Ver Fonte

日历新增接口创建

pm há 3 meses atrás
pai
commit
73767ab843

+ 42 - 0
src/api/calendar/index.ts

@@ -0,0 +1,42 @@
+// src/api/mes/modeStation/modeStation.ts
+import request from '@/config/axios'
+
+export interface HolidayVO {
+  holidayType?: string
+  theDay: string
+  startTime?: string
+  endTime?: string
+  remark?: string
+  createTime?: Date
+}
+
+export interface PageParam {
+  pageNo: number
+  pageSize: number
+}
+
+// 查询工作流模式列表
+export const getHolidayPage = async (params: PageParam) => {
+  return await request.get({ url: '/iscs/holiday/getHolidayPage', params })
+}
+
+// 获取工作流模式详细信息
+export const selectHolidayById = async (id: number) => {
+  return await request.get({ url: '/iscs/holiday/selectHolidayById', params: { id: id } })
+}
+
+// 单一修改工作流模式
+export const updateHoliday = async (data: HolidayVO) => {
+  return await request.put({ url: '/iscs/holiday/updateHoliday', data })
+}
+// 批量修改工作流模式
+export const updateHolidayList = async (data: HolidayVO) => {
+  return await request.post({ url: '/iscs/holiday/updateHolidayList', data })
+}
+
+// 删除工作流模式
+export const deleteHolidayList = async (ids: number) => {
+  return await request.delete({
+    url: '/iscs/holiday/deleteHolidayList?ids='+ids,
+  })
+}

+ 3 - 0
src/utils/dict.ts

