Ben Lin
2024-07-01 f60c5156615626515bd6d84f151a1292b8b936c1
班制更新
已修改2个文件
已添加2个文件
629 ■■■■■ 文件已修改
src/components/FlowChart/src/FlowChartView.vue 79 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/tigerprojects/system/lowcode/entityts/MES_SHIFT.ts 416 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/tigerprojects/system/lowcode/entityts/MES_SHIFT_SYS.ts 132 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/tigerprojects/system/lowcode/high/dtl.vue 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/components/FlowChart/src/FlowChartView.vue
@@ -1,13 +1,12 @@
<template>
  <div class="h-full" :class="prefixCls">
    <div ref="lfElRef" class="h-full"></div>
    <div ref="lfElVRef" class="h-full"></div>
  </div>
</template>
<script lang="ts" setup>
  import type { Ref } from 'vue';
  import type { Definition } from '@logicflow/core';
  import { ref, onMounted, unref, nextTick, computed, watch } from 'vue';
  import FlowChartToolbar from './FlowChartToolbar.vue';
  import LogicFlow from '@logicflow/core';
  import { Snapshot, BpmnElement, Menu, DndPanel, SelectionSelect } from '@logicflow/extension';
  import { useDesign } from '@/hooks/web/useDesign';
@@ -15,14 +14,10 @@
  import { createFlowChartContext } from './useFlowContext';
  import { toLogicFlowData } from './adpterForTurbo';
  import { useModal, BasicModal } from '@/components/Modal';
  import { JsonPreview } from '@/components/CodeEditor';
  import { configDefaultDndPanel } from './config';
  import '@logicflow/core/dist/style/index.css';
  import '@logicflow/extension/lib/style/index.css';
  import { useGlobSetting } from '/@/hooks/setting';
  import customEdge from './customEdge';
  import { useMessage } from '/@/hooks/web/useMessage';
  import { useI18n } from '/@/hooks/web/useI18n';
  import actionRect from './actionRect';
  import TestNode from './TestNode';
  import CollectNode from './CollectNode';
@@ -62,7 +57,7 @@
    'undo',
    'redo',
  ]);
  const lfElRef = ref(null);
  const lfElVRef = ref(null);
  const graphData = ref({});
  const lfInstance = ref(null) as Ref<LogicFlow | null>;
@@ -117,7 +112,7 @@
  async function init() {
    await nextTick();
    const lfEl = unref(lfElRef);
    const lfEl = unref(lfElVRef);
    if (!lfEl) {
      return;
    }
@@ -152,7 +147,7 @@
    lf.register(RepairNode);
    lf.register(customEdge);
    onRender();
    lf?.setPatternItems(props.patternItems || configDefaultDndPanel(lf));
    // lf?.setPatternItems(props.patternItems || configDefaultDndPanel(lf));
  }
  async function onRender() {
@@ -161,42 +156,42 @@
    if (!lf) {
      return;
    }
    const lFData = toLogicFlowData(props.data);
    lf.render(lFData);
    // const lFData = toLogicFlowData(props.data);
    lf.render(props.data);
    lf.on('anchor:drop', (data) => {
      const nodeData = data.nodeModel.getData();
      if (nodeData.properties.isReturn === true) {
        console.log(11, nodeData.properties.isReturn);
        data.nodeModel.graphModel.edges.forEach((element) => {
          if (element.sourceNodeId === data.nodeModel.id) {
            lf.changeEdgeType(element.id, 'custom-edge');
          }
        });
      }
    });
    lf.on('node:click,edge:click', (data) => {
      if (data.isSelected) {
        console.log(data.data.text.value, data.isSelected);
        // notification.success({
        //   message: t('点击了节点'),
        //   description: `${data.data.text.value}: ${data.isSelected}`,
        //   duration: 3,
        // });
        emit('select-node', data, lf);
      } else {
        console.log(data.data.type);
      }
    });
    // lf.on('anchor:drop', (data) => {
    //   const nodeData = data.nodeModel.getData();
    //   if (nodeData.properties.isReturn === true) {
    //     console.log(11, nodeData.properties.isReturn);
    //     data.nodeModel.graphModel.edges.forEach((element) => {
    //       if (element.sourceNodeId === data.nodeModel.id) {
    //         lf.changeEdgeType(element.id, 'custom-edge');
    //       }
    //     });
    //   }
    // });
    // lf.on('node:click,edge:click', (data) => {
    //   if (data.isSelected) {
    //     console.log(data.data.text.value, data.isSelected);
    //     // notification.success({
    //     //   message: t('点击了节点'),
    //     //   description: `${data.data.text.value}: ${data.isSelected}`,
    //     //   duration: 3,
    //     // });
    //     emit('select-node', data, lf);
    //   } else {
    //     console.log(data.data.type);
    //   }
    // });
    lf.on('blank:mousedown', (e) => {
      emit('click-blank');
    });
    // lf.on('blank:mousedown', (e) => {
    //   emit('click-blank');
    // });
    lf.on('node:dnd-add', (data, e) => {
      console.log('node:dnd-add', data);
      emit('select-node', data, lf);
    });
    // lf.on('node:dnd-add', (data, e) => {
    //   console.log('node:dnd-add', data);
    //   emit('select-node', data, lf);
    // });
    emit('init', lf);
  }
