Ben Lin
2024-09-24 3bf0e1e45acfb85fb6054dc55d1c1204a6750998
通用增删改模态窗口更新,工单维护更新
已修改12个文件
已添加2个文件
753 ■■■■ 文件已修改
src/api/tigerapi/mes/mesApi.ts 4 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/api/tigerapi/mes/wo.ts 17 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/api/tigerapi/system.ts 33 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/assets/icons/template.svg 1 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/components/GeneralCrudModal.vue 279 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/components/GeneralModal.vue 5 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/components/GeneralTree.vue 5 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/demo/table/EditRowTable.vue 3 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/tigerprojects/system/lowcode/composition/Config.vue 89 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/tigerprojects/system/lowcode/entityts/BIZ_MES_WO.ts 15 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/tigerprojects/system/lowcode/entityts/ProdRouteBinding.ts 23 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/tigerprojects/system/lowcode/entityts/WoRouteBinding.ts 267 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/tigerprojects/system/lowcode/high/edit/editdtl.vue 4 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/tigerprojects/system/lowcode/normal/mainTable.vue 8 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/api/tigerapi/mes/mesApi.ts
@@ -4,7 +4,7 @@
 * @version: 
 * @Date: 2024-04-27 15:54:50
 * @LastEditors: Ben Lin
 * @LastEditTime: 2024-09-11 23:13:42
 * @LastEditTime: 2024-09-22 18:30:58
 */
export enum mesApi {
  GetRoute = '/MES/GetRoute',
@@ -35,4 +35,6 @@
  UpdateWoBatchStatus = '/MES/UpdateWoBatchStatus',
  SaveLabelTemplate = '/MES/SaveLabelTemplate',
  DeleteLabelTemplate = '/MES/DeleteLabelTemplate',
  AddOrEditLabelVarByWorkOrder = '/MES/AddOrEditLabelVarByWorkOrder',
  GetLabelVarByWorkOrder = '/MES/GetLabelVarByWorkOrder',
}
src/api/tigerapi/mes/wo.ts
@@ -6,6 +6,7 @@
  BIZ_MES_WO,
  SaveWoBatchInput,
  BizMesWoInput,
  BAS_LABEL_VAR_WO,
} from '../model/mesModel';
import { genAction, Api, genActionPage } from '../system';
import { defHttp } from '/@/utils/http/axios';
@@ -129,3 +130,19 @@
    },
  );
};
/**
 * @description: ä¿®æ”¹å·¥å•模板变量
 * @param {BAS_LABEL_VAR_WO} params
 * @return {*}
 */
