Ben Lin
2024-10-17 07895c65b99fa43f8e54f5054bd8351a71158143
src/views/tigerprojects/system/lowcode/composition/Config.vue
@@ -4,7 +4,7 @@
 * @version: 
 * @Date: 2024-06-24 23:44:31
 * @LastEditors: Ben Lin
 * @LastEditTime: 2024-09-29 16:23:30
 * @LastEditTime: 2024-10-17 20:28:47
-->
<template>
  <Card :title="GetTitle(configType)['configTitle']">
@@ -34,16 +34,18 @@
  <Card
    :title="GetTitle(configType, item)['tableTitle']"
    :bordered="false"
    class="!mt-5"
    v-for="item in OtherTables"
    :key="item"
    v-show="showOtherTable[item]"
    class="mt-1"
  >
  <div :style="custTableStyle" >
    <BasicTable @register="useTables[item][0]" v-if="showOtherTable[item]">
      <template #action="{ record }">
        <TableAction :actions="createActions(record, item)" />
      </template>
    </BasicTable>
  </div>
    <normalDrawer @register="useDrawers[item][0]" @success="(d, u) => EditSuccess(d, u, item)" />
    <GeneralCrudModal @register="useModalsCrud[item][0]"></GeneralCrudModal>
  </Card>
@@ -62,6 +64,8 @@
  import { useDrawer } from '/@/components/Drawer';
  import normalDrawer from '../normalDrawer.vue';
  import { useModal } from '/@/components/Modal';
  import { useProdRouteStore } from '/@/store/modules/prodRoute';
  import { storeToRefs } from 'pinia';
  const { t } = useI18n();
  const emit = defineEmits(['success', 'register']);
@@ -113,10 +117,11 @@
  ] = isNullOrUnDef(custImport.value['default'])
    ? EntityCustFunction.value
    : custImport.value['default']();
  const useProdRoute = useProdRouteStore();
  const { curDtl } = storeToRefs(useProdRoute);
  const useModalData = ref(GetUseModals());
  const data = ref({});
  const useTables = ref(GetUseTables(data, emit));
  // const data = ref({});
  const useTables = ref(GetUseTables(curDtl, emit));
  const useForms = ref(GetUseForm());
  const useDrawers = ref({});
  const useModalsCrud = ref({});
@@ -127,6 +132,9 @@
    showOtherTable.value[x] = false;
    useDrawers.value[x] = useDrawer();
    useModalsCrud.value[x] = useModal();
  });
  const custTableStyle = ref({
    height: window.screen.width == 1366? '350px': '450px'
  });
  /* 注入选中节点数据 */
@@ -150,9 +158,9 @@
            const name = result['name'];
            if (showOtherTable.value[name]) {
              showOtherTable.value[name] = false;
              data.value[name] = result[name];
              data.value['Action'] = result['Action'];
              useTables.value = GetUseTables(data, emit);
              // data.value[name] = curDtl.value[name]; //result[name];
              // data.value['Action'] = curDtl.value['Action']; //result['Action'];
              useTables.value = GetUseTables(curDtl, emit);
              setTimeout(() => {
                showOtherTable.value[name] = true;
              }, 10);
@@ -180,10 +188,10 @@
    const nodes = selectedNodes.value;
    nodeChange({ useForms, objParams, selectedNodes: nodes }).then((result) => {
      showOtherTable.value = result.isShow;
      data.value[configType.value as string] = result[configType.value as string];
      useTables.value = GetUseTables(data, emit);
      if (showOtherTable.value[result['name']]) {
        data.value[result['name']] = result[result['name']];
      // data.value[configType.value as string] = curDtl.value[configType.value as string]; //result[configType.value as string];
      useTables.value = GetUseTables(curDtl, emit);
      if (showOtherTable.value[curDtl.value['name']]) {
        // curDtl.value[result['name']] = curDtl.value[result['name']];
        // useTables.value[result['name']][1].setProps({
        //   dataSource: [],
        // });
@@ -263,7 +271,7 @@
      CustFunc({
        ctype: item,
        values: d,
        data: data,
        data: curDtl,
      }).then(() => {
        /* 显示其他表格 */
        if (showOtherTable.value[item]) {
@@ -271,12 +279,12 @@
          setTimeout(() => {
            showOtherTable.value[item] = true;
          }, 10);
          useTables.value = GetUseTables(data, emit);
          useTables.value = GetUseTables(curDtl, emit);
          setTimeout(() => {
            useTables.value[item][1].reload();
            useForms.value[configType.value as string][1].resetFields();
            useForms.value[configType.value as string][1].setFieldsValue(
              data.value[configType.value as string][0],
              curDtl.value[configType.value as string][0],
            );
          }, 10);
        }
@@ -311,17 +319,17 @@
  function SelectInFormSuccess(d, u, item) {
    GetSelectSuccess(d, u, item).then((result) => {
      useForms.value[configType.value][1].setFieldsValue(result['value']);
      if (!isNullOrUnDef(data.value[configType.value as string])) {
        data.value[configType.value as string].map((x) => {
      if (!isNullOrUnDef(curDtl.value[configType.value as string])) {
        curDtl.value[configType.value as string].map((x) => {
          Object.getOwnPropertyNames(result['value']).forEach((key) => {
            x[key] = result['value'][key];
          });
        });
      }
      showOtherTable.value = result['isShow'];
      data.value[result.name] = result['data'];
      curDtl.value[result.name] = result['data'];
      /* 重新useTable,否则数据不刷新 */
      useTables.value = GetUseTables(data, emit);
      useTables.value = GetUseTables(curDtl, emit);
      if (showOtherTable.value[result.name]) {
        showOtherTable.value[result.name] = false;
        setTimeout(() => {