htui-yllkbz 1.4.11 → 1.4.13

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.4.11",
3
+ "version": "1.4.13",
4
4
  "port": "8082",
5
5
  "typings": "types/index.d.ts",
6
6
  "main": "lib/htui.common.js",
@@ -4,7 +4,7 @@
4
4
  * @Author: hutao
5
5
  * @Date: 2023-03-20 18:46:48
6
6
  * @LastEditors: hutao
7
- * @LastEditTime: 2023-03-30 17:38:51
7
+ * @LastEditTime: 2023-04-09 16:02:14
8
8
  -->
9
9
  <template>
10
10
  <el-menu
@@ -85,7 +85,7 @@ export default class Index extends Vue {
85
85
  }
86
86
  @Watch('data', { immediate: true })
87
87
  getdata(val: any) {
88
- console.log('data', val);
88
+ //console.log('data', val);
89
89
  }
90
90
  }
91
91
  </script>
@@ -27,6 +27,7 @@
27
27
  <template v-for="(child, childindex) in item.children">
28
28
  <HtTableColumn
29
29
  :item="child"
30
+ @showFiles="(val) => $emit('showFiles', val)"
30
31
  :fromColumn="true"
31
32
  :key="`${child.key}_${childindex}_1`"
32
33
  ></HtTableColumn>
@@ -212,6 +213,7 @@ interface State {
212
213
  loading: boolean;
213
214
  }
