index.vue 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544
  1. <!--智能门禁-->
  2. <template>
  3. <div class="app-container SmartAccessControl">
  4. <el-form :model="queryParamsData" class="form-box" ref="queryForm" :inline="true">
  5. <el-form-item label="关键字" prop="searchValue">
  6. <el-input
  7. maxLength="30"
  8. v-model="queryParamsData.searchValue"
  9. placeholder="门禁锁编号/实验室"
  10. clearable
  11. size="small"
  12. style="width: 240px"
  13. />
  14. </el-form-item>
  15. <el-form-item label="学院" prop="deptId">
  16. <el-select v-model="queryParamsData.deptId" clearable placeholder="请选择学院">
  17. <el-option
  18. v-for="item in optionsListOne"
  19. :key="item.deptId"
  20. :label="item.deptName"
  21. :value="item.deptId">
  22. </el-option>
  23. </el-select>
  24. </el-form-item>
  25. <el-form-item label="状态" prop="useStatus">
  26. <el-select v-model="queryParamsData.operate" clearable placeholder="请选择状态">
  27. <el-option
  28. v-for="item in optionsListTwo"
  29. :key="item.id"
  30. :label="item.name"
  31. :value="item.id">
  32. </el-option>
  33. </el-select>
  34. </el-form-item>
  35. <el-form-item>
  36. <p class="inquire-button-one" @click="handleQuery" style="margin-right:10px;">查询</p>
  37. <p class="reset-button-one" @click="resetQuery">重置</p>
  38. </el-form-item>
  39. <el-form-item style="float: right;">
  40. <el-col :span="1.5" v-hasPermi="['laboratory:hardware6:add']">
  41. <p class="add-button-one-90"
  42. @click="pageToggle(1)"
  43. ><i class="el-icon-plus"></i>新增</p>
  44. </el-col>
  45. </el-form-item>
  46. </el-form>
  47. <el-table border :data="tableList" ref="multipleTable">
  48. <el-table-column label="门禁锁编号" align="center" prop="hardwareNum"/>
  49. <el-table-column label="学院" align="center" prop="deptName" width="250"/>
  50. <el-table-column label="实验室" align="center" prop="posi" width="250" show-overflow-tooltip/>
  51. <el-table-column label="设备状态" align="center" prop="status" width="100">
  52. <template slot-scope="scope">{{scope.row.operate.name}}</template>
  53. </el-table-column>
  54. <el-table-column label="创建人" align="center" prop="createBy" width="150"/>
  55. <el-table-column label="创建时间" align="center" prop="createTime" width="250"/>
  56. <el-table-column label="操作" align="center" width="140" class-name="small-padding fixed-width" v-if="tableButtonType">
  57. <template slot-scope="scope">
  58. <div class="table-button-box">
  59. <p class="table-button-null"></p>
  60. <p class="table-button-p" v-hasPermi="['laboratory:hardware6:edit']" @click="pageToggle(2,scope.row)">编辑</p>
  61. <p class="table-button-p" v-hasPermi="['laboratory:hardware6:remove']" @click="pageToggle(3,scope.row)">删除</p>
  62. <p class="table-button-null"></p>
  63. </div>
  64. </template>
  65. </el-table-column>
  66. </el-table>
  67. <pagination :page-sizes="[20, 30, 40, 50]"
  68. v-show="total>0"
  69. :total="total"
  70. :page.sync="queryParamsData.pageNum"
  71. :limit.sync="queryParamsData.pageSize"
  72. @pagination="getList"
  73. />
  74. <!--新增/编辑-->
  75. <el-dialog :title="dialogTitle" :visible.sync="addDialogType" v-if="addDialogType" width="520px" append-to-body class="add-dialog-box" :close-on-click-modal="false">
  76. <el-form ref="form" :model="form" :rules="rules" label-width="110px">
  77. <el-form-item label="实验室:" prop="subjectId">
  78. <el-select
  79. style="width:360px;"
  80. v-model="form.subjectId"
  81. filterable
  82. remote
  83. clearable
  84. @focus="selectFocus"
  85. reserve-keyword
  86. @clear="clearClick"
  87. placeholder="搜索选择实验室"
  88. :remote-method="getSelectList"
  89. :loading="loading">
  90. <el-option
  91. v-for="item in selectList"
  92. :key="item.id"
  93. :label="item.name"
  94. :value="item.id">
  95. </el-option>
  96. </el-select>
  97. </el-form-item>
  98. <el-form-item label="门禁编号" prop="hardwareNum">
  99. <el-input
  100. style="width:320px;"
  101. v-model="form.hardwareNum"
  102. placeholder="请输入门禁编号"
  103. maxlength="20"
  104. size="small"
  105. />
  106. </el-form-item>
  107. <el-form-item label="门禁名称" prop="name" >
  108. <el-input
  109. style="width:320px;"
  110. v-model="form.name"
  111. placeholder="请输入门禁名称"
  112. maxlength="8"
  113. size="small"
  114. />
  115. </el-form-item>
  116. <el-form-item label="IP" prop="ipAddress" >
  117. <el-input
  118. style="width:320px;"
  119. v-model="form.ipAddress"
  120. placeholder="请输入IP"
  121. maxlength="15"
  122. size="small"
  123. />
  124. </el-form-item>
  125. <el-form-item label="端口" prop="port" >
  126. <el-input
  127. style="width:320px;"
  128. v-model="form.port"
  129. placeholder="请输入端口"
  130. maxlength="6"
  131. size="small"
  132. />
  133. </el-form-item>
  134. <el-form-item label="设备管理证号" prop="harUser" >
  135. <el-input
  136. style="width:320px;"
  137. v-model="form.harUser"
  138. placeholder="请输入设备管理证号"
  139. maxlength="30"
  140. size="small"
  141. />
  142. </el-form-item>
  143. <el-form-item label="设备管理密码" prop="harPsw" >
  144. <el-input
  145. style="width:320px;"
  146. v-model="form.harPsw"
  147. placeholder="请输入设备管理密码"
  148. maxlength="30"
  149. size="small"
  150. />
  151. </el-form-item>
  152. <el-form-item label="门禁权限" style="margin-bottom: 0">
  153. <el-checkbox-group v-model="form.controlScope">
  154. <el-checkbox label="1" >关联安全准入</el-checkbox>
  155. <el-checkbox label="2">关联白名单</el-checkbox>
  156. </el-checkbox-group>
  157. </el-form-item>
  158. </el-form>
  159. <div slot="footer" class="dialog-footer">
  160. <el-button type="primary" @click="submitForm">确 定</el-button>
  161. <el-button @click="cancel">取 消</el-button>
  162. </div>
  163. </el-dialog>
  164. </div>
  165. </template>
  166. <script>
  167. import { hxpSmartTerminal,filterDept,getSubList,addHxpSmartTerminal,putHxpSmartTerminal,getHxpSmartTerminal,delHxpSmartTerminal } from "@/api/medicUniversity-3_1/index";
  168. import { listHardware, delHardware, addHardware, updateHardware } from "@/api/medicUniversity-3_1/index";
  169. import { listDepartments } from "@/api/system/dept";
  170. import {subjectDictList } from "@/api/laboratory/record";
  171. import { getToken } from "@/utils/auth";
  172. export default {
  173. name: "SmartAccessControl-jinan",
  174. data() {
  175. return {
  176. // table操作按钮校验
  177. tableButtonType:this.hasPermiDom(['laboratory:hardware6:edit','laboratory:hardware6:remove']),
  178. //上传相关配置
  179. uploadImgUrl: window.location.href.split('://')[0]+'://' + this.judgmentNetworkReturnAddress() + "/laboratory/hardware/importData", // 上传地址
  180. headers: {
  181. Authorization: "Bearer " + getToken(),
  182. },
  183. // 遮罩层
  184. loading:false,
  185. //页面状态
  186. pageType:1,
  187. // 搜索数据
  188. queryParamsData:{
  189. pageNum:1,
  190. pageSize:20,
  191. },
  192. //数据数量
  193. total:0,
  194. //数据数组
  195. tableList:[],
  196. //学院列表
  197. optionsListOne:[],
  198. //状态列表
  199. optionsListTwo:[{id:"ONLINE",name:"在线"},{id:"OFFLINE",name:"离线"}],
  200. //编辑新增相关
  201. dialogTitle:"",
  202. addDialogType:false,
  203. form:{},
  204. selectList:[],
  205. selectListData:[],
  206. rules:{
  207. name: [
  208. { required: true, trigger: "blur", message: "请输入门禁名称" },
  209. ],
  210. hardwareNum: [
  211. { required: true, trigger: "blur", message: "最大20个字符,包含大小写字母、数字" },
  212. { required: true, message: "最大20个字符,包含大小写字母、数字", validator: this.spaceJudgment, trigger: "blur" }
  213. ],
  214. subjectId: [
  215. { required: true, trigger: "blur", message: "搜索选择实验室" },
  216. ],
  217. relayCode: [
  218. { required: true, message: "请输入设备编号", trigger: "blur" },
  219. { required: true, message: "请输入设备编号", validator: this.spaceJudgment, trigger: "blur" }
  220. ],
  221. bit: [
  222. { required: true, message: "请输入路由", trigger: "blur" },
  223. { required: true, message: "请输入路由", validator: this.spaceJudgment, trigger: "blur" }
  224. ],
  225. ipAddress: [
  226. { required: true, message: "请输入IP", trigger: "blur" },
  227. { required: true, message: "请输入IP", validator: this.spaceJudgment, trigger: "blur" }
  228. ],
  229. port: [
  230. { required: true, message: "请输入端口", trigger: "blur" },
  231. { required: true, message: "请输入端口", validator: this.spaceJudgment, trigger: "blur" }
  232. ],
  233. harUser: [
  234. { required: true, message: "请输入设备管理证号", trigger: "blur" },
  235. { required: true, message: "请输入设备管理证号", validator: this.spaceJudgment, trigger: "blur" }
  236. ],
  237. harPsw: [
  238. { required: true, message: "请输入设备管理密码", trigger: "blur" },
  239. { required: true, message: "请输入设备管理密码", validator: this.spaceJudgment, trigger: "blur" }
  240. ],
  241. },
  242. };
  243. },
  244. created() {
  245. },
  246. mounted(){
  247. this.filterDept();
  248. this.listDepartments();
  249. this.getList();
  250. },
  251. methods: {
  252. selectFocus(){
  253. if(!this.selectList[0]){
  254. this.filterDept();
  255. }
  256. },
  257. //获取学院列表
  258. listDepartments(){
  259. listDepartments().then(response => {
  260. this.optionsListOne = response.data;
  261. });
  262. },
  263. pageToggle(type,row){
  264. let self = this;
  265. if(type == 1){
  266. //新增
  267. this.dialogTitle = '新增';
  268. this.$set(this,'form',{
  269. subjectId:"",
  270. hardwareNum:"",
  271. name:"",
  272. ipAddress:"",
  273. port:"",
  274. harUser:"",
  275. harPsw:"",
  276. controlScope:[],
  277. });
  278. this.clearClick();
  279. this.addDialogType = true;
  280. }else if(type == 2){
  281. // 编辑
  282. this.dialogTitle = '编辑';
  283. this.$set(this,'form',JSON.parse(JSON.stringify(row)));
  284. if(row.controlScope){
  285. this.form.controlScope=row.controlScope.split(',')
  286. }else{
  287. this.form.controlScope=[]
  288. }
  289. this.clearClick();
  290. this.addDialogType = true;
  291. }else if(type == 3){
  292. // 删除
  293. this.$confirm('确认要删除吗?', "警告", {
  294. confirmButtonText: "确定",
  295. cancelButtonText: "取消",
  296. type: "warning"
  297. }).then(function() {
  298. delHardware(row.id).then(response => {
  299. if (response.code == 200){
  300. self.msgSuccess(response.msg);
  301. self.getList();
  302. }
  303. });
  304. }).then(() => {
  305. }).catch(() => {});
  306. }
  307. },
  308. //查询当前院系
  309. filterDept(){
  310. filterDept().then(response => {
  311. let idText = "";
  312. for(let i=0;i<response.data.length;i++){
  313. if(i==0){
  314. idText = idText + response.data[i].deptId;
  315. }else{
  316. idText = idText +','+ response.data[i].deptId;
  317. }
  318. }
  319. //查询院系下实验室
  320. subjectDictList(idText).then(response => {
  321. //当前列表
  322. this.selectList = JSON.parse(JSON.stringify(response.data));
  323. //原始列表数据
  324. this.selectListData = JSON.parse(JSON.stringify(response.data));
  325. });
  326. });
  327. },
  328. /** 实验室-本地懒加载 */
  329. getSelectList(val) {
  330. let self = this;
  331. let list = [];
  332. for(let i=0;i<self.selectListData.length;i++){
  333. if(self.selectListData[i].name.indexOf(val) != -1){
  334. list.push(self.selectListData[i]);
  335. }
  336. }
  337. this.selectList = JSON.parse(JSON.stringify(list))
  338. },
  339. //实验室选中清除
  340. clearClick(){
  341. this.selectList = JSON.parse(JSON.stringify(this.selectListData))
  342. },
  343. submitForm(){
  344. this.$refs["form"].validate((valid) => {
  345. if (valid) {
  346. if(this.form.id){
  347. //编辑
  348. this.form.type = 11;
  349. this.form.controlScope=this.form.controlScope.join(','),
  350. updateHardware(this.form).then(response => {
  351. if (response.code == 200){
  352. this.addDialogType = false;
  353. this.msgSuccess(response.msg);
  354. this.getList();
  355. }
  356. });
  357. }else{
  358. //新增
  359. let obj = {
  360. type:11,
  361. subjectId:this.form.subjectId,
  362. hardwareNum:this.form.hardwareNum,
  363. name:this.form.name,
  364. ipAddress:this.form.ipAddress,
  365. port:this.form.port,
  366. harUser:this.form.harUser,
  367. harPsw:this.form.harPsw,
  368. controlScope:this.form.controlScope.join(','),
  369. }
  370. addHardware(obj).then(response => {
  371. if (response.code == 200){
  372. this.addDialogType = false;
  373. this.msgSuccess(response.msg);
  374. this.resetQuery();
  375. }else if(response.code == 205){
  376. this.$confirm(response.msg, "警告", {
  377. confirmButtonText: "确定",
  378. cancelButtonText: "取消",
  379. type: "warning"
  380. }).then(() => {
  381. // 确定
  382. this.$router.push({ path: '/comprehensive/laboratoryManagement/accessAuthorization' });
  383. }).catch(function() {
  384. // 取消
  385. });
  386. }
  387. });
  388. }
  389. }
  390. })
  391. },
  392. cancel(){
  393. this.addDialogType = false;
  394. },
  395. //获取数据列表
  396. getList(){
  397. this.queryParamsData.type = 'HK_DOOR';
  398. listHardware(this.queryParamsData).then(response => {
  399. this.total = response.total;
  400. this.tableList = response.rows;
  401. });
  402. },
  403. /** 搜索按钮操作 */
  404. handleQuery() {
  405. this.queryParamsData.pageNum = 1;
  406. this.queryParamsData.pageSize = 20;
  407. this.getList();
  408. },
  409. /** 重置按钮操作 */
  410. resetQuery() {
  411. this.$set(this,'queryParamsData',{});
  412. this.handleQuery();
  413. },
  414. },
  415. }
  416. </script>
  417. <style scoped lang="scss">
  418. .SmartAccessControl{
  419. flex:1;
  420. display: flex;
  421. flex-direction: column;
  422. overflow: hidden!important;
  423. padding:20px !important;
  424. p{
  425. margin:0;
  426. padding:0;
  427. }
  428. .form-box{
  429. .form-dropdown-box{
  430. display: flex;
  431. margin:0;
  432. padding:0 10px;
  433. cursor: pointer;
  434. height:40px;
  435. img:nth-child(1){
  436. width:16px;
  437. height:16px;
  438. margin-top:12px;
  439. }
  440. p{
  441. width:47px;
  442. text-align: center;
  443. font-size:14px;
  444. margin:0;
  445. line-height:40px;
  446. }
  447. img:nth-child(3){
  448. width:10px;
  449. height:6px;
  450. margin-top:17px;
  451. }
  452. }
  453. }
  454. .button-box{
  455. display: flex;
  456. }
  457. }
  458. </style>
  459. <style lang="scss">
  460. .import-dialog-box{
  461. .import-dialog-upLoad-box{
  462. .el-upload{
  463. width:450px;
  464. margin:0 55px;
  465. .el-upload-dragger{
  466. width:450px;
  467. .el-icon-upload{
  468. font-size:100px;
  469. color:#CBE6FE;
  470. }
  471. .el-upload__text{
  472. margin-top:20px;
  473. }
  474. }
  475. }
  476. .el-upload__tip{
  477. margin-left:60px;
  478. font-size:14px;
  479. margin-top:10px;
  480. }
  481. .el-upload-text-box{
  482. background: #F5F5F5;
  483. border-radius: 10px;
  484. margin:15px 30px 0;
  485. padding:0 20px 15px;
  486. overflow: hidden;
  487. *{
  488. margin:0;
  489. }
  490. .img-text-box{
  491. display: flex;
  492. margin-top:15px;
  493. img{
  494. width:16px;
  495. height:16px;
  496. margin-right:13px;
  497. }
  498. p{
  499. height:16px;
  500. line-height:16px;
  501. font-size:12px;
  502. }
  503. }
  504. .text-p{
  505. margin-top:15px;
  506. margin-left:29px;
  507. height:16px;
  508. line-height:16px;
  509. font-size:12px;
  510. }
  511. }
  512. }
  513. .teacher-import-dialog-button-box{
  514. display: flex;
  515. width:190px;
  516. margin:0 auto;
  517. p{
  518. width:70px;
  519. height:30px;
  520. line-height:30px;
  521. font-size:14px;
  522. margin:0 auto;
  523. }
  524. }
  525. .teacher-import-dialog-position-box{
  526. width:100%;
  527. height:100%;
  528. position: absolute;
  529. top:0;
  530. left:0;
  531. z-index: 999;
  532. background: rgba(255,255,255,0.4);
  533. border-radius:20px;
  534. }
  535. }
  536. </style>