From 61900b1f71f4c9048cbc48ed6f4b41ccfa1a6ce4 Mon Sep 17 00:00:00 2001
From: yyg1378265336 <1378265336@qq.com>
Date: 星期三, 26 二月 2025 09:16:16 +0800
Subject: [PATCH] 工具属性、工具信息页面初次编写

---
 src/views/tigerprojects/system/lowcode/entityts/MES_TOOL_PROP.ts |  352 +++++++++++++++++++++++++++++++++++++++
 src/views/tigerprojects/system/lowcode/entityts/MES_TOOL.ts      |  145 ++++++++++++++++
 2 files changed, 497 insertions(+), 0 deletions(-)

diff --git a/src/views/tigerprojects/system/lowcode/entityts/MES_TOOL.ts b/src/views/tigerprojects/system/lowcode/entityts/MES_TOOL.ts
new file mode 100644
index 0000000..881c396
--- /dev/null
+++ b/src/views/tigerprojects/system/lowcode/entityts/MES_TOOL.ts
@@ -0,0 +1,145 @@
+/*
+ * @Description: 涓嶈壇浠g爜缁勭浉鍏�
+ * @Author: Ben Lin
+ * @version:
+ * @Date: 2024-06-19 20:34:27
+ * @LastEditors: Ben Lin
+ * @LastEditTime: 2024-08-04 14:20:02
+ */
+
+import { ActionItem, BasicColumn } from '/@/components/Table';
+import { buildUUID } from '/@/utils/uuid';
+import { useI18n } from '/@/hooks/web/useI18n';
+import { isNullOrUnDef } from '/@/utils/is';
+
+const { t } = useI18n();
+function _default() {
+  const ActionColumn: BasicColumn = {
+    width: 100,
+    title: '鎿嶄綔',
+    dataIndex: 'action',
+    slots: { customRender: 'action' },
+    fixed: 'right',
+  };
+  /**
+   * @description: 涓�浜涜嚜瀹氫箟鏂规硶
+   * @return {*}
+   */
+  const methods = {
+    /**
+     * @description: 鑾峰彇鏂板鎸夐挳鐨勮涓�
+     * @return {*}
+     */
+    CreateAction: (type: string) => {
+      return {
+        action: 'go', //drawer(鎵撳紑宸︿晶鎶藉眽妗�) | go(璺宠浆鍒版柊鐨勯〉闈�) | edit(濡傛灉鏄〃鏍煎彲缂栬緫椤甸潰灏辨槸鑷畾涔夋柟娉�)
+        url: 'MES_TOOL_PROP/High',
+        params: {
+          CODE: '0',
+          ID: buildUUID(),
+          Name: 'MES_TOOL_PROP',
+          Title: '鏂板鐢熶骇宸ュ叿淇℃伅',
+          // pCode: 'DFTG_CODE',
+          IsID: false,
+          ifSave: false,
+          drawers: [{ name: 'MES_TOOL_PROP', code: 'TOOL_CODE', type: 'one', keyName: 'MES_TOOL_PROP' }], //drawers鏄彸杈瑰脊鍑哄鏀逛晶妗嗙殑鍚嶅瓧鍒楄〃
+        },
+      };
+    },
+    /**
+     * @description: 鎿嶄綔瀛楁鑷畾涔夋寜閽�
+     * @return {*}
+     */
+    ActionItem: (params: Recordable<any>, data, ...args): ActionItem[] => {
+      if (!isNullOrUnDef(data[0])) {
+        data[0].onClick =Redact.bind(null, args, params);
+      }
+      return data;
+    },
+    /**
+     * @description: 寮瑰嚭閫夋嫨妗嗘垚鍔熻繑鍥炴柟娉�
+     * @param {*} d
+     * @param {*} u
+     * @return {*}
+     */
+    GetSelectSuccess: (d, u) => {
+      return {
+        ITEM_CODE: d.values['val'],
+      };
+    },
+    /**
+     * @description: 寮瑰嚭閫夋嫨妗嗘墦寮�鏂规硶
+     * @param {Fn} openItemModal
+     * @return {*}
+     */
+    OpenSelectItem: (openItemModal: Fn, ...args) => {
+      openItemModal(true, {
+        title: '鐗╂枡鍒楄〃',
+        schemas: [
+          {
+            field: 'ITEM_CODE',
+            component: 'Input',
+            label: '鐗╂枡缂栫爜',
+            colProps: {
+              span: 12,
+            },
+          },
+        ],
+        ItemColumns: [
+          {
+            title: t('鐗╂枡缂栫爜'),
+            dataIndex: 'ITEM_CODE',
+            resizable: true,
+            sorter: true,
+            width: 200,
+          },
+          {
+            title: t('鐗╂枡鍚嶇О'),
+            dataIndex: 'ITEM_NAME',
+            resizable: true,
+            sorter: true,
+            width: 180,
+          },
+        ],
+        tableName: 'BAS_ITEM',
+        rowKey: 'ITEM_CODE',
+        searchInfo: { TABLE_NAME: 'BAS_ITEM' },
+      });
+    },
+    GetUseForm: () => {
+      return {};
+    },
+  };
+
+  /* 浠ヤ笅鏄唴閮ㄦ柟娉曪紝涓峞xport锛屼緵涓婇潰鐨勬柟娉曡皟鐢� */
+
+  /**
+   * @description: 鑷畾涔夌紪杈戞柟娉�
+   * @param {Fn} args
+   * @param {*} params
+   * @return {*}
+   */
+  function Redact(args: Fn[], params: {}) {
+    const param = {
+      CODE: params['record']['TOOL_CODE'],
+      ID: params['record']['ID'],
+      Name: 'MES_TOOL_PROP',
+      SessionName: 'MES_TOOL_PROP_update',
+      Title: `缂栬緫鐢熶骇宸ュ叿淇℃伅锛�${params['record']['TOOL_CODE']}`,
+      pCode: 'TOOL_CODE',
+      IsID: false,
+      ifSave: false,
+      drawers: [{ name: 'MES_TOOL_PROP', code: 'TOOL_CODE', type: 'one', keyName: 'MES_TOOL_PROP' }], //drawers鏄彸杈瑰脊鍑哄鏀逛晶妗嗙殑鍚嶅瓧鍒楄〃
+    };
+    // 灏嗗璞¤浆鎹负JSON瀛楃涓插苟淇濆瓨鍒皊essionStorage
+    sessionStorage.removeItem(`${param.SessionName}_params`);
+    sessionStorage.setItem(`${param.SessionName}_params`, encodeURI(JSON.stringify(param)));
+    args[5](
+      `/MES_TOOL_PROP/High/${encodeURI(JSON.stringify({ sName: param.SessionName, Name: param.Name }))}`,
+    );
+  }
+
+  return [methods, ActionColumn];
+}
+
+export default _default;
diff --git a/src/views/tigerprojects/system/lowcode/entityts/MES_TOOL_PROP.ts b/src/views/tigerprojects/system/lowcode/entityts/MES_TOOL_PROP.ts
new file mode 100644
index 0000000..f6e60c8
--- /dev/null
+++ b/src/views/tigerprojects/system/lowcode/entityts/MES_TOOL_PROP.ts
@@ -0,0 +1,352 @@
+/*
+ * @Description: 鐢熶骇宸ュ叿淇℃伅
+ * @Author: Ben Lin
+ * @version:
+ * @Date: 2024-06-19 20:34:27
+ * @LastEditors: Ben Lin
+ * @LastEditTime: 2024-07-04 11:21:28
+ */
+
+import { Ref, h, unref } from 'vue';
+import { DeleteEntity, GetEnum, getEntity } from '/@/api/tigerapi/system';
+import { ActionItem, BasicColumn, FormSchema, useTable } from '/@/components/Table';
+import { isNullOrEmpty, isNullOrUnDef } from '/@/utils/is';
+import { buildUUID } from '/@/utils/uuid';
+import { useUserStore } from '/@/store/modules/user';
+import { formatToDateTime } from '/@/utils/dateUtil';
+import { Tag } from 'ant-design-vue';
+import { useLocale } from '/@/locales/useLocale';
+import { useDrawer } from '/@/components/Drawer';
+import { EditOperation, Search, custDel } from '../data';
+
+const { getLocale } = useLocale();
+function _default() {
+  const ActionColumn: BasicColumn = {
+    width: 80,
+    title: '鎿嶄綔',
+    dataIndex: 'action',
+    slots: { customRender: 'action' },
+    fixed: undefined,
+  };
+  
+  /**
+   * @description: 浜涜嚜瀹氫箟鏂规硶
+   * @return {*}
+   */
+  const methods = {
+    /**
+     * @description: 鑾峰彇鏂板鎸夐挳鐨勮涓�
+     * @return {*}
+     */
+    CreateAction: (type: string) => {
+      return {
+        action: 'drawer', //drawer(鎵撳紑宸︿晶鎶藉眽妗�) | go(璺宠浆鍒版柊鐨勯〉闈�)
+      };
+    },
+    /**
+     * @description: 鎿嶄綔瀛楁鑷畾涔夋寜閽�
+     * @return {*}
+     */
+    ActionItem: (params: Recordable<any>, data, ...args): ActionItem[] => {
+      if (!isNullOrUnDef(data[1])) {
+        data[1].popConfirm.confirm = custDel.bind(null, args, params);
+      }
+      return data;
+    },
+    /**
+     * @description: 楂樼骇琛ㄥ崟鍜岃鎯呴〉闈㈣繑鍥炰富椤甸潰鐨剈rl
+     * @return {*}
+     */
+    GetHomeUrl: () => {
+      const param = { ID: 'MES_TOOL_PROP', colSlots: [], crudColSlots: [] };
+      return `/MES_TOOL_PROP/LC/${encodeURI(JSON.stringify(param))}`;
+    },
+    GetBaseColumns: (type: string) => {
+      return baseColumns[type];
+    },
+    GetSearchForm: (type: string) => {
+      return searchForms[type];
+    },
+    GetCrudForm: (type: string) => {
+      return crudForms[type];
+    },
+    //涓昏〃 鐢熶骇宸ュ叿淇℃伅
+    GetBaseForm: () => {
+      return [
+        {
+          field: 'TOOL_CODE',
+          label: '宸ュ叿缂栫爜',
+          component: 'Input',
+          required: true,
+          colProps: {
+            span: 8,
+          },
+        },
+        {
+          label: '宸ュ叿鍨嬪彿',
+          field: 'TOOL_MODEL',
+          required: true,
+          component: 'Input',
+          colProps: {
+            span: 8,
+          },
+        },
+        {
+          label: '宸ュ叿瑙勬牸',
+          field: 'TOOL_SPEC',
+          required: true,
+          component: 'Input',
+          colProps: {
+            span: 8,
+          },
+        },
+        {
+          label: '宸ュ叿绫诲瀷',
+          field: 'TOOL_TYPE',
+          required: true,
+          component: 'Input',
+          colProps: {
+            span: 8,
+          },
+        },
+        {
+          label: '杞﹂棿缂栫爜',
+          field: 'WS_CODE',
+          required: true,
+          component: 'Input',
+          colProps: {
+            span: 8,
+          },
+        },
+        {
+          label: '澶囨敞',
+          field: 'REMARK',
+          component: 'Input',
+          colProps: {
+            span: 8,
+          },
+        },
+        {
+          label: 'ID',
+          field: 'ID',
+          component: 'Input',
+          colProps: {
+            span: 8,
+          },
+          show: false,
+        },
+      ];
+    },
+    /**
+     * @description: 鑾峰彇鍗$墖鍐呴厤缃垪琛紝浠ュ惊鐜樉绀哄涓崱鐗囧苟閰嶇疆澶氫釜鎻掓Ы
+     * @return {*}
+     */    
+    GetBaseCards: (type: string) => {
+      return [
+        {
+          name: 'BaseForm',
+          slots: [],
+          preIcons: {},
+          title: '鐢熶骇宸ュ叿淇℃伅',
+          entityName: 'MES_TOOL_PROP',
+        },
+        // {
+        //   name: 'prodinfo',
+        //   slots: ['addRot', 'setRot'],
+        //   preIcons: { addRot: 'search|svg', setRot: 'config|svg' },
+        //   title: '浜у搧淇℃伅',
+        // },
+        // { name: 'rotinfo', slots: ['add'], preIcons: { add: 'search|svg' }, title: '宸ヨ壓淇℃伅' },
+      ];
+    },
+    /**
+     * @description: 鑾峰彇鍙充晶杈规use鏂规硶
+     * @return {*}
+     */    
+    GetUseDrawers: () => {
+      return [{
+        'MES_TOOL_PROP': useDrawer(),
+      }];
+    },
+    /**
+     * @description: 鑾峰彇琛ㄦ牸use鍒楄〃
+     * @param {string} type
+     * @param {array} args
+     * @return {*}
+     */    
+    GetUseTables: (data: Ref<{}>, ...args) => {
+      return {
+        MES_TOOL_PROP: useTable({
+          title: '鍒楄〃淇℃伅',
+          dataSource: data.value['MES_TOOL_PROP'],
+          columns: baseColumns['MES_TOOL_PROP'],
+          formConfig: {
+            labelWidth: 140,
+            schemas: searchForms['MES_TOOL_PROP'],
+            submitFunc: () => Search('MES_TOOL_PROP', data, args[0]), //鑷畾涔夋煡璇㈡彁浜ゆ寜閽殑鏂规硶锛岃Е鍙戞煡璇㈡彁浜や簨浠�
+          },
+          useSearchForm: true,
+          showTableSetting: false,
+          bordered: true,
+          canResize: true,
+          showIndexColumn: false,
+          actionColumn: {
+            width: 130,
+            title: '鎿嶄綔',
+            dataIndex: 'action',
+            slots: { customRender: 'action' },
+            fixed: 'right',
+          }, //鑷畾涔夋搷浣滃垪
+        })
+      };
+    },
+    /**
+     * @description: 琛ㄦ牸鏌ヨ鍥炶皟锛岀埗缁勪欢涓�氳繃瀛愮粍浠惰Е鍙戠殑浜嬩欢鑾峰彇浼犲叆鐨勫�硷紝鍋氬叿浣撶殑鏌ヨ閫昏緫瀹炵幇
+     * @param {*} d
+     * @return {*}
+     */
+    FormSearch: (d) => {
+      let data = {} as any;
+      switch (d.type) {
+        case 'MES_TOOL_PROP':
+          data = d.data.value[d.type].filter(
+            (item) =>
+              item.DFT_CODE.includes(d.values.DFT_CODE) || item.DFT_NAME == d.values.DFT_NAME,
+          );
+          if (isNullOrEmpty(d.values.DFT_CODE) && isNullOrEmpty(d.values.DFT_NAME)) {
+            data = d.data.value[d.type];
+          }
+          break;
+      }
+      return data;
+    },
+    KeyFieldValues: (val: string, id: string) => {
+      return { DFTG_CODE: val };
+    } /**
+     * @description: 鑷畾涔夋槑缁嗚〃涓紪杈戣繑鍥炴柟娉�
+     * @param {string} type
+     * @param {*} d
+     * @param {*} u
+     * @return {*}
+     */,
+    EditOperation: (data: Ref<any[]>, d, u, item) => {
+      //鏇存柊
+      var _data = data.value[item].map((item) => {
+        if (item['ID'] == d.ID)
+          return {
+            ...item,
+            DFT_CODE: d.DFT_CODE,
+            DFT_NAME: d.DFT_NAME,
+            DFT_LEVEL: d.DFT_LEVEL,
+            REMARK: d.REMARK,
+          };
+        return item;
+      });
+      EditOperation(data,d, u, item, _data);
+    },
+    /**
+     * @description: 鑾峰彇鏍囬淇℃伅
+     * @param {string} type
+     * @return {*}
+     */
+    GetTitle: () => {
+      return {
+        pageTitle: '鐢熶骇宸ュ叿绠$悊',
+        pageContent: '杩欓噷鍙互娣诲姞鍜屼慨鏀圭敓浜у伐鍏风鐞嗗拰鐢熶骇宸ュ叿灞炴�х鐞嗐��',
+        tableTitle: {
+          MES_TOOL_PROP: '鐢熶骇宸ュ叿绠$悊',
+        }
+      };
+    },
+    GetUseForm: () => {
+      return {};
+    },
+  };
+
+  /* 浠ヤ笅鏄唴閮ㄦ柟娉曪紝涓峞xport锛屼緵涓婇潰鐨勬柟娉曡皟鐢� */
+  // 鍒楄〃
+  const baseColumns = {
+    MES_TOOL_PROP: [
+      {
+        title: '宸ュ叿缂栫爜',
+        dataIndex: 'TOOL_CODE',
+      },
+      {
+        title: '鐐规椤圭洰鍚嶇О',
+        dataIndex: 'PROP_NAME',
+      },
+      {
+        title: '澶囨敞',
+        dataIndex: 'REMARK',
+      },
+      {
+        title: '鏇存柊鏃堕棿',
+        dataIndex: 'UPDATE_TIME',
+      },
+      {
+        title: '鏇存柊浜�',
+        dataIndex: 'UPDATE_USER',
+      },
+    ]
+  }
+
+  const searchForms = {
+    MES_TOOL_PROP: [
+      {
+        label: '鐐规椤圭洰鍚嶇О',
+        field: 'PROP_NAME',
+        component: 'Input',
+        colProps: {
+          span: 8,
+        },
+      },
+    ] as FormSchema[],
+  }
+  //鍒楄〃淇℃伅 --鏂板
+  const crudForms = {
+    MES_TOOL_PROP: [
+      {
+        field: 'TOOL_CODE',
+        label: '宸ュ叿缂栫爜',
+        component: 'Input',
+        required: true,
+        colProps: {
+          span: 24,
+        },
+        dynamicDisabled: ({ values }) => {
+          return true;
+        },
+      },
+      {
+        label: '鐐规椤圭洰鍚嶇О',
+        field: 'PROP_NAME',
+        component: 'Input',
+        required: true,
+        colProps: {
+          span: 24,
+        },
+      },
+      {
+        label: '澶囨敞',
+        field: 'REMARK',
+        component: 'Input',
+        colProps: {
+          span: 24,
+        },
+      },
+      {
+        label: 'ID',
+        field: 'ID',
+        component: 'Input',
+        colProps: {
+          span: 24,
+        },
+        show: false,
+      },
+    ] as FormSchema[],
+  }
+
+  return [methods, ActionColumn];
+}
+
+export default _default;

--
Gitblit v1.9.3