|
@@ -4,24 +4,29 @@
|
|
|
class="outStock-modal"
|
|
|
:footer="null"
|
|
|
:maskClosable="false"
|
|
|
- :title="title"
|
|
|
+ title="采购缺货产品明细"
|
|
|
v-model="isShow"
|
|
|
@cancel="isShow=false"
|
|
|
- :width="800">
|
|
|
+ :width="900">
|
|
|
<a-spin :spinning="spinning" tip="Loading...">
|
|
|
<div class="outStock-con">
|
|
|
<div>
|
|
|
<div ref="tableSearch" class="table-page-search-wrapper">
|
|
|
<a-form layout="inline" @keyup.enter.native="searchForm">
|
|
|
<a-row :gutter="15">
|
|
|
+ <a-col :md="8" :sm="24">
|
|
|
+ <a-form-item label="采购单号">
|
|
|
+ <a-input id="productInfoList-purchaseBillNo" v-model.trim="queryParam.dealerProduct.purchaseBillNo" placeholder="请输入采购单号" allowClear />
|
|
|
+ </a-form-item>
|
|
|
+ </a-col>
|
|
|
<a-col :md="8" :sm="24">
|
|
|
<a-form-item label="产品编码">
|
|
|
- <a-input id="productInfoList-code" v-model.trim="queryParam.dealerProductEntity.code" allowClear placeholder="请输入产品编码"/>
|
|
|
+ <a-input id="productInfoList-code" v-model.trim="queryParam.dealerProduct.code" allowClear placeholder="请输入产品编码"/>
|
|
|
</a-form-item>
|
|
|
</a-col>
|
|
|
<a-col :md="8" :sm="24">
|
|
|
<a-form-item label="产品名称">
|
|
|
- <a-input id="productInfoList-name" v-model.trim="queryParam.dealerProductEntity.name" allowClear placeholder="请输入产品名称"/>
|
|
|
+ <a-input id="productInfoList-name" v-model.trim="queryParam.dealerProduct.name" allowClear placeholder="请输入产品名称"/>
|
|
|
</a-form-item>
|
|
|
</a-col>
|
|
|
<a-col :md="8" :sm="24">
|
|
@@ -31,7 +36,7 @@
|
|
|
</a-col>
|
|
|
<a-col :md="8" :sm="24">
|
|
|
<a-form-item label="产品品牌">
|
|
|
- <ProductBrand id="productInfoList-productBrandSn" placeholder="请选择产品品牌" v-model="queryParam.dealerProductEntity.productBrandSn"></ProductBrand>
|
|
|
+ <ProductBrand id="productInfoList-productBrandSn" placeholder="请选择产品品牌" v-model="queryParam.dealerProduct.productBrandSn"></ProductBrand>
|
|
|
</a-select>
|
|
|
</a-form-item>
|
|
|
</a-col>
|
|
@@ -55,6 +60,7 @@
|
|
|
:data="loadData"
|
|
|
:columns="columns"
|
|
|
:scroll="{ y: 450 }"
|
|
|
+ :defaultLoadData="false"
|
|
|
bordered>
|
|
|
</s-table>
|
|
|
</div>
|
|
@@ -82,7 +88,8 @@
|
|
|
<script>
|
|
|
import { commonMixin } from '@/utils/mixin'
|
|
|
import { STable } from '@/components'
|
|
|
-import { purchaseDetailCancelList, purchaseDetailCancelSave } from '@/api/purchaseDetail'
|
|
|
+import { outOfStockDetailList } from '@/api/oos'
|
|
|
+import { importOosDetail } from '@/api/purchaseDetail'
|
|
|
import ProductType from '../../common/productType.js'
|
|
|
import ProductBrand from '../../common/productBrand.js'
|
|
|
export default {
|
|
@@ -94,57 +101,61 @@ export default {
|
|
|
type: Boolean,
|
|
|
default: false
|
|
|
},
|
|
|
+ paramsSn: {
|
|
|
+ type: String,
|
|
|
+ default: ''
|
|
|
+ },
|
|
|
chooseData: {
|
|
|
type: Array,
|
|
|
default: () => {
|
|
|
return []
|
|
|
}
|
|
|
- },
|
|
|
- paramsData: {
|
|
|
- type: Object,
|
|
|
- default: () => {
|
|
|
- return {}
|
|
|
- }
|
|
|
}
|
|
|
},
|
|
|
data () {
|
|
|
+ const _this = this
|
|
|
return {
|
|
|
- isShow: this.openModal, // 是否打开弹框
|
|
|
+ isShow: _this.openModal, // 是否打开弹框
|
|
|
formItemLayout: {
|
|
|
labelCol: { span: 4 },
|
|
|
wrapperCol: { span: 20 }
|
|
|
},
|
|
|
disabled: false, // 查询、重置按钮是否可操作
|
|
|
columns: [
|
|
|
- { title: '产品编码', dataIndex: 'dealerProductEntity.code', width: '24%', align: 'center', customRender: function (text) { return text || '--' } },
|
|
|
- { title: '产品名称', dataIndex: 'dealerProductEntity.name', width: '32%', align: 'left', customRender: function (text) { return text || '--' }, ellipsis: true },
|
|
|
- { title: '上次采购数量', dataIndex: 'qty', width: '18%', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
|
|
|
- { title: '上次缺货数量', dataIndex: 'cancelQty', width: '18%', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
|
|
|
- { title: '单位', dataIndex: 'dealerProductEntity.unit', width: '8%', align: 'center', customRender: function (text) { return text || '--' } }
|
|
|
+ { title: '序号', dataIndex: 'no', width: '8%', align: 'center' },
|
|
|
+ { title: '采购单号', dataIndex: 'purchaseBillNo', width: '18%', align: 'center', customRender: function (text) { return text || '--' } },
|
|
|
+ { title: '产品编码', dataIndex: 'productCode', width: '18%', align: 'center', customRender: function (text) { return text || '--' } },
|
|
|
+ { title: '产品名称', dataIndex: 'productName', width: '30%', align: 'left', customRender: function (text) { return text || '--' }, ellipsis: true },
|
|
|
+ { title: '缺货数量', dataIndex: 'qty', width: '15%', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
|
|
|
+ { title: '缺货金额', dataIndex: 'totalAmount', width: '15%', align: 'right', customRender: function (text) { return ((text || text == 0) ? _this.toThousands(text) : '--') } },
|
|
|
+ { title: '单位', dataIndex: 'unit', width: '10%', align: 'center', customRender: function (text) { return text || '--' } }
|
|
|
],
|
|
|
- title: '',
|
|
|
// 加载数据方法 必须为 Promise 对象
|
|
|
loadData: parameter => {
|
|
|
this.disabled = true
|
|
|
this.spinning = true
|
|
|
- return purchaseDetailCancelList(Object.assign(parameter, this.queryParam)).then(res => {
|
|
|
+ this.queryParam.purchaseBillSnList = this.chooseData
|
|
|
+ return outOfStockDetailList(Object.assign(parameter, this.queryParam)).then(res => {
|
|
|
let data
|
|
|
if (res.status == 200) {
|
|
|
data = res.data
|
|
|
+ const no = (data.pageNo - 1) * data.pageSize
|
|
|
+ for (var i = 0; i < data.list.length; i++) {
|
|
|
+ data.list[i].no = no + i + 1
|
|
|
+ }
|
|
|
this.disabled = false
|
|
|
}
|
|
|
this.spinning = false
|
|
|
- const purchaseBillNo = data && data.list.length > 0 ? data.list[0].purchaseBillNo : '--'
|
|
|
- this.title = '上次采购缺货产品明细(采购单号:' + purchaseBillNo + ')'
|
|
|
return data
|
|
|
})
|
|
|
},
|
|
|
spinning: false,
|
|
|
rowSelectionInfo: null,
|
|
|
productType: [],
|
|
|
- dataList: [],
|
|
|
queryParam: { // 查询条件
|
|
|
- dealerProductEntity: {
|
|
|
+ purchaseBillSnList: undefined,
|
|
|
+ dealerProduct: {
|
|
|
+ purchaseBillNo: '',
|
|
|
code: '', // 产品编码
|
|
|
name: '', // 产品名称
|
|
|
productBrandSn: undefined, // 产品品牌
|
|
@@ -158,9 +169,9 @@ export default {
|
|
|
methods: {
|
|
|
// 产品分类 change
|
|
|
changeProductType (val, opt) {
|
|
|
- this.queryParam.dealerProductEntity.productTypeSn1 = val[0] ? val[0] : ''
|
|
|
- this.queryParam.dealerProductEntity.productTypeSn2 = val[1] ? val[1] : ''
|
|
|
- this.queryParam.dealerProductEntity.productTypeSn3 = val[2] ? val[2] : ''
|
|
|
+ this.queryParam.dealerProduct.productTypeSn1 = val[0] ? val[0] : ''
|
|
|
+ this.queryParam.dealerProduct.productTypeSn2 = val[1] ? val[1] : ''
|
|
|
+ this.queryParam.dealerProduct.productTypeSn3 = val[2] ? val[2] : ''
|
|
|
},
|
|
|
// 表格选中项
|
|
|
rowSelectionFun (obj) {
|
|
@@ -171,67 +182,19 @@ export default {
|
|
|
const _this = this
|
|
|
if (!this.rowSelectionInfo || (this.rowSelectionInfo && this.rowSelectionInfo.selectedRowKeys.length < 1)) {
|
|
|
this.$message.warning('请在列表勾选后再进行操作!')
|
|
|
- return
|
|
|
- }
|
|
|
- const params = {
|
|
|
- confirm: false,
|
|
|
- purchaseBillSn: this.paramsData.purchaseBillSn,
|
|
|
- purchaseBillNo: this.paramsData.purchaseBillNo,
|
|
|
- purchaseBillDetailEntityList: this.rowSelectionInfo && this.rowSelectionInfo.selectedRows
|
|
|
}
|
|
|
- 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)
|
|
|
- } else if (res.data.productSizeRepeat == res.data.productSize) {
|
|
|
- content = `抱歉,您选择的 ${res.data.productSize} 个产品,采购单中已经全部存在,无需加入!`
|
|
|
- this.$info({
|
|
|
- title: '提示',
|
|
|
- content: content,
|
|
|
- okText: '好的',
|
|
|
- centered: true,
|
|
|
- onOk () {
|
|
|
- _this.$refs.table.clearSelected() // 清空表格选中项
|
|
|
- }
|
|
|
- })
|
|
|
- } else {
|
|
|
- content = `您已经选择 ${res.data.productSize} 个产品,上次缺货数量将作为本次采购数量。确认加入本次采购吗?`
|
|
|
- this.confirmFun(content)
|
|
|
- }
|
|
|
+ const arr = []
|
|
|
+ _this.rowSelectionInfo.selectedRows.forEach(item => {
|
|
|
+ const obj = {
|
|
|
+ productSn: item.productSn,
|
|
|
+ productCode: item.productCode,
|
|
|
+ qty: item.qty
|
|
|
}
|
|
|
+ arr.push(obj)
|
|
|
})
|
|
|
- },
|
|
|
- confirmFun (content) {
|
|
|
- const _this = this
|
|
|
- this.$confirm({
|
|
|
- title: '提示',
|
|
|
- content: content,
|
|
|
- okText: '确认加入',
|
|
|
- cancelText: '重新选择',
|
|
|
- centered: true,
|
|
|
- closable: true,
|
|
|
- onOk () {
|
|
|
- _this.spinning = true
|
|
|
- const params = {
|
|
|
- confirm: true,
|
|
|
- purchaseBillSn: _this.paramsData.purchaseBillSn,
|
|
|
- purchaseBillNo: _this.paramsData.purchaseBillNo,
|
|
|
- purchaseBillDetailEntityList: _this.rowSelectionInfo && _this.rowSelectionInfo.selectedRows
|
|
|
- }
|
|
|
- purchaseDetailCancelSave(params).then(res => {
|
|
|
- if (res.status == 200) {
|
|
|
- _this.$emit('ok')
|
|
|
- _this.isShow = false
|
|
|
- _this.spinning = false
|
|
|
- } else {
|
|
|
- _this.spinning = false
|
|
|
- }
|
|
|
- })
|
|
|
- },
|
|
|
- onCancel () {
|
|
|
- _this.$refs.table.clearSelected() // 清空表格选中项
|
|
|
+ importOosDetail({ purchaseBillSn: _this.paramsSn, arr }).then(res => {
|
|
|
+ if (res.status == 200) {
|
|
|
+ _this.$emit('ok')
|
|
|
}
|
|
|
})
|
|
|
},
|
|
@@ -240,6 +203,7 @@ export default {
|
|
|
},
|
|
|
resetSearchForm () {
|
|
|
const info = {
|
|
|
+ purchaseBillNo: '',
|
|
|
productBrandSn: undefined,
|
|
|
code: '', // 产品编码
|
|
|
name: '', // 产品名称
|
|
@@ -247,8 +211,8 @@ export default {
|
|
|
productTypeSn2: '', // 产品二级分类
|
|
|
productTypeSn3: '' // 产品三级分类
|
|
|
}
|
|
|
- Object.assign(this.queryParam.dealerProductEntity, info)
|
|
|
this.productType = []
|
|
|
+ Object.assign(this.queryParam.dealerProduct, info)
|
|
|
this.$refs.table.refresh(true)
|
|
|
}
|
|
|
},
|