提交 674a0bd3 编写于 作者: 刘英杰's avatar 刘英杰

V20241030 保存

上级 c3fbdad6
<template>
<!-- 通用新增、编辑Modal -->
<div>
<!-- timeTable 添加班次抽屉 -->
<Drawer v-model="showDrawer"
class="class-drawer" title="配置值班时间" transfer width="800">
<!-- <div class="subTitle">打卡时段</div>-->
<div style="margin-top: 20px">
<!-- 第一次上班 -->
<Card dis-hover>
<Row style="
margin-bottom: 10px;
padding: 12px 0;
background-color: #f6f6f6;
">
<Col span="14"> 值班时间范围限制</Col>
</Row>
<Row style="margin-bottom: 10px">
<Col v-for="(item,index) in formDataTimeTable.time" :key="index" span="24"
style="margin-bottom: 10px;display: flex;align-items: center">
<TimePicker v-model="item.timeRange" :clearable="false" format="HH:mm"
placeholder="未设置" placement="bottom-end" style="width: 240px"
type="timerange"
@on-open-change="onOpenChangeTimeTable($event,item,index)"/>
<!--&nbsp;可预约座位-->
<i-switch v-model="item.morrow" :false-value="0" :true-value="1" class="ivu-ml-8" size="large">
<template #open>
<span>次日</span>
</template>
<template #close>
<span>当日</span>
</template>
</i-switch>
<div style="margin-left: auto">
<Poptip
confirm
title="是否继续该操作?"
@on-ok="()=>{
//删除某项时间配置
formDataTimeTable.time.splice(index,1);
}"
@on-cancel="">
<Button icon="ios-close" shape="circle"></Button>
</Poptip>
</div>
</Col>
</Row>
<Row style="margin-bottom: 10px;display: flex;justify-content: center">
<Button icon="ios-add" style="width: 200px;" type="dashed"
@click=" formDataTimeTable.time.push({begin: '',end:'',morrow:0})">添加时间
</Button>
</Row>
</Card>
</div>
<div class="drawer-footer">
<Button style="margin-right: 8px" @click="showDrawer = false">取消</Button>
<Button type="primary" @click="save">保存</Button>
</div>
</Drawer>
<Modal
v-model="show"
:before-close="beforeClose"
......@@ -19,10 +79,11 @@
:rules="formRule"
label-colon>
<!-- 新增 / 编辑 -->
<Row v-if="!isDetails">
<Col v-for="item in formItem.filter(a => a.type != 'file' && (!a.hasOwnProperty('show') || a.show))"
:key="item.id"
v-bind="grid">
<Row v-if="!isDetails ">
<Col
v-for="item in formItem.filter(a => a.type != 'timeTable' && a.type != 'file' && (!a.hasOwnProperty('show') || a.show))"
:key="item.id"
v-bind="grid">
<FormItem :label="item.name" :prop="item.id">
<Input
v-if="item.type == 'input'"
......@@ -78,8 +139,8 @@
<TimePicker
v-else-if="item.type == 'timerange'"
:editable="true"
v-model="formData[item['id']]"
:editable="true"
:placeholder="'请选择'+item.name"
format="HH:mm"
placement="bottom-end"
......@@ -213,12 +274,30 @@
</FormItem>
</Col>
</Row>
<Row v-if="!isDetails && !!formItem.filter(cur=>cur.type === 'timeTable').length">
<FormItem v-for="(item,index) in formItem.filter(cur=>cur.type === 'timeTable')" :key="item.id"
label="值班时间区间">
<Table :key="aaa" :columns="item.columns" :data="item.data" border size="small">
<template slot="time" slot-scope="{ row, index }">
<Tag v-for="(item,inde) in row.time" :key="inde" color="blue" style="margin-right: 5px">{{
item.Begin + '~' + item.End + [' 当日', ' 次日'][item.Morrow]
}}
</Tag>
</template>
<template #action="{ row, index }">
<a @click="openClass(row, index,item)">配置</a>
</template>
</Table>
</FormItem>
</Row>
<!-- 详情 -->
<Row v-if="isDetails">
<Col v-for="item in formItem.filter(a => a.type != 'file' && (!a.hasOwnProperty('show') || a.show))"
:key="item.id"
v-bind="grid">
<Row v-if="isDetails ">
<Col
v-for="item in formItem.filter(a => a.type != 'timeTable' && a.type != 'file' && (!a.hasOwnProperty('show') || a.show))"
:key="item.id"
v-bind="grid">
<FormItem :label="item.name" :prop="item.name">
<span v-if="item.type == 'input'">{{ formData[item.id] }}</span>
<span v-if="item.type == 'textarea'">{{ formData[item.id] }}</span>
......@@ -284,6 +363,20 @@
</FormItem>
</Col>
</Row>
<Row v-if="isDetails && !!formItem.filter(cur=>cur.type === 'timeTable').length">
<FormItem v-for="(item,index) in formItem.filter(cur=>cur.type === 'timeTable')" :key="item.id"
label="值班时间区间">
<Table :key="item.id" :columns="item.columns" :data="item.data" border size="small">
<template slot="time" slot-scope="{ row, index }">
<Tag v-for="(item,inde) in row.time" :key="inde" color="blue" style="margin-right: 5px">{{
item.Begin + '~' + item.End + [' 当日', ' 次日'][item.Morrow]
}}
</Tag>
</template>
</Table>
</FormItem>
</Row>
</Form>
</template>
<template #footer>
......@@ -302,7 +395,7 @@
</template>
<script>
import {cloneDeep} from 'lodash'
import _, {cloneDeep} from 'lodash'
export default {
props: {
......@@ -353,6 +446,18 @@ export default {
isDetails: false,
peopleKey: '',//select 搜索文字
//timeTable
aaa: 123123,
showDrawer: false,
formDataTimeTable: {
time: [
{begin: '12:00', end: '15:00'},
{begin: '12:00', end: '15:00'},
],
},
//timeTable
}
},
computed: {},
......@@ -361,6 +466,132 @@ export default {
mounted() {
},
methods: {
/***
值班时间区间
*/
checkTimes(intervals, times) {
//时间差判断
// Helper function to convert time string to minutes
function timeToMinutes(timeStr) {
const [hours, minutes] = timeStr.split(':').map(Number);
return hours * 60 + minutes;
}
// Helper function to convert minutes back to time string
function minutesToTime(minutes) {
const hours = Math.floor(minutes / 60);
const mins = minutes % 60;
return `${String(hours).padStart(2, '0')}:${String(mins).padStart(2, '0')}`;
}
// Convert intervals to start and end minutes
const intervalMinutes = intervals.map(interval => {
const [start, end] = interval.split('~').map(timeToMinutes);
return {start, end};
});
// Convert times to minutes
const timeMinutes = times.map(timeToMinutes);
// Check if all times are greater than all intervals
const allGreater = timeMinutes.every(time =>
intervalMinutes.every(({end}) => time > end)
);
// Check if all times are less than all intervals
const allLess = timeMinutes.every(time =>
intervalMinutes.every(({start}) => time < start)
);
// Check if all times are outside all intervals
const allOutside = timeMinutes.every(time =>
intervalMinutes.every(({start, end}) => time < start || time > end)
);
return allGreater || allLess || allOutside;
},
onOpenChangeTimeTable(event, item, index) {
console.log("🚀🚀event, item, index🚀,", event, item, index)
if (!event) {
// 关闭浮层时触发
let deleteEventArray = this.formDataTimeTable.time.map(cur => {
return cur.timeRange.join('~');
})
if (deleteEventArray.indexOf(item.timeRange.join('~')) !== -1) deleteEventArray.splice(deleteEventArray.indexOf(item.timeRange.join('~')), 1);
if (!(this.checkTimes(deleteEventArray, item.timeRange))) {
//对比算法 ,大于、小于且不在已有时间段内,返回则删除
this.formDataTimeTable.time.splice(index, 1);
this.$Message.error('配置时间重叠,请重新配置时间');
}
}
},
save() {
//深拷贝,防止污染 1~7天的数据
let array = _.cloneDeep(this.formItem.find(cur => cur.type === 'timeTable').data);
function getFormatData(data) {
//获取开放时间段,格式化
return data.map(cur => {
return {
"Begin": cur.timeRange[0],
"End": cur.timeRange[1],
"Morrow": cur.morrow,
}
})
}
let info = {
//策略判断日期,把数据分配给对应日期,最后保存
'周一': () => array[0].time = getFormatData(this.formDataTimeTable.time),
'周二': () => array[1].time = getFormatData(this.formDataTimeTable.time),
'周三': () => array[2].time = getFormatData(this.formDataTimeTable.time),
'周四': () => array[3].time = getFormatData(this.formDataTimeTable.time),
'周五': () => array[4].time = getFormatData(this.formDataTimeTable.time),
'周六': () => array[5].time = getFormatData(this.formDataTimeTable.time),
'周日': () => array[6].time = getFormatData(this.formDataTimeTable.time),
}
info[this.formDataTimeTable.day](); //入口
this.formItem.find(cur => cur.type === 'timeTable').data = array; //Table列表输出
let data = {
//格式化数据,
"one": array[0].time,
"two": array[1].time,
"three": array[2].time,
"four": array[3].time,
"five": array[4].time,
"six": array[5].time,
"seven": array[6].time,
};
this.formData['sign_daytime'] = JSON.stringify(data) //格式化为后端接口格式
// timeTable
this.showDrawer = false;
},
openClass(row, index, item) {
//触发配置时间
console.log("🚀🚀openClass,", row, index)
this.formDataTimeTable = {
// 某天的时间
...row,
id: item.id,
index,
time: row.time.map(cur => {
return {
/* begin: cur.split('~')[0],
end: cur.split('~')[1],*/
morrow:cur.Morrow,
timeRange: [cur.Begin, cur.End]
}
})
}
this.showDrawer = true
},
/***
值班时间区间
*/
setTime2() {
//触发坐标
this.$emit('setTime2', true)
......@@ -492,19 +723,60 @@ export default {
</script>
<style lang="less" scoped>
/deep/ .ivu-form-item-content {
position: relative;
/* line-height: 32px; */
font-size: 14px;
/deep/ .ivu-modal-mask {
position: fixed;
top: 0;
bottom: 0;
left: 0;
right: 0;
background-color: rgba(55, 55, 55, 0.6);
height: 100%;
z-index: 1050 !important;
}
/deep/ .ivu-modal-wrap {
position: fixed;
overflow: auto;
top: 0;
right: 0;
bottom: 0;
left: 0;
z-index: 1050 !important;
-webkit-overflow-scrolling: touch;
outline: 0;
}
/deep/ .ivu-divider-horizontal {
display: block;
height: 1px;
/*/deep/.ivu-message {
font-size: 14px;
position: fixed;
z-index: 999999 !important;
width: 100%;
min-width: 100%;
margin: 0;
clear: both;
top: 16px;
left: 0;
pointer-events: none;
}*/
/deep/ .ivu-drawer-mask {
position: fixed;
top: 0;
bottom: 0;
left: 0;
right: 0;
background-color: rgba(55, 55, 55, 0.6);
height: 100%;
z-index: 1100 !important;
}
/deep/ .ivu-drawer-wrap {
position: fixed;
overflow: auto;
top: 0;
right: 0;
bottom: 0;
left: 0;
z-index: 1100 !important;
-webkit-overflow-scrolling: touch;
outline: 0;
}
.ivu-form-item {
......@@ -525,4 +797,38 @@ export default {
cursor: pointer;
}
}
</style>
.class-drawer {
height: "calc(100% - 55px)";
overflow: "auto";
padding-bottom: "53px";
position: "static";
z-index: 1100 !important;
.subTitle {
margin-top: 20px;
font-size: 14px;
color: #191f25;
font-weight: 700;
}
.drawer-footer {
width: 100%;
position: absolute;
bottom: 0;
left: 0;
border-top: 1px solid #e8e8e8;
padding: 10px 16px;
text-align: right;
background: #fff;
}
/deep/ .ivu-drawer-header-inner {
font-size: 20px;
font-weight: 600;
}
}
</style>
\ No newline at end of file
......@@ -116,7 +116,8 @@
<div style="text-align:center">
<Form :label-width="80">
<FormItem label="值班日期" prop="user">
<DatePicker v-model="importDuty.date" placeholder="请选择值班日期" placement="bottom-end" style="width: 100%"
<DatePicker v-model="importDuty.date" placeholder="请选择值班日期" placement="bottom-end"
style="width: 100%"
type="daterange"/>
</FormItem>
</Form>
......@@ -139,7 +140,8 @@
<div style="text-align:center">
<Form :label-width="80">
<FormItem label="值班日期" prop="user">
<DatePicker v-model="importDutySheet.date" placeholder="请选择值班日期" placement="bottom-end" style="width: 100%"
<DatePicker v-model="importDutySheet.date" placeholder="请选择值班日期" placement="bottom-end"
style="width: 100%"
type="daterange"/>
</FormItem>
</Form>
......@@ -249,7 +251,7 @@ export default {
},
importDutySheetFun() {
//值班表导出
this.importDutySheet.loading = true
this.importDutySheet.loading = true;
this.importDutySheet.formData = {
begin: dayjs(this.importDutySheet.date[0]).format('YYYY-MM-DD'),
end: dayjs(this.importDutySheet.date[1]).format('YYYY-MM-DD'),
......
......@@ -11,7 +11,7 @@
style="width: calc(100% - 70px);"
type="timerange"
/>
<i-switch class="ivu-ml-8" v-model="daylightHours.morrow" size="large" :true-value="1" :false-value="0">
<i-switch v-model="daylightHours.morrow" :false-value="0" :true-value="1" class="ivu-ml-8" size="large">
<template #open>
<span>次日</span>
</template>
......@@ -22,8 +22,6 @@
<template #footer>
<Button @click="()=>daylightHours.show = false">取消</Button>
<Button :disabled="!daylightHours.value.length >0" type="primary" @click="()=>{
// defaultFormData.sign_daytime.push({begin:daylightHours.value[0],end:daylightHours.value[1]})
$refs.ceditmodal.formData.sign_daytime.push({begin:daylightHours.value[0],end:daylightHours.value[1],morrow:daylightHours.morrow}) //子组件同步坐标
daylightHours.show = false
$refs.ceditmodal.$refs.form.validate()
}">确定
......@@ -40,7 +38,7 @@
style="width: calc(100% - 70px);"
type="timerange"
/>
<i-switch class="ivu-ml-8" v-model="eveningTime.morrow" size="large" :true-value="1" :false-value="0">
<i-switch v-model="eveningTime.morrow" :false-value="0" :true-value="1" class="ivu-ml-8" size="large">
<template #open>
<span>次日</span>
</template>
......@@ -66,8 +64,8 @@
mask-closable
@on-cancle="address = undefined">
<template>
<!-- -->
<!--:src="`https://apis.map.qq.com/tools/locpicker?search=1&type=1&key=ZNMBZ-NYOEO-WNMWL-SJF4C-MWKQT-KJB7W&referer=myapp`"-->
<!-- -->
<!--:src="`https://apis.map.qq.com/tools/locpicker?search=1&type=1&key=ZNMBZ-NYOEO-WNMWL-SJF4C-MWKQT-KJB7W&referer=myapp`"-->
<iframe
id="mapPage"
:src="`https://apis.map.qq.com/tools/locpicker?search=1&type=1&key=IZXBZ-OTAWV-XU7PV-5FAAL-F6VXH-7XBQP&referer=myapp`"
......@@ -84,12 +82,13 @@
</Select>
</div>
<template #footer>
<Button :disabled="address == undefined" type="primary" @click="saveAttendance(); $refs.ceditmodal.$refs.form.validate()">确定</Button>
<Button :disabled="address == undefined" type="primary"
@click="saveAttendance(); $refs.ceditmodal.$refs.form.validate()">确定
</Button>
</template>
</Modal>
<!-- 地点设置Modal -->
<!--地点设置Modal-->
<Modal
v-model="locSetModalShow"
mask-closable
......@@ -123,13 +122,13 @@
</template>
</Modal>
<!-- 新增修改Modal -->
<!--新增修改Modal-->
<CEditModal
ref="ceditmodal"
v-model="editModalshow"
:formItem="formItem"
:formRule="formRule"
:formLabelWidth="100"
:formRule="formRule"
:loading="editModalLoading"
:regionDot="regionDot"
:width="850"
......@@ -147,13 +146,13 @@
:labelWidth="120"
:searchCondList="searchCondList"
@onReset="reset"
@onSubmit="search"></SearchCondForm>
@onSubmit="search">
</SearchCondForm>
<Button class="ivu-ml-8" ghost type="primary" @click="add">
<Button class="ivu-ml-8" ghost type="primary" @click="add">
<Icon type="md-add"/>
新增
</Button>
<!-- 数据table -->
<CTable
:dataCount="dataCount"
......@@ -268,9 +267,10 @@ export default {
},
formValidate: {
"name": "",
"sign_daytime": {},
"start_daytime": "",
"end_daytime": "",
"sign_daytime": [],
"duty_night_time_start": "",
"duty_night_time_end": "",
"sign_night_time": [],
......@@ -293,7 +293,7 @@ export default {
page_size: 10,
},
tableColumns: [
{type: 'index', title: '序号', align: 'center', width: 80, show: true, fixed: 'left'},
{type: 'index', title: '序号', align: 'center', width: 80, show: true, fixed: 'left'},
{key: 'name', title: '值班配置值班', align: 'center', minWidth: 150, show: true},
{key: 'day_time', title: '一天值班时间段', align: 'center', minWidth: 150, show: false},
{key: 'effect_begin', title: '配置生效开始时间', align: 'center', minWidth: 150, show: true},
......@@ -326,17 +326,42 @@ export default {
optList: []
},
{id: 'day_time', name: '一天值班时间段', type: 'timerange', disabled: false, require: false, optList: []},
{id: 'duty_daytime', name: '白天值班时间段', type: 'timerange', disabled: false, require: false, optList: []},
{id: 'sign_daytime', name: '白天签到时间', type: 'areaTime1', disabled: false, require: false, optList: []},
/*
{id: 'duty_daytime', name: '白天值班时间段', type: 'timerange', disabled: false, require: false, optList: []},
{id: 'sign_daytime', name: '白天签到时间', type: 'areaTime1', disabled: false, require: false, optList: []},
{
id: 'duty_night_time',
name: '晚上值班时间段',
type: 'timerange',
disabled: false,
require: false,
optList: []
},
{id: 'sign_night_time', name: '晚上签到时间', type: 'areaTime2', disabled: false, require: false, optList: []},
*/
{
id: 'duty_night_time',
name: '晚上值班时间段',
type: 'timerange',
id: 'sign_daytime',
name: '值班时间区间',
type: 'timeTable',
disabled: false,
require: false,
columns: [
{title: '周数', width: 100, key: 'day'},
{title: '值班时间', slot: 'time', minWidth: 410,},
{title: ' ', slot: 'action', width: 140},
],
data: [
{day: '周一', time: ''},
{day: '周二', time: ''},
{day: '周三', time: ''},
{day: '周四', time: ''},
{day: '周五', time: ''},
{day: '周六', time: ''},
{day: '周日', time: ''}
],
optList: []
},
{id: 'sign_night_time', name: '晚上签到时间', type: 'areaTime2', disabled: false, require: false, optList: []},
{id: 'log_content', name: '配置日志', type: 'textarea', disabled: false, require: false, optList: []},
{id: 'attandence_area', name: '值班打卡坐标', type: 'area', disabled: false, require: false, optList: []},
{id: 'is_sign', name: '是否签到', type: 'switch', disabled: false, require: false, optList: []},
......@@ -349,35 +374,35 @@ export default {
{required: true, message: '该项不能为空', trigger: 'blur'},
],
effect_beginAndEffect_end: [
{type:'array', required: true, message: '该项不能为空', trigger: 'change'},
{type: 'array', required: true, message: '该项不能为空', trigger: 'change'},
],
day_time: [
{type:'array', required: true, message: '该项不能为空', trigger: 'change'},
{type: 'array', required: true, message: '该项不能为空', trigger: 'change'},
],
duty_daytime: [
{type:'array', required: true, message: '该项不能为空', trigger: 'change'},
],
sign_daytime: [
{type:'array', required: true, message: '该项不能为空', trigger: 'change'},
{type: 'array', required: true, message: '该项不能为空', trigger: 'change'},
],
/*sign_daytime: [
{type: 'array', required: true, message: '该项不能为空', trigger: 'change'},
],*/
duty_night_time: [
{type:'array', required: true, message: '该项不能为空', trigger: 'change'},
{type: 'array', required: true, message: '该项不能为空', trigger: 'change'},
],
sign_night_time: [
{type:'array', required: true, message: '该项不能为空', trigger: 'change'},
{type:'array', required: true, message: '该项不能为空', trigger: 'blur'},
{type: 'array', required: true, message: '该项不能为空', trigger: 'change'},
{type: 'array', required: true, message: '该项不能为空', trigger: 'blur'},
],
attandence_area: [
{type:'array', required: true, message: '该项不能为空', trigger: 'change'},
{type:'array', required: true, message: '该项不能为空', trigger: 'blur'},
{type: 'array', required: true, message: '该项不能为空', trigger: 'change'},
{type: 'array', required: true, message: '该项不能为空', trigger: 'blur'},
],
},
defaultFormData: {
"name": "",
"start_daytime": "",
"end_daytime": "",
"sign_daytime": [],
"sign_daytime": {},
"duty_night_time_start": "",
"duty_night_time_end": "",
"sign_night_time": [],
......@@ -387,7 +412,7 @@ export default {
"day_time_end": "",
"effect_begin": "",
"effect_end": "",
"is_sign":0,
"is_sign": 0,
},
// 角色
......@@ -416,6 +441,81 @@ export default {
}, false);
},
methods: {
/**
* 默认开放时间
* */
showOpenTime(row) {
//查看开放时间
let info = {
'one': '周一',
'two': '周二',
'three': '周三',
'four': '周四',
'five': '周五',
'six': '周六',
'seven': '周日',
}
let data = eval("(" + row.service_interval_time + ")");
this.openTime.data = [
{day: info['one'], time: data['one']},
{day: info['two'], time: data['two']},
{day: info['three'], time: data['three']},
{day: info['four'], time: data['four']},
{day: info['five'], time: data['five']},
{day: info['six'], time: data['six']},
{day: info['seven'], time: data['seven']}
]
this.$forceUpdate();
this.openTime.show = true
},
defaultOpeningHours(noFormatData) {
console.log("🚀🚀noFo11rmatData🚀,", noFormatData)
//获取默认开放时间 列表数据
let info = {
'one': '周一',
'two': '周二',
'three': '周三',
'four': '周四',
'five': '周五',
'six': '周六',
'seven': '周日',
}
let data = typeof noFormatData === 'string' ? eval("(" + noFormatData + ")") : {
"one": [],
"two": [],
"three": [],
"four": [],
"five": [],
"six": [],
"seven": [],
}
console.log("🚀🚀🚀data,", data)
//
/*{
"one": ["8:00~13:00", "14:00~18:00"],
"two": [],
"three": [],
"four": [],
"five": ["8:00~13:00", "14:00~18:00"],
"six": [],
"seven": [],
}*/
this.formItem[this.formItem.findIndex(a => a.type === 'timeTable')].data = [
{day: info['one'], time: data['one']},
{day: info['two'], time: data['two']},
{day: info['three'], time: data['three']},
{day: info['four'], time: data['four']},
{day: info['five'], time: data['five']},
{day: info['six'], time: data['six']},
{day: info['seven'], time: data['seven']}
]
},
/**
* 默认开放时间
* */
setTime2() {
//触发晚上签到时间
this.eveningTime.show = true
......@@ -515,30 +615,36 @@ export default {
},
rowDetails(row) {
//值班时间区间
this.formItem[this.formItem.findIndex(a => a.type === 'timeTable')].columns = [
{title: '周数', width: 100, key: 'day'},
{
title: '值班时间',
slot: 'time',
minWidth: 590,
},
]
this.$forceUpdate();
this.defaultOpeningHours(row.sign_daytime);
//值班时间区间
this.regionDot = 0
this.editModalshow = true
this.editModalLoading = true
api.getApiDutyConfigGetDutyConfigDetail({id: row.id}).then(res => {
//值班时间区间
this.$forceUpdate();
this.defaultOpeningHours(res.sign_daytime);
//值班时间区间
this.$refs.ceditmodal.modalDetailsInit({
id: row.id,
...res,
sign_daytime: JSON.parse(res.sign_daytime).map(cur => {
return {
begin: cur.Begin,
end: cur.End,
morrow: cur.Morrow
}
}),
sign_night_time: JSON.parse(res.sign_night_time).map(cur => {
return {
begin: cur.Begin,
end: cur.End,
morrow: cur.Morrow
}
}),
attandence_area: JSON.parse(res.attendance_area),
duty_daytime: res.duty_daytime.split('~'),
duty_night_time: res.duty_night_time.split('~'),
day_time: res.day_time.split('~'),
effect_beginAndEffect_end: [
dayjs(res.effect_begin).format('YYYY-MM-DD hh:mm'),
......@@ -553,39 +659,59 @@ export default {
},
// 新增
add() {
//值班时间区间
this.formItem[this.formItem.findIndex(a => a.type === 'timeTable')].columns = [
{title: '周数', width: 100, key: 'day'},
{title: '值班时间', slot: 'time', minWidth: 490,},
{title: ' ', slot: 'action', width: 110},
]
console.log("🚀🚀this.defaultFormData.sign_daytime🚀,", this.defaultFormData.sign_daytime)
this.defaultOpeningHours(this.defaultFormData.sign_daytime);
//值班时间区间
this.flag = 'add'
this.editModalshow = true
this.regionDot = 0
this.$refs.ceditmodal.modalInit('add', {...this.defaultFormData, effect_beginAndEffect_end: [],attandence_area:[]}, '新增值班配置')
this.$refs.ceditmodal.modalInit('add', {
...this.defaultFormData,
effect_beginAndEffect_end: [],
attandence_area: []
}, '新增值班配置')
},
// 编辑
async rowEdit(row) {
console.log('编辑行', row)
//值班时间区间
this.formItem[this.formItem.findIndex(a => a.type === 'timeTable')].columns = [
{title: '周数', width: 100, key: 'day'},
{title: '值班时间', slot: 'time', minWidth: 490,},
{title: ' ', slot: 'action', width: 110},
]
//值班时间区间
this.flag = 'edit'
this.editModalshow = true
this.editModalLoading = true
api.getApiDutyConfigGetDutyConfigDetail({id: row.id}).then(res => {
//值班时间区间
this.defaultOpeningHours(res.sign_daytime)
this.$refs.ceditmodal.aaa ++
//值班时间区间
this.$refs.ceditmodal.modalInit('edit', {
id: row.id,
...res,
sign_daytime: JSON.parse(res.sign_daytime).map(cur => {
/* sign_daytime: JSON.parse(res.sign_daytime).map(cur => {
return {
begin: cur.Begin,
end: cur.End,
morrow: cur.Morrow,
}
}),
sign_night_time: JSON.parse(res.sign_night_time).map(cur => {
return {
begin: cur.Begin,
end: cur.End,
morrow: cur.Morrow,
}
}),
}),*/
attandence_area: JSON.parse(res.attendance_area),
duty_daytime: res.duty_daytime.split('~'), //白天
duty_night_time: res.duty_night_time.split('~'), //晚上
day_time: res.day_time.split('~'),//一天
effect_beginAndEffect_end: [
dayjs(res.effect_begin).format('YYYY-MM-DD hh:mm'),
......@@ -601,13 +727,12 @@ export default {
},
// 新增编辑提交
modalSubmit(val) {
console.log('modal提交', val)
console.log('modal提交', val);
val = {
...val,
//一天值班時段
day_time_end: val.day_time.split('-')[1],
/* day_time_end: val.day_time.split('-')[1],
day_time_start: val.day_time.split('-')[0],
//白天签到時段
......@@ -616,13 +741,26 @@ export default {
//晚上签到時段
duty_night_time_end: val.duty_night_time[1],
duty_night_time_start: val.duty_night_time[0],
duty_night_time_start: val.duty_night_time[0],*/
//配置生效范围
effect_begin: dayjs(val.effect_beginAndEffect_end[0]).format('YYYY-MM-DD hh:mm'),
effect_end: dayjs(val.effect_beginAndEffect_end[1]).format('YYYY-MM-DD hh:mm'),
}
delete val.effect_beginAndEffect_end;
delete val.day_time_end;
delete val.day_time_start;
delete val.end_daytime;
delete val.start_daytime;
delete val.duty_night_time_end;
delete val.duty_night_time_start;
delete val.sign_night_time;
delete val.daytime_num
delete val.duty_daytime
delete val.duty_night_num
delete val.duty_night_time
console.log('modal111提交', val);
return
let strategy = {
'add': () => {
//新增值班配置
......
Markdown 格式
0% or
您添加了 0 人 到此讨论。请谨慎行事。
先完成此消息的编辑!
想要评论请 注册 或