Browse Source

修改表单

master
邓宏 2 years ago
parent
commit
20f75d4f6e
  1. 4
      common/request.js
  2. 11
      pages/massif/info.vue
  3. 45
      uni_modules/d-form/components/d-form/d-form.vue

4
common/request.js

@ -2,8 +2,8 @@ import store from "@/store"
export function host(host='default',suffix='/plant_manage'){
var url=process.env.NODE_ENV === 'development'?{
// default:`http://zrxsae.natappfree.cc` //陈
default:`http://k3megd.natappfree.cc` //马
default:`http://zrxsae.natappfree.cc` //陈
// default:`http://k3megd.natappfree.cc` //马
}:{
default:`http://qv6mj8.natappfree.cc`
}

11
pages/massif/info.vue

@ -15,6 +15,7 @@
:required="!!rules[k]"
:field="k"
:value="(/^dateRange$|^select$/.test(v.type)?fields[k].value:formData[k])"
ref="dForm"
@input="formData[k]=$event"
@selectRDate="selectDate"
@select="fields[k].value=$event.value.map(v=>v.value);formData[k]=$event.value[0].value"
@ -36,7 +37,7 @@ import request from '@/common/request'
realityArea:{label:"实际面积",type:'digit'},
image:{label:"地块图片",type:"upImg",num:3,value:''},
date:{label:"使用日期",type:"dateRange",value:[]},
jw:{label:"经/纬度"},
jw:{label:"经/纬度",type:"map"},
address:{label:"详细地址",type:"textarea"},
},
formData:{
@ -72,6 +73,7 @@ import request from '@/common/request'
}
},
onLoad(options){
window.the=this
this.init()
if(options.id)this.getDetail(options.id);
this.eventChannel=this.getOpenerEventChannel()
@ -141,8 +143,13 @@ import request from '@/common/request'
},
},
onBackPress(e){
console.log(e)
var dForm=this.$refs.dForm.find(v=>v.field=='jw')
if(dForm?.showMap){//
dForm.showMap=false
return true
}else{
return false
}
},
}
</script>

45
uni_modules/d-form/components/d-form/d-form.vue

@ -18,12 +18,25 @@
margin-left:30rpx;
}
}
.u-input,textarea{
.map,.u-input,textarea{
background:#F7F7F7;
margin-top:14rpx;
border-radius: 24rpx;
width:100%;
}
.map{
height:80rpx;
display:flex;
align-items: center;
padding:0 20rpx;
&.noData{
color:#999;
}
&:before{
margin-right:26rpx;
color:#999;
}
}
textarea{
height:auto;
min-height:160rpx;
@ -143,6 +156,27 @@
}
}
}
.amap{
position:fixed;
top:0;
left:0;
width:100%;
height:100%;
z-index: -1;
background:rgba(0, 0, 0, 0.4);
transition: all .5s;
opacity: 0;
transform: scale(0.8);
&.show{
opacity: 1;
transform: scale(1);
z-index: 100;
}
map{
width:100%;
height:100%;
}
}
}
</style>
<template>
@ -154,6 +188,7 @@
</u-input>
<button v-if="btnText" @click="btnFun" class="cu-btn bg-green shadow">{{btnText}}</button>
</view>
<view v-else-if="type=='map'" class="map plant-dingweixiao" :class="{noData:true}" @click="showMap=true">选择经纬度</view>
<view v-else-if="type=='select'" class="plant-youbian" :class="{noData: !value[0]}" @click="show=true">{{pickerContent}}</view>
<u-upload v-else-if="type=='upImg'" :fileList="imgs" previewFullImage multiple :maxCount="num" @delete="delImg" @afterRead="afterRead">
<view class="album">
@ -180,7 +215,7 @@
<view class="tip" v-if="tip">{{tip}}</view>
</u-form-item>
<!-- :defaultIndex="(value||[]).map(v=>v||0)" -->
<u-picker
v-if="type=='select'"
:columns="columns"
@ -211,6 +246,9 @@
lunar
@confirm="$emit('input',$event.fulldate)"/>
<view v-if="type=='map'" class="amap" :class="{show:showMap}">
<map />
</view>
</view>
</template>
@ -221,7 +259,7 @@ import {dataType} from 'black-knight/lib/config/tools'
function setPickerCol(columns, value, n){
if(columns.length<=0)return
var v=value[n-1]||0
if(columns[v].children){
if(columns[v]?.children){
this.setColumnValues(n,columns[v].children)
setPickerCol(columns[v].children, value, ++n)
}
@ -295,6 +333,7 @@ import {dataType} from 'black-knight/lib/config/tools'
show:false,
dateType:"start",
imgList:[],
showMap:false,
}
},
watch:{

Loading…
Cancel
Save