htui-yllkbz 1.3.11 → 1.3.15

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.
Binary file
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "htui-yllkbz",
3
- "version": "1.3.11",
3
+ "version": "1.3.15",
4
4
  "typings": "types/index.d.ts",
5
5
  "main": "lib/htui.common.js",
6
6
  "style": "lib/htui.css",
@@ -4,7 +4,7 @@
4
4
  * @Author: hutao
5
5
  * @Date: 2021-12-30 15:47:47
6
6
  * @LastEditors: hutao
7
- * @LastEditTime: 2022-03-08 14:47:24
7
+ * @LastEditTime: 2022-04-12 17:45:27
8
8
  -->
9
9
 
10
10
  <template>
@@ -24,12 +24,19 @@
24
24
 
25
25
  </template>
26
26
  <div v-else>
27
- <div is='common-datas-info-id'
27
+ <HtShowBaseData v-if="this.value"
28
+ :hide-code="hideCode"
29
+ :base-data-id='this.value'
30
+ :base-data-info='true'
31
+ com-style="font-size:12px"
32
+ style="font-size:12px">
33
+ </HtShowBaseData>
34
+ <!-- <div is='common-datas-info-id'
28
35
  com-style="font-size:12px"
29
36
  v-if="this.value"
30
37
  :hide-code="hideCode"
31
38
  :base-data-id='this.value'
32
- :base-data-info='true'></div>
39
+ :base-data-info='true'></div> -->
33
40
  </div>
34
41
 
35
42
  </div>
@@ -37,6 +44,7 @@
37
44
  </template>
38
45
  <script lang='ts'>
39
46
  import { Component, Prop, Vue, Watch } from "vue-property-decorator";
