Browse Source

修改表单

master
邓宏 2 years ago
parent
commit
20f75d4f6e
  1. 4
      common/request.js
  2. 13
      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'){ export function host(host='default',suffix='/plant_manage'){
var url=process.env.NODE_ENV === 'development'?{ var url=process.env.NODE_ENV === 'development'?{
// default:`http://zrxsae.natappfree.cc` //陈 default:`http://zrxsae.natappfree.cc` //陈
default:`http://k3megd.natappfree.cc` //马 // default:`http://k3megd.natappfree.cc` //马
}:{ }:{
default:`http://qv6mj8.natappfree.cc` default:`http://qv6mj8.natappfree.cc`
} }

13
pages/massif/info.vue

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

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

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

Loading…
Cancel
Save