feat: 远程调度-厂界在线页面前后端

This commit is contained in:
LokerL 2024-10-20 13:38:57 +08:00
parent 1c6e360d91
commit be99d7e3e0
15 changed files with 1012 additions and 369 deletions

View File

@ -8,6 +8,7 @@ import com.ruoyi.framework.web.domain.AjaxResult;
import com.ruoyi.framework.web.page.TableDataInfo; import com.ruoyi.framework.web.page.TableDataInfo;
import com.ruoyi.project.oil.domain.OilDevice; import com.ruoyi.project.oil.domain.OilDevice;
import com.ruoyi.project.oil.domain.OilDeviceDetail; import com.ruoyi.project.oil.domain.OilDeviceDetail;
import com.ruoyi.project.oil.domain.monitor.ThDevice;
import com.ruoyi.project.oil.service.IOilDeviceService; import com.ruoyi.project.oil.service.IOilDeviceService;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
@ -37,6 +38,12 @@ public class OilDeviceController extends BaseController {
private IOilDeviceService oilDeviceService; private IOilDeviceService oilDeviceService;
@GetMapping("/thList")
public TableDataInfo list(ThDevice thDevice) {
startPage();
List<ThDevice> list = oilDeviceService.selectDeviceList(thDevice);
return getDataTable(list);
}
/** /**

View File

@ -140,6 +140,43 @@ public class ThDevice extends BaseEntity {
this.gangqu = gangqu; this.gangqu = gangqu;
} }
private String p;
private String pp;
private String ppp;
private String bjyz;
public String getP() {
return p;
}
public void setP(String p) {
this.p = p;
}
public String getPp() {
return pp;
}
public void setPp(String pp) {
this.pp = pp;
}
public String getPpp() {
return ppp;
}
public void setPpp(String ppp) {
this.ppp = ppp;
}
public String getBjyz() {
return bjyz;
}
public void setBjyz(String bjyz) {
this.bjyz = bjyz;
}
/** /**
* 单位 * 单位
*/ */

View File

@ -21,6 +21,13 @@ public interface ThDeviceMapper {
*/ */
List<ThDevice> selectAllDeviceListByDeptId(Long deptId); List<ThDevice> selectAllDeviceListByDeptId(Long deptId);
/**
* 查询设备列表
* @param thDevice 设备
* @return 设备列表
*/
List<ThDevice> selectDeviceList(ThDevice thDevice);
} }

View File

