index.vue
10.2 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
<template>
<div class="main" ref="mainBox">
<table border="1">
<tr>
<th colspan="2">宗地代码</th>
<td colspan="3" disabled>{{zddm}}</td>
</tr>
<tr>
<th colspan="2">土地坐落</th>
<td colspan="3">{{tdzl}}</td>
</tr>
<tr>
<th colspan="2" style="width:25%">宗地面积(㎡)</th>
<td style="width:25%">{{zdmj}}</td>
<th style="width:25%">定着物数量</th>
<td style="width:25%" class="dzwsl">{{dzwdsl}}</td>
</tr>
<tr>
<th colspan="2">备注</th>
<td colspan="3"><el-input v-model="mjftData.bz" :disabled="isDisabled"></el-input></td>
</tr>
<tr>
<td class="cz"><el-button
type="primary"
class="changeBtn inAdd addMinus"
@click="addRow"
:disabled="isDisabled"
>+</el-button
></td>
<th >定着物代码</th>
<th >土地所有权/使用权面积(㎡)</th>
<th >独有独用土地面积(㎡)</th>
<th >分摊土地面积(㎡)</th>
</tr>
<tr v-for="(item,i) in mjftData.list" :key="i">
<td class="cz">
<el-button
type="primary"
class="changeBtn inMinus addMinus"
@click="delRow(i)"
:disabled="isDisabled"
>-</el-button
>
</td>
<td class="dzwdm">
<el-input v-model="item.dzwdm"
maxlength="9"
:disabled="isDisabled"
>
</el-input>
</td>
<td class="syqmj">
<el-input style="ime-mode:inactive"
oninput="value = (value.match(/^\d{0,8}(\.?\d{0,3})/g)[0]) || null"
v-model="item.tdsyqsyqmj" :disabled="isDisabled"
></el-input>
</td>
<td class="dytdmj">
<el-input v-model="item.dydytdmj" style="ime-mode:inactive" oninput="value = (value.match(/^\d{0,8}(\.?\d{0,3})/g)[0]) || null" :disabled="isDisabled"></el-input>
</td>
<td class="fttjmj">
<el-input v-model="item.fttdmj" style="ime-mode:inactive" oninput="value = (value.match(/^\d{0,8}(\.?\d{0,3})/g)[0]) || null" :disabled="isDisabled"></el-input>
</td>
</tr>
<tr>
<td class="cz"></td>
<th class="dzwdm">统计</th>
<td class="syqmj">{{sumTdsyqsyqmj}}</td>
<td class="dytdmj">{{sumDydytdmj}}</td>
<td class="fttjmj">{{sumFttdmj}}</td>
</tr>
</table>
<div class="header-button" :style="{width:mainBoxWidth+'px'}">
<el-button type="primary" class="saveBtn" @click="save" :disabled="isDisabled">保存</el-button>
</div>
</div>
</template>
<script>
import {getMjftInfo, savemjft} from '@api/zd'
import {Message} from 'element-ui'
export default {
name: "index",
props: {
isDisabled:{
type:Boolean,
default:false
}
},
data() {
return {
tdzl: '', // 土地坐落 继承获取
zdmj: '', // 宗地面积 继承获取
zddm: '',
mjftData: {
zdbsm: '', // 宗地标识码 继承获取
tdsyqsyqmjhj: '',// 土地所有权/使用权面积合计
fttdmjhj: '', // 分摊土地面积合计
dzwdys: '', // 表示同一宗地内所有的定着物单元数
dydytdmjhj: '', // 根据该宗地下共有/共用定着物量自动计算。 ,
bz: '', // 备注
list: [
{
dydytdmj: '', // 独有独用土地面积
dzwdm: '', // 定着物代码
fttdmj: '', // 分摊土地面积
gygyzdmjftbsm: '',// 共有公用面积分摊标识码 ,
tdsyqsyqmj: '' // 土地所有权/使用权面积
}
]
},
mainBoxWidth:0
}
},
methods: {
getData(bsm) {
getMjftInfo(bsm).then(res => {
if (res.success) {
this.mjftData = res.result
}
})
},
save() {
if(this.mjftData.list.length === 0){
Message.info("请填写相关定着物或者面积信息")
return
}
for (let val of this.mjftData.list) {
if (val.dzwdm == '') {
Message.error("定着物代码不能为空")
return
}
}
this.mjftData['zdbsm'] = this.$store.state.zdbsm
savemjft(this.mjftData).then(res => {
if (res.success) {
Message.success("保存成功")
this.getData(this.mjftData.zdbsm)
} else {
Message.error(res.message)
}
}).catch(error => {
console.log(error)
})
},
addRow() {
this.mjftData.list.push({
dydytdmj: '',
dzwdm: '',
fttdmj: '',
gygyzdmjftbsm: '',
tdsyqsyqmj: ''
})
},
delRow(index) {
this.mjftData.list.splice(index, 1)
}
},
computed: {
sumTdsyqsyqmj: function () {
let self = this;
let sum = 0;
let data = this.mjftData.list;
for (let i = 0; i < data.length; i++) {
if (isNaN(parseFloat(data[i].tdsyqsyqmj))) {
continue;
}
sum += parseFloat(data[i].tdsyqsyqmj)
}
let num = isNaN(sum) ? '' : sum.toFixed(3);
self.mjftData.tdsyqsyqmjhj = num;
return num;
},
sumDydytdmj: function () {
let self = this;
let sum = 0;
let data = this.mjftData.list;
for (let i = 0; i < data.length; i++) {
if (isNaN(parseFloat(data[i].dydytdmj))) {
continue;
}
sum += parseFloat(data[i].dydytdmj)
}
let num = isNaN(sum) ? '' : sum.toFixed(3);
self.mjftData.dydytdmjhj = num;
return num;
},
sumFttdmj: function () {
let self = this;
let sum = 0;
let data = this.mjftData.list;
for (let i = 0; i < data.length; i++) {
if (isNaN(parseFloat(data[i].fttdmj))) {
continue;
}
sum += parseFloat(data[i].fttdmj)
}
let num = isNaN(sum) ? '' : sum.toFixed(3);
self.mjftData.fttdmjhj = num;
return num;
},
dzwdsl: function () {
let self = this
let num = this.mjftData.list.length ? this.mjftData.list.length : 0
self.mjftData.dzwdys = num
return num;
},
zdbsm() {
return this.$route.query.bsm;
},
},
created() {
console.log("create init...")
},
mounted() {
this.mjftData.zdbsm = this.$store.state.zdbsm
this.zdmj = this.$store.state.zdmj
this.tdzl = this.$store.state.zdzl
this.zddm = this.$store.state.zddm
if (this.mjftData.zdbsm) {
this.getData(this.mjftData.zdbsm)
}
this.$nextTick(() => {
this.mainBoxWidth = this.$refs.mainBox.clientWidth;
})
},
watch: {
"$store.state.zdbsm": function (bsm) {
this.mjftData.zdbsm = bsm
},
"$store.state.zdmj": function (zdmj) {
this.zdmj = zdmj
},
"$store.state.zdzl": function (tdzl) {
this.tdzl = tdzl
},
"$store.state.zddm": function (zddm) {
this.zddm = zddm
},
zdbsm: function (val) {
this.getData(val);
},
}
}
</script>
<style scoped lang="less">
.main {
box-sizing: border-box;
padding: 18px;
height: auto;
width: 100%;
table {
// margin-top: 10px;
background-color: #fff;
font-size: 14px;
width: 100%;
cursor: pointer;
td {
text-align: center;
height: 36px;
min-width: 50px;
}
}
.header-button {
z-index: 3;
height: 50px;
position: fixed;
bottom: 0;
right: 0;
text-align: center;
background-color: #ffffff;
.saveBtn {
background-color: #00CACD;
border-color: #00CACD;
padding: 10px 30px;
margin-top: 8px;
}
.saveBtn:hover {
background-color: rgba(0, 202, 205, .8);
border-color: rgba(0, 202, 205, .8);
}
}
}
.cz {
width: 50px;
}
</style>