Ben Lin
2024-06-24 c8f8a9c645f7857859a9d56fac96192d994be70b
按钮权限更新
已修改23个文件
已添加1个文件
874 ■■■■■ 文件已修改
src/api/sys/menu.ts 16 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/api/tigerapi/mes/mesApi.ts 1 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/api/tigerapi/mes/router.ts 16 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/api/tigerapi/model/basModel.ts 15 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/api/tigerapi/system.ts 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/components/GeneralModal.vue 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/tigerprojects/bas/MaterialInfo/index.vue 27 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/tigerprojects/system/lowcode/composition/RouteAction.vue 16 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/tigerprojects/system/lowcode/composition/index.vue 90 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/tigerprojects/system/lowcode/detail/detail.vue 5 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/tigerprojects/system/lowcode/entityts/BAS_DEFECT.ts 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/tigerprojects/system/lowcode/entityts/BAS_DEFECT_GRP.ts 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/tigerprojects/system/lowcode/entityts/BAS_LABEL_PV.ts 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/tigerprojects/system/lowcode/entityts/BAS_LABEL_TEMP.ts 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/tigerprojects/system/lowcode/entityts/BAS_LABEL_VAR.ts 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/tigerprojects/system/lowcode/entityts/BAS_PKG_DTL.ts 15 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/tigerprojects/system/lowcode/entityts/BAS_PKG_RULE.ts 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/tigerprojects/system/lowcode/entityts/BAS_REASON.ts 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/tigerprojects/system/lowcode/entityts/BAS_REASON_GRP.ts 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/tigerprojects/system/lowcode/entityts/V_BAS_PROD.ts 7 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/tigerprojects/system/lowcode/high/dtl.vue 5 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/tigerprojects/system/lowcode/normal/index.vue 262 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/tigerprojects/system/lowcode/normal/mainTable.vue 356 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/tigerprojects/system/menu/menu.data.ts 13 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/api/sys/menu.ts
@@ -4,11 +4,12 @@
 * @version: 
 * @Date: 2024-06-18 15:09:47
 * @LastEditors: Ben Lin
 * @LastEditTime: 2024-06-21 16:50:45
 * @LastEditTime: 2024-06-24 14:53:25
 */
import { defHttp } from '/@/utils/http/axios';
import { getMenuListResultModel } from './model/menuModel';
import { genAction, Api } from '../tigerapi/system';
import { useUserStore } from '/@/store/modules/user';
enum _Api {
  GetMenuList = '/SYS/getMenuList',
@@ -65,7 +66,7 @@
export const getMenuButtons = async (params: string) =>{
  const usParams = genAction('SYS_MENU', {
    QueryAble_T: '',
    where: "PFUNC_CODE = '" + params + "'",
    where: "PFUNC_CODE = '" + params + "' And BUTTON_TYPE < 3",
    order: '',
  });
  return await defHttp.post(
@@ -76,3 +77,14 @@
    },
  );
};
/**
 * @description: æ ¹æ®å½“前菜单代码获取用户有权限的按钮列表
 * @param {string} menuCode
 * @return {*}
 */
export async function getRoleButtons(menuCode: string) {
  const buttons = (await getMenuButtons(menuCode)).Data.Items;
  const roles = useUserStore().getUserInfo.roles;
  return buttons.filter((btn) => roles.some((item) => item.MENU_CODE === btn.FUNC_CODE));
}
src/api/tigerapi/mes/mesApi.ts
@@ -19,5 +19,6 @@
  SaveRouteNodePost = '/MES/SaveRouteNodePost',
  GetRoutePTree = '/MES/GetRoutePTree',
  RouteToProd = '/MES/RouteToProd',
  RouteToCust = '/MES/RouteToCust',
  
}
src/api/tigerapi/mes/router.ts
@@ -156,3 +156,19 @@
  );
  return data;
};
/**
 * @description: æ·»åŠ å·¥è‰ºçº¿åˆ°å®¢æˆ·
 * @param {*} params
 * @return {*}
 */
