소스 검색

Merge remote-tracking branch 'origin/master'

zhangcl 1 개월 전
부모
커밋
c4d72ca7bf

+ 1 - 1
src/locales/zh-CN.ts

@@ -850,7 +850,7 @@ export default {
     createTime:'创建时间',
   },
   info:{
-    deviceClass:'设备分类:',
+    deviceClass:'设备分类',
     classHolder:'请选择设备分类',
     faultySystem:'故障系统',
     faultySystemHolder:'请输入故障系统',

+ 9 - 1
src/views/pms/failure/IotFailureReportForm.vue

@@ -11,9 +11,17 @@
       <el-col :span="12">
       <el-form-item :label="t('faultForm.device')" prop="deviceName">
         <el-select
+          v-if="disabled"
           :disabled="disabled"
           v-model="formData.deviceName"
           :placeholder="t('faultForm.choose')"
+          clearable
+          @clear="handleClear"
+        />
+        <el-select
+          v-if="!disabled"
+          v-model="formData.deviceName"
+          :placeholder="t('faultForm.choose')"
           @click="openForm"
           clearable
           @clear="handleClear"
@@ -114,7 +122,7 @@
       </el-row>
     </el-form>
     <template #footer>
-      <el-button @click="submitForm" type="primary" :disabled="formLoading">{{t('faultForm.ok')}}</el-button>
+      <el-button @click="submitForm" type="primary" v-if="!disabled" :disabled="formLoading">{{t('faultForm.ok')}}</el-button>
       <el-button @click="dialogVisible = false">{{t('faultForm.cancel')}}</el-button>
     </template>
     <DeviceList ref="deviceFormRef" @choose="deviceChoose" />

+ 17 - 10
src/views/pms/information/index.vue

@@ -8,15 +8,16 @@
       :inline="true"
       label-width="68px"
     >
-      <el-form-item :label="t('info.deviceClass')" prop="deviceType" style="margin-left: 25px">
-        <el-select
+      <el-form-item :label="t('deviceForm.category')" prop="deviceType" style="width: 15vw" >
+        <el-tree-select
           v-model="queryParams.deviceType"
-          :placeholder="t('info.classHolder')"
-          clearable
-          class="!w-240px"
-        >
-          <el-option label="请选择字典生成" value="" />
-        </el-select>
+          :data="productClassifyList"
+          :props="defaultProps"
+          check-strictly
+          node-key="id"
+          :placeholder="t('deviceForm.categoryHolder')"
+          filterable
+        />
       </el-form-item>
       <el-form-item :label="t('info.faultySystem')" prop="failureSystem">
         <el-input
@@ -126,6 +127,8 @@ import { dateFormatter } from '@/utils/formatTime'
 import download from '@/utils/download'
 import { IotInformationDbApi, IotInformationDbVO } from '@/api/pms/information'
 import IotInformationDbForm from './IotInformationDbForm.vue'
+import {defaultProps, handleTree} from "@/utils/tree";
+import * as ProductClassifyApi from "@/api/pms/productclassify";
 
 /** 故障知识库 列表 */
 defineOptions({ name: 'IotInformationDb' })
@@ -135,6 +138,7 @@ const { t } = useI18n() // 国际化
 
 const loading = ref(true) // 列表的加载中
 const list = ref<IotInformationDbVO[]>([]) // 列表的数据
+const productClassifyList = ref<Tree[]>([]) // 树形结构
 const total = ref(0) // 列表的总页数
 const queryParams = reactive({
   pageNo: 1,
@@ -211,7 +215,10 @@ const handleExport = async () => {
 }
 
 /** 初始化 **/
-onMounted(() => {
-  getList()
+onMounted(async () => {
+  productClassifyList.value = handleTree(
+    await ProductClassifyApi.IotProductClassifyApi.getSimpleProductClassifyList()
+  )
+  await getList()
 })
 </script>

+ 8 - 5
src/views/pms/inspect/plan/IotInspectPlan.vue

@@ -207,12 +207,15 @@ const formRules = reactive({
 // 拖动状态管理
 const items = ref([])
 const deviceChoose = (rows) => {
-  // formData.value.deviceId = row.id
-  // formData.value.deviceName = row.deviceName
-  // formData.value.deptId = row.deptId
-  // deviceLabel.value = row.deviceName
   debugger
-  list.value = rows
+  rows.forEach((it) => {
+    const ifExist = list.value.find((item) => item.id === it.id)
+    if (!ifExist) {
+      list.value.push(it)
+      console.log(JSON.stringify(it))
+    }
+  })
+  // list.value = rows
 }
 
 const viewRoute = (itemJson) => {

+ 3 - 1
src/views/pms/maintain/IotMaintain.vue

@@ -364,12 +364,14 @@ const addFormRules = reactive({
 
 const handleConfirm = () => {
   addFormData.value.bomNodeId = Math.floor(100000 + Math.random() * 900000)
+
   const index = list.value.findIndex((item) => item.name === addFormData.value.name)
   if (index !== -1) {
     message.warning("维修项重复")
     return
   }
-  list.value.push(addFormData.value)
+  const addItem = {...addFormData.value}
+  list.value.push(addItem)
   addItemVisible.value = false
 }
 const customerChoose = (row) => {

+ 9 - 5
src/views/pms/map/Map.vue

@@ -56,7 +56,7 @@ const initMap = () => {
     if ((window as any).BMap) {
       map.value = new (window as any).BMap.Map(mapContainer.value)
       const point = new (window as any).BMap.Point(104.114129, 37.550339)
-      map.value.centerAndZoom(point, 5.5)
+      map.value.centerAndZoom(point, 5)
 
       map.value.enableScrollWheelZoom(true)
       map.value.setMapType((window as any)[mapType.value])
@@ -85,7 +85,7 @@ const initDeviceMarkers = () => {
 
   const zoomLevel = map.value.getZoom()
   debugger
-  if (zoomLevel > 9) {
+  if (zoomLevel > 12) {
     // 高缩放级别下显示单个设备标记
     devices.value.forEach((device) => {
       const point = new (window as any).BMap.Point(device.lng, device.lat)
@@ -238,10 +238,14 @@ const clusterDevices = (devices: IotDeviceVO[], map: any): Cluster[] => {
 }
 
 const getGridSize = (zoom: number): number => {
-  if (zoom <= 5) return 2
+  if (zoom <= 5) return 3
+  if (zoom <= 7) return 2
   if (zoom <= 8) return 1
-  if (zoom < 10) return 0.03
-  return 0.1
+  if (zoom <= 9) return 0.09
+  if (zoom <= 10) return 0.08
+  if (zoom < 12) return 0.06
+  if (zoom < 15) return 0.02
+  return 0.01
 }
 
 const showDeviceInfoWindow = (device: IotDeviceVO, point: any) => {