Ben Lin
2024-06-08 cca7adfe0b76ed7c2fbdbc9978533de147695184
src/views/tigerprojects/mes/prod/biz_mes_wo/index.vue
@@ -64,17 +64,12 @@
    <WoModal @register="registerWo" @success="handleSuccess" :title="title" :mtitle="mtitle" />
    <CustModal
      @register="registerCust"
      @success="handleSuccess"
      @success="custSuccess"
      :type="cType"
      :detailSlots="dtlSlots"
    >
      <template #[item.name] v-for="item in dtlSlots" :key="item.name">
        <BasicForm
          :schemas="formSchema"
          :ref="item.name"
          :labelWidth="100"
          :showActionButtonGroup="false"
        >
        <BasicForm @register="useFormData[item.name][0]">
          <template #[sitem]="{ field }" v-for="sitem in item.slots" :key="sitem">
            <a-button
              class="mt-1 ml-1"
@@ -96,7 +91,7 @@
<script lang="ts" setup>
  import { reactive, unref, h, onMounted, ref, nextTick } from 'vue';
  import { BasicTable, useTable, TableAction } from '/@/components/Table';
  import { BasicForm, FormSchema, FormActionType, FormProps } from '/@/components/Form/index';
  import { BasicForm, FormSchema, FormActionType, useForm } from '/@/components/Form/index';
  import WoDrawer from './WoDrawer.vue';
  import WoModal from './WoModal.vue';
  import NormalModal from '/@/views/components/NormalModal.vue';
@@ -115,7 +110,6 @@
  const { t } = useI18n();
  const cType = ref('');
  const title = ref('工单导入');
  const ctitle = ref('工单下发配置');
  const mtitle = ref('工单列表');
  const dtlSlots = ref([] as any[]);
  const selectVals = ref({});
@@ -153,9 +147,43 @@
    showIndexColumn: false,
  });
  const formSchema = ref([] as FormSchema[]);
  const woinfo = ref<Nullable<FormActionType>>(null);
  const forminfo = ref<Nullable<FormActionType>>(null);
  const prodinfo = ref<Nullable<FormActionType>>(null);
  const woSchema = ref([] as FormSchema[]);
  const prodSchema = ref([] as FormSchema[]);
  const xxSchema = ref([] as FormSchema[]);
  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,
    }),
    xxinfo: useForm({
      labelWidth: 120,
      schemas: xxSchema,
      actionColOptions: {
        span: 24,
      },
      showActionButtonGroup: false,
    }),
  });
  onMounted(() => {});
@@ -188,17 +216,19 @@
    dtlSlots.value = [
      { name: 'woinfo', slots: [], preIcons: {}, title: '工单信息' },
      { name: 'prodinfo', slots: [], preIcons: {}, title: '产品信息' },
      { name: 'xxinfo', slots: ['add'], preIcons: { add: 'search|svg' }, title: 'XXX' },
    ];
    formSchema.value = getFormSchema(cType.value);
    woSchema.value = getFormSchema('woinfo');
    prodSchema.value = getFormSchema('prodinfo');
    xxSchema.value = getFormSchema('xxinfo');
    openCustModal(true, {
      isUpdate: true,
      ctype: cType,
      title: '工艺配置',
      width: '1000px',
      formEl: useFormData.value, //如果是多个表单,增加多个插槽
      formElName: ['woinfo', 'prodinfo', 'xxinfo'],
      RowKey: '',
      formEl: { woinfo: woinfo.value, prodinfo: prodinfo.value }, //如果是多个表单,增加多个插槽
      // preIcons: { add: 'search|svg', set: 'config|svg' },
      // slots: ['add', 'set'], //给弹出框增加插槽标签数组
      ...record,
    });
  }
@@ -209,27 +239,24 @@
      {
        name: 'forminfo',
        slots: ['add', 'set'],
        preIcons: { add: 'search|svg', set: 'config|svg' },
        preIcons: { add: 'search|svg', set: 'config|svg' }, //如果是多个表单,增加多个插槽。slots是弹出框按钮的插槽,preIcons是插槽对应的按钮图标
        title: '下发配置',
      },
    ]; //如果是多个表单,增加多个插槽。slots是弹出框按钮的插槽,preIcons是插槽对应的按钮图标
    ];
    formSchema.value = getFormSchema(cType.value);
    nextTick(() => {
      setTimeout(() => {
        openCustModal(true, {
          isUpdate: true, //是否更新操作
          ctype: cType, //是哪个页面
          title: '工单下发', //标题
          width: '900px', //弹出框宽度
          formEl: { forminfo: forminfo.value },
          formElName: 'forminfo',
          RowKeys: { add: 'ROUTE_CODE', set: 'ROUTE_CODE' }, //插槽的弹出框选择的code
          ...record,
        });
      }, 100);
      closeModal();
      openCustModal(true, {});
    openCustModal(true, {
      isUpdate: true, //是否更新操作
      ctype: cType, //是哪个页面
      title: '工单下发', //标题
      width: '900px', //弹出框宽度
      formEl: useFormData.value,
      formElName: ['forminfo'],
      RowKeys: { add: 'ROUTE_CODE', set: 'ROUTE_CODE' }, //插槽的弹出框选择的code
      ...record,
    });
  }
  function custSuccess(d) {
    reload();
  }
  //取消下发
  function handleUnRelease(record: Recordable) {}
@@ -294,13 +321,13 @@
    let _val = {};
    _val[d.returnFieldName] = values[d.returnFieldName];
    if (item == 'forminfo') {
      forminfo.value.setFieldsValue(_val);
      useFormData.value['forminfo'][1].setFieldsValue(_val);
    }
    if (item == 'prodinfo') {
      prodinfo.value.setFieldsValue(_val);
      useFormData.value['prodinfo'][1].setFieldsValue(_val);
    }
    if (item == 'woinfo') {
      woinfo.value.setFieldsValue(_val);
      useFormData.value['woinfo'][1].setFieldsValue(_val);
    }
  }