export const RouteToCust = async (params: {}) => {
  const data = await defHttp.get(
    { url: mesApi.RouteToCust, params: params },
    {
      errorMessageMode: 'none',
      isTransformResponse: false,
    },
  );
  return data;
};
src/api/tigerapi/model/basModel.ts
@@ -1,4 +1,6 @@
import { Ref } from 'vue';
import { BasicPageParams, BasicFetchResult } from '/@/api/model/baseModel';
import { ActionItem } from '/@/components/Table';
//物料信息实体
export type MaterialInfoParams = {
  ITEM_CODE?: string;
@@ -103,3 +105,16 @@
export type MaterialInfoPageListGetResultModel = BasicFetchResult<MaterialInfoListItem>;
export type SupplierInfoPageListGetResultModel = BasicFetchResult<SupplierInfoListItem>;
export type PackageRulePageListGetResultModel = BasicFetchResult<PackageRuleListItem>;
export interface EntityCustFunctionType {
  CreateAction: (fnName: string) => {};
  ActionItem: (params: Recordable<any>, data, ...args) => ActionItem[];
  EditeOperation: (data: Ref<any[]>, d, u) => void;
  GetHomeUrl: () => string;
  GetBaseColumns: () => [];
  GetSearchForm: () => [];
  GetCrudForm: () => [];
  GetBaseForm: () => [];
  GetBaseCards: () => [];
  OthersValues: (val: string, id: string) => {}
}
src/api/tigerapi/system.ts
@@ -745,7 +745,7 @@
}
async function getListByPageAsync(params: any) {
  const data = await defHttp.post(
    { url: Api.QueryUrl, params,timeout:30000 },
    { url: Api.QueryUrl, params,timeout:50000 },
    {
      isTransformResponse: false,
    },
src/views/components/GeneralModal.vue
@@ -33,6 +33,7 @@
  const rowKey = ref('');
  const returnFieldName = ref('');
  const schemas = ref([] as FormSchema[]);
  const which = ref('');
  //列表
  const ItemColumns = ref([] as BasicColumn[]);
@@ -98,6 +99,7 @@
    rowKey.value = data?.rowKey;
    returnFieldName.value = data?.returnFieldName;
    checkedKeys.value = [];
    which.value = data?.which;
    getForm().resetFields();
    reload();
  }
@@ -113,6 +115,7 @@
        isUpdate: unref(false),
        values: { val: record[rowKey.value], id: record['ID'] },
        returnFieldName: returnFieldName.value,
        which: which.value,
      });
    } finally {
      setModalProps({ confirmLoading: false });
@@ -133,6 +136,7 @@
        isUpdate: unref(false),
        values: { val: values, id: ids },
        returnFieldName: returnFieldName.value,
        which: which.value,
      });
    } finally {
      setModalProps({ confirmLoading: false });
src/views/tigerprojects/bas/MaterialInfo/index.vue
@@ -111,31 +111,6 @@
  onMounted(async () => {
    buttons.value = (await getMenuButtons(currentRoute.value.meta.menuCode as string)).Data.Items;
    const roles = useUserStore().getUserInfo.roles;
    HasRole.value = roles.some((item) => item.MENU_CODE === buttons.value[0]['FUNC_CODE']);
    const btnsByrole = buttons.value.filter((btn) => roles.some((item) => item.MENU_CODE === btn['FUNC_CODE']));
  });
  /**
   * @description: è·³è½¬äº§å“å·¥è‰ºç»‘定页面
   * @param {*} record
   * @return {*}
   */
  function handleBinding(record: Recordable) {
    const id = {
      ID: record.ID,
      Name: 'ProdRouteBinding',
      CODE: record.ITEM_CODE,
      Title: `产品[${record.ITEM_CODE}]工艺绑定`,
      colSlots: [],
      crudColSlots: [],
      dense: true,
      pageTitle: `产品工艺绑定`,
      pageContent: `这里是管理产品的工艺绑定,一个产品可以绑定多个工艺路线`,
    };
    go(`/ProdRouteBinding/CP/${encodeURI(JSON.stringify(id))}`);
    // let obj = JSON.stringify(id);
    // push({
    //   path: '/ProdRouteBinding',
    //   state: {obj}, //HTML5 History API çš„传参,参数隐藏不在地址栏显示(history)
    // })
  }
</script>
src/views/tigerprojects/system/lowcode/composition/RouteAction.vue
@@ -4,7 +4,7 @@
 * @version: 
 * @Date: 2024-06-20 12:13:27
 * @LastEditors: Ben Lin
 * @LastEditTime: 2024-06-21 15:37:05
 * @LastEditTime: 2024-06-24 10:56:19
-->
<template>
  <Card title="操作">
@@ -20,7 +20,7 @@
<script lang="ts" setup>
  import { Card, CardGrid } from 'ant-design-vue';
  import Icon from '@/components/Icon/Icon.vue';
  import { RouteToProd } from '/@/api/tigerapi/mes/router';
  import { RouteToCust, RouteToProd } from '/@/api/tigerapi/mes/router';
  import GeneralModal from '/@/views/components/GeneralModal.vue';
  import { useModal } from '/@/components/Modal';
  import { useI18n } from '/@/hooks/web/useI18n';
@@ -109,7 +109,6 @@
    // },
  ];
  function changeItem(action) {
    if (action == 'addRoute') {
      openModal(true, {
        title: '工艺路线列表',
        schemas: [
@@ -142,8 +141,8 @@
        rowKey: 'ROT_CODE',
        returnFieldName: 'ROUTE_CODE', //返回值要赋值的字段名称
        searchInfo: { TABLE_NAME: 'MES_ROUTE' },
      which: action,
      });
    }
  }
  /**
@@ -154,13 +153,20 @@
   */
   async function handleSuccess(d, u) {
    if(isNullOrEmpty(Prod_Code.value)){
      createErrorModal({ title: t('sys.api.errorTip'), content: '产品为空,不能添加工艺路线,请点击左侧选择产品' });
      createErrorModal({
        title: t('sys.api.errorTip'),
        content: '产品为空,不能添加工艺路线,请点击左侧选择产品',
      });
      return;
    }
    let codes = d.values.id.split(',');
    var i;
    for (i = 0; i < codes.length; i++) {
      if (d.which == 'addRoute') {
      await RouteToProd({ rotId: codes[i], prodCode: Prod_Code.value });
      } else {
        await RouteToCust({ rotId: codes[i], prodCode: Prod_Code.value, custCode: '' });
      }
    }
    
    await refreshPage();
src/views/tigerprojects/system/lowcode/composition/index.vue
@@ -69,7 +69,7 @@
  import GeneralModal from '/@/views/components/GeneralModal.vue';
  import RouteAction from './RouteAction.vue';
  import CustModal from '/@/views/components/CustModal.vue';
  import { OpenCustModal, getOthersValues } from '../data';
  import { OpenCustModal } from '../data';
  import { Ref, onMounted, provide, reactive, ref } from 'vue';
  import { useRoute } from 'vue-router';
  import { useDrawer } from '/@/components/Drawer';
@@ -103,39 +103,15 @@
  const dense = isNullOrUnDef(objParams.value.dense) ? ref(false) : ref(objParams.value.dense);
  const pageTitle = ref(objParams.value.pageTitle);
  const pageContent = ref(objParams.value.pageContent);
  const others = ref(getOthersValues(entityName.value, objParams.value.CODE, objParams.value.ID));
  const prodCode = ref('');
  const rotType = ref('');
  const isMounted = ref(false);
  const custImport = ref(null);
  const custImport = ref<any>(null);
  const [registerCust, { openModal: openCustomModal, closeModal }] = useModal();
  const [registerItemAdd, { openModal: openItemModal }] = useModal();
  const [registerDrawer, { openDrawer }] = useDrawer();
  provide<Ref<string>>('prodCode', prodCode);
  setTitle(objParams.value.Title); //设置标签页标题
  // const [registerTable, { reload }] = useTable({
  //   title: '列表信息',
  //   api: getRoleListByPage,
  //   columns,
  //   formConfig: {
  //     labelWidth: 120,
  //     schemas: searchFormSchema,
  //   },
  //   pagination: false,
  //   striped: false,
  //   useSearchForm: true,
  //   showTableSetting: true,
  //   bordered: true,
  //   showIndexColumn: false,
  //   canResize: false,
  //   actionColumn: {
  //     width: 80,
  //     title: '操作',
  //     dataIndex: 'action',
  //     // slots: { customRender: 'action' },
  //     fixed: undefined,
  //   },
  // });
  /**
   * @description: èŽ·å–æ ‘å½¢æ•°æ®
@@ -144,7 +120,7 @@
   */
  async function fetch(type: string) {
    if (!isNullOrUnDef(custImport.value)) {
      const [{ fetchTreeData }] = custImport.value.default();
      const [{ fetchTreeData }] = custImport.value['default']();
    //根据type获取树形数据
    const data = await fetchTreeData(type, objParams.value.CODE);
    title.value = data.title;
@@ -159,7 +135,7 @@
   */
  function goBack() {
    if (!isNullOrUnDef(custImport.value)) {
      const [{ GetHomeUrl }] = custImport.value.default();
      const [{ GetHomeUrl }] = custImport.value['default']();
      // æœ¬ä¾‹çš„æ•ˆæžœæ—¶ç‚¹å‡»è¿”回始终跳转到账号列表页,实际应用时可返回上一页
      go(GetHomeUrl(entityName.value));
    }
@@ -179,7 +155,7 @@
    if (isNullOrUnDef(custImport.value)) {
      return '';
    } else {
      const [{CreateIcon}] = custImport.value.default();
      const [{CreateIcon}] = custImport.value['default']();
      return CreateIcon(params);
    }
  }
@@ -193,58 +169,6 @@
      isMounted.value = true;
    } catch (e) {}
  });
  /**
   * @description: ç”Ÿæˆåˆ—表中操作项的按钮
   * @param {*} record
   * @return {*}
   */
  function createActions(record) {
    // return GetActionsData(
    //   {
    //     record,
    //     isUpdate: true,
    //     ifSave: true,
    //     entityName: entityName.value,
    //     formJson: getFormSchema(`${entityName.value}_Crud`),
    //     cType,
    //     dtlSlots,
    //     useModalData,
    //     useFormData,
    //     crudColSlots,
    //   },
    //   openDrawer,
    //   reload,
    //   openCustomModal,
    //   useForm,
    //   useModal,
    // );
  }
  /**
   * @description: éªŒè¯è¡¨å•
   * @return {*}
   */
  async function validate() {
    let validates = {};
    const Keys = Object.getOwnPropertyNames(useFormData.value);
    let i;
    for (i = 0; i < Keys.length; i++) {
      validates[Keys[i]] = await useFormData.value[Keys[i]][1].validate();
    }
    return validates;
  }
  // function handleEdit(record: Recordable) {
  //   openModal(true, {
  //     record,
  //     isUpdate: true,
  //   });
  // }
  // function handleDelete(record: Recordable) {
  //   console.log(record);
  // }
  function handleSelect(deptId = '', info) {
    searchInfo.deptId = deptId;
@@ -263,10 +187,6 @@
    rotType.value = '';
    // reload();
  }
  // function handleSuccess() {
  //   reload();
  // }
  /**
   * @description: å¼¹å‡ºæ¡†ç¡®å®šè¿”回
src/views/tigerprojects/system/lowcode/detail/detail.vue
@@ -84,6 +84,11 @@
  onMounted(() => {});
  /**
   * @description: ç”Ÿæˆåˆ—表中操作项的按钮
   * @param {*} record
   * @return {*}
   */
  function createActions(record) {
    const params = {
      record,
src/views/tigerprojects/system/lowcode/entityts/BAS_DEFECT.ts
@@ -63,7 +63,7 @@
     * @description: èŽ·å–æ–°å¢žæŒ‰é’®çš„è¡Œä¸º
     * @return {*}
     */
    CreateAction: () => {
    CreateAction: (fnName: string) => {
      return {
        action: 'drawer', //drawer(打开左侧抽屉框) | go(跳转到新的页面)
      };
src/views/tigerprojects/system/lowcode/entityts/BAS_DEFECT_GRP.ts
@@ -4,7 +4,7 @@
 * @version:
 * @Date: 2024-06-19 20:34:27
 * @LastEditors: Ben Lin
 * @LastEditTime: 2024-06-22 23:30:54
 * @LastEditTime: 2024-06-24 15:52:18
 */
import { ActionItem, BasicColumn } from '/@/components/Table';
@@ -44,7 +44,7 @@
     * @description: èŽ·å–æ–°å¢žæŒ‰é’®çš„è¡Œä¸º
     * @return {*}
     */
    CreateAction: () => {
    CreateAction: (fnName: string) => {
      return {
        action: 'go', //drawer(打开左侧抽屉框) | go(跳转到新的页面)
        url: 'BAS_DEFECT/High',
src/views/tigerprojects/system/lowcode/entityts/BAS_LABEL_PV.ts
@@ -26,7 +26,7 @@
     * @description: èŽ·å–æ–°å¢žæŒ‰é’®çš„è¡Œä¸º
     * @return {*}
     */
    CreateAction: () => {
    CreateAction: (fnName: string) => {
      return {
        action: 'drawer', //drawer(打开左侧抽屉框) | go(跳转到新的页面)
      };
src/views/tigerprojects/system/lowcode/entityts/BAS_LABEL_TEMP.ts
@@ -4,7 +4,7 @@
 * @version:
 * @Date: 2024-06-19 20:34:27
 * @LastEditors: Ben Lin
 * @LastEditTime: 2024-06-23 23:53:41
 * @LastEditTime: 2024-06-24 15:52:02
 */
import { ActionItem, BasicColumn } from '/@/components/Table';
@@ -46,7 +46,7 @@
     * @description: èŽ·å–æ–°å¢žæŒ‰é’®çš„è¡Œä¸º
     * @return {*}
     */
    CreateAction: () => {
    CreateAction: (fnName: string) => {
      return {
        action: 'drawer', //drawer(打开左侧抽屉框) | go(跳转到新的页面)
      };
src/views/tigerprojects/system/lowcode/entityts/BAS_LABEL_VAR.ts
@@ -31,7 +31,7 @@
     * @description: èŽ·å–æ–°å¢žæŒ‰é’®çš„è¡Œä¸ºï¼Œå¿…éœ€è¦æœ‰çš„æ–¹æ³•
     * @return {*}
     */
    CreateAction: () => {
    CreateAction: (fnName: string) => {
      return {
        action: 'drawer', //drawer(打开左侧抽屉框) | go(跳转到新的页面)
      };
src/views/tigerprojects/system/lowcode/entityts/BAS_PKG_DTL.ts
@@ -4,7 +4,7 @@
 * @version:
 * @Date: 2024-06-19 20:34:27
 * @LastEditors: Ben Lin
 * @LastEditTime: 2024-06-23 18:28:00
 * @LastEditTime: 2024-06-24 15:51:12
 */
import { Ref } from 'vue';
@@ -55,7 +55,7 @@
     * @description: èŽ·å–æ–°å¢žæŒ‰é’®çš„è¡Œä¸º
     * @return {*}
     */
    CreateAction: () => {
    CreateAction: (fnName: string) => {
      return {
        action: 'drawer', //drawer(打开左侧抽屉框) | go(跳转到新的页面)
      };
@@ -65,6 +65,7 @@
     * @return {*}
     */
    ActionItem: (params: Recordable<any>, data, ...args): ActionItem[] => {
      /* é‡å†™åˆ é™¤æ–¹æ³• */
      data[1].popConfirm.confirm = custDel.bind(null, args, params);
      return data;
    },
@@ -303,14 +304,18 @@
        },
      ];
    },
    /**
     * @description: é«˜çº§è¡¨å•主信息卡片生成,可以多个
     * @return {*}
     */
    GetBaseCards: () => {
      return [
        {
          name: 'BaseForm',
          slots: [],
          preIcons: {},
          slots: [], //定义插槽
          preIcons: {}, //定义插槽中按钮图标
          title: '包装信息',
          entityName: 'BAS_PKG_RULE',
          entityName: 'BAS_PKG_RULE', //实体名称
        },
      ];
    },
src/views/tigerprojects/system/lowcode/entityts/BAS_PKG_RULE.ts
@@ -42,7 +42,7 @@
     * @description: èŽ·å–æ–°å¢žæŒ‰é’®çš„è¡Œä¸º
     * @return {*}
     */
    CreateAction: () => {
    CreateAction: (fnName: string) => {
      return {
        action: 'go', //drawer(打开左侧抽屉框) | go(跳转到新的页面)
        url: 'BAS_PKG_DTL/High',
src/views/tigerprojects/system/lowcode/entityts/BAS_REASON.ts
@@ -4,7 +4,7 @@
 * @version:
 * @Date: 2024-06-22 00:58:43
 * @LastEditors: Ben Lin
 * @LastEditTime: 2024-06-23 18:28:55
 * @LastEditTime: 2024-06-24 15:50:42
 */
/*
 * @Description: ä¸è‰¯åŽŸå› ç›¸å…³
@@ -64,7 +64,7 @@
     * @description: èŽ·å–æ–°å¢žæŒ‰é’®çš„è¡Œä¸º
     * @return {*}
     */
    CreateAction: () => {
    CreateAction: (fnName: string) => {
      return {
        action: 'drawer', //drawer(打开左侧抽屉框) | go(跳转到新的页面)
      };
src/views/tigerprojects/system/lowcode/entityts/BAS_REASON_GRP.ts
@@ -4,7 +4,7 @@
 * @version:
 * @Date: 2024-06-19 20:34:27
 * @LastEditors: Ben Lin
 * @LastEditTime: 2024-06-22 23:33:08
 * @LastEditTime: 2024-06-24 15:50:49
 */
import { ActionItem, BasicColumn } from '/@/components/Table';
@@ -45,7 +45,7 @@
     * @description: èŽ·å–æ–°å¢žæŒ‰é’®çš„è¡Œä¸º
     * @return {*}
     */
    CreateAction: () => {
    CreateAction: (fnName: string) => {
      return {
        action: 'go', //drawer(打开左侧抽屉框) | go(跳转到新的页面)
        url: 'BAS_REASON/High',
src/views/tigerprojects/system/lowcode/entityts/V_BAS_PROD.ts
@@ -4,7 +4,7 @@
 * @version:
 * @Date: 2024-06-19 20:34:27
 * @LastEditors: Ben Lin
 * @LastEditTime: 2024-06-22 22:20:05
 * @LastEditTime: 2024-06-24 15:50:03
 */
import { ActionItem, BasicColumn } from '/@/components/Table';
@@ -48,7 +48,7 @@
     * @description: èŽ·å–æ–°å¢žæŒ‰é’®çš„è¡Œä¸º
     * @return {*}
     */
    CreateAction: () => {
    CreateAction: (fnName: string) => {
      return {
        action: 'drawer', //drawer(打开左侧抽屉框) | go(跳转到新的页面)
      };
@@ -66,6 +66,9 @@
        },
      ];
    },
    OthersValues: (val: string, id: string) => {
      return { RSNG_CODE: val };
    },
  };
  return [methods, ActionColumn];
src/views/tigerprojects/system/lowcode/high/dtl.vue
@@ -118,6 +118,11 @@
    });
  });
  /**
   * @description: ç”Ÿæˆåˆ—表中操作项的按钮
   * @param {*} record
   * @return {*}
   */
  function createActions(record) {
    const params = {
      record,
src/views/tigerprojects/system/lowcode/normal/index.vue
@@ -4,19 +4,26 @@
 * @version: 
 * @Date: 2024-05-30 13:28:20
 * @LastEditors: Ben Lin
 * @LastEditTime: 2024-06-23 00:03:51
 * @LastEditTime: 2024-06-24 18:10:10
-->
<template>
  <div>
    <BasicTable @register="registerTable" v-if="isMounted">
    <!-- <BasicTable @register="registerTable" v-if="isMounted">
      <template #toolbar>
        <a-button type="primary" @click="handleCreate" preIcon="add_02|svg"> æ–°å¢ž </a-button>
        <a-button
          type="primary"
          @click="handleCreate(item['DO_METHOD'])"
          :preIcon="item['ICON_URL']"
          v-for="item in buttons.filter((m) => m['BUTTON_TYPE'] == 0)"
          :key="item"
        >
          {{ item['FUNC_NAME'] }}
        </a-button>
      </template>
      <template #action="{ record }">
        <TableAction :actions="createActions(record)" />
      </template>
      <template #[item]="{ field }" v-for="item in colSlots" :key="item">
        <!-- <template #form-BAS_REASON3aadd="{ field }"> -->
        <a-button
          v-if="field"
          class="mt-1 ml-1"
@@ -30,7 +37,10 @@
        />
      </template>
    </BasicTable>
    <normalDrawer @register="registerDrawer" @success="handleSuccess" />
    <normalDrawer @register="registerDrawer" @success="handleSuccess" /> -->
    <Suspense>
      <mainTable />
    </Suspense>
    <CustModal
      @register="registerCust"
      @success="custSuccess"
@@ -60,14 +70,11 @@
  </div>
</template>
<script lang="ts" setup>
  import { h, onMounted, ref, unref } from 'vue';
  import { BasicTable, useTable, TableAction, BasicColumn, FormSchema } from '/@/components/Table';
  import { useDrawer } from '/@/components/Drawer';
  import normalDrawer from '../normalDrawer.vue';
  import { Ref, h, onMounted, provide, ref, unref } from 'vue';
  import mainTable from './mainTable.vue';
  import GeneralModal from '/@/views/components/GeneralModal.vue';
  import { DeleteEntity, GetEnum, getEntity, getListByPage } from '/@/api/tigerapi/system';
  import { useGlobSetting } from '/@/hooks/setting';
  import { useRoute } from 'vue-router';
  import { useRoute, useRouter } from 'vue-router';
  import { Tag, Tooltip } from 'ant-design-vue';
  import CustModal from '/@/views/components/CustModal.vue';
  import { BasicForm, useForm } from '/@/components/Form/index';
@@ -78,166 +85,35 @@
  import { uploadApi } from '/@/api/sys/upload';
  import { useGo } from '/@/hooks/web/usePage';
  import { useI18n } from '/@/hooks/web/useI18n';
  import { getRoleButtons } from '/@/api/sys/menu';
  const { getLocale } = useLocale();
  const { t } = useI18n();
  const route = useRoute();
  const { currentRoute } = useRouter();
  const go = useGo();
  const objParams = ref(JSON.parse(decodeURI(route.params?.id as string)));
  const entityName = ref(objParams.value.ID);
  const globSetting = useGlobSetting();
  const _columns = ref([]);
  const _searchFormSchema = ref([]);
  const _crudFormSchema = ref([]);
  const formSchemas = ref({}); //弹出框多表单结构
  const useModalData = ref({}); //表单中插槽渲染按钮打开模态框useModal方法
  const useFormData = ref({});
  const colSlots = ref<any>(objParams.value.colSlots); //按钮插槽
  const crudColSlots = ref<any>(objParams.value.crudColSlots);
  const cType = ref('');
  const dtlSlots = ref([] as any[]);
  const selectVals = ref({});
  const isExistSql = ref('');
  const custImport = ref(null);
  const custImport = ref<any>(null);
  const isMounted = ref(false);
  const buttons = ref([]);
  const others = ref<any>(null);
  provide<Ref<any>>('objParams', objParams.value);
  provide<Ref<any[]>>('_columns', _columns);
  provide<Ref<any[]>>('_searchFormSchema', _searchFormSchema);
  provide<Ref<any[]>>('_crudFormSchema', _crudFormSchema);
  provide<Ref<string>>('isExistSql', isExistSql);
  provide<Ref<any>>('others', others);
  const [registerCust, { openModal: openCustomModal, closeModal }] = useModal();
  const [registerItemAdd, { openModal: openItemModal }] = useModal();
  const [registerDrawer, { openDrawer }] = useDrawer();
  const [registerTable, { getForm, reload, setProps }] = useTable({
    title: '列表信息',
    api: getListByPage,
    searchInfo: { TABLE_NAME: objParams.value.ID },
    columns: _columns as unknown as BasicColumn[],
    formConfig: {
      labelWidth: 140,
      schemas: _searchFormSchema as unknown as FormSchema[],
    },
    useSearchForm: true,
    showTableSetting: true,
    bordered: true,
    canResize: true,
    showIndexColumn: false,
    actionColumn: {
      width: 130,
      title: '操作',
      dataIndex: 'action',
      slots: { customRender: 'action' },
      fixed: undefined,
    }, //自定义操作列
  });
  /**
   * @description: ç”Ÿæˆåˆ—表中操作项的按钮
   * @param {*} record
   * @return {*}
   */
  function createActions(record) {
    const params = {
      record,
      isUpdate: true,
      entityName: objParams.value.ID,
      formJson: _crudFormSchema.value,
      cType,
      dtlSlots,
      formSchemas,
      useModalData,
      useFormData,
      crudColSlots,
    };
    const actionItem = [
      {
        icon: 'clarity:note-edit-line',
        onClick: editRecord.bind(null, openDrawer, params),
      },
      {
        icon: 'ant-design:delete-outlined',
        color: 'error',
        popConfirm: {
          title: '是否确认删除?',
          placement: 'left',
          confirm: deleteRecord.bind(null, reload, params),
        },
      },
    ];
    if (isNullOrUnDef(custImport.value)) {
      return actionItem;
    }
    const [{ ActionItem }] = custImport.value.default();
    return ActionItem(
      params,
      actionItem,
      openDrawer,
      reload,
      openCustomModal,
      useForm,
      useModal,
      go,
    );
  }
  /**
   * @description: å…¬ç”¨ç¼–辑方法
   * @param {Fn} fn
   * @param {*} params
   * @return {*}
   */
  function editRecord(fn: Fn, params: {}) {
    fn(true, params);
  }
  /**
   * @description: å…¬ç”¨åˆ é™¤æ–¹æ³•
   * @param {Fn} fn
   * @param {*} params
   * @return {*}
   */
  function deleteRecord(fn: Fn, params: {}) {
    console.log(params['record']);
    //删除
    DeleteEntity(params['record'], params['entityName']).then((action) => {
      if (action.IsSuccessed) {
        fn();
      }
    });
  }
  /**
   * @description: èŽ·å–æ–°å¢žæŒ‰é’®çš„è¡Œä¸º
   * @return {*}
   */
  function handleCreate() {
    if (isNullOrUnDef(custImport.value)) {
      openDrawer(true, {
        isUpdate: false,
        entityName: objParams.value.ID,
        formJson: _crudFormSchema.value,
        crudColSlots,
        isExistSql: isExistSql.value,
      });
    } else {
      const [{ CreateAction }] = custImport.value.default();
      const result = CreateAction(objParams.value.ID);
      switch (result.action) {
        case 'go':
          go(`/${result.url}/${encodeURI(JSON.stringify(result.params))}`);
          break;
        case 'drawer':
          openDrawer(true, {
            isUpdate: false,
            entityName: objParams.value.ID,
            formJson: _crudFormSchema.value,
            crudColSlots,
            isExistSql: isExistSql.value,
          });
          break;
      }
    }
  }
  function handleSuccess() {
    reload();
  }
  onMounted(async () => {
    /* ç”¨json获取列 */
@@ -342,84 +218,8 @@
      }
    }
    _columns.value = objs;
    buttons.value = await getRoleButtons(currentRoute.value.meta.menuCode as string);
  });
  /**
   * @description: å¼¹å‡ºé€‰æ‹©æ¡†é€‰æ‹©æˆåŠŸåŽäº‹ä»¶
   * @param {*} d
   * @param {*} u
   * @param {*} item
   * @return {*}
   */
  function handleItemSuccess(d, u, item) {
    /* åŠ¨æ€import实体名.ts的自定义方法 */
    try {
      import(
        /* @vite-ignore */ `../entityts/${getForm().getFieldsValue()[`${item.replace(/form-/, '').replace(/add/, '')}PSelect_0`]}`
      )
        .then((m) => {
          const [{ GetSelectSuccess }] = m.default();
          getForm().setFieldsValue(GetSelectSuccess(d, u));
        })
        .catch(() => {
          getForm().setFieldsValue({
            ITEM_CODE: d.values['val'],
          });
        });
    } catch (e) {}
  }
  /**
   * @description: å¼¹å‡ºé€‰æ‹©æ¡†
   * @param {*} item
   * @return {*}
   */
  function handleSelectItem(item) {
    /* åŠ¨æ€import实体名.ts的自定义方法 */
    try {
      import(
        /* @vite-ignore */ `../entityts/${getForm().getFieldsValue()[`${item.replace(/form-/, '').replace(/add/, '')}PSelect_0`]}`
      )
        .then((m) => {
          const [{ OpenSelectItem }] = m.default();
          OpenSelectItem(openItemModal);
        })
        .catch(() => {
          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' },
          });
        });
    } catch (e) {}
  }
  /**
   * @description: Select è‡ªå®šä¹‰onChange方法
@@ -441,7 +241,7 @@
  //弹出框确定返回
  function custSuccess(d) {
    reload();
    // reload();
  }
  /**
src/views/tigerprojects/system/lowcode/normal/mainTable.vue
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,356 @@
<template>
  <div>
    <BasicTable @register="registerTable">
      <template #toolbar>
        <a-button
          type="primary"
          @click="handleCreate(item['DO_METHOD'])"
          :preIcon="item['ICON_URL']"
          v-for="item in buttons.filter((m) => m['BUTTON_TYPE'] == 0)"
          :key="item"
        >
          {{ item['FUNC_NAME'] }}
        </a-button>
      </template>
      <template #action="{ record }">
        <TableAction :actions="createActions(record)" />
      </template>
      <template #[item]="{ field }" v-for="item in colSlots" :key="item">
        <!-- <template #form-BAS_REASON3aadd="{ field }"> -->
        <a-button
          v-if="field"
          class="mt-1 ml-1"
          size="small"
          @click="handleSelectItem(item)"
          preIcon="search|svg"
        />
        <GeneralModal
          @register="registerItemAdd"
          @success="(d, u) => handleItemSuccess(d, u, item)"
        />
      </template>
    </BasicTable>
    <normalDrawer @register="registerDrawer" @success="handleSuccess" />
  </div>
</template>
<script lang="ts" setup>
  import { Ref, inject, nextTick, onMounted, ref, watch } from 'vue';
  import {
    BasicTable,
    useTable,
    TableAction,
    BasicColumn,
    FormSchema,
    ActionItem,
    PopConfirm,
  } from '/@/components/Table';
  import { BasicForm, useForm } from '/@/components/Form/index';
  import { useDrawer } from '/@/components/Drawer';
  import GeneralModal from '/@/views/components/GeneralModal.vue';
  import normalDrawer from '../normalDrawer.vue';
  import { isNullOrEmpty, isNullOrUnDef } from '/@/utils/is';
  import { useModal } from '/@/components/Modal';
  import { useGo } from '/@/hooks/web/usePage';
  import { DeleteEntity, getEntity, getListByPage } from '/@/api/tigerapi/system';
  import { useI18n } from '/@/hooks/web/useI18n';
  import { EntityCustFunctionType } from '/@/api/tigerapi/model/basModel';
  import { getRoleButtons } from '/@/api/sys/menu';
  import { useRouter } from 'vue-router';
  const { t } = useI18n();
  const { currentRoute } = useRouter();
  const props = defineProps({
    colSlots: { type: Array as PropType<any[]> },
    useTableData: { type: Object as PropType<{}>, default: { table: [] } },
    crudColSlots: { type: Object as PropType<any> },
  });
  const objParams = inject('objParams') as Ref<any>;
  const _columns = inject('_columns') as Ref<any[]>;
  const _searchFormSchema = inject('_searchFormSchema') as Ref<any[]>;
  const _crudFormSchema = inject('_crudFormSchema') as Ref<any[]>;
  const buttons = ref<[]>(await getRoleButtons(currentRoute.value.meta.menuCode as string));
  const isExistSql = inject('isExistSql') as Ref<string>;
  const others = inject('others') as Ref<Recordable[]>;
  const entityName = ref(objParams['ID']);
  const go = useGo();
  const [registerDrawer, { openDrawer }] = useDrawer();
  const [registerItemAdd, { openModal: openItemModal }] = useModal();
  const cType = ref('');
  const dtlSlots = ref([] as any[]);
  const formSchemas = ref({}); //弹出框多表单结构
  const useModalData = ref({}); //表单中插槽渲染按钮打开模态框useModal方法
  const useFormData = ref({});
  const custImport = ref<any[]>([]);
  const EntityCustFunction = ref([
    {
      ActionItem(params, data, ...args) {},
      EditeOperation(data, d, u) {},
      GetBaseColumns() {},
      GetSearchForm() {},
      GetCrudForm() {},
      OthersValues(val, id) {},
    } as EntityCustFunctionType,
  ]);
  /* åŠ¨æ€import实体名.ts的自定义方法 */
  try {
    custImport.value = await import(/* @vite-ignore */ `../entityts/${objParams['ID']}`);
  } catch (e) {}
  const [
    {
      ActionItem: nActionItem,
      EditeOperation,
      GetBaseColumns,
      GetSearchForm,
      GetCrudForm,
      OthersValues,
    },
  ] = isNullOrUnDef(custImport.value['default'])
    ? EntityCustFunction.value
    : custImport.value['default']();
  others.value = OthersValues(objParams['CODE'], objParams['ID']);
  const [registerTable, { getForm, reload, setProps }] = useTable({
    title: '列表信息',
    api: getListByPage,
    searchInfo: { TABLE_NAME: objParams['ID'] },
    columns: _columns as unknown as BasicColumn[],
    formConfig: {
      labelWidth: 140,
      schemas: _searchFormSchema as unknown as FormSchema[],
    },
    useSearchForm: true,
    showTableSetting: true,
    bordered: true,
    canResize: true,
    showIndexColumn: false,
    actionColumn: {
      width: 130,
      title: '操作',
      dataIndex: 'action',
      slots: { customRender: 'action' },
      fixed: undefined,
    }, //自定义操作列
  });
  onMounted(() => {});
  /**
   * @description: ç”Ÿæˆåˆ—表中操作项的按钮
   * @param {*} record
   * @return {*}
   */
  function createActions(record) {
    const params = {
      record,
      isUpdate: true,
      entityName: objParams['ID'],
      formJson: _crudFormSchema.value,
      cType,
      dtlSlots,
      formSchemas,
      useModalData,
      useFormData,
      crudColSlots: objParams['crudColSlots'],
    };
    const actionItem = GenerateActionButton(params);
    if (isNullOrUnDef(custImport.value['default'])) {
      return actionItem;
    }
    return nActionItem(
      params,
      actionItem,
      openDrawer,
      reload,
      null,
      useForm,
      useModal,
      go,
      setProps,
    );
  }
  /**
   * @description: èŽ·å–æƒé™æŒ‰é’®åˆ—è¡¨
   * @param {*} params
   * @return {*}
   */
  function GenerateActionButton(params: any) {
    let actionItem = [] as ActionItem[];
    buttons.value.map((x) => {
      if (x['BUTTON_TYPE'] == 1) {
        let url = '';
        let color = undefined as 'success' | 'error' | 'warning' | undefined;
        let _click = null as any;
        let _popConfirm = undefined as PopConfirm | undefined;
        if (x['DO_METHOD'] == 'Edit') {
          url = 'clarity:note-edit-line';
          _click = editRecord.bind(null, openDrawer, params);
        } else {
          _click = x['ICON_URL'];
          if (x['DO_METHOD'] == 'Delete') {
            url = 'ant-design:delete-outlined';
            color = 'error';
            _popConfirm = {
              title: '是否确认删除?',
              placement: 'left',
              confirm: deleteRecord.bind(null, reload, params),
            };
          }
        }
        actionItem.push({
          icon: isNullOrEmpty(x['ICON_URL']) ? url : x['ICON_URL'],
          onClick: _click,
          color: color,
          popConfirm: _popConfirm,
        });
      }
    });
    return actionItem;
  }
  /**
   * @description: å…¬ç”¨ç¼–辑方法
   * @param {Fn} fn
   * @param {*} params
   * @return {*}
   */
  function editRecord(fn: Fn, params: {}) {
    fn(true, params);
  }
  /**
   * @description: å…¬ç”¨åˆ é™¤æ–¹æ³•
   * @param {Fn} fn
   * @param {*} params
   * @return {*}
   */
  function deleteRecord(fn: Fn, params: {}) {
    console.log(params['record']);
    //删除
    DeleteEntity(params['record'], params['entityName']).then((action) => {
      if (action.IsSuccessed) {
        fn();
      }
    });
  }
  /**
   * @description: èŽ·å–æ–°å¢žæŒ‰é’®çš„è¡Œä¸º
   * @return {*}
   */
  function handleCreate(fnName: string) {
    if (isNullOrUnDef(custImport.value['default'])) {
      openDrawer(true, {
        isUpdate: false,
        entityName: entityName.value,
        formJson: _crudFormSchema.value,
        crudColSlots: objParams['crudColSlots'],
        isExistSql: isExistSql.value,
      });
    } else {
      const [{ CreateAction }] = custImport.value['default']();
      const result = CreateAction(fnName);
      switch (result.action) {
        case 'go':
          go(`/${result.url}/${encodeURI(JSON.stringify(result.params))}`);
          break;
        case 'drawer':
          openDrawer(true, {
            isUpdate: false,
            entityName: objParams.value.ID,
            formJson: _crudFormSchema.value,
            crudColSlots: objParams['crudColSlots'],
            isExistSql: isExistSql.value,
          });
          break;
      }
    }
  }
  /**
   * @description: æ–°å¢žç¼–辑返回成功方法
   * @param {*} d
   * @param {*} u
   * @return {*}
   */
  function handleSuccess(d, u) {
    reload();
  }
  /**
   * @description: å¼¹å‡ºé€‰æ‹©æ¡†é€‰æ‹©æˆåŠŸåŽäº‹ä»¶
   * @param {*} d
   * @param {*} u
   * @param {*} item
   * @return {*}
   */
  function handleItemSuccess(d, u, item) {
    /* åŠ¨æ€import实体名.ts的自定义方法 */
    try {
      import(
        /* @vite-ignore */ `../entityts/${getForm().getFieldsValue()[`${item.replace(/form-/, '').replace(/add/, '')}PSelect_0`]}`
      )
        .then((m) => {
          const [{ GetSelectSuccess }] = m.default();
          getForm().setFieldsValue(GetSelectSuccess(d, u));
        })
        .catch(() => {
          getForm().setFieldsValue({
            ITEM_CODE: d.values['val'],
          });
        });
    } catch (e) {}
  }
  /**
   * @description: å¼¹å‡ºé€‰æ‹©æ¡†
   * @param {*} item
   * @return {*}
   */
  function handleSelectItem(item) {
    /* åŠ¨æ€import实体名.ts的自定义方法 */
    try {
      import(
        /* @vite-ignore */ `../entityts/${getForm().getFieldsValue()[`${item.replace(/form-/, '').replace(/add/, '')}PSelect_0`]}`
      )
        .then((m) => {
          const [{ OpenSelectItem }] = m.default();
          OpenSelectItem(openItemModal);
        })
        .catch(() => {
          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' },
          });
        });
    } catch (e) {}
  }
</script>
src/views/tigerprojects/system/menu/menu.data.ts
@@ -60,6 +60,11 @@
    dataIndex: 'btnType',
    ifShow: false,
  },
  {
    title: '执行方法',
    dataIndex: 'doMethod',
    ifShow: false,
  },
];
const isDir = (type: string) => type === '0';
@@ -134,7 +139,7 @@
    label: '图标',
    component: 'IconPicker',
    required: ({ values }) => isDir(values.func_type),
    ifShow: ({ values }) => !isButton(values.func_type),
    ifShow: ({ values }) => true, //!isButton(values.func_type),
  },
  {
@@ -166,6 +171,12 @@
    ifShow: ({ values }) => isButton(values.func_type),
  },
  {
    field: 'doMethod',
    label: '执行方法名',
    component: 'Input',
    ifShow: ({ values }) => isButton(values.func_type),
  },
  {
    field: 'func_code',
    label: '权限标识',
    component: 'Input',