feat(cms): 移除cmsComponents、cmsDesignCollect、cmsDesignRecord和cmsDesignSignUp模块
移除了以下CMS相关模块的API接口定义及前端页面组件:- cmsComponents(组件管理) - cmsDesignCollect(设计征集) - cmsDesignRecord(页面组件记录) - cmsDesignSignUp(设计征集报名) 同时清理了相关的模型定义、接口调用及Vue页面文件,优化了登录模块中用户信息存储逻辑,去除冗余字段。
This commit is contained in:
@@ -1,106 +0,0 @@
|
|||||||
import request from '@/utils/request';
|
|
||||||
import type { ApiResult, PageResult } from '@/api';
|
|
||||||
import type { CmsComponents, CmsComponentsParam } from './model';
|
|
||||||
import { MODULES_API_URL } from '@/config/setting';
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 分页查询组件
|
|
||||||
*/
|
|
||||||
export async function pageCmsComponents(params: CmsComponentsParam) {
|
|
||||||
const res = await request.get<ApiResult<PageResult<CmsComponents>>>(
|
|
||||||
MODULES_API_URL + '/cms/cms-components/page',
|
|
||||||
{
|
|
||||||
params
|
|
||||||
}
|
|
||||||
);
|
|
||||||
if (res.data.code === 0) {
|
|
||||||
return res.data.data;
|
|
||||||
}
|
|
||||||
return Promise.reject(new Error(res.data.message));
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 查询组件列表
|
|
||||||
*/
|
|
||||||
export async function listCmsComponents(params?: CmsComponentsParam) {
|
|
||||||
const res = await request.get<ApiResult<CmsComponents[]>>(
|
|
||||||
MODULES_API_URL + '/cms/cms-components',
|
|
||||||
{
|
|
||||||
params
|
|
||||||
}
|
|
||||||
);
|
|
||||||
if (res.data.code === 0 && res.data.data) {
|
|
||||||
return res.data.data;
|
|
||||||
}
|
|
||||||
return Promise.reject(new Error(res.data.message));
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 添加组件
|
|
||||||
*/
|
|
||||||
export async function addCmsComponents(data: CmsComponents) {
|
|
||||||
const res = await request.post<ApiResult<unknown>>(
|
|
||||||
MODULES_API_URL + '/cms/cms-components',
|
|
||||||
data
|
|
||||||
);
|
|
||||||
if (res.data.code === 0) {
|
|
||||||
return res.data.message;
|
|
||||||
}
|
|
||||||
return Promise.reject(new Error(res.data.message));
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 修改组件
|
|
||||||
*/
|
|
||||||
export async function updateCmsComponents(data: CmsComponents) {
|
|
||||||
const res = await request.put<ApiResult<unknown>>(
|
|
||||||
MODULES_API_URL + '/cms/cms-components',
|
|
||||||
data
|
|
||||||
);
|
|
||||||
if (res.data.code === 0) {
|
|
||||||
return res.data.message;
|
|
||||||
}
|
|
||||||
return Promise.reject(new Error(res.data.message));
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 删除组件
|
|
||||||
*/
|
|
||||||
export async function removeCmsComponents(id?: number) {
|
|
||||||
const res = await request.delete<ApiResult<unknown>>(
|
|
||||||
MODULES_API_URL + '/cms/cms-components/' + id
|
|
||||||
);
|
|
||||||
if (res.data.code === 0) {
|
|
||||||
return res.data.message;
|
|
||||||
}
|
|
||||||
return Promise.reject(new Error(res.data.message));
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 批量删除组件
|
|
||||||
*/
|
|
||||||
export async function removeBatchCmsComponents(data: (number | undefined)[]) {
|
|
||||||
const res = await request.delete<ApiResult<unknown>>(
|
|
||||||
MODULES_API_URL + '/cms/cms-components/batch',
|
|
||||||
{
|
|
||||||
data
|
|
||||||
}
|
|
||||||
);
|
|
||||||
if (res.data.code === 0) {
|
|
||||||
return res.data.message;
|
|
||||||
}
|
|
||||||
return Promise.reject(new Error(res.data.message));
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 根据id查询组件
|
|
||||||
*/
|
|
||||||
export async function getCmsComponents(id: number) {
|
|
||||||
const res = await request.get<ApiResult<CmsComponents>>(
|
|
||||||
MODULES_API_URL + '/cms/cms-components/' + id
|
|
||||||
);
|
|
||||||
if (res.data.code === 0 && res.data.data) {
|
|
||||||
return res.data.data;
|
|
||||||
}
|
|
||||||
return Promise.reject(new Error(res.data.message));
|
|
||||||
}
|
|
||||||
@@ -1,43 +0,0 @@
|
|||||||
import type { PageParam } from '@/api';
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 组件
|
|
||||||
*/
|
|
||||||
export interface CmsComponents {
|
|
||||||
// ID
|
|
||||||
id?: number;
|
|
||||||
// 组件标题
|
|
||||||
title?: string;
|
|
||||||
// 关联导航ID
|
|
||||||
navigationId?: number;
|
|
||||||
// 组件类型
|
|
||||||
type?: string;
|
|
||||||
// 页面关键词
|
|
||||||
keywords?: string;
|
|
||||||
// 页面描述
|
|
||||||
description?: string;
|
|
||||||
// 组件路径
|
|
||||||
path?: string;
|
|
||||||
// 组件图标
|
|
||||||
icon?: string;
|
|
||||||
// 用户ID
|
|
||||||
userId?: number;
|
|
||||||
// 排序(数字越小越靠前)
|
|
||||||
sortNumber?: number;
|
|
||||||
// 备注
|
|
||||||
comments?: string;
|
|
||||||
// 状态, 0正常, 1冻结
|
|
||||||
status?: number;
|
|
||||||
// 租户id
|
|
||||||
tenantId?: number;
|
|
||||||
// 创建时间
|
|
||||||
createTime?: string;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 组件搜索条件
|
|
||||||
*/
|
|
||||||
export interface CmsComponentsParam extends PageParam {
|
|
||||||
id?: number;
|
|
||||||
keywords?: string;
|
|
||||||
}
|
|
||||||
@@ -1,106 +0,0 @@
|
|||||||
import request from '@/utils/request';
|
|
||||||
import type { ApiResult, PageResult } from '@/api';
|
|
||||||
import type { CmsDesignCollect, CmsDesignCollectParam } from './model';
|
|
||||||
import { MODULES_API_URL } from '@/config/setting';
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 分页查询设计征集
|
|
||||||
*/
|
|
||||||
export async function pageCmsDesignCollect(params: CmsDesignCollectParam) {
|
|
||||||
const res = await request.get<ApiResult<PageResult<CmsDesignCollect>>>(
|
|
||||||
MODULES_API_URL + '/cms/cms-design-collect/page',
|
|
||||||
{
|
|
||||||
params
|
|
||||||
}
|
|
||||||
);
|
|
||||||
if (res.data.code === 0) {
|
|
||||||
return res.data.data;
|
|
||||||
}
|
|
||||||
return Promise.reject(new Error(res.data.message));
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 查询设计征集列表
|
|
||||||
*/
|
|
||||||
export async function listCmsDesignCollect(params?: CmsDesignCollectParam) {
|
|
||||||
const res = await request.get<ApiResult<CmsDesignCollect[]>>(
|
|
||||||
MODULES_API_URL + '/cms/cms-design-collect',
|
|
||||||
{
|
|
||||||
params
|
|
||||||
}
|
|
||||||
);
|
|
||||||
if (res.data.code === 0 && res.data.data) {
|
|
||||||
return res.data.data;
|
|
||||||
}
|
|
||||||
return Promise.reject(new Error(res.data.message));
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 添加设计征集
|
|
||||||
*/
|
|
||||||
export async function addCmsDesignCollect(data: CmsDesignCollect) {
|
|
||||||
const res = await request.post<ApiResult<unknown>>(
|
|
||||||
MODULES_API_URL + '/cms/cms-design-collect',
|
|
||||||
data
|
|
||||||
);
|
|
||||||
if (res.data.code === 0) {
|
|
||||||
return res.data.message;
|
|
||||||
}
|
|
||||||
return Promise.reject(new Error(res.data.message));
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 修改设计征集
|
|
||||||
*/
|
|
||||||
export async function updateCmsDesignCollect(data: CmsDesignCollect) {
|
|
||||||
const res = await request.put<ApiResult<unknown>>(
|
|
||||||
MODULES_API_URL + '/cms/cms-design-collect',
|
|
||||||
data
|
|
||||||
);
|
|
||||||
if (res.data.code === 0) {
|
|
||||||
return res.data.message;
|
|
||||||
}
|
|
||||||
return Promise.reject(new Error(res.data.message));
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 删除设计征集
|
|
||||||
*/
|
|
||||||
export async function removeCmsDesignCollect(id?: number) {
|
|
||||||
const res = await request.delete<ApiResult<unknown>>(
|
|
||||||
MODULES_API_URL + '/cms/cms-design-collect/' + id
|
|
||||||
);
|
|
||||||
if (res.data.code === 0) {
|
|
||||||
return res.data.message;
|
|
||||||
}
|
|
||||||
return Promise.reject(new Error(res.data.message));
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 批量删除设计征集
|
|
||||||
*/
|
|
||||||
export async function removeBatchCmsDesignCollect(data: (number | undefined)[]) {
|
|
||||||
const res = await request.delete<ApiResult<unknown>>(
|
|
||||||
MODULES_API_URL + '/cms/cms-design-collect/batch',
|
|
||||||
{
|
|
||||||
data
|
|
||||||
}
|
|
||||||
);
|
|
||||||
if (res.data.code === 0) {
|
|
||||||
return res.data.message;
|
|
||||||
}
|
|
||||||
return Promise.reject(new Error(res.data.message));
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 根据id查询设计征集
|
|
||||||
*/
|
|
||||||
export async function getCmsDesignCollect(id: number) {
|
|
||||||
const res = await request.get<ApiResult<CmsDesignCollect>>(
|
|
||||||
MODULES_API_URL + '/cms/cms-design-collect/' + id
|
|
||||||
);
|
|
||||||
if (res.data.code === 0 && res.data.data) {
|
|
||||||
return res.data.data;
|
|
||||||
}
|
|
||||||
return Promise.reject(new Error(res.data.message));
|
|
||||||
}
|
|
||||||
@@ -1,39 +0,0 @@
|
|||||||
import type { PageParam } from '@/api';
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 设计征集
|
|
||||||
*/
|
|
||||||
export interface CmsDesignCollect {
|
|
||||||
//
|
|
||||||
id?: number;
|
|
||||||
//
|
|
||||||
title?: string;
|
|
||||||
//
|
|
||||||
content?: string;
|
|
||||||
//
|
|
||||||
image?: string;
|
|
||||||
// 用户ID
|
|
||||||
userId?: number;
|
|
||||||
// 排序(数字越小越靠前)
|
|
||||||
sortNumber?: number;
|
|
||||||
// 备注
|
|
||||||
comments?: string;
|
|
||||||
// 状态, 0已发布, 1待审核 2已驳回 3违规内容
|
|
||||||
status?: number;
|
|
||||||
// 是否删除, 0否, 1是
|
|
||||||
deleted?: number;
|
|
||||||
// 租户id
|
|
||||||
tenantId?: number;
|
|
||||||
// 创建时间
|
|
||||||
createTime?: string;
|
|
||||||
// 修改时间
|
|
||||||
updateTime?: string;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 设计征集搜索条件
|
|
||||||
*/
|
|
||||||
export interface CmsDesignCollectParam extends PageParam {
|
|
||||||
id?: number;
|
|
||||||
keywords?: string;
|
|
||||||
}
|
|
||||||
@@ -1,106 +0,0 @@
|
|||||||
import request from '@/utils/request';
|
|
||||||
import type { ApiResult, PageResult } from '@/api';
|
|
||||||
import type { CmsDesignRecord, CmsDesignRecordParam } from './model';
|
|
||||||
import { MODULES_API_URL } from '@/config/setting';
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 分页查询页面组件表
|
|
||||||
*/
|
|
||||||
export async function pageCmsDesignRecord(params: CmsDesignRecordParam) {
|
|
||||||
const res = await request.get<ApiResult<PageResult<CmsDesignRecord>>>(
|
|
||||||
MODULES_API_URL + '/cms/cms-design-record/page',
|
|
||||||
{
|
|
||||||
params
|
|
||||||
}
|
|
||||||
);
|
|
||||||
if (res.data.code === 0) {
|
|
||||||
return res.data.data;
|
|
||||||
}
|
|
||||||
return Promise.reject(new Error(res.data.message));
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 查询页面组件表列表
|
|
||||||
*/
|
|
||||||
export async function listCmsDesignRecord(params?: CmsDesignRecordParam) {
|
|
||||||
const res = await request.get<ApiResult<CmsDesignRecord[]>>(
|
|
||||||
MODULES_API_URL + '/cms/cms-design-record',
|
|
||||||
{
|
|
||||||
params
|
|
||||||
}
|
|
||||||
);
|
|
||||||
if (res.data.code === 0 && res.data.data) {
|
|
||||||
return res.data.data;
|
|
||||||
}
|
|
||||||
return Promise.reject(new Error(res.data.message));
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 添加页面组件表
|
|
||||||
*/
|
|
||||||
export async function addCmsDesignRecord(data: CmsDesignRecord) {
|
|
||||||
const res = await request.post<ApiResult<unknown>>(
|
|
||||||
MODULES_API_URL + '/cms/cms-design-record',
|
|
||||||
data
|
|
||||||
);
|
|
||||||
if (res.data.code === 0) {
|
|
||||||
return res.data.message;
|
|
||||||
}
|
|
||||||
return Promise.reject(new Error(res.data.message));
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 修改页面组件表
|
|
||||||
*/
|
|
||||||
export async function updateCmsDesignRecord(data: CmsDesignRecord) {
|
|
||||||
const res = await request.put<ApiResult<unknown>>(
|
|
||||||
MODULES_API_URL + '/cms/cms-design-record',
|
|
||||||
data
|
|
||||||
);
|
|
||||||
if (res.data.code === 0) {
|
|
||||||
return res.data.message;
|
|
||||||
}
|
|
||||||
return Promise.reject(new Error(res.data.message));
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 删除页面组件表
|
|
||||||
*/
|
|
||||||
export async function removeCmsDesignRecord(id?: number) {
|
|
||||||
const res = await request.delete<ApiResult<unknown>>(
|
|
||||||
MODULES_API_URL + '/cms/cms-design-record/' + id
|
|
||||||
);
|
|
||||||
if (res.data.code === 0) {
|
|
||||||
return res.data.message;
|
|
||||||
}
|
|
||||||
return Promise.reject(new Error(res.data.message));
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 批量删除页面组件表
|
|
||||||
*/
|
|
||||||
export async function removeBatchCmsDesignRecord(data: (number | undefined)[]) {
|
|
||||||
const res = await request.delete<ApiResult<unknown>>(
|
|
||||||
MODULES_API_URL + '/cms/cms-design-record/batch',
|
|
||||||
{
|
|
||||||
data
|
|
||||||
}
|
|
||||||
);
|
|
||||||
if (res.data.code === 0) {
|
|
||||||
return res.data.message;
|
|
||||||
}
|
|
||||||
return Promise.reject(new Error(res.data.message));
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 根据id查询页面组件表
|
|
||||||
*/
|
|
||||||
export async function getCmsDesignRecord(id: number) {
|
|
||||||
const res = await request.get<ApiResult<CmsDesignRecord>>(
|
|
||||||
MODULES_API_URL + '/cms/cms-design-record/' + id
|
|
||||||
);
|
|
||||||
if (res.data.code === 0 && res.data.data) {
|
|
||||||
return res.data.data;
|
|
||||||
}
|
|
||||||
return Promise.reject(new Error(res.data.message));
|
|
||||||
}
|
|
||||||
@@ -1,51 +0,0 @@
|
|||||||
import type { PageParam } from '@/api';
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 页面组件表
|
|
||||||
*/
|
|
||||||
export interface CmsDesignRecord {
|
|
||||||
// ID
|
|
||||||
id?: number;
|
|
||||||
// 关联导航ID
|
|
||||||
navigationId?: number;
|
|
||||||
parentId?: number;
|
|
||||||
pageId?: number;
|
|
||||||
// 组件
|
|
||||||
title?: string;
|
|
||||||
// 组件标识
|
|
||||||
dictCode?: string;
|
|
||||||
// 组件样式
|
|
||||||
styles?: string;
|
|
||||||
// 卡片阴影显示时机
|
|
||||||
shadow?: string;
|
|
||||||
// 页面关键词
|
|
||||||
keywords?: string;
|
|
||||||
// 页面描述
|
|
||||||
description?: string;
|
|
||||||
// 页面路由地址
|
|
||||||
path?: string;
|
|
||||||
// 缩列图
|
|
||||||
photo?: string;
|
|
||||||
// 用户ID
|
|
||||||
userId?: number;
|
|
||||||
// 排序(数字越小越靠前)
|
|
||||||
sortNumber?: number;
|
|
||||||
// 备注
|
|
||||||
comments?: string;
|
|
||||||
// 状态, 0正常, 1冻结
|
|
||||||
status?: number;
|
|
||||||
// 租户id
|
|
||||||
tenantId?: number;
|
|
||||||
// 创建时间
|
|
||||||
createTime?: string;
|
|
||||||
// 所属期次
|
|
||||||
periodId?: number;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 页面组件表搜索条件
|
|
||||||
*/
|
|
||||||
export interface CmsDesignRecordParam extends PageParam {
|
|
||||||
id?: number;
|
|
||||||
keywords?: string;
|
|
||||||
}
|
|
||||||
@@ -1,106 +0,0 @@
|
|||||||
import request from '@/utils/request';
|
|
||||||
import type { ApiResult, PageResult } from '@/api';
|
|
||||||
import type { CmsDesignSignUp, CmsDesignSignUpParam } from './model';
|
|
||||||
import { MODULES_API_URL } from '@/config/setting';
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 分页查询设计征集报名
|
|
||||||
*/
|
|
||||||
export async function pageCmsDesignSignUp(params: CmsDesignSignUpParam) {
|
|
||||||
const res = await request.get<ApiResult<PageResult<CmsDesignSignUp>>>(
|
|
||||||
MODULES_API_URL + '/cms/cms-design-sign-up/page',
|
|
||||||
{
|
|
||||||
params
|
|
||||||
}
|
|
||||||
);
|
|
||||||
if (res.data.code === 0) {
|
|
||||||
return res.data.data;
|
|
||||||
}
|
|
||||||
return Promise.reject(new Error(res.data.message));
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 查询设计征集报名列表
|
|
||||||
*/
|
|
||||||
export async function listCmsDesignSignUp(params?: CmsDesignSignUpParam) {
|
|
||||||
const res = await request.get<ApiResult<CmsDesignSignUp[]>>(
|
|
||||||
MODULES_API_URL + '/cms/cms-design-sign-up',
|
|
||||||
{
|
|
||||||
params
|
|
||||||
}
|
|
||||||
);
|
|
||||||
if (res.data.code === 0 && res.data.data) {
|
|
||||||
return res.data.data;
|
|
||||||
}
|
|
||||||
return Promise.reject(new Error(res.data.message));
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 添加设计征集报名
|
|
||||||
*/
|
|
||||||
export async function addCmsDesignSignUp(data: CmsDesignSignUp) {
|
|
||||||
const res = await request.post<ApiResult<unknown>>(
|
|
||||||
MODULES_API_URL + '/cms/cms-design-sign-up',
|
|
||||||
data
|
|
||||||
);
|
|
||||||
if (res.data.code === 0) {
|
|
||||||
return res.data.message;
|
|
||||||
}
|
|
||||||
return Promise.reject(new Error(res.data.message));
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 修改设计征集报名
|
|
||||||
*/
|
|
||||||
export async function updateCmsDesignSignUp(data: CmsDesignSignUp) {
|
|
||||||
const res = await request.put<ApiResult<unknown>>(
|
|
||||||
MODULES_API_URL + '/cms/cms-design-sign-up',
|
|
||||||
data
|
|
||||||
);
|
|
||||||
if (res.data.code === 0) {
|
|
||||||
return res.data.message;
|
|
||||||
}
|
|
||||||
return Promise.reject(new Error(res.data.message));
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 删除设计征集报名
|
|
||||||
*/
|
|
||||||
export async function removeCmsDesignSignUp(id?: number) {
|
|
||||||
const res = await request.delete<ApiResult<unknown>>(
|
|
||||||
MODULES_API_URL + '/cms/cms-design-sign-up/' + id
|
|
||||||
);
|
|
||||||
if (res.data.code === 0) {
|
|
||||||
return res.data.message;
|
|
||||||
}
|
|
||||||
return Promise.reject(new Error(res.data.message));
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 批量删除设计征集报名
|
|
||||||
*/
|
|
||||||
export async function removeBatchCmsDesignSignUp(data: (number | undefined)[]) {
|
|
||||||
const res = await request.delete<ApiResult<unknown>>(
|
|
||||||
MODULES_API_URL + '/cms/cms-design-sign-up/batch',
|
|
||||||
{
|
|
||||||
data
|
|
||||||
}
|
|
||||||
);
|
|
||||||
if (res.data.code === 0) {
|
|
||||||
return res.data.message;
|
|
||||||
}
|
|
||||||
return Promise.reject(new Error(res.data.message));
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 根据id查询设计征集报名
|
|
||||||
*/
|
|
||||||
export async function getCmsDesignSignUp(id: number) {
|
|
||||||
const res = await request.get<ApiResult<CmsDesignSignUp>>(
|
|
||||||
MODULES_API_URL + '/cms/cms-design-sign-up/' + id
|
|
||||||
);
|
|
||||||
if (res.data.code === 0 && res.data.data) {
|
|
||||||
return res.data.data;
|
|
||||||
}
|
|
||||||
return Promise.reject(new Error(res.data.message));
|
|
||||||
}
|
|
||||||
@@ -1,41 +0,0 @@
|
|||||||
import type { PageParam } from '@/api';
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 设计征集报名
|
|
||||||
*/
|
|
||||||
export interface CmsDesignSignUp {
|
|
||||||
//
|
|
||||||
id?: number;
|
|
||||||
//
|
|
||||||
designId?: number;
|
|
||||||
//
|
|
||||||
name?: string;
|
|
||||||
//
|
|
||||||
phone?: string;
|
|
||||||
//
|
|
||||||
content?: string;
|
|
||||||
// 用户ID
|
|
||||||
userId?: number;
|
|
||||||
// 排序(数字越小越靠前)
|
|
||||||
sortNumber?: number;
|
|
||||||
// 备注
|
|
||||||
comments?: string;
|
|
||||||
// 状态, 0已发布, 1待审核 2已驳回 3违规内容
|
|
||||||
status?: number;
|
|
||||||
// 是否删除, 0否, 1是
|
|
||||||
deleted?: number;
|
|
||||||
// 租户id
|
|
||||||
tenantId?: number;
|
|
||||||
// 创建时间
|
|
||||||
createTime?: string;
|
|
||||||
// 修改时间
|
|
||||||
updateTime?: string;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 设计征集报名搜索条件
|
|
||||||
*/
|
|
||||||
export interface CmsDesignSignUpParam extends PageParam {
|
|
||||||
id?: number;
|
|
||||||
keywords?: string;
|
|
||||||
}
|
|
||||||
@@ -54,10 +54,7 @@ export async function loginBySms(data: LoginParam) {
|
|||||||
if (res.data.data?.user) {
|
if (res.data.data?.user) {
|
||||||
const user = res.data.data?.user;
|
const user = res.data.data?.user;
|
||||||
localStorage.setItem('TenantId', String(user.tenantId));
|
localStorage.setItem('TenantId', String(user.tenantId));
|
||||||
localStorage.setItem('Phone', String(user.phone));
|
|
||||||
localStorage.setItem('UserId', String(user.userId));
|
localStorage.setItem('UserId', String(user.userId));
|
||||||
// localStorage.setItem('MerchantId', String(user.merchantId));
|
|
||||||
// localStorage.setItem('MerchantName', String(user.merchantName));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return res.data.message;
|
return res.data.message;
|
||||||
|
|||||||
@@ -1,252 +0,0 @@
|
|||||||
<!-- 编辑弹窗 -->
|
|
||||||
<template>
|
|
||||||
<ele-modal
|
|
||||||
:width="800"
|
|
||||||
:visible="visible"
|
|
||||||
:maskClosable="false"
|
|
||||||
:maxable="maxable"
|
|
||||||
:title="isUpdate ? '编辑组件' : '添加组件'"
|
|
||||||
:body-style="{ paddingBottom: '28px' }"
|
|
||||||
@update:visible="updateVisible"
|
|
||||||
@ok="save"
|
|
||||||
>
|
|
||||||
<a-form
|
|
||||||
ref="formRef"
|
|
||||||
:model="form"
|
|
||||||
:rules="rules"
|
|
||||||
:label-col="styleResponsive ? { md: 4, sm: 5, xs: 24 } : { flex: '90px' }"
|
|
||||||
:wrapper-col="
|
|
||||||
styleResponsive ? { md: 19, sm: 19, xs: 24 } : { flex: '1' }
|
|
||||||
"
|
|
||||||
>
|
|
||||||
<a-form-item label="组件标题" name="title">
|
|
||||||
<a-input
|
|
||||||
allow-clear
|
|
||||||
placeholder="请输入组件标题"
|
|
||||||
v-model:value="form.title"
|
|
||||||
/>
|
|
||||||
</a-form-item>
|
|
||||||
<a-form-item label="关联导航ID" name="navigationId">
|
|
||||||
<a-input
|
|
||||||
allow-clear
|
|
||||||
placeholder="请输入关联导航ID"
|
|
||||||
v-model:value="form.navigationId"
|
|
||||||
/>
|
|
||||||
</a-form-item>
|
|
||||||
<a-form-item label="组件类型" name="type">
|
|
||||||
<a-input
|
|
||||||
allow-clear
|
|
||||||
placeholder="请输入组件类型"
|
|
||||||
v-model:value="form.type"
|
|
||||||
/>
|
|
||||||
</a-form-item>
|
|
||||||
<a-form-item label="页面关键词" name="keywords">
|
|
||||||
<a-input
|
|
||||||
allow-clear
|
|
||||||
placeholder="请输入页面关键词"
|
|
||||||
v-model:value="form.keywords"
|
|
||||||
/>
|
|
||||||
</a-form-item>
|
|
||||||
<a-form-item label="页面描述" name="description">
|
|
||||||
<a-input
|
|
||||||
allow-clear
|
|
||||||
placeholder="请输入页面描述"
|
|
||||||
v-model:value="form.description"
|
|
||||||
/>
|
|
||||||
</a-form-item>
|
|
||||||
<a-form-item label="组件路径" name="path">
|
|
||||||
<a-input
|
|
||||||
allow-clear
|
|
||||||
placeholder="请输入组件路径"
|
|
||||||
v-model:value="form.path"
|
|
||||||
/>
|
|
||||||
</a-form-item>
|
|
||||||
<a-form-item label="组件图标" name="icon">
|
|
||||||
<a-input
|
|
||||||
allow-clear
|
|
||||||
placeholder="请输入组件图标"
|
|
||||||
v-model:value="form.icon"
|
|
||||||
/>
|
|
||||||
</a-form-item>
|
|
||||||
<a-form-item label="用户ID" name="userId">
|
|
||||||
<a-input
|
|
||||||
allow-clear
|
|
||||||
placeholder="请输入用户ID"
|
|
||||||
v-model:value="form.userId"
|
|
||||||
/>
|
|
||||||
</a-form-item>
|
|
||||||
<a-form-item label="排序(数字越小越靠前)" name="sortNumber">
|
|
||||||
<a-input-number
|
|
||||||
:min="0"
|
|
||||||
:max="9999"
|
|
||||||
class="ele-fluid"
|
|
||||||
placeholder="请输入排序号"
|
|
||||||
v-model:value="form.sortNumber"
|
|
||||||
/>
|
|
||||||
</a-form-item>
|
|
||||||
<a-form-item label="备注" name="comments">
|
|
||||||
<a-textarea
|
|
||||||
:rows="4"
|
|
||||||
:maxlength="200"
|
|
||||||
placeholder="请输入描述"
|
|
||||||
v-model:value="form.comments"
|
|
||||||
/>
|
|
||||||
</a-form-item>
|
|
||||||
<a-form-item label="状态, 0正常, 1冻结" name="status">
|
|
||||||
<a-radio-group v-model:value="form.status">
|
|
||||||
<a-radio :value="0">显示</a-radio>
|
|
||||||
<a-radio :value="1">隐藏</a-radio>
|
|
||||||
</a-radio-group>
|
|
||||||
</a-form-item>
|
|
||||||
</a-form>
|
|
||||||
</ele-modal>
|
|
||||||
</template>
|
|
||||||
|
|
||||||
<script lang="ts" setup>
|
|
||||||
import { ref, reactive, watch } from 'vue';
|
|
||||||
import { Form, message } from 'ant-design-vue';
|
|
||||||
import { assignObject, uuid } from 'ele-admin-pro';
|
|
||||||
import { addCmsComponents, updateCmsComponents } from '@/api/cms/cmsComponents';
|
|
||||||
import { CmsComponents } from '@/api/cms/cmsComponents/model';
|
|
||||||
import { useThemeStore } from '@/store/modules/theme';
|
|
||||||
import { storeToRefs } from 'pinia';
|
|
||||||
import { ItemType } from 'ele-admin-pro/es/ele-image-upload/types';
|
|
||||||
import { FormInstance } from 'ant-design-vue/es/form';
|
|
||||||
import { FileRecord } from '@/api/system/file/model';
|
|
||||||
|
|
||||||
// 是否是修改
|
|
||||||
const isUpdate = ref(false);
|
|
||||||
const useForm = Form.useForm;
|
|
||||||
// 是否开启响应式布局
|
|
||||||
const themeStore = useThemeStore();
|
|
||||||
const { styleResponsive } = storeToRefs(themeStore);
|
|
||||||
|
|
||||||
const props = defineProps<{
|
|
||||||
// 弹窗是否打开
|
|
||||||
visible: boolean;
|
|
||||||
// 修改回显的数据
|
|
||||||
data?: CmsComponents | null;
|
|
||||||
}>();
|
|
||||||
|
|
||||||
const emit = defineEmits<{
|
|
||||||
(e: 'done'): void;
|
|
||||||
(e: 'update:visible', visible: boolean): void;
|
|
||||||
}>();
|
|
||||||
|
|
||||||
// 提交状态
|
|
||||||
const loading = ref(false);
|
|
||||||
// 是否显示最大化切换按钮
|
|
||||||
const maxable = ref(true);
|
|
||||||
// 表格选中数据
|
|
||||||
const formRef = ref<FormInstance | null>(null);
|
|
||||||
const images = ref<ItemType[]>([]);
|
|
||||||
|
|
||||||
// 用户信息
|
|
||||||
const form = reactive<CmsComponents>({
|
|
||||||
id: undefined,
|
|
||||||
title: undefined,
|
|
||||||
navigationId: undefined,
|
|
||||||
type: undefined,
|
|
||||||
keywords: undefined,
|
|
||||||
description: undefined,
|
|
||||||
path: undefined,
|
|
||||||
icon: undefined,
|
|
||||||
userId: undefined,
|
|
||||||
sortNumber: undefined,
|
|
||||||
comments: undefined,
|
|
||||||
status: undefined,
|
|
||||||
tenantId: undefined,
|
|
||||||
createTime: undefined,
|
|
||||||
cmsComponentsId: undefined,
|
|
||||||
cmsComponentsName: '',
|
|
||||||
status: 0,
|
|
||||||
comments: '',
|
|
||||||
sortNumber: 100
|
|
||||||
});
|
|
||||||
|
|
||||||
/* 更新visible */
|
|
||||||
const updateVisible = (value: boolean) => {
|
|
||||||
emit('update:visible', value);
|
|
||||||
};
|
|
||||||
|
|
||||||
// 表单验证规则
|
|
||||||
const rules = reactive({
|
|
||||||
cmsComponentsName: [
|
|
||||||
{
|
|
||||||
required: true,
|
|
||||||
type: 'string',
|
|
||||||
message: '请填写组件名称',
|
|
||||||
trigger: 'blur'
|
|
||||||
}
|
|
||||||
]
|
|
||||||
});
|
|
||||||
|
|
||||||
const chooseImage = (data: FileRecord) => {
|
|
||||||
images.value.push({
|
|
||||||
uid: data.id,
|
|
||||||
url: data.path,
|
|
||||||
status: 'done'
|
|
||||||
});
|
|
||||||
form.image = data.path;
|
|
||||||
};
|
|
||||||
|
|
||||||
const onDeleteItem = (index: number) => {
|
|
||||||
images.value.splice(index, 1);
|
|
||||||
form.image = '';
|
|
||||||
};
|
|
||||||
|
|
||||||
const { resetFields } = useForm(form, rules);
|
|
||||||
|
|
||||||
/* 保存编辑 */
|
|
||||||
const save = () => {
|
|
||||||
if (!formRef.value) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
formRef.value
|
|
||||||
.validate()
|
|
||||||
.then(() => {
|
|
||||||
loading.value = true;
|
|
||||||
const formData = {
|
|
||||||
...form
|
|
||||||
};
|
|
||||||
const saveOrUpdate = isUpdate.value ? updateCmsComponents : addCmsComponents;
|
|
||||||
saveOrUpdate(formData)
|
|
||||||
.then((msg) => {
|
|
||||||
loading.value = false;
|
|
||||||
message.success(msg);
|
|
||||||
updateVisible(false);
|
|
||||||
emit('done');
|
|
||||||
})
|
|
||||||
.catch((e) => {
|
|
||||||
loading.value = false;
|
|
||||||
message.error(e.message);
|
|
||||||
});
|
|
||||||
})
|
|
||||||
.catch(() => {});
|
|
||||||
};
|
|
||||||
|
|
||||||
watch(
|
|
||||||
() => props.visible,
|
|
||||||
(visible) => {
|
|
||||||
if (visible) {
|
|
||||||
images.value = [];
|
|
||||||
if (props.data) {
|
|
||||||
assignObject(form, props.data);
|
|
||||||
if(props.data.image){
|
|
||||||
images.value.push({
|
|
||||||
uid: uuid(),
|
|
||||||
url: props.data.image,
|
|
||||||
status: 'done'
|
|
||||||
})
|
|
||||||
}
|
|
||||||
isUpdate.value = true;
|
|
||||||
} else {
|
|
||||||
isUpdate.value = false;
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
resetFields();
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{ immediate: true }
|
|
||||||
);
|
|
||||||
</script>
|
|
||||||
@@ -1,42 +0,0 @@
|
|||||||
<!-- 搜索表单 -->
|
|
||||||
<template>
|
|
||||||
<a-space :size="10" style="flex-wrap: wrap">
|
|
||||||
<a-button type="primary" class="ele-btn-icon" @click="add">
|
|
||||||
<template #icon>
|
|
||||||
<PlusOutlined />
|
|
||||||
</template>
|
|
||||||
<span>添加</span>
|
|
||||||
</a-button>
|
|
||||||
</a-space>
|
|
||||||
</template>
|
|
||||||
|
|
||||||
<script lang="ts" setup>
|
|
||||||
import { PlusOutlined } from '@ant-design/icons-vue';
|
|
||||||
import type { GradeParam } from '@/api/user/grade/model';
|
|
||||||
import { watch } from 'vue';
|
|
||||||
|
|
||||||
const props = withDefaults(
|
|
||||||
defineProps<{
|
|
||||||
// 选中的角色
|
|
||||||
selection?: [];
|
|
||||||
}>(),
|
|
||||||
{}
|
|
||||||
);
|
|
||||||
|
|
||||||
const emit = defineEmits<{
|
|
||||||
(e: 'search', where?: GradeParam): void;
|
|
||||||
(e: 'add'): void;
|
|
||||||
(e: 'remove'): void;
|
|
||||||
(e: 'batchMove'): void;
|
|
||||||
}>();
|
|
||||||
|
|
||||||
// 新增
|
|
||||||
const add = () => {
|
|
||||||
emit('add');
|
|
||||||
};
|
|
||||||
|
|
||||||
watch(
|
|
||||||
() => props.selection,
|
|
||||||
() => {}
|
|
||||||
);
|
|
||||||
</script>
|
|
||||||
@@ -1,281 +0,0 @@
|
|||||||
<template>
|
|
||||||
<div class="page">
|
|
||||||
<div class="ele-body">
|
|
||||||
<a-card :bordered="false" :body-style="{ padding: '16px' }">
|
|
||||||
<ele-pro-table
|
|
||||||
ref="tableRef"
|
|
||||||
row-key="cmsComponentsId"
|
|
||||||
:columns="columns"
|
|
||||||
:datasource="datasource"
|
|
||||||
:customRow="customRow"
|
|
||||||
tool-class="ele-toolbar-form"
|
|
||||||
class="sys-org-table"
|
|
||||||
>
|
|
||||||
<template #toolbar>
|
|
||||||
<search
|
|
||||||
@search="reload"
|
|
||||||
:selection="selection"
|
|
||||||
@add="openEdit"
|
|
||||||
@remove="removeBatch"
|
|
||||||
@batchMove="openMove"
|
|
||||||
/>
|
|
||||||
</template>
|
|
||||||
<template #bodyCell="{ column, record }">
|
|
||||||
<template v-if="column.key === 'image'">
|
|
||||||
<a-image :src="record.image" :width="50" />
|
|
||||||
</template>
|
|
||||||
<template v-if="column.key === 'status'">
|
|
||||||
<a-tag v-if="record.status === 0" color="green">显示</a-tag>
|
|
||||||
<a-tag v-if="record.status === 1" color="red">隐藏</a-tag>
|
|
||||||
</template>
|
|
||||||
<template v-if="column.key === 'action'">
|
|
||||||
<a-space>
|
|
||||||
<a @click="openEdit(record)">修改</a>
|
|
||||||
<a-divider type="vertical" />
|
|
||||||
<a-popconfirm
|
|
||||||
title="确定要删除此记录吗?"
|
|
||||||
@confirm="remove(record)"
|
|
||||||
>
|
|
||||||
<a class="ele-text-danger">删除</a>
|
|
||||||
</a-popconfirm>
|
|
||||||
</a-space>
|
|
||||||
</template>
|
|
||||||
</template>
|
|
||||||
</ele-pro-table>
|
|
||||||
</a-card>
|
|
||||||
|
|
||||||
<!-- 编辑弹窗 -->
|
|
||||||
<CmsComponentsEdit v-model:visible="showEdit" :data="current" @done="reload" />
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</template>
|
|
||||||
|
|
||||||
<script lang="ts" setup>
|
|
||||||
import { createVNode, ref } from 'vue';
|
|
||||||
import { message, Modal } from 'ant-design-vue';
|
|
||||||
import { ExclamationCircleOutlined } from '@ant-design/icons-vue';
|
|
||||||
import type { EleProTable } from 'ele-admin-pro';
|
|
||||||
import { toDateString } from 'ele-admin-pro';
|
|
||||||
import type {
|
|
||||||
DatasourceFunction,
|
|
||||||
ColumnItem
|
|
||||||
} from 'ele-admin-pro/es/ele-pro-table/types';
|
|
||||||
import Search from './components/search.vue';
|
|
||||||
import CmsComponentsEdit from './components/cmsComponentsEdit.vue';
|
|
||||||
import { pageCmsComponents, removeCmsComponents, removeBatchCmsComponents } from '@/api/cms/cmsComponents';
|
|
||||||
import type { CmsComponents, CmsComponentsParam } from '@/api/cms/cmsComponents/model';
|
|
||||||
|
|
||||||
// 表格实例
|
|
||||||
const tableRef = ref<InstanceType<typeof EleProTable> | null>(null);
|
|
||||||
|
|
||||||
// 表格选中数据
|
|
||||||
const selection = ref<CmsComponents[]>([]);
|
|
||||||
// 当前编辑数据
|
|
||||||
const current = ref<CmsComponents | null>(null);
|
|
||||||
// 是否显示编辑弹窗
|
|
||||||
const showEdit = ref(false);
|
|
||||||
// 是否显示批量移动弹窗
|
|
||||||
const showMove = ref(false);
|
|
||||||
// 加载状态
|
|
||||||
const loading = ref(true);
|
|
||||||
|
|
||||||
// 表格数据源
|
|
||||||
const datasource: DatasourceFunction = ({
|
|
||||||
page,
|
|
||||||
limit,
|
|
||||||
where,
|
|
||||||
orders,
|
|
||||||
filters
|
|
||||||
}) => {
|
|
||||||
if (filters) {
|
|
||||||
where.status = filters.status;
|
|
||||||
}
|
|
||||||
return pageCmsComponents({
|
|
||||||
...where,
|
|
||||||
...orders,
|
|
||||||
page,
|
|
||||||
limit
|
|
||||||
});
|
|
||||||
};
|
|
||||||
|
|
||||||
// 表格列配置
|
|
||||||
const columns = ref<ColumnItem[]>([
|
|
||||||
{
|
|
||||||
title: 'ID',
|
|
||||||
dataIndex: 'id',
|
|
||||||
key: 'id',
|
|
||||||
align: 'center',
|
|
||||||
width: 90,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
title: '组件标题',
|
|
||||||
dataIndex: 'title',
|
|
||||||
key: 'title',
|
|
||||||
align: 'center',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
title: '关联导航ID',
|
|
||||||
dataIndex: 'navigationId',
|
|
||||||
key: 'navigationId',
|
|
||||||
align: 'center',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
title: '组件类型',
|
|
||||||
dataIndex: 'type',
|
|
||||||
key: 'type',
|
|
||||||
align: 'center',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
title: '页面关键词',
|
|
||||||
dataIndex: 'keywords',
|
|
||||||
key: 'keywords',
|
|
||||||
align: 'center',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
title: '页面描述',
|
|
||||||
dataIndex: 'description',
|
|
||||||
key: 'description',
|
|
||||||
align: 'center',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
title: '组件路径',
|
|
||||||
dataIndex: 'path',
|
|
||||||
key: 'path',
|
|
||||||
align: 'center',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
title: '组件图标',
|
|
||||||
dataIndex: 'icon',
|
|
||||||
key: 'icon',
|
|
||||||
align: 'center',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
title: '用户ID',
|
|
||||||
dataIndex: 'userId',
|
|
||||||
key: 'userId',
|
|
||||||
align: 'center',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
title: '排序(数字越小越靠前)',
|
|
||||||
dataIndex: 'sortNumber',
|
|
||||||
key: 'sortNumber',
|
|
||||||
align: 'center',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
title: '备注',
|
|
||||||
dataIndex: 'comments',
|
|
||||||
key: 'comments',
|
|
||||||
align: 'center',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
title: '状态, 0正常, 1冻结',
|
|
||||||
dataIndex: 'status',
|
|
||||||
key: 'status',
|
|
||||||
align: 'center',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
title: '创建时间',
|
|
||||||
dataIndex: 'createTime',
|
|
||||||
key: 'createTime',
|
|
||||||
align: 'center',
|
|
||||||
sorter: true,
|
|
||||||
ellipsis: true,
|
|
||||||
customRender: ({ text }) => toDateString(text, 'yyyy-MM-dd')
|
|
||||||
},
|
|
||||||
{
|
|
||||||
title: '操作',
|
|
||||||
key: 'action',
|
|
||||||
width: 180,
|
|
||||||
fixed: 'right',
|
|
||||||
align: 'center',
|
|
||||||
hideInSetting: true
|
|
||||||
}
|
|
||||||
]);
|
|
||||||
|
|
||||||
/* 搜索 */
|
|
||||||
const reload = (where?: CmsComponentsParam) => {
|
|
||||||
selection.value = [];
|
|
||||||
tableRef?.value?.reload({ where: where });
|
|
||||||
};
|
|
||||||
|
|
||||||
/* 打开编辑弹窗 */
|
|
||||||
const openEdit = (row?: CmsComponents) => {
|
|
||||||
current.value = row ?? null;
|
|
||||||
showEdit.value = true;
|
|
||||||
};
|
|
||||||
|
|
||||||
/* 打开批量移动弹窗 */
|
|
||||||
const openMove = () => {
|
|
||||||
showMove.value = true;
|
|
||||||
};
|
|
||||||
|
|
||||||
/* 删除单个 */
|
|
||||||
const remove = (row: CmsComponents) => {
|
|
||||||
const hide = message.loading('请求中..', 0);
|
|
||||||
removeCmsComponents(row.cmsComponentsId)
|
|
||||||
.then((msg) => {
|
|
||||||
hide();
|
|
||||||
message.success(msg);
|
|
||||||
reload();
|
|
||||||
})
|
|
||||||
.catch((e) => {
|
|
||||||
hide();
|
|
||||||
message.error(e.message);
|
|
||||||
});
|
|
||||||
};
|
|
||||||
|
|
||||||
/* 批量删除 */
|
|
||||||
const removeBatch = () => {
|
|
||||||
if (!selection.value.length) {
|
|
||||||
message.error('请至少选择一条数据');
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
Modal.confirm({
|
|
||||||
title: '提示',
|
|
||||||
content: '确定要删除选中的记录吗?',
|
|
||||||
icon: createVNode(ExclamationCircleOutlined),
|
|
||||||
maskClosable: true,
|
|
||||||
onOk: () => {
|
|
||||||
const hide = message.loading('请求中..', 0);
|
|
||||||
removeBatchCmsComponents(selection.value.map((d) => d.cmsComponentsId))
|
|
||||||
.then((msg) => {
|
|
||||||
hide();
|
|
||||||
message.success(msg);
|
|
||||||
reload();
|
|
||||||
})
|
|
||||||
.catch((e) => {
|
|
||||||
hide();
|
|
||||||
message.error(e.message);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
});
|
|
||||||
};
|
|
||||||
|
|
||||||
/* 查询 */
|
|
||||||
const query = () => {
|
|
||||||
loading.value = true;
|
|
||||||
};
|
|
||||||
|
|
||||||
/* 自定义行属性 */
|
|
||||||
const customRow = (record: CmsComponents) => {
|
|
||||||
return {
|
|
||||||
// 行点击事件
|
|
||||||
onClick: () => {
|
|
||||||
// console.log(record);
|
|
||||||
},
|
|
||||||
// 行双击事件
|
|
||||||
onDblclick: () => {
|
|
||||||
openEdit(record);
|
|
||||||
}
|
|
||||||
};
|
|
||||||
};
|
|
||||||
query();
|
|
||||||
</script>
|
|
||||||
|
|
||||||
<script lang="ts">
|
|
||||||
export default {
|
|
||||||
name: 'CmsComponents'
|
|
||||||
};
|
|
||||||
</script>
|
|
||||||
|
|
||||||
<style lang="less" scoped></style>
|
|
||||||
@@ -1,240 +0,0 @@
|
|||||||
<!-- 编辑弹窗 -->
|
|
||||||
<template>
|
|
||||||
<ele-modal
|
|
||||||
:width="800"
|
|
||||||
:visible="visible"
|
|
||||||
:maskClosable="false"
|
|
||||||
:maxable="maxable"
|
|
||||||
:title="isUpdate ? '编辑设计征集' : '添加设计征集'"
|
|
||||||
:body-style="{ paddingBottom: '28px' }"
|
|
||||||
@update:visible="updateVisible"
|
|
||||||
@ok="save"
|
|
||||||
>
|
|
||||||
<a-form
|
|
||||||
ref="formRef"
|
|
||||||
:model="form"
|
|
||||||
:rules="rules"
|
|
||||||
:label-col="styleResponsive ? { md: 4, sm: 5, xs: 24 } : { flex: '90px' }"
|
|
||||||
:wrapper-col="
|
|
||||||
styleResponsive ? { md: 19, sm: 19, xs: 24 } : { flex: '1' }
|
|
||||||
"
|
|
||||||
>
|
|
||||||
<a-form-item label="" name="title">
|
|
||||||
<a-input
|
|
||||||
allow-clear
|
|
||||||
placeholder="请输入"
|
|
||||||
v-model:value="form.title"
|
|
||||||
/>
|
|
||||||
</a-form-item>
|
|
||||||
<a-form-item label="" name="content">
|
|
||||||
<a-input
|
|
||||||
allow-clear
|
|
||||||
placeholder="请输入"
|
|
||||||
v-model:value="form.content"
|
|
||||||
/>
|
|
||||||
</a-form-item>
|
|
||||||
<a-form-item
|
|
||||||
label=""
|
|
||||||
name="image">
|
|
||||||
<SelectFile
|
|
||||||
:placeholder="`请选择图片`"
|
|
||||||
:limit="1"
|
|
||||||
:data="images"
|
|
||||||
@done="chooseImage"
|
|
||||||
@del="onDeleteItem"
|
|
||||||
/>
|
|
||||||
</a-form-item>
|
|
||||||
<a-form-item label="用户ID" name="userId">
|
|
||||||
<a-input
|
|
||||||
allow-clear
|
|
||||||
placeholder="请输入用户ID"
|
|
||||||
v-model:value="form.userId"
|
|
||||||
/>
|
|
||||||
</a-form-item>
|
|
||||||
<a-form-item label="排序(数字越小越靠前)" name="sortNumber">
|
|
||||||
<a-input-number
|
|
||||||
:min="0"
|
|
||||||
:max="9999"
|
|
||||||
class="ele-fluid"
|
|
||||||
placeholder="请输入排序号"
|
|
||||||
v-model:value="form.sortNumber"
|
|
||||||
/>
|
|
||||||
</a-form-item>
|
|
||||||
<a-form-item label="备注" name="comments">
|
|
||||||
<a-textarea
|
|
||||||
:rows="4"
|
|
||||||
:maxlength="200"
|
|
||||||
placeholder="请输入描述"
|
|
||||||
v-model:value="form.comments"
|
|
||||||
/>
|
|
||||||
</a-form-item>
|
|
||||||
<a-form-item label="状态, 0已发布, 1待审核 2已驳回 3违规内容" name="status">
|
|
||||||
<a-radio-group v-model:value="form.status">
|
|
||||||
<a-radio :value="0">显示</a-radio>
|
|
||||||
<a-radio :value="1">隐藏</a-radio>
|
|
||||||
</a-radio-group>
|
|
||||||
</a-form-item>
|
|
||||||
<a-form-item label="是否删除, 0否, 1是" name="deleted">
|
|
||||||
<a-input
|
|
||||||
allow-clear
|
|
||||||
placeholder="请输入是否删除, 0否, 1是"
|
|
||||||
v-model:value="form.deleted"
|
|
||||||
/>
|
|
||||||
</a-form-item>
|
|
||||||
<a-form-item label="修改时间" name="updateTime">
|
|
||||||
<a-input
|
|
||||||
allow-clear
|
|
||||||
placeholder="请输入修改时间"
|
|
||||||
v-model:value="form.updateTime"
|
|
||||||
/>
|
|
||||||
</a-form-item>
|
|
||||||
</a-form>
|
|
||||||
</ele-modal>
|
|
||||||
</template>
|
|
||||||
|
|
||||||
<script lang="ts" setup>
|
|
||||||
import { ref, reactive, watch } from 'vue';
|
|
||||||
import { Form, message } from 'ant-design-vue';
|
|
||||||
import { assignObject, uuid } from 'ele-admin-pro';
|
|
||||||
import { addCmsDesignCollect, updateCmsDesignCollect } from '@/api/cms/cmsDesignCollect';
|
|
||||||
import { CmsDesignCollect } from '@/api/cms/cmsDesignCollect/model';
|
|
||||||
import { useThemeStore } from '@/store/modules/theme';
|
|
||||||
import { storeToRefs } from 'pinia';
|
|
||||||
import { ItemType } from 'ele-admin-pro/es/ele-image-upload/types';
|
|
||||||
import { FormInstance } from 'ant-design-vue/es/form';
|
|
||||||
import { FileRecord } from '@/api/system/file/model';
|
|
||||||
|
|
||||||
// 是否是修改
|
|
||||||
const isUpdate = ref(false);
|
|
||||||
const useForm = Form.useForm;
|
|
||||||
// 是否开启响应式布局
|
|
||||||
const themeStore = useThemeStore();
|
|
||||||
const { styleResponsive } = storeToRefs(themeStore);
|
|
||||||
|
|
||||||
const props = defineProps<{
|
|
||||||
// 弹窗是否打开
|
|
||||||
visible: boolean;
|
|
||||||
// 修改回显的数据
|
|
||||||
data?: CmsDesignCollect | null;
|
|
||||||
}>();
|
|
||||||
|
|
||||||
const emit = defineEmits<{
|
|
||||||
(e: 'done'): void;
|
|
||||||
(e: 'update:visible', visible: boolean): void;
|
|
||||||
}>();
|
|
||||||
|
|
||||||
// 提交状态
|
|
||||||
const loading = ref(false);
|
|
||||||
// 是否显示最大化切换按钮
|
|
||||||
const maxable = ref(true);
|
|
||||||
// 表格选中数据
|
|
||||||
const formRef = ref<FormInstance | null>(null);
|
|
||||||
const images = ref<ItemType[]>([]);
|
|
||||||
|
|
||||||
// 用户信息
|
|
||||||
const form = reactive<CmsDesignCollect>({
|
|
||||||
id: undefined,
|
|
||||||
title: undefined,
|
|
||||||
content: undefined,
|
|
||||||
image: undefined,
|
|
||||||
userId: undefined,
|
|
||||||
sortNumber: undefined,
|
|
||||||
comments: undefined,
|
|
||||||
status: undefined,
|
|
||||||
deleted: undefined,
|
|
||||||
tenantId: undefined,
|
|
||||||
createTime: undefined,
|
|
||||||
updateTime: undefined,
|
|
||||||
cmsDesignCollectId: undefined,
|
|
||||||
cmsDesignCollectName: '',
|
|
||||||
status: 0,
|
|
||||||
comments: '',
|
|
||||||
sortNumber: 100
|
|
||||||
});
|
|
||||||
|
|
||||||
/* 更新visible */
|
|
||||||
const updateVisible = (value: boolean) => {
|
|
||||||
emit('update:visible', value);
|
|
||||||
};
|
|
||||||
|
|
||||||
// 表单验证规则
|
|
||||||
const rules = reactive({
|
|
||||||
cmsDesignCollectName: [
|
|
||||||
{
|
|
||||||
required: true,
|
|
||||||
type: 'string',
|
|
||||||
message: '请填写设计征集名称',
|
|
||||||
trigger: 'blur'
|
|
||||||
}
|
|
||||||
]
|
|
||||||
});
|
|
||||||
|
|
||||||
const chooseImage = (data: FileRecord) => {
|
|
||||||
images.value.push({
|
|
||||||
uid: data.id,
|
|
||||||
url: data.path,
|
|
||||||
status: 'done'
|
|
||||||
});
|
|
||||||
form.image = data.path;
|
|
||||||
};
|
|
||||||
|
|
||||||
const onDeleteItem = (index: number) => {
|
|
||||||
images.value.splice(index, 1);
|
|
||||||
form.image = '';
|
|
||||||
};
|
|
||||||
|
|
||||||
const { resetFields } = useForm(form, rules);
|
|
||||||
|
|
||||||
/* 保存编辑 */
|
|
||||||
const save = () => {
|
|
||||||
if (!formRef.value) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
formRef.value
|
|
||||||
.validate()
|
|
||||||
.then(() => {
|
|
||||||
loading.value = true;
|
|
||||||
const formData = {
|
|
||||||
...form
|
|
||||||
};
|
|
||||||
const saveOrUpdate = isUpdate.value ? updateCmsDesignCollect : addCmsDesignCollect;
|
|
||||||
saveOrUpdate(formData)
|
|
||||||
.then((msg) => {
|
|
||||||
loading.value = false;
|
|
||||||
message.success(msg);
|
|
||||||
updateVisible(false);
|
|
||||||
emit('done');
|
|
||||||
})
|
|
||||||
.catch((e) => {
|
|
||||||
loading.value = false;
|
|
||||||
message.error(e.message);
|
|
||||||
});
|
|
||||||
})
|
|
||||||
.catch(() => {});
|
|
||||||
};
|
|
||||||
|
|
||||||
watch(
|
|
||||||
() => props.visible,
|
|
||||||
(visible) => {
|
|
||||||
if (visible) {
|
|
||||||
images.value = [];
|
|
||||||
if (props.data) {
|
|
||||||
assignObject(form, props.data);
|
|
||||||
if(props.data.image){
|
|
||||||
images.value.push({
|
|
||||||
uid: uuid(),
|
|
||||||
url: props.data.image,
|
|
||||||
status: 'done'
|
|
||||||
})
|
|
||||||
}
|
|
||||||
isUpdate.value = true;
|
|
||||||
} else {
|
|
||||||
isUpdate.value = false;
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
resetFields();
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{ immediate: true }
|
|
||||||
);
|
|
||||||
</script>
|
|
||||||
@@ -1,42 +0,0 @@
|
|||||||
<!-- 搜索表单 -->
|
|
||||||
<template>
|
|
||||||
<a-space :size="10" style="flex-wrap: wrap">
|
|
||||||
<a-button type="primary" class="ele-btn-icon" @click="add">
|
|
||||||
<template #icon>
|
|
||||||
<PlusOutlined />
|
|
||||||
</template>
|
|
||||||
<span>添加</span>
|
|
||||||
</a-button>
|
|
||||||
</a-space>
|
|
||||||
</template>
|
|
||||||
|
|
||||||
<script lang="ts" setup>
|
|
||||||
import { PlusOutlined } from '@ant-design/icons-vue';
|
|
||||||
import type { GradeParam } from '@/api/user/grade/model';
|
|
||||||
import { watch } from 'vue';
|
|
||||||
|
|
||||||
const props = withDefaults(
|
|
||||||
defineProps<{
|
|
||||||
// 选中的角色
|
|
||||||
selection?: [];
|
|
||||||
}>(),
|
|
||||||
{}
|
|
||||||
);
|
|
||||||
|
|
||||||
const emit = defineEmits<{
|
|
||||||
(e: 'search', where?: GradeParam): void;
|
|
||||||
(e: 'add'): void;
|
|
||||||
(e: 'remove'): void;
|
|
||||||
(e: 'batchMove'): void;
|
|
||||||
}>();
|
|
||||||
|
|
||||||
// 新增
|
|
||||||
const add = () => {
|
|
||||||
emit('add');
|
|
||||||
};
|
|
||||||
|
|
||||||
watch(
|
|
||||||
() => props.selection,
|
|
||||||
() => {}
|
|
||||||
);
|
|
||||||
</script>
|
|
||||||
@@ -1,269 +0,0 @@
|
|||||||
<template>
|
|
||||||
<div class="page">
|
|
||||||
<div class="ele-body">
|
|
||||||
<a-card :bordered="false" :body-style="{ padding: '16px' }">
|
|
||||||
<ele-pro-table
|
|
||||||
ref="tableRef"
|
|
||||||
row-key="cmsDesignCollectId"
|
|
||||||
:columns="columns"
|
|
||||||
:datasource="datasource"
|
|
||||||
:customRow="customRow"
|
|
||||||
tool-class="ele-toolbar-form"
|
|
||||||
class="sys-org-table"
|
|
||||||
>
|
|
||||||
<template #toolbar>
|
|
||||||
<search
|
|
||||||
@search="reload"
|
|
||||||
:selection="selection"
|
|
||||||
@add="openEdit"
|
|
||||||
@remove="removeBatch"
|
|
||||||
@batchMove="openMove"
|
|
||||||
/>
|
|
||||||
</template>
|
|
||||||
<template #bodyCell="{ column, record }">
|
|
||||||
<template v-if="column.key === 'image'">
|
|
||||||
<a-image :src="record.image" :width="50" />
|
|
||||||
</template>
|
|
||||||
<template v-if="column.key === 'status'">
|
|
||||||
<a-tag v-if="record.status === 0" color="green">显示</a-tag>
|
|
||||||
<a-tag v-if="record.status === 1" color="red">隐藏</a-tag>
|
|
||||||
</template>
|
|
||||||
<template v-if="column.key === 'action'">
|
|
||||||
<a-space>
|
|
||||||
<a @click="openEdit(record)">修改</a>
|
|
||||||
<a-divider type="vertical" />
|
|
||||||
<a-popconfirm
|
|
||||||
title="确定要删除此记录吗?"
|
|
||||||
@confirm="remove(record)"
|
|
||||||
>
|
|
||||||
<a class="ele-text-danger">删除</a>
|
|
||||||
</a-popconfirm>
|
|
||||||
</a-space>
|
|
||||||
</template>
|
|
||||||
</template>
|
|
||||||
</ele-pro-table>
|
|
||||||
</a-card>
|
|
||||||
|
|
||||||
<!-- 编辑弹窗 -->
|
|
||||||
<CmsDesignCollectEdit v-model:visible="showEdit" :data="current" @done="reload" />
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</template>
|
|
||||||
|
|
||||||
<script lang="ts" setup>
|
|
||||||
import { createVNode, ref } from 'vue';
|
|
||||||
import { message, Modal } from 'ant-design-vue';
|
|
||||||
import { ExclamationCircleOutlined } from '@ant-design/icons-vue';
|
|
||||||
import type { EleProTable } from 'ele-admin-pro';
|
|
||||||
import { toDateString } from 'ele-admin-pro';
|
|
||||||
import type {
|
|
||||||
DatasourceFunction,
|
|
||||||
ColumnItem
|
|
||||||
} from 'ele-admin-pro/es/ele-pro-table/types';
|
|
||||||
import Search from './components/search.vue';
|
|
||||||
import CmsDesignCollectEdit from './components/cmsDesignCollectEdit.vue';
|
|
||||||
import { pageCmsDesignCollect, removeCmsDesignCollect, removeBatchCmsDesignCollect } from '@/api/cms/cmsDesignCollect';
|
|
||||||
import type { CmsDesignCollect, CmsDesignCollectParam } from '@/api/cms/cmsDesignCollect/model';
|
|
||||||
|
|
||||||
// 表格实例
|
|
||||||
const tableRef = ref<InstanceType<typeof EleProTable> | null>(null);
|
|
||||||
|
|
||||||
// 表格选中数据
|
|
||||||
const selection = ref<CmsDesignCollect[]>([]);
|
|
||||||
// 当前编辑数据
|
|
||||||
const current = ref<CmsDesignCollect | null>(null);
|
|
||||||
// 是否显示编辑弹窗
|
|
||||||
const showEdit = ref(false);
|
|
||||||
// 是否显示批量移动弹窗
|
|
||||||
const showMove = ref(false);
|
|
||||||
// 加载状态
|
|
||||||
const loading = ref(true);
|
|
||||||
|
|
||||||
// 表格数据源
|
|
||||||
const datasource: DatasourceFunction = ({
|
|
||||||
page,
|
|
||||||
limit,
|
|
||||||
where,
|
|
||||||
orders,
|
|
||||||
filters
|
|
||||||
}) => {
|
|
||||||
if (filters) {
|
|
||||||
where.status = filters.status;
|
|
||||||
}
|
|
||||||
return pageCmsDesignCollect({
|
|
||||||
...where,
|
|
||||||
...orders,
|
|
||||||
page,
|
|
||||||
limit
|
|
||||||
});
|
|
||||||
};
|
|
||||||
|
|
||||||
// 表格列配置
|
|
||||||
const columns = ref<ColumnItem[]>([
|
|
||||||
{
|
|
||||||
title: '',
|
|
||||||
dataIndex: 'id',
|
|
||||||
key: 'id',
|
|
||||||
align: 'center',
|
|
||||||
width: 90,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
title: '',
|
|
||||||
dataIndex: 'title',
|
|
||||||
key: 'title',
|
|
||||||
align: 'center',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
title: '',
|
|
||||||
dataIndex: 'content',
|
|
||||||
key: 'content',
|
|
||||||
align: 'center',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
title: '',
|
|
||||||
dataIndex: 'image',
|
|
||||||
key: 'image',
|
|
||||||
align: 'center',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
title: '用户ID',
|
|
||||||
dataIndex: 'userId',
|
|
||||||
key: 'userId',
|
|
||||||
align: 'center',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
title: '排序(数字越小越靠前)',
|
|
||||||
dataIndex: 'sortNumber',
|
|
||||||
key: 'sortNumber',
|
|
||||||
align: 'center',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
title: '备注',
|
|
||||||
dataIndex: 'comments',
|
|
||||||
key: 'comments',
|
|
||||||
align: 'center',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
title: '状态, 0已发布, 1待审核 2已驳回 3违规内容',
|
|
||||||
dataIndex: 'status',
|
|
||||||
key: 'status',
|
|
||||||
align: 'center',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
title: '是否删除, 0否, 1是',
|
|
||||||
dataIndex: 'deleted',
|
|
||||||
key: 'deleted',
|
|
||||||
align: 'center',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
title: '创建时间',
|
|
||||||
dataIndex: 'createTime',
|
|
||||||
key: 'createTime',
|
|
||||||
align: 'center',
|
|
||||||
sorter: true,
|
|
||||||
ellipsis: true,
|
|
||||||
customRender: ({ text }) => toDateString(text, 'yyyy-MM-dd')
|
|
||||||
},
|
|
||||||
{
|
|
||||||
title: '修改时间',
|
|
||||||
dataIndex: 'updateTime',
|
|
||||||
key: 'updateTime',
|
|
||||||
align: 'center',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
title: '操作',
|
|
||||||
key: 'action',
|
|
||||||
width: 180,
|
|
||||||
fixed: 'right',
|
|
||||||
align: 'center',
|
|
||||||
hideInSetting: true
|
|
||||||
}
|
|
||||||
]);
|
|
||||||
|
|
||||||
/* 搜索 */
|
|
||||||
const reload = (where?: CmsDesignCollectParam) => {
|
|
||||||
selection.value = [];
|
|
||||||
tableRef?.value?.reload({ where: where });
|
|
||||||
};
|
|
||||||
|
|
||||||
/* 打开编辑弹窗 */
|
|
||||||
const openEdit = (row?: CmsDesignCollect) => {
|
|
||||||
current.value = row ?? null;
|
|
||||||
showEdit.value = true;
|
|
||||||
};
|
|
||||||
|
|
||||||
/* 打开批量移动弹窗 */
|
|
||||||
const openMove = () => {
|
|
||||||
showMove.value = true;
|
|
||||||
};
|
|
||||||
|
|
||||||
/* 删除单个 */
|
|
||||||
const remove = (row: CmsDesignCollect) => {
|
|
||||||
const hide = message.loading('请求中..', 0);
|
|
||||||
removeCmsDesignCollect(row.cmsDesignCollectId)
|
|
||||||
.then((msg) => {
|
|
||||||
hide();
|
|
||||||
message.success(msg);
|
|
||||||
reload();
|
|
||||||
})
|
|
||||||
.catch((e) => {
|
|
||||||
hide();
|
|
||||||
message.error(e.message);
|
|
||||||
});
|
|
||||||
};
|
|
||||||
|
|
||||||
/* 批量删除 */
|
|
||||||
const removeBatch = () => {
|
|
||||||
if (!selection.value.length) {
|
|
||||||
message.error('请至少选择一条数据');
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
Modal.confirm({
|
|
||||||
title: '提示',
|
|
||||||
content: '确定要删除选中的记录吗?',
|
|
||||||
icon: createVNode(ExclamationCircleOutlined),
|
|
||||||
maskClosable: true,
|
|
||||||
onOk: () => {
|
|
||||||
const hide = message.loading('请求中..', 0);
|
|
||||||
removeBatchCmsDesignCollect(selection.value.map((d) => d.cmsDesignCollectId))
|
|
||||||
.then((msg) => {
|
|
||||||
hide();
|
|
||||||
message.success(msg);
|
|
||||||
reload();
|
|
||||||
})
|
|
||||||
.catch((e) => {
|
|
||||||
hide();
|
|
||||||
message.error(e.message);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
});
|
|
||||||
};
|
|
||||||
|
|
||||||
/* 查询 */
|
|
||||||
const query = () => {
|
|
||||||
loading.value = true;
|
|
||||||
};
|
|
||||||
|
|
||||||
/* 自定义行属性 */
|
|
||||||
const customRow = (record: CmsDesignCollect) => {
|
|
||||||
return {
|
|
||||||
// 行点击事件
|
|
||||||
onClick: () => {
|
|
||||||
// console.log(record);
|
|
||||||
},
|
|
||||||
// 行双击事件
|
|
||||||
onDblclick: () => {
|
|
||||||
openEdit(record);
|
|
||||||
}
|
|
||||||
};
|
|
||||||
};
|
|
||||||
query();
|
|
||||||
</script>
|
|
||||||
|
|
||||||
<script lang="ts">
|
|
||||||
export default {
|
|
||||||
name: 'CmsDesignCollect'
|
|
||||||
};
|
|
||||||
</script>
|
|
||||||
|
|
||||||
<style lang="less" scoped></style>
|
|
||||||
@@ -1,268 +0,0 @@
|
|||||||
<!-- 编辑弹窗 -->
|
|
||||||
<template>
|
|
||||||
<ele-modal
|
|
||||||
:width="800"
|
|
||||||
:visible="visible"
|
|
||||||
:maskClosable="false"
|
|
||||||
:maxable="maxable"
|
|
||||||
:title="isUpdate ? '编辑页面组件表' : '添加页面组件表'"
|
|
||||||
:body-style="{ paddingBottom: '28px' }"
|
|
||||||
@update:visible="updateVisible"
|
|
||||||
@ok="save"
|
|
||||||
>
|
|
||||||
<a-form
|
|
||||||
ref="formRef"
|
|
||||||
:model="form"
|
|
||||||
:rules="rules"
|
|
||||||
:label-col="styleResponsive ? { md: 4, sm: 5, xs: 24 } : { flex: '90px' }"
|
|
||||||
:wrapper-col="
|
|
||||||
styleResponsive ? { md: 19, sm: 19, xs: 24 } : { flex: '1' }
|
|
||||||
"
|
|
||||||
>
|
|
||||||
<a-form-item label="关联导航ID" name="navigationId">
|
|
||||||
<a-input
|
|
||||||
allow-clear
|
|
||||||
placeholder="请输入关联导航ID"
|
|
||||||
v-model:value="form.navigationId"
|
|
||||||
/>
|
|
||||||
</a-form-item>
|
|
||||||
<a-form-item label="组件" name="title">
|
|
||||||
<a-input
|
|
||||||
allow-clear
|
|
||||||
placeholder="请输入组件"
|
|
||||||
v-model:value="form.title"
|
|
||||||
/>
|
|
||||||
</a-form-item>
|
|
||||||
<a-form-item label="组件标识" name="dictCode">
|
|
||||||
<a-input
|
|
||||||
allow-clear
|
|
||||||
placeholder="请输入组件标识"
|
|
||||||
v-model:value="form.dictCode"
|
|
||||||
/>
|
|
||||||
</a-form-item>
|
|
||||||
<a-form-item label="组件样式" name="styles">
|
|
||||||
<a-input
|
|
||||||
allow-clear
|
|
||||||
placeholder="请输入组件样式"
|
|
||||||
v-model:value="form.styles"
|
|
||||||
/>
|
|
||||||
</a-form-item>
|
|
||||||
<a-form-item label="卡片阴影显示时机" name="shadow">
|
|
||||||
<a-input
|
|
||||||
allow-clear
|
|
||||||
placeholder="请输入卡片阴影显示时机"
|
|
||||||
v-model:value="form.shadow"
|
|
||||||
/>
|
|
||||||
</a-form-item>
|
|
||||||
<a-form-item label="页面关键词" name="keywords">
|
|
||||||
<a-input
|
|
||||||
allow-clear
|
|
||||||
placeholder="请输入页面关键词"
|
|
||||||
v-model:value="form.keywords"
|
|
||||||
/>
|
|
||||||
</a-form-item>
|
|
||||||
<a-form-item label="页面描述" name="description">
|
|
||||||
<a-input
|
|
||||||
allow-clear
|
|
||||||
placeholder="请输入页面描述"
|
|
||||||
v-model:value="form.description"
|
|
||||||
/>
|
|
||||||
</a-form-item>
|
|
||||||
<a-form-item label="页面路由地址" name="path">
|
|
||||||
<a-input
|
|
||||||
allow-clear
|
|
||||||
placeholder="请输入页面路由地址"
|
|
||||||
v-model:value="form.path"
|
|
||||||
/>
|
|
||||||
</a-form-item>
|
|
||||||
<a-form-item label="缩列图" name="photo">
|
|
||||||
<a-input
|
|
||||||
allow-clear
|
|
||||||
placeholder="请输入缩列图"
|
|
||||||
v-model:value="form.photo"
|
|
||||||
/>
|
|
||||||
</a-form-item>
|
|
||||||
<a-form-item label="用户ID" name="userId">
|
|
||||||
<a-input
|
|
||||||
allow-clear
|
|
||||||
placeholder="请输入用户ID"
|
|
||||||
v-model:value="form.userId"
|
|
||||||
/>
|
|
||||||
</a-form-item>
|
|
||||||
<a-form-item label="排序(数字越小越靠前)" name="sortNumber">
|
|
||||||
<a-input-number
|
|
||||||
:min="0"
|
|
||||||
:max="9999"
|
|
||||||
class="ele-fluid"
|
|
||||||
placeholder="请输入排序号"
|
|
||||||
v-model:value="form.sortNumber"
|
|
||||||
/>
|
|
||||||
</a-form-item>
|
|
||||||
<a-form-item label="备注" name="comments">
|
|
||||||
<a-textarea
|
|
||||||
:rows="4"
|
|
||||||
:maxlength="200"
|
|
||||||
placeholder="请输入描述"
|
|
||||||
v-model:value="form.comments"
|
|
||||||
/>
|
|
||||||
</a-form-item>
|
|
||||||
<a-form-item label="状态, 0正常, 1冻结" name="status">
|
|
||||||
<a-radio-group v-model:value="form.status">
|
|
||||||
<a-radio :value="0">显示</a-radio>
|
|
||||||
<a-radio :value="1">隐藏</a-radio>
|
|
||||||
</a-radio-group>
|
|
||||||
</a-form-item>
|
|
||||||
</a-form>
|
|
||||||
</ele-modal>
|
|
||||||
</template>
|
|
||||||
|
|
||||||
<script lang="ts" setup>
|
|
||||||
import { ref, reactive, watch } from 'vue';
|
|
||||||
import { Form, message } from 'ant-design-vue';
|
|
||||||
import { assignObject, uuid } from 'ele-admin-pro';
|
|
||||||
import { addCmsDesignRecord, updateCmsDesignRecord } from '@/api/cms/cmsDesignRecord';
|
|
||||||
import { CmsDesignRecord } from '@/api/cms/cmsDesignRecord/model';
|
|
||||||
import { useThemeStore } from '@/store/modules/theme';
|
|
||||||
import { storeToRefs } from 'pinia';
|
|
||||||
import { ItemType } from 'ele-admin-pro/es/ele-image-upload/types';
|
|
||||||
import { FormInstance } from 'ant-design-vue/es/form';
|
|
||||||
import { FileRecord } from '@/api/system/file/model';
|
|
||||||
|
|
||||||
// 是否是修改
|
|
||||||
const isUpdate = ref(false);
|
|
||||||
const useForm = Form.useForm;
|
|
||||||
// 是否开启响应式布局
|
|
||||||
const themeStore = useThemeStore();
|
|
||||||
const { styleResponsive } = storeToRefs(themeStore);
|
|
||||||
|
|
||||||
const props = defineProps<{
|
|
||||||
// 弹窗是否打开
|
|
||||||
visible: boolean;
|
|
||||||
// 修改回显的数据
|
|
||||||
data?: CmsDesignRecord | null;
|
|
||||||
}>();
|
|
||||||
|
|
||||||
const emit = defineEmits<{
|
|
||||||
(e: 'done'): void;
|
|
||||||
(e: 'update:visible', visible: boolean): void;
|
|
||||||
}>();
|
|
||||||
|
|
||||||
// 提交状态
|
|
||||||
const loading = ref(false);
|
|
||||||
// 是否显示最大化切换按钮
|
|
||||||
const maxable = ref(true);
|
|
||||||
// 表格选中数据
|
|
||||||
const formRef = ref<FormInstance | null>(null);
|
|
||||||
const images = ref<ItemType[]>([]);
|
|
||||||
|
|
||||||
// 用户信息
|
|
||||||
const form = reactive<CmsDesignRecord>({
|
|
||||||
id: undefined,
|
|
||||||
navigationId: undefined,
|
|
||||||
title: undefined,
|
|
||||||
dictCode: undefined,
|
|
||||||
styles: undefined,
|
|
||||||
shadow: undefined,
|
|
||||||
keywords: undefined,
|
|
||||||
description: undefined,
|
|
||||||
path: undefined,
|
|
||||||
photo: undefined,
|
|
||||||
userId: undefined,
|
|
||||||
sortNumber: undefined,
|
|
||||||
comments: undefined,
|
|
||||||
status: undefined,
|
|
||||||
tenantId: undefined,
|
|
||||||
createTime: undefined,
|
|
||||||
cmsDesignRecordId: undefined,
|
|
||||||
cmsDesignRecordName: '',
|
|
||||||
status: 0,
|
|
||||||
comments: '',
|
|
||||||
sortNumber: 100
|
|
||||||
});
|
|
||||||
|
|
||||||
/* 更新visible */
|
|
||||||
const updateVisible = (value: boolean) => {
|
|
||||||
emit('update:visible', value);
|
|
||||||
};
|
|
||||||
|
|
||||||
// 表单验证规则
|
|
||||||
const rules = reactive({
|
|
||||||
cmsDesignRecordName: [
|
|
||||||
{
|
|
||||||
required: true,
|
|
||||||
type: 'string',
|
|
||||||
message: '请填写页面组件表名称',
|
|
||||||
trigger: 'blur'
|
|
||||||
}
|
|
||||||
]
|
|
||||||
});
|
|
||||||
|
|
||||||
const chooseImage = (data: FileRecord) => {
|
|
||||||
images.value.push({
|
|
||||||
uid: data.id,
|
|
||||||
url: data.path,
|
|
||||||
status: 'done'
|
|
||||||
});
|
|
||||||
form.image = data.path;
|
|
||||||
};
|
|
||||||
|
|
||||||
const onDeleteItem = (index: number) => {
|
|
||||||
images.value.splice(index, 1);
|
|
||||||
form.image = '';
|
|
||||||
};
|
|
||||||
|
|
||||||
const { resetFields } = useForm(form, rules);
|
|
||||||
|
|
||||||
/* 保存编辑 */
|
|
||||||
const save = () => {
|
|
||||||
if (!formRef.value) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
formRef.value
|
|
||||||
.validate()
|
|
||||||
.then(() => {
|
|
||||||
loading.value = true;
|
|
||||||
const formData = {
|
|
||||||
...form
|
|
||||||
};
|
|
||||||
const saveOrUpdate = isUpdate.value ? updateCmsDesignRecord : addCmsDesignRecord;
|
|
||||||
saveOrUpdate(formData)
|
|
||||||
.then((msg) => {
|
|
||||||
loading.value = false;
|
|
||||||
message.success(msg);
|
|
||||||
updateVisible(false);
|
|
||||||
emit('done');
|
|
||||||
})
|
|
||||||
.catch((e) => {
|
|
||||||
loading.value = false;
|
|
||||||
message.error(e.message);
|
|
||||||
});
|
|
||||||
})
|
|
||||||
.catch(() => {});
|
|
||||||
};
|
|
||||||
|
|
||||||
watch(
|
|
||||||
() => props.visible,
|
|
||||||
(visible) => {
|
|
||||||
if (visible) {
|
|
||||||
images.value = [];
|
|
||||||
if (props.data) {
|
|
||||||
assignObject(form, props.data);
|
|
||||||
if(props.data.image){
|
|
||||||
images.value.push({
|
|
||||||
uid: uuid(),
|
|
||||||
url: props.data.image,
|
|
||||||
status: 'done'
|
|
||||||
})
|
|
||||||
}
|
|
||||||
isUpdate.value = true;
|
|
||||||
} else {
|
|
||||||
isUpdate.value = false;
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
resetFields();
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{ immediate: true }
|
|
||||||
);
|
|
||||||
</script>
|
|
||||||
@@ -1,42 +0,0 @@
|
|||||||
<!-- 搜索表单 -->
|
|
||||||
<template>
|
|
||||||
<a-space :size="10" style="flex-wrap: wrap">
|
|
||||||
<a-button type="primary" class="ele-btn-icon" @click="add">
|
|
||||||
<template #icon>
|
|
||||||
<PlusOutlined />
|
|
||||||
</template>
|
|
||||||
<span>添加</span>
|
|
||||||
</a-button>
|
|
||||||
</a-space>
|
|
||||||
</template>
|
|
||||||
|
|
||||||
<script lang="ts" setup>
|
|
||||||
import { PlusOutlined } from '@ant-design/icons-vue';
|
|
||||||
import type { GradeParam } from '@/api/user/grade/model';
|
|
||||||
import { watch } from 'vue';
|
|
||||||
|
|
||||||
const props = withDefaults(
|
|
||||||
defineProps<{
|
|
||||||
// 选中的角色
|
|
||||||
selection?: [];
|
|
||||||
}>(),
|
|
||||||
{}
|
|
||||||
);
|
|
||||||
|
|
||||||
const emit = defineEmits<{
|
|
||||||
(e: 'search', where?: GradeParam): void;
|
|
||||||
(e: 'add'): void;
|
|
||||||
(e: 'remove'): void;
|
|
||||||
(e: 'batchMove'): void;
|
|
||||||
}>();
|
|
||||||
|
|
||||||
// 新增
|
|
||||||
const add = () => {
|
|
||||||
emit('add');
|
|
||||||
};
|
|
||||||
|
|
||||||
watch(
|
|
||||||
() => props.selection,
|
|
||||||
() => {}
|
|
||||||
);
|
|
||||||
</script>
|
|
||||||
@@ -1,293 +0,0 @@
|
|||||||
<template>
|
|
||||||
<div class="page">
|
|
||||||
<div class="ele-body">
|
|
||||||
<a-card :bordered="false" :body-style="{ padding: '16px' }">
|
|
||||||
<ele-pro-table
|
|
||||||
ref="tableRef"
|
|
||||||
row-key="cmsDesignRecordId"
|
|
||||||
:columns="columns"
|
|
||||||
:datasource="datasource"
|
|
||||||
:customRow="customRow"
|
|
||||||
tool-class="ele-toolbar-form"
|
|
||||||
class="sys-org-table"
|
|
||||||
>
|
|
||||||
<template #toolbar>
|
|
||||||
<search
|
|
||||||
@search="reload"
|
|
||||||
:selection="selection"
|
|
||||||
@add="openEdit"
|
|
||||||
@remove="removeBatch"
|
|
||||||
@batchMove="openMove"
|
|
||||||
/>
|
|
||||||
</template>
|
|
||||||
<template #bodyCell="{ column, record }">
|
|
||||||
<template v-if="column.key === 'image'">
|
|
||||||
<a-image :src="record.image" :width="50" />
|
|
||||||
</template>
|
|
||||||
<template v-if="column.key === 'status'">
|
|
||||||
<a-tag v-if="record.status === 0" color="green">显示</a-tag>
|
|
||||||
<a-tag v-if="record.status === 1" color="red">隐藏</a-tag>
|
|
||||||
</template>
|
|
||||||
<template v-if="column.key === 'action'">
|
|
||||||
<a-space>
|
|
||||||
<a @click="openEdit(record)">修改</a>
|
|
||||||
<a-divider type="vertical" />
|
|
||||||
<a-popconfirm
|
|
||||||
title="确定要删除此记录吗?"
|
|
||||||
@confirm="remove(record)"
|
|
||||||
>
|
|
||||||
<a class="ele-text-danger">删除</a>
|
|
||||||
</a-popconfirm>
|
|
||||||
</a-space>
|
|
||||||
</template>
|
|
||||||
</template>
|
|
||||||
</ele-pro-table>
|
|
||||||
</a-card>
|
|
||||||
|
|
||||||
<!-- 编辑弹窗 -->
|
|
||||||
<CmsDesignRecordEdit v-model:visible="showEdit" :data="current" @done="reload" />
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</template>
|
|
||||||
|
|
||||||
<script lang="ts" setup>
|
|
||||||
import { createVNode, ref } from 'vue';
|
|
||||||
import { message, Modal } from 'ant-design-vue';
|
|
||||||
import { ExclamationCircleOutlined } from '@ant-design/icons-vue';
|
|
||||||
import type { EleProTable } from 'ele-admin-pro';
|
|
||||||
import { toDateString } from 'ele-admin-pro';
|
|
||||||
import type {
|
|
||||||
DatasourceFunction,
|
|
||||||
ColumnItem
|
|
||||||
} from 'ele-admin-pro/es/ele-pro-table/types';
|
|
||||||
import Search from './components/search.vue';
|
|
||||||
import CmsDesignRecordEdit from './components/cmsDesignRecordEdit.vue';
|
|
||||||
import { pageCmsDesignRecord, removeCmsDesignRecord, removeBatchCmsDesignRecord } from '@/api/cms/cmsDesignRecord';
|
|
||||||
import type { CmsDesignRecord, CmsDesignRecordParam } from '@/api/cms/cmsDesignRecord/model';
|
|
||||||
|
|
||||||
// 表格实例
|
|
||||||
const tableRef = ref<InstanceType<typeof EleProTable> | null>(null);
|
|
||||||
|
|
||||||
// 表格选中数据
|
|
||||||
const selection = ref<CmsDesignRecord[]>([]);
|
|
||||||
// 当前编辑数据
|
|
||||||
const current = ref<CmsDesignRecord | null>(null);
|
|
||||||
// 是否显示编辑弹窗
|
|
||||||
const showEdit = ref(false);
|
|
||||||
// 是否显示批量移动弹窗
|
|
||||||
const showMove = ref(false);
|
|
||||||
// 加载状态
|
|
||||||
const loading = ref(true);
|
|
||||||
|
|
||||||
// 表格数据源
|
|
||||||
const datasource: DatasourceFunction = ({
|
|
||||||
page,
|
|
||||||
limit,
|
|
||||||
where,
|
|
||||||
orders,
|
|
||||||
filters
|
|
||||||
}) => {
|
|
||||||
if (filters) {
|
|
||||||
where.status = filters.status;
|
|
||||||
}
|
|
||||||
return pageCmsDesignRecord({
|
|
||||||
...where,
|
|
||||||
...orders,
|
|
||||||
page,
|
|
||||||
limit
|
|
||||||
});
|
|
||||||
};
|
|
||||||
|
|
||||||
// 表格列配置
|
|
||||||
const columns = ref<ColumnItem[]>([
|
|
||||||
{
|
|
||||||
title: 'ID',
|
|
||||||
dataIndex: 'id',
|
|
||||||
key: 'id',
|
|
||||||
align: 'center',
|
|
||||||
width: 90,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
title: '关联导航ID',
|
|
||||||
dataIndex: 'navigationId',
|
|
||||||
key: 'navigationId',
|
|
||||||
align: 'center',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
title: '组件',
|
|
||||||
dataIndex: 'title',
|
|
||||||
key: 'title',
|
|
||||||
align: 'center',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
title: '组件标识',
|
|
||||||
dataIndex: 'dictCode',
|
|
||||||
key: 'dictCode',
|
|
||||||
align: 'center',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
title: '组件样式',
|
|
||||||
dataIndex: 'styles',
|
|
||||||
key: 'styles',
|
|
||||||
align: 'center',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
title: '卡片阴影显示时机',
|
|
||||||
dataIndex: 'shadow',
|
|
||||||
key: 'shadow',
|
|
||||||
align: 'center',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
title: '页面关键词',
|
|
||||||
dataIndex: 'keywords',
|
|
||||||
key: 'keywords',
|
|
||||||
align: 'center',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
title: '页面描述',
|
|
||||||
dataIndex: 'description',
|
|
||||||
key: 'description',
|
|
||||||
align: 'center',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
title: '页面路由地址',
|
|
||||||
dataIndex: 'path',
|
|
||||||
key: 'path',
|
|
||||||
align: 'center',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
title: '缩列图',
|
|
||||||
dataIndex: 'photo',
|
|
||||||
key: 'photo',
|
|
||||||
align: 'center',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
title: '用户ID',
|
|
||||||
dataIndex: 'userId',
|
|
||||||
key: 'userId',
|
|
||||||
align: 'center',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
title: '排序(数字越小越靠前)',
|
|
||||||
dataIndex: 'sortNumber',
|
|
||||||
key: 'sortNumber',
|
|
||||||
align: 'center',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
title: '备注',
|
|
||||||
dataIndex: 'comments',
|
|
||||||
key: 'comments',
|
|
||||||
align: 'center',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
title: '状态, 0正常, 1冻结',
|
|
||||||
dataIndex: 'status',
|
|
||||||
key: 'status',
|
|
||||||
align: 'center',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
title: '创建时间',
|
|
||||||
dataIndex: 'createTime',
|
|
||||||
key: 'createTime',
|
|
||||||
align: 'center',
|
|
||||||
sorter: true,
|
|
||||||
ellipsis: true,
|
|
||||||
customRender: ({ text }) => toDateString(text, 'yyyy-MM-dd')
|
|
||||||
},
|
|
||||||
{
|
|
||||||
title: '操作',
|
|
||||||
key: 'action',
|
|
||||||
width: 180,
|
|
||||||
fixed: 'right',
|
|
||||||
align: 'center',
|
|
||||||
hideInSetting: true
|
|
||||||
}
|
|
||||||
]);
|
|
||||||
|
|
||||||
/* 搜索 */
|
|
||||||
const reload = (where?: CmsDesignRecordParam) => {
|
|
||||||
selection.value = [];
|
|
||||||
tableRef?.value?.reload({ where: where });
|
|
||||||
};
|
|
||||||
|
|
||||||
/* 打开编辑弹窗 */
|
|
||||||
const openEdit = (row?: CmsDesignRecord) => {
|
|
||||||
current.value = row ?? null;
|
|
||||||
showEdit.value = true;
|
|
||||||
};
|
|
||||||
|
|
||||||
/* 打开批量移动弹窗 */
|
|
||||||
const openMove = () => {
|
|
||||||
showMove.value = true;
|
|
||||||
};
|
|
||||||
|
|
||||||
/* 删除单个 */
|
|
||||||
const remove = (row: CmsDesignRecord) => {
|
|
||||||
const hide = message.loading('请求中..', 0);
|
|
||||||
removeCmsDesignRecord(row.cmsDesignRecordId)
|
|
||||||
.then((msg) => {
|
|
||||||
hide();
|
|
||||||
message.success(msg);
|
|
||||||
reload();
|
|
||||||
})
|
|
||||||
.catch((e) => {
|
|
||||||
hide();
|
|
||||||
message.error(e.message);
|
|
||||||
});
|
|
||||||
};
|
|
||||||
|
|
||||||
/* 批量删除 */
|
|
||||||
const removeBatch = () => {
|
|
||||||
if (!selection.value.length) {
|
|
||||||
message.error('请至少选择一条数据');
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
Modal.confirm({
|
|
||||||
title: '提示',
|
|
||||||
content: '确定要删除选中的记录吗?',
|
|
||||||
icon: createVNode(ExclamationCircleOutlined),
|
|
||||||
maskClosable: true,
|
|
||||||
onOk: () => {
|
|
||||||
const hide = message.loading('请求中..', 0);
|
|
||||||
removeBatchCmsDesignRecord(selection.value.map((d) => d.cmsDesignRecordId))
|
|
||||||
.then((msg) => {
|
|
||||||
hide();
|
|
||||||
message.success(msg);
|
|
||||||
reload();
|
|
||||||
})
|
|
||||||
.catch((e) => {
|
|
||||||
hide();
|
|
||||||
message.error(e.message);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
});
|
|
||||||
};
|
|
||||||
|
|
||||||
/* 查询 */
|
|
||||||
const query = () => {
|
|
||||||
loading.value = true;
|
|
||||||
};
|
|
||||||
|
|
||||||
/* 自定义行属性 */
|
|
||||||
const customRow = (record: CmsDesignRecord) => {
|
|
||||||
return {
|
|
||||||
// 行点击事件
|
|
||||||
onClick: () => {
|
|
||||||
// console.log(record);
|
|
||||||
},
|
|
||||||
// 行双击事件
|
|
||||||
onDblclick: () => {
|
|
||||||
openEdit(record);
|
|
||||||
}
|
|
||||||
};
|
|
||||||
};
|
|
||||||
query();
|
|
||||||
</script>
|
|
||||||
|
|
||||||
<script lang="ts">
|
|
||||||
export default {
|
|
||||||
name: 'CmsDesignRecord'
|
|
||||||
};
|
|
||||||
</script>
|
|
||||||
|
|
||||||
<style lang="less" scoped></style>
|
|
||||||
@@ -1,244 +0,0 @@
|
|||||||
<!-- 编辑弹窗 -->
|
|
||||||
<template>
|
|
||||||
<ele-modal
|
|
||||||
:width="800"
|
|
||||||
:visible="visible"
|
|
||||||
:maskClosable="false"
|
|
||||||
:maxable="maxable"
|
|
||||||
:title="isUpdate ? '编辑设计征集报名' : '添加设计征集报名'"
|
|
||||||
:body-style="{ paddingBottom: '28px' }"
|
|
||||||
@update:visible="updateVisible"
|
|
||||||
@ok="save"
|
|
||||||
>
|
|
||||||
<a-form
|
|
||||||
ref="formRef"
|
|
||||||
:model="form"
|
|
||||||
:rules="rules"
|
|
||||||
:label-col="styleResponsive ? { md: 4, sm: 5, xs: 24 } : { flex: '90px' }"
|
|
||||||
:wrapper-col="
|
|
||||||
styleResponsive ? { md: 19, sm: 19, xs: 24 } : { flex: '1' }
|
|
||||||
"
|
|
||||||
>
|
|
||||||
<a-form-item label="" name="designId">
|
|
||||||
<a-input
|
|
||||||
allow-clear
|
|
||||||
placeholder="请输入"
|
|
||||||
v-model:value="form.designId"
|
|
||||||
/>
|
|
||||||
</a-form-item>
|
|
||||||
<a-form-item label="" name="name">
|
|
||||||
<a-input
|
|
||||||
allow-clear
|
|
||||||
placeholder="请输入"
|
|
||||||
v-model:value="form.name"
|
|
||||||
/>
|
|
||||||
</a-form-item>
|
|
||||||
<a-form-item label="" name="phone">
|
|
||||||
<a-input
|
|
||||||
allow-clear
|
|
||||||
placeholder="请输入"
|
|
||||||
v-model:value="form.phone"
|
|
||||||
/>
|
|
||||||
</a-form-item>
|
|
||||||
<a-form-item label="" name="content">
|
|
||||||
<a-input
|
|
||||||
allow-clear
|
|
||||||
placeholder="请输入"
|
|
||||||
v-model:value="form.content"
|
|
||||||
/>
|
|
||||||
</a-form-item>
|
|
||||||
<a-form-item label="用户ID" name="userId">
|
|
||||||
<a-input
|
|
||||||
allow-clear
|
|
||||||
placeholder="请输入用户ID"
|
|
||||||
v-model:value="form.userId"
|
|
||||||
/>
|
|
||||||
</a-form-item>
|
|
||||||
<a-form-item label="排序(数字越小越靠前)" name="sortNumber">
|
|
||||||
<a-input-number
|
|
||||||
:min="0"
|
|
||||||
:max="9999"
|
|
||||||
class="ele-fluid"
|
|
||||||
placeholder="请输入排序号"
|
|
||||||
v-model:value="form.sortNumber"
|
|
||||||
/>
|
|
||||||
</a-form-item>
|
|
||||||
<a-form-item label="备注" name="comments">
|
|
||||||
<a-textarea
|
|
||||||
:rows="4"
|
|
||||||
:maxlength="200"
|
|
||||||
placeholder="请输入描述"
|
|
||||||
v-model:value="form.comments"
|
|
||||||
/>
|
|
||||||
</a-form-item>
|
|
||||||
<a-form-item label="状态, 0已发布, 1待审核 2已驳回 3违规内容" name="status">
|
|
||||||
<a-radio-group v-model:value="form.status">
|
|
||||||
<a-radio :value="0">显示</a-radio>
|
|
||||||
<a-radio :value="1">隐藏</a-radio>
|
|
||||||
</a-radio-group>
|
|
||||||
</a-form-item>
|
|
||||||
<a-form-item label="是否删除, 0否, 1是" name="deleted">
|
|
||||||
<a-input
|
|
||||||
allow-clear
|
|
||||||
placeholder="请输入是否删除, 0否, 1是"
|
|
||||||
v-model:value="form.deleted"
|
|
||||||
/>
|
|
||||||
</a-form-item>
|
|
||||||
<a-form-item label="修改时间" name="updateTime">
|
|
||||||
<a-input
|
|
||||||
allow-clear
|
|
||||||
placeholder="请输入修改时间"
|
|
||||||
v-model:value="form.updateTime"
|
|
||||||
/>
|
|
||||||
</a-form-item>
|
|
||||||
</a-form>
|
|
||||||
</ele-modal>
|
|
||||||
</template>
|
|
||||||
|
|
||||||
<script lang="ts" setup>
|
|
||||||
import { ref, reactive, watch } from 'vue';
|
|
||||||
import { Form, message } from 'ant-design-vue';
|
|
||||||
import { assignObject, uuid } from 'ele-admin-pro';
|
|
||||||
import { addCmsDesignSignUp, updateCmsDesignSignUp } from '@/api/cms/cmsDesignSignUp';
|
|
||||||
import { CmsDesignSignUp } from '@/api/cms/cmsDesignSignUp/model';
|
|
||||||
import { useThemeStore } from '@/store/modules/theme';
|
|
||||||
import { storeToRefs } from 'pinia';
|
|
||||||
import { ItemType } from 'ele-admin-pro/es/ele-image-upload/types';
|
|
||||||
import { FormInstance } from 'ant-design-vue/es/form';
|
|
||||||
import { FileRecord } from '@/api/system/file/model';
|
|
||||||
|
|
||||||
// 是否是修改
|
|
||||||
const isUpdate = ref(false);
|
|
||||||
const useForm = Form.useForm;
|
|
||||||
// 是否开启响应式布局
|
|
||||||
const themeStore = useThemeStore();
|
|
||||||
const { styleResponsive } = storeToRefs(themeStore);
|
|
||||||
|
|
||||||
const props = defineProps<{
|
|
||||||
// 弹窗是否打开
|
|
||||||
visible: boolean;
|
|
||||||
// 修改回显的数据
|
|
||||||
data?: CmsDesignSignUp | null;
|
|
||||||
}>();
|
|
||||||
|
|
||||||
const emit = defineEmits<{
|
|
||||||
(e: 'done'): void;
|
|
||||||
(e: 'update:visible', visible: boolean): void;
|
|
||||||
}>();
|
|
||||||
|
|
||||||
// 提交状态
|
|
||||||
const loading = ref(false);
|
|
||||||
// 是否显示最大化切换按钮
|
|
||||||
const maxable = ref(true);
|
|
||||||
// 表格选中数据
|
|
||||||
const formRef = ref<FormInstance | null>(null);
|
|
||||||
const images = ref<ItemType[]>([]);
|
|
||||||
|
|
||||||
// 用户信息
|
|
||||||
const form = reactive<CmsDesignSignUp>({
|
|
||||||
id: undefined,
|
|
||||||
designId: undefined,
|
|
||||||
name: undefined,
|
|
||||||
phone: undefined,
|
|
||||||
content: undefined,
|
|
||||||
userId: undefined,
|
|
||||||
sortNumber: undefined,
|
|
||||||
comments: undefined,
|
|
||||||
status: undefined,
|
|
||||||
deleted: undefined,
|
|
||||||
tenantId: undefined,
|
|
||||||
createTime: undefined,
|
|
||||||
updateTime: undefined,
|
|
||||||
cmsDesignSignUpId: undefined,
|
|
||||||
cmsDesignSignUpName: '',
|
|
||||||
status: 0,
|
|
||||||
comments: '',
|
|
||||||
sortNumber: 100
|
|
||||||
});
|
|
||||||
|
|
||||||
/* 更新visible */
|
|
||||||
const updateVisible = (value: boolean) => {
|
|
||||||
emit('update:visible', value);
|
|
||||||
};
|
|
||||||
|
|
||||||
// 表单验证规则
|
|
||||||
const rules = reactive({
|
|
||||||
cmsDesignSignUpName: [
|
|
||||||
{
|
|
||||||
required: true,
|
|
||||||
type: 'string',
|
|
||||||
message: '请填写设计征集报名名称',
|
|
||||||
trigger: 'blur'
|
|
||||||
}
|
|
||||||
]
|
|
||||||
});
|
|
||||||
|
|
||||||
const chooseImage = (data: FileRecord) => {
|
|
||||||
images.value.push({
|
|
||||||
uid: data.id,
|
|
||||||
url: data.path,
|
|
||||||
status: 'done'
|
|
||||||
});
|
|
||||||
form.image = data.path;
|
|
||||||
};
|
|
||||||
|
|
||||||
const onDeleteItem = (index: number) => {
|
|
||||||
images.value.splice(index, 1);
|
|
||||||
form.image = '';
|
|
||||||
};
|
|
||||||
|
|
||||||
const { resetFields } = useForm(form, rules);
|
|
||||||
|
|
||||||
/* 保存编辑 */
|
|
||||||
const save = () => {
|
|
||||||
if (!formRef.value) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
formRef.value
|
|
||||||
.validate()
|
|
||||||
.then(() => {
|
|
||||||
loading.value = true;
|
|
||||||
const formData = {
|
|
||||||
...form
|
|
||||||
};
|
|
||||||
const saveOrUpdate = isUpdate.value ? updateCmsDesignSignUp : addCmsDesignSignUp;
|
|
||||||
saveOrUpdate(formData)
|
|
||||||
.then((msg) => {
|
|
||||||
loading.value = false;
|
|
||||||
message.success(msg);
|
|
||||||
updateVisible(false);
|
|
||||||
emit('done');
|
|
||||||
})
|
|
||||||
.catch((e) => {
|
|
||||||
loading.value = false;
|
|
||||||
message.error(e.message);
|
|
||||||
});
|
|
||||||
})
|
|
||||||
.catch(() => {});
|
|
||||||
};
|
|
||||||
|
|
||||||
watch(
|
|
||||||
() => props.visible,
|
|
||||||
(visible) => {
|
|
||||||
if (visible) {
|
|
||||||
images.value = [];
|
|
||||||
if (props.data) {
|
|
||||||
assignObject(form, props.data);
|
|
||||||
if(props.data.image){
|
|
||||||
images.value.push({
|
|
||||||
uid: uuid(),
|
|
||||||
url: props.data.image,
|
|
||||||
status: 'done'
|
|
||||||
})
|
|
||||||
}
|
|
||||||
isUpdate.value = true;
|
|
||||||
} else {
|
|
||||||
isUpdate.value = false;
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
resetFields();
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{ immediate: true }
|
|
||||||
);
|
|
||||||
</script>
|
|
||||||
@@ -1,42 +0,0 @@
|
|||||||
<!-- 搜索表单 -->
|
|
||||||
<template>
|
|
||||||
<a-space :size="10" style="flex-wrap: wrap">
|
|
||||||
<a-button type="primary" class="ele-btn-icon" @click="add">
|
|
||||||
<template #icon>
|
|
||||||
<PlusOutlined />
|
|
||||||
</template>
|
|
||||||
<span>添加</span>
|
|
||||||
</a-button>
|
|
||||||
</a-space>
|
|
||||||
</template>
|
|
||||||
|
|
||||||
<script lang="ts" setup>
|
|
||||||
import { PlusOutlined } from '@ant-design/icons-vue';
|
|
||||||
import type { GradeParam } from '@/api/user/grade/model';
|
|
||||||
import { watch } from 'vue';
|
|
||||||
|
|
||||||
const props = withDefaults(
|
|
||||||
defineProps<{
|
|
||||||
// 选中的角色
|
|
||||||
selection?: [];
|
|
||||||
}>(),
|
|
||||||
{}
|
|
||||||
);
|
|
||||||
|
|
||||||
const emit = defineEmits<{
|
|
||||||
(e: 'search', where?: GradeParam): void;
|
|
||||||
(e: 'add'): void;
|
|
||||||
(e: 'remove'): void;
|
|
||||||
(e: 'batchMove'): void;
|
|
||||||
}>();
|
|
||||||
|
|
||||||
// 新增
|
|
||||||
const add = () => {
|
|
||||||
emit('add');
|
|
||||||
};
|
|
||||||
|
|
||||||
watch(
|
|
||||||
() => props.selection,
|
|
||||||
() => {}
|
|
||||||
);
|
|
||||||
</script>
|
|
||||||
@@ -1,275 +0,0 @@
|
|||||||
<template>
|
|
||||||
<div class="page">
|
|
||||||
<div class="ele-body">
|
|
||||||
<a-card :bordered="false" :body-style="{ padding: '16px' }">
|
|
||||||
<ele-pro-table
|
|
||||||
ref="tableRef"
|
|
||||||
row-key="cmsDesignSignUpId"
|
|
||||||
:columns="columns"
|
|
||||||
:datasource="datasource"
|
|
||||||
:customRow="customRow"
|
|
||||||
tool-class="ele-toolbar-form"
|
|
||||||
class="sys-org-table"
|
|
||||||
>
|
|
||||||
<template #toolbar>
|
|
||||||
<search
|
|
||||||
@search="reload"
|
|
||||||
:selection="selection"
|
|
||||||
@add="openEdit"
|
|
||||||
@remove="removeBatch"
|
|
||||||
@batchMove="openMove"
|
|
||||||
/>
|
|
||||||
</template>
|
|
||||||
<template #bodyCell="{ column, record }">
|
|
||||||
<template v-if="column.key === 'image'">
|
|
||||||
<a-image :src="record.image" :width="50" />
|
|
||||||
</template>
|
|
||||||
<template v-if="column.key === 'status'">
|
|
||||||
<a-tag v-if="record.status === 0" color="green">显示</a-tag>
|
|
||||||
<a-tag v-if="record.status === 1" color="red">隐藏</a-tag>
|
|
||||||
</template>
|
|
||||||
<template v-if="column.key === 'action'">
|
|
||||||
<a-space>
|
|
||||||
<a @click="openEdit(record)">修改</a>
|
|
||||||
<a-divider type="vertical" />
|
|
||||||
<a-popconfirm
|
|
||||||
title="确定要删除此记录吗?"
|
|
||||||
@confirm="remove(record)"
|
|
||||||
>
|
|
||||||
<a class="ele-text-danger">删除</a>
|
|
||||||
</a-popconfirm>
|
|
||||||
</a-space>
|
|
||||||
</template>
|
|
||||||
</template>
|
|
||||||
</ele-pro-table>
|
|
||||||
</a-card>
|
|
||||||
|
|
||||||
<!-- 编辑弹窗 -->
|
|
||||||
<CmsDesignSignUpEdit v-model:visible="showEdit" :data="current" @done="reload" />
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</template>
|
|
||||||
|
|
||||||
<script lang="ts" setup>
|
|
||||||
import { createVNode, ref } from 'vue';
|
|
||||||
import { message, Modal } from 'ant-design-vue';
|
|
||||||
import { ExclamationCircleOutlined } from '@ant-design/icons-vue';
|
|
||||||
import type { EleProTable } from 'ele-admin-pro';
|
|
||||||
import { toDateString } from 'ele-admin-pro';
|
|
||||||
import type {
|
|
||||||
DatasourceFunction,
|
|
||||||
ColumnItem
|
|
||||||
} from 'ele-admin-pro/es/ele-pro-table/types';
|
|
||||||
import Search from './components/search.vue';
|
|
||||||
import CmsDesignSignUpEdit from './components/cmsDesignSignUpEdit.vue';
|
|
||||||
import { pageCmsDesignSignUp, removeCmsDesignSignUp, removeBatchCmsDesignSignUp } from '@/api/cms/cmsDesignSignUp';
|
|
||||||
import type { CmsDesignSignUp, CmsDesignSignUpParam } from '@/api/cms/cmsDesignSignUp/model';
|
|
||||||
|
|
||||||
// 表格实例
|
|
||||||
const tableRef = ref<InstanceType<typeof EleProTable> | null>(null);
|
|
||||||
|
|
||||||
// 表格选中数据
|
|
||||||
const selection = ref<CmsDesignSignUp[]>([]);
|
|
||||||
// 当前编辑数据
|
|
||||||
const current = ref<CmsDesignSignUp | null>(null);
|
|
||||||
// 是否显示编辑弹窗
|
|
||||||
const showEdit = ref(false);
|
|
||||||
// 是否显示批量移动弹窗
|
|
||||||
const showMove = ref(false);
|
|
||||||
// 加载状态
|
|
||||||
const loading = ref(true);
|
|
||||||
|
|
||||||
// 表格数据源
|
|
||||||
const datasource: DatasourceFunction = ({
|
|
||||||
page,
|
|
||||||
limit,
|
|
||||||
where,
|
|
||||||
orders,
|
|
||||||
filters
|
|
||||||
}) => {
|
|
||||||
if (filters) {
|
|
||||||
where.status = filters.status;
|
|
||||||
}
|
|
||||||
return pageCmsDesignSignUp({
|
|
||||||
...where,
|
|
||||||
...orders,
|
|
||||||
page,
|
|
||||||
limit
|
|
||||||
});
|
|
||||||
};
|
|
||||||
|
|
||||||
// 表格列配置
|
|
||||||
const columns = ref<ColumnItem[]>([
|
|
||||||
{
|
|
||||||
title: '',
|
|
||||||
dataIndex: 'id',
|
|
||||||
key: 'id',
|
|
||||||
align: 'center',
|
|
||||||
width: 90,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
title: '',
|
|
||||||
dataIndex: 'designId',
|
|
||||||
key: 'designId',
|
|
||||||
align: 'center',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
title: '',
|
|
||||||
dataIndex: 'name',
|
|
||||||
key: 'name',
|
|
||||||
align: 'center',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
title: '',
|
|
||||||
dataIndex: 'phone',
|
|
||||||
key: 'phone',
|
|
||||||
align: 'center',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
title: '',
|
|
||||||
dataIndex: 'content',
|
|
||||||
key: 'content',
|
|
||||||
align: 'center',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
title: '用户ID',
|
|
||||||
dataIndex: 'userId',
|
|
||||||
key: 'userId',
|
|
||||||
align: 'center',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
title: '排序(数字越小越靠前)',
|
|
||||||
dataIndex: 'sortNumber',
|
|
||||||
key: 'sortNumber',
|
|
||||||
align: 'center',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
title: '备注',
|
|
||||||
dataIndex: 'comments',
|
|
||||||
key: 'comments',
|
|
||||||
align: 'center',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
title: '状态, 0已发布, 1待审核 2已驳回 3违规内容',
|
|
||||||
dataIndex: 'status',
|
|
||||||
key: 'status',
|
|
||||||
align: 'center',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
title: '是否删除, 0否, 1是',
|
|
||||||
dataIndex: 'deleted',
|
|
||||||
key: 'deleted',
|
|
||||||
align: 'center',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
title: '创建时间',
|
|
||||||
dataIndex: 'createTime',
|
|
||||||
key: 'createTime',
|
|
||||||
align: 'center',
|
|
||||||
sorter: true,
|
|
||||||
ellipsis: true,
|
|
||||||
customRender: ({ text }) => toDateString(text, 'yyyy-MM-dd')
|
|
||||||
},
|
|
||||||
{
|
|
||||||
title: '修改时间',
|
|
||||||
dataIndex: 'updateTime',
|
|
||||||
key: 'updateTime',
|
|
||||||
align: 'center',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
title: '操作',
|
|
||||||
key: 'action',
|
|
||||||
width: 180,
|
|
||||||
fixed: 'right',
|
|
||||||
align: 'center',
|
|
||||||
hideInSetting: true
|
|
||||||
}
|
|
||||||
]);
|
|
||||||
|
|
||||||
/* 搜索 */
|
|
||||||
const reload = (where?: CmsDesignSignUpParam) => {
|
|
||||||
selection.value = [];
|
|
||||||
tableRef?.value?.reload({ where: where });
|
|
||||||
};
|
|
||||||
|
|
||||||
/* 打开编辑弹窗 */
|
|
||||||
const openEdit = (row?: CmsDesignSignUp) => {
|
|
||||||
current.value = row ?? null;
|
|
||||||
showEdit.value = true;
|
|
||||||
};
|
|
||||||
|
|
||||||
/* 打开批量移动弹窗 */
|
|
||||||
const openMove = () => {
|
|
||||||
showMove.value = true;
|
|
||||||
};
|
|
||||||
|
|
||||||
/* 删除单个 */
|
|
||||||
const remove = (row: CmsDesignSignUp) => {
|
|
||||||
const hide = message.loading('请求中..', 0);
|
|
||||||
removeCmsDesignSignUp(row.cmsDesignSignUpId)
|
|
||||||
.then((msg) => {
|
|
||||||
hide();
|
|
||||||
message.success(msg);
|
|
||||||
reload();
|
|
||||||
})
|
|
||||||
.catch((e) => {
|
|
||||||
hide();
|
|
||||||
message.error(e.message);
|
|
||||||
});
|
|
||||||
};
|
|
||||||
|
|
||||||
/* 批量删除 */
|
|
||||||
const removeBatch = () => {
|
|
||||||
if (!selection.value.length) {
|
|
||||||
message.error('请至少选择一条数据');
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
Modal.confirm({
|
|
||||||
title: '提示',
|
|
||||||
content: '确定要删除选中的记录吗?',
|
|
||||||
icon: createVNode(ExclamationCircleOutlined),
|
|
||||||
maskClosable: true,
|
|
||||||
onOk: () => {
|
|
||||||
const hide = message.loading('请求中..', 0);
|
|
||||||
removeBatchCmsDesignSignUp(selection.value.map((d) => d.cmsDesignSignUpId))
|
|
||||||
.then((msg) => {
|
|
||||||
hide();
|
|
||||||
message.success(msg);
|
|
||||||
reload();
|
|
||||||
})
|
|
||||||
.catch((e) => {
|
|
||||||
hide();
|
|
||||||
message.error(e.message);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
});
|
|
||||||
};
|
|
||||||
|
|
||||||
/* 查询 */
|
|
||||||
const query = () => {
|
|
||||||
loading.value = true;
|
|
||||||
};
|
|
||||||
|
|
||||||
/* 自定义行属性 */
|
|
||||||
const customRow = (record: CmsDesignSignUp) => {
|
|
||||||
return {
|
|
||||||
// 行点击事件
|
|
||||||
onClick: () => {
|
|
||||||
// console.log(record);
|
|
||||||
},
|
|
||||||
// 行双击事件
|
|
||||||
onDblclick: () => {
|
|
||||||
openEdit(record);
|
|
||||||
}
|
|
||||||
};
|
|
||||||
};
|
|
||||||
query();
|
|
||||||
</script>
|
|
||||||
|
|
||||||
<script lang="ts">
|
|
||||||
export default {
|
|
||||||
name: 'CmsDesignSignUp'
|
|
||||||
};
|
|
||||||
</script>
|
|
||||||
|
|
||||||
<style lang="less" scoped></style>
|
|
||||||
@@ -1,276 +0,0 @@
|
|||||||
<template>
|
|
||||||
<a-drawer
|
|
||||||
width="70%"
|
|
||||||
:visible="visible"
|
|
||||||
:title="`${data?.title}`"
|
|
||||||
placement="left"
|
|
||||||
:body-style="{ paddingBottom: '28px' }"
|
|
||||||
@update:visible="updateVisible"
|
|
||||||
:confirm-loading="loading"
|
|
||||||
:footer="null"
|
|
||||||
>
|
|
||||||
<ele-pro-table
|
|
||||||
ref="tableRef"
|
|
||||||
row-key="navigationId"
|
|
||||||
:columns="columns"
|
|
||||||
:datasource="datasource"
|
|
||||||
:customRow="customRow"
|
|
||||||
tool-class="ele-toolbar-form"
|
|
||||||
class="sys-org-table"
|
|
||||||
>
|
|
||||||
<template #toolbar>
|
|
||||||
<search
|
|
||||||
@search="reload"
|
|
||||||
:selection="selection"
|
|
||||||
:categoryId="categoryId"
|
|
||||||
@add="openEdit"
|
|
||||||
@remove="removeBatch"
|
|
||||||
@batchMove="openMove"
|
|
||||||
/>
|
|
||||||
</template>
|
|
||||||
<template #bodyCell="{ column, record }">
|
|
||||||
<template v-if="column.key === 'isStatus'">
|
|
||||||
<a-tag v-if="record.isStatus === 1" color="green">开启</a-tag>
|
|
||||||
<a-tag v-if="record.isStatus === 2" color="red">关闭</a-tag>
|
|
||||||
</template>
|
|
||||||
<template v-if="column.key === 'isFree'">
|
|
||||||
<a-tag v-if="record.isFree === 1" color="green">免费</a-tag>
|
|
||||||
<a-tag v-if="record.isFree === 2" color="orange">收费</a-tag>
|
|
||||||
</template>
|
|
||||||
<template v-if="column.key === 'action'">
|
|
||||||
<a-space>
|
|
||||||
<a @click="moveUp(record)">上移<ArrowUpOutlined /></a>
|
|
||||||
<a-divider type="vertical" />
|
|
||||||
<a @click="openEdit(record)">编辑</a>
|
|
||||||
<a-divider type="vertical" />
|
|
||||||
<a-popconfirm
|
|
||||||
title="确定要删除此记录吗?"
|
|
||||||
@confirm="remove(record)"
|
|
||||||
>
|
|
||||||
<a class="ele-text-danger">删除</a>
|
|
||||||
</a-popconfirm>
|
|
||||||
</a-space>
|
|
||||||
</template>
|
|
||||||
</template>
|
|
||||||
</ele-pro-table>
|
|
||||||
<!-- 编辑弹窗 -->
|
|
||||||
<DesignRecordEdit
|
|
||||||
v-model:visible="showEdit"
|
|
||||||
:merchant="data"
|
|
||||||
:categoryId="categoryId"
|
|
||||||
:data="current"
|
|
||||||
@done="reload"
|
|
||||||
/>
|
|
||||||
</a-drawer>
|
|
||||||
</template>
|
|
||||||
|
|
||||||
<script lang="ts" setup>
|
|
||||||
import { createVNode, ref, watch } from 'vue';
|
|
||||||
import { message, Modal } from 'ant-design-vue';
|
|
||||||
import {
|
|
||||||
ArrowUpOutlined,
|
|
||||||
ExclamationCircleOutlined
|
|
||||||
} from '@ant-design/icons-vue';
|
|
||||||
import { EleProTable } from 'ele-admin-pro';
|
|
||||||
import type {
|
|
||||||
DatasourceFunction,
|
|
||||||
ColumnItem
|
|
||||||
} from 'ele-admin-pro/es/ele-pro-table/types';
|
|
||||||
import Search from './components/search.vue';
|
|
||||||
import DesignRecordEdit from './components/designRecordEdit.vue';
|
|
||||||
import {
|
|
||||||
removeCmsDesignRecord,
|
|
||||||
removeBatchCmsDesignRecord,
|
|
||||||
updateCmsDesignRecord
|
|
||||||
} from '@/api/cms/cmsDesignRecord';
|
|
||||||
import type { CmsDesignRecord } from '@/api/cms/cmsDesignRecord/model';
|
|
||||||
import { CmsNavigation } from '@/api/cms/cmsNavigation/model';
|
|
||||||
import { pageCmsDesignRecord } from '@/api/cms/cmsDesignRecord';
|
|
||||||
import { CmsDesignRecordParam } from '@/api/cms/cmsDesignRecord/model';
|
|
||||||
|
|
||||||
const props = defineProps<{
|
|
||||||
// 弹窗是否打开
|
|
||||||
visible: boolean;
|
|
||||||
// 修改回显的数据
|
|
||||||
categoryId?: number | null;
|
|
||||||
// 导航信息
|
|
||||||
data?: CmsNavigation;
|
|
||||||
}>();
|
|
||||||
|
|
||||||
const emit = defineEmits<{
|
|
||||||
(e: 'done'): void;
|
|
||||||
(e: 'update:visible', visible: boolean): void;
|
|
||||||
}>();
|
|
||||||
|
|
||||||
/* 更新visible */
|
|
||||||
const updateVisible = (value: boolean) => {
|
|
||||||
emit('update:visible', value);
|
|
||||||
};
|
|
||||||
|
|
||||||
// 表格实例
|
|
||||||
const tableRef = ref<InstanceType<typeof EleProTable> | null>(null);
|
|
||||||
// 表格选中数据
|
|
||||||
const selection = ref<CmsDesignRecord[]>([]);
|
|
||||||
// 当前编辑数据
|
|
||||||
const current = ref<CmsDesignRecord | null>(null);
|
|
||||||
// 是否显示编辑弹窗
|
|
||||||
const showEdit = ref(false);
|
|
||||||
// 是否显示批量移动弹窗
|
|
||||||
const showMove = ref(false);
|
|
||||||
|
|
||||||
// 加载状态
|
|
||||||
const loading = ref(true);
|
|
||||||
|
|
||||||
// 表格数据源
|
|
||||||
const datasource: DatasourceFunction = ({
|
|
||||||
page,
|
|
||||||
limit,
|
|
||||||
where,
|
|
||||||
orders,
|
|
||||||
filters
|
|
||||||
}) => {
|
|
||||||
if (filters) {
|
|
||||||
where.status = filters.status;
|
|
||||||
}
|
|
||||||
where.navigationId = props.categoryId;
|
|
||||||
return pageCmsDesignRecord({
|
|
||||||
...where,
|
|
||||||
...orders,
|
|
||||||
page,
|
|
||||||
limit
|
|
||||||
});
|
|
||||||
};
|
|
||||||
|
|
||||||
// 表格列配置
|
|
||||||
const columns = ref<ColumnItem[]>([
|
|
||||||
{
|
|
||||||
key: 'navigationId',
|
|
||||||
width: 48,
|
|
||||||
align: 'center',
|
|
||||||
fixed: 'left',
|
|
||||||
hideInSetting: true,
|
|
||||||
customRender: ({ index }) => index + (tableRef.value?.tableIndex ?? 0)
|
|
||||||
},
|
|
||||||
{
|
|
||||||
title: '组件',
|
|
||||||
dataIndex: 'title',
|
|
||||||
key: 'title'
|
|
||||||
},
|
|
||||||
{
|
|
||||||
title: '排序',
|
|
||||||
dataIndex: 'sortNumber',
|
|
||||||
key: 'sortNumber',
|
|
||||||
width: 120,
|
|
||||||
align: 'center'
|
|
||||||
},
|
|
||||||
{
|
|
||||||
title: '操作',
|
|
||||||
key: 'action',
|
|
||||||
width: 180,
|
|
||||||
fixed: 'right',
|
|
||||||
align: 'center',
|
|
||||||
hideInSetting: true
|
|
||||||
}
|
|
||||||
]);
|
|
||||||
|
|
||||||
/* 搜索 */
|
|
||||||
const reload = (where?: CmsDesignRecordParam) => {
|
|
||||||
selection.value = [];
|
|
||||||
tableRef?.value?.reload({ where: where });
|
|
||||||
};
|
|
||||||
|
|
||||||
/* 打开编辑弹窗 */
|
|
||||||
const openEdit = (row?: CmsDesignRecord) => {
|
|
||||||
current.value = row ?? null;
|
|
||||||
showEdit.value = true;
|
|
||||||
};
|
|
||||||
|
|
||||||
/* 打开批量移动弹窗 */
|
|
||||||
const openMove = () => {
|
|
||||||
showMove.value = true;
|
|
||||||
};
|
|
||||||
|
|
||||||
/* 删除单个 */
|
|
||||||
const remove = (row: CmsDesignRecord) => {
|
|
||||||
const hide = message.loading('请求中..', 0);
|
|
||||||
removeCmsDesignRecord(row.periodId)
|
|
||||||
.then((msg) => {
|
|
||||||
hide();
|
|
||||||
message.success(msg);
|
|
||||||
reload();
|
|
||||||
})
|
|
||||||
.catch((e) => {
|
|
||||||
hide();
|
|
||||||
message.error(e.message);
|
|
||||||
});
|
|
||||||
};
|
|
||||||
|
|
||||||
/* 批量删除 */
|
|
||||||
const removeBatch = () => {
|
|
||||||
if (!selection.value.length) {
|
|
||||||
message.error('请至少选择一条数据');
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
Modal.confirm({
|
|
||||||
title: '提示',
|
|
||||||
content: '确定要删除选中的记录吗?',
|
|
||||||
icon: createVNode(ExclamationCircleOutlined),
|
|
||||||
maskClosable: true,
|
|
||||||
onOk: () => {
|
|
||||||
const hide = message.loading('请求中..', 0);
|
|
||||||
removeBatchCmsDesignRecord(selection.value.map((d) => d.periodId))
|
|
||||||
.then((msg) => {
|
|
||||||
hide();
|
|
||||||
message.success(msg);
|
|
||||||
reload();
|
|
||||||
})
|
|
||||||
.catch((e) => {
|
|
||||||
hide();
|
|
||||||
message.error(e.message);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
});
|
|
||||||
};
|
|
||||||
|
|
||||||
// 上移
|
|
||||||
const moveUp = (row?: CmsDesignRecord) => {
|
|
||||||
updateCmsDesignRecord({
|
|
||||||
periodId: row?.periodId,
|
|
||||||
sortNumber: Number(row?.sortNumber) - 1
|
|
||||||
}).then((msg) => {
|
|
||||||
message.success(msg);
|
|
||||||
reload();
|
|
||||||
});
|
|
||||||
};
|
|
||||||
|
|
||||||
/* 自定义行属性 */
|
|
||||||
const customRow = (record: CmsDesignRecord) => {
|
|
||||||
return {
|
|
||||||
// 行点击事件
|
|
||||||
onClick: () => {
|
|
||||||
// console.log(record);
|
|
||||||
},
|
|
||||||
// 行双击事件
|
|
||||||
onDblclick: () => {
|
|
||||||
openEdit(record);
|
|
||||||
}
|
|
||||||
};
|
|
||||||
};
|
|
||||||
|
|
||||||
watch(
|
|
||||||
() => props.categoryId,
|
|
||||||
(categoryId) => {
|
|
||||||
if (categoryId) {
|
|
||||||
reload();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
);
|
|
||||||
</script>
|
|
||||||
|
|
||||||
<script lang="ts">
|
|
||||||
export default {
|
|
||||||
name: 'DesignRecord'
|
|
||||||
};
|
|
||||||
</script>
|
|
||||||
|
|
||||||
<style lang="less" scoped></style>
|
|
||||||
@@ -212,13 +212,6 @@
|
|||||||
:category-id="categoryId"
|
:category-id="categoryId"
|
||||||
@done="reload"
|
@done="reload"
|
||||||
/>
|
/>
|
||||||
<!-- 页面组件弹窗 -->
|
|
||||||
<Components
|
|
||||||
v-model:visible="showDesignRecordEdit"
|
|
||||||
:data="current"
|
|
||||||
:category-id="categoryId"
|
|
||||||
@done="reload"
|
|
||||||
/>
|
|
||||||
</a-page-header>
|
</a-page-header>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
@@ -242,7 +235,6 @@ import type {EleProTable} from 'ele-admin-pro/es';
|
|||||||
import {useI18n} from 'vue-i18n';
|
import {useI18n} from 'vue-i18n';
|
||||||
import CmsNavigationEdit from './components/navigation-edit.vue';
|
import CmsNavigationEdit from './components/navigation-edit.vue';
|
||||||
import DesignEdit from './components/design-edit.vue';
|
import DesignEdit from './components/design-edit.vue';
|
||||||
import Components from './components/components.vue';
|
|
||||||
import {
|
import {
|
||||||
listCmsNavigation,
|
listCmsNavigation,
|
||||||
removeCmsNavigation
|
removeCmsNavigation
|
||||||
|
|||||||
@@ -132,12 +132,7 @@
|
|||||||
deleted: undefined,
|
deleted: undefined,
|
||||||
tenantId: undefined,
|
tenantId: undefined,
|
||||||
createTime: undefined,
|
createTime: undefined,
|
||||||
updateTime: undefined,
|
updateTime: undefined
|
||||||
hjmExamLogId: undefined,
|
|
||||||
hjmExamLogName: '',
|
|
||||||
status: 0,
|
|
||||||
comments: '',
|
|
||||||
sortNumber: 100
|
|
||||||
});
|
});
|
||||||
|
|
||||||
/* 更新visible */
|
/* 更新visible */
|
||||||
|
|||||||
@@ -133,7 +133,7 @@
|
|||||||
>
|
>
|
||||||
{{ loading ? t('login.loading') : t('login.login') }}
|
{{ loading ? t('login.loading') : t('login.login') }}
|
||||||
</a-button>
|
</a-button>
|
||||||
<!-- <div class="register text-center pt-5"><a @click="push('/register')">免费注册</a></div>-->
|
<!-- <div class="register text-center pt-5"><a @click="push('/register')">免费注册</a></div>-->
|
||||||
</a-form-item>
|
</a-form-item>
|
||||||
</template>
|
</template>
|
||||||
<template v-if="loginType === 'sms'">
|
<template v-if="loginType === 'sms'">
|
||||||
@@ -178,7 +178,7 @@
|
|||||||
>
|
>
|
||||||
{{ loading ? t('login.loading') : t('login.login') }}
|
{{ loading ? t('login.loading') : t('login.login') }}
|
||||||
</a-button>
|
</a-button>
|
||||||
<!-- <div class="register text-center pt-5"><a @click="push('/register')">免费注册</a></div>-->
|
<!-- <div class="register text-center pt-5"><a @click="push('/register')">免费注册</a></div>-->
|
||||||
</a-form-item>
|
</a-form-item>
|
||||||
</template>
|
</template>
|
||||||
<template v-if="loginType == 'scan'">
|
<template v-if="loginType == 'scan'">
|
||||||
@@ -280,11 +280,9 @@ import {FormInstance} from 'ant-design-vue/es/form';
|
|||||||
import {configWebsiteField} from '@/api/cms/cmsWebsiteField';
|
import {configWebsiteField} from '@/api/cms/cmsWebsiteField';
|
||||||
import {Config} from '@/api/cms/cmsWebsiteField/model';
|
import {Config} from '@/api/cms/cmsWebsiteField/model';
|
||||||
import {phoneReg} from 'ele-admin-pro';
|
import {phoneReg} from 'ele-admin-pro';
|
||||||
// import {push} from "@/utils/common";
|
|
||||||
import router from "@/router";
|
import router from "@/router";
|
||||||
import {listAdminsByPhoneAll} from "@/api/system/user";
|
import {listAdminsByPhoneAll} from "@/api/system/user";
|
||||||
// import {pageOrderGoods} from "@/api/system/orderGoods";
|
import {getUserInfo} from "@/api/layout";
|
||||||
// import {push} from "@/utils/common";
|
|
||||||
|
|
||||||
const useForm = Form.useForm;
|
const useForm = Form.useForm;
|
||||||
const {currentRoute} = useRouter();
|
const {currentRoute} = useRouter();
|
||||||
@@ -296,7 +294,6 @@ const direction = ref(0);
|
|||||||
// 加载状态
|
// 加载状态
|
||||||
const loading = ref(false);
|
const loading = ref(false);
|
||||||
// 是否显示tenantId填写输入框
|
// 是否显示tenantId填写输入框
|
||||||
const showTenantId = ref(true);
|
|
||||||
const loginType = ref('sms');
|
const loginType = ref('sms');
|
||||||
const config = ref<Config>();
|
const config = ref<Config>();
|
||||||
// 配置信息
|
// 配置信息
|
||||||
@@ -398,7 +395,7 @@ const sendCode = () => {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
codeLoading.value = true;
|
codeLoading.value = true;
|
||||||
sendSmsCaptcha({phone: form.phone}).then((res) => {
|
sendSmsCaptcha({phone: form.phone}).then(() => {
|
||||||
message.success('短信验证码发送成功, 请注意查收!');
|
message.success('短信验证码发送成功, 请注意查收!');
|
||||||
visible.value = false;
|
visible.value = false;
|
||||||
codeLoading.value = false;
|
codeLoading.value = false;
|
||||||
@@ -481,7 +478,7 @@ const submit = () => {
|
|||||||
form.phone = undefined;
|
form.phone = undefined;
|
||||||
login(form)
|
login(form)
|
||||||
.then((msg) => {
|
.then((msg) => {
|
||||||
if(msg == '请选择登录用户'){
|
if (msg == '请选择登录用户') {
|
||||||
showSelectLoginUser.value = true;
|
showSelectLoginUser.value = true;
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@@ -518,20 +515,26 @@ const onLoginType = (text) => {
|
|||||||
};
|
};
|
||||||
|
|
||||||
const onScan = () => {
|
const onScan = () => {
|
||||||
if(loginType.value == 'scan'){
|
if (loginType.value == 'scan') {
|
||||||
loginType.value = 'sms'
|
loginType.value = 'sms'
|
||||||
}else {
|
} else {
|
||||||
loginType.value = 'scan'
|
loginType.value = 'scan'
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* 二维码登录成功处理 */
|
/* 二维码登录成功处理 */
|
||||||
const onQrLoginSuccess = (token: string) => {
|
const onQrLoginSuccess = async (token: string) => {
|
||||||
// 设置token到localStorage或其他存储
|
// 设置token到localStorage或其他存储
|
||||||
localStorage.setItem('access_token', token);
|
localStorage.setItem('access_token', token);
|
||||||
message.success('扫码登录成功');
|
message.success('扫码登录成功');
|
||||||
cleanPageTabs();
|
const data = await getUserInfo();
|
||||||
goHome();
|
if (data) {
|
||||||
|
localStorage.setItem('access_token', token);
|
||||||
|
localStorage.setItem('TenantId', String(data.tenantId));
|
||||||
|
localStorage.setItem('UserId', String(data.userId));
|
||||||
|
cleanPageTabs();
|
||||||
|
goHome();
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
/* 二维码登录错误处理 */
|
/* 二维码登录错误处理 */
|
||||||
@@ -578,9 +581,9 @@ loginConnect();
|
|||||||
watch(
|
watch(
|
||||||
router.currentRoute,
|
router.currentRoute,
|
||||||
(data) => {
|
(data) => {
|
||||||
if(data.query?.loginPhone){
|
if (data.query?.loginPhone) {
|
||||||
form.phone = `${data.query?.loginPhone}`;
|
form.phone = `${data.query?.loginPhone}`;
|
||||||
}else {
|
} else {
|
||||||
localStorage.clear();
|
localStorage.clear();
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|||||||
Reference in New Issue
Block a user