|
|
@@ -1,12 +1,12 @@
|
|
|
<template>
|
|
|
<div>
|
|
|
- <el-button type="primary" size="small" @click="submit()" plain style="margin-bottom: 10px;margin-top: -10px">导 出</el-button>
|
|
|
+ <el-button type="primary" size="small" @click="submit()" plain >导 出</el-button>
|
|
|
</div>
|
|
|
</template>
|
|
|
|
|
|
<script>
|
|
|
export default {
|
|
|
- props:['tablecols','param','excelTitle','total'],
|
|
|
+ props:['tablecols','param','excelTitle','total','specialKey'],
|
|
|
data () {
|
|
|
return {}
|
|
|
},
|
|
|
@@ -14,26 +14,30 @@ export default {
|
|
|
async submit () {
|
|
|
let data = {}
|
|
|
// 如果传入了total,需要赋值保证数量准确性
|
|
|
+ // data = Object.assign({},data,this.param)
|
|
|
+ data = JSON.parse(JSON.stringify(this.param))
|
|
|
if (this.total) {
|
|
|
- this.param.content.pageSize = this.total
|
|
|
+ data.content.pageSize = this.total
|
|
|
}
|
|
|
- data = JSON.parse(JSON.stringify(this.param))
|
|
|
+ data.content.isAll = false
|
|
|
|
|
|
- data.content.isAll = true
|
|
|
const res = await this.$api.requested(data)
|
|
|
- console.log(res,"res111")
|
|
|
+
|
|
|
+ if (this.specialKey){
|
|
|
+ res.data.forEach(e=>{
|
|
|
+ this.specialKey.forEach(s=>{
|
|
|
+ e[s.key] = e[s.key]? e[s.key]:[]
|
|
|
+ e[s.key] = e[s.key].map(k=>{return s.value?k[s.value]:k}).toString()
|
|
|
+ })
|
|
|
+ })
|
|
|
+ }
|
|
|
+
|
|
|
let table = JSON.parse(JSON.stringify(this.tablecols))
|
|
|
table.forEach((e,index) => {
|
|
|
// 由于表格数据结构问题这里需要判断一下
|
|
|
- /* console.log(res)*/
|
|
|
- console.log(index)
|
|
|
if (e.title === '省市县') {
|
|
|
table[index].title = '省'
|
|
|
table.splice(index + 1,0,{title:'市',columnname:'city'},{title:'县',columnname:'county'})
|
|
|
- }else if(e.title === '型号/规格'){
|
|
|
- res.data.forEach(e => {
|
|
|
- e.model = e.model + '/' + e.spec
|
|
|
- })
|
|
|
}else if(e.title === '需求日期'){
|
|
|
res.data.forEach(e => {
|
|
|
if (e.delivery === 0){
|
|
|
@@ -42,17 +46,9 @@ export default {
|
|
|
e.needdate = e.needdate
|
|
|
}
|
|
|
})
|
|
|
- }else if(e.title === '回复交期'){
|
|
|
- res.data.forEach(e => {
|
|
|
- if (e.delivery === 0){
|
|
|
- e.deliverydate = '不管控交期'
|
|
|
- }else {
|
|
|
- e.deliverydate = e.deliverydate
|
|
|
- }
|
|
|
- })
|
|
|
- }else if(e.title === '小计'){
|
|
|
+ }else if(e.title === '型号/规格'){
|
|
|
res.data.forEach(e => {
|
|
|
- e.totalprice = e.price * e.qty
|
|
|
+ e.model = e.model + '/' + e.spec
|
|
|
})
|
|
|
}
|
|
|
});
|