DESKTOP-6NE3CFS\GAGABYTE 4 anos atrás
pai
commit
9849402a7c

+ 1 - 1
.env.production

@@ -2,5 +2,5 @@
 ENV = 'production'
 ENV = 'production'
 
 
 # base api
 # base api
-VUE_APP_BASE_API = '/'
+# VUE_APP_BASE_API = '/'
 
 

BIN
dist.zip


+ 8 - 0
src/api/accessrecords.js

@@ -16,3 +16,11 @@ export function searchList(query) {
   })
   })
 }
 }
 
 
+export function fetchGroupList(query) {
+  return request({
+    url: '/ncjtEntranceGuard/getDevicePageList',
+    method: 'get',
+    params: query
+  })
+}
+

+ 1 - 1
src/api/index.js

@@ -10,7 +10,7 @@ export function fetchList(query) {
 
 
 export function searchList(query) {
 export function searchList(query) {
   return request({
   return request({
-    url: '/vue-element-admin/article/list',
+    url: '/ncjtEntranceGuard/getTrafficRecordCountById',
     method: 'get',
     method: 'get',
     params: query
     params: query
   })
   })

Diferenças do arquivo suprimidas por serem muito extensas
+ 1 - 0
src/icons/svg/用户与组绑定.svg


Diferenças do arquivo suprimidas por serem muito extensas
+ 1 - 0
src/icons/svg/用户管理.svg


Diferenças do arquivo suprimidas por serem muito extensas
+ 1 - 0
src/icons/svg/设备与组绑定.svg


Diferenças do arquivo suprimidas por serem muito extensas
+ 1 - 0
src/icons/svg/设备与身份绑定.svg


Diferenças do arquivo suprimidas por serem muito extensas
+ 1 - 0
src/icons/svg/账号管理.svg


Diferenças do arquivo suprimidas por serem muito extensas
+ 1 - 0
src/icons/svg/通行记录.svg


+ 6 - 6
src/router/index.js

@@ -117,7 +117,7 @@ export const constantRoutes = [
         path: 'index',
         path: 'index',
         component: () => import('@/views/userManagement/index'),
         component: () => import('@/views/userManagement/index'),
         name: 'userManagement',
         name: 'userManagement',
-        meta: { title: '用户管理', icon: 'table', noCache: true }
+        meta: { title: '用户管理', icon: '用户管理', noCache: true }
       }
       }
     ]
     ]
   },
   },
@@ -130,7 +130,7 @@ export const constantRoutes = [
         path: 'index',
         path: 'index',
         component: () => import('@/views/devicewithGroup/index'),
         component: () => import('@/views/devicewithGroup/index'),
         name: 'devicewithGroup',
         name: 'devicewithGroup',
-        meta: { title: '设备与组绑定', icon: 'tree', noCache: true }
+        meta: { title: '设备与组绑定', icon: '设备与组绑定', noCache: true }
       }
       }
     ]
     ]
   },
   },
@@ -143,7 +143,7 @@ export const constantRoutes = [
         path: 'index',
         path: 'index',
         component: () => import('@/views/deviceWithStatus/index'),
         component: () => import('@/views/deviceWithStatus/index'),
         name: 'deviceWithStatus',
         name: 'deviceWithStatus',
-        meta: { title: '设备与身份绑定', icon: 'tab', noCache: true }
+        meta: { title: '设备与身份绑定', icon: '设备与身份绑定', noCache: true }
       }
       }
     ]
     ]
   },
   },
@@ -156,7 +156,7 @@ export const constantRoutes = [
         path: 'index',
         path: 'index',
         component: () => import('@/views/userWithGroup/index'),
         component: () => import('@/views/userWithGroup/index'),
         name: 'userWithGroup',
         name: 'userWithGroup',
-        meta: { title: '用户与组绑定', icon: 'table', noCache: true }
+        meta: { title: '用户与组绑定', icon: '用户与组绑定', noCache: true }
       }
       }
     ]
     ]
   },
   },
