Ver código fonte

Merge remote-tracking branch 'origin/master'

zhangcl 2 meses atrás
pai
commit
20c04857d5

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

@@ -39,10 +39,18 @@ export const IotOpeationFillApi = {
     return await request.get({ url: `/rq/iot-opeation-fill/page`, params })
   },
 
+  getIotOrderPage: async (params: any) => {
+    return await request.get({ url: `/rq/iot-opeation-fill/orderPage`, params })
+  },
+
   getIotOpeationFillPage1: async (params: any) => {
     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 })
   },

+ 1 - 1
src/views/pms/failure/DeviceList.vue

@@ -1,5 +1,5 @@
 <template>
-  <Dialog v-model="dialogVisible" title="选择品牌" style="width: 1100px; max-height: 800px">
+  <Dialog v-model="dialogVisible" title="选择设备" style="width: 1100px; max-height: 800px">
     <ContentWrap>
       <el-form
         class="-mb-15px"

+ 28 - 28
src/views/pms/inspect/order/index.vue

@@ -24,15 +24,15 @@
               class="!w-240px"
             />
           </el-form-item>
-          <el-form-item label="工单编码" prop="inspectOrderCode">
-            <el-input
-              v-model="queryParams.inspectOrderCode"
-              placeholder="请输入工单编码"
-              clearable
-              @keyup.enter="handleQuery"
-              class="!w-240px"
-            />
-          </el-form-item>
+<!--          <el-form-item label="工单编码" prop="inspectOrderCode">-->
+<!--            <el-input-->
+<!--              v-model="queryParams.inspectOrderCode"-->
+<!--              placeholder="请输入工单编码"-->
+<!--              clearable-->
+<!--              @keyup.enter="handleQuery"-->
+<!--              class="!w-240px"-->
+<!--            />-->
+<!--          </el-form-item>-->
           <el-form-item label="工单状态" prop="status">
             <el-select
               v-model="queryParams.status"
@@ -48,17 +48,17 @@
               />
             </el-select>
           </el-form-item>
-          <el-form-item label="创建时间" prop="createTime">
-            <el-date-picker
-              v-model="queryParams.createTime"
-              value-format="YYYY-MM-DD HH:mm:ss"
-              type="daterange"
-              start-placeholder="开始日期"
-              end-placeholder="结束日期"
-              :default-time="[new Date('1 00:00:00'), new Date('1 23:59:59')]"
-              class="!w-220px"
-            />
-          </el-form-item>
+<!--          <el-form-item label="创建时间" prop="createTime">-->
+<!--            <el-date-picker-->
+<!--              v-model="queryParams.createTime"-->
+<!--              value-format="YYYY-MM-DD HH:mm:ss"-->
+<!--              type="daterange"-->
+<!--              start-placeholder="开始日期"-->
+<!--              end-placeholder="结束日期"-->
+<!--              :default-time="[new Date('1 00:00:00'), new Date('1 23:59:59')]"-->
+<!--              class="!w-220px"-->
+<!--            />-->
+<!--          </el-form-item>-->
           <el-form-item>
             <el-button @click="handleQuery"
               ><Icon icon="ep:search" class="mr-5px" /> 搜索</el-button
@@ -96,7 +96,7 @@
             </template>
           </el-table-column>
           <el-table-column label="工单名称" align="center" prop="inspectOrderTitle" />
-          <el-table-column label="工单编码" align="center" prop="inspectOrderCode" />
+<!--          <el-table-column label="工单编码" align="center" prop="inspectOrderCode" />-->
           <el-table-column label="工单类型" align="center" prop="type" />
           <el-table-column label="工单状态" align="center" prop="status">
             <template #default="scope">
@@ -105,13 +105,13 @@
           </el-table-column>
           <el-table-column label="负责人" align="center" prop="chargeName" />
           <el-table-column label="备注" align="center" prop="remark" />
-          <el-table-column
-            label="创建时间"
-            align="center"
-            prop="createTime"
-            :formatter="dateFormatter"
-            width="180px"
-          />
+<!--          <el-table-column-->
+<!--            label="创建时间"-->
+<!--            align="center"-->
+<!--            prop="createTime"-->
+<!--            :formatter="dateFormatter"-->
+<!--            width="180px"-->
+<!--          />-->
           <el-table-column label="操作" align="center" min-width="120px">
             <template #default="scope">
               <!--          <el-button-->