export const AddOrEditLabelVarByWorkOrder = async (params: BAS_LABEL_VAR_WO) => {
  const data = await defHttp.post(
    { url: mesApi.AddOrEditLabelVarByWorkOrder, params: genAction('', params) },
    {
      errorMessageMode: 'none',
      isTransformResponse: false,
    },
  );
  return data;
};
src/api/tigerapi/system.ts
@@ -715,24 +715,26 @@
  }
  const rParams = genAction(
    params['TABLE_NAME'],
    {
      QueryAble_T: '',
      where: sqlcmd,
      order: order,
      page: {
        pageAble_T: 'string',
        draw: 1,
        pageIndex: params['page'],
        pageSize: params['pageSize'],
      },
    },
    !isNullOrEmpty(params['apiUrl'])
      ? params
      : {
          QueryAble_T: '',
          where: sqlcmd,
          order: order,
          page: {
            pageAble_T: 'string',
            draw: 1,
            pageIndex: params['page'],
            pageSize: params['pageSize'],
          },
        },
    params['option'],
  );
  return getListByPageAsync(rParams);
  return getListByPageAsync(rParams, params['apiUrl']); //如果不想用默认的基础方法获取分页数据,可以换其他的api
}
async function getListByPageAsync(params: any) {
async function getListByPageAsync(params: any, apiUrl: string | null | undefined) {
  const data = await defHttp.post(
    { url: Api.QueryUrl, params, timeout: 50000 },
    { url: !isNullOrEmpty(apiUrl) ? apiUrl : Api.QueryUrl, params, timeout: 50000 },
    {
      isTransformResponse: false,
    },
@@ -763,6 +765,7 @@
      Keys[k] != 'field' &&
      Keys[k] != 'option' &&
      Keys[k] != '0' &&
      Keys[k] != 'apiUrl' &&
      !Keys[k].toString().endsWith('PSelect_0')
    ) {
      if (!isNullOrEmpty(params[Keys[k]].length) && isTimeViaRegExp8601(params[Keys[k]][0])) {
@@ -770,6 +773,8 @@
        sqlcmd += ` And ${Keys[k]} < '${params[Keys[k]][1]}'`;
      } else if (isNumber(params[Keys[k]])) {
        sqlcmd += `And ${Keys[k]} = ${params[Keys[k]]}`;
      } else if (Keys[k] == 'sqlcmd') {
        sqlcmd += ` And ${params[Keys[k]]}`;
      } else {
        sqlcmd += `And ${Keys[k]} like '%${params[Keys[k]]}%'`;
      }
src/assets/icons/template.svg
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1 @@
<?xml version="1.0" standalone="no"?><!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"><svg t="1726924381855" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="17051" xmlns:xlink="http://www.w3.org/1999/xlink" width="200" height="200"><path d="M0 0v1024h1024V0z m965.485714 965.485714H58.514286V204.8h906.971428z m0-819.2H58.514286V58.514286h906.971428zM468.114286 263.314286H146.285714v292.571428h321.828572z m-58.514286 234.057143H204.8v-175.542858h204.8z m380.342857-175.542858h-263.314286v58.514286h263.314286z m87.771429 117.028572H526.628571v58.514286h351.085715z m-409.6 175.542857H146.285714v292.571429h321.828572z m-58.514286 234.057143H204.8v-175.542857h204.8z m380.342857-175.542857h-263.314286v58.514285h263.314286z m87.771429 117.028571H526.628571v58.514286h351.085715z" p-id="17052" fill="#182991"></path></svg>
src/views/components/GeneralCrudModal.vue
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,279 @@
<template>
  <BasicModal
    :width="width"
    :height="650"
    v-bind="$attrs"
    @register="register"
    :title="title"
    @ok="handleSubmit"
  >
    <div>
      <BasicTable @register="registerTable" @edit-change="onEditChange">
        <template #toolbar>
          <a-button @click="openImg" type="primary"> é¢„览 </a-button>
        </template>
        <template #bodyCell="{ column, record }">
          <template v-if="column.key === 'action'">
            <TableAction :actions="createActions(record)" />
          </template>
        </template>
      </BasicTable>
    </div>
  </BasicModal>
</template>
<script lang="ts" setup>
  import { ref, unref } from 'vue';
  import { BasicModal, useModalInner } from '/@/components/Modal';
  import { FormSchema } from '/@/components/Form/index';
  import {
    BasicTable,
    BasicColumn,
    TableAction,
    useTable,
    EditRecordRow,
    ActionItem,
  } from '/@/components/Table';
  import { useI18n } from '/@/hooks/web/useI18n';
  import { createImgPreview } from '/@/components/Preview';
  import { getListByPage, SaveEntity } from '/@/api/tigerapi/system';
  import { useMessage } from '/@/hooks/web/useMessage';
  import { cloneDeep, isFunction } from 'lodash-es';
  import { isNullOrUnDef } from '/@/utils/is';
  import { CustModalParams } from '/@/api/tigerapi/model/systemModel';
  import { EntityCustFunctionType } from '/@/api/tigerapi/model/basModel';
  const { t } = useI18n();
  const title = ref('');
  const tableName = ref('');
  const rowKey = ref('');
  const returnFieldName = ref('');
  const schemas = ref([] as FormSchema[]);
  const which = ref('');
  const width = ref('');
  const entityName = ref('');
  const ctype = ref('');
  const others = ref({});
  //列表
  const ItemColumns = ref([] as BasicColumn[]);
  const searchInfo = ref({});
  const emit = defineEmits(['success', 'register']);
  const [registerTable, { setProps, getDataSource, reload }] = useTable({
    title: '列表信息',
    api: getListByPage,
    searchInfo: searchInfo,
    columns: ItemColumns,
    scroll: { y: 600 },
    formConfig: {
      labelWidth: 140,
      schemas: schemas.value,
      // submitFunc: () => Search('BAS_LABEL_VAR_WO', data, args[0]), //自定义查询提交按钮的方法,触发查询提交事件
    },
    useSearchForm: false,
    showTableSetting: false,
    bordered: true,
    canResize: false,
    showIndexColumn: false,
    actionColumn: {
      width: 130,
      title: '操作',
      dataIndex: 'action',
      fixed: 'right',
    }, //自定义操作列
  });
  const { createMessage: msg } = useMessage();
  const currentEditKeyRef = ref('');
  const custImport = ref<any[]>([]);
  const EntityCustFunction = ref([
    {
      ActionItem(params, data, ...args) {},
      KeyFieldValues(val, id) {},
      OpenSelectItem(openItemModal: Fn, ...args) {},
      GetSelectSuccess(d, u, ...args) {},
      GetUseForm(...args) {},
      CustFunc(param: CustModalParams) {},
    } as EntityCustFunctionType,
  ]);
  const [register, { setModalProps, closeModal }] = useModalInner((data) => {
    setModalProps({ confirmLoading: false });
    setProps({
      dataSource: [],
    });
    data && onDataReceive(data);
  });
  const imgList: any[] = []; //['http://localhost:8800/files/Template/10位批次条码.png'];
  function openImg() {
    let dataSource: any[] = getDataSource();
    const onImgLoad = ({ index, url, dom }) => {
      console.log(`第${index + 1}张图片已加载,URL为:${url}`, dom);
    };
    // å¯ä»¥ä½¿ç”¨createImgPreview返回的 PreviewActions æ¥æŽ§åˆ¶é¢„览逻辑,实现类似幻灯片、自动旋转之类的骚操作
    createImgPreview({ imageList: [dataSource[0].LABEL_VIEW_PATH], defaultWidth: 700, rememberState: true, onImgLoad });
  }
  async function onDataReceive(data) {
    currentEditKeyRef.value = '';
    console.log('Data Received', data);
    // æ–¹å¼1;
    // setFieldsValue({
    //   field2: data.data,
    //   field1: data.info,
    // });
    searchInfo.value = data?.searchInfo;
    title.value = data?.title;
    schemas.value = data?.schemas;
    ItemColumns.value = data?.ItemColumns;
    width.value = data?.width; //弹框宽度
    tableName.value = data?.tableName;
    rowKey.value = data?.rowKey;
    returnFieldName.value = data?.returnFieldName;
    which.value = data?.which;
    entityName.value = data?.entityName;
    ctype.value = data?.ctype;
    others.value = data?.others;
    // getForm().resetFields();
    /* åŠ¨æ€import实体名.ts的自定义方法 */
    try {
      custImport.value = await import(
        `../tigerprojects/system/lowcode/entityts/${entityName.value}.ts`
      );
    } catch (e) {}
    reload();
  }
  /**
   * @description: ç¼–辑行
   * @param {*} record
   * @return {*}
   */
  function handleEdit(record: EditRecordRow) {
    currentEditKeyRef.value = record.key;
    record.onEdit?.(true);
  }
  /**
   * @description: å–消编辑
   * @param {*} record
   * @return {*}
   */
  function handleCancel(record: EditRecordRow) {
    currentEditKeyRef.value = '';
    record.onEdit?.(false, false);
  }
  /**
   * @description: ç”ŸæˆæŒ‰é’®
   * @param {*} record
   * @return {*}
   */
  function createActions(record: EditRecordRow): ActionItem[] {
    if (!record.editable) {
      return [
        {
          label: '编辑',
          disabled: currentEditKeyRef.value ? currentEditKeyRef.value !== record.key : false,
          onClick: handleEdit.bind(null, record),
          name: '',
        },
      ];
    }
    return [
      {
        label: '保存',
        onClick: handleSave.bind(null, record),
        name: '',
      },
      {
        label: '取消',
        popConfirm: {
          title: '是否取消编辑',
          confirm: handleCancel.bind(null, record),
        },
        name: '',
      },
    ];
  }
  /**
   * @description: ä¿å­˜æ“ä½œ
   * @param {*} record
   * @return {*}
   */
  async function handleSave(record: EditRecordRow) {
    // æ ¡éªŒ
    msg.loading({ content: '正在保存...', duration: 0, key: 'saving' });
    const valid = await record.onValid?.();
    if (valid) {
      try {
        const data = cloneDeep(record.editValueRefs);
        console.log(data);
        //TODO æ­¤å¤„将数据提交给服务器保存
        const [{ CustFunc }, ActionColumn] = isNullOrUnDef(custImport.value['default'])
          ? EntityCustFunction.value
          : custImport.value['default']();
        if (CustFunc && isFunction(CustFunc)) {
          CustFunc({
            others: others.value,
            ctype: ctype.value,
            values: record,
          });
        } else {
          /* é»˜è®¤ä¿å­˜æ–¹æ³• */
          const action = await SaveEntity(
            record,
            true,
            unref(entityName),
            // `${isExistSql.value}='${values[isExistSql.value]}'`,
          );
        }
        // ä¿å­˜ä¹‹åŽæäº¤ç¼–辑状态
        const pass = await record.onEdit?.(false, true);
        if (pass) {
          currentEditKeyRef.value = '';
        }
        msg.success({ content: t('数据已保存'), key: 'saving' });
      } catch (error) {
        msg.error({ content: t('保存失败'), key: 'saving' });
      }
    } else {
      msg.error({ content: t('请填写正确的数据'), key: 'saving' });
    }
  }
  /**
   * @description: ç¼–辑改变时事件
   * @param {*} column
   * @param {*} value
   * @param {*} record
   * @return {*}
   */
  function onEditChange({ column, value, record }) {
    // æœ¬ä¾‹
    if (column.dataIndex === 'id') {
      record.editValueRefs.name4.value = `${value}`;
    }
    console.log(column, value, record);
  }
  /**
   * @description: å®Œæˆæäº¤
   * @return {*}
   */
  async function handleSubmit() {
    try {
      var values = '';
      var ids = '';
      closeModal();
      emit('success', {
        isUpdate: unref(false),
        values: { val: values, id: ids },
        returnFieldName: returnFieldName.value,
        which: which.value,
      });
    } finally {
      setModalProps({ confirmLoading: false });
    }
  }
</script>
src/views/components/GeneralModal.vue
@@ -49,14 +49,13 @@
    columns: ItemColumns,
    formConfig: {
      labelWidth: 120,
      schemas,
      schemas: schemas.value,
    },
    useSearchForm: true,
    showTableSetting: false,
    rowKey: rowKey,
    rowSelection: {
      selectedRowKeys: checkedKeys,
      selectedRowKeys: checkedKeys.value,
      type: 'checkbox',
      // getCheckboxProps(record: Recordable) {
      //   // Demo: ç¬¬ä¸€è¡Œï¼ˆid为0)的选择框禁用
src/views/components/GeneralTree.vue
@@ -4,7 +4,7 @@
 * @version: 
 * @Date: 2024-06-19 11:07:21
 * @LastEditors: Ben Lin
 * @LastEditTime: 2024-07-23 21:29:52
 * @LastEditTime: 2024-09-22 00:19:36
-->
<template>
  <div class="m-4 mr-0 overflow-hidden bg-white">
@@ -14,7 +14,7 @@
      search
      :add="add"
      treeWrapperClassName="h-[calc(100%-35px)] overflow-auto"
      :clickRowToExpand="false"
      :clickRowToExpand="true"
      :treeData="treeData"
      :renderIcon="createIcon"
      :fieldNames="fieldNames"
@@ -22,6 +22,7 @@
      @handleAdd="handleAdd"
      @unselect="UnSelect"
      :beforeRightClick="props.beforeRightClick"
      :defaultExpandAll="true"
    />
  </div>
</template>
src/views/demo/table/EditRowTable.vue
@@ -282,6 +282,7 @@
          label: '编辑',
          disabled: currentEditKeyRef.value ? currentEditKeyRef.value !== record.key : false,
          onClick: handleEdit.bind(null, record),
          name: ''
        },
      ];
    }
@@ -289,6 +290,7 @@
      {
        label: '保存',
        onClick: handleSave.bind(null, record),
        name: ''
      },
      {
        label: '取消',
@@ -296,6 +298,7 @@
          title: '是否取消编辑',
          confirm: handleCancel.bind(null, record),
        },
        name: ''
      },
    ];
  }
