Commit 0d1e3a08 authored by 王鑫's avatar 王鑫

feat: 新增节假日

parent a01ecd68
...@@ -4,7 +4,8 @@ const api = { ...@@ -4,7 +4,8 @@ const api = {
getPage: '/holidays/page', getPage: '/holidays/page',
synchronousVacation: '/holidays/synchronousVacation', synchronousVacation: '/holidays/synchronousVacation',
deleteHoliday: '/holidays/', deleteHoliday: '/holidays/',
batchDeleteHoliday: '/holidays/batchDelete' batchDeleteHoliday: '/holidays/batchDelete',
addHoliday: '/holidays/add'
} }
export default api export default api
...@@ -43,3 +44,12 @@ export function batchDeleteHoliday(parameter) { ...@@ -43,3 +44,12 @@ export function batchDeleteHoliday(parameter) {
useFullLoading: true useFullLoading: true
}) })
} }
export function addHoliday(parameter) {
return axios({
url: api.addHoliday,
method: 'post',
data: parameter,
useFullLoading: true
})
}
\ No newline at end of file
<template>
<a-modal
:title="modalTitle"
v-model="visible"
@ok="handleOk"
:maskClosable="false"
:width="modalWidth"
class="cust-modal"
okText="保存"
>
<a-form>
<a-row>
<a-col :span="12">
<a-form-item label='假期名称' :labelCol="{ span: 5 }" :wrapperCol="{ span: 17 }">
<a-input v-model="submitInfo.name" placeholder="双休日请输入星期六或星期日" />
</a-form-item>
</a-col>
<a-col :span="12">
<a-form-item label='假期类型' :labelCol="{ span: 5 }" :wrapperCol="{ span: 17 }">
<a-select :default-value="(holidayTypes[0]||{}).valueInt" @change="handleChange">
<a-select-option v-for="item in holidayTypes" :value="item.valueInt" :key="item.id">
{{item.name}}
</a-select-option>
</a-select>
</a-form-item>
</a-col>
</a-row>
<a-row>
<a-col :span="12">
<a-form-item v-if="durationInput" label='假期时间' :labelCol="{ span: 5 }" :wrapperCol="{ span: 17 }">
<a-date-picker style="width: 100%" />
</a-form-item>
<a-form-item v-else label='假期范围' :labelCol="{ span: 5 }" :wrapperCol="{ span: 17 }">
<a-range-picker @change="onChange" />
</a-form-item>
</a-col>
<a-col :span="12">
<a-form-item label='假期时长' :labelCol="{ span: 5 }" :wrapperCol="{ span: 17 }">
<a-input disabled="disabled" v-model="submitInfo.duration" />
</a-form-item>
</a-col>
</a-row>
</a-form>
</a-modal>
</template>
<script>
import {addHoliday} from "@api/holidays/holidays";
export default {
name: 'SysBusinessDetail',
props:[
'holidayTypes',
'year'
],
data() {
return {
parentName:"",//父业务名称
optType: 0,
sysBusiness:{},
isChildBusiness: false,
visible: false,
modalTitle: "新建假期",
modalWidth:800,
durationInput: false,
submitInfo:{
name: "",
dayCode: (this.holidayTypes[0]||{}).valueInt,
startDate: null,
endDate: null,
duration: 0,
year: this.year
}
}
},
methods: {
handleOk() {
addHoliday(this.submitInfo).then(response => {
if (response && response.code == SYS_CONST.REQUEST.SUCCEED) {
this.visible = false;
this.loadData();
}
});
},
onChange(date,dateStr) {
this.submitInfo.duration = date[1].diff(date[0],'day')+1;
this.submitInfo.startDate = dateStr[0];
this.submitInfo.endDate = dateStr[1];
},
handleChange(value) {
this.submitInfo.dayCode = value
if(value===SYS_CONST.HOLIDAY_TYPE.WEEKEND){
this.durationInput = true
this.submitInfo.duration = 1
}else {
this.durationInput = false
this.submitInfo.duration = 0
}
}
}
}
</script>
\ No newline at end of file
...@@ -40,7 +40,7 @@ ...@@ -40,7 +40,7 @@
</span> </span>
<div class="cust-table-operator"> <div class="cust-table-operator">
<a-button-group> <a-button-group>
<a-button type="primary">新建</a-button> <a-button type="primary" @click="addNew">新建</a-button>
<a-button @click="onBatchDelete" type="danger">批量删除</a-button> <a-button @click="onBatchDelete" type="danger">批量删除</a-button>
</a-button-group> </a-button-group>
</div> </div>
...@@ -83,12 +83,13 @@ ...@@ -83,12 +83,13 @@
:showTotal="$showTotal"/> :showTotal="$showTotal"/>
</div> </div>
</a-table> </a-table>
<holidays-detail ref="holidayDetail" :holidayTypes="holidayTypes" :year="query.year"></holidays-detail>
</a-card> </a-card>
</template> </template>
<script> <script>
import {getCommonCode} from "@api/system/sysCode"; import {getCommonCode} from "@api/system/sysCode";
import {getPage,synchronousVacation,deleteHoliday,batchDeleteHoliday} from "@api/holidays/holidays"; import {getPage,synchronousVacation,deleteHoliday,batchDeleteHoliday} from "@api/holidays/holidays";
import HolidaysDetail from "@views/holidays/HolidaysDetail";
const columns = [ const columns = [
{title: '名称', width: 100,dataIndex: 'name'}, {title: '名称', width: 100,dataIndex: 'name'},
{title: '类型', width: 80, dataIndex: 'dayCode',scopedSlots: {customRender: 'dayCode'}}, {title: '类型', width: 80, dataIndex: 'dayCode',scopedSlots: {customRender: 'dayCode'}},
...@@ -102,6 +103,7 @@ const columns = [ ...@@ -102,6 +103,7 @@ const columns = [
const dataSource = [] const dataSource = []
export default { export default {
name: 'HolidaysList', name: 'HolidaysList',
components: {HolidaysDetail},
data() { data() {
return { return {
query: { query: {
...@@ -222,6 +224,9 @@ export default { ...@@ -222,6 +224,9 @@ export default {
}) })
} }
this.query.year = current this.query.year = current
},
addNew(){
this.$refs.holidayDetail.visible=true
} }
}, },
mounted() { mounted() {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment