mirror of
http://git.mhez-qa.uplus.co.kr/hubez/hubez-admin.git
synced 2025-12-06 16:43:32 +09:00
vue 수정완료
This commit is contained in:
@@ -14,7 +14,9 @@
|
||||
<vuejs-datepicker
|
||||
:language="ko"
|
||||
:format="customFormatter"
|
||||
:disabled-dates="disabledSDate"
|
||||
v-model="startDate"
|
||||
@closed="closeDate('start')"
|
||||
></vuejs-datepicker>
|
||||
</span>
|
||||
</div>
|
||||
@@ -71,7 +73,6 @@ import moment from 'moment';
|
||||
import VueTimepicker from 'vue2-timepicker';
|
||||
import 'vue2-timepicker/dist/VueTimepicker.css'
|
||||
import sysMgtApi from '../service/sysMgtApi'
|
||||
// import CommonModal from '../components/modal/commonModal';
|
||||
import CommonModal from '../components/commonModal.vue';
|
||||
|
||||
export default {
|
||||
@@ -81,8 +82,11 @@ export default {
|
||||
isFocused: false,
|
||||
//날짜 조회
|
||||
ko: vdp_translation_ko.js,
|
||||
periodDay: 7,
|
||||
sDateDiv: 'day',
|
||||
startDate: new Date(),
|
||||
disabledSDate: '',
|
||||
startDateOptions: {disabledDate: this.disabledStDate},
|
||||
totalItems: 0,
|
||||
row: {},
|
||||
grid: {
|
||||
@@ -110,8 +114,12 @@ export default {
|
||||
},
|
||||
startTime : '',
|
||||
endTime : '',
|
||||
state: '',
|
||||
|
||||
state: 'USE',
|
||||
startDate2 :'',
|
||||
startTimeT2: '',
|
||||
startTimeM2: '',
|
||||
endTimeT2 : '',
|
||||
endTimeM2: '',
|
||||
};
|
||||
},
|
||||
components: {
|
||||
@@ -122,6 +130,7 @@ export default {
|
||||
|
||||
},
|
||||
created() {
|
||||
this.setPeriodDay(0);
|
||||
},
|
||||
destroyed() {
|
||||
this.$store.commit('searchcondition/updateSearchCondition', {
|
||||
@@ -148,11 +157,6 @@ export default {
|
||||
|
||||
methods: {
|
||||
fnSaveTxt(){
|
||||
if (this.state == 'NOTUSE') {
|
||||
this.row.title = '서비스 점검 설정';
|
||||
this.row.msg1 = '저장 하시겠습니까?';
|
||||
this.$refs.commonModal.confirmModalOpen(this.row);
|
||||
}
|
||||
let params = {
|
||||
startDate : moment(this.startDate).format('YYYY-MM-DD'),
|
||||
startTimeT : '',
|
||||
@@ -161,6 +165,13 @@ export default {
|
||||
endTimeM : '',
|
||||
state : this.state,
|
||||
}
|
||||
|
||||
this.startDate2 = moment(this.startDate).format('YYYY-MM-DD');
|
||||
this.startTimeT2 = moment(this.startTime, 'HH:mm').format('HH');
|
||||
this.startTimeM2 = moment(this.startTime, 'HH:mm').format('mm');
|
||||
this.endTimeT2 = moment(this.endTime, 'HH:mm').format('HH');
|
||||
this.endTimeM2 = moment(this.endTime, 'HH:mm').format('mm');
|
||||
|
||||
if (this.startTime) {
|
||||
params.startTimeT = moment(this.startTime, 'HH:mm').format('HH');
|
||||
params.startTimeM = moment(this.startTime, 'HH:mm').format('mm');
|
||||
@@ -169,19 +180,77 @@ export default {
|
||||
params.endTimeT = moment(this.endTime, 'HH:mm').format('HH');
|
||||
params.endTimeM = moment(this.endTime, 'HH:mm').format('mm');
|
||||
}
|
||||
sysMgtApi.setWorkState(params).then((respose) => {
|
||||
var result = respose.data;
|
||||
if (result != null && result.retCode == "0000"){
|
||||
// 저장이 완료된 후에 테이블 다시 로드
|
||||
this.toComplete();
|
||||
}
|
||||
});
|
||||
if(params.startTimeT == ''){
|
||||
this.row.title = '서비스 점검 설정';
|
||||
this.row.msg1 = '시작시간을 설정해 주세요 ';
|
||||
this.$refs.commonModal.alertSysModalOpen(this.row);
|
||||
return false;
|
||||
}
|
||||
if(params.startTimeM== ''){
|
||||
this.row.title = '서비스 점검 설정';
|
||||
this.row.msg1 = '시작시간을 설정해 주세요 ';
|
||||
this.$refs.commonModal.alertSysModalOpen(this.row);
|
||||
return false;
|
||||
}
|
||||
if(params.endTimeT== ''){
|
||||
this.row.title = '서비스 점검 설정';
|
||||
this.row.msg1 = '종료시간을 설정해 주세요 ';
|
||||
this.$refs.commonModal.alertSysModalOpen(this.row);
|
||||
return false;
|
||||
}
|
||||
if(params.endTimeM== ''){
|
||||
this.row.title = '서비스 점검 설정';
|
||||
this.row.msg1 = '종료시간을 설정해 주세요 ';
|
||||
this.$refs.commonModal.alertSysModalOpen(this.row);
|
||||
return false;
|
||||
}
|
||||
|
||||
// 사용 && 점검중 선택
|
||||
if (this.state == 'NOTUSE') {
|
||||
this.row.title = '서비스 점검 설정';
|
||||
this.row.msg1 = '저장 하시겠습니까?';
|
||||
this.$refs.commonModal.confirmModalOpen(this.row);
|
||||
}else{
|
||||
this.setState(params);
|
||||
}
|
||||
},
|
||||
toComplete(){
|
||||
this.$refs.table.reloadData();
|
||||
// this.confirmCalbackFnc();
|
||||
},
|
||||
|
||||
async setState(){
|
||||
let params = {
|
||||
startDate : this.startDate2,
|
||||
startTimeT : this.startTimeT2,
|
||||
startTimeM : this.startTimeM2,
|
||||
endTimeT : this.endTimeT2,
|
||||
endTimeM : this.endTimeM2,
|
||||
state : this.state,
|
||||
}
|
||||
try {
|
||||
let response = await sysMgtApi.setWorkState(params);
|
||||
const result = response.data;
|
||||
if (result != null && result.retCode == "0000"){
|
||||
// 저장이 완료된 후에 테이블 다시 로드
|
||||
this.$refs.table.reloadData();
|
||||
return;
|
||||
} else {
|
||||
this.row.title = '서비스 점검 설정';
|
||||
this.row.msg1 = '실패 하였습니다.';
|
||||
this.$refs.commonModal.alertSysModalOpen(this.row);
|
||||
return false;
|
||||
}
|
||||
} catch (error) {
|
||||
this.row.title = '서비스 점검 설정';
|
||||
this.row.msg1 = '실패 하였습니다.';
|
||||
this.$refs.commonModal.alertSysModalOpen(this.row);
|
||||
return false;
|
||||
}
|
||||
},
|
||||
|
||||
confirmCalbackFnc(props) {
|
||||
if (props.result) {
|
||||
this.setState();
|
||||
}
|
||||
},
|
||||
|
||||
search: function (isKeep) {
|
||||
this.$refs.table.search(this.grid.params, isKeep);
|
||||
const getP = this.$refs.table.getPagination();
|
||||
@@ -209,7 +278,12 @@ export default {
|
||||
|
||||
const getCondition = this.$store.getters['searchcondition/getSearchCondition'];
|
||||
},
|
||||
|
||||
setPeriodDay(day) {
|
||||
this.periodDay = day;
|
||||
this.initSetStartDate();
|
||||
this.initSetEndDate();
|
||||
this.closeDate('start');
|
||||
},
|
||||
customFormatter: function (date) {
|
||||
if (this.sDateDiv == 'month') {
|
||||
return moment(date).format('YYYY-MM');
|
||||
@@ -219,6 +293,31 @@ export default {
|
||||
return moment(date).format('YYYY-MM-DD');
|
||||
}
|
||||
},
|
||||
|
||||
closeDate(type){
|
||||
if (type != undefined && type != null){
|
||||
let initStartDate = new Date();
|
||||
let initEndDate = new Date();
|
||||
initStartDate.setDate(Number(moment(initStartDate).format('DD'))+365 );
|
||||
initEndDate.setDate(Number(moment(initEndDate).format('DD')) -1)
|
||||
|
||||
this.disabledSDate = {to: initEndDate, from: initStartDate};
|
||||
if (this.startDate !== initStartDate) {
|
||||
this.disabledSDate = {to: initEndDate, from: initStartDate};
|
||||
}
|
||||
|
||||
}
|
||||
},
|
||||
initSetStartDate() {
|
||||
let initStartDate = new Date();
|
||||
initStartDate.setDate(Number(moment(initStartDate).format('DD'))+365 );
|
||||
this.startDate = initStartDate;
|
||||
},
|
||||
initSetEndDate(){
|
||||
let initEndDate = new Date();
|
||||
initEndDate.setDate(Number(moment(initEndDate).format('DD')) )
|
||||
this.startDate = initEndDate;
|
||||
},
|
||||
beforeRouteLeave(to, from, next) {
|
||||
const getP = this.$refs.table.getPagination();
|
||||
this.$store.commit('searchcondition/updateSearchCondition', {
|
||||
@@ -227,10 +326,7 @@ export default {
|
||||
// 라우트 하기전 실행
|
||||
next();
|
||||
},
|
||||
confirmCalbackFnc(props) {
|
||||
// if (props.result) {
|
||||
// }
|
||||
},
|
||||
|
||||
}
|
||||
};
|
||||
</script>
|
||||
|
||||
Reference in New Issue
Block a user