增加节假日管理
parent
dee5440d43
commit
8d79b63954
@ -0,0 +1,85 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers\API\Admin\YeWu;
|
||||
|
||||
use App\Http\Controllers\Controller;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
|
||||
class HolidayController extends Controller
|
||||
{
|
||||
public function GetList()
|
||||
{
|
||||
$page = request('page');
|
||||
$pageSize = request('pageSize');
|
||||
$searchInfo = request('searchInfo');
|
||||
$list = DB::table('s_holiday');
|
||||
if (!empty($searchInfo['year'])) {
|
||||
$list = $list->where('year', $searchInfo['year']);
|
||||
}
|
||||
if (!empty($searchInfo['type'])) {
|
||||
$list = $list->where('type', $searchInfo['type']);
|
||||
}
|
||||
if (!empty($searchInfo['date_start'])) {
|
||||
$list = $list->where('date', '>=', $searchInfo['date_start']);
|
||||
}
|
||||
if (!empty($searchInfo['date_end'])) {
|
||||
$list = $list->where('date', '<=', $searchInfo['date_end']);
|
||||
}
|
||||
$count = $list->count();
|
||||
$list = $list->orderBy('date', 'desc')
|
||||
->skip(($page - 1) * $pageSize)
|
||||
->take($pageSize)
|
||||
->get();
|
||||
return \Yz::Return(true, "查询完成", ['list' => $list, 'count' => $count]);
|
||||
}
|
||||
|
||||
public function Save(Request $request)
|
||||
{
|
||||
$userid = $request->get('userid');
|
||||
$data = request('Info');
|
||||
if (empty($data['id'])) {
|
||||
$exists = DB::table('s_holiday')->where('date', $data['date'])->exists();
|
||||
if ($exists) {
|
||||
return \Yz::Return(false, '该日期已存在记录');
|
||||
}
|
||||
$insertData = [
|
||||
'year' => date('Y', strtotime($data['date'])),
|
||||
'date' => $data['date'],
|
||||
'type' => $data['type'],
|
||||
];
|
||||
$id = DB::table('s_holiday')->insertGetId($insertData);
|
||||
if ($id) {
|
||||
return \Yz::Return(true, '添加成功', $id);
|
||||
} else {
|
||||
return \Yz::Return(false, '添加失败');
|
||||
}
|
||||
} else {
|
||||
$updateData = [];
|
||||
if (isset($data['date'])) {
|
||||
$updateData['date'] = $data['date'];
|
||||
$updateData['year'] = date('Y', strtotime($data['date']));
|
||||
}
|
||||
if (isset($data['type'])) {
|
||||
$updateData['type'] = $data['type'];
|
||||
}
|
||||
$res = DB::table('s_holiday')->where('id', $data['id'])->update($updateData);
|
||||
if ($res) {
|
||||
return \Yz::Return(true, '修改成功');
|
||||
} else {
|
||||
return \Yz::Return(false, '修改失败');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public function Del()
|
||||
{
|
||||
$id = request('id');
|
||||
$res = DB::table('s_holiday')->where('id', $id)->delete();
|
||||
if ($res) {
|
||||
return \Yz::Return(true, '删除成功');
|
||||
} else {
|
||||
return \Yz::Return(false, '删除失败');
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1,10 +1,10 @@
|
||||
ENV = 'production'
|
||||
VITE_APP_API = 'http://192.168.80.76/api/'
|
||||
VITE_APP_FILE = 'http://192.168.80.76/'
|
||||
VITE_APP_API_5555 = 'http://192.168.80.76/api/'
|
||||
VITE_APP_FILE_5555 = 'http://192.168.80.76/'
|
||||
|
||||
VITE_APP_API_66666666 = 'http://yiji-qhdzhongyiyuan/api/'
|
||||
VITE_APP_FILE_66666666 = 'http://yiji-qhdzhongyiyuan/'
|
||||
|
||||
|
||||
VITE_APP_API_5555 = 'https://yiji.yuluo.online/api/'
|
||||
VITE_APP_FILE_555555 = 'https://yiji.yuluo.online/'
|
||||
VITE_APP_API = 'https://qhdzyyyiji.cjy.net.cn/api/'
|
||||
VITE_APP_FILE = 'https://qhdzyyyiji.cjy.net.cn/'
|
||||
@ -0,0 +1,183 @@
|
||||
<template>
|
||||
<div class="head">
|
||||
<el-row>
|
||||
<el-form-item>
|
||||
<el-date-picker v-model="searchInfo.date_start" type="date" placeholder="开始日期" value-format="YYYY-MM-DD" style="margin-left: 10px;" />
|
||||
</el-form-item>
|
||||
<el-form-item>
|
||||
<el-date-picker v-model="searchInfo.date_end" type="date" placeholder="结束日期" value-format="YYYY-MM-DD" style="margin-left: 10px;" />
|
||||
</el-form-item>
|
||||
<el-form-item>
|
||||
<el-select v-model="searchInfo.type" placeholder="类型" clearable style="margin-left: 10px; width: 120px;">
|
||||
<el-option label="节假日" :value="2" />
|
||||
<el-option label="工作日(补班)" :value="1" />
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-button @click="GetListAction()" style="margin-left: 10px;">搜索</el-button>
|
||||
<el-button type="primary" @click="Add()" style="margin-left: 10px;">添加</el-button>
|
||||
</el-row>
|
||||
</div>
|
||||
<el-table :data="tableData" style="width: 100%;" row-key="id" v-loading="loading">
|
||||
<el-table-column prop="id" label="Id" width="100" />
|
||||
<el-table-column prop="date" label="日期" width="180" />
|
||||
<el-table-column prop="year" label="年份" width="100" />
|
||||
<el-table-column prop="type" label="类型" width="150">
|
||||
<template #default="scope">
|
||||
<el-tag v-if="scope.row.type == 2" type="danger">节假日</el-tag>
|
||||
<el-tag v-if="scope.row.type == 1" type="success">工作日(补班)</el-tag>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column prop="created_at" label="创建时间" />
|
||||
<el-table-column prop="" label="操作" width="180">
|
||||
<template #default="scope">
|
||||
<el-button type="primary" @click="Edit(scope.row)" size="small" style="margin-left: 10px;">修改</el-button>
|
||||
<el-button type="danger" @click="Del(scope.row.id)" size="small" style="margin-left: 10px;">删除</el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
<div class="page">
|
||||
<el-pagination v-model:current-page="currentPage" v-model:page-size="pageSize"
|
||||
:page-sizes="[15, 50, 100, 200]" layout="total,sizes, prev, pager, next" :total="total"
|
||||
@size-change="PageSizeChange" @current-change="PageCurrentChange" />
|
||||
</div>
|
||||
|
||||
<el-dialog v-model="dialogVisible" title="节假日信息" width="30%">
|
||||
<el-form :model="holidayInfo" label-width="100px" v-loading="loading" style="padding-right: 40px;">
|
||||
<el-form-item label="日期:">
|
||||
<el-date-picker v-model="holidayInfo.date" type="date" placeholder="选择日期" value-format="YYYY-MM-DD" style="width: 100%;" />
|
||||
</el-form-item>
|
||||
<el-form-item label="类型:">
|
||||
<el-select v-model="holidayInfo.type" style="width: 100%;">
|
||||
<el-option label="节假日" :value="2" />
|
||||
<el-option label="工作日(补班)" :value="1" />
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
<template #footer>
|
||||
<span class="dialog-footer">
|
||||
<el-button @click="dialogVisible = false">取消</el-button>
|
||||
<el-button type="primary" @click="Save">确定</el-button>
|
||||
</span>
|
||||
</template>
|
||||
</el-dialog>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import {
|
||||
ref,
|
||||
onMounted
|
||||
} from 'vue'
|
||||
import {
|
||||
HolidayGetList, HolidaySave, HolidayDel
|
||||
} from '@/api/api.js'
|
||||
import { ElMessage, ElMessageBox } from 'element-plus'
|
||||
|
||||
let loading = ref(false)
|
||||
let searchInfo = ref({
|
||||
date_start: '',
|
||||
date_end: '',
|
||||
type: null
|
||||
})
|
||||
let holidayInfo = ref({
|
||||
id: null,
|
||||
date: '',
|
||||
type: 2
|
||||
})
|
||||
|
||||
let dialogVisible = ref(false)
|
||||
|
||||
let tableData = ref([])
|
||||
let currentPage = ref(1)
|
||||
let pageSize = ref(15)
|
||||
let total = 0
|
||||
|
||||
const GetListAction = () => {
|
||||
loading.value = true
|
||||
HolidayGetList({
|
||||
searchInfo: searchInfo.value,
|
||||
page: currentPage.value,
|
||||
pageSize: pageSize.value
|
||||
}).then(res => {
|
||||
loading.value = false
|
||||
if (res.status) {
|
||||
tableData.value = res.data.list
|
||||
total = res.data.count
|
||||
} else {
|
||||
ElMessage.error(res.msg)
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
const PageSizeChange = (e) => {
|
||||
pageSize.value = e
|
||||
GetListAction()
|
||||
}
|
||||
|
||||
const PageCurrentChange = (e) => {
|
||||
currentPage.value = e
|
||||
GetListAction()
|
||||
}
|
||||
|
||||
const Add = () => {
|
||||
dialogVisible.value = true
|
||||
holidayInfo.value = {
|
||||
id: null,
|
||||
date: '',
|
||||
type: 2
|
||||
}
|
||||
}
|
||||
|
||||
const Edit = (row) => {
|
||||
holidayInfo.value = {
|
||||
id: row.id,
|
||||
date: row.date,
|
||||
type: row.type
|
||||
}
|
||||
dialogVisible.value = true
|
||||
}
|
||||
|
||||
const Del = (id) => {
|
||||
ElMessageBox.confirm('确定删除吗?', '提示', {
|
||||
confirmButtonText: '确定',
|
||||
cancelButtonText: '取消',
|
||||
type: 'warning',
|
||||
}).then(() => {
|
||||
HolidayDel({ id: id }).then(res => {
|
||||
if (res.status) {
|
||||
GetListAction()
|
||||
} else {
|
||||
ElMessage.error(res.msg)
|
||||
}
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
const Save = () => {
|
||||
if (!holidayInfo.value.date) {
|
||||
ElMessage.error('请选择日期')
|
||||
return
|
||||
}
|
||||
loading.value = true
|
||||
HolidaySave({ Info: holidayInfo.value }).then(res => {
|
||||
loading.value = false
|
||||
if (res.status) {
|
||||
dialogVisible.value = false
|
||||
GetListAction()
|
||||
} else {
|
||||
ElMessage.error(res.msg)
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
onMounted(() => {
|
||||
GetListAction()
|
||||
})
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
.page {
|
||||
display: flex;
|
||||
justify-content: flex-end;
|
||||
margin-top: 10px;
|
||||
}
|
||||
</style>
|
||||
@ -1,42 +0,0 @@
|
||||
{
|
||||
"$schema": "https://opencode.ai/config.json",
|
||||
"plugin": ["oh-my-openagent"],
|
||||
"mcp": {
|
||||
"playwright-server": {
|
||||
"enabled": true,
|
||||
"type": "local",
|
||||
"command": ["npx", "-y", "@executeautomation/playwright-mcp-server"]
|
||||
}
|
||||
},
|
||||
"provider":{
|
||||
"minimax-yangzong": {
|
||||
"npm": "@ai-sdk/anthropic",
|
||||
"options": {
|
||||
"baseURL": "https://api.minimaxi.com/anthropic/v1",
|
||||
"apiKey": "{env:YANG_MINMAX_KEY}"
|
||||
},
|
||||
"models": {
|
||||
"MiniMax-M2.7": {
|
||||
"name": "MiniMax-M2.7"
|
||||
}
|
||||
}
|
||||
},
|
||||
"yan-ZhiPu": {
|
||||
"options": {
|
||||
"baseURL": "https://open.bigmodel.cn/api/coding/paas/v4",
|
||||
"apiKey": "{env:YAN_ZHIPU_API_KEY}"
|
||||
},
|
||||
"models": {
|
||||
"GLM-4.7": {
|
||||
"name": "GLM-4.7"
|
||||
},
|
||||
"GLM-5": {
|
||||
"name": "GLM-5"
|
||||
},
|
||||
"GLM-5.1": {
|
||||
"name": "GLM-5.1"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Loading…
Reference in New Issue