|
|
@@ -1,7 +1,7 @@
|
|
|
<template>
|
|
|
<div class="question-infos">
|
|
|
<DialogCom title="新增作息" @close="handleClose" :visible.sync="isShow" :close-on-click-modal="false"
|
|
|
- custom-class="gxDialog" width="80%" append-to-body>
|
|
|
+ custom-class="gxDialog" width="911px" append-to-body>
|
|
|
<!-- <div class="p-5 work-time">-->
|
|
|
<el-form label-width="90px" label-suffix=":" label-position="right">
|
|
|
|
|
|
@@ -14,7 +14,7 @@
|
|
|
<!-- -->
|
|
|
<el-form-item label="作息规则">
|
|
|
<el-table class="w-auto" height="350" border :data="workTimeList">
|
|
|
- <el-table-column label="日期" width="160px">
|
|
|
+ <el-table-column label="日期" width="160">
|
|
|
<template slot-scope="r" >
|
|
|
<el-date-picker
|
|
|
style="width: 100%"
|
|
|
@@ -28,72 +28,72 @@
|
|
|
</el-date-picker>
|
|
|
</template>
|
|
|
</el-table-column>
|
|
|
- <el-table-column label="星期" width="80px">
|
|
|
+ <el-table-column label="星期" width="80">
|
|
|
<template slot-scope="r">
|
|
|
<span>{{parseTime(r.row.ymdDate ,'dddd')}}</span>
|
|
|
</template>
|
|
|
</el-table-column>
|
|
|
- <el-table-column label="状态" width="160px">
|
|
|
+ <el-table-column label="状态" width="160">
|
|
|
<template slot-scope="r">
|
|
|
- <el-switch
|
|
|
- v-model="r.row.isEnable"
|
|
|
- :active-value="1"
|
|
|
- :inactive-value="0"
|
|
|
- @change="onEnableChange(r.row)"
|
|
|
- active-text="营业"
|
|
|
- inactive-text="歇业">
|
|
|
- </el-switch>
|
|
|
+<!-- <el-switch-->
|
|
|
+<!-- v-model="r.row.isEnable"-->
|
|
|
+<!-- :active-value="1"-->
|
|
|
+<!-- :inactive-value="0"-->
|
|
|
+<!-- @change="onEnableChange(r.row)"-->
|
|
|
+<!-- active-text="营业"-->
|
|
|
+<!-- inactive-text="歇业">-->
|
|
|
+<!-- </el-switch>-->
|
|
|
|
|
|
-<!-- <el-radio-group-->
|
|
|
-<!-- :disabled="r.row.disabled"-->
|
|
|
-<!-- v-model="r.row.isEnable"-->
|
|
|
-<!-- @change="onEnableChange(r.row)">-->
|
|
|
-<!-- <el-radio text-color="#48bb78" :label="1">营业</el-radio>-->
|
|
|
-<!-- <el-radio text-color="#f56565" :label="0">歇业</el-radio>-->
|
|
|
-<!-- </el-radio-group>-->
|
|
|
+ <el-radio-group
|
|
|
+ :disabled="r.row.disabled"
|
|
|
+ v-model="r.row.isEnable"
|
|
|
+ @change="onEnableChange(r.row)">
|
|
|
+ <el-radio text-color="#48bb78" :label="1">营业</el-radio>
|
|
|
+ <el-radio text-color="#f56565" :label="0">歇业</el-radio>
|
|
|
+ </el-radio-group>
|
|
|
</template>
|
|
|
</el-table-column>
|
|
|
- <el-table-column label="上班时间" >
|
|
|
+<!-- <el-table-column label="上班时间" >-->
|
|
|
+<!-- <template slot-scope="r">-->
|
|
|
+<!-- <el-time-select-->
|
|
|
+<!-- style="width: 100%"-->
|
|
|
+<!-- size="mini"-->
|
|
|
+<!-- :picker-options="pickerOptions"-->
|
|
|
+<!-- :disabled="r.row.disabled || !r.row.isEnable"-->
|
|
|
+<!-- v-model="r.row.workTime"/>-->
|
|
|
+<!-- </template>-->
|
|
|
+<!-- </el-table-column>-->
|
|
|
+ <el-table-column label="营业时间" width="120">
|
|
|
<template slot-scope="r">
|
|
|
<el-time-select
|
|
|
- style="width: 100%"
|
|
|
- size="mini"
|
|
|
- :picker-options="pickerOptions"
|
|
|
- :disabled="r.row.disabled || !r.row.isEnable"
|
|
|
- v-model="r.row.workTime"/>
|
|
|
- </template>
|
|
|
- </el-table-column>
|
|
|
- <el-table-column label="营业时间" >
|
|
|
- <template slot-scope="r">
|
|
|
- <el-time-select
|
|
|
- style="width: 100%"
|
|
|
+ style="width: 100%;"
|
|
|
size="mini"
|
|
|
:picker-options="pickerOptions"
|
|
|
:disabled="r.row.disabled || !r.row.isEnable"
|
|
|
v-model="r.row.openTime"/>
|
|
|
</template>
|
|
|
</el-table-column>
|
|
|
- <el-table-column label="午休开始">
|
|
|
- <template slot-scope="r">
|
|
|
- <el-time-select
|
|
|
- style="width: 100%"
|
|
|
- size="mini"
|
|
|
- :picker-options="pickerOptions"
|
|
|
- :disabled="r.row.disabled || !r.row.isEnable"
|
|
|
- v-model="r.row.noonbreakStart"/>
|
|
|
- </template>
|
|
|
- </el-table-column>
|
|
|
- <el-table-column label="午休结束">
|
|
|
- <template slot-scope="r">
|
|
|
- <el-time-select
|
|
|
- style="width: 100%"
|
|
|
- size="mini"
|
|
|
- :picker-options="pickerOptions"
|
|
|
- :disabled="r.row.disabled || !r.row.isEnable"
|
|
|
- v-model="r.row.noonbreakEnd"/>
|
|
|
- </template>
|
|
|
- </el-table-column>
|
|
|
- <el-table-column label="营业终了">
|
|
|
+<!-- <el-table-column label="午休开始">-->
|
|
|
+<!-- <template slot-scope="r">-->
|
|
|
+<!-- <el-time-select-->
|
|
|
+<!-- style="width: 100%"-->
|
|
|
+<!-- size="mini"-->
|
|
|
+<!-- :picker-options="pickerOptions"-->
|
|
|
+<!-- :disabled="r.row.disabled || !r.row.isEnable"-->
|
|
|
+<!-- v-model="r.row.noonbreakStart"/>-->
|
|
|
+<!-- </template>-->
|
|
|
+<!-- </el-table-column>-->
|
|
|
+<!-- <el-table-column label="午休结束">-->
|
|
|
+<!-- <template slot-scope="r">-->
|
|
|
+<!-- <el-time-select-->
|
|
|
+<!-- style="width: 100%"-->
|
|
|
+<!-- size="mini"-->
|
|
|
+<!-- :picker-options="pickerOptions"-->
|
|
|
+<!-- :disabled="r.row.disabled || !r.row.isEnable"-->
|
|
|
+<!-- v-model="r.row.noonbreakEnd"/>-->
|
|
|
+<!-- </template>-->
|
|
|
+<!-- </el-table-column>-->
|
|
|
+ <el-table-column label="营业终了" width="120">
|
|
|
<template slot-scope="r">
|
|
|
<el-time-select
|
|
|
style="width: 100%"
|
|
|
@@ -103,17 +103,17 @@
|
|
|
v-model="r.row.closeTime"/>
|
|
|
</template>
|
|
|
</el-table-column>
|
|
|
- <el-table-column label="下班时间" >
|
|
|
- <template slot-scope="r">
|
|
|
- <el-time-select
|
|
|
- style="width: 100%"
|
|
|
- size="mini"
|
|
|
- :picker-options="pickerOptions"
|
|
|
- :disabled="r.row.disabled || !r.row.isEnable"
|
|
|
- v-model="r.row.workOffTime"/>
|
|
|
- </template>
|
|
|
- </el-table-column>
|
|
|
- <el-table-column label="操作列表" width="140px">
|
|
|
+<!-- <el-table-column label="下班时间" >-->
|
|
|
+<!-- <template slot-scope="r">-->
|
|
|
+<!-- <el-time-select-->
|
|
|
+<!-- style="width: 100%"-->
|
|
|
+<!-- size="mini"-->
|
|
|
+<!-- :picker-options="pickerOptions"-->
|
|
|
+<!-- :disabled="r.row.disabled || !r.row.isEnable"-->
|
|
|
+<!-- v-model="r.row.workOffTime"/>-->
|
|
|
+<!-- </template>-->
|
|
|
+<!-- </el-table-column>-->
|
|
|
+ <el-table-column label="操作列表" width="140">
|
|
|
<template slot-scope="r">
|
|
|
<btn-tip type="text" @click="deleteData(r.row,r.$index)">删除</btn-tip>
|
|
|
<el-button type="text" @click="coppy(r.$index)">复制至全部</el-button>
|
|
|
@@ -167,7 +167,7 @@ export default {
|
|
|
return {
|
|
|
start: "00:00",
|
|
|
end: "24:00",
|
|
|
- step: "00:10",
|
|
|
+ step: "00:05",
|
|
|
};
|
|
|
},
|
|
|
},
|
|
|
@@ -190,12 +190,12 @@ export default {
|
|
|
//获取workTimeList最后一条数据
|
|
|
let workTime = {
|
|
|
isEnable: 1,
|
|
|
- workTime: '08:30',
|
|
|
+ // workTime: '08:30',
|
|
|
openTime: '09:00',
|
|
|
- noonbreakStart: '12:00',
|
|
|
- noonbreakEnd: '14:00',
|
|
|
+ // noonbreakStart: '12:00',
|
|
|
+ // noonbreakEnd: '14:00',
|
|
|
closeTime: '17:00',
|
|
|
- workOffTime: '17:30',
|
|
|
+ // workOffTime: '17:30',
|
|
|
ymdDate: new Date(),
|
|
|
disabled: false,
|
|
|
};
|
|
|
@@ -211,19 +211,19 @@ export default {
|
|
|
let workTime = this.workTimeList[index];
|
|
|
for(let i=0;i<this.workTimeList.length;i++){
|
|
|
this.workTimeList[i].isEnable = workTime.isEnable;
|
|
|
- this.workTimeList[i].workTime = workTime.workTime;
|
|
|
+ // this.workTimeList[i].workTime = workTime.workTime;
|
|
|
this.workTimeList[i].openTime = workTime.openTime;
|
|
|
- this.workTimeList[i].noonbreakStart = workTime.noonbreakStart;
|
|
|
- this.workTimeList[i].noonbreakEnd = workTime.noonbreakEnd;
|
|
|
+ // this.workTimeList[i].noonbreakStart = workTime.noonbreakStart;
|
|
|
+ // this.workTimeList[i].noonbreakEnd = workTime.noonbreakEnd;
|
|
|
this.workTimeList[i].closeTime = workTime.closeTime;
|
|
|
- this.workTimeList[i].workOffTime = workTime.workOffTime;
|
|
|
+ // this.workTimeList[i].workOffTime = workTime.workOffTime;
|
|
|
}
|
|
|
},
|
|
|
deleteData(row,index){
|
|
|
console.log(index);
|
|
|
this.workTimeList.splice(index,1);
|
|
|
},
|
|
|
- //
|
|
|
+ //检查每一项
|
|
|
check(other) {
|
|
|
if(!other.ymdDate){
|
|
|
this.$message.error(`日期不能为空`);
|
|
|
@@ -232,42 +232,53 @@ export default {
|
|
|
const ds = this.formatTime(other.ymdDate,"YYYY-MM-DD");
|
|
|
console.log(other,'ds')
|
|
|
if ( !other.isEnable === null && !other.disabled ) {
|
|
|
- this.$message.error(`${ds}未进行配置`);
|
|
|
+ this.$message.error(`${ds}:未进行配置`);
|
|
|
return;
|
|
|
}
|
|
|
- if (other.isEnable) {
|
|
|
- if (
|
|
|
- !(
|
|
|
- other.workTime &&
|
|
|
- other.openTime &&
|
|
|
- other.closeTime &&
|
|
|
- other.workOffTime
|
|
|
- )
|
|
|
- ) {
|
|
|
- this.$message.error(`${ds}未配置时间`);
|
|
|
- return;
|
|
|
- }
|
|
|
- if (!other.noonbreakStart ^ !other.noonbreakEnd) {
|
|
|
- this.$message.error(`午休开始及结束时间必须同时配置`);
|
|
|
+ if(other.isEnable){
|
|
|
+ if(!other.openTime || !other.closeTime){
|
|
|
+ this.$message.error(`${ds}:未配置时间`);
|
|
|
return;
|
|
|
}
|
|
|
- if (
|
|
|
- !timeCheck([
|
|
|
- other.workTime,
|
|
|
- other.openTime,
|
|
|
- other.noonbreakStart,
|
|
|
- other.noonbreakEnd,
|
|
|
- other.closeTime,
|
|
|
- other.workOffTime,
|
|
|
- ])
|
|
|
- ) {
|
|
|
- this.$message.error(
|
|
|
- `${ds}上班时间<=营业时间<=午休开始<=午休结束<=营业终了<=下班时间`
|
|
|
- );
|
|
|
+ if(!timeCheck([other.openTime,other.closeTime])){
|
|
|
+ this.$message.error(`${ds}:营业时间应在营业终了之前`);
|
|
|
return false;
|
|
|
}
|
|
|
}
|
|
|
- return true;
|
|
|
+ return true
|
|
|
+ // if (other.isEnable) {
|
|
|
+ // if (
|
|
|
+ // !(
|
|
|
+ // other.workTime &&
|
|
|
+ // other.openTime &&
|
|
|
+ // other.closeTime &&
|
|
|
+ // other.workOffTime
|
|
|
+ // )
|
|
|
+ // ) {
|
|
|
+ // this.$message.error(`${ds}未配置时间`);
|
|
|
+ // return;
|
|
|
+ // }
|
|
|
+ // if (!other.noonbreakStart ^ !other.noonbreakEnd) {
|
|
|
+ // this.$message.error(`午休开始及结束时间必须同时配置`);
|
|
|
+ // return;
|
|
|
+ // }
|
|
|
+ // if (
|
|
|
+ // !timeCheck([
|
|
|
+ // other.workTime,
|
|
|
+ // other.openTime,
|
|
|
+ // other.noonbreakStart,
|
|
|
+ // other.noonbreakEnd,
|
|
|
+ // other.closeTime,
|
|
|
+ // other.workOffTime,
|
|
|
+ // ])
|
|
|
+ // ) {
|
|
|
+ // this.$message.error(
|
|
|
+ // `${ds}上班时间<=营业时间<=午休开始<=午休结束<=营业终了<=下班时间`
|
|
|
+ // );
|
|
|
+ // return false;
|
|
|
+ // }
|
|
|
+ // }
|
|
|
+ // return true;
|
|
|
},
|
|
|
handleClose() {
|
|
|
this.isShow = false;
|
|
|
@@ -279,13 +290,15 @@ export default {
|
|
|
if (!workTime.isEnable) {
|
|
|
workTime.openTime = null;
|
|
|
workTime.closeTime = null;
|
|
|
- workTime.noonbreakStart = null;
|
|
|
- workTime.noonbreakEnd = null;
|
|
|
- workTime.workTime = null;
|
|
|
- workTime.workOffTime = null;
|
|
|
+ // workTime.noonbreakStart = null;
|
|
|
+ // workTime.noonbreakEnd = null;
|
|
|
+ // workTime.workTime = null;
|
|
|
+ // workTime.workOffTime = null;
|
|
|
}
|
|
|
},
|
|
|
async onSubmit() {
|
|
|
+ if(this.orgIdList.length === 0)return this.$message.warning('请选择机构!');
|
|
|
+ if(this.workTimeList.length === 0)return this.$message.warning('请添加日期!');
|
|
|
//判断是否有重复的日期
|
|
|
let dateList = [];
|
|
|
let workTimeList = JSON.parse(JSON.stringify(this.workTimeList))
|
|
|
@@ -309,20 +322,12 @@ export default {
|
|
|
orgIdList:this.orgIdList,
|
|
|
workTimeList:workTimeList
|
|
|
}
|
|
|
+ debugger
|
|
|
addWorkTimeDay(data).then(res=>{
|
|
|
this.$emit("ok");
|
|
|
this.handleClose();
|
|
|
})
|
|
|
-
|
|
|
- // await this.$api.workTimeMonth.edit({
|
|
|
- // ...this.data,
|
|
|
- // workTimeList: this.workTimeList,
|
|
|
- // }).then((v) => {
|
|
|
- // this.$emit("success");
|
|
|
- // this.onHide();
|
|
|
- // });
|
|
|
},
|
|
|
- //apimark//
|
|
|
},
|
|
|
};
|
|
|
</script>
|