@@ -169,7 +169,7 @@ export const constantRoutes = [
         path: 'index',
         path: 'index',
         component: () => import('@/views/accessRecords/index'),
         component: () => import('@/views/accessRecords/index'),
         name: 'accessRecords',
         name: 'accessRecords',
-        meta: { title: '通行记录', icon: 'people', noCache: true }
+        meta: { title: '通行记录', icon: '通行记录', noCache: true }
       }
       }
     ]
     ]
   },
   },
@@ -182,7 +182,7 @@ export const constantRoutes = [
         path: 'index',
         path: 'index',
         component: () => import('@/views/user/index'),
         component: () => import('@/views/user/index'),
         name: 'user',
         name: 'user',
-        meta: { title: '账号管理', icon: 'peoples', noCache: true }
+        meta: { title: '账号管理', icon: '账号管理', noCache: true }
       }
       }
     ]
     ]
   },
   },

+ 1 - 1
src/settings.js

@@ -1,5 +1,5 @@
 module.exports = {
 module.exports = {
-  title: 'Vue Element Admin',
+  title: '门禁设备管理平台',
 
 
   /**
   /**
    * @type {boolean} true | false
    * @type {boolean} true | false

+ 1 - 1
src/utils/get-page-title.js

@@ -1,6 +1,6 @@
 import defaultSettings from '@/settings'
 import defaultSettings from '@/settings'
 
 
-const title = defaultSettings.title || 'Vue Element Admin'
+const title = defaultSettings.title || '门禁设备管理平台'
 
 
 export default function getPageTitle(pageTitle) {
 export default function getPageTitle(pageTitle) {
   if (pageTitle) {
   if (pageTitle) {

+ 2 - 1
src/utils/request.js

@@ -10,7 +10,8 @@ import {
 
 
 // create an axios instance
 // create an axios instance
 const service = axios.create({
 const service = axios.create({
-  baseURL: process.env.VUE_APP_BASE_API, // url = base url + request url
+  // baseURL: "https://chtech.ncjti.edu.cn/access-control/", // 打包使用的URL
+  baseURL: process.env.VUE_APP_BASE_API, // 本机开发使用的URL url = base url + request url
   // withCredentials: true, // send cookies when cross-domain requests
   // withCredentials: true, // send cookies when cross-domain requests
   timeout: 5000 // request timeout
   timeout: 5000 // request timeout
 })
 })

+ 85 - 38
src/views/accessRecords/index.vue

@@ -8,14 +8,14 @@
           v-model="listQuery.deviceName"
           v-model="listQuery.deviceName"
           size="mini"
           size="mini"
           clearable
           clearable
-          @clear="getList"
+          @clear="handleChangeFilter"
           placeholder="请选择设备名称"
           placeholder="请选择设备名称"
         >
         >
           <el-option
           <el-option
-            v-for="item in list"
+            v-for="item in groupList"
             :key="item.id"
             :key="item.id"
-            :label="item.deviceName"
-            :value="item.deviceName"
+            :label="item.name"
+            :value="item.name"
           >
           >
           </el-option>
           </el-option>
         </el-select>
         </el-select>
@@ -28,7 +28,7 @@
           size="mini"
           size="mini"
           placeholder="请输入卡号"
           placeholder="请输入卡号"
           clearable
           clearable
-          @clear="getList"
+          @clear="handleChangeFilter"
           @keyup.enter.native="handleFilter"
           @keyup.enter.native="handleFilter"
         >
         >
         </el-input>
         </el-input>
@@ -41,7 +41,7 @@
           size="mini"
           size="mini"
           placeholder="请输入姓名"
           placeholder="请输入姓名"
           clearable
           clearable
-          @clear="getList"
+          @clear="handleChangeFilter"
           @keyup.enter.native="handleFilter"
           @keyup.enter.native="handleFilter"
         >
         >
         </el-input>
         </el-input>
@@ -55,6 +55,7 @@
         start-placeholder="开始时间"
         start-placeholder="开始时间"
         end-placeholder="结束时间"
         end-placeholder="结束时间"
         value-format="timestamp"
         value-format="timestamp"
+        @change="handleChangeFilter($event)"
       >
       >
       </el-date-picker>
       </el-date-picker>
 
 
@@ -130,7 +131,7 @@
             :total="total"
             :total="total"
             :page.sync="listQuery.page"
             :page.sync="listQuery.page"
             :limit.sync="listQuery.limit"
             :limit.sync="listQuery.limit"
-            @pagination="getListTotalPage"
+            @pagination="getList"
           />
           />
         </template>
         </template>
       </div>
       </div>
@@ -140,7 +141,7 @@
 
 
 <script>
 <script>
 import Pagination from "@/components/Pagination";
 import Pagination from "@/components/Pagination";
-import { fetchList, searchList } from "@/api/accessrecords";
+import { fetchList, searchList, fetchGroupList } from "@/api/accessrecords";
 export default {
 export default {
   components: {
   components: {
     Pagination,
     Pagination,
@@ -148,6 +149,7 @@ export default {
   data() {
   data() {
     return {
     return {
       list: [],
       list: [],
+      groupList: [],
       total: 0, //数据的总数//
       total: 0, //数据的总数//
       listQuery: {
       listQuery: {
         page: 1,
         page: 1,
@@ -164,48 +166,93 @@ export default {
   },
   },
   created() {
   created() {
     this.getList();
     this.getList();
+    this.getgroupList();
   },
   },
   methods: {
   methods: {
     getList() {
     getList() {
-      fetchList({
-        page: this.listQuery.page,
-        limit: this.listQuery.limit,
-      }).then((response) => {
-        this.list = response.data;
-        this.total = response.total;
-      });
-    },
-    getListTotalPage() {
-      //获取分页数据
       if (
       if (
+        this.listQuery.cardNumber ||
         this.listQuery.deviceName ||
         this.listQuery.deviceName ||
         this.listQuery.userName ||
         this.listQuery.userName ||
-        this.listQuery.cardNumber ||
         this.listQuery.time
         this.listQuery.time
       ) {
       ) {
-        this.handleFilter();
+        searchList(this.listQuery).then((response) => {
+          this.list = response.data;
+          this.total = response.total;
+        });
       } else {
       } else {
-        this.getList();
+        fetchList({
+          page: this.listQuery.page,
+          limit: this.listQuery.limit,
+        }).then((response) => {
+          this.list = response.data;
+          this.total = response.total;
+        });
       }
       }
     },
     },
+    getgroupList() {
+      fetchGroupList({ page: this.listQuery.page, limit: "999" }).then(
+        (response) => {
+          this.groupList = response.data;
+        }
+      );
+    },
     refreshGetList() {
     refreshGetList() {
       //刷新页面
       //刷新页面
       this.$router.go(0);
       this.$router.go(0);
     },
     },
+    handleChangeFilter(e) {
+      if (e == null) {
+        // 清空时间
+        if (
+          !this.listQuery.userName &&
+          !this.listQuery.cardNumber &&
+          !this.listQuery.deviceName &&
+          !this.listQuery.time
+        ) {
+          this.getList();
+        } else {
+          searchList({
+            page: this.listQuery.page,
+            limit: this.listQuery.limit,
+            cardNumber: this.listQuery.cardNumber,
+            deviceName: this.listQuery.deviceName,
+            time1: this.listQuery.time === null ? null : this.listQuery.time[0],
+            time2: this.listQuery.time === null ? null : this.listQuery.time[1],
+            userName: this.listQuery.userName,
+          }).then((response) => {
+            this.list = response.data;
+            this.total = response.total;
+          });
+        }
+      } else {
+        // 设置时间
+      }
+    },
     handleFilter() {
     handleFilter() {
       //搜索数据
       //搜索数据
-      searchList({
-        page: this.listQuery.page,
-        limit: this.listQuery.limit,
-        cardNumber: this.listQuery.cardNumber,
-        deviceName: this.listQuery.deviceName,
-        time1: this.listQuery.time[0],
-        time2: this.listQuery.time[1],
-        userName: this.listQuery.userName,
-      }).then((response) => {
-        this.list = response.data;
-        this.total = response.total;
-      });
+      if (
+        !this.listQuery.userName &&
+        !this.listQuery.cardNumber &&
+        !this.listQuery.deviceName &&
+        !this.listQuery.time
+      ) {
+        alert("请输入搜索条件");
+      } else {
+        searchList({
+          page: 1,
+          limit: this.listQuery.limit,
+          cardNumber: this.listQuery.cardNumber,
+          deviceName: this.listQuery.deviceName,
+          time1: this.listQuery.time === null ? null : this.listQuery.time[0],
+          time2: this.listQuery.time === null ? null : this.listQuery.time[1],
+          userName: this.listQuery.userName,
+        }).then((response) => {
+          this.list = response.data;
+          this.total = response.total;
+        });
+        this.listQuery.page = 1;
+      }
     },
     },
     timestampToTime(time) {
     timestampToTime(time) {
       //格式化时间
       //格式化时间
@@ -243,30 +290,30 @@ export default {
 <style lang="scss" scoped>
 <style lang="scss" scoped>
 .form-head {
 .form-head {
   margin: 0 40px;
   margin: 0 40px;
-  width: 1504px;
+  width: 1380px;
   line-height: 118px;
   line-height: 118px;
   font-size: 9px;
   font-size: 9px;
 
 
   .input {
   .input {
     display: inline-block;
     display: inline-block;
-    margin-right: 30px;
+    margin-right: 10px;
     width: 210px;
     width: 210px;
   }
   }
 
 
   .input-select {
   .input-select {
     display: inline-block;
     display: inline-block;
-    margin-right: 29px;
+    margin-right: 10px;
     width: 148px;
     width: 148px;
   }
   }
 
 
   .button {
   .button {
-    margin-left: 41px;
+    margin-left: 10px;
   }
   }
 }
 }
 
 
 .form {
 .form {
   margin-left: 40px;
   margin-left: 40px;
-  width: 1480px;
+  width: 1400px;
 
 
   .button-img {
   .button-img {
     img {
     img {

+ 10 - 14
src/views/deviceManagement/index.vue

@@ -62,7 +62,8 @@
               inactive-color="#CCCCCC"
               inactive-color="#CCCCCC"
               :active-value="1"
               :active-value="1"
               :inactive-value="0"
               :inactive-value="0"
-              @change="changeSwitch(scope.row)"
+              disabled
+              @click.native="changeSwitch(scope.row)"
             >
             >
             </el-switch>
             </el-switch>
           </template>
           </template>
@@ -339,11 +340,12 @@ export default {
     },
     },
     changeSwitch(row) {
     changeSwitch(row) {
       this.temp = Object.assign({}, row);
       this.temp = Object.assign({}, row);
-      if (this.temp.status == 1) {
+      if (this.temp.status == 0) {
         if (confirm("确定开启设备吗?")) {
         if (confirm("确定开启设备吗?")) {
           updateDevice({ id: this.temp.id, status: this.temp.status }).then(
           updateDevice({ id: this.temp.id, status: this.temp.status }).then(
             () => {
             () => {
               const index = this.list.findIndex((v) => v.id === this.temp.id);
               const index = this.list.findIndex((v) => v.id === this.temp.id);
+              this.temp.status = 1;
               this.list.splice(index, 1, this.temp);
               this.list.splice(index, 1, this.temp);
             }
             }
           );
           );
@@ -352,13 +354,13 @@ export default {
             type: "success",
             type: "success",
             duration: 1500,
             duration: 1500,
           });
           });
-          this.value = 1;
         }
         }
       } else {
       } else {
         if (confirm("确定关闭设备吗?")) {
         if (confirm("确定关闭设备吗?")) {
           updateDevice({ id: this.temp.id, status: this.temp.status }).then(
           updateDevice({ id: this.temp.id, status: this.temp.status }).then(
             () => {
             () => {
               const index = this.list.findIndex((v) => v.id === this.temp.id);
               const index = this.list.findIndex((v) => v.id === this.temp.id);
+              this.temp.status = 0;
               this.list.splice(index, 1, this.temp);
               this.list.splice(index, 1, this.temp);
             }
             }
           );
           );
@@ -424,16 +426,13 @@ export default {
     margin-left: 40px;
     margin-left: 40px;
     width: 1380px;
     width: 1380px;
 
 
-    .button-img {
-      img {
-        width: 53.5px;
+    .el-switch.is-disabled {
+      opacity: 1;
+      ::v-deep .el-switch__core {
+        cursor: pointer;
       }
       }
     }
     }
 
 
-    .button-info {
-      margin-top: 39px;
-    }
-
     .button {
     .button {
       color: red;
       color: red;
     }
     }
@@ -446,11 +445,8 @@ export default {
     .block {
     .block {
       float: right;
       float: right;
     }
     }
-
-    .foot-button {
-      margin-top: 53px;
-    }
   }
   }
+
   .switch-button-item {
   .switch-button-item {
     margin-left: 120px;
     margin-left: 120px;
     margin-top: 32px;
     margin-top: 32px;

+ 31 - 16
src/views/deviceWithStatus/index.vue

@@ -17,7 +17,7 @@
           v-model="listQuery.serialNumber"
           v-model="listQuery.serialNumber"
           placeholder="请输入序列号"
           placeholder="请输入序列号"
           clearable
           clearable
-          @clear="getList"
+          @clear="handleChangeFilter"
           @keyup.enter.native="handleFilter"
           @keyup.enter.native="handleFilter"
         >
         >
         </el-input>
         </el-input>
@@ -29,7 +29,7 @@
           v-model="listQuery.name"
           v-model="listQuery.name"
           placeholder="请输入设备名称"
           placeholder="请输入设备名称"
           clearable
           clearable
-          @clear="getList"
+          @clear="handleChangeFilter"
           @keyup.enter.native="handleFilter"
           @keyup.enter.native="handleFilter"
         >
         >
         </el-input>
         </el-input>
@@ -227,22 +227,24 @@ export default {
   },
   },
   created() {
   created() {
     this.getList();
     this.getList();
-    // this.getgroupList();
   },
   },
   methods: {
   methods: {
     getList() {
     getList() {
-      fetchList(this.listQuery).then((response) => {
-        this.list = response.data;
-        this.total = response.total;
-      });
+      if (this.listQuery.name || this.listQuery.serialNumber) {
+        searchList(this.listQuery).then((response) => {
+          this.list = response.data;
+          this.total = response.total;
+        });
+      } else {
+        fetchList({
+          page: this.listQuery.page,
+          limit: this.listQuery.limit,
+        }).then((response) => {
+          this.list = response.data;
+          this.total = response.total;
+        });
+      }
     },
     },
-    // getgroupList() {
-    //   fetchGroupList({ page: this.listQuery.page, limit: "999" }).then(
-    //     (response) => {
-    //       this.groupList = response.data;
-    //     }
-    //   );
-    // },
     checkPower(row) {
     checkPower(row) {
       this.temp = Object.assign({}, row);
       this.temp = Object.assign({}, row);
       checkPowers({ deviceId: row.id }).then((response) => {
       checkPowers({ deviceId: row.id }).then((response) => {
@@ -299,14 +301,27 @@ export default {
         });
         });
       }
       }
     },
     },
+    handleChangeFilter() {
+      if (!this.listQuery.name && !this.listQuery.serialNumber) {
+        this.getList();
+      } else {
+        searchList(this.listQuery).then((response) => {
+          this.list = response.data;
+          this.total = response.total;
+        });
+      }
+    },
     handleFilter() {
     handleFilter() {
-      if (!this.listQuery.name) {
+      if (!this.listQuery.name && !this.listQuery.serialNumber) {
         alert("请输入搜索条件");
         alert("请输入搜索条件");
       } else {
       } else {
-        searchList(this.listQuery).then((response) => {
+        let temp = Object.assign({}, this.listQuery);
+        temp.page = 1;
+        searchList(temp).then((response) => {
           this.list = response.data;
           this.list = response.data;
           this.total = response.total;
           this.total = response.total;
         });
         });
+        this.listQuery.page = 1;
       }
       }
     },
     },
   },
   },

+ 30 - 11
src/views/devicewithGroup/index.vue

@@ -17,7 +17,7 @@
           v-model="listQuery.serialNumber"
           v-model="listQuery.serialNumber"
           placeholder="请输入序列号"
           placeholder="请输入序列号"
           clearable
           clearable
-          @clear="getList"
+          @clear="handleChangeFilter"
           @keyup.enter.native="handleFilter"
           @keyup.enter.native="handleFilter"
         >
         >
         </el-input>
         </el-input>
@@ -29,7 +29,7 @@
           v-model="listQuery.name"
           v-model="listQuery.name"
           placeholder="请输入设备名称"
           placeholder="请输入设备名称"
           clearable
           clearable
-          @clear="getList"
+          @clear="handleChangeFilter"
           @keyup.enter.native="handleFilter"
           @keyup.enter.native="handleFilter"
         >
         >
         </el-input>
         </el-input>
@@ -228,13 +228,20 @@ export default {
   },
   },
   methods: {
   methods: {
     getList() {
     getList() {
-      fetchList({
-        page: this.listQuery.page,
-        limit: this.listQuery.limit,
-      }).then((response) => {
-        this.list = response.data;
-        this.total = response.total;
-      });
+      if (this.listQuery.name || this.listQuery.serialNumber) {
+        searchList(this.listQuery).then((response) => {
+          this.list = response.data;
+          this.total = response.total;
+        });
+      } else {
+        fetchList({
+          page: this.listQuery.page,
+          limit: this.listQuery.limit,
+        }).then((response) => {
+          this.list = response.data;
+          this.total = response.total;
+        });
+      }
     },
     },
     getgroupList() {
     getgroupList() {
       fetchGroupList({ page: this.listQuery.page, limit: "999" }).then(
       fetchGroupList({ page: this.listQuery.page, limit: "999" }).then(
@@ -284,7 +291,6 @@ export default {
       this.dialogUnbindGroup = true;
       this.dialogUnbindGroup = true;
     },
     },
     deleteGroup(row, index) {
     deleteGroup(row, index) {
-      console.log(row, index);
       if (confirm("确定解绑吗?")) {
       if (confirm("确定解绑吗?")) {
         deleteGroups({
         deleteGroups({
           id: this.temp.id,
           id: this.temp.id,
@@ -300,14 +306,27 @@ export default {
         });
         });
       }
       }
     },
     },
+    handleChangeFilter() {
+      if (!this.listQuery.name && !this.listQuery.serialNumber) {
+        this.getList();
+      } else {
+        searchList(this.listQuery).then((response) => {
+          this.list = response.data;
+          this.total = response.total;
+        });
+      }
+    },
     handleFilter() {
     handleFilter() {
       if (!this.listQuery.name && !this.listQuery.serialNumber) {
       if (!this.listQuery.name && !this.listQuery.serialNumber) {
         alert("请输入搜索条件");
         alert("请输入搜索条件");
       } else {
       } else {
-        searchList(this.listQuery).then((response) => {
+        let temp = Object.assign({}, this.listQuery);
+        temp.page = 1;
+        searchList(temp).then((response) => {
           this.list = response.data;
           this.list = response.data;
           this.total = response.total;
           this.total = response.total;
         });
         });
+        this.listQuery.page = 1;
       }
       }
     },
     },
   },
   },

+ 21 - 15
src/views/index/index.vue

@@ -10,12 +10,19 @@
     <div class="user">
     <div class="user">
       条件:
       条件:
       <div class="input">
       <div class="input">
-        <el-select v-model="value" size="mini" placeholder="请选择设备">
+        <el-select
+          v-model="listQuery.id"
+          filterable
+          clearable
+          @clear="handleFilter"
+          size="mini"
+          placeholder="请选择设备"
+        >
           <el-option
           <el-option
             v-for="item in list"
             v-for="item in list"
             :key="item.id"
             :key="item.id"
             :label="item.name"
             :label="item.name"
-            :value="item.deviceName"
+            :value="item.id"
           >
           >
           </el-option>
           </el-option>
         </el-select>
         </el-select>
@@ -61,19 +68,13 @@ export default {
   data() {
   data() {
     return {
     return {
       list: [],
       list: [],
+      searchList: [],
       total: 0, //数据的总数//
       total: 0, //数据的总数//
       listQuery: {
       listQuery: {
         page: 1,
         page: 1,
         limit: 999,
         limit: 999,
-        cardNumber: "",
-        deviceName: "",
-        groupName: "",
-        identityName: "",
-        message: "",
-        time: "",
-        userName: "",
+        id: "",
       },
       },
-      value: "",
     };
     };
   },
   },
   created() {
   created() {
@@ -83,14 +84,19 @@ export default {
     getList() {
     getList() {
       fetchList(this.listQuery).then((response) => {
       fetchList(this.listQuery).then((response) => {
         this.list = response.data;
         this.list = response.data;
-        this.total = response.total;
       });
       });
     },
     },
     handleFilter() {
     handleFilter() {
-      searchList({ deviceName: this.listQuery.deviceName }).then((response) => {
-        this.list = response.data;
-        this.total = response.total;
-      });
+      if (!this.listQuery.id) {
+        this.total = 0;
+      } else {
+        searchList({
+          deviceId: this.listQuery.id,
+        }).then((response) => {
+          this.searchList = response.data;
+          this.total = response.total;
+        });
+      }
     },
     },
   },
   },
 };
 };

+ 30 - 10
src/views/userWithGroup/index.vue

@@ -17,7 +17,7 @@
           v-model="listQuery.name"
           v-model="listQuery.name"
           placeholder="请输入姓名"
           placeholder="请输入姓名"
           clearable
           clearable
-          @clear="getUserList"
+          @clear="handleChangeFilter"
           @keyup.enter.native="handleFilter"
           @keyup.enter.native="handleFilter"
         >
         >
         </el-input>
         </el-input>
@@ -29,7 +29,7 @@
           v-model="listQuery.cardNumber"
           v-model="listQuery.cardNumber"
           placeholder="请输入卡号"
           placeholder="请输入卡号"
           clearable
           clearable
-          @clear="getUserList"
+          @clear="handleChangeFilter"
           @keyup.enter.native="handleFilter"
           @keyup.enter.native="handleFilter"
         >
         >
         </el-input>
         </el-input>
@@ -229,13 +229,20 @@ export default {
   },
   },
   methods: {
   methods: {
     getUserList() {
     getUserList() {
-      fetchUserList({
-        page: this.listQuery.page,
-        limit: this.listQuery.limit,
-      }).then((response) => {
-        this.list = response.data;
-        this.total = response.total;
-      });
+      if (this.listQuery.name || this.listQuery.cardNumber) {
+        searchList(this.listQuery).then((response) => {
+          this.list = response.data;
+          this.total = response.total;
+        });
+      } else {
+        fetchUserList({
+          page: this.listQuery.page,
+          limit: this.listQuery.limit,
+        }).then((response) => {
+          this.list = response.data;
+          this.total = response.total;
+        });
+      }
     },
     },
     getgroupList() {
     getgroupList() {
       fetchGroupList({ page: this.listQuery.page, limit: "999" }).then(
       fetchGroupList({ page: this.listQuery.page, limit: "999" }).then(
@@ -299,14 +306,27 @@ export default {
         });
         });
       }
       }
     },
     },
+    handleChangeFilter() {
+      if (!this.listQuery.name && !this.listQuery.cardNumber) {
+        this.getUserList();
+      } else {
+        searchList(this.listQuery).then((response) => {
+          this.list = response.data;
+          this.total = response.total;
+        });
+      }
+    },
     handleFilter() {
     handleFilter() {
       if (!this.listQuery.name && !this.listQuery.cardNumber) {
       if (!this.listQuery.name && !this.listQuery.cardNumber) {
         alert("请输入搜索条件");
         alert("请输入搜索条件");
       } else {
       } else {
-        searchList(this.listQuery).then((response) => {
+        let temp = Object.assign({}, this.listQuery);
+        temp.page = 1;
+        searchList(temp).then((response) => {
           this.list = response.data;
           this.list = response.data;
           this.total = response.total;
           this.total = response.total;
         });
         });
+        this.listQuery.page = 1;
       }
       }
     },
     },
   },
   },

+ 1 - 1
vue.config.js

@@ -6,7 +6,7 @@ function resolve(dir) {
   return path.join(__dirname, dir)
   return path.join(__dirname, dir)
 }
 }
 
 
-const name = defaultSettings.title || 'vue Element Admin' // page title
+const name = defaultSettings.title || '门禁设备管理平台' // page title
 
 
 // If your port is set to 80,
 // If your port is set to 80,
 // use administrator privileges to execute the command line.
 // use administrator privileges to execute the command line.