| | |
| | | * @version: |
| | | * @Date: 2024-05-25 00:27:00 |
| | | * @LastEditors: Ben Lin |
| | | * @LastEditTime: 2024-06-28 11:40:38 |
| | | * @LastEditTime: 2024-07-03 20:51:05 |
| | | --> |
| | | <template> |
| | | <div> |
| | |
| | | </template> |
| | | </BasicForm> |
| | | <!-- 自定义内容 --> |
| | | <div style="height: 200px" id="lfContainer" v-if="isCustEl[item.name]"></div> |
| | | <!-- <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> |
| | | <RouteViewModal @register="registerRv" @success="RvItemSuccess" /> |
| | |
| | | import WoModal from './WoModal.vue'; |
| | | import GeneralModal from '/@/views/components/GeneralModal.vue'; |
| | | import RouteViewModal from '/@/views/components/RouteViewModal.vue'; |
| | | import { FlowChartView } from '/@/components/FlowChart'; |
| | | import CustModal from '/@/views/components/CustModal.vue'; |
| | | import { useDrawer } from '/@/components/Drawer'; |
| | | import { columns, searchFormSchema } from './biz_mes_wo.data'; |
| | |
| | | import { SaveEntity, getListByPage } from '/@/api/tigerapi/system'; |
| | | import { GetSelectSuccess, OpenSelectItem, getFormSchema } from '/@/views/components/data'; |
| | | import LogicFlow from '@logicflow/core'; |
| | | import { getRouteData } from '/@/api/tigerapi/mes/router'; |
| | | import actionRect from '/@/components/FlowChart/src/actionRect'; |
| | | import TestNode from '/@/components/FlowChart/src/TestNode'; |
| | | import CollectNode from '/@/components/FlowChart/src/CollectNode'; |
| | | import AssemblyNode from '/@/components/FlowChart/src/AssemblyNode'; |
| | | import PackingNode from '/@/components/FlowChart/src/PackingNode'; |
| | | import RepairNode from '/@/components/FlowChart/src/RepairNode'; |
| | | import customEdge from '/@/components/FlowChart/src/customEdge'; |
| | | import { BpmnElement } from '@logicflow/extension'; |
| | | import { initRoute } from '../../../system/lowcode/data'; |
| | | |
| | | const { t } = useI18n(); |
| | | const ASteps = Steps; |
| | |
| | | tip: '加载中...', |
| | | }); |
| | | const lfInstance = ref(null) as Ref<LogicFlow | null>; |
| | | const [registerRv, { openModal: openRvModal }] = useModal(); |
| | | const [registerRv, { openModal: openRvModal, closeModal }] = useModal(); |
| | | const [registerWo, { openModal: openWoModal }] = useModal(); |
| | | const [registerItemAdd, { openModal: openItemModal }] = useModal(); |
| | | const [registerCust, { openModal: openCustModal, closeModal }] = useModal(); |
| | | const [registerCust, { openModal: openCustModal }] = useModal(); |
| | | const [registerTable, { getForm, reload }] = useTable({ |
| | | title: '工单信息', |
| | | api: getListByPage, |
| | |
| | | |
| | | onMounted(async () => {}); |
| | | |
| | | const currlf = ref(null) as Ref<LogicFlow | null>; |
| | | /** |
| | | * @description: 工艺路线初始化 |
| | | * @param {*} lf |
| | | * @return {*} |
| | | */ |
| | | async function init(lf, rotId) { |
| | | initRoute(lf, rotId, routeData, currlf); |
| | | } |
| | | |
| | | //新增 |
| | | function addWo() { |
| | | openDrawer(true, { |
| | |
| | | { name: 'rotinfo', slots: ['add'], preIcons: { add: 'search|svg' }, title: '工艺信息' }, |
| | | ]; |
| | | // rotSchema.value = getFormSchema('rotinfo'); |
| | | //工艺路线渲染图初始化 |
| | | if (lfInstance.value != null) { |
| | | routeData.value = { |
| | | nodes: [], |
| | | edges: [], |
| | | }; |
| | | const lf = unref(lfInstance)!; |
| | | lf.render({}); |
| | | } |
| | | initRoute(currlf, record.ROUTE_CODE, routeData, currlf); |
| | | selectVals.value['ROUTE_CODE'] = record.ROUTE_CODE; |
| | | openCustModal(true, { |
| | | isUpdate: true, |
| | | ctype: cType, |
| | | title: '工艺配置', |
| | | width: '1000px', |
| | | width: '1200px', |
| | | formEl: useFormData.value, //如果是多个表单,增加多个插槽 |
| | | formElName: ['woinfo', 'prodinfo', 'rotinfo'], //表单插槽名称,支持多个表单 |
| | | RowKey: '', |
| | |
| | | ], |
| | | tableName: 'BAS_ITEM', |
| | | rowKey: 'ITEM_CODE', |
| | | searchInfo: {TABLE_NAME: 'BAS_ITEM'} |
| | | searchInfo: { TABLE_NAME: 'BAS_ITEM' }, |
| | | }); |
| | | } |
| | | |
| | |
| | | nodes: [], |
| | | edges: [], |
| | | }; |
| | | init(selectVals.value['ROUTE_CODE']); |
| | | |
| | | init(currlf, selectVals.value['ROUTE_CODE']); |
| | | const { transformModel, width, height } = unref(currlf).graphModel; |
| | | transformModel.focusOn(300, 200, width, height); |
| | | } |
| | | } |
| | | |
| | |
| | | selectVals.value['ROUTE_CODE'], |
| | | ); //[openRvModal], selectVals.value['ID']这是自定义参数,按实际需求 |
| | | } |
| | | function RvItemSuccess(d, u) {} |
| | | |
| | | async function init(rotId) { |
| | | LogicFlow.use(BpmnElement); |
| | | lfInstance.value = new LogicFlow({ |
| | | container: document.querySelector('#lfContainer'), |
| | | edgeGenerator: (sourceNode) => { |
| | | // console.log('a'); |
| | | // 起始节点类型 rect 时使用 自定义的边 custom-edge |
| | | if (sourceNode.properties.isReturn) return 'custom-edge'; |
| | | // if (sourceNode.type === 'rect') return 'custom-edge'; |
| | | // return 'custom-edge'; |
| | | }, |
| | | }); |
| | | const lf = unref(lfInstance)!; |
| | | // lf?.setDefaultEdgeType('line'); |
| | | lf.register(customEdge); |
| | | lf.register(actionRect); |
| | | lf.register(TestNode); |
| | | lf.register(CollectNode); |
| | | lf.register(AssemblyNode); |
| | | lf.register(PackingNode); |
| | | lf.register(RepairNode); |
| | | lf.render({}); |
| | | //通过工艺路线ID获取图形数据,并渲染 |
| | | var _data = await getRouteData(rotId); |
| | | console.log('组件已挂载', _data); |
| | | //工艺路线全信息,包括Node、Edge和Act |
| | | // routeConfig.routeData = _data.Data; |
| | | if (_data.Data != null) { |
| | | //工艺路线主信息 |
| | | var currRoute = _data.Data.route; |
| | | _data.Data.nodes.forEach((n) => { |
| | | n.node.properties = JSON.parse(n.node.properties); |
| | | routeData.value.nodes.push(n.node); |
| | | }); |
| | | console.log('111', routeData.value); |
| | | _data.Data.edges.forEach((e) => { |
| | | e.edge.properties = JSON.parse(e.edge.properties); |
| | | routeData.value.edges.push(e.edge); |
| | | }); |
| | | _data.Data.acts.forEach((act) => { |
| | | act.node.properties = JSON.parse(act.node.properties); |
| | | routeData.value.nodes.push(act.node); |
| | | }); |
| | | console.log('init', unref(lf).getGraphData(), JSON.parse(JSON.stringify(routeData.value))); |
| | | lf.render(routeData.value); |
| | | // lf.graphModel.resize(500, 400); |
| | | lf.graphModel.fitView(); |
| | | lf.graphModel.translateCenter(); |
| | | } |
| | | function RvItemSuccess(d, u) { |
| | | closeModal(); |
| | | } |
| | | </script> |