tactics.vue 33 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915
  1. <template>
  2. <div class="content">
  3. <div class="tabs">
  4. <ul>
  5. <li v-for="(tab,i) in tabs" @click="goTab(tab.url)" :class="{'active':tabIndex == i}">
  6. {{tab.name}}
  7. </li>
  8. </ul>
  9. </div>
  10. <div class="panel">
  11. <div class="panel-body">
  12. <div class=" panel_control">
  13. <div class="pline">
  14. <em>策略名称:</em>
  15. <el-input v-model="panel.tagname" placeholder=""></el-input>
  16. </div>
  17. <div class="pline">
  18. <el-button size="medium" type="primary" @click="query">查询</el-button>
  19. </div>
  20. <div class="pline pull-right">
  21. <el-button size="medium" type="primary" @click="addList">添加</el-button>
  22. <el-button size="medium" type="primary" @click="editList">修改</el-button>
  23. <el-button size="medium" type="primary" @click="delList">删除</el-button>
  24. </div>
  25. </div>
  26. </div>
  27. </div>
  28. <el-table
  29. :data="tableData"
  30. is-horizontal-resize
  31. :default-sort="{prop: 'date', order: 'descending'}"
  32. v-loading="loading"
  33. element-loading-background="rgba(0, 0, 0, 0.8)"
  34. class=""
  35. @selection-change="handleSelectionChange"
  36. stripe
  37. ref="multipleTable"
  38. @row-click="handle"
  39. >
  40. <el-table-column
  41. type="selection"
  42. width="55">
  43. </el-table-column>
  44. <el-table-column
  45. type="index"
  46. label="序号"
  47. width="60"
  48. sortable
  49. >
  50. </el-table-column>
  51. <el-table-column
  52. prop="Mac"
  53. label="区域名称"
  54. >
  55. </el-table-column>
  56. <el-table-column type="expand">
  57. <template slot-scope="props">
  58. <el-table
  59. :data="props.row"
  60. style="width: 100%">
  61. <el-table-column
  62. prop="date"
  63. label="日期"
  64. width="180">
  65. </el-table-column>
  66. <el-table-column
  67. prop="name"
  68. label="姓名"
  69. width="180">
  70. </el-table-column>
  71. <el-table-column
  72. prop="address"
  73. label="地址">
  74. </el-table-column>
  75. </el-table>
  76. </template>
  77. </el-table-column>
  78. <el-table-column
  79. prop="Xmax"
  80. label="长/m"
  81. >
  82. </el-table-column>
  83. <el-table-column
  84. prop="Ymax"
  85. label="宽/m"
  86. >
  87. </el-table-column>
  88. <el-table-column
  89. prop="Memo"
  90. label="备注"
  91. >
  92. </el-table-column>
  93. <el-table-column
  94. prop="address"
  95. label="操作记录"
  96. width="220"
  97. >
  98. <template slot-scope="scope">
  99. <!--<el-button class="" type="text" @click="goPhoneRecord(scope.row)">手机信号记录</el-button>-->
  100. <el-button class="" type="primary" size="small" @click="goWifiRecord(scope.row)">监测记录</el-button>
  101. <!--<el-button v-if="scope.row.Status == 1" class="yellow" type="text" @click="pauseRow(scope.row)">禁用-->
  102. <!--</el-button>-->
  103. <!--<el-button v-if="scope.row.Status == 0" class="green" type="text" @click="runRow(scope.row)">启用-->
  104. <!--</el-button>-->
  105. </template>
  106. </el-table-column>
  107. </el-table>
  108. <br>
  109. <el-pagination
  110. background
  111. :total="pageination.total"
  112. :page-size="pageination.pageItem"
  113. @current-change="pageChange"
  114. ></el-pagination>
  115. <dialog_referrer_list
  116. :show="dialog_state"
  117. :title="dialog_title"
  118. :large="true"
  119. @dialog_cancel="dialog_cancel"
  120. @dialog_ok="dialog_ok"
  121. >
  122. <div class="dialogContent">
  123. <el-row :gutter="24">
  124. <el-col :span="24">
  125. <label>
  126. 区域名称
  127. </label>
  128. <el-input v-model="dialog.mac" @keyup.native="autoCompleteMac"
  129. :disabled="dialog_type == 2"></el-input>
  130. </el-col>
  131. <el-col :span="12">
  132. <label>
  133. 长/m
  134. </label>
  135. <el-input v-model="dialog.tagname"></el-input>
  136. </el-col>
  137. <el-col :span="12">
  138. <label>
  139. 宽/m
  140. </label>
  141. <el-input v-model="dialog.tagname"></el-input>
  142. </el-col>
  143. <el-col :span="24">
  144. <label>
  145. 备注
  146. </label>
  147. <el-input v-model="dialog.memo" type="textarea"></el-input>
  148. </el-col>
  149. </el-row>
  150. </div>
  151. </dialog_referrer_list>
  152. </div>
  153. </template>
  154. <script>
  155. import Global from '../Global.js'
  156. import dialog_referrer_list from '../components/dialog_referrer_list'
  157. import {
  158. DetectorQuery,
  159. GetChildRegionSelect,
  160. DetectorEditStatus,
  161. RegionPictureGetByRegionId,
  162. DetectorAdd,
  163. RegionList,
  164. DetectorList,
  165. DetectorEdit,
  166. GetDetectorCoords,
  167. GeFullRegionSelect,
  168. } from '../api/getApiRes.js'
  169. let qs = require('qs');
  170. export default {
  171. data() {
  172. return {
  173. // dialog
  174. dialog_state: false,
  175. dialog_title: '',
  176. dialog_type: '',//类型,1是添加,2是修改
  177. dialog: {
  178. mac: '',
  179. comId: 1,
  180. regionlevelOneId: 0,
  181. regionId: 0,
  182. tagname: '',
  183. longitude: 0,
  184. latitude: 0,
  185. HardwareVersion: '',
  186. FirmwareVersion: '',
  187. FirmwareScanM4Version: '',
  188. FirmwareScanM0Version: '',
  189. purchasesrc: '',
  190. location: '',
  191. coords_memo: '',
  192. memo: '',
  193. plateImgSrc: '',
  194. regionlevelOneIdOptions: [],
  195. regionIdRoomOptions: [],
  196. points: [],
  197. CoordsId: 0,
  198. status: 0,
  199. },
  200. tabIndex: 0,
  201. tabs: [
  202. {name: '扫描策略管理', url: 'tactics'},
  203. ],
  204. // panel 配置项目
  205. panel: {
  206. usercode: '',
  207. username: '',
  208. compname: '',
  209. keyword: '',
  210. USERCODE: '',
  211. taskstatus: 99,
  212. regionid: 0,
  213. regionid2: '',
  214. regionidOptions: [],
  215. regionidOptions2: [],
  216. options: [
  217. {value: 99, label: '全部'},
  218. {value: 1, label: '进行中'},
  219. {value: 2, label: '已完成'},
  220. ],
  221. time1: globalBt3(2),
  222. },
  223. pageination: {
  224. pageItem: 100,
  225. pageoptions: pageOptions(),
  226. total: 500,
  227. pageIndex: 1,
  228. },
  229. draw: 1,
  230. start: 0,
  231. recordsTotal: 0,
  232. tableData: [],
  233. allTableData: [],
  234. limit: '10',
  235. multipleSort: false,
  236. loading: true,
  237. fileList: [],
  238. multipleSelection: [],
  239. detectedmac: '',
  240. }
  241. },
  242. mounted() {
  243. if (this.$route.query.RegionId) {
  244. this.panel.regionid = this.$route.query.RegionId;
  245. this.panel.tagname = this.$route.query.TagName;
  246. }
  247. this.getTableQuery();
  248. },
  249. methods: {
  250. handle(row, column, event) {
  251. this.$refs.multipleTable.toggleRowSelection(row);
  252. },
  253. // 页面数据查询
  254. getTableQuery() {
  255. let that = this;
  256. // this.getGetChildRegionSelect(0, 1);
  257. this.getGeFullRegionSelect();
  258. that.loading = true;
  259. // 查询检测设备。上级区域id,区域id必传。regionid传0,查询supregionid对应所有子区域的检测设备。 如果supregionid,regionid都传0,默认查询企业ID下所有检测设备
  260. let param = {
  261. token: localStorage.token,
  262. mac: this.panel.mac,//
  263. regionId: that.panel.regionId,//
  264. name: that.panel.tagname,//标签名
  265. comid: 1,//
  266. start: 1,//
  267. tableMax: 9999,//
  268. };
  269. let postdata = qs.stringify(param);
  270. DetectorList(postdata).then(res => {
  271. let json = res;
  272. if (json.Code == 0) {
  273. that.loading = false;
  274. if (json.Rs) {
  275. that.allTableData = json.Rs;
  276. console.log(json.Rs);
  277. that.recordsTotal = json.Rs.length;
  278. } else {
  279. that.allTableData = [];
  280. that.recordsTotal = 0;
  281. }
  282. // 设置分页数据
  283. that.setPaginations();
  284. } else {
  285. that.$message.error(json.Memo + ',错误代码:' + json.Code);
  286. }
  287. })
  288. },
  289. // 获取下级列表
  290. getGeFullRegionSelect() {
  291. let that = this;
  292. let param = {
  293. token: localStorage.token,
  294. };
  295. let postdata = qs.stringify(param);
  296. RegionList(postdata).then(res => {
  297. let json = res;
  298. if (json.Code == 0) {
  299. if (!json.Rs) {
  300. that.$message.error('区域列表为空,请先添加有效区域');
  301. return false
  302. }
  303. that.panel.regionidOptions = json.Rs;
  304. that.panel.regionidOptions.unshift({Id: 0, Name: "全部", DisplayName: "全部"});
  305. } else {
  306. that.$message.error(json.Memo + ',错误代码:' + json.Code);
  307. }
  308. })
  309. },
  310. // dialog获取下级列表
  311. dialoggetGeFullRegionSelect() {
  312. let that = this;
  313. let param = {
  314. token: localStorage.token,
  315. };
  316. let postdata = qs.stringify(param);
  317. RegionList(postdata).then(res => {
  318. let json = res;
  319. if (json.Code == 0) {
  320. that.dialog.regionlevelOneIdOptions = json.Rs;
  321. that.dialog.regionId = json.Rs[0].Id;
  322. } else {
  323. that.$message.error(json.Memo + ',错误代码:' + json.Code);
  324. }
  325. })
  326. },
  327. // dialog获取区域下级菜单
  328. dialogGetGetChildRegionSelect(regionId, level) {
  329. let that = this;
  330. let param = {
  331. token: localStorage.token,
  332. regionId: regionId,
  333. };
  334. let postdata = qs.stringify(param);
  335. RegionList(postdata).then(res => {
  336. let json = res;
  337. if (json.Code == 0) {
  338. that.dialog.regionlevelOneIdOptions = json.Rs;
  339. that.dialog.regionlevelOneId = regionId;
  340. // if (level == 1) {
  341. // console.log(json.Rs);
  342. // that.dialog.regionlevelOneIdOptions = json.Rs;
  343. // that.dialog.regionlevelOneId = regionId;
  344. // } else {
  345. // if (json.Rs) {
  346. // console.log(123);
  347. // that.dialog.regionIdRoomOptions = json.Rs;
  348. // that.dialog.regionId = regionId;
  349. // } else {
  350. // that.dialog.regionIdRoomOptions = [];
  351. // that.dialog.regionId = '';
  352. // }
  353. // }
  354. } else {
  355. that.$message.error(json.Memo + ',错误代码:' + json.Code);
  356. }
  357. })
  358. },
  359. // 跳转tab页面
  360. goTab(url) {
  361. this.$router.push({path: url});
  362. },
  363. // 查询按钮
  364. query() {
  365. this.getTableQuery();
  366. this.$message.success('查询完毕');
  367. },
  368. handleSelectionChange(val) {
  369. this.multipleSelection = val;
  370. },
  371. // 设置分页数据
  372. setPaginations() {
  373. // 分页属性
  374. let that = this;
  375. that.pageination.total = that.recordsTotal;
  376. // 默认分页
  377. that.tableData = that.allTableData.filter((item, index) => {
  378. return index < that.pageination.pageItem;
  379. });
  380. },
  381. // 每页显示数量
  382. handleSizeChange() {
  383. let that = this;
  384. that.tableData = that.allTableData.filter((item, index) => {
  385. return index < that.pageination.pageItem;
  386. });
  387. that.draw = that.pageination.pageItem;
  388. // that.getTableQuery();
  389. },
  390. // 翻页
  391. pageChange(pageIndex) {
  392. let that = this;
  393. // 获取当前页
  394. let index = that.pageination.pageItem * (pageIndex - 1);
  395. // 数据总数
  396. let nums = that.pageination.pageItem * pageIndex;
  397. // 容器
  398. let tables = [];
  399. for (var i = index; i < nums; i++) {
  400. if (that.allTableData[i]) {
  401. tables.push(that.allTableData[i])
  402. }
  403. this.tableData = tables;
  404. }
  405. that.start = index * that.draw;
  406. // that.getTableQuery();
  407. },
  408. // 自动排序
  409. sortChange(params) {
  410. console.log(params)
  411. },
  412. // 过滤时间
  413. filterFmtDate(value, row, column) {
  414. return globalfmtDate(column, 11);
  415. },
  416. addList() {
  417. this.$router.push(
  418. {
  419. path: '/addTactics', query: {tid: 0}
  420. }
  421. )
  422. },
  423. delList() {
  424. let that = this;
  425. // checkNum
  426. if (!this.multipleSelection.length) {
  427. that.$message({
  428. showClose: true,
  429. message: '错了哦,需要先选中至少一条记录',
  430. type: 'error'
  431. });
  432. return false
  433. }
  434. let detectorid = that.multipleSelection[0].Id;
  435. let param = {
  436. token: localStorage.token,
  437. detectorid: detectorid,
  438. status: 9,//0禁用1启用9删除
  439. };
  440. let postdata = qs.stringify(param);
  441. this.$confirm('此操作将永久删除该设备, 是否继续?', '提示', {
  442. confirmButtonText: '确定',
  443. cancelButtonText: '取消',
  444. type: 'warning'
  445. }).then(() => {
  446. DetectorEditStatus(postdata).then(res => {
  447. let json = res;
  448. if (json.Code == 0) {
  449. that.$message({
  450. showClose: true,
  451. message: '选中的设备已删除!',
  452. type: 'success'
  453. });
  454. // 重载列表
  455. that.getTableQuery();
  456. that.dialog_state = false;
  457. } else {
  458. that.$message.error(json.Memo + ',错误代码:' + json.Code);
  459. }
  460. });
  461. }).catch(() => {
  462. this.$message({
  463. type: 'info',
  464. message: '已取消删除'
  465. });
  466. });
  467. },
  468. editList() {
  469. let that = this;
  470. // checkNum
  471. if (!this.multipleSelection.length) {
  472. this.$message({
  473. showClose: true,
  474. message: '错了哦,需要先选中一条记录',
  475. type: 'error'
  476. });
  477. return false
  478. }
  479. if (this.multipleSelection.length > 1) {
  480. this.$message({
  481. showClose: true,
  482. message: '错了哦,只能选中一条记录',
  483. type: 'error'
  484. });
  485. return false
  486. }
  487. this.dialog_state = true;
  488. this.dialog_title = '修改设备信息';
  489. this.dialog_type = 2;
  490. // 读取本条记录
  491. let row = this.multipleSelection[0];
  492. this.dialog.eqId = row.Id;
  493. this.dialog.mac = row.Mac;
  494. this.dialog.regionId = row.RegionId;
  495. this.dialog.tagname = row.TagName;
  496. this.dialog.HardwareVersion = row.HardwareVersion;
  497. this.dialog.FirmwareVersion = row.FirmwareVersion;
  498. this.dialog.FirmwareScanM4Version = row.FirmwareScanM4Version;
  499. this.dialog.FirmwareScanM0Version = row.FirmwareScanM0Version;
  500. this.dialog.location = row.Location;
  501. this.dialog.purchasesrc = row.PurchaseSrc;
  502. this.dialog.memo = row.Memo;
  503. this.dialog.regionlevelOneId = row.RegionId;
  504. this.dialog.status = row.Status;
  505. // this.dialog.coords_memo = row.coords_memo;
  506. // 重载地区列表
  507. this.getGeFullRegionSelect();
  508. that.dialog.points = [{x: row.X, y: row.Y}];
  509. this.$router.push(
  510. {
  511. path: '/addtactics', query: {tid: row.id}
  512. }
  513. );
  514. },
  515. // 自动补全MAC
  516. autoCompleteMac() {
  517. let text = this.dialog.mac;
  518. if (text.length == 2 || text.length == 5 || text.length == 8 || text.length == 11 || text.length == 14) {
  519. this.dialog.mac = this.dialog.mac.toUpperCase() + ":"
  520. }
  521. if (text.length > 14) {
  522. this.dialog.mac = this.dialog.mac.toUpperCase()
  523. }
  524. },
  525. // 探测记录
  526. goPhoneRecord(row) {
  527. this.$router.push({
  528. path: '/phoneSign',
  529. query:
  530. {
  531. detectorid: row.Id,
  532. comId: 1,
  533. regionId: row.RegionId,
  534. }
  535. });
  536. },
  537. // 探测记录
  538. goWifiRecord(row) {
  539. this.$router.push({
  540. path: '/wifiSign',
  541. query:
  542. {
  543. detectorid: row.Id,
  544. comId: 1,
  545. regionId: row.RegionId,
  546. }
  547. });
  548. },
  549. dialog_cancel() {
  550. let that = this;
  551. that.dialog_state = false;
  552. },
  553. dialog_ok() {
  554. if (this.dialog_type == 1) {
  555. this.confirmAddEquip();
  556. } else {
  557. this.confirmEditEquip();
  558. }
  559. },
  560. // 提交增加新设备
  561. confirmAddEquip() {
  562. let that = this;
  563. // checkVal
  564. if (!that.dialog.mac) {
  565. this.$message.error('错了哦,mac不能为空');
  566. return false
  567. }
  568. if (!checkMac(that.dialog.mac)) {
  569. this.$message.error('错了哦,mac格式不正确');
  570. return false
  571. }
  572. if (!that.dialog.regionId) {
  573. this.$message.error('错了哦,所属区域不能为空');
  574. return false
  575. }
  576. if (!that.dialog.tagname) {
  577. this.$message.error('错了哦,标签名不能为空');
  578. return false
  579. }
  580. if (that.dialog.tagname.length > 20) {
  581. this.$message.error('错了哦,标签名不能超过20个字符');
  582. return false
  583. }
  584. this.selectRegionLabel(that.dialog.regionId);
  585. let param = {
  586. token: localStorage.token,
  587. mac: that.dialog.mac,
  588. comId: 1,
  589. regionId: that.dialog.regionId,
  590. name: that.dialog.tagname,
  591. HardwareVersion: that.dialog.HardwareVersion,
  592. FirmwareVersion: that.dialog.FirmwareVersion,
  593. FirmwareScanM4Version: that.dialog.FirmwareScanM4Version,
  594. FirmwareScanM0Version: that.dialog.FirmwareScanM0Version,
  595. location: that.dialog.location,
  596. purchasesrc: that.dialog.purchasesrc,
  597. x: that.dialog.points[0].x,
  598. y: that.dialog.points[0].y,
  599. // coords_memo: that.dialog.coords_memo,
  600. memo: that.dialog.memo,
  601. };
  602. let postdata = qs.stringify(param);
  603. DetectorAdd(postdata).then(res => {
  604. let json = res;
  605. if (json.Code == 0) {
  606. that.$message({
  607. showClose: true,
  608. message: '设备添加成功!',
  609. type: 'success'
  610. });
  611. // 重载列表
  612. that.getTableQuery();
  613. that.dialog_state = false;
  614. } else {
  615. that.$message.error(json.Memo + ',错误代码:' + json.Code);
  616. }
  617. });
  618. },
  619. // 提交修改设备信息
  620. confirmEditEquip() {
  621. let that = this;
  622. // checkVal
  623. if (!that.dialog.mac) {
  624. this.$message.error('错了哦,mac不能为空');
  625. return false
  626. }
  627. if (!checkMac(that.dialog.mac)) {
  628. this.$message.error('错了哦,mac格式不正确');
  629. return false
  630. }
  631. if (!that.dialog.regionId) {
  632. this.$message.error('错了哦,所属区域不能为空');
  633. return false
  634. }
  635. if (!that.dialog.tagname) {
  636. this.$message.error('错了哦,标签名不能为空');
  637. return false
  638. }
  639. if (that.dialog.tagname.length > 20) {
  640. this.$message.error('错了哦,标签名不能超过20个字符');
  641. return false
  642. }
  643. this.selectRegionLabel(that.dialog.regionId);
  644. let param = {
  645. token: localStorage.token,
  646. id: that.dialog.eqId,
  647. mac: that.dialog.mac,
  648. comId: 1,
  649. regionId: that.dialog.regionId,
  650. name: that.dialog.tagname,
  651. HardwareVersion: that.dialog.HardwareVersion,
  652. FirmwareVersion: that.dialog.FirmwareVersion,
  653. FirmwareScanM4Version: that.dialog.FirmwareScanM4Version,
  654. FirmwareScanM0Version: that.dialog.FirmwareScanM0Version,
  655. location: that.dialog.location,
  656. purchasesrc: that.dialog.purchasesrc,
  657. x: that.dialog.points[0].x,
  658. y: that.dialog.points[0].y,
  659. coords_memo: that.dialog.coords_memo,
  660. memo: that.dialog.memo,
  661. coordsType: 1,//坐标状态 0:禁用, 1:启用, 9:删除,没有就传0
  662. coordsID: that.dialog.CoordsId,
  663. status: that.dialog.status,
  664. };
  665. let postdata = qs.stringify(param);
  666. DetectorEdit(postdata).then(res => {
  667. let json = res;
  668. if (json.Code == 0) {
  669. that.$message({
  670. showClose: true,
  671. message: '设备添加成功!',
  672. type: 'success'
  673. });
  674. // 重载列表
  675. that.getTableQuery();
  676. that.dialog_state = false;
  677. } else {
  678. that.$message.error(json.Memo + ',错误代码:' + json.Code);
  679. }
  680. });
  681. },
  682. // 修改设备状态
  683. getDetectorEditStatus(detectorid, status, text) {
  684. let that = this;
  685. let param = {
  686. token: localStorage.token,
  687. detectorid: detectorid,
  688. status: status,
  689. };
  690. let postdata = qs.stringify(param);
  691. DetectorEditStatus(postdata).then(res => {
  692. let json = res;
  693. if (json.Code == 0) {
  694. that.$message({
  695. showClose: true,
  696. message: text + '成功!',
  697. type: 'success'
  698. });
  699. // table 重载
  700. that.getTableQuery();
  701. } else {
  702. that.$message.error(json.Memo + ',错误代码:' + json.Code);
  703. }
  704. })
  705. },
  706. // 禁用
  707. pauseRow(row) {
  708. let that = this;
  709. this.$confirm('是否禁用' + row.TagName + '设备?', '禁用操作', {
  710. confirmButtonText: '确定',
  711. cancelButtonText: '取消',
  712. type: 'warning'
  713. }).then(() => {
  714. that.getDetectorEditStatus(row.Id, 0, '禁用');
  715. }).catch(() => {
  716. this.$message({
  717. type: 'info',
  718. message: '已取消禁用'
  719. });
  720. });
  721. },
  722. // 获取区域位置的平面图
  723. getRegionPictureGetByRegionId(regionID) {
  724. let that = this;
  725. let param = {
  726. token: localStorage.token,
  727. regionID: regionID,
  728. regionId: regionID,
  729. };
  730. let postdata = qs.stringify(param);
  731. that.dialog.plateImgSrc = '../assets/img/main/grid.png'
  732. // RegionPictureGetByRegionId(postdata).then(res => {
  733. // let json = res;
  734. // that.dialog.plateImgSrc = '';
  735. // if (json.Code == 0) {
  736. // that.dialog.plateImgSrc = json.EncodeString;
  737. // } else {
  738. // that.$message.error(json.Memo + ',错误代码:' + json.Code);
  739. // }
  740. // })
  741. },
  742. // 启用
  743. runRow(row) {
  744. console.log(row);
  745. let that = this;
  746. this.$confirm('是否启用' + row.TagName + '设备?', '启用操作', {
  747. confirmButtonText: '确定',
  748. cancelButtonText: '取消',
  749. type: 'warning'
  750. }).then(() => {
  751. that.getDetectorEditStatus(row.Id, 1, '启用');
  752. }).catch(() => {
  753. this.$message({
  754. type: 'info',
  755. message: '已取消启用'
  756. });
  757. });
  758. },
  759. // 添加探测器位置的点坐标
  760. addPoint(e) {
  761. let x = e.offsetX;
  762. let y = e.offsetY;
  763. this.dialog.points = [{x: x, y: y}];
  764. },
  765. // 获取位置的文字内容
  766. selectRegionLabel(id) {
  767. let that = this;
  768. let selectedWorkName = {};
  769. // selectedWorkName = that.dialog.regionIdRoomOptions.filter(item => {
  770. selectedWorkName = that.dialog.regionlevelOneIdOptions.filter(item => {
  771. if (item.Id === id) {
  772. console.log(item.Name);
  773. that.dialog.location = item.Name;
  774. }
  775. });
  776. },
  777. filterTime(val, row, column) {
  778. return nonTfmtDate(column, 10);
  779. }
  780. }
  781. ,
  782. watch: {
  783. // 'dialog.regionlevelOneId': function (val) {
  784. // this.dialogGetGetChildRegionSelect(val, 2)
  785. // },
  786. 'dialog.regionId':
  787. function (val) {
  788. if (val) {
  789. this.getRegionPictureGetByRegionId(val);
  790. }
  791. }
  792. ,
  793. }
  794. ,
  795. components: {
  796. dialog_referrer_list
  797. }
  798. }
  799. </script>
  800. <style scoped>
  801. @import "../assets/css/panel.css";
  802. @import "../assets/css/dialog.css";
  803. .tabs ul {
  804. width: 168px;
  805. float: left;
  806. }
  807. table span {
  808. cursor: pointer;
  809. }
  810. .down_btn {
  811. float: left;
  812. }
  813. .content {
  814. width: 98%;
  815. overflow: hidden;
  816. display: block;
  817. margin: 0 auto;
  818. padding-left: 20px;
  819. }
  820. .selectStyle {
  821. width: 100%;
  822. color: #005EA2;
  823. }
  824. .selectStyle ::placeholder {
  825. color: #005EA2;
  826. }
  827. /deep/ .modal .el-select .el-input .el-select__caret {
  828. position: relative;
  829. top: 35px;
  830. }
  831. .imgContianer {
  832. width: 100%;
  833. height: 340px;
  834. overflow: hidden;
  835. display: block;
  836. margin: 0 auto;
  837. }
  838. .imgContianer img {
  839. width: 100%;
  840. height: 100%;
  841. overflow: hidden;
  842. display: block;
  843. margin: 0 auto;
  844. }
  845. .pointers {
  846. position: relative;
  847. bottom: 340px;
  848. width: 100%;
  849. height: 100%;
  850. overflow: hidden;
  851. display: block;
  852. margin: 0 auto;
  853. }
  854. .imgContianer i {
  855. position: relative;
  856. width: 10px;
  857. height: 10px;
  858. float: left;
  859. border-radius: 250px;
  860. background: #FFDD00;
  861. }
  862. /deep/ .modal-dialog {
  863. height: 80px;
  864. margin-top: 20px;
  865. }
  866. /deep/ textarea {
  867. color: #6DC1FF;
  868. }
  869. /deep/ .el-table__empty-text {
  870. color: #015B9E;
  871. }
  872. /deep/ .el-input.is-disabled .el-input__inner {
  873. background-color: #015B9E;
  874. }
  875. .red {
  876. color: red;
  877. }
  878. .yellow {
  879. color: #fd0;
  880. }
  881. </style>