Browse Source

新版本节假日前端界面

master_hella_20240701
陈宜阳 8 months ago
parent
commit
cad84ab304
  1. 59
      src/api/mes/holidayCalendar/index.ts
  2. 61
      src/api/mes/holidaySetting/index.ts
  3. 179
      src/views/mes/holidayCalendar/holidayCalendar.data.ts
  4. 43
      src/views/mes/holidayCalendar/index.vue

59
src/api/mes/holidayCalendar/index.ts

@ -0,0 +1,59 @@
import request from '@/config/axios'
export interface HolidayCalendarVO {
id: number
holidayDate: Date
endTime: Date
textOne: string
textTwo: string
textThree: string
textFour: string
textFive: string
deleteTime: Date
status: string
concurrencyStamp: number
remark: string
deleter: string
siteId: number
}
// 查询节假日设置日历列表
export const getHolidayCalendarPage = async (params) => {
if (params.isSearch) {
delete params.isSearch
const data = {...params}
return await request.post({ url: '/mes/holidayCalendar/senior', data })
} else {
return await request.get({ url: `/mes/holidayCalendar/page`, params })
}
}
// 查询节假日设置日历详情
export const getHolidayCalendar = async (id: number) => {
return await request.get({ url: `/mes/holidayCalendar/get?id=` + id })
}
// 新增节假日设置日历
export const createHolidayCalendar = async (data: HolidayCalendarVO) => {
return await request.post({ url: `/mes/holidayCalendar/create`, data })
}
// 修改节假日设置日历
export const updateHolidayCalendar = async (data: HolidayCalendarVO) => {
return await request.put({ url: `/mes/holidayCalendar/update`, data })
}
// 删除节假日设置日历
export const deleteHolidayCalendar = async (id: number) => {
return await request.delete({ url: `/mes/holidayCalendar/delete?id=` + id })
}
// 导出节假日设置日历 Excel
export const exportHolidayCalendar = async (params) => {
return await request.download({ url: `/mes/holidayCalendar/export-excel`, params })
}
// 下载用户导入模板
export const importTemplate = () => {
return request.download({ url: '/mes/holidayCalendar/get-import-template' })
}

61
src/api/mes/holidaySetting/index.ts

@ -1,61 +0,0 @@
import request from '@/config/axios'
export interface HolidaySettingVO {
id: number
textOne: string
textTwo: string
textThree: string
textFour: string
textFive: string
deleteTime: Date
status: string
concurrencyStamp: number
remark: string
deleter: string
siteId: number
changeEmplId: number
holidayDate: Date
holidayFlag: string
holidayName: string
}
// 查询节假日设置列表
export const getHolidaySettingPage = async (params) => {
if (params.isSearch) {
delete params.isSearch
const data = {...params}
return await request.post({ url: '/mes/holidaySetting/senior', data })
} else {
return await request.get({ url: `/mes/holidaySetting/page`, params })
}
}
// 查询节假日设置详情
export const getHolidaySetting = async (id: number) => {
return await request.get({ url: `/mes/holidaySetting/get?id=` + id })
}
// 新增节假日设置
export const createHolidaySetting = async (data: HolidaySettingVO) => {
return await request.post({ url: `/mes/holidaySetting/create`, data })
}
// 修改节假日设置
export const updateHolidaySetting = async (data: HolidaySettingVO) => {
return await request.put({ url: `/mes/holidaySetting/update`, data })
}
// 删除节假日设置
export const deleteHolidaySetting = async (id: number) => {
return await request.delete({ url: `/mes/holidaySetting/delete?id=` + id })
}
// 导出节假日设置 Excel
export const exportHolidaySetting = async (params) => {
return await request.download({ url: `/mes/holidaySetting/export-excel`, params })
}
// 下载用户导入模板
export const importTemplate = () => {
return request.download({ url: '/mes/holidaySetting/get-import-template' })
}

179
src/views/mes/holidayCalendar/holidayCalendar.data.ts

