提交 44c07cb8 编写于 作者: 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
...@@ -18,13 +18,33 @@ let loadingInstance = () => { ...@@ -18,13 +18,33 @@ let loadingInstance = () => {
background: 'rgba(0, 0, 0, 0.7)' background: 'rgba(0, 0, 0, 0.7)'
}); });
} }
let loading;
let needLoadingRequestCount = 0;
let showFullScreenLoading = () => {
if (needLoadingRequestCount === 0) {
loadingInstance();
}
needLoadingRequestCount++;
};
let tryHideFullScreenLoading = () => {
if (needLoadingRequestCount > 0) {
needLoadingRequestCount--;
}
if (needLoadingRequestCount === 0) {
loadingInstance().close();
}
};
// request拦截器 // request拦截器
service.interceptors.request.use(config => { service.interceptors.request.use(config => {
loadingInstance() if (config.noLoading) {
}else{
showFullScreenLoading();
}
if( config.headers['sysCode']==undefined) { if( config.headers['sysCode']==undefined) {
config.headers['sysCode'] = 12 config.headers['sysCode'] = 12
} }
// config.headers['token'] = 'F211893E7F3042CCA8CBBB0B90951722' // config.headers['token'] = 'AE013D42003D4BA3856FAD9DBDC82254'
config.headers['token'] = localStorage.getItem('storageToken') config.headers['token'] = localStorage.getItem('storageToken')
config.headers['deviceInfo'] = JSON.stringify({ "app_channel": "", "app_mac": "", "app_uuid": "", "app_version": "", "device_brand": "", "device_ip": "", "device_model": "", "device_net": "", "device_ops": "", "resolution_wh": "", "system_level": "", "device_type": '10' }) config.headers['deviceInfo'] = JSON.stringify({ "app_channel": "", "app_mac": "", "app_uuid": "", "app_version": "", "device_brand": "", "device_ip": "", "device_model": "", "device_net": "", "device_ops": "", "resolution_wh": "", "system_level": "", "device_type": '10' })
// if (config.data && config.data.setEntry) { // if (config.data && config.data.setEntry) {
...@@ -38,14 +58,17 @@ service.interceptors.request.use(config => { ...@@ -38,14 +58,17 @@ service.interceptors.request.use(config => {
return config return config
}, error => { }, error => {
// logger.debug('service.interceptors.request: ', error) // logger.debug('service.interceptors.request: ', error)
loadingInstance().close(); tryHideFullScreenLoading();
Promise.reject(error) Promise.reject(error)
}) })
// respone拦截器 // respone拦截器
service.interceptors.response.use( service.interceptors.response.use(
response => { response => {
loadingInstance().close(); if (response.config.noLoading) {
}else{
tryHideFullScreenLoading()
}
const res = response.data const res = response.data
/* /*
baseUrl时,返回000000为成功 baseUrl时,返回000000为成功
...@@ -59,7 +82,7 @@ service.interceptors.response.use( ...@@ -59,7 +82,7 @@ service.interceptors.response.use(
}, },
error => { error => {
// logger.error('err' + error) // logger.error('err' + error)
loadingInstance().close(); tryHideFullScreenLoading();
return Promise.reject(error) return Promise.reject(error)
} }
) )
......
...@@ -83,6 +83,7 @@ ...@@ -83,6 +83,7 @@
}, },
props: { props: {
isSelectCartoon: Boolean, isSelectCartoon: Boolean,
activeComentId: String,
}, },
watch: { watch: {
isSelectCartoon(val){ isSelectCartoon(val){
...@@ -99,16 +100,19 @@ ...@@ -99,16 +100,19 @@
this.picapEducationComtentsForNotHypertension = res.data.picapEducationComtentsForNotHypertension; this.picapEducationComtentsForNotHypertension = res.data.picapEducationComtentsForNotHypertension;
this.allList = [...this.picapEducationComtentsForHypertension,...this.picapEducationComtentsForNotHypertension]; this.allList = [...this.picapEducationComtentsForHypertension,...this.picapEducationComtentsForNotHypertension];
this.cartoonList = this.allList this.cartoonList = this.allList
this.articleTable = this.picapEducationComtentsForNotHypertension this.articleTable = this.picapEducationComtentsForNotHypertension
}) })
} }
}
}, },
created() { cartoonList(val){
if(this.activeComentId){
for(let i=0;i<val.length;i++){
if(val[i].id == this.activeComentId){
this.sendObj = val[i]
}
}
}
}
}, },
methods: { methods: {
changeDisease(val){ changeDisease(val){
...@@ -157,7 +161,14 @@ ...@@ -157,7 +161,14 @@
this.$emit('closeSelectCartoon') this.$emit('closeSelectCartoon')
}, },
sureSelect() { sureSelect() {
if(this.sendObj.id){
this.$emit('confirmSelectComent', this.sendObj); this.$emit('confirmSelectComent', this.sendObj);
}else{
this.$message({
message: '请选择漫画',
type: 'warning'
});
}
}, },
}, },
} }
......
...@@ -22,8 +22,6 @@ ...@@ -22,8 +22,6 @@
> >
<div <div
v-show="index == activeTab" v-show="index == activeTab"
:key="index"
:label="index"
class="form-div" 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">
...@@ -67,13 +65,12 @@ ...@@ -67,13 +65,12 @@
@change="changeRemindDay" @change="changeRemindDay"
placeholder="请选择"> placeholder="请选择">
<el-option <el-option
v-for="(item,index) in remindOptions" v-for="(item_sub,index) in remindOptions"
:key="index" :key="index"
:label="item.value" :label="item_sub.value"
:value="item.no"> :value="item_sub.no">
</el-option> </el-option>
</el-select> </el-select>
</el-form-item> </el-form-item>
<el-form-item label="推送患教"> <el-form-item label="推送患教">
<div style="display: flex"> <div style="display: flex">
...@@ -85,10 +82,10 @@ ...@@ -85,10 +82,10 @@
:disabled="itemIsDisabled(itemTimeForm)" :disabled="itemIsDisabled(itemTimeForm)"
> >
<el-option <el-option
v-for="(item,index) in pushTimeOptions" v-for="(item_sub,index) in pushTimeOptions"
:key="index" :key="index"
:label="item.value" :label="item_sub.value"
:value="item.no"> :value="item_sub.no">
</el-option> </el-option>
</el-select> </el-select>
...@@ -119,7 +116,6 @@ ...@@ -119,7 +116,6 @@
:value="item_sub.scaleNo"> :value="item_sub.scaleNo">
</el-option> </el-option>
</el-select> </el-select>
</el-form-item> </el-form-item>
</el-form> </el-form>
</div> </div>
...@@ -130,6 +126,7 @@ ...@@ -130,6 +126,7 @@
<select-cartoon <select-cartoon
:isSelectCartoon="isSelectCartoon" :isSelectCartoon="isSelectCartoon"
:activeComentId="activeComentId"
@closeSelectCartoon="closeSelectCartoon" @closeSelectCartoon="closeSelectCartoon"
@confirmSelectComent="confirmSelectComent" @confirmSelectComent="confirmSelectComent"
/> />
...@@ -152,7 +149,6 @@ ...@@ -152,7 +149,6 @@
}, },
data() { data() {
const checkDay = (rule, value, callback)=>{ const checkDay = (rule, value, callback)=>{
console.log(value)
const num = parseFloat(value); const num = parseFloat(value);
if(num < 0 || num > 100){ if(num < 0 || num > 100){
return callback(new Error('数字范围0-99')); return callback(new Error('数字范围0-99'));
...@@ -163,6 +159,7 @@ ...@@ -163,6 +159,7 @@
callback(); callback();
} }
return { return {
setTimeNodeList: [],
isValied: false, isValied: false,
timeUnit: '', timeUnit: '',
timeUnitStr: '', timeUnitStr: '',
...@@ -171,84 +168,91 @@ ...@@ -171,84 +168,91 @@
timeUnit: [{ required: true, message: '请添加随访时间', trigger: 'change' }], timeUnit: [{ required: true, message: '请添加随访时间', trigger: 'change' }],
type: [{ required: true, message: '请选择随访方式', trigger: 'change' }], type: [{ required: true, message: '请选择随访方式', trigger: 'change' }],
}, },
tabIndex:2,
setTimeNodeList: [],
timeIsRepeat: false, //验证时间是否重复
valBegin: false,
// isSelectCartoon: false,
// saveValiedBegin: false,
isSelectCartoon: false, isSelectCartoon: false,
activeTab: 0, activeTab: 0,
currentFormRef: 1, activeComentId: '',
// showSetBtn: true,
// timeForm: {},
markOptions: [], markOptions: [],
followTypeList: [], followTypeList: [],
remindOptions: [], remindOptions: [],
pushTimeOptions: [], pushTimeOptions: [],
formOptions: [], formOptions: [],
wechatPatientNum: 0, wechatPatientNum: 0,
messagePatientNum: 0, messagePatientNum: 0,
totalNumber: 0, totalNumber: 0,
activeResourceId: '',
} }
}, },
props: { props: {
resourceId: String,
standedTimeNodeList: Array, standedTimeNodeList: Array,
patientIdList: Array, patientIdList: Array,
checkForm: Boolean, checkForm: Boolean,
isStandedTemplate: Boolean, isStandedTemplate: Boolean,
planId: String, planId: String,
},
computed: {
}, },
created() { created() {
this.getConstData(); this.getConstData();
// 如果是固定模板 },
if(!this.isStandedTemplate && !this.planId){//新建计划并且是自定义模板 mounted(){
console.log(this.resourceId)
if(!this.planId){//新建计划
this.initNewForm(); this.initNewForm();
} }
}, },
watch: { watch: {
// 初始化 固定模板或者修改计划 的时间节点 // 初始化 固定模板或者修改计划 的时间节点
standedTimeNodeList(val){ standedTimeNodeList(val){
// 只有固定模板或者修改才有固定的list
if(this.isStandedTemplate || this.planId){ if(this.isStandedTemplate || this.planId){
console.log('我是修改或者固定模板')
this.activeTab = 0 + ''; this.activeTab = 0 + '';
this.setTimeNodeList = val this.setTimeNodeList = val;
this.$forceUpdate();
}
},
resourceId(val){
console.log('props=',val)
console.log('activeResourceId=',this.activeResourceId)
if(parseFloat(val) >= 0){
if(val!==this.activeResourceId){
this.activeTab = 0 + '';
this.setTimeNodeList = this.standedTimeNodeList;
this.$forceUpdate();
if(this.isStandedTemplate){// 系统固定模板
}else{//自定义模板
this.initNewForm();
}
}
} }
}, },
setTimeNodeList(val){ setTimeNodeList(val){
this.timeUnit = val[0].timeUnit this.setTimeNodeList = val;
if(this.setTimeNodeList.length > 0){
this.timeUnit = this.setTimeNodeList[0].timeUnit
// 这里操作时间节点的数据 // 这里操作时间节点的数据
val.forEach((item,index)=>{ this.setTimeNodeList.forEach((item,index)=>{
if((index > 0 && !this.isStandedTemplate) || this.isStandedTemplate){ if((index > 0 && !this.isStandedTemplate) || this.isStandedTemplate){
item.isDisabled = true; item.isDisabled = true;
item.timeUnit = this.timeUnit; item.timeUnit = this.timeUnit;
}else{ }else{
item.isDisabled = false; item.isDisabled = false;
} }
if(item.remindList && item.remindList.length > 0){// remindDay 提醒医生预约提前天数 if(item.remindList.length > 0){// remindDay 提醒医生预约提前天数
item.remindDay = [] item.remindDay = []
item.remindList.forEach((kkk)=>{ item.remindList.forEach((kkk)=>{
item.remindDay.push(kkk.startDays) item.remindDay.push(kkk.startDays)
}) })
} }
if(item.pushContentList && item.pushContentList.length > 0){//pushDay 推送患教提前天数 if(item.pushContentList.length > 0){//pushDay 推送患教提前天数
let pushData = item.pushContentList[0] let pushData = item.pushContentList[0]
item.hasSelected = true item.hasSelected = pushData.resourceId ? true : false;
item.pushDay = pushData.startDays item.pushDay = pushData.startDays
item.comentMsg = { item.comentMsg = {
id: pushData.resourceId, id: pushData.resourceId,
header_name: pushData.sendContent header_name: pushData.sendContent
} }
} }
if(item.followupList && item.followupList.length > 0){ //followResourceId 随访量表 if(item.followupList.length > 0){ //followResourceId 随访量表
item.followResourceId = [] item.followResourceId = []
item.followupList.forEach((kkk)=>{ item.followupList.forEach((kkk)=>{
if(this.isStandedTemplate){ if(this.isStandedTemplate){
...@@ -265,6 +269,8 @@ ...@@ -265,6 +269,8 @@
this.setTimeNodeList[index].formRef = 'form' + index; this.setTimeNodeList[index].formRef = 'form' + index;
}); });
this.$forceUpdate(); this.$forceUpdate();
}
}, },
patientIdList(val){ patientIdList(val){
// 获取微信和短信用户数量 // 获取微信和短信用户数量
...@@ -277,11 +283,9 @@ ...@@ -277,11 +283,9 @@
this.messagePatientNum = res.data.messagePatientNum; this.messagePatientNum = res.data.messagePatientNum;
this.totalNumber = this.wechatPatientNum + this.messagePatientNum this.totalNumber = this.wechatPatientNum + this.messagePatientNum
}else{ }else{
this.$notify.success({ this.$message({
title: '提交失败', message: '提交失败',
message: res.message, type: 'error'
showClose: false,
duration: 500
}); });
} }
}) })
...@@ -293,6 +297,14 @@ ...@@ -293,6 +297,14 @@
this.saveData(); this.saveData();
} }
}, },
markOptions(val){
//设置单位
val.forEach((ob)=>{
if(this.timeUnit == ob.no){
this.timeUnitStr = ob.value
}
})
}
}, },
methods: { methods: {
// 初始化新的表单 // 初始化新的表单
...@@ -350,6 +362,9 @@ ...@@ -350,6 +362,9 @@
setTimeNodeList: this.setTimeNodeList setTimeNodeList: this.setTimeNodeList
}) })
}else{ }else{
if(!this.checkHasChoseComent('save')){
return;
}
// 如果直接点击保存,需要进行对当前填写的表单进行校验 // 如果直接点击保存,需要进行对当前填写的表单进行校验
this.checkStart(); this.checkStart();
if(this.isValied){ if(this.isValied){
...@@ -363,24 +378,25 @@ ...@@ -363,24 +378,25 @@
setTimeNodeList: this.setTimeNodeList setTimeNodeList: this.setTimeNodeList
}) })
}else{ }else{
this.$notify.success({ this.$message({
title: '请填写完整表单',
message: '请填写完整表单', message: '请填写完整表单',
showClose: false, type: 'error'
duration: 500
}); });
this.$emit('addListenSave',{ this.$emit('addListenSave',{
status: false, status: false,
setTimeNodeList: this.setTimeNodeList setTimeNodeList: this.setTimeNodeList,
message: '请填写完整表单'
}) })
} }
} }
}, },
// 新增时间节点 // 新增时间节点
addNewNode() { addNewNode() {
if(!this.checkHasChoseComent()){
return;
}
//开始校验 //开始校验
this.checkStart(); this.checkStart();
if(this.isValied){ if(this.isValied){
let timeNo = this.setTimeNodeList[this.activeTab].timeNo; let timeNo = this.setTimeNodeList[this.activeTab].timeNo;
this.checkIsRepeat(timeNo); this.checkIsRepeat(timeNo);
...@@ -390,13 +406,10 @@ ...@@ -390,13 +406,10 @@
this.activeTab = newTabName; this.activeTab = newTabName;
// 新增成功之后 // 新增成功之后
this.setTimeNodeList = this.sortKey(this.setTimeNodeList,'timeNo'); this.setTimeNodeList = this.sortKey(this.setTimeNodeList,'timeNo');
console.log('当前tab',this.activeTab)
}else{ }else{
this.$notify.success({ this.$message({
title: '请填写完整表单',
message: '请填写完整表单', message: '请填写完整表单',
showClose: false, type: 'error'
duration: 500
}); });
} }
}, },
...@@ -404,7 +417,10 @@ ...@@ -404,7 +417,10 @@
deleteTimeNode(index) { deleteTimeNode(index) {
let listLen = this.setTimeNodeList.length; let listLen = this.setTimeNodeList.length;
if(listLen<=1){ if(listLen<=1){
alert('至少选择一个时间节点') this.$message({
message: '至少选择一个时间节点',
type: 'warning'
});
return; return;
}else{ }else{
this.$confirm('是否删除该时间节点?', '', { this.$confirm('是否删除该时间节点?', '', {
...@@ -418,9 +434,48 @@ ...@@ -418,9 +434,48 @@
}) })
} }
}, },
// 校验漫画是否选择
checkHasChoseComent(type){
let pushData = this.setTimeNodeList[this.activeTab].pushContentList;
const len = pushData.length;
const startDays = len ? pushData[0].startDays : null;
const resourceId = len ? pushData[0].resourceId : null;
console.log(pushData)
// 如果选了推送时间,没选漫画
if(len && (startDays!==''&&startDays >= 0) && !resourceId){
this.$message({
message: '请选择推送的患教漫画',
type: 'error'
});
if(type=='save'){
this.$emit('addListenSave',{
status: false,
setTimeNodeList: this.setTimeNodeList,
message: '请选择推送的患教漫画'
})
}
return false;
}else if(len && startDays === '' && resourceId){
//如果选了漫画,没选推送时间
this.$message({
message: '请选择推送时间',
type: 'error'
});
if(type=='save'){
this.$emit('addListenSave',{
status: false,
setTimeNodeList: this.setTimeNodeList,
message: '请选择推送时间'
})
}
return false;
}else{
return true;
}
},
// 校验开始 // 校验开始
checkStart(){ checkStart(){
console.log(this.setTimeNodeList) // 如果选择了患教推送时间,则必须选择漫画,否则过不了校验
let len = this.setTimeNodeList.length; let len = this.setTimeNodeList.length;
for(let i=0;i<len;i++){ for(let i=0;i<len;i++){
let isValied = this.valiedForm(this.setTimeNodeList[i].formRef); let isValied = this.valiedForm(this.setTimeNodeList[i].formRef);
...@@ -457,11 +512,9 @@ ...@@ -457,11 +512,9 @@
checkIsRepeat(val){ checkIsRepeat(val){
this.setTimeNodeList.forEach((item,index)=>{ this.setTimeNodeList.forEach((item,index)=>{
if(this.activeTab!=index && val==item.timeNo){ if(this.activeTab!=index && val==item.timeNo){
this.$notify.success({ this.$message({
title: '时间节点重复',
message: '时间节点重复', message: '时间节点重复',
showClose: false, type: 'warning'
duration: 500
}); });
this.isValied = false; this.isValied = false;
this.setTimeNodeList[this.activeTab].timeNo = ''; this.setTimeNodeList[this.activeTab].timeNo = '';
...@@ -549,7 +602,7 @@ ...@@ -549,7 +602,7 @@
console.log('当前的tab是',this.activeTab) console.log('当前的tab是',this.activeTab)
console.log('当前是否固定模板',this.isStandedTemplate) console.log('当前是否固定模板',this.isStandedTemplate)
console.log('当前的时间list',this.setTimeNodeList) console.log('当前的时间list',this.setTimeNodeList)
this.activeComentId = String(val.id);
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];
...@@ -564,7 +617,10 @@ ...@@ -564,7 +617,10 @@
deleteClick(index) { deleteClick(index) {
this.setTimeNodeList[index].hasSelected = false; this.setTimeNodeList[index].hasSelected = false;
this.setTimeNodeList[index].comentMsg = {}; this.setTimeNodeList[index].comentMsg = {};
this.setTimeNodeList[index].pushContentList.splice(0,1); // this.setTimeNodeList[index].pushContentList.splice(0,1);
this.setTimeNodeList[index].pushContentList[0].resourceId = null
this.setTimeNodeList[index].pushContentList[0].sendContent = null
this.activeComentId = '';
this.$forceUpdate(); this.$forceUpdate();
}, },
// 选择提醒医生预约天数 // 选择提醒医生预约天数
...@@ -620,17 +676,27 @@ ...@@ -620,17 +676,27 @@
} }
}) })
}, },
// 显示tab文字
showTabLabel(item){ showTabLabel(item){
let str; let str;
if(!this.isStandedTemplate && !this.planId){ if(this.isStandedTemplate || this.planId){
str = item.timeStr;
}else{
if(item.timeNo){ if(item.timeNo){
str = '开始后' + String(item.timeNo) + this.timeUnitStr str = '开始后' + String(item.timeNo) + this.timeUnitStr
}else{ }else{
str = '设置时间节点' str = '设置时间节点'
} }
}else{
str = '开始后' + String(item.timeNo) + this.timeUnitStr
} }
// 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 return str
}, },
}, },
......
...@@ -81,7 +81,7 @@ ...@@ -81,7 +81,7 @@
<div class="edit-plan-content" v-show="activeTab === 'second'"> <div class="edit-plan-content" v-show="activeTab === 'second'">
<set-time-node <set-time-node
ref="getTimeNodeList" :resourceId="resourceId"
:standedTimeNodeList="standedTimeNodeList" :standedTimeNodeList="standedTimeNodeList"
:isStandedTemplate="isStandedTemplate" :isStandedTemplate="isStandedTemplate"
:patientIdList="baseInfo.patientIdList" :patientIdList="baseInfo.patientIdList"
...@@ -216,6 +216,11 @@ ...@@ -216,6 +216,11 @@
}); });
} }
}) })
}else{
this.$message({
message: val.message,
type: 'error'
});
} }
}, },
selectPatientHandler() { selectPatientHandler() {
...@@ -258,7 +263,6 @@ ...@@ -258,7 +263,6 @@
// 关闭弹层,继续创建 // 关闭弹层,继续创建
}).catch(() => { }).catch(() => {
// 确定放弃,跳出当前编辑页面 // 确定放弃,跳出当前编辑页面
// this.getTimeNodeList([])
this.$router.push({path: '/followup/plan-manage/plan-list'}) this.$router.push({path: '/followup/plan-manage/plan-list'})
}); });
}, },
...@@ -275,11 +279,11 @@ ...@@ -275,11 +279,11 @@
} }
if (valid) { if (valid) {
console.log('当前选择的随访模板id为',this.baseInfo.resourceId) console.log('当前选择的随访模板id为',this.baseInfo.resourceId)
this.resourceId = this.baseInfo.resourceId this.resourceId = String(this.baseInfo.resourceId)
console.log( this.baseInfo.resourceId) // console.log( this.baseInfo.resourceId)
if(this.baseInfo.resourceId){ if(this.baseInfo.resourceId){
this.isStandedTemplate = true
getFollowupTableTemplate(this.baseInfo.resourceId).then(res=>{ getFollowupTableTemplate(this.baseInfo.resourceId).then(res=>{
this.isStandedTemplate = true
this.standedTimeNodeList = res.data this.standedTimeNodeList = res.data
this.activeTab = 'second'; this.activeTab = 'second';
}) })
......
...@@ -274,11 +274,9 @@ ...@@ -274,11 +274,9 @@
}) })
}) })
}else{ }else{
this.$notify.success({ this.$message({
title: '请填写完整表单', message: val.message,
message: '请填写完整表单', type: 'error'
showClose: false,
duration: 500
}); });
} }
}, },
......
Markdown 格式
0% or
您添加了 0 到此讨论。请谨慎行事。
先完成此消息的编辑!
想要评论请 注册