浏览代码

运行记录填报

yuanchao 2 月之前
父节点
当前提交
ae2ce00034
共有 3 个文件被更改,包括 59 次插入65 次删除
  1. 4 0
      src/api/pms/iotopeationfill/index.ts
  2. 20 42
      src/views/pms/iotopeationfill/index.vue
  3. 35 23
      src/views/pms/iotopeationfill/index1.vue

+ 4 - 0
src/api/pms/iotopeationfill/index.ts

@@ -43,6 +43,10 @@ export const IotOpeationFillApi = {
     return await request.get({ url: `/rq/iot-opeation-fill/page1`, params })
   },
 
+  getFillRecordsPage: async (params: any) => {
+    return await request.get({ url: `/rq/iot-opeation-fill/fillRecordPage`, params })
+  },
+
   getAttrs:async (params: any) => {
     return await request.get({ url: `/rq/iot-opeation-fill/getAttrs`, params })
   },

+ 20 - 42
src/views/pms/iotopeationfill/index.vue

@@ -100,47 +100,25 @@
         />-->
         <el-table-column label="操作" align="center" min-width="120px">
           <template #default="scope">
-  <!--          <el-button-->
-  <!--            link-->
-  <!--            type="primary"-->
-  <!--            @click="openForm('update', scope.row.id)"-->
-  <!--            v-hasPermi="['rq:iot-inspect-order:update']"-->
-  <!--          >-->
-  <!--            编辑-->
-  <!--          </el-button>-->
-  <!--          <el-button-->
-  <!--            link-->
-  <!--            type="danger"-->
-  <!--            @click="handleDelete(scope.row.id)"-->
-  <!--            v-hasPermi="['rq:iot-inspect-order:delete']"-->
-  <!--          >-->
-  <!--            删除-->
-  <!--          </el-button>-->
-            <el-button
-              link
-              type="primary"
-              @click="openWrite(scope.row.deptId+','+scope.row.userId+','+scope.row.createTime+','+scope.row.id)"
-              v-hasPermi="['rq:iot-opeation-fill:update']"
-            >
-              填写
-            </el-button>
-            <el-button
-              link
-              type="primary"
-              @click="openWrite(scope.row.deptId+','+scope.row.userId+','+scope.row.createTime)"
-              v-if='scope.row.orderStatus === "已完成"'
-            >
-              查看
+              <el-button
+                link
+                type="primary"
+                @click="openWrite(scope.row.deptId+','+scope.row.userId+','+scope.row.createTime
+                +','+scope.row.id+','+scope.row.orderStatus)"
+                v-hasPermi="['rq:iot-opeation-fill:update']"
+                v-if="scope.row.orderStatus !== 1"
+              >
+                填写
+              </el-button>
+              <el-button
+                link
+                type="primary"
+                @click="openWrite(scope.row.deptId+','+scope.row.userId+','+scope.row.createTime+','+scope.row.id+','+scope.row.orderStatus)"
+                v-else
+              >
+                查看
+              </el-button>
 
-            </el-button>
-            <el-button
-              link
-              type="primary"
-              @click="openWrite(scope.row.deptId)"
-              v-else
-            >
-              查看
-            </el-button>
           </template>
         </el-table-column>
       </el-table>
@@ -186,9 +164,9 @@ const queryParams = reactive({
   status: undefined,
   remark: undefined,
   createTime: [],
-  deptId: undefined,
+  deptId: useUserStore().getUser.deptId,
   deviceIds: undefined,
-  userId:useUserStore().getUser.id
+  //userId:useUserStore().getUser.id
 })
 const queryFormRef = ref() // 搜索的表单
 const exportLoading = ref(false) // 导出的加载中

+ 35 - 23
src/views/pms/iotopeationfill/index1.vue

@@ -33,22 +33,22 @@
                 <el-form-item :label='item.name' prop="deviceId"  >
                   <el-input
                     v-if="item.isCollection===1"
-                    v-model="item.fillContent" @input="attrList[index].fillContent = $event.target.fillContent"
+                    v-model="item.fillContent"
                     clearable
                     style="width: 200px"
                     disabled
                   />
                   <el-input
                     v-else
-                    v-model="item.fillContent" @input="attrList[index].fillContent = $event.target.fillContent"
+                    v-model="item.fillContent"
                     clearable
                     style="width: 200px"
                   />
                 </el-form-item>
             </div>
             <el-form-item>
-              <el-button type="info" @click="deleteFillInfo">取消</el-button>
-              <el-button type="primary" @click="getFillInfo">确定</el-button>
+              <el-button type="primary" @click="getFillInfo" v-show="showStatus">确定</el-button>
+              <el-button type="info" @click="deleteFillInfo" v-show="showStatus">取消</el-button>
             </el-form-item>
           </el-form>
         </div>
