htui-yllkbz 1.3.16 → 1.3.19

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