Browse Source

部门内容修改

develop
fuguobin 1 year ago
parent
commit
3b7a6d97bf
  1. 1424
      src/views/details/index - 副本.vue
  2. 75
      src/views/details/index.vue
  3. 136
      src/views/details/test.vue
  4. 6
      src/views/monitoring/components/header.vue
  5. 68
      src/views/monitoring/components/menu.vue
  6. 34
      src/views/monitoring/devicemanage/components/main.vue
  7. 93
      src/views/monitoring/screen/components/main.vue
  8. 4
      vite.config.ts

1424
src/views/details/index - 副本.vue

File diff suppressed because it is too large

75
src/views/details/index.vue

@ -34,7 +34,6 @@
<el-form-item class="item" label="设备:" prop="device">
<el-select
v-model="searchForm.device"
multiple
filterable
clearable
collapse-tags
@ -54,7 +53,6 @@
<el-select
v-model="searchForm.parameter"
multiple
:multiple-limit="multipleLimit"
filterable
clearable
collapse-tags
@ -89,7 +87,7 @@
</el-select>
</el-form-item>
<el-form-item class="item">
<el-checkbox v-model="searchForm.showZero" label="是否显示0值" size="large" />
<el-checkbox v-model="searchForm.showZero" label="是否显示0值" size="large" @change="showZeroChange" />
</el-form-item>
<div class="formBtn">
<el-form-item class="item">
@ -104,7 +102,6 @@
<div ref="stackedRef" class="stackedLine">暂无数据</div>
</div>
</el-card>
<!-- <Test /> -->
</div>
</template>
<script lang="ts" setup>
@ -115,7 +112,6 @@ import { randomColor } from '@/utils/index';
const stackedRef: Ref<HTMLElement | any> = ref(null);
import type { FormInstance, FormRules } from 'element-plus';
import { ReturnDownBack } from '@vicons/ionicons5';
// import Test from './test.vue';
import { getDevices, getParams, getPortions, getDeviceInfos } from '@/api/device/index';
import { deetsVo, partitionVo, parameterVo, seriesVo } from '@/api/device/types';
@ -125,13 +121,13 @@ const route = useRoute();
const searchRef = ref<FormInstance>();
const defaultTime = new Date(2000, 1, 1, 12, 0, 0); // '12:00:00'
const multipleLimit = ref(0);
// const multipleLimit = ref(0);
const parameterLimit = ref(0);
const deptId = ref(0);
// const seriesData = ref<seriesVo[]>();
const searchForm = reactive({
time: '',
device: [],
device: '',
parameter: [],
partition: '',
showZero: false
@ -172,8 +168,12 @@ const resetInit = {
mainInfos: [],
additionalInfo: null
};
export interface deviceVo {
centerDeviceCode: string;
deviceName: string;
}
const colors = ['#5470c6', '#91cc75', '#fac858', '#1a94bc', '#f26b1f', '#5bae23'];
const deviceData = ref<deetsVo[]>();
const deviceData = ref<deviceVo[]>();
const parameterData = ref<parameterVo[]>();
const partitionData = ref<partitionVo[]>();
@ -1113,6 +1113,11 @@ onMounted(() => {
// chart.setOption(options2);
});
function lineClick() {
//
router.go(-1);
}
document.addEventListener('keyup', e => {
//
console.log('按键:', e.key);
@ -1146,23 +1151,24 @@ function keyClick(res: string) {
return;
}
const device = searchForm.device;
const deviceDataValue = deviceData.value;
console.log('已选设备:', searchForm.device);
if (device.length === 1 && deviceData.value?.length != 0) {
deviceData.value?.map((item: deetsVo, index: number) => {
if (deviceDataValue?.length != 0) {
deviceDataValue?.map((item: deviceVo, index: number) => {
console.log('遍历设备:', item, index);
if (res === '0') {
//
if (device[0] === item.centerDeviceCode && index != 0) {
searchForm.device = [deviceData.value[index - 1].centerDeviceCode];
filterForm.deviceUuid = searchForm.device.toString();
if (device === item.centerDeviceCode && index != 0) {
searchForm.device = deviceDataValue[index - 1].centerDeviceCode;
filterForm.deviceUuid = searchForm.device;
console.log('当前设备:', searchForm.device);
}
} else if (res === '1') {
//
if (device[0] === item.centerDeviceCode && index + 1 != deviceData.value?.length) {
if (device === item.centerDeviceCode && index + 1 != deviceDataValue?.length) {
console.log('当前设备:', item.deviceName, index);
searchForm.device = [deviceData.value[index + 1].centerDeviceCode];
filterForm.deviceUuid = searchForm.device.toString();
searchForm.device = deviceDataValue[index + 1].centerDeviceCode;
filterForm.deviceUuid = searchForm.device;
console.log('当前设备:', searchForm.device);
}
}
@ -1171,9 +1177,34 @@ function keyClick(res: string) {
getDeviceInfo();
}
function lineClick() {
//
router.go(-1);
function showZeroChange() {
//0
if (filterForm.startTime === '' && filterForm.endTime === '') {
searchForm.showZero = !searchForm.showZero;
ElMessage({
message: '请选择时间',
type: 'warning'
});
return;
}
if (filterForm.deviceUuid === '') {
searchForm.showZero = !searchForm.showZero;
ElMessage({
message: '请选择设备',
type: 'warning'
});
return;
}
if (filterForm.paramCode === '') {
searchForm.showZero = !searchForm.showZero;
ElMessage({
message: '请选择参数',
type: 'warning'
});
return;
}
filterForm.showZero = searchForm.showZero;
getDeviceInfo();
}
function getDevice() {
@ -1382,9 +1413,9 @@ function timeChange(res: any) {
function deviceChange(res: any) {
//
searchForm.parameter = [];
multipleLimit.value = res.length <= 1 ? 0 : 1;
filterForm.deviceUuid = res.toString();
// searchForm.parameter = [];
// multipleLimit.value = res.length <= 1 ? 0 : 1;
filterForm.deviceUuid = res;
}
function parameterChange(res: any) {
//

136
src/views/details/test.vue

@ -1,136 +0,0 @@
<template>
<div id="demo"></div>
</template>
<script setup lang="ts">
import * as echart from 'echarts';
import { onMounted, ref } from 'vue';
const start = ref(7);
const end = ref(9);
onMounted(() => {
const myChart = echart.init(document.getElementById('demo'));
const option = {
tooltip: {
trigger: 'axis',
axisPointer: {
type: 'shadow'
}
},
grid: {
top: 50,
bottom: 50,
right: 30
},
toolbox: {
show: true, //
orient: 'horizontal', //
itemSize: 15, //
itemGap: 8, //
showTitle: true, //
feature: {
//
myLeft: {
show: true,
title: '上一个',
icon: 'path://M735.208665 65.582671l-446.41733 446.417329 446.41733 446.417329z',
onclick: () => {
if (end.value < 9) {
start.value += 1;
end.value += 1;
}
myChart.dispatchAction({
type: 'dataZoom',
// dataZoom index dataZoom 0
dataZoomIndex: 0,
//
startValue: start.value,
//
endValue: end.value
});
}
},
myRight: {
show: true,
title: '下一个',
icon: 'path://M288.791335 65.582671l446.41733 446.417329-446.41733 446.417329z',
onclick: () => {
if (start.value > 0) {
start.value -= 1;
end.value -= 1;
}
myChart.dispatchAction({
type: 'dataZoom',
// dataZoom index dataZoom 0
dataZoomIndex: 0,
//
startValue: start.value,
//
endValue: end.value
});
}
}
},
iconStyle: {
//
color: '#869AD7'
},
right: 3
},
xAxis: {
type: 'value',
splitLine: {
lineStyle: {
type: 'dashed'
}
}
},
yAxis: {
type: 'category',
data: ['ten', 'nine', 'eight', 'seven', 'six', 'five', 'four', 'three', 'two', 'one']
},
//
dataZoom: [
{
//
show: true,
// y
yAxisIndex: 0,
//
filterMode: 'empty',
//
width: 15,
height: '70%',
//
showDataShadow: false,
//
left: '95%',
//
startValue: 10,
//
endValue: 8,
// 3
zoomLock: true
}
],
series: [
{
name: 'Cost',
type: 'bar',
data: [12, 23, 34, 56, 43, 67, 89, 90, 76, 29]
}
]
};
myChart.setOption(option);
});
</script>
<style lang="scss" scoped>
#demo {
width: 600px;
height: 300px;
border: 1px solid red;
padding-right: 30px;
}
</style>

6
src/views/monitoring/components/header.vue

@ -106,8 +106,8 @@
</el-table-column>
<el-table-column prop="totalCounts" label="告警累计" align="center" />
<el-table-column label="报警时间" align="center">
<el-table-column prop="alertFirstTime" label="首次告警时间" align="center" />
<el-table-column prop="alertLastTime" label="末次告警时间" align="center" />
<el-table-column prop="alertFirstTimeS" label="首次告警时间" align="center" />
<el-table-column prop="alertLastTimeS" label="末次告警时间" align="center" />
</el-table-column>
<el-table-column fixed="right" label="操作" align="center">
<template #default="scope">
@ -269,7 +269,7 @@ function getwaringList() {
const paramsr = {
beginTime: '',
endTime: '',
orgCode: deptId.value,
orgCode: sessionStorage.getItem('deptId') === null ? 0 : Number(sessionStorage.getItem('deptId')),
params
};
getWarList(paramsr).then((res: any) => {

68
src/views/monitoring/components/menu.vue

@ -1,55 +1,65 @@
<template>
<div class="menuCantent">
<n-menu ref="menuInstRef" class="menu" :indent="0" :options="menuOptions" v-model:value="selectedKey"
key-field="deptId" label-field="deptName" :default-expand-all="false" :watch-props="['defaultExpandedKeys']"
:render-label="renderMenuLabel" @update:value="menuUpdateValue" />
<n-menu
ref="menuInstRef"
class="menu"
:indent="0"
:options="menuOptions"
v-model:value="selectedKey"
key-field="deptId"
label-field="deptName"
:default-expand-all="false"
:watch-props="['defaultExpandedKeys']"
:render-label="renderMenuLabel"
@update:value="menuUpdateValue"
/>
</div>
</template>
<script lang="ts" setup>
import { useRoute } from "vue-router";
import { useRoute } from 'vue-router';
import type { MenuOption } from 'naive-ui';
// import { NEllipsis } from 'naive-ui';
import { getMenu } from '@/api/table/list';
import { getMenuData } from '@/api/device/index';
import { getFirstNodeLastLevel } from '@/utils/index';
import useStorage from '@/utils/useStorage'
import useStorage from '@/utils/useStorage';
import mitt from '@/plugins/bus';
const router = useRoute()
const router = useRoute();
const menuOptions = ref([]);
const selectedKey = ref();
const sessionStorageIns = useStorage('sessionStorage');
const routerType = ref('')
const id = ref(0)
const deptId = ref(0)
const menuDeptKey = ref(0)
const menuIdKey = ref(0)
const routerType = ref('');
const id = ref(0);
const deptId = ref(0);
const menuDeptKey = ref(0);
const menuIdKey = ref(0);
const emit = defineEmits(['tableMenuData']);
const props = defineProps({
menuType: {
type: String,
default: '1',
},
default: '1'
}
});
onMounted(() => {
routerType.value = router.query?.id === undefined ? "0" : "1"
id.value = sessionStorage.getItem('id') === null ? 0 : Number(sessionStorage.getItem('id'))
deptId.value = sessionStorage.getItem('deptId') === null ? 0 : Number(sessionStorage.getItem('deptId'))
routerType.value = router.query?.id === undefined ? '0' : '1';
id.value = sessionStorage.getItem('id') === null ? 0 : Number(sessionStorage.getItem('id'));
deptId.value = sessionStorage.getItem('deptId') === null ? 0 : Number(sessionStorage.getItem('deptId'));
if (props.menuType === '1') {
menuApi();
} else if (props.menuType === '2') {
comMenuApi()
comMenuApi();
}
});
function menuApi() {
//
//
getMenu().then((res: any) => {
if (res.code === 200) {
menuDeptKey.value = routerType.value === '1' ? deptId.value : getFirstNodeLastLevel(res.data).deptId
menuDeptKey.value = routerType.value === '1' ? deptId.value : getFirstNodeLastLevel(res.data).deptId;
removeChildren(res.data);
menuOptions.value = res.data;
selectedKey.value = menuDeptKey.value;
@ -63,11 +73,12 @@ function comMenuApi() {
//
getMenuData().then((res: any) => {
if (res.code === 200) {
menuIdKey.value = routerType.value === '1' ? id.value : getFirstNodeLastLevel(res.data).deptId
menuIdKey.value = routerType.value === '1' ? id.value : getFirstNodeLastLevel(res.data).deptId;
const parentId = routerType.value === '1' ? id.value : getFirstNodeLastLevel(res.data).parentId;
removeChildren(res.data);
menuOptions.value = res.data;
selectedKey.value = menuIdKey.value;
sessionStorageIns.setUseStorage('deptId', routerType.value === '1' ? deptId.value : menuIdKey.value);
sessionStorageIns.setUseStorage('deptId', routerType.value === '1' ? deptId.value : parentId);
mitt.emit(props.menuType === '1' ? 'menuKey' : 'deviceMenuKey', menuIdKey.value);
emit('tableMenuData', res.data);
}
@ -80,7 +91,7 @@ function removeChildren(menu: any) {
return;
}
menu.forEach((item) => {
menu.forEach(item => {
if (item.children && item.children.length === 0) {
delete item.children;
} else {
@ -93,11 +104,14 @@ const renderMenuLabel = (option: MenuOption) => {
//
// return h(NEllipsis, null, option.deptName as string);
return h(NEllipsis, null, { default: () => option.deptName });
}
};
function menuUpdateValue(key: string, item: MenuOption) {
//
sessionStorageIns.setUseStorage(props.menuType === '1' ? 'deptId' : 'id', key);
if (props.menuType === '2') {
sessionStorageIns.setUseStorage('deptId', item.parentId);
}
mitt.emit(props.menuType === '1' ? 'menuKey' : 'deviceMenuKey', key);
console.log(key, item);
}
@ -129,17 +143,17 @@ function menuUpdateValue(key: string, item: MenuOption) {
}
.n-menu-item-content__arrow {
color: #B1E3FF;
color: #b1e3ff;
}
}
.n-menu-item-content.n-menu-item-content--child-active {
.n-menu-item-content-header {
color: #B1E3FF;
color: #b1e3ff;
}
.n-menu-item-content__arrow {
color: #B1E3FF;
color: #b1e3ff;
}
}
@ -158,7 +172,7 @@ function menuUpdateValue(key: string, item: MenuOption) {
.n-menu-item-content-header {
font-size: 2.2rem;
color: #B1E3FF;
color: #b1e3ff;
}
}

34
src/views/monitoring/devicemanage/components/main.vue

@ -144,8 +144,8 @@
@update:value="submitBlur(res)"
v-if="res.ctrlpro.valueType === 'bool'"
>
<template #checked>Y</template>
<template #unchecked>N</template>
<template #checked></template>
<template #unchecked></template>
</n-switch>
<n-input
size="tiny"
@ -212,8 +212,34 @@
@update:value="submitBlur(res)"
v-if="res.ctrlpro.valueType === 'bool'"
>
<template #checked>Y</template>
<template #unchecked>N</template>
<template #checked></template>
<template #unchecked></template>
</n-switch>
<n-input
size="tiny"
v-model:value="res.value"
readonly
placeholder="0"
style="width: 80px; opacity: 0.9; text-align: center"
v-if="res.ctrlpro.valueType != 'bool'"
@click="inputClick(res)"
/>
</i>
</span>
<span v-for="(res, index) in item.header_pump" :key="index">
<i>{{ res.label }} </i>
<i v-if="res.ctrlFlag === 0">{{ res.value }}{{ res.paramUnit }}</i>
<i v-if="res.ctrlFlag === 1">
<n-switch
class="switch"
size="small"
v-model:value="res.value"
style="--n-rail-color-active: #409eff; --n-rail-color: #ff4949"
@update:value="submitBlur(res)"
v-if="res.ctrlpro.valueType === 'bool'"
>
<template #checked></template>
<template #unchecked></template>
</n-switch>
<n-input
size="tiny"

93
src/views/monitoring/screen/components/main.vue

@ -61,14 +61,32 @@
title-align="right"
title-width="100"
:data="formData"
:rules="formRules"
:loading="formLoading"
@submit="submitEvent"
@reset="resetEvent"
>
<vxe-form-item field="value" span="24" :item-render="{}" title-overflow>
<template #default="params">
<vxe-input v-model="params.data.value" placeholder="请输入数值" clearable></vxe-input>
<vxe-switch
v-model="params.data.value"
size="small"
open-label="启"
close-label="停"
v-if="params.data.valueType === 'bool'"
></vxe-switch>
<vxe-input
v-model="params.data.value"
placeholder="请输入数值"
type="number"
clearable
v-if="params.data.valueType != 'bool'"
></vxe-input>
<!-- <vxe-input
v-model="params.data.value"
placeholder="请输入数值"
clearable
v-if="params.data.valueType != 'bool'"
></vxe-input> -->
</template>
</vxe-form-item>
<vxe-form-item align="center" span="24">
@ -122,34 +140,36 @@ const tableBorder = ref(true);
// const waringArrow = ref([])
interface FormDataVO {
//url: string;
deviceName: string;
paramCode: string;
value: string;
centeruuid: string;
paramcode: string;
url: string;
valueType: string;
value: string | boolean;
}
const formRef = ref<VxeFormInstance>();
const formLoading = ref(false);
const formData = ref<FormDataVO>({
//url: '',
deviceName: '',
paramCode: '',
centeruuid: '',
paramcode: '',
url: '',
valueType: '',
value: ''
});
const formRules = ref<VxeFormPropTypes.Rules>({
value: [
{ required: true, message: '请输入数值' },
{ min: 1, max: 100, message: '长度在 1 到 100 个字符' },
{
validator({ itemValue }) {
//
const reg = /^-?\d+\.?\d{0,2}$/;
if (!reg.test(itemValue)) {
return new Error('请输入正确数值!');
}
}
}
]
});
// const formRules = ref<VxeFormPropTypes.Rules>({
// value: [
// { required: true, message: '' },
// { min: 1, max: 100, message: ' 1 100 ' },
// {
// validator({ itemValue }) {
// //
// const reg = /^-?\d+\.?\d{0,2}$/;
// if (!reg.test(itemValue)) {
// return new Error('');
// }
// }
// }
// ]
// });
const userStorageInfo = sessionStorage.getItem('userInfo');
const userInfo = JSON.parse(userStorageInfo === null ? '' : userStorageInfo);
@ -369,9 +389,9 @@ const cellDBLClickEvent: VxeTableEvents.CellDblclick<TableVo> = ({ row, column }
modalTitle.value = column.title;
///formData.value.url = data.url;
//formData.value.deviceName = cellField.deviceName;
formData.value = cellField.ctrlPro;
formData.value.value = cellField.val;
formData.value.deviceName = cellField.ctrlPro.centeruuid;
formData.value.paramCode = cellField.ctrlPro.paramcode;
// formData.value.paramCode = cellField.ctrlPro.paramcode;
editModal.value = true;
}
console.log(row[column.field]);
@ -379,11 +399,15 @@ const cellDBLClickEvent: VxeTableEvents.CellDblclick<TableVo> = ({ row, column }
const formatRole: VxeColumnPropTypes.Formatter<HeaderVo> = ({ cellValue }) => {
//object
console.log(cellValue);
// const iconFont=cellValue.changeProp===-1?'<i class="iconfont icon-decline" />':(cellValue.changeProp===1?'<i class="iconfont icon-rise" />':'<i/>')
// const cellData = `<span class="cellClass ${cellValue.alertProp===1?'warning':''}">${cellValue.val}</span>${iconFont}`;
// const cellData = `<span class="cellClass ${cellValue.alertProp === 1 ? 'warning' : cellValue.canBeControl === '1' ? 'cellEdit' : ''}">${cellValue.val}</span><i class="iconfont ${cellValue.changeProp === -1 ? 'icon-decline' : cellValue.changeProp === 1 ? 'icon-rise' : ''}" ></i>${cellValue.canBeControl === '1' ? '<i class="iconfont icon-edit-icon"></i>' : ''}`;
const cellData = `<span class="cellClass ${
cellValue.alertProp === 1 ? 'warning' : cellValue.canBeControl === '1' ? 'cellEdit' : ''
}">${cellValue.val}</span><i class="iconfont ${
}">${
cellValue.ctrlPro.valueType != 'bool' ? cellValue.val : cellValue.val === 'true' ? '启' : '停'
}</span><i class="iconfont ${
cellValue.changeProp === -1 ? 'icon-decline' : cellValue.changeProp === 1 ? 'icon-rise' : ''
}" ></i>${cellValue.canBeControl === '1' ? '<i class="iconfont icon-edit-icon"></i>' : ''}`;
return cellData;
@ -414,23 +438,12 @@ const submitEvent: VxeFormEvents.Submit = () => {
//websocket
formLoading.value = true;
const $table = tableRef.value;
const submitData = {
//code: 'W01',
//data: {
//url: formData.value.url,
//deviceName: formData.value.deviceName,
//value: formData.value.value,
deviceUUID: formData.value.deviceName,
paramCode: formData.value.paramCode,
valueType: '',
value: formData.value.value
//},
};
const submitData = formData.value;
console.log(submitData);
//Add by zhousq 2023-10-12 post
sendCtrl(submitData).then((res: any) => {
if (res.code === 200) {
console.log(res.data);
ElNotification({ message: res.data.msg });
}
});
//socket.onSend(submitData);

4
vite.config.ts

@ -45,9 +45,9 @@ export default defineConfig(({ mode }: ConfigEnv): UserConfig => {
hmr: true, //配置HMR
proxy: {
'/dev-api': {
// target: 'http://172.1.2.196:9010/', //本地接口地址
target: 'http://172.1.2.6:9010/', //本地接口地址
// target: 'http://172.1.2.158:9010/', //本地接口地址
target: 'http://10.10.10.56:9010/', //线上测试接口地址
// target: 'http://10.10.10.56:9010/', //线上测试接口地址
changeOrigin: true,
rewrite: path => path.replace(/^\/dev-api/, '')
}

Loading…
Cancel
Save