@@ -256,6 +256,7 @@ export enum DICT_TYPE {
   TICKET_TYPE = 'ticket_type',
   JOB_LOG_TYPE = 'job_log_type',
   HARDWARE_STATUS = 'hardware_status',
+
   IS_USER_TYPE = 'is_user_type',
   LOCK_TYPE = 'lock_type',
   JOB_STATUS = 'job_status',
@@ -301,4 +302,6 @@ export enum DICT_TYPE {
   ISOCCUPIED_STATUS = 'isOccupied_status',
   SLOT_TYPE = 'slot_type',
   SLOT_STATUS = 'slot_status',
+  HOLIDAY_TYPE='holiday_type',
+  HOLIDAY_UNIT='holiday_unit'
 }

+ 85 - 0
src/views/calendar/calendarView/BatchHolidayForm.vue

@@ -0,0 +1,85 @@
+<template>
+  <Dialog v-model="visible" title="批量设置节假日" width="500px" >
+    <el-form v-loading="formLoading"  :model="form" label-width="120px">
+      <el-form-item label="开始日期">
+        <el-date-picker
+          v-model="form.startDay"
+          type="date"
+          value-format="YYYY-MM-DD"
+          placeholder="开始日期"
+        />
+      </el-form-item>
+      <el-form-item label="结束日期">
+        <el-date-picker
+          v-model="form.endDay"
+          type="date"
+          value-format="YYYY-MM-DD"
+          placeholder="结束日期"
+        />
+      </el-form-item>
+      <el-form-item label="单位">
+        <el-select v-model="form.unit" placeholder="选择单位">
+          <el-option
+            v-for="dict in getIntDictOptions(DICT_TYPE.HOLIDAY_UNIT)"
+            :key="dict.value"
+            :label="dict.label"
+            :value="dict.value"
+          />
+        </el-select>
+      </el-form-item>
+      <el-form-item label="值">
+        <el-input v-model="form.value" placeholder="如 周一 或 15" />
+      </el-form-item>
+      <el-form-item label="类型">
+        <el-select v-model="form.holidayType" placeholder="选择类型">
+          <el-option
+            v-for="dict in getStrDictOptions(DICT_TYPE.HOLIDAY_TYPE)"
+            :key="dict.value"
+            :label="dict.label"
+            :value="dict.value"
+          />
+        </el-select>
+      </el-form-item>
+    </el-form>
+    <template #footer>
+      <el-button @click="visible = false">取消</el-button>
+      <el-button type="primary" @click="submit" :disabled="formLoading">确定</el-button>
+    </template>
+  </Dialog>
+</template>
+
+<script setup lang="ts">
+import { ref } from 'vue'
+import { updateHolidayList } from '@/api/calendar/index'
+import { ElMessage } from 'element-plus'
+import { getStrDictOptions, DICT_TYPE,getIntDictOptions } from '@/utils/dict'
+
+// 弹框
+const formLoading = ref(false) // 表单的加载中
+const visible = ref(false)
+const form = ref({
+  startDay: '',
+  endDay: '',
+  unit: '',
+  value: '',
+  holidayType: '',
+})
+
+// 打开
+const open = () => {
+  visible.value = true
+}
+
+defineExpose({ open })
+
+const emit = defineEmits(['success'])
+const submit = async () => {
+  // 提交请求
+  formLoading.value = true
+  await updateHolidayList(form.value)
+  ElMessage.success('批量节假日设置成功')
+  formLoading.value = false
+  visible.value = false
+  emit('success')
+}
+</script>

+ 65 - 0
src/views/calendar/calendarView/SingleHolidayForm.vue

@@ -0,0 +1,65 @@
+<template>
+  <Dialog v-model="visible" title="设置节假日" width="400px">
+    <el-form v-loading="formLoading"  :model="form" label-width="120px">
+      <el-form-item label="日期">
+        <el-date-picker
+          v-model="form.theDay"
+          type="date"
+          value-format="YYYY-MM-DD"
+          placeholder="选择日期"
+        />
+      </el-form-item>
+      <el-form-item label="类型">
+        <el-select
+          v-model="form.holidayType"
+          placeholder="请选择节假日类型"
+        >
+          <el-option
+            v-for="dict in getStrDictOptions(DICT_TYPE.HOLIDAY_TYPE)"
+            :key="dict.value"
+            :label="dict.label"
+            :value="dict.value"
+          />
+        </el-select>
+      </el-form-item>
+    </el-form>
+    <template #footer>
+      <el-button @click="visible = false">取消</el-button>
+      <el-button type="primary" @click="submit" :disabled="formLoading">确定</el-button>
+    </template>
+  </Dialog>
+</template>
+
+<script setup lang="ts">
+import { ref } from 'vue'
+import { updateHoliday } from '@/api/calendar/index'
+import { ElMessage } from 'element-plus'
+import {DICT_TYPE, getStrDictOptions} from '@/utils/dict'
+
+// 弹框
+const formLoading = ref(false) // 表单的加载中
+const visible = ref(false)
+const form = ref({
+  theDay: '',
+  holidayType: '',
+})
+
+// 打开
+const open = () => {
+  visible.value = true
+}
+
+defineExpose({ open })
+
+// 提交
+const emit = defineEmits(['success'])
+const submit = async () => {
+  // 提交请求
+  formLoading.value = true
+  await updateHoliday(form.value)
+  ElMessage.success('单个节假日设置成功')
+  formLoading.value = false
+  visible.value = false
+  emit('success')
+}
+</script>

+ 39 - 1
src/views/calendar/calendarView/index.vue

@@ -17,6 +17,23 @@
           <el-checkbox label="workday">显示调休上班</el-checkbox>
         </el-checkbox-group>
       </div>
+      <!-- 单个设置按钮 -->
+      <el-button
+        type="primary"
+        plain
+        @click="openSingleForm('create')"
+      >
+        <Icon icon="ep:plus" class="mr-5px" /> 设置节假日
+      </el-button>
+
+      <!-- 批量设置按钮 -->
+      <el-button
+        type="success"
+        plain
+        @click="openBatchForm('create')"
+      >
+        <Icon icon="ep:plus" class="mr-5px" /> 批量设置节假日
+      </el-button>
     </ContentWrap>
 
     <div class="calendar-wrapper">
@@ -50,19 +67,40 @@
       </el-calendar>
     </div>
   </div>
+  <!-- 引入子表单组件 -->
+  <SingleHolidayForm ref="singleFormRef" @success="refresh" />
+  <BatchHolidayForm ref="batchFormRef" @success="refresh" />
 </template>
 
 <script setup>
 import { ref, computed, onMounted, watch } from 'vue';
 import axios from 'axios';
-
+// 引入子组件
+import SingleHolidayForm from './SingleHolidayForm.vue'
+import BatchHolidayForm from './BatchHolidayForm.vue'
 // 当前年
 const currentYear = new Date().getFullYear();
 const selectedYear = ref(currentYear);
 const selectedDate = ref(new Date());
 const holidayData = ref({});
 const showOptions = ref(['weekend', 'legal', 'holiday', 'workday']);
+// ref
+const singleFormRef = ref()
+const batchFormRef = ref()
+
+// 打开
+const openSingleForm = (type) => {
+  singleFormRef.value.open(type)
+}
 
+const openBatchForm = (type) => {
+  batchFormRef.value.open(type)
+}
+
+// 成功回调
+const refresh = () => {
+  console.log('重新拉列表或做后续操作')
+}
 // 年份选项
 const yearOptions = computed(() => {
   const years = [];