Ben Lin
2024-06-26 29568a6b76b70b358877dfd3ffe68ccbd42e8844
src/views/tigerprojects/system/lowcode/entityts/ProdRouteBinding.ts
@@ -4,15 +4,16 @@
 * @version:
 * @Date: 2024-06-19 20:34:27
 * @LastEditors: Ben Lin
 * @LastEditTime: 2024-06-26 18:41:16
 * @LastEditTime: 2024-06-26 21:49:44
 */
import { Ref, unref } from 'vue';
import { Ref, ref, unref } from 'vue';
import { GetRoutePTree } from '/@/api/tigerapi/mes/router';
import { GetEnum, convertToTree, getEntity } from '/@/api/tigerapi/system';
import { useLocale } from '/@/locales/useLocale';
import { isNullOrEmpty } from '/@/utils/is';
import { isNullOrEmpty, isNullOrUnDef } from '/@/utils/is';
import { useI18n } from '/@/hooks/web/useI18n';
import { NavItem } from '/@/api/tigerapi/model/basModel';
const { t } = useI18n();
const { getLocale } = useLocale();
@@ -332,6 +333,100 @@
      }
      return value;
    },
    /**
     * @description: 获取标题信息
     * @param {string} type
     * @return {*}
     */
    GetTitle: () => {
      return {
        configTitle: '行为配置',
        navTitle: '添加工艺路线',
      };
    },
    /**
     * @description: 根据选中的树节点判断要切换哪个组件
     * @param {Ref} selectedNodes
     * @return {*}
     */
    SelectNode: (selectedNodes: Ref<any[]>) => {
      let result = { showConfig: false, showNav: false };
      if (isNullOrUnDef(selectedNodes)) {
        return result;
      }
      if (selectedNodes.value[0].type == 'Product') {
        result.showNav = true;
        result.showConfig = false;
      }
      if (selectedNodes.value[0].type == 'Action') {
        result.showNav = false;
        result.showConfig = true;
      }
      return result;
    },
    /**
     * @description: 获取导航项
     * @return {*}
     */
    GetNavItems: () => {
      return [
        {
          title: '添加产品工艺路线',
          icon: 'add_green|svg',
          color: '#1fdaca',
          url: '/addRoute',
          action: 'addRoute',
        },
        {
          title: '添加客户工艺路线',
          icon: 'add_customer|svg',
          color: '#bf0c2c',
          url: '/addCustomer',
          action: 'addCustomer',
        },
      ] as NavItem[];
    },
    /**
     * @description: 导航页面切换按钮时调用方法
     * @param {any} action
     * @return {*}
     */
    naveChangeItem: (action: any, ...args) => {
      args[0](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', //返回值要赋值的字段名称
        searchInfo: { TABLE_NAME: 'MES_ROUTE' },
        which: action,
      });
    },
  };
  const itemCodeModalCfg = {