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

新建计划修改

上级 989a7988
...@@ -10,7 +10,7 @@ ...@@ -10,7 +10,7 @@
center :lock-scroll="false"> center :lock-scroll="false">
<div class="selected-dialog-content"> <div class="selected-dialog-content">
<div class="title-div"> <div class="title-div">
<el-button type="primary" @click="continueAdd">继续添加</el-button> <el-button type="primary" size="small" @click="continueAdd">继续添加</el-button>
</div> </div>
<el-table <el-table
:data="hasSelectedList" :data="hasSelectedList"
......
...@@ -9,7 +9,7 @@ ...@@ -9,7 +9,7 @@
:close-on-press-escape="false" :close-on-press-escape="false"
center> center>
<div class="finish-content"> <div class="finish-content">
<el-form ref="searchData" :model="searchData" :inline="true" class="select-width"> <el-form ref="searchData" :model="searchData" :inline="true" class="select-width" size="small">
<el-form-item> <el-form-item>
<el-select v-model="searchData.sex"> <el-select v-model="searchData.sex">
<el-option <el-option
...@@ -113,8 +113,8 @@ ...@@ -113,8 +113,8 @@
</el-row> </el-row>
</div> </div>
<div slot="footer" class="dialog-footer"> <div slot="footer" class="dialog-footer">
<el-button @click="clickClose" plain>取 消</el-button> <el-button @click="clickClose" size="small" plain>取 消</el-button>
<el-button type="primary" @click="sureClick">确 定</el-button> <el-button type="primary" size="small" @click="sureClick">确 定</el-button>
</div> </div>
</el-dialog> </el-dialog>
</div> </div>
......
...@@ -26,7 +26,7 @@ ...@@ -26,7 +26,7 @@
</el-select> </el-select>
</el-form-item> </el-form-item>
<el-form-item prop="followupMark" class="ml20"> <el-form-item prop="followupMark" class="ml20">
<el-select v-model="timeFormHas.followupMark" placeholder="请选择"> <el-select v-model="timeFormHas.followupMark" placeholder="请选择" :disabled="timeFormHas.isDisabled">
<el-option <el-option
v-for="item in markOptions" v-for="item in markOptions"
:key="item.value" :key="item.value"
...@@ -113,7 +113,7 @@ ...@@ -113,7 +113,7 @@
</el-select> </el-select>
</el-form-item> </el-form-item>
<el-form-item prop="followupMark" class="ml20"> <el-form-item prop="followupMark" class="ml20">
<el-select v-model="timeForm.followupMark" placeholder="请选择"> <el-select v-model="timeForm.followupMark" placeholder="请选择" :disabled="timeForm.isDisabled">
<el-option <el-option
v-for="item in markOptions" v-for="item in markOptions"
:key="item.value" :key="item.value"
...@@ -192,7 +192,7 @@ ...@@ -192,7 +192,7 @@
<script> <script>
import _ from 'lodash'; import _ from 'lodash';
import SelectCartoon from '@/views/followup/plan-manage/dialog/select-cartoon'; import SelectCartoon from '@/views/followup/plan-manage/dialog/select-cartoon';
import { mapState } from 'vuex'
const timeFormInit = { const timeFormInit = {
formRef: '', formRef: '',
followupTime: '', followupTime: '',
...@@ -202,6 +202,7 @@ ...@@ -202,6 +202,7 @@
remindTime: [], remindTime: [],
followupForm: [], followupForm: [],
hasSelected: '', hasSelected: '',
isDisabled: false,
}; };
export default { export default {
...@@ -212,7 +213,6 @@ ...@@ -212,7 +213,6 @@
return { return {
isSelectCartoon: false, isSelectCartoon: false,
activeTab: null, activeTab: null,
setTimeNodeList: [],
currentFormRef: 1, currentFormRef: 1,
showSetBtn: true, showSetBtn: true,
timeForm: _.cloneDeep(timeFormInit), timeForm: _.cloneDeep(timeFormInit),
...@@ -293,31 +293,50 @@ ...@@ -293,31 +293,50 @@
}, },
} }
}, },
props: {},
computed: { computed: {
...mapState('planManage',{
setTimeNodeList: state => state.setTimeNodeList,
}),
setTimeNodeList1:function(){ setTimeNodeList1:function(){
return this.sortKey(this.setTimeNodeList,'followupTime') return this.sortKey(this.setTimeNodeList,'followupTime')
} },
followupMarkOne() {
return this.setTimeNodeList1[0].followupMark;
},
}, },
created() { created() {
//初始化一个随访时间节点 //初始化一个随访时间节点
if(this.setTimeNodeList.length === 0){ this.activeTab = 'setNewRef';
this.activeTab = 'setNewRef'; this.timeForm.formRef = this.getNowTime();
this.timeForm.formRef = this.getNowTime(); if(this.setTimeNodeList.length>0) {
this.timeForm.isDisabled = true;
this.timeForm.followupMark = this.setTimeNodeList[0].followupMark;
} }
}, },
watch: {}, watch: {
methods: { timeForm(newVal, oldVal) {
getNowTime() { if(this.setTimeNodeList.length>0) {
const date = new Date(); this.timeForm.isDisabled = true;
const year = date.getFullYear(); this.timeForm.followupMark = this.setTimeNodeList[0].followupMark;
const month = date.getMonth() + 1; }
const day = date.getDate(); },
const hour = date.getHours(); setTimeNodeList1(newVal, oldVal) {
const minute = date.getMinutes(); this.setTimeNodeList1.map(item=>{
const second = date.getSeconds(); item.isDisabled = true;
let formName = `form${year}${month}${day}${hour}${minute}${second}`; item.followupMark = this.setTimeNodeList1[0].followupMark
return formName; });
this.setTimeNodeList1[0].isDisabled = false;
}, },
followupMarkOne(newVal, oldVal){
if(newVal != oldVal){
this.setTimeNodeList1.map(item=>{
item.followupMark = this.setTimeNodeList1[0].followupMark
});
}
}
},
methods: {
addNewNode(formName) { addNewNode(formName) {
if(this.activeTab !== 'setNewRef') { if(this.activeTab !== 'setNewRef') {
this.activeTab = 'setNewRef'; this.activeTab = 'setNewRef';
...@@ -328,9 +347,9 @@ ...@@ -328,9 +347,9 @@
this.$refs[formName].validate((valid) => { this.$refs[formName].validate((valid) => {
if (valid) { if (valid) {
this.setTimeNodeList.push(this.timeForm); this.setTimeNodeList.push(this.timeForm);
// this.store.commit('SET_TIME_NODE_LIST',this.setTimeNodeList)
this.timeForm = _.cloneDeep(timeFormInit); this.timeForm = _.cloneDeep(timeFormInit);
this.timeForm.formRef = this.getNowTime(); //新增一个form this.timeForm.formRef = this.getNowTime(); //新增一个form
this.timeForm.isDisabled = true; //新增一个form
} else { } else {
return; return;
} }
...@@ -358,16 +377,28 @@ ...@@ -358,16 +377,28 @@
this.setTimeNodeList.splice(index, 1) this.setTimeNodeList.splice(index, 1)
this.activeTab = 0; this.activeTab = 0;
if(this.setTimeNodeList.length == 0) { if(this.setTimeNodeList.length == 0) {
//新增一个form
this.activeTab = 'setNewRef'; this.activeTab = 'setNewRef';
this.showSetBtn = true; this.showSetBtn = true;
this.timeForm = _.cloneDeep(timeFormInit); this.timeForm = _.cloneDeep(timeFormInit);
this.timeForm.formRef = this.getNowTime(); //新增一个form this.timeForm.formRef = this.getNowTime();
} }
}, },
deleteAddNode() { deleteAddNode() {
this.showSetBtn = false; this.showSetBtn = false;
this.activeTab = 0; this.activeTab = 0;
}, },
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;
},
sortKey(array,key) { sortKey(array,key) {
return array.sort(function(a,b){ return array.sort(function(a,b){
var x = a[key]; var x = a[key];
......
...@@ -22,6 +22,7 @@ ...@@ -22,6 +22,7 @@
<el-button type="primary" size="small" @click="saveEdit">保 存</el-button> <el-button type="primary" size="small" @click="saveEdit">保 存</el-button>
</div> </div>
</div> </div>
<div class="edit-plan-content" v-if="activeTab === 'first'"> <div class="edit-plan-content" v-if="activeTab === 'first'">
<el-form ref="baseInfo" :model="baseInfo" :rules="rules" label-suffix=":" label-width="140px" :inline-message="true" size="small"> <el-form ref="baseInfo" :model="baseInfo" :rules="rules" label-suffix=":" label-width="140px" :inline-message="true" size="small">
<el-form-item label="随访计划名称" prop="name"> <el-form-item label="随访计划名称" prop="name">
...@@ -76,9 +77,8 @@ ...@@ -76,9 +77,8 @@
</div> </div>
<div class="edit-plan-content" v-if="activeTab === 'second'"> <div class="edit-plan-content" v-if="activeTab === 'second'">
<set-time-node></set-time-node> <set-time-node ref="getTimeNodeList"></set-time-node>
</div> </div>
</div> </div>
<select-patient :isShowSelectPatient="isShowSelectPatient" @closeSelectPatient="closeSelectPatient" @sureSelectPatient="sureSelectPatient(arguments)"></select-patient> <select-patient :isShowSelectPatient="isShowSelectPatient" @closeSelectPatient="closeSelectPatient" @sureSelectPatient="sureSelectPatient(arguments)"></select-patient>
...@@ -92,7 +92,7 @@ ...@@ -92,7 +92,7 @@
import HasSelectedPatient from '@/views/followup/plan-manage/dialog/has-selected-patient'; import HasSelectedPatient from '@/views/followup/plan-manage/dialog/has-selected-patient';
import SetTimeNode from '@/views/followup/plan-manage/dialog/set-time-node'; import SetTimeNode from '@/views/followup/plan-manage/dialog/set-time-node';
// import { mapState, mapActions } from 'vuex' import { mapState, mapActions } from 'vuex'
export default { export default {
name: "addNewPlan", name: "addNewPlan",
components: { components: {
...@@ -152,19 +152,15 @@ ...@@ -152,19 +152,15 @@
} }
}, },
created() { created() {
}, },
mounted() { mounted() {
// this.getResidentList({ //清理store中存的数据setTimeNodeList
// planId: this.$route.query.planId
// });
// this.getGroupList(); //获取分组列表
}, },
computed: { computed: {
// ...mapState('planManage',{ ...mapState('planManage',{
// residentList: state => state.residentList, setTimeNodeList: state => state.setTimeNodeList,
// groupList: state => state.groupList })
// })
}, },
methods: { methods: {
// ...mapActions('planManage', ['getResidentList', 'getGroupList']), // ...mapActions('planManage', ['getResidentList', 'getGroupList']),
...@@ -204,28 +200,35 @@ ...@@ -204,28 +200,35 @@
}, },
nextClick(formName) { nextClick(formName) {
//为方便调试,不做校验 //为方便调试,不做校验
this.activeTab = 'second'; // this.activeTab = 'second';
//用作校验 //用作校验
// if(!this.baseInfo.hasSelectedNum) { if(!this.baseInfo.hasSelectedNum) {
// this.noChoice = true this.noChoice = true
// return; return;
// }else { }else {
// this.noChoice = false this.noChoice = false
// } }
// this.$refs[formName].validate((valid) => { this.$refs[formName].validate((valid) => {
// if (valid) { if (valid) {
// // this.$refs['statusForm'].resetFields(); // this.$refs['statusForm'].resetFields();
// this.activeTab = 'second'; this.activeTab = 'second';
// } else { } else {
// return false; return false;
// } }
// }); });
}, },
preClick() { preClick() {
this.activeTab = 'first'; this.activeTab = 'first';
}, },
saveEdit() { saveEdit() {
console.log('保存') console.log('保存setTimeNodeList1',this.$refs.getTimeNodeList.setTimeNodeList1)
console.log('保存timeForm',this.$refs.getTimeNodeList.timeForm)
// 各种校验通过后,提交编辑内容,toast提示
this.$notify.success({
title: '',
message: '创建成功',
showClose: false
});
}, },
}, },
watch: { watch: {
......
Markdown 格式
0% or
您添加了 0 到此讨论。请谨慎行事。
先完成此消息的编辑!
想要评论请 注册