htui-yllkbz 2.0.13 → 2.0.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": "2.0.13",
3
+ "version": "2.0.15",
4
4
  "port": "8082",
5
5
  "typings": "types/index.d.ts",
6
6
  "main": "lib/htui.common.js",
@@ -57,4 +57,4 @@
57
57
  "typescript": "~3.9.3",
58
58
  "vue-template-compiler": "^2.6.11"
59
59
  }
60
- }
60
+ }
@@ -409,13 +409,13 @@ import {
409
409
  DictionaryCategoryDto,
410
410
  DictionaryDataDto,
411
411
  SeverityLevelDto,
412
- } from "@/plugins/commonApi";
412
+ } from "../../plugins/commonApi";
413
413
  /* eslint-disable @typescript-eslint/camelcase */
414
414
  import {
415
415
  ListResultDto_1OfOfOrganizationUnitWithUsersAndContractsAnd_0AndCulture_neutralAndPublicKeyToken_null,
416
416
  OrganizationUnitWithDetailsDto,
417
417
  OrganizationUnitDto,
418
- } from "@/plugins/Auth";
418
+ } from "../../plugins/Auth";
419
419
  import { _axios, baseConfig } from "vue-kst-auth";
420
420
  interface Inuser {
421
421
  concurrencyStamp: string;
@@ -38,7 +38,7 @@
38
38
  </template>
39
39
  <script lang="ts">
40
40
  import { Component, Prop, Vue } from 'vue-property-decorator';
41
- import HtPopover from '@/packages/HtPopover/index.vue';
41
+ import HtPopover from '../HtPopover/index.vue';
42
42
  interface State {
43
43
  /** 数据状态 */
44
44
  loading: boolean;
@@ -52,7 +52,7 @@
52
52
  </template>
53
53
  <script lang="ts">
54
54
  import { Component, Prop, Vue } from 'vue-property-decorator';
55
- import '@/packages/style.scss';
55
+ import '../style.scss';
56
56
 
57
57
  interface State {
58
58
  /** 数据状态 */
@@ -58,8 +58,8 @@
58
58
  </template>
59
59
  <script lang="ts">
60
60
  import { Component, Prop, Vue, Watch } from "vue-property-decorator";
61
- import HtShowBaseData from "@/packages/HtShowBaseData";
62
- import HtBaseData from "@/packages/HtBaseData";
61
+ import HtShowBaseData from "../HtShowBaseData";
62
+ import HtBaseData from "../HtBaseData";
63
63
  interface State {
64
64
  /** 数据状态 */
65
65
  loading: boolean;
File without changes
@@ -35,8 +35,8 @@
35
35
  </template>
36
36
  <script lang="ts">
37
37
  import { Component, Prop, Vue } from 'vue-property-decorator';
38
- import HtShowBaseData from '@/packages/HtShowBaseData';
39
- import HtBaseData from '@/packages/HtBaseData';
38
+ import HtShowBaseData from '../HtShowBaseData';
39
+ import HtBaseData from '../HtBaseData';
40
40
  import { getCommDataItem } from '../common';
41
41
  interface State {
42
42
  /** 数据状态 */
@@ -20,8 +20,8 @@
20
20
  </template>
21
21
  <script lang="ts">
22
22
  import { Component, Prop, Vue } from "vue-property-decorator";
23
- import HtShowBaseData from "@/packages/HtShowBaseData";
24
- import HtBaseData from "@/packages/HtBaseData";
23
+ import HtShowBaseData from "../HtShowBaseData";
24
+ import HtBaseData from "../HtBaseData";
25
25
  import { getCommDataItem } from "../common";
26
26
  interface State {
27
27
  /** 数据状态 */
@@ -1,38 +1,65 @@
1
1
  <template>
2
- <el-table-column :label="item.title" :fixed="item.fixed" :align="item.align"
3
- v-if="fromColumn ? !item.hide : !item.hide && item.checked" :resizable="item.resizable === false ? false : true"
4
- :header-align="item.headerAlign" :column-key="item.columnKey" :class-name="item.className" :prop="item.key"
5
- :show-overflow-tooltip="item.type === 'common' || item.type === 'org' || item.type === 'userId'
2
+ <el-table-column :label="item.title"
3
+ :fixed="item.fixed"
4
+ :align="item.align"
5
+ v-if="fromColumn ? !item.hide : !item.hide && item.checked"
6
+ :resizable="item.resizable === false ? false : true"
7
+ :header-align="item.headerAlign"
8
+ :column-key="item.columnKey"
9
+ :class-name="item.className"
10
+ :prop="item.key"
11
+ :show-overflow-tooltip="item.type === 'common' || item.type === 'org' || item.type === 'userId'
6
12
  ? false
7
13
  : item.showOverflowTooltip === false
8
14
  ? false
9
15
  : true
10
- " :sortable="item.sortable" :sort-method="item.sortMethod" :sort-orders="item.sortOrders"
11
- :formatter="item.formatter" :sort-by="item.sortBy" :min-width="item.minWidth" :width="item.width">
16
+ "
17
+ :sortable="item.sortable"
18
+ :sort-method="item.sortMethod"
19
+ :sort-orders="item.sortOrders"
20
+ :formatter="item.formatter"
21
+ :sort-by="item.sortBy"
22
+ :min-width="item.minWidth"
23
+ :width="item.width">
12
24
 
13
25
  <template v-if="item.children && item.children.length">
14
- <HtTableColumn :item="child" :getAllBaseData="getAllBaseData" :getAllOrg="getAllOrg" :getAllRole="getAllRole"
15
- :getAllUser="getAllUser" v-for="(child, childindex) in item.children"
16
- @showFiles="(val) => $emit('showFiles', val)" :fromColumn="true" :key="`${child.key}_${childindex}_1`">
17
- <template :slot="child.key" slot-scope="scope">
18
- <slot :name="child.key" :row="scope.row" :column="scope.column" :rowIndex="scope.rowIndex">
26
+ <HtTableColumn :item="child"
27
+ :getAllBaseData="getAllBaseData"
28
+ :getAllOrg="getAllOrg"
29
+ :getAllRole="getAllRole"
30
+ :getAllUser="getAllUser"
31
+ v-for="(child, childindex) in item.children"
32
+ @showFiles="emitShowFiles"
33
+ :fromColumn="true"
34
+ :key="`${child.key}_${childindex}_1`">
35
+ <template :slot="child.key"
36
+ slot-scope="scope">
37
+ <slot :name="child.key"
38
+ :row="scope.row"
39
+ :column="scope.column"
40
+ :rowIndex="scope.rowIndex">
19
41
  </slot>
20
42
  </template>
21
43
  <!-- <template slot="title" slot-scope="{ data }">
22
44
  <slot name="title" :data="data"></slot
23
45
  ></template> -->
24
- <template slot-scope="scope" :slot="'header_' + child.key">
25
- <slot :name="'header_' + child.key" :column="scope.column" :$index="scope.$index"></slot>
46
+ <template slot-scope="scope"
47
+ :slot="'header_' + child.key">
48
+ <slot :name="'header_' + child.key"
49
+ :column="scope.column"
50
+ :$index="scope.$index"></slot>
26
51
  </template>
27
52
  </HtTableColumn>
28
53
  </template>
29
54
  <template slot-scope="{ row, column, $index }">
30
55
 
31
- <slot :name="item.key" :row="row" :column="column" :rowIndex="$index">
56
+ <slot :name="item.key"
57
+ :row="row"
58
+ :column="column"
59
+ :rowIndex="$index">
32
60
  <!-- 处理部门 -->
33
61
  <template v-if="item.type === 'org'">
34
- <el-tag v-if="getPropByPath(row, item.key)"> {{ getAllOrg[getPropByPath(row, item.key)]?.displayName
35
- }}</el-tag>
62
+ <el-tag v-if="getPropByPath(row, item.key)">{{ getOrgDisplayName(getPropByPath(row, item.key)) }}</el-tag>
36
63
  <!-- <HtOrgInfo v-if="getPropByPath(row, item.key)"
37
64
  :org-id="getPropByPath(row, item.key)"
38
65
  type="tag"></HtOrgInfo> -->
@@ -43,22 +70,24 @@
43
70
  <span v-if="item.commonType === 'userId' && getPropByPath(row, item.key)">
44
71
  {{ getAllUser[getPropByPath(row, item.key)]?.value }}</span>
45
72
  <span v-else-if="item.commonType === 'departmentId' && getPropByPath(row, item.key)">
46
- {{ getAllOrg[getPropByPath(row, item.key)]?.displayName }}</span>
73
+ {{ getOrgDisplayName(getPropByPath(row, item.key)) }}</span>
47
74
  <span v-else-if="item.commonType === 'roleId' && getPropByPath(row, item.key)">
48
75
  {{ getAllRole[getPropByPath(row, item.key)]?.name }}</span>
49
76
  <span v-else-if="item.commonType === 'baseDataId' && getPropByPath(row, item.key)">
50
77
  {{ getAllBaseData[getPropByPath(row, item.key)]?.name }}<span v-if="!item.hideCode">({{
51
78
  getAllBaseData[getPropByPath(row, item.key)]?.value }})</span></span>
52
79
 
53
- <HtShowBaseData
54
- v-else-if="getPropByPath(row, item.key) && (item.commonType === 'baseDataValue' || item.commonType === 'baseDataName')"
55
- :hide-code="item.hideCode" :base-data-value="item.commonType === 'baseDataValue'
80
+ <HtShowBaseData v-else-if="getPropByPath(row, item.key) && (item.commonType === 'baseDataValue' || item.commonType === 'baseDataName')"
81
+ :hide-code="item.hideCode"
82
+ :base-data-value="item.commonType === 'baseDataValue'
56
83
  ? getPropByPath(row, item.key)
57
84
  : ''
58
- " :base-data-name="item.commonType === 'baseDataName'
85
+ "
86
+ :base-data-name="item.commonType === 'baseDataName'
59
87
  ? getPropByPath(row, item.key)
60
88
  : ''
61
- " :base-data-info="true">
89
+ "
90
+ :base-data-info="true">
62
91
  </HtShowBaseData>
63
92
 
64
93
  <span v-else>--</span>
@@ -71,7 +100,8 @@
71
100
  </template>
72
101
  <!-- 处理时间 yyyy-mm-dd HH:mm:ss -->
73
102
  <template v-else-if="item.type === 'time'">
74
- <div v-if="getPropByPath(row, item.key)" class="ht-column-cell">
103
+ <div v-if="getPropByPath(row, item.key)"
104
+ class="ht-column-cell">
75
105
  <span v-if="!item.spread">
76
106
  {{
77
107
  getPropByPath(row, item.key)
@@ -95,7 +125,8 @@
95
125
  </template>
96
126
  <!-- 处理日期 yyyy-mm-dd -->
97
127
  <template v-else-if="item.type === 'date'">
98
- <div v-if="getPropByPath(row, item.key)" class="ht-column-cell">
128
+ <div v-if="getPropByPath(row, item.key)"
129
+ class="ht-column-cell">
99
130
  <span>
100
131
  {{
101
132
  getPropByPath(row, item.key)
@@ -107,23 +138,31 @@
107
138
  </template>
108
139
  <!-- 处理布尔值显示 -->
109
140
  <template v-else-if="item.type === 'boolean'">
110
- <el-tag :type="'success'" :size="'small'" v-if="getPropByPath(row, item.key)">是</el-tag>
111
- <el-tag type="danger" :size="'small'" v-else>否</el-tag>
141
+ <el-tag :type="'success'"
142
+ :size="'small'"
143
+ v-if="getPropByPath(row, item.key)">是</el-tag>
144
+ <el-tag type="danger"
145
+ :size="'small'"
146
+ v-else>否</el-tag>
112
147
  </template>
113
148
  <!-- 处理新资产的单位 -->
114
149
  <template v-else-if="item.type === 'unit'">
115
- <HtSelectUnit :readonly="true" :value="getPropByPath(row, item.key)"></HtSelectUnit>
150
+ <HtSelectUnit :readonly="true"
151
+ :value="getPropByPath(row, item.key)"></HtSelectUnit>
116
152
  </template>
117
153
  <!-- 处理新资产的单位 -->
118
154
  <template v-else-if="item.type === 'position'">
119
- <HtSelectPosition :readonly="true" :value="getPropByPath(row, item.key)"></HtSelectPosition>
155
+ <HtSelectPosition :readonly="true"
156
+ :value="getPropByPath(row, item.key)"></HtSelectPosition>
120
157
  </template>
121
158
  <!-- 处理图片显示 -->
122
159
  <template v-else-if="item.type === 'img'">
123
160
  <span v-if="getPropByPath(row, item.key)">
124
- <el-image style="width: 38px; height: 38px;margin-right:5px" :key="fileToken"
125
- v-for="fileToken in getPropByPath(row, item.key).split(',')"
126
- :src="`/${proxy}/api/filing/file/download/` + fileToken" :preview-src-list="[
161
+ <el-image style="width: 38px; height: 38px;margin-right:5px"
162
+ :key="fileToken"
163
+ v-for="fileToken in getPropByPath(row, item.key).split(',')"
164
+ :src="`/${proxy}/api/filing/file/download/` + fileToken"
165
+ :preview-src-list="[
127
166
  `/${proxy}/api/filing/file/download/` + fileToken,
128
167
  ]">
129
168
  </el-image>
@@ -132,8 +171,9 @@
132
171
  <!-- 处理附件显示 -->
133
172
  <template v-else-if="item.type === 'file'">
134
173
  <span v-if="getPropByPath(row, item.key)">
135
- <i class="el-icon-paperclip" @click="$emit('showFiles', getPropByPath(row, item.key))"
136
- style="color:var(--primary);cursor:pointer">{{
174
+ <i class="el-icon-paperclip"
175
+ @click="$emit('showFiles', getPropByPath(row, item.key))"
176
+ style="color:var(--primary);cursor:pointer">{{
137
177
  Array.isArray(getPropByPath(row, item.key))
138
178
  ? getPropByPath(row, item.key).length
139
179
  : getPropByPath(row, item.key).split(',').length
@@ -142,14 +182,18 @@
142
182
  <span v-else>--</span>
143
183
  </template>
144
184
  <!-- 其他 -->
145
- <span :style="item.style" v-else>{{
185
+ <span :style="item.style"
186
+ v-else>{{
146
187
  getPropByPath(row, item.key)
147
188
  }}</span>
148
189
  </slot>
149
190
  </template>
150
191
  <!-- 处理重定义table头相关信息 header_key -->
151
- <template slot-scope="{ column, $index }" slot="header">
152
- <slot :name="'header_' + item.key" :column="column" :$index="$index">{{
192
+ <template slot-scope="{ column, $index }"
193
+ slot="header">
194
+ <slot :name="'header_' + item.key"
195
+ :column="column"
196
+ :$index="$index">{{
153
197
  item.title
154
198
  }}</slot>
155
199
  </template>
@@ -158,10 +202,10 @@
158
202
  <script lang="ts">
159
203
  import { Component, Prop, Vue } from "vue-property-decorator";
160
204
  import { Column } from "../type";
161
- import HtShowBaseData from "@/packages/HtShowBaseData";
162
- import HtOrgInfo from "@/packages/HtOrgInfo";
163
- import HtUploadFiles from "@/packages/HtUploadFiles/index.vue";
164
- import HtSelectUnit from "@/packages/HtSelectUnit";
205
+ import HtShowBaseData from "../HtShowBaseData";
206
+ import HtOrgInfo from "../HtOrgInfo";
207
+ import HtUploadFiles from "../HtUploadFiles/index.vue";
208
+ import HtSelectUnit from "../HtSelectUnit";
165
209
 
166
210
  interface State {
167
211
  /** 数据状态 */
@@ -179,6 +223,10 @@ interface State {
179
223
  },
180
224
  })
181
225
  export default class Index extends Vue {
226
+ private pathKeyCache = new Map<string, string[]>();
227
+
228
+ private rowValueCache = new WeakMap<object, { [key: string]: any }>();
229
+
182
230
  /** 单个Column信息 */
183
231
  @Prop() item!: Column;
184
232
  @Prop() getAllBaseData!: any;
@@ -192,22 +240,38 @@ export default class Index extends Vue {
192
240
  state: State = {
193
241
  loading: false,
194
242
  };
195
- /** 生命周期 */
196
- /** 方法 */
197
- // getPropByPath(obj: any, path: string, strict = true) {
198
- // return getPropByPath(obj, path, strict);
199
- // }
243
+ beforeUpdate() {
244
+ this.rowValueCache = new WeakMap<object, { [key: string]: any }>();
245
+ }
246
+ getPathKeys(path: string) {
247
+ const cachePath = path || "";
248
+ const cacheKeys = this.pathKeyCache.get(cachePath);
249
+ if (cacheKeys) {
250
+ return cacheKeys;
251
+ }
252
+ const normalizedPath = cachePath
253
+ .replace(/\[(\w+)\]/g, ".$1")
254
+ .replace(/^\./, "");
255
+ const keys = normalizedPath ? normalizedPath.split(".") : [];
256
+ this.pathKeyCache.set(cachePath, keys);
257
+ return keys;
258
+ }
200
259
  getPropByPath(obj: any, path: string, strict = true) {
201
- let tempObj = obj;
202
- path = path.replace(/\[(\w+)\]/g, ".$1");
203
- path = path.replace(/^\./, "");
260
+ if (!obj || typeof obj !== "object") {
261
+ return null;
262
+ }
263
+ const cache = this.rowValueCache.get(obj);
264
+ if (cache && path in cache) {
265
+ return cache[path];
266
+ }
204
267
 
205
- const keyArr = path.split(".");
268
+ let tempObj = obj;
269
+ const keyArr = this.getPathKeys(path);
206
270
  let i = 0;
207
271
  for (let len = keyArr.length; i < len - 1; ++i) {
208
272
  if (!tempObj && !strict) break;
209
273
  const key = keyArr[i];
210
- if (key in tempObj) {
274
+ if (tempObj && key in tempObj) {
211
275
  tempObj = tempObj[key];
212
276
  } else {
213
277
  if (strict) {
@@ -216,12 +280,48 @@ export default class Index extends Vue {
216
280
  break;
217
281
  }
218
282
  }
219
- // return {
220
- // o: tempObj,
221
- // k: keyArr[i],
222
- // v: tempObj ? tempObj[keyArr[i]] : null,
223
- // };
224
- return tempObj ? tempObj[keyArr[i]] : null;
283
+ const value = tempObj && keyArr.length ? tempObj[keyArr[i]] : null;
284
+ this.rowValueCache.set(obj, {
285
+ ...(cache || {}),
286
+ [path]: value,
287
+ });
288
+ return value;
289
+ }
290
+ getOrgDisplayName(orgId: string) {
291
+ const orgMap = this.getAllOrg || {};
292
+ if (orgMap[orgId]?.displayName) {
293
+ return orgMap[orgId].displayName;
294
+ }
295
+
296
+ const commonDatas = window.localStorage.getItem("commonDatas");
297
+ if (!commonDatas) {
298
+ return "--";
299
+ }
300
+
301
+ try {
302
+ const { organizationUnit = [] } = JSON.parse(commonDatas);
303
+ return this.findOrgName(orgId, organizationUnit);
304
+ } catch (_error) {
305
+ return "--";
306
+ }
307
+ }
308
+ findOrgName(orgId: string, organizationUnit: any[] = []): string {
309
+ for (let i = 0; i < organizationUnit.length; i++) {
310
+ const item = organizationUnit[i];
311
+ if (item.id === orgId) {
312
+ return item.displayName || "--";
313
+ }
314
+ if (item.children?.length) {
315
+ const childName = this.findOrgName(orgId, item.children);
316
+ if (childName !== "--") {
317
+ return childName;
318
+ }
319
+ }
320
+ }
321
+ return "--";
322
+ }
323
+ emitShowFiles(val: string | string[]) {
324
+ this.$emit("showFiles", val);
225
325
  }
226
326
  /** 监听 */
227
327
  /** 计算属性 */