@ -2,6 +2,7 @@ package com.ruoyi.project.oil.service;
import com.ruoyi.project.oil.domain.OilDevice; import com.ruoyi.project.oil.domain.OilDevice;
import com.ruoyi.project.oil.domain.OilDeviceDetail; import com.ruoyi.project.oil.domain.OilDeviceDetail;
import com.ruoyi.project.oil.domain.monitor.ThDevice;
import java.util.List; import java.util.List;
@ -12,6 +13,9 @@ import java.util.List;
* @date 2023-07-08 * @date 2023-07-08
*/ */
public interface IOilDeviceService { public interface IOilDeviceService {
List<ThDevice> selectDeviceList(ThDevice thDevice);
/** /**
* 查询检测设备 * 查询检测设备
* *

View File

@ -4,7 +4,9 @@ import com.ruoyi.common.utils.SecurityUtils;
import com.ruoyi.framework.aspectj.lang.annotation.DataScope; import com.ruoyi.framework.aspectj.lang.annotation.DataScope;
import com.ruoyi.project.oil.domain.OilDevice; import com.ruoyi.project.oil.domain.OilDevice;
import com.ruoyi.project.oil.domain.OilDeviceDetail; import com.ruoyi.project.oil.domain.OilDeviceDetail;
import com.ruoyi.project.oil.domain.monitor.ThDevice;
import com.ruoyi.project.oil.mapper.OilDeviceMapper; import com.ruoyi.project.oil.mapper.OilDeviceMapper;
import com.ruoyi.project.oil.mapper.ThDeviceMapper;
import com.ruoyi.project.oil.service.IOilDeviceService; import com.ruoyi.project.oil.service.IOilDeviceService;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
@ -30,9 +32,21 @@ public class OilDeviceServiceImpl implements IOilDeviceService {
@Autowired @Autowired
private OilDeviceMapper oilDeviceMapper; private OilDeviceMapper oilDeviceMapper;
@Autowired
private ThDeviceMapper thDeviceMapper;
@Autowired @Autowired
private JdbcTemplate jdbcTemplate; private JdbcTemplate jdbcTemplate;
/**
* 查询检测设备列表
*
*/
@Override
public List<ThDevice> selectDeviceList(ThDevice thDevice) {
return thDeviceMapper.selectDeviceList(thDevice);
}
/** /**
* 查询检测设备 * 查询检测设备
* *

View File

@ -1,6 +1,8 @@
package com.ruoyi.project.system.controller; package com.ruoyi.project.system.controller;
import java.util.List; import java.util.List;
import com.ruoyi.framework.aspectj.lang.annotation.DataScope;
import org.apache.commons.lang3.ArrayUtils; import org.apache.commons.lang3.ArrayUtils;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize; import org.springframework.security.access.prepost.PreAuthorize;
@ -39,6 +41,7 @@ public class SysDeptController extends BaseController
*/ */
@PreAuthorize("@ss.hasPermi('system:dept:list')") @PreAuthorize("@ss.hasPermi('system:dept:list')")
@GetMapping("/list") @GetMapping("/list")
@DataScope(deptAlias="d", permission="4")
public AjaxResult list(SysDept dept) public AjaxResult list(SysDept dept)
{ {
List<SysDept> depts = deptService.selectDeptList(dept); List<SysDept> depts = deptService.selectDeptList(dept);

View File

@ -3,6 +3,11 @@
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd"> "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.ruoyi.project.oil.mapper.ThDeviceMapper"> <mapper namespace="com.ruoyi.project.oil.mapper.ThDeviceMapper">
<parameterMap id="BaseParameterMap" type="com.ruoyi.project.oil.domain.monitor.ThDevice">
<parameter property="sn" jdbcType="VARCHAR"/>
<parameter property="name" jdbcType="VARCHAR"/>
<parameter property="deptId" jdbcType="BIGINT"/>
</parameterMap>
<resultMap id="BaseResultMap" type="com.ruoyi.project.oil.domain.monitor.ThDevice"> <resultMap id="BaseResultMap" type="com.ruoyi.project.oil.domain.monitor.ThDevice">
<id property="id" column="id" jdbcType="BIGINT"/> <id property="id" column="id" jdbcType="BIGINT"/>
@ -20,7 +25,11 @@
<result property="longitude" column="longitude" jdbcType="VARCHAR"/> <result property="longitude" column="longitude" jdbcType="VARCHAR"/>
<result property="latitude" column="latitude" jdbcType="VARCHAR"/> <result property="latitude" column="latitude" jdbcType="VARCHAR"/>
<result property="deptName" column="dept_name" jdbcType="VARCHAR"/> <result property="deptName" column="dept_name" jdbcType="VARCHAR"/>
<result property="bjyz" column="bjyz" jdbcType="VARCHAR"/>
<result property="gangqu" column="gangqu" jdbcType="VARCHAR"/> <result property="gangqu" column="gangqu" jdbcType="VARCHAR"/>
<result property="p" column="p" jdbcType="VARCHAR"/>
<result property="pp" column="pp" jdbcType="VARCHAR"/>
<result property="ppp" column="ppp" jdbcType="VARCHAR"/>
</resultMap> </resultMap>
<sql id="Base_Column_List"> <sql id="Base_Column_List">
@ -45,6 +54,45 @@
left join sys_dept pp on p.parent_id = pp.dept_id left join sys_dept pp on p.parent_id = pp.dept_id
</sql> </sql>
<select id="selectDeviceList" resultMap="BaseResultMap" parameterType="com.ruoyi.project.oil.domain.monitor.ThDevice">
select d.id,
d.sn,
d.name,
d.create_by,
d.create_time,
d.status,
d.note,
d.file_url,
d.update_by,
d.update_time,
d.address,
d.dept_id,
d.longitude,
d.latitude,
d.bjyz,
p.dept_name as "p",
pp.dept_name as "pp",
ppp.dept_name as "ppp"
from th_device d
LEFT JOIN sys_dept p ON d.dept_id = p.dept_id
LEFT JOIN sys_dept pp ON p.parent_id = pp.dept_id
LEFT JOIN sys_dept ppp ON pp.parent_id = ppp.dept_id
<where>
<if test="deptId != null and deptId != ''">
AND d.dept_id IN (SELECT dept_id
FROM sys_dept START WITH dept_id = #{deptId}
CONNECT BY PRIOR dept_id = parent_id)
</if>
<if test="sn != null and sn != ''">
AND d.sn like concat(concat('%',#{sn}),'%')
</if>
<if test="name != null and name != ''">
AND d.name like concat(concat('%',#{name}),'%')
</if>
</where>
order by d.id desc
</select>
<select id="selectDeviceListByDeptId" parameterType="long" resultMap="BaseResultMap"> <select id="selectDeviceListByDeptId" parameterType="long" resultMap="BaseResultMap">
<include refid="Base_Column_List"/> <include refid="Base_Column_List"/>
where d.dept_id = #{deptId} where d.dept_id = #{deptId}

View File

@ -20,7 +20,6 @@
d.sn, d.sn,
d.report_time, d.report_time,
d.SBZT, d.SBZT,
d.kcjd,
d.lc, d.lc,
d.dw, d.dw,
d.zt, d.zt,

View File

@ -0,0 +1,9 @@
import request from '@/utils/request'
export function getThList(params) {
return request({
url: '/device/thList',
params: params,
method: 'get',
})
}

View File

@ -87,7 +87,7 @@ export default {
const rootDept = this.deptList[0]; const rootDept = this.deptList[0];
this.firstChildList = rootDept.children; this.firstChildList = rootDept.children;
this.deptId = this.multiple ? this.firstChildList.map(item => item.deptId) : rootDept.deptId; this.deptId = this.multiple ? this.firstChildList.map(item => item.deptId) : rootDept.deptId;
this.$emit("deptChange", this.multiple ? [rootDept] : rootDept); // this.$emit("deptChange", this.multiple ? [rootDept] : rootDept);
} else { } else {
console.error(response); console.error(response);
this.$message.error(response.msg); this.$message.error(response.msg);

View File

@ -0,0 +1,167 @@
<template>
<el-dialog
title="下发通知"
:visible.sync="openConfig1"
:before-close="handleClose"
>
<div style="display: inline-flex; height: 30px; line-height: 30px">
<el-button class="agreeButton" style="width: 120px" @click="chooseUser1()"
>选择联系人</el-button
>
<div style="margin-right: 5px">
<span style="margin-left: 2px" v-for="item in userList">{{
item.nickName
}}</span>
</div>
</div>
<div style="margin: 10px">
<el-input
type="textarea"
:rows="2"
placeholder="请输入消息内容..."
v-model="shareContent"
>
</el-input>
</div>
<user-select
v-if="isShowUser"
:isShowUser="isShowUser"
@closeUser="closeUser"
@chooseUser="chooseUser"
/>
<div style="margin-left: 5px; height: 50px">
<el-checkbox v-model="isSendPhone">同时发送短信</el-checkbox>
</div>
<div style="margin-left: 5px; height: 50px">
<el-button class="agreeButton" @click="sendMsg">发送</el-button>
</div>
</el-dialog>
</template>
<script>
import bus from "@/utils/bus.js";
import { sendMessage } from "@/api/home";
import { addAlarm } from "@/api/demostrate/monitor";
import UserSelect from "@/views/home/components/UserSelect.vue";
export default {
components: { UserSelect },
props: {
shareContent: {
type: String,
default: "",
},
isOpenMsg: {
type: Boolean,
default: false,
},
},
watch: {
isOpenMsg: {
handler(newVal, oldVal) {
this.openConfig1 = newVal;
},
deep: true,
immediate: true,
},
},
data() {
return {
isSendPhone: false,
isShowUser: false,
userList: [],
phoneList: [],
shareContent: "",
openConfig1: false,
};
},
methods: {
sendMsg() {
let readList = [];
this.phoneList = [];
this.userList.forEach((element) => {
readList.push(element.userName);
this.phoneList.push(element.phonenumber);
});
let params = {
phoneList: this.phoneList,
isSendPhone: this.isSendPhone,
readerList: readList,
sendText: this.shareContent,
sendType: "设备报警",
};
sendMessage(params).then((response) => {
if (response.code == 200) {
this.$message.success("消息发送成功!");
}
});
},
closeUser(val) {
this.isShowUser = val;
},
chooseUser1() {
this.isShowUser = true;
},
//
chooseUser(val) {
if (val && val.length < 1) {
this.$message.error("请至少选择一名处理人员!");
this.isShowUser = false;
} else {
this.userList = val;
this.isShowUser = false;
}
},
//
handleClose() {
this.openConfig1 = false;
this.$emit("closeMsg", false);
},
},
mounted() {},
};
</script>
<style lang="scss" scoped>
.title {
padding-left: 20px;
color: #212121;
font-size: 16px;
margin-bottom: 10px;
margin-top: 10px;
background: url("~@/assets/ucs/biaoti.png") no-repeat;
background-position-y: 7px;
}
.agreeButton {
display: inline-block;
line-height: 8px;
width: 80px;
height: 32px;
white-space: nowrap;
cursor: pointer;
color: #ffffff;
-webkit-appearance: none;
text-align: center;
-webkit-box-sizing: border-box;
box-sizing: border-box;
outline: 0;
margin-left: 10px;
-webkit-transition: 0.1s;
transition: 0.1s;
font-weight: 500;
//padding: 12px 20px;
font-size: 14px;
border-radius: 4px;
background-color: #068f5c;
}
.agreeButton:hover {
background: #65a5f9;
border-color: #65a5f9;
color: #fff;
}
</style>

View File

@ -1,181 +1,196 @@
<template> <template>
<el-dialog title="下发通知" :visible.sync="openConfig1" :before-close="handleClose"> <el-dialog
<div style="display: inline-flex; height: 30px; title="下发通知"
line-height: 30px;"> :visible.sync="openConfig1"
<el-button class="agreeButton" style="width: 120px;" @click="chooseUser1()">选择联系人</el-button> :before-close="handleClose"
<div style="margin-right: 5px;"><span style="margin-left:2px;" v-for="item in userList">{{ item.nickName >
}}</span></div> <div style="display: inline-flex; height: 30px; line-height: 30px">
</div> <el-button class="agreeButton" style="width: 120px" @click="chooseUser1()"
<div style="margin:10px"> >选择联系人</el-button
<el-input type="textarea" :rows="2" placeholder="请输入消息内容..." v-model="shareContent"> >
</el-input> <div style="margin-right: 5px">
</div> <span style="margin-left: 2px" v-for="item in userList">{{
item.nickName
}}</span>
</div>
</div>
<div style="margin: 10px">
<el-input
type="textarea"
:rows="2"
placeholder="请输入消息内容..."
v-model="shareContent"
>
</el-input>
</div>
<user-select
<user-select v-if="isShowUser" :isShowUser="isShowUser" @closeUser="closeUser" @chooseUser="chooseUser" /> v-if="isShowUser"
:isShowUser="isShowUser"
@closeUser="closeUser"
@chooseUser="chooseUser"
/>
<div style="margin-left:5px;height: 50px;"> <el-checkbox v-model="isSendPhone">同时发送短信</el-checkbox></div> <div style="margin-left: 5px; height: 50px">
<el-checkbox v-model="isSendPhone">同时发送短信</el-checkbox>
</div>
<div style="margin-left:5px;height: 50px;"> <el-button class="agreeButton" @click="sendMsg">发送</el-button></div> <div style="margin-left: 5px; height: 50px">
</el-dialog> <el-button class="agreeButton" @click="sendMsg">发送</el-button>
</div>
</el-dialog>
</template> </template>
<script> <script>
import bus from '@/utils/bus.js' import bus from "@/utils/bus.js";
import { sendMessage } from "@/api/home"; import { sendMessage } from "@/api/home";
import { addAlarm } from "@/api/demostrate/monitor"; import { addAlarm } from "@/api/demostrate/monitor";
import UserSelect from "@/views/home/components/UserSelect.vue"; import UserSelect from "@/views/home/components/UserSelect.vue";
export default { export default {
components: { UserSelect }, components: { UserSelect },
props: { props: {
deviceInfo: { deviceInfo: {
type: Object, type: Object,
default: {} default: {},
},
isOpenMsg: {
type: Boolean,
default: false
},
}, },
watch: { isOpenMsg: {
isOpenMsg: { type: Boolean,
handler(newVal, oldVal) { default: false,
this.openConfig1 = newVal
},
deep: true,
immediate: true
},
deviceInfo: {
handler(newVal, oldVal) {
this.shareContent = newVal.name + newVal.sn + '存在报警,报警等级为' + newVal.zt + ',请开展设备维护工作!'
},
deep: true,
immediate: true
}
}, },
data() { },
return { watch: {
isSendPhone:false, isOpenMsg: {
isShowUser: false, handler(newVal, oldVal) {
userList: [], this.openConfig1 = newVal;
phoneList:[], },
shareContent: "", deep: true,
openConfig1: false, immediate: true,
}
}, },
methods: { deviceInfo: {
sendMsg() { handler(newVal, oldVal) {
let readList = [] this.shareContent =
this.phoneList=[] newVal.name +
this.userList.forEach(element => { newVal.sn +
readList.push(element.userName) "存在报警,报警等级为" +
this.phoneList.push(element.phonenumber) newVal.zt +
}); ",请开展设备维护工作!";
},
let params = { deep: true,
phoneList :this.phoneList, immediate: true,
isSendPhone:this.isSendPhone, },
//readList: JSON.stringify(readList), },
readerList: readList, data() {
sendText: this.shareContent, return {
sendType: '设备报警' isSendPhone: false,
} isShowUser: false,
sendMessage(params).then(response => { userList: [],
if (response.code == 200) { phoneList: [],
this.$message.success("消息发送成功!") shareContent: "",
openConfig1: false,
};
},
methods: {
sendMsg() {
let readList = [];
this.phoneList = [];
this.userList.forEach((element) => {
readList.push(element.userName);
this.phoneList.push(element.phonenumber);
});
let data = { let params = {
reportId: this.deviceInfo.reportId, phoneList: this.phoneList,
isDeal: '0', isSendPhone: this.isSendPhone,
dealUser: this.userList[0].userName //readList: JSON.stringify(readList),
readerList: readList,
sendText: this.shareContent,
sendType: "设备报警",
};
sendMessage(params).then((response) => {
if (response.code == 200) {
this.$message.success("消息发送成功!");
} let data = {
reportId: this.deviceInfo.reportId,
isDeal: "0",
dealUser: this.userList[0].userName,
};
addAlarm(data).then(res => { addAlarm(data).then((res) => {
if (res.code == 200) { if (res.code == 200) {
this.$message.success("分配修复任务成功!") this.$message.success("分配修复任务成功!");
this.handleClose() this.handleClose();
bus.$emit('msgReaded') bus.$emit("msgReaded");
} else {
this.$message.success("分配修复任务失败!")
}
});
}
});
},
closeUser(val) {
this.isShowUser = val
},
chooseUser1() {
this.isShowUser = true
},
//
chooseUser(val) {
if (val && val.length <1) {
this.$message.error("请至少选择一名处理人员!")
this.isShowUser = false
} else { } else {
this.userList = val this.$message.success("分配修复任务失败!");
this.isShowUser = false
} }
});
},
//
handleClose() {
this.openConfig1 = false
this.$emit('closeMsg', false)
} }
});
},
closeUser(val) {
this.isShowUser = val;
},
chooseUser1() {
this.isShowUser = true;
},
//
chooseUser(val) {
if (val && val.length < 1) {
this.$message.error("请至少选择一名处理人员!");
this.isShowUser = false;
} else {
this.userList = val;
this.isShowUser = false;
}
}, },
mounted() {
} //
handleClose() {
} this.openConfig1 = false;
this.$emit("closeMsg", false);
},
},
mounted() {},
};
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>
.title { .title {
padding-left: 20px; padding-left: 20px;
color: #212121; color: #212121;
font-size: 16px; font-size: 16px;
margin-bottom: 10px; margin-bottom: 10px;
margin-top: 10px; margin-top: 10px;
background: url("~@/assets/ucs/biaoti.png") no-repeat; background: url("~@/assets/ucs/biaoti.png") no-repeat;
background-position-y: 7px; background-position-y: 7px;
} }
.agreeButton { .agreeButton {
display: inline-block; display: inline-block;
line-height: 8px; line-height: 8px;
width: 80px; width: 80px;
height: 32px; height: 32px;
white-space: nowrap; white-space: nowrap;
cursor: pointer; cursor: pointer;
color: #ffffff; color: #ffffff;
-webkit-appearance: none; -webkit-appearance: none;
text-align: center; text-align: center;
-webkit-box-sizing: border-box; -webkit-box-sizing: border-box;
box-sizing: border-box; box-sizing: border-box;
outline: 0; outline: 0;
margin-left: 10px; margin-left: 10px;
-webkit-transition: .1s; -webkit-transition: 0.1s;
transition: .1s; transition: 0.1s;
font-weight: 500; font-weight: 500;
//padding: 12px 20px; //padding: 12px 20px;
font-size: 14px; font-size: 14px;
border-radius: 4px; border-radius: 4px;
background-color: #068f5c; background-color: #068f5c;
} }
.agreeButton:hover { .agreeButton:hover {
background: #65a5f9; background: #65a5f9;
border-color: #65a5f9; border-color: #65a5f9;
color: #FFF; color: #fff;
} }
</style> </style>

View File

@ -1,185 +1,221 @@
<template> <template>
<el-dialog title="选择联系人" :visible.sync="openConfig1" :before-close="handleClose"> <el-dialog
<el-form :model="userParams" size="small" :inline="true" label-width="100px"> title="选择联系人"
<el-form-item label="用户名称" prop="userName"> :visible.sync="openConfig1"
<el-input v-model="userParams.userName" placeholder="请输入用户名称" /> :before-close="handleClose"
</el-form-item> append-to-body
<el-form-item label="用户昵称" prop="nickName"> >
<el-input v-model="userParams.nickName" placeholder="请输入用户昵称" /> <el-form
</el-form-item> :model="userParams"
<el-form-item> size="small"
<el-button class="agreeButton" @click="quetyList()">搜索</el-button> :inline="true"
</el-form-item> label-width="100px"
</el-form> >
<el-form-item label="用户名称" prop="userName">
<el-input v-model="userParams.userName" placeholder="请输入用户名称" />
</el-form-item>
<el-form-item label="用户昵称" prop="nickName">
<el-input v-model="userParams.nickName" placeholder="请输入用户昵称" />
</el-form-item>
<el-form-item>
<el-button class="agreeButton" @click="quetyList()">搜索</el-button>
</el-form-item>
</el-form>
<el-table :data="userList" @selection-change="handleSelectionChange"> <el-table
<el-table-column type="selection" width="55" align="center" /> ref="userTable"
<el-table-column label="用户名称" align="center" prop="userName" /> :data="userList"
<el-table-column label="用户昵称" align="center" prop="nickName" /> @selection-change="handleSelectionChange"
<el-table-column label="企业" align="center" prop="deptName" /> >
<el-table-column label="用户手机号" align="center" prop="phonenumber" /> <el-table-column type="selection" width="55" align="center" />
</el-table> <el-table-column label="用户名称" align="center" prop="userName" />
<pagination style="margin-bottom: 10px;" v-show="total > 0" :total="total" :page.sync="userParams.pageNum" <el-table-column label="用户昵称" align="center" prop="nickName" />
:limit.sync="userParams.pageSize" @pagination="getList" /> <el-table-column label="企业" align="center" prop="deptName" />
<div style="height: 80px; margin: 10px; display: flex; justify-content: center; align-items: center;"> <el-table-column label="用户手机号" align="center" prop="phonenumber" />
<el-button class="agreeButton" @click="confirm">确定</el-button> </el-table>
</div> <pagination
</el-dialog> style="margin-bottom: 10px"
v-show="total > 0"
:total="total"
:page.sync="userParams.pageNum"
:limit.sync="userParams.pageSize"
@pagination="getList"
/>
<div
style="
height: 80px;
margin: 10px;
display: flex;
justify-content: center;
align-items: center;
"
>
<el-button class="agreeButton" @click="confirm">确定</el-button>
</div>
</el-dialog>
</template> </template>
<script> <script>
import { listUser } from "@/api/system/user"; import { listUser } from "@/api/system/user";
export default { export default {
components: {}, components: {},
props: { props: {
isShowUser: { isShowUser: {
type: Boolean, type: Boolean,
default: false default: false,
},
roleType: {
type: String,
default: ''
},
}, },
watch: { roleType: {
isShowUser: { type: String,
handler(newVal, oldVal) { default: "",
this.openConfig1 = newVal
this.getList()
},
deep: true,
immediate: true
},
roleType: {
handler(newVal, oldVal) {
this.userParams.roleType = newVal
},
deep: true,
immediate: true
},
}, },
data() { selectedList: {
return { type: Array,
openConfig1: false, default: [],
userParams: { },
userName: '', },
nickName: '', watch: {
roleType: '', isShowUser: {
pageNum: 1, handler(newVal, oldVal) {
pageSize: 10, this.openConfig1 = newVal;
}, this.getList();
userList: [], },
selectList: [], deep: true,
total: 0, immediate: true,
},
roleType: {
handler(newVal, oldVal) {
this.userParams.roleType = newVal;
},
deep: true,
immediate: true,
},
},
data() {
return {
openConfig1: false,
userParams: {
userName: "",
nickName: "",
roleType: "",
pageNum: 1,
pageSize: 10,
},
userList: [],
selectList: [],
total: 0,
};
},
methods: {
confirm() {
if (this.selectList.length < 1) {
this.$message.error("请选择联系人!");
} else {
this.openConfig1 = false;
this.$emit("chooseUser", this.selectList);
}
},
handleSelectionChange(val) {
this.selectList = val;
},
quetyList() {
listUser(this.userParams).then((response) => {
this.userList = response.rows;
this.total = response.total;
this.handleSelectedList();
});
},
getList() {
listUser(this.addDateRange(this.userParams)).then((response) => {
this.userList = response.rows;
this.total = response.total;
this.handleSelectedList();
});
},
//
handleClose() {
this.openConfig1 = false;
this.$emit("closeUser", false);
},
handleSelectedList() {
this.$nextTick(() => {
if (this.selectedList) {
this.selectedList.forEach((row) => {
const item = this.userList.find((item) => item.userId === row.userId);
this.$refs.userTable.toggleRowSelection(item, true);
});
} }
});
}, },
methods: { },
confirm() { mounted() {},
if (this.selectList.length < 1) { };
this.$message.error("请选择联系人!")
} else {
this.openConfig1 = false
this.$emit('chooseUser', this.selectList)
}
},
handleSelectionChange(val) {
this.selectList = val;
},
quetyList() {
listUser(this.userParams).then(response => {
this.userList = response.rows;
this.total = response.total;
}
);
},
getList() {
listUser(this.addDateRange(this.userParams)).then(response => {
this.userList = response.rows;
this.total = response.total;
}
);
},
//
handleClose() {
this.openConfig1 = false
this.$emit('closeUser', false)
}
},
mounted() {
}
}
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>
.agreeButton { .agreeButton {
display: inline-block; display: inline-block;
line-height: 8px; line-height: 8px;
width: 80px; width: 80px;
height: 32px; height: 32px;
white-space: nowrap; white-space: nowrap;
cursor: pointer; cursor: pointer;
color: #ffffff; color: #ffffff;
-webkit-appearance: none; -webkit-appearance: none;
text-align: center; text-align: center;
-webkit-box-sizing: border-box; -webkit-box-sizing: border-box;
box-sizing: border-box; box-sizing: border-box;
outline: 0; outline: 0;
margin-left: 10px; margin-left: 10px;
-webkit-transition: .1s; -webkit-transition: 0.1s;
transition: .1s; transition: 0.1s;
font-weight: 500; font-weight: 500;
//padding: 12px 20px; //padding: 12px 20px;
font-size: 14px; font-size: 14px;
border-radius: 4px; border-radius: 4px;
background-color: #068f5c; background-color: #068f5c;
} }
.agreeButton:hover { .agreeButton:hover {
background: #65a5f9; background: #65a5f9;
border-color: #65a5f9; border-color: #65a5f9;
color: #FFF; color: #fff;
} }
.title { .title {
padding-left: 20px; padding-left: 20px;
color: #212121; color: #212121;
font-size: 16px; font-size: 16px;
margin-bottom: 10px; margin-bottom: 10px;
margin-top: 10px; margin-top: 10px;
background: url("~@/assets/ucs/biaoti.png") no-repeat; background: url("~@/assets/ucs/biaoti.png") no-repeat;
background-position-y: 7px; background-position-y: 7px;
} }
.agreeButton { .agreeButton {
display: inline-block; display: inline-block;
line-height: 8px; line-height: 8px;
width: 80px; width: 80px;
height: 32px; height: 32px;
white-space: nowrap; white-space: nowrap;
cursor: pointer; cursor: pointer;
color: #ffffff; color: #ffffff;
-webkit-appearance: none; -webkit-appearance: none;
text-align: center; text-align: center;
-webkit-box-sizing: border-box; -webkit-box-sizing: border-box;
box-sizing: border-box; box-sizing: border-box;
outline: 0; outline: 0;
margin-left: 10px; margin-left: 10px;
-webkit-transition: .1s; -webkit-transition: 0.1s;
transition: .1s; transition: 0.1s;
font-weight: 500; font-weight: 500;
//padding: 12px 20px; //padding: 12px 20px;
font-size: 14px; font-size: 14px;
border-radius: 4px; border-radius: 4px;
background-color: #068f5c; background-color: #068f5c;
} }
.agreeButton:hover { .agreeButton:hover {
background: #65a5f9; background: #65a5f9;
border-color: #65a5f9; border-color: #65a5f9;
color: #FFF; color: #fff;
} }
</style> </style>

View File

@ -1,67 +1,165 @@
<template> <template>
<div class="dashboard"> <div class="app-container">
<h1 class="title">厂界在线设备远程调度</h1> <el-form :inline="true" :model="queryParams" ref="form">
<div class="content"> <el-form-item label="选择部门" prop="factoryId">
<DeviceList :devices="devices" @select-device="selectDevice" /> <dept-tree @deptChange="handleDeptChange" style="width: 150px" />
<RemoteControl v-if="selectedDevice" :device="selectedDevice" @update-threshold="updateThreshold" /> </el-form-item>
<el-form-item label="设备编号">
<el-input v-model="queryParams.sn"></el-input>
</el-form-item>
<el-form-item label="名称" prop="equipmentName">
<el-input v-model="queryParams.name"></el-input>
</el-form-item>
<el-form-item>
<el-button
type="primary"
icon="el-icon-search"
size="mini"
@click="handleQuery"
>搜索</el-button
>
<el-button icon="el-icon-refresh" size="mini" @click="resetQuery"
>重置</el-button
>
</el-form-item>
</el-form>
<div class="rt-wrapper">
<el-table
ref="singleTable"
:data="tableData"
highlight-current-row
:max-height="tableHeight"
style="width: 100%"
>
<el-table-column property="ppp" label="港口" width="80" />
<el-table-column property="pp" label="港区" width="130" />
<el-table-column property="p" label="公司" show-overflow-tooltip />
<el-table-column property="name" label="名称" show-overflow-tooltip />
<el-table-column property="sn" label="编号" show-overflow-tooltip />
<el-table-column
property="address"
label="地址"
show-overflow-tooltip
/>
<el-table-column property="bjyz" label="报警阈值" />
<el-table-column label="操作">
<template slot-scope="scope">
<el-button type="text" size="mini" @click="handleEdit(scope.row)"
>通知修改阈值</el-button
>
</template>
</el-table-column>
</el-table>
<div class="pagination-wrapper">
<el-pagination
background
layout="sizes, prev, pager, next, total"
:total="total"
:page-size="queryParams.pageSize"
@current-change="handleCurrentChange"
@size-change="handleSizeChange"
>
</el-pagination>
</div> </div>
</div> </div>
</template> <msg-dialog :visible.sync="showMsgDialog" :shareContent="shareContent"/>
</div>
<script> </template>
import DeviceList from '@/views/remoteControl/oilRecovery/DeviceList.vue';
import RemoteControl from '@/views/remoteControl/oilRecovery/RemoteControl.vue'; <script>
import DeptTree from "@/components/DeptTree/index.vue";
export default { import { getThList } from "@/api/remoteControl";
name: 'Dashboard', import MsgDialog from './msg-dialog.vue';
components: { export default {
DeviceList, name: "remoteControl-bound",
RemoteControl, components: { DeptTree, MsgDialog },
dicts: [],
data() {
return {
tableData: [],
loading: false,
dept: null,
deviceInfo: null,
total: 0,
tableHeight: 0,
showMsgDialog: false,
shareContent: "",
//
queryParams: {
pageNum: 1,
pageSize: 10,
sn: null,
name: null,
deptId: null,
},
};
},
mounted() {
this.$nextTick(() => {
this.tableHeight = window.innerHeight - 250;
});
},
methods: {
handleDeptChange(dept) {
this.dept = dept;
this.queryParams.deptId = dept.deptId;
this.getTableData();
}, },
data() { handleCurrentChange(val) {
return { this.queryParams.pageNum = val;
devices: [ this.getTableData();
{ id: 1, name: 'YQHS0001',factoryName: '***有限公司', threshold: 50 }, },
{ id: 2, name: 'YQHS0002', factoryName: '***有限公司',threshold: 60 }, handleSizeChange(val) {
{ id: 3, name: 'YQHS0003',factoryName: '***有限公司', threshold: 70 }, this.queryParams.pageSize = val;
{ id: 3, name: 'YQHS0004',factoryName: '***有限公司', threshold: 70 }, this.getTableData();
], },
selectedDevice: true, handleQuery() {
this.queryParams.pageNum = 1;
this.getTableData();
},
resetQuery() {
this.queryParams = {
pageNum: 1,
pageSize: 10,
sn: null,
name: null,
deptId: this.dept ? this.dept.deptId : null,
}; };
this.getTableData();
}, },
methods: { handleEdit(row) {
selectDevice(device) { this.deviceInfo = structuredClone(row);
this.selectedDevice = device; this.showMsgDialog = true;
}, this.shareContent = `请将[${row.p}]的[${row.name}设备](当前报警阈值:${row.bjyz})的报警阈值调整为:[]`;
updateThreshold(newThreshold) {
this.selectedDevice.threshold = newThreshold;
},
}, },
}; getTableData() {
</script> if (!this.queryParams.deptId) {
this.$message.error("请选择部门");
<style scoped> return;
.dashboard { }
height: 864px; this.loading = true;
background: url('~@/assets/ldar/bg3.png') no-repeat; getThList(this.queryParams)
display: flex; .then((res) => {
flex-direction: column; this.tableData = res.rows;
align-items: center; this.total = res.total;
padding: 20px; this.loading = false;
background: linear-gradient(135deg, #071e3b, #2a73d1); })
} .catch((error) => {
console.error(error);
.title { this.$message.error(error.message);
font-size: 2em; this.loading = false;
margin-bottom: 20px; });
color: #fff; },
} },
};
.content { </script>
display: flex;
height:700px; <style lang="css" scoped>
width: 100%; .pagination-wrapper {
justify-content: space-around; margin-top: 10px;
} display: flex;
</style> justify-content: flex-end;
}
</style>

View File

@ -0,0 +1,199 @@
<template>
<el-dialog
title="下发通知"
:visible.sync="dialogVisible"
>
<div style="display: inline-flex; height: 30px; line-height: 30px">
<el-button class="agreeButton" style="width: 120px" @click="chooseUser1()"
>选择联系人</el-button
>
<div style="margin-right: 5px">
<!-- <span style="margin-left: 2px" v-for="item in userList">{{
item.nickName
}}</span> -->
<el-tag
:key="user.userId"
v-for="user in userList"
closable
:disable-transitions="false"
@close="handleRemoveUser(user)">
{{ user.userName }}
</el-tag>
</div>
</div>
<div style="margin: 10px">
<el-input
type="textarea"
:rows="2"
placeholder="请输入消息内容..."
v-model="shareContent"
>
</el-input>
</div>
<user-select
v-if="isShowUser"
:isShowUser="isShowUser"
:selectedList="userList"
@closeUser="closeUser"
@chooseUser="chooseUser"
/>
<div style="margin-left: 5px; height: 50px">
<el-checkbox v-model="isSendPhone">同时发送短信</el-checkbox>
</div>
<div style="margin-left: 5px; height: 50px">
<el-button class="agreeButton" @click="sendMsg">发送</el-button>
</div>
</el-dialog>
</template>
<script>
import bus from "@/utils/bus.js";
import { sendMessage } from "@/api/home";
import { addAlarm } from "@/api/demostrate/monitor";
import UserSelect from "@/views/home/components/UserSelect.vue";
export default {
components: { UserSelect },
props: {
infoMsg: {
type: String,
default: "",
},
shareContent: {
type: String,
default: "",
},
visible: {
type: Boolean,
default: false,
},
},
computed: {
dialogVisible: {
get() {
return this.visible;
},
set(val) {
// this.$emit("updateVisible", val);
this.$emit("update:visible", val);
}
}
},
data() {
return {
isSendPhone: false,
isShowUser: false,
userList: [],
phoneList: [],
};
},
methods: {
sendMsg() {
let readList = [];
this.phoneList = [];
this.userList.forEach((element) => {
readList.push(element.userName);
this.phoneList.push(element.phonenumber);
});
let params = {
phoneList: this.phoneList,
isSendPhone: this.isSendPhone,
//readList: JSON.stringify(readList),
readerList: readList,
sendText: this.shareContent,
sendType: "设备报警",
};
sendMessage(params).then((response) => {
if (response.code == 200) {
this.$message.success("消息发送成功!");
let data = {
reportId: this.deviceInfo.reportId,
isDeal: "0",
dealUser: this.userList[0].userName,
};
addAlarm(data).then((res) => {
if (res.code == 200) {
this.$message.success("分配修复任务成功!");
this.handleClose();
bus.$emit("msgReaded");
} else {
this.$message.success("分配修复任务失败!");
}
});
}
});
},
closeUser(val) {
this.isShowUser = val;
},
chooseUser1() {
this.isShowUser = true;
},
//
chooseUser(val) {
if (val && val.length < 1) {
this.$message.error("请至少选择一名处理人员!");
this.isShowUser = false;
} else {
this.userList = val;
this.isShowUser = false;
}
},
handleRemoveUser(user) {
this.userList = this.userList.filter((item) => item.userId !== user.userId);
},
},
mounted() {},
};
</script>
<style lang="scss" scoped>
::v-deep .el-dialog .el-dialog__body {
padding: 0px;
}
.el-tag {
margin-left: 10px;
}
.title {
padding-left: 20px;
color: #212121;
font-size: 16px;
margin-bottom: 10px;
margin-top: 10px;
background: url("~@/assets/ucs/biaoti.png") no-repeat;
background-position-y: 7px;
}
.agreeButton {
display: inline-block;
line-height: 8px;
width: 80px;
height: 32px;
white-space: nowrap;
cursor: pointer;
color: #ffffff;
-webkit-appearance: none;
text-align: center;
-webkit-box-sizing: border-box;
box-sizing: border-box;
outline: 0;
margin-left: 10px;
-webkit-transition: 0.1s;
transition: 0.1s;
font-weight: 500;
//padding: 12px 20px;
font-size: 14px;
border-radius: 4px;
background-color: #068f5c;
}
.agreeButton:hover {
background: #65a5f9;
border-color: #65a5f9;
color: #fff;
}
</style>