ny
昨天 282fbc6488f4e8ceb5fda759f963ee88fbf7b999
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
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
<script lang="ts" setup>
import { computed, inject, reactive, toRefs, unref, watch } from 'vue';
 
import { bpmnProcessing, hasGatewayType, typeConfig, typeConfluence, typeOutside, typeSubFlow } from '@jnpf/bpmn/config';
import { NodeUtils } from '@jnpf/bpmn/utils';
import { useModal } from '@jnpf/ui/modal';
import { buildBitUUID, formatToDateTime } from '@jnpf/utils';
 
import { DownOutlined, ReloadOutlined } from '@ant-design/icons-vue';
import { TreeSelect } from 'ant-design-vue';
import { cloneDeep } from 'lodash-es';
import draggable from 'vuedraggable';
 
import { InterfaceModal } from '#/components/CommonModal';
import { SelectInterfaceBtn } from '#/components/Interface';
import { systemFieldOptions } from '#/utils/define';
 
import {
  defaultStep,
  divideRuleOptions,
  formFieldTypeOptions,
  nodeOverTimeMsgOptions,
  overTimeOptions,
  printConditionTypeOptions,
  typeOptions,
} from '../helper/define';
import ApproversSortModal from './components/ApproversSortModal.vue';
import AssignRuleModal from './components/AssignRuleModal.vue';
import ConditionModal from './components/ConditionModal.vue';
import FlowFormModal from './components/FlowFormModal.vue';
import HeaderContainer from './components/HeaderContainer.vue';
import NoticeConfig from './components/NoticeConfig.vue';
import StyleScript from './components/StyleScript.vue';
 
interface State {
  activeKey: number;
  assignList: any[];
  userLabel: string;
  readAllChecked: boolean;
  writeAllChecked: boolean;
  requiredAllChecked: boolean;
  isReadIndeterminate: boolean;
  isWriteIndeterminate: boolean;
  isRequiredIndeterminate: boolean;
  conditionType: string;
  currentBtnIndex: number;
  jsJson: string;
  formLoading: boolean;
}
 
defineOptions({ inheritAttrs: false });
const props = defineProps([
  'formConf',
  'printTplOptions',
  'prevNodeList',
  'beforeNodeOptions',
  'funcOptions',
  'noticeOptions',
  'formFieldsOptions',
  'usedFormItems',
  'getFormFieldList',
  'initFormOperates',
  'updateJnpfData',
  'nodeOptions',
  'flowState',
  'type',
  'updateFormFieldList',
  'updateBpmnProperties',
]);
const emit = defineEmits(['updateDivideRule']);
const state = reactive<State>({
  activeKey: 1,
  assignList: [],
  userLabel: '',
  readAllChecked: false,
  writeAllChecked: false,
  requiredAllChecked: false,
  isReadIndeterminate: false,
  isWriteIndeterminate: false,
  isRequiredIndeterminate: false,
  conditionType: '',
  currentBtnIndex: 0,
  jsJson: '({ flowInfo, formData, taskInfo, onlineUtils }) => {\n    // 在此编写代码\n    \n}',
  formLoading: false,
});
defineExpose({ getContent, updateCheckStatus });
const { activeKey, readAllChecked, writeAllChecked, requiredAllChecked, isReadIndeterminate, isWriteIndeterminate, isRequiredIndeterminate, formLoading } =
  toRefs(state);
const [registerAssignRuleModal, { openModal: openAssignRuleModal }] = useModal();
const [registerConditionModal, { openModal: openConditionModal }] = useModal();
const [registerApproversSortModal, { openModal: openApproversSortModal }] = useModal();
const [registerStyleScriptModal, { openModal: openStyleScriptModal }] = useModal();
const bpmn: (() => string | undefined) | undefined = inject('bpmn');
 
const extraRuleOptions = [
  { id: 1, fullName: '无办理人范围' },
  { id: 6, fullName: '同一公司' },
  { id: 2, fullName: '同一部门' },
  { id: 3, fullName: '同一岗位' },
  { id: 4, fullName: '发起人上级' },
  { id: 5, fullName: '发起人下属' },
];
const candidateExtraRuleOptions = [
  { id: 1, fullName: '无候选人范围' },
  { id: 6, fullName: '同一公司' },
  { id: 2, fullName: '同一部门' },
  { id: 3, fullName: '同一岗位' },
];
const overTimeRuleOptions = [
  { id: 7, fullName: '同一角色' },
  { id: 2, fullName: '同一部门' },
  { id: 3, fullName: '同一岗位' },
  { id: 8, fullName: '同一分组' },
];
const extraCopyRuleOptions = extraRuleOptions.map((o) => (o.id === 1 ? { id: 1, fullName: '无抄送人范围' } : o));
const counterSignOptions = [
  { id: 0, fullName: '或签(一名成员办理即可)' },
  { id: 1, fullName: '会签(无序会签,办理达到会签比例,办理通过)' },
];
const auditTypeOptions = [
  { id: 1, fullName: '按百分比' },
  { id: 2, fullName: '按人数' },
];
const calculateTypeOptions = [
  { id: 1, fullName: '实时计算' },
  { id: 2, fullName: '延后计算' },
];
const rejectTypeOptions = [{ id: 0, fullName: '无' }, ...auditTypeOptions];
const formOperatesColumns = [
  { title: '表单字段', dataIndex: 'name', key: 'name' },
  { title: '操作', dataIndex: 'write', key: 'write', align: 'center', width: 250 },
];
const conditionTypeOptions = [
  { id: 1, fullName: '字段' },
  { id: 2, fullName: '自定义' },
  { id: 3, fullName: '系统参数' },
];
 
const approverStartOptions = computed(() => {
  const list: any = [];
  const elementRegistry: any = unref(getBpmn)?.get('elementRegistry');
  const element = elementRegistry.get(props.formConf?.nodeId);
  list.push({ fullName: '发起人', id: 1 });
  if (
    !element?.incoming?.some((o) => {
      let hasOutsideAndSubFlow = false;
      if ([typeOutside, typeSubFlow].includes(o.source.wnType)) hasOutsideAndSubFlow = true;
      if (
        (hasGatewayType.has(o.source.wnType) || o.source.wnType === typeConfluence) &&
        o?.source.incoming?.some((i) => [typeOutside, typeSubFlow].includes(i.source.wnType))
      )
        hasOutsideAndSubFlow = true;
      return hasOutsideAndSubFlow;
    })
  )
    list.push({ fullName: '上节点审批人', id: 2 });
  return list;
});
 
