diff --git a/components/plant/landInfo.vue b/components/plant/landInfo.vue index 10ef578..1458f90 100644 --- a/components/plant/landInfo.vue +++ b/components/plant/landInfo.vue @@ -13,7 +13,11 @@ --> - + + + 当前种植: {{info.kindarea}}亩 + + 当前种植: {{info.total_area-info.residual_area}}亩 + + @@ -120,11 +124,16 @@ const calendar1 = ref(null) const form = ref(null) const task_id = ref(''); + const value1 = ref(Date.now()); + const show1 = ref(false); + const show2 = ref(false); const openDate = () => { - calendar.value.open() + // calendar.value.open() + show1.value = true } const openDate1 = () => { - calendar1.value.open() + // calendar1.value.open() + show2.value = true } // console.log() const formData = reactive({ @@ -136,14 +145,26 @@ end_date: "", }) - +const formatter = (type, value) => { + if (type === 'year') { + return `${value}年`; + } + if (type === 'month') { + return `${value}月`; + } + if (type === 'day') { + return `${value}日`; + } + return value; +}; +//获取时间 const dateConfirmfn = (e) => { - console.log(e) - formData.start_date = e.fulldate + formData.start_date = uni.$u.timeFormat(e.value, 'yyyy-mm-dd hh:MM ') + show1.value = false } const dateConfirmfn1 = (e) => { - console.log(e) - formData.end_date = e.fulldate + formData.end_date = uni.$u.timeFormat(e.value, 'yyyy-mm-dd hh:MM ') + show2.value = false } const rules = ref({ 'kind': { @@ -288,9 +309,13 @@ // uni.$u.toast('校验成功') } + }).catch((err)=>{ + uni.$u.toast(err[0].message) + console.log(err) }) + } diff --git a/pages/husbandryForm/fertilize.vue b/pages/husbandryForm/fertilize.vue index 25aeeb9..e8f1673 100644 --- a/pages/husbandryForm/fertilize.vue +++ b/pages/husbandryForm/fertilize.vue @@ -18,22 +18,22 @@ - + - + - + - + @@ -57,7 +57,8 @@ - + @@ -82,9 +83,14 @@ - + + + + @@ -122,11 +128,16 @@ const calendar1 = ref(null) const form = ref(null) const task_id = ref(''); + const value1 = ref(Date.now()); + const show1 = ref(false); + const show2 = ref(false); const openDate = () => { - calendar.value.open() + // calendar.value.open() + show1.value = true } const openDate1 = () => { - calendar1.value.open() + // calendar1.value.open() + show2.value = true } // console.log() const formData = reactive({ @@ -140,12 +151,12 @@ const dateConfirmfn = (e) => { - - formData.start_date = e.fulldate + formData.start_date = uni.$u.timeFormat(e.value, 'yyyy-mm-dd hh:MM ') + show1.value = false } const dateConfirmfn1 = (e) => { - - formData.end_date = e.fulldate + formData.end_date = uni.$u.timeFormat(e.value, 'yyyy-mm-dd hh:MM ') + show2.value = false } const rules = ref({ 'kind': { @@ -201,6 +212,18 @@ form.value.setRules(rules); }); + const formatter = (type, value) => { + if (type === 'year') { + return `${value}年`; + } + if (type === 'month') { + return `${value}月`; + } + if (type === 'day') { + return `${value}日`; + } + return value; + }; //图片上传 const updateImgFn = async () => { @@ -246,12 +269,9 @@ const addFn = () => { form.value.validate().then(res => { - console.log(res) + // console.log(res) if (res) { - - - formData.pic = pic let data1 = { @@ -292,12 +312,16 @@ // uni.$u.toast('校验成功') } + }).catch((err)=>{ + uni.$u.toast(err[0].message) + console.log(err) }) + } //查看图片 - const perviewFn = (url) => { + const perviewFn = (url) => { uni.previewImage({ urls: [url] }) diff --git a/pages/husbandryForm/harvest.vue b/pages/husbandryForm/harvest.vue index bf9680e..093f10b 100644 --- a/pages/husbandryForm/harvest.vue +++ b/pages/husbandryForm/harvest.vue @@ -154,9 +154,13 @@ // uni.$u.toast('校验成功') } + }).catch((err)=>{ + uni.$u.toast(err[0].message) + console.log(err) }) + } //查看图片 const perviewFn = (url) => { diff --git a/pages/husbandryForm/irrigate.vue b/pages/husbandryForm/irrigate.vue index ca119d9..1935093 100644 --- a/pages/husbandryForm/irrigate.vue +++ b/pages/husbandryForm/irrigate.vue @@ -75,9 +75,13 @@ - + + + @@ -116,15 +120,15 @@ addaction } from '@/api/api.js' const range = reactive([{ - value: 0, + value: 1, name: "喷灌" }, { - value: 1, + value: 2, name: "滴灌" }, { - value: 2, + value: 3, name: "沟灌" }, ]) @@ -135,12 +139,29 @@ const formDatatype = ref('') const showgg = ref(false) const form = ref(null) + const value1 = ref(Date.now()); + const show1 = ref(false); + const show2 = ref(false); const openDate = () => { - calendar.value.open() + // calendar.value.open() + show1.value = true } const openDate1 = () => { - calendar1.value.open() + // calendar1.value.open() + show2.value = true } + const formatter = (type, value) => { + if (type === 'year') { + return `${value}年`; + } + if (type === 'month') { + return `${value}月`; + } + if (type === 'day') { + return `${value}日`; + } + return value; + }; // console.log() const formData = reactive({ type: "", @@ -162,11 +183,12 @@ //获取时间 const dateConfirmfn = (e) => { - formData.start_date = e.fulldate + formData.start_date = uni.$u.timeFormat(e.value, 'yyyy-mm-dd hh:MM ') + show1.value = false } const dateConfirmfn1 = (e) => { - - formData.end_date = e.fulldate + formData.end_date = uni.$u.timeFormat(e.value, 'yyyy-mm-dd hh:MM ') + show2.value = false } const rules = { 'type': { @@ -216,9 +238,8 @@ }) } const addFn = () => { - console.log(formData) + // console.log(formData) form.value.validate().then(res => { - if (res) { formData.pic = pic let data1 = { @@ -256,7 +277,9 @@ }) // uni.$u.toast('校验成功') } - + }).catch((err)=>{ + uni.$u.toast(err[0].message) + console.log(err) }) diff --git a/pages/husbandryForm/sow.vue b/pages/husbandryForm/sow.vue index 2d395bc..26075c1 100644 --- a/pages/husbandryForm/sow.vue +++ b/pages/husbandryForm/sow.vue @@ -12,8 +12,8 @@ v-model="data.formData.breed"> - + @@ -21,7 +21,7 @@ v-model="data.formData.area"> - @@ -33,9 +33,10 @@ style="display: flex;flex-direction: row;flex-wrap: wrap;margin-bottom: 30rpx;"> - - + + @@ -54,14 +55,17 @@ - + - + + + @@ -101,6 +105,8 @@ const form1 = ref(null); const task_id = ref(''); const pic = reactive([]); + const value1 = ref(Date.now()); + const show = ref(false); const data = reactive({ formData: { @@ -143,7 +149,7 @@ message: '请填写开始日期', trigger: ['blur', 'change'] }] - + } }) @@ -154,16 +160,25 @@ }); const openDate = () => { - calendar.value.open() + // calendar.value.open() + show.value = true } - +const formatter = (type, value) => { + if (type === 'year') { + return `${value}年`; + } + if (type === 'month') { + return `${value}月`; + } + if (type === 'day') { + return `${value}日`; + } + return value; +}; const dateConfirmfn = (e) => { - - data.formData.date = e.fulldate - - - + data.formData.date = uni.$u.timeFormat(e.value, 'yyyy-mm-dd hh:MM ') + show.value = false } //图片删除 @@ -198,14 +213,14 @@ return } data.formData.pic = JSON.stringify(pic) - + // 表单验证通过,执行提交操作 addplant(data.formData).then((res) => { - + if (res.code == 1) { - + uni.navigateBack({ - delta:1 + delta: 1 }) uni.$u.toast(res.msg) } @@ -229,7 +244,7 @@ // console.log() } -//图片上传 + //图片上传 const updateImgFn = async () => { uni.chooseImage({ @@ -240,9 +255,9 @@ Uploads(res.tempFilePaths[0], 'img').then(res => { console.log(res) if (res.code == 1) { - + pic.push(res.data.url) - + console.log(pic) uni.$u.toast('上传成功') diff --git a/pages/husbandryForm/weeding.vue b/pages/husbandryForm/weeding.vue index dca355e..f7b79f8 100644 --- a/pages/husbandryForm/weeding.vue +++ b/pages/husbandryForm/weeding.vue @@ -81,9 +81,13 @@ - + + + @@ -121,12 +125,29 @@ const calendar1 = ref(null) const form = ref(null) const task_id = ref(''); +const value1 = ref(Date.now()); + const show1 = ref(false); + const show2 = ref(false); const openDate = () => { - calendar.value.open() + // calendar.value.open() + show1.value = true } const openDate1 = () => { - calendar1.value.open() + // calendar1.value.open() + show2.value = true } + const formatter = (type, value) => { + if (type === 'year') { + return `${value}年`; + } + if (type === 'month') { + return `${value}月`; + } + if (type === 'day') { + return `${value}日`; + } + return value; + }; // console.log() const formData = reactive({ kind: "", @@ -138,13 +159,14 @@ }) + //获取时间 const dateConfirmfn = (e) => { - console.log(e) - formData.start_date = e.fulldate + formData.start_date = uni.$u.timeFormat(e.value, 'yyyy-mm-dd hh:MM ') + show1.value = false } const dateConfirmfn1 = (e) => { - console.log(e) - formData.end_date = e.fulldate + formData.end_date = uni.$u.timeFormat(e.value, 'yyyy-mm-dd hh:MM ') + show2.value = false } const rules = ref({ 'kind': { @@ -293,9 +315,13 @@ // uni.$u.toast('校验成功') } + }).catch((err)=>{ + uni.$u.toast(err[0].message) + console.log(err) }) + } diff --git a/pages/landDetail/results.vue b/pages/landDetail/results.vue index 0ac1d3c..e9b1280 100644 --- a/pages/landDetail/results.vue +++ b/pages/landDetail/results.vue @@ -18,14 +18,22 @@ {{dataobj.kind}} - - - 生产地址: - - - {{dataobj.land_address}} - + + + 种植日期: + + {{dataobj.plant_date}} + + + + + 收获日期: + + + {{dataobj.harvest_date}} + + 生长期: @@ -34,9 +42,28 @@ - {{ daysDiff }}天 + {{ dataobj.group_day }}天 + + + 负责人: + + + + + {{ dataobj.user}} + + + + + 生产地址: + + + {{dataobj.land_address}} + + + @@ -60,7 +87,7 @@ {{item.detail.dosage}} - + @@ -87,7 +114,7 @@ 灌溉方式: - {{item.detail.type==0?"喷灌":item.detail.type==1?"滴灌":"沟灌"}} + {{item.detail.type==1?"喷灌":item.detail.type==2?"滴灌":"沟灌"}} @@ -121,7 +148,7 @@ 收获时间: - {{item.create_time}} + {{dataobj.harvest_date}} @@ -176,7 +203,7 @@ //获取详情 const getlist1 = (id) => { suYuan({ - plant_id: 5 + plant_id:id }).then((res) => { if (res.code == 1) { diff --git a/pages/landDetail/tudi.vue b/pages/landDetail/tudi.vue index ef43bbd..123181a 100644 --- a/pages/landDetail/tudi.vue +++ b/pages/landDetail/tudi.vue @@ -62,7 +62,7 @@ - {{item.type_text.slice(0, -2)}}方式:{{item.detail.type==0?"喷灌":item.detail.type==1?"滴灌":"沟灌"}} + {{item.type_text.slice(0, -2)}}方式:{{item.detail.type==1?"喷灌":item.detail.type==2?"滴灌":"沟灌"}} 参与人员: {{item.detail.user}} @@ -192,7 +192,7 @@ getlist2(); }) - const getlist1 = (id, a, b) => { + const getlist1 = (id, a, b,c) => { landdetail({ land_id: id }).then((res) => { @@ -200,6 +200,7 @@ if (res.code == 1) { res.data.kind = a res.data.datapic = b + res.data.kindarea= c Object.assign(dataobj, res.data); @@ -211,7 +212,7 @@ plant_id: typeID.value }).then((res) => { if (res.code == 1) { - getlist1(res.data.land_id, res.data.kind, res.data.pic) + getlist1(res.data.land_id, res.data.kind, res.data.pic,res.data.area) } }); };