src/views/tigerprojects/system/lowcode/composition/Config.vue
@@ -4,66 +4,71 @@
 * @version: 
 * @Date: 2024-06-24 23:44:31
 * @LastEditors: Ben Lin
 * @LastEditTime: 2024-08-09 16:49:10
 * @LastEditTime: 2024-09-23 01:57:00
-->
<template>
  <Card :title="GetTitle(props.configType)['configTitle']">
  <Card :title="GetTitle(configType)['configTitle']">
    <BasicForm
      @register="useForms[d]"
      @submit="customSubmitFunc"
      v-for="d in Object.keys(useForms)"
      :key="d"
      v-show="d == props.configType"
      v-show="d == configType"
    >
      <template #[item]="{ field }" v-for="item in GetCrudColSlots()" :key="item">
      <template #[item.name]="{ field }" v-for="item in GetCrudColSlots()" :key="item.name">
        <a-button
          v-if="field"
          class="mt-1 ml-1"
          size="small"
          @click="SelectItemInForm(item)"
          preIcon="search|svg"
          @click="SelectItemInForm(item.name)"
          :preIcon="item.icon"
        />
        <GeneralModal
          @register="useModalData[item][0]"
          @success="(d, u) => SelectInFormSuccess(d, u, item)"
          @register="useModalData[item.name][0]"
          @success="(d, u) => SelectInFormSuccess(d, u, item.name)"
        />
        <GeneralCrudModal @register="useModalsCrudInForm[item.name][0]"></GeneralCrudModal>
      </template>
    </BasicForm>
  </Card>
  <Card
    :title="GetTitle(props.configType, item)['tableTitle']"
    :title="GetTitle(configType, item)['tableTitle']"
    :bordered="false"
    class="!mt-5"
    v-for="item in OtherTables"
    :key="item"
    v-show="showOtherTable[item]">
    <BasicTable @register="useTables[item][0]"
    v-if="showOtherTable[item]">
    v-show="showOtherTable[item]"
  >
    <BasicTable @register="useTables[item][0]" v-if="showOtherTable[item]">
      <template #action="{ record }">
        <TableAction :actions="createActions(record, item)" />
      </template>
    </BasicTable>
    <normalDrawer @register="useDrawers[item][0]" @success="(d,u) => EditSuccess(d, u, item)" />
    <normalDrawer @register="useDrawers[item][0]" @success="(d, u) => EditSuccess(d, u, item)" />
    <GeneralCrudModal @register="useModalsCrud[item][0]"></GeneralCrudModal>
  </Card>
