Compare commits
13 Commits
90eceb508a
...
master
Author | SHA1 | Date | |
---|---|---|---|
abe8a8e79b | |||
452e16ce2f | |||
d8a91ff4be | |||
8e61d61fdd | |||
cd141d2c79 | |||
6ada18b28b | |||
5516e79b5d | |||
e8d2650f9a | |||
5646112e44 | |||
82e971d98f | |||
d6da044b48 | |||
8c062feef0 | |||
bc59c2c22f |
@@ -2,7 +2,7 @@ run-name: ${{ gitea.actor }} is testing out Gitea Actions 🚀
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- master
|
||||
- prod
|
||||
jobs:
|
||||
Explore-Gitea-Actions:
|
||||
runs-on: ubuntu
|
||||
|
@@ -1,10 +1,9 @@
|
||||
import type { MeterInfoVO, MeterInfoForm, MeterInfoQuery } from './model';
|
||||
import type { MeterInfoVO, MeterInfoForm, MeterInfoQuery } from './model'
|
||||
|
||||
import type { ID, IDS } from '#/api/common';
|
||||
import type { PageResult } from '#/api/common';
|
||||
import type { ID, IDS, PageResult, TreeNode } from '#/api/common';
|
||||
|
||||
import { commonExport } from '#/api/helper';
|
||||
import { requestClient } from '#/api/request';
|
||||
import { commonExport } from '#/api/helper'
|
||||
import { requestClient } from '#/api/request'
|
||||
|
||||
/**
|
||||
* 查询水电气列表
|
||||
@@ -12,7 +11,7 @@ import { requestClient } from '#/api/request';
|
||||
* @returns 水电气列表
|
||||
*/
|
||||
export function meterInfoList(params?: MeterInfoQuery) {
|
||||
return requestClient.get<PageResult<MeterInfoVO>>('/property/meterInfo/list', { params });
|
||||
return requestClient.get<PageResult<MeterInfoVO>>('/property/meterInfo/list', { params })
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -21,7 +20,7 @@ export function meterInfoList(params?: MeterInfoQuery) {
|
||||
* @returns 水电气列表
|
||||
*/
|
||||
export function meterInfoExport(params?: MeterInfoQuery) {
|
||||
return commonExport('/property/meterInfo/export', params ?? {});
|
||||
return commonExport('/property/meterInfo/export', params ?? {})
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -30,7 +29,7 @@ export function meterInfoExport(params?: MeterInfoQuery) {
|
||||
* @returns 水电气详情
|
||||
*/
|
||||
export function meterInfoInfo(id: ID) {
|
||||
return requestClient.get<MeterInfoVO>(`/property/meterInfo/${id}`);
|
||||
return requestClient.get<MeterInfoVO>(`/property/meterInfo/${id}`)
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -39,7 +38,7 @@ export function meterInfoInfo(id: ID) {
|
||||
* @returns void
|
||||
*/
|
||||
export function meterInfoAdd(data: MeterInfoForm) {
|
||||
return requestClient.postWithMsg<void>('/property/meterInfo', data);
|
||||
return requestClient.postWithMsg<void>('/property/meterInfo', data)
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -48,7 +47,7 @@ export function meterInfoAdd(data: MeterInfoForm) {
|
||||
* @returns void
|
||||
*/
|
||||
export function meterInfoUpdate(data: MeterInfoForm) {
|
||||
return requestClient.putWithMsg<void>('/property/meterInfo', data);
|
||||
return requestClient.putWithMsg<void>('/property/meterInfo', data)
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -57,5 +56,14 @@ export function meterInfoUpdate(data: MeterInfoForm) {
|
||||
* @returns void
|
||||
*/
|
||||
export function meterInfoRemove(id: ID | IDS) {
|
||||
return requestClient.deleteWithMsg<void>(`/property/meterInfo/${id}`);
|
||||
return requestClient.deleteWithMsg<void>(`/property/meterInfo/${id}`)
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询水电气树
|
||||
* @param level
|
||||
* @returns 水电气树
|
||||
*/
|
||||
export function queryTree(meterType: number | string) {
|
||||
return requestClient.get<TreeNode<Number>[]>(`/property/meterInfo/tree/${meterType}`)
|
||||
}
|
@@ -1,65 +1,65 @@
|
||||
import type { PageQuery, BaseEntity } from '#/api/common';
|
||||
import type { PageQuery, BaseEntity } from '#/api/common'
|
||||
|
||||
export interface MeterInfoVO {
|
||||
/**
|
||||
* 主键id
|
||||
*/
|
||||
id: string | number;
|
||||
id: string | number
|
||||
|
||||
/**
|
||||
* 仪表名称
|
||||
*/
|
||||
meterName: string;
|
||||
meterName: string
|
||||
|
||||
/**
|
||||
* 仪表编码
|
||||
*/
|
||||
meterCode: string;
|
||||
meterCode: string
|
||||
|
||||
/**
|
||||
* 设备厂商
|
||||
*/
|
||||
factoryNo: string;
|
||||
factoryNo: string
|
||||
|
||||
/**
|
||||
* 设备类型(1-电表,2-水表,3-气表)
|
||||
*/
|
||||
meterType: number;
|
||||
meterType: number | String
|
||||
|
||||
/**
|
||||
* 计量单位(1-度,2-吨,3-立方米)
|
||||
*/
|
||||
meterUnit: number;
|
||||
meterUnit: number | String
|
||||
|
||||
/**
|
||||
* 安装位置
|
||||
*/
|
||||
installLocation: string;
|
||||
installLocation: string
|
||||
|
||||
/**
|
||||
* 初始读数
|
||||
*/
|
||||
initReading: number;
|
||||
initReading: number
|
||||
|
||||
/**
|
||||
* 最大量程
|
||||
*/
|
||||
maxRang: number;
|
||||
maxRang: number
|
||||
|
||||
/**
|
||||
* 通信状态
|
||||
*/
|
||||
communicationState: number;
|
||||
communicationState: number | String
|
||||
|
||||
/**
|
||||
* 运行状态
|
||||
*/
|
||||
runningState: number;
|
||||
runningState: number | String
|
||||
|
||||
/**
|
||||
* 备注
|
||||
*/
|
||||
remark: string;
|
||||
remark: string
|
||||
|
||||
}
|
||||
|
||||
@@ -67,62 +67,67 @@ export interface MeterInfoForm extends BaseEntity {
|
||||
/**
|
||||
* 主键id
|
||||
*/
|
||||
id?: string | number;
|
||||
id?: string | number
|
||||
|
||||
/**
|
||||
* 仪表名称
|
||||
*/
|
||||
meterName?: string;
|
||||
meterName?: string
|
||||
|
||||
/**
|
||||
* 仪表编码
|
||||
*/
|
||||
meterCode?: string;
|
||||
meterCode?: string
|
||||
|
||||
/**
|
||||
* 设备厂商
|
||||
*/
|
||||
factoryNo?: string;
|
||||
factoryNo?: string
|
||||
|
||||
/**
|
||||
* 设备类型(1-电表,2-水表,3-气表)
|
||||
*/
|
||||
meterType?: number;
|
||||
meterType?: number
|
||||
|
||||
/**
|
||||
* 计量单位(1-度,2-吨,3-立方米)
|
||||
*/
|
||||
meterUnit?: number;
|
||||
meterUnit?: number
|
||||
|
||||
/**
|
||||
* 安装位置
|
||||
*/
|
||||
installLocation?: string;
|
||||
installLocation?: string
|
||||
|
||||
/**
|
||||
* 初始读数
|
||||
*/
|
||||
initReading?: number;
|
||||
initReading?: number
|
||||
|
||||
/**
|
||||
* 最大量程
|
||||
*/
|
||||
maxRang?: number;
|
||||
maxRang?: number
|
||||
|
||||
/**
|
||||
* 通信状态
|
||||
*/
|
||||
communicationState?: number;
|
||||
communicationState?: number
|
||||
|
||||
/**
|
||||
* 运行状态
|
||||
*/
|
||||
runningState?: number;
|
||||
runningState?: number
|
||||
|
||||
/**
|
||||
* 采集器IP
|
||||
*/
|
||||
hostIp?: string
|
||||
|
||||
/**
|
||||
* 备注
|
||||
*/
|
||||
remark?: string;
|
||||
remark?: string
|
||||
|
||||
}
|
||||
|
||||
@@ -130,55 +135,55 @@ export interface MeterInfoQuery extends PageQuery {
|
||||
/**
|
||||
* 仪表名称
|
||||
*/
|
||||
meterName?: string;
|
||||
meterName?: string
|
||||
|
||||
/**
|
||||
* 仪表编码
|
||||
*/
|
||||
meterCode?: string;
|
||||
meterCode?: string
|
||||
|
||||
/**
|
||||
* 设备厂商
|
||||
*/
|
||||
factoryNo?: string;
|
||||
factoryNo?: string
|
||||
|
||||
/**
|
||||
* 设备类型(1-电表,2-水表,3-气表)
|
||||
*/
|
||||
meterType?: number;
|
||||
meterType?: number
|
||||
|
||||
/**
|
||||
* 计量单位(1-度,2-吨,3-立方米)
|
||||
*/
|
||||
meterUnit?: number;
|
||||
meterUnit?: number
|
||||
|
||||
/**
|
||||
* 安装位置
|
||||
*/
|
||||
installLocation?: string;
|
||||
installLocation?: string
|
||||
|
||||
/**
|
||||
* 初始读数
|
||||
*/
|
||||
initReading?: number;
|
||||
initReading?: number
|
||||
|
||||
/**
|
||||
* 最大量程
|
||||
*/
|
||||
maxRang?: number;
|
||||
maxRang?: number
|
||||
|
||||
/**
|
||||
* 通信状态
|
||||
*/
|
||||
communicationState?: number;
|
||||
communicationState?: number
|
||||
|
||||
/**
|
||||
* 运行状态
|
||||
*/
|
||||
runningState?: number;
|
||||
runningState?: number
|
||||
|
||||
/**
|
||||
* 日期范围参数
|
||||
*/
|
||||
params?: any;
|
||||
params?: any
|
||||
}
|
||||
|
@@ -0,0 +1,61 @@
|
||||
import type { MeterRecordVO, MeterRecordForm, MeterRecordQuery } from './model';
|
||||
|
||||
import type { ID, IDS } from '#/api/common';
|
||||
import type { PageResult } from '#/api/common';
|
||||
|
||||
import { commonExport } from '#/api/helper';
|
||||
import { requestClient } from '#/api/request';
|
||||
|
||||
/**
|
||||
* 查询抄表记录列表
|
||||
* @param params
|
||||
* @returns 抄表记录列表
|
||||
*/
|
||||
export function meterRecordList(params?: MeterRecordQuery) {
|
||||
return requestClient.get<PageResult<MeterRecordVO>>('/property/meterRecord/list', { params });
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出抄表记录列表
|
||||
* @param params
|
||||
* @returns 抄表记录列表
|
||||
*/
|
||||
export function meterRecordExport(params?: MeterRecordQuery) {
|
||||
return commonExport('/property/meterRecord/export', params ?? {});
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询抄表记录详情
|
||||
* @param id id
|
||||
* @returns 抄表记录详情
|
||||
*/
|
||||
export function meterRecordInfo(id: ID) {
|
||||
return requestClient.get<MeterRecordVO>(`/property/meterRecord/${id}`);
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增抄表记录
|
||||
* @param data
|
||||
* @returns void
|
||||
*/
|
||||
export function meterRecordAdd(data: MeterRecordForm) {
|
||||
return requestClient.postWithMsg<void>('/property/meterRecord', data);
|
||||
}
|
||||
|
||||
/**
|
||||
* 更新抄表记录
|
||||
* @param data
|
||||
* @returns void
|
||||
*/
|
||||
export function meterRecordUpdate(data: MeterRecordForm) {
|
||||
return requestClient.putWithMsg<void>('/property/meterRecord', data);
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除抄表记录
|
||||
* @param id id
|
||||
* @returns void
|
||||
*/
|
||||
export function meterRecordRemove(id: ID | IDS) {
|
||||
return requestClient.deleteWithMsg<void>(`/property/meterRecord/${id}`);
|
||||
}
|
149
apps/web-antd/src/api/property/energyManagement/meterRecord/model.d.ts
vendored
Normal file
149
apps/web-antd/src/api/property/energyManagement/meterRecord/model.d.ts
vendored
Normal file
@@ -0,0 +1,149 @@
|
||||
import type { PageQuery, BaseEntity } from '#/api/common'
|
||||
|
||||
export interface MeterRecordVO {
|
||||
/**
|
||||
* 记录ID
|
||||
*/
|
||||
id: string | number
|
||||
|
||||
/**
|
||||
* 仪表编号
|
||||
*/
|
||||
meterId: string | number
|
||||
|
||||
/**
|
||||
* 仪表类型
|
||||
*/
|
||||
meterType: string | number
|
||||
|
||||
/**
|
||||
* 抄表员ID
|
||||
*/
|
||||
readerId: string | number
|
||||
|
||||
/**
|
||||
* 抄表时间
|
||||
*/
|
||||
readingTime: string
|
||||
|
||||
/**
|
||||
* 当前读数
|
||||
*/
|
||||
currentReading: number
|
||||
|
||||
/**
|
||||
* 上次读数
|
||||
*/
|
||||
previousReading: number
|
||||
|
||||
/**
|
||||
* 用量
|
||||
*/
|
||||
consumption: number
|
||||
|
||||
/**
|
||||
* 抄表方式(1手动 2自动 3用户上报)
|
||||
*/
|
||||
readingMethod: number
|
||||
|
||||
/**
|
||||
* 抄表照片
|
||||
*/
|
||||
imgOssid: string | number
|
||||
|
||||
}
|
||||
|
||||
export interface MeterRecordForm extends BaseEntity {
|
||||
/**
|
||||
* 记录ID
|
||||
*/
|
||||
id?: string | number
|
||||
|
||||
/**
|
||||
* 仪表编号
|
||||
*/
|
||||
meterId?: string | number
|
||||
|
||||
/**
|
||||
* 抄表员ID
|
||||
*/
|
||||
readerId?: string | number
|
||||
|
||||
/**
|
||||
* 抄表时间
|
||||
*/
|
||||
readingTime?: string
|
||||
|
||||
/**
|
||||
* 当前读数
|
||||
*/
|
||||
currentReading?: number
|
||||
|
||||
/**
|
||||
* 上次读数
|
||||
*/
|
||||
previousReading?: number
|
||||
|
||||
/**
|
||||
* 用量
|
||||
*/
|
||||
consumption?: number
|
||||
|
||||
/**
|
||||
* 抄表方式(1手动 2自动 3用户上报)
|
||||
*/
|
||||
readingMethod?: number
|
||||
|
||||
/**
|
||||
* 抄表照片
|
||||
*/
|
||||
imgOssid?: string | number
|
||||
|
||||
}
|
||||
|
||||
export interface MeterRecordQuery extends PageQuery {
|
||||
/**
|
||||
* 仪表编号
|
||||
*/
|
||||
meterId?: string | number
|
||||
|
||||
/**
|
||||
* 抄表员ID
|
||||
*/
|
||||
readerId?: string | number
|
||||
|
||||
/**
|
||||
* 抄表时间
|
||||
*/
|
||||
readingTime?: string
|
||||
|
||||
/**
|
||||
* 当前读数
|
||||
*/
|
||||
currentReading?: number
|
||||
|
||||
/**
|
||||
* 上次读数
|
||||
*/
|
||||
previousReading?: number
|
||||
|
||||
/**
|
||||
* 用量
|
||||
*/
|
||||
consumption?: number
|
||||
|
||||
/**
|
||||
* 抄表方式(1手动 2自动 3用户上报)
|
||||
*/
|
||||
readingMethod?: number
|
||||
|
||||
/**
|
||||
* 抄表照片
|
||||
*/
|
||||
imgOssid?: string | number
|
||||
|
||||
/**
|
||||
* 日期范围参数
|
||||
*/
|
||||
params?: any
|
||||
}
|
@@ -0,0 +1,11 @@
|
||||
import { requestClient } from '#/api/request';
|
||||
import type { PageResult } from '#/api/common';
|
||||
|
||||
/**
|
||||
* 通行记录列表
|
||||
* @param data
|
||||
* @returns void
|
||||
*/
|
||||
export function getVisitorList(params?: any) {
|
||||
return requestClient.get<PageResult<any>>('/sis/visitor/list', { params });
|
||||
}
|
@@ -1,18 +1,24 @@
|
||||
import type { AlarmEventProcessVO, AlarmEventProcessForm, AlarmEventProcessQuery } from './model';
|
||||
import type {
|
||||
AlarmEventProcessForm,
|
||||
AlarmEventProcessQuery,
|
||||
AlarmEventProcessVO,
|
||||
} from './model';
|
||||
|
||||
import type { ID, IDS } from '#/api/common';
|
||||
import type { PageResult } from '#/api/common';
|
||||
import type { ID, IDS, PageResult } from '#/api/common';
|
||||
|
||||
import { commonExport } from '#/api/helper';
|
||||
import { requestClient } from '#/api/request';
|
||||
|
||||
/**
|
||||
* 查询告警信息处理流程记录列表
|
||||
* @param params
|
||||
* @returns 告警信息处理流程记录列表
|
||||
*/
|
||||
* 查询告警信息处理流程记录列表
|
||||
* @param params
|
||||
* @returns 告警信息处理流程记录列表
|
||||
*/
|
||||
export function alarmEventProcessList(params?: AlarmEventProcessQuery) {
|
||||
return requestClient.get<PageResult<AlarmEventProcessVO>>('/sis/alarmEventProcess/list', { params });
|
||||
return requestClient.get<PageResult<AlarmEventProcessVO>>(
|
||||
'/sis/alarmEventProcess/list',
|
||||
{ params },
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -59,3 +65,14 @@ export function alarmEventProcessUpdate(data: AlarmEventProcessForm) {
|
||||
export function alarmEventProcessRemove(id: ID | IDS) {
|
||||
return requestClient.deleteWithMsg<void>(`/sis/alarmEventProcess/${id}`);
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除告警信息处理流程记录
|
||||
* @param id id
|
||||
* @returns void
|
||||
*/
|
||||
export function queryResult(id: ID | IDS) {
|
||||
return requestClient.get<AlarmEventProcessVO>(
|
||||
`/sis/alarmEventProcess/query/result/${id}`,
|
||||
);
|
||||
}
|
||||
|
@@ -3,13 +3,8 @@ import { computed } from 'vue';
|
||||
|
||||
import { useAntdDesignTokens } from '@vben/hooks';
|
||||
import { preferences, usePreferences } from '@vben/preferences';
|
||||
|
||||
import { App, ConfigProvider, theme } from 'ant-design-vue';
|
||||
|
||||
import { antdLocale } from '#/locales';
|
||||
|
||||
import { useUploadTip } from './upload-tip';
|
||||
|
||||
defineOptions({ name: 'App' });
|
||||
|
||||
const { isDark } = usePreferences();
|
||||
@@ -30,8 +25,6 @@ const tokenTheme = computed(() => {
|
||||
token: tokens,
|
||||
};
|
||||
});
|
||||
|
||||
useUploadTip();
|
||||
</script>
|
||||
|
||||
<template>
|
||||
|
@@ -1,36 +0,0 @@
|
||||
import { onMounted } from 'vue';
|
||||
|
||||
import { useLocalStorage } from '@vueuse/core';
|
||||
import { Modal } from 'ant-design-vue';
|
||||
|
||||
export function useUploadTip() {
|
||||
const readTip = useLocalStorage<boolean>('__upload_tip_read_5.4.0', false);
|
||||
onMounted(() => {
|
||||
if (readTip.value || !import.meta.env.DEV) {
|
||||
return;
|
||||
}
|
||||
const modalInstance = Modal.info({
|
||||
title: '提示',
|
||||
centered: true,
|
||||
content:
|
||||
'如果你的版本是从低版本升级到后端>5.4.0, 记得执行升级sql, 否则跳转页面(如oss 代码生成配置)等会404',
|
||||
okButtonProps: { disabled: true },
|
||||
onOk() {
|
||||
modalInstance.destroy();
|
||||
readTip.value = true;
|
||||
},
|
||||
});
|
||||
|
||||
let time = 3;
|
||||
const interval = setInterval(() => {
|
||||
modalInstance.update({
|
||||
okText: time === 0 ? '我知道了, 不再弹出' : `${time}秒后关闭`,
|
||||
okButtonProps: { disabled: time > 0 },
|
||||
});
|
||||
if (time <= 0) {
|
||||
clearInterval(interval);
|
||||
}
|
||||
time--;
|
||||
}, 1000);
|
||||
});
|
||||
}
|
@@ -1,60 +0,0 @@
|
||||
import type { DemoForm, DemoQuery, DemoVO } from './model';
|
||||
|
||||
import type { ID, IDS, PageResult } from '#/api/common';
|
||||
|
||||
import { commonExport } from '#/api/helper';
|
||||
import { requestClient } from '#/api/request';
|
||||
|
||||
/**
|
||||
* 查询测试单表列表
|
||||
* @param params
|
||||
* @returns 测试单表列表
|
||||
*/
|
||||
export function demoList(params?: DemoQuery) {
|
||||
return requestClient.get<PageResult<DemoVO>>('/demo/demo/list', { params });
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出测试单表列表
|
||||
* @param params
|
||||
* @returns 测试单表列表
|
||||
*/
|
||||
export function demoExport(params?: DemoQuery) {
|
||||
return commonExport('/demo/demo/export', params ?? {});
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询测试单表详情
|
||||
* @param id id
|
||||
* @returns 测试单表详情
|
||||
*/
|
||||
export function demoInfo(id: ID) {
|
||||
return requestClient.get<DemoVO>(`/demo/demo/${id}`);
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增测试单表
|
||||
* @param data
|
||||
* @returns void
|
||||
*/
|
||||
export function demoAdd(data: DemoForm) {
|
||||
return requestClient.postWithMsg<void>('/demo/demo', data);
|
||||
}
|
||||
|
||||
/**
|
||||
* 更新测试单表
|
||||
* @param data
|
||||
* @returns void
|
||||
*/
|
||||
export function demoUpdate(data: DemoForm) {
|
||||
return requestClient.putWithMsg<void>('/demo/demo', data);
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除测试单表
|
||||
* @param id id
|
||||
* @returns void
|
||||
*/
|
||||
export function demoRemove(id: ID | IDS) {
|
||||
return requestClient.deleteWithMsg<void>(`/demo/demo/${id}`);
|
||||
}
|
82
apps/web-antd/src/views/demo/demo/api/model.d.ts
vendored
82
apps/web-antd/src/views/demo/demo/api/model.d.ts
vendored
@@ -1,82 +0,0 @@
|
||||
import type { BaseEntity, PageQuery } from '#/api/common';
|
||||
|
||||
export interface DemoVO {
|
||||
/**
|
||||
* 主键
|
||||
*/
|
||||
id: number | string;
|
||||
|
||||
/**
|
||||
* 排序号
|
||||
*/
|
||||
orderNum: number;
|
||||
|
||||
/**
|
||||
* key键
|
||||
*/
|
||||
testKey: string;
|
||||
|
||||
/**
|
||||
* 值
|
||||
*/
|
||||
value: string;
|
||||
|
||||
/**
|
||||
* 版本
|
||||
*/
|
||||
version: number;
|
||||
}
|
||||
|
||||
export interface DemoForm extends BaseEntity {
|
||||
/**
|
||||
* 主键
|
||||
*/
|
||||
id?: number | string;
|
||||
|
||||
/**
|
||||
* 排序号
|
||||
*/
|
||||
orderNum?: number;
|
||||
|
||||
/**
|
||||
* key键
|
||||
*/
|
||||
testKey?: string;
|
||||
|
||||
/**
|
||||
* 值
|
||||
*/
|
||||
value?: string;
|
||||
|
||||
/**
|
||||
* 版本
|
||||
*/
|
||||
version?: number;
|
||||
}
|
||||
|
||||
export interface DemoQuery extends PageQuery {
|
||||
/**
|
||||
* 排序号
|
||||
*/
|
||||
orderNum?: number;
|
||||
|
||||
/**
|
||||
* key键
|
||||
*/
|
||||
testKey?: string;
|
||||
|
||||
/**
|
||||
* 值
|
||||
*/
|
||||
value?: string;
|
||||
|
||||
/**
|
||||
* 版本
|
||||
*/
|
||||
version?: number;
|
||||
|
||||
/**
|
||||
* 日期范围参数
|
||||
*/
|
||||
params?: any;
|
||||
}
|
@@ -1,93 +0,0 @@
|
||||
import type { FormSchemaGetter } from '#/adapter/form';
|
||||
import type { VxeGridProps } from '#/adapter/vxe-table';
|
||||
|
||||
export const querySchema: FormSchemaGetter = () => [
|
||||
{
|
||||
component: 'Input',
|
||||
fieldName: 'orderNum',
|
||||
label: '排序号',
|
||||
},
|
||||
{
|
||||
component: 'Input',
|
||||
fieldName: 'testKey',
|
||||
label: 'key键',
|
||||
},
|
||||
{
|
||||
component: 'Input',
|
||||
fieldName: 'value',
|
||||
label: '值',
|
||||
},
|
||||
{
|
||||
component: 'Input',
|
||||
fieldName: 'version',
|
||||
label: '版本',
|
||||
},
|
||||
];
|
||||
|
||||
export const columns: VxeGridProps['columns'] = [
|
||||
{ type: 'checkbox', width: 60 },
|
||||
{
|
||||
title: '主键',
|
||||
field: 'id',
|
||||
},
|
||||
{
|
||||
title: '排序号',
|
||||
field: 'orderNum',
|
||||
},
|
||||
{
|
||||
title: 'key键',
|
||||
field: 'testKey',
|
||||
},
|
||||
{
|
||||
title: '值',
|
||||
field: 'value',
|
||||
},
|
||||
{
|
||||
title: '版本',
|
||||
field: 'version',
|
||||
},
|
||||
{
|
||||
field: 'action',
|
||||
fixed: 'right',
|
||||
slots: { default: 'action' },
|
||||
title: '操作',
|
||||
resizable: false,
|
||||
width: 'auto',
|
||||
},
|
||||
];
|
||||
|
||||
export const modalSchema: FormSchemaGetter = () => [
|
||||
{
|
||||
label: '主键',
|
||||
fieldName: 'id',
|
||||
component: 'Input',
|
||||
dependencies: {
|
||||
show: () => false,
|
||||
triggerFields: [''],
|
||||
},
|
||||
},
|
||||
{
|
||||
label: '排序号',
|
||||
fieldName: 'orderNum',
|
||||
component: 'Input',
|
||||
rules: 'required',
|
||||
},
|
||||
{
|
||||
label: 'key键',
|
||||
fieldName: 'testKey',
|
||||
component: 'Input',
|
||||
rules: 'required',
|
||||
},
|
||||
{
|
||||
label: '值',
|
||||
fieldName: 'value',
|
||||
component: 'Input',
|
||||
rules: 'required',
|
||||
},
|
||||
{
|
||||
label: '版本',
|
||||
fieldName: 'version',
|
||||
component: 'Input',
|
||||
rules: 'required',
|
||||
},
|
||||
];
|
@@ -1,50 +0,0 @@
|
||||
import type { TreeForm, TreeQuery, TreeVO } from './model';
|
||||
|
||||
import type { ID, IDS } from '#/api/common';
|
||||
|
||||
import { requestClient } from '#/api/request';
|
||||
|
||||
/**
|
||||
* 查询测试树列表
|
||||
* @param params
|
||||
* @returns 测试树列表
|
||||
*/
|
||||
export function treeList(params?: TreeQuery) {
|
||||
return requestClient.get<TreeVO[]>('/demo/tree/list', { params });
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询测试树详情
|
||||
* @param id id
|
||||
* @returns 测试树详情
|
||||
*/
|
||||
export function treeInfo(id: ID) {
|
||||
return requestClient.get<TreeVO>(`/demo/tree/${id}`);
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增测试树
|
||||
* @param data
|
||||
* @returns void
|
||||
*/
|
||||
export function treeAdd(data: TreeForm) {
|
||||
return requestClient.postWithMsg<void>('/demo/tree', data);
|
||||
}
|
||||
|
||||
/**
|
||||
* 更新测试树
|
||||
* @param data
|
||||
* @returns void
|
||||
*/
|
||||
export function treeUpdate(data: TreeForm) {
|
||||
return requestClient.putWithMsg<void>('/demo/tree', data);
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除测试树
|
||||
* @param id id
|
||||
* @returns void
|
||||
*/
|
||||
export function treeRemove(id: ID | IDS) {
|
||||
return requestClient.deleteWithMsg<void>(`/demo/tree/${id}`);
|
||||
}
|
102
apps/web-antd/src/views/demo/tree/api/model.d.ts
vendored
102
apps/web-antd/src/views/demo/tree/api/model.d.ts
vendored
@@ -1,102 +0,0 @@
|
||||
import type { BaseEntity } from '#/api/common';
|
||||
|
||||
export interface TreeVO {
|
||||
/**
|
||||
* 主键
|
||||
*/
|
||||
id: number | string;
|
||||
|
||||
/**
|
||||
* 父id
|
||||
*/
|
||||
parentId: number | string;
|
||||
|
||||
/**
|
||||
* 部门id
|
||||
*/
|
||||
deptId: number | string;
|
||||
|
||||
/**
|
||||
* 用户id
|
||||
*/
|
||||
userId: number | string;
|
||||
|
||||
/**
|
||||
* 值
|
||||
*/
|
||||
treeName: string;
|
||||
|
||||
/**
|
||||
* 版本
|
||||
*/
|
||||
version: number;
|
||||
|
||||
/**
|
||||
* 子对象
|
||||
*/
|
||||
children: TreeVO[];
|
||||
}
|
||||
|
||||
export interface TreeForm extends BaseEntity {
|
||||
/**
|
||||
* 主键
|
||||
*/
|
||||
id?: number | string;
|
||||
|
||||
/**
|
||||
* 父id
|
||||
*/
|
||||
parentId?: number | string;
|
||||
|
||||
/**
|
||||
* 部门id
|
||||
*/
|
||||
deptId?: number | string;
|
||||
|
||||
/**
|
||||
* 用户id
|
||||
*/
|
||||
userId?: number | string;
|
||||
|
||||
/**
|
||||
* 值
|
||||
*/
|
||||
treeName?: string;
|
||||
|
||||
/**
|
||||
* 版本
|
||||
*/
|
||||
version?: number;
|
||||
}
|
||||
|
||||
export interface TreeQuery {
|
||||
/**
|
||||
* 父id
|
||||
*/
|
||||
parentId?: number | string;
|
||||
|
||||
/**
|
||||
* 部门id
|
||||
*/
|
||||
deptId?: number | string;
|
||||
|
||||
/**
|
||||
* 用户id
|
||||
*/
|
||||
userId?: number | string;
|
||||
|
||||
/**
|
||||
* 值
|
||||
*/
|
||||
treeName?: string;
|
||||
|
||||
/**
|
||||
* 版本
|
||||
*/
|
||||
version?: number;
|
||||
|
||||
/**
|
||||
* 日期范围参数
|
||||
*/
|
||||
params?: any;
|
||||
}
|
@@ -1,108 +0,0 @@
|
||||
import type { FormSchemaGetter } from '#/adapter/form';
|
||||
import type { VxeGridProps } from '#/adapter/vxe-table';
|
||||
|
||||
export const querySchema: FormSchemaGetter = () => [
|
||||
{
|
||||
component: 'Input',
|
||||
fieldName: 'parentId',
|
||||
label: '父id',
|
||||
},
|
||||
{
|
||||
component: 'Input',
|
||||
fieldName: 'deptId',
|
||||
label: '部门id',
|
||||
},
|
||||
{
|
||||
component: 'Input',
|
||||
fieldName: 'userId',
|
||||
label: '用户id',
|
||||
},
|
||||
{
|
||||
component: 'Input',
|
||||
fieldName: 'treeName',
|
||||
label: '值',
|
||||
},
|
||||
{
|
||||
component: 'Input',
|
||||
fieldName: 'version',
|
||||
label: '版本',
|
||||
},
|
||||
];
|
||||
|
||||
export const columns: VxeGridProps['columns'] = [
|
||||
{
|
||||
title: '主键',
|
||||
field: 'id',
|
||||
treeNode: true,
|
||||
},
|
||||
{
|
||||
title: '父id',
|
||||
field: 'parentId',
|
||||
},
|
||||
{
|
||||
title: '部门id',
|
||||
field: 'deptId',
|
||||
},
|
||||
{
|
||||
title: '用户id',
|
||||
field: 'userId',
|
||||
},
|
||||
{
|
||||
title: '值',
|
||||
field: 'treeName',
|
||||
},
|
||||
{
|
||||
title: '版本',
|
||||
field: 'version',
|
||||
},
|
||||
{
|
||||
field: 'action',
|
||||
fixed: 'right',
|
||||
slots: { default: 'action' },
|
||||
title: '操作',
|
||||
resizable: false,
|
||||
width: 'auto',
|
||||
},
|
||||
];
|
||||
|
||||
export const modalSchema: FormSchemaGetter = () => [
|
||||
{
|
||||
label: '主键',
|
||||
fieldName: 'id',
|
||||
component: 'Input',
|
||||
dependencies: {
|
||||
show: () => false,
|
||||
triggerFields: [''],
|
||||
},
|
||||
},
|
||||
{
|
||||
label: '父id',
|
||||
fieldName: 'parentId',
|
||||
component: 'TreeSelect',
|
||||
rules: 'required',
|
||||
},
|
||||
{
|
||||
label: '部门id',
|
||||
fieldName: 'deptId',
|
||||
component: 'Input',
|
||||
rules: 'required',
|
||||
},
|
||||
{
|
||||
label: '用户id',
|
||||
fieldName: 'userId',
|
||||
component: 'Input',
|
||||
rules: 'required',
|
||||
},
|
||||
{
|
||||
label: '值',
|
||||
fieldName: 'treeName',
|
||||
component: 'Input',
|
||||
rules: 'required',
|
||||
},
|
||||
{
|
||||
label: '版本',
|
||||
fieldName: 'version',
|
||||
component: 'Input',
|
||||
rules: 'required',
|
||||
},
|
||||
];
|
@@ -1,146 +0,0 @@
|
||||
<script setup lang="ts">
|
||||
import type { VbenFormProps } from '@vben/common-ui';
|
||||
import type { Recordable } from '@vben/types';
|
||||
|
||||
import type { VxeGridProps } from '#/adapter/vxe-table';
|
||||
|
||||
import { nextTick } from 'vue';
|
||||
|
||||
import { Page, useVbenModal } from '@vben/common-ui';
|
||||
import { getPopupContainer, listToTree } from '@vben/utils';
|
||||
|
||||
import { Popconfirm, Space } from 'ant-design-vue';
|
||||
|
||||
import { useVbenVxeGrid } from '#/adapter/vxe-table';
|
||||
|
||||
import { treeList, treeRemove } from './api';
|
||||
import { columns, querySchema } from './data';
|
||||
import treeModal from './tree-modal.vue';
|
||||
|
||||
const formOptions: VbenFormProps = {
|
||||
commonConfig: {
|
||||
labelWidth: 80,
|
||||
},
|
||||
schema: querySchema(),
|
||||
wrapperClass: 'grid-cols-1 md:grid-cols-2 lg:grid-cols-3 xl:grid-cols-4',
|
||||
};
|
||||
|
||||
const gridOptions: VxeGridProps = {
|
||||
columns,
|
||||
height: 'auto',
|
||||
keepSource: true,
|
||||
pagerConfig: {
|
||||
enabled: false,
|
||||
},
|
||||
proxyConfig: {
|
||||
ajax: {
|
||||
query: async (_, formValues = {}) => {
|
||||
const resp = await treeList({
|
||||
...formValues,
|
||||
});
|
||||
const treeData = listToTree(resp, {
|
||||
id: 'id',
|
||||
pid: 'parentId',
|
||||
children: 'children',
|
||||
});
|
||||
return { rows: treeData };
|
||||
},
|
||||
// 默认请求接口后展开全部 不需要可以删除这段
|
||||
querySuccess: () => {
|
||||
nextTick(() => {
|
||||
expandAll();
|
||||
});
|
||||
},
|
||||
},
|
||||
},
|
||||
rowConfig: {
|
||||
keyField: 'id',
|
||||
},
|
||||
|
||||
treeConfig: {
|
||||
parentField: 'parentId',
|
||||
rowField: 'id',
|
||||
transform: false,
|
||||
},
|
||||
};
|
||||
|
||||
const [BasicTable, tableApi] = useVbenVxeGrid({ formOptions, gridOptions });
|
||||
const [TreeModal, modalApi] = useVbenModal({
|
||||
connectedComponent: treeModal,
|
||||
});
|
||||
|
||||
function handleAdd() {
|
||||
modalApi.setData({ update: false });
|
||||
modalApi.open();
|
||||
}
|
||||
|
||||
async function handleEdit(row: Recordable<any>) {
|
||||
modalApi.setData({ id: row.id, update: true });
|
||||
modalApi.open();
|
||||
}
|
||||
|
||||
async function handleDelete(row: Recordable<any>) {
|
||||
await treeRemove(row.id);
|
||||
await tableApi.query();
|
||||
}
|
||||
|
||||
function expandAll() {
|
||||
tableApi.grid?.setAllTreeExpand(true);
|
||||
}
|
||||
|
||||
function collapseAll() {
|
||||
tableApi.grid?.setAllTreeExpand(false);
|
||||
}
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<Page :auto-content-height="true">
|
||||
<BasicTable>
|
||||
<template #toolbar-actions>
|
||||
<span class="pl-[7px] text-[16px]">测试树列表</span>
|
||||
</template>
|
||||
<template #toolbar-tools>
|
||||
<Space>
|
||||
<a-button @click="collapseAll">
|
||||
{{ $t('pages.common.collapse') }}
|
||||
</a-button>
|
||||
<a-button @click="expandAll">
|
||||
{{ $t('pages.common.expand') }}
|
||||
</a-button>
|
||||
<a-button
|
||||
type="primary"
|
||||
v-access:code="['system:tree:add']"
|
||||
@click="handleAdd"
|
||||
>
|
||||
{{ $t('pages.common.add') }}
|
||||
</a-button>
|
||||
</Space>
|
||||
</template>
|
||||
<template #action="{ row }">
|
||||
<Space>
|
||||
<ghost-button
|
||||
v-access:code="['system:tree:edit']"
|
||||
@click.stop="handleEdit(row)"
|
||||
>
|
||||
{{ $t('pages.common.edit') }}
|
||||
</ghost-button>
|
||||
<Popconfirm
|
||||
:get-popup-container="getPopupContainer"
|
||||
placement="left"
|
||||
title="确认删除?"
|
||||
@confirm="handleDelete(row)"
|
||||
>
|
||||
<ghost-button
|
||||
danger
|
||||
v-access:code="['system:tree:remove']"
|
||||
@click.stop=""
|
||||
>
|
||||
{{ $t('pages.common.delete') }}
|
||||
</ghost-button>
|
||||
</Popconfirm>
|
||||
</Space>
|
||||
</template>
|
||||
</BasicTable>
|
||||
<TreeModal @reload="tableApi.query()" />
|
||||
</Page>
|
||||
</template>
|
@@ -1,104 +0,0 @@
|
||||
<script setup lang="ts">
|
||||
import { computed, ref } from 'vue';
|
||||
|
||||
import { useVbenModal } from '@vben/common-ui';
|
||||
import { $t } from '@vben/locales';
|
||||
import { cloneDeep, listToTree } from '@vben/utils';
|
||||
|
||||
import { useVbenForm } from '#/adapter/form';
|
||||
|
||||
import { treeAdd, treeInfo, treeList, treeUpdate } from './api';
|
||||
import { modalSchema } from './data';
|
||||
|
||||
const emit = defineEmits<{ reload: [] }>();
|
||||
|
||||
const isUpdate = ref(false);
|
||||
const title = computed(() => {
|
||||
return isUpdate.value ? $t('pages.common.edit') : $t('pages.common.add');
|
||||
});
|
||||
|
||||
const [BasicForm, formApi] = useVbenForm({
|
||||
commonConfig: {
|
||||
// 默认占满两列
|
||||
formItemClass: 'col-span-2',
|
||||
// 默认label宽度 px
|
||||
labelWidth: 80,
|
||||
// 通用配置项 会影响到所有表单项
|
||||
componentProps: {
|
||||
class: 'w-full',
|
||||
},
|
||||
},
|
||||
schema: modalSchema(),
|
||||
showDefaultActions: false,
|
||||
wrapperClass: 'grid-cols-2',
|
||||
});
|
||||
|
||||
async function setupTreeSelect() {
|
||||
const listData = await treeList();
|
||||
const treeData = listToTree(listData, { id: 'id', pid: 'parentId' });
|
||||
formApi.updateSchema([
|
||||
{
|
||||
fieldName: 'parentId',
|
||||
componentProps: {
|
||||
treeData,
|
||||
treeLine: { showLeafIcon: false },
|
||||
fieldNames: { label: 'treeName', value: 'id' },
|
||||
treeDefaultExpandAll: true,
|
||||
},
|
||||
},
|
||||
]);
|
||||
}
|
||||
|
||||
const [BasicModal, modalApi] = useVbenModal({
|
||||
fullscreenButton: false,
|
||||
onCancel: handleCancel,
|
||||
onConfirm: handleConfirm,
|
||||
onOpenChange: async (isOpen) => {
|
||||
if (!isOpen) {
|
||||
return null;
|
||||
}
|
||||
modalApi.modalLoading(true);
|
||||
|
||||
const { id } = modalApi.getData() as { id?: number | string };
|
||||
isUpdate.value = !!id;
|
||||
|
||||
if (isUpdate.value && id) {
|
||||
const record = await treeInfo(id);
|
||||
await formApi.setValues(record);
|
||||
}
|
||||
await setupTreeSelect();
|
||||
|
||||
modalApi.modalLoading(false);
|
||||
},
|
||||
});
|
||||
|
||||
async function handleConfirm() {
|
||||
try {
|
||||
modalApi.modalLoading(true);
|
||||
const { valid } = await formApi.validate();
|
||||
if (!valid) {
|
||||
return;
|
||||
}
|
||||
// getValues获取为一个readonly的对象 需要修改必须先深拷贝一次
|
||||
const data = cloneDeep(await formApi.getValues());
|
||||
await (isUpdate.value ? treeUpdate(data) : treeAdd(data));
|
||||
emit('reload');
|
||||
await handleCancel();
|
||||
} catch (error) {
|
||||
console.error(error);
|
||||
} finally {
|
||||
modalApi.modalLoading(false);
|
||||
}
|
||||
}
|
||||
|
||||
async function handleCancel() {
|
||||
modalApi.close();
|
||||
await formApi.resetForm();
|
||||
}
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<BasicModal :close-on-click-modal="false" :title="title" class="w-[550px]">
|
||||
<BasicForm />
|
||||
</BasicModal>
|
||||
</template>
|
@@ -2,8 +2,6 @@ import type {FormSchemaGetter} from '#/adapter/form';
|
||||
import type {VxeGridProps} from '#/adapter/vxe-table';
|
||||
import {renderDict} from "#/utils/render";
|
||||
import {getDictOptions} from "#/utils/dict";
|
||||
import {h} from "vue";
|
||||
import {Rate} from "ant-design-vue";
|
||||
|
||||
export const querySchema: FormSchemaGetter = () => [
|
||||
{
|
||||
@@ -96,34 +94,34 @@ export const columns: VxeGridProps['columns'] = [
|
||||
// field: 'planCompleTime',
|
||||
// width: 100,
|
||||
// },
|
||||
{
|
||||
title: '完成时间',
|
||||
field: 'compleTime',
|
||||
width: 100,
|
||||
},
|
||||
{
|
||||
title: '评价',
|
||||
field: 'serviceEvalua',
|
||||
width: 180,
|
||||
slots: {
|
||||
default: ({row}) => {
|
||||
return h(Rate, {
|
||||
value: row.serviceEvalua || 0,
|
||||
disabled: true,
|
||||
});
|
||||
},
|
||||
},
|
||||
},
|
||||
{
|
||||
title: '是否超时',
|
||||
field: 'isTimeOut',
|
||||
width: 100,
|
||||
slots: {
|
||||
default: ({row}) => {
|
||||
return row.isTimeOut ? renderDict(row.isTimeOut, 'wy_sf') : '';
|
||||
},
|
||||
},
|
||||
},
|
||||
// {
|
||||
// title: '完成时间',
|
||||
// field: 'compleTime',
|
||||
// width: 100,
|
||||
// },
|
||||
// {
|
||||
// title: '评价',
|
||||
// field: 'serviceEvalua',
|
||||
// width: 180,
|
||||
// slots: {
|
||||
// default: ({row}) => {
|
||||
// return h(Rate, {
|
||||
// value: row.serviceEvalua || 0,
|
||||
// disabled: true,
|
||||
// });
|
||||
// },
|
||||
// },
|
||||
// },
|
||||
// {
|
||||
// title: '是否超时',
|
||||
// field: 'isTimeOut',
|
||||
// width: 100,
|
||||
// slots: {
|
||||
// default: ({row}) => {
|
||||
// return row.isTimeOut ? renderDict(row.isTimeOut, 'wy_sf') : '';
|
||||
// },
|
||||
// },
|
||||
// },
|
||||
{
|
||||
title: '创建时间',
|
||||
field: 'createTime',
|
||||
|
@@ -47,7 +47,7 @@ async function handleOpenChange(open: boolean) {
|
||||
try {
|
||||
if (orderDetail.value.orderImgUrl) {
|
||||
const res = await ossInfo([orderDetail.value.orderImgUrl]);
|
||||
let imgUrls = [];
|
||||
let imgUrls = [] as string[];
|
||||
res.forEach(item => {
|
||||
imgUrls.push(item.url)
|
||||
})
|
||||
@@ -55,7 +55,7 @@ async function handleOpenChange(open: boolean) {
|
||||
}
|
||||
if (orderDetail.value.imgUrl) {
|
||||
const res = await ossInfo([orderDetail.value.imgUrl]);
|
||||
let imgUrls = [];
|
||||
let imgUrls = [] as string[];
|
||||
res.forEach(item => {
|
||||
imgUrls.push(item.url)
|
||||
})
|
||||
@@ -106,7 +106,6 @@ async function handleOpenChange(open: boolean) {
|
||||
<!-- {{ orderDetail.planCompleTime }}-->
|
||||
<!-- </DescriptionsItem>-->
|
||||
|
||||
|
||||
<DescriptionsItem label="备注" :span="2">
|
||||
{{ orderDetail.remark }}
|
||||
</DescriptionsItem>
|
||||
|
@@ -33,8 +33,13 @@ export const querySchema: FormSchemaGetter = () => [
|
||||
export const columns: VxeGridProps['columns'] = [
|
||||
{ type: 'checkbox', width: 60 },
|
||||
{
|
||||
title: '房屋',
|
||||
field: 'roomNumber',
|
||||
title: '费用类型',
|
||||
field: 'costType',
|
||||
slots: {
|
||||
default: ({ row }) => {
|
||||
return renderDict(row.costType, 'pro_expense_type');
|
||||
},
|
||||
},
|
||||
},
|
||||
{
|
||||
title: '费用项目',
|
||||
|
@@ -36,7 +36,7 @@ async function handleOpenChange(open: boolean) {
|
||||
<BasicModal :footer="false" :fullscreen-button="false" title="缴费审核详情" class="w-[70%]">
|
||||
<Descriptions v-if="paymentReviewDetail" size="small" :column="2" bordered
|
||||
:labelStyle="{width:'120px'}">
|
||||
<DescriptionsItem label="房屋">
|
||||
<DescriptionsItem label="房屋" v-if="paymentReviewDetail.roomNumber">
|
||||
{{ paymentReviewDetail.roomNumber }}
|
||||
</DescriptionsItem>
|
||||
<DescriptionsItem label="费用项目">
|
||||
|
@@ -4,8 +4,8 @@ import type { PropType } from 'vue'
|
||||
import { onMounted, ref } from 'vue'
|
||||
import { handleNode } from '@vben/utils'
|
||||
import { Empty, Skeleton, Tree } from 'ant-design-vue'
|
||||
import { communityTree } from "#/api/property/community"
|
||||
import type { CommunityVO } from "#/api/property/community/model"
|
||||
import { queryTree } from "#/api/property/energyManagement/meterInfo"
|
||||
import type { TreeNode } from '#/api/common'
|
||||
|
||||
defineOptions({ inheritAttrs: false })
|
||||
|
||||
@@ -31,26 +31,31 @@ const searchValue = defineModel('searchValue', {
|
||||
default: '',
|
||||
})
|
||||
|
||||
type TreeArray = CommunityVO[]
|
||||
const treeArray = ref<TreeArray>([])
|
||||
const treeArray = ref<TreeNode[]>([])
|
||||
/** 骨架屏加载 */
|
||||
const showTreeSkeleton = ref<boolean>(true)
|
||||
|
||||
async function loadTree() {
|
||||
showTreeSkeleton.value = true
|
||||
searchValue.value = ''
|
||||
selectFloorId.value = []
|
||||
const ret = await communityTree(3)
|
||||
const splitStr = '/'
|
||||
handleNode(ret, 'label', splitStr, function (node: any) {
|
||||
if (node.level != 3) {
|
||||
node.disabled = true
|
||||
}
|
||||
})
|
||||
const ret = await queryTree(1)
|
||||
handleNode(ret, 3)
|
||||
treeArray.value = ret
|
||||
showTreeSkeleton.value = false
|
||||
}
|
||||
|
||||
function handleNode(nodes: any[], level: number) {
|
||||
nodes.forEach((node) => {
|
||||
node.key = node.id
|
||||
if (node.level < level) {
|
||||
node.disabled = true
|
||||
}
|
||||
if (node.children) {
|
||||
handleNode(node.children, level)
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
onMounted(loadTree);
|
||||
</script>
|
||||
|
||||
@@ -59,8 +64,7 @@ onMounted(loadTree);
|
||||
<Skeleton :loading="showTreeSkeleton" :paragraph="{ rows: 8 }" active class="p-[8px] flex-1 min-h-0">
|
||||
<div class="bg-background flex h-full flex-col overflow-y-auto rounded-lg">
|
||||
<div class="h-full overflow-x-hidden px-[8px]">
|
||||
<Tree v-bind="$attrs" v-if="treeArray.length > 0" v-model:selected-keys="selectFloorId"
|
||||
:field-names="{ title: 'label', key: 'id' }" :show-line="{ showLeafIcon: false }" :tree-data="treeArray"
|
||||
<Tree v-bind="$attrs" v-if="treeArray.length > 0" :show-line="{ showLeafIcon: false }" :tree-data="treeArray"
|
||||
:virtual="false" default-expand-all @select="$emit('select')">
|
||||
<template #title="{ label }">
|
||||
<span v-if="label.indexOf(searchValue) > -1">
|
||||
|
@@ -1,112 +1,3 @@
|
||||
<template>
|
||||
<Page :auto-content-height="true">
|
||||
<div class="flex h-full gap-[8px]">
|
||||
<FloorTree class="w-[260px]"></FloorTree>
|
||||
<div class="flex-1 overflow-hidden">
|
||||
<div class="row">
|
||||
<div class="comparison-section-container">
|
||||
<div class="section-header">
|
||||
<div class="header-title">环比</div>
|
||||
</div>
|
||||
<div class="comparison-grid">
|
||||
<div class="comparison-item">
|
||||
<div class="item-value">{{ chainData.todayEnergy }}</div>
|
||||
<div class="item-title">今日用能(kW.h)</div>
|
||||
</div>
|
||||
<div class="comparison-item">
|
||||
<div class="item-value">{{ chainData.yesterdaySamePeriodEnergy }}</div>
|
||||
<div class="item-title">昨日同期(kW.h)</div>
|
||||
</div>
|
||||
<div class="comparison-item">
|
||||
<div class="item-top">
|
||||
<div class="item-percent">{{ chainData.dayTrendPercentage }}</div>
|
||||
<div>{{ chainData.dayTrendValue }}<span class="item-unit">kW.h</span></div>
|
||||
</div>
|
||||
<div class="item-title">趋势</div>
|
||||
</div>
|
||||
<div class="comparison-item">
|
||||
<div class="item-value">{{ chainData.currentMonthEnergy }}</div>
|
||||
<div class="item-title">当月用能(kW.h)</div>
|
||||
</div>
|
||||
<div class="comparison-item">
|
||||
<div class="item-value">{{ chainData.lastMonthSamePeriodEnergy }}</div>
|
||||
<div class="item-title">上月同期(kW.h)</div>
|
||||
</div>
|
||||
<div class="comparison-item">
|
||||
<div class="item-top">
|
||||
<div class="item-percent">{{ chainData.monthTrendPercentage }}</div>
|
||||
<div>{{ chainData.monthTrendValue }}
|
||||
<span class="item-title">kW.h</span>
|
||||
</div>
|
||||
</div>
|
||||
<div class="item-title">趋势</div>
|
||||
</div>
|
||||
<div class="comparison-item">
|
||||
<div class="item-value">{{ chainData.currentYearEnergy }}</div>
|
||||
<div class="item-title">当年用能(kW.h)</div>
|
||||
|
||||
</div>
|
||||
<div class="comparison-item">
|
||||
<div class="item-value">{{ chainData.lastYearSamePeriodEnergy }}</div>
|
||||
<div class="item-title">去年同期(kW.h)</div>
|
||||
</div>
|
||||
<div class="comparison-item">
|
||||
<div class="item-top">
|
||||
<div class="item-percent">{{ chainData.yearTrendPercentage }}</div>
|
||||
<div>{{ chainData.yearTrendValue }}
|
||||
<span class="item-title">kW.h</span>
|
||||
</div>
|
||||
</div>
|
||||
<div class="item-title">趋势</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="energy-trend-container">
|
||||
<div class="energy-trend-top">
|
||||
<div class="section-header">
|
||||
<div class="header-title">能耗趋势</div>
|
||||
</div>
|
||||
<RadioGroup v-model:value="energyTrendTime" button-style="solid" size="small"
|
||||
@change="buildingEnergyTrendData(energyTrendTime)">
|
||||
<RadioButton value="1">当日</RadioButton>
|
||||
<RadioButton value="2">当月</RadioButton>
|
||||
<RadioButton value="3">当年</RadioButton>
|
||||
</RadioGroup>
|
||||
</div>
|
||||
<div class="chart-placeholder" ref="energyTrendChart">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="power-curve-container">
|
||||
<div class="section-header">
|
||||
<div class="header-title">日用电功率曲线</div>
|
||||
</div>
|
||||
<!-- <div class="chart-placeholder" ref="powerCurveChart">-->
|
||||
<div class="power-chart" ref="powerCurveChart">
|
||||
</div>
|
||||
</div>
|
||||
<div class="power-peak-container">
|
||||
<div class="section-header">
|
||||
<div class="header-title">电功率峰值</div>
|
||||
</div>
|
||||
<div class="peak-item">
|
||||
<p class="value">{{ peakData.todayPeakPower }}</p>
|
||||
<p class="time">{{ peakData.todayPeakTime }}</p>
|
||||
<div class="bottom-text">当日(kW)</div>
|
||||
</div>
|
||||
<div class="peak-item">
|
||||
<p class="value">{{ peakData.yesterdayPeakPower }}</p>
|
||||
<p class="time">{{ peakData.yesterdayPeakTime }}</p>
|
||||
<div class="bottom-text">昨日(kW)</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</Page>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { RadioGroup, RadioButton } from 'ant-design-vue'
|
||||
import { Page } from '@vben/common-ui'
|
||||
@@ -116,6 +7,9 @@ import type { ECharts, EChartsOption } from 'echarts'
|
||||
import FloorTree from "../components/floor-tree.vue"
|
||||
import dayjs from "dayjs"
|
||||
|
||||
// 左边楼层用
|
||||
const selectFloorId = ref<string[]>([])
|
||||
|
||||
const chainData = reactive({
|
||||
todayEnergy: '231.78',
|
||||
yesterdaySamePeriodEnergy: '269.56',
|
||||
@@ -235,7 +129,6 @@ function buildingEnergyTrendData(val: string) {
|
||||
const powerCurveChart = ref<HTMLElement | null>(null)
|
||||
const powerCurveInstance = ref<ECharts | null>(null)
|
||||
|
||||
|
||||
const powerCurveOption: EChartsOption = {
|
||||
tooltip: {
|
||||
trigger: 'item',
|
||||
@@ -355,8 +248,121 @@ onBeforeUnmount(() => {
|
||||
energyTrendInstance.value?.dispose()
|
||||
powerCurveInstance.value?.dispose()
|
||||
})
|
||||
|
||||
function handleSelectFloor() {
|
||||
console.log(selectFloorId.value[0])
|
||||
}
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<Page :auto-content-height="true">
|
||||
<div class="flex h-full gap-[8px]">
|
||||
<FloorTree class="w-[260px]"></FloorTree>
|
||||
<div class="flex-1 overflow-hidden">
|
||||
<div class="row">
|
||||
<div class="comparison-section-container">
|
||||
<div class="section-header">
|
||||
<div class="header-title">环比</div>
|
||||
</div>
|
||||
<div class="comparison-grid">
|
||||
<div class="comparison-item">
|
||||
<div class="item-value">{{ chainData.todayEnergy }}</div>
|
||||
<div class="item-title">今日用能(kW.h)</div>
|
||||
</div>
|
||||
<div class="comparison-item">
|
||||
<div class="item-value">{{ chainData.yesterdaySamePeriodEnergy }}</div>
|
||||
<div class="item-title">昨日同期(kW.h)</div>
|
||||
</div>
|
||||
<div class="comparison-item">
|
||||
<div class="item-top">
|
||||
<div class="item-percent">{{ chainData.dayTrendPercentage }}</div>
|
||||
<div>{{ chainData.dayTrendValue }}<span class="item-unit">kW.h</span></div>
|
||||
</div>
|
||||
<div class="item-title">趋势</div>
|
||||
</div>
|
||||
<div class="comparison-item">
|
||||
<div class="item-value">{{ chainData.currentMonthEnergy }}</div>
|
||||
<div class="item-title">当月用能(kW.h)</div>
|
||||
</div>
|
||||
<div class="comparison-item">
|
||||
<div class="item-value">{{ chainData.lastMonthSamePeriodEnergy }}</div>
|
||||
<div class="item-title">上月同期(kW.h)</div>
|
||||
</div>
|
||||
<div class="comparison-item">
|
||||
<div class="item-top">
|
||||
<div class="item-percent">{{ chainData.monthTrendPercentage }}</div>
|
||||
<div>{{ chainData.monthTrendValue }}
|
||||
<span class="item-title">kW.h</span>
|
||||
</div>
|
||||
</div>
|
||||
<div class="item-title">趋势</div>
|
||||
</div>
|
||||
<div class="comparison-item">
|
||||
<div class="item-value">{{ chainData.currentYearEnergy }}</div>
|
||||
<div class="item-title">当年用能(kW.h)</div>
|
||||
|
||||
</div>
|
||||
<div class="comparison-item">
|
||||
<div class="item-value">{{ chainData.lastYearSamePeriodEnergy }}</div>
|
||||
<div class="item-title">去年同期(kW.h)</div>
|
||||
</div>
|
||||
<div class="comparison-item">
|
||||
<div class="item-top">
|
||||
<div class="item-percent">{{ chainData.yearTrendPercentage }}</div>
|
||||
<div>{{ chainData.yearTrendValue }}
|
||||
<span class="item-title">kW.h</span>
|
||||
</div>
|
||||
</div>
|
||||
<div class="item-title">趋势</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="energy-trend-container">
|
||||
<div class="energy-trend-top">
|
||||
<div class="section-header">
|
||||
<div class="header-title">能耗趋势</div>
|
||||
</div>
|
||||
<RadioGroup v-model:value="energyTrendTime" button-style="solid" size="small"
|
||||
@change="buildingEnergyTrendData(energyTrendTime)">
|
||||
<RadioButton value="1">当日</RadioButton>
|
||||
<RadioButton value="2">当月</RadioButton>
|
||||
<RadioButton value="3">当年</RadioButton>
|
||||
</RadioGroup>
|
||||
</div>
|
||||
<div class="chart-placeholder" ref="energyTrendChart">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="power-curve-container">
|
||||
<div class="section-header">
|
||||
<div class="header-title">日用电功率曲线</div>
|
||||
</div>
|
||||
<!-- <div class="chart-placeholder" ref="powerCurveChart">-->
|
||||
<div class="power-chart" ref="powerCurveChart">
|
||||
</div>
|
||||
</div>
|
||||
<div class="power-peak-container">
|
||||
<div class="section-header">
|
||||
<div class="header-title">电功率峰值</div>
|
||||
</div>
|
||||
<div class="peak-item">
|
||||
<p class="value">{{ peakData.todayPeakPower }}</p>
|
||||
<p class="time">{{ peakData.todayPeakTime }}</p>
|
||||
<div class="bottom-text">当日(kW)</div>
|
||||
</div>
|
||||
<div class="peak-item">
|
||||
<p class="value">{{ peakData.yesterdayPeakPower }}</p>
|
||||
<p class="time">{{ peakData.yesterdayPeakTime }}</p>
|
||||
<div class="bottom-text">昨日(kW)</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</Page>
|
||||
</template>
|
||||
|
||||
<style scoped>
|
||||
.row {
|
||||
display: flex;
|
||||
|
@@ -4,8 +4,17 @@ import type { VxeGridProps } from '#/adapter/vxe-table'
|
||||
import { getDictOptions } from '#/utils/dict'
|
||||
import { renderDict } from '#/utils/render'
|
||||
|
||||
export function initMoalForm(type: number) {
|
||||
const modalSchema: FormSchemaGetter = () => [
|
||||
export function initDrawerForm(type: number) {
|
||||
const drawerSchema: FormSchemaGetter = () => [
|
||||
{
|
||||
label: '主键id',
|
||||
fieldName: 'id',
|
||||
component: 'Input',
|
||||
dependencies: {
|
||||
show: () => false,
|
||||
triggerFields: [''],
|
||||
},
|
||||
},
|
||||
{
|
||||
label: '仪表名称',
|
||||
fieldName: 'meterName',
|
||||
@@ -13,14 +22,28 @@ export function initMoalForm(type: number) {
|
||||
rules: 'selectRequired',
|
||||
},
|
||||
{
|
||||
label: '仪表编码',
|
||||
fieldName: 'meterCode',
|
||||
label: '楼层',
|
||||
fieldName: 'floorId',
|
||||
component: 'TreeSelect',
|
||||
defaultValue: undefined,
|
||||
rules: 'required',
|
||||
},
|
||||
{
|
||||
label: '安装位置',
|
||||
fieldName: 'installLocation',
|
||||
component: 'Input',
|
||||
},
|
||||
{
|
||||
label: '设备厂商',
|
||||
fieldName: 'factoryNo',
|
||||
label: '仪表编码',
|
||||
fieldName: 'meterCode',
|
||||
component: 'Input',
|
||||
rules: 'required',
|
||||
},
|
||||
{
|
||||
label: '采集器IP',
|
||||
fieldName: 'hostIp',
|
||||
component: 'Input',
|
||||
rules: 'required',
|
||||
},
|
||||
{
|
||||
label: type === 1 ? '设备类型(电表)' : type === 2 ? '设备类型(水表)' : '设备类型(气表)',
|
||||
@@ -46,11 +69,6 @@ export function initMoalForm(type: number) {
|
||||
},
|
||||
rules: 'selectRequired',
|
||||
},
|
||||
{
|
||||
label: '安装位置',
|
||||
fieldName: 'installLocation',
|
||||
component: 'Input',
|
||||
},
|
||||
{
|
||||
label: '初始读数',
|
||||
fieldName: 'initReading',
|
||||
@@ -70,15 +88,15 @@ export function initMoalForm(type: number) {
|
||||
options: getDictOptions('sis_device_status'),
|
||||
},
|
||||
},
|
||||
{
|
||||
label: '运行状态',
|
||||
fieldName: 'runningState',
|
||||
component: 'Select',
|
||||
componentProps: {
|
||||
// 可选从DictEnum中获取 DictEnum.SIS_DEVICE_STATUS 便于维护
|
||||
options: getDictOptions('sis_device_status'),
|
||||
},
|
||||
},
|
||||
// {
|
||||
// label: '运行状态',
|
||||
// fieldName: 'runningState',
|
||||
// component: 'Select',
|
||||
// componentProps: {
|
||||
// // 可选从DictEnum中获取 DictEnum.SIS_DEVICE_STATUS 便于维护
|
||||
// options: getDictOptions('sis_device_status'),
|
||||
// },
|
||||
// },
|
||||
{
|
||||
label: '备注',
|
||||
fieldName: 'remark',
|
||||
@@ -86,7 +104,7 @@ export function initMoalForm(type: number) {
|
||||
},
|
||||
]
|
||||
|
||||
return modalSchema
|
||||
return drawerSchema
|
||||
}
|
||||
|
||||
export function initQuerySchema(type: number) {
|
||||
@@ -131,10 +149,10 @@ export function initColumns(type: number) {
|
||||
title: '仪表编码',
|
||||
field: 'meterCode',
|
||||
},
|
||||
{
|
||||
title: '设备厂商',
|
||||
field: 'factoryNo',
|
||||
},
|
||||
// {
|
||||
// title: '设备厂商',
|
||||
// field: 'factoryNo',
|
||||
// },
|
||||
{
|
||||
title: type === 1 ? '设备类型(电表)' : type === 2 ? '设备类型(水表)' : '设备类型(气表)',
|
||||
field: 'meterType',
|
||||
@@ -155,6 +173,10 @@ export function initColumns(type: number) {
|
||||
},
|
||||
},
|
||||
},
|
||||
{
|
||||
title: '楼层',
|
||||
field: 'floorName',
|
||||
},
|
||||
{
|
||||
title: '安装位置',
|
||||
field: 'installLocation',
|
||||
@@ -177,16 +199,16 @@ export function initColumns(type: number) {
|
||||
},
|
||||
},
|
||||
},
|
||||
{
|
||||
title: '运行状态',
|
||||
field: 'runningState',
|
||||
slots: {
|
||||
default: ({ row }) => {
|
||||
// 可选从DictEnum中获取 DictEnum.SIS_DEVICE_STATUS 便于维护
|
||||
return renderDict(row.runningState, 'sis_device_status')
|
||||
},
|
||||
},
|
||||
},
|
||||
// {
|
||||
// title: '运行状态',
|
||||
// field: 'runningState',
|
||||
// slots: {
|
||||
// default: ({ row }) => {
|
||||
// // 可选从DictEnum中获取 DictEnum.SIS_DEVICE_STATUS 便于维护
|
||||
// return renderDict(row.runningState, 'sis_device_status')
|
||||
// },
|
||||
// },
|
||||
// },
|
||||
{
|
||||
title: '备注',
|
||||
field: 'remark',
|
||||
|
@@ -1,17 +1,20 @@
|
||||
<script setup lang="ts">
|
||||
import { computed, ref } from "vue"
|
||||
|
||||
import { useVbenModal } from "@vben/common-ui"
|
||||
import { useVbenDrawer } from "@vben/common-ui"
|
||||
import { $t } from "@vben/locales"
|
||||
import { cloneDeep } from "@vben/utils"
|
||||
import { cloneDeep, getPopupContainer, handleNode } from '@vben/utils'
|
||||
|
||||
import { useVbenForm } from "#/adapter/form"
|
||||
import { communityTree } from '#/api/property/community'
|
||||
import { defaultFormValueGetter, useBeforeCloseDiff } from "#/utils/popup"
|
||||
|
||||
import {
|
||||
meterInfoAdd,
|
||||
meterInfoInfo,
|
||||
meterInfoUpdate,
|
||||
} from "#/api/property/energyManagement/meterInfo"
|
||||
import { defaultFormValueGetter, useBeforeCloseDiff } from "#/utils/popup"
|
||||
|
||||
|
||||
const props = defineProps({
|
||||
meterType: {
|
||||
@@ -20,8 +23,8 @@ const props = defineProps({
|
||||
},
|
||||
})
|
||||
|
||||
import { initMoalForm } from "./data"
|
||||
const modalSchema = initMoalForm(props.meterType)
|
||||
import { initDrawerForm } from "./data"
|
||||
const drawerSchema = initDrawerForm(props.meterType)
|
||||
|
||||
const emit = defineEmits<{ reload: [] }>()
|
||||
const isUpdate = ref(false)
|
||||
@@ -32,7 +35,7 @@ const title = computed(() => {
|
||||
const [BasicForm, formApi] = useVbenForm({
|
||||
commonConfig: {
|
||||
// 默认占满两列
|
||||
formItemClass: "col-span-1",
|
||||
formItemClass: "col-span-2",
|
||||
// 默认label宽度 px
|
||||
labelWidth: 120,
|
||||
|
||||
@@ -41,7 +44,7 @@ const [BasicForm, formApi] = useVbenForm({
|
||||
class: "w-full",
|
||||
},
|
||||
},
|
||||
schema: modalSchema(),
|
||||
schema: drawerSchema(),
|
||||
showDefaultActions: false,
|
||||
wrapperClass: "grid-cols-2",
|
||||
})
|
||||
@@ -53,9 +56,9 @@ const { onBeforeClose, markInitialized, resetInitialized } = useBeforeCloseDiff(
|
||||
}
|
||||
)
|
||||
|
||||
const [BasicModal, modalApi] = useVbenModal({
|
||||
const [BasicModal, modalApi] = useVbenDrawer({
|
||||
// 在这里更改宽度
|
||||
class: "w-[900px]",
|
||||
class: "w-[600px]",
|
||||
fullscreenButton: false,
|
||||
onBeforeClose,
|
||||
onClosed: handleClosed,
|
||||
@@ -64,11 +67,11 @@ const [BasicModal, modalApi] = useVbenModal({
|
||||
if (!isOpen) {
|
||||
return null
|
||||
}
|
||||
modalApi.modalLoading(true)
|
||||
modalApi.drawerLoading(true)
|
||||
|
||||
const { id } = modalApi.getData() as { id?: number | string }
|
||||
isUpdate.value = !!id
|
||||
|
||||
setupCommunitySelect()
|
||||
if (isUpdate.value && id) {
|
||||
const record = await meterInfoInfo(id)
|
||||
record.meterType = record.meterType.toString()
|
||||
@@ -79,7 +82,7 @@ const [BasicModal, modalApi] = useVbenModal({
|
||||
}
|
||||
await markInitialized()
|
||||
|
||||
modalApi.modalLoading(false)
|
||||
modalApi.drawerLoading(false)
|
||||
},
|
||||
})
|
||||
|
||||
@@ -107,6 +110,44 @@ async function handleClosed() {
|
||||
await formApi.resetForm()
|
||||
resetInitialized()
|
||||
}
|
||||
|
||||
/**
|
||||
* 初始化城市
|
||||
*/
|
||||
async function setupCommunitySelect() {
|
||||
const areaList = await communityTree(3)
|
||||
// 选中后显示在输入框的值 即父节点 / 子节点
|
||||
// addFullName(areaList, 'areaName', ' / ');
|
||||
const splitStr = '/'
|
||||
handleNode(areaList, 'label', splitStr, function (node: any) {
|
||||
if (node.level != 3) {
|
||||
node.disabled = true
|
||||
}
|
||||
})
|
||||
formApi.updateSchema([
|
||||
{
|
||||
componentProps: () => ({
|
||||
fieldNames: {
|
||||
key: 'id',
|
||||
label: 'label',
|
||||
value: 'code',
|
||||
children: 'children',
|
||||
},
|
||||
getPopupContainer,
|
||||
placeholder: '请选择建筑',
|
||||
showSearch: true,
|
||||
treeData: areaList,
|
||||
treeDefaultExpandAll: true,
|
||||
treeLine: { showLeafIcon: false },
|
||||
// 筛选的字段
|
||||
treeNodeFilterProp: 'label',
|
||||
// 选中后显示在输入框的值
|
||||
treeNodeLabelProp: 'fullName',
|
||||
}),
|
||||
fieldName: 'floorId',
|
||||
},
|
||||
])
|
||||
}
|
||||
</script>
|
||||
|
||||
<template>
|
@@ -3,7 +3,7 @@ import type { Recordable } from "@vben/types"
|
||||
|
||||
import { ref } from "vue"
|
||||
|
||||
import { Page, useVbenModal, type VbenFormProps } from "@vben/common-ui"
|
||||
import { Page, useVbenDrawer, type VbenFormProps } from "@vben/common-ui"
|
||||
import { getVxePopupContainer } from "@vben/utils"
|
||||
|
||||
import { Modal, Popconfirm, Space } from "ant-design-vue"
|
||||
@@ -23,7 +23,7 @@ import {
|
||||
import type { MeterInfoForm } from "#/api/property/meterInfo/model"
|
||||
import { commonDownloadExcel } from "#/utils/file/download"
|
||||
|
||||
import meterInfoModal from "../components/meterInfo-modal.vue"
|
||||
import meterInfoDrawer from "../components/meterInfo-drawer.vue"
|
||||
import { initQuerySchema, initColumns } from "../components/data"
|
||||
const columns = initColumns(3)
|
||||
const querySchema = initQuerySchema(3)
|
||||
@@ -86,8 +86,8 @@ const [BasicTable, tableApi] = useVbenVxeGrid({
|
||||
gridOptions,
|
||||
})
|
||||
|
||||
const [MeterInfoModal, modalApi] = useVbenModal({
|
||||
connectedComponent: meterInfoModal,
|
||||
const [MeterInfoDrawer, modalApi] = useVbenDrawer({
|
||||
connectedComponent: meterInfoDrawer,
|
||||
})
|
||||
|
||||
function handleAdd() {
|
||||
@@ -162,6 +162,6 @@ function handleDownloadExcel() {
|
||||
</Space>
|
||||
</template>
|
||||
</BasicTable>
|
||||
<MeterInfoModal @reload="tableApi.query()" :meterType="3" />
|
||||
<MeterInfoDrawer @reload="tableApi.query()" :meterType="3" />
|
||||
</Page>
|
||||
</template>
|
||||
|
@@ -3,7 +3,7 @@ import type { Recordable } from '@vben/types'
|
||||
|
||||
import { ref } from 'vue'
|
||||
|
||||
import { Page, useVbenModal, type VbenFormProps } from '@vben/common-ui'
|
||||
import { Page, useVbenDrawer, type VbenFormProps } from '@vben/common-ui'
|
||||
import { getVxePopupContainer } from '@vben/utils'
|
||||
|
||||
import { Modal, Popconfirm, Space } from 'ant-design-vue'
|
||||
@@ -23,7 +23,7 @@ import {
|
||||
import type { MeterInfoForm } from '#/api/property/meterInfo/model'
|
||||
import { commonDownloadExcel } from '#/utils/file/download'
|
||||
|
||||
import meterInfoModal from "../components/meterInfo-modal.vue"
|
||||
import meterInfoDrawer from "../components/meterInfo-drawer.vue"
|
||||
import { initQuerySchema, initColumns } from "../components/data"
|
||||
const columns = initColumns(1)
|
||||
const querySchema = initQuerySchema(1)
|
||||
@@ -86,8 +86,8 @@ const [BasicTable, tableApi] = useVbenVxeGrid({
|
||||
gridOptions,
|
||||
})
|
||||
|
||||
const [MeterInfoModal, modalApi] = useVbenModal({
|
||||
connectedComponent: meterInfoModal,
|
||||
const [MeterInfoDrawer, modalApi] = useVbenDrawer({
|
||||
connectedComponent: meterInfoDrawer,
|
||||
})
|
||||
|
||||
function handleAdd() {
|
||||
@@ -157,6 +157,6 @@ function handleDownloadExcel() {
|
||||
</Space>
|
||||
</template>
|
||||
</BasicTable>
|
||||
<MeterInfoModal @reload="tableApi.query()" :meterType="1" />
|
||||
<MeterInfoDrawer @reload="tableApi.query()" :meterType="1" />
|
||||
</Page>
|
||||
</template>
|
||||
|
@@ -3,7 +3,7 @@ import type { Recordable } from '@vben/types'
|
||||
|
||||
import { ref } from 'vue'
|
||||
|
||||
import { Page, useVbenModal, type VbenFormProps } from '@vben/common-ui'
|
||||
import { Page, useVbenDrawer, type VbenFormProps } from '@vben/common-ui'
|
||||
import { getVxePopupContainer } from '@vben/utils'
|
||||
|
||||
import { Modal, Popconfirm, Space } from 'ant-design-vue'
|
||||
@@ -23,7 +23,7 @@ import {
|
||||
import type { MeterInfoForm } from '#/api/property/meterInfo/model'
|
||||
import { commonDownloadExcel } from '#/utils/file/download'
|
||||
|
||||
import meterInfoModal from "../components/meterInfo-modal.vue"
|
||||
import meterInfoDrawer from "../components/meterInfo-drawer.vue"
|
||||
import { initQuerySchema, initColumns } from "../components/data"
|
||||
const columns = initColumns(2)
|
||||
const querySchema = initQuerySchema(2)
|
||||
@@ -86,8 +86,8 @@ const [BasicTable, tableApi] = useVbenVxeGrid({
|
||||
gridOptions,
|
||||
})
|
||||
|
||||
const [MeterInfoModal, modalApi] = useVbenModal({
|
||||
connectedComponent: meterInfoModal,
|
||||
const [MeterInfoDrawer, modalApi] = useVbenDrawer({
|
||||
connectedComponent: meterInfoDrawer,
|
||||
})
|
||||
|
||||
function handleAdd() {
|
||||
@@ -157,6 +157,6 @@ function handleDownloadExcel() {
|
||||
</Space>
|
||||
</template>
|
||||
</BasicTable>
|
||||
<MeterInfoModal @reload="tableApi.query()" :meterType="2" />
|
||||
<MeterInfoDrawer @reload="tableApi.query()" :meterType="2" />
|
||||
</Page>
|
||||
</template>
|
||||
|
@@ -0,0 +1,157 @@
|
||||
import type { FormSchemaGetter } from '#/adapter/form'
|
||||
import type { VxeGridProps } from '#/adapter/vxe-table'
|
||||
import { getDictOptions } from '#/utils/dict'
|
||||
import { renderDict } from '#/utils/render'
|
||||
|
||||
export const querySchema: FormSchemaGetter = () => [
|
||||
{
|
||||
component: 'Select',
|
||||
componentProps: {
|
||||
// 可选从DictEnum中获取 DictEnum.METER_TYPE 便于维护
|
||||
options: getDictOptions('meter_type'),
|
||||
},
|
||||
fieldName: 'meterType',
|
||||
label: '设备类型',
|
||||
},
|
||||
{
|
||||
component: 'DatePicker',
|
||||
componentProps: {
|
||||
showTime: true,
|
||||
format: 'YYYY-MM-DD HH:mm:ss',
|
||||
valueFormat: 'YYYY-MM-DD HH:mm:ss',
|
||||
},
|
||||
fieldName: 'readingTime',
|
||||
label: '抄表时间',
|
||||
},
|
||||
{
|
||||
component: 'Select',
|
||||
componentProps: {
|
||||
// 可选从DictEnum中获取 DictEnum.METER_TYPE 便于维护
|
||||
options: getDictOptions('meter_record_type'),
|
||||
},
|
||||
fieldName: 'readingMethod',
|
||||
label: '抄表方式',
|
||||
},
|
||||
]
|
||||
|
||||
// 需要使用i18n注意这里要改成getter形式 否则切换语言不会刷新
|
||||
// export const columns: () => VxeGridProps['columns'] = () => [
|
||||
export const columns: VxeGridProps['columns'] = [
|
||||
{ type: 'checkbox', width: 60 },
|
||||
{
|
||||
title: '仪表编号',
|
||||
field: 'meterId',
|
||||
},
|
||||
{
|
||||
title: '仪表类型',
|
||||
field: 'meterType',
|
||||
slots: {
|
||||
default: ({ row }) => {
|
||||
// 可选从DictEnum中获取 DictEnum.SIS_DEVICE_STATUS 便于维护
|
||||
return renderDict(row.meterType, 'meter_type')
|
||||
},
|
||||
},
|
||||
},
|
||||
{
|
||||
title: '抄表员ID',
|
||||
field: 'readerId',
|
||||
},
|
||||
{
|
||||
title: '抄表时间',
|
||||
field: 'readingTime',
|
||||
},
|
||||
{
|
||||
title: '当前读数',
|
||||
field: 'currentReading',
|
||||
},
|
||||
{
|
||||
title: '上次读数',
|
||||
field: 'previousReading',
|
||||
},
|
||||
{
|
||||
title: '用量',
|
||||
field: 'consumption',
|
||||
},
|
||||
{
|
||||
title: '抄表方式',
|
||||
field: 'readingMethod',
|
||||
slots: {
|
||||
default: ({ row }) => {
|
||||
// 可选从DictEnum中获取 DictEnum.SIS_DEVICE_STATUS 便于维护
|
||||
return renderDict(row.readingMethod, 'meter_record_type')
|
||||
},
|
||||
},
|
||||
},
|
||||
{
|
||||
title: '抄表照片',
|
||||
field: 'imgOssid',
|
||||
},
|
||||
{
|
||||
field: 'action',
|
||||
fixed: 'right',
|
||||
slots: { default: 'action' },
|
||||
title: '操作',
|
||||
width: 180,
|
||||
},
|
||||
]
|
||||
|
||||
export const drawerSchema: FormSchemaGetter = () => [
|
||||
{
|
||||
label: '记录ID',
|
||||
fieldName: 'id',
|
||||
component: 'Input',
|
||||
dependencies: {
|
||||
show: () => false,
|
||||
triggerFields: [''],
|
||||
},
|
||||
},
|
||||
{
|
||||
label: '仪表编号',
|
||||
fieldName: 'meterId',
|
||||
component: 'Input',
|
||||
rules: 'required',
|
||||
},
|
||||
// {
|
||||
// label: '抄表员ID',
|
||||
// fieldName: 'readerId',
|
||||
// component: 'Input',
|
||||
// rules: 'required',
|
||||
// },
|
||||
{
|
||||
label: '抄表时间',
|
||||
fieldName: 'readingTime',
|
||||
component: 'DatePicker',
|
||||
componentProps: {
|
||||
showTime: true,
|
||||
format: 'YYYY-MM-DD HH:mm:ss',
|
||||
valueFormat: 'YYYY-MM-DD HH:mm:ss',
|
||||
},
|
||||
rules: 'required',
|
||||
},
|
||||
{
|
||||
label: '当前读数',
|
||||
fieldName: 'currentReading',
|
||||
component: 'Input',
|
||||
rules: 'required',
|
||||
},
|
||||
{
|
||||
label: '上次读数',
|
||||
fieldName: 'previousReading',
|
||||
component: 'Input',
|
||||
rules: 'required',
|
||||
},
|
||||
{
|
||||
component: 'Select',
|
||||
componentProps: {
|
||||
// 可选从DictEnum中获取 DictEnum.METER_TYPE 便于维护
|
||||
options: getDictOptions('meter_record_type'),
|
||||
},
|
||||
fieldName: 'readingMethod',
|
||||
label: '抄表方式',
|
||||
},
|
||||
// {
|
||||
// label: '抄表照片',
|
||||
// fieldName: 'imgOssid',
|
||||
// component: 'Input',
|
||||
// },
|
||||
]
|
@@ -1,29 +1,50 @@
|
||||
<script setup lang="ts">
|
||||
import type { VbenFormProps } from '@vben/common-ui';
|
||||
import type { Recordable } from '@vben/types';
|
||||
|
||||
import type { VxeGridProps } from '#/adapter/vxe-table';
|
||||
|
||||
import { ref } from 'vue';
|
||||
|
||||
import { Page, useVbenModal } from '@vben/common-ui';
|
||||
import { getPopupContainer } from '@vben/utils';
|
||||
import { Page, useVbenDrawer, type VbenFormProps } from '@vben/common-ui';
|
||||
import { getVxePopupContainer } from '@vben/utils';
|
||||
|
||||
import { Modal, Popconfirm, Space } from 'ant-design-vue';
|
||||
import dayjs from 'dayjs';
|
||||
|
||||
import { useVbenVxeGrid, vxeCheckboxChecked } from '#/adapter/vxe-table';
|
||||
import {
|
||||
useVbenVxeGrid,
|
||||
vxeCheckboxChecked,
|
||||
type VxeGridProps
|
||||
} from '#/adapter/vxe-table';
|
||||
|
||||
import {
|
||||
meterRecordExport,
|
||||
meterRecordList,
|
||||
meterRecordRemove,
|
||||
} from '#/api/property/energyManagement/meterRecord';
|
||||
|
||||
import type { MeterRecordForm } from '#/api/property/energyManagement/meterRecord/model';
|
||||
import { commonDownloadExcel } from '#/utils/file/download';
|
||||
|
||||
import { demoExport, demoList, demoRemove } from './api';
|
||||
import meterRecordDrawer from './meterRecord-drawer.vue';
|
||||
import { columns, querySchema } from './data';
|
||||
import demoModal from './demo-modal.vue';
|
||||
|
||||
const formOptions: VbenFormProps = {
|
||||
commonConfig: {
|
||||
labelWidth: 80,
|
||||
componentProps: {
|
||||
allowClear: true,
|
||||
},
|
||||
},
|
||||
schema: querySchema(),
|
||||
wrapperClass: 'grid-cols-1 md:grid-cols-2 lg:grid-cols-3 xl:grid-cols-4',
|
||||
// 处理区间选择器RangePicker时间格式 将一个字段映射为两个字段 搜索/导出会用到
|
||||
// 不需要直接删除
|
||||
// fieldMappingTime: [
|
||||
// [
|
||||
// 'createTime',
|
||||
// ['params[beginTime]', 'params[endTime]'],
|
||||
// ['YYYY-MM-DD 00:00:00', 'YYYY-MM-DD 23:59:59'],
|
||||
// ],
|
||||
// ],
|
||||
};
|
||||
|
||||
const gridOptions: VxeGridProps = {
|
||||
@@ -35,6 +56,8 @@ const gridOptions: VxeGridProps = {
|
||||
// 点击行选中
|
||||
// trigger: 'row',
|
||||
},
|
||||
// 需要使用i18n注意这里要改成getter形式 否则切换语言不会刷新
|
||||
// columns: columns(),
|
||||
columns,
|
||||
height: 'auto',
|
||||
keepSource: true,
|
||||
@@ -42,7 +65,7 @@ const gridOptions: VxeGridProps = {
|
||||
proxyConfig: {
|
||||
ajax: {
|
||||
query: async ({ page }, formValues = {}) => {
|
||||
return await demoList({
|
||||
return await meterRecordList({
|
||||
pageNum: page.currentPage,
|
||||
pageSize: page.pageSize,
|
||||
...formValues,
|
||||
@@ -51,107 +74,89 @@ const gridOptions: VxeGridProps = {
|
||||
},
|
||||
},
|
||||
rowConfig: {
|
||||
isHover: true,
|
||||
keyField: 'id',
|
||||
},
|
||||
// 表格全局唯一表示 保存列配置需要用到
|
||||
id: 'property-meterRecord-index'
|
||||
};
|
||||
|
||||
const checked = ref(false);
|
||||
const [BasicTable, tableApi] = useVbenVxeGrid({
|
||||
formOptions,
|
||||
gridOptions,
|
||||
});
|
||||
|
||||
const [DemoModal, modalApi] = useVbenModal({
|
||||
connectedComponent: demoModal,
|
||||
const [MeterRecordDrawer, drawerApi] = useVbenDrawer({
|
||||
connectedComponent: meterRecordDrawer,
|
||||
});
|
||||
|
||||
function handleAdd() {
|
||||
modalApi.setData({});
|
||||
modalApi.open();
|
||||
drawerApi.setData({});
|
||||
drawerApi.open();
|
||||
}
|
||||
|
||||
async function handleEdit(record: Recordable<any>) {
|
||||
modalApi.setData({ id: record.id });
|
||||
modalApi.open();
|
||||
async function handleEdit(row: Required<MeterRecordForm>) {
|
||||
drawerApi.setData({ id: row.id });
|
||||
drawerApi.open();
|
||||
}
|
||||
|
||||
async function handleDelete(row: Recordable<any>) {
|
||||
await demoRemove(row.id);
|
||||
async function handleDelete(row: Required<MeterRecordForm>) {
|
||||
await meterRecordRemove(row.id);
|
||||
await tableApi.query();
|
||||
}
|
||||
|
||||
function handleMultiDelete() {
|
||||
const rows = tableApi.grid.getCheckboxRecords();
|
||||
const ids = rows.map((row: any) => row.id);
|
||||
const ids = rows.map((row: Required<MeterRecordForm>) => row.id);
|
||||
Modal.confirm({
|
||||
title: '提示',
|
||||
okType: 'danger',
|
||||
content: `确认删除选中的${ids.length}条记录吗?`,
|
||||
onOk: async () => {
|
||||
await demoRemove(ids);
|
||||
await meterRecordRemove(ids);
|
||||
await tableApi.query();
|
||||
checked.value = false;
|
||||
},
|
||||
});
|
||||
}
|
||||
|
||||
function handleDownloadExcel() {
|
||||
commonDownloadExcel(meterRecordExport, '抄表记录数据', tableApi.formApi.form.values, {
|
||||
fieldMappingTime: formOptions.fieldMappingTime,
|
||||
});
|
||||
}
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<Page :auto-content-height="true">
|
||||
<BasicTable>
|
||||
<template #toolbar-actions>
|
||||
<span class="pl-[7px] text-[16px]">测试单列表</span>
|
||||
</template>
|
||||
<BasicTable table-title="抄表记录列表">
|
||||
<template #toolbar-tools>
|
||||
<Space>
|
||||
<a-button
|
||||
v-access:code="['system:demo:export']"
|
||||
@click="
|
||||
commonDownloadExcel(
|
||||
demoExport,
|
||||
'测试单数据',
|
||||
tableApi.formApi.form.values,
|
||||
)
|
||||
"
|
||||
>
|
||||
{{ $t('pages.common.export') }}
|
||||
</a-button>
|
||||
<a-button
|
||||
:disabled="!vxeCheckboxChecked(tableApi)"
|
||||
danger
|
||||
type="primary"
|
||||
v-access:code="['system:demo:remove']"
|
||||
@click="handleMultiDelete"
|
||||
>
|
||||
v-access:code="['property:meterRecord:remove']"
|
||||
@click="handleMultiDelete">
|
||||
{{ $t('pages.common.delete') }}
|
||||
</a-button>
|
||||
<a-button
|
||||
type="primary"
|
||||
v-access:code="['system:demo:add']"
|
||||
@click="handleAdd"
|
||||
>
|
||||
{{ $t('pages.common.add') }}
|
||||
</a-button>
|
||||
</Space>
|
||||
</template>
|
||||
<template #action="{ row }">
|
||||
<Space>
|
||||
<ghost-button
|
||||
v-access:code="['system:demo:edit']"
|
||||
v-access:code="['property:meterRecord:edit']"
|
||||
@click.stop="handleEdit(row)"
|
||||
>
|
||||
{{ $t('pages.common.edit') }}
|
||||
</ghost-button>
|
||||
<Popconfirm
|
||||
:get-popup-container="getPopupContainer"
|
||||
:get-popup-container="getVxePopupContainer"
|
||||
placement="left"
|
||||
title="确认删除?"
|
||||
@confirm="handleDelete(row)"
|
||||
>
|
||||
<ghost-button
|
||||
danger
|
||||
v-access:code="['system:demo:remove']"
|
||||
v-access:code="['property:meterRecord:remove']"
|
||||
@click.stop=""
|
||||
>
|
||||
{{ $t('pages.common.delete') }}
|
||||
@@ -160,6 +165,6 @@ function handleMultiDelete() {
|
||||
</Space>
|
||||
</template>
|
||||
</BasicTable>
|
||||
<DemoModal @reload="tableApi.query()" />
|
||||
<MeterRecordDrawer @reload="tableApi.query()" />
|
||||
</Page>
|
||||
</template>
|
@@ -1,14 +1,15 @@
|
||||
<script setup lang="ts">
|
||||
import { computed, ref } from 'vue';
|
||||
|
||||
import { useVbenModal } from '@vben/common-ui';
|
||||
import { useVbenDrawer } from '@vben/common-ui';
|
||||
import { $t } from '@vben/locales';
|
||||
import { cloneDeep } from '@vben/utils';
|
||||
|
||||
import { useVbenForm } from '#/adapter/form';
|
||||
import { meterRecordAdd, meterRecordInfo, meterRecordUpdate } from '#/api/property/energyManagement/meterRecord';
|
||||
import { defaultFormValueGetter, useBeforeCloseDiff } from '#/utils/popup';
|
||||
|
||||
import { demoAdd, demoInfo, demoUpdate } from './api';
|
||||
import { modalSchema } from './data';
|
||||
import { drawerSchema } from './data';
|
||||
|
||||
const emit = defineEmits<{ reload: [] }>();
|
||||
|
||||
@@ -26,62 +27,75 @@ const [BasicForm, formApi] = useVbenForm({
|
||||
// 通用配置项 会影响到所有表单项
|
||||
componentProps: {
|
||||
class: 'w-full',
|
||||
}
|
||||
},
|
||||
},
|
||||
schema: modalSchema(),
|
||||
schema: drawerSchema(),
|
||||
showDefaultActions: false,
|
||||
wrapperClass: 'grid-cols-2',
|
||||
});
|
||||
|
||||
const [BasicModal, modalApi] = useVbenModal({
|
||||
const { onBeforeClose, markInitialized, resetInitialized } = useBeforeCloseDiff(
|
||||
{
|
||||
initializedGetter: defaultFormValueGetter(formApi),
|
||||
currentGetter: defaultFormValueGetter(formApi),
|
||||
},
|
||||
);
|
||||
|
||||
const [BasicDrawer, drawerApi] = useVbenDrawer({
|
||||
// 在这里更改宽度
|
||||
class: 'w-[550px]',
|
||||
fullscreenButton: false,
|
||||
onCancel: handleCancel,
|
||||
onBeforeClose,
|
||||
onClosed: handleClosed,
|
||||
onConfirm: handleConfirm,
|
||||
onOpenChange: async (isOpen) => {
|
||||
if (!isOpen) {
|
||||
return null;
|
||||
}
|
||||
modalApi.modalLoading(true);
|
||||
drawerApi.drawerLoading(true);
|
||||
|
||||
const { id } = modalApi.getData() as { id?: number | string };
|
||||
const { id } = drawerApi.getData() as { id?: number | string };
|
||||
isUpdate.value = !!id;
|
||||
|
||||
if (isUpdate.value && id) {
|
||||
const record = await demoInfo(id);
|
||||
const record = await meterRecordInfo(id);
|
||||
await formApi.setValues(record);
|
||||
}
|
||||
await markInitialized();
|
||||
|
||||
modalApi.modalLoading(false);
|
||||
drawerApi.drawerLoading(false);
|
||||
},
|
||||
});
|
||||
|
||||
async function handleConfirm() {
|
||||
try {
|
||||
modalApi.modalLoading(true);
|
||||
drawerApi.lock(true);
|
||||
const { valid } = await formApi.validate();
|
||||
if (!valid) {
|
||||
return;
|
||||
}
|
||||
// getValues获取为一个readonly的对象 需要修改必须先深拷贝一次
|
||||
const data = cloneDeep(await formApi.getValues());
|
||||
await (isUpdate.value ? demoUpdate(data) : demoAdd(data));
|
||||
await (isUpdate.value ? meterRecordUpdate(data) : meterRecordAdd(data));
|
||||
resetInitialized();
|
||||
emit('reload');
|
||||
await handleCancel();
|
||||
drawerApi.close();
|
||||
} catch (error) {
|
||||
console.error(error);
|
||||
} finally {
|
||||
modalApi.modalLoading(false);
|
||||
drawerApi.lock(false);
|
||||
}
|
||||
}
|
||||
|
||||
async function handleCancel() {
|
||||
modalApi.close();
|
||||
async function handleClosed() {
|
||||
await formApi.resetForm();
|
||||
resetInitialized();
|
||||
}
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<BasicModal :close-on-click-modal="false" :title="title" class="w-[550px]">
|
||||
<BasicDrawer :title="title">
|
||||
<BasicForm />
|
||||
</BasicModal>
|
||||
</BasicDrawer>
|
||||
</template>
|
||||
|
@@ -0,0 +1,187 @@
|
||||
import type { FormSchemaGetter } from '#/adapter/form';
|
||||
import type { VxeGridProps } from '#/adapter/vxe-table';
|
||||
import dayjs from 'dayjs';
|
||||
|
||||
export const querySchema: FormSchemaGetter = () => [
|
||||
{
|
||||
component: 'Input',
|
||||
fieldName: 'orderId',
|
||||
label: '订单编号',
|
||||
},
|
||||
];
|
||||
|
||||
export const columns: VxeGridProps['columns'] = [
|
||||
// { type: 'checkbox', width: 60 },
|
||||
{
|
||||
title: '序号',
|
||||
field: 'id',
|
||||
slots: {
|
||||
default: ({ rowIndex }) => {
|
||||
return (rowIndex + 1).toString();
|
||||
},
|
||||
},
|
||||
width: 60,
|
||||
},
|
||||
{
|
||||
title: '订单编号',
|
||||
field: 'orderId',
|
||||
minWidth: 200,
|
||||
},
|
||||
{
|
||||
title: '车场名称',
|
||||
field: 'plName',
|
||||
width: 'auto',
|
||||
},
|
||||
{
|
||||
title: '停车类型',
|
||||
field: 'carBusiType',
|
||||
width: 100,
|
||||
formatter: ({ cellValue }) => {
|
||||
// 停车类型转换
|
||||
// 10:临时车,11, 12, 13:月租车,其他:未知
|
||||
switch (cellValue) {
|
||||
case 10:
|
||||
return '临时车';
|
||||
case 11:
|
||||
case 12:
|
||||
case 13:
|
||||
return '月租车';
|
||||
default:
|
||||
return '未知';
|
||||
}
|
||||
},
|
||||
},
|
||||
{
|
||||
title: '车牌号',
|
||||
field: 'carNumber',
|
||||
width: 100,
|
||||
},
|
||||
{
|
||||
title: '车辆类型',
|
||||
field: 'carType',
|
||||
width: 100,
|
||||
formatter: ({ cellValue }) => {
|
||||
switch (cellValue) {
|
||||
case 1:
|
||||
return '大型车';
|
||||
case 2:
|
||||
return '小型车';
|
||||
case 3:
|
||||
return '新能源车';
|
||||
default:
|
||||
return '未知';
|
||||
}
|
||||
},
|
||||
},
|
||||
{
|
||||
title: '应收',
|
||||
field: 'orderTotalFee',
|
||||
width: 100,
|
||||
},
|
||||
{
|
||||
title: '实收',
|
||||
field: 'orderActFee',
|
||||
width: 100,
|
||||
},
|
||||
{
|
||||
title: '停车时长',
|
||||
field: 'parkingDuration',
|
||||
width: 150,
|
||||
formatter: ({ cellValue }) => {
|
||||
// 将秒数转换为友好的时间格式
|
||||
if (!cellValue && cellValue !== 0) return '';
|
||||
|
||||
const totalSeconds = Number(cellValue);
|
||||
if (isNaN(totalSeconds)) return cellValue;
|
||||
|
||||
// 计算天、小时、分钟和秒
|
||||
const days = Math.floor(totalSeconds / 86400);
|
||||
const hours = Math.floor((totalSeconds % 86400) / 3600);
|
||||
const minutes = Math.floor((totalSeconds % 3600) / 60);
|
||||
const seconds = Math.floor(totalSeconds % 60);
|
||||
|
||||
// 格式化显示
|
||||
let result = '';
|
||||
if (days > 0) result += `${days}天`;
|
||||
if (hours > 0) result += `${hours}小时`;
|
||||
if (minutes > 0) result += `${minutes}分钟`;
|
||||
if (seconds > 0 || result === '') result += `${seconds}秒`;
|
||||
|
||||
return result;
|
||||
},
|
||||
},
|
||||
{
|
||||
title: '进场时间',
|
||||
field: 'parkInTime',
|
||||
width: 150,
|
||||
formatter: ({ cellValue }) => {
|
||||
// 如果没有值,直接返回空字符串
|
||||
if (!cellValue) return '';
|
||||
|
||||
// 使用 dayjs 格式化时间戳
|
||||
// 如果是时间戳(数字或数字字符串)
|
||||
if (typeof cellValue === 'number' || /^\d+$/.test(cellValue.toString())) {
|
||||
return dayjs(Number(cellValue)).format('YYYY-MM-DD HH:mm:ss');
|
||||
}
|
||||
|
||||
// 如果已经是日期字符串,尝试解析后格式化
|
||||
const date = dayjs(cellValue);
|
||||
if (date.isValid()) {
|
||||
return date.format('YYYY-MM-DD HH:mm:ss');
|
||||
}
|
||||
|
||||
// 如果无法解析,返回原始值
|
||||
return cellValue;
|
||||
},
|
||||
},
|
||||
{
|
||||
title: '出场时间',
|
||||
field: 'parkOutTime',
|
||||
width: 100,
|
||||
formatter: ({ cellValue }) => {
|
||||
// 如果没有值,直接返回空字符串
|
||||
if (!cellValue) return '';
|
||||
|
||||
// 使用 dayjs 格式化时间戳
|
||||
// 如果是时间戳(数字或数字字符串)
|
||||
if (typeof cellValue === 'number' || /^\d+$/.test(cellValue.toString())) {
|
||||
return dayjs(Number(cellValue)).format('YYYY-MM-DD HH:mm:ss');
|
||||
}
|
||||
|
||||
// 如果已经是日期字符串,尝试解析后格式化
|
||||
const date = dayjs(cellValue);
|
||||
if (date.isValid()) {
|
||||
return date.format('YYYY-MM-DD HH:mm:ss');
|
||||
}
|
||||
|
||||
// 如果无法解析,返回原始值
|
||||
return cellValue;
|
||||
},
|
||||
},
|
||||
{
|
||||
title: '备注',
|
||||
field: 'remark',
|
||||
|
||||
width: 100,
|
||||
},
|
||||
{
|
||||
title: '状态',
|
||||
field: 'parkState',
|
||||
formatter: ({ cellValue }) => {
|
||||
switch (cellValue) {
|
||||
case 10:
|
||||
return '在场';
|
||||
case 20:
|
||||
return '离场';
|
||||
}
|
||||
},
|
||||
width: 100,
|
||||
},
|
||||
{
|
||||
field: 'action',
|
||||
fixed: 'right',
|
||||
slots: { default: 'action' },
|
||||
title: '操作',
|
||||
minWidth: 180,
|
||||
},
|
||||
];
|
@@ -0,0 +1,230 @@
|
||||
<script setup lang="ts">
|
||||
import { ref } from 'vue';
|
||||
import { Page, useVbenModal, type VbenFormProps } from '@vben/common-ui';
|
||||
|
||||
import { Space } from 'ant-design-vue';
|
||||
|
||||
import { useVbenVxeGrid, type VxeGridProps } from '#/adapter/vxe-table';
|
||||
|
||||
import { columns, querySchema } from './data';
|
||||
import recordDetailModal from './record-detail-modal.vue';
|
||||
import { Radio } from 'ant-design-vue';
|
||||
import type { RadioChangeEvent } from 'ant-design-vue';
|
||||
const token = ref('');
|
||||
const parkStates = ref('10');
|
||||
// 外部登录接口:页面加载时请求
|
||||
async function externalLoginOnLoad() {
|
||||
try {
|
||||
const response = await fetch(
|
||||
'https://server.cqnctc.com:6081/web/oAuth/login',
|
||||
{
|
||||
method: 'POST',
|
||||
headers: {
|
||||
'Content-Type': 'application/json',
|
||||
},
|
||||
body: JSON.stringify({
|
||||
loginCode: 'zhfwzx',
|
||||
loginPassword: 'nc123456',
|
||||
}),
|
||||
},
|
||||
);
|
||||
|
||||
if (!response.ok) {
|
||||
throw new Error(`Request failed: ${response.status}`);
|
||||
}
|
||||
|
||||
const result = await response.json();
|
||||
|
||||
// 检查登录是否成功
|
||||
if (result?.data?.token) {
|
||||
token.value = result.data.token;
|
||||
// 将 token 存储到 sessionStorage 中
|
||||
sessionStorage.setItem('token', token.value);
|
||||
// try{
|
||||
const response = await fetch(
|
||||
`https://server.cqnctc.com:6081/web/oAuth/getUserInfo?token=${sessionStorage.getItem('token')}`,
|
||||
{
|
||||
method: 'POST',
|
||||
headers: {
|
||||
'Content-Type': 'application/json',
|
||||
'X-Auth-Token': `${sessionStorage.getItem('token')}`,
|
||||
// Authorization: `Bearer ${sessionStorage.getItem('token')}`,
|
||||
Accept: 'application/json, text/plain, */*',
|
||||
},
|
||||
},
|
||||
);
|
||||
|
||||
if (!response.ok) {
|
||||
throw new Error(`Request failed: ${response.status}`);
|
||||
}
|
||||
|
||||
const result2 = await response.json();
|
||||
console.log(result2);
|
||||
// }
|
||||
}
|
||||
} catch (error) {
|
||||
console.error('External login error:', error);
|
||||
}
|
||||
}
|
||||
|
||||
const formOptions: VbenFormProps = {
|
||||
commonConfig: {
|
||||
labelWidth: 120,
|
||||
componentProps: {
|
||||
allowClear: true,
|
||||
},
|
||||
},
|
||||
schema: querySchema(),
|
||||
wrapperClass: 'grid-cols-1 md:grid-cols-2 lg:grid-cols-3 xl:grid-cols-4',
|
||||
};
|
||||
|
||||
const gridOptions: VxeGridProps = {
|
||||
checkboxConfig: {
|
||||
// 高亮
|
||||
highlight: true,
|
||||
// 翻页时保留选中状态
|
||||
reserve: true,
|
||||
// 点击行选中
|
||||
// trigger: 'row',
|
||||
},
|
||||
columns,
|
||||
height: 'auto',
|
||||
keepSource: true,
|
||||
pagerConfig: {},
|
||||
proxyConfig: {
|
||||
ajax: {
|
||||
query: async ({ page }, formValues = {}) => {
|
||||
// 修改:添加对token的使用,如果token存在则请求外部接口,否则使用原接口
|
||||
console.log(1243);
|
||||
sessionStorage.removeItem('token');
|
||||
await externalLoginOnLoad();
|
||||
console.log(23423310248);
|
||||
|
||||
if (token.value) {
|
||||
try {
|
||||
const response = await fetch(
|
||||
'https://server.cqnctc.com:6081/web/lot/net/queryOrderParkForPage',
|
||||
{
|
||||
method: 'POST',
|
||||
headers: {
|
||||
'X-Auth-Token': `${sessionStorage.getItem('token')}`,
|
||||
'Content-Type': 'application/json',
|
||||
Authorization: `Bearer ${sessionStorage.getItem('token')}`,
|
||||
Accept: 'application/json, text/plain, */*',
|
||||
},
|
||||
body: JSON.stringify({
|
||||
// pageReq: {
|
||||
// pageNum: page.currentPage,
|
||||
// pageSize: page.pageSize,
|
||||
// },
|
||||
// parkStates: parkStates.value,
|
||||
// parkOrderTypes: [100, 200, 201, 300, 500],
|
||||
// plNos: ['PFN000000022', 'PFN000000012', 'PFN000000025'],
|
||||
// terminalSource: 50,
|
||||
// orderStates: [],
|
||||
// orgId: 10012,
|
||||
// ...formValues,
|
||||
pageReq: {
|
||||
pageNum: page.currentPage,
|
||||
pageSize: page.pageSize,
|
||||
},
|
||||
plNos: ['PFN000000025', 'PFN000000022', 'PFN000000012'],
|
||||
carNumber: null,
|
||||
orgId: 10012,
|
||||
parkStates: Number(parkStates.value),
|
||||
orderStates: [],
|
||||
parkOrderTypes: [100, 200, 201, 300, 500],
|
||||
terminalSource: 50,
|
||||
}),
|
||||
},
|
||||
);
|
||||
|
||||
// if (!response.ok) {
|
||||
// throw new Error(
|
||||
// `External API request failed: ${response.status}`,
|
||||
// );
|
||||
// }
|
||||
|
||||
const result = await response.json();
|
||||
console.log(result);
|
||||
|
||||
// 根据返回数据结构调整
|
||||
return {
|
||||
rows: result.data.dataList || [],
|
||||
total: result.data.pageTotals || 0,
|
||||
};
|
||||
} catch (error) {
|
||||
console.error('External API request error:', error);
|
||||
}
|
||||
}
|
||||
},
|
||||
},
|
||||
},
|
||||
rowConfig: {
|
||||
keyField: 'id',
|
||||
},
|
||||
// 表格全局唯一表示 保存列配置需要用到
|
||||
id: 'property-unit-index',
|
||||
};
|
||||
|
||||
const [BasicTable, tableApi] = useVbenVxeGrid({
|
||||
formOptions,
|
||||
gridOptions,
|
||||
});
|
||||
|
||||
function handleDownloadExcel() {
|
||||
// commonDownloadExcel(
|
||||
// resident_unitExport,
|
||||
// '入驻单位数据',
|
||||
// tableApi.formApi.form.values,
|
||||
// {
|
||||
// fieldMappingTime: formOptions.fieldMappingTime,
|
||||
// },
|
||||
// );
|
||||
}
|
||||
|
||||
// onMounted(() => {
|
||||
// externalLoginOnLoad();
|
||||
// });
|
||||
const [RecordDetailModal, recordDetailModalApi] = useVbenModal({
|
||||
connectedComponent: recordDetailModal,
|
||||
});
|
||||
async function handleInfo(row: any) {
|
||||
recordDetailModalApi.setData({ data: row });
|
||||
recordDetailModalApi.open();
|
||||
}
|
||||
// 切换视图模式
|
||||
async function handleViewModeChange(e: RadioChangeEvent): Promise<void> {
|
||||
parkStates.value = e.target.value;
|
||||
await tableApi.query();
|
||||
}
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<Page :auto-content-height="true">
|
||||
<BasicTable table-title="通行记录列表">
|
||||
<template #toolbar-tools style="width: 100%">
|
||||
<div style="margin-right: 20px">
|
||||
<Radio.Group
|
||||
v-model:value="parkStates"
|
||||
@change="handleViewModeChange"
|
||||
>
|
||||
<Radio.Button value="10">在场</Radio.Button>
|
||||
<Radio.Button value="20">离场</Radio.Button>
|
||||
</Radio.Group>
|
||||
</div>
|
||||
<Space>
|
||||
<a-button @click="handleDownloadExcel">
|
||||
{{ $t('pages.common.export') }}
|
||||
</a-button>
|
||||
</Space>
|
||||
</template>
|
||||
<template #action="{ row }">
|
||||
<Space>
|
||||
<ghost-button @click.stop="handleInfo(row)"> 查看 </ghost-button>
|
||||
</Space>
|
||||
</template>
|
||||
</BasicTable>
|
||||
<RecordDetailModal />
|
||||
</Page>
|
||||
</template>
|
@@ -0,0 +1,256 @@
|
||||
<script setup lang="ts">
|
||||
import { ref } from 'vue';
|
||||
|
||||
import { useVbenModal } from '@vben/common-ui';
|
||||
import { Descriptions, DescriptionsItem } from 'ant-design-vue';
|
||||
|
||||
import dayjs from 'dayjs';
|
||||
|
||||
// 格式化停车时长(将秒数转换为友好的时间格式)
|
||||
function formatParkingDuration(seconds: number | string): string {
|
||||
// 将秒数转换为友好的时间格式
|
||||
if (!seconds && seconds !== 0) return '';
|
||||
|
||||
const totalSeconds = Number(seconds);
|
||||
if (isNaN(totalSeconds)) return seconds as string;
|
||||
|
||||
// 计算天、小时、分钟和秒
|
||||
const days = Math.floor(totalSeconds / 86400);
|
||||
const hours = Math.floor((totalSeconds % 86400) / 3600);
|
||||
const minutes = Math.floor((totalSeconds % 3600) / 60);
|
||||
const secs = Math.floor(totalSeconds % 60);
|
||||
|
||||
// 格式化显示
|
||||
let result = '';
|
||||
if (days > 0) result += `${days}天`;
|
||||
if (hours > 0) result += `${hours}小时`;
|
||||
if (minutes > 0) result += `${minutes}分钟`;
|
||||
if (secs > 0 || result === '') result += `${secs}秒`;
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
const emit = defineEmits<{ reload: [] }>();
|
||||
|
||||
const picture1 = ref('');
|
||||
const detail = ref<any>();
|
||||
// const { onBeforeClose, markInitialized, resetInitialized } = useBeforeCloseDiff(
|
||||
// {
|
||||
// initializedGetter: defaultFormValueGetter(formApi),
|
||||
// currentGetter: defaultFormValueGetter(formApi),
|
||||
// },
|
||||
// );
|
||||
|
||||
const [BasicModal, modalApi] = useVbenModal({
|
||||
// 在这里更改宽度
|
||||
class: 'w-[70%]',
|
||||
fullscreenButton: false,
|
||||
onClosed: handleClosed,
|
||||
onConfirm: handleConfirm,
|
||||
onOpenChange: async (isOpen) => {
|
||||
if (!isOpen) {
|
||||
return null;
|
||||
}
|
||||
modalApi.modalLoading(true);
|
||||
const { data } = modalApi.getData() as { data: any };
|
||||
detail.value = data;
|
||||
picture1.value = data.pictureUrl;
|
||||
const response = await fetch(
|
||||
'https://server.cqnctc.com:6081/web/toCFile/selectToCFileList',
|
||||
{
|
||||
method: 'POST',
|
||||
headers: {
|
||||
'X-Auth-Token': `${sessionStorage.getItem('token')}`,
|
||||
'Content-Type': 'application/json',
|
||||
Authorization: `Bearer ${sessionStorage.getItem('token')}`,
|
||||
Accept: 'application/json, text/plain, */*',
|
||||
},
|
||||
body: JSON.stringify({
|
||||
sourceId: data.orderId,
|
||||
fileTypes: [4, 5],
|
||||
}),
|
||||
},
|
||||
);
|
||||
|
||||
const result = await response.json();
|
||||
for (const item of result.data) {
|
||||
if (item.fileName.includes('进场图片')) {
|
||||
data.parkInImgPath = item.filePath;
|
||||
console.log('图片路径:', data.parkInImgPath);
|
||||
} else {
|
||||
data.parkOutImgPath = item.filePath;
|
||||
}
|
||||
}
|
||||
modalApi.modalLoading(false);
|
||||
},
|
||||
});
|
||||
|
||||
async function handleConfirm() {
|
||||
try {
|
||||
modalApi.lock(true);
|
||||
emit('reload');
|
||||
modalApi.close();
|
||||
} catch (error) {
|
||||
console.error(error);
|
||||
} finally {
|
||||
modalApi.lock(false);
|
||||
}
|
||||
}
|
||||
async function handleClosed() {
|
||||
detail.value = null;
|
||||
}
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<BasicModal title="详情">
|
||||
<Descriptions
|
||||
v-if="detail"
|
||||
size="small"
|
||||
:column="2"
|
||||
bordered
|
||||
:labelStyle="{ width: '100px' }"
|
||||
>
|
||||
<DescriptionsItem label="订单编号">
|
||||
{{ detail.orderId }}
|
||||
</DescriptionsItem>
|
||||
<DescriptionsItem label="车场名称">
|
||||
{{ detail.plName }}
|
||||
</DescriptionsItem>
|
||||
<DescriptionsItem label="停车类型">
|
||||
{{
|
||||
detail.carBusiType === 10
|
||||
? '临时车'
|
||||
: [11, 12, 13].includes(detail.carBusiType)
|
||||
? '月租车'
|
||||
: '未知'
|
||||
}}
|
||||
</DescriptionsItem>
|
||||
<DescriptionsItem label="车牌号">
|
||||
{{ detail.carNumber }}
|
||||
</DescriptionsItem>
|
||||
<DescriptionsItem label="车辆类型">
|
||||
{{
|
||||
detail.carType === 1
|
||||
? '大型车'
|
||||
: detail.carType === 2
|
||||
? '小型车'
|
||||
: detail.carType === 3
|
||||
? ' 新能源车'
|
||||
: '未知'
|
||||
}}
|
||||
</DescriptionsItem>
|
||||
<DescriptionsItem label="应收">
|
||||
{{ detail.orderTotalFee }}
|
||||
</DescriptionsItem>
|
||||
<DescriptionsItem label="停车时长">
|
||||
{{ formatParkingDuration(detail.parkingDuration) }}
|
||||
</DescriptionsItem>
|
||||
<DescriptionsItem label="进场时间">
|
||||
{{
|
||||
detail.parkInTime
|
||||
? dayjs(detail.parkInTime).format('YYYY-MM-DD HH:mm:ss')
|
||||
: ''
|
||||
}}
|
||||
</DescriptionsItem>
|
||||
<!-- <DescriptionsItem label="入驻位置">-->
|
||||
<!-- {{ detail.locathon }}-->
|
||||
<!-- </DescriptionsItem>-->
|
||||
<DescriptionsItem label="进场图片">
|
||||
<img
|
||||
v-if="detail.parkInImgPath"
|
||||
:src="detail.parkInImgPath"
|
||||
alt="图片加载失败"
|
||||
class="h-[100px] w-[100px]"
|
||||
/>
|
||||
</DescriptionsItem>
|
||||
<DescriptionsItem label="出场时间">
|
||||
{{
|
||||
detail.parkOutTime
|
||||
? dayjs(detail.parkOutTime).format('YYYY-MM-DD HH:mm:ss')
|
||||
: ''
|
||||
}}
|
||||
</DescriptionsItem>
|
||||
<!-- <DescriptionsItem label="入驻位置">-->
|
||||
<!-- {{ detail.locathon }}-->
|
||||
<!-- </DescriptionsItem>-->
|
||||
<DescriptionsItem label="出场图片">
|
||||
<img
|
||||
v-if="detail.parkOutImgPath"
|
||||
:src="detail.parkOutImgPath"
|
||||
alt="图片加载失败"
|
||||
class="h-[100px] w-[100px]"
|
||||
/>
|
||||
</DescriptionsItem>
|
||||
<DescriptionsItem label="备注">
|
||||
{{ detail.remark }}
|
||||
</DescriptionsItem>
|
||||
<DescriptionsItem label="状态">
|
||||
{{ detail.parkState == 10 ? '在场' : '离场' }}
|
||||
</DescriptionsItem>
|
||||
</Descriptions>
|
||||
</BasicModal>
|
||||
</template>
|
||||
|
||||
<style scoped>
|
||||
.detail-wrapper {
|
||||
padding: 24px;
|
||||
}
|
||||
|
||||
.detail-grid {
|
||||
display: grid;
|
||||
grid-template-columns: repeat(3, minmax(0, 1fr));
|
||||
gap: 24px;
|
||||
}
|
||||
|
||||
.detail-card {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
background-color: #fff;
|
||||
border-radius: 8px;
|
||||
box-shadow:
|
||||
0 1px 3px rgba(0, 0, 0, 0.06),
|
||||
0 1px 2px rgba(0, 0, 0, 0.08);
|
||||
padding: 16px;
|
||||
}
|
||||
|
||||
.detail-thumb {
|
||||
width: 220px;
|
||||
height: 260px;
|
||||
background-color: #f5f7fa;
|
||||
border-radius: 6px;
|
||||
overflow: hidden;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
border: 1px solid #e5e7eb;
|
||||
}
|
||||
|
||||
.detail-thumb img {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
object-fit: cover;
|
||||
}
|
||||
|
||||
.detail-caption {
|
||||
margin-top: 12px;
|
||||
font-size: 14px;
|
||||
color: #606266;
|
||||
}
|
||||
|
||||
@media (max-width: 1024px) {
|
||||
.detail-grid {
|
||||
grid-template-columns: repeat(2, minmax(0, 1fr));
|
||||
}
|
||||
}
|
||||
|
||||
@media (max-width: 640px) {
|
||||
.detail-grid {
|
||||
grid-template-columns: 1fr;
|
||||
}
|
||||
.detail-thumb {
|
||||
width: 100%;
|
||||
height: 240px;
|
||||
}
|
||||
}
|
||||
</style>
|
@@ -54,11 +54,19 @@ const gridOptions: VxeGridProps = {
|
||||
proxyConfig: {
|
||||
ajax: {
|
||||
query: async ({ page }, formValues = {}) => {
|
||||
return await personList({
|
||||
// return await personList({
|
||||
// pageNum: page.currentPage,
|
||||
// pageSize: page.pageSize,
|
||||
// ...formValues,
|
||||
// })
|
||||
const res = await personList({
|
||||
pageNum: page.currentPage,
|
||||
pageSize: page.pageSize,
|
||||
...formValues,
|
||||
})
|
||||
});
|
||||
console.log(res);
|
||||
|
||||
return res;
|
||||
},
|
||||
},
|
||||
},
|
||||
|
@@ -0,0 +1,131 @@
|
||||
import type { FormSchemaGetter } from '#/adapter/form';
|
||||
import type { VxeGridProps } from '#/adapter/vxe-table';
|
||||
import { getDictOptions } from '#/utils/dict';
|
||||
import { renderDict } from '#/utils/render';
|
||||
|
||||
export const querySchema: FormSchemaGetter = () => [
|
||||
// {
|
||||
// component: 'Input',
|
||||
// fieldName: 'actionTime',
|
||||
// label: '通行时间',
|
||||
// },
|
||||
{
|
||||
component: 'Input',
|
||||
fieldName: 'customerName',
|
||||
label: '人员姓名',
|
||||
},
|
||||
// {
|
||||
// component: 'Input',
|
||||
// fieldName: 'organFullPath',
|
||||
// label: '组织机构',
|
||||
// },
|
||||
// {
|
||||
// component: 'Input',
|
||||
// fieldName: 'doorName',
|
||||
// label: '门/电梯名称',
|
||||
// },
|
||||
// {
|
||||
// component: 'Input',
|
||||
// fieldName: 'deviceName',
|
||||
// label: '设备名称',
|
||||
// },
|
||||
{
|
||||
component: 'Select',
|
||||
componentProps: {
|
||||
options: getDictOptions('wy_txjllx'),
|
||||
},
|
||||
fieldName: 'recordType',
|
||||
label: '记录类型',
|
||||
},
|
||||
];
|
||||
|
||||
export const columns: VxeGridProps['columns'] = [
|
||||
// { type: 'checkbox', width: 60 },
|
||||
{
|
||||
title: '序号',
|
||||
field: 'id',
|
||||
slots: {
|
||||
default: ({ rowIndex }) => {
|
||||
return (rowIndex + 1).toString();
|
||||
},
|
||||
},
|
||||
width: 60,
|
||||
},
|
||||
{
|
||||
title: '门/电梯名称',
|
||||
field: 'doorName',
|
||||
width: 120,
|
||||
},
|
||||
{
|
||||
title: '设备名称',
|
||||
field: 'deviceName',
|
||||
width: 150,
|
||||
},
|
||||
{
|
||||
title: '设备类别',
|
||||
field: 'deviceType',
|
||||
slots: {
|
||||
default: ({ row }) => {
|
||||
return renderDict(row.deviceType, 'wy_txjlsblb');
|
||||
},
|
||||
},
|
||||
width: 150,
|
||||
},
|
||||
{
|
||||
title: '读头名称',
|
||||
field: 'readerName',
|
||||
width: 100,
|
||||
},
|
||||
{
|
||||
title: '人员姓名',
|
||||
field: 'customerName',
|
||||
width: 150,
|
||||
},
|
||||
{
|
||||
title: '所属组织',
|
||||
field: 'organFullPath',
|
||||
width: 150,
|
||||
},
|
||||
{
|
||||
title: '门卡类别',
|
||||
field: 'cardType',
|
||||
slots: {
|
||||
default: ({ row }) => {
|
||||
return renderDict(row.cardType, 'wy_txjlmklb');
|
||||
},
|
||||
},
|
||||
width: 100,
|
||||
},
|
||||
{
|
||||
title: '出入类型',
|
||||
field: 'gatewayType',
|
||||
slots: {
|
||||
default: ({ row }) => {
|
||||
return renderDict(row.gatewayType, 'wy_txjlcrlx');
|
||||
},
|
||||
},
|
||||
width: 100,
|
||||
},
|
||||
{
|
||||
title: '通行时间',
|
||||
field: 'actionTime',
|
||||
width: 150,
|
||||
},
|
||||
{
|
||||
title: '记录类型',
|
||||
field: 'recordType',
|
||||
slots: {
|
||||
default: ({ row }) => {
|
||||
return renderDict(row.recordType, 'wy_txjllx');
|
||||
},
|
||||
},
|
||||
width: 100,
|
||||
},
|
||||
{
|
||||
field: '',
|
||||
fixed: 'right',
|
||||
slots: { default: 'action' },
|
||||
title: '抓拍图片',
|
||||
minWidth: 180,
|
||||
},
|
||||
];
|
@@ -0,0 +1,95 @@
|
||||
<script setup lang="ts">
|
||||
import { Page, useVbenModal, type VbenFormProps } from '@vben/common-ui';
|
||||
|
||||
import { Space } from 'ant-design-vue';
|
||||
|
||||
import { useVbenVxeGrid, type VxeGridProps } from '#/adapter/vxe-table';
|
||||
|
||||
import { columns, querySchema } from './data';
|
||||
import { getVisitorList } from '#/api/property/resident/passRecordManagement';
|
||||
import recordDetailModal from './record-detail-modal.vue';
|
||||
const formOptions: VbenFormProps = {
|
||||
commonConfig: {
|
||||
labelWidth: 120,
|
||||
componentProps: {
|
||||
allowClear: true,
|
||||
},
|
||||
},
|
||||
schema: querySchema(),
|
||||
wrapperClass: 'grid-cols-1 md:grid-cols-2 lg:grid-cols-3 xl:grid-cols-4',
|
||||
};
|
||||
|
||||
const gridOptions: VxeGridProps = {
|
||||
checkboxConfig: {
|
||||
// 高亮
|
||||
highlight: true,
|
||||
// 翻页时保留选中状态
|
||||
reserve: true,
|
||||
// 点击行选中
|
||||
// trigger: 'row',
|
||||
},
|
||||
columns,
|
||||
height: 'auto',
|
||||
keepSource: true,
|
||||
pagerConfig: {},
|
||||
proxyConfig: {
|
||||
ajax: {
|
||||
query: async ({ page }, formValues = {}) => {
|
||||
return await getVisitorList({
|
||||
pageNum: page.currentPage,
|
||||
pageSize: page.pageSize,
|
||||
...formValues,
|
||||
});
|
||||
},
|
||||
},
|
||||
},
|
||||
rowConfig: {
|
||||
keyField: 'id',
|
||||
},
|
||||
// 表格全局唯一表示 保存列配置需要用到
|
||||
id: 'property-unit-index',
|
||||
};
|
||||
|
||||
const [BasicTable, tableApi] = useVbenVxeGrid({
|
||||
formOptions,
|
||||
gridOptions,
|
||||
});
|
||||
|
||||
function handleDownloadExcel() {
|
||||
// commonDownloadExcel(
|
||||
// resident_unitExport,
|
||||
// '入驻单位数据',
|
||||
// tableApi.formApi.form.values,
|
||||
// {
|
||||
// fieldMappingTime: formOptions.fieldMappingTime,
|
||||
// },
|
||||
// );
|
||||
}
|
||||
const [RecordDetailModal, recordDetailModalApi] = useVbenModal({
|
||||
connectedComponent: recordDetailModal,
|
||||
});
|
||||
async function handleInfo(row: any) {
|
||||
recordDetailModalApi.setData({ data: row });
|
||||
recordDetailModalApi.open();
|
||||
}
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<Page :auto-content-height="true">
|
||||
<BasicTable table-title="通行记录列表">
|
||||
<template #toolbar-tools>
|
||||
<Space>
|
||||
<a-button @click="handleDownloadExcel">
|
||||
{{ $t('pages.common.export') }}
|
||||
</a-button>
|
||||
</Space>
|
||||
</template>
|
||||
<template #action="{ row }">
|
||||
<Space>
|
||||
<ghost-button @click.stop="handleInfo(row)"> 查看 </ghost-button>
|
||||
</Space>
|
||||
</template>
|
||||
</BasicTable>
|
||||
<RecordDetailModal />
|
||||
</Page>
|
||||
</template>
|
@@ -0,0 +1,141 @@
|
||||
<script setup lang="ts">
|
||||
import { ref } from 'vue';
|
||||
|
||||
import { useVbenModal } from '@vben/common-ui';
|
||||
|
||||
const emit = defineEmits<{ reload: [] }>();
|
||||
|
||||
const picture1 = ref('')
|
||||
// const { onBeforeClose, markInitialized, resetInitialized } = useBeforeCloseDiff(
|
||||
// {
|
||||
// initializedGetter: defaultFormValueGetter(formApi),
|
||||
// currentGetter: defaultFormValueGetter(formApi),
|
||||
// },
|
||||
// );
|
||||
|
||||
const [BasicModal, modalApi] = useVbenModal({
|
||||
// 在这里更改宽度
|
||||
class: 'w-[70%]',
|
||||
fullscreenButton: false,
|
||||
onClosed: handleClosed,
|
||||
onConfirm: handleConfirm,
|
||||
onOpenChange: async (isOpen) => {
|
||||
if (!isOpen) {
|
||||
return null;
|
||||
}
|
||||
const {data} = modalApi.getData() as { data:any };
|
||||
console.log(data)
|
||||
picture1.value = data.pictureUrl;
|
||||
// detail.value = await meetInfo(id);
|
||||
// if (detail.value?.picture) {
|
||||
// const res = await ossInfo([conferenceSettingsDetail.value?.picture]);
|
||||
// if (res) {
|
||||
// let imgArr = [] as string[];
|
||||
// res.forEach(item => {
|
||||
// imgArr.push(item.url)
|
||||
// })
|
||||
// conferenceSettingsDetail.value.pictureArr = imgArr;
|
||||
// }
|
||||
// }
|
||||
modalApi.modalLoading(true);
|
||||
|
||||
modalApi.modalLoading(false);
|
||||
},
|
||||
});
|
||||
|
||||
async function handleConfirm() {
|
||||
try {
|
||||
modalApi.lock(true);
|
||||
emit('reload');
|
||||
modalApi.close();
|
||||
} catch (error) {
|
||||
console.error(error);
|
||||
} finally {
|
||||
modalApi.lock(false);
|
||||
}
|
||||
}
|
||||
async function handleClosed() {}
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<BasicModal title="抓拍图片">
|
||||
<div class="detail-wrapper">
|
||||
<div class="detail-grid">
|
||||
<div class="detail-card">
|
||||
<img class="detail-thumb" :src="picture1"></img>
|
||||
<div class="detail-caption">人脸凭证照片</div>
|
||||
</div>
|
||||
<div class="detail-card">
|
||||
<img class="detail-thumb" :src="picture1"></img>
|
||||
<div class="detail-caption">监控设备抓拍</div>
|
||||
</div>
|
||||
<div class="detail-card">
|
||||
<img class="detail-thumb" :src="picture1"></img>
|
||||
<div class="detail-caption">人脸门禁抓拍</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</BasicModal>
|
||||
</template>
|
||||
|
||||
<style scoped>
|
||||
.detail-wrapper {
|
||||
padding: 24px;
|
||||
}
|
||||
|
||||
.detail-grid {
|
||||
display: grid;
|
||||
grid-template-columns: repeat(3, minmax(0, 1fr));
|
||||
gap: 24px;
|
||||
}
|
||||
|
||||
.detail-card {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
background-color: #fff;
|
||||
border-radius: 8px;
|
||||
box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06), 0 1px 2px rgba(0, 0, 0, 0.08);
|
||||
padding: 16px;
|
||||
}
|
||||
|
||||
.detail-thumb {
|
||||
width: 220px;
|
||||
height: 260px;
|
||||
background-color: #f5f7fa;
|
||||
border-radius: 6px;
|
||||
overflow: hidden;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
border: 1px solid #e5e7eb;
|
||||
}
|
||||
|
||||
.detail-thumb img {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
object-fit: cover;
|
||||
}
|
||||
|
||||
.detail-caption {
|
||||
margin-top: 12px;
|
||||
font-size: 14px;
|
||||
color: #606266;
|
||||
}
|
||||
|
||||
@media (max-width: 1024px) {
|
||||
.detail-grid {
|
||||
grid-template-columns: repeat(2, minmax(0, 1fr));
|
||||
}
|
||||
}
|
||||
|
||||
@media (max-width: 640px) {
|
||||
.detail-grid {
|
||||
grid-template-columns: 1fr;
|
||||
}
|
||||
.detail-thumb {
|
||||
width: 100%;
|
||||
height: 240px;
|
||||
}
|
||||
}
|
||||
</style>
|
@@ -13,6 +13,11 @@
|
||||
placeholder="请选择类型"
|
||||
style="width: 150px;"
|
||||
>
|
||||
<SelectOption
|
||||
key="all"
|
||||
value="all">
|
||||
全部类型
|
||||
</SelectOption>
|
||||
<SelectOption
|
||||
v-for="item in getDictOptions('meeting_room_type')"
|
||||
:key="item.value"
|
||||
@@ -20,6 +25,7 @@
|
||||
>
|
||||
{{ item.label }}
|
||||
</SelectOption>
|
||||
|
||||
</Select>
|
||||
</a-form-item>
|
||||
<a-form-item label="会议日期">
|
||||
@@ -113,7 +119,7 @@ async function handleSearch() {
|
||||
openStartHours: openStartHours??undefined,
|
||||
openEndHours:openEndHours??undefined,
|
||||
appointmentTime:formState.appointmentTime?formState.appointmentTime.format('YYYY-MM-DD'):undefined,
|
||||
meetingRoomType:formState.meetingRoomType
|
||||
meetingRoomType:formState.meetingRoomType=='all'?undefined:formState.meetingRoomType,
|
||||
}
|
||||
meetingList.value =await notlist(obj);
|
||||
}
|
||||
|
@@ -1,7 +1,9 @@
|
||||
<template>
|
||||
<Page :auto-content-height="true">
|
||||
<div class="flex h-full gap-[8px]">
|
||||
<div class="h-full tree-box">
|
||||
<DpTree class="h-full w-[300px]" @checked="onNodeChecked" />
|
||||
</div>
|
||||
<div class="bg-background flex-1">
|
||||
<div class="video-play-area flex h-full flex-wrap">
|
||||
<div
|
||||
|
@@ -46,7 +46,7 @@ onMounted(loadChannelTree);
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<div :class="$attrs.class">
|
||||
<div class="h-[800px]" :class="$attrs.class">
|
||||
<Skeleton
|
||||
:loading="showTreeSkeleton"
|
||||
:paragraph="{ rows: 8 }"
|
||||
@@ -54,12 +54,12 @@ onMounted(loadChannelTree);
|
||||
class="p-[8px]"
|
||||
>
|
||||
<div
|
||||
class="bg-background flex h-full flex-col overflow-y-auto rounded-lg"
|
||||
class="flex h-full flex-col overflow-y-auto rounded-lg"
|
||||
>
|
||||
<!-- 固定在顶部 必须加上bg-background背景色 否则会产生'穿透'效果 -->
|
||||
<div
|
||||
<divx
|
||||
v-if="showSearch"
|
||||
class="bg-background z-100 sticky left-0 top-0 p-[8px]"
|
||||
class="z-100 sticky left-0 top-0 p-[8px]"
|
||||
>
|
||||
<InputSearch
|
||||
v-model:value="searchValue"
|
||||
@@ -72,7 +72,7 @@ onMounted(loadChannelTree);
|
||||
</a-button>
|
||||
</template>
|
||||
</InputSearch>
|
||||
</div>
|
||||
</divx>
|
||||
<div class="h-full overflow-x-hidden px-[8px]">
|
||||
<Tree
|
||||
v-bind="$attrs"
|
||||
|
@@ -2,7 +2,12 @@
|
||||
<Page class="h-full w-full">
|
||||
<!-- 设备分组区域 -->
|
||||
<div class="flex h-full gap-[8px]">
|
||||
<ChannelTree class="h-full w-[300px]" @check="onNodeChecked" />
|
||||
<div class="h-full pb-[5px] c-tree bg-background">
|
||||
<ChannelTree
|
||||
class="w-[300px]"
|
||||
@check="onNodeChecked"
|
||||
/>
|
||||
</div>
|
||||
|
||||
<!-- 设备分组区域 -->
|
||||
<div class="bg-background flex-1">
|
||||
@@ -287,13 +292,12 @@ function streamProxy(nodeData: any, cb: Function) {
|
||||
pwd: nodeData.devicePwd,
|
||||
channelId: nodeData.channelNo,
|
||||
};
|
||||
|
||||
}
|
||||
if (isSupportH265) {
|
||||
addStreamProxy(params).then((res) => cb(res));
|
||||
} else {
|
||||
// addFFmpegStreamProxy(params).then((res) => cb(res));
|
||||
addStreamProxy(params).then((res) => cb(res));
|
||||
}
|
||||
addFFmpegStreamProxy(params).then((res) => cb(res));
|
||||
// addStreamProxy(params).then((res) => cb(res));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -306,7 +310,7 @@ function doPlayer(nodeData: any, index: number = 0) {
|
||||
console.log('index=', index);
|
||||
if (mpegts.isSupported()) {
|
||||
streamProxy(nodeData, (res: AddStreamProxyResult) => {
|
||||
const url = res.flv;
|
||||
const url = res.wsFlv;
|
||||
// 将url 绑定到 nodeData
|
||||
nodeData.url = url;
|
||||
closePlayer(index);
|
||||
|
@@ -92,10 +92,6 @@ export const columns: VxeGridProps['columns'] = [
|
||||
title: '创建时间',
|
||||
field: 'createTime',
|
||||
},
|
||||
{
|
||||
title: '创建人',
|
||||
field: 'createBy',
|
||||
},
|
||||
{
|
||||
field: 'action',
|
||||
fixed: 'right',
|
||||
|
@@ -5,7 +5,7 @@ import { Descriptions, DescriptionsItem, Image, Tag } from 'ant-design-vue';
|
||||
import { queryAlarmEventAttachmentsList } from '#/api/sis/alarmEventAttachments';
|
||||
import type { AlarmEventAttachmentsVO } from '#/api/sis/alarmEventAttachments/model';
|
||||
import { fallImg } from './data';
|
||||
import { alarmEventProcessList } from '#/api/sis/alarmEventProcess';
|
||||
import {alarmEventProcessList, queryResult} from '#/api/sis/alarmEventProcess';
|
||||
import type { AlarmEventProcessVO } from '#/api/sis/alarmEventProcess/model';
|
||||
|
||||
const [BasicModal, modalApi] = useVbenModal({
|
||||
@@ -34,6 +34,8 @@ async function handleOpenChange(open: boolean) {
|
||||
}
|
||||
// 加载事件附件信息
|
||||
currFiles.value = await queryAlarmEventAttachmentsList(id);
|
||||
const d = await queryResult(id)
|
||||
console.log(d)
|
||||
// 加载处理流程
|
||||
loadProcessList();
|
||||
modalApi.modalLoading(false);
|
||||
@@ -123,7 +125,7 @@ function loadProcessList() {
|
||||
</DescriptionsItem>
|
||||
|
||||
<DescriptionsItem label="处理时间" :span="2">
|
||||
{{ warningDetail.processingTime || '-' }}
|
||||
{{ warningDetail.solveTime || '-' }}
|
||||
</DescriptionsItem>
|
||||
|
||||
<DescriptionsItem :span="1" label="附件信息">
|
||||
|
@@ -92,10 +92,6 @@ export const columns: VxeGridProps['columns'] = [
|
||||
title: '创建时间',
|
||||
field: 'createTime',
|
||||
},
|
||||
{
|
||||
title: '创建人',
|
||||
field: 'createBy',
|
||||
},
|
||||
{
|
||||
field: 'action',
|
||||
fixed: 'right',
|
||||
|
@@ -113,18 +113,18 @@ function loadProcessList() {
|
||||
</DescriptionsItem>
|
||||
|
||||
<DescriptionsItem label="处理状态">
|
||||
<Tag>
|
||||
<Tag color="processing">
|
||||
{{ warningDetail.stateName }}
|
||||
</Tag>
|
||||
</DescriptionsItem>
|
||||
|
||||
<DescriptionsItem label="处理情况" :span="2">
|
||||
<!-- <DescriptionsItem label="处理情况" :span="2">
|
||||
{{ warningDetail.processingDetails || '-' }}
|
||||
</DescriptionsItem>
|
||||
|
||||
<DescriptionsItem label="处理时间" :span="2">
|
||||
{{ warningDetail.processingTime || '-' }}
|
||||
</DescriptionsItem>
|
||||
</DescriptionsItem>-->
|
||||
|
||||
<DescriptionsItem :span="1" label="附件信息">
|
||||
<div class="file-box">
|
||||
|
@@ -93,10 +93,6 @@ export const columns: VxeGridProps['columns'] = [
|
||||
title: '创建时间',
|
||||
field: 'createTime',
|
||||
},
|
||||
{
|
||||
title: '处理人',
|
||||
field: 'solveName',
|
||||
},
|
||||
{
|
||||
field: 'action',
|
||||
fixed: 'right',
|
||||
|
@@ -113,19 +113,11 @@ function loadProcessList() {
|
||||
</DescriptionsItem>
|
||||
|
||||
<DescriptionsItem label="处理状态">
|
||||
<Tag>
|
||||
<Tag color="success">
|
||||
{{ warningDetail.stateName }}
|
||||
</Tag>
|
||||
</DescriptionsItem>
|
||||
|
||||
<DescriptionsItem label="处理情况" :span="2">
|
||||
{{ warningDetail.processingDetails || '-' }}
|
||||
</DescriptionsItem>
|
||||
|
||||
<DescriptionsItem label="处理时间" :span="2">
|
||||
{{ warningDetail.processingTime || '-' }}
|
||||
</DescriptionsItem>
|
||||
|
||||
<DescriptionsItem :span="1" label="附件信息">
|
||||
<div class="file-box">
|
||||
<div class="img-box" v-for="item in currFiles">
|
||||
|
@@ -1 +0,0 @@
|
||||
演示站专用目录 可直接删除该目录
|
@@ -1,26 +0,0 @@
|
||||
<script setup lang="ts">
|
||||
import { ref } from 'vue';
|
||||
|
||||
import { MarkdownPreviewer, Page } from '@vben/common-ui';
|
||||
|
||||
import { Spin } from 'ant-design-vue';
|
||||
|
||||
import changelog from '../../../../../../CHANGELOG.md?raw';
|
||||
|
||||
const content = ref(changelog);
|
||||
|
||||
const loading = ref(true);
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<Page :auto-content-height="true">
|
||||
<Spin :spinning="loading" tip="加载markdown中...">
|
||||
<MarkdownPreviewer
|
||||
v-model:value="content"
|
||||
height="100%"
|
||||
class="min-h-[50vh]"
|
||||
@mounted="loading = false"
|
||||
/>
|
||||
</Spin>
|
||||
</Page>
|
||||
</template>
|
@@ -1,27 +0,0 @@
|
||||
<script setup lang="ts">
|
||||
import type { MenuOption } from '#/api/system/menu/model';
|
||||
|
||||
import { roleMenuTreeSelect } from '#/api/system/menu';
|
||||
import { MenuSelectTable } from '#/components/tree';
|
||||
import { Page } from '@vben/common-ui';
|
||||
import { onMounted, ref, shallowRef } from 'vue';
|
||||
|
||||
const checkedKeys = ref<number[]>([]);
|
||||
const menus = shallowRef<MenuOption[]>([]);
|
||||
|
||||
onMounted(async () => {
|
||||
const resp = await roleMenuTreeSelect(3);
|
||||
menus.value = resp.menus;
|
||||
checkedKeys.value = resp.checkedKeys;
|
||||
});
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<Page :auto-content-height="true">
|
||||
<MenuSelectTable
|
||||
:menus="menus"
|
||||
v-model:checked-keys="checkedKeys"
|
||||
:association="true"
|
||||
/>
|
||||
</Page>
|
||||
</template>
|
@@ -1,17 +0,0 @@
|
||||
<script setup lang="ts">
|
||||
import { useRoute } from 'vue-router';
|
||||
|
||||
import { JsonPreview, Page } from '@vben/common-ui';
|
||||
|
||||
const route = useRoute();
|
||||
const query = route.query;
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<Page>
|
||||
<div class="bg-background rounded-lg p-4">
|
||||
<span>当前参数:</span>
|
||||
<JsonPreview :data="query" />
|
||||
</div>
|
||||
</Page>
|
||||
</template>
|
@@ -1,26 +0,0 @@
|
||||
import { requestClient } from '#/api/request';
|
||||
|
||||
enum Api {
|
||||
list = '/system/sse/list',
|
||||
send = '/system/sse/send',
|
||||
sendAll = '/system/sse/sendAll',
|
||||
status = '/system/sse/status',
|
||||
}
|
||||
|
||||
export function sseStatus() {
|
||||
return requestClient.get<boolean>(Api.status);
|
||||
}
|
||||
|
||||
export function sseSendAll(message: string) {
|
||||
return requestClient.postWithMsg<void>(`${Api.sendAll}?message=${message}`);
|
||||
}
|
||||
|
||||
export function sseSendByUserId(userId: string, message: string) {
|
||||
return requestClient.postWithMsg<void>(
|
||||
`${Api.send}/${userId}?message=${message}`,
|
||||
);
|
||||
}
|
||||
|
||||
export function sseList() {
|
||||
return requestClient.get<any>(Api.list);
|
||||
}
|
@@ -1,103 +0,0 @@
|
||||
<script setup lang="ts">
|
||||
import type { VxeGridProps } from '#/adapter/vxe-table';
|
||||
|
||||
import { Page, useVbenModal } from '@vben/common-ui';
|
||||
|
||||
import { Space } from 'ant-design-vue';
|
||||
|
||||
import { useVbenVxeGrid } from '#/adapter/vxe-table';
|
||||
|
||||
import { sseList } from './api';
|
||||
import sendMsgModal from './send-msg-modal.vue';
|
||||
|
||||
const gridOptions: VxeGridProps = {
|
||||
columns: [
|
||||
{
|
||||
title: '用户ID',
|
||||
field: 'userId',
|
||||
},
|
||||
{
|
||||
title: '用户账号',
|
||||
field: 'userName',
|
||||
},
|
||||
{
|
||||
title: '用户昵称',
|
||||
field: 'nickName',
|
||||
},
|
||||
{
|
||||
title: '用户部门',
|
||||
field: 'deptName',
|
||||
},
|
||||
{
|
||||
field: 'action',
|
||||
fixed: 'right',
|
||||
slots: { default: 'action' },
|
||||
title: '操作',
|
||||
resizable: false,
|
||||
width: 'auto',
|
||||
},
|
||||
],
|
||||
height: 'auto',
|
||||
keepSource: true,
|
||||
pagerConfig: {},
|
||||
proxyConfig: {
|
||||
ajax: {
|
||||
query: async () => {
|
||||
const list = await sseList();
|
||||
return {
|
||||
rows: list,
|
||||
};
|
||||
},
|
||||
},
|
||||
},
|
||||
rowConfig: {
|
||||
isHover: false,
|
||||
keyField: 'userId',
|
||||
height: 48,
|
||||
},
|
||||
id: 'sse-index',
|
||||
};
|
||||
|
||||
const [BasicTable] = useVbenVxeGrid({
|
||||
gridOptions,
|
||||
});
|
||||
|
||||
const [SendMsgModal, modalApi] = useVbenModal({
|
||||
connectedComponent: sendMsgModal,
|
||||
});
|
||||
|
||||
function handleSendAll() {
|
||||
modalApi.setData({});
|
||||
modalApi.open();
|
||||
}
|
||||
|
||||
function handleSendSingle(userId: string) {
|
||||
modalApi.setData({ userId });
|
||||
modalApi.open();
|
||||
}
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<Page
|
||||
:auto-content-height="true"
|
||||
description="这这里可以进行[Server-sent events]测试 非官方功能"
|
||||
title="SSE测试"
|
||||
>
|
||||
<BasicTable>
|
||||
<template #toolbar-actions>
|
||||
<span class="pl-[7px] text-[16px]">在线用户列表</span>
|
||||
</template>
|
||||
<template #toolbar-tools>
|
||||
<Space>
|
||||
<a-button @click="handleSendAll">发送全体消息</a-button>
|
||||
</Space>
|
||||
</template>
|
||||
<template #action="{ row }">
|
||||
<ghost-button @click="handleSendSingle(row.userId)">
|
||||
发送消息
|
||||
</ghost-button>
|
||||
</template>
|
||||
</BasicTable>
|
||||
<SendMsgModal />
|
||||
</Page>
|
||||
</template>
|
@@ -1,77 +0,0 @@
|
||||
<script setup lang="ts">
|
||||
import { computed, ref } from 'vue';
|
||||
|
||||
import { useVbenModal } from '@vben/common-ui';
|
||||
|
||||
import { useVbenForm } from '#/adapter/form';
|
||||
|
||||
import { sseSendAll, sseSendByUserId } from './api';
|
||||
|
||||
const currentUserId = ref<string | undefined>(undefined);
|
||||
const title = computed(() => {
|
||||
return currentUserId.value ? '发送指定消息' : '发送全体消息';
|
||||
});
|
||||
|
||||
const [BasicModal, modalApi] = useVbenModal({
|
||||
onConfirm: handleSubmit,
|
||||
onOpenChange: (isOpen) => {
|
||||
if (!isOpen) {
|
||||
return null;
|
||||
}
|
||||
const data = modalApi.getData() as { userId: string | undefined };
|
||||
currentUserId.value = data.userId;
|
||||
},
|
||||
});
|
||||
|
||||
const [BasicForm, formApi] = useVbenForm({
|
||||
layout: 'vertical',
|
||||
commonConfig: {
|
||||
formItemClass: 'col-span-2',
|
||||
componentProps: {
|
||||
class: 'w-full',
|
||||
},
|
||||
labelWidth: 80,
|
||||
},
|
||||
schema: [
|
||||
{
|
||||
component: 'Textarea',
|
||||
label: '消息内容',
|
||||
fieldName: 'content',
|
||||
rules: 'required',
|
||||
},
|
||||
],
|
||||
showDefaultActions: false,
|
||||
wrapperClass: 'grid-cols-2',
|
||||
});
|
||||
|
||||
async function handleSubmit() {
|
||||
try {
|
||||
modalApi.modalLoading(true);
|
||||
|
||||
const { valid } = await formApi.validate();
|
||||
if (!valid) {
|
||||
return;
|
||||
}
|
||||
const { content } = await formApi.getValues();
|
||||
|
||||
await (currentUserId.value
|
||||
? sseSendByUserId(currentUserId.value, content)
|
||||
: sseSendAll(content));
|
||||
modalApi.close();
|
||||
} catch (error) {
|
||||
console.error(error);
|
||||
} finally {
|
||||
modalApi.modalLoading(false);
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<BasicModal
|
||||
:close-on-click-modal="false"
|
||||
:fullscreen-button="false"
|
||||
:title="title"
|
||||
>
|
||||
<BasicForm />
|
||||
</BasicModal>
|
||||
</template>
|
@@ -1,24 +0,0 @@
|
||||
<script setup lang="ts">
|
||||
import { ref } from 'vue';
|
||||
|
||||
import { Page } from '@vben/common-ui';
|
||||
|
||||
import { Switch } from 'ant-design-vue';
|
||||
|
||||
import { Tinymce } from '#/components/tinymce';
|
||||
|
||||
const readonly = ref(false);
|
||||
const content = ref('');
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<Page title="Tinymce富文本">
|
||||
<div class="flex flex-col gap-[16px]">
|
||||
<div class="flex items-center gap-[16px]">
|
||||
<span>禁用</span>
|
||||
<Switch v-model:checked="readonly" />
|
||||
</div>
|
||||
<Tinymce v-model="content" :height="800" :disabled="readonly" />
|
||||
</div>
|
||||
</Page>
|
||||
</template>
|
@@ -1,32 +0,0 @@
|
||||
import { ref } from 'vue';
|
||||
|
||||
export function useImageType() {
|
||||
const imageListTypes = ['text', 'picture', 'picture-card'] as const;
|
||||
const imageListOptions = imageListTypes.map((str) => ({
|
||||
label: str,
|
||||
value: str,
|
||||
}));
|
||||
|
||||
const currentImageListType =
|
||||
ref<(typeof imageListTypes)[number]>('picture-card');
|
||||
|
||||
return {
|
||||
imageListOptions,
|
||||
currentImageListType,
|
||||
};
|
||||
}
|
||||
|
||||
export function useFileType() {
|
||||
const fileListTypes = ['text', 'picture'] as const;
|
||||
const fileListOptions = fileListTypes.map((str) => ({
|
||||
label: str,
|
||||
value: str,
|
||||
}));
|
||||
|
||||
const currentFileListType = ref<(typeof fileListTypes)[number]>('picture');
|
||||
|
||||
return {
|
||||
fileListOptions,
|
||||
currentFileListType,
|
||||
};
|
||||
}
|
@@ -1,236 +0,0 @@
|
||||
<script setup lang="ts">
|
||||
import type { UploadFile } from 'ant-design-vue/es/upload/interface';
|
||||
|
||||
import type { CustomGetter } from '#/components/upload/src/props';
|
||||
|
||||
import { h, ref } from 'vue';
|
||||
|
||||
import { CodeMirror, Page, useVbenModal } from '@vben/common-ui';
|
||||
|
||||
import { useClipboard } from '@vueuse/core';
|
||||
import { Alert, Card, Modal, RadioGroup, Switch } from 'ant-design-vue';
|
||||
|
||||
import { FileUpload, ImageUpload } from '#/components/upload';
|
||||
|
||||
import { useFileType, useImageType } from './hook';
|
||||
import sql from './insert.sql?raw';
|
||||
import uploadModal from './upload-modal.vue';
|
||||
|
||||
const singleImageId = ref('1905537674682916865');
|
||||
const singleFileId = ref('1905191167882518529');
|
||||
const multipleImageId = ref<string[]>(['1905537674682916865']);
|
||||
const multipleFileId = ref<string[]>(['1905191167882518529']);
|
||||
|
||||
function handlePreview(file: UploadFile) {
|
||||
Modal.info({
|
||||
content: h('div', { class: 'break-all' }, JSON.stringify(file, null, 2)),
|
||||
maskClosable: true,
|
||||
});
|
||||
}
|
||||
|
||||
function customAccept(accept: string) {
|
||||
return accept
|
||||
.split(',')
|
||||
.map((str) => str.toUpperCase())
|
||||
.join(',');
|
||||
}
|
||||
|
||||
const showComponent = ref(true);
|
||||
|
||||
const { imageListOptions, currentImageListType } = useImageType();
|
||||
const { fileListOptions, currentFileListType } = useFileType();
|
||||
|
||||
const customName: CustomGetter<string> = (cb) => {
|
||||
if (cb.type === 'info') {
|
||||
return `加上自定义前缀显示 - ${cb.response.originalName.toUpperCase()}`;
|
||||
}
|
||||
return `加上自定义前缀显示 - ${cb.response.fileName.toUpperCase()}`;
|
||||
};
|
||||
|
||||
const customThumbnailUrl: CustomGetter<undefined> = () => {
|
||||
return 'https://unpkg.com/@vbenjs/static-source@0.1.7/source/logo-v1.webp';
|
||||
};
|
||||
|
||||
const { copy } = useClipboard({ legacy: true });
|
||||
|
||||
const animationEnable = ref(false);
|
||||
|
||||
const [UploadModal, uploadModalApi] = useVbenModal({
|
||||
connectedComponent: uploadModal,
|
||||
});
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<Page>
|
||||
<Card class="mb-2" title="提示" size="small">
|
||||
本地想体验可以导入这个sql(mysql的 其他的自行处理或者手动从菜单添加)
|
||||
<a-button size="small" @click="copy(sql)">复制</a-button>
|
||||
<CodeMirror class="mt-2" v-model="sql" language="sql" readonly />
|
||||
</Card>
|
||||
<div class="grid grid-cols-2 gap-4">
|
||||
<Card title="表单上传">
|
||||
<a-button @click="uploadModalApi.open()">打开</a-button>
|
||||
<UploadModal />
|
||||
</Card>
|
||||
<Card title="单上传, 会绑定为string" size="small">
|
||||
<ImageUpload v-model:value="singleImageId" />
|
||||
当前绑定值: {{ singleImageId }}
|
||||
|
||||
<FileUpload class="mt-6" v-model:value="singleFileId" />
|
||||
当前绑定值: {{ singleFileId }}
|
||||
</Card>
|
||||
|
||||
<Card title="多上传, maxCount参数控制(开启深度监听)" size="small">
|
||||
<ImageUpload
|
||||
v-model:value="multipleImageId"
|
||||
:max-count="3"
|
||||
:deep-watch="true"
|
||||
/>
|
||||
当前绑定值: {{ multipleImageId }}
|
||||
|
||||
<FileUpload
|
||||
class="mt-6"
|
||||
v-model:value="multipleFileId"
|
||||
:max-count="3"
|
||||
:deep-watch="true"
|
||||
/>
|
||||
当前绑定值: {{ multipleFileId }}
|
||||
</Card>
|
||||
|
||||
<Card title="文件自定义预览逻辑" size="small">
|
||||
<Alert
|
||||
message="你可以自定义预览逻辑, 比如改为下载, 回调参数为文件信息"
|
||||
class="my-2"
|
||||
/>
|
||||
<FileUpload
|
||||
v-model:value="multipleFileId"
|
||||
:max-count="3"
|
||||
:preview="handlePreview"
|
||||
:help-message="false"
|
||||
/>
|
||||
<ImageUpload
|
||||
class="mt-6"
|
||||
v-model:value="multipleImageId"
|
||||
:max-count="3"
|
||||
:preview="handlePreview"
|
||||
:help-message="false"
|
||||
/>
|
||||
</Card>
|
||||
|
||||
<Card title="文件/图片拖拽上传" size="small">
|
||||
<FileUpload
|
||||
v-model:value="multipleFileId"
|
||||
:max-count="3"
|
||||
:enable-drag-upload="true"
|
||||
/>
|
||||
<ImageUpload
|
||||
class="mt-6"
|
||||
v-model:value="multipleImageId"
|
||||
:enable-drag-upload="true"
|
||||
:max-count="6"
|
||||
/>
|
||||
</Card>
|
||||
|
||||
<Card title="禁用上传" size="small">
|
||||
<ImageUpload :disabled="true" :max-count="3" :help-message="false" />
|
||||
<FileUpload
|
||||
class="mt-6"
|
||||
:disabled="true"
|
||||
:max-count="3"
|
||||
:help-message="false"
|
||||
/>
|
||||
</Card>
|
||||
|
||||
<Card title="文件夹上传/自定义helpMessage" size="small">
|
||||
<FileUpload
|
||||
v-model:value="multipleFileId"
|
||||
:max-count="3"
|
||||
:directory="true"
|
||||
accept="*"
|
||||
>
|
||||
<template #helpMessage="slotProps">
|
||||
<div class="mt-2 font-semibold text-green-500">
|
||||
自定义helpMessage: {{ JSON.stringify(slotProps) }}
|
||||
</div>
|
||||
</template>
|
||||
</FileUpload>
|
||||
</Card>
|
||||
|
||||
<Card title="自定义accept显示" size="small">
|
||||
<ImageUpload
|
||||
v-model:value="singleImageId"
|
||||
:accept-format="customAccept"
|
||||
/>
|
||||
<ImageUpload
|
||||
class="mt-6"
|
||||
v-model:value="singleImageId"
|
||||
accept-format="自定义显示允许的文件类型"
|
||||
/>
|
||||
</Card>
|
||||
|
||||
<Card title="默认在unMounted会取消上传" size="small">
|
||||
<div>将开发者工具调整网络为3G 切换挂载/卸载 可见请求在卸载被取消</div>
|
||||
挂载/卸载组件: <Switch v-model:checked="showComponent" />
|
||||
<FileUpload v-if="showComponent" v-model:value="singleFileId" />
|
||||
</Card>
|
||||
|
||||
<Card title="图片: listType控制上传样式" size="small">
|
||||
<RadioGroup
|
||||
v-model:value="currentImageListType"
|
||||
:options="imageListOptions"
|
||||
button-style="solid"
|
||||
option-type="button"
|
||||
/>
|
||||
<ImageUpload
|
||||
class="mt-2"
|
||||
v-model:value="singleImageId"
|
||||
:list-type="currentImageListType"
|
||||
/>
|
||||
</Card>
|
||||
|
||||
<Card title="文件: listType控制上传样式" size="small">
|
||||
<div class="mb-2 text-red-500">
|
||||
注意文件上传不支持`picture-card`类型
|
||||
</div>
|
||||
<div class="mb-2 text-red-500">
|
||||
注意不要中途切换list-type(应该仅作为初始化属性使用) 会导致样式计算问题
|
||||
helpMessage和文件会重叠
|
||||
</div>
|
||||
<RadioGroup
|
||||
v-model:value="currentFileListType"
|
||||
:options="fileListOptions"
|
||||
button-style="solid"
|
||||
option-type="button"
|
||||
/>
|
||||
<FileUpload
|
||||
class="mt-2"
|
||||
v-model:value="singleFileId"
|
||||
:list-type="currentFileListType"
|
||||
/>
|
||||
</Card>
|
||||
|
||||
<Card title="自定义缩略图和文件名" size="small">
|
||||
<FileUpload
|
||||
v-model:value="multipleFileId"
|
||||
:max-count="5"
|
||||
list-type="picture"
|
||||
:custom-filename="customName"
|
||||
:custom-thumb-url="customThumbnailUrl"
|
||||
/>
|
||||
</Card>
|
||||
|
||||
<Card title="图片上传的动画效果" size="small">
|
||||
<div class="my-2">
|
||||
是否启用
|
||||
<span class="font-semibold">list-type: picture-card</span> 的动画效果:
|
||||
<Switch v-model:checked="animationEnable" />
|
||||
</div>
|
||||
<ImageUpload
|
||||
v-model:value="singleImageId"
|
||||
:with-animation="animationEnable"
|
||||
/>
|
||||
当前绑定值: {{ singleImageId }}
|
||||
</Card>
|
||||
</div>
|
||||
</Page>
|
||||
</template>
|
@@ -1 +0,0 @@
|
||||
INSERT INTO `sys_menu` (`menu_id`, `menu_name`, `parent_id`, `order_num`, `path`, `component`, `query_param`, `is_frame`, `is_cache`, `menu_type`, `visible`, `status`, `perms`, `icon`, `create_dept`, `create_by`, `create_time`, `update_by`, `update_time`, `remark`) VALUES (1905430203187712002, '文件上传Demo', 0, 1000, 'upload_test', '演示使用自行删除/upload/index', NULL, 1, 0, 'C', '0', '0', NULL, '#', 103, 1, '2025-03-28 09:22:16', 1, '2025-03-28 09:22:16', '');
|
@@ -1,70 +0,0 @@
|
||||
<script setup lang="ts">
|
||||
import { h } from 'vue';
|
||||
|
||||
import { JsonPreview, useVbenModal } from '@vben/common-ui';
|
||||
|
||||
import { Modal, Space } from 'ant-design-vue';
|
||||
|
||||
import { useVbenForm } from '#/adapter/form';
|
||||
|
||||
const [BasicForm, formApi] = useVbenForm({
|
||||
layout: 'vertical',
|
||||
schema: [
|
||||
{
|
||||
label: '图片上传多图',
|
||||
component: 'ImageUpload',
|
||||
fieldName: 'ossIds',
|
||||
componentProps: {
|
||||
maxCount: 3,
|
||||
},
|
||||
},
|
||||
{
|
||||
label: '图片上传单图',
|
||||
component: 'ImageUpload',
|
||||
fieldName: 'ossId',
|
||||
componentProps: {
|
||||
maxCount: 1,
|
||||
},
|
||||
},
|
||||
],
|
||||
showDefaultActions: false,
|
||||
});
|
||||
|
||||
async function getValues() {
|
||||
try {
|
||||
const v = await formApi.getValues();
|
||||
console.log(v);
|
||||
|
||||
Modal.info({
|
||||
content: () => h(JsonPreview, { data: v }),
|
||||
});
|
||||
} catch (error) {
|
||||
console.error(error);
|
||||
}
|
||||
}
|
||||
|
||||
async function handleAssign() {
|
||||
const ids = ['1908761290673315841', '1907738568539332610'];
|
||||
await formApi.setValues({
|
||||
ossIds: ids,
|
||||
ossId: ids[0],
|
||||
});
|
||||
}
|
||||
|
||||
const [BasicModal] = useVbenModal({
|
||||
title: '上传',
|
||||
footer: false,
|
||||
});
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<BasicModal>
|
||||
<div class="flex flex-col">
|
||||
<Space>
|
||||
<a-button @click="handleAssign">赋值</a-button>
|
||||
<a-button @click="getValues">获取值</a-button>
|
||||
</Space>
|
||||
<BasicForm />
|
||||
</div>
|
||||
</BasicModal>
|
||||
</template>
|
@@ -1,32 +0,0 @@
|
||||
import { requestClient } from '#/api/request';
|
||||
|
||||
export interface Temp {
|
||||
name: string;
|
||||
value: number;
|
||||
}
|
||||
|
||||
export function visitList() {
|
||||
return requestClient.get<Temp[]>('/monitor/logininfor/visitsMap');
|
||||
}
|
||||
|
||||
export function deviceInfoList() {
|
||||
return requestClient.get<Temp[]>('/monitor/logininfor/deviceInfoList');
|
||||
}
|
||||
|
||||
export function browserInfoList() {
|
||||
return requestClient.get<Temp[]>('/monitor/logininfor/browserInfoList');
|
||||
}
|
||||
|
||||
export function ispInfoList() {
|
||||
return requestClient.get<Temp[]>('/monitor/logininfor/ispInfoList');
|
||||
}
|
||||
|
||||
export interface LoginLineResp {
|
||||
date: string[];
|
||||
fail: number[];
|
||||
success: number[];
|
||||
}
|
||||
|
||||
export function loginLine() {
|
||||
return requestClient.get<LoginLineResp>('/monitor/logininfor/loginLine');
|
||||
}
|
File diff suppressed because it is too large
Load Diff
@@ -1,26 +0,0 @@
|
||||
<script lang="ts" setup>
|
||||
import { ref } from 'vue';
|
||||
|
||||
import { Tabs } from 'ant-design-vue';
|
||||
|
||||
import Browser from './pages/browser.vue';
|
||||
import Device from './pages/device.vue';
|
||||
import Isp from './pages/isp.vue';
|
||||
import LoginLine from './pages/loginLine.vue';
|
||||
import VisitMap from './pages/map.vue';
|
||||
|
||||
const TabPane = Tabs.TabPane;
|
||||
|
||||
const activeKey = ref<number>(1);
|
||||
</script>
|
||||
<template>
|
||||
<div class="pt-[16px]">
|
||||
<Tabs v-model:activeKey="activeKey" class="h-full" tab-position="left">
|
||||
<TabPane :key="1" tab="访问量数据"> <VisitMap /> </TabPane>
|
||||
<TabPane :key="2" tab="使用设备"><Device /></TabPane>
|
||||
<TabPane :key="3" tab="使用浏览器"><Browser /></TabPane>
|
||||
<TabPane :key="4" tab="登录量"><LoginLine /></TabPane>
|
||||
<TabPane :key="5" tab="运营商占比"><Isp /></TabPane>
|
||||
</Tabs>
|
||||
</div>
|
||||
</template>
|
@@ -1,62 +0,0 @@
|
||||
<script setup lang="ts">
|
||||
import type { EChartsOption } from 'echarts';
|
||||
|
||||
// import * as echarts from 'echarts';
|
||||
import { onMounted, ref } from 'vue';
|
||||
|
||||
import {
|
||||
EchartsUI,
|
||||
type EchartsUIType,
|
||||
useEcharts,
|
||||
} from '@vben/plugins/echarts';
|
||||
|
||||
import { browserInfoList } from '../api';
|
||||
|
||||
defineOptions({ name: 'Browser' });
|
||||
|
||||
const browserRef = ref<EchartsUIType>();
|
||||
const { renderEcharts } = useEcharts(browserRef);
|
||||
|
||||
onMounted(async () => {
|
||||
const data = await browserInfoList();
|
||||
const options: EChartsOption = {
|
||||
legend: {
|
||||
left: 'left',
|
||||
orient: 'vertical',
|
||||
},
|
||||
series: [
|
||||
{
|
||||
data,
|
||||
emphasis: {
|
||||
itemStyle: {
|
||||
shadowBlur: 10,
|
||||
shadowColor: 'rgba(0, 0, 0, 0.5)',
|
||||
shadowOffsetX: 0,
|
||||
},
|
||||
},
|
||||
// 百分比
|
||||
label: {
|
||||
formatter: '{b}: {c} - ({d}%)', // 自定义显示格式(b:name, c:value, d:百分比)
|
||||
show: true,
|
||||
},
|
||||
radius: '50%',
|
||||
type: 'pie',
|
||||
},
|
||||
],
|
||||
title: {
|
||||
left: 'center',
|
||||
text: '使用浏览器占比',
|
||||
},
|
||||
tooltip: {
|
||||
trigger: 'item',
|
||||
},
|
||||
};
|
||||
renderEcharts(options);
|
||||
});
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<EchartsUI ref="browserRef" height="720px" width="100%" />
|
||||
</template>
|
||||
|
||||
<style scoped></style>
|
@@ -1,62 +0,0 @@
|
||||
<script setup lang="ts">
|
||||
import type { EChartsOption } from 'echarts';
|
||||
|
||||
// import * as echarts from 'echarts';
|
||||
import { onMounted, ref } from 'vue';
|
||||
|
||||
import {
|
||||
EchartsUI,
|
||||
type EchartsUIType,
|
||||
useEcharts,
|
||||
} from '@vben/plugins/echarts';
|
||||
|
||||
import { deviceInfoList } from '../api';
|
||||
|
||||
defineOptions({ name: 'Device' });
|
||||
|
||||
const deviceRef = ref<EchartsUIType>();
|
||||
const { renderEcharts } = useEcharts(deviceRef);
|
||||
|
||||
onMounted(async () => {
|
||||
const data = await deviceInfoList();
|
||||
const options: EChartsOption = {
|
||||
legend: {
|
||||
left: 'left',
|
||||
orient: 'vertical',
|
||||
},
|
||||
series: [
|
||||
{
|
||||
data,
|
||||
emphasis: {
|
||||
itemStyle: {
|
||||
shadowBlur: 10,
|
||||
shadowColor: 'rgba(0, 0, 0, 0.5)',
|
||||
shadowOffsetX: 0,
|
||||
},
|
||||
},
|
||||
// 百分比
|
||||
label: {
|
||||
formatter: '{b}: {c} - ({d}%)', // 自定义显示格式(b:name, c:value, d:百分比)
|
||||
show: true,
|
||||
},
|
||||
radius: '50%',
|
||||
type: 'pie',
|
||||
},
|
||||
],
|
||||
title: {
|
||||
left: 'center',
|
||||
text: '使用设备占比',
|
||||
},
|
||||
tooltip: {
|
||||
trigger: 'item',
|
||||
},
|
||||
};
|
||||
renderEcharts(options);
|
||||
});
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<EchartsUI ref="deviceRef" height="720px" width="100%" />
|
||||
</template>
|
||||
|
||||
<style scoped></style>
|
@@ -1,62 +0,0 @@
|
||||
<script setup lang="ts">
|
||||
import type { EChartsOption } from 'echarts';
|
||||
|
||||
// import * as echarts from 'echarts';
|
||||
import { onMounted, ref } from 'vue';
|
||||
|
||||
import {
|
||||
EchartsUI,
|
||||
type EchartsUIType,
|
||||
useEcharts,
|
||||
} from '@vben/plugins/echarts';
|
||||
|
||||
import { ispInfoList } from '../api';
|
||||
|
||||
defineOptions({ name: 'Isp' });
|
||||
|
||||
const ispRef = ref<EchartsUIType>();
|
||||
const { renderEcharts } = useEcharts(ispRef);
|
||||
|
||||
onMounted(async () => {
|
||||
const data = await ispInfoList();
|
||||
const options: EChartsOption = {
|
||||
legend: {
|
||||
left: 'left',
|
||||
orient: 'vertical',
|
||||
},
|
||||
series: [
|
||||
{
|
||||
data,
|
||||
emphasis: {
|
||||
itemStyle: {
|
||||
shadowBlur: 10,
|
||||
shadowColor: 'rgba(0, 0, 0, 0.5)',
|
||||
shadowOffsetX: 0,
|
||||
},
|
||||
},
|
||||
// 百分比
|
||||
label: {
|
||||
formatter: '{b}: {c} - ({d}%)', // 自定义显示格式(b:name, c:value, d:百分比)
|
||||
show: true,
|
||||
},
|
||||
radius: '50%',
|
||||
type: 'pie',
|
||||
},
|
||||
],
|
||||
title: {
|
||||
left: 'center',
|
||||
text: '网络运营商占比',
|
||||
},
|
||||
tooltip: {
|
||||
trigger: 'item',
|
||||
},
|
||||
};
|
||||
renderEcharts(options);
|
||||
});
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<EchartsUI ref="ispRef" height="720px" width="100%" />
|
||||
</template>
|
||||
|
||||
<style scoped></style>
|
@@ -1,83 +0,0 @@
|
||||
<script setup lang="ts">
|
||||
import type { EChartsOption } from 'echarts';
|
||||
|
||||
// import * as echarts from 'echarts';
|
||||
import { onMounted, ref } from 'vue';
|
||||
|
||||
import {
|
||||
EchartsUI,
|
||||
type EchartsUIType,
|
||||
useEcharts,
|
||||
} from '@vben/plugins/echarts';
|
||||
|
||||
import { loginLine } from '../api';
|
||||
|
||||
defineOptions({ name: 'LoginLine' });
|
||||
|
||||
const loginLineRef = ref<EchartsUIType>();
|
||||
const { renderEcharts } = useEcharts(loginLineRef);
|
||||
|
||||
onMounted(async () => {
|
||||
const data = await loginLine();
|
||||
console.log(data);
|
||||
const options: EChartsOption = {
|
||||
legend: {},
|
||||
series: [
|
||||
{
|
||||
data: data.success,
|
||||
itemStyle: {
|
||||
color: '#3399CC',
|
||||
},
|
||||
lineStyle: {
|
||||
color: '#3399CC',
|
||||
},
|
||||
name: '登录成功',
|
||||
type: 'line',
|
||||
},
|
||||
{
|
||||
data: data.fail,
|
||||
itemStyle: {
|
||||
color: '#CC6633',
|
||||
},
|
||||
lineStyle: {
|
||||
color: '#CC6633',
|
||||
},
|
||||
name: '登录失败',
|
||||
type: 'line',
|
||||
},
|
||||
],
|
||||
title: {
|
||||
text: '近一月登录量统计',
|
||||
},
|
||||
toolbox: {
|
||||
feature: {
|
||||
dataView: { readOnly: true },
|
||||
dataZoom: {
|
||||
yAxisIndex: 'none',
|
||||
},
|
||||
magicType: { type: ['line', 'bar'] },
|
||||
saveAsImage: {},
|
||||
},
|
||||
show: true,
|
||||
},
|
||||
tooltip: {
|
||||
trigger: 'axis',
|
||||
},
|
||||
xAxis: {
|
||||
boundaryGap: false,
|
||||
data: data.date,
|
||||
type: 'category',
|
||||
},
|
||||
yAxis: {
|
||||
type: 'value',
|
||||
},
|
||||
};
|
||||
renderEcharts(options);
|
||||
});
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<EchartsUI ref="loginLineRef" height="720px" width="100%" />
|
||||
</template>
|
||||
|
||||
<style scoped></style>
|
@@ -1,111 +0,0 @@
|
||||
<script setup lang="ts">
|
||||
import type { EChartsOption } from 'echarts';
|
||||
|
||||
// import * as echarts from 'echarts';
|
||||
import { onMounted, ref } from 'vue';
|
||||
|
||||
import {
|
||||
EchartsUI,
|
||||
type EchartsUIType,
|
||||
useEcharts,
|
||||
} from '@vben/plugins/echarts';
|
||||
|
||||
import * as echarts from 'echarts/core';
|
||||
|
||||
import { type Temp, visitList } from '../api';
|
||||
import * as chinaMap from '../china.json';
|
||||
|
||||
defineOptions({ name: 'VisitMap' });
|
||||
|
||||
const mapRef = ref<EchartsUIType>();
|
||||
const { renderEcharts } = useEcharts(mapRef);
|
||||
|
||||
function transformData(data: Temp[]) {
|
||||
const nameList: string[] = chinaMap.features.map(
|
||||
(item) => item.properties.name,
|
||||
);
|
||||
// eslint-disable-next-line unicorn/prefer-set-has
|
||||
const dataNameList: string[] = data.map((item) => item.name);
|
||||
// 差集
|
||||
const diff = nameList.filter(
|
||||
(item) => !dataNameList.includes(item) && item.trim() !== '',
|
||||
);
|
||||
diff.forEach((name) => {
|
||||
data.push({
|
||||
name,
|
||||
value: 0,
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
onMounted(async () => {
|
||||
echarts.registerMap('china', chinaMap as any);
|
||||
const data = await visitList();
|
||||
transformData(data);
|
||||
const max = Math.max.apply(
|
||||
null,
|
||||
data.map((item) => item.value),
|
||||
);
|
||||
const options: EChartsOption = {
|
||||
series: [
|
||||
{
|
||||
data,
|
||||
emphasis: {
|
||||
label: {
|
||||
show: true,
|
||||
},
|
||||
},
|
||||
label: {
|
||||
// formatter: '{b}\n{c}',
|
||||
formatter: '{c}',
|
||||
position: 'inside',
|
||||
show: true,
|
||||
},
|
||||
map: 'china',
|
||||
roam: true,
|
||||
// 由于缩放 这里加上偏移
|
||||
top: 200,
|
||||
type: 'map',
|
||||
zoom: 1.5,
|
||||
},
|
||||
],
|
||||
title: {
|
||||
left: 'right',
|
||||
text: '用户访问量数据',
|
||||
},
|
||||
toolbox: {
|
||||
feature: {
|
||||
dataView: { readOnly: true },
|
||||
saveAsImage: {},
|
||||
},
|
||||
// orient: 'vertical',
|
||||
left: 'left',
|
||||
show: true,
|
||||
top: 'top',
|
||||
},
|
||||
tooltip: {
|
||||
formatter: '{b}<br/>{c}',
|
||||
showDelay: 0,
|
||||
transitionDuration: 0.2,
|
||||
trigger: 'item',
|
||||
},
|
||||
visualMap: {
|
||||
calculable: true,
|
||||
inRange: {
|
||||
color: ['#ffffff', '#00FF66', '#00CCFF', '#CC6600'],
|
||||
},
|
||||
left: 'left',
|
||||
max,
|
||||
min: 0,
|
||||
text: ['最高', '最低'],
|
||||
},
|
||||
};
|
||||
renderEcharts(options);
|
||||
});
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<EchartsUI ref="mapRef" height="720px" width="100%" />
|
||||
</template>
|
||||
|
||||
<style scoped></style>
|
@@ -1,229 +0,0 @@
|
||||
<script setup lang="tsx">
|
||||
import type { VxeGridProps } from '#/adapter/vxe-table';
|
||||
|
||||
import { nextTick, onMounted } from 'vue';
|
||||
|
||||
import { JsonPreview } from '@vben/common-ui';
|
||||
import { getPopupContainer } from '@vben/utils';
|
||||
|
||||
import {
|
||||
Button,
|
||||
Input,
|
||||
InputNumber,
|
||||
message,
|
||||
Modal,
|
||||
Select,
|
||||
Space,
|
||||
} from 'ant-design-vue';
|
||||
|
||||
import { useVbenVxeGrid } from '#/adapter/vxe-table';
|
||||
|
||||
const gridOptions: VxeGridProps = {
|
||||
editConfig: {
|
||||
// 触发编辑的方式
|
||||
trigger: 'click',
|
||||
// 触发编辑的模式
|
||||
mode: 'row',
|
||||
showStatus: true,
|
||||
},
|
||||
border: true,
|
||||
rowConfig: {
|
||||
drag: true,
|
||||
},
|
||||
checkboxConfig: {},
|
||||
editRules: {
|
||||
name: [{ required: true, message: '请输入姓名', trigger: 'blur' }],
|
||||
age: [
|
||||
{ required: true, message: '请输入年龄', trigger: 'blur' },
|
||||
{ min: 0, max: 200, message: '年龄必须为1-200' },
|
||||
],
|
||||
job: [{ required: true, message: '请选择工作', trigger: 'blur' }],
|
||||
},
|
||||
columns: [
|
||||
{
|
||||
type: 'checkbox',
|
||||
width: 60,
|
||||
},
|
||||
{
|
||||
dragSort: true,
|
||||
title: '排序',
|
||||
width: 60,
|
||||
},
|
||||
{
|
||||
field: 'name',
|
||||
title: '姓名',
|
||||
align: 'left',
|
||||
editRender: {},
|
||||
slots: {
|
||||
default: ({ row }) => {
|
||||
if (!row.name) {
|
||||
return <span class="text-red-500">未填写</span>;
|
||||
}
|
||||
return <span>{row.name}</span>;
|
||||
},
|
||||
edit: ({ row }) => {
|
||||
return <Input placeholder={'请输入'} v-model:value={row.name} />;
|
||||
},
|
||||
},
|
||||
},
|
||||
{
|
||||
field: 'age',
|
||||
title: '年龄',
|
||||
align: 'left',
|
||||
editRender: {},
|
||||
slots: {
|
||||
default: ({ row }) => {
|
||||
if (!row.age) {
|
||||
return <span class="text-red-500">未填写</span>;
|
||||
}
|
||||
return <span>{row.age}</span>;
|
||||
},
|
||||
edit: ({ row }) => {
|
||||
return (
|
||||
<InputNumber
|
||||
class="w-full"
|
||||
placeholder={'请输入'}
|
||||
v-model:value={row.age}
|
||||
/>
|
||||
);
|
||||
},
|
||||
},
|
||||
},
|
||||
{
|
||||
field: '工作',
|
||||
title: 'job',
|
||||
align: 'left',
|
||||
editRender: {},
|
||||
slots: {
|
||||
default: ({ row }) => {
|
||||
if (!row.job) {
|
||||
return <span class="text-red-500">未选择</span>;
|
||||
}
|
||||
return <span>{row.job}</span>;
|
||||
},
|
||||
edit: ({ row }) => {
|
||||
const options = ['前端佬', '后端佬', '组长'].map((item) => ({
|
||||
label: item,
|
||||
value: item,
|
||||
}));
|
||||
return (
|
||||
<Select
|
||||
class="w-full"
|
||||
getPopupContainer={getPopupContainer}
|
||||
options={options}
|
||||
placeholder={'请选择'}
|
||||
v-model:value={row.job}
|
||||
/>
|
||||
);
|
||||
},
|
||||
},
|
||||
},
|
||||
{
|
||||
field: 'action',
|
||||
title: '操作',
|
||||
width: 100,
|
||||
slots: {
|
||||
default: ({ $table, row }) => {
|
||||
function handleDelete() {
|
||||
$table.remove(row);
|
||||
}
|
||||
return (
|
||||
<Button danger={true} onClick={handleDelete} size={'small'}>
|
||||
删除
|
||||
</Button>
|
||||
);
|
||||
},
|
||||
},
|
||||
},
|
||||
],
|
||||
height: 'auto',
|
||||
keepSource: true,
|
||||
pagerConfig: {
|
||||
enabled: false,
|
||||
},
|
||||
proxyConfig: {
|
||||
enabled: false,
|
||||
},
|
||||
toolbarConfig: {
|
||||
enabled: false,
|
||||
},
|
||||
showOverflow: false,
|
||||
};
|
||||
|
||||
const [BasicTable, tableApi] = useVbenVxeGrid({
|
||||
gridOptions,
|
||||
});
|
||||
|
||||
onMounted(async () => {
|
||||
const data = [
|
||||
{
|
||||
name: '张三',
|
||||
age: 18,
|
||||
job: '前端佬',
|
||||
},
|
||||
{
|
||||
name: '李四',
|
||||
age: 19,
|
||||
job: '后端佬',
|
||||
},
|
||||
{
|
||||
name: '王五',
|
||||
age: 20,
|
||||
job: '组长',
|
||||
},
|
||||
];
|
||||
await nextTick();
|
||||
await tableApi.grid.loadData(data);
|
||||
});
|
||||
async function handleAdd() {
|
||||
const record = { name: '', age: undefined, job: undefined };
|
||||
const { row: newRow } = await tableApi.grid.insert(record);
|
||||
await tableApi.grid.setEditCell(newRow, 'name');
|
||||
}
|
||||
|
||||
async function handleRemove() {
|
||||
await tableApi.grid.removeCheckboxRow();
|
||||
}
|
||||
|
||||
async function handleValidate() {
|
||||
const result = await tableApi.grid.validate(true);
|
||||
if (result) {
|
||||
message.error('校验失败');
|
||||
} else {
|
||||
message.success('校验成功');
|
||||
}
|
||||
}
|
||||
|
||||
function getData() {
|
||||
const data = tableApi.grid.getTableData();
|
||||
const { fullData } = data;
|
||||
console.log(fullData);
|
||||
Modal.info({
|
||||
title: '提示',
|
||||
content: (
|
||||
<div class="max-h-[350px] overflow-y-auto">
|
||||
<JsonPreview data={fullData} />
|
||||
</div>
|
||||
),
|
||||
});
|
||||
}
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<BasicTable>
|
||||
<template #toolbar-tools>
|
||||
<Space>
|
||||
<a-button @click="getData">获取表格数据</a-button>
|
||||
<a-button @click="handleValidate">校验</a-button>
|
||||
<a-button danger @click="handleRemove"> 删除勾选 </a-button>
|
||||
<a-button
|
||||
type="primary"
|
||||
v-access:code="['system:config:add']"
|
||||
@click="handleAdd"
|
||||
>
|
||||
{{ $t('pages.common.add') }}
|
||||
</a-button>
|
||||
</Space>
|
||||
</template>
|
||||
</BasicTable>
|
||||
</template>
|
@@ -1,17 +0,0 @@
|
||||
<script setup lang="ts">
|
||||
import { Page } from '@vben/common-ui';
|
||||
|
||||
import { Card } from 'ant-design-vue';
|
||||
|
||||
import EditTable from './edit-table.vue';
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<Page>
|
||||
<div class="flex flex-col gap-4">
|
||||
<Card title="可编辑表格" size="small">
|
||||
<EditTable class="h-[500px]" />
|
||||
</Card>
|
||||
</div>
|
||||
</Page>
|
||||
</template>
|
File diff suppressed because one or more lines are too long
@@ -1,23 +0,0 @@
|
||||
<script setup lang="ts">
|
||||
import { Page } from '@vben/common-ui';
|
||||
|
||||
import { Image } from 'ant-design-vue';
|
||||
|
||||
import wechatGroupImg from './img-base64.txt?raw';
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<Page>
|
||||
<div class="flex w-[360px] flex-col gap-2">
|
||||
<!-- <Alert :show-icon="true" message="人数已满,需要手动拉人" type="info" /> -->
|
||||
<div>
|
||||
<Image
|
||||
:preview="false"
|
||||
:src="wechatGroupImg"
|
||||
:width="240"
|
||||
class="pointer-events-none select-none"
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
</Page>
|
||||
</template>
|
@@ -27,8 +27,7 @@ export default defineConfig(async () => {
|
||||
changeOrigin: true,
|
||||
rewrite: (path) => path.replace(/^\/api/, ''),
|
||||
// mock代理目标地址
|
||||
target: 'http://127.0.0.1:8080',
|
||||
// target: 'http://183.230.235.66:11010/api',
|
||||
target: 'http://localhost:8080',
|
||||
ws: true,
|
||||
},
|
||||
},
|
||||
|
Reference in New Issue
Block a user