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