deviceList.vue 32 KB

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