优化company/profile

This commit is contained in:
2024-09-20 16:11:55 +08:00
parent e298d960e7
commit ed4b4afda0
74 changed files with 2392 additions and 8130 deletions

View File

@@ -1,11 +1,11 @@
VITE_APP_NAME=后台管理系统
VITE_SOCKET_URL=wss://server.gxwebsoft.com
VITE_SERVER_URL=https://server.gxwebsoft.com/api
#VITE_SERVER_URL=https://server.gxwebsoft.com/api
VITE_THINK_URL=https://gxtyzx-api.websoft.top/api
VITE_API_URL=https://modules.gxwebsoft.com/api
#VITE_SERVER_URL=http://127.0.0.1:9090/api
VITE_SERVER_URL=http://127.0.0.1:9090/api
#VITE_API_URL=http://127.0.0.1:9001/api
#VITE_THINK_URL=http://127.0.0.1:9099/api
#/booking/bookingItem

View File

@@ -1,14 +1,14 @@
import request from '@/utils/request';
import type { ApiResult, PageResult } from '@/api';
import type { CmsDesign, CmsDesignParam } from './model';
import { MODULES_API_URL } from '@/config/setting';
import { SERVER_API_URL } from '@/config/setting';
/**
* 分页查询页面管理记录表
*/
export async function pageCmsDesign(params: CmsDesignParam) {
const res = await request.get<ApiResult<PageResult<CmsDesign>>>(
MODULES_API_URL + '/cms/cms-design/page',
SERVER_API_URL + '/cms/cms-design/page',
{
params
}
@@ -24,7 +24,7 @@ export async function pageCmsDesign(params: CmsDesignParam) {
*/
export async function listCmsDesign(params?: CmsDesignParam) {
const res = await request.get<ApiResult<CmsDesign[]>>(
MODULES_API_URL + '/cms/cms-design',
SERVER_API_URL + '/cms/cms-design',
{
params
}
@@ -40,7 +40,7 @@ export async function listCmsDesign(params?: CmsDesignParam) {
*/
export async function addCmsDesign(data: CmsDesign) {
const res = await request.post<ApiResult<unknown>>(
MODULES_API_URL + '/cms/cms-design',
SERVER_API_URL + '/cms/cms-design',
data
);
if (res.data.code === 0) {
@@ -54,7 +54,7 @@ export async function addCmsDesign(data: CmsDesign) {
*/
export async function updateCmsDesign(data: CmsDesign) {
const res = await request.put<ApiResult<unknown>>(
MODULES_API_URL + '/cms/cms-design',
SERVER_API_URL + '/cms/cms-design',
data
);
if (res.data.code === 0) {
@@ -68,7 +68,7 @@ export async function updateCmsDesign(data: CmsDesign) {
*/
export async function removeCmsDesign(id?: number) {
const res = await request.delete<ApiResult<unknown>>(
MODULES_API_URL + '/cms/cms-design/' + id
SERVER_API_URL + '/cms/cms-design/' + id
);
if (res.data.code === 0) {
return res.data.message;
@@ -81,7 +81,7 @@ export async function removeCmsDesign(id?: number) {
*/
export async function removeBatchCmsDesign(data: (number | undefined)[]) {
const res = await request.delete<ApiResult<unknown>>(
MODULES_API_URL + '/cms/cms-design/batch',
SERVER_API_URL + '/cms/cms-design/batch',
{
data
}
@@ -97,7 +97,7 @@ export async function removeBatchCmsDesign(data: (number | undefined)[]) {
*/
export async function getCmsDesign(id: number) {
const res = await request.get<ApiResult<CmsDesign>>(
MODULES_API_URL + '/cms/cms-design/' + id
SERVER_API_URL + '/cms/cms-design/' + id
);
if (res.data.code === 0 && res.data.data) {
return res.data.data;

View File

@@ -1,14 +1,14 @@
import request from '@/utils/request';
import type { ApiResult, PageResult } from '@/api';
import type { CmsNavigation, CmsNavigationParam } from './model';
import { MODULES_API_URL } from '@/config/setting';
import { SERVER_API_URL } from '@/config/setting';
/**
* 分页查询网站导航记录表
*/
export async function pageCmsNavigation(params: CmsNavigationParam) {
const res = await request.get<ApiResult<PageResult<CmsNavigation>>>(
MODULES_API_URL + '/cms/cms-navigation/page',
SERVER_API_URL + '/cms/cms-navigation/page',
{
params
}
@@ -24,7 +24,7 @@ export async function pageCmsNavigation(params: CmsNavigationParam) {
*/
export async function listCmsNavigation(params?: CmsNavigationParam) {
const res = await request.get<ApiResult<CmsNavigation[]>>(
MODULES_API_URL + '/cms/cms-navigation',
SERVER_API_URL + '/cms/cms-navigation',
{
params
}
@@ -40,7 +40,7 @@ export async function listCmsNavigation(params?: CmsNavigationParam) {
*/
export async function addCmsNavigation(data: CmsNavigation) {
const res = await request.post<ApiResult<unknown>>(
MODULES_API_URL + '/cms/cms-navigation',
SERVER_API_URL + '/cms/cms-navigation',
data
);
if (res.data.code === 0) {
@@ -54,7 +54,7 @@ export async function addCmsNavigation(data: CmsNavigation) {
*/
export async function updateCmsNavigation(data: CmsNavigation) {
const res = await request.put<ApiResult<unknown>>(
MODULES_API_URL + '/cms/cms-navigation',
SERVER_API_URL + '/cms/cms-navigation',
data
);
if (res.data.code === 0) {
@@ -68,7 +68,7 @@ export async function updateCmsNavigation(data: CmsNavigation) {
*/
export async function removeCmsNavigation(id?: number) {
const res = await request.delete<ApiResult<unknown>>(
MODULES_API_URL + '/cms/cms-navigation/' + id
SERVER_API_URL + '/cms/cms-navigation/' + id
);
if (res.data.code === 0) {
return res.data.message;
@@ -81,7 +81,7 @@ export async function removeCmsNavigation(id?: number) {
*/
export async function removeBatchCmsNavigation(data: (number | undefined)[]) {
const res = await request.delete<ApiResult<unknown>>(
MODULES_API_URL + '/cms/cms-navigation/batch',
SERVER_API_URL + '/cms/cms-navigation/batch',
{
data
}
@@ -97,7 +97,7 @@ export async function removeBatchCmsNavigation(data: (number | undefined)[]) {
*/
export async function getCmsNavigation(id: number) {
const res = await request.get<ApiResult<CmsNavigation>>(
MODULES_API_URL + '/cms/cms-navigation/' + id
SERVER_API_URL + '/cms/cms-navigation/' + id
);
if (res.data.code === 0 && res.data.data) {
return res.data.data;

View File

@@ -70,6 +70,7 @@ export interface CmsNavigation {
tenantId?: number;
// 创建时间
createTime?: string;
children?: CmsNavigation[];
}
/**

View File

@@ -1,7 +1,7 @@
import request from '@/utils/request';
import type { ApiResult, PageResult } from '@/api';
import type { CmsWebsite, CmsWebsiteParam } from './model';
import { SERVER_API_URL } from '@/config/setting';
import { MODULES_API_URL, SERVER_API_URL } from '@/config/setting';
/**
* 分页查询网站信息记录表
@@ -104,3 +104,16 @@ export async function getCmsWebsite(id: number) {
}
return Promise.reject(new Error(res.data.message));
}
/**
* 清除缓存
*/
export async function removeSiteInfoCache(key?: string) {
const res = await request.delete<ApiResult<unknown>>(
SERVER_API_URL + '/cms/cms-website/clearSiteInfo/' + key
);
if (res.data.code === 0) {
return res.data.message;
}
return Promise.reject(new Error(res.data.message));
}

View File

@@ -28,7 +28,7 @@ export interface CmsWebsite {
style?: string;
// 后台管理地址
adminUrl?: string;
// 应用版本 10免费版 20授权版 30永久授权
// 应用版本 10免费版 20专业版 30永久授权
version?: number;
// 服务到期时间
expirationTime?: string;

View File

@@ -1,130 +0,0 @@
import request from '@/utils/request';
import type { ApiResult, PageResult } from '@/api';
import type {
CompanyField,
CompanyFieldParam
} from '@/api/oa/company/field/model';
import { MODULES_API_URL } from '@/config/setting';
/**
* 分页查询客户资料
*/
export async function pageCompanyField(params: CompanyFieldParam) {
const res = await request.get<ApiResult<PageResult<CompanyField>>>(
MODULES_API_URL + '/oa/company-field/page',
{
params
}
);
console.log(res.data.data);
if (res.data.code === 0) {
return res.data.data;
}
return Promise.reject(new Error(res.data.message));
}
/**
* 查询客户资料列表
*/
export async function listCompanyField(params?: CompanyFieldParam) {
const res = await request.get<ApiResult<CompanyField[]>>(
MODULES_API_URL + '/oa/company-field',
{
params
}
);
if (res.data.code === 0 && res.data.data) {
return res.data.data;
}
return Promise.reject(new Error(res.data.message));
}
/**
* 根据id查询客户资料
*/
export async function getCompanyField(id: number) {
const res = await request.get<ApiResult<CompanyField>>(
MODULES_API_URL + '/oa/company-field/' + id
);
if (res.data.code === 0 && res.data.data) {
return res.data.data;
}
return Promise.reject(new Error(res.data.message));
}
/**
* 添加客户资料
*/
export async function addCompanyField(data: CompanyField) {
const res = await request.post<ApiResult<unknown>>(
MODULES_API_URL + '/oa/company-field',
data
);
if (res.data.code === 0) {
return res.data.message;
}
return Promise.reject(new Error(res.data.message));
}
/**
* 修改客户资料
*/
export async function updateCompanyField(data: CompanyField) {
const res = await request.put<ApiResult<unknown>>(
MODULES_API_URL + '/oa/company-field',
data
);
if (res.data.code === 0) {
return res.data.message;
}
return Promise.reject(new Error(res.data.message));
}
/**
* 删除客户资料
*/
export async function removeCompanyField(id?: number) {
const res = await request.delete<ApiResult<unknown>>(
MODULES_API_URL + '/oa/company-field/' + id
);
if (res.data.code === 0) {
return res.data.message;
}
return Promise.reject(new Error(res.data.message));
}
/**
* 批量删除客户资料
*/
export async function removeBatchCompanyField(data: (number | undefined)[]) {
const res = await request.delete<ApiResult<unknown>>(
MODULES_API_URL + '/oa/company-field/batch',
{
data
}
);
if (res.data.code === 0) {
return res.data.message;
}
return Promise.reject(new Error(res.data.message));
}
/**
* 检查IP是否存在
*/
export async function checkExistence(
field: string,
value: string,
id?: number
) {
const res = await request.get<ApiResult<unknown>>(
MODULES_API_URL + '/oa/company-field/existence',
{
params: { field, value, id }
}
);
if (res.data.code === 0) {
return res.data.message;
}
return Promise.reject(new Error(res.data.message));
}

View File

@@ -1,24 +0,0 @@
import type { PageParam } from '@/api';
/**
* 项目参数
*/
export interface CompanyField {
id?: number;
name?: string;
comments?: string;
userId?: number;
companyId?: number;
status?: any;
sortNumber?: any;
createTime?: string;
}
/**
* 项目参数搜索条件
*/
export interface CompanyFieldParam extends PageParam {
id?: number;
userId?: number;
companyId?: number;
}

View File

@@ -1,174 +0,0 @@
import request from '@/utils/request';
import type { ApiResult } from '@/api';
import type { Company, CompanyParam } from './model';
import { PageResult } from '@/api';
import { SERVER_API_URL } from '@/config/setting';
/**
* 查询企业资料
*/
export async function getCompany(params?: CompanyParam) {
const res = await request.get<ApiResult<Company>>(
SERVER_API_URL + '/system/company/profile',
{
params
}
);
if (res.data.code === 0 && res.data.data) {
return res.data.data;
}
return Promise.reject(new Error(res.data.message));
}
/**
* 查询企业资料不限租户
*/
export async function getCompanyAll(companyId: number) {
const res = await request.get<ApiResult<Company>>(
SERVER_API_URL + '/system/company/profileAll/' + companyId
);
if (res.data.code === 0 && res.data) {
console.log(res.data);
return res.data.data;
}
return Promise.reject(new Error(res.data.message));
}
/**
* 查询Company列表
*/
export async function pageCompany(params: CompanyParam) {
const res = await request.get<ApiResult<PageResult<Company>>>(
SERVER_API_URL + '/system/company/page',
{ params }
);
if (res.data.code === 0) {
return res.data.data;
}
return Promise.reject(new Error(res.data.message));
}
/**
* 查询Company列表不限租户
*/
export async function pageCompanyAll(params: CompanyParam) {
const res = await request.get<ApiResult<PageResult<Company>>>(
SERVER_API_URL + '/system/company/pageAll',
{ params }
);
if (res.data.code === 0) {
return res.data.data;
}
return Promise.reject(new Error(res.data.message));
}
/**
* 添加Company
*/
export async function addCompany(data: Company) {
const res = await request.post<ApiResult<unknown>>(
SERVER_API_URL + '/system/company',
data
);
if (res.data.code === 0) {
return res.data.message;
}
return Promise.reject(new Error(res.data.message));
}
/**
* 修改Company
*/
export async function updateCompany(data: Company) {
const res = await request.put<ApiResult<unknown>>(
SERVER_API_URL + '/system/company',
data
);
if (res.data.code === 0) {
return res.data.message;
}
return Promise.reject(new Error(res.data.message));
}
/**
* 删除Company
*/
export async function removeCompany(id?: number) {
const res = await request.delete<ApiResult<unknown>>(
SERVER_API_URL + '/system/company/removeAll/' + id
);
if (res.data.code === 0) {
return res.data.message;
}
return Promise.reject(new Error(res.data.message));
}
// 销毁租户
export async function destructionTenant(id?: number) {
const res = await request.delete<ApiResult<unknown>>(
SERVER_API_URL + '/system/company/destruction/' + id
);
if (res.data.code === 0) {
return res.data.message;
}
return Promise.reject(new Error(res.data.message));
}
/**
* 批量删除Company
*/
export async function removeBatchCompany(data: (number | undefined)[]) {
const res = await request.delete<ApiResult<unknown>>(
SERVER_API_URL + '/system/company/batch',
{
data
}
);
if (res.data.code === 0) {
return res.data.message;
}
return Promise.reject(new Error(res.data.message));
}
export async function checkExistence(
field: string,
value: string,
id?: number
) {
const res = await request.get<ApiResult<unknown>>(
SERVER_API_URL + '/system/company/existence',
{
params: { field, value, id }
}
);
if (res.data.code === 0) {
return res.data.message;
}
return Promise.reject(new Error(res.data.message));
}
/**
* 恢复Company
*/
export async function undeleteCompany(id?: number) {
const res = await request.delete<ApiResult<unknown>>(
SERVER_API_URL + '/system/company/undeleteAll/' + id
);
if (res.data.code === 0) {
return res.data.message;
}
return Promise.reject(new Error(res.data.message));
}
/**
* 销毁Company
*/
export async function destructionCompany(id?: number) {
const res = await request.delete<ApiResult<unknown>>(
SERVER_API_URL + '/system/company/destructionAll/' + id
);
if (res.data.code === 0) {
return res.data.message;
}
return Promise.reject(new Error(res.data.message));
}

View File

@@ -1,97 +0,0 @@
import { PageParam } from '@/api';
import { CompanyUser } from '@/api/oa/company/user/model';
import { CompanyField } from '@/api/oa/company/field/model';
/**
* 企业信息
*/
export interface Company {
companyId?: number;
shortName?: string;
companyName?: string;
companyType?: number;
companyTypeMultiple?: string;
appType?: string;
companyLogo?: string;
companyCode?: string;
domain?: string;
phone?: string;
tel?: string;
email?: string;
InvoiceHeader?: string;
startTime?: string;
expirationTime?: string;
version?: number;
members?: number;
storage?: string;
storageMax?: string;
buys?: number;
clicks?: number;
users?: number;
departments?: number;
industryParent?: string;
industryChild?: string;
country?: string;
province?: string;
city?: string;
region?: string;
address?: string;
latitude?: string;
longitude?: string;
businessEntity?: string;
comments?: any;
authentication?: number;
industryId?: number;
industryName?: string;
status?: number;
userId?: number;
planId?: number;
sortNumber?: number;
authoritative?: boolean;
merchantId?: number;
tenantId?: number;
tenantName?: string;
tenantCode?: string;
modules?: string;
requestUrl?: string;
socketUrl?: string;
serverUrl?: string;
modulesUrl?: string;
mpWeixinCode?: string;
h5Code?: string;
androidUrl?: string;
iosUrl?: string;
avatar?: string;
nickname?: string;
code?: number;
createTime?: string;
updateTime?: string;
password?: string;
password2?: string;
userList?: CompanyUser[];
fields?: CompanyField[];
}
/**
* 企业信息搜索条件
*/
export interface CompanyParam extends PageParam {
companyId?: number;
shortName?: string;
companyName?: string;
domain?: string;
recommend?: boolean;
keywords?: any;
authoritative?: number;
authentication?: number;
industryParent?: string;
industryChild?: string;
province?: string;
city?: string;
region?: string;
version?: number;
sceneType?: string;
createTimeStart?: string;
createTimeEnd?: string;
tenantId?: number;
}

View File

@@ -1,129 +0,0 @@
import request from '@/utils/request';
import type { ApiResult, PageResult } from '@/api';
import type {
CompanyUser,
CompanyUserParam
} from '@/api/oa/company/user/model';
import { MODULES_API_URL } from '@/config/setting';
/**
* 分页查询企业成员
*/
export async function pageCompanyUser(params: CompanyUserParam) {
const res = await request.get<ApiResult<PageResult<CompanyUser>>>(
MODULES_API_URL + '/oa/company-user/page',
{
params
}
);
if (res.data.code === 0) {
return res.data.data;
}
return Promise.reject(new Error(res.data.message));
}
/**
* 查询企业成员列表
*/
export async function listCompanyUser(params?: CompanyUserParam) {
const res = await request.get<ApiResult<CompanyUser[]>>(
MODULES_API_URL + '/oa/company-user',
{
params
}
);
if (res.data.code === 0 && res.data.data) {
return res.data.data;
}
return Promise.reject(new Error(res.data.message));
}
/**
* 根据id查询企业成员
*/
export async function getCompanyUser(id: number) {
const res = await request.get<ApiResult<CompanyUser>>(
MODULES_API_URL + '/oa/company-user/' + id
);
if (res.data.code === 0 && res.data.data) {
return res.data.data;
}
return Promise.reject(new Error(res.data.message));
}
/**
* 添加企业成员
*/
export async function addCompanyUser(data: CompanyUser) {
const res = await request.post<ApiResult<unknown>>(
MODULES_API_URL + '/oa/company-user',
data
);
if (res.data.code === 0) {
return res.data.message;
}
return Promise.reject(new Error(res.data.message));
}
/**
* 修改企业成员
*/
export async function updateCompanyUser(data: CompanyUser) {
const res = await request.put<ApiResult<unknown>>(
MODULES_API_URL + '/oa/company-user',
data
);
if (res.data.code === 0) {
return res.data.message;
}
return Promise.reject(new Error(res.data.message));
}
/**
* 删除企业成员
*/
export async function removeCompanyUser(id?: number) {
const res = await request.delete<ApiResult<unknown>>(
MODULES_API_URL + '/oa/company-user/' + id
);
if (res.data.code === 0) {
return res.data.message;
}
return Promise.reject(new Error(res.data.message));
}
/**
* 批量删除企业成员
*/
export async function removeBatchCompanyUser(data: (number | undefined)[]) {
const res = await request.delete<ApiResult<unknown>>(
MODULES_API_URL + '/oa/company-user/batch',
{
data
}
);
if (res.data.code === 0) {
return res.data.message;
}
return Promise.reject(new Error(res.data.message));
}
/**
* 检查IP是否存在
*/
export async function checkExistence(
field: string,
value: string,
id?: number
) {
const res = await request.get<ApiResult<unknown>>(
MODULES_API_URL + '/oa/company-user/existence',
{
params: { field, value, id }
}
);
if (res.data.code === 0) {
return res.data.message;
}
return Promise.reject(new Error(res.data.message));
}

View File

@@ -1,37 +0,0 @@
import type { PageParam } from '@/api';
/**
* 成员
*/
export interface CompanyUser {
// 成员id
companyUserId?: number;
role?: number;
userId?: number;
username?: string;
nickname?: string;
avatar?: string;
email?: string;
phone?: string;
mobile?: string;
companyId?: number;
status?: string;
createTime?: string;
}
/**
* 成员搜索条件
*/
export interface CompanyUserParam extends PageParam {
userId?: number;
companyId?: number;
role?: number;
}
export interface UserItem {
key: string;
isEdit?: boolean;
number?: string;
name?: string;
department?: string;
}

View File

@@ -94,7 +94,7 @@ export interface OaApp {
active?: string;
// 其它路由元信息
meta?: string;
// 版本0正式版 1体验版 2开发版
// 版本0正式版 1基础版 2开发版
edition?: string;
// 版本号
version?: string;

View File

@@ -28,7 +28,6 @@ export interface OaCompany {
tel?: string;
// 邮箱
email?: string;
@TableField("Invoice_header")
// 发票抬头
invoiceHeader?: string;
// 企业法人

View File

@@ -6,7 +6,7 @@ import type { PageParam } from '@/api';
export interface OaCompanyUser {
// 自增ID
companyUserId?: number;
// 角色10体验成员 20开发者成员 30管理员
// 角色10体验成员 20开发者成员 30管理员
role?: number;
// 用户ID
userId?: number;

View File

@@ -1,6 +1,6 @@
import type { PageParam } from '@/api';
import { GoodsSpec } from "@/api/shop/goodsSpec/model";
import { GoodsSku } from "@/api/shop/goodsSku/model";
import { GoodsSpec } from '@/api/shop/goodsSpec/model';
import { GoodsSku } from '@/api/shop/goodsSku/model';
export interface GoodsCount {
totalNum: number;
@@ -24,20 +24,32 @@ export interface Goods {
image?: string;
// 商品详情
content?: string;
// 商品分类
category?: string;
// 商品分类ID
categoryId?: number;
parentName?: string;
categoryName?: string;
// 一级分类
categoryParent?: string;
// categoryParent?: string;
// 二级分类
categoryChildren?: string;
// categoryChildren?: string;
// 商品规格 0单规格 1多规格
specs?: number;
// 货架
position?: string;
// 进货价
// 进货价
buyingPrice?: string;
// 商品价格
price?: string;
// 销售价格
salePrice?: string;
// 有赠品
priceGift?: boolean;
// 经销商价格
dealerPrice?: string;
// 有赠品
dealerGift?: string;
// 库存计算方式(10下单减库存 20付款减库存)
deductStockType?: number;
// 封面图

View File

@@ -1,77 +1,141 @@
import { PageParam } from '@/api';
import type { PageParam } from '@/api';
/**
* 企业信息
*/
export interface Company {
// 企业id
companyId?: number;
// 企业简称
shortName?: string;
// 企业全称
companyName?: string;
companyType?: number;
companyTypeMultiple?: string;
appType?: string;
companyLogo?: string;
// 企业标识
companyCode?: string;
// 类型 10企业 20政府单位
companyType?: string;
// 企业类型多选(已废弃)
companyTypeMultiple?: string;
// 应用标识
companyLogo?: string;
// 应用类型
appType?: string;
// 免费域名
freeDomain?: string;
// 绑定域名
domain?: string;
// 联系电话
phone?: string;
// 座机电话
tel?: string;
// 邮箱
email?: string;
InvoiceHeader?: string;
startTime?: string;
expirationTime?: string;
version?: number;
versionName?: string;
versionCode?: string;
members?: number;
storage?: string;
storageMax?: string;
buys?: number;
clicks?: number;
users?: number;
departments?: number;
industryParent?: string;
industryChild?: string;
country?: string;
province?: string;
city?: string;
region?: string;
address?: string;
latitude?: string;
longitude?: string;
// 发票抬头
invoiceHeader?: string;
// 企业法人
businessEntity?: string;
comments?: any;
// 服务开始时间
startTime?: string;
// 服务到期时间
expirationTime?: string;
// 应用版本 10体验版 20授权版 30永久授权
version?: number;
// 版本名称
versionName?: string;
// 版本号
versionCode?: string;
// 成员数量(人数上限)
members?: number;
// 成员数量(当前)
users?: number;
// 行业类型(父级)
industryParent?: string;
// 行业类型(子级)
industryChild?: string;
// 部门数量
departments?: number;
// 存储空间
storage?: string;
// 存储空间(上限)
storageMax?: string;
// 所在国家
country?: string;
// 所在省份
province?: string;
// 所在城市
city?: string;
// 所在辖区
region?: string;
// 街道地址
address?: string;
// 经度
longitude?: string;
// 纬度
latitude?: string;
// 备注
comments?: string;
// 是否实名认证
authentication?: number;
industryId?: number;
industryName?: string;
status?: number;
userId?: number;
planId?: number;
sortNumber?: number;
// 企业默认主体
authoritative?: boolean;
merchantId?: number;
tenantId?: number;
tenantName?: string;
tenantCode?: string;
modules?: string;
requestUrl?: string;
socketUrl?: string;
// 主控节点
serverUrl?: string;
// 模块节点
modulesUrl?: string;
// 重定向
redirectUrl?: string;
// request合法域名
requestUrl?: string;
// socket合法域名
socketUrl?: string;
// 总后台管理入口
adminUrl?: string;
// 商户端入口
merchantUrl?: string;
// 网站域名
websiteUrl?: string;
// 微信小程序二维码
mpWeixinCode?: string;
// 支付宝小程序二维码
mpAlipayCode?: string;
// H5端应用二维码
h5Code?: string;
// 安卓APP二维码
androidUrl?: string;
// 苹果APP二维码
iosUrl?: string;
avatar?: string;
nickname?: string;
code?: number;
// 是否推荐
recommend?: number;
// 点赞数量
likes?: number;
// 点击数量
clicks?: number;
// 购买数量
buys?: number;
// 是否含税, 0不含, 1含
isTax?: number;
// 当前克隆的租户ID
planId?: number;
// 状态
status?: number;
// 是否开启网站
websiteStatus?: number;
// 排序号
sortNumber?: number;
// 商户ID
merchantId?: number;
// 租户id
tid?: number;
// 用户ID
userId?: number;
// 是否删除, 0否, 1是
deleted?: number;
// 租户id
tenantId?: number;
// 创建时间
createTime?: string;
// 修改时间
updateTime?: string;
password?: string;
password2?: string;
collection?: boolean;
}
/**
@@ -79,24 +143,5 @@ export interface Company {
*/
export interface CompanyParam extends PageParam {
companyId?: number;
shortName?: string;
companyName?: string;
domain?: string;
recommend?: boolean;
keywords?: any;
authoritative?: number;
authentication?: number;
industryParent?: string;
industryChild?: string;
province?: string;
city?: string;
region?: string;
version?: number;
status?: number;
sceneType?: string;
createTimeStart?: string;
createTimeEnd?: string;
tenantId?: number;
collection?: boolean;
deleted?: number;
keywords?: string;
}

View File

@@ -0,0 +1,120 @@
import request from '@/utils/request';
import type { ApiResult, PageResult } from '@/api';
import type { Grade, GradeParam } from '@/api/user/grade/model';
import { SERVER_API_URL } from '@/config/setting';
/**
* 分页查询仓库
*/
export async function pageGrade(params: GradeParam) {
const res = await request.get<ApiResult<PageResult<Grade>>>(
SERVER_API_URL + '/system/user-grade/page',
{
params
}
);
if (res.data.code === 0) {
return res.data.data;
}
return Promise.reject(new Error(res.data.message));
}
/**
* 查询仓库列表
*/
export async function listGrade(params?: GradeParam) {
const res = await request.get<ApiResult<Grade[]>>(
SERVER_API_URL + '/system/user-grade',
{
params
}
);
if (res.data.code === 0 && res.data.data) {
return res.data.data;
}
return Promise.reject(new Error(res.data.message));
}
/**
* 添加仓库
*/
export async function addGrade(data: Grade) {
const res = await request.post<ApiResult<unknown>>(
SERVER_API_URL + '/system/user-grade',
data
);
if (res.data.code === 0) {
return res.data.message;
}
return Promise.reject(new Error(res.data.message));
}
/**
* 修改仓库
*/
export async function updateGrade(data: Grade) {
const res = await request.put<ApiResult<unknown>>(
SERVER_API_URL + '/system/user-grade',
data
);
if (res.data.code === 0) {
return res.data.message;
}
return Promise.reject(new Error(res.data.message));
}
/**
* 绑定仓库
*/
export async function bindGrade(data: Grade) {
const res = await request.put<ApiResult<unknown>>(
SERVER_API_URL + '/system/user-grade/bind',
data
);
if (res.data.code === 0) {
return res.data.message;
}
return Promise.reject(new Error(res.data.message));
}
/**
* 批量添加设备
*/
export async function addBatchGrade(data: Grade[]) {
const res = await request.post<ApiResult<unknown>>(
SERVER_API_URL + '/system/user-grade/batch',
data
);
if (res.data.code === 0) {
return res.data.message;
}
return Promise.reject(new Error(res.data.message));
}
/**
* 删除仓库
*/
export async function removeGrade(id?: number) {
const res = await request.delete<ApiResult<unknown>>(
SERVER_API_URL + '/system/user-grade/' + id
);
if (res.data.code === 0) {
return res.data.message;
}
return Promise.reject(new Error(res.data.message));
}
/**
* 批量删除仓库
*/
export async function removeBatchGrade(data: (number | undefined)[]) {
const res = await request.delete<ApiResult<unknown>>(
SERVER_API_URL + '/system/user-grade/batch',
{
data
}
);
if (res.data.code === 0) {
return res.data.message;
}
return Promise.reject(new Error(res.data.message));
}

View File

@@ -0,0 +1,28 @@
import type { PageParam } from '@/api';
export interface Grade {
gradeId?: number;
name?: string;
weight?: string;
upgrade?: string;
equity?: string;
commission?: string;
status?: number;
comments?: string;
sortNumber?: number;
userId?: number;
deleted?: number;
tenantId?: number;
createTime?: string;
updateTime?: string;
}
/**
* 搜索条件
*/
export interface GradeParam extends PageParam {
gradeId?: number;
name?: string;
status?: number;
keywords?: string;
}

View File

@@ -28,7 +28,7 @@ export interface Website {
style?: string;
// 后台管理地址
adminUrl?: string;
// 应用版本 10免费版 20授权版 30永久授权
// 应用版本 10免费版 20专业版 30永久授权
version?: number;
// 服务到期时间
expirationTime?: string;

View File

@@ -53,9 +53,9 @@
ColumnItem,
DatasourceFunction
} from 'ele-admin-pro/es/ele-pro-table/types';
import { pageCompany } from '@/api/oa/company';
import { pageCompany } from '@/api/system/company';
import { EleProTable } from 'ele-admin-pro';
import { Company, CompanyParam } from '@/api/oa/company/model';
import { Company, CompanyParam } from '@/api/system/company/model';
const props = defineProps<{
// 弹窗是否打开

View File

@@ -65,7 +65,7 @@
} from 'ele-admin-pro/es/ele-pro-table/types';
import { ExclamationCircleOutlined } from '@ant-design/icons-vue';
import { EleProTable } from 'ele-admin-pro';
import { Company, CompanyParam } from '@/api/oa/company/model';
import { Company, CompanyParam } from '@/api/system/company/model';
import { pageWebsiteField } from '@/api/system/website/field';
import { WebsiteField } from '@/api/system/website/field/model';

View File

@@ -41,7 +41,8 @@ export const useTenantStore = defineStore({
// 企业信息
if (company) {
this.company = company;
// localStorage.setItem('TenantId', String(company.tenantId));
localStorage.setItem('SysDomain', String(company.domain));
localStorage.setItem('TenantId', String(company.tenantId));
localStorage.setItem('TenantName', String(company.shortName));
localStorage.setItem('CompanyId', String(company.companyId));
}

View File

@@ -1,404 +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, 0是顶级" name="parentId">
<a-input
allow-clear
placeholder="请输入上级id, 0是顶级"
v-model:value="form.parentId"
/>
</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="model">
<a-input
allow-clear
placeholder="请输入模型"
v-model:value="form.model"
/>
</a-form-item>
<a-form-item label="标识" name="code">
<a-input
allow-clear
placeholder="请输入标识"
v-model:value="form.code"
/>
</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="component">
<a-input
allow-clear
placeholder="请输入菜单组件地址, 目录可为空"
v-model:value="form.component"
/>
</a-form-item>
<a-form-item label="打开位置" name="target">
<a-input
allow-clear
placeholder="请输入打开位置"
v-model:value="form.target"
/>
</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="图标颜色" name="color">
<a-input
allow-clear
placeholder="请输入图标颜色"
v-model:value="form.color"
/>
</a-form-item>
<a-form-item label="是否隐藏, 0否, 1是(仅注册路由不显示在左侧菜单)" name="hide">
<a-input
allow-clear
placeholder="请输入是否隐藏, 0否, 1是(仅注册路由不显示在左侧菜单)"
v-model:value="form.hide"
/>
</a-form-item>
<a-form-item label="可见类型 0所有人 1登录可见 2密码可见" name="permission">
<a-input
allow-clear
placeholder="请输入可见类型 0所有人 1登录可见 2密码可见"
v-model:value="form.permission"
/>
</a-form-item>
<a-form-item label="访问密码" name="password">
<a-input
allow-clear
placeholder="请输入访问密码"
v-model:value="form.password"
/>
</a-form-item>
<a-form-item label="位置 0不限 1顶部 2底部" name="position">
<a-input
allow-clear
placeholder="请输入位置 0不限 1顶部 2底部"
v-model:value="form.position"
/>
</a-form-item>
<a-form-item label="仅在顶部显示" name="top">
<a-input
allow-clear
placeholder="请输入仅在顶部显示"
v-model:value="form.top"
/>
</a-form-item>
<a-form-item label="仅在底部显示" name="bottom">
<a-input
allow-clear
placeholder="请输入仅在底部显示"
v-model:value="form.bottom"
/>
</a-form-item>
<a-form-item label="菜单侧栏选中的path" name="active">
<a-input
allow-clear
placeholder="请输入菜单侧栏选中的path"
v-model:value="form.active"
/>
</a-form-item>
<a-form-item label="其它路由元信息" name="meta">
<a-input
allow-clear
placeholder="请输入其它路由元信息"
v-model:value="form.meta"
/>
</a-form-item>
<a-form-item label="css样式" name="style">
<a-input
allow-clear
placeholder="请输入css样式"
v-model:value="form.style"
/>
</a-form-item>
<a-form-item label="父级栏目路由" name="parentPath">
<a-input
allow-clear
placeholder="请输入父级栏目路由"
v-model:value="form.parentPath"
/>
</a-form-item>
<a-form-item label="父级栏目名称" name="parentName">
<a-input
allow-clear
placeholder="请输入父级栏目名称"
v-model:value="form.parentName"
/>
</a-form-item>
<a-form-item label="模型名称" name="modelName">
<a-input
allow-clear
placeholder="请输入模型名称"
v-model:value="form.modelName"
/>
</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="pageId">
<a-input
allow-clear
placeholder="请输入绑定的页面(已废弃)"
v-model:value="form.pageId"
/>
</a-form-item>
<a-form-item label="是否微信小程序菜单" name="isMpWeixin">
<a-input
allow-clear
placeholder="请输入是否微信小程序菜单"
v-model:value="form.isMpWeixin"
/>
</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="home">
<a-input
allow-clear
placeholder="请输入设为首页"
v-model:value="form.home"
/>
</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="deleted">
<a-input
allow-clear
placeholder="请输入是否删除, 0否, 1是"
v-model:value="form.deleted"
/>
</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 { addCmsNavigation, updateCmsNavigation } from '@/api/cms/cmsNavigation';
import { CmsNavigation } from '@/api/cms/cmsNavigation/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?: CmsNavigation | 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<CmsNavigation>({
navigationId: undefined,
parentId: undefined,
title: undefined,
model: undefined,
code: undefined,
path: undefined,
component: undefined,
target: undefined,
icon: undefined,
color: undefined,
hide: undefined,
permission: undefined,
password: undefined,
position: undefined,
top: undefined,
bottom: undefined,
active: undefined,
meta: undefined,
style: undefined,
parentPath: undefined,
parentName: undefined,
modelName: undefined,
type: undefined,
pageId: undefined,
isMpWeixin: undefined,
userId: undefined,
home: undefined,
sortNumber: undefined,
comments: undefined,
deleted: undefined,
status: undefined,
tenantId: undefined,
createTime: undefined,
cmsNavigationId: undefined,
cmsNavigationName: '',
status: 0,
comments: '',
sortNumber: 100
});
/* 更新visible */
const updateVisible = (value: boolean) => {
emit('update:visible', value);
};
// 表单验证规则
const rules = reactive({
cmsNavigationName: [
{
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 ? updateCmsNavigation : addCmsNavigation;
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>

View File

@@ -0,0 +1,276 @@
<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 {
removeDesignRecord,
removeBatchDesignRecord,
updateDesignRecord
} from '@/api/cms/designRecord';
import type { DesignRecord } from '@/api/cms/designRecord/model';
import { Navigation } from '@/api/cms/navigation/model';
import { pageDesignRecord } from '@/api/cms/designRecord';
import { DesignRecordParam } from '@/api/cms/designRecord/model';
const props = defineProps<{
// 弹窗是否打开
visible: boolean;
// 修改回显的数据
categoryId?: number | null;
// 导航信息
data?: Navigation;
}>();
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<DesignRecord[]>([]);
// 当前编辑数据
const current = ref<DesignRecord | 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 pageDesignRecord({
...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?: DesignRecordParam) => {
selection.value = [];
tableRef?.value?.reload({ where: where });
};
/* 打开编辑弹窗 */
const openEdit = (row?: DesignRecord) => {
current.value = row ?? null;
showEdit.value = true;
};
/* 打开批量移动弹窗 */
const openMove = () => {
showMove.value = true;
};
/* 删除单个 */
const remove = (row: DesignRecord) => {
const hide = message.loading('请求中..', 0);
removeDesignRecord(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);
removeBatchDesignRecord(selection.value.map((d) => d.periodId))
.then((msg) => {
hide();
message.success(msg);
reload();
})
.catch((e) => {
hide();
message.error(e.message);
});
}
});
};
// 上移
const moveUp = (row?: DesignRecord) => {
updateDesignRecord({
periodId: row?.periodId,
sortNumber: Number(row?.sortNumber) - 1
}).then((msg) => {
message.success(msg);
reload();
});
};
/* 自定义行属性 */
const customRow = (record: DesignRecord) => {
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>

View File

@@ -0,0 +1,250 @@
<!-- 编辑弹窗 -->
<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="parentId">-->
<!-- <a-input-->
<!-- allow-clear-->
<!-- placeholder="请输入上级id, 0是顶级"-->
<!-- v-model:value="form.parentId"-->
<!-- />-->
<!-- </a-form-item>-->
<a-form-item label="选择组件" name="dictCode">
<SelectDictDictionary
dict-code="componentsType"
:placeholder="`选择组件`"
v-model:value="form.dictCode"
@done="chooseComponents"
/>
</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="styles">
<a-input allow-clear placeholder="样式" v-model:value="form.styles" />
</a-form-item>
<!-- 卡片 -->
<!-- <template v-if="form.dictCode == 'Card'">-->
<!-- <a-form-item label="标题" name="title">-->
<!-- <a-input allow-clear placeholder="标题" v-model:value="form.title" />-->
<!-- </a-form-item>-->
<!-- </template>-->
<!-- <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="状态" 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 { addDesignRecord, updateDesignRecord } from '@/api/cms/designRecord';
import { DesignRecord } from '@/api/cms/designRecord/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';
import { DictionaryData } from '@/api/system/dictionary-data/model';
// 是否是修改
const isUpdate = ref(false);
const useForm = Form.useForm;
// 是否开启响应式布局
const themeStore = useThemeStore();
const { styleResponsive } = storeToRefs(themeStore);
const props = defineProps<{
// 弹窗是否打开
visible: boolean;
// 修改回显的数据
data?: DesignRecord | null;
// 导航ID
categoryId?: number;
}>();
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<DesignRecord>({
id: undefined,
pageId: undefined,
parentId: undefined,
title: undefined,
styles: '',
keywords: undefined,
description: undefined,
path: undefined,
photo: undefined,
userId: undefined,
sortNumber: undefined,
comments: undefined,
status: undefined,
tenantId: undefined,
createTime: undefined,
designRecordId: undefined,
designRecordName: '',
status: 0,
comments: '',
sortNumber: 100
});
/* 更新visible */
const updateVisible = (value: boolean) => {
emit('update:visible', value);
};
// 表单验证规则
const rules = reactive({
dictCode: [
{
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 chooseComponents = (data: DictionaryData) => {
form.title = data.dictDataName;
form.dictCode = data.dictDataCode;
};
const { resetFields } = useForm(form, rules);
/* 保存编辑 */
const save = () => {
if (!formRef.value) {
return;
}
formRef.value
.validate()
.then(() => {
loading.value = true;
const formData = {
...form,
navigationId: props.categoryId
};
const saveOrUpdate = isUpdate.value
? updateDesignRecord
: addDesignRecord;
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>

View File

@@ -5,15 +5,15 @@
<template #icon>
<PlusOutlined />
</template>
<span>添加</span>
<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';
import { DesignParam } from '@/api/cms/design/model';
const props = withDefaults(
defineProps<{
@@ -24,7 +24,7 @@
);
const emit = defineEmits<{
(e: 'search', where?: GradeParam): void;
(e: 'search', where?: DesignParam): void;
(e: 'add'): void;
(e: 'remove'): void;
(e: 'batchMove'): void;

View File

@@ -0,0 +1,509 @@
<!-- 编辑弹窗 -->
<template>
<a-drawer
:width="1000"
:visible="visible"
:maskClosable="false"
:maxable="true"
:title="isUpdate ? '页面设计' : '添加页面设计'"
placement="left"
:confirm-loading="loading"
:body-style="{ paddingBottom: '28px' }"
@update:visible="updateVisible"
@ok="save"
>
<template #extra>
<a-button type="primary" style="margin-right: 8px" @click="save">保存</a-button>
<a-button @click="openSpmUrl(`${form.path}`)">预览</a-button>
</template>
<a-form
ref="formRef"
:model="form"
:rules="rules"
:label-col="styleResponsive ? { md: 2, sm: 5, xs: 24 } : { flex: '90px' }"
:wrapper-col="
styleResponsive ? { md: 21, sm: 19, xs: 24 } : { flex: '1' }
"
>
<a-form-item label="网站SEO">
<a-space direction="vertical"
class="w-full">
<a-input
allow-clear
:maxlength="100"
placeholder="Title"
v-model:value="form.name"
/>
<a-textarea
:rows="4"
:maxlength="200"
placeholder="Description"
v-model:value="form.description"
/>
<a-input
allow-clear
:maxlength="100"
placeholder="Keywords"
v-model:value="form.keywords"
/>
</a-space>
</a-form-item>
<a-form-item label="banner">
<a-space direction="vertical" class="w-full">
<div class="p-2">
<a-radio-group v-model:value="form.showBanner">
<a-radio :value="true">开启</a-radio>
<a-radio :value="false">关闭</a-radio>
</a-radio-group>
</div>
<template v-if="form.showBanner">
<SelectFile
:placeholder="`请选择背景图`"
:limit="1"
:data="images"
@done="chooseFile"
@del="onDeleteItem"
/>
<a-textarea
:rows="4"
:maxlength="200"
placeholder="Tailwind CSS风格"
v-model:value="form.style"
/>
<a-input
allow-clear
:maxlength="100"
:placeholder="`演示地址 demoUrl`"
v-model:value="form.demoUrl"
/>
<a-input
allow-clear
:maxlength="100"
:placeholder="`账号密码 admin,123456`"
v-model:value="form.account"
/>
<a-input
allow-clear
:maxlength="100"
:placeholder="`立即购买 buyUrl`"
v-model:value="form.buyUrl"
/>
<a-input
allow-clear
:maxlength="100"
:placeholder="`产品文档 docUrl`"
v-model:value="form.docUrl"
/>
</template>
</a-space>
<a-divider style="margin: 30px 0" />
</a-form-item>
<a-form-item label="展示方式" name="content">
<a-space direction="vertical" class="w-full">
<div class="p-1.5">
<a-radio-group v-model:value="form.showLayout">
<a-radio :value="false">简单</a-radio>
<a-radio :value="true">高级</a-radio>
</a-radio-group>
</div>
<template v-if="!form.showLayout">
<!-- 编辑器 -->
<div class="content">
<tinymce-editor
v-model:value="content"
:disabled="disabled"
:init="config"
placeholder="图片直接粘贴自动上传"
@paste="onPaste"
/>
</div>
</template>
<template v-if="form.showLayout">
<!-- 组件名称 -->
<a-space direction="vertical" class="w-full">
<template v-for="(item,index) in components" :key="index">
<a-card :title="`${item.name}`" class="layout-item w-full bg-gray-50 my-2">
<template #title>
<a-select
ref="select"
v-model:value="form.adType"
style="width: 120px"
>
<a-select-option value="图片广告">图片广告</a-select-option>
<a-select-option value="幻灯片">幻灯片</a-select-option>
<a-select-option value="视频广告">视频广告</a-select-option>
</a-select>
</template>
</a-card>
</template>
</a-space>
<a-button @click="addComponents">添加组件</a-button>
</template>
</a-space>
</a-form-item>
<!-- <a-form-item label="状态" 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>
</a-drawer>
</template>
<script lang="ts" setup>
import { ref, reactive, watch } from 'vue';
import { message } from 'ant-design-vue';
import { uuid} from 'ele-admin-pro';
import { addCmsDesign, pageCmsDesign, updateCmsDesign } from "@/api/cms/cmsDesign";
import { CmsDesign } from '@/api/cms/cmsDesign/model';
import { useThemeStore } from '@/store/modules/theme';
import { storeToRefs } from 'pinia';
import { FormInstance, Rule } from 'ant-design-vue/es/form';
import { ItemType } from 'ele-admin-pro/es/ele-image-upload/types';
import {uploadFile, uploadOss} from '@/api/system/file';
import TinymceEditor from "@/components/TinymceEditor/index.vue";
import useFormData from "@/utils/use-form-data";
import {removeSiteInfoCache} from "@/api/cms/cmsWebsite";
import {FileRecord} from "@/api/system/file/model";
import { openSpmUrl } from "@/utils/common";
// 是否是修改
const isUpdate = ref(false);
// 是否开启响应式布局
const themeStore = useThemeStore();
const { styleResponsive } = storeToRefs(themeStore);
const disabled = ref(false);
// 编辑器内容,双向绑定
const content = ref<any>('');
// 组件列表
const components = ref<any[]>();
const props = defineProps<{
// 弹窗是否打开
visible: boolean;
// 修改回显的数据
data?: CmsDesign | null;
//
categoryId?: number;
}>();
const emit = defineEmits<{
(e: 'done'): void;
(e: 'update:visible', visible: boolean): void;
}>();
// 提交状态
const loading = ref(false);
// 已上传数据
const images = ref<ItemType[]>([]);
// 表格选中数据
const formRef = ref<FormInstance | null>(null);
// 表单数据
const { form, resetFields, assignFields } = useFormData<CmsDesign>({
pageId: undefined,
name: '',
images: '',
path: '',
component: '/custom/index',
description: '',
keywords: '',
content: '',
type: '',
categoryId: undefined,
style: '',
status: 0,
comments: '',
sortNumber: 100,
navigationId: undefined,
showLayout: false,
layout: '',
btn: [],
showBanner: true,
buyUrl: '',
demoUrl: '',
account: '',
docUrl: ''
});
const editorRef = ref<InstanceType<typeof TinymceEditor> | null>(null);
const config = ref({
height: 500,
images_upload_handler: (blobInfo, success, error) => {
const file = blobInfo.blob();
const formData = new FormData();
formData.append('file', file, file.name);
uploadOss(file).then(res => {
success(res.url)
}).catch((msg) => {
error(msg);
})
return false;
},
// 自定义文件上传(这里使用把选择的文件转成 blob 演示)
file_picker_callback: (callback: any, _value: any, meta: any) => {
const input = document.createElement('input');
input.setAttribute('type', 'file');
// 设定文件可选类型
if (meta.filetype === 'image') {
input.setAttribute('accept', 'image/*');
} else if (meta.filetype === 'media') {
input.setAttribute('accept', 'video/*,.pdf');
}
input.onchange = () => {
const file = input.files?.[0];
if (!file) {
return;
}
if (meta.filetype === 'media') {
if (file.size / 1024 / 1024 > 200) {
editorRef.value?.alert({ content: '大小不能超过 200MB' });
return;
}
if (!file.type.startsWith('video/')) {
editorRef.value?.alert({ content: '只能选择视频文件' });
return;
}
uploadOss(file).then(res => {
callback(res.downloadUrl);
})
}
};
input.click();
}
});
/* 粘贴图片上传服务器并插入编辑器 */
const onPaste = (e) => {
const items = (e.clipboardData || e.originalEvent.clipboardData).items;
let hasFile = false;
for (let i = 0; i < items.length; i++) {
if (items[i].type.indexOf('image') !== -1) {
let file = items[i].getAsFile();
const item: ItemType = {
file,
uid: (file as any).lastModified,
name: file.name
};
uploadFile(<File>item.file)
.then((result) => {
const addPath = `<p><img class="content-img" src="${result.url}"></p>`;
content.value = content.value + addPath
})
.catch((e) => {
message.error(e.message);
});
hasFile = true;
}
}
if (hasFile) {
e.preventDefault();
}
}
/* 更新visible */
const updateVisible = (value: boolean) => {
emit('update:visible', value);
};
// 表单验证规则
const rules = reactive<Record<string, Rule[]>>({
name: [
{
required: true,
type: 'string',
message: '请填写页面名称',
trigger: 'blur'
}
],
path: [
{
required: true,
type: 'string',
message: '请填写路由地址',
trigger: 'blur'
}
],
component: [
{
required: true,
type: 'string',
message: '请填写组件路径',
trigger: 'blur'
}
]
});
/* 上传事件 */
const uploadHandler = (file: File) => {
const item: ItemType = {
file,
uid: (file as any).uid,
name: file.name
};
if (file.type.startsWith('video')) {
if (file.size / 1024 / 1024 > 200) {
message.error('大小不能超过 200MB');
return;
}
}
if (file.type.startsWith('image')) {
if (file.size / 1024 / 1024 > 5) {
message.error('大小不能超过 5MB');
return;
}
}
onUpload(item);
};
// 上传文件
const onUpload = (item: any) => {
const { file } = item;
uploadFile(file)
.then((data) => {
form.photo = data.path;
images.value.push({
uid: data.id,
url:
file.type == 'video/mp4'
? 'https://oss.wsdns.cn/20240301/6e4e32cb808245d4be336b9486961145.png'
: data.path,
status: 'done'
});
})
.catch((e) => {
message.error(e.message);
});
};
const chooseFile = (data: FileRecord) => {
images.value.push({
uid: data.id,
url: data.downloadUrl,
status: 'done'
});
form.photo = data.downloadUrl;
}
const onDeleteItem = (index: number) => {
images.value.splice(index,1)
form.photo = '';
}
const addComponents = () => {
if(!components.value){
components.value = [];
}
components.value?.push({
type: 'card',
name: '组件名称',
css: '',
data: []
})
}
const options = [{
value: 'primary',
label: 'primary',
},{
value: 'success',
label: 'success',
},{
value: 'warning',
label: 'warning',
},{
value: 'danger',
label: 'danger',
},{
value: 'info',
label: 'info',
},{
value: 'text',
label: 'text',
}];
const delBtn = (index: number) => {
form.btn?.splice(index,1)
}
/* 保存编辑 */
const save = () => {
if (!formRef.value) {
return;
}
formRef.value
.validate()
.then(() => {
loading.value = true;
console.log(form);
const formData = {
...form,
layout: JSON.stringify(form),
categoryId: props.categoryId,
content: content.value,
};
console.log(formData);
const saveOrUpdate = isUpdate.value ? updateCmsDesign : addCmsDesign;
saveOrUpdate(formData)
.then((msg) => {
loading.value = false;
message.success(msg);
updateVisible(false);
// 清除缓存
removeSiteInfoCache('SiteInfo:' + localStorage.getItem('TenantId'));
emit('done');
})
.catch((e) => {
loading.value = false;
message.error(e.message);
});
})
.catch(() => {});
};
watch(
() => props.visible,
(visible) => {
if (visible) {
// 查询页面设计元素
if(props.categoryId){
content.value = '';
images.value = []
pageCmsDesign({categoryId: props.categoryId,limit: 1}).then(res => {
const design = res?.list[0];
if(design){
assignFields(design);
if(design.layout){
assignFields(JSON.parse(design.layout));
}
if(design?.content){
content.value = design.content
}
if(design.photo){
form.photo = design.photo;
images.value.push({
uid: uuid(),
url: design.photo,
status: 'done'
})
}
isUpdate.value = true;
}else {
isUpdate.value = false;
content.value = '';
resetFields();
}
})
}
} else {
resetFields();
formRef.value?.clearValidate();
}
},
{ immediate: true }
);
</script>

View File

@@ -0,0 +1,451 @@
<!-- 编辑弹窗 -->
<template>
<ele-modal
:width="800"
:visible="visible"
:confirm-loading="loading"
:title="isUpdate ? '修改导航' : '新建导航'"
:body-style="{ paddingBottom: '8px' }"
@update:visible="updateVisible"
@ok="save"
>
<a-form
ref="formRef"
:model="form"
:rules="rules"
:label-col="styleResponsive ? { md: 6, sm: 4, xs: 24 } : { flex: '90px' }"
:wrapper-col="
styleResponsive ? { md: 18, sm: 20, xs: 24 } : { flex: '1' }
"
>
<a-row :gutter="16">
<a-col
v-bind="styleResponsive ? { md: 12, sm: 24, xs: 24 } : { span: 12 }"
>
<a-form-item label="上级分类" name="parentId">
<a-tree-select
allow-clear
:tree-data="navigationList"
tree-default-expand-all
placeholder="请选择上级分类"
:value="form.parentId || undefined"
:dropdown-style="{ maxHeight: '360px', overflow: 'auto' }"
@update:value="(value?: number) => (form.parentId = value)"
/>
</a-form-item>
<a-form-item label="菜单名称" name="title">
<a-input
allow-clear
placeholder="请输入菜单名称"
v-model:value="form.title"
@pressEnter="save"
/>
</a-form-item>
<a-form-item
:label="form.type == 9 ? '链接地址' : '路由地址'"
name="path"
v-if="isUpdate || form.model == 'links'"
>
<a-input
allow-clear
:placeholder="
form.type == 9 ? '请输入链接地址' : '/iphone-15-pro'
"
v-model:value="form.path"
@pressEnter="save"
/>
</a-form-item>
<a-form-item label="组件路径" name="component" v-if="isUpdate">
<a-input
allow-clear
disabled
placeholder="/pages/product/detail.vue"
v-model:value="form.component"
@pressEnter="save"
/>
</a-form-item>
<a-form-item label="css样式" name="style" v-if="isUpdate">
<a-input
allow-clear
placeholder="Tailwind CSS风格"
v-model:value="form.style"
@pressEnter="save"
/>
</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-col>
<a-col
v-bind="styleResponsive ? { md: 12, sm: 24, xs: 24 } : { span: 12 }"
>
<a-form-item label="模型" name="model">
<ChooseDictionary
dict-code="NavigationModel"
:placeholder="`选择模型`"
v-model:value="form.model"
@done="chooseModel"
/>
</a-form-item>
<a-form-item label="位置" name="top" v-if="isUpdate">
<a-radio-group v-model:value="form.position" @change="onPosition">
<a-radio :value="1">顶部</a-radio>
<a-radio :value="2">底部</a-radio>
<a-radio :value="0">不限</a-radio>
</a-radio-group>
</a-form-item>
<a-form-item label="排序" name="sortNumber">
<a-input-number
:min="0"
:max="99999"
placeholder="请输入排序号"
v-model:value="form.sortNumber"
@pressEnter="save"
/>
</a-form-item>
<a-form-item label="图标" name="icon">
<SelectFile
:placeholder="`请选择图片`"
:limit="1"
:data="images"
:width="50"
:height="50"
@done="chooseFile"
@del="onDeleteItem"
/>
</a-form-item>
<a-divider style="margin-bottom: 16px" />
<a-form-item label="状态" name="hide">
<a-space>
<a-switch
checked-children="显示"
un-checked-children="隐藏"
:checked="form.hide === 0"
@update:checked="updateHideValue"
/>
</a-space>
</a-form-item>
<a-form-item label="权限" name="permission" v-if="isUpdate">
<a-radio-group v-model:value="form.permission">
<a-radio :value="0">所有人</a-radio>
<a-radio :value="1">登录可见</a-radio>
<a-radio :value="2">密码可见</a-radio>
</a-radio-group>
</a-form-item>
<a-form-item
label="访问密码"
name="password"
v-if="form.permission == 2"
>
<a-tag>{{ form.password }}</a-tag>
</a-form-item>
</a-col>
</a-row>
</a-form>
</ele-modal>
</template>
<script lang="ts" setup>
import { ref, reactive, watch } from 'vue';
import { message } from 'ant-design-vue/es';
import type { FormInstance, Rule } from 'ant-design-vue/es/form';
import { storeToRefs } from 'pinia';
import { useThemeStore } from '@/store/modules/theme';
import useFormData from '@/utils/use-form-data';
import { CmsNavigation } from '@/api/cms/cmsNavigation/model';
import {
addCmsNavigation,
updateCmsNavigation
} from '@/api/cms/cmsNavigation';
import { removeSiteInfoCache } from '@/api/cms/cmsWebsite';
import { ItemType } from 'ele-admin-pro/es/ele-image-upload/types';
import { FileRecord } from '@/api/system/file/model';
// 是否开启响应式布局
const themeStore = useThemeStore();
const { styleResponsive } = storeToRefs(themeStore);
const emit = defineEmits<{
(e: 'done'): void;
(e: 'update:visible', visible: boolean): void;
}>();
const props = defineProps<{
// 弹窗是否打开
visible: boolean;
// 修改回显的数据
data?: CmsNavigation | null;
// 上级分类id
parentId?: number;
// 位置
position?: number;
// 全部导航数据
navigationList: CmsNavigation[];
}>();
//
const formRef = ref<FormInstance | null>(null);
// 是否是修改
const isUpdate = ref(false);
// 提交状态
const loading = ref(false);
// 已上传数据
const images = ref<ItemType[]>([]);
// 表单数据
const { form, resetFields, assignFields } = useFormData<CmsNavigation>({
navigationId: undefined,
model: undefined,
code: undefined,
modelName: undefined,
type: 0,
title: '',
parentId: 0,
parentName: undefined,
parentPath: undefined,
path: undefined,
component: undefined,
componentPath: '/pages/[custom].vue',
sortNumber: 100,
hide: 0,
permission: 0,
password: undefined,
position: 1,
top: 0,
bottom: 1,
status: 0,
pageId: 0,
articleCategoryId: 0,
articleId: 0,
pageName: '',
isMpWeixin: false
});
// 表单验证规则
const rules = reactive<Record<string, Rule[]>>({
title: [
{
required: true,
message: '请输入菜单名称',
type: 'string',
trigger: 'blur'
}
],
model: [
{
required: true,
message: '请选择模型',
type: 'string',
trigger: 'blur'
}
],
// component: [
// {
// required: true,
// type: 'string',
// trigger: 'blur',
// validator: (_rule: Rule, value: string) => {
// return new Promise<void>((resolve, reject) => {
// if (!value) {
// return reject('请填写组件路径');
// }
// if (value.charAt(0) != '/') {
// return reject('请填写路由地址,必须是以"/"开头的英文字母+数字');
// }
// if (isChinese(value)) {
// return reject('不支持中文');
// }
// resolve();
// });
// }
// }
// ],
// path: [
// {
// required: true,
// type: 'string',
// trigger: 'blur',
// validator: (_rule: Rule, value: string) => {
// return new Promise<void>((resolve, reject) => {
// if (!value) {
// return reject('请填写路由地址');
// }
// if (form.type == 9) {
// if (!isUrl(value)) {
// return reject('请输入正确的网址');
// }
// resolve();
// }
// if (form.type == 1) {
// if (form.pageId == 0) {
// return reject('请选择页面');
// }
// }
// if (value.charAt(0) != '/') {
// return reject('请填写路由地址,必须是以"/"开头的英文字母+数字');
// }
// if (isChinese(value)) {
// return reject('不支持中文');
// }
// resolve();
// // checkExistence('path', value, form.navigationId)
// // .then((msg) => {
// // return reject(msg);
// // })
// // .catch(() => {
// // resolve();
// // });
// });
// }
// }
// ],
status: [
{
required: true,
message: '请设置是否展示',
type: 'number',
trigger: 'blur'
}
]
});
const chooseModel = (item: any) => {
form.model = `${item.value}`;
form.modelName = `${item.label}`;
if (item.value == 'custom') {
form.path = `/custom-${form.navigationId}`;
form.component = `/pages/[${item.value}]/index.vue`;
return;
}
if (item.value == 'links') {
form.path = `https://`;
form.component = `/pages/${item.value}/index.vue`;
return;
}
if (!isUpdate.value) {
form.path = undefined;
form.component = `/pages/${item.value}/index.vue`;
return;
}
form.path = `/${item.value}/${form.navigationId}`;
form.component = `/pages/${item.value}/index.vue`;
};
const chooseFile = (data: FileRecord) => {
images.value.push({
uid: data.id,
url: data.path,
status: 'done'
});
form.icon = data.path;
};
const onDeleteItem = (index: number) => {
images.value.splice(index, 1);
form.icon = '';
};
const onPosition = (index: number) => {
if (form.position == 0) {
form.top = 0;
form.bottom = 0;
}
if (form.position == 1) {
form.top = 0;
form.bottom = 1;
}
if (form.position == 2) {
form.top = 1;
form.bottom = 0;
}
};
/* 保存编辑 */
const save = () => {
if (!formRef.value) {
return;
}
formRef.value
.validate()
.then(() => {
const navigationForm = {
...form,
parentId: form.parentId || 0
};
const saveOrUpdate = isUpdate.value
? updateCmsNavigation
: addCmsNavigation;
saveOrUpdate(navigationForm)
.then((msg) => {
message.success(msg);
updateVisible(false);
// 清除缓存
removeSiteInfoCache('RootSiteInfo');
emit('done');
})
.catch((e) => {
message.error(e.message);
});
})
.catch(() => {});
};
/* 更新visible */
const updateVisible = (value: boolean) => {
emit('update:visible', value);
};
const updateHideValue = (value: boolean) => {
form.hide = value ? 0 : 1;
};
watch(
() => props.visible,
(visible) => {
if (visible) {
form.position = props.position;
if (props.parentId) {
form.parentId = props.parentId;
}
if (props.data) {
assignFields({
...props.data,
tempPath: props.data.path
});
if (props.data.type == 2) {
form.pageName = props.data.title;
}
isUpdate.value = true;
} else {
isUpdate.value = false;
}
} else {
resetFields();
formRef.value?.clearValidate();
}
}
);
</script>
<script lang="ts">
import * as icons from '@/layout/menu-icons';
export default {
components: icons,
data() {
return {
iconData: [
{
title: '已引入的图标',
icons: Object.keys(icons)
}
]
};
}
};
</script>

View File

@@ -1,332 +1,428 @@
<template>
<div class="page">
<div class="ele-body">
<a-card :bordered="false" :body-style="{ padding: '16px' }">
<ele-pro-table
ref="tableRef"
row-key="cmsNavigationId"
:columns="columns"
:datasource="datasource"
:customRow="customRow"
tool-class="ele-toolbar-form"
class="sys-org-table"
>
<template #toolbar>
<search
<div class="ele-body">
<a-card :bordered="false">
<!-- 表格 -->
<ele-pro-table
ref="tableRef"
row-key="navigationId"
:columns="columns"
:datasource="datasource"
:parse-data="parseData"
:need-page="false"
:customRow="customRow"
:expand-icon-column-index="1"
:expanded-row-keys="expandedRowKeys"
:scroll="{ x: 1200 }"
cache-key="proCmsNavigationTable"
@done="onDone"
@expand="onExpand"
>
<template #toolbar>
<a-space>
<a-button type="primary" class="ele-btn-icon" @click="openEdit()">
<template #icon>
<plus-outlined />
</template>
<span>新建</span>
</a-button>
<a-button type="dashed" class="ele-btn-icon" @click="expandAll">
展开
</a-button>
<a-button type="dashed" class="ele-btn-icon" @click="foldAll">
折叠
</a-button>
<a-divider type="vertical" />
<a-radio-group v-model:value="position" @change="reload">
<a-radio-button :value="1">顶部</a-radio-button>
<a-radio-button :value="2">底部</a-radio-button>
<a-radio-button :value="0">不限</a-radio-button>
</a-radio-group>
<a-divider type="vertical" />
<!-- 搜索表单 -->
<a-input-search
allow-clear
v-model:value="searchText"
placeholder="请输入搜索关键词"
@search="reload"
:selection="selection"
@add="openEdit"
@remove="removeBatch"
@batchMove="openMove"
@pressEnter="reload"
/>
</a-space>
</template>
<template #bodyCell="{ column, record, index }">
<template v-if="column.key === 'path'">
<span class="cursor-pointer" v-if="isDirectory(record)"></span>
<span
v-else
@click="
openSpmUrl(
`https://${record.tenantId}.wsdns.cn${record.path}`,
record,
record.navigationId
)
"
class="ele-text-placeholder cursor-pointer"
>{{ record.path }}</span
>
</template>
<template #bodyCell="{ column, record }">
<template v-if="column.key === 'image'">
<a-image :src="record.image" :width="50" />
<template v-if="column.key === 'component'">
<template v-if="!isDirectory(record)">
<span class="ele-text-placeholder">{{ record.component }}</span>
</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 v-else>
<span></span>
</template>
</template>
</ele-pro-table>
</a-card>
<template v-if="column.key === 'model'">
<text class="ele-text-placeholder">{{ record.modelName }}</text>
</template>
<template v-if="column.key === 'type'">
<a-tag v-if="isExternalLink(record.path)" color="purple"
>外部链接</a-tag
>
<a-tag v-else-if="index === 0" color="orange">首页</a-tag>
<a-tag v-else-if="isExternalLink(record.component)" color="orange">
内链
</a-tag>
<span v-else-if="isDirectory(record)"></span>
<a-tag v-else>{{ record.modelName }}</a-tag>
</template>
<template v-else-if="column.key === 'title'">
<a-avatar
:size="22"
shape="square"
:src="`${record.image}`"
style="margin-right: 10px"
v-if="record.image"
/>
<span class="cursor-pointer" v-if="isDirectory(record)">{{
record.title
}}</span>
<span
v-else
@click="openSpmUrl(record.path, record, record.navigationId)"
class="cursor-pointer"
>{{ record.title }}</span
>
</template>
<template v-if="column.key === 'showIndex'">
<a-tag v-if="record.showIndex === 1" color="green">显示</a-tag>
<span v-else></span>
</template>
<template v-if="column.key === 'position'">
<a-space>
<span v-if="record.top === 0" class="ele-text-placeholder"
>顶部</span
>
<span v-if="record.bottom === 0" class="ele-text-placeholder"
>底部</span
>
<span v-if="record.top === 0 || record.bottom === 0"></span>
</a-space>
</template>
<template v-if="column.key === 'hide'">
<span v-if="record.hide === 0" class="ele-text-success">显示</span>
<span v-if="record.hide === 1" class="ele-text-placeholder"
>隐藏</span
>
</template>
<template v-else-if="column.key === 'action'">
<a-space>
<a-tooltip :title="`配置SEO及页面内容`">
<a class="text-fuchsia-300" @click="openDesign(record)">设计</a>
</a-tooltip>
<a-divider type="vertical" />
<a-tooltip :title="`添加子分类`">
<a @click="openEdit(null, record.navigationId)">添加</a>
</a-tooltip>
<!-- 编辑弹窗 -->
<CmsNavigationEdit v-model:visible="showEdit" :data="current" @done="reload" />
</div>
<a-divider type="vertical" />
<a @click="openEdit(record)">修改</a>
<a-divider type="vertical" />
<a-popconfirm
placement="topRight"
title="确定要删除此菜单吗?"
@confirm="remove(record)"
>
<a class="ele-text-danger">删除</a>
</a-popconfirm>
</a-space>
</template>
</template>
</ele-pro-table>
</a-card>
<!-- 编辑弹窗 -->
<CmsNavigationEdit
v-model:visible="showEdit"
:data="current"
:parent-id="parentId"
:navigation-list="navigationData"
:position="position"
@done="reload"
/>
<!-- 页面编辑弹窗 -->
<DesignEdit
v-model:visible="showDesignEdit"
:data="design"
:category-id="categoryId"
@done="reload"
/>
<!-- 页面组件弹窗 -->
<Components
v-model:visible="showDesignRecordEdit"
:data="current"
:category-id="categoryId"
@done="reload"
/>
</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 { ref } from 'vue';
import { message } from 'ant-design-vue/es';
import { PlusOutlined } from '@ant-design/icons-vue';
import type {
DatasourceFunction,
ColumnItem
ColumnItem,
EleProTableDone
} from 'ele-admin-pro/es/ele-pro-table/types';
import Search from './components/search.vue';
import CmsNavigationEdit from './components/cmsNavigationEdit.vue';
import { pageCmsNavigation, removeCmsNavigation, removeBatchCmsNavigation } from '@/api/cms/cmsNavigation';
import type { CmsNavigation, CmsNavigationParam } from '@/api/cms/cmsNavigation/model';
import {
messageLoading,
toDateString,
isExternalLink,
toTreeData,
eachTreeData
} from 'ele-admin-pro/es';
import type { EleProTable } from 'ele-admin-pro/es';
import CmsNavigationEdit from './components/navigation-edit.vue';
import DesignEdit from './components/design-edit.vue';
import Components from './components/components.vue';
import {
listCmsNavigation,
removeCmsNavigation
} from '@/api/cms/cmsNavigation';
import type {
CmsNavigation,
CmsNavigationParam
} from '@/api/cms/cmsNavigation/model';
import { openSpmUrl } from '@/utils/common';
import { getSiteInfo } from '@/api/layout';
import { CmsDesign } from '@/api/cms/cmsDesign/model';
import router from '@/router';
// 表格实例
const tableRef = ref<InstanceType<typeof EleProTable> | null>(null);
// 表格选中数据
const selection = ref<CmsNavigation[]>([]);
// 当前编辑数据
const current = ref<CmsNavigation | 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 pageCmsNavigation({
...where,
...orders,
page,
limit
});
};
// 表格列配置
const columns = ref<ColumnItem[]>([
{
title: 'ID',
dataIndex: 'navigationId',
key: 'navigationId',
align: 'center',
width: 90,
width: 80
},
{
title: '上级id, 0是顶级',
dataIndex: 'parentId',
key: 'parentId',
align: 'center',
},
{
title: '菜单名称',
title: '栏目名称',
dataIndex: 'title',
key: 'title',
align: 'center',
showSorterTooltip: false,
ellipsis: true
},
{
title: '路由地址',
dataIndex: 'path',
key: 'path'
},
{
title: '组件路径',
dataIndex: 'component',
hideInTable: true,
key: 'component'
},
{
title: '模型',
dataIndex: 'model',
key: 'model',
align: 'center',
width: 120
},
{
title: '标识',
dataIndex: 'code',
key: 'code',
align: 'center',
},
{
title: '菜单路由地址',
dataIndex: 'path',
key: 'path',
align: 'center',
},
{
title: '菜单组件地址, 目录可为空',
dataIndex: 'component',
key: 'component',
align: 'center',
},
{
title: '打开位置',
dataIndex: 'target',
key: 'target',
align: 'center',
},
{
title: '菜单图标',
dataIndex: 'icon',
key: 'icon',
align: 'center',
},
{
title: '图标颜色',
dataIndex: 'color',
key: 'color',
align: 'center',
},
{
title: '是否隐藏, 0否, 1是(仅注册路由不显示在左侧菜单)',
dataIndex: 'hide',
key: 'hide',
align: 'center',
},
{
title: '可见类型 0所有人 1登录可见 2密码可见',
dataIndex: 'permission',
key: 'permission',
align: 'center',
},
{
title: '访问密码',
dataIndex: 'password',
key: 'password',
align: 'center',
},
{
title: '位置 0不限 1顶部 2底部',
title: '位置',
dataIndex: 'position',
key: 'position',
align: 'center',
width: 120
},
{
title: '仅在顶部显示',
dataIndex: 'top',
key: 'top',
title: '状态',
dataIndex: 'hide',
key: 'hide',
align: 'center',
width: 120,
showSorterTooltip: false,
customRender: ({ text }) => ['显示', '隐藏'][text]
},
{
title: '仅在底部显示',
dataIndex: 'bottom',
key: 'bottom',
align: 'center',
},
{
title: '菜单侧栏选中的path',
dataIndex: 'active',
key: 'active',
align: 'center',
},
{
title: '其它路由元信息',
dataIndex: 'meta',
key: 'meta',
align: 'center',
},
{
title: 'css样式',
dataIndex: 'style',
key: 'style',
align: 'center',
},
{
title: '父级栏目路由',
dataIndex: 'parentPath',
key: 'parentPath',
align: 'center',
},
{
title: '父级栏目名称',
dataIndex: 'parentName',
key: 'parentName',
align: 'center',
},
{
title: '模型名称',
dataIndex: 'modelName',
key: 'modelName',
align: 'center',
},
{
title: '类型(已废弃)',
dataIndex: 'type',
key: 'type',
align: 'center',
},
{
title: '绑定的页面(已废弃)',
dataIndex: 'pageId',
key: 'pageId',
align: 'center',
},
{
title: '是否微信小程序菜单',
dataIndex: 'isMpWeixin',
key: 'isMpWeixin',
align: 'center',
},
{
title: '用户ID',
dataIndex: 'userId',
key: 'userId',
align: 'center',
},
{
title: '设为首页',
dataIndex: 'home',
key: 'home',
align: 'center',
},
{
title: '排序(数字越小越靠前)',
title: '排序',
dataIndex: 'sortNumber',
key: 'sortNumber',
align: 'center',
},
{
title: '备注',
dataIndex: 'comments',
key: 'comments',
align: 'center',
},
{
title: '是否删除, 0否, 1是',
dataIndex: 'deleted',
key: 'deleted',
align: 'center',
},
{
title: '状态, 0正常, 1冻结',
dataIndex: 'status',
key: 'status',
align: 'center',
width: 120,
showSorterTooltip: false
},
{
title: '创建时间',
dataIndex: 'createTime',
key: 'createTime',
align: 'center',
sorter: true,
showSorterTooltip: false,
ellipsis: true,
customRender: ({ text }) => toDateString(text, 'yyyy-MM-dd')
hideInTable: true,
width: 180,
customRender: ({ text }) => toDateString(text)
},
{
title: '操作',
key: 'action',
width: 180,
fixed: 'right',
width: 240,
align: 'center',
hideInSetting: true
fixed: 'right'
}
]);
/* 搜索 */
// 当前编辑数据
const current = ref<CmsNavigation | null>(null);
// 当前选中页面
const design = ref<CmsDesign>();
// 是否显示编辑弹窗
const showEdit = ref(false);
// 编辑内容
const showDesignEdit = ref(false);
// 页面组件
const showDesignRecordEdit = ref(false);
// 上级分类id
const parentId = ref<number>();
const categoryId = ref<number>();
// 分类数据
const navigationData = ref<CmsNavigation[]>([]);
// 表格展开的行
const expandedRowKeys = ref<number[]>([]);
const searchText = ref('');
const position = ref(1);
const tenantId = ref<number>();
const domain = ref<string>();
getSiteInfo().then((data) => {
tenantId.value = data.tenantId;
domain.value = data.domain;
});
// 表格数据源
const datasource: DatasourceFunction = ({ where }) => {
where = {};
where.keywords = searchText.value;
// where.position = position.value;
where.top = 0;
where.bottom = undefined;
if (position.value == 1) {
where.top = 0;
where.bottom = undefined;
}
if (position.value == 2) {
where.top = undefined;
where.bottom = 0;
}
if (position.value == 0) {
where.top = undefined;
where.bottom = undefined;
}
where.isMpWeixin = false;
return listCmsNavigation({ ...where });
};
/* 数据转为树形结构 */
const parseData = (data: CmsNavigation[]) => {
return toTreeData({
data: data.map((d) => {
return { ...d, key: d.navigationId, value: d.navigationId };
}),
idField: 'navigationId',
parentIdField: 'parentId'
});
};
/* 表格渲染完成回调 */
const onDone: EleProTableDone<CmsNavigation> = ({ data }) => {
navigationData.value = data;
};
/* 刷新表格 */
const reload = (where?: CmsNavigationParam) => {
selection.value = [];
tableRef?.value?.reload({ where: where });
tableRef?.value?.reload({ where });
};
/* 打开编辑弹窗 */
const openEdit = (row?: CmsNavigation) => {
const openEdit = (row?: CmsNavigation | null, id?: number) => {
current.value = row ?? null;
parentId.value = id;
showEdit.value = true;
};
/* 打开批量移动弹窗 */
const openMove = () => {
showMove.value = true;
// 跳转模型内容列表
const openDesign = (row?: CmsNavigation) => {
categoryId.value = row?.navigationId;
showDesignEdit.value = true;
return;
// if (row && isDirectory(row)) {
// categoryId.value = row?.navigationId;
// showDesignEdit.value = true;
// return;
// }
// TODO 单页模型
// if (row?.model == 'custom') {
// router.push({
// path: `/cms/design`,
// query: {
// id: row.navigationId,
// type: row.model
// }
// });
// return;
// }
// TODO 文章列表
// if (row?.model === 'article') {
// router.push({
// path: `/cms/article`,
// query: {
// id: row.navigationId,
// type: row.model
// }
// });
// return;
// }
// TODO 产品列表
// if (row?.model === 'product') {
// router.push({
// path: '/goods/index',
// query: { categoryId: row.navigationId, type: row.type }
// });
// return;
// }
};
const openLayout = (row?: CmsNavigation) => {
current.value = row ?? null;
categoryId.value = row?.navigationId;
showDesignRecordEdit.value = true;
};
/* 删除单个 */
const remove = (row: CmsNavigation) => {
const hide = message.loading('请求中..', 0);
removeCmsNavigation(row.cmsNavigationId)
console.log(row);
if (row.children?.length) {
message.error('请先删除子节点');
return;
}
const hide = messageLoading('请求中..', 0);
removeCmsNavigation(row.navigationId)
.then((msg) => {
hide();
message.success(msg);
@@ -338,36 +434,39 @@
});
};
/* 批量删除 */
const removeBatch = () => {
if (!selection.value.length) {
message.error('请至少选择一条数据');
return;
}
Modal.confirm({
title: '提示',
content: '确定要删除选中的记录吗?',
icon: createVNode(ExclamationCircleOutlined),
maskClosable: true,
onOk: () => {
const hide = message.loading('请求中..', 0);
removeBatchCmsNavigation(selection.value.map((d) => d.cmsNavigationId))
.then((msg) => {
hide();
message.success(msg);
reload();
})
.catch((e) => {
hide();
message.error(e.message);
});
/* 展开全部 */
const expandAll = () => {
let keys: number[] = [];
eachTreeData(navigationData.value, (d) => {
if (d.children && d.children.length && d.navigationId) {
keys.push(d.navigationId);
}
});
expandedRowKeys.value = keys;
};
/* 查询 */
const query = () => {
loading.value = true;
/* 折叠全部 */
const foldAll = () => {
expandedRowKeys.value = [];
};
/* 点击展开图标时触发 */
const onExpand = (expanded: boolean, record: CmsNavigation) => {
if (expanded) {
expandedRowKeys.value = [
...expandedRowKeys.value,
record.navigationId as number
];
} else {
expandedRowKeys.value = expandedRowKeys.value.filter(
(d) => d !== record.navigationId
);
}
};
/* 判断是否是目录 */
const isDirectory = (d: CmsNavigation) => {
return !!d.children?.length;
};
/* 自定义行属性 */
@@ -383,7 +482,6 @@
}
};
};
query();
</script>
<script lang="ts">
@@ -391,5 +489,3 @@
name: 'CmsNavigation'
};
</script>
<style lang="less" scoped></style>

View File

@@ -109,7 +109,7 @@
<!-- </a-form-item>-->
<!-- <a-form-item label="当前版本" name="version">-->
<!-- <a-tag color="red" v-if="form.version === 10">免费版</a-tag>-->
<!-- <a-tag color="green" v-if="form.version === 20">授权</a-tag>-->
<!-- <a-tag color="green" v-if="form.version === 20">专业</a-tag>-->
<!-- <a-tag color="cyan" v-if="form.version === 30">永久授权</a-tag>-->
<!-- </a-form-item>-->
<a-form-item label="状态" name="status">

View File

@@ -59,7 +59,7 @@
</template>
<template v-if="column.key === 'version'">
<text v-if="record.version === 10">免费版</text>
<text v-if="record.version === 20">授权</text>
<text v-if="record.version === 20">专业</text>
<text v-if="record.version === 30">永久授权</text>
</template>
<template v-if="column.key === 'status'">

View File

@@ -109,7 +109,7 @@
<!-- </a-form-item>-->
<!-- <a-form-item label="当前版本" name="version">-->
<!-- <a-tag color="red" v-if="form.version === 10">免费版</a-tag>-->
<!-- <a-tag color="green" v-if="form.version === 20">授权</a-tag>-->
<!-- <a-tag color="green" v-if="form.version === 20">专业</a-tag>-->
<!-- <a-tag color="cyan" v-if="form.version === 30">永久授权</a-tag>-->
<!-- </a-form-item>-->
<a-form-item label="状态" name="status">

View File

@@ -60,7 +60,7 @@
</template>
<template v-if="column.key === 'version'">
<text v-if="record.version === 10">免费版</text>
<text v-if="record.version === 20">授权</text>
<text v-if="record.version === 20">专业</text>
<text v-if="record.version === 30">永久授权</text>
</template>
<template v-if="column.key === 'status'">

View File

@@ -1,701 +0,0 @@
<!-- 编辑弹窗 -->
<template>
<ele-modal
width="60%"
:visible="visible"
:maskClosable="false"
:title="isUpdate ? '编辑企业' : '添加企业'"
:body-style="{ paddingBottom: '28px', backgroundColor: '#F0F2F5FF' }"
@update:visible="updateVisible"
@ok="save"
>
<a-form
ref="formRef"
:model="form"
:rules="rules"
:label-col="{ md: { span: 7 }, sm: { span: 4 }, xs: { span: 24 } }"
:wrapper-col="{ md: { span: 20 }, sm: { span: 20 }, xs: { span: 24 } }"
>
<a-card title="基本信息" :bordered="false">
<a-row :gutter="16">
<a-col
v-bind="styleResponsive ? { md: 11, sm: 24, xs: 24 } : { span: 8 }"
>
<a-form-item label="企业名称" name="companyName">
<a-input
allow-clear
placeholder="请输入企业完整名称"
v-model:value="form.companyName"
/>
</a-form-item>
<a-form-item label="客户类型" name="companyType">
<DictSelect
dict-code="CompanyType"
placeholder="请选择企业类型"
v-model:value="form.companyType"
/>
</a-form-item>
<a-form-item label="统一社会信用代码" name="companyCode">
<a-input
allow-clear
:maxlength="20"
placeholder="请输入社会统一信用代码"
v-model:value="form.companyCode"
/>
</a-form-item>
<a-form-item label="法定代表人" name="legal">
<a-input
allow-clear
:maxlength="20"
placeholder="请填写法定代表人"
v-model:value="form.businessEntity"
/>
</a-form-item>
<a-form-item label="手机号码" name="phone">
<a-input
allow-clear
:maxlength="20"
placeholder="请填写法定代表手机号"
v-model:value="form.phone"
/>
</a-form-item>
<a-form-item label="座机电话" name="tel">
<a-input
allow-clear
:maxlength="20"
placeholder="请填写座机电话"
v-model:value="form.tel"
/>
</a-form-item>
<a-form-item label="电子邮箱" name="email">
<a-input
allow-clear
placeholder="请填写电子邮箱"
v-model:value="form.email"
/>
</a-form-item>
<a-form-item label="官方网站" name="domain">
<a-input
allow-clear
:maxlength="20"
placeholder="请填写官方网站域名"
v-model:value="form.domain"
/>
</a-form-item>
<a-form-item label="LOGO" name="logo">
<SelectFile
:placeholder="`请选择图片`"
:limit="1"
:data="images"
@done="chooseFile"
@del="onDeleteItem"
/>
<!-- <ele-image-upload-->
<!-- v-model:value="images"-->
<!-- :accept="'image/png,image/jpeg,image/webp'"-->
<!-- :item-style="{ width: '120px', height: '120px' }"-->
<!-- :limit="1"-->
<!-- @upload="onUpload"-->
<!-- />-->
</a-form-item>
</a-col>
<a-col
v-bind="styleResponsive ? { md: 11, sm: 24, xs: 24 } : { span: 8 }"
>
<a-form-item label="客户简称" name="shortName">
<a-input
allow-clear
placeholder="请输入客户简称"
v-model:value="form.shortName"
/>
</a-form-item>
<a-form-item label="所属行业" name="industry">
<industry-select
v-model:value="industry"
valueField="label"
placeholder="请选择所属行业"
class="ele-fluid"
/>
</a-form-item>
<a-form-item label="所属区域" name="region">
<a-input-group compact>
<a-input
disabled
style="width: calc(100% - 32px)"
v-model:value="form.region"
placeholder="所属区域"
/>
<a-tooltip title="选择位置">
<a-button @click="openMapPicker">
<template #icon><EnvironmentOutlined /></template>
</a-button>
</a-tooltip>
</a-input-group>
</a-form-item>
<a-form-item label="所属区域" name="region">
<regions-select
v-model:value="city"
valueField="label"
placeholder="请选择省市区"
class="ele-fluid"
/>
</a-form-item>
<a-form-item label="办公地址" name="address">
<a-input
allow-clear
placeholder="请输入企业办公地址"
v-model:value="form.address"
/>
</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-col>
</a-row>
</a-card>
</a-form>
<!-- 地图位置选择弹窗 -->
<ele-map-picker
:need-city="true"
:dark-mode="darkMode"
v-model:visible="showMap"
:center="[108.374959, 22.767024]"
:search-type="1"
:zoom="12"
@done="onDone"
/>
</ele-modal>
</template>
<script lang="ts" setup>
import { ref, reactive, watch, createVNode, computed } from 'vue';
import { Form, message } from 'ant-design-vue';
import { assignObject, ipReg, toDateString } from "ele-admin-pro";
import { useUserStore } from '@/store/modules/user';
import { useThemeStore } from '@/store/modules/theme';
import { storeToRefs } from 'pinia';
// 中文语言文件
import zh_Hans from 'bytemd/locales/zh_Hans.json';
// 链接、删除线、复选框、表格等的插件
// 插件的中文语言文件
import zh_HansGfm from '@bytemd/plugin-gfm/locales/zh_Hans.json';
import 'bytemd/dist/index.min.css';
import 'github-markdown-css/github-markdown-light.css';
import { Modal } from 'ant-design-vue';
// import TinymceEditor from '@/components/TinymceEditor/index.vue';
import highlight from '@bytemd/plugin-highlight';
// 中文语言文件
import gfm from '@bytemd/plugin-gfm';
// // 预览界面的样式,这里用的 github 的 markdown 主题
import 'github-markdown-css/github-markdown-light.css';
import {
EyeOutlined,
EyeInvisibleOutlined,
EnvironmentOutlined
} from '@ant-design/icons-vue';
import { UploadOutlined } from '@/layout/menu-icons';
import { FormInstance } from 'ant-design-vue/es/form';
import { Company } from '@/api/oa/company/model';
import { ItemType } from 'ele-admin-pro/es/ele-image-upload/types';
import { User } from '@/api/system/user/model';
import { uploadFile, uploadOss } from "@/api/system/file";
import { FILE_SERVER, FILE_THUMBNAIL, TOKEN_STORE_NAME } from "@/config/setting";
import { listAppUser, addAppUser, removeAppUser } from "@/api/oa/app/user";
import { AppUser } from '@/api/oa/app/user/model'
import { updateCompany, addCompany } from "@/api/oa/company";
import { CenterPoint } from "ele-admin-pro/es/ele-map-picker/types";
import {FileRecord} from "@/api/system/file/model";
// 是否是修改
const isUpdate = ref(false);
const useForm = Form.useForm;
// 是否开启响应式布局
const themeStore = useThemeStore();
const { styleResponsive } = storeToRefs(themeStore);
const { darkMode } = storeToRefs(themeStore);
const props = defineProps<{
// 弹窗是否打开
visible: boolean;
// 修改回显的数据
data?: Company | null;
}>();
const emit = defineEmits<{
(e: 'done'): void;
(e: 'update:visible', visible: boolean): void;
}>();
// 提交状态
const loading = ref(false);
// 是否显示最大化切换按钮
const maxable = ref(true);
// 当期时间
const dayTime = toDateString(new Date());
// 已上传数据
const images = ref<ItemType[]>([]);
const appUsers = ref<AppUser[]>([]);
const selectUser = ref<string>();
const editStatus = ref(false);
// 类型 single|multiple
// const type = ref<string>('single');
// 日期范围选择
const dateRange = ref<[string, string]>(['', '']);
const content = ref('');
const requirement = ref('');
// 插件
const plugins = ref([
gfm({
locale: zh_HansGfm
}),
highlight()
]);
// 穿梭框数据
const breakfast = ref<any[]>();
const targetKeys1 = ref<any[]>([]);
const selectedKeys1 = ref<any[]>();
const lunch = ref<any[]>();
const targetKeys2 = ref<any[]>([]);
const selectedKeys2 = ref<any[]>();
const dinner = ref<any[]>();
const targetKeys3 = ref<any[]>([]);
const selectedKeys3 = ref<any[]>();
const selectedGoodsIds = ref<any[]>([]);
const showAddUserForm = ref(false);
// 是否显示地图选择弹窗
const showMap = ref(false);
// 省市区
const city = ref<string[]>([]);
const token = localStorage.getItem(TOKEN_STORE_NAME);
const formRef = ref<FormInstance | null>(null);
// 文件模型
interface FileItem {
uid: string;
name?: string;
status?: string;
response?: Response;
thumbUrl?: string;
downloadUrl?: string;
url: string;
}
interface FileInfo {
file: FileItem;
fileList: FileItem[];
}
// 文件上传
const file1 = ref<FileItem[]>();
const file2 = ref<FileItem[]>();
const file3 = ref<FileItem[]>();
// 用户信息
const form = reactive<Company>({
companyId: undefined,
companyName: '',
companyCode: '',
businessEntity: '',
companyType: undefined,
industryParent: '',
industryChild: '',
shortName: '',
tel: '',
phone: '',
email: '',
companyLogo: undefined,
domain: '',
sortNumber: undefined,
comments: '',
tenantName: '',
province: '',
city: '',
region: '',
latitude: '',
longitude: '',
address: '',
nickname: '',
tenantId: undefined,
createTime: '',
status: undefined,
userId: undefined
});
/* 更新visible */
const updateVisible = (value: boolean) => {
emit('update:visible', value);
};
// 表单验证规则
const rules = reactive({
companyName: [
{
required: true,
type: 'string',
message: '请输入企业简称',
trigger: 'blur'
}
],
companyType: [
{
required: true,
type: 'string',
message: '请选择企业类型',
trigger: 'blur'
}
],
// securityStatus: [
// {
// required: true,
// type: 'string',
// message: '请选择安全状态',
// trigger: 'blur'
// }
// ],
// companyName: [
// {
// required: true,
// type: 'string',
// message: '请选择租赁单位',
// trigger: 'blur'
// }
// ],
// appRegion: [
// {
// required: true,
// type: 'string',
// message: '请输入企业地址',
// trigger: 'blur'
// }
// ]
});
const { resetFields, validate, validateInfos } = useForm(form, rules);
const addUser = () => {
showAddUserForm.value = true;
};
const chooseCompanyName = (data: Company) => {
form.companyName = data.companyName;
form.companyId = data.companyId;
};
// 所属用户
const chooseUser = (data: User) => {
form.nickname = data.nickname
form.userId = data.userId
}
// 移除成员
const removeUser = (data: AppUser) => {
removeAppUser(data.appUserId)
.then((msg) => {
message.success(msg);
reload();
})
.catch((e) => {
message.error(e.message);
});
};
// 选择地区
const onChangeRegion = (value) => {
form.province = value[0];
form.city = value[1];
form.region = value[2];
};
/* 地图选择后回调 */
const onDone = (location: CenterPoint) => {
console.log(location);
city.value = [
`${location.city?.province}`,
`${location.city?.city}`,
`${location.city?.district}`
];
form.province = `${location.city?.province}`;
form.city = `${location.city?.city}`;
form.region = `${location.city?.district}`;
form.address = `${location.address}`;
form.latitude = `${location.lat}`;
form.longitude = `${location.lng}`;
showMap.value = false;
};
const handleEditStatus = () => {
editStatus.value = !editStatus.value;
}
// const chooseCompanyName = (data: Company) => {
// form.companyName = data.companyName;
// };
const chooseDismantlingCompany = (data: Company) => {
form.dismantlingCompany = data.companyName;
};
const chooseDirector = (data: User) => {
form.director = data.nickname;
};
const chooseDeveloper = (data: Company) => {
form.developer = data.companyName;
};
const chooseSalesman = (data: User) => {
form.salesman = data.nickname;
};
const changeAppCode = (e) => {
form.packageName = `com.gxwebsoft.${form.appCode}`;
form.appUrl = `https://apps.gxwebsoft.com/${form.appCode}`;
}
/* 打开位置选择 */
const openMapPicker = () => {
showMap.value = true;
};
const onFile1 = (info: FileInfo) => {
let resFileList = [...info.fileList];
file1.value = resFileList.map((file) => {
if (file.response) {
file.url = file.response.url;
}
return file;
});
form.file1 = JSON.stringify(file1.value);
};
const onFile2 = (info: FileInfo) => {
let resFileList = [...info.fileList];
file2.value = resFileList.map((file) => {
if (file.response) {
file.url = file.response.url;
}
return file;
});
form.file2 = JSON.stringify(file2.value);
};
const onFile3 = (info: FileInfo) => {
let resFileList = [...info.fileList];
file3.value = resFileList.map((file) => {
if (file.response) {
file.url = file.response.url;
}
return file;
});
form.file3 = JSON.stringify(file3.value);
};
const config = ref({
height: 500,
images_upload_handler: (blobInfo, success, error) => {
const file = blobInfo.blob();
// 使用 axios 上传,实际开发这段建议写在 api 中再调用 api
const formData = new FormData();
formData.append('file', file, file.name);
uploadFile(<File>file)
.then((result) => {
if (result.length) {
if (file.size / 1024 / 1024 > 2) {
error('图片大小不能超过 2MB');
}
success(FILE_SERVER + result.path);
} else {
error('上传失败');
}
})
.catch((e) => {
message.error(e.message);
});
}
});
// 上传文件
const onUpload = (item) => {
const { file } = item;
images.value = [];
uploadOss(file)
.then((data) => {
images.value.push({
uid: data.id,
url: data.url,
status: 'done'
});
form.companyLogo = data.url;
message.success('上传成功');
})
.catch((e) => {
message.error(e.message);
});
};
/* 粘贴图片上传服务器并插入编辑器 */
const onPaste = (e) => {
console.log(e);
const items = (e.clipboardData || e.originalEvent.clipboardData).items;
console.log(items);
let hasFile = false;
for (let i = 0; i < items.length; i++) {
if (items[i].type.indexOf('image') !== -1) {
let file = items[i].getAsFile();
const item: ItemType = {
file,
uid: (file as any).lastModified,
name: file.name
};
uploadFile(<File>item.file)
.then((result) => {
const addPath = '!['+result.name+']('+FILE_SERVER + result.path+')\n\r';
content.value = content.value + addPath
})
.catch((e) => {
message.error(e.message);
});
hasFile = true;
}
}
if (hasFile) {
e.preventDefault();
}
}
const chooseFile = (data: FileRecord) => {
images.value.push({
uid: data.id,
url: data.path,
status: 'done'
});
form.companyLogo = data.path;
}
const onDeleteItem = (index: number) => {
images.value.splice(index,1)
form.companyLogo = '';
}
/* 保存编辑 */
const save = () => {
if (!formRef.value) {
return;
}
formRef.value
.validate()
.then(() => {
loading.value = true;
const formData = {
...form,
content: content.value
};
const saveOrUpdate = isUpdate.value ? updateCompany : addCompany;
saveOrUpdate(formData)
.then((msg) => {
loading.value = false;
message.success(msg);
updateVisible(false);
emit('done');
})
.catch((e) => {
loading.value = false;
message.error(e.message);
});
})
.catch(() => {});
};
const industry = ref<string[]>([
String(form.industryParent),
String(form.industryChild)
]);
const reload = () => {
loading.value = true;
listAppUser({appId:props.data?.appId}).then(data => {
appUsers.value = data
})
};
watch(
() => props.visible,
(visible) => {
if (visible) {
content.value = '';
requirement.value = '';
if (props.data) {
assignObject(form, props.data);
images.value = [];
if(props.data.companyLogo){
images.value.push({
uid: 0,
url: props.data.companyLogo,
status: 'done'
});
}
industry.value[0] = String(props.data.industryParent);
industry.value[1] = String(props.data.industryChild);
if (props.data.content) {
content.value = props.data.content;
}
if (props.data.requirement){
requirement.value = props.data.requirement;
}
if (props.data.file1) {
file1.value = JSON.parse(props.data.file1);
}
if (props.data.file2) {
file2.value = JSON.parse(props.data.file2);
}
if (props.data.file3) {
file3.value = JSON.parse(props.data.file3);
}
// 所在地区
if(props.data.province){
city.value.push(props.data.province)
}
if(props.data.city){
city.value.push(props.data.city)
}
if(props.data.region){
city.value.push(props.data.region)
}
isUpdate.value = true;
reload();
} else {
isUpdate.value = false;
}
} else {
resetFields();
}
}
);
</script>
<style lang="less">
.upload-image {
display: flex;
justify-content: center;
}
.full-modal {
.ant-modal {
max-width: 100%;
top: 0;
padding-bottom: 0;
margin: 0;
}
.ant-modal-content {
display: flex;
flex-direction: column;
height: calc(100vh);
}
.ant-modal-body {
flex: 1;
}
}
</style>

View File

@@ -1,298 +0,0 @@
<!-- 用户编辑弹窗 -->
<template>
<a-drawer
width="60%"
:visible="visible"
:maxable="maxable"
:title="isUpdate ? '企业详情' : '添加企业'"
:body-style="{ paddingBottom: '28px' }"
@update:visible="updateVisible"
@ok="save"
>
<div style="background-color: #f3f3f3; padding: 8px">
<a-card title="基本信息">
<a-form
:label-col="
styleResponsive
? { lg: 2, md: 6, sm: 4, xs: 24 }
: { flex: '100px' }
"
:wrapper-col="styleResponsive ? { offset: 1 } : { offset: 1 }"
style="margin-top: 20px"
>
<a-form-item labelAlign="right" label="企业logo">
<ele-image-upload
v-model:value="logo"
disabled
:accept="'image/*'"
:item-style="{ width: '50px', height: '50px' }"
:limit="1"
@upload="onUpload"
@remove="onClose"
/>
</a-form-item>
<a-form-item label="企业简称">
<a-space size="middle">
<span>{{ form.shortName }}</span>
</a-space>
</a-form-item>
<a-form-item label="企业全称">
<a-space size="middle">
<span>{{ form.companyName }}</span>
<a-tag color="green" v-if="form.authentication">已认证</a-tag>
<a-tag color="orange" v-else>未认证</a-tag>
</a-space>
<!-- <div class="position-right">-->
<!-- <a-button>前往认证</a-button>-->
<!-- </div>-->
</a-form-item>
<a-form-item label="主体类型">
<a-tag v-if="form.companyType === 0">个人</a-tag>
<a-tag v-if="form.companyType === 10" color="">企业</a-tag>
</a-form-item>
<a-divider style="padding-bottom: 20px" />
<a-form-item label="所属地区">
<a-space size="middle">
<span>{{ form.province }} {{ form.city }} {{ form.region }}</span>
</a-space>
</a-form-item>
<a-form-item label="企业地址">
<a-space size="middle">
<span>{{ form.address }}</span>
</a-space>
</a-form-item>
<a-form-item label="联系电话">
<a-space size="middle">
<span>{{ form.phone }}</span>
</a-space>
</a-form-item>
<a-form-item label="企业域名">
<a-space size="middle">
<span>{{ form.domain }}</span>
</a-space>
</a-form-item>
<a-divider style="padding-bottom: 20px" />
<a-form-item label="企业成员">
<span>{{ form.users }}个成员</span>
</a-form-item>
<a-form-item label="企业部门">
<span>{{ form.departments }}</span>
<span>个部门</span>
</a-form-item>
<a-form-item label="人数上限">
<span>{{ form.users }}/{{ form.members }}</span>
<!-- <a-button type="link" v-if="form.authentication === false">-->
<!-- 去认证扩容-->
<!-- </a-button>-->
</a-form-item>
<a-form-item label="存储空间">
{{ getFileSize(form.storage) }}/{{ getFileSize(form.storageMax) }}
</a-form-item>
<a-divider style="padding-bottom: 20px" />
<a-form-item label="行业类型">
<a-space size="middle">
<span>{{ form.industryParent }} {{ form.industryChild }}</span>
</a-space>
</a-form-item>
<a-form-item label="应用版本">
<span v-if="form.version === 10">体验版试用期1个月</span>
<span v-if="form.version === 20">正式版</span>
<!-- <div class="position-right">-->
<!-- <a-button>前往升级</a-button>-->
<!-- </div>-->
</a-form-item>
<a-form-item label="到期时间">
<span>{{ form.expirationTime }}</span>
</a-form-item>
<a-form-item label="创建时间">
<span>{{ form.createTime }}</span>
</a-form-item>
<a-divider style="padding-bottom: 20px" />
<a-form-item label="企业ID">
<span>{{ form.tenantId }}</span>
</a-form-item>
<a-form-item label="企业号">
<span>{{ form.tenantCode }}</span>
</a-form-item>
<a-form-item
label="注销"
extra="注销后,当前应用的数据将会销毁,且不可恢复,请谨慎操作"
>
<a-button>注销</a-button>
</a-form-item>
</a-form>
</a-card>
</div>
</a-drawer>
</template>
<script lang="ts" setup>
import { ref, reactive, watch } from 'vue';
import { Form, message } from 'ant-design-vue';
import { assignObject } from 'ele-admin-pro';
import { addCompany, updateCompany } from '@/api/oa/company';
import { Company } from '@/api/oa/company/model';
import { useThemeStore } from '@/store/modules/theme';
import { storeToRefs } from 'pinia';
import { getFileSize } from '@/utils/common';
import { FormInstance } from 'ant-design-vue/es/form';
import { FILE_SERVER } from '@/config/setting';
// 是否是修改
const isUpdate = ref(false);
const useForm = Form.useForm;
// 是否开启响应式布局
const themeStore = useThemeStore();
const { styleResponsive } = storeToRefs(themeStore);
const props = defineProps<{
// 弹窗是否打开
visible: boolean;
// 修改回显的数据
data?: Company | null;
}>();
const emit = defineEmits<{
(e: 'done'): void;
(e: 'update:visible', visible: boolean): void;
}>();
// 提交状态
const loading = ref(false);
// 是否显示最大化切换按钮
const maxable = ref(true);
const logo = ref<any>([]);
const formRef = ref<FormInstance | null>(null);
// 表单信息
const form = reactive<Company>({
companyId: undefined,
companyName: '',
shortName: '',
companyType: undefined,
companyLogo: '',
domain: '',
phone: '',
invoiceHeader: '',
startTime: '',
expirationTime: '',
version: '',
members: undefined,
storage: '',
storageMax: '',
industryParent: '',
industryChild: '',
departments: undefined,
country: '',
province: '',
city: '',
region: '',
address: '',
longitude: '',
latitude: '',
comments: '',
authentication: '',
status: '',
userId: '',
users: '',
tenantId: undefined,
tenantCode: '',
createTime: ''
});
/* 更新visible */
const updateVisible = (value: boolean) => {
emit('update:visible', value);
};
// 表单验证规则
const rules = reactive({
name: [
{
required: true,
type: 'string',
message: '请输入企业名称',
trigger: 'blur'
}
],
model: [
{
required: true,
type: 'string',
message: '请输入企业型号',
trigger: 'blur'
}
],
factoryNo: [
{
required: true,
type: 'string',
message: '请输入出厂编号',
trigger: 'blur'
}
]
});
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 ? updateCompany : addCompany;
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) {
if (props.data) {
if (props.data.companyLogo) {
logo.value = [];
logo.value.push({
uid: 1,
url: FILE_SERVER + props.data.companyLogo,
status: ''
});
}
assignObject(form, props.data);
isUpdate.value = true;
} else {
isUpdate.value = false;
}
} else {
resetFields();
}
}
);
</script>
<style lang="less"></style>
<style lang="less">
.position-right {
position: absolute;
right: 0;
top: 0;
}
</style>

View File

@@ -1,232 +0,0 @@
<!-- 搜索表单 -->
<template>
<div style="display: flex; justify-content: space-between">
<a-space style="flex-wrap: wrap">
<a-button type="primary" class="ele-btn-icon" @click="add">
<template #icon>
<PlusOutlined />
</template>
<span>添加</span>
</a-button>
<!-- <a-button class="ele-btn-icon" @click="openImport">-->
<!-- <template #icon>-->
<!-- <UploadOutlined />-->
<!-- </template>-->
<!-- <span>导入</span>-->
<!-- </a-button>-->
<a-button
danger
type="primary"
class="ele-btn-icon"
v-if="selection?.length > 0"
@click="removeBatch"
>
<template #icon>
<DeleteOutlined />
</template>
<span>批量删除</span>
</a-button>
<a-button
class="ele-btn-icon"
v-if="selection?.length > 0"
@click="handleExport"
>
<span>导出</span>
</a-button>
</a-space>
<a-space :size="10" style="flex-wrap: wrap; margin-right: 20px">
<regions-select
v-model:value="city"
type="provinceCity"
valueField="label"
placeholder="请选择省市区"
class="ele-fluid"
@change="handleCity"
/>
<a-input-search
allow-clear
placeholder="请输入关键词"
v-model:value="searchText"
@pressEnter="search"
@search="search"
/>
<a-button @click="reset">重置</a-button>
</a-space>
</div>
</template>
<script lang="ts" setup>
import {
PlusOutlined,
UploadOutlined,
DeleteOutlined
} from '@ant-design/icons-vue';
import useSearch from '@/utils/use-search';
import { ref, watch } from 'vue';
import { utils, writeFile } from 'xlsx';
import { Company } from '@/api/system/company/model';
import { CompanyParam } from '@/api/system/company/model';
import { message } from 'ant-design-vue';
const props = withDefaults(
defineProps<{
// 选中的角色
selection?: [];
}>(),
{}
);
const emit = defineEmits<{
(e: 'search', where?: CompanyParam): void;
(e: 'add'): void;
(e: 'remove'): void;
(e: 'update', status?: number): void;
(e: 'import'): void;
}>();
// 表单数据
const { where, resetFields } = useSearch<CompanyParam>({
companyId: undefined,
companyName: undefined,
keywords: '',
authentication: undefined,
version: undefined,
province: '',
city: '',
region: ''
});
const tenantId = ref<number>();
if (localStorage.getItem('TenantId')) {
tenantId.value = Number(localStorage.getItem('TenantId'));
}
// 下来选项
const type = ref('keywords');
// 搜索内容
const searchText = ref('');
// 所在城市
const city = ref<string[]>([]);
// 日期范围选择
const dateRange = ref<[string, string]>(['', '']);
// 是否显示导入弹窗
const showImport = ref(false);
/* 搜索 */
const search = () => {
console.log(where);
resetFields();
const [d1, d2] = dateRange.value ?? [];
if (type.value == 'keywords') {
where.keywords = searchText.value;
}
emit('search', {
...where,
createTimeStart: d1 ? d1 + ' 00:00:00' : '',
createTimeEnd: d2 ? d2 + ' 23:59:59' : ''
});
};
// 导出
const handleExport = () => {
if (!props.selection?.length) {
message.error('请至少选择一条数据');
return;
}
const array: (string | number)[][] = [
[
'ID',
'企业名称',
'企业简称',
'所在城市',
'详细地址',
'联系电话',
'企业域名',
'实名认证',
'版本',
'注册时间',
'到期时间',
'备注'
]
];
props.selection?.forEach((d: Company) => {
let version = '';
if (d.version === 10) {
version = '体验版';
}
if (d.version === 20) {
version = '授权版';
}
array.push([
`${d.companyId}`,
`${d.companyName}`,
`${d.shortName}`,
`${d.city}`,
`${d.address}`,
`${d.phone}`,
`${d.domain}`,
`${d.authentication == 1 ? '已认证' : ''}`,
`${version}`,
`${d.createTime}`,
`${d.expirationTime}`,
`${d.users}`,
`${d.comments}`
]);
});
const sheetName = '企业导出列表';
const workbook = {
SheetNames: [sheetName],
Sheets: {}
};
const sheet = utils.aoa_to_sheet(array);
workbook.Sheets[sheetName] = sheet;
// 设置列宽
sheet['!cols'] = [
{ wch: 10 },
{ wch: 10 },
{ wch: 10 },
{ wch: 10 },
{ wch: 20 },
{ wch: 40 },
{ wch: 10 }
];
writeFile(workbook, '导出企业管理表.xlsx');
};
// 添加企业
const add = () => {
// if (tenantId.value == 5) {
// return window.open('https://www.gxwebsoft.com/register');
// }
emit('add');
};
// 导入
const openImport = () => {
showImport.value = true;
};
const handleSearch = () => {
emit('search', where);
};
/* 重置 */
const reset = () => {
resetFields();
search();
};
const handleCity = (text) => {
where.city = text[1];
emit('search', where);
};
// 批量删除
const removeBatch = () => {
emit('remove');
};
watch(
() => props.selection,
() => {}
);
</script>

View File

@@ -1,245 +0,0 @@
<!-- 用户编辑弹窗 -->
<template>
<ele-modal
width="80%"
:visible="visible"
:maskClosable="false"
:maxable="maxable"
:title="isUpdate ? '编辑' : '新增'"
:body-style="{ paddingBottom: '28px' }"
@update:visible="updateVisible"
@ok="save"
>
<a-form
ref="formRef"
:model="form"
:label-col="{ md: { span: 7 }, sm: { span: 4 }, xs: { span: 24 } }"
:wrapper-col="{ md: { span: 17 }, sm: { span: 20 }, xs: { span: 24 } }"
>
<!-- 编辑器 -->
<byte-md-editor
v-model:value="content"
placeholder="请输入您的内容,图片请直接粘贴"
:locale="zh_Hans"
mode="split"
:plugins="plugins"
height="500px"
:editorConfig="{ lineNumbers: true }"
@paste="onPaste"
/>
</a-form>
</ele-modal>
</template>
<script lang="ts" setup>
import { ref, reactive, watch } from 'vue';
import { Form, message } from 'ant-design-vue';
import {assignObject} from "ele-admin-pro";
import { addCompany, updateCompany } from '@/api/oa/company';
import type { Company } from '@/api/oa/company/model';
import { useThemeStore } from '@/store/modules/theme';
import { storeToRefs } from 'pinia';
// 中文语言文件
import zh_Hans from 'bytemd/locales/zh_Hans.json';
// 链接、删除线、复选框、表格等的插件
// 插件的中文语言文件
import zh_HansGfm from '@bytemd/plugin-gfm/locales/zh_Hans.json';
import 'bytemd/dist/index.min.css';
import 'github-markdown-css/github-markdown-light.css';
import highlight from '@bytemd/plugin-highlight';
// 中文语言文件
import gfm from '@bytemd/plugin-gfm';
// // 预览界面的样式,这里用的 github 的 markdown 主题
import 'github-markdown-css/github-markdown-light.css';
import {FormInstance} from 'ant-design-vue/es/form';
import { ItemType } from 'ele-admin-pro/es/ele-image-upload/types';
import { uploadFile } from "@/api/system/file";
import { TOKEN_STORE_NAME } from "@/config/setting";
// 是否是修改
const isUpdate = ref(false);
const useForm = Form.useForm;
// 是否开启响应式布局
const themeStore = useThemeStore();
const { styleResponsive } = storeToRefs(themeStore);
const props = defineProps<{
// 弹窗是否打开
visible: boolean;
// 修改回显的数据
data?: Company | null;
}>();
const emit = defineEmits<{
(e: 'done'): void;
(e: 'update:visible', visible: boolean): void;
}>();
// 提交状态
const loading = ref(false);
// 是否显示最大化切换按钮
const maxable = ref(true);
const images = ref<ItemType[]>([]);
const content = ref('');
// 插件
const plugins = ref([
gfm({
locale: zh_HansGfm
}),
highlight()
]);
const token = localStorage.getItem(TOKEN_STORE_NAME);
const formRef = ref<FormInstance | null>(null);
// 用户信息
const form = reactive<Company>({
// 应用id
companyId: undefined
});
/* 更新visible */
const updateVisible = (value: boolean) => {
emit('update:visible', value);
};
const { resetFields, validate, validateInfos } = useForm(form);
const config = ref({
height: 500,
images_upload_handler: (blobInfo, success, error) => {
const file = blobInfo.blob();
// 使用 axios 上传,实际开发这段建议写在 api 中再调用 api
const formData = new FormData();
formData.append('file', file, file.name);
uploadFile(<File>file)
.then((result) => {
if (result.length) {
if (file.size / 1024 / 1024 > 2) {
error('图片大小不能超过 2MB');
}
success(result.url);
} else {
error('上传失败');
}
})
.catch((e) => {
message.error(e.message);
});
},
});
/* 粘贴图片上传服务器并插入编辑器 */
const onPaste = (e) => {
const items = (e.clipboardData || e.originalEvent.clipboardData).items;
let hasFile = false;
for (let i = 0; i < items.length; i++) {
if (items[i].type.indexOf('image') !== -1) {
let file = items[i].getAsFile();
const item: ItemType = {
file,
uid: (file as any).lastModified,
name: file.name
};
uploadFile(<File>item.file)
.then((result) => {
const addPath = '!['+result.name+']('+ result.url+')\n\r';
content.value = content.value + addPath
})
.catch((e) => {
message.error(e.message);
});
hasFile = true;
}
}
if (hasFile) {
e.preventDefault();
}
}
/* 保存编辑 */
const save = () => {
if (!formRef.value) {
return;
}
formRef.value
.validate()
.then(() => {
loading.value = true;
const formData = {
...form,
content: content.value
};
const saveOrUpdate = isUpdate.value ? updateCompany : addCompany;
saveOrUpdate(formData)
.then((msg) => {
loading.value = false;
message.success(msg);
updateVisible(false);
emit('done');
})
.catch((e) => {
loading.value = false;
message.error(e.message);
});
})
.catch(() => {});
};
/* 上传事件 */
const uploadHandler = (file: File) => {
const item: ItemType = {
file,
uid: (file as any).uid,
name: file.name
};
if (!file.type.startsWith('image')) {
message.error('只能选择图片');
return;
}
if (file.size / 1024 / 1024 > 2) {
message.error('大小不能超过 2MB');
return;
}
onUpload(item);
};
// 上传文件
const onUpload = (item) => {
const { file } = item;
uploadFile(file)
.then((data) => {
images.value.push({
uid: data.id,
url: data.url,
status: 'done'
});
})
.catch((e) => {
message.error(e.message);
});
};
watch(
() => props.visible,
(visible) => {
if (visible) {
content.value = '';
if (props.data) {
assignObject(form, props.data);
if (props.data.content) {
content.value = props.data.content;
}
isUpdate.value = true;
} else {
isUpdate.value = false;
}
} else {
resetFields();
}
}
);
</script>

View File

@@ -1,60 +0,0 @@
<template>
<a-descriptions title="企业简介" :bordered="false">
<template #extra>
<a @click="openEdit">编辑</a>
</template>
</a-descriptions>
<byte-md-viewer :value="data.content" :plugins="plugins" />
<a-empty
v-if="data.content == ''"
image="https://gw.alipayobjects.com/mdn/miniapp_social/afts/img/A*pevERLJC9v0AAAAAAAAAAABjAQAAAQ/original"
:image-style="{
height: '60px'
}"
>
<template #description>
<span class="ele-text-placeholder">请填写企业简介</span>
</template>
<a-button type="primary" @click="openEdit">立即填写</a-button>
</a-empty>
<!-- 编辑弹窗 -->
<CompanyAboutEdit v-model:visible="showEdit" :data="data" @done="reload" />
</template>
<script lang="ts" setup>
import { ref } from 'vue';
import gfm from '@bytemd/plugin-gfm';
import zh_HansGfm from '@bytemd/plugin-gfm/locales/zh_Hans.json';
import highlight from '@bytemd/plugin-highlight';
import 'bytemd/dist/index.min.css';
import 'github-markdown-css/github-markdown-light.css';
import 'github-markdown-css/github-markdown-light.css';
import CompanyAboutEdit from './company-about-edit.vue';
defineProps<{
data: any;
}>();
const emit = defineEmits<{
(e: 'done'): void;
}>();
// 是否显示编辑弹窗
const showEdit = ref(false);
/* 打开编辑弹窗 */
const openEdit = () => {
showEdit.value = true;
};
const reload = () => {
emit('done');
};
// 插件
const plugins = ref([
gfm({
locale: zh_HansGfm
}),
highlight()
]);
</script>

View File

@@ -1,221 +0,0 @@
<!-- 角色编辑弹窗 -->
<template>
<ele-modal
:width="600"
:visible="visible"
:confirm-loading="loading"
:title="isUpdate ? '编辑内容' : '上传文件'"
:body-style="{ paddingBottom: '8px' }"
@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="fileName" v-if="!isUpdate">
<span
class="ele-text-success"
v-if="fileName"
style="margin-right: 10px"
>
{{ fileName }}
</span>
<a-upload
:show-upload-list="false"
:accept="'video/*'"
v-if="!fileName"
:customRequest="onUpload"
>
<a-button type="primary" class="ele-btn-icon">
<template #icon>
<UploadOutlined />
</template>
<span>上传文件</span>
</a-button>
</a-upload>
</a-form-item>
<a-form-item label="设置分类" name="name">
<SelectDict
dict-code="groupId"
:placeholder="`选择分类`"
v-model:value="form.groupName"
@done="chooseGroupId"
/>
</a-form-item>
<a-form-item label="文件名称" name="name">
<a-input
allow-clear
:maxlength="20"
placeholder="请输入文件名称"
v-model:value="form.name"
/>
</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>
</ele-modal>
</template>
<script lang="ts" setup>
import { ref, reactive, watch } from 'vue';
import { message } from 'ant-design-vue/es';
import type { FormInstance, Rule } from 'ant-design-vue/es/form';
import { storeToRefs } from 'pinia';
import { useThemeStore } from '@/store/modules/theme';
import useFormData from '@/utils/use-form-data';
import type { FileRecord } from '@/api/system/file/model';
import { messageLoading } from 'ele-admin-pro';
import { addFiles, updateFiles, uploadFile } from '@/api/system/file';
import { UploadOutlined } from '@ant-design/icons-vue';
import { RuleObject } from 'ant-design-vue/es/form';
import { DictData } from '@/api/system/dict-data/model';
// 是否开启响应式布局
const themeStore = useThemeStore();
const { styleResponsive } = storeToRefs(themeStore);
const emit = defineEmits<{
(e: 'done'): void;
(e: 'update:visible', visible: boolean): void;
}>();
const props = defineProps<{
// 弹窗是否打开
visible: boolean;
// 修改回显的数据
data?: FileRecord | null;
}>();
//
const formRef = ref<FormInstance | null>(null);
const fileName = ref('');
// 是否是修改
const isUpdate = ref(false);
// 提交状态
const loading = ref(false);
// 表单数据
const { form, resetFields, assignFields } = useFormData<FileRecord>({
id: 0,
name: '',
comments: ''
});
// 表单验证规则
const rules = reactive<Record<string, Rule[]>>({
fileName: [
{
required: true,
message: '请上传文件',
type: 'string',
trigger: 'blur',
validator: async (_rule: RuleObject) => {
if (!isUpdate.value && fileName.value.length == 0) {
return Promise.reject('请上传文件');
}
return Promise.resolve();
}
}
],
name: [
{
required: true,
message: '请输入文件名称',
type: 'string',
trigger: 'blur'
}
]
});
const chooseGroupId = (item: DictData) => {
form.groupId = item.dictDataId;
form.groupName = item.dictDataName;
};
// 上传文件
const onUpload = (item) => {
const { file } = item;
if (!file.type.startsWith('video')) {
message.error('文件格式不正确!');
return;
}
if (file.size / 1024 / 1024 > 100) {
message.error('大小不能超过 100MB');
return;
}
const hide = messageLoading({
content: '上传中..',
duration: 0,
mask: true
});
uploadFile(file)
.then((data) => {
hide();
fileName.value = String(data.name);
message.success('上传成功');
})
.catch((e) => {
message.error(e.message);
hide();
});
};
/* 保存编辑 */
const save = () => {
if (!formRef.value) {
return;
}
formRef.value
.validate()
.then(() => {
loading.value = true;
const saveOrUpdate = isUpdate.value ? updateFiles : addFiles;
saveOrUpdate(form)
.then((msg) => {
loading.value = false;
message.success(msg);
updateVisible(false);
emit('done');
})
.catch((e) => {
loading.value = false;
message.error(e.message);
});
})
.catch(() => {});
};
/* 更新visible */
const updateVisible = (value: boolean) => {
emit('update:visible', value);
};
watch(
() => props.visible,
(visible) => {
if (visible) {
if (props.data) {
assignFields(props.data);
isUpdate.value = true;
} else {
isUpdate.value = false;
}
} else {
resetFields();
formRef.value?.clearValidate();
}
}
);
</script>

View File

@@ -1,301 +0,0 @@
<template>
<!-- 表格 -->
<ele-pro-table
ref="tableRef"
row-key="id"
:columns="columns"
:datasource="datasource"
:customRow="customRow"
:scroll="{ x: 800 }"
cache-key="proCompanyAnnexTable"
>
<template #toolbar>
<a-space>
<a-upload :show-upload-list="false" :customRequest="onUpload">
<a-button class="ele-btn-icon">
<template #icon>
<UploadOutlined />
</template>
<span>上传文件</span>
</a-button>
</a-upload>
<a-button
danger
type="primary"
class="ele-btn-icon"
v-if="selection.length > 0"
@click="removeBatch"
>
<template #icon>
<delete-outlined />
</template>
<span>删除</span>
</a-button>
<a-input-search
allow-clear
v-model:value="searchText"
placeholder="请输入关键词"
@search="reload"
@pressEnter="reload"
/>
</a-space>
</template>
<template #bodyCell="{ column, record }">
<template v-if="column.dataIndex === 'name'">
<span>{{ record.name }}</span>
<a-tooltip :title="`复制链接地址`">
<copy-outlined
style="padding-left: 4px"
@click="copyText(record.url)"
/>
</a-tooltip>
</template>
<template v-if="column.key === 'action'">
<a @click="openNew(record.url)">预览</a>
<a-divider type="vertical" />
<a :href="record.downloadUrl" target="_blank">下载</a>
<a-divider type="vertical" />
<a @click="openEdit(record)">修改</a>
<a-divider type="vertical" />
<a-popconfirm
placement="topRight"
title="确定要删除此文件吗?"
@confirm="remove(record)"
>
<a class="ele-text-danger">删除</a>
</a-popconfirm>
</template>
</template>
</ele-pro-table>
<!-- 编辑弹窗 -->
<company-annex-edit v-model:visible="showEdit" :data="current" @done="reload" />
</template>
<script lang="ts" setup>
import { createVNode, ref, watch } from 'vue';
import { message, Modal } from 'ant-design-vue/es';
import {
UploadOutlined,
DeleteOutlined,
CopyOutlined,
ExclamationCircleOutlined
} from '@ant-design/icons-vue';
import type { EleProTable } from 'ele-admin-pro/es';
import type {
DatasourceFunction,
ColumnItem
} from 'ele-admin-pro/es/ele-pro-table/types';
import { messageLoading, toDateString } from 'ele-admin-pro/es';
import CompanyAnnexEdit from './company-annex-edit.vue';
import {
pageFiles,
removeFile,
removeFiles,
uploadFileLocalByCompany
} from '@/api/system/file';
import type { FileRecord, FileRecordParam } from '@/api/system/file/model';
import { copyText, openNew } from '@/utils/common';
const props = defineProps<{
companyId: any;
data: any;
}>();
// 表格实例
const tableRef = ref<InstanceType<typeof EleProTable> | null>(null);
// 表格选中数据
const selection = ref<FileRecord[]>([]);
// 当前编辑数据
const current = ref<FileRecord | null>(null);
// 是否显示编辑弹窗
const showEdit = ref(false);
const type = ref('name');
const groupId = ref<number>(0);
const searchText = ref('');
// 表格列配置
const columns = ref<ColumnItem[]>([
{
key: 'index',
width: 48,
align: 'center',
fixed: 'left',
hideInSetting: true,
customRender: ({ index }) => index + (tableRef.value?.tableIndex ?? 0)
},
{
title: '文件名称',
dataIndex: 'name',
ellipsis: true
},
{
title: '描述',
dataIndex: 'comments',
ellipsis: true
},
{
title: '文件大小',
dataIndex: 'length',
sorter: true,
showSorterTooltip: false,
ellipsis: true,
customRender: ({ text }) => {
if (text < 1024) {
return text + 'B';
} else if (text < 1024 * 1024) {
return (text / 1024).toFixed(1) + 'KB';
} else if (text < 1024 * 1024 * 1024) {
return (text / 1024 / 1024).toFixed(1) + 'M';
} else {
return (text / 1024 / 1024 / 1024).toFixed(1) + 'G';
}
},
width: 120
},
{
title: '上传者',
width: 120,
dataIndex: 'createNickname'
},
{
title: '上传时间',
dataIndex: 'createTime',
sorter: true,
width: 180,
showSorterTooltip: false,
ellipsis: true,
customRender: ({ text }) => toDateString(text)
},
{
title: '操作',
key: 'action',
width: 260,
align: 'center'
}
]);
// 表格数据源
const datasource: DatasourceFunction = ({ page, limit, where, orders }) => {
where = {};
if (type.value == 'name') {
where.name = searchText.value;
}
if (type.value == 'createNickname') {
where.createNickname = searchText.value;
}
if (groupId.value > 0) {
where.groupId = groupId.value;
}
// where.contentType = 'companylication';
where.companyId = props.companyId;
return pageFiles({ ...where, ...orders, page, limit });
};
/* 搜索 */
const reload = (where?: FileRecordParam) => {
selection.value = [];
tableRef?.value?.reload({ page: 1, where });
};
/* 打开编辑弹窗 */
const openEdit = (row?: FileRecord) => {
current.value = row ?? null;
showEdit.value = true;
};
/* 删除单个 */
const remove = (row: FileRecord) => {
const hide = messageLoading('请求中..', 0);
removeFile(row.id)
.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 = messageLoading('请求中..', 0);
removeFiles(selection.value.map((d) => d.id))
.then((msg) => {
hide();
message.success(msg);
reload();
})
.catch((e) => {
hide();
message.error(e.message);
});
}
});
};
// 上传文件
const onUpload = (item) => {
const { file } = item;
if (file.size / 1024 / 1024 > 100) {
message.error('大小不能超过 100MB');
return;
}
const hide = messageLoading({
content: '上传中..',
duration: 0,
mask: true
});
uploadFileLocalByCompany(file, props.data.companyId)
.then((data) => {
console.log(data);
hide();
message.success('上传成功');
reload();
})
.catch((e) => {
message.error(e.message);
hide();
});
};
/* 自定义行属性 */
const customRow = (record: FileRecord) => {
return {
// 行点击事件
onClick: () => {
// console.log(record);
},
// 行双击事件
onDblclick: () => {
window.open(record.url);
}
};
};
watch(
() => props.companyId,
(companyId) => {
if (companyId) {
reload();
}
},
{ immediate: true }
);
</script>
<script lang="ts">
export default {
name: 'CompanyAnnexIndex'
};
</script>

View File

@@ -1,177 +0,0 @@
<!-- 用户编辑弹窗 -->
<template>
<ele-modal
:width="1000"
: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="{ md: { span: 2 }, sm: { span: 4 }, xs: { span: 24 } }"
:wrapper-col="{ md: { span: 21 }, sm: { span: 22 }, xs: { span: 24 } }"
>
<a-form-item label="名称" name="name">
<a-input allow-clear placeholder="字段名称" v-model:value="form.name" />
</a-form-item>
<a-form-item label="资料" name="comments">
<!-- 编辑器 -->
<byte-md-editor
v-model:value="form.comments"
placeholder="资料内容"
:locale="zh_Hans"
mode="split"
:plugins="plugins"
height="300px"
maxLength="500"
:editorConfig="{ lineNumbers: true }"
/>
</a-form-item>
<a-form-item label="排序" name="sortNumber">
<a-input-number
:min="0"
:max="99999"
class="ele-fluid"
placeholder="请输入排序号"
v-model:value="form.sortNumber"
/>
</a-form-item>
</a-form>
</ele-modal>
</template>
<script lang="ts" setup>
import { ref, reactive, watch } from 'vue';
import { FormInstance } from 'ant-design-vue/es/form';
import { CompanyField } from '@/api/oa/company/field/model';
import useFormData from '@/utils/use-form-data';
import { decrypt, encrypt } from '@/utils/common';
import { addCompanyField, updateCompanyField } from '@/api/oa/company/field';
import { message } from 'ant-design-vue/es';
import zh_Hans from 'bytemd/locales/zh_Hans.json';
import gfm from '@bytemd/plugin-gfm';
import zh_HansGfm from '@bytemd/plugin-gfm/locales/zh_Hans.json';
import highlight from '@bytemd/plugin-highlight';
// 是否是修改
const isUpdate = ref(false);
const props = defineProps<{
// 弹窗是否打开
visible: boolean;
companyId: number | null | undefined;
// 修改回显的数据
data?: CompanyField | 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 { form, resetFields, assignFields } = useFormData<CompanyField>({
id: undefined,
companyId: undefined,
name: '',
comments: '',
status: 0,
sortNumber: 0
});
// 表单验证规则
const rules = reactive({
comments: [
{
required: true,
type: 'string',
message: '请填写内容'
}
],
name: [
{
required: true,
message: '请输入名称'
}
]
});
// 插件
const plugins = ref([
gfm({
locale: zh_HansGfm
}),
highlight()
]);
/* 更新visible */
const updateVisible = (value: boolean) => {
emit('update:visible', value);
};
/* 保存编辑 */
const save = () => {
if (!formRef.value) {
return;
}
formRef.value
.validate()
.then(() => {
loading.value = true;
const data = {
...form,
companyId: props.companyId
};
// 加密信息处理
if (form.comments != '') {
data.comments = encrypt(form.comments);
} else {
data.comments = undefined;
}
const saveOrUpdate = isUpdate.value ? updateCompanyField : addCompanyField;
console.log(isUpdate.value);
saveOrUpdate(data)
.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) {
if (props.data) {
const comments = decrypt(props.data.comments);
assignFields(props.data);
form.comments = comments;
isUpdate.value = true;
} else {
isUpdate.value = false;
}
} else {
resetFields();
}
}
);
</script>

View File

@@ -1,13 +0,0 @@
<template>
<a-button @click="add">添加资料</a-button>
</template>
<script lang="ts" setup>
const emit = defineEmits<{
(e: 'add'): void;
}>();
const add = () => {
emit('add');
};
</script>

View File

@@ -1,211 +0,0 @@
<template>
<div class="company-task">
<!-- 表格 -->
<ele-pro-table
ref="tableRef"
row-key="fieldId"
:columns="columns"
:datasource="datasource"
tool-class="ele-toolbar-form"
class="sys-org-table"
>
<template #toolbar>
<CompanyFieldSearch @add="openEdit" @remove="removeBatch" />
</template>
<template #bodyCell="{ column, record }">
<template v-if="column.key === 'comments'">
<byte-md-viewer
:value="decrypt(record.comments)"
:plugins="plugins"
/>
</template>
<template v-if="column.key === 'action'">
<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>
</template>
</template>
</ele-pro-table>
<!-- 编辑弹窗 -->
<CompanyFieldEdit
v-model:visible="showEdit"
:company-id="data.companyId"
:data="current"
@done="reload"
/>
</div>
</template>
<script lang="ts" setup>
import { createVNode, ref, watch } from 'vue';
import { message, Modal } from 'ant-design-vue';
import { ExclamationCircleOutlined } from '@ant-design/icons-vue';
import type { EleProTable } from 'ele-admin-pro';
import type { DatasourceFunction } from 'ele-admin-pro/es/ele-pro-table/types';
import CompanyFieldSearch from './company-field-search.vue';
import { decrypt } from '@/utils/common';
import { Company } from '@/api/oa/company/model';
import CompanyFieldEdit from './company-field-edit.vue';
import {
CompanyField,
CompanyFieldParam
} from '@/api/oa/company/field/model';
import {
pageCompanyField,
removeCompanyField,
removeBatchCompanyField,
updateCompanyField
} from '@/api/oa/company/field';
import { ArrowUpOutlined } from '@ant-design/icons-vue';
import gfm from '@bytemd/plugin-gfm';
import zh_HansGfm from '@bytemd/plugin-gfm/locales/zh_Hans.json';
import highlight from '@bytemd/plugin-highlight';
const props = defineProps<{
companyId: any;
data: Company;
}>();
// 表格实例
const tableRef = ref<InstanceType<typeof EleProTable> | null>(null);
const selection = ref<any[]>();
// 当前编辑数据
const current = ref<CompanyField | null>(null);
// 是否显示编辑弹窗
const showEdit = ref(false);
// 表格数据源
const datasource: DatasourceFunction = ({ page, limit, where, orders }) => {
// 搜索条件
where.companyId = props.companyId;
return pageCompanyField({
...where,
...orders,
page,
limit
});
};
// 表格列配置
const columns = ref<any[]>([
{
title: '名称',
dataIndex: 'name',
width: 180
},
{
title: '内容',
dataIndex: 'comments',
key: 'comments',
ellipsis: true
},
{
title: '排序',
dataIndex: 'sortNumber',
sorter: true,
width: 100,
align: 'center'
},
{
title: '操作',
key: 'action',
width: 180,
align: 'center',
hideInSetting: true
}
]);
const moveUp = (row?: CompanyField) => {
updateCompanyField({
id: row?.id,
sortNumber: Number(row?.sortNumber) + 1
}).then((msg) => {
message.success(msg);
reload();
});
};
/* 打开编辑弹窗 */
const openEdit = (row?: CompanyField) => {
current.value = row ?? null;
showEdit.value = true;
};
/* 搜索 */
const reload = (where?: CompanyFieldParam) => {
selection.value = [];
tableRef?.value?.reload({ where: where });
};
/* 删除单个 */
const remove = (row: CompanyField) => {
const hide = message.loading('请求中..', 0);
removeCompanyField(row.id)
.then((msg) => {
hide();
message.success(msg);
reload();
})
.catch((e) => {
hide();
message.error(e.message);
});
};
/* 批量删除 */
const removeBatch = () => {
if (!selection.value?.length) {
message.error('请至少选择一条数据');
return;
}
if (selection.value?.length) {
Modal.confirm({
title: '提示',
content: '确定要删除选中的记录吗?',
icon: createVNode(ExclamationCircleOutlined),
maskClosable: true,
onOk: () => {
const hide = message.loading('请求中..', 0);
removeBatchCompanyField(selection.value.map((d) => d.id))
.then((msg) => {
hide();
message.success(msg);
reload();
})
.catch((e) => {
hide();
message.error(e.message);
});
}
});
}
};
// 插件
const plugins = ref([
gfm({
locale: zh_HansGfm
}),
highlight()
]);
watch(
() => props.companyId,
(companyId) => {
if (companyId) {
reload();
}
},
{ immediate: true }
);
</script>
<script lang="ts">
export default {
name: 'CompanyFieldIndex'
};
</script>

View File

@@ -1,500 +0,0 @@
<!-- 用户编辑弹窗 -->
<template>
<ele-modal
width="80%"
: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="{ md: { span: 7 }, sm: { span: 4 }, xs: { span: 24 } }"
:wrapper-col="{ md: { span: 17 }, sm: { span: 20 }, xs: { span: 24 } }"
>
<a-descriptions title="基本信息" :column="2" bordered>
<a-descriptions-item
label="AppId"
:labelStyle="{ width: '200px', color: '#808080' }"
>{{ data.appId }}</a-descriptions-item
>
<a-descriptions-item
label="状态"
:labelStyle="{ width: '200px', color: '#808080' }"
>
<DictSelect
dict-code="appstoreStatus"
placeholder="请选择应用状态"
style="width: 200px"
v-model:value="form.appStatus"
/>
</a-descriptions-item>
<a-descriptions-item
label="AppSecret"
:labelStyle="{ width: '200px', color: '#808080' }"
>
<span>****</span>
</a-descriptions-item>
<a-descriptions-item
label="名称"
:labelStyle="{ width: '200px', color: '#808080' }"
>
<a-input
allow-clear
placeholder="请输入应用名称"
v-model:value="form.appName"
/></a-descriptions-item>
<a-descriptions-item
label="标识"
:labelStyle="{ width: '200px', color: '#808080' }"
><a-input
allow-clear
placeholder="请输入应用标识(英文字母)"
v-model:value="form.appCode"
@change="changeAppCode"
/></a-descriptions-item>
<a-descriptions-item
label="所属企业"
:labelStyle="{ width: '200px', color: '#808080' }"
>
<SelectCompany
:placeholder="`所属企业`"
v-model:value="form.companyName"
@done="chooseCompanyName"
/>
</a-descriptions-item>
<a-descriptions-item
label="主域名"
:labelStyle="{ width: '200px', color: '#808080' }"
>
<a-input
allow-clear
placeholder="请输入主域名"
v-model:value="form.appUrl"
/>
</a-descriptions-item>
<a-descriptions-item
label="项目类型"
:labelStyle="{ width: '200px', color: '#808080' }"
>
<DictSelect
dict-code="appType"
placeholder="请选择项目类型"
v-model:value="form.appType"
/>
</a-descriptions-item>
<a-descriptions-item
label="描述"
:span="2"
layout="vertical"
:labelStyle="{ width: '200px', color: '#808080' }"
>
<a-textarea
:rows="4"
:maxlength="200"
placeholder="请输入应用描述"
v-model:value="form.comments"
/>
</a-descriptions-item>
<a-descriptions-item
label="头像"
layout="vertical"
:labelStyle="{ width: '200px', color: '#808080' }"
>
<ele-image-upload
v-model:value="logo"
:item-style="{ width: '90px', height: '90px' }"
:limit="1"
@upload="onUploadIcon"
/>
</a-descriptions-item>
<a-descriptions-item
label="二维码"
layout="vertical"
:labelStyle="{ width: '200px', color: '#808080' }"
>
<ele-image-upload
v-model:value="appQrcode"
:item-style="{ width: '90px', height: '90px' }"
:limit="1"
@upload="onUploadQrcode"
/>
</a-descriptions-item>
</a-descriptions>
</a-form>
</ele-modal>
</template>
<script lang="ts" setup>
import { ref, reactive, watch } from 'vue';
import { Form, message } from 'ant-design-vue';
import { assignObject, ipReg, isChinese } from 'ele-admin-pro';
import { addApp, updateApp } from '@/api/oa/app';
import type { App } from '@/api/oa/app/model';
import { FormInstance, RuleObject } from 'ant-design-vue/es/form';
import { Company } from '@/api/system/company/model';
import { ItemType } from 'ele-admin-pro/es/ele-image-upload/types';
import { uploadFile } from '@/api/system/file';
import { TOKEN_STORE_NAME } from '@/config/setting';
// 是否是修改
const isUpdate = ref(false);
const useForm = Form.useForm;
const props = defineProps<{
// 弹窗是否打开
visible: boolean;
// 修改回显的数据
data?: App | null;
}>();
const emit = defineEmits<{
(e: 'done'): void;
(e: 'update:visible', visible: boolean): void;
}>();
// 提交状态
const loading = ref(false);
// 是否显示最大化切换按钮
const maxable = ref(true);
// 当期时间
// 已上传数据
const logo = ref<ItemType[]>([]);
const appQrcode = ref<ItemType[]>([]);
const images = ref<ItemType[]>([]);
// 日期范围选择
const content = ref('');
const token = localStorage.getItem(TOKEN_STORE_NAME);
const formRef = ref<FormInstance | null>(null);
// 用户信息
const form = reactive<App>({
// 应用id
appId: undefined,
// 应用秘钥
appSecret: '',
enName: '',
// 应用名称
appName: '',
// 上级id, 0是顶级
parentId: undefined,
// 应用编号
appCode: '',
// 应用图标
appIcon: '',
appQrcode: '',
// 应用截图
images: '',
appType: undefined,
appTypeMultiple: undefined,
// 菜单类型
menuType: undefined,
// 应用地址
appUrl: '',
// 后台管理地址
adminUrl: undefined,
// 下载地址
downUrl: undefined,
serverUrl: undefined,
callbackUrl: undefined,
gitUrl: undefined,
docsUrl: undefined,
prototypeUrl: undefined,
ipAddress: undefined,
fileUrl: undefined,
// 应用包名
packageName: '',
// 点击次数
clicks: '',
// 安装次数
installs: '',
// 项目介绍
content: '',
// 开发者(个人)
developer: '',
director: '',
projectDirector: '',
salesman: '',
// 软件定价
price: '',
// 评分
score: '',
// 星级
star: '',
// 菜单组件地址
component: '',
// 菜单路由地址
path: '',
// 权限标识
authority: '',
// 打开位置
target: '',
// 是否隐藏, 0否, 1是(仅注册路由不显示在左侧菜单)
hide: undefined,
// 菜单侧栏选中的path
active: '',
// 其它路由元信息
meta: '',
// 版本
edition: '',
// 版本号
version: '',
// 是否已安装
isUse: undefined,
// 排序
sortNumber: undefined,
// 备注
comments: undefined,
tenantName: '',
companyName: '',
// 租户编号
tenantCode: '',
// 租户id
tenantId: undefined,
// 创建时间
createTime: '',
appStatus: '开发中',
// 状态
status: undefined,
// 发布者
userId: '',
// 发布者昵称
nickname: '',
// 子菜单
children: [],
// 权限树回显选中状态, 0未选中, 1选中
checked: false,
//
key: undefined,
//
value: undefined,
//
parentIds: [],
//
openType: undefined,
//
search: undefined
});
/* 更新visible */
const updateVisible = (value: boolean) => {
emit('update:visible', value);
};
// 表单验证规则
const rules = reactive({
appName: [
{
required: true,
type: 'string',
message: '请输入应用名称',
trigger: 'blur'
}
],
companyName: [
{
required: true,
type: 'string',
message: '请选择所属企业',
trigger: 'blur'
}
],
appCode: [
{
required: true,
type: 'string',
message: '请输入应用标识(英文字母)',
trigger: 'blur',
validator: async (_rule: RuleObject, value: string) => {
if (isChinese(value)) {
return Promise.reject('请输入正确的应用标识');
}
return Promise.resolve();
}
}
],
appType: [
{
required: true,
message: '请选择项目类型'
}
],
ipAddress: [
{
pattern: ipReg,
message: 'IP地址不合法',
type: 'string'
}
],
appStatus: [
{
required: true,
type: 'string',
message: '请选择应用状态',
trigger: 'blur'
}
]
});
const { resetFields, validate } = useForm(form, rules);
const chooseCompanyName = (data: Company) => {
form.appUrl = data.domain;
form.companyName = data.companyName;
form.companyId = data.companyId;
form.tenantId = data.tenantId;
};
const changeAppCode = (e) => {
form.packageName = `com.gxwebsoft.${form.appCode}`;
};
/* 保存编辑 */
const save = () => {
if (!formRef.value) {
return;
}
formRef.value
.validate()
.then(() => {
loading.value = true;
const formData = {
...form,
content: content.value,
search: form.search ? 1 : 0,
images: JSON.stringify(images.value)
// appTypeMultiple: JSON.stringify(form.appTypeMultiple)
};
const saveOrUpdate = isUpdate.value ? updateApp : addApp;
saveOrUpdate(formData)
.then((msg) => {
loading.value = false;
message.success(msg);
updateVisible(false);
emit('done');
})
.catch((e) => {
loading.value = false;
message.error(e.message);
});
})
.catch(() => {});
};
// 上传文件:应用图标
const onUploadIcon = (item) => {
const { file } = item;
logo.value = [];
uploadFile(file)
.then((data) => {
logo.value.push({
uid: data.id,
url: data.url,
status: 'done'
});
form.appIcon = data.url;
message.success('上传成功');
})
.catch((e) => {
message.error(e.message);
});
};
const onUploadQrcode = (item) => {
const { file } = item;
appQrcode.value = [];
uploadFile(file)
.then((data) => {
appQrcode.value.push({
uid: data.id,
url: data.url,
status: 'done'
});
form.appQrcode = data.url;
message.success('上传成功');
})
.catch((e) => {
message.error(e.message);
});
};
// 上传文件
const onUpload = (item) => {
const { file } = item;
uploadFile(file)
.then((data) => {
images.value.push({
uid: data.id,
url: data.url,
status: 'done'
});
})
.catch((e) => {
message.error(e.message);
});
};
const reload = () => {
loading.value = true;
};
watch(
() => props.visible,
(visible) => {
if (visible) {
content.value = '';
logo.value = [];
images.value = [];
appQrcode.value = [];
if (props.data) {
assignObject(form, props.data);
if (props.data.appIcon) {
logo.value.push({
uid: 0,
url: props.data.appIcon,
status: 'done'
});
}
if (props.data.appQrcode) {
appQrcode.value.push({
uid: 0,
url: props.data.appQrcode,
status: 'done'
});
}
if (props.data.companyId) {
console.log(props.data);
}
if (props.data.images) {
const arr = JSON.parse(props.data.images);
arr.map((d) => {
images.value.push({
uid: d.uid,
url: d.url,
status: 'done'
});
});
}
if (props.data.search) {
form.search = props.data.search == 1 ? true : 0;
}
if (props.data.content) {
content.value = props.data.content;
}
isUpdate.value = true;
reload();
} else {
isUpdate.value = false;
}
} else {
resetFields();
}
}
);
</script>

View File

@@ -1,161 +0,0 @@
<template>
<a-descriptions title="基本信息" :column="2" bordered>
<template #extra>
<a @click="openEdit">编辑</a>
</template>
<a-descriptions-item
label="企业名称"
:labelStyle="{ width: '200px', color: '#808080' }"
>{{ data.companyName }}</a-descriptions-item
>
<a-descriptions-item
label="状态"
:labelStyle="{ width: '200px', color: '#808080' }"
>
<template v-if="data.status == 0">
<a-badge status="processing" :text="`正常`" />
</template>
<template v-if="data.status == 1">
<a-badge status="default" :text="`冻结`" />
</template>
</a-descriptions-item>
<a-descriptions-item
label="客户简称"
:labelStyle="{ width: '200px', color: '#808080' }"
>{{ data.shortName }}</a-descriptions-item
>
<a-descriptions-item
label="客户类型"
:labelStyle="{ width: '200px', color: '#808080' }"
>{{ data.companyType }}</a-descriptions-item
>
<a-descriptions-item
label="统一社会信用代码"
:labelStyle="{ width: '200px', color: '#808080' }"
>{{ data.companyCode }}</a-descriptions-item
>
<a-descriptions-item
label="所属行业"
:labelStyle="{ width: '200px', color: '#808080' }"
>
<a-space class="justify">
{{ data.industryParent }}
{{ data.industryChild ? data.industryChild : '-' }}
</a-space>
</a-descriptions-item>
<a-descriptions-item
label="法定代表人"
:labelStyle="{ width: '200px', color: '#808080' }"
>
{{ data.businessEntity }}
</a-descriptions-item>
<a-descriptions-item
label="所属区域"
:labelStyle="{ width: '200px', color: '#808080' }"
>
<a-space class="justify">
<span
>{{ data.province }} {{ data.city }}
{{ data.region ? data.region : '-' }}</span
>
</a-space>
</a-descriptions-item>
<a-descriptions-item
label="手机号码"
:labelStyle="{ width: '200px', color: '#808080' }"
>
{{ data.phone }}
</a-descriptions-item>
<a-descriptions-item
label="办公地址"
:labelStyle="{ width: '200px', color: '#808080' }"
>
{{ data.address }}
</a-descriptions-item>
<a-descriptions-item
label="座机电话"
:labelStyle="{ width: '200px', color: '#808080' }"
>
{{ data.tel }}
</a-descriptions-item>
<a-descriptions-item
label="描述"
:span="2"
layout="vertical"
:labelStyle="{ width: '200px', color: '#808080' }"
>
{{ data.comments }}
</a-descriptions-item>
<a-descriptions-item
label="电子邮箱"
:labelStyle="{ width: '200px', color: '#808080' }"
>
{{ data.email }}
</a-descriptions-item>
<a-descriptions-item
label="官方网站"
:labelStyle="{ width: '200px', color: '#808080' }"
>
{{ data.domain }}
</a-descriptions-item>
<a-descriptions-item
label="logo"
layout="vertical"
:labelStyle="{ width: '200px', color: '#808080' }"
>
<ele-image-upload
v-model:value="logo"
:disabled="true"
:item-style="{ width: '90px', height: '90px' }"
:limit="1"
/>
</a-descriptions-item>
<!-- <a-descriptions-item-->
<!-- label="二维码"-->
<!-- layout="vertical"-->
<!-- :labelStyle="{ width: '200px', color: '#808080' }"-->
<!-- >-->
<!-- <ele-image-upload-->
<!-- v-model:value="companyQrcode"-->
<!-- :disabled="true"-->
<!-- :item-style="{ width: '90px', height: '90px' }"-->
<!-- :limit="1"-->
<!-- />-->
<!-- </a-descriptions-item>-->
</a-descriptions>
<!-- 编辑弹窗 -->
<CompanyInfoEdit v-model:visible="showEdit" :data="data" @done="reload" />
</template>
<script lang="ts" setup>
import { Company } from '@/api/oa/company/model';
import { ref } from 'vue';
import CompanyInfoEdit from './company-info-edit.vue';
defineProps<{
data: Company;
logo: [] | any;
companyQrcode: any | undefined;
}>();
const emit = defineEmits<{
(e: 'done'): void;
}>();
// 是否显示编辑弹窗
const showEdit = ref(false);
const showCompanySecretForm = ref<boolean>(false);
const openCompanySecretForm = () => {
showCompanySecretForm.value = true;
};
/* 打开编辑弹窗 */
const openEdit = () => {
showEdit.value = true;
};
const reload = () => {
emit('done');
};
</script>

View File

@@ -1,255 +0,0 @@
<template>
<a-button @click="addRecord" style="margin-bottom: 10px">添加</a-button>
<table
class="ele-table ele-table-border ele-table-stripe ele-table-medium"
>
<thead>
<tr>
<th>状态</th>
<th>续费金额</th>
<th>开始时间</th>
<th>结束时间</th>
<th width="360">描述</th>
<th style="text-align: center">操作</th>
</tr>
</thead>
<tr v-for="(item, index) in list" :key="index">
<td>
<template v-if="item.editStatus">
<a-select placeholder="请选择" v-model:value="item.status">
<a-select-option :value="0">待缴费</a-select-option>
<a-select-option :value="1">已缴费</a-select-option>
</a-select>
</template>
<template v-else>
<span v-if="item.status == 1">已缴费</span>
<span v-if="item.status == 0">待缴费</span>
</template>
</td>
<td>
<template v-if="item.editStatus">
<a-input-number
:min="0"
:max="999999"
class="ele-fluid"
placeholder="请输入续费金额"
v-model:value="item.money"
/>
</template>
<template v-else> {{ item.money }} </template>
</td>
<td>
<template v-if="item.editStatus">
<a-date-picker
placeholder="开始日期"
value-format="YYYY-MM-DD"
v-model:value="item.startTime"
/>
</template>
<template v-else>
{{ toDateString(item.startTime, 'yyyy-MM-dd') }}
</template>
</td>
<td>
<template v-if="item.editStatus">
<a-date-picker
placeholder="结束日期"
value-format="YYYY-MM-DD"
v-model:value="item.endTime"
/>
</template>
<template v-else>
{{ toDateString(item.endTime, 'yyyy-MM-dd') }}
</template>
</td>
<td>
<template v-if="item.editStatus">
<a-input
class="ele-fluid"
placeholder="请输入描述内容"
v-model:value="item.comments"
/>
<a-upload
v-model:file-list="item.images"
class="upload-list-inline"
list-type="picture"
:before-upload="beforeUpload"
>
<a-button>
<UploadOutlined />
上传附件
</a-button>
</a-upload>
</template>
<template v-else>
<div class="comments">{{ item.comments }}</div>
<div class="files">
<a-upload
v-model:file-list="item.images"
class="upload-list-inline"
>
</a-upload>
</div>
</template>
</td>
<td style="text-align: center">
<template v-if="item.editStatus">
<a-space>
<a @click="save(item, index)">保存</a>
<a-divider type="vertical" />
<a-popconfirm title="确定要删除此记录吗?" @confirm="remove(index)">
<a class="ele-text-info">删除</a>
</a-popconfirm>
</a-space>
</template>
<template v-else>
<a-space>
<a @click="openEdit(index)">编辑</a>
<a-divider type="vertical" v-if="hasRole('superAdmin')" @confirm="removeRel(index)" />
<a-popconfirm title="确定要删除此记录吗?" v-if="hasRole('superAdmin')" @confirm="removeRel(index)">
<a class="ele-text-info">删除</a>
</a-popconfirm>
</a-space>
</template>
</td>
</tr>
</table>
</template>
<script setup lang="ts">
import { hasRole } from '@/utils/permission';
import { ref, watch } from 'vue';
import { addAppRenew, pageAppRenew, removeAppRenew } from "@/api/oa/app/renew";
import { AppRenew } from '@/api/oa/app/renew/model';
import { useUserStore } from '@/store/modules/user';
import { message } from 'ant-design-vue';
import { toDateString } from 'ele-admin-pro';
import { ItemType } from "ele-admin-pro/es/ele-image-upload/types";
import { uploadOss } from "@/api/system/file";
import { isImage } from "@/utils/common";
const props = defineProps<{
visible: boolean;
editStatus?: boolean;
appId?: number;
companyId?: number;
}>();
const emit = defineEmits<{
(e: 'done'): void;
(e: 'update:visible', visible: boolean): void;
}>();
const userStore = useUserStore();
const list = ref<AppRenew[]>([]);
const files = ref<ItemType[]>([]);
const addRecord = () => {
list.value.unshift({
money: undefined,
comments: undefined,
startTime: undefined,
endTime: undefined,
nickname: userStore.info?.nickname,
status: 1,
images: undefined,
editStatus: true
});
};
// 文件上传事件
const beforeUpload = (file: File) => {
const item: ItemType = {
file,
uid: (file as any).uid,
name: file.name
}
if (!file.type.startsWith("image")) {
if (file.size / 1024 / 1024 > 100) {
message.error("大小不能超过 100MB");
return;
}
}
onUpload(item);
return false;
};
const onUpload = (d: ItemType) => {
uploadOss(<File>d.file)
.then((result) => {
files.value.push({
uid: result.id,
url: result.path,
name: isImage(result.path) ? 'image' : result.name,
status: "done"
});
message.success("上传成功");
})
.catch((e) => {
message.error(e.message);
});
};
const remove = (index: number) => {
list.value.splice(index, 1);
};
const openEdit = (index: number) => {
list.value[index].editStatus = true
}
const removeRel = (index: number) => {
removeAppRenew(list.value[index].appRenewId).then(() => {
list.value.splice(index, 1);
message.success('删除成功')
})
}
const save = (item: AppRenew, index: number) => {
item.appId = props.appId;
item.companyId = props.companyId;
item.startTime = item.startTime ? item.startTime + ' 00:00:00' : '';
item.endTime = item.endTime ? item.endTime + ' 23:59:59' : '';
item.nickname = userStore.info?.nickname;
item.userId = userStore.info?.userId;
if(files.value.length > 0){
item.images = JSON.stringify(files.value)
}
if (item.money == undefined || item.money == 0) {
message.error('请填写金额');
return false;
}
addAppRenew(item).then(() => {
list.value[index].editStatus = false;
message.success('保存成功');
});
};
const reload = () => {
pageAppRenew({ appId: props.appId }).then((res) => {
if (res?.list) {
list.value = res?.list.map((d) => {
d.editStatus = false;
if(d.images){
d.images = JSON.parse(d.images);
}
return d;
});
}
});
};
watch(
() => props.appId,
(options) => {
if (options) {
reload();
}
},
{
immediate: true
}
);
</script>
<style scoped lang="less"></style>

View File

@@ -1,220 +0,0 @@
<!-- 用户编辑弹窗 -->
<template>
<ele-modal
width="80%"
:visible="visible"
:maskClosable="false"
:maxable="maxable"
:title="isUpdate ? '编辑' : '添加'"
:body-style="{ paddingBottom: '28px' }"
@update:visible="updateVisible"
@ok="save"
>
<a-form
ref="formRef"
:model="form"
:label-col="{ md: { span: 7 }, sm: { span: 4 }, xs: { span: 24 } }"
:wrapper-col="{ md: { span: 17 }, sm: { span: 20 }, xs: { span: 24 } }"
>
<div class="content">
<ele-image-upload
v-model:value="images"
:limit="6"
:drag="true"
:item-style="{ width: '150px', height: '267px' }"
:upload-handler="uploadHandler"
@upload="onUpload"
/>
<small class="ele-text-placeholder">
请上传应用截图(最多6张)建议宽度300*533像素小于2M/
</small>
</div>
</a-form>
</ele-modal>
</template>
<script lang="ts" setup>
import { ref, reactive, watch } from 'vue';
import { Form, message } from 'ant-design-vue';
import { assignObject } from 'ele-admin-pro';
import { addApp, updateApp } from '@/api/oa/app';
import type { App } from '@/api/oa/app/model';
import { FormInstance } from 'ant-design-vue/es/form';
import { ItemType } from 'ele-admin-pro/es/ele-image-upload/types';
import { uploadFileLocal } from '@/api/system/file';
import { TOKEN_STORE_NAME } from '@/config/setting';
// 是否是修改
const isUpdate = ref(false);
const useForm = Form.useForm;
const props = defineProps<{
// 弹窗是否打开
visible: boolean;
// 修改回显的数据
data?: App | null;
}>();
const emit = defineEmits<{
(e: 'done'): void;
(e: 'update:visible', visible: boolean): void;
}>();
// 提交状态
const loading = ref(false);
// 是否显示最大化切换按钮
const maxable = ref(true);
// 当期时间
const logo = ref<ItemType[]>([]);
const appQrcode = ref<ItemType[]>([]);
const images = ref<ItemType[]>([]);
const content = ref('');
const requirement = ref('');
const token = localStorage.getItem(TOKEN_STORE_NAME);
const formRef = ref<FormInstance | null>(null);
// 用户信息
const form = reactive<App>({
// 应用id
appId: undefined,
// 应用截图
images: ''
});
/* 更新visible */
const updateVisible = (value: boolean) => {
emit('update:visible', value);
};
const { resetFields } = useForm(form);
/* 保存编辑 */
const save = () => {
if (!formRef.value) {
return;
}
formRef.value
.validate()
.then(() => {
loading.value = true;
const formData = {
...form,
content: content.value,
requirement: requirement.value,
search: form.search ? 1 : 0,
images: JSON.stringify(images.value)
// appTypeMultiple: JSON.stringify(form.appTypeMultiple)
};
const saveOrUpdate = isUpdate.value ? updateApp : addApp;
saveOrUpdate(formData)
.then((msg) => {
loading.value = false;
message.success(msg);
updateVisible(false);
emit('done');
})
.catch((e) => {
loading.value = false;
message.error(e.message);
});
})
.catch(() => {});
};
/* 上传事件 */
const uploadHandler = (file: File) => {
const item: ItemType = {
file,
uid: (file as any).uid,
name: file.name
};
if (!file.type.startsWith('image')) {
message.error('只能选择图片');
return;
}
if (file.size / 1024 / 1024 > 2) {
message.error('大小不能超过 2MB');
return;
}
onUpload(item);
};
// 上传文件
const onUpload = (item) => {
const { file } = item;
uploadFileLocal(file, props.data?.appId)
.then((data) => {
images.value.push({
uid: data.id,
url: data.url,
status: 'done'
});
})
.catch((e) => {
message.error(e.message);
});
};
const reload = () => {
loading.value = true;
};
watch(
() => props.visible,
(visible) => {
if (visible) {
content.value = '';
requirement.value = '';
logo.value = [];
images.value = [];
appQrcode.value = [];
if (props.data) {
assignObject(form, props.data);
if (props.data.appIcon) {
logo.value.push({
uid: 0,
url: props.data.appIcon,
status: 'done'
});
}
if (props.data.appQrcode) {
appQrcode.value.push({
uid: 0,
url: props.data.appQrcode,
status: 'done'
});
}
if (props.data.companyId) {
console.log(props.data);
}
if (props.data.images) {
const arr = JSON.parse(props.data.images);
arr.map((d, i) => {
images.value.push({
uid: d.uid,
url: d.url,
status: 'done'
});
});
}
if (props.data.search) {
form.search = props.data.search == 1 ? true : 0;
}
if (props.data.content) {
content.value = props.data.content;
}
if (props.data.requirement) {
requirement.value = props.data.requirement;
}
isUpdate.value = true;
reload();
} else {
isUpdate.value = false;
}
} else {
resetFields();
}
}
);
</script>

View File

@@ -1,52 +0,0 @@
<template>
<a-descriptions title="企业相册" :bordered="false">
<template #extra>
<a @click="openEdit">编辑</a>
</template>
</a-descriptions>
<div class="content">
<template v-if="data.companyType === 'web'">
<a-image-preview-group>
<a-space :size="20" v-for="(item, index) in images" :key="index">
<a-image :width="360" :src="item.url" />
</a-space>
</a-image-preview-group>
</template>
<template v-else>
<a-image-preview-group>
<a-space :size="20" v-for="(item, index) in images" :key="index">
<a-image :width="200" :src="item.url" />
</a-space>
</a-image-preview-group>
</template>
</div>
<!-- 编辑弹窗 -->
<CompanyPhotoEdit v-model:visible="showEdit" :data="data" @done="reload" />
</template>
<script lang="ts" setup>
import { Company } from '@/api/oa/company/model';
import { ref } from 'vue';
import CompanyPhotoEdit from './company-photo-edit.vue';
defineProps<{
visible: boolean;
data: Company;
images: any[];
}>();
const emit = defineEmits<{
(e: 'done'): void;
}>();
// 是否显示编辑弹窗
const showEdit = ref(false);
/* 打开编辑弹窗 */
const openEdit = () => {
showEdit.value = true;
};
const reload = () => {
emit('done');
};
</script>

View File

@@ -1,256 +0,0 @@
<!-- 用户编辑弹窗 -->
<template>
<ele-modal
width="80%"
:visible="visible"
:maskClosable="false"
:maxable="maxable"
:title="isUpdate ? '编辑' : '新增'"
:body-style="{ paddingBottom: '28px' }"
@update:visible="updateVisible"
@ok="save"
>
<a-form
ref="formRef"
:model="form"
:label-col="{ md: { span: 7 }, sm: { span: 4 }, xs: { span: 24 } }"
:wrapper-col="{ md: { span: 17 }, sm: { span: 20 }, xs: { span: 24 } }"
>
<!-- 编辑器 -->
<byte-md-editor
v-model:value="requirement"
placeholder="请输入您的内容,图片请直接粘贴"
:locale="zh_Hans"
mode="split"
:plugins="plugins"
height="500px"
:editorConfig="{ lineNumbers: true }"
@paste="onPaste"
/>
</a-form>
</ele-modal>
</template>
<script lang="ts" setup>
import { ref, reactive, watch } from 'vue';
import { Form, message } from 'ant-design-vue';
import {assignObject} from "ele-admin-pro";
import { addApp, updateApp } from '@/api/oa/app';
import type { App } from '@/api/oa/app/model';
import { useThemeStore } from '@/store/modules/theme';
import { storeToRefs } from 'pinia';
// 中文语言文件
import zh_Hans from 'bytemd/locales/zh_Hans.json';
// 链接、删除线、复选框、表格等的插件
// 插件的中文语言文件
import zh_HansGfm from '@bytemd/plugin-gfm/locales/zh_Hans.json';
import 'bytemd/dist/index.min.css';
import 'github-markdown-css/github-markdown-light.css';
import highlight from '@bytemd/plugin-highlight';
// 中文语言文件
import gfm from '@bytemd/plugin-gfm';
// // 预览界面的样式,这里用的 github 的 markdown 主题
import 'github-markdown-css/github-markdown-light.css';
import {FormInstance} from 'ant-design-vue/es/form';
import { ItemType } from 'ele-admin-pro/es/ele-image-upload/types';
import { uploadFile } from "@/api/system/file";
import { TOKEN_STORE_NAME } from "@/config/setting";
// 是否是修改
const isUpdate = ref(false);
const useForm = Form.useForm;
// 是否开启响应式布局
const themeStore = useThemeStore();
const { styleResponsive } = storeToRefs(themeStore);
const props = defineProps<{
// 弹窗是否打开
visible: boolean;
// 修改回显的数据
data?: App | null;
}>();
const emit = defineEmits<{
(e: 'done'): void;
(e: 'update:visible', visible: boolean): void;
}>();
// 提交状态
const loading = ref(false);
// 是否显示最大化切换按钮
const maxable = ref(true);
const images = ref<ItemType[]>([]);
const content = ref('');
const requirement = ref('');
// 插件
const plugins = ref([
gfm({
locale: zh_HansGfm
}),
highlight()
]);
const token = localStorage.getItem(TOKEN_STORE_NAME);
const formRef = ref<FormInstance | null>(null);
// 用户信息
const form = reactive<App>({
// 应用id
appId: undefined,
// 项目需求
requirement: ''
});
/* 更新visible */
const updateVisible = (value: boolean) => {
emit('update:visible', value);
};
const { resetFields, validate, validateInfos } = useForm(form);
const config = ref({
height: 500,
images_upload_handler: (blobInfo, success, error) => {
const file = blobInfo.blob();
// 使用 axios 上传,实际开发这段建议写在 api 中再调用 api
const formData = new FormData();
formData.append('file', file, file.name);
uploadFile(<File>file)
.then((result) => {
if (result.length) {
if (file.size / 1024 / 1024 > 2) {
error('图片大小不能超过 2MB');
}
success(result.url);
} else {
error('上传失败');
}
})
.catch((e) => {
message.error(e.message);
});
},
});
/* 粘贴图片上传服务器并插入编辑器 */
const onPaste = (e) => {
console.log(e);
const items = (e.clipboardData || e.originalEvent.clipboardData).items;
console.log(items);
let hasFile = false;
for (let i = 0; i < items.length; i++) {
if (items[i].type.indexOf('image') !== -1) {
let file = items[i].getAsFile();
const item: ItemType = {
file,
uid: (file as any).lastModified,
name: file.name
};
uploadFile(<File>item.file)
.then((result) => {
const addPath = '!['+result.name+']('+ result.url+')\n\r';
content.value = content.value + addPath
})
.catch((e) => {
message.error(e.message);
});
hasFile = true;
}
}
if (hasFile) {
e.preventDefault();
}
}
/* 保存编辑 */
const save = () => {
if (!formRef.value) {
return;
}
formRef.value
.validate()
.then(() => {
loading.value = true;
const formData = {
...form,
content: content.value,
requirement: requirement.value,
images: JSON.stringify(images.value)
};
const saveOrUpdate = isUpdate.value ? updateApp : addApp;
saveOrUpdate(formData)
.then((msg) => {
loading.value = false;
message.success(msg);
updateVisible(false);
emit('done');
})
.catch((e) => {
loading.value = false;
message.error(e.message);
});
})
.catch(() => {});
};
/* 上传事件 */
const uploadHandler = (file: File) => {
const item: ItemType = {
file,
uid: (file as any).uid,
name: file.name
};
if (!file.type.startsWith('image')) {
message.error('只能选择图片');
return;
}
if (file.size / 1024 / 1024 > 2) {
message.error('大小不能超过 2MB');
return;
}
onUpload(item);
};
// 上传文件
const onUpload = (item) => {
const { file } = item;
uploadFile(file)
.then((data) => {
images.value.push({
uid: data.id,
url: data.url,
status: 'done'
});
})
.catch((e) => {
message.error(e.message);
});
};
watch(
() => props.visible,
(visible) => {
if (visible) {
content.value = '';
requirement.value = '';
if (props.data) {
assignObject(form, props.data);
if (props.data.requirement){
requirement.value = props.data.requirement;
}
if (props.data.content) {
content.value = props.data.content;
}
isUpdate.value = true;
} else {
isUpdate.value = false;
}
} else {
resetFields();
}
}
);
</script>

View File

@@ -1,66 +0,0 @@
<template>
<a-descriptions title="协同文档" :bordered="false">
<template #extra>
<a @click="openEdit">编辑</a>
</template>
</a-descriptions>
<byte-md-viewer :value="data.requirement" :plugins="plugins" />
<a-empty
v-if="data.requirement == ''"
image="https://gw.alipayobjects.com/mdn/miniapp_social/afts/img/A*pevERLJC9v0AAAAAAAAAAABjAQAAAQ/original"
:image-style="{
height: '60px'
}"
>
<template #description>
<span class="ele-text-placeholder">类似腾讯文档的功能支持多人编辑</span>
</template>
<a-button type="primary" @click="openEdit">编辑</a-button>
</a-empty>
<!-- 编辑弹窗 -->
<AppProfileEdit v-model:visible="showEdit" :data="data" @done="reload" />
</template>
<script lang="ts" setup>
import { ref } from 'vue';
import gfm from '@bytemd/plugin-gfm';
import zh_HansGfm from '@bytemd/plugin-gfm/locales/zh_Hans.json';
import highlight from '@bytemd/plugin-highlight';
import 'bytemd/dist/index.min.css';
import 'github-markdown-css/github-markdown-light.css';
import 'github-markdown-css/github-markdown-light.css';
import AppProfileEdit from './company-profile-edit.vue';
defineProps<{
appId: number;
data: any;
}>();
const emit = defineEmits<{
(e: 'done'): void;
}>();
// 是否显示编辑弹窗
const showEdit = ref(false);
/* 打开编辑弹窗 */
const openEdit = () => {
showEdit.value = true;
};
const reload = () => {
emit('done');
};
// 插件
const plugins = ref([
gfm({
locale: zh_HansGfm
}),
highlight()
]);
</script>
<style lang="less">
.app-profile * {
max-width: 1000px;
}
</style>

View File

@@ -1,210 +0,0 @@
<!-- 角色编辑弹窗 -->
<template>
<ele-modal
:width="550"
:visible="visible"
:confirm-loading="loading"
title="重置AppSecret"
:body-style="{ paddingBottom: '8px' }"
@update:visible="updateVisible"
ok-text="重置"
cancel-text="关闭"
@ok="save"
>
<a-form
ref="formRef"
:model="form"
:label-col="styleResponsive ? { md: 5, sm: 5, xs: 24 } : { flex: '90px' }"
:wrapper-col="
styleResponsive ? { md: 19, sm: 19, xs: 24 } : { flex: '1' }
"
>
<template v-if="!appSecret">
<a-form-item label="手机号码" name="phone">
<a-input
:maxlength="20"
:disabled="true"
placeholder="请输入短信验证码"
v-model:value="form.phone"
/>
</a-form-item>
<a-form-item label="短信验证码" name="code">
<div class="login-input-group">
<a-input
placeholder="请输入验证码"
v-model:value="form.code"
:maxlength="6"
allow-clear
/>
<a-button
class="login-captcha"
:disabled="!!countdownTime"
@click="openImgCodeModal"
>
<span v-if="!countdownTime" @click="sendCode">发送验证码</span>
<span v-else>已发送 {{ countdownTime }} s</span>
</a-button>
</div>
</a-form-item>
</template>
<template v-else>
<a-form-item label="AppID" name="appId">
<a-typography-text copyable code class="ele-text-secondary">{{
appId
}}</a-typography-text>
</a-form-item>
<a-form-item label="AppSecret" name="appSecret">
<a-typography-text copyable code class="ele-text-secondary">{{
appSecret
}}</a-typography-text>
</a-form-item>
</template>
</a-form>
</ele-modal>
</template>
<script lang="ts" setup>
import { ref, watch } from 'vue';
import { message } from 'ant-design-vue/es';
import type { FormInstance } from 'ant-design-vue/es/form';
import { storeToRefs } from 'pinia';
import { useThemeStore } from '@/store/modules/theme';
import useFormData from '@/utils/use-form-data';
import { User } from '@/api/system/user/model';
import { sendSmsCaptcha } from '@/api/passport/login';
import { updateAppSecret } from '@/api/oa/app';
import { createCode, encrypt } from '@/utils/common';
import { pageAppUser } from '@/api/oa/app/user';
// 是否开启响应式布局
const themeStore = useThemeStore();
const { styleResponsive } = storeToRefs(themeStore);
const emit = defineEmits<{
(e: 'done'): void;
(e: 'update:visible', visible: boolean): void;
}>();
const props = defineProps<{
// 弹窗是否打开
visible: boolean;
// 修改回显的数据
appId?: number;
}>();
const formRef = ref<FormInstance | null>(null);
// 验证码倒计时时间
const countdownTime = ref(0);
// 验证码倒计时定时器
let countdownTimer: number | null = null;
const loading = ref(false);
const appSecret = ref('');
// 表单数据
const { form, resetFields } = useFormData<User>({
phone: '',
userId: undefined
});
/* 显示发送短信验证码弹窗 */
const openImgCodeModal = () => {
if (!form.phone) {
message.error('请输入手机号码');
return;
}
};
/* 发送短信验证码 */
const sendCode = () => {
sendSmsCaptcha({ phone: form.phone }).then(() => {
message.success('短信验证码发送成功, 请注意查收!');
countdownTime.value = 60;
// 开始对按钮进行倒计时
countdownTimer = window.setInterval(() => {
if (countdownTime.value <= 1) {
countdownTimer && clearInterval(countdownTimer);
countdownTimer = null;
}
countdownTime.value--;
}, 1000);
});
};
/* 保存编辑 */
const save = () => {
if (!formRef.value) {
return;
}
if (appSecret.value) {
return;
}
formRef.value
.validate()
.then(() => {
loading.value = true;
updateAppSecret({
phone: form.phone,
appCode: form.code,
appId: props.appId,
appSecret: encrypt(createCode())
})
.then((res) => {
loading.value = false;
message.success(res.message);
appSecret.value = String(res.data);
// updateVisible(false);
emit('done');
})
.catch((e) => {
loading.value = false;
message.error(e.message);
});
})
.catch(() => {});
};
/* 更新visible */
const updateVisible = (value: boolean) => {
emit('update:visible', value);
};
watch(
() => props.visible,
(visible) => {
if (visible) {
pageAppUser({ appId: props.appId, role: 30 }).then((res) => {
if (res?.list) {
form.phone = res.list[0].phone;
}
});
console.log(props.appId);
} else {
resetFields();
formRef.value?.clearValidate();
}
}
);
</script>
<style lang="less" scoped>
/* 验证码 */
.login-input-group {
display: flex;
align-items: center;
:deep(.ant-input-affix-wrapper) {
flex: 1;
}
.login-captcha {
width: 102px;
height: 33px;
margin-left: 10px;
padding: 0;
& > img {
width: 100%;
height: 100%;
}
}
}
</style>

View File

@@ -1,34 +0,0 @@
<template>
<a-button
@click="openNew(`/oa/task/add?appid=${data.appId}&appName=${data.appName}`)"
>提交工单</a-button
>
</template>
<script lang="ts" setup>
import { TaskParam } from '@/api/oa/task/model';
import useSearch from '@/utils/use-search';
import { openNew } from '@/utils/common';
import { App } from '@/api/oa/app/model';
defineProps<{
data: App;
}>();
const emit = defineEmits<{
(e: 'search', where: TaskParam): void;
(e: 'remove'): void;
}>();
// 表单数据
const { where } = useSearch<TaskParam>({
keywords: '',
status: undefined,
commander: undefined
});
/* 搜索 */
const search = () => {
emit('search', where);
};
</script>

View File

@@ -1,298 +0,0 @@
<template>
<div class="app-task">
<!-- 表格 -->
<ele-pro-table
ref="tableRef"
row-key="taskId"
:columns="columns"
:datasource="datasource"
:customRow="customRow"
tool-class="ele-toolbar-form"
class="sys-org-table"
>
<template #toolbar>
<AppTaskSearch :data="data" @search="reload" @remove="removeBatch" />
</template>
<template #bodyCell="{ column, record }">
<template v-if="column.key === 'content'">
<div class="user-box">
<div class="user-info">
<a-badge
:dot="!record.isRead && record.userId != userStore.info?.userId"
>
<a-avatar :src="record.avatar" size="large" />
</a-badge>
</div>
<div class="content" style="display: flex; flex-direction: column">
<div class="nickname">
<a-typography-text strong>
{{ `${record.nickname}` }}
</a-typography-text>
<span class="ele-text-placeholder" style="padding-left: 10px">{{
timeAgo(record.createTime)
}}</span>
</div>
<a
class="ele-text-heading"
@click="openNew('/oa/task/detail/' + record.taskId)"
>
{{ `工单标题:${record.name}` }}
</a>
<div class="ele-text-placeholder">{{
record.appId > 0 ? `项目名称:【${record.appName}` : ''
}}</div>
<div
class="ele-text-secondary"
style="display: flex; align-items: center"
>
<a-avatar :size="18" :src="record.lastAvatar" />
<div class="content" style="padding-left: 8px">
{{ record.content }}
</div>
<span class="ele-text-placeholder" style="padding-left: 10px">{{
timeAgo(record.updateTime)
}}</span>
</div>
</div>
<div class="last-time ele-text-info"> </div>
</div>
</template>
<template v-else-if="column.key === 'status'">
<a-tag v-if="record.progress === TOBEARRANGED" color="red"
>待安排</a-tag
>
<a-tag v-if="record.progress === PENDING" color="orange"
>待处理</a-tag
>
<a-tag v-if="record.progress === PROCESSING" color="purple"
>处理中</a-tag
>
<a-tag v-if="record.progress === TOBECONFIRMED" color="cyan"
>待评价</a-tag
>
<a-tag v-if="record.progress === COMPLETED" color="green"
>已完成</a-tag
>
<a-tag v-if="record.progress === CLOSED">已关闭</a-tag>
<div class="ele-text-danger" v-if="record.overdueDays">
已逾期{{ record.overdueDays }}
</div>
</template>
<template v-else-if="column.key === 'progress'">
<a-progress :percent="record.progress * 2" :steps="5" />
</template>
<template v-if="column.key === 'action'">
<a-space>
<a @click="onDetail(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>
</div>
</template>
<script lang="ts" setup>
import { createVNode, ref, watch } from 'vue';
import { message, Modal } from 'ant-design-vue';
import { ExclamationCircleOutlined } from '@ant-design/icons-vue';
import type { EleProTable } from 'ele-admin-pro';
import type { DatasourceFunction } from 'ele-admin-pro/es/ele-pro-table/types';
import { timeAgo } from 'ele-admin-pro';
import { pageTask, removeTask, removeBatchTask } from '@/api/oa/task';
import type { Task, TaskParam } from '@/api/oa/task/model';
import { useUserStore } from '@/store/modules/user';
import AppTaskSearch from './company-task-search.vue';
import {
CLOSED,
COMPLETED,
PENDING,
PROCESSING,
TOBEARRANGED,
TOBECONFIRMED
} from '@/api/oa/task/model/progress';
import { hasRole } from '@/utils/permission';
import { openNew } from '@/utils/common';
import { App } from '@/api/oa/app/model';
const props = defineProps<{
appId: number | undefined;
data: App;
}>();
const userStore = useUserStore();
// 表格实例
const tableRef = ref<InstanceType<typeof EleProTable> | null>(null);
const selection = ref<any[]>();
const status = ref<number>();
// 表格数据源
const datasource: DatasourceFunction = ({ page, limit, where, orders }) => {
// 搜索条件
// 工单发起人
if (hasRole('promoter') || hasRole('user')) {
where.commander = undefined;
where.userId = userStore.info?.userId;
}
// 管理人员
if (hasRole('superAdmin') || hasRole('admin')) {
where.commander = undefined;
}
// 工单受理人员
if (hasRole('commander')) {
where.commander = userStore.info?.userId;
}
return pageTask({
...where,
...orders,
page,
limit
});
};
// 表格列配置
const columns = ref<any[]>([
{
title: '工单号',
dataIndex: 'taskId',
align: 'center',
width: 100
},
{
title: '工单类型',
dataIndex: 'taskType',
width: 100
},
{
title: '工单信息',
dataIndex: 'content',
key: 'content',
ellipsis: true
},
{
title: '状态',
dataIndex: 'status',
key: 'status',
align: 'center',
width: 120
}
]);
/* 搜索 */
const reload = (where?: TaskParam) => {
status.value = where?.status;
selection.value = [];
tableRef?.value?.reload({ where: where });
};
const onDetail = (record?: Task) => {
window.location.href = 'detail?id=' + record?.taskId;
};
/* 删除单个 */
const remove = (row: Task) => {
const hide = message.loading('请求中..', 0);
removeTask(row.taskId)
.then((msg) => {
hide();
message.success(msg);
reload();
})
.catch((e) => {
hide();
message.error(e.message);
});
};
/* 批量删除 */
const removeBatch = () => {
if (!selection.value?.length) {
message.error('请至少选择一条数据');
return;
}
if (selection.value?.length) {
Modal.confirm({
title: '提示',
content: '确定要删除选中的记录吗?',
icon: createVNode(ExclamationCircleOutlined),
maskClosable: true,
onOk: () => {
const hide = message.loading('请求中..', 0);
removeBatchTask(selection.value.map((d) => d.taskId))
.then((msg) => {
hide();
message.success(msg);
reload();
})
.catch((e) => {
hide();
message.error(e.message);
});
}
});
}
};
// 是否展现多选按钮及批量删除按钮
if (hasRole('superAdmin') || hasRole('admin')) {
selection.value = [];
}
/* 自定义行属性 */
const customRow = (record: Task) => {
return {
// 行双击事件
onDblclick: () => {
window.open('/oa/task/detail/' + record.taskId);
}
};
};
watch(
() => props.appId,
(appId) => {
if (appId) {
reload({ appId });
}
},
{ immediate: true }
);
</script>
<script lang="ts">
export default {
name: 'AppTaskIndex'
};
</script>
<style lang="less" scoped>
.user-box {
display: flex;
align-items: center;
.user-info {
display: flex;
flex-direction: column;
align-items: start;
margin-right: 7px;
}
.last-time {
margin-left: 12px;
}
.content {
.text {
max-width: 90%;
}
}
}
.nickname {
.ele-text-heading {
font-weight: bold;
}
}
</style>

View File

@@ -1,110 +0,0 @@
<template>
<a-space style="margin-bottom: 20px">
<SelectUser
style="margin-left: 10px"
v-if="hasRole('superAdmin') || hasRole('admin')"
:placeholder="`添加成员`"
@done="addCompanyExpUser"
/>
<a-button>邀请添加</a-button>
</a-space>
<div class="content">
<table class="ele-table ele-table-border ele-table-stripe ele-table-medium">
<thead>
<tr>
<th>用户ID</th>
<th>角色</th>
<th>昵称</th>
<th>加入时间</th>
<th>操作</th>
</tr>
</thead>
<tbody>
<tr v-for="(user, index) in data.userList" :key="index">
<td>{{ user.userId }}</td>
<td>
<span v-if="user.role === 10">普通成员</span>
<span v-if="user.role === 20">管理成员</span>
<span v-if="user.role === 30">所有者</span>
</td>
<td>
<span style="padding-left: 5px">{{ user.nickname }}</span>
</td>
<td>{{ user.createTime }}</td>
<td>
<div v-if="user.role !== 30">
<a
@click="removeUser(user)"
v-if="hasRole('superAdmin') || hasRole('admin')"
>
移除
</a>
</div>
</td>
</tr>
</tbody>
</table>
</div>
</template>
<script lang="ts" setup>
import { User } from '@/api/system/user/model';
import { Company } from '@/api/oa/company/model';
import { hasRole } from '@/utils/permission';
import { CompanyUser } from '@/api/oa/company/user/model';
import { addCompanyUser, removeCompanyUser } from '@/api/oa/company/user';
import { message } from 'ant-design-vue';
const props = defineProps<{
companyId: any;
data: Company;
}>();
const emit = defineEmits<{
(e: 'done'): void;
(e: 'update:visible', visible: boolean): void;
}>();
// 添加开发成员
const addCompanyDevUser = (data: User) => {
addCompanyUser({
userId: data.userId,
companyId: props.data?.companyId,
role: 20
})
.then((msg) => {
message.success(msg);
emit('done');
})
.catch((e) => {
message.error(e.message);
});
};
// 添加体验成员
const addCompanyExpUser = (data: User) => {
addCompanyUser({
userId: data.userId,
companyId: props.data?.companyId,
role: 10
})
.then((msg) => {
message.success(msg);
emit('done');
})
.catch((e) => {
message.error(e.message);
});
};
// 移除成员
const removeUser = (data: CompanyUser) => {
removeCompanyUser(data.companyUserId)
.then((msg) => {
message.success(msg);
emit('done');
})
.catch((e) => {
message.error(e.message);
});
};
</script>

View File

@@ -1,203 +0,0 @@
<template>
<a-page-header
:title="title"
:style="{ padding: screenWidth > 480 ? '16px 24px' : '0' }"
@back="() => $router.go(-1)"
>
<a-spin :spinning="spinning">
<a-card
:bordered="false"
:body-style="{ paddingTop: '5px' }"
v-if="isShow"
>
<a-tabs v-model:active-key="active" @change="onChange">
<a-tab-pane tab="基本信息" key="base">
<CompanyInfo
:data="form"
:logo="logo"
:company-qrcode="companyQrcode"
@done="reload"
/>
</a-tab-pane>
<a-tab-pane
tab="成员管理"
key="users"
v-if="hasRole('superAdmin') || hasRole('admin')"
>
<CompanyUsers :company-id="companyId" :data="form" @done="reload" />
</a-tab-pane>
<a-tab-pane tab="客户资料" key="param">
<CompanyFieldForm
:company-id="companyId"
:data="form"
@done="reload"
/>
</a-tab-pane>
<a-tab-pane tab="企业附件" key="annex">
<CompanyAnnex :company-id="companyId" :data="form" @done="reload" />
</a-tab-pane>
</a-tabs>
</a-card>
<a-card v-else :bordered="false">
<div style="max-width: 960px; margin: 0 auto">
<a-result
status="error"
title="无查看权限"
sub-title="请先添加为企业成员"
>
<template #extra>
<a-space size="middle">
<a-button type="primary" @click="openUrl('/oa/company/index')"
>返回</a-button
>
</a-space>
</template>
</a-result>
</div>
</a-card>
</a-spin>
</a-page-header>
</template>
<script lang="ts" setup>
import { ref, unref, watch } from 'vue';
import { useRouter } from 'vue-router';
import { useThemeStore } from '@/store/modules/theme';
import { storeToRefs } from 'pinia';
import CompanyInfo from './components/company-info.vue';
import CompanyUsers from './components/company-users.vue';
import CompanyAnnex from './components/company-annex.vue';
import CompanyFieldForm from './components/company-field.vue';
import { pageCompany } from '@/api/oa/company';
import useFormData from '@/utils/use-form-data';
import { Company } from '@/api/oa/company/model';
import { ItemType } from 'ele-admin-pro/es/ele-image-upload/types';
import { hasRole } from '@/utils/permission';
import { setPageTabTitle } from '@/utils/page-tab-util';
import { openUrl } from '@/utils/common';
import { pageCompanyUser } from '@/api/oa/company/user';
import { pageCompanyField } from '@/api/oa/company/field';
import { CompanyField } from '@/api/oa/company/field/model';
const { currentRoute } = useRouter();
// 当前选项卡
const active = ref('base');
// 是否开启响应式布局
const themeStore = useThemeStore();
const { screenWidth } = storeToRefs(themeStore);
const title = ref('企业名称');
const spinning = ref(true);
const isShow = ref(true);
const logo = ref<any[]>([]);
const companyId = ref<number>(0);
const companyQrcode = ref<any[]>([]);
const images = ref<ItemType[]>([]);
const companyField = ref<CompanyField[]>();
// 应用信息
const { form, assignFields, resetFields } = useFormData<Company>({
companyId: undefined,
companyName: '',
shortName: '',
companyCode: '',
companyLogo: '',
companyType: undefined,
industryParent: '',
industryChild: '',
businessEntity: '',
province: '',
city: '',
region: '',
address: '',
phone: '',
tel: '',
email: '',
domain: '',
serverUrl: undefined,
clicks: undefined,
version: undefined,
sortNumber: undefined,
comments: '',
tenantName: '',
tenantCode: '',
tenantId: undefined,
createTime: '',
status: undefined,
nickname: '',
fields: [],
userList: []
});
const onChange = () => {
reload();
};
/**
* 加载数据
*/
const reload = () => {
resetFields();
logo.value = [];
companyQrcode.value = [];
images.value = [];
// companyField.value = [];
// 加载企业详情
pageCompany({ companyId: companyId.value })
.then((data) => {
if (data?.list) {
const company = data.list[0];
assignFields(company);
if (company.companyName) {
title.value = company.companyName;
// 修改页签标题
setPageTabTitle(company.companyName);
}
if (company.companyLogo) {
logo.value.push({
uid: company.companyId,
url: company.companyLogo,
status: 'done'
});
}
}
isShow.value = true;
spinning.value = false;
// 加载企业资料
pageCompanyField({ companyId: companyId.value, limit: 50 }).then(
(res) => {
companyField.value = res?.list;
form.fields = res?.list;
}
);
// 加载项目成员
pageCompanyUser({ companyId: companyId.value }).then((res) => {
if (res?.list) {
form.userList = res.list;
}
});
})
.catch((err) => {
isShow.value = false;
spinning.value = false;
});
};
watch(
currentRoute,
(route) => {
const { params } = unref(route);
const { id } = params;
if (id) {
companyId.value = Number(id);
}
reload();
},
{ immediate: true }
);
</script>
<script lang="ts">
export default {
name: 'CompanyDetail'
};
</script>

View File

@@ -1,178 +0,0 @@
<!-- 分类编辑弹窗 -->
<template>
<ele-modal
:width="460"
:visible="visible"
:confirm-loading="loading"
:title="isUpdate ? '修改分类' : '添加分类'"
:body-style="{ paddingBottom: '8px' }"
@update:visible="updateVisible"
@ok="save"
>
<a-form
ref="formRef"
:model="form"
:rules="rules"
:label-col="styleResponsive ? { md: 5, sm: 5, xs: 24 } : { flex: '90px' }"
:wrapper-col="
styleResponsive ? { md: 19, sm: 19, xs: 24 } : { flex: '1' }
"
>
<a-form-item label="分类标识" name="dictCode">
<a-input
allow-clear
:maxlength="20"
disabled
placeholder="请输入分类标识"
v-model:value="form.dictCode"
/>
</a-form-item>
<a-form-item label="分类名称" name="dictDataName">
<a-input
allow-clear
:maxlength="20"
placeholder="请输入分类名称"
v-model:value="form.dictDataName"
/>
</a-form-item>
<a-form-item label="排序" name="sortNumber">
<a-input-number
:min="0"
:max="99999"
class="ele-fluid"
placeholder="请输入排序号"
v-model:value="form.sortNumber"
/>
</a-form-item>
<a-form-item label="备注">
<a-textarea
:rows="4"
:maxlength="200"
placeholder="请输入备注"
v-model:value="form.comments"
/>
</a-form-item>
</a-form>
</ele-modal>
</template>
<script lang="ts" setup>
import { ref, reactive, watch } from 'vue';
import { message } from 'ant-design-vue/es';
import type { FormInstance, Rule } from 'ant-design-vue/es/form';
import { storeToRefs } from 'pinia';
import { useThemeStore } from '@/store/modules/theme';
import useFormData from '@/utils/use-form-data';
import { addDictData, updateDictData } from '@/api/system/dict-data';
import { DictData } from '@/api/system/dict-data/model';
import {removeSiteInfoCache} from "@/api/cms/website";
// 是否开启响应式布局
const themeStore = useThemeStore();
const { styleResponsive } = storeToRefs(themeStore);
const emit = defineEmits<{
(e: 'done'): void;
(e: 'update:visible', visible: boolean): void;
}>();
const props = defineProps<{
// 弹窗是否打开
visible: boolean;
// 修改回显的数据
data?: DictData | null;
// 字典ID
dictId?: number | 0;
}>();
//
const formRef = ref<FormInstance | null>(null);
// 是否是修改
const isUpdate = ref(false);
// 提交状态
const loading = ref(false);
// 表单数据
const { form, resetFields, assignFields } = useFormData<DictData>({
dictId: undefined,
dictDataId: undefined,
dictDataName: '',
dictCode: 'companyType',
dictDataCode: '',
sortNumber: 100,
comments: ''
});
// 表单验证规则
const rules = reactive<Record<string, Rule[]>>({
dictDataCode: [
{
required: true,
message: '请输入分类名称',
type: 'string',
trigger: 'blur'
}
],
dictCode: [
{
required: true,
message: '请输入分类标识',
type: 'string',
trigger: 'blur'
}
]
});
/* 保存编辑 */
const save = () => {
if (!formRef.value) {
return;
}
formRef.value
.validate()
.then(() => {
loading.value = true;
const saveOrUpdate = isUpdate.value ? updateDictData : addDictData;
form.dictDataCode = form.dictDataName;
form.dictId = props.dictId;
saveOrUpdate(form)
.then((msg) => {
loading.value = false;
message.success(msg);
// 清除字典缓存
removeSiteInfoCache(form.dictCode + ':' + form.tenantId);
updateVisible(false);
emit('done');
})
.catch((e) => {
loading.value = false;
message.error(e.message);
});
})
.catch(() => {});
};
/* 更新visible */
const updateVisible = (value: boolean) => {
emit('update:visible', value);
};
watch(
() => props.visible,
(visible) => {
if (visible) {
if (props.data) {
assignFields(props.data);
isUpdate.value = true;
} else {
isUpdate.value = false;
}
} else {
resetFields();
formRef.value?.clearValidate();
}
}
);
</script>

View File

@@ -1,222 +0,0 @@
<template>
<div class="ele-body">
<a-card :bordered="false">
<!-- 表格 -->
<ele-pro-table
ref="tableRef"
row-key="dictDataId"
:columns="columns"
:datasource="datasource"
:customRow="customRow"
:scroll="{ x: 800 }"
cache-key="companyDictTable"
>
<template #toolbar>
<a-space>
<a-button type="primary" class="ele-btn-icon" @click="openEdit()">
<template #icon>
<plus-outlined />
</template>
<span>新建</span>
</a-button>
<a-button
danger
type="primary"
class="ele-btn-icon"
@click="removeBatch"
>
<template #icon>
<delete-outlined />
</template>
<span>删除</span>
</a-button>
</a-space>
</template>
<template #bodyCell="{ column, record }">
<template v-if="column.key === 'action'">
<a-space>
<a @click="openEdit(record)">修改</a>
<a-divider type="vertical" />
<a-popconfirm
placement="topRight"
title="确定要删除此分类吗?"
@confirm="remove(record)"
>
<a class="ele-text-danger">删除</a>
</a-popconfirm>
</a-space>
</template>
</template>
</ele-pro-table>
</a-card>
<!-- 编辑弹窗 -->
<dict-edit
v-model:visible="showEdit"
:dictId="dictId"
:data="current"
@done="reload"
/>
</div>
</template>
<script lang="ts" setup>
import { createVNode, ref } from 'vue';
import { message, Modal } from 'ant-design-vue/es';
import {
PlusOutlined,
DeleteOutlined,
ExclamationCircleOutlined
} from '@ant-design/icons-vue';
import type { EleProTable } from 'ele-admin-pro/es';
import type {
DatasourceFunction,
ColumnItem
} from 'ele-admin-pro/es/ele-pro-table/types';
import { messageLoading } from 'ele-admin-pro/es';
import DictEdit from './components/dict-edit.vue';
import {
pageDictData,
removeDictData,
removeDictDataBatch
} from '@/api/system/dict-data';
import { DictParam } from '@/api/system/dict/model';
import { DictData } from '@/api/system/dict-data/model';
import { addDict, listDictionaries } from '@/api/system/dict';
import { Dictionary } from '@/api/system/dictionary/model';
// 表格实例
const tableRef = ref<InstanceType<typeof EleProTable> | null>(null);
const dictId = ref(0);
// 表格列配置
const columns = ref<ColumnItem[]>([
{
title: 'ID',
dataIndex: 'dictDataId',
width: 80
},
{
title: '分类名称',
dataIndex: 'dictDataName',
showSorterTooltip: false
},
{
title: '备注',
dataIndex: 'comments',
sorter: true,
showSorterTooltip: false
},
{
title: '排序号',
width: 180,
align: 'center',
dataIndex: 'sortNumber'
},
{
title: '操作',
key: 'action',
width: 180,
align: 'center'
}
]);
// 表格选中数据
const selection = ref<DictData[]>([]);
// 当前编辑数据
const current = ref<Dictionary | null>(null);
// 是否显示编辑弹窗
const showEdit = ref(false);
// 表格数据源
const datasource: DatasourceFunction = ({ page, limit, where, orders }) => {
where.dictCode = 'companyType';
return pageDictData({ ...where, ...orders, page, limit });
};
/* 搜索 */
const reload = (where?: DictParam) => {
selection.value = [];
tableRef?.value?.reload({ page: 1, where });
};
/* 打开编辑弹窗 */
const openEdit = (row?: DictData) => {
current.value = row ?? null;
showEdit.value = true;
};
/* 删除单个 */
const remove = (row: DictData) => {
const hide = messageLoading('请求中..', 0);
removeDictData(row.dictDataId)
.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 = messageLoading('请求中..', 0);
removeDictDataBatch(selection.value.map((d) => d.dictDataId))
.then((msg) => {
hide();
message.success(msg);
reload();
})
.catch((e) => {
hide();
message.error(e.message);
});
}
});
};
// 初始化字典
const loadDict = () => {
listDictionaries({ dictCode: 'companyType' }).then(async (data) => {
if (data?.length == 0) {
await addDict({ dictCode: 'companyType', dictName: '链接分类' });
}
await listDictionaries({ dictCode: 'companyType' }).then((list) => {
list?.map((d) => {
dictId.value = Number(d.dictId);
});
});
});
};
loadDict();
/* 自定义行属性 */
const customRow = (record: DictData) => {
return {
onDblclick: () => {
openEdit(record);
}
};
};
</script>
<script lang="ts">
export default {
name: 'TaskDictData'
};
</script>

View File

@@ -1,315 +0,0 @@
<template>
<div class="page">
<div class="ele-body">
<a-card :bordered="false">
<!-- 表格 -->
<ele-pro-table
ref="tableRef"
row-key="companyId"
:columns="columns"
:datasource="datasource"
v-model:selection="selection"
:customRow="customRow"
tool-class="ele-toolbar-form"
:scroll="{ x: 1200 }"
class="sys-org-table"
:striped="true"
>
<template #toolbar>
<search
@search="reload"
:selection="selection"
@add="openEdit"
@remove="removeBatch"
@advanced="openAdvanced"
/>
</template>
<template #bodyCell="{ column, record }">
<template v-if="column.key === 'companyName'">
<div class="company-box">
<a-image
:height="45"
:width="45"
:preview="false"
:src="record.companyLogo"
fallback="https://file.wsdns.cn/20230218/550e610d43334dd2a7f66d5b20bd58eb.svg"
/>
<div class="company-info">
<a
class="ele-text-heading"
@click="openUrl('/oa/company/detail/' + record.companyId)"
>
{{ record.companyName }}
</a>
<span class="ele-text-placeholder">
{{ record.shortName }}
</span>
</div>
</div>
</template>
<template v-if="column.key === 'status'">
<template v-if="record.status == 0">
<a-badge status="processing" :text="`正常`" />
</template>
<template v-if="record.status == 1">
<a-badge status="default" :text="`冻结`" />
</template>
</template>
<template v-if="column.key === 'expirationTime'">
<template v-if="expirationTime(record.expirationTime) < 30">
<a-space>
<span class="ele-text-danger">{{
toDateString(record.expirationTime, 'yyyy-MM-dd')
}}</span>
<span class="ele-text-placeholder"
>(剩余{{ expirationTime(record.expirationTime) }})</span
>
</a-space>
</template>
<template v-else>
{{ toDateString(record.expirationTime, 'yyyy-MM-dd') }}
</template>
</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>
</div>
<!-- 编辑弹窗 -->
<CompanyEdit v-model:visible="showEdit" :data="current" @done="reload" />
</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 { openUrl } from '@/utils/common';
import type {
DatasourceFunction,
ColumnItem
} from 'ele-admin-pro/es/ele-pro-table/types';
import Search from './components/search.vue';
import CompanyEdit from './components/company-edit.vue';
import {
pageCompany,
removeBatchCompany,
removeCompany
} from '@/api/oa/company';
import { Company, CompanyParam } from '@/api/oa/company/model';
import { toDateString } from 'ele-admin-pro';
defineProps<{
activeKey?: boolean;
data?: any;
}>();
// 表格实例
const tableRef = ref<InstanceType<typeof EleProTable> | null>(null);
// 表格列配置
const columns = ref<ColumnItem[]>([
{
title: 'ID',
dataIndex: 'companyId',
width: 80,
hideInTable: true
},
{
title: '企业名称',
dataIndex: 'companyName',
key: 'companyName'
},
{
title: '企业类型',
dataIndex: 'companyType',
width: 180,
align: 'center',
key: 'companyType'
},
{
title: '状态',
dataIndex: 'status',
align: 'center',
width: 180,
key: 'status',
customRender: ({ text }) => ['正常', '冻结'][text]
},
{
title: '创建时间',
dataIndex: 'createTime',
key: 'createTime',
align: 'center',
width: 180,
sorter: true,
customRender: ({ text }) => toDateString(text, 'yyyy-MM-dd HH:ss')
},
{
title: '操作',
key: 'action',
width: 120,
align: 'center',
fixed: 'right',
hideInSetting: true
}
]);
// 表格选中数据
const selection = ref<Company[]>([]);
// 当前编辑数据
const current = ref<Company | null>(null);
// 是否显示编辑弹窗
const showEdit = ref(false);
// 是否显示高级搜索
const showAdvancedSearch = ref(false);
// 表格数据源
const datasource: DatasourceFunction = ({
page,
limit,
where,
orders,
filters
}) => {
// 默认类型
if (where.keywords == undefined) {
where.companyStatus = '开发中';
where.showExpiration = undefined;
}
return pageCompany({
...where,
...orders,
page,
limit
});
};
/* 搜索 */
const reload = (where?: CompanyParam) => {
selection.value = [];
tableRef?.value?.reload({ where: where });
};
/* 打开编辑弹窗 */
const openEdit = (row?: Company) => {
current.value = row ?? null;
showEdit.value = true;
};
const expirationTime = (dateTime) => {
const now = new Date().getTime();
const expiration = new Date(dateTime).getTime();
const mss = expiration - now;
let days = Math.floor(mss / (1000 * 60 * 60 * 24));
let hours = Math.floor((mss % (1000 * 60 * 60 * 24)) / (1000 * 60 * 60));
let minutes = Math.floor((mss % (1000 * 60 * 60)) / (1000 * 60));
let seconds = Math.round((mss % (1000 * 60)) / 1000);
return days;
};
/* 打开高级搜索 */
const openAdvanced = () => {
showAdvancedSearch.value = !showAdvancedSearch.value;
};
/* 删除单个 */
const remove = (row: Company) => {
const hide = message.loading('请求中..', 0);
removeCompany(row.companyId)
.then((msg) => {
hide();
message.success(msg);
reload();
})
.catch((e) => {
hide();
message.error(e.message);
});
};
/* 批量删除 */
const removeBatch = () => {
console.log(selection.value);
if (!selection.value.length) {
message.error('请至少选择一条数据');
return;
}
Modal.confirm({
title: '提示',
content: '确定要删除选中的记录吗?',
icon: createVNode(ExclamationCircleOutlined),
maskClosable: true,
onOk: () => {
const hide = message.loading('请求中..', 0);
removeBatchCompany(selection.value.map((d) => d.companyId))
.then((msg) => {
hide();
message.success(msg);
reload();
})
.catch((e) => {
hide();
message.error(e.message);
});
}
});
};
/* 自定义行属性 */
const customRow = (record: Company) => {
return {
// 行点击事件
onClick: () => {
// console.log(record);
},
// 行双击事件
onDblclick: () => {
openUrl('/oa/company/detail/' + record.companyId);
// window.open('/oa/company/detail/' + record.companyId);
}
};
};
reload();
</script>
<script lang="ts">
export default {
name: 'CompanyIndex'
};
</script>
<style lang="less" scoped>
p {
line-height: 0.8;
}
.sys-org-table :deep(.ant-table-body) {
overflow: auto !important;
overflow: overlay !important;
}
.sys-org-table :deep(.ant-table-pagination.ant-pagination) {
padding: 0 4px;
margin-bottom: 0;
}
.company-box {
display: flex;
.company-info {
display: flex;
margin-left: 5px;
flex-direction: column;
}
}
</style>

View File

@@ -328,10 +328,10 @@
v-model:value="form.meta"
/>
</a-form-item>
<a-form-item label="版本0正式版 1体验版 2开发版" name="edition">
<a-form-item label="版本0正式版 1基础版 2开发版" name="edition">
<a-input
allow-clear
placeholder="请输入版本0正式版 1体验版 2开发版"
placeholder="请输入版本0正式版 1基础版 2开发版"
v-model:value="form.edition"
/>
</a-form-item>

View File

@@ -372,7 +372,7 @@
align: 'center',
},
{
title: '版本0正式版 1体验版 2开发版',
title: '版本0正式版 1基础版 2开发版',
dataIndex: 'edition',
key: 'edition',
align: 'center',

View File

@@ -101,7 +101,7 @@
<!-- </a-form-item>-->
<!-- <a-form-item label="当前版本" name="version">-->
<!-- <a-tag color="red" v-if="form.version === 10">免费版</a-tag>-->
<!-- <a-tag color="green" v-if="form.version === 20">授权</a-tag>-->
<!-- <a-tag color="green" v-if="form.version === 20">专业</a-tag>-->
<!-- <a-tag color="cyan" v-if="form.version === 30">永久授权</a-tag>-->
<!-- </a-form-item>-->
<a-form-item label="状态" name="status">

View File

@@ -50,7 +50,7 @@
</template>
<template v-if="column.key === 'version'">
<text v-if="record.version === 10">免费版</text>
<text v-if="record.version === 20">授权</text>
<text v-if="record.version === 20">专业</text>
<text v-if="record.version === 30">永久授权</text>
</template>
<template v-if="column.key === 'status'">

View File

@@ -121,7 +121,7 @@
<a-input
allow-clear
size="large"
maxlength="11"
:maxlength="11"
v-model:value="form.phone"
:placeholder="`请输入手机号码`"
>
@@ -322,8 +322,8 @@
message.error('请输入图形验证码');
return;
}
if (text.value !== imgCode.value) {
message.error('图形验证码不正确');
if (text.value !== imgCode.value.toLowerCase()) {
message.error(text.value + '图形验证码不正确' + imgCode.value);
return;
}
codeLoading.value = true;
@@ -471,6 +471,11 @@
form.tenantId = Number(tenantId);
showTenantId.value = false;
}
const tid = localStorage.getItem('TenantId');
if (tid) {
form.tenantId = Number(tid);
showTenantId.value = false;
}
},
{ immediate: true }
);

File diff suppressed because it is too large Load Diff

View File

@@ -100,21 +100,49 @@
v-model:value="form.unitName"
/>
</a-form-item>
<a-form-item label="商品价格" name="price">
<a-input-number
:placeholder="`商品价格`"
style="width: 240px"
v-model:value="form.price"
/>
<div class="ele-text-placeholder">商品的实际购买金额最低0.01</div>
</a-form-item>
<a-form-item label="市场价" name="salePrice">
<a-input-number
:placeholder="`市场价`"
style="width: 240px"
:min="0.01"
v-model:value="form.salePrice"
/>
<div class="ele-text-placeholder">划线价仅用于商品页展示</div>
<div class="ele-text-placeholder">市场价或划线价仅用于商品页展示</div>
</a-form-item>
<a-form-item label="会员价" name="price">
<a-space>
<a-input-number
:placeholder="`会员价`"
style="width: 240px"
:min="0.01"
v-model:value="form.price"
/>
<a-checkbox v-model:checked="form.priceGift">有赠品</a-checkbox>
</a-space>
<div class="ele-text-placeholder">商品的实际购买金额最低0.01</div>
</a-form-item>
<a-form-item label="经销商" name="buyingPrice">
<a-space>
<a-input-number
:placeholder="`经销商价格`"
style="width: 240px"
:min="0.01"
v-model:value="form.dealerPrice"
/>
<a-checkbox v-model:checked="form.dealerGift">有赠品</a-checkbox>
</a-space>
<div class="ele-text-placeholder">经销商价格</div>
</a-form-item>
<a-form-item label="进货价" name="buyingPrice">
<a-space>
<a-input-number
:placeholder="`进货价`"
:min="0.01"
style="width: 240px"
v-model:value="form.buyingPrice"
/>
</a-space>
<div class="ele-text-placeholder">进货价</div>
</a-form-item>
<a-form-item label="当前库存" name="stock">
<a-input-number
@@ -272,14 +300,6 @@
</a-form-item>
</a-tab-pane>
<a-tab-pane tab="营销设置" key="coupon">
<a-form-item label="货架" name="position">
<a-input
allow-clear
style="width: 250px"
placeholder="请输入货架"
v-model:value="form.position"
/>
</a-form-item>
<a-form-item label="商品重量" name="goodsWeight">
<a-input
allow-clear
@@ -309,6 +329,14 @@
<a-radio :value="10">下单减库存</a-radio>
</a-radio-group>
</a-form-item>
<a-form-item label="货架" name="position">
<a-input
allow-clear
style="width: 250px"
placeholder="请输入货架"
v-model:value="form.position"
/>
</a-form-item>
<a-form-item label="排序号" name="sortNumber">
<a-input-number
:min="0"
@@ -345,7 +373,6 @@
import { GoodsSpec } from "@/api/shop/goodsSpec/model";
import { generateGoodsSku, listGoodsSku } from "@/api/shop/goodsSku";
import { listGoodsSpec } from "@/api/shop/goodsSpec";
import CategorySelect from "@/views/cms/article/components/category-select.vue";
import { GoodsCategory } from "@/api/shop/goodsCategory/model";
import { listGoodsCategory } from "@/api/shop/goodsCategory";
@@ -435,12 +462,16 @@
content: undefined,
unitName: '',
categoryId: undefined,
categoryParent: undefined,
categoryChildren: undefined,
parentName: undefined,
categoryName: undefined,
specs: 0,
position: undefined,
price: undefined,
salePrice: undefined,
buyingPrice: undefined,
dealerPrice: undefined,
priceGift: undefined,
dealerGift: undefined,
files: undefined,
sales: 0,
gainIntegral: 0,
@@ -505,7 +536,23 @@
price: [
{
required: true,
message: '请填写商品价格',
message: '请填写会员价',
type: 'number',
trigger: 'blur'
}
],
salePrice: [
{
required: true,
message: '请填写市场价',
type: 'number',
trigger: 'blur'
}
],
buyingPrice: [
{
required: true,
message: '请填写进货价',
type: 'number',
trigger: 'blur'
}
@@ -570,8 +617,8 @@
const chooseGoodsCategory = (item: GoodsCategory,value: any) => {
form.categoryId = value[1].value;
form.categoryParent = value[0].label;
form.categoryChildren = value[1].label;
form.parentName = value[0].label;
form.categoryName = value[1].label;
}
const chooseTakeawayCategory = (item: GoodsCategory, value: any) => {
form.categoryParent = '店铺分类';
@@ -787,6 +834,7 @@
const formData = {
...form,
content: content.value,
category: JSON.stringify(category.value),
files: JSON.stringify(files.value),
goodsSpec: goodsSpec.value,
goodsSkus: skuList.value,
@@ -845,11 +893,11 @@
});
}
// 商品分类
if(props.data.categoryParent){
category.value.push(props.data.categoryParent);
if(props.data.parentName){
category.value.push(props.data.parentName);
}
if(props.data.categoryChildren){
category.value.push(props.data.categoryChildren);
if(props.data.category){
category.value = JSON.parse(props.data.category);
}
if (props.data.content){
content.value = props.data.content;

View File

@@ -27,7 +27,7 @@
<a
@click="
openSpmUrl(
`/product/detail/${record.goodsId}`,
`https://${record.tenantId}.wsdns.cn/product/detail/${record.goodsId}`,
record,
record.goodsId
)

View File

@@ -63,7 +63,7 @@
import { ref, reactive, watch } from 'vue';
import { Form, message } from 'ant-design-vue';
import { assignObject } from 'ele-admin-pro';
import { addGrade, updateGrade } from '@/api/user/grade';
import { addGrade, updateGrade } from '@/api/system/user-grade';
import { Grade } from '@/api/user/grade/model';
import { useThemeStore } from '@/store/modules/theme';
import { storeToRefs } from 'pinia';
@@ -189,14 +189,3 @@
}
);
</script>
<style lang="less">
.tab-pane {
min-height: 300px;
}
.ml-10 {
margin-left: 5px;
}
.upload-text {
margin-right: 70px;
}
</style>

View File

@@ -82,7 +82,11 @@
import { toDateString } from 'ele-admin-pro';
import Search from './components/search.vue';
import GradeEdit from './components/grade-edit.vue';
import { pageGrade, removeGrade, removeBatchGrade } from '@/api/user/grade';
import {
pageGrade,
removeGrade,
removeBatchGrade
} from '@/api/system/user-grade';
import { timeAgo } from 'ele-admin-pro';
import type { Grade, GradeParam } from '@/api/user/grade/model';
import { useUserStore } from '@/store/modules/user';

View File

@@ -122,8 +122,6 @@
import { ref } from 'vue';
import { Company, CompanyParam } from '@/api/system/company/model';
import useSearch from '@/utils/use-search';
import { message } from 'ant-design-vue/es';
import { pageCompanyAll } from '@/api/system/company';
import { pagePlug } from "@/api/system/plug";
const props = defineProps<{

View File

@@ -128,7 +128,6 @@
import { ref } from 'vue';
import { Company, CompanyParam } from '@/api/system/company/model';
import useSearch from '@/utils/use-search';
import { message } from 'ant-design-vue/es';
import { pageCompanyAll } from '@/api/system/company';
const props = defineProps<{

View File

@@ -59,7 +59,7 @@
<div class="title"> 套餐版本 </div>
<div class="info">
<a-radio-group v-model:value="plan" size="large">
<a-radio-button value="1">体验版(3用户)</a-radio-button>
<a-radio-button value="1">基础版(3用户)</a-radio-button>
<a-radio-button value="2">基础版(10用户)</a-radio-button>
<a-radio-button value="3">标准版(50用户)</a-radio-button>
<a-radio-button value="4">豪华版(100用户)</a-radio-button>

View File

@@ -12,7 +12,7 @@
<a-form layout="horizontal">
<template v-for="(value, key) in data" :key="key">
<template v-if="field === key">
<a-form-item :label="title">
<a-form-item>
<template v-if="field === 'city'">
<regions-select
v-model:value="city"
@@ -21,6 +21,14 @@
class="ele-fluid"
/>
</template>
<template v-else-if="field === 'freeDomain'">
<a-input
v-model:value="form.freeDomain"
placeholder="huawei"
addon-before="https://"
addon-after=".websoft.top"
/>
</template>
<template v-else-if="field === 'industryParent'">
<industry-select
v-model:value="industry"
@@ -104,8 +112,9 @@
appType: '',
companyLogo: '',
domain: '',
freeDomain: undefined,
phone: '',
InvoiceHeader: '',
invoiceHeader: '',
startTime: '',
expirationTime: '',
version: undefined,
@@ -118,7 +127,6 @@
address: '',
comments: '',
authentication: undefined,
modules: '',
requestUrl: '',
socketUrl: '',
serverUrl: '',
@@ -164,20 +172,12 @@
const appType = ref<SelectProps['options']>([
{
value: 'Tenant',
label: 'Tenant'
value: 'web',
label: '应用'
},
{
value: 'Vue',
label: 'Vue'
},
{
value: 'UniApp',
label: 'UniApp'
},
{
value: '网站应用',
label: '网站应用'
value: 'plug',
label: '插件'
}
]);

View File

@@ -5,15 +5,15 @@
:body-style="{ paddingTop: '0px', minHeight: '800px' }"
>
<a-tabs v-model:active-key="active" size="large">
<a-tab-pane tab="基本信息" key="info">
<a-tab-pane tab="系统信息" key="info">
<a-form
:label-col="
styleResponsive
? { lg: 3, md: 6, sm: 4, xs: 24 }
? { lg: 2, md: 6, sm: 4, xs: 24 }
: { flex: '100px' }
"
:wrapper-col="styleResponsive ? { offset: 1 } : { offset: 1 }"
style="margin-top: 20px"
style="margin-top: 20px;"
>
<a-form-item labelAlign="right" label="logo">
<SelectFile
@@ -23,16 +23,9 @@
@done="chooseFile"
@del="onDeleteItem"
/>
<!-- <ele-image-upload-->
<!-- v-model:value="logo"-->
<!-- :accept="'image/*'"-->
<!-- :item-style="{ width: '80px', height: '80px' }"-->
<!-- :limit="1"-->
<!-- @upload="onUpload"-->
<!-- />-->
</a-form-item>
<a-form-item label="应用名称">
<a-space class="justify ele-text-secondary">
<a-space class="justify ele-text-heading">
<span>{{ form.shortName }}</span>
<a @click="onEdit('应用名称', 'shortName', form.shortName)"
>修改</a
@@ -40,47 +33,47 @@
</a-space>
</a-form-item>
<a-form-item label="应用描述">
<a-space class="justify ele-text-secondary">
<a-space class="justify ele-text-heading">
<div style="max-width: 600px">{{ form.comments }}</div>
<a @click="onEdit('应用描述', 'comments', form.comments)"
>修改</a
>
</a-space>
</a-form-item>
<a-form-item label="专属域名">
<a-space class="justify">
<a class="cursor-pointer" @click="openSpmUrl(`https://${form.domain}`)">{{ `${form.domain}` }}</a>
<a @click="onEdit('专属域名', 'freeDomain', form.freeDomain)">修改</a>
</a-space>
</a-form-item>
<!-- <a-form-item label="应用类型">-->
<!-- <a-space class="justify">-->
<!-- <span>Tenant</span>-->
<!-- </a-space>-->
<!-- </a-form-item>-->
<a-form-item label="应用状态">
<span v-if="form.status == 0" class="ele-text-success">已上线</span>
<span v-if="form.status == 1" class="ele-text-warning">开发中</span>
<span v-if="form.status == 2" class="ele-text-danger">维护中</span>
<span v-if="form.status == 3" class="ele-text-placeholder">已欠费</span>
</a-form-item>
<a-form-item label="当前版本">
<!-- <a-form-item label="应用状态">-->
<!-- <span v-if="form.status == 0" class="ele-text-success">已上线</span>-->
<!-- <span v-if="form.status == 1" class="ele-text-warning">开发中</span>-->
<!-- <span v-if="form.status == 2" class="ele-text-danger">维护中</span>-->
<!-- <span v-if="form.status == 3" class="ele-text-placeholder">已欠费</span>-->
<!-- </a-form-item>-->
<a-form-item label="应用版本">
<a-space class="justify">
<a-tag color="red" v-if="form.version === 10" class="cursor-pointer" @click="updateVersion(form.version)">体验</a-tag>
<a-tag color="blue" v-if="form.version === 20" class="cursor-pointer" @click="updateVersion(form.version)">授权</a-tag>
<a-tag color="red" v-if="form.version === 10" class="cursor-pointer" @click="updateVersion(form.version)">基础</a-tag>
<a-tag color="blue" v-if="form.version === 20" class="cursor-pointer" @click="updateVersion(form.version)">专业</a-tag>
<a-tag color="cyan" v-if="form.version === 30">永久授权</a-tag>
</a-space>
</a-form-item>
<a-form-item label="版本号">
<a-space class="justify ele-text-secondary">
{{ form.versionName }}
<a @click="openUrl('/system/version')">更新</a>
</a-space>
</a-form-item>
<a-form-item label="开通时间">
<span class="ele-text-secondary">{{ form.createTime }}</span>
<span class="ele-text-heading">{{ form.createTime }}</span>
</a-form-item>
<a-form-item label="到期时间" v-if="form.version != 30">
<span class="ele-text-secondary">{{ form.expirationTime }}</span>
<span class="ele-text-heading">{{ form.expirationTime }}</span>
</a-form-item>
<a-divider style="padding-bottom: 20px" />
<a-form-item label="主体名称">
<a-space class="justify">
<div class="ele-text-secondary">
<div class="ele-text-heading">
<span style="padding-right: 12px">{{ form.companyName ? form.companyName : "-" }}</span>
<a-tag v-if="form.authentication == 1" color="green">已认证</a-tag>
<a-tag v-else color="orange">未认证</a-tag>
@@ -96,94 +89,103 @@
<a @click="onEdit('主体类型', 'companyType', form.companyType)">修改</a>
</a-space>
</a-form-item>
<a-form-item label="行业类型">
<a-space class="justify">
<span>{{ form.industryParent }} {{ form.industryChild ? form.industryChild : '-' }}</span>
<a @click="onEdit('行业类型', 'industryParent', form.industryParent)"
>修改</a
>
<a-form-item label="用户数量">
<a-space class="justify ele-text-heading">
<span>{{ form.users }}/{{ form.members }}</span>
</a-space>
</a-form-item>
<a-form-item label="所属地区">
<a-space class="justify">
<span
>{{ form.province }} {{ form.city }} {{ form.region ? form.region : '-' }}</span
>
<a @click="onEdit('所属地区', 'city', form.city)">修改</a>
<!-- <a-form-item label="部门数量">-->
<!-- <a-space class="justify ele-text-heading">-->
<!-- <span>{{ form.departments }}</span>-->
<!-- </a-space>-->
<!-- </a-form-item>-->
<a-form-item label="存储空间">
<a-space class="justify ele-text-heading">
<span>{{ getFileSize(form.storage) }}/{{ getFileSize(form.storageMax) }}</span>
</a-space>
</a-form-item>
<a-form-item label="企业地址">
<a-space class="justify">
<span>{{ form.address ? form.address : '-' }}</span>
<a @click="onEdit('企业地址', 'address', form.address)">修改</a>
</a-space>
</a-form-item>
<!-- <a-form-item label="企业域名">-->
<!-- <a-form-item label="所属地区">-->
<!-- <a-space class="justify">-->
<!-- <span>{{ form.domain ? form.domain : '-' }}</span>-->
<!-- <a @click="onEdit('企业域名', 'domain', form.domain)">修改</a>-->
<!-- <span-->
<!-- >{{ form.province }}{{ form.city }}{{ form.region ? form.region : '-' }}</span-->
<!-- >-->
<!-- <a @click="onEdit('所属地区', 'city', form.city)">修改</a>-->
<!-- </a-space>-->
<!-- </a-form-item>-->
<!-- <a-form-item label="企业地址">-->
<!-- <a-space class="justify">-->
<!-- <span>{{ form.address ? form.address : '-' }}</span>-->
<!-- <a @click="onEdit('企业地址', 'address', form.address)">修改</a>-->
<!-- </a-space>-->
<!-- </a-form-item>-->
<!-- <a-form-item label="企业域名">-->
<!-- <a-space class="justify ele-text-secondary">-->
<!-- <a-space class="justify ele-text-heading">-->
<!-- <span>{{ form.domain ? form.domain : '-' }}</span>-->
<!-- <a @click="onEdit('企业域名', 'domain', form.domain)">修改</a>-->
<!-- </a-space>-->
<!-- </a-form-item>-->
<!-- <a-form-item label="联系电话">-->
<!-- <a-space class="justify ele-text-secondary">-->
<!-- <a-space class="justify ele-text-heading">-->
<!-- <span>{{ form.phone }}</span>-->
<!-- </a-space>-->
<!-- </a-form-item>-->
<!-- <a-form-item label="电子邮箱">-->
<!-- <a-space class="justify ele-text-secondary">-->
<!-- <a-space class="justify ele-text-heading">-->
<!-- <span>{{ form.email }}</span>-->
<!-- </a-space>-->
<!-- </a-form-item>-->
<a-divider style="padding-bottom: 20px" />
<a-form-item label="用户数量">
<a-space class="justify ele-text-secondary">
<span>{{ form.users }}</span>
</a-space>
</a-form-item>
<a-form-item label="部门数量">
<a-space class="justify ele-text-secondary">
<span>{{ form.departments }}</span>
</a-space>
</a-form-item>
<a-form-item label="存储空间">
<a-space class="justify ele-text-secondary">
<span>{{ getFileSize(form.storage) }}</span>
<!-- <span>{{ getFileSize(form.storage) }}/{{-->
<!-- getFileSize(form.storageMax)-->
<!-- }}</span>-->
</a-space>
</a-form-item>
<a-divider style="padding-bottom: 20px" />
<a-form-item label="租户ID">
<span class="ele-text-secondary">{{ form.tenantId }}</span>
<span class="ele-text-heading">{{ form.tenantId }}</span>
</a-form-item>
<a-form-item label="租户编号">
<span class="ele-text-secondary">{{ form.tenantCode }}</span>
<a-form-item label="应用类型">
<a-space class="justify">
<a-tag>{{ form.appType }}</a-tag>
<a @click="onEdit('应用类型', 'appType', form.appType)">修改</a>
</a-space>
</a-form-item>
<a-form-item label="模版ID" v-if="form.planId > 0">
<span class="ele-text-heading ele-text-secondary">{{ form.planId }}</span>
<a-form-item label="适用行业">
<a-space class="justify">
<span>{{ form.industryParent }}/{{ form.industryChild }}</span>
<a @click="onEdit('行业类型', 'industryParent', form.industryParent)"
>修改</a
>
</a-space>
</a-form-item>
<!-- <a-form-item label="赠送域名" name="websiteCode">-->
<!-- <a-input-->
<!-- v-model:value="form.domain"-->
<!-- placeholder="huawei"-->
<!-- addon-before="https://"-->
<!-- addon-after=".wsdns.cn"-->
<!-- />-->
<!-- </a-form-item>-->
<!-- <a-form-item label="租户编号">-->
<!-- <span class="ele-text-heading">{{ form.tenantCode }}</span>-->
<!-- </a-form-item>-->
<!-- <a-form-item label="模版ID" v-if="form.planId > 0">-->
<!-- <span class="ele-text-heading ele-text-heading">{{ form.planId }}</span>-->
<!-- </a-form-item>-->
<a-form-item label="当前版本">
<a-space class="justify ele-text-heading">
{{ form.versionName }}
<a @click="openUrl('/system/version')">更新</a>
</a-space>
</a-form-item>
<!-- <a-form-item label="request合法域名">-->
<!-- <a-space class="justify ele-text-secondary">-->
<!-- <a-space class="justify ele-text-heading">-->
<!-- <span>{{ form.requestUrl ? form.requestUrl : '-' }}</span>-->
<!-- <a @click="onEdit('request合法域名', 'requestUrl', form.requestUrl)">修改</a>-->
<!-- </a-space>-->
<!-- </a-form-item>-->
<!-- <a-form-item label="socket合法域名">-->
<!-- <a-space class="justify ele-text-secondary">-->
<!-- <a-space class="justify ele-text-heading">-->
<!-- <span>{{ form.socketUrl ? form.socketUrl : '-' }}</span>-->
<!-- <a @click="onEdit('socket合法域名', 'socketUrl', form.socketUrl)">修改</a>-->
<!-- </a-space>-->
<!-- </a-form-item>-->
<!-- <a-form-item label="业务域名">-->
<!-- <a-space class="justify ele-text-secondary">-->
<!-- <a-space class="justify ele-text-heading">-->
<!-- <span>{{ form.modulesUrl ? form.modulesUrl : '-' }}</span>-->
<!-- <a @click="onEdit('业务域名', 'modulesUrl', form.modulesUrl)">修改</a>-->
<!-- </a-space>-->
@@ -241,7 +243,7 @@ import { getCompany, updateCompany, destructionTenant } from "@/api/system/compa
import Field from "./components/field.vue";
import Version from "./components/version.vue";
import { assignObject } from "ele-admin-pro";
import { getFileSize, openUrl } from "@/utils/common";
import { getFileSize, openSpmUrl, openUrl } from "@/utils/common";
import { Company } from "@/api/system/company/model";
import { ItemType } from "ele-admin-pro/es/ele-image-upload/types";
import { uploadFile } from "@/api/system/file";
@@ -259,18 +261,13 @@ const { styleResponsive } = storeToRefs(themeStore);
const userStore = useUserStore();
// tab 页选中
const active = ref("info");
// 保存按钮 loading
const loading = ref(false);
// 是否显示裁剪弹窗
const visible = ref(false);
const logo = ref<any>([]);
const field = ref("");
const title = ref("");
// 是否显示编辑弹窗
const showEdit = ref(false);
const content = ref("请输入要修改的内容");
const markdown = ref("请输入应用介绍");
const showMarkdown = ref(false);
const showVersionForm = ref(false);
// 登录用户信息
const loginUser = computed(() => userStore.info ?? {});
@@ -283,6 +280,7 @@ const form = reactive<Company>({
companyType: undefined,
companyLogo: "",
domain: "",
freeDomain: undefined,
phone: "",
email: "",
InvoiceHeader: "",