|
|
|
@ -4,42 +4,38 @@ |
|
|
|
|
<uni-forms :modelValue="formData" ref="formRef" :label-width="80" border :rules="formRules"> |
|
|
|
|
<view class="v-form-item"> |
|
|
|
|
<uni-forms-item label="认证类型" name="authenticationType" required> |
|
|
|
|
<uni-data-picker class="m-data-pick" popupTitle=" " v-model="formData.authenticationType" :localdata="authenticationList" @change="getCustomChange"></uni-data-picker> |
|
|
|
|
<uni-data-picker class="m-data-pick" popupTitle=" " v-model="formData.authenticationType" |
|
|
|
|
:localdata="authenticationList" @change="getCustomChange"></uni-data-picker> |
|
|
|
|
</uni-forms-item> |
|
|
|
|
<uni-forms-item label="认证图片" name="authenticationPic"> |
|
|
|
|
<htz-image-upload |
|
|
|
|
class="m-img-upload" |
|
|
|
|
:max="1" |
|
|
|
|
v-model="imgList" |
|
|
|
|
mediaType="image" |
|
|
|
|
:chooseNum="1" |
|
|
|
|
:sourceType="['album', 'camera']" |
|
|
|
|
:compress="false" |
|
|
|
|
:quality="80" |
|
|
|
|
:remove="true" |
|
|
|
|
:headers="headers" |
|
|
|
|
@uploadSuccess="ceshiUploadSuccess1" |
|
|
|
|
@imgDelete="ceshiImgDelete" |
|
|
|
|
@uploadFail="ceshiUploadFail" |
|
|
|
|
:action="baseUrls" |
|
|
|
|
></htz-image-upload> |
|
|
|
|
<htz-image-upload class="m-img-upload" :max="1" v-model="imgList" mediaType="image" |
|
|
|
|
:chooseNum="1" :sourceType="['album', 'camera']" :compress="false" :quality="80" |
|
|
|
|
:remove="true" :headers="headers" @uploadSuccess="ceshiUploadSuccess1" |
|
|
|
|
@imgDelete="ceshiImgDelete" @uploadFail="ceshiUploadFail" |
|
|
|
|
:action="baseUrls"></htz-image-upload> |
|
|
|
|
<uni-easyinput class="not-show" v-model="formData.authenticationPic" placeholder=" " /> |
|
|
|
|
</uni-forms-item> |
|
|
|
|
</view> |
|
|
|
|
<view class="v-form-item"> |
|
|
|
|
<uni-forms-item label="种植方式" name="plantingWay" required> |
|
|
|
|
<uni-data-picker class="m-data-pick" popupTitle=" " v-model="formData.plantingWay" :localdata="plantingWayList" @change="getCustomChange"></uni-data-picker> |
|
|
|
|
<uni-data-picker class="m-data-pick" popupTitle=" " v-model="formData.plantingWay" |
|
|
|
|
:localdata="plantingWayList" @change="getCustomChange"></uni-data-picker> |
|
|
|
|
</uni-forms-item> |
|
|
|
|
<uni-forms-item label="作业方式" name="jobWay" required> |
|
|
|
|
<uni-data-picker class="m-data-pick" popupTitle=" " v-model="formData.jobWay" :localdata="operationWayList" @change="getCustomChange"></uni-data-picker> |
|
|
|
|
<uni-data-picker class="m-data-pick" popupTitle=" " v-model="formData.jobWay" |
|
|
|
|
:localdata="operationWayList" @change="getCustomChange"></uni-data-picker> |
|
|
|
|
</uni-forms-item> |
|
|
|
|
<uni-forms-item customClass="custom-content" label="种植时间" name="plantingTime" required> |
|
|
|
|
<uni-datetime-picker :clear-icon="false" type="date" returnType="timestamp" v-model="formData.plantingTime" @change="changeLog($event)" /> |
|
|
|
|
<uni-datetime-picker :clear-icon="false" type="date" returnType="timestamp" |
|
|
|
|
v-model="formData.plantingTime" @change="changeLog($event)" /> |
|
|
|
|
</uni-forms-item> |
|
|
|
|
<uni-forms-item label="种植面积" name="plantingArea" required> |
|
|
|
|
<input class="cnstom-input" type="text" disabled="true" @input="checkArea" v-if="formData.blockName == undefined" placeholder="请先选择地块" /> |
|
|
|
|
<uni-easyinput v-if="formData.blockName != undefined" :styles="styles" type="digit" class="uni-mt-5 m-cj" v-model="formData.plantingArea" @blur="checkArea1(1)"> |
|
|
|
|
<template slot="right" class="m-kg" :class="formData.plantingArea == undefined || formData.plantingArea == '' ? 'no-mar' : ''">亩</template> |
|
|
|
|
<input class="cnstom-input" type="text" disabled="true" @input="checkArea" |
|
|
|
|
v-if="formData.blockName == undefined" placeholder="请先选择地块" /> |
|
|
|
|
<uni-easyinput v-if="formData.blockName != undefined" :styles="styles" type="digit" |
|
|
|
|
class="uni-mt-5 m-cj" v-model="formData.plantingArea" @blur="checkArea1(1)"> |
|
|
|
|
<template slot="right" class="m-kg" |
|
|
|
|
:class="formData.plantingArea == undefined || formData.plantingArea == '' ? 'no-mar' : ''">亩</template> |
|
|
|
|
</uni-easyinput> |
|
|
|
|
<spna v-if="formData.blockName != undefined" class="m-notice"> |
|
|
|
|
可种植面积 |
|
|
|
@ -59,17 +55,13 @@ |
|
|
|
|
<view class="v-form-item"> |
|
|
|
|
<uni-forms-item label="种植地块" name="blockName" required> |
|
|
|
|
<view v-if="formData.choose == true" @click.stop="goSearch"> |
|
|
|
|
<uni-easyinput |
|
|
|
|
class="uni-mt-5 m-padding-rigt" |
|
|
|
|
:placeholderStyle="'color: grey;font-size: 24rpx;'" |
|
|
|
|
:disabled="true" |
|
|
|
|
suffixIcon="right" |
|
|
|
|
placeholder="请选择地块" |
|
|
|
|
v-model="formData.blockName" |
|
|
|
|
></uni-easyinput> |
|
|
|
|
<uni-easyinput class="uni-mt-5 m-padding-rigt" |
|
|
|
|
:placeholderStyle="'color: grey;font-size: 24rpx;'" :disabled="true" suffixIcon="right" |
|
|
|
|
placeholder="请选择地块" v-model="formData.blockName"></uni-easyinput> |
|
|
|
|
</view> |
|
|
|
|
<view v-else> |
|
|
|
|
<uni-easyinput class="uni-mt-5 m-padding-rigt" :disabled="true" suffixIcon="right" v-model="formData.blockName" placeholder=""></uni-easyinput> |
|
|
|
|
<uni-easyinput class="uni-mt-5 m-padding-rigt" :disabled="true" suffixIcon="right" |
|
|
|
|
v-model="formData.blockName" placeholder=""></uni-easyinput> |
|
|
|
|
</view> |
|
|
|
|
</uni-forms-item> |
|
|
|
|
</view> |
|
|
|
@ -80,11 +72,14 @@ |
|
|
|
|
</view> |
|
|
|
|
<view class="v-form-item"> |
|
|
|
|
<uni-forms-item customClass="custom-content" label-width="120px" label="预计采收时间" name="harvestTime"> |
|
|
|
|
<uni-datetime-picker :clear-icon="false" type="date" returnType="timestamp" v-model="formData.harvestTime" @change="changeLog($event)" /> |
|
|
|
|
<uni-datetime-picker :clear-icon="false" type="date" returnType="timestamp" |
|
|
|
|
v-model="formData.harvestTime" @change="changeLog($event)" /> |
|
|
|
|
</uni-forms-item> |
|
|
|
|
<uni-forms-item label="预计亩产" name="production"> |
|
|
|
|
<uni-easyinput class="m-cj" :styles="styles" @blur="checkArea1(2)" type="digit" v-model="formData.production" placeholder="请输入预计亩产量"> |
|
|
|
|
<template slot="right" class="m-kg" :class="formData.production == undefined || formData.production == '' ? 'no-mar' : ''">公斤</template> |
|
|
|
|
<uni-easyinput class="m-cj" :styles="styles" @blur="checkArea1(2)" type="digit" |
|
|
|
|
v-model="formData.production" placeholder="请输入预计亩产量"> |
|
|
|
|
<template slot="right" class="m-kg" |
|
|
|
|
:class="formData.production == undefined || formData.production == '' ? 'no-mar' : ''">公斤</template> |
|
|
|
|
</uni-easyinput> |
|
|
|
|
</uni-forms-item> |
|
|
|
|
</view> |
|
|
|
@ -97,394 +92,310 @@ |
|
|
|
|
</template> |
|
|
|
|
|
|
|
|
|
<script> |
|
|
|
|
import mix from '@/utils/mix.js'; |
|
|
|
|
import { getDictDatas, DICT_TYPE } from '@/utils/dict'; |
|
|
|
|
import { getAccessToken } from '@/utils/auth'; |
|
|
|
|
import config from '@/config'; |
|
|
|
|
import htzImageUpload from '@/components/htz-image-upload/htz-image-upload.vue'; |
|
|
|
|
import { createCropper } from '@/api/system/addCrop/addCrop.js'; |
|
|
|
|
export default { |
|
|
|
|
components: { |
|
|
|
|
htzImageUpload |
|
|
|
|
}, |
|
|
|
|
data() { |
|
|
|
|
return { |
|
|
|
|
authenticationList: [], //认证类型 |
|
|
|
|
plantingWayList: [], //种植方式 |
|
|
|
|
operationWayList: [], //作业方式 |
|
|
|
|
showBlock: true, |
|
|
|
|
styles: { |
|
|
|
|
color: '#666' |
|
|
|
|
}, |
|
|
|
|
formData: { |
|
|
|
|
id: undefined, |
|
|
|
|
blockId: undefined, |
|
|
|
|
productId: undefined, |
|
|
|
|
speciesId: undefined, |
|
|
|
|
authenticationType: undefined, |
|
|
|
|
authenticationPic: undefined, |
|
|
|
|
plantingWay: undefined, |
|
|
|
|
jobWay: undefined, |
|
|
|
|
plantingTime: undefined, |
|
|
|
|
plantingArea: undefined, |
|
|
|
|
harvestTime: undefined, |
|
|
|
|
production: 0, |
|
|
|
|
import mix from '@/utils/mix.js'; |
|
|
|
|
import { |
|
|
|
|
getDictDatas, |
|
|
|
|
DICT_TYPE |
|
|
|
|
} from '@/utils/dict'; |
|
|
|
|
import { |
|
|
|
|
getAccessToken |
|
|
|
|
} from '@/utils/auth'; |
|
|
|
|
import config from '@/config'; |
|
|
|
|
import htzImageUpload from '@/components/htz-image-upload/htz-image-upload.vue'; |
|
|
|
|
import { |
|
|
|
|
createCropper |
|
|
|
|
} from '@/api/system/addCrop/addCrop.js'; |
|
|
|
|
export default { |
|
|
|
|
components: { |
|
|
|
|
htzImageUpload |
|
|
|
|
}, |
|
|
|
|
data() { |
|
|
|
|
return { |
|
|
|
|
authenticationList: [], //认证类型 |
|
|
|
|
plantingWayList: [], //种植方式 |
|
|
|
|
operationWayList: [], //作业方式 |
|
|
|
|
showBlock: true, |
|
|
|
|
styles: { |
|
|
|
|
color: '#666' |
|
|
|
|
}, |
|
|
|
|
formData: { |
|
|
|
|
id: undefined, |
|
|
|
|
blockId: undefined, |
|
|
|
|
productId: undefined, |
|
|
|
|
speciesId: undefined, |
|
|
|
|
authenticationType: undefined, |
|
|
|
|
authenticationPic: undefined, |
|
|
|
|
plantingWay: undefined, |
|
|
|
|
jobWay: undefined, |
|
|
|
|
plantingTime: undefined, |
|
|
|
|
plantingArea: undefined, |
|
|
|
|
harvestTime: undefined, |
|
|
|
|
production: 0, |
|
|
|
|
|
|
|
|
|
blockArea: undefined, |
|
|
|
|
blockName: undefined, |
|
|
|
|
choose: true |
|
|
|
|
}, |
|
|
|
|
// 表单校验 |
|
|
|
|
formRules: { |
|
|
|
|
blockName: { |
|
|
|
|
rules: [ |
|
|
|
|
{ |
|
|
|
|
blockArea: undefined, |
|
|
|
|
blockName: undefined, |
|
|
|
|
choose: true |
|
|
|
|
}, |
|
|
|
|
// 表单校验 |
|
|
|
|
formRules: { |
|
|
|
|
blockName: { |
|
|
|
|
rules: [{ |
|
|
|
|
required: true, |
|
|
|
|
errorMessage: '请选择种植地块' |
|
|
|
|
} |
|
|
|
|
] |
|
|
|
|
}, |
|
|
|
|
productId: { |
|
|
|
|
rules: [ |
|
|
|
|
{ |
|
|
|
|
}] |
|
|
|
|
}, |
|
|
|
|
productId: { |
|
|
|
|
rules: [{ |
|
|
|
|
required: true, |
|
|
|
|
errorMessage: '请选择产品名称' |
|
|
|
|
} |
|
|
|
|
] |
|
|
|
|
}, |
|
|
|
|
speciesId: { |
|
|
|
|
rules: [ |
|
|
|
|
{ |
|
|
|
|
}] |
|
|
|
|
}, |
|
|
|
|
speciesId: { |
|
|
|
|
rules: [{ |
|
|
|
|
required: true, |
|
|
|
|
errorMessage: '请选择产品品种' |
|
|
|
|
} |
|
|
|
|
] |
|
|
|
|
}, |
|
|
|
|
authenticationType: { |
|
|
|
|
rules: [ |
|
|
|
|
{ |
|
|
|
|
}] |
|
|
|
|
}, |
|
|
|
|
authenticationType: { |
|
|
|
|
rules: [{ |
|
|
|
|
required: true, |
|
|
|
|
errorMessage: '请选择认证类型' |
|
|
|
|
} |
|
|
|
|
] |
|
|
|
|
}, |
|
|
|
|
plantingWay: { |
|
|
|
|
rules: [ |
|
|
|
|
{ |
|
|
|
|
}] |
|
|
|
|
}, |
|
|
|
|
plantingWay: { |
|
|
|
|
rules: [{ |
|
|
|
|
required: true, |
|
|
|
|
errorMessage: '请选择种植方式' |
|
|
|
|
} |
|
|
|
|
] |
|
|
|
|
}, |
|
|
|
|
jobWay: { |
|
|
|
|
rules: [ |
|
|
|
|
{ |
|
|
|
|
}] |
|
|
|
|
}, |
|
|
|
|
jobWay: { |
|
|
|
|
rules: [{ |
|
|
|
|
required: true, |
|
|
|
|
errorMessage: '请选择作业方式' |
|
|
|
|
} |
|
|
|
|
] |
|
|
|
|
}, |
|
|
|
|
plantingTime: { |
|
|
|
|
rules: [ |
|
|
|
|
{ |
|
|
|
|
}] |
|
|
|
|
}, |
|
|
|
|
plantingTime: { |
|
|
|
|
rules: [{ |
|
|
|
|
required: true, |
|
|
|
|
errorMessage: '请选择种植时间' |
|
|
|
|
} |
|
|
|
|
] |
|
|
|
|
}, |
|
|
|
|
plantingArea: { |
|
|
|
|
rules: [ |
|
|
|
|
{ |
|
|
|
|
required: true, |
|
|
|
|
errorMessage: '请输入种植面积' |
|
|
|
|
} |
|
|
|
|
// { |
|
|
|
|
// pattern: /^[+-]?(0|([1-9]\d*))(\.\d+)?$/, |
|
|
|
|
// errorMessage: '请输入正确的种植面积', |
|
|
|
|
// trigger: 'blur' |
|
|
|
|
// } |
|
|
|
|
] |
|
|
|
|
}] |
|
|
|
|
}, |
|
|
|
|
plantingArea: { |
|
|
|
|
rules: [{ |
|
|
|
|
required: true, |
|
|
|
|
errorMessage: '请输入种植面积' |
|
|
|
|
} |
|
|
|
|
// { |
|
|
|
|
// pattern: /^[+-]?(0|([1-9]\d*))(\.\d+)?$/, |
|
|
|
|
// errorMessage: '请输入正确的种植面积', |
|
|
|
|
// trigger: 'blur' |
|
|
|
|
// } |
|
|
|
|
] |
|
|
|
|
}, |
|
|
|
|
production: { |
|
|
|
|
rules: [ |
|
|
|
|
// { |
|
|
|
|
// pattern: /^[+-]?(0|([1-9]\d*))(\.\d+)?$/, |
|
|
|
|
// errorMessage: '请输入正确的预计亩产', |
|
|
|
|
// trigger: 'blur' |
|
|
|
|
// } |
|
|
|
|
] |
|
|
|
|
} |
|
|
|
|
}, |
|
|
|
|
production: { |
|
|
|
|
rules: [ |
|
|
|
|
// { |
|
|
|
|
// pattern: /^[+-]?(0|([1-9]\d*))(\.\d+)?$/, |
|
|
|
|
// errorMessage: '请输入正确的预计亩产', |
|
|
|
|
// trigger: 'blur' |
|
|
|
|
// } |
|
|
|
|
] |
|
|
|
|
} |
|
|
|
|
}, |
|
|
|
|
baseUrls: config.baseUrl + config.baseApi + '/infra/file/upload', |
|
|
|
|
headers: { Authorization: 'Bearer ' + getAccessToken() }, // 设置上传的请求头部 |
|
|
|
|
imgList: [] |
|
|
|
|
}; |
|
|
|
|
}, |
|
|
|
|
mixins: [mix], |
|
|
|
|
computed: { |
|
|
|
|
formDatas() { |
|
|
|
|
return this.$store.state.formData; // 从Vuex中获取表单数据 |
|
|
|
|
} |
|
|
|
|
}, |
|
|
|
|
onLoad(options) { |
|
|
|
|
if (options.params) { |
|
|
|
|
this.formData = JSON.parse(options.params); |
|
|
|
|
const choo = this.formData.choose; |
|
|
|
|
console.log(choo, ';;;;;'); |
|
|
|
|
if (choo == undefined) { |
|
|
|
|
this.formData.choose = true; |
|
|
|
|
} else { |
|
|
|
|
this.formData.choose = choo; |
|
|
|
|
} |
|
|
|
|
console.log(this.formData); |
|
|
|
|
if (this.formData.authenticationPic != undefined) { |
|
|
|
|
this.imgList = []; |
|
|
|
|
this.imgList.push(this.formData.authenticationPic); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
}, |
|
|
|
|
onReady() { |
|
|
|
|
// 设置自定义表单校验规则,必须在节点渲染完毕后执行 |
|
|
|
|
this.$refs.formRef.setRules(this.formRules); |
|
|
|
|
}, |
|
|
|
|
onShow() { |
|
|
|
|
if (this.formDatas) { |
|
|
|
|
// 使用formData更新页面状态或执行其他操作 |
|
|
|
|
console.log('this.formDatas', this.formDatas); |
|
|
|
|
this.formData = this.formDatas; |
|
|
|
|
const choo = this.formData.choose; |
|
|
|
|
console.log(choo, ';;;;;'); |
|
|
|
|
if (choo == undefined) { |
|
|
|
|
this.formData.choose = true; |
|
|
|
|
} else { |
|
|
|
|
this.formData.choose = choo; |
|
|
|
|
} |
|
|
|
|
if (this.formData.authenticationPic != undefined) { |
|
|
|
|
this.imgList = []; |
|
|
|
|
this.imgList.push(this.formData.authenticationPic); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
//认证类型 数据字典查询 |
|
|
|
|
let arr = this.getDictDatas(DICT_TYPE.AUTHENTICATION_TYPE); |
|
|
|
|
arr.forEach((item) => { |
|
|
|
|
item.text = item.label; |
|
|
|
|
}); |
|
|
|
|
this.authenticationList = arr; |
|
|
|
|
//种植方式 PLANTING_WAY |
|
|
|
|
let arr1 = this.getDictDatas(DICT_TYPE.PLANTING_WAY); |
|
|
|
|
arr1.forEach((item) => { |
|
|
|
|
item.text = item.label; |
|
|
|
|
}); |
|
|
|
|
this.plantingWayList = arr1; |
|
|
|
|
//作业方式 OPERATION_WAY |
|
|
|
|
let arr2 = this.getDictDatas(DICT_TYPE.OPERATION_WAY); |
|
|
|
|
arr2.forEach((item) => { |
|
|
|
|
item.text = item.label; |
|
|
|
|
}); |
|
|
|
|
this.operationWayList = arr2; |
|
|
|
|
}, |
|
|
|
|
onUnload() { |
|
|
|
|
this.$store.commit('updateFormData', null); |
|
|
|
|
}, |
|
|
|
|
methods: { |
|
|
|
|
getCustomChange() { |
|
|
|
|
console.log(this.formData); |
|
|
|
|
baseUrls: config.baseUrl + config.baseApi + '/infra/file/upload', |
|
|
|
|
headers: { |
|
|
|
|
Authorization: 'Bearer ' + getAccessToken() |
|
|
|
|
}, // 设置上传的请求头部 |
|
|
|
|
imgList: [] |
|
|
|
|
}; |
|
|
|
|
}, |
|
|
|
|
ceshiUploadSuccess1(res) { |
|
|
|
|
//上传成功 |
|
|
|
|
var _res = JSON.parse(res.data); |
|
|
|
|
console.log('_res', _res); |
|
|
|
|
if (_res.code == 0) { |
|
|
|
|
this.imgList.push(_res.data); |
|
|
|
|
this.formData.authenticationPic = _res.data; |
|
|
|
|
mixins: [mix], |
|
|
|
|
computed: { |
|
|
|
|
formDatas() { |
|
|
|
|
return this.$store.state.formData; // 从Vuex中获取表单数据 |
|
|
|
|
} |
|
|
|
|
}, |
|
|
|
|
ceshiImgDelete(e) { |
|
|
|
|
console.log('ceshiImgDelete', e); |
|
|
|
|
}, |
|
|
|
|
ceshiUploadFail(err) { |
|
|
|
|
//上传失败 |
|
|
|
|
console.log('err', err); |
|
|
|
|
}, |
|
|
|
|
changeLog(e) { |
|
|
|
|
console.log('change事件:', e, this.formData); |
|
|
|
|
}, |
|
|
|
|
checkArea() { |
|
|
|
|
console.log(this.formData.plantingArea, this.formData.blockArea); |
|
|
|
|
if (this.formData.plantingArea != undefined && this.formData.blockArea != undefined) { |
|
|
|
|
if (this.formData.plantingArea > this.formData.blockArea) { |
|
|
|
|
uni.showToast({ |
|
|
|
|
icon: 'none', |
|
|
|
|
title: '警告:种植面积不可大于地块面积' |
|
|
|
|
}); |
|
|
|
|
this.showBlock = false; |
|
|
|
|
onLoad(options) { |
|
|
|
|
if (options.params) { |
|
|
|
|
this.formData = JSON.parse(options.params); |
|
|
|
|
const choo = this.formData.choose; |
|
|
|
|
console.log(choo, ';;;;;'); |
|
|
|
|
if (choo == undefined) { |
|
|
|
|
this.formData.choose = true; |
|
|
|
|
} else { |
|
|
|
|
this.showBlock = true; |
|
|
|
|
this.formData.choose = choo; |
|
|
|
|
} |
|
|
|
|
console.log(this.formData); |
|
|
|
|
if (this.formData.authenticationPic != undefined) { |
|
|
|
|
this.imgList = []; |
|
|
|
|
this.imgList.push(this.formData.authenticationPic); |
|
|
|
|
} |
|
|
|
|
} else { |
|
|
|
|
this.showBlock = true; |
|
|
|
|
} |
|
|
|
|
}, |
|
|
|
|
checkArea1(val) { |
|
|
|
|
console.log(this.formData.production) |
|
|
|
|
if (val == 1) { |
|
|
|
|
if(this.formData.plantingArea!=''){ |
|
|
|
|
this.formData.plantingArea = parseFloat(this.formData.plantingArea).toFixed(2); |
|
|
|
|
onReady() { |
|
|
|
|
// 设置自定义表单校验规则,必须在节点渲染完毕后执行 |
|
|
|
|
this.$refs.formRef.setRules(this.formRules); |
|
|
|
|
}, |
|
|
|
|
onShow() { |
|
|
|
|
if (this.formDatas) { |
|
|
|
|
// 使用formData更新页面状态或执行其他操作 |
|
|
|
|
console.log('this.formDatas', this.formDatas); |
|
|
|
|
this.formData = this.formDatas; |
|
|
|
|
const choo = this.formData.choose; |
|
|
|
|
console.log(choo, ';;;;;'); |
|
|
|
|
if (choo == undefined) { |
|
|
|
|
this.formData.choose = true; |
|
|
|
|
} else { |
|
|
|
|
this.formData.choose = choo; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
if (val == 2) { |
|
|
|
|
if(this.formData.production!=''){ |
|
|
|
|
this.formData.production = parseFloat(this.formData.production).toFixed(2); |
|
|
|
|
if (this.formData.authenticationPic != undefined) { |
|
|
|
|
this.imgList = []; |
|
|
|
|
this.imgList.push(this.formData.authenticationPic); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
}, |
|
|
|
|
goSearch() { |
|
|
|
|
const val = JSON.stringify(this.formData); |
|
|
|
|
uni.navigateTo({ |
|
|
|
|
url: '/sunPages/commonSearch/commonSearch?isBlock=1¶ms=' + val |
|
|
|
|
//认证类型 数据字典查询 |
|
|
|
|
let arr = this.getDictDatas(DICT_TYPE.AUTHENTICATION_TYPE); |
|
|
|
|
arr.forEach((item) => { |
|
|
|
|
item.text = item.label; |
|
|
|
|
}); |
|
|
|
|
this.authenticationList = arr; |
|
|
|
|
//种植方式 PLANTING_WAY |
|
|
|
|
let arr1 = this.getDictDatas(DICT_TYPE.PLANTING_WAY); |
|
|
|
|
arr1.forEach((item) => { |
|
|
|
|
item.text = item.label; |
|
|
|
|
}); |
|
|
|
|
this.plantingWayList = arr1; |
|
|
|
|
//作业方式 OPERATION_WAY |
|
|
|
|
let arr2 = this.getDictDatas(DICT_TYPE.OPERATION_WAY); |
|
|
|
|
arr2.forEach((item) => { |
|
|
|
|
item.text = item.label; |
|
|
|
|
}); |
|
|
|
|
this.operationWayList = arr2; |
|
|
|
|
}, |
|
|
|
|
reset() { |
|
|
|
|
this.showBlock = false; |
|
|
|
|
this.formData = { |
|
|
|
|
id: undefined, |
|
|
|
|
blockId: undefined, |
|
|
|
|
productId: undefined, |
|
|
|
|
speciesId: undefined, |
|
|
|
|
authenticationType: undefined, |
|
|
|
|
authenticationPic: undefined, |
|
|
|
|
plantingWay: undefined, |
|
|
|
|
jobWay: undefined, |
|
|
|
|
plantingTime: undefined, |
|
|
|
|
plantingArea: undefined, |
|
|
|
|
harvestTime: undefined, |
|
|
|
|
production: 0, |
|
|
|
|
|
|
|
|
|
blockArea: undefined, |
|
|
|
|
blockName: undefined, |
|
|
|
|
choose: true |
|
|
|
|
}; |
|
|
|
|
onUnload() { |
|
|
|
|
this.$store.commit('updateFormData', null); |
|
|
|
|
}, |
|
|
|
|
submitForm() { |
|
|
|
|
console.log(this.formData); |
|
|
|
|
let that = this; |
|
|
|
|
this.checkArea(); |
|
|
|
|
// 校验主表 |
|
|
|
|
if (this.showBlock == false) { |
|
|
|
|
// uni.showToast({ |
|
|
|
|
// icon: 'none', |
|
|
|
|
// title: '警告:种植面积不可大于地块面积' |
|
|
|
|
// }); |
|
|
|
|
return false; |
|
|
|
|
} |
|
|
|
|
this.$refs['formRef'] |
|
|
|
|
.validate() |
|
|
|
|
.then((res) => { |
|
|
|
|
console.log('success', res); |
|
|
|
|
createCropper(res) |
|
|
|
|
.then((res) => { |
|
|
|
|
uni.showToast({ |
|
|
|
|
title: `新增成功`, |
|
|
|
|
duration: 1500, |
|
|
|
|
success() { |
|
|
|
|
setTimeout(() => { |
|
|
|
|
that.reset(); |
|
|
|
|
uni.reLaunch({ |
|
|
|
|
url: '/pages/block/index' |
|
|
|
|
}); |
|
|
|
|
}, 1500); |
|
|
|
|
} |
|
|
|
|
}); |
|
|
|
|
}) |
|
|
|
|
.catch((err) => { |
|
|
|
|
console.log(err); |
|
|
|
|
methods: { |
|
|
|
|
getCustomChange() { |
|
|
|
|
console.log(this.formData); |
|
|
|
|
}, |
|
|
|
|
ceshiUploadSuccess1(res) { |
|
|
|
|
//上传成功 |
|
|
|
|
var _res = JSON.parse(res.data); |
|
|
|
|
console.log('_res', _res); |
|
|
|
|
if (_res.code == 0) { |
|
|
|
|
this.imgList.push(_res.data); |
|
|
|
|
this.formData.authenticationPic = _res.data; |
|
|
|
|
} |
|
|
|
|
}, |
|
|
|
|
ceshiImgDelete(e) { |
|
|
|
|
console.log('ceshiImgDelete', e); |
|
|
|
|
}, |
|
|
|
|
ceshiUploadFail(err) { |
|
|
|
|
//上传失败 |
|
|
|
|
console.log('err', err); |
|
|
|
|
}, |
|
|
|
|
changeLog(e) { |
|
|
|
|
console.log('change事件:', e, this.formData); |
|
|
|
|
}, |
|
|
|
|
checkArea() { |
|
|
|
|
console.log(this.formData.plantingArea, this.formData.blockArea); |
|
|
|
|
if (this.formData.plantingArea != undefined && this.formData.blockArea != undefined) { |
|
|
|
|
if (this.formData.plantingArea > this.formData.blockArea) { |
|
|
|
|
uni.showToast({ |
|
|
|
|
icon: 'none', |
|
|
|
|
title: '警告:种植面积不可大于地块面积' |
|
|
|
|
}); |
|
|
|
|
}) |
|
|
|
|
.catch((err) => { |
|
|
|
|
console.log('err', err); |
|
|
|
|
this.showBlock = false; |
|
|
|
|
} else { |
|
|
|
|
this.showBlock = true; |
|
|
|
|
} |
|
|
|
|
} else { |
|
|
|
|
this.showBlock = true; |
|
|
|
|
} |
|
|
|
|
}, |
|
|
|
|
checkArea1(val) { |
|
|
|
|
console.log(this.formData.production) |
|
|
|
|
if (val == 1) { |
|
|
|
|
if (this.formData.plantingArea != '') { |
|
|
|
|
this.formData.plantingArea = parseFloat(this.formData.plantingArea).toFixed(2); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
if (val == 2) { |
|
|
|
|
if (this.formData.production != '') { |
|
|
|
|
this.formData.production = parseFloat(this.formData.production).toFixed(2); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
}, |
|
|
|
|
goSearch() { |
|
|
|
|
const val = JSON.stringify(this.formData); |
|
|
|
|
uni.navigateTo({ |
|
|
|
|
url: '/sunPages/commonSearch/commonSearch?isBlock=1¶ms=' + val |
|
|
|
|
}); |
|
|
|
|
}, |
|
|
|
|
reset() { |
|
|
|
|
this.showBlock = false; |
|
|
|
|
this.formData = { |
|
|
|
|
id: undefined, |
|
|
|
|
blockId: undefined, |
|
|
|
|
productId: undefined, |
|
|
|
|
speciesId: undefined, |
|
|
|
|
authenticationType: undefined, |
|
|
|
|
authenticationPic: undefined, |
|
|
|
|
plantingWay: undefined, |
|
|
|
|
jobWay: undefined, |
|
|
|
|
plantingTime: undefined, |
|
|
|
|
plantingArea: undefined, |
|
|
|
|
harvestTime: undefined, |
|
|
|
|
production: 0, |
|
|
|
|
|
|
|
|
|
blockArea: undefined, |
|
|
|
|
blockName: undefined, |
|
|
|
|
choose: true |
|
|
|
|
}; |
|
|
|
|
}, |
|
|
|
|
submitForm() { |
|
|
|
|
console.log(this.formData); |
|
|
|
|
let that = this; |
|
|
|
|
this.checkArea(); |
|
|
|
|
// 校验主表 |
|
|
|
|
if (this.showBlock == false) { |
|
|
|
|
// uni.showToast({ |
|
|
|
|
// icon: 'none', |
|
|
|
|
// title: '警告:种植面积不可大于地块面积' |
|
|
|
|
// }); |
|
|
|
|
return false; |
|
|
|
|
} |
|
|
|
|
this.$refs['formRef'] |
|
|
|
|
.validate() |
|
|
|
|
.then((res) => { |
|
|
|
|
console.log('success', res); |
|
|
|
|
createCropper(res) |
|
|
|
|
.then((res) => { |
|
|
|
|
uni.showToast({ |
|
|
|
|
title: `新增成功`, |
|
|
|
|
duration: 1500, |
|
|
|
|
success() { |
|
|
|
|
setTimeout(() => { |
|
|
|
|
that.reset(); |
|
|
|
|
uni.reLaunch({ |
|
|
|
|
url: '/pages/block/index' |
|
|
|
|
}); |
|
|
|
|
}, 1500); |
|
|
|
|
} |
|
|
|
|
}); |
|
|
|
|
}) |
|
|
|
|
.catch((err) => { |
|
|
|
|
console.log(err); |
|
|
|
|
}); |
|
|
|
|
}) |
|
|
|
|
.catch((err) => { |
|
|
|
|
console.log('err', err); |
|
|
|
|
}); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
}; |
|
|
|
|
}; |
|
|
|
|
</script> |
|
|
|
|
<style scoped lang="scss"> |
|
|
|
|
.v-pages { |
|
|
|
|
background-color: #f5f5f5; |
|
|
|
|
min-height: 100vh; |
|
|
|
|
height: fit-content; |
|
|
|
|
padding-bottom: 160rpx; |
|
|
|
|
|
|
|
|
|
.box-bg { |
|
|
|
|
position: fixed; |
|
|
|
|
z-index: 99; |
|
|
|
|
width: 100%; |
|
|
|
|
top: 35rpx; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
.not-show { |
|
|
|
|
display: none; |
|
|
|
|
} |
|
|
|
|
.m-kg { |
|
|
|
|
background: #eee; |
|
|
|
|
padding: 0 11rpx; |
|
|
|
|
border-radius: 15rpx; |
|
|
|
|
margin-right: 55rpx; |
|
|
|
|
color: #929292; |
|
|
|
|
font-size: 20rpx; |
|
|
|
|
height: 55rpx; |
|
|
|
|
line-height: 55rpx; |
|
|
|
|
margin-left: 10rpx; |
|
|
|
|
} |
|
|
|
|
.no-mar { |
|
|
|
|
margin-right: 0; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
.m-notice { |
|
|
|
|
background:rgba(#14c171,.1); |
|
|
|
|
padding: 6rpx 10rpx; |
|
|
|
|
border-radius: 10rpx; |
|
|
|
|
font-size: 24rpx; |
|
|
|
|
color: #333333; |
|
|
|
|
|
|
|
|
|
.color-red { |
|
|
|
|
color: #14c171; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
/deep/ .m-cj .uni-easyinput__content-input { |
|
|
|
|
z-index: 5; |
|
|
|
|
padding-right: 0 !important; |
|
|
|
|
} |
|
|
|
|
/deep/ .uni-mt-5 .is-disabled { |
|
|
|
|
background-color: #fff !important; |
|
|
|
|
color: #666 !important; |
|
|
|
|
} |
|
|
|
|
/deep/ .custom-content .uni-forms-item__content { |
|
|
|
|
padding-right: 0; |
|
|
|
|
} |
|
|
|
|
/deep/ .custom-content .uni-date__x-input { |
|
|
|
|
font-size: 28rpx; |
|
|
|
|
color: #666; |
|
|
|
|
} |
|
|
|
|
.v-form-item /deep/ .input-placeholder { |
|
|
|
|
color: #666; |
|
|
|
|
font-size: 28rpx !important; |
|
|
|
|
} |
|
|
|
|
.cnstom-input { |
|
|
|
|
padding-right: 20rpx; |
|
|
|
|
color: #666; |
|
|
|
|
font-size: 28rpx; |
|
|
|
|
} |
|
|
|
|
.m-t-large { |
|
|
|
|
margin-top: 20rpx; |
|
|
|
|
width: 650rpx; |
|
|
|
|
height: 80rpx; |
|
|
|
|
border-radius: 50rpx; |
|
|
|
|
color: #fff; |
|
|
|
|
line-height: 80rpx; |
|
|
|
|
position: fixed; |
|
|
|
|
left: 50%; |
|
|
|
|
transform: translateX(-50%); |
|
|
|
|
bottom: 55rpx; |
|
|
|
|
z-index: 97; |
|
|
|
|
} |
|
|
|
|
</style> |
|
|
|
|
</style> |