优化部分页面的样式

This commit is contained in:
毛鹏
2025-11-09 13:36:48 +08:00
parent 4782e13813
commit 241590dedb
4 changed files with 56 additions and 144 deletions

View File

@@ -126,10 +126,10 @@ if not IS_SQLITE:
'OPTIONS': {
'charset': 'utf8mb4',
'connect_timeout': 5, # 连接超时时间
'init_command': 'SET SESSION sort_buffer_size=8 * 1024 * 1024', # 会话级设置
'isolation_level': 'READ COMMITTED', # 可选:事务隔离级别
'init_command': "SET SESSION wait_timeout=60, interactive_timeout=60, sort_buffer_size=2 * 1024 * 1024",
'isolation_level': 'READ COMMITTED',
},
'CONN_MAX_AGE': 60, # 连接最大存活时间(秒)
'CONN_MAX_AGE': 60, # 这个设置是正确的
}
}
else:

View File

@@ -57,33 +57,49 @@
</template>
<script lang="ts" setup>
defineProps({
uiStats: {
type: Object,
default: () => ({
elementCount: 0,
pageCount: 0,
stepCount: 0,
caseCount: 0
})
},
apiStats: {
type: Object,
default: () => ({
interfaceCount: 0,
caseCount: 0,
headersCount: 0
})
},
pytestStats: {
type: Object,
default: () => ({
processObjects: 0,
caseCount: 0,
toolFiles: 0,
testFiles: 0
})
import { ref, onMounted } from 'vue'
import { getSystemIndexStatistics } from '@/api/system'
// 定义响应式数据
const uiStats = ref({
elementCount: 0,
pageCount: 0,
stepCount: 0,
caseCount: 0,
})
const apiStats = ref({
interfaceCount: 0,
caseCount: 0,
headersCount: 0,
})
const pytestStats = ref({
processObjects: 0,
caseCount: 0,
toolFiles: 0,
testFiles: 0,
})
// 获取统计数据
const fetchStatistics = async () => {
try {
const res = await getSystemIndexStatistics()
uiStats.value = res.data.uiStats
apiStats.value = res.data.apiStats
pytestStats.value = res.data.pytestStats
} catch (error) {
console.log(error)
}
}
onMounted(() => {
fetchStatistics()
})
// 暴露刷新方法
defineExpose({
refresh: fetchStatistics,
})
</script>

View File

@@ -11,11 +11,7 @@
</div>
<div class="item">
<Title title="自动化测试统计" />
<AutomationStats
:ui-stats="data.uiStats"
:api-stats="data.apiStats"
:pytest-stats="data.pytestStats"
/>
<AutomationStats />
</div>
</div>
<div class="center">
@@ -60,65 +56,34 @@
</template>
<script lang="ts" setup>
import { computed, nextTick, onMounted, reactive, ref, unref, watch } from 'vue'
import useAppConfigStore from '@/store/modules/app-config'
import { nextTick, onMounted, reactive, ref } from 'vue'
import FullYearSalesChart from './components/chart/FullYearSalesChart.vue'
import HotProductChart from './components/chart/HotProductChart.vue'
import Title from '@/views/index/components/Title.vue'
import { useRowKey, useRowSelection, useTable, useTableColumn } from '@/hooks/table'
import { useRouter } from 'vue-router'
import { getSystemTasks } from '@/api/system/tasks'
import { useEnum } from '@/store/modules/get-enum'
import PieChart from '@/components/chart/PieChart.vue'
import { getSystemCaseRunSum, getSystemCaseSum, getSystemIndexStatistics } from '@/api/system'
import { Message } from '@arco-design/web-vue'
// 导入新创建的组件
import ContactAuthor from './components/ContactAuthor.vue'
import AutomationStats from './components/AutomationStats.vue'
import PendingTasks from './components/PendingTasks.vue'
import ResourceCenter from './components/ResourceCenter.vue'
const appStore = useAppConfigStore()
// 联系作者弹窗相关状态
const contactVisible = ref(false)
const enumStore = useEnum()
const hotProductChart = ref()
const fullYearSalesChart = ref()
const onResize = () => {
setTimeout(() => {
unref(hotProductChart).updateChart()
unref(fullYearSalesChart).updateChart()
}, 500)
}
const collapse = computed(() => {
return appStore.isCollapse
})
watch(collapse, () => {
onResize()
})
const { onSelectionChange } = useRowSelection()
const table = useTable()
const rowKey = useRowKey('id')
const data: any = reactive({
caseSum: [],
reportSum: [],
onlineUsers: 0,
// UI自动化统计
uiStats: {
elementCount: 0,
pageCount: 0,
stepCount: 0,
caseCount: 0,
},
// API自动化统计
apiStats: {
interfaceCount: 0,
caseCount: 0,
headersCount: 0,
},
// Pytest自动化统计
pytestStats: {
processObjects: 0,
caseCount: 0,
@@ -126,73 +91,6 @@
testFiles: 0,
},
})
const tableColumns = useTableColumn([
table.indexColumn,
{
title: '任务名称',
key: 'name',
dataIndex: 'name',
align: 'left',
ellipsis: true,
tooltip: true,
},
{
title: '定时策略',
key: 'timing_strategy',
dataIndex: 'timing_strategy',
align: 'left',
ellipsis: true,
tooltip: true,
},
{
title: '测试对象',
key: 'test_env',
dataIndex: 'test_env',
width: 100,
},
{
title: '负责人',
key: 'case_people',
dataIndex: 'case_people',
width: 120,
},
])
const router = useRouter()
function handleViewResult(record: any) {
router.push({
path: '/index/report-details',
query: {
id: record.id,
name: record.name,
type: record.type,
},
})
}
function goToCreateCase() {
router.push('/apitest/case/create')
}
function goToTaskManagement() {
router.push('/system/tasks')
}
function goToReportCenter() {
router.push('/index/report')
}
function doRefresh() {
getSystemTasks({
pageSize: 100,
page: 1,
})
.then((res) => {
table.handleSuccess(res)
})
.catch(console.log)
}
function caseSum() {
getSystemCaseSum()
@@ -210,7 +108,6 @@
.catch(console.log)
}
// 获取系统统计数据
function getSystemStatistics() {
getSystemIndexStatistics()
.then((res) => {
@@ -223,10 +120,9 @@
onMounted(() => {
nextTick(async () => {
doRefresh()
caseSum()
getAllReportSum()
getSystemStatistics()
caseSum()
getAllReportSum()
getSystemStatistics()
})
})

View File

@@ -45,13 +45,13 @@
</div>
</a-space>
</template>
<a-tab-pane key="1" title="前置数据">
<a-tab-pane key="1" title="用例前置">
<a-tabs
:default-active-key="data.uiSonType"
position="left"
@tab-click="(key) => switchSonType(key)"
>
<a-tab-pane key="11" title="自定义变量">
<a-tab-pane key="11" title="自定义参数">
<a-space direction="vertical">
<a-space
v-for="(item, index) of pageData.record.front_custom"
@@ -79,7 +79,7 @@
</a-space>
</a-space>
</a-tab-pane>
<a-tab-pane key="12" title="sql变量">
<a-tab-pane key="12" title="sql参数">
<a-space direction="vertical">
<a-space v-for="(item, index) of pageData.record.front_sql" :key="item.sql">
<span>sql语句</span>
@@ -192,13 +192,13 @@
</template>
</a-table>
</a-tab-pane>
<a-tab-pane key="3" title="后置清除">
<a-tab-pane key="3" title="用例后置">
<a-tabs
:default-active-key="data.uiSonType"
position="left"
@tab-click="(key) => switchSonType(key)"
>
<a-tab-pane key="31" title="sql清除">
<a-tab-pane key="31" title="sql参数">
<a-space direction="vertical">
<a-space
v-for="(item, index) of pageData.record.posterior_sql"