提交 ca519148 编写于 作者: Yuanzhao.dai's avatar Yuanzhao.dai

Merge branch 'dev-followUp-20190312' of...

Merge branch 'dev-followUp-20190312' of http://192.168.110.53/com.pica.cloud.education.frontend/pica.cloud.web-education-admin into dev-followUp-20190312
......@@ -113,7 +113,6 @@
callback();
}
return {
// comentMsg: {},//选择的漫画信息
isSelectCartoon: false,
followResourceId: '',
pushDay: '',
......@@ -123,9 +122,6 @@
timeUnit: [{ required: true, message: '请添加随访时间', trigger: 'change' }],
type: [{ required: true, message: '请选择随访方式', trigger: 'change' }],
},
// totalNumber: 0,
// wechatPatientNum: 0,
// messagePatientNum: 0
}
},
props: {
......@@ -140,6 +136,10 @@
patientIdList: Array
},
watch: {
// timeForm(val){
// this.timeForm = val
// console.log('表单子组件监听到的form数据',this.timeForm)
// },
valBegin(val){
if(val){
this.$refs[this.timeForm.formRef].validate((valid) => {
......
<template>
<div>
<p><el-button plain icon="el-icon-plus" size="small" round @click="addNewNode(timeForm.formRef)">新增时间节点</el-button><br></p>
<p><el-button plain icon="el-icon-plus" size="small" round @click="addNewNode">新增时间节点</el-button><br></p>
<div class="add-time-content">
<div class="time-line-scroll">
......@@ -20,6 +20,7 @@
</el-radio-group>
</div>
<!--查看时间节点-->
<div class="form-div" v-if="activeTab != 'setNewRef'">
<div v-for="(timeFormHas, index) in setTimeNodeList1" :key="index" :label="index">
<set-time-form
......@@ -37,6 +38,7 @@
</div>
</div>
<!--新增时间节点-->
<div class="form-div" v-if="activeTab == 'setNewRef'">
<set-time-form
:timeForm="timeForm"
......@@ -64,24 +66,7 @@
import {getFormOptions} from '@/utils/followup/followapis'
import { mapState,mapActions } from 'vuex'
const timeFormInit = {
formRef: '',
type: '',//随访方式
timeNo: '',//随访时间
timeUnit: '',//随访时间单位
remindList: [],//提醒医生预约提前天数
pushContentList: [],//推送患教提前天数 漫画id
followupList: [],//随访量表id
hasSelected: '',
isDisabled: false,
remindDay: '',
pushDay: '',
followResourceId: '',
comentMsg: {},
totalNumber: 0,
wechatPatientNum: 0,
messagePatientNum: 0
};
export default {
components: {
......@@ -96,7 +81,7 @@
activeTab: null,
currentFormRef: 1,
showSetBtn: true,
timeForm: _.cloneDeep(timeFormInit),
timeForm: {},
timeFormRules: {
timeNo: [{ required: true, message: '请添加随访时间', trigger: 'change' }],
timeUnit: [{ required: true, message: '请添加随访时间', trigger: 'change' }],
......@@ -108,6 +93,7 @@
setTimeNodeList: Array,
patientIdList: Array,
checkForm: Boolean,
saveStatus: Boolean,
},
computed: {
...mapState('planManage',{
......@@ -129,8 +115,8 @@
},
},
created() {
this.initNewForm();
this.getConstData()
//初始化一个随访时间节点
this.activeTab = 'setNewRef';
this.timeForm.formRef = this.getNowTime();
......@@ -140,25 +126,30 @@
}
},
watch: {
checkForm(val){
// console.log(val)
saveStatus(val){
if(val){
// 触发 保存 校验
this.saveValiedBegin = true
// 校验通过并且保存一个时间节点,通知外层
// this.setTimeNodeList.push(this.timeForm);
}else{
this.saveValiedBegin = false
}
},
checkForm(val){
// 触发 保存 校验
this.saveValiedBegin = val
},
valBegin(val){
this.valBegin = val
},
timeForm(newVal, oldVal) {
timeForm(val) {
if(this.setTimeNodeList.length>0) {
this.timeForm.isDisabled = true;
this.timeForm.timeUnit = this.setTimeNodeList[0].timeUnit;
}
this.timeForm = val
console.log('表单父组件的数据',this.timeForm)
},
setTimeNodeList1(newVal, oldVal) {
setTimeNodeList1() {
this.setTimeNodeList1.map(item=>{
item.isDisabled = true;
item.timeUnit = this.setTimeNodeList1[0].timeUnit
......@@ -193,6 +184,7 @@
this.getFormOptions()
},
// 校验通过之后,需要新增一个新的初始化的表单
checkValid(obj){
this.valBegin = false
console.log('校验结果',obj.valid)
......@@ -207,7 +199,9 @@
if(this.timeForm.pushDay){
this.timeForm.pushContentList.push({
startDays: this.timeForm.pushDay,
resourceId: ''
// resourceId: '',
resourceId: this.timeForm.comentMsg.id
})
}
if(this.timeForm.followResourceId.length>0){
......@@ -218,19 +212,21 @@
})
}
this.setTimeNodeList.push(this.timeForm);
this.$emit('setTimeNodeListOnCom',this.setTimeNodeList)
this.setTimeNodeList.push(this.timeForm);
if(obj.type=='save'){
console.log('是点击保存时候的校验,因此告诉最外层的 new-plan 组件,校验结果')
this.$emit('addListenSave',true)
}
}else{
this.initNewForm();
// console.log('初始化过之后activeTab=====> ',this.activeTab)
this.timeForm.formRef = this.getNowTime();
this.timeForm.isDisabled = true;
// this.timeForm = _.cloneDeep(timeFormInit);
}
this.timeForm = timeFormInit
this.timeForm.formRef = this.getNowTime();
this.timeForm.isDisabled = true;
this.$emit('setTimeNodeListOnCom',this.setTimeNodeList)
} else {
// 告诉 保存 按钮, 校验没通过
......@@ -242,21 +238,47 @@
return
}
},
addNewNode(formName) {
console.log(this.activeTab)
// 点击 新增时间节点
addNewNode() {
console.log('是否新增一个新的时间节点 ' + (this.activeTab == 'setNewRef'))
// 新增,则进行校验表单字段 触发校验
if(this.activeTab == 'setNewRef') {
if(this.activeTab !== 'setNewRef') {
this.valBegin = true
}else {
// 否则切换 已经新增的表单至新增节点表单
this.activeTab = 'setNewRef';
this.showSetBtn = true;
this.timeForm = _.cloneDeep(timeFormInit);
this.timeForm.formRef = this.getNowTime();
}else {
// 触发校验
this.valBegin = true
this.initNewForm()
}
console.log(this.timeForm)
},
// 初始化新的表单
initNewForm(){
const timeFormInit = {
formRef: '',
type: '',//随访方式
timeNo: '',//随访时间
timeUnit: '',//随访时间单位
remindList: [],//提醒医生预约提前天数
pushContentList: [],//推送患教提前天数 漫画id
followupList: [],//随访量表id
hasSelected: '',
isDisabled: false,
remindDay: [],
pushDay: '',
followResourceId: [],
comentMsg: {},
totalNumber: 0,
wechatPatientNum: 0,
messagePatientNum: 0
};
this.timeForm = timeFormInit;
this.timeForm.formRef = this.getNowTime();
},
goSelectCartoon() {
this.isSelectCartoon = true;
},
......@@ -268,11 +290,12 @@
this.timeForm.hasSelected = '';
},
changeTab(val){
console.log(val)
this.activeTab = val;
console.log('当前的activeTab ',val)
if(val == 'setNewRef') {
this.timeForm = _.cloneDeep(timeFormInit);
this.timeForm.formRef = this.getNowTime();
this.initNewForm();
}
},
deleteTimeNode(item, index) {
......@@ -282,8 +305,7 @@
//新增一个form
this.activeTab = 'setNewRef';
this.showSetBtn = true;
this.timeForm = _.cloneDeep(timeFormInit);
this.timeForm.formRef = this.getNowTime();
this.initNewForm();
}
},
deleteAddNode() {
......
......@@ -30,8 +30,8 @@
</el-form-item>
<el-form-item label="随访居民" required prop="hasSelectedNum">
<div style="display: flex">
<div class="select-patients">
<el-button plain icon="el-icon-plus" @click="selectPatientHandler">{{baseInfo.hasSelectedNum ? '继续添加' : '选择居民'}}</el-button><br>
<div>
<el-button plain icon="el-icon-plus" :style="noChoice?'border:1px solid red;':''" @click="selectPatientHandler">{{baseInfo.hasSelectedNum ? '继续添加' : '选择居民'}}</el-button><br>
<el-button type="text" class="mt10" @click="seeSelectedHandler" v-if="baseInfo.hasSelectedNum">已选{{baseInfo.hasSelectedNum}}<i class="el-icon-arrow-right"></i></el-button>
</div>
<p class="err-tips" v-if="noChoice">请添加随访居民</p>
......@@ -59,6 +59,7 @@
clearable
style="width:380px;">
</el-date-picker>
</el-form-item>
<el-form-item label="备注">
<el-select
......@@ -83,6 +84,7 @@
@setTimeNodeListOnCom="setTimeNodeListOnCom"
:patientIdList="baseInfo.patientIdList"
:checkForm="checkForm"
:saveStatus="saveStatus"
@addListenSave="addListenSave"
/>
</div>
......@@ -122,13 +124,16 @@
data() {
return {
checkForm: false,
saveStatus: false,
/*面包屑配置*/
curmbFirst: '随访管理',
curmbSecond: '计划管理',
curmbThird: '新建随访计划',
jumPathThird: '/followUp/plan-manage',
activeTab: 'first',
noName: false,
noResourceId: false,
noTime: false,
noChoice: false,
baseInfo: {
name: '',//随访计划名称
......@@ -160,11 +165,6 @@
//清理store中存的数据setTimeNodeList
},
// watch: {
// checkForm(val){
// this.checkForm = val
// }
// },
computed: {
...mapState('planManage',{
setTimeNodeList: state => state.setTimeNodeList,
......@@ -208,6 +208,7 @@
message: res.message,
showClose: false
});
this.saveStatus = false
}
})
// console.log('保存setTimeNodeList1',this.$refs.getTimeNodeList.setTimeNodeList1)
......@@ -233,10 +234,12 @@
let getArguments = arguments[0];
this.isShowSelectPatient = getArguments[0];
const selectPatients = getArguments[1]; // 每次选中获取的人
this.hasSelectedList = selectPatients;
this.baseInfo.patientIdList = [];
// this.hasSelectedList = selectPatients;
selectPatients.forEach((item)=>{
this.baseInfo.patientIdList.push(item.patientId); // 页面中数据存储所有选择的人,没有去重
if(!this.baseInfo.patientIdList.includes(item.patientId)){
this.hasSelectedList.push(item)
this.baseInfo.patientIdList.push(item.patientId); // 页面中数据存储所有选择的人,没有去重
}
})
this.baseInfo.hasSelectedNum = this.baseInfo.patientIdList.length;
},
......@@ -261,14 +264,15 @@
// this.getTimeNodeList([]);
//为方便调试,不做校验
// this.activeTab = 'second';
//用作校验
if(!this.baseInfo.hasSelectedNum) {
this.noChoice = true
return;
}else {
this.noChoice = false
}
this.$refs[formName].validate((valid) => {
//用作校验
if(!this.baseInfo.hasSelectedNum) {
this.noChoice = true
return;
}else {
this.noChoice = false
}
if (valid) {
// this.$refs['statusForm'].resetFields();
this.activeTab = 'second';
......@@ -344,9 +348,6 @@
}
}
.select-patients{
}
.err-tips{
color: #F56C6C;
......
Markdown 格式
0% or
您添加了 0 到此讨论。请谨慎行事。
先完成此消息的编辑!
想要评论请 注册