提交 c4a334f0 编写于 作者: yi.li's avatar yi.li

Merge branch 'dev-followUp-20190312' of...

Merge branch 'dev-followUp-20190312' of 192.168.110.53:com.pica.cloud.education.frontend/pica.cloud.web-education-admin into dev-followUp-20190312
......@@ -18,12 +18,12 @@
v-if="showSetBtn && !isStandedTemplate">设置随访时间
<i class="el-icon-circle-close-outline" @click="deleteAddNode" v-if="setTimeNodeList.length>0"></i>
</div>
<div v-model="activeTab" type="card" closable @tab-remove="deleteTimeNode(item, index)">
<div v-model="activeTab" type="card" closable>
<div
v-for="(item, index) in setTimeNodeList"
:key="index"
@click="changeTabNew(index)"
v-text="isStandedTemplate ? item.timeStr : '开始后'+String(item.timeNo) + item.timeUnitStr"
v-text="isStandedTemplate ? item.timeStr : '开始后'+String(item.timeNo) + timeUnitStr"
:style="(index == activeTab)?'background:#3190e8;':''"
style="float:left;border:1px solid orange;padding:5px 10px;margin:0 5px;"
></div>
......@@ -32,7 +32,7 @@
<!--查看时间节点-->
<div class="form-div" >
<div
v-if="index == activeTab"
v-show="index == activeTab"
v-for="(item, index) in setTimeNodeList"
:key="index"
:label="index"
......@@ -209,11 +209,12 @@
clearable />
</el-form-item>
<el-form-item prop="timeUnit" class="ml20">
<el-select v-if="!isStandedTemplate && !planId" v-model="timeForm.timeUnit" placeholder="请选择" :disabled="timeForm.isDisabled">
<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>
......@@ -322,6 +323,8 @@
callback();
}
return {
timeUnit: '',
timeUnitStr: '',
timeFormRules: {
timeNo: [{ required: true, message: '请添加随访时间', trigger: 'change' },{ validator: checkDay, trigger: 'blur' }],
timeUnit: [{ required: true, message: '请添加随访时间', trigger: 'change' }],
......@@ -375,72 +378,42 @@
this.initNewForm();
this.getConstData();
// 如果是固定模板
console.log(this.isStandedTemplate)
console.log(this.planId)
if(this.isStandedTemplate || this.planId){
this.activeTab = 0;
}
//初始化一个随访时间节点
// this.activeTab = 'setNewRef';
// this.timeForm.formRef = this.getNowTime();
// this.setTimeNodeList.push(this.timeForm)
// console.log(this.isStandedTemplate)
// console.log(this.standedTimeNodeList)
},
watch: {
standedTimeNodeList(val){
this.setTimeNodeList = val
this.$forceUpdate(); //强制刷新,解决页面不会重新渲染的问题
},
setTimeNodeList(val){
this.setTimeNodeList = val
console.log(this.setTimeNodeList)
if(this.setTimeNodeList.length>0) {
if(this.timeForm){
this.timeForm.isDisabled = true;
this.timeForm.timeUnit = this.setTimeNodeList[0].timeUnit;
// if(this.isStandedTemplate || this.planId){
// this.deleteAddNode()
// }
}
this.timeUnit = this.setTimeNodeList[0].timeUnit
this.setTimeNodeList.forEach(item=>{
item.isDisabled = true;
item.timeUnit = this.setTimeNodeList[0].timeUnit
//
if(item.remindList && item.remindList.length > 0){// remindDay
item.remindDay = []
item.remindList.forEach((kkk)=>{
item.remindDay.push(kkk.startDays)
// if(this.isStandedTemplate){
// this.remindOptions = [
// {
// no: kkk.resourceId,
// value: kkk.sendContent
// }
// ]
// }
})
}
if(item.pushContentList && item.pushContentList.length){//pushDay
let pushData = item.pushContentList[0]
item.pushDay = pushData.startDays
// this.timeForm.startDaysStr = pushData.startDaysStr
item.comentMsg = {
id: pushData.resourceId,
header_name: pushData.sendContent
}
// this.closeSelectCartoon({
// closeStatus: false,
// hasSelected: this.timeForm.comentMsg
// })
}
if(item.followupList && item.followupList.length > 0){ //followResourceId
item.followResourceId = []
item.followupList.forEach((kkk)=>{
// item.sendContent = kkk.sendContent
if(this.isStandedTemplate){
this.formOptions = [
{
......@@ -453,42 +426,68 @@
})
}
});
if(!this.isStandedTemplate){
this.setTimeNodeList[0].isDisabled = false;
}
}
},
checkForm(val){
console.log('触发 保存 校验',val)
console.log('触发 保存按钮的 校验',val)
// 触发 保存 校验
// this.saveValiedBegin = val
if(val){
if(this.isStandedTemplate){
if(val){// 触发了
console.log('是否固定模板',this.isStandedTemplate)
console.log('是否修改计划',this.planId)
console.log(this.showSetBtn)
if(this.planId){//修改计划
if(this.isStandedTemplate){//固定模板
// 固定模板,无法修改
this.$emit('addListenSave',{
status: true,
setTimeNodeList: this.setTimeNodeList
})
}else{ //自定义模板
this.$emit('addListenSave',{
status: true,
setTimeNodeList: this.setTimeNodeList
})
}
}else{//新增计划
if(this.isStandedTemplate){//固定模板
// 固定模板,无法修改
this.$emit('addListenSave',{
status: true,
setTimeNodeList: this.setTimeNodeList
})
}else{
this.addNewNode('isSave')
this.$emit('addListenSave',{
status: true,
setTimeNodeList: this.setTimeNodeList
})
// // 校验的方法
// console.log('新建计划自定义模板!!!')
// this.addNewNode('isSave')
}
}
}
},
timeForm(val) {
// if(this.setTimeNodeList.length>0) {
// this.timeForm.isDisabled = true;
// this.timeForm.timeUnit = this.setTimeNodeList[0].timeUnit;
// }
// this.timeForm = val
// console.log('表单父组件的数据',this.timeForm)
if(this.setTimeNodeList.length>0) {
this.timeForm.isDisabled = true;
this.timeForm.timeUnit = this.setTimeNodeList[0].timeUnit;
}
this.timeForm = val
console.log('表单父组件的数据',this.timeForm)
},
setTimeNodeList1(val) {
if(val.length > 0){
......@@ -503,17 +502,9 @@
});
this.setTimeNodeList1[0].isDisabled = false;
}
// this.setTimeNodeList1 = this.sortKey(this.setTimeNodeList,'timeNo')
},
},
methods: {
// ...mapActions('planManage', [
// 'getDateUnit',
// 'getFollowTypeList',
// 'getRemindOptions',
// 'getPushTimeOptions',
// 'getFormOptions'
// ]),
// 一次性获取常量接口数据
getConstData(){
// 随访时间节点单位
......@@ -537,201 +528,20 @@
this.formOptions = res.data
})
},
// 校验通过之后,需要新增一个新的初始化的表单
checkValid(obj){
console.log('!!!!!!!!!!!!!!!!!!!!!')
console.log('校验结果',obj.valid)
// 校验结束
this.valBegin = false
// 校验通过了
if (obj.valid) {
this.checkTimeIsRepeat()
if(this.timeIsRepeat){
this.$notify.success({
title: '时间节点重复',
message: '时间节点重复',
showClose: false
});
if(obj.type=='save'){
this.$emit('addListenSave',false)
}
}else{
console.log(this.isStandedTemplate)
console.log(this.planId)
// 修改
if(this.planId){
console.log('修改计划中')
// 固定模板
if(this.isStandedTemplate){
// 只能保存提交
// this.setTimeNodeList.push(this.timeForm);
console.log('addListenSave',this.setTimeNodeList)
this.$emit('setTimeNodeListOnCom',this.setTimeNodeList)
this.$emit('addListenSave',true)
}else{
// 自定义普通修改
if(this.timeForm.remindDay.length>0){
this.timeForm.remindList = []
this.timeForm.remindDay.forEach((item)=>{
this.timeForm.remindList.push({
startDays: item
})
})
}
console.log(this.timeForm)
console.log(this.timeForm.followResourceIdStr)
if(this.timeForm.pushDay){
this.timeForm.pushContentList = []
this.timeForm.pushContentList.push({
startDays: this.timeForm.pushDay,
resourceId: this.timeForm.comentMsg.id,
sendContent: this.timeForm.comentMsg.header_name
})
}
if(this.timeForm.followResourceId.length>0){
this.timeForm.followupList = []
this.timeForm.followResourceId.forEach((item,index)=>{
this.timeForm.followupList.push({
resourceId: item,
sendContent : this.timeForm.followResourceIdStr?this.timeForm.followResourceIdStr[index]:''
})
})
}
if(this.showSetBtn){
this.setTimeNodeList.push(this.timeForm);
}
this.$emit('setTimeNodeListOnCom',this.setTimeNodeList)
console.log('addListenSave',this.setTimeNodeList)
// 保存按钮发起的校验
if(obj.type=='save'){
this.$emit('addListenSave',true)
}else{
this.initNewForm();
// console.log('初始化过之后activeTab=====> ',this.activeTab)
// this.timeForm.formRef = this.getNowTime();
this.timeForm.isDisabled = true;
}
}
}else{
// 新建
if(this.timeForm.remindDay && this.timeForm.remindDay.length>0){
this.timeForm.remindDay = []
this.timeForm.remindDay.forEach((item)=>{
this.timeForm.remindList.push({
startDays: item
})
})
}
console.log(this.timeForm)
console.log(this.timeForm.followResourceIdStr)
if(this.timeForm.pushDay){
this.timeForm.pushContentList = []
this.timeForm.pushContentList.push({
startDays: this.timeForm.pushDay,
resourceId: this.timeForm.comentMsg.id,
sendContent: this.timeForm.comentMsg.header_name
})
}
if(this.timeForm.followResourceId && this.timeForm.followResourceId.length>0){
this.timeForm.followupList = []
this.timeForm.followResourceId.forEach((item,index)=>{
this.timeForm.followupList.push({
resourceId: item,
sendContent : this.timeForm.followResourceIdStr?this.timeForm.followResourceIdStr[index]:''
})
})
}
if(this.showSetBtn){
this.setTimeNodeList.push(this.timeForm);
}
this.$emit('setTimeNodeListOnCom',this.setTimeNodeList)
// console.log('addListenSave',this.setTimeNodeList)
// 保存按钮发起的校验
if(obj.type=='save'){
this.$emit('addListenSave',true)
}else{
this.initNewForm();
// console.log('初始化过之后activeTab=====> ',this.activeTab)
// this.timeForm.formRef = this.getNowTime();
this.timeForm.isDisabled = true;
}
}
// 不是固定模板
// if(!this.isStandedTemplate){
// if(this.timeForm.remindDay.length>0){
// this.timeForm.remindDay.forEach((item)=>{
// this.timeForm.remindList.push({
// startDays: item
// })
// })
// }
// console.log(this.timeForm)
// console.log(this.timeForm.followResourceIdStr)
// if(this.timeForm.pushDay){
// this.timeForm.pushContentList.push({
// startDays: this.timeForm.pushDay,
// resourceId: this.timeForm.comentMsg.id,
// sendContent: this.timeForm.comentMsg.header_name
// })
// }
// if(this.timeForm.followResourceId.length>0){
// this.timeForm.followResourceId.forEach((item,index)=>{
// this.timeForm.followupList.push({
// resourceId: item,
// sendContent : this.timeForm.followResourceIdStr[index]
// })
// })
// }
//
// if(this.showSetBtn){
// this.setTimeNodeList.push(this.timeForm);
// }
// this.$emit('setTimeNodeListOnCom',this.setTimeNodeList)
// console.log('addListenSave',this.setTimeNodeList)
// // 保存按钮发起的校验
// if(obj.type=='save'){
// this.$emit('addListenSave',true)
// }else{
// this.initNewForm();
//// console.log('初始化过之后activeTab=====> ',this.activeTab)
// this.timeForm.formRef = this.getNowTime();
// this.timeForm.isDisabled = true;
// }
// }else if(this.planId){
//
// }else{// 是固定模板
// // 只能保存提交
//// this.setTimeNodeList.push(this.timeForm);
// console.log('addListenSave',this.setTimeNodeList)
// this.$emit('setTimeNodeListOnCom',this.setTimeNodeList)
// this.$emit('addListenSave',true)
// }
}
// 校验没通过
} else {
// 保存按钮发起的校验
if(obj.type=='save'){
this.$emit('addListenSave',false)
}
}
},
checkCurrentForm(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){
......@@ -740,58 +550,19 @@
console.log(this.setTimeNodeList)
this.timeForm = this.setTimeNodeList[index]
},
// 点击 新增时间节点
addNewNode(str) {
if(this.activeTab!='setNewRef' && str!='isSave'){
this.initNewForm();
this.activeTab = 'setNewRef'
}
this.showSetBtn = true;
this.$nextTick(()=>{
const isValied = this.checkCurrentForm(this.timeForm.formRef);
if(isValied){
// 验证时间数量是否重复
this.checkTimeIsRepeat(()=>{
this.activeTab = this.setTimeNodeList.length;
this.timeForm.formRef = 'form' + this.activeTab;
this.setTimeNodeList.push(this.timeForm)
// 验证完成后,判断如果是保存,告诉上层发送请求保存
if(str=='isSave'){
this.$emit('addListenSave',{
status: true,
setTimeNodeList: this.setTimeNodeList
})
}
this.initNewForm();
this.activeTab = 'setNewRef';
})
}else{
this.$emit('addListenSave',{
status: false,
setTimeNodeList: []
})
}
})
},
// 验证是否重复
checkTimeIsRepeat(callback){
this.timeIsRepeat = false;
console.log('=666666666666666!',this.setTimeNodeList)
console.log(this.timeForm)
if(this.setTimeNodeList.length > 0){
if(this.showSetBtn){
this.setTimeNodeList.forEach(item=>{
if(item.timeNo == this.timeForm.timeNo){
this.timeIsRepeat = true;
}
})
}else{
this.setTimeNodeList.forEach((item,index)=>{
if(index > 0){
if(item.timeNo == this.timeForm.timeNo){
this.timeIsRepeat = true;
}
}
})
}
}else{
this.timeIsRepeat = false;
}
if(this.timeIsRepeat){
this.$notify.success({
......@@ -801,18 +572,75 @@
});
}else{
callback();
// // 新增,则进行校验表单字段 触发校验
// if(this.activeTab == 'setNewRef') {
// // 校验开始
// this.valBegin = true
// }else {
// // 否则切换 已经新增的表单至新增节点表单
// this.activeTab = 'setNewRef';
}
},
// 点击 新增时间节点
addNewNode(str ,callback) {
const isValied = this.checkCurrentForm(this.timeForm.formRef);
console.log('isVlie=98989898',isValied)
if(isValied){
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.markOptions.forEach((ob)=>{
if(this.setTimeNodeList[0].timeUnit==ob.no){
this.timeUnitStr = ob.value
}
})
if(str=='isSave') {
this.addNewNode('isSave', () => {
this.$emit('addListenSave', {
status: true,
setTimeNodeList: this.setTimeNodeList
})
})
}
this.initNewForm();
this.activeTab = 'setNewRef';
})
}
//
//
//
//
// return
//
// if(this.activeTab!='setNewRef' && str!='isSave'){
// this.initNewForm();
// this.activeTab = 'setNewRef'
// }else if(this.planId && !this.isStandedTemplate){
// this.initNewForm();
// this.activeTab = 'setNewRef'
// }
// this.showSetBtn = true;
// this.initNewForm()
// this.$nextTick(()=>{
// console.log(this.timeForm)
// const isValied = this.checkCurrentForm(this.timeForm.formRef,()=>{
// // 验证时间数量是否重复
// this.checkTimeIsRepeat(()=>{
// this.activeTab = this.setTimeNodeList.length;
// this.timeForm.formRef = 'form' + this.activeTab;
// this.setTimeNodeList.push(this.timeForm)
// // 验证完成后,判断如果是保存,告诉上层发送请求保存
// if(str=='isSave'){
// callback();
//
// }
}
// this.initNewForm();
// this.activeTab = 'setNewRef';
// })
// });
// })
},
// 初始化新的表单
initNewForm(){
const timeFormInit = {
......@@ -846,21 +674,6 @@
deleteClick() {
this.timeForm.hasSelected = '';
},
// changeTab(val){
// debugger
// console.log('当前的 activeTab ',val)
// this.activeTab = val;
//console.log(this.setTimeNodeList)
// console.log(this.setTimeNodeList1)
//// this.setTimeNodeList1 = this.setTimeNodeList
//// this.timeForm = this.setTimeNodeList[val];
//// this.timeForm.formRef = this.getNowTime();
//
//
// if(val == 'setNewRef') {
// this.initNewForm();
// }
// },
deleteTimeNode(item, index) {
this.setTimeNodeList.splice(index, 1)
this.activeTab = 0;
......@@ -875,7 +688,7 @@
this.showSetBtn = false;
this.activeTab = 0;
this.timeForm = this.setTimeNodeList[0];
// this.timeForm.formRef = this.getNowTime();
this.$forceUpdate(); //强制刷新,解决页面不会重新渲染的问题
},
changeRemindDay(val){
......@@ -942,8 +755,6 @@
})
},
getNowTime() {
const date = new Date();
const year = date.getFullYear();
......@@ -961,7 +772,9 @@
var y = b[key];
return ((x<y) ? -1 : (x>y) ? 1 : 0)
})
}
},
},
}
</script>
......
......@@ -128,6 +128,7 @@
}
},
created() {
this.planId = String(this.$route.query.planId)
this.getPlanDetail(this.$route.query.planId); //获取计划详情
this.getRemarkOption()
this.getNodeTimeList(this.$route.query.planId); // 获取随访时间列表
......@@ -203,7 +204,7 @@
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
console.log(this.checkForm)
// console.log(this.checkForm)
// 点击保存,先进行校验,表单字段是否通过验证
this.checkForm = true
......@@ -224,10 +225,10 @@
addListenSave(val){
console.log('监听保存校验结果',val)
this.checkForm = false
if(val){
if(val.status){
// 关闭弹层,继续创建
this.planDetail.joinTime = '2019-04-09T16:00:00.000+0000'
this.planDetailData.fPlanTimeReqList = this.setTimeNodeList
this.planDetailData.fPlanTimeReqList = val.setTimeNodeList
console.log('修改计划前的数据===>>>',this.planDetailData)
createFollowPlan(this.planDetailData).then(res=>{
if(res.code=='000000'){
......@@ -267,14 +268,13 @@
planDetail(val) {
console.log(val)
this.planDetailData = val
// this.setTimeNodeListOnCom(val.fPlanTimeReqList)
this.setTimeNodeList = val.fPlanTimeReqList
this.planId = String(val.id)
if(val.resourceId){
if(this.planDetailData.resourceId){
this.isStandedTemplate = true
}else{
this.isStandedTemplate = false
}
},
selectResidentList(val) {
const _this = this
......
Markdown 格式
0% or
您添加了 0 到此讨论。请谨慎行事。
先完成此消息的编辑!
想要评论请 注册