Compare commits

31 Commits

Author SHA1 Message Date
chy
ed058096be 修改登录 2026-02-27 14:00:45 +08:00
mll
47168c77d8 登录页背景自适应 登录框居中 2026-02-27 13:32:15 +08:00
mll
a8db600e90 同上 2026-02-26 12:06:23 +08:00
mll
baf731526f 维度和查询分割开 2026-02-26 12:05:34 +08:00
mll
c8d7fdd0f6 查询默认值 2026-02-25 15:46:17 +08:00
mll
c47dba53d9 Merge branch 'main' of http://8.130.49.250:3000/admin/gr_report_web 2026-02-23 14:48:08 +08:00
mll
e44d018f20 登录页1 2026-02-23 14:48:02 +08:00
chy
51922734ba 修改登录标题 2026-02-22 21:52:57 +08:00
mll
1af5fbd87c Merge branch 'main' of http://8.130.49.250:3000/admin/gr_report_web 2026-02-12 21:47:58 +08:00
mll
f2b5dd2a8d 固定多级表头 2026-02-12 21:47:53 +08:00
chy
36b4608ddf 111 2026-02-12 15:51:18 +08:00
chy
49c5d07b65 111 2026-02-12 14:26:25 +08:00
chy
dced583c7f 修改登录界面 2026-02-12 14:25:27 +08:00
chy
aa853f539b 解决冲突 2026-02-12 09:32:15 +08:00
chy
e7dd16454c Merge branch 'zh'
# Conflicts:
#	src/components/LowDesign/src/LowReport/index.vue
#	src/views/lowdesign/reportDesign/designData.ts
2026-02-12 08:50:42 +08:00
mll
cecaaacf4b view表单斑马纹 2026-02-11 16:57:52 +08:00
mll
76987e8ea6 Merge branch 'main' of http://8.130.49.250:3000/admin/gr_report_web 2026-02-11 11:30:43 +08:00
mll
7555c7093d no message 2026-02-11 11:30:30 +08:00
5ae5353baa Merge pull request 'main_beta' (#4) from main_beta into main
Reviewed-on: #4
2026-02-11 10:04:32 +08:00
mll
09a300e98a Merge branch 'main' of http://8.130.49.250:3000/admin/gr_report_web 2026-02-10 22:17:30 +08:00
mll
7a496e6407 加隐藏列 2026-02-10 22:17:26 +08:00
gesilong
1cdabba4da commit:更换首页获取应用接口 2026-02-10 16:44:58 +08:00
gesilong
d7def83ee4 commit:应用权限功能 2026-02-10 16:28:33 +08:00
chy
e69cffbdb6 Merge branch 'main_beta'
# Conflicts:
#	src/views/Home/Index20.vue
2026-02-10 09:52:20 +08:00
gesilong
34f7c68041 commit:首页重构;应用管理优化 2026-02-10 09:30:20 +08:00
mll
bcac3326a3 维度隐藏列 2026-02-09 20:16:36 +08:00
chy
f9393dfca8 1 2026-02-09 18:11:10 +08:00
chy
67fe2e22fc 修改国际化 2026-02-09 13:36:16 +08:00
chy
9e210114b6 添加工作台 2026-02-09 11:34:46 +08:00
chy
8185399f8f 1 2026-02-09 11:34:22 +08:00
7f62a5b191 Merge pull request 'zh' (#1) from zh into main
Reviewed-on: #1
2026-02-09 00:39:20 +08:00
24 changed files with 1003 additions and 719 deletions

2
.env
View File

@@ -1,5 +1,5 @@
# 标题
VITE_APP_TITLE=国瑞报表系统
VITE_APP_TITLE=国瑞药业报表系统
# 项目本地运行端口号
VITE_PORT=80

View File

@@ -4,7 +4,7 @@ VITE_NODE_ENV=production
VITE_DEV=false
# 请求路径
VITE_BASE_URL='http://127.0.0.1:48080'
VITE_BASE_URL='http://192.168.1.241'
# 文件上传类型server - 后端上传, client - 前端直连上传仅支持S3服务
VITE_UPLOAD_TYPE=server

View File

@@ -17,6 +17,21 @@ export interface UpdateStatusReqVO {
status: number
}
// 获取登陆用户的应用
export const getMyPage = async (params: PageParam) => {
return await request.get({ url: '/system/oauth2-client/myPage', params })
}
// 获取角色下的应用id
export const getRoleAppIds = async (roleId: number) => {
return await request.get({ url: '/system/permission/list-role-clients?roleId=' + roleId })
}
// 新增角色
export const saveApp = async (data: any) => {
return await request.post({ url: '/system/permission/assign-role-client', data })
}
// 查询角色列表
export const getRolePage = async (params: PageParam) => {
return await request.get({ url: '/system/role/page', params })

Binary file not shown.

After

Width:  |  Height:  |  Size: 148 KiB

BIN
src/assets/imgs/jsc.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.3 KiB

BIN
src/assets/imgs/sjzt.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.6 KiB

BIN
src/assets/imgs/szls.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.3 KiB

BIN
src/assets/imgs/wlzt.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.5 KiB

BIN
src/assets/imgs/znbb.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.8 KiB

View File

@@ -4,6 +4,7 @@
class="low-reoprt"
:class="[`low-report__${reportCode}`, { summary: tableOption.showSummary }]"
>
<div v-if="isSearch" style="margin-bottom:6px">查询</div>
<avue-crud
ref="crudRef"
v-model:search="tableSearch"
@@ -68,11 +69,14 @@
></InputTimeRange>
</template>
<template #header v-if="Object.keys(dimensionFields)?.length">
<div style="display:flex;margin-left:40px">
<el-checkbox-group @change="searchDimension" v-model="tableSearch['Group by']"
<div style="display:flex;align-items:center;border-top:1px solid #eee;margin-bottom:10px;padding-top:10px;">
<span style="margin-right:10px;">维度:</span>
<el-checkbox-group
@change="searchDimension" v-model="tableSearch['Group by']"
placeholder="请选择内容">
<template v-for="(item,key) in dimensionFields">
<el-checkbox v-if="tableSearch['Group by']&&tableSearch['Group by'].includes(key)||!tableSearch['Group by']?.length"
<el-checkbox
v-if="tableSearch['Group by']&&tableSearch['Group by'].includes(key)||!tableSearch['Group by']?.length"
:key="key"
:value="key"
:label="item.label"></el-checkbox>
@@ -115,6 +119,8 @@ const { mergeLocaleMessage, t } = useI18n() // 国际化
const loading = ref(false) // 列表的加载中
const isInit = ref(false)
const isSearch = ref(false)
const tableOption = ref<any>({})
const tableData = ref<any>([])
@@ -128,6 +134,7 @@ const tableInfo = ref<any>({})
const timerObj = ref<any>({})
const numberRange = ref<string[]>([])
const dateRange=ref<string[]>([])
const hideColumns=ref<string[]>([])
const dateTimeRange=ref<string[]>([])
const timeRange=ref<string[]>([])
const amountFieds=ref<any>({})
@@ -136,6 +143,7 @@ const crudRef = ref()
const dimensionFields=ref<any>({})
const exportLoading = ref(false)
const fieldList = ref<any[]>([]) // 添加fieldList引用
const hideFeilds= ref<any>({})
const permissions =
wsCache.get(CACHE_KEY.USER).lideeYunjipermissions?.[route.meta.menuDataId as string] || false
const selectIds = computed(() => {
@@ -165,6 +173,23 @@ const summaryMethod1=({columns,data})=>{
})
return result;
}
function getCurrentDate() {
const now = new Date();
// 补零函数小于10则前面加0
const padZero = (num) => num.toString().padStart(2, '0');
const year = now.getFullYear();
const month = padZero(now.getMonth() + 1);
const day = padZero(now.getDate());
// 返回格式化后的字符串或对象,按需选择
return {
year,
month,
day,
fullDate: `${year}-${month}-${day}` // 拼接成 2026-02-24 格式
};
}
const initTable = async () => {
isInit.value = false
loading.value = true
@@ -176,6 +201,7 @@ const initTable = async () => {
const isPage = reportVo.dataConfig?.includes('page')
const isPermi = reportVo.dataConfig?.includes('authTrue')
const isHideExport = reportVo.tableConfig?.includes('hideExport')
hideColumns.value=[]
tableInfo.value = { ...reportVo, isPage, isHeight, isPermi, isHideExport }
tableOption.value = {
selection: !isHideExport,
@@ -188,6 +214,9 @@ const initTable = async () => {
border: reportVo.tableConfig.includes('border'),
stripe: reportVo.tableConfig.includes('stripe'),
showSummary:false,
stripe:true,
column: {}
}
@@ -240,16 +269,34 @@ const initTable = async () => {
_hasChildConfig: childFieldConfigs.has(item.fieldCode),
_childConfigs: childFieldConfigs.get(item.fieldCode) || []
}
if(item.queryIsWeb == 'Y') isSearch.value=true
if(!!item.searchDefaultValue){
if(['年','年度','年份'].includes(item.fieldName)&&item.searchDefaultValue=='本年'){
tableSearch.value[config.prop]=getCurrentDate().year
}else if( ['月','月度','月份'].includes(item.fieldName)&&item.searchDefaultValue=='本月'){
tableSearch.value[config.prop]=new Date().getMonth() + 1
}else if(item.fieldType=='Date'&&item.searchDefaultValue=='当日'){
tableSearch.value[config.prop]=getCurrentDate().fullDate
}else{
tableSearch.value[config.prop]=item.searchDefaultValue
}
}
if(!!item.isAmount){
index==0?amountFieds.value.fistField=config.prop:''
amountFieds.value[item.isAmount]=config
tableOption.value.showSummary=true
}
if(item.width){
config.width=item.width
}
if(item.isDimension=='Y'){
dimensionFields.value[config.prop]=config
hideFeilds.value[config.prop]=item.isHideDimension
}
if(item.isHideCol == 'Y') {
config.hide = true
hideColumns.value.push( config.prop )
}
if (item.queryMode == 'RANGE') config.searchRange = true
if (['Integer', 'BigInt', 'BigDecimal'].includes(item.fieldType)) config.type = 'number'
else if (item.fieldType == 'Date') {
@@ -274,7 +321,19 @@ const initTable = async () => {
config.searchType = 'tag'
}
if (item.queryMode == 'NE') config.searchLabel = `${config.label} !=`
tableOption.value.column[item.fieldCode] = config
if(!item.parentFieldCode&&!!item.parentFieldName){
if(tableOption.value.column[item.parentFieldName]){
tableOption.value.column[item.parentFieldName].children.push(config)
}else{
tableOption.value.column[item.parentFieldName]={
children:[config],
label:item.parentFieldName
}
}
}else{
tableOption.value.column[item.fieldCode] = config
}
})
isInit.value = true
@@ -282,6 +341,7 @@ const initTable = async () => {
initTableLayout()
}
const searchDimension=()=>{
searchChange()
}
const initTableLayout = () => {
@@ -578,6 +638,15 @@ const clearSearch = () => {
const searchChange = (params?, done?) => {
if (tablePage.value) tablePage.value['currentPage'] = 1
getTableData().finally(() => {
let field=tableSearch.value['Group by']
let hides=[]
if(field.length){
hides=Object.keys(hideFeilds.value).length?hideFeilds.value[field].split(','):[]
}
Object.keys(tableOption.value.column).forEach(key=>{
let item=tableOption.value.column[key]
item.hide=hides.includes(item.prop)||hideColumns.value.includes(item.prop)
})
if (done) done()
})
}
@@ -640,10 +709,12 @@ defineExpose({
&::after{
content:'、'
}
&:last-of-type::after{
content:''
}
}
.lastAmountRow{
}

View File

@@ -69,7 +69,7 @@ export default {
noPermission: `抱歉,您无权访问此页面。`,
pageError: '抱歉,您访问的页面不存在。',
networkError: '抱歉,服务器报告错误。',
returnToHome: '返回首页'
returnToHome: '返回工作台'
},
permission: {
hasPermission: `请设置操作权限标签值`,
@@ -157,7 +157,7 @@ export default {
router: {
login: '登录',
socialLogin: '社交登录',
home: '首页',
home: '工作台',
analysis: '分析页',
workplace: '工作台'
},
@@ -275,7 +275,7 @@ export default {
},
exception: {
backLogin: '返回登录',
backHome: '返回首页',
backHome: '返回工作台',
subTitle403: '抱歉,您无权访问此页面。',
subTitle404: '抱歉,您访问的页面不存在。',
subTitle500: '抱歉,服务器报告错误。',
@@ -292,7 +292,7 @@ export default {
},
login: {
backSignIn: '返回',
signInFormTitle: '登录',
signInFormTitle: '国瑞药业工业互联网平台',
ssoFormTitle: '三方授权',
mobileSignInFormTitle: '手机登录',
qrSignInFormTitle: '二维码登录',

View File

@@ -59,7 +59,7 @@ const remainingRouter: AppRouteRecordRaw[] = [
children: [
{
path: 'index',
component: () => import('@/views/Home/Index5.vue'),
component: () => import('@/views/Home/Index20.vue'),
name: 'Index',
meta: {
title: t('router.home'),

View File

@@ -95,7 +95,9 @@
display: flex;
justify-content: flex-start;
}
.width-50{
width: 50% !important;
}
/* nprogress 适配 element-plus 的主题色 */
#nprogress {
& .bar {

View File

@@ -103,6 +103,8 @@ export const getDictLabel = (dictType: string, value: any): string => {
export enum DICT_TYPE {
USER_TYPE = 'user_type',
COMMON_STATUS = 'common_status',
APP_CATEGORY = 'app_category',
APP_QX = 'app_qx',
TERMINAL = 'terminal', // 终端
// ========== SYSTEM 模块 ==========
@@ -120,6 +122,7 @@ export enum DICT_TYPE {
SYSTEM_SMS_RECEIVE_STATUS = 'system_sms_receive_status',
SYSTEM_ERROR_CODE_TYPE = 'system_error_code_type',
SYSTEM_OAUTH2_GRANT_TYPE = 'system_oauth2_grant_type',
SYSTEM_OAUTH2_SCOPE='system_oauth2_scope',
SYSTEM_MAIL_SEND_STATUS = 'system_mail_send_status',
SYSTEM_NOTIFY_TEMPLATE_TYPE = 'system_notify_template_type',
SYSTEM_SOCIAL_TYPE = 'system_social_type',

View File

@@ -2,7 +2,7 @@ import dayjs from 'dayjs'
import type { TableColumnCtx } from 'element-plus'
/**
* 日期快捷选项适用于 el-date-picker
* 日期快捷选项适用于 -picker
*/
export const defaultShortcuts = [
{

View File

@@ -1,631 +1,371 @@
<template>
<ContentWrap>
<div class="app-container">
<!-- 头部区域 -->
<!-- <header class="app-header">
<h1 class="title">
<i class="el-icon-menu"></i>
</h1>
</header> -->
<el-table
:data="processedTableData" :span-method="objectSpanMethod" border stripe
height="calc(100vh - 300px)" style="width: 100%" v-loading="loading" :summary-method="getSummaries"
show-summary :summary-text="summaryText">
<!-- 动态生成表头 -->
<template v-for="dim in selectedDimensions" :key="dim">
<el-table-column
:prop="dim" :label="getDimensionName(dim)" :min-width="getColumnWidth(dim)"
show-overflow-tooltip>
<template #default="{ row }">
<span>{{ row[dim] || '-' }}</span>
</template>
</el-table-column>
</template>
<!-- 统计指标列 -->
<el-table-column prop="salesAmount" label="销售额(万)" width="120" sortable>
<template #default="{ row }">
{{ formatNumber(row.salesAmount) }}
</template>
</el-table-column>
<!-- 搜索区域 -->
<!-- <div class="search-container">
<el-input
v-model="searchQuery"
placeholder="搜索应用..."
clearable
prefix-icon="el-icon-search"
class="search-input"
></el-input>
</div> -->
<el-table-column prop="salesQuantity" label="销售数量" width="120" sortable>
<template #default="{ row }">
{{ formatNumber(row.salesQuantity) }}
</template>
</el-table-column>
<!-- 空状态 -->
<div v-if="Object.keys(filteredCategories).length === 0" class="empty-state">
<i class="el-icon-warning empty-icon"></i>
<h3>未找到匹配的应用</h3>
<p>请尝试调整搜索关键词</p>
</div>
<el-table-column prop="growthRate" label="同比增长" width="120" sortable>
<template #default="{ row }">
<span :class="getGrowthClass(row.growthRate)">
{{ formatPercent(row.growthRate) }}
</span>
</template>
</el-table-column>
</el-table>
</ContentWrap>
<!-- 分类应用展示 -->
<div
v-for="(category, categoryName) in filteredCategories"
:key="categoryName"
class="category-section">
<div class="category-header">
<h2 class="category-title">{{ categoryName }}</h2>
<el-tag size="small" class="app-count">{{ category.apps.length }} 个应用</el-tag>
</div>
<div class="apps-grid">
<div
v-for="app in category.apps"
:key="app.id"
class="app-card"
@click="handleAppClick(app)">
<div class="app-icon-wrapper">
<img :src="app.logo" class="app-icon-img" />
</div>
<div class="app-name">{{ app.name }}</div>
</div>
</div>
</div>
<!-- 应用详情对话框 -->
<el-dialog
v-model:visible="dialogVisible"
title="应用详情"
width="30%"
custom-class="app-dialog">
<div v-if="selectedApp" class="dialog-content">
<div class="dialog-icon-wrapper">
<img :src="selectedApp.logo" class="dialog-app-icon-img" />
</div>
<h3 class="dialog-app-name">{{ selectedApp.name }}</h3>
<p class="dialog-app-id">ID: {{ selectedApp.id }}</p>
<p class="dialog-app-category" v-if="selectedApp.category">分类: {{ selectedApp.category }}</p>
</div>
<template #footer>
<span class="dialog-footer">
<el-button @click="dialogVisible = false">取消</el-button>
<el-button type="primary" @click="confirmLaunch">启动</el-button>
</span>
</template>
</el-dialog>
</div>
</template>
<script setup>
import { ref, computed, watch, onMounted } from 'vue'
import { ElMessage } from 'element-plus'
import { Check } from '@element-plus/icons-vue'
import * as echarts from 'echarts'
// 维度定义 - 7个维度
const dimensions = ref([
{ id: 'salesType', name: '销售类型' },
{ id: 'customer', name: '客户' },
{ id: 'dosageForm', name: '剂型' },
{ id: 'product', name: '产品' },
{ id: 'administrativeArea', name: '行政区域' },
{ id: 'salesman', name: '业务员' },
{ id: 'specification', name: '品规' }
])
// 状态管理 - 默认选中所有维度
const selectedDimensions = ref(dimensions.value.map(d => d.id))
const primaryDimension = ref('product') // 默认主维度为产品
const tableData = ref([])
const loading = ref(false)
const lastUpdate = ref('')
const showChart = ref(true)
const activeChartTab = ref('bar')
// 合计行相关状态
const showSummaryRow = ref(true)
const totalStats = ref(null)
const summaryText = computed(() => showSummaryRow.value ? '合计' : '')
// 计算属性
const processedTableData = computed(() => {
return tableData.value.map(item => ({
...item,
formattedAmount: formatNumber(item.salesAmount),
formattedQuantity: formatNumber(item.salesQuantity),
formattedGrowth: formatPercent(item.growthRate)
}))
})
// 方法定义
const toggleDimension = (dimensionId) => {
const index = selectedDimensions.value.indexOf(dimensionId)
if (index > -1) {
// 如果当前维度是主维度,且只有一个维度被选中,不能移除
if (selectedDimensions.value.length === 1) {
ElMessage.warning('至少需要保留一个维度')
return
}
// 如果要移除的是当前主维度,则自动切换到下一个维度
if (dimensionId === primaryDimension.value) {
// 找下一个可用的维度作为主维度
const nextDim = selectedDimensions.value.find(d => d !== dimensionId)
if (nextDim) {
primaryDimension.value = nextDim
}
}
selectedDimensions.value.splice(index, 1)
} else {
selectedDimensions.value.push(dimensionId)
}
}
const getDimensionName = (dimensionId) => {
const dim = dimensions.value.find(d => d.id === dimensionId)
return dim ? dim.name : dimensionId
}
// 单元格合并逻辑
const objectSpanMethod = ({ row, column, rowIndex, columnIndex }) => {
if (!primaryDimension.value) return { rowspan: 1, colspan: 1 }
const prop = column.property
if (prop !== primaryDimension.value) return { rowspan: 1, colspan: 1 }
// 计算相同值的行数
let spanCount = 1
for (let i = rowIndex + 1; i < tableData.value.length; i++) {
if (tableData.value[i][prop] === row[prop]) {
spanCount++
} else {
break
}
}
// 如果是第一行,返回合并
let isFirstRow = true
for (let i = rowIndex - 1; i >= 0; i--) {
if (tableData.value[i][prop] === row[prop]) {
isFirstRow = false
break
}
}
if (isFirstRow && spanCount > 1) {
return { rowspan: spanCount, colspan: 1 }
} else {
return { rowspan: 0, colspan: 0 }
}
}
// 自定义合计方法 - 包含同比增长的加权平均计算
const getSummaries = (param) => {
const { columns, data } = param
const sums = []
columns.forEach((column, index) => {
if (index === 0) {
sums[index] = showSummaryRow.value ? '合计' : ''
return
}
// 如果不是数值列,不显示合计
if (!['salesAmount', 'salesQuantity', 'growthRate'].includes(column.property)) {
sums[index] = ''
return
}
// 计算数值列的总和或加权平均
const values = data.map(item => Number(item[column.property]))
if (!values.every(value => isNaN(value))) {
if (column.property === 'salesAmount' || column.property === 'salesQuantity') {
// 销售额和销售数量直接求和
const sum = values.reduce((prev, curr) => {
const value = Number(curr)
if (!isNaN(value)) {
return prev + curr
} else {
return prev
}
}, 0)
if (column.property === 'salesAmount') {
sums[index] = formatNumber(sum)
} else if (column.property === 'salesQuantity') {
sums[index] = formatNumber(sum)
<script>
import * as RoleApi from '@/api/system/role'
import { DICT_TYPE, getDictLabel } from '@/utils/dict'
export default {
name: 'AppManager',
data() {
return {
searchQuery: '',
dialogVisible: false,
selectedApp: null,
appsData: []
};
},
mounted() {
this.fetchApps()
},
computed: {
categorizedApps() {
const result = {};
this.appsData.forEach(app => {
const categoryLabel = app.categoryLabel || '未分类'
if (!result[categoryLabel]) {
result[categoryLabel] = { apps: [] }
}
} else if (column.property === 'growthRate') {
// 同比增长率需要计算加权平均值(按销售额加权)
let totalAmount = 0
let weightedGrowthSum = 0
data.forEach(item => {
const amount = Number(item.salesAmount) || 0
const growth = Number(item.growthRate) || 0
if (!isNaN(amount) && !isNaN(growth)) {
totalAmount += amount
weightedGrowthSum += growth * amount
}
})
const avgGrowth = totalAmount > 0 ? weightedGrowthSum / totalAmount : 0
sums[index] = formatPercent(avgGrowth)
}
} else {
sums[index] = '-'
}
})
return sums
}
// 数据获取
const fetchData = async () => {
loading.value = true
try {
// 使用模拟数据
setTimeout(() => {
tableData.value = generateMockData()
// 计算并保存总统计数据
calculateTotalStats()
lastUpdate.value = new Date().toLocaleString()
loading.value = false
// 更新图表
if (showChart.value) {
updateCharts()
}
}, 1000)
} catch (error) {
console.error('获取数据失败:', error)
loading.value = false
ElMessage.error('获取数据失败')
}
}
// 计算总统计数据
const calculateTotalStats = () => {
const totalAmount = tableData.value.reduce((sum, row) => sum + (row.salesAmount || 0), 0)
const totalQuantity = tableData.value.reduce((sum, row) => sum + (row.salesQuantity || 0), 0)
// 计算加权平均增长率(按销售额加权)
const weightedGrowthSum = tableData.value.reduce(
(sum, row) => sum + (row.growthRate || 0) * (row.salesAmount || 0), 0
)
const avgGrowth = totalAmount > 0 ? weightedGrowthSum / totalAmount : 0
totalStats.value = {
totalAmount,
totalQuantity,
avgGrowth
}
}
// 生成模拟数据
const generateMockData = () => {
const data = []
// 定义各维度的取值范围
const dimValues = {
salesType: ['零售', '批发', '直销'],
customer: ['客户1', '客户2', '客户3', '客户4', '客户5'],
dosageForm: ['片剂', '胶囊', '颗粒', '口服液'],
product: ['产品A', '产品B', '产品C', '产品D'],
administrativeArea: ['上海', '北京', '广州', '深圳', '杭州'],
salesman: ['张三', '李四', '王五', '赵六'],
specification: ['10mg*20片', '20mg*30片', '50mg*10片', '100mg*5片']
}
// 为每个产品生成一些数据
const products = dimValues.product
const rowCount = 100 // 生成100行数据
for (let i = 0; i < rowCount; i++) {
const row = {}
// 为每个维度生成随机值
dimensions.value.forEach(dim => {
const values = dimValues[dim.id] || ['默认值']
row[dim.id] = values[Math.floor(Math.random() * values.length)]
})
// 添加统计指标
row.salesAmount = Math.random() * 200 + 50
row.salesQuantity = Math.floor(Math.random() * 5000) + 1000
row.growthRate = (Math.random() * 0.3 - 0.1) // -10% 到 20%
data.push(row)
}
// 按主维度排序
return data.sort((a, b) => {
const aValue = a[primaryDimension.value] || ''
const bValue = b[primaryDimension.value] || ''
return aValue.localeCompare(bValue)
})
}
// 辅助方法
const formatNumber = (num) => {
if (num === undefined || num === null) return '-'
return Number(num).toLocaleString('zh-CN', {
minimumFractionDigits: 2,
maximumFractionDigits: 2
})
}
const formatPercent = (num) => {
if (num === undefined || num === null) return '-'
return (num * 100).toFixed(2) + '%'
}
const getGrowthClass = (rate) => {
if (rate > 0) return 'positive'
if (rate < 0) return 'negative'
return 'neutral'
}
const getColumnWidth = (dimensionId) => {
const widthMap = {
salesType: 100,
customer: 120,
dosageForm: 80,
product: 100,
administrativeArea: 100,
salesman: 100,
specification: 120
}
return widthMap[dimensionId] || 100
}
// 图表相关
let barChartInstance = null
let pieChartInstance = null
const updateCharts = () => {
if (barChartInstance) {
barChartInstance.dispose()
}
if (pieChartInstance) {
pieChartInstance.dispose()
}
// 更新柱状图
const barElement = document.querySelector('.chart-container .el-tab-pane:first-child div')
if (barElement) {
barChartInstance = echarts.init(barElement)
// 按主维度分组数据
const groups = {}
tableData.value.forEach(d => {
const key = d[primaryDimension.value] || '其他'
if (!groups[key]) {
groups[key] = 0
}
groups[key] += d.salesAmount || 0
})
const barOption = {
title: { text: `${getDimensionName(primaryDimension.value)}销售额分布`, left: 'center' },
tooltip: {
trigger: 'axis',
formatter: '{b}: {c}万元'
},
xAxis: {
type: 'category',
data: Object.keys(groups)
},
yAxis: {
type: 'value',
name: '销售额(万)'
},
series: [{
data: Object.values(groups),
type: 'bar',
itemStyle: {
color: '#409eff'
}
}]
}
barChartInstance.setOption(barOption)
}
// 更新饼图
const pieElement = document.querySelector('.chart-container .el-tab-pane:last-child div')
if (pieElement) {
pieChartInstance = echarts.init(pieElement)
// 按第一个维度分组数据
const firstDim = selectedDimensions.value[0]
if (firstDim) {
const groups = {}
tableData.value.forEach(d => {
const key = d[firstDim] || '其他'
if (!groups[key]) {
groups[key] = 0
}
groups[key] += d.salesAmount || 0
result[categoryLabel].apps.push(app)
})
const pieOption = {
title: { text: `${getDimensionName(firstDim)}占比`, left: 'center' },
tooltip: {
trigger: 'item',
formatter: '{a}<br/>{b}: {c}万元 ({d}%)'
},
series: [{
name: '销售额',
type: 'pie',
radius: '50%',
data: Object.keys(groups).map(key => ({
name: key,
value: groups[key]
})),
emphasis: {
itemStyle: {
shadowBlur: 10,
shadowOffsetX: 0,
shadowColor: 'rgba(0, 0, 0, 0.5)'
}
}
}]
return result;
},
filteredCategories() {
if (!this.searchQuery.trim()) {
return this.categorizedApps;
}
pieChartInstance.setOption(pieOption)
const query = this.searchQuery.toLowerCase();
const result = {};
for (const [categoryName, categoryData] of Object.entries(this.categorizedApps)) {
const filteredApps = categoryData.apps.filter(app =>
app.name.toLowerCase().includes(query) ||
String(app.categoryLabel || '').toLowerCase().includes(query)
);
if (filteredApps.length > 0) {
result[categoryName] = {...categoryData, apps: filteredApps};
}
}
return result;
},
totalApps() {
return this.appsData.length;
},
categoriesCount() {
return Object.keys(this.categorizedApps).length;
},
visibleCategories() {
return Object.keys(this.filteredCategories).length;
}
},
methods: {
async fetchApps() {
try {
const data = await RoleApi.getMyPage({ pageNo: 1, pageSize: 1000 })
const list = data?.list || []
this.appsData = list.map(item => ({
id: item.id,
name: item.name,
logo: item.logo,
category: item.category,
categoryLabel: getDictLabel(DICT_TYPE.APP_CATEGORY, item.category),
redirectUris: item.redirectUris
}))
} catch (e) {
this.$message.error('应用数据加载失败')
}
},
handleAppClick(app) {
const uri = Array.isArray(app.redirectUris) ? app.redirectUris[0] : app.redirectUris
if (uri) {
window.location.href = uri
} else {
this.$message.warning('未配置重定向地址')
}
},
confirmLaunch() {
this.$message.success(`正在启动 ${this.selectedApp.name}...`);
this.dialogVisible = false;
}
}
}
const reset = () => {
selectedDimensions.value = dimensions.value.map(d => d.id)
primaryDimension.value = 'product'
tableData.value = []
showSummaryRow.value = true
totalStats.value = null
}
// 监听维度变化
watch(() => [...selectedDimensions.value], (newVal) => {
// 如果当前主维度不在选中维度中,则设置为第一个选中的维度
if (!newVal.includes(primaryDimension.value) && newVal.length > 0) {
primaryDimension.value = newVal[0]
}
})
// 监听主维度变化
watch(primaryDimension, () => {
if (tableData.value.length > 0) {
fetchData()
}
})
// 初始化
onMounted(() => {
fetchData()
// 监听窗口变化调整图表
window.addEventListener('resize', () => {
if (barChartInstance) barChartInstance.resize()
if (pieChartInstance) pieChartInstance.resize()
})
})
};
</script>
<style scoped>
.multi-dimension-report {
display: flex;
height: 100vh;
background: #f5f7fa;
flex-direction: column;
/* 头部样式 */
.app-header {
padding: 30px 0;
color: white;
text-align: center;
}
.dimension-controls {
.title {
margin-bottom: 10px;
font-size: 2.5rem;
text-shadow: 0 2px 4px rgb(0 0 0 / 10%);
}
.subtitle {
font-size: 1.1rem;
opacity: 0.9;
}
/* 统计信息样式 */
.stats-container {
display: flex;
padding: 20px;
background: white;
border-bottom: 1px solid #e6e6e6;
margin-bottom: 30px;
background: rgb(255 255 255 / 20%);
border-radius: 15px;
justify-content: space-around;
backdrop-filter: blur(10px);
}
.header {
.stat-card {
color: white;
text-align: center;
}
.stat-value {
margin-bottom: 5px;
font-size: 2rem;
font-weight: bold;
}
.stat-label {
font-size: 0.9rem;
opacity: 0.9;
}
/* 搜索区域样式 */
.search-container {
max-width: 500px;
margin: 0 auto 30px;
}
.search-input ::v-deep .el-input__inner {
padding-left: 40px;
border-radius: 25px;
}
/* 空状态样式 */
.empty-state {
padding: 60px 20px;
margin-bottom: 30px;
color: rgb(255 255 255 / 80%);
text-align: center;
background: rgb(255 255 255 / 10%);
border-radius: 15px;
}
.empty-icon {
display: block;
margin-bottom: 15px;
font-size: 3rem;
}
/* 分类区域样式 */
.category-section {
padding: 25px;
margin-bottom: 30px;
background: white;
border-radius: 15px;
box-shadow: 0 10px 30px rgb(0 0 0 / 10%);
animation: fadeIn 0.5s ease-out;
}
.category-header {
display: flex;
justify-content: space-between;
align-items: center;
justify-content: space-between;
margin-bottom: 20px;
}
.dimension-selection {
margin-top: 10px;
.category-title {
padding-left: 15px;
margin: 0;
font-size: 1.5rem;
color: #303133;
border-left: 5px solid #409EFF;
}
.dimension-selection h3 {
margin: 0 0 15px;
font-size: 16px;
color: #606266;
}
.dimension-grid {
display: grid;
grid-template-columns: repeat(4, 1fr);
gap: 10px;
margin-bottom: 10px;
}
.dimension-item {
position: relative;
padding: 12px;
font-weight: 500;
.app-count {
color: #409eff;
background: #ecf5ff;
}
/* 应用网格样式 */
.apps-grid {
display: grid;
grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
gap: 25px;
}
.app-card {
padding: 20px 15px;
text-align: center;
cursor: pointer;
background-color: #ecf5ff;
border: 2px solid #409eff;
border-radius: 4px;
transition: all 0.3s;
user-select: none;
background: #f8f9fa;
border-radius: 12px;
box-shadow: 0 2px 10px rgb(0 0 0 / 5%);
transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}
.dimension-item:hover {
background-color: #d9ecff;
transform: translateY(-2px);
box-shadow: 0 2px 8px rgb(64 158 255 / 20%);
.app-card:hover {
color: white;
background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
transform: translateY(-5px);
box-shadow: 0 10px 25px rgb(64 158 255 / 20%);
}
.dimension-item.inactive {
font-weight: normal;
color: #606266;
background-color: #f5f7fa;
border-color: #dcdfe6;
}
.dimension-item.inactive:hover {
background-color: #ebeef5;
transform: translateY(-2px);
box-shadow: 0 2px 8px rgb(0 0 0 / 10%);
}
.dimension-item .check-icon {
position: absolute;
top: 5px;
right: 5px;
font-size: 12px;
color: #409eff;
}
.dimension-item.inactive .check-icon {
display: none;
}
.report-container {
flex: 1;
padding: 20px;
overflow: hidden;
}
.report-header {
.app-icon-wrapper {
display: flex;
justify-content: space-between;
width: 60px;
height: 60px;
margin: 0 auto 12px;
font-size: 28px;
line-height: 60px;
color: white;
border-radius: 50%;
align-items: center;
margin-bottom: 20px;
justify-content: center;
}
.statistics-info {
padding: 8px 15px;
.app-icon-img {
width: 60px;
height: 60px;
border-radius: 50%;
object-fit: cover;
}
.app-name {
overflow: hidden;
font-size: 14px;
color: #666;
background: #f5f7fa;
border: 1px solid #e6e6e6;
border-radius: 4px;
font-weight: 500;
text-overflow: ellipsis;
white-space: nowrap;
}
.table-container {
padding: 20px;
background: white;
border-radius: 4px;
box-shadow: 0 2px 12px 0 rgb(0 0 0 / 10%);
/* 对话框样式 */
::v-deep .app-dialog .el-dialog__body {
padding: 30px 20px;
}
.positive {
color: #67c23a;
}
.negative {
color: #f56c6c;
}
.neutral {
color: #909399;
}
.chart-container {
padding: 20px;
margin-top: 20px;
background: white;
border-radius: 4px;
box-shadow: 0 2px 12px 0 rgb(0 0 0 / 10%);
}
:deep(.el-table .cell) {
padding: 4px 8px;
}
:deep(.el-table th) {
font-weight: 600;
background-color: #f8f9fa;
}
:deep(.el-table__footer-wrapper .el-table__cell) {
font-weight: bold;
background-color: #f0f9ff;
}
:deep(.el-table__footer-wrapper .positive) {
color: #67c23a;
}
:deep(.el-table__footer-wrapper .negative) {
color: #f56c6c;
}
:deep(.el-table__footer-wrapper .neutral) {
color: #909399;
}
/* 维度选择提示 */
.dimension-hint {
margin-top: 10px;
font-size: 12px;
color: #909399;
.dialog-content {
text-align: center;
}
</style>
.dialog-icon-wrapper {
display: flex;
width: 80px;
height: 80px;
margin: 0 auto 20px;
font-size: 36px;
line-height: 80px;
color: white;
border-radius: 50%;
align-items: center;
justify-content: center;
}
.dialog-app-icon-img {
width: 80px;
height: 80px;
border-radius: 50%;
object-fit: cover;
}
.dialog-app-name {
margin: 0 0 10px;
font-size: 1.5rem;
}
.dialog-app-id,
.dialog-app-category {
margin: 5px 0;
color: #909399;
}
.dialog-footer {
text-align: right;
}
</style>

View File

@@ -1,79 +1,9 @@
<template>
<div :class="prefixCls" class="relative h-[100%]">
<div class="relative mx-auto h-full flex">
<div :class="prefixCls" class="relative h-[100%]" :style="{ backgroundImage: 'url(' + localImage + ')' ,backgroundSize:'cover'}">
<div class="relative mx-auto h-full flex" style=" margin: 0 auto;">
<div
v-if="!appStore.getMobile"
:class="`${prefixCls}__left flex-1 bg-#409eff dark:bg-[var(--login-bg-color)] relative p-30px lt-xl:hidden overflow-x-hidden overflow-y-auto`"
>
<!-- 左上角的 logo + 系统标题 -->
<div
class="relative flex items-center text-white mt-30px"
:style="{ marginTop: leftStyle.logo.mt }"
>
<img
alt=""
class="mr-10px"
:style="{ height: leftStyle.logo.height }"
src="@/assets/imgs/logo_white.png"
/>
</div>
<!-- 左边的背景图 + 欢迎语 -->
<Transition
appear
enter-active-class="animate__animated animate__bounceInLeft"
tag="div"
>
<div :style="{ marginTop: leftStyle.bottomText.textMt }">
<div
class="pos-relative w-100% overflow-hidden"
:style="{ height: leftStyle.lottie.boxHeight }"
>
<vue3-lottie
class="pos-absolute"
:style="{ left: leftStyle.lottie.left, top: leftStyle.lottie.top }"
:animation-data="loginAnimationData"
:height="leftStyle.lottie.height"
:width="leftStyle.lottie.width"
:auto-play="true"
:loop="true"
/>
</div>
<div
class="flex justify-center w-100%"
:style="{ marginTop: leftStyle.bottomText.textMt }"
>
<div
class="pos-relative overflow-hidden"
:style="{ width: leftStyle.bottomText.width, height: leftStyle.bottomText.height }"
>
<img
alt=""
class="pos-absolute top-0"
:style="{ width: leftStyle.bottomText.width, left: leftStyle.bottomText.left }"
src="@/assets/imgs/login/login_text.png"
/>
</div>
</div>
</div>
</Transition>
</div>
<div
class="relative flex-1 p-30px bg-#e3f0ff lt-sm:p-10px overflow-x-hidden overflow-y-auto"
:class="`${prefixCls}__right`"
>
<!-- 右上角的主题语言选择 -->
<div
class="relative z-2 flex items-center justify-between text-white at-2xl:justify-end at-xl:justify-end"
>
<div class="flex items-center at-2xl:hidden at-xl:hidden">
<img alt="" class="mr-10px h-32px" src="@/assets/imgs/logo.png" />
</div>
<div class="flex items-center justify-end space-x-10px h-48px">
<ThemeSwitch />
<LocaleDropdown class="dark:text-white lt-xl:text-white" />
</div>
</div>
class="relative flex-1 p-30px lt-sm:p-10px overflow-x-hidden overflow-y-auto"
:class="`${prefixCls}__right`">
<!-- 右边的登录界面 -->
<Transition appear enter-active-class="animate__animated animate__bounceInRight">
<div
@@ -83,25 +13,35 @@
<div class="bg-#fff dark:bg-[var(--login-bg-color)] b-rounded-20px px-20px">
<!-- 账号登录 -->
<LoginForm class="m-auto h-auto p-20px lt-xl:(rounded-3xl light:bg-white)" />
<!-- 手机登录 -->
<MobileForm class="m-auto h-auto p-20px lt-xl:(rounded-3xl light:bg-white)" />
<!-- 二维码登录 -->
<QrCodeForm class="m-auto h-auto p-20px lt-xl:(rounded-3xl light:bg-white)" />
<!-- 三方登录 -->
<!-- <SSOLoginVue class="m-auto h-auto p-20px lt-xl:(rounded-3xl light:bg-white)" /> -->
</div>
</div>
</Transition>
</div>
<div
class="pos-fixed bottom-0px left-50% lt-md:left-0px lt-sm:left-0px lt-xl:left-0px lt-xl:left-0px z-1"
>
<img class="w-138px block" src="@/assets/imgs/login/login_right_bg_1.png" alt="" />
</div>
<div class="pos-fixed right--38px top--23px">
<img class="w-160px block" src="@/assets/imgs/login/login_right_bg_2.png" alt="" />
</div>
</div>
<div class="tags">
<div class="module cockpit">
<img :src="jsc"/>
驾驶舱
</div>
<div class="module iot">
<img :src="wlzt"/>
物联中台
</div>
<div class="module data-center">
<img :src="sjzt"/>
数据中台
</div>
<div class="module report">
<img :src="znbb"/>
智能报表
</div>
<div class="module digital-twin">
<img :src="szls"/>
数字孪生
</div>
</div>
</div>
</template>
<script lang="ts" setup>
@@ -110,9 +50,16 @@ import { useAppStore } from '@/store/modules/app'
import { ThemeSwitch } from '@/layout/components/ThemeSwitch'
import { LocaleDropdown } from '@/layout/components/LocaleDropdown'
import { useWindowSize } from '@vueuse/core'
import { LoginForm, MobileForm, QrCodeForm, SSOLoginVue } from './components'
import { LoginForm } from './components'
import * as loginAnimation from '@/assets/json/login_left.json'
import jsc from '@/assets/imgs/jsc.png'
import sjzt from '@/assets/imgs/sjzt.png'
import szls from '@/assets/imgs/szls.png'
import wlzt from '@/assets/imgs/wlzt.png'
import znbb from '@/assets/imgs/znbb.png'
// import { useRoute } from 'vue-router';
import localImage from '@/assets/imgs/background.jpg'
defineOptions({ name: 'Login' })
@@ -157,6 +104,9 @@ const newClass = computed(() => {
const toggle = appStore.getFullscreen ? 'is-toggle' : ''
return toggle ? toggle : mobile
})
// const route = useRoute();
// console.log(route.query)
</script>
<style lang="scss" scoped>
@@ -179,4 +129,78 @@ $prefix-cls: #{$namespace}-login;
left: 50%;
transform: translate(-50%, -50%) scale(0.7, 0.6);
}
.tags{
position:absolute;
bottom:20px;
left:50%;
display: grid;
width: 1000px;
transform:translateX(-50%);
grid-template-columns: 1fr 1fr 1fr;
grid-template-rows: auto auto;
gap: 20px;
.module {
display: flex;
padding: 20px;
font-size: 26px;
font-weight: 600;
color: #fff;
text-align: center;
border-radius: 4px;
align-items: center;
justify-content: center;
flex-direction: column;
}
.module img {
width: 80px;
height: 80px;
margin-bottom: 16px;
object-fit: contain;
}
.module.iot,
.module.data-center,
.module.report,
.module.digital-twin {
flex-direction: row;
gap: 50px; /* 图标和文字之间的间距 */
img{
margin:0
}
}
/* 驾驶舱:深蓝色渐变 */
.module.cockpit {
grid-row: 1 / 3;
background: linear-gradient(180deg, rgb(109 147 245 / 75%), rgb(7 38 111 / 75%));
img {
width: 140px;
height: 140px;
}
}
/* 物联中台:中蓝色渐变 */
.module.iot {
background: linear-gradient(180deg, rgb(130 156 223 / 75%), rgb(7 38 111 / 75%));
}
/* 数据中台:青绿色渐变 */
.module.data-center {
background: linear-gradient(180deg, rgb(46 192 182 / 75%), rgb(40 180 170 / 75%));
}
/* 智能报表:绿色渐变 */
.module.report {
background: linear-gradient(180deg, rgb(77 212 122 / 75%), rgb(60 180 100 / 75%));
}
/* 数字孪生:浅蓝色渐变 */
.module.digital-twin {
background: linear-gradient(180deg, rgb(111 181 235 / 75%), rgb(60 140 200 / 75%));
}
}
</style>

View File

@@ -74,6 +74,75 @@ export const useRenderVxeColumn = (useType = 'table') => {
return <el-input class="my-cell" text="text" v-model={row[prop]} placeholder={placeholder ? placeholder : '请输入 ' + column.title} />
}
},
LowInputDefualt: {
default: (renderOpts, { row, column, fieldProp }, isStop) => {
const prop = fieldProp || column.field
if (isStop) return (<div> <span>{row[prop]}</span> {stopIcon} </div>)
return <span>{row[prop]}</span>
},
edit: (renderOpts, { row, column, fieldProp ,rowIndex}) => {
const { placeholder } = renderOpts
const prop = fieldProp || column.field
const dicData=[]
if(['年','年度','年份'].includes(row.fieldName)){
dicData.push({label:'本年',value:'本年'})
dicData.push({label:'指定年份',value:'指定'})
}else if( ['月','月度','月份'].includes(row.fieldName)){
dicData.push({label:'本月',value:'本月'})
dicData.push({label:'指定月份',value:'指定'})
}else if(row.fieldType=='Date'){
dicData.push({label:'当日',value:'当日'})
dicData.push({label:'指定日期',value:'指定'})
}
if(dicData.length){
return [
<avue-select
popper-class="vxe-table--ignore-clear"
v-model={row.defaultSelect}
placeholder={'请选择'}
class={row.defaultSelect=="指定"?'width-50':''}
dic={dicData}
clearable={true}
onChange={({value}) => {
if(value!=='指定') row[prop]=value
else row[prop]=''
// 再触发自定义事件
if (renderOpts.events && renderOpts.events.change) {
renderOpts.events.change(row, column.field, rowIndex)
}
}}
onClear={() => {
// 触发清空事件
if (renderOpts.events && renderOpts.events.clear) {
renderOpts.events.clear(row, column.field, rowIndex)
}
}}
/>,
row.defaultSelect === "指定"&&row.fieldType!=='Date' && (
<el-input
class={row.defaultSelect?'my-cell width-50':'my-cell'}
type="text"
v-model={row[prop]}
placeholder={placeholder || `请输入 ${column.title}`}
/>
),
row.defaultSelect === "指定"&&row.fieldType=='Date' && (
<el-date-picker
class={row.defaultSelect?'my-cell width-50':'my-cell'}
v-model={row[prop]}
placeholder={placeholder || `请输入 ${column.title}`}
format={'YYYY-MM-DD'}
valueFormat={'YYYY-MM-DD'}
/>
)
]
}
else
return <el-input class="my-cell" text="text" v-model={row[prop]} placeholder={placeholder ? placeholder : '请输入 ' + column.title} />
}
},
LowNumber: {
default: (renderOpts, { row, column }, isStop) => {
if (isStop) return (<div> <span>{row[column.field]}</span> {stopIcon} </div>)
@@ -183,6 +252,44 @@ export const useRenderVxeColumn = (useType = 'table') => {
)
}
},
LowSelectMultiple: {
default: (renderOpts, { row, column }, isStop = false) => {
const { dicData } = renderOpts
const value = row[column.field]
const valStr=value?dicData.filter(item=>value.includes(item.value)).map(item=>item.label).join(''):''
return <span>{valStr}</span>
},
edit: (renderOpts, { row, rowIndex, column }) => {
const { multiple, filterable, allowCreate, typeKey ,dicData} = renderOpts
interface DictItem {
label: string;
value: string | number;
[key: string]: any; // 兼容其他可能的字段
}
return (
<el-select
popper-class="vxe-table--ignore-clear"
v-model={row[column.field]}
placeholder={'请选择 ' + column.title}
multiple={multiple}
filterable={filterable}
collapseTags={true}
collapseTagsTooltip={true}
allowCreate={allowCreate}
clearable={true}
>
{dicData.map((item: DictItem, index: number) => (
<el-option
key={index} // 建议用 item.value 作为 key更稳定
label={item.label}
value={item.value}
/>
))}
</el-select>
)
}
},
LowSummaryBottomSql: {
default: (renderOpts, { row, column }, isStop = false) => {
const { dicObj } = renderOpts

View File

@@ -157,12 +157,18 @@ const fixedColumnDialog = ref({
const fieldList = computed(() => {
let dicData: Array<{ label: string; value: string; type: string }> = []
infoData.value.basics.forEach((item) => {
if (item.fieldCode && item.isDb == 'Y')
dicData.push({
label: `${item.fieldCode}${item.fieldName ? '' + item.fieldName + '' : ''}`,
value: item.fieldCode,
type: item.fieldType
})
if(item.searchDefaultValue&&['当日','本月','本年'].includes(item.searchDefaultValue)){
item.defaultSelect=item.searchDefaultValue
}else if(item.searchDefaultValue){
item.defaultSelect='指定'
}
})
return dicData
})
@@ -380,7 +386,9 @@ const initEditInfoData = () => {
if (fieldItem.hasChildren === 'Y') {
fieldItem.hasChildren = 'Y'
}
if (!!fieldItem.isHideDimension&&Object.prototype.toString.call(fieldItem.isHideDimension) == '[object String]') {
fieldItem.isHideDimension=fieldItem.isHideDimension.split(',')
}
fieldList.push(fieldItem)
})
@@ -405,7 +413,9 @@ onMounted(() => {
})
}
}
tableInfoOption.infoColumn.fieldColumn.isHideDimension.editRender.dicData = infoData.value.basics.map(({fieldCode,fieldName})=>{
return {label:fieldName,value:fieldCode}
})
// 设置父字段下拉选项
const updateParentFieldOptions = () => {
// 获取所有parentFieldCode为空且非固定列的字段作为可选父字段
@@ -455,11 +465,12 @@ onMounted(() => {
row.isSubField = false;
_lastSelectedValue = '';
}
} else {
// 清空选择
handleParentFieldClear(row);
_lastSelectedValue = '';
}
// else {
// // 清空选择
// handleParentFieldClear(row);
// _lastSelectedValue = '';
//}
// 更新父字段选项
updateParentFieldOptions();
},

View File

@@ -149,19 +149,25 @@ const infoColumn = {
fieldColumn: {
fieldCode: { title: '字段编码', minWidth: 120, editRender: { name: 'LowInput', verifyEdit: true } },
fieldName: { title: '字段名称', minWidth: 120, editRender: { name: 'LowInput' } },
parentFieldName: { title: '父字段名称', width: 120, editRender: { name: 'LowSelect', dicData: [], filterable: true, clearable: true } },
parentFieldName: { title: '父字段名称', width: 120, editRender: { name: 'LowSelect', dicData: [], filterable: true,allowCreate:true, clearable: true } },
labelI18n: { title: '国际化配置', width: 140, editRender: { name: 'LowMonacoEditorInput', events: {} } },
fieldType: { title: '字段类型', minWidth: 100, editRender: { name: 'LowSelect', verifyEdit: true, dicData: dicObj.fieldType, dicObj: getDicObj('fieldType') } },
width: { title: '列宽', width: 120, align: "center", editRender: { name: 'LowInput', verifyEdit: true } },
isFixedColumn: { title: '固定列', width: 75, align: "center", editRender: { name: 'LowCheckbox' } },
fixedColumnValue: { title: '固定列内容', width: 110, align: "center", editRender: { name: 'LowButton', disabled: (row) => row.isFixedColumn !== 'Y', buttonText: '配置内容', buttonType: 'primary', buttonSize: 'small', events: {} } },
queryIsDb: { title: '接口查询', width: 75, align: "center", editRender: { name: 'LowCheckbox' } },
queryIsWeb: { title: '查询控件', width: 75, align: "center", editRender: { name: 'LowCheckbox' } },
searchDefaultValue: { title: '默认值', width: 180, align: "center", editRender: { name: 'LowInputDefualt' , verifyEdit: true} },
queryMode: { title: '查询模式', width: 130, editRender: { name: 'LowSelect', verifyEdit: true, dicData: dicObj.queryMode, dicObj: getDicObj('queryMode') } },
dictCode: { title: '字典Code', width: 180, editRender: { name: 'LowSelect', verifyEdit: true, filterable: true, noStop: true, dicData: [] } },
isExport: { title: '是否可导出', width: 90, align: "center", editRender: { name: 'LowCheckbox' } },
isHideCol: { title: '隐藏列', width: 90, align: "center", editRender: { name: 'LowCheckbox' } },
isAmount: { title: '是否合计', width: 75, align: "center", editRender: { name: 'LowCheckboxSum' } },
isDimension: { title: '是否维度', width: 75, align: "center", editRender: { name: 'LowCheckbox' } },
isHideDimension: { title: '维度隐藏列', width: 180, editRender: { name: 'LowSelectMultiple', verifyEdit: true, filterable: true, multiple:true,dicData: [] } },
isShowSort: { title: '是否排序', width: 75, align: "center", editRender: { name: 'LowCheckbox' } },
isDynamicGroup: { title: '动态分组', width: 75, align: "center", editRender: { name: 'LowCheckbox' } },
hasChildren: { title: '子字段', width: 90, align: "center", editRender: { name: 'LowButton', disabled: (row) => row.isSubField === true, buttonText: '添加子字段', buttonType: 'primary', buttonSize: 'small' } },
@@ -194,7 +200,11 @@ for (const key in infoColumn) {
//默认值
const infoDefaultData = {
basics: {
// fieldCode: '', fieldName: '', parentFieldName: '', labelI18n: '', fieldType: 'String', queryIsDb: 'N', queryIsWeb: 'N', queryMode: 'LIKE', dictCode: '',isHideCol:'N', isExport: 'Y', isShowSort: 'N', isAmount: '', isDimension: '',isHideDimension:'', hasChildren: 'N', isSubField: false, parentFieldId: '', parentFieldCode: '',
fieldCode: '', fieldName: '', parentFieldName: '', labelI18n: '', fieldType: 'String', isFixedColumn: 'N', fixedColumnValue: '', queryIsDb: 'N', queryIsWeb: 'N', queryMode: 'LIKE', dictCode: '', isExport: 'Y', isShowSort: 'N', isAmount: '', isDimension: '', isDynamicGroup: 'N', hasChildren: 'N', isSubField: false, parentFieldId: '', parentFieldCode: '',
},
}

View File

@@ -349,7 +349,7 @@ const tableFormVerify = (type) => {
const index = Number(i)
const item = filedData[index]
item.sortNum = index + 1
item.isHideDimension?item.isHideDimension=item.isHideDimension.join(','):''
let messageText = ''
let tabKey = 'mysql'
// 子字段不能再包含子字段

View File

@@ -32,7 +32,46 @@
</el-tag>
</template>
<!-- 表单 -->
<template #scopes-form="scope">
<template #category-form>
<el-select
v-model="tableForm.category"
filterable
placeholder="请输入应用分类"
style="width: 100%"
>
<el-option
v-for="item in getIntDictOptions(DICT_TYPE.APP_CATEGORY)"
:key="item.value"
:label="item.label"
:value="item.value"
/>
</el-select>
</template>
<template #authorizedGrantTypes-form>
<el-select
v-model="tableForm.authorizedGrantTypes"
filterable
multiple
allow-create
placeholder="请输入授权类型"
style="width: 100%"
>
<el-option v-for="item in getDictOptions(DICT_TYPE.SYSTEM_OAUTH2_GRANT_TYPE)" :key="item.value" :label="item.label" :value="item.value" />
</el-select>
</template>
<template #authorities-form>
<el-select
v-model="tableForm.authorities"
filterable
multiple
allow-create
placeholder="请输入权限"
style="width: 100%"
>
<el-option v-for="item in getDictOptions(DICT_TYPE.APP_QX)" :key="item.value" :label="item.label" :value="item.value" />
</el-select>
</template>
<template #scopes-form>
<el-select
v-model="tableForm.scopes"
filterable
@@ -41,20 +80,21 @@
placeholder="请输入授权范围"
style="width: 100%"
>
<el-option v-for="item in scope.value" :key="item" :label="item" :value="item" />
<el-option v-for="item in [{
label: 'user.read',
value: 'user.read'
},{
label: 'user.write',
value: 'user.write'
}]" :key="item.value" :label="item.label" :value="item.value" />
</el-select>
</template>
<template #redirectUris-form="scope">
<el-select
v-model="tableForm.redirectUris"
filterable
multiple
allow-create
placeholder="请输入可重定向的 URI 地址"
style="width: 100%"
>
<el-option v-for="item in scope.value" :key="item" :label="item" :value="item" />
</el-select>
<template #category="scope">
<dict-tag
v-if="scope.row.category !== undefined"
:type="DICT_TYPE.APP_CATEGORY"
:value="scope.row.category"
/>
</template>
<template #status="scope">
<dict-tag
@@ -105,9 +145,14 @@ const tableOption = reactive({
name: {
label: '应用名',
search: true,
minWidth: 100,
span: 12,
rules: [{ required: true, message: '应用名不能为空', trigger: 'blur' }]
},
category: {
label: '应用分类',
span: 12,
rules: [{ required: true, message: '应用分类不能为空', trigger: 'blur' }]
},
logo: {
label: '应用图标',
span: 24,
@@ -173,7 +218,7 @@ const tableOption = reactive({
span: 12,
hide: true,
control: (val) => {
let dicData = []
let dicData = ["user.read","user.write"]
if (val?.length) {
dicData = val.map((item) => {
return { label: item, value: item }
@@ -190,12 +235,10 @@ const tableOption = reactive({
span: 12,
multiple: true,
hide: true,
dicData: []
dicData: ["user.read","user.write"]
},
redirectUris: {
label: '可重定向的 URI 地址',
type: 'select',
multiple: true,
span: 12,
hide: true,
rules: [{ required: true, message: '可重定向的 URI 地址不能为空', trigger: 'blur' }]
@@ -203,12 +246,20 @@ const tableOption = reactive({
authorities: {
label: '权限',
span: 12,
multiple: true,
hide: true,
type: 'select'
},
callbackUris: {
label: '回调地址',
span: 12,
hide: true
},
resourceIds: {
label: '资源',
span: 12,
hide: true
hide: true,
type: 'array'
},
additionalInformation: {
label: '附加信息',

View File

@@ -0,0 +1,233 @@
<template>
<DesignPopup v-model="dialogVisible" title="应用权限" :is-footer="true" width="40%">
<div class="p-20px">
<el-form ref="formRef" v-loading="formLoading" :model="formData" label-width="80px">
<el-form-item label="角色名称">
<el-tag>{{ formData.name }}</el-tag>
</el-form-item>
<el-form-item label="角色标识">
<el-tag>{{ formData.code }}</el-tag>
</el-form-item>
<el-form-item label="应用权限">
<el-card class="w-full h-400px !overflow-y-scroll" shadow="never">
<template #header>
全选/全不选:
<el-switch
v-model="treeNodeAll"
active-text=""
inactive-text=""
inline-prompt
@change="handleCheckedTreeNodeAll"
/>
</template>
<!-- 修复移除未使用的node变量优化无子集Tree展示 -->
<el-tree
ref="treeRef"
:data="appOptions"
:props="{ label: 'name', children: 'children' }"
empty-text="暂无应用数据"
node-key="id"
show-checkbox
check-strictly
v-loading="tableLoading"
class="app-tree-list"
:indent="0"
>
<!-- 修复只解构使用到的data删除未使用的node -->
<template #default="{ data }">
<div class="app-tree-node">
<span class="node-name">{{ data.name }}</span>
<span class="node-clientId">客户端ID{{ data.clientId }}</span>
<span class="node-status">
<dict-tag :type="DICT_TYPE.COMMON_STATUS" :value="data.status" />
</span>
</div>
</template>
</el-tree>
</el-card>
</el-form-item>
</el-form>
</div>
<template #footer>
<el-button :disabled="formLoading" type="primary" @click="submitForm"> </el-button>
<el-button @click="dialogVisible = false"> </el-button>
</template>
</DesignPopup>
</template>
<script lang="ts" setup>
import { DICT_TYPE } from '@/utils/dict'
import * as RoleApi from '@/api/system/role'
defineOptions({ name: 'SystemRoleAssignAppForm' })
const { t } = useI18n()
const message = useMessage()
const dialogVisible = ref(false)
const formLoading = ref(false)
const tableLoading = ref(false)
const formData = ref({
id: 0,
name: '',
code: '',
clientIds: [] as number[]
})
const formRef = ref()
const treeRef = ref()
const appOptions = ref<any[]>([])
const treeNodeAll = ref(false)
// 优化Tree配置明确指定无children纯列表展示
const treeProps = {
label: 'name',
children: () => [] // 强制返回空数组,彻底避免树形层级
}
/** 打开弹窗 */
const open = async (row: RoleApi.RoleVO) => {
dialogVisible.value = true
formLoading.value = true
resetForm()
// 设置角色信息
formData.value.id = row.id
formData.value.name = row.name
formData.value.code = row.code
try {
// 加载应用列表pageSize=99模拟不分页
await getAppList()
// 获取当前角色已有的应用ID
const roleAppIds = await RoleApi.getRoleAppIds(row.id)
formData.value.clientIds = roleAppIds
// 设置Tree选中状态
await nextTick()
treeRef.value?.setCheckedNodes([])
formData.value.clientIds.forEach(id => {
treeRef.value?.setChecked(id, true, false)
})
} finally {
formLoading.value = false
}
}
defineExpose({ open })
/** 获取应用列表固定pageSize=99不分页 */
const getAppList = async () => {
tableLoading.value = true
try {
const data = await RoleApi.getMyPage({
pageNo: 1,
pageSize: 99 // 设为99覆盖大部分场景的数量模拟不分页
})
// 优化确保返回数据绝对没有children字段避免树形展示
appOptions.value = data.list.map(item => {
const { children, ...rest } = item // 移除可能存在的children字段
return { ...rest, children: [] } // 强制设置空children
})
} finally {
tableLoading.value = false
}
}
/** 全选/全不选适配Tree组件 */
const handleCheckedTreeNodeAll = () => {
if (treeNodeAll.value) {
// 全选:选中所有节点
treeRef.value?.setCheckedNodes(appOptions.value)
formData.value.clientIds = appOptions.value.map(item => item.id)
} else {
// 全不选:清空选中
treeRef.value?.setCheckedNodes([])
formData.value.clientIds = []
}
}
/** 提交表单 */
const emit = defineEmits(['success'])
const submitForm = async () => {
if (!formRef) return
const valid = await formRef.value.validate()
if (!valid) return
formLoading.value = true
try {
// 获取Tree选中的节点ID
formData.value.clientIds = treeRef.value?.getCheckedKeys(false) as number[]
const data = {
roleId: formData.value.id,
clientIds: formData.value.clientIds
}
await RoleApi.saveApp(data)
message.success(t('common.updateSuccess'))
dialogVisible.value = false
emit('success')
} finally {
formLoading.value = false
}
}
/** 重置表单 */
const resetForm = () => {
treeNodeAll.value = false
formData.value = {
id: 0,
name: '',
code: '',
clientIds: []
}
appOptions.value = []
treeRef.value?.setCheckedNodes([])
formRef.value?.resetFields()
}
</script>
<style lang="scss" scoped>
// 自定义Tree节点样式模拟表格列布局
.app-tree-list {
::v-deep(.el-tree-node) {
height: 40px;
line-height: 40px;
border-bottom: 1px solid #f5f7fa;
}
::v-deep(.el-tree-node__content) {
padding: 0 10px;
height: 40px !important;
// 移除树形节点的默认图标
.el-tree-node__expand-icon {
display: none;
}
}
::v-deep(.el-tree-node__children) {
padding-left: 0 !important; // 彻底去掉子节点缩进
}
}
// 节点内容布局
.app-tree-node {
display: flex;
align-items: center;
width: 100%;
.node-name {
flex: 0 0 120px;
font-weight: 500;
}
.node-clientId {
flex: 0 0 150px;
color: #666;
}
.node-status {
flex: 0 0 80px;
text-align: center;
}
}
// 卡片样式优化
::v-deep(.el-card__header) {
padding: 10px 20px;
}
::v-deep(.el-card__body) {
padding: 10px;
}
</style>

View File

@@ -58,6 +58,15 @@
<span>菜单权限</span>
</div>
</el-dropdown-item>
<el-dropdown-item
:command="{ type: 'app', row }"
v-if="checkPermi(['system:permission:assign-role-app'])"
>
<div class="flex items-center">
<Icon icon="ep:menu" />
<span>应用权限</span>
</div>
</el-dropdown-item>
<el-dropdown-item
:command="{ type: 'data', row }"
v-if="checkPermi(['system:permission:assign-role-data-scope'])"
@@ -86,6 +95,8 @@
<RoleAssignMenuForm ref="assignMenuFormRef" @success="getTableData" />
<!-- 表单弹窗数据权限 -->
<RoleDataPermissionForm ref="dataPermissionFormRef" @success="getTableData" />
<!-- 表单弹窗应用权限 -->
<RoleAssignAppForm ref="assignAppFormRef" @success="getTableData" />
</template>
<script lang="ts" setup>
import { DICT_TYPE, getIntDictOptions } from '@/utils/dict'
@@ -96,6 +107,7 @@ import * as RoleApi from '@/api/system/role'
import { CommonStatusEnum } from '@/utils/constants'
import RoleAssignMenuForm from './RoleAssignMenuForm.vue'
import RoleDataPermissionForm from './RoleDataPermissionForm.vue'
import RoleAssignAppForm from './RoleAssignAppForm.vue'
defineOptions({ name: 'SystemRole' })
@@ -186,7 +198,7 @@ const tablePage = ref({
total: 0
})
const permission = getCurrPermi(['system:role'])
const assignAppFormRef = ref()
const crudRef = ref()
useCrudHeight(crudRef)
@@ -197,6 +209,11 @@ const menuHandle = ({ row, type }) => {
if (type == 'menu') openAssignMenuForm(row)
else if (type == 'data') openDataPermissionForm(row)
else if (type == 'del') rowDel(row)
else if (type == 'app') openAssignAppForm(row)
}
const openAssignAppForm = (row) => {
assignAppFormRef.value.open(row)
}
/** 查询列表 */