htui-yllkbz 1.3.16 → 1.3.17

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,860 @@
1
+ <template>
2
+ <div>
3
+ <!-- 选择部门 -->
4
+ <template v-if="
5
+ state.configJson['departmentId'] &&
6
+ state.configJson['departmentId'].show
7
+ ">
8
+ <!-- multiple: state.configJson['departmentId'].multiple, -->
9
+ <el-cascader v-if="!state.configJson['departmentId'].panel"
10
+ :disabled="!!disabled"
11
+ class="component-item"
12
+ :class="comClass"
13
+ :style="comStyle || ''"
14
+ :clearable="state.configJson['departmentId'].clearable"
15
+ :placeholder="`请选择部门`"
16
+ :collapse-tags="state.configJson['departmentId'].collapseTags"
17
+ v-model="state.selectVal['departmentId']"
18
+ :show-all-levels="state.configJson['departmentId'].showAllLevels"
19
+ :props="{
20
+ label: 'name',
21
+ value: 'id',
22
+ children: 'children',
23
+ expandTrigger: 'click',
24
+ emitPath: false,
25
+ checkStrictly: state.configJson['departmentId'].checkStrictly,
26
+ multiple: state.configJson['departmentId'].multiple,
27
+ }"
28
+ @click.native="selectClick($event)"
29
+ ref="departmentId"
30
+ @change="setSelctData('departmentId')"
31
+ :options="organizationUsersTree">
32
+ </el-cascader>
33
+ <el-cascader-panel v-if="state.configJson['departmentId'].panel"
34
+ class="component-item"
35
+ :class="comClass"
36
+ :style="comStyle || ''"
37
+ :placeholder="`请选择部门`"
38
+ v-model="state.selectVal['departmentId']"
39
+ :props="{
40
+ label: 'name',
41
+ value: 'id',
42
+ children: 'children',
43
+ expandTrigger: 'click',
44
+ emitPath: false,
45
+ checkStrictly: state.configJson['departmentId'].checkStrictly,
46
+ multiple: state.configJson['departmentId'].multiple,
47
+ }"
48
+ ref="departmentId"
49
+ @change="setSelctData('departmentId')"
50
+ :options="organizationUsersTree">
51
+ <template slot-scope="{ data }">
52
+ <span>{{ data.label }}</span>
53
+ </template>
54
+ </el-cascader-panel>
55
+ </template>
56
+ <!-- 选择人员 -->
57
+ <el-select v-model="state.selectVal['userId']"
58
+ placeholder="请选择人员"
59
+ :disabled="!!disabled"
60
+ :style="comStyle || ''"
61
+ class="component-item"
62
+ @click.native="selectClick($event)"
63
+ v-if="state.configJson['userId'] && state.configJson['userId'].show"
64
+ :multiple="state.configJson['userId'].multiple">
65
+ <el-option v-for="item in userDataList"
66
+ :key="item.id"
67
+ :label="item.value"
68
+ :value="item.id"
69
+ :title="`所在部门:${item.organizationNames}`">
70
+ <span>
71
+ <p class="ht-user-dot"
72
+ :class="
73
+ item.dutyOfficer && !item.dutyOfficer.status
74
+ ? 'ht-user-dot-disabled'
75
+ : ''
76
+ "
77
+ v-if="item.dutyOfficer"></p>
78
+ <p class="ht-user-name"
79
+ :class="
80
+ item.dutyOfficer && !item.dutyOfficer.status
81
+ ? 'ht-user-disabled'
82
+ : ''
83
+ ">
84
+ {{ item.value
85
+ }}<span v-if="item.phoneNumber"> ({{ item.phoneNumber }}) </span>
86
+ </p>
87
+ </span>
88
+ </el-option>
89
+ </el-select>
90
+ <!-- 选择部门下人员 -->
91
+ <template v-if="
92
+ state.configJson['departmentUser'] &&
93
+ state.configJson['departmentUser'].show
94
+ ">
95
+ <el-cascader v-if="!state.configJson['departmentUser'].panel"
96
+ :disabled="!!disabled"
97
+ class="component-item"
98
+ :class="comClass"
99
+ :style="comStyle || ''"
100
+ :clearable="state.configJson['departmentUser'].clearable"
101
+ :placeholder="`请选择部门下人员`"
102
+ :collapse-tags="state.configJson['departmentUser'].collapseTags"
103
+ v-model="state.selectVal['departmentUser']"
104
+ :show-all-levels="state.configJson['departmentUser'].showAllLevels"
105
+ :props="{
106
+ label: 'name',
107
+ value: 'id',
108
+ children: 'childrenList',
109
+ expandTrigger: 'click',
110
+ emitPath: false,
111
+ checkStrictly: state.configJson['departmentUser'].checkStrictly,
112
+ multiple: state.configJson['departmentUser'].multiple,
113
+ }"
114
+ ref="departmentUser"
115
+ @click.native="selectClick($event)"
116
+ @change="setSelctData('departmentUser')"
117
+ :options="organizationUsersTreeUser">
118
+ <template slot-scope="{ data }">
119
+ <p class="ht-user-dot"
120
+ style="
121
+ padding: 0;
122
+ margin: 0;
123
+ float: left;
124
+ width: 14px;
125
+ height: 14px;
126
+ background: #4ecc7a;
127
+ line-height: 34px;
128
+ margin-top: 10px;
129
+ border-radius: 10px;
130
+ margin-right: 4px;
131
+ "
132
+ :style="
133
+ data.dutyOfficer && !data.dutyOfficer.status
134
+ ? 'background: #ccc;'
135
+ : ''
136
+ "
137
+ v-if="data.dutyOfficer"></p>
138
+ <p class="ht-user-name"
139
+ style="padding: 0; margin: 0; float: left"
140
+ :style="
141
+ data.dutyOfficer && !data.dutyOfficer.status ? 'color:#ddd' : ''
142
+ ">
143
+ {{ data.label }}
144
+ </p>
145
+ </template>
146
+ </el-cascader>
147
+ <el-cascader-panel v-else
148
+ :style="panStyle"
149
+ class="component-item"
150
+ :placeholder="`请选择部门下人员`"
151
+ v-model="state.selectVal['departmentUser']"
152
+ :props="{
153
+ label: 'name',
154
+ value: 'id',
155
+ children: 'childrenList',
156
+ expandTrigger: 'click',
157
+ emitPath: false,
158
+ checkStrictly: state.configJson['departmentUser'].checkStrictly,
159
+ multiple: state.configJson['departmentUser'].multiple,
160
+ }"
161
+ ref="departmentUser"
162
+ @change="setSelctData('departmentUser')"
163
+ :options="organizationUsersTreeUser">
164
+ <template slot-scope="{ data }">
165
+ <p class="ht-user-dot"
166
+ style="
167
+ padding: 0;
168
+ margin: 0;
169
+ float: left;
170
+ width: 14px;
171
+ height: 14px;
172
+ background: #4ecc7a;
173
+ line-height: 34px;
174
+ margin-top: 10px;
175
+ border-radius: 10px;
176
+ margin-right: 4px;
177
+ "
178
+ :style="
179
+ data.dutyOfficer && !data.dutyOfficer.status
180
+ ? 'background: #ccc;'
181
+ : ''
182
+ "
183
+ v-if="data.dutyOfficer"></p>
184
+ <p class="ht-user-name"
185
+ style="padding: 0; margin: 0; float: left"
186
+ :style="
187
+ data.dutyOfficer && !data.dutyOfficer.status ? 'color:#ddd' : ''
188
+ ">
189
+ {{ data.label }}
190
+ </p>
191
+ </template>
192
+ </el-cascader-panel>
193
+ </template>
194
+ <!-- 基础数据分类 -->
195
+ <template v-for="item in state.resData.dictionaryCategory.items">
196
+ <!-- 选择严重等级 -->
197
+ <template v-if="item.code == 'SeverityLevel'">
198
+ <el-select v-if="state.configJson[item.code] && state.configJson[item.code].show"
199
+ v-model="state.selectVal[item.code]"
200
+ :disabled="!!disabled"
201
+ :key="item.id"
202
+ :style="comStyle || ''"
203
+ placeholder="请选择严重等级"
204
+ filterable
205
+ class="component-item"
206
+ @click.native="selectClick($event)"
207
+ @change="setSelctItem(item.code)">
208
+ <el-option v-for="item in SeverityLevel"
209
+ :key="item.id"
210
+ :style="panStyle"
211
+ :label="item.name"
212
+ :value="`${item.value}`"
213
+ :title="`${item.name}(${item.value})`">
214
+ <span>
215
+ <b class="item-origin"
216
+ :style="{
217
+ 'border-color': `${item.color}`,
218
+ }"></b>
219
+ {{ item.name }}
220
+ </span>
221
+ <span v-if="item.phoneNumber"> ({{ item.phoneNumber }}) </span>
222
+ </el-option>
223
+ </el-select>
224
+ </template>
225
+ <!-- 选择响应列表 -->
226
+ <template v-else-if="item.code == 'ResponseList'">
227
+ <el-select v-if="state.configJson[item.code] && state.configJson[item.code].show"
228
+ v-model="state.selectVal[item.code]"
229
+ :key="item.id"
230
+ :disabled="!!disabled"
231
+ :style="comStyle || ''"
232
+ placeholder="请选择响应列表"
233
+ filterable
234
+ class="component-item"
235
+ @click.native="selectClick($event)"
236
+ @change="setSelctItem(item.code)">
237
+ <el-option v-for="item in ResponseList"
238
+ :key="item.id"
239
+ :style="panStyle"
240
+ :label="item.name"
241
+ :value="item.value"
242
+ :title="`${item.name}(${item.value})`">
243
+ <span>
244
+ <b v-if="item.color"
245
+ class="item-origin"
246
+ :style="{
247
+ 'border-color': `${item.color}`,
248
+ }"></b>
249
+ {{ item.name }}
250
+ </span>
251
+ <span v-if="item.phoneNumber"> ({{ item.phoneNumber }}) </span>
252
+ </el-option>
253
+ </el-select>
254
+ </template>
255
+ <!-- 基础数据级联选择 -->
256
+ <template v-else>
257
+ <template v-if="state.configJson[item.code] && state.configJson[item.code].show">
258
+ <el-cascader v-if="!state.configJson[item.code].panel"
259
+ :placeholder="`请选择${item.name}`"
260
+ :disabled="!!disabled"
261
+ class="component-item"
262
+ :style="comStyle || ''"
263
+ :key="item.id"
264
+ :clearable="state.configJson[item.code].clearable"
265
+ @click.native="selectClick($event)"
266
+ v-model="state.selectVal[item.code]"
267
+ :collapse-tags="state.configJson[item.code].collapseTags"
268
+ :show-all-levels="state.configJson[item.code].showAllLevels"
269
+ :props="{
270
+ label: 'name',
271
+ value: 'id',
272
+ children: 'children',
273
+ expandTrigger: 'click',
274
+ emitPath: false,
275
+ checkStrictly: state.configJson[item.code].checkStrictly,
276
+ multiple: state.configJson[item.code].multiple,
277
+ }"
278
+ :ref="`${item.code}`"
279
+ @change="setSelctData(item.code)"
280
+ :options="getbaseDataInfo[item.id]"></el-cascader>
281
+ <el-cascader-panel v-else
282
+ @click.native="selectClick($event)"
283
+ :placeholder="`请选择${item.name}`"
284
+ class="component-item"
285
+ :key="item.id"
286
+ :style="panStyle"
287
+ v-model="state.selectVal[item.code]"
288
+ :props="{
289
+ label: 'name',
290
+ value: 'id',
291
+ children: 'children',
292
+ expandTrigger: 'click',
293
+ emitPath: false,
294
+ checkStrictly: state.configJson[item.code].checkStrictly,
295
+ multiple: state.configJson[item.code].multiple,
296
+ }"
297
+ :ref="`${item.code}`"
298
+ @change="setSelctData(item.code)"
299
+ :options="getbaseDataInfo[item.id]"></el-cascader-panel>
300
+ </template>
301
+ </template>
302
+ </template>
303
+ <!-- <div>
304
+ <h2>12456</h2>
305
+ <div
306
+ is="common-datas-info"
307
+ :config-json="JSON.stringify({departmentId:{show:true}})"
308
+ ></div>
309
+ </div> -->
310
+ </div>
311
+ </template>
312
+
313
+ <script lang="ts">
314
+ import { Vue, Prop, Emit, Component, Watch } from "vue-property-decorator";
315
+
316
+ import {
317
+ BaseDataDto,
318
+ DictionaryCategoryDto,
319
+ DictionaryDataDto,
320
+ SeverityLevelDto,
321
+ } from "@/plugins/commonApi";
322
+ /* eslint-disable @typescript-eslint/camelcase */
323
+ import {
324
+ ListResultDto_1OfOfOrganizationUnitWithUsersAndContractsAnd_0AndCulture_neutralAndPublicKeyToken_null,
325
+ OrganizationUnitWithDetailsDto,
326
+ OrganizationUnitDto,
327
+ } from "@/plugins/Auth";
328
+ import { _axios, baseConfig } from "vue-kst-auth";
329
+ interface Inuser {
330
+ concurrencyStamp: string;
331
+ email: string;
332
+ emailConfirmed: boolean;
333
+ extraProperties: any;
334
+ id: string;
335
+ isLockedOut: boolean;
336
+ lockoutEnabled: boolean;
337
+ name: string;
338
+ organizationIds: string[];
339
+ phoneNumber: string;
340
+ phoneNumberConfirmed: boolean;
341
+ surname: string;
342
+ tenantId: string;
343
+ userName: string;
344
+ value: string;
345
+ }
346
+ /** 部门树类型 */
347
+ interface InDeparentTree {
348
+ children: Array<InDeparentTree>;
349
+ code: string;
350
+ creationTime: string;
351
+ creatorId: string;
352
+ deleterId: string;
353
+ deletionTime: string;
354
+ displayName: string;
355
+ extraProperties: any;
356
+ id: string;
357
+ isDeleted: boolean;
358
+ label: string;
359
+ name: string;
360
+ lastModificationTime: string;
361
+ lastModifierId: string;
362
+ parentId: string;
363
+ roles: any[];
364
+ users: Array<Inuser>;
365
+ }
366
+ /** 基础数据树声明 */
367
+ interface InNode {
368
+ children: Array<InNode>;
369
+ config: any;
370
+ data?: BaseDataDto;
371
+ hasChildren: boolean;
372
+ label: string | undefined;
373
+ level: number;
374
+ loaded: boolean;
375
+ loading: boolean;
376
+ parent: Node;
377
+ path: Array<any>;
378
+ pathLabels: Array<any>;
379
+ pathNodes: Array<any>;
380
+ uid: number;
381
+ value: string;
382
+ isDisabled: boolean | null;
383
+ leaf: boolean;
384
+ }
385
+ /** 基础数据部门树声明 */
386
+ interface InNodeDepaent {
387
+ children: Array<InNode>;
388
+ config: any;
389
+ data?: InDeparentTree;
390
+ hasChildren: boolean;
391
+ label: string | undefined;
392
+ level: number;
393
+ loaded: boolean;
394
+ loading: boolean;
395
+ parent: Node;
396
+ path: Array<any>;
397
+ pathLabels: Array<any>;
398
+ pathNodes: Array<any>;
399
+ uid: number;
400
+ value: string;
401
+ isDisabled: boolean | null;
402
+ leaf: boolean;
403
+ }
404
+ interface State {
405
+ /** api返回数据 */
406
+ resData: {
407
+ /** 基础数据 */
408
+ baseData: {
409
+ items: BaseDataDto[];
410
+ };
411
+ /** 字典类别 */
412
+ dictionaryCategory: {
413
+ items: DictionaryCategoryDto[];
414
+ };
415
+ /** 字典数据 */
416
+ dictionaryData: DictionaryDataDto[];
417
+ /** 严重等级 */
418
+ severityLevel: SeverityLevelDto[];
419
+ /** 部门 */
420
+ organizationUnit: OrganizationUnitWithDetailsDto[];
421
+ /** 部门树结构 */
422
+ organizationUsersTree: any[];
423
+ /** 用户 */
424
+ users: {
425
+ items?: Array<Inuser>;
426
+ };
427
+ /** 当前登录用户相关信息 */
428
+ SessionState: any;
429
+ /** 当前登录用户所在部门 */
430
+ userInOrganiza: OrganizationUnitDto[];
431
+ organizationUsers: ListResultDto_1OfOfOrganizationUnitWithUsersAndContractsAnd_0AndCulture_neutralAndPublicKeyToken_null;
432
+ };
433
+ /** 下拉框 */
434
+ selectVal: {
435
+ [key: string]: undefined | string | string[];
436
+ };
437
+ /** 下拉框选中数据对象 */
438
+ selectValData: {
439
+ [key: string]: Array<any>;
440
+ };
441
+ /** 配置文件 */
442
+ configJson: {
443
+ [key: string]: {
444
+ /** 名称介绍 */
445
+ name: string;
446
+ /** 是否显示 */
447
+ show: boolean;
448
+ /** 是否多选 */
449
+ multiple: boolean;
450
+ /** 显示 */
451
+ collapseTags: boolean;
452
+ /** 唯一字段 */
453
+ code: string;
454
+ data: {};
455
+ /** 级联适用,是否严格的遵守父子节点不互相关联 */
456
+ checkStrictly: boolean;
457
+ /** 级联面板显示 */
458
+ panel: boolean;
459
+ /** 仅显示最后一级 */
460
+ showAllLevels: boolean;
461
+ /** 接收下拉显示唯一值,id/value等 */
462
+ key?: string | string[];
463
+ };
464
+ };
465
+ }
466
+ @Component({
467
+ name: "HtBaseData",
468
+ components: {},
469
+ })
470
+ export default class CommonDatas extends Vue {
471
+ /** 配置数据 */
472
+ @Prop() configJson?: string;
473
+ /** 自定义class */
474
+ @Prop() comClass?: string;
475
+ /** 自定义style */
476
+ @Prop() comStyle?: string;
477
+ /** 自定义style */
478
+ @Prop() panStyle?: string;
479
+ /** 所属部门 */
480
+ @Prop() org?: string;
481
+ /** 是否禁用 */
482
+ @Prop() disabled?: string;
483
+
484
+ /** 人员 */
485
+ /** 数据 */
486
+ state: State = {
487
+ resData: {
488
+ baseData: {
489
+ items: [],
490
+ },
491
+ dictionaryCategory: {
492
+ items: [],
493
+ },
494
+ dictionaryData: [],
495
+ severityLevel: [],
496
+ organizationUnit: [],
497
+ organizationUsersTree: [],
498
+ users: {
499
+ items: [],
500
+ },
501
+ SessionState: "",
502
+ userInOrganiza: [],
503
+ organizationUsers:
504
+ new ListResultDto_1OfOfOrganizationUnitWithUsersAndContractsAnd_0AndCulture_neutralAndPublicKeyToken_null(),
505
+ },
506
+ selectVal: {},
507
+ selectValData: {},
508
+ configJson: {},
509
+ };
510
+ /** 生命周期 */
511
+ created() {
512
+ this.rewriteGetComputedStyle();
513
+ if (!baseConfig.getLoginState()) {
514
+ return;
515
+ }
516
+ const data = window.localStorage.getItem("commonDatas");
517
+ if (data) {
518
+ this.state.resData = Object.assign(this.state.resData, JSON.parse(data));
519
+ }
520
+ // 初始化配置文件
521
+ if (this.configJson) {
522
+ this.state.configJson = JSON.parse(this.configJson);
523
+ } else {
524
+ const { items } = this.state.resData.dictionaryCategory;
525
+ let configJson: any = {
526
+ departmentId: {
527
+ name: "部门树结构",
528
+ show: true,
529
+ showAllLevels: false,
530
+ multiple: false,
531
+ code: "departmentId",
532
+ data: {},
533
+ checkStrictly: true,
534
+ panel: false,
535
+ },
536
+ departmentUser: {
537
+ name: "部门下人员",
538
+ show: true,
539
+ showAllLevels: false,
540
+ multiple: false,
541
+ code: "departmentUser",
542
+ data: {},
543
+ checkStrictly: false,
544
+ panel: false,
545
+ },
546
+ userId: {
547
+ name: "部门人员",
548
+ show: true,
549
+ showAllLevels: false,
550
+ multiple: false,
551
+ code: "userId",
552
+ data: {},
553
+ checkStrictly: false,
554
+ panel: false,
555
+ },
556
+ };
557
+ items.forEach((item) => {
558
+ configJson = {
559
+ ...configJson,
560
+ [item.code as string]: {
561
+ name: item.name,
562
+ show: true,
563
+ showAllLevels: false,
564
+ multiple: true,
565
+ collapseTags: true,
566
+ code: item.code,
567
+ data: {},
568
+ checkStrictly: true,
569
+ panel: false,
570
+ key: "a1c72763-0ed5-0ba8-5131-39fdf96dfe9a",
571
+ },
572
+ };
573
+ });
574
+ // name: "设备系统分类",
575
+ // show: true,
576
+ // showAllLevels: true,
577
+ // multiple: false,
578
+ // code: "DeviceSystemType",
579
+ // data: {},
580
+ // checkStrictly: true,
581
+ // panel: false,
582
+ // key: this.state.editNodeData.systemType,
583
+ // };
584
+
585
+ this.state.configJson = { ...configJson };
586
+ }
587
+ for (const key in this.state.configJson) {
588
+ if (Object.prototype.hasOwnProperty.call(this.state.configJson, key)) {
589
+ const element = this.state.configJson[key];
590
+
591
+ this.$set(this.state.selectVal, key, element.key || "");
592
+ }
593
+ }
594
+ }
595
+ /** 方法 */
596
+ /** 重写window的一个方法,解决web components组件获取样式报错问题 */
597
+ rewriteGetComputedStyle() {
598
+ const getComputedStyle = window.getComputedStyle;
599
+ window.getComputedStyle = function (element: any, property) {
600
+ return getComputedStyle(element.host || element, property);
601
+ };
602
+ }
603
+ /** 设置下拉数据 */
604
+ setSelctItem(key: string) {
605
+ const code = this.state.selectVal[key];
606
+ let codelist: string[];
607
+ if (!Array.isArray(code)) {
608
+ codelist = code ? code.toString().split(",") : [];
609
+ }
610
+ switch (key) {
611
+ case "SeverityLevel":
612
+ this.state.selectValData[key] = this.SeverityLevel.filter((item) =>
613
+ codelist.some((val) => val == item.value?.toString())
614
+ );
615
+ break;
616
+ case "ResponseList":
617
+ this.state.selectValData[key] = this.SeverityLevel.filter((item) =>
618
+ codelist.some((val) => val == item.id)
619
+ );
620
+ break;
621
+
622
+ default:
623
+ break;
624
+ }
625
+ }
626
+ /** 动态设置显示面板位置 */
627
+
628
+ selectClick(e: any) {
629
+ // 下拉选择框列表
630
+ //const list = window.document.getElementsByClassName("el-select-dropdown");
631
+ // (list as any).forEach((element: any) => {
632
+ // // element.style.top = `${e.clientY - e.layerY + e.target.offsetHeight}px`;
633
+ // // element.style.left = `${e.clientX - e.layerX}px`;
634
+ // element.style.zIndex = 3000;
635
+ // });
636
+ // // 级联下拉列表
637
+ // const list01 = window.document.getElementsByClassName(
638
+ // "el-cascader__dropdown"
639
+ // );
640
+ // (list01 as any).forEach((element: any) => {
641
+ // // element.style.top = `${e.clientY - e.layerY + e.target.offsetHeight}px`;
642
+ // // element.style.left = `${e.clientX - e.layerX}px`;
643
+ // // element.style.position = "absolute";
644
+ // element.style.zIndex = 3000;
645
+ // });
646
+ }
647
+ /** 设置下拉数据(级联选择) */
648
+ setSelctData(key: string) {
649
+ const ref: any | undefined = (this.$refs[key] as any)[0] || this.$refs[key];
650
+ const checkList = ref ? ref.getCheckedNodes() : [];
651
+ /** 过滤在多选模式下,Tag时触发删除 */
652
+ const checkNodes = checkList.filter((item: any) => {
653
+ return this.state.selectVal[key]?.includes(item.data.id);
654
+ });
655
+ this.state.selectValData[key] = [];
656
+ if (checkNodes && checkNodes.length && checkNodes[0] !== null) {
657
+ checkNodes.forEach(
658
+ (item: { data?: { id: string; name: string } } | undefined) => {
659
+ const { data } = item || { data: "" };
660
+ if (data && !this.state.selectValData[key].includes(data)) {
661
+ this.state.selectValData[key].push(data);
662
+ }
663
+ }
664
+ );
665
+ }
666
+ this.$emit("change", this.state.selectValData);
667
+ }
668
+ /** 基础数据递归处理 */
669
+ recursion(data: Array<BaseDataDto>) {
670
+ return data.reduce((prv: BaseDataDto[], cur) => {
671
+ if (cur.children && cur.children.length > 0) {
672
+ this.recursion(cur.children);
673
+ } else {
674
+ cur.children = undefined;
675
+ }
676
+ prv.push(cur);
677
+ return prv;
678
+ }, []);
679
+ }
680
+ /** 计算属性 */
681
+ /** 根据基础数据分类获取详细数据 */
682
+ get getbaseDataInfo() {
683
+ const body: { [key: string]: Array<BaseDataDto> } = {};
684
+ /** 获取基础数据列表 */
685
+ const { items: baseItems } = this.state.resData.baseData;
686
+ this.state.resData.dictionaryCategory.items.forEach((item) => {
687
+ body[item.id || ""] = [];
688
+ if (this.org) {
689
+ body[item.id || ""] = this.recursion(
690
+ baseItems.filter(
691
+ (val) =>
692
+ val.category == item.code &&
693
+ val.organizationUnits?.includes(this.org as string)
694
+ )
695
+ );
696
+ } else {
697
+ body[item.id || ""] = this.recursion(
698
+ baseItems.filter((val) => val.category == item.code)
699
+ );
700
+ }
701
+ });
702
+ return body;
703
+ }
704
+ /** 获取响应列表 */
705
+ get ResponseList() {
706
+ return (
707
+ this.state.resData.dictionaryData.filter(
708
+ (val) => val.categoryCode == "ResponseList"
709
+ ) || []
710
+ );
711
+ }
712
+ /** 获取严重等级 */
713
+ get SeverityLevel() {
714
+ return this.state.resData.severityLevel || [];
715
+ }
716
+ /** 获取用户数据 */
717
+ get userDataList() {
718
+ return this.state.resData.users.items || [];
719
+ }
720
+ /** 获取部门树结构 */
721
+ get organizationUsersTree() {
722
+ const org = this.org;
723
+ /** 递归处理 */
724
+ function recursion(data: Array<any>) {
725
+ return data.reduce((prv: any[], cur) => {
726
+ cur.name = cur.displayName;
727
+ if (cur.children && cur.children.length > 0) {
728
+ recursion(cur.children);
729
+ } else {
730
+ cur.children = undefined;
731
+ }
732
+ prv.push(cur);
733
+ return prv;
734
+ }, []);
735
+ }
736
+ const data = recursion(this.state.resData.organizationUsersTree);
737
+ if (org) {
738
+ const orgData: any[] = [];
739
+ function filter(items: any[]) {
740
+ for (let i = 0; i < items.length; i++) {
741
+ const item = items[i];
742
+ if (org?.includes(item.id)) {
743
+ orgData.push(item);
744
+ } else {
745
+ item.children && filter(item.children);
746
+ }
747
+ }
748
+ }
749
+ filter(data);
750
+ return orgData;
751
+ }
752
+ return data;
753
+ }
754
+
755
+ /** 获取部门人员树结构 */
756
+ get organizationUsersTreeUser() {
757
+ /** 递归处理 */
758
+ function recursion(
759
+ data: Array<{
760
+ users?: any[];
761
+ children?: any[];
762
+ childrenList: any[] | undefined;
763
+ }>
764
+ ) {
765
+ return data.reduce((prv: any[], cur) => {
766
+ /** 合并部门人员数据 */
767
+ cur.childrenList = [];
768
+ if (cur.users) {
769
+ cur.users.map((item) => {
770
+ item.name =
771
+ item.surname || item.name
772
+ ? `${item.surname}${item.name}`
773
+ : item.userName;
774
+ item.childrenList = undefined;
775
+
776
+ return item;
777
+ });
778
+ }
779
+ if (cur.children && cur.children.length > 0) {
780
+ recursion(cur.children);
781
+ } else {
782
+ cur.children = undefined;
783
+ }
784
+ if (cur.children) {
785
+ cur.childrenList.push(...cur.children);
786
+ }
787
+ if (cur.users) {
788
+ cur.childrenList.push(...cur.users);
789
+ }
790
+
791
+ prv.push(cur);
792
+ return prv;
793
+ }, []);
794
+ }
795
+
796
+ return recursion(this.organizationUsersTree);
797
+ }
798
+ @Watch("configJson", { deep: true })
799
+ watchCongiJson(val: any, old: any) {
800
+ this.state.configJson = JSON.parse(val);
801
+ if (val !== old) {
802
+ for (const key in this.state.configJson) {
803
+ if (Object.prototype.hasOwnProperty.call(this.state.configJson, key)) {
804
+ const element = this.state.configJson[key];
805
+
806
+ this.$set(this.state.selectVal, key, element.key || "");
807
+ }
808
+ }
809
+ }
810
+ }
811
+ //this.state.configJson = JSON.parse(this.configJson);
812
+ }
813
+ </script>
814
+ <style lang="scss" scoped>
815
+ .component-item {
816
+ width: 100%;
817
+ + .component-item {
818
+ margin-top: 10px;
819
+ }
820
+ }
821
+ .item-origin {
822
+ border-radius: 50%;
823
+ border-width: 0px 7px;
824
+ margin-right: 6px;
825
+ border-style: solid;
826
+ }
827
+ </style>
828
+ <style lang="scss">
829
+ $primary-color: #4ecc7a;
830
+ .component-item .el-input--suffix .el-input__inner {
831
+ background: none;
832
+ height: 32px !important;
833
+ }
834
+ .component-item .is-disabled .el-input__inner {
835
+ background: #f5f5f5;
836
+ }
837
+ .ht-user-dot {
838
+ padding: 0;
839
+ margin: 0;
840
+ float: left;
841
+ width: 14px;
842
+ height: 14px;
843
+ background: $primary-color;
844
+ line-height: 34px;
845
+ margin-top: 10px;
846
+ border-radius: 10px;
847
+ margin-right: 4px;
848
+ }
849
+ .ht-user-name {
850
+ padding: 0;
851
+ margin: 0;
852
+ float: left;
853
+ }
854
+ .ht-user-dot-disabled {
855
+ background: #ccc;
856
+ }
857
+ .ht-user-disabled {
858
+ color: #ddd;
859
+ }
860
+ </style>