😎调整优化日程相关代码和升级npm依赖

This commit is contained in:
zuohuaijun 2024-07-20 16:25:10 +08:00
parent 4a07a213fd
commit 1567099226
15 changed files with 485 additions and 50 deletions

View File

@ -20,15 +20,33 @@ public class SysSchedule : EntityTenant
public long UserId { get; set; }
/// <summary>
/// 日程时间
/// 日程日期
/// </summary>
[SugarColumn(ColumnDescription = "日程时间")]
[SugarColumn(ColumnDescription = "日程日期")]
public DateTime? ScheduleTime { get; set; }
/// <summary>
/// 开始时间
/// </summary>
[SugarColumn(ColumnDescription = "开始时间", Length = 10)]
public string? StartTime { get; set; }
/// <summary>
/// 结束时间
/// </summary>
[SugarColumn(ColumnDescription = "结束时间", Length = 10)]
public string? EndTime { get; set; }
/// <summary>
/// 日程内容
/// </summary>
[SugarColumn(ColumnDescription = "日程内容", Length = 256)]
[Required, MaxLength(256)]
public virtual string Content { get; set; }
/// <summary>
/// 完成状态
/// </summary>
[SugarColumn(ColumnDescription = "完成状态")]
public FinishStatusEnum Status { get; set; } = FinishStatusEnum.UnFinish;
}

View File

@ -0,0 +1,26 @@
// Admin.NET 项目的版权、商标、专利和其他相关权利均受相应法律法规的保护。使用本项目应遵守相关法律法规和许可证的要求。
//
// 本项目主要遵循 MIT 许可证和 Apache 许可证(版本 2.0)进行分发和使用。许可证位于源代码树根目录中的 LICENSE-MIT 和 LICENSE-APACHE 文件。
//
// 不得利用本项目从事危害国家安全、扰乱社会秩序、侵犯他人合法权益等法律法规禁止的活动!任何基于本项目二次开发而产生的一切法律纠纷和责任,我们不承担任何责任!
namespace Admin.NET.Core;
/// <summary>
/// 完成状态枚举
/// </summary>
[Description("完成状态枚举")]
public enum FinishStatusEnum
{
/// <summary>
/// 已完成
/// </summary>
[Description("已完成")]
Finish = 1,
/// <summary>
/// 未完成
/// </summary>
[Description("未完成")]
UnFinish = 0,
}

View File

@ -6,7 +6,15 @@
namespace Admin.NET.Core.Service;
public class ScheduleInput
public class ScheduleInput : BaseIdInput
{
/// <summary>
/// 状态
/// </summary>
public virtual FinishStatusEnum Status { get; set; }
}
public class ListScheduleInput
{
public DateTime? StartTime { get; set; }

View File

@ -27,13 +27,13 @@ public class SysScheduleService : IDynamicApiController, ITransient
/// </summary>
/// <returns></returns>
[DisplayName("获取日程列表")]
public async Task<List<SysSchedule>> Page(ScheduleInput input)
public async Task<List<SysSchedule>> Page(ListScheduleInput input)
{
return await _sysSchedule.AsQueryable()
.Where(u => u.UserId == _userManager.UserId)
.WhereIF(!string.IsNullOrWhiteSpace(input.StartTime.ToString()), u => u.ScheduleTime >= input.StartTime)
.WhereIF(!string.IsNullOrWhiteSpace(input.EndTime.ToString()), u => u.ScheduleTime <= input.EndTime)
.OrderBy(u => u.CreateTime, OrderByType.Asc)
.OrderBy(u => u.StartTime, OrderByType.Asc)
.ToListAsync();
}
@ -84,4 +84,21 @@ public class SysScheduleService : IDynamicApiController, ITransient
{
await _sysSchedule.DeleteAsync(u => u.Id == input.Id);
}
/// <summary>
/// 设置日程状态
/// </summary>
/// <param name="input"></param>
/// <returns></returns>
[DisplayName("设置日程状态")]
public async Task<int> SetStatus(ScheduleInput input)
{
if (!Enum.IsDefined(typeof(FinishStatusEnum), input.Status))
throw Oops.Oh(ErrorCodeEnum.D3005);
return await _sysSchedule.AsUpdateable()
.SetColumns(u => u.Status == input.Status)
.Where(u => u.Id == input.Id)
.ExecuteCommandAsync();
}
}

