Ben Lin
2025-02-25 fee83fc57f553595cc3a4891b8a692fa66cd77fe
src/views/tigerprojects/system/lowcode/normal/mainTable.vue
@@ -10,6 +10,20 @@
    <div v-show="false">
      <printTemplate />
    </div>
    <CollapseContainer title="操作信息" class="m-2" v-if="!isSearch[String(currentTab.name)]">
      <BasicForm @register="registerbaseForm">
        <template #[l]="{ field }" v-for="l in colSlots" :key="l">
          <a-button
            v-if="field"
            class="mt-1 ml-1"
            size="small"
            @click="handleSelectItem(l)"
            preIcon="search|svg"
          />
          <!-- <GeneralModal @register="baseFormModalRegister" @success="(d, u) => baseFormSuccess(d, u, l)" /> -->
        </template>
      </BasicForm>
    </CollapseContainer>
    <BasicTable @register="registerTable">
      <template #toolbar>
        <!-- 根据菜单设置的按钮,自动生成 -->
@@ -23,11 +37,12 @@
          {{ item['FUNC_NAME'] }}
        </a-button>
      </template>
      <!--这里的action是ant的Table里固定的插槽action,取表格数据data中的行记录record-->
      <template #action="{ record }">
        <TableAction :actions="createActions(record)" />
      </template>
      <template #[item]="{ field }" v-for="item in colSlots" :key="item">
        <!-- <template #form-BAS_REASON3aadd="{ field }"> -->
        <!-- <template #form-BAS_REASON3aadd="{ field }"> --><!--在查询form中框架会自动查找插槽名加上form-,然后传入列json数据,这里取field的值-->
        <a-button
          v-if="field"
          class="mt-1 ml-1"
@@ -96,6 +111,7 @@
  import CustModal from '/@/views/components/CustModal.vue';
  import RouteViewModal from '/@/views/components/RouteViewModal.vue';
  import ImportExcelModal from '/@/views/components/ImportExcelModal.vue';
  import { CollapseContainer } from '@/components/Container';
  import { FlowChartView } from '/@/components/FlowChart';
  import { isNullOrEmpty, isNullOrUnDef } from '/@/utils/is';
  import { useModal } from '/@/components/Modal';
@@ -105,7 +121,7 @@
  import { EntityCustFunctionType } from '/@/api/tigerapi/model/basModel';
  import { getRoleButtons } from '/@/api/sys/menu';
  import { useUserStore } from '/@/store/modules/user';
  import { useRouter } from 'vue-router';
  import { useRoute, useRouter } from 'vue-router';
  import { afterFetchFn, GenerateActionButton, initRoute, SearchInfoFn } from '../data';
  import LogicFlow from '@logicflow/core';
  import { isFunction } from 'xe-utils';
@@ -116,6 +132,8 @@
  import { Loading, useLoading } from '@/components/Loading';
  import { useWoFlowcardStore } from '/@/store/modules/woflowcardprint';
  import { storeToRefs } from 'pinia';
  import { useLowCodeStore } from '/@/store/modules/lowcode';
  import { useMultipleTabStore } from '/@/store/modules/multipleTab';
  const { t } = useI18n();
  const { currentRoute } = useRouter();
@@ -135,7 +153,7 @@
  const isExistSql = inject('isExistSql') as Ref<string>;
  const keyFieldValues = inject('keyFieldValues') as Ref<Recordable[]>;
  const AuthOption = inject('AuthOption') as Ref<{}>;
  const entityName = ref(objParams.value['ID']);
  const entityName = ref(objParams.value['EntityName']);
  const go = useGo();
  const [registerDrawer, { openDrawer }] = useDrawer();
  const [registerRv, { openModal: openRvModal, closeModal: RvcloseModal }] = useModal();
