deviceList.vue 42 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324
  1. <!--物联设备配置-->
  2. <template>
  3. <div class="deviceList scrollbar-box">
  4. <div class="title-box">
  5. <p class="left-title">传感器</p>
  6. <p class="right-button reset-button-one" @click="backPage">返回</p>
  7. </div>
  8. <div class="for-max-box">
  9. <div class="for-big-box" v-for="(item,index) in listCgq" :key="index">
  10. <p class="for-title-p">{{subjectData.room}}-{{item.type.name}}传感器{{index+1}}</p>
  11. <div class="for-text-box">
  12. <p>网关编号:</p>
  13. <el-tooltip class="item" effect="dark" :content="item.gatewayId" placement="top">
  14. <p>{{item.gatewayId}}</p>
  15. </el-tooltip>
  16. </div>
  17. <div class="for-button-box">
  18. <p @click="editData(5,item)"><i class="el-icon-edit-outline"></i>编辑</p>
  19. <p></p>
  20. <p @click="delSensor(item)"><i class="el-icon-delete"></i>删除</p>
  21. </div>
  22. </div>
  23. <p class="add-for-p" @click="addData(1)"><i class="el-icon-plus"></i>添加传感器</p>
  24. </div>
  25. <div class="title-box" v-if="subjectData.hardwareType==1">
  26. <p class="left-title">智能门禁</p>
  27. </div>
  28. <div class="for-max-box" v-if="subjectData.hardwareType==1">
  29. <div class="for-big-box" v-for="(item,index) in listHK" :key="index" style="width: 350px">
  30. <p class="for-title-p">{{item.type.name}}-{{item.name}}</p>
  31. <div class="for-text-box">
  32. <p>门禁编号:</p>
  33. <el-tooltip class="item" effect="dark" :content="item.hardwareNum" placement="top">
  34. <p>{{item.hardwareNum}}</p>
  35. </el-tooltip>
  36. </div>
  37. <div class="for-text-box">
  38. <p>门禁授权:</p>
  39. <el-checkbox-group v-model="item.controlScope==null?[]:item.controlScope.split(',')" style="margin-top: 6px" disabled>
  40. <el-checkbox label="1" style="margin-right: 8px">关联安全准入</el-checkbox>
  41. <el-checkbox label="2">关联白名单</el-checkbox>
  42. </el-checkbox-group>
  43. </div>
  44. <div class="for-button-box">
  45. <p @click="editData('editEntrance',item)"><i class="el-icon-edit-outline"></i>编辑</p>
  46. <p></p>
  47. <p @click="delEntrance(item)"><i class="el-icon-delete"></i>删除</p>
  48. </div>
  49. </div>
  50. <p class="add-for-p" @click="addData('addEntrance')" style="width: 350px;height: 158px;" v-if="listHK.length<3"><i class="el-icon-plus"></i>添加智能门禁</p>
  51. </div>
  52. <div class="title-box">
  53. <p class="left-title">一体机</p>
  54. </div>
  55. <div class="for-max-box">
  56. <div class="for-big-box" v-for="(item,index) in listYtj" :key="index">
  57. <p class="for-title-p">{{subjectData.room}}-{{item.type.name}}{{index+1}}</p>
  58. <div class="for-text-box">
  59. <p>一体机编号:</p>
  60. <el-tooltip class="item" effect="dark" :content="item.hardwareNum" placement="top">
  61. <p>{{item.hardwareNum}}</p>
  62. </el-tooltip>
  63. </div>
  64. <div class="for-button-box">
  65. <p @click="editData(6,item)"><i class="el-icon-edit-outline"></i>编辑</p>
  66. <p></p>
  67. <p @click="delHardware(item)"><i class="el-icon-delete"></i>删除</p>
  68. </div>
  69. </div>
  70. <p class="add-for-p" @click="addData(2)"><i class="el-icon-plus"></i>添加一体机</p>
  71. </div>
  72. <div class="title-box">
  73. <p class="left-title">控制设备</p>
  74. </div>
  75. <div class="for-max-box">
  76. <div class="for-big-box-two" v-for="(item,index) in listkzsb" :key="index">
  77. <p class="for-title-p">{{subjectData.room}}-{{item.type.name}}传感器{{index+1}}</p>
  78. <div class="for-text-box">
  79. <p>设备编号:</p>
  80. <el-tooltip class="item" effect="dark" :content="item.relayCode" placement="top">
  81. <p>{{item.relayCode}}</p>
  82. </el-tooltip>
  83. </div>
  84. <div class="for-text-box">
  85. <p>设备路由:</p>
  86. <p>{{item.bit}}</p>
  87. </div>
  88. <div class="for-button-box">
  89. <p @click="editData(7,item)"><i class="el-icon-edit-outline"></i>编辑</p>
  90. <p></p>
  91. <p @click="delHardwareTwo(item)"><i class="el-icon-delete"></i>删除</p>
  92. </div>
  93. </div>
  94. <p class="add-for-p-two" @click="addData(3)"><i class="el-icon-plus"></i>添加控制设备</p>
  95. </div>
  96. <div class="title-box">
  97. <p class="left-title">摄像头</p>
  98. </div>
  99. <div class="for-max-box">
  100. <div class="for-big-box" v-for="(item,index) in listSpjk" :key="index">
  101. <p class="for-title-p">{{subjectData.room}}-{{item.type.name}}{{index+1}}</p>
  102. <div class="for-text-box">
  103. <p>摄像头编号:</p>
  104. <p></p>
  105. </div>
  106. <div class="for-text-box">
  107. <p></p>
  108. <el-tooltip class="item" effect="dark" :content="item.hardwareNum" placement="top">
  109. <p>{{item.hardwareNum}}</p>
  110. </el-tooltip>
  111. </div>
  112. <div class="for-button-box">
  113. <p @click="editData(8,item)"><i class="el-icon-edit-outline"></i>编辑</p>
  114. <p></p>
  115. <p @click="delHardwareThree(item)"><i class="el-icon-delete"></i>删除</p>
  116. </div>
  117. </div>
  118. <p class="add-for-p-two" @click="addData(4)"><i class="el-icon-plus"></i>添加摄像头</p>
  119. </div>
  120. <div class="title-box" v-if="subjectData.hardwareType==2">
  121. <p class="left-title">电子信息牌</p>
  122. </div>
  123. <div class="for-max-box" v-if="subjectData.hardwareType==2">
  124. <div class="for-big-box" v-for="(item,index) in listXxp" :key="index">
  125. <p class="for-title-p">{{subjectData.room}}-{{item.cardName}}{{index+1}}</p>
  126. <div class="for-text-box">
  127. <p>设备编号:</p>
  128. <el-tooltip class="item" effect="dark" :content="item.cardNum" placement="top">
  129. <p>{{item.cardNum}}</p>
  130. </el-tooltip>
  131. </div>
  132. <div class="for-button-box">
  133. <p @click="editData('editSign',item)"><i class="el-icon-edit-outline"></i>编辑</p>
  134. <p></p>
  135. <p @click="delSign(item)"><i class="el-icon-delete"></i>删除</p>
  136. </div>
  137. </div>
  138. <p class="add-for-p" @click="addData('addSign')" v-if="listXxp.length<1"><i class="el-icon-plus"></i>添加信息牌</p>
  139. </div>
  140. <el-dialog :title="title" :visible.sync="addType" v-if="addType" width="500px" append-to-body>
  141. <el-form ref="form" :model="form" :rules="rules" label-width="110px">
  142. <div v-if="upType == 1 || upType == 5">
  143. <el-form-item label="传感器类型" prop="type">
  144. <el-select v-model="form.type" placeholder="请选择传感器类型" style="width:320px;">
  145. <el-option
  146. v-for="item in sensorAddOptions"
  147. :key="item.enumName"
  148. :label="item.name"
  149. :value="item.enumName">
  150. </el-option>
  151. </el-select>
  152. </el-form-item>
  153. <el-form-item label="网关编号" prop="gatewayId">
  154. <el-input v-model="form.gatewayId" placeholder="请输入网关编号"
  155. maxlength="30" style="width:320px;"/>
  156. </el-form-item>
  157. <el-form-item label="路由" prop="routeNum">
  158. <el-input v-model="form.routeNum" oninput="value=value.replace(/[^0-9.]/g,'')" maxlength="2" placeholder="请输入路由" style="width:320px;"></el-input>
  159. </el-form-item>
  160. <el-form-item label="传感器参数" prop="configName">
  161. <el-input v-model="form.configName" placeholder="请输入传感器参数"
  162. maxlength="30" style="width:320px;"></el-input>
  163. </el-form-item>
  164. <el-form-item label="状态参数" prop="configStatus">
  165. <el-input v-model="form.configStatus" placeholder="请输入状态参数"
  166. maxlength="30" style="width:320px;"></el-input>
  167. </el-form-item>
  168. </div>
  169. <div v-if="upType == 2 || upType == 6">
  170. <el-form-item label="一体机名称" prop="name">
  171. <el-input
  172. style="width:320px;"
  173. v-model="form.name"
  174. placeholder="请输入一体机名称"
  175. maxlength="8"
  176. size="small"
  177. />
  178. </el-form-item>
  179. <el-form-item label="一体机类型" prop="pcType">
  180. <el-select v-model="form.pcType" placeholder="请选择一体机类型" style="width:320px;">
  181. <el-option label="管控一体机" value="0" />
  182. <el-option label="学习一体机" value="1" />
  183. </el-select>
  184. </el-form-item>
  185. <el-form-item label="一体机编号" prop="hardwareNum">
  186. <el-input
  187. style="width:320px;"
  188. v-model="form.hardwareNum"
  189. placeholder="请输入一体机编号"
  190. maxlength="30"
  191. size="small"
  192. />
  193. </el-form-item>
  194. </div>
  195. <div v-if="upType == 3 || upType == 7">
  196. <el-form-item label="设备类型" prop="type">
  197. <el-select v-model="form.type" placeholder="请选择设备类型" style="width:320px;" :disabled="disabledType">
  198. <el-option key="1" label="电源开关" value="1"></el-option>
  199. <el-option key="2" label="智能通风" value="2"></el-option>
  200. </el-select>
  201. </el-form-item>
  202. <el-form-item label="硬件名称" prop="name">
  203. <el-input
  204. v-model="form.name"
  205. placeholder="请输入硬件名称"
  206. clearable
  207. size="small"
  208. maxLength="8"
  209. />
  210. </el-form-item>
  211. <el-form-item label="继电器类型" prop="hardwareType">
  212. <el-radio-group v-model="form.hardwareType">
  213. <el-radio :label="1">老继电器</el-radio>
  214. <el-radio :label="2">新继电器</el-radio>
  215. <el-radio :label="3">泥人继电器</el-radio>
  216. </el-radio-group>
  217. </el-form-item>
  218. <el-form-item label="绑定继电器" prop="relayCode" v-if="form.hardwareType==1 || form.hardwareType==3">
  219. <el-select v-model="form.relayCode" placeholder="请选择继电器" clearable @change="loadRelayNum" @clear="loadClear">
  220. <el-option v-for="relay in relayList"
  221. :key="relay.code"
  222. :label="relay.code"
  223. :value="relay.code">
  224. </el-option>
  225. </el-select>
  226. </el-form-item>
  227. <el-form-item label="继电器编号" prop="relayCode" v-if="form.hardwareType==2">
  228. <el-input
  229. v-model="form.relayCode"
  230. placeholder="请输入继电器编号"
  231. clearable
  232. size="small"
  233. maxlength="20"
  234. />
  235. </el-form-item>
  236. <el-form-item label="继电器位置" prop="bit" >
  237. <el-select v-model="form.bit" placeholder="请选择继电器位置" clearable >
  238. <el-option v-for="lab in relayNumList"
  239. :key="lab.name"
  240. :label="lab.name"
  241. :value="lab.name">
  242. </el-option>
  243. </el-select>
  244. </el-form-item>
  245. <el-form-item label="是否灭火主机" prop="isPcfire">
  246. <el-radio-group v-model="form.isPcfire">
  247. <el-radio :label="0">否</el-radio>
  248. <el-radio :label="1">是</el-radio>
  249. </el-radio-group>
  250. </el-form-item>
  251. <el-form-item label="配置名称" prop="configName" v-if="form.hardwareType == 2">
  252. <el-input v-model="form.configName" maxlength="30" placeholder="请输入配置名称" style="width:320px;"></el-input>
  253. </el-form-item>
  254. <el-form-item label="配置状态" prop="configStatus" v-if="form.hardwareType == 2">
  255. <el-input v-model="form.configStatus" maxlength="30" placeholder="请输入配置状态" style="width:320px;"></el-input>
  256. </el-form-item>
  257. </div>
  258. <div v-if="upType == 4 || upType == 8">
  259. <el-form-item label="摄像头编号" prop="hardwareNum">
  260. <el-input v-model="form.hardwareNum" placeholder="摄像头编号"
  261. maxlength="30" style="width:320px;"/>
  262. </el-form-item>
  263. </div>
  264. <div v-if="upType == 'addEntrance'|| upType=='editEntrance'">
  265. <el-form-item label="门禁编号" prop="hardwareNum">
  266. <el-input
  267. style="width:320px;"
  268. v-model="form.hardwareNum"
  269. placeholder="请输入门禁编号"
  270. maxlength="20"
  271. size="small"
  272. />
  273. </el-form-item>
  274. <el-form-item label="门禁名称" prop="name" >
  275. <el-input
  276. style="width:320px;"
  277. v-model="form.name"
  278. placeholder="请输入门禁名称"
  279. maxlength="8"
  280. size="small"
  281. />
  282. </el-form-item>
  283. <el-form-item label="IP" prop="ipAddress" >
  284. <el-input
  285. style="width:320px;"
  286. v-model="form.ipAddress"
  287. placeholder="请输入IP"
  288. maxlength="15"
  289. size="small"
  290. />
  291. </el-form-item>
  292. <el-form-item label="端口" prop="port" >
  293. <el-input
  294. style="width:320px;"
  295. v-model="form.port"
  296. placeholder="请输入端口"
  297. maxlength="6"
  298. size="small"
  299. />
  300. </el-form-item>
  301. <el-form-item label="设备管理证号" prop="harUser" >
  302. <el-input
  303. style="width:320px;"
  304. v-model="form.harUser"
  305. placeholder="请输入设备管理证号"
  306. maxlength="30"
  307. size="small"
  308. />
  309. </el-form-item>
  310. <el-form-item label="设备管理密码" prop="harPsw" >
  311. <el-input
  312. style="width:320px;"
  313. v-model="form.harPsw"
  314. placeholder="请输入设备管理密码"
  315. maxlength="30"
  316. size="small"
  317. />
  318. </el-form-item>
  319. <el-form-item label="门禁权限" style="margin-bottom: 0">
  320. <el-checkbox-group v-model="form.controlScope">
  321. <el-checkbox label="1" >关联安全准入</el-checkbox>
  322. <el-checkbox label="2">关联白名单</el-checkbox>
  323. </el-checkbox-group>
  324. </el-form-item>
  325. <p style="margin:0 20px 0 104px;color: #FD2A2A;">关联之后申请安全准入或者白名单后自动授权门禁,不关联则需要单独授权门禁</p>
  326. </div>
  327. <div v-if="upType == 'addSign'|| upType=='editSign'">
  328. <el-form-item label="设备编号" prop="cardNum">
  329. <el-input
  330. style="width:320px;"
  331. v-model="form.cardNum"
  332. placeholder="请输入设备编号"
  333. maxlength="50"
  334. size="small"
  335. />
  336. </el-form-item>
  337. <el-form-item label="实验室">
  338. <el-input
  339. style="width:320px;"
  340. v-model="subjectData.name"
  341. placeholder="请选择实验室"
  342. maxlength="20"
  343. size="small"
  344. disabled
  345. />
  346. </el-form-item>
  347. <!-- <el-form-item label="实验室" prop="subjectId">-->
  348. <!-- <el-select-->
  349. <!-- style="width:300px;"-->
  350. <!-- v-model="form.subjectName"-->
  351. <!-- filterable-->
  352. <!-- remote-->
  353. <!-- clearable-->
  354. <!-- reserve-keyword-->
  355. <!-- @focus="selectFocus"-->
  356. <!-- @change="selectChange"-->
  357. <!-- placeholder="请选择实验地点"-->
  358. <!-- :remote-method="userSelectList"-->
  359. <!-- :loading="loading">-->
  360. <!-- <el-option-->
  361. <!-- v-for="item in laboratoryOptions"-->
  362. <!-- :key="item.id"-->
  363. <!-- :label="item.name"-->
  364. <!-- :value="item.id">-->
  365. <!-- </el-option>-->
  366. <!-- </el-select>-->
  367. <!-- </el-form-item>-->
  368. <el-form-item label="安装位置" >
  369. <el-input
  370. style="width:320px;"
  371. v-model="form.location"
  372. placeholder="请输入安装位置"
  373. maxlength="10"
  374. size="small"
  375. />
  376. </el-form-item>
  377. <el-form-item label="关联门禁">
  378. <el-radio-group v-model="form.isStart">
  379. <el-radio :label="1">是</el-radio>
  380. <el-radio :label="2">否</el-radio>
  381. </el-radio-group>
  382. </el-form-item>
  383. </div>
  384. </el-form>
  385. <div slot="footer" class="dialog-footer">
  386. <el-button @click="cancel">取 消</el-button>
  387. <el-button type="primary" @click="submitForm">确 定</el-button>
  388. </div>
  389. </el-dialog>
  390. </div>
  391. </template>
  392. <script>
  393. import {
  394. listBySubjectId,
  395. addSensor,
  396. putSensor,
  397. delSensor,
  398. addHardware,
  399. putHardware,
  400. delHardware,
  401. subjectSignAdd, subjectSignEdit, subjectSignDelete
  402. } from '@/api/laboratory/subject'
  403. import { getSensorList } from "@/api/laboratory/sensor";
  404. import { subjectList } from '@/api/gasManage3_0/gasManage'
  405. import { listRelay } from '@/api/laboratory/relay'
  406. export default {
  407. name: "deviceList",
  408. props:{
  409. subjectData:{},
  410. },
  411. data() {
  412. return {
  413. loading:false,
  414. title:"",
  415. addType:false,
  416. listCgq:[], //传感器
  417. listYtj:[], //一体机
  418. listkzsb:[],
  419. listSpjk:[], //摄像头
  420. listHK:[],//智能门禁
  421. listXxp:[],//电子信息牌
  422. form:{
  423. },
  424. relayList: [],
  425. relayNumList:[
  426. {name:1},
  427. {name:2},
  428. {name:3},
  429. {name:4},
  430. {name:5},
  431. {name:6},
  432. {name:7},
  433. {name:8},
  434. {name:9},
  435. {name:10},
  436. {name:11},
  437. {name:12}
  438. ],
  439. // 表单校验
  440. rules: {
  441. name:[
  442. {required: true, message: '请输入名称', trigger: 'blur'},
  443. { required: true, message: "请输入名称", validator: this.spaceJudgment, trigger: "blur" }
  444. ],
  445. type:[
  446. {required: true, message: '类型不能为空', trigger: 'blur'}
  447. ],
  448. gatewayId:[
  449. {required: true, message: '网关不能为空', trigger: 'blur'},
  450. { required: true, message: "网关不能为空", validator: this.spaceJudgment, trigger: "blur" }
  451. ],
  452. hardwareNum:[
  453. { required: true, message: "请输入编号", trigger: "blur" },
  454. { required: true, message: "请输入编号", validator: this.spaceJudgment, trigger: "blur" }
  455. ],
  456. pcType: [
  457. { required: true, message: "请选择类型", trigger: "blur" },
  458. ],
  459. hardwareType: [
  460. { required: true, message: "请选择设备版本", trigger: "blur" },
  461. ],
  462. relayCode: [
  463. { required: true, message: "请输入设备编号", trigger: "blur" },
  464. { required: true, message: "请输入设备编号", validator: this.spaceJudgment, trigger: "blur" }
  465. ],
  466. bit: [
  467. { required: true, message: "请输入路由", trigger: "blur" },
  468. { required: true, message: "请输入路由", validator: this.spaceJudgment, trigger: "blur" }
  469. ],
  470. ipAddress: [
  471. { required: true, message: "请输入IP", trigger: "blur" },
  472. { required: true, message: "请输入IP", validator: this.spaceJudgment, trigger: "blur" }
  473. ],
  474. port: [
  475. { required: true, message: "请输入端口", trigger: "blur" },
  476. { required: true, message: "请输入端口", validator: this.spaceJudgment, trigger: "blur" }
  477. ],
  478. harUser: [
  479. { required: true, message: "请输入设备管理证号", trigger: "blur" },
  480. { required: true, message: "请输入设备管理证号", validator: this.spaceJudgment, trigger: "blur" }
  481. ],
  482. harPsw: [
  483. { required: true, message: "请输入设备管理密码", trigger: "blur" },
  484. { required: true, message: "请输入设备管理密码", validator: this.spaceJudgment, trigger: "blur" }
  485. ],
  486. cardNum:[
  487. { required: true, message: "请输入设备编号", trigger: "blur" },
  488. { required: true, message: "请输入设备编号", validator: this.spaceJudgment, trigger: "blur" }
  489. ],
  490. subjectId: [
  491. { required: true, message: "请选择实验室", trigger: "blur" }
  492. ],
  493. },
  494. //提交类型
  495. upType:"",
  496. //传感器类型
  497. sensorAddOptions: [],
  498. }
  499. },
  500. created() {
  501. this.listBySubjectId();
  502. this.getSensorList();
  503. this.getRelayList();
  504. },
  505. mounted(){
  506. },
  507. methods:{
  508. selectFocus(){
  509. if(!this.laboratoryOptions[0]){
  510. this.userSelectList("");
  511. }
  512. },
  513. //懒加载实验室
  514. userSelectList(e){
  515. subjectList({name:e,deptId:this.form.deptId}).then(response => {
  516. this.laboratoryOptions = response.data;
  517. });
  518. },
  519. //实验室选择
  520. selectChange(e){
  521. let self = this;
  522. for(let i=0;i<self.laboratoryOptions.length;i++){
  523. if(self.laboratoryOptions[i].id == e){
  524. this.$set(this.form,"subject",self.laboratoryOptions[i]);
  525. this.$set(this.form,"subjectName",self.laboratoryOptions[i].name);
  526. }
  527. }
  528. this.$set(this.form,"subjectId",e);
  529. },
  530. // 取消按钮
  531. cancel() {
  532. this.addType = false;
  533. },
  534. // 查询继电器列表
  535. getRelayList(){
  536. listRelay({"type": 1}).then(response => {
  537. this.relayList = response.data;
  538. if(this.form.relayCode){
  539. let self = this
  540. let num = ""
  541. for(let i=0;i<self.relayList.length;i++){
  542. if(self.relayList[i].code == this.form.relayCode){
  543. num = self.relayList[i].routeNum
  544. }
  545. }
  546. let list = [];
  547. for(let i=0;i<num;i++){
  548. let obj = {
  549. name:i+1
  550. }
  551. list.push(obj);
  552. }
  553. this.relayNumList = list;
  554. }
  555. });
  556. },
  557. loadRelayNum(e){
  558. let self = this;
  559. let num = ""
  560. for(let i=0;i<self.relayList.length;i++){
  561. if(self.relayList[i].code == e){
  562. num = self.relayList[i].routeNum
  563. }
  564. }
  565. let list = [];
  566. for(let i=0;i<num;i++){
  567. let obj = {
  568. name:i+1
  569. }
  570. list.push(obj);
  571. }
  572. console.log(list)
  573. if(list.length>0){
  574. this.relayNumList = list;
  575. }else{
  576. this.relayNumList =[
  577. {name:1},
  578. {name:2},
  579. {name:3},
  580. {name:4},
  581. {name:5},
  582. {name:6},
  583. {name:7},
  584. {name:8},
  585. {name:9},
  586. {name:10},
  587. ]
  588. }
  589. },
  590. //清空按钮
  591. loadClear(){
  592. this.form.bit = '';
  593. },
  594. // 提交
  595. submitForm() {
  596. this.$refs["form"].validate(valid => {
  597. if (valid) {
  598. if(this.upType == 1){
  599. //新增传感器
  600. this.addSensor();
  601. }else if(this.upType == 5){
  602. //编辑传感器
  603. this.putSensor();
  604. }else if(this.upType == 2){
  605. //新增一体机
  606. this.addHardware();
  607. }else if(this.upType == 6){
  608. //编辑一体机
  609. this.putHardware();
  610. }else if(this.upType == 3){
  611. //新增控制设备
  612. this.addHardwareTwo();
  613. }else if(this.upType == 7){
  614. //编辑控制设备
  615. this.putHardwareTwo();
  616. }else if(this.upType == 4){
  617. //新增控制设备
  618. this.addHardwareThree();
  619. }else if(this.upType == 8){
  620. //编辑控制设备
  621. this.putHardwareThree();
  622. }else if(this.upType == 'addEntrance'){
  623. //新增智能门禁
  624. this.addEntrance();
  625. }else if(this.upType == 'editEntrance'){
  626. //编辑智能门禁
  627. this.editEntrance();
  628. }else if(this.upType == 'addSign'){
  629. //新增电子信息牌
  630. this.addSign();
  631. }else if(this.upType == 'editSign'){
  632. //编辑电子信息牌
  633. this.editSign();
  634. }
  635. }
  636. });
  637. },
  638. //删除电子信息牌
  639. delSign(item){
  640. this.$confirm('确认要删除该电子信息牌?', "警告", {
  641. confirmButtonText: "确定",
  642. cancelButtonText: "取消",
  643. type: "warning"
  644. }).then(() => {
  645. // 确定
  646. subjectSignDelete(item.id).then((response) => {
  647. this.msgSuccess(response.msg)
  648. this.addType = false;
  649. this.listBySubjectId();
  650. });
  651. }).catch(function() {
  652. // 取消
  653. });
  654. },
  655. //删除智能门禁
  656. delEntrance(item){
  657. this.$confirm('确认要删除该智能门禁?', "警告", {
  658. confirmButtonText: "确定",
  659. cancelButtonText: "取消",
  660. type: "warning"
  661. }).then(() => {
  662. // 确定
  663. delHardware(item.id).then((response) => {
  664. this.msgSuccess(response.msg)
  665. this.addType = false;
  666. this.listBySubjectId();
  667. });
  668. }).catch(function() {
  669. // 取消
  670. });
  671. },
  672. //新增摄像头
  673. addHardwareThree(){
  674. let obj = {
  675. type:4,
  676. hardwareNum:this.form.hardwareNum,
  677. subjectId:this.subjectData.id,
  678. deptId:this.subjectData.deptId,
  679. deptName:this.subjectData.deptName,
  680. }
  681. addHardware(obj).then(response => {
  682. this.msgSuccess(response.msg)
  683. this.addType = false;
  684. this.listBySubjectId();
  685. });
  686. },
  687. //编辑摄像头
  688. putHardwareThree(){
  689. let obj = {
  690. id:this.form.id,
  691. hardwareNum:this.form.hardwareNum,
  692. subjectId:this.form.subjectId,
  693. deptId:this.form.deptId,
  694. deptName:this.form.deptName,
  695. }
  696. putHardware(obj).then(response => {
  697. this.msgSuccess(response.msg)
  698. this.addType = false;
  699. this.listBySubjectId();
  700. });
  701. },
  702. //删除摄像头
  703. delHardwareThree(item){
  704. this.$confirm('确认要删除该摄像头?', "警告", {
  705. confirmButtonText: "确定",
  706. cancelButtonText: "取消",
  707. type: "warning"
  708. }).then(() => {
  709. // 确定
  710. delHardware(item.id).then((response) => {
  711. this.msgSuccess(response.msg)
  712. this.addType = false;
  713. this.listBySubjectId();
  714. });
  715. }).catch(function() {
  716. // 取消
  717. });
  718. },
  719. //新增控制设备
  720. addHardwareTwo(){
  721. let obj = {
  722. name:this.form.name,
  723. type:this.form.type,
  724. hardwareType:this.form.hardwareType,
  725. relayCode:this.form.relayCode,
  726. bit:this.form.bit,
  727. configName:this.form.configName,
  728. configStatus:this.form.configStatus,
  729. subjectId:this.subjectData.id,
  730. deptId:this.subjectData.deptId,
  731. deptName:this.subjectData.deptName,
  732. isPcfire:this.form.isPcfire,
  733. }
  734. addHardware(obj).then(response => {
  735. this.msgSuccess(response.msg)
  736. this.addType = false;
  737. this.listBySubjectId();
  738. });
  739. },
  740. //编辑控制设备
  741. putHardwareTwo(){
  742. let obj = {
  743. id:this.form.id,
  744. hardwareType:this.form.hardwareType,
  745. relayCode:this.form.relayCode,
  746. bit:this.form.bit,
  747. configName:this.form.configName,
  748. configStatus:this.form.configStatus,
  749. subjectId:this.form.subjectId,
  750. deptId:this.form.deptId,
  751. deptName:this.form.deptName,
  752. name:this.form.name,
  753. isPcfire:this.form.isPcfire,
  754. }
  755. putHardware(obj).then(response => {
  756. this.msgSuccess(response.msg)
  757. this.addType = false;
  758. this.listBySubjectId();
  759. });
  760. },
  761. //删除控制设备
  762. delHardwareTwo(item){
  763. this.$confirm('确认要删除该一体机?', "警告", {
  764. confirmButtonText: "确定",
  765. cancelButtonText: "取消",
  766. type: "warning"
  767. }).then(() => {
  768. // 确定
  769. delHardware(item.id).then((response) => {
  770. this.msgSuccess(response.msg)
  771. this.addType = false;
  772. this.listBySubjectId();
  773. });
  774. }).catch(function() {
  775. // 取消
  776. });
  777. },
  778. //添加一体机
  779. addHardware(){
  780. let obj = {
  781. type:0,
  782. name:this.form.name,
  783. pcType:this.form.pcType,
  784. hardwareNum:this.form.hardwareNum,
  785. subjectId:this.subjectData.id,
  786. deptId:this.subjectData.deptId,
  787. deptName:this.subjectData.deptName,
  788. }
  789. addHardware(obj).then(response => {
  790. this.msgSuccess(response.msg)
  791. this.addType = false;
  792. this.listBySubjectId();
  793. });
  794. },
  795. //编辑一体机
  796. putHardware(){
  797. let obj = {
  798. id:this.form.id,
  799. name:this.form.name,
  800. pcType:this.form.pcType,
  801. hardwareNum:this.form.hardwareNum,
  802. }
  803. putHardware(obj).then(response => {
  804. this.msgSuccess(response.msg)
  805. this.addType = false;
  806. this.listBySubjectId();
  807. });
  808. },
  809. //删除一体机
  810. delHardware(item){
  811. this.$confirm('确认要删除该一体机?', "警告", {
  812. confirmButtonText: "确定",
  813. cancelButtonText: "取消",
  814. type: "warning"
  815. }).then(() => {
  816. // 确定
  817. delHardware(item.id).then((response) => {
  818. this.msgSuccess(response.msg)
  819. this.addType = false;
  820. this.listBySubjectId();
  821. });
  822. }).catch(function() {
  823. // 取消
  824. });
  825. },
  826. //添加传感器
  827. addSensor(){
  828. let obj = {
  829. type:this.form.type,
  830. gatewayId:this.form.gatewayId,
  831. routeNum:this.form.routeNum,
  832. configName:this.form.configName,
  833. configStatus:this.form.configStatus,
  834. subjectId:this.subjectData.id
  835. }
  836. addSensor(obj).then(response => {
  837. this.msgSuccess(response.msg)
  838. this.addType = false;
  839. this.listBySubjectId();
  840. });
  841. },
  842. //编辑传感器
  843. putSensor(){
  844. let obj = {
  845. type:this.form.type,
  846. id:this.form.id,
  847. gatewayId:this.form.gatewayId,
  848. routeNum:this.form.routeNum,
  849. configName:this.form.configName,
  850. configStatus:this.form.configStatus,
  851. }
  852. putSensor(obj).then(response => {
  853. this.msgSuccess(response.msg)
  854. this.addType = false;
  855. this.listBySubjectId();
  856. });
  857. },
  858. //删除传感器
  859. delSensor(item){
  860. this.$confirm('确认要删除该传感器?', "警告", {
  861. confirmButtonText: "确定",
  862. cancelButtonText: "取消",
  863. type: "warning"
  864. }).then(() => {
  865. // 确定
  866. delSensor(item.id).then((response) => {
  867. this.msgSuccess(response.msg)
  868. this.addType = false;
  869. this.listBySubjectId();
  870. });
  871. }).catch(function() {
  872. // 取消
  873. });
  874. },
  875. //新增智能门禁
  876. addEntrance(){
  877. let obj = {
  878. type:11,
  879. subjectId:this.subjectData.id,
  880. hardwareNum:this.form.hardwareNum,
  881. name:this.form.name,
  882. ipAddress:this.form.ipAddress,
  883. port:this.form.port,
  884. harUser:this.form.harUser,
  885. harPsw:this.form.harPsw,
  886. controlScope:this.form.controlScope.join(','),
  887. }
  888. addHardware(obj).then(response => {
  889. if(response.code==200){
  890. this.msgSuccess(response.msg)
  891. this.addType = false;
  892. this.listBySubjectId();
  893. }else if(response.code==205){
  894. this.$confirm(response.msg, "警告", {
  895. confirmButtonText: "确定",
  896. cancelButtonText: "取消",
  897. type: "warning"
  898. }).then(() => {
  899. // 确定
  900. this.$router.push({ path: '/comprehensive/laboratoryManagement/accessAuthorization' });
  901. }).catch(function() {
  902. // 取消
  903. });
  904. }
  905. });
  906. },
  907. //编辑智能门禁
  908. editEntrance(){
  909. let obj = {
  910. id:this.form.id,
  911. hardwareNum:this.form.hardwareNum,
  912. name:this.form.name,
  913. ipAddress:this.form.ipAddress,
  914. port:this.form.port,
  915. harUser:this.form.harUser,
  916. harPsw:this.form.harPsw,
  917. controlScope:this.form.controlScope.join(','),
  918. subjectId:this.subjectData.id
  919. }
  920. putHardware(obj).then(response => {
  921. this.msgSuccess(response.msg)
  922. this.addType = false;
  923. this.listBySubjectId();
  924. });
  925. },
  926. //新增电子信息牌
  927. addSign(){
  928. let obj = {
  929. subjectId:this.subjectData.id,
  930. subjectName:this.subjectData.name,
  931. cardNum:this.form.cardNum,
  932. location:this.form.location,
  933. isStart:this.form.isStart,
  934. deptId:this.subjectData.deptId,
  935. deptName:this.subjectData.deptName,
  936. }
  937. subjectSignAdd(obj).then(response => {
  938. if(response.code==200){
  939. this.msgSuccess(response.msg)
  940. this.addType = false;
  941. this.listBySubjectId();
  942. }
  943. });
  944. },
  945. //编辑电子信息牌
  946. editSign(){
  947. let obj = {
  948. id:this.form.id,
  949. cardNum:this.form.cardNum,
  950. location:this.form.location,
  951. isStart:this.form.isStart,
  952. subjectId:this.subjectData.id,
  953. subjectName:this.subjectData.name,
  954. deptId:this.subjectData.deptId,
  955. deptName:this.subjectData.deptName,
  956. }
  957. subjectSignEdit(obj).then(response => {
  958. this.msgSuccess(response.msg)
  959. this.addType = false;
  960. this.listBySubjectId();
  961. });
  962. },
  963. //添加
  964. addData(type){
  965. // this.resetForm("form");
  966. if(type == 1){
  967. this.title = '新增传感器';
  968. this.$set(this,'form',{
  969. type:"",
  970. gatewayId:"",
  971. routeNum:"",
  972. configName:"",
  973. configStatus:"",
  974. });
  975. }else if(type == 2){
  976. this.title = '新增一体机';
  977. this.$set(this,'form',{
  978. name:"",
  979. pcType:"",
  980. hardwareNum:"",
  981. });
  982. }else if(type == 3){
  983. this.title = '新增控制设备';
  984. this.disabledType = false;
  985. this.$set(this,'form',{
  986. name:"",
  987. type:"",
  988. hardwareType:1,
  989. relayCode:"",
  990. bit:"",
  991. configName:"",
  992. configStatus:"",
  993. isPcfire:0,
  994. });
  995. }else if(type == 4){
  996. this.title = '新增摄像头';
  997. this.$set(this,'form',{
  998. hardwareNum:"",
  999. });
  1000. }else if(type == 'addEntrance'){
  1001. this.title = '新增智能门禁';
  1002. this.$set(this,'form',{
  1003. hardwareNum:"",
  1004. name:"",
  1005. ipAddress:"",
  1006. port:"",
  1007. harUser:"",
  1008. harPsw:"",
  1009. controlScope:[],
  1010. });
  1011. }else if(type == 'addSign'){
  1012. this.title = '新增电子信息牌';
  1013. this.$set(this,'form',{
  1014. cardNum:"",
  1015. subjectName:"",
  1016. subjectId:"",
  1017. location:"",
  1018. isStart:"",
  1019. deptId:"",
  1020. deptName:"",
  1021. });
  1022. }
  1023. this.addType = true;
  1024. this.upType = type;
  1025. },
  1026. //编辑
  1027. editData(type,row){
  1028. if(type == 5){
  1029. this.title = '编辑传感器';
  1030. this.$set(this,'form',JSON.parse(JSON.stringify(row)));
  1031. this.$set(this.form,'type',JSON.parse(JSON.stringify(row.type.enumName)));
  1032. }else if(type == 6){
  1033. this.title = '编辑一体机';
  1034. this.$set(this,'form',JSON.parse(JSON.stringify(row)));
  1035. this.$set(this.form,'pcType',JSON.parse(JSON.stringify(row.pcType+'')));
  1036. }else if(type == 7){
  1037. this.title = '编辑控制设备';
  1038. this.disabledType = true;
  1039. this.$set(this,'form',JSON.parse(JSON.stringify(row)));
  1040. this.$set(this.form,'type',JSON.parse(JSON.stringify(row.type.code+'')));
  1041. }else if(type == 8){
  1042. this.title = '编辑摄像头';
  1043. this.$set(this,'form',JSON.parse(JSON.stringify(row)));
  1044. }else if(type == 'editEntrance'){
  1045. this.title = '编辑智能门禁';
  1046. this.$set(this,'form',JSON.parse(JSON.stringify(row)));
  1047. if(row.controlScope){
  1048. this.form.controlScope=row.controlScope.split(',')
  1049. }else{
  1050. this.form.controlScope=[]
  1051. }
  1052. }else if(type=='editSign'){
  1053. this.title = '编辑电子信息牌';
  1054. this.$set(this,'form',JSON.parse(JSON.stringify(row)));
  1055. }
  1056. this.addType = true;
  1057. this.upType = type;
  1058. },
  1059. //获取列表
  1060. listBySubjectId(){
  1061. console.log(this.subjectData)
  1062. let obj = {
  1063. subjectId:this.subjectData.id
  1064. };
  1065. listBySubjectId(obj).then(response => {
  1066. if(response.data.listCgq){
  1067. this.$set(this,'listCgq',response.data.listCgq);
  1068. }
  1069. if(response.data.listYtj){
  1070. this.$set(this,'listYtj',response.data.listYtj);
  1071. }
  1072. if(response.data.listkzsb){
  1073. this.$set(this,'listkzsb',response.data.listkzsb);
  1074. }
  1075. if(response.data.listSpjk){
  1076. this.$set(this,'listSpjk',response.data.listSpjk);
  1077. }
  1078. if(response.data.listHK){
  1079. this.$set(this,'listHK',response.data.listHK);
  1080. }
  1081. if(response.data.listXxp){
  1082. this.$set(this,'listXxp',response.data.listXxp);
  1083. }
  1084. });
  1085. },
  1086. //返回上一页
  1087. backPage(){
  1088. this.$parent.clickPage(1);
  1089. },
  1090. //传感器类型
  1091. getSensorList(){
  1092. getSensorList().then(response => {
  1093. this.sensorAddOptions = response.data;
  1094. });
  1095. },
  1096. }
  1097. }
  1098. </script>
  1099. <style scoped lang="scss">
  1100. .deviceList{
  1101. flex:1;
  1102. display: flex;
  1103. flex-direction: column;
  1104. padding-bottom:20px;
  1105. border-radius:10px!important;
  1106. margin:5px 20px 20px 10px!important;
  1107. box-shadow: 0 0 8px 1px rgba(0, 0, 0, 0.1) !important;
  1108. *{
  1109. margin:0;
  1110. }
  1111. .title-box{
  1112. display: flex;
  1113. margin:0 20px;
  1114. .left-title{
  1115. flex:1;
  1116. height:80px;
  1117. line-height:80px;
  1118. color:#0045AF;
  1119. font-size:18px;
  1120. }
  1121. .right-button{
  1122. margin:20px 0;
  1123. }
  1124. }
  1125. .for-max-box{
  1126. margin:0 40px;
  1127. font-weight:500;
  1128. .for-big-box{
  1129. border: 1px solid #E0E0E0;
  1130. display: inline-block;
  1131. overflow: hidden;
  1132. width:280px;
  1133. min-height:130px;
  1134. padding-bottom:10px;
  1135. border-radius: 6px;
  1136. margin:0 20px 20px 0;
  1137. .for-title-p{
  1138. background: rgba(182,214,254,1);
  1139. color:#0183FA;
  1140. font-size:16px;
  1141. line-height:40px;
  1142. display:block;
  1143. overflow:hidden;
  1144. text-overflow:ellipsis;
  1145. white-space:nowrap;
  1146. padding:0 16px;
  1147. margin-bottom:10px;
  1148. font-weight:700;
  1149. }
  1150. .for-text-box{
  1151. display: flex;
  1152. padding:0 23px;
  1153. p{
  1154. font-size:14px;
  1155. line-height:30px;
  1156. flex:1;
  1157. }
  1158. p:nth-child(1){
  1159. color:#333;
  1160. text-align: left;
  1161. }
  1162. p:nth-child(2){
  1163. color:#999;
  1164. text-align: right;
  1165. overflow:hidden;
  1166. text-overflow:ellipsis;
  1167. white-space:nowrap;
  1168. }
  1169. }
  1170. .for-button-box{
  1171. display: flex;
  1172. line-height:26px;
  1173. margin-top:10px;
  1174. p{
  1175. text-align: center;
  1176. font-size:14px;
  1177. color:#666666;
  1178. }
  1179. p:nth-child(1){
  1180. flex:1;
  1181. cursor: pointer;
  1182. i{
  1183. color:#1151b4;
  1184. margin-right:10px;
  1185. }
  1186. }
  1187. p:nth-child(2){
  1188. width:2px;
  1189. height:14px;
  1190. margin:6px 0;
  1191. background: #CCCCCC;
  1192. }
  1193. p:nth-child(3){
  1194. flex:1;
  1195. cursor: pointer;
  1196. i{
  1197. color:#ff6868;
  1198. margin-right:10px;
  1199. }
  1200. }
  1201. }
  1202. }
  1203. .for-big-box-two{
  1204. border: 1px solid #E0E0E0;
  1205. display: inline-block;
  1206. overflow: hidden;
  1207. width:280px;
  1208. min-height:158px;
  1209. padding-bottom:10px;
  1210. border-radius: 6px;
  1211. margin:0 20px 20px 0;
  1212. .for-title-p{
  1213. background: rgba(182,214,254,1);
  1214. color:#0183FA;
  1215. font-size:16px;
  1216. line-height:40px;
  1217. display:block;
  1218. overflow:hidden;
  1219. text-overflow:ellipsis;
  1220. white-space:nowrap;
  1221. padding:0 16px;
  1222. margin-bottom:10px;
  1223. font-weight:700;
  1224. }
  1225. .for-text-box{
  1226. display: flex;
  1227. padding:0 23px;
  1228. p{
  1229. font-size:14px;
  1230. line-height:30px;
  1231. flex:1;
  1232. }
  1233. p:nth-child(1){
  1234. text-align: left;
  1235. color:#333;
  1236. }
  1237. p:nth-child(2){
  1238. color:#999;
  1239. text-align: right;
  1240. overflow:hidden;
  1241. text-overflow:ellipsis;
  1242. white-space:nowrap;
  1243. }
  1244. }
  1245. .for-button-box{
  1246. display: flex;
  1247. line-height:26px;
  1248. margin-top:10px;
  1249. p{
  1250. text-align: center;
  1251. font-size:14px;
  1252. color:#666666;
  1253. }
  1254. p:nth-child(1){
  1255. flex:1;
  1256. cursor: pointer;
  1257. i{
  1258. color:#1151b4;
  1259. margin-right:10px;
  1260. }
  1261. }
  1262. p:nth-child(2){
  1263. width:2px;
  1264. height:14px;
  1265. margin:6px 0;
  1266. background: #CCCCCC;
  1267. }
  1268. p:nth-child(3){
  1269. flex:1;
  1270. cursor: pointer;
  1271. i{
  1272. color:#ff6868;
  1273. margin-right:10px;
  1274. }
  1275. }
  1276. }
  1277. }
  1278. .add-for-p{
  1279. font-size:14px;
  1280. border: 1px solid #E0E0E0;
  1281. display: inline-block;
  1282. overflow: hidden;
  1283. width:280px;
  1284. height:130px;
  1285. line-height:130px;
  1286. text-align: center;
  1287. border-radius: 6px;
  1288. color:#999999;
  1289. cursor: pointer;
  1290. margin:0 20px 20px 0;
  1291. i{
  1292. margin-right:10px;
  1293. }
  1294. }
  1295. .add-for-p-two{
  1296. font-size:14px;
  1297. border: 1px solid #E0E0E0;
  1298. display: inline-block;
  1299. overflow: hidden;
  1300. width:280px;
  1301. height:158px;
  1302. line-height:158px;
  1303. text-align: center;
  1304. border-radius: 6px;
  1305. color:#999999;
  1306. cursor: pointer;
  1307. margin:0 20px 20px 0;
  1308. i{
  1309. margin-right:10px;
  1310. }
  1311. }
  1312. }
  1313. }
  1314. </style>