bl-common-vue3 3.7.20 → 3.7.21
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.
- package/.history/package_20230222150904.json +54 -54
- package/.history/package_20230227191203.json +54 -54
- package/.history/package_20230227193052.json +54 -54
- package/.history/package_20230308102851.json +54 -54
- package/.history/src/common/utils/util_20230210124242.js +156 -156
- package/.history/src/common/utils/util_20230228192253.js +157 -157
- package/.history/src/components/BLIcon/index_20230103102354.js +17 -17
- package/.history/src/components/BLIcon/index_20230227191108.js +18 -18
- package/.history/src/components/BLIcon/index_20230227193020.js +18 -18
- package/.history/src/components/BLIcon/index_20230227193025.js +18 -18
- package/.history/src/components/ChooseHousingResources/index_20230222193654.vue +1252 -1252
- package/.history/src/components/ChooseHousingResources/index_20230227191144.vue +1252 -1252
- package/.history/src/components/ChooseHousingResources/index_20230227193035.vue +1252 -1252
- package/.history/src/components/VillageTree/index_20230227202552.vue +298 -298
- package/.history/src/components/VillageTree/index_20230308102756.vue +305 -305
- package/.history/src/components/VillageTree/index_20230308113141.vue +305 -305
- package/.history/src/components/components_20230216190147.js +15 -15
- package/.history/src/components/components_20230227191116.js +15 -15
- package/.history/src/components/components_20230227191117.js +15 -15
- package/.history/src/components/components_20230308102833.js +16 -16
- package/.idea/components_vue3.iml +12 -0
- package/.idea/inspectionProfiles/Project_Default.xml +6 -0
- package/.idea/modules.xml +8 -0
- package/.idea/vcs.xml +6 -0
- package/lib/vue3common.common.js +21317 -34351
- package/lib/vue3common.umd.js +21317 -34351
- package/lib/vue3common.umd.min.js +41 -37
- package/package.json +1 -1
|
@@ -1,305 +1,305 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<div class="hide-scroller-bar" style="height: 100%; overflow: hidden auto">
|
|
3
|
-
<a-tree
|
|
4
|
-
v-if="treeList.length"
|
|
5
|
-
show-icon
|
|
6
|
-
v-model:expandedKeys="expandedKeys"
|
|
7
|
-
:selectedKeys="selectedKeys"
|
|
8
|
-
:tree-data="treeList"
|
|
9
|
-
:blockNode="true"
|
|
10
|
-
:selectable="true"
|
|
11
|
-
:load-data="onLoadTreeData"
|
|
12
|
-
@select="onTreeSelect"
|
|
13
|
-
>
|
|
14
|
-
<!-- 图标 -->
|
|
15
|
-
<template #topCompanyIcon>
|
|
16
|
-
<bl-icon type="tree-jigou" class="tree-icon" />
|
|
17
|
-
</template>
|
|
18
|
-
<template #departmentIcon>
|
|
19
|
-
<GoldenFilled class="tree-icon" />
|
|
20
|
-
</template>
|
|
21
|
-
<template #villageIcon>
|
|
22
|
-
<bl-icon type="tree-xiangmu" class="tree-icon" />
|
|
23
|
-
</template>
|
|
24
|
-
<template #buildIcon>
|
|
25
|
-
<bl-icon type="tree-louyu" class="tree-icon" />
|
|
26
|
-
</template>
|
|
27
|
-
<template #layerIcon>
|
|
28
|
-
<bl-icon type="tree-louceng" class="tree-icon" />
|
|
29
|
-
</template>
|
|
30
|
-
<template #roomIcon>
|
|
31
|
-
<bl-icon type="tree-fangjian" class="tree-icon" />
|
|
32
|
-
</template>
|
|
33
|
-
</a-tree>
|
|
34
|
-
</div>
|
|
35
|
-
</template>
|
|
36
|
-
|
|
37
|
-
<script>
|
|
38
|
-
import { defineComponent, reactive, toRefs } from "vue";
|
|
39
|
-
import BlIcon from "../BLIcon/index.js";
|
|
40
|
-
// import { BlIcon } from "bl-common-vue3";
|
|
41
|
-
import { GoldenFilled } from "@ant-design/icons-vue";
|
|
42
|
-
import { Tree } from "ant-design-vue";
|
|
43
|
-
export default defineComponent({
|
|
44
|
-
name: "VillageTree",
|
|
45
|
-
props: {
|
|
46
|
-
userChecked: {
|
|
47
|
-
type: Number,
|
|
48
|
-
default: 1,
|
|
49
|
-
},
|
|
50
|
-
attachDpt: {
|
|
51
|
-
type: Number,
|
|
52
|
-
default: 1,
|
|
53
|
-
},
|
|
54
|
-
// 是否展示租客画像
|
|
55
|
-
showRentIcon: {
|
|
56
|
-
type: Boolean,
|
|
57
|
-
default: false,
|
|
58
|
-
},
|
|
59
|
-
},
|
|
60
|
-
components: { GoldenFilled, "bl-icon": BlIcon, "a-tree": Tree },
|
|
61
|
-
setup(props, { emit }) {
|
|
62
|
-
const state = reactive({
|
|
63
|
-
treeList: [],
|
|
64
|
-
expandedKeys: [],
|
|
65
|
-
selectedKeys: [],
|
|
66
|
-
selected: {},
|
|
67
|
-
});
|
|
68
|
-
|
|
69
|
-
/** 点击选中当前项 */
|
|
70
|
-
const onTreeSelect = (value, e) => {
|
|
71
|
-
const current = e.node.dataRef;
|
|
72
|
-
if (current.childType == "department") {
|
|
73
|
-
// 部门不允许选中
|
|
74
|
-
return;
|
|
75
|
-
}
|
|
76
|
-
setSelected(current);
|
|
77
|
-
};
|
|
78
|
-
|
|
79
|
-
/** 设置选中 */
|
|
80
|
-
const setSelected = (current) => {
|
|
81
|
-
state.selectedKeys = [current.key];
|
|
82
|
-
state.selected = current;
|
|
83
|
-
emit("getCurrent", { current });
|
|
84
|
-
};
|
|
85
|
-
|
|
86
|
-
/** 动态加载树数据 */
|
|
87
|
-
const onLoadTreeData = (treeNode) => {
|
|
88
|
-
return new Promise((resolve) => {
|
|
89
|
-
const { dataRef } = treeNode;
|
|
90
|
-
if (dataRef.isLeaf || (dataRef.children && dataRef.children.length)) {
|
|
91
|
-
resolve();
|
|
92
|
-
return;
|
|
93
|
-
}
|
|
94
|
-
if (dataRef.childType === "build") {
|
|
95
|
-
getLayerList(dataRef).then(() => {
|
|
96
|
-
resolve();
|
|
97
|
-
});
|
|
98
|
-
} else if (dataRef.childType === "layer") {
|
|
99
|
-
getRoomList(dataRef).then(() => {
|
|
100
|
-
resolve();
|
|
101
|
-
});
|
|
102
|
-
}
|
|
103
|
-
});
|
|
104
|
-
};
|
|
105
|
-
// 获取楼层列表
|
|
106
|
-
const getLayerList = (build) => {
|
|
107
|
-
return new Promise((resolve) => {
|
|
108
|
-
if (build.isLeaf || (build.children && build.children.length)) {
|
|
109
|
-
resolve(build.children || []);
|
|
110
|
-
return;
|
|
111
|
-
}
|
|
112
|
-
emit("request", {
|
|
113
|
-
params: {
|
|
114
|
-
method: "get",
|
|
115
|
-
server: "/village",
|
|
116
|
-
url: "/project/layer/all",
|
|
117
|
-
extra: {
|
|
118
|
-
build_id: build.id,
|
|
119
|
-
},
|
|
120
|
-
},
|
|
121
|
-
success: (res) => {
|
|
122
|
-
if (res.list.length) {
|
|
123
|
-
build.children = res.list.map((item) => ({
|
|
124
|
-
...item,
|
|
125
|
-
childType: "layer",
|
|
126
|
-
key: `${build.key}_layer_${item.id}`,
|
|
127
|
-
title: item.layer_name,
|
|
128
|
-
level: build.level + 1,
|
|
129
|
-
extra: {
|
|
130
|
-
...build.extra,
|
|
131
|
-
build_id: build.id,
|
|
132
|
-
build_number: build.build_number,
|
|
133
|
-
build_name: build.build_name,
|
|
134
|
-
},
|
|
135
|
-
isLeaf: false,
|
|
136
|
-
slots: {
|
|
137
|
-
icon: "layerIcon",
|
|
138
|
-
},
|
|
139
|
-
}));
|
|
140
|
-
}
|
|
141
|
-
resolve(build.children);
|
|
142
|
-
},
|
|
143
|
-
});
|
|
144
|
-
});
|
|
145
|
-
};
|
|
146
|
-
// 获取房间列表
|
|
147
|
-
const getRoomList = (layer) => {
|
|
148
|
-
return new Promise((resolve) => {
|
|
149
|
-
if (layer.isLeaf || (layer.children && layer.children.length)) {
|
|
150
|
-
resolve(layer.children || []);
|
|
151
|
-
return;
|
|
152
|
-
}
|
|
153
|
-
emit("request", {
|
|
154
|
-
params: {
|
|
155
|
-
method: "get",
|
|
156
|
-
server: "/village",
|
|
157
|
-
url: "/project/room/all",
|
|
158
|
-
extra: {
|
|
159
|
-
village_id: layer.extra.village_id,
|
|
160
|
-
layer_id: layer.id,
|
|
161
|
-
},
|
|
162
|
-
},
|
|
163
|
-
success: (res) => {
|
|
164
|
-
if (res.list.length) {
|
|
165
|
-
layer.children = res.list.map((item) => {
|
|
166
|
-
let newItem = {
|
|
167
|
-
...item,
|
|
168
|
-
childType: "room",
|
|
169
|
-
key: `${layer.key}_room_${item.id}`,
|
|
170
|
-
title: item.room_name,
|
|
171
|
-
level: layer.level + 1,
|
|
172
|
-
layer_id: layer.id,
|
|
173
|
-
layer_number: layer.layer_number,
|
|
174
|
-
layer_name: layer.layer_name,
|
|
175
|
-
property_area: item.charging_area,
|
|
176
|
-
lease_square: item.rental_area,
|
|
177
|
-
extra: {
|
|
178
|
-
...layer.extra,
|
|
179
|
-
layer_id: layer.id,
|
|
180
|
-
layer_number: layer.layer_number,
|
|
181
|
-
layer_name: layer.layer_name,
|
|
182
|
-
},
|
|
183
|
-
isLeaf: true,
|
|
184
|
-
slots: {
|
|
185
|
-
icon: "roomIcon",
|
|
186
|
-
title: "roomTitle",
|
|
187
|
-
},
|
|
188
|
-
};
|
|
189
|
-
return newItem;
|
|
190
|
-
});
|
|
191
|
-
}
|
|
192
|
-
resolve(layer.children);
|
|
193
|
-
},
|
|
194
|
-
});
|
|
195
|
-
});
|
|
196
|
-
};
|
|
197
|
-
|
|
198
|
-
/** 获取树数据 */
|
|
199
|
-
// 获取部门树列表
|
|
200
|
-
const getDeptTreeList = (list, level) => {
|
|
201
|
-
let result = [];
|
|
202
|
-
for (let listItem of list) {
|
|
203
|
-
// 非项目管理部门
|
|
204
|
-
if (listItem.type !== 3) {
|
|
205
|
-
listItem.childType = "department"; //listItem.type == 0 ? "topCompany" : "department";
|
|
206
|
-
listItem.key = `${listItem.childType}-${listItem.id}`; // 部门用中划线,房源用下划线,方便整理选中房源key
|
|
207
|
-
listItem.title = listItem.name;
|
|
208
|
-
listItem.level = level;
|
|
209
|
-
listItem.slots = {
|
|
210
|
-
icon: `${listItem.childType}Icon`,
|
|
211
|
-
};
|
|
212
|
-
listItem.children = [];
|
|
213
|
-
if (listItem.subcat && listItem.subcat.length) {
|
|
214
|
-
listItem.children = getDeptTreeList(listItem.subcat, level + 1);
|
|
215
|
-
}
|
|
216
|
-
if (listItem.villageList && listItem.villageList.length) {
|
|
217
|
-
const villageList = getVillageTreeList(
|
|
218
|
-
listItem.villageList,
|
|
219
|
-
level,
|
|
220
|
-
listItem.key
|
|
221
|
-
);
|
|
222
|
-
listItem.children = [...listItem.children, ...villageList];
|
|
223
|
-
}
|
|
224
|
-
listItem.isLeaf = listItem.children.length === 0;
|
|
225
|
-
result.push(listItem);
|
|
226
|
-
state.expandedKeys.push(listItem.key);
|
|
227
|
-
}
|
|
228
|
-
}
|
|
229
|
-
return result;
|
|
230
|
-
};
|
|
231
|
-
// 获取项目树列表
|
|
232
|
-
const getVillageTreeList = (villageList, level = 1, parentKey) => {
|
|
233
|
-
return villageList.map((village) => {
|
|
234
|
-
village.childType = "village";
|
|
235
|
-
village.key = `${parentKey ? parentKey + "-" : ""}${
|
|
236
|
-
village.childType
|
|
237
|
-
}_${village.id}`;
|
|
238
|
-
|
|
239
|
-
village.title = village.name;
|
|
240
|
-
village.level = level;
|
|
241
|
-
village.slots = {
|
|
242
|
-
icon: `${village.childType}Icon`,
|
|
243
|
-
};
|
|
244
|
-
if (village.buildList && village.buildList.length) {
|
|
245
|
-
village.isLeaf = false;
|
|
246
|
-
village.children = village.buildList.map((build) => ({
|
|
247
|
-
...build,
|
|
248
|
-
level,
|
|
249
|
-
childType: "build",
|
|
250
|
-
key: `${village.key}_build_${build.id}`,
|
|
251
|
-
title: build.build_name,
|
|
252
|
-
extra: {
|
|
253
|
-
village_id: village.id,
|
|
254
|
-
village_name: village.name,
|
|
255
|
-
village_short_name: village.short_name,
|
|
256
|
-
},
|
|
257
|
-
slots: {
|
|
258
|
-
icon: "buildIcon",
|
|
259
|
-
},
|
|
260
|
-
isLeaf: false,
|
|
261
|
-
}));
|
|
262
|
-
} else {
|
|
263
|
-
village.isLeaf = true;
|
|
264
|
-
}
|
|
265
|
-
state.expandedKeys.push(village.key);
|
|
266
|
-
if (!state.selectedKeys.length) {
|
|
267
|
-
setSelected(village);
|
|
268
|
-
}
|
|
269
|
-
return village;
|
|
270
|
-
});
|
|
271
|
-
};
|
|
272
|
-
|
|
273
|
-
const getVillageInfo = () => {
|
|
274
|
-
emit("request", {
|
|
275
|
-
params: {
|
|
276
|
-
method: "get",
|
|
277
|
-
server: "/org",
|
|
278
|
-
url: "/build/villageAndBuildList/v2",
|
|
279
|
-
extra: {
|
|
280
|
-
checked: props.attachDpt ? 1 : props.userChecked,
|
|
281
|
-
attach_department: props.attachDpt,
|
|
282
|
-
},
|
|
283
|
-
},
|
|
284
|
-
success: (res) => {
|
|
285
|
-
state.treeList = res.list
|
|
286
|
-
? getDeptTreeList(res.list, 1)
|
|
287
|
-
: getVillageTreeList(res.villageList);
|
|
288
|
-
},
|
|
289
|
-
});
|
|
290
|
-
};
|
|
291
|
-
|
|
292
|
-
const init = () => {
|
|
293
|
-
getVillageInfo();
|
|
294
|
-
};
|
|
295
|
-
|
|
296
|
-
init();
|
|
297
|
-
|
|
298
|
-
return {
|
|
299
|
-
...toRefs(state),
|
|
300
|
-
onLoadTreeData,
|
|
301
|
-
onTreeSelect,
|
|
302
|
-
};
|
|
303
|
-
},
|
|
304
|
-
});
|
|
305
|
-
</script>
|
|
1
|
+
<template>
|
|
2
|
+
<div class="hide-scroller-bar" style="height: 100%; overflow: hidden auto">
|
|
3
|
+
<a-tree
|
|
4
|
+
v-if="treeList.length"
|
|
5
|
+
show-icon
|
|
6
|
+
v-model:expandedKeys="expandedKeys"
|
|
7
|
+
:selectedKeys="selectedKeys"
|
|
8
|
+
:tree-data="treeList"
|
|
9
|
+
:blockNode="true"
|
|
10
|
+
:selectable="true"
|
|
11
|
+
:load-data="onLoadTreeData"
|
|
12
|
+
@select="onTreeSelect"
|
|
13
|
+
>
|
|
14
|
+
<!-- 图标 -->
|
|
15
|
+
<template #topCompanyIcon>
|
|
16
|
+
<bl-icon type="tree-jigou" class="tree-icon" />
|
|
17
|
+
</template>
|
|
18
|
+
<template #departmentIcon>
|
|
19
|
+
<GoldenFilled class="tree-icon" />
|
|
20
|
+
</template>
|
|
21
|
+
<template #villageIcon>
|
|
22
|
+
<bl-icon type="tree-xiangmu" class="tree-icon" />
|
|
23
|
+
</template>
|
|
24
|
+
<template #buildIcon>
|
|
25
|
+
<bl-icon type="tree-louyu" class="tree-icon" />
|
|
26
|
+
</template>
|
|
27
|
+
<template #layerIcon>
|
|
28
|
+
<bl-icon type="tree-louceng" class="tree-icon" />
|
|
29
|
+
</template>
|
|
30
|
+
<template #roomIcon>
|
|
31
|
+
<bl-icon type="tree-fangjian" class="tree-icon" />
|
|
32
|
+
</template>
|
|
33
|
+
</a-tree>
|
|
34
|
+
</div>
|
|
35
|
+
</template>
|
|
36
|
+
|
|
37
|
+
<script>
|
|
38
|
+
import { defineComponent, reactive, toRefs } from "vue";
|
|
39
|
+
import BlIcon from "../BLIcon/index.js";
|
|
40
|
+
// import { BlIcon } from "bl-common-vue3";
|
|
41
|
+
import { GoldenFilled } from "@ant-design/icons-vue";
|
|
42
|
+
import { Tree } from "ant-design-vue";
|
|
43
|
+
export default defineComponent({
|
|
44
|
+
name: "VillageTree",
|
|
45
|
+
props: {
|
|
46
|
+
userChecked: {
|
|
47
|
+
type: Number,
|
|
48
|
+
default: 1,
|
|
49
|
+
},
|
|
50
|
+
attachDpt: {
|
|
51
|
+
type: Number,
|
|
52
|
+
default: 1,
|
|
53
|
+
},
|
|
54
|
+
// 是否展示租客画像
|
|
55
|
+
showRentIcon: {
|
|
56
|
+
type: Boolean,
|
|
57
|
+
default: false,
|
|
58
|
+
},
|
|
59
|
+
},
|
|
60
|
+
components: { GoldenFilled, "bl-icon": BlIcon, "a-tree": Tree },
|
|
61
|
+
setup(props, { emit }) {
|
|
62
|
+
const state = reactive({
|
|
63
|
+
treeList: [],
|
|
64
|
+
expandedKeys: [],
|
|
65
|
+
selectedKeys: [],
|
|
66
|
+
selected: {},
|
|
67
|
+
});
|
|
68
|
+
|
|
69
|
+
/** 点击选中当前项 */
|
|
70
|
+
const onTreeSelect = (value, e) => {
|
|
71
|
+
const current = e.node.dataRef;
|
|
72
|
+
if (current.childType == "department") {
|
|
73
|
+
// 部门不允许选中
|
|
74
|
+
return;
|
|
75
|
+
}
|
|
76
|
+
setSelected(current);
|
|
77
|
+
};
|
|
78
|
+
|
|
79
|
+
/** 设置选中 */
|
|
80
|
+
const setSelected = (current) => {
|
|
81
|
+
state.selectedKeys = [current.key];
|
|
82
|
+
state.selected = current;
|
|
83
|
+
emit("getCurrent", { current });
|
|
84
|
+
};
|
|
85
|
+
|
|
86
|
+
/** 动态加载树数据 */
|
|
87
|
+
const onLoadTreeData = (treeNode) => {
|
|
88
|
+
return new Promise((resolve) => {
|
|
89
|
+
const { dataRef } = treeNode;
|
|
90
|
+
if (dataRef.isLeaf || (dataRef.children && dataRef.children.length)) {
|
|
91
|
+
resolve();
|
|
92
|
+
return;
|
|
93
|
+
}
|
|
94
|
+
if (dataRef.childType === "build") {
|
|
95
|
+
getLayerList(dataRef).then(() => {
|
|
96
|
+
resolve();
|
|
97
|
+
});
|
|
98
|
+
} else if (dataRef.childType === "layer") {
|
|
99
|
+
getRoomList(dataRef).then(() => {
|
|
100
|
+
resolve();
|
|
101
|
+
});
|
|
102
|
+
}
|
|
103
|
+
});
|
|
104
|
+
};
|
|
105
|
+
// 获取楼层列表
|
|
106
|
+
const getLayerList = (build) => {
|
|
107
|
+
return new Promise((resolve) => {
|
|
108
|
+
if (build.isLeaf || (build.children && build.children.length)) {
|
|
109
|
+
resolve(build.children || []);
|
|
110
|
+
return;
|
|
111
|
+
}
|
|
112
|
+
emit("request", {
|
|
113
|
+
params: {
|
|
114
|
+
method: "get",
|
|
115
|
+
server: "/village",
|
|
116
|
+
url: "/project/layer/all",
|
|
117
|
+
extra: {
|
|
118
|
+
build_id: build.id,
|
|
119
|
+
},
|
|
120
|
+
},
|
|
121
|
+
success: (res) => {
|
|
122
|
+
if (res.list.length) {
|
|
123
|
+
build.children = res.list.map((item) => ({
|
|
124
|
+
...item,
|
|
125
|
+
childType: "layer",
|
|
126
|
+
key: `${build.key}_layer_${item.id}`,
|
|
127
|
+
title: item.layer_name,
|
|
128
|
+
level: build.level + 1,
|
|
129
|
+
extra: {
|
|
130
|
+
...build.extra,
|
|
131
|
+
build_id: build.id,
|
|
132
|
+
build_number: build.build_number,
|
|
133
|
+
build_name: build.build_name,
|
|
134
|
+
},
|
|
135
|
+
isLeaf: false,
|
|
136
|
+
slots: {
|
|
137
|
+
icon: "layerIcon",
|
|
138
|
+
},
|
|
139
|
+
}));
|
|
140
|
+
}
|
|
141
|
+
resolve(build.children);
|
|
142
|
+
},
|
|
143
|
+
});
|
|
144
|
+
});
|
|
145
|
+
};
|
|
146
|
+
// 获取房间列表
|
|
147
|
+
const getRoomList = (layer) => {
|
|
148
|
+
return new Promise((resolve) => {
|
|
149
|
+
if (layer.isLeaf || (layer.children && layer.children.length)) {
|
|
150
|
+
resolve(layer.children || []);
|
|
151
|
+
return;
|
|
152
|
+
}
|
|
153
|
+
emit("request", {
|
|
154
|
+
params: {
|
|
155
|
+
method: "get",
|
|
156
|
+
server: "/village",
|
|
157
|
+
url: "/project/room/all",
|
|
158
|
+
extra: {
|
|
159
|
+
village_id: layer.extra.village_id,
|
|
160
|
+
layer_id: layer.id,
|
|
161
|
+
},
|
|
162
|
+
},
|
|
163
|
+
success: (res) => {
|
|
164
|
+
if (res.list.length) {
|
|
165
|
+
layer.children = res.list.map((item) => {
|
|
166
|
+
let newItem = {
|
|
167
|
+
...item,
|
|
168
|
+
childType: "room",
|
|
169
|
+
key: `${layer.key}_room_${item.id}`,
|
|
170
|
+
title: item.room_name,
|
|
171
|
+
level: layer.level + 1,
|
|
172
|
+
layer_id: layer.id,
|
|
173
|
+
layer_number: layer.layer_number,
|
|
174
|
+
layer_name: layer.layer_name,
|
|
175
|
+
property_area: item.charging_area,
|
|
176
|
+
lease_square: item.rental_area,
|
|
177
|
+
extra: {
|
|
178
|
+
...layer.extra,
|
|
179
|
+
layer_id: layer.id,
|
|
180
|
+
layer_number: layer.layer_number,
|
|
181
|
+
layer_name: layer.layer_name,
|
|
182
|
+
},
|
|
183
|
+
isLeaf: true,
|
|
184
|
+
slots: {
|
|
185
|
+
icon: "roomIcon",
|
|
186
|
+
title: "roomTitle",
|
|
187
|
+
},
|
|
188
|
+
};
|
|
189
|
+
return newItem;
|
|
190
|
+
});
|
|
191
|
+
}
|
|
192
|
+
resolve(layer.children);
|
|
193
|
+
},
|
|
194
|
+
});
|
|
195
|
+
});
|
|
196
|
+
};
|
|
197
|
+
|
|
198
|
+
/** 获取树数据 */
|
|
199
|
+
// 获取部门树列表
|
|
200
|
+
const getDeptTreeList = (list, level) => {
|
|
201
|
+
let result = [];
|
|
202
|
+
for (let listItem of list) {
|
|
203
|
+
// 非项目管理部门
|
|
204
|
+
if (listItem.type !== 3) {
|
|
205
|
+
listItem.childType = "department"; //listItem.type == 0 ? "topCompany" : "department";
|
|
206
|
+
listItem.key = `${listItem.childType}-${listItem.id}`; // 部门用中划线,房源用下划线,方便整理选中房源key
|
|
207
|
+
listItem.title = listItem.name;
|
|
208
|
+
listItem.level = level;
|
|
209
|
+
listItem.slots = {
|
|
210
|
+
icon: `${listItem.childType}Icon`,
|
|
211
|
+
};
|
|
212
|
+
listItem.children = [];
|
|
213
|
+
if (listItem.subcat && listItem.subcat.length) {
|
|
214
|
+
listItem.children = getDeptTreeList(listItem.subcat, level + 1);
|
|
215
|
+
}
|
|
216
|
+
if (listItem.villageList && listItem.villageList.length) {
|
|
217
|
+
const villageList = getVillageTreeList(
|
|
218
|
+
listItem.villageList,
|
|
219
|
+
level,
|
|
220
|
+
listItem.key
|
|
221
|
+
);
|
|
222
|
+
listItem.children = [...listItem.children, ...villageList];
|
|
223
|
+
}
|
|
224
|
+
listItem.isLeaf = listItem.children.length === 0;
|
|
225
|
+
result.push(listItem);
|
|
226
|
+
state.expandedKeys.push(listItem.key);
|
|
227
|
+
}
|
|
228
|
+
}
|
|
229
|
+
return result;
|
|
230
|
+
};
|
|
231
|
+
// 获取项目树列表
|
|
232
|
+
const getVillageTreeList = (villageList, level = 1, parentKey) => {
|
|
233
|
+
return villageList.map((village) => {
|
|
234
|
+
village.childType = "village";
|
|
235
|
+
village.key = `${parentKey ? parentKey + "-" : ""}${
|
|
236
|
+
village.childType
|
|
237
|
+
}_${village.id}`;
|
|
238
|
+
|
|
239
|
+
village.title = village.name;
|
|
240
|
+
village.level = level;
|
|
241
|
+
village.slots = {
|
|
242
|
+
icon: `${village.childType}Icon`,
|
|
243
|
+
};
|
|
244
|
+
if (village.buildList && village.buildList.length) {
|
|
245
|
+
village.isLeaf = false;
|
|
246
|
+
village.children = village.buildList.map((build) => ({
|
|
247
|
+
...build,
|
|
248
|
+
level,
|
|
249
|
+
childType: "build",
|
|
250
|
+
key: `${village.key}_build_${build.id}`,
|
|
251
|
+
title: build.build_name,
|
|
252
|
+
extra: {
|
|
253
|
+
village_id: village.id,
|
|
254
|
+
village_name: village.name,
|
|
255
|
+
village_short_name: village.short_name,
|
|
256
|
+
},
|
|
257
|
+
slots: {
|
|
258
|
+
icon: "buildIcon",
|
|
259
|
+
},
|
|
260
|
+
isLeaf: false,
|
|
261
|
+
}));
|
|
262
|
+
} else {
|
|
263
|
+
village.isLeaf = true;
|
|
264
|
+
}
|
|
265
|
+
state.expandedKeys.push(village.key);
|
|
266
|
+
if (!state.selectedKeys.length) {
|
|
267
|
+
setSelected(village);
|
|
268
|
+
}
|
|
269
|
+
return village;
|
|
270
|
+
});
|
|
271
|
+
};
|
|
272
|
+
|
|
273
|
+
const getVillageInfo = () => {
|
|
274
|
+
emit("request", {
|
|
275
|
+
params: {
|
|
276
|
+
method: "get",
|
|
277
|
+
server: "/org",
|
|
278
|
+
url: "/build/villageAndBuildList/v2",
|
|
279
|
+
extra: {
|
|
280
|
+
checked: props.attachDpt ? 1 : props.userChecked,
|
|
281
|
+
attach_department: props.attachDpt,
|
|
282
|
+
},
|
|
283
|
+
},
|
|
284
|
+
success: (res) => {
|
|
285
|
+
state.treeList = res.list
|
|
286
|
+
? getDeptTreeList(res.list, 1)
|
|
287
|
+
: getVillageTreeList(res.villageList);
|
|
288
|
+
},
|
|
289
|
+
});
|
|
290
|
+
};
|
|
291
|
+
|
|
292
|
+
const init = () => {
|
|
293
|
+
getVillageInfo();
|
|
294
|
+
};
|
|
295
|
+
|
|
296
|
+
init();
|
|
297
|
+
|
|
298
|
+
return {
|
|
299
|
+
...toRefs(state),
|
|
300
|
+
onLoadTreeData,
|
|
301
|
+
onTreeSelect,
|
|
302
|
+
};
|
|
303
|
+
},
|
|
304
|
+
});
|
|
305
|
+
</script>
|
|
@@ -1,15 +1,15 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* 组件导出
|
|
3
|
-
*/
|
|
4
|
-
|
|
5
|
-
export { default as ChooseOrgMember } from "./ChooseOrgMember/index.vue";
|
|
6
|
-
export { default as PaySetting } from "./PaySetting/index.vue";
|
|
7
|
-
export { default as QrcodeModal } from "./QrcodeModal/index.vue";
|
|
8
|
-
export { default as TextTip } from "./TextTip/index.vue";
|
|
9
|
-
export { default as ImportFile } from "./ImportFile/index.vue";
|
|
10
|
-
export { default as PreviewImg } from "./PreviewImg/index.vue";
|
|
11
|
-
export { default as ChooseBuildings } from "./ChooseBuildings/index.vue";
|
|
12
|
-
export { default as SelectProperty } from "./SelectProperty/index.vue";
|
|
13
|
-
export { default as ChooseHousingResources } from "./ChooseHousingResources/index.vue";
|
|
14
|
-
export { default as CheckedHousingResources } from "./CheckedHousingResources/index.vue";
|
|
15
|
-
export { default as BLIcon } from "./BLIcon/index.js";
|
|
1
|
+
/**
|
|
2
|
+
* 组件导出
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
export { default as ChooseOrgMember } from "./ChooseOrgMember/index.vue";
|
|
6
|
+
export { default as PaySetting } from "./PaySetting/index.vue";
|
|
7
|
+
export { default as QrcodeModal } from "./QrcodeModal/index.vue";
|
|
8
|
+
export { default as TextTip } from "./TextTip/index.vue";
|
|
9
|
+
export { default as ImportFile } from "./ImportFile/index.vue";
|
|
10
|
+
export { default as PreviewImg } from "./PreviewImg/index.vue";
|
|
11
|
+
export { default as ChooseBuildings } from "./ChooseBuildings/index.vue";
|
|
12
|
+
export { default as SelectProperty } from "./SelectProperty/index.vue";
|
|
13
|
+
export { default as ChooseHousingResources } from "./ChooseHousingResources/index.vue";
|
|
14
|
+
export { default as CheckedHousingResources } from "./CheckedHousingResources/index.vue";
|
|
15
|
+
export { default as BLIcon } from "./BLIcon/index.js";
|
|
@@ -1,15 +1,15 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* 组件导出
|
|
3
|
-
*/
|
|
4
|
-
|
|
5
|
-
export { default as ChooseOrgMember } from "./ChooseOrgMember/index.vue";
|
|
6
|
-
export { default as PaySetting } from "./PaySetting/index.vue";
|
|
7
|
-
export { default as QrcodeModal } from "./QrcodeModal/index.vue";
|
|
8
|
-
export { default as TextTip } from "./TextTip/index.vue";
|
|
9
|
-
export { default as ImportFile } from "./ImportFile/index.vue";
|
|
10
|
-
export { default as PreviewImg } from "./PreviewImg/index.vue";
|
|
11
|
-
export { default as ChooseBuildings } from "./ChooseBuildings/index.vue";
|
|
12
|
-
export { default as SelectProperty } from "./SelectProperty/index.vue";
|
|
13
|
-
export { default as ChooseHousingResources } from "./ChooseHousingResources/index.vue";
|
|
14
|
-
export { default as CheckedHousingResources } from "./CheckedHousingResources/index.vue";
|
|
15
|
-
export { default as BlIcon } from "./BLIcon/index.js";
|
|
1
|
+
/**
|
|
2
|
+
* 组件导出
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
export { default as ChooseOrgMember } from "./ChooseOrgMember/index.vue";
|
|
6
|
+
export { default as PaySetting } from "./PaySetting/index.vue";
|
|
7
|
+
export { default as QrcodeModal } from "./QrcodeModal/index.vue";
|
|
8
|
+
export { default as TextTip } from "./TextTip/index.vue";
|
|
9
|
+
export { default as ImportFile } from "./ImportFile/index.vue";
|
|
10
|
+
export { default as PreviewImg } from "./PreviewImg/index.vue";
|
|
11
|
+
export { default as ChooseBuildings } from "./ChooseBuildings/index.vue";
|
|
12
|
+
export { default as SelectProperty } from "./SelectProperty/index.vue";
|
|
13
|
+
export { default as ChooseHousingResources } from "./ChooseHousingResources/index.vue";
|
|
14
|
+
export { default as CheckedHousingResources } from "./CheckedHousingResources/index.vue";
|
|
15
|
+
export { default as BlIcon } from "./BLIcon/index.js";
|