@@ -144,6 +162,14 @@
  const [registerImport, { openModal: openImportModal }] = useModal();
  const useWoFlowCard = useWoFlowcardStore();
  const { curPrintInfo } = storeToRefs(useWoFlowCard);
  const useLowcode = useLowCodeStore();
  const { isSearch } = storeToRefs(useLowcode);
  const tabStore = useMultipleTabStore();
  function getCurrentTab() {
    const route = unref(currentRoute);
    return tabStore.getTabList.find((item) => item.fullPath === route.fullPath)!;
  }
  const currentTab = getCurrentTab();
  const cType = ref('');
  const formSchemas = ref({}); //弹出框多表单结构
  const routeData = ref({
@@ -151,8 +177,6 @@
    edges: [],
  });
  const selectVals = ref({});
  const printData = ref<any[]>([]);
  const wokerorder = ref('');
  const compState = reactive<{
    absolute?: boolean;
    loading?: boolean;
@@ -170,123 +194,6 @@
    tip: '正在加载打印数据...',
  });
  printData.value = [
    {
      id: '111',
      Items: [
        {
          ID: 111,
          SALES_ORDER: 'YDSO240400482',
          ORDER_NO: 'YDRKD241000012',
          WORK_ORDER: 'YDMOB241104737',
          ITEM_CODE: '20100705.0102.00',
          ITEM_NAME: 'YM-DEMS-BD11Q48 AC0-300V AC20mA 电能1级 ',
          PLAN_QTY: 100,
          SCAN_QTY: 50,
          STATUS: 'Y',
        },
        {
          ID: 112,
          SALES_ORDER: 'YDSO240400483',
          ORDER_NO: 'YDRKD241000013',
          WORK_ORDER: 'YDMOB241104737',
          ITEM_CODE: '20100705.0102.00',
          ITEM_NAME: 'YM-DEMS-BD11Q48 AC0-300V AC20mA 电能1级 ',
          PLAN_QTY: 100,
          SCAN_QTY: 50,
          STATUS: 'Y',
        },
        {
          ID: 113,
          SALES_ORDER: 'YDSO240400484',
          ORDER_NO: 'YDRKD241000014',
          WORK_ORDER: 'YDMOB241104737',
          ITEM_CODE: '20100705.0102.00',
          ITEM_NAME: 'YM-DEMS-BD11Q48 AC0-300V AC20mA 电能1级 ',
          PLAN_QTY: 100,
          SCAN_QTY: 50,
          STATUS: 'Y',
        },
        {
          ID: 114,
          ORDER_NO: 'YDRKD241000015',
          SALES_ORDER: 'YDSO240400485',
          WORK_ORDER: 'YDMOB241104737',
          ITEM_CODE: '20100705.0102.00',
          ITEM_NAME: 'YM-DEMS-BD11Q48 AC0-300V AC20mA 电能1级 ',
          PLAN_QTY: 100,
          SCAN_QTY: 50,
          STATUS: 'Y',
        },
        {
          ID: 115,
          ORDER_NO: 'YDRKD241000016',
          SALES_ORDER: 'YDSO240400486',
          WORK_ORDER: 'YDMOB241104737',
          ITEM_CODE: '20100705.0102.00',
          ITEM_NAME: 'YM-DEMS-BD11Q48 AC0-300V AC20mA 电能1级 ',
          PLAN_QTY: 100,
          SCAN_QTY: 50,
          STATUS: 'Y',
        },
        {
          ID: 116,
          ORDER_NO: 'YDRKD241000017',
          SALES_ORDER: 'YDSO240400487',
          WORK_ORDER: 'YDMOB241104737',
          ITEM_CODE: '20100705.0102.00',
          ITEM_NAME: 'YM-DEMS-BD11Q48 AC0-300V AC20mA 电能1级 ',
          PLAN_QTY: 100,
          SCAN_QTY: 50,
          STATUS: 'Y',
        },
        // {
        //   ID: 116,
        //   ORDER_NO: 'YDRKD241000018',
        //   SALES_ORDER: 'YDSO240400488',
        //   WORK_ORDER: 'YDMOB241104737',
        //   ITEM_CODE: '20100705.0102.00',
        //   ITEM_NAME: 'YM-DEMS-BD11Q48 AC0-300V AC20mA 电能1级 ',
        //   PLAN_QTY: 100,
        //   SCAN_QTY: 50,
        //   STATUS: 'Y',
        // },
        // {
        //   ID: 116,
        //   ORDER_NO: 'YDRKD241000019',
        //   SALES_ORDER: 'YDSO240400489',
        //   WORK_ORDER: 'YDMOB241104737',
        //   ITEM_CODE: '20100705.0102.00',
        //   ITEM_NAME: 'YM-DEMS-BD11Q48 AC0-300V AC20mA 电能1级 ',
        //   PLAN_QTY: 100,
        //   SCAN_QTY: 50,
        //   STATUS: 'Y',
        // },
        // {
        //   ID: 116,
        //   ORDER_NO: 'YDRKD241000020',
        //   SALES_ORDER: 'YDSO240400490',
        //   WORK_ORDER: 'YDMOB241104737',
        //   ITEM_CODE: '20100705.0102.00',
        //   ITEM_NAME: 'YM-DEMS-BD11Q48 AC0-300V AC20mA 电能1级 ',
        //   PLAN_QTY: 100,
        //   SCAN_QTY: 50,
        //   STATUS: 'Y',
        // },
        // {
        //   ID: 116,
        //   ORDER_NO: 'YDRKD241000021',
        //   SALES_ORDER: 'YDSO240400491',
        //   WORK_ORDER: 'YDMOB241104737',
        //   ITEM_CODE: '20100705.0102.00',
        //   ITEM_NAME: 'YM-DEMS-BD11Q48 AC0-300V AC20mA 电能1级 ',
        //   PLAN_QTY: 100,
        //   SCAN_QTY: 50,
        //   STATUS: 'Y',
        // },
      ],
    },
  ];
  const custImport = ref<any[]>([]);
  const EntityCustFunction = ref([
    {
@@ -298,9 +205,10 @@
      CustFunc(param: CustModalParams) {},
    } as EntityCustFunctionType,
  ]);
  /* 动态import实体名.ts的自定义方法 */
  try {
    custImport.value = await import(`../entityts/${objParams.value['ID']}.ts`);
    custImport.value = await import(`../entityts/${objParams.value['EntityName']}.ts`);
  } catch (e) {
    console.log(e);
  }
