7f1950dc by weimo934

fix(mjft):修改面积验证

1 parent 3024659f
<template>
<div class="main">
<table border="1">
<tr>
<td colspan="2">土地坐落</td>
<td colspan="3"><input type="number" class="formInput" v-model.number="mjftData.tdzl" disabled/></td>
</tr>
<tr>
<td colspan="2">宗地代码</td>
<td colspan="3"><input type="text" class="formInput" v-model="mjftData.zdbsm " disabled/></td>
</tr>
<tr>
<td colspan="2">宗地面积(㎡)</td>
<td><input type="number" class="formInput" v-model.number="mjftData.zjmj" disabled/></td>
<td>定着物数量</td>
<td>{{dzwdsl}}</td>
</tr>
<tr>
<td colspan="2">备注</td>
<td colspan="3"><input type="text" class="formInput" v-model="mjftData.bz"/></td>
</tr>
</table>
<table border="1">
<tr>
<td @click="addRow">+</td>
<td>定着物代码</td>
<td>土地所有权/使用权面积(㎡)</td>
<td>独有独用土地面积(㎡)</td>
<td>分摊土地面积(㎡)</td>
</tr>
<tr v-for="(item,i) in mjftData.addQjZdftdzwRequestList" :key="i">
<td @click="delRow(i)">-</td>
<td><input type="text" class="formInput" v-model="item.dzwdm"/></td>
<td><input type="number" class="formInput" v-model.number="item.tdsyqsyqmj"/></td>
<td><input type="number" class="formInput" v-model.number="item.dydytdmj"/></td>
<td><input type="number" class="formInput" v-model.number="item.fttdmj"/></td>
</tr>
<tr>
<td></td>
<td>统计</td>
<td>{{sumTdsyqsyqmj}}</td>
<td>{{sumDydytdmj}}</td>
<td>{{sumFttdmj}}</td>
</tr>
</table>
<div class="pers">
<el-button @click="save" type="primary">保存</el-button>
<div class="main">
<table border="1">
<tr>
<td colspan="2">土地坐落</td>
<td colspan="3"><input type="text" class="formInput" v-model="mjftData.tdzl" disabled/></td>
</tr>
<tr>
<td colspan="2">宗地代码</td>
<td colspan="3"><input type="text" class="formInput" v-model="mjftData.zdbsm " disabled/></td>
</tr>
<tr>
<td colspan="2">宗地面积(㎡)</td>
<td><input type="number" class="formInput" v-model.number="mjftData.zdmj" disabled/></td>
<td>定着物数量</td>
<td>{{dzwdsl}}</td>
</tr>
<tr>
<td colspan="2">备注</td>
<td colspan="3"><input type="text" class="formInput" v-model="mjftData.bz"/></td>
</tr>
</table>
<table border="1">
<tr>
<td @click="addRow">+</td>
<td>定着物代码</td>
<td>土地所有权/使用权面积(㎡)</td>
<td>独有独用土地面积(㎡)</td>
<td>分摊土地面积(㎡)</td>
</tr>
<tr v-for="(item,i) in mjftData.addQjZdftdzwRequestList" :key="i">
<td @click="delRow(i)">-</td>
<td><input type="text" class="formInput" v-model="item.dzwdm"/></td>
<td><input type="number" class="formInput" v-model="item.tdsyqsyqmj" @keydown="oninput"/></td>
<td><input type="number" class="formInput" v-model="item.dydytdmj" @keydown="oninput"/></td>
<td><input type="number" class="formInput" v-model="item.fttdmj" @keydown="oninput"/></td>
</tr>
<tr>
<td></td>
<td>统计</td>
<td>{{sumTdsyqsyqmj}}</td>
<td>{{sumDydytdmj}}</td>
<td>{{sumFttdmj}}</td>
</tr>
</table>
<div class="pers">
<el-button @click="save" type="primary">保存</el-button>
</div>
</div>
</div>
</template>
<script>
......@@ -57,7 +57,7 @@
data() {
return {
mjftData: {
zdbsm: '123', // 宗地标识码 继承获取
zdbsm: '', // 宗地标识码 继承获取
tdsyqsyqmjhj: '',// 土地所有权/使用权面积合计
fttdmjhj: '', // 分摊土地面积合计
dzwdys: '', // 表示同一宗地内所有的定着物单元数
......@@ -87,6 +87,9 @@
console.log(error)
})
},
oninput(e) {
e.target.value = (e.target.value.match(/^\d*(\.?\d{0,2})/g)[0]) || null
},
addRow() {
this.mjftData.addQjZdftdzwRequestList.push({
dydytdmj: '',
......@@ -111,7 +114,7 @@
}
sum += parseFloat(data[i].tdsyqsyqmj)
}
let num = isNaN(sum) ? '' : sum;
let num = isNaN(sum) ? '' : sum.toFixed(3);
self.mjftData.tdsyqsyqmjhj = num;
return num;
},
......@@ -125,7 +128,7 @@
}
sum += parseFloat(data[i].dydytdmj)
}
let num = isNaN(sum) ? '' : sum;
let num = isNaN(sum) ? '' : sum.toFixed(3);
self.mjftData.dydytdmjhj = num;
return num;
},
......@@ -139,7 +142,7 @@
}
sum += parseFloat(data[i].fttdmj)
}
let num = isNaN(sum) ? '' : sum;
let num = isNaN(sum) ? '' : sum.toFixed(3);
self.mjftData.fttdmjhj = num;
return num;
},
......@@ -154,49 +157,55 @@
console.log("create init...")
},
mounted() {
// 暂时随机生成 后续从调查表继承过来
this.mjftData.zdbsm='ZDDM'+parseInt(Math.random()*100)
this.mjftData.zdmj=(Math.random()*100).toFixed(3)
let zl=['西安','咸阳','雁塔区','高新区','未央区','莲湖区','临潼区']
let i=parseInt(Math.random()*7,10);
this.mjftData.tdzl=zl[i]
console.log("mounted init...")
}
}
</script>
<style scoped>
.main {
box-sizing: border-box;
padding: 18px;
height: auto;
width: 80%;
}
.main {
box-sizing: border-box;
padding: 18px;
height: auto;
width: 80%;
}
table {
margin-top: 10px;
background-color: #fff;
font-size: 14px;
width: 100%;
}
table {
margin-top: 10px;
background-color: #fff;
font-size: 14px;
width: 100%;
}
td {
text-align: center;
height: 36px;
}
td {
text-align: center;
height: 36px;
}
table .formInput {
margin: 0;
height: 36px;
outline: none;
border: none;
color: #606764;
overflow: visible;
text-align: center;
cursor: text;
}
table .formInput {
margin: 0;
height: 36px;
outline: none;
border: none;
color: #606764;
overflow: visible;
text-align: center;
cursor: text;
}
.pers {
text-align: center;
margin-top: 10px;
}
.pers {
text-align: center;
margin-top: 10px;
}
.pers .el-button {
width: 150px;
}
.pers .el-button {
width: 150px;
}
</style>
......