index.vue 16 KB

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