From 8a12783afd1d6c4881d90e66bb0a52010a1598ae Mon Sep 17 00:00:00 2001
From: Ben Lin <maobin001@msn.com>
Date: 星期四, 27 二月 2025 00:52:57 +0800
Subject: [PATCH] 一些更改

---
 src/views/tigerprojects/system/lowcode/normal/mainTable.vue |  644 +++++++++++++++++++++++++++++++++++++++++++++++----------
 1 files changed, 524 insertions(+), 120 deletions(-)

diff --git a/src/views/tigerprojects/system/lowcode/normal/mainTable.vue b/src/views/tigerprojects/system/lowcode/normal/mainTable.vue
index 988a7d1..e58b968 100644
--- a/src/views/tigerprojects/system/lowcode/normal/mainTable.vue
+++ b/src/views/tigerprojects/system/lowcode/normal/mainTable.vue
@@ -1,22 +1,48 @@
 <template>
   <div>
+    <Loading
+      :loading="compState.loading"
+      :absolute="compState.absolute"
+      :theme="compState.theme"
+      :background="compState.background"
+      :tip="compState.tip"
+    />
+    <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>
+        <!-- 鏍规嵁鑿滃崟璁剧疆鐨勬寜閽紝鑷姩鐢熸垚 -->
         <a-button
           type="primary"
+          v-for="item in buttons.filter((m) => m['BUTTON_TYPE'] == 0)"
           @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>
+      <!--杩欓噷鐨刟ction鏄痑nt鐨凾able閲屽浐瀹氱殑鎻掓Ыaction锛屽彇琛ㄦ牸鏁版嵁data涓殑琛岃褰時ecord-->
       <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 }"> --><!--鍦ㄦ煡璇orm涓鏋朵細鑷姩鏌ユ壘鎻掓Ы鍚嶅姞涓奻orm-锛岀劧鍚庝紶鍏ュ垪json鏁版嵁锛岃繖閲屽彇field鐨勫��-->
         <a-button
           v-if="field"
           class="mt-1 ml-1"
@@ -25,16 +51,51 @@
           preIcon="search|svg"
         />
         <GeneralModal
-          @register="registerItemAdd"
+          @register="useModalInTableForm[item]"
           @success="(d, u) => handleItemSuccess(d, u, item)"
         />
       </template>
     </BasicTable>
+    <Suspense>
+      <CustModal
+        @register="registerCust"
+        @success="custSuccess"
+        @cancel="custCancel"
+        :type="cType"
+        :entityName="entityName"
+        @modal-inner="getdtlSlots"
+      >
+        <!-- 鐢ㄦ彃妲借嚜瀹氫箟澶氳〃鍗� -->
+        <template #[item.name] v-for="item in dtlSlots" :key="item.name">
+          <BasicForm @register="useFormData[item.name][0]" v-if="useFormData[item.name]">
+            <!-- 鐢ㄦ彃妲借嚜瀹氫箟寮瑰嚭閫夋嫨妗� -->
+            <template #[name]="{ field }" v-for="name in item.slots" :key="name">
+              <a-button
+                class="mt-1 ml-1"
+                size="small"
+                @click="handleCustClick(field)"
+                :preIcon="item.preIcons[name]"
+              />
+              <GeneralModal
+                @register="useModalData[name][0]"
+                @success="(d, u) => handleEntSuccess(d, u, item.name)"
+              />
+            </template>
+          </BasicForm>
+          <!-- 鑷畾涔夊唴瀹� -->
+          <div class="h-full" style="height: 380px" v-if="isCustEl[item.name]">
+            <FlowChartView :data="routeData" @init="init" />
+            <RouteViewModal @register="registerRv" @success="RvItemSuccess" />
+          </div>
+        </template>
+      </CustModal>
+    </Suspense>
     <normalDrawer @register="registerDrawer" @success="handleSuccess" />
+    <ImportExcelModal @register="registerImport" :title="ImportTitle" />
   </div>
 </template>
 <script lang="ts" setup>
