Commit 73dee4bdf7ed0386350a90d91a4127e1d92c2081

Authored by 刘淇
1 parent c872bdb3

高度非必填

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