刘璐珈

This commit is contained in:
Vergil
2020-02-28 17:36:18 +08:00
parent 7ee104c1b4
commit f6af07c412
26 changed files with 1033 additions and 592 deletions

View File

@@ -3,7 +3,25 @@
<el-card>
<el-input v-model="invoiceNumber" placeholder="发货单号和收货单位" clearable style="width: 200px;margin-right: 10px" size="small" @keyup.enter.native="openSearch"/>
<!--<el-input v-model="receivingUnit" placeholder="请输入收货单位" clearable style="width: 150px;margin-right: 10px" size="mini"/>-->
<span style="font-size: 13px;margin-left: 10px">发货时间</span>
<el-date-picker
v-model="dateRange"
:picker-options="pickerOptions"
size="small"
type="daterange"
align="center"
style="width: 240px;margin: 3px 0"
value-format="yyyy-MM-dd"
format="yyyy-MM-dd"
range-separator=""
start-placeholder="开始日期"
end-placeholder="结束日期"/>
<el-button type="primary" icon="el-icon-search" size="mini" style="margin-left: 10px" plain @click="openSearch">查询</el-button>
<el-tooltip :open-delay="1200" effect="dark" content="导出" placement="top">
<div style="display: inline-block">
<el-button type="primary" plain class="el-icon-download" size="small" style="margin: 10px 0 0 10px" @click="exportExcel">导出</el-button>
</div>
</el-tooltip>
</el-card>
<el-card>
<el-col :span="12">
@@ -123,10 +141,40 @@
</template>
<script>
import { InvoiceListSearch, DetailsFeach } from '@/api/MarketingCenter/ShippingInquiries'
import { getNowShotTime } from '@/utils/tool'
import { InvoiceListSearch, DetailsFeach, InvoiceListSearch_Excel } from '@/api/MarketingCenter/ShippingInquiries'
export default {
data() {
return {
dateRange: '',
check1: '',
pickerOptions: {
shortcuts: [{
text: '上季度',
onClick(picker) {
const end = new Date()
const start = new Date()
start.setTime(end.getTime() - 3600 * 1000 * 24 * 30 * 3)
picker.$emit('pick', [start, end])
}
}, {
text: '过去半年',
onClick(picker) {
const end = new Date()
const start = new Date()
start.setTime(end.getTime() - 3600 * 1000 * 24 * 366 / 2)
picker.$emit('pick', [start, end])
}
}, {
text: '过去一年',
onClick(picker) {
const end = new Date()
const start = new Date()
start.setTime(end.getTime() - 3600 * 1000 * 24 * 365)
picker.$emit('pick', [start, end])
}
}]
},
tableDataSearchList: [],
invoiceNumber: '',
receivingUnit: '',
@@ -140,11 +188,73 @@ export default {
this.openSearch()
},
methods: {
formatJson(filterVal, jsonData) {
return jsonData.map(v => filterVal.map(j => {
return v[j]
}))
},
exportExcel() {
this.tableDataSearchList = []
this.invoiceNumber !== null && this.invoiceNumber !== '' ? this.invoiceNumber_check = 1 : this.invoiceNumber_check = 0
this.receivingUnit !== null && this.receivingUnit !== '' ? this.receivingUnit_check = 1 : this.receivingUnit_check = 0
this.dateRange ? this.check1 = 1 : (this.check1 = 0, this.dateRange = '')
InvoiceListSearch_Excel(this.invoiceNumber, this.receivingUnit, this.invoiceNumber_check, this.receivingUnit_check, this.check1, this.dateRange[0], this.dateRange[1]).then(val => {
console.log(val)
// for (let i = 0; i < val.data.length; i++) {
// // if (val.data[i].投标结果 !== '' && val.data[i].交付日期 !== null) {
// // val.data[i].交付日期 = val.data[i].交付日期.substring(0, val.data[i].交付日期.length - 8)
// // }
// if (val.data[i].投标结果 === 0) {
// val.data[i].投标结果 = ''
// } else if (val.data[i].投标结果 === 1) {
// val.data[i].投标结果 = '已中标'
// } else if (val.data[i].投标结果 === 2) {
// val.data[i].投标结果 = '未中标'
// }
// if (val.data[i].公布日期 !== '' && val.data[i].公布日期 !== null) {
// val.data[i].公布日期 = val.data[i].公布日期.substring(0, val.data[i].公布日期.length - 8)
// }
// if (val.data[i].投标日期 !== '' && val.data[i].投标日期 !== null) {
// val.data[i].投标日期 = val.data[i].投标日期.substring(0, val.data[i].投标日期.length - 8)
// }
// // if (val.data[i].投标日期 !== '' && val.data[i].投标日期 !== null) {
// // val.data[i].投标日期 = val.data[i].投标日期.substring(0, val.data[i].投标日期.length - 8)
// // }
// if (parseInt(val.data[i].是否收回) !== 2) {
// val.data[i].应收回金额 = '未收回'
// } else {
// val.data[i].应收回金额 = (val.data[i].应收回金额).toFixed(2)
// }
// val.data[i].保证金金额 = (val.data[i].保证金金额).toFixed(2)
// val.data[i].中标服务费 = (val.data[i].中标服务费).toFixed(2)
// val.data[i].未收金额 = (val.data[i].未收金额).toFixed(2)
// val.data[i].转履约保证金金额 = (val.data[i].转履约保证金金额).toFixed(2)
// }
if (val.length !== 0) {
import('@/vendor/Export2Excel').then(excel => {
const tHeader = ['状态', '发货单号', '收货单位', '收货人', '联系电话', '收货地址', '发货日期', '车辆牌号', '司机姓名', '司机电话', '货品类别', '货品编号', '货品名称', '货品规格', '货品型号', '数量', '设计者']
const filterVal = ['状态', '发货单号', '收货单位', '收货人', '联系电话', '收货地址', '发货日期', '车辆牌号', '司机姓名', '司机电话', '货品类别', '货品编号', '货品名称', '货品规格', '货品型号', '数量', '设计者']
const list = val.data
const data = this.formatJson(filterVal, list)
excel.export_json_to_excel({
header: tHeader,
data,
filename: getNowShotTime() + '发货记录',
autoWidth: true,
bookType: 'xlsx'
})
})
} else {
this.$message.warning('没有导出内容')
}
})
},
openSearch() {
this.tableDataSearchList = []
this.invoiceNumber !== null && this.invoiceNumber !== '' ? this.invoiceNumber_check = 1 : this.invoiceNumber_check = 0
this.receivingUnit !== null && this.receivingUnit !== '' ? this.receivingUnit_check = 1 : this.receivingUnit_check = 0
InvoiceListSearch(this.invoiceNumber, this.receivingUnit, this.invoiceNumber_check, this.receivingUnit_check).then(response => {
this.dateRange ? this.check1 = 1 : (this.check1 = 0, this.dateRange = '')
InvoiceListSearch(this.invoiceNumber, this.receivingUnit, this.invoiceNumber_check, this.receivingUnit_check, this.check1, this.dateRange[0], this.dateRange[1]).then(response => {
if (response.data.length !== 0) {
this.tableDataSearchList = response.data
}