MessageAlarmList.vue 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407
  1. <template>
  2. <a-card :bordered="false">
  3. <!-- 查询区域 -->
  4. <div class="table-page-search-wrapper">
  5. <a-form layout="inline" @keyup.enter.native="searchQuery">
  6. <a-row :gutter="24">
  7. <a-col :xl="10" :lg="7" :md="8" :sm="24">
  8. <a-form-item label="设备名称">
  9. <a-select
  10. v-model="queryParam.id"
  11. placeholder="请输入设备名称或设备编号"
  12. show-search
  13. :filterOption="filterOptions"
  14. @search="searchDevice"
  15. allowClear>
  16. <a-select-option v-for="(item, index) in deviceOptions" :key="index" :value="item.id" :label="item.equipmentname">
  17. <span>{{item.equipmentname}}</span>
  18. <span style="position: absolute;right: 2%;">{{ item.equipmentcode }}</span>
  19. </a-select-option>
  20. </a-select>
  21. </a-form-item>
  22. </a-col>
  23. <template v-if="toggleSearchStatus">
  24. <a-col :xl="6" :lg="7" :md="8" :sm="24">
  25. <a-form-item label="报警日期">
  26. <j-date v-model="queryParam.alarmtime" placeholder="请选择报警日期" style="width:100%;"></j-date>
  27. </a-form-item>
  28. </a-col>
  29. <a-col :xl="6" :lg="7" :md="8" :sm="24">
  30. <a-form-item label="报警等级">
  31. <j-dict-select-tag v-model="queryParam.alarmlevel" placeholder="请选择报警等级" dictCode="alarm_level"/>
  32. </a-form-item>
  33. </a-col>
  34. <a-col :xl="6" :lg="7" :md="8" :sm="24">
  35. <a-form-item label="报警类型">
  36. <j-dict-select-tag v-model="queryParam.alarmtype" placeholder="请选择报警类型" dictCode="alarm_type"/>
  37. </a-form-item>
  38. </a-col>
  39. <a-col :xl="6" :lg="7" :md="8" :sm="24">
  40. <a-form-item label="处理状态">
  41. <j-dict-select-tag v-model="queryParam.status" placeholder="请选择处理状态" dictCode="alarm_status"/>
  42. </a-form-item>
  43. </a-col>
  44. </template>
  45. <a-col :xl="6" :lg="7" :md="8" :sm="24">
  46. <span style="float: left;overflow: hidden;" class="table-page-search-submitButtons">
  47. <a-button type="primary" @click="searchQuery" icon="search">查询</a-button>
  48. <a-button type="primary" @click="searchReset" icon="reload" style="margin-left: 8px">重置</a-button>
  49. <a @click="handleToggleSearch" style="margin-left: 8px">
  50. {{ toggleSearchStatus ? '收起' : '展开' }}
  51. <a-icon :type="toggleSearchStatus ? 'up' : 'down'"/>
  52. </a>
  53. </span>
  54. </a-col>
  55. </a-row>
  56. </a-form>
  57. </div>
  58. <!-- 查询区域-END -->
  59. <!-- 操作按钮区域 -->
  60. <!-- <div class="table-operator">
  61. <a-button @click="handleAdd" type="primary" icon="plus">新增</a-button>
  62. <a-button type="primary" icon="download" @click="handleExportXls('tpm_message_alarm')">导出</a-button>
  63. <a-upload name="file" :showUploadList="false" :multiple="false" :headers="tokenHeader" :action="importExcelUrl" @change="handleImportExcel">
  64. <a-button type="primary" icon="import">导入</a-button>
  65. </a-upload> -->
  66. <!-- 高级查询区域 -->
  67. <!-- <j-super-query :fieldList="superFieldList" ref="superQueryModal" @handleSuperQuery="handleSuperQuery"></j-super-query>
  68. <a-dropdown v-if="selectedRowKeys.length > 0">
  69. <a-menu slot="overlay">
  70. <a-menu-item key="1" @click="batchDel"><a-icon type="delete"/>删除</a-menu-item>
  71. </a-menu>
  72. <a-button style="margin-left: 8px"> 批量操作 <a-icon type="down" /></a-button>
  73. </a-dropdown>
  74. </div> -->
  75. <!-- table区域-begin -->
  76. <div>
  77. <!-- <div class="ant-alert ant-alert-info" style="margin-bottom: 16px;">
  78. <i class="anticon anticon-info-circle ant-alert-icon"></i> 已选择 <a style="font-weight: 600">{{ selectedRowKeys.length }}</a>项
  79. <a style="margin-left: 24px" @click="onClearSelected">清空</a>
  80. </div> -->
  81. <a-table
  82. ref="table"
  83. size="middle"
  84. :scroll="{x:true}"
  85. bordered
  86. rowKey="id"
  87. :columns="columns"
  88. :dataSource="dataSource"
  89. :pagination="ipagination"
  90. :loading="loading"
  91. class="j-table-force-nowrap"
  92. @change="handleTableChange">
  93. <template slot="htmlSlot" slot-scope="text">
  94. <div v-html="text"></div>
  95. </template>
  96. <template slot="imgSlot" slot-scope="text,record">
  97. <span v-if="!text" style="font-size: 12px;font-style: italic;">无图片</span>
  98. <img v-else :src="getImgView(text)" :preview="record.id" height="25px" alt="" style="max-width:80px;font-size: 12px;font-style: italic;"/>
  99. </template>
  100. <template slot="fileSlot" slot-scope="text">
  101. <span v-if="!text" style="font-size: 12px;font-style: italic;">无文件</span>
  102. <a-button
  103. v-else
  104. :ghost="true"
  105. type="primary"
  106. icon="download"
  107. size="small"
  108. @click="downloadFile(text)">
  109. 下载
  110. </a-button>
  111. </template>
  112. <span slot="action" slot-scope="text, record">
  113. <a @click="handleEdit(record)">处理</a>
  114. <!-- <a-divider type="vertical" />
  115. <a-dropdown>
  116. <a class="ant-dropdown-link">更多 <a-icon type="down" /></a>
  117. <a-menu slot="overlay">
  118. <a-menu-item>
  119. <a @click="handleDetail(record)">详情</a>
  120. </a-menu-item>
  121. <a-menu-item>
  122. <a-popconfirm title="确定删除吗?" @confirm="() => handleDelete(record.id)">
  123. <a>删除</a>
  124. </a-popconfirm>
  125. </a-menu-item>
  126. </a-menu>
  127. </a-dropdown> -->
  128. </span>
  129. </a-table>
  130. </div>
  131. <message-alarm-modal ref="modalForm" @ok="modalFormOk"></message-alarm-modal>
  132. </a-card>
  133. </template>
  134. <script>
  135. import '@/assets/less/TableExpand.less'
  136. import { mixinDevice } from '@/utils/mixin'
  137. import { JeecgListMixin } from '@/mixins/JeecgListMixin'
  138. import { httpAction, getAction } from '@/api/manage'
  139. import MessageAlarmModal from './modules/MessageAlarmModal'
  140. export default {
  141. name: 'MessageAlarmList',
  142. mixins:[JeecgListMixin, mixinDevice],
  143. components: {
  144. MessageAlarmModal
  145. },
  146. data () {
  147. return {
  148. description: 'tpm_message_alarm管理页面',
  149. // 表头
  150. columns: [
  151. {
  152. title: '序号',
  153. dataIndex: '',
  154. key:'rowIndex',
  155. width:60,
  156. align:"center",
  157. customRender:function (t,r,index) {
  158. return parseInt(index)+1;
  159. }
  160. },
  161. {
  162. title:'设备',
  163. align:"center",
  164. dataIndex: 'equipmentid'
  165. },
  166. {
  167. title:'报警类型',
  168. align:"center",
  169. dataIndex: 'alarmtype'
  170. },
  171. {
  172. title:'报警描述',
  173. align:"center",
  174. dataIndex: 'remark'
  175. },
  176. {
  177. title:'报警时间',
  178. align:"center",
  179. dataIndex: 'alarmtime',
  180. // customRender:function (text) {
  181. // return !text?"":(text.length>10?text.substr(0,10):text)
  182. // }
  183. },
  184. {
  185. title:'报警等级',
  186. align:"center",
  187. dataIndex: 'alarmlevel'
  188. },
  189. // {
  190. // title:'消息码',
  191. // align:"center",
  192. // dataIndex: 'msgcode'
  193. // },
  194. // {
  195. // title:'参数编号',
  196. // align:"center",
  197. // dataIndex: 'paramcode'
  198. // },
  199. // {
  200. // title:'参数名称',
  201. // align:"center",
  202. // dataIndex: 'paramname'
  203. // },
  204. {
  205. title:'当前值',
  206. align:"center",
  207. dataIndex: 'nowvalue'
  208. },
  209. {
  210. title:'阈值最小值',
  211. align:"center",
  212. dataIndex: 'vmin'
  213. },
  214. {
  215. title:'阈值最大值',
  216. align:"center",
  217. dataIndex: 'vmax'
  218. },
  219. {
  220. title:'处理状态',
  221. align:"center",
  222. dataIndex: 'status'
  223. },
  224. // {
  225. // title:'处理日期',
  226. // align:"center",
  227. // dataIndex: 'handletime',
  228. // customRender:function (text) {
  229. // return !text?"":(text.length>10?text.substr(0,10):text)
  230. // }
  231. // },
  232. // {
  233. // title:'处理人',
  234. // align:"center",
  235. // dataIndex: 'handleuser'
  236. // },
  237. // {
  238. // title:'处理信息',
  239. // align:"center",
  240. // dataIndex: 'handleremark'
  241. // },
  242. // {
  243. // title:'图片地址',
  244. // align:"center",
  245. // dataIndex: 'url'
  246. // },
  247. // {
  248. // title:'距离(摄像头用)',
  249. // align:"center",
  250. // dataIndex: 'distance'
  251. // },
  252. // {
  253. // title:'方位(摄像头用)',
  254. // align:"center",
  255. // dataIndex: 'position'
  256. // },
  257. // {
  258. // title:'所属年',
  259. // align:"center",
  260. // dataIndex: 'year'
  261. // },
  262. // {
  263. // title:'所属月',
  264. // align:"center",
  265. // dataIndex: 'month'
  266. // },
  267. // {
  268. // title:'所属周',
  269. // align:"center",
  270. // dataIndex: 'week'
  271. // },
  272. // {
  273. // title:'日期',
  274. // align:"center",
  275. // dataIndex: 'day'
  276. // },
  277. // {
  278. // title:'周几',
  279. // align:"center",
  280. // dataIndex: 'dayofweek'
  281. // },
  282. // {
  283. // title:'所属年月',
  284. // align:"center",
  285. // dataIndex: 'yearmonth'
  286. // },
  287. {
  288. title: '操作',
  289. dataIndex: 'action',
  290. align:"center",
  291. fixed:"right",
  292. width:147,
  293. scopedSlots: { customRender: 'action' }
  294. }
  295. ],
  296. url: {
  297. list: "/tpmMessageAlarm/tpmMessageAlarm/list",
  298. delete: "/tpmMessageAlarm/tpmMessageAlarm/delete",
  299. deleteBatch: "/tpmMessageAlarm/tpmMessageAlarm/deleteBatch",
  300. exportXlsUrl: "/tpmMessageAlarm/tpmMessageAlarm/exportXls",
  301. importExcelUrl: "tpmMessageAlarm/tpmMessageAlarm/importExcel",
  302. },
  303. dictOptions:{},
  304. superFieldList:[],
  305. deviceOptions: [],
  306. deviceOptionsAll: [],
  307. }
  308. },
  309. created() {
  310. this.getSuperFieldList();
  311. this.getDeviceOption();
  312. },
  313. computed: {
  314. importExcelUrl: function(){
  315. return `${window._CONFIG['domianURL']}/${this.url.importExcelUrl}`;
  316. },
  317. },
  318. methods: {
  319. // 获取设备下拉列表
  320. getDeviceOption(){
  321. getAction(`/tpmEquipment/tpmEquipment/selectEquipmentList`).then(res=>{
  322. console.log(111,res.result)
  323. this.deviceOptions = res.result.map((res) => {
  324. return {
  325. id: res.id,
  326. equipmentname: res.equipmentname,
  327. equipmentcode: res.equipmentcode,
  328. }
  329. })
  330. // 存一个完整的设备表
  331. this.deviceOptionsAll = this.deviceOptions
  332. // console.log(7878,this.deviceOptionsAll)
  333. })
  334. },
  335. // 筛选设备
  336. searchDevice(value) {
  337. console.log(1212,value,value.trim().length)
  338. // 若输入的值删除,则重新赋完整的设备列表
  339. if (value.trim().length === 0) {
  340. this.deviceOptions = this.deviceOptionsAll
  341. }
  342. // 通过判断字符串中是数字还是文字进而判断是通过设备名筛选还是设备编号筛选
  343. let panDuan = isNaN(parseFloat(value))
  344. if (!panDuan) {
  345. // 数字
  346. // console.log(777)
  347. let filteredArray = this.deviceOptionsAll.filter(item => item.equipmentcode.includes(value));
  348. this.deviceOptions = filteredArray
  349. } else {
  350. // console.log(888)
  351. let filteredArray = this.deviceOptionsAll.filter(item => item.equipmentname.includes(value));
  352. this.deviceOptions = filteredArray
  353. }
  354. // console.log(999,this.deviceOptions)
  355. },
  356. // 解决筛选后option不回显问题
  357. filterOptions(input, option) {
  358. return this.deviceOptions
  359. },
  360. initDictConfig(){
  361. },
  362. getSuperFieldList(){
  363. let fieldList=[];
  364. fieldList.push({type:'string',value:'remark',text:'报警描述'})
  365. fieldList.push({type:'string',value:'equipmentid',text:'设备id'})
  366. fieldList.push({type:'date',value:'alarmtime',text:'报警时间'})
  367. fieldList.push({type:'string',value:'alarmtype',text:'报警类型:0通讯状态,1现场报警,2设备故障,3消防报警,4环境报警,5安全报警'})
  368. fieldList.push({type:'string',value:'alarmlevel',text:'报警等级:0普通,1严重,2事故'})
  369. fieldList.push({type:'string',value:'msgcode',text:'消息码'})
  370. fieldList.push({type:'string',value:'paramcode',text:'参数编号'})
  371. fieldList.push({type:'string',value:'paramname',text:'参数名称'})
  372. fieldList.push({type:'number',value:'nowvalue',text:'当前值'})
  373. fieldList.push({type:'number',value:'vmin',text:'阈值最小值'})
  374. fieldList.push({type:'number',value:'vmax',text:'阈值最大值'})
  375. fieldList.push({type:'int',value:'status',text:'状态:0 报警,1误报 , 2 处理中,3已处理'})
  376. fieldList.push({type:'date',value:'handletime',text:'处理日期'})
  377. fieldList.push({type:'string',value:'handleuser',text:'处理人'})
  378. fieldList.push({type:'string',value:'handleremark',text:'处理信息'})
  379. fieldList.push({type:'string',value:'url',text:'图片地址'})
  380. fieldList.push({type:'number',value:'distance',text:'距离(摄像头用)'})
  381. fieldList.push({type:'number',value:'position',text:'方位(摄像头用)'})
  382. fieldList.push({type:'int',value:'year',text:'所属年'})
  383. fieldList.push({type:'int',value:'month',text:'所属月'})
  384. fieldList.push({type:'int',value:'week',text:'所属周'})
  385. fieldList.push({type:'string',value:'day',text:'日期'})
  386. fieldList.push({type:'int',value:'dayofweek',text:'周几'})
  387. fieldList.push({type:'string',value:'yearmonth',text:'所属年月'})
  388. this.superFieldList = fieldList
  389. }
  390. }
  391. }
  392. </script>
  393. <style scoped>
  394. @import '~@assets/less/common.less';
  395. </style>