|
|
@@ -201,7 +201,8 @@ export default {
|
|
|
areaAll: '0',
|
|
|
waterRightAll: '0',
|
|
|
yieldPer: '0',
|
|
|
- residualWaterRight:'0',
|
|
|
+ residualWaterRight: '0',
|
|
|
+ areasizeResidue: '0',
|
|
|
rules: {
|
|
|
areaId: [
|
|
|
{ required: true, message: '请选择所属区域', trigger: 'blur' }
|
|
|
@@ -238,11 +239,22 @@ export default {
|
|
|
{
|
|
|
required: true, validator: (rule, value, callback) => {
|
|
|
if (!value) { callback(new Error('请输入土地面积')); return }
|
|
|
- if (isNaN(value)) callback(new Error('请正确输入您的土地面积'))
|
|
|
- else if (value > this.areaAll) {
|
|
|
- callback(new Error('输入的土地面积不能大于总面积'))
|
|
|
+ if (+value < 0) { callback(new Error('土地面积不能为负数')); return }
|
|
|
+ if (isNaN(value)) { callback(new Error('请正确输入您的土地面积')); return }
|
|
|
+ if (this.isEdit) {
|
|
|
+ if (+value > (+this.areasizeResidue) + (+this.editFarmerData.farmerAreasize)) {
|
|
|
+ callback(new Error('输入的土地面积不能大于总面积'))
|
|
|
+ return
|
|
|
+ } else {
|
|
|
+ callback()
|
|
|
+ }
|
|
|
} else {
|
|
|
- callback()
|
|
|
+ if (+value > +this.areasizeResidue) {
|
|
|
+ callback(new Error('输入的水权不能大于剩余面积'))
|
|
|
+ return
|
|
|
+ } else {
|
|
|
+ callback()
|
|
|
+ }
|
|
|
}
|
|
|
}, trigger: 'blur' }
|
|
|
],
|
|
|
@@ -250,6 +262,7 @@ export default {
|
|
|
{
|
|
|
required: true, validator: (rule, value, callback) => {
|
|
|
if (value == 0) { callback(new Error('请输入水权')); return }
|
|
|
+ if (+value < 0) { callback(new Error('水权不能为负数')); return }
|
|
|
if (isNaN(value)) { callback(new Error('请正确输入您的水权')); return }
|
|
|
if (this.isEdit) {
|
|
|
if (+value > (+this.residualWaterRight) + (+this.editFarmerData.farmerWrbalance)) {
|
|
|
@@ -277,7 +290,7 @@ export default {
|
|
|
this.dialogVisible = val;
|
|
|
}
|
|
|
if (!val) {
|
|
|
- this.$refs.baseForm.clearValidate()
|
|
|
+ this.$refs.baseForm?.clearValidate()
|
|
|
this.baseForm = { areaId:'' }
|
|
|
this.$emit('closeHandler')
|
|
|
this.cusareaName = ''
|
|
|
@@ -289,7 +302,6 @@ export default {
|
|
|
if (this.isEdit && val?.areaId) {
|
|
|
this.baseForm = { ...val }
|
|
|
this.handlerClick(val)
|
|
|
- this.cusareaName = val?.cusareaName || ''
|
|
|
} else {
|
|
|
this.baseForm = { areaId: '' }
|
|
|
this.cusareaName = ''
|
|
|
@@ -306,9 +318,9 @@ export default {
|
|
|
},
|
|
|
'baseForm.areaId': {
|
|
|
handler(val) {
|
|
|
- val && this.$refs.baseForm.clearValidate('areaId')
|
|
|
+ val && this.$refs.baseForm?.clearValidate('areaId')
|
|
|
},
|
|
|
- deep: true
|
|
|
+ deep: true
|
|
|
}
|
|
|
},
|
|
|
methods: {
|
|
|
@@ -320,6 +332,7 @@ export default {
|
|
|
this.yieldPer = value ? value?.waterrightAmount == 0 ? 0 : (value?.waterrightAreasize) / (value?.waterrightAmount) : 0
|
|
|
this.yieldPer = (+this.yieldPer).toFixed(2)
|
|
|
this.residualWaterRight = value?.amountResidue ?? 0
|
|
|
+ this.areasizeResidue = value?.areasizeResidue ?? 0
|
|
|
this.residualWaterRight = (+this.residualWaterRight).toFixed(2)
|
|
|
},
|
|
|
clearItem() {
|
|
|
@@ -337,6 +350,7 @@ export default {
|
|
|
areaId: item.areaId
|
|
|
})
|
|
|
const value = res?.data
|
|
|
+ this.cusareaName = item?.cusareaName
|
|
|
const areaId = item?.areaId || ''
|
|
|
this.baseForm.areaId = areaId
|
|
|
this.$set(this.baseForm,'areaId', areaId)
|