deviceList.vue 38 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206
  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-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="30"
  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. deptId:this.subjectData.deptId,
  819. deptName:this.subjectData.deptName,
  820. }
  821. subjectSignAdd(obj).then(response => {
  822. if(response.code==200){
  823. this.msgSuccess(response.msg)
  824. this.addType = false;
  825. this.listBySubjectId();
  826. }
  827. });
  828. },
  829. //编辑电子信息牌
  830. editSign(){
  831. let obj = {
  832. id:this.form.id,
  833. cardNum:this.form.cardNum,
  834. location:this.form.location,
  835. isStart:this.form.isStart,
  836. subjectId:this.subjectData.id,
  837. subjectName:this.subjectData.name,
  838. deptId:this.subjectData.deptId,
  839. deptName:this.subjectData.deptName,
  840. }
  841. subjectSignEdit(obj).then(response => {
  842. this.msgSuccess(response.msg)
  843. this.addType = false;
  844. this.listBySubjectId();
  845. });
  846. },
  847. //添加
  848. addData(type){
  849. // this.resetForm("form");
  850. if(type == 1){
  851. this.title = '新增传感器';
  852. this.$set(this,'form',{
  853. type:"",
  854. gatewayId:"",
  855. routeNum:"",
  856. configName:"",
  857. configStatus:"",
  858. });
  859. }else if(type == 2){
  860. this.title = '新增一体机';
  861. this.$set(this,'form',{
  862. name:"",
  863. pcType:"",
  864. hardwareNum:"",
  865. });
  866. }else if(type == 3){
  867. this.title = '新增控制设备';
  868. this.form.hardwareType = 1;
  869. this.disabledType = false;
  870. this.$set(this,'form',{
  871. type:"",
  872. hardwareType:"",
  873. relayCode:"",
  874. bit:"",
  875. configName:"",
  876. configStatus:"",
  877. });
  878. }else if(type == 4){
  879. this.title = '新增摄像头';
  880. this.$set(this,'form',{
  881. hardwareNum:"",
  882. });
  883. }else if(type == 'addEntrance'){
  884. this.title = '新增智能门禁';
  885. this.$set(this,'form',{
  886. hardwareNum:"",
  887. name:"",
  888. ipAddress:"",
  889. port:"",
  890. harUser:"",
  891. harPsw:"",
  892. controlScope:[],
  893. });
  894. }else if(type == 'addSign'){
  895. this.title = '新增电子信息牌';
  896. this.$set(this,'form',{
  897. cardNum:"",
  898. subjectName:"",
  899. subjectId:"",
  900. location:"",
  901. isStart:"",
  902. deptId:"",
  903. deptName:"",
  904. });
  905. }
  906. this.addType = true;
  907. this.upType = type;
  908. },
  909. //编辑
  910. editData(type,row){
  911. if(type == 5){
  912. this.title = '编辑传感器';
  913. this.$set(this,'form',JSON.parse(JSON.stringify(row)));
  914. this.$set(this.form,'type',JSON.parse(JSON.stringify(row.type.enumName)));
  915. }else if(type == 6){
  916. this.title = '编辑一体机';
  917. this.$set(this,'form',JSON.parse(JSON.stringify(row)));
  918. this.$set(this.form,'pcType',JSON.parse(JSON.stringify(row.pcType+'')));
  919. }else if(type == 7){
  920. this.title = '编辑控制设备';
  921. this.disabledType = true;
  922. this.$set(this,'form',JSON.parse(JSON.stringify(row)));
  923. this.$set(this.form,'type',JSON.parse(JSON.stringify(row.type.code+'')));
  924. }else if(type == 8){
  925. this.title = '编辑摄像头';
  926. this.$set(this,'form',JSON.parse(JSON.stringify(row)));
  927. }else if(type == 'editEntrance'){
  928. this.title = '编辑智能门禁';
  929. this.$set(this,'form',JSON.parse(JSON.stringify(row)));
  930. if(row.controlScope){
  931. this.form.controlScope=row.controlScope.split(',')
  932. }else{
  933. this.form.controlScope=[]
  934. }
  935. }else if(type=='editSign'){
  936. this.title = '编辑电子信息牌';
  937. this.$set(this,'form',JSON.parse(JSON.stringify(row)));
  938. }
  939. this.addType = true;
  940. this.upType = type;
  941. },
  942. //获取列表
  943. listBySubjectId(){
  944. console.log(this.subjectData)
  945. let obj = {
  946. subjectId:this.subjectData.id
  947. };
  948. listBySubjectId(obj).then(response => {
  949. if(response.data.listCgq){
  950. this.$set(this,'listCgq',response.data.listCgq);
  951. }
  952. if(response.data.listYtj){
  953. this.$set(this,'listYtj',response.data.listYtj);
  954. }
  955. if(response.data.listkzsb){
  956. this.$set(this,'listkzsb',response.data.listkzsb);
  957. }
  958. if(response.data.listSpjk){
  959. this.$set(this,'listSpjk',response.data.listSpjk);
  960. }
  961. if(response.data.listHK){
  962. this.$set(this,'listHK',response.data.listHK);
  963. }
  964. if(response.data.listXxp){
  965. this.$set(this,'listXxp',response.data.listXxp);
  966. }
  967. });
  968. },
  969. //返回上一页
  970. backPage(){
  971. this.$parent.clickPage(1);
  972. },
  973. //传感器类型
  974. getSensorList(){
  975. getSensorList().then(response => {
  976. this.sensorAddOptions = response.data;
  977. });
  978. },
  979. }
  980. }
  981. </script>
  982. <style scoped lang="scss">
  983. .deviceList{
  984. flex:1;
  985. display: flex;
  986. flex-direction: column;
  987. padding-bottom:20px;
  988. border-radius:10px!important;
  989. margin:5px 20px 20px 10px!important;
  990. box-shadow: 0 0 8px 1px rgba(0, 0, 0, 0.1) !important;
  991. *{
  992. margin:0;
  993. }
  994. .title-box{
  995. display: flex;
  996. margin:0 20px;
  997. .left-title{
  998. flex:1;
  999. height:80px;
  1000. line-height:80px;
  1001. color:#0045AF;
  1002. font-size:18px;
  1003. }
  1004. .right-button{
  1005. margin:20px 0;
  1006. }
  1007. }
  1008. .for-max-box{
  1009. margin:0 40px;
  1010. font-weight:500;
  1011. .for-big-box{
  1012. border: 1px solid #E0E0E0;
  1013. display: inline-block;
  1014. overflow: hidden;
  1015. width:280px;
  1016. min-height:130px;
  1017. padding-bottom:10px;
  1018. border-radius: 6px;
  1019. margin:0 20px 20px 0;
  1020. .for-title-p{
  1021. background: rgba(182,214,254,1);
  1022. color:#0183FA;
  1023. font-size:16px;
  1024. line-height:40px;
  1025. display:block;
  1026. overflow:hidden;
  1027. text-overflow:ellipsis;
  1028. white-space:nowrap;
  1029. padding:0 16px;
  1030. margin-bottom:10px;
  1031. font-weight:700;
  1032. }
  1033. .for-text-box{
  1034. display: flex;
  1035. padding:0 23px;
  1036. p{
  1037. font-size:14px;
  1038. line-height:30px;
  1039. flex:1;
  1040. }
  1041. p:nth-child(1){
  1042. color:#333;
  1043. text-align: left;
  1044. }
  1045. p:nth-child(2){
  1046. color:#999;
  1047. text-align: right;
  1048. overflow:hidden;
  1049. text-overflow:ellipsis;
  1050. white-space:nowrap;
  1051. }
  1052. }
  1053. .for-button-box{
  1054. display: flex;
  1055. line-height:26px;
  1056. margin-top:10px;
  1057. p{
  1058. text-align: center;
  1059. font-size:14px;
  1060. color:#666666;
  1061. }
  1062. p:nth-child(1){
  1063. flex:1;
  1064. cursor: pointer;
  1065. i{
  1066. color:#1151b4;
  1067. margin-right:10px;
  1068. }
  1069. }
  1070. p:nth-child(2){
  1071. width:2px;
  1072. height:14px;
  1073. margin:6px 0;
  1074. background: #CCCCCC;
  1075. }
  1076. p:nth-child(3){
  1077. flex:1;
  1078. cursor: pointer;
  1079. i{
  1080. color:#ff6868;
  1081. margin-right:10px;
  1082. }
  1083. }
  1084. }
  1085. }
  1086. .for-big-box-two{
  1087. border: 1px solid #E0E0E0;
  1088. display: inline-block;
  1089. overflow: hidden;
  1090. width:280px;
  1091. min-height:158px;
  1092. padding-bottom:10px;
  1093. border-radius: 6px;
  1094. margin:0 20px 20px 0;
  1095. .for-title-p{
  1096. background: rgba(182,214,254,1);
  1097. color:#0183FA;
  1098. font-size:16px;
  1099. line-height:40px;
  1100. display:block;
  1101. overflow:hidden;
  1102. text-overflow:ellipsis;
  1103. white-space:nowrap;
  1104. padding:0 16px;
  1105. margin-bottom:10px;
  1106. font-weight:700;
  1107. }
  1108. .for-text-box{
  1109. display: flex;
  1110. padding:0 23px;
  1111. p{
  1112. font-size:14px;
  1113. line-height:30px;
  1114. flex:1;
  1115. }
  1116. p:nth-child(1){
  1117. text-align: left;
  1118. color:#333;
  1119. }
  1120. p:nth-child(2){
  1121. color:#999;
  1122. text-align: right;
  1123. overflow:hidden;
  1124. text-overflow:ellipsis;
  1125. white-space:nowrap;
  1126. }
  1127. }
  1128. .for-button-box{
  1129. display: flex;
  1130. line-height:26px;
  1131. margin-top:10px;
  1132. p{
  1133. text-align: center;
  1134. font-size:14px;
  1135. color:#666666;
  1136. }
  1137. p:nth-child(1){
  1138. flex:1;
  1139. cursor: pointer;
  1140. i{
  1141. color:#1151b4;
  1142. margin-right:10px;
  1143. }
  1144. }
  1145. p:nth-child(2){
  1146. width:2px;
  1147. height:14px;
  1148. margin:6px 0;
  1149. background: #CCCCCC;
  1150. }
  1151. p:nth-child(3){
  1152. flex:1;
  1153. cursor: pointer;
  1154. i{
  1155. color:#ff6868;
  1156. margin-right:10px;
  1157. }
  1158. }
  1159. }
  1160. }
  1161. .add-for-p{
  1162. font-size:14px;
  1163. border: 1px solid #E0E0E0;
  1164. display: inline-block;
  1165. overflow: hidden;
  1166. width:280px;
  1167. height:130px;
  1168. line-height:130px;
  1169. text-align: center;
  1170. border-radius: 6px;
  1171. color:#999999;
  1172. cursor: pointer;
  1173. margin:0 20px 20px 0;
  1174. i{
  1175. margin-right:10px;
  1176. }
  1177. }
  1178. .add-for-p-two{
  1179. font-size:14px;
  1180. border: 1px solid #E0E0E0;
  1181. display: inline-block;
  1182. overflow: hidden;
  1183. width:280px;
  1184. height:158px;
  1185. line-height:158px;
  1186. text-align: center;
  1187. border-radius: 6px;
  1188. color:#999999;
  1189. cursor: pointer;
  1190. margin:0 20px 20px 0;
  1191. i{
  1192. margin-right:10px;
  1193. }
  1194. }
  1195. }
  1196. }
  1197. </style>