修改权限控制和大屏页面

This commit is contained in:
jiangzhe 2024-04-26 17:10:09 +08:00
parent b353171ab4
commit a95ae31a26
16 changed files with 600 additions and 18 deletions

View File

@ -35,6 +35,20 @@ export const getEvaluationRecordList = (warnId: string | number): AxiosPromise<W
});
};
export const listConfig = (): AxiosPromise<any> => {
return request({
url: '/scale/warn/config/list',
method: 'get'
});
};
export const editConfig = (id: string | number | Array<string | number>) => {
return request({
url: '/scale/warn/config/' + id,
method: 'put'
});
};
export const getEvaluationList = (query: any): AxiosPromise<WarnRecordVO> => {
return request({
url: '/scale/evaluation/conclusion/list',

Binary file not shown.

BIN
src/assets/images/bg.jpg Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 252 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.7 KiB

BIN
src/assets/images/line.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.9 KiB

View File

@ -47,6 +47,11 @@ export const constantRoutes: RouteOption[] = [
component: () => import('@/views/login.vue'),
hidden: true
},
{
path: '/bigScreen',
component: () => import('@/views/bigScreen/index.vue'),
hidden: true
},
{
path: '/register',
component: () => import('@/views/register.vue'),
@ -153,7 +158,7 @@ export const dynamicRoutes: RouteOption[] = [
path: '/scale/scale-question',
component: Layout,
hidden: true,
permissions: ['scale:SysScale:edit'],
permissions: ['scale:question:pageList'],
children: [
{
path: 'index/:scaleId(\\d+)',

43
src/utils/flexible.ts Normal file
View File

@ -0,0 +1,43 @@
(function flexible(window, document) {
var docEl = document.documentElement;
var dpr = window.devicePixelRatio || 1;
// adjust body font size
function setBodyFontSize() {
if (document.body) {
document.body.style.fontSize = 12 * dpr + "px";
} else {
document.addEventListener("DOMContentLoaded", setBodyFontSize);
}
}
setBodyFontSize();
// set 1rem = viewWidth / 10
function setRemUnit() {
var rem = docEl.clientWidth / 24;
docEl.style.fontSize = rem + "px";
}
setRemUnit();
// reset rem unit on page resize
window.addEventListener("resize", setRemUnit);
window.addEventListener("pageshow", function (e) {
if (e.persisted) {
setRemUnit();
}
});
// detect 0.5px supports
if (dpr >= 2) {
var fakeBody = document.createElement("body");
var testElement = document.createElement("div");
testElement.style.border = ".5px solid transparent";
fakeBody.appendChild(testElement);
docEl.appendChild(fakeBody);
if (testElement.offsetHeight === 1) {
docEl.classList.add("hairlines");
}
docEl.removeChild(fakeBody);
}
})(window, document);

View File

@ -40,11 +40,11 @@
<template #default="scope">
<el-tooltip content="处理" placement="top">
<el-button link type="primary" icon="View" @click="handleUpdate(scope.row)"
v-hasPermi="['scale:warnRecord:edit']">处理</el-button>
v-hasPermi="['intervene:record:add']">处理</el-button>
</el-tooltip>
<el-tooltip content="干预列表" placement="top">
<el-button link type="primary" icon="Edit" @click="handleList(scope.row)"
v-hasPermi="['scale:warnRecord:edit']">干预列表</el-button>
v-hasPermi="['intervene:record:list']">干预列表</el-button>
</el-tooltip>
</template>
</el-table-column>

View File

@ -40,11 +40,11 @@
<template #default="scope">
<el-tooltip content="详情" placement="top">
<el-button link type="primary" icon="View" @click="handleDesc(scope.row)"
v-hasPermi="['scale:warnRecord:edit']">详情</el-button>
v-hasPermi="['warn:record:query']">详情</el-button>
</el-tooltip>
<el-tooltip content="补充说明" placement="top">
<el-button link type="primary" icon="Edit" @click="handleUpdate(scope.row)"
v-hasPermi="['scale:warnRecord:edit']">补充说明</el-button>
v-hasPermi="['warn:record:edit']">补充说明</el-button>
</el-tooltip>
</template>
</el-table-column>

View File

@ -0,0 +1,462 @@
<template>
<div class="big-screen">
<header class="item item1">
<h1>云舒心理健康云平台</h1>
<div class="showTime">{{ showTime }}</div>
</header>
<div class="item item2 no">
<div class="no-hd">
<ul>
<li>50</li>
<li>164</li>
<li>87</li>
<li>1</li>
</ul>
</div>
<div class="no-bd">
<ul>
<li>总人数</li>
<li>总采集人数</li>
<li>关注人次</li>
<li>干预人次</li>
</ul>
</div>
</div>
<div class="item item3 panel ">
<h2>采集统计分析</h2>
<v-chart style="height: 3.75rem;" :option="pieOption" autoresize />
<div class="panel-footer"></div>
</div>
<div class="item item4 panel">
<h2>单位数据统计</h2>
<v-chart style="height: 3.75rem;" :option="barOption" autoresize />
<div class="panel-footer"></div>
</div>
<div class="item item5 panel">
<h2>单位排名统计</h2>
<div class="chart"></div>
<div class="panel-footer"></div>
</div>
<div class="item item6 panel">
<h2>心理咨询师</h2>
<div class="chart"></div>
<div class="panel-footer"></div>
</div>
<div class="item item7 panel">
<h2>数据统计分析</h2>
<div class="chart"></div>
<div class="panel-footer"></div>
</div>
<div class="item item8 panel">
<h2>已测评人员</h2>
<div class="chart"></div>
<div class="panel-footer"></div>
</div>
<div class="item item9"></div>
</div>
</template>
<script lang="ts" setup>
import { ref } from 'vue'
import '@/utils/flexible'
import * as echarts from 'echarts';
import { use } from 'echarts/core'
import { CanvasRenderer } from "echarts/renderers";
import { PieChart, BarChart } from "echarts/charts";
import { TitleComponent, TooltipComponent, LegendComponent, GridComponent } from "echarts/components";
import VChart from 'vue-echarts'
use([
CanvasRenderer,
PieChart,
BarChart,
TitleComponent,
TooltipComponent,
LegendComponent,
GridComponent
]);
let showTime = ref('')
let timer: any = null
function time() {
let dt = new Date();
let y = dt.getFullYear();
let mt = dt.getMonth() + 1;
let day = dt.getDate();
let h = dt.getHours();//
let m = dt.getMinutes();//
let s = dt.getSeconds();//
showTime.value = y + "年" + mt + "月" + day + "日" + h + "时" + m + "分" + s + "秒";
}
onMounted(() => {
time()
timer = setInterval(time, 1000);
});
onBeforeUnmount(() => {
clearInterval(timer);
});
const pieOption = ref({
tooltip: {
trigger: 'item'
},
legend: {
top: '5%',
left: 'center',
textStyle: {
color: '#fff',
fontSize: 20
},
},
series: [
{
name: '采集统计分析',
type: 'pie',
radius: ['40%', '70%'],
avoidLabelOverlap: false,
itemStyle: {
borderRadius: 10,
borderColor: '#fff',
borderWidth: 2
},
label: {
show: false,
position: 'center'
},
emphasis: {
label: {
show: true,
fontSize: 40,
fontWeight: 'bold'
}
},
labelLine: {
show: false
},
data: [
{ value: 1048, name: '中风险' },
{ value: 735, name: '低风险' },
{ value: 580, name: '高风险' },
{ value: 484, name: '未见异常' },
{ value: 300, name: '重大风险' }
]
}
]
});
const barOption = ref({
tooltip: {
trigger: 'axis',
axisPointer: {
type: 'shadow'
}
},
legend: {
textStyle: {
color: '#fff',
fontSize: 20
},
},
grid: {
left: '3%',
right: '4%',
bottom: '3%',
containLabel: true
},
xAxis: {
type: 'value'
},
yAxis: {
type: 'category',
data: ['Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat', 'Sun']
},
series: [
{
name: 'Direct',
type: 'bar',
stack: 'total',
label: {
show: true
},
emphasis: {
focus: 'series'
},
data: [320, 302, 301, 334, 390, 330, 320]
},
{
name: 'Mail Ad',
type: 'bar',
stack: 'total',
label: {
show: true
},
emphasis: {
focus: 'series'
},
data: [120, 132, 101, 134, 90, 230, 210]
},
{
name: 'Affiliate Ad',
type: 'bar',
stack: 'total',
label: {
show: true
},
emphasis: {
focus: 'series'
},
data: [220, 182, 191, 234, 290, 330, 310]
},
{
name: 'Video Ad',
type: 'bar',
stack: 'total',
label: {
show: true
},
emphasis: {
focus: 'series'
},
data: [150, 212, 201, 154, 190, 330, 410]
},
{
name: 'Search Engine',
type: 'bar',
stack: 'total',
label: {
show: true
},
emphasis: {
focus: 'series'
},
data: [820, 832, 901, 934, 1290, 1330, 1320]
}
]
})
</script>
<style lang="scss" scoped>
* {
margin: 0;
padding: 0;
box-sizing: border-box;
}
li {
list-style: none;
}
/* 声明字体*/
@font-face {
font-family: electronicFont;
src: url('@/assets/font/DS-DIGIT.TTF');
}
.big-screen {
background: url('@/assets/images/bg.jpg') no-repeat top center;
background-size: cover;
line-height: 1.15;
width: 100vw;
height: 100vh;
display: grid;
grid-template-columns: repeat(3, 1fr);
grid-template-rows: 1.25rem 1.75rem repeat(2, 1fr) .025rem;
gap: .125rem;
header {
position: relative;
height: 1.25rem;
background: url('@/assets/images/head_bg.png') no-repeat;
background-size: 100% 100%;
h1 {
font-size: .475rem;
color: #fff;
text-align: center;
line-height: 1rem;
}
.showTime {
position: absolute;
right: .375rem;
top: 0;
line-height: .9375rem;
color: rgba(255, 255, 255, 0.7);
font-size: .25rem;
letter-spacing: .025rem;
}
}
.no {
background-color: rgba(101, 132, 226, 0.1);
padding: .1875rem;
margin-left: .125rem;
margin-right: .125rem;
.no-hd {
height: 1rem;
position: relative;
border: 1px solid rgba(25, 186, 139, 0.17);
&::before {
position: absolute;
top: 0;
left: 0;
content: "";
width: 30px;
height: 10px;
border-top: 2px solid #02a6b5;
border-left: 2px solid #02a6b5;
}
&::after {
position: absolute;
bottom: 0;
right: 0;
content: "";
width: 30px;
height: 10px;
border-right: 2px solid #02a6b5;
border-bottom: 2px solid #02a6b5;
}
ul {
display: flex;
li {
position: relative;
flex: 1;
line-height: 1rem;
font-size: .875rem;
color: #ffeb7b;
text-align: center;
font-family: 'electronicFont';
&::after {
content: "";
position: absolute;
top: 25%;
right: 0;
height: 50%;
width: 1px;
background-color: rgba(255, 255, 255, 0.2);
}
}
}
}
.no-bd {
height: .5rem;
ul {
display: flex;
li {
flex: 1;
text-align: center;
color: rgba(255, 255, 255, 0.7);
font-size: .225rem;
line-height: .5rem;
padding-top: .125rem;
}
}
}
}
.item1,
.item2,
.item9 {
grid-column: 1/4;
}
.item3,
.item6 {
margin-left: .125rem;
}
.item5,
.item8 {
margin-right: .125rem;
}
.panel {
position: relative;
border: 1px solid rgba(25, 186, 139, 0.17);
background: url('@/assets/images/line.png') rgba(255, 255, 255, 0.03);
&::before {
position: absolute;
top: 0;
left: 0;
width: 10px;
height: 10px;
border-left: 2px solid #02a6b5;
border-top: 2px solid #02a6b5;
content: "";
}
&::after {
position: absolute;
top: 0;
right: 0;
width: 10px;
height: 10px;
border-right: 2px solid #02a6b5;
border-top: 2px solid #02a6b5;
content: "";
}
.panel-footer {
position: absolute;
bottom: 0;
left: 0;
width: 100%;
&::before {
position: absolute;
bottom: 0;
left: 0;
width: 10px;
height: 10px;
border-left: 2px solid #02a6b5;
border-bottom: 2px solid #02a6b5;
content: "";
}
&::after {
position: absolute;
bottom: 0;
right: 0;
width: 10px;
height: 10px;
border-right: 2px solid #02a6b5;
border-bottom: 2px solid #02a6b5;
content: "";
}
}
h2 {
height: .6rem;
color: #fff;
line-height: .6rem;
text-align: center;
font-size: .25rem;
font-weight: 400;
}
}
}
</style>

View File

@ -0,0 +1,47 @@
<template>
<div class="p-2" style="margin-left: 20px;margin-top: 20px;">
<p>请选择预警配置项</p>
<el-checkbox-group v-model="checkList">
<el-checkbox v-for="item in configList" :label="item.name" :value="item.id" />
</el-checkbox-group>
<el-button style="margin-top: 20px;" type="primary" @click="handleSubmit"
v-hasPermi="['warn:config:edit']">确定</el-button>
</div>
</template>
<script setup lang="ts">
import { listConfig, editConfig } from '@/api/archive/warnRecord'
import { onMounted } from 'vue';
const checkList = ref<any[]>([])
const configList = ref<any[]>([])
async function getConfigList() {
const res = await listConfig()
configList.value = res.data
checkList.value = res.data.filter((item: any) => item.status == 1).map((item: any) => item.id)
}
async function handleSubmit() {
if (checkList) {
const res = await editConfig(checkList.value)
if (res.code == 200) {
ElMessage.success('提交成功')
} else {
ElMessage.error('提交失败')
}
getConfigList()
} else {
ElMessage.error('请选择配置项')
}
}
onMounted(() => {
getConfigList()
})
</script>
<style scoped></style>

View File

@ -51,7 +51,8 @@
<el-table-column label="操作" align="center" class-name="small-padding fixed-width">
<template #default="scope">
<el-tooltip content="查看测评结果" placement="top">
<el-button link type="primary" icon="View" @click="handleUpdate(scope.row)">
<el-button link type="primary" icon="View" @click="handleUpdate(scope.row)"
v-hasPermi="['evaluation:record:query']">
<router-link :to="'/activity/index/' + scope.row.batchNo" class="link-type">
<span>查看测评结果</span>
</router-link>

View File

@ -1,16 +1,23 @@
<template>
<div class="app-container home">
<el-button round>
<router-link target="_blank" to="/bigScreen">
<el-icon>
<FullScreen />
</el-icon><span></span>
</router-link>
</el-button>
<img src="@/assets/images/welcome.png" />
</div>
</template>
<script setup name="Index" lang="ts">
import { initWebSocket } from '@/utils/websocket';
// import { initWebSocket } from '@/utils/websocket';
onMounted(() => {
let protocol = window.location.protocol === 'https:' ? 'wss://' : 'ws://'
initWebSocket(protocol + window.location.host + import.meta.env.VITE_APP_BASE_API + "/resource/websocket");
});
// onMounted(() => {
// let protocol = window.location.protocol === 'https:' ? 'wss://' : 'ws://'
// initWebSocket(protocol + window.location.host + import.meta.env.VITE_APP_BASE_API + "/resource/websocket");
// });
</script>
<style scoped lang="scss">

View File

@ -112,7 +112,7 @@
</el-tooltip>
<el-tooltip content="问题列表" placement="top">
<el-button link type="primary" icon="Grid" v-hasPermi="['scale:info:edit']">
<el-button link type="primary" icon="Grid" v-hasPermi="['scale:question:pageList']">
<router-link :to="'/scale/scale-question/index/' + scope.row.scaleId" class="link-type">
<span>问题列表</span>
</router-link>
@ -120,7 +120,7 @@
</el-tooltip>
<el-tooltip content="因子列表" placement="top">
<el-button link type="primary" icon="Grid" v-hasPermi="['scale:info:edit']">
<el-button link type="primary" icon="Grid" v-hasPermi="['scale:factor:pageList']">
<router-link :to="'/scale/scale-factor/index/' + scope.row.scaleId" class="link-type">
<span>因子列表</span>
</router-link>

View File

@ -31,7 +31,8 @@
<template #header>
<el-row :gutter="10" class="mb8">
<el-col :span="1.5">
<el-button type="primary" plain icon="Plus" @click="handleAdd">量表测评发布</el-button>
<el-button type="primary" plain icon="Plus" @click="handleAdd"
v-hasPermi="['scale:publish:add']">量表测评发布</el-button>
</el-col>
<right-toolbar v-model:showSearch="showSearch" @queryTable="getList"></right-toolbar>
</el-row>
@ -75,8 +76,9 @@
<el-table-column label="布布次数" align="center" prop="publishNums" />
<el-table-column label="操作" align="center" class-name="small-padding fixed-width">
<template #default="scope">
<el-tooltip content="修改" placement="top">
<el-button link type="primary" icon="View" @click="handleDetail(scope.row)">查看量表详情</el-button>
<el-tooltip content="查看量表详情" placement="top">
<el-button link type="primary" icon="View" @click="handleDetail(scope.row)"
v-hasPermi="['scale:info:query']">查看量表详情</el-button>
</el-tooltip>
</template>
</el-table-column>

View File

@ -58,7 +58,8 @@
<el-table-column label="操作" align="center" class-name="small-padding fixed-width">
<template #default="scope">
<el-tooltip content="查看测评结果" placement="top">
<el-button link type="primary" icon="View" @click="handleUpdate(scope.row)">
<el-button link type="primary" icon="View" @click="handleUpdate(scope.row)"
v-hasPermi="['evaluation:record:query']">
<router-link :to="'/activity/index/' + scope.row.batchNo" class="link-type">
<span>查看测评结果</span>
</router-link>
@ -66,7 +67,7 @@
</el-tooltip>
<el-tooltip content="中止" placement="top">
<el-button link type="primary" icon="Delete" @click="handleDelete(scope.row)"
v-hasPermi="['scale:scalePublish:remove']">中止</el-button>
v-hasPermi="['scale:publish:edit']">中止</el-button>
</el-tooltip>
</template>
</el-table-column>