Commit 73dee4bdf7ed0386350a90d91a4127e1d92c2081

Authored by 刘淇
1 parent c872bdb3

高度非必填

subPackages/treePage/addTree.vue
1 <template> 1 <template>
2 <view class="container"> 2 <view class="container">
3 - <tui-form ref="form" :show-message="false" :model="formData"> 3 + <tui-form ref="form" :show-message="false" :model="formData">
4 <tui-form-item asterisk label="名称" prop="treetype"> 4 <tui-form-item asterisk label="名称" prop="treetype">
5 <tui-input padding="0" :borderBottom="false" placeholder="请输入名称" maxlength="30" 5 <tui-input padding="0" :borderBottom="false" placeholder="请输入名称" maxlength="30"
6 v-model="formData.treetype"></tui-input> 6 v-model="formData.treetype"></tui-input>
7 </tui-form-item> 7 </tui-form-item>
8 8
9 <tui-row> 9 <tui-row>
  10 +
10 <tui-col :span="12"> 11 <tui-col :span="12">
11 - <tui-form-item label="高度" asterisk prop="treeheight" :position="3"> 12 + <tui-form-item label="胸径" asterisk prop="dbh" :position="3">
12 <tui-input padding="0" :borderBottom="false" placeholder="请输入" textRight maxlength="10" 13 <tui-input padding="0" :borderBottom="false" placeholder="请输入" textRight maxlength="10"
13 - v-model="formData.treeheight"></tui-input> 14 + v-model="formData.dbh"></tui-input>
14 <template v-slot:right> 15 <template v-slot:right>
15 - <text style="padding-left: 12rpx;color:#ccc;font-size:14px;">米</text> 16 + <text style="padding-left: 12rpx;color:#ccc;font-size:14px">厘米</text>
16 </template> 17 </template>
17 </tui-form-item> 18 </tui-form-item>
18 </tui-col> 19 </tui-col>
19 <tui-col :span="12"> 20 <tui-col :span="12">
20 - <tui-form-item label="胸径" asterisk prop="dbh" :position="3"> 21 + <tui-form-item label="高度" prop="treeheight" :position="3">
21 <tui-input padding="0" :borderBottom="false" placeholder="请输入" textRight maxlength="10" 22 <tui-input padding="0" :borderBottom="false" placeholder="请输入" textRight maxlength="10"
22 - v-model="formData.dbh"></tui-input> 23 + v-model="formData.treeheight"></tui-input>
23 <template v-slot:right> 24 <template v-slot:right>
24 - <text style="padding-left: 12rpx;color:#ccc;font-size:14px">厘米</text> 25 + <text style="padding-left: 12rpx;color:#ccc;font-size:14px;">米</text>
25 </template> 26 </template>
26 </tui-form-item> 27 </tui-form-item>
27 </tui-col> 28 </tui-col>
@@ -45,21 +46,23 @@ @@ -45,21 +46,23 @@
45 <tui-col :span="12"> 46 <tui-col :span="12">
46 <tui-form-item 47 <tui-form-item
47 label="经度" 48 label="经度"
  49 + labelColor="#ccc"
48 class="location-form-item" 50 class="location-form-item"
49 prop="latitude" 51 prop="latitude"
50 :bottomBorder="false" 52 :bottomBorder="false"
51 > 53 >
52 - {{ formData.longitude }} 54 + <span style="color: #ccc"> {{ formData.longitude }}</span>
53 </tui-form-item> 55 </tui-form-item>
54 </tui-col> 56 </tui-col>
55 <tui-col :span="12"> 57 <tui-col :span="12">
56 <tui-form-item 58 <tui-form-item
57 :bottomBorder="false" 59 :bottomBorder="false"
58 label="纬度" 60 label="纬度"
  61 + labelColor="#ccc"
