|
@ -81,6 +81,7 @@ import { PurchasePlanMain,PurchasePlanMainRules,PurchasePlanDetail,PurchasePlanD |
|
|
import * as PurchasePlanMainApi from '@/api/wms/purchasePlanMain' |
|
|
import * as PurchasePlanMainApi from '@/api/wms/purchasePlanMain' |
|
|
import * as PurchasePlanDetailApi from '@/api/wms/purchasePlanDetail' |
|
|
import * as PurchasePlanDetailApi from '@/api/wms/purchasePlanDetail' |
|
|
import * as defaultButtons from '@/utils/disposition/defaultButtons' |
|
|
import * as defaultButtons from '@/utils/disposition/defaultButtons' |
|
|
|
|
|
import * as PurchaseDetailApi from '@/api/wms/purchaseDetail' |
|
|
|
|
|
|
|
|
// 要货计划 |
|
|
// 要货计划 |
|
|
defineOptions({ name: 'PurchasePlanMain' }) |
|
|
defineOptions({ name: 'PurchasePlanMain' }) |
|
@ -100,13 +101,21 @@ const updataTableColumns = (val) => { |
|
|
|
|
|
|
|
|
// 查询页面返回 |
|
|
// 查询页面返回 |
|
|
const searchTableSuccess = (formField, searchField, val, formRef, type, row ) => { |
|
|
const searchTableSuccess = (formField, searchField, val, formRef, type, row ) => { |
|
|
nextTick(() => { |
|
|
nextTick(async() => { |
|
|
if (type == 'tableForm') { |
|
|
if (type == 'tableForm') { |
|
|
// 明细查询页赋值 |
|
|
// 明细查询页赋值 |
|
|
row[formField] = val[0][searchField] |
|
|
row[formField] = val[0][searchField] |
|
|
row['itemCode'] = val[0]['code'] |
|
|
row['itemCode'] = val[0]['code'] |
|
|
row['poNumber'] = val[0]['number'] |
|
|
row['poNumber'] = val[0]['number'] |
|
|
row['poLine'] = val[0]['lineNumber'] |
|
|
row['poLine'] = val[0]['lineNumber'] |
|
|
|
|
|
await PurchaseDetailApi.getPurchaseDetailPage({ |
|
|
|
|
|
number: row['poNumber'], |
|
|
|
|
|
lineNumber: row['poLine'], |
|
|
|
|
|
}).then(res => { |
|
|
|
|
|
if(res.list.length == 1) { |
|
|
|
|
|
row['itemCode'] = res.list[0].itemCode |
|
|
|
|
|
} |
|
|
|
|
|
}) |
|
|
} else { |
|
|
} else { |
|
|
const setV = {} |
|
|
const setV = {} |
|
|
setV[formField] = val[0][searchField] |
|
|
setV[formField] = val[0][searchField] |
|
@ -116,13 +125,20 @@ const searchTableSuccess = (formField, searchField, val, formRef, type, row ) => |
|
|
} |
|
|
} |
|
|
// 查询页面返回——详情 |
|
|
// 查询页面返回——详情 |
|
|
const searchTableSuccessDetail = (formField, searchField, val, formRef ) => { |
|
|
const searchTableSuccessDetail = (formField, searchField, val, formRef ) => { |
|
|
nextTick(() => { |
|
|
nextTick(async() => { |
|
|
const setV = {} |
|
|
const setV = {} |
|
|
setV[formField] = val[0][searchField] |
|
|
setV[formField] = val[0][searchField] |
|
|
setV['itemCode'] = val[0]['code'] |
|
|
|
|
|
setV['poNumber'] = val[0]['number'] |
|
|
setV['poNumber'] = val[0]['number'] |
|
|
setV['poLine'] = val[0]['lineNumber'] |
|
|
setV['poLine'] = val[0]['lineNumber'] |
|
|
|
|
|
await PurchaseDetailApi.getPurchaseDetailPage({ |
|
|
|
|
|
number: setV['poNumber'], |
|
|
|
|
|
lineNumber: setV['poLine'], |
|
|
|
|
|
}).then(res => { |
|
|
|
|
|
if(res.list.length == 1) { |
|
|
|
|
|
setV['itemCode'] = res.list[0].itemCode |
|
|
formRef.setValues(setV) |
|
|
formRef.setValues(setV) |
|
|
|
|
|
} |
|
|
|
|
|
}) |
|
|
}) |
|
|
}) |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
@ -179,15 +195,15 @@ const isShowMainButton = (row,val) => { |
|
|
// 列表-操作按钮 |
|
|
// 列表-操作按钮 |
|
|
const butttondata = (row) => { |
|
|
const butttondata = (row) => { |
|
|
return [ |
|
|
return [ |
|
|
defaultButtons.mainListPurchasePlanModBtn({hide:isShowMainButton(row,['PLAN_PURCHASE_REJECTED'])}), // 修改 |
|
|
defaultButtons.mainListPurchasePlanModBtn({hide:isShowMainButton(row,['5'])}), // 修改 |
|
|
defaultButtons.mainListPurchasePlanWitBtn({hide:isShowMainButton(row,['PLAN_PURCHASE_PUBLISHED'])}), // 下架 |
|
|
defaultButtons.mainListPurchasePlanWitBtn({hide:isShowMainButton(row,['3'])}), // 下架 |
|
|
defaultButtons.mainListPurchasePlanRejBtn({hide:isShowMainButton(row,['PLAN_PURCHASE_PUBLISHED'])}), // 不接受 |
|
|
defaultButtons.mainListPurchasePlanRejBtn({hide:isShowMainButton(row,['3'])}), // 不接受 |
|
|
defaultButtons.mainListPurchasePlanAccBtn({hide:isShowMainButton(row,['PLAN_PURCHASE_PUBLISHED'])}), // 接受 |
|
|
defaultButtons.mainListPurchasePlanAccBtn({hide:isShowMainButton(row,['3'])}), // 接受 |
|
|
defaultButtons.mainListPurchasePlanPubBtn({hide:isShowMainButton(row,['PLAN_PURCHASE_READY'])}), // 发布 |
|
|
defaultButtons.mainListPurchasePlanPubBtn({hide:isShowMainButton(row,['1'])}), // 发布 |
|
|
defaultButtons.mainListPurchasePlanCloBtn({hide:isShowMainButton(row,['PLAN_PURCHASE_READY'])}), // 关闭 |
|
|
defaultButtons.mainListPurchasePlanCloBtn({hide:isShowMainButton(row,['1'])}), // 关闭 |
|
|
defaultButtons.mainListPurchasePlanOpeBtn({hide:isShowMainButton(row,['PLAN_PURCHASE_CLOSED'])}), // 打开 |
|
|
defaultButtons.mainListPurchasePlanOpeBtn({hide:isShowMainButton(row,['2'])}), // 打开 |
|
|
defaultButtons.mainListEditBtn({hide:isShowMainButton(row,['PLAN_PURCHASE_READY']),hasPermi:'wms:purchase-plan-main:update'}), // 编辑 |
|
|
defaultButtons.mainListEditBtn({hide:isShowMainButton(row,['1']),hasPermi:'wms:purchase-plan-main:update'}), // 编辑 |
|
|
defaultButtons.mainListDeleteBtn({hide:isShowMainButton(row,['PLAN_PURCHASE_READY']),hasPermi:'wms:purchase-plan-main:delete'}), // 删除 |
|
|
defaultButtons.mainListDeleteBtn({hide:isShowMainButton(row,['1']),hasPermi:'wms:purchase-plan-main:delete'}), // 删除 |
|
|
] |
|
|
] |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
@ -278,7 +294,20 @@ const handleDeleteTable = (item, index) => { |
|
|
|
|
|
|
|
|
// 主子数据 提交 |
|
|
// 主子数据 提交 |
|
|
const submitForm = async (formType, data) => { |
|
|
const submitForm = async (formType, data) => { |
|
|
data.subList = tableData.value // 拼接子表数据参数 |
|
|
data.subList = [] |
|
|
|
|
|
for(let item of tableData.value) { |
|
|
|
|
|
await PurchaseDetailApi.getPurchaseDetailPage({ |
|
|
|
|
|
number: item.poNumber, |
|
|
|
|
|
lineNumber: item.poLine |
|
|
|
|
|
}).then(res => { |
|
|
|
|
|
if(item.planQty > res.list[0].orderQty-res.list[0].plannedQty){ |
|
|
|
|
|
message.error('要货计划数量不得大于订单数量-已计划数量') |
|
|
|
|
|
} else { |
|
|
|
|
|
data.subList.push(item) // 拼接子表数据参数 |
|
|
|
|
|
} |
|
|
|
|
|
}) |
|
|
|
|
|
} |
|
|
|
|
|
if(data.subList.length == tableData.value.length){ |
|
|
try { |
|
|
try { |
|
|
if (formType === 'create') { |
|
|
if (formType === 'create') { |
|
|
await PurchasePlanMainApi.createPurchasePlanMain(data) |
|
|
await PurchasePlanMainApi.createPurchasePlanMain(data) |
|
@ -294,12 +323,24 @@ const submitForm = async (formType, data) => { |
|
|
formRef.value.formLoading = false |
|
|
formRef.value.formLoading = false |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
formRef.value.formLoading = false |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
// 子表新增校验 |
|
|
// 子表新增/编辑校验 |
|
|
const detailValidate = (data) => { |
|
|
const detailValidate = async (data) => { |
|
|
console.log(300, data) |
|
|
let tag = false |
|
|
message.warning('错了吧,') |
|
|
await PurchaseDetailApi.getPurchaseDetailPage({ |
|
|
return false |
|
|
number: data.poNumber, |
|
|
|
|
|
lineNumber: data.poLine |
|
|
|
|
|
}).then(res => { |
|
|
|
|
|
if(data.planQty > res.list[0].orderQty-res.list[0].plannedQty){ |
|
|
|
|
|
message.error('要货计划数量不得大于订单数量-已计划数量') |
|
|
|
|
|
tag = false |
|
|
|
|
|
} else { |
|
|
|
|
|
tag = true |
|
|
|
|
|
} |
|
|
|
|
|
}) |
|
|
|
|
|
return tag |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
/** 导入 */ |
|
|
/** 导入 */ |
|
|