增加6中新需求

This commit is contained in:
jiangzhe 2024-08-08 10:54:28 +08:00
parent 196946d5e9
commit 1c99e06680
5 changed files with 153 additions and 2 deletions

View File

@ -23,3 +23,18 @@ export const listStatistic = (query?: any): AxiosPromise<any[]> => {
});
};
export const statisticScale = (query?: any): AxiosPromise<any[]> => {
return request({
url: '/scale/archive/statistic/scale',
method: 'get',
params: query
});
};
export const statisticWarn = (query?: any): AxiosPromise<any> => {
return request({
url: '/scale/archive/statistic/warn',
method: 'get',
params: query
});
};

View File

@ -0,0 +1,122 @@
<template>
<el-dialog title="测评统计" v-model="visible" width="800px" append-to-body :close-on-click-modal="false"
@close="handleClose">
<el-card>
<template #header>
图表统计
</template>
<v-chart style="height: 300px;" :option="barOption" autoresize />
</el-card>
<el-card style="margin-top: 20px;">
<template #header>
列表统计
</template>
<el-table :data="tableData">
<el-table-column prop="name" label="姓名" />
<el-table-column prop="times" label="时间">
<template #default="scope">
<div v-for="item in scope.row.times.split(',')">
{{ item }}<br>
</div>
</template>
</el-table-column>
<el-table-column prop="value" label="测评次数" />
</el-table>
</el-card>
</el-dialog>
</template>
<script setup lang="ts">
import { statisticScale, statisticWarn } from '@/api/archive/information'
import * as echarts from 'echarts';
import { use } from 'echarts/core'
import { CanvasRenderer } from "echarts/renderers";
import { PieChart, BarChart, LineChart } from "echarts/charts";
import { TitleComponent, TooltipComponent, LegendComponent, ToolboxComponent, GridComponent, VisualMapComponent } from "echarts/components";
import VChart from 'vue-echarts'
use([
CanvasRenderer,
PieChart,
BarChart,
LineChart,
TitleComponent,
TooltipComponent,
LegendComponent,
ToolboxComponent,
GridComponent,
VisualMapComponent
]);
const visible = ref(false)
const userId = ref()
const openStatistic = (row: any) => {
userId.value = row.userId
console.log('userId:', userId.value);
visible.value = true
}
const tableData = ref<any[]>([])
const statisticScaleData = async () => {
const { data } = await statisticScale({ userId: userId.value })
tableData.value = data
}
const barOption = ref({
xAxis: {
type: 'category',
data: ['未见异常', '低风险', '中风险', '高风险', '重大风险']
},
yAxis: {
type: 'value'
},
series: [
{
data: [],
type: 'bar'
}
]
})
const statisticWarnData = async () => {
const { data: { noneNum, lowNum, middleNum, highNum, majorNum } } = await statisticWarn({ userId: userId.value })
barOption.value.series[0].data = [
noneNum, lowNum, middleNum, highNum, majorNum
]
}
watch(visible, (newVal, oldVal) => {
if (newVal) {
statisticScaleData()
statisticWarnData()
}
})
const handleClose = () => {
barOption.value = {
xAxis: {
type: 'category',
data: ['未见异常', '低风险', '中风险', '高风险', '重大风险']
},
yAxis: {
type: 'value'
},
series: [
{
data: [],
type: 'bar'
}
]
}
tableData.value = []
}
defineExpose({ openStatistic })
</script>
<style scoped></style>

View File

@ -61,6 +61,10 @@
<el-button link type="primary" icon="View" @click="handleUpdate(scope.row)"
v-hasPermi="['evaluation:record:view']">查看</el-button>
</el-tooltip>
<el-tooltip content="统计" placement="top">
<el-button link type="primary" icon="Histogram" @click="handleStatistic(scope.row)"
v-hasPermi="['evaluation:record:statistic']">统计</el-button>
</el-tooltip>
</template>
</el-table-column>
</el-table>
@ -224,6 +228,8 @@
</el-descriptions-item>
</el-descriptions>
</el-dialog>
<Statistic ref="statisticRef" />
</div>
</template>
@ -231,6 +237,7 @@
import { listArchive, listStatistic } from '@/api/archive/information';
import { getEvaluationList } from '@/api/archive/warnRecord';
import { pageInterveneRecord } from '@/api/archive/interveneRecord';
import Statistic from './components/Statistic.vue';
const { proxy } = getCurrentInstance() as ComponentInternalInstance;
@ -358,6 +365,11 @@ const handleUpdate = async (row?: any) => {
dialog.title = "查看详情";
}
const statisticRef = ref()
const handleStatistic = (row?: any) => {
statisticRef.value?.openStatistic(row)
}
async function getStaticList() {
const res = await listStatistic(staticQuery.value);
staticList.value = res.rows

View File

@ -69,7 +69,9 @@
v-hasPermi="['evaluation:record:view']">测评详情</el-button>
</el-tooltip>
<el-tooltip content="处理" placement="top">
<el-button link type="primary" icon="Pointer" @click="handleUpdate(scope.row)"
<el-button v-if="scope.row.readFlag == 1" link type="danger" icon="Pointer"
@click="handleUpdate(scope.row)" v-hasPermi="['intervene:record:add']">处理</el-button>
<el-button v-else link type="primary" icon="Pointer" @click="handleUpdate(scope.row)"
v-hasPermi="['intervene:record:add']">处理</el-button>
</el-tooltip>
<el-tooltip content="干预列表" placement="top">

View File

@ -33,7 +33,7 @@ export default defineConfig(({ mode, command }: ConfigEnv): UserConfig => {
},
proxy: {
[env.VITE_APP_BASE_API]: {
target: 'http://localhost:8080/',
target: 'http://localhost:8070/',
changeOrigin: true,
ws: true,
rewrite: (path) => path.replace(new RegExp('^' + env.VITE_APP_BASE_API), '')