htui-yllkbz 1.3.13 → 1.3.14

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.13",
3
+ "version": "1.3.14",
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-07 09:13:22
8
+ * @LastEditTime: 2022-04-12 17:47:36
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
+
277
280
  interface State {
278
281
  pageInfo: PageInfoType;
279
282
  loading: boolean;