傅豪杰 1 year ago
parent
commit
8c3798a1d4

+ 19 - 1
ruoyi-ui/src/api/user.js

@@ -1,3 +1,11 @@
+/*
+ * @Author: 傅豪杰 18516149270@163.com
+ * @Date: 2023-08-02 16:19:30
+ * @LastEditors: 傅豪杰 18516149270@163.com
+ * @LastEditTime: 2024-01-10 10:20:24
+ * @FilePath: /infrared_remote/admin_web/ruoyi-ui/src/api/user.js
+ * @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
+ */
 import request from '@/utils/request'
 
 export class BaseUserApi {
@@ -13,7 +21,7 @@ export class BaseUserApi {
         url: '/platform/v1/userInfo/userAddress',
         method: 'post',
         data: data
-    })
+  })
   }
   // 获取地图数据
   getMapData = (data={})=>{
@@ -23,5 +31,15 @@ export class BaseUserApi {
         data: data
     })
   }
+  
+  // 用户列表页 获取用户列表
+  getUserList = ( data={} )=> {
+    return  request({
+        url: '/platform/v1/userInfo/userList',
+        method: 'post',
+        data: data
+    })
+  }
+
 }
 export const baseUserApi = new BaseUserApi()

+ 3 - 4
ruoyi-ui/src/baseComponents/f-pagination/index.vue

@@ -2,14 +2,13 @@
   <div class="f-pagination-container flex-ju-al-between ml-16">
     <div class="f-pagination-left">
       <!-- <span>共{{ total }}条数据,当前在{{ currentPage }}/{{ Math.ceil(total / pager.pageSize) === 0? 1:Math.ceil(total / pager.pageSize) }}页</span> -->
-      <span>共{{ total }}条数据</span>
     </div>
     <div class="f-pagination-right">
       <el-pagination
         :current-page="pager.pageNo"
         :page-sizes="pageSizes"
         :page-size="pager.pageSize"
-        layout="prev, pager, next, sizes"
+        layout="total,prev, pager, next, sizes"
         :total="total"
         popper-class="define-pagination-select"
         v-bind="$attrs"
@@ -37,7 +36,7 @@ export default {
     // 页面size可选项
     pageSizes: {
       type: Array,
-      default: () => [15, 20, 50, 100, 200]
+      default: () => [10, 20, 50, 100, 200]
     }
   },
   data() {
@@ -46,7 +45,7 @@ export default {
       selectedDom: '',
       pager: {
         pageNo: 1,
-        pageSize: 20
+        pageSize: 10
       }
     };
   },

+ 1 - 1
ruoyi-ui/src/comComponents/tableList/index.vue

@@ -56,7 +56,7 @@
             // 分页器设置
             page: {
                 pageNo: 1,
-                pageSize: 20,
+                pageSize: 10,
             },
             // 分页总数
             total:0,

+ 115 - 0
ruoyi-ui/src/views/baseUser/user/index.vue