</template>
<script lang="ts" setup>
  import { Ref, inject, nextTick, onMounted, ref, unref, watch } from 'vue';
  import { Ref, inject, nextTick, onMounted, ref, toRef, toRefs, unref, watch } from 'vue';
  import { BasicForm } from '/@/components/Form/index';
  import { BasicTable, TableAction } from '/@/components/Table';
  import { Card } from 'ant-design-vue';
  import GeneralModal from '/@/views/components/GeneralModal.vue';
  import GeneralCrudModal from '/@/views/components/GeneralCrudModal.vue';
  import { useI18n } from '/@/hooks/web/useI18n';
  import { isFunction, isNullOrUnDef } from '/@/utils/is';
  import { EntityCustFunctionType } from '/@/api/tigerapi/model/basModel';
  import { editRecord } from '../data';
  import { useDrawer } from '/@/components/Drawer';
  import normalDrawer from '../normalDrawer.vue';
  import { useModal } from '/@/components/Modal';
  const { t } = useI18n();
  const emit = defineEmits(['success', 'register']);
  const props = defineProps({
    configType: { type: String },
  });
  const configType = toRef(props, 'configType');
  const showOtherTable = ref<any>({}); //显示表格布尔对象
  const objParams = inject('objParams') as Ref<any>;
  const custImport = ref<any[]>([]);
@@ -102,6 +107,8 @@
      GetUseTables,
      GetUseForm,
      CustFunc,
      GetUseCrudModals,
      ActionItem,
    },
  ] = isNullOrUnDef(custImport.value['default'])
    ? EntityCustFunction.value
@@ -112,11 +119,14 @@
  const useTables = ref(GetUseTables(data, emit));
  const useForms = ref(GetUseForm());
  const useDrawers = ref({});
  const useModalsCrud = ref({});
  const useModalsCrudInForm = ref(GetUseCrudModals());
  const OtherTables = ref(objParams.value['OtherTableName']);
  /* å¾ªçŽ¯è‡ªå®šä¹‰è¡¨æ ¼ååˆ—è¡¨ï¼Œåˆå§‹åŒ–æ˜¾ç¤ºè¡¨æ ¼å¸ƒå°”å¯¹è±¡ */
  objParams.value['OtherTableName'].forEach((x) => {
    showOtherTable.value[x] = false;
    useDrawers.value[x] = useDrawer();
    useModalsCrud.value[x] = useModal();
  });
  /* æ³¨å…¥é€‰ä¸­èŠ‚ç‚¹æ•°æ® */
@@ -148,12 +158,12 @@
              }, 10);
              setTimeout(() => {
                if (!isNullOrUnDef(name)) {
                // useTables.value[name][1].setProps({
                //   dataSource: [],
                // });
                // useTables.value[name][1].setProps({
                //   dataSource: data.value[name],
                // });
                  // useTables.value[name][1].setProps({
                  //   dataSource: [],
                  // });
                  // useTables.value[name][1].setProps({
                  //   dataSource: data.value[name],
                  // });
                  useTables.value[name][1].reload();
                }
              }, 1000);
