From 030dc5a8d1eaa0f25520034bdb00c41e7ac08852 Mon Sep 17 00:00:00 2001
From: husq <931347610@qq.com>
Date: Wed, 13 Sep 2023 15:50:09 +0800
Subject: [PATCH] 冲突修改

---
 src/api/http/request.ts                 |   13 +++-
 src/pages/page-web/projects/wayline.vue |   28 +++++---
 src/api/manage.ts                       |   25 ++++++++
 src/api/http/type.ts                    |    9 ++-
 src/pages/page-web/projects/members.vue |   32 ++++++----
 src/pages/page-web/projects/devices.vue |   63 ++++++++++-----------
 6 files changed, 106 insertions(+), 64 deletions(-)

diff --git a/src/api/http/request.ts b/src/api/http/request.ts
index 5505fd6..04dde7e 100644
--- a/src/api/http/request.ts
+++ b/src/api/http/request.ts
@@ -33,10 +33,17 @@
 
 instance.interceptors.response.use(
   response => {
+
+
     // console.info('URL: ' + response.config.baseURL + response.config.url, '\nData: ', response.data, '\nResponse:', response)
-    if (response.data.code && !response.data.success) {
-      message.error(response.data.message)
-    }
+
+      //处理消息返回
+      // if (response.data.code && !response.data.success) {
+    //   message.error(response.data.message)
+    // }
+      if (response.data.code != 5000) {
+          message.error(response.data.message)
+      }
     return response
   },
   err => {
diff --git a/src/api/http/type.ts b/src/api/http/type.ts
index 78de4ca..c28eb94 100644
--- a/src/api/http/type.ts
+++ b/src/api/http/type.ts
@@ -4,9 +4,12 @@
 }
 
 export interface IPage {
- page: number;
- total: number;
- page_size: number;
+ page?: number;
+ total?: number;
+ page_size?: number;
+
+ current?:number;
+ size?:number;
 }
 
 export interface IListWorkspaceResponse<T> {
diff --git a/src/api/manage.ts b/src/api/manage.ts
index 34afc15..27886d9 100644
--- a/src/api/manage.ts
+++ b/src/api/manage.ts
@@ -2,7 +2,7 @@
 import request, { CommonListResponse, IListWorkspaceResponse, IPage, IWorkspaceResponse } from '/@/api/http/request'
 import { Device } from '/@/types/device'
 
-const HTTP_PREFIX = 'system/auth'
+const HTTP_PREFIX = 'api/system'
 
 // login
 export interface LoginBody {
@@ -100,6 +100,17 @@
   return result.data
 }
 
+export const getUserPage = async function (params: any, body: IPage): Promise<CommonListResponse<any>> {
+
+  console.log(params,"++++++++++++++")
+
+  const url = `${HTTP_PREFIX}/user/page`
+  const result = await request.get(url,{params:{...params,pageNum:body.current,pageSize:body.size}})
+  return result.data
+}
+
+
+
 export const updateUserInfo = async function (wid: string, user_id: string, body: {}): Promise<IWorkspaceResponse<any>> {
   const url = `${HTTP_PREFIX}/users/${wid}/users/${user_id}`
   const result = await request.put(url, body)
@@ -137,6 +148,18 @@
   return result.data
 }
 
+/**
+ * 获取设备信息
+ * @param params
+ */
+export const getDeviceList = async function (params:any): Promise<IListWorkspaceResponse<Device>> {
+  const url = `${HTTP_PREFIX}/manage/device/getPage`
+  const result = await request.get(url,{params})
+  return result.data
+}
+
+
+
 export const updateDevice = async function (body: {}, workspace_id: string, device_sn: string): Promise<IWorkspaceResponse<any>> {
   const url = `${HTTP_PREFIX}/devices/${workspace_id}/devices/${device_sn}`
   const result = await request.put(url, body)
diff --git a/src/pages/page-web/projects/devices.vue b/src/pages/page-web/projects/devices.vue
index b81ad9a..5a2f055 100644
--- a/src/pages/page-web/projects/devices.vue
+++ b/src/pages/page-web/projects/devices.vue
@@ -8,6 +8,7 @@
       机场
     </a-menu-item>
   </a-menu>
+
   <div class="device-table-wrap table flex-display flex-column">
     <a-table :columns="columns" :data-source="data.device" :pagination="paginationProp" @change="refreshData" row-key="device_sn" :expandedRowKeys="expandRows"
     :row-selection="rowSelection" :rowClassName="rowClassName" :scroll="{ x: '100%', y: 600 }"
@@ -26,6 +27,7 @@
           </template>
         </div>
       </template>
+
       <template v-for="col in ['sn', 'workspace']" #[col]="{ text }" :key="col">
         <a-tooltip :title="text">
             <span>{{ text }}</span>
@@ -113,12 +115,13 @@
       :device="currentDevice">
     </DeviceHmsDrawer>
   </div>
+
 </template>
 <script lang="ts" setup>
 import { ColumnProps, TableState } from 'ant-design-vue/lib/table/interface'
 import { h, onMounted, reactive, ref, UnwrapRef } from 'vue'
 import { IPage } from '/@/api/http/type'
-import { BindBody, bindDevice, getBindingDevices, unbindDevice, updateDevice } from '/@/api/manage'
+import { BindBody, bindDevice, getBindingDevices, getDeviceList, unbindDevice, updateDevice } from '/@/api/manage'
 import { EDeviceTypeName, ELocalStorageKey } from '/@/types'
 import { EditOutlined, CheckOutlined, CloseOutlined, DeleteOutlined, FileSearchOutlined, CloudServerOutlined } from '@ant-design/icons-vue'
 import { Device, DeviceFirmwareStatusEnum } from '/@/types/device'
@@ -139,8 +142,8 @@
 const deleteTip = ref<boolean>(false)
 const deleteSn = ref<string>()
 const columns: ColumnProps[] = [
-  { title: '设备型号', dataIndex: 'device_name', width: 100, className: 'titleStyle' },
-  { title: '设备SN', dataIndex: 'device_sn', width: 100, className: 'titleStyle', ellipsis: true, slots: { customRender: 'sn' } },
+  { title: '设备型号', dataIndex: 'deviceName', width: 100, className: 'titleStyle' },
+  { title: '设备SN', dataIndex: 'deviceSn', width: 100, className: 'titleStyle', ellipsis: true, slots: { customRender: 'sn' } },
   {
     title: '设备组织名称',
     dataIndex: 'nickname',
@@ -150,11 +153,11 @@
     ellipsis: true,
     slots: { customRender: 'nickname' }
   },
-  { title: '固件版本', dataIndex: 'firmware_version', width: 150, className: 'titleStyle', slots: { customRender: 'firmware_version' } },
+  { title: '固件版本', dataIndex: 'firmwareVersion', width: 150, className: 'titleStyle', slots: { customRender: 'firmware_version' } },
   { title: '在线状态', dataIndex: 'status', width: 100, className: 'titleStyle', slots: { customRender: 'status' } },
   {
     title: '所属项目',
-    dataIndex: 'workspace_name',
+    dataIndex: 'workspaceName',
     width: 100,
     className: 'titleStyle',
     ellipsis: true,
@@ -172,8 +175,8 @@
       return obj
     }
   },
-  { title: '加入组织时间', dataIndex: 'bound_time', width: 150, sorter: (a: Device, b: Device) => a.bound_time.localeCompare(b.bound_time), className: 'titleStyle' },
-  { title: '在线时间', dataIndex: 'login_time', width: 150, sorter: (a: Device, b: Device) => a.login_time.localeCompare(b.login_time), className: 'titleStyle' },
+  { title: '加入组织时间', dataIndex: 'boundTime', width: 150, sorter: (a: Device, b: Device) => a.bound_time.localeCompare(b.bound_time), className: 'titleStyle' },
+  { title: '在线时间', dataIndex: 'loginTime', width: 150, sorter: (a: Device, b: Device) => a.login_time.localeCompare(b.login_time), className: 'titleStyle' },
   {
     title: '操作',
     dataIndex: 'actions',
@@ -221,8 +224,8 @@
 // 获取分页信息
 function getPaginationBody () {
   return {
-    page: paginationProp.current,
-    page_size: paginationProp.pageSize
+    current: paginationProp.current,
+    size: paginationProp.pageSize
   } as IPage
 }
 
@@ -297,30 +300,24 @@
 useDeviceUpgradeEvent(onDeviceUpgradeWs)
 
 // 获取设备列表信息
-function getDevices (domain: number, closeLoading?: boolean) {
-  if (!closeLoading) {
-    loading.value = true
-  }
-  // getBindingDevices(workspaceId, getPaginationBody(), domain).then(res => {
-  //   if (res.code !== 0) {
-  //     return
-  //   }
-  //   const resData: Device[] = res.data.list
-  //   expandRows.value = []
-  //   resData.forEach((val: any) => {
-  //     if (val.children) {
-  //       val.children = [val.children]
-  //     }
-  //     if (judgeCurrentType(EDeviceTypeName.Dock)) {
-  //       expandRows.value.push(val.device_sn)
-  //     }
-  //   })
-  //   data.device = resData
-  //   paginationProp.total = res.data.pagination.total
-  //   paginationProp.current = res.data.pagination.page
-  //   paginationProp.pageSize = res.data.pagination.page_size
-  //   loading.value = false
-  // })
+function getDevices (params:any) {
+  loading.value = true
+  const paginationBody = getPaginationBody()
+
+  getDeviceList(Object.assign(params, paginationBody)).then(res => {
+    if (res.code !== 5000) {
+      return
+    }
+
+    console.log(res, '++++++++++')
+    const list = res.data.records
+    data.device = list
+
+    loading.value = false
+  }).catch(err => {
+    console.log('错误:', err)
+    loading.value = false
+  })
 }
 
 function refreshData (page: Pagination) {
diff --git a/src/pages/page-web/projects/members.vue b/src/pages/page-web/projects/members.vue
index c63ccef..18da6e7 100644
--- a/src/pages/page-web/projects/members.vue
+++ b/src/pages/page-web/projects/members.vue
@@ -43,9 +43,10 @@
 import { TableState } from 'ant-design-vue/lib/table/interface'
 import { onMounted, reactive, Ref, ref, UnwrapRef } from 'vue'
 import { IPage } from '/@/api/http/type'
-import { getAllUsersInfo, updateUserInfo } from '/@/api/manage'
+import { getAllUsersInfo, getUserPage, updateUserInfo } from '/@/api/manage'
 import { ELocalStorageKey } from '/@/types'
 import { EditOutlined, DeleteOutlined, CheckOutlined, CloseOutlined } from '@ant-design/icons-vue'
+import { useMyStore } from '/@/store'
 
 export interface Member {
     user_id: string
@@ -62,11 +63,11 @@
 }
 const columns = [
   { title: '账号', dataIndex: 'username', width: 150, sorter: (a: Member, b: Member) => a.username.localeCompare(b.username), className: 'titleStyle' },
-  { title: '人员组织名称', dataIndex: 'organization_name', sorter: (a: Member, b: Member) => a.organization_name.localeCompare(b.organization_name), width: 150, className: 'titleStyle' },
-  { title: '用户角色', dataIndex: 'user_role', width: 150, className: 'titleStyle', slots: { customRender: 'user_role' } },
-  { title: '所属项目', dataIndex: 'project', width: 150, className: 'titleStyle' },
+  { title: '人员组织名称', dataIndex: 'deptName', sorter: (a: Member, b: Member) => a.organization_name.localeCompare(b.organization_name), width: 150, className: 'titleStyle' },
+  { title: '用户角色', dataIndex: 'roleName', width: 150, className: 'titleStyle', slots: { customRender: 'user_role' } },
+  { title: '所属项目', dataIndex: 'projectName', width: 150, className: 'titleStyle' },
   { title: '加入方式', dataIndex: 'join_way', width: 150, className: 'titleStyle', slots: { customRender: 'join_way' } },
-  { title: '加入时间', dataIndex: 'create_time', width: 150, sorter: (a: Member, b: Member) => a.create_time.localeCompare(b.create_time), className: 'titleStyle' },
+  { title: '加入时间', dataIndex: 'createTime', width: 150, sorter: (a: Member, b: Member) => a.create_time.localeCompare(b.create_time), className: 'titleStyle' },
   { title: '操作', dataIndex: 'action', width: 70, className: 'titleStyle', slots: { customRender: 'action' } },
 ]
 
@@ -104,23 +105,28 @@
   page_size: 50
 }
 const workspaceId: string = localStorage.getItem(ELocalStorageKey.WorkspaceId)!
+const store = useMyStore()
+const projectId:string = store.state.common.projectId
 
 onMounted(() => {
-  // getAllUsers(workspaceId, body)
+  getAllUsers({ projectId }, body)
 })
 
 function refreshData (page: Pagination) {
   body.page = page?.current!
   body.page_size = page?.pageSize!
-  getAllUsers(workspaceId, body)
+  getAllUsers({ projectId }, body)
 }
 
-function getAllUsers (workspaceId: string, page: IPage) {
-  getAllUsersInfo(workspaceId, page).then(res => {
-    const userList: Member[] = res.data.list
-    data.member = userList
-    paginationProp.total = res.data.pagination.total
-    paginationProp.current = res.data.pagination.page
+function getAllUsers (params:any, page: IPage) {
+  getUserPage(params, page).then(res => {
+    const resData = res.data
+    data.member = resData.list
+
+    paginationProp.total = resData.total
+    paginationProp.current = resData.pageNum
+  }).catch(err => {
+    console.log(err)
   })
 }
 
diff --git a/src/pages/page-web/projects/wayline.vue b/src/pages/page-web/projects/wayline.vue
index 393b265..7c61ad1 100644
--- a/src/pages/page-web/projects/wayline.vue
+++ b/src/pages/page-web/projects/wayline.vue
@@ -126,17 +126,17 @@
 onMounted(() => {
   const parent = document.getElementsByClassName('scrollbar').item(0)?.parentNode as HTMLDivElement
   height.value = document.body.clientHeight - parent.firstElementChild!.clientHeight
-  // getWaylines()
+  getWaylines()
 
-  // const key = setInterval(() => {
-  //   const data = document.getElementById('data')?.lastElementChild as HTMLDivElement
-  //   if (pagination.total === 0 || Math.ceil(pagination.total / pagination.page_size) <= pagination.page || height.value <= data?.clientHeight + data?.offsetTop) {
-  //     clearInterval(key)
-  //     return
-  //   }
-  //   pagination.page++
-  //   getWaylines()
-  // }, 1000)
+  const key = setInterval(() => {
+    const data = document.getElementById('data')?.lastElementChild as HTMLDivElement
+    if (pagination.total === 0 || Math.ceil(pagination.total / pagination.page_size) <= pagination.page || height.value <= data?.clientHeight + data?.offsetTop) {
+      clearInterval(key)
+      return
+    }
+    pagination.page++
+    getWaylines()
+  }, 1000)
 })
 
 function getWaylines () {
@@ -196,6 +196,10 @@
   // store.commit('SET_SELECT_WAYLINE_INFO', wayline)
 }
 
+/**
+ * 加载kml文件
+ * @param file
+ */
 function initKmlFile (file:string) {
   const options = {
     camera: global.$viewer.scene.camera,
@@ -235,7 +239,9 @@
       },
     })
 
-    global.$viewer.flyTo(lineEntity)
+    global.$viewer.flyTo(lineEntity, {
+      offset: new Cesium.HeadingPitchRange(0, -90, 1000)
+    })
   })
 }
 

--
Gitblit v1.9.3