|
@@ -54,7 +54,7 @@
|
|
>
|
|
>
|
|
</el-form-item>
|
|
</el-form-item>
|
|
<el-form-item>
|
|
<el-form-item>
|
|
- <el-button type="primary" @click="addSaleOrder"
|
|
|
|
|
|
+ <el-button type="primary" @click="addSaleOrder1"
|
|
>重新生成计划</el-button
|
|
>重新生成计划</el-button
|
|
>
|
|
>
|
|
</el-form-item>
|
|
</el-form-item>
|
|
@@ -439,7 +439,8 @@ export default {
|
|
'saleOrderReceiveCustomer',
|
|
'saleOrderReceiveCustomer',
|
|
'salerName',
|
|
'salerName',
|
|
'saleOrderNo',
|
|
'saleOrderNo',
|
|
- 'saleArea'
|
|
|
|
|
|
+ 'saleArea',
|
|
|
|
+ 'saleOrderId'
|
|
],
|
|
],
|
|
saleOrderMapList: [
|
|
saleOrderMapList: [
|
|
'orderNo',
|
|
'orderNo',
|
|
@@ -479,18 +480,12 @@ export default {
|
|
}
|
|
}
|
|
this.remarkDateNew = this.getRemarkDate()
|
|
this.remarkDateNew = this.getRemarkDate()
|
|
this.remarkDateOld = this.getRemarkDateOld()
|
|
this.remarkDateOld = this.getRemarkDateOld()
|
|
|
|
+ this.addSaleOrder1 = this.debounce(() => {
|
|
|
|
+ this.addSaleOrder()
|
|
|
|
+ }, 3000)
|
|
this.getSteelReport()
|
|
this.getSteelReport()
|
|
},
|
|
},
|
|
- watch: {
|
|
|
|
- tableData: {
|
|
|
|
- handler(oldVal, newVal) {
|
|
|
|
- this.filterListChange()
|
|
|
|
- this.toggleSelection(newVal)
|
|
|
|
- },
|
|
|
|
- deep: true,
|
|
|
|
- immediate: true
|
|
|
|
- }
|
|
|
|
- },
|
|
|
|
|
|
+ watch: {},
|
|
computed: {},
|
|
computed: {},
|
|
mounted() {
|
|
mounted() {
|
|
this.$nextTick(() => {
|
|
this.$nextTick(() => {
|
|
@@ -506,12 +501,18 @@ export default {
|
|
},
|
|
},
|
|
computed: {},
|
|
computed: {},
|
|
methods: {
|
|
methods: {
|
|
- toggleSelection() {
|
|
|
|
- this.$nextTick(() => {
|
|
|
|
- this.$refs.tableRef.toggleAllSelection()
|
|
|
|
- })
|
|
|
|
|
|
+ //防抖函数--防止用户重复点击
|
|
|
|
+ debounce(func, delay) {
|
|
|
|
+ let timer = null
|
|
|
|
+ return function(...args) {
|
|
|
|
+ if (timer !== null) {
|
|
|
|
+ clearTimeout(timer)
|
|
|
|
+ }
|
|
|
|
+ timer = setTimeout(function() {
|
|
|
|
+ func.apply(this, args)
|
|
|
|
+ }, delay)
|
|
|
|
+ }
|
|
},
|
|
},
|
|
- handleSelectionChange() {},
|
|
|
|
//记录每一行的合并数
|
|
//记录每一行的合并数
|
|
getSpanArr(data) {
|
|
getSpanArr(data) {
|
|
//每次调用方法初始化
|
|
//每次调用方法初始化
|
|
@@ -550,97 +551,86 @@ export default {
|
|
}
|
|
}
|
|
},
|
|
},
|
|
addSaleOrder() {
|
|
addSaleOrder() {
|
|
- //
|
|
|
|
- let remark = '10.20钢材成都组'
|
|
|
|
- console.log(remark.split(this.getRemarkDateOld)[0])
|
|
|
|
- const loading = this.$loading({
|
|
|
|
- lock: true,
|
|
|
|
- text: '正在快马加鞭为您生成上传销售订单,请稍候',
|
|
|
|
- spinner: 'el-icon-loading',
|
|
|
|
- background: 'rgba(0, 0, 0, 0.7)'
|
|
|
|
- })
|
|
|
|
- let closeEntryList = []
|
|
|
|
- this.$refs.tableRef.selection.forEach(e => {
|
|
|
|
- let map = {}
|
|
|
|
- e.saleRemark = this.remarkDateNew + e.saleRemark.split[1]
|
|
|
|
- map.saleMaterialId = e.saleMaterialId
|
|
|
|
- map.closeEntryId = e.closeEntryId
|
|
|
|
- map.number = e.saleOrderNo
|
|
|
|
- closeEntryList.push(map)
|
|
|
|
- })
|
|
|
|
- console.log(this.$refs.tableRef.selection)
|
|
|
|
- return
|
|
|
|
- const map1 = this.$refs.tableRef.selection.reduce((result, item) => {
|
|
|
|
- result[item.saleOrderNo] = result[item.saleOrderNo] || []
|
|
|
|
- result[item.saleOrderNo].push(item)
|
|
|
|
- return result
|
|
|
|
- }, {})
|
|
|
|
- let result = Object.values(map1)
|
|
|
|
- //遍历数组
|
|
|
|
- let saleOrderListMap = []
|
|
|
|
- console.log(result)
|
|
|
|
- result.forEach((saleOrderList, index) => {
|
|
|
|
- let map = {}
|
|
|
|
- let arr = []
|
|
|
|
- saleOrderList.forEach(e => {
|
|
|
|
- let mapMaterial = {}
|
|
|
|
- Object.keys(e).forEach(e1 => {
|
|
|
|
- if (this.saleOrderList.includes(e1)) {
|
|
|
|
- map[e1] = e[e1]
|
|
|
|
- }
|
|
|
|
- if (this.saleOrderMapList.includes(e1)) {
|
|
|
|
- mapMaterial[e1] = e[e1]
|
|
|
|
- }
|
|
|
|
|
|
+ this.$confirm(
|
|
|
|
+ `确定将所选${this.$refs.tableRef.selection.length}条分录重新上传金蝶?`,
|
|
|
|
+ '提示',
|
|
|
|
+ {
|
|
|
|
+ cancelButtonText: '取消',
|
|
|
|
+ confirmButtonText: '确定',
|
|
|
|
+ center: true
|
|
|
|
+ }
|
|
|
|
+ )
|
|
|
|
+ .then(() => {
|
|
|
|
+ const loading = this.$loading({
|
|
|
|
+ lock: true,
|
|
|
|
+ text: '正在快马加鞭为您生成上传销售订单,请稍候',
|
|
|
|
+ spinner: 'el-icon-loading',
|
|
|
|
+ background: 'rgba(0, 0, 0, 0.7)'
|
|
})
|
|
})
|
|
- mapMaterial.saleDateOfReceipt = sjTime(this.saleDateOfReceipt)
|
|
|
|
- arr.push(mapMaterial)
|
|
|
|
- })
|
|
|
|
- map.shipperId = 1
|
|
|
|
- map.mapList = arr
|
|
|
|
- map.isUploadEas = 1
|
|
|
|
- saleOrderListMap.push(map)
|
|
|
|
- })
|
|
|
|
- this.axios
|
|
|
|
- .post('/api/v1/ams/addSteelSaleOrderList', saleOrderListMap)
|
|
|
|
- .then(res => {
|
|
|
|
- if (res.data.code == '200') {
|
|
|
|
- loading.close()
|
|
|
|
- this.getSteelReport()
|
|
|
|
- this.$message.success('新增上传销售订单成功!')
|
|
|
|
- this.tableData = []
|
|
|
|
- } else {
|
|
|
|
- this.$message.error(res.data.data)
|
|
|
|
- this.getSteelReport()
|
|
|
|
- loading.close()
|
|
|
|
- this.tableData = []
|
|
|
|
- }
|
|
|
|
- })
|
|
|
|
- .catch(e => {
|
|
|
|
- this.$message.error('生成错误!')
|
|
|
|
- loading.close()
|
|
|
|
- this.tableData = []
|
|
|
|
- })
|
|
|
|
- const loadings = this.$loading({
|
|
|
|
- lock: true,
|
|
|
|
- text: '正在关闭上一个分录,请稍候',
|
|
|
|
- spinner: 'el-icon-loading',
|
|
|
|
- background: 'rgba(0, 0, 0, 0.7)'
|
|
|
|
- })
|
|
|
|
- this.axios
|
|
|
|
- .post('/api/v1/ams/closingEntries', closeEntryList)
|
|
|
|
- .then(res => {
|
|
|
|
- if (res.data.code == '200') {
|
|
|
|
- loadings.close()
|
|
|
|
- this.$message.success('关闭成功')
|
|
|
|
- } else {
|
|
|
|
- this.$message.error('关闭失败')
|
|
|
|
- this.getSteelReport()
|
|
|
|
- loadings.close()
|
|
|
|
- }
|
|
|
|
|
|
+ let closeEntryList = []
|
|
|
|
+ this.$refs.tableRef.selection.forEach(e => {
|
|
|
|
+ let map = {}
|
|
|
|
+ e.saleRemark = this.remarkDateNew + e.saleRemark.split[1]
|
|
|
|
+ map.saleMaterialId = e.saleMaterialId
|
|
|
|
+ map.closeEntryId = e.closeEntryId
|
|
|
|
+ map.number = e.saleOrderNo
|
|
|
|
+ closeEntryList.push(map)
|
|
|
|
+ })
|
|
|
|
+ const map1 = this.$refs.tableRef.selection.reduce((result, item) => {
|
|
|
|
+ result[item.saleOrderNo] = result[item.saleOrderNo] || []
|
|
|
|
+ result[item.saleOrderNo].push(item)
|
|
|
|
+ return result
|
|
|
|
+ }, {})
|
|
|
|
+ let result = Object.values(map1)
|
|
|
|
+ //遍历数组
|
|
|
|
+ let saleOrderListMap = []
|
|
|
|
+ console.log(result)
|
|
|
|
+ result.forEach((saleOrderList, index) => {
|
|
|
|
+ let map = {}
|
|
|
|
+ let arr = []
|
|
|
|
+ saleOrderList.forEach(e => {
|
|
|
|
+ let mapMaterial = {}
|
|
|
|
+ Object.keys(e).forEach(e1 => {
|
|
|
|
+ if (this.saleOrderList.includes(e1)) {
|
|
|
|
+ map[e1] = e[e1]
|
|
|
|
+ }
|
|
|
|
+ if (this.saleOrderMapList.includes(e1)) {
|
|
|
|
+ mapMaterial[e1] = e[e1]
|
|
|
|
+ }
|
|
|
|
+ })
|
|
|
|
+ mapMaterial.saleDateOfReceipt = sjTime(this.saleDateOfReceipt)
|
|
|
|
+ arr.push(mapMaterial)
|
|
|
|
+ })
|
|
|
|
+ map.shipperId = 1
|
|
|
|
+ map.mapList = arr
|
|
|
|
+ map.isUploadEas = 1
|
|
|
|
+ saleOrderListMap.push(map)
|
|
|
|
+ })
|
|
|
|
+ this.axios
|
|
|
|
+ .post('/api/v1/ams/addUnloadSteelSaleOrderList', saleOrderListMap)
|
|
|
|
+ .then(res => {
|
|
|
|
+ if (res.data.code == '200') {
|
|
|
|
+ this.axios
|
|
|
|
+ .post('/api/v1/ams/closingEntries', closeEntryList)
|
|
|
|
+ .then(res => {
|
|
|
|
+ if (res.data.code == '200') {
|
|
|
|
+ this.getSteelReport()
|
|
|
|
+ loading.close()
|
|
|
|
+ this.$message({
|
|
|
|
+ type: 'success',
|
|
|
|
+ offset: '250'
|
|
|
|
+ })
|
|
|
|
+ }
|
|
|
|
+ })
|
|
|
|
+ }
|
|
|
|
+ })
|
|
})
|
|
})
|
|
- .catch(e => {
|
|
|
|
- this.$message.error('关闭错误!')
|
|
|
|
- loadings.close()
|
|
|
|
|
|
+ .catch(() => {
|
|
|
|
+ this.$message({
|
|
|
|
+ type: 'info',
|
|
|
|
+ message: '取消操作',
|
|
|
|
+ offset: '200'
|
|
|
|
+ })
|
|
})
|
|
})
|
|
},
|
|
},
|
|
getRemarkDate() {
|
|
getRemarkDate() {
|
|
@@ -890,9 +880,9 @@ export default {
|
|
)
|
|
)
|
|
.then(res => {
|
|
.then(res => {
|
|
this.tableData = res.data.data
|
|
this.tableData = res.data.data
|
|
- this.filters1 = res.data.data.consigneeName
|
|
|
|
- console.log('客户数据')
|
|
|
|
- console.log(res.data.data.consigneeName)
|
|
|
|
|
|
+ this.$nextTick(() => {
|
|
|
|
+ this.$refs.tableRef.toggleAllSelection()
|
|
|
|
+ })
|
|
this.getSpanArr(res.data.data)
|
|
this.getSpanArr(res.data.data)
|
|
loading.close()
|
|
loading.close()
|
|
})
|
|
})
|
|
@@ -969,6 +959,9 @@ export default {
|
|
)
|
|
)
|
|
.then(res => {
|
|
.then(res => {
|
|
this.tableData = res.data.data
|
|
this.tableData = res.data.data
|
|
|
|
+ this.$nextTick(() => {
|
|
|
|
+ this.$refs.tableRef.toggleAllSelection()
|
|
|
|
+ })
|
|
this.getSpanArr(res.data.data)
|
|
this.getSpanArr(res.data.data)
|
|
})
|
|
})
|
|
}
|
|
}
|