deviceListjinan.vue 31 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980
  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.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;"><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="30"
  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="30"
  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="30"
  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="30"
  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:10,
  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. this.msgSuccess(response.msg)
  632. this.addType = false;
  633. this.listBySubjectId();
  634. });
  635. },
  636. //编辑智能门禁
  637. editEntrance(){
  638. let obj = {
  639. id:this.form.id,
  640. hardwareNum:this.form.hardwareNum,
  641. name:this.form.name,
  642. ipAddress:this.form.ipAddress,
  643. port:this.form.port,
  644. harUser:this.form.harUser,
  645. harPsw:this.form.harPsw,
  646. controlScope:this.form.controlScope.join(','),
  647. subjectId:this.subjectData.id
  648. }
  649. putHardware(obj).then(response => {
  650. this.msgSuccess(response.msg)
  651. this.addType = false;
  652. this.listBySubjectId();
  653. });
  654. },
  655. //添加
  656. addData(type){
  657. // this.resetForm("form");
  658. if(type == 1){
  659. this.title = '新增传感器';
  660. this.$set(this,'form',{
  661. type:"",
  662. gatewayId:"",
  663. routeNum:"",
  664. configName:"",
  665. configStatus:"",
  666. });
  667. }else if(type == 2){
  668. this.title = '新增一体机';
  669. this.$set(this,'form',{
  670. name:"",
  671. pcType:"",
  672. hardwareNum:"",
  673. });
  674. }else if(type == 3){
  675. this.title = '新增控制设备';
  676. this.form.hardwareType = 1;
  677. this.disabledType = false;
  678. this.$set(this,'form',{
  679. type:"",
  680. hardwareType:"",
  681. relayCode:"",
  682. bit:"",
  683. configName:"",
  684. configStatus:"",
  685. });
  686. }else if(type == 4){
  687. this.title = '新增摄像头';
  688. this.$set(this,'form',{
  689. hardwareNum:"",
  690. });
  691. }else if(type == 'addEntrance'){
  692. this.title = '新增智能门禁';
  693. this.$set(this,'form',{
  694. hardwareNum:"",
  695. name:"",
  696. ipAddress:"",
  697. port:"",
  698. harUser:"",
  699. harPsw:"",
  700. controlScope:[],
  701. });
  702. }
  703. this.addType = true;
  704. this.upType = type;
  705. },
  706. //编辑
  707. editData(type,row){
  708. if(type == 5){
  709. this.title = '编辑传感器';
  710. this.$set(this,'form',JSON.parse(JSON.stringify(row)));
  711. this.$set(this.form,'type',JSON.parse(JSON.stringify(row.type.enumName)));
  712. }else if(type == 6){
  713. this.title = '编辑一体机';
  714. this.$set(this,'form',JSON.parse(JSON.stringify(row)));
  715. this.$set(this.form,'pcType',JSON.parse(JSON.stringify(row.pcType+'')));
  716. }else if(type == 7){
  717. this.title = '编辑控制设备';
  718. this.disabledType = true;
  719. this.$set(this,'form',JSON.parse(JSON.stringify(row)));
  720. this.$set(this.form,'type',JSON.parse(JSON.stringify(row.type.code+'')));
  721. }else if(type == 8){
  722. this.title = '编辑摄像头';
  723. this.$set(this,'form',JSON.parse(JSON.stringify(row)));
  724. }else if(type == 'editEntrance'){
  725. this.title = '编辑智能门禁';
  726. this.$set(this,'form',JSON.parse(JSON.stringify(row)));
  727. this.form.controlScope=row.controlScope.split(',')
  728. }
  729. this.addType = true;
  730. this.upType = type;
  731. },
  732. //获取列表
  733. listBySubjectId(){
  734. let obj = {
  735. subjectId:this.subjectData.id
  736. };
  737. console.log("obj",obj)
  738. listBySubjectId(obj).then(response => {
  739. this.$set(this,'listCgq',response.data.listCgq);
  740. this.$set(this,'listYtj',response.data.listYtj);
  741. this.$set(this,'listkzsb',response.data.listkzsb);
  742. this.$set(this,'listSpjk',response.data.listSpjk);
  743. this.$set(this,'listHK',response.data.listHK);
  744. });
  745. },
  746. //返回上一页
  747. backPage(){
  748. this.$parent.clickPage(1);
  749. },
  750. //传感器类型
  751. getSensorList(){
  752. getSensorList().then(response => {
  753. this.sensorAddOptions = response.data;
  754. });
  755. },
  756. }
  757. }
  758. </script>
  759. <style scoped lang="scss">
  760. .deviceList{
  761. flex:1;
  762. display: flex;
  763. flex-direction: column;
  764. padding-bottom:20px;
  765. border-radius:10px!important;
  766. margin:5px 20px 20px 10px!important;
  767. box-shadow: 0 0 8px 1px rgba(0, 0, 0, 0.1) !important;
  768. *{
  769. margin:0;
  770. }
  771. .title-box{
  772. display: flex;
  773. margin:0 20px;
  774. .left-title{
  775. flex:1;
  776. height:80px;
  777. line-height:80px;
  778. color:#0045AF;
  779. font-size:18px;
  780. }
  781. .right-button{
  782. margin:20px 0;
  783. }
  784. }
  785. .for-max-box{
  786. margin:0 40px;
  787. font-weight:500;
  788. .for-big-box{
  789. border: 1px solid #E0E0E0;
  790. display: inline-block;
  791. overflow: hidden;
  792. width:280px;
  793. min-height:130px;
  794. padding-bottom:10px;
  795. border-radius: 6px;
  796. margin:0 20px 20px 0;
  797. .for-title-p{
  798. background: rgba(182,214,254,1);
  799. color:#0183FA;
  800. font-size:16px;
  801. line-height:40px;
  802. display:block;
  803. overflow:hidden;
  804. text-overflow:ellipsis;
  805. white-space:nowrap;
  806. padding:0 16px;
  807. margin-bottom:10px;
  808. font-weight:700;
  809. }
  810. .for-text-box{
  811. display: flex;
  812. padding:0 23px;
  813. p{
  814. font-size:14px;
  815. line-height:30px;
  816. flex:1;
  817. }
  818. p:nth-child(1){
  819. color:#333;
  820. text-align: left;
  821. }
  822. p:nth-child(2){
  823. color:#999;
  824. text-align: right;
  825. overflow:hidden;
  826. text-overflow:ellipsis;
  827. white-space:nowrap;
  828. }
  829. }
  830. .for-button-box{
  831. display: flex;
  832. line-height:26px;
  833. margin-top:10px;
  834. p{
  835. text-align: center;
  836. font-size:14px;
  837. color:#666666;
  838. }
  839. p:nth-child(1){
  840. flex:1;
  841. cursor: pointer;
  842. i{
  843. color:#1151b4;
  844. margin-right:10px;
  845. }
  846. }
  847. p:nth-child(2){
  848. width:2px;
  849. height:14px;
  850. margin:6px 0;
  851. background: #CCCCCC;
  852. }
  853. p:nth-child(3){
  854. flex:1;
  855. cursor: pointer;
  856. i{
  857. color:#ff6868;
  858. margin-right:10px;
  859. }
  860. }
  861. }
  862. }
  863. .for-big-box-two{
  864. border: 1px solid #E0E0E0;
  865. display: inline-block;
  866. overflow: hidden;
  867. width:280px;
  868. min-height:158px;
  869. padding-bottom:10px;
  870. border-radius: 6px;
  871. margin:0 20px 20px 0;
  872. .for-title-p{
  873. background: rgba(182,214,254,1);
  874. color:#0183FA;
  875. font-size:16px;
  876. line-height:40px;
  877. display:block;
  878. overflow:hidden;
  879. text-overflow:ellipsis;
  880. white-space:nowrap;
  881. padding:0 16px;
  882. margin-bottom:10px;
  883. font-weight:700;
  884. }
  885. .for-text-box{
  886. display: flex;
  887. padding:0 23px;
  888. p{
  889. font-size:14px;
  890. line-height:30px;
  891. flex:1;
  892. }
  893. p:nth-child(1){
  894. text-align: left;
  895. color:#333;
  896. }
  897. p:nth-child(2){
  898. color:#999;
  899. text-align: right;
  900. overflow:hidden;
  901. text-overflow:ellipsis;
  902. white-space:nowrap;
  903. }
  904. }
  905. .for-button-box{
  906. display: flex;
  907. line-height:26px;
  908. margin-top:10px;
  909. p{
  910. text-align: center;
  911. font-size:14px;
  912. color:#666666;
  913. }
  914. p:nth-child(1){
  915. flex:1;
  916. cursor: pointer;
  917. i{
  918. color:#1151b4;
  919. margin-right:10px;
  920. }
  921. }
  922. p:nth-child(2){
  923. width:2px;
  924. height:14px;
  925. margin:6px 0;
  926. background: #CCCCCC;
  927. }
  928. p:nth-child(3){
  929. flex:1;
  930. cursor: pointer;
  931. i{
  932. color:#ff6868;
  933. margin-right:10px;
  934. }
  935. }
  936. }
  937. }
  938. .add-for-p{
  939. font-size:14px;
  940. border: 1px solid #E0E0E0;
  941. display: inline-block;
  942. overflow: hidden;
  943. width:280px;
  944. height:130px;
  945. line-height:130px;
  946. text-align: center;
  947. border-radius: 6px;
  948. color:#999999;
  949. cursor: pointer;
  950. margin:0 20px 20px 0;
  951. i{
  952. margin-right:10px;
  953. }
  954. }
  955. .add-for-p-two{
  956. font-size:14px;
  957. border: 1px solid #E0E0E0;
  958. display: inline-block;
  959. overflow: hidden;
  960. width:280px;
  961. height:158px;
  962. line-height:158px;
  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. }
  973. }
  974. </style>