778b4e44 by zhaoqian

权利人必填项控制

1 parent a60277d2
......@@ -75,11 +75,11 @@
<tr>
<td colspan="4" class="tdright"><i class="requisite">*</i>权利人名称</td>
<td colspan="6">
<input type="text" class="formInput" v-model="formData.qlrmc" />
<input type="text" class="formInput" v-model="formData.qlrmc" ref="qlrmc" @blur="inputBlur($event)"/>
</td>
<td colspan="4" class="tdright"><i class="requisite">*</i>权利人类型</td>
<td colspan="6">
<el-select class="formSelect" v-model="formData.qlrlxbsm">
<el-select class="formSelect" v-model="formData.qlrlxbsm" ref="qlrlxbsm" @blur="inputBlur($event)">
<el-option
v-for="item in $store.state.qlrlxList"
:key="item.bsm"
......@@ -93,7 +93,7 @@
<tr>
<td colspan="4" class="tdright"><i class="requisite">*</i>证件类型</td>
<td colspan="6">
<el-select class="formSelect" v-model="formData.zjzlbsm">
<el-select class="formSelect" v-model="formData.zjzlbsm" ref="zjzlbsm" @blur="inputBlur($event)">
<el-option
v-for="item in $store.state.zjzlList"
:key="item.bsm"
......@@ -105,18 +105,18 @@
</td>
<td colspan="4" class="tdright"><i class="requisite">*</i>证件号</td>
<td colspan="6">
<input type="text" class="formInput" maxlength="18" v-model="formData.zjh" />
<input type="text" class="formInput" maxlength="18" v-model="formData.zjh" ref="zjh" @blur="inputBlur($event)"/>
</td>
</tr>
<tr>
<td colspan="4" class="tdright"><i class="requisite">*</i>电话</td>
<td colspan="6">
<!-- @blur="inputBlur($event)"-->
<input type="text" class="formInput" v-model="formData.dh" />
<input type="text" class="formInput" v-model="formData.dh" ref="dh" @blur="inputBlur($event)"/>
</td>
<td colspan="4" class="tdright"><i class="requisite">*</i>地址</td>
<td colspan="6">
<input type="text" class="formInput" v-model="formData.dz" />
<input type="text" class="formInput" v-model="formData.dz" ref="dz" @blur="inputBlur($event)"/>
</td>
</tr>
<tr>
......@@ -384,9 +384,21 @@
zjzlbsm: "",
},
glbsm:'',
rules:[],
};
},
methods: {
inputBlur(e){
if(e.target.value!=''){
e.target.style.border=""
}else{
e.target.style.border="1px solid red";
e.target.style.boxSizing = 'border-box';
}
},
//新增行数据
addRow() {
this.update=false;
......@@ -414,39 +426,97 @@
},
//确认权利人信息按钮;可以进行新增;可以进行更新;
addNewQlrInfo(){
//todo 权利人页面调整
this.formData.addQjDlrFrRequest=[];
this.formData.glbsm=this.bsm;
//将代理人,法人数据合在一起,名称为addQjDlrFrRequest;
//法人的type字段类型为0,
this.formData.fr.type=0;
this.formData.addQjDlrFrRequest.push(this.formData.fr);
for(let k=0;k<this.formData.dlrList.length;k++){
//代理人的type字段类型为1,
this.formData.dlrList[k].type=1;
this.formData.addQjDlrFrRequest.push(this.formData.dlrList[k]);
}
//如果是从更新按钮点击确定的则进行更新操作,如果不是,则进行添加操作
if(this.update){
console.log(this.formData)
updateQlrDlrFr(this.formData).then((res)=>{
if(res.code===200){
this.$message.success("修改完成!");
this.getQlrInfo();
this.update=false;
this.dialogVisible = false;
this.rules=[
{
data:this.formData.qlrmc,
name:'权利人名称',
dom:this.$refs.qlrmc,
rule: /^\s*$/g, //非空
},
{
data:this.formData.qlrlxbsm,
name:'权利人类型',
dom:this.$refs.qlrlxbsm,
rule: /^\s*$/g, //非空
},
{
data:this.formData.zjzlbsm,
name:'证件类型',
dom:this.$refs.zjzlbsm,
rule: /^\s*$/g, //非空
},
{
data:this.formData.zjh,
name:'证件号',
dom:this.$refs.zjh,
rule: /^\s*$/g, //非空
},
{
data:this.formData.dh,
name:'电话',
dom:this.$refs.dh,
rule: /^\s*$/g, //非空
},
{
data:this.formData.dz,
name:'地址',
dom:this.$refs.dz,
rule: /^\s*$/g, //非空
},
]
let flag = true;
this.rules.forEach(item=>{
if(item.rule.test(item.data) || item.data == null){
if(item.dom.$el){
item.dom.$el.style.border = '1px solid red';
item.dom.$el.style.boxSizing = 'border-box';
}else{
item.dom.style.border = '1px solid red';
item.dom.style.boxSizing = 'border-box';
}
})
}else {
insertQlrDlrFr(this.formData).then((res)=>{
if(res.code===200){
this.tableData.push(this.formData);
Object.assign(this.$data, this.$options.data())
this.dialogVisible = false;
this.getQlrInfo();
flag = false;
return false
}
})
this.$nextTick(()=>{
if (flag) {
//todo 权利人页面调整
this.formData.addQjDlrFrRequest=[];
this.formData.glbsm=this.bsm;
//将代理人,法人数据合在一起,名称为addQjDlrFrRequest;
//法人的type字段类型为0,
this.formData.fr.type=0;
this.formData.addQjDlrFrRequest.push(this.formData.fr);
for(let k=0;k<this.formData.dlrList.length;k++){
//代理人的type字段类型为1,
this.formData.dlrList[k].type=1;
this.formData.addQjDlrFrRequest.push(this.formData.dlrList[k]);
}
})
}
//如果是从更新按钮点击确定的则进行更新操作,如果不是,则进行添加操作
if(this.update){
console.log(this.formData)
updateQlrDlrFr(this.formData).then((res)=>{
if(res.code===200){
this.$message.success("修改完成!");
this.getQlrInfo();
this.update=false;
this.dialogVisible = false;
}
})
}else {
insertQlrDlrFr(this.formData).then((res)=>{
if(res.code===200){
this.tableData.push(this.formData);
Object.assign(this.$data, this.$options.data())
this.dialogVisible = false;
this.getQlrInfo();
}
})
}
}
})
},
//修改行数据
......@@ -623,12 +693,24 @@
this.gyfsList[i].disabled = item.mc === "单独所有";
}
}
console.log(this.tableData.length+":this.tableData[0].length");
if(this.tableData.length>1){
console.log(JSON.stringify(this.tableData[0])+":this.tableData[0].length");
this.gyfs = this.tableData[0].gyfsbsm
}
},
"formData.qlrlxbsm":function (val) {
console.log(this.$refs.qlrlxbsm.$el.style.border+":console.log(this.$refs.qlrlxbsm.$el.style.border)")
if (val != '') {
console.log(this.$refs.qlrlxbsm.$el.style.border+":console.log(this.$refs.qlrlxbsm.$el.style.border)")
this.$refs.qlrlxbsm.$el.style.border = '';
}
},
"formData.zjzlbsm":function (val) {
if (val != '') {
this.$refs.zjzlbsm.$el.style.border = '';
}
},
}
};
</script>
......