const transferTypeOptions = [
  { fullName: '指定成员', id: 6 },
  { fullName: '超时办理人', id: 11 },
  { fullName: '数据接口', id: 9 },
];
const getBpmn = computed(() => (bpmn as () => any)());
const getJnpfGlobalData = computed(() => {
  const jnpfData: any = unref(getBpmn).get('jnpfData');
  return jnpfData?.getValue('global') || {};
});
const getBindValue = computed(() => ({
  funcOptions: props.noticeOptions,
  isApprover: true,
}));
const getAssignBindValue = computed(() => ({
  formConf: props.formConf,
  formFieldsOptions: props.formFieldsOptions,
}));
const backNodeCodeOptions = computed(() => {
  let options = [...defaultStep, ...props.beforeNodeOptions];
  if (props.formConf.backType == 2) options = options.filter((o) => o.id != 1);
  return options;
});
const getPrintConditionsContent = computed(() => NodeUtils.getConditionsContent(props.formConf.printConfig.conditions, props.formConf.printConfig.matchLogic));
const getSystemFieldOptions = computed(() => systemFieldOptions.map((o) => ({ ...o, label: o.fullName ? `${o.id}(${o.fullName})` : o.id })));
const getParameterList = computed(() => unref(getJnpfGlobalData).globalParameterList || []);
const getApprovalFieldOptions = computed(() => unref(getJnpfGlobalData).approvalFieldList || []);
const getCanSetApproversSort = computed(() => {
  return (
    props.formConf.assigneeType === 6 &&
    props.formConf.approvers.length &&
    props.formConf.approvers.every((o) => o.includes('--user')) &&
    props.formConf.counterSign == 2
  );
});
const getHasAssign = computed(() => props.formConf.assignList.length && props.formConf.assignList.some((o) => o.ruleList?.length));
const getFormFieldOptions = computed(() => getFormField(props.usedFormItems, props.formConf.formFieldType));
const getCopyFormFieldOptions = computed(() => getFormField(props.usedFormItems, props.formConf.copyFormFieldType));
const getGlobalOptions = computed(() => unref(getJnpfGlobalData).globalParameterList);
 
watch(
  () => props.formConf,
  () => props.updateJnpfData(props.formConf),
  { deep: true, immediate: true },
);
watch(
  () => state.activeKey,
  (val) => {
    val == 3 && updateCheckStatus();
  },
);
 
