Merge branch 'master' of http://47.109.37.87:3000/by2025/admin-vben5
Some checks are pending
Gitea Actions Demo / Explore-Gitea-Actions (push) Waiting to run
Some checks are pending
Gitea Actions Demo / Explore-Gitea-Actions (push) Waiting to run
This commit is contained in:
@@ -89,6 +89,10 @@ export interface ArrangementForm extends BaseEntity {
|
|||||||
* 排班人员详情
|
* 排班人员详情
|
||||||
*/
|
*/
|
||||||
userGroupList: any[];
|
userGroupList: any[];
|
||||||
|
/**
|
||||||
|
* 排班id
|
||||||
|
*/
|
||||||
|
scheduleId?: string | number;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface ArrangementQuery extends PageQuery {
|
export interface ArrangementQuery extends PageQuery {
|
||||||
@@ -140,4 +144,6 @@ export interface ArrangementQuery extends PageQuery {
|
|||||||
export interface arrangmentListQuery extends PageQuery {
|
export interface arrangmentListQuery extends PageQuery {
|
||||||
currentDate: string; //某天的日期
|
currentDate: string; //某天的日期
|
||||||
}
|
}
|
||||||
export interface AttendanceUserGroup {}
|
export interface AttendanceUserGroup extends PageQuery {
|
||||||
|
currentDate: string; //某天的日期
|
||||||
|
}
|
||||||
|
@@ -0,0 +1,61 @@
|
|||||||
|
import type { AttendanceAreaVO, AttendanceAreaForm, AttendanceAreaQuery } from './model';
|
||||||
|
|
||||||
|
import type { ID, IDS } from '#/api/common';
|
||||||
|
import type { PageResult } from '#/api/common';
|
||||||
|
|
||||||
|
import { commonExport } from '#/api/helper';
|
||||||
|
import { requestClient } from '#/api/request';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询区域区域管理列表
|
||||||
|
* @param params
|
||||||
|
* @returns 区域区域管理列表
|
||||||
|
*/
|
||||||
|
export function attendanceAreaList(params?: AttendanceAreaQuery) {
|
||||||
|
return requestClient.get<PageResult<AttendanceAreaVO>>('/property/attendanceArea/list', { params });
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 导出区域区域管理列表
|
||||||
|
* @param params
|
||||||
|
* @returns 区域区域管理列表
|
||||||
|
*/
|
||||||
|
export function attendanceAreaExport(params?: AttendanceAreaQuery) {
|
||||||
|
return commonExport('/property/attendanceArea/export', params ?? {});
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询区域区域管理详情
|
||||||
|
* @param id id
|
||||||
|
* @returns 区域区域管理详情
|
||||||
|
*/
|
||||||
|
export function attendanceAreaInfo(id: ID) {
|
||||||
|
return requestClient.get<AttendanceAreaVO>(`/property/attendanceArea/${id}`);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 新增区域区域管理
|
||||||
|
* @param data
|
||||||
|
* @returns void
|
||||||
|
*/
|
||||||
|
export function attendanceAreaAdd(data: AttendanceAreaForm) {
|
||||||
|
return requestClient.postWithMsg<void>('/property/attendanceArea', data);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 更新区域区域管理
|
||||||
|
* @param data
|
||||||
|
* @returns void
|
||||||
|
*/
|
||||||
|
export function attendanceAreaUpdate(data: AttendanceAreaForm) {
|
||||||
|
return requestClient.putWithMsg<void>('/property/attendanceArea', data);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除区域区域管理
|
||||||
|
* @param id id
|
||||||
|
* @returns void
|
||||||
|
*/
|
||||||
|
export function attendanceAreaRemove(id: ID | IDS) {
|
||||||
|
return requestClient.deleteWithMsg<void>(`/property/attendanceArea/${id}`);
|
||||||
|
}
|
69
apps/web-antd/src/api/property/attendanceManagement/attendanceArea/model.d.ts
vendored
Normal file
69
apps/web-antd/src/api/property/attendanceManagement/attendanceArea/model.d.ts
vendored
Normal file
@@ -0,0 +1,69 @@
|
|||||||
|
import type { PageQuery, BaseEntity } from '#/api/common';
|
||||||
|
|
||||||
|
export interface AttendanceAreaVO {
|
||||||
|
/**
|
||||||
|
* 主键id
|
||||||
|
*/
|
||||||
|
id: string | number;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 摄像机id
|
||||||
|
*/
|
||||||
|
deviceManageId: string | number;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 区域
|
||||||
|
*/
|
||||||
|
area: string;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 备注
|
||||||
|
*/
|
||||||
|
reamark: string;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface AttendanceAreaForm extends BaseEntity {
|
||||||
|
/**
|
||||||
|
* 主键id
|
||||||
|
*/
|
||||||
|
id?: string | number;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 摄像机id
|
||||||
|
*/
|
||||||
|
deviceManageId?: string | number;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 区域
|
||||||
|
*/
|
||||||
|
area?: string;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 备注
|
||||||
|
*/
|
||||||
|
reamark?: string;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface AttendanceAreaQuery extends PageQuery {
|
||||||
|
/**
|
||||||
|
* 摄像机id
|
||||||
|
*/
|
||||||
|
deviceManageId?: string | number;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 区域
|
||||||
|
*/
|
||||||
|
area?: string;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 备注
|
||||||
|
*/
|
||||||
|
reamark?: string;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 日期范围参数
|
||||||
|
*/
|
||||||
|
params?: any;
|
||||||
|
}
|
@@ -0,0 +1,61 @@
|
|||||||
|
import type { QuestionVO, QuestionForm, QuestionQuery } from './model';
|
||||||
|
|
||||||
|
import type { ID, IDS } from '#/api/common';
|
||||||
|
import type { PageResult } from '#/api/common';
|
||||||
|
|
||||||
|
import { commonExport } from '#/api/helper';
|
||||||
|
import { requestClient } from '#/api/request';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询调查问卷问题列表
|
||||||
|
* @param params
|
||||||
|
* @returns 调查问卷问题列表
|
||||||
|
*/
|
||||||
|
export function questionList(params?: QuestionQuery) {
|
||||||
|
return requestClient.get<PageResult<QuestionVO>>('/property/question/list', { params });
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 导出调查问卷问题列表
|
||||||
|
* @param params
|
||||||
|
* @returns 调查问卷问题列表
|
||||||
|
*/
|
||||||
|
export function questionExport(params?: QuestionQuery) {
|
||||||
|
return commonExport('/property/question/export', params ?? {});
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询调查问卷问题详情
|
||||||
|
* @param id id
|
||||||
|
* @returns 调查问卷问题详情
|
||||||
|
*/
|
||||||
|
export function questionInfo(id: ID) {
|
||||||
|
return requestClient.get<QuestionVO>(`/property/question/${id}`);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 新增调查问卷问题
|
||||||
|
* @param data
|
||||||
|
* @returns void
|
||||||
|
*/
|
||||||
|
export function questionAdd(data: QuestionForm) {
|
||||||
|
return requestClient.postWithMsg<void>('/property/question', data);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 更新调查问卷问题
|
||||||
|
* @param data
|
||||||
|
* @returns void
|
||||||
|
*/
|
||||||
|
export function questionUpdate(data: QuestionForm) {
|
||||||
|
return requestClient.putWithMsg<void>('/property/question', data);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除调查问卷问题
|
||||||
|
* @param id id
|
||||||
|
* @returns void
|
||||||
|
*/
|
||||||
|
export function questionRemove(id: ID | IDS) {
|
||||||
|
return requestClient.deleteWithMsg<void>(`/property/question/${id}`);
|
||||||
|
}
|
114
apps/web-antd/src/api/property/questionnaire/question/model.d.ts
vendored
Normal file
114
apps/web-antd/src/api/property/questionnaire/question/model.d.ts
vendored
Normal file
@@ -0,0 +1,114 @@
|
|||||||
|
import type { PageQuery, BaseEntity } from '#/api/common';
|
||||||
|
|
||||||
|
export interface QuestionVO {
|
||||||
|
/**
|
||||||
|
* id
|
||||||
|
*/
|
||||||
|
id: string | number;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 调查问卷id
|
||||||
|
*/
|
||||||
|
questionnaireId: string | number;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 标题
|
||||||
|
*/
|
||||||
|
head: string;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 问题类型(1单行文本2多行文本3单选题4多选题5评分题6日期选择)
|
||||||
|
*/
|
||||||
|
type: string;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 是否必填(1不必填2必填)
|
||||||
|
*/
|
||||||
|
isRequired: string;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 描述
|
||||||
|
*/
|
||||||
|
depict: string;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 排序
|
||||||
|
*/
|
||||||
|
sort: number;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface QuestionForm extends BaseEntity {
|
||||||
|
/**
|
||||||
|
* id
|
||||||
|
*/
|
||||||
|
id?: string | number;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 调查问卷id
|
||||||
|
*/
|
||||||
|
questionnaireId?: string | number;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 标题
|
||||||
|
*/
|
||||||
|
head?: string;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 问题类型(1单行文本2多行文本3单选题4多选题5评分题6日期选择)
|
||||||
|
*/
|
||||||
|
type?: string;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 是否必填(1不必填2必填)
|
||||||
|
*/
|
||||||
|
isRequired?: string;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 描述
|
||||||
|
*/
|
||||||
|
depict?: string;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 排序
|
||||||
|
*/
|
||||||
|
sort?: number;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface QuestionQuery extends PageQuery {
|
||||||
|
/**
|
||||||
|
* 调查问卷id
|
||||||
|
*/
|
||||||
|
questionnaireId?: string | number;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 标题
|
||||||
|
*/
|
||||||
|
head?: string;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 问题类型(1单行文本2多行文本3单选题4多选题5评分题6日期选择)
|
||||||
|
*/
|
||||||
|
type?: string;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 是否必填(1不必填2必填)
|
||||||
|
*/
|
||||||
|
isRequired?: string;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 描述
|
||||||
|
*/
|
||||||
|
depict?: string;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 排序
|
||||||
|
*/
|
||||||
|
sort?: number;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 日期范围参数
|
||||||
|
*/
|
||||||
|
params?: any;
|
||||||
|
}
|
@@ -0,0 +1,61 @@
|
|||||||
|
import type { QuestionItemVO, QuestionItemForm, QuestionItemQuery } from './model';
|
||||||
|
|
||||||
|
import type { ID, IDS } from '#/api/common';
|
||||||
|
import type { PageResult } from '#/api/common';
|
||||||
|
|
||||||
|
import { commonExport } from '#/api/helper';
|
||||||
|
import { requestClient } from '#/api/request';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询调查问卷问题选项列表
|
||||||
|
* @param params
|
||||||
|
* @returns 调查问卷问题选项列表
|
||||||
|
*/
|
||||||
|
export function questionItemList(params?: QuestionItemQuery) {
|
||||||
|
return requestClient.get<PageResult<QuestionItemVO>>('/property/questionItem/list', { params });
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 导出调查问卷问题选项列表
|
||||||
|
* @param params
|
||||||
|
* @returns 调查问卷问题选项列表
|
||||||
|
*/
|
||||||
|
export function questionItemExport(params?: QuestionItemQuery) {
|
||||||
|
return commonExport('/property/questionItem/export', params ?? {});
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询调查问卷问题选项详情
|
||||||
|
* @param id id
|
||||||
|
* @returns 调查问卷问题选项详情
|
||||||
|
*/
|
||||||
|
export function questionItemInfo(id: ID) {
|
||||||
|
return requestClient.get<QuestionItemVO>(`/property/questionItem/${id}`);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 新增调查问卷问题选项
|
||||||
|
* @param data
|
||||||
|
* @returns void
|
||||||
|
*/
|
||||||
|
export function questionItemAdd(data: QuestionItemForm) {
|
||||||
|
return requestClient.postWithMsg<void>('/property/questionItem', data);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 更新调查问卷问题选项
|
||||||
|
* @param data
|
||||||
|
* @returns void
|
||||||
|
*/
|
||||||
|
export function questionItemUpdate(data: QuestionItemForm) {
|
||||||
|
return requestClient.putWithMsg<void>('/property/questionItem', data);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除调查问卷问题选项
|
||||||
|
* @param id id
|
||||||
|
* @returns void
|
||||||
|
*/
|
||||||
|
export function questionItemRemove(id: ID | IDS) {
|
||||||
|
return requestClient.deleteWithMsg<void>(`/property/questionItem/${id}`);
|
||||||
|
}
|
79
apps/web-antd/src/api/property/questionnaire/questionItem/model.d.ts
vendored
Normal file
79
apps/web-antd/src/api/property/questionnaire/questionItem/model.d.ts
vendored
Normal file
@@ -0,0 +1,79 @@
|
|||||||
|
import type { PageQuery, BaseEntity } from '#/api/common';
|
||||||
|
|
||||||
|
export interface QuestionItemVO {
|
||||||
|
/**
|
||||||
|
* id
|
||||||
|
*/
|
||||||
|
id: string | number;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 问题id
|
||||||
|
*/
|
||||||
|
questionId: string | number;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 选项内容
|
||||||
|
*/
|
||||||
|
itemContent: string;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 排序
|
||||||
|
*/
|
||||||
|
sort: number;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 备注
|
||||||
|
*/
|
||||||
|
remark: string;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface QuestionItemForm extends BaseEntity {
|
||||||
|
/**
|
||||||
|
* id
|
||||||
|
*/
|
||||||
|
id?: string | number;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 问题id
|
||||||
|
*/
|
||||||
|
questionId?: string | number;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 选项内容
|
||||||
|
*/
|
||||||
|
itemContent?: string;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 排序
|
||||||
|
*/
|
||||||
|
sort?: number;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 备注
|
||||||
|
*/
|
||||||
|
remark?: string;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface QuestionItemQuery extends PageQuery {
|
||||||
|
/**
|
||||||
|
* 问题id
|
||||||
|
*/
|
||||||
|
questionId?: string | number;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 选项内容
|
||||||
|
*/
|
||||||
|
itemContent?: string;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 排序
|
||||||
|
*/
|
||||||
|
sort?: number;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 日期范围参数
|
||||||
|
*/
|
||||||
|
params?: any;
|
||||||
|
}
|
@@ -0,0 +1,61 @@
|
|||||||
|
import type { QuestionnaireVO, QuestionnaireForm, QuestionnaireQuery } from './model';
|
||||||
|
|
||||||
|
import type { ID, IDS } from '#/api/common';
|
||||||
|
import type { PageResult } from '#/api/common';
|
||||||
|
|
||||||
|
import { commonExport } from '#/api/helper';
|
||||||
|
import { requestClient } from '#/api/request';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询调查问卷列表
|
||||||
|
* @param params
|
||||||
|
* @returns 调查问卷列表
|
||||||
|
*/
|
||||||
|
export function questionnaireList(params?: QuestionnaireQuery) {
|
||||||
|
return requestClient.get<PageResult<QuestionnaireVO>>('/property/questionnaire/list', { params });
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 导出调查问卷列表
|
||||||
|
* @param params
|
||||||
|
* @returns 调查问卷列表
|
||||||
|
*/
|
||||||
|
export function questionnaireExport(params?: QuestionnaireQuery) {
|
||||||
|
return commonExport('/property/questionnaire/export', params ?? {});
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询调查问卷详情
|
||||||
|
* @param id id
|
||||||
|
* @returns 调查问卷详情
|
||||||
|
*/
|
||||||
|
export function questionnaireInfo(id: ID) {
|
||||||
|
return requestClient.get<QuestionnaireVO>(`/property/questionnaire/${id}`);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 新增调查问卷
|
||||||
|
* @param data
|
||||||
|
* @returns void
|
||||||
|
*/
|
||||||
|
export function questionnaireAdd(data: QuestionnaireForm) {
|
||||||
|
return requestClient.postWithMsg<void>('/property/questionnaire', data);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 更新调查问卷
|
||||||
|
* @param data
|
||||||
|
* @returns void
|
||||||
|
*/
|
||||||
|
export function questionnaireUpdate(data: QuestionnaireForm) {
|
||||||
|
return requestClient.putWithMsg<void>('/property/questionnaire', data);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除调查问卷
|
||||||
|
* @param id id
|
||||||
|
* @returns void
|
||||||
|
*/
|
||||||
|
export function questionnaireRemove(id: ID | IDS) {
|
||||||
|
return requestClient.deleteWithMsg<void>(`/property/questionnaire/${id}`);
|
||||||
|
}
|
114
apps/web-antd/src/api/property/questionnaire/questionnaire/model.d.ts
vendored
Normal file
114
apps/web-antd/src/api/property/questionnaire/questionnaire/model.d.ts
vendored
Normal file
@@ -0,0 +1,114 @@
|
|||||||
|
import type { PageQuery, BaseEntity } from '#/api/common';
|
||||||
|
|
||||||
|
export interface QuestionnaireVO {
|
||||||
|
/**
|
||||||
|
* id
|
||||||
|
*/
|
||||||
|
id: string | number;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 标题
|
||||||
|
*/
|
||||||
|
head: string;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 描述
|
||||||
|
*/
|
||||||
|
depict: string;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 是否匿名收集
|
||||||
|
*/
|
||||||
|
isAnonyCollec: string;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 是否多次提交
|
||||||
|
*/
|
||||||
|
isCommit: string;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 截止日期
|
||||||
|
*/
|
||||||
|
deadline: string;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 状态(1草稿2已发布3未发布)
|
||||||
|
*/
|
||||||
|
status: string;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface QuestionnaireForm extends BaseEntity {
|
||||||
|
/**
|
||||||
|
* id
|
||||||
|
*/
|
||||||
|
id?: string | number;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 标题
|
||||||
|
*/
|
||||||
|
head?: string;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 描述
|
||||||
|
*/
|
||||||
|
depict?: string;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 是否匿名收集
|
||||||
|
*/
|
||||||
|
isAnonyCollec?: string;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 是否多次提交
|
||||||
|
*/
|
||||||
|
isCommit?: string;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 截止日期
|
||||||
|
*/
|
||||||
|
deadline?: string;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 状态(1草稿2已发布3未发布)
|
||||||
|
*/
|
||||||
|
status?: string;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface QuestionnaireQuery extends PageQuery {
|
||||||
|
/**
|
||||||
|
* 标题
|
||||||
|
*/
|
||||||
|
head?: string;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 描述
|
||||||
|
*/
|
||||||
|
depict?: string;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 是否匿名收集
|
||||||
|
*/
|
||||||
|
isAnonyCollec?: string;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 是否多次提交
|
||||||
|
*/
|
||||||
|
isCommit?: string;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 截止日期
|
||||||
|
*/
|
||||||
|
deadline?: string;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 状态(1草稿2已发布3未发布)
|
||||||
|
*/
|
||||||
|
status?: string;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 日期范围参数
|
||||||
|
*/
|
||||||
|
params?: any;
|
||||||
|
}
|
@@ -0,0 +1,101 @@
|
|||||||
|
<script setup lang="ts">
|
||||||
|
import { computed, ref } from 'vue';
|
||||||
|
|
||||||
|
import { useVbenModal } from '@vben/common-ui';
|
||||||
|
import { $t } from '@vben/locales';
|
||||||
|
import { cloneDeep } from '@vben/utils';
|
||||||
|
|
||||||
|
import { useVbenForm } from '#/adapter/form';
|
||||||
|
import { attendanceAreaAdd, attendanceAreaInfo, attendanceAreaUpdate } from '#/api/property/attendanceManagement/attendanceArea';
|
||||||
|
import { defaultFormValueGetter, useBeforeCloseDiff } from '#/utils/popup';
|
||||||
|
|
||||||
|
import { modalSchema } from './data';
|
||||||
|
|
||||||
|
const emit = defineEmits<{ reload: [] }>();
|
||||||
|
|
||||||
|
const isUpdate = ref(false);
|
||||||
|
const title = computed(() => {
|
||||||
|
return isUpdate.value ? $t('pages.common.edit') : $t('pages.common.add');
|
||||||
|
});
|
||||||
|
|
||||||
|
const [BasicForm, formApi] = useVbenForm({
|
||||||
|
commonConfig: {
|
||||||
|
// 默认占满两列
|
||||||
|
formItemClass: 'col-span-2',
|
||||||
|
// 默认label宽度 px
|
||||||
|
labelWidth: 80,
|
||||||
|
// 通用配置项 会影响到所有表单项
|
||||||
|
componentProps: {
|
||||||
|
class: 'w-full',
|
||||||
|
}
|
||||||
|
},
|
||||||
|
schema: modalSchema(),
|
||||||
|
showDefaultActions: false,
|
||||||
|
wrapperClass: 'grid-cols-2',
|
||||||
|
});
|
||||||
|
|
||||||
|
const { onBeforeClose, markInitialized, resetInitialized } = useBeforeCloseDiff(
|
||||||
|
{
|
||||||
|
initializedGetter: defaultFormValueGetter(formApi),
|
||||||
|
currentGetter: defaultFormValueGetter(formApi),
|
||||||
|
},
|
||||||
|
);
|
||||||
|
|
||||||
|
const [BasicModal, modalApi] = useVbenModal({
|
||||||
|
// 在这里更改宽度
|
||||||
|
class: 'w-[550px]',
|
||||||
|
fullscreenButton: false,
|
||||||
|
onBeforeClose,
|
||||||
|
onClosed: handleClosed,
|
||||||
|
onConfirm: handleConfirm,
|
||||||
|
onOpenChange: async (isOpen) => {
|
||||||
|
if (!isOpen) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
modalApi.modalLoading(true);
|
||||||
|
|
||||||
|
const { id } = modalApi.getData() as { id?: number | string };
|
||||||
|
isUpdate.value = !!id;
|
||||||
|
|
||||||
|
if (isUpdate.value && id) {
|
||||||
|
const record = await attendanceAreaInfo(id);
|
||||||
|
await formApi.setValues(record);
|
||||||
|
}
|
||||||
|
await markInitialized();
|
||||||
|
|
||||||
|
modalApi.modalLoading(false);
|
||||||
|
},
|
||||||
|
});
|
||||||
|
|
||||||
|
async function handleConfirm() {
|
||||||
|
try {
|
||||||
|
modalApi.lock(true);
|
||||||
|
const { valid } = await formApi.validate();
|
||||||
|
if (!valid) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
// getValues获取为一个readonly的对象 需要修改必须先深拷贝一次
|
||||||
|
const data = cloneDeep(await formApi.getValues());
|
||||||
|
await (isUpdate.value ? attendanceAreaUpdate(data) : attendanceAreaAdd(data));
|
||||||
|
resetInitialized();
|
||||||
|
emit('reload');
|
||||||
|
modalApi.close();
|
||||||
|
} catch (error) {
|
||||||
|
console.error(error);
|
||||||
|
} finally {
|
||||||
|
modalApi.lock(false);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
async function handleClosed() {
|
||||||
|
await formApi.resetForm();
|
||||||
|
resetInitialized();
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<template>
|
||||||
|
<BasicModal :title="title">
|
||||||
|
<BasicForm />
|
||||||
|
</BasicModal>
|
||||||
|
</template>
|
||||||
|
|
@@ -0,0 +1,68 @@
|
|||||||
|
import type { FormSchemaGetter } from '#/adapter/form';
|
||||||
|
import type { VxeGridProps } from '#/adapter/vxe-table';
|
||||||
|
|
||||||
|
|
||||||
|
export const querySchema: FormSchemaGetter = () => [
|
||||||
|
{
|
||||||
|
component: 'Input',
|
||||||
|
fieldName: 'area',
|
||||||
|
label: '区域',
|
||||||
|
}
|
||||||
|
];
|
||||||
|
|
||||||
|
// 需要使用i18n注意这里要改成getter形式 否则切换语言不会刷新
|
||||||
|
// export const columns: () => VxeGridProps['columns'] = () => [
|
||||||
|
export const columns: VxeGridProps['columns'] = [
|
||||||
|
{ type: 'checkbox', width: 60 },
|
||||||
|
{
|
||||||
|
title: '区域',
|
||||||
|
field: 'area',
|
||||||
|
width: 'auto',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: '摄像机id',
|
||||||
|
field: 'deviceManageId',
|
||||||
|
minWidth: 300,
|
||||||
|
},
|
||||||
|
|
||||||
|
{
|
||||||
|
title: '备注',
|
||||||
|
field: 'reamark',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
field: 'action',
|
||||||
|
fixed: 'right',
|
||||||
|
slots: { default: 'action' },
|
||||||
|
title: '操作',
|
||||||
|
width: 180,
|
||||||
|
},
|
||||||
|
];
|
||||||
|
|
||||||
|
export const modalSchema: FormSchemaGetter = () => [
|
||||||
|
{
|
||||||
|
label: '主键id',
|
||||||
|
fieldName: 'id',
|
||||||
|
component: 'Input',
|
||||||
|
dependencies: {
|
||||||
|
show: () => false,
|
||||||
|
triggerFields: [''],
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: '区域',
|
||||||
|
fieldName: 'area',
|
||||||
|
component: 'Input',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: '摄像机id',
|
||||||
|
fieldName: 'deviceManageId',
|
||||||
|
component: 'Select',
|
||||||
|
componentProps: {
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: '备注',
|
||||||
|
fieldName: 'reamark',
|
||||||
|
component: 'Input',
|
||||||
|
},
|
||||||
|
];
|
@@ -0,0 +1,182 @@
|
|||||||
|
<script setup lang="ts">
|
||||||
|
import type { Recordable } from '@vben/types';
|
||||||
|
|
||||||
|
import { ref } from 'vue';
|
||||||
|
|
||||||
|
import { Page, useVbenModal, type VbenFormProps } from '@vben/common-ui';
|
||||||
|
import { getVxePopupContainer } from '@vben/utils';
|
||||||
|
|
||||||
|
import { Modal, Popconfirm, Space } from 'ant-design-vue';
|
||||||
|
import dayjs from 'dayjs';
|
||||||
|
|
||||||
|
import {
|
||||||
|
useVbenVxeGrid,
|
||||||
|
vxeCheckboxChecked,
|
||||||
|
type VxeGridProps
|
||||||
|
} from '#/adapter/vxe-table';
|
||||||
|
|
||||||
|
import {
|
||||||
|
attendanceAreaExport,
|
||||||
|
attendanceAreaList,
|
||||||
|
attendanceAreaRemove,
|
||||||
|
} from '#/api/property/attendanceManagement/attendanceArea';
|
||||||
|
import type { AttendanceAreaForm } from '#/api/property/attendanceManagement/attendanceArea/model';
|
||||||
|
import { commonDownloadExcel } from '#/utils/file/download';
|
||||||
|
|
||||||
|
import attendanceAreaModal from './attendanceArea-modal.vue';
|
||||||
|
import { columns, querySchema } from './data';
|
||||||
|
|
||||||
|
const formOptions: VbenFormProps = {
|
||||||
|
commonConfig: {
|
||||||
|
labelWidth: 80,
|
||||||
|
componentProps: {
|
||||||
|
allowClear: true,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
schema: querySchema(),
|
||||||
|
wrapperClass: 'grid-cols-1 md:grid-cols-2 lg:grid-cols-3 xl:grid-cols-4',
|
||||||
|
// 处理区间选择器RangePicker时间格式 将一个字段映射为两个字段 搜索/导出会用到
|
||||||
|
// 不需要直接删除
|
||||||
|
// fieldMappingTime: [
|
||||||
|
// [
|
||||||
|
// 'createTime',
|
||||||
|
// ['params[beginTime]', 'params[endTime]'],
|
||||||
|
// ['YYYY-MM-DD 00:00:00', 'YYYY-MM-DD 23:59:59'],
|
||||||
|
// ],
|
||||||
|
// ],
|
||||||
|
};
|
||||||
|
|
||||||
|
const gridOptions: VxeGridProps = {
|
||||||
|
checkboxConfig: {
|
||||||
|
// 高亮
|
||||||
|
highlight: true,
|
||||||
|
// 翻页时保留选中状态
|
||||||
|
reserve: true,
|
||||||
|
// 点击行选中
|
||||||
|
// trigger: 'row',
|
||||||
|
},
|
||||||
|
// 需要使用i18n注意这里要改成getter形式 否则切换语言不会刷新
|
||||||
|
// columns: columns(),
|
||||||
|
columns,
|
||||||
|
height: 'auto',
|
||||||
|
keepSource: true,
|
||||||
|
pagerConfig: {},
|
||||||
|
proxyConfig: {
|
||||||
|
ajax: {
|
||||||
|
query: async ({ page }, formValues = {}) => {
|
||||||
|
return await attendanceAreaList({
|
||||||
|
pageNum: page.currentPage,
|
||||||
|
pageSize: page.pageSize,
|
||||||
|
...formValues,
|
||||||
|
});
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
rowConfig: {
|
||||||
|
keyField: 'id',
|
||||||
|
},
|
||||||
|
// 表格全局唯一表示 保存列配置需要用到
|
||||||
|
id: 'property-attendanceArea-index'
|
||||||
|
};
|
||||||
|
|
||||||
|
const [BasicTable, tableApi] = useVbenVxeGrid({
|
||||||
|
formOptions,
|
||||||
|
gridOptions,
|
||||||
|
});
|
||||||
|
|
||||||
|
const [AttendanceAreaModal, modalApi] = useVbenModal({
|
||||||
|
connectedComponent: attendanceAreaModal,
|
||||||
|
});
|
||||||
|
|
||||||
|
function handleAdd() {
|
||||||
|
modalApi.setData({});
|
||||||
|
modalApi.open();
|
||||||
|
}
|
||||||
|
|
||||||
|
async function handleEdit(row: Required<AttendanceAreaForm>) {
|
||||||
|
modalApi.setData({ id: row.id });
|
||||||
|
modalApi.open();
|
||||||
|
}
|
||||||
|
|
||||||
|
async function handleDelete(row: Required<AttendanceAreaForm>) {
|
||||||
|
await attendanceAreaRemove(row.id);
|
||||||
|
await tableApi.query();
|
||||||
|
}
|
||||||
|
|
||||||
|
function handleMultiDelete() {
|
||||||
|
const rows = tableApi.grid.getCheckboxRecords();
|
||||||
|
const ids = rows.map((row: Required<AttendanceAreaForm>) => row.id);
|
||||||
|
Modal.confirm({
|
||||||
|
title: '提示',
|
||||||
|
okType: 'danger',
|
||||||
|
content: `确认删除选中的${ids.length}条记录吗?`,
|
||||||
|
onOk: async () => {
|
||||||
|
await attendanceAreaRemove(ids);
|
||||||
|
await tableApi.query();
|
||||||
|
},
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
function handleDownloadExcel() {
|
||||||
|
commonDownloadExcel(attendanceAreaExport, '区域区域管理数据', tableApi.formApi.form.values, {
|
||||||
|
fieldMappingTime: formOptions.fieldMappingTime,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<template>
|
||||||
|
<Page :auto-content-height="true">
|
||||||
|
<BasicTable table-title="区域区域管理列表">
|
||||||
|
<template #toolbar-tools>
|
||||||
|
<Space>
|
||||||
|
<a-button
|
||||||
|
v-access:code="['property:attendanceArea:export']"
|
||||||
|
@click="handleDownloadExcel"
|
||||||
|
>
|
||||||
|
{{ $t('pages.common.export') }}
|
||||||
|
</a-button>
|
||||||
|
<a-button
|
||||||
|
:disabled="!vxeCheckboxChecked(tableApi)"
|
||||||
|
danger
|
||||||
|
type="primary"
|
||||||
|
v-access:code="['property:attendanceArea:remove']"
|
||||||
|
@click="handleMultiDelete">
|
||||||
|
{{ $t('pages.common.delete') }}
|
||||||
|
</a-button>
|
||||||
|
<a-button
|
||||||
|
type="primary"
|
||||||
|
v-access:code="['property:attendanceArea:add']"
|
||||||
|
@click="handleAdd"
|
||||||
|
>
|
||||||
|
{{ $t('pages.common.add') }}
|
||||||
|
</a-button>
|
||||||
|
</Space>
|
||||||
|
</template>
|
||||||
|
<template #action="{ row }">
|
||||||
|
<Space>
|
||||||
|
<ghost-button
|
||||||
|
v-access:code="['property:attendanceArea:edit']"
|
||||||
|
@click.stop="handleEdit(row)"
|
||||||
|
>
|
||||||
|
{{ $t('pages.common.edit') }}
|
||||||
|
</ghost-button>
|
||||||
|
<Popconfirm
|
||||||
|
:get-popup-container="getVxePopupContainer"
|
||||||
|
placement="left"
|
||||||
|
title="确认删除?"
|
||||||
|
@confirm="handleDelete(row)"
|
||||||
|
>
|
||||||
|
<ghost-button
|
||||||
|
danger
|
||||||
|
v-access:code="['property:attendanceArea:remove']"
|
||||||
|
@click.stop=""
|
||||||
|
>
|
||||||
|
{{ $t('pages.common.delete') }}
|
||||||
|
</ghost-button>
|
||||||
|
</Popconfirm>
|
||||||
|
</Space>
|
||||||
|
</template>
|
||||||
|
</BasicTable>
|
||||||
|
<AttendanceAreaModal @reload="tableApi.query()" />
|
||||||
|
</Page>
|
||||||
|
</template>
|
@@ -207,8 +207,8 @@ const [BasicModal, modalApi] = useVbenModal({
|
|||||||
if (!isOpen) {
|
if (!isOpen) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
await getGroupList();
|
|
||||||
modalApi.modalLoading(true);
|
modalApi.modalLoading(true);
|
||||||
|
await getGroupList();
|
||||||
// await markInitialized();
|
// await markInitialized();
|
||||||
modalApi.modalLoading(false);
|
modalApi.modalLoading(false);
|
||||||
},
|
},
|
||||||
|
@@ -180,8 +180,8 @@ const getListData2 = (
|
|||||||
if (found) {
|
if (found) {
|
||||||
return found.list;
|
return found.list;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
|
}
|
||||||
// 如果没有找到数据,返回空数组
|
// 如果没有找到数据,返回空数组
|
||||||
return [];
|
return [];
|
||||||
};
|
};
|
||||||
|
@@ -82,13 +82,13 @@ export const columns: VxeGridProps['columns'] = [
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
title: '人员',
|
title: '人员',
|
||||||
field: 'employeeName',
|
field: 'sysUser.userName',
|
||||||
width: 120,
|
width: 120,
|
||||||
// width: 'auto',
|
// width: 'auto',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
title: '单位',
|
title: '单位',
|
||||||
field: 'deptName',
|
field: 'sysUser.deptName',
|
||||||
width: 'auto',
|
width: 'auto',
|
||||||
},
|
},
|
||||||
// {
|
// {
|
||||||
@@ -120,12 +120,13 @@ export const columns: VxeGridProps['columns'] = [
|
|||||||
minWidth: 200,
|
minWidth: 200,
|
||||||
slots: {
|
slots: {
|
||||||
default: ({ row }) => {
|
default: ({ row }) => {
|
||||||
|
if(!row.attendanceShift) return '/';
|
||||||
if (row.attendanceShift.startTime && row.attendanceShift.endTime) {
|
if (row.attendanceShift.startTime && row.attendanceShift.endTime) {
|
||||||
if (
|
if (
|
||||||
row.attendanceShift.restEndTime &&
|
row.attendanceShift.restEndTime &&
|
||||||
row.attendanceShift.restStartTime
|
row.attendanceShift.restStartTime
|
||||||
) {
|
) {
|
||||||
return `${row.attendanceShift.startTime}~${row.attendanceShift.endTime} ${row.shift.restStartTime}~${row.shift.restEndTime}`;
|
return `${row.attendanceShift.startTime}~${row.attendanceShift.endTime} ${row.attendanceShift.restStartTime}~${row.attendanceShift.restEndTime}`;
|
||||||
} else {
|
} else {
|
||||||
return `${row.attendanceShift.startTime}~${row.attendanceShift.endTime}`;
|
return `${row.attendanceShift.startTime}~${row.attendanceShift.endTime}`;
|
||||||
}
|
}
|
||||||
|
@@ -83,12 +83,12 @@ function handleAdd() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
async function handleEdit(row: Required<ArrangementForm>) {
|
async function handleEdit(row: Required<ArrangementForm>) {
|
||||||
modalApi.setData({ id: row.id });
|
modalApi.setData({ id: row.scheduleId });
|
||||||
modalApi.open();
|
modalApi.open();
|
||||||
}
|
}
|
||||||
|
|
||||||
async function handleDelete(row: Required<ArrangementForm>) {
|
async function handleDelete(row: Required<ArrangementForm>) {
|
||||||
await arrangementRemove(row.id);
|
await arrangementRemove(row.scheduleId);
|
||||||
await tableApi.query();
|
await tableApi.query();
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
@@ -129,12 +129,6 @@ async function handleDelete(row: Required<ArrangementForm>) {
|
|||||||
<BasicTable>
|
<BasicTable>
|
||||||
<template #action="{ row }">
|
<template #action="{ row }">
|
||||||
<Space>
|
<Space>
|
||||||
<ghost-button
|
|
||||||
v-access:code="['property:arrangement:edit']"
|
|
||||||
@click.stop="handleEdit(row)"
|
|
||||||
>
|
|
||||||
{{ $t('pages.common.edit') }}
|
|
||||||
</ghost-button>
|
|
||||||
<Popconfirm
|
<Popconfirm
|
||||||
:get-popup-container="getVxePopupContainer"
|
:get-popup-container="getVxePopupContainer"
|
||||||
placement="left"
|
placement="left"
|
||||||
|
@@ -192,7 +192,6 @@ async function handleConfirm() {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
console.log(tableData);
|
|
||||||
resetInitialized();
|
resetInitialized();
|
||||||
emit('reload', tableData);
|
emit('reload', tableData);
|
||||||
tableData = [];
|
tableData = [];
|
||||||
|
@@ -87,7 +87,7 @@ async function handleClosed() {
|
|||||||
:key="item.id"
|
:key="item.id"
|
||||||
class="wrap-cell"
|
class="wrap-cell"
|
||||||
>
|
>
|
||||||
{{ item.employeeName }}
|
{{ item.sysUser.userName }}
|
||||||
<span v-if="index !== row.userGroupList.length - 1">、</span>
|
<span v-if="index !== row.userGroupList.length - 1">、</span>
|
||||||
</span>
|
</span>
|
||||||
</template>
|
</template>
|
||||||
|
@@ -1,5 +1,5 @@
|
|||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import { reactive, onMounted } from 'vue';
|
import { reactive, onMounted,computed } from 'vue';
|
||||||
|
|
||||||
import { useVbenModal } from '@vben/common-ui';
|
import { useVbenModal } from '@vben/common-ui';
|
||||||
import {
|
import {
|
||||||
@@ -102,7 +102,7 @@ const columns = [
|
|||||||
];
|
];
|
||||||
const editDate = ref<string | undefined>('');
|
const editDate = ref<string | undefined>('');
|
||||||
function handleRemoveUser(row: any, user: any) {
|
function handleRemoveUser(row: any, user: any) {
|
||||||
row.users = row.users.filter((u: any) => u.id !== user.id);
|
row.users = row.users.filter((u: any) => u.userId !== user.userId);
|
||||||
}
|
}
|
||||||
function handleRemoveRow(index: number) {
|
function handleRemoveRow(index: number) {
|
||||||
tableData.splice(index, 1);
|
tableData.splice(index, 1);
|
||||||
@@ -133,7 +133,7 @@ function handleTableData(newTableData: any) {
|
|||||||
for (const newUser of newItem.users) {
|
for (const newUser of newItem.users) {
|
||||||
// 检查该用户是否已存在
|
// 检查该用户是否已存在
|
||||||
const userExists = existingDept?.users.some(
|
const userExists = existingDept?.users.some(
|
||||||
(existingUser) => existingUser.id === newUser.id,
|
(existingUser) => existingUser.userId === newUser.userId,
|
||||||
);
|
);
|
||||||
if (!userExists) {
|
if (!userExists) {
|
||||||
// 用户不存在,添加到现有部门
|
// 用户不存在,添加到现有部门
|
||||||
@@ -159,8 +159,8 @@ const [BasicModal, modalApi] = useVbenModal({
|
|||||||
if (!isOpen) {
|
if (!isOpen) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
await getGroupList();
|
|
||||||
modalApi.modalLoading(true);
|
modalApi.modalLoading(true);
|
||||||
|
await getGroupList();
|
||||||
const { id, date } = modalApi.getData() as {
|
const { id, date } = modalApi.getData() as {
|
||||||
id?: number | string;
|
id?: number | string;
|
||||||
date?: string;
|
date?: string;
|
||||||
@@ -178,8 +178,8 @@ const [BasicModal, modalApi] = useVbenModal({
|
|||||||
const deptMap = new Map();
|
const deptMap = new Map();
|
||||||
|
|
||||||
for (const item of record.userGroupList) {
|
for (const item of record.userGroupList) {
|
||||||
const deptId = item.deptId;
|
const deptId = item.sysUser.deptId;
|
||||||
const deptName = item.deptName;
|
const deptName = item.sysUser.deptName;
|
||||||
|
|
||||||
if (!deptMap.has(deptId)) {
|
if (!deptMap.has(deptId)) {
|
||||||
deptMap.set(deptId, {
|
deptMap.set(deptId, {
|
||||||
@@ -188,19 +188,23 @@ const [BasicModal, modalApi] = useVbenModal({
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
deptMap.get(deptId).users.push({
|
deptMap.get(deptId).users.push({
|
||||||
id: item.employeeId,
|
userId: item.sysUser.userId,
|
||||||
userName: item.employeeName,
|
userName: item.sysUser.userName,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
// 转换为 tableData 格式
|
// 转换为 tableData 格式
|
||||||
tableData.splice(0, 0, ...Array.from(deptMap.values()));
|
tableData.splice(0, 0, ...Array.from(deptMap.values()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
console.log(tableData);
|
||||||
|
|
||||||
// await markInitialized();
|
// await markInitialized();
|
||||||
modalApi.modalLoading(false);
|
modalApi.modalLoading(false);
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
const totalSelected: number = 0;
|
const totalSelected = computed(() =>
|
||||||
|
tableData.reduce((sum, row) => sum + (row.users?.length || 0), 0),
|
||||||
|
);
|
||||||
async function getGroupList() {
|
async function getGroupList() {
|
||||||
const res = await groupList({
|
const res = await groupList({
|
||||||
pageSize: 1000000000,
|
pageSize: 1000000000,
|
||||||
@@ -233,11 +237,12 @@ async function handleConfirm() {
|
|||||||
modalApi.lock(true);
|
modalApi.lock(true);
|
||||||
await formRef.value.validate(); // 先校验
|
await formRef.value.validate(); // 先校验
|
||||||
const data = formModal;
|
const data = formModal;
|
||||||
|
console.log(tableData);
|
||||||
data.userGroupList = tableData.flatMap((item) =>
|
data.userGroupList = tableData.flatMap((item) =>
|
||||||
item.users.map((user) => ({
|
item.users.map((user) => ({
|
||||||
deptId: item.dept.unitId,
|
deptId: item.dept.unitId,
|
||||||
deptName: item.dept.unitName,
|
deptName: item.dept.unitName,
|
||||||
employeeId: user.id,
|
employeeId: user.userId,
|
||||||
employeeName: user.userName,
|
employeeName: user.userName,
|
||||||
})),
|
})),
|
||||||
);
|
);
|
||||||
|
@@ -0,0 +1,158 @@
|
|||||||
|
import type { FormSchemaGetter } from '#/adapter/form';
|
||||||
|
import type { VxeGridProps } from '#/adapter/vxe-table';
|
||||||
|
import { getDictOptions } from '#/utils/dict';
|
||||||
|
import { renderDict } from '#/utils/render';
|
||||||
|
import {h} from "vue";
|
||||||
|
import {Rate} from "ant-design-vue";
|
||||||
|
|
||||||
|
export const querySchema: FormSchemaGetter = () => [
|
||||||
|
{
|
||||||
|
component: 'Select',
|
||||||
|
componentProps: {
|
||||||
|
options: getDictOptions('type_contingency_plan'),
|
||||||
|
},
|
||||||
|
fieldName: 'contingenPlanType',
|
||||||
|
label: '预案类型',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
component: 'ApiSelect',
|
||||||
|
fieldName: 'dutyPersion',
|
||||||
|
label: '责任人',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
component: 'Select',
|
||||||
|
componentProps: {
|
||||||
|
options: getDictOptions('pro_exercise_status'),
|
||||||
|
},
|
||||||
|
fieldName: 'status',
|
||||||
|
label: '演练状态',
|
||||||
|
},
|
||||||
|
];
|
||||||
|
|
||||||
|
export const columns: VxeGridProps['columns'] = [
|
||||||
|
{ type: 'checkbox', width: 60 },
|
||||||
|
{
|
||||||
|
title: '序号',
|
||||||
|
field: 'id',
|
||||||
|
slots: {
|
||||||
|
default: ({rowIndex}) => {
|
||||||
|
return (rowIndex + 1).toString();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: '预案名称',
|
||||||
|
field: 'contingenPlanName',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: '预案类型',
|
||||||
|
field: 'contingenPlanType',
|
||||||
|
slots: {
|
||||||
|
default: ({ row }) => {
|
||||||
|
return renderDict(row.contingenPlanType, 'type_contingency_plan');
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: '风险等级',
|
||||||
|
field: 'grade',
|
||||||
|
slots: {
|
||||||
|
default: ({ row }) => {
|
||||||
|
return h(Rate, {
|
||||||
|
value: row.grade || 0,
|
||||||
|
disabled: true,
|
||||||
|
});
|
||||||
|
},
|
||||||
|
},
|
||||||
|
minWidth: '150'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: '发起人',
|
||||||
|
field: 'initiatName',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: '演练状态',
|
||||||
|
field: 'status',
|
||||||
|
slots: {
|
||||||
|
default: ({ row }) => {
|
||||||
|
return renderDict(row.status, 'pro_exercise_status');
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: '责任人',
|
||||||
|
field: 'dutyPersionName',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: '完成时间',
|
||||||
|
field: 'compleTimes',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
field: 'action',
|
||||||
|
fixed: 'right',
|
||||||
|
slots: { default: 'action' },
|
||||||
|
title: '操作',
|
||||||
|
width: 240,
|
||||||
|
},
|
||||||
|
];
|
||||||
|
|
||||||
|
export const modalSchema: FormSchemaGetter = () => [
|
||||||
|
{
|
||||||
|
label: '主键',
|
||||||
|
fieldName: 'id',
|
||||||
|
component: 'Input',
|
||||||
|
dependencies: {
|
||||||
|
show: () => false,
|
||||||
|
triggerFields: [''],
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: '预案名称',
|
||||||
|
fieldName: 'contingenPlanName',
|
||||||
|
component: 'Input',
|
||||||
|
rules: 'required',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: '预案类型',
|
||||||
|
fieldName: 'contingenPlanType',
|
||||||
|
component: 'Select',
|
||||||
|
componentProps: {
|
||||||
|
options: getDictOptions('type_contingency_plan'),
|
||||||
|
},
|
||||||
|
rules: 'selectRequired',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: '发起人',
|
||||||
|
fieldName: 'initiat',
|
||||||
|
component: 'ApiSelect',
|
||||||
|
rules: 'selectRequired',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: '责任人',
|
||||||
|
fieldName: 'dutyPersion',
|
||||||
|
component: 'ApiSelect',
|
||||||
|
rules: 'selectRequired',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: '预案内容',
|
||||||
|
fieldName: 'contingenPlanContent',
|
||||||
|
component: 'RichTextarea',
|
||||||
|
componentProps: {
|
||||||
|
// disabled: false, // 是否只读
|
||||||
|
// height: 400 // 高度 默认400
|
||||||
|
},
|
||||||
|
formItemClass: 'col-span-2'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: '风险等级',
|
||||||
|
fieldName: 'grade',
|
||||||
|
component: 'Rate',
|
||||||
|
componentProps: {
|
||||||
|
allowHalf: false,
|
||||||
|
count: 5,
|
||||||
|
tooltips: ['1星', '2星', '3星', '4星', '5星'],
|
||||||
|
defaultValue: 0
|
||||||
|
},
|
||||||
|
rules: 'required',
|
||||||
|
},
|
||||||
|
];
|
@@ -0,0 +1,231 @@
|
|||||||
|
<script setup lang="ts">
|
||||||
|
import { Page, useVbenModal, type VbenFormProps } from '@vben/common-ui';
|
||||||
|
import { getVxePopupContainer } from '@vben/utils';
|
||||||
|
import { Modal, Popconfirm, Space } from 'ant-design-vue';
|
||||||
|
import {
|
||||||
|
useVbenVxeGrid,
|
||||||
|
vxeCheckboxChecked,
|
||||||
|
type VxeGridProps
|
||||||
|
} from '#/adapter/vxe-table';
|
||||||
|
import {onMounted} from "vue";
|
||||||
|
import {
|
||||||
|
contingenPlanExport,
|
||||||
|
contingenPlanList,
|
||||||
|
contingenPlanRemove,
|
||||||
|
contingenPlanUpdate
|
||||||
|
} from '#/api/property/customerService/contingenPlan';
|
||||||
|
import type { ContingenPlanForm } from '#/api/property/customerService/contingenPlan/model';
|
||||||
|
import { commonDownloadExcel } from '#/utils/file/download';
|
||||||
|
|
||||||
|
import contingenPlanModal from './questionnaire-modal.vue';
|
||||||
|
import contingenPlanDetail from './questionnaire-detail.vue';
|
||||||
|
import { columns, querySchema } from './data';
|
||||||
|
import {personList} from "#/api/property/resident/person";
|
||||||
|
import {renderDictValue} from "#/utils/render";
|
||||||
|
|
||||||
|
const formOptions: VbenFormProps = {
|
||||||
|
commonConfig: {
|
||||||
|
labelWidth: 80,
|
||||||
|
componentProps: {
|
||||||
|
allowClear: true,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
schema: querySchema(),
|
||||||
|
wrapperClass: 'grid-cols-1 md:grid-cols-2 lg:grid-cols-3 xl:grid-cols-4',
|
||||||
|
};
|
||||||
|
|
||||||
|
const gridOptions: VxeGridProps = {
|
||||||
|
checkboxConfig: {
|
||||||
|
// 高亮
|
||||||
|
highlight: true,
|
||||||
|
// 翻页时保留选中状态
|
||||||
|
reserve: true,
|
||||||
|
},
|
||||||
|
columns,
|
||||||
|
height: 'auto',
|
||||||
|
keepSource: true,
|
||||||
|
pagerConfig: {},
|
||||||
|
proxyConfig: {
|
||||||
|
ajax: {
|
||||||
|
query: async ({ page }, formValues = {}) => {
|
||||||
|
return await contingenPlanList({
|
||||||
|
pageNum: page.currentPage,
|
||||||
|
pageSize: page.pageSize,
|
||||||
|
...formValues,
|
||||||
|
});
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
rowConfig: {
|
||||||
|
keyField: 'id',
|
||||||
|
},
|
||||||
|
// 表格全局唯一表示 保存列配置需要用到
|
||||||
|
id: 'system-contingenPlan-index'
|
||||||
|
};
|
||||||
|
|
||||||
|
const [BasicTable, tableApi] = useVbenVxeGrid({
|
||||||
|
formOptions,
|
||||||
|
gridOptions,
|
||||||
|
});
|
||||||
|
|
||||||
|
const [ContingenPlanModal, modalApi] = useVbenModal({
|
||||||
|
connectedComponent: contingenPlanModal,
|
||||||
|
});
|
||||||
|
|
||||||
|
const [contingenPlanDetailModal, contingenPlanDetailApi] = useVbenModal({
|
||||||
|
connectedComponent: contingenPlanDetail,
|
||||||
|
});
|
||||||
|
|
||||||
|
async function handleInfo(row: Required<ContingenPlanForm>) {
|
||||||
|
contingenPlanDetailApi.setData({ id: row.id });
|
||||||
|
contingenPlanDetailApi.open();
|
||||||
|
}
|
||||||
|
|
||||||
|
function handleAdd() {
|
||||||
|
modalApi.setData({});
|
||||||
|
modalApi.open();
|
||||||
|
}
|
||||||
|
|
||||||
|
async function handleEdit(row: Required<ContingenPlanForm>) {
|
||||||
|
modalApi.setData({ id: row.id });
|
||||||
|
modalApi.open();
|
||||||
|
}
|
||||||
|
|
||||||
|
async function handleDelete(row: Required<ContingenPlanForm>) {
|
||||||
|
await contingenPlanRemove(row.id);
|
||||||
|
await tableApi.query();
|
||||||
|
}
|
||||||
|
|
||||||
|
async function handleExamine(row: Required<ContingenPlanForm>) {
|
||||||
|
row.status = '1'
|
||||||
|
await contingenPlanUpdate(row);
|
||||||
|
await tableApi.query();
|
||||||
|
}
|
||||||
|
|
||||||
|
function handleMultiDelete() {
|
||||||
|
const rows = tableApi.grid.getCheckboxRecords();
|
||||||
|
const ids = rows.map((row: Required<ContingenPlanForm>) => row.id);
|
||||||
|
Modal.confirm({
|
||||||
|
title: '提示',
|
||||||
|
okType: 'danger',
|
||||||
|
content: `确认删除选中的${ids.length}条记录吗?`,
|
||||||
|
onOk: async () => {
|
||||||
|
await contingenPlanRemove(ids);
|
||||||
|
await tableApi.query();
|
||||||
|
},
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
function handleDownloadExcel() {
|
||||||
|
commonDownloadExcel(contingenPlanExport, '应急预案管理数据', tableApi.formApi.form.values, {
|
||||||
|
fieldMappingTime: formOptions.fieldMappingTime,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
async function queryPersonData() {
|
||||||
|
let params = {
|
||||||
|
pageSize: 1000,
|
||||||
|
pageNum: 1,
|
||||||
|
}
|
||||||
|
const res = await personList(params);
|
||||||
|
const options = res.rows.map((user) => ({
|
||||||
|
label: user.userName + '-' + renderDictValue(user.gender, 'sys_user_sex') + '-' + user.phone,
|
||||||
|
value: user.id,
|
||||||
|
}));
|
||||||
|
tableApi.formApi.updateSchema([
|
||||||
|
{
|
||||||
|
componentProps: () => ({
|
||||||
|
options: options,
|
||||||
|
showSearch:true,
|
||||||
|
filterOption: filterOption
|
||||||
|
}),
|
||||||
|
fieldName: 'dutyPersion',
|
||||||
|
}
|
||||||
|
])
|
||||||
|
}
|
||||||
|
|
||||||
|
const filterOption = (input: string, option: any) => {
|
||||||
|
return option.label.toLowerCase().indexOf(input.toLowerCase()) >= 0;
|
||||||
|
};
|
||||||
|
|
||||||
|
onMounted(async () => {
|
||||||
|
await queryPersonData()
|
||||||
|
})
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<template>
|
||||||
|
<Page :auto-content-height="true">
|
||||||
|
<BasicTable table-title="应急预案管理列表">
|
||||||
|
<template #toolbar-tools>
|
||||||
|
<Space>
|
||||||
|
<a-button
|
||||||
|
v-access:code="['system:contingenPlan:export']"
|
||||||
|
@click="handleDownloadExcel"
|
||||||
|
>
|
||||||
|
{{ $t('pages.common.export') }}
|
||||||
|
</a-button>
|
||||||
|
<a-button
|
||||||
|
:disabled="!vxeCheckboxChecked(tableApi)"
|
||||||
|
danger
|
||||||
|
type="primary"
|
||||||
|
v-access:code="['system:contingenPlan:remove']"
|
||||||
|
@click="handleMultiDelete">
|
||||||
|
{{ $t('pages.common.delete') }}
|
||||||
|
</a-button>
|
||||||
|
<a-button
|
||||||
|
type="primary"
|
||||||
|
v-access:code="['system:contingenPlan:add']"
|
||||||
|
@click="handleAdd"
|
||||||
|
>
|
||||||
|
{{ $t('pages.common.add') }}
|
||||||
|
</a-button>
|
||||||
|
</Space>
|
||||||
|
</template>
|
||||||
|
<template #action="{ row }">
|
||||||
|
<Space>
|
||||||
|
<Popconfirm
|
||||||
|
v-if="row.status === '0'"
|
||||||
|
:get-popup-container="getVxePopupContainer"
|
||||||
|
placement="left"
|
||||||
|
title="确认审核?"
|
||||||
|
@confirm="handleExamine(row)"
|
||||||
|
>
|
||||||
|
<ghost-button
|
||||||
|
@click.stop=""
|
||||||
|
>
|
||||||
|
{{ '审核' }}
|
||||||
|
</ghost-button>
|
||||||
|
</Popconfirm>
|
||||||
|
<ghost-button
|
||||||
|
@click.stop="handleInfo(row)"
|
||||||
|
>
|
||||||
|
{{ $t('pages.common.info') }}
|
||||||
|
</ghost-button>
|
||||||
|
<ghost-button
|
||||||
|
v-if="row.status === '0'"
|
||||||
|
v-access:code="['system:contingenPlan:edit']"
|
||||||
|
@click.stop="handleEdit(row)"
|
||||||
|
>
|
||||||
|
{{ $t('pages.common.edit') }}
|
||||||
|
</ghost-button>
|
||||||
|
<Popconfirm
|
||||||
|
:get-popup-container="getVxePopupContainer"
|
||||||
|
placement="left"
|
||||||
|
title="确认删除?"
|
||||||
|
@confirm="handleDelete(row)"
|
||||||
|
>
|
||||||
|
<ghost-button
|
||||||
|
danger
|
||||||
|
v-access:code="['system:contingenPlan:remove']"
|
||||||
|
@click.stop=""
|
||||||
|
>
|
||||||
|
{{ $t('pages.common.delete') }}
|
||||||
|
</ghost-button>
|
||||||
|
</Popconfirm>
|
||||||
|
</Space>
|
||||||
|
</template>
|
||||||
|
</BasicTable>
|
||||||
|
<ContingenPlanModal @reload="tableApi.query()" />
|
||||||
|
<contingenPlanDetailModal/>
|
||||||
|
</Page>
|
||||||
|
</template>
|
@@ -0,0 +1,96 @@
|
|||||||
|
<script setup lang="ts">
|
||||||
|
import type {ContingenPlanVO} from '#/api/property/customerService/contingenPlan/model';
|
||||||
|
import {shallowRef} from 'vue';
|
||||||
|
import {useVbenModal} from '@vben/common-ui';
|
||||||
|
import {
|
||||||
|
Descriptions,
|
||||||
|
DescriptionsItem,
|
||||||
|
Divider,
|
||||||
|
Rate,
|
||||||
|
Timeline,
|
||||||
|
TimelineItem
|
||||||
|
} from 'ant-design-vue';
|
||||||
|
import {contingenPlanInfo} from '#/api/property/customerService/contingenPlan';
|
||||||
|
import {renderDict} from "#/utils/render";
|
||||||
|
|
||||||
|
const [BasicModal, modalApi] = useVbenModal({
|
||||||
|
onOpenChange: handleOpenChange,
|
||||||
|
onClosed() {
|
||||||
|
contingenPlanIDetail.value = null;
|
||||||
|
},
|
||||||
|
});
|
||||||
|
|
||||||
|
const contingenPlanIDetail = shallowRef<null | ContingenPlanVO>(null);
|
||||||
|
const handleRecords = shallowRef<null | ContingenPlanVO>(null);
|
||||||
|
async function handleOpenChange(open: boolean) {
|
||||||
|
if (!open) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
modalApi.modalLoading(true);
|
||||||
|
const {id} = modalApi.getData() as { id: number | string };
|
||||||
|
const response = await contingenPlanInfo(id);
|
||||||
|
contingenPlanIDetail.value = response;
|
||||||
|
handleRecords.value = response.contingenPlanRecordVos.map(item => ({
|
||||||
|
status: item.status,
|
||||||
|
createTime: item.createTime,
|
||||||
|
handlerName: item.dutyPersionName
|
||||||
|
}));
|
||||||
|
console.log(handleRecords.value)
|
||||||
|
modalApi.modalLoading(false);
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<template>
|
||||||
|
<BasicModal :footer="false" :fullscreen-button="false" title="详情" class="w-[70%]">
|
||||||
|
<Descriptions v-if="contingenPlanIDetail" size="small" :column="2" bordered :labelStyle="{width:'120px'}">
|
||||||
|
<DescriptionsItem label="预案名称">
|
||||||
|
{{ contingenPlanIDetail.contingenPlanName }}
|
||||||
|
</DescriptionsItem>
|
||||||
|
<DescriptionsItem label="创建时间">
|
||||||
|
{{ contingenPlanIDetail.createTime }}
|
||||||
|
</DescriptionsItem>
|
||||||
|
<DescriptionsItem label="预案类型" v-if="contingenPlanIDetail.contingenPlanType!=null">
|
||||||
|
<component
|
||||||
|
:is="renderDict(contingenPlanIDetail.contingenPlanType,'type_contingency_plan')"
|
||||||
|
/>
|
||||||
|
</DescriptionsItem>
|
||||||
|
<DescriptionsItem label="最后更新时间">
|
||||||
|
{{ contingenPlanIDetail.updateTime }}
|
||||||
|
</DescriptionsItem>
|
||||||
|
<DescriptionsItem label="演练状态" v-if="contingenPlanIDetail.status!=null">
|
||||||
|
<component
|
||||||
|
:is="renderDict(contingenPlanIDetail.status,'pro_exercise_status')"
|
||||||
|
/>
|
||||||
|
</DescriptionsItem>
|
||||||
|
<DescriptionsItem label="完成时间">
|
||||||
|
{{ contingenPlanIDetail.compleTimes }}
|
||||||
|
</DescriptionsItem>
|
||||||
|
<DescriptionsItem label="发起人">
|
||||||
|
{{ contingenPlanIDetail.initiatName }}
|
||||||
|
</DescriptionsItem>
|
||||||
|
<DescriptionsItem label="责任人">
|
||||||
|
{{ contingenPlanIDetail.dutyPersionName}}
|
||||||
|
</DescriptionsItem>
|
||||||
|
<DescriptionsItem label="预案内容" :span="2">
|
||||||
|
<div v-html="contingenPlanIDetail.contingenPlanContent"></div>
|
||||||
|
</DescriptionsItem>
|
||||||
|
<DescriptionsItem label="风险等级">
|
||||||
|
<Rate :value="contingenPlanIDetail.grade" disabled />
|
||||||
|
</DescriptionsItem>
|
||||||
|
</Descriptions>
|
||||||
|
|
||||||
|
<Divider orientation="left" orientation-margin="0px">
|
||||||
|
处理记录
|
||||||
|
</Divider>
|
||||||
|
<Timeline>
|
||||||
|
<TimelineItem v-for="(item,index) in handleRecords" :key="index">
|
||||||
|
<p style="display: flex;">类型:
|
||||||
|
<component
|
||||||
|
:is="renderDict(item.status,'pro_exercise_status')"
|
||||||
|
/></p>
|
||||||
|
<p>时间:{{item.createTime}}</p>
|
||||||
|
<p>处理人:{{item.handlerName}}</p>
|
||||||
|
</TimelineItem>
|
||||||
|
</Timeline>
|
||||||
|
</BasicModal>
|
||||||
|
</template>
|
@@ -0,0 +1,421 @@
|
|||||||
|
<script setup lang="ts">
|
||||||
|
import {computed, onMounted, reactive, ref} from 'vue';
|
||||||
|
import {useVbenModal} from '@vben/common-ui';
|
||||||
|
import {cloneDeep} from '@vben/utils';
|
||||||
|
import {
|
||||||
|
Form,
|
||||||
|
FormItem,
|
||||||
|
Input,
|
||||||
|
Row,
|
||||||
|
Col,
|
||||||
|
Switch,
|
||||||
|
DatePicker,
|
||||||
|
Empty,
|
||||||
|
Divider,
|
||||||
|
Rate,
|
||||||
|
Popover,
|
||||||
|
Badge
|
||||||
|
} from 'ant-design-vue'
|
||||||
|
import {PlusOutlined, DeleteOutlined} from '@ant-design/icons-vue';
|
||||||
|
import {renderDictValue} from "#/utils/render";
|
||||||
|
import {getDictOptions} from "#/utils/dict";
|
||||||
|
|
||||||
|
const emit = defineEmits<{ reload: [] }>();
|
||||||
|
const isUpdate = ref(false);
|
||||||
|
const title = computed(() => {
|
||||||
|
return isUpdate.value ? '编辑问卷' : '新增问卷';
|
||||||
|
});
|
||||||
|
|
||||||
|
// const [BasicForm, formApi] = useVbenForm({
|
||||||
|
// commonConfig: {
|
||||||
|
// // 默认占满两列
|
||||||
|
// formItemClass: 'col-span-1',
|
||||||
|
// // 默认label宽度 px
|
||||||
|
// labelWidth: 80,
|
||||||
|
// // 通用配置项 会影响到所有表单项
|
||||||
|
// componentProps: {
|
||||||
|
// class: 'w-full',
|
||||||
|
// }
|
||||||
|
// },
|
||||||
|
// schema: modalSchema(),
|
||||||
|
// showDefaultActions: false,
|
||||||
|
// wrapperClass: 'grid-cols-2',
|
||||||
|
// });
|
||||||
|
|
||||||
|
// const {onBeforeClose, markInitialized, resetInitialized} = useBeforeCloseDiff(
|
||||||
|
// {
|
||||||
|
// initializedGetter: defaultFormValueGetter(formApi),
|
||||||
|
// currentGetter: defaultFormValueGetter(formApi),
|
||||||
|
// },
|
||||||
|
// );
|
||||||
|
|
||||||
|
const [BasicModal, modalApi] = useVbenModal({
|
||||||
|
// 在这里更改宽度
|
||||||
|
fullscreenButton: false,
|
||||||
|
fullscreen: true,
|
||||||
|
onClosed: handleClosed,
|
||||||
|
onConfirm: handleConfirm,
|
||||||
|
onOpenChange: async (isOpen) => {
|
||||||
|
if (!isOpen) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
modalApi.modalLoading(true);
|
||||||
|
const {id} = modalApi.getData() as { id?: number | string };
|
||||||
|
isUpdate.value = !!id;
|
||||||
|
|
||||||
|
if (isUpdate.value && id) {
|
||||||
|
// const record = await contingenPlanInfo(id);
|
||||||
|
// await formApi.setValues(record);
|
||||||
|
}
|
||||||
|
// await markInitialized();
|
||||||
|
|
||||||
|
modalApi.modalLoading(false);
|
||||||
|
},
|
||||||
|
});
|
||||||
|
|
||||||
|
async function handleConfirm() {
|
||||||
|
try {
|
||||||
|
modalApi.lock(true);
|
||||||
|
// const {valid} = await formApi.validate();
|
||||||
|
// if (!valid) {
|
||||||
|
// return;
|
||||||
|
// }
|
||||||
|
// getValues获取为一个readonly的对象 需要修改必须先深拷贝一次
|
||||||
|
// const data = cloneDeep(await formApi.getValues());
|
||||||
|
// await (isUpdate.value ? contingenPlanUpdate(data) : contingenPlanAdd(data));
|
||||||
|
// resetInitialized();
|
||||||
|
emit('reload');
|
||||||
|
modalApi.close();
|
||||||
|
} catch (error) {
|
||||||
|
console.error(error);
|
||||||
|
} finally {
|
||||||
|
modalApi.lock(false);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
async function handleClosed() {
|
||||||
|
// await formApi.resetForm();
|
||||||
|
// resetInitialized();
|
||||||
|
}
|
||||||
|
|
||||||
|
const initialState = {
|
||||||
|
username: '',
|
||||||
|
password: '',
|
||||||
|
questionList: [],
|
||||||
|
};
|
||||||
|
|
||||||
|
const badgeCounts = {
|
||||||
|
inputCount: 0,
|
||||||
|
textareaCount: 0,
|
||||||
|
radioCount: 0,
|
||||||
|
checkboxCount: 0,
|
||||||
|
rateCount: 0,
|
||||||
|
datePickerCount: 0,
|
||||||
|
}
|
||||||
|
|
||||||
|
const counts = reactive({...badgeCounts})
|
||||||
|
const formState = reactive({
|
||||||
|
...initialState
|
||||||
|
});
|
||||||
|
|
||||||
|
async function handleCancel() {
|
||||||
|
Object.assign(formState, initialState);
|
||||||
|
Object.assign(counts, badgeCounts);
|
||||||
|
formState.questionList = [];
|
||||||
|
await modalApi.close();
|
||||||
|
}
|
||||||
|
|
||||||
|
function handleAddQuestion(type: number) {
|
||||||
|
formState.questionList.push({type})
|
||||||
|
switch (type) {
|
||||||
|
case 1:
|
||||||
|
counts.inputCount++;
|
||||||
|
break;
|
||||||
|
case 2:
|
||||||
|
counts.textareaCount++;
|
||||||
|
break;
|
||||||
|
case 3:
|
||||||
|
counts.radioCount++;
|
||||||
|
break;
|
||||||
|
case 4:
|
||||||
|
counts.checkboxCount++;
|
||||||
|
break;
|
||||||
|
case 5:
|
||||||
|
counts.rateCount++;
|
||||||
|
break;
|
||||||
|
case 6:
|
||||||
|
counts.datePickerCount++;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function addOptions(val: any) {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
function deleteOptions(index: number, type: number) {
|
||||||
|
formState.questionList.splice(index, 1)
|
||||||
|
switch (type) {
|
||||||
|
case 1:
|
||||||
|
counts.inputCount--;
|
||||||
|
break;
|
||||||
|
case 2:
|
||||||
|
counts.textareaCount--;
|
||||||
|
break;
|
||||||
|
case 3:
|
||||||
|
counts.radioCount--;
|
||||||
|
break;
|
||||||
|
case 4:
|
||||||
|
counts.checkboxCount--;
|
||||||
|
break;
|
||||||
|
case 5:
|
||||||
|
counts.rateCount--;
|
||||||
|
break;
|
||||||
|
case 6:
|
||||||
|
counts.datePickerCount--;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
async function handleSave(type: number) {
|
||||||
|
await modalApi.close();
|
||||||
|
}
|
||||||
|
|
||||||
|
onMounted(()=>{
|
||||||
|
getDictOptions('wy_wtsjlx')
|
||||||
|
})
|
||||||
|
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<template>
|
||||||
|
<BasicModal :title="title" :footer="false" class="modal-container">
|
||||||
|
<Row :gutter="24">
|
||||||
|
<Col class="gutter-row" :span="3">
|
||||||
|
<div class="left-options">
|
||||||
|
<div class="header-title">问题设计</div>
|
||||||
|
<Badge :count="counts.inputCount" :number-style="{ backgroundColor: '#3996f3' }">
|
||||||
|
<a-button size="large" @click="handleAddQuestion(1)">单行文本</a-button>
|
||||||
|
</Badge>
|
||||||
|
<Badge :count="counts.textareaCount" :number-style="{ backgroundColor: '#3996f3' }">
|
||||||
|
<a-button size="large" @click="handleAddQuestion(2)">多行文本</a-button>
|
||||||
|
</Badge>
|
||||||
|
<Badge :count="counts.radioCount" :number-style="{ backgroundColor: '#3996f3' }">
|
||||||
|
<a-button size="large" @click="handleAddQuestion(3)">单选题</a-button>
|
||||||
|
</Badge>
|
||||||
|
<Badge :count="counts.checkboxCount" :number-style="{ backgroundColor: '#3996f3' }">
|
||||||
|
<a-button size="large" @click="handleAddQuestion(4)">多选题</a-button>
|
||||||
|
</Badge>
|
||||||
|
<Badge :count="counts.rateCount" :number-style="{ backgroundColor: '#3996f3' }">
|
||||||
|
<a-button size="large" @click="handleAddQuestion(5)">评分题</a-button>
|
||||||
|
</Badge>
|
||||||
|
<Badge :count="counts.datePickerCount" :number-style="{ backgroundColor: '#3996f3' }">
|
||||||
|
<a-button size="large" @click="handleAddQuestion(6)">日期选择</a-button>
|
||||||
|
</Badge>
|
||||||
|
</div>
|
||||||
|
</Col>
|
||||||
|
<Col class="gutter-row" :span="21">
|
||||||
|
<div class="right-question">
|
||||||
|
<div class="header-title">基本信息</div>
|
||||||
|
<Form
|
||||||
|
:model="formState"
|
||||||
|
name="basic"
|
||||||
|
>
|
||||||
|
<FormItem
|
||||||
|
label="问卷标题"
|
||||||
|
name="username"
|
||||||
|
:rules="[{ required: true, message: '问卷标题不能为空' }]"
|
||||||
|
>
|
||||||
|
<Input v-model:value="formState.username"/>
|
||||||
|
</FormItem>
|
||||||
|
|
||||||
|
<FormItem
|
||||||
|
label="问卷描述"
|
||||||
|
name="password"
|
||||||
|
:rules="[{ required: true, message: 'Please input your password!' }]"
|
||||||
|
>
|
||||||
|
<Input v-model:value="formState.password"/>
|
||||||
|
</FormItem>
|
||||||
|
<div v-if="formState.questionList.length">
|
||||||
|
<div v-for="(item,index) in formState.questionList">
|
||||||
|
<Divider orientation="left">
|
||||||
|
问题{{ (index + 1) + '\xa0' + renderDictValue(item.type, 'wy_wtsjlx') }}
|
||||||
|
<Popover placement="top">
|
||||||
|
<template #content>
|
||||||
|
<p>删除当前问题</p>
|
||||||
|
</template>
|
||||||
|
<a-button type="link" @click="deleteOptions(index,item.type)">
|
||||||
|
<template #icon>
|
||||||
|
<DeleteOutlined style="color: red"/>
|
||||||
|
</template>
|
||||||
|
</a-button>
|
||||||
|
</Popover>
|
||||||
|
</Divider>
|
||||||
|
<FormItem
|
||||||
|
label="问题标题"
|
||||||
|
name="username"
|
||||||
|
:rules="[{ required: true }]"
|
||||||
|
>
|
||||||
|
<Input v-model:value="formState.username"/>
|
||||||
|
</FormItem>
|
||||||
|
<FormItem
|
||||||
|
label="问题描述"
|
||||||
|
name="password"
|
||||||
|
:rules="[{ required: true }]"
|
||||||
|
>
|
||||||
|
<Input v-model:value="formState.password"/>
|
||||||
|
</FormItem>
|
||||||
|
<Row :gutter="24" v-if="item.type==3||item.type==4">
|
||||||
|
<Col class="gutter-row" :span="12">
|
||||||
|
<FormItem
|
||||||
|
label="选项设置"
|
||||||
|
name="password"
|
||||||
|
:rules="[{ required: true }]"
|
||||||
|
>
|
||||||
|
<Input style="margin-bottom: 10px" v-model:value="formState.password"
|
||||||
|
placeholder="选项1"/>
|
||||||
|
<Input v-model:value="formState.password" placeholder="选项1"/>
|
||||||
|
</FormItem>
|
||||||
|
</Col>
|
||||||
|
<Col class="gutter-row" :span="12">
|
||||||
|
<a-button @click="addOptions(item)">
|
||||||
|
<template #icon>
|
||||||
|
<PlusOutlined/>
|
||||||
|
</template>
|
||||||
|
添加选项
|
||||||
|
</a-button>
|
||||||
|
</Col>
|
||||||
|
</Row>
|
||||||
|
<FormItem
|
||||||
|
v-if="item.type==5"
|
||||||
|
label="评分预览"
|
||||||
|
name="password"
|
||||||
|
>
|
||||||
|
<Rate v-model:value="formState.username"/>
|
||||||
|
</FormItem>
|
||||||
|
<FormItem
|
||||||
|
v-if="item.type==6"
|
||||||
|
label="日期选择预览"
|
||||||
|
name="password"
|
||||||
|
>
|
||||||
|
<DatePicker style="width: 180px" v-model:value="formState.username"/>
|
||||||
|
</FormItem>
|
||||||
|
<FormItem
|
||||||
|
label="是否必填"
|
||||||
|
name="password"
|
||||||
|
:rules="[{ required: true, message: 'Please input your password!' }]"
|
||||||
|
>
|
||||||
|
<Switch v-model:checked="formState.username"/>
|
||||||
|
</FormItem>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="empty-box" v-else>
|
||||||
|
<Empty description="还没有添加问题,点击左侧按钮开始创建"/>
|
||||||
|
</div>
|
||||||
|
<div class="header-title">发布设计</div>
|
||||||
|
<Row :gutter="24">
|
||||||
|
<Col class="gutter-row" :span="6">
|
||||||
|
<FormItem
|
||||||
|
label="匿名收集"
|
||||||
|
name="username"
|
||||||
|
:rules="[{ required: true, message: '匿名收集不能为空' }]"
|
||||||
|
>
|
||||||
|
<Switch v-model:checked="formState.username"/>
|
||||||
|
</FormItem>
|
||||||
|
</Col>
|
||||||
|
<Col class="gutter-row" :span="6">
|
||||||
|
<FormItem
|
||||||
|
label="允许多次提交"
|
||||||
|
name="username"
|
||||||
|
:rules="[{ required: true, message: '多次提交不能为空' }]"
|
||||||
|
>
|
||||||
|
<Switch v-model:checked="formState.username"/>
|
||||||
|
</FormItem>
|
||||||
|
</Col>
|
||||||
|
<Col class="gutter-row" :span="12">
|
||||||
|
<FormItem
|
||||||
|
label="截至日期"
|
||||||
|
name="username"
|
||||||
|
:rules="[{ required: true, message: '截止日期不能为空' }]"
|
||||||
|
>
|
||||||
|
<DatePicker style="width: 180px" v-model:value="formState.username"/>
|
||||||
|
</FormItem>
|
||||||
|
</Col>
|
||||||
|
</Row>
|
||||||
|
</Form>
|
||||||
|
</div>
|
||||||
|
</Col>
|
||||||
|
</Row>
|
||||||
|
<div class="footer-button">
|
||||||
|
<a-button type="primary" @click="handleSave(1)">保存并发布</a-button>
|
||||||
|
<a-button @click="handleSave(2)">保存为草稿</a-button>
|
||||||
|
<a-button @click="handleCancel">取消</a-button>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</BasicModal>
|
||||||
|
</template>
|
||||||
|
<style lang="scss" scoped>
|
||||||
|
.modal-container {
|
||||||
|
position: relative;
|
||||||
|
|
||||||
|
.header-title {
|
||||||
|
margin-bottom: 10px;
|
||||||
|
font-size: 17px;
|
||||||
|
font-weight: bold;
|
||||||
|
}
|
||||||
|
|
||||||
|
.left-options {
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
|
||||||
|
:deep(.ant-badge .ant-badge-count) {
|
||||||
|
position: absolute;
|
||||||
|
top: 40px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.ant-btn {
|
||||||
|
width: 150px;
|
||||||
|
margin-top: 40px;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.right-question {
|
||||||
|
max-height: 87vh;
|
||||||
|
overflow-x: hidden;
|
||||||
|
overflow-y: auto;
|
||||||
|
}
|
||||||
|
|
||||||
|
.footer-button {
|
||||||
|
width: 100%;
|
||||||
|
|
||||||
|
.ant-btn {
|
||||||
|
float: right;
|
||||||
|
margin: 0 15px 10px 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
position: absolute;
|
||||||
|
right: 0;
|
||||||
|
bottom: 0;
|
||||||
|
z-index: 100;
|
||||||
|
background-color: #ffffff;
|
||||||
|
}
|
||||||
|
|
||||||
|
.empty-box {
|
||||||
|
height: 50vh;
|
||||||
|
border: 2px dashed #dce0e6;
|
||||||
|
border-radius: 10px;
|
||||||
|
|
||||||
|
:deep(.ant-empty .ant-empty-image) {
|
||||||
|
margin-top: 15vh;
|
||||||
|
}
|
||||||
|
|
||||||
|
margin-bottom: 10px;
|
||||||
|
margin-left: 80px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.question-item-title {
|
||||||
|
font-weight: bold;
|
||||||
|
margin: 5px 12px;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
|
Reference in New Issue
Block a user