index.vue 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452
  1. <template>
  2. <div class="app-container">
  3. <el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="68px">
  4. <el-form-item label="用户姓名" prop="userid">
  5. <el-input v-model="queryParams.name" placeholder="请输入用户姓名" clearable @keyup.enter.native="handleQuery" />
  6. </el-form-item>
  7. <el-form-item label="处理状态" prop="solve_status">
  8. <el-select v-model="queryParams.solve_status">
  9. <el-option label="已处理" :value="1"></el-option>
  10. <el-option label="未处理" :value="0"></el-option>
  11. </el-select>
  12. </el-form-item>
  13. <el-form-item>
  14. <el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
  15. <el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
  16. </el-form-item>
  17. </el-form>
  18. <el-row :gutter="10" class="mb8">
  19. <!-- <el-col :span="1.5">
  20. <el-button
  21. type="primary"
  22. plain
  23. icon="el-icon-plus"
  24. size="mini"
  25. @click="handleAdd"
  26. v-hasPermi="['system:solve:add']"
  27. >新增</el-button>
  28. </el-col>
  29. <el-col :span="1.5">
  30. <el-button
  31. type="success"
  32. plain
  33. icon="el-icon-edit"
  34. size="mini"
  35. :disabled="single"
  36. @click="handleUpdate"
  37. v-hasPermi="['system:solve:edit']"
  38. >修改</el-button>
  39. </el-col>
  40. <el-col :span="1.5">
  41. <el-button
  42. type="danger"
  43. plain
  44. icon="el-icon-delete"
  45. size="mini"
  46. :disabled="multiple"
  47. @click="handleDelete"
  48. v-hasPermi="['system:solve:remove']"
  49. >删除</el-button>
  50. </el-col> -->
  51. <el-col :span="1.5">
  52. <el-button type="warning" plain icon="el-icon-download" size="mini" @click="handleExport"
  53. v-hasPermi="['system:solve:export']">导出</el-button>
  54. </el-col>
  55. <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
  56. </el-row>
  57. <el-table v-loading="loading" :data="healthsolveList" @selection-change="handleSelectionChange">
  58. <el-table-column type="selection" width="55" align="center" />
  59. <!-- <el-table-column label="id" align="center" prop="id" /> -->
  60. <el-table-column label="用户名" align="center" prop="name" />
  61. <el-table-column label="联系电话" align="center" prop="tel_one" />
  62. <el-table-column label="事件类型" align="center">
  63. <template slot-scope="scope">
  64. 健康告警
  65. </template>
  66. </el-table-column>
  67. <el-table-column label="告警时间" align="center" prop="createtime" />
  68. <el-table-column label="告警内容" align="center" prop="alarmMsg" />
  69. <el-table-column label="处理状态" align="center" prop="solveStatus" />
  70. <!-- <el-table-column label="服务人员用户ID" align="center" prop="serviceUserid" />
  71. <el-table-column label="时间记录" align="center" prop="msg" />
  72. <el-table-column label="创建时间" align="center" prop="createTime" width="180">
  73. <template slot-scope="scope">
  74. <span>{{ parseTime(scope.row.createTime, '{y}-{m}-{d}') }}</span>
  75. </template>
  76. </el-table-column> -->
  77. <el-table-column label="操作" align="center" class-name="small-padding fixed-width">
  78. <template slot-scope="scope">
  79. <el-button size="mini" type="text" icon="el-icon-view" @click="handleSee(scope.row)">查看</el-button>
  80. <el-button size="mini" type="text" icon="el-icon-edit" @click="handleUpdate(scope.row)"
  81. v-hasPermi="['system:solve:edit']">处理</el-button>
  82. <!-- <el-button
  83. size="mini"
  84. type="text"
  85. icon="el-icon-delete"
  86. @click="handleDelete(scope.row)"
  87. v-hasPermi="['system:solve:remove']"
  88. >删除</el-button> -->
  89. </template>
  90. </el-table-column>
  91. </el-table>
  92. <pagination v-show="total > 0" :total="total" :page.sync="queryParams.pageNum" :limit.sync="queryParams.pageSize"
  93. @pagination="getList" />
  94. <!-- 添加或修改SOS预警处理对话框 -->
  95. <el-dialog :visible.sync="open" width="1200px" append-to-body destroy-on-close>
  96. <el-row>
  97. <el-col :span="8" class="user-table">
  98. <div class="label">姓名:</div>
  99. <div>{{ form.name }}</div>
  100. </el-col>
  101. <el-col :span="8" class="user-table">
  102. <div class="label">联系电话:</div>
  103. <div>{{ form.tel_one }}</div>
  104. </el-col>
  105. <el-col :span="8" class="user-table">
  106. <div class="label">所属机构:</div>
  107. <div>{{ form.store_name }}</div>
  108. </el-col>
  109. </el-row>
  110. <el-row>
  111. <el-col :span="8" class="user-table">
  112. <div class="label">设备类型:</div>
  113. <div>智能设备</div>
  114. </el-col>
  115. <el-col :span="8" class="user-table">
  116. <div class="label">设备型号:</div>
  117. <div>{{form.deviceModel}}</div>
  118. </el-col>
  119. <el-col :span="8" class="user-table">
  120. <div class="label">设备名称:</div>
  121. <div>智能手环</div>
  122. </el-col>
  123. </el-row>
  124. <el-row>
  125. <el-col :span="8" class="user-table">
  126. <div class="label">设备ID:</div>
  127. <div>{{ form.deviceIdCode }}</div>
  128. </el-col>
  129. <el-col :span="8" class="user-table">
  130. <div class="label">事件类型:</div>
  131. <div>{{ form.alarm_type == 24 ? '健康告警' : '' }}</div>
  132. </el-col>
  133. <el-col :span="8" class="user-table">
  134. <div class="label">告警时间:</div>
  135. <div>{{ form.createtime }}</div>
  136. </el-col>
  137. </el-row>
  138. <!-- <el-row>
  139. <el-col :span="8" class="user-table">
  140. <div class="label">告警开始时间:</div>
  141. <div>2023-09-07 16:41</div>
  142. </el-col>
  143. <el-col :span="8" class="user-table">
  144. <div class="label">告警结束时间:</div>
  145. <div>2023-09-07 16:41</div>
  146. </el-col>
  147. </el-row> -->
  148. <el-row>
  149. <el-col class="user-table">
  150. <div class="label">告警地址:</div>
  151. <div>{{ form.address_desc }}</div>
  152. </el-col>
  153. </el-row>
  154. <el-row>
  155. <el-col class="user-table">
  156. <div class="label">告警内容:</div>
  157. <div>{{ form.alarmMsg }}</div>
  158. </el-col>
  159. </el-row>
  160. <el-row v-if="!deal_flag">
  161. <el-col class="user-table">
  162. <div class="label">处理状态:</div>
  163. <div>{{form.solveStatus}}</div>
  164. </el-col>
  165. </el-row>
  166. <el-row v-if="!deal_flag">
  167. <el-col class="user-table">
  168. <div class="label">事件记录:</div>
  169. <div>{{ form.msg }}</div>
  170. </el-col>
  171. </el-row>
  172. <el-row v-if="deal_flag">
  173. <el-col class="user-table">
  174. <div class="label">处理状态:</div>
  175. <el-radio-group v-model="form.solve_status">
  176. <el-radio label="0">未处理</el-radio>
  177. <el-radio label="2">在处理</el-radio>
  178. <el-radio label="1">已处理</el-radio>
  179. </el-radio-group>
  180. </el-col>
  181. </el-row>
  182. <el-row v-if="deal_flag" style="margin-bottom: 20px;">
  183. <el-col class="user-table" style="align-items: flex-start;">
  184. <div class="label">事件记录:</div>
  185. <el-input type="textarea" :rows="2" style="width: 950px;" v-model="form.msg"></el-input>
  186. </el-col>
  187. </el-row>
  188. <el-row>
  189. <div id="health-map"></div>
  190. </el-row>
  191. <div slot="footer" class="dialog-footer" style="text-align: center;">
  192. <el-button type="primary" @click="submit" v-if="deal_flag">提 交</el-button>
  193. <el-button @click="cancel" v-if="!deal_flag">关 闭</el-button>
  194. </div>
  195. </el-dialog>
  196. </div>
  197. </template>
  198. <script>
  199. import { listHealthsolve, getHealthsolve, delHealthsolve, addHealthsolve, updateHealthsolve } from "@/api/system/healthsolve";
  200. import AMapLoader from '@amap/amap-jsapi-loader';
  201. export default {
  202. name: "Healthsolve",
  203. data() {
  204. return {
  205. // 遮罩层
  206. loading: true,
  207. // 选中数组
  208. ids: [],
  209. // 非单个禁用
  210. single: true,
  211. // 非多个禁用
  212. multiple: true,
  213. // 显示搜索条件
  214. showSearch: true,
  215. // 总条数
  216. total: 0,
  217. // 健康告警处理表格数据
  218. healthsolveList: [],
  219. // 弹出层标题
  220. title: "",
  221. // 是否显示弹出层
  222. open: false,
  223. // 查询参数
  224. queryParams: {
  225. pageNum: 1,
  226. pageSize: 10,
  227. userid: null,
  228. deviceIdCode: null,
  229. alarmMsg: null,
  230. solve_status: null,
  231. serviceUserid: null,
  232. msg: null,
  233. createTime: null,
  234. alarmid: null
  235. },
  236. // 表单参数
  237. form: {},
  238. // 表单校验
  239. rules: {
  240. },
  241. map: null,
  242. deal_flag: false,
  243. deviceModel: []
  244. };
  245. },
  246. created() {
  247. this.getList();
  248. },
  249. methods: {
  250. createMap() {
  251. window._AMapSecurityConfig = {
  252. securityJsCode: 'e91e92cbd76e89c48f3ff1d6180f288c'
  253. }
  254. AMapLoader.load({
  255. key: 'c968deab485d6e688e7c68689722ffb4',
  256. version: '2.0'
  257. }).then(AMap => {
  258. this.map = new AMap.Map('health-map', {
  259. zoom: 15,
  260. center: [this.form.gps_long, this.form.gps_lat]
  261. })
  262. this.map.plugin(['AMap.ToolBar', 'AMap.Scale'], () => {
  263. this.map.addControl(new AMap.ToolBar({
  264. position: 'RT'
  265. }))
  266. this.map.addControl(new AMap.Scale())
  267. })
  268. var info = [];
  269. info.push(`<p>姓名 : ${this.form.name}</p>`)
  270. info.push(`<p>电话 : ${this.form.tel_one}</p>`);
  271. info.push(`<p>地址 : ${this.form.address_desc}</p>`);
  272. info.push(`<p>预警时间 : ${this.form.createtime}</p>`);
  273. let infoWindow = new AMap.InfoWindow({
  274. offset: new AMap.Pixel(0, -35),
  275. content: info.join(""), //使用默认信息窗体框样式,显示信息内容
  276. });
  277. infoWindow.open(this.map, this.map.getCenter());
  278. let marker = new AMap.Marker({
  279. position: [this.form.gps_long, this.form.gps_lat]
  280. })
  281. this.map.add(marker)
  282. marker.on('click', () => {
  283. infoWindow.open(this.map, this.map.getCenter());
  284. })
  285. })
  286. },
  287. /** 查询健康告警处理列表 */
  288. async getList() {
  289. this.loading = true;
  290. let { data: deviceModel } = await this.getDicts('sys_device_type')
  291. this.deviceModel = deviceModel
  292. await listHealthsolve(this.queryParams).then(response => {
  293. this.healthsolveList = response.rows;
  294. this.healthsolveList.map(item => {
  295. if (item.device_model || item.device_model == 0) {
  296. item.deviceModel = this.deviceModel[item.device_model].dictLabel
  297. }
  298. item.solveStatus = item.solve_status == 1 ? '已处理' : item.solve_status == 0 ? '未处理' : '处理中'
  299. })
  300. this.total = response.total;
  301. this.loading = false;
  302. });
  303. },
  304. // 取消按钮
  305. cancel() {
  306. this.open = false;
  307. this.reset();
  308. },
  309. // 表单重置
  310. reset() {
  311. this.form = {
  312. id: null,
  313. userid: null,
  314. deviceIdCode: null,
  315. alarmMsg: null,
  316. solveStatus: null,
  317. serviceUserid: null,
  318. msg: null,
  319. createTime: null,
  320. alarmid: null
  321. };
  322. this.resetForm("form");
  323. },
  324. /** 搜索按钮操作 */
  325. handleQuery() {
  326. this.queryParams.pageNum = 1;
  327. this.getList();
  328. },
  329. /** 重置按钮操作 */
  330. resetQuery() {
  331. this.resetForm("queryForm");
  332. this.handleQuery();
  333. },
  334. // 多选框选中数据
  335. handleSelectionChange(selection) {
  336. this.ids = selection.map(item => item.id)
  337. this.single = selection.length!==1
  338. this.multiple = !selection.length
  339. },
  340. /** 新增按钮操作 */
  341. handleAdd() {
  342. this.reset();
  343. this.open = true;
  344. this.title = "添加健康告警处理";
  345. },
  346. /** 修改按钮操作 */
  347. handleUpdate(row) {
  348. this.reset();
  349. const id = row.aid || this.ids
  350. this.deal_flag = true
  351. // getSolve(id).then(response => {
  352. // this.form = response.data;
  353. // this.open = true;
  354. // this.title = "修改SOS预警处理";
  355. // this.createMap()
  356. // });
  357. this.healthsolveList.map(item => {
  358. if (item.aid == id) {
  359. this.form = item
  360. this.open = true;
  361. }
  362. })
  363. this.createMap()
  364. },
  365. handleSee(row) {
  366. this.reset();
  367. const id = row.aid
  368. this.healthsolveList.map(item => {
  369. if (item.aid == id) {
  370. this.form = item
  371. this.open = true;
  372. this.deal_flag = false
  373. }
  374. })
  375. this.createMap()
  376. },
  377. submit() {
  378. let data = {}
  379. data.uid = this.form.uid
  380. data.deviceIdCode = this.form.deviceIdCode
  381. data.alarmMsg = this.form.alarmMsg
  382. data.solve_status = this.form.solve_status
  383. data.msg = this.form.msg
  384. data.aid = this.form.aid
  385. addHealthsolve(data).then(response => {
  386. this.$modal.msgSuccess("提交成功");
  387. this.open = false;
  388. this.getList();
  389. });
  390. },
  391. /** 提交按钮 */
  392. submitForm() {
  393. this.$refs["form"].validate(valid => {
  394. if (valid) {
  395. if (this.form.id != null) {
  396. updateHealthsolve(this.form).then(response => {
  397. this.$modal.msgSuccess("修改成功");
  398. this.open = false;
  399. this.getList();
  400. });
  401. } else {
  402. addHealthsolve(this.form).then(response => {
  403. this.$modal.msgSuccess("新增成功");
  404. this.open = false;
  405. this.getList();
  406. });
  407. }
  408. }
  409. });
  410. },
  411. /** 删除按钮操作 */
  412. handleDelete(row) {
  413. const ids = row.id || this.ids;
  414. this.$modal.confirm('是否确认删除健康告警处理编号为"' + ids + '"的数据项?').then(function() {
  415. return delHealthsolve(ids);
  416. }).then(() => {
  417. this.getList();
  418. this.$modal.msgSuccess("删除成功");
  419. }).catch(() => {});
  420. },
  421. /** 导出按钮操作 */
  422. handleExport() {
  423. this.download('system/healthsolve/export', {
  424. ...this.queryParams
  425. }, `healthsolve_${new Date().getTime()}.xlsx`)
  426. }
  427. }
  428. };
  429. </script>
  430. <style scoped>
  431. .user-table {
  432. display: flex;
  433. align-items: center;
  434. line-height: 42px;
  435. }
  436. .label {
  437. width: 120px;
  438. text-align: end;
  439. }
  440. #health-map {
  441. width: 100%;
  442. height: 500px;
  443. }
  444. </style>