Procházet zdrojové kódy

运行记录填报

yuanchao před 3 měsíci
rodič
revize
76b60e72ad

+ 2 - 1
src/api/pms/iotopeationfill/index.ts

@@ -27,8 +27,9 @@ export interface IotOpeationFillVO {
   orderName:string
   orderType:string
   orderStatus:number
-  crateTime:Date
+  createTime:Date
   totalRunTime:number
+  userId:number
 }
 
 // 运行记录填报 API

+ 2 - 2
src/views/pms/iotopeationfill/index.vue

@@ -119,7 +119,7 @@
             <el-button
               link
               type="primary"
-              @click="openWrite(scope.row.deptId+','+scope.row.userId)"
+              @click="openWrite(scope.row.deptId+','+scope.row.userId+','+scope.row.createTime)"
               v-hasPermi="['rq:iot-opeation-fill:update']"
             >
               填写
@@ -127,7 +127,7 @@
             <el-button
               link
               type="primary"
-              @click="openWrite(scope.row.deptId)"
+              @click="openWrite(scope.row.deptId+','+scope.row.userId+','+scope.row.createTime)"
               v-if='scope.row.orderStatus === "已完成"'
             >
               查看

+ 20 - 8
src/views/pms/iotopeationfill/index1.vue

@@ -3,7 +3,7 @@
     <el-tabs v-model="activeTab" type="border-card" tab-position="left" v-loading="loading" style="height: 84vh">
       <el-tab-pane
         style="height: 100%"
-        v-for="(item,index) in arry1"
+        v-for="(item,index) in list"
         :key="index"
       >
         <template #label>
@@ -30,11 +30,12 @@
               </el-form>
             </div>
             <div v-for="(item,index) in attrList" :key="index">
-                <el-form-item :label='item.name' prop="deviceId" v-if="item.name==='累计运行时间'" >
+                <el-form-item :label='item.name' prop="deviceId" v-if="item.name==='当日运转时间'" >
                   <el-input
                     v-model="item.fillContent" @input="attrList[index].fillContent = $event.target.fillContent"
                     clearable
                     style="width: 200px"
+                    disabled
                   />
                 </el-form-item>
               <el-form-item :label='item.name' prop="deviceId" v-else>
@@ -67,6 +68,8 @@ import { IotOpeationFillApi, IotOpeationFillVO } from '@/api/pms/iotopeationfill
 import IotOpeationFillForm from './IotOpeationFillForm.vue'
 import Vue from "@vitejs/plugin-vue";
 import {useUserStore} from "@/store/modules/user";
+
+
 /** 运行记录填报 列表 */
 defineOptions({ name: 'IotOpeationFill' })
 
@@ -116,6 +119,7 @@ const getList = async () => {
   try {
     queryParams.deptId = deptId.split(",")[0];
     queryParams.userId = deptId.split(",")[1];
+    queryParams.createTime = formatTimestamp(JSON.parse(deptId.split(",")[2]));
     const data = await IotOpeationFillApi.getIotOpeationFillPage(queryParams)
     list.value = data;
     list.value.forEach(function (item, index) {
@@ -131,8 +135,13 @@ const getList = async () => {
     loading.value = false
   }
 }
-
-
+function formatTimestamp(timestamp) {
+  const date = new Date(timestamp);
+  const year = date.getFullYear();
+  const month = String(date.getMonth() + 1).padStart(2, '0'); // 月份是从0开始的
+  const day = String(date.getDate()).padStart(2, '0');
+  return `${year}-${month}-${day}`;
+}
 
 /** 搜索按钮操作 */
 const handleQuery = () => {
@@ -168,13 +177,14 @@ const openFill = (deviceCategoryId?:number,deviceId?:number,deptId?:number,devic
 const getAttrList = async () => {
   loading.value = true
   try {
+    totalRunTime1 = 0;
     const data = await IotOpeationFillApi.getAttrs(queryParams)
     attrList.value = data;
-
-    totalRunTime1 = Number(attrList.value[0].totalRunTime).toFixed(2)
+    //totalRunTime1 = Number(attrList.value[0].totalRunTime).toFixed(2)
     attrList.value.forEach(function (item,index){
-      if(item.name=='累计运行时间'){
-        totalRunTime1 = Number(item.fillContent).toFixed(2)
+      if(item.name==='累计运行时间'){
+        item.name = '当日运转时间'
+        totalRunTime1 = Number(item.totalRunTime).toFixed(2)
       }
       item.fillContent = Number(item.fillContent).toFixed(2)
       item.deviceCode = queryParams.deviceCode;
@@ -192,6 +202,8 @@ const getFillInfo = async () => {
   try {
     attrList.value.forEach(function (item,index){
       item.pointName = item.name;
+      item.createTime = formatTimestamp(JSON.parse(deptId.split(",")[2]));
+      item.userId = deptId.split(",")[1];
     })
     const data = attrList.value as unknown as IotOpeationFillVO