Ben Lin
2024-10-07 b6163e1bed94b4d02d1b6f01fdc2eb3f15ca22e3
src/views/tigerprojects/system/lowcode/normal/mainTable.vue
@@ -2,6 +2,7 @@
  <div>
    <BasicTable @register="registerTable">
      <template #toolbar>
        <!-- 根据菜单设置的按钮,自动生成 -->
        <a-button
          type="primary"
          v-for="item in buttons.filter((m) => m['BUTTON_TYPE'] == 0)"
@@ -111,6 +112,7 @@
  const [registerDrawer, { openDrawer }] = useDrawer();
  const [registerRv, { openModal: openRvModal, closeModal: RvcloseModal }] = useModal();
  const [registerCust, { openModal: openCustModal }] = useModal();
  const [registerCrud, { openModal: openCrudModal }] = useModal();
  const cType = ref('');
  const formSchemas = ref({}); //弹出框多表单结构
  const routeData = ref({
@@ -237,7 +239,7 @@
   * @return {*}
   */
  async function init(lf, rotId) {
    initRoute(lf, rotId, routeData, currlf);
    initRoute(lf, rotId, routeData, currlf, null);
  }
  /**
@@ -261,12 +263,15 @@
      currlf,
      selectVals,
      colSlots,
      ifSave: true,
    };
    /* 根据菜单设置的按钮自动生成操作列中的按钮 */
    const actionItem = GenerateActionButton(params, buttons, openDrawer, reload);
    if (isNullOrUnDef(custImport.value['default'])) {
      return actionItem;
    }
    /* 根据动态加载的实体类名.ts中的ActionItem方法,渲染操作列中的按钮方法 */
    return nActionItem(
      params,
      actionItem,
@@ -278,6 +283,7 @@
      go,
      setProps,
      openCustModal,
      openCrudModal,
    );
  }
@@ -300,18 +306,21 @@
   */
  function handleCreate(fnName: string) {
    if (isNullOrUnDef(custImport.value['default'])) {
      /* 如果动态加载的实体类.ts不存在,则直接打开侧边框 */
      openDrawer(true, {
        isUpdate: false,
        entityName: entityName.value,
        formJson: _crudFormSchema.value,
        crudColSlots: objParams.value['crudColSlots'],
        isExistSql: isExistSql.value,
        isUpdate: false, //是新增还是编辑,false-新增|true-编辑
        entityName: entityName.value, //实体类名
        formJson: _crudFormSchema.value, //新增编辑的表单结构
        crudColSlots: objParams.value['crudColSlots'], //新增编辑的表单中的插槽列表
        isExistSql: isExistSql.value, //是否存在检查sql,比如: XXX_CODE = '12345'
        ifSave: true, //是否提交表单时保存到数据库,否-暂存|是-保存
      });
    } else {
      /* 如果动态加载的实体类.ts存在,根据.ts文件中的方法来执行操作 */
      const [{ CreateAction }] = custImport.value['default']();
      const result = CreateAction(entityName.value, colSlots.value);
      switch (result.action) {
        case 'go':
        case 'go' /* 跳转页面 */:
          // 将对象转换为JSON字符串并保存到sessionStorage
          sessionStorage.setItem(
            `${result.params.Name}_params`,
@@ -321,13 +330,14 @@
            `/${result.url}/${encodeURI(JSON.stringify({ sName: result.params.Name, Name: result.params.Name }))}`,
          );
          break;
        case 'drawer':
        case 'drawer' /* 打开侧边框 */:
          openDrawer(true, {
            isUpdate: false,
            entityName: entityName.value,
            formJson: _crudFormSchema.value,
            crudColSlots: objParams.value['crudColSlots'],
            isExistSql: isExistSql.value,
            isUpdate: false, //是新增还是编辑,false-新增|true-编辑
            entityName: entityName.value, //实体类名
            formJson: _crudFormSchema.value, //新增编辑的表单结构
            crudColSlots: objParams.value['crudColSlots'], //新增编辑的表单中的插槽列表
            isExistSql: isExistSql.value, //是否存在检查sql,比如: XXX_CODE = '12345'
            ifSave: true, //是否提交表单时保存到数据库,否-暂存|是-保存
          });
          break;
      }