214
215
  @Component({
216
+ name: 'HtTableColumn',
215
217
  components: {
216
218
  HtUploadFiles,
217
219
  HtShowBaseData,
@@ -6,8 +6,8 @@
6
6
  * @LastEditors: hutao
7
7
  * @LastEditTime: 2023-04-09 10:42:47
8
8
  */
9
- // import HtTable from "./index.vue";
10
- import HtTable from "./table.vue";
9
+ import HtTable from "./index.vue";
10
+ //import HtTable from "./table.vue";
11
11
  (HtTable as any).install = function (Vue: any) {
12
12
 
13
13
  Vue.component("HtTable", HtTable);
@@ -4,7 +4,7 @@
4
4
  * @Author: hutao
5
5
  * @Date: 2021-11-11 11:23:24
6
6
  * @LastEditors: hutao
7
- * @LastEditTime: 2023-04-09 10:33:03
7
+ * @LastEditTime: 2023-04-09 16:12:58
8
8
  -->
9
9
  <template>
10
10
  <div v-loading="state.loading" style="background:#fff">
@@ -22,7 +22,7 @@
22
22
  :stripe="stripe !== undefined ? stripe : true"
23
23
  :size="size || 'small'"
24
24
  :fit="fit"
25
- :span-method="spanMethod"
25
+ :span-method="spanMethodCom"
26
26
  :header-row-style="
27
27
  headerRowStyle || { background: 'var(--primary-92)' }
28
28
  "
@@ -134,217 +134,11 @@
134
134
  </template>
135
135
  </el-table-column>
136
136
  <template v-for="(item, index) in state.showColumns">
137
- <el-table-column
138
- :label="item.title"
137
+ <HtTableColumn
139
138
  :key="`${item.key}_${index}`"
140
- :fixed="item.fixed"
141
- :align="item.align"
142
- v-if="!item.hide && item.checked"
143
- :resizable="item.resizable"
144
- :header-align="item.headerAlign"
145
- :column-key="item.columnKey"
146
- :class-name="item.className"
147
- :prop="item.key"
148
- :show-overflow-tooltip="
149
- item.type === 'common' ||
150
- item.type === 'org' ||
151
- item.type === 'userId'
152
- ? false
153
- : item.showOverflowTooltip === false
154
- ? false
155
- : true
156
- "
157
- :sortable="item.sortable"
158
- :sort-method="item.sortMethod"
159
- :sort-orders="item.sortOrders"
160
- :formatter="item.formatter"
161
- :sort-by="item.sortBy"
162
- :min-width="item.minWidth"
163
- :width="item.width"
164
- >
165
- <template slot-scope="{ row, column, $index }">
166
- <slot
167
- :name="item.key"
168
- :row="row"
169
- :column="column"
170
- :rowIndex="$index"
171
- >
172
- <!-- 处理部门 -->
173
- <template v-if="item.type === 'org'">
174
- <HtOrgInfo
175
- v-if="getPropByPath(row, item.key)"
176
- :org-id="getPropByPath(row, item.key)"
177
- type="tag"
178
- ></HtOrgInfo>
179
- <span v-else>--</span>
180
- </template>
181
- <!-- 处理基础数据 -->
182
- <template v-else-if="item.type === 'common'">
183
- <HtShowBaseData
184
- v-if="getPropByPath(row, item.key)"
185
- :hide-code="item.hideCode"
186
- :user-id="
187
- item.commonType === 'userId'
188
- ? JSON.stringify([getPropByPath(row, item.key)])
189
- : '[]'
190
- "
191
- :department-id="
192
- item.commonType === 'departmentId'
193
- ? JSON.stringify([getPropByPath(row, item.key)])
194
- : '[]'
195
- "
196
- :role-id="
197
- item.commonType === 'roleId'
198
- ? JSON.stringify([getPropByPath(row, item.key)])
199
- : '[]'
200
- "
201
- :base-data-id="
202
- item.commonType === 'baseDataId'
203
- ? getPropByPath(row, item.key)
204
- : ''
205
- "
206
- :base-data-value="
207
- item.commonType === 'baseDataValue'
208
- ? getPropByPath(row, item.key)
209
- : ''
210
- "
211
- :base-data-name="
212
- item.commonType === 'baseDataName'
213
- ? getPropByPath(row, item.key)
214
- : ''
215
- "
216
- :base-data-info="true"
217
- >
218
- </HtShowBaseData>
219
-
220
- <span v-else>--</span>
221
- </template>
222
- <!-- 处理部门人员 -->
223
- <template v-else-if="item.type === 'userId'">
224
- <HtShowBaseData
225
- v-if="getPropByPath(row, item.key)"
226
- :user-id="JSON.stringify(getPropByPath(row, item.key))"
227
- :base-data-info="true"
228
- >
229
- </HtShowBaseData>
230
-
231
- <span v-else>--</span>
232
- </template>
233
- <!-- 处理时间 yyyy-mm-dd HH:mm:ss -->
234
- <template v-else-if="item.type === 'time'">
235
- <div
236
- v-if="getPropByPath(row, item.key)"
237
- class="ht-column-cell"
238
- >
239
- <span v-if="!item.spread">
240
- {{
241
- getPropByPath(row, item.key)
242
- .replace('T', ' ')
243
- .slice(0, 19)
244
- }}</span
245
- >
246
- <template v-else>
247
- <p style="color:var(--primary);margin:0;padding:0">
248
- {{ getPropByPath(row, item.key).slice(11, 19) }}
249
- </p>
250
- <p style="margin:0;padding:0">
251
- {{
252
- getPropByPath(row, item.key)
253
- .replace('T', ' ')
254
- .slice(0, 10)
255
- }}
256
- </p>
257
- </template>
258
- </div>
259
- <span v-else>--</span>
260
- </template>
261
- <!-- 处理日期 yyyy-mm-dd -->
262
- <template v-else-if="item.type === 'date'">
263
- <div
264
- v-if="getPropByPath(row, item.key)"
265
- class="ht-column-cell"
266
- >
267
- <span>
268
- {{
269
- getPropByPath(row, item.key)
270
- .replace('T', ' ')
271
- .slice(0, 10)
272
- }}</span
273
- >
274
- </div>
275
- <span v-else>--</span>
276
- </template>
277
- <!-- 处理布尔值显示 -->
278
- <template v-else-if="item.type === 'boolean'">
279
- <el-tag
280
- :type="'success'"
281
- :size="'small'"
282
- v-if="getPropByPath(row, item.key)"
283
- >是</el-tag
284
- >
285
- <el-tag type="danger" :size="'small'" v-else>否</el-tag>
286
- </template>
287
- <!-- 处理新资产的单位 -->
288
- <template v-else-if="item.type === 'unit'">
289
- <HtSelectUnit
290
- :readonly="true"
291
- :value="getPropByPath(row, item.key)"
292
- ></HtSelectUnit>
293
- </template>
294
- <!-- 处理新资产的单位 -->
295
- <template v-else-if="item.type === 'position'">
296
- <HtSelectPosition
297
- :readonly="true"
298
- :value="getPropByPath(row, item.key)"
299
- ></HtSelectPosition>
300
- </template>
301
- <!-- 处理图片显示 -->
302
- <template v-else-if="item.type === 'img'">
303
- <span v-if="getPropByPath(row, item.key)">
304
- <el-image
305
- style="width: 38px; height: 38px;margin-right:5px"
306
- :key="fileToken"
307
- v-for="fileToken in getPropByPath(row, item.key).split(
308
- ','
309
- )"
310
- :src="'/files/api/filing/file/download/' + fileToken"
311
- :preview-src-list="[
312
- '/files/api/filing/file/download/' + fileToken,
313
- ]"
314
- >
315
- </el-image>
316
- </span>
317
- </template>
318
- <!-- 处理附件显示 -->
319
- <template v-else-if="item.type === 'file'">
320
- <span v-if="getPropByPath(row, item.key)">
321
- <i
322
- class="el-icon-paperclip"
323
- @click="showFiles(getPropByPath(row, item.key))"
324
- style="color:var(--primary);cursor:pointer"
325
- >{{
326
- Array.isArray(getPropByPath(row, item.key))
327
- ? getPropByPath(row, item.key).length
328
- : getPropByPath(row, item.key).split(',').length
329
- }}</i
330
- >
331
- </span>
332
- <span v-else>--</span>
333
- </template>
334
- <!-- 其他 -->
335
- <span v-else>{{ getPropByPath(row, item.key) }}</span>
336
- </slot>
337
- </template>
338
- <!-- 处理重定义table头相关信息 header_key -->
339
- <template slot-scope="{ column, $index }" slot="header">
340
- <slot
341
- :name="'header_' + item.key"
342
- :column="column"
343
- :$index="$index"
344
- >{{ item.title }}</slot
345
- >
346
- </template>
347
- </el-table-column>
139
+ :item="item"
140
+ @showFiles="showFiles"
141
+ ></HtTableColumn>
348
142
  </template>
349
143
  </el-table>
350
144
  </article>
@@ -454,7 +248,9 @@ import HtUploadFiles from '@/packages/HtUploadFiles/index.vue';
454
248
  import HtShowBaseData from '@/packages/HtShowBaseData';
455
249
  import HtOrgInfo from '@/packages/HtOrgInfo';
456
250
  import HtSelectUnit from '@/packages/HtSelectUnit';
251
+ import HtTableColumn from './htTableColumn.vue';
457
252
  import ElmentUI from 'element-ui';
253
+ import { getSpanMethod } from './table-span-method';
458
254
  Vue.use(ElmentUI);
459
255
  interface State {
460
256
  pageInfo: PageInfoType;
@@ -484,6 +280,7 @@ interface State {
484
280
  HtShowBaseData,
485
281
  HtOrgInfo,
486
282
  HtSelectUnit,
283
+ HtTableColumn,
487
284
  },
488
285
  })
489
286
  export default class HtTable extends Vue {
@@ -547,6 +344,13 @@ export default class HtTable extends Vue {
547
344
  @Prop() headerCellStyle?: any;
548
345
  /** 是否可以拖动排序 */
549
346
  @Prop({ default: true }) draggable?: boolean;
347
+ @Prop() spanMethodProps?: {
348
+ /** 需要合并的key值--将指定的列的行进行合并 */
349
+ colRows?: string[];
350
+ /** 将指定的列进行合并时候 合并规则必须相同 */
351
+ sameColRows?: string[];
352
+ relateProps?: { [key: string]: string };
353
+ };
550
354
 
551
355
  /** 分页的所有额外信息通过此参数传递 */
552
356
  @Prop() pagination?: any;
@@ -668,33 +472,7 @@ export default class HtTable extends Vue {
668
472
  allowDrag(draggingNode: any) {
669
473
  return !draggingNode.data.disabled;
670
474
  }
671
- /** 处理table里面根据字段获取对应的值 */
672
- getPropByPath(obj: any, path: string, strict = true) {
673
- let tempObj = obj;
674
- path = path.replace(/\[(\w+)\]/g, '.$1');
675
- path = path.replace(/^\./, '');
676
475
 
677
- const keyArr = path.split('.');
678
- let i = 0;
679
- for (let len = keyArr.length; i < len - 1; ++i) {
680
- if (!tempObj && !strict) break;
681
- const key = keyArr[i];
682
- if (key in tempObj) {
683
- tempObj = tempObj[key];
684
- } else {
685
- if (strict) {
686
- throw new Error(`table中${path}字段发生错误,请检查`);
687
- }
688
- break;
689
- }
690
- }
691
- // return {
692
- // o: tempObj,
693
- // k: keyArr[i],
694
- // v: tempObj ? tempObj[keyArr[i]] : null,
695
- // };
696
- return tempObj ? tempObj[keyArr[i]] : null;
697
- }
698
476
  /** 现在自定义列弹窗 */
699
477
  showFilterModel() {
700
478
  this.state.visibleFilter = true;
@@ -815,6 +593,16 @@ export default class HtTable extends Vue {
815
593
  }
816
594
  }
817
595
  }
596
+ get spanMethodCom() {
597
+ return this.spanMethod
598
+ ? this.spanMethod
599
+ : getSpanMethod(
600
+ this.data,
601
+ this.spanMethodProps?.colRows || [],
602
+ this.spanMethodProps?.sameColRows || [],
603
+ this.spanMethodProps?.relateProps || {}
604
+ );
605
+ }
818
606
  }
819
607
  </script>
820
608
  <style lang="scss" scoped></style>
@@ -4,7 +4,7 @@
4
4
  * @Author: hutao
5
5
  * @Date: 2023-04-09 14:33:12
6
6
  * @LastEditors: hutao
7
- * @LastEditTime: 2023-04-09 15:45:30
7
+ * @LastEditTime: 2023-04-09 16:12:06
8
8
  */
9
9
  /** 处理table里面根据字段获取对应的值 */
10
10
  export function getPropByPath(obj: any, path: string, strict = true) {
@@ -4,7 +4,7 @@
4
4
  * @Author: hutao
5
5
  * @Date: 2021-11-11 11:23:24
6
6
  * @LastEditors: hutao
7
- * @LastEditTime: 2023-04-09 15:35:02
7
+ * @LastEditTime: 2023-04-09 16:00:36
8
8
  -->
9
9
  <template>
10
10
  <div v-loading="state.loading" style="background:#fff">
@@ -137,6 +137,7 @@
137
137
  <HtTableColumn
138
138
  :key="`${item.key}_${index}`"
139
139
  :item="item"
140
+ @showFiles="showFiles"
140
141
  ></HtTableColumn>
141
142
  </template>
142
143
  </el-table>
@@ -5,7 +5,7 @@
5
5
  * @Author: hutao
6
6
  * @Date: 2022-05-06 17:56:08
7
7
  * @LastEditors: hutao
8
- * @LastEditTime: 2022-05-09 14:20:45
8
+ * @LastEditTime: 2023-04-09 16:02:30
9
9
  */
10
10
  import Oidc from "oidc-client";
11
11
  function getCurrentUrl() {
@@ -13,8 +13,8 @@ function getCurrentUrl() {
13
13
  if (href.charAt(href.length - 1) === '/') {
14
14
  href = href.substring(0, href.length - 1)
15
15
  }
16
- console.log('href', href, window.location);
17
- console.log('window.location.host + href', window.location.origin + href);
16
+ //console.log('href', href, window.location);
17
+ ///console.log('window.location.host + href', window.location.origin + href);
18
18
  return window.location.origin + href
19
19
  }
20
20
  export const mgr = new Oidc.UserManager({
@@ -34,9 +34,9 @@
34
34
  :checked="true"
35
35
  :isExpand="false"
36
36
  :spanMethodProps="{
37
- colRows: ['name', 'age', 'test.title'],
37
+ colRows: ['name', 'age'],
38
38
  sameColRows: [],
39
- relateProps: { name: 'test.title' },
39
+ relateProps: { age: 'test.title,id' },
40
40
  }"
41
41
  :height="500"
42
42
  :columns="state.columns"