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

no message

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