From 661944e573c3edf24b80b5729a065bf2b42ae100 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=99=88=E8=96=AA=E5=90=8D?= <942005050@qq.com> Date: Fri, 24 Nov 2023 14:43:26 +0800 Subject: [PATCH] =?UTF-8?q?=E5=AD=90=E8=A1=A8=E6=96=B0=E5=A2=9E=E7=BC=96?= =?UTF-8?q?=E8=BE=91=E6=A0=A1=E9=AA=8C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/Detail/src/Detail.vue | 9 +++-- .../purchasePlanMain/index.vue | 35 ++++++++++--------- 2 files changed, 25 insertions(+), 19 deletions(-) diff --git a/src/components/Detail/src/Detail.vue b/src/components/Detail/src/Detail.vue index ec5c5f57b..a221dd247 100644 --- a/src/components/Detail/src/Detail.vue +++ b/src/components/Detail/src/Detail.vue @@ -175,9 +175,9 @@ const props = defineProps({ required: false, default: null }, - // 回显字段 - Echo: { - type: Array, + // 子表新增修改校验 + detailValidate: { + type: Function, required: false, default: null } @@ -410,6 +410,9 @@ const openForm = async (type: string, row?: number) => { // form 提交 const submitForm = async (formType, data) => { try { + // 子表新增编辑校验 如果业务需要子表提交校验 需在主页详情组件添加 detailValidate 参数及方法 + const rs = await props.detailValidate?props.detailValidate(data):true + if (!rs) return if (formType === 'create') { await props.apiCreate(data) message.success(t('common.createSuccess')) diff --git a/src/views/wms/purchasereceiptManage/supplierdeliver/purchasePlanMain/index.vue b/src/views/wms/purchasereceiptManage/supplierdeliver/purchasePlanMain/index.vue index 043ebc659..83b94b08a 100644 --- a/src/views/wms/purchasereceiptManage/supplierdeliver/purchasePlanMain/index.vue +++ b/src/views/wms/purchasereceiptManage/supplierdeliver/purchasePlanMain/index.vue @@ -67,8 +67,8 @@ :apiUpdate="PurchasePlanDetailApi.updatePurchasePlanDetail" :apiPage="PurchasePlanDetailApi.getPurchasePlanDetailPage" :apiDelete="PurchasePlanDetailApi.deletePurchasePlanDetail" - :Echo="Echo" @searchTableSuccessDetail="searchTableSuccessDetail" + :detailValidate="detailValidate" /> @@ -126,10 +126,6 @@ const searchTableSuccessDetail = (formField, searchField, val, formRef ) => { }) } -// 子表新增的时候选择表格之后需要会显得字段 -// const Echo = ['ppNumber','poLine', 'batch', 'altBatch', 'itemCode', 'itemName', 'itemDesc1', 'itemDesc2', 'projectCode', 'qty', 'uom'] -const Echo = [] - const { tableObject, tableMethods } = useTable({ getListApi: PurchasePlanMainApi.getPurchasePlanMainPage // 分页接口 }) @@ -182,17 +178,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,['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'}), // 删除 + ] } @@ -299,6 +295,13 @@ const submitForm = async (formType, data) => { } } +// 子表新增校验 +const detailValidate = (data) => { + console.log(300, data) + message.warning('错了吧,') + return false +} + /** 导入 */ const importFormRef = ref() const handleImport = () => {