资产表单验证规则

master
xy 1 year ago
parent 3dcf5d265c
commit 7c8dd44c55

@ -13,6 +13,67 @@ export default {
render(h) {
const _this = this;
let houseDialog = new CreateDialog(this, [
{
show: true,
key: "bufuyuanyin",
label: "不符原因",
render: h("el-input", {
props: {
disabled: this.form.dengjimianji === this.form.shijimianji,
size: "small",
value: this.form["bufuyuanyin"],
},
on: {
input: e => {
this.$set(this.form,'bufuyuanyin',e)
}
}
}),
},
{
show: true,
key: "xianzhuang",
label: "现状",
render: h("div",[
h('el-select',{
props: {
size: 'small',
value: this.form.xianzhuang
},
style: {
width: '100%'
},
on: {
input: e => {
this.$set(this.form,'xianzhuang',e)
}
}
},this.formInfo?.find(i => i.field === 'xianzhuang')?._params?.map(i => h('el-option',{
props: {
label: i.key,
value: i.value
}
}))),
h('el-input',{
style: {
display: this.form.xianzhuang === '其他' ? 'block' : 'none',
'margin-top': '6px'
},
attrs: {
placeholder: "填写现状其他事项"
},
props: {
value: this.xianzhuangInput,
size: 'small',
},
on: {
input: e => {
this.$set(this,'xianzhuangInput',e)
}
}
})
])
},
{
show: true,
key: "guanliantudizhengquanzheng",
@ -292,6 +353,7 @@ export default {
table_name: "lands",
keyword: ""
},
xianzhuangInput: "",
};
},
methods: {
@ -379,6 +441,9 @@ export default {
this.$refs["elForm"].validate((validate) => {
if (validate) {
let copyForm = deepCopy(this.form);
if(copyForm.xianzhuang === '其他') {
copyForm.xianzhuang = this.xianzhuangInput
}
this.formInfo.forEach((info) => {
if (
info._relations?.link_relation === "newHasMany" ||
@ -507,6 +572,21 @@ export default {
{ required: true, message: `请填写${i.name}` },
];
}
if (i.field === 'bufuyuanyin') {
this.rules[i.field] = [
{ validator: (rule, value, callback) => {
if (this.form.dengjimianji === this.form.shijimianji) {
callback()
} else {
if (!value) {
callback(new Error('登记面积与实际面积不符,请填写不符原因'))
} else {
callback()
}
}
} },
];
}
if (i.edit_input === "files") {
this.form[i.field] = [];
}

@ -12,6 +12,67 @@ export default {
},
render(h) {
let dialog = new CreateDialog(this, [
{
show: true,
key: "bufuyuanyin",
label: "不符原因",
render: h("el-input", {
props: {
disabled: this.form.dengjimianji === this.form.shijimianji,
size: "small",
value: this.form["bufuyuanyin"],
},
on: {
input: e => {
this.$set(this.form,'bufuyuanyin',e)
}
}
}),
},
{
show: true,
key: "xianzhuang",
label: "现状",
render: h("div",[
h('el-select',{
props: {
size: 'small',
value: this.form.xianzhuang
},
style: {
width: '100%'
},
on: {
input: e => {
this.$set(this.form,'xianzhuang',e)
}
}
},this.formInfo?.find(i => i.field === 'xianzhuang')?._params?.map(i => h('el-option',{
props: {
label: i.key,
value: i.value
}
}))),
h('el-input',{
style: {
display: this.form.xianzhuang === '其他' ? 'block' : 'none',
'margin-top': '6px'
},
attrs: {
placeholder: "填写现状其他事项"
},
props: {
value: this.xianzhuangInput,
size: 'small',
},
on: {
input: e => {
this.$set(this,'xianzhuangInput',e)
}
}
})
])
},
{
key: "fangchanzhuangtai",
label: "房产状态",
@ -156,6 +217,7 @@ export default {
file: {},
pickHouseRow: null,
xianzhuangInput: ""
};
},
methods: {
@ -246,6 +308,9 @@ export default {
this.$refs["elForm"].validate((validate) => {
if (validate) {
let copyForm = deepCopy(this.form);
if(copyForm.xianzhuang === '其他') {
copyForm.xianzhuang = this.xianzhuangInput
}
this.formInfo.forEach((info) => {
if (
info._relations?.link_relation === "newHasMany" ||
@ -403,6 +468,21 @@ export default {
{ required: true, message: `请填写${i.name}` },
];
}
if (i.field === 'bufuyuanyin') {
this.rules[i.field] = [
{ validator: (rule, value, callback) => {
if (this.form.dengjimianji === this.form.shijimianji) {
callback()
} else {
if (!value) {
callback(new Error('登记面积与实际面积不符,请填写不符原因'))
} else {
callback()
}
}
} },
];
}
if (i.edit_input === "files") {
this.form[i.field] = [];
}

@ -825,7 +825,7 @@ export default {
table_name: item.hasOwnProperty('land_id') ? "houses" : "lands",
...item.ORIGINAL_DATA,
id: item.id,
xianzhuang: item._zichanshengyumianji == 0 ? 1 : 2,
xianzhuang: '已处置/拆迁',///
shijimianji: item._zichanshengyumianji,
fenlei: 1
})))

@ -411,7 +411,7 @@ export default {
value: "",
},
],
sort_name: 'xianzhuang',
sort_name: 'fenlei',
sort_type: 'asc',
},
form: [],
@ -627,7 +627,7 @@ export default {
paramMap.set(i.select_item[key], key);
});
return paramMap.get(row[i.field]?.toString());
return paramMap.get(row[i.field]?.toString()) || row[i.field];
};
}
if (i._relations) {

@ -390,7 +390,7 @@ export default {
value: "",
},
],
sort_name: 'xianzhuang',
sort_name: 'fenlei',
sort_type: 'asc'
},
form: [],
@ -603,7 +603,7 @@ export default {
paramMap.set(i.select_item[key], key);
});
return paramMap.get(row[i.field]?.toString());
return paramMap.get(row[i.field]?.toString()) || row[i.field];
};
}
if (i._relations) {

Loading…
Cancel
Save