Ben Lin
2025-03-08 858b9bccead46cdefc99325b7c956d50a2964309
src/views/tigerprojects/system/lowcode/entityts/MES_TOOL_PROP.ts
@@ -58,8 +58,8 @@
     * @return {*}
     */
    GetHomeUrl: () => {
      const param = { ID: 'MES_TOOL_PROP', colSlots: [], crudColSlots: [] };
      return `/MES_TOOL_PROP/LC/${encodeURI(JSON.stringify(param))}`;
      const param = { ID: 'MES_TOOL',EntityName: 'MES_TOOL', colSlots: [], crudColSlots: [] };
      return `/MES_TOOL/LC/${encodeURI(JSON.stringify(param))}`;
    },
    GetBaseColumns: (type: string) => {
      return baseColumns[type];
@@ -71,7 +71,7 @@
      return crudForms[type];
    },
    //主表 生产工具信息
    GetBaseForm: () => {
    GetBaseForm: (entityName:string, isedit: boolean) => {
      return [
        {
          field: 'TOOL_CODE',
@@ -80,6 +80,9 @@
          required: true,
          colProps: {
            span: 8,
          },
          dynamicDisabled: ({ values }) => {
            return isedit? true: false;
          },
        },
        {
@@ -110,9 +113,115 @@
          },
        },
        {
          label: '设备状态',
          field: 'STATUS',
          component: 'ApiSelect',
          colProps: { span: 8 },
          defaultValue: 0,
          componentProps: {
            api: GetEnum,
            params: { name: 'MES_TOOL+STATUSs' },
            resultField: 'Data',
            labelField: unref(getLocale) == 'zh_CN' ? 'Desc' : 'Name',
            valueField: 'Value',
            // onChange: (e, v) => {
            //   alert(e)
            //   console.log('ApiSelect====>:', e, v);
            // },
          },
        },
        {
          label: '生产厂家',
          field: 'MFT_NAME',
          component: 'Input',
          colProps: {
            span: 8,
          },
        },
        {
          label: '生产日期',
          field: 'MFT_DATE',
          component: 'DatePicker',
          colProps: {
            span: 8,
          },
        },
        {
          label: '使用部门',
          field: 'USE_DEPT',
          component: 'Input',
          colProps: {
            span: 8,
          },
        },
        {
          label: '工厂编码',
          field: 'FTY_CODE',
          required: true,
          component: 'ApiSelect',
          colProps: {
            span: 8,
          },
          componentProps: {
            api: getEntity,
            params: { entityName: 'MES_FACTORY', sqlcmd: ' 1=1 ' },
            resultField: 'Data.Items',
            labelField: 'FTY_NAME',
            valueField: 'FTY_CODE',
          },
          // dynamicDisabled: ({ values }) => {
          //   return true;
          // },
        },
        {
          label: '车间编码',
          field: 'WS_CODE',
          required: true,
          component: 'ApiSelect',
          colProps: {
            span: 8,
          },
          componentProps: {
            api: getEntity,
            params: { entityName: 'MES_WORKSHOP', sqlcmd: ' 1=1 ' },
            resultField: 'Data.Items',
            labelField: 'WS_NAME',
            valueField: 'WS_CODE',
          },
          // dynamicDisabled: ({ values }) => {
          //   return true;
          // },
        },
        {
          label: '产线编码',
          field: 'LINE_CODE',
          required: true,
          component: 'ApiSelect',
          colProps: {
            span: 8,
          },
          componentProps: {
            api: getEntity,
            params: { entityName: 'MES_LINE', sqlcmd: ' 1=1 ' },
            resultField: 'Data.Items',
            labelField: 'LINE_NAME',
            valueField: 'LINE_CODE',
          },
          // dynamicDisabled: ({ values }) => {
          //   return true;
          // },
        },
        {
          label: '使用地点',
          field: 'LOCATION',
          component: 'Input',
          colProps: {
            span: 8,
          },
        },
        {
          label: '使用次数上限',
          field: 'USE_LIMIT',
          component: 'Input',
          colProps: {
            span: 8,
@@ -148,7 +257,7 @@
          slots: [],
          preIcons: {},
          title: '生产工具信息',
          entityName: 'MES_TOOL_PROP',
          entityName: 'MES_TOOL',
        },
        // {
        //   name: 'prodinfo',
@@ -183,7 +292,7 @@
          formConfig: {
            labelWidth: 140,
            schemas: searchForms['MES_TOOL_PROP'],
            submitFunc: () => Search('MES_TOOL_PROP', data, args[0]), //自定义查询提交按钮的方法,触发查询提交事件
            submitFunc: () => Search('PROP_NAME', data, args[0]), //自定义查询提交按钮的方法,触发查询提交事件
          },
          useSearchForm: true,
          showTableSetting: false,
@@ -205,23 +314,25 @@
     * @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,
              item.TOOL_CODE.includes(d.values.TOOL_CODE) || item.PROP_NAME == d.values.PROP_NAME,
          );
          if (isNullOrEmpty(d.values.DFT_CODE) && isNullOrEmpty(d.values.DFT_NAME)) {
          if (isNullOrEmpty(d.values.TOOL_CODE) && isNullOrEmpty(d.values.PROP_NAME)) {
            data = d.data.value[d.type];
          }
          break;
      }
      return data;
    },
    //
    KeyFieldValues: (val: string, id: string) => {
      return { DFTG_CODE: val };
      return { TOOL_CODE: val };
    } /**
     * @description: 自定义明细表中编辑返回方法
     * @param {string} type
@@ -235,9 +346,9 @@
        if (item['ID'] == d.ID)
          return {
            ...item,
            DFT_CODE: d.DFT_CODE,
            DFT_NAME: d.DFT_NAME,
            DFT_LEVEL: d.DFT_LEVEL,
            TOOL_CODE: d.TOOL_CODE,
            PROP_NAME: d.PROP_NAME,
           // DFT_LEVEL: d.DFT_LEVEL,
            REMARK: d.REMARK,
          };
        return item;
@@ -313,12 +424,13 @@
        colProps: {
          span: 24,
        },
        //只读
        dynamicDisabled: ({ values }) => {
          return true;
        },
      },
      {
        label: '点检项目名称',
        label: '工具属性名称',
        field: 'PROP_NAME',
        component: 'Input',
        required: true,
@@ -327,6 +439,98 @@
        },
      },
      {
        label: '展示的控件',
        field: 'PROP_CONTROL',
        component: 'Input',
        colProps: {
          span: 24,
        },
      },
      {
        field: 'VALUE_TYPE',
        label: '属性值类型',
        component: 'ApiSelect',
        colProps: { span: 12 },
        defaultValue: 0,
        componentProps: {
          api: GetEnum,
          params: { name: 'MES_TOOL_PROP+VALUE_TYPEs' },
          resultField: 'Data',
          labelField: unref(getLocale) == 'zh_CN' ? 'Desc' : 'Name',
          valueField: 'Value',
          // onChange: (e, v) => {
          //   alert(e)
          //   console.log('ApiSelect====>:', e, v);
          // },
        },
      },
      {
        label: '是否只读(Y/N)',
        field: 'READONLY',
        component: 'Select',
        colProps: {
          span: 24,
        },
        componentProps: {
          options: [
            {
              label: '是',
              value: 'Y',
              key: 'Y',
            },
            {
              label: '否',
              value: 'N',
              key: 'N',
            },
          ],
        },
      },
      {
        label: '是否显示(Y/N)',
        field: 'VISIABLE',
        component: 'Select',
        colProps: {
          span: 24,
        },
        componentProps: {
          options: [
            {
              label: '是',
              value: 'Y',
              key: 'Y',
            },
            {
              label: '否',
              value: 'N',
              key: 'N',
            },
          ],
        },
      },
      {
        label: '是否必填(Y/N)',
        field: 'NECESSARY',
        component: 'Select',
        colProps: {
          span: 24,
        },
        componentProps: {
          options: [
            {
              label: '是',
              value: 'Y',
              key: 'Y',
            },
            {
              label: '否',
              value: 'N',
              key: 'N',
            },
          ],
        },
      },
      {
        label: '备注',
        field: 'REMARK',
        component: 'Input',