11111
This commit is contained in:
parent
81c57e91fb
commit
9fb1e00ca7
@ -4,8 +4,11 @@ import java.util.ArrayList;
|
|||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import javax.servlet.http.HttpServletResponse;
|
import javax.servlet.http.HttpServletResponse;
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||||
|
import com.ruoyi.base.domain.BaseCalendar;
|
||||||
|
import com.ruoyi.base.service.IBaseCalendarService;
|
||||||
import org.springframework.security.access.prepost.PreAuthorize;
|
import org.springframework.security.access.prepost.PreAuthorize;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.web.bind.annotation.*;
|
import org.springframework.web.bind.annotation.*;
|
||||||
@ -34,10 +37,11 @@ import com.ruoyi.common.core.page.TableDataInfo;
|
|||||||
*/
|
*/
|
||||||
@RestController
|
@RestController
|
||||||
@RequestMapping("/base/event")
|
@RequestMapping("/base/event")
|
||||||
public class BaseCalendarEventController extends BaseController
|
public class BaseCalendarEventController extends BaseController {
|
||||||
{
|
|
||||||
@Autowired
|
@Autowired
|
||||||
private IBaseCalendarEventService baseCalendarEventService;
|
private IBaseCalendarEventService baseCalendarEventService;
|
||||||
|
@Autowired
|
||||||
|
private IBaseCalendarService baseCalendarService;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 查询节日列表
|
* 查询节日列表
|
||||||
@ -45,11 +49,10 @@ public class BaseCalendarEventController extends BaseController
|
|||||||
@PreAuthorize("@ss.hasPermi('base:event:list')")
|
@PreAuthorize("@ss.hasPermi('base:event:list')")
|
||||||
@GetMapping("/list")
|
@GetMapping("/list")
|
||||||
public AjaxResult list(BaseCalendarEvent baseCalendarEvent,
|
public AjaxResult list(BaseCalendarEvent baseCalendarEvent,
|
||||||
@RequestParam(name = "pageNum", defaultValue = "1") Integer pageNum,
|
@RequestParam(name = "pageNum", defaultValue = "1") Integer pageNum,
|
||||||
@RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize)
|
@RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize) {
|
||||||
{
|
|
||||||
Page<BaseCalendarEvent> page = new Page<>(pageNum, pageSize);
|
Page<BaseCalendarEvent> page = new Page<>(pageNum, pageSize);
|
||||||
IPage<BaseCalendarEvent> list = baseCalendarEventService.queryListPage(baseCalendarEvent,page);
|
IPage<BaseCalendarEvent> list = baseCalendarEventService.queryListPage(baseCalendarEvent, page);
|
||||||
return success(list);
|
return success(list);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -60,8 +63,7 @@ public class BaseCalendarEventController extends BaseController
|
|||||||
@PreAuthorize("@ss.hasPermi('base:event:export')")
|
@PreAuthorize("@ss.hasPermi('base:event:export')")
|
||||||
@Log(title = "节日", businessType = BusinessType.EXPORT)
|
@Log(title = "节日", businessType = BusinessType.EXPORT)
|
||||||
@PostMapping("/export")
|
@PostMapping("/export")
|
||||||
public void export(HttpServletResponse response, BaseCalendarEvent baseCalendarEvent)
|
public void export(HttpServletResponse response, BaseCalendarEvent baseCalendarEvent) {
|
||||||
{
|
|
||||||
List<BaseCalendarEvent> list = baseCalendarEventService.list();
|
List<BaseCalendarEvent> list = baseCalendarEventService.list();
|
||||||
ExcelUtil<BaseCalendarEvent> util = new ExcelUtil<BaseCalendarEvent>(BaseCalendarEvent.class);
|
ExcelUtil<BaseCalendarEvent> util = new ExcelUtil<BaseCalendarEvent>(BaseCalendarEvent.class);
|
||||||
util.exportExcel(response, list, "节日数据");
|
util.exportExcel(response, list, "节日数据");
|
||||||
@ -72,30 +74,43 @@ public class BaseCalendarEventController extends BaseController
|
|||||||
*/
|
*/
|
||||||
@PreAuthorize("@ss.hasPermi('base:event:query')")
|
@PreAuthorize("@ss.hasPermi('base:event:query')")
|
||||||
@GetMapping(value = "/{id}")
|
@GetMapping(value = "/{id}")
|
||||||
public AjaxResult getInfo(@PathVariable("id") String id)
|
public AjaxResult getInfo(@PathVariable("id") String id) {
|
||||||
{
|
|
||||||
return success(baseCalendarEventService.getById(id));
|
return success(baseCalendarEventService.getById(id));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 新增节日
|
* 修改节日
|
||||||
*/
|
*
|
||||||
|
* @param baseCalendarEvent TODO
|
||||||
|
* @return com.ruoyi.common.core.domain.AjaxResult
|
||||||
|
* @author PQZ
|
||||||
|
* @date 19:12 2025/11/18
|
||||||
|
**/
|
||||||
@PreAuthorize("@ss.hasPermi('base:event:add')")
|
@PreAuthorize("@ss.hasPermi('base:event:add')")
|
||||||
@Log(title = "节日", businessType = BusinessType.INSERT)
|
@Log(title = "节日", businessType = BusinessType.INSERT)
|
||||||
@PostMapping
|
@PostMapping
|
||||||
public AjaxResult add(@RequestBody BaseCalendarEvent baseCalendarEvent)
|
public AjaxResult add(@RequestBody BaseCalendarEvent baseCalendarEvent) {
|
||||||
{
|
//查询日历id
|
||||||
|
BaseCalendar calendar = baseCalendarService.getByYearMonthDay(baseCalendarEvent.getYear(), baseCalendarEvent.getMonth(), baseCalendarEvent.getDay());
|
||||||
|
baseCalendarEvent.setDateId(calendar.getId());
|
||||||
return toAjax(baseCalendarEventService.save(baseCalendarEvent));
|
return toAjax(baseCalendarEventService.save(baseCalendarEvent));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 修改节日
|
* 修改节假日
|
||||||
*/
|
*
|
||||||
|
* @param baseCalendarEvent TODO
|
||||||
|
* @return com.ruoyi.common.core.domain.AjaxResult
|
||||||
|
* @author PQZ
|
||||||
|
* @date 19:13 2025/11/18
|
||||||
|
**/
|
||||||
@PreAuthorize("@ss.hasPermi('base:event:edit')")
|
@PreAuthorize("@ss.hasPermi('base:event:edit')")
|
||||||
@Log(title = "节日", businessType = BusinessType.UPDATE)
|
@Log(title = "节日", businessType = BusinessType.UPDATE)
|
||||||
@PutMapping
|
@PutMapping
|
||||||
public AjaxResult edit(@RequestBody BaseCalendarEvent baseCalendarEvent)
|
public AjaxResult edit(@RequestBody BaseCalendarEvent baseCalendarEvent) {
|
||||||
{
|
//查询日历id
|
||||||
|
BaseCalendar calendar = baseCalendarService.getByYearMonthDay(baseCalendarEvent.getYear(), baseCalendarEvent.getMonth(), baseCalendarEvent.getDay());
|
||||||
|
baseCalendarEvent.setDateId(calendar.getId());
|
||||||
return toAjax(baseCalendarEventService.updateById(baseCalendarEvent));
|
return toAjax(baseCalendarEventService.updateById(baseCalendarEvent));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -104,9 +119,8 @@ public class BaseCalendarEventController extends BaseController
|
|||||||
*/
|
*/
|
||||||
@PreAuthorize("@ss.hasPermi('base:event:remove')")
|
@PreAuthorize("@ss.hasPermi('base:event:remove')")
|
||||||
@Log(title = "节日", businessType = BusinessType.DELETE)
|
@Log(title = "节日", businessType = BusinessType.DELETE)
|
||||||
@DeleteMapping("/{ids}")
|
@DeleteMapping("/{ids}")
|
||||||
public AjaxResult remove(@PathVariable String[] ids)
|
public AjaxResult remove(@PathVariable String[] ids) {
|
||||||
{
|
|
||||||
List<String> list = new ArrayList<>(Arrays.asList(ids));
|
List<String> list = new ArrayList<>(Arrays.asList(ids));
|
||||||
return toAjax(baseCalendarEventService.removeByIds(list));
|
return toAjax(baseCalendarEventService.removeByIds(list));
|
||||||
}
|
}
|
||||||
|
|||||||
@ -8,6 +8,7 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|||||||
import com.baomidou.mybatisplus.extension.service.IService;
|
import com.baomidou.mybatisplus.extension.service.IService;
|
||||||
import com.ruoyi.base.domain.BaseCalendar;
|
import com.ruoyi.base.domain.BaseCalendar;
|
||||||
import com.ruoyi.base.vo.BaseCalendarVO;
|
import com.ruoyi.base.vo.BaseCalendarVO;
|
||||||
|
import io.swagger.models.auth.In;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 日历Service接口
|
* 日历Service接口
|
||||||
@ -48,9 +49,22 @@ public interface IBaseCalendarService extends IService<BaseCalendar> {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* 获取已经生成日历的年份以及生成中国节假日的年份
|
* 获取已经生成日历的年份以及生成中国节假日的年份
|
||||||
|
*
|
||||||
|
* @return java.util.Map<java.lang.String, java.util.List < java.lang.String>>
|
||||||
* @author PQZ
|
* @author PQZ
|
||||||
* @date 15:26 2025/11/12
|
* @date 15:26 2025/11/12
|
||||||
* @return java.util.Map<java.lang.String,java.util.List<java.lang.String>>
|
**/
|
||||||
**/
|
Map<String, List<Long>> getGeneraYear();
|
||||||
Map<String,List<Long>> getGeneraYear();
|
|
||||||
|
/**
|
||||||
|
* 通过年月日精确锁定日期
|
||||||
|
*
|
||||||
|
* @param year 年
|
||||||
|
* @param month 月
|
||||||
|
* @param day 日
|
||||||
|
* @return com.ruoyi.base.domain.BaseCalendar
|
||||||
|
* @author PQZ
|
||||||
|
* @date 19:10 2025/11/18
|
||||||
|
**/
|
||||||
|
BaseCalendar getByYearMonthDay(Integer year, Integer month, Integer day);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -142,6 +142,25 @@ public class BaseCalendarServiceImpl extends ServiceImpl<BaseCalendarMapper, Bas
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 通过年月日精确锁定日期
|
||||||
|
*
|
||||||
|
* @param year 年
|
||||||
|
* @param month 月
|
||||||
|
* @param day 日
|
||||||
|
* @return com.ruoyi.base.domain.BaseCalendar
|
||||||
|
* @author PQZ
|
||||||
|
* @date 19:10 2025/11/18
|
||||||
|
**/
|
||||||
|
@Override
|
||||||
|
public BaseCalendar getByYearMonthDay(Integer year, Integer month, Integer day) {
|
||||||
|
LambdaQueryWrapper<BaseCalendar> lambdaQueryWrapper = new LambdaQueryWrapper<>();
|
||||||
|
lambdaQueryWrapper.eq(BaseCalendar::getYear,year)
|
||||||
|
.eq(BaseCalendar::getMonth,month)
|
||||||
|
.eq(BaseCalendar::getDay,day);
|
||||||
|
return getOne(lambdaQueryWrapper);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 使用Hutool计算农历日期
|
* 使用Hutool计算农历日期
|
||||||
*
|
*
|
||||||
|
|||||||
@ -9,10 +9,13 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||||||
<result property="dateId" column="date_id" />
|
<result property="dateId" column="date_id" />
|
||||||
<result property="country" column="country" />
|
<result property="country" column="country" />
|
||||||
<result property="eventName" column="event_name" />
|
<result property="eventName" column="event_name" />
|
||||||
|
<result property="year" column="year" />
|
||||||
|
<result property="month" column="month" />
|
||||||
|
<result property="day" column="day" />
|
||||||
</resultMap>
|
</resultMap>
|
||||||
|
|
||||||
<sql id="selectBaseCalendarEventVo">
|
<sql id="selectBaseCalendarEventVo">
|
||||||
select id, date_id, country, event_name from base_calendar_event
|
select id, date_id, country, event_name,year ,month,day from base_calendar_event
|
||||||
</sql>
|
</sql>
|
||||||
|
|
||||||
<select id="queryListPage" parameterType="BaseCalendarEvent" resultMap="BaseCalendarEventResult">
|
<select id="queryListPage" parameterType="BaseCalendarEvent" resultMap="BaseCalendarEventResult">
|
||||||
|
|||||||
@ -1,15 +1,7 @@
|
|||||||
<template>
|
<template>
|
||||||
<div class="app-container">
|
<div class="app-container">
|
||||||
<el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="68px">
|
<el-form @submit.native.prevent :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="80px">
|
||||||
<el-form-item label="国家名称" prop="nameEn">
|
<el-form-item label="国家名称" prop="nameEn">
|
||||||
<el-input
|
|
||||||
v-model="queryParams.nameEn"
|
|
||||||
placeholder="请输入国家名称"
|
|
||||||
clearable
|
|
||||||
@keyup.enter.native="handleQuery"
|
|
||||||
/>
|
|
||||||
</el-form-item>
|
|
||||||
<el-form-item label="国家名称" prop="nameCn">
|
|
||||||
<el-input
|
<el-input
|
||||||
v-model="queryParams.nameCn"
|
v-model="queryParams.nameCn"
|
||||||
placeholder="请输入国家名称"
|
placeholder="请输入国家名称"
|
||||||
@ -37,8 +29,7 @@
|
|||||||
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
|
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
|
||||||
</el-row>
|
</el-row>
|
||||||
|
|
||||||
<el-table v-loading="loading" :data="countryList" @selection-change="handleSelectionChange">
|
<el-table v-loading="loading" :data="countryList" >
|
||||||
<el-table-column type="selection" width="55" align="center" />
|
|
||||||
<el-table-column label="英文标准名称" align="left" prop="nameEn">
|
<el-table-column label="英文标准名称" align="left" prop="nameEn">
|
||||||
<template slot-scope="scope">
|
<template slot-scope="scope">
|
||||||
<img :src="getImg(scope.row.img)" style="width: 30px; height: 20px;"/>
|
<img :src="getImg(scope.row.img)" style="width: 30px; height: 20px;"/>
|
||||||
@ -145,7 +136,6 @@ export default {
|
|||||||
queryParams: {
|
queryParams: {
|
||||||
pageNum: 1,
|
pageNum: 1,
|
||||||
pageSize: 10,
|
pageSize: 10,
|
||||||
nameEn: null,
|
|
||||||
nameCn: null,
|
nameCn: null,
|
||||||
},
|
},
|
||||||
// 表单参数
|
// 表单参数
|
||||||
|
|||||||
@ -1,14 +1,6 @@
|
|||||||
<template>
|
<template>
|
||||||
<div class="app-container">
|
<div class="app-container">
|
||||||
<el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="68px">
|
<el-form @submit.native.prevent :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="80px">
|
||||||
<el-form-item label="日期ID(base_calendar表ID)" prop="dateId">
|
|
||||||
<el-input
|
|
||||||
v-model="queryParams.dateId"
|
|
||||||
placeholder="请输入日期ID(base_calendar表ID)"
|
|
||||||
clearable
|
|
||||||
@keyup.enter.native="handleQuery"
|
|
||||||
/>
|
|
||||||
</el-form-item>
|
|
||||||
<el-form-item label="国家名称" prop="country">
|
<el-form-item label="国家名称" prop="country">
|
||||||
<el-input
|
<el-input
|
||||||
v-model="queryParams.country"
|
v-model="queryParams.country"
|
||||||
@ -32,15 +24,7 @@
|
|||||||
</el-form>
|
</el-form>
|
||||||
|
|
||||||
<el-row :gutter="10" class="mb8">
|
<el-row :gutter="10" class="mb8">
|
||||||
<el-col :span="1.5">
|
|
||||||
<el-button
|
|
||||||
type="primary"
|
|
||||||
plain
|
|
||||||
icon="el-icon-plus"
|
|
||||||
size="mini"
|
|
||||||
@click="eventSync"
|
|
||||||
>同步</el-button>
|
|
||||||
</el-col>
|
|
||||||
<el-col :span="1.5">
|
<el-col :span="1.5">
|
||||||
<el-button
|
<el-button
|
||||||
type="primary"
|
type="primary"
|
||||||
@ -49,49 +33,21 @@
|
|||||||
size="mini"
|
size="mini"
|
||||||
@click="handleAdd"
|
@click="handleAdd"
|
||||||
v-hasPermi="['base:event:add']"
|
v-hasPermi="['base:event:add']"
|
||||||
>新增</el-button>
|
>新增
|
||||||
</el-col>
|
</el-button>
|
||||||
<el-col :span="1.5">
|
|
||||||
<el-button
|
|
||||||
type="success"
|
|
||||||
plain
|
|
||||||
icon="el-icon-edit"
|
|
||||||
size="mini"
|
|
||||||
:disabled="single"
|
|
||||||
@click="handleUpdate"
|
|
||||||
v-hasPermi="['base:event:edit']"
|
|
||||||
>修改</el-button>
|
|
||||||
</el-col>
|
|
||||||
<el-col :span="1.5">
|
|
||||||
<el-button
|
|
||||||
type="danger"
|
|
||||||
plain
|
|
||||||
icon="el-icon-delete"
|
|
||||||
size="mini"
|
|
||||||
:disabled="multiple"
|
|
||||||
@click="handleDelete"
|
|
||||||
v-hasPermi="['base:event:remove']"
|
|
||||||
>删除</el-button>
|
|
||||||
</el-col>
|
|
||||||
<el-col :span="1.5">
|
|
||||||
<el-button
|
|
||||||
type="warning"
|
|
||||||
plain
|
|
||||||
icon="el-icon-download"
|
|
||||||
size="mini"
|
|
||||||
@click="handleExport"
|
|
||||||
v-hasPermi="['base:event:export']"
|
|
||||||
>导出</el-button>
|
|
||||||
</el-col>
|
</el-col>
|
||||||
|
|
||||||
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
|
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
|
||||||
</el-row>
|
</el-row>
|
||||||
|
|
||||||
<el-table v-loading="loading" :data="eventList" @selection-change="handleSelectionChange">
|
<el-table v-loading="loading" :data="eventList">
|
||||||
<el-table-column type="selection" width="55" align="center" />
|
<el-table-column label="日期" align="center" prop="dateId">
|
||||||
<el-table-column label="主键" align="center" prop="id" />
|
<template slot-scope="scope">
|
||||||
<el-table-column label="日期ID(base_calendar表ID)" align="center" prop="dateId" />
|
<span>{{ scope.row.year }}-{{ scope.row.month }}-{{ scope.row.day }}</span>
|
||||||
<el-table-column label="国家名称" align="center" prop="country" />
|
</template>
|
||||||
<el-table-column label="节日名称" align="center" prop="eventName" />
|
</el-table-column>
|
||||||
|
<el-table-column label="国家名称" align="center" prop="country"/>
|
||||||
|
<el-table-column label="节日名称" align="center" prop="eventName"/>
|
||||||
<el-table-column label="操作" align="center" class-name="small-padding fixed-width">
|
<el-table-column label="操作" align="center" class-name="small-padding fixed-width">
|
||||||
<template slot-scope="scope">
|
<template slot-scope="scope">
|
||||||
<el-button
|
<el-button
|
||||||
@ -100,14 +56,16 @@
|
|||||||
icon="el-icon-edit"
|
icon="el-icon-edit"
|
||||||
@click="handleUpdate(scope.row)"
|
@click="handleUpdate(scope.row)"
|
||||||
v-hasPermi="['base:event:edit']"
|
v-hasPermi="['base:event:edit']"
|
||||||
>修改</el-button>
|
>修改
|
||||||
|
</el-button>
|
||||||
<el-button
|
<el-button
|
||||||
size="mini"
|
size="mini"
|
||||||
type="text"
|
type="text"
|
||||||
icon="el-icon-delete"
|
icon="el-icon-delete"
|
||||||
@click="handleDelete(scope.row)"
|
@click="handleDelete(scope.row)"
|
||||||
v-hasPermi="['base:event:remove']"
|
v-hasPermi="['base:event:remove']"
|
||||||
>删除</el-button>
|
>删除
|
||||||
|
</el-button>
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
</el-table>
|
</el-table>
|
||||||
@ -123,14 +81,19 @@
|
|||||||
<!-- 添加或修改节日对话框 -->
|
<!-- 添加或修改节日对话框 -->
|
||||||
<el-dialog :title="title" :visible.sync="open" width="500px" append-to-body>
|
<el-dialog :title="title" :visible.sync="open" width="500px" append-to-body>
|
||||||
<el-form ref="form" :model="form" :rules="rules" label-width="80px">
|
<el-form ref="form" :model="form" :rules="rules" label-width="80px">
|
||||||
<el-form-item label="日期ID(base_calendar表ID)" prop="dateId">
|
<el-form-item label="日期" prop="dateValue">
|
||||||
<el-input v-model="form.dateId" placeholder="请输入日期ID(base_calendar表ID)" />
|
<el-date-picker
|
||||||
|
v-model="form.dateValue"
|
||||||
|
type="date"
|
||||||
|
placeholder="选择日期时间"
|
||||||
|
>
|
||||||
|
</el-date-picker>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item label="国家名称" prop="country">
|
<el-form-item label="国家名称" prop="country">
|
||||||
<el-input v-model="form.country" placeholder="请输入国家名称" />
|
<el-input v-model="form.country" placeholder="请输入国家名称"/>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item label="节日名称" prop="eventName">
|
<el-form-item label="节日名称" prop="eventName">
|
||||||
<el-input v-model="form.eventName" placeholder="请输入节日名称" />
|
<el-input v-model="form.eventName" placeholder="请输入节日名称"/>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
</el-form>
|
</el-form>
|
||||||
<div slot="footer" class="dialog-footer">
|
<div slot="footer" class="dialog-footer">
|
||||||
@ -142,10 +105,10 @@
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import { listEvent, getEvent,syncEvent, delEvent, addEvent, updateEvent } from "@/api/base/event";
|
import { listEvent, getEvent, syncEvent, delEvent, addEvent, updateEvent } from '@/api/base/event'
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: "Event",
|
name: 'Event',
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
// 遮罩层
|
// 遮罩层
|
||||||
@ -163,7 +126,7 @@ export default {
|
|||||||
// 节日表格数据
|
// 节日表格数据
|
||||||
eventList: [],
|
eventList: [],
|
||||||
// 弹出层标题
|
// 弹出层标题
|
||||||
title: "",
|
title: '',
|
||||||
// 是否显示弹出层
|
// 是否显示弹出层
|
||||||
open: false,
|
open: false,
|
||||||
// 查询参数
|
// 查询参数
|
||||||
@ -175,83 +138,117 @@ export default {
|
|||||||
eventName: null
|
eventName: null
|
||||||
},
|
},
|
||||||
// 表单参数
|
// 表单参数
|
||||||
form: {},
|
form: {
|
||||||
|
id: null,
|
||||||
|
dateValue: null,
|
||||||
|
dateId: null,
|
||||||
|
country: null,
|
||||||
|
eventName: null,
|
||||||
|
year: null,
|
||||||
|
month: null,
|
||||||
|
day: null
|
||||||
|
},
|
||||||
// 表单校验
|
// 表单校验
|
||||||
rules: {
|
rules: {
|
||||||
|
dateValue: [
|
||||||
|
{ required: true, message: '日期不能为空', trigger: 'blur' }
|
||||||
|
],
|
||||||
|
country: [
|
||||||
|
{ required: true, message: '国家名称不能为空', trigger: 'blur' }
|
||||||
|
],
|
||||||
|
eventName: [
|
||||||
|
{ required: true, message: '节日名称不能为空', trigger: 'blur' }
|
||||||
|
]
|
||||||
}
|
}
|
||||||
};
|
}
|
||||||
},
|
},
|
||||||
created() {
|
created() {
|
||||||
this.getList();
|
this.getList()
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
|
|
||||||
eventSync(){
|
eventSync() {
|
||||||
syncEvent().then(res =>{
|
syncEvent().then(res => {
|
||||||
this.$modal.msgSuccess("同步成功");
|
this.$modal.msgSuccess('同步成功')
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
|
|
||||||
/** 查询节日列表 */
|
/** 查询节日列表 */
|
||||||
getList() {
|
getList() {
|
||||||
this.loading = true;
|
this.loading = true
|
||||||
listEvent(this.queryParams).then(response => {
|
listEvent(this.queryParams).then(response => {
|
||||||
this.eventList = response.data.records;
|
this.eventList = response.data.records
|
||||||
this.total = response.data.total;
|
this.total = response.data.total
|
||||||
this.loading = false;
|
this.loading = false
|
||||||
});
|
})
|
||||||
},
|
},
|
||||||
// 取消按钮
|
// 取消按钮
|
||||||
cancel() {
|
cancel() {
|
||||||
this.open = false;
|
this.open = false
|
||||||
this.reset();
|
this.reset()
|
||||||
},
|
},
|
||||||
// 表单重置
|
// 表单重置
|
||||||
reset() {
|
reset() {
|
||||||
this.form = {
|
this.form = {
|
||||||
id: null,
|
id: null,
|
||||||
|
dateValue: null,
|
||||||
dateId: null,
|
dateId: null,
|
||||||
country: null,
|
country: null,
|
||||||
eventName: null
|
eventName: null,
|
||||||
};
|
year: null,
|
||||||
this.resetForm("form");
|
month: null,
|
||||||
|
day: null
|
||||||
|
}
|
||||||
},
|
},
|
||||||
/** 搜索按钮操作 */
|
/** 搜索按钮操作 */
|
||||||
handleQuery() {
|
handleQuery() {
|
||||||
this.queryParams.pageNum = 1;
|
this.queryParams.pageNum = 1
|
||||||
this.getList();
|
this.getList()
|
||||||
},
|
},
|
||||||
/** 重置按钮操作 */
|
/** 重置按钮操作 */
|
||||||
resetQuery() {
|
resetQuery() {
|
||||||
this.resetForm("queryForm");
|
this.resetForm('queryForm')
|
||||||
this.handleQuery();
|
this.handleQuery()
|
||||||
},
|
},
|
||||||
// 多选框选中数据
|
// 多选框选中数据
|
||||||
handleSelectionChange(selection) {
|
handleSelectionChange(selection) {
|
||||||
this.ids = selection.map(item => item.id)
|
this.ids = selection.map(item => item.id)
|
||||||
this.single = selection.length!==1
|
this.single = selection.length !== 1
|
||||||
this.multiple = !selection.length
|
this.multiple = !selection.length
|
||||||
},
|
},
|
||||||
/** 新增按钮操作 */
|
/** 新增按钮操作 */
|
||||||
handleAdd() {
|
handleAdd() {
|
||||||
this.reset();
|
this.reset()
|
||||||
this.open = true;
|
this.open = true
|
||||||
this.title = "添加节日";
|
this.title = '添加节日'
|
||||||
},
|
},
|
||||||
/** 修改按钮操作 */
|
/** 修改按钮操作 */
|
||||||
handleUpdate(row) {
|
handleUpdate(row) {
|
||||||
this.reset();
|
this.reset()
|
||||||
const id = row.id || this.ids
|
const id = row.id || this.ids
|
||||||
getEvent(id).then(response => {
|
getEvent(id).then(response => {
|
||||||
this.form = response.data;
|
this.form = response.data
|
||||||
this.open = true;
|
const dataValue = new Date(this.form.year, this.form.month - 1, this.form.day)
|
||||||
this.title = "修改节日";
|
this.$set(this.form, "dateValue",dataValue);
|
||||||
});
|
this.open = true
|
||||||
|
this.title = '修改节日'
|
||||||
|
})
|
||||||
},
|
},
|
||||||
/** 提交按钮 */
|
/** 提交按钮 */
|
||||||
submitForm() {
|
submitForm() {
|
||||||
this.$refs["form"].validate(valid => {
|
this.$refs["form"].validate(valid => {
|
||||||
if (valid) {
|
if (valid) {
|
||||||
|
// his.form.dateValue 是一个 Date 对象
|
||||||
|
const date = new Date(this.form.dateValue)
|
||||||
|
// 提取年份
|
||||||
|
const year = date.getFullYear()
|
||||||
|
// 提取月份(注意:月份从 0 开始,所以需要 +1)
|
||||||
|
const month = date.getMonth() + 1
|
||||||
|
// 提取日期
|
||||||
|
const day = date.getDate()
|
||||||
|
this.form.year = year
|
||||||
|
this.form.month = month
|
||||||
|
this.form.day = day
|
||||||
if (this.form.id != null) {
|
if (this.form.id != null) {
|
||||||
updateEvent(this.form).then(response => {
|
updateEvent(this.form).then(response => {
|
||||||
this.$modal.msgSuccess("修改成功");
|
this.$modal.msgSuccess("修改成功");
|
||||||
@ -270,13 +267,14 @@ export default {
|
|||||||
},
|
},
|
||||||
/** 删除按钮操作 */
|
/** 删除按钮操作 */
|
||||||
handleDelete(row) {
|
handleDelete(row) {
|
||||||
const ids = row.id || this.ids;
|
const ids = row.id || this.ids
|
||||||
this.$modal.confirm('是否确认删除节日编号为"' + ids + '"的数据项?').then(function() {
|
this.$modal.confirm('是否确认删除节日编号为"' + ids + '"的数据项?').then(function() {
|
||||||
return delEvent(ids);
|
return delEvent(ids)
|
||||||
}).then(() => {
|
}).then(() => {
|
||||||
this.getList();
|
this.getList()
|
||||||
this.$modal.msgSuccess("删除成功");
|
this.$modal.msgSuccess('删除成功')
|
||||||
}).catch(() => {});
|
}).catch(() => {
|
||||||
|
})
|
||||||
},
|
},
|
||||||
/** 导出按钮操作 */
|
/** 导出按钮操作 */
|
||||||
handleExport() {
|
handleExport() {
|
||||||
@ -285,5 +283,5 @@ export default {
|
|||||||
}, `event_${new Date().getTime()}.xlsx`)
|
}, `event_${new Date().getTime()}.xlsx`)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
<template>
|
<template>
|
||||||
<div class="app-container">
|
<div class="app-container">
|
||||||
<el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="68px">
|
<el-form @submit.native.prevent :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="110px">
|
||||||
<el-form-item label="时区标准名称" prop="zoneName">
|
<el-form-item label="时区标准名称" prop="zoneName">
|
||||||
<el-input
|
<el-input
|
||||||
v-model="queryParams.zoneName"
|
v-model="queryParams.zoneName"
|
||||||
@ -29,7 +29,7 @@
|
|||||||
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
|
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
|
||||||
</el-row>
|
</el-row>
|
||||||
|
|
||||||
<el-table v-loading="loading" :data="zoneList" @selection-change="handleSelectionChange">
|
<el-table v-loading="loading" :data="zoneList">
|
||||||
<el-table-column label="时区标准名称" align="center" prop="zoneName" />
|
<el-table-column label="时区标准名称" align="center" prop="zoneName" />
|
||||||
<el-table-column label="UTC 偏移量" align="center" prop="utcOffset" />
|
<el-table-column label="UTC 偏移量" align="center" prop="utcOffset" />
|
||||||
<el-table-column label="时区缩写" align="center" prop="abbreviation" />
|
<el-table-column label="时区缩写" align="center" prop="abbreviation" />
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user