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

no message

上级 4747b577
...@@ -4,241 +4,134 @@ ...@@ -4,241 +4,134 @@
<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}} <div
<i class="deletelist el-icon-circle-close-outline" @click.stop="deleteTimeNode(item, index)" v-if="!isStandedTemplate && item.change"></i></div> v-show="index == activeTab"
</div> :key="index"
</div> :label="index"
<!--查看时间节点--> class="form-div"
<div class="form-div" > >
<div <el-form :ref="itemTimeForm.formRef" :model="itemTimeForm" :rules="timeFormRules" label-suffix=":" label-width="140px" :inline-message="true" size="small">
v-show="index == activeTab" <el-form-item label="本次随访时间" required>
v-for="(itemTimeForm, index) in setTimeNodeList" <div style="display: flex;">
:key="index" <el-form-item prop="timeNo">
:label="index" <el-input
> v-model="itemTimeForm.timeNo"
<el-form :ref="itemTimeForm.formRef" :model="itemTimeForm" :rules="timeFormRules" label-suffix=":" label-width="140px" :inline-message="true" size="small"> type="number"
<el-form-item label="本次随访时间" required> size="small"
<div style="display: flex;"> placeholder="请输入"
<el-form-item prop="timeNo"> :disabled="itemIsDisabled(itemTimeForm)"
<el-input @blur="timeNoBlur(itemTimeForm)"
v-model="itemTimeForm.timeNo" maxlength="2"
type="number" clearable />
size="small" </el-form-item>
placeholder="请输入" <el-form-item prop="timeUnit" class="ml20">
:disabled="isStandedTemplate || !itemTimeForm.change" <el-select v-model="itemTimeForm.timeUnit" placeholder="请选择" @change="choseTimeUit" :disabled="itemTimeForm.isDisabled">
maxlength="2" <el-option
clearable /> v-for="(item,index) in markOptions"
:key="index"
:label="item.value"
:value="item.no">
</el-option>
</el-select>
</el-form-item>
</div>
</el-form-item>
<el-form-item label="随访方式" prop="type">
<el-radio-group v-model="itemTimeForm.type" size="small">
<el-radio v-for="(item,index) in followTypeList" :key="index" :label="item.no" :disabled="itemIsDisabled(itemTimeForm)">{{item.value}}</el-radio>
</el-radio-group>
</el-form-item> </el-form-item>
<el-form-item prop="timeUnit" class="ml20"> <el-form-item label="提醒医生预约居民">
<el-select v-model="itemTimeForm.timeUnit" placeholder="请选择" :disabled="itemTimeForm.isDisabled || !itemTimeForm.change"> <el-select
v-model="itemTimeForm.remindDay"
multiple
:multiple-limit=3
:disabled="itemIsDisabled(itemTimeForm)"
@change="changeRemindDay"
placeholder="请选择">
<el-option <el-option
v-for="(item,index) in markOptions" v-for="(item,index) in remindOptions"
:key="index" :key="index"
:label="item.value" :label="item.value"
:value="item.no"> :value="item.no">
</el-option> </el-option>
</el-select> </el-select>
</el-form-item>
</div>
</el-form-item>
<el-form-item label="随访方式" prop="type">
<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-group>
</el-form-item>
<el-form-item label="提醒医生预约居民">
<el-select
v-model="itemTimeForm.remindDay"
multiple
:multiple-limit=3
:disabled="isStandedTemplate || !itemTimeForm.change"
@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-model="itemTimeForm.pushDay"
placeholder="选择推送时间"
clearable
@change="changePushDay"
:disabled="isStandedTemplate || !itemTimeForm.change"
>
<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="showChoseComtent(itemTimeForm)">选择健康漫画</el-button> </el-form-item>
<div class="selected-div ml20" v-if="itemTimeForm.hasSelected"> <el-form-item label="推送患教">
<span>{{itemTimeForm.comentMsg.header_name}}</span> <div style="display: flex">
<el-button type="text" @click="goSelectCartoon" v-if="showRechoseDelete(itemTimeForm)">重选</el-button> <el-select
<el-button type="text" @click="deleteClick" v-if="showRechoseDelete(itemTimeForm)">删除</el-button> v-model="itemTimeForm.pushDay"
placeholder="选择推送时间"
clearable
@change="changePushDay"
:disabled="itemIsDisabled(itemTimeForm)"
>
<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="showChoseComtent(itemTimeForm)">选择健康漫画</el-button>
<div class="selected-div ml20" v-if="itemTimeForm.hasSelected">
<h5>{{itemTimeForm.comentMsg.header_name}}</h5>
<el-button type="text" @click="goSelectCartoon" v-if="showRechoseDelete(itemTimeForm)">重选</el-button>
<el-button type="text" @click="deleteClick(index)" v-if="showRechoseDelete(itemTimeForm)">删除</el-button>
</div>
</div>
</el-form-item>
<div class="tips-contnt" v-if="itemTimeForm.hasSelected">
<p class="yellow-font">当前计划中共{{totalNumber}}位居民(微信:{{wechatPatientNum}}位,短信:{{messagePatientNum}}位),本次定时推送任务在发送当日预计需要{{messagePatientNum}}条短信额度(微信推送不消耗额度,建议您让居民关注云鹊健康微信公众号),务必提前确保短信额度的充足。</p>
<p>需要更多额度,请前往「云鹊医App-个人中心-啾啾币中心」兑换短信额度后再进行预约,您也可以联系云鹊医客服购买短信额度,客服电话:400-920-8877</p>
</div> </div>
</div> <el-form-item label="随访登记表">
</el-form-item> <el-select
<div class="tips-contnt" v-if="itemTimeForm.hasSelected"> v-model="itemTimeForm.followResourceId"
<p class="yellow-font">当前计划中共{{totalNumber}}位居民(微信:{{wechatPatientNum}}位,短信:{{messagePatientNum}}位),本次定时推送任务在发送当日预计需要{{messagePatientNum}}条短信额度(微信推送不消耗额度,建议您让居民关注云鹊健康微信公众号),务必提前确保短信额度的充足。</p> multiple
<p>需要更多额度,请前往「云鹊医App-个人中心-啾啾币中心」兑换短信额度后再进行预约,您也可以联系云鹊医客服购买短信额度,客服电话:400-920-8877</p> :multiple-limit=3
</div> @change="changeFollowId"
<el-form-item label="随访登记表"> :disabled="itemIsDisabled(itemTimeForm)"
<el-select placeholder="请选择">
v-model="itemTimeForm.followResourceId" <el-option
multiple v-for="(item_sub,index) in formOptions"
:multiple-limit=3 :key="index"
@change="changeFollowId" :label="item_sub.name"
:disabled="isStandedTemplate || !itemTimeForm.change" :value="item_sub.scaleNo">
placeholder="请选择"> </el-option>
<el-option </el-select>
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>
<!--新增时间节点-->
<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>
</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 </el-form-item>
v-if="!isStandedTemplate" </el-form>
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> </div>
</el-form-item> </el-tab-pane>
<div class="tips-contnt" v-if="timeForm.hasSelected"> </el-tabs>
<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>
</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 +151,11 @@ ...@@ -258,8 +151,11 @@
}, },
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){
return callback(new Error('请输入数字'));
}
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 +173,18 @@ ...@@ -277,17 +173,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,78 +215,61 @@ ...@@ -318,78 +215,61 @@
} }
}, },
watch: { watch: {
// 初始化 固定模板或者修改计划 的时间节点
standedTimeNodeList(val){ standedTimeNodeList(val){
this.setTimeNodeList = val // 只有固定模板或者修改才有固定的list
if(this.planId){//这一步,是处理新建计划选择固定模板,或者修改计划(无论固定还是自定义模板)监听传递进来的list if(this.isStandedTemplate || this.planId){
this.activeTab = 0; console.log('我是修改或者固定模板')
this.timeForm = this.setTimeNodeList[this.activeTab] this.activeTab = 0 + '';
this.timeForm.formRef = 'form' + this.activeTab; this.setTimeNodeList = val
}
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;
if(item.remindList && item.remindList.length > 0){// remindDay 提醒医生预约提前天数 }else{
item.remindDay = [] item.isDisabled = false;
item.remindList.forEach((kkk)=>{ }
item.remindDay.push(kkk.startDays) if(item.remindList && item.remindList.length > 0){// remindDay 提醒医生预约提前天数
}) item.remindDay = []
item.remindList.forEach((kkk)=>{
item.remindDay.push(kkk.startDays)
})
}
if(item.pushContentList && item.pushContentList.length > 0){//pushDay 推送患教提前天数
let pushData = item.pushContentList[0]
item.hasSelected = true
item.pushDay = pushData.startDays
item.comentMsg = {
id: pushData.resourceId,
header_name: pushData.sendContent
} }
if(item.pushContentList && item.pushContentList.length > 0){//pushDay 推送患教提前天数 }
let pushData = item.pushContentList[0] if(item.followupList && item.followupList.length > 0){ //followResourceId 随访量表
item.hasSelected = true item.followResourceId = []
item.pushDay = pushData.startDays item.followupList.forEach((kkk)=>{
item.comentMsg = { if(this.isStandedTemplate){
id: pushData.resourceId, this.formOptions = [
header_name: pushData.sendContent {
scaleNo: kkk.resourceId,
name: kkk.sendContent
}
]
} }
} item.followResourceId.push(kkk.resourceId)
if(item.followupList && item.followupList.length > 0){ //followResourceId 随访量表 })
item.followResourceId = []
item.followupList.forEach((kkk)=>{
if(this.isStandedTemplate){
this.formOptions = [
{
scaleNo: kkk.resourceId,
name: kkk.sendContent
}
]
}
item.followResourceId.push(kkk.resourceId)
})
}
});
if(!this.isStandedTemplate){
this.setTimeNodeList[0].isDisabled = false;
} }
} this.setTimeNodeList[index].formRef = 'form' + index;
});
this.$forceUpdate();
}, },
patientIdList(val){ patientIdList(val){
// if(this.planId){//如果是修改计划,发送人数共享给各个时间节点 // 获取微信和短信用户数量
// 获取微信和短信用户数量 if(val.length > 0){
getPatientNumber({ getPatientNumber({
patientIdList: val patientIdList: val
}).then(res=>{ }).then(res=>{
...@@ -401,119 +281,44 @@ ...@@ -401,119 +281,44 @@
this.$notify.success({ this.$notify.success({
title: '提交失败', title: '提交失败',
message: res.message, message: res.message,
showClose: false showClose: false,
duration: 500
}); });
} }
}) })
// }
},
checkForm(val){
if(val){// 触发了
// console.log('触发 保存按钮的 校验',val)
// 触发 保存 校验
// console.log('是否固定模板',this.isStandedTemplate)
// console.log('是否修改计划',this.planId)
// console.log('是否显示设置时间按钮',this.showSetBtn)
// console.log('当前的检验是否通过了',this.isValied)
// console.log('表单数据',this.timeForm)
// console.log('activeTab',this.activeTab)
if(this.planId){//修改计划
if(this.isStandedTemplate){//固定模板
// 固定模板,无法修改
this.$emit('addListenSave',{
status: true,
setTimeNodeList: this.setTimeNodeList
})
}else{ //自定义模板
// 如果直接点击保存,需要进行对当前填写的表单进行校验
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)
})
}
// 新增成功之后
this.setTimeNodeList = this.sortKey(this.setTimeNodeList,'timeNo')
this.$emit('addListenSave',{
status: true,
setTimeNodeList: this.setTimeNodeList
})
}else{
this.$emit('addListenSave',{
status: false,
setTimeNodeList: this.setTimeNodeList
})
}
}
} else{//新增计划
if(this.isStandedTemplate){//固定模板
// 固定模板,无法修改
this.$emit('addListenSave',{
status: true,
setTimeNodeList: this.setTimeNodeList
})
}else{
// 如果直接点击保存,需要进行对当前填写的表单进行校验
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)
})
}
//
// // 新增成功之后
this.setTimeNodeList = this.sortKey(this.setTimeNodeList,'timeNo')
}
if(this.isValied){
this.$emit('addListenSave',{
status: true,
setTimeNodeList: this.setTimeNodeList
})
}else{
this.$emit('addListenSave',{
status: false,
setTimeNodeList: this.setTimeNodeList
})
}
}
}
} }
}, },
timeForm(val) { // 保存
if(this.setTimeNodeList.length>0) { checkForm(val){
this.timeForm.isDisabled = true; if(val){// 触发了 保存 校验
this.timeForm.timeUnit = this.setTimeNodeList[0].timeUnit; this.saveData();
} }
}, },
}, },
methods: { methods: {
// 初始化新的表单
initNewForm(){
this.setTimeNodeList.push({
formRef: 'form' + this.setTimeNodeList.length,
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
});
},
// 一次性获取常量接口数据 // 一次性获取常量接口数据
getConstData(){ getConstData(){
// 随访时间节点单位 // 随访时间节点单位
...@@ -537,85 +342,163 @@ ...@@ -537,85 +342,163 @@
this.formOptions = res.data this.formOptions = res.data
}) })
}, },
// 保存按钮
checkCurrentForm(form){ saveData(){
let validback; if(this.isStandedTemplate){//固定模板
if(this.$refs[form].validate){ // 固定模板,无法修改
this.$refs[form].validate((valid) => { this.$emit('addListenSave',{
// console.log('新的new校验结果' + valid) status: true,
validback = valid setTimeNodeList: this.setTimeNodeList
}); })
}else{
// 如果直接点击保存,需要进行对当前填写的表单进行校验
this.checkStart();
if(this.isValied){
let timeNo = this.setTimeNodeList[this.activeTab].timeNo;
this.checkIsRepeat(timeNo);
// 保存 校验通过后,排序 + 发送请求
// 新增成功之后
this.setTimeNodeList = this.sortKey(this.setTimeNodeList,'timeNo');
this.$emit('addListenSave',{
status: true,
setTimeNodeList: this.setTimeNodeList
})
}else{ }else{
this.$refs[form][0].validate((valid) => { this.$notify.success({
// console.log('新的new校验结果' + valid) title: '请填写完整表单',
validback = valid message: '请填写完整表单',
showClose: false,
duration: 500
}); });
this.$emit('addListenSave',{
status: false,
setTimeNodeList: this.setTimeNodeList
})
} }
return validback }
}, },
changeTabNew(index){ // 新增时间节点
console.log('点击了下标',index) addNewNode() {
this.activeTab= index //开始校验
this.timeForm = this.setTimeNodeList[index] 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
});
}
}, },
// 验证是否重复 // 删除时间节点
checkTimeIsRepeat(callback){ deleteTimeNode(index) {
this.timeIsRepeat = false; let listLen = this.setTimeNodeList.length;
if(this.setTimeNodeList.length > 0){ if(listLen<=1){
this.setTimeNodeList.forEach((item,index)=>{ alert('至少选择一个时间节点')
if(item.timeNo == this.timeForm.timeNo){ return;
this.timeIsRepeat = true;
}
if(this.setTimeNodeList[0].timeNo==this.timeForm.timeNo){
this.timeIsRepeat = true;
}
})
}else{ }else{
this.timeIsRepeat = false; this.$confirm('是否删除该时间节点?', '', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
this.setTimeNodeList.splice(parseFloat(index), 1);
this.activeTab = this.setTimeNodeList.length -1 + '';
this.$forceUpdate();
})
} }
if(this.timeIsRepeat){ },
this.$notify.success({ // 校验开始
title: '时间节点重复', checkStart(){
message: '时间节点重复', console.log(this.setTimeNodeList)
showClose: false 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
}
}
},
// 表单验证
valiedForm(form){
let validback;
if(this.$refs[form].validate){
this.$refs[form].validate((valid) => {
validback = valid
}); });
}else{ }else{
callback(); this.$refs[form][0].validate((valid) => {
validback = valid
});
} }
return validback
}, },
// 点击 新增时间节点 // 时间失去焦点
addNewNode(str ,callback) { timeNoBlur(itemTimeForm){
if(this.activeTab>=0){//如果是切换到当前tab this.checkIsRepeat(itemTimeForm.timeNo);
this.initNewForm(); // 新增成功之后
this.activeTab = 'setNewRef'; this.setTimeNodeList = this.sortKey(this.setTimeNodeList,'timeNo');
this.showSetBtn = true; },
// 检查是否重复
checkIsRepeat(val){
this.setTimeNodeList.forEach((item,index)=>{
if(this.activeTab!=index && val==item.timeNo){
this.$notify.success({
title: '时间节点重复',
message: '时间节点重复',
showClose: false,
duration: 500
});
this.isValied = false;
this.setTimeNodeList[this.activeTab].timeNo = '';
return;
}
})
},
// 是否禁用按钮
itemIsDisabled(item){
let flag;
if(this.isStandedTemplate){
flag = true;
}else{ }else{
if(item.change){
flag = false;
}else{
flag = true;
}
} }
const isValied = this.checkCurrentForm(this.timeForm.formRef); return flag;
this.isValied = isValied },
if(isValied){ // 是否可以删除时间节点
this.checkTimeIsRepeat(()=>{ tabClosable(){
if(this.showSetBtn){ let flag;
this.activeTab = this.setTimeNodeList.length; if(this.isStandedTemplate){//固定模板,不可关闭
this.timeForm.formRef = 'form' + this.activeTab; flag = false;
this.setTimeNodeList.push(this.timeForm) }else{
// 新增成功之后 this.setTimeNodeList.forEach((item)=>{
this.setTimeNodeList = this.sortKey(this.setTimeNodeList,'timeNo') if(item.change){
this.$forceUpdate(); flag = true;
//设置单位 }else{
this.markOptions.forEach((ob)=>{ flag = false;
if(this.setTimeNodeList[0].timeUnit==ob.no){
this.timeUnitStr = ob.value
}
})
} }
this.initNewForm();
this.activeTab = 'setNewRef';
this.isValied = false;
}) })
} }
return flag;
}, },
// 是否显示选择添加漫画按钮 // 是否显示选择添加漫画按钮
showChoseComtent(timeObj){ showChoseComtent(timeObj){
...@@ -623,10 +506,14 @@ ...@@ -623,10 +506,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{ }else{
flag = (!timeObj.id) ? true : false if(timeObj.comentMsg && timeObj.comentMsg.id){
flag = false;
}else{
flag = true;
}
} }
} }
return flag return flag
...@@ -637,47 +524,18 @@ ...@@ -637,47 +524,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){ flag = true
if(timeObj.id){ }else{
flag = true if(timeObj.comentMsg.id){
}else{ flag = true
flag = false
}
}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,112 +546,64 @@ ...@@ -688,112 +546,64 @@
// 确认选择漫画 // 确认选择漫画
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) this.setTimeNodeList[this.activeTab].hasSelected = true;
this.setTimeNodeList[this.activeTab].comentMsg = val;
if(this.planId){//修改 const comdata = this.setTimeNodeList[this.activeTab];
this.setTimeNodeList[this.activeTab].hasSelected = true; const obj = {
this.setTimeNodeList[this.activeTab].comentMsg = val; startDays: comdata.pushDay,
const comdata = this.setTimeNodeList[this.activeTab]; resourceId: comdata.comentMsg.id,
const obj = { sendContent: comdata.comentMsg.header_name
startDays: comdata.pushDay,
resourceId: comdata.comentMsg.id,
sendContent: comdata.comentMsg.header_name
}
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() {
if(this.planId){
this.setTimeNodeList[this.activeTab].hasSelected = false;
this.setTimeNodeList[this.activeTab].comentMsg = {};
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.setTimeNodeList[this.activeTab].pushContentList[0] = obj
},
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() { deleteClick(index) {
this.showSetBtn = false; this.setTimeNodeList[index].hasSelected = false;
this.isValied = true; this.setTimeNodeList[index].comentMsg = {};
this.activeTab = 0; this.setTimeNodeList[index].pushContentList.splice(0,1);
this.timeForm = this.setTimeNodeList[0];
this.$forceUpdate(); 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 +612,28 @@ ...@@ -802,18 +612,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 +649,7 @@ ...@@ -829,7 +649,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;
......
...@@ -168,10 +168,6 @@ ...@@ -168,10 +168,6 @@
// 获取随访计划模板列表 // 获取随访计划模板列表
this.getFollowupTemplate() this.getFollowupTemplate()
}, },
mounted() {
//清理store中存的数据setTimeNodeList
},
computed: { computed: {
...mapState('planManage',{ ...mapState('planManage',{
remarkOption: state => state.remarkOption, remarkOption: state => state.remarkOption,
...@@ -195,7 +191,6 @@ ...@@ -195,7 +191,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: '',
...@@ -284,8 +279,6 @@ ...@@ -284,8 +279,6 @@
this.standedTimeNodeList = []; this.standedTimeNodeList = [];
this.activeTab = 'second'; this.activeTab = 'second';
} }
} else { } else {
return false; return false;
} }
...@@ -295,12 +288,6 @@ ...@@ -295,12 +288,6 @@
this.activeTab = 'first'; this.activeTab = 'first';
}, },
}, },
beforeRouteLeave (to, from, next) {
// 离开页面,需要清除缓存的时间节点
this.getTimeNodeList([])
next()
},
} }
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>
......
...@@ -232,58 +232,53 @@ ...@@ -232,58 +232,53 @@
}); });
}, },
saveModify() { saveModify() {
this.$confirm('是否确认保存修改内容?', '', { // 点击保存,先进行校验,表单字段是否通过验证
confirmButtonText: '确定', this.checkForm = true
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
// console.log(this.checkForm)
// 点击保存,先进行校验,表单字段是否通过验证
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('是否确认保存修改内容?', '', {
this.planDetailData.fPlanTimeReqList = val.setTimeNodeList confirmButtonText: '确定',
console.log('修改计划前的数据===>>>',this.planDetailData) cancelButtonText: '取消',
createFollowPlan(this.planDetailData).then(res=>{ type: 'warning'
if(res.code=='000000'){ }).then(() => {
this.getTimeNodeList([]); // 点击保存,先进行校验,表单字段是否通过验证
// 各种校验通过后,提交编辑内容,toast提示 // 关闭弹层,继续创建
this.$notify.success({ this.planDetailData.fPlanTimeReqList = val.setTimeNodeList
title: '', this.planDetailData.joinTime = new Date();
message: '修改成功', console.log('修改计划前的数据===>>>',this.planDetailData)
showClose: false createFollowPlan(this.planDetailData).then(res=>{
}); if(res.code=='000000'){
setTimeout(()=>{ // 各种校验通过后,提交编辑内容,toast提示
this.$router.back(-1) this.$notify.success({
},2000) title: '',
}else{ message: '修改成功',
this.$notify.success({ showClose: false
title: '修改失败', });
message: res.message, setTimeout(()=>{
showClose: false this.$router.push({
}); path: '/followup/plan-manage/plan-list'
} })
},2000)
}else{
this.$notify.success({
title: '修改失败',
message: res.message,
showClose: false
});
}
})
}) })
}else{ }else{
console.log('点击保存按钮之后校验失败') this.$notify.success({
title: '请填写完整表单',
message: '请填写完整表单',
showClose: false,
duration: 500
});
} }
}, },
goToFollowTime() { goToFollowTime() {
......
Markdown 格式
0% or
您添加了 0 到此讨论。请谨慎行事。
先完成此消息的编辑!
想要评论请 注册