界面优化

This commit is contained in:
jia 2023-12-09 17:07:42 +08:00
parent be68268fb5
commit 14eea39897
10 changed files with 263 additions and 122 deletions

View File

@ -41,7 +41,9 @@
v-model="data.formData.master_phone"></up-input>
</u-form-item>
<view class="card-li">
<view class="card-li-tit">
<span>*</span>
土地图片
</view>
<view class="code-img1">
@ -431,9 +433,19 @@
<style lang="scss">
.card-li-tit {
margin-bottom: 20rpx;
position: relative;
span {
position: absolute;
left: -9px;
color: #f56c6c;
line-height: 20px;
font-size: 20px;
top: 3px;
}
margin-bottom: 20rpx;
}
.confim-btn {
margin: 0 auto;
width: 196.26rpx;

View File

@ -3,37 +3,37 @@
<view class="content">
<view class="card">
<u--form labelPosition="top" labelWidth='130' :model="formData" :rules="rules" ref="form">
<u-form-item label="虫剂种类" prop="kind" borderBottom ref='item1' required>
<up-input placeholder="请输入虫剂种类" :disabled="mode=='detail'" border="surround"
<u-form-item label="虫剂种类" prop="kind" borderBottom ref='item1' required>
<up-input placeholder="请输入虫剂种类" :disabled="mode=='detail'" border="surround"
v-model="formData.kind"></up-input>
</u-form-item>
<u-form-item label="虫剂品牌" prop="breed" borderBottom required>
<up-input placeholder="请输入虫剂品牌" :disabled="mode=='detail'" border="surround"
<u-form-item label="虫剂品牌" prop="breed" borderBottom required>
<up-input placeholder="请输入虫剂品牌" :disabled="mode=='detail'" border="surround"
v-model="formData.breed"></up-input>
</u-form-item>
<u-form-item label="虫剂用量(升)" prop="dosage" borderBottom required>
<up-input placeholder="请输入虫剂用量" type='number' border="surround" :disabled="mode=='detail'"
<u-form-item label="虫剂用量(升)" prop="dosage" borderBottom required>
<up-input placeholder="请输入虫剂用量" type='number' border="surround" :disabled="mode=='detail'"
v-model="formData.dosage"></up-input>
</u-form-item>
<view class="" v-if="mode=='add'">
<u-form-item label="开始日期" @click="openDate" prop="start_date" borderBottom required>
<up-input placeholder="请选择日期" readonly border="surround"
v-model="formData.start_date" style="pointer-events: none;"></up-input>
<up-input placeholder="请选择日期" readonly border="surround" v-model="formData.start_date"
style="pointer-events: none;"></up-input>
</u-form-item>
<u-form-item label="结束日期" prop="end_date" @click="openDate1" borderBottom required>
<up-input placeholder="请选择日期" readonly border="surround"
v-model="formData.end_date" style="pointer-events: none;"></up-input>
<up-input placeholder="请选择日期" readonly border="surround" v-model="formData.end_date"
style="pointer-events: none;"></up-input>
</u-form-item>
</view>
<view class="" v-else>
<u-form-item label="开始日期" prop="start_date" borderBottom required>
<up-input placeholder="请选择日期" readonly border="surround"
v-model="formData.start_date" style="pointer-events: none;"></up-input>
<up-input placeholder="请选择日期" readonly border="surround" v-model="formData.start_date"
style="pointer-events: none;"></up-input>
</u-form-item>
<u-form-item label="结束日期" prop="end_date" borderBottom required>
<up-input placeholder="请选择日期" readonly border="surround"
v-model="formData.end_date" style="pointer-events: none;"></up-input>
<up-input placeholder="请选择日期" readonly border="surround" v-model="formData.end_date"
style="pointer-events: none;"></up-input>
</u-form-item>
</view>
<u-form-item label="作业面积(亩)" prop="area" borderBottom required>
@ -47,16 +47,17 @@
<view class="card-li">
<view class="card-li-tit">
<span>*</span>
虫图片
虫图片
</view>
<view class="code-img1">
<view class="" v-if="pic.length>0"
style="display: flex;flex-direction: row;flex-wrap: wrap;margin-bottom: 30rpx;">
<view class="" v-for="(item,i) in pic" style="margin-right: 30rpx;">
<view class="">
<u-icon name="close" size="15" style="margin-left:120.85rpx;"
@click="delimg(i)" v-show="mode=='add'"></u-icon>
<u-image :src="item" width="150.85rpx" height="150.85rpx" @click="perviewFn(item)"></u-image>
<u-icon name="close" size="15" style="margin-left:120.85rpx;" @click="delimg(i)"
v-show="mode=='add'"></u-icon>
<u-image :src="item" width="150.85rpx" height="150.85rpx"
@click="perviewFn(item)"></u-image>
</view>
</view>
</view>
@ -75,7 +76,7 @@
</view>
</view>
<u-form-item label="备注" prop="remark" borderBottom >
<u-form-item label="备注" prop="remark" borderBottom>
<u--textarea v-model="formData.remark" :disabled="mode=='detail'" placeholder="请输入内容"></u--textarea>
</u-form-item>
@ -117,7 +118,8 @@
onReady
} from '@dcloudio/uni-app';
import {
addaction
addaction,
plantdetail
} from '@/api/api.js'
const pic = reactive([]);
@ -132,6 +134,7 @@
// calendar.value.open()
show1.value = true
}
const dataobj = reactive({})
const openDate1 = () => {
// calendar1.value.open()
show2.value = true
@ -146,7 +149,7 @@
end_date: "",
})
const formatter = (type, value) => {
const formatter = (type, value) => {
if (type === 'year') {
return `${value}`;
}
@ -157,8 +160,8 @@ const formatter = (type, value) => {
return `${value}`;
}
return value;
};
//
};
//
const dateConfirmfn = (e) => {
formData.start_date = uni.$u.timeFormat(e.value, 'yyyy-mm-dd hh:MM ')
show1.value = false
@ -171,19 +174,19 @@ const formatter = (type, value) => {
'kind': {
type: 'string',
required: true,
message: '请填写虫剂品牌',
message: '请填写虫剂品牌',
trigger: ['blur', 'change']
},
'breed': {
type: 'string',
required: true,
message: '请填写虫剂品牌',
message: '请填写虫剂品牌',
trigger: ['blur', 'change']
},
'dosage': {
type: 'string',
required: true,
message: '请填写虫剂用量',
message: '请填写虫剂用量',
trigger: ['blur', 'change']
},
'start_date': {
@ -281,7 +284,10 @@ const formatter = (type, value) => {
if (res) {
if (formData.area > dataobj.area) {
uni.$u.toast('作业面积不能超过种植面积')
return
}
formData.pic = pic
let data1 = {
@ -295,6 +301,28 @@ const formatter = (type, value) => {
return
}
let endTime = new Date(formData.end_date)
let startTime = new Date(formData.start_date)
let plantTime = new Date(dataobj.plant_date)
if (startTime < plantTime) {
uni.$u.toast("除虫时间必须超过种植的时间");
return
}
if (endTime < plantTime) {
uni.$u.toast("除虫时间必须超过种植的时间");
return
}
if (endTime < startTime) {
uni.$u.toast("结束时间不能小于开始时间");
return
} else if (startTime > endTime) {
uni.$u.toast("开始时间不能大于结束时间");
return
} else {
console.log("开始时间和结束时间合法");
}
console.log('表单通过');
//
@ -311,7 +339,7 @@ const formatter = (type, value) => {
// uni.$u.toast('')
}
}).catch((err)=>{
}).catch((err) => {
uni.$u.toast(err[0].message)
console.log(err)
})
@ -319,7 +347,16 @@ const formatter = (type, value) => {
}
const getlist = () => {
plantdetail({
plant_id: task_id.value
}).then((res) => {
if (res.code == 1) {
// console.log(res)
Object.assign(dataobj, res.data)
}
});
};
const mode = ref('add')
onLoad((options) => {
@ -341,7 +378,7 @@ const formatter = (type, value) => {
task_id.value = options.id
}
getlist()
})
</script>

View File

@ -10,7 +10,8 @@
<view class="shop_action-detail" v-if="item.type!=3&&item.type!=5">
<view class="action-detail">
<view class="title">
{{item.type_text.slice(0, -2)}}品种
{{item.type_text.slice(0, -2)}}<text class=""
v-if="item.type==2||item.type==4"></text>品种
</view>
<view class="detail">
{{item.detail.kind}}
@ -18,7 +19,8 @@
</view>
<view class="action-detail" v-if="item.detail.breed">
<view class="title">
{{item.type_text.slice(0, -2)}}品牌
{{item.type_text.slice(0, -2)}}<text class=""
v-if="item.type==2||item.type==4"></text>品牌
</view>
<view class="detail">
{{item.detail.breed}}
@ -26,7 +28,8 @@
</view>
<view class="action-detail">
<view class="title">
{{item.type_text.slice(0, -2)}}用量
{{item.type_text.slice(0, -2)}}<text class=""
v-if="item.type==2||item.type==4"></text>用量
</view>
<view class="detail">
{{item.detail.dosage}}
@ -37,7 +40,7 @@
<view class="action-detail">
<view class="title">
{{item.type_text.slice(0, -2)}}
参与
</view>
<view class="detail">
{{item.detail.user}}
@ -92,7 +95,7 @@
<view class="action-detail">
<view class="title">
灌溉
参与
</view>
<view class="detail">
{{item.detail.user}}
@ -136,7 +139,7 @@
<view class="action-detail">
<view class="title" style="width: 200rpx;">
收获
参与
</view>
<view class="detail">
{{item.detail.user}}

View File

@ -78,7 +78,7 @@
</view>
</view>
<u-form-item label="备注" prop="remark" borderBottom >
<u-form-item label="备注" prop="remark" borderBottom>
<u--textarea v-model="formData.remark" :disabled="mode=='detail'" placeholder="请输入内容"></u--textarea>
</u-form-item>
@ -121,7 +121,8 @@
onReady
} from '@dcloudio/uni-app';
import {
addaction
addaction,
plantdetail
} from '@/api/api.js'
const pic = reactive([]);
@ -132,6 +133,7 @@
const value1 = ref(Date.now());
const show1 = ref(false);
const show2 = ref(false);
const dataobj = reactive({});
const openDate = () => {
// calendar.value.open()
show1.value = true
@ -273,7 +275,10 @@
form.value.validate().then(res => {
// console.log(res)
if (res) {
if (formData.area > dataobj.area) {
uni.$u.toast('作业面积不能超过种植面积')
return
}
formData.pic = pic
let data1 = {
@ -281,6 +286,7 @@
type: 1,
detail: JSON.stringify(formData)
};
if (formData.pic.length == 0) {
uni.$u.toast('请上传图片')
@ -288,6 +294,17 @@
}
let endTime = new Date(formData.end_date)
let startTime = new Date(formData.start_date)
let plantTime = new Date(dataobj.plant_date)
console.log(startTime<plantTime,endTime<plantTime)
if(startTime<plantTime ){
uni.$u.toast("施肥时间必须超过种植的时间");
return
}
if(endTime<plantTime){
uni.$u.toast("施肥时间必须超过种植的时间");
return
}
if (endTime < startTime) {
uni.$u.toast("结束时间不能小于开始时间");
return
@ -298,6 +315,9 @@
console.log("开始时间和结束时间合法");
}
console.log('表单通过');
//
@ -314,8 +334,8 @@
// uni.$u.toast('')
}
}).catch((err)=>{
uni.$u.toast(err[0].message)
}).catch((err) => {
console.log(err)
})
@ -332,7 +352,16 @@
const delimg = (i) => {
pic.splice(i, 1);
}
const getlist = () => {
plantdetail({
plant_id: task_id.value
}).then((res) => {
if (res.code == 1) {
// console.log(res)
Object.assign(dataobj, res.data)
}
});
};
const mode = ref('add')
onLoad((options) => {
@ -355,7 +384,7 @@
task_id.value = options.id
}
getlist()
})
</script>

View File

@ -118,7 +118,8 @@
} from "@dcloudio/uni-app"
import {
addaction
addaction,
plantdetail
} from '@/api/api.js'
const range = reactive([{
value: 1,
@ -143,6 +144,7 @@
const value1 = ref(Date.now());
const show1 = ref(false);
const show2 = ref(false);
const dataobj = reactive({})
const openDate = () => {
// calendar.value.open()
show1.value = true
@ -243,6 +245,10 @@
// console.log(formData)
form.value.validate().then(res => {
if (res) {
if (formData.area > dataobj.area) {
uni.$u.toast('灌溉面积不能超过种植面积')
return
}
formData.pic = pic
let data1 = {
plant_id: task_id.value,
@ -255,6 +261,16 @@
}
let endTime = new Date(formData.end_date)
let startTime = new Date(formData.start_date)
let plantTime = new Date(dataobj.plant_date)
if (startTime < plantTime) {
uni.$u.toast("灌溉时间必须超过种植的时间");
return
}
if (endTime < plantTime) {
uni.$u.toast("灌溉时间必须超过种植的时间");
return
}
if (endTime < startTime) {
uni.$u.toast("结束时间不能小于开始时间");
return
@ -331,7 +347,16 @@
// let res = await Uploads()
// data.formData.pic = res.data.image
}
const getlist = () => {
plantdetail({
plant_id: task_id.value
}).then((res) => {
if (res.code == 1) {
// console.log(res)
Object.assign(dataobj, res.data)
}
});
};
const mode = ref('add')
onLoad((options) => {
if (options.task) {
@ -351,7 +376,7 @@
task_id.value = options.id
}
getlist()
})
</script>

View File

@ -77,7 +77,7 @@
</view>
</view>
<u-form-item label="备注" prop="remark" borderBottom >
<u-form-item label="备注" prop="remark" borderBottom>
<u--textarea v-model="formData.remark" :disabled="mode=='detail'" placeholder="请输入内容"></u--textarea>
</u-form-item>
@ -119,7 +119,8 @@
onReady
} from '@dcloudio/uni-app';
import {
addaction
addaction,
plantdetail
} from '@/api/api.js'
const pic = reactive([]);
@ -134,6 +135,7 @@
// calendar.value.open()
show1.value = true
}
const dataobj = reactive({})
const openDate1 = () => {
// calendar1.value.open()
show2.value = true
@ -273,10 +275,13 @@
const addFn = () => {
form.value.validate().then(res => {
console.log(res)
// console.log(res)
if (res) {
if (formData.area > dataobj.area) {
uni.$u.toast('作业面积不能超过种植面积')
return
}
formData.pic = pic
@ -292,6 +297,16 @@
}
let endTime = new Date(formData.end_date)
let startTime = new Date(formData.start_date)
let plantTime = new Date(dataobj.plant_date)
if (startTime < plantTime) {
uni.$u.toast("除草时间必须超过种植的时间");
return
}
if (endTime < plantTime) {
uni.$u.toast("除草时间必须超过种植的时间");
return
}
if (endTime < startTime) {
uni.$u.toast("结束时间不能小于开始时间");
return
@ -326,7 +341,16 @@
}
const getlist = () => {
plantdetail({
plant_id: task_id.value
}).then((res) => {
if (res.code == 1) {
// console.log(res)
Object.assign(dataobj, res.data)
}
});
};
const mode = ref('add')
onLoad((options) => {
@ -348,7 +372,7 @@
}
getlist()
})
</script>

View File

@ -77,10 +77,15 @@
</view>
</view>
<view class="add-thing" v-if="(dataobj.total_area-dataobj.residual_area)==0" @click="palnt(dataobj.id)">
新增种植
</view>
<view class="" v-else>
<view class="add-thing" @click="showPicker1=true" v-if="columns2[0]&&columns2[0].length>0">
记农事
</view>
</view>
<!-- 苗情监测 -->
<view class="">
<view class="live-video soil-monitor">
@ -591,6 +596,12 @@
url: '/pages/landDetail/index?id=' + dataobj.id
})
}
const palnt = (id) => {
uni.navigateTo({
url: '/pages/husbandryForm/sow?id=' + id
})
}
const navto = (url) => {
uni.navigateTo({
url

View File

@ -49,7 +49,7 @@
种植面积: {{item.area}}
</view>
<view class="">
参与人: {{item.user}}
参与人: {{item.user}}
</view>
<view class="">
种植日期: {{item.plant_date}}

View File

@ -75,7 +75,7 @@
<view class="shop_action-detail" v-if="item.type!=3&&item.type!=5">
<view class="action-detail">
<view class="title">
{{item.type_text.slice(0, -2)}}品种
{{item.type_text.slice(0, -2)}}<text class="" v-if="item.type==2||item.type==4"></text>品种
</view>
<view class="detail">
{{item.detail.kind}}
@ -83,7 +83,7 @@
</view>
<view class="action-detail" v-if="item.detail.breed">
<view class="title">
{{item.type_text.slice(0, -2)}}品牌
{{item.type_text.slice(0, -2)}}<text class="" v-if="item.type==2||item.type==4"></text>品牌
</view>
<view class="detail">
{{item.detail.breed}}
@ -91,7 +91,7 @@
</view>
<view class="action-detail">
<view class="title">
{{item.type_text.slice(0, -2)}}用量
{{item.type_text.slice(0, -2)}}<text class="" v-if="item.type==2||item.type==4"></text>用量
</view>
<view class="detail">
{{item.detail.dosage}}<text v-if='item.type==4'></text>
@ -100,7 +100,7 @@
</view>
<view class="action-detail">
<view class="title">
{{item.type_text.slice(0, -2)}}
参与
</view>
<view class="detail">
{{item.detail.user}}
@ -136,7 +136,7 @@
</view>
<view class="action-detail">
<view class="title">
灌溉
参与
</view>
<view class="detail">
{{item.detail.user}}
@ -165,7 +165,7 @@
<view class="action-detail">
<view class="title">
收获
参与
</view>
<view class="detail">
{{item.detail.user}}

View File

@ -39,7 +39,7 @@
<view class="right">
<view class="" v-if="item.type==5">
<view class="">
参与人: {{item.detail.user}}
参与人: {{item.detail.user}}
</view>
<view class="">
备注: {{item.detail.remark}}
@ -48,16 +48,16 @@
<view class="" v-else>
<view class="" v-if="!item.detail.type">
<view class="">
{{item.type_text.slice(0, -2)}}种类: {{item.detail.kind}}
{{item.type_text.slice(0, -2)}}<text class="" v-if="item.type==2||item.type==4"></text>种类: {{item.detail.kind}}
</view>
<view class="">
{{item.type_text.slice(0, -2)}}品牌: {{item.detail.breed}}
{{item.type_text.slice(0, -2)}}<text class="" v-if="item.type==2||item.type==4"></text>品牌: {{item.detail.breed}}
</view>
<view class="" v-if='item.detail.dosage'>
{{item.type_text.slice(0, -2)}}用量: {{item.detail.dosage}}
{{item.type_text.slice(0, -2)}}<text class="" v-if="item.type==2||item.type==4"></text>用量: {{item.detail.dosage}}
<text v-if='item.type==4'></text>
<text v-if='item.type!=4&&item.type!=5'></text>
@ -72,7 +72,7 @@
{{item.type_text.slice(0, -2)}}方式: {{item.detail.type==1?"喷灌":item.detail.type==2?"滴灌":"沟灌"}}
</view>
<view class="">
参与人: {{item.detail.user}}
参与人: {{item.detail.user}}
</view>
<view class="" v-if="item.detail.start_date">