index.vue 30 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868
  1. <template>
  2. <div class="app-container">
  3. <div style="">
  4. <div style="background-color: #fff;padding: 20px;border-radius: 10px; padding-bottom: 0;">
  5. <p style="margin: 0; font-weight: 800;font-size: 16px;color: #343434;display: flex;align-items: center;margin-bottom: 20px;border-left: 6px solid #03BF8A;margin-left: -20px;">
  6. <!-- <img src="../../../assets/images/icon_htgl_btzs.png" alt="" style="width: 16px;height: 20px;"> -->
  7. <span style="margin-left: 10px;">搜索条件</span>
  8. </p>
  9. <div style="padding-bottom: 0;margin-bottom: 20px;">
  10. <el-form class="qucheu" :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="88px">
  11. <el-row>
  12. <el-col :span="6">
  13. <el-form-item label="告警类别" prop="algorithmType">
  14. <el-select style="width: 140px;" v-model="queryParams.algorithmType" placeholder="请选择告警类别" clearable>
  15. <el-option
  16. v-for="dict in dict.type.gaojing_typeshuju"
  17. :key="dict.value"
  18. :label="dict.label"
  19. :value="dict.value"
  20. />
  21. </el-select>
  22. </el-form-item>
  23. </el-col>
  24. <el-col :span="6">
  25. <el-form-item label="告警时间" prop="warnTime">
  26. <el-date-picker style="width: 140px;" clearable
  27. v-model="queryParams.warnTime"
  28. type="date"
  29. value-format="yyyy-MM-dd"
  30. placeholder="请选择告警时间">
  31. </el-date-picker>
  32. </el-form-item>
  33. </el-col>
  34. <el-col :span="5">
  35. <el-form-item class="butt" style="border: 0;">
  36. <el-button style="background-color: #03BF8A; border-color: #03BF8A;" type="primary" size="mini" @click="handleQuery">查询 </el-button>
  37. <el-button size="mini" @click="resetQuery">重置</el-button>
  38. </el-form-item>
  39. </el-col>
  40. </el-row>
  41. </el-form>
  42. </div>
  43. </div>
  44. <div class="casr">
  45. <el-row :gutter="10" class="mb8">
  46. <el-col :span="1.5">
  47. <el-button
  48. type="success"
  49. plain
  50. size="mini"
  51. @click="handleAdd"
  52. v-hasPermi="['manage:warnManage:add']"
  53. >添加</el-button>
  54. </el-col>
  55. <!-- <el-col :span="1.5">
  56. <el-button
  57. type="success"
  58. plain
  59. size="mini"
  60. :disabled="singleg"
  61. @click="handleUpdateg"
  62. v-hasPermi="['manage:warnManage:edits']"
  63. >修改</el-button>
  64. </el-col> -->
  65. <el-col :span="1.5">
  66. <el-button
  67. type="danger"
  68. plain
  69. size="mini"
  70. @click="handleDeleteg"
  71. v-hasPermi="['manage:warnManage:remove']"
  72. >删除</el-button>
  73. </el-col>
  74. <el-col :span="1.5">
  75. <el-button
  76. type="warning"
  77. plain
  78. size="mini"
  79. @click="handleExport"
  80. v-hasPermi="['manage:warnManage:export']"
  81. >导出</el-button>
  82. </el-col>
  83. <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
  84. </el-row>
  85. <div class=" infinite-list" :style="dynamicStyle">
  86. <el-row :gutter="10" v-if="warnManageList.length !=0" style="width: 100%;margin-left: 0;">
  87. <el-col :span="6" v-for="(item,index) in warnManageList" :key="index" style="cursor: pointer;">
  88. <div v-if="isshoe" @click="isac(item)" :class=" item.isnum ==true ? 'ingwe' :'' " style="position: relative; background-color: #fff;box-shadow: 0px 0px 10px 0px #CDCDCD;border-radius: 10px;margin-bottom: 10px;padding-bottom: 10px;">
  89. <div class="quning">
  90. <div class="shipige">
  91. <div style="display: flex;align-items: center;">
  92. <img src="../../../assets/images/icon_gjgl_gx_normal.png" alt="" v-if="item.isnum == false">
  93. <img src="../../../assets/images/icon_gjgl_gx_selected.png" alt="" v-if="item.isnum == true">
  94. <p style="font-size: 14px;color: #333;font-weight: 700; margin-left: 5px;">{{ item.rangName + (item.algorithmType == 0 ? '离岗' : '玩手机') + '告警'}}</p>
  95. </div>
  96. <!-- <p style="font-size: 14px; color: #aaa;font-weight: 500;" @click="tiahzo(item)">详情→</p> -->
  97. </div>
  98. <!-- <img :src="item.warnImage" alt="" style="width: 100%; height: 150px;"> -->
  99. <image-preview v-if="item.warnImage != null && item.warnImage != ''" :src="item.warnImage" :width="100 +'%'" :height="150" style=""/>
  100. <!-- <video
  101. :id="'myVideo' + (index+1)"
  102. data-setup="{}"
  103. loop="loop"
  104. :autoplay="false"
  105. muted
  106. controls
  107. @play="videoPlay(item)"
  108. poster=""
  109. style="width: 100%;height: 150px;"
  110. v-if=" item.videoAddress != null && item.videoAddress != ''"
  111. > -->
  112. <!-- + baseUrl -->
  113. <!-- <source :src="item.videoAddress " />
  114. </video> -->
  115. <div ref="videoPlayer" style="width: 100%;height: 150px;" class="video-player"></div>
  116. <!-- <h265-player url="http://192.168.9.240:5010/prod-api/profile/videoRecored/recording_20250627_092541_357_离岗.mp4" @error="handleError"></h265-player> -->
  117. </div>
  118. <div class="goe">
  119. <div style="display: flex;align-items: center;margin-top: 8px;">
  120. <p>设备名称:</p>
  121. <p>{{item.equipmentName == null?'暂无数据' : item.equipmentName}}</p>
  122. </div>
  123. <div style="display: flex;align-items: center;margin-top: 8px;">
  124. <p>算法参数:</p>
  125. <p>{{item.parameterSet == null?'暂无数据' : item.parameterSet}}</p>
  126. </div>
  127. <!-- <div style="display: flex;align-items: center;margin-top: 8px;">
  128. <p>视频通道:</p>
  129. <p>{{item.channelNum == null?'暂无数据' : item.channelNum}}</p>
  130. </div> -->
  131. <div style="display: flex;align-items: center;margin-top: 8px;">
  132. <p>告警日期:</p>
  133. <p>{{item.warnTime == null?'暂无数据' : item.warnTime}}</p>
  134. </div>
  135. <!-- <div style="display: flex;align-items: center;margin-top: 8px;">
  136. <p>上报地址:</p>
  137. <p>{{item.reportAddress == null?'暂无数据' : item.reportAddress}}</p>
  138. </div> -->
  139. <div style="display: flex;align-items: center;margin-top: 8px;">
  140. <p>上报状态:</p>
  141. <div><dict-tag :options="dict.type.shagnt" :value="item.reportStatus"/></div>
  142. </div>
  143. <!-- <div style="display: flex;align-items: center;margin-top: 8px;">
  144. <p>告警内容:</p>
  145. <div><dict-tag :options="dict.type.gaojing_typeshuju" :value="item.algorithmType"/></div>
  146. </div> -->
  147. </div>
  148. <!-- <img v-if="item.isnum == true" src="../../../assets/images/icon_htgl_kp_gx.png" alt="" style="width: 35px;height: 35px;position: absolute;bottom: 0;right: 0;"> -->
  149. </div>
  150. </el-col>
  151. </el-row>
  152. <div style="margin-top: 20px;display: flex;justify-content: center;align-items: center;" v-if="warnManageList.length ==0">
  153. <img src="../../../assets/images/zwshjbig.png" alt="" style="">
  154. </div>
  155. </div>
  156. </div>
  157. <paginations
  158. v-show="total>0"
  159. :total="total"
  160. :page.sync="queryParams.pageNum"
  161. :limit.sync="queryParams.pageSize"
  162. @pagination="getList"
  163. />
  164. </div>
  165. <!-- 添加或修改岗位对话框 -->
  166. <el-dialog :title="title" :visible.sync="open" width="800px" append-to-body>
  167. <el-form ref="form" :model="form" :rules="rules" label-width="120px">
  168. <el-row>
  169. <el-col :span="12">
  170. <el-form-item label="告警类别" prop="warnType">
  171. <el-select style="width: 100%;" v-model="form.algorithmType" placeholder="请选择告警类别">
  172. <el-option
  173. v-for="dict in dict.type.gaojing_typeshuju"
  174. :key="dict.value"
  175. :label="dict.label"
  176. :value="dict.value"
  177. ></el-option>
  178. </el-select>
  179. </el-form-item>
  180. </el-col>
  181. <el-col :span="12" >
  182. <el-form-item label="告警标识" prop="warnSign">
  183. <el-input v-model="form.warnSign" placeholder="请输入告警标识" />
  184. </el-form-item>
  185. </el-col>
  186. <el-col :span="12" >
  187. <el-form-item label="通道Id" prop="channelId">
  188. <el-select style="width: 100%;" v-model="form.channelId" placeholder="请选择通道ID">
  189. <el-option
  190. v-for="dict in channelNumberList "
  191. :key="dict.channelId"
  192. :label="dict.channelNum"
  193. :value="dict.channelId"
  194. ></el-option>
  195. </el-select>
  196. </el-form-item>
  197. </el-col>
  198. <el-col :span="12" >
  199. <el-form-item label="视频地址" prop="videoAddress">
  200. <el-input v-model="form.videoAddress" placeholder="请输入视频地址" />
  201. </el-form-item>
  202. </el-col>
  203. <el-col :span="12" >
  204. <el-form-item label="上报地址" prop="reportAddress">
  205. <el-input v-model="form.reportAddress" placeholder="请输入上报地址" />
  206. </el-form-item>
  207. </el-col>
  208. <el-col :span="12" >
  209. <el-form-item label="上报状态" prop="reportStatus">
  210. <el-select style="width: 100%;" v-model="form.reportStatus" placeholder="请选择上报状态">
  211. <el-option
  212. v-for="dict in dict.type.shagnt"
  213. :key="dict.value"
  214. :label="dict.label"
  215. :value="dict.value"
  216. ></el-option>
  217. </el-select>
  218. </el-form-item>
  219. </el-col>
  220. <el-col :span="12">
  221. <el-form-item label="告警时间" prop="warnTime">
  222. <el-date-picker style="width: 100%;" clearable
  223. v-model="form.warnTime"
  224. type="date"
  225. value-format="yyyy-MM-dd"
  226. placeholder="请选择告警时间">
  227. </el-date-picker>
  228. </el-form-item>
  229. </el-col>
  230. <el-col :span="12">
  231. <el-form-item label="备注" prop="remark">
  232. <el-input v-model="form.remark" placeholder="请输入内容" />
  233. </el-form-item>
  234. </el-col>
  235. <el-col :span="24">
  236. <el-form-item label="告警预览图片" prop="warnImage">
  237. <image-upload v-model="form.warnImage"/>
  238. </el-form-item>
  239. </el-col>
  240. </el-row>
  241. </el-form>
  242. <div slot="footer" class="dialog-footer" v-if="isredw">
  243. <el-button type="primary" @click="submitForm">确 定</el-button>
  244. <el-button @click="cancel">取 消</el-button>
  245. </div>
  246. </el-dialog>
  247. </div>
  248. </template>
  249. <script>
  250. // import { listNotice, getNotice, delNotice, addNotice, updateNotice } from "@/api/system/notice"
  251. import { listWarnManage, getWarnManage, delWarnManage, addWarnManage, updateWarnManage } from "@/api/manage/warnManage"
  252. // import 'videojs-flash'
  253. import { listChannelNumber, getChannelNumber, delChannelNumber, addChannelNumber, updateChannelNumber } from "@/api/system/channelNumber"
  254. const defaultSettings = require("@/settings.js");
  255. import videojs from 'video.js';
  256. import 'video.js/dist/video-js.css';
  257. import H265Player from 'vue-h265-player';
  258. import mqttHandle from "../../../utils/mqttHandler.js"
  259. import mqtt from 'mqtt';
  260. import { MqttClient } from 'mqtt'
  261. // 状态变量
  262. const client = mqtt.connect('ws://13.229.167.76:1884/mqtt')
  263. export default {
  264. name: "WarnManage",
  265. components: {
  266. H265Player
  267. },
  268. dicts: ['gaojing_typeshuju', 'source_type','alarm_task','shagnt'],
  269. data() {
  270. return {
  271. mqttThemeName:{
  272. url: 'ws://13.229.167.76:1884/mqtt',
  273. topic: 'test/topic'
  274. },
  275. // 遮罩层
  276. loading: true,
  277. defaultSettings:defaultSettings,
  278. baseUrl: process.env.VUE_APP_BASE_API,
  279. // 选中数组
  280. ids: [],
  281. // 非单个禁用
  282. single: true,
  283. // 非多个禁用
  284. multiple: true,
  285. // 显示搜索条件
  286. showSearch: true,
  287. // 总条数
  288. total: 0,
  289. // 告警管理表格数据
  290. warnManageList: [],
  291. channelNumberList:[],
  292. // 弹出层标题
  293. title: "",
  294. // 是否显示弹出层
  295. open: false,
  296. // 查询参数
  297. queryParams: {
  298. pageNum: 1,
  299. pageSize: 10,
  300. warnType: null,
  301. warnSign: null,
  302. channelId: null,
  303. videoAddress: null,
  304. reportAddress: null,
  305. reportStatus: null,
  306. warnTime: null,
  307. warnImage: null,
  308. algorithmType:null,
  309. params:{
  310. month:null
  311. }
  312. },
  313. // 表单参数
  314. form: {},
  315. // 表单校验
  316. rules: {
  317. videoAddress: [
  318. { required: true, message: "不能为空", trigger: "blur" }
  319. ],
  320. warnTime: [
  321. { required: true, message: "不能为空", trigger: "blur" }
  322. ],
  323. warnImage: [
  324. { required: true, message: "不能为空", trigger: "blur" }
  325. ],
  326. },
  327. activeName:'1',
  328. videoState: false, // 视频播放状态
  329. poster:true,
  330. controls:true,
  331. videoData:{},
  332. player: null,
  333. isshoe:true,
  334. isredw:true,
  335. singleg:true,
  336. manid:0,
  337. getreadList:[],
  338. startTime: 0,
  339. yutim:true,
  340. staffTrainTimeList:[],
  341. tableMaxHeight:'200',
  342. receiveNews: "",
  343. player: null,
  344. options: {
  345. // 视频源
  346. sources: [{
  347. src: 'http://192.168.9.240:5010/prod-api/profile/videoRecored/recording_20250627_092541_357_离岗.mp4',
  348. type: 'video/mp4'
  349. }],
  350. // 其他配置选项...
  351. }
  352. };
  353. },
  354. computed: {
  355. dynamicStyle() {
  356. return {
  357. overflowY:'auto',
  358. height: this.tableMaxHeight+ 'px',
  359. paddingTop:'10px'
  360. }
  361. }
  362. },
  363. created() {
  364. this.startTime = Date.now()
  365. if(this.$route.query.type != undefined){
  366. if(this.$route.query.type == 'zs'){
  367. this.queryParams.params.month = this.gettimeyer()
  368. }else {
  369. this.queryParams.algorithmType = this.$route.query.type
  370. }
  371. }else{
  372. this.queryParams.params.month = null
  373. this.queryParams.algorithmType = null
  374. }
  375. if(this.$route.query.deptId != undefined){
  376. this.queryParams.params.month = this.gettimeyer()
  377. this.queryParams.deptId = this.$route.query.deptId
  378. }else{
  379. this.queryParams.params.month = null
  380. this.queryParams.deptId = null
  381. }
  382. if(this.$route.query.rangName != undefined){
  383. this.queryParams.warnTime = this.gettime()
  384. this.queryParams.rangName = this.$route.query.rangName
  385. this.queryParams.algorithmType = this.$route.query.type
  386. }else{
  387. this.queryParams.warnTime = null
  388. this.queryParams.rangName = null
  389. }
  390. if(this.$route.query.year != undefined){
  391. this.queryParams.params.year = this.$route.query.year
  392. }else{
  393. this.queryParams.params.year = null
  394. }
  395. this.getList();
  396. this.getListt()
  397. window.onresize = () => {
  398. this.changeTableMaxHeight()
  399. }
  400. this.changeTableMaxHeight()
  401. },
  402. mounted() {
  403. // this.createMqtt() // 建立mqtt通信
  404. window.onresize = () => {
  405. this.changeTableMaxHeight()
  406. }
  407. this.changeTableMaxHeight()
  408. this.player = videojs(this.$refs.videoPlayer, this.options, () => {
  409. console.log('player is ready');
  410. });
  411. },
  412. beforeDestroy() {
  413. if (this.player) {
  414. this.player.dispose()
  415. }
  416. if (client) {
  417. console.log(4)
  418. client.end()
  419. }
  420. // this.disconnect()
  421. },
  422. methods: {
  423. handleError(error) {
  424. console.error('Video error:', error);
  425. },
  426. gettimeyer(){
  427. let nowDate = new Date()
  428. let date = {
  429. year: nowDate.getFullYear(),
  430. month: nowDate.getMonth() + 1,
  431. date: nowDate.getDate()
  432. }
  433. if (parseInt(date.month) < 10) {
  434. date.month = '0' + date.month
  435. }
  436. if (parseInt(date.date) < 10) {
  437. date.date = '0' + date.date
  438. }
  439. let nghe = date.year + '-' + date.month
  440. return nghe
  441. },
  442. minToHm(min) {
  443. let h = Math.floor(min / 60);
  444. let m = min % 60;
  445. let hDisplay = h ? `${h}小时` : '';
  446. let mDisplay = m ? `${m}分钟` : '';
  447. console.log(`${hDisplay}${mDisplay}`.trim())
  448. return `${hDisplay}${mDisplay}`.trim();
  449. },
  450. /** 查询岗位列表 */
  451. getList() {
  452. this.loading = true;
  453. this.isshoe = false
  454. listWarnManage(this.queryParams).then(response => {
  455. this.warnManageList = response.rows;
  456. this.warnManageList.filter(rou=>{
  457. rou.isnum = false
  458. })
  459. this.isshoe = true
  460. // this.getge(this.warnManageList)
  461. this.total = response.total;
  462. this.loading = false;
  463. });
  464. },
  465. // 创mqtt最终版
  466. mqttzz(){
  467. // 创建一个连接到MQTT broker的客户端实例
  468. // 连接成功后,订阅一个主题
  469. client.on('connect', function () {
  470. client.subscribe('test/topic', function (err) {
  471. if (!err) {
  472. console.log('成功订阅 test/topic 主题!')
  473. }
  474. })
  475. })
  476. // 监听订阅主题上的消息
  477. client.on('message', function (topic, message) {
  478. // 处理接收到的消息
  479. console.log('收到主题 ' + topic + ' 的消息: ' + message.toString())
  480. })
  481. },
  482. isac(val){
  483. console.log(5,val)
  484. val.isnum = !val.isnum
  485. this.isshoe = false
  486. this.isshoe = true
  487. let nhde = []
  488. let nsg = ''
  489. this.warnManageList.filter(rou=>{
  490. if(rou.isnum == true){
  491. nhde.push(rou.manualId)
  492. }
  493. })
  494. if(nhde.length == 1){
  495. this.warnManageList.filter(rou=>{
  496. if(rou.isnum == true){
  497. console.log(rou.manualId)
  498. this.manid = rou.manualId
  499. console.log(this.manid)
  500. }
  501. })
  502. this.singleg = false
  503. }else{
  504. // this.manid = row.
  505. this.singleg = true
  506. }
  507. },
  508. /** 查询通道管理列表 */
  509. getListt() {
  510. this.loading = true
  511. let snge={
  512. pageNum: 1,
  513. pageSize: 200,
  514. }
  515. listChannelNumber(snge).then(response => {
  516. this.channelNumberList = response.rows
  517. this.loading = false
  518. })
  519. },
  520. getge(valy){
  521.   this.$nextTick(() => {
  522.        setTimeout(() => {
  523. for(var i =0; i < valy.length;i++){
  524. let du = document.getElementById("myVideo" + (i+1)) //获取组件下的video
  525.        var hour = parseInt((du.duration) / 3600);
  526.        var minute = parseInt((du.duration % 3600) / 60);
  527.        var second = parseInt(du.duration % 60);
  528.        let result = ''
  529.        if (hour > 0) {
  530.        result = this.formatTimeStr(hour) + ':' + this.formatTimeStr(minute) + ':' + this
  531.        .formatTimeStr(second)
  532.                  } else {
  533.                     result = this.formatTimeStr(minute) + ':' + 
  534.                   this.formatTimeStr(second)
  535.                   }
  536. this.isshoe = false
  537. valy[i].result = result
  538. this.isshoe = true
  539. console.log(valy[i],result,du)
  540. //                   return result //转化成分,秒
  541. }
  542.                 }, 1200)
  543.               })
  544. },
  545. formatTimeStr(val) {
  546.         if (val > 9) {
  547.           return val
  548.         } else {
  549.           return '0' + val
  550.         }
  551.       },
  552. // 取消按钮
  553. cancel() {
  554. this.open = false;
  555. this.reset();
  556. },
  557. // 获取当前时间
  558. gettime(){
  559. let nowDate = new Date()
  560. let date = {
  561. year: nowDate.getFullYear(),
  562. month: nowDate.getMonth() + 1,
  563. date: nowDate.getDate()
  564. }
  565. // console.log(parseInt(date.date),date.month,4)
  566. if (date.month < 10) {
  567. date.month = '0' + date.month
  568. }
  569. if (parseInt(date.date) < 10) {
  570. date.date = '0' + date.date
  571. }
  572. let nghe = date.year + '-' + date.month + '-' + date.date
  573. return nghe
  574. },
  575. // 表单重置
  576. reset() {
  577. this.form = {
  578. warnId: null,
  579. warnType: null,
  580. warnSign: null,
  581. channelId: null,
  582. videoAddress: null,
  583. reportAddress: null,
  584. reportStatus: null,
  585. warnTime: this.gettime(),
  586. warnImage: null,
  587. delFlag: null,
  588. createBy: null,
  589. createTime: null,
  590. updateBy: null,
  591. updateTime: null,
  592. remark: null
  593. }
  594. this.resetForm("form");
  595. },
  596. /** 搜索按钮操作 */
  597. handleQuery() {
  598. this.queryParams.pageNum = 1
  599. this.getList()
  600. },
  601. /** 重置按钮操作 */
  602. resetQuery() {
  603. this.queryParams.pageNum = 1
  604. this.queryParams.params.month = null
  605. this.queryParams.algorithmType = null
  606. this.queryParams.deptId = null
  607. this.queryParams.warnTime = null
  608. this.queryParams.rangName = null
  609. this.queryParams.params.year = null
  610. this.resetForm("queryForm")
  611. this.handleQuery()
  612. },
  613. // 多选框选中数据
  614. handleSelectionChange(selection) {
  615. this.ids = selection.map(item => item.warnId)
  616. this.single = selection.length!==1
  617. this.multiple = !selection.length
  618. },
  619. /** 新增按钮操作 */
  620. handleAdd() {
  621. this.reset()
  622. this.open = true
  623. this.title = "添加告警管理"
  624. },
  625. /** 修改按钮操作 */
  626. handleUpdate(row) {
  627. this.reset()
  628. const warnId = row.warnId || this.ids
  629. getWarnManage(warnId).then(response => {
  630. this.form = response.data
  631. this.open = true
  632. this.title = "修改告警管理"
  633. })
  634. },
  635. getImageSrc(val) {
  636. // 创建一个临时元素,将HTML内容插入其中
  637. const tempElement = document.createElement('div');
  638. tempElement.innerHTML = val;
  639. // 查找 <img> 标签并获取 src 属性值
  640. const imgElement = tempElement.querySelector('img');
  641. if (imgElement) {
  642. const srcValue = imgElement.getAttribute('src');
  643. // this.imagePath=srcValue
  644. console.log('Image src:', srcValue+"照片路径");
  645. } else {
  646. console.log('No <img> element found.');
  647. }
  648. },
  649. /** 提交按钮 */
  650. submitForm() {
  651. this.$refs["form"].validate(valid => {
  652. if (valid) {
  653. if (this.form.warnId != null) {
  654. updateWarnManage(this.form).then(response => {
  655. this.$modal.msgSuccess("修改成功")
  656. this.open = false
  657. this.getList()
  658. })
  659. } else {
  660. addWarnManage(this.form).then(response => {
  661. this.$modal.msgSuccess("新增成功")
  662. this.open = false
  663. this.getList()
  664. })
  665. }
  666. }
  667. })
  668. },
  669. handleDeleteg() {
  670. let nhde = []
  671. let nsg = ''
  672. this.warnManageList.filter(rou=>{
  673. if(rou.isnum == true){
  674. nhde.push(rou.warnId)
  675. }
  676. })
  677. console.log(nhde)
  678. nsg = nhde.join(',')
  679. // return
  680. delWarnManage(nsg).then(response => {
  681. this.$modal.msgSuccess("操作成功")
  682. this.getList()
  683. })
  684. // delManual(nsg)
  685. // this.$modal.confirm('是否确认删除数据项?').then(function() {
  686. // return delManual(nsg);
  687. // }).then(() => {
  688. // this.getList();
  689. // this.$modal.msgSuccess("删除成功");
  690. // }).catch(() => {});
  691. },
  692. /** 删除按钮操作 */
  693. handleDelete(row) {
  694. const warnIds = row.warnId || this.ids
  695. this.$modal.confirm('是否确认删除告警管理编号为"' + warnIds + '"的数据项?').then(function() {
  696. return delWarnManage(warnIds)
  697. }).then(() => {
  698. this.getList()
  699. this.$modal.msgSuccess("删除成功")
  700. }).catch(() => {})
  701. },
  702. /** 导出按钮操作 */
  703. handleExport() {
  704. this.download('manage/warnManage/export', {
  705. ...this.queryParams
  706. }, `warnManage_${new Date().getTime()}.xlsx`)
  707. },
  708. // 获取屏幕高度
  709. showFilterForm () {
  710. this.filterActive = !this.filterActive
  711. this.changeTableMaxHeight()
  712. },
  713. changeTableMaxHeight () {
  714. let height = document.body.offsetHeight // 网页可视区域高度
  715. // if (this.filterActive) {
  716. // this.tableMaxHeight = height - 320
  717. // } else {
  718. this.tableMaxHeight = height - 150
  719. // }
  720. console.log(height)
  721. },
  722. tiahzo(item){
  723. this.$router.push({
  724. path: '/shebe',
  725. query: {
  726. 'id':item.warnId,
  727. }
  728. })
  729. }
  730. }
  731. };
  732. </script>
  733. <style lang="scss">
  734. .ckilde{
  735. // color: #03BF8A;
  736. }
  737. .quning{
  738. .el-image{
  739. box-shadow:0;
  740. -webkit-box-shadow:0;
  741. }
  742. }
  743. .qucheu{
  744. .el-form-item--small.el-form-item{
  745. border: 1px solid #E6E6E6;
  746. }
  747. .el-input__inner{
  748. border:0;
  749. }
  750. }
  751. .nghsey{
  752. .el-dialog__body{
  753. padding: 0;
  754. background-color: #F2F3FD;
  755. }
  756. }
  757. .butt{
  758. .el-button--small{
  759. padding: 9px 23px !important;
  760. font-size: 14px;
  761. border: 0 !important;
  762. }
  763. }
  764. .casr{
  765. .el-tabs__item.is-active{
  766. color: #196CFF;
  767. }
  768. .el-tabs--card > .el-tabs__header .el-tabs__item{
  769. padding: 0 30px !important;
  770. }
  771. }
  772. .el-table .el-table__header-wrapper th{
  773. background-color:#F5F6F8;
  774. color:#343434;
  775. }
  776. .el-table{
  777. color:#343434;
  778. }
  779. </style>
  780. <style scoped lang="scss">
  781. .goe{
  782. padding: 0 15px;
  783. div{
  784. // margin-bottom: 12px;
  785. }
  786. p{
  787. margin: 0;
  788. font-weight: 500;
  789. font-size: 14px;
  790. color: #AAAAAA;
  791. // margin-top: 10px;
  792. // margin-bottom: 3px;
  793. // padding: 0 10px;
  794. overflow: hidden;
  795. text-overflow: ellipsis;
  796. display:-webkit-box; //作为弹性伸缩盒子模型显示。
  797. -webkit-box-orient:vertical; //设置伸缩盒子的子元素排列方式--从上到下垂直排列
  798. -webkit-line-clamp:1; //显示的行
  799. width: 30%;
  800. }
  801. p:nth-child(2){
  802. // margin-bottom: 10px;
  803. margin-top: 0;
  804. font-weight: 400;
  805. width: 70%;
  806. font-size: 14px;
  807. color: #333333;
  808. display: flex;
  809. justify-content: space-between;
  810. align-items: center;
  811. overflow: hidden;
  812. text-overflow: ellipsis;
  813. display:-webkit-box; //作为弹性伸缩盒子模型显示。
  814. -webkit-box-orient:vertical; //设置伸缩盒子的子元素排列方式--从上到下垂直排列
  815. -webkit-line-clamp:1; //显示的行
  816. // padding-bottom: 10px;
  817. }
  818. }
  819. .ingwe{
  820. border: 2px solid #03BF8A;
  821. }
  822. .shipige{
  823. padding: 15px;
  824. display: flex;
  825. justify-content: space-between;
  826. align-items: center;
  827. p{
  828. margin: 0;
  829. }
  830. }
  831. </style>