src/views/tigerprojects/system/lowcode/entityts/MES_SHIFT.ts
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,416 @@
/*
 * @Description: ç­æ¬¡ç›¸å…³
 * @Author: Ben Lin
 * @version:
 * @Date: 2024-06-19 20:34:27
 * @LastEditors: Ben Lin
 * @LastEditTime: 2024-07-01 12:33:25
 */
import { Ref, h, unref } from 'vue';
import { DeleteEntity, GetEnum, getEntity } from '/@/api/tigerapi/system';
import { ActionItem, BasicColumn } from '/@/components/Table';
import { isNullOrEmpty, isNullOrUnDef } from '/@/utils/is';
import { buildUUID } from '/@/utils/uuid';
import { useUserStore } from '/@/store/modules/user';
import { formatToDateTime } from '/@/utils/dateUtil';
import { Tag } from 'ant-design-vue';
import { useLocale } from '/@/locales/useLocale';
const { getLocale } = useLocale();
function _default() {
  const ActionColumn: BasicColumn = {
    width: 80,
    title: '操作',
    dataIndex: 'action',
    slots: { customRender: 'action' },
    fixed: undefined,
  };
  /**
   * @description: äº›è‡ªå®šä¹‰æ–¹æ³•
   * @return {*}
   */
  const methods = {
    /**
     * @description: èŽ·å–æ–°å¢žæŒ‰é’®çš„è¡Œä¸º
     * @return {*}
     */
    CreateAction: (fnName: string) => {
      return {
        action: 'drawer', //drawer(打开左侧抽屉框) | go(跳转到新的页面)
      };
    },
    /**
     * @description: æ“ä½œå­—段自定义按钮
     * @return {*}
     */
    ActionItem: (params: Recordable<any>, data, ...args): ActionItem[] => {
      if (!isNullOrUnDef(data[1])) {
        data[1].popConfirm.confirm = Del.bind(null, args, params);
      }
      return data;
    },
    /**
     * @description: é«˜çº§è¡¨å•和详情页面返回主页面的url
     * @return {*}
     */
    GetHomeUrl: () => {
      const param = { ID: 'MES_SHIFT_SYS', colSlots: [], crudColSlots: [] };
      return `/MES_SHIFT_SYS/LC/${encodeURI(JSON.stringify(param))}`;
    },
    GetBaseColumns: () => {
      return [
        {
          title: '班次编码',
          dataIndex: 'SFT_CODE',
          // ifShow: false,
          width: 180,
        },
        {
          title: '班次名称',
          dataIndex: 'SFT_NAME',
        },
        {
          title: '班制编码',
          dataIndex: 'SFTS_CODE',
        },
        {
          title: '班次开始时间',
          dataIndex: 'SFT_BEGIN',
        },
        {
          title: '班次结束时间',
          dataIndex: 'SFT_END',
        },
        {
          title: '是否跨天',
          dataIndex: 'IS_ACROSS_DAY',
          customRender: ({ record }) => {
            const type = record.IS_ACROSS_DAY;
            var text = '';
            var color = 'green';
            switch (type) {
              case 'Y':
                text = '是';
                break;
              case 'N':
                color = 'blue';
                text = '否';
                break;
            }
            return h(Tag, { color: color }, () => text);
          },
        },
        {
          title: '备注',
          dataIndex: 'REMARK',
        },
        {
          title: '更新时间',
          dataIndex: 'UPDATE_TIME',
        },
        {
          title: '更新人',
          dataIndex: 'UPDATE_USER',
        },
      ];
    },
    GetSearchForm: () => {
      return [
        {
          field: 'SFT_CODE',
          label: '班次编码',
          component: 'Input',
          colProps: {
            span: 8,
          },
        },
        {
          label: '班次名称',
          field: 'SFT_NAME',
          component: 'Input',
          colProps: {
            span: 8,
          },
        },
      ];
    },
    GetCrudForm: () => {
      return [
        {
          field: 'SFT_CODE',
          label: '班次编码',
          component: 'Input',
          required: true,
          colProps: {
            span: 24,
          },
        },
        {
          label: '班次名称',
          field: 'SFT_NAME',
          component: 'Input',
          required: true,
          colProps: {
            span: 24,
          },
        },
        {
          label: '班制编码',
          field: 'SFTS_CODE',
          component: 'ApiSelect',
          colProps: {
            span: 24,
          },
          componentProps: {
            api: getEntity,
            params: { entityName: 'MES_SHIFT_SYS', sqlcmd: ' 1=1 ' },
            resultField: 'Data.Items',
            labelField: 'SFTS_NAME',
            valueField: 'SFTS_CODE',
          },
          dynamicDisabled: ({ values }) => {
            return true;
          },
        },
        {
          label: '班次开始时间',
          field: 'SFT_BEGIN',
          component: 'Input',
          colProps: {
            span: 24,
          },
        },
        {
          label: '班次结束时间',
          field: 'SFT_END',
          component: 'Input',
          colProps: {
            span: 24,
          },
        },
        {
          label: '是否跨天',
          field: 'IS_ACROSS_DAY',
          component: 'Select',
          required: true,
          colProps: {
            span: 24,
          },
          componentProps: {
            options: [
              {
                label: '是',
                value: 'Y',
                key: 'Y',
              },
              {
                label: '否',
                value: 'N',
                key: 'N',
              },
            ],
          },
        },
        // {
        //   field: 'LOGIN_TIME',
        //   label: '登录时间',
        //   defaultValue: '',
        //   component: 'RangePicker',
        //   ifShow: true,
        //   colProps: { span: 8 },
        // },
        {
          label: '备注',
          field: 'REMARK',
          component: 'Input',
          colProps: {
            span: 24,
          },
        },
        {
          label: 'ID',
          field: 'ID',
          component: 'Input',
          colProps: {
            span: 24,
          },
          show: false,
        },
      ];
    },
    /**
     * @description: èŽ·å–ä¸»ä¿¡æ¯
     * @return {*}
     */
    GetBaseForm: () => {
      return [
        {
          field: 'SFTS_CODE',
          label: '班制编码',
          component: 'Input',
          required: true,
          colProps: {
            span: 8,
          },
        },
        {
          label: '班制名称',
          field: 'SFTS_NAME',
          required: true,
          component: 'Input',
          colProps: {
            span: 8,
          },
        },
        {
          label: '是否启用',
          field: 'IS_ACTIVE',
          required: true,
          component: 'Select',
          colProps: {
            span: 8,
          },
          componentProps: {
            options: [
              {
                label: '启用',
                value: 'Y',
                key: 'Y',
              },
              {
                label: '禁用',
                value: 'N',
                key: 'N',
              },
            ],
          },
        },
        {
          label: '备注',
          field: 'REMARK',
          component: 'Input',
          colProps: {
            span: 8,
          },
        },
        {
          label: 'ID',
          field: 'ID',
          component: 'Input',
          colProps: {
            span: 8,
          },
          show: false,
        },
      ];
    },
    /**
     * @description: èŽ·å–å¡ç‰‡å†…é…ç½®åˆ—è¡¨ï¼Œä»¥å¾ªçŽ¯æ˜¾ç¤ºå¤šä¸ªå¡ç‰‡å¹¶é…ç½®å¤šä¸ªæ’æ§½
     * @return {*}
     */
    GetBaseCards: (type: string) => {
      return [
        {
          name: 'BaseForm',
          slots: [],
          preIcons: {},
          title: '班制信息',
          entityName: 'MES_SHIFT_SYS',
        },
        // {
        //   name: 'prodinfo',
        //   slots: ['addRot', 'setRot'],
        //   preIcons: { addRot: 'search|svg', setRot: 'config|svg' },
        //   title: '产品信息',
        // },
        // { name: 'rotinfo', slots: ['add'], preIcons: { add: 'search|svg' }, title: '工艺信息' },
      ];
    },
    OthersValues: (val: string, id: string) => {
      return { SFTS_CODE: val };
    } /**
     * @description: è‡ªå®šä¹‰æ˜Žç»†è¡¨ä¸­ç¼–辑返回方法
     * @param {string} type
     * @param {*} d
     * @param {*} u
     * @return {*}
     */,
    EditOperation: (data: Ref<any[]>, d, u) => {
      if (u.isUpdate) {
        //更新
        var _data = data.value.map((item) => {
          if (item['ID'] == d.ID)
            return {
              ...item,
              SFT_CODE: d.SFT_CODE,
              SFT_NAME: d.SFT_NAME,
              SFT_BEGIN: d.SFT_BEGIN,
              SFT_END: d.SFT_END,
              IS_ACROSS_DAY: d.IS_ACROSS_DAY,
              REMARK: d.REMARK,
            };
          return item;
        });
        data.value = _data;
      } else {
        //新增
        d.ID = buildUUID();
        d.CREATE_USER = useUserStore().getUserInfo.userId as string;
        d.UPDATE_TIME = formatToDateTime(new Date());
        d.UPDATE_USER = useUserStore().getUserInfo.userId as string;
        var _data2: any[] = [];
        if (!isNullOrEmpty(data.value)) {
          _data2 = data.value.map((item) => {
            return item;
          });
        }
        _data2.push(d);
        data.value = _data2;
      }
    },
    /**
     * @description: èŽ·å–æ ‡é¢˜ä¿¡æ¯
     * @param {string} type
     * @return {*}
     */
    GetTitle: () => {
      return {
        pageTitle: '班制管理',
        pageContent: '这里可以添加和修改班制和班次及时段。',
        baseTableTitle: '班次管理',
      };
    },
  };
  /**
   * @description: è‡ªå®šä¹‰åˆ é™¤æ–¹æ³•
   * @param {Fn} args
   * @param {*} params
   * @return {*}
   */
  function Del(args: Fn[], params: {}) {
    if (!isNullOrEmpty(params['data'])) {
      var _data = params['data'].value.filter((item) => item['ID'] != params['record']['ID']);
      params['data'].value = _data;
      args[6]({
        dataSource: [],
      });
      args[6]({
        dataSource: params['data'],
      });
      args[1]();
    } else {
      DeleteEntity(params['record'], params['entityName']).then((action) => {
        if (action.IsSuccessed) {
          args[1]();
        }
      });
    }
  }
  return [methods, ActionColumn];
}
export default _default;
src/views/tigerprojects/system/lowcode/entityts/MES_SHIFT_SYS.ts
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,132 @@
/*
 * @Description: ç­åˆ¶ç›¸å…³
 * @Author: Ben Lin
 * @version:
 * @Date: 2024-06-19 20:34:27
 * @LastEditors: Ben Lin
 * @LastEditTime: 2024-07-01 12:17:23
 */
