htui-yllkbz 1.3.89 → 1.3.90

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.89",
3
+ "version": "1.3.90",
4
4
  "port": "8082",
5
5
  "typings": "types/index.d.ts",
6
6
  "main": "lib/htui.common.js",
package/src/App.vue CHANGED
@@ -4,7 +4,7 @@
4
4
  * @Author: hutao
5
5
  * @Date: 2021-11-15 14:41:40
6
6
  * @LastEditors: hutao
7
- * @LastEditTime: 2023-01-15 16:24:16
7
+ * @LastEditTime: 2023-02-01 16:54:30
8
8
  -->
9
9
  <template>
10
10
  <div id="app">
@@ -13,8 +13,10 @@
13
13
  <ul>
14
14
  <li>8888<HtMore></HtMore></li>
15
15
  </ul>
16
- <HtSelectPosition v-model="state.value"></HtSelectPosition>
17
- <HtSelectPosition :readonly="true" v-model="state.value"></HtSelectPosition>
16
+ <!-- <HtSelectPosition v-model="state.value"></HtSelectPosition>
17
+ <HtSelectPosition :readonly="true" v-model="state.value"></HtSelectPosition> -->
18
+ <HtSelectCategory :multiple="true" v-model="state.value"></HtSelectCategory>
19
+ <HtSelectCategory :readonly="true" v-model="state.value"></HtSelectCategory>
18
20
  <router-view></router-view>
19
21
  </div>
20
22
  </template>
@@ -27,6 +29,7 @@ import HtSelectUser from '@/packages/HtSelectUser';
27
29
  import HtShowBaseType from '@/packages/HtShowBaseType';
28
30
  import HtSelectTimeSlot from '@/packages/HtSelectTimeSlot';
29
31
  import HtSelectPosition from '@/packages/HtSelectPosition';
32
+ import HtSelectCategory from '@/packages/HtSelectCategory';
30
33
  import HtMore from '@/packages/HtMore';
31
34
  import HtSelectUnit from '@/packages/HtSelectUnit';
32
35
  import { mgr } from '@/plugins/oidc-client';
@@ -40,6 +43,7 @@ import { mgr } from '@/plugins/oidc-client';
40
43
  HtMore,
41
44
  HtSelectUnit,
42
45
  HtSelectPosition,
46
+ HtSelectCategory,
43
47
  },
44
48
  })
45
49
  export default class App extends Vue {
@@ -0,0 +1,14 @@
1
+ /*
2
+ * @Descripttion:选择资产单位
3
+ * @version:
4
+ * @Author: hutao
5
+ * @Date: 2021-11-15 15:00:57
6
+ * @LastEditors: hutao
7
+ * @LastEditTime: 2023-01-15 14:45:42
8
+ */
9
+ import HtSelectCategory from "./index.vue";
10
+ (HtSelectCategory as any).install = function (Vue: any) {
11
+
12
+ Vue.component("HtSelectCategory", HtSelectCategory);
13
+ };
14
+ export default HtSelectCategory;
@@ -0,0 +1,180 @@
1
+ <!--
2
+ * @Descripttion:位置选择
3
+ * @version:
4
+ * @Author: hutao
5
+ * @Date: 2021-12-30 14:29:14
6
+ * @LastEditors: hutao
7
+ * @LastEditTime: 2023-02-01 16:55:50
8
+ -->
9
+ <template>
10
+ <span v-if="readonly">
11
+ {{ state.positionName.toString() }}
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: defalutName,
27
+ value: 'id',
28
+ expandTrigger: 'click',
29
+ emitPath: false,
30
+ checkStrictly: checkStrictly,
31
+ multiple: multiple,
32
+ }"
33
+ ref="HtSelectPosition"
34
+ v-model="state.value"
35
+ :options="options"
36
+ @change="handleChange"
37
+ >
38
+ </el-cascader>
39
+ </template>
40
+ <script lang="ts">
41
+ import { Component, Prop, Vue, Watch } from 'vue-property-decorator';
42
+ import { _axios } from 'vue-kst-auth';
43
+ interface State {
44
+ /** 数据状态 */
45
+ loading: boolean;
46
+ value: any;
47
+ positionName: string[];
48
+ /** 所有位置 */
49
+ dataSource: any[];
50
+ /** 所有分类 */
51
+ unitCategory: any[];
52
+ }
53
+ @Component({
54
+ name: 'HtSelectCategory',
55
+ })
56
+ export default class HtSelectUser extends Vue {
57
+ @Prop() value!: string;
58
+ @Prop() org!: string;
59
+ @Prop() size!: string;
60
+ /** 是否禁用 */
61
+ @Prop() disabled?: boolean;
62
+ @Prop() heightAuto?: boolean;
63
+ @Prop() placeholder?: string;
64
+ /** 是否可以清除 */
65
+ @Prop() clearable?: boolean;
66
+ @Prop({ default: true }) show?: boolean;
67
+ @Prop({ default: false }) multiple?: boolean;
68
+ @Prop({ default: true }) showAllLevels?: boolean;
69
+ @Prop({ default: false }) checkStrictly?: boolean;
70
+ /* 是否只读 */
71
+ @Prop({ default: false }) readonly?: boolean;
72
+ @Prop({ default: false }) panel?: boolean;
73
+ @Prop({ default: false }) collapseTags?: boolean;
74
+ @Prop({ default: true }) appendToBody?: boolean;
75
+ @Prop({ default: 'name' }) defalutName?: string;
76
+ /** 父级id */
77
+ @Prop() parentId?: string;
78
+
79
+ /** 数据 */
80
+ state: State = {
81
+ loading: false,
82
+ value: undefined,
83
+ positionName: [],
84
+ dataSource: [],
85
+ unitCategory: [],
86
+ };
87
+ /** 生命周期 */
88
+ created() {
89
+ //
90
+ if (!this.readonly) {
91
+ this.getAllList();
92
+ }
93
+ }
94
+ /** 根据id获取单个 */
95
+ getSingle(val?: string | string[]) {
96
+ this.state.positionName = [];
97
+ if (val) {
98
+ let arr: string[] = [];
99
+ if (Array.isArray(val)) {
100
+ arr = val;
101
+ } else {
102
+ arr = val.split(',');
103
+ }
104
+ arr.forEach((item) => {
105
+ _axios
106
+ .get(`/asset_manage/api/asset-management/asset-categories/${item}`)
107
+ .then((res) => {
108
+ const data = res.data;
109
+ this.state.positionName.push(
110
+ `${data.displayName}${data.code ? `(${data.code})` : ''}`
111
+ );
112
+ });
113
+ });
114
+ } else {
115
+ this.state.positionName = [];
116
+ }
117
+ }
118
+
119
+ /** 获取单位列表 */
120
+ getAllList() {
121
+ _axios
122
+ .get(`/asset_manage/api/asset-management/asset-categories/list`, {
123
+ params: { Recursive: true, CurrentId: this.parentId },
124
+ })
125
+ .then((res) => {
126
+ const data = res.data.items || [];
127
+ this.state.dataSource = data;
128
+ });
129
+ }
130
+ /** 方法 */
131
+ /**选择回调 */
132
+ handleChange(e?: string | string[]) {
133
+ const allData = [...this.state.dataSource];
134
+ if (!e || !e.length) {
135
+ this.$emit('input', e);
136
+ this.$emit('change', e);
137
+ } else {
138
+ let seletId: any = {};
139
+ if (Array.isArray(e)) {
140
+ e.forEach((item) => {
141
+ seletId = { ...seletId, [item]: true };
142
+ });
143
+ } else {
144
+ seletId = { [e]: true };
145
+ }
146
+ const data = allData.filter((item) => seletId[item.id]);
147
+ this.$emit('input', e, data);
148
+ this.$emit('change', e, data);
149
+ }
150
+ }
151
+ @Watch('value', { immediate: true })
152
+ setValue(val: any) {
153
+ this.state.value = val;
154
+ if (this.readonly) {
155
+ this.getSingle(val);
156
+ } else {
157
+ // this.getAllList(this.org);
158
+ }
159
+ }
160
+
161
+ formatData(data: any[]) {
162
+ for (let i = 0; i < data.length; i++) {
163
+ const item = data[i];
164
+ item.name = `${item.displayName}${item.code ? `(${item.code})` : ''}`;
165
+ if (item.children.length < 1) {
166
+ item.children = undefined;
167
+ } else {
168
+ this.formatData(item.children);
169
+ }
170
+ }
171
+ return data;
172
+ }
173
+ get options() {
174
+ const { dataSource } = this.state;
175
+ const allData = this.formatData(dataSource);
176
+ return allData;
177
+ }
178
+ }
179
+ </script>
180
+ <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-18 12:21:25
7
+ * @LastEditTime: 2023-02-01 16:50:13
8
8
  -->
