baseinfo.vue 25 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790
  1. <template>
  2. <div id="app">
  3. <el-container class="container">
  4. <!-- 显示设备信息-->
  5. <el-main class="el-table">
  6. <div class="buttons" v-if="user.roleName!='企业用户'">
  7. <el-form :inline="true" class="demo-form-inline">
  8. <el-form-item>
  9. <el-input v-model="companyName" placeholder="企业名称" />
  10. </el-form-item>
  11. <el-form-item>
  12. <el-input v-model="deviceName" placeholder="设备名称" />
  13. </el-form-item>
  14. <el-form-item>
  15. <el-button type="primary" icon="el-icon-search" @click="search"
  16. >查询
  17. </el-button
  18. >
  19. <el-button
  20. type="warning"
  21. icon="el-icon-refresh-right"
  22. @click="test"
  23. >重置
  24. </el-button
  25. >
  26. <el-button
  27. type="success"
  28. icon="el-icon-circle-plus"
  29. @click="AddDevicedialogVisible = true"
  30. >新增
  31. </el-button
  32. >
  33. </el-form-item>
  34. </el-form>
  35. </div>
  36. <el-table :data="tableData" border>
  37. <el-table-column label="设备编号" align="center">
  38. <template slot-scope="scope" align="center">
  39. <span style="margin-left: 10px">{{ scope.row.deviceId }}</span>
  40. </template>
  41. </el-table-column>
  42. <el-table-column label="设备名称">
  43. <template slot-scope="scope" align="center">
  44. <span style="margin-left: 10px">{{ scope.row.deviceName }}</span>
  45. </template>
  46. </el-table-column>
  47. <el-table-column label="设备启用日期" align="center">
  48. <template slot-scope="scope">
  49. <span style="margin-left: 10px">{{
  50. scope.row.deviceStartDate
  51. }}</span>
  52. </template>
  53. </el-table-column>
  54. <el-table-column label="所属行业" align="center">
  55. <template slot-scope="scope">
  56. <span style="margin-left: 10px">{{
  57. scope.row.industryValue
  58. }}</span>
  59. </template>
  60. </el-table-column>
  61. <el-table-column label="粉尘类别" align="center">
  62. <template slot-scope="scope">
  63. <span style="margin-left: 10px">{{ scope.row.dustName }}</span>
  64. </template>
  65. </el-table-column>
  66. <el-table-column label="所属企业名称" align="center">
  67. <template slot-scope="scope">
  68. <span style="margin-left: 10px">{{ scope.row.companyName }}</span>
  69. </template>
  70. </el-table-column>
  71. <el-table-column label="设备位置" align="center">
  72. <template slot-scope="scope">
  73. <span style="margin-left: 10px">{{
  74. scope.row.deviceLocation
  75. }}</span>
  76. </template>
  77. </el-table-column>
  78. <el-table-column label="操作" align="center">
  79. <template slot-scope="scope">
  80. <el-tooltip content="编辑" placement="bottom" effect="light">
  81. <el-button
  82. type="primary"
  83. icon="el-icon-edit"
  84. circle
  85. @click="handleEdit(scope.row)"
  86. v-show="scope.row.editable!=0"
  87. />
  88. </el-tooltip>
  89. <el-tooltip content="删除" placement="bottom" effect="light">
  90. <el-button
  91. type="danger"
  92. icon="el-icon-delete"
  93. circle
  94. v-show="user.roleName!='企业用户'"
  95. @click="removeDeviceById(scope.row.deviceId)"
  96. />
  97. </el-tooltip>
  98. <el-tooltip content="设置工作时间" placement="bottom" effect="light">
  99. <el-button
  100. type="success"
  101. icon="el-icon-time"
  102. circle
  103. @click="timeSetting(scope.row)"
  104. />
  105. </el-tooltip>
  106. <el-tooltip content="解除编辑锁定" placement="bottom" effect="light">
  107. <el-button
  108. type="warning"
  109. icon="el-icon-lock"
  110. circle
  111. v-show="user.roleName!='企业用户'&&scope.row.editable!='1'"
  112. @click="unlockEdit(scope.row.deviceId)"
  113. />
  114. </el-tooltip>
  115. </template>
  116. </el-table-column>
  117. <el-table-column label="传感器" align="center">
  118. <template slot-scope="scope">
  119. <el-tooltip content="传感器管理" placement="bottom" effect="light">
  120. <el-button
  121. type="primary"
  122. icon="el-icon-odometer"
  123. circle
  124. @click="sensorInfo(scope.row.deviceId)"
  125. />
  126. </el-tooltip>
  127. </template>
  128. </el-table-column>
  129. </el-table>
  130. <div class="block">
  131. <span class="demonstration" />
  132. <pagination
  133. v-show="total > 0"
  134. :total="total"
  135. :page.sync="pagination.num"
  136. :limit.sync="pagination.size"
  137. @pagination="test"
  138. />
  139. </div>
  140. </el-main>
  141. </el-container>
  142. <!-- //编辑信息-->
  143. <el-dialog
  144. title="设备信息编辑"
  145. :visible.sync="dialogFormVisible"
  146. width="28%"
  147. @close="closedFun"
  148. >
  149. <el-form :model="form01">
  150. <el-form-item label="设备编号">
  151. <el-col :span="11">
  152. <el-input v-model="form01.deviceId" disabled />
  153. </el-col>
  154. </el-form-item>
  155. <el-form-item label="设备名称">
  156. <el-col :span="11">
  157. <el-input v-model="form01.deviceName" />
  158. </el-col>
  159. </el-form-item>
  160. <el-form-item label="设备启用日期">
  161. <el-col :span="11">
  162. <!-- <el-input v-model="form01.deviceStartDate" />-->
  163. <el-date-picker
  164. v-model="form01.deviceStartDate"
  165. type="date"
  166. placeholder="选择日期"
  167. value-format="yyyy-MM-dd"
  168. style="width: 100%"
  169. />
  170. </el-col>
  171. </el-form-item>
  172. <el-form-item label="行业编码/粉尘类别">
  173. <span class="demonstration" />
  174. <el-cascader
  175. ref="cascader"
  176. v-model="form01.industryCode"
  177. placeholder="行业编码/粉尘类别"
  178. :options="cascader_options"
  179. filterable
  180. />
  181. </el-form-item>
  182. <el-form-item label="所属企业id" hidden>
  183. <el-col :span="11">
  184. <el-input v-model="form01.companyId" />
  185. </el-col>
  186. </el-form-item>
  187. <el-form-item label="所属企业名称">
  188. <el-col :span="11">
  189. <el-autocomplete
  190. v-model="form01.companyName"
  191. class="inline-input"
  192. :fetch-suggestions="querySearch"
  193. placeholder="请输入内容"
  194. :trigger-on-focus="false"
  195. @select="handleSelect"
  196. aria-readonly="true"
  197. />
  198. </el-col>
  199. </el-form-item>
  200. <el-form-item label="设备位置">
  201. <el-col :span="11">
  202. <el-input v-model="form01.deviceLocation" />
  203. </el-col>
  204. </el-form-item>
  205. <el-form-item label="经度">
  206. <el-col :span="11">
  207. <el-input v-model="form01.longitude" />
  208. </el-col>
  209. </el-form-item>
  210. <el-form-item label="纬度">
  211. <el-col :span="11">
  212. <el-input v-model="form01.latitude" />
  213. </el-col>
  214. </el-form-item>
  215. </el-form>
  216. <div slot="footer" class="dialog-footer">
  217. <el-button @click="dialogFormVisible = false">取 消</el-button>
  218. <el-button type="primary" @click="submitEdit">确 定</el-button>
  219. </div>
  220. </el-dialog>
  221. <!-- // 新增设备信息-->
  222. <el-dialog
  223. title="新增设备信息"
  224. :visible.sync="AddDevicedialogVisible"
  225. width="35%"
  226. @close="closedFun"
  227. >
  228. <el-form ref="form" :model="form" label-width="100px">
  229. <el-form-item label="设备编号">
  230. <el-input v-model="form.deviceId" />
  231. </el-form-item>
  232. <el-form-item label="设备名称">
  233. <el-input v-model="form.deviceName" />
  234. </el-form-item>
  235. <el-form-item label="设备启用日期">
  236. <el-col>
  237. <el-date-picker
  238. v-model="form.deviceStartDate"
  239. type="date"
  240. placeholder="选择日期"
  241. value-format="yyyy-MM-dd"
  242. style="width: 100%"
  243. />
  244. </el-col>
  245. </el-form-item>
  246. <el-form-item label="行业编码/粉尘类别">
  247. <span class="demonstration" />
  248. <el-cascader
  249. ref="cascader"
  250. v-model="form.industryCode"
  251. placeholder="行业编码/粉尘类别"
  252. :options="cascader_options"
  253. filterable
  254. />
  255. </el-form-item>
  256. <el-form-item label="所属企业名称">
  257. <el-autocomplete
  258. v-model="form.companyName"
  259. class="inline-input"
  260. :fetch-suggestions="querySearch"
  261. placeholder="请输入内容"
  262. :trigger-on-focus="false"
  263. @select="handleSelect"
  264. />
  265. </el-form-item>
  266. <el-form-item label="企业编码" hidden>
  267. <el-input v-model="form.companyId" />
  268. </el-form-item>
  269. <el-form-item label="功能区" hidden>
  270. <el-input v-model="form.possession" />
  271. </el-form-item>
  272. <el-form-item label="设备位置">
  273. <el-input v-model="form.deviceLocation" />
  274. </el-form-item>
  275. <el-form-item label="经度">
  276. <el-input v-model="form.longitude" />
  277. </el-form-item>
  278. <el-form-item label="纬度">
  279. <el-input v-model="form.latitude" />
  280. </el-form-item>
  281. <el-form-item>
  282. <el-button type="primary" @click="onSubmit">立即创建</el-button>
  283. <el-button @click="AddDevicedialogVisible = false">取消</el-button>
  284. </el-form-item>
  285. </el-form>
  286. </el-dialog>
  287. <!-- 传感器-->
  288. <el-dialog
  289. title="传感器"
  290. :visible.sync="senorDialogVisible"
  291. width="50%"
  292. @close="closedFun"
  293. >
  294. <div class="buttons" style="width: 95%; margin: auto">
  295. <el-form :inline="true" class="demo-form-inline">
  296. <el-form-item>
  297. <el-button
  298. type="primary"
  299. icon="el-icon-add"
  300. @click="handleAddSenor()"
  301. >新增传感器
  302. </el-button
  303. >
  304. </el-form-item>
  305. </el-form>
  306. <el-table :data="SenortableData" border>
  307. <el-table-column fixed prop="sensorId" label="id" align="center">
  308. <template slot-scope="scope">
  309. <span style="margin-left: 10px">{{ scope.row.id }}</span>
  310. </template>
  311. </el-table-column>
  312. <el-table-column
  313. fixed
  314. prop="sensorId"
  315. label="传感器编号"
  316. align="center"
  317. >
  318. <template slot-scope="scope">
  319. <span style="margin-left: 10px">{{ scope.row.sensorId }}</span>
  320. </template>
  321. </el-table-column>
  322. <el-table-column prop="deviceId" label="所属设备编号" align="center">
  323. <template slot-scope="scope">
  324. <span style="margin-left: 10px">{{ scope.row.deviceId }}</span>
  325. </template>
  326. </el-table-column>
  327. <el-table-column prop="sensorName" label="传感器名称" align="center">
  328. <template slot-scope="scope">
  329. <span style="margin-left: 10px">{{ scope.row.sensorName }}</span>
  330. </template>
  331. </el-table-column>
  332. <el-table-column prop="sensorUnit" label="传感器单位" align="center">
  333. <template slot-scope="scope">
  334. <span style="margin-left: 10px">{{ scope.row.sensorUnit }}</span>
  335. </template>
  336. </el-table-column>
  337. <el-table-column
  338. label="操作"
  339. class-name="small-padding fixed-width"
  340. style="display: block"
  341. align="center"
  342. >
  343. <template slot-scope="scope">
  344. <el-button
  345. class="el-icon-edit table-operation"
  346. style="color: #2db7f5; margin-right: -30px"
  347. type="text"
  348. size="small"
  349. @click="SenorhandleEdit(scope.$index, scope.row)"
  350. />
  351. <el-button
  352. class="el-icon-delete table-operation"
  353. style="color: #f50; margin-right: -30px"
  354. type="text"
  355. size="small"
  356. @click="removeSenorById(scope.row.id)"
  357. />
  358. </template>
  359. </el-table-column>
  360. </el-table>
  361. </div>
  362. </el-dialog>
  363. <!-- 新增传感器-->
  364. <el-dialog
  365. title="新增传感器"
  366. :visible.sync="AddSenordialogVisible"
  367. width="35%"
  368. @close="closedFun"
  369. >
  370. <el-form ref="form" :model="senorform" label-width="100px">
  371. <el-form-item label="传感器编号">
  372. <el-input v-model="senorform.sensorId" />
  373. </el-form-item>
  374. <el-form-item label="所属设备编号">
  375. <el-input v-model="senorform.deviceId" />
  376. </el-form-item>
  377. <el-form-item label="传感器名称">
  378. <el-input v-model="senorform.sensorName" />
  379. </el-form-item>
  380. <el-form-item label="传感器单位">
  381. <el-input v-model="senorform.sensorUnit" />
  382. </el-form-item>
  383. <el-form-item>
  384. <el-button type="primary" @click="SenoronSubmit">立即创建</el-button>
  385. <el-button @click="AddSenordialogVisible = false">取消</el-button>
  386. </el-form-item>
  387. </el-form>
  388. </el-dialog>
  389. <!-- 编辑传感器-->
  390. <el-dialog
  391. title="设备信息编辑"
  392. :visible.sync="EditSenordialogVisible"
  393. width="28%"
  394. >
  395. <el-form :model="senorformEdit">
  396. <el-form-item label="传感器编号">
  397. <el-col :span="11">
  398. <el-input v-model="senorformEdit.sensorId" />
  399. </el-col>
  400. </el-form-item>
  401. <el-form-item label="所属设备编号">
  402. <el-col :span="11">
  403. <el-input v-model="senorformEdit.deviceId" />
  404. </el-col>
  405. </el-form-item>
  406. <el-form-item label="传感器名称">
  407. <el-col :span="11">
  408. <el-input v-model="senorformEdit.sensorName" />
  409. </el-col>
  410. </el-form-item>
  411. <el-form-item label="传感器单位">
  412. <el-col :span="11">
  413. <el-input v-model="senorformEdit.sensorUnit" />
  414. </el-col>
  415. </el-form-item>
  416. </el-form>
  417. <div slot="footer" class="dialog-footer">
  418. <el-button @click="EditSenordialogVisible = false">取 消</el-button>
  419. <el-button type="primary" @click="submitSenorEdit">确 定</el-button>
  420. </div>
  421. </el-dialog>
  422. <!-- 工作时间设置-->
  423. <el-dialog
  424. title="工作时间设置"
  425. :visible.sync="timesettingdialogVisible"
  426. width="28%"
  427. @close="closedTimePicker"
  428. >
  429. <div style="text-align: center">
  430. <el-time-picker
  431. is-range
  432. v-model="workTime"
  433. value-format="HH:mm:ss"
  434. range-separator="-"
  435. style="text-align: center"
  436. start-placeholder="开始时间"
  437. end-placeholder="结束时间"
  438. >
  439. </el-time-picker>
  440. <div slot="footer" class="dialog-footer" style="margin-top: 25px">
  441. <el-button @click="timesettingdialogVisible = false">取 消</el-button>
  442. <el-button type="primary" @click="setWorkTime">确 定</el-button>
  443. </div>
  444. </div>
  445. </el-dialog>
  446. </div>
  447. </template>
  448. <script>
  449. import Pagination from '@/components/Pagination'
  450. export default {
  451. components: { Pagination },
  452. data() {
  453. return {
  454. companyName: '',
  455. deviceName: '',
  456. workTime: [],
  457. tableData: [],
  458. pagesize: 8,
  459. currentPage: 1,
  460. dialogFormVisible: false,
  461. form: {},
  462. form01: {},
  463. formSenor: {},
  464. senorform: {},
  465. senorformEdit: {},
  466. deviceId: null,
  467. AddDevicedialogVisible: false,
  468. AddSenordialogVisible: false,
  469. EditSenordialogVisible: false,
  470. timesettingdialogVisible: false,
  471. senorDialogVisible: false,
  472. devicethreshold: false,
  473. total: 0,
  474. industryCode: [],
  475. cascader_options: [],
  476. SenortableData: [],
  477. params: {},
  478. pagination: {
  479. size: 10,
  480. num: 1
  481. }
  482. }
  483. },
  484. created() {
  485. this.test()
  486. this.jilian()
  487. // this.Serortest();
  488. },
  489. computed: {
  490. user() {
  491. return this.$store.state.account.user
  492. }
  493. },
  494. mounted() {
  495. },
  496. methods: {
  497. timeSetting(row) {
  498. console.log(row)
  499. this.deviceId = row.deviceId
  500. if (row.workTimeFrom != null) {
  501. this.workTime = [row.workTimeFrom, row.workTimeTo]
  502. }
  503. this.timesettingdialogVisible = true
  504. },
  505. closedTimePicker() {
  506. this.workTime = ''
  507. },
  508. setWorkTime() {
  509. const arr = this.workTime
  510. this.$post('/demp/info/deviceInfo/setWorkTime/', {
  511. from: arr[0],
  512. to: arr[1],
  513. id: this.deviceId
  514. })
  515. .then(() => {
  516. this.$message({
  517. message: this.$t('设置成功!'),
  518. type: 'success'
  519. })
  520. this.timesettingdialogVisible = false
  521. this.search()
  522. })
  523. .catch((r) => {
  524. })
  525. },
  526. unlockEdit(id) {
  527. this.$post('/demp/info/deviceInfo/unlockEdit/', {
  528. id: id
  529. })
  530. .then(() => {
  531. this.$message({
  532. message: this.$t('设置成功!'),
  533. type: 'success'
  534. })
  535. this.timesettingdialogVisible = false
  536. this.search()
  537. })
  538. .catch((r) => {
  539. })
  540. },
  541. // 编辑传感器信息
  542. submitSenorEdit() {
  543. this.$put('/demp/info/sensorInfo/', this.senorformEdit)
  544. .then(() => {
  545. this.$message({
  546. message: this.$t('传感器信息修改成功'),
  547. type: 'success'
  548. })
  549. // this.$emit("success");
  550. this.EditSenordialogVisible = false
  551. this.sensorInfo(this.deviceId)
  552. this.senorform = {}
  553. })
  554. .catch((r) => {
  555. })
  556. },
  557. // 修改设备信息
  558. submitEdit() {
  559. const nodesObj = this.$refs['cascader'].getCheckedNodes(true)
  560. const newform = this.form01
  561. newform.industryCode = this.form01.industryCode[0]
  562. newform.dustType = nodesObj[0].value
  563. this.$put('/demp/info/deviceInfo/', newform)
  564. .then(() => {
  565. this.$message({
  566. message: this.$t('设备信息修改成功'),
  567. type: 'success'
  568. })
  569. // this.$emit('success')
  570. this.dialogFormVisible = false
  571. this.search()
  572. })
  573. .catch((r) => {
  574. })
  575. },
  576. closedFun() {
  577. this.form = {}
  578. this.form01 = {}
  579. },
  580. // 初始页currentPage、初始每页数据数pagesize和数据data
  581. handleSizeChange: function(size) {
  582. this.pagesize = size
  583. console.log(this.pagesize) // 每页下拉显示数据
  584. this.test()
  585. },
  586. handleCurrentChange: function(currentPage) {
  587. this.currentPage = currentPage
  588. console.log(this.currentPage) // 点击第几页
  589. },
  590. querySearch(queryString, cb) {
  591. var list = [{}]
  592. this.$get(
  593. 'demp/info/companyInfo/getThirdPartyCompanyInfo?companyName=' +
  594. queryString
  595. // enterpriseName: this.companyName
  596. ).then((r) => {
  597. for (const i of r.data.datas) {
  598. i.value = i.enterpriseName // 将想要展示的数据作为value
  599. }
  600. list = r.data.datas
  601. cb(list)
  602. })
  603. },
  604. handleSelect(item) {
  605. this.form.companyId = item.id
  606. this.form.possession = item.possession
  607. this.form01.companyId = item.id
  608. this.form01.possession = item.possession
  609. },
  610. onSubmit() {
  611. const nodesObj = this.$refs['cascader'].getCheckedNodes(true)
  612. const newform = this.form
  613. newform.industryCode = this.form.industryCode[0]
  614. newform.dustType = nodesObj[0].value
  615. this.$post('/demp/info/deviceInfo', newform)
  616. .then(() => {
  617. this.$message({
  618. message: this.$t('tips.createSuccess'),
  619. type: 'success'
  620. })
  621. // this.$emit("success");
  622. this.AddDevicedialogVisible = false
  623. this.search()
  624. })
  625. .catch((r) => {
  626. })
  627. },
  628. getCascaderObj(val, opt) {
  629. return val.map(function(value, index, array) {
  630. for (var itm of opt) {
  631. if (itm.id == value) {
  632. opt = itm.children
  633. return itm
  634. }
  635. }
  636. return null
  637. })
  638. },
  639. handleAddSenor() {
  640. this.senorform.deviceId = this.deviceId
  641. this.AddSenordialogVisible = true
  642. },
  643. SenoronSubmit() {
  644. this.$post('/demp/info/sensorInfo/', this.senorform)
  645. .then(() => {
  646. this.$message({
  647. message: this.$t('tips.createSuccess'),
  648. type: 'success'
  649. })
  650. // this.$emit("success");
  651. this.AddSenordialogVisible = false
  652. this.sensorInfo(this.senorform.deviceId)
  653. this.senorform = {}
  654. })
  655. .catch((r) => {
  656. })
  657. },
  658. async removeDeviceById(id) {
  659. const ids = [id]
  660. const comfirmResult = await this.$confirm(
  661. '此操作将永久删除该设备, 是否继续?',
  662. '提示',
  663. {
  664. confirmButtonText: '确定',
  665. cancelButtonText: '取消',
  666. type: 'warning'
  667. }
  668. ).catch((err) => {
  669. return err
  670. })
  671. if (comfirmResult !== 'confirm') {
  672. return this.$message.info('取消删除设备')
  673. }
  674. this.$delete(`demp/info/deviceInfo/${ids}`).then(() => {
  675. this.$message({
  676. message: this.$t('tips.deleteSuccess'),
  677. type: 'success'
  678. })
  679. this.search()
  680. })
  681. },
  682. async removeSenorById(id) {
  683. console.log(id)
  684. const comfirmResult = await this.$confirm(
  685. '此操作将永久删除该传感器, 是否继续?',
  686. '提示',
  687. {
  688. confirmButtonText: '确定',
  689. cancelButtonText: '取消',
  690. type: 'warning'
  691. }
  692. ).catch((err) => {
  693. return err
  694. })
  695. if (comfirmResult !== 'confirm') {
  696. return this.$message.info('取消删除传感器')
  697. }
  698. this.$delete('demp/info/sensorInfo', {
  699. id
  700. }).then((r) => {
  701. this.$message({
  702. message: this.$t('tips.deleteSuccess'),
  703. type: 'success'
  704. })
  705. this.sensorInfo(this.deviceId)
  706. // console.log(r.data.rows);
  707. })
  708. },
  709. search() {
  710. this.$get('demp/info/deviceInfo/list', {
  711. companyName: this.companyName,
  712. deviceName: this.deviceName,
  713. pageSize: this.pagination.size,
  714. pageNum: this.pagination.num
  715. }).then((r) => {
  716. this.tableData = r.data.data.rows
  717. this.total = r.data.data.total
  718. })
  719. },
  720. handleView(index, row) {
  721. console.log(index, row)
  722. },
  723. handleEdit(row) {
  724. const row_ = JSON.parse(JSON.stringify(row))
  725. this.form01 = row_
  726. this.form01.industryCode = [row_.industryCode, row_.dustType]
  727. // this.form01.industryCode = row.industryCode
  728. this.dialogFormVisible = true
  729. },
  730. SenorhandleEdit(index, row) {
  731. this.senorformEdit = row
  732. this.EditSenordialogVisible = true
  733. console.log(index, row)
  734. },
  735. handleThreshold(id) {
  736. this.form.deviceId = id
  737. this.devicethreshold = true
  738. },
  739. test() {
  740. this.params.pageSize = this.pagination.size
  741. this.params.pageNum = this.pagination.num
  742. this.$get('/demp/info/deviceInfo/list', { ...this.params }).then((r) => {
  743. this.tableData = r.data.data.rows
  744. this.total = r.data.data.total
  745. this.companyName = ''
  746. this.deviceName = ''
  747. })
  748. },
  749. sensorInfo(deviceId) {
  750. this.deviceId = deviceId
  751. this.senorDialogVisible = true
  752. this.$get('/demp/info/sensorInfo/list', { deviceId }).then((r) => {
  753. this.SenortableData = r.data.data.rows
  754. this.totals = r.data.data.total
  755. })
  756. },
  757. jilian() {
  758. this.$get('demp/info/codeIndustry').then((r) => {
  759. for (let i = 0; i < r.data.data.length; i++) {
  760. r.data.data[i].label = r.data.data[i].value
  761. r.data.data[i].value = r.data.data[i].code
  762. r.data.data[i].children = []
  763. this.cascader_options.push(r.data.data[i])
  764. this.$get(
  765. 'demp/info/codeDustType?industryCode=' +
  766. this.cascader_options[i].value
  767. ).then((ri) => {
  768. for (let j = 0; j < ri.data.data.length; j++) {
  769. this.cascader_options[i].children.push({
  770. label: ri.data.data[j].dustName,
  771. value: ri.data.data[j].code
  772. })
  773. }
  774. })
  775. }
  776. })
  777. }
  778. }
  779. }
  780. </script>
  781. <style>
  782. h1 {
  783. text-align: center;
  784. font-weight: normal;
  785. }
  786. </style>