From 8cae1dcd8d2bde01880ac4b70bdda4e61df3c7ef Mon Sep 17 00:00:00 2001 From: YangYuGang <1378265336@qq.com> Date: 星期六, 08 三月 2025 12:46:26 +0800 Subject: [PATCH] 送货单(U9) --- src/views/components/GeneralCrudModal.vue | 68 +++++++++++++++++++++++++++++---- 1 files changed, 59 insertions(+), 9 deletions(-) diff --git a/src/views/components/GeneralCrudModal.vue b/src/views/components/GeneralCrudModal.vue index f7ead92..7eac77c 100644 --- a/src/views/components/GeneralCrudModal.vue +++ b/src/views/components/GeneralCrudModal.vue @@ -8,6 +8,13 @@ @ok="handleSubmit" > <div> + <a-alert + v-if="showAlert" + :message="message" + :description="description" + type="info" + show-icon + /> <BasicTable @register="registerTable" @edit-change="onEditChange"> <template #toolbar> <a-button @click="openImg" type="primary"> 棰勮 </a-button> @@ -38,10 +45,12 @@ import { DeleteEntity, getListByPage, SaveEntity } from '/@/api/tigerapi/system'; import { useMessage } from '/@/hooks/web/useMessage'; import { cloneDeep, isFunction } from 'lodash-es'; - import { isNullOrUnDef } from '/@/utils/is'; + import { isNullOrEmpty, isNullOrUnDef } from '/@/utils/is'; import { CustModalParams } from '/@/api/tigerapi/model/systemModel'; import { EntityCustFunctionType } from '/@/api/tigerapi/model/basModel'; + import { Alert } from 'ant-design-vue'; + const AAlert = Alert; const { t } = useI18n(); const title = ref(''); const tableName = ref(''); @@ -53,6 +62,9 @@ const entityName = ref(''); const ctype = ref(''); const others = ref({}); + const showAlert = ref(false); + const message = ref(''); + const description = ref(''); //鍒楄〃 const ItemColumns = ref([] as BasicColumn[]); @@ -110,8 +122,22 @@ console.log(`绗�${index + 1}寮犲浘鐗囧凡鍔犺浇锛孶RL涓猴細${url}`, dom); }; // 鍙互浣跨敤createImgPreview杩斿洖鐨� PreviewActions 鏉ユ帶鍒堕瑙堥�昏緫锛屽疄鐜扮被浼煎够鐏墖銆佽嚜鍔ㄦ棆杞箣绫荤殑楠氭搷浣� + const Keys = Object.getOwnPropertyNames(others.value); + let path = ''; + dataSource.map((item) => { + for (const k in Keys) { + if (item[Keys[k]] == others.value[Keys[k]] && !isNullOrEmpty(others.value[Keys[k]])) { + path = item['LABEL_VIEW_PATH']; + return; + } + } + }); + if (isNullOrEmpty(path)) { + path = dataSource.filter((q) => isNullOrEmpty(q.WORK_ORDER) || isNullOrEmpty(q.PROD_CODE))[0] + .LABEL_VIEW_PATH; + } createImgPreview({ - imageList: [dataSource[0].LABEL_VIEW_PATH], + imageList: [path], defaultWidth: 700, rememberState: true, onImgLoad, @@ -138,6 +164,9 @@ entityName.value = data?.entityName; ctype.value = data?.ctype; others.value = data?.others; + showAlert.value = data?.alertConfig.showAlert; + message.value = data?.alertConfig.message; + description.value = data?.alertConfig.description; // getForm().resetFields(); /* 鍔ㄦ�乮mport瀹炰綋鍚�.ts鐨勮嚜瀹氫箟鏂规硶 */ try { @@ -162,14 +191,35 @@ * @description: 鍒犻櫎琛� * @param {*} record * @return {*} - */ + */ function handleDel(record: EditRecordRow) { - //鍒犻櫎 - DeleteEntity(record, ctype.value).then((action) => { - if (action.IsSuccessed) { - reload(); - } - }); + if (!isNullOrEmpty(record.WORK_ORDER) || !isNullOrEmpty(record.PROD_CODE)) { + //鍒犻櫎 + DeleteEntity(record, ctype.value).then((action) => { + if (action.IsSuccessed) { + try { + const data = cloneDeep(record.editValueRefs); + console.log(data); + + const [{ CustFunc }] = isNullOrUnDef(custImport.value['default']) + ? EntityCustFunction.value + : custImport.value['default'](); + if (CustFunc && isFunction(CustFunc)) { + CustFunc({ + others: others.value, + ctype: 'delete', + values: record, + }); + } + } catch (error) { + msg.error({ content: t('鍒犻櫎澶辫触'), key: 'saving' }); + } + reload(); + } + }); + } else { + msg.error({ content: t('娌℃湁闇�瑕佸垹闄ょ殑鍙橀噺'), key: 'saving' }); + } } /** -- Gitblit v1.9.3