View File

@ -2,7 +2,7 @@
"name": "admin.net.pro",
"type": "module",
"version": "2.4.33",
"lastBuildTime": "2024.07.18",
"lastBuildTime": "2024.07.20",
"description": "Admin.NET 站在巨人肩膀上的 .NET 通用权限开发框架",
"author": "zuohuaijun",
"license": "MIT",
@ -57,7 +57,7 @@
"splitpanes": "^3.1.5",
"vcrontab-3": "^3.3.22",
"vform3-builds": "^3.0.10",
"vue": "^3.4.32",
"vue": "^3.4.33",
"vue-clipboard3": "^2.0.0",
"vue-demi": "^0.14.8",
"vue-grid-layout": "3.0.0-beta1",
@ -68,8 +68,8 @@
"vue-signature-pad": "^3.0.2",
"vue3-tree-org": "^4.2.2",
"vuedraggable": "4.0.3",
"vxe-pc-ui": "^4.0.74",
"vxe-table": "^4.7.54",
"vxe-pc-ui": "^4.0.77",
"vxe-table": "^4.7.56",
"vxe-table-plugin-element": "^4.0.4",
"vxe-table-plugin-export-xlsx": "^4.0.5",
"xe-utils": "^3.5.28",
@ -86,7 +86,7 @@
"@typescript-eslint/parser": "^7.16.1",
"@vitejs/plugin-vue": "^5.0.5",
"@vitejs/plugin-vue-jsx": "^4.0.0",
"@vue/compiler-sfc": "^3.4.32",
"@vue/compiler-sfc": "^3.4.33",
"code-inspector-plugin": "^0.14.2",
"eslint": "^9.7.0",
"eslint-plugin-vue": "^9.27.0",

View File

@ -18,9 +18,11 @@ import { Configuration } from '../configuration';
// @ts-ignore
import { BASE_PATH, COLLECTION_FORMATS, RequestArgs, BaseAPI, RequiredError } from '../base';
import { AddScheduleInput } from '../models';
import { AdminResultInt32 } from '../models';
import { AdminResultListSysSchedule } from '../models';
import { AdminResultSysSchedule } from '../models';
import { DeleteScheduleInput } from '../models';
import { ListScheduleInput } from '../models';
import { ScheduleInput } from '../models';
import { UpdateScheduleInput } from '../models';
/**
@ -177,12 +179,60 @@ export const SysScheduleApiAxiosParamCreator = function (configuration?: Configu
/**
*
* @summary
* @param {ListScheduleInput} [body]
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
apiSysSchedulePagePost: async (body?: ListScheduleInput, options: AxiosRequestConfig = {}): Promise<RequestArgs> => {
const localVarPath = `/api/sysSchedule/page`;
// use dummy base URL string because the URL constructor only accepts absolute URLs.
const localVarUrlObj = new URL(localVarPath, 'https://example.com');
let baseOptions;
if (configuration) {
baseOptions = configuration.baseOptions;
}
const localVarRequestOptions :AxiosRequestConfig = { method: 'POST', ...baseOptions, ...options};
const localVarHeaderParameter = {} as any;
const localVarQueryParameter = {} as any;
// authentication Bearer required
// http bearer authentication required
if (configuration && configuration.accessToken) {
const accessToken = typeof configuration.accessToken === 'function'
? await configuration.accessToken()
: await configuration.accessToken;
localVarHeaderParameter["Authorization"] = "Bearer " + accessToken;
}
localVarHeaderParameter['Content-Type'] = 'application/json-patch+json';
const query = new URLSearchParams(localVarUrlObj.search);
for (const key in localVarQueryParameter) {
query.set(key, localVarQueryParameter[key]);
}
for (const key in options.params) {
query.set(key, options.params[key]);
}
localVarUrlObj.search = (new URLSearchParams(query)).toString();
let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers};
const needsSerialization = (typeof body !== "string") || localVarRequestOptions.headers['Content-Type'] === 'application/json';
localVarRequestOptions.data = needsSerialization ? JSON.stringify(body !== undefined ? body : {}) : (body || "");
return {
url: localVarUrlObj.pathname + localVarUrlObj.search + localVarUrlObj.hash,
options: localVarRequestOptions,
};
},
/**
*
* @summary
* @param {ScheduleInput} [body]
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
apiSysSchedulePagePost: async (body?: ScheduleInput, options: AxiosRequestConfig = {}): Promise<RequestArgs> => {
const localVarPath = `/api/sysSchedule/page`;
apiSysScheduleSetStatusPost: async (body?: ScheduleInput, options: AxiosRequestConfig = {}): Promise<RequestArgs> => {
const localVarPath = `/api/sysSchedule/setStatus`;
// use dummy base URL string because the URL constructor only accepts absolute URLs.
const localVarUrlObj = new URL(localVarPath, 'https://example.com');
let baseOptions;
@ -324,12 +374,26 @@ export const SysScheduleApiFp = function(configuration?: Configuration) {
/**
*
* @summary
* @param {ListScheduleInput} [body]
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
async apiSysSchedulePagePost(body?: ListScheduleInput, options?: AxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => Promise<AxiosResponse<AdminResultListSysSchedule>>> {
const localVarAxiosArgs = await SysScheduleApiAxiosParamCreator(configuration).apiSysSchedulePagePost(body, options);
return (axios: AxiosInstance = globalAxios, basePath: string = BASE_PATH) => {
const axiosRequestArgs :AxiosRequestConfig = {...localVarAxiosArgs.options, url: basePath + localVarAxiosArgs.url};
return axios.request(axiosRequestArgs);
};
},
/**
*
* @summary
* @param {ScheduleInput} [body]
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
async apiSysSchedulePagePost(body?: ScheduleInput, options?: AxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => Promise<AxiosResponse<AdminResultListSysSchedule>>> {
const localVarAxiosArgs = await SysScheduleApiAxiosParamCreator(configuration).apiSysSchedulePagePost(body, options);
async apiSysScheduleSetStatusPost(body?: ScheduleInput, options?: AxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => Promise<AxiosResponse<AdminResultInt32>>> {
const localVarAxiosArgs = await SysScheduleApiAxiosParamCreator(configuration).apiSysScheduleSetStatusPost(body, options);
return (axios: AxiosInstance = globalAxios, basePath: string = BASE_PATH) => {
const axiosRequestArgs :AxiosRequestConfig = {...localVarAxiosArgs.options, url: basePath + localVarAxiosArgs.url};
return axios.request(axiosRequestArgs);
@ -391,12 +455,22 @@ export const SysScheduleApiFactory = function (configuration?: Configuration, ba
/**
*
* @summary
* @param {ListScheduleInput} [body]
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
async apiSysSchedulePagePost(body?: ListScheduleInput, options?: AxiosRequestConfig): Promise<AxiosResponse<AdminResultListSysSchedule>> {
return SysScheduleApiFp(configuration).apiSysSchedulePagePost(body, options).then((request) => request(axios, basePath));
},
/**
*
* @summary
* @param {ScheduleInput} [body]
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
async apiSysSchedulePagePost(body?: ScheduleInput, options?: AxiosRequestConfig): Promise<AxiosResponse<AdminResultListSysSchedule>> {
return SysScheduleApiFp(configuration).apiSysSchedulePagePost(body, options).then((request) => request(axios, basePath));
async apiSysScheduleSetStatusPost(body?: ScheduleInput, options?: AxiosRequestConfig): Promise<AxiosResponse<AdminResultInt32>> {
return SysScheduleApiFp(configuration).apiSysScheduleSetStatusPost(body, options).then((request) => request(axios, basePath));
},
/**
*
@ -454,13 +528,24 @@ export class SysScheduleApi extends BaseAPI {
/**
*
* @summary
* @param {ListScheduleInput} [body]
* @param {*} [options] Override http request option.
* @throws {RequiredError}
* @memberof SysScheduleApi
*/
public async apiSysSchedulePagePost(body?: ListScheduleInput, options?: AxiosRequestConfig) : Promise<AxiosResponse<AdminResultListSysSchedule>> {
return SysScheduleApiFp(this.configuration).apiSysSchedulePagePost(body, options).then((request) => request(this.axios, this.basePath));
}
/**
*
* @summary
* @param {ScheduleInput} [body]
* @param {*} [options] Override http request option.
* @throws {RequiredError}
* @memberof SysScheduleApi
*/
public async apiSysSchedulePagePost(body?: ScheduleInput, options?: AxiosRequestConfig) : Promise<AxiosResponse<AdminResultListSysSchedule>> {
return SysScheduleApiFp(this.configuration).apiSysSchedulePagePost(body, options).then((request) => request(this.axios, this.basePath));
public async apiSysScheduleSetStatusPost(body?: ScheduleInput, options?: AxiosRequestConfig) : Promise<AxiosResponse<AdminResultInt32>> {
return SysScheduleApiFp(this.configuration).apiSysScheduleSetStatusPost(body, options).then((request) => request(this.axios, this.basePath));
}
/**
*

View File

@ -12,6 +12,7 @@
* Do not edit the class manually.
*/
import { FinishStatusEnum } from './finish-status-enum';
/**
*
*
@ -101,13 +102,35 @@ export interface AddScheduleInput {
userId?: number;
/**
*
*
*
* @type {Date}
* @memberof AddScheduleInput
*/
scheduleTime?: Date | null;
/**
*
*
* @type {string}
* @memberof AddScheduleInput
*/
startTime?: string | null;
/**
*
*
* @type {string}
* @memberof AddScheduleInput
*/
endTime?: string | null;
/**
* @type {FinishStatusEnum}
* @memberof AddScheduleInput
*/
status?: FinishStatusEnum;
/**
*
*

View File

@ -0,0 +1,24 @@
/* tslint:disable */
/* eslint-disable */
/**
* Admin.NET
* .NET <br/><u><b><font color='FF0000'> 👮</font></b></u>
*
* OpenAPI spec version: 1.0.0
*
*
* NOTE: This class is auto generated by the swagger code generator program.
* https://github.com/swagger-api/swagger-codegen.git
* Do not edit the class manually.
*/
/**
* <br />&nbsp; UnFinish = 0<br />&nbsp; Finish = 1<br />
* @export
* @enum {string}
*/
export enum FinishStatusEnum {
NUMBER_0 = 0,
NUMBER_1 = 1
}

View File

@ -190,6 +190,7 @@ export * from './file-output';
export * from './filter';
export * from './filter-logic-enum';
export * from './filter-operator-enum';
export * from './finish-status-enum';
export * from './from';
export * from './gen-auth-url-input';
export * from './gender-enum';
@ -211,6 +212,7 @@ export * from './job-detail-input';
export * from './job-detail-output';
export * from './job-trigger-input';
export * from './layout-kind';
export * from './list-schedule-input';
export * from './log-input';
export * from './log-level';
export * from './log-vis-output';

View File

@ -0,0 +1,34 @@
/* tslint:disable */
/* eslint-disable */
/**
* Admin.NET
* .NET <br/><u><b><font color='FF0000'> 👮</font></b></u>
*
* OpenAPI spec version: 1.0.0
*
*
* NOTE: This class is auto generated by the swagger code generator program.
* https://github.com/swagger-api/swagger-codegen.git
* Do not edit the class manually.
*/
/**
*
*
* @export
* @interface ListScheduleInput
*/
export interface ListScheduleInput {
/**
* @type {Date}
* @memberof ListScheduleInput
*/
startTime?: Date | null;
/**
* @type {Date}
* @memberof ListScheduleInput
*/
endTime?: Date | null;
}

View File

@ -12,6 +12,7 @@
* Do not edit the class manually.
*/
import { FinishStatusEnum } from './finish-status-enum';
/**
*
*
@ -21,14 +22,16 @@
export interface ScheduleInput {
/**
* @type {Date}
* Id
*
* @type {number}
* @memberof ScheduleInput
*/
startTime?: Date | null;
id: number;
/**
* @type {Date}
* @type {FinishStatusEnum}
* @memberof ScheduleInput
*/
endTime?: Date | null;
status?: FinishStatusEnum;
}