function onFormIdChange(id, item) {
  if (!id) return handleNull();
  const isSameForm = props.formConf.formId === id;
  props.formConf.formName = item.fullName;
  props.formConf.formId = id;
  props.formConf.assignList = [];
  props.getFormFieldList(id, 'approverForm', isSameForm);
}
function handleNull() {
  props.formConf.formName = '';
  props.formConf.formId = '';
  let formFieldList = [];
  const jnpfData: any = unref(getBpmn).get('jnpfData');
  const global = jnpfData.getValue('global');
  const formId = global.formId;
  if (formId && global.allFormMap && global.allFormMap[`form_${formId}`]) {
    formFieldList = global.allFormMap[`form_${formId}`] || [];
  }
  props.updateFormFieldList(formFieldList);
  props.formConf.formOperates = props.initFormOperates(props.formConf, true);
}
function onBackTypeChange(e) {
  if (e?.target?.value == 2 && props.formConf.backNodeCode == 1) props.formConf.backNodeCode = 0;
}
function openTransmitRuleBox() {
  const assignList = getRealAssignList(props.formConf.assignList ? cloneDeep(props.formConf.assignList) : []);
  openAssignRuleModal(true, { assignList });
}
function getRealAssignList(assignList) {
  const jnpfData: any = unref(getBpmn).get('jnpfData');
  const global = jnpfData.getValue('global');
  const newAssignList = props.prevNodeList.map((o) => {
    const formFieldList: any[] = [];
    const formId = o.formId;
    if (formId && o.type != 'start' && global.allFormMap && global.allFormMap[`form_${formId}`]) {
      let list = cloneDeep(global.allFormMap[`form_${formId}`]) || [];
      list = list.filter((o) => o.__config__.jnpfKey !== 'table');
      list = list.map((o) => ({ ...o, id: `${o.id}|${formId}` }));
      const sysFieldList = [{ id: '@prevNodeFormId', fullName: '上节点表单Id' }];
      formFieldList.push({ fullName: '上节点表单', children: [...sysFieldList, ...list] });
    }
    // 外部节点
    if (formId && o.type != 'start' && global.allFormMap && global.allFormMap[`outsideForm_${formId}`]) {
      const list = cloneDeep(global.allFormMap[`outsideForm_${formId}`]) || [];
      formFieldList.push({ fullName: '上节点表单', children: [...list] });
    }
    const globalFormId = global.formId;
    if (globalFormId && global.allFormMap && global.allFormMap[`form_${globalFormId}`]) {
      let list = cloneDeep(global.allFormMap[`form_${globalFormId}`]) || [];
      list = list.filter((o) => o.__config__.jnpfKey !== 'table');
      list = list.map((o) => ({ ...o, id: `${o.id}|${globalFormId}` }));
      const sysFieldList = [{ id: '@startNodeFormId', fullName: '发起节点表单Id' }];
      formFieldList.push({ fullName: '发起节点表单', children: [...sysFieldList, ...list] });
    }
    const globalParameterList = cloneDeep(global.globalParameterList).map((o) => ({ ...o, fullName: o.fieldName, id: `${o.fieldName}|globalParameter` }));
    globalParameterList.length && formFieldList.push({ fullName: '全局变量', children: globalParameterList || [] });
    return {
      nodeId: o.id,
      title: o.fullName,
      formFieldList,
      ruleList: [],
    };
  });
  if (!assignList.length) return newAssignList;
  const list: any[] = [];
  // 去掉被删掉的节点
  for (const e of assignList) {
    inter: for (const element of newAssignList) {
      if (e.nodeId === element.nodeId) {
        const item = {
          nodeId: e.nodeId,
          title: element.title,
          formFieldList: element.formFieldList,
          ruleList: e.ruleList,
        };
        list.push(item);
        break inter;
      }
    }
  }
  const addList = newAssignList.filter((o) => !assignList.some((item) => item.nodeId === o.nodeId));
  return [...list, ...addList];
}
function onAssigneeTypeChange() {
  props.formConf.approversSortList = [];
  props.formConf.extraRule = 1;
  props.updateBpmnProperties('elementBodyName', getContent());
}
function onFormFieldTypeChange() {
  props.formConf.formField = '';
}
function onCopyFormFieldTypeChange() {
  props.formConf.copyFormField = '';
}
function getFormField(list, type) {
  if (type === 2) return list.filter((o) => o.__config__.jnpfKey == 'organizeSelect');
  if (type === 3) return list.filter((o) => o.__config__.jnpfKey == 'posSelect');
  if (type === 4) return list.filter((o) => o.__config__.jnpfKey == 'roleSelect');
  if (type === 5) return list.filter((o) => o.__config__.jnpfKey == 'groupSelect');
  return list.filter((o) => o.__config__.jnpfKey == 'userSelect' || o.__config__.jnpfKey == 'usersSelect');
}
function onApproversChange(val) {
  if (!val?.length) onLabelChange('');
  if (props.formConf.assigneeType != 6 || !val || !val.length || !val.every((o) => o.includes('--user'))) return (props.formConf.approversSortList = []);
  if (!props.formConf.approversSortList.length) return (props.formConf.approversSortList = val);
  const arr = props.formConf.approversSortList.filter((o) => val.includes(o));
  const updated = val.filter((o) => !props.formConf.approversSortList.includes(o));
  props.formConf.approversSortList = [...arr, ...updated];
}
function onLabelChange(val) {
  state.userLabel = val;
  props.updateBpmnProperties('elementBodyName', getContent());
}
function getContent() {
  let content = typeConfig[bpmnProcessing].renderer.bodyDefaultText;
  content =
    props.formConf.assigneeType == 6
      ? state.userLabel || typeConfig[bpmnProcessing].renderer.bodyDefaultText
      : typeOptions.find((o) => o.id === props.formConf.assigneeType)?.fullName || typeConfig[bpmnProcessing].renderer.bodyDefaultText;
  props.formConf.content = content;
  return content;
}
function onInterfaceChange(val, row) {
  if (!val) {
    props.formConf.interfaceConfig.interfaceId = '';
    props.formConf.interfaceConfig.interfaceName = '';
    props.formConf.interfaceConfig.templateJson = [];
    return;
  }
  if (props.formConf.interfaceConfig.interfaceId === val) return;
  props.formConf.interfaceConfig.interfaceId = val;
  props.formConf.interfaceConfig.interfaceName = row.fullName;
  props.formConf.interfaceConfig.templateJson = row.templateJson.map((o) => ({ ...o, sourceType: 1 })) || [];
}
function onOverTimeConfigInterfaceChange(val, row) {
  if (!val) {
    props.formConf.overTimeConfig.interfaceId = '';
    props.formConf.overTimeConfig.interfaceName = '';
    props.formConf.overTimeConfig.templateJson = [];
    return;
  }
  if (props.formConf.overTimeConfig.interfaceId === val) return;
  props.formConf.overTimeConfig.interfaceId = val;
  props.formConf.overTimeConfig.interfaceName = row.fullName;
  props.formConf.overTimeConfig.templateJson = row.templateJson.map((o) => ({ ...o, sourceType: 1 })) || [];
}
function onRelationFieldChange(val, row) {
  if (!val) return;
  const list = props.funcOptions.filter((o) => o.id === val);
  if (!list.length) return;
  const item = list[0];
  row.isSubTable = item.__config__ && item.__config__.isSubTable ? item.__config__.isSubTable : false;
}
function onSignNumberChange(val, key) {
  if (val) return;
  props.formConf.counterSignConfig[key] = 1;
}
function handleCheckAllChange(e, type) {
  const val = e.target.checked;
  if (type == 1) state.isReadIndeterminate = false;
  if (type == 2) state.isWriteIndeterminate = false;
  if (type == 3) state.isRequiredIndeterminate = false;
  props.formConf.formOperates.forEach((item) => {
    if (type == 1) item.read = val;
    if (type == 2) item.write = val;
    if (type == 3 && !item.requiredDisabled) item.required = val;
  });
}
function handleCheckedChange() {
  updateCheckStatus();
}
function updateCheckStatus() {
  const formOperatesLen = props.formConf.formOperates.length;
  const requiredDisabledCount = props.formConf.formOperates.filter((o) => !o.requiredDisabled).length;
  let readCount = 0;
  let writeCount = 0;
  let requiredCount = 0;
  props.formConf.formOperates.forEach((item) => {
    if (item.read) readCount++;
    if (item.write) writeCount++;
    if (item.required && !item.requiredDisabled) requiredCount++;
  });
  state.readAllChecked = formOperatesLen ? formOperatesLen === readCount : false;
  state.writeAllChecked = formOperatesLen ? formOperatesLen === writeCount : false;
  state.requiredAllChecked = formOperatesLen ? requiredDisabledCount === requiredCount : false;
  state.isReadIndeterminate = !!readCount && readCount < formOperatesLen;
  state.isWriteIndeterminate = !!writeCount && writeCount < formOperatesLen;
  state.isRequiredIndeterminate = !!requiredCount && requiredCount < requiredDisabledCount;
}
function handlePrintConfig() {
  state.conditionType = 'print';
  openConditionModal(true, { usedFormItems: props.usedFormItems, formFieldsOptions: props.formFieldsOptions, ...props.formConf.printConfig });
}
function updatePrintConfig(data) {
  const form = state.conditionType == 'print' ? 'printConfig' : state.conditionType == 'audit' ? 'autoAuditRule' : 'autoRejectRule';
  props.formConf[form] = { ...props.formConf[form], ...data };
}
function handlePrintConfigRemove() {
  props.formConf.printConfig.matchLogic = 'and';
  props.formConf.printConfig.conditions = [];
}
function handleAddParameter() {
  props.formConf.parameterList.push({
    field: '',
    fieldValueType: 2,
    fieldValue: '',
  });
}
function onFieldValueChange(item, val, data) {
  item.fieldLabel = val ? data.fullName : '';
  item.fieldValueJnpfKey = val ? data.__config__.jnpfKey : '';
}
function onConditionDateChange(val, item) {
  if (!val) return (item.fieldLabel = '');
  const format = item.format || 'YYYY-MM-DD HH:mm:ss';
  item.fieldLabel = formatToDateTime(val, format);
}
function onConditionListChange(item, val, data) {
  if (!val) return (item.fieldLabel = '');
  const labelList = data.map((o) => o.fullName);
  item.fieldLabel = labelList.join('/');
}
function onConditionOrganizeChange(item, val, data) {
  if (!val) return (item.fieldLabel = '');
  item.fieldLabel = data.orgNameTree || '';
}
function onConditionObjChange(item, val, data) {
  if (!val) return (item.fieldLabel = '');
  item.fieldLabel = data.fullName || '';
}
function handleDelItem(index) {
  props.formConf.parameterList.splice(index, 1);
}
function onFieldValueTypeChange(item) {
  item.fieldValue = '';
  item.fieldLabel = '';
}
function openApproversSortListModal() {
  openApproversSortModal(true, { ids: props.formConf.approversSortList });
}
function updateApproversSortList(data) {
  props.formConf.approversSortList = data;
}
function onTimeLimitChange(val) {
  if (val == 0) props.formConf.overTimeConfig.on = 0;
}
function onOverAutoTransferChange(value) {
  if (value) props.formConf.overTimeConfig.overAutoApprove = false;
}
function onOverAutoApproveChange(value) {
  if (value) props.formConf.overTimeConfig.overAutoTransfer = false;
}
function addCustomBtn() {
  const data = {
    value: `btn_${buildBitUUID()}`,
    label: `按钮${props.formConf.customBtns.length + 1}`,
    jsJson: state.jsJson,
  };
  props.formConf.customBtns.push(data);
}
function setDefaultValue(e) {
  if (e.element.label === '') {
    const data = {
      ...e.element,
      label: `按钮${e.index + 1}`,
    };
    props.formConf.customBtns[e.index] = data;
  }
}
function editStyle(element, index) {
  state.currentBtnIndex = index;
  openStyleScriptModal(true, { text: element.jsJson || state.jsJson });
}
function updateStyleScript(data) {
  props.formConf.customBtns[state.currentBtnIndex].jsJson = data;
}
function handleSelectChange(value, fieldPath, min) {
  const keys = fieldPath.split('.');
  let obj = props.formConf;
  while (keys.length > 1) {
    const key = keys.shift();
    obj = obj[key];
  }
  const lastKey = keys[0];
  obj[lastKey] = value || min;
}
function handleDivideRule() {
  emit('updateDivideRule', props.formConf.divideRule);
}
function handleRefreshFormField() {
  if (state.formLoading == true) return;
  state.formLoading = true;
  props
    .getFormFieldList(props.formConf.formId, 'approverForm', true)
    .then(() => {
      state.formLoading = false;
    })
    .catch(() => {
      state.formLoading = false;
    });
}
</script>
<template>
  <HeaderContainer :form-conf="formConf" @on-node-name-change="updateBpmnProperties('nodeName', $event)" />
  <a-tabs v-model:active-key="activeKey" size="small" class="pane-tabs approver-pane-tabs">
    <a-tab-pane :key="1" tab="基础信息" />
    <a-tab-pane :key="2" tab="高级设置" />
    <a-tab-pane :key="3" tab="表单权限" />
    <a-tab-pane :key="5" tab="流程通知" />
    <a-tab-pane :key="6" tab="超时设置" />
  </a-tabs>
  <template v-if="activeKey !== 3">
    <a-form :colon="false" :model="formConf" class="config-content" layout="vertical">
      <template v-if="activeKey === 1">
        <template v-if="getJnpfGlobalData?.hasAloneConfigureForms">
          <a-form-item class="form-item-reload">
            <template #label>表单设置<BasicHelp text="办理节点不设置表单,默认引用发起节点表单" /></template>
            <FlowFormModal :value="formConf.formId" :title="formConf.formName" @change="onFormIdChange" placeholder="请选择" :disabled="flowState != 0" />
            <a-tooltip title="刷新表单" v-if="flowState == 0 && formConf.formId">
              <a-button @click="handleRefreshFormField">
                <ReloadOutlined :spin="formLoading" />
              </a-button>
            </a-tooltip>
          </a-form-item>
          <a-form-item v-if="true">
            <template #label>
              数据传递
              <BasicHelp :text="['不设置传递规则时字段名称相同自动赋值', '设置传递规则时相同名称字段会自动赋值字段后再按传递规则赋值']" />
            </template>
            <a-input :value="getHasAssign ? '已设置' : ''" placeholder="请设置数据传递规则" readonly class="hand" @click="openTransmitRuleBox">
              <template #suffix>
                <span class="ant-select-arrow"><DownOutlined /></span>
              </template>
            </a-input>
          </a-form-item>
        </template>
        <a-form-item label="办理设置">
          <jnpf-radio
            v-model:value="formConf.assigneeType"
            :options="typeOptions.filter((o) => o.id != 5 && o.id != 7 && o.id != 10)"
            class="type-radio"
            @change="onAssigneeTypeChange" />
          <div class="mt-[10px]" :class="{ 'mb-[10px]': formConf.assigneeType !== 3 }">
            <div v-if="[1, 2].includes(formConf.assigneeType)" class="common-tip">选择责任人</div>
            <div v-if="formConf.assigneeType === 3" class="common-tip">发起者自己将作为办理人处理办理单</div>
            <div v-if="formConf.assigneeType === 4" class="common-tip">选择流程表单字段的值作为办理人</div>
            <div v-if="formConf.assigneeType === 6" class="common-tip">指定办理人处理办理单</div>
            <div v-if="formConf.assigneeType === 9" class="common-tip">从目标接口中获取办理人</div>
          </div>
          <a-form-item class="!mb-0" v-if="formConf.assigneeType == 1">
            <div class="countersign-cell">
              <jnpf-select v-model:value="formConf.approverType" :options="unref(approverStartOptions)" class="!w-[130px]" />
              的
              <a-select v-model:value="formConf.managerLevel" placeholder="请选择" class="flex-1">
                <a-select-option v-for="item in 8" :key="item" :value="item">{{ item === 1 ? '上级责任人' : `第${item}级责任人` }}</a-select-option>
              </a-select>
            </div>
          </a-form-item>
          <a-form-item label="表单字段" class="!mb-0" v-if="formConf.assigneeType === 4">
            <a-input-group compact>
              <jnpf-select v-model:value="formConf.formFieldType" :options="formFieldTypeOptions" class="!w-[100px]" @change="onFormFieldTypeChange" />
              <jnpf-select
                v-model:value="formConf.formField"
                :options="getFormFieldOptions"
                :field-names="{ options: 'options1' }"
                show-search
                style="width: calc(100% - 100px)" />
            </a-input-group>
          </a-form-item>
          <a-form-item label="办理节点" class="!mb-0" v-if="formConf.assigneeType === 5">
            <jnpf-select v-model:value="formConf.approverNodeId" show-search :options="nodeOptions" />
          </a-form-item>
          <a-form-item class="!mb-0" v-if="formConf.assigneeType === 9">
            <div class="ant-form-item-label">
              <label class="ant-form-item-no-colon">数据接口</label>
              <BasicHelp text="请求自带参数:taskId、taskNodeId,返回结构:JSON对象{&quot;'handleId'&quot;:&quot;'id1,id2'&quot;}" />
            </div>
            <InterfaceModal :value="formConf.interfaceConfig.interfaceId" :title="formConf.interfaceConfig.interfaceName" @change="onInterfaceChange" />
            <template v-if="formConf.interfaceConfig.templateJson?.length">
              <div class="ant-form-item-label !mt-[12px]"><label class="ant-form-item-no-colon">参数设置</label></div>
              <SelectInterfaceBtn
                :template-json="formConf.interfaceConfig.templateJson"
                :field-options="funcOptions"
                :global-options="getGlobalOptions"
                is-flow
                show-field-full-label
                show-system-full-label
                @field-change="onRelationFieldChange" />
            </template>
          </a-form-item>
          <div v-if="formConf.assigneeType === 6 || formConf.assigneeType === 7">
            <jnpf-users-select
              v-model:value="formConf.approvers"
              button-type="button"
              :modal-title="formConf.assigneeType === 6 ? '添加办理人' : '添加候选人'"
              @change="onApproversChange"
              @label-change="onLabelChange" />
          </div>
          <a-form-item class="!mb-0 !mt-[10px]" v-if="formConf.assigneeType === 6 || (formConf.assigneeType === 7 && formConf.approvers?.length)">
            <template #label>
              {{ formConf.assigneeType === 6 ? '办理人范围' : '候选人范围' }}
              <BasicHelp :text="formConf.assigneeType === 6 ? '指定成员增加人员选择范围附加条件' : '候选人增加人员选择范围附加条件'" />
            </template>
            <jnpf-select v-model:value="formConf.extraRule" :options="formConf.assigneeType === 6 ? extraRuleOptions : candidateExtraRuleOptions" />
          </a-form-item>
        </a-form-item>
        <a-form-item label="办理方式">
          <jnpf-radio v-model:value="formConf.counterSign" :options="counterSignOptions" class="counterSign-radio" />
        </a-form-item>
        <a-form-item label="设置会签流转规则" v-if="formConf.counterSign == 1">
          <div class="countersign-cell mb-[10px]">
            <span class="inline-block w-[70px]">同意规则</span>
            <jnpf-select v-model:value="formConf.counterSignConfig.auditType" :options="auditTypeOptions" class="!w-[120px]" />
            <a-select v-model:value="formConf.counterSignConfig.auditRatio" class="!w-[120px]" v-if="formConf.counterSignConfig.auditType === 1">
              <a-select-option v-for="item in 10" :key="item" :value="item * 10">{{ `${item * 10}%` }}</a-select-option>
            </a-select>
            <a-input-number
              class="!w-[120px]"
              v-model:value="formConf.counterSignConfig.auditNum"
              placeholder="请输入"
              :precision="0"
              :min="1"
              @change="onSignNumberChange($event, 'auditNum')"
              v-if="formConf.counterSignConfig.auditType === 2" />
            <span>进入下一节点</span>
          </div>
          <div class="countersign-cell">
            <span class="inline-block w-[70px]">不同意规则</span>
            <jnpf-select v-model:value="formConf.counterSignConfig.rejectType" :options="rejectTypeOptions" class="!w-[120px]" />
            <a-select v-model:value="formConf.counterSignConfig.rejectRatio" class="!w-[120px]" v-if="formConf.counterSignConfig.rejectType === 1">
              <a-select-option v-for="item in 10" :key="item" :value="item * 10">{{ `${item * 10}%` }}</a-select-option>
            </a-select>
            <a-input-number
              class="!w-[120px]"
              v-model:value="formConf.counterSignConfig.rejectNum"
              placeholder="请输入"
              :precision="0"
              :min="1"
              @change="onSignNumberChange($event, 'rejectNum')"
              v-if="formConf.counterSignConfig.rejectType === 2" />
            <span v-if="formConf.counterSignConfig.rejectType">时拒绝</span>
          </div>
        </a-form-item>
        <a-form-item v-if="formConf.counterSign == 1">
          <template #label>计算方式<BasicHelp :text="['实时计算:办理过程中实时进行规则判断', '延后计算:在所有办理人办理完成后进行规则判断']" /></template>
          <jnpf-radio v-model:value="formConf.counterSignConfig.calculateType" :options="calculateTypeOptions" />
        </a-form-item>
        <a-form-item label="设置依次办理顺序" v-if="getCanSetApproversSort">
          <a-button pre-icon="icon-ym icon-ym-btn-add" @click="openApproversSortListModal">设置办理顺序</a-button>
        </a-form-item>
        <a-form-item label="办理意见">
          <a-checkbox v-model:checked="formConf.hasSign">启用签名</a-checkbox>
          <div class="mt-[10px]">
            <a-checkbox v-model:checked="formConf.hasFile">启用附件</a-checkbox>
          </div>
          <jnpf-select
            v-if="formConf.hasApprovalField"
            v-model:value="formConf.approvalField"
            :options="getApprovalFieldOptions"
            :field-names="{ label: 'fieldName', options: 'options1' }"
            multiple
            class="mt-[10px]" />
        </a-form-item>
        <a-form-item label="抄送设置">
          <jnpf-users-select v-model:value="formConf.circulateUser" button-type="button" modal-title="添加抄送人" />
          <a-form-item class="!pt-[10px]">
            <template #label>抄送人范围<BasicHelp text="抄送人员增加人员选择范围附加条件" /></template>
            <jnpf-select v-model:value="formConf.extraCopyRule" :options="extraCopyRuleOptions" />
          </a-form-item>
          <a-checkbox v-model:checked="formConf.isCustomCopy">允许自选抄送人</a-checkbox>
          <div class="mt-[10px]">
            <a-checkbox v-model:checked="formConf.isInitiatorCopy">抄送给流程发起人</a-checkbox>
          </div>
          <div class="mt-[10px]">
            <a-checkbox v-model:checked="formConf.isFormFieldCopy">抄送给表单变量</a-checkbox>
          </div>
          <div v-if="formConf.isFormFieldCopy" class="common-tip my-[10px]">选择流程表单字段的值作为抄送人</div>
          <a-form-item class="!mb-0" v-if="formConf.isFormFieldCopy">
            <a-input-group compact>
              <jnpf-select v-model:value="formConf.copyFormFieldType" :options="formFieldTypeOptions" class="!w-[100px]" @change="onCopyFormFieldTypeChange" />
              <jnpf-select
                v-model:value="formConf.copyFormField"
                :options="getCopyFormFieldOptions"
                :field-names="{ options: 'options1' }"
                show-search
                style="width: calc(100% - 100px)" />
            </a-input-group>
          </a-form-item>
        </a-form-item>
      </template>
      <template v-if="activeKey === 2">
        <a-form-item label="处置操作">
          <div class="btn-cell">
            <a-checkbox v-model:checked="formConf.hasAuditBtn">办理</a-checkbox>
            <a-input v-model:value="formConf.auditBtnText" placeholder="请输入" />
          </div>
          <div class="btn-cell">
            <a-checkbox v-model:checked="formConf.hasBackBtn">退回</a-checkbox>
            <a-input v-model:value="formConf.backBtnText" placeholder="请输入" />
          </div>
          <div class="btn-cell">
            <a-checkbox v-model:checked="formConf.hasTransferBtn">转办</a-checkbox>
            <a-input v-model:value="formConf.transferBtnText" placeholder="请输入" />
          </div>
          <div class="btn-cell">
            <a-checkbox v-model:checked="formConf.hasSaveAuditBtn">暂存</a-checkbox>
            <a-input v-model:value="formConf.saveAuditBtnText" placeholder="请输入" />
          </div>
        </a-form-item>
        <a-form-item v-if="formConf.hasBackBtn">
          <template #label>退回设置<BasicHelp text="纯表单流程设置退回到发起节点无效" /></template>
          <div class="form-item-content"></div>
          <a-form-item label="被退回的节点重新提交时">
            <a-radio-group v-model:value="formConf.backType" class="counterSign-radio" @change="onBackTypeChange">
              <a-radio :value="1">重新办理<BasicHelp text="若流程为A->B->C,C退回至A,则C->A->B->C" /></a-radio>
              <a-radio :value="2">从当前节点办理<BasicHelp text="若流程为A->B->C,C退回至A,则C->A->C" /></a-radio>
              <a-radio :value="3">自定义办理<BasicHelp text="由用户选择重新办理或从当前节点办理" /></a-radio>
            </a-radio-group>
          </a-form-item>
          <a-form-item label="设置退回到的节点" class="!mb-[0px]">
            <jnpf-select v-model:value="formConf.backNodeCode" :options="backNodeCodeOptions" show-search />
          </a-form-item>
        </a-form-item>
        <a-divider><text class="approver-text">自定义按钮区</text></a-divider>
        <a-form-item class="custom-draggable-list">
          <draggable v-model="formConf.customBtns" :animation="300" group="selectItem" handle=".option-drag" item-key="value">
            <template #item="{ element, index }">
              <div class="custom-draggable-item mb-[10px]">
                <div class="custom-line-icon option-drag">
                  <i class="icon-ym icon-ym-darg"></i>
                </div>
                <a-input-group class="btn-cell ml-[15px] mr-[15px]" style="margin-bottom: 0" compact>
                  <a-input v-model:value="element.label" :maxlength="4" @blur="setDefaultValue({ element, index })" />
                  <a-button @click="editStyle(element, index)">事件</a-button>
                </a-input-group>
                <div class="close-btn custom-line-icon" @click="formConf.customBtns.splice(index, 1)">
                  <i class="icon-ym icon-ym-btn-clearn"></i>
                </div>
              </div>
            </template>
          </draggable>
          <div class="add-btn" v-if="formConf.customBtns?.length < 5">
            <a-button type="link" pre-icon="icon-ym icon-ym-btn-add" @click="addCustomBtn()">添加按钮</a-button>
          </div>
        </a-form-item>
        <a-form-item label="节点打印">
          <a-checkbox class="leading-[32px]" v-model:checked="formConf.printConfig.on">节点打印</a-checkbox>
          <template v-if="formConf.printConfig.on">
            <a-form-item label="请选择打印模板" class="!mt-[12px]">
              <jnpf-tree-select
                v-model:value="formConf.printConfig.printIds"
                :options="printTplOptions"
                multiple
                last-level
                :show-checked-strategy="TreeSelect.SHOW_CHILD" />
            </a-form-item>
            <a-form-item label="打印条件">
              <jnpf-select v-model:value="formConf.printConfig.conditionType" :options="printConditionTypeOptions" />
            </a-form-item>
            <template v-if="formConf.printConfig.conditionType == 4">
              <a-button @click="handlePrintConfig">设置打印条件</a-button>
              <div class="conditions-content" v-if="formConf.printConfig.conditions.length">
                <span @click="handlePrintConfig"> {{ getPrintConditionsContent }}</span>
                <i class="icon-ym icon-ym-delete" @click="handlePrintConfigRemove"></i>
              </div>
            </template>
          </template>
        </a-form-item>
        <a-form-item label="节点参数">
          <div class="parameter-content">
            <span>参数设置</span>
            <i class="icon-ym icon-ym-btn-add" @click="handleAddParameter"></i>
          </div>
          <a-row :gutter="8" class="condition-main mt-[10px]" v-for="(item, index) in formConf.parameterList" :key="index">
            <a-col :span="8" class="overflow-auto">
              <jnpf-select
                v-model:value="item.field"
                :options="getParameterList"
                :field-names="{ label: 'fieldName', value: 'fieldName', options: 'options1' }" />
            </a-col>
            <a-col :span="5" class="overflow-auto">
              <jnpf-select v-model:value="item.fieldValueType" :options="conditionTypeOptions" @change="onFieldValueTypeChange(item)" />
            </a-col>
            <a-col :span="9" class="overflow-auto">
              <jnpf-select
                v-model:value="item.fieldValue"
                :options="usedFormItems"
                allow-clear
                show-search
                :field-names="{ options: 'options1' }"
                class="w-100%"
                @change="(val, data) => onFieldValueChange(item, val, data)"
                v-if="item.fieldValueType === 1" />
              <div class="w-100%" v-if="item.fieldValueType === 2">
                <template v-if="item.jnpfKey === 'inputNumber'">
                  <a-input-number v-model:value="item.fieldValue" placeholder="请输入" :precision="item.precision" />
                </template>
                <template v-else-if="item.jnpfKey === 'calculate'">
                  <a-input-number v-model:value="item.fieldValue" placeholder="请输入" :precision="2" />
                </template>
                <template v-else-if="['rate', 'slider'].includes(item.jnpfKey)">
                  <a-input-number v-model:value="item.fieldValue" placeholder="请输入" />
                </template>
                <template v-else-if="item.jnpfKey === 'switch'">
                  <jnpf-switch v-model:value="item.fieldValue" />
                </template>
                <template v-else-if="item.jnpfKey === 'timePicker'">
                  <jnpf-time-picker v-model:value="item.fieldValue" :format="item.format || 'HH:mm:ss'" allow-clear />
                </template>
                <template v-else-if="['datePicker', 'createTime', 'modifyTime'].includes(item.jnpfKey)">
                  <jnpf-date-picker v-model:value="item.fieldValue" :format="item.format" allow-clear @change="onConditionDateChange($event, item)" />
                </template>
                <template v-else-if="['organizeSelect', 'currOrganize'].includes(item.jnpfKey)">
                  <jnpf-organize-select v-model:value="item.fieldValue" allow-clear @change="(val, data) => onConditionOrganizeChange(item, val, data)" />
                </template>
                <template v-else-if="item.jnpfKey === 'roleSelect'">
                  <jnpf-role-select v-model:value="item.fieldValue" allow-clear @change="(val, data) => onConditionObjChange(item, val, data)" />
                </template>
                <template v-else-if="item.jnpfKey === 'groupSelect'">
                  <jnpf-group-select v-model:value="item.fieldValue" allow-clear @change="(val, data) => onConditionObjChange(item, val, data)" />
                </template>
                <template v-else-if="['posSelect', 'currPosition'].includes(item.jnpfKey)">
                  <jnpf-pos-select v-model:value="item.fieldValue" allow-clear @change="(val, data) => onConditionOrganizeChange(item, val, data)" />
                </template>
                <template v-else-if="['userSelect', 'createUser', 'modifyUser'].includes(item.jnpfKey)">
                  <jnpf-user-select v-model:value="item.fieldValue" has-sys allow-clear @change="(val, data) => onConditionObjChange(item, val, data)" />
                </template>
                <template v-else-if="item.jnpfKey === 'usersSelect'">
                  <jnpf-users-select v-model:value="item.fieldValue" allow-clear @change="(val, data) => onConditionOrganizeChange(item, val, data)" />
                </template>
                <template v-else-if="item.jnpfKey === 'areaSelect'">
                  <jnpf-area-select
                    v-model:value="item.fieldValue"
                    :level="item.level"
                    allow-clear
                    @change="(val, data) => onConditionListChange(item, val, data)" />
                </template>
                <template v-else>
                  <a-input v-model:value="item.fieldValue" placeholder="请输入" allow-clear />
                </template>
              </div>
              <jnpf-select
                v-model:value="item.fieldValue"
                :options="getSystemFieldOptions"
                :field-names="{ label: 'label', options: 'options1' }"
                allow-clear
                class="w-100%"
                v-else-if="item.fieldValueType === 3" />
            </a-col>
            <a-col :span="2" class="text-center">
              <i class="icon-ym icon-ym-btn-clearn" @click="handleDelItem(index)"></i>
            </a-col>
          </a-row>
        </a-form-item>
        <a-form-item v-if="props.type != 1" label="分流规则">
          <jnpf-select v-model:value="formConf.divideRule" :options="divideRuleOptions" @change="handleDivideRule()" />
        </a-form-item>
      </template>
      <template v-if="activeKey === 5">
        <a-alert message="自定义通知以“消息中心-发送配置”为主,请移步设置;关闭:表示不提醒,默认:表示站内提醒" type="warning" show-icon class="!mb-[10px]" />
        <!-- 节点退回 -->
        <NoticeConfig :notice-config="formConf.backMsgConfig" type="back" v-bind="getBindValue" />
        <!-- 节点抄送 -->
        <NoticeConfig :notice-config="formConf.copyMsgConfig" type="copy" v-bind="getBindValue" />
        <!-- 节点超时 -->
        <NoticeConfig :notice-config="formConf.overTimeMsgConfig" type="overTime" v-bind="getBindValue" />
        <!-- 节点提醒 -->
        <NoticeConfig :notice-config="formConf.noticeMsgConfig" type="notice" v-bind="getBindValue" />
      </template>
      <template v-if="activeKey === 6">
        <a-form-item label="限时设置">
          <jnpf-select v-model:value="formConf.timeLimitConfig.on" :options="nodeOverTimeMsgOptions" @change="onTimeLimitChange" />
          <template v-if="formConf.timeLimitConfig.on === 1">
            <a-form-item class="!mt-[12px]" label="节点处理截止时间">
              <div class="flex items-center">
                <jnpf-select v-model:value="formConf.timeLimitConfig.nodeLimit" :options="overTimeOptions" />
                <span class="!ml-[10px] flex-shrink-0">开始</span>
              </div>
              <div class="mt-[10px]" v-if="formConf.timeLimitConfig.nodeLimit === 2">
                <jnpf-select
                  v-model:value="formConf.timeLimitConfig.formField"
                  :options="usedFormItems"
                  :field-names="{ options: 'options1' }"
                  show-search
                  allow-clear />
              </div>
              <div class="countersign-cell mt-[12px]">
                <span class="inline-block w-[85px]">流程到达节点</span>
                <a-input-number
                  v-model:value="formConf.timeLimitConfig.duringDeal"
                  @change="handleSelectChange($event, 'timeLimitConfig.duringDeal', 1)"
                  :min="1"
                  :precision="0"
                  class="!w-[90px]" />
                <span>小时后,视为超时</span>
              </div>
            </a-form-item>
            <a-form-item label="限时提醒规则" class="!mt-[12px]">
              <jnpf-select v-model:value="formConf.noticeConfig.on" :options="nodeOverTimeMsgOptions" />
            </a-form-item>
            <a-form-item v-if="formConf.noticeConfig.on === 1">
              <div class="countersign-cell">
                <span class="inline-block w-[85px]">流程到达节点</span>
                <a-input-number
                  v-model:value="formConf.noticeConfig.firstOver"
                  @change="handleSelectChange($event, 'noticeConfig.firstOver', 1)"
                  :min="1"
                  :precision="0"
                  class="!w-[90px]" />
                <span>小时,开始提醒通知</span>
              </div>
              <div class="countersign-cell mt-[12px]">
                <span class="inline-block w-[85px]">每间隔</span>
                <a-input-number
                  v-model:value="formConf.noticeConfig.overTimeDuring"
                  @change="handleSelectChange($event, 'noticeConfig.overTimeDuring', 1)"
                  :min="1"
                  :precision="0"
                  class="!w-[90px]" />
                <span>小时,提醒通知一次</span>
              </div>
              <div class="ant-form-item-label !mt-[12px]"><label class="ant-form-item-no-colon">提醒事务</label></div>
              <a-row class="block leading-[32px]">
                <a-checkbox v-model:checked="formConf.noticeConfig.overNotice">
                  提醒通知<BasicHelp text="勾选后才能进行提醒消息发送(站内信系统默认发送,第三方超时消息需在节点通知内配置)" />
                </a-checkbox>
              </a-row>
              <a-row class="block leading-[32px]" v-if="false">
                <a-checkbox v-model:checked="formConf.noticeConfig.overEvent">提醒事件<BasicHelp text="请在节点事件内配置提醒事件" /></a-checkbox>
              </a-row>
              <div class="countersign-cell mt-[12px]" v-if="formConf.noticeConfig.overEvent">
                <span class="inline-block w-[85px]">在提醒通知第</span>
                <a-input-number
                  v-model:value="formConf.noticeConfig.overEventTime"
                  @change="handleSelectChange($event, 'noticeConfig.overEventTime', 1)"
                  :min="1"
                  :precision="0"
                  class="!w-[90px]" />
                <span>次时,执行提醒事件</span>
              </div>
            </a-form-item>
          </template>
        </a-form-item>
        <a-form-item label="超时设置">
          <jnpf-select v-model:value="formConf.overTimeConfig.on" :options="nodeOverTimeMsgOptions" :disabled="formConf.timeLimitConfig.on == 0" />
        </a-form-item>
        <a-form-item v-if="formConf.overTimeConfig.on === 1">
          <div class="countersign-cell">
            <span class="inline-block w-[85px]">超时</span>
            <a-input-number
              v-model:value="formConf.overTimeConfig.firstOver"
              @change="handleSelectChange($event, 'overTimeConfig.firstOver', 0)"
              :min="0"
              :precision="0"
              class="!w-[90px]" />
            <span>小时,开始超时通知</span>
          </div>
          <div class="countersign-cell mt-[12px]">
            <span class="inline-block w-[85px]">每间隔</span>
            <a-input-number
              v-model:value="formConf.overTimeConfig.overTimeDuring"
              @change="handleSelectChange($event, 'overTimeConfig.overTimeDuring', 1)"
              :min="1"
              :precision="0"
              class="!w-[90px]" />
            <span>小时,超时通知一次</span>
          </div>
          <div class="ant-form-item-label !mt-[12px]"><label class="ant-form-item-no-colon">超时事务</label></div>
          <a-row class="block leading-[32px]">
            <a-checkbox v-model:checked="formConf.overTimeConfig.overNotice">
              超时通知<BasicHelp text="勾选后才能进行提醒消息发送(站内信系统默认发送,第三方超时消息需在节点通知内配置)" />
            </a-checkbox>
          </a-row>
          <a-row class="block leading-[32px]" v-if="false">
            <a-checkbox v-model:checked="formConf.overTimeConfig.overEvent">超时事件<BasicHelp text="请在节点事件内配置提醒事件" /></a-checkbox>
          </a-row>
          <div class="countersign-cell" v-if="formConf.overTimeConfig.overEvent">
            <span class="inline-block w-[85px]">在超时通知</span>
            <a-input-number
              v-model:value="formConf.overTimeConfig.overEventTime"
              @change="handleSelectChange($event, 'overTimeConfig.overEventTime', 1)"
              :min="1"
              :precision="0"
              class="!w-[90px]" />
            <span>次时,执行超时事件</span>
          </div>
          <a-row class="block leading-[32px]">
            <a-checkbox v-model:checked="formConf.overTimeConfig.overAutoApprove" @change="onOverAutoApproveChange(formConf.overTimeConfig.overAutoApprove)">
              超时自动办理
              <BasicHelp text="当前办理节点表单必填字段为空工单流转时不做校验,下一办理节点设置候选人员、选择分支、异常节点时当前办理节点规则失效" />
            </a-checkbox>
          </a-row>
          <div class="countersign-cell" v-if="formConf.overTimeConfig.overAutoApprove">
            <span class="inline-block w-[85px]">在超时通知</span>
            <a-input-number
              v-model:value="formConf.overTimeConfig.overAutoApproveTime"
              @change="handleSelectChange($event, 'overTimeConfig.overAutoApproveTime', 1)"
              :min="1"
              :precision="0"
              class="!w-[90px]" />
            <span>次,执行超时自动办理</span>
          </div>
          <a-row class="block leading-[32px]">
            <a-checkbox v-model:checked="formConf.overTimeConfig.overAutoTransfer" @change="onOverAutoTransferChange(formConf.overTimeConfig.overAutoTransfer)">
              超时自动转办
            </a-checkbox>
          </a-row>
          <template v-if="formConf.overTimeConfig.overAutoTransfer">
            <div class="countersign-cell">
              <span class="inline-block w-[85px]">在超时通知</span>
              <a-input-number
                v-model:value="formConf.overTimeConfig.overAutoTransferTime"
                @change="handleSelectChange($event, 'overTimeConfig.overAutoTransferTime', 1)"
                :min="1"
                :precision="0"
                class="!w-[90px]" />
              <span>次,执行超时自动转办</span>
            </div>
            <div class="transfer-tip !mt-[12px]">转办人设置</div>
            <jnpf-radio v-model:value="formConf.overTimeConfig.overTimeType" :options="transferTypeOptions" />
            <div v-if="formConf.overTimeConfig.overTimeType === 6" class="common-tip !mt-[12px]">指定转办人处理办理单</div>
            <div v-if="formConf.overTimeConfig.overTimeType === 9" class="common-tip !mt-[12px]">从目标接口中获取办理人</div>
            <div v-if="formConf.overTimeConfig.overTimeType === 11" class="common-tip !mt-[12px]">选择与超时办理人相关的设置</div>
          </template>
        </a-form-item>
        <template v-if="formConf.overTimeConfig.overAutoTransfer && formConf.overTimeConfig.on === 1">
          <a-form-item v-if="formConf.overTimeConfig.overTimeType === 6">
            <jnpf-user-select v-model:value="formConf.overTimeConfig.reApprovers" button-type="button" modal-title="添加转办人" />
          </a-form-item>
          <a-form-item class="!mt-[10px]" v-if="formConf.overTimeConfig.overTimeType === 11">
            <jnpf-select v-model:value="formConf.overTimeConfig.overTimeExtraRule" :options="overTimeRuleOptions" />
          </a-form-item>
          <a-form-item v-if="formConf.overTimeConfig.overTimeType === 9">
            <div class="ant-form-item-label">
              <label class="ant-form-item-no-colon">数据接口</label>
              <BasicHelp text="请求自带参数:taskId、taskNodeId,返回结构:JSON对象{&quot;'handleId'&quot;:&quot;'id1,id2'&quot;}" />
            </div>
            <InterfaceModal
              :value="formConf.overTimeConfig.interfaceId"
              :title="formConf.overTimeConfig.interfaceName"
              @change="onOverTimeConfigInterfaceChange" />
            <template v-if="formConf.overTimeConfig.templateJson?.length">
              <div class="ant-form-item-label !mt-[12px]"><label class="ant-form-item-no-colon">参数设置</label></div>
              <SelectInterfaceBtn
                :template-json="formConf.overTimeConfig.templateJson"
                :field-options="funcOptions"
                :global-options="getGlobalOptions"
                is-flow
                show-field-full-label
                show-system-full-label
                @field-change="onRelationFieldChange" />
            </template>
          </a-form-item>
        </template>
      </template>
    </a-form>
  </template>
  <!-- 表单权限 -->
  <template v-else>
    <a-table :data-source="formConf.formOperates" :columns="formOperatesColumns" size="small" :pagination="false" :scroll="{ y: 'calc(100vh - 197px)' }">
      <template #headerCell="{ column }">
        <template v-if="column.key === 'write'">
          <a-checkbox v-model:checked="readAllChecked" :indeterminate="isReadIndeterminate" @change="handleCheckAllChange($event, 1)">查看</a-checkbox>
          <a-checkbox v-model:checked="writeAllChecked" :indeterminate="isWriteIndeterminate" @change="handleCheckAllChange($event, 2)">编辑</a-checkbox>
          <a-checkbox v-model:checked="requiredAllChecked" :indeterminate="isRequiredIndeterminate" @change="handleCheckAllChange($event, 3)">
            必填
          </a-checkbox>
        </template>
      </template>
      <template #bodyCell="{ column, record }">
        <template v-if="column.key === 'write'">
          <a-checkbox v-model:checked="record.read" @change="handleCheckedChange">查看</a-checkbox>
          <a-checkbox v-model:checked="record.write" @change="handleCheckedChange">编辑</a-checkbox>
          <a-checkbox v-model:checked="record.required" :disabled="record.requiredDisabled" @change="handleCheckedChange">必填</a-checkbox>
        </template>
      </template>
    </a-table>
  </template>
  <AssignRuleModal @register="registerAssignRuleModal" v-bind="getAssignBindValue" />
  <ConditionModal @register="registerConditionModal" @confirm="updatePrintConfig" />
  <ApproversSortModal @register="registerApproversSortModal" @confirm="updateApproversSortList" />
  <StyleScript type="workflow" @register="registerStyleScriptModal" @confirm="updateStyleScript" />
</template>