htui-yllkbz 1.3.87 → 1.3.88

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.
@@ -0,0 +1,189 @@
1
+ <!--
2
+ * @Descripttion:部门选择
3
+ * @version:
4
+ * @Author: hutao
5
+ * @Date: 2021-12-30 14:29:14
6
+ * @LastEditors: hutao
7
+ * @LastEditTime: 2023-01-15 15:37:55
8
+ -->
9
+ <template>
10
+ <span v-if="readonly">
11
+ {{ getName }}
12
+ </span>
13
+ <el-cascader
14
+ v-else
15
+ :size="size"
16
+ popper-class="ht-cascader-poper"
17
+ :placeholder="placeholder || `请选择`"
18
+ :disabled="!!disabled"
19
+ class="component-item"
20
+ style="width:100%"
21
+ :filterable="true"
22
+ :clearable="clearable"
23
+ :collapse-tags="collapseTags"
24
+ :show-all-levels="showAllLevels"
25
+ :props="{
26
+ label: 'name',
27
+ expandTrigger: 'click',
28
+ emitPath: false,
29
+ checkStrictly: checkStrictly,
30
+ multiple: multiple,
31
+ }"
32
+ ref="htSelectUnit"
33
+ v-model="state.value"
34
+ :options="options"
35
+ @change="handleChange"
36
+ >
37
+ </el-cascader>
38
+ </template>
39
+ <script lang="ts">
40
+ import { Component, Prop, Vue, Watch } from 'vue-property-decorator';
41
+ import { _axios } from 'vue-kst-auth';
42
+ interface State {
43
+ /** 数据状态 */
44
+ loading: boolean;
45
+ value: any;
46
+ /** 所有单位 */
47
+ allUnitList: any[];
48
+ /** 所有分类 */
49
+ unitCategory: any[];
50
+ }
51
+ @Component({
52
+ name: 'HtSelectUnit',
53
+ })
54
+ export default class HtSelectUser extends Vue {
55
+ @Prop() value!: string;
56
+ @Prop() org!: string;
57
+ @Prop() size!: string;
58
+ /** 是否禁用 */
59
+ @Prop() disabled?: boolean;
60
+ @Prop() heightAuto?: boolean;
61
+ @Prop() placeholder?: string;
62
+ /** 是否可以清除 */
63
+ @Prop() clearable?: boolean;
64
+ @Prop({ default: true }) show?: boolean;
65
+ @Prop({ default: false }) multiple?: boolean;
66
+ @Prop({ default: true }) showAllLevels?: boolean;
67
+ @Prop({ default: false }) checkStrictly?: boolean;
68
+ /* 是否只读 */
69
+ @Prop({ default: false }) readonly?: boolean;
70
+ @Prop({ default: false }) panel?: boolean;
71
+ @Prop({ default: false }) collapseTags?: boolean;
72
+ @Prop({ default: true }) appendToBody?: boolean;
73
+ /* 单位分类id */
74
+ @Prop() categoyId?: string;
75
+ /** 是否只选择分类列表 */
76
+ @Prop({ default: false }) onlyCategoy?: string;
77
+ /** 数据 */
78
+ state: State = {
79
+ loading: false,
80
+ value: undefined,
81
+ allUnitList: [],
82
+ unitCategory: [],
83
+ };
84
+ /** 生命周期 */
85
+ created() {
86
+ const unitCategory = window.sessionStorage.getItem('unitCategory');
87
+ const allUnitList = window.sessionStorage.getItem('allUnitList');
88
+ if (unitCategory) {
89
+ this.state.unitCategory = JSON.parse(unitCategory);
90
+ } else {
91
+ this.getCategoy();
92
+ }
93
+ if (allUnitList) {
94
+ this.state.allUnitList = JSON.parse(allUnitList);
95
+ }
96
+ }
97
+ /** 获取单位分类列表 */
98
+ getCategoy() {
99
+ _axios
100
+ .get(
101
+ '/Unit/api/unit/unit-category/get-list?MaxResultCount=999&SkipCount=0'
102
+ )
103
+ .then((res) => {
104
+ const data = res.data.items || [];
105
+ window.sessionStorage.setItem('unitCategory', JSON.stringify(data));
106
+ this.state.unitCategory = data;
107
+ this.getAllUnit();
108
+ });
109
+ }
110
+ /** 获取单位列表 */
111
+ getAllUnit() {
112
+ _axios
113
+ .get('/Unit/api/unit/unit/get-list?MaxResultCount=999&SkipCount=0')
114
+ .then((res) => {
115
+ const data = res.data.items || [];
116
+ window.sessionStorage.setItem('allUnitList', JSON.stringify(data));
117
+ this.state.allUnitList = data;
118
+ });
119
+ }
120
+ /** 方法 */
121
+ /**部门选择回调 */
122
+ handleChange(e?: string | string[]) {
123
+ const allData = [...this.state.allUnitList, ...this.state.unitCategory];
124
+ if (!e || !e.length) {
125
+ this.$emit('input', e);
126
+ this.$emit('change', e);
127
+ } else {
128
+ let seletId: any = {};
129
+ if (Array.isArray(e)) {
130
+ e.forEach((item) => {
131
+ seletId = { ...seletId, [item]: true };
132
+ });
133
+ } else {
134
+ seletId = { [e]: true };
135
+ }
136
+ const data = allData.filter((item) => seletId[item.id]);
137
+ this.$emit('input', e, data);
138
+ this.$emit('change', e, data);
139
+ }
140
+ }
141
+ @Watch('value', { immediate: true })
142
+ setValue(val: any) {
143
+ this.state.value = val;
144
+ }
145
+ get options() {
146
+ const { unitCategory, allUnitList } = this.state;
147
+ function getCurrentUnit(id: string) {
148
+ const dataUnit: any[] = [];
149
+ allUnitList.forEach((item) => {
150
+ if (item.unitCategoryId === id) {
151
+ dataUnit.push({
152
+ value: item.id,
153
+ name: `${item.name}${item.code ? `(${item.code})` : ''}`,
154
+ code: item.code,
155
+ label: item.name,
156
+ });
157
+ }
158
+ });
159
+ return dataUnit.length ? dataUnit : undefined;
160
+ }
161
+ let data: any[] = [];
162
+ if (this.categoyId) {
163
+ data = getCurrentUnit(this.categoyId) || [];
164
+ } else {
165
+ unitCategory.forEach((item) => {
166
+ data.push({
167
+ value: item.id,
168
+ name: `${item.name}${item.code ? `(${item.code})` : ''}`,
169
+ label: item.name,
170
+ code: item.code,
171
+ children: this.onlyCategoy ? undefined : getCurrentUnit(item.id),
172
+ });
173
+ });
174
+ }
175
+ return data;
176
+ }
177
+ /** 计算属性 */
178
+ get getName() {
179
+ const allData: any[] = [
180
+ ...this.state.allUnitList,
181
+ ...this.state.unitCategory,
182
+ ];
183
+
184
+ const data: any = allData.find((item) => item.id === this.value);
185
+ return data ? `${data.name}${data.code ? `(${data.code})` : ''}` : '';
186
+ }
187
+ }
188
+ </script>
189
+ <style lang="scss" scoped></style>
@@ -4,7 +4,7 @@
4
4
  * @Author: hutao
