提交 538e3af9 编写于 作者: tao.wu's avatar tao.wu

no message

上级 b8df61d9
......@@ -13,7 +13,7 @@
:label="item.label"
:rules="item.rules"
:label-width="item.labelWidth"
:required="isRule"
:required="needRule"
:class="item.className"
:error="item.error">
<!-- div文本 -->
......@@ -112,8 +112,7 @@
export default {
props: {
isRule: Boolean,
// formName: String,
needRule: Boolean,
dataSource: {
type: Array,
default: () => []
......@@ -124,19 +123,13 @@
}
},
watch: {
isRule(val){
this.needRule = val
this.$forceUpdate();
},
form(val){
this.form = val
// console.log(val)
this.$forceUpdate()
}
},
data() {
return {
needRule: true,
spanNum: 6,
// valueFormat: 'timestamp',
// valueFormat: 'yyyy-MM-dd',
......
......@@ -52,6 +52,8 @@ export default ($this) => {
console.log(e)
if(e == '12个月'){
$this.needRule = true;
}else{
$this.needRule = false;
}
}
},
......
......@@ -14,7 +14,7 @@
<FormScale
:dataSource="item.dataSource"
:form="item.formObject"
:isRule="isRule"
:needRule="needRule"
:class="item.className"
/>
</el-form>
......@@ -54,6 +54,7 @@
needRule: false, //是否动态开启验证
showModule: true, //是否隐藏表单模块
canRender: true,
valid: false,
planPatientsTimesId: '',
scaleNo: '',
doctorId: '',
......@@ -75,7 +76,6 @@
{name: 'CheckLab',formObject: {},showModule: true,formName: 'stroke_015',className: 'obj-form-title',dataSource: dataSourceCheckLab(this), title: '六、实验室检查(高危人群12个月随访必填)'},
],
formData: {},//整个表单对象
isRule: false,//验证的依赖关系
}
},
components: {
......@@ -89,42 +89,27 @@
// 动态开启验证开关
setRuleToTrue(index){
this.addComponents[index].dataSource.forEach((item,k)=>{
if(item.rules && item.rules.length > 0){
if(!this.needRule){
this.addComponents[index].dataSource[k].rules[0].required = false;
// this.addComponents[index].dataSource[k].rules.push(item)
// this.addComponents[index].dataSource[k].rules = item.rules.splice(0,1);
// this.$forceUpdate()
}
// console.log(this.addComponents[index].dataSource[k].rules)
if(this.addComponents[index].dataSource[k].rules && this.addComponents[index].dataSource[k].rules.length > 0){
this.addComponents[index].dataSource[k].rules[0].required = true;
}
})
}
},
watch: {
checkStart(val){
if(val){
for(let i=0;i<this.addComponents.length;i++){
let formName = this.addComponents[i].formName;
// 将每个模块的fornName对应后台的表名放到表单对象
this.formData[formName] = this.addComponents[i].formObject;
if(formName==='stroke_006'||formName==='stroke_014'||formName==='stroke_015'){
if(this.needRule){
this.setRuleToTrue(i)
}
}
if(this.$refs['form' + i].length > 0){
this.$refs['form' + i][0].validate((valid) => {
this.valid = valid;
});
}
}
// console.log(this.formData)
// 提交量表
dataSubmit(){
if(this.valid){
// console.log(this.formData)
this.formData.doctorId = parseFloat(this.doctorId);
this.formData.saveWay = parseFloat(this.saveWay);
this.formData.planPatientsTimesId = parseFloat(this.planPatientsTimesId);
this.formData.scaleNo = this.scaleNo;
this.formData.isLine = 2;
// console.log(JSON.stringify(this.formData))
if(this.valid){
// console.log(JSON.stringify(this.formData))
axios({
method: 'post',
url: getFollowUpSC('/scale/save'),
......@@ -143,11 +128,34 @@
}
});
}
}
},
watch: {
checkStart(val){
if(val){
for(let i=0;i<this.addComponents.length;i++){
let formName = this.addComponents[i].formName;
// 将每个模块的fornName对应后台的表名放到表单对象
this.formData[formName] = this.addComponents[i].formObject;
if(formName==='stroke_006'||formName==='stroke_014'||formName==='stroke_015'){
this.setRuleToTrue(i)
}
this.$nextTick(()=>{
if(this.$refs['form' + i].length > 0){
this.$refs['form' + i][0].validate((valid) => {
this.valid = valid;
});
}
})
}
this.$emit('checkEnd',false);
// this.dataSubmit();
}
},
showModule(val){
console.log(val)
this.addComponents.forEach((item,index)=>{
if(index >= 3){
this.addComponents[index].showModule = val;
......
Markdown 格式
0% or
您添加了 0 到此讨论。请谨慎行事。
先完成此消息的编辑!
想要评论请 注册