@@ -0,0 +1,115 @@
+<template>
+     <div class="app-container">
+      <el-form :model="form" ref="form" size="small" :inline="true" label-position="left" label-width="70px">
+        <el-form-item>
+            <el-input v-model="form.name" placeholder="请输入用户名" clearable />
+        </el-form-item>
+        <el-form-item>
+          <el-button type="primary" @click="handleCurrentGetList">查询</el-button>
+        </el-form-item>
+      </el-form>
+        <tableList
+        ref="table"
+        :column="tableConfig"
+        :checkbox="false"
+        :getList="handleGetList"
+        :showOperation="false"
+        operationWidth="100px"
+        >
+        <!-- <template #default="scope">
+            <f-btn type="text" @click="openMapDialog(scope.row)">查看定位</f-btn>
+        </template> -->
+    </tableList> 
+
+    <f-dialog ref="mapDialog" @opened="mapDialogInitData" :isCancel="false" destroy-on-close title="用户定位" width="80%" @submit.native.prevent>
+      <template #contain>
+        <div id="map" style="width:100%;height:500px"></div>
+      </template>
+    </f-dialog>
+     </div>
+  </template>
+  
+  <script>
+  import { baseUserApi } from '@/api/user'
+  import tableList from "@/comComponents/tableList";
+  import '../userList/china.js'
+  
+  export default {
+    name: 'UserList',
+    components:{tableList},
+    data() {
+      return {
+        form:{name:''},
+           tableConfig: [
+              {'userPhone': '用户手机号'},
+              {'createTime': '注册时间'},
+              // {'positionTime': '定位时间',formatter:row=>row.positionTime || '-'},
+              // {'latitude': '经纬度',formatter:row=>row.latitude?row.longitude+','+row.latitude:'-'}
+           ],
+           rowData:{},
+           map:'',
+           mapData:{}
+      }
+    },
+    methods: {
+      // 查询列表
+      handleCurrentGetList() {
+        this.$refs.table.handleQueryList();
+      },
+      // 获取列表
+      async handleGetList(page) {
+        const res = await baseUserApi.getUserList(
+          {
+            ...page,
+            name:this.form.name
+          }
+        );
+        if(res.code!= 200 ) return {
+          current:1,
+          records:[],
+          total:0
+        }
+        return res.data;
+      },
+      // 打开弹窗
+      openDialog(el) {
+        const { data } = el;
+        this.rowData = data
+        this.$refs.dialog.show()
+  
+      },
+      // 打开百度地图弹窗
+      openMapDialog(row){
+        this.mapData = row
+        this.$refs.mapDialog.show()
+      },
+      // 弹窗初始化
+      async dialogInitData() {
+        this.handleCurrentGetList()
+      },
+      // 地图数据初始化
+      async mapDialogInitData(){
+        const res = await baseUserApi.userAddress({
+          id:this.mapData.id
+        })
+        console.log(res)
+        let mapData = '上海市'
+  
+        var map = new BMapGL.Map("map");
+        map.enableScrollWheelZoom(true); // 开启鼠标滚轮缩放
+        if(res.data) {
+          mapData = new BMapGL.Point(Number(res.data.longitude), Number(res.data.latitude))
+          let marker = new BMapGL.Marker(new BMapGL.Point(Number(res.data.longitude), Number(res.data.latitude)));
+          map.addOverlay(marker)
+        }
+        map.centerAndZoom(mapData, 12); // 初始化地图,设置中心点坐标和地图级别
+      }
+  
+    },
+    mounted() {
+        this.handleCurrentGetList()
+    },
+  }
+  </script>
+  
+  

+ 0 - 16
ruoyi-ui/src/views/baseUser/userList/index.vue

@@ -1,19 +1,3 @@
-<!--
- * @Author: 傅豪杰 18516149270@163.com
- * @Date: 2023-08-02 16:12:43
- * @LastEditors: 傅豪杰 18516149270@163.com
- * @LastEditTime: 2023-08-23 14:34:35
- * @FilePath: /infrared_remote/admin_web/ruoyi-ui/src/views/baseUser/userList/index.vue
- * @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
--->
-<!--
- * @Author: 傅豪杰 18516149270@163.com
- * @Date: 2023-08-02 16:12:43
- * @LastEditors: 傅豪杰 18516149270@163.com
- * @LastEditTime: 2023-08-17 14:29:40
- * @FilePath: /infrared_remote/admin_web/ruoyi-ui/src/views/baseUser/userList/index.vue
- * @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
--->
 <template>
   <div class="app-container">
     <div ref="map" style="width:100%;height:800px" />

+ 1 - 1
ruoyi-ui/src/views/code/index.vue

@@ -1,6 +1,6 @@
 <template>
   <div class="app-container">
-    <el-form :model="form" ref="form" size="small" :inline="true" label-position="left" label-width="70px">
+    <el-form @submit.native.prevent :model="form" ref="form" size="small" :inline="true" label-position="left" label-width="70px">
       <el-form-item>
           <el-input v-model="form.label" placeholder="请输入" clearable />
       </el-form-item>