Ben Lin
2024-07-16 5a4d79d9765dfca8812638b57d5f5fe21f7a06ee
src/views/tigerprojects/mes/prod/biz_mes_wo/index.vue
@@ -4,7 +4,7 @@
 * @version: 
 * @Date: 2024-05-25 00:27:00
 * @LastEditors: Ben Lin
 * @LastEditTime: 2024-07-03 20:51:05
 * @LastEditTime: 2024-07-16 16:44:47
-->
<template>
  <div>
@@ -70,37 +70,41 @@
    <Loading :loading="compState.loading" :tip="compState.tip" />
    <WoDrawer @register="registerDrawer" @success="handleSuccess" />
    <WoModal @register="registerWo" @success="handleSuccess" :title="title" :mtitle="mtitle" />
    <!-- 自定义模态框,可以自定义多表单 -->
    <CustModal
      @register="registerCust"
      @success="custSuccess"
      :type="cType"
      :detailSlots="dtlSlots"
    >
      <!-- 用插槽自定义多表单 -->
      <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 style="height: 200px" id="lfContainer" v-if="isCustEl[item.name]"></div> -->
        <div class="h-full" style="height: 380px" v-if="isCustEl[item.name]">
          <FlowChartView :data="routeData" @init="init" />
        </div>
      </template>
    </CustModal>
    <Suspense>
      <!-- 自定义模态框,可以自定义多表单 -->
      <CustModal
        @register="registerCust"
        @success="custSuccess"
        :type="cType"
        :detailSlots="dtlSlots"
        :entityName="entityName"
      >
        <!-- 用插槽自定义多表单 -->
        <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 style="height: 200px" id="lfContainer" v-if="isCustEl[item.name]"></div> -->
          <div class="h-full" style="height: 380px" v-if="isCustEl[item.name]">
            <FlowChartView :data="routeData" @init="init" />
          </div>
        </template>
      </CustModal>
      <!-- <template #fallback> Loading... </template> -->
    </Suspense>
    <RouteViewModal @register="registerRv" @success="RvItemSuccess" />
  </div>
</template>
@@ -126,6 +130,7 @@
  import { GetSelectSuccess, OpenSelectItem, getFormSchema } from '/@/views/components/data';
  import LogicFlow from '@logicflow/core';
  import { initRoute } from '../../../system/lowcode/data';
  import BIZ_MES_WO from '../../../system/lowcode/entityts/BIZ_MES_WO';
  const { t } = useI18n();
  const ASteps = Steps;
@@ -172,6 +177,7 @@
    nodes: [],
    edges: [],
  });
  const entityName = ref('BIZ_MES_WO');
  const formSchema = ref([] as FormSchema[]);
  const woSchema = ref<FormSchema[]>(getFormSchema('woinfo'));
  const prodSchema = ref<FormSchema[]>(getFormSchema('prodinfo'));
@@ -188,41 +194,10 @@
    addRot: useModal(),
    setRot: useModal(),
  });
  //自定义多表单实例
  const useFormData = ref({
    forminfo: useForm({
      labelWidth: 120,
      schemas: formSchema,
      actionColOptions: {
        span: 24,
      },
      showActionButtonGroup: false,
    }),
    woinfo: useForm({
      labelWidth: 120,
      schemas: woSchema,
      actionColOptions: {
        span: 24,
      },
      showActionButtonGroup: false,
    }),
    prodinfo: useForm({
      labelWidth: 120,
      schemas: prodSchema,
      actionColOptions: {
        span: 24,
      },
      showActionButtonGroup: false,
    }),
    // rotinfo: useForm({
    //   labelWidth: 120,
    //   schemas: rotSchema,
    //   actionColOptions: {
    //     span: 24,
    //   },
    //   showActionButtonGroup: false,
    // }),
  });
  /* 获取多表单实例 */
  const [{ GetUseForm }] = BIZ_MES_WO();
  const useFormData = ref<any>(GetUseForm());
  onMounted(async () => {});
@@ -301,14 +276,14 @@
   * @return {*}
   */
  function handleRelease(record: Recordable) {
    if (record.STATUS == 2) {
      createErrorModal({
        title: t('警告'),
        content: t('工单已经下发,不能再下发!'),
        getContainer: () => document.body,
      });
      return;
    }
    // if (record.STATUS == 2) {
    //   createErrorModal({
    //     title: t('警告'),
    //     content: t('工单已经下发,不能再下发!'),
    //     getContainer: () => document.body,
    //   });
    //   return;
    // }
    cType.value = 'BIZ_MES_WO';
    dtlSlots.value = [
      {
@@ -318,7 +293,7 @@
        title: '下发配置',
      },
    ];
    formSchema.value = getFormSchema(cType.value);
    // formSchema.value = getFormSchema(cType.value);
    openCustModal(true, {
      isUpdate: true, //是否更新操作
      ctype: cType, //是哪个页面
@@ -328,7 +303,7 @@
      formElName: ['forminfo'], //表单插槽名称
      RowKeys: { add: 'ROUTE_CODE', set: 'ROUTE_CODE' }, //插槽的弹出框选择的code
      fnName: { BIZ_MES_WO: 'SaveWoBatch' }, //保存方法名
      initFnName: {}, //初始化方法名
      initFnName: {}, //初始化方法名,没有就留空{}
      isCustEl: isCustEl.value,
      values: record, //表单记录
    });
@@ -503,8 +478,8 @@
      selectVals.value['ROUTE_CODE'],
    ); //[openRvModal], selectVals.value['ID']这是自定义参数,按实际需求
  }
  function RvItemSuccess(d, u) {
    closeModal();
    }
  }
</script>