Ben Lin
2024-08-04 54bd2e89b8689e9aa8ab6edcda003da46065cb19
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
<template>
  <PageWrapper title="工艺流程图" content="根据生产工艺设计工艺流程" contentFullHeight fixedHeight>
    <Layout class="h-full">
      <LayoutContent :style="{ overflow: 'initial' }">
        <FlowChart
          :data="routeData"
          @save-data="handleSave"
          @add-lf="handleAddlf"
          @select-node="handleSelect"
          @click-blank="clickBlank"
          @init="init"
        />
      </LayoutContent>
      <LayoutSider
        :class="`right`"
        collapsible
        :reverseArrow="true"
        collapsedWidth="0"
        width="400"
        style="padding: 10px; border-left: 1px solid #d9d9d9; background: #fafafa"
        :zeroWidthTriggerStyle="{ 'margin-top': '-70px', 'background-color': 'gray' }"
      >
        <PropsPanel
          ref="propsPanel"
          :activeKey="routeConfig.activeKey"
          :IsOperation="IsOperation"
          :title="title"
          :posttitle="posttitle"
          :entityName="entityName"
          @change-name="changeName"
          @change-node-name="changeNodeName"
        >
          <!-- <template v-for="item of formConfig.schemas" #[`${item.component}Props`]="data">
            <slot
              :name="`${item.component}Props`"
              v-bind="{ formItem: data, props: data.componentProps }"
            ></slot>
          </template> -->
        </PropsPanel>
      </LayoutSider>
    </Layout>
    <RouteDrawer @register="registerDrawer" @success="handleSuccess" />
    <RouteModal @register="registerModal" @success="modalSuccess" />
  </PageWrapper>
</template>
 