@@ -68,6 +68,7 @@ import {useUserStore} from "@/store/modules/user";
 import { ElMessage } from 'element-plus'
 import moment from 'moment';
 import { format } from 'date-fns';
+import {cx} from "@fullcalendar/core/internal-common";
 /** 运行记录填报 列表 */
 defineOptions({ name: 'IotOpeationFill' })
 
@@ -83,6 +84,8 @@ const attrList = ref<IotOpeationFillVO[]>([]) // 列表的数据
 const total = ref(0) // 列表的总页数
 const arry1 =ref([]);
 let totalRunTime1: string = '123'
+let fillStatus = params.id.split(",")[4];
+let showStatus = true;
 const queryParams = reactive({
   pageNo: 1,
   pageSize: 10,
@@ -101,16 +104,25 @@ const queryParams = reactive({
   creDate: [],
   createTime: [],
   deviceCategoryId:1,
+  deviceId:undefined
 })
 const queryFormRef = ref() // 搜索的表单
 const exportLoading = ref(false) // 导出的加载中
-
+let cxStatus = true;
 
 const formatDescription = async(row, column, cellValue) =>{
   return cellValue.split(',').map(part => `<div>${part}</div>`).join('');
 }
 
 
+
+const showComponent = () => {
+  if(JSON.parse(fillStatus)=== 1){
+    showStatus = false;
+  }
+};
+
+
 /** 查询列表 */
 const getList = async () => {
   loading.value = true
@@ -118,24 +130,22 @@ const getList = async () => {
     queryParams.deptId = deptId.split(",")[0];
     queryParams.userId = deptId.split(",")[1];
     queryParams.createTime = formatTimestamp(JSON.parse(deptId.split(",")[2].substring(0,10)));
-    const data = await IotOpeationFillApi.getIotOpeationFillPage(queryParams)
-    if(data.length===0){
-      ElMessage({
-        message: '改用户负责设备状态为非施工或待命,请调整',
-        type: 'warning',
-      })
-    }else{
+    queryParams.orderId = deptId.split(",")[3];
+    const data = await IotOpeationFillApi.getIotOpeationFillPage(queryParams);
+
       list.value = data;
-      list.value.forEach(function (item, index) {
-        arry1.value[index] = item;
-      });
-      queryParams.deviceCategoryId = arry1.value[0].deviceCategoryId
-      queryParams.deptId = arry1.value[0].deptId;
-      queryParams.deviceCode = arry1.value[0].deviceCode;
-      queryParams.deviceName = arry1.value[0].deviceName;
-      queryParams.deviceId = arry1.value[0].deviceId;
+
+      if(cxStatus){
+        queryParams.deviceCategoryId = list.value[0].deviceCategoryId
+        queryParams.deptId = list.value[0].deptId;
+        queryParams.deviceCode = list.value[0].deviceCode;
+        queryParams.deviceName = list.value[0].deviceName;
+        queryParams.deviceId = list.value[0].deviceId;
+      }
+
       getAttrList();
-    }
+
+
   } finally {
     loading.value = false
   }
@@ -168,6 +178,7 @@ const open = async (type: string, id?: number) => {
 }
 defineExpose({ open }) // 提供 open 方法,用于打开弹窗
 const openFill = (deviceCategoryId?:number,deviceId?:number,deptId?:number,deviceName?:string,deviceCode?:string) =>{
+
   queryParams.deviceCategoryId = deviceCategoryId;
   queryParams.deptId = deptId;
   queryParams.deviceCode = deviceCode;
@@ -184,7 +195,6 @@ const getAttrList = async () => {
     queryParams.createTime = formatTimestamp(JSON.parse(deptId.split(",")[2].substring(0,10)));
     const data = await IotOpeationFillApi.getAttrs(queryParams)
     attrList.value = data;
-    //totalRunTime1 = Number(attrList.value[0].totalRunTime).toFixed(2)
     attrList.value.forEach(function (item,index){
 
       if(item.name==='累计运行时间'){
@@ -201,6 +211,7 @@ const getAttrList = async () => {
   } finally {
     loading.value = false
   }
+
 }
 /** 获取填写信息保存到后台*/
 const getFillInfo = async () => {
@@ -216,6 +227,7 @@ const getFillInfo = async () => {
     message.success(t('common.createSuccess'))
     // 发送操作成功的事件
     emit('success')
+    cxStatus = false;
     getList();
   } finally {
 
@@ -260,7 +272,7 @@ const handleExport = async () => {
 /** 初始化 **/
 onMounted(() => {
   getList()
-
+  showComponent()
 })
 </script>
 <style scoped>