+ 12 - 4
src/views/pms/inspect/route/IotInspectRoute.vue

@@ -226,7 +226,6 @@ const close = () => {
   })
 }
 const itemsWithIndex = computed(() => {
-  debugger
   return items.value.map((item, index) => ({
     itemId: item.id,
     item: item.item,
@@ -234,6 +233,14 @@ const itemsWithIndex = computed(() => {
     index: index + 1 // 序号从1开始
   }))
 })
+const itemsWithIndexUpdate = computed(() => {
+  return items.value.map((item, index) => ({
+    itemId: item.itemId,
+    item: item.item,
+    standard: item.standard,
+    index: index + 1 // 序号从1开始
+  }))
+})
 const { wsCache } = useCache()
 /** 提交表单 */
 const emit = defineEmits(['success']) // 定义 success 事件,用于操作成功后的回调
@@ -244,17 +251,18 @@ const submitForm = async () => {
   // 提交请求
   formLoading.value = true
   try {
-    const newitems = itemsWithIndex
-    debugger
-    formData.value.itemJson = JSON.stringify(newitems.value)
     // const user = wsCache.get(CACHE_KEY.USER)
     // formData.value.deptId = user.user.deptId
     const data = formData.value as unknown as IotInspectRouteVO
     if (formType.value === 'create') {
+      const newitems = itemsWithIndex
+      formData.value.itemJson = JSON.stringify(newitems.value)
       await IotInspectRouteApi.createIotInspectRoute(data)
       message.success(t('common.createSuccess'))
       close()
     } else {
+      const newitems = itemsWithIndexUpdate
+      formData.value.itemJson = JSON.stringify(newitems.value)
       await IotInspectRouteApi.updateIotInspectRoute(data)
       message.success(t('common.updateSuccess'))
       close()

+ 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) // 导出的加载中

+ 32 - 24
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,19 @@ 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 +175,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 +192,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==='累计运行时间'){
@@ -197,10 +204,10 @@ const getAttrList = async () => {
       item.deviceId = queryParams.deviceId;
       item.deviceCategoryId = queryParams.deviceCategoryId;
     })
-
   } finally {
     loading.value = false
   }
+
 }
 /** 获取填写信息保存到后台*/
 const getFillInfo = async () => {
@@ -216,6 +223,7 @@ const getFillInfo = async () => {
     message.success(t('common.createSuccess'))
     // 发送操作成功的事件
     emit('success')
+    cxStatus = false;
     getList();
   } finally {
 
@@ -260,7 +268,7 @@ const handleExport = async () => {
 /** 初始化 **/
 onMounted(() => {
   getList()
-
+  showComponent()
 })
 </script>
 <style scoped>

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

@@ -78,7 +78,7 @@
               </el-form-item>
             </el-col>
             <el-col :span="8">
-              <el-form-item label="故障时间" prop="failureTime">
+              <el-form-item label="故障时间" prop="failureTime" :rules="formData.type==='out'?failureTimeRule:[]" >
                 <el-date-picker
                   style="width: 150%"
                   v-model="formData.failureTime"
@@ -333,6 +333,7 @@ const formData = ref({
   maintainFee: undefined,
   outFile: undefined
 })
+const failureTimeRule = [{ required: true, message: '故障时间不能为空', trigger: 'blur' }]
 const startRule = [{ required: true, message: '维修开始时间不能为空', trigger: 'blur' }]
 const descriptionRule = [{required: true, message:'维修描述不能为空', trigger: 'blur' }]
 const endRule = [{ required: true, message: '维修结束时间不能为空', trigger: 'blur' }]
@@ -342,7 +343,7 @@ const formRules = reactive({
   type: [{ required: true, message: '维修类型不能为空', trigger: 'blur' }],
   ifStop: [{ required: true, message: '是否停机不能为空', trigger: 'blur' }],
   failureName: [{ required: true, message: '故障名称不能为空', trigger: 'blur' }],
-  failureTime: [{ required: true, message: '故障时间不能为空', trigger: 'blur' }],
+  // failureTime: [{ required: true, message: '故障时间不能为空', trigger: 'blur' }],
   // maintainStartTime: [{ required: true, message: '维修开始时间不能为空', trigger: 'blur' }],
   // maintainEndTime: [{ required: true, message: '维修结束时间不能为空', trigger: 'blur' }],
   // maintainDescription: [{ required: true, message: '维修描述不能为空', trigger: 'blur' }],