5
5
  * @Date: 2021-11-11 11:23:24
6
6
  * @LastEditors: hutao
7
- * @LastEditTime: 2023-01-09 11:01:05
7
+ * @LastEditTime: 2023-01-18 12:21:25
8
8
  -->
9
9
  <template>
10
10
  <div v-loading="state.loading" style="background:#fff">
@@ -13,7 +13,12 @@
13
13
  ref="comTable"
14
14
  :height="height"
15
15
  :max-height="maxHeight"
16
+ :sum-text="sumText"
17
+ :show-summary="showSummary"
18
+ :summary-method="summaryMethod"
16
19
  :border="border"
20
+ :default-expand-all="defaultExpandAll"
21
+ :expand-row-keys="expandRowKeys"
17
22
  :stripe="stripe !== undefined ? stripe : true"
18
23
  :size="size || 'small'"
19
24
  :fit="fit"
@@ -262,6 +267,20 @@
262
267
  >
263
268
  <el-tag type="danger" :size="'small'" v-else>否</el-tag>
264
269
  </template>
270
+ <!-- 处理新资产的单位 -->
271
+ <template v-else-if="item.type === 'unit'">
272
+ <HtSelectUnit
273
+ :readonly="true"
274
+ :value="getPropByPath(row, item.key)"
275
+ ></HtSelectUnit>
276
+ </template>
277
+ <!-- 处理新资产的单位 -->
278
+ <template v-else-if="item.type === 'position'">
279
+ <HtSelectPosition
280
+ :readonly="true"
281
+ :value="getPropByPath(row, item.key)"
282
+ ></HtSelectPosition>
283
+ </template>
265
284
  <!-- 处理图片显示 -->
266
285
  <template v-else-if="item.type === 'img'">
267
286
  <span v-if="getPropByPath(row, item.key)">
@@ -416,6 +435,7 @@ import PageInfo from '@/packages/PageInfo/index.vue';
416
435
  import HtUploadFiles from '@/packages/HtUploadFiles/index.vue';
417
436
  import HtShowBaseData from '@/packages/HtShowBaseData';
418
437
  import HtOrgInfo from '@/packages/HtOrgInfo';
438
+ import HtSelectUnit from '@/packages/HtSelectUnit';
419
439
  import ElmentUI from 'element-ui';
420
440
  Vue.use(ElmentUI);
421
441
  interface State {
@@ -445,12 +465,21 @@ interface State {
445
465
  HtUploadFiles,
446
466
  HtShowBaseData,
447
467
  HtOrgInfo,
468
+ HtSelectUnit,
448
469
  },
449
470
  })