View File

@ -12,6 +12,7 @@
* Do not edit the class manually.
*/
import { FinishStatusEnum } from './finish-status-enum';
/**
*
*
@ -101,13 +102,29 @@ export interface SysSchedule {
userId?: number;
/**
*
*
*
* @type {Date}
* @memberof SysSchedule
*/
scheduleTime?: Date | null;
/**
*
*
* @type {string}
* @memberof SysSchedule
*/
startTime?: string | null;
/**
*
*
* @type {string}
* @memberof SysSchedule
*/
endTime?: string | null;
/**
*
*
@ -115,4 +132,10 @@ export interface SysSchedule {
* @memberof SysSchedule
*/
content: string;
/**
* @type {FinishStatusEnum}
* @memberof SysSchedule
*/
status?: FinishStatusEnum;
}

View File

@ -12,6 +12,7 @@
* Do not edit the class manually.
*/
import { FinishStatusEnum } from './finish-status-enum';
/**
*
*
@ -101,13 +102,35 @@ export interface UpdateScheduleInput {
userId?: number;
/**
*
*
*
* @type {Date}
* @memberof UpdateScheduleInput
*/
scheduleTime?: Date | null;
/**
*
*
* @type {string}
* @memberof UpdateScheduleInput
*/
startTime?: string | null;
/**
*
*
* @type {string}
* @memberof UpdateScheduleInput
*/
endTime?: string | null;
/**
* @type {FinishStatusEnum}
* @memberof UpdateScheduleInput
*/
status?: FinishStatusEnum;
/**
*
*

View File

@ -23,16 +23,19 @@
</el-calendar>
</div>
<div class="schedule-list">
<div class="item" v-for="(item, index) in state.TodayScheduleData" :key="index" @click="openEditSchedule(item)">
<el-icon style="display: inline; vertical-align: middle"> <ele-Calendar /> </el-icon>
<span class="content" style="padding-left: 10px">
<span>
{{ item.scheduleTime }}
</span>
<span style="padding-left: 15px; font-weight: 600; color: var(--el-color-primary)">
<div class="item" v-for="(item, index) in state.TodayScheduleData" :key="index">
<el-icon v-if="item.status == 1" class="icon" @click="changeStatus(item)"> <ele-CircleCheck /> </el-icon>
<el-icon v-else class="icon" @click="changeStatus(item)"> <ele-Edit /> </el-icon>
<span class="content" style="padding-left: 10px" @click="openEditSchedule(item)">
<span> {{ item.startTime }} - {{ item.endTime }} </span>
<span :class="item.status == 1 ? 'finish' : 'no'" style="padding-left: 15px; font-weight: 600; color: var(--el-color-primary)">
{{ item.content }}
</span>
</span>
<span style="float: right">
<el-icon class="icon" @click="delItem(item)"> <ele-CircleClose /> </el-icon>
</span>
</div>
</div>
@ -50,7 +53,7 @@ export default {
<script setup lang="ts">
import { reactive, onMounted, ref } from 'vue';
import { dayjs } from 'element-plus';
import { dayjs, ElMessage, ElMessageBox } from 'element-plus';
import calendar from '/@/utils/calendar.js';
import EditSchedule from '/@/views/home/widgets/components/scheduleEdit.vue';
@ -78,6 +81,7 @@ onMounted(async () => {
//
const handleQuery = async () => {
// debugger;
state.queryParams.startTime = GetMonthFirstDay(state.calendarValue);
state.queryParams.endTime = GetMonthLastDay(state.calendarValue);
@ -91,6 +95,35 @@ const handleQuery = async () => {
}
};
//
const delItem = (row: any) => {
console.log(row);
ElMessageBox.confirm(`确定删日程:${row.startTime}-${row.endTime}${row.content}】?`, '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning',
})
.then(async () => {
await getAPI(SysScheduleApi).apiSysScheduleDeletePost(row);
await handleQuery();
ElMessage.success('删除成功');
})
.catch(() => {});
};
//
const changeStatus = async (row: any) => {
await getAPI(SysScheduleApi)
.apiSysScheduleSetStatusPost({ id: row.id, status: row.status == 1 ? 0 : 1 })
.then(() => {
row.status = row.status == 1 ? 0 : 1;
ElMessage.success('日程状态设置成功');
})
.catch(() => {
ElMessage.success('日程状态设置异常');
});
};
//
const solarDate2lunar = (solarDate: any) => {
var solar = solarDate.split('-');
@ -110,31 +143,36 @@ const handleQueryByDate = async (date: any) => {
//
const openAddSchedule = () => {
var timerange = GetRecentTime();
state.editTitle = '添加日程';
editScheduleRef.value?.openDialog({ id: undefined, status: 1, orderNo: 100 });
editScheduleRef.value?.openDialog({ id: undefined, status: 0, orderNo: 100, startTime: timerange.startTime, endTime: timerange.endTime });
};
//
const openEditSchedule = async (row: any) => {
if (row.status == 1) return;
state.editTitle = '编辑日程';
editScheduleRef.value?.openDialog(row, true);
};
//
async function handleClickDate(data: any) {
const handleClickDate = async (data: any) => {
await handleQueryByDate(data.day);
}
};
function GetMonthFirstDay(date: any) {
//
const GetMonthFirstDay = (date: any) => {
var newDate = new Date(date);
newDate.setDate(1);
newDate.setHours(0);
newDate.setMinutes(0);
newDate.setSeconds(0);
return newDate;
}
};
function GetMonthLastDay(date: any) {
//
const GetMonthLastDay = (date: any) => {
var newDate = new Date(date);
newDate.setMonth(newDate.getMonth() + 1);
newDate.setDate(0);
@ -142,29 +180,83 @@ function GetMonthLastDay(date: any) {
newDate.setMinutes(0);
newDate.setSeconds(0);
return newDate;
}
};
//
function FormatDateDelHMS(date: any) {
const FormatDateDelHMS = (date: any) => {
var newDate = new Date(date);
newDate.setHours(0);
newDate.setMinutes(0);
newDate.setSeconds(0);
return newDate;
}
};
function FormatDateEndHMS(date: any) {
const FormatDateEndHMS = (date: any) => {
var newDate = new Date(date);
newDate.setHours(23);
newDate.setMinutes(59);
newDate.setSeconds(59);
return newDate;
}
};
//
function FormatDate(date: any) {
const FormatDate = (date: any) => {
return dayjs(date).format('YYYY-MM-DD');
}
};
// EndTimeStartTime + 1(hour)
const GetRecentTime = () => {
var date = new Date();
//
var currentHour = date.getHours();
var currentMin = date.getMinutes();
var starHour = dayjs(date).format('HH');
var endHour = dayjs(date).format('HH');
var starMin = '00';
var endMin = '00';
// 23 starHourendHour23
if (currentHour == 23) {
starHour = '23';
endHour = '23';
starMin = '00';
endMin = '45';
} else {
//
if (currentMin < 15) {
starMin = '15';
endMin = '15';
//
date.setHours(date.getHours() + 1);
endHour = dayjs(date).format('HH');
} else if (currentMin >= 15 && currentMin < 30) {
starMin = '30';
endMin = '30';
//
date.setHours(date.getHours() + 1);
endHour = dayjs(date).format('HH');
} else if (currentMin >= 30 && currentMin < 45) {
starMin = '45';
endMin = '45';
//
date.setHours(date.getHours() + 1);
endHour = dayjs(date).format('HH');
} else if (currentMin >= 45) {
// : 00
starMin = '00';
endMin = '00';
// +1
date.setHours(date.getHours() + 1);
starHour = dayjs(date).format('HH');
//
date.setHours(date.getHours() + 1);
endHour = dayjs(date).format('HH');
}
}
return { startTime: starHour + ':' + starMin, endTime: endHour + ':' + endMin };
};
</script>
<style lang="scss" scoped>
@ -241,6 +333,14 @@ function FormatDate(date: any) {
color: #666;
font-size: 14px;
}
.icon {
display: inline;
vertical-align: middle;
color: var(--el-color-primary);
}
.finish {
text-decoration: line-through 2px var(--el-color-danger) !important;
}
}
}
</style>

View File

@ -9,9 +9,20 @@
</template>
<el-form :model="state.ruleForm" ref="ruleFormRef" label-width="auto">
<el-row :gutter="35">
<el-col :xs="24" :sm="24" :md="24" :lg="24" :xl="24" class="mb20">
<el-col :xs="8" :sm="8" :md="8" :lg="8" :xl="8" class="mb20 time-padding-right">
<el-form-item label="日程时间" prop="scheduleTime" :rules="[{ required: true, message: '日程时间不能为空', trigger: 'blur' }]">
<el-date-picker v-model="state.ruleForm.scheduleTime" type="datetime" placeholder="请选择日程时间" format="YYYY-MM-DD HH:mm:ss" value-format="YYYY-MM-DD HH:mm:ss" class="w100" />
<el-date-picker v-model="state.ruleForm.scheduleTime" type="datetime" placeholder="请选择日程日期" format="YYYY-MM-DD" value-format="YYYY-MM-DD HH:mm:ss" class="w100" />
</el-form-item>
</el-col>
<el-col :xs="5" :sm="5" :md="5" :lg="5" :xl="5" class="mb20 time-padding">
<el-form-item prop="startTime" :rules="[{ required: true, message: '开始时间不能为空', trigger: 'blur' }]">
<el-time-select v-model="state.ruleForm.startTime" format="HH:mm" start="00:00" end="23:45" step="00:15" class="w100" clearable @change="ChangeEndTime()" />
</el-form-item>
</el-col>
<span></span>
<el-col :xs="5" :sm="5" :md="5" :lg="5" :xl="5" class="mb20 time-padding">
<el-form-item prop="endTime" :rules="[{ required: true, message: '结束时间不能为空', trigger: 'blur' }]">
<el-time-select v-model="state.ruleForm.endTime" :min-time="state.ruleForm.startTime" format="HH:mm" start="00:00" end="23:45" step="00:15" class="w100" clearable />
</el-form-item>
</el-col>
<el-col :xs="24" :sm="24" :md="24" :lg="24" :xl="24" class="mb20">
@ -34,7 +45,7 @@
<script lang="ts" setup name="editSchedule">
import { onMounted, reactive, ref } from 'vue';
import { dayjs, ElMessageBox, ElMessage, ElNotification } from 'element-plus';
import { dayjs, ElMessageBox, ElMessage } from 'element-plus';
import { getAPI } from '/@/utils/axios-utils';
import { SysScheduleApi } from '/@/api-services/api';
@ -53,7 +64,7 @@ const state = reactive({
});
//
onMounted(async () => {});
onMounted(() => {});
//
const openDialog = (row: any, showRemove: boolean = false) => {
@ -104,6 +115,44 @@ const remove = () => {
.catch(() => {});
};
//
const ChangeEndTime = () => {
//
var timeStr = state.ruleForm.startTime;
var parts = timeStr.split(':');
var hours = parseInt(parts[0], 10);
var minutes = parseInt(parts[1], 10);
var startTime = new Date();
startTime.setHours(hours);
startTime.setMinutes(minutes);
if (startTime.getHours() < 23) {
startTime.setHours(startTime.getHours() + 1);
state.ruleForm.endTime = dayjs(startTime).format('HH:mm');
} else {
state.ruleForm.endTime = '23:45';
}
};
//
defineExpose({ openDialog });
</script>
<style lang="scss" scoped>
.editSchedule-container {
.no-pre-icon {
color: red;
}
}
:v-deep(.el-select__prefix) {
display: none !important;
}
.time-padding-right {
padding-right: 1px !important;
}
.time-padding {
padding-left: 10px !important;
padding-right: 10px !important;
}
</style>