deviceList.vue 38 KB

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