-  import { Ref, inject, nextTick, onMounted, ref, watch } from 'vue';
+  import { Ref, inject, nextTick, onMounted, reactive, ref, unref, watch } from 'vue';
   import {
     BasicTable,
     useTable,
@@ -42,98 +103,273 @@
     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 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';
   import { useGo } from '/@/hooks/web/usePage';
-  import { DeleteEntity, getEntity, getListByPage } from '/@/api/tigerapi/system';
+  import { 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';
+  import { useUserStore } from '/@/store/modules/user';
+  import { useRoute, useRouter } from 'vue-router';
+  import { afterFetchFn, GenerateActionButton, initRoute, SearchInfoFn } from '../data';
+  import LogicFlow from '@logicflow/core';
+  import { isFunction } from 'xe-utils';
+  import { CustModalParams } from '/@/api/tigerapi/model/systemModel';
+  import { useQueryStore } from '/@/store/modules/queryInpage';
+  import printJS, { Configuration } from 'print-js';
+  import printTemplate from '/@/views/components/printTemplate.vue';
+  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();
+  const route = unref(currentRoute);
+  const useQuery = useQueryStore();
   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 savedParams = inject('savedParams') as Ref<any>;
+  const colSlots = ref(objParams.value['colSlots']);
   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 keyFieldValues = inject('keyFieldValues') as Ref<Recordable[]>;
+  const AuthOption = inject('AuthOption') as Ref<{}>;
+  const entityName = ref(objParams.value['EntityName']);
   const go = useGo();
   const [registerDrawer, { openDrawer }] = useDrawer();
-  const [registerItemAdd, { openModal: openItemModal }] = useModal();
+  const [registerRv, { openModal: openRvModal, closeModal: RvcloseModal }] = useModal();
+  const [registerCust, { openModal: openCustModal }] = useModal();
+  const [registerCrud, { openModal: openCrudModal }] = useModal();
+  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 dtlSlots = ref([] as any[]);
   const formSchemas = ref({}); //寮瑰嚭妗嗗琛ㄥ崟缁撴瀯
-  const useModalData = ref({}); //琛ㄥ崟涓彃妲芥覆鏌撴寜閽墦寮�妯℃�佹useModal鏂规硶
-  const useFormData = ref({});
+  const routeData = ref({
+    nodes: [],
+    edges: [],
+  });
+  const selectVals = ref({});
+  const compState = reactive<{
+    absolute?: boolean;
+    loading?: boolean;
+    theme?: 'dark' | 'light';
+    background?: string;
+    tip?: string;
+  }>({
+    absolute: false,
+    loading: false,
+    theme: 'dark',
+    background: 'rgba(111,111,111,.7)',
+    tip: '鍔犺浇涓�...',
+  });
+  const [openFullLoading, closeFullLoading] = useLoading({
+    tip: '姝e湪鍔犺浇鎵撳嵃鏁版嵁...',
+  });
+
   const custImport = ref<any[]>([]);
   const EntityCustFunction = ref([
     {
       ActionItem(params, data, ...args) {},
-      EditOperation(data, d, u) {},
-      GetBaseColumns() {},
-      GetSearchForm() {},
-      GetCrudForm() {},
-      OthersValues(val, id) {},
+      KeyFieldValues(val, id) {},
+      OpenSelectItem(openItemModal: Fn, ...args) {},
+      GetSelectSuccess(d, u, ...args) {},
+      GetUseForm(...args) {},
+      CustFunc(param: CustModalParams) {},
     } as EntityCustFunctionType,
   ]);
+
   /* 鍔ㄦ�乮mport瀹炰綋鍚�.ts鐨勮嚜瀹氫箟鏂规硶 */
   try {
-    custImport.value = await import(`../entityts/${objParams['ID']}.ts`);
-  } catch (e) {}
+    custImport.value = await import(`../entityts/${objParams.value['EntityName']}.ts`);
+  } catch (e) {
+    console.log(e);
+  }
   const [
     {
       ActionItem: nActionItem,
-      EditOperation,
-      GetBaseColumns,
-      GetSearchForm,
-      GetCrudForm,
-      OthersValues,
+      KeyFieldValues,
+      GetUseForm,
+      GetUseModals,
+      GetCustData,
+      OpenSelectItem: OpenSelectCust,
+      GetSelectSuccess,
+      CustFunc,
+      GetTitle,
     },
+    ActionColumn,
   ] = isNullOrUnDef(custImport.value['default'])
     ? EntityCustFunction.value
     : custImport.value['default']();
-  others.value = isNullOrUnDef(OthersValues)
+
+  keyFieldValues.value = isNullOrUnDef(KeyFieldValues)
     ? {}
-    : OthersValues(objParams['CODE'], objParams['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);
+
+  /* 鑷畾涔夋ā鎬佺獥鍙d腑琛ㄥ崟涓彃妲芥覆鏌撴寜閽墦寮�妯℃�佹useModal鏂规硶 */
+  const modals = GetUseModals && isFunction(GetUseModals) ? GetUseModals() : { useModalData: {} };
+  const useModalData = ref(modals['useModalData']);
+  /* 琛ㄦ牸鍐呯殑鎻掓Ы娓叉煋鐨勫脊鍑洪�夋嫨妗嗗垪琛� */
+  const useModalInTableForm = ref<any>({});
+  colSlots.value.map((x) => {
+    useModalInTableForm.value[x] = useModal();
+  });
+  /* 鑾峰彇鑷畾涔夋暟鎹� */
+  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['ID'] },
+    searchInfo: {
+      TABLE_NAME: objParams.value['EntityName'],
+      option:
+        AuthOption.value['BY_ORG'] == 'Y'
+          ? {
+              //鏍规嵁鎹偣鏌ヨ锛屽繀闇�甯﹁繖涓弬鏁�
+              UserId: useUserStore().getUserInfo.userId,
+              ByOrg: true,
+              CurOrg: useUserStore().getUserInfo.orgCode,
+            }
+          : '',
+      NeedInclude: true,
+    },
+    beforeFetch: (t) => SearchInfoFn(t, route.name, AuthOption.value['BY_ORG'] == 'Y'),
+    afterFetch: afterFetch,
     columns: _columns as unknown as BasicColumn[],
     formConfig: {
       labelWidth: 140,
       schemas: _searchFormSchema as unknown as FormSchema[],
+      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,
     showIndexColumn: false,
-    actionColumn: {
-      width: 130,
-      title: '鎿嶄綔',
-      dataIndex: 'action',
-      slots: { customRender: 'action' },
-      fixed: undefined,
-    }, //鑷畾涔夋搷浣滃垪
+    actionColumn: ActionColumn
+      ? ActionColumn
+      : {
+          width: 120,
+          title: '鎿嶄綔',
+          dataIndex: 'action',
+          slots: { customRender: 'action' },
+          fixed: 'right',
+        }, //鑷畾涔夋搷浣滃垪
   });
 
-  onMounted(() => {});
+  watch(
+    () => AuthOption.value,
+    (newVal, oldVal) => {
+      nextTick(() => {
+        if (!isNullOrEmpty(newVal.BY_ORG) && !isNullOrUnDef(savedParams.value['params'])) {
+          getForm().setFieldsValue(savedParams.value['params']);
+          setProps({
+            searchInfo: {
+              TABLE_NAME: objParams.value['EntityName'],
+              option:
+                AuthOption.value['BY_ORG'] == 'Y'
+                  ? {
+                      //鏍规嵁鎹偣鏌ヨ锛屽繀闇�甯﹁繖涓弬鏁�
+                      UserId: useUserStore().getUserInfo.userId,
+                      ByOrg: true,
+                      CurOrg: useUserStore().getUserInfo.orgCode,
+                    }
+                  : '',
+            },
+          });
+          reload();
+        }
+      });
+    },
+    { deep: true, immediate: true },
+  );
+
+  onMounted(async () => {
+    if (!isNullOrUnDef(savedParams) && !isNullOrUnDef(savedParams.value['params'])) {
+      getForm().setFieldsValue(savedParams.value['params']);
+      reload();
+    }
+    // if (
+    //   !isNullOrUnDef(useQuery.getCurSearchInfo['searchInfo']) &&
+    //   useQuery.getCurSearchInfo['name'] == route.name
+    // ) {
+    //   getForm().resetFields();
+    //   const searchInfo = useQuery.getCurSearchInfo['searchInfo'];
+    //   await getForm().setFieldsValue(searchInfo);
+    // }
+  });
+
+  /**
+   * @description: 鏌ヨ鎻愪氦
+   * @return {*}
+   */
+  async function Search() {
+    useQuery.submitFunc(route.name, getForm(), AuthOption.value['BY_ORG'] == 'Y').then(() => {
+      reload();
+    });
+  }
+
+  /**
+   * @description: 璇锋眰涔嬪悗瀵硅繑鍥炲�艰繘琛屽鐞�
+   * @param {*} t
+   * @return {*}
+   */
+  function afterFetch(t) {
+    afterFetchFn(t, route.name, getForm());
+  }
+
+  const currlf = ref(null) as Ref<LogicFlow | null>;
+  /**
+   * @description: 宸ヨ壓璺嚎鍒濆鍖�
+   * @param {*} lf
+   * @return {*}
+   */
+  async function init(lf, rotId) {
+    initRoute(lf, rotId, routeData, currlf, null);
+  }
 
   /**
    * @description: 鐢熸垚鍒楄〃涓搷浣滈」鐨勬寜閽�
@@ -144,20 +380,38 @@
     const params = {
       record,
       isUpdate: true,
-      entityName: objParams['ID'],
+      entityName: objParams.value['EntityName'],
       formJson: _crudFormSchema.value,
       cType,
       dtlSlots,
       formSchemas,
       useModalData,
       useFormData,
-      crudColSlots: objParams['crudColSlots'],
+      crudColSlots: objParams.value['crudColSlots'],
+      routeData,
+      currlf,
+      selectVals,
+      colSlots,
+      ifSave: true,
+      sName: objParams.value['sName'],
     };
 
-    const actionItem = GenerateActionButton(params);
+    /* 鏍规嵁鑿滃崟璁剧疆鐨勬寜閽嚜鍔ㄧ敓鎴愭搷浣滃垪涓殑鎸夐挳 */
+    const _actionItem: ActionItem[] = [];
+    const actionItem = GenerateActionButton(params, buttons, openDrawer, reload, _actionItem);
+    let _btn = buttons.value.filter((q) => q['BUTTON_TYPE'] == 1 && q['DO_METHOD'] == 'ToPrint');
+    if (_btn.length > 0) {
+      _actionItem.push({
+        icon: isNullOrEmpty(_btn[0]['ICON_URL']) ? '' : _btn[0]['ICON_URL'],
+        tooltip: '鎵撳嵃',
+        onClick: ToPrint.bind(null, params),
+        name: _btn[0]['DO_METHOD'],
+      });
+    }
     if (isNullOrUnDef(custImport.value['default'])) {
       return actionItem;
     }
+    /* 鏍规嵁鍔ㄦ�佸姞杞界殑瀹炰綋绫诲悕.ts涓殑ActionItem鏂规硶锛屾覆鏌撴搷浣滃垪涓殑鎸夐挳鏂规硶 */
     return nActionItem(
       params,
       actionItem,
@@ -168,102 +422,69 @@
       useModal,
       go,
       setProps,
+      openCustModal,
+      openCrudModal,
     );
   }
 
   /**
-   * @description: 鑾峰彇鏉冮檺鎸夐挳鍒楄〃
-   * @param {*} params
+   * @description: 鑾峰彇澶氳〃鍗曟彃妲藉垪琛�
+   * @param {*} d
    * @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;
+  function getdtlSlots(d, callback) {
+    dtlSlots.value = d;
+    callback();
+    // setTimeout(() => {
+    //   callback();
+    // }, 100);
   }
 
   /**
-   * @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: 鑾峰彇鏂板鎸夐挳鐨勮涓�
+   * @description: 鑾峰彇宸ュ叿鏍忎腑鎸夐挳鐨勮涓�
    * @return {*}
    */
   function handleCreate(fnName: string) {
     if (isNullOrUnDef(custImport.value['default'])) {
+      /* 濡傛灉鍔ㄦ�佸姞杞界殑瀹炰綋绫�.ts涓嶅瓨鍦紝鍒欑洿鎺ユ墦寮�渚ц竟妗� */
       openDrawer(true, {
-        isUpdate: false,
-        entityName: entityName.value,
-        formJson: _crudFormSchema.value,
-        crudColSlots: objParams['crudColSlots'],
-        isExistSql: isExistSql.value,
+        isUpdate: false, //鏄柊澧炶繕鏄紪杈戯紝false-鏂板|true-缂栬緫
+        entityName: entityName.value, //瀹炰綋绫诲悕
+        formJson: _crudFormSchema.value, //鏂板缂栬緫鐨勮〃鍗曠粨鏋�
+        crudColSlots: objParams.value['crudColSlots'], //鏂板缂栬緫鐨勮〃鍗曚腑鐨勬彃妲藉垪琛�
+        isExistSql: isExistSql.value, //鏄惁瀛樺湪妫�鏌ql锛屾瘮濡�: XXX_CODE = '12345'
+        ifSave: true, //鏄惁鎻愪氦琛ㄥ崟鏃朵繚瀛樺埌鏁版嵁搴擄紝鍚�-鏆傚瓨|鏄�-淇濆瓨
       });
     } else {
+      /* 濡傛灉鍔ㄦ�佸姞杞界殑瀹炰綋绫�.ts瀛樺湪锛屾牴鎹�.ts鏂囦欢涓殑鏂规硶鏉ユ墽琛屾搷浣� */
       const [{ CreateAction }] = custImport.value['default']();
-      const result = CreateAction(fnName);
+      const result = CreateAction(entityName.value, fnName);
       switch (result.action) {
-        case 'go':
-          go(`/${result.url}/${encodeURI(JSON.stringify(result.params))}`);
+        case 'go' /* 璺宠浆椤甸潰 */:
+          // 灏嗗璞¤浆鎹负JSON瀛楃涓插苟淇濆瓨鍒皊essionStorage
+          sessionStorage.setItem(
+            `${result.params.Name}_params`,
+            encodeURI(JSON.stringify(result.params)),
+          );
+          go(
+            `/${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['crudColSlots'],
-            isExistSql: isExistSql.value,
+            isUpdate: false, //鏄柊澧炶繕鏄紪杈戯紝false-鏂板|true-缂栬緫
+            entityName: entityName.value, //瀹炰綋绫诲悕
+            formJson: _crudFormSchema.value, //鏂板缂栬緫鐨勮〃鍗曠粨鏋�
+            crudColSlots: objParams.value['crudColSlots'], //鏂板缂栬緫鐨勮〃鍗曚腑鐨勬彃妲藉垪琛�
+            isExistSql: isExistSql.value, //鏄惁瀛樺湪妫�鏌ql锛屾瘮濡�: XXX_CODE = '12345'
+            ifSave: true, //鏄惁鎻愪氦琛ㄥ崟鏃朵繚瀛樺埌鏁版嵁搴擄紝鍚�-鏆傚瓨|鏄�-淇濆瓨
           });
+          break;
+        case 'importModal' /* 鎵撳紑瀵煎叆Excel妯℃�佺獥鍙� */:
+          openImportModal(true, result.params);
+          break;
+        case 'ToPrint':
+          ToPrint({});
           break;
       }
     }
@@ -276,6 +497,11 @@
    * @return {*}
    */
   function handleSuccess(d, u) {
+    if (CustFunc && isFunction(CustFunc)) {
+      CustFunc({
+        values: d,
+      });
+    }
     reload();
   }
 
@@ -293,8 +519,8 @@
         `../entityts/${getForm().getFieldsValue()[`${item.replace(/form-/, '').replace(/add/, '')}PSelect_0`]}.ts`
       )
         .then((m) => {
-          const [{ GetSelectSuccess }] = m.default();
-          getForm().setFieldsValue(GetSelectSuccess(d, u));
+          const [{ GetSelectSuccess: GetSelectSuccess2 }] = m.default();
+          getForm().setFieldsValue(GetSelectSuccess2(d, u, objParams.value['EntityName']));
         })
         .catch(() => {
           getForm().setFieldsValue({
@@ -317,10 +543,10 @@
       )
         .then((m) => {
           const [{ OpenSelectItem }] = m.default();
-          OpenSelectItem(openItemModal);
+          OpenSelectItem(useModalInTableForm.value[item][1].openModal);
         })
         .catch(() => {
-          openItemModal(true, {
+          useModalInTableForm.value[item][1].openModal(true, {
             title: '鐗╂枡鍒楄〃',
             schemas: [
               {
@@ -355,4 +581,182 @@
         });
     } catch (e) {}
   }
+
+  /**
+   * @description: 寮瑰嚭妗嗙‘瀹氳繑鍥�
+   * @param {*} d
+   * @return {*}
+   */
+  function custSuccess(d) {
+    reload();
+  }
+
+  /**
+   * @description: 寮瑰嚭妗嗗彇娑堣繑鍥�
+   * @param {*} reload
+   * @return {*}
+   */
+  function custCancel() {
+    reload();
+  }
+
+  /**
+   * @description: 鍚勮〃鍗曞唴寮瑰嚭閫夋嫨妗嗛�夋嫨鎴愬姛鍚庢柟娉�
+   * @param {*} d
+   * @param {*} u
+   * @param {*} item
+   * @return {*}
+   */
+  function handleEntSuccess(d, u, item) {
+    /* 鍔ㄦ�乮mport瀹炰綋鍚�.ts鐨勮嚜瀹氫箟鏂规硶 */
+    try {
+      var values = GetSelectSuccess(d, u);
+      selectVals.value = values; //淇濆瓨寮瑰嚭妗嗛�夋嫨鐨勭粨鏋�
+      let _val = {};
+      d.returnFieldName.map((x) => {
+        _val[x] = values[x];
+      });
+      useFormData.value[item][1].setFieldsValue(_val);
+      /* 閽堝宸ュ崟鐨勬柟娉� */
+      if (d.returnFieldName.filter((x) => x == 'ROUTE_CODE') && item == 'prodinfo') {
+        routeData.value = {
+          nodes: [],
+          edges: [],
+        };
+
+        init(currlf, selectVals.value['ROUTE_CODE']);
+        const { transformModel, width, height } = unref(currlf).graphModel;
+        transformModel.focusOn(565, 200, width, height);
+      }
+    } catch (e) {}
+  }
+
+  /**
+   * @description: 鎵撳紑琛ㄥ崟涓殑妯℃�佹
+   * @param {*} item
+   * @return {*}
+   */
+  function handleCustClick(item) {
+    OpenSelectCust(
+      useModalData.value[item][1].openModal, //甯﹀叆openModal鏂规硶
+      item,
+      openRvModal,
+      selectVals,
+    );
+  }
+
+  function RvItemSuccess(d, u) {
+    RvcloseModal();
+  }
+
+  function ToPrint(params: {}) {
+    openFullLoading();
+    useWoFlowCard.getWoPickList(params['record']['ORDER_NO']).then((res) => {
+      const _style = `
+      #print-area {
+        position: absolute;
+        inset: 0;
+        background-color: #fff;
+
+        .item {
+          display: flex;
+          flex-direction: column;
+          height: 100%;
+          margin-right: 10px;
+          margin-left: 10px;
+          font-family: SimSun, "瀹嬩綋", serif;
+          page-break-after: always;
+
+          .head {
+          z-index: 1;
+          width: 100%;
+          background-color: azure;
+          font-size: 20px;
+          font-weight: bold;
+          line-height: 100px;
+          text-align: center;
+        }
+
+          .main {
+            display: flex;
+            flex: 1;
+            justify-content: center;
+            margin-top: 10px;
+            padding: 15px;
+            
+            table {
+              border-collapse: collapse;
+              width: 100%;
+            }
+
+            table,
+            th,
+            td {
+              border: solid 1px black;
+            }
+
+            tr > th {
+              height: 60px;
+            }
+            .instore_td {
+              border: 1px solid #000;
+              font-size: 12px;
+              line-height: 16px;
+              text-align: center;
+              word-break: break-all;
+            }
+            
+            .instore_td2 {
+              height: 60px;
+              border: 1px solid #000;
+              font-family: SimSun, "瀹嬩綋", serif;
+              font-size: 12px; /* 淇敼涓轰綘鎯宠鐨勫瓧浣撳ぇ灏� */
+              line-height: 20px;
+              text-align: center;
+              word-break: break-all;
+            }
+
+            .material_table_td {
+              border: 1px solid #000;
+              font-size: 12px; 
+              height: 25px;
+              line-height: 18px;
+              text-align: center;
+              word-break: break-all;
+            }
+          }
+
+          .footer {
+            display: flex;
+            margin-bottom: 15px;
+            background-color: #eee;
+            font-size: 12px;
+            line-height: 21px;
+            text-align: center;
+          }
+        }
+        .line {
+          width: 100px; /* 绾挎潯鐨勯暱搴� */
+          height: 0;
+          margin: 10px; /* 绾挎潯涓庡叾浠栧厓绱犵殑璺濈 */
+          border-top: 1px solid black; /* 绾挎潯鐨勯鑹插拰瀹藉害 */
+        }
+      }`;
+
+      printJS({
+        // 闇�瑕佹墦鍗板尯鍩熻缃殑Id
+        printable: 'print-area',
+        // 鎵撳嵃绫诲瀷
+        type: 'html',
+        // 榛樿鍊间负800锛屾垜浠妸鎶婅缃负100%
+        maxWidth: '100%',
+        // *浠h〃搴旂敤鎵�鏈夋牱寮忥紝榛樿鍊间负null锛屽鏋滀笉璁剧疆锛屾墦鍗扮獥鍙e垯浼氬拷鐣ユ墍鏈夋牱寮�
+        targetStyles: ['*'],
+        // font_size: '9pt',
+        scanStyles: false,
+        style: `@page {size: auto; margin: 0mm;} html, ${_style}`,
+      } as unknown as Configuration);
+      closeFullLoading();
+    });
+  }
 </script>

--
Gitblit v1.9.3