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