bl-common-vue3 0.2.52 → 0.2.54
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_20230314202309.json +54 -0
- package/.history/package_20230321175012.json +54 -0
- package/.history/src/components/CheckedHousingResources/index_20230222150349.vue +358 -0
- package/.history/src/components/CheckedHousingResources/index_20230317104616.vue +358 -0
- package/.history/src/components/CheckedHousingResources/index_20230317104754.vue +358 -0
- package/.history/src/components/CheckedHousingResources/index_20230317104756.vue +358 -0
- package/.history/src/components/CheckedHousingResources/index_20230317104801.vue +358 -0
- package/.history/src/components/CheckedHousingResources/index_20230317104808.vue +358 -0
- package/.history/src/components/ChooseHousingResources/index_20230317104439.vue +1252 -0
- package/.history/src/components/ChooseHousingResources/index_20230317104446.vue +1252 -0
- package/.history/src/components/VillageTree/index_20230321174938.vue +488 -0
- package/.history/src/components/VillageTree/index_20230321175214.vue +488 -0
- package/lib/vue3common.common.js +561 -212
- package/lib/vue3common.umd.js +561 -212
- package/lib/vue3common.umd.min.js +18 -18
- package/package.json +1 -1
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "bl-common-vue3",
|
|
3
|
+
"version": "0.2.53",
|
|
4
|
+
"main": "lib/vue3common.umd.min.js",
|
|
5
|
+
"description": "bailing vue3 common components lib",
|
|
6
|
+
"private": false,
|
|
7
|
+
"scripts": {
|
|
8
|
+
"lib": "vue-cli-service build --target lib --name vue3common --dest lib index.js",
|
|
9
|
+
"serve": "vue-cli-service serve",
|
|
10
|
+
"build": "vue-cli-service build",
|
|
11
|
+
"lint": "vue-cli-service lint",
|
|
12
|
+
"publish": "npm publish --access public"
|
|
13
|
+
},
|
|
14
|
+
"dependencies": {
|
|
15
|
+
"@ant-design/icons-vue": "^6.0.1",
|
|
16
|
+
"ant-design-vue": "^2.2.8",
|
|
17
|
+
"axios": "^0.21.4",
|
|
18
|
+
"core-js": "^3.6.5",
|
|
19
|
+
"less": "^4.1.1",
|
|
20
|
+
"less-loader": "^6.0.0",
|
|
21
|
+
"moment": "^2.29.1",
|
|
22
|
+
"qrcode.vue": "^3.3.3",
|
|
23
|
+
"style-resources-loader": "^1.5.0",
|
|
24
|
+
"vue": "^3.0.4"
|
|
25
|
+
},
|
|
26
|
+
"devDependencies": {
|
|
27
|
+
"@vue/cli-plugin-babel": "~4.5.13",
|
|
28
|
+
"@vue/cli-plugin-eslint": "~4.5.13",
|
|
29
|
+
"@vue/cli-service": "~4.5.13",
|
|
30
|
+
"@vue/compiler-sfc": "^3.0.0",
|
|
31
|
+
"babel-eslint": "^10.1.0",
|
|
32
|
+
"eslint": "^6.7.2",
|
|
33
|
+
"eslint-plugin-vue": "^7.0.0"
|
|
34
|
+
},
|
|
35
|
+
"eslintConfig": {
|
|
36
|
+
"root": true,
|
|
37
|
+
"env": {
|
|
38
|
+
"node": true
|
|
39
|
+
},
|
|
40
|
+
"extends": [
|
|
41
|
+
"plugin:vue/vue3-essential",
|
|
42
|
+
"eslint:recommended"
|
|
43
|
+
],
|
|
44
|
+
"parserOptions": {
|
|
45
|
+
"parser": "babel-eslint"
|
|
46
|
+
},
|
|
47
|
+
"rules": {}
|
|
48
|
+
},
|
|
49
|
+
"browserslist": [
|
|
50
|
+
"> 1%",
|
|
51
|
+
"last 2 versions",
|
|
52
|
+
"not dead"
|
|
53
|
+
]
|
|
54
|
+
}
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "bl-common-vue3",
|
|
3
|
+
"version": "0.2.54",
|
|
4
|
+
"main": "lib/vue3common.umd.min.js",
|
|
5
|
+
"description": "bailing vue3 common components lib",
|
|
6
|
+
"private": false,
|
|
7
|
+
"scripts": {
|
|
8
|
+
"lib": "vue-cli-service build --target lib --name vue3common --dest lib index.js",
|
|
9
|
+
"serve": "vue-cli-service serve",
|
|
10
|
+
"build": "vue-cli-service build",
|
|
11
|
+
"lint": "vue-cli-service lint",
|
|
12
|
+
"publish": "npm publish --access public"
|
|
13
|
+
},
|
|
14
|
+
"dependencies": {
|
|
15
|
+
"@ant-design/icons-vue": "^6.0.1",
|
|
16
|
+
"ant-design-vue": "^2.2.8",
|
|
17
|
+
"axios": "^0.21.4",
|
|
18
|
+
"core-js": "^3.6.5",
|
|
19
|
+
"less": "^4.1.1",
|
|
20
|
+
"less-loader": "^6.0.0",
|
|
21
|
+
"moment": "^2.29.1",
|
|
22
|
+
"qrcode.vue": "^3.3.3",
|
|
23
|
+
"style-resources-loader": "^1.5.0",
|
|
24
|
+
"vue": "^3.0.4"
|
|
25
|
+
},
|
|
26
|
+
"devDependencies": {
|
|
27
|
+
"@vue/cli-plugin-babel": "~4.5.13",
|
|
28
|
+
"@vue/cli-plugin-eslint": "~4.5.13",
|
|
29
|
+
"@vue/cli-service": "~4.5.13",
|
|
30
|
+
"@vue/compiler-sfc": "^3.0.0",
|
|
31
|
+
"babel-eslint": "^10.1.0",
|
|
32
|
+
"eslint": "^6.7.2",
|
|
33
|
+
"eslint-plugin-vue": "^7.0.0"
|
|
34
|
+
},
|
|
35
|
+
"eslintConfig": {
|
|
36
|
+
"root": true,
|
|
37
|
+
"env": {
|
|
38
|
+
"node": true
|
|
39
|
+
},
|
|
40
|
+
"extends": [
|
|
41
|
+
"plugin:vue/vue3-essential",
|
|
42
|
+
"eslint:recommended"
|
|
43
|
+
],
|
|
44
|
+
"parserOptions": {
|
|
45
|
+
"parser": "babel-eslint"
|
|
46
|
+
},
|
|
47
|
+
"rules": {}
|
|
48
|
+
},
|
|
49
|
+
"browserslist": [
|
|
50
|
+
"> 1%",
|
|
51
|
+
"last 2 versions",
|
|
52
|
+
"not dead"
|
|
53
|
+
]
|
|
54
|
+
}
|
|
@@ -0,0 +1,358 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div class="checked-house">
|
|
3
|
+
<a-row :gutter="12">
|
|
4
|
+
<a-col :span="inputShow ? 8 : 16"> 房源名称</a-col>
|
|
5
|
+
<a-col :span="8" v-if="inputShow"> 租赁面积(㎡)</a-col>
|
|
6
|
+
<a-col :span="8">
|
|
7
|
+
{{ maxTotal ? "总面积(㎡)" : "可租/总面积(㎡)" }}
|
|
8
|
+
</a-col>
|
|
9
|
+
</a-row>
|
|
10
|
+
<a-divider style="margin: 10px 0" />
|
|
11
|
+
<a-row v-if="checkable">
|
|
12
|
+
<template v-for="(item, index) of allHouseList" :key="item.id">
|
|
13
|
+
<a-col
|
|
14
|
+
:span="16"
|
|
15
|
+
style="cursor: pointer"
|
|
16
|
+
@click="handleHouseChecked(item, index)"
|
|
17
|
+
>
|
|
18
|
+
<div class="room-name">
|
|
19
|
+
<a-checkbox
|
|
20
|
+
:checked="item.checked"
|
|
21
|
+
style="margin-right: 10px"
|
|
22
|
+
size="large"
|
|
23
|
+
></a-checkbox>
|
|
24
|
+
<!-- 楼层 -->
|
|
25
|
+
<span v-if="item.layer_name || item.extra.layer_name">
|
|
26
|
+
{{ item.layer_name || item.extra.layer_name }}
|
|
27
|
+
</span>
|
|
28
|
+
<span v-if="item.room_name">/{{ item.room_name }}</span>
|
|
29
|
+
</div>
|
|
30
|
+
<div
|
|
31
|
+
class="building-name"
|
|
32
|
+
style="padding-left: 26px"
|
|
33
|
+
v-if="
|
|
34
|
+
item.build_name || (item.extra ? item.extra.build_name : false)
|
|
35
|
+
"
|
|
36
|
+
>
|
|
37
|
+
{{ item.build_name || item.extra.build_name }}
|
|
38
|
+
</div>
|
|
39
|
+
</a-col>
|
|
40
|
+
<a-col :span="8" style="padding-left: 10px">
|
|
41
|
+
<span v-if="maxTotal">{{ getTotalArea(item) }}</span>
|
|
42
|
+
<span v-else> {{ getMaxArea(item) }} / {{ getTotalArea(item) }}</span>
|
|
43
|
+
</a-col>
|
|
44
|
+
</template>
|
|
45
|
+
</a-row>
|
|
46
|
+
<a-row :gutter="[12, 12]" align="middle" v-else>
|
|
47
|
+
<template v-if="houseShowList && houseShowList.length">
|
|
48
|
+
<template v-for="item of houseShowList" :key="item.id">
|
|
49
|
+
<a-col :span="inputShow ? 8 : 16">
|
|
50
|
+
<div class="room-name">
|
|
51
|
+
<!-- 楼层 -->
|
|
52
|
+
<span v-if="item.layer_name || item.extra.layer_name">
|
|
53
|
+
{{ item.layer_name || item.extra.layer_name }}
|
|
54
|
+
</span>
|
|
55
|
+
<span v-if="item.room_name">/{{ item.room_name }}</span>
|
|
56
|
+
</div>
|
|
57
|
+
<div
|
|
58
|
+
class="building-name"
|
|
59
|
+
v-if="
|
|
60
|
+
item.build_name || (item.extra ? item.extra.build_name : false)
|
|
61
|
+
"
|
|
62
|
+
>
|
|
63
|
+
{{ item.build_name || item.extra.build_name }}
|
|
64
|
+
</div>
|
|
65
|
+
</a-col>
|
|
66
|
+
<a-col :span="8" v-if="inputShow">
|
|
67
|
+
<a-input-number
|
|
68
|
+
v-model:value="item.inputArea[clauseType]"
|
|
69
|
+
placeholder="请输入面积"
|
|
70
|
+
:min="clauseType == 'property' ? 0 : 1"
|
|
71
|
+
:max="Number(item.maxArea[clauseType])"
|
|
72
|
+
@change="(val) => handleAreaInputChange(item, val)"
|
|
73
|
+
/>
|
|
74
|
+
</a-col>
|
|
75
|
+
<a-col :span="8">
|
|
76
|
+
<span v-if="!maxTotal"> {{ item.maxArea[clauseType] }} / </span>
|
|
77
|
+
<span> {{ item.totalArea[clauseType] }} </span>
|
|
78
|
+
</a-col>
|
|
79
|
+
</template>
|
|
80
|
+
</template>
|
|
81
|
+
<div v-else style="text-align: center; margin-top: 20px; width: 100%">
|
|
82
|
+
<a-empty :description="emptyDesc" />
|
|
83
|
+
</div>
|
|
84
|
+
</a-row>
|
|
85
|
+
</div>
|
|
86
|
+
</template>
|
|
87
|
+
|
|
88
|
+
<script>
|
|
89
|
+
import {
|
|
90
|
+
computed,
|
|
91
|
+
defineComponent,
|
|
92
|
+
nextTick,
|
|
93
|
+
reactive,
|
|
94
|
+
toRaw,
|
|
95
|
+
toRefs,
|
|
96
|
+
watch,
|
|
97
|
+
} from "vue";
|
|
98
|
+
import { Empty, Row, Col, InputNumber, Divider } from "ant-design-vue";
|
|
99
|
+
|
|
100
|
+
export default defineComponent({
|
|
101
|
+
name: "CheckedHousingResources",
|
|
102
|
+
components: {
|
|
103
|
+
"a-empty": Empty,
|
|
104
|
+
"a-row": Row,
|
|
105
|
+
"a-col": Col,
|
|
106
|
+
"a-input-number": InputNumber,
|
|
107
|
+
"a-divider": Divider,
|
|
108
|
+
},
|
|
109
|
+
props: {
|
|
110
|
+
// 是否是可勾选模式
|
|
111
|
+
checkable: {
|
|
112
|
+
type: Boolean,
|
|
113
|
+
default: false,
|
|
114
|
+
},
|
|
115
|
+
// 面积是否可填写 (checkable为true时areaInput固定为false)
|
|
116
|
+
areaInput: {
|
|
117
|
+
type: Boolean,
|
|
118
|
+
default: false,
|
|
119
|
+
},
|
|
120
|
+
// 选择的房源
|
|
121
|
+
houseList: {
|
|
122
|
+
type: Array,
|
|
123
|
+
default: () => [],
|
|
124
|
+
},
|
|
125
|
+
// 全部房源列表 checkable为true时展示的列表
|
|
126
|
+
allHouseList: {
|
|
127
|
+
type: Array,
|
|
128
|
+
default: () => [],
|
|
129
|
+
},
|
|
130
|
+
// 勾选选中与否是否由外部控制
|
|
131
|
+
checkControl: {
|
|
132
|
+
type: Boolean,
|
|
133
|
+
default: false,
|
|
134
|
+
},
|
|
135
|
+
// 空状态描述文字
|
|
136
|
+
emptyDesc: {
|
|
137
|
+
type: String,
|
|
138
|
+
default: "未选择房源",
|
|
139
|
+
},
|
|
140
|
+
// 条款类型 lease租赁条款 property物业条款
|
|
141
|
+
clauseType: {
|
|
142
|
+
type: String,
|
|
143
|
+
default: "lease",
|
|
144
|
+
},
|
|
145
|
+
// 可租面积是否包含自己的面积
|
|
146
|
+
includeSelfArea: {
|
|
147
|
+
type: Boolean,
|
|
148
|
+
default: false,
|
|
149
|
+
},
|
|
150
|
+
// 最大面积是否是总面积(不受可租面积影响)
|
|
151
|
+
maxTotal: {
|
|
152
|
+
type: Boolean,
|
|
153
|
+
default: false,
|
|
154
|
+
},
|
|
155
|
+
},
|
|
156
|
+
setup(props, { emit }) {
|
|
157
|
+
const state = reactive({
|
|
158
|
+
houseShowList: [],
|
|
159
|
+
});
|
|
160
|
+
|
|
161
|
+
const inputShow = computed(() => !props.checkable && props.areaInput);
|
|
162
|
+
|
|
163
|
+
const setHouseArea = (current, needInputArea = true) => {
|
|
164
|
+
current.charging_area =
|
|
165
|
+
current.charging_area || current.property_area || 0;
|
|
166
|
+
current.rental_area = current.rental_area || current.lease_area || 0;
|
|
167
|
+
let item = { ...current };
|
|
168
|
+
if (
|
|
169
|
+
item.totalArea &&
|
|
170
|
+
item.totalArea[props.clauseType] &&
|
|
171
|
+
item.maxArea &&
|
|
172
|
+
item.maxArea[props.clauseType] != undefined &&
|
|
173
|
+
(!needInputArea ||
|
|
174
|
+
(item.inputArea && item.inputArea[props.clauseType] != undefined))
|
|
175
|
+
) {
|
|
176
|
+
return item;
|
|
177
|
+
}
|
|
178
|
+
item.totalArea = {
|
|
179
|
+
property:
|
|
180
|
+
props.clauseType == "property" && Number(item.charging_area)
|
|
181
|
+
? Number(item.charging_area)
|
|
182
|
+
: Number(item.rental_area),
|
|
183
|
+
lease: Number(item.rental_area),
|
|
184
|
+
};
|
|
185
|
+
item.maxArea = { ...item.totalArea };
|
|
186
|
+
if (!props.maxTotal) {
|
|
187
|
+
if (item.rent_area) {
|
|
188
|
+
item.maxArea = {
|
|
189
|
+
property:
|
|
190
|
+
props.clauseType == "property" &&
|
|
191
|
+
Number(item.rent_area.property_square)
|
|
192
|
+
? Number(
|
|
193
|
+
Number(item.totalArea.property) -
|
|
194
|
+
Number(item.rent_area.property_square)
|
|
195
|
+
)
|
|
196
|
+
: item.totalArea.property,
|
|
197
|
+
lease: item.rent_area.lease_square
|
|
198
|
+
? Number(
|
|
199
|
+
Number(item.totalArea.lease) -
|
|
200
|
+
Number(item.rent_area.lease_square)
|
|
201
|
+
)
|
|
202
|
+
: item.totalArea.lease,
|
|
203
|
+
};
|
|
204
|
+
}
|
|
205
|
+
if (item.rentedArea && props.includeSelfArea) {
|
|
206
|
+
item.maxArea = {
|
|
207
|
+
property: item.maxArea.property + Number(item.rentedArea.property),
|
|
208
|
+
lease: item.maxArea.lease + Number(item.rentedArea.lease),
|
|
209
|
+
};
|
|
210
|
+
}
|
|
211
|
+
}
|
|
212
|
+
if (
|
|
213
|
+
needInputArea &&
|
|
214
|
+
(!item.inputArea || item.inputArea[props.clauseType] == undefined)
|
|
215
|
+
) {
|
|
216
|
+
item.inputArea = { ...item.maxArea };
|
|
217
|
+
if (!props.maxTotal && item.rentedArea) {
|
|
218
|
+
item.inputArea = {
|
|
219
|
+
...item.rentedArea,
|
|
220
|
+
};
|
|
221
|
+
}
|
|
222
|
+
}
|
|
223
|
+
return item;
|
|
224
|
+
};
|
|
225
|
+
|
|
226
|
+
const getTotalArea = (item) => {
|
|
227
|
+
item.charging_area = item.charging_area || item.property_area || 0;
|
|
228
|
+
item.rental_area = item.rental_area || item.lease_area || 0;
|
|
229
|
+
if (props.clauseType == "property" && Number(item.charging_area)) {
|
|
230
|
+
return Number(item.charging_area);
|
|
231
|
+
} else {
|
|
232
|
+
return Number(item.rental_area);
|
|
233
|
+
}
|
|
234
|
+
};
|
|
235
|
+
|
|
236
|
+
const getMaxArea = (item) => {
|
|
237
|
+
const totalArea = getTotalArea(item);
|
|
238
|
+
if (props.maxTotal) {
|
|
239
|
+
return totalArea;
|
|
240
|
+
}
|
|
241
|
+
let maxArea = totalArea;
|
|
242
|
+
if (item.rent_area) {
|
|
243
|
+
if (props.clauseType == "property" && Number(item.charging_area)) {
|
|
244
|
+
maxArea = Number(
|
|
245
|
+
Number(totalArea) - (Number(item.rent_area.property_square) || 0)
|
|
246
|
+
);
|
|
247
|
+
} else {
|
|
248
|
+
maxArea = Number(
|
|
249
|
+
Number(totalArea) - (Number(item.rent_area.lease_square) || 0)
|
|
250
|
+
);
|
|
251
|
+
}
|
|
252
|
+
}
|
|
253
|
+
if (
|
|
254
|
+
props.includeSelfArea &&
|
|
255
|
+
item.rentedArea &&
|
|
256
|
+
item.rentedArea[props.clauseType]
|
|
257
|
+
) {
|
|
258
|
+
maxArea = maxArea + Number(item.rentedArea[props.clauseType]);
|
|
259
|
+
}
|
|
260
|
+
return maxArea;
|
|
261
|
+
};
|
|
262
|
+
|
|
263
|
+
const emitInputChange = () => {
|
|
264
|
+
let leaseArea = 0;
|
|
265
|
+
state.houseShowList.forEach((item) => {
|
|
266
|
+
leaseArea =
|
|
267
|
+
Number(leaseArea) + Number(item.inputArea[props.clauseType]);
|
|
268
|
+
});
|
|
269
|
+
emit("getResult", {
|
|
270
|
+
type: "area",
|
|
271
|
+
houseList: state.houseShowList,
|
|
272
|
+
leaseArea,
|
|
273
|
+
});
|
|
274
|
+
};
|
|
275
|
+
|
|
276
|
+
let inputTimeout = null;
|
|
277
|
+
const handleAreaInputChange = () => {
|
|
278
|
+
if (inputTimeout) {
|
|
279
|
+
clearTimeout(inputTimeout);
|
|
280
|
+
inputTimeout = null;
|
|
281
|
+
}
|
|
282
|
+
inputTimeout = setTimeout(() => {
|
|
283
|
+
emitInputChange();
|
|
284
|
+
}, 1000);
|
|
285
|
+
};
|
|
286
|
+
|
|
287
|
+
const handleHouseChecked = (current, index) => {
|
|
288
|
+
if (!props.checkControl) {
|
|
289
|
+
current.checked = !current.checked;
|
|
290
|
+
}
|
|
291
|
+
emit("getResult", {
|
|
292
|
+
type: "check",
|
|
293
|
+
current,
|
|
294
|
+
index,
|
|
295
|
+
houseList: state.houseShowList,
|
|
296
|
+
});
|
|
297
|
+
};
|
|
298
|
+
|
|
299
|
+
const setHouseShowList = () => {
|
|
300
|
+
state.houseShowList = props.houseList.map((item) => {
|
|
301
|
+
return setHouseArea(item);
|
|
302
|
+
});
|
|
303
|
+
nextTick(() => {
|
|
304
|
+
console.log(
|
|
305
|
+
"setHouseShowList-----------------------------------",
|
|
306
|
+
toRaw(state.houseShowList)
|
|
307
|
+
);
|
|
308
|
+
emitInputChange();
|
|
309
|
+
});
|
|
310
|
+
};
|
|
311
|
+
|
|
312
|
+
watch(
|
|
313
|
+
() => props.houseList,
|
|
314
|
+
() => {
|
|
315
|
+
setHouseShowList();
|
|
316
|
+
},
|
|
317
|
+
{
|
|
318
|
+
deep: true,
|
|
319
|
+
}
|
|
320
|
+
);
|
|
321
|
+
|
|
322
|
+
const init = () => {
|
|
323
|
+
setHouseShowList();
|
|
324
|
+
};
|
|
325
|
+
init();
|
|
326
|
+
|
|
327
|
+
return {
|
|
328
|
+
inputShow,
|
|
329
|
+
...toRefs(state),
|
|
330
|
+
handleAreaInputChange,
|
|
331
|
+
handleHouseChecked,
|
|
332
|
+
getTotalArea,
|
|
333
|
+
getMaxArea,
|
|
334
|
+
};
|
|
335
|
+
},
|
|
336
|
+
});
|
|
337
|
+
</script>
|
|
338
|
+
|
|
339
|
+
<style lang="less" scoped>
|
|
340
|
+
.checked-house {
|
|
341
|
+
width: 100%;
|
|
342
|
+
height: 100%;
|
|
343
|
+
overflow: hidden auto;
|
|
344
|
+
.room-name {
|
|
345
|
+
font-size: 15px;
|
|
346
|
+
color: rgba(0, 0, 0, 1);
|
|
347
|
+
font-weight: 500;
|
|
348
|
+
}
|
|
349
|
+
.building-name {
|
|
350
|
+
color: rgba(0, 0, 0, 0.65);
|
|
351
|
+
font-size: 12px;
|
|
352
|
+
}
|
|
353
|
+
.room-area {
|
|
354
|
+
font-size: 15px;
|
|
355
|
+
color: rgba(0, 0, 0, 1);
|
|
356
|
+
}
|
|
357
|
+
}
|
|
358
|
+
</style>
|