59 class="location-form-item" 62 class="location-form-item"
60 prop="latitude" 63 prop="latitude"
61 > 64 >
62 - {{ formData.latitude }} 65 + <span style="color: #ccc"> {{ formData.latitude }}</span>
63 </tui-form-item> 66 </tui-form-item>
64 </tui-col> 67 </tui-col>
65 68
@@ -210,8 +213,8 @@ const rules = [{ @@ -210,8 +213,8 @@ const rules = [{
210 msg: ["请输入名称"] 213 msg: ["请输入名称"]
211 }, { 214 }, {
212 name: "treeheight", 215 name: "treeheight",
213 - rule: ["required", "maxLength:10", "isAmount"],  
214 - msg: ["请输入树高", "数高不能超过10个字符", "请输入正确"] 216 + rule: ["maxLength:10", "isAmount"],
  217 + msg: ["树高不能超过10个字符", "请输入正确"]
215 }, { 218 }, {
216 name: "dbh", 219 name: "dbh",
217 rule: ["required", "maxLength:10", "isAmount"], 220 rule: ["required", "maxLength:10", "isAmount"],
@@ -283,12 +286,12 @@ export default { @@ -283,12 +286,12 @@ export default {
283 dbh: '', 286 dbh: '',
284 //级别 287 //级别
285 treelevel: '', 288 treelevel: '',
286 - treeleveltext:'', 289 + treeleveltext: '',
287 //权属单位 290 //权属单位
288 managedutyunit: '', 291 managedutyunit: '',
289 //权属分类 292 //权属分类
290 oldtreeownership: '', 293 oldtreeownership: '',
291 - oldtreeownershipText:'', 294 + oldtreeownershipText: '',
292 latinname: '', // 拉丁名 295 latinname: '', // 拉丁名
293 estimationtreeage: '', // 估测树龄 296 estimationtreeage: '', // 估测树龄
294 canopysouthnorth: '', // 冠幅南北 297 canopysouthnorth: '', // 冠幅南北
@@ -376,7 +379,6 @@ export default { @@ -376,7 +379,6 @@ export default {
376 console.log(e) 379 console.log(e)
377 this.formData.treelevel = e.dictValue 380 this.formData.treelevel = e.dictValue
378 this.formData.treeleveltext = e.dictLabel 381 this.formData.treeleveltext = e.dictLabel
379 -  
380 }, 382 },
381 submit() { 383 submit() {
382 // 3. 打印提交时的数据 384 // 3. 打印提交时的数据
@@ -444,7 +446,6 @@ export default { @@ -444,7 +446,6 @@ export default {
444 <style> 446 <style>
445 447
446 448
447 -  
448 .tui-btn__box { 449 .tui-btn__box {
449 width: 100%; 450 width: 100%;
450 position: fixed; 451 position: fixed;
subPackages/treePage/editTreeIfo.vue
@@ -7,27 +7,26 @@ @@ -7,27 +7,26 @@
7 </tui-form-item> 7 </tui-form-item>
8 8
9 <tui-row> 9 <tui-row>
  10 +
10 <tui-col :span="12"> 11 <tui-col :span="12">
11 - <tui-form-item label="高度" asterisk prop="treeheight" :position="3"> 12 + <tui-form-item label="胸径" asterisk prop="dbh" :position="3">
12 <tui-input padding="0" :borderBottom="false" placeholder="请输入" textRight maxlength="10" 13 <tui-input padding="0" :borderBottom="false" placeholder="请输入" textRight maxlength="10"
13 - v-model="formData.treeheight"></tui-input> 14 + v-model="formData.dbh"></tui-input>
14 <template v-slot:right> 15 <template v-slot:right>
15 - <text style="padding-left: 12rpx;color:#aaa;font-size:14px;">米</text> 16 + <text style="padding-left: 12rpx;color:#ccc;font-size:14px">厘米</text>
16 </template> 17 </template>
17 </tui-form-item> 18 </tui-form-item>
18 </tui-col> 19 </tui-col>
19 <tui-col :span="12"> 20 <tui-col :span="12">
20 - <tui-form-item label="胸径" asterisk prop="dbh" :position="3"> 21 + <tui-form-item label="高度" prop="treeheight" :position="3">
21 <tui-input padding="0" :borderBottom="false" placeholder="请输入" textRight maxlength="10" 22 <tui-input padding="0" :borderBottom="false" placeholder="请输入" textRight maxlength="10"
22 - v-model="formData.dbh"></tui-input> 23 + v-model="formData.treeheight"></tui-input>
23 <template v-slot:right> 24 <template v-slot:right>
24 - <text style="padding-left: 12rpx;color:#aaa;font-size:14px">厘米</text> 25 + <text style="padding-left: 12rpx;color:#ccc;font-size:14px;">米</text>
25 </template> 26 </template>
26 </tui-form-item> 27 </tui-form-item>
27 </tui-col> 28 </tui-col>
28 </tui-row> 29 </tui-row>
29 -  
30 -  
31 <tui-form-item 30 <tui-form-item
32 asterisk 31 asterisk
33 label="位置" 32 label="位置"
@@ -41,29 +40,31 @@ @@ -41,29 +40,31 @@
41 <tui-icon name="gps" :size="20"></tui-icon> 40 <tui-icon name="gps" :size="20"></tui-icon>
42 </template> 41 </template>
43 </tui-form-item> 42 </tui-form-item>
44 -  
45 <tui-col :span="12"> 43 <tui-col :span="12">
46 <tui-form-item 44 <tui-form-item
47 -  
48 - label="纬度" 45 + label="经度"
  46 + labelColor="#ccc"
49 class="location-form-item" 47 class="location-form-item"
50 -  
51 prop="latitude" 48 prop="latitude"
52 > 49 >
53 - {{ formData.latitude }} 50 + <span style="color: #ccc"> {{ formData.longitude }}</span>
54 </tui-form-item> 51 </tui-form-item>
55 </tui-col> 52 </tui-col>
  53 +
56 <tui-col :span="12"> 54 <tui-col :span="12">
57 <tui-form-item 55 <tui-form-item
58 - label="经度" 56 + labelColor="#ccc"
  57 + label="纬度"
59 class="location-form-item" 58 class="location-form-item"
  59 +
60 prop="latitude" 60 prop="latitude"
61 > 61 >
62 - {{ formData.longitude }} 62 + <span style="color: #ccc"> {{ formData.latitude }}</span>
63 </tui-form-item> 63 </tui-form-item>
64 </tui-col> 64 </tui-col>
65 65
66 66
  67 +
67 <tui-form-item asterisk label="管护单位" prop="managedutyunit"> 68 <tui-form-item asterisk label="管护单位" prop="managedutyunit">
68 69
69 <tui-input padding="0" :borderBottom="false" placeholder="请输入" maxlength="30" 70 <tui-input padding="0" :borderBottom="false" placeholder="请输入" maxlength="30"
@@ -145,7 +146,7 @@ @@ -145,7 +146,7 @@
145 <tui-input padding="0" :borderBottom="false" placeholder="请输入" textRight maxlength="10" 146 <tui-input padding="0" :borderBottom="false" placeholder="请输入" textRight maxlength="10"
146 v-model="formData.estimationtreeage"></tui-input> 147 v-model="formData.estimationtreeage"></tui-input>
147 <template v-slot:right> 148 <template v-slot:right>
148 - <text style="padding-left: 12rpx;color:#aaa;font-size: 14px">年</text> 149 + <text style="padding-left: 12rpx;color:#ccc;font-size: 14px">年</text>
149 </template> 150 </template>
150 </tui-form-item> 151 </tui-form-item>
151 </tui-col> 152 </tui-col>
@@ -154,7 +155,7 @@ @@ -154,7 +155,7 @@
154 <tui-input padding="0" :borderBottom="false" placeholder="请输入" textRight maxlength="10" 155 <tui-input padding="0" :borderBottom="false" placeholder="请输入" textRight maxlength="10"
155 v-model="formData.weekday"></tui-input> 156 v-model="formData.weekday"></tui-input>
156 <template v-slot:right> 157 <template v-slot:right>
157 - <text style="padding-left: 12rpx;color:#aaa;font-size: 14px">厘米</text> 158 + <text style="padding-left: 12rpx;color:#ccc;font-size: 14px">厘米</text>
158 </template> 159 </template>
159 </tui-form-item> 160 </tui-form-item>
160 </tui-col> 161 </tui-col>
@@ -167,7 +168,7 @@ @@ -167,7 +168,7 @@
167 <tui-input padding="0" :borderBottom="false" placeholder="请输入" textRight maxlength="10" 168 <tui-input padding="0" :borderBottom="false" placeholder="请输入" textRight maxlength="10"
168 v-model="formData.canopyeastwest"></tui-input> 169 v-model="formData.canopyeastwest"></tui-input>
169 <template v-slot:right> 170 <template v-slot:right>
170 - <text style="padding-left: 12rpx;color:#aaa">米</text> 171 + <text style="padding-left: 12rpx;color:#ccc">米</text>
171 </template> 172 </template>
172 </tui-form-item> 173 </tui-form-item>
173 </tui-col> 174 </tui-col>
@@ -176,13 +177,12 @@ @@ -176,13 +177,12 @@
176 <tui-input padding="0" :borderBottom="false" placeholder="请输入" textRight maxlength="10" 177 <tui-input padding="0" :borderBottom="false" placeholder="请输入" textRight maxlength="10"
177 v-model="formData.canopysouthnorth"></tui-input> 178 v-model="formData.canopysouthnorth"></tui-input>
178 <template v-slot:right> 179 <template v-slot:right>
179 - <text style="padding-left: 12rpx;color:#aaa;font-size: 14px">米</text> 180 + <text style="padding-left: 12rpx;color:#ccc;font-size: 14px">米</text>
180 </template> 181 </template>
181 </tui-form-item> 182 </tui-form-item>
182 </tui-col> 183 </tui-col>
183 </tui-row> 184 </tui-row>
184 185
185 -  
186 </view> 186 </view>
187 187
188 <!-- 触发按钮 --> 188 <!-- 触发按钮 -->
@@ -198,7 +198,7 @@ @@ -198,7 +198,7 @@
198 </tui-form> 198 </tui-form>
199 <view style="height: 60px;width: 100%"></view> 199 <view style="height: 60px;width: 100%"></view>
200 <view class="tui-btn__box"> 200 <view class="tui-btn__box">
201 - <tui-button bold @click="submit">提交</tui-button> 201 + <tui-button bold @click="submit">修改树木信息</tui-button>
202 </view> 202 </view>
203 <tui-picker :show="show" :pickerData="treeOwnershipData" textField="dictLabel" valueField="dictValue" 203 <tui-picker :show="show" :pickerData="treeOwnershipData" textField="dictLabel" valueField="dictValue"
204 @hide="pickerHide" @change="pickerChange"> 204 @hide="pickerHide" @change="pickerChange">
@@ -219,8 +219,8 @@ const rules = [{ @@ -219,8 +219,8 @@ const rules = [{
219 msg: ["请输入名称"] 219 msg: ["请输入名称"]
220 }, { 220 }, {
221 name: "treeheight", 221 name: "treeheight",
222 - rule: ["required", "maxLength:10", "isAmount"],  
223 - msg: ["请输入数高", "数高不能超过10个字符", "请输入正确"] 222 + rule: ["maxLength:10", "isAmount"],
  223 + msg: ["数高不能超过10个字符", "请输入正确"]
224 }, { 224 }, {
225 name: "dbh", 225 name: "dbh",
226 rule: ["required", "maxLength:10", "isAmount"], 226 rule: ["required", "maxLength:10", "isAmount"],
@@ -414,6 +414,7 @@ export default { @@ -414,6 +414,7 @@ export default {
414 // 3. 打印提交时的数据 414 // 3. 打印提交时的数据
415 console.log("提交时treeImgList:", this.formData.treeImgList); 415 console.log("提交时treeImgList:", this.formData.treeImgList);
416 // 手动校验图片 416 // 手动校验图片
  417 + console.log( this.formData);
417 if (!this.formData.treeImgList || this.formData.treeImgList.length === 0) { 418 if (!this.formData.treeImgList || this.formData.treeImgList.length === 0) {
418 uni.showToast({title: "请上传图片", icon: "none"}); 419 uni.showToast({title: "请上传图片", icon: "none"});
419 return; // 阻止提交 420 return; // 阻止提交
@@ -423,11 +424,11 @@ export default { @@ -423,11 +424,11 @@ export default {
423 if (res.isPass) { 424 if (res.isPass) {
424 console.log(this.formData) 425 console.log(this.formData)
425 console.log('校验通过!') 426 console.log('校验通过!')
426 - updateTree({data: {...this.formData}}).then(res => { 427 + updateTree({data:this.formData}).then(res => {
427 console.log(res) 428 console.log(res)
428 if (res.code == '200') { 429 if (res.code == '200') {
429 uni.showToast({title: "修改成功", icon: "none"}); 430 uni.showToast({title: "修改成功", icon: "none"});
430 - // uni.$tui.href(`/subPackages/treePage/treeRecord?roadId=${this.formData.road}`) 431 + uni.$tui.href(`/subPackages/treePage/treeRecord?roadId=${this.formData.road}`)
431 } 432 }
432 }) 433 })
433 } else { 434 } else {
subPackages/treePage/treeInfo.vue
@@ -7,21 +7,23 @@ @@ -7,21 +7,23 @@
7 </tui-form-item> 7 </tui-form-item>
8 8
9 <tui-row> 9 <tui-row>
  10 +
10 <tui-col :span="12"> 11 <tui-col :span="12">
11 - <tui-form-item label="高度" asterisk prop="treeheight" :position="3"> 12 + <tui-form-item label="胸径" asterisk prop="dbh" :position="3">
12 <tui-input padding="0" :borderBottom="false" placeholder="请输入" textRight maxlength="10" :disabled="true" 13 <tui-input padding="0" :borderBottom="false" placeholder="请输入" textRight maxlength="10" :disabled="true"
13 - v-model="formData.treeheight"></tui-input> 14 + v-model="formData.dbh"></tui-input>
14 <template v-slot:right> 15 <template v-slot:right>
15 - <text style="padding-left: 12rpx;color:#ccc;font-size:14px;">米</text> 16 + <text style="padding-left: 12rpx;color:#ccc;font-size:14px">厘米</text>
16 </template> 17 </template>
17 </tui-form-item> 18 </tui-form-item>
18 </tui-col> 19 </tui-col>
  20 +
19 <tui-col :span="12"> 21 <tui-col :span="12">
20 - <tui-form-item label="胸径" asterisk prop="dbh" :position="3"> 22 + <tui-form-item label="高度" prop="treeheight" :position="3">
21 <tui-input padding="0" :borderBottom="false" placeholder="请输入" textRight maxlength="10" :disabled="true" 23 <tui-input padding="0" :borderBottom="false" placeholder="请输入" textRight maxlength="10" :disabled="true"
22 - v-model="formData.dbh"></tui-input> 24 + v-model="formData.treeheight"></tui-input>
23 <template v-slot:right> 25 <template v-slot:right>
24 - <text style="padding-left: 12rpx;color:#ccc;font-size:14px">厘米</text> 26 + <text style="padding-left: 12rpx;color:#ccc;font-size:14px;">米</text>
25 </template> 27 </template>
26 </tui-form-item> 28 </tui-form-item>
27 </tui-col> 29 </tui-col>
@@ -46,20 +48,20 @@ @@ -46,20 +48,20 @@
46 label="经度" 48 label="经度"
47 class="location-form-item" 49 class="location-form-item"
48 prop="latitude" 50 prop="latitude"
  51 + labelColor="#ccc"
49 > 52 >
50 - {{ formData.longitude }} 53 + <span style="color: #ccc"> {{ formData.longitude }}</span>
51 </tui-form-item> 54 </tui-form-item>
52 </tui-col> 55 </tui-col>
53 56
54 <tui-col :span="12"> 57 <tui-col :span="12">
55 <tui-form-item 58 <tui-form-item
56 -  
57 label="纬度" 59 label="纬度"
58 class="location-form-item" 60 class="location-form-item"
59 - 61 + labelColor="#ccc"
60 prop="latitude" 62 prop="latitude"
61 > 63 >
62 - {{ formData.latitude }} 64 + <span style="color: #ccc"> {{ formData.latitude }}</span>
63 </tui-form-item> 65 </tui-form-item>
64 </tui-col> 66 </tui-col>
65 67
utils/request.js
@@ -7,7 +7,7 @@ function checkParams(params) { @@ -7,7 +7,7 @@ function checkParams(params) {
7 if (typeof params != 'object') return params; 7 if (typeof params != 'object') return params;
8 for (let key in params) { 8 for (let key in params) {
9 const value = params[key] 9 const value = params[key]
10 - if (value === null || value === undefined || value === "") { 10 + if (value === null || value === undefined ) {
11 delete params[key] 11 delete params[key]
12 } 12 }
13 } 13 }