From cc88111d61a350a4d24cf339b526d4357f934ddf Mon Sep 17 00:00:00 2001 From: Ben Lin <maobin001@msn.com> Date: 星期二, 30 七月 2024 00:31:12 +0800 Subject: [PATCH] 标签模板维护变量更新 --- src/views/tigerprojects/system/lowcode/entityts/BIZ_MES_WO_BATCH.ts | 312 +++++++++++++++++++++++++++++++++++++++++++++++++++- 1 files changed, 306 insertions(+), 6 deletions(-) diff --git a/src/views/tigerprojects/system/lowcode/entityts/BIZ_MES_WO_BATCH.ts b/src/views/tigerprojects/system/lowcode/entityts/BIZ_MES_WO_BATCH.ts index 20513be..8801d77 100644 --- a/src/views/tigerprojects/system/lowcode/entityts/BIZ_MES_WO_BATCH.ts +++ b/src/views/tigerprojects/system/lowcode/entityts/BIZ_MES_WO_BATCH.ts @@ -4,18 +4,22 @@ * @version: * @Date: 2024-06-19 20:34:27 * @LastEditors: Ben Lin - * @LastEditTime: 2024-07-20 22:29:35 + * @LastEditTime: 2024-07-25 21:44:58 */ import { Tag, Tooltip } from 'ant-design-vue'; -import { ActionItem, BasicColumn } from '/@/components/Table'; +import { ActionItem, BasicColumn, FormSchema } from '/@/components/Table'; import { useI18n } from '/@/hooks/web/useI18n'; import { h, unref } from 'vue'; -import { GetEnum } from '/@/api/tigerapi/system'; +import { getEntity, GetEnum, SaveEntity } from '/@/api/tigerapi/system'; import { useLocale } from '/@/locales/useLocale'; +import { useModal } from '/@/components/Modal'; +import { CustModalParams, FunctionType } from '/@/api/tigerapi/model/systemModel'; +import { useForm } from '/@/components/Form'; +import { useMessage } from '/@/hooks/web/useMessage'; const { getLocale } = useLocale(); - +const { createMessage, createErrorModal } = useMessage(); const { t } = useI18n(); function _default() { @@ -36,7 +40,7 @@ * @description: 鑾峰彇鏂板鎸夐挳鐨勮涓猴紝蹇呴渶瑕佹湁鐨勬柟娉� * @return {*} */ - CreateAction: (fnName: string) => { + CreateAction: (type: string) => { return { action: 'drawer', //drawer(鎵撳紑宸︿晶鎶藉眽妗�) | go(璺宠浆鍒版柊鐨勯〉闈�) }; @@ -46,6 +50,16 @@ * @return {*} */ ActionItem: (params: Recordable<any>, data, ...args): ActionItem[] => { + data.map((x) => { + if (x.name == 'handlePause') { + x.onClick = handlePause.bind(null, args, params); + x.tooltip = '鏆傚仠'; + } + if (x.name == 'handleRelease') { + x.onClick = handleRelease.bind(null, args, params); + x.tooltip = '涓嬪彂'; + } + }); return data; }, /** @@ -173,10 +187,296 @@ return { ORDER_NO: val }; }, GetUseForm: () => { - return {}; + return { + forminfo: useForm({ + labelWidth: 120, + schemas: woformSchema, + actionColOptions: { + span: 24, + }, + showActionButtonGroup: false, + }), + }; + }, + /** + * @description: 鑷畾涔夋柟娉� + * @param {string} type + * @param {array} args + * @return {*} + */ + CustFunc: (param: CustModalParams) => { + switch (param.cType) { + case 'BIZ_MES_WO_BATCH': + return getWoFns[param.FnName](param) as Promise<any>; + break; + default: + return new Promise((resolve, reject) => { + try { + (e) => {}; + resolve(true); + } catch { + reject(false); + } finally { + // args[0][0]({ confirmLoading: false }); + } + }); + // break; + } + }, + /** + * @description: 鑾峰彇澶氳〃鍗曟彃妲藉垪琛� + * @return {*} + */ + GetDtlSlots: (type: string) => { + let result = [] as any[]; + switch (type) { + case 'BIZ_MES_WO_BATCH': + result = [ + { + name: 'forminfo', + slots: ['add', 'set'], + preIcons: { add: 'search|svg', set: 'config|svg' }, //濡傛灉鏄涓〃鍗曪紝澧炲姞澶氫釜鎻掓Ы銆俿lots鏄脊鍑烘鎸夐挳鐨勬彃妲斤紝preIcons鏄彃妲藉搴旂殑鎸夐挳鍥炬爣 + title: '涓嬪彂閰嶇疆', + }, + ]; + break; + } + return result; + }, + /** + * @description: 鑾峰彇妯℃�佹搴旂敤鍒楄〃 + * @return {*} + */ + GetUseModals: () => { + return { + useModalData: { + add: useModal(), + set: useModal(), + addRot: useModal(), + setRot: useModal(), + }, + }; + }, + /** + * @description: 寮瑰嚭閫夋嫨妗嗛�夋嫨鎴愬姛杩斿洖鏂规硶 + * @param {*} d + * @param {*} u + * @return {*} + */ + GetSelectSuccess: (d, u) => { + return { + ROUTE_CODE: d.values['val'], + // ID: d.values['id'], + ROT_ID: d.values['id'], + }; + }, + /** + * @description: 鎵撳紑寮瑰嚭閫夋嫨妗� + * @param {Fn} openItemModal + * @param {array} args + * @return {*} + */ + OpenSelectItem: (openItemModal: Fn, ...args) => { + const slotName = args[0]; + switch (slotName) { + case 'addRot': + case 'add': + openItemModal(true, { + title: '宸ヨ壓璺嚎鍒楄〃', + schemas: [ + { + field: 'ROT_CODE', + component: 'Input', + label: '宸ヨ壓璺嚎缂栫爜', + colProps: { + span: 12, + }, + }, + ], + ItemColumns: [ + { + title: t('宸ヨ壓璺嚎缂栫爜'), + dataIndex: 'ROT_CODE', + resizable: true, + sorter: true, + width: 200, + }, + { + title: t('宸ヨ壓璺嚎鍚嶇О'), + dataIndex: 'ROT_NAME', + resizable: true, + sorter: true, + width: 180, + }, + ], + tableName: 'MES_ROUTE', + rowKey: 'ROT_CODE', + returnFieldName: ['ROUTE_CODE', 'ROT_ID'], //杩斿洖鍊艰璧嬪�肩殑瀛楁鍚嶇О + searchInfo: { TABLE_NAME: 'MES_ROUTE' }, + }); + break; + } }, }; + /* 浠ヤ笅鏄唴閮ㄦ柟娉曪紝涓峞xport锛屼緵涓婇潰鐨勬柟娉曡皟鐢� */ + + /** + * @description: 鑷畾涔夋柟娉� + * @return {*} + */ + const getWoFns: Record<string, FunctionType> = { + /** + * @description: 宸ュ崟涓嬪彂淇濆瓨鏂规硶 + * @param {CustModalParams} param + * @return {*} + */ + SaveWoBatch: (param: CustModalParams) => { + return new Promise((resolve, reject) => { + try { + const wo = param.values['mValues']; + wo.STATUS = 2; + wo.ACT_LINE = param.values['forminfo'].ACT_LINE; + SaveEntity(wo, true, 'BIZ_MES_WO_BATCH').then((action) => { + if (action.IsSuccessed) { + resolve(action); + } else { + reject(action); + } + }); + } catch { + reject(false); + } + }); + }, + }; + + /** + * @description: 宸ュ崟鏆傚仠鏂规硶 + * @param {*} args + * @param {Recordable} params + * @return {*} + */ + function handlePause(args, params: Recordable) { + const reload = args[1]; + if (params['record'].STATUS == 0) { + createErrorModal({ + title: t('璀﹀憡'), + content: t('宸ュ崟鏄垵濮嬪寲鐘舵�侊紝涓嶈兘鏆傚仠锛�'), + getContainer: () => document.body, + }); + return; + } + if (params['record'].STATUS == 5) { + createErrorModal({ + title: t('璀﹀憡'), + content: t('宸ュ崟鏄畬鎴愮姸鎬侊紝涓嶈兘鏆傚仠锛�'), + getContainer: () => document.body, + }); + return; + } + params['record'].STATUS = 4; + SaveEntity(params['record'], true, 'BIZ_MES_WO_BATCH').then((action) => { + if (action.IsSuccessed) { + createMessage.success(t('宸叉殏鍋�')); + reload(); + } else { + createMessage.success(t('鏆傚仠鎿嶄綔澶辫触')); + } + }); + } + + /** + * @description: 宸ュ崟涓嬪彂鏂规硶 + * @param {*} args + * @param {Recordable} params + * @return {*} + */ + function handleRelease(args, params: Recordable) { + const openCustModal = args[7]; + openCustModal(true, { + isUpdate: true, //鏄惁鏇存柊鎿嶄綔 + ctype: 'BIZ_MES_WO_BATCH', //鏄摢涓〉闈� + title: '宸ュ崟涓嬪彂', //鏍囬 + width: '900px', //寮瑰嚭妗嗗搴� + formEl: params['useFormData'].value, + formElName: ['forminfo'], //琛ㄥ崟鎻掓Ы鍚嶇О + RowKeys: { add: 'ROUTE_CODE', set: 'ROUTE_CODE' }, //鎻掓Ы鐨勫脊鍑烘閫夋嫨鐨刢ode + fnName: 'SaveWoBatch', //淇濆瓨鏂规硶鍚� + initFnName: {}, //鍒濆鍖栨柟娉曞悕锛屾病鏈夊氨鐣欑┖{} + values: params['record'], //琛ㄥ崟璁板綍 + }); + } + + const woformSchema: FormSchema[] = [ + { + field: 'PLAN_QTY', + label: '宸ュ崟鏁伴噺', + component: 'Input', + required: true, + colProps: { + span: 24, + }, + dynamicDisabled: ({ values }) => { + return true; + }, + }, + // { + // field: 'RELEASE_QTY', + // label: '宸ュ崟涓嬪彂鏁伴噺', + // component: 'Input', + // required: true, + // colProps: { + // span: 24, + // }, + // }, + { + label: '瀹為檯浜х嚎', + field: 'ACT_LINE', + component: 'ApiSelect', + required: true, + colProps: { + span: 24, + }, + componentProps: { + api: getEntity, + params: { entityName: 'MES_LINE', sqlcmd: ' 1=1 ', order: '' }, + resultField: 'Data.Items', + labelField: 'LINE_NAME', + valueField: 'LINE_CODE', + }, + }, + // { + // label: '宸ヨ壓璺嚎', + // field: 'ROUTE_CODE', + // component: 'Input', + // required: true, + // colProps: { + // span: 22, + // }, + // }, + // { + // field: 'add', + // component: 'Input', + // label: '1', + // colSlot: 'add', + // defaultValue: 'MES_ROUTE', + // colProps: { + // span: 1, + // }, + // }, + // { + // field: 'set', + // component: 'Input', + // label: '1', + // colSlot: 'set', + // defaultValue: 'MES_ROUTE', + // colProps: { + // span: 1, + // }, + // }, + ]; + return [methods, ActionColumn]; } -- Gitblit v1.9.3