@@ -170,7 +180,7 @@
    const nodes = selectedNodes.value;
    nodeChange({ useForms, objParams, selectedNodes: nodes }).then((result) => {
      showOtherTable.value = result.isShow;
      data.value['Action'] = result['Action'];
      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']];
@@ -194,7 +204,7 @@
   */
  async function customSubmitFunc(values) {
    try {
      SubmitFunc(values, props.configType, emit);
      SubmitFunc(values, configType.value, emit);
      // values.AUTH_PROD = useUserStore().getUserInfo.prodCode;
      // values.FACTORY = useUserStore().getUserInfo.prodCode;
      // const apiAction = SaveEntity(values, true, 'MES_PROD_ACTION');
@@ -233,7 +243,13 @@
        name: undefined,
      },
    ];
    return actionItem;
    return ActionItem(
      params,
      actionItem,
      useModalsCrud.value[name][1].openModal,
      useTables.value[name][1].reload(),
      objParams.value['CODE'],
    );
  }
  /**
@@ -258,8 +274,8 @@
          useTables.value = GetUseTables(data, emit);
          setTimeout(() => {
            useTables.value[item][1].reload();
            useForms.value['Action'][1].resetFields();
            useForms.value['Action'][1].setFieldsValue(data.value['Action'][0]);
            useForms.value[configType.value as string][1].resetFields();
            useForms.value[configType.value as string][1].setFieldsValue(data.value[configType.value as string][0]);
          }, 10);
        }
      });
@@ -273,7 +289,8 @@
   * @return {*}
   */
  function SelectItemInForm(item) {
    OpenSelectItem(useModalData.value[item][1].openModal, item);
    const record = useForms.value[configType.value][1].getFieldsValue();
    OpenSelectItem(useModalData.value[item][1].openModal, item, useModalsCrudInForm.value[item][1].openModal, record, objParams.value['CODE']);
  }
  /**
@@ -285,21 +302,21 @@
   */
  function SelectInFormSuccess(d, u, item) {
    GetSelectSuccess(d, u, item).then((result) => {
      useForms.value[props.configType][1].setFieldsValue(result['value']);
      data.value[props.configType as string].map((x) => {
        Object.getOwnPropertyNames(result['value']).forEach(key => {
            x[key] = result['value'][key];
         });
      useForms.value[configType.value][1].setFieldsValue(result['value']);
      data.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']
      data.value[result.name] = result['data'];
      /* é‡æ–°useTable,否则数据不刷新 */
      useTables.value = GetUseTables(data, emit);
      if (showOtherTable.value[result.name]) {
          showOtherTable.value[result.name] = false;
          setTimeout(() => {
            showOtherTable.value[result.name] = true;
          }, 10);
        showOtherTable.value[result.name] = false;
        setTimeout(() => {
          showOtherTable.value[result.name] = true;
        }, 10);
        useTables.value[result.name][1].reload();
      }
    });
src/views/tigerprojects/system/lowcode/entityts/BIZ_MES_WO.ts
@@ -4,7 +4,7 @@
 * @version:
 * @Date: 2024-06-19 20:34:27
 * @LastEditors: Ben Lin
 * @LastEditTime: 2024-09-11 22:41:44
 * @LastEditTime: 2024-09-21 23:19:58
 */
import { Ref, h, ref, render, unref } from 'vue';
@@ -66,6 +66,10 @@
          x.onClick = handleRelease.bind(null, args, params);
          x.tooltip = '下发';
        }
        // if (x.name == 'handleTemplate') {
        //   x.onClick = handleTemplate.bind(null, args, params);
        //   x.tooltip = '模板维护';
        // }
      });
      return data;
    },
