Ver código fonte

fix:功能优化

Jerry Liang 5 meses atrás
pai
commit
75e2805b3c

+ 17 - 0
service/dto/touTemplateDTO.go

@@ -0,0 +1,17 @@
+package dto
+
+type TouTemplateItemInfo struct {
+	Id                 int     `json:"id"`                   // 模板ID
+	ElectricCompany    string  `json:"electricCompany"`      // 电力公司简称
+	EleCompanyFullName string  `json:"eleCompanyFullName"`   // 电力公司全名
+	DerSchdule         *string `json:"derSchdule,omitempty"` // DER计划
+	GridType           string  `json:"gridType"`             // 电网套餐类型
+	Status             int     `json:"status"`               // 发布状态 0-未发布 2-已发布
+	SourceType         int     `json:"sourceType"`           // 模板类型 0-系统模板 1-API模板 2-用户推荐
+	CountryId          int     `json:"countryId"`            // 国家ID
+	CountryName        string  `json:"countryName"`          //国家名
+	ProvinceName       string  `json:"provinceName"`         // 州名
+	ProvinceId         int     `json:"provinceId"`           // 州ID
+	UpdateTime         *string `json:"updateTime,omitempty"` // 更新时间 格式:YYYY-MM-DD HH:mm:SS
+	ElectricityType    int     `json:"electricityType"`
+}

+ 58 - 0
service/repositories/api/fwh_pro/fwh_touTemplate.go

@@ -0,0 +1,58 @@
+package fwh_pro
+
+import (
+	"fmt"
+	"fwh-toolbox-server/domain"
+	"net/url"
+)
+
+type SelectTouTemplateListPayload struct {
+	SourceType      *int    `json:"sourceType,omitempty"` // 模板类型 0-系统模板 1-API模板 2-用户推荐
+	CountryId       *int    `json:"countryId,omitempty"`  // 国家ID
+	ProvinceId      *int    `json:"provinceId,omitempty"` // 州ID
+	Status          *int    `json:"status,omitempty"`     // 发表状态 0-未发布 2-已发布
+	StartUpdateTime *string `json:"startUpdateTime"`      // 开始时间(更新时间) 格式:YYYY-MM-DD HH:mm:SS
+	EndUpdateTime   *string `json:"endUpdateTime"`        // 结束时间(更新时间) 格式:YYYY-MM-DD HH:mm:SS
+	Search          string  `json:"search"`
+	PageSize        uint    `json:"pageSize"`
+	PageNum         uint    `json:"pageNum"`
+	Lang            string  `json:"lang"` // 语言 - ZH_CN
+}
+
+// 查询模板列表
+func QueryTouTemplateInfoList(search string, pageSize uint, pageNum uint) (*domain.FwhResponse[[]interface{}], error) {
+	// 要发送的 JSON
+	payload := SelectTouTemplateListPayload{
+		Search:   search,
+		PageSize: pageSize,
+		PageNum:  pageNum,
+		Lang:     "ZH_CN",
+	}
+
+	// 要发送的表单数据
+	form := url.Values{}
+	form.Set("search", payload.Search)
+	form.Set("pageSize", fmt.Sprintf("%d", payload.PageSize))
+	form.Set("pageNum", fmt.Sprintf("%d", payload.PageNum))
+	form.Set("lang", payload.Lang)
+
+	response, err := FwhHttpPostUnmarshal[[]interface{}](getFullEnergyUrl("/hes-gateway/manage/selectIotTouTemplateList"), form)
+	if err != nil {
+		return nil, err
+	}
+	return response, nil
+}
+
+// 查询模板列表
+func QueryTouTemplateDetailInfo(id uint) (*domain.FwhResponse[interface{}], error) {
+	// 要发送的表单数据
+	form := url.Values{}
+	form.Set("id", fmt.Sprintf("%d", id))
+	form.Set("lang", "ZH_CN")
+
+	response, err := FwhHttpPostUnmarshal[interface{}](getFullEnergyUrl("/hes-gateway/manage/getIotTouTemplateDetailById"), form)
+	if err != nil {
+		return nil, err
+	}
+	return response, nil
+}

