deviceList.vue 41 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274
  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="camera" v-if="item.isArrest">抓拍</p>
  102. <p class="for-title-p" style="background: none;color: #333;margin-top: 12px;">{{subjectData.room}}-{{item.type.name}}{{index+1}}</p>
  103. <div class="for-text-box">
  104. <p>摄像头编号:</p>
  105. <el-tooltip class="item" effect="dark" :content="item.hardwareNum" placement="top">
  106. <p>{{item.hardwareNum}}</p>
  107. </el-tooltip>
  108. </div>
  109. <!-- <div class="for-text-box">-->
  110. <!-- <p></p>-->
  111. <!-- <el-tooltip class="item" effect="dark" :content="item.hardwareNum" placement="top">-->
  112. <!-- <p>{{item.hardwareNum}}</p>-->
  113. <!-- </el-tooltip>-->
  114. <!-- </div>-->
  115. <div class="for-button-box">
  116. <p @click="editData(8,item)"><i class="el-icon-edit-outline"></i>编辑</p>
  117. <p></p>
  118. <p @click="delHardwareThree(item)"><i class="el-icon-delete"></i>删除</p>
  119. </div>
  120. </div>
  121. <p class="add-for-p-two" @click="addData(4)"><i class="el-icon-plus"></i>添加摄像头</p>
  122. </div>
  123. <div class="title-box" v-if="subjectData.hardwareType==2">
  124. <p class="left-title">电子信息牌</p>
  125. </div>
  126. <div class="for-max-box" v-if="subjectData.hardwareType==2">
  127. <div class="for-big-box" v-for="(item,index) in listXxp" :key="index">
  128. <p class="for-title-p">{{subjectData.room}}-{{item.cardName}}{{index+1}}</p>
  129. <div class="for-text-box">
  130. <p>设备编号:</p>
  131. <el-tooltip class="item" effect="dark" :content="item.cardNum" placement="top">
  132. <p>{{item.cardNum}}</p>
  133. </el-tooltip>
  134. </div>
  135. <div class="for-button-box">
  136. <p @click="editData('editSign',item)"><i class="el-icon-edit-outline"></i>编辑</p>
  137. <p></p>
  138. <p @click="delSign(item)"><i class="el-icon-delete"></i>删除</p>
  139. </div>
  140. </div>
  141. <p class="add-for-p" @click="addData('addSign')" v-if="listXxp.length<1"><i class="el-icon-plus"></i>添加信息牌</p>
  142. </div>
  143. <el-dialog :title="title" :visible.sync="addType" v-if="addType" width="500px" append-to-body>
  144. <el-form ref="form" :model="form" :rules="rules" label-width="110px">
  145. <div v-if="upType == 1 || upType == 5">
  146. <el-form-item label="传感器类型" prop="type">
  147. <el-select v-model="form.type" placeholder="请选择传感器类型" style="width:320px;">
  148. <el-option
  149. v-for="item in sensorAddOptions"
  150. :key="item.enumName"
  151. :label="item.name"
  152. :value="item.enumName">
  153. </el-option>
  154. </el-select>
  155. </el-form-item>
  156. <el-form-item label="网关编号" prop="gatewayId">
  157. <el-input v-model="form.gatewayId" placeholder="请输入网关编号"
  158. maxlength="30" style="width:320px;"/>
  159. </el-form-item>
  160. <el-form-item label="路由" prop="routeNum">
  161. <el-input v-model="form.routeNum" oninput="value=value.replace(/[^0-9.]/g,'')" maxlength="2" placeholder="请输入路由" style="width:320px;"></el-input>
  162. </el-form-item>
  163. <el-form-item label="传感器参数" prop="configName">
  164. <el-input v-model="form.configName" placeholder="请输入传感器参数"
  165. maxlength="30" style="width:320px;"></el-input>
  166. </el-form-item>
  167. <el-form-item label="状态参数" prop="configStatus">
  168. <el-input v-model="form.configStatus" placeholder="请输入状态参数"
  169. maxlength="30" style="width:320px;"></el-input>
  170. </el-form-item>
  171. </div>
  172. <div v-if="upType == 2 || upType == 6">
  173. <el-form-item label="一体机名称" prop="name">
  174. <el-input
  175. style="width:320px;"
  176. v-model="form.name"
  177. placeholder="请输入一体机名称"
  178. maxlength="8"
  179. size="small"
  180. />
  181. </el-form-item>
  182. <el-form-item label="一体机类型" prop="pcType">
  183. <el-select v-model="form.pcType" placeholder="请选择一体机类型" style="width:320px;">
  184. <el-option label="管控一体机" value="0" />
  185. <el-option label="学习一体机" value="1" />
  186. </el-select>
  187. </el-form-item>
  188. <el-form-item label="一体机编号" prop="hardwareNum">
  189. <el-input
  190. style="width:320px;"
  191. v-model="form.hardwareNum"
  192. placeholder="请输入一体机编号"
  193. maxlength="30"
  194. size="small"
  195. />
  196. </el-form-item>
  197. </div>
  198. <div v-if="upType == 3 || upType == 7">
  199. <el-form-item label="设备类型" prop="type">
  200. <el-select v-model="form.type" placeholder="请选择设备类型" style="width:320px;" :disabled="disabledType">
  201. <el-option key="1" label="电源开关" value="1"></el-option>
  202. <el-option key="2" label="智能通风" value="2"></el-option>
  203. </el-select>
  204. </el-form-item>
  205. <el-form-item label="设备版本" prop="hardwareType">
  206. <el-radio-group v-model="form.hardwareType">
  207. <el-radio :label="1">老继电器</el-radio>
  208. <el-radio :label="2">新继电器</el-radio>
  209. <el-radio :label="3">泥人继电器</el-radio>
  210. </el-radio-group>
  211. </el-form-item>
  212. <el-form-item label="设备编号" prop="relayCode">
  213. <el-input v-model="form.relayCode" placeholder="请输入设备编号"
  214. maxlength="30" style="width:320px;"/>
  215. </el-form-item>
  216. <el-form-item label="设备路由" prop="bit">
  217. <el-input v-model="form.bit" oninput="value=value.replace(/[^0-9.]/g,'')" maxlength="2" placeholder="请输入路由" style="width:320px;"></el-input>
  218. </el-form-item>
  219. <el-form-item label="设备参数" prop="configName" v-if="form.hardwareType == 2">
  220. <el-input v-model="form.configName" maxlength="30" placeholder="请输入设备参数" style="width:320px;"></el-input>
  221. </el-form-item>
  222. <el-form-item label="参数状态" prop="configStatus" v-if="form.hardwareType == 2">
  223. <el-input v-model="form.configStatus" maxlength="30" placeholder="请输入参数状态" style="width:320px;"></el-input>
  224. </el-form-item>
  225. </div>
  226. <div v-if="upType == 4 || upType == 8">
  227. <el-form-item label="硬件名称" prop="name">
  228. <el-input
  229. v-model="form.name"
  230. placeholder="请输入硬件名称"
  231. clearable
  232. size="small"
  233. maxLength="8"
  234. style="width:320px;"
  235. />
  236. </el-form-item>
  237. <el-form-item label="摄像头编号" prop="hardwareNum">
  238. <el-input v-model="form.hardwareNum" placeholder="摄像头编号"
  239. maxlength="30" style="width:320px;"/>
  240. </el-form-item>
  241. <el-form-item label="硬件IP" prop="ipAddress">
  242. <el-input
  243. v-model="form.ipAddress"
  244. placeholder="请输入硬件IP"
  245. clearable
  246. size="small"
  247. maxLength="20"
  248. style="width:320px;"
  249. />
  250. </el-form-item>
  251. <el-form-item label="类型" >
  252. <!-- <el-radio-group v-model="form.pcType">-->
  253. <!-- <el-radio :label="0">火焰算法</el-radio>-->
  254. <!-- <el-radio :label="1">穿戴识别</el-radio>-->
  255. <!-- <el-radio :label="2">违规带离抓拍</el-radio>-->
  256. <!-- </el-radio-group>-->
  257. <el-checkbox-group v-model="form.subType">
  258. <el-checkbox label="0">火焰算法</el-checkbox>
  259. <el-checkbox label="1">穿戴识别</el-checkbox>
  260. <el-checkbox label="2">违规带离抓拍</el-checkbox>
  261. </el-checkbox-group>
  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="30"
  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. export default {
  406. name: "deviceList",
  407. props:{
  408. subjectData:{},
  409. },
  410. data() {
  411. return {
  412. loading:false,
  413. title:"",
  414. addType:false,
  415. listCgq:[], //传感器
  416. listYtj:[], //一体机
  417. listkzsb:[],
  418. listSpjk:[], //摄像头
  419. listHK:[],//智能门禁
  420. listXxp:[],//电子信息牌
  421. form:{
  422. },
  423. laboratoryOptions:[],
  424. // 表单校验
  425. rules: {
  426. name:[
  427. {required: true, message: '请输入名称', trigger: 'blur'},
  428. { required: true, message: "请输入名称", validator: this.spaceJudgment, trigger: "blur" }
  429. ],
  430. type:[
  431. {required: true, message: '类型不能为空', trigger: 'blur'}
  432. ],
  433. gatewayId:[
  434. {required: true, message: '网关不能为空', trigger: 'blur'},
  435. { required: true, message: "网关不能为空", validator: this.spaceJudgment, trigger: "blur" }
  436. ],
  437. hardwareNum:[
  438. { required: true, message: "请输入编号", trigger: "blur" },
  439. { required: true, message: "请输入编号", validator: this.spaceJudgment, trigger: "blur" }
  440. ],
  441. pcType: [
  442. { required: true, message: "请选择类型", trigger: "blur" },
  443. ],
  444. hardwareType: [
  445. { required: true, message: "请选择设备版本", trigger: "blur" },
  446. ],
  447. relayCode: [
  448. { required: true, message: "请输入设备编号", trigger: "blur" },
  449. { required: true, message: "请输入设备编号", validator: this.spaceJudgment, trigger: "blur" }
  450. ],
  451. bit: [
  452. { required: true, message: "请输入路由", trigger: "blur" },
  453. { required: true, message: "请输入路由", validator: this.spaceJudgment, trigger: "blur" }
  454. ],
  455. ipAddress: [
  456. { required: true, message: "请输入IP", trigger: "blur" },
  457. { required: true, message: "请输入IP", validator: this.spaceJudgment, trigger: "blur" }
  458. ],
  459. port: [
  460. { required: true, message: "请输入端口", trigger: "blur" },
  461. { required: true, message: "请输入端口", validator: this.spaceJudgment, trigger: "blur" }
  462. ],
  463. harUser: [
  464. { required: true, message: "请输入设备管理证号", trigger: "blur" },
  465. { required: true, message: "请输入设备管理证号", validator: this.spaceJudgment, trigger: "blur" }
  466. ],
  467. harPsw: [
  468. { required: true, message: "请输入设备管理密码", trigger: "blur" },
  469. { required: true, message: "请输入设备管理密码", validator: this.spaceJudgment, trigger: "blur" }
  470. ],
  471. cardNum:[
  472. { required: true, message: "请输入设备编号", trigger: "blur" },
  473. { required: true, message: "请输入设备编号", validator: this.spaceJudgment, trigger: "blur" }
  474. ],
  475. subjectId: [
  476. { required: true, message: "请选择实验室", trigger: "blur" }
  477. ],
  478. },
  479. //提交类型
  480. upType:"",
  481. //传感器类型
  482. sensorAddOptions: [],
  483. }
  484. },
  485. created() {
  486. this.listBySubjectId();
  487. this.getSensorList();
  488. },
  489. mounted(){
  490. },
  491. methods:{
  492. selectFocus(){
  493. if(!this.laboratoryOptions[0]){
  494. this.userSelectList("");
  495. }
  496. },
  497. //懒加载实验室
  498. userSelectList(e){
  499. subjectList({name:e,deptId:this.form.deptId}).then(response => {
  500. this.laboratoryOptions = response.data;
  501. });
  502. },
  503. //实验室选择
  504. selectChange(e){
  505. let self = this;
  506. for(let i=0;i<self.laboratoryOptions.length;i++){
  507. if(self.laboratoryOptions[i].id == e){
  508. this.$set(this.form,"subject",self.laboratoryOptions[i]);
  509. this.$set(this.form,"subjectName",self.laboratoryOptions[i].name);
  510. }
  511. }
  512. this.$set(this.form,"subjectId",e);
  513. },
  514. // 取消按钮
  515. cancel() {
  516. this.addType = false;
  517. },
  518. // 提交
  519. submitForm() {
  520. this.$refs["form"].validate(valid => {
  521. if (valid) {
  522. if(this.upType == 1){
  523. //新增传感器
  524. this.addSensor();
  525. }else if(this.upType == 5){
  526. //编辑传感器
  527. this.putSensor();
  528. }else if(this.upType == 2){
  529. //新增一体机
  530. this.addHardware();
  531. }else if(this.upType == 6){
  532. //编辑一体机
  533. this.putHardware();
  534. }else if(this.upType == 3){
  535. //新增控制设备
  536. this.addHardwareTwo();
  537. }else if(this.upType == 7){
  538. //编辑控制设备
  539. this.putHardwareTwo();
  540. }else if(this.upType == 4){
  541. //新增控制设备
  542. this.addHardwareThree();
  543. }else if(this.upType == 8){
  544. //编辑控制设备
  545. this.putHardwareThree();
  546. }else if(this.upType == 'addEntrance'){
  547. //新增智能门禁
  548. this.addEntrance();
  549. }else if(this.upType == 'editEntrance'){
  550. //编辑智能门禁
  551. this.editEntrance();
  552. }else if(this.upType == 'addSign'){
  553. //新增电子信息牌
  554. this.addSign();
  555. }else if(this.upType == 'editSign'){
  556. //编辑电子信息牌
  557. this.editSign();
  558. }
  559. }
  560. });
  561. },
  562. //删除电子信息牌
  563. delSign(item){
  564. this.$confirm('确认要删除该电子信息牌?', "警告", {
  565. confirmButtonText: "确定",
  566. cancelButtonText: "取消",
  567. type: "warning"
  568. }).then(() => {
  569. // 确定
  570. subjectSignDelete(item.id).then((response) => {
  571. this.msgSuccess(response.msg)
  572. this.addType = false;
  573. this.listBySubjectId();
  574. });
  575. }).catch(function() {
  576. // 取消
  577. });
  578. },
  579. //删除智能门禁
  580. delEntrance(item){
  581. this.$confirm('确认要删除该智能门禁?', "警告", {
  582. confirmButtonText: "确定",
  583. cancelButtonText: "取消",
  584. type: "warning"
  585. }).then(() => {
  586. // 确定
  587. delHardware(item.id).then((response) => {
  588. this.msgSuccess(response.msg)
  589. this.addType = false;
  590. this.listBySubjectId();
  591. });
  592. }).catch(function() {
  593. // 取消
  594. });
  595. },
  596. //新增摄像头
  597. addHardwareThree(){
  598. let obj = {
  599. type:4,
  600. name:this.form.name,
  601. hardwareNum:this.form.hardwareNum,
  602. ipAddress:this.form.ipAddress,
  603. subType:this.form.subType.toString(),
  604. subjectId:this.subjectData.id,
  605. deptId:this.subjectData.deptId,
  606. deptName:this.subjectData.deptName,
  607. }
  608. addHardware(obj).then(response => {
  609. this.msgSuccess(response.msg)
  610. this.addType = false;
  611. this.listBySubjectId();
  612. });
  613. },
  614. //编辑摄像头
  615. putHardwareThree(){
  616. let obj = {
  617. id:this.form.id,
  618. name:this.form.name,
  619. hardwareNum:this.form.hardwareNum,
  620. ipAddress:this.form.ipAddress,
  621. subType:this.form.subType.toString(),
  622. subjectId:this.form.subjectId,
  623. deptId:this.form.deptId,
  624. deptName:this.form.deptName,
  625. }
  626. putHardware(obj).then(response => {
  627. this.msgSuccess(response.msg)
  628. this.addType = false;
  629. this.listBySubjectId();
  630. });
  631. },
  632. //删除摄像头
  633. delHardwareThree(item){
  634. this.$confirm('确认要删除该摄像头?', "警告", {
  635. confirmButtonText: "确定",
  636. cancelButtonText: "取消",
  637. type: "warning"
  638. }).then(() => {
  639. // 确定
  640. delHardware(item.id).then((response) => {
  641. this.msgSuccess(response.msg)
  642. this.addType = false;
  643. this.listBySubjectId();
  644. });
  645. }).catch(function() {
  646. // 取消
  647. });
  648. },
  649. //新增控制设备
  650. addHardwareTwo(){
  651. let obj = {
  652. type:this.form.type,
  653. hardwareType:this.form.hardwareType,
  654. relayCode:this.form.relayCode,
  655. bit:this.form.bit,
  656. configName:this.form.configName,
  657. configStatus:this.form.configStatus,
  658. subjectId:this.subjectData.id,
  659. deptId:this.subjectData.deptId,
  660. deptName:this.subjectData.deptName,
  661. }
  662. addHardware(obj).then(response => {
  663. this.msgSuccess(response.msg)
  664. this.addType = false;
  665. this.listBySubjectId();
  666. });
  667. },
  668. //编辑控制设备
  669. putHardwareTwo(){
  670. let obj = {
  671. id:this.form.id,
  672. hardwareType:this.form.hardwareType,
  673. relayCode:this.form.relayCode,
  674. bit:this.form.bit,
  675. configName:this.form.configName,
  676. configStatus:this.form.configStatus,
  677. subjectId:this.form.subjectId,
  678. deptId:this.form.deptId,
  679. deptName:this.form.deptName,
  680. }
  681. putHardware(obj).then(response => {
  682. this.msgSuccess(response.msg)
  683. this.addType = false;
  684. this.listBySubjectId();
  685. });
  686. },
  687. //删除控制设备
  688. delHardwareTwo(item){
  689. this.$confirm('确认要删除该一体机?', "警告", {
  690. confirmButtonText: "确定",
  691. cancelButtonText: "取消",
  692. type: "warning"
  693. }).then(() => {
  694. // 确定
  695. delHardware(item.id).then((response) => {
  696. this.msgSuccess(response.msg)
  697. this.addType = false;
  698. this.listBySubjectId();
  699. });
  700. }).catch(function() {
  701. // 取消
  702. });
  703. },
  704. //添加一体机
  705. addHardware(){
  706. let obj = {
  707. type:0,
  708. name:this.form.name,
  709. pcType:this.form.pcType,
  710. hardwareNum:this.form.hardwareNum,
  711. subjectId:this.subjectData.id,
  712. deptId:this.subjectData.deptId,
  713. deptName:this.subjectData.deptName,
  714. }
  715. addHardware(obj).then(response => {
  716. this.msgSuccess(response.msg)
  717. this.addType = false;
  718. this.listBySubjectId();
  719. });
  720. },
  721. //编辑一体机
  722. putHardware(){
  723. let obj = {
  724. id:this.form.id,
  725. name:this.form.name,
  726. pcType:this.form.pcType,
  727. hardwareNum:this.form.hardwareNum,
  728. }
  729. putHardware(obj).then(response => {
  730. this.msgSuccess(response.msg)
  731. this.addType = false;
  732. this.listBySubjectId();
  733. });
  734. },
  735. //删除一体机
  736. delHardware(item){
  737. this.$confirm('确认要删除该一体机?', "警告", {
  738. confirmButtonText: "确定",
  739. cancelButtonText: "取消",
  740. type: "warning"
  741. }).then(() => {
  742. // 确定
  743. delHardware(item.id).then((response) => {
  744. this.msgSuccess(response.msg)
  745. this.addType = false;
  746. this.listBySubjectId();
  747. });
  748. }).catch(function() {
  749. // 取消
  750. });
  751. },
  752. //添加传感器
  753. addSensor(){
  754. let obj = {
  755. type:this.form.type,
  756. gatewayId:this.form.gatewayId,
  757. routeNum:this.form.routeNum,
  758. configName:this.form.configName,
  759. configStatus:this.form.configStatus,
  760. subjectId:this.subjectData.id
  761. }
  762. addSensor(obj).then(response => {
  763. this.msgSuccess(response.msg)
  764. this.addType = false;
  765. this.listBySubjectId();
  766. });
  767. },
  768. //编辑传感器
  769. putSensor(){
  770. let obj = {
  771. type:this.form.type,
  772. id:this.form.id,
  773. gatewayId:this.form.gatewayId,
  774. routeNum:this.form.routeNum,
  775. configName:this.form.configName,
  776. configStatus:this.form.configStatus,
  777. }
  778. putSensor(obj).then(response => {
  779. this.msgSuccess(response.msg)
  780. this.addType = false;
  781. this.listBySubjectId();
  782. });
  783. },
  784. //删除传感器
  785. delSensor(item){
  786. this.$confirm('确认要删除该传感器?', "警告", {
  787. confirmButtonText: "确定",
  788. cancelButtonText: "取消",
  789. type: "warning"
  790. }).then(() => {
  791. // 确定
  792. delSensor(item.id).then((response) => {
  793. this.msgSuccess(response.msg)
  794. this.addType = false;
  795. this.listBySubjectId();
  796. });
  797. }).catch(function() {
  798. // 取消
  799. });
  800. },
  801. //新增智能门禁
  802. addEntrance(){
  803. let obj = {
  804. type:11,
  805. subjectId:this.subjectData.id,
  806. hardwareNum:this.form.hardwareNum,
  807. name:this.form.name,
  808. ipAddress:this.form.ipAddress,
  809. port:this.form.port,
  810. harUser:this.form.harUser,
  811. harPsw:this.form.harPsw,
  812. controlScope:this.form.controlScope.join(','),
  813. }
  814. addHardware(obj).then(response => {
  815. if(response.code==200){
  816. this.msgSuccess(response.msg)
  817. this.addType = false;
  818. this.listBySubjectId();
  819. }else if(response.code==205){
  820. this.$confirm(response.msg, "警告", {
  821. confirmButtonText: "确定",
  822. cancelButtonText: "取消",
  823. type: "warning"
  824. }).then(() => {
  825. // 确定
  826. this.$router.push({ path: '/comprehensive/laboratoryManagement/accessAuthorization' });
  827. }).catch(function() {
  828. // 取消
  829. });
  830. }
  831. });
  832. },
  833. //编辑智能门禁
  834. editEntrance(){
  835. let obj = {
  836. id:this.form.id,
  837. hardwareNum:this.form.hardwareNum,
  838. name:this.form.name,
  839. ipAddress:this.form.ipAddress,
  840. port:this.form.port,
  841. harUser:this.form.harUser,
  842. harPsw:this.form.harPsw,
  843. controlScope:this.form.controlScope.join(','),
  844. subjectId:this.subjectData.id
  845. }
  846. putHardware(obj).then(response => {
  847. this.msgSuccess(response.msg)
  848. this.addType = false;
  849. this.listBySubjectId();
  850. });
  851. },
  852. //新增电子信息牌
  853. addSign(){
  854. let obj = {
  855. subjectId:this.subjectData.id,
  856. subjectName:this.subjectData.name,
  857. cardNum:this.form.cardNum,
  858. location:this.form.location,
  859. isStart:this.form.isStart,
  860. deptId:this.subjectData.deptId,
  861. deptName:this.subjectData.deptName,
  862. }
  863. subjectSignAdd(obj).then(response => {
  864. if(response.code==200){
  865. this.msgSuccess(response.msg)
  866. this.addType = false;
  867. this.listBySubjectId();
  868. }
  869. });
  870. },
  871. //编辑电子信息牌
  872. editSign(){
  873. let obj = {
  874. id:this.form.id,
  875. cardNum:this.form.cardNum,
  876. location:this.form.location,
  877. isStart:this.form.isStart,
  878. subjectId:this.subjectData.id,
  879. subjectName:this.subjectData.name,
  880. deptId:this.subjectData.deptId,
  881. deptName:this.subjectData.deptName,
  882. }
  883. subjectSignEdit(obj).then(response => {
  884. this.msgSuccess(response.msg)
  885. this.addType = false;
  886. this.listBySubjectId();
  887. });
  888. },
  889. //添加
  890. addData(type){
  891. // this.resetForm("form");
  892. if(type == 1){
  893. this.title = '新增传感器';
  894. this.$set(this,'form',{
  895. type:"",
  896. gatewayId:"",
  897. routeNum:"",
  898. configName:"",
  899. configStatus:"",
  900. });
  901. }else if(type == 2){
  902. this.title = '新增一体机';
  903. this.$set(this,'form',{
  904. name:"",
  905. pcType:"",
  906. hardwareNum:"",
  907. });
  908. }else if(type == 3){
  909. this.title = '新增控制设备';
  910. this.form.hardwareType = 1;
  911. this.disabledType = false;
  912. this.$set(this,'form',{
  913. type:"",
  914. hardwareType:"",
  915. relayCode:"",
  916. bit:"",
  917. configName:"",
  918. configStatus:"",
  919. });
  920. }else if(type == 4){
  921. this.title = '新增摄像头';
  922. this.$set(this,'form',{
  923. hardwareNum:"",
  924. subType:[],
  925. });
  926. }else if(type == 'addEntrance'){
  927. this.title = '新增智能门禁';
  928. this.$set(this,'form',{
  929. hardwareNum:"",
  930. name:"",
  931. ipAddress:"",
  932. port:"",
  933. harUser:"",
  934. harPsw:"",
  935. controlScope:[],
  936. });
  937. }else if(type == 'addSign'){
  938. this.title = '新增电子信息牌';
  939. this.$set(this,'form',{
  940. cardNum:"",
  941. subjectName:"",
  942. subjectId:"",
  943. location:"",
  944. isStart:"",
  945. deptId:"",
  946. deptName:"",
  947. });
  948. }
  949. this.addType = true;
  950. this.upType = type;
  951. },
  952. //编辑
  953. editData(type,row){
  954. if(type == 5){
  955. this.title = '编辑传感器';
  956. this.$set(this,'form',JSON.parse(JSON.stringify(row)));
  957. this.$set(this.form,'type',JSON.parse(JSON.stringify(row.type.enumName)));
  958. }else if(type == 6){
  959. this.title = '编辑一体机';
  960. this.$set(this,'form',JSON.parse(JSON.stringify(row)));
  961. this.$set(this.form,'pcType',JSON.parse(JSON.stringify(row.pcType+'')));
  962. }else if(type == 7){
  963. this.title = '编辑控制设备';
  964. this.disabledType = true;
  965. this.$set(this,'form',JSON.parse(JSON.stringify(row)));
  966. this.$set(this.form,'type',JSON.parse(JSON.stringify(row.type.code+'')));
  967. }else if(type == 8){
  968. this.title = '编辑摄像头';
  969. this.$set(this,'form',JSON.parse(JSON.stringify(row)));
  970. if(this.form.subType!='' && this.form.subType!=null ){
  971. this.form.subType=this.form.subType.split(',')
  972. }else{
  973. this.form.subType=[];
  974. }
  975. }else if(type == 'editEntrance'){
  976. this.title = '编辑智能门禁';
  977. this.$set(this,'form',JSON.parse(JSON.stringify(row)));
  978. if(row.controlScope){
  979. this.form.controlScope=row.controlScope.split(',')
  980. }else{
  981. this.form.controlScope=[]
  982. }
  983. }else if(type=='editSign'){
  984. this.title = '编辑电子信息牌';
  985. this.$set(this,'form',JSON.parse(JSON.stringify(row)));
  986. }
  987. this.addType = true;
  988. this.upType = type;
  989. },
  990. //获取列表
  991. listBySubjectId(){
  992. console.log(this.subjectData)
  993. let obj = {
  994. subjectId:this.subjectData.id
  995. };
  996. listBySubjectId(obj).then(response => {
  997. if(response.data.listCgq){
  998. this.$set(this,'listCgq',response.data.listCgq);
  999. }
  1000. if(response.data.listYtj){
  1001. this.$set(this,'listYtj',response.data.listYtj);
  1002. }
  1003. if(response.data.listkzsb){
  1004. this.$set(this,'listkzsb',response.data.listkzsb);
  1005. }
  1006. if(response.data.listSpjk){
  1007. //判断是否是抓拍摄像头
  1008. for(let i=0; i< response.data.listSpjk.length;i++){
  1009. response.data.listSpjk[i].isArrest=(response.data.listSpjk[i].subType!=''&& response.data.listSpjk[i].subType!=null);
  1010. }
  1011. this.$set(this,'listSpjk',response.data.listSpjk);
  1012. }
  1013. if(response.data.listHK){
  1014. this.$set(this,'listHK',response.data.listHK);
  1015. }
  1016. if(response.data.listXxp){
  1017. this.$set(this,'listXxp',response.data.listXxp);
  1018. }
  1019. });
  1020. },
  1021. //返回上一页
  1022. backPage(){
  1023. this.$parent.clickPage(1);
  1024. },
  1025. //传感器类型
  1026. getSensorList(){
  1027. getSensorList().then(response => {
  1028. this.sensorAddOptions = response.data;
  1029. });
  1030. },
  1031. }
  1032. }
  1033. </script>
  1034. <style scoped lang="scss">
  1035. .deviceList{
  1036. flex:1;
  1037. display: flex;
  1038. flex-direction: column;
  1039. padding-bottom:20px;
  1040. border-radius:10px!important;
  1041. margin:5px 20px 20px 10px!important;
  1042. box-shadow: 0 0 8px 1px rgba(0, 0, 0, 0.1) !important;
  1043. *{
  1044. margin:0;
  1045. }
  1046. .title-box{
  1047. display: flex;
  1048. margin:0 20px;
  1049. .left-title{
  1050. flex:1;
  1051. height:80px;
  1052. line-height:80px;
  1053. color:#0045AF;
  1054. font-size:18px;
  1055. }
  1056. .right-button{
  1057. margin:20px 0;
  1058. }
  1059. }
  1060. .for-max-box{
  1061. margin:0 40px;
  1062. font-weight:500;
  1063. .for-big-box{
  1064. border: 1px solid #E0E0E0;
  1065. display: inline-block;
  1066. overflow: hidden;
  1067. width:280px;
  1068. min-height:158px;
  1069. padding-bottom:10px;
  1070. border-radius: 6px;
  1071. margin:0 20px 20px 0;
  1072. position: relative;
  1073. .camera{
  1074. position: absolute;
  1075. right: 0;
  1076. top: 0;
  1077. width: 50px;
  1078. height: 30px;
  1079. background: #0183FA;
  1080. border-radius: 10px 0px 10px 0px;
  1081. font-size: 14px;
  1082. font-weight: 400;
  1083. color: #FFFFFF;
  1084. line-height: 30px;
  1085. text-align: center;
  1086. }
  1087. .for-title-p{
  1088. background: rgba(182,214,254,1);
  1089. color:#0183FA;
  1090. font-size:16px;
  1091. line-height:40px;
  1092. display:block;
  1093. overflow:hidden;
  1094. text-overflow:ellipsis;
  1095. white-space:nowrap;
  1096. padding:0 16px;
  1097. margin-bottom:10px;
  1098. font-weight:700;
  1099. }
  1100. .for-text-box{
  1101. display: flex;
  1102. padding:0 23px;
  1103. p{
  1104. font-size:14px;
  1105. line-height:30px;
  1106. flex:1;
  1107. }
  1108. p:nth-child(1){
  1109. color:#333;
  1110. text-align: left;
  1111. }
  1112. p:nth-child(2){
  1113. color:#999;
  1114. text-align: right;
  1115. overflow:hidden;
  1116. text-overflow:ellipsis;
  1117. white-space:nowrap;
  1118. }
  1119. }
  1120. .for-button-box{
  1121. display: flex;
  1122. line-height:26px;
  1123. margin-top:10px;
  1124. p{
  1125. text-align: center;
  1126. font-size:14px;
  1127. color:#666666;
  1128. }
  1129. p:nth-child(1){
  1130. flex:1;
  1131. cursor: pointer;
  1132. i{
  1133. color:#1151b4;
  1134. margin-right:10px;
  1135. }
  1136. }
  1137. p:nth-child(2){
  1138. width:2px;
  1139. height:14px;
  1140. margin:6px 0;
  1141. background: #CCCCCC;
  1142. }
  1143. p:nth-child(3){
  1144. flex:1;
  1145. cursor: pointer;
  1146. i{
  1147. color:#ff6868;
  1148. margin-right:10px;
  1149. }
  1150. }
  1151. }
  1152. }
  1153. .for-big-box-two{
  1154. border: 1px solid #E0E0E0;
  1155. display: inline-block;
  1156. overflow: hidden;
  1157. width:280px;
  1158. min-height:158px;
  1159. padding-bottom:10px;
  1160. border-radius: 6px;
  1161. margin:0 20px 20px 0;
  1162. .for-title-p{
  1163. background: rgba(182,214,254,1);
  1164. color:#0183FA;
  1165. font-size:16px;
  1166. line-height:40px;
  1167. display:block;
  1168. overflow:hidden;
  1169. text-overflow:ellipsis;
  1170. white-space:nowrap;
  1171. padding:0 16px;
  1172. margin-bottom:10px;
  1173. font-weight:700;
  1174. }
  1175. .for-text-box{
  1176. display: flex;
  1177. padding:0 23px;
  1178. p{
  1179. font-size:14px;
  1180. line-height:30px;
  1181. flex:1;
  1182. }
  1183. p:nth-child(1){
  1184. text-align: left;
  1185. color:#333;
  1186. }
  1187. p:nth-child(2){
  1188. color:#999;
  1189. text-align: right;
  1190. overflow:hidden;
  1191. text-overflow:ellipsis;
  1192. white-space:nowrap;
  1193. }
  1194. }
  1195. .for-button-box{
  1196. display: flex;
  1197. line-height:26px;
  1198. margin-top:10px;
  1199. p{
  1200. text-align: center;
  1201. font-size:14px;
  1202. color:#666666;
  1203. }
  1204. p:nth-child(1){
  1205. flex:1;
  1206. cursor: pointer;
  1207. i{
  1208. color:#1151b4;
  1209. margin-right:10px;
  1210. }
  1211. }
  1212. p:nth-child(2){
  1213. width:2px;
  1214. height:14px;
  1215. margin:6px 0;
  1216. background: #CCCCCC;
  1217. }
  1218. p:nth-child(3){
  1219. flex:1;
  1220. cursor: pointer;
  1221. i{
  1222. color:#ff6868;
  1223. margin-right:10px;
  1224. }
  1225. }
  1226. }
  1227. }
  1228. .add-for-p{
  1229. font-size:14px;
  1230. border: 1px solid #E0E0E0;
  1231. display: inline-block;
  1232. overflow: hidden;
  1233. width:280px;
  1234. height:130px;
  1235. line-height:130px;
  1236. text-align: center;
  1237. border-radius: 6px;
  1238. color:#999999;
  1239. cursor: pointer;
  1240. margin:0 20px 20px 0;
  1241. i{
  1242. margin-right:10px;
  1243. }
  1244. }
  1245. .add-for-p-two{
  1246. font-size:14px;
  1247. border: 1px solid #E0E0E0;
  1248. display: inline-block;
  1249. overflow: hidden;
  1250. width:280px;
  1251. height:158px;
  1252. line-height:158px;
  1253. text-align: center;
  1254. border-radius: 6px;
  1255. color:#999999;
  1256. cursor: pointer;
  1257. margin:0 20px 20px 0;
  1258. i{
  1259. margin-right:10px;
  1260. }
  1261. }
  1262. }
  1263. }
  1264. </style>