@@ -88,6 +92,14 @@
          showActionButtonGroup: false,
        }),
        prodinfo: useForm({
          labelWidth: 120,
          schemas: prodCfgformSchema,
          actionColOptions: {
            span: 24,
          },
          showActionButtonGroup: false,
        }),
        tmpinfo: useForm({
          labelWidth: 120,
          schemas: prodCfgformSchema,
          actionColOptions: {
@@ -426,7 +438,6 @@
    });
  }
  /* ä¸‹å‘界面中的表单列表 */
  const woformSchema: FormSchema[] = [
    {
      field: 'PLAN_QTY',
src/views/tigerprojects/system/lowcode/entityts/ProdRouteBinding.ts
@@ -4,7 +4,7 @@
 * @version:
 * @Date: 2024-06-19 20:34:27
 * @LastEditors: Ben Lin
 * @LastEditTime: 2024-09-11 10:44:38
 * @LastEditTime: 2024-09-23 01:57:24
 */
import { Ref, h, ref, render, unref } from 'vue';
@@ -125,7 +125,15 @@
     * @return {*}
     */
    GetCrudColSlots: () => {
      return ['scanadd', 'assyadd', 'testadd', 'auditadd', 'printadd', 'pkgadd'];
      return [
        { name: 'scanadd', icon: 'search|svg' },
        { name: 'assyadd', icon: 'search|svg' },
        { name: 'testadd', icon: 'search|svg' },
        { name: 'auditadd', icon: 'search|svg' },
        { name: 'printadd', icon: 'search|svg' },
        { name: 'pkgadd', icon: 'search|svg' },
        { name: 'labeladd', icon: 'search|svg' },
      ];
    },
    /**
     * @description: åˆ‡æ¢èŠ‚ç‚¹æ—¶äº‹ä»¶æ–¹æ³•
@@ -645,7 +653,12 @@
          });
          break;
        case 'editRoute':
          args[1](true, { rotId: args[2][0].id, slotName: '', prodCode:args[3],custCode:args[2][0].cust });
          args[1](true, {
            rotId: args[2][0].id,
            slotName: '',
            prodCode: args[3],
            custCode: args[2][0].cust,
          });
          break;
      }
    },
@@ -725,9 +738,7 @@
              x.RULE_CODE = param.values['RULE_CODE'];
            }
          });
          param.data.value['Action'][0]['OPTION_1'] = JSON.stringify(
            param.data.value['ItemCode'],
          );
          param.data.value['Action'][0]['OPTION_1'] = JSON.stringify(param.data.value['ItemCode']);
          break;
      }
    },
src/views/tigerprojects/system/lowcode/entityts/WoRouteBinding.ts
@@ -4,7 +4,7 @@
 * @version:
 * @Date: 2024-06-19 20:34:27
 * @LastEditors: Ben Lin
 * @LastEditTime: 2024-08-21 23:20:38
 * @LastEditTime: 2024-09-24 09:28:56
 */
import { Ref, h, ref, render, unref } from 'vue';
@@ -21,13 +21,16 @@
import { NavItem } from '/@/api/tigerapi/model/basModel';
import { useMessage } from '/@/hooks/web/useMessage';
import { useModal } from '/@/components/Modal';
import { BasicColumn, FormSchema, useTable } from '/@/components/Table';
import { ActionItem, BasicColumn, FormSchema, useTable } from '/@/components/Table';
import { CustModalParams } from '/@/api/tigerapi/model/systemModel';
import { useUserStore } from '/@/store/modules/user';
import { EventDataNode } from 'ant-design-vue/lib/tree';
import { ContextMenuItem } from '/@/components/TigerTree';
import { UpdateWoStatus } from '/@/api/tigerapi/mes/wo';
import { AddOrEditLabelVarByWorkOrder, UpdateWoStatus } from '/@/api/tigerapi/mes/wo';
import { useForm } from '/@/components/Form';
import { BAS_LABEL_VAR_WO } from '/@/api/tigerapi/model/mesModel';
import { buildUUID } from '/@/utils/uuid';
import { mesApi } from '/@/api/tigerapi/mes/mesApi';
const { t } = useI18n();
const { createErrorModal } = useMessage();
@@ -110,6 +113,19 @@
      return data;
    },
    /**
     * @description: æ“ä½œå­—段自定义按钮,必需要有的方法
     * @return {*}
     */
    ActionItem: (params: Recordable<any>, data, ...args): ActionItem[] => {
      data.push({
        icon: 'template|svg',
        tooltip: '模板维护',
        onClick: handleTemplate.bind(null, args, params),
        name: '模板维护',
      });
      return data;
    },
    /**
     * @description: èŽ·å–é…ç½®é¡¹è¡¨å•å­—æ®µï¼Œæ ¹æ®æ ‘å½¢èŠ‚ç‚¹type不同而不同
     * @param {string} type
     * @return {*}
@@ -134,7 +150,15 @@
     * @return {*}
     */
    GetCrudColSlots: () => {
      return ['scanadd', 'assyadd', 'testadd', 'auditadd', 'printadd', 'pkgadd'];
      return [
        { name: 'scanadd', icon: 'search|svg' },
        { name: 'assyadd', icon: 'search|svg' },
        { name: 'testadd', icon: 'search|svg' },
        { name: 'auditadd', icon: 'search|svg' },
        { name: 'printadd', icon: 'search|svg' },
        { name: 'pkgadd', icon: 'search|svg' },
        { name: 'labeladd', icon: 'template|svg' },
      ];
    },
    /**
     * @description: èŽ·å–è¡¨æ ¼use列表
@@ -366,6 +390,9 @@
     */
    OpenSelectItem: (openItemModal: Fn, ...args) => {
      let config = {};
      const openCrudModal = args[1];
      const record = args[2];
      const OrderNo = args[3];
      switch (args[0]) {
        case 'scanadd':
          config = ruleModalCfg;
@@ -383,7 +410,35 @@
          config = pkgModalCfg;
          break;
      }
      openItemModal(true, config);
      if (args[0] == 'labeladd') {
        openCrudModal(true, {
          isUpdate: true, //是否更新操作
          entityName: 'WoRouteBinding', //是哪个页面
          ctype: 'BAS_LABEL_VAR_WO', //实体名称
          title: '模板维护', //标题
          width: '1024px', //弹出框宽度
          ItemColumns: TemplateBasColumn, //弹出框中表格字段结构
          schemas: [], //查询条件字段结构
          others: { WORK_ORDER: OrderNo }, //需要带到弹出窗口中的数据
          searchInfo: {
            TABLE_NAME: 'BAS_LABEL_VAR_WO', //实体名称
            LabelId: record.LABEL_CODE, //模板ID
            WorkOrder: OrderNo, //工单号
            apiUrl: mesApi.GetLabelVarByWorkOrder, //自定义获取数据分页的api,不用默认的基础方法
            // sqlcmd: ` (WORK_ORDER = '${OrderNo}' OR WORK_ORDER = '' OR WORK_ORDER IS NULL)`,
            // option:
            // {
            //   //根据据点查询,必需带这个参数
            //   UserId: useUserStore().getUserInfo.userId,
            //   ByOrg: true,
            //   CurOrg: useUserStore().getUserInfo.orgCode,
            // },
          },
          values: record, //表单记录
        });
      } else {
        openItemModal(true, config);
      }
    },
    /**
     * @description: å¼¹å‡ºé€‰æ‹©æ¡†é€‰æ‹©æˆåŠŸè¿”å›ž
@@ -432,6 +487,8 @@
            isShow: { BAS_PKG_DTL: false, ItemCode: false },
          };
          break;
        case 'labeladd':
          break;
        case 'pkgadd':
          const ents = await getEntity({
            sqlcmd: `RULE_CODE ='${d.values['val']}'`,
@@ -461,6 +518,7 @@
            WorkOrder: args[1]['CODE'],
            Status: -1,
            RouteStatus: 1,
            WoBatch: '',
          }).then((action) => {
            if (action.IsSuccessed) {
              SP_MES_PROD2WO({ rotId: d.values.id, wo: args[1]['CODE'] }).then((action) => {
@@ -472,6 +530,7 @@
                    WorkOrder: args[1]['CODE'],
                    Status: -1,
                    RouteStatus: 0,
                    WoBatch: '',
                  });
                  createErrorModal({
                    title: t('sys.api.errorTip'),
@@ -516,6 +575,25 @@
        testadd: useModal(),
        auditadd: useModal(),
        printadd: useModal(),
        labeladd: useModal(),
        pkgadd: useModal(),
      };
    },
    /**
     * @description: èŽ·å–æ¨¡æ€æ¡†åº”ç”¨åˆ—è¡¨
     * @return {*}
     */
    GetUseCrudModals: () => {
      return {
        addRoute: useModal(),
        addCustomer: useModal(),
        editRoute: useModal(),
        scanadd: useModal(),
        assyadd: useModal(),
        testadd: useModal(),
        auditadd: useModal(),
        printadd: useModal(),
        labeladd: useModal(),
        pkgadd: useModal(),
      };
    },
@@ -659,7 +737,13 @@
          SP_MES_WO2CUST({ wo: args[2][0]['wo'] });
          break;
        case 'editRoute':
          args[1](true, { rotId: args[2][0].wo, slotName: '', rotType: 'Wo', prodCode:args[3],custCode:args[2][0].cust });
          args[1](true, {
            rotId: args[2][0].wo,
            slotName: '',
            rotType: 'Wo',
            prodCode: args[3],
            custCode: args[2][0].cust,
          });
          break;
      }
    },