@ -0,0 +1,179 @@
import type { CrudSchema } from '@/hooks/web/useCrudSchemas'
import { dateFormatter } from '@/utils/formatTime'
// 表单校验
export const HolidayCalendarRules = reactive({
endTime: [required],
concurrencyStamp: [required],
})
export const HolidayCalendar = useCrudSchemas(reactive<CrudSchema[]>([
{
label: 'ID',
field: 'id',
sort: 'custom',
isForm: false,
},
{
label: '日期',
field: 'holidayDate',
sort: 'custom',
formatter: dateFormatter,
isSearch: true,
search: {
component: 'DatePicker',
componentProps: {
valueFormat: 'YYYY-MM-DD HH:mm:ss',
type: 'daterange',
defaultTime: [new Date('1 00:00:00'), new Date('1 23:59:59')]
}
},
form: {
component: 'DatePicker',
componentProps: {
type: 'datetime',
valueFormat: 'x'
}
},
},
{
label: '结束时间',
field: 'endTime',
sort: 'custom',
formatter: dateFormatter,
isSearch: true,
search: {
component: 'DatePicker',
componentProps: {
valueFormat: 'YYYY-MM-DD HH:mm:ss',
type: 'daterange',
defaultTime: [new Date('1 00:00:00'), new Date('1 23:59:59')]
}
},
form: {
component: 'DatePicker',
componentProps: {
type: 'datetime',
valueFormat: 'x'
}
},
},
{
label: '备用字段一',
field: 'textOne',
sort: 'custom',
isSearch: true,
},
{
label: '备用字段二',
field: 'textTwo',
sort: 'custom',
isSearch: true,
},
{
label: '备用字段三',
field: 'textThree',
sort: 'custom',
isSearch: true,
},
{
label: '备用字段四',
field: 'textFour',
sort: 'custom',
isSearch: true,
},
{
label: '备用字段五',
field: 'textFive',
sort: 'custom',
isSearch: true,
},
{
label: '删除时间',
field: 'deleteTime',
sort: 'custom',
formatter: dateFormatter,
isSearch: true,
search: {
component: 'DatePicker',
componentProps: {
valueFormat: 'YYYY-MM-DD HH:mm:ss',
type: 'daterange',
defaultTime: [new Date('1 00:00:00'), new Date('1 23:59:59')]
}
},
form: {
component: 'DatePicker',
componentProps: {
type: 'datetime',
valueFormat: 'x'
}
},
},
{
label: '状态',
field: 'status',
sort: 'custom',
isSearch: true,
form: {
component: 'Radio'
},
},
{
label: '并发乐观锁',
field: 'concurrencyStamp',
sort: 'custom',
isSearch: true,
form: {
component: 'InputNumber',
value: 0
},
},
{
label: '备注',
field: 'remark',
sort: 'custom',
isSearch: true,
},
{
label: '创建时间',
field: 'createTime',
sort: 'custom',
formatter: dateFormatter,
isSearch: true,
search: {
component: 'DatePicker',
componentProps: {
valueFormat: 'YYYY-MM-DD HH:mm:ss',
type: 'daterange',
defaultTime: [new Date('1 00:00:00'), new Date('1 23:59:59')]
}
},
isForm: false,
},
{
label: '删除用户名',
field: 'deleter',
sort: 'custom',
isSearch: true,
},
{
label: '位置ID',
field: 'siteId',
sort: 'custom',
isSearch: true,
form: {
component: 'InputNumber',
value: 0
},
},
{
label: '操作',
field: 'action',
isForm: false,
table: {
width: 150,
fixed: 'right'
}
}
]))

43
src/views/mes/holidayCalendar/index.vue

@ -0,0 +1,43 @@
<template>
<div>
<el-calendar>
<template #date-cell="{ data }">
<div
style="height: 100"
:class="data.isSelected ? 'is-selected' : ''"
@click="handleClick(data.day)">
<div>{{ data.day.split('-').slice(1).join('-') }}</div>
<div v-if="arr.find((v) => v.date === data.day)">{{ arr.find((v) => v.date === data.day).content }}
</div>
<!-- <div>{{ data.isSelected ? '打羽毛球' : '' }}</div>  -->
</div>
</template>
</el-calendar>
</div>
</template>
<script>
export default {
name: 'Calendar',
data() {
return {
value: new Date(),
arr: [
{ date: '2024-04-01', content: '打球' },
{ date: '2024-04-02', content: '打台球' },
{ date: '2024-04-03', content: '打篮球' },
{ date: '2024-04-04', content: '踢足球' }
]
}
},
methods: {
handleClick(date) {
alert(date)
}
}
}
</script>
<style scoped>
</style>
Loading…
Cancel
Save