恢复用户列表功能
This commit is contained in:
@@ -1,9 +1,9 @@
|
||||
VITE_APP_NAME=后台管理系统
|
||||
VITE_SOCKET_URL=wss://server.gxwebsoft.com
|
||||
#VITE_SERVER_URL=https://server.gxwebsoft.com/api
|
||||
VITE_API_URL=https://modules.gxwebsoft.com/api
|
||||
#VITE_API_URL=https://modules.gxwebsoft.com/api
|
||||
|
||||
#VITE_API_URL=http://127.0.0.1:9099/api
|
||||
VITE_API_URL=http://127.0.0.1:9099/api
|
||||
VITE_SERVER_URL=http://127.0.0.1:9091/api
|
||||
#VITE_SOCKET_URL=ws://localhost:9191
|
||||
#VITE_API_URL=https://server.gxwebsoft.com/api
|
||||
|
||||
@@ -8,7 +8,7 @@ import { MODULES_API_URL } from '@/config/setting';
|
||||
*/
|
||||
export async function pageOrder(params: OrderParam) {
|
||||
const res = await request.get<ApiResult<PageResult<Order>>>(
|
||||
MODULES_API_URL + '/booking/order/page',
|
||||
MODULES_API_URL + '/shop/order/page',
|
||||
{
|
||||
params
|
||||
}
|
||||
@@ -24,7 +24,7 @@ export async function pageOrder(params: OrderParam) {
|
||||
*/
|
||||
export async function listOrder(params?: OrderParam) {
|
||||
const res = await request.get<ApiResult<Order[]>>(
|
||||
MODULES_API_URL + '/booking/order',
|
||||
MODULES_API_URL + '/shop/order',
|
||||
{
|
||||
params
|
||||
}
|
||||
@@ -40,7 +40,7 @@ export async function listOrder(params?: OrderParam) {
|
||||
*/
|
||||
export async function addOrder(data: Order) {
|
||||
const res = await request.post<ApiResult<unknown>>(
|
||||
MODULES_API_URL + '/booking/order',
|
||||
MODULES_API_URL + '/shop/order',
|
||||
data
|
||||
);
|
||||
if (res.data.code === 0) {
|
||||
@@ -54,7 +54,7 @@ export async function addOrder(data: Order) {
|
||||
*/
|
||||
export async function updateOrder(data: Order) {
|
||||
const res = await request.put<ApiResult<unknown>>(
|
||||
MODULES_API_URL + '/booking/order',
|
||||
MODULES_API_URL + '/shop/order',
|
||||
data
|
||||
);
|
||||
if (res.data.code === 0) {
|
||||
@@ -68,7 +68,7 @@ export async function updateOrder(data: Order) {
|
||||
*/
|
||||
export async function removeOrder(id?: number) {
|
||||
const res = await request.delete<ApiResult<unknown>>(
|
||||
MODULES_API_URL + '/booking/order/' + id
|
||||
MODULES_API_URL + '/shop/order/' + id
|
||||
);
|
||||
if (res.data.code === 0) {
|
||||
return res.data.message;
|
||||
@@ -81,7 +81,7 @@ export async function removeOrder(id?: number) {
|
||||
*/
|
||||
export async function removeBatchOrder(data: (number | undefined)[]) {
|
||||
const res = await request.delete<ApiResult<unknown>>(
|
||||
MODULES_API_URL + '/booking/order/batch',
|
||||
MODULES_API_URL + '/shop/order/batch',
|
||||
{
|
||||
data
|
||||
}
|
||||
@@ -97,7 +97,7 @@ export async function removeBatchOrder(data: (number | undefined)[]) {
|
||||
*/
|
||||
export async function getOrder(id: number) {
|
||||
const res = await request.get<ApiResult<Order>>(
|
||||
MODULES_API_URL + '/booking/order/' + id
|
||||
MODULES_API_URL + '/shop/order/' + id
|
||||
);
|
||||
if (res.data.code === 0 && res.data.data) {
|
||||
return res.data.data;
|
||||
|
||||
@@ -53,7 +53,7 @@ export interface Order {
|
||||
// 1已完成,2未使用,3已取消,4退款申请中,5退款被拒绝,6退款成功,7客户端申请退款
|
||||
orderStatus?: string;
|
||||
// 优惠类型:0无、1抵扣优惠券、2折扣优惠券、3、VIP月卡、4VIP年卡,5VIP次卡、6VIP会员卡、7IC月卡、8IC年卡、9IC次卡、10IC会员卡、11免费订单、12VIP充值卡、13IC充值卡、14VIP季卡、15IC季卡
|
||||
type?: string;
|
||||
couponType?: string;
|
||||
// 二维码地址,保存订单号,支付成功后才生成
|
||||
qrcode?: string;
|
||||
// 优惠说明
|
||||
@@ -68,7 +68,7 @@ export interface Order {
|
||||
isInvoice?: string;
|
||||
// 下单时间
|
||||
createTime?: number;
|
||||
//
|
||||
//
|
||||
updateTime?: number;
|
||||
// 付款时间
|
||||
payTime?: number;
|
||||
|
||||
@@ -36,7 +36,7 @@ export interface Website {
|
||||
region?: string;
|
||||
appId?: number;
|
||||
fields?: WebsiteField[];
|
||||
status?: number;
|
||||
status?: boolean;
|
||||
tenantId?: number;
|
||||
tenantName?: string;
|
||||
navigations?: Navigation[];
|
||||
|
||||
@@ -2,14 +2,14 @@ import request from '@/utils/request';
|
||||
import type { ApiResult } from '@/api';
|
||||
import type { Company, CompanyParam } from './model';
|
||||
import { PageResult } from '@/api';
|
||||
import { MODULES_API_URL } from '@/config/setting';
|
||||
import { SERVER_API_URL } from '@/config/setting';
|
||||
|
||||
/**
|
||||
* 查询企业资料
|
||||
*/
|
||||
export async function getCompany(params?: CompanyParam) {
|
||||
const res = await request.get<ApiResult<Company>>(
|
||||
MODULES_API_URL + '/oa/company/profile',
|
||||
SERVER_API_URL + '/system/company/profile',
|
||||
{
|
||||
params
|
||||
}
|
||||
@@ -25,7 +25,7 @@ export async function getCompany(params?: CompanyParam) {
|
||||
*/
|
||||
export async function getCompanyAll(companyId: number) {
|
||||
const res = await request.get<ApiResult<Company>>(
|
||||
MODULES_API_URL + '/oa/company/profileAll/' + companyId
|
||||
SERVER_API_URL + '/system/company/profileAll/' + companyId
|
||||
);
|
||||
if (res.data.code === 0 && res.data) {
|
||||
console.log(res.data);
|
||||
@@ -39,7 +39,7 @@ export async function getCompanyAll(companyId: number) {
|
||||
*/
|
||||
export async function pageCompany(params: CompanyParam) {
|
||||
const res = await request.get<ApiResult<PageResult<Company>>>(
|
||||
MODULES_API_URL + '/oa/company/page',
|
||||
SERVER_API_URL + '/system/company/page',
|
||||
{ params }
|
||||
);
|
||||
if (res.data.code === 0) {
|
||||
@@ -53,7 +53,7 @@ export async function pageCompany(params: CompanyParam) {
|
||||
*/
|
||||
export async function pageCompanyAll(params: CompanyParam) {
|
||||
const res = await request.get<ApiResult<PageResult<Company>>>(
|
||||
MODULES_API_URL + '/oa/company/pageAll',
|
||||
SERVER_API_URL + '/system/company/pageAll',
|
||||
{ params }
|
||||
);
|
||||
if (res.data.code === 0) {
|
||||
@@ -67,7 +67,7 @@ export async function pageCompanyAll(params: CompanyParam) {
|
||||
*/
|
||||
export async function addCompany(data: Company) {
|
||||
const res = await request.post<ApiResult<unknown>>(
|
||||
MODULES_API_URL + '/oa/company',
|
||||
SERVER_API_URL + '/system/company',
|
||||
data
|
||||
);
|
||||
if (res.data.code === 0) {
|
||||
@@ -81,7 +81,7 @@ export async function addCompany(data: Company) {
|
||||
*/
|
||||
export async function updateCompany(data: Company) {
|
||||
const res = await request.put<ApiResult<unknown>>(
|
||||
MODULES_API_URL + '/oa/company',
|
||||
SERVER_API_URL + '/system/company',
|
||||
data
|
||||
);
|
||||
if (res.data.code === 0) {
|
||||
@@ -95,7 +95,7 @@ export async function updateCompany(data: Company) {
|
||||
*/
|
||||
export async function removeCompany(id?: number) {
|
||||
const res = await request.delete<ApiResult<unknown>>(
|
||||
MODULES_API_URL + '/oa/company/' + id
|
||||
SERVER_API_URL + '/system/company/removeAll/' + id
|
||||
);
|
||||
if (res.data.code === 0) {
|
||||
return res.data.message;
|
||||
@@ -106,7 +106,7 @@ export async function removeCompany(id?: number) {
|
||||
// 销毁租户
|
||||
export async function destructionTenant(id?: number) {
|
||||
const res = await request.delete<ApiResult<unknown>>(
|
||||
MODULES_API_URL + '/oa/company/destruction/' + id
|
||||
SERVER_API_URL + '/system/company/destruction/' + id
|
||||
);
|
||||
if (res.data.code === 0) {
|
||||
return res.data.message;
|
||||
@@ -119,7 +119,7 @@ export async function destructionTenant(id?: number) {
|
||||
*/
|
||||
export async function removeBatchCompany(data: (number | undefined)[]) {
|
||||
const res = await request.delete<ApiResult<unknown>>(
|
||||
MODULES_API_URL + '/oa/company/batch',
|
||||
SERVER_API_URL + '/system/company/batch',
|
||||
{
|
||||
data
|
||||
}
|
||||
@@ -136,7 +136,7 @@ export async function checkExistence(
|
||||
id?: number
|
||||
) {
|
||||
const res = await request.get<ApiResult<unknown>>(
|
||||
MODULES_API_URL + '/oa/company/existence',
|
||||
SERVER_API_URL + '/system/company/existence',
|
||||
{
|
||||
params: { field, value, id }
|
||||
}
|
||||
@@ -146,3 +146,29 @@ export async function checkExistence(
|
||||
}
|
||||
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));
|
||||
}
|
||||
|
||||
@@ -48,6 +48,7 @@ export interface Company {
|
||||
planId?: number;
|
||||
sortNumber?: number;
|
||||
authoritative?: boolean;
|
||||
merchantId?: number;
|
||||
tenantId?: number;
|
||||
tenantName?: string;
|
||||
tenantCode?: string;
|
||||
@@ -56,6 +57,10 @@ export interface Company {
|
||||
socketUrl?: string;
|
||||
serverUrl?: string;
|
||||
modulesUrl?: string;
|
||||
mpWeixinCode?: string;
|
||||
h5Code?: string;
|
||||
androidUrl?: string;
|
||||
iosUrl?: string;
|
||||
avatar?: string;
|
||||
nickname?: string;
|
||||
code?: number;
|
||||
|
||||
@@ -1,14 +1,14 @@
|
||||
import request from '@/utils/request';
|
||||
import type { ApiResult, PageResult } from '@/api';
|
||||
import type { Merchant, MerchantParam } from './model';
|
||||
import { SERVER_API_URL } from '@/config/setting';
|
||||
import { MODULES_API_URL } from '@/config/setting';
|
||||
|
||||
/**
|
||||
* 分页查询商户
|
||||
*/
|
||||
export async function pageMerchant(params: MerchantParam) {
|
||||
const res = await request.get<ApiResult<PageResult<Merchant>>>(
|
||||
SERVER_API_URL + '/system/merchant/page',
|
||||
MODULES_API_URL + '/shop/merchant/page',
|
||||
{
|
||||
params
|
||||
}
|
||||
@@ -24,7 +24,7 @@ export async function pageMerchant(params: MerchantParam) {
|
||||
*/
|
||||
export async function listMerchant(params?: MerchantParam) {
|
||||
const res = await request.get<ApiResult<Merchant[]>>(
|
||||
SERVER_API_URL + '/system/merchant',
|
||||
MODULES_API_URL + '/shop/merchant',
|
||||
{
|
||||
params
|
||||
}
|
||||
@@ -40,7 +40,7 @@ export async function listMerchant(params?: MerchantParam) {
|
||||
*/
|
||||
export async function addMerchant(data: Merchant) {
|
||||
const res = await request.post<ApiResult<unknown>>(
|
||||
SERVER_API_URL + '/system/merchant',
|
||||
MODULES_API_URL + '/shop/merchant',
|
||||
data
|
||||
);
|
||||
if (res.data.code === 0) {
|
||||
@@ -54,7 +54,7 @@ export async function addMerchant(data: Merchant) {
|
||||
*/
|
||||
export async function updateMerchant(data: Merchant) {
|
||||
const res = await request.put<ApiResult<unknown>>(
|
||||
SERVER_API_URL + '/system/merchant',
|
||||
MODULES_API_URL + '/shop/merchant',
|
||||
data
|
||||
);
|
||||
if (res.data.code === 0) {
|
||||
@@ -68,7 +68,7 @@ export async function updateMerchant(data: Merchant) {
|
||||
*/
|
||||
export async function removeMerchant(id?: number) {
|
||||
const res = await request.delete<ApiResult<unknown>>(
|
||||
SERVER_API_URL + '/system/merchant/' + id
|
||||
MODULES_API_URL + '/shop/merchant/' + id
|
||||
);
|
||||
if (res.data.code === 0) {
|
||||
return res.data.message;
|
||||
@@ -81,7 +81,7 @@ export async function removeMerchant(id?: number) {
|
||||
*/
|
||||
export async function removeBatchMerchant(data: (number | undefined)[]) {
|
||||
const res = await request.delete<ApiResult<unknown>>(
|
||||
SERVER_API_URL + '/system/merchant/batch',
|
||||
MODULES_API_URL + '/shop/merchant/batch',
|
||||
{
|
||||
data
|
||||
}
|
||||
@@ -97,7 +97,7 @@ export async function removeBatchMerchant(data: (number | undefined)[]) {
|
||||
*/
|
||||
export async function getMerchant(id: number) {
|
||||
const res = await request.get<ApiResult<Merchant>>(
|
||||
SERVER_API_URL + '/system/merchant/' + id
|
||||
MODULES_API_URL + '/shop/merchant/' + id
|
||||
);
|
||||
if (res.data.code === 0 && res.data.data) {
|
||||
return res.data.data;
|
||||
|
||||
@@ -8,6 +8,7 @@ export interface Merchant {
|
||||
merchantId?: number;
|
||||
// 商户名称
|
||||
merchantName?: string;
|
||||
merchantCode?: string;
|
||||
// 商户图标
|
||||
image?: string;
|
||||
// 商户手机号
|
||||
@@ -63,6 +64,8 @@ export interface Merchant {
|
||||
// 默认商户管理角色ID
|
||||
roleId?: number;
|
||||
roleName?: string;
|
||||
label?: string;
|
||||
value?: string;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -1,14 +1,14 @@
|
||||
import request from '@/utils/request';
|
||||
import type { ApiResult, PageResult } from '@/api';
|
||||
import type { Order, OrderParam } from './model';
|
||||
import { MODULES_API_URL } from '@/config/setting';
|
||||
import { SERVER_API_URL } from '@/config/setting';
|
||||
|
||||
/**
|
||||
* 分页查询预约订单
|
||||
*/
|
||||
export async function pageOrder(params: OrderParam) {
|
||||
const res = await request.get<ApiResult<PageResult<Order>>>(
|
||||
MODULES_API_URL + '/shop/order/page',
|
||||
SERVER_API_URL + '/system/order/page',
|
||||
{
|
||||
params
|
||||
}
|
||||
@@ -24,7 +24,7 @@ export async function pageOrder(params: OrderParam) {
|
||||
*/
|
||||
export async function listOrder(params?: OrderParam) {
|
||||
const res = await request.get<ApiResult<Order[]>>(
|
||||
MODULES_API_URL + '/shop/order',
|
||||
SERVER_API_URL + '/system/order',
|
||||
{
|
||||
params
|
||||
}
|
||||
@@ -40,7 +40,7 @@ export async function listOrder(params?: OrderParam) {
|
||||
*/
|
||||
export async function addOrder(data: Order) {
|
||||
const res = await request.post<ApiResult<unknown>>(
|
||||
MODULES_API_URL + '/shop/order',
|
||||
SERVER_API_URL + '/system/order',
|
||||
data
|
||||
);
|
||||
if (res.data.code === 0) {
|
||||
@@ -54,7 +54,7 @@ export async function addOrder(data: Order) {
|
||||
*/
|
||||
export async function updateOrder(data: Order) {
|
||||
const res = await request.put<ApiResult<unknown>>(
|
||||
MODULES_API_URL + '/shop/order',
|
||||
SERVER_API_URL + '/system/order',
|
||||
data
|
||||
);
|
||||
if (res.data.code === 0) {
|
||||
@@ -68,7 +68,7 @@ export async function updateOrder(data: Order) {
|
||||
*/
|
||||
export async function removeOrder(id?: number) {
|
||||
const res = await request.delete<ApiResult<unknown>>(
|
||||
MODULES_API_URL + '/shop/order/' + id
|
||||
SERVER_API_URL + '/system/order/' + id
|
||||
);
|
||||
if (res.data.code === 0) {
|
||||
return res.data.message;
|
||||
@@ -81,7 +81,7 @@ export async function removeOrder(id?: number) {
|
||||
*/
|
||||
export async function removeBatchOrder(data: (number | undefined)[]) {
|
||||
const res = await request.delete<ApiResult<unknown>>(
|
||||
MODULES_API_URL + '/shop/order/batch',
|
||||
SERVER_API_URL + '/system/order/batch',
|
||||
{
|
||||
data
|
||||
}
|
||||
@@ -97,7 +97,7 @@ export async function removeBatchOrder(data: (number | undefined)[]) {
|
||||
*/
|
||||
export async function getOrder(id: number) {
|
||||
const res = await request.get<ApiResult<Order>>(
|
||||
MODULES_API_URL + '/shop/order/' + id
|
||||
SERVER_API_URL + '/system/order/' + id
|
||||
);
|
||||
if (res.data.code === 0 && res.data.data) {
|
||||
return res.data.data;
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import type { PageParam } from '@/api';
|
||||
import { OrderInfo } from "@/api/shop/orderInfo/model";
|
||||
import { OrderInfo } from '@/api/shop/orderInfo/model';
|
||||
|
||||
/**
|
||||
* 预约订单
|
||||
@@ -10,25 +10,23 @@ export interface Order {
|
||||
// 订单编号
|
||||
orderNo?: string;
|
||||
// 微信支付订单号
|
||||
wechatOrder?: string;
|
||||
transactionId?: string;
|
||||
// 微信退款订单号
|
||||
refundOrder?: string;
|
||||
// 场馆id用于权限判断
|
||||
// 商户ID
|
||||
merchantId?: number;
|
||||
// 用户id
|
||||
userId?: number;
|
||||
// 使用的优惠券id
|
||||
couponId?: number;
|
||||
// 使用的会员卡id
|
||||
cardId?: number;
|
||||
cardId?: string;
|
||||
// 关联管理员id
|
||||
aid?: number;
|
||||
// 核销管理员id
|
||||
adminId?: number;
|
||||
// 核销管理员id
|
||||
confirmId?: number;
|
||||
// IC卡号
|
||||
code?: string;
|
||||
icCard?: string;
|
||||
// 真实姓名
|
||||
name?: string;
|
||||
realName?: string;
|
||||
// 手机号码
|
||||
phone?: string;
|
||||
// 订单总额
|
||||
@@ -47,44 +45,54 @@ export interface Order {
|
||||
coachPrice?: string;
|
||||
// 教练id
|
||||
coachId?: number;
|
||||
// 1微信支付,2积分,3支付宝,4现金,5POS机,6VIP月卡,7VIP年卡,8VIP次卡,9IC月卡,10IC年卡,11IC次卡,12免费,13VIP充值卡,14IC充值卡,15积分支付,16VIP季卡,17IC季卡
|
||||
payType?: string;
|
||||
// 1已付款,2未付款
|
||||
// 0余额支付, 1微信支付,2积分,3支付宝,4现金,5POS机,6VIP月卡,7VIP年卡,8VIP次卡,9IC月卡,10IC年卡,11IC次卡,12免费,13VIP充值卡,14IC充值卡,15积分支付,16VIP季卡,17IC季卡
|
||||
payType?: number;
|
||||
// 0未付款,1已付款
|
||||
payStatus?: string;
|
||||
// 1已完成,2未使用,3已取消,4退款申请中,5退款被拒绝,6退款成功,7客户端申请退款
|
||||
orderStatus?: string;
|
||||
// 0未使用,1已完成,2已取消,3取消中,4退款申请中,5退款被拒绝,6退款成功,7客户端申请退款
|
||||
orderStatus?: number;
|
||||
// 优惠类型:0无、1抵扣优惠券、2折扣优惠券、3、VIP月卡、4VIP年卡,5VIP次卡、6VIP会员卡、7IC月卡、8IC年卡、9IC次卡、10IC会员卡、11免费订单、12VIP充值卡、13IC充值卡、14VIP季卡、15IC季卡
|
||||
type?: string;
|
||||
couponType?: number;
|
||||
// 优惠说明
|
||||
couponDesc?: string;
|
||||
// 二维码地址,保存订单号,支付成功后才生成
|
||||
qrcode?: string;
|
||||
// 优惠说明
|
||||
desc?: string;
|
||||
// vip月卡年卡、ic月卡年卡回退次数
|
||||
returnNum?: number;
|
||||
// vip充值回退金额
|
||||
returnMoney?: string;
|
||||
// 预约详情开始时间数组
|
||||
startTime?: string;
|
||||
// 是否已开具发票:1已开发票,2未开发票,3不能开具发票
|
||||
// 是否已开具发票:0未开发票,1已开发票,2不能开具发票
|
||||
isInvoice?: string;
|
||||
// 下单时间
|
||||
createTime?: number;
|
||||
//
|
||||
updateTime?: number;
|
||||
// 付款时间
|
||||
payTime?: number;
|
||||
// 支付时间
|
||||
payTime?: string;
|
||||
// 退款时间
|
||||
refundTime?: number;
|
||||
refundTime?: string;
|
||||
// 申请退款时间
|
||||
refundApplyTime?: number;
|
||||
// 对账情况:1=已对账;2=未对账;3=已对账,金额对不上;4=未查询到该订单
|
||||
refundApplyTime?: string;
|
||||
// 对账情况:0=未对账;1=已对账;3=已对账,金额对不上;4=未查询到该订单
|
||||
checkBill?: number;
|
||||
// 订单是否已结算(0未结算 1已结算)
|
||||
isSettled?: number;
|
||||
// 系统版本号 0当前版本 value=其他版本
|
||||
version?: number;
|
||||
// 用户id
|
||||
userId?: number;
|
||||
// 状态
|
||||
status?: number;
|
||||
// 备注
|
||||
comments?: string;
|
||||
// 排序号
|
||||
sortNumber?: number;
|
||||
// 是否删除, 0否, 1是
|
||||
deleted?: number;
|
||||
// 租户id
|
||||
tenantId?: number;
|
||||
// 修改时间
|
||||
updateTime?: string;
|
||||
// 创建时间
|
||||
createTime?: string;
|
||||
// 商户名称
|
||||
merchantName?: string;
|
||||
// 商户图标
|
||||
@@ -100,4 +108,7 @@ export interface OrderParam extends PageParam {
|
||||
orderId?: number;
|
||||
keywords?: string;
|
||||
userId?: number;
|
||||
merchantId?: number;
|
||||
merchantCode?: string;
|
||||
merchantName?: string;
|
||||
}
|
||||
|
||||
@@ -2,7 +2,7 @@ import request from '@/utils/request';
|
||||
import type { ApiResult } from '@/api';
|
||||
import type { Company, CompanyParam } from './model';
|
||||
import { PageResult } from '@/api';
|
||||
import { MODULES_API_URL, SERVER_API_URL } from '@/config/setting';
|
||||
import { SERVER_API_URL } from '@/config/setting';
|
||||
|
||||
/**
|
||||
* 查询企业资料
|
||||
@@ -25,7 +25,7 @@ export async function getCompany(params?: CompanyParam) {
|
||||
*/
|
||||
export async function getCompanyAll(companyId: number) {
|
||||
const res = await request.get<ApiResult<Company>>(
|
||||
MODULES_API_URL + '/system/company/profileAll/' + companyId
|
||||
SERVER_API_URL + '/system/company/profileAll/' + companyId
|
||||
);
|
||||
if (res.data.code === 0 && res.data) {
|
||||
console.log(res.data);
|
||||
@@ -39,7 +39,7 @@ export async function getCompanyAll(companyId: number) {
|
||||
*/
|
||||
export async function pageCompany(params: CompanyParam) {
|
||||
const res = await request.get<ApiResult<PageResult<Company>>>(
|
||||
MODULES_API_URL + '/system/company/page',
|
||||
SERVER_API_URL + '/system/company/page',
|
||||
{ params }
|
||||
);
|
||||
if (res.data.code === 0) {
|
||||
@@ -67,7 +67,7 @@ export async function pageCompanyAll(params: CompanyParam) {
|
||||
*/
|
||||
export async function addCompany(data: Company) {
|
||||
const res = await request.post<ApiResult<unknown>>(
|
||||
MODULES_API_URL + '/system/company',
|
||||
SERVER_API_URL + '/system/company',
|
||||
data
|
||||
);
|
||||
if (res.data.code === 0) {
|
||||
@@ -90,12 +90,26 @@ export async function updateCompany(data: Company) {
|
||||
return Promise.reject(new Error(res.data.message));
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改CompanyAll
|
||||
*/
|
||||
export async function updateCompanyAll(data: Company) {
|
||||
const res = await request.put<ApiResult<unknown>>(
|
||||
SERVER_API_URL + '/system/company/updateCompanyAll',
|
||||
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>>(
|
||||
MODULES_API_URL + '/system/company/' + id
|
||||
SERVER_API_URL + '/system/company/' + id
|
||||
);
|
||||
if (res.data.code === 0) {
|
||||
return res.data.message;
|
||||
@@ -106,7 +120,7 @@ export async function removeCompany(id?: number) {
|
||||
// 销毁租户
|
||||
export async function destructionTenant(id?: number) {
|
||||
const res = await request.delete<ApiResult<unknown>>(
|
||||
MODULES_API_URL + '/system/company/destruction/' + id
|
||||
SERVER_API_URL + '/system/company/destruction/' + id
|
||||
);
|
||||
if (res.data.code === 0) {
|
||||
return res.data.message;
|
||||
@@ -119,7 +133,7 @@ export async function destructionTenant(id?: number) {
|
||||
*/
|
||||
export async function removeBatchCompany(data: (number | undefined)[]) {
|
||||
const res = await request.delete<ApiResult<unknown>>(
|
||||
MODULES_API_URL + '/system/company/batch',
|
||||
SERVER_API_URL + '/system/company/batch',
|
||||
{
|
||||
data
|
||||
}
|
||||
@@ -136,7 +150,7 @@ export async function checkExistence(
|
||||
id?: number
|
||||
) {
|
||||
const res = await request.get<ApiResult<unknown>>(
|
||||
MODULES_API_URL + '/system/company/existence',
|
||||
SERVER_API_URL + '/system/company/existence',
|
||||
{
|
||||
params: { field, value, id }
|
||||
}
|
||||
|
||||
@@ -14,6 +14,7 @@ export interface Company {
|
||||
companyCode?: string;
|
||||
domain?: string;
|
||||
phone?: string;
|
||||
tel?: string;
|
||||
email?: string;
|
||||
InvoiceHeader?: string;
|
||||
startTime?: string;
|
||||
@@ -47,6 +48,7 @@ export interface Company {
|
||||
planId?: number;
|
||||
sortNumber?: number;
|
||||
authoritative?: boolean;
|
||||
merchantId?: number;
|
||||
tenantId?: number;
|
||||
tenantName?: string;
|
||||
tenantCode?: string;
|
||||
@@ -55,6 +57,13 @@ export interface Company {
|
||||
socketUrl?: string;
|
||||
serverUrl?: string;
|
||||
modulesUrl?: string;
|
||||
merchantUrl?: string;
|
||||
websiteUrl?: string;
|
||||
mpWeixinCode?: string;
|
||||
mpAlipayCode?: string;
|
||||
h5Code?: string;
|
||||
androidUrl?: string;
|
||||
iosUrl?: string;
|
||||
avatar?: string;
|
||||
nickname?: string;
|
||||
code?: number;
|
||||
@@ -62,6 +71,7 @@ export interface Company {
|
||||
updateTime?: string;
|
||||
password?: string;
|
||||
password2?: string;
|
||||
collection?: boolean;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -82,8 +92,11 @@ export interface CompanyParam extends PageParam {
|
||||
city?: string;
|
||||
region?: string;
|
||||
version?: number;
|
||||
status?: number;
|
||||
sceneType?: string;
|
||||
createTimeStart?: string;
|
||||
createTimeEnd?: string;
|
||||
tenantId?: number;
|
||||
collection?: boolean;
|
||||
deleted?: number;
|
||||
}
|
||||
|
||||
@@ -26,6 +26,8 @@ export interface Payment {
|
||||
apiclientKey?: string;
|
||||
// 商户证书序列号
|
||||
merchantSerialNumber?: string;
|
||||
// 支付结果通过
|
||||
notifyUrl?: string;
|
||||
// 备注
|
||||
comments?: string;
|
||||
// 文章排序(数字越小越靠前)
|
||||
|
||||
106
src/api/system/user-collection/index.ts
Normal file
106
src/api/system/user-collection/index.ts
Normal file
@@ -0,0 +1,106 @@
|
||||
import request from '@/utils/request';
|
||||
import type { ApiResult, PageResult } from '@/api';
|
||||
import type { UserCollection, UserCollectionParam } from './model';
|
||||
import { SERVER_API_URL } from '@/config/setting';
|
||||
|
||||
/**
|
||||
* 分页查询我的收藏
|
||||
*/
|
||||
export async function pageUserCollection(params: UserCollectionParam) {
|
||||
const res = await request.get<ApiResult<PageResult<UserCollection>>>(
|
||||
SERVER_API_URL + '/system/user-collection/page',
|
||||
{
|
||||
params
|
||||
}
|
||||
);
|
||||
if (res.data.code === 0) {
|
||||
return res.data.data;
|
||||
}
|
||||
return Promise.reject(new Error(res.data.message));
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询我的收藏列表
|
||||
*/
|
||||
export async function listUserCollection(params?: UserCollectionParam) {
|
||||
const res = await request.get<ApiResult<UserCollection[]>>(
|
||||
SERVER_API_URL + '/system/user-collection',
|
||||
{
|
||||
params
|
||||
}
|
||||
);
|
||||
if (res.data.code === 0 && res.data.data) {
|
||||
return res.data.data;
|
||||
}
|
||||
return Promise.reject(new Error(res.data.message));
|
||||
}
|
||||
|
||||
/**
|
||||
* 添加我的收藏
|
||||
*/
|
||||
export async function addUserCollection(data: UserCollection) {
|
||||
const res = await request.post<ApiResult<unknown>>(
|
||||
SERVER_API_URL + '/system/user-collection',
|
||||
data
|
||||
);
|
||||
if (res.data.code === 0) {
|
||||
return res.data.message;
|
||||
}
|
||||
return Promise.reject(new Error(res.data.message));
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改我的收藏
|
||||
*/
|
||||
export async function updateUserCollection(data: UserCollection) {
|
||||
const res = await request.put<ApiResult<unknown>>(
|
||||
SERVER_API_URL + '/system/user-collection',
|
||||
data
|
||||
);
|
||||
if (res.data.code === 0) {
|
||||
return res.data.message;
|
||||
}
|
||||
return Promise.reject(new Error(res.data.message));
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除我的收藏
|
||||
*/
|
||||
export async function removeUserCollection(id?: number) {
|
||||
const res = await request.delete<ApiResult<unknown>>(
|
||||
SERVER_API_URL + '/system/user-collection/' + id
|
||||
);
|
||||
if (res.data.code === 0) {
|
||||
return res.data.message;
|
||||
}
|
||||
return Promise.reject(new Error(res.data.message));
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量删除我的收藏
|
||||
*/
|
||||
export async function removeBatchUserCollection(data: (number | undefined)[]) {
|
||||
const res = await request.delete<ApiResult<unknown>>(
|
||||
SERVER_API_URL + '/system/user-collection/batch',
|
||||
{
|
||||
data
|
||||
}
|
||||
);
|
||||
if (res.data.code === 0) {
|
||||
return res.data.message;
|
||||
}
|
||||
return Promise.reject(new Error(res.data.message));
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据id查询我的收藏
|
||||
*/
|
||||
export async function getUserCollection(id: number) {
|
||||
const res = await request.get<ApiResult<UserCollection>>(
|
||||
SERVER_API_URL + '/system/user-collection/' + id
|
||||
);
|
||||
if (res.data.code === 0 && res.data.data) {
|
||||
return res.data.data;
|
||||
}
|
||||
return Promise.reject(new Error(res.data.message));
|
||||
}
|
||||
25
src/api/system/user-collection/model/index.ts
Normal file
25
src/api/system/user-collection/model/index.ts
Normal file
@@ -0,0 +1,25 @@
|
||||
import type { PageParam } from '@/api';
|
||||
|
||||
/**
|
||||
* 我的收藏
|
||||
*/
|
||||
export interface UserCollection {
|
||||
// 主键ID
|
||||
id?: number;
|
||||
// 租户ID
|
||||
tid?: number;
|
||||
// 用户ID
|
||||
userId?: number;
|
||||
// 租户id
|
||||
tenantId?: number;
|
||||
// 注册时间
|
||||
createTime?: string;
|
||||
}
|
||||
|
||||
/**
|
||||
* 我的收藏搜索条件
|
||||
*/
|
||||
export interface UserCollectionParam extends PageParam {
|
||||
id?: number;
|
||||
keywords?: string;
|
||||
}
|
||||
62
src/components/SelectMerchantDown/index.vue
Normal file
62
src/components/SelectMerchantDown/index.vue
Normal file
@@ -0,0 +1,62 @@
|
||||
<!-- 选择下拉框 -->
|
||||
<template>
|
||||
<a-select
|
||||
:allow-clear="true"
|
||||
:show-search="true"
|
||||
optionFilterProp="label"
|
||||
:options="options"
|
||||
:value="value"
|
||||
:placeholder="placeholder"
|
||||
@update:value="updateValue"
|
||||
:style="`width: 200px`"
|
||||
@blur="onBlur"
|
||||
/>
|
||||
</template>
|
||||
|
||||
<script lang="ts" setup>
|
||||
import { ref } from 'vue';
|
||||
import { Merchant } from '@/api/shop/merchant/model';
|
||||
import { listMerchant } from '@/api/shop/merchant';
|
||||
|
||||
const emit = defineEmits<{
|
||||
(e: 'update:value', value: string, item: any): void;
|
||||
(e: 'blur'): void;
|
||||
}>();
|
||||
|
||||
const props = withDefaults(
|
||||
defineProps<{
|
||||
value?: any;
|
||||
type?: any;
|
||||
placeholder?: string;
|
||||
dictCode?: string;
|
||||
}>(),
|
||||
{
|
||||
placeholder: '请选择场馆'
|
||||
}
|
||||
);
|
||||
|
||||
// 字典数据
|
||||
const options = ref<Merchant[]>([]);
|
||||
|
||||
/* 更新选中数据 */
|
||||
const updateValue = (value: string) => {
|
||||
const item = options.value?.find((d) => d.merchantName == value);
|
||||
emit('update:value', value, item);
|
||||
};
|
||||
/* 失去焦点 */
|
||||
const onBlur = () => {
|
||||
emit('blur');
|
||||
};
|
||||
|
||||
const reload = () => {
|
||||
listMerchant({}).then((list) => {
|
||||
options.value = list.map((d) => {
|
||||
d.label = d.merchantName;
|
||||
d.value = d.merchantCode;
|
||||
return d;
|
||||
});
|
||||
});
|
||||
};
|
||||
|
||||
reload();
|
||||
</script>
|
||||
@@ -42,7 +42,7 @@ export const useTenantStore = defineStore({
|
||||
if (company) {
|
||||
this.company = company;
|
||||
localStorage.setItem('TenantId', String(company.tenantId));
|
||||
localStorage.setItem('TenantName', String(company.companyName));
|
||||
localStorage.setItem('TenantName', String(company.shortName));
|
||||
localStorage.setItem('CompanyId', String(company.companyId));
|
||||
}
|
||||
// 用户菜单, 过滤掉按钮类型并转为 children 形式
|
||||
|
||||
@@ -48,6 +48,14 @@ export function getTenantId() {
|
||||
return getDomainPart1();
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取根域名
|
||||
* hostname
|
||||
*/
|
||||
export function getHostname(): string {
|
||||
return window.location.hostname;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取域名
|
||||
* @return https://www.domain.com
|
||||
|
||||
@@ -10,7 +10,7 @@ import { API_BASE_URL, TOKEN_HEADER_NAME, LAYOUT_PATH } from '@/config/setting';
|
||||
import { getToken, setToken } from './token-util';
|
||||
import { logout } from './page-tab-util';
|
||||
import type { ApiResult } from '@/api';
|
||||
import { getTenantId } from '@/utils/domain';
|
||||
import { getHostname, getTenantId } from "@/utils/domain";
|
||||
|
||||
const service = axios.create({
|
||||
baseURL: API_BASE_URL
|
||||
@@ -34,6 +34,10 @@ service.interceptors.request.use(
|
||||
if (companyId) {
|
||||
config.headers.common['CompanyId'] = companyId;
|
||||
}
|
||||
// 通过网站域名获取租户ID
|
||||
if (getHostname()){
|
||||
config.headers.common['Domain'] = getHostname();
|
||||
}
|
||||
// 解析二级域名获取租户ID
|
||||
if (getTenantId()) {
|
||||
config.headers.common['TenantId'] = getTenantId();
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
<!-- 编辑弹窗 -->
|
||||
<template>
|
||||
<ele-modal
|
||||
:width="800"
|
||||
:width="1000"
|
||||
:visible="visible"
|
||||
:maskClosable="false"
|
||||
:maxable="maxable"
|
||||
:title="isUpdate ? '编辑预约订单' : '添加预约订单'"
|
||||
:title="isUpdate ? '编辑订单' : '添加订单'"
|
||||
:body-style="{ paddingBottom: '28px' }"
|
||||
@update:visible="updateVisible"
|
||||
@ok="save"
|
||||
@@ -23,40 +23,38 @@
|
||||
<a-input
|
||||
allow-clear
|
||||
placeholder="请输入订单编号"
|
||||
:disabled="true"
|
||||
v-model:value="form.orderNo"
|
||||
/>
|
||||
</a-form-item>
|
||||
<a-form-item label="微信支付订单号" name="wechatOrder">
|
||||
<a-form-item label="微信支付订单号" name="transactionId">
|
||||
<a-input
|
||||
allow-clear
|
||||
:disabled="true"
|
||||
placeholder="请输入微信支付订单号"
|
||||
v-model:value="form.wechatOrder"
|
||||
v-model:value="form.transactionId"
|
||||
/>
|
||||
</a-form-item>
|
||||
<a-form-item label="微信退款订单号" name="refundOrder">
|
||||
<a-input
|
||||
allow-clear
|
||||
:disabled="true"
|
||||
placeholder="请输入微信退款订单号"
|
||||
v-model:value="form.refundOrder"
|
||||
/>
|
||||
</a-form-item>
|
||||
<a-form-item label="场馆id用于权限判断" name="merchantId">
|
||||
<a-form-item label="商户ID" name="merchantId">
|
||||
<a-input
|
||||
allow-clear
|
||||
placeholder="请输入场馆id用于权限判断"
|
||||
:disabled="true"
|
||||
placeholder="请输入商户ID"
|
||||
v-model:value="form.merchantId"
|
||||
/>
|
||||
</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="使用的优惠券id" name="couponId">
|
||||
<a-input
|
||||
allow-clear
|
||||
:disabled="true"
|
||||
placeholder="请输入使用的优惠券id"
|
||||
v-model:value="form.couponId"
|
||||
/>
|
||||
@@ -64,41 +62,31 @@
|
||||
<a-form-item label="使用的会员卡id" name="cardId">
|
||||
<a-input
|
||||
allow-clear
|
||||
:disabled="true"
|
||||
placeholder="请输入使用的会员卡id"
|
||||
v-model:value="form.cardId"
|
||||
/>
|
||||
</a-form-item>
|
||||
<a-form-item label="关联管理员id" name="aid">
|
||||
<a-input
|
||||
allow-clear
|
||||
placeholder="请输入关联管理员id"
|
||||
v-model:value="form.aid"
|
||||
/>
|
||||
</a-form-item>
|
||||
<a-form-item label="核销管理员id" name="adminId">
|
||||
<a-input
|
||||
allow-clear
|
||||
placeholder="请输入核销管理员id"
|
||||
v-model:value="form.adminId"
|
||||
/>
|
||||
</a-form-item>
|
||||
<a-form-item label="IC卡号" name="code">
|
||||
<a-form-item label="IC卡号" name="icCard">
|
||||
<a-input
|
||||
allow-clear
|
||||
:disabled="true"
|
||||
placeholder="请输入IC卡号"
|
||||
v-model:value="form.code"
|
||||
v-model:value="form.icCard"
|
||||
/>
|
||||
</a-form-item>
|
||||
<a-form-item label="真实姓名" name="name">
|
||||
<a-form-item label="真实姓名" name="realName">
|
||||
<a-input
|
||||
allow-clear
|
||||
:disabled="true"
|
||||
placeholder="请输入真实姓名"
|
||||
v-model:value="form.name"
|
||||
v-model:value="form.realName"
|
||||
/>
|
||||
</a-form-item>
|
||||
<a-form-item label="手机号码" name="phone">
|
||||
<a-input
|
||||
allow-clear
|
||||
:disabled="true"
|
||||
placeholder="请输入手机号码"
|
||||
v-model:value="form.phone"
|
||||
/>
|
||||
@@ -106,16 +94,15 @@
|
||||
<a-form-item label="订单总额" name="totalPrice">
|
||||
<a-input
|
||||
allow-clear
|
||||
:disabled="true"
|
||||
placeholder="请输入订单总额"
|
||||
v-model:value="form.totalPrice"
|
||||
/>
|
||||
</a-form-item>
|
||||
<a-form-item
|
||||
label="减少的金额,使用VIP会员折扣、优惠券抵扣、优惠券折扣后减去的价格"
|
||||
name="reducePrice"
|
||||
>
|
||||
<a-form-item label="减少的金额" name="reducePrice">
|
||||
<a-input
|
||||
allow-clear
|
||||
:disabled="true"
|
||||
placeholder="请输入减少的金额,使用VIP会员折扣、优惠券抵扣、优惠券折扣后减去的价格"
|
||||
v-model:value="form.reducePrice"
|
||||
/>
|
||||
@@ -123,147 +110,139 @@
|
||||
<a-form-item label="实际付款" name="payPrice">
|
||||
<a-input
|
||||
allow-clear
|
||||
:disabled="true"
|
||||
placeholder="请输入实际付款"
|
||||
v-model:value="form.payPrice"
|
||||
/>
|
||||
</a-form-item>
|
||||
<a-form-item label="用于统计" name="price">
|
||||
<a-input
|
||||
allow-clear
|
||||
placeholder="请输入用于统计"
|
||||
v-model:value="form.price"
|
||||
/>
|
||||
</a-form-item>
|
||||
<a-form-item label="价钱,用于积分赠送" name="money">
|
||||
<a-input
|
||||
allow-clear
|
||||
placeholder="请输入价钱,用于积分赠送"
|
||||
v-model:value="form.money"
|
||||
/>
|
||||
</a-form-item>
|
||||
<a-form-item label="退款金额" name="refundMoney">
|
||||
<!-- <a-form-item label="用于统计" name="price">-->
|
||||
<!-- <a-input-->
|
||||
<!-- allow-clear-->
|
||||
<!-- placeholder="请输入用于统计"-->
|
||||
<!-- v-model:value="form.price"-->
|
||||
<!-- />-->
|
||||
<!-- </a-form-item>-->
|
||||
<!-- <a-form-item label="价钱,用于积分赠送" name="money">-->
|
||||
<!-- <a-input-->
|
||||
<!-- allow-clear-->
|
||||
<!-- placeholder="请输入价钱,用于积分赠送"-->
|
||||
<!-- v-model:value="form.money"-->
|
||||
<!-- />-->
|
||||
<!-- </a-form-item>-->
|
||||
<a-form-item label="退款金额" name="refundMoney" v-if="form.refundMoney">
|
||||
<a-input
|
||||
allow-clear
|
||||
:disabled="true"
|
||||
placeholder="请输入退款金额"
|
||||
v-model:value="form.refundMoney"
|
||||
/>
|
||||
</a-form-item>
|
||||
<a-form-item label="教练价格" name="coachPrice">
|
||||
<!-- <a-form-item label="教练价格" name="coachPrice">-->
|
||||
<!-- <a-input-->
|
||||
<!-- allow-clear-->
|
||||
<!-- placeholder="请输入教练价格"-->
|
||||
<!-- v-model:value="form.coachPrice"-->
|
||||
<!-- />-->
|
||||
<!-- </a-form-item>-->
|
||||
<!-- <a-form-item label="教练id" name="coachId">-->
|
||||
<!-- <a-input-->
|
||||
<!-- allow-clear-->
|
||||
<!-- placeholder="请输入教练id"-->
|
||||
<!-- v-model:value="form.coachId"-->
|
||||
<!-- />-->
|
||||
<!-- </a-form-item>-->
|
||||
<a-form-item label="支付方式" name="payType">
|
||||
<a-input
|
||||
allow-clear
|
||||
placeholder="请输入教练价格"
|
||||
v-model:value="form.coachPrice"
|
||||
/>
|
||||
</a-form-item>
|
||||
<a-form-item label="教练id" name="coachId">
|
||||
<a-input
|
||||
allow-clear
|
||||
placeholder="请输入教练id"
|
||||
v-model:value="form.coachId"
|
||||
/>
|
||||
</a-form-item>
|
||||
<a-form-item
|
||||
label="1微信支付,2积分,3支付宝,4现金,5POS机,6VIP月卡,7VIP年卡,8VIP次卡,9IC月卡,10IC年卡,11IC次卡,12免费,13VIP充值卡,14IC充值卡,15积分支付,16VIP季卡,17IC季卡"
|
||||
name="payType"
|
||||
>
|
||||
<a-input
|
||||
allow-clear
|
||||
placeholder="请输入1微信支付,2积分,3支付宝,4现金,5POS机,6VIP月卡,7VIP年卡,8VIP次卡,9IC月卡,10IC年卡,11IC次卡,12免费,13VIP充值卡,14IC充值卡,15积分支付,16VIP季卡,17IC季卡"
|
||||
:disabled="true"
|
||||
placeholder="请输入支付方式 0余额支付, 1微信支付,2积分,3支付宝,4现金,5POS机,6VIP月卡,7VIP年卡,8VIP次卡,9IC月卡,10IC年卡,11IC次卡,12免费,13VIP充值卡,14IC充值卡,15积分支付,16VIP季卡,17IC季卡"
|
||||
v-model:value="form.payType"
|
||||
/>
|
||||
</a-form-item>
|
||||
<a-form-item label="1已付款,2未付款" name="payStatus">
|
||||
<a-form-item label="支付状态" name="payStatus">
|
||||
<a-input
|
||||
allow-clear
|
||||
placeholder="请输入1已付款,2未付款"
|
||||
:disabled="true"
|
||||
placeholder="请输入0未付款,1已付款"
|
||||
v-model:value="form.payStatus"
|
||||
/>
|
||||
</a-form-item>
|
||||
<a-form-item
|
||||
label="1已完成,2未使用,3已取消,4退款申请中,5退款被拒绝,6退款成功,7客户端申请退款"
|
||||
name="orderStatus"
|
||||
>
|
||||
<a-form-item label="订单状态" name="orderStatus">
|
||||
<a-input
|
||||
allow-clear
|
||||
placeholder="请输入1已完成,2未使用,3已取消,4退款申请中,5退款被拒绝,6退款成功,7客户端申请退款"
|
||||
:disabled="true"
|
||||
placeholder="请输入0未使用,1已完成,2已取消,3取消中,4退款申请中,5退款被拒绝,6退款成功,7客户端申请退款"
|
||||
v-model:value="form.orderStatus"
|
||||
/>
|
||||
</a-form-item>
|
||||
<a-form-item
|
||||
label="优惠类型:0无、1抵扣优惠券、2折扣优惠券、3、VIP月卡、4VIP年卡,5VIP次卡、6VIP会员卡、7IC月卡、8IC年卡、9IC次卡、10IC会员卡、11免费订单、12VIP充值卡、13IC充值卡、14VIP季卡、15IC季卡"
|
||||
name="type"
|
||||
>
|
||||
<a-form-item label="优惠类型" name="couponType">
|
||||
<a-input
|
||||
allow-clear
|
||||
:disabled="true"
|
||||
placeholder="请输入优惠类型:0无、1抵扣优惠券、2折扣优惠券、3、VIP月卡、4VIP年卡,5VIP次卡、6VIP会员卡、7IC月卡、8IC年卡、9IC次卡、10IC会员卡、11免费订单、12VIP充值卡、13IC充值卡、14VIP季卡、15IC季卡"
|
||||
v-model:value="form.type"
|
||||
v-model:value="form.couponType"
|
||||
/>
|
||||
</a-form-item>
|
||||
<a-form-item
|
||||
label="二维码地址,保存订单号,支付成功后才生成"
|
||||
name="qrcode"
|
||||
>
|
||||
<a-input
|
||||
allow-clear
|
||||
placeholder="请输入二维码地址,保存订单号,支付成功后才生成"
|
||||
v-model:value="form.qrcode"
|
||||
/>
|
||||
</a-form-item>
|
||||
<a-form-item label="优惠说明" name="desc">
|
||||
<a-form-item label="优惠说明" name="couponDesc">
|
||||
<a-input
|
||||
allow-clear
|
||||
:disabled="true"
|
||||
placeholder="请输入优惠说明"
|
||||
v-model:value="form.desc"
|
||||
/>
|
||||
</a-form-item>
|
||||
<a-form-item label="vip月卡年卡、ic月卡年卡回退次数" name="returnNum">
|
||||
<a-input
|
||||
allow-clear
|
||||
placeholder="请输入vip月卡年卡、ic月卡年卡回退次数"
|
||||
v-model:value="form.returnNum"
|
||||
/>
|
||||
</a-form-item>
|
||||
<a-form-item label="vip充值回退金额" name="returnMoney">
|
||||
<a-input
|
||||
allow-clear
|
||||
placeholder="请输入vip充值回退金额"
|
||||
v-model:value="form.returnMoney"
|
||||
v-model:value="form.couponDesc"
|
||||
/>
|
||||
</a-form-item>
|
||||
<!-- <a-form-item-->
|
||||
<!-- label="二维码地址,保存订单号,支付成功后才生成"-->
|
||||
<!-- name="qrcode"-->
|
||||
<!-- >-->
|
||||
<!-- <a-input-->
|
||||
<!-- allow-clear-->
|
||||
<!-- placeholder="请输入二维码地址,保存订单号,支付成功后才生成"-->
|
||||
<!-- v-model:value="form.qrcode"-->
|
||||
<!-- />-->
|
||||
<!-- </a-form-item>-->
|
||||
<!-- <a-form-item label="vip月卡年卡、ic月卡年卡回退次数" name="returnNum">-->
|
||||
<!-- <a-input-->
|
||||
<!-- allow-clear-->
|
||||
<!-- placeholder="请输入vip月卡年卡、ic月卡年卡回退次数"-->
|
||||
<!-- v-model:value="form.returnNum"-->
|
||||
<!-- />-->
|
||||
<!-- </a-form-item>-->
|
||||
<!-- <a-form-item label="vip充值回退金额" name="returnMoney">-->
|
||||
<!-- <a-input-->
|
||||
<!-- allow-clear-->
|
||||
<!-- placeholder="请输入vip充值回退金额"-->
|
||||
<!-- v-model:value="form.returnMoney"-->
|
||||
<!-- />-->
|
||||
<!-- </a-form-item>-->
|
||||
<a-form-item label="预约详情开始时间数组" name="startTime">
|
||||
<a-input
|
||||
allow-clear
|
||||
:disabled="true"
|
||||
placeholder="请输入预约详情开始时间数组"
|
||||
v-model:value="form.startTime"
|
||||
/>
|
||||
</a-form-item>
|
||||
<a-form-item
|
||||
label="是否已开具发票:1已开发票,2未开发票,3不能开具发票"
|
||||
name="isInvoice"
|
||||
>
|
||||
<a-form-item label="是否已开具发票" name="isInvoice">
|
||||
<a-input
|
||||
allow-clear
|
||||
placeholder="请输入是否已开具发票:1已开发票,2未开发票,3不能开具发票"
|
||||
:disabled="true"
|
||||
placeholder="请输入是否已开具发票:0未开发票,1已开发票,2不能开具发票"
|
||||
v-model:value="form.isInvoice"
|
||||
/>
|
||||
</a-form-item>
|
||||
<a-form-item label="" name="updateTime">
|
||||
<a-form-item label="支付时间" name="payTime">
|
||||
<a-input
|
||||
allow-clear
|
||||
placeholder="请输入"
|
||||
v-model:value="form.updateTime"
|
||||
/>
|
||||
</a-form-item>
|
||||
<a-form-item label="付款时间" name="payTime">
|
||||
<a-input
|
||||
allow-clear
|
||||
placeholder="请输入付款时间"
|
||||
:disabled="true"
|
||||
placeholder="请输入支付时间"
|
||||
v-model:value="form.payTime"
|
||||
/>
|
||||
</a-form-item>
|
||||
<a-form-item label="退款时间" name="refundTime">
|
||||
<a-input
|
||||
allow-clear
|
||||
:disabled="true"
|
||||
placeholder="请输入退款时间"
|
||||
v-model:value="form.refundTime"
|
||||
/>
|
||||
@@ -271,35 +250,36 @@
|
||||
<a-form-item label="申请退款时间" name="refundApplyTime">
|
||||
<a-input
|
||||
allow-clear
|
||||
:disabled="true"
|
||||
placeholder="请输入申请退款时间"
|
||||
v-model:value="form.refundApplyTime"
|
||||
/>
|
||||
</a-form-item>
|
||||
<a-form-item
|
||||
label="对账情况:1=已对账;2=未对账;3=已对账,金额对不上;4=未查询到该订单"
|
||||
name="checkBill"
|
||||
>
|
||||
<a-form-item label="对账情况" name="checkBill">
|
||||
<a-input
|
||||
allow-clear
|
||||
placeholder="请输入对账情况:1=已对账;2=未对账;3=已对账,金额对不上;4=未查询到该订单"
|
||||
:disabled="true"
|
||||
placeholder="请输入对账情况:0=未对账;1=已对账;3=已对账,金额对不上;4=未查询到该订单"
|
||||
v-model:value="form.checkBill"
|
||||
/>
|
||||
</a-form-item>
|
||||
<a-form-item label="订单是否已结算" name="isSettled">
|
||||
<a-input
|
||||
allow-clear
|
||||
:disabled="true"
|
||||
placeholder="请输入订单是否已结算(0未结算 1已结算)"
|
||||
v-model:value="form.isSettled"
|
||||
/>
|
||||
</a-form-item>
|
||||
<a-form-item label="备注" name="comments">
|
||||
<a-textarea
|
||||
:rows="4"
|
||||
:maxlength="200"
|
||||
:disabled="true"
|
||||
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>
|
||||
</ele-modal>
|
||||
</template>
|
||||
@@ -347,16 +327,15 @@
|
||||
const form = reactive<Order>({
|
||||
orderId: undefined,
|
||||
orderNo: undefined,
|
||||
wechatOrder: undefined,
|
||||
transactionId: undefined,
|
||||
refundOrder: undefined,
|
||||
merchantId: undefined,
|
||||
userId: undefined,
|
||||
couponId: undefined,
|
||||
cardId: undefined,
|
||||
aid: undefined,
|
||||
adminId: undefined,
|
||||
code: undefined,
|
||||
name: undefined,
|
||||
confirmId: undefined,
|
||||
icCard: undefined,
|
||||
realName: undefined,
|
||||
phone: undefined,
|
||||
totalPrice: undefined,
|
||||
reducePrice: undefined,
|
||||
@@ -369,22 +348,27 @@
|
||||
payType: undefined,
|
||||
payStatus: undefined,
|
||||
orderStatus: undefined,
|
||||
type: undefined,
|
||||
couponType: undefined,
|
||||
couponDesc: undefined,
|
||||
qrcode: undefined,
|
||||
desc: undefined,
|
||||
returnNum: undefined,
|
||||
returnMoney: undefined,
|
||||
startTime: undefined,
|
||||
isInvoice: undefined,
|
||||
createTime: undefined,
|
||||
updateTime: undefined,
|
||||
payTime: undefined,
|
||||
refundTime: undefined,
|
||||
refundApplyTime: undefined,
|
||||
checkBill: undefined,
|
||||
isSettled: undefined,
|
||||
version: undefined,
|
||||
userId: undefined,
|
||||
deleted: undefined,
|
||||
tenantId: undefined,
|
||||
comments: ''
|
||||
updateTime: undefined,
|
||||
createTime: undefined,
|
||||
status: 0,
|
||||
comments: '',
|
||||
sortNumber: 100
|
||||
});
|
||||
|
||||
/* 更新visible */
|
||||
@@ -398,7 +382,7 @@
|
||||
{
|
||||
required: true,
|
||||
type: 'string',
|
||||
message: '请填写预约订单名称',
|
||||
message: '请填写订单名称',
|
||||
trigger: 'blur'
|
||||
}
|
||||
]
|
||||
|
||||
417
src/views/booking/order/components/orderInfo.vue
Normal file
417
src/views/booking/order/components/orderInfo.vue
Normal file
@@ -0,0 +1,417 @@
|
||||
<!-- 用户编辑弹窗 -->
|
||||
<template>
|
||||
<ele-modal
|
||||
:width="`80%`"
|
||||
:visible="visible"
|
||||
:confirm-loading="loading"
|
||||
:maxable="maxAble"
|
||||
:title="isUpdate ? '编辑订单' : '订单详情'"
|
||||
:body-style="{ paddingBottom: '8px', background: '#f3f3f3' }"
|
||||
@update:visible="updateVisible"
|
||||
:maskClosable="false"
|
||||
:footer="null"
|
||||
@ok="save"
|
||||
>
|
||||
<a-card class="order-card" :bordered="false">
|
||||
<a-descriptions title="基本信息" :column="3">
|
||||
<a-descriptions-item
|
||||
label="订单号"
|
||||
:labelStyle="{ width: '90px', color: '#808080' }"
|
||||
>
|
||||
{{ form.orderId }}
|
||||
</a-descriptions-item>
|
||||
<a-descriptions-item
|
||||
label="订单编号"
|
||||
:labelStyle="{ width: '90px', color: '#808080' }"
|
||||
>
|
||||
{{ form.orderNo }}
|
||||
</a-descriptions-item>
|
||||
<a-descriptions-item
|
||||
label="订单状态"
|
||||
:labelStyle="{ width: '90px', color: '#808080' }"
|
||||
>
|
||||
<a-tag v-if="form.orderStatus == 0">未使用</a-tag>
|
||||
<a-tag v-if="form.orderStatus == 1">已付款</a-tag>
|
||||
<a-tag v-if="form.orderStatus == 3">已取消</a-tag>
|
||||
<a-tag v-if="form.orderStatus == 4">退款申请中</a-tag>
|
||||
<a-tag v-if="form.orderStatus == 5">退款被拒绝</a-tag>
|
||||
<a-tag v-if="form.orderStatus == 6">退款成功</a-tag>
|
||||
<a-tag v-if="form.orderStatus == 7">客户端申请退款</a-tag>
|
||||
</a-descriptions-item>
|
||||
<a-descriptions-item
|
||||
label="买家信息"
|
||||
:labelStyle="{ width: '90px', color: '#808080' }"
|
||||
>
|
||||
{{ form.realName }}
|
||||
</a-descriptions-item>
|
||||
<a-descriptions-item
|
||||
label="手机号码"
|
||||
:labelStyle="{ width: '90px', color: '#808080' }"
|
||||
>
|
||||
{{ form.phone }}
|
||||
</a-descriptions-item>
|
||||
<a-descriptions-item
|
||||
label="交易流水号"
|
||||
:labelStyle="{ width: '90px', color: '#808080' }"
|
||||
>
|
||||
{{ form.transactionId }}
|
||||
</a-descriptions-item>
|
||||
<a-descriptions-item
|
||||
label="订单总金额"
|
||||
:labelStyle="{ width: '90px', color: '#808080' }"
|
||||
>
|
||||
¥{{ form.totalPrice }}
|
||||
</a-descriptions-item>
|
||||
<a-descriptions-item
|
||||
label="实付金额"
|
||||
:labelStyle="{ width: '90px', color: '#808080' }"
|
||||
>
|
||||
¥{{ form.payPrice }}
|
||||
</a-descriptions-item>
|
||||
<a-descriptions-item
|
||||
label="减少金额"
|
||||
:labelStyle="{ width: '90px', color: '#808080' }"
|
||||
>
|
||||
¥{{ form.reducePrice }}
|
||||
</a-descriptions-item>
|
||||
<a-descriptions-item
|
||||
label="支付方式"
|
||||
:labelStyle="{ width: '90px', color: '#808080' }"
|
||||
>
|
||||
<template v-if="form.payStatus == 1">
|
||||
<a-tag v-if="form.payType == 1">微信支付</a-tag>
|
||||
<a-tag v-if="form.payType == 2">积分</a-tag>
|
||||
<a-tag v-if="form.payType == 3">支付宝</a-tag>
|
||||
<a-tag v-if="form.payType == 4">现金</a-tag>
|
||||
<a-tag v-if="form.payType == 5">POS机</a-tag>
|
||||
<a-tag v-if="form.payType == 6">VIP月卡</a-tag>
|
||||
<a-tag v-if="form.payType == 7">formVIP年卡</a-tag>
|
||||
<a-tag v-if="form.payType == 8">formVIP次卡</a-tag>
|
||||
<a-tag v-if="form.payType == 9">formIC月卡</a-tag>
|
||||
<a-tag v-if="form.payType == 10">formIC年卡</a-tag>
|
||||
<a-tag v-if="form.payType == 11">formIC次卡</a-tag>
|
||||
<a-tag v-if="form.payType == 12">form免费</a-tag>
|
||||
<a-tag v-if="form.payType == 13">formVIP充值卡</a-tag>
|
||||
<a-tag v-if="form.payType == 14">formIC充值卡</a-tag>
|
||||
<a-tag v-if="form.payType == 15">form积分支付</a-tag>
|
||||
<a-tag v-if="form.payType == 16">formVIP季卡</a-tag>
|
||||
<a-tag v-if="form.payType == 17">formIC季卡</a-tag>
|
||||
</template>
|
||||
<template v-else>
|
||||
<span></span>
|
||||
</template>
|
||||
</a-descriptions-item>
|
||||
<a-descriptions-item
|
||||
label="支付状态"
|
||||
:labelStyle="{ width: '90px', color: '#808080' }"
|
||||
>
|
||||
<a-tag v-if="form.payStatus == 1" color="green"
|
||||
><CheckOutlined class="tag-icon" />已付款</a-tag
|
||||
>
|
||||
<a-tag v-if="form.payStatus == 0" color="error"
|
||||
><CloseOutlined class="tag-icon" />未付款</a-tag
|
||||
>
|
||||
<a-tag v-if="form.payStatus == 3" color="cyan"
|
||||
><CoffeeOutlined class="tag-icon" />未付款,占场中</a-tag
|
||||
>
|
||||
</a-descriptions-item>
|
||||
<a-descriptions-item
|
||||
label="付款时间"
|
||||
:labelStyle="{ width: '90px', color: '#808080' }"
|
||||
>
|
||||
{{ form.payTime }}
|
||||
</a-descriptions-item>
|
||||
<a-descriptions-item
|
||||
label="下单时间"
|
||||
:labelStyle="{ width: '90px', color: '#808080' }"
|
||||
>
|
||||
{{ form.createTime }}
|
||||
</a-descriptions-item>
|
||||
<a-descriptions-item
|
||||
label="信息备注"
|
||||
:labelStyle="{ width: '90px', color: '#808080' }"
|
||||
>
|
||||
{{ form.comments }}
|
||||
</a-descriptions-item>
|
||||
</a-descriptions>
|
||||
</a-card>
|
||||
<a-card class="order-card" :bordered="false">
|
||||
<a-spin :spinning="loading">
|
||||
<a-table
|
||||
:data-source="form.orderInfoList"
|
||||
:columns="columns"
|
||||
:pagination="false"
|
||||
>
|
||||
<template #bodyCell="{ column, record }">
|
||||
<template v-if="column.key === 'goodsName'">
|
||||
<div class="order-info">
|
||||
<a-image
|
||||
v-if="record.imageUrl"
|
||||
:src="record.imageUrl"
|
||||
:preview="false"
|
||||
:width="50"
|
||||
/>
|
||||
<div class="info">
|
||||
<div>{{ record.goodsName }}</div>
|
||||
<div class="ele-text-placeholder" v-if="record.gear === 10">
|
||||
食堂档口
|
||||
</div>
|
||||
<div class="ele-text-placeholder" v-if="record.gear === 20">
|
||||
物品档口
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
</template>
|
||||
</a-table>
|
||||
</a-spin>
|
||||
</a-card>
|
||||
</ele-modal>
|
||||
</template>
|
||||
|
||||
<script lang="ts" setup>
|
||||
import { ref, reactive, watch } from 'vue';
|
||||
import { Form } from 'ant-design-vue';
|
||||
import { assignObject } from 'ele-admin-pro';
|
||||
import { Order } from '@/api/shop/order/model';
|
||||
import { ColumnItem } from 'ele-admin-pro/es/ele-pro-table/types';
|
||||
import {
|
||||
CheckOutlined,
|
||||
CloseOutlined,
|
||||
CoffeeOutlined
|
||||
} from '@ant-design/icons-vue';
|
||||
|
||||
const useForm = Form.useForm;
|
||||
|
||||
const props = defineProps<{
|
||||
// 弹窗是否打开
|
||||
visible: boolean;
|
||||
// 修改回显的数据
|
||||
data?: Order | null;
|
||||
}>();
|
||||
|
||||
export interface step {
|
||||
title?: String | undefined;
|
||||
subTitle?: String | undefined;
|
||||
description?: String | undefined;
|
||||
}
|
||||
|
||||
// 是否是修改
|
||||
const isUpdate = ref(false);
|
||||
// 是否显示最大化切换按钮
|
||||
const maxAble = ref(true);
|
||||
|
||||
// 步骤条
|
||||
const steps = ref<step[]>([
|
||||
{
|
||||
title: '报餐',
|
||||
description: undefined
|
||||
},
|
||||
{
|
||||
title: '付款',
|
||||
description: undefined
|
||||
},
|
||||
{
|
||||
title: '发餐',
|
||||
description: undefined
|
||||
},
|
||||
{
|
||||
title: '取餐',
|
||||
description: undefined
|
||||
},
|
||||
{
|
||||
title: '完成',
|
||||
description: undefined
|
||||
}
|
||||
]);
|
||||
const active = ref(2);
|
||||
|
||||
const emit = defineEmits<{
|
||||
(e: 'done'): void;
|
||||
(e: 'update:visible', visible: boolean): void;
|
||||
}>();
|
||||
|
||||
// 订单信息
|
||||
const form = reactive<Order>({
|
||||
orderId: undefined,
|
||||
orderNo: undefined,
|
||||
transactionId: undefined,
|
||||
refundOrder: undefined,
|
||||
merchantId: undefined,
|
||||
couponId: undefined,
|
||||
cardId: undefined,
|
||||
adminId: undefined,
|
||||
confirmId: undefined,
|
||||
icCard: undefined,
|
||||
realName: undefined,
|
||||
phone: undefined,
|
||||
totalPrice: undefined,
|
||||
reducePrice: undefined,
|
||||
payPrice: undefined,
|
||||
price: undefined,
|
||||
money: undefined,
|
||||
refundMoney: undefined,
|
||||
coachPrice: undefined,
|
||||
coachId: undefined,
|
||||
payType: undefined,
|
||||
payStatus: undefined,
|
||||
orderStatus: undefined,
|
||||
couponType: undefined,
|
||||
couponDesc: undefined,
|
||||
qrcode: undefined,
|
||||
returnNum: undefined,
|
||||
returnMoney: undefined,
|
||||
startTime: undefined,
|
||||
isInvoice: undefined,
|
||||
payTime: undefined,
|
||||
refundTime: undefined,
|
||||
refundApplyTime: undefined,
|
||||
checkBill: undefined,
|
||||
isSettled: undefined,
|
||||
version: undefined,
|
||||
userId: undefined,
|
||||
deleted: undefined,
|
||||
tenantId: undefined,
|
||||
updateTime: undefined,
|
||||
createTime: undefined,
|
||||
status: 0,
|
||||
comments: '',
|
||||
sortNumber: 100,
|
||||
orderInfoList: []
|
||||
});
|
||||
|
||||
// 请求状态
|
||||
const loading = ref(true);
|
||||
|
||||
const { resetFields } = useForm(form);
|
||||
|
||||
/* 更新visible */
|
||||
const updateVisible = (value: boolean) => {
|
||||
emit('update:visible', value);
|
||||
};
|
||||
|
||||
const columns = ref<ColumnItem[]>([
|
||||
{
|
||||
title: '场馆名称',
|
||||
dataIndex: 'merchantName',
|
||||
key: 'merchantName'
|
||||
},
|
||||
{
|
||||
title: '场地',
|
||||
dataIndex: 'fieldName'
|
||||
},
|
||||
{
|
||||
title: '预定信息',
|
||||
dataIndex: 'comments',
|
||||
key: 'comments'
|
||||
},
|
||||
{
|
||||
title: '金额',
|
||||
dataIndex: 'price',
|
||||
customRender: ({ text }) => '¥' + text
|
||||
}
|
||||
]);
|
||||
|
||||
/* 制作步骤条 */
|
||||
const loadSteps = (order) => {
|
||||
steps.value = [];
|
||||
steps.value.push({
|
||||
title: '下单'
|
||||
});
|
||||
steps.value.push({
|
||||
title: '付款'
|
||||
});
|
||||
steps.value.push({
|
||||
title: '发货'
|
||||
});
|
||||
steps.value.push({
|
||||
title: '收货'
|
||||
});
|
||||
steps.value.push({
|
||||
title: '完成'
|
||||
});
|
||||
|
||||
// 下单
|
||||
if (order.payStatus == 10) {
|
||||
active.value = 0;
|
||||
steps.value[0].description = order.createTime;
|
||||
}
|
||||
// 付款
|
||||
if (order.payStatus == 20) {
|
||||
active.value = 1;
|
||||
steps.value[0].description = order.createTime;
|
||||
steps.value[1].description = order.payTime;
|
||||
}
|
||||
// 发货
|
||||
if (order.payStatus == 20 && order.deliveryStatus == 20) {
|
||||
active.value = 2;
|
||||
steps.value[0].description = order.createTime;
|
||||
steps.value[1].description = order.payTime;
|
||||
steps.value[2].description = order.deliveryTime;
|
||||
}
|
||||
// 收货
|
||||
if (order.payStatus == 20 && order.receiptStatus == 20) {
|
||||
active.value = 3;
|
||||
steps.value[0].description = order.createTime;
|
||||
steps.value[1].description = order.payTime;
|
||||
steps.value[2].description = order.deliveryTime;
|
||||
steps.value[3].description = order.receiptTime;
|
||||
}
|
||||
// 完成
|
||||
if (order.payStatus == 20 && order.orderStatus == 30) {
|
||||
active.value = 4;
|
||||
steps.value[0].description = order.createTime;
|
||||
steps.value[1].description = order.payTime;
|
||||
steps.value[2].description = order.deliveryTime;
|
||||
steps.value[3].description = order.receiptTime;
|
||||
}
|
||||
// 已取消
|
||||
if (order.orderStatus == 20) {
|
||||
active.value = 4;
|
||||
}
|
||||
};
|
||||
|
||||
// const getOrderInfo = () => {
|
||||
// const orderId = props.data?.orderId;
|
||||
// listOrderInfo({ orderId }).then((data) => {
|
||||
// orderInfo.value = data.filter((d) => d.totalNum > 0);
|
||||
// });
|
||||
// };
|
||||
|
||||
/* 保存编辑 */
|
||||
const save = () => {};
|
||||
|
||||
watch(
|
||||
() => props.visible,
|
||||
(visible) => {
|
||||
if (visible) {
|
||||
if (props.data) {
|
||||
loading.value = false;
|
||||
assignObject(form, props.data);
|
||||
loadSteps(props.data);
|
||||
}
|
||||
} else {
|
||||
resetFields();
|
||||
}
|
||||
}
|
||||
);
|
||||
</script>
|
||||
<style lang="less" scoped>
|
||||
.order-card {
|
||||
margin-bottom: 20px;
|
||||
}
|
||||
.ant-form-item {
|
||||
margin-bottom: 5px;
|
||||
}
|
||||
.order-info {
|
||||
display: flex;
|
||||
.info {
|
||||
padding-left: 5px;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
}
|
||||
}
|
||||
.tag-icon {
|
||||
padding-right: 6px;
|
||||
}
|
||||
</style>
|
||||
@@ -1,6 +1,12 @@
|
||||
<!-- 搜索表单 -->
|
||||
<template>
|
||||
<a-space :size="10" style="flex-wrap: wrap">
|
||||
<SelectMerchantDown
|
||||
:placeholder="`选择场馆`"
|
||||
class="input-item"
|
||||
v-model:value="where.merchantCode"
|
||||
@change="search"
|
||||
/>
|
||||
<a-input-search
|
||||
allow-clear
|
||||
v-model:value="where.keywords"
|
||||
@@ -9,6 +15,7 @@
|
||||
@pressEnter="search"
|
||||
/>
|
||||
<a-button @click="getCode">生成支付二维码</a-button>
|
||||
<a-button @click="reset">重置</a-button>
|
||||
</a-space>
|
||||
<ele-modal
|
||||
:width="500"
|
||||
@@ -48,7 +55,7 @@
|
||||
}>();
|
||||
|
||||
// 表单数据
|
||||
const { where } = useSearch<OrderParam>({
|
||||
const { where, resetFields } = useSearch<OrderParam>({
|
||||
keywords: ''
|
||||
});
|
||||
|
||||
@@ -57,6 +64,12 @@
|
||||
emit('search', where);
|
||||
};
|
||||
|
||||
/* 重置 */
|
||||
const reset = () => {
|
||||
resetFields();
|
||||
search();
|
||||
};
|
||||
|
||||
// 二维码内容
|
||||
const text = ref('');
|
||||
const showQrcode = ref(false);
|
||||
|
||||
@@ -26,101 +26,106 @@
|
||||
<a-image :src="record.image" :width="50" />
|
||||
</template>
|
||||
<template v-if="column.key === 'payType'">
|
||||
<a-tag v-if="record.payType == 1" color="green"
|
||||
><WechatOutlined class="tag-icon" />微信支付</a-tag
|
||||
>
|
||||
<a-tag v-if="record.payType == 2" color="green">积分</a-tag>
|
||||
<a-tag v-if="record.payType == 3" color="green"
|
||||
><AlipayCircleOutlined class="tag-icon" />支付宝</a-tag
|
||||
>
|
||||
<a-tag v-if="record.payType == 4" color="green"
|
||||
><IdcardOutlined class="tag-icon" />现金</a-tag
|
||||
>
|
||||
<a-tag v-if="record.payType == 5" color="green"
|
||||
><IdcardOutlined class="tag-icon" />POS机</a-tag
|
||||
>
|
||||
<a-tag v-if="record.payType == 6" color="green"
|
||||
><IdcardOutlined class="tag-icon" />VIP月卡</a-tag
|
||||
>
|
||||
<a-tag v-if="record.payType == 7" color="green"
|
||||
><IdcardOutlined class="tag-icon" />VIP年卡</a-tag
|
||||
>
|
||||
<a-tag v-if="record.payType == 8" color="green"
|
||||
><IdcardOutlined class="tag-icon" />VIP次卡</a-tag
|
||||
>
|
||||
<a-tag v-if="record.payType == 9" color="green"
|
||||
><IdcardOutlined class="tag-icon" />IC月卡</a-tag
|
||||
>
|
||||
<a-tag v-if="record.payType == 10" color="green"
|
||||
><IdcardOutlined class="tag-icon" />IC年卡</a-tag
|
||||
>
|
||||
<a-tag v-if="record.payType == 11" color="green"
|
||||
><IdcardOutlined class="tag-icon" />IC次卡</a-tag
|
||||
>
|
||||
<a-tag v-if="record.payType == 12" color="green"
|
||||
><IdcardOutlined class="tag-icon" />免费</a-tag
|
||||
>
|
||||
<a-tag v-if="record.payType == 13" color="green"
|
||||
><IdcardOutlined class="tag-icon" />VIP充值卡</a-tag
|
||||
>
|
||||
<a-tag v-if="record.payType == 14" color="green"
|
||||
><IdcardOutlined class="tag-icon" />IC充值卡</a-tag
|
||||
>
|
||||
<a-tag v-if="record.payType == 15" color="green"
|
||||
><IdcardOutlined class="tag-icon" />积分支付</a-tag
|
||||
>
|
||||
<a-tag v-if="record.payType == 16" color="green"
|
||||
><IdcardOutlined class="tag-icon" />VIP季卡</a-tag
|
||||
>
|
||||
<a-tag v-if="record.payType == 17" color="green"
|
||||
><IdcardOutlined class="tag-icon" />IC季卡</a-tag
|
||||
>
|
||||
<template v-if="record.payStatus == 1">
|
||||
<a-tag v-if="record.payType == 1"
|
||||
><WechatOutlined class="tag-icon" />微信支付</a-tag
|
||||
>
|
||||
<a-tag v-if="record.payType == 2">积分</a-tag>
|
||||
<a-tag v-if="record.payType == 3"
|
||||
><AlipayCircleOutlined class="tag-icon" />支付宝</a-tag
|
||||
>
|
||||
<a-tag v-if="record.payType == 4"
|
||||
><IdcardOutlined class="tag-icon" />现金</a-tag
|
||||
>
|
||||
<a-tag v-if="record.payType == 5"
|
||||
><IdcardOutlined class="tag-icon" />POS机</a-tag
|
||||
>
|
||||
<a-tag v-if="record.payType == 6"
|
||||
><IdcardOutlined class="tag-icon" />VIP月卡</a-tag
|
||||
>
|
||||
<a-tag v-if="record.payType == 7"
|
||||
><IdcardOutlined class="tag-icon" />VIP年卡</a-tag
|
||||
>
|
||||
<a-tag v-if="record.payType == 8"
|
||||
><IdcardOutlined class="tag-icon" />VIP次卡</a-tag
|
||||
>
|
||||
<a-tag v-if="record.payType == 9"
|
||||
><IdcardOutlined class="tag-icon" />IC月卡</a-tag
|
||||
>
|
||||
<a-tag v-if="record.payType == 10"
|
||||
><IdcardOutlined class="tag-icon" />IC年卡</a-tag
|
||||
>
|
||||
<a-tag v-if="record.payType == 11"
|
||||
><IdcardOutlined class="tag-icon" />IC次卡</a-tag
|
||||
>
|
||||
<a-tag v-if="record.payType == 12"
|
||||
><IdcardOutlined class="tag-icon" />免费</a-tag
|
||||
>
|
||||
<a-tag v-if="record.payType == 13"
|
||||
><IdcardOutlined class="tag-icon" />VIP充值卡</a-tag
|
||||
>
|
||||
<a-tag v-if="record.payType == 14"
|
||||
><IdcardOutlined class="tag-icon" />IC充值卡</a-tag
|
||||
>
|
||||
<a-tag v-if="record.payType == 15"
|
||||
><IdcardOutlined class="tag-icon" />积分支付</a-tag
|
||||
>
|
||||
<a-tag v-if="record.payType == 16"
|
||||
><IdcardOutlined class="tag-icon" />VIP季卡</a-tag
|
||||
>
|
||||
<a-tag v-if="record.payType == 17"
|
||||
><IdcardOutlined class="tag-icon" />IC季卡</a-tag
|
||||
>
|
||||
</template>
|
||||
<template v-else>
|
||||
<span></span>
|
||||
</template>
|
||||
</template>
|
||||
<template v-if="column.key === 'type'">
|
||||
<a-tag v-if="record.type == 0">无</a-tag>
|
||||
<a-tag v-if="record.type == 1" color="blue"
|
||||
<template v-if="column.key === 'couponType'">
|
||||
<a-tag v-if="record.couponType == 0">无</a-tag>
|
||||
<a-tag v-if="record.couponType == 1" color="blue"
|
||||
><IdcardOutlined class="tag-icon" />抵扣优惠券</a-tag
|
||||
>
|
||||
<a-tag v-if="record.type == 2" color="blue"
|
||||
<a-tag v-if="record.couponType == 2" color="blue"
|
||||
><IdcardOutlined class="tag-icon" />折扣优惠券</a-tag
|
||||
>
|
||||
<a-tag v-if="record.type == 3" color="blue"
|
||||
<a-tag v-if="record.couponType == 3" color="blue"
|
||||
><IdcardOutlined class="tag-icon" />VIP月卡</a-tag
|
||||
>
|
||||
<a-tag v-if="record.type == 4" color="blue"
|
||||
<a-tag v-if="record.couponType == 4" color="blue"
|
||||
><IdcardOutlined class="tag-icon" />VIP年卡</a-tag
|
||||
>
|
||||
<a-tag v-if="record.type == 5" color="blue"
|
||||
<a-tag v-if="record.couponType == 5" color="blue"
|
||||
><IdcardOutlined class="tag-icon" />VIP次卡</a-tag
|
||||
>
|
||||
<a-tag v-if="record.type == 6" color="blue"
|
||||
<a-tag v-if="record.couponType == 6" color="blue"
|
||||
><IdcardOutlined class="tag-icon" />VIP会员卡</a-tag
|
||||
>
|
||||
<a-tag v-if="record.type == 7" color="blue"
|
||||
<a-tag v-if="record.couponType == 7" color="blue"
|
||||
><IdcardOutlined class="tag-icon" />IC月卡</a-tag
|
||||
>
|
||||
<a-tag v-if="record.type == 8" color="blue"
|
||||
<a-tag v-if="record.couponType == 8" color="blue"
|
||||
><IdcardOutlined class="tag-icon" />IC年卡</a-tag
|
||||
>
|
||||
<a-tag v-if="record.type == 9" color="blue"
|
||||
<a-tag v-if="record.couponType == 9" color="blue"
|
||||
><IdcardOutlined class="tag-icon" />IC次卡</a-tag
|
||||
>
|
||||
<a-tag v-if="record.type == 10" color="blue"
|
||||
<a-tag v-if="record.couponType == 10" color="blue"
|
||||
><IdcardOutlined class="tag-icon" />IC会员卡</a-tag
|
||||
>
|
||||
<a-tag v-if="record.type == 11" color="blue"
|
||||
<a-tag v-if="record.couponType == 11" color="blue"
|
||||
><IdcardOutlined class="tag-icon" />免费订单</a-tag
|
||||
>
|
||||
<a-tag v-if="record.type == 12" color="blue"
|
||||
<a-tag v-if="record.couponType == 12" color="blue"
|
||||
><IdcardOutlined class="tag-icon" />VIP充值卡</a-tag
|
||||
>
|
||||
<a-tag v-if="record.type == 13" color="blue"
|
||||
<a-tag v-if="record.couponType == 13" color="blue"
|
||||
><IdcardOutlined class="tag-icon" />IC充值卡</a-tag
|
||||
>
|
||||
<a-tag v-if="record.type == 14" color="blue"
|
||||
<a-tag v-if="record.couponType == 14" color="blue"
|
||||
><IdcardOutlined class="tag-icon" />VIP季卡</a-tag
|
||||
>
|
||||
<a-tag v-if="record.type == 15" color="blue"
|
||||
<a-tag v-if="record.couponType == 15" color="blue"
|
||||
><IdcardOutlined class="tag-icon" />IC季卡</a-tag
|
||||
>
|
||||
</template>
|
||||
@@ -128,40 +133,35 @@
|
||||
<a-tag v-if="record.payStatus == 1" color="green"
|
||||
><CheckOutlined class="tag-icon" />已付款</a-tag
|
||||
>
|
||||
<a-tag v-if="record.payStatus == 2" color="error"
|
||||
<a-tag v-if="record.payStatus == 0" color="error"
|
||||
><CloseOutlined class="tag-icon" />未付款</a-tag
|
||||
>
|
||||
<a-tag v-if="record.payStatus == 3" color="cyan"
|
||||
><CoffeeOutlined class="tag-icon" />未付款,占场中</a-tag
|
||||
>
|
||||
</template>
|
||||
<template v-if="column.key === 'orderInfo'">
|
||||
{{ record.orderInfoList }}
|
||||
</template>
|
||||
<template v-if="column.key === 'orderStatus'">
|
||||
<a-tag v-if="record.orderStatus == 1" color="green"
|
||||
><CheckOutlined class="tag-icon" />已付款</a-tag
|
||||
<span v-if="record.orderStatus == 0"
|
||||
><ClockCircleOutlined class="tag-icon" />未使用</span
|
||||
>
|
||||
<a-tag v-if="record.orderStatus == 2" color="blue"
|
||||
><ClockCircleOutlined class="tag-icon" />未使用</a-tag
|
||||
<span v-if="record.orderStatus == 1"
|
||||
><CheckOutlined class="tag-icon" />已付款</span
|
||||
>
|
||||
<a-tag v-if="record.orderStatus == 3" color="error"
|
||||
><CloseOutlined class="tag-icon" />已取消</a-tag
|
||||
>
|
||||
<a-tag v-if="record.orderStatus == 4" color="error"
|
||||
>退款申请中</a-tag
|
||||
>
|
||||
<a-tag v-if="record.orderStatus == 5" color="error"
|
||||
>退款被拒绝</a-tag
|
||||
>
|
||||
<a-tag v-if="record.orderStatus == 6" color="green"
|
||||
>退款成功</a-tag
|
||||
>
|
||||
<a-tag v-if="record.orderStatus == 7" color="green"
|
||||
>客户端申请退款</a-tag
|
||||
<span v-if="record.orderStatus == 3"
|
||||
><CloseOutlined class="tag-icon" />已取消</span
|
||||
>
|
||||
<span v-if="record.orderStatus == 4">退款申请中</span>
|
||||
<span v-if="record.orderStatus == 5">退款被拒绝</span>
|
||||
<span v-if="record.orderStatus == 6">退款成功</span>
|
||||
<span v-if="record.orderStatus == 7">客户端申请退款</span>
|
||||
</template>
|
||||
<template v-if="column.key === 'isInvoice'">
|
||||
<a-tag v-if="record.isInvoice == 0">未开</a-tag>
|
||||
<a-tag v-if="record.isInvoice == 1" color="green">已开</a-tag>
|
||||
<a-tag v-if="record.isInvoice == 2" color="green">未开</a-tag>
|
||||
<a-tag v-if="record.isInvoice == 1" color="green">不能开</a-tag>
|
||||
<a-tag v-if="record.isInvoice == 2">不能开</a-tag>
|
||||
</template>
|
||||
<template v-if="column.key === 'status'">
|
||||
<a-tag v-if="record.status === 0" color="green">显示</a-tag>
|
||||
@@ -170,14 +170,15 @@
|
||||
<template v-if="column.key === 'action'">
|
||||
<a-space>
|
||||
<a @click="openEdit(record)">详情</a>
|
||||
<a-divider type="vertical" />
|
||||
<a @click="openEdit(record)">编辑</a>
|
||||
</a-space>
|
||||
</template>
|
||||
</template>
|
||||
</ele-pro-table>
|
||||
</a-card>
|
||||
|
||||
<!-- 编辑弹窗 -->
|
||||
<OrderEdit v-model:visible="showEdit" :data="current" @done="reload" />
|
||||
<OrderInfo v-model:visible="showEdit" :data="current" @done="reload" />
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
@@ -189,7 +190,6 @@
|
||||
ExclamationCircleOutlined,
|
||||
CheckOutlined,
|
||||
CloseOutlined,
|
||||
RestOutlined,
|
||||
ClockCircleOutlined,
|
||||
IdcardOutlined,
|
||||
WechatOutlined,
|
||||
@@ -202,9 +202,14 @@
|
||||
ColumnItem
|
||||
} from 'ele-admin-pro/es/ele-pro-table/types';
|
||||
import Search from './components/search.vue';
|
||||
import OrderEdit from './components/orderEdit.vue';
|
||||
import { pageOrder, removeOrder, removeBatchOrder } from '@/api/shop/order';
|
||||
import type { Order, OrderParam } from '@/api/shop/order/model';
|
||||
import OrderInfo from './components/orderInfo.vue';
|
||||
import {
|
||||
pageOrder,
|
||||
removeOrder,
|
||||
removeBatchOrder
|
||||
} from '@/api/booking/order';
|
||||
import type { Order, OrderParam } from '@/api/booking/order/model';
|
||||
import { formatNumber } from 'ele-admin-pro/es';
|
||||
|
||||
// 表格实例
|
||||
const tableRef = ref<InstanceType<typeof EleProTable> | null>(null);
|
||||
@@ -249,8 +254,8 @@
|
||||
},
|
||||
{
|
||||
title: '姓名',
|
||||
dataIndex: 'name',
|
||||
key: 'name',
|
||||
dataIndex: 'realName',
|
||||
key: 'realName',
|
||||
align: 'center'
|
||||
},
|
||||
{
|
||||
@@ -264,19 +269,22 @@
|
||||
title: '总额',
|
||||
dataIndex: 'totalPrice',
|
||||
key: 'totalPrice',
|
||||
align: 'center'
|
||||
align: 'center',
|
||||
customRender: ({ text }) => `¥${formatNumber(text)}`
|
||||
},
|
||||
{
|
||||
title: '减少金额',
|
||||
dataIndex: 'reducePrice',
|
||||
key: 'reducePrice',
|
||||
align: 'center'
|
||||
align: 'center',
|
||||
customRender: ({ text }) => `¥${formatNumber(text)}`
|
||||
},
|
||||
{
|
||||
title: '实付金额',
|
||||
dataIndex: 'payPrice',
|
||||
key: 'payPrice',
|
||||
align: 'center'
|
||||
align: 'center',
|
||||
customRender: ({ text }) => `¥${formatNumber(text)}`
|
||||
},
|
||||
{
|
||||
title: '支付方式',
|
||||
@@ -298,8 +306,8 @@
|
||||
},
|
||||
{
|
||||
title: '优惠类型',
|
||||
dataIndex: 'type',
|
||||
key: 'type',
|
||||
dataIndex: 'couponType',
|
||||
key: 'couponType',
|
||||
align: 'center'
|
||||
},
|
||||
{
|
||||
@@ -427,5 +435,7 @@
|
||||
<style lang="less" scoped>
|
||||
.tag-icon {
|
||||
padding-right: 6px;
|
||||
background-image: linear-gradient(#9fcdec, rgb(0, 118, 199));
|
||||
color: rgba(21, 154, 203, 0.5);
|
||||
}
|
||||
</style>
|
||||
|
||||
227
src/views/cms/website/components/edit.vue
Normal file
227
src/views/cms/website/components/edit.vue
Normal file
@@ -0,0 +1,227 @@
|
||||
<!-- 编辑弹窗 -->
|
||||
<template>
|
||||
<ele-modal
|
||||
:width="isUpdate ? 880 : 500"
|
||||
:visible="visible"
|
||||
:maskClosable="false"
|
||||
:title="isUpdate ? '域名DNS解析验证' : '添加域名'"
|
||||
:body-style="{ paddingBottom: '28px' }"
|
||||
@update:visible="updateVisible"
|
||||
:confirmLoading="loading"
|
||||
@ok="save"
|
||||
>
|
||||
<a-form
|
||||
ref="formRef"
|
||||
:model="form"
|
||||
:rules="rules"
|
||||
:label-col="styleResponsive ? { md: 5, sm: 7, xs: 24 } : { flex: '90px' }"
|
||||
:wrapper-col="
|
||||
styleResponsive ? { md: 18, sm: 19, xs: 24 } : { flex: '1' }
|
||||
"
|
||||
>
|
||||
<a-form-item label="https://" name="domain">
|
||||
<a-input
|
||||
allow-clear
|
||||
:maxlength="100"
|
||||
placeholder="example.com"
|
||||
:disabled="isUpdate"
|
||||
v-model:value="form.domain"
|
||||
@pressEnter="save"
|
||||
/>
|
||||
</a-form-item>
|
||||
<a-form-item label="添加DNS解析" name="check" v-if="isUpdate">
|
||||
<a-space direction="vertical">
|
||||
<div class="ele-text-placeholder" style="line-height: 2.2em"
|
||||
>请按以下提示,在您的域名控制台添加DNS解析配置</div
|
||||
>
|
||||
<table
|
||||
class="ele-table ele-table-border ele-table-stripe ele-table-medium"
|
||||
>
|
||||
<colgroup>
|
||||
<col width="180" />
|
||||
<col width="120" />
|
||||
<col />
|
||||
</colgroup>
|
||||
<thead>
|
||||
<tr>
|
||||
<th>主机记录</th>
|
||||
<th>记录类型</th>
|
||||
<th>记录值</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr>
|
||||
<td>{{ form.hostName }}</td>
|
||||
<td>CNAME</td>
|
||||
<td>{{ form.hostValue }}</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</a-space>
|
||||
</a-form-item>
|
||||
<a-form-item label="排序" name="sortNumber">
|
||||
<a-input-number
|
||||
:min="0"
|
||||
:max="99999"
|
||||
placeholder="请输入排序号"
|
||||
v-model:value="form.sortNumber"
|
||||
/>
|
||||
</a-form-item>
|
||||
<a-form-item label="操作" v-if="isUpdate && form.status == 0">
|
||||
<a-button type="primary" @click="save">验证域名</a-button>
|
||||
</a-form-item>
|
||||
</a-form>
|
||||
</ele-modal>
|
||||
</template>
|
||||
|
||||
<script lang="ts" setup>
|
||||
import { ref, reactive, watch } from 'vue';
|
||||
import { message } from 'ant-design-vue';
|
||||
import { addDomain, resolvable } from '@/api/cms/domain';
|
||||
import { Domain } from '@/api/cms/domain/model';
|
||||
import { useThemeStore } from '@/store/modules/theme';
|
||||
import { storeToRefs } from 'pinia';
|
||||
import { FormInstance, type Rule } from 'ant-design-vue/es/form';
|
||||
import useFormData from '@/utils/use-form-data';
|
||||
import { isUrl } from 'ele-admin-pro';
|
||||
|
||||
// 是否是修改
|
||||
const isUpdate = ref(false);
|
||||
// 是否开启响应式布局
|
||||
const themeStore = useThemeStore();
|
||||
const { styleResponsive } = storeToRefs(themeStore);
|
||||
|
||||
const props = defineProps<{
|
||||
// 弹窗是否打开
|
||||
visible: boolean;
|
||||
// 修改回显的数据
|
||||
data?: Domain | null;
|
||||
}>();
|
||||
|
||||
const emit = defineEmits<{
|
||||
(e: 'done'): void;
|
||||
(e: 'update:visible', visible: boolean): void;
|
||||
}>();
|
||||
|
||||
// 提交状态
|
||||
const loading = ref(false);
|
||||
const disabled = ref(false);
|
||||
// 表格选中数据
|
||||
const formRef = ref<FormInstance | null>(null);
|
||||
|
||||
// 表单数据
|
||||
const { form, resetFields, assignFields } = useFormData<Domain>({
|
||||
id: undefined,
|
||||
domain: '',
|
||||
hostName: '',
|
||||
hostValue: '',
|
||||
status: 0,
|
||||
comments: '',
|
||||
sortNumber: 100
|
||||
});
|
||||
|
||||
/* 更新visible */
|
||||
const updateVisible = (value: boolean) => {
|
||||
emit('update:visible', value);
|
||||
};
|
||||
|
||||
// 表单验证规则
|
||||
const rules = reactive({
|
||||
domain: [
|
||||
{
|
||||
required: true,
|
||||
type: 'string',
|
||||
message: '请输入合法域名',
|
||||
trigger: 'blur',
|
||||
validator: (_rule: Rule, value: string) => {
|
||||
return new Promise<void>((resolve, reject) => {
|
||||
if (!isUrl(`https://${value}`)) {
|
||||
if (value.includes('http')) {
|
||||
return reject('不含http开头');
|
||||
}
|
||||
return reject('请输入合法域名');
|
||||
}
|
||||
disabled.value = true;
|
||||
return resolve();
|
||||
});
|
||||
}
|
||||
}
|
||||
]
|
||||
});
|
||||
|
||||
/* 保存编辑 */
|
||||
const save = () => {
|
||||
if (!formRef.value) {
|
||||
return;
|
||||
}
|
||||
formRef.value
|
||||
.validate()
|
||||
.then(() => {
|
||||
loading.value = true;
|
||||
if (form.domain) {
|
||||
form.domain = form.domain.trim();
|
||||
form.domain = form.domain.replace('https://', '');
|
||||
form.domain = form.domain.replace('http://', '');
|
||||
const split = form.domain.split('.');
|
||||
if (split.length == 2) {
|
||||
form.hostName = '@';
|
||||
}
|
||||
if (split.length > 2) {
|
||||
const suffix = split[split.length - 1];
|
||||
const name = split[split.length - 2];
|
||||
form.hostName = form.domain.replace(`.${name}.${suffix}`, '');
|
||||
}
|
||||
}
|
||||
const formData = {
|
||||
...form
|
||||
};
|
||||
if (isUpdate.value) {
|
||||
setTimeout(() => {
|
||||
resolvable(Number(form.id))
|
||||
.then((data) => {
|
||||
loading.value = false;
|
||||
message.success(data.message);
|
||||
updateVisible(false);
|
||||
emit('done');
|
||||
})
|
||||
.catch((res) => {
|
||||
loading.value = false;
|
||||
message.error(res.message);
|
||||
});
|
||||
}, 1000);
|
||||
}
|
||||
if (!isUpdate.value) {
|
||||
addDomain(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) {
|
||||
assignFields(props.data);
|
||||
isUpdate.value = true;
|
||||
} else {
|
||||
isUpdate.value = false;
|
||||
}
|
||||
} else {
|
||||
resetFields();
|
||||
formRef.value?.clearValidate();
|
||||
}
|
||||
},
|
||||
{ immediate: true }
|
||||
);
|
||||
</script>
|
||||
42
src/views/cms/website/components/search.vue
Normal file
42
src/views/cms/website/components/search.vue
Normal file
@@ -0,0 +1,42 @@
|
||||
<!-- 搜索表单 -->
|
||||
<template>
|
||||
<a-space :size="10" style="flex-wrap: wrap">
|
||||
<a-button type="primary" class="ele-btn-icon" @click="add">
|
||||
<template #icon>
|
||||
<PlusOutlined />
|
||||
</template>
|
||||
<span>添加</span>
|
||||
</a-button>
|
||||
</a-space>
|
||||
</template>
|
||||
|
||||
<script lang="ts" setup>
|
||||
import { PlusOutlined } from '@ant-design/icons-vue';
|
||||
import type { GradeParam } from '@/api/user/grade/model';
|
||||
import { watch } from 'vue';
|
||||
|
||||
const props = withDefaults(
|
||||
defineProps<{
|
||||
// 选中的角色
|
||||
selection?: [];
|
||||
}>(),
|
||||
{}
|
||||
);
|
||||
|
||||
const emit = defineEmits<{
|
||||
(e: 'search', where?: GradeParam): void;
|
||||
(e: 'add'): void;
|
||||
(e: 'remove'): void;
|
||||
(e: 'batchMove'): void;
|
||||
}>();
|
||||
|
||||
// 新增
|
||||
const add = () => {
|
||||
emit('add');
|
||||
};
|
||||
|
||||
watch(
|
||||
() => props.selection,
|
||||
() => {}
|
||||
);
|
||||
</script>
|
||||
217
src/views/cms/website/index.vue
Normal file
217
src/views/cms/website/index.vue
Normal file
@@ -0,0 +1,217 @@
|
||||
<template>
|
||||
<div class="page">
|
||||
<div class="ele-body">
|
||||
<a-card :bordered="false" :body-style="{ padding: '16px' }">
|
||||
<ele-pro-table
|
||||
ref="tableRef"
|
||||
row-key="id"
|
||||
:columns="columns"
|
||||
:datasource="datasource"
|
||||
tool-class="ele-toolbar-form"
|
||||
class="sys-org-table"
|
||||
>
|
||||
<template #bodyCell="{ column, record }">
|
||||
<template v-if="column.key === 'websiteName'">
|
||||
<a-space class="ele-cell">
|
||||
<a-avatar
|
||||
:src="record.websiteLogo"
|
||||
size="small"
|
||||
shape="square"
|
||||
/>
|
||||
<span class="ele-text-secondary">{{ record.websiteName }}</span>
|
||||
</a-space>
|
||||
</template>
|
||||
<template v-if="column.key === 'hostName'">
|
||||
<span class="ele-text-placeholder">{{ record.hostName }}</span>
|
||||
</template>
|
||||
<template v-if="column.key === 'hostType'">
|
||||
<span class="ele-text-placeholder">CNAME</span>
|
||||
</template>
|
||||
<template v-if="column.key === 'hostValue'">
|
||||
<span class="ele-text-placeholder">{{ record.hostValue }}</span>
|
||||
</template>
|
||||
<template v-if="column.key === 'photo'">
|
||||
<a-image :src="record.photo" />
|
||||
</template>
|
||||
<template v-if="column.key === 'status'">
|
||||
<a-switch
|
||||
v-model:checked="record.status"
|
||||
@change="updateStatus(record)"
|
||||
/>
|
||||
</template>
|
||||
<template v-if="column.key === 'action'">
|
||||
<a-space>
|
||||
<a-button @click="openEdit(record)" size="small">管理</a-button>
|
||||
<a-popconfirm
|
||||
title="确定要删除此域名吗?"
|
||||
:disabled="record.home == 1"
|
||||
@confirm="remove(record)"
|
||||
>
|
||||
<a-button size="small">删除</a-button>
|
||||
</a-popconfirm>
|
||||
</a-space>
|
||||
</template>
|
||||
</template>
|
||||
</ele-pro-table>
|
||||
</a-card>
|
||||
|
||||
<!-- 编辑弹窗 -->
|
||||
<Edit v-model:visible="showEdit" :data="current" @done="reload" />
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script lang="ts" setup>
|
||||
import { createVNode, ref } from 'vue';
|
||||
import { message, Modal } from 'ant-design-vue';
|
||||
import { ExclamationCircleOutlined } from '@ant-design/icons-vue';
|
||||
import type { EleProTable } from 'ele-admin-pro';
|
||||
import type {
|
||||
DatasourceFunction,
|
||||
ColumnItem
|
||||
} from 'ele-admin-pro/es/ele-pro-table/types';
|
||||
// import Search from './components/search.vue';
|
||||
import Edit from './components/edit.vue';
|
||||
import {
|
||||
pageWebsite,
|
||||
removeWebsite,
|
||||
removeBatchWebsite,
|
||||
updateWebsite
|
||||
} from '@/api/cms/website';
|
||||
import type { Website, WebsiteParam } from '@/api/cms/website/model';
|
||||
import { openPreview } from '@/utils/common';
|
||||
import type { Payment } from '@/api/system/payment/model';
|
||||
import { updatePayment } from '@/api/system/payment';
|
||||
|
||||
// 表格实例
|
||||
const tableRef = ref<InstanceType<typeof EleProTable> | null>(null);
|
||||
|
||||
// 表格选中数据
|
||||
const selection = ref<Website[]>([]);
|
||||
// 当前编辑数据
|
||||
const current = ref<Website | null>(null);
|
||||
// 是否显示编辑弹窗
|
||||
const showEdit = ref(false);
|
||||
// 是否显示批量移动弹窗
|
||||
const showMove = ref(false);
|
||||
|
||||
// 表格数据源
|
||||
const datasource: DatasourceFunction = ({
|
||||
page,
|
||||
limit,
|
||||
where,
|
||||
orders,
|
||||
filters
|
||||
}) => {
|
||||
return pageWebsite({
|
||||
...where,
|
||||
...orders,
|
||||
page,
|
||||
limit
|
||||
});
|
||||
};
|
||||
|
||||
// 表格列配置
|
||||
const columns = ref<ColumnItem[]>([
|
||||
{
|
||||
title: '网站名称',
|
||||
dataIndex: 'websiteName',
|
||||
width: 240,
|
||||
key: 'websiteName'
|
||||
},
|
||||
{
|
||||
title: '主机类型',
|
||||
dataIndex: 'websiteType',
|
||||
align: 'center',
|
||||
key: 'websiteType'
|
||||
},
|
||||
{
|
||||
title: '是否启用',
|
||||
dataIndex: 'status',
|
||||
width: 120,
|
||||
align: 'center',
|
||||
key: 'status'
|
||||
},
|
||||
{
|
||||
title: '操作',
|
||||
key: 'action',
|
||||
width: 120,
|
||||
align: 'center',
|
||||
hideInSetting: true
|
||||
}
|
||||
]);
|
||||
|
||||
/* 搜索 */
|
||||
const reload = (where?: WebsiteParam) => {
|
||||
selection.value = [];
|
||||
tableRef?.value?.reload({ where: where });
|
||||
};
|
||||
|
||||
/* 打开编辑弹窗 */
|
||||
const openEdit = (row?: Website) => {
|
||||
current.value = row ?? null;
|
||||
showEdit.value = true;
|
||||
};
|
||||
|
||||
/* 打开批量移动弹窗 */
|
||||
const openMove = () => {
|
||||
showMove.value = true;
|
||||
};
|
||||
|
||||
const updateStatus = (item: Website) => {
|
||||
updateWebsite(item)
|
||||
.then((msg) => {
|
||||
message.success(msg);
|
||||
})
|
||||
.catch((msg) => {
|
||||
message.error(msg);
|
||||
});
|
||||
};
|
||||
|
||||
/* 删除单个 */
|
||||
const remove = (row: Website) => {
|
||||
const hide = message.loading('请求中..', 0);
|
||||
removeWebsite(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 = message.loading('请求中..', 0);
|
||||
removeBatchWebsite(selection.value.map((d) => d.id))
|
||||
.then((msg) => {
|
||||
hide();
|
||||
message.success(msg);
|
||||
reload();
|
||||
})
|
||||
.catch((e) => {
|
||||
hide();
|
||||
message.error(e.message);
|
||||
});
|
||||
}
|
||||
});
|
||||
};
|
||||
</script>
|
||||
<script lang="ts">
|
||||
export default {
|
||||
name: 'Website'
|
||||
};
|
||||
</script>
|
||||
@@ -151,7 +151,6 @@
|
||||
{
|
||||
required: true,
|
||||
message: '请输入正确的URL',
|
||||
pattern: urlReg,
|
||||
type: 'string',
|
||||
trigger: 'blur'
|
||||
}
|
||||
|
||||
@@ -26,12 +26,12 @@
|
||||
</template>
|
||||
<template v-if="column.key === 'action'">
|
||||
<a-space>
|
||||
<a @click="openEdit(record)">修改</a>
|
||||
<a @click.stop="openEdit(record)">修改</a>
|
||||
<a-divider type="vertical" />
|
||||
<a-popconfirm
|
||||
placement="topRight"
|
||||
title="确定要删除此模块吗?"
|
||||
@confirm="remove(record)"
|
||||
@confirm.stop="remove(record)"
|
||||
>
|
||||
<a class="ele-text-danger">删除</a>
|
||||
</a-popconfirm>
|
||||
@@ -59,7 +59,7 @@
|
||||
import { pageLink, removeLink } from '@/api/oa/link';
|
||||
import type { Link, LinkParam } from '@/api/oa/link/model';
|
||||
import { Menu } from '@/api/system/menu/model';
|
||||
import { openUrl } from '@/utils/common';
|
||||
import { openNew, openUrl } from '@/utils/common';
|
||||
import LinkSearch from './components/link-search.vue';
|
||||
|
||||
// 表格实例
|
||||
@@ -128,15 +128,15 @@
|
||||
};
|
||||
|
||||
/* 自定义行属性 */
|
||||
const customRow = (record: Menu) => {
|
||||
const customRow = (record: Link) => {
|
||||
return {
|
||||
// 行点击事件
|
||||
onClick: () => {
|
||||
// console.log(record);
|
||||
// openUrl(`${record.url}`);
|
||||
},
|
||||
// 行双击事件
|
||||
onDblclick: () => {
|
||||
openEdit(record);
|
||||
openUrl(`${record.url}`);
|
||||
}
|
||||
};
|
||||
};
|
||||
|
||||
@@ -35,6 +35,18 @@
|
||||
>
|
||||
</a-space>
|
||||
<template v-if="loginType === 'account'">
|
||||
<a-form-item name="tenantId" v-if="showTenantId">
|
||||
<a-input
|
||||
allow-clear
|
||||
size="large"
|
||||
v-model:value="form.tenantId"
|
||||
:placeholder="`租户ID`"
|
||||
>
|
||||
<template #prefix>
|
||||
<BankOutlined />
|
||||
</template>
|
||||
</a-input>
|
||||
</a-form-item>
|
||||
<a-form-item name="username">
|
||||
<a-input
|
||||
allow-clear
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
<!-- 编辑弹窗 -->
|
||||
<template>
|
||||
<ele-modal
|
||||
:width="800"
|
||||
:width="1000"
|
||||
:visible="visible"
|
||||
:maskClosable="false"
|
||||
:maxable="maxable"
|
||||
:title="isUpdate ? '编辑预约订单' : '添加预约订单'"
|
||||
:title="isUpdate ? '编辑订单' : '添加订单'"
|
||||
:body-style="{ paddingBottom: '28px' }"
|
||||
@update:visible="updateVisible"
|
||||
@ok="save"
|
||||
@@ -23,40 +23,38 @@
|
||||
<a-input
|
||||
allow-clear
|
||||
placeholder="请输入订单编号"
|
||||
:disabled="true"
|
||||
v-model:value="form.orderNo"
|
||||
/>
|
||||
</a-form-item>
|
||||
<a-form-item label="微信支付订单号" name="wechatOrder">
|
||||
<a-form-item label="微信支付订单号" name="transactionId">
|
||||
<a-input
|
||||
allow-clear
|
||||
:disabled="true"
|
||||
placeholder="请输入微信支付订单号"
|
||||
v-model:value="form.wechatOrder"
|
||||
v-model:value="form.transactionId"
|
||||
/>
|
||||
</a-form-item>
|
||||
<a-form-item label="微信退款订单号" name="refundOrder">
|
||||
<a-input
|
||||
allow-clear
|
||||
:disabled="true"
|
||||
placeholder="请输入微信退款订单号"
|
||||
v-model:value="form.refundOrder"
|
||||
/>
|
||||
</a-form-item>
|
||||
<a-form-item label="场馆id用于权限判断" name="merchantId">
|
||||
<a-form-item label="商户ID" name="merchantId">
|
||||
<a-input
|
||||
allow-clear
|
||||
placeholder="请输入场馆id用于权限判断"
|
||||
:disabled="true"
|
||||
placeholder="请输入商户ID"
|
||||
v-model:value="form.merchantId"
|
||||
/>
|
||||
</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="使用的优惠券id" name="couponId">
|
||||
<a-input
|
||||
allow-clear
|
||||
:disabled="true"
|
||||
placeholder="请输入使用的优惠券id"
|
||||
v-model:value="form.couponId"
|
||||
/>
|
||||
@@ -64,41 +62,31 @@
|
||||
<a-form-item label="使用的会员卡id" name="cardId">
|
||||
<a-input
|
||||
allow-clear
|
||||
:disabled="true"
|
||||
placeholder="请输入使用的会员卡id"
|
||||
v-model:value="form.cardId"
|
||||
/>
|
||||
</a-form-item>
|
||||
<a-form-item label="关联管理员id" name="aid">
|
||||
<a-input
|
||||
allow-clear
|
||||
placeholder="请输入关联管理员id"
|
||||
v-model:value="form.aid"
|
||||
/>
|
||||
</a-form-item>
|
||||
<a-form-item label="核销管理员id" name="adminId">
|
||||
<a-input
|
||||
allow-clear
|
||||
placeholder="请输入核销管理员id"
|
||||
v-model:value="form.adminId"
|
||||
/>
|
||||
</a-form-item>
|
||||
<a-form-item label="IC卡号" name="code">
|
||||
<a-form-item label="IC卡号" name="icCard">
|
||||
<a-input
|
||||
allow-clear
|
||||
:disabled="true"
|
||||
placeholder="请输入IC卡号"
|
||||
v-model:value="form.code"
|
||||
v-model:value="form.icCard"
|
||||
/>
|
||||
</a-form-item>
|
||||
<a-form-item label="真实姓名" name="name">
|
||||
<a-form-item label="真实姓名" name="realName">
|
||||
<a-input
|
||||
allow-clear
|
||||
:disabled="true"
|
||||
placeholder="请输入真实姓名"
|
||||
v-model:value="form.name"
|
||||
v-model:value="form.realName"
|
||||
/>
|
||||
</a-form-item>
|
||||
<a-form-item label="手机号码" name="phone">
|
||||
<a-input
|
||||
allow-clear
|
||||
:disabled="true"
|
||||
placeholder="请输入手机号码"
|
||||
v-model:value="form.phone"
|
||||
/>
|
||||
@@ -106,13 +94,15 @@
|
||||
<a-form-item label="订单总额" name="totalPrice">
|
||||
<a-input
|
||||
allow-clear
|
||||
:disabled="true"
|
||||
placeholder="请输入订单总额"
|
||||
v-model:value="form.totalPrice"
|
||||
/>
|
||||
</a-form-item>
|
||||
<a-form-item label="减少的金额,使用VIP会员折扣、优惠券抵扣、优惠券折扣后减去的价格" name="reducePrice">
|
||||
<a-form-item label="减少的金额" name="reducePrice">
|
||||
<a-input
|
||||
allow-clear
|
||||
:disabled="true"
|
||||
placeholder="请输入减少的金额,使用VIP会员折扣、优惠券抵扣、优惠券折扣后减去的价格"
|
||||
v-model:value="form.reducePrice"
|
||||
/>
|
||||
@@ -120,132 +110,139 @@
|
||||
<a-form-item label="实际付款" name="payPrice">
|
||||
<a-input
|
||||
allow-clear
|
||||
:disabled="true"
|
||||
placeholder="请输入实际付款"
|
||||
v-model:value="form.payPrice"
|
||||
/>
|
||||
</a-form-item>
|
||||
<a-form-item label="用于统计" name="price">
|
||||
<a-input
|
||||
allow-clear
|
||||
placeholder="请输入用于统计"
|
||||
v-model:value="form.price"
|
||||
/>
|
||||
</a-form-item>
|
||||
<a-form-item label="价钱,用于积分赠送" name="money">
|
||||
<a-input
|
||||
allow-clear
|
||||
placeholder="请输入价钱,用于积分赠送"
|
||||
v-model:value="form.money"
|
||||
/>
|
||||
</a-form-item>
|
||||
<a-form-item label="退款金额" name="refundMoney">
|
||||
<!-- <a-form-item label="用于统计" name="price">-->
|
||||
<!-- <a-input-->
|
||||
<!-- allow-clear-->
|
||||
<!-- placeholder="请输入用于统计"-->
|
||||
<!-- v-model:value="form.price"-->
|
||||
<!-- />-->
|
||||
<!-- </a-form-item>-->
|
||||
<!-- <a-form-item label="价钱,用于积分赠送" name="money">-->
|
||||
<!-- <a-input-->
|
||||
<!-- allow-clear-->
|
||||
<!-- placeholder="请输入价钱,用于积分赠送"-->
|
||||
<!-- v-model:value="form.money"-->
|
||||
<!-- />-->
|
||||
<!-- </a-form-item>-->
|
||||
<a-form-item label="退款金额" name="refundMoney" v-if="form.refundMoney">
|
||||
<a-input
|
||||
allow-clear
|
||||
:disabled="true"
|
||||
placeholder="请输入退款金额"
|
||||
v-model:value="form.refundMoney"
|
||||
/>
|
||||
</a-form-item>
|
||||
<a-form-item label="教练价格" name="coachPrice">
|
||||
<!-- <a-form-item label="教练价格" name="coachPrice">-->
|
||||
<!-- <a-input-->
|
||||
<!-- allow-clear-->
|
||||
<!-- placeholder="请输入教练价格"-->
|
||||
<!-- v-model:value="form.coachPrice"-->
|
||||
<!-- />-->
|
||||
<!-- </a-form-item>-->
|
||||
<!-- <a-form-item label="教练id" name="coachId">-->
|
||||
<!-- <a-input-->
|
||||
<!-- allow-clear-->
|
||||
<!-- placeholder="请输入教练id"-->
|
||||
<!-- v-model:value="form.coachId"-->
|
||||
<!-- />-->
|
||||
<!-- </a-form-item>-->
|
||||
<a-form-item label="支付方式" name="payType">
|
||||
<a-input
|
||||
allow-clear
|
||||
placeholder="请输入教练价格"
|
||||
v-model:value="form.coachPrice"
|
||||
/>
|
||||
</a-form-item>
|
||||
<a-form-item label="教练id" name="coachId">
|
||||
<a-input
|
||||
allow-clear
|
||||
placeholder="请输入教练id"
|
||||
v-model:value="form.coachId"
|
||||
/>
|
||||
</a-form-item>
|
||||
<a-form-item label="1微信支付,2积分,3支付宝,4现金,5POS机,6VIP月卡,7VIP年卡,8VIP次卡,9IC月卡,10IC年卡,11IC次卡,12免费,13VIP充值卡,14IC充值卡,15积分支付,16VIP季卡,17IC季卡" name="payType">
|
||||
<a-input
|
||||
allow-clear
|
||||
placeholder="请输入1微信支付,2积分,3支付宝,4现金,5POS机,6VIP月卡,7VIP年卡,8VIP次卡,9IC月卡,10IC年卡,11IC次卡,12免费,13VIP充值卡,14IC充值卡,15积分支付,16VIP季卡,17IC季卡"
|
||||
:disabled="true"
|
||||
placeholder="请输入支付方式 0余额支付, 1微信支付,2积分,3支付宝,4现金,5POS机,6VIP月卡,7VIP年卡,8VIP次卡,9IC月卡,10IC年卡,11IC次卡,12免费,13VIP充值卡,14IC充值卡,15积分支付,16VIP季卡,17IC季卡"
|
||||
v-model:value="form.payType"
|
||||
/>
|
||||
</a-form-item>
|
||||
<a-form-item label="1已付款,2未付款" name="payStatus">
|
||||
<a-form-item label="支付状态" name="payStatus">
|
||||
<a-input
|
||||
allow-clear
|
||||
placeholder="请输入1已付款,2未付款"
|
||||
:disabled="true"
|
||||
placeholder="请输入0未付款,1已付款"
|
||||
v-model:value="form.payStatus"
|
||||
/>
|
||||
</a-form-item>
|
||||
<a-form-item label="1已完成,2未使用,3已取消,4退款申请中,5退款被拒绝,6退款成功,7客户端申请退款" name="orderStatus">
|
||||
<a-form-item label="订单状态" name="orderStatus">
|
||||
<a-input
|
||||
allow-clear
|
||||
placeholder="请输入1已完成,2未使用,3已取消,4退款申请中,5退款被拒绝,6退款成功,7客户端申请退款"
|
||||
:disabled="true"
|
||||
placeholder="请输入0未使用,1已完成,2已取消,3取消中,4退款申请中,5退款被拒绝,6退款成功,7客户端申请退款"
|
||||
v-model:value="form.orderStatus"
|
||||
/>
|
||||
</a-form-item>
|
||||
<a-form-item label="优惠类型:0无、1抵扣优惠券、2折扣优惠券、3、VIP月卡、4VIP年卡,5VIP次卡、6VIP会员卡、7IC月卡、8IC年卡、9IC次卡、10IC会员卡、11免费订单、12VIP充值卡、13IC充值卡、14VIP季卡、15IC季卡" name="type">
|
||||
<a-form-item label="优惠类型" name="couponType">
|
||||
<a-input
|
||||
allow-clear
|
||||
:disabled="true"
|
||||
placeholder="请输入优惠类型:0无、1抵扣优惠券、2折扣优惠券、3、VIP月卡、4VIP年卡,5VIP次卡、6VIP会员卡、7IC月卡、8IC年卡、9IC次卡、10IC会员卡、11免费订单、12VIP充值卡、13IC充值卡、14VIP季卡、15IC季卡"
|
||||
v-model:value="form.type"
|
||||
v-model:value="form.couponType"
|
||||
/>
|
||||
</a-form-item>
|
||||
<a-form-item label="二维码地址,保存订单号,支付成功后才生成" name="qrcode">
|
||||
<a-input
|
||||
allow-clear
|
||||
placeholder="请输入二维码地址,保存订单号,支付成功后才生成"
|
||||
v-model:value="form.qrcode"
|
||||
/>
|
||||
</a-form-item>
|
||||
<a-form-item label="优惠说明" name="desc">
|
||||
<a-form-item label="优惠说明" name="couponDesc">
|
||||
<a-input
|
||||
allow-clear
|
||||
:disabled="true"
|
||||
placeholder="请输入优惠说明"
|
||||
v-model:value="form.desc"
|
||||
/>
|
||||
</a-form-item>
|
||||
<a-form-item label="vip月卡年卡、ic月卡年卡回退次数" name="returnNum">
|
||||
<a-input
|
||||
allow-clear
|
||||
placeholder="请输入vip月卡年卡、ic月卡年卡回退次数"
|
||||
v-model:value="form.returnNum"
|
||||
/>
|
||||
</a-form-item>
|
||||
<a-form-item label="vip充值回退金额" name="returnMoney">
|
||||
<a-input
|
||||
allow-clear
|
||||
placeholder="请输入vip充值回退金额"
|
||||
v-model:value="form.returnMoney"
|
||||
v-model:value="form.couponDesc"
|
||||
/>
|
||||
</a-form-item>
|
||||
<!-- <a-form-item-->
|
||||
<!-- label="二维码地址,保存订单号,支付成功后才生成"-->
|
||||
<!-- name="qrcode"-->
|
||||
<!-- >-->
|
||||
<!-- <a-input-->
|
||||
<!-- allow-clear-->
|
||||
<!-- placeholder="请输入二维码地址,保存订单号,支付成功后才生成"-->
|
||||
<!-- v-model:value="form.qrcode"-->
|
||||
<!-- />-->
|
||||
<!-- </a-form-item>-->
|
||||
<!-- <a-form-item label="vip月卡年卡、ic月卡年卡回退次数" name="returnNum">-->
|
||||
<!-- <a-input-->
|
||||
<!-- allow-clear-->
|
||||
<!-- placeholder="请输入vip月卡年卡、ic月卡年卡回退次数"-->
|
||||
<!-- v-model:value="form.returnNum"-->
|
||||
<!-- />-->
|
||||
<!-- </a-form-item>-->
|
||||
<!-- <a-form-item label="vip充值回退金额" name="returnMoney">-->
|
||||
<!-- <a-input-->
|
||||
<!-- allow-clear-->
|
||||
<!-- placeholder="请输入vip充值回退金额"-->
|
||||
<!-- v-model:value="form.returnMoney"-->
|
||||
<!-- />-->
|
||||
<!-- </a-form-item>-->
|
||||
<a-form-item label="预约详情开始时间数组" name="startTime">
|
||||
<a-input
|
||||
allow-clear
|
||||
:disabled="true"
|
||||
placeholder="请输入预约详情开始时间数组"
|
||||
v-model:value="form.startTime"
|
||||
/>
|
||||
</a-form-item>
|
||||
<a-form-item label="是否已开具发票:1已开发票,2未开发票,3不能开具发票" name="isInvoice">
|
||||
<a-form-item label="是否已开具发票" name="isInvoice">
|
||||
<a-input
|
||||
allow-clear
|
||||
placeholder="请输入是否已开具发票:1已开发票,2未开发票,3不能开具发票"
|
||||
:disabled="true"
|
||||
placeholder="请输入是否已开具发票:0未开发票,1已开发票,2不能开具发票"
|
||||
v-model:value="form.isInvoice"
|
||||
/>
|
||||
</a-form-item>
|
||||
<a-form-item label="" name="updateTime">
|
||||
<a-form-item label="支付时间" name="payTime">
|
||||
<a-input
|
||||
allow-clear
|
||||
placeholder="请输入"
|
||||
v-model:value="form.updateTime"
|
||||
/>
|
||||
</a-form-item>
|
||||
<a-form-item label="付款时间" name="payTime">
|
||||
<a-input
|
||||
allow-clear
|
||||
placeholder="请输入付款时间"
|
||||
:disabled="true"
|
||||
placeholder="请输入支付时间"
|
||||
v-model:value="form.payTime"
|
||||
/>
|
||||
</a-form-item>
|
||||
<a-form-item label="退款时间" name="refundTime">
|
||||
<a-input
|
||||
allow-clear
|
||||
:disabled="true"
|
||||
placeholder="请输入退款时间"
|
||||
v-model:value="form.refundTime"
|
||||
/>
|
||||
@@ -253,32 +250,36 @@
|
||||
<a-form-item label="申请退款时间" name="refundApplyTime">
|
||||
<a-input
|
||||
allow-clear
|
||||
:disabled="true"
|
||||
placeholder="请输入申请退款时间"
|
||||
v-model:value="form.refundApplyTime"
|
||||
/>
|
||||
</a-form-item>
|
||||
<a-form-item label="对账情况:1=已对账;2=未对账;3=已对账,金额对不上;4=未查询到该订单" name="checkBill">
|
||||
<a-form-item label="对账情况" name="checkBill">
|
||||
<a-input
|
||||
allow-clear
|
||||
placeholder="请输入对账情况:1=已对账;2=未对账;3=已对账,金额对不上;4=未查询到该订单"
|
||||
:disabled="true"
|
||||
placeholder="请输入对账情况:0=未对账;1=已对账;3=已对账,金额对不上;4=未查询到该订单"
|
||||
v-model:value="form.checkBill"
|
||||
/>
|
||||
</a-form-item>
|
||||
<a-form-item label="订单是否已结算" name="isSettled">
|
||||
<a-input
|
||||
allow-clear
|
||||
:disabled="true"
|
||||
placeholder="请输入订单是否已结算(0未结算 1已结算)"
|
||||
v-model:value="form.isSettled"
|
||||
/>
|
||||
</a-form-item>
|
||||
<a-form-item label="备注" name="comments">
|
||||
<a-textarea
|
||||
:rows="4"
|
||||
:maxlength="200"
|
||||
:disabled="true"
|
||||
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>
|
||||
</ele-modal>
|
||||
</template>
|
||||
@@ -329,13 +330,12 @@
|
||||
wechatOrder: undefined,
|
||||
refundOrder: undefined,
|
||||
merchantId: undefined,
|
||||
userId: undefined,
|
||||
couponId: undefined,
|
||||
cardId: undefined,
|
||||
aid: undefined,
|
||||
adminId: undefined,
|
||||
code: undefined,
|
||||
name: undefined,
|
||||
confirmId: undefined,
|
||||
icCard: undefined,
|
||||
realName: undefined,
|
||||
phone: undefined,
|
||||
totalPrice: undefined,
|
||||
reducePrice: undefined,
|
||||
@@ -348,24 +348,24 @@
|
||||
payType: undefined,
|
||||
payStatus: undefined,
|
||||
orderStatus: undefined,
|
||||
type: undefined,
|
||||
couponType: undefined,
|
||||
couponDesc: undefined,
|
||||
qrcode: undefined,
|
||||
desc: undefined,
|
||||
returnNum: undefined,
|
||||
returnMoney: undefined,
|
||||
startTime: undefined,
|
||||
isInvoice: undefined,
|
||||
createTime: undefined,
|
||||
updateTime: undefined,
|
||||
payTime: undefined,
|
||||
refundTime: undefined,
|
||||
refundApplyTime: undefined,
|
||||
checkBill: undefined,
|
||||
comments: undefined,
|
||||
isSettled: undefined,
|
||||
version: undefined,
|
||||
userId: undefined,
|
||||
deleted: undefined,
|
||||
tenantId: undefined,
|
||||
orderId: undefined,
|
||||
orderName: '',
|
||||
updateTime: undefined,
|
||||
createTime: undefined,
|
||||
status: 0,
|
||||
comments: '',
|
||||
sortNumber: 100
|
||||
@@ -382,7 +382,7 @@
|
||||
{
|
||||
required: true,
|
||||
type: 'string',
|
||||
message: '请填写预约订单名称',
|
||||
message: '请填写订单名称',
|
||||
trigger: 'blur'
|
||||
}
|
||||
]
|
||||
@@ -439,12 +439,12 @@
|
||||
images.value = [];
|
||||
if (props.data) {
|
||||
assignObject(form, props.data);
|
||||
if(props.data.image){
|
||||
if (props.data.image) {
|
||||
images.value.push({
|
||||
uid: uuid(),
|
||||
url: props.data.image,
|
||||
status: 'done'
|
||||
})
|
||||
});
|
||||
}
|
||||
isUpdate.value = true;
|
||||
} else {
|
||||
|
||||
@@ -1,6 +1,12 @@
|
||||
<!-- 搜索表单 -->
|
||||
<template>
|
||||
<a-space :size="10" style="flex-wrap: wrap">
|
||||
<SelectMerchantDown
|
||||
:placeholder="`选择场馆`"
|
||||
class="input-item"
|
||||
v-model:value="where.merchantId"
|
||||
@change="search"
|
||||
/>
|
||||
<a-input-search
|
||||
allow-clear
|
||||
v-model:value="where.keywords"
|
||||
@@ -8,13 +14,30 @@
|
||||
@search="search"
|
||||
@pressEnter="search"
|
||||
/>
|
||||
<a-button @click="getCode">生成支付二维码</a-button>
|
||||
<a-button @click="reset">重置</a-button>
|
||||
</a-space>
|
||||
<ele-modal
|
||||
:width="500"
|
||||
:visible="showQrcode"
|
||||
:maskClosable="false"
|
||||
title="使用微信扫一扫完成支付"
|
||||
:body-style="{ paddingBottom: '28px' }"
|
||||
@cancel="closeQrcode"
|
||||
@ok="closeQrcode"
|
||||
>
|
||||
<div class="qrcode">
|
||||
<ele-qr-code-svg v-if="text" :value="text" :size="200" />
|
||||
<div class="ele-text-secondary">使用微信扫一扫完成支付</div>
|
||||
</div>
|
||||
</ele-modal>
|
||||
</template>
|
||||
|
||||
<script lang="ts" setup>
|
||||
import { watch } from 'vue';
|
||||
import { ref, watch } from 'vue';
|
||||
import useSearch from '@/utils/use-search';
|
||||
import { OrderParam } from '@/api/shop/order/model';
|
||||
import { getNativeCode } from '@/api/system/payment';
|
||||
|
||||
const props = withDefaults(
|
||||
defineProps<{
|
||||
@@ -32,7 +55,7 @@
|
||||
}>();
|
||||
|
||||
// 表单数据
|
||||
const { where } = useSearch<OrderParam>({
|
||||
const { where, resetFields } = useSearch<OrderParam>({
|
||||
keywords: ''
|
||||
});
|
||||
|
||||
@@ -41,8 +64,39 @@
|
||||
emit('search', where);
|
||||
};
|
||||
|
||||
/* 重置 */
|
||||
const reset = () => {
|
||||
resetFields();
|
||||
search();
|
||||
};
|
||||
|
||||
// 二维码内容
|
||||
const text = ref('');
|
||||
const showQrcode = ref(false);
|
||||
|
||||
const closeQrcode = () => {
|
||||
showQrcode.value = !showQrcode.value;
|
||||
};
|
||||
|
||||
const getCode = () => {
|
||||
getNativeCode({}).then((data) => {
|
||||
text.value = String(data);
|
||||
showQrcode.value = true;
|
||||
});
|
||||
};
|
||||
|
||||
watch(
|
||||
() => props.selection,
|
||||
() => {}
|
||||
);
|
||||
</script>
|
||||
|
||||
<style lang="less" scoped>
|
||||
.qrcode {
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
padding: 40px 0;
|
||||
}
|
||||
</style>
|
||||
|
||||
@@ -26,101 +26,106 @@
|
||||
<a-image :src="record.image" :width="50" />
|
||||
</template>
|
||||
<template v-if="column.key === 'payType'">
|
||||
<a-tag v-if="record.payType == 1" color="green"
|
||||
><WechatOutlined class="tag-icon" />微信支付</a-tag
|
||||
>
|
||||
<a-tag v-if="record.payType == 2" color="green">积分</a-tag>
|
||||
<a-tag v-if="record.payType == 3" color="green"
|
||||
><AlipayCircleOutlined class="tag-icon" />支付宝</a-tag
|
||||
>
|
||||
<a-tag v-if="record.payType == 4" color="green"
|
||||
><IdcardOutlined class="tag-icon" />现金</a-tag
|
||||
>
|
||||
<a-tag v-if="record.payType == 5" color="green"
|
||||
><IdcardOutlined class="tag-icon" />POS机</a-tag
|
||||
>
|
||||
<a-tag v-if="record.payType == 6" color="green"
|
||||
><IdcardOutlined class="tag-icon" />VIP月卡</a-tag
|
||||
>
|
||||
<a-tag v-if="record.payType == 7" color="green"
|
||||
><IdcardOutlined class="tag-icon" />VIP年卡</a-tag
|
||||
>
|
||||
<a-tag v-if="record.payType == 8" color="green"
|
||||
><IdcardOutlined class="tag-icon" />VIP次卡</a-tag
|
||||
>
|
||||
<a-tag v-if="record.payType == 9" color="green"
|
||||
><IdcardOutlined class="tag-icon" />IC月卡</a-tag
|
||||
>
|
||||
<a-tag v-if="record.payType == 10" color="green"
|
||||
><IdcardOutlined class="tag-icon" />IC年卡</a-tag
|
||||
>
|
||||
<a-tag v-if="record.payType == 11" color="green"
|
||||
><IdcardOutlined class="tag-icon" />IC次卡</a-tag
|
||||
>
|
||||
<a-tag v-if="record.payType == 12" color="green"
|
||||
><IdcardOutlined class="tag-icon" />免费</a-tag
|
||||
>
|
||||
<a-tag v-if="record.payType == 13" color="green"
|
||||
><IdcardOutlined class="tag-icon" />VIP充值卡</a-tag
|
||||
>
|
||||
<a-tag v-if="record.payType == 14" color="green"
|
||||
><IdcardOutlined class="tag-icon" />IC充值卡</a-tag
|
||||
>
|
||||
<a-tag v-if="record.payType == 15" color="green"
|
||||
><IdcardOutlined class="tag-icon" />积分支付</a-tag
|
||||
>
|
||||
<a-tag v-if="record.payType == 16" color="green"
|
||||
><IdcardOutlined class="tag-icon" />VIP季卡</a-tag
|
||||
>
|
||||
<a-tag v-if="record.payType == 17" color="green"
|
||||
><IdcardOutlined class="tag-icon" />IC季卡</a-tag
|
||||
>
|
||||
<template v-if="record.payStatus == 1">
|
||||
<a-tag v-if="record.payType == 1"
|
||||
><WechatOutlined class="tag-icon" />微信支付</a-tag
|
||||
>
|
||||
<a-tag v-if="record.payType == 2">积分</a-tag>
|
||||
<a-tag v-if="record.payType == 3"
|
||||
><AlipayCircleOutlined class="tag-icon" />支付宝</a-tag
|
||||
>
|
||||
<a-tag v-if="record.payType == 4"
|
||||
><IdcardOutlined class="tag-icon" />现金</a-tag
|
||||
>
|
||||
<a-tag v-if="record.payType == 5"
|
||||
><IdcardOutlined class="tag-icon" />POS机</a-tag
|
||||
>
|
||||
<a-tag v-if="record.payType == 6"
|
||||
><IdcardOutlined class="tag-icon" />VIP月卡</a-tag
|
||||
>
|
||||
<a-tag v-if="record.payType == 7"
|
||||
><IdcardOutlined class="tag-icon" />VIP年卡</a-tag
|
||||
>
|
||||
<a-tag v-if="record.payType == 8"
|
||||
><IdcardOutlined class="tag-icon" />VIP次卡</a-tag
|
||||
>
|
||||
<a-tag v-if="record.payType == 9"
|
||||
><IdcardOutlined class="tag-icon" />IC月卡</a-tag
|
||||
>
|
||||
<a-tag v-if="record.payType == 10"
|
||||
><IdcardOutlined class="tag-icon" />IC年卡</a-tag
|
||||
>
|
||||
<a-tag v-if="record.payType == 11"
|
||||
><IdcardOutlined class="tag-icon" />IC次卡</a-tag
|
||||
>
|
||||
<a-tag v-if="record.payType == 12"
|
||||
><IdcardOutlined class="tag-icon" />免费</a-tag
|
||||
>
|
||||
<a-tag v-if="record.payType == 13"
|
||||
><IdcardOutlined class="tag-icon" />VIP充值卡</a-tag
|
||||
>
|
||||
<a-tag v-if="record.payType == 14"
|
||||
><IdcardOutlined class="tag-icon" />IC充值卡</a-tag
|
||||
>
|
||||
<a-tag v-if="record.payType == 15"
|
||||
><IdcardOutlined class="tag-icon" />积分支付</a-tag
|
||||
>
|
||||
<a-tag v-if="record.payType == 16"
|
||||
><IdcardOutlined class="tag-icon" />VIP季卡</a-tag
|
||||
>
|
||||
<a-tag v-if="record.payType == 17"
|
||||
><IdcardOutlined class="tag-icon" />IC季卡</a-tag
|
||||
>
|
||||
</template>
|
||||
<template v-else>
|
||||
<span></span>
|
||||
</template>
|
||||
</template>
|
||||
<template v-if="column.key === 'type'">
|
||||
<a-tag v-if="record.type == 0">无</a-tag>
|
||||
<a-tag v-if="record.type == 1" color="blue"
|
||||
<template v-if="column.key === 'couponType'">
|
||||
<a-tag v-if="record.couponType == 0">无</a-tag>
|
||||
<a-tag v-if="record.couponType == 1" color="blue"
|
||||
><IdcardOutlined class="tag-icon" />抵扣优惠券</a-tag
|
||||
>
|
||||
<a-tag v-if="record.type == 2" color="blue"
|
||||
<a-tag v-if="record.couponType == 2" color="blue"
|
||||
><IdcardOutlined class="tag-icon" />折扣优惠券</a-tag
|
||||
>
|
||||
<a-tag v-if="record.type == 3" color="blue"
|
||||
<a-tag v-if="record.couponType == 3" color="blue"
|
||||
><IdcardOutlined class="tag-icon" />VIP月卡</a-tag
|
||||
>
|
||||
<a-tag v-if="record.type == 4" color="blue"
|
||||
<a-tag v-if="record.couponType == 4" color="blue"
|
||||
><IdcardOutlined class="tag-icon" />VIP年卡</a-tag
|
||||
>
|
||||
<a-tag v-if="record.type == 5" color="blue"
|
||||
<a-tag v-if="record.couponType == 5" color="blue"
|
||||
><IdcardOutlined class="tag-icon" />VIP次卡</a-tag
|
||||
>
|
||||
<a-tag v-if="record.type == 6" color="blue"
|
||||
<a-tag v-if="record.couponType == 6" color="blue"
|
||||
><IdcardOutlined class="tag-icon" />VIP会员卡</a-tag
|
||||
>
|
||||
<a-tag v-if="record.type == 7" color="blue"
|
||||
<a-tag v-if="record.couponType == 7" color="blue"
|
||||
><IdcardOutlined class="tag-icon" />IC月卡</a-tag
|
||||
>
|
||||
<a-tag v-if="record.type == 8" color="blue"
|
||||
<a-tag v-if="record.couponType == 8" color="blue"
|
||||
><IdcardOutlined class="tag-icon" />IC年卡</a-tag
|
||||
>
|
||||
<a-tag v-if="record.type == 9" color="blue"
|
||||
<a-tag v-if="record.couponType == 9" color="blue"
|
||||
><IdcardOutlined class="tag-icon" />IC次卡</a-tag
|
||||
>
|
||||
<a-tag v-if="record.type == 10" color="blue"
|
||||
<a-tag v-if="record.couponType == 10" color="blue"
|
||||
><IdcardOutlined class="tag-icon" />IC会员卡</a-tag
|
||||
>
|
||||
<a-tag v-if="record.type == 11" color="blue"
|
||||
<a-tag v-if="record.couponType == 11" color="blue"
|
||||
><IdcardOutlined class="tag-icon" />免费订单</a-tag
|
||||
>
|
||||
<a-tag v-if="record.type == 12" color="blue"
|
||||
<a-tag v-if="record.couponType == 12" color="blue"
|
||||
><IdcardOutlined class="tag-icon" />VIP充值卡</a-tag
|
||||
>
|
||||
<a-tag v-if="record.type == 13" color="blue"
|
||||
<a-tag v-if="record.couponType == 13" color="blue"
|
||||
><IdcardOutlined class="tag-icon" />IC充值卡</a-tag
|
||||
>
|
||||
<a-tag v-if="record.type == 14" color="blue"
|
||||
<a-tag v-if="record.couponType == 14" color="blue"
|
||||
><IdcardOutlined class="tag-icon" />VIP季卡</a-tag
|
||||
>
|
||||
<a-tag v-if="record.type == 15" color="blue"
|
||||
<a-tag v-if="record.couponType == 15" color="blue"
|
||||
><IdcardOutlined class="tag-icon" />IC季卡</a-tag
|
||||
>
|
||||
</template>
|
||||
@@ -128,7 +133,7 @@
|
||||
<a-tag v-if="record.payStatus == 1" color="green"
|
||||
><CheckOutlined class="tag-icon" />已付款</a-tag
|
||||
>
|
||||
<a-tag v-if="record.payStatus == 2" color="error"
|
||||
<a-tag v-if="record.payStatus == 0" color="error"
|
||||
><CloseOutlined class="tag-icon" />未付款</a-tag
|
||||
>
|
||||
<a-tag v-if="record.payStatus == 3" color="cyan"
|
||||
@@ -136,32 +141,24 @@
|
||||
>
|
||||
</template>
|
||||
<template v-if="column.key === 'orderStatus'">
|
||||
<a-tag v-if="record.orderStatus == 1" color="green"
|
||||
><CheckOutlined class="tag-icon" />已付款</a-tag
|
||||
<span v-if="record.orderStatus == 0"
|
||||
><ClockCircleOutlined class="tag-icon" />未使用</span
|
||||
>
|
||||
<a-tag v-if="record.orderStatus == 2" color="blue"
|
||||
><ClockCircleOutlined class="tag-icon" />未使用</a-tag
|
||||
<span v-if="record.orderStatus == 1"
|
||||
><CheckOutlined class="tag-icon" />已付款</span
|
||||
>
|
||||
<a-tag v-if="record.orderStatus == 3" color="error"
|
||||
><CloseOutlined class="tag-icon" />已取消</a-tag
|
||||
>
|
||||
<a-tag v-if="record.orderStatus == 4" color="error"
|
||||
>退款申请中</a-tag
|
||||
>
|
||||
<a-tag v-if="record.orderStatus == 5" color="error"
|
||||
>退款被拒绝</a-tag
|
||||
>
|
||||
<a-tag v-if="record.orderStatus == 6" color="green"
|
||||
>退款成功</a-tag
|
||||
>
|
||||
<a-tag v-if="record.orderStatus == 7" color="green"
|
||||
>客户端申请退款</a-tag
|
||||
<span v-if="record.orderStatus == 3"
|
||||
><CloseOutlined class="tag-icon" />已取消</span
|
||||
>
|
||||
<span v-if="record.orderStatus == 4">退款申请中</span>
|
||||
<span v-if="record.orderStatus == 5">退款被拒绝</span>
|
||||
<span v-if="record.orderStatus == 6">退款成功</span>
|
||||
<span v-if="record.orderStatus == 7">客户端申请退款</span>
|
||||
</template>
|
||||
<template v-if="column.key === 'isInvoice'">
|
||||
<a-tag v-if="record.isInvoice == 0">未开</a-tag>
|
||||
<a-tag v-if="record.isInvoice == 1" color="green">已开</a-tag>
|
||||
<a-tag v-if="record.isInvoice == 2" color="green">未开</a-tag>
|
||||
<a-tag v-if="record.isInvoice == 1" color="green">不能开</a-tag>
|
||||
<a-tag v-if="record.isInvoice == 2">不能开</a-tag>
|
||||
</template>
|
||||
<template v-if="column.key === 'status'">
|
||||
<a-tag v-if="record.status === 0" color="green">显示</a-tag>
|
||||
@@ -203,8 +200,13 @@
|
||||
} from 'ele-admin-pro/es/ele-pro-table/types';
|
||||
import Search from './components/search.vue';
|
||||
import OrderEdit from './components/orderEdit.vue';
|
||||
import { pageOrder, removeOrder, removeBatchOrder } from '@/api/shop/order';
|
||||
import type { Order, OrderParam } from '@/api/shop/order/model';
|
||||
import {
|
||||
pageOrder,
|
||||
removeOrder,
|
||||
removeBatchOrder
|
||||
} from '@/api/booking/order';
|
||||
import type { Order, OrderParam } from '@/api/booking/order/model';
|
||||
import { formatNumber } from 'ele-admin-pro/es';
|
||||
|
||||
// 表格实例
|
||||
const tableRef = ref<InstanceType<typeof EleProTable> | null>(null);
|
||||
@@ -249,8 +251,8 @@
|
||||
},
|
||||
{
|
||||
title: '姓名',
|
||||
dataIndex: 'name',
|
||||
key: 'name',
|
||||
dataIndex: 'realName',
|
||||
key: 'realName',
|
||||
align: 'center'
|
||||
},
|
||||
{
|
||||
@@ -264,19 +266,22 @@
|
||||
title: '总额',
|
||||
dataIndex: 'totalPrice',
|
||||
key: 'totalPrice',
|
||||
align: 'center'
|
||||
align: 'center',
|
||||
customRender: ({ text }) => `¥${formatNumber(text)}`
|
||||
},
|
||||
{
|
||||
title: '减少金额',
|
||||
dataIndex: 'reducePrice',
|
||||
key: 'reducePrice',
|
||||
align: 'center'
|
||||
align: 'center',
|
||||
customRender: ({ text }) => `¥${formatNumber(text)}`
|
||||
},
|
||||
{
|
||||
title: '实付金额',
|
||||
dataIndex: 'payPrice',
|
||||
key: 'payPrice',
|
||||
align: 'center'
|
||||
align: 'center',
|
||||
customRender: ({ text }) => `¥${formatNumber(text)}`
|
||||
},
|
||||
{
|
||||
title: '支付方式',
|
||||
@@ -298,8 +303,8 @@
|
||||
},
|
||||
{
|
||||
title: '优惠类型',
|
||||
dataIndex: 'type',
|
||||
key: 'type',
|
||||
dataIndex: 'couponType',
|
||||
key: 'couponType',
|
||||
align: 'center'
|
||||
},
|
||||
{
|
||||
|
||||
474
src/views/system/company/components/company-edit.vue
Normal file
474
src/views/system/company/components/company-edit.vue
Normal file
@@ -0,0 +1,474 @@
|
||||
<!-- 编辑弹窗 -->
|
||||
<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="shortName">
|
||||
<a-input
|
||||
allow-clear
|
||||
placeholder="请输入租户名称"
|
||||
v-model:value="form.shortName"
|
||||
/>
|
||||
</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="companyName">
|
||||
<a-input
|
||||
allow-clear
|
||||
placeholder="请输入企业完整名称"
|
||||
v-model:value="form.companyName"
|
||||
/>
|
||||
</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="businessEntity">
|
||||
<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="11"
|
||||
:disabled="isUpdate"
|
||||
placeholder="请填写法定代表手机号"
|
||||
v-model:value="form.phone"
|
||||
/>
|
||||
</a-form-item>
|
||||
<a-form-item label="登录密码" name="password" v-if="!isUpdate">
|
||||
<a-input
|
||||
allow-clear
|
||||
:maxlength="20"
|
||||
placeholder="请填写登录密码"
|
||||
v-model:value="form.password"
|
||||
/>
|
||||
</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="tel">
|
||||
<a-input
|
||||
allow-clear
|
||||
:maxlength="20"
|
||||
placeholder="请填写座机电话"
|
||||
v-model:value="form.tel"
|
||||
/>
|
||||
</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"
|
||||
/>
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
<a-col
|
||||
v-bind="styleResponsive ? { md: 11, sm: 24, xs: 24 } : { span: 8 }"
|
||||
>
|
||||
<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 } from 'vue';
|
||||
import { Form, message } from 'ant-design-vue';
|
||||
import { assignObject, phoneReg } from 'ele-admin-pro';
|
||||
import { useThemeStore } from '@/store/modules/theme';
|
||||
import { storeToRefs } from 'pinia';
|
||||
import { EnvironmentOutlined } from '@ant-design/icons-vue';
|
||||
import { FormInstance, type 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 {
|
||||
updateCompany,
|
||||
addCompany,
|
||||
updateCompanyAll
|
||||
} from '@/api/system/company';
|
||||
import { CenterPoint } from 'ele-admin-pro/es/ele-map-picker/types';
|
||||
import { FileRecord } from '@/api/system/file/model';
|
||||
import { getMerchantId, getUserId } from '@/utils/common';
|
||||
import { emailReg } from 'ele-admin-pro/es';
|
||||
|
||||
// 是否是修改
|
||||
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 userId = getUserId();
|
||||
// 当期时间
|
||||
// 已上传数据
|
||||
const images = ref<ItemType[]>([]);
|
||||
// 类型 single|multiple
|
||||
// const type = ref<string>('single');
|
||||
// 日期范围选择
|
||||
const content = ref('');
|
||||
const requirement = ref('');
|
||||
// 是否显示地图选择弹窗
|
||||
const showMap = ref(false);
|
||||
// 省市区
|
||||
const city = ref<string[]>([]);
|
||||
const formRef = ref<FormInstance | null>(null);
|
||||
|
||||
// 用户信息
|
||||
const form = reactive<Company>({
|
||||
companyId: undefined,
|
||||
companyName: '',
|
||||
companyCode: '',
|
||||
businessEntity: '',
|
||||
companyType: undefined,
|
||||
industryParent: '',
|
||||
industryChild: '',
|
||||
shortName: '',
|
||||
phone: '',
|
||||
email: '',
|
||||
companyLogo: undefined,
|
||||
domain: '',
|
||||
sortNumber: undefined,
|
||||
comments: '',
|
||||
tenantName: '',
|
||||
province: '',
|
||||
city: '',
|
||||
region: '',
|
||||
latitude: '',
|
||||
longitude: '',
|
||||
address: '',
|
||||
nickname: '',
|
||||
merchantId: 0,
|
||||
createTime: '',
|
||||
status: 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'
|
||||
}
|
||||
],
|
||||
shortName: [
|
||||
{
|
||||
required: true,
|
||||
type: 'string',
|
||||
message: '请填写租户名称',
|
||||
trigger: 'blur'
|
||||
}
|
||||
],
|
||||
phone: [
|
||||
{
|
||||
pattern: phoneReg,
|
||||
required: true,
|
||||
type: 'string',
|
||||
message: '手机号格式不正确',
|
||||
trigger: 'blur'
|
||||
}
|
||||
],
|
||||
businessEntity: [
|
||||
{
|
||||
required: true,
|
||||
type: 'string',
|
||||
message: '请填写企业法定代表人',
|
||||
trigger: 'blur'
|
||||
}
|
||||
],
|
||||
email: [
|
||||
{
|
||||
pattern: emailReg,
|
||||
required: true,
|
||||
type: 'string',
|
||||
message: '电子邮箱格式不正确',
|
||||
trigger: 'blur'
|
||||
}
|
||||
],
|
||||
password: [
|
||||
{
|
||||
required: true,
|
||||
type: 'string',
|
||||
message: '请填写登录密码',
|
||||
trigger: 'blur'
|
||||
}
|
||||
],
|
||||
region: [
|
||||
{
|
||||
required: true,
|
||||
type: 'string',
|
||||
message: '请选择所在区域',
|
||||
trigger: 'blur'
|
||||
}
|
||||
],
|
||||
industry: [
|
||||
{
|
||||
required: true,
|
||||
type: 'string',
|
||||
message: '请选择所属行业',
|
||||
trigger: 'blur',
|
||||
validator: async (_rule: RuleObject, value: string) => {
|
||||
if (!industry.value[1]) {
|
||||
return Promise.reject('请选择所属行业');
|
||||
} else {
|
||||
return Promise.resolve();
|
||||
}
|
||||
}
|
||||
}
|
||||
]
|
||||
});
|
||||
|
||||
const { resetFields, validate, validateInfos } = useForm(form, rules);
|
||||
|
||||
// 选择地区
|
||||
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 openMapPicker = () => {
|
||||
showMap.value = true;
|
||||
};
|
||||
|
||||
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,
|
||||
merchantId: getMerchantId(),
|
||||
industryParent: industry.value[0],
|
||||
industryChild: industry.value[1]
|
||||
};
|
||||
console.log(formData);
|
||||
const saveOrUpdate = isUpdate.value ? updateCompanyAll : 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)
|
||||
]);
|
||||
|
||||
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.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;
|
||||
} else {
|
||||
isUpdate.value = false;
|
||||
}
|
||||
} else {
|
||||
resetFields();
|
||||
}
|
||||
}
|
||||
);
|
||||
</script>
|
||||
298
src/views/system/company/components/company-info.vue
Normal file
298
src/views/system/company/components/company-info.vue
Normal file
@@ -0,0 +1,298 @@
|
||||
<!-- 用户编辑弹窗 -->
|
||||
<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>
|
||||
96
src/views/system/company/components/search.vue
Normal file
96
src/views/system/company/components/search.vue
Normal file
@@ -0,0 +1,96 @@
|
||||
<!-- 搜索表单 -->
|
||||
<template>
|
||||
<div style="display: flex; justify-content: space-between">
|
||||
<a-space :size="10" style="flex-wrap: wrap; margin-right: 20px">
|
||||
<a-button
|
||||
v-permission="['sys:company:save']"
|
||||
type="primary"
|
||||
class="ele-btn-icon"
|
||||
@click="add"
|
||||
>
|
||||
<template #icon>
|
||||
<PlusOutlined />
|
||||
</template>
|
||||
<span>创建</span>
|
||||
</a-button>
|
||||
<a-radio-group v-model:value="where.version" @change="handleSearch">
|
||||
<a-radio-button :value="99">我的收藏</a-radio-button>
|
||||
<a-radio-button :value="88">回收站</a-radio-button>
|
||||
</a-radio-group>
|
||||
<a-radio-group v-model:value="where.version" @change="handleSearch">
|
||||
<a-radio-button :value="100">全部</a-radio-button>
|
||||
<a-radio-button :value="10">免费版</a-radio-button>
|
||||
<a-radio-button :value="20">商业版</a-radio-button>
|
||||
<a-radio-button :value="30">永久授权</a-radio-button>
|
||||
</a-radio-group>
|
||||
<a-input-search
|
||||
allow-clear
|
||||
placeholder="请输入关键词"
|
||||
v-model:value="where.keywords"
|
||||
@pressEnter="search"
|
||||
@search="search"
|
||||
/>
|
||||
</a-space>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script lang="ts" setup>
|
||||
import { PlusOutlined } from '@ant-design/icons-vue';
|
||||
import useSearch from '@/utils/use-search';
|
||||
import { ref, watch } from 'vue';
|
||||
import { CompanyParam } from '@/api/system/company/model';
|
||||
|
||||
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 } = useSearch<CompanyParam>({
|
||||
companyId: undefined,
|
||||
companyName: undefined,
|
||||
keywords: '',
|
||||
authentication: undefined,
|
||||
version: 99,
|
||||
province: '',
|
||||
city: '',
|
||||
region: '',
|
||||
collection: undefined
|
||||
});
|
||||
const tenantId = ref<number>();
|
||||
if (localStorage.getItem('TenantId')) {
|
||||
tenantId.value = Number(localStorage.getItem('TenantId'));
|
||||
}
|
||||
|
||||
// 新增
|
||||
const add = () => {
|
||||
emit('add');
|
||||
};
|
||||
|
||||
/* 搜索 */
|
||||
const search = () => {
|
||||
emit('search', {
|
||||
...where
|
||||
});
|
||||
};
|
||||
|
||||
const handleSearch = () => {
|
||||
emit('search', where);
|
||||
};
|
||||
|
||||
watch(
|
||||
() => props.selection,
|
||||
() => {}
|
||||
);
|
||||
</script>
|
||||
@@ -0,0 +1,245 @@
|
||||
<!-- 用户编辑弹窗 -->
|
||||
<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 = '\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>
|
||||
60
src/views/system/company/detail/components/company-about.vue
Normal file
60
src/views/system/company/detail/components/company-about.vue
Normal file
@@ -0,0 +1,60 @@
|
||||
<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>
|
||||
@@ -0,0 +1,221 @@
|
||||
<!-- 角色编辑弹窗 -->
|
||||
<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>
|
||||
301
src/views/system/company/detail/components/company-annex.vue
Normal file
301
src/views/system/company/detail/components/company-annex.vue
Normal file
@@ -0,0 +1,301 @@
|
||||
<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>
|
||||
@@ -0,0 +1,177 @@
|
||||
<!-- 用户编辑弹窗 -->
|
||||
<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>
|
||||
@@ -0,0 +1,13 @@
|
||||
<template>
|
||||
<a-button @click="add">添加资料</a-button>
|
||||
</template>
|
||||
|
||||
<script lang="ts" setup>
|
||||
const emit = defineEmits<{
|
||||
(e: 'add'): void;
|
||||
}>();
|
||||
|
||||
const add = () => {
|
||||
emit('add');
|
||||
};
|
||||
</script>
|
||||
211
src/views/system/company/detail/components/company-field.vue
Normal file
211
src/views/system/company/detail/components/company-field.vue
Normal file
@@ -0,0 +1,211 @@
|
||||
<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>
|
||||
500
src/views/system/company/detail/components/company-info-edit.vue
Normal file
500
src/views/system/company/detail/components/company-info-edit.vue
Normal file
@@ -0,0 +1,500 @@
|
||||
<!-- 用户编辑弹窗 -->
|
||||
<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>
|
||||
161
src/views/system/company/detail/components/company-info.vue
Normal file
161
src/views/system/company/detail/components/company-info.vue
Normal file
@@ -0,0 +1,161 @@
|
||||
<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>
|
||||
255
src/views/system/company/detail/components/company-nenew.vue
Normal file
255
src/views/system/company/detail/components/company-nenew.vue
Normal file
@@ -0,0 +1,255 @@
|
||||
<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>
|
||||
@@ -0,0 +1,220 @@
|
||||
<!-- 用户编辑弹窗 -->
|
||||
<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>
|
||||
52
src/views/system/company/detail/components/company-photo.vue
Normal file
52
src/views/system/company/detail/components/company-photo.vue
Normal file
@@ -0,0 +1,52 @@
|
||||
<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>
|
||||
@@ -0,0 +1,256 @@
|
||||
<!-- 用户编辑弹窗 -->
|
||||
<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 = '\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>
|
||||
@@ -0,0 +1,66 @@
|
||||
<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>
|
||||
@@ -0,0 +1,210 @@
|
||||
<!-- 角色编辑弹窗 -->
|
||||
<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/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>
|
||||
@@ -0,0 +1,34 @@
|
||||
<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>
|
||||
298
src/views/system/company/detail/components/company-task.vue
Normal file
298
src/views/system/company/detail/components/company-task.vue
Normal file
@@ -0,0 +1,298 @@
|
||||
<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>
|
||||
110
src/views/system/company/detail/components/company-users.vue
Normal file
110
src/views/system/company/detail/components/company-users.vue
Normal file
@@ -0,0 +1,110 @@
|
||||
<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>
|
||||
203
src/views/system/company/detail/index.vue
Normal file
203
src/views/system/company/detail/index.vue
Normal file
@@ -0,0 +1,203 @@
|
||||
<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>
|
||||
178
src/views/system/company/dict/components/dict-edit.vue
Normal file
178
src/views/system/company/dict/components/dict-edit.vue
Normal file
@@ -0,0 +1,178 @@
|
||||
<!-- 分类编辑弹窗 -->
|
||||
<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>
|
||||
222
src/views/system/company/dict/index.vue
Normal file
222
src/views/system/company/dict/index.vue
Normal file
@@ -0,0 +1,222 @@
|
||||
<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>
|
||||
626
src/views/system/company/index.vue
Normal file
626
src/views/system/company/index.vue
Normal file
@@ -0,0 +1,626 @@
|
||||
<template>
|
||||
<a-page-header :title="title" @back="() => $router.go(-1)">
|
||||
<a-card :bordered="false" :body-style="{ padding: '16px' }">
|
||||
<!-- 表格 -->
|
||||
<ele-pro-table
|
||||
ref="tableRef"
|
||||
row-key="companyId"
|
||||
:columns="columns"
|
||||
:datasource="datasource"
|
||||
:scroll="{ x: 1200 }"
|
||||
cache-key="proSystemCompanyTable"
|
||||
>
|
||||
<template #toolbar>
|
||||
<search
|
||||
@search="reload"
|
||||
:selection="selection"
|
||||
@add="openEdit"
|
||||
@remove="removeBatch"
|
||||
@advanced="openAdvanced"
|
||||
/>
|
||||
</template>
|
||||
<template #bodyCell="{ column, record }">
|
||||
<template v-if="column.key === 'shortName'">
|
||||
<StarOutlined
|
||||
@click="onCollection(record)"
|
||||
class="tag-icon"
|
||||
:class="
|
||||
record.collection ? 'ele-text-warning' : 'ele-text-placeholder'
|
||||
"
|
||||
/>
|
||||
{{ record.shortName }}
|
||||
</template>
|
||||
<template v-if="column.key === 'companyLogo'">
|
||||
<div class="company-box">
|
||||
<a-image
|
||||
:height="45"
|
||||
:width="45"
|
||||
:preview="false"
|
||||
:src="record.companyLogo"
|
||||
fallback="https://file.wsdns.cn/20230218/550e610d43334dd2a7f66d5b20bd58eb.svg"
|
||||
/>
|
||||
</div>
|
||||
</template>
|
||||
<template v-if="column.key === 'phone'">
|
||||
<div class="ele-text-secondary">{{ record.companyName }}</div>
|
||||
<div
|
||||
v-any-role="['merchant', 'superAdmin']"
|
||||
class="ele-text-secondary"
|
||||
>{{ record.phone }}</div
|
||||
>
|
||||
<div v-role="'guest'" class="ele-text-secondary">{{
|
||||
record.mobile
|
||||
}}</div>
|
||||
</template>
|
||||
<template v-if="column.key === 'comments'">
|
||||
<span class="ele-text-secondary">{{ record.comments }}</span>
|
||||
</template>
|
||||
<template v-if="column.key === 'status'">
|
||||
<template v-if="record.status == 0">
|
||||
<a-tag>已下架</a-tag>
|
||||
</template>
|
||||
<template v-if="record.status == 1">
|
||||
<a-tag color="green">已上架</a-tag>
|
||||
</template>
|
||||
</template>
|
||||
<template v-if="column.key === 'expirationTime'">
|
||||
<template v-if="record.version == 30"> - </template>
|
||||
<template v-else>
|
||||
<div>{{ toDateString(record.createTime, 'yyyy-MM-dd') }}</div>
|
||||
<div>{{ toDateString(record.expirationTime, 'yyyy-MM-dd') }}</div>
|
||||
<div
|
||||
v-if="expirationTime(record.expirationTime) < 0"
|
||||
class="ele-text-placeholder"
|
||||
>
|
||||
{{ expirationTimeText(record) }}
|
||||
</div>
|
||||
<div
|
||||
v-if="
|
||||
expirationTime(record.expirationTime) > 0 &&
|
||||
expirationTime(record.expirationTime) < 30
|
||||
"
|
||||
class="ele-text-warning"
|
||||
>
|
||||
{{ expirationTimeText(record) }}
|
||||
</div>
|
||||
</template>
|
||||
</template>
|
||||
<template v-if="column.key === 'version'">
|
||||
<a-tag v-if="record.version == 10"
|
||||
><IdcardOutlined class="tag-icon" />免费版</a-tag
|
||||
>
|
||||
<a-tag color="blue" v-if="record.version == 20"
|
||||
><IdcardOutlined class="tag-icon" />商业版</a-tag
|
||||
>
|
||||
<a-tag color="cyan" v-if="record.version == 30"
|
||||
><IdcardOutlined class="tag-icon" />永久授权</a-tag
|
||||
>
|
||||
</template>
|
||||
<!-- <template v-if="column.key === 'version'">-->
|
||||
<!-- <a-button-->
|
||||
<!-- :size="`small`"-->
|
||||
<!-- v-if="record.version == 10"-->
|
||||
<!-- style="-->
|
||||
<!-- background-color: var(--grey-8);-->
|
||||
<!-- border: 1px solid var(--grey-5);-->
|
||||
<!-- color: var(--grey-3);-->
|
||||
<!-- "-->
|
||||
<!-- ><IdcardOutlined />体验版</a-button-->
|
||||
<!-- >-->
|
||||
<!-- <a-button-->
|
||||
<!-- :size="`small`"-->
|
||||
<!-- style="-->
|
||||
<!-- background-color: var(--green-1);-->
|
||||
<!-- border: 1px solid var(--green-5);-->
|
||||
<!-- color: var(--green-7);-->
|
||||
<!-- "-->
|
||||
<!-- v-if="record.version == 20"-->
|
||||
<!-- ><IdcardOutlined />商业版</a-button-->
|
||||
<!-- >-->
|
||||
<!-- <a-button-->
|
||||
<!-- :size="`small`"-->
|
||||
<!-- style="-->
|
||||
<!-- background-color: var(--cyan-1);-->
|
||||
<!-- border: 1px solid var(--cyan-5);-->
|
||||
<!-- color: var(--cyan-7);-->
|
||||
<!-- "-->
|
||||
<!-- v-if="record.version == 30"-->
|
||||
<!-- ><IdcardOutlined />永久授权</a-button-->
|
||||
<!-- >-->
|
||||
<!-- </template>-->
|
||||
<template v-if="column.key === 'appUrl'">
|
||||
<template v-if="record.adminUrl">
|
||||
<a-popover>
|
||||
<template #content>
|
||||
<div class="qrcode">
|
||||
<a
|
||||
@click="openNew(record.adminUrl)"
|
||||
class="ele-text-heading"
|
||||
>进入后台管理系统</a
|
||||
>
|
||||
<div class="ele-text-placeholder">
|
||||
账号密码:预留手机号+短信验证码登录
|
||||
</div>
|
||||
<div
|
||||
@click="copyText(`${record.adminUrl}`)"
|
||||
class="ele-text-secondary"
|
||||
>{{ record.adminUrl }}</div
|
||||
>
|
||||
</div>
|
||||
</template>
|
||||
<a-button :size="`small`" @click="openNew(record.adminUrl)"
|
||||
><DesktopOutlined />管理后台</a-button
|
||||
>
|
||||
</a-popover>
|
||||
</template>
|
||||
<template v-if="record.merchantUrl">
|
||||
<a-divider type="vertical" />
|
||||
<a-popover>
|
||||
<template #content>
|
||||
<div class="qrcode">
|
||||
<a
|
||||
@click="openNew(record.merchantUrl)"
|
||||
class="ele-text-heading"
|
||||
>访问商户端</a
|
||||
>
|
||||
<div class="ele-text-placeholder"
|
||||
>商户及登录账号在总后台创建</div
|
||||
>
|
||||
<div
|
||||
@click="copyText(`${record.merchantUrl}`)"
|
||||
class="ele-text-secondary"
|
||||
>{{ record.merchantUrl }}</div
|
||||
>
|
||||
</div>
|
||||
</template>
|
||||
<a-button :size="`small`" @click="openNew(record.merchantUrl)"
|
||||
><DesktopOutlined />商户端</a-button
|
||||
>
|
||||
</a-popover>
|
||||
</template>
|
||||
<template v-if="record.websiteUrl">
|
||||
<a-divider type="vertical" />
|
||||
<a-popover>
|
||||
<template #content>
|
||||
<div class="qrcode">
|
||||
<a
|
||||
class="ele-text-heading"
|
||||
@click="openNew(record.websiteUrl)"
|
||||
>访问PC端</a
|
||||
>
|
||||
<div
|
||||
@click="copyText(`${record.websiteUrl}`)"
|
||||
class="ele-text-secondary"
|
||||
>{{ record.websiteUrl }}</div
|
||||
>
|
||||
</div>
|
||||
</template>
|
||||
<a-button :size="`small`" @click="openNew(record.websiteUrl)"
|
||||
><LaptopOutlined class="ele-text-primary" />PC</a-button
|
||||
>
|
||||
</a-popover>
|
||||
</template>
|
||||
<template v-if="record.h5Code">
|
||||
<a-divider type="vertical" />
|
||||
<a-popover>
|
||||
<template #content>
|
||||
<div class="qrcode">
|
||||
<ele-qr-code
|
||||
:value="`http://${record.h5Code}`"
|
||||
:size="160"
|
||||
level="M"
|
||||
:margin="1"
|
||||
/>
|
||||
<span>手机扫一扫</span>
|
||||
<div
|
||||
@click="copyText(`${record.h5Code}`)"
|
||||
class="ele-text-secondary"
|
||||
>{{ record.h5Code }}</div
|
||||
>
|
||||
</div>
|
||||
</template>
|
||||
<a-button :size="`small`" @click="openNew(record.h5Code)"
|
||||
><QrcodeOutlined class="ele-text-warning" />H5</a-button
|
||||
>
|
||||
</a-popover>
|
||||
</template>
|
||||
<template v-if="record.mpWeixinCode">
|
||||
<a-divider type="vertical" />
|
||||
<a-popover>
|
||||
<template #content>
|
||||
<div class="qrcode">
|
||||
<ele-qr-code
|
||||
:value="`微信小程序未配置`"
|
||||
:size="160"
|
||||
level="M"
|
||||
:margin="1"
|
||||
/>
|
||||
微信扫一扫
|
||||
</div>
|
||||
</template>
|
||||
<a-button :size="`small`"
|
||||
><WechatOutlined
|
||||
class="ele-text-success"
|
||||
/>微信小程序</a-button
|
||||
>
|
||||
</a-popover>
|
||||
</template>
|
||||
<template v-if="record.mpAlipayCode">
|
||||
<a-divider type="vertical" />
|
||||
<a-popover>
|
||||
<template #content>
|
||||
<div class="qrcode">
|
||||
<ele-qr-code
|
||||
:value="`支付宝小程序未配置`"
|
||||
:size="160"
|
||||
level="M"
|
||||
:margin="1"
|
||||
/>
|
||||
支付宝扫一扫
|
||||
</div>
|
||||
</template>
|
||||
<a-button :size="`small`"
|
||||
><AlipayOutlined class="ele-text-primary" />支付宝</a-button
|
||||
>
|
||||
</a-popover>
|
||||
</template>
|
||||
<!-- <a-divider type="vertical" />-->
|
||||
<!-- <a-dropdown>-->
|
||||
<!-- <template #overlay>-->
|
||||
<!-- <a-menu>-->
|
||||
<!-- <a-menu-item key="1" @click="onCode(record.iosUrl)">-->
|
||||
<!-- <AndroidOutlined class="tag-icon" />-->
|
||||
<!-- <span>APP端</span>-->
|
||||
<!-- </a-menu-item>-->
|
||||
<!-- <a-menu-item key="2" @click="openNew(record.android)">-->
|
||||
<!-- <AlipayOutlined class="tag-icon" />-->
|
||||
<!-- <span>支付宝</span>-->
|
||||
<!-- </a-menu-item>-->
|
||||
<!-- </a-menu>-->
|
||||
<!-- </template>-->
|
||||
<!-- <a-button :size="`small`">-->
|
||||
<!-- 更多-->
|
||||
<!-- <DownOutlined />-->
|
||||
<!-- </a-button>-->
|
||||
<!-- </a-dropdown>-->
|
||||
</template>
|
||||
<template v-if="column.key === 'action'">
|
||||
<template v-if="record.deleted == 1">
|
||||
<a-popconfirm
|
||||
placement="topRight"
|
||||
title="确定从回收站放回原处吗?"
|
||||
@confirm="recovery(record)"
|
||||
>
|
||||
<a class="ele-text-success" style="font-weight: bold">恢复</a>
|
||||
</a-popconfirm>
|
||||
</template>
|
||||
<template v-if="record.deleted == 0">
|
||||
<a-popconfirm
|
||||
placement="topRight"
|
||||
title="确定要删除此租户吗?"
|
||||
@confirm="remove(record)"
|
||||
>
|
||||
<a class="ele-text-danger">删除</a>
|
||||
</a-popconfirm>
|
||||
</template>
|
||||
<template v-if="record.deleted == 1 && getUserId() == 3731">
|
||||
<a-divider type="vertical" />
|
||||
<a-popconfirm
|
||||
placement="topRight"
|
||||
title="确定要销毁该租户吗?此操作将永久删除且不可恢复"
|
||||
@confirm="destruction(record)"
|
||||
>
|
||||
<a class="ele-text-danger" style="font-weight: bold">销毁</a>
|
||||
</a-popconfirm>
|
||||
</template>
|
||||
</template>
|
||||
</template>
|
||||
</ele-pro-table>
|
||||
</a-card>
|
||||
<!-- 编辑弹窗 -->
|
||||
<CompanyEdit v-model:visible="showEdit" :data="current" @done="reload" />
|
||||
</a-page-header>
|
||||
</template>
|
||||
|
||||
<script lang="ts" setup>
|
||||
import { createVNode, ref, watch } from 'vue';
|
||||
import { message, Modal } from 'ant-design-vue';
|
||||
import {
|
||||
ExclamationCircleOutlined,
|
||||
IdcardOutlined
|
||||
} from '@ant-design/icons-vue';
|
||||
import type { 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 CompanyEdit from './components/company-edit.vue';
|
||||
import {
|
||||
destructionCompany,
|
||||
removeBatchCompany,
|
||||
removeCompany,
|
||||
undeleteCompany
|
||||
} from '@/api/oa/company';
|
||||
import { Company, CompanyParam } from '@/api/system/company/model';
|
||||
import { toDateString } from 'ele-admin-pro';
|
||||
import { useRouter } from 'vue-router';
|
||||
const { currentRoute } = useRouter();
|
||||
import { pageCompanyAll } from '@/api/system/company';
|
||||
import {
|
||||
copyText,
|
||||
getMerchantId,
|
||||
getPageTitle,
|
||||
getUserId,
|
||||
openNew
|
||||
} from '@/utils/common';
|
||||
import { addUserCollection } from '@/api/system/user-collection';
|
||||
|
||||
defineProps<{
|
||||
activeKey?: boolean;
|
||||
data?: any;
|
||||
}>();
|
||||
|
||||
// 表格实例
|
||||
const tableRef = ref<InstanceType<typeof EleProTable> | null>(null);
|
||||
|
||||
// 表格列配置
|
||||
const columns = ref<ColumnItem[]>([
|
||||
{
|
||||
title: '租户ID',
|
||||
fixed: 'left',
|
||||
dataIndex: 'tenantId',
|
||||
width: 90
|
||||
},
|
||||
{
|
||||
title: 'Logo',
|
||||
dataIndex: 'companyLogo',
|
||||
key: 'companyLogo',
|
||||
width: 90
|
||||
},
|
||||
{
|
||||
title: '租户名称',
|
||||
dataIndex: 'shortName',
|
||||
key: 'shortName',
|
||||
width: 240
|
||||
},
|
||||
{
|
||||
title: '应用入口',
|
||||
key: 'appUrl'
|
||||
},
|
||||
{
|
||||
title: '版本',
|
||||
dataIndex: 'version',
|
||||
align: 'center',
|
||||
width: 160,
|
||||
key: 'version'
|
||||
},
|
||||
{
|
||||
title: '客户信息',
|
||||
dataIndex: 'phone',
|
||||
align: 'center',
|
||||
key: 'phone',
|
||||
width: 160
|
||||
},
|
||||
{
|
||||
title: '备注',
|
||||
dataIndex: 'comments',
|
||||
key: 'comments',
|
||||
width: 200
|
||||
},
|
||||
{
|
||||
title: '到期时间',
|
||||
dataIndex: 'expirationTime',
|
||||
key: 'expirationTime',
|
||||
align: 'center',
|
||||
width: 160,
|
||||
sorter: true,
|
||||
customRender: ({ text }) => toDateString(text, 'yyyy-MM-dd')
|
||||
},
|
||||
// {
|
||||
// title: '状态',
|
||||
// dataIndex: 'status',
|
||||
// align: 'center',
|
||||
// width: 120,
|
||||
// key: 'status',
|
||||
// customRender: ({ text }) => ['已上线', '开发中'][text]
|
||||
// }
|
||||
{
|
||||
title: '操作',
|
||||
key: 'action',
|
||||
width: 180,
|
||||
align: 'center'
|
||||
}
|
||||
]);
|
||||
|
||||
// 表格选中数据
|
||||
const selection = ref<Company[]>([]);
|
||||
// 当前编辑数据
|
||||
const current = ref<Company | null>(null);
|
||||
// 是否显示编辑弹窗
|
||||
const showEdit = ref(false);
|
||||
// 是否显示高级搜索
|
||||
const showAdvancedSearch = ref(false);
|
||||
// 页面标题
|
||||
const title = getPageTitle();
|
||||
|
||||
// 表格数据源
|
||||
const datasource: DatasourceFunction = ({ page, limit, where, orders }) => {
|
||||
where.merchantId = getMerchantId();
|
||||
|
||||
// 默认显示我的收藏
|
||||
if (where.version == undefined) {
|
||||
where.version = 99;
|
||||
}
|
||||
// 回收站
|
||||
if (where.version == 88) {
|
||||
where.version = undefined;
|
||||
where.deleted = 1;
|
||||
}
|
||||
// 查询全部
|
||||
if (where.version == 100) {
|
||||
where.version = undefined;
|
||||
}
|
||||
return pageCompanyAll({
|
||||
...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 expirationTimeText = (item: any) => {
|
||||
const now = new Date().getTime();
|
||||
const expiration = new Date(item.expirationTime).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);
|
||||
if (item.version == 30) {
|
||||
return `永久授权`;
|
||||
}
|
||||
if (days < 0) {
|
||||
// item.status = 1;
|
||||
// updateCompany(item);
|
||||
return `(已过期${Math.abs(days)}天)`;
|
||||
}
|
||||
if (days < 30) {
|
||||
return `(剩余${days}天)`;
|
||||
}
|
||||
};
|
||||
|
||||
/* 打开高级搜索 */
|
||||
const openAdvanced = () => {
|
||||
showAdvancedSearch.value = !showAdvancedSearch.value;
|
||||
};
|
||||
|
||||
const onCode = (text: string) => {
|
||||
console.log(text);
|
||||
};
|
||||
|
||||
const onCollection = (item: Company) => {
|
||||
addUserCollection({ tid: item.companyId }).then((msg) => {
|
||||
reload();
|
||||
});
|
||||
};
|
||||
|
||||
/* 删除单个 */
|
||||
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 recovery = (row: Company) => {
|
||||
undeleteCompany(row.companyId)
|
||||
.then((msg) => {
|
||||
message.success(msg);
|
||||
reload();
|
||||
})
|
||||
.catch((e) => {
|
||||
message.error(e.message);
|
||||
});
|
||||
};
|
||||
|
||||
// 销毁租户
|
||||
const destruction = (row: Company) => {
|
||||
destructionCompany(row.tenantId)
|
||||
.then((msg) => {
|
||||
message.success(msg);
|
||||
reload();
|
||||
})
|
||||
.catch((e) => {
|
||||
message.error(e.message);
|
||||
});
|
||||
};
|
||||
|
||||
watch(
|
||||
currentRoute,
|
||||
() => {
|
||||
reload();
|
||||
},
|
||||
{ immediate: true }
|
||||
);
|
||||
</script>
|
||||
|
||||
<script lang="ts">
|
||||
import * as MenuIcons from '@/layout/menu-icons';
|
||||
|
||||
export default {
|
||||
name: 'CompanyIndex',
|
||||
components: MenuIcons
|
||||
};
|
||||
</script>
|
||||
|
||||
<style lang="less" scoped>
|
||||
.tag-icon {
|
||||
padding-right: 6px;
|
||||
}
|
||||
.qrcode {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
}
|
||||
</style>
|
||||
701
src/views/system/company/renew/components/company-edit.vue
Normal file
701
src/views/system/company/renew/components/company-edit.vue
Normal file
@@ -0,0 +1,701 @@
|
||||
<!-- 编辑弹窗 -->
|
||||
<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 = '\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>
|
||||
298
src/views/system/company/renew/components/company-info.vue
Normal file
298
src/views/system/company/renew/components/company-info.vue
Normal file
@@ -0,0 +1,298 @@
|
||||
<!-- 用户编辑弹窗 -->
|
||||
<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>
|
||||
151
src/views/system/company/renew/components/search.vue
Normal file
151
src/views/system/company/renew/components/search.vue
Normal file
@@ -0,0 +1,151 @@
|
||||
<!-- 搜索表单 -->
|
||||
<template>
|
||||
<div style="display: flex; justify-content: space-between"> </div>
|
||||
</template>
|
||||
|
||||
<script lang="ts" setup>
|
||||
import { 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 searchText = ref('');
|
||||
// 所在城市
|
||||
const city = ref<string[]>([]);
|
||||
|
||||
/* 搜索 */
|
||||
const search = () => {
|
||||
emit('search', {
|
||||
...where
|
||||
});
|
||||
};
|
||||
|
||||
// 导出
|
||||
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 handleSearch = () => {
|
||||
console.log(where);
|
||||
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>
|
||||
305
src/views/system/company/renew/index.vue
Normal file
305
src/views/system/company/renew/index.vue
Normal file
@@ -0,0 +1,305 @@
|
||||
<template>
|
||||
<div class="page">
|
||||
<div class="ele-body">
|
||||
<a-card :bordered="false">
|
||||
<!-- 表格 -->
|
||||
<ele-pro-table
|
||||
ref="tableRef"
|
||||
row-key="companyId"
|
||||
:columns="columns"
|
||||
:datasource="datasource"
|
||||
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 === 'companyLogo'">
|
||||
<div class="company-box">
|
||||
<a-image
|
||||
:height="45"
|
||||
:width="45"
|
||||
:preview="false"
|
||||
:src="record.companyLogo"
|
||||
fallback="https://file.wsdns.cn/20230218/550e610d43334dd2a7f66d5b20bd58eb.svg"
|
||||
/>
|
||||
</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'">
|
||||
<div>{{ toDateString(record.createTime, 'yyyy-MM-dd') }}</div>
|
||||
<div>{{ toDateString(record.expirationTime, 'yyyy-MM-dd') }}</div>
|
||||
<div
|
||||
v-if="expirationTime(record.expirationTime) < 0"
|
||||
class="ele-text-placeholder"
|
||||
>
|
||||
{{ expirationTimeText(record) }}
|
||||
</div>
|
||||
<div
|
||||
v-if="
|
||||
expirationTime(record.expirationTime) > 0 &&
|
||||
expirationTime(record.expirationTime) < 30
|
||||
"
|
||||
class="ele-text-warning"
|
||||
>
|
||||
{{ expirationTimeText(record) }}
|
||||
</div>
|
||||
</template>
|
||||
<template v-if="column.key === 'version'">
|
||||
<a-tag v-if="record.version == 10">体验版</a-tag>
|
||||
<a-tag color="success" v-if="record.version == 20">授权版</a-tag>
|
||||
<a-tag color="cyan" v-if="record.version == 30">永久授权</a-tag>
|
||||
</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 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 { removeBatchCompany, removeCompany } from '@/api/oa/company';
|
||||
import { Company, CompanyParam } from '@/api/oa/company/model';
|
||||
import { toDateString } from 'ele-admin-pro';
|
||||
import { pageCompanyAll, updateCompany } from '@/api/system/company';
|
||||
|
||||
defineProps<{
|
||||
activeKey?: boolean;
|
||||
data?: any;
|
||||
}>();
|
||||
|
||||
// 表格实例
|
||||
const tableRef = ref<InstanceType<typeof EleProTable> | null>(null);
|
||||
|
||||
// 表格列配置
|
||||
const columns = ref<ColumnItem[]>([
|
||||
{
|
||||
title: '租户ID',
|
||||
dataIndex: 'tenantId',
|
||||
width: 90
|
||||
},
|
||||
{
|
||||
title: 'Logo',
|
||||
dataIndex: 'companyLogo',
|
||||
key: 'companyLogo',
|
||||
width: 90
|
||||
},
|
||||
{
|
||||
title: '简称',
|
||||
dataIndex: 'shortName',
|
||||
key: 'shortName'
|
||||
},
|
||||
{
|
||||
title: '企业全称',
|
||||
dataIndex: 'companyName',
|
||||
key: 'companyName'
|
||||
},
|
||||
{
|
||||
title: '手机号码',
|
||||
dataIndex: 'phone',
|
||||
key: 'phone',
|
||||
width: 120
|
||||
},
|
||||
{
|
||||
title: '到期时间',
|
||||
dataIndex: 'expirationTime',
|
||||
key: 'expirationTime',
|
||||
align: 'center',
|
||||
width: 200,
|
||||
sorter: true,
|
||||
customRender: ({ text }) => toDateString(text, 'yyyy-MM-dd')
|
||||
},
|
||||
{
|
||||
title: '版本',
|
||||
dataIndex: 'version',
|
||||
align: 'center',
|
||||
width: 120,
|
||||
key: 'version'
|
||||
}
|
||||
]);
|
||||
|
||||
// 表格选中数据
|
||||
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;
|
||||
}
|
||||
where.sort = 'expirationTime';
|
||||
where.order = 'asc';
|
||||
where.status = 0;
|
||||
return pageCompanyAll({
|
||||
...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 expirationTimeText = (item: any) => {
|
||||
const now = new Date().getTime();
|
||||
const expiration = new Date(item.expirationTime).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);
|
||||
if (item.version == 30) {
|
||||
return `永久授权`;
|
||||
}
|
||||
if (days < 0) {
|
||||
// item.status = 1;
|
||||
// updateCompany(item);
|
||||
return `(已过期${Math.abs(days)}天)`;
|
||||
}
|
||||
if (days < 30) {
|
||||
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);
|
||||
});
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
/* 自定义行属性 */
|
||||
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>
|
||||
@@ -10,7 +10,6 @@
|
||||
@update:visible="updateVisible"
|
||||
@ok="save"
|
||||
>
|
||||
{{ form }}
|
||||
<a-form
|
||||
ref="formRef"
|
||||
:model="form"
|
||||
@@ -53,30 +52,36 @@
|
||||
/>
|
||||
</a-form-item>
|
||||
<a-form-item label="设置APIv3密钥" name="apiKey">
|
||||
<a-input
|
||||
<a-input-password
|
||||
allow-clear
|
||||
placeholder="请输入设置APIv3密钥"
|
||||
v-model:value="form.apiKey"
|
||||
/>
|
||||
</a-form-item>
|
||||
<a-form-item label="证书文件 (CERT)" name="apiclientCert" extra="请上传 apiclient_cert.pem 文件">
|
||||
<Upload accept=".crt" v-model:value="form.apiclientCert" />
|
||||
{{ form.apiclientCert }}
|
||||
</a-form-item>
|
||||
<a-form-item label="证书文件 (KEY)" name="apiclientKey" extra="请上传 apiclient_key.pem 文件">
|
||||
<Upload accept=".crt" v-model:value="form.apiclientKey" />
|
||||
{{ form.apiclientKey }}
|
||||
</a-form-item>
|
||||
<a-form-item label="商户证书序列号" name="merchantSerialNumber">
|
||||
<a-form-item label="证书文件 (CERT)" name="apiclientCert" extra="请上传 apiclient_cert.pem 文件">
|
||||
<Upload accept=".crt" v-model:value="form.apiclientCert" />
|
||||
{{ form.apiclientCert }}
|
||||
</a-form-item>
|
||||
<a-form-item label="商户证书序列号" name="merchantSerialNumber" extra="填写API证书里的证书序列号">
|
||||
<a-input
|
||||
allow-clear
|
||||
placeholder="请输入商户证书序列号"
|
||||
v-model:value="form.merchantSerialNumber"
|
||||
/>
|
||||
</a-form-item>
|
||||
<a-form-item label="支付通知(选填)" name="notifyUrl" extra="留空则推送到系统预留的默认地址">
|
||||
<a-input
|
||||
allow-clear
|
||||
placeholder="请输入支付结果通知地址"
|
||||
v-model:value="form.notifyUrl"
|
||||
/>
|
||||
</a-form-item>
|
||||
</template>
|
||||
|
||||
<a-form-item label="支付图标" name="image">
|
||||
<a-form-item label="图标" name="image">
|
||||
<SelectFile
|
||||
:placeholder="`请选择图片`"
|
||||
:limit="1"
|
||||
@@ -163,6 +168,7 @@
|
||||
apiclientCert: '',
|
||||
apiclientKey: '',
|
||||
merchantSerialNumber: '',
|
||||
notifyUrl: 'https://server.gxwebsoft.com/api/system/wx-pay/notify',
|
||||
comments: '',
|
||||
sortNumber: 0,
|
||||
status: undefined,
|
||||
@@ -217,22 +223,22 @@
|
||||
trigger: 'blur'
|
||||
}
|
||||
],
|
||||
// apiclientCert: [
|
||||
// {
|
||||
// required: true,
|
||||
// type: 'string',
|
||||
// message: '请上传证书文件(CERT)',
|
||||
// trigger: 'blur'
|
||||
// }
|
||||
// ],
|
||||
// apiclientKey: [
|
||||
// {
|
||||
// required: true,
|
||||
// type: 'string',
|
||||
// message: '请上传证书文件(KEY)',
|
||||
// trigger: 'blur'
|
||||
// }
|
||||
// ],
|
||||
apiclientCert: [
|
||||
{
|
||||
required: true,
|
||||
type: 'string',
|
||||
message: '请上传证书文件(CERT)',
|
||||
trigger: 'blur'
|
||||
}
|
||||
],
|
||||
apiclientKey: [
|
||||
{
|
||||
required: true,
|
||||
type: 'string',
|
||||
message: '请上传证书文件(KEY)',
|
||||
trigger: 'blur'
|
||||
}
|
||||
],
|
||||
merchantSerialNumber: [
|
||||
{
|
||||
required: true,
|
||||
@@ -244,7 +250,6 @@
|
||||
});
|
||||
|
||||
const chooseImage = (data: FileRecord) => {
|
||||
console.log(data);
|
||||
images.value.push({
|
||||
uid: data.id,
|
||||
url: data.thumbnail,
|
||||
|
||||
@@ -32,7 +32,7 @@
|
||||
<!-- />-->
|
||||
</a-form-item>
|
||||
<a-form-item label="应用名称">
|
||||
<a-space class="justify">
|
||||
<a-space class="justify ele-text-secondary">
|
||||
<span>{{ form.shortName }}</span>
|
||||
<a @click="onEdit('应用名称', 'shortName', form.shortName)"
|
||||
>修改</a
|
||||
@@ -40,22 +40,21 @@
|
||||
</a-space>
|
||||
</a-form-item>
|
||||
<a-form-item label="应用描述">
|
||||
<a-space class="justify">
|
||||
<a-space class="justify ele-text-secondary">
|
||||
<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">
|
||||
<span>Tenant</span>
|
||||
<a @click="onEdit('应用类型', 'appType', form.appType)">修改</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" color="orange">开发中</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>
|
||||
@@ -66,127 +65,121 @@
|
||||
<a-tag color="cyan" v-if="form.version === 30">永久授权</a-tag>
|
||||
</a-space>
|
||||
</a-form-item>
|
||||
<a-form-item label="当前版本号">
|
||||
<a-space class="justify">
|
||||
<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>{{ form.createTime }}</span>
|
||||
<span class="ele-text-secondary">{{ form.createTime }}</span>
|
||||
</a-form-item>
|
||||
<a-form-item label="到期时间" v-if="form.version != 30">
|
||||
<span>{{ form.expirationTime }}</span>
|
||||
<span class="ele-text-secondary">{{ form.expirationTime }}</span>
|
||||
</a-form-item>
|
||||
<a-divider style="padding-bottom: 20px" />
|
||||
<a-form-item label="主体名称">
|
||||
<a-space class="justify">
|
||||
<div>
|
||||
<div class="ele-text-secondary">
|
||||
<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>
|
||||
</div>
|
||||
<a @click="onEdit('公司名称', 'companyName', form.companyName)"
|
||||
>修改</a
|
||||
>
|
||||
</a-space>
|
||||
</a-form-item>
|
||||
<a-form-item label="主体类型">
|
||||
<a-space class="justify">
|
||||
<a-tag>{{ form.companyType }}</a-tag>
|
||||
<a @click="onEdit('主体类型', 'companyType', form.companyType)">修改</a>
|
||||
<span class="ele-text-secondary">{{ form.companyType }}</span>
|
||||
</a-space>
|
||||
</a-form-item>
|
||||
<a-form-item label="行业类型">
|
||||
<a-space class="justify">
|
||||
<a-space class="justify ele-text-secondary">
|
||||
<span>{{ form.industryParent }} {{ form.industryChild ? form.industryChild : '-' }}</span>
|
||||
<a @click="onEdit('行业类型', 'industryParent', form.industryParent)"
|
||||
>修改</a
|
||||
>
|
||||
</a-space>
|
||||
</a-form-item>
|
||||
<a-form-item label="所属地区">
|
||||
<a-space class="justify">
|
||||
<a-space class="justify ele-text-secondary">
|
||||
<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">
|
||||
<a-space class="justify ele-text-secondary">
|
||||
<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">
|
||||
<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">
|
||||
<span>{{ form.phone }}</span>
|
||||
</a-space>
|
||||
</a-form-item>
|
||||
<a-form-item label="电子邮箱">
|
||||
<a-space class="justify">
|
||||
<span>{{ form.email }}</span>
|
||||
</a-space>
|
||||
</a-form-item>
|
||||
<!-- <a-form-item label="企业域名">-->
|
||||
<!-- <a-space class="justify ele-text-secondary">-->
|
||||
<!-- <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">-->
|
||||
<!-- <span>{{ form.phone }}</span>-->
|
||||
<!-- </a-space>-->
|
||||
<!-- </a-form-item>-->
|
||||
<!-- <a-form-item label="电子邮箱">-->
|
||||
<!-- <a-space class="justify ele-text-secondary">-->
|
||||
<!-- <span>{{ form.email }}</span>-->
|
||||
<!-- </a-space>-->
|
||||
<!-- </a-form-item>-->
|
||||
<a-divider style="padding-bottom: 20px" />
|
||||
<a-form-item label="用户数量">
|
||||
<a-space class="justify">
|
||||
<a-space class="justify ele-text-secondary">
|
||||
<span>{{ form.users }}</span>
|
||||
<a>更新</a>
|
||||
</a-space>
|
||||
</a-form-item>
|
||||
<a-form-item label="部门数量">
|
||||
<a-space class="justify">
|
||||
<a-space class="justify ele-text-secondary">
|
||||
<span>{{ form.departments }}</span>
|
||||
</a-space>
|
||||
</a-form-item>
|
||||
<a-form-item label="存储空间">
|
||||
<a-space class="justify">
|
||||
<span>{{ getFileSize(form.storage) }}/{{
|
||||
getFileSize(form.storageMax)
|
||||
}}</span>
|
||||
<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="tenantId">
|
||||
<span>{{ form.tenantId }}</span>
|
||||
<a-form-item label="租户ID">
|
||||
<span class="ele-text-secondary">{{ form.tenantId }}</span>
|
||||
</a-form-item>
|
||||
<a-form-item label="企业编号">
|
||||
<span>{{ form.tenantCode }}</span>
|
||||
<a-form-item label="租户编号">
|
||||
<span class="ele-text-secondary">{{ form.tenantCode }}</span>
|
||||
</a-form-item>
|
||||
<a-form-item label="request合法域名">
|
||||
<a-space class="justify">
|
||||
<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">
|
||||
<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">
|
||||
<span>{{ form.modulesUrl ? form.modulesUrl : '-' }}</span>
|
||||
<a @click="onEdit('业务域名', 'modulesUrl', form.modulesUrl)">修改</a>
|
||||
</a-space>
|
||||
<a-form-item label="模版ID" v-if="form.planId > 0">
|
||||
<span class="ele-text-heading ele-text-secondary">{{ form.planId }}</span>
|
||||
</a-form-item>
|
||||
<!-- <a-form-item label="request合法域名">-->
|
||||
<!-- <a-space class="justify ele-text-secondary">-->
|
||||
<!-- <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">-->
|
||||
<!-- <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">-->
|
||||
<!-- <span>{{ form.modulesUrl ? form.modulesUrl : '-' }}</span>-->
|
||||
<!-- <a @click="onEdit('业务域名', 'modulesUrl', form.modulesUrl)">修改</a>-->
|
||||
<!-- </a-space>-->
|
||||
<!-- </a-form-item>-->
|
||||
<a-divider style="padding-bottom: 20px" />
|
||||
<a-form-item
|
||||
v-if="form.tenantId"
|
||||
label="注销"
|
||||
extra="注销后,当前应用的数据将会销毁,且不可恢复,请谨慎操作"
|
||||
>
|
||||
<a-button @click="destruction(form.tenantId)">注销</a-button>
|
||||
<a-button @click="destruction(form.tenantId)" :disabled="true">注销</a-button>
|
||||
<div class="ele-text-placeholder">注销后,当前应用的数据将会销毁,且不可恢复,请谨慎操作</div>
|
||||
</a-form-item>
|
||||
</a-form>
|
||||
</a-tab-pane>
|
||||
@@ -272,6 +265,8 @@ import {FileRecord} from "@/api/system/file/model";
|
||||
startTime: '',
|
||||
expirationTime: '',
|
||||
appType: undefined,
|
||||
planId: 0,
|
||||
businessEntity: '',
|
||||
version: undefined,
|
||||
versionName: '',
|
||||
versionCode: '',
|
||||
|
||||
@@ -11,9 +11,9 @@
|
||||
<a-tab-pane tab="短信设置" key="sms">
|
||||
<Sms v-model:value="active" :data="data" />
|
||||
</a-tab-pane>
|
||||
<a-tab-pane tab="支付设置" key="payment">
|
||||
<Payment :value="active" :data="data" />
|
||||
</a-tab-pane>
|
||||
<!-- <a-tab-pane tab="支付设置" key="payment">-->
|
||||
<!-- <Payment :value="active" :data="data" />-->
|
||||
<!-- </a-tab-pane>-->
|
||||
<a-tab-pane tab="注册设置" key="register">
|
||||
<Register :value="active" :data="data" />
|
||||
</a-tab-pane>
|
||||
@@ -45,14 +45,14 @@
|
||||
import WxWork from './components/wx-work.vue';
|
||||
import WxOfficial from './components/wx-official.vue';
|
||||
import MpWeixin from './components/mp-weixin.vue';
|
||||
import Payment from './components/payment.vue';
|
||||
// import Payment from './components/payment.vue';
|
||||
import Sms from './components/sms.vue';
|
||||
import Printer from './components/printer.vue';
|
||||
import Clear from './components/clear.vue';
|
||||
import { listSetting } from '@/api/system/setting';
|
||||
|
||||
// tab页选中
|
||||
const active = ref('payment');
|
||||
const active = ref('upload');
|
||||
|
||||
const data = ref<Setting>();
|
||||
|
||||
|
||||
39
src/views/system/user/components/org-select.vue
Normal file
39
src/views/system/user/components/org-select.vue
Normal file
@@ -0,0 +1,39 @@
|
||||
<!-- 机构选择下拉框 -->
|
||||
<template>
|
||||
<a-tree-select
|
||||
allow-clear
|
||||
tree-default-expand-all
|
||||
:placeholder="placeholder"
|
||||
:value="value || undefined"
|
||||
:tree-data="data"
|
||||
:dropdown-style="{ maxHeight: '360px', overflow: 'auto' }"
|
||||
@update:value="updateValue"
|
||||
/>
|
||||
</template>
|
||||
|
||||
<script lang="ts" setup>
|
||||
import type { Organization } from '@/api/system/organization/model';
|
||||
|
||||
const emit = defineEmits<{
|
||||
(e: 'update:value', value?: number): void;
|
||||
}>();
|
||||
|
||||
withDefaults(
|
||||
defineProps<{
|
||||
// 选中的数据(v-modal)
|
||||
value?: number;
|
||||
// 提示信息
|
||||
placeholder?: string;
|
||||
// 机构数据
|
||||
data: Organization[];
|
||||
}>(),
|
||||
{
|
||||
placeholder: '请选择角色'
|
||||
}
|
||||
);
|
||||
|
||||
/* 更新选中数据 */
|
||||
const updateValue = (value?: number) => {
|
||||
emit('update:value', value);
|
||||
};
|
||||
</script>
|
||||
71
src/views/system/user/components/role-select.vue
Normal file
71
src/views/system/user/components/role-select.vue
Normal file
@@ -0,0 +1,71 @@
|
||||
<!-- 角色选择下拉框 -->
|
||||
<template>
|
||||
<a-select
|
||||
allow-clear
|
||||
mode="multiple"
|
||||
:value="roleIds"
|
||||
:placeholder="placeholder"
|
||||
@update:value="updateValue"
|
||||
@blur="onBlur"
|
||||
>
|
||||
<a-select-option
|
||||
v-for="item in data"
|
||||
:key="item.roleId"
|
||||
:value="item.roleId"
|
||||
>
|
||||
{{ item.roleName }}
|
||||
</a-select-option>
|
||||
</a-select>
|
||||
</template>
|
||||
|
||||
<script lang="ts" setup>
|
||||
import { ref, computed } from 'vue';
|
||||
import { message } from 'ant-design-vue/es';
|
||||
import { listRoles } from '@/api/system/role';
|
||||
import type { Role } from '@/api/system/role/model';
|
||||
|
||||
const emit = defineEmits<{
|
||||
(e: 'update:value', value: Role[]): void;
|
||||
(e: 'blur'): void;
|
||||
}>();
|
||||
|
||||
const props = withDefaults(
|
||||
defineProps<{
|
||||
// 选中的角色
|
||||
value?: Role[];
|
||||
//
|
||||
placeholder?: string;
|
||||
}>(),
|
||||
{
|
||||
placeholder: '请选择角色'
|
||||
}
|
||||
);
|
||||
|
||||
// 选中的角色id
|
||||
const roleIds = computed(() => props.value?.map((d) => d.roleId as number));
|
||||
|
||||
// 角色数据
|
||||
const data = ref<Role[]>([]);
|
||||
|
||||
/* 更新选中数据 */
|
||||
const updateValue = (value: number[]) => {
|
||||
emit(
|
||||
'update:value',
|
||||
value.map((v) => ({ roleId: v }))
|
||||
);
|
||||
};
|
||||
|
||||
/* 获取角色数据 */
|
||||
listRoles()
|
||||
.then((list) => {
|
||||
data.value = list;
|
||||
})
|
||||
.catch((e) => {
|
||||
message.error(e.message);
|
||||
});
|
||||
|
||||
/* 失去焦点 */
|
||||
const onBlur = () => {
|
||||
emit('blur');
|
||||
};
|
||||
</script>
|
||||
45
src/views/system/user/components/sex-select.vue
Normal file
45
src/views/system/user/components/sex-select.vue
Normal file
@@ -0,0 +1,45 @@
|
||||
<!-- 角色选择下拉框 -->
|
||||
<template>
|
||||
<a-select
|
||||
show-search
|
||||
optionFilterProp="label"
|
||||
:options="data"
|
||||
allow-clear
|
||||
:value="value"
|
||||
:placeholder="placeholder"
|
||||
@update:value="updateValue"
|
||||
@blur="onBlur"
|
||||
/>
|
||||
</template>
|
||||
|
||||
<script lang="ts" setup>
|
||||
import { getDictionaryOptions } from '@/utils/common';
|
||||
|
||||
const emit = defineEmits<{
|
||||
(e: 'update:value', value: string): void;
|
||||
(e: 'blur'): void;
|
||||
}>();
|
||||
|
||||
withDefaults(
|
||||
defineProps<{
|
||||
value?: string;
|
||||
placeholder?: string;
|
||||
}>(),
|
||||
{
|
||||
placeholder: '请选择性别'
|
||||
}
|
||||
);
|
||||
|
||||
// 字典数据
|
||||
const data = getDictionaryOptions('sex');
|
||||
|
||||
/* 更新选中数据 */
|
||||
const updateValue = (value: string) => {
|
||||
emit('update:value', value);
|
||||
};
|
||||
|
||||
/* 失去焦点 */
|
||||
const onBlur = () => {
|
||||
emit('blur');
|
||||
};
|
||||
</script>
|
||||
351
src/views/system/user/components/user-edit.vue
Normal file
351
src/views/system/user/components/user-edit.vue
Normal file
@@ -0,0 +1,351 @@
|
||||
<!-- 用户编辑弹窗 -->
|
||||
<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: 5, sm: 4, xs: 24 } : { flex: '90px' }"
|
||||
:wrapper-col="
|
||||
styleResponsive ? { md: 17, 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="username">
|
||||
<a-input
|
||||
allow-clear
|
||||
:maxlength="20"
|
||||
placeholder="请输入账号"
|
||||
:disabled="isUpdate"
|
||||
v-model:value="form.username"
|
||||
/>
|
||||
</a-form-item>
|
||||
<a-form-item label="昵称" name="nickname">
|
||||
<a-input
|
||||
allow-clear
|
||||
:maxlength="20"
|
||||
placeholder="请输入昵称"
|
||||
v-model:value="form.nickname"
|
||||
/>
|
||||
</a-form-item>
|
||||
<a-form-item label="角色" name="roles">
|
||||
<role-select v-model:value="form.roles" />
|
||||
</a-form-item>
|
||||
<a-form-item label="会员等级">
|
||||
<SelectGrade
|
||||
:placeholder="`请选择会员等级`"
|
||||
v-model:value="form.gradeName"
|
||||
:disabled="isUpdate"
|
||||
@done="chooseGradeId"
|
||||
/>
|
||||
</a-form-item>
|
||||
<a-form-item label="性别" name="sex">
|
||||
<sex-select v-model:value="form.sex" />
|
||||
</a-form-item>
|
||||
<a-form-item label="姓名" name="realName">
|
||||
<a-input
|
||||
allow-clear
|
||||
:maxlength="20"
|
||||
placeholder="请输入真实姓名"
|
||||
v-model:value="form.realName"
|
||||
/>
|
||||
</a-form-item>
|
||||
<a-form-item label="所属机构" name="type">
|
||||
<org-select
|
||||
:data="organizationList"
|
||||
placeholder="请选择所属机构"
|
||||
v-model:value="form.organizationId"
|
||||
/>
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
<a-col
|
||||
v-bind="styleResponsive ? { md: 12, sm: 24, xs: 24 } : { span: 12 }"
|
||||
>
|
||||
<a-form-item label="手机号" v-if="isUpdate" name="mobile">
|
||||
<a-input
|
||||
allow-clear
|
||||
:maxlength="11"
|
||||
placeholder="请输入手机号"
|
||||
v-model:value="form.mobile"
|
||||
disabled
|
||||
/>
|
||||
</a-form-item>
|
||||
<a-form-item label="手机号" v-else name="phone">
|
||||
<a-input
|
||||
allow-clear
|
||||
:maxlength="11"
|
||||
placeholder="请输入手机号"
|
||||
v-model:value="form.phone"
|
||||
/>
|
||||
</a-form-item>
|
||||
<a-form-item label="邮箱" name="email">
|
||||
<a-input
|
||||
allow-clear
|
||||
:maxlength="100"
|
||||
placeholder="请输入邮箱"
|
||||
v-model:value="form.email"
|
||||
/>
|
||||
</a-form-item>
|
||||
<a-form-item label="出生日期">
|
||||
<a-date-picker
|
||||
class="ele-fluid"
|
||||
value-format="YYYY-MM-DD"
|
||||
placeholder="请选择出生日期"
|
||||
v-model:value="form.birthday"
|
||||
/>
|
||||
</a-form-item>
|
||||
<a-form-item v-if="!isUpdate" label="登录密码" name="password">
|
||||
<a-input-password
|
||||
:maxlength="20"
|
||||
v-model:value="form.password"
|
||||
placeholder="请输入登录密码"
|
||||
/>
|
||||
</a-form-item>
|
||||
<a-form-item label="个人简介">
|
||||
<a-textarea
|
||||
:rows="4"
|
||||
:maxlength="200"
|
||||
placeholder="请输入个人简介"
|
||||
v-model:value="form.introduction"
|
||||
/>
|
||||
</a-form-item>
|
||||
<a-form-item label="管理员">
|
||||
<a-switch
|
||||
checked-children="是"
|
||||
un-checked-children="否"
|
||||
:checked="form.isAdmin == 1"
|
||||
@update:checked="updateIsAdmin"
|
||||
/>
|
||||
</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 { emailReg, phoneReg } from 'ele-admin-pro/es';
|
||||
import { storeToRefs } from 'pinia';
|
||||
import { useThemeStore } from '@/store/modules/theme';
|
||||
import useFormData from '@/utils/use-form-data';
|
||||
import RoleSelect from './role-select.vue';
|
||||
import SexSelect from './sex-select.vue';
|
||||
import { addUser, updateUser, checkExistence } from '@/api/system/user';
|
||||
import type { User } from '@/api/system/user/model';
|
||||
import OrgSelect from './org-select.vue';
|
||||
// import { getDictionaryOptions } from '@/utils/common';
|
||||
import { Organization } from '@/api/system/organization/model';
|
||||
import { Grade } from '@/api/user/grade/model';
|
||||
|
||||
// 是否开启响应式布局
|
||||
const themeStore = useThemeStore();
|
||||
const { styleResponsive } = storeToRefs(themeStore);
|
||||
// 获取字典数据
|
||||
// const userTypeData = getDictionaryOptions('userType');
|
||||
const emit = defineEmits<{
|
||||
(e: 'done'): void;
|
||||
(e: 'update:visible', visible: boolean): void;
|
||||
}>();
|
||||
|
||||
const props = defineProps<{
|
||||
// 弹窗是否打开
|
||||
visible: boolean;
|
||||
// 修改回显的数据
|
||||
data?: User | null;
|
||||
// 全部机构
|
||||
organizationList: Organization[];
|
||||
}>();
|
||||
|
||||
//
|
||||
const formRef = ref<FormInstance | null>(null);
|
||||
|
||||
// 是否是修改
|
||||
const isUpdate = ref(false);
|
||||
|
||||
// 提交状态
|
||||
const loading = ref(false);
|
||||
|
||||
// 表单数据
|
||||
const { form, resetFields, assignFields } = useFormData<User>({
|
||||
type: undefined,
|
||||
userId: undefined,
|
||||
username: '',
|
||||
nickname: '',
|
||||
realName: '',
|
||||
companyName: '',
|
||||
sex: undefined,
|
||||
roles: [],
|
||||
email: '',
|
||||
phone: '',
|
||||
mobile: '',
|
||||
password: '',
|
||||
introduction: '',
|
||||
organizationId: undefined,
|
||||
birthday: '',
|
||||
idCard: '',
|
||||
comments: '',
|
||||
gradeName: '',
|
||||
isAdmin: undefined,
|
||||
gradeId: undefined
|
||||
});
|
||||
|
||||
// 表单验证规则
|
||||
const rules = reactive<Record<string, Rule[]>>({
|
||||
username: [
|
||||
{
|
||||
required: true,
|
||||
type: 'string',
|
||||
validator: (_rule: Rule, value: string) => {
|
||||
return new Promise<void>((resolve, reject) => {
|
||||
if (!value) {
|
||||
return reject('请输入用户账号');
|
||||
}
|
||||
checkExistence('username', value, props.data?.userId)
|
||||
.then(() => {
|
||||
reject('账号已经存在');
|
||||
})
|
||||
.catch(() => {
|
||||
resolve();
|
||||
});
|
||||
});
|
||||
},
|
||||
trigger: 'blur'
|
||||
}
|
||||
],
|
||||
nickname: [
|
||||
{
|
||||
required: true,
|
||||
message: '请输入昵称',
|
||||
type: 'string',
|
||||
trigger: 'blur'
|
||||
}
|
||||
],
|
||||
// realName: [
|
||||
// {
|
||||
// required: true,
|
||||
// message: '请输入真实姓名',
|
||||
// type: 'string',
|
||||
// trigger: 'blur'
|
||||
// }
|
||||
// ],
|
||||
// sex: [
|
||||
// {
|
||||
// required: true,
|
||||
// message: '请选择性别',
|
||||
// type: 'string',
|
||||
// trigger: 'blur'
|
||||
// }
|
||||
// ],
|
||||
roles: [
|
||||
{
|
||||
required: true,
|
||||
message: '请选择角色',
|
||||
type: 'array',
|
||||
trigger: 'blur'
|
||||
}
|
||||
],
|
||||
email: [
|
||||
{
|
||||
pattern: emailReg,
|
||||
message: '邮箱格式不正确',
|
||||
type: 'string',
|
||||
trigger: 'blur'
|
||||
}
|
||||
],
|
||||
password: [
|
||||
{
|
||||
required: true,
|
||||
type: 'string',
|
||||
validator: async (_rule: Rule, value: string) => {
|
||||
if (isUpdate.value || /^[\S]{5,18}$/.test(value)) {
|
||||
return Promise.resolve();
|
||||
}
|
||||
return Promise.reject('密码必须为5-18位非空白字符');
|
||||
},
|
||||
trigger: 'blur'
|
||||
}
|
||||
],
|
||||
phone: [
|
||||
{
|
||||
required: true,
|
||||
pattern: phoneReg,
|
||||
message: '手机号格式不正确',
|
||||
type: 'string',
|
||||
trigger: 'blur'
|
||||
}
|
||||
]
|
||||
});
|
||||
|
||||
const chooseGradeId = (data: Grade) => {
|
||||
form.gradeName = data.name;
|
||||
form.gradeId = data.gradeId;
|
||||
};
|
||||
|
||||
const updateIsAdmin = (value: boolean) => {
|
||||
form.isAdmin = value ? 1 : 0;
|
||||
};
|
||||
|
||||
/* 保存编辑 */
|
||||
const save = () => {
|
||||
if (!formRef.value) {
|
||||
return;
|
||||
}
|
||||
formRef.value
|
||||
.validate()
|
||||
.then(() => {
|
||||
loading.value = true;
|
||||
const saveOrUpdate = isUpdate.value ? updateUser : addUser;
|
||||
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,
|
||||
password: ''
|
||||
});
|
||||
isUpdate.value = true;
|
||||
} else {
|
||||
isUpdate.value = false;
|
||||
}
|
||||
} else {
|
||||
resetFields();
|
||||
formRef.value?.clearValidate();
|
||||
}
|
||||
}
|
||||
);
|
||||
</script>
|
||||
88
src/views/system/user/components/user-import.vue
Normal file
88
src/views/system/user/components/user-import.vue
Normal file
@@ -0,0 +1,88 @@
|
||||
<!-- 用户导入弹窗 -->
|
||||
<template>
|
||||
<ele-modal
|
||||
:width="520"
|
||||
:footer="null"
|
||||
title="导入用户"
|
||||
:visible="visible"
|
||||
@update:visible="updateVisible"
|
||||
>
|
||||
<a-spin :spinning="loading">
|
||||
<a-upload-dragger
|
||||
accept=".xls,.xlsx"
|
||||
:show-upload-list="false"
|
||||
:customRequest="doUpload"
|
||||
style="padding: 24px 0; margin-bottom: 16px"
|
||||
>
|
||||
<p class="ant-upload-drag-icon">
|
||||
<cloud-upload-outlined />
|
||||
</p>
|
||||
<p class="ant-upload-hint">将文件拖到此处,或点击上传</p>
|
||||
</a-upload-dragger>
|
||||
</a-spin>
|
||||
<div class="ele-text-center">
|
||||
<span>只能上传xls、xlsx文件,</span>
|
||||
<a
|
||||
href="https://cdn.eleadmin.com/20200610/用户导入模板.xlsx"
|
||||
download="用户导入模板.xlsx"
|
||||
>
|
||||
下载模板
|
||||
</a>
|
||||
</div>
|
||||
</ele-modal>
|
||||
</template>
|
||||
|
||||
<script lang="ts" setup>
|
||||
import { ref } from 'vue';
|
||||
import { message } from 'ant-design-vue/es';
|
||||
import { CloudUploadOutlined } from '@ant-design/icons-vue';
|
||||
import { importUsers } from '@/api/system/user';
|
||||
|
||||
const emit = defineEmits<{
|
||||
(e: 'done'): void;
|
||||
(e: 'update:visible', visible: boolean): void;
|
||||
}>();
|
||||
|
||||
defineProps<{
|
||||
// 是否打开弹窗
|
||||
visible: boolean;
|
||||
}>();
|
||||
|
||||
// 导入请求状态
|
||||
const loading = ref(false);
|
||||
|
||||
/* 上传 */
|
||||
const doUpload = ({ file }) => {
|
||||
if (
|
||||
![
|
||||
'application/vnd.ms-excel',
|
||||
'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet'
|
||||
].includes(file.type)
|
||||
) {
|
||||
message.error('只能选择 excel 文件');
|
||||
return false;
|
||||
}
|
||||
if (file.size / 1024 / 1024 > 10) {
|
||||
message.error('大小不能超过 10MB');
|
||||
return false;
|
||||
}
|
||||
loading.value = true;
|
||||
importUsers(file)
|
||||
.then((msg) => {
|
||||
loading.value = false;
|
||||
message.success(msg);
|
||||
updateVisible(false);
|
||||
emit('done');
|
||||
})
|
||||
.catch((e) => {
|
||||
loading.value = false;
|
||||
message.error(e.message);
|
||||
});
|
||||
return false;
|
||||
};
|
||||
|
||||
/* 更新 visible */
|
||||
const updateVisible = (value: boolean) => {
|
||||
emit('update:visible', value);
|
||||
};
|
||||
</script>
|
||||
143
src/views/system/user/components/user-info.vue
Normal file
143
src/views/system/user/components/user-info.vue
Normal file
@@ -0,0 +1,143 @@
|
||||
<!-- 用户编辑弹窗 -->
|
||||
<template>
|
||||
<a-drawer
|
||||
:width="680"
|
||||
:visible="visible"
|
||||
:confirm-loading="loading"
|
||||
:title="'基本信息'"
|
||||
:body-style="{ paddingBottom: '8px' }"
|
||||
@update:visible="updateVisible"
|
||||
:footer="null"
|
||||
>
|
||||
<a-form
|
||||
:label-col="{ md: { span: 6 }, sm: { span: 24 } }"
|
||||
:wrapper-col="{ md: { span: 19 }, sm: { span: 24 } }"
|
||||
>
|
||||
<a-row :gutter="16">
|
||||
<a-col
|
||||
v-bind="styleResponsive ? { md: 12, sm: 24, xs: 24 } : { span: 12 }"
|
||||
>
|
||||
<a-form-item label="账号">
|
||||
<span class="ele-text">{{ user.username }}</span>
|
||||
</a-form-item>
|
||||
<a-form-item label="昵称">
|
||||
<span class="ele-text">{{ user.nickname }}</span>
|
||||
</a-form-item>
|
||||
<a-form-item label="性别">
|
||||
<span class="ele-text">{{ user.sexName }}</span>
|
||||
</a-form-item>
|
||||
<a-form-item label="手机号">
|
||||
<span class="ele-text">{{ user.phone }}</span>
|
||||
</a-form-item>
|
||||
<a-form-item label="角色">
|
||||
<a-tag v-for="item in user.roles" :key="item.roleId" color="blue">
|
||||
{{ item.roleName }}
|
||||
</a-tag>
|
||||
</a-form-item>
|
||||
<a-form-item label="状态">
|
||||
<a-badge
|
||||
v-if="typeof user.status === 'number'"
|
||||
:status="(['processing', 'error'][user.status] as any)"
|
||||
:text="['正常', '冻结'][user.status]"
|
||||
/>
|
||||
</a-form-item>
|
||||
<a-form-item label="地址">
|
||||
<span class="ele-text">{{ user.address }}</span>
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
<a-col
|
||||
v-bind="styleResponsive ? { md: 12, sm: 24, xs: 24 } : { span: 12 }"
|
||||
>
|
||||
<a-form-item label="可用余额">
|
||||
<span class="ele-text-success">¥{{ formatNumber(user.balance) }}</span>
|
||||
</a-form-item>
|
||||
<a-form-item label="可用积分">
|
||||
<span class="ele-text">{{ user.points }}</span>
|
||||
</a-form-item>
|
||||
<a-form-item label="实际消费">
|
||||
<span class="ele-text">{{ user.payMoney }}</span>
|
||||
</a-form-item>
|
||||
<a-form-item label="机构/部门">
|
||||
<span class="ele-text">{{ user.organizationName }}</span>
|
||||
</a-form-item>
|
||||
<a-form-item label="头像">
|
||||
<a-image :src="user.avatar" :width="36" />
|
||||
</a-form-item>
|
||||
<a-form-item label="生日">
|
||||
<span class="ele-text">{{ user.birthday }}</span>
|
||||
</a-form-item>
|
||||
<a-form-item label="创建时间">
|
||||
<span class="ele-text">{{ user.createTime }}</span>
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
</a-row>
|
||||
</a-form>
|
||||
</a-drawer>
|
||||
</template>
|
||||
|
||||
<script lang="ts" setup>
|
||||
import { ref, reactive, watch } from 'vue';
|
||||
import { Form } from 'ant-design-vue';
|
||||
import { assignObject } from 'ele-admin-pro';
|
||||
import type { User } from '@/api/system/user/model';
|
||||
import { useThemeStore } from '@/store/modules/theme';
|
||||
import { formatNumber } from 'ele-admin-pro/es';
|
||||
import { storeToRefs } from 'pinia';
|
||||
|
||||
const useForm = Form.useForm;
|
||||
// 是否开启响应式布局
|
||||
const themeStore = useThemeStore();
|
||||
const { styleResponsive } = storeToRefs(themeStore);
|
||||
const props = defineProps<{
|
||||
// 弹窗是否打开
|
||||
visible: boolean;
|
||||
// 修改回显的数据
|
||||
data?: User | null;
|
||||
}>();
|
||||
|
||||
const emit = defineEmits<{
|
||||
(e: 'done'): void;
|
||||
(e: 'update:visible', visible: boolean): void;
|
||||
}>();
|
||||
|
||||
// 用户信息
|
||||
const user = reactive<User>({
|
||||
username: '',
|
||||
nickname: '',
|
||||
sexName: '',
|
||||
phone: '',
|
||||
avatar: '',
|
||||
balance: undefined,
|
||||
points: 0,
|
||||
payMoney: 0,
|
||||
birthday: '',
|
||||
address: '',
|
||||
roles: [],
|
||||
createTime: undefined,
|
||||
status: undefined
|
||||
});
|
||||
|
||||
// 请求状态
|
||||
const loading = ref(true);
|
||||
|
||||
const { resetFields } = useForm(user);
|
||||
|
||||
/* 更新visible */
|
||||
const updateVisible = (value: boolean) => {
|
||||
emit('update:visible', value);
|
||||
};
|
||||
|
||||
watch(
|
||||
() => props.visible,
|
||||
(visible) => {
|
||||
if (visible) {
|
||||
if (props.data) {
|
||||
loading.value = false;
|
||||
assignObject(user, props.data);
|
||||
}
|
||||
} else {
|
||||
resetFields();
|
||||
}
|
||||
}
|
||||
);
|
||||
</script>
|
||||
111
src/views/system/user/components/user-search.vue
Normal file
111
src/views/system/user/components/user-search.vue
Normal file
@@ -0,0 +1,111 @@
|
||||
<!-- 搜索表单 -->
|
||||
<template>
|
||||
<a-form
|
||||
:label-col="
|
||||
styleResponsive ? { xl: 7, lg: 5, md: 7, sm: 4 } : { flex: '90px' }
|
||||
"
|
||||
:wrapper-col="
|
||||
styleResponsive ? { xl: 17, lg: 19, md: 17, sm: 20 } : { flex: '1' }
|
||||
"
|
||||
>
|
||||
<a-row :gutter="8">
|
||||
<a-col
|
||||
v-bind="
|
||||
styleResponsive
|
||||
? { xl: 6, lg: 12, md: 12, sm: 24, xs: 24 }
|
||||
: { span: 6 }
|
||||
"
|
||||
>
|
||||
<a-form-item label="用户账号">
|
||||
<a-input
|
||||
v-model:value.trim="form.username"
|
||||
placeholder="请输入"
|
||||
allow-clear
|
||||
/>
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
<a-col
|
||||
v-bind="
|
||||
styleResponsive
|
||||
? { xl: 6, lg: 12, md: 12, sm: 24, xs: 24 }
|
||||
: { span: 6 }
|
||||
"
|
||||
>
|
||||
<a-form-item label="昵称">
|
||||
<a-input
|
||||
v-model:value.trim="form.nickname"
|
||||
placeholder="请输入"
|
||||
allow-clear
|
||||
/>
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
<a-col
|
||||
v-bind="
|
||||
styleResponsive
|
||||
? { xl: 6, lg: 12, md: 12, sm: 24, xs: 24 }
|
||||
: { span: 6 }
|
||||
"
|
||||
>
|
||||
<a-form-item label="性别">
|
||||
<a-select v-model:value="form.sex" placeholder="请选择" allow-clear>
|
||||
<a-select-option value="1">男</a-select-option>
|
||||
<a-select-option value="2">女</a-select-option>
|
||||
</a-select>
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
<a-col
|
||||
v-bind="
|
||||
styleResponsive
|
||||
? { xl: 6, lg: 12, md: 12, sm: 24, xs: 24 }
|
||||
: { span: 6 }
|
||||
"
|
||||
>
|
||||
<a-form-item class="ele-text-right" :wrapper-col="{ span: 24 }">
|
||||
<a-space>
|
||||
<a-button type="primary" @click="search">查询</a-button>
|
||||
<a-button @click="reset">重置</a-button>
|
||||
</a-space>
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
</a-row>
|
||||
</a-form>
|
||||
</template>
|
||||
|
||||
<script lang="ts" setup>
|
||||
import { storeToRefs } from 'pinia';
|
||||
import { useThemeStore } from '@/store/modules/theme';
|
||||
import useFormData from '@/utils/use-form-data';
|
||||
import type { UserParam } from '@/api/system/user/model';
|
||||
|
||||
// 是否开启响应式布局
|
||||
const themeStore = useThemeStore();
|
||||
const { styleResponsive } = storeToRefs(themeStore);
|
||||
|
||||
const props = defineProps<{
|
||||
// 默认搜索条件
|
||||
where?: UserParam;
|
||||
}>();
|
||||
|
||||
const emit = defineEmits<{
|
||||
(e: 'search', where?: UserParam): void;
|
||||
}>();
|
||||
|
||||
// 表单数据
|
||||
const { form, resetFields } = useFormData<UserParam>({
|
||||
username: '',
|
||||
nickname: '',
|
||||
sex: undefined,
|
||||
...props.where
|
||||
});
|
||||
|
||||
/* 搜索 */
|
||||
const search = () => {
|
||||
emit('search', form);
|
||||
};
|
||||
|
||||
/* 重置 */
|
||||
const reset = () => {
|
||||
resetFields();
|
||||
search();
|
||||
};
|
||||
</script>
|
||||
130
src/views/system/user/details/index.vue
Normal file
130
src/views/system/user/details/index.vue
Normal file
@@ -0,0 +1,130 @@
|
||||
<template>
|
||||
<div class="ele-body">
|
||||
<a-card title="基本信息" :bordered="false">
|
||||
<a-form
|
||||
class="ele-form-detail"
|
||||
:label-col="
|
||||
styleResponsive ? { md: 2, sm: 4, xs: 6 } : { flex: '90px' }
|
||||
"
|
||||
:wrapper-col="
|
||||
styleResponsive ? { md: 22, sm: 20, xs: 18 } : { flex: '1' }
|
||||
"
|
||||
>
|
||||
<a-form-item label="账号">
|
||||
<div class="ele-text-secondary">{{ form.username }}</div>
|
||||
</a-form-item>
|
||||
<a-form-item label="昵称">
|
||||
<div class="ele-text-secondary">{{ form.nickname }}</div>
|
||||
</a-form-item>
|
||||
<a-form-item label="性别">
|
||||
<div class="ele-text-secondary">{{ form.sexName }}</div>
|
||||
</a-form-item>
|
||||
<a-form-item label="手机号">
|
||||
<div class="ele-text-secondary">{{ form.phone }}</div>
|
||||
</a-form-item>
|
||||
<a-form-item label="真实姓名">
|
||||
<div class="ele-text-secondary">{{ form.realName }}</div>
|
||||
</a-form-item>
|
||||
<a-form-item label="别名">
|
||||
<div class="ele-text-secondary">{{ form.alias }}</div>
|
||||
</a-form-item>
|
||||
<a-form-item label="角色">
|
||||
<a-tag v-for="item in form.roles" :key="item.roleId" color="blue">
|
||||
{{ item.roleName }}
|
||||
</a-tag>
|
||||
</a-form-item>
|
||||
<a-form-item label="创建时间">
|
||||
<div class="ele-text-secondary">{{ form.createTime }}</div>
|
||||
</a-form-item>
|
||||
<a-form-item label="状态">
|
||||
<a-badge
|
||||
v-if="typeof form.status === 'number'"
|
||||
:status="(['processing', 'error'][form.status] as any)"
|
||||
:text="['正常', '冻结'][form.status]"
|
||||
/>
|
||||
</a-form-item>
|
||||
</a-form>
|
||||
</a-card>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script lang="ts" setup>
|
||||
import { ref, watch, unref } from 'vue';
|
||||
import { useRouter } from 'vue-router';
|
||||
import { message } from 'ant-design-vue/es';
|
||||
import { toDateString } from 'ele-admin-pro/es';
|
||||
import { storeToRefs } from 'pinia';
|
||||
import { useThemeStore } from '@/store/modules/theme';
|
||||
import useFormData from '@/utils/use-form-data';
|
||||
import { setPageTabTitle } from '@/utils/page-tab-util';
|
||||
import { getUser } from '@/api/system/user';
|
||||
import type { User } from '@/api/system/user/model';
|
||||
const ROUTE_PATH = '/system/user/details';
|
||||
|
||||
// 是否开启响应式布局
|
||||
const themeStore = useThemeStore();
|
||||
const { styleResponsive } = storeToRefs(themeStore);
|
||||
|
||||
const { currentRoute } = useRouter();
|
||||
|
||||
// 用户信息
|
||||
const { form, assignFields } = useFormData<User>({
|
||||
userId: undefined,
|
||||
alias: '',
|
||||
realName: '',
|
||||
username: '',
|
||||
nickname: '',
|
||||
sexName: '',
|
||||
phone: '',
|
||||
roles: [],
|
||||
createTime: undefined,
|
||||
status: undefined
|
||||
});
|
||||
|
||||
// 请求状态
|
||||
const loading = ref(true);
|
||||
|
||||
/* */
|
||||
const query = () => {
|
||||
const { query } = unref(currentRoute);
|
||||
const id = query.id;
|
||||
if (!id || form.userId === Number(id)) {
|
||||
return;
|
||||
}
|
||||
loading.value = true;
|
||||
getUser(Number(id))
|
||||
.then((data) => {
|
||||
loading.value = false;
|
||||
assignFields({
|
||||
...data,
|
||||
createTime: toDateString(data.createTime)
|
||||
});
|
||||
// 修改页签标题
|
||||
if (unref(currentRoute).path === ROUTE_PATH) {
|
||||
setPageTabTitle(data.nickname + '的信息');
|
||||
}
|
||||
})
|
||||
.catch((e) => {
|
||||
loading.value = false;
|
||||
message.error(e.message);
|
||||
});
|
||||
};
|
||||
|
||||
watch(
|
||||
currentRoute,
|
||||
(route) => {
|
||||
const { path } = unref(route);
|
||||
if (path !== ROUTE_PATH) {
|
||||
return;
|
||||
}
|
||||
query();
|
||||
},
|
||||
{ immediate: true }
|
||||
);
|
||||
</script>
|
||||
|
||||
<script lang="ts">
|
||||
export default {
|
||||
name: 'SystemUserDetails'
|
||||
};
|
||||
</script>
|
||||
554
src/views/system/user/index.vue
Normal file
554
src/views/system/user/index.vue
Normal file
@@ -0,0 +1,554 @@
|
||||
<template>
|
||||
<div class="ele-body">
|
||||
<a-card :bordered="false">
|
||||
<!-- 表格 -->
|
||||
<ele-pro-table
|
||||
ref="tableRef"
|
||||
row-key="userId"
|
||||
:columns="columns"
|
||||
:datasource="datasource"
|
||||
v-model:selection="selection"
|
||||
:scroll="{ x: 1300 }"
|
||||
:where="defaultWhere"
|
||||
:customRow="customRow"
|
||||
cache-key="proSystemUserTable"
|
||||
>
|
||||
<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="primary"
|
||||
class="ele-btn-icon"
|
||||
@click="openEdit(selection[0])"
|
||||
:disabled="selection.length === 0"
|
||||
>
|
||||
<template #icon>
|
||||
<EditOutlined />
|
||||
</template>
|
||||
<span>修改</span>
|
||||
</a-button>
|
||||
<a-button
|
||||
type="primary"
|
||||
danger
|
||||
@click="resetPsw(selection[0])"
|
||||
:disabled="selection.length === 0"
|
||||
>重置密码</a-button
|
||||
>
|
||||
<a-button
|
||||
danger
|
||||
type="primary"
|
||||
class="ele-btn-icon"
|
||||
@click="removeBatch"
|
||||
>
|
||||
<template #icon>
|
||||
<delete-outlined />
|
||||
</template>
|
||||
<span>批量删除</span>
|
||||
</a-button>
|
||||
<a-button type="dashed" class="ele-btn-icon" @click="openImport">
|
||||
<template #icon>
|
||||
<upload-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.key === 'avatar'">
|
||||
<a-avatar
|
||||
:size="30"
|
||||
:src="`${record.avatar}`"
|
||||
style="margin-right: 4px"
|
||||
>
|
||||
<template #icon>
|
||||
<UserOutlined />
|
||||
</template>
|
||||
</a-avatar>
|
||||
</template>
|
||||
<template v-if="column.key === 'nickname'">
|
||||
<span>{{ record.nickname }}</span>
|
||||
</template>
|
||||
<template v-if="column.key === 'mobile'">
|
||||
<span v-if="hasRole('superAdmin')">{{ record.phone }}</span>
|
||||
<span v-else>{{ record.mobile }}</span>
|
||||
</template>
|
||||
<template v-else-if="column.key === 'roles'">
|
||||
<a-tag v-for="item in record.roles" :key="item.roleId" color="blue">
|
||||
{{ item.roleName }}
|
||||
</a-tag>
|
||||
</template>
|
||||
<template v-if="column.key === 'balance'">
|
||||
<span class="ele-text-success">
|
||||
¥{{ formatNumber(record.balance) }}
|
||||
</span>
|
||||
</template>
|
||||
<template v-if="column.key === 'expendMoney'">
|
||||
<span class="ele-text-warning">
|
||||
¥{{ formatNumber(record.expendMoney) }}
|
||||
</span>
|
||||
</template>
|
||||
<template v-else-if="column.key === 'isAdmin'">
|
||||
<a-switch
|
||||
:checked="record.isAdmin == 1"
|
||||
@change="updateIsAdmin(record)"
|
||||
/>
|
||||
</template>
|
||||
<template v-else-if="column.key === 'action'">
|
||||
<a-space>
|
||||
<a @click="openEdit(record)">修改</a>
|
||||
<a-divider type="vertical" />
|
||||
<!-- <a @click="resetPsw(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>
|
||||
<!-- 编辑弹窗 -->
|
||||
<user-edit
|
||||
v-model:visible="showEdit"
|
||||
:data="current"
|
||||
:organization-list="data"
|
||||
@done="reload"
|
||||
/>
|
||||
<!-- 导入弹窗 -->
|
||||
<user-import v-model:visible="showImport" @done="reload" />
|
||||
<!-- 用户详情 -->
|
||||
<user-info v-model:visible="showInfo" :data="current" @done="reload" />
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script lang="ts" setup>
|
||||
import { createVNode, ref, reactive } from 'vue';
|
||||
import { message, Modal } from 'ant-design-vue/es';
|
||||
import {
|
||||
PlusOutlined,
|
||||
DeleteOutlined,
|
||||
UploadOutlined,
|
||||
EditOutlined,
|
||||
UserOutlined,
|
||||
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, formatNumber } from 'ele-admin-pro/es';
|
||||
import { timeAgo } from 'ele-admin-pro';
|
||||
import UserEdit from './components/user-edit.vue';
|
||||
import UserImport from './components/user-import.vue';
|
||||
import UserInfo from './components/user-info.vue';
|
||||
import {
|
||||
pageUsers,
|
||||
removeUser,
|
||||
removeUsers,
|
||||
updateUserStatus,
|
||||
updateUserPassword, updateUser
|
||||
} from "@/api/system/user";
|
||||
import type { User, UserParam } from '@/api/system/user/model';
|
||||
import { toTreeData, uuid } from 'ele-admin-pro';
|
||||
import { listRoles } from '@/api/system/role';
|
||||
import { listOrganizations } from '@/api/system/organization';
|
||||
import { Organization } from '@/api/system/organization/model';
|
||||
import { hasRole } from '@/utils/permission';
|
||||
|
||||
// 加载状态
|
||||
const loading = ref(true);
|
||||
// 树形数据
|
||||
const data = ref<Organization[]>([]);
|
||||
// 树展开的key
|
||||
const expandedRowKeys = ref<number[]>([]);
|
||||
// 树选中的key
|
||||
const selectedRowKeys = ref<number[]>([]);
|
||||
// 表格选中数据
|
||||
const selection = ref<User[]>([]);
|
||||
// 当前编辑数据
|
||||
const current = ref<User | null>(null);
|
||||
// 是否显示编辑弹窗
|
||||
const showEdit = ref(false);
|
||||
// 是否显示用户详情
|
||||
const showInfo = ref(false);
|
||||
// 是否显示用户导入弹窗
|
||||
const showImport = ref(false);
|
||||
const userType = ref<number>();
|
||||
const searchText = ref('');
|
||||
|
||||
// 加载角色
|
||||
const roles = ref<any[]>([]);
|
||||
const filters = () => {
|
||||
listRoles().then((result) => {
|
||||
result.map((d) => {
|
||||
roles.value.push({
|
||||
text: d.roleName,
|
||||
value: d.roleId
|
||||
});
|
||||
});
|
||||
});
|
||||
};
|
||||
filters();
|
||||
// 加载机构
|
||||
listOrganizations()
|
||||
.then((list) => {
|
||||
loading.value = false;
|
||||
const eks: number[] = [];
|
||||
list.forEach((d) => {
|
||||
d.key = d.organizationId;
|
||||
d.value = d.organizationId;
|
||||
d.title = d.organizationName;
|
||||
if (typeof d.key === 'number') {
|
||||
eks.push(d.key);
|
||||
}
|
||||
});
|
||||
expandedRowKeys.value = eks;
|
||||
data.value = toTreeData({
|
||||
data: list,
|
||||
idField: 'organizationId',
|
||||
parentIdField: 'parentId'
|
||||
});
|
||||
if (list.length) {
|
||||
if (typeof list[0].key === 'number') {
|
||||
selectedRowKeys.value = [list[0].key];
|
||||
}
|
||||
// current.value = list[0];
|
||||
} else {
|
||||
selectedRowKeys.value = [];
|
||||
// current.value = null;
|
||||
}
|
||||
})
|
||||
.catch((e) => {
|
||||
loading.value = false;
|
||||
message.error(e.message);
|
||||
});
|
||||
|
||||
// 表格实例
|
||||
const tableRef = ref<InstanceType<typeof EleProTable> | null>(null);
|
||||
// 表格列配置
|
||||
const columns = ref<ColumnItem[]>([
|
||||
{
|
||||
title: 'ID',
|
||||
dataIndex: 'userId',
|
||||
width: 90,
|
||||
showSorterTooltip: false
|
||||
},
|
||||
{
|
||||
title: '头像',
|
||||
key: 'avatar',
|
||||
dataIndex: 'avatar',
|
||||
align: 'center',
|
||||
width: 90
|
||||
},
|
||||
{
|
||||
title: '用户名',
|
||||
dataIndex: 'username',
|
||||
showSorterTooltip: false
|
||||
},
|
||||
{
|
||||
title: '手机号码',
|
||||
dataIndex: 'mobile',
|
||||
align: 'center',
|
||||
key: 'mobile',
|
||||
showSorterTooltip: false
|
||||
},
|
||||
{
|
||||
title: '昵称',
|
||||
key: 'nickname',
|
||||
align: 'center',
|
||||
dataIndex: 'nickname'
|
||||
},
|
||||
// {
|
||||
// title: '客户分组',
|
||||
// dataIndex: 'type',
|
||||
// key: 'type',
|
||||
// align: 'center',
|
||||
// width: 120,
|
||||
// customRender: ({ text }) => typeName(text)
|
||||
// },
|
||||
{
|
||||
title: '性别',
|
||||
dataIndex: 'sexName',
|
||||
align: 'center',
|
||||
showSorterTooltip: false
|
||||
},
|
||||
{
|
||||
title: '邮箱',
|
||||
dataIndex: 'email',
|
||||
hideInTable: true,
|
||||
showSorterTooltip: false
|
||||
},
|
||||
{
|
||||
title: '实际消费金额',
|
||||
dataIndex: 'expendMoney',
|
||||
key: 'expendMoney',
|
||||
sorter: true,
|
||||
hideInTable: true,
|
||||
showSorterTooltip: false
|
||||
},
|
||||
{
|
||||
title: '可用积分',
|
||||
dataIndex: 'points',
|
||||
hideInTable: true,
|
||||
sorter: true
|
||||
},
|
||||
{
|
||||
title: '注册来源',
|
||||
key: 'platform',
|
||||
dataIndex: 'platform',
|
||||
width: 120,
|
||||
customRender: ({ text }) => ['未知', '网站', '小程序', 'APP'][text]
|
||||
},
|
||||
{
|
||||
title: '证件号码',
|
||||
dataIndex: 'idCard',
|
||||
hideInTable: true
|
||||
},
|
||||
{
|
||||
title: '出生日期',
|
||||
dataIndex: 'birthday',
|
||||
key: 'birthday',
|
||||
hideInTable: true
|
||||
},
|
||||
{
|
||||
title: '省份',
|
||||
dataIndex: 'province',
|
||||
key: 'province',
|
||||
hideInTable: true
|
||||
},
|
||||
{
|
||||
title: '城市',
|
||||
dataIndex: 'city',
|
||||
key: 'city',
|
||||
hideInTable: true,
|
||||
showSorterTooltip: false
|
||||
},
|
||||
{
|
||||
title: '地区',
|
||||
dataIndex: 'region',
|
||||
key: 'region',
|
||||
hideInTable: true,
|
||||
showSorterTooltip: false
|
||||
},
|
||||
{
|
||||
title: '邮箱认证',
|
||||
dataIndex: 'emailVerified',
|
||||
hideInTable: true,
|
||||
showSorterTooltip: false,
|
||||
customRender: ({ text }) => ['未认证', '已认证'][text]
|
||||
},
|
||||
{
|
||||
title: '实名认证',
|
||||
dataIndex: 'certification',
|
||||
sorter: true,
|
||||
hideInTable: true,
|
||||
customRender: ({ text }) => ['未认证', '已认证'][text]
|
||||
},
|
||||
{
|
||||
title: '角色',
|
||||
dataIndex: 'roles',
|
||||
key: 'roles',
|
||||
align: 'center',
|
||||
filterMultiple: false,
|
||||
filters: roles.value
|
||||
},
|
||||
{
|
||||
title: '管理员',
|
||||
key: 'isAdmin',
|
||||
dataIndex: 'isAdmin',
|
||||
sorter: true,
|
||||
showSorterTooltip: false,
|
||||
align: 'center'
|
||||
},
|
||||
{
|
||||
title: '注册时间',
|
||||
dataIndex: 'createTime',
|
||||
sorter: true,
|
||||
showSorterTooltip: false,
|
||||
ellipsis: true,
|
||||
customRender: ({ text }) => timeAgo(text)
|
||||
},
|
||||
{
|
||||
title: '操作',
|
||||
key: 'action',
|
||||
width: 120,
|
||||
fixed: 'right',
|
||||
align: 'center'
|
||||
}
|
||||
]);
|
||||
|
||||
// 默认搜索条件
|
||||
const defaultWhere = reactive({
|
||||
username: '',
|
||||
nickname: ''
|
||||
});
|
||||
|
||||
// 表格数据源
|
||||
const datasource: DatasourceFunction = ({
|
||||
page,
|
||||
limit,
|
||||
where,
|
||||
orders,
|
||||
filters
|
||||
}) => {
|
||||
where = {};
|
||||
where.roleId = filters.roles;
|
||||
where.keywords = searchText.value;
|
||||
where.isAdmin = 0;
|
||||
return pageUsers({ page, limit, ...where, ...orders });
|
||||
};
|
||||
|
||||
/* 搜索 */
|
||||
const reload = (where?: UserParam) => {
|
||||
selection.value = [];
|
||||
tableRef?.value?.reload({ where });
|
||||
};
|
||||
|
||||
/* 打开编辑弹窗 */
|
||||
const openEdit = (row?: User) => {
|
||||
current.value = row ?? null;
|
||||
showEdit.value = true;
|
||||
};
|
||||
|
||||
/* 打开用户详情弹窗 */
|
||||
const openInfo = (row?: User) => {
|
||||
current.value = row ?? null;
|
||||
showInfo.value = true;
|
||||
};
|
||||
|
||||
/* 打开编辑弹窗 */
|
||||
const openImport = () => {
|
||||
showImport.value = true;
|
||||
};
|
||||
|
||||
const handleTabs = (e) => {
|
||||
userType.value = Number(e.target.value);
|
||||
reload();
|
||||
};
|
||||
|
||||
/* 删除单个 */
|
||||
const remove = (row: User) => {
|
||||
const hide = messageLoading('请求中..', 0);
|
||||
removeUser(row.userId)
|
||||
.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);
|
||||
removeUsers(selection.value.map((d) => d.userId))
|
||||
.then((msg) => {
|
||||
hide();
|
||||
message.success(msg);
|
||||
reload();
|
||||
})
|
||||
.catch((e) => {
|
||||
hide();
|
||||
message.error(e.message);
|
||||
});
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
/* 重置用户密码 */
|
||||
const resetPsw = (row: User) => {
|
||||
Modal.confirm({
|
||||
title: '提示',
|
||||
content: '确定要重置此用户的密码吗?',
|
||||
icon: createVNode(ExclamationCircleOutlined),
|
||||
maskClosable: true,
|
||||
onOk: () => {
|
||||
const hide = message.loading('请求中..', 0);
|
||||
const password = uuid(8);
|
||||
updateUserPassword(row.userId, password)
|
||||
.then((msg) => {
|
||||
hide();
|
||||
message.success(msg + ',新密码:' + password);
|
||||
})
|
||||
.catch((e) => {
|
||||
hide();
|
||||
message.error(e.message);
|
||||
});
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
/* 修改用户状态 */
|
||||
const updateIsAdmin = (row: User) => {
|
||||
row.isAdmin = row.isAdmin ? 0 : 1;
|
||||
updateUser(row)
|
||||
.then((msg) => {
|
||||
message.success(msg);
|
||||
})
|
||||
.catch((e) => {
|
||||
message.error(e.message);
|
||||
});
|
||||
};
|
||||
|
||||
/* 自定义行属性 */
|
||||
const customRow = (record: User) => {
|
||||
return {
|
||||
// 行点击事件
|
||||
onClick: () => {
|
||||
// console.log(record);
|
||||
},
|
||||
// 行双击事件
|
||||
onDblclick: () => {
|
||||
openEdit(record);
|
||||
}
|
||||
};
|
||||
};
|
||||
</script>
|
||||
|
||||
<script lang="ts">
|
||||
export default {
|
||||
name: 'SystemUser'
|
||||
};
|
||||
</script>
|
||||
|
||||
<style lang="less" scoped>
|
||||
.user-box {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
.user-info {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: start;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
Reference in New Issue
Block a user