47
+ import HtShowBaseData from "@/packages/HtShowBaseData";
40
48
  interface State {
41
49
  /** 数据状态 */
42
50
  loading: boolean;
@@ -44,6 +52,9 @@ interface State {
44
52
  }
45
53
  @Component({
46
54
  name: "HtSelectBaseData",
55
+ components: {
56
+ HtShowBaseData,
57
+ },
47
58
  })
48
59
  export default class HtSelectBaseData extends Vue {
49
60
  @Prop() value!: string;
@@ -0,0 +1,15 @@
1
+ /*
2
+ * @Descripttion: 基础数据展示组件
3
+ * @version:
4
+ * @Author: hutao
5
+ * @Date: 2022-04-12 17:34:51
6
+ * @LastEditors: hutao
7
+ * @LastEditTime: 2022-04-12 17:43:38
8
+ */
9
+
10
+ import HtShowBaseData from "./index.vue";
11
+ (HtShowBaseData as any).install = function (Vue: any) {
12
+
13
+ Vue.component("HtShowBaseData", HtShowBaseData);
14
+ };
15
+ export default HtShowBaseData;
@@ -0,0 +1,316 @@
1
+ <template>
2
+ <div class="show-common-item">
3
+ <!-- 时间 -->
4
+ <template v-if="timeStr">
5
+ <span>
6
+ {{ timeFormat }}
7
+ </span>
8
+ </template>
9
+ <!-- 部门 -->
10
+ <template v-if="departmentId">
11
+ <span class="item"
12
+ v-for="item in departmentData"
13
+ :key="item">
14
+ {{ getorgById(item).displayName || empty }}
15
+ </span>
16
+ </template>
17
+ <!-- 用户 -->
18
+ <template v-if="userId">
19
+ <span class="item"
20
+ v-for="item in userData"
21
+ :key="item.id">
22
+ {{ item.value || empty }}
23
+ </span>
24
+ </template>
25
+ <!-- 角色 -->
26
+ <template v-if="roleId">
27
+ <span class="item"
28
+ v-for="item in roleData"
29
+ :key="item.id">
30
+ {{ item.name || empty }}
31
+ </span>
32
+ </template>
33
+ <!-- 基础数据,以id查找 -->
34
+ <template v-if="baseDataId">
35
+ <span class="item"
36
+ v-if="baseDataItem[baseDataId]">
37
+ <!-- {{ baseDataItem[baseDataId].name || empty }}
38
+ <span v-if="baseDataInfo&&!hideCode">
39
+ ({{ baseDataItem[baseDataId].value || empty }})
40
+ </span> -->
41
+ {{state.text}}
42
+ </span>
43
+ <span v-else> {{ empty }}</span>
44
+ </template>
45
+ <!-- 基础数据,以value查找 -->
46
+ <template v-if="baseDataValue">
47
+ <span class="item"
48
+ v-if="baseDataItem[baseDataValue]">
49
+ {{ baseDataItem[baseDataValue].name || empty }}
50
+ <span v-if="baseDataInfo&&!hideCode">
51
+ ({{ baseDataItem[baseDataValue].value || empty }})
52
+ </span>
53
+ </span>
54
+ <span v-else> {{ empty }}</span>
55
+ </template>
56
+ <!-- 基础数据,以namg查找 -->
57
+ <template v-if="baseDataName">
58
+ <span class="item"
59
+ v-if="baseDataItem[baseDataName]">
60
+ {{ baseDataItem[baseDataName].name || empty }}
61
+ <span v-if="baseDataInfo&&!hideCode">
62
+ ({{ baseDataItem[baseDataName].value || empty }})
63
+ </span>
64
+ </span>
65
+ <span v-else> {{ empty }}</span>
66
+ </template>
67
+ </div>
68
+ </template>
69
+
70
+ <script lang="ts">
71
+ import { Vue, Prop, Component, Watch } from "vue-property-decorator";
72
+ import { baseConfig } from "vue-kst-auth";
73
+ interface Inuser {
74
+ concurrencyStamp: string;
75
+ email: string;
76
+ emailConfirmed: boolean;
77
+ extraProperties: any;
78
+ id: string;
79
+ isLockedOut: boolean;
80
+ lockoutEnabled: boolean;
81
+ name: string;
82
+ organizationIds: string[];
83
+ phoneNumber: string;
84
+ phoneNumberConfirmed: boolean;
85
+ surname: string;
86
+ tenantId: string;
87
+ userName: string;
88
+ value: string;
89
+ }
90
+ interface State {
91
+ /** api返回数据 */
92
+ resData: {
93
+ /** 基础数据 */
94
+ baseData: {
95
+ items: any[];
96
+ };
97
+ /** 字典类别 */
98
+ dictionaryCategory: {
99
+ items: any[];
100
+ };
101
+ /** 字典数据 */
102
+ dictionaryData: any[];
103
+ /** 严重等级 */
104
+ severityLevel: any[];
105
+ /** 部门 */
106
+ organizationUnit: any[];
107
+ /** 部门树结构 */
108
+ organizationUsersTree: any[];
109
+ /** 用户 */
110
+ users: {
111
+ items?: Array<Inuser>;
112
+ };
113
+ /** 当前登录用户相关信息 */
114
+ SessionState: any;
115
+ /** 当前登录用户所在部门 */
116
+ userInOrganiza: any[];
117
+ organizationUsers: any;
118
+ roleList: any[];
119
+ };
120
+ /** 递归基础数据 */
121
+ baseDataItem: {
122
+ [key: string]: any;
123
+ };
124
+ text: string;
125
+ }
126
+
127
+ @Component({
128
+ name: "HtShowBaseData",
129
+ })
130
+ export default class CommonDatas extends Vue {
131
+ /** 查找不到为空时显示 */
132
+ @Prop({ default: "" }) empty?: string;
133
+ /** 显示用户信息 */
134
+ @Prop() userId?: string;
135
+ /** 是否展示所有关联节点 */
136
+ @Prop() showAllLevel?: boolean;
137
+ /** 隐藏编码 */
138
+ @Prop() hideCode?: boolean;
139
+ /** 显示角色信息 */
140
+ @Prop() roleId?: string;
141
+ /** 显示部门信息 */
142
+ @Prop() departmentId?: string;
143
+ /** 严重性信息 */
144
+ @Prop() severityValue?: string;
145
+ /** 时间格式处理 */
146
+ @Prop() timeStr?: string;
147
+ /** 基础数据 */
148
+ @Prop() baseDataId?: string;
149
+ /** 基础数据value */
150
+ @Prop() baseDataValue?: string;
151
+ /** 基础数据name */
152
+ @Prop() baseDataName?: string;
153
+ /** 基础数据详情,显示名称加编码 */
154
+ @Prop({ default: false }) baseDataInfo?: boolean;
155
+ /** 人员 */
156
+ /** 数据 */
157
+ state: State = {
158
+ text: "",
159
+ resData: {
160
+ baseData: {
161
+ items: [],
162
+ },
163
+ dictionaryCategory: {
164
+ items: [],
165
+ },
166
+ dictionaryData: [],
167
+ severityLevel: [],
168
+ organizationUnit: [],
169
+ organizationUsersTree: [],
170
+ users: {
171
+ items: [],
172
+ },
173
+ SessionState: "",
174
+ userInOrganiza: [],
175
+ organizationUsers: {},
176
+ roleList: [],
177
+ },
178
+ baseDataItem: {},
179
+ };
180
+ /** 生命周期 */
181
+ created() {
182
+ if (!baseConfig.getLoginState()) {
183
+ return;
184
+ }
185
+ const data = window.localStorage.getItem("commonDatas");
186
+ if (data) {
187
+ this.state.resData = Object.assign(this.state.resData, JSON.parse(data));
188
+ }
189
+ const { items = [] } = this.state.resData.baseData;
190
+ this.getBaseDataItem(items);
191
+ this.setText();
192
+ }
193
+ /** 方法 */
194
+ /** 根据id获取用户部门 */
195
+ getorgById(id: string) {
196
+ return (
197
+ this.state.resData.organizationUnit.find((val) => val.id == id) || {}
198
+ );
199
+ }
200
+ /** 递归处理基础数据 */
201
+ getBaseDataItem(list: any[]) {
202
+ // const list = this.state.resData.baseData.items || []
203
+ list.forEach((item) => {
204
+ this.state.baseDataItem[item.id || ""] = item;
205
+ this.state.baseDataItem[item.value || ""] = item;
206
+ this.state.baseDataItem[item.name || ""] = item;
207
+ if (item.children) {
208
+ this.getBaseDataItem(item.children);
209
+ }
210
+ });
211
+ }
212
+ /** 获取节点相关的所有父节点信息--只针对基础数据 */
213
+ setAllLevel(id: any) {
214
+ const { baseDataItem } = this.state;
215
+ const hideCode = this.hideCode;
216
+ let text = "";
217
+
218
+ if (baseDataItem[id]) {
219
+ if (hideCode) {
220
+ text = `${baseDataItem[id].name || ""}`;
221
+ } else {
222
+ text = `${baseDataItem[id].name || ""}(${baseDataItem[id].value})`;
223
+ }
224
+ if (baseDataItem[id].parentId && this.showAllLevel) {
225
+ const tempText = this.setAllLevel(baseDataItem[id]["parentId"]);
226
+ text = `${tempText}/${text}`;
227
+ }
228
+ }
229
+
230
+ return text;
231
+ }
232
+ @Watch("baseDataItem")
233
+ setText() {
234
+ if (this.baseDataId) {
235
+ const tempText = this.setAllLevel(this.baseDataId);
236
+ this.state.text = tempText;
237
+ }
238
+ }
239
+
240
+ /** 计算属性 */
241
+ /** 基础数据 */
242
+ get baseDataItem() {
243
+ return this.state.baseDataItem || {};
244
+ }
245
+ /** 获取严重等级 */
246
+ get SeverityLevel() {
247
+ return this.state.resData.severityLevel || [];
248
+ }
249
+ /** 获取用户数据 */
250
+ get userDataList() {
251
+ return this.state.resData.users.items || [];
252
+ }
253
+ /** 根据id获取用户数据 */
254
+ get userData() {
255
+ if (!this.userId) {
256
+ return [];
257
+ }
258
+
259
+ if (this.state.resData.users.items) {
260
+ const ids: string[] = JSON.parse(this.userId);
261
+
262
+ const data = this.state.resData.users.items.filter((val) =>
263
+ ids.includes(val.id)
264
+ );
265
+ return data;
266
+ } else {
267
+ return [];
268
+ }
269
+ }
270
+ /** 根据id获取角色数据 */
271
+ get roleData() {
272
+ if (!this.roleId) {
273
+ return [];
274
+ }
275
+
276
+ if (this.state.resData.roleList) {
277
+ const ids: string[] = JSON.parse(this.roleId);
278
+
279
+ const data = this.state.resData.roleList.filter((val) =>
280
+ ids.includes(val.id || "")
281
+ );
282
+ return data;
283
+ } else {
284
+ return [];
285
+ }
286
+ }
287
+ /** 根据id获取部门数据 */
288
+ get departmentData() {
289
+ if (!this.departmentId) {
290
+ return [];
291
+ }
292
+ const ids = JSON.parse(this.departmentId);
293
+
294
+ return ids;
295
+ }
296
+ /** 时间格式 */
297
+ get timeFormat() {
298
+ if (this.timeStr && this.timeStr.startsWith("0")) {
299
+ return this.empty;
300
+ } else {
301
+ return this.timeStr?.replace(/T/, " ").slice(0, 19) || this.empty;
302
+ }
303
+ }
304
+ }
305
+ </script>
306
+
307
+ <style lang="scss" scoped>
308
+ .show-common-item {
309
+ display: inline-block;
310
+ .item {
311
+ + .item {
312
+ padding-left: 10px;
313
+ }
314
+ }
315
+ }
316
+ </style>
@@ -5,7 +5,7 @@
5
5
  * @Author: hutao
6
6
  * @Date: 2021-11-11 11:23:24
7
7
  * @LastEditors: hutao
8
- * @LastEditTime: 2022-04-06 17:25:14
8
+ * @LastEditTime: 2022-04-12 17:54:52
9
9
  -->
10
10
  <template>
11
11
  <div v-loading="state.loading"
@@ -105,6 +105,7 @@
105
105
  :rowIndex="rowIndex">
106
106
  <!-- 处理部门 -->
107
107
  <template v-if="item.type==='org'">
108
+
108
109
  <common-org-info v-if="getPropByPath(row,item.key)"
109
110
  :org-id="getPropByPath(row,item.key)"
110
111
  type="tag"></common-org-info>
@@ -112,25 +113,26 @@
112
113
  </template>
113
114
  <!-- 处理基础数据 -->
114
115
  <template v-else-if="item.type==='common'">
116
+ <HtShowBaseData v-if="getPropByPath(row,item.key)"
117
+ :hide-code="item.hideCode"
118
+ :user-id="item.commonType==='userId'?JSON.stringify([getPropByPath(row,item.key)]):'[]'"
119
+ :department-id="item.commonType==='departmentId'?JSON.stringify([getPropByPath(row,item.key)]):'[]'"
120
+ :role-id="item.commonType==='roleId'?JSON.stringify([getPropByPath(row,item.key)]):'[]'"
121
+ :base-data-id="item.commonType==='baseDataId'?getPropByPath(row,item.key):''"
122
+ :base-data-value="item.commonType==='baseDataValue'?getPropByPath(row,item.key):''"
123
+ :base-data-name="item.commonType==='baseDataName'?getPropByPath(row,item.key):''"
124
+ :base-data-info='true'>
125
+ </HtShowBaseData>
115
126
 
116
- <div v-if="getPropByPath(row,item.key)"
117
- is='common-datas-info-id'
118
- :hide-code="item.hideCode"
119
- :user-id="item.commonType==='userId'?JSON.stringify([getPropByPath(row,item.key)]):'[]'"
120
- :department-id="item.commonType==='departmentId'?JSON.stringify([getPropByPath(row,item.key)]):'[]'"
121
- :role-id="item.commonType==='roleId'?JSON.stringify([getPropByPath(row,item.key)]):'[]'"
122
- :base-data-id="item.commonType==='baseDataId'?getPropByPath(row,item.key):''"
123
- :base-data-value="item.commonType==='baseDataValue'?getPropByPath(row,item.key):''"
124
- :base-data-name="item.commonType==='baseDataName'?getPropByPath(row,item.key):''"
125
- :base-data-info='true'></div>
126
127
  <span v-else>--</span>
127
128
  </template>
128
129
  <!-- 处理部门人员 -->
129
130
  <template v-else-if="item.type==='userId'">
130
- <div is='common-datas-info-id'
131
- v-if="getPropByPath(row,item.key)"
132
- :user-id="JSON.stringify(getPropByPath(row,item.key))"
133
- :base-data-info='true'></div>
131
+ <HtShowBaseData v-if="getPropByPath(row,item.key)"
132
+ :user-id="JSON.stringify(getPropByPath(row,item.key))"
133
+ :base-data-info='true'>
134
+ </HtShowBaseData>
135
+
134
136
  <span v-else>--</span>
135
137
  </template>
136
138
  <!-- 处理时间 -->
@@ -274,6 +276,7 @@ import { Component, Prop, Vue, Watch } from "vue-property-decorator";
274
276
  import { Column, PageInfoType } from "@/packages/type";
275
277
  import PageInfo from "@/packages/PageInfo/index.vue";
276
278
  import HtUploadFiles from "@/packages/HtUploadFiles/index.vue";
279
+ import HtShowBaseData from "@/packages/HtShowBaseData";
277
280
  interface State {
278
281
  pageInfo: PageInfoType;
279
282
  loading: boolean;
@@ -299,6 +302,7 @@ interface State {
299
302
  components: {
300
303
  PageInfo,
301
304
  HtUploadFiles,
305
+ HtShowBaseData,
302
306
  },
303
307
  })
304
308
  export default class HtTable extends Vue {
@@ -381,26 +385,29 @@ export default class HtTable extends Vue {
381
385
  this.getShowKeys(this.state.allColumns);
382
386
  } else {
383
387
  if (this.configShow) {
384
- this.creatInitColumnKey(
385
- this.columns.filter((item) => item.deafaultShow)
386
- );
388
+ this.columns.forEach((item) => (item.checked = !!item.deafaultShow));
389
+ this.creatInitColumnKey(this.columns);
387
390
  } else {
388
391
  this.creatInitColumnKey(this.columns || []);
389
392
  }
390
393
  }
391
394
  } else {
392
395
  if (this.configShow) {
393
- this.creatInitColumnKey(
394
- this.columns.filter((item) => item.deafaultShow)
395
- );
396
+ this.columns.forEach((item) => (item.checked = !!item.deafaultShow));
397
+ this.creatInitColumnKey(this.columns);
396
398
  } else {
397
399
  this.creatInitColumnKey(this.columns || []);
398
400
  }
399
401
  }
402
+ console.log("this.columns", this.columns);
400
403
  }
401
404
  resetColumn() {
402
405
  if (this.configShow) {
403
- this.creatInitColumnKey(this.columns.filter((item) => item.deafaultShow));
406
+ this.columns.forEach((item) => {
407
+ item.checked = !!item.deafaultShow;
408
+ });
409
+
410
+ this.creatInitColumnKey(this.columns);
404
411
  } else {
405
412
  this.creatInitColumnKey(this.columns || []);
406
413
  }
@@ -427,8 +434,9 @@ export default class HtTable extends Vue {
427
434
  creatInitColumnKey(columns: Column[]) {
428
435
  this.state.allColumns = columns;
429
436
  this.state.showColumns = columns;
437
+
430
438
  this.state.allColumns.forEach((item) => {
431
- item.checked = true;
439
+ item.checked = item.checked === false ? false : true;
432
440
  });
433
441
  this.$nextTick(() => {
434
442
  (this.$refs.comTable as any).doLayout();
@@ -591,6 +599,7 @@ export default class HtTable extends Vue {
591
599
  }
592
600
  get getAllColumns() {
593
601
  const { allColumns } = this.state;
602
+
594
603
  return allColumns.filter((item) => !item.hide);
595
604
  }
596
605
  @Watch("columns")
@@ -4,7 +4,7 @@
4
4
  * @Author: hutao
5
5
  * @Date: 2021-11-15 14:41:40
6
6
  * @LastEditors: hutao
7
- * @LastEditTime: 2022-03-09 15:08:19
7
+ * @LastEditTime: 2022-04-06 18:02:23
8
8
  -->
9
9
  <template>
10
10
  <div>
@@ -29,6 +29,7 @@
29
29
  :subfield="true"></ht-md> -->
30
30
  <div ref="ht-pdf">
31
31
  <HtTable :data="state.data"
32
+ :configShow="true"
32
33
  :checked="true"
33
34
  :height="200"
34
35
  uuId="54598fs1okdsfsdfk2"
@@ -84,6 +85,7 @@ export default class Index extends Vue {
84
85
  {
85
86
  name: "胡涛",
86
87
  selectable: true,
88
+
87
89
  age: 12,
88
90
  sex: "e49961a4f385e5d341ce3a01ee674c90ea9e037b734228fe26753a01ee674c90,e49961a4f385e5d341ce3a01ee674c90ea9e037b734228fe26753a01ee674c90",
89
91
  id: 1,
@@ -131,6 +133,7 @@ export default class Index extends Vue {
131
133
  width: "300px",
132
134
  property: "base",
133
135
  disabled: true,
136
+ deafaultShow: true,
134
137
  },
135
138
  {
136
139
  title: "姓额外名",
@@ -145,6 +148,7 @@ export default class Index extends Vue {
145
148
  type: "time",
146
149
  spread: true,
147
150
  key: "time",
151
+ deafaultShow: true,
148
152
  },
149
153
  {
150
154
  title: "性别",