@@ -715,35 +799,47 @@
     * @return {*}
     */
    CustFunc: async (param: CustModalParams) => {
      switch (param['ctype']) {
        case 'BAS_PKG_DTL':
          // const ents = await getEntity({
          //   sqlcmd: `PKG_RULE_ID ='${param.values['PKG_RULE_ID']}'`,
          //   entityName: 'V_BAS_PKG_DTL',
          //   order: '',
          // });
          // param.data.value['Table'] = ents.Data.Items;
          param.data.value['BAS_PKG_DTL'].map((x) => {
            if (x.PKG_CODE == param.values['PKG_CODE']) {
              x.LABEL_CODE = param.values['LABEL_CODE'];
            }
          });
          param.data.value['Action'][0]['OPTION_1'] = JSON.stringify(
            param.data.value['BAS_PKG_DTL'],
          );
          break;
        case 'ItemCode':
          param.data.value['ItemCode'].map((x) => {
            if (x.ITEM_CODE == param.values['ITEM_CODE']) {
              x.IsBatchItem = param.values['IsBatchItem'];
              x.RULE_CODE = param.values['RULE_CODE'];
            }
          });
          param.data.value['Action'][0]['OPTION_1'] = JSON.stringify(
            param.data.value['ItemCode'],
          );
          break;
      }
      return new Promise<any>(async (resolve, reject) => {
        try {
          switch (param['ctype']) {
            case 'BAS_PKG_DTL':
              // const ents = await getEntity({
              //   sqlcmd: `PKG_RULE_ID ='${param.values['PKG_RULE_ID']}'`,
              //   entityName: 'V_BAS_PKG_DTL',
              //   order: '',
              // });
              // param.data.value['Table'] = ents.Data.Items;
              param.data.value['BAS_PKG_DTL'].map((x) => {
                if (x.PKG_CODE == param.values['PKG_CODE']) {
                  x.LABEL_CODE = param.values['LABEL_CODE'];
                  x.LABEL_ID =  param.values['LABEL_CODE'];
                }
              });
              param.data.value['Action'][0]['OPTION_1'] = JSON.stringify(
                param.data.value['BAS_PKG_DTL'],
              );
              break;
            case 'ItemCode':
              param.data.value['ItemCode'].map((x) => {
                if (x.ITEM_CODE == param.values['ITEM_CODE']) {
                  x.IsBatchItem = param.values['IsBatchItem'];
                  x.RULE_CODE = param.values['RULE_CODE'];
                }
              });
              param.data.value['Action'][0]['OPTION_1'] = JSON.stringify(
                param.data.value['ItemCode'],
              );
              break;
            case 'BAS_LABEL_VAR_WO':
              param.values['WORK_ORDER'] = param.others['WORK_ORDER'];
              param.values['ID'] = buildUUID();
              await AddOrEditLabelVarByWorkOrder(param.values as unknown as BAS_LABEL_VAR_WO);
          }
          resolve('OK');
        } catch (e) {
          reject(e);
        }
      });
    },
    /**
     * @description: èŽ·å–å³é”®èœå•åˆ—è¡¨
@@ -857,6 +953,12 @@
            //   };
            // },
          },
          {
            dataIndex: 'LABEL_ID',
            title: '标签模板ID',
            ifShow: false,
            customRender: () => {},
          },
        ] as BasicColumn[];
        break;
      case 'ItemCode':
@@ -933,6 +1035,7 @@
    }
    return columns;
  }
  /**
   * @description: å¼¹å‡ºé€‰æ‹©æ¡†-物料选择框配置
   * @return {*}
@@ -1187,7 +1290,7 @@
      label: '1',
      defaultValue: '',
      component: 'Input',
      colProps: { span: 1, pull: 1 },
      colProps: { span: 1, pull: window.screen.width == 1366 ? -1 : 1 },
      ifShow: ({ values }) => isScan(values.ACT_TYPE),
      colSlot: 'scanadd',
    },
@@ -1203,7 +1306,7 @@
      label: '1',
      defaultValue: '',
      component: 'Input',
      colProps: { span: 1, pull: 1 },
      colProps: { span: 1, pull: window.screen.width == 1366 ? -1 : 1 },
      ifShow: ({ values }) => isAssy(values.ACT_TYPE),
      colSlot: 'assyadd',
    },
@@ -1219,7 +1322,7 @@
      label: '1',
      defaultValue: '',
      component: 'Input',
      colProps: { span: 1, pull: 1 },
      colProps: { span: 1, pull: window.screen.width == 1366 ? -1 : 1 },
      ifShow: ({ values }) => isTest(values.ACT_TYPE),
      colSlot: 'testadd',
    },
@@ -1235,14 +1338,14 @@
      label: '1',
      defaultValue: '',
      component: 'Input',
      colProps: { span: 1, pull: 1 },
      colProps: { span: 1, pull: window.screen.width == 1366 ? -1 : 1 },
      ifShow: ({ values }) => isAudit(values.ACT_TYPE),
      colSlot: 'auditadd',
    },
    {
      field: 'LABEL_CODE',
      label: '标签打印',
      colProps: { span: 11 },
      colProps: { span: 9 },
      component: 'Input',
      ifShow: ({ values }) => isPrint(values.ACT_TYPE),
    },
@@ -1251,9 +1354,18 @@
      label: '1',
      defaultValue: '',
      component: 'Input',
      colProps: { span: 1, pull: 1 },
      colProps: { span: 2 }, //{ span: 2, pull: window.screen.width == 1366 ? -1 : 1 },
      ifShow: ({ values }) => isPrint(values.ACT_TYPE),
      colSlot: 'printadd',
    },
    {
      field: 'print1',
      label: '1',
      defaultValue: '',
      component: 'Input',
      colProps: { span: 1, pull: window.screen.width == 1366 ? -1 : 1 },
      ifShow: ({ values }) => isPrint(values.ACT_TYPE),
      colSlot: 'labeladd',
    },
    {
      field: 'PKG_CODE',
@@ -1267,7 +1379,7 @@
      label: '1',
      defaultValue: '',
      component: 'Input',
      colProps: { span: 1, pull: 1 },
      colProps: { span: 1, pull: window.screen.width == 1366 ? -1 : 1 },
      ifShow: ({ values }) => isPackage(values.ACT_TYPE),
      colSlot: 'pkgadd',
    },
@@ -1666,6 +1778,77 @@
    ] as FormSchema[],
  };
  /**
   * @description: æ¨¡æ¿ç»´æŠ¤
   * @param {*} args
   * @param {Recordable} params
   * @return {*}
   */
  function handleTemplate(args, params: Recordable) {
    const openCrudModal = args[0];
    const OrderNo = args[2];
    openCrudModal(true, {
      isUpdate: true, //是否更新操作
      entityName: 'WoRouteBinding', //是哪个页面
      ctype: 'BAS_LABEL_VAR_WO', //实体名称
      title: '模板维护', //标题
      width: '1024px', //弹出框宽度
      ItemColumns: TemplateBasColumn, //弹出框中表格字段结构
      schemas: [], //查询条件字段结构
      others: { WORK_ORDER: OrderNo }, //需要带到弹出窗口中的数据
      searchInfo: {
        TABLE_NAME: 'BAS_LABEL_VAR_WO', //实体名称
        LabelId: params['record'].LABEL_ID, //模板ID
        WorkOrder: OrderNo, //工单号
        apiUrl: mesApi.GetLabelVarByWorkOrder, //自定义获取数据分页的api,不用默认的基础方法
        // sqlcmd: ` (WORK_ORDER = '${OrderNo}' OR WORK_ORDER = '' OR WORK_ORDER IS NULL)`,
        // option:
        // {
        //   //根据据点查询,必需带这个参数
        //   UserId: useUserStore().getUserInfo.userId,
        //   ByOrg: true,
        //   CurOrg: useUserStore().getUserInfo.orgCode,
        // },
      },
      values: params['record'], //表单记录
    });
  }
  /* ä¸‹å‘界面中的表单列表 */
  const TemplateBasColumn = [
    {
      dataIndex: 'LABEL_ID',
      title: '标签模板ID',
      ifShow: false,
      sorter: true,
      resizable: true,
    },
    {
      title: '工单号',
      dataIndex: 'WORK_ORDER',
      width: 280,
      editRow: true,
      // editable: true,
      ifShow: false,
    },
    {
      title: '变量名',
      dataIndex: 'VAR_NAME',
    },
    {
      title: '变量值',
      dataIndex: 'VAR_VALUE',
      editRow: true,
      editRule: true,
    },
    {
      title: '默认值',
      dataIndex: 'DEFAULT_VALUE',
      editRow: true,
      editRule: true,
    },
  ] as BasicColumn[];
  return [methods];
}
src/views/tigerprojects/system/lowcode/high/edit/editdtl.vue
@@ -212,9 +212,7 @@
    }
  }
  const imgList = [
    'http://localhost:8800/files/Template/10位批次条码.png',
  ];
  const imgList = ['http://localhost:8800/files/Template/10位批次条码.png'];
  function openImg() {
    const onImgLoad = ({ index, url, dom }) => {
      console.log(`第${index + 1}张图片已加载,URL为:${url}`, dom);
src/views/tigerprojects/system/lowcode/normal/mainTable.vue
@@ -2,7 +2,7 @@
  <div>
    <BasicTable @register="registerTable">
      <template #toolbar>
      <!-- æ ¹æ®èœå•设置的按钮,自动生成 -->
        <!-- æ ¹æ®èœå•设置的按钮,自动生成 -->
        <a-button
          type="primary"
          v-for="item in buttons.filter((m) => m['BUTTON_TYPE'] == 0)"
@@ -112,6 +112,7 @@
  const [registerDrawer, { openDrawer }] = useDrawer();
  const [registerRv, { openModal: openRvModal, closeModal: RvcloseModal }] = useModal();
  const [registerCust, { openModal: openCustModal }] = useModal();
  const [registerCrud, { openModal: openCrudModal }] = useModal();
  const cType = ref('');
  const formSchemas = ref({}); //弹出框多表单结构
  const routeData = ref({
@@ -282,6 +283,7 @@
      go,
      setProps,
      openCustModal,
      openCrudModal,
    );
  }
@@ -318,7 +320,7 @@
      const [{ CreateAction }] = custImport.value['default']();
      const result = CreateAction(entityName.value, colSlots.value);
      switch (result.action) {
        case 'go': /* è·³è½¬é¡µé¢ */
        case 'go' /* è·³è½¬é¡µé¢ */:
          // å°†å¯¹è±¡è½¬æ¢ä¸ºJSON字符串并保存到sessionStorage
          sessionStorage.setItem(
            `${result.params.Name}_params`,
@@ -328,7 +330,7 @@
            `/${result.url}/${encodeURI(JSON.stringify({ sName: result.params.Name, Name: result.params.Name }))}`,
          );
          break;
        case 'drawer': /* æ‰“开侧边框 */
        case 'drawer' /* æ‰“开侧边框 */:
          openDrawer(true, {
            isUpdate: false, //是新增还是编辑,false-新增|true-编辑
            entityName: entityName.value, //实体类名