[update] 完善系统

This commit is contained in:
danshihao
2024-04-09 19:45:46 +08:00
parent 8d33b4532e
commit 46d9540b66
14 changed files with 449 additions and 58 deletions
+1 -1
View File
@@ -6,7 +6,7 @@
:visible="visible"
:confirmLoading="confirmLoading">
<div :style="{width: '100%',border: '1px solid #e9e9e9',padding: '10px 16px',background: '#fff',}">
<div :style="{width: '100%',padding: '10px 16px',}">
<a-spin :spinning="confirmLoading">
<a-form-model ref="form" :model="model" :rules="validatorRules">
@@ -34,13 +34,14 @@
</div>
</common-card>
</a-col>
<a-col flex="auto">
<a-col flex="1">
<common-card title="设备列表">
<a-table
ref="table"
size="middle"
bordered
rowKey="id"
:loading="deviceData.loading"
:scroll="{x: true,y:200}"
:columns="deviceData.columns"
:dataSource="deviceData.dataSource"
@@ -61,7 +62,7 @@
</a-col>
</a-row>
<a-row :gutter="20" type="flex">
<a-row :gutter="20" type="flex" class="mb-20">
<a-col flex="545px">
<common-card title="系统消息">
<a-table
@@ -81,7 +82,7 @@
</a-table>
</common-card>
</a-col>
<a-col flex="auto">
<a-col flex="1">
<a-row type="flex">
<a-col flex="1" style="margin-right: 20px">
<common-card title="添加设备">
@@ -276,7 +277,7 @@ export default {
pageSize: 10,
pageSizeOptions: ['10', '20', '30'],
showTotal: (total, range) => {
return range[0] + '-' + range[1] + ' 共' + total + '条'
return '共' + total + '条'
},
showQuickJumper: true,
showSizeChanger: true,
@@ -310,41 +311,49 @@ export default {
],
dataSource: [
{
id: '1',
triggerTime: '2024-3-15 13:55:26',
messageType: '用户登录',
messageContent: '张三登录系统'
},
{
id: '2',
triggerTime: '2024-3-15 13:55:26',
messageType: '设备上线',
messageContent: '树101-1RTU控制器上线'
},
{
id: '3',
triggerTime: '2024-3-15 13:55:26',
messageType: '设备下线',
messageContent: '树101-1RTU控制器上线'
},
{
id: '4',
triggerTime: '2024-3-15 13:55:26',
messageType: '设备上线',
messageContent: '树101-1RTU控制器上线'
},
{
id: '5',
triggerTime: '2024-3-15 13:55:26',
messageType: '设备上线',
messageContent: '树101-1RTU控制器上线'
},
{
id: '6',
triggerTime: '2024-3-15 13:55:26',
messageType: '设备上线',
messageContent: '树101-1RTU控制器上线'
},
{
id: '7',
triggerTime: '2024-3-15 13:55:26',
messageType: '设备下线',
messageContent: '树101-1RTU控制器下线'
},
{
id: '8',
triggerTime: '2024-3-15 13:55:26',
messageType: '用户退出',
messageContent: '张三退出系统'
@@ -377,7 +386,7 @@ export default {
// 分页、排序、筛选变化时触发
handleTableChange (pagination, filters, sorter) {
this.deviceData.ipagination = pagination
// this.loadData()
this.loadDeviceList()
},
// 设备状态改变
handleChangeStatus (record) {
@@ -50,7 +50,7 @@
size="middle"
bordered
rowKey="id"
:scroll="{x: true,y:200}"
:scroll="{x: true,y:280}"
:columns="userInfo.columns"
:dataSource="userInfo.dataSource"
:pagination="userInfo.ipagination"
@@ -61,9 +61,19 @@
<div class="table-text">{{ text || text === 0 ? text : global.emptyLine }}</div>
</a-tooltip>
</template>
<template slot="userType" slot-scope="text, record">
<a-tooltip>
<template slot="title">{{ text || text === 0 ? text : global.emptyLine }}</template>
<div class="table-text"
:class="{
'tag-blue': record.userType === userType.admin.value,
'tag-cyan': record.userType === userType.common.value
}">{{ text || text === 0 ? text : global.emptyLine }}</div>
</a-tooltip>
</template>
<span slot="action" slot-scope="text, record, index" class="operation-btns">
<a class="primary" @click="handleChangeStatus(record, index)">编辑</a>
<a class="danger" @click="handleDelete(record, index)">删除</a>
<a class="primary" @click="handleEditUser(record, index)">编辑</a>
<a class="danger" @click="handleDeleteUser(record, index)">删除</a>
</span>
</a-table>
</common-card>
@@ -133,7 +143,7 @@
size="middle"
bordered
rowKey="id"
:scroll="{x: true,y:200}"
:scroll="{x: true,y:360}"
:columns="communicationLog.columns"
:dataSource="communicationLog.dataSource"
:pagination="communicationLog.ipagination"
@@ -152,20 +162,24 @@
</common-card>
</a-col>
</a-row>
<!-- 用户信息编辑 -->
<user-info-modal ref="userInfoModal" @ok="loadUserList"/>
</a-spin>
</template>
<script>
import CommonCard from '@comp/CommonCard'
import { addUserInfo, getSysSetting, getUserPage, saveSysSetting } from '@api/systemOverview'
import { dataAcquisitionCycle, dataAcquisitionProtocol } from '@/enums/commonEnums'
import { addUserInfo, delUserInfo, getSysSetting, getUserPage, saveSysSetting } from '@api/systemOverview'
import { dataAcquisitionCycle, dataAcquisitionProtocol, userType } from '@/enums/commonEnums'
import { getRSAPublicKey } from '@/utils/encryption'
import { JSEncrypt } from 'jsencrypt'
import UserInfoModal from '@views/systemOverview/systemSettings/modules/UserInfoModal'
export default {
name: 'SystemSettings',
components: { CommonCard },
components: { UserInfoModal, CommonCard },
data () {
return {
userType,
loading: false,
// 系统设置表单
sysSettingForm: this.$form.createForm(this),
@@ -210,11 +224,11 @@ export default {
scopedSlots: { customRender: 'text' }
},
{
dataIndex: 'roleTxt',
dataIndex: 'userType_dictText',
title: '用户类别',
align: 'center',
width: '20%',
scopedSlots: { customRender: 'text' }
scopedSlots: { customRender: 'userType' }
},
{
dataIndex: 'orgCodeTxt',
@@ -238,7 +252,7 @@ export default {
pageSize: 10,
pageSizeOptions: ['10', '20', '30'],
showTotal: (total, range) => {
return range[0] + '-' + range[1] + ' 共' + total + '条'
return '共' + total + '条'
},
showQuickJumper: true,
showSizeChanger: true,
@@ -254,28 +268,94 @@ export default {
communicationLog: {
columns: [
{
dataIndex: 'deviceStatus_dictText',
dataIndex: 'time',
title: '时间',
align: 'center',
width: '20%',
width: '30%',
scopedSlots: { customRender: 'text' }
},
{
dataIndex: 'deviceName',
dataIndex: 'msgType',
title: '消息类型',
align: 'center',
width: '20%',
width: '30%',
scopedSlots: { customRender: 'text' }
},
{
dataIndex: 'deviceSn',
dataIndex: 'msgContent',
title: '消息内容',
align: 'center',
width: '20%',
width: '40%',
scopedSlots: { customRender: 'text' }
}
],
dataSource: []
dataSource: [
{
id: '1',
time: '2024-3-15 13:55:26',
msgType: 'Host-》Device',
msgContent: '01 03 00 00 00 05 89 C5'
},
{
id: '2',
time: '2024-3-15 13:55:26',
msgType: 'Device-》Host',
msgContent: '01 03 00 00 00 05 89 C5'
},
{
id: '3',
time: '2024-3-15 13:55:26',
msgType: 'Host-》Device',
msgContent: '01 03 00 00 00 05 89 C5'
},
{
id: '4',
time: '2024-3-15 13:55:26',
msgType: 'Device-》Host',
msgContent: '01 03 00 00 00 05 89 C5'
},
{
id: '5',
time: '2024-3-15 13:55:26',
msgType: 'Host-》Device',
msgContent: '01 03 00 00 00 05 89 C5'
},
{
id: '6',
time: '2024-3-15 13:55:26',
msgType: 'Device-》Host',
msgContent: '01 03 00 00 00 05 89 C5'
},
{
id: '7',
time: '2024-3-15 13:55:26',
msgType: 'Host-》Device',
msgContent: '01 03 00 00 00 05 89 C5'
},
{
id: '8',
time: '2024-3-15 13:55:26',
msgType: 'Device-》Host',
msgContent: '01 03 00 00 00 05 89 C5'
}
],
/* 分页参数 */
ipagination: {
current: 1,
pageSize: 10,
pageSizeOptions: ['1', '10', '20', '30'],
showTotal: (total, range) => {
return '共' + total + '条'
},
showQuickJumper: true,
showSizeChanger: true,
total: 0
},
/* 排序参数 */
isorter: {
column: 'createTime',
order: 'desc'
}
},
// 公钥
rsaPublicKey: '',
@@ -361,11 +441,12 @@ export default {
this.userInfo.loading = false
})
},
handleUserInfoTableChange () {
console.log()
handleUserInfoTableChange (pagination) {
this.userInfo.ipagination = pagination
this.loadUserList()
},
handleCommunicationLogTableChange () {
console.log()
handleCommunicationLogTableChange (pagination) {
this.communicationLog.ipagination = pagination
},
// 添加用户
async handleAddUser () {
@@ -406,6 +487,34 @@ export default {
} else {
callback(new Error('您的手机号码格式不正确'))
}
},
// 编辑用户
handleEditUser (record) {
// this.$refs.userInfoModal.edit(record)
},
// 删除用户
handleDeleteUser (record) {
const { id } = record
this.$confirm({
title: '确认删除',
content: '确定要删除此条数据吗?',
onOk: () => {
delUserInfo({ id }).then((res) => {
if (res.success) {
this.$message.success(res.message)
// 判断当前删除的数据是否是最后一页的最后一条数据,如果是的话页码减一
if (this.userInfo.ipagination.current > 1 && ((this.userInfo.ipagination.current - 1) * this.userInfo.ipagination.pageSize) + 1 === this.userInfo.ipagination.total) {
this.userInfo.ipagination.current -= 1
}
this.loadData()
} else {
this.$message.warning(res.message)
}
}).finally(() => {
this.loadUserList()
})
}
})
}
}
}
@@ -62,7 +62,7 @@
<!-- 泵型图 -->
<div class="pump-type mb-20">
<div class="pump-type-title">泵型常规泵</div>
<div class="pump-type-remarks">备注-----</div>
<div class="pump-type-remarks">备注备注备注备注备注</div>
</div>
<common-card-info :left-list="data.oilWellProductionDataLeft"
:right-list="data.oilWellProductionDataRight"/>
@@ -163,13 +163,14 @@
</template>
<span slot="action" slot-scope="text, record">
<a @click="handleConfirm(record)" class="confirm mr-10">确认</a>
<a @click="handleConfirm(record)" :disabled="record.disabledConfirm" class="confirm mr-10">确认</a>
<a @click="handleShow(record)" class="show">查看</a>
</span>
</a-table>
<a-table
bordered
class="right-fixed-table"
style='display: inline-block; width: 100px'
ref="table"
size="middle"
@@ -186,7 +187,7 @@
:dataSource="this.dataSource.length ? [{}]: []"
:pagination="false">
<div slot="actionBatch" class="action-batch">
<a href='javascript:' class='all-alarms'></a>
<a href='javascript:' @click="handleAllAlarms" class='all-alarms'></a>
</div>
</a-table>
</div>
@@ -217,56 +218,56 @@ export default {
singleWellList: [],
columns: [
{
dataIndex: 'a',
dataIndex: 'alarmTime',
title: '报警时间',
align: 'center',
width: '10%',
scopedSlots: { customRender: 'text' }
},
{
dataIndex: 'b',
dataIndex: 'recoveryTime',
title: '恢复时间',
align: 'center',
width: '10%',
scopedSlots: { customRender: 'text' }
},
{
dataIndex: 'c',
dataIndex: 'alarmDeviceA',
title: '报警设备',
align: 'center',
width: '10%',
scopedSlots: { customRender: 'text' }
},
{
dataIndex: 'd',
dataIndex: 'alarmDeviceB',
title: '报警设备',
align: 'center',
width: '10%',
scopedSlots: { customRender: 'text' }
},
{
dataIndex: 'e',
dataIndex: 'alarmDesc',
title: '报警描述',
align: 'center',
width: '20%',
scopedSlots: { customRender: 'text' }
},
{
dataIndex: 'f',
dataIndex: 'alarmType',
title: '报警类别',
align: 'center',
width: '10%',
scopedSlots: { customRender: 'text' }
},
{
dataIndex: 'g',
dataIndex: 'confirmTime',
title: '确认时间',
align: 'center',
width: '10%',
scopedSlots: { customRender: 'text' }
},
{
dataIndex: 'h',
dataIndex: 'confirmUser',
title: '确认人',
align: 'center',
width: '10%',
@@ -305,7 +306,107 @@ export default {
// width: 100
// }
],
dataSource: new Array(10).fill(0).map((_, i) => ({ id: i + '' })),
dataSource: [
{
id: '1',
alarmTime: '2022-02-10 19:48:30',
recoveryTime: '2022-02-10 19:58:30',
alarmDeviceA: '西平236-76',
alarmDeviceB: '收球桶压力:0.53MPa',
alarmDesc: '报警恢复:西平236-76油压低报警,报警值(1.3MPa',
alarmType: '油套压报警',
confirmTime: '2022-02-10 19:58:30',
confirmUser: '王某某'
},
{
id: '2',
alarmTime: '2022-02-10 19:48:30',
recoveryTime: '2022-02-10 19:58:30',
alarmDeviceA: '西平236-76',
alarmDeviceB: '收球桶压力:0.53MPa',
alarmDesc: '西平236-76油压低报警,报警值(1.3MPa',
alarmType: '油套压报警',
confirmTime: '2022-02-10 19:58:30',
confirmUser: '王某某'
},
{
id: '3',
alarmTime: '2022-02-10 19:48:30',
recoveryTime: '2022-02-10 19:58:30',
alarmDeviceA: '西平236-76',
alarmDeviceB: '收球桶压力:0.53MPa',
alarmDesc: '西平236-76油压低报警,报警值(1.3MPa',
alarmType: '油套压报警',
confirmTime: '2022-02-10 19:58:30',
confirmUser: '王某某'
},
{
id: '4',
alarmTime: '2022-02-10 19:48:30',
recoveryTime: '2022-02-10 19:58:30',
alarmDeviceA: '西平236-76',
alarmDeviceB: '收球桶压力:0.53MPa',
alarmDesc: '报警恢复:西平236-76油压低报警,报警值(1.3MPa',
alarmType: '油套压报警',
confirmTime: '2022-02-10 19:58:30',
confirmUser: '王某某'
},
{
id: '5',
alarmTime: '2022-02-10 19:48:30',
recoveryTime: '2022-02-10 19:58:30',
alarmDeviceA: '西平236-76',
alarmDeviceB: '收球桶压力:0.53MPa',
alarmDesc: '西平236-76油压低报警,报警值(1.3MPa',
alarmType: '油套压报警',
confirmTime: '2022-02-10 19:58:30',
confirmUser: '王某某'
},
{
id: '6',
alarmTime: '2022-02-10 19:48:30',
recoveryTime: '2022-02-10 19:58:30',
alarmDeviceA: '西平236-76',
alarmDeviceB: '收球桶压力:0.53MPa',
alarmDesc: '西平236-76油压低报警,报警值(1.3MPa',
alarmType: '油套压报警',
confirmTime: '2022-02-10 19:58:30',
confirmUser: '王某某'
},
{
id: '7',
alarmTime: '2022-02-10 19:48:30',
recoveryTime: '2022-02-10 19:58:30',
alarmDeviceA: '西平236-76',
alarmDeviceB: '收球桶压力:0.53MPa',
alarmDesc: '报警恢复:西平236-76油压低报警,报警值(1.3MPa',
alarmType: '油套压报警',
confirmTime: '2022-02-10 19:58:30',
confirmUser: '王某某'
},
{
id: '8',
alarmTime: '2022-02-10 19:48:30',
recoveryTime: '2022-02-10 19:58:30',
alarmDeviceA: '西平236-76',
alarmDeviceB: '收球桶压力:0.53MPa',
alarmDesc: '西平236-76油压低报警,报警值(1.3MPa',
alarmType: '油套压报警',
confirmTime: '2022-02-10 19:58:30',
confirmUser: '王某某'
},
{
id: '9',
alarmTime: '2022-02-10 19:48:30',
recoveryTime: '2022-02-10 19:58:30',
alarmDeviceA: '西平236-76',
alarmDeviceB: '收球桶压力:0.53MPa',
alarmDesc: '西平236-76油压低报警,报警值(1.3MPa',
alarmType: '油套压报警',
confirmTime: '2022-02-10 19:58:30',
confirmUser: '王某某'
}
],
defaultId: 'default', // 默认数据的id
// 油井实时数据
oilWellRealTimeData: {},
@@ -362,7 +463,7 @@ export default {
{ label: '日产水量', value: '4.34 m³' },
{ label: '日产液量', value: '19.09 m³' },
{ label: '日产油量', value: '14.75 t' },
{ label: '备注', value: '----' }
{ label: '备注', value: '备注备注备注备注备注' }
],
oilWellProductionDataRight: [
{ label: '用电量', value: '0.00 kw.h' },
@@ -397,11 +498,29 @@ export default {
searchReset () {
},
handleConfirm () {
handleConfirm (record) {
this.$confirm({
title: '确认报警',
content: '确定报警该数据吗?',
onOk: function () {
record.disabledConfirm = true
}
})
},
handleShow () {
},
// 全部报警
handleAllAlarms () {
this.$confirm({
title: '确认报警',
content: '确定报警全部数据吗?',
onOk: () => {
this.dataSource.forEach(item => {
item.disabledConfirm = true
})
}
})
},
// 加载实时数据(油井实时参数、实时示功图、载荷分布图)(每10s请求一次)
loadOilWellRealTimeData () {
@@ -897,6 +1016,10 @@ export default {
.confirm:hover {
color: #2BFF82;
}
.confirm[disabled],
.show[disabled] {
color: @text-color-secondary;
}
// 查看
.show,
.show:hover {
@@ -915,4 +1038,7 @@ export default {
height: 100px;
background: url("~@/assets/images/systemOverview/wellheadDataMonitoring/all-alarms-btn.png");
}
.right-fixed-table /deep/ th {
height: 40px;
}
</style>