Эх сурвалжийг харах

修改物资柜无数据的时候的提示文字以及开关布局代码

pm 2 сар өмнө
parent
commit
bf90a4e9d5

+ 1 - 1
src/router/index.js

@@ -268,7 +268,7 @@ export const dynamicRoutes = [
     path: '/mes/dv/switchmanagement/index',
     component: Layout,
     hidden: true,
-    permissions: ['iscs:switch:list'],
+    permissions: ['iscs:switchmap:list'],
     children: [
       {
         path: 'LookDetail',

+ 9 - 15
src/views/mes/dv/switchmanagement/MapData.vue

@@ -168,24 +168,18 @@ export default {
           }
           console.log('调用getIsIsolationPointPage之前')
           getIsIsolationPointPage(data).then((res) => {
-            console.log(res, '调用getIsIsolationPointPage之后')
-            const data1 = res.data.records // 该柜子或地图所有点
-            const data2 = this.pointList   // 该柜子里 json 拿到的点位(已渲染)
+            const allPoints = res.data.records || [];  // 所有可绑定点
+            const placedPointIds = new Set(this.pointList.map(p => p.entityId)); // 已经有位置的点id
 
-            console.log(data1, '该柜子或地图所有点')
-            console.log(data2, '柜子里json拿到的点位')
+            // 过滤:只留下还没有指定位置的点
+            const unplacedPoints = allPoints.filter(item => !placedPointIds.has(item.pointId));
 
-            // 当前柜子已经存在的点位 id
-            const pointListIds = new Set(this.pointList.map((item) => item.pointId))
-
-            // 过滤掉已经在 pointList 里的点
-            const filterData = data1.filter(item => !pointListIds.has(item.pointId))
-
-            console.log([...pointListIds], '已有点位 ID')
-            console.log(filterData, 'filterData-需要显示在左侧的数据')
+            console.log(allPoints, '所有点');
+            console.log(this.pointList, '已绑定并有位置的点');
+            console.log(unplacedPoints, '未绑定位置的点(需要放左上角0,0)');
 
             // 左侧需要显示的数据
-            this.leftPoints = filterData.map((item) => {
+            this.leftPoints = unplacedPoints.map((item) => {
               return {
                 pointId: item.pointId,
                 entityId: item.pointId,
@@ -210,7 +204,7 @@ export default {
             })
 
             // 调用你已有的渲染逻辑
-            this.addPointsToLeftPointsBox(filterData)
+            this.addPointsToLeftPointsBox(this.leftPoints)
 
             // 保存完整数据
             this.orgLeftPoints = res.data.records.map((item) => {

+ 22 - 19
src/views/mes/dv/switchmanagement/SwitchStatus.vue

@@ -15,23 +15,23 @@
         <!--        >关闭-->
         <!--        </el-button>-->
 
-        <el-button
-          v-no-more-click
-          @click="save"
-          type="primary"
-          icon="el-icon-check"
-          style="align-self: flex-end;margin-top: 10px"
-        >保存
-        </el-button>
-
-        <el-button
-          v-no-more-click
-          @click="reset"
-          type="primary"
-          icon="el-icon-setting"
-          style="align-self: flex-end;margin-top: 10px"
-        >重置
-        </el-button>
+<!--        <el-button-->
+<!--          v-no-more-click-->
+<!--          @click="save"-->
+<!--          type="primary"-->
+<!--          icon="el-icon-check"-->
+<!--          style="align-self: flex-end;margin-top: 10px"-->
+<!--        >保存-->
+<!--        </el-button>-->
+
+<!--        <el-button-->
+<!--          v-no-more-click-->
+<!--          @click="reset"-->
+<!--          type="primary"-->
+<!--          icon="el-icon-setting"-->
+<!--          style="align-self: flex-end;margin-top: 10px"-->
+<!--        >重置-->
+<!--        </el-button>-->
 
       </div>
     </div>
@@ -505,7 +505,6 @@ export default {
       this.movePoints = []
 
       // 点位数据
-      console.log(this.pointList, '点位数据')
       const positions = (this.pointList || []).map(item => ({
         row: item.x,
         col: item.y,
@@ -521,6 +520,9 @@ export default {
         remark: item.remark,
         pointIcon: item.pointIcon,
         pointPicture: item.pointPicture,
+        pointSerialNumber:item.pointSerialNumber,
+        switchStatus: item.switchStatus,
+        switchLastUpdateTime:item.switchLastUpdateTime
       }))
       console.log(positions, 'positions')
 
@@ -562,7 +564,7 @@ export default {
           })
           // 确定灯的颜色
           let lightColor, shadowColor, stroke;
-
+console.log(pos,'点位')
           if (pos.switchStatus == "0") {
             // lightColor = '#ff000d';     // Red
             // shadowColor = '#ffcae8';
@@ -619,6 +621,7 @@ export default {
           group.add(bgrect)
           group.add(rect)
           // group.add(knovaImage)
+          // 添加灯闪
           group.add(light)
           group.add(text)
 

+ 2 - 2
src/views/mes/dv/switchmanagement/index.vue

@@ -10,9 +10,9 @@
       @submit.native.prevent
     >
       <el-row>
-        <el-form-item label="布局名称" prop="lotoName">
+        <el-form-item label="布局名称" prop="switchMapName">
           <el-input
-            v-model="queryParams.lotoName"
+            v-model="queryParams.switchMapName"
             placeholder="请输入布局名称"
             clearable
             @keyup.enter.native="handleQuery"

+ 94 - 78
src/views/mes/material/lockers/index.vue

@@ -4,13 +4,27 @@
       <el-radio-button label="first">物资柜位置</el-radio-button>
       <el-radio-button label="second">物资柜列表</el-radio-button>
     </el-radio-group>
+    <!-- 优化后带样式的无数据提示盒子 -->
     <div
+      v-if="jobconfig.imageUrl==''"
       style="
-        display: flex;
-        justify-content: center;
-        align-items: center;
-        position: relative;
-      "
+    position: absolute;
+    top: 40%;
+    left: 40%;
+    font-size: 18px;
+    color: #666;
+    text-align: center;
+  "
+    >
+      暂无数据,请到基础数据菜单进行配置
+    </div>
+    <div
+      style="
+            display: flex;
+            justify-content: center;
+            align-items: center;
+            position: relative;
+          "
       v-show="tabPosition == 'first'"
     >
 
@@ -18,12 +32,12 @@
       <div
         ref="mapContainer"
         :style="{
-          transform: `scale(${scaleFactor})`,
-          transformOrigin: 'top left',
-          width: '1250px',
-          height: '700px',
-          position: 'relative',
-        }"
+              transform: `scale(${scaleFactor})`,
+              transformOrigin: 'top left',
+              width: '1250px',
+              height: '700px',
+              position: 'relative',
+            }"
       >
 
         <img
@@ -32,28 +46,28 @@
           alt=""
         />
 
-<!--        <img-->
-<!--          v-for="(cabinet, index) in TicketListPage"-->
-<!--          :key="cabinet.cabinetId"-->
-<!--          :style="{-->
-<!--            width: '35px',-->
-<!--            height: '35px',-->
-<!--            position: 'absolute',-->
-<!--            cursor: 'pointer',-->
-<!--            // 图标垂直居中-->
-<!--            top: `${deptXLGCenter.top - 53}px`,-->
-<!--            // 图标水平居中,动态计算偏移-->
-<!--            left: `${-->
-<!--              deptXLGCenter.left - -->
-<!--              (TicketListPage.length * 35 + (TicketListPage.length - 1) * 5) /-->
-<!--                2 +-->
-<!--              index * 40-->
-<!--            }px`,-->
-<!--          }"-->
-<!--          :src="require(`@/assets/images/${imageMap[cabinet.status]}.jpg`)"-->
-<!--          alt=""-->
-<!--          @click="handleCabinetClick(cabinet)"-->
-<!--        />-->
+        <!--        <img-->
+        <!--          v-for="(cabinet, index) in TicketListPage"-->
+        <!--          :key="cabinet.cabinetId"-->
+        <!--          :style="{-->
+        <!--            width: '35px',-->
+        <!--            height: '35px',-->
+        <!--            position: 'absolute',-->
+        <!--            cursor: 'pointer',-->
+        <!--            // 图标垂直居中-->
+        <!--            top: `${deptXLGCenter.top - 53}px`,-->
+        <!--            // 图标水平居中,动态计算偏移-->
+        <!--            left: `${-->
+        <!--              deptXLGCenter.left - -->
+        <!--              (TicketListPage.length * 35 + (TicketListPage.length - 1) * 5) /-->
+        <!--                2 +-->
+        <!--              index * 40-->
+        <!--            }px`,-->
+        <!--          }"-->
+        <!--          :src="require(`@/assets/images/${imageMap[cabinet.status]}.jpg`)"-->
+        <!--          alt=""-->
+        <!--          @click="handleCabinetClick(cabinet)"-->
+        <!--        />-->
 
         <div v-for="(item, index) in jobconfigPoint.records" :key="item.id">
           <div
@@ -68,17 +82,17 @@
             v-for="(cabinet, index) in TicketListPage[item.entityId] || []"
             :key="cabinet.cabinetId"
             :style="{
-    width: '35px',
-    height: '35px',
-    position: 'absolute',
-    cursor: 'pointer',
-    top: (item.y - 40) + 'px',  // 让图标浮在岗位的上方
-    left: (
-      item.x -
-      ((TicketListPage[item.entityId] ? TicketListPage[item.entityId].length * 35 : 0) - 53) / 2 +  // 计算总宽度并居中,减去单个图标宽度,确保居中
-      index * 40  // 处理图标间隔
-    ) + 'px'
-  }"
+        width: '35px',
+        height: '35px',
+        position: 'absolute',
+        cursor: 'pointer',
+        top: (item.y - 40) + 'px',  // 让图标浮在岗位的上方
+        left: (
+          item.x -
+          ((TicketListPage[item.entityId] ? TicketListPage[item.entityId].length * 35 : 0) - 53) / 2 +  // 计算总宽度并居中,减去单个图标宽度,确保居中
+          index * 40  // 处理图标间隔
+        ) + 'px'
+      }"
             :src="imageMap[cabinet.status]"
             alt=""
             @click="handleCabinetClick(cabinet)"
@@ -86,8 +100,9 @@
 
 
         </div>
-<!--        左侧警告部分内容-->
-        <img style="width: 40px;height: 40px;position: absolute;top:2%;right: -4%" :src="this.ExceptionTableImage" alt=""
+        <!--        左侧警告部分内容-->
+        <img style="width: 40px;height: 40px;position: absolute;top:2%;right: -4%" :src="this.ExceptionTableImage"
+             alt=""
              @click="showExTable"
         >
         <div v-if="exceptionTableVisible"
@@ -399,7 +414,8 @@ import { listMaterials } from '@/api/mes/material/information'
 import { MaterialsLoanExceptionPage } from '@/api/mes/material/exception'
 import { selectIsMapById } from '@/api/system/mapconfig'
 import { getIsMapPointPage } from '@/api/system/mappoint'
-import { getIsSystemAttributeByKey} from '@/api/system/configuration'
+import { getIsSystemAttributeByKey } from '@/api/system/configuration'
+
 export default {
   name: 'Team',
   components: {
@@ -510,9 +526,9 @@ export default {
         children: 'children',
         label: 'label'
       },
-      sysAttrValue:null,//从基础数据接口里拿到物资柜底图的mapId
-      ExceptionTableImage:'',//列表异常的图标
-      ExceptionTableImage2:'',//列表异常的图标2
+      sysAttrValue: null,//从基础数据接口里拿到物资柜底图的mapId
+      ExceptionTableImage: '',//列表异常的图标
+      ExceptionTableImage2: ''//列表异常的图标2
     }
   },
 
@@ -555,11 +571,11 @@ export default {
         this.total = response.data.total
         this.loading = false
       })
-      const sysAttrKey1 = 'icon.cabinet.normal';
-      const sysAttrKey2 = 'icon.cabinet.borrowed';
-      const sysAttrKey3 = 'icon.cabinet.abnormal';
-      const sysAttrKey4='sys.exception.icon';
-      const sysAttrKey5='sys.exception2.icon';
+      const sysAttrKey1 = 'icon.cabinet.normal'
+      const sysAttrKey2 = 'icon.cabinet.borrowed'
+      const sysAttrKey3 = 'icon.cabinet.abnormal'
+      const sysAttrKey4 = 'sys.exception.icon'
+      const sysAttrKey5 = 'sys.exception2.icon'
       Promise.all([
         getIsSystemAttributeByKey(sysAttrKey1),
         getIsSystemAttributeByKey(sysAttrKey2),
@@ -567,13 +583,13 @@ export default {
         getIsSystemAttributeByKey(sysAttrKey4),
         getIsSystemAttributeByKey(sysAttrKey5)
       ]).then((responses) => {
-        this.imageMap[0] = responses[0].data.sysAttrValue; // 正常
-        this.imageMap[1] = responses[1].data.sysAttrValue; // 使用中
-        this.imageMap[2] = responses[2].data.sysAttrValue; // 异常
-        this.ExceptionTableImage=responses[3].data.sysAttrValue
-        this.ExceptionTableImage2=responses[4].data.sysAttrValue
-        console.log(this.imageMap,this.ExceptionTableImage,this.ExceptionTableImage2,'imageMap');
-      });
+        this.imageMap[0] = responses[0].data.sysAttrValue // 正常
+        this.imageMap[1] = responses[1].data.sysAttrValue // 使用中
+        this.imageMap[2] = responses[2].data.sysAttrValue // 异常
+        this.ExceptionTableImage = responses[3].data.sysAttrValue
+        this.ExceptionTableImage2 = responses[4].data.sysAttrValue
+        console.log(this.imageMap, this.ExceptionTableImage, this.ExceptionTableImage2, 'imageMap')
+      })
     },
 
     getExpection() {
@@ -692,10 +708,10 @@ export default {
       })
 
       //   获取物资柜地图与物资柜对应状态的柜子图片
-      const sysAttrKey='sys.map.cabinet'
+      const sysAttrKey = 'sys.map.cabinet'
       getIsSystemAttributeByKey(sysAttrKey).then(response => {
-        console.log(response,'获取物资柜底图')
-        this.sysAttrValue=response.data.sysAttrValue
+        console.log(response, '获取物资柜底图')
+        this.sysAttrValue = response.data.sysAttrValue
         // 这里获取全局配置地图参数里的作业票地图
         selectIsMapById(this.sysAttrValue).then((res) => {
           console.log(res, '作业票地图 图片数据')
@@ -703,10 +719,10 @@ export default {
         })
       })
 
-      const dataMap={
+      const dataMap = {
         pages: 1,
         size: -1,
-        mapId:4
+        mapId: 4
       }
       getIsMapPointPage(dataMap).then((res) => {
         console.log(res, '作业票地图岗位位置信息接口')
@@ -715,26 +731,26 @@ export default {
     },
     //辅助函数计算超时时间
     calculateTimeDifference(occurTime) {
-      if (!occurTime) return '未知';
+      if (!occurTime) return '未知'
 
       // 将时间字符串转换为 Date 对象
-      const occurDate = new Date(occurTime);
+      const occurDate = new Date(occurTime)
       if (isNaN(occurDate.getTime())) {
-        console.error('Invalid date format:', occurTime);
-        return '未知';
+        console.error('Invalid date format:', occurTime)
+        return '未知'
       }
 
-      const currentTime = new Date().getTime();
-      const timeDifference = (currentTime - occurDate.getTime()) / (1000 * 60); // 转换为分钟
+      const currentTime = new Date().getTime()
+      const timeDifference = (currentTime - occurDate.getTime()) / (1000 * 60) // 转换为分钟
 
       if (timeDifference < 1) {
-        return `${(timeDifference * 60).toFixed(0)}秒`;
+        return `${(timeDifference * 60).toFixed(0)}秒`
       } else if (timeDifference < 60) {
-        return `${timeDifference.toFixed(1)}分钟`;
+        return `${timeDifference.toFixed(1)}分钟`
       } else {
-        const hours = Math.floor(timeDifference / 60);
-        const minutes = (timeDifference % 60).toFixed(0);
-        return `${hours}小时${minutes}分钟`;
+        const hours = Math.floor(timeDifference / 60)
+        const minutes = (timeDifference % 60).toFixed(0)
+        return `${hours}小时${minutes}分钟`
       }
     },