deviceList.vue 39 KB

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