+ 4 - 0
service/repositories/repositories.go

@@ -60,6 +60,10 @@ var QuerySystemUpdateLog = fwh_pro.QuerySystemUpdateLog             // 查询系
 var QuerySystemUpdateLogDetail = fwh_pro.QuerySystemUpdateLogDetail // 查询系统升级记录详细信息
 var QueryAHubUpdateLog = fwh_pro.QueryAHubUpdateLog                 // 查询aHub升级记录
 
+// fwh_touTemplate
+var QueryTouTemplateInfoList = fwh_pro.QueryTouTemplateInfoList // 查询模板列表
+var QueryTouTemplateDetailInfo = fwh_pro.QueryTouTemplateDetailInfo
+
 // SmartHub
 var QuerySmartHubBatchSimCardInfo = smartHub.QueryBatchSimCardInfo // 批量查询SIM卡信息
 

+ 34 - 24
service/services/batchDownloadServices.go

@@ -115,52 +115,62 @@ func GetBatchDownloadData(id primitive.ObjectID, writer *bufio.Writer) error {
 		for _, batchData := range dataPathMap {
 			// PowerFlow
 			// map[date]path
-			for _, path := range *batchData.PowerFlow {
-				fmt.Println("InsertZipFile: ", path)
-				if err := InsertZipFile(path); err != nil {
-					continue
+			if batchData.PowerFlow != nil {
+				for _, path := range *batchData.PowerFlow {
+					fmt.Println("InsertZipFile: ", path)
+					if err := InsertZipFile(path); err != nil {
+						continue
+					}
 				}
 			}
 
 			// MqttLogs
 			// map[date]logs
-			for _, logs := range *batchData.MqttLogs {
-				// map[logType]path
-				for _, path := range logs {
-					fmt.Println("InsertZipFile: ", path)
-					if err := InsertZipFile(path); err != nil {
-						continue
+			if batchData.MqttLogs != nil {
+				for _, logs := range *batchData.MqttLogs {
+					// map[logType]path
+					for _, path := range logs {
+						fmt.Println("InsertZipFile: ", path)
+						if err := InsertZipFile(path); err != nil {
+							continue
+						}
 					}
 				}
 			}
 
 			// EventAlarm
 			// map[date]path
-			for _, path := range *batchData.EventAlarm {
-				fmt.Println("InsertZipFile: ", path)
-				if err := InsertZipFile(path); err != nil {
-					continue
+			if batchData.EventAlarm != nil {
+				for _, path := range *batchData.EventAlarm {
+					fmt.Println("InsertZipFile: ", path)
+					if err := InsertZipFile(path); err != nil {
+						continue
+					}
 				}
 			}
 
 			// EmsLogs
 			// map[date]logs
-			for _, logs := range *batchData.EmsLogs {
-				// map[logType]path
-				for _, path := range logs {
-					fmt.Println("InsertZipFile: ", path)
-					if err := InsertZipFile(path); err != nil {
-						continue
+			if batchData.EmsLogs != nil {
+				for _, logs := range *batchData.EmsLogs {
+					// map[logType]path
+					for _, path := range logs {
+						fmt.Println("InsertZipFile: ", path)
+						if err := InsertZipFile(path); err != nil {
+							continue
+						}
 					}
 				}
 			}
 
 			// FaultRecord
 			// map[date]path
-			for _, path := range *batchData.FaultRecord {
-				fmt.Println("InsertZipFile: ", path)
-				if err := InsertZipFile(path); err != nil {
-					continue
+			if batchData.FaultRecord != nil {
+				for _, path := range *batchData.FaultRecord {
+					fmt.Println("InsertZipFile: ", path)
+					if err := InsertZipFile(path); err != nil {
+						continue
+					}
 				}
 			}
 

+ 114 - 1
service/services/siteInfoManageServices.go

@@ -8,6 +8,8 @@ import (
 	"fwh-toolbox-server/repositories"
 	"fwh-toolbox-server/taskQueue"
 	"fwh-toolbox-server/utils/global"
+	"math"
+	"regexp"
 	"strconv"
 	"time"
 
@@ -15,6 +17,8 @@ import (
 	"go.uber.org/zap"
 )
 
+var VERSION_REGEX = regexp.MustCompile(`V(\d+)R(\d+)B(\d+)D(\d+)`)
+
 // 获取更新状态
 func GetSiteInfoUpdateStatus() (*domain.SiteInfoUpdateRecord, error) {
 	return repositories.GetSiteInfoUpdateNewRecord()
@@ -101,13 +105,25 @@ func ExportSiteInfoDataList(filer *domain.SiteInfoFilter) (*excelize.File, error
 	f.SetCellValue("Sheet1", "AA1", "Owner/Maintainer")
 	f.SetCellValue("Sheet1", "AB1", "DataSource")
 	f.SetCellValue("Sheet1", "AC1", "LastUpdated")
+	f.SetCellValue("Sheet1", "AD1", "ConnectType")
+	f.SetCellValue("Sheet1", "AE1", "WifiSignal")
+	f.SetCellValue("Sheet1", "AF1", "4GSignal")
 
 	// 写入数据
 	for i, d := range res.Data {
 		f.SetCellValue("Sheet1", "A"+strconv.Itoa(i+2), d.Sn)
 		f.SetCellValue("Sheet1", "B"+strconv.Itoa(i+2), global.Deref(d.InstallerName, ""))
 		f.SetCellValue("Sheet1", "C"+strconv.Itoa(i+2), d.ActiveTime)
-		f.SetCellValue("Sheet1", "D"+strconv.Itoa(i+2), d.Status)
+		f.SetCellValue("Sheet1", "D"+strconv.Itoa(i+2), func() string {
+			switch d.Status {
+			case 0:
+				return "离线(0)"
+			case 1:
+				return "在线(1)"
+			default:
+				return fmt.Sprintf("未知(%d)", d.Status)
+			}
+		}())
 		f.SetCellValue("Sheet1", "E"+strconv.Itoa(i+2), global.Deref(d.OnLineTime, ""))
 		f.SetCellValue("Sheet1", "F"+strconv.Itoa(i+2), global.Deref(d.OffLineTime, ""))
 		f.SetCellValue("Sheet1", "G"+strconv.Itoa(i+2), d.FhpSn)
@@ -139,6 +155,103 @@ func ExportSiteInfoDataList(filer *domain.SiteInfoFilter) (*excelize.File, error
 		f.SetCellValue("Sheet1", "AA"+strconv.Itoa(i+2), "Jerry Liang/LMT")
 		f.SetCellValue("Sheet1", "AB"+strconv.Itoa(i+2), "Fleetview")
 		f.SetCellValue("Sheet1", "AC"+strconv.Itoa(i+2), record.UpdateTime.Format(time.DateTime))
+		f.SetCellValue("Sheet1", "AD"+strconv.Itoa(i+2), func() string {
+			switch d.ConnType {
+			case 0:
+				return "未连接(0)"
+			case 1:
+				return "eth0(1)"
+			case 2:
+				return "eth1(2)"
+			case 3:
+				return "WIFI(3)"
+			case 4:
+				return "4G(4)"
+			default:
+				return fmt.Sprintf("未知(%d)", d.Status)
+			}
+		}())
+		f.SetCellValue("Sheet1", "AE"+strconv.Itoa(i+2), func() string {
+			s, err := strconv.ParseInt(d.WifiSignal, 10, 64)
+			if err != nil {
+				zap.L().Warn("WifiSignal ParseInt failed", zap.String("WifiSignal", d.WifiSignal), zap.String("err", err.Error()))
+				return fmt.Sprintf("未知信号(%s)", d.WifiSignal)
+			}
+			if s < 0 {
+				return fmt.Sprintf("Disable(%s)", d.WifiSignal)
+			} else if s < 40 {
+				return fmt.Sprintf("很弱/不可用(%s) %ddBm", d.WifiSignal, s/2-100)
+			} else if s < 60 {
+				return fmt.Sprintf("弱(%s) %ddBm", d.WifiSignal, s/2-100)
+			} else if s < 80 {
+				return fmt.Sprintf("中等/一般(%s) %ddBm", d.WifiSignal, s/2-100)
+			} else {
+				return fmt.Sprintf("强/良好(%s) > -50dBm", d.WifiSignal)
+			}
+		}())
+		f.SetCellValue("Sheet1", "AF"+strconv.Itoa(i+2), func() string {
+			if d.Signal == nil {
+				return "Not Signal"
+			}
+			s, err := strconv.ParseInt(*d.Signal, 10, 64)
+			if err != nil {
+				zap.L().Warn("Signal ParseInt failed", zap.String("4GSignal", *d.Signal), zap.String("err", err.Error()))
+				return fmt.Sprintf("未知信号(%s)", *d.Signal)
+			}
+
+			// 判断软件版本
+			isNew := false
+			if d.AppVersion != nil && *d.AppVersion != "" {
+				match := VERSION_REGEX.FindStringSubmatch(*d.AppVersion)
+				if match != nil {
+					v := match[1]
+					r := match[2]
+					b := match[3]
+					d := match[4]
+					_ = d // 当前逻辑未使用
+					if v == "10" {
+						rInt, _ := strconv.Atoi(r)
+						bInt, _ := strconv.Atoi(b)
+
+						if rInt > 5 {
+							isNew = true
+						} else if rInt == 4 && bInt >= 14 {
+							isNew = true
+						}
+					}
+				}
+			}
+
+			if isNew {
+				if s < 0 {
+					return fmt.Sprintf("Disable(%s)", *d.Signal)
+				} else if s <= 12 {
+					return fmt.Sprintf("很差(%s) %ddBm", *d.Signal, int(math.Round(float64(s)/2.5-115)))
+				} else if s <= 37 {
+					return fmt.Sprintf("较差(%s) %ddBm", *d.Signal, int(math.Round(float64(s)/2.5-115)))
+				} else if s <= 62 {
+					return fmt.Sprintf("一般(%s) %ddBm", *d.Signal, int(math.Round(float64(s)/2.5-115)))
+				} else if s <= 87 {
+					return fmt.Sprintf("良好(%s) %ddBm", *d.Signal, int(math.Round(float64(s)/2.5-115)))
+				} else {
+					return fmt.Sprintf("极好(%s) %ddBm", *d.Signal, int(math.Round(float64(s)/2.5-115)))
+				}
+			} else {
+				if s < 0 {
+					return fmt.Sprintf("Disable(%s)", *d.Signal)
+				} else if s <= 1 {
+					return fmt.Sprintf("很差(%s) %ddBm", *d.Signal, s*2-113)
+				} else if s <= 6 {
+					return fmt.Sprintf("较差(%s) %ddBm", *d.Signal, s*2-113)
+				} else if s <= 11 {
+					return fmt.Sprintf("一般(%s) %ddBm", *d.Signal, s*2-113)
+				} else if s <= 16 {
+					return fmt.Sprintf("良好(%s) %ddBm", *d.Signal, s*2-113)
+				} else {
+					return fmt.Sprintf("极好(%s) %ddBm", *d.Signal, s*2-113)
+				}
+			}
+		}())
 	}
 
 	return f, err

+ 28 - 28
src/router/record.ts

@@ -299,17 +299,17 @@ export const routeRecordRaw: MergeMenuMixedOptions[] = [
     },
     component: 'batch-download/index',
   },
-  // {
-  //   path: 'background-task',
-  //   name: 'backgroundTask',
-  //   icon: 'i-ph:selection-background',
-  //   label: '后台任务管理',
-  //   meta: {
-  //     componentName: 'BackgroundTask',
-  //     showTab: true,
-  //   },
-  //   component: 'background-task/index',
-  // },
+  {
+    path: 'background-task',
+    name: 'backgroundTask',
+    icon: 'i-ph:selection-background',
+    label: '后台任务管理',
+    meta: {
+      componentName: 'BackgroundTask',
+      showTab: true,
+    },
+    component: 'background-task/index',
+  },
   {
     path: 'xlog-manage',
     name: 'xlogManage',
@@ -321,23 +321,23 @@ export const routeRecordRaw: MergeMenuMixedOptions[] = [
     },
     component: 'xlog/manage',
   },
-  // {
-  //   path: 'xlog-terminal/:uuid',
-  //   name: 'xlogTerminal',
-  //   icon: 'i-carbon:terminal',
-  //   label: 'XLOG',
-  //   meta: {
-  //     componentName: 'XlogTerminal',
-  //     showTab: true,
-  //     enableMultiTab: true,
-  //     renderTabLabel({ uuid }) {
-  //       // TODO 后续考虑如何显示SN
-  //       return `XLOG${uuid ? '-' + uuid : ''}`
-  //     },
-  //   },
-  //   component: 'xlog/index',
-  //   show: false,
-  // },
+  {
+    path: 'xlog-terminal/:uuid',
+    name: 'xlogTerminal',
+    icon: 'i-carbon:terminal',
+    label: 'XLOG',
+    meta: {
+      componentName: 'XlogTerminal',
+      showTab: true,
+      enableMultiTab: true,
+      renderTabLabel({ uuid }) {
+        // TODO 后续考虑如何显示SN
+        return `XLOG${uuid ? `-${uuid}` : ''}`
+      },
+    },
+    component: 'xlog/index',
+    show: false,
+  },
   {
     path: 'local-utils',
     key: 'local-utils',

+ 118 - 34
src/stores/user.ts

@@ -16,13 +16,69 @@ interface User {
   id?: string
   name?: string
   role?: 'admin' | 'user'
+  permissions: UserPermissions
+}
+
+interface UserPermissions {
+  isAdmin: boolean
+  items: UserPermissionsItems
+}
+
+interface UserPermissionsItems {
+  xlog?: boolean // xlog操作权限
+  autoUpdate?: boolean // 自动升级配置页面操作权限
 }
 
 const DEFAULT_USER: User = {
   avatar: '',
   id: '2000',
   name: 'FWH User',
-  role: 'admin',
+  role: 'user',
+  permissions: {
+    isAdmin: false,
+    items: {},
+  },
+}
+
+// 特权菜单定义
+const adminMenuNames: string[] = [
+  'backgroundTask', // 后台任务管理
+] as const
+
+const xlogMenuNames: string[] = [
+  'xlogManage', // XLOG管理
+  'xlogTerminal', // XLOG终端
+] as const
+
+const autoUpdateMenuNames: string[] = [
+  'autoUpdate', // 自动升级
+  'autoUpdatePackage', // 升级包管理
+  'autoUpdateAPowerVersion', // aPower版本管理
+  'autoUpdateConfig', // 自动升级配置
+  'autoUpdateConfigFile', // 配置文件管理
+] as const
+
+const parsePermissions = (payload: JwtPayload): User => {
+  return {
+    avatar: '',
+    id: payload.id,
+    name: payload.name,
+    role: payload.isAdmin ? 'admin' : 'user',
+    permissions: {
+      isAdmin: payload.isAdmin,
+      items: payload.permissions.reduce<UserPermissionsItems>((acc, cur) => {
+        switch (cur.name) {
+          case 'xlog':
+            acc.xlog = true
+            break
+          case 'autoUpdate':
+            acc.autoUpdate = true
+            break
+        }
+        return acc
+      }, {}),
+    },
+  }
 }
 
 export const useUserStore = defineStore('userStore', () => {
@@ -41,52 +97,79 @@ export const useUserStore = defineStore('userStore', () => {
 
   const routeList = ref<RouteRecordRaw[]>([])
 
+  const getUserInfo = (): User => {
+    return user.value
+  }
+
   const setToken = (value: string | undefined) => {
     token.value = value
     if (value !== undefined) {
       const jwtData = parseJwtToken(value)
       console.log({ jwtData, jwtDataStr: JSON.stringify(jwtData) })
       tokenPayload.value = jwtData
+      user.value = parsePermissions(jwtData)
     } else {
       tokenPayload.value = undefined
+      user.value = DEFAULT_USER
     }
   }
 
   async function resolveMenuList() {
     const res = await new Promise<MergeMenuMixedOptions[]>((resolve) => {
-      // TODO 暂时不限制权限
-      resolve(routeRecordRaw)
-      // if (tokenPayload.value !== undefined) {
-      //   if (tokenPayload.value.isAdmin) {
-      //     resolve(routeRecordRaw)
-      //   } else {
-      //     const allowedRoutes = tokenPayload.value.roles.map((role) => role.domains).flat()
-      //     const filterRoutes = (routeRecord: MergeMenuMixedOptions[]) => {
-      //       return routeRecord
-      //         .map((route): MergeMenuMixedOptions | undefined => {
-      //           const selfAllowed =
-      //             !route.type && route.name && allowedRoutes.includes(route.name as string)
-      //           if (selfAllowed) return route
-
-      //           // 先递归处理 children
-      //           if (!('children' in route) || route.children === undefined) {
-      //             return undefined
-      //           }
-      //           const result = { ...route }
-      //           result.children = filterRoutes(route.children)
-      //           return result
-      //         })
-      //         .filter((item): item is MergeMenuMixedOptions => Boolean(item))
-      //     }
-      //     // const filteredRoutes = routeRecordRaw.filter((route) => {
-      //     //   return !route.type && route.name && allowedRoutes.includes(route.name as string)
-      //     // })
-      //     resolve(filterRoutes(routeRecordRaw))
-      //   }
-      // } else {
-      //   cleanup()
-      //   resolve([])
-      // }
+      if (tokenPayload.value !== undefined) {
+        if (user.value.permissions.isAdmin) {
+          resolve(routeRecordRaw)
+        } else {
+          // const allowedRoutes = tokenPayload.value.roles.map((role) => role.domains).flat()
+          // const filterRoutes = (routeRecord: MergeMenuMixedOptions[]) => {
+          //   return routeRecord
+          //     .map((route): MergeMenuMixedOptions | undefined => {
+          //       const selfAllowed =
+          //         !route.type && route.name && allowedRoutes.includes(route.name as string)
+          //       if (selfAllowed) return route
+
+          //       // 先递归处理 children
+          //       if (!('children' in route) || route.children === undefined) {
+          //         return undefined
+          //       }
+          //       const result = { ...route }
+          //       result.children = filterRoutes(route.children)
+          //       return result
+          //     })
+          //     .filter((item): item is MergeMenuMixedOptions => Boolean(item))
+          // }
+          // resolve(filterRoutes(routeRecordRaw))
+          const permissionsItems = user.value.permissions.items
+          resolve(
+            routeRecordRaw.filter((route) => {
+              if (route.type === undefined && typeof route.name === 'string') {
+                // 清除admin权限页面
+                if (adminMenuNames.includes(route.name)) {
+                  return false
+                }
+
+                // xlog界面控制
+                if (permissionsItems.xlog !== true) {
+                  if (xlogMenuNames.includes(route.name)) {
+                    return false
+                  }
+                }
+
+                // autoUpdate界面控制
+                if (permissionsItems.autoUpdate !== true) {
+                  if (autoUpdateMenuNames.includes(route.name)) {
+                    return false
+                  }
+                }
+              }
+              return true
+            }),
+          )
+        }
+      } else {
+        cleanup()
+        resolve([])
+      }
 
       // if (token.value?.includes('admin')) {
       //   resolve(routeRecordRaw)
@@ -129,6 +212,7 @@ export const useUserStore = defineStore('userStore', () => {
     menuList,
     routeList,
     resolveMenuList,
+    getUserInfo,
     setToken,
     cleanup,
   }

+ 2 - 3
src/views/local-utils/log-357-parser/func/parseData.ts

@@ -89,7 +89,7 @@ export interface TimeRangeSchedulingInfo {
 
 export interface SchedulingInfo {
   id?: number // 策略ID
-  season: string // 季节或分类名称
+  season?: string // 季节或分类名称
   dayType: string // 日期类型 每天、工作日、非工作日等
   timeTab: TimeRangeSchedulingInfo[] // 时间策略表
 }
@@ -240,8 +240,7 @@ export function parse357Log(
     !schedulingListObject.every((v, i) => {
       const id = fieldCheck<'number'>(v, 'id', 'number', errorCallback, true)
 
-      const season = fieldCheck<'string'>(v, 'season', 'string', errorCallback)
-      if (season === undefined) return false
+      const season = fieldCheck<'string'>(v, 'season', 'string', errorCallback, true)
 
       const dayType = fieldCheck<'string'>(v, 'dayType', 'string', errorCallback)
       if (dayType === undefined) return false

+ 13 - 5
src/views/site-info-manage/index.vue

@@ -207,11 +207,13 @@ import SiteInfoFieldsComp from './component/siteInfoFields.vue'
 import SiteInfoView from './component/siteInfoView.vue'
 import * as siteTabCfg from './config'
 import { useSiteInfoManageStateStore } from '@/stores/modules/views/siteInfoManageState'
+import { useUserStore } from '@/stores/user'
 
 const dialog = useDialog()
 const message = useMessage()
 
 const siteInfoManageStateStore = useSiteInfoManageStateStore()
+const userStore = useUserStore()
 
 const mainCardRef = useTemplateRef<InstanceType<typeof NCard>>('mainCardRef')
 const dataTableRef = useTemplateRef<InstanceType<typeof NDataTable>>('dataTableRef')
@@ -417,7 +419,7 @@ function createColumns(): DataTableColumns<SiteInfo> {
             type: 'info',
             strong: true,
             size: 'small',
-            disabled: true, // TODO 这个按钮需要做权限管控
+            disabled: userStore.getUserInfo().permissions.items.xlog,
             onClick: () => {
               dialog.warning({
                 title: '确认使能xLog',
@@ -426,8 +428,7 @@ function createColumns(): DataTableColumns<SiteInfo> {
                 negativeText: '取消',
                 maskClosable: false,
                 onPositiveClick: async () => {
-                  // const res = await operateSiteEnableXlog(row.sn)
-                  const res = await operateSiteEnableXlog('10060006A02X24330167') // TEST
+                  const res = await operateSiteEnableXlog(row.sn)
                   message.info(`使能xlog结果: ${res}`)
                 },
                 onNegativeClick: () => {
@@ -511,8 +512,15 @@ const clickExportSiteInfo = () => {
     maskClosable: false,
     onPositiveClick: () => {
       console.log('开始导出')
-      // TODO 提取过滤条件
-      exportSiteInfoManageList({})
+      exportSiteInfoManageList({
+        filter: (() => {
+          const currFilter = siteInfoManageStateStore.queryFilterComputed
+          if (currFilter.subFilter.length === 0) {
+            return undefined
+          }
+          return currFilter
+        })(),
+      })
     },
     onNegativeClick: () => {
       console.log('取消导出')

+ 1 - 1
src/views/site-info-manage/infoRender/netRender.ts

@@ -68,7 +68,7 @@ export const render4gSignal = (data: SiteInfo): VNode => {
   // 未使能
   let signalIcon = 'i-boxicons:signal-slash text-red-500'
   let tagType: 'error' | 'warning' | 'success' | 'default' | 'primary' | 'info' = 'error'
-  let signalString = `Disable(${data.signal}`
+  let signalString = `Disable(${data.signal})`
 
   if (signal >= 0) {
     if (isNew) {