<script lang="ts" setup>
  import { FlowChart } from '/@/components/FlowChart';
  import { PageWrapper } from '/@/components/Page';
  import {
    SaveRouteData,
    SaveWoRouteData,
    getRouteData,
    getWoRouteData,
  } from '/@/api/tigerapi/mes/router';
  import { useModal } from '/@/components/Modal';
  import RouteModal from './RouteModal.vue';
  import { onMounted, ref, unref, Ref, provide, reactive, nextTick, watch } from 'vue';
  import { Layout, LayoutContent, LayoutSider } from 'ant-design-vue';
  import {
    RouteData,
    node,
    edge,
    MES_ROUTE_NODE,
    MES_ROUTE_EDGE,
    MES_ROUTE_NODE_ACT,
    MES_ROUTE,
    nodeText,
  } from '/@/api/tigerapi/model/router';
  import { useUserStore } from '/@/store/modules/user';
  import RouteDrawer from './RouteDrawer.vue';
  import { useDrawer } from '/@/components/Drawer';
  import PropsPanel from './components/PropsPanel.vue';
  import { IRouteConfig } from './typings/v-form-component';
  import { useMessage } from '/@/hooks/web/useMessage';
  import { useI18n } from '/@/hooks/web/useI18n';
  import { isNullOrEmpty, isNullOrUnDef } from '/@/utils/is';
  import { useRoute } from 'vue-router';
  import { useTabs } from '/@/hooks/web/useTabs';
  import LogicFlow from '@logicflow/core';
 
  defineOptions({ name: 'Route_View' });
  const { refreshPage } = useTabs();
  const [registerDrawer, { openDrawer }] = useDrawer();
  const [registerModal, { openModal }] = useModal();
  const { t } = useI18n();
  const route = useRoute();
  const { setTitle } = useTabs();
  const { notification, createErrorModal } = useMessage();
  const routeConfig = reactive<IRouteConfig>({
    // 表单配置
    schemas: [],
    layout: 'horizontal',
    labelLayout: 'flex',
    labelWidth: 100,
    labelCol: {},
    wrapperCol: {},
    currentItem: {} as MES_ROUTE_NODE,
    currentAct: {} as MES_ROUTE_NODE_ACT,
    routeData: {} as RouteData,
    activeKey: 1,
    isWorkOrder: false,
  });
  const currRoute = ref({} as MES_ROUTE);
  const routeData = ref({
    nodes: [],
    edges: [],
  });
  provide<Ref<IRouteConfig>>('routeConfig', routeConfig as unknown as Ref<IRouteConfig>);
  provide<Ref<MES_ROUTE>>('mesRoute', currRoute);
  const selectnode = ref({} as node);
  const currRotId = ref(route.params?.id);
  const colSlots = ref<any>([]);
  const crudColSlots = ref<any>([]);
  const entityName = ref<any>('MES_POSITION');
  const props = defineProps({
    rotId: { type: String, default: '' },
    rotType: { type: String, default: 'Route' },
  });
  const IsOperation = ref(false);
  const title = ref('');
  const posttitle = ref('');
  let _num = 1;
  let _numEdge = 1;
  watch(
    () => props.rotId,
    (v) => {
      if (!isNullOrEmpty(v) && v !== currRotId.value) {
        currRotId.value = v;
        if (!isNullOrUnDef(unref(currlf))) {
          unref(currlf).render({});
          routeData.value = {
            nodes: [],
            edges: [],
          };
          init(currlf);
        }
      }
    },
    { deep: true },
  );
 
  const currlf = ref(null) as Ref<LogicFlow | null>;
  console.log(currRotId.value);
 
  onMounted(() => {});
  /**
   * @description: 工艺路线初始化
   * @param {*} lf
   * @return {*}
   */
  async function init(lf) {
    currlf.value = unref(lf);
    //通过工艺路线ID获取图形数据,并渲染
    routeConfig.isWorkOrder = props.rotType == 'Wo';
    var _data =
      props.rotType == 'Route'
        ? await getRouteData(currRotId.value)
        : await getWoRouteData(currRotId.value);
    console.log('组件已挂载', _data);
    //工艺路线全信息,包括Node、Edge和Act
    routeConfig.routeData = _data.Data;
    if (_data.Data != null) {
      //工艺路线主信息
      currRoute.value = _data.Data.route;
      if (!isNullOrEmpty(currRotId.value) && isNullOrEmpty(props.rotId)) {
        setTitle('设计:工艺路线-' + currRoute.value.ROT_CODE);
      }
      _data.Data.nodes.forEach((n) => {
        n.node.properties = JSON.parse(n.node.properties);
        n['node']['text']['value'] = n.NODE_NAME;
        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)));
      unref(lf).render(routeData.value);
    }
  }
 
  /**
   * @description: 获取工艺路线图数据
   * @param {*} lf
   * @return {*}
   */
  const GetRotData = (lf) => {
    var currRotData: RouteData = {
      route: {
        ID: currRoute.value.ID,
        CREATE_TIME: new Date(),
        CREATE_USER: useUserStore().getUserInfo.userId as string,
        UPDATE_TIME: new Date(),
        UPDATE_USER: useUserStore().getUserInfo.userId as string,
        GHOST_ROW: false,
        ROT_CODE: currRoute.value.ROT_CODE,
        ROT_NAME: currRoute.value.ROT_NAME,
        ROT_TYPE: currRoute.value.ROT_TYPE,
        ROT_VER: currRoute.value.ROT_VER,
        IS_ACTIVE: currRoute.value.IS_ACTIVE,
        REMARK: currRoute.value.REMARK,
        AUTH_ORG: useUserStore().getUserInfo.orgCode,
        AUTH_PROD: '',
        AUTH_WH: '',
        WORK_ORDER: currRoute.value.WORK_ORDER,
        PROD_CODE: currRoute.value.PROD_CODE,
        CUST_CODE: currRoute.value.CUST_CODE,
      },
      nodes: [],
      edges: [],
      acts: [],
    };
    var _nodes = unref(lf).getGraphData().nodes as node[];
    var _edges = unref(lf).getGraphData().edges as edge[];
    const diffnodes = routeConfig.routeData.nodes.filter((itemA) =>
      _nodes.some((itemB) => itemB.id === itemA.ID),
    );
    const diffacts = routeConfig.routeData.acts.filter((itemA) =>
      _nodes.some((itemB) => itemB.id === itemA.ID),
    );
    _nodes.forEach((n) => {
      if (n.properties.operType && n.properties.operType == 'Action') {
        var _diffacts = diffacts.length > 0 ? diffacts : routeConfig.routeData.acts;
        _diffacts.forEach((a) => {
          if (a.ID == n.id) {
            var act: MES_ROUTE_NODE_ACT = {
              ID: n.id,
              CREATE_TIME: routeConfig.routeData.route.CREATE_TIME,
              CREATE_USER: useUserStore().getUserInfo.userId as string,
              UPDATE_TIME: routeConfig.routeData.route.UPDATE_TIME,
              UPDATE_USER: useUserStore().getUserInfo.userId as string,
              GHOST_ROW: false,
              ROT_ID: routeConfig.routeData.route.ID,
              GPH_TYPE: n.type,
              GPH_X: n.x,
              GPH_Y: n.y,
              GPH_PROP: JSON.stringify(n.properties),
              GPH_TEXT: n.text.value,
              REMARK: a.REMARK,
              AUTH_ORG: useUserStore().getUserInfo.orgCode,
              AUTH_PROD: '',
              AUTH_WH: '',
              OPTION_1: '',
              OPTION_2: '',
              OPTION_3: '',
              OPTION_4: '',
              OPTION_5: '',
              ACT_NAME: isNullOrEmpty(a.ACT_NAME) ? `${n.text.value}_${_num}` : a.ACT_NAME,
              ACT_CODE: a.ACT_CODE,
              NEED_SETUP: a.NEED_SETUP,
              NEED_RESET: a.NEED_RESET,
              NODE_ID: a.NODE_ID,
              ACT_TYPE: a.ACT_TYPE,
              // DO_TYPE: a.DO_TYPE,
              // DO_METHOD: a.DO_METHOD,
              // DO_IF_PASS: a.DO_IF_PASS,
              // DO_IF_FAIL: a.DO_IF_FAIL,
              node: {} as node,
              IS_ACTIVE: a.IS_ACTIVE,
              WORK_ORDER: a.WORK_ORDER,
              PROD_CODE: a.PROD_CODE,
              CUST_CODE: a.CUST_CODE,
            };
            var pnode = [n];
            while (pnode[0].properties.operType == 'Action') {
              pnode = unref(lf).getNodeIncomingNode(pnode[0].id);
              if (pnode[0].properties.operType != 'Action') {
                act.NODE_ID = pnode[0].id;
                break;
              }
            }
            currRotData.acts.push(act);
          }
        });
        routeConfig.routeData.acts = _diffacts;
      } else {
        var _diffnodes = diffnodes.length > 0 ? diffnodes : routeConfig.routeData.nodes;
        _diffnodes.forEach((nd) => {
          if (nd.ID == n.id) {
            var node: MES_ROUTE_NODE = {
              ID: n.id,
              CREATE_TIME: currRotData.route.CREATE_TIME,
              CREATE_USER: useUserStore().getUserInfo.userId as string,
              UPDATE_TIME: currRotData.route.UPDATE_TIME,
              UPDATE_USER: useUserStore().getUserInfo.userId as string,
              GHOST_ROW: false,
              NODE_NAME: isNullOrEmpty(nd.NODE_NAME) ? `${n.text.value}_${_num}` : nd.NODE_NAME,
              ROT_ID: currRotData.route.ID,
              SEGMENT: nd.SEGMENT,
              OPER_CODE: isNullOrEmpty(nd.OPER_CODE) ? n.type : nd.OPER_CODE,
              GPH_TYPE: n.type,
              GPH_X: n.x,
              GPH_Y: n.y,
              GPH_PROP: JSON.stringify(n.properties),
              GPH_TEXT: n.text.value,
              IS_ACTIVE: nd.IS_ACTIVE,
              IS_CALC_FPY: nd.IS_CALC_FPY,
              ALLOW_DFT_IN: nd.ALLOW_DFT_IN,
              CAN_SKIP: nd.CAN_SKIP,
              REMARK: nd.REMARK,
              AUTH_ORG: useUserStore().getUserInfo.orgCode,
              AUTH_PROD: '',
              AUTH_WH: '',
              IS_FIRST_NODE: 'N',
              IS_INPUT: nd.IS_INPUT,
              IS_OUTPUT: nd.IS_OUTPUT,
              OPTION_1: '',
              OPTION_2: '',
              OPTION_3: '',
              OPTION_4: '',
              OPTION_5: '',
              node: {} as node,
              WORK_ORDER: nd.WORK_ORDER,
              PROD_CODE: nd.PROD_CODE,
              CUST_CODE: nd.CUST_CODE,
            };
            nd.GPH_TYPE = n.type;
            nd.GPH_PROP = JSON.stringify(n.properties);
            nd.GPH_TEXT = n.text.value;
            nd.GPH_X = n.x;
            nd.GPH_Y = n.y;
            if (unref(lf).getNodeIncomingNode(n.id).length == 0) {
              node.IS_FIRST_NODE = 'Y';
              nd.IS_FIRST_NODE = 'Y';
            }
            currRotData.nodes.push(node);
          }
        });
        routeConfig.routeData.nodes = _diffnodes;
      }
      _num++;
    });
    routeConfig.routeData.edges = [];
    _edges.forEach((e) => {
      var edge: MES_ROUTE_EDGE = {
        ID: e.id,
        CREATE_TIME: routeConfig.routeData.route.CREATE_TIME,
        CREATE_USER: useUserStore().getUserInfo.userId as string,
        UPDATE_TIME: routeConfig.routeData.route.UPDATE_TIME,
        UPDATE_USER: useUserStore().getUserInfo.userId as string,
        GHOST_ROW: false,
        EDGE_NAME: `${routeConfig.routeData.route.ROT_CODE}_${e.id}`,
        ROT_ID: routeConfig.routeData.route.ID,
        SRC_NODE: e.sourceNodeId,
        TGT_NODE: e.targetNodeId,
        GPH_TYPE: e.type,
        GPH_SRC_X: e.startPoint.x,
        GPH_SRC_Y: e.startPoint.y,
        GPH_TGT_X: e.endPoint.x,
        GPH_TGT_Y: e.endPoint.y,
        GPH_PROP: JSON.stringify(e.properties),
        GPH_POTS: JSON.stringify(e.pointsList),
        REMARK: '',
        AUTH_ORG: useUserStore().getUserInfo.orgCode,
        AUTH_PROD: '',
        AUTH_WH: '',
        EDGE_TYPE: 0,
        OPTION_1: '',
        OPTION_2: '',
        OPTION_3: '',
        OPTION_4: '',
        OPTION_5: '',
        edge: {} as edge,
        WORK_ORDER: routeConfig.routeData.route.WORK_ORDER,
        PROD_CODE: routeConfig.routeData.route.PROD_CODE,
        CUST_CODE: routeConfig.routeData.route.CUST_CODE,
      };
      routeConfig.routeData.edges.push(edge);
      currRotData.edges.push(edge);
      _numEdge++;
    });
    return currRotData;
  };
 
  /*
   *保存工艺路线事件
   */
  async function handleSave(lf) {
    console.log('handleSave', unref(lf).getGraphData().nodes[0]);
    if (
      isNullOrEmpty(currRoute.value.ROT_CODE) ||
      (props.rotType == 'Wo' && isNullOrEmpty(currRoute.value.WORK_ORDER))
    ) {
      createErrorModal({
        title: t('未选择'),
        content: t('未选择工艺路线或者新增工艺路线'),
        getContainer: () => document.body,
      });
    } else {
      var hasError = false;
      unref(lf)
        .getGraphData()
        .nodes.forEach((n) => {
          if (
            unref(lf).getNodeIncomingEdge(n.id).length == 0 &&
            unref(lf).getNodeOutgoingEdge(n.id).length == 0
          ) {
            hasError = true;
          }
        });
      if (hasError) {
        createErrorModal({
          title: t('警告'),
          content: t('有节点未连线,请重新设计工艺路线再保存数据!'),
          getContainer: () => document.body,
        });
      } else {
        var action =
          props.rotType == 'Wo'
            ? await SaveWoRouteData(GetRotData(lf))
            : await SaveRouteData(GetRotData(lf));
        if (action.IsSuccessed) {
          await refreshPage();
        }
      }
    }
  }
 
  /*
   *新增工艺路线弹出模态窗口事件
   */
  async function handleAddlf(lf) {
    // openDrawer(true, {
    //   isUpdate: false,
    //   lf: lf,
    // });
    openModal(true, {
      isUpdate: false,
      lf: lf,
    });
  }
 
  /*
   *点击节点选中事件
   */
  function handleSelect(data, lf) {
    lf.graphModel.clearSelectElements();
    lf.graphModel.getNodeModelById(data.data.id).setSelected(true);
    selectnode.value = data.data;
    if (isNullOrUnDef(routeConfig.routeData)) {
      //先初始化routeData
      routeConfig.routeData = {};
      routeConfig.routeData.route = currRoute.value;
      routeConfig.routeData.nodes = [];
      routeConfig.routeData.edges = [];
      routeConfig.routeData.acts = [];
      //再返回具体数据
      routeConfig.routeData = GetRotData(lf);
    }
 
    var _node = routeConfig.routeData.nodes.filter((x) => x.ID == selectnode.value.id)[0];
    if (isNullOrUnDef(_node)) {
      _node = {
        ID: selectnode.value.id,
        CREATE_TIME: currRoute.value.CREATE_TIME,
        CREATE_USER: useUserStore().getUserInfo.userId as string,
        UPDATE_TIME: currRoute.value.UPDATE_TIME,
        UPDATE_USER: useUserStore().getUserInfo.userId as string,
        GHOST_ROW: false,
        NODE_NAME: `${selectnode.value.text.value}_${_num}`,
        ROT_ID: currRoute.value.ID,
        SEGMENT: '',
        OPER_CODE: selectnode.value.type,
        GPH_TYPE: selectnode.value.type,
        GPH_X: selectnode.value.x,
        GPH_Y: selectnode.value.y,
        GPH_PROP: '',
        GPH_TEXT: selectnode.value.text.value,
        IS_ACTIVE: 'Y',
        IS_CALC_FPY: 'N',
        CAN_SKIP: 'N',
        REMARK: '',
        AUTH_ORG: useUserStore().getUserInfo.orgCode,
        AUTH_PROD: '',
        AUTH_WH: '',
        IS_FIRST_NODE: '',
        ALLOW_DFT_IN: '',
        IS_INPUT: '',
        IS_OUTPUT: '',
        OPTION_1: '',
        OPTION_2: '',
        OPTION_3: '',
        OPTION_4: '',
        OPTION_5: '',
        node: {} as node,
        WORK_ORDER: currRoute.value.WORK_ORDER,
        PROD_CODE: currRoute.value.PROD_CODE,
        CUST_CODE: currRoute.value.CUST_CODE,
      };
      routeConfig.routeData.nodes.push(_node);
      _num++;
    }
    //是行为
    if (
      selectnode.value.properties['operType'] &&
      selectnode.value.properties['operType'] == 'Action'
    ) {
      var _act = routeConfig.routeData.acts.filter((x) => x.ID == selectnode.value.id)[0];
      routeConfig.activeKey = 2;
      IsOperation.value = false;
      title.value = '行为';
      posttitle.value = '';
      if (isNullOrUnDef(_act)) {
        _act = {
          ID: selectnode.value.id,
          CREATE_TIME: currRoute.value.CREATE_TIME,
          CREATE_USER: useUserStore().getUserInfo.userId as string,
          UPDATE_TIME: currRoute.value.UPDATE_TIME,
          UPDATE_USER: useUserStore().getUserInfo.userId as string,
          GHOST_ROW: false,
          AUTH_ORG: useUserStore().getUserInfo.orgCode,
          AUTH_PROD: '',
          AUTH_WH: '',
          ACT_NAME: `${selectnode.value.text.value}_${_numEdge}`,
          ACT_CODE: '',
          ROT_ID: currRoute.value.ID,
          NODE_ID: '',
          ACT_TYPE: 0,
          GPH_TYPE: selectnode.value.type,
          GPH_X: selectnode.value.x,
          GPH_Y: selectnode.value.y,
          GPH_PROP: JSON.stringify(selectnode.value.properties),
          GPH_TEXT: selectnode.value.text.value,
          NEED_SETUP: 'Y',
          NEED_RESET: 'N',
          // DO_TYPE: 0,
          // DO_METHOD: '',
          // DO_IF_PASS: '',
          // DO_IF_FAIL: '',
          IS_ACTIVE: '',
          OPTION_1: '',
          OPTION_2: '',
          OPTION_3: '',
          OPTION_4: '',
          OPTION_5: '',
          REMARK: '',
          node: {} as node,
          WORK_ORDER: currRoute.value.WORK_ORDER,
          PROD_CODE: currRoute.value.PROD_CODE,
          CUST_CODE: currRoute.value.CUST_CODE,
        };
        routeConfig.routeData.acts.push(_act);
        _numEdge++;
      }
      routeConfig.currentAct = {
        ID: selectnode.value.id,
        CREATE_TIME: currRoute.value.CREATE_TIME,
        CREATE_USER: useUserStore().getUserInfo.userId as string,
        UPDATE_TIME: currRoute.value.UPDATE_TIME,
        UPDATE_USER: useUserStore().getUserInfo.userId as string,
        GHOST_ROW: false,
        AUTH_ORG: _act.AUTH_ORG,
        AUTH_PROD: _act.AUTH_PROD,
        AUTH_WH: _act.AUTH_WH,
        ACT_NAME: _act.ACT_NAME,
        ACT_CODE: _act.ACT_CODE,
        ROT_ID: currRoute.value.ID,
        NODE_ID: _act.NODE_ID,
        ACT_TYPE: _act.ACT_TYPE,
        GPH_TYPE: selectnode.value.type,
        GPH_X: selectnode.value.x,
        GPH_Y: selectnode.value.y,
        GPH_PROP: JSON.stringify(selectnode.value.properties),
        GPH_TEXT: selectnode.value.text.value,
        NEED_SETUP: _act.NEED_SETUP,
        NEED_RESET: _act.NEED_RESET,
        // DO_TYPE: _act.DO_TYPE,
        // DO_METHOD: _act.DO_METHOD,
        // DO_IF_PASS: _act.DO_IF_PASS,
        // DO_IF_FAIL: _act.DO_IF_FAIL,
        IS_ACTIVE: _act.IS_ACTIVE,
        OPTION_1: '',
        OPTION_2: '',
        OPTION_3: '',
        OPTION_4: '',
        OPTION_5: '',
        REMARK: '',
        node: {} as node,
        WORK_ORDER: currRoute.value.WORK_ORDER,
        PROD_CODE: currRoute.value.PROD_CODE,
        CUST_CODE: currRoute.value.CUST_CODE,
      };
      const actModel = lf.getNodeModelById(selectnode.value.id);
      actModel.updateText(routeConfig.currentAct?.ACT_NAME);
    } else {
      //是工序
      IsOperation.value = false;
      routeConfig.currentItem = {
        ID: selectnode.value.id,
        CREATE_TIME: currRoute.value.CREATE_TIME,
        CREATE_USER: useUserStore().getUserInfo.userId as string,
        UPDATE_TIME: currRoute.value.UPDATE_TIME,
        UPDATE_USER: useUserStore().getUserInfo.userId as string,
        GHOST_ROW: false,
        AUTH_ORG: _node.AUTH_ORG,
        AUTH_PROD: _node.AUTH_PROD,
        AUTH_WH: _node.AUTH_WH,
        NODE_NAME: _node.NODE_NAME ?? '',
        ROT_ID: currRoute.value.ID,
        SEGMENT: _node.SEGMENT,
        OPER_CODE: _node.OPER_CODE,
        GPH_TYPE: selectnode.value.type,
        GPH_X: selectnode.value.x,
        GPH_Y: selectnode.value.y,
        GPH_PROP: '',
        GPH_TEXT: selectnode.value.text.value,
        IS_ACTIVE: _node.IS_ACTIVE,
        IS_CALC_FPY: _node.IS_CALC_FPY,
        CAN_SKIP: _node.CAN_SKIP,
        IS_INPUT: _node.IS_INPUT,
        ALLOW_DFT_IN: _node.ALLOW_DFT_IN,
        IS_OUTPUT: _node.IS_OUTPUT,
        REMARK: _node.REMARK,
        WORK_ORDER: currRoute.value.WORK_ORDER,
        PROD_CODE: currRoute.value.PROD_CODE,
        CUST_CODE: currRoute.value.CUST_CODE,
        node: {} as node,
      };
      const nodeModel = lf.getNodeModelById(selectnode.value.id);
      nodeModel.updateText(_node.NODE_NAME);
      routeConfig.isCalcFpy = _node.IS_CALC_FPY == 'Y';
      routeConfig.canSkip = _node.CAN_SKIP == 'Y';
      routeConfig.isActive = _node.IS_ACTIVE == 'Y';
      routeConfig.allowDftIn = _node.ALLOW_DFT_IN == 'Y';
      routeConfig.isInput = _node.IS_INPUT == 'Y';
      routeConfig.isOutput = _node.IS_OUTPUT == 'Y';
      setTimeout(() => {
        console.log(routeConfig.currentItem);
        routeConfig.activeKey = 2;
        IsOperation.value = true;
        title.value = '工序';
        posttitle.value = '岗位';
      }, 100);
    }
  }
 
  function handleSuccess(lfInstance) {
    unref(lfInstance).render({});
  }
 
  /*
   *点击画布事件
   */
  function clickBlank() {
    routeConfig.activeKey = 1;
    title.value = '';
    posttitle.value = '';
  }
 
  /*
   *新增工艺路线成功后事件
   */
  async function modalSuccess(lfInstance, route) {
    unref(lfInstance).render({});
    currRoute.value = route;
    currRotId.value = currRoute.value.ID;
    setTitle('设计:工艺路线-' + currRoute.value.ROT_CODE);
    //先初始化routeData
    routeConfig.routeData = {};
    routeConfig.routeData.route = currRoute.value;
    routeConfig.routeData.nodes = [];
    routeConfig.routeData.edges = [];
    routeConfig.routeData.acts = [];
    //再返回具体数据
    routeConfig.routeData = GetRotData(unref(lfInstance));
  }
 
  /**
   * @description: 名称改变回调方法,返回后更新节点文本
   * @param {*} e
   * @return {*}
   */
  function changeName(e) {
    console.log(e.val);
    const nodeModel = unref(currlf)?.getNodeModelById(e.id);
    nodeModel?.updateText(e.val);
  }
  /**
   * @description: 名称改变回调方法,返回后更新节点文本
   * @param {*} e
   * @return {*}
   */
  function changeNodeName(e) {
    console.log(e.val);
    const nodeModel = unref(currlf)?.getNodeModelById(e.id);
    nodeModel?.updateText(e.val);
  }
</script>