450
471
  export default class HtTable extends Vue {
451
472
  /** 默认的table头 */
452
473
  @Prop({ default: [] }) columns!: Column[];
453
474
  @Prop() data!: any[];
475
+ /** 是否在表尾显示合计行 */
476
+ @Prop({ default: false }) showSummary!: boolean;
477
+ /** 合计行第一列的文本 */
478
+ @Prop({ default: '合计' }) sumText!: string;
479
+ @Prop({ default: false }) defaultExpandAll!: boolean;
480
+ @Prop() expandRowKeys!: string[];
481
+ /** 自定义合并方法 */
482
+ @Prop() summaryMethod!: any;
454
483
  /** 序号对应的名称 */
455
484
  @Prop() keyName?: string;
456
485
  /** 合并单元格 */
@@ -4,7 +4,7 @@
4
4
  * @Author: hutao
5
5
  * @Date: 2021-10-21 10:08:41
6
6
  * @LastEditors: hutao
7
- * @LastEditTime: 2023-01-09 16:45:52
7
+ * @LastEditTime: 2023-01-15 15:54:18
8
8
  */
9
9
 
10
10
  // 导入组件
@@ -30,12 +30,15 @@ import HtDrawer from './HtDrawer'
30
30
  import HtSelectCron from './HtSelectCron'
31
31
  import HtSelectTimeSlot from './HtSelectTimeSlot'
32
32
  import HtMore from './HtMore'
33
+ import HtSelectUnit from './HtSelectUnit'
34
+ import HtSelectPosition from './HtSelectPosition'
35
+
33
36
 
34
37
 
35
38
 
36
39
 
37
40
  // 存储组件列表
38
- const components = [HtMore, HtSelectTimeSlot, HtSelectCron, HtBaseData, HtDrawer, HtShowBaseType, HtSelectTable, HtPagination, HtTable, HtExport, HtUpload, HtMd, HtCountDown, HtUploadFiles, HtSelectBaseData, HtSelectOrg, HtSelectUser, HtShowBaseData, HtOrgInfo]
41
+ const components = [HtSelectUnit, HtSelectPosition, HtMore, HtSelectTimeSlot, HtSelectCron, HtBaseData, HtDrawer, HtShowBaseType, HtSelectTable, HtPagination, HtTable, HtExport, HtUpload, HtMd, HtCountDown, HtUploadFiles, HtSelectBaseData, HtSelectOrg, HtSelectUser, HtShowBaseData, HtOrgInfo]
39
42
  // 定义 install 方法,接收 Vue 作为参数。如果使用 use 注册插件,则所有的组件都将被注册
40
43
  const install = function (Vue: any) {
41
44
  // 判断是否安装
@@ -51,7 +54,8 @@ export default {
51
54
  // 导出的对象必须具有 install,才能被 Vue.use() 方法安装
52
55
  install,
53
56
  // 以下是具体的组件列表
54
- HtSelectTable, HtPagination, HtShowBaseType, HtTable, HtExport, HtUpload, HtMd, HtCountDown, HtUploadFiles, HtMore,
57
+ HtSelectTable, HtSelectPosition, HtPagination, HtShowBaseType, HtTable, HtExport, HtUpload, HtMd, HtCountDown, HtUploadFiles, HtMore,
58
+ HtSelectUnit,
55
59
  HtSelectBaseData, HtSelectOrg, HtSelectUser, HtShowBaseData, HtOrgInfo, HtBaseData, HtDrawer, HtSelectCron, HtSelectTimeSlot
56
60
  }
57
61
 
@@ -4,7 +4,7 @@
4
4
  * @Author: hutao
5
5
  * @Date: 2021-10-25 17:05:17
6
6
  * @LastEditors: hutao
7
- * @LastEditTime: 2023-01-03 14:20:13
7
+ * @LastEditTime: 2023-01-15 16:03:39
8
8
  */
9
9
  /** 初始的默认条数 */
10
10
  export const defalutPageSize = 10
@@ -70,8 +70,8 @@ export interface Column {
70
70
  spread?: boolean;
71
71
  /** 通过type展示相应的数据 用户id|部门id|时间格式化|是否布尔值|图片 |附件*/
72
72
  type?: 'userId' | 'org' | 'time' | 'common' | 'boolean' | 'img' | 'file';
73
- /** 只有当type='common'时候有效 数据类型个ca common里面的一样但不包括时间 时间使用time */
74
- commonType?: 'userId' | 'departmentId' | 'baseDataId' | 'roleId' | 'baseDataName' | 'baseDataValue';
73
+ /** 只有当type='common'时候有效 数据类型个ca common里面的一样但不包括时间 时间使用time unit是新资产的单位 position资产位置*/
74
+ commonType?: 'userId' | 'departmentId' | 'baseDataId' | 'roleId' | 'baseDataName' | 'baseDataValue' | 'unit' | 'position';
75
75
  /** 当type===common时候 设置是否隐藏基础数据的value */
76
76
  hideCode?: boolean;
77
77
  showOverflowTooltip?: boolean;