更新班组
This commit is contained in:
@@ -2,7 +2,7 @@
|
||||
* @Author: zwq
|
||||
* @Date: 2021-11-18 14:16:25
|
||||
* @LastEditors: zwq
|
||||
* @LastEditTime: 2025-10-23 13:29:58
|
||||
* @LastEditTime: 2025-11-05 13:43:53
|
||||
* @Description:
|
||||
-->
|
||||
<template>
|
||||
@@ -18,6 +18,7 @@
|
||||
<el-col :span="12">
|
||||
<el-form-item label="节假日名称" prop="name">
|
||||
<el-input
|
||||
ref="inputWidth"
|
||||
v-model="dataForm.name"
|
||||
clearable
|
||||
:disabled="detail"
|
||||
@@ -54,7 +55,7 @@
|
||||
</el-col>
|
||||
<el-col :span="12">
|
||||
<el-form-item
|
||||
v-if="dataForm.dateType == 1"
|
||||
v-if="dataForm.dateType == 1 && dataForm.calendarType == 1"
|
||||
label="日期"
|
||||
prop="dateDay">
|
||||
<el-date-picker
|
||||
@@ -66,9 +67,13 @@
|
||||
placeholder="选择日期"
|
||||
format="yyyy-MM-dd"
|
||||
value-format="--MM-dd"
|
||||
@blur="$forceUpdate()"
|
||||
:picker-options="pickerOptions"></el-date-picker>
|
||||
</el-form-item>
|
||||
<el-form-item v-else label="日期" prop="dateDayArr">
|
||||
<el-form-item
|
||||
v-else-if="dataForm.dateType == 2 && dataForm.calendarType == 1"
|
||||
label="日期"
|
||||
prop="dateDayArr">
|
||||
<el-date-picker
|
||||
:disabled="detail"
|
||||
style="width: 100%"
|
||||
@@ -80,8 +85,53 @@
|
||||
range-separator="至"
|
||||
start-placeholder="开始日期"
|
||||
end-placeholder="结束日期"
|
||||
@blur="$forceUpdate()"
|
||||
:picker-options="pickerOptions"></el-date-picker>
|
||||
</el-form-item>
|
||||
<el-form-item
|
||||
v-else-if="dataForm.dateType == 1 && dataForm.calendarType == 2"
|
||||
label="日期"
|
||||
prop="dateDayChinese">
|
||||
<j-date-picker
|
||||
ref="JDatePicker1"
|
||||
style="line-height: 18px"
|
||||
v-model="dataForm.dateDayChinese"
|
||||
id="value1"
|
||||
:width="width1"
|
||||
:placeholder="placeholder"
|
||||
:picker-options="pickerOptions"
|
||||
:rangeSeparator="rangeSeparator"
|
||||
@change="onDateChange"
|
||||
:disabled="detail"
|
||||
:showLunarClass="showLunarClass"
|
||||
:showLunarControl="showLunarControl"
|
||||
type="DATE"
|
||||
:showBackYears="showBackYears"
|
||||
:showLunarIcon="showLunarIcon"
|
||||
:format="format"></j-date-picker>
|
||||
</el-form-item>
|
||||
<el-form-item
|
||||
v-else-if="dataForm.dateType == 2 && dataForm.calendarType == 2"
|
||||
label="日期"
|
||||
prop="dateDayArrChinese">
|
||||
<j-date-picker
|
||||
style="line-height: 18px"
|
||||
ref="JDatePicker2"
|
||||
v-model="dataForm.dateDayArrChinese"
|
||||
id="value2"
|
||||
:width="width1"
|
||||
:placeholder="placeholder"
|
||||
:picker-options="pickerOptions"
|
||||
:rangeSeparator="rangeSeparator"
|
||||
@change="onDateChange"
|
||||
:disabled="detail"
|
||||
:showLunarClass="showLunarClass"
|
||||
:showLunarControl="showLunarControl"
|
||||
type="DATERANGE"
|
||||
:showBackYears="showBackYears"
|
||||
:showLunarIcon="showLunarIcon"
|
||||
:format="format"></j-date-picker>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="12">
|
||||
<el-form-item label="是否每年重复" prop="repeat">
|
||||
@@ -131,6 +181,7 @@
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import JDatePicker from 'vue-jlunar-datepicker';
|
||||
import {
|
||||
createHoliday,
|
||||
updateHoliday,
|
||||
@@ -141,7 +192,9 @@ import {
|
||||
} from '@/api/group/holidaySetting';
|
||||
|
||||
export default {
|
||||
components: {},
|
||||
components: {
|
||||
JDatePicker,
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
dataForm: {
|
||||
@@ -151,6 +204,10 @@ export default {
|
||||
dateType: 1,
|
||||
dateDay: undefined,
|
||||
dateDayArr: [],
|
||||
dateDayChinese: undefined,
|
||||
dateDayArrChinese: [],
|
||||
noRepeatYear: undefined,
|
||||
noRepeatYearChinese: undefined,
|
||||
repeat: true,
|
||||
inherited: true, // 是否为继承
|
||||
deptId: undefined,
|
||||
@@ -202,6 +259,12 @@ export default {
|
||||
dateDayArr: [
|
||||
{ required: true, message: '日期不能为空', trigger: 'change' },
|
||||
],
|
||||
dateDayChinese: [
|
||||
{ required: true, message: '日期不能为空', trigger: 'change' },
|
||||
],
|
||||
dateDayArrChinese: [
|
||||
{ required: true, message: '日期不能为空', trigger: 'change' },
|
||||
],
|
||||
repeat: [
|
||||
{
|
||||
required: true,
|
||||
@@ -216,12 +279,61 @@ export default {
|
||||
},
|
||||
},
|
||||
dialogVisible: false,
|
||||
//农历组件数据
|
||||
showLunarClass: 'LUNAR', //农历日期的展示类型 MIX(混合)FULLLUNAR(全农历)LUNAR(农历)NUMBER(数字)
|
||||
showBackYears: 2, //向后展示年数;见于年份列表;
|
||||
showLunarIcon: true, //是否显示农历控制组件
|
||||
showLunarControl: false, //是否显示农历控制组件
|
||||
width1: '300', //这个设置成100%,原组件写死了px需要修改
|
||||
format: 'yyyy-MM-dd',
|
||||
placeholder: '',
|
||||
rangeSeparator: '-',
|
||||
editable: true,
|
||||
clearable: true,
|
||||
pickerOptions: {
|
||||
disabledDate(time) {
|
||||
return time.getTime() < Date.now() - 8.64e7;
|
||||
},
|
||||
},
|
||||
};
|
||||
},
|
||||
|
||||
watch: {
|
||||
'dataForm.calendarType': function (newValue, oldValue) {
|
||||
this.$nextTick(() => {
|
||||
if (this.$refs.JDatePicker1) {
|
||||
this.$refs.JDatePicker1.isLunar = true; //默认转为农历
|
||||
this.$refs.JDatePicker1.onLunarChange();
|
||||
}
|
||||
if (this.$refs.JDatePicker2) {
|
||||
this.$refs.JDatePicker2.isLunar = true;
|
||||
this.$refs.JDatePicker2.onLunarChange();
|
||||
}
|
||||
});
|
||||
},
|
||||
'dataForm.dateType': function (newValue, oldValue) {
|
||||
this.$nextTick(() => {
|
||||
if (this.$refs.JDatePicker1) {
|
||||
this.$refs.JDatePicker1.isLunar = true; //默认转为农历
|
||||
this.$refs.JDatePicker1.onLunarChange();
|
||||
}
|
||||
if (this.$refs.JDatePicker2) {
|
||||
this.$refs.JDatePicker2.isLunar = true;
|
||||
this.$refs.JDatePicker2.onLunarChange();
|
||||
}
|
||||
});
|
||||
},
|
||||
},
|
||||
mounted() {
|
||||
this.$nextTick(() => {
|
||||
this.width1 = this.$refs.inputWidth.$el.offsetWidth + '';
|
||||
});
|
||||
},
|
||||
methods: {
|
||||
init(deptId, id, detail) {
|
||||
init(deptId, val, detail) {
|
||||
this.dataForm.deptId = deptId || undefined;
|
||||
this.dataForm.id = id || undefined;
|
||||
this.dataForm.id = val.holidayId || undefined;
|
||||
this.dataForm.inherited = val.isInherit || false;
|
||||
this.detail = detail || false;
|
||||
this.$nextTick(() => {
|
||||
this.$refs['dataForm'].resetFields();
|
||||
@@ -245,14 +357,21 @@ export default {
|
||||
this.dataForm.dateType == 1 &&
|
||||
this.dataForm.calendarType == 2
|
||||
) {
|
||||
this.dataForm.dateDay = this.dataForm.oneDayChinese;
|
||||
this.dataForm.dateDayChinese =
|
||||
'L' +
|
||||
new Date().getFullYear() +
|
||||
this.dataForm.oneDayChinese.slice(-6);
|
||||
} else if (
|
||||
this.dataForm.dateType == 2 &&
|
||||
this.dataForm.calendarType == 2
|
||||
) {
|
||||
this.dataForm.dateDayArr = [
|
||||
this.dataForm.startDayChinese,
|
||||
this.dataForm.endDayChinese,
|
||||
this.dataForm.dateDayArrChinese = [
|
||||
'L' +
|
||||
new Date().getFullYear() +
|
||||
this.dataForm.startDayChinese.slice(-6),
|
||||
'L' +
|
||||
new Date().getFullYear() +
|
||||
this.dataForm.endDayChinese.slice(-6),
|
||||
];
|
||||
}
|
||||
});
|
||||
@@ -307,10 +426,13 @@ export default {
|
||||
this.$modal.msgSuccess('删除成功');
|
||||
updateSchedule({ logId: res.data.logId }).then((res1) => {
|
||||
this.$modal.msgSuccess('更新成功');
|
||||
this.$emit('refreshPage');
|
||||
});
|
||||
this.$emit('refreshPage');
|
||||
});
|
||||
},
|
||||
onDateChange(val) {
|
||||
console.log(val);
|
||||
},
|
||||
// 表单提交
|
||||
dataFormSubmit() {
|
||||
this.$refs['dataForm'].validate((valid) => {
|
||||
@@ -329,25 +451,57 @@ export default {
|
||||
this.dataForm.dateType == 1 &&
|
||||
this.dataForm.calendarType == 2
|
||||
) {
|
||||
this.dataForm.oneDayChinese = this.dataForm.dateDay;
|
||||
this.dataForm.oneDayChinese =
|
||||
'--' + this.dataForm.dateDayChinese.slice(-5);
|
||||
} else if (
|
||||
this.dataForm.dateType == 2 &&
|
||||
this.dataForm.calendarType == 2
|
||||
) {
|
||||
this.dataForm.startDayChinese = this.dataForm.dateDayArr[0];
|
||||
this.dataForm.endDayChinese = this.dataForm.dateDayArr[1];
|
||||
this.dataForm.startDayChinese =
|
||||
'--' + this.dataForm.dateDayArrChinese[0].slice(-5);
|
||||
this.dataForm.endDayChinese =
|
||||
'--' + this.dataForm.dateDayArrChinese[1].slice(-5);
|
||||
}
|
||||
if (this.dataForm.calendarType == 1 && !this.dataForm.repeat) {
|
||||
this.dataForm.noRepeatYear = new Date().getFullYear();
|
||||
} else if (this.dataForm.calendarType == 2 && !this.dataForm.repeat) {
|
||||
this.dataForm.noRepeatYearChinese = new Date().getFullYear();
|
||||
}
|
||||
// 修改的提交
|
||||
if (this.dataForm.id) {
|
||||
updateHoliday(this.dataForm).then((response) => {
|
||||
this.$modal.msgSuccess('修改成功');
|
||||
this.$emit('refreshPage');
|
||||
updateHoliday(this.dataForm).then((res) => {
|
||||
if (!res.data.updateFlag) {
|
||||
this.$modal.msgSuccess('修改成功');
|
||||
this.$emit('refreshPage');
|
||||
} else {
|
||||
this.$confirm(
|
||||
'新增节假日影响已有排班计划,是否立即更新?',
|
||||
'更新排班',
|
||||
{
|
||||
confirmButtonText: '立即更新',
|
||||
cancelButtonText: '暂不更新',
|
||||
type: 'warning',
|
||||
}
|
||||
)
|
||||
.then(() => {
|
||||
updateSchedule({ logId: res.data.logId }).then((res1) => {
|
||||
this.$modal.msgSuccess('更新成功');
|
||||
});
|
||||
this.$emit('refreshPage');
|
||||
})
|
||||
.catch(() => {
|
||||
this.$message({
|
||||
type: 'info',
|
||||
message: '已取消',
|
||||
});
|
||||
this.$emit('refreshPage');
|
||||
});
|
||||
}
|
||||
});
|
||||
return;
|
||||
}
|
||||
// 添加的提交
|
||||
createHoliday(this.dataForm).then((res) => {
|
||||
updateSchedule;
|
||||
if (!res.data.updateFlag) {
|
||||
this.$modal.msgSuccess('新增成功');
|
||||
this.$emit('refreshPage');
|
||||
@@ -363,15 +517,16 @@ export default {
|
||||
)
|
||||
.then(() => {
|
||||
updateSchedule({ logId: res.data.logId }).then((res1) => {
|
||||
this.$modal.msgSuccess('新增成功');
|
||||
this.$emit('refreshPage');
|
||||
this.$modal.msgSuccess('更新成功');
|
||||
});
|
||||
this.$emit('refreshPage');
|
||||
})
|
||||
.catch(() => {
|
||||
this.$message({
|
||||
type: 'info',
|
||||
message: '已取消',
|
||||
});
|
||||
this.$emit('refreshPage');
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user