Compare commits

..

No commits in common. "312ed7ecb7afd47a641093264a02d768fadd7fb2" and "b367bfcbe479292e0b38e338a43d519a4fc97cec" have entirely different histories.

11 changed files with 81 additions and 86 deletions

View File

@ -1,3 +1,10 @@
/*
* @Author: zhp
* @Date: 2024-01-29 17:05:25
* @LastEditTime: 2024-01-29 17:05:25
* @LastEditors: zhp
* @Description:
*/
/** /**
* 发起websocket请求函数 * 发起websocket请求函数
* @param {string} url ws连接地址 * @param {string} url ws连接地址
@ -42,7 +49,7 @@ export function WsConnect(url, agentData, successCallback, errCallback) {
this.lockReconnect = true; this.lockReconnect = true;
this.wsCreateHandler && clearTimeout(this.wsCreateHandler); this.wsCreateHandler && clearTimeout(this.wsCreateHandler);
// 关闭心跳检查 // 关闭心跳检查
heartCheck.stop(); // heartCheck.stop();
} }
}; };
const initWsEventHandle = () => { const initWsEventHandle = () => {
@ -50,13 +57,13 @@ export function WsConnect(url, agentData, successCallback, errCallback) {
// 连接成功 // 连接成功
this.wsObj.onopen = (event) => { this.wsObj.onopen = (event) => {
onWsOpen(event); onWsOpen(event);
heartCheck.start(); // heartCheck.start();
}; };
// 监听服务器端返回的信息 // 监听服务器端返回的信息
this.wsObj.onmessage = (event) => { this.wsObj.onmessage = (event) => {
onWsMessage(event); onWsMessage(event);
heartCheck.start(); // heartCheck.start();
}; };
this.wsObj.onclose = (event) => { this.wsObj.onclose = (event) => {
@ -123,7 +130,7 @@ export function WsConnect(url, agentData, successCallback, errCallback) {
if (this.lockReconnect) { if (this.lockReconnect) {
return; return;
} }
writeToScreen("5秒后重连"); writeToScreen("3秒后重连");
this.lockReconnect = true; this.lockReconnect = true;
// 没连接上会一直重连,设置延迟避免请求过多 // 没连接上会一直重连,设置延迟避免请求过多
this.wsCreateHandler && clearTimeout(this.wsCreateHandler); this.wsCreateHandler && clearTimeout(this.wsCreateHandler);
@ -132,40 +139,10 @@ export function WsConnect(url, agentData, successCallback, errCallback) {
this.createWebSoket(); this.createWebSoket();
this.lockReconnect = false; this.lockReconnect = false;
writeToScreen("重连完成"); writeToScreen("重连完成");
}, 5000); }, 3000);
}; };
// 心跳检查看看websocket是否还在正常连接中不需要服务端返回单向的 // 心跳检查看看websocket是否还在正常连接中
let _this = this
let heartCheck = {
timeout: 55000,
timeoutObj: null,
// 重启
reset() {
clearTimeout(this.timeoutObj);
this.start();
},
// 停止
stop() {
clearTimeout(this.timeoutObj);
},
// 开启定时器
start() {
this.timeoutObj && clearTimeout(this.timeoutObj);
this.timeoutObj = setTimeout(() => {
writeToScreen("心跳检查发送ping到后台");
try {
const datas = { ping: true };
_this.wsObj.send(JSON.stringify(datas));
} catch (err) {
writeToScreen("发送ping异常");
}
}, this.timeout);
},
};
// 心跳检查看看websocket是否还在正常连接中,和服务端通信,双向的)
// let heartCheck = { // let heartCheck = {
// timeout: 15000, // timeout: 15000,
// timeoutObj: null, // timeoutObj: null,
@ -190,7 +167,7 @@ export function WsConnect(url, agentData, successCallback, errCallback) {
// writeToScreen("心跳检查发送ping到后台"); // writeToScreen("心跳检查发送ping到后台");
// try { // try {
// const datas = { ping: true }; // const datas = { ping: true };
// _this.wsObj.send(JSON.stringify(datas)); // this.wsObj.send(JSON.stringify(datas));
// } catch (err) { // } catch (err) {
// writeToScreen("发送ping异常"); // writeToScreen("发送ping异常");
// } // }

View File

@ -36,8 +36,7 @@ const tableProps = [
}, },
{ {
prop: 'objCode', prop: 'objCode',
label: '对象编码', label: '对象编码'
showOverflowtooltip: true
}, },
{ {
prop: 'plcTableName', prop: 'plcTableName',

View File

@ -46,8 +46,7 @@ const tableProps = [
prop: 'tableName', prop: 'tableName',
label: '能源表名', label: '能源表名',
filter: publicFormatter('table_name'), filter: publicFormatter('table_name'),
minWidth: 110, minWidth: 110
showOverflowtooltip: true
}, },
{ {
prop: 'recordTime', prop: 'recordTime',

View File

@ -20,18 +20,15 @@ import * as XLSX from 'xlsx/xlsx.mjs'
const tableProps = [ const tableProps = [
{ {
prop: 'objName', prop: 'objName',
label: '统计对象', label: '统计对象'
showOverflowtooltip: true
}, },
{ {
prop: 'objCode', prop: 'objCode',
label: '对象编码', label: '对象编码'
showOverflowtooltip: true
}, },
{ {
prop: 'energyTypeName', prop: 'energyTypeName',
label: '能源类型', label: '能源类型'
showOverflowtooltip: true
}, },
{ {
prop: 'startValue', prop: 'startValue',

View File

@ -2,23 +2,46 @@
<div class="app-container"> <div class="app-container">
<!-- 搜索工作栏 --> <!-- 搜索工作栏 -->
<search-bar :formConfigs="formConfig" ref="searchBarForm" @headBtnClick="buttonClick" /> <search-bar
:formConfigs="formConfig"
ref="searchBarForm"
@headBtnClick="buttonClick"
/>
<!-- 列表 --> <!-- 列表 -->
<base-table :page="queryParams.pageNo" :limit="queryParams.pageSize" :table-props="tableProps" :table-data="list" <base-table
:max-height="tableH"> :page="queryParams.pageNo"
<method-btn v-if="tableBtn.length" slot="handleBtn" :width="160" label="操作" :method-list="tableBtn" :limit="queryParams.pageSize"
@clickBtn="handleClick" /> :table-props="tableProps"
:table-data="list"
:max-height="tableH"
>
<method-btn
v-if="tableBtn.length"
slot="handleBtn"
:width="160"
label="操作"
:method-list="tableBtn"
@clickBtn="handleClick"
/>
</base-table> </base-table>
<pagination :page.sync="queryParams.pageNo" :limit.sync="queryParams.pageSize" :total="total" <pagination
@pagination="getList" /> :page.sync="queryParams.pageNo"
:limit.sync="queryParams.pageSize"
:total="total"
@pagination="getList"
/>
<!-- 新增 --> <!-- 新增 -->
<base-dialog :dialogTitle="addOrEditTitle" :dialogVisible="centervisible" @cancel="handleCancel" <base-dialog
@confirm="handleConfirm" :before-close="handleCancel"> :dialogTitle="addOrEditTitle"
:dialogVisible="centervisible"
@cancel="handleCancel"
@confirm="handleConfirm"
:before-close="handleCancel"
>
<energy-statistics-add ref="energyStatistics" @successSubmit="successSubmit" /> <energy-statistics-add ref="energyStatistics" @successSubmit="successSubmit" />
</base-dialog> </base-dialog>
<!-- 参数绑定/查看 --> <!-- 参数绑定/查看 -->
<energy-statistics-det ref="plcParam" @closeDrawer="closeDrawer" <energy-statistics-det ref="plcParam" @closeDrawer="closeDrawer" :energyTypeList="energyTypeList"></energy-statistics-det>
:energyTypeList="energyTypeList"></energy-statistics-det>
</div> </div>
</template> </template>
@ -40,7 +63,7 @@ const tableProps = [
showOverflowtooltip: true showOverflowtooltip: true
}, },
{ {
prop: 'type', prop: 'type',
label: '统计类型', label: '统计类型',
filter: publicFormatter('statistic_type') filter: publicFormatter('statistic_type')
}, },
@ -58,7 +81,7 @@ const tableProps = [
} }
] ]
export default { export default {
name: "EnergyStatistics", name: "energyStatistics",
components: { EnergyStatisticsAdd, EnergyStatisticsDet }, components: { EnergyStatisticsAdd, EnergyStatisticsDet },
data() { data() {
return { return {
@ -89,26 +112,26 @@ export default {
tableProps, tableProps,
tableBtn: [ tableBtn: [
this.$auth.hasPermi('monitoring:energy-statistics:bind') this.$auth.hasPermi('monitoring:energy-statistics:bind')
? { ? {
type: 'connect', type: 'connect',
btnName: '绑定' btnName: '绑定'
} }
: undefined, : undefined,
{ {
type: 'detail', type: 'detail',
btnName: '详情' btnName: '详情'
}, },
this.$auth.hasPermi('monitoring:energy-statistics:update') this.$auth.hasPermi('monitoring:energy-statistics:update')
? { ? {
type: 'edit', type: 'edit',
btnName: '编辑' btnName: '编辑'
} }
: undefined, : undefined,
this.$auth.hasPermi('monitoring:energy-statistics:delete') this.$auth.hasPermi('monitoring:energy-statistics:delete')
? { ? {
type: 'delete', type: 'delete',
btnName: '删除' btnName: '删除'
} }
: undefined : undefined
].filter((v) => v), ].filter((v) => v),
tableH: this.tableHeight(260), tableH: this.tableHeight(260),
@ -201,13 +224,13 @@ export default {
}, },
/** 删除按钮操作 */ /** 删除按钮操作 */
handleDelete(row) { handleDelete(row) {
this.$modal.confirm('是否确认删除方案名称为"' + row.name + '"的数据项?').then(function () { this.$modal.confirm('是否确认删除方案名称为"' + row.name + '"的数据项?').then(function() {
return deleteEnergyStatistics(row.id); return deleteEnergyStatistics(row.id);
}).then(() => { }).then(() => {
this.queryParams.pageNo = 1; this.queryParams.pageNo = 1;
this.getList(); this.getList();
this.$modal.msgSuccess("删除成功"); this.$modal.msgSuccess("删除成功");
}).catch(() => { }); }).catch(() => {});
}, },
closeDrawer() { closeDrawer() {
this.getList() this.getList()

View File

@ -1,7 +1,7 @@
<!-- <!--
* @Author: zhp * @Author: zhp
* @Date: 2024-01-24 15:15:24 * @Date: 2024-01-24 15:15:24
* @LastEditTime: 2024-03-27 09:27:23 * @LastEditTime: 2024-03-26 17:56:11
* @LastEditors: zhp * @LastEditors: zhp
* @Description: * @Description:
--> -->
@ -16,9 +16,9 @@
</el-date-picker> </el-date-picker>
</el-form-item> </el-form-item>
<el-form-item> <el-form-item>
<el-button v-if="this.$auth.hasPermi('base:report-auto-original-glass:query')" type="primary" size="small" <el-button v-if="this.$auth.hasPermi('report:glass-month:query')" type="primary" size="small"
@click="getDataList">查询</el-button> @click="getDataList">查询</el-button>
<el-button v-if="this.$auth.hasPermi('report:glass-day:export')" type="primary" size="small" plain <el-button v-if="this.$auth.hasPermi('report:glass-month:export')" type="primary" size="small" plain
@click="handleExport">导出</el-button> @click="handleExport">导出</el-button>
</el-form-item> </el-form-item>
</el-form> </el-form>

View File

@ -1,7 +1,7 @@
<!-- <!--
* @Author: Do not edit * @Author: Do not edit
* @Date: 2023-12-13 14:10:04 * @Date: 2023-12-13 14:10:04
* @LastEditTime: 2024-03-27 09:22:51 * @LastEditTime: 2024-03-22 09:45:23
* @LastEditors: zhp * @LastEditors: zhp
* @Description: * @Description:
--> -->
@ -206,10 +206,12 @@ const cols = [
}, },
methods: { methods: {
handleReturn() { handleReturn() {
// this.disabled = true
this.edit = false this.edit = false
console.log(this.$parent.getDataList());
}, },
handleChange(e) { handleChange(e) {
// console.log(q)
console.log(e);
}, },
updateData() { updateData() {
let obj = {} let obj = {}

View File

@ -7,7 +7,7 @@
</el-date-picker> </el-date-picker>
</el-form-item> </el-form-item>
<el-form-item> <el-form-item>
<el-button v-if="this.$auth.hasPermi('base:report-auto-original-glass:query')" type="primary" size="small" <el-button v-if="this.$auth.hasPermi('report:glass-month:query')" type="primary" size="small"
@click="getDataList">查询</el-button> @click="getDataList">查询</el-button>
<el-button v-if="this.$auth.hasPermi('report:glass-month:export')" type="primary" size="small" plain <el-button v-if="this.$auth.hasPermi('report:glass-month:export')" type="primary" size="small" plain
@click="handleExport">导出</el-button> @click="handleExport">导出</el-button>

View File

@ -14,7 +14,7 @@
</el-date-picker> </el-date-picker>
</el-form-item> </el-form-item>
<el-form-item> <el-form-item>
<el-button v-if="this.$auth.hasPermi('base:report-auto-original-glass:query')" type="primary" size="small" <el-button v-if="this.$auth.hasPermi('report:glass-weekly:query')" type="primary" size="small"
@click="getDataList">查询</el-button> @click="getDataList">查询</el-button>
<el-button v-if="this.$auth.hasPermi('report:glass-weekly:export')" type="primary" size="small" plain <el-button v-if="this.$auth.hasPermi('report:glass-weekly:export')" type="primary" size="small" plain
@click="handleExport">导出</el-button> @click="handleExport">导出</el-button>

View File

@ -9,7 +9,7 @@
</el-date-picker> </el-date-picker>
</el-form-item> </el-form-item>
<el-form-item> <el-form-item>
<el-button v-if="this.$auth.hasPermi('base:report-auto-original-glass:query')" type="primary" size="small" <el-button v-if="this.$auth.hasPermi('report:glass-year:query')" type="primary" size="small"
@click="getDataList">查询</el-button> @click="getDataList">查询</el-button>
<el-button v-if="this.$auth.hasPermi('report:glass-year:export')" type="primary" size="small" plain <el-button v-if="this.$auth.hasPermi('report:glass-year:export')" type="primary" size="small" plain
@click="handleExport">导出</el-button> @click="handleExport">导出</el-button>

View File

@ -1,7 +1,7 @@
<!-- <!--
* @Author: zhp * @Author: zhp
* @Date: 2023-12-12 13:45:25 * @Date: 2023-12-12 13:45:25
* @LastEditTime: 2024-03-27 09:21:00 * @LastEditTime: 2024-03-26 09:41:07
* @LastEditors: zhp * @LastEditors: zhp
* @Description: * @Description:
--> -->
@ -456,8 +456,6 @@ export default {
handleReturn() { handleReturn() {
this.disabled = true this.disabled = true
this.isSave = false this.isSave = false
this.getDataList()
}, },
format(shijianchuo) { format(shijianchuo) {
//shijianchuoparseInt //shijianchuoparseInt