|
@@ -1,70 +1,99 @@
|
1
|
1
|
<template>
|
2
|
2
|
<x-loading x-id="room.resc.list">
|
3
|
|
- <div class="resc">
|
4
|
|
- <div class="mgtp" v-if="initData.limitFlag === 'rescLimit' && initData.rescStatus === '9'">
|
5
|
|
- <p>房源录入后4小时内仅允许房源录入人上传图片,目前尚无权限上传实勘图</p>
|
6
|
|
- </div>
|
7
|
|
- <div class="mgtp" v-if="initData.rescStatus === '1'">
|
8
|
|
- <p>当前实勘图正在审核中</p>
|
9
|
|
- </div>
|
10
|
|
- <div class="mgtp" v-if="initData.rescStatus === '0'">
|
11
|
|
- <x-field label="实勘人">{{initData.rescUser}}</x-field>
|
12
|
|
- <x-field label="达成时间">{{initData.rescTime}}</x-field>
|
13
|
|
- </div>
|
14
|
|
-
|
15
|
|
- <g-section title="门牌">
|
16
|
|
- <van-uploader
|
17
|
|
- v-model="houseNumberImg"
|
18
|
|
- max-count="1"
|
19
|
|
- :after-read="afterRead"
|
20
|
|
- />
|
21
|
|
- </g-section>
|
|
3
|
+ <div class="resc-mgtp" v-if="initData.limitFlag === 'rescLimit' && detail.roomInfo?.rescStatus === '9'">
|
|
4
|
+ <p>房源录入后4小时内仅允许房源录入人上传图片,目前尚无权限上传实勘图</p>
|
|
5
|
+ </div>
|
|
6
|
+ <div class="resc-mgtp" v-if="detail.roomInfo?.rescStatus === '1'">
|
|
7
|
+ <p>当前实勘图正在审核中</p>
|
|
8
|
+ </div>
|
|
9
|
+ <div class="resc-mgtp" v-if="detail.roomInfo?.rescStatus === '0'">
|
|
10
|
+ <x-field label="实勘人">{{initData.rescUser}}</x-field>
|
|
11
|
+ <x-field label="达成时间">{{initData.rescTime}}</x-field>
|
|
12
|
+ </div>
|
22
|
13
|
|
23
|
|
- <g-section title="户型">
|
24
|
|
- <van-uploader
|
25
|
|
- v-model="houseNumberImg"
|
26
|
|
- max-count="1"
|
27
|
|
- :after-read="afterRead"
|
28
|
|
- />
|
29
|
|
- </g-section>
|
|
14
|
+ <div class="resc">
|
|
15
|
+ <van-row>
|
|
16
|
+ <van-col span="12">
|
|
17
|
+ <g-section title="门牌">
|
|
18
|
+ <RescItems
|
|
19
|
+ :room-info="detail.roomInfo"
|
|
20
|
+ :resc-list="initData.rescList?.[0]"
|
|
21
|
+ resc-type="0"
|
|
22
|
+ @upload="handleUpload"
|
|
23
|
+ @delete="handleDelete"
|
|
24
|
+ />
|
|
25
|
+ </g-section>
|
|
26
|
+ </van-col>
|
|
27
|
+ <van-col span="12">
|
|
28
|
+ <g-section title="户型">
|
|
29
|
+ <RescItems
|
|
30
|
+ :room-info="detail.roomInfo"
|
|
31
|
+ :resc-list="initData.rescList?.[1]"
|
|
32
|
+ resc-type="1"
|
|
33
|
+ @upload="handleUpload"
|
|
34
|
+ @delete="handleDelete"
|
|
35
|
+ />
|
|
36
|
+ </g-section>
|
|
37
|
+ </van-col>
|
|
38
|
+ </van-row>
|
30
|
39
|
|
31
|
40
|
<g-section title="客厅">
|
32
|
|
- <van-uploader
|
33
|
|
- v-model="houseNumberImg"
|
34
|
|
- :after-read="afterRead"
|
|
41
|
+ <RescItems
|
|
42
|
+ :room-info="detail.roomInfo"
|
|
43
|
+ :resc-list="initData.rescList?.[2]"
|
|
44
|
+ resc-type="2"
|
|
45
|
+ @cover="handleCover"
|
|
46
|
+ @upload="handleUpload"
|
|
47
|
+ @delete="handleDelete"
|
35
|
48
|
/>
|
36
|
49
|
</g-section>
|
37
|
50
|
|
38
|
51
|
<g-section title="卧室">
|
39
|
|
- <van-uploader
|
40
|
|
- v-model="houseNumberImg"
|
41
|
|
- :after-read="afterRead"
|
|
52
|
+ <RescItems
|
|
53
|
+ :room-info="detail.roomInfo"
|
|
54
|
+ :resc-list="initData.rescList?.[3]"
|
|
55
|
+ resc-type="3"
|
|
56
|
+ @cover="handleCover"
|
|
57
|
+ @upload="handleUpload"
|
|
58
|
+ @delete="handleDelete"
|
42
|
59
|
/>
|
43
|
60
|
</g-section>
|
44
|
61
|
|
45
|
62
|
<g-section title="厨房">
|
46
|
|
- <van-uploader
|
47
|
|
- v-model="houseNumberImg"
|
48
|
|
- :after-read="afterRead"
|
|
63
|
+ <RescItems
|
|
64
|
+ :room-info="detail.roomInfo"
|
|
65
|
+ :resc-list="initData.rescList?.[4]"
|
|
66
|
+ resc-type="4"
|
|
67
|
+ @cover="handleCover"
|
|
68
|
+ @upload="handleUpload"
|
|
69
|
+ @delete="handleDelete"
|
49
|
70
|
/>
|
50
|
71
|
</g-section>
|
51
|
72
|
|
52
|
73
|
<g-section title="卫生间">
|
53
|
|
- <van-uploader
|
54
|
|
- v-model="houseNumberImg"
|
55
|
|
- :after-read="afterRead"
|
|
74
|
+ <RescItems
|
|
75
|
+ :room-info="detail.roomInfo"
|
|
76
|
+ :resc-list="initData.rescList?.[5]"
|
|
77
|
+ resc-type="5"
|
|
78
|
+ @cover="handleCover"
|
|
79
|
+ @upload="handleUpload"
|
|
80
|
+ @delete="handleDelete"
|
56
|
81
|
/>
|
57
|
82
|
</g-section>
|
58
|
83
|
|
59
|
84
|
<g-section title="其他">
|
60
|
|
- <van-uploader
|
61
|
|
- v-model="houseNumberImg"
|
62
|
|
- :after-read="afterRead"
|
|
85
|
+ <RescItems
|
|
86
|
+ :room-info="detail.roomInfo"
|
|
87
|
+ :resc-list="initData.rescList?.[6]"
|
|
88
|
+ resc-type="6"
|
|
89
|
+ @cover="handleCover"
|
|
90
|
+ @upload="handleUpload"
|
|
91
|
+ @delete="handleDelete"
|
63
|
92
|
/>
|
64
|
93
|
</g-section>
|
65
|
94
|
|
66
|
95
|
<div style="margin-top: 2em">
|
67
|
|
- <van-button block type="warning">
|
|
96
|
+ <van-button block type="warning" v-shiro="'room:info:addResc'">
|
68
|
97
|
保存审核并提交
|
69
|
98
|
</van-button>
|
70
|
99
|
</div>
|
|
@@ -73,50 +102,110 @@
|
73
|
102
|
</template>
|
74
|
103
|
|
75
|
104
|
<script>
|
76
|
|
-import { ref } from "vue";
|
|
105
|
+import { onMounted, ref } from "vue";
|
77
|
106
|
import { useRoute } from 'vue-router'
|
78
|
107
|
import { useModel } from '@zjxpcyc/vue-tiny-store'
|
79
|
108
|
//
|
80
|
109
|
import {
|
|
110
|
+ Row,
|
|
111
|
+ Col,
|
81
|
112
|
Uploader,
|
82
|
113
|
Button,
|
83
|
114
|
} from "vant"
|
84
|
|
-import { showDanger } from '@/utils';
|
|
115
|
+import RescItems from './components/Items'
|
|
116
|
+import { showDanger, showSuccess } from '@/utils'
|
|
117
|
+import uploadImage from '@/utils/uploadImage'
|
85
|
118
|
|
86
|
119
|
export default {
|
87
|
120
|
components: {
|
|
121
|
+ [Row.name]: Row,
|
|
122
|
+ [Col.name]: Col,
|
88
|
123
|
[Uploader.name]: Uploader,
|
89
|
124
|
[Button.name]: Button,
|
|
125
|
+ RescItems,
|
90
|
126
|
},
|
91
|
127
|
|
92
|
128
|
setup() {
|
93
|
129
|
const initData = ref({})
|
94
|
130
|
const route = useRoute()
|
95
|
|
-
|
96
|
|
- const { getRescList } = useModel('room')
|
97
|
|
-
|
98
|
|
- getRescList(route.query.roomId).then(res => {
|
99
|
|
- initData.value = res
|
100
|
|
- }).catch(e => {
|
101
|
|
- showDanger(e.message)
|
|
131
|
+ const willSave = ref([])
|
|
132
|
+
|
|
133
|
+ const { detail, getRescList, getDetail, setRescCover } = useModel('room')
|
|
134
|
+
|
|
135
|
+ const roomId = route.query.roomId - 0
|
|
136
|
+
|
|
137
|
+ // 设置封面
|
|
138
|
+ const handleCover = resc => {
|
|
139
|
+ setRescCover(resc.id).then(() => {
|
|
140
|
+ (initData.value.rescList[resc.imgType] || []).forEach(it => {
|
|
141
|
+ if (it.id === resc.id) {
|
|
142
|
+ it.imgTags = '1'
|
|
143
|
+ } else {
|
|
144
|
+ it.imgTags = '0'
|
|
145
|
+ }
|
|
146
|
+ })
|
|
147
|
+
|
|
148
|
+ showSuccess('设置成功')
|
|
149
|
+ })
|
|
150
|
+ }
|
|
151
|
+
|
|
152
|
+ // 上传图片
|
|
153
|
+ const handleUpload = ({file, type}) => {
|
|
154
|
+ const sort = (initData.value.rescList[type] || []).length + willSave.value.filter(x => x.imgType === type).length
|
|
155
|
+
|
|
156
|
+ uploadImage(file, '1').then(url => {
|
|
157
|
+ const img = {
|
|
158
|
+ roomId,
|
|
159
|
+ url,
|
|
160
|
+ imgType: type,
|
|
161
|
+ sort
|
|
162
|
+ }
|
|
163
|
+
|
|
164
|
+ willSave.value.push(img)
|
|
165
|
+ initData.value = {
|
|
166
|
+ ...initData.value,
|
|
167
|
+ rescList: {
|
|
168
|
+ ...initData.value.rescList || {},
|
|
169
|
+ [type]: (initData.value.rescList[type] || []).concat(img)
|
|
170
|
+ }
|
|
171
|
+ }
|
|
172
|
+ })
|
|
173
|
+ }
|
|
174
|
+
|
|
175
|
+ // 删除图片
|
|
176
|
+ const handleDelete = ({resc, index, rescType}) => {
|
|
177
|
+ // 尚未保存
|
|
178
|
+ if (!resc.id) {
|
|
179
|
+ const list = initData.value.rescList[rescType] || []
|
|
180
|
+ list.splice(index, 1)
|
|
181
|
+
|
|
182
|
+ initData.value = {
|
|
183
|
+ ...initData.value,
|
|
184
|
+ rescList: {
|
|
185
|
+ ...initData.value.rescList || {},
|
|
186
|
+ [rescType]: list
|
|
187
|
+ }
|
|
188
|
+ }
|
|
189
|
+ } else {
|
|
190
|
+ //
|
|
191
|
+ }
|
|
192
|
+ }
|
|
193
|
+
|
|
194
|
+ onMounted(() => {
|
|
195
|
+ getDetail(roomId)
|
|
196
|
+ getRescList(roomId).then(res => {
|
|
197
|
+ initData.value = res
|
|
198
|
+ }).catch(e => {
|
|
199
|
+ showDanger(e.message)
|
|
200
|
+ })
|
102
|
201
|
})
|
103
|
202
|
|
104
|
|
- const fileList = ref([
|
105
|
|
- { url: "https://img.yzcdn.cn/vant/leaf.jpg" },
|
106
|
|
- // Uploader 根据文件后缀来判断是否为图片文件
|
107
|
|
- // 如果图片 URL 中不包含类型信息,可以添加 isImage 标记来声明
|
108
|
|
- { url: "https://cloud-image", isImage: true },
|
109
|
|
- ]);
|
110
|
|
-
|
111
|
|
- const afterRead = (file) => {
|
112
|
|
- // 此时可以自行将文件上传至服务器
|
113
|
|
- console.log(file);
|
114
|
|
- };
|
115
|
|
-
|
116
|
203
|
return {
|
117
|
204
|
initData,
|
118
|
|
- fileList,
|
119
|
|
- afterRead,
|
|
205
|
+ detail,
|
|
206
|
+ handleCover,
|
|
207
|
+ handleUpload,
|
|
208
|
+ handleDelete,
|
120
|
209
|
};
|
121
|
210
|
},
|
122
|
211
|
};
|
|
@@ -125,11 +214,11 @@ export default {
|
125
|
214
|
<!-- Add "scoped" attribute to limit CSS to this component only -->
|
126
|
215
|
<style lang="less" scoped>
|
127
|
216
|
.resc {
|
128
|
|
- background: #fff;
|
129
|
217
|
padding: 1em;
|
|
218
|
+}
|
130
|
219
|
|
131
|
|
- .mgtp {
|
132
|
|
- margin-top: 1em;
|
133
|
|
- }
|
|
220
|
+.resc-mgtp {
|
|
221
|
+ margin-top: 1em;
|
134
|
222
|
}
|
|
223
|
+
|
135
|
224
|
</style>
|