提交 4f57b218 编写于 作者: 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
...@@ -4,54 +4,45 @@ ...@@ -4,54 +4,45 @@
<div v-if="!isStandedTemplate"> <div v-if="!isStandedTemplate">
<el-button <el-button
size="small" size="small"
@click="addNewNode" type="primary"
@click="addNewNode()"
>新增时间节点 >新增时间节点
</el-button> </el-button>
</div> </div>
<div class="add-time-content"> <div class="add-time-content">
<!--tab层-->
<div class="time-line-scroll"> <div class="time-line-scroll">
<el-tabs v-model="activeTab" type="card" @tab-remove="deleteTimeNode" :closable="tabClosable()">
<div <el-tab-pane
v-if="showSetBtn && !isStandedTemplate" style="margin:10px 5px;background:orange;padding:10px;display: inline-block;">设置随访时间 v-for="(itemTimeForm, index) in setTimeNodeList"
<i class="el-icon-circle-close-outline" @click="deleteAddNode" v-if="setTimeNodeList.length>0"></i>
</div>
<div v-model="activeTab" type="card" closable>
<div
v-for="(item, index) in setTimeNodeList"
:key="index" :key="index"
@click="changeTabNew(index)" :label="showTabLabel(itemTimeForm)"
:style="(index == activeTab)?'background:#3190e8;':''" :name="index+''"
style="float:left;border:1px solid orange;padding:5px 10px;margin:0 5px;position: relative;" >
>{{isStandedTemplate ? item.timeStr : '开始后'+String(item.timeNo) + timeUnitStr}}
<i class="deletelist el-icon-circle-close-outline" @click.stop="deleteTimeNode(item, index)" v-if="!isStandedTemplate && item.change"></i></div>
</div>
</div>
<!--查看时间节点-->
<div class="form-div" >
<div <div
v-show="index == activeTab" v-show="index == activeTab"
v-for="(itemTimeForm, index) in setTimeNodeList"
:key="index" :key="index"
:label="index" :label="index"
class="form-div"
> >
<el-form :ref="itemTimeForm.formRef" :model="itemTimeForm" :rules="timeFormRules" label-suffix=":" label-width="140px" :inline-message="true" size="small"> <el-form :ref="itemTimeForm.formRef" :model="itemTimeForm" :rules="timeFormRules" label-suffix=":" label-width="140px" :inline-message="true" size="small">
<el-form-item label="本次随访时间" required> <el-form-item label="本次随访时间" required>
<div style="display: flex;"> <div style="display: flex;">
<el-form-item prop="timeNo"> <el-form-item prop="timeNo">
<el-input <el-input
style="width:200px;"
v-model="itemTimeForm.timeNo" v-model="itemTimeForm.timeNo"
type="number" type="number"
size="small" size="small"
placeholder="请输入" placeholder="请输入"
:disabled="isStandedTemplate || !itemTimeForm.change" :disabled="itemIsDisabled(itemTimeForm)"
@blur="timeNoBlur(itemTimeForm)"
maxlength="2" maxlength="2"
clearable /> clearable />
</el-form-item> </el-form-item>
<el-form-item prop="timeUnit" class="ml20"> <el-form-item prop="timeUnit" class="ml20">
<el-select v-model="itemTimeForm.timeUnit" placeholder="请选择" :disabled="itemTimeForm.isDisabled || !itemTimeForm.change"> <el-select style="width:200px;" v-model="itemTimeForm.timeUnit" placeholder="请选择" @change="choseTimeUit" :disabled="itemTimeForm.isDisabled">
<el-option <el-option
v-for="(item,index) in markOptions" v-for="(item,index) in markOptions"
:key="index" :key="index"
...@@ -64,7 +55,7 @@ ...@@ -64,7 +55,7 @@
</el-form-item> </el-form-item>
<el-form-item label="随访方式" prop="type"> <el-form-item label="随访方式" prop="type">
<el-radio-group v-model="itemTimeForm.type" size="small"> <el-radio-group v-model="itemTimeForm.type" size="small">
<el-radio v-for="(item,index) in followTypeList" :key="index" :label="item.no" :disabled="isStandedTemplate || !itemTimeForm.change">{{item.value}}</el-radio> <el-radio v-for="(item,index) in followTypeList" :key="index" :label="item.no" :disabled="itemIsDisabled(itemTimeForm)">{{item.value}}</el-radio>
</el-radio-group> </el-radio-group>
</el-form-item> </el-form-item>
<el-form-item label="提醒医生预约居民"> <el-form-item label="提醒医生预约居民">
...@@ -72,7 +63,7 @@ ...@@ -72,7 +63,7 @@
v-model="itemTimeForm.remindDay" v-model="itemTimeForm.remindDay"
multiple multiple
:multiple-limit=3 :multiple-limit=3
:disabled="isStandedTemplate || !itemTimeForm.change" :disabled="itemIsDisabled(itemTimeForm)"
@change="changeRemindDay" @change="changeRemindDay"
placeholder="请选择"> placeholder="请选择">
<el-option <el-option
...@@ -91,7 +82,7 @@ ...@@ -91,7 +82,7 @@
placeholder="选择推送时间" placeholder="选择推送时间"
clearable clearable
@change="changePushDay" @change="changePushDay"
:disabled="isStandedTemplate || !itemTimeForm.change" :disabled="itemIsDisabled(itemTimeForm)"
> >
<el-option <el-option
v-for="(item,index) in pushTimeOptions" v-for="(item,index) in pushTimeOptions"
...@@ -103,9 +94,9 @@ ...@@ -103,9 +94,9 @@
<el-button plain class="ml20" @click="goSelectCartoon" v-if="showChoseComtent(itemTimeForm)">选择健康漫画</el-button> <el-button plain class="ml20" @click="goSelectCartoon" v-if="showChoseComtent(itemTimeForm)">选择健康漫画</el-button>
<div class="selected-div ml20" v-if="itemTimeForm.hasSelected"> <div class="selected-div ml20" v-if="itemTimeForm.hasSelected">
<span>{{itemTimeForm.comentMsg.header_name}}</span> <h5>{{itemTimeForm.comentMsg.header_name}}</h5>
<el-button type="text" @click="goSelectCartoon" v-if="showRechoseDelete(itemTimeForm)">重选</el-button> <el-button type="text" @click="goSelectCartoon" v-if="showRechoseDelete(itemTimeForm)">重选</el-button>
<el-button type="text" @click="deleteClick" v-if="showRechoseDelete(itemTimeForm)">删除</el-button> <el-button type="text" @click="deleteClick(index)" v-if="showRechoseDelete(itemTimeForm)">删除</el-button>
</div> </div>
</div> </div>
</el-form-item> </el-form-item>
...@@ -119,7 +110,7 @@ ...@@ -119,7 +110,7 @@
multiple multiple
:multiple-limit=3 :multiple-limit=3
@change="changeFollowId" @change="changeFollowId"
:disabled="isStandedTemplate || !itemTimeForm.change" :disabled="itemIsDisabled(itemTimeForm)"
placeholder="请选择"> placeholder="请选择">
<el-option <el-option
v-for="(item_sub,index) in formOptions" v-for="(item_sub,index) in formOptions"
...@@ -132,113 +123,16 @@ ...@@ -132,113 +123,16 @@
</el-form-item> </el-form-item>
</el-form> </el-form>
</div> </div>
</el-tab-pane>
</el-tabs>
</div> </div>
<!--新增时间节点-->
<div class="form-div" v-show="activeTab == 'setNewRef'">
<el-form :ref="timeForm.formRef" :model="timeForm" :rules="timeFormRules" label-suffix=":" label-width="140px" :inline-message="true" size="small">
<el-form-item label="本次随访时间" required>
<div style="display: flex;">
<el-form-item prop="timeNo">
<el-input
v-model="timeForm.timeNo"
type="number"
size="small"
placeholder="请输入"
:disabled="isStandedTemplate"
maxlength="2"
clearable />
</el-form-item>
<el-form-item prop="timeUnit" class="ml20">
<el-select v-model="timeForm.timeUnit" placeholder="请选择" :disabled="timeForm.isDisabled">
<el-option
v-for="(item,index) in markOptions"
:key="index"
:label="item.value"
:disabled="isStandedTemplate"
:value="item.no">
</el-option>
</el-select>
</el-form-item>
</div> </div>
</el-form-item>
<el-form-item label="随访方式" prop="type">
<el-radio-group v-model="timeForm.type" size="small">
<el-radio v-for="(item,index) in followTypeList" :key="index" :label="item.no" :disabled="isStandedTemplate">{{item.value}}</el-radio>
</el-radio-group>
</el-form-item>
<el-form-item label="提醒医生预约居民">
<el-select
v-if="!isStandedTemplate"
v-model="timeForm.remindDay"
multiple
:multiple-limit=3
@change="changeRemindDay"
placeholder="请选择">
<el-option
v-for="(item,index) in remindOptions"
:key="index"
:label="item.value"
:value="item.no">
</el-option>
</el-select>
</el-form-item>
<el-form-item label="推送患教">
<div style="display: flex">
<el-select
v-if="!isStandedTemplate"
v-model="timeForm.pushDay"
@change="changePushDay"
placeholder="选择推送时间"
clearable
>
<el-option
v-for="(item,index) in pushTimeOptions"
:key="index"
:label="item.value"
:value="item.no">
</el-option>
</el-select>
<el-button plain class="ml20" @click="goSelectCartoon" v-if="!timeForm.hasSelected && !isStandedTemplate && !planId">选择健康漫画</el-button>
<div class="selected-div ml20" v-if="timeForm.hasSelected">
<span>{{timeForm.comentMsg.header_name}}</span>
<el-button type="text" @click="goSelectCartoon" v-if="!isStandedTemplate && !planId">重选</el-button>
<el-button type="text" @click="deleteClick" v-if="!isStandedTemplate && !planId">删除</el-button>
</div>
</div>
</el-form-item>
<div class="tips-contnt" v-if="timeForm.hasSelected">
<p class="yellow-font">当前计划中共{{totalNumber}}位居民(微信:{{wechatPatientNum}}位,短信:{{messagePatientNum}}位),本次定时推送任务在发送当日预计需要{{messagePatientNum}}条短信额度(微信推送不消耗额度,建议您让居民关注云鹊健康微信公众号),务必提前确保短信额度的充足。</p>
<p>需要更多额度,请前往「云鹊医App-个人中心-啾啾币中心」兑换短信额度后再进行预约,您也可以联系云鹊医客服购买短信额度,客服电话:400-920-8877</p>
</div>
<el-form-item label="随访登记表">
<el-select
v-if="!isStandedTemplate"
v-model="timeForm.followResourceId"
multiple
:multiple-limit=3
@change="changeFollowId"
placeholder="请选择">
<el-option
v-for="(item_sub,index) in formOptions"
:key="index"
:label="item_sub.name"
:value="item_sub.scaleNo">
</el-option>
</el-select>
</el-form-item>
</el-form>
</div>
</div>
<select-cartoon <select-cartoon
:isSelectCartoon="isSelectCartoon" :isSelectCartoon="isSelectCartoon"
@closeSelectCartoon="closeSelectCartoon" @closeSelectCartoon="closeSelectCartoon"
@confirmSelectComent="confirmSelectComent" @confirmSelectComent="confirmSelectComent"
/> />
<!--<select-cartoon :isSelectCartoon="isSelectCartoon" @closeSelectCartoon="closeSelectCartoon"></select-cartoon>-->
</div> </div>
</template> </template>
...@@ -258,8 +152,8 @@ ...@@ -258,8 +152,8 @@
}, },
data() { data() {
const checkDay = (rule, value, callback)=>{ const checkDay = (rule, value, callback)=>{
const num = parseFloat(value) const num = parseFloat(value);
if(num < 1 || num>99){ if(num < 0 || num > 100){
return callback(new Error('数字范围0-99')); return callback(new Error('数字范围0-99'));
} }
if(!Number.isInteger(num)){ if(!Number.isInteger(num)){
...@@ -277,17 +171,18 @@ ...@@ -277,17 +171,18 @@
type: [{ required: true, message: '请选择随访方式', trigger: 'change' }], type: [{ required: true, message: '请选择随访方式', trigger: 'change' }],
}, },
tabIndex:2, tabIndex:2,
setTimeNodeList: [], setTimeNodeList: [],
timeIsRepeat: false, //验证时间是否重复 timeIsRepeat: false, //验证时间是否重复
valBegin: false, valBegin: false,
// isSelectCartoon: false, // isSelectCartoon: false,
// saveValiedBegin: false, // saveValiedBegin: false,
isSelectCartoon: false, isSelectCartoon: false,
activeTab: 'setNewRef', activeTab: 0,
currentFormRef: 1, currentFormRef: 1,
showSetBtn: true, // showSetBtn: true,
timeForm: { // timeForm: {},
},
markOptions: [], markOptions: [],
followTypeList: [], followTypeList: [],
...@@ -318,37 +213,25 @@ ...@@ -318,37 +213,25 @@
} }
}, },
watch: { watch: {
// 初始化 固定模板或者修改计划 的时间节点
standedTimeNodeList(val){ standedTimeNodeList(val){
// 只有固定模板或者修改才有固定的list
if(this.isStandedTemplate || this.planId){
console.log('我是修改或者固定模板')
this.activeTab = 0 + '';
this.setTimeNodeList = val this.setTimeNodeList = val
if(this.planId){//这一步,是处理新建计划选择固定模板,或者修改计划(无论固定还是自定义模板)监听传递进来的list
this.activeTab = 0;
this.timeForm = this.setTimeNodeList[this.activeTab]
this.timeForm.formRef = 'form' + this.activeTab;
}
this.$forceUpdate();
},
isStandedTemplate(val){
this.isStandedTemplate = val
console.log('是否固定模板',this.isStandedTemplate)
if(this.isStandedTemplate){
this.setTimeNodeList = this.standedTimeNodeList
this.activeTab = 0;
} }
}, },
setTimeNodeList(val){ setTimeNodeList(val){
this.setTimeNodeList = val this.timeUnit = val[0].timeUnit
if(this.setTimeNodeList.length>0) {
this.timeUnit = this.setTimeNodeList[0].timeUnit
this.markOptions.forEach((ob)=>{
if(this.timeUnit==ob.no){
this.timeUnitStr = ob.value
}
})
// 这里操作时间节点的数据 // 这里操作时间节点的数据
this.setTimeNodeList.forEach(item=>{ val.forEach((item,index)=>{
if((index > 0 && !this.isStandedTemplate) || this.isStandedTemplate){
item.isDisabled = true; item.isDisabled = true;
// item.timeUnit = this.setTimeNodeList[0].timeUnit item.timeUnit = this.timeUnit;
}else{
item.isDisabled = false;
}
if(item.remindList && item.remindList.length > 0){// remindDay 提醒医生预约提前天数 if(item.remindList && item.remindList.length > 0){// remindDay 提醒医生预约提前天数
item.remindDay = [] item.remindDay = []
item.remindList.forEach((kkk)=>{ item.remindList.forEach((kkk)=>{
...@@ -378,18 +261,13 @@ ...@@ -378,18 +261,13 @@
item.followResourceId.push(kkk.resourceId) item.followResourceId.push(kkk.resourceId)
}) })
} }
this.setTimeNodeList[index].formRef = 'form' + index;
}); });
this.$forceUpdate();
if(!this.isStandedTemplate){
this.setTimeNodeList[0].isDisabled = false;
}
}
}, },
patientIdList(val){ patientIdList(val){
// if(this.planId){//如果是修改计划,发送人数共享给各个时间节点
// 获取微信和短信用户数量 // 获取微信和短信用户数量
if(val.length > 0){
getPatientNumber({ getPatientNumber({
patientIdList: val patientIdList: val
}).then(res=>{ }).then(res=>{
...@@ -401,68 +279,69 @@ ...@@ -401,68 +279,69 @@
this.$notify.success({ this.$notify.success({
title: '提交失败', title: '提交失败',
message: res.message, message: res.message,
showClose: false showClose: false,
duration: 500
}); });
} }
}) })
// } }
}, },
// 保存
checkForm(val){ checkForm(val){
if(val){// 触发了 if(val){// 触发了 保存 校验
// console.log('触发 保存按钮的 校验',val) this.saveData();
// 触发 保存 校验 }
},
// console.log('是否固定模板',this.isStandedTemplate) },
// console.log('是否修改计划',this.planId) methods: {
// console.log('是否显示设置时间按钮',this.showSetBtn) // 初始化新的表单
// console.log('当前的检验是否通过了',this.isValied) initNewForm(){
// console.log('表单数据',this.timeForm) this.setTimeNodeList.push({
// console.log('activeTab',this.activeTab) formRef: 'form' + this.setTimeNodeList.length,
type: '',//随访方式
if(this.planId){//修改计划 timeNo: '',//随访时间
timeUnit: '',//随访时间单位
if(this.isStandedTemplate){//固定模板 remindList: [],//提醒医生预约提前天数
// 固定模板,无法修改 pushContentList: [],//推送患教提前天数 漫画id
this.$emit('addListenSave',{ followupList: [],//随访量表id
status: true, hasSelected: false,
setTimeNodeList: this.setTimeNodeList isDisabled: false,
remindDay: [],
pushDay: '',
followResourceId: [],
comentMsg: {},
followResourceIdStr: [],
totalNumber: 0,
wechatPatientNum: 0,
messagePatientNum: 0,
change: true
});
},
// 一次性获取常量接口数据
getConstData(){
// 随访时间节点单位
getBasicData({numList: 'P017'}).then(res=>{
this.markOptions = res.data.P017
}) })
}else{ //自定义模板 // 随访方式
getBasicData({numList: 'P212'}).then(res=>{
// 如果直接点击保存,需要进行对当前填写的表单进行校验 this.followTypeList = res.data.P212
console.log(this.timeForm)
const isValied = this.checkCurrentForm(this.timeForm.formRef);
this.isValied = isValied
if(isValied){
if(this.setTimeNodeList.length>0 && this.timeForm.timeNo==this.setTimeNodeList[0].timeNo){
}else{
this.checkTimeIsRepeat(()=>{
this.activeTab = this.setTimeNodeList.length;
this.timeForm.formRef = 'form' + this.activeTab;
this.setTimeNodeList.push(this.timeForm)
}) })
} // 提醒医生天数
getBasicData({numList: 'P213'}).then(res=>{
// 新增成功之后 this.remindOptions = res.data.P213
this.setTimeNodeList = this.sortKey(this.setTimeNodeList,'timeNo')
this.$emit('addListenSave',{
status: true,
setTimeNodeList: this.setTimeNodeList
}) })
// 推送患教提醒天数
}else{ getBasicData({numList: 'P214'}).then(res=>{
this.$emit('addListenSave',{ this.pushTimeOptions = res.data.P214
status: false,
setTimeNodeList: this.setTimeNodeList
}) })
} // 获取量表
} getFormOptions().then(res=>{
this.formOptions = res.data
} else{//新增计划 })
},
// 保存按钮
saveData(){
if(this.isStandedTemplate){//固定模板 if(this.isStandedTemplate){//固定模板
// 固定模板,无法修改 // 固定模板,无法修改
this.$emit('addListenSave',{ this.$emit('addListenSave',{
...@@ -471,151 +350,153 @@ ...@@ -471,151 +350,153 @@
}) })
}else{ }else{
// 如果直接点击保存,需要进行对当前填写的表单进行校验 // 如果直接点击保存,需要进行对当前填写的表单进行校验
const isValied = this.checkCurrentForm(this.timeForm.formRef); this.checkStart();
this.isValied = isValied
if(isValied){
if(this.setTimeNodeList.length>0 && this.timeForm.timeNo==this.setTimeNodeList[0].timeNo){
}else{
this.checkTimeIsRepeat(()=>{
this.activeTab = this.setTimeNodeList.length;
this.timeForm.formRef = 'form' + this.activeTab;
this.setTimeNodeList.push(this.timeForm)
})
}
//
// // 新增成功之后
this.setTimeNodeList = this.sortKey(this.setTimeNodeList,'timeNo')
}
if(this.isValied){ if(this.isValied){
let timeNo = this.setTimeNodeList[this.activeTab].timeNo;
this.checkIsRepeat(timeNo);
// 保存 校验通过后,排序 + 发送请求
// 新增成功之后
this.setTimeNodeList = this.sortKey(this.setTimeNodeList,'timeNo');
this.$emit('addListenSave',{ this.$emit('addListenSave',{
status: true, status: true,
setTimeNodeList: this.setTimeNodeList setTimeNodeList: this.setTimeNodeList
}) })
}else{ }else{
this.$notify.success({
title: '请填写完整表单',
message: '请填写完整表单',
showClose: false,
duration: 500
});
this.$emit('addListenSave',{ this.$emit('addListenSave',{
status: false, status: false,
setTimeNodeList: this.setTimeNodeList setTimeNodeList: this.setTimeNodeList
}) })
} }
} }
},
// 新增时间节点
addNewNode() {
//开始校验
this.checkStart();
} if(this.isValied){
let timeNo = this.setTimeNodeList[this.activeTab].timeNo;
this.checkIsRepeat(timeNo);
// 校验通过后,切换tab并且增加初始化list一个item
let newTabName = ++this.activeTab + '';
this.initNewForm();
this.activeTab = newTabName;
// 新增成功之后
this.setTimeNodeList = this.sortKey(this.setTimeNodeList,'timeNo');
console.log('当前tab',this.activeTab)
}else{
this.$notify.success({
title: '请填写完整表单',
message: '请填写完整表单',
showClose: false,
duration: 500
});
} }
}, },
timeForm(val) { // 删除时间节点
if(this.setTimeNodeList.length>0) { deleteTimeNode(index) {
this.timeForm.isDisabled = true; let listLen = this.setTimeNodeList.length;
this.timeForm.timeUnit = this.setTimeNodeList[0].timeUnit; if(listLen<=1){
alert('至少选择一个时间节点')
return;
}else{
this.$confirm('是否删除该时间节点?', '', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
this.setTimeNodeList.splice(parseFloat(index), 1);
this.activeTab = this.setTimeNodeList.length -1 + '';
this.$forceUpdate();
})
} }
}, },
// 校验开始
checkStart(){
console.log(this.setTimeNodeList)
let len = this.setTimeNodeList.length;
for(let i=0;i<len;i++){
let isValied = this.valiedForm(this.setTimeNodeList[i].formRef);
if(!isValied){
this.activeTab = i + '';
this.isValied = false;
return;
}else{
this.isValied = true
}
}
}, },
methods: { // 表单验证
// 一次性获取常量接口数据 valiedForm(form){
getConstData(){
// 随访时间节点单位
getBasicData({numList: 'P017'}).then(res=>{
this.markOptions = res.data.P017
})
// 随访方式
getBasicData({numList: 'P212'}).then(res=>{
this.followTypeList = res.data.P212
})
// 提醒医生天数
getBasicData({numList: 'P213'}).then(res=>{
this.remindOptions = res.data.P213
})
// 推送患教提醒天数
getBasicData({numList: 'P214'}).then(res=>{
this.pushTimeOptions = res.data.P214
})
// 获取量表
getFormOptions().then(res=>{
this.formOptions = res.data
})
},
checkCurrentForm(form){
let validback; let validback;
if(this.$refs[form].validate){ if(this.$refs[form].validate){
this.$refs[form].validate((valid) => { this.$refs[form].validate((valid) => {
// console.log('新的new校验结果' + valid)
validback = valid validback = valid
}); });
}else{ }else{
this.$refs[form][0].validate((valid) => { this.$refs[form][0].validate((valid) => {
// console.log('新的new校验结果' + valid)
validback = valid validback = valid
}); });
} }
return validback return validback
}, },
changeTabNew(index){ // 时间失去焦点
console.log('点击了下标',index) timeNoBlur(itemTimeForm){
this.activeTab= index this.checkIsRepeat(itemTimeForm.timeNo);
this.timeForm = this.setTimeNodeList[index] // 新增成功之后
this.setTimeNodeList = this.sortKey(this.setTimeNodeList,'timeNo');
}, },
// 验证是否重复 // 检查是否重复
checkTimeIsRepeat(callback){ checkIsRepeat(val){
this.timeIsRepeat = false;
if(this.setTimeNodeList.length > 0){
this.setTimeNodeList.forEach((item,index)=>{ this.setTimeNodeList.forEach((item,index)=>{
if(item.timeNo == this.timeForm.timeNo){ if(this.activeTab!=index && val==item.timeNo){
this.timeIsRepeat = true;
}
if(this.setTimeNodeList[0].timeNo==this.timeForm.timeNo){
this.timeIsRepeat = true;
}
})
}else{
this.timeIsRepeat = false;
}
if(this.timeIsRepeat){
this.$notify.success({ this.$notify.success({
title: '时间节点重复', title: '时间节点重复',
message: '时间节点重复', message: '时间节点重复',
showClose: false showClose: false,
duration: 500
}); });
}else{ this.isValied = false;
callback(); this.setTimeNodeList[this.activeTab].timeNo = '';
return;
} }
})
}, },
// 点击 新增时间节点 // 是否禁用按钮
addNewNode(str ,callback) { itemIsDisabled(item){
if(this.activeTab>=0){//如果是切换到当前tab let flag;
this.initNewForm(); if(this.isStandedTemplate){
this.activeTab = 'setNewRef'; flag = true;
this.showSetBtn = true;
}else{ }else{
if(item.change){
flag = false;
}else{
flag = true;
} }
const isValied = this.checkCurrentForm(this.timeForm.formRef);
this.isValied = isValied
if(isValied){
this.checkTimeIsRepeat(()=>{
if(this.showSetBtn){
this.activeTab = this.setTimeNodeList.length;
this.timeForm.formRef = 'form' + this.activeTab;
this.setTimeNodeList.push(this.timeForm)
// 新增成功之后
this.setTimeNodeList = this.sortKey(this.setTimeNodeList,'timeNo')
this.$forceUpdate();
//设置单位
this.markOptions.forEach((ob)=>{
if(this.setTimeNodeList[0].timeUnit==ob.no){
this.timeUnitStr = ob.value
} }
}) return flag;
},
// 是否可以删除时间节点
tabClosable(){
let flag;
if(this.isStandedTemplate){//固定模板,不可关闭
flag = false;
}else{
this.setTimeNodeList.forEach((item)=>{
if(item.change){
flag = true;
}else{
flag = false;
} }
this.initNewForm();
this.activeTab = 'setNewRef';
this.isValied = false;
}) })
} }
return flag;
}, },
// 是否显示选择添加漫画按钮 // 是否显示选择添加漫画按钮
showChoseComtent(timeObj){ showChoseComtent(timeObj){
...@@ -623,10 +504,14 @@ ...@@ -623,10 +504,14 @@
if(this.isStandedTemplate){ if(this.isStandedTemplate){
flag = false flag = false
}else{ }else{
if(this.planId){ if(this.planId && !timeObj.change){
flag = (timeObj.change && !timeObj.id) ? true : false flag = false;
}else{
if(timeObj.comentMsg && timeObj.comentMsg.id){
flag = false;
}else{ }else{
flag = (!timeObj.id) ? true : false flag = true;
}
} }
} }
return flag return flag
...@@ -637,47 +522,18 @@ ...@@ -637,47 +522,18 @@
if(this.isStandedTemplate){ if(this.isStandedTemplate){
flag = false flag = false
}else{ }else{
if(this.planId){ if(this.planId && timeObj.change && timeObj.comentMsg.id){
if(timeObj.change){
if(timeObj.id){
flag = true flag = true
}else{ }else{
flag = false if(timeObj.comentMsg.id){
} flag = true
}else{ }else{
flag = false flag = false
} }
}else{
flag = (!timeObj.id) ? true : false
} }
} }
return flag return flag
}, },
// 初始化新的表单
initNewForm(){
const timeFormInit = {
formRef: 'formsetNewRef',
type: '',//随访方式
timeNo: '',//随访时间
timeUnit: '',//随访时间单位
remindList: [],//提醒医生预约提前天数
pushContentList: [],//推送患教提前天数 漫画id
followupList: [],//随访量表id
hasSelected: false,
isDisabled: false,
remindDay: [],
pushDay: '',
followResourceId: [],
comentMsg: {},
followResourceIdStr: [],
totalNumber: 0,
wechatPatientNum: 0,
messagePatientNum: 0,
change: true
};
this.timeForm = timeFormInit;
},
goSelectCartoon() { goSelectCartoon() {
this.isSelectCartoon = true; this.isSelectCartoon = true;
}, },
...@@ -688,14 +544,11 @@ ...@@ -688,14 +544,11 @@
// 确认选择漫画 // 确认选择漫画
confirmSelectComent(val){ confirmSelectComent(val){
this.isSelectCartoon = false; this.isSelectCartoon = false;
// console.log('拿到的漫画选择组件的信息',val) console.log('当前的漫画选择组件的信息',val)
// console.log('当前的tab是',this.activeTab) console.log('当前的tab是',this.activeTab)
// console.log('当前表单信息',this.timeForm) console.log('当前是否固定模板',this.isStandedTemplate)
// console.log('当前是否固定模板',this.isStandedTemplate) console.log('当前的时间list',this.setTimeNodeList)
// console.log('当前的时间list',this.setTimeNodeList)
// console.log('选择的漫画信息',val)
if(this.planId){//修改
this.setTimeNodeList[this.activeTab].hasSelected = true; this.setTimeNodeList[this.activeTab].hasSelected = true;
this.setTimeNodeList[this.activeTab].comentMsg = val; this.setTimeNodeList[this.activeTab].comentMsg = val;
const comdata = this.setTimeNodeList[this.activeTab]; const comdata = this.setTimeNodeList[this.activeTab];
...@@ -705,95 +558,50 @@ ...@@ -705,95 +558,50 @@
sendContent: comdata.comentMsg.header_name sendContent: comdata.comentMsg.header_name
} }
this.setTimeNodeList[this.activeTab].pushContentList[0] = obj this.setTimeNodeList[this.activeTab].pushContentList[0] = obj
}else{//新增
this.timeForm.hasSelected = true;
this.timeForm.comentMsg = val;
const comdata = this.timeForm;
let obj = {
startDays: comdata.pushDay,
resourceId: comdata.comentMsg.id,
sendContent: comdata.comentMsg.header_name
}
this.timeForm.pushContentList[0] = obj;
}
}, },
deleteClick() { deleteClick(index) {
if(this.planId){ this.setTimeNodeList[index].hasSelected = false;
this.setTimeNodeList[this.activeTab].hasSelected = false; this.setTimeNodeList[index].comentMsg = {};
this.setTimeNodeList[this.activeTab].comentMsg = {}; this.setTimeNodeList[index].pushContentList.splice(0,1);
this.setTimeNodeList[this.activeTab].pushContentList.splice(0,1);
}else{
this.timeForm.hasSelected = false;
this.timeForm.comentMsg = {};
this.timeForm.pushContentList.splice(0,1);
}
this.$forceUpdate(); this.$forceUpdate();
}, },
deleteTimeNode(item, index) { // 选择提醒医生预约天数
this.$confirm('是否删除该时间节点?', '', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
this.setTimeNodeList.splice(index, 1)
// this.activeTab = 0;
// this.timeForm = this.setTimeNodeList[0];
if(this.setTimeNodeList.length == 0) {
//新增一个form
this.activeTab = 'setNewRef';
this.showSetBtn = true;
this.initNewForm();
}
this.$forceUpdate();
})
},
deleteAddNode() {
this.showSetBtn = false;
this.isValied = true;
this.activeTab = 0;
this.timeForm = this.setTimeNodeList[0];
this.$forceUpdate();
},
changeRemindDay(val){ changeRemindDay(val){
this.timeForm.remindList = [] this.setTimeNodeList[this.activeTab].remindList = []
val.forEach((item)=>{ val.forEach((item)=>{
this.timeForm.remindList.push({ this.setTimeNodeList[this.activeTab].remindList.push({
startDays: item startDays: item
}) })
}) })
this.$forceUpdate(); this.$forceUpdate();
}, },
// 选择推送患教提前天数
changePushDay(val){ changePushDay(val){
console.log(val)
let obj = { let obj = {
startDays: val, startDays: val,
resourceId: this.timeForm.comentMsg.id, resourceId: this.setTimeNodeList[this.activeTab].comentMsg.id,
sendContent: this.timeForm.comentMsg.header_name sendContent: this.setTimeNodeList[this.activeTab].comentMsg.header_name
} }
this.timeForm.pushContentList[0] = obj this.setTimeNodeList[this.activeTab].pushContentList[0] = obj
this.$forceUpdate(); this.$forceUpdate();
}, },
// 选择随访量表
changeFollowId(val){ changeFollowId(val){
console.log(val) this.setTimeNodeList[this.activeTab].followupList = []
this.timeForm.followupList = []
val.forEach((item)=>{ val.forEach((item)=>{
this.formOptions.forEach((item2)=>{ this.formOptions.forEach((item2)=>{
if(item2.scaleNo==item){ if(item2.scaleNo==item){
this.timeForm.followupList.push({ this.setTimeNodeList[this.activeTab].followupList.push({
resourceId: item, resourceId: item,
sendContent: item2.name sendContent: item2.name
}) })
} }
}) })
}) })
this.$forceUpdate(); this.$forceUpdate();
}, },
// 对时间节点进行排序
sortKey(array,key) { sortKey(array,key) {
let newList = array.sort((a,b)=>{ let newList = array.sort((a,b)=>{
const x = parseFloat(a[key]); const x = parseFloat(a[key]);
...@@ -802,18 +610,28 @@ ...@@ -802,18 +610,28 @@
}) })
return newList return newList
}, },
getNowTime() { //新建计划,根据第一个时间节点选择单位
const date = new Date(); choseTimeUit(val){
const year = date.getFullYear(); //设置单位
const month = date.getMonth() + 1; this.markOptions.forEach((ob)=>{
const day = date.getDate(); if(val == ob.no){
const hour = date.getHours(); this.timeUnitStr = ob.value
const minute = date.getMinutes(); }
const second = date.getSeconds(); })
let formName = `form${year}${month}${day}${hour}${minute}${second}`; },
return formName; showTabLabel(item){
let str;
if(!this.isStandedTemplate && !this.planId){
if(item.timeNo){
str = '开始后' + String(item.timeNo) + this.timeUnitStr
}else{
str = '设置时间节点'
}
}else{
str = '开始后' + String(item.timeNo) + this.timeUnitStr
}
return str
}, },
}, },
} }
</script> </script>
...@@ -829,7 +647,7 @@ ...@@ -829,7 +647,7 @@
width: 100%; width: 100%;
/*height: 60px;*/ /*height: 60px;*/
box-sizing: border-box; box-sizing: border-box;
background-color: #F0F2F5; /*background-color: #F0F2F5;*/
padding: 10px; padding: 10px;
overflow-x: scroll; overflow-x: scroll;
overflow-y: hidden; overflow-y: hidden;
......
...@@ -55,9 +55,11 @@ ...@@ -55,9 +55,11 @@
<el-date-picker <el-date-picker
v-model="baseInfo.time" v-model="baseInfo.time"
type="date" type="date"
ref="beginDate"
placeholder="请选择随访开始时间" placeholder="请选择随访开始时间"
:picker-options="pickerOptions" :picker-options="pickerOptions"
clearable clearable
@blur="handleDateInputConfirm"
style="width:380px;"> style="width:380px;">
</el-date-picker> </el-date-picker>
</el-form-item> </el-form-item>
...@@ -168,10 +170,6 @@ ...@@ -168,10 +170,6 @@
// 获取随访计划模板列表 // 获取随访计划模板列表
this.getFollowupTemplate() this.getFollowupTemplate()
}, },
mounted() {
//清理store中存的数据setTimeNodeList
},
computed: { computed: {
...mapState('planManage',{ ...mapState('planManage',{
remarkOption: state => state.remarkOption, remarkOption: state => state.remarkOption,
...@@ -186,6 +184,12 @@ ...@@ -186,6 +184,12 @@
// 点击保存,先进行校验,表单字段是否通过验证 // 点击保存,先进行校验,表单字段是否通过验证
this.checkForm = true this.checkForm = true
}, },
handleDateInputConfirm(e){
if(!this.baseInfo.time){
this.$refs.beginDate.picker.date = new Date();
}
},
// 监听保存校验结果 // 监听保存校验结果
addListenSave(val){ addListenSave(val){
console.log('监听保存校验结果',val) console.log('监听保存校验结果',val)
...@@ -195,7 +199,6 @@ ...@@ -195,7 +199,6 @@
// 提交 // 提交
createFollowPlan(this.baseInfo).then(res=>{ createFollowPlan(this.baseInfo).then(res=>{
if(res.code=='000000'){ if(res.code=='000000'){
// this.getTimeNodeList([]);
// 各种校验通过后,提交编辑内容,toast提示 // 各种校验通过后,提交编辑内容,toast提示
this.$notify.success({ this.$notify.success({
title: '', title: '',
...@@ -240,6 +243,9 @@ ...@@ -240,6 +243,9 @@
this.baseInfo.patientIdList.push(item.patientId); this.baseInfo.patientIdList.push(item.patientId);
}) })
this.baseInfo.hasSelectedNum = this.hasSelectedList.length; this.baseInfo.hasSelectedNum = this.hasSelectedList.length;
if(this.baseInfo.hasSelectedNum > 0){
this.noChoice = false;
}
}, },
continueAdd(val) { continueAdd(val) {
this.isShowSelectedDialog = val; this.isShowSelectedDialog = val;
...@@ -284,8 +290,6 @@ ...@@ -284,8 +290,6 @@
this.standedTimeNodeList = []; this.standedTimeNodeList = [];
this.activeTab = 'second'; this.activeTab = 'second';
} }
} else { } else {
return false; return false;
} }
...@@ -295,12 +299,6 @@ ...@@ -295,12 +299,6 @@
this.activeTab = 'first'; this.activeTab = 'first';
}, },
}, },
beforeRouteLeave (to, from, next) {
// 离开页面,需要清除缓存的时间节点
this.getTimeNodeList([])
next()
},
} }
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>
......
...@@ -235,39 +235,26 @@ ...@@ -235,39 +235,26 @@
}); });
}, },
saveModify() { saveModify() {
this.$confirm('是否确认保存修改内容?', '', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
// console.log(this.checkForm)
// 点击保存,先进行校验,表单字段是否通过验证 // 点击保存,先进行校验,表单字段是否通过验证
this.checkForm = true this.checkForm = true
// // 关闭弹层,继续创建
// this.planDetail.joinTime = '2019-04-09T16:00:00.000+0000'
// this.setFollowPlan(this.planDetail)
// /*this.$message({
// message: '修改成功!',
// type: 'success'
// });*/
// this.$router.back(-1)
}).catch(() => {
// 确定放弃,跳出当前编辑页面
});
}, },
// 监听保存校验结果 // 监听保存校验结果
addListenSave(val){ addListenSave(val){
console.log('监听保存校验结果',val) console.log('监听保存校验结果',val)
this.checkForm = false this.checkForm = false
if(val.status){ if(val.status){
this.$confirm('是否确认保存修改内容?', '', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
// 点击保存,先进行校验,表单字段是否通过验证
// 关闭弹层,继续创建 // 关闭弹层,继续创建
this.planDetailData.fPlanTimeReqList = val.setTimeNodeList this.planDetailData.fPlanTimeReqList = val.setTimeNodeList
this.planDetailData.joinTime = new Date();
console.log('修改计划前的数据===>>>',this.planDetailData) console.log('修改计划前的数据===>>>',this.planDetailData)
createFollowPlan(this.planDetailData).then(res=>{ createFollowPlan(this.planDetailData).then(res=>{
if(res.code=='000000'){ if(res.code=='000000'){
this.getTimeNodeList([]);
// 各种校验通过后,提交编辑内容,toast提示 // 各种校验通过后,提交编辑内容,toast提示
this.$notify.success({ this.$notify.success({
title: '', title: '',
...@@ -275,7 +262,9 @@ ...@@ -275,7 +262,9 @@
showClose: false showClose: false
}); });
setTimeout(()=>{ setTimeout(()=>{
this.$router.back(-1) this.$router.push({
path: '/followup/plan-manage/plan-list'
})
},2000) },2000)
}else{ }else{
this.$notify.success({ this.$notify.success({
...@@ -285,8 +274,14 @@ ...@@ -285,8 +274,14 @@
}); });
} }
}) })
})
}else{ }else{
console.log('点击保存按钮之后校验失败') this.$notify.success({
title: '请填写完整表单',
message: '请填写完整表单',
showClose: false,
duration: 500
});
} }
}, },
goToFollowTime() { goToFollowTime() {
......
Markdown 格式
0% or
您添加了 0 到此讨论。请谨慎行事。
先完成此消息的编辑!
想要评论请 注册