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