From c827494faaff4bbc19cfc00aa1202864df601eb8 Mon Sep 17 00:00:00 2001 From: shawnzhang Date: Thu, 30 Jul 2020 18:10:14 +0800 Subject: [PATCH] =?UTF-8?q?7/30=20=E5=89=8D=E4=BF=AE=E6=94=B9=E9=97=AE?= =?UTF-8?q?=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 34 + src/api/Product.js | 3 + src/lang/en.js | 2 + src/lang/zh.js | 2 + src/views/CheckReport/AddCheckReport.vue | 50 +- .../CheckReport/components/DetailReport.vue | 1 + .../CheckReport/components/DetailReport2.vue | 1 + .../CheckReport/components/DetailReport3.vue | 1 + .../CheckReport/components/DetailReport4.vue | 1 + src/views/Financecount/collectAndPay.vue | 12 + src/views/Financecount/expensesSummary.vue | 4 +- .../InventoryCount/AddInventoryCount.vue | 731 ++++++++----- .../InventoryCount/components/MyDetail.vue | 6 +- .../InventoryCount/components/MyDialog.vue | 312 ++++-- src/views/Product/ProductList.vue | 5 +- .../ReturnExchange/AddReturnExchange.vue | 129 ++- src/views/SaleOrder/Addreturnordermoney.vue | 73 +- src/views/SaleOrder/components/MyDialog2.vue | 19 +- src/views/SaleOut/AddSaleOut.vue | 6 +- src/views/SaleOut/components/DetailList.vue | 4 +- src/views/SaleOut/components/MyDialog.vue | 803 +++++++------- src/views/SaleOut/components/MyDialog2.vue | 992 +++++++++--------- src/views/SaleOut/components/MyDialog3.vue | 956 +++++++++-------- src/views/StockInvoice/components/MyEnter.vue | 22 +- .../Stockenter/components/DetailList.vue | 2 +- .../SupplierAdjust/components/MyDialog.vue | 1 - src/views/Transfer/AddTransfer.vue | 2 +- src/views/Transfer/components/MyDialog.vue | 2 + src/views/income/components/MyDialog.vue | 10 +- src/views/operation/operationList.vue | 2 +- 30 files changed, 2404 insertions(+), 1784 deletions(-) diff --git a/README.md b/README.md index 6d0ffd2b..b63427ff 100644 --- a/README.md +++ b/README.md @@ -488,4 +488,38 @@ for (let i = 0, l = newarr.length; i < l - 1; i++) { return time.getTime() > _now || time.getTime() < sevenDays } }, +``` + +#### 去除json中重复数据 + +``` +uniqueArray(array, key) { + var result = [array[0]] + for (var i = 1; i < array.length; i++) { + var item = array[i] + var repeat = false + for (var j = 0; j < result.length; j++) { + if (item[key] === result[j][key]) { + repeat = true + break + } + } + if (!repeat) { + result.push(item) + } + } + return result + }, + + const nowlistdata = this.$refs.editable.getRecords() + this.$refs.editable.clear() + console.log('val============', val) + const alldata = [...nowlistdata, ...val] + const filterdata = this.uniqueArray(alldata, 'productCode') + console.log('filterdata=====', filterdata) + // this.list2 = filterdata + for (let i = 0; i < filterdata.length; i++) { + // val[i].quantity = 1 + this.$refs.editable.insert(filterdata[i]) + } ``` \ No newline at end of file diff --git a/src/api/Product.js b/src/api/Product.js index 63e42c7b..6a09971c 100644 --- a/src/api/Product.js +++ b/src/api/Product.js @@ -424,6 +424,9 @@ export function productlist(query) { if (query.categoryid !== '' && query.categoryid !== null && query.categoryid !== undefined) { params.append('categoryid', query.categoryid) // 你要传给后台的参数值 key/value } + if (query.detailCategoryId !== '' && query.detailCategoryId !== null && query.detailCategoryId !== undefined) { + params.append('detailCategoryId', query.detailCategoryId) // 你要传给后台的参数值 key/value + } if (query.typeid !== '' && query.typeid !== null && query.typeid !== undefined) { params.append('typeid', query.typeid) // 你要传给后台的参数值 key/value } diff --git a/src/lang/en.js b/src/lang/en.js index 80f165d8..48e67ea6 100644 --- a/src/lang/en.js +++ b/src/lang/en.js @@ -4054,6 +4054,8 @@ export default { createTime: 'create time' }, collectAndPay: { + preReturn: 'preReturn', + hhd: 'exchange', time: 'time', saleOut: 'sales stock out', stockRetreat: 'purchase return', diff --git a/src/lang/zh.js b/src/lang/zh.js index f22f918c..f4d1dfef 100644 --- a/src/lang/zh.js +++ b/src/lang/zh.js @@ -4054,6 +4054,8 @@ export default { createTime: '创建时间' }, collectAndPay: { + preReturn: '预收退款', + hhd: '换货单', time: '时间', saleOut: '销售出库', stockRetreat: '采购退货', diff --git a/src/views/CheckReport/AddCheckReport.vue b/src/views/CheckReport/AddCheckReport.vue index 59369d21..2b3a465b 100644 --- a/src/views/CheckReport/AddCheckReport.vue +++ b/src/views/CheckReport/AddCheckReport.vue @@ -1117,28 +1117,32 @@ export default { }, // 清空记录 restAllForm() { - this.personalForm = { - createPersonId: this.$store.getters.userId, - countryId: this.$store.getters.countryId, - repositoryId: this.$store.getters.repositoryId, - regionId: this.$store.getters.regionId, - inspectionPersonId: this.$store.getters.userId, - isRecheck: 1, - sampleQuantity: null, - checkQuantity: null, - failedQuantity: '', - passQuantity: '', - checkMode: '1', - checkType: '1', - checkDate: null, - checkResult: '1', - checkPersonId: this.$store.getters.userId - } - this.judgequilty = null - this.inspectionPersonId = this.$store.getters.name - this.workCenterId = null - this.produceManagerId = null - this.checkPersonId = this.$store.getters.name + this.personalForm.productName = '' + this.personalForm.unit = '' + this.typeId = '' + this.personalForm.typeId = '' + // this.personalForm = { + // createPersonId: this.$store.getters.userId, + // countryId: this.$store.getters.countryId, + // repositoryId: this.$store.getters.repositoryId, + // regionId: this.$store.getters.regionId, + // inspectionPersonId: this.$store.getters.userId, + // isRecheck: 1, + // sampleQuantity: null, + // checkQuantity: null, + // failedQuantity: '', + // passQuantity: '', + // checkMode: '1', + // checkType: '1', + // checkDate: null, + // checkResult: '1', + // checkPersonId: this.$store.getters.userId + // } + // this.judgequilty = null + // this.inspectionPersonId = this.$store.getters.name + // this.workCenterId = null + // this.produceManagerId = null + // this.checkPersonId = this.$store.getters.name this.getdatatime() }, // 保存操作 @@ -1232,7 +1236,7 @@ export default { this.restAllForm() this.$refs.editable.clear() this.$refs.personalForm.clearValidate() - this.$refs.personalForm.resetFields() + this.$refs.personalForm2.clearValidate() this.$refs.personalForm2.resetFields() this.$refs.personalForm3.clearValidate() diff --git a/src/views/CheckReport/components/DetailReport.vue b/src/views/CheckReport/components/DetailReport.vue index 1f9fe346..b2a0564d 100644 --- a/src/views/CheckReport/components/DetailReport.vue +++ b/src/views/CheckReport/components/DetailReport.vue @@ -120,6 +120,7 @@ export default { watch: { reportcontrol() { this.editVisible = this.reportcontrol + this.getdata() if (this.reportcontrol) { setTimeout(() => { this.tableHeight = window.innerHeight - this.$refs.table.$el.offsetTop - 180 diff --git a/src/views/CheckReport/components/DetailReport2.vue b/src/views/CheckReport/components/DetailReport2.vue index 69c1a738..9edf9845 100644 --- a/src/views/CheckReport/components/DetailReport2.vue +++ b/src/views/CheckReport/components/DetailReport2.vue @@ -110,6 +110,7 @@ export default { watch: { reportcontrol2() { this.editVisible = this.reportcontrol2 + this.getData() if (this.reportcontrol2) { setTimeout(() => { this.tableHeight = window.innerHeight - this.$refs.table.$el.offsetTop - 180 diff --git a/src/views/CheckReport/components/DetailReport3.vue b/src/views/CheckReport/components/DetailReport3.vue index fea9b745..76a768a3 100644 --- a/src/views/CheckReport/components/DetailReport3.vue +++ b/src/views/CheckReport/components/DetailReport3.vue @@ -99,6 +99,7 @@ export default { watch: { reportcontrol3() { this.editVisible = this.reportcontrol3 + this.getData() if (this.reportcontrol3) { setTimeout(() => { this.tableHeight = window.innerHeight - this.$refs.table.$el.offsetTop - 180 diff --git a/src/views/CheckReport/components/DetailReport4.vue b/src/views/CheckReport/components/DetailReport4.vue index f1a0e6e1..20605988 100644 --- a/src/views/CheckReport/components/DetailReport4.vue +++ b/src/views/CheckReport/components/DetailReport4.vue @@ -94,6 +94,7 @@ export default { watch: { reportcontrol4() { this.editVisible = this.reportcontrol4 + this.getdata() if (this.reportcontrol4) { setTimeout(() => { this.tableHeight = window.innerHeight - this.$refs.table.$el.offsetTop - 180 diff --git a/src/views/Financecount/collectAndPay.vue b/src/views/Financecount/collectAndPay.vue index d0da3e21..9646df6f 100644 --- a/src/views/Financecount/collectAndPay.vue +++ b/src/views/Financecount/collectAndPay.vue @@ -75,6 +75,18 @@ sortable width="240" align="center"/> + + { const value = Number(curr) if (!isNaN(value)) { - return (Number(prev) + Number(curr)).toFixed(6) + return (Number(prev) + Number(curr)).toFixed(2) } else { - return (Number(prev)).toFixed(6) + return (Number(prev)).toFixed(2) } }, 0) sums[index] += '' diff --git a/src/views/InventoryCount/AddInventoryCount.vue b/src/views/InventoryCount/AddInventoryCount.vue index 90c84eb4..1806e8bf 100644 --- a/src/views/InventoryCount/AddInventoryCount.vue +++ b/src/views/InventoryCount/AddInventoryCount.vue @@ -91,10 +91,21 @@ @selection-change="handleSelectionChange"> - + + + @@ -106,18 +117,11 @@ - - + @@ -199,7 +203,7 @@
- {{ $t('Hmodule.baoc') }} + {{ $t('Hmodule.baoc') }} {{ $t('updates.jxlr') }} {{ $t('Hmodule.cancel') }}
@@ -239,7 +243,7 @@ import '@/directive/noMoreClick/index.js' import { getdeptlist } from '@/api/BasicSettings' import { addinventorycount } from '@/api/InventoryCount' -import { batchlist, getQuantity, getlocation, countlist } from '@/api/public' +import { batchlist, getQuantity, getlocation, countlist, locationlist } from '@/api/public' import MyCreate from './components/MyCreate' import MyRepository from './components/MyRepository' import MyDetail from './components/MyDetail' @@ -280,6 +284,7 @@ export default { } } return { + saveloading: false, heji1: 0, heji2: 0, heji3: 0, @@ -367,7 +372,7 @@ export default { num4 += this.list2[i].price * this.list2[i].inventoryQuantity num5 += this.list2[i].price * this.list2[i].actualQuantity num6 += this.list2[i].price * this.list2[i].diffQuantity - console.log('this.list2[i].diffQuantity', this.list2[i].diffQuantity) + // console.log('this.list2[i].diffQuantity', this.list2[i].diffQuantity) } this.heji1 = num1 this.heji2 = num2 @@ -388,6 +393,68 @@ export default { _that = this }, methods: { + getBatch(row) { + if (row.flag === undefined) { + row.flag = true + } else { + return row.batch + } + if (row.flag) { + const parms3 = row.productCode + // batchlist(this.personalForm.countRepositoryId, parms3).then(res => { + // if (res.data.data.content.length !== 0) { + // row.batch = res.data.data.content[0] + // } + // }) + getlocation(this.personalForm.countRepositoryId, row).then(res => { + if (res.data.ret === 200) { + if (res.data.data.content.length !== 0) { + if (res.data.data.content.length === 1) { + row.locationId = res.data.data.content[0].id + } + this.locationlist = res.data.data.content + } else if (res.data.data.content.length === 0) { + locationlist(this.personalForm.countRepositoryId).then(res => { + if (res.data.ret === 200) { + this.locationlist = res.data.data.content.list + } + }) + } + } + }) + // return row.batch + } + row.flag = false + }, + updateLocation(event, scope) { + if (event === true) { + console.log(this.personalForm.countRepositoryId) + if (!this.personalForm.countRepositoryId) { + this.$notify.error({ + title: 'wrong', + message: this.$t('prompt.sqslcg'), + offset: 100 + }) + return false + } + getlocation(this.personalForm.countRepositoryId, scope.row).then(res => { + if (res.data.ret === 200) { + if (res.data.data.content.length !== 0) { + if (res.data.data.content.length === 1) { + scope.row.locationId = res.data.data.content[0].id + } + this.locationlist = res.data.data.content + } else if (res.data.data.content.length === 0) { + locationlist(this.personalForm.countRepositoryId).then(res => { + if (res.data.ret === 200) { + this.locationlist = res.data.data.content.list + } + }) + } + } + }) + } + }, getLocationData(row) { // 默认批次 // if (row.batch === null || row.batch === '' || row.batch === undefined) { @@ -473,8 +540,8 @@ export default { }, // 差异数量 getDiff(par1, par2, par3) { - console.log('par1', par1) - console.log('par2', par2) + // console.log('par1', par1) + // console.log('par2', par2) par3.diffQuantity = Math.abs(par2 - par1) let num1 = 0 let num2 = 0 @@ -504,50 +571,56 @@ export default { return quan * pric }, getquantity(sco) { - const parms2 = sco.locationId - const parms3 = sco.productCode - const parms4 = sco.batch - if (parms4 !== '' && parms4 !== null && parms4 !== undefined) { - getQuantity(this.personalForm.countRepositoryId, parms2, parms3, parms4).then(res => { - this.out = res.data.data.content - sco.inventoryQuantity = res.data.data.content - }) - return sco.inventoryQuantity - } else { - sco.inventoryQuantity = 0 - return sco.inventoryQuantity + if (sco.flag === undefined) { + sco.flag = true } - }, - updatebatch(event, scope) { - if (event === true) { - console.log(this.personalForm.countRepositoryId) - if (this.personalForm.countRepositoryId === undefined || this.personalForm.countRepositoryId === '') { - this.$notify.error({ - title: 'wrong', - message: this.$t('prompt.sqslcg'), - offset: 100 + if (sco.flag) { + const parms2 = sco.locationId + const parms3 = sco.productCode + const parms4 = sco.batch + if (parms4 !== '' && parms4 !== null && parms4 !== undefined) { + getQuantity(this.personalForm.countRepositoryId, parms2, parms3, parms4).then(res => { + this.out = res.data.data.content + sco.inventoryQuantity = res.data.data.content }) - return false + return sco.inventoryQuantity + } else { + sco.inventoryQuantity = 0 + return sco.inventoryQuantity } - getlocation(this.personalForm.countRepositoryId, scope.row).then(res => { - if (res.data.ret === 200) { - if (res.data.data.content.length !== 0) { - this.locationlist = res.data.data.content - scope.row.locationId = res.data.data.content[0].id - this.updatebatch3(scope) - } else if (res.data.data.content.length === 0) { - this.$notify.error({ - title: 'wrong', - message: this.$t('prompt.gckmygsp'), - offset: 100 - }) - this.locationlist = [] - return false - } - } - }) } + sco.flag = false }, + // updatebatch(event, scope) { + // if (event === true) { + // console.log(this.personalForm.countRepositoryId) + // if (this.personalForm.countRepositoryId === undefined || this.personalForm.countRepositoryId === '') { + // this.$notify.error({ + // title: 'wrong', + // message: this.$t('prompt.sqslcg'), + // offset: 100 + // }) + // return false + // } + // getlocation(this.personalForm.countRepositoryId, scope.row).then(res => { + // if (res.data.ret === 200) { + // if (res.data.data.content.length !== 0) { + // this.locationlist = res.data.data.content + // scope.row.locationId = res.data.data.content[0].id + // this.updatebatch3(scope) + // } else if (res.data.data.content.length === 0) { + // this.$notify.error({ + // title: 'wrong', + // message: this.$t('prompt.gckmygsp'), + // offset: 100 + // }) + // this.locationlist = [] + // return false + // } + // } + // }) + // } + // }, updatebatch3(scope) { const parms3 = scope.row.productCode batchlist(this.personalForm.countRepositoryId, parms3).then(res => { @@ -564,123 +637,147 @@ export default { }, // 保存操作 handlesave() { - if (this.Time === null) { - this.personalForm.beginTime = null - this.personalForm.endTime = null - } else { - this.personalForm.beginTime = this.Time[0] - this.personalForm.endTime = this.Time[1] - } - const EnterDetail = this.$refs.editable.getRecords() - // if (EnterDetail.length === 0) { - // this.$notify.error({ - // title: 'wrong', - // message: '明细表不能为空', - // offset: 100 - // }) - // return false - // } - EnterDetail.map(function(elem) { - return elem - }).forEach(function(elem) { - if (elem.locationId === null || elem.locationId === '' || elem.locationId === undefined) { - delete elem.locationId - } - if (elem.productCode === null || elem.productCode === '' || elem.productCode === undefined) { - delete elem.productCode - } - if (elem.productName === null || elem.productName === '' || elem.productName === undefined) { - delete elem.productName - } - if (elem.color === null || elem.color === '' || elem.color === undefined) { - delete elem.color - } - if (elem.typeId === null || elem.typeId === '' || elem.typeId === undefined) { - delete elem.typeId - } - if (elem.unit === null || elem.unit === '' || elem.unit === undefined) { - delete elem.unit - } - if (elem.inventoryQuantity === null || elem.inventoryQuantity === '' || elem.inventoryQuantity === undefined) { - delete elem.inventoryQuantity - } - if (elem.actualQuantity === null || elem.actualQuantity === '' || elem.actualQuantity === undefined) { - delete elem.actualQuantity - } - if (elem.price === null || elem.price === '' || elem.price === undefined) { - delete elem.price - } - if (elem.totalMoney === null || elem.totalMoney === '' || elem.totalMoney === undefined) { - delete elem.totalMoney - } - if (elem.diffQuantity === null || elem.diffQuantity === '' || elem.diffQuantity === undefined) { - delete elem.diffQuantity - } - if (elem.diffType === null || elem.diffType === '' || elem.diffType === undefined) { - delete elem.diffType - } - if (elem.remarks === null || elem.remarks === '' || elem.remarks === undefined) { - delete elem.remarks - } - if (elem.batch === null || elem.batch === '' || elem.batch === undefined) { - delete elem.batch - } - return elem - }) - const Data = this.personalForm - for (const key in Data) { - if (Data[key] === '' || Data[key] === undefined || Data[key] === null) { - delete Data[key] - } - } - const parms1 = JSON.stringify(Data) - let parms2 = '' - if (EnterDetail.length !== 0) { - parms2 = JSON.stringify(EnterDetail) - } - this.$refs.personalForm.validate((valid) => { - if (valid) { - this.$refs.editable.validate((valid) => { - if (valid) { - addinventorycount(parms1, parms2, this.personalForm.repositoryId, this.personalForm.regionId).then(res => { - console.log(res) - if (res.data.ret === 200) { - this.$notify({ - title: 'successful', - message: 'save successful', - type: 'success', - offset: 100 - }) - this.restAllForm() - this.$refs.editable.clear() - this.$refs.personalForm.clearValidate() - this.$refs.personalForm.resetFields() - } else { - this.$notify.error({ - title: 'wrong', - message: res.data.msg, - offset: 100 - }) - } - }) - } else { - this.$notify.error({ - title: 'wrong', - message: 'Information is incomplete', - offset: 100 - }) - return false - } - }) + this.saveloading = true + + setTimeout(() => { + if (this.Time === null) { + this.personalForm.beginTime = null + this.personalForm.endTime = null } else { + this.personalForm.beginTime = this.Time[0] + this.personalForm.endTime = this.Time[1] + } + const EnterDetail = this.$refs.editable.getRecords() + if (EnterDetail.length === 0) { this.$notify.error({ title: 'wrong', - message: 'Information is incomplete', + message: '明细表不能为空', offset: 100 }) + this.saveloading = false return false } - }) + let judgestat = 1 + for (const i in EnterDetail) { + if (!EnterDetail[i].locationId) { + judgestat = 2 + } + } + if (judgestat === 2) { + this.$notify.error({ + title: 'wrong', + message: this.$t('prompt.pchwbnwk'), + offset: 100 + }) + this.saveloading = false + return false + } + + EnterDetail.map(function(elem) { + return elem + }).forEach(function(elem) { + if (elem.locationId === null || elem.locationId === '' || elem.locationId === undefined) { + delete elem.locationId + } + if (elem.productCode === null || elem.productCode === '' || elem.productCode === undefined) { + delete elem.productCode + } + if (elem.productName === null || elem.productName === '' || elem.productName === undefined) { + delete elem.productName + } + if (elem.color === null || elem.color === '' || elem.color === undefined) { + delete elem.color + } + if (elem.typeId === null || elem.typeId === '' || elem.typeId === undefined) { + delete elem.typeId + } + if (elem.unit === null || elem.unit === '' || elem.unit === undefined) { + delete elem.unit + } + if (elem.inventoryQuantity === null || elem.inventoryQuantity === '' || elem.inventoryQuantity === undefined) { + delete elem.inventoryQuantity + } + if (elem.actualQuantity === null || elem.actualQuantity === '' || elem.actualQuantity === undefined) { + delete elem.actualQuantity + } + if (elem.price === null || elem.price === '' || elem.price === undefined) { + delete elem.price + } + if (elem.totalMoney === null || elem.totalMoney === '' || elem.totalMoney === undefined) { + delete elem.totalMoney + } + if (elem.diffQuantity === null || elem.diffQuantity === '' || elem.diffQuantity === undefined) { + delete elem.diffQuantity + } + if (elem.diffType === null || elem.diffType === '' || elem.diffType === undefined) { + delete elem.diffType + } + if (elem.remarks === null || elem.remarks === '' || elem.remarks === undefined) { + delete elem.remarks + } + if (elem.batch === null || elem.batch === '' || elem.batch === undefined) { + delete elem.batch + } + return elem + }) + const Data = this.personalForm + for (const key in Data) { + if (Data[key] === '' || Data[key] === undefined || Data[key] === null) { + delete Data[key] + } + } + const parms1 = JSON.stringify(Data) + let parms2 = '' + if (EnterDetail.length !== 0) { + parms2 = JSON.stringify(EnterDetail) + } + this.$refs.personalForm.validate((valid) => { + if (valid) { + this.$refs.editable.validate((valid) => { + if (valid) { + addinventorycount(parms1, parms2, this.personalForm.repositoryId, this.personalForm.regionId).then(res => { + console.log(res) + if (res.data.ret === 200) { + this.$notify({ + title: 'successful', + message: 'save successful', + type: 'success', + offset: 100 + }) + this.restAllForm() + this.$refs.editable.clear() + this.$refs.personalForm.clearValidate() + this.$refs.personalForm.resetFields() + } else { + this.$notify.error({ + title: 'wrong', + message: res.data.msg, + offset: 100 + }) + } + this.saveloading = false + }) + } else { + this.$notify.error({ + title: 'wrong', + message: 'Information is incomplete', + offset: 100 + }) + this.saveloading = false + return false + } + }) + } else { + this.$notify.error({ + title: 'wrong', + message: 'Information is incomplete', + offset: 100 + }) + this.saveloading = false + return false + } + }) + }, 1000 * 0.5) }, // 清空记录 restAllForm() { @@ -746,112 +843,230 @@ export default { if (this.countRepositoryId === '' || this.countRepositoryId === null || this.countRepositoryId === undefined) { this.$notify.error({ title: 'wrong', - message: this.$t('prompt.sqslcg'), + message: this.$t('prompt.qxxzck'), offset: 100 }) return false } this.control = true }, + uniqueArray(array, key) { + var result = [array[0]] + for (var i = 1; i < array.length; i++) { + var item = array[i] + var repeat = false + for (var j = 0; j < result.length; j++) { + if (item[key] === result[j][key]) { + repeat = true + break + } + } + if (!repeat) { + result.push(item) + } + } + return result + }, async productdetail(val) { const nowlistdata = this.$refs.editable.getRecords() - if (nowlistdata.length === 0) { - const batcharr = await Promise.all(val.map(item => { - return batchlist(this.personalForm.countRepositoryId, item.productCode) - })) - const newbatch = batcharr.map(item => { - return { - pcode: item.data.data.pCode, - batchs: item.data.data.content - } - }) - console.log('newbatch---======', newbatch) + this.$refs.editable.clear() + console.log('val============', val) + const alldata = [...nowlistdata, ...val] + const filterdata = this.uniqueArray(alldata, 'productCode') + console.log('filterdata=====', filterdata) - const needarr = newbatch.map(item => { - const arrned = item.batchs.map(zitem => { - return { - productCode: item.pcode, - batch: zitem - } - }) - return arrned - }) - const onearr = [].concat.apply([], needarr) - for (const i in val) { - for (const j in onearr) { - if (val[i].productCode === onearr[j].productCode) { - onearr[j].productName = val[i].productName - onearr[j].color = val[i].color - onearr[j].locationId = val[i].locationId - onearr[j].typeId = val[i].typeId - onearr[j].inventoryQuantity = val[i].inventoryQuantity - onearr[j].actualQuantity = val[i].actualQuantity - onearr[j].enterQuantity = val[i].enterQuantity - onearr[j].taxRate = val[i].taxRate - onearr[j].unit = val[i].unit - onearr[j].totalMoney = val[i].totalMoney - onearr[j].actualEnterQuantity = val[i].actualEnterQuantity - onearr[j].basicQuantity = val[i].basicQuantity - onearr[j].price = val[i].price - onearr[j].productType = val[i].productType - onearr[j].countPerson = val[i].countPerson - onearr[j].countPersonId = val[i].countPersonId - onearr[j].countDate = val[i].countDate + const batcharr = await Promise.all(filterdata.map(item => { + return batchlist(this.personalForm.countRepositoryId, item.productCode) + })) + console.log('batcharr', batcharr) + const nonebatch = [] + for (const i in batcharr) { + for (const j in filterdata) { + if (batcharr[i].data.data.content.length === 0) { + if (batcharr[i].data.data.pCode === filterdata[j].productCode) { + nonebatch.push(filterdata[j]) } } } - console.log('needarr---======', onearr) - this.list2 = onearr - } else { - const batcharr = await Promise.all(val.map(item => { - return batchlist(this.personalForm.countRepositoryId, item.productCode) - })) - const newbatch = batcharr.map(item => { - return { - pcode: item.data.data.pCode, - batchs: item.data.data.content - } - }) - console.log('newbatch---======', newbatch) - - const needarr = newbatch.map(item => { - const arrned = item.batchs.map(zitem => { - return { - productCode: item.pcode, - batch: zitem - } - }) - return arrned - }) - const onearr = [].concat.apply([], needarr) - for (const i in val) { - for (const j in onearr) { - if (val[i].productCode === onearr[j].productCode) { - onearr[j].productName = val[i].productName - onearr[j].color = val[i].color - onearr[j].locationId = val[i].locationId - onearr[j].typeId = val[i].typeId - onearr[j].inventoryQuantity = val[i].inventoryQuantity - onearr[j].actualQuantity = val[i].actualQuantity - onearr[j].enterQuantity = val[i].enterQuantity - onearr[j].taxRate = val[i].taxRate - onearr[j].unit = val[i].unit - onearr[j].totalMoney = val[i].totalMoney - onearr[j].actualEnterQuantity = val[i].actualEnterQuantity - onearr[j].basicQuantity = val[i].basicQuantity - onearr[j].price = val[i].price - onearr[j].productType = val[i].productType - onearr[j].countPerson = val[i].countPerson - onearr[j].countPersonId = val[i].countPersonId - onearr[j].countDate = val[i].countDate - } - } - } - console.log('needarr---======', onearr) - const newarr = Object.assign([], onearr, nowlistdata) - this.list2 = newarr } + console.log('nonebatch', nonebatch) + const newbatch = batcharr.map(item => { + return { + pcode: item.data.data.pCode, + batchs: item.data.data.content + } + }) + console.log('newbatch---======', newbatch) + + const needarr = newbatch.map(item => { + const arrned = item.batchs.map(zitem => { + return { + productCode: item.pcode, + batch: zitem + } + }) + return arrned + }) + console.log('needarr', needarr) + const onearr = [].concat.apply([], needarr) + for (const i in filterdata) { + for (const j in onearr) { + if (filterdata[i].productCode === onearr[j].productCode) { + onearr[j].productName = filterdata[i].productName + onearr[j].color = filterdata[i].color + onearr[j].locationId = filterdata[i].locationId + onearr[j].typeId = filterdata[i].typeId + onearr[j].inventoryQuantity = filterdata[i].inventoryQuantity + onearr[j].actualQuantity = filterdata[i].actualQuantity + onearr[j].enterQuantity = filterdata[i].enterQuantity + onearr[j].taxRate = filterdata[i].taxRate + onearr[j].unit = filterdata[i].unit + onearr[j].totalMoney = filterdata[i].totalMoney + onearr[j].actualEnterQuantity = filterdata[i].actualEnterQuantity + onearr[j].basicQuantity = filterdata[i].basicQuantity + onearr[j].price = filterdata[i].price + onearr[j].productType = filterdata[i].productType + onearr[j].countPerson = filterdata[i].countPerson + onearr[j].countPersonId = filterdata[i].countPersonId + onearr[j].countDate = filterdata[i].countDate + } + } + } + console.log('needarr---======', onearr) + const finallyarr = [...nonebatch, ...onearr] + this.list2 = finallyarr + + // this.list2 = filterdata + // for (let i = 0; i < filterdata.length; i++) { + // // val[i].quantity = 1 + // this.$refs.editable.insert(filterdata[i]) + // } } + // async productdetail(val) { + // const nowlistdata = this.$refs.editable.getRecords() + // if (nowlistdata.length === 0) { + // const batcharr = await Promise.all(val.map(item => { + // return batchlist(this.personalForm.countRepositoryId, item.productCode) + // })) + // console.log('batcharr', batcharr) + // const nonebatch = [] + // for (const i in batcharr) { + // for (const j in val) { + // if (batcharr[i].data.data.content.length === 0) { + // if (batcharr[i].data.data.pCode === val[j].productCode) { + // nonebatch.push(val[j]) + // } + // } + // } + // } + // console.log('nonebatch', nonebatch) + // const newbatch = batcharr.map(item => { + // return { + // pcode: item.data.data.pCode, + // batchs: item.data.data.content + // } + // }) + // console.log('newbatch---======', newbatch) + + // const needarr = newbatch.map(item => { + // const arrned = item.batchs.map(zitem => { + // return { + // productCode: item.pcode, + // batch: zitem + // } + // }) + // return arrned + // }) + // console.log('needarr', needarr) + // const onearr = [].concat.apply([], needarr) + // for (const i in val) { + // for (const j in onearr) { + // if (val[i].productCode === onearr[j].productCode) { + // onearr[j].productName = val[i].productName + // onearr[j].color = val[i].color + // onearr[j].locationId = val[i].locationId + // onearr[j].typeId = val[i].typeId + // onearr[j].inventoryQuantity = val[i].inventoryQuantity + // onearr[j].actualQuantity = val[i].actualQuantity + // onearr[j].enterQuantity = val[i].enterQuantity + // onearr[j].taxRate = val[i].taxRate + // onearr[j].unit = val[i].unit + // onearr[j].totalMoney = val[i].totalMoney + // onearr[j].actualEnterQuantity = val[i].actualEnterQuantity + // onearr[j].basicQuantity = val[i].basicQuantity + // onearr[j].price = val[i].price + // onearr[j].productType = val[i].productType + // onearr[j].countPerson = val[i].countPerson + // onearr[j].countPersonId = val[i].countPersonId + // onearr[j].countDate = val[i].countDate + // } + // } + // } + // console.log('needarr---======', onearr) + // const finallyarr = [...nonebatch, ...onearr] + // this.list2 = finallyarr + // } else { + // console.log(123) + // const batcharr = await Promise.all(val.map(item => { + // return batchlist(this.personalForm.countRepositoryId, item.productCode) + // })) + // const nonebatch = [] + // for (const i in batcharr) { + // for (const j in val) { + // if (batcharr[i].data.data.content.length === 0) { + // if (batcharr[i].data.data.pCode === val[j].productCode) { + // nonebatch.push(val[j]) + // } + // } + // } + // } + // const newbatch = batcharr.map(item => { + // return { + // pcode: item.data.data.pCode, + // batchs: item.data.data.content + // } + // }) + // console.log('newbatch---======', newbatch) + + // const needarr = newbatch.map(item => { + // const arrned = item.batchs.map(zitem => { + // return { + // productCode: item.pcode, + // batch: zitem + // } + // }) + // return arrned + // }) + // const onearr = [].concat.apply([], needarr) + // for (const i in val) { + // for (const j in onearr) { + // if (val[i].productCode === onearr[j].productCode) { + // onearr[j].productName = val[i].productName + // onearr[j].color = val[i].color + // onearr[j].locationId = val[i].locationId + // onearr[j].typeId = val[i].typeId + // onearr[j].inventoryQuantity = val[i].inventoryQuantity + // onearr[j].actualQuantity = val[i].actualQuantity + // onearr[j].enterQuantity = val[i].enterQuantity + // onearr[j].taxRate = val[i].taxRate + // onearr[j].unit = val[i].unit + // onearr[j].totalMoney = val[i].totalMoney + // onearr[j].actualEnterQuantity = val[i].actualEnterQuantity + // onearr[j].basicQuantity = val[i].basicQuantity + // onearr[j].price = val[i].price + // onearr[j].productType = val[i].productType + // onearr[j].countPerson = val[i].countPerson + // onearr[j].countPersonId = val[i].countPersonId + // onearr[j].countDate = val[i].countDate + // } + // } + // } + // console.log('needarr---======', onearr) + // const newarr = Object.assign([], onearr, nowlistdata) + // const finallyarr = [...nonebatch, ...newarr] + // this.list2 = newarr + // } + // } // 货位批次默认 // 2撒打算 // console.log(val) diff --git a/src/views/InventoryCount/components/MyDetail.vue b/src/views/InventoryCount/components/MyDetail.vue index 7bbd8076..8cf6ce27 100644 --- a/src/views/InventoryCount/components/MyDetail.vue +++ b/src/views/InventoryCount/components/MyDetail.vue @@ -129,7 +129,7 @@