|
|
@@ -4,18 +4,20 @@
|
|
|
custom-class="gxDialog" width="75%" append-to-body>
|
|
|
<!-- <div class="p-5 work-time-modify">-->
|
|
|
<el-form
|
|
|
+ :disabled="title === '查看作息模版'"
|
|
|
label-width="140px"
|
|
|
:rules="rules"
|
|
|
label-suffix=":"
|
|
|
label-position="left">
|
|
|
<el-form-item>
|
|
|
<span slot="label"> <span style="color: red"> * </span>机构 </span>
|
|
|
- <org-tree-select @selectNode="queryNode"></org-tree-select>
|
|
|
+ <org-tree-select v-model="tagsList" :disabled="data.disabled" @selectNode="queryNode"></org-tree-select>
|
|
|
</el-form-item>
|
|
|
<el-form-item >
|
|
|
<span slot="label"> <span style="color: red"> * </span>生效日期 </span>
|
|
|
<el-date-picker
|
|
|
v-model="formData.effectiveDate"
|
|
|
+ value-format="yyyy-MM-dd hh:mm:ss"
|
|
|
:disabled="data.disabled"
|
|
|
:clearable="!data.disabled"
|
|
|
:picker-options="startDatepickerOptions"
|
|
|
@@ -31,71 +33,70 @@
|
|
|
</p >
|
|
|
<div class="box">
|
|
|
<el-table class="w-auto" border :data="formData.dayOfWeeks">
|
|
|
- <el-table-column label="星期" width="60px" prop="dayOfWeekText">
|
|
|
+ <el-table-column label="星期" width="100px" prop="dayOfWeekText">
|
|
|
</el-table-column>
|
|
|
- <el-table-column label="营业状态" width="180px">
|
|
|
+ <el-table-column label="营业状态" width="160px">
|
|
|
<template slot-scope="r">
|
|
|
<el-radio-group
|
|
|
v-model="r.row.isWorkday"
|
|
|
- @change="onEnableChange(r.row)"
|
|
|
- >
|
|
|
- <el-radio text-color="#48bb78" :label="true">营业</el-radio>
|
|
|
- <el-radio text-color="#f56565" :label="false">歇业</el-radio>
|
|
|
+ @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="上班时间">
|
|
|
<template slot-scope="r">
|
|
|
<el-time-select
|
|
|
- :picker-options="pickerOptions"
|
|
|
- :disabled="!r.row.isWorkday || r.row.isWorkday === false"
|
|
|
- v-model="r.row.workTime"
|
|
|
- />
|
|
|
+ style="width: 100%"
|
|
|
+ :picker-options="pickerOptions"
|
|
|
+ :disabled="!r.row.isWorkday || r.row.isWorkday === false"
|
|
|
+ v-model="r.row.workTime"/>
|
|
|
</template>
|
|
|
</el-table-column>
|
|
|
<el-table-column label="营业时间">
|
|
|
<template slot-scope="r">
|
|
|
<el-time-select
|
|
|
- :picker-options="pickerOptions"
|
|
|
- :disabled="!r.row.isWorkday || r.row.isWorkday === false"
|
|
|
- v-model="r.row.openTime"
|
|
|
- />
|
|
|
+ style="width: 100%"
|
|
|
+ :picker-options="pickerOptions"
|
|
|
+ :disabled="!r.row.isWorkday || r.row.isWorkday === false"
|
|
|
+ v-model="r.row.openTime"/>
|
|
|
</template>
|
|
|
</el-table-column>
|
|
|
<el-table-column label="午休开始">
|
|
|
<template slot-scope="r">
|
|
|
<el-time-select
|
|
|
- :picker-options="pickerOptions"
|
|
|
- :disabled="!r.row.isWorkday || r.row.isWorkday === false"
|
|
|
- v-model="r.row.noonbreakStart"
|
|
|
- />
|
|
|
+ style="width: 100%"
|
|
|
+ :picker-options="pickerOptions"
|
|
|
+ :disabled="!r.row.isWorkday || r.row.isWorkday === false"
|
|
|
+ v-model="r.row.noonbreakStart"/>
|
|
|
</template>
|
|
|
</el-table-column>
|
|
|
<el-table-column label="午休结束">
|
|
|
<template slot-scope="r">
|
|
|
<el-time-select
|
|
|
- :picker-options="pickerOptions"
|
|
|
- :disabled="!r.row.isWorkday || r.row.isWorkday === false"
|
|
|
- v-model="r.row.noonbreakEnd"
|
|
|
- />
|
|
|
+ style="width: 100%"
|
|
|
+ :picker-options="pickerOptions"
|
|
|
+ :disabled="!r.row.isWorkday || r.row.isWorkday === false"
|
|
|
+ v-model="r.row.noonbreakEnd"/>
|
|
|
</template>
|
|
|
</el-table-column>
|
|
|
<el-table-column label="营业终了">
|
|
|
<template slot-scope="r">
|
|
|
<el-time-select
|
|
|
- :picker-options="pickerOptions"
|
|
|
- :disabled="!r.row.isWorkday || r.row.isWorkday === false"
|
|
|
- v-model="r.row.closeTime"
|
|
|
- />
|
|
|
+ style="width: 100%"
|
|
|
+ :picker-options="pickerOptions"
|
|
|
+ :disabled="!r.row.isWorkday || r.row.isWorkday === false"
|
|
|
+ v-model="r.row.closeTime"/>
|
|
|
</template>
|
|
|
</el-table-column>
|
|
|
<el-table-column label="下班时间">
|
|
|
<template slot-scope="r">
|
|
|
<el-time-select
|
|
|
- :picker-options="pickerOptions"
|
|
|
- :disabled="!r.row.isWorkday || r.row.isWorkday === false"
|
|
|
- v-model="r.row.workOffTime"
|
|
|
- />
|
|
|
+ style="width: 100%"
|
|
|
+ :picker-options="pickerOptions"
|
|
|
+ :disabled="!r.row.isWorkday || r.row.isWorkday === false"
|
|
|
+ v-model="r.row.workOffTime"/>
|
|
|
</template>
|
|
|
</el-table-column>
|
|
|
|
|
|
@@ -108,11 +109,12 @@
|
|
|
注:保存后生成或更新本月或下月生效日期后的每日作息
|
|
|
</div>
|
|
|
<!-- </div>-->
|
|
|
- <div slot="footer" class="dialog-footer">
|
|
|
- <el-button @click="onHide">取消</el-button>
|
|
|
+ <div v-if="title != '查看作息模版'" slot="footer" class="dialog-footer">
|
|
|
+ <el-button @click="handleClose">取消</el-button>
|
|
|
<btn-tip tip="确定要提交吗?" type="primary" @click="onSubmit">保存</btn-tip>
|
|
|
</div>
|
|
|
</el-dialog>
|
|
|
+
|
|
|
<el-dialog
|
|
|
title="提示"
|
|
|
:visible="centerDialogVisible"
|
|
|
@@ -134,7 +136,7 @@
|
|
|
center>
|
|
|
<span>已存在其他生效的配置,将会生成{{checkMsg}}的作息,是否提交?</span>
|
|
|
<span slot="footer" class="dialog-footer">
|
|
|
- <el-button @click="checkDataMsg(0)">取消</el-button>
|
|
|
+ <el-button @click="handleClose()">取消</el-button>
|
|
|
<el-button type="primary" @click="checkDataMsg(1)">提交</el-button>
|
|
|
</span>
|
|
|
</el-dialog>
|
|
|
@@ -145,18 +147,21 @@
|
|
|
import BtnTip from "@/components/btnTip";
|
|
|
import OrgTreeSelect from '@/components/orgTreeSelect'
|
|
|
import { timeCheck } from "@/utils/ruoyi";
|
|
|
+import {addTimeWeek,checkData, queryInfoById} from "@/views/system/workTimeSet/api";
|
|
|
+import {json} from './json'
|
|
|
export default {
|
|
|
components:{BtnTip,OrgTreeSelect},
|
|
|
data() {
|
|
|
- let { params, query } = this.$route;
|
|
|
return {
|
|
|
title:'',
|
|
|
isShow: false,
|
|
|
- id:null,
|
|
|
+ row:null,
|
|
|
+ id:0,
|
|
|
orgId:null,
|
|
|
formData: {
|
|
|
orgIdList: [],
|
|
|
- dayOfWeeks: [],
|
|
|
+ dayOfWeeks: json,
|
|
|
+ effectiveDate:null,
|
|
|
},
|
|
|
data: {
|
|
|
orgIdList: [],
|
|
|
@@ -171,21 +176,16 @@ export default {
|
|
|
},
|
|
|
],
|
|
|
},
|
|
|
- options: [
|
|
|
- {
|
|
|
- value: new Date().getFullYear(),
|
|
|
- label: new Date().getFullYear(),
|
|
|
- },
|
|
|
- {
|
|
|
- value: new Date().getFullYear() + 1,
|
|
|
- label: new Date().getFullYear() + 1,
|
|
|
- },
|
|
|
- ],
|
|
|
- pickerOptions: {
|
|
|
- start: "00:00",
|
|
|
- step: "00:10",
|
|
|
- end: "24:00",
|
|
|
- },
|
|
|
+ // options: [
|
|
|
+ // {
|
|
|
+ // value: new Date().getFullYear(),
|
|
|
+ // label: new Date().getFullYear(),
|
|
|
+ // },
|
|
|
+ // {
|
|
|
+ // value: new Date().getFullYear() + 1,
|
|
|
+ // label: new Date().getFullYear() + 1,
|
|
|
+ // },
|
|
|
+ // ],
|
|
|
startDatepickerOptions: {
|
|
|
disabledDate(time) {
|
|
|
const date = new Date();
|
|
|
@@ -197,46 +197,51 @@ export default {
|
|
|
centerDialogVisiblea:false,
|
|
|
checkData:null,
|
|
|
checkMsg:null,
|
|
|
+ //回显tag
|
|
|
+ tagsList:[]
|
|
|
};
|
|
|
},
|
|
|
props: {},
|
|
|
watch: {
|
|
|
- year() {
|
|
|
- this.getData();
|
|
|
- },
|
|
|
},
|
|
|
- mounted() {
|
|
|
- this.getData();
|
|
|
+ computed: {
|
|
|
+ pickerOptions() {
|
|
|
+ return {
|
|
|
+ start: "00:00",
|
|
|
+ end: "24:00",
|
|
|
+ step: "00:10",
|
|
|
+ };
|
|
|
+ },
|
|
|
},
|
|
|
- computed: {},
|
|
|
methods: {
|
|
|
queryNode(json){
|
|
|
- this.nodes = JSON.parse(json);
|
|
|
- console.log(this.nodes,'nodes')
|
|
|
+ this.data.orgIdList = JSON.parse(json);
|
|
|
+ console.log(this.orgIdList,'orgIdList')
|
|
|
},
|
|
|
edit(row){
|
|
|
this.title = '编辑作息模版';
|
|
|
this.isShow = true;
|
|
|
this.formData = row;
|
|
|
},
|
|
|
- add(tree){
|
|
|
+ add(){
|
|
|
this.title = '新增作息模版';
|
|
|
this.isShow = true;
|
|
|
+ //this.getData()
|
|
|
+ // for (let i=0; i <= 6;i++){
|
|
|
+ // this.formData.dayOfWeeks.push({})
|
|
|
+ // }
|
|
|
},
|
|
|
- // ...mapMutations([]),
|
|
|
- async refresh() {},
|
|
|
-
|
|
|
- async show(id,orgId, other = {}) {
|
|
|
- console.log("show",id,orgId);
|
|
|
+ show(row) {
|
|
|
+ this.title = '查看作息模版';
|
|
|
this.isShow = true;
|
|
|
- this.id=id;
|
|
|
- this.orgId=orgId;
|
|
|
+ this.id = row.id;
|
|
|
+ this.orgId = row.orgId;
|
|
|
this.getData();
|
|
|
},
|
|
|
- async onSubmit() {
|
|
|
-
|
|
|
- this.formData.orgIds = this.data.orgIdList;
|
|
|
-
|
|
|
+ onSubmit() {
|
|
|
+ this.formData.orgIds = this.data.orgIdList.map(v=>{
|
|
|
+ return v.id
|
|
|
+ });
|
|
|
if (this.data.orgIdList.length < 1) {
|
|
|
this.$message.error("机构不能为空");
|
|
|
return;
|
|
|
@@ -245,96 +250,39 @@ export default {
|
|
|
this.$message.error("生效日期不能为空");
|
|
|
return;
|
|
|
}
|
|
|
- let d=this.formData;
|
|
|
- if (
|
|
|
- this.formData.dayOfWeeks.filter((w) => w.isWorkday ===true || w.isWorkday)
|
|
|
- .length === 0
|
|
|
- ) {
|
|
|
+ if (this.formData.dayOfWeeks.filter((w) => w.isWorkday ===true || w.isWorkday).length === 0) {
|
|
|
this.$message.error("工作日不能为空");
|
|
|
return;
|
|
|
}
|
|
|
-
|
|
|
- for (let i=0;i< this.formData.dayOfWeeks.length;i++ ) {
|
|
|
- let dayOfWeek=this.formData.dayOfWeeks[i];
|
|
|
- if(!dayOfWeek.isWorkday && dayOfWeek.isWorkday!=true){
|
|
|
- continue;
|
|
|
- }
|
|
|
- if (
|
|
|
- !(
|
|
|
- dayOfWeek.workTime &&
|
|
|
- dayOfWeek.openTime &&
|
|
|
- dayOfWeek.closeTime &&
|
|
|
- dayOfWeek.workOffTime
|
|
|
- )
|
|
|
- ) {
|
|
|
- this.onError(`${dayOfWeek.dayOfWeekText}的上班时间、营业时间未配置完整`);
|
|
|
+ this.formData.dayOfWeeks.forEach(v=>{
|
|
|
+ let dayOfWeek = v;
|
|
|
+ console.log(dayOfWeek,'dayOfWeek');
|
|
|
+ //是否启用
|
|
|
+ if(!dayOfWeek.isWorkday ) return ;
|
|
|
+ if (!(dayOfWeek.workTime && dayOfWeek.openTime && dayOfWeek.closeTime && dayOfWeek.workOffTime)) {
|
|
|
+ this.$message.error(`${dayOfWeek.dayOfWeekText}的上班时间、营业时间未配置完整`);
|
|
|
return;
|
|
|
}
|
|
|
-
|
|
|
if (!dayOfWeek.noonbreakStart ^ !dayOfWeek.noonbreakEnd) {
|
|
|
- this.onError(`${dayOfWeek.dayOfWeekText}的午休开始及结束时间必须同时配置`);
|
|
|
+ this.$message.error(`${dayOfWeek.dayOfWeekText}的午休开始及结束时间必须同时配置`);
|
|
|
return;
|
|
|
}
|
|
|
- if (
|
|
|
- !timeCheck([
|
|
|
- dayOfWeek.workTime,
|
|
|
- dayOfWeek.openTime,
|
|
|
- dayOfWeek.noonbreakStart,
|
|
|
- dayOfWeek.noonbreakEnd,
|
|
|
- dayOfWeek.closeTime,
|
|
|
- dayOfWeek.workOffTime,
|
|
|
- ])
|
|
|
- ) {
|
|
|
- this.onError(
|
|
|
- `${dayOfWeek.dayOfWeekText}的上班时间<=营业时间<=午休开始<=午休结束<=营业终了<=下班时间`
|
|
|
- );
|
|
|
+ let arr = [dayOfWeek.workTime, dayOfWeek.openTime, dayOfWeek.noonbreakStart, dayOfWeek.noonbreakEnd, dayOfWeek.closeTime, dayOfWeek.workOffTime];
|
|
|
+ let flag = timeCheck(arr);
|
|
|
+ if (!flag) {
|
|
|
+ this.$message.error(`${dayOfWeek.dayOfWeekText}的上班时间<=营业时间<=午休开始<=午休结束<=营业终了<=下班时间`);
|
|
|
return false;
|
|
|
}
|
|
|
- }
|
|
|
-
|
|
|
- let data = await this.$api.workTime.checkData(this.formData);
|
|
|
- this.checkData=data.checkData
|
|
|
- this.checkMsg=data.checkMsg
|
|
|
-
|
|
|
- if((data.checkData==null||data.checkData==0)&&data.checkMsg==null) {
|
|
|
- // this.$api.workTimeMonth.timeSetAdd(this.formData).then((v) => {
|
|
|
- // this.$emit("success");
|
|
|
- // this.onHide();
|
|
|
- // });
|
|
|
-
|
|
|
- }else{
|
|
|
- this.checkDataDialog();
|
|
|
- }
|
|
|
- },
|
|
|
-
|
|
|
- checkDataDialog(){
|
|
|
- if(this.checkMsg!=null){
|
|
|
- this.centerDialogVisiblea=true;
|
|
|
- return;
|
|
|
- }
|
|
|
- if(this.checkData>0){
|
|
|
- this.centerDialogVisible=true;
|
|
|
- return;
|
|
|
- }
|
|
|
- },
|
|
|
- checkDataMsg(tyep){
|
|
|
- if(tyep==0){
|
|
|
- this.centerDialogVisiblea=false;
|
|
|
- this.checkData=null;
|
|
|
- this.checkMsg=null;
|
|
|
- return;
|
|
|
- }else{
|
|
|
- if(this.checkData>0){
|
|
|
- this.centerDialogVisible=true;
|
|
|
- return;
|
|
|
- }else{
|
|
|
- // this.$api.workTimeMonth.timeSetAdd(this.formData).then((v) => {
|
|
|
- // this.$emit("success");
|
|
|
- // this.onHide();
|
|
|
- // });
|
|
|
+ })
|
|
|
+ checkData(this.formData).then(res=>{
|
|
|
+ this.checkData = res.checkData;
|
|
|
+ if(!res.checkData) {
|
|
|
+ addTimeWeek(this.formData).then(res=>{
|
|
|
+ this.$emit("success");
|
|
|
+ this.handleClose();
|
|
|
+ })
|
|
|
}
|
|
|
- }
|
|
|
-
|
|
|
+ })
|
|
|
},
|
|
|
async submitData(result){
|
|
|
this.centerDialogVisible=false;
|
|
|
@@ -346,27 +294,30 @@ export default {
|
|
|
// });
|
|
|
|
|
|
},
|
|
|
-
|
|
|
async getData() {
|
|
|
- console.log("this.formData.id",this.formData.id);
|
|
|
- console.log("this.formData.orgId",this.formData.orgId);
|
|
|
- // this.formData = await this.$api.workTimeMonth.holiday({
|
|
|
- // id: this.id,
|
|
|
- // });
|
|
|
-
|
|
|
- // this.data.orgIdList =[];
|
|
|
- if (this.id != 0) {
|
|
|
- this.data.disabled=true;
|
|
|
- this.data.orgIdList = [this.formData.orgId];
|
|
|
- console.log(this.formData.orgIdList);
|
|
|
- if (this.orgId) {
|
|
|
+ queryInfoById({id:this.id}).then(res=>{
|
|
|
+ this.formData = res.data;
|
|
|
+ if (this.id != 0) {
|
|
|
+ this.tagsList = [
|
|
|
+ {
|
|
|
+ id:res.data.orgId,
|
|
|
+ name:res.data.orgName
|
|
|
+ }
|
|
|
+ ];
|
|
|
+ this.data.disabled = true;
|
|
|
this.data.orgIdList = [this.formData.orgId];
|
|
|
- console.log(this.data.orgIdList);
|
|
|
+ console.log(this.formData.orgIdList);
|
|
|
+ if (this.orgId) {
|
|
|
+ this.data.orgIdList = [this.formData.orgId];
|
|
|
+ console.log(this.data.orgIdList);
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ this.data.orgIdList = [];
|
|
|
+ this.data.disabled= false;
|
|
|
}
|
|
|
- } else {
|
|
|
- this.data.orgIdList = [];
|
|
|
- this.data.disabled= false;
|
|
|
- }
|
|
|
+ })
|
|
|
+
|
|
|
+ // this.data.orgIdList =[];
|
|
|
},
|
|
|
onEnableChange(workTime) {
|
|
|
if (workTime.isWorkday === false) {
|
|
|
@@ -379,26 +330,16 @@ export default {
|
|
|
}
|
|
|
},
|
|
|
handleClose() {
|
|
|
-
|
|
|
- this.id=null;
|
|
|
- this.formData = {
|
|
|
- orgIdList: [],
|
|
|
- effectiveDate: null,
|
|
|
- checkDataResult:null,
|
|
|
- };
|
|
|
- this.checkData=null;
|
|
|
- this.checkMsg=null;
|
|
|
- this.centerDialogVisiblea=false;
|
|
|
- this.centerDialogVisible=false;
|
|
|
- this.isShow = false;
|
|
|
- },
|
|
|
- onHide() {
|
|
|
this.id=null;
|
|
|
this.formData = {
|
|
|
orgIdList: [],
|
|
|
+ dayOfWeeks: json,
|
|
|
effectiveDate: null,
|
|
|
checkDataResult:null,
|
|
|
};
|
|
|
+ this.tagsList = [];
|
|
|
+ this.data.orgIdList = [];
|
|
|
+ this.data.disabled= false;
|
|
|
this.checkData=null;
|
|
|
this.checkMsg=null;
|
|
|
this.centerDialogVisiblea=false;
|