Commit 21397afdeba193a8357d2d0cb065a8f7faf40769
1 parent
6cba22de
树 新增
Showing
8 changed files
with
318 additions
and
103 deletions
App.vue
@@ -17,7 +17,7 @@ export default { | @@ -17,7 +17,7 @@ export default { | ||
17 | <style lang="scss"> | 17 | <style lang="scss"> |
18 | page { | 18 | page { |
19 | background-color: #F4F4F4; | 19 | background-color: #F4F4F4; |
20 | - color: #333; | 20 | + color: #666; |
21 | } | 21 | } |
22 | @import './components/thorui/fui-css/firstui.scss'; | 22 | @import './components/thorui/fui-css/firstui.scss'; |
23 | </style> | 23 | </style> |
api/tree.js
0 → 100644
1 | + | ||
2 | + | ||
3 | +import request from '@/utils/request' | ||
4 | + | ||
5 | +// 权属分类 | ||
6 | +export const treeOwnership = (params) => request.get('/system/dict/data/type/tree_ownership', params) | ||
7 | + | ||
8 | +// 新增树 | ||
9 | +export const addTree = (params) => request.post('/business/tree', params) | ||
10 | + | ||
11 | +// 树基本详情 | ||
12 | +export const treeDetailReq = (params) => request.get('/business/tree/'+params ) | ||
13 | + | ||
14 | + | ||
15 | +// 归属公司 | ||
16 | +export const belongCompanyreq = (params) => request.get('/system/dict/data/type/belongCompanyId', params) | ||
17 | + | ||
18 | + | ||
19 | +// 班组集合 | ||
20 | +export const deptListReq = (params) => request.get('/business/tree/dept/list', params) | ||
21 | + | ||
22 | +// 道路树木列表 | ||
23 | +export const treeRoadReq = (params) => request.get('/business/tree/road/list', params) | ||
24 | + | ||
25 | +// 分类 | ||
26 | +export const treeLevelReq = (params) => request.get('/system/dict/data/type/tree_level', params) | ||
27 | + | ||
28 | + | ||
29 | + | ||
30 | +// 获取道路数据列表(根据街道id) | ||
31 | +export const apiRoadListByStreetId = (params) => request.get('/road/manager/queryRoadListByStreetId', params) |
config/app.js
@@ -17,7 +17,9 @@ const baseURLMap = { | @@ -17,7 +17,9 @@ const baseURLMap = { | ||
17 | // 开发环境 | 17 | // 开发环境 |
18 | development: 'https://test.jichengshanshui.com.cn:28303', | 18 | development: 'https://test.jichengshanshui.com.cn:28303', |
19 | // 生产环境 | 19 | // 生产环境 |
20 | - production: IS_H5 ? location.origin : 'http://125.35.93.94:8986' | 20 | + // production: IS_H5 ? location.origin : 'http://125.35.93.94:8986' |
21 | + // 生产环境 | ||
22 | + production: IS_H5 ? location.origin : 'https://test.jichengshanshui.com.cn:28303' | ||
21 | } | 23 | } |
22 | 24 | ||
23 | /** E API BaseURL **/ | 25 | /** E API BaseURL **/ |
manifest.json
@@ -112,7 +112,7 @@ | @@ -112,7 +112,7 @@ | ||
112 | "quickapp" : {}, | 112 | "quickapp" : {}, |
113 | /* 小程序特有相关 */ | 113 | /* 小程序特有相关 */ |
114 | "mp-weixin" : { | 114 | "mp-weixin" : { |
115 | - "appid" : "wx64368a9b9e799172", | 115 | + "appid" : "wxcb4cd34066b97d82", |
116 | "setting" : { | 116 | "setting" : { |
117 | "urlCheck" : false | 117 | "urlCheck" : false |
118 | }, | 118 | }, |
subPackages/treePage/addTree.vue
@@ -42,9 +42,35 @@ | @@ -42,9 +42,35 @@ | ||
42 | </template> | 42 | </template> |
43 | </tui-form-item> | 43 | </tui-form-item> |
44 | 44 | ||
45 | - <tui-form-item asterisk label="管护单位" arrow highlight prop="managedutyunit" @click="pickerShow"> | ||
46 | - <tui-input padding="0" :borderBottom="false" placeholder="请选择" disabled | ||
47 | - backgroundColor="transparent" v-model="formData.managedutyunit"></tui-input> | 45 | + <tui-col :span="12"> |
46 | + <tui-form-item | ||
47 | + | ||
48 | + label="纬度" | ||
49 | + class="location-form-item" | ||
50 | + | ||
51 | + prop="latitude" | ||
52 | + > | ||
53 | + {{ formData.latitude }} | ||
54 | + </tui-form-item> | ||
55 | + </tui-col> | ||
56 | + <tui-col :span="12"> | ||
57 | + <tui-form-item | ||
58 | + label="经度" | ||
59 | + class="location-form-item" | ||
60 | + prop="latitude" | ||
61 | + > | ||
62 | + {{ formData.longitude }} | ||
63 | + </tui-form-item> | ||
64 | + </tui-col> | ||
65 | + | ||
66 | + | ||
67 | + <tui-form-item asterisk label="管护单位" prop="managedutyunit"> | ||
68 | + | ||
69 | + <tui-input padding="0" :borderBottom="false" placeholder="请输入" maxlength="30" | ||
70 | + v-model="formData.managedutyunit"></tui-input> | ||
71 | + | ||
72 | + <!-- <tui-input padding="0" :borderBottom="false" placeholder="请选择" disabled--> | ||
73 | + <!-- backgroundColor="transparent" v-model="formData.managedutyunit"></tui-input>--> | ||
48 | </tui-form-item> | 74 | </tui-form-item> |
49 | <tui-form-item asterisk label="权属分类" arrow highlight prop="oldtreeownership" @click="pickerShow"> | 75 | <tui-form-item asterisk label="权属分类" arrow highlight prop="oldtreeownership" @click="pickerShow"> |
50 | <tui-input padding="0" :borderBottom="false" placeholder="请选择" disabled | 76 | <tui-input padding="0" :borderBottom="false" placeholder="请选择" disabled |
@@ -53,23 +79,21 @@ | @@ -53,23 +79,21 @@ | ||
53 | 79 | ||
54 | <tui-form-item label="图片信息" asterisk prop="treeImgList"> | 80 | <tui-form-item label="图片信息" asterisk prop="treeImgList"> |
55 | <!-- 使用ThorUI的tui-upload组件 --> | 81 | <!-- 使用ThorUI的tui-upload组件 --> |
56 | -<!-- @remove="handleRemove" :multiple="true" :value="formData.treeImgList"--> | 82 | + <!-- @remove="handleRemove" :multiple="true" :value="formData.treeImgList"--> |
57 | <tui-upload | 83 | <tui-upload |
58 | :height="140" | 84 | :height="140" |
59 | :width="140" | 85 | :width="140" |
60 | - :value="formData.treeImgList" | 86 | + :value="formData.treeImgListFile" |
61 | :serverUrl="serverURL" :header="{'Authorization': userToken}" | 87 | :serverUrl="serverURL" :header="{'Authorization': userToken}" |
62 | @complete="handleComplete" | 88 | @complete="handleComplete" |
63 | - | ||
64 | :limit="3" | 89 | :limit="3" |
65 | - | ||
66 | accept="image/*" | 90 | accept="image/*" |
67 | - > | ||
68 | - <!-- 自定义上传按钮 --> | ||
69 | - <view class="upload-btn"> | ||
70 | - <tui-icon name="plus" size="32" color="#999"></tui-icon> | 91 | + > |
92 | + <!-- 自定义上传按钮 --> | ||
93 | + <view class="upload-btn"> | ||
94 | + <tui-icon name="plus" size="32" color="#999"></tui-icon> | ||
71 | 95 | ||
72 | - </view> | 96 | + </view> |
73 | <!-- 提示信息 --> | 97 | <!-- 提示信息 --> |
74 | <!-- <view class="upload-tips">--> | 98 | <!-- <view class="upload-tips">--> |
75 | <!-- 最多上传3张图片,单张不超过5MB--> | 99 | <!-- 最多上传3张图片,单张不超过5MB--> |
@@ -101,7 +125,7 @@ | @@ -101,7 +125,7 @@ | ||
101 | </tui-form-item> | 125 | </tui-form-item> |
102 | </tui-col> | 126 | </tui-col> |
103 | <tui-col :span="12"> | 127 | <tui-col :span="12"> |
104 | - <tui-form-item label="级别" arrow highlight prop="treelevel" @click="pickerShow"> | 128 | + <tui-form-item label="级别" arrow highlight prop="treelevel" @click="pickerLevelShow"> |
105 | <tui-input padding="0" :borderBottom="false" placeholder="请选择" disabled | 129 | <tui-input padding="0" :borderBottom="false" placeholder="请选择" disabled |
106 | backgroundColor="transparent" v-model="formData.treelevel"></tui-input> | 130 | backgroundColor="transparent" v-model="formData.treelevel"></tui-input> |
107 | </tui-form-item> | 131 | </tui-form-item> |
@@ -176,46 +200,71 @@ | @@ -176,46 +200,71 @@ | ||
176 | <tui-button bold @click="submit">提交</tui-button> | 200 | <tui-button bold @click="submit">提交</tui-button> |
177 | </view> | 201 | </view> |
178 | </tui-form> | 202 | </tui-form> |
179 | - <tui-picker :show="show" :pickerData="areaData" @hide="pickerHide" @change="pickerChange"> | 203 | + <tui-picker :show="show" :pickerData="treeOwnershipData" textField="dictLabel" valueField="dictValue" |
204 | + @hide="pickerHide" @change="pickerChange"> | ||
205 | + </tui-picker> | ||
206 | + | ||
207 | + <tui-picker :show="levelshow" :pickerData="treeLevelData" textField="dictLabel" valueField="dictValue" | ||
208 | + @hide="pickerLevelHide" @change="pickerLevelChange"> | ||
180 | </tui-picker> | 209 | </tui-picker> |
181 | </view> | 210 | </view> |
182 | </template> | 211 | </template> |
183 | 212 | ||
184 | <script> | 213 | <script> |
185 | -import { uploadURL } from '@/config/app' | 214 | +import { uploadURL,OSSURL} from '@/config/app' |
215 | +import { treeOwnership, addTree, treeLevelReq } from "@/api/tree"; | ||
186 | const rules = [{ | 216 | const rules = [{ |
187 | name: "treetype", | 217 | name: "treetype", |
188 | rule: ["required"], | 218 | rule: ["required"], |
189 | msg: ["请输入名称"] | 219 | msg: ["请输入名称"] |
190 | }, { | 220 | }, { |
191 | name: "treeheight", | 221 | name: "treeheight", |
192 | - rule: ["required", "maxLength:10"], | ||
193 | - msg: ["请输入数高", "数高不能超过10个字符"] | 222 | + rule: ["required", "maxLength:10", "isAmount"], |
223 | + msg: ["请输入数高", "数高不能超过10个字符", "请输入正确"] | ||
194 | }, { | 224 | }, { |
195 | name: "dbh", | 225 | name: "dbh", |
196 | - rule: ["required", "maxLength:10"], | ||
197 | - msg: ["请输入胸径", "胸径不能超过10个字符"] | ||
198 | -}, { | ||
199 | - name: "growlocation", | ||
200 | - rule: ["required"], | ||
201 | - msg: ["请地图选择位置"] | 226 | + rule: ["required", "maxLength:10", "isAmount"], |
227 | + msg: ["请输入胸径", "胸径不能超过10个字符", "请输入正确"] | ||
202 | }, { | 228 | }, { |
203 | - name: "managedutyunit", | ||
204 | - rule: ["required"], | ||
205 | - msg: ["请选择权属单位"] | ||
206 | -}, { | ||
207 | - name: "oldtreeownership", | ||
208 | - rule: ["required"], | ||
209 | - msg: ["请选择权属分类"] | ||
210 | -},{ | ||
211 | - name: "treeImgList", | ||
212 | - rule: ["required", "custom"], // 增加required强制必选 | ||
213 | - msg: ["请上传图片", "请至少上传一张图片"], // 对应两个规则的提示 | ||
214 | - custom: function(value) { | ||
215 | - // 即使required通过,再校验数组长度 | ||
216 | - return value.length > 0; | ||
217 | - } | ||
218 | -}]; | 229 | + name: "estimationtreeage", |
230 | + rule: ["maxLength:10", "isAmount"], | ||
231 | + msg: ["胸径不能超过10个字符", "请输入正确"] | ||
232 | +}, | ||
233 | + { | ||
234 | + name: "weekday", | ||
235 | + rule: ["maxLength:10", "isAmount"], | ||
236 | + msg: ["胸径不能超过10个字符", "请输入正确"] | ||
237 | + }, | ||
238 | + { | ||
239 | + name: "canopyeastwest", | ||
240 | + rule: ["maxLength:10", "isAmount"], | ||
241 | + msg: ["胸径不能超过10个字符", "请输入正确"] | ||
242 | + }, | ||
243 | + { | ||
244 | + name: "canopysouthnorth", | ||
245 | + rule: ["maxLength:10", "isAmount"], | ||
246 | + msg: ["胸径不能超过10个字符", "请输入正确"] | ||
247 | + }, { | ||
248 | + name: "growlocation", | ||
249 | + rule: ["required"], | ||
250 | + msg: ["请地图选择位置"] | ||
251 | + }, { | ||
252 | + name: "managedutyunit", | ||
253 | + rule: ["required"], | ||
254 | + msg: ["请选择权属单位"] | ||
255 | + }, { | ||
256 | + name: "oldtreeownership", | ||
257 | + rule: ["required"], | ||
258 | + msg: ["请选择权属分类"] | ||
259 | + }, { | ||
260 | + name: "treeImgListFile", | ||
261 | + rule: ["required", "custom"], // 增加required强制必选 | ||
262 | + msg: ["请上传图片", "请至少上传一张图片"], // 对应两个规则的提示 | ||
263 | + custom: function (value) { | ||
264 | + // 即使required通过,再校验数组长度 | ||
265 | + return value.length > 0; | ||
266 | + } | ||
267 | + }]; | ||
219 | export default { | 268 | export default { |
220 | props: { | 269 | props: { |
221 | // 外部传入的已上传图片列表 | 270 | // 外部传入的已上传图片列表 |
@@ -229,17 +278,10 @@ export default { | @@ -229,17 +278,10 @@ export default { | ||
229 | isShow: false, // 控制区域显示/隐藏 | 278 | isShow: false, // 控制区域显示/隐藏 |
230 | contentHeight: 200, // 内容区域高度 | 279 | contentHeight: 200, // 内容区域高度 |
231 | serverURL: uploadURL, | 280 | serverURL: uploadURL, |
232 | - areaData: [{ | ||
233 | - text: "中国", | ||
234 | - value: "1001" | ||
235 | - }, { | ||
236 | - text: "美国", | ||
237 | - value: "1002" | ||
238 | - }, { | ||
239 | - text: "俄罗斯", | ||
240 | - value: "1003" | ||
241 | - }], | 281 | + treeOwnershipData: [], |
282 | + treeLevelData: [], // 级别 | ||
242 | show: false, | 283 | show: false, |
284 | + levelshow: false, | ||
243 | //仅对部分数据进行收集演示 | 285 | //仅对部分数据进行收集演示 |
244 | formData: { | 286 | formData: { |
245 | //数名 | 287 | //数名 |
@@ -256,15 +298,17 @@ export default { | @@ -256,15 +298,17 @@ export default { | ||
256 | oldtreeownership: '', | 298 | oldtreeownership: '', |
257 | latinname: '', // 拉丁名 | 299 | latinname: '', // 拉丁名 |
258 | estimationtreeage: '', // 估测树龄 | 300 | estimationtreeage: '', // 估测树龄 |
259 | - canopysouthnorth:'', // 冠幅南北 | 301 | + canopysouthnorth: '', // 冠幅南北 |
260 | canopyeastwest: '', // 冠幅东西 | 302 | canopyeastwest: '', // 冠幅东西 |
261 | weekday: '', // 干周 | 303 | weekday: '', // 干周 |
262 | - growlocation:'', // 位置 | 304 | + growlocation: '', // 位置 |
263 | growthenvironment: '', // 生长环境 | 305 | growthenvironment: '', // 生长环境 |
264 | - treeImgList:[], // 图片信息 | 306 | + treeImgList: [], // 图片信息 |
307 | + treeImgListFile: [], // 图片信息 | ||
265 | address: '', // 位置名称 | 308 | address: '', // 位置名称 |
266 | latitude: '', // 纬度 | 309 | latitude: '', // 纬度 |
267 | - longitude: '' // 经度 | 310 | + longitude: '', // 经度 |
311 | + road: '' | ||
268 | }, | 312 | }, |
269 | // currentFiles: [...this.value], // 当前已上传文件列表 | 313 | // currentFiles: [...this.value], // 当前已上传文件列表 |
270 | // value: [] | 314 | // value: [] |
@@ -282,25 +326,41 @@ export default { | @@ -282,25 +326,41 @@ export default { | ||
282 | this.$refs.form && this.$refs.form.immediateValidate(true, rules); | 326 | this.$refs.form && this.$refs.form.immediateValidate(true, rules); |
283 | // this.$refs.form && this.$refs.form.immediateValidate(true, rules) | 327 | // this.$refs.form && this.$refs.form.immediateValidate(true, rules) |
284 | }, | 328 | }, |
329 | + onLoad(options) { | ||
330 | + treeLevelReq().then(res => { | ||
331 | + this.treeLevelData = res.data | ||
332 | + }) | ||
333 | + this.formData.road = options.roadId | ||
334 | + this.treeOwnership() | ||
335 | + }, | ||
285 | methods: { | 336 | methods: { |
337 | + handleInput() { | ||
338 | + this.formData.treeheight = this.formData.treeheight.replace(/^(\d*\.\d{0,2}).*/, '$1'); | ||
339 | + }, | ||
340 | + treeOwnership() { | ||
341 | + treeOwnership().then(res => { | ||
342 | + console.log(res) | ||
343 | + this.treeOwnershipData = res.data | ||
344 | + }) | ||
345 | + }, | ||
286 | // 切换显示/隐藏状态 | 346 | // 切换显示/隐藏状态 |
287 | toggleArea() { | 347 | toggleArea() { |
288 | this.isShow = !this.isShow; | 348 | this.isShow = !this.isShow; |
289 | }, | 349 | }, |
290 | // 上传完成回调 | 350 | // 上传完成回调 |
291 | handleComplete(e) { | 351 | handleComplete(e) { |
292 | - | ||
293 | - if (e.status == 1){ | 352 | + if (e.status == 1) { |
294 | console.log(e) | 353 | console.log(e) |
295 | // this.formData.treeImgList.push(e.imgArr); | 354 | // this.formData.treeImgList.push(e.imgArr); |
296 | - | ||
297 | - this.formData.treeImgList = e.imgArr; | 355 | + console.log(e.imgArr[0]) |
356 | + this.formData.treeImgListFile = e.imgArr | ||
357 | + this.formData.treeImgList = e.imgArr.map(item=>OSSURL+item); | ||
358 | + console.log(this.formData.treeImgList) | ||
359 | + // baseURL | ||
298 | // 手动触发treeImgList字段的校验 | 360 | // 手动触发treeImgList字段的校验 |
299 | this.$refs.form.validateField("treeImgList"); | 361 | this.$refs.form.validateField("treeImgList"); |
300 | - console.log(this.formData.treeImgList) | ||
301 | - console.log(this.formData.treeImgList.length) | ||
302 | - } | ||
303 | 362 | ||
363 | + } | ||
304 | // this.formData.treeImgList = e.imgArr; | 364 | // this.formData.treeImgList = e.imgArr; |
305 | // 根据实际接口返回格式调整 | 365 | // 根据实际接口返回格式调整 |
306 | // this.currentFiles.push(e.data); | 366 | // this.currentFiles.push(e.data); |
@@ -314,7 +374,6 @@ export default { | @@ -314,7 +374,6 @@ export default { | ||
314 | // this.$emit('input', this.currentFiles); | 374 | // this.$emit('input', this.currentFiles); |
315 | // this.$emit('remove', index); | 375 | // this.$emit('remove', index); |
316 | }, | 376 | }, |
317 | - | ||
318 | pickerShow() { | 377 | pickerShow() { |
319 | this.show = true | 378 | this.show = true |
320 | }, | 379 | }, |
@@ -323,16 +382,24 @@ export default { | @@ -323,16 +382,24 @@ export default { | ||
323 | }, | 382 | }, |
324 | pickerChange(e) { | 383 | pickerChange(e) { |
325 | console.log(e) | 384 | console.log(e) |
326 | - this.formData.oldtreeownership = e.text | ||
327 | - this.formData.managedutyunit = e.text | ||
328 | - | 385 | + this.formData.oldtreeownership = e.dictLabel |
386 | + }, | ||
387 | + pickerLevelShow() { | ||
388 | + this.levelshow = true | ||
389 | + }, | ||
390 | + pickerLevelHide() { | ||
391 | + this.levelshow = false | ||
392 | + }, | ||
393 | + pickerLevelChange(e) { | ||
394 | + console.log(e) | ||
395 | + this.formData.treelevel = e.dictLabel | ||
329 | }, | 396 | }, |
330 | submit() { | 397 | submit() { |
331 | // 3. 打印提交时的数据 | 398 | // 3. 打印提交时的数据 |
332 | console.log("提交时treeImgList:", this.formData.treeImgList); | 399 | console.log("提交时treeImgList:", this.formData.treeImgList); |
333 | // 手动校验图片 | 400 | // 手动校验图片 |
334 | if (!this.formData.treeImgList || this.formData.treeImgList.length === 0) { | 401 | if (!this.formData.treeImgList || this.formData.treeImgList.length === 0) { |
335 | - uni.showToast({ title: "请上传图片", icon: "none" }); | 402 | + uni.showToast({title: "请上传图片", icon: "none"}); |
336 | return; // 阻止提交 | 403 | return; // 阻止提交 |
337 | } | 404 | } |
338 | //注:结合FormItem校验,validate方法第三个参数必须传true | 405 | //注:结合FormItem校验,validate方法第三个参数必须传true |
@@ -340,6 +407,14 @@ export default { | @@ -340,6 +407,14 @@ export default { | ||
340 | if (res.isPass) { | 407 | if (res.isPass) { |
341 | console.log(this.formData) | 408 | console.log(this.formData) |
342 | console.log('校验通过!') | 409 | console.log('校验通过!') |
410 | + // addTree() | ||
411 | + addTree({data: {...this.formData}}).then(res => { | ||
412 | + console.log(res) | ||
413 | + if (res.code == '200') { | ||
414 | + uni.showToast({title: "新增成功", icon: "none"}); | ||
415 | + uni.$tui.href(`/subPackages/treePage/treeRecord?roadId=${this.formData.road}`) | ||
416 | + } | ||
417 | + }) | ||
343 | } else { | 418 | } else { |
344 | console.log(res) | 419 | console.log(res) |
345 | } | 420 | } |
subPackages/treePage/editTree.vue
@@ -14,6 +14,8 @@ | @@ -14,6 +14,8 @@ | ||
14 | 14 | ||
15 | </template> | 15 | </template> |
16 | <script > | 16 | <script > |
17 | +import { treeDetailReq } from "@/api/tree"; | ||
18 | + | ||
17 | import treeLog from "./treeLog.vue"; | 19 | import treeLog from "./treeLog.vue"; |
18 | export default { | 20 | export default { |
19 | components:{treeLog}, | 21 | components:{treeLog}, |
@@ -27,8 +29,14 @@ export default { | @@ -27,8 +29,14 @@ export default { | ||
27 | }, | 29 | }, |
28 | onLoad(options){ | 30 | onLoad(options){ |
29 | this.id = options.id | 31 | this.id = options.id |
32 | + this.treeDetailQuery() | ||
30 | }, | 33 | }, |
31 | methods:{ | 34 | methods:{ |
35 | + treeDetailQuery(){ | ||
36 | + treeDetailReq(this.id).then(res=>{ | ||
37 | + console.log(res) | ||
38 | + }) | ||
39 | + }, | ||
32 | tabChange(i){ | 40 | tabChange(i){ |
33 | console.log(i.item.name) | 41 | console.log(i.item.name) |
34 | this.currentName = i.item.name | 42 | this.currentName = i.item.name |
subPackages/treePage/treeFiles.vue
@@ -7,7 +7,7 @@ | @@ -7,7 +7,7 @@ | ||
7 | </tui-form-item> | 7 | </tui-form-item> |
8 | <tui-form-item prop="name" :bottom-border="false"> | 8 | <tui-form-item prop="name" :bottom-border="false"> |
9 | <tui-input padding="0" :borderBottom="false" placeholder="请输入道路" maxlength="20" | 9 | <tui-input padding="0" :borderBottom="false" placeholder="请输入道路" maxlength="20" |
10 | - v-model="formData.name"></tui-input> | 10 | + v-model="formData.roadName" @confirm="searchChange"></tui-input> |
11 | </tui-form-item> | 11 | </tui-form-item> |
12 | </tui-form> | 12 | </tui-form> |
13 | 13 | ||
@@ -22,37 +22,43 @@ | @@ -22,37 +22,43 @@ | ||
22 | 22 | ||
23 | <view class="full-height-row"> | 23 | <view class="full-height-row"> |
24 | <view class="full-height-col left-con"> | 24 | <view class="full-height-col left-con"> |
25 | - <view v-for="(i,index) in 7" class="teamsItem" :key="index" | 25 | + <view v-for="(i,index) in depts" class="teamsItem" :key="index" |
26 | @click="teamsChange(i)" | 26 | @click="teamsChange(i)" |
27 | :class="{teamsActive:index==currentIndex}" | 27 | :class="{teamsActive:index==currentIndex}" |
28 | > | 28 | > |
29 | - <view class="fs-ellipsis fs-pt16 fs-pb16 fs-pl8 fs-pr8">归属班组归属班组归属班组</view> | 29 | + <view class="fs-ellipsis fs-pt16 fs-pb16 fs-pl8 fs-pr8">{{ i.deptName }}</view> |
30 | 30 | ||
31 | </view> | 31 | </view> |
32 | </view> | 32 | </view> |
33 | <view class="full-height-col right-con"> | 33 | <view class="full-height-col right-con"> |
34 | - <view class="nodata-wrap"> | 34 | + <view class="nodata-wrap" v-if="roads.length==0"> |
35 | <img src="/static/images/nodata.png" alt=""> | 35 | <img src="/static/images/nodata.png" alt=""> |
36 | <view style="color: #aaa">暂无数据</view> | 36 | <view style="color: #aaa">暂无数据</view> |
37 | 37 | ||
38 | -<!-- <tui-no-data imgUrl="/static/images/nodata.png">暂无数据</tui-no-data>--> | 38 | + <!-- <tui-no-data imgUrl="/static/images/nodata.png">暂无数据</tui-no-data>--> |
39 | </view> | 39 | </view> |
40 | - <view v-for="i in 6" class="card-wrap"> | 40 | + <view v-else> |
41 | + <view v-for="i in roads" class="card-wrap" @click="toNewPage(i.roadId)"> | ||
41 | 42 | ||
42 | - <p class="fs-flex__between"> | ||
43 | - <span>白菜湾四街</span> | ||
44 | - <span>154颗</span> | ||
45 | - </p> | 43 | + <p class="fs-flex__between"> |
44 | + <span>{{ i.roadName }}</span> | ||
45 | + <span>{{ i.treeCount }}颗</span> | ||
46 | + </p> | ||
46 | 47 | ||
47 | - <p>已录入行道树:3颗</p> | 48 | + <p>已录入行道树:{{ i.recordedCount }}颗</p> |
48 | 49 | ||
49 | - <p>起点。。。。。</p> | 50 | + <p>起点:{{ i.startRemark }}</p> |
51 | + <p>终点:{{ i.endRemark }}</p> | ||
52 | + | ||
53 | + </view> | ||
50 | </view> | 54 | </view> |
51 | 55 | ||
56 | + | ||
52 | </view> | 57 | </view> |
53 | </view> | 58 | </view> |
54 | 59 | ||
55 | - <tui-picker :show="show" :pickerData="areaData" @hide="pickerHide" @change="pickerChange"> | 60 | + <tui-picker :show="show" :pickerData="belongCompanyData" textField="dictLabel" valueField="dictValue" |
61 | + @hide="pickerHide" @change="pickerChange"> | ||
56 | </tui-picker> | 62 | </tui-picker> |
57 | 63 | ||
58 | </view> | 64 | </view> |
@@ -60,29 +66,24 @@ | @@ -60,29 +66,24 @@ | ||
60 | 66 | ||
61 | 67 | ||
62 | <script> | 68 | <script> |
69 | +import { belongCompanyreq, deptListReq, treeRoadReq } from "@/api/tree"; | ||
63 | export default { | 70 | export default { |
64 | name: "treeFiles", | 71 | name: "treeFiles", |
65 | data() { | 72 | data() { |
66 | return { | 73 | return { |
67 | - cardList:[], | ||
68 | - areaData: [{ | ||
69 | - text: "中国", | ||
70 | - value: "1001" | ||
71 | - }, { | ||
72 | - text: "美国", | ||
73 | - value: "1002" | ||
74 | - }, { | ||
75 | - text: "俄罗斯", | ||
76 | - value: "1003" | ||
77 | - }], | 74 | + cardList: [], |
75 | + belongCompanyData: [], | ||
78 | show: false, | 76 | show: false, |
79 | currentIndex: 0, | 77 | currentIndex: 0, |
80 | formData: { | 78 | formData: { |
81 | //道路 | 79 | //道路 |
82 | - name: '', | 80 | + roadName: '', |
83 | //归属单位 | 81 | //归属单位 |
84 | area: '', | 82 | area: '', |
85 | }, | 83 | }, |
84 | + companyId: '',// 归属公司 | ||
85 | + depts: [],// 归属班组 | ||
86 | + roads: [], // 道路树 | ||
86 | card: { | 87 | card: { |
87 | title: { | 88 | title: { |
88 | text: '白菜湾四街' | 89 | text: '白菜湾四街' |
@@ -97,7 +98,46 @@ export default { | @@ -97,7 +98,46 @@ export default { | ||
97 | } | 98 | } |
98 | } | 99 | } |
99 | }, | 100 | }, |
101 | + onLoad() { | ||
102 | + // 归属公司 | ||
103 | + belongCompanyreq().then(res => { | ||
104 | + this.belongCompanyData = res.data | ||
105 | + if (this.belongCompanyData.length > 0) { | ||
106 | + this.formData.area = this.belongCompanyData[0].dictLabel | ||
107 | + this.companyId = (this.belongCompanyData[0].dictValue).toString() | ||
108 | + this.deptListQuery() | ||
109 | + } | ||
110 | + }) | ||
111 | + }, | ||
100 | methods: { | 112 | methods: { |
113 | + toNewPage(params){ | ||
114 | + console.log('123312') | ||
115 | + uni.$tui.href(`/subPackages/treePage/treeRecord?roadId=${params}`) | ||
116 | + | ||
117 | + }, | ||
118 | + searchChange() { | ||
119 | + this.deptListQuery() | ||
120 | + }, | ||
121 | + // 归属班组 | ||
122 | + deptListQuery() { | ||
123 | + deptListReq({data: {companyId: this.companyId, roadName: this.formData.roadName}}).then(res => { | ||
124 | + if (res.data.length == 0) { | ||
125 | + this.depts = [] | ||
126 | + this.roads = [] | ||
127 | + } else { | ||
128 | + this.depts = res.data[0].depts | ||
129 | + this.roads = this.depts[0].roads | ||
130 | + } | ||
131 | + // this.treeRoadQuery() | ||
132 | + }) | ||
133 | + }, | ||
134 | + // 树列表 | ||
135 | + treeRoadQuery() { | ||
136 | + treeRoadReq({data: {road: ''}}).then(res => { | ||
137 | + console.log(res) | ||
138 | + }) | ||
139 | + }, | ||
140 | + // 归属公司 | ||
101 | teamsChange(i) { | 141 | teamsChange(i) { |
102 | console.log(i) | 142 | console.log(i) |
103 | this.currentIndex = i | 143 | this.currentIndex = i |
@@ -166,11 +206,12 @@ export default { | @@ -166,11 +206,12 @@ export default { | ||
166 | border-radius: 10rpx; | 206 | border-radius: 10rpx; |
167 | } | 207 | } |
168 | 208 | ||
169 | -.nodata-wrap{ | 209 | +.nodata-wrap { |
170 | margin: 20px auto; | 210 | margin: 20px auto; |
171 | text-align: center; | 211 | text-align: center; |
172 | - image{ | ||
173 | - width: 160rpx ; | 212 | + |
213 | + image { | ||
214 | + width: 160rpx; | ||
174 | height: 160rpx; | 215 | height: 160rpx; |
175 | margin-bottom: 20rpx; | 216 | margin-bottom: 20rpx; |
176 | } | 217 | } |
subPackages/treePage/treeRecord.vue
1 | <template> | 1 | <template> |
2 | <view class="container"> | 2 | <view class="container"> |
3 | - <view class="record-wrap"> | ||
4 | - <view class="record-list-wrap" v-for="i in 10">1</view> | 3 | + |
4 | + <tui-no-data imgUrl="/static/images/nodata.png" v-if="rows.length==0">暂无数据</tui-no-data> | ||
5 | + <view class="record-wrap" v-else> | ||
6 | + <view class="record-list-wrap" v-for="i in rows" @click="toEditPage(i.id)"> | ||
7 | + <view class="record-list-left" :style="`background-image: url(${i.treephoto});`"></view> | ||
8 | + <view class="record-list-right"> | ||
9 | + <view class="record-list-right-title"> | ||
10 | + <view>{{i.treetype}}</view> | ||
11 | + <view>{{i.updatetime.substring(0,10)}}</view> | ||
12 | + </view> | ||
13 | + <view class="fs-mt8"> | ||
14 | + 高度:{{i.treeheight}} | ||
15 | + </view> | ||
16 | + <view class="fs-mt8"> | ||
17 | + 胸径:{{i.dbh}} | ||
18 | + </view> | ||
19 | + <view class="fs-mt8"> | ||
20 | + 树木编号:{{i.treenumber}} | ||
21 | + </view> | ||
22 | + </view> | ||
23 | + </view> | ||
5 | </view> | 24 | </view> |
6 | 25 | ||
7 | 26 | ||
8 | - <tui-button class="addTree">新增树木录入</tui-button> | 27 | + <tui-button class="addTree" @click="toAddTreePage">新增树木录入</tui-button> |
9 | </view> | 28 | </view> |
10 | 29 | ||
11 | </template> | 30 | </template> |
12 | 31 | ||
13 | <script> | 32 | <script> |
14 | - | 33 | +import { treeRoadReq } from "@/api/tree"; |
15 | export default { | 34 | export default { |
16 | - name: "treeRecord" | 35 | + name: "treeRecord", |
36 | + data(){ | ||
37 | + return{ | ||
38 | + rows:[], | ||
39 | + roadId:'' | ||
40 | + } | ||
41 | + }, | ||
42 | + onLoad(options){ | ||
43 | + this.roadId = options.roadId | ||
44 | + this.treeRoadQuery() | ||
45 | + }, | ||
46 | + methods:{ | ||
47 | + toEditPage(id){ // 前往修改页面 | ||
48 | + uni.$tui.href(`/subPackages/treePage/editTree?id=${id}`) | ||
49 | + }, | ||
50 | + toAddTreePage(){ | ||
51 | + uni.$tui.href(`/subPackages/treePage/addTree?roadId=${this.roadId}`) | ||
52 | + }, | ||
53 | + // 记录列表 | ||
54 | + treeRoadQuery(){ | ||
55 | + treeRoadReq({data:{road: this.roadId}}).then(res=>{ | ||
56 | + console.log(res) | ||
57 | + this.rows = res.rows | ||
58 | + }) | ||
59 | + }, | ||
60 | + } | ||
17 | } | 61 | } |
18 | </script> | 62 | </script> |
19 | 63 | ||
@@ -22,13 +66,27 @@ export default { | @@ -22,13 +66,27 @@ export default { | ||
22 | padding-bottom: 120rpx; | 66 | padding-bottom: 120rpx; |
23 | } | 67 | } |
24 | .record-list-wrap{ | 68 | .record-list-wrap{ |
25 | - height: 200rpx; | 69 | + height: 130px; |
26 | margin: 20rpx 20rpx 0 20rpx; | 70 | margin: 20rpx 20rpx 0 20rpx; |
27 | padding: 20rpx; | 71 | padding: 20rpx; |
28 | box-shadow: 0 1rpx 2rpx 5rpx rgb(0, 0, 0, .3); | 72 | box-shadow: 0 1rpx 2rpx 5rpx rgb(0, 0, 0, .3); |
29 | border-radius: 10rpx; | 73 | border-radius: 10rpx; |
74 | + display: flex; | ||
75 | +} | ||
76 | +.record-list-left{ | ||
77 | + height: 100px; | ||
78 | + width: 100px; | ||
79 | + background-size: 100% 100%; | ||
80 | +} | ||
81 | +.record-list-right{ | ||
82 | + height: 140px; | ||
83 | + margin-left: 20px; | ||
84 | + flex:1 | ||
85 | +} | ||
86 | +.record-list-right-title{ | ||
87 | + display: flex; | ||
88 | + justify-content: space-between; | ||
30 | } | 89 | } |
31 | - | ||
32 | .addTree{ | 90 | .addTree{ |
33 | width: 100%; | 91 | width: 100%; |
34 | position: fixed; | 92 | position: fixed; |