deviceList.vue 38 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187
  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">
  26. <p class="left-title">智能门禁</p>
  27. </div>
  28. <div class="for-max-box">
  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">
  121. <p class="left-title">电子信息牌</p>
  122. </div>
  123. <div class="for-max-box">
  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="hardwareType">
  203. <el-radio-group v-model="form.hardwareType">
  204. <el-radio :label="1">老继电器</el-radio>
  205. <el-radio :label="2">新继电器</el-radio>
  206. </el-radio-group>
  207. </el-form-item>
  208. <el-form-item label="设备编号" prop="relayCode">
  209. <el-input v-model="form.relayCode" placeholder="请输入设备编号"
  210. maxlength="30" style="width:320px;"/>
  211. </el-form-item>
  212. <el-form-item label="设备路由" prop="bit">
  213. <el-input v-model="form.bit" oninput="value=value.replace(/[^0-9.]/g,'')" maxlength="2" placeholder="请输入路由" style="width:320px;"></el-input>
  214. </el-form-item>
  215. <el-form-item label="设备参数" prop="configName" v-if="form.hardwareType == 2">
  216. <el-input v-model="form.configName" maxlength="30" placeholder="请输入设备参数" style="width:320px;"></el-input>
  217. </el-form-item>
  218. <el-form-item label="参数状态" prop="configStatus" v-if="form.hardwareType == 2">
  219. <el-input v-model="form.configStatus" maxlength="30" placeholder="请输入参数状态" style="width:320px;"></el-input>
  220. </el-form-item>
  221. </div>
  222. <div v-if="upType == 4 || upType == 8">
  223. <el-form-item label="摄像头编号" prop="hardwareNum">
  224. <el-input v-model="form.hardwareNum" placeholder="摄像头编号"
  225. maxlength="30" style="width:320px;"/>
  226. </el-form-item>
  227. </div>
  228. <div v-if="upType == 'addEntrance'|| upType=='editEntrance'">
  229. <el-form-item label="门禁编号" prop="hardwareNum">
  230. <el-input
  231. style="width:320px;"
  232. v-model="form.hardwareNum"
  233. placeholder="请输入门禁编号"
  234. maxlength="20"
  235. size="small"
  236. />
  237. </el-form-item>
  238. <el-form-item label="门禁名称" prop="name" >
  239. <el-input
  240. style="width:320px;"
  241. v-model="form.name"
  242. placeholder="请输入门禁名称"
  243. maxlength="8"
  244. size="small"
  245. />
  246. </el-form-item>
  247. <el-form-item label="IP" prop="ipAddress" >
  248. <el-input
  249. style="width:320px;"
  250. v-model="form.ipAddress"
  251. placeholder="请输入IP"
  252. maxlength="15"
  253. size="small"
  254. />
  255. </el-form-item>
  256. <el-form-item label="端口" prop="port" >
  257. <el-input
  258. style="width:320px;"
  259. v-model="form.port"
  260. placeholder="请输入端口"
  261. maxlength="6"
  262. size="small"
  263. />
  264. </el-form-item>
  265. <el-form-item label="设备管理证号" prop="harUser" >
  266. <el-input
  267. style="width:320px;"
  268. v-model="form.harUser"
  269. placeholder="请输入设备管理证号"
  270. maxlength="30"
  271. size="small"
  272. />
  273. </el-form-item>
  274. <el-form-item label="设备管理密码" prop="harPsw" >
  275. <el-input
  276. style="width:320px;"
  277. v-model="form.harPsw"
  278. placeholder="请输入设备管理密码"
  279. maxlength="30"
  280. size="small"
  281. />
  282. </el-form-item>
  283. <el-form-item label="门禁权限" style="margin-bottom: 0">
  284. <el-checkbox-group v-model="form.controlScope">
  285. <el-checkbox label="1" >关联安全准入</el-checkbox>
  286. <el-checkbox label="2">关联白名单</el-checkbox>
  287. </el-checkbox-group>
  288. </el-form-item>
  289. <p style="margin:0 20px 0 104px;color: #FD2A2A;">关联之后申请安全准入或者白名单后自动授权门禁,不关联则需要单独授权门禁</p>
  290. </div>
  291. <div v-if="upType == 'addSign'|| upType=='editSign'">
  292. <el-form-item label="设备编号" prop="cardNum">
  293. <el-input
  294. style="width:320px;"
  295. v-model="form.cardNum"
  296. placeholder="请输入设备编号"
  297. maxlength="20"
  298. size="small"
  299. />
  300. </el-form-item>
  301. <el-form-item label="实验室">
  302. <el-input
  303. style="width:320px;"
  304. v-model="subjectData.name"
  305. placeholder="请选择实验室"
  306. maxlength="20"
  307. size="small"
  308. disabled
  309. />
  310. </el-form-item>
  311. <!-- <el-form-item label="实验室" prop="subjectId">-->
  312. <!-- <el-select-->
  313. <!-- style="width:300px;"-->
  314. <!-- v-model="form.subjectName"-->
  315. <!-- filterable-->
  316. <!-- remote-->
  317. <!-- clearable-->
  318. <!-- reserve-keyword-->
  319. <!-- @focus="selectFocus"-->
  320. <!-- @change="selectChange"-->
  321. <!-- placeholder="请选择实验地点"-->
  322. <!-- :remote-method="userSelectList"-->
  323. <!-- :loading="loading">-->
  324. <!-- <el-option-->
  325. <!-- v-for="item in laboratoryOptions"-->
  326. <!-- :key="item.id"-->
  327. <!-- :label="item.name"-->
  328. <!-- :value="item.id">-->
  329. <!-- </el-option>-->
  330. <!-- </el-select>-->
  331. <!-- </el-form-item>-->
  332. <el-form-item label="安装位置" >
  333. <el-input
  334. style="width:320px;"
  335. v-model="form.location"
  336. placeholder="请输入安装位置"
  337. maxlength="10"
  338. size="small"
  339. />
  340. </el-form-item>
  341. <el-form-item label="关联门禁">
  342. <el-radio-group v-model="form.isStart">
  343. <el-radio :label="1">是</el-radio>
  344. <el-radio :label="2">否</el-radio>
  345. </el-radio-group>
  346. </el-form-item>
  347. </div>
  348. </el-form>
  349. <div slot="footer" class="dialog-footer">
  350. <el-button @click="cancel">取 消</el-button>
  351. <el-button type="primary" @click="submitForm">确 定</el-button>
  352. </div>
  353. </el-dialog>
  354. </div>
  355. </template>
  356. <script>
  357. import {
  358. listBySubjectId,
  359. addSensor,
  360. putSensor,
  361. delSensor,
  362. addHardware,
  363. putHardware,
  364. delHardware,
  365. subjectSignAdd, subjectSignEdit, subjectSignDelete
  366. } from '@/api/laboratory/subject'
  367. import { getSensorList } from "@/api/laboratory/sensor";
  368. import { subjectList } from '@/api/gasManage3_0/gasManage'
  369. export default {
  370. name: "deviceList",
  371. props:{
  372. subjectData:{},
  373. },
  374. data() {
  375. return {
  376. loading:false,
  377. title:"",
  378. addType:false,
  379. listCgq:[], //传感器
  380. listYtj:[], //一体机
  381. listkzsb:[],
  382. listSpjk:[], //摄像头
  383. listHK:[],//智能门禁
  384. listXxp:[],//电子信息牌
  385. form:{
  386. },
  387. laboratoryOptions:[],
  388. // 表单校验
  389. rules: {
  390. name:[
  391. {required: true, message: '请输入名称', trigger: 'blur'},
  392. { required: true, message: "请输入名称", validator: this.spaceJudgment, trigger: "blur" }
  393. ],
  394. type:[
  395. {required: true, message: '类型不能为空', trigger: 'blur'}
  396. ],
  397. gatewayId:[
  398. {required: true, message: '网关不能为空', trigger: 'blur'},
  399. { required: true, message: "网关不能为空", validator: this.spaceJudgment, trigger: "blur" }
  400. ],
  401. hardwareNum:[
  402. { required: true, message: "请输入编号", trigger: "blur" },
  403. { required: true, message: "请输入编号", validator: this.spaceJudgment, trigger: "blur" }
  404. ],
  405. pcType: [
  406. { required: true, message: "请选择类型", trigger: "blur" },
  407. ],
  408. hardwareType: [
  409. { required: true, message: "请选择设备版本", trigger: "blur" },
  410. ],
  411. relayCode: [
  412. { required: true, message: "请输入设备编号", trigger: "blur" },
  413. { required: true, message: "请输入设备编号", validator: this.spaceJudgment, trigger: "blur" }
  414. ],
  415. bit: [
  416. { required: true, message: "请输入路由", trigger: "blur" },
  417. { required: true, message: "请输入路由", validator: this.spaceJudgment, trigger: "blur" }
  418. ],
  419. ipAddress: [
  420. { required: true, message: "请输入IP", trigger: "blur" },
  421. { required: true, message: "请输入IP", validator: this.spaceJudgment, trigger: "blur" }
  422. ],
  423. port: [
  424. { required: true, message: "请输入端口", trigger: "blur" },
  425. { required: true, message: "请输入端口", validator: this.spaceJudgment, trigger: "blur" }
  426. ],
  427. harUser: [
  428. { required: true, message: "请输入设备管理证号", trigger: "blur" },
  429. { required: true, message: "请输入设备管理证号", validator: this.spaceJudgment, trigger: "blur" }
  430. ],
  431. harPsw: [
  432. { required: true, message: "请输入设备管理密码", trigger: "blur" },
  433. { required: true, message: "请输入设备管理密码", validator: this.spaceJudgment, trigger: "blur" }
  434. ],
  435. cardNum:[
  436. { required: true, message: "请输入设备编号", trigger: "blur" },
  437. { required: true, message: "请输入设备编号", validator: this.spaceJudgment, trigger: "blur" }
  438. ],
  439. subjectId: [
  440. { required: true, message: "请选择实验室", trigger: "blur" }
  441. ],
  442. },
  443. //提交类型
  444. upType:"",
  445. //传感器类型
  446. sensorAddOptions: [],
  447. }
  448. },
  449. created() {
  450. this.listBySubjectId();
  451. this.getSensorList();
  452. },
  453. mounted(){
  454. },
  455. methods:{
  456. selectFocus(){
  457. if(!this.laboratoryOptions[0]){
  458. this.userSelectList("");
  459. }
  460. },
  461. //懒加载实验室
  462. userSelectList(e){
  463. subjectList({name:e,deptId:this.form.deptId}).then(response => {
  464. this.laboratoryOptions = response.data;
  465. });
  466. },
  467. //实验室选择
  468. selectChange(e){
  469. let self = this;
  470. for(let i=0;i<self.laboratoryOptions.length;i++){
  471. if(self.laboratoryOptions[i].id == e){
  472. this.$set(this.form,"subject",self.laboratoryOptions[i]);
  473. this.$set(this.form,"subjectName",self.laboratoryOptions[i].name);
  474. }
  475. }
  476. this.$set(this.form,"subjectId",e);
  477. },
  478. // 取消按钮
  479. cancel() {
  480. this.addType = false;
  481. },
  482. // 提交
  483. submitForm() {
  484. this.$refs["form"].validate(valid => {
  485. if (valid) {
  486. if(this.upType == 1){
  487. //新增传感器
  488. this.addSensor();
  489. }else if(this.upType == 5){
  490. //编辑传感器
  491. this.putSensor();
  492. }else if(this.upType == 2){
  493. //新增一体机
  494. this.addHardware();
  495. }else if(this.upType == 6){
  496. //编辑一体机
  497. this.putHardware();
  498. }else if(this.upType == 3){
  499. //新增控制设备
  500. this.addHardwareTwo();
  501. }else if(this.upType == 7){
  502. //编辑控制设备
  503. this.putHardwareTwo();
  504. }else if(this.upType == 4){
  505. //新增控制设备
  506. this.addHardwareThree();
  507. }else if(this.upType == 8){
  508. //编辑控制设备
  509. this.putHardwareThree();
  510. }else if(this.upType == 'addEntrance'){
  511. //新增智能门禁
  512. this.addEntrance();
  513. }else if(this.upType == 'editEntrance'){
  514. //编辑智能门禁
  515. this.editEntrance();
  516. }else if(this.upType == 'addSign'){
  517. //新增电子信息牌
  518. this.addSign();
  519. }else if(this.upType == 'editSign'){
  520. //编辑电子信息牌
  521. this.editSign();
  522. }
  523. }
  524. });
  525. },
  526. //删除电子信息牌
  527. delSign(item){
  528. this.$confirm('确认要删除该电子信息牌?', "警告", {
  529. confirmButtonText: "确定",
  530. cancelButtonText: "取消",
  531. type: "warning"
  532. }).then(() => {
  533. // 确定
  534. subjectSignDelete(item.id).then((response) => {
  535. this.msgSuccess(response.msg)
  536. this.addType = false;
  537. this.listBySubjectId();
  538. });
  539. }).catch(function() {
  540. // 取消
  541. });
  542. },
  543. //删除智能门禁
  544. delEntrance(item){
  545. this.$confirm('确认要删除该智能门禁?', "警告", {
  546. confirmButtonText: "确定",
  547. cancelButtonText: "取消",
  548. type: "warning"
  549. }).then(() => {
  550. // 确定
  551. delHardware(item.id).then((response) => {
  552. this.msgSuccess(response.msg)
  553. this.addType = false;
  554. this.listBySubjectId();
  555. });
  556. }).catch(function() {
  557. // 取消
  558. });
  559. },
  560. //新增摄像头
  561. addHardwareThree(){
  562. let obj = {
  563. type:4,
  564. hardwareNum:this.form.hardwareNum,
  565. subjectId:this.subjectData.id,
  566. deptId:this.subjectData.deptId,
  567. deptName:this.subjectData.deptName,
  568. }
  569. addHardware(obj).then(response => {
  570. this.msgSuccess(response.msg)
  571. this.addType = false;
  572. this.listBySubjectId();
  573. });
  574. },
  575. //编辑摄像头
  576. putHardwareThree(){
  577. let obj = {
  578. id:this.form.id,
  579. hardwareNum:this.form.hardwareNum,
  580. subjectId:this.form.subjectId,
  581. deptId:this.form.deptId,
  582. deptName:this.form.deptName,
  583. }
  584. putHardware(obj).then(response => {
  585. this.msgSuccess(response.msg)
  586. this.addType = false;
  587. this.listBySubjectId();
  588. });
  589. },
  590. //删除摄像头
  591. delHardwareThree(item){
  592. this.$confirm('确认要删除该摄像头?', "警告", {
  593. confirmButtonText: "确定",
  594. cancelButtonText: "取消",
  595. type: "warning"
  596. }).then(() => {
  597. // 确定
  598. delHardware(item.id).then((response) => {
  599. this.msgSuccess(response.msg)
  600. this.addType = false;
  601. this.listBySubjectId();
  602. });
  603. }).catch(function() {
  604. // 取消
  605. });
  606. },
  607. //新增控制设备
  608. addHardwareTwo(){
  609. let obj = {
  610. type:this.form.type,
  611. hardwareType:this.form.hardwareType,
  612. relayCode:this.form.relayCode,
  613. bit:this.form.bit,
  614. configName:this.form.configName,
  615. configStatus:this.form.configStatus,
  616. subjectId:this.subjectData.id,
  617. deptId:this.subjectData.deptId,
  618. deptName:this.subjectData.deptName,
  619. }
  620. addHardware(obj).then(response => {
  621. this.msgSuccess(response.msg)
  622. this.addType = false;
  623. this.listBySubjectId();
  624. });
  625. },
  626. //编辑控制设备
  627. putHardwareTwo(){
  628. let obj = {
  629. id:this.form.id,
  630. hardwareType:this.form.hardwareType,
  631. relayCode:this.form.relayCode,
  632. bit:this.form.bit,
  633. configName:this.form.configName,
  634. configStatus:this.form.configStatus,
  635. subjectId:this.form.subjectId,
  636. deptId:this.form.deptId,
  637. deptName:this.form.deptName,
  638. }
  639. putHardware(obj).then(response => {
  640. this.msgSuccess(response.msg)
  641. this.addType = false;
  642. this.listBySubjectId();
  643. });
  644. },
  645. //删除控制设备
  646. delHardwareTwo(item){
  647. this.$confirm('确认要删除该一体机?', "警告", {
  648. confirmButtonText: "确定",
  649. cancelButtonText: "取消",
  650. type: "warning"
  651. }).then(() => {
  652. // 确定
  653. delHardware(item.id).then((response) => {
  654. this.msgSuccess(response.msg)
  655. this.addType = false;
  656. this.listBySubjectId();
  657. });
  658. }).catch(function() {
  659. // 取消
  660. });
  661. },
  662. //添加一体机
  663. addHardware(){
  664. let obj = {
  665. type:0,
  666. name:this.form.name,
  667. pcType:this.form.pcType,
  668. hardwareNum:this.form.hardwareNum,
  669. subjectId:this.subjectData.id,
  670. deptId:this.subjectData.deptId,
  671. deptName:this.subjectData.deptName,
  672. }
  673. addHardware(obj).then(response => {
  674. this.msgSuccess(response.msg)
  675. this.addType = false;
  676. this.listBySubjectId();
  677. });
  678. },
  679. //编辑一体机
  680. putHardware(){
  681. let obj = {
  682. id:this.form.id,
  683. name:this.form.name,
  684. pcType:this.form.pcType,
  685. hardwareNum:this.form.hardwareNum,
  686. }
  687. putHardware(obj).then(response => {
  688. this.msgSuccess(response.msg)
  689. this.addType = false;
  690. this.listBySubjectId();
  691. });
  692. },
  693. //删除一体机
  694. delHardware(item){
  695. this.$confirm('确认要删除该一体机?', "警告", {
  696. confirmButtonText: "确定",
  697. cancelButtonText: "取消",
  698. type: "warning"
  699. }).then(() => {
  700. // 确定
  701. delHardware(item.id).then((response) => {
  702. this.msgSuccess(response.msg)
  703. this.addType = false;
  704. this.listBySubjectId();
  705. });
  706. }).catch(function() {
  707. // 取消
  708. });
  709. },
  710. //添加传感器
  711. addSensor(){
  712. let obj = {
  713. type:this.form.type,
  714. gatewayId:this.form.gatewayId,
  715. routeNum:this.form.routeNum,
  716. configName:this.form.configName,
  717. configStatus:this.form.configStatus,
  718. subjectId:this.subjectData.id
  719. }
  720. addSensor(obj).then(response => {
  721. this.msgSuccess(response.msg)
  722. this.addType = false;
  723. this.listBySubjectId();
  724. });
  725. },
  726. //编辑传感器
  727. putSensor(){
  728. let obj = {
  729. type:this.form.type,
  730. id:this.form.id,
  731. gatewayId:this.form.gatewayId,
  732. routeNum:this.form.routeNum,
  733. configName:this.form.configName,
  734. configStatus:this.form.configStatus,
  735. }
  736. putSensor(obj).then(response => {
  737. this.msgSuccess(response.msg)
  738. this.addType = false;
  739. this.listBySubjectId();
  740. });
  741. },
  742. //删除传感器
  743. delSensor(item){
  744. this.$confirm('确认要删除该传感器?', "警告", {
  745. confirmButtonText: "确定",
  746. cancelButtonText: "取消",
  747. type: "warning"
  748. }).then(() => {
  749. // 确定
  750. delSensor(item.id).then((response) => {
  751. this.msgSuccess(response.msg)
  752. this.addType = false;
  753. this.listBySubjectId();
  754. });
  755. }).catch(function() {
  756. // 取消
  757. });
  758. },
  759. //新增智能门禁
  760. addEntrance(){
  761. let obj = {
  762. type:11,
  763. subjectId:this.subjectData.id,
  764. hardwareNum:this.form.hardwareNum,
  765. name:this.form.name,
  766. ipAddress:this.form.ipAddress,
  767. port:this.form.port,
  768. harUser:this.form.harUser,
  769. harPsw:this.form.harPsw,
  770. controlScope:this.form.controlScope.join(','),
  771. }
  772. addHardware(obj).then(response => {
  773. if(response.code==200){
  774. this.msgSuccess(response.msg)
  775. this.addType = false;
  776. this.listBySubjectId();
  777. }else if(response.code==205){
  778. this.$confirm(response.msg, "警告", {
  779. confirmButtonText: "确定",
  780. cancelButtonText: "取消",
  781. type: "warning"
  782. }).then(() => {
  783. // 确定
  784. this.$router.push({ path: '/comprehensive/laboratoryManagement/accessAuthorization' });
  785. }).catch(function() {
  786. // 取消
  787. });
  788. }
  789. });
  790. },
  791. //编辑智能门禁
  792. editEntrance(){
  793. let obj = {
  794. id:this.form.id,
  795. hardwareNum:this.form.hardwareNum,
  796. name:this.form.name,
  797. ipAddress:this.form.ipAddress,
  798. port:this.form.port,
  799. harUser:this.form.harUser,
  800. harPsw:this.form.harPsw,
  801. controlScope:this.form.controlScope.join(','),
  802. subjectId:this.subjectData.id
  803. }
  804. putHardware(obj).then(response => {
  805. this.msgSuccess(response.msg)
  806. this.addType = false;
  807. this.listBySubjectId();
  808. });
  809. },
  810. //新增电子信息牌
  811. addSign(){
  812. let obj = {
  813. subjectId:this.subjectData.id,
  814. subjectName:this.subjectData.name,
  815. cardNum:this.form.cardNum,
  816. location:this.form.location,
  817. isStart:this.form.isStart,
  818. }
  819. subjectSignAdd(obj).then(response => {
  820. if(response.code==200){
  821. this.msgSuccess(response.msg)
  822. this.addType = false;
  823. this.listBySubjectId();
  824. }
  825. });
  826. },
  827. //编辑电子信息牌
  828. editSign(){
  829. let obj = {
  830. id:this.form.id,
  831. cardNum:this.form.cardNum,
  832. location:this.form.location,
  833. isStart:this.form.isStart,
  834. subjectId:this.subjectData.id,
  835. subjectName:this.subjectData.name,
  836. }
  837. subjectSignEdit(obj).then(response => {
  838. this.msgSuccess(response.msg)
  839. this.addType = false;
  840. this.listBySubjectId();
  841. });
  842. },
  843. //添加
  844. addData(type){
  845. // this.resetForm("form");
  846. if(type == 1){
  847. this.title = '新增传感器';
  848. this.$set(this,'form',{
  849. type:"",
  850. gatewayId:"",
  851. routeNum:"",
  852. configName:"",
  853. configStatus:"",
  854. });
  855. }else if(type == 2){
  856. this.title = '新增一体机';
  857. this.$set(this,'form',{
  858. name:"",
  859. pcType:"",
  860. hardwareNum:"",
  861. });
  862. }else if(type == 3){
  863. this.title = '新增控制设备';
  864. this.form.hardwareType = 1;
  865. this.disabledType = false;
  866. this.$set(this,'form',{
  867. type:"",
  868. hardwareType:"",
  869. relayCode:"",
  870. bit:"",
  871. configName:"",
  872. configStatus:"",
  873. });
  874. }else if(type == 4){
  875. this.title = '新增摄像头';
  876. this.$set(this,'form',{
  877. hardwareNum:"",
  878. });
  879. }else if(type == 'addEntrance'){
  880. this.title = '新增智能门禁';
  881. this.$set(this,'form',{
  882. hardwareNum:"",
  883. name:"",
  884. ipAddress:"",
  885. port:"",
  886. harUser:"",
  887. harPsw:"",
  888. controlScope:[],
  889. });
  890. }else if(type == 'addSign'){
  891. this.title = '新增电子信息牌';
  892. this.$set(this,'form',{
  893. cardNum:"",
  894. subjectName:"",
  895. subjectId:"",
  896. location:"",
  897. isStart:"",
  898. });
  899. }
  900. this.addType = true;
  901. this.upType = type;
  902. },
  903. //编辑
  904. editData(type,row){
  905. if(type == 5){
  906. this.title = '编辑传感器';
  907. this.$set(this,'form',JSON.parse(JSON.stringify(row)));
  908. this.$set(this.form,'type',JSON.parse(JSON.stringify(row.type.enumName)));
  909. }else if(type == 6){
  910. this.title = '编辑一体机';
  911. this.$set(this,'form',JSON.parse(JSON.stringify(row)));
  912. this.$set(this.form,'pcType',JSON.parse(JSON.stringify(row.pcType+'')));
  913. }else if(type == 7){
  914. this.title = '编辑控制设备';
  915. this.disabledType = true;
  916. this.$set(this,'form',JSON.parse(JSON.stringify(row)));
  917. this.$set(this.form,'type',JSON.parse(JSON.stringify(row.type.code+'')));
  918. }else if(type == 8){
  919. this.title = '编辑摄像头';
  920. this.$set(this,'form',JSON.parse(JSON.stringify(row)));
  921. }else if(type == 'editEntrance'){
  922. this.title = '编辑智能门禁';
  923. this.$set(this,'form',JSON.parse(JSON.stringify(row)));
  924. if(row.controlScope){
  925. this.form.controlScope=row.controlScope.split(',')
  926. }else{
  927. this.form.controlScope=[]
  928. }
  929. }else if(type=='editSign'){
  930. this.title = '编辑电子信息牌';
  931. this.$set(this,'form',JSON.parse(JSON.stringify(row)));
  932. }
  933. this.addType = true;
  934. this.upType = type;
  935. },
  936. //获取列表
  937. listBySubjectId(){
  938. let obj = {
  939. subjectId:this.subjectData.id
  940. };
  941. console.log("obj",obj)
  942. listBySubjectId(obj).then(response => {
  943. this.$set(this,'listCgq',response.data.listCgq);
  944. this.$set(this,'listYtj',response.data.listYtj);
  945. this.$set(this,'listkzsb',response.data.listkzsb);
  946. this.$set(this,'listSpjk',response.data.listSpjk);
  947. this.$set(this,'listHK',response.data.listHK);
  948. this.$set(this,'listXxp',response.data.listXxp);
  949. });
  950. },
  951. //返回上一页
  952. backPage(){
  953. this.$parent.clickPage(1);
  954. },
  955. //传感器类型
  956. getSensorList(){
  957. getSensorList().then(response => {
  958. this.sensorAddOptions = response.data;
  959. });
  960. },
  961. }
  962. }
  963. </script>
  964. <style scoped lang="scss">
  965. .deviceList{
  966. flex:1;
  967. display: flex;
  968. flex-direction: column;
  969. padding-bottom:20px;
  970. border-radius:10px!important;
  971. margin:5px 20px 20px 10px!important;
  972. box-shadow: 0 0 8px 1px rgba(0, 0, 0, 0.1) !important;
  973. *{
  974. margin:0;
  975. }
  976. .title-box{
  977. display: flex;
  978. margin:0 20px;
  979. .left-title{
  980. flex:1;
  981. height:80px;
  982. line-height:80px;
  983. color:#0045AF;
  984. font-size:18px;
  985. }
  986. .right-button{
  987. margin:20px 0;
  988. }
  989. }
  990. .for-max-box{
  991. margin:0 40px;
  992. font-weight:500;
  993. .for-big-box{
  994. border: 1px solid #E0E0E0;
  995. display: inline-block;
  996. overflow: hidden;
  997. width:280px;
  998. min-height:130px;
  999. padding-bottom:10px;
  1000. border-radius: 6px;
  1001. margin:0 20px 20px 0;
  1002. .for-title-p{
  1003. background: rgba(182,214,254,1);
  1004. color:#0183FA;
  1005. font-size:16px;
  1006. line-height:40px;
  1007. display:block;
  1008. overflow:hidden;
  1009. text-overflow:ellipsis;
  1010. white-space:nowrap;
  1011. padding:0 16px;
  1012. margin-bottom:10px;
  1013. font-weight:700;
  1014. }
  1015. .for-text-box{
  1016. display: flex;
  1017. padding:0 23px;
  1018. p{
  1019. font-size:14px;
  1020. line-height:30px;
  1021. flex:1;
  1022. }
  1023. p:nth-child(1){
  1024. color:#333;
  1025. text-align: left;
  1026. }
  1027. p:nth-child(2){
  1028. color:#999;
  1029. text-align: right;
  1030. overflow:hidden;
  1031. text-overflow:ellipsis;
  1032. white-space:nowrap;
  1033. }
  1034. }
  1035. .for-button-box{
  1036. display: flex;
  1037. line-height:26px;
  1038. margin-top:10px;
  1039. p{
  1040. text-align: center;
  1041. font-size:14px;
  1042. color:#666666;
  1043. }
  1044. p:nth-child(1){
  1045. flex:1;
  1046. cursor: pointer;
  1047. i{
  1048. color:#1151b4;
  1049. margin-right:10px;
  1050. }
  1051. }
  1052. p:nth-child(2){
  1053. width:2px;
  1054. height:14px;
  1055. margin:6px 0;
  1056. background: #CCCCCC;
  1057. }
  1058. p:nth-child(3){
  1059. flex:1;
  1060. cursor: pointer;
  1061. i{
  1062. color:#ff6868;
  1063. margin-right:10px;
  1064. }
  1065. }
  1066. }
  1067. }
  1068. .for-big-box-two{
  1069. border: 1px solid #E0E0E0;
  1070. display: inline-block;
  1071. overflow: hidden;
  1072. width:280px;
  1073. min-height:158px;
  1074. padding-bottom:10px;
  1075. border-radius: 6px;
  1076. margin:0 20px 20px 0;
  1077. .for-title-p{
  1078. background: rgba(182,214,254,1);
  1079. color:#0183FA;
  1080. font-size:16px;
  1081. line-height:40px;
  1082. display:block;
  1083. overflow:hidden;
  1084. text-overflow:ellipsis;
  1085. white-space:nowrap;
  1086. padding:0 16px;
  1087. margin-bottom:10px;
  1088. font-weight:700;
  1089. }
  1090. .for-text-box{
  1091. display: flex;
  1092. padding:0 23px;
  1093. p{
  1094. font-size:14px;
  1095. line-height:30px;
  1096. flex:1;
  1097. }
  1098. p:nth-child(1){
  1099. text-align: left;
  1100. color:#333;
  1101. }
  1102. p:nth-child(2){
  1103. color:#999;
  1104. text-align: right;
  1105. overflow:hidden;
  1106. text-overflow:ellipsis;
  1107. white-space:nowrap;
  1108. }
  1109. }
  1110. .for-button-box{
  1111. display: flex;
  1112. line-height:26px;
  1113. margin-top:10px;
  1114. p{
  1115. text-align: center;
  1116. font-size:14px;
  1117. color:#666666;
  1118. }
  1119. p:nth-child(1){
  1120. flex:1;
  1121. cursor: pointer;
  1122. i{
  1123. color:#1151b4;
  1124. margin-right:10px;
  1125. }
  1126. }
  1127. p:nth-child(2){
  1128. width:2px;
  1129. height:14px;
  1130. margin:6px 0;
  1131. background: #CCCCCC;
  1132. }
  1133. p:nth-child(3){
  1134. flex:1;
  1135. cursor: pointer;
  1136. i{
  1137. color:#ff6868;
  1138. margin-right:10px;
  1139. }
  1140. }
  1141. }
  1142. }
  1143. .add-for-p{
  1144. font-size:14px;
  1145. border: 1px solid #E0E0E0;
  1146. display: inline-block;
  1147. overflow: hidden;
  1148. width:280px;
  1149. height:130px;
  1150. line-height:130px;
  1151. text-align: center;
  1152. border-radius: 6px;
  1153. color:#999999;
  1154. cursor: pointer;
  1155. margin:0 20px 20px 0;
  1156. i{
  1157. margin-right:10px;
  1158. }
  1159. }
  1160. .add-for-p-two{
  1161. font-size:14px;
  1162. border: 1px solid #E0E0E0;
  1163. display: inline-block;
  1164. overflow: hidden;
  1165. width:280px;
  1166. height:158px;
  1167. line-height:158px;
  1168. text-align: center;
  1169. border-radius: 6px;
  1170. color:#999999;
  1171. cursor: pointer;
  1172. margin:0 20px 20px 0;
  1173. i{
  1174. margin-right:10px;
  1175. }
  1176. }
  1177. }
  1178. }
  1179. </style>