import { ActionItem, BasicColumn } from '/@/components/Table';
import { buildUUID } from '/@/utils/uuid';
import { useI18n } from '/@/hooks/web/useI18n';
import { isNullOrUnDef } from '/@/utils/is';
const { t } = useI18n();
function _default() {
  const ActionColumn: BasicColumn = {
    width: 100,
    title: '操作',
    dataIndex: 'action',
    slots: { customRender: 'action' },
    fixed: 'right',
  };
 /**
   * @description: ä¸€äº›è‡ªå®šä¹‰æ–¹æ³•
   * @return {*}
   */
  const methods = {
    /**
     * @description: èŽ·å–æ–°å¢žæŒ‰é’®çš„è¡Œä¸º
     * @return {*}
     */
    CreateAction: (fnName: string) => {
      return {
        action: 'go', //drawer(打开左侧抽屉框) | go(跳转到新的页面)
        url: 'MES_SHIFT/High',
        params: {
          CODE: '0',
          ID: buildUUID(),
          Name: 'MES_SHIFT',
          Title: '新增班制',
          pCode: 'SFTS_CODE',
          IsID: false,
        },
      };
    },
    /**
     * @description: æ“ä½œå­—段自定义按钮
     * @return {*}
     */
    ActionItem: (params: Recordable<any>, data, ...args): ActionItem[] => {
      if (!isNullOrUnDef(data[0])) {
        data[0].onClick = Edit.bind(null, args, params);
      }
      return data;
    },
    /**
     * @description: å¼¹å‡ºé€‰æ‹©æ¡†æˆåŠŸè¿”å›žæ–¹æ³•
     * @param {*} d
     * @param {*} u
     * @return {*}
     */
    GetSelectSuccess: (d, u) => {
      return {
        ITEM_CODE: d.values['val'],
      };
    },
    /**
     * @description: å¼¹å‡ºé€‰æ‹©æ¡†æ‰“开方法
     * @param {Fn} openItemModal
     * @return {*}
     */
    OpenSelectItem: (openItemModal: Fn, ...args) => {
      openItemModal(true, {
        title: '物料列表',
        schemas: [
          {
            field: 'ITEM_CODE',
            component: 'Input',
            label: '物料编码',
            colProps: {
              span: 12,
            },
          },
        ],
        ItemColumns: [
          {
            title: t('物料编码'),
            dataIndex: 'ITEM_CODE',
            resizable: true,
            sorter: true,
            width: 200,
          },
          {
            title: t('物料名称'),
            dataIndex: 'ITEM_NAME',
            resizable: true,
            sorter: true,
            width: 180,
          },
        ],
        tableName: 'BAS_ITEM',
        rowKey: 'ITEM_CODE',
        searchInfo: { TABLE_NAME: 'BAS_ITEM' },
      });
    },
  };
  /* ä»¥ä¸‹æ˜¯å†…部方法,不export,供上面的方法调用 */
  /**
   * @description: è‡ªå®šä¹‰ç¼–辑方法
   * @param {Fn} args
   * @param {*} params
   * @return {*}
   */
  function Edit(args: Fn[], params: {}) {
    const param = {
      CODE: params['record']['SFTS_CODE'],
      ID: params['record']['ID'],
      Name: 'MES_SHIFT',
      Title: `编辑班制:${params['record']['SFTS_CODE']}`,
      pCode: 'SFTS_CODE',
      IsID: false,
    };
    args[5](`/MES_SHIFT/High/${encodeURI(JSON.stringify(param))}`);
  }
  return [methods, ActionColumn];
}
export default _default;
src/views/tigerprojects/system/lowcode/high/dtl.vue
@@ -81,7 +81,7 @@
      title: '操作',
      dataIndex: 'action',
      slots: { customRender: 'action' },
      fixed: undefined,
      fixed: 'right',
    }, //自定义操作列
  });
  // watch(