htui-yllkbz 1.4.12 → 1.4.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.4.12",
3
+ "version": "1.4.14",
4
4
  "port": "8082",
5
5
  "typings": "types/index.d.ts",
6
6
  "main": "lib/htui.common.js",
@@ -24,15 +24,17 @@
24
24
  :min-width="item.minWidth"
25
25
  :width="item.width"
26
26
  >
27
- <template v-for="(child, childindex) in item.children">
27
+ <template v-if="item.children && item.children.length">
28
28
  <HtTableColumn
29
29
  :item="child"
30
+ v-for="(child, childindex) in item.children"
30
31
  @showFiles="(val) => $emit('showFiles', val)"
31
32
  :fromColumn="true"
32
33
  :key="`${child.key}_${childindex}_1`"
33
34
  ></HtTableColumn>
34
35
  </template>
35
36
  <template slot-scope="{ row, column, $index }">
37
+ {{ item.type }}
36
38
  <slot :name="item.key" :row="row" :column="column" :rowIndex="$index">
37
39
  <!-- 处理部门 -->
38
40
  <template v-if="item.type === 'org'">
@@ -207,12 +209,13 @@ import HtShowBaseData from '@/packages/HtShowBaseData';
207
209
  import HtOrgInfo from '@/packages/HtOrgInfo';
208
210
  import HtUploadFiles from '@/packages/HtUploadFiles/index.vue';
209
211
  import HtSelectUnit from '@/packages/HtSelectUnit';
210
- import { getPropByPath } from './table-span-method';
212
+
211
213
  interface State {
212
214
  /** 数据状态 */
213
215
  loading: boolean;
214
216
  }
215
217
  @Component({
218
+ name: 'HtTableColumn',
216
219
  components: {
217
220
  HtUploadFiles,
218
221
  HtShowBaseData,
@@ -233,8 +236,34 @@ export default class Index extends Vue {
233
236
  };
234
237
  /** 生命周期 */
235
238
  /** 方法 */
239
+ // getPropByPath(obj: any, path: string, strict = true) {
240
+ // return getPropByPath(obj, path, strict);
241
+ // }
236
242
  getPropByPath(obj: any, path: string, strict = true) {
237
- return getPropByPath(obj, path, strict);
243
+ let tempObj = obj;
244
+ path = path.replace(/\[(\w+)\]/g, '.$1');
245
+ path = path.replace(/^\./, '');
246
+
247
+ const keyArr = path.split('.');
248
+ let i = 0;
249
+ for (let len = keyArr.length; i < len - 1; ++i) {
250
+ if (!tempObj && !strict) break;
251
+ const key = keyArr[i];
252
+ if (key in tempObj) {
253
+ tempObj = tempObj[key];
254
+ } else {
255
+ if (strict) {
256
+ throw new Error(`table中${path}字段发生错误,请检查`);
257
+ }
258
+ break;
259
+ }
260
+ }
261
+ // return {
262
+ // o: tempObj,
263
+ // k: keyArr[i],
264
+ // v: tempObj ? tempObj[keyArr[i]] : null,
265
+ // };
266
+ return tempObj ? tempObj[keyArr[i]] : null;
238
267
  }
239
268
  /** 监听 */
240
269
  /** 计算属性 */
@@ -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-15 14:41:40
6
6
  * @LastEditors: hutao
7
- * @LastEditTime: 2023-04-09 15:46:52
7
+ * @LastEditTime: 2023-04-09 16:48:04
8
8
  -->
9
9
  <template>
10
10
  <div>
@@ -47,7 +47,7 @@
47
47
  </template>
48
48
  <script lang="ts">
49
49
  import { Component, Vue } from 'vue-property-decorator';
50
- import HtTable from '@/packages/HtTable/table.vue';
50
+ import HtTable from '@/packages/HtTable/index.vue';
51
51
  import HtCountDown from '@/packages/HtCountDown/index.vue';
52
52
  import HtSelectUser from '@/packages/HtSelectUser/index.vue';
53
53
  import HtSelectOrg from '@/packages/HtSelectOrg/index.vue';
@@ -134,6 +134,12 @@ export default class Index extends Vue {
134
134
  disabled: true,
135
135
  deafaultShow: true,
136
136
  },
137
+ {
138
+ title: 'selectable',
139
+ key: 'selectable',
140
+ width: '300px',
141
+ type: 'boolean',
142
+ },
137
143
  {
138
144
  title: '姓额外名',
139
145
  key: 'namey',