|
@@ -100,6 +100,7 @@
|
|
import { commonMixin } from '@/utils/mixin'
|
|
import { commonMixin } from '@/utils/mixin'
|
|
import { mapActions } from 'vuex'
|
|
import { mapActions } from 'vuex'
|
|
import { purchaseCartList, purchaseDeleteBatch, purchaseUpdateQty } from '@/api/purchaseCart'
|
|
import { purchaseCartList, purchaseDeleteBatch, purchaseUpdateQty } from '@/api/purchaseCart'
|
|
|
|
+import { purchaseDetailCancelSave } from '@/api/purchaseDetail'
|
|
import ProductType from '../../common/productType.js'
|
|
import ProductType from '../../common/productType.js'
|
|
import ProductBrand from '../../common/productBrand.js'
|
|
import ProductBrand from '../../common/productBrand.js'
|
|
import { STable, VSelect } from '@/components'
|
|
import { STable, VSelect } from '@/components'
|
|
@@ -234,23 +235,84 @@ export default {
|
|
}
|
|
}
|
|
})
|
|
})
|
|
},
|
|
},
|
|
- // 批量添加
|
|
|
|
|
|
+ // 保存
|
|
addMore () {
|
|
addMore () {
|
|
|
|
+ const _this = this
|
|
const rows = this.rowSelectionInfo && this.rowSelectionInfo.selectedRowKeys || []
|
|
const rows = this.rowSelectionInfo && this.rowSelectionInfo.selectedRowKeys || []
|
|
if (!this.rowSelectionInfo || (rows.length <= 0)) {
|
|
if (!this.rowSelectionInfo || (rows.length <= 0)) {
|
|
this.$message.warning('请在列表勾选后再进行批量操作!')
|
|
this.$message.warning('请在列表勾选后再进行批量操作!')
|
|
return
|
|
return
|
|
}
|
|
}
|
|
|
|
+ const rowsList = this.rowSelectionInfo && this.rowSelectionInfo.selectedRows || []
|
|
|
|
+ const list = []
|
|
|
|
+ rowsList.map(item => {
|
|
|
|
+ list.push({
|
|
|
|
+ cancelQty: item.qty,
|
|
|
|
+ qty: item.qty,
|
|
|
|
+ productSn: item.productSn,
|
|
|
|
+ price: item.purchasePrice
|
|
|
|
+ })
|
|
|
|
+ })
|
|
|
|
+ const params = {
|
|
|
|
+ confirm: false,
|
|
|
|
+ purchaseBillSn: this.paramsData.purchaseBillSn,
|
|
|
|
+ purchaseBillNo: this.paramsData.purchaseBillNo,
|
|
|
|
+ purchaseBillDetailEntityList: list,
|
|
|
|
+ purchaseCartFlag: true
|
|
|
|
+ }
|
|
|
|
+ purchaseDetailCancelSave(params).then(res => {
|
|
|
|
+ if (res.status == 200 && res.data) {
|
|
|
|
+ let content = ''
|
|
|
|
+ if ((res.data.productSizeRepeat != res.data.productSize) && (res.data.productSizeRepeat != 0)) {
|
|
|
|
+ content = `您已经选择 ${res.data.productSize} 个产品,其中 ${res.data.productSizeRepeat} 个产品已经存在于采购单中。本次只会加入不重复的产品,上次采购数量将作为本次采购数量。确认加入本次采购吗?`
|
|
|
|
+ this.confirmFun(content,params)
|
|
|
|
+ } else if (res.data.productSizeRepeat == res.data.productSize) {
|
|
|
|
+ content = `抱歉,您选择的 ${res.data.productSize} 个产品,采购单中已经全部存在,无需加入!`
|
|
|
|
+ this.$info({
|
|
|
|
+ title: '提示',
|
|
|
|
+ content: content,
|
|
|
|
+ okText: '好的',
|
|
|
|
+ centered: true,
|
|
|
|
+ zIndex: 1100,
|
|
|
|
+ onOk () {
|
|
|
|
+ _this.$refs.table.clearSelected() // 清空表格选中项
|
|
|
|
+ }
|
|
|
|
+ })
|
|
|
|
+ } else {
|
|
|
|
+ content = `您已经选择 ${res.data.productSize} 个产品,上次采购数量将作为本次采购数量。确认加入本次采购吗?`
|
|
|
|
+ this.confirmFun(content,params)
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ })
|
|
|
|
+ },
|
|
|
|
+ confirmFun (content,params) {
|
|
|
|
+ const _this = this
|
|
this.$confirm({
|
|
this.$confirm({
|
|
title: '提示',
|
|
title: '提示',
|
|
- content: '确定批量添加吗?',
|
|
|
|
|
|
+ content: content,
|
|
|
|
+ okText: '确认加入',
|
|
|
|
+ cancelText: '重新选择',
|
|
centered: true,
|
|
centered: true,
|
|
- onOk: () => {
|
|
|
|
|
|
+ closable: true,
|
|
|
|
+ zIndex: 1100,
|
|
|
|
+ onOk () {
|
|
|
|
+ _this.loading = true
|
|
|
|
+ params.confirm = true
|
|
|
|
+ purchaseDetailCancelSave(params).then(res => {
|
|
|
|
+ if (res.status == 200) {
|
|
|
|
+ _this.$emit('ok')
|
|
|
|
+ _this.loading = false
|
|
|
|
+ } else {
|
|
|
|
+ _this.loading = false
|
|
|
|
+ }
|
|
|
|
+ })
|
|
|
|
+ },
|
|
|
|
+ onCancel () {
|
|
|
|
+ _this.$refs.table.clearSelected() // 清空表格选中项
|
|
}
|
|
}
|
|
})
|
|
})
|
|
},
|
|
},
|
|
pageInit (paramsData) {
|
|
pageInit (paramsData) {
|
|
- const _this = this
|
|
|
|
this.paramsData = paramsData || {}
|
|
this.paramsData = paramsData || {}
|
|
this.setTableH()
|
|
this.setTableH()
|
|
this.getColumns()
|
|
this.getColumns()
|