9
9
  <template>
10
10
  <div v-loading="state.loading" style="background:#fff">
@@ -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-15 15:54:18
7
+ * @LastEditTime: 2023-02-01 16:30:54
8
8
  */
9
9
 
10
10
  // 导入组件
@@ -32,13 +32,14 @@ import HtSelectTimeSlot from './HtSelectTimeSlot'
32
32
  import HtMore from './HtMore'
33
33
  import HtSelectUnit from './HtSelectUnit'
34
34
  import HtSelectPosition from './HtSelectPosition'
35
+ import HtSelectCategory from './HtSelectCategory'
35
36
 
36
37
 
37
38
 
38
39
 
39
40
 
40
41
  // 存储组件列表
41
- const components = [HtSelectUnit, HtSelectPosition, HtMore, HtSelectTimeSlot, HtSelectCron, HtBaseData, HtDrawer, HtShowBaseType, HtSelectTable, HtPagination, HtTable, HtExport, HtUpload, HtMd, HtCountDown, HtUploadFiles, HtSelectBaseData, HtSelectOrg, HtSelectUser, HtShowBaseData, HtOrgInfo]
42
+ const components = [HtSelectCategory, HtSelectUnit, HtSelectPosition, HtMore, HtSelectTimeSlot, HtSelectCron, HtBaseData, HtDrawer, HtShowBaseType, HtSelectTable, HtPagination, HtTable, HtExport, HtUpload, HtMd, HtCountDown, HtUploadFiles, HtSelectBaseData, HtSelectOrg, HtSelectUser, HtShowBaseData, HtOrgInfo]
42
43
  // 定义 install 方法,接收 Vue 作为参数。如果使用 use 注册插件,则所有的组件都将被注册
43
44
  const install = function (Vue: any) {
44
45
  // 判断是否安装
@@ -55,7 +56,7 @@ export default {
55
56
  install,
56
57
  // 以下是具体的组件列表
57
58
  HtSelectTable, HtSelectPosition, HtPagination, HtShowBaseType, HtTable, HtExport, HtUpload, HtMd, HtCountDown, HtUploadFiles, HtMore,
58
- HtSelectUnit,
59
+ HtSelectUnit, HtSelectCategory,
59
60
  HtSelectBaseData, HtSelectOrg, HtSelectUser, HtShowBaseData, HtOrgInfo, HtBaseData, HtDrawer, HtSelectCron, HtSelectTimeSlot
60
61
  }
61
62