@@ -323,11 +231,12 @@
  keyFieldValues.value = isNullOrUnDef(KeyFieldValues)
    ? {}
    : KeyFieldValues(objParams.value['CODE'], objParams.value['ID']);
    : KeyFieldValues(objParams.value['CODE'], objParams.value['EntityName']);
  const dtlSlots = ref<any[]>([]);
  const ImportTitle = GetTitle && isFunction(GetTitle) ? ref(GetTitle().importTitle) : ref('');
  const useformdata = GetUseForm && isFunction(GetUseForm) ? GetUseForm() : {};
  const useFormData = ref<any>(useformdata);
  /* 自定义模态窗口中表单中插槽渲染按钮打开模态框useModal方法 */
  const modals = GetUseModals && isFunction(GetUseModals) ? GetUseModals() : { useModalData: {} };
  const useModalData = ref(modals['useModalData']);
@@ -339,11 +248,22 @@
  /* 获取自定义数据 */
  const custData = GetCustData && isFunction(GetCustData) ? GetCustData() : { isCustEl: {} };
  const isCustEl = ref(custData['isCustEl']);
  const [registerbaseForm, { resetFields, setFieldsValue, getFieldsValue, validate }] = useForm({
    labelWidth: 140,
    schemas: _searchFormSchema as unknown as FormSchema[],
    actionColOptions: {
      span: 24,
    },
    showActionButtonGroup: false,
  });
  /* 主表格初始化 */
  const [registerTable, { getForm, reload, setProps }] = useTable({
    title: '列表信息',
    api: getListByPage,
    searchInfo: {
      TABLE_NAME: objParams.value['ID'],
      TABLE_NAME: objParams.value['EntityName'],
      option:
        AuthOption.value['BY_ORG'] == 'Y'
          ? {
@@ -353,6 +273,7 @@
              CurOrg: useUserStore().getUserInfo.orgCode,
            }
          : '',
      NeedInclude: true,
    },
    beforeFetch: (t) => SearchInfoFn(t, route.name, AuthOption.value['BY_ORG'] == 'Y'),
    afterFetch: afterFetch,
@@ -363,7 +284,7 @@
      submitFunc: () => Search(), //自定义查询提交按钮的方法,触发查询提交事件
      resetFunc: () => useQuery.resetFunc(route.name, getForm(), AuthOption.value['BY_ORG'] == 'Y'),
    },
    useSearchForm: true,
    useSearchForm: isSearch.value[String(currentTab.name)],
    showTableSetting: true,
    bordered: true,
    canResize: true,
@@ -387,7 +308,7 @@
          getForm().setFieldsValue(savedParams.value['params']);
          setProps({
            searchInfo: {
              TABLE_NAME: objParams.value['ID'],
              TABLE_NAME: objParams.value['EntityName'],
              option:
                AuthOption.value['BY_ORG'] == 'Y'
                  ? {
@@ -459,7 +380,7 @@
    const params = {
      record,
      isUpdate: true,
      entityName: objParams.value['ID'],
      entityName: objParams.value['EntityName'],
      formJson: _crudFormSchema.value,
      cType,
      dtlSlots,
@@ -599,7 +520,7 @@
      )
        .then((m) => {
          const [{ GetSelectSuccess: GetSelectSuccess2 }] = m.default();
          getForm().setFieldsValue(GetSelectSuccess2(d, u, objParams.value['ID']));
          getForm().setFieldsValue(GetSelectSuccess2(d, u, objParams.value['EntityName']));
        })
        .catch(() => {
          getForm().setFieldsValue({