Forráskód Böngészése

feat: 增加设备选择,动态日期

sunxiao 5 hónapja
szülő
commit
fcfbf6a303

+ 20 - 206
src/views/report/detection-month/index.vue

@@ -1,12 +1,13 @@
 <script setup>
 import { dayjs } from 'element-plus';
-import { getContinuousAssayList } from '@/api/report/lab';
+import { getContinuousAssayList, getDeviceList } from '@/api/report/lab';
 
 const { proxy } = getCurrentInstance();
 
 const queryParams = ref({
   pageNum: 1,
   pageSize: 10,
+  deviceNo: '',
   activeRadioName: 'week'
 });
 
@@ -18,6 +19,7 @@ const tempDataValue = ref({timeBegin: dayjs(new Date()).startOf('week').format('
 
 const tableData = ref([]);
 const columns = ref([]);
+const options = ref([]);
 
 const format = computed(() => {
   return queryParams.value.activeRadioName === 'week' ? tempDataValue.value.timeBegin + ' 第 ww 周'  : 'YYYY-MM'
@@ -53,207 +55,7 @@ const initPageData = async() => {
   tableLoading.value = true;
   loading.value = true;
   const dateResult = getStartTimeAndEndTime();
-  const { data } = await getContinuousAssayList({...dateResult});
-  // const data = {
-  //   "二段1池": {
-  //     "正磷酸盐": [
-  //       {
-  //         "assayName": "正磷酸盐",
-  //         "assayCounts": 1,
-  //         "minVal": 1.04,
-  //         "maxVal": 1.04,
-  //         "passedRates": "100.0%",
-  //         "bx": "90.00%",
-  //         "ratesDeviation": "10.00%",
-  //         "unitPrice": null,
-  //         "totalPrice": null
-  //       }
-  //     ],
-  //     "硝酸盐氮": [
-  //       {
-  //         "assayName": "硝酸盐氮",
-  //         "assayCounts": 1,
-  //         "minVal": 8.87,
-  //         "maxVal": 8.87,
-  //         "passedRates": "100.0%",
-  //         "bx": "90.00%",
-  //         "ratesDeviation": "10.00%",
-  //         "unitPrice": null,
-  //         "totalPrice": null
-  //       }
-  //     ]
-  //   },
-  //   "回流一池": {
-  //     "正磷酸盐": [
-  //       {
-  //         "assayName": "正磷酸盐",
-  //         "assayCounts": 3,
-  //         "minVal": 1.85,
-  //         "maxVal": 2.16,
-  //         "passedRates": "100.0%",
-  //         "bx": "90.00%",
-  //         "ratesDeviation": "10.00%",
-  //         "unitPrice": null,
-  //         "totalPrice": null
-  //       }
-  //     ],
-  //     "硝酸盐氮": [
-  //       {
-  //         "assayName": "硝酸盐氮",
-  //         "assayCounts": 5,
-  //         "minVal": 9.81,
-  //         "maxVal": 11,
-  //         "passedRates": "100.0%",
-  //         "bx": "90.00%",
-  //         "ratesDeviation": "10.00%",
-  //         "unitPrice": null,
-  //         "totalPrice": null
-  //       }
-  //     ]
-  //   },
-  //   "缺氧二池": {
-  //     "氨氮": [
-  //       {
-  //         "assayName": "氨氮",
-  //         "assayCounts": 2,
-  //         "minVal": 13.59,
-  //         "maxVal": 13.61,
-  //         "passedRates": "100.0%",
-  //         "bx": "90.00%",
-  //         "ratesDeviation": "10.00%",
-  //         "unitPrice": null,
-  //         "totalPrice": null
-  //       }
-  //     ],
-  //     "硝酸盐氮": [
-  //       {
-  //         "assayName": "硝酸盐氮",
-  //         "assayCounts": 5,
-  //         "minVal": 0.49,
-  //         "maxVal": 0.64,
-  //         "passedRates": "100.0%",
-  //         "bx": "90.00%",
-  //         "ratesDeviation": "10.00%",
-  //         "unitPrice": null,
-  //         "totalPrice": null
-  //       }
-  //     ]
-  //   },
-  //   "二沉池": {
-  //     "正磷酸盐": [
-  //       {
-  //         "assayName": "正磷酸盐",
-  //         "assayCounts": 3,
-  //         "minVal": 0.39,
-  //         "maxVal": 0.8,
-  //         "passedRates": "100.0%",
-  //         "bx": "90.00%",
-  //         "ratesDeviation": "10.00%",
-  //         "unitPrice": null,
-  //         "totalPrice": null
-  //       }
-  //     ]
-  //   },
-  //   "回流二池": {
-  //     "正磷酸盐": [
-  //       {
-  //         "assayName": "正磷酸盐",
-  //         "assayCounts": 3,
-  //         "minVal": 2.08,
-  //         "maxVal": 2.44,
-  //         "passedRates": "100.0%",
-  //         "bx": "90.00%",
-  //         "ratesDeviation": "10.00%",
-  //         "unitPrice": null,
-  //         "totalPrice": null
-  //       }
-  //     ],
-  //     "硝酸盐氮": [
-  //       {
-  //         "assayName": "硝酸盐氮",
-  //         "assayCounts": 5,
-  //         "minVal": 11.43,
-  //         "maxVal": 12.22,
-  //         "passedRates": "100.0%",
-  //         "bx": "90.00%",
-  //         "ratesDeviation": "10.00%",
-  //         "unitPrice": null,
-  //         "totalPrice": null
-  //       }
-  //     ]
-  //   },
-  //   "缺氧一池": {
-  //     "氨氮": [
-  //       {
-  //         "assayName": "氨氮",
-  //         "assayCounts": 2,
-  //         "minVal": 11.9,
-  //         "maxVal": 11.97,
-  //         "passedRates": "100.0%",
-  //         "bx": "90.00%",
-  //         "ratesDeviation": "10.00%",
-  //         "unitPrice": null,
-  //         "totalPrice": null
-  //       }
-  //     ],
-  //     "硝酸盐氮": [
-  //       {
-  //         "assayName": "硝酸盐氮",
-  //         "assayCounts": 5,
-  //         "minVal": 0.52,
-  //         "maxVal": 0.62,
-  //         "passedRates": "100.0%",
-  //         "bx": "90.00%",
-  //         "ratesDeviation": "10.00%",
-  //         "unitPrice": null,
-  //         "totalPrice": null
-  //       }
-  //     ]
-  //   },
-  //   "二段2池": {
-  //     "正磷酸盐": [
-  //       {
-  //         "assayName": "正磷酸盐",
-  //         "assayCounts": 1,
-  //         "minVal": 1.55,
-  //         "maxVal": 1.55,
-  //         "passedRates": "100.0%",
-  //         "bx": "90.00%",
-  //         "ratesDeviation": "10.00%",
-  //         "unitPrice": null,
-  //         "totalPrice": null
-  //       }
-  //     ],
-  //     "硝酸盐氮": [
-  //       {
-  //         "assayName": "硝酸盐氮",
-  //         "assayCounts": 1,
-  //         "minVal": 8.24,
-  //         "maxVal": 8.24,
-  //         "passedRates": "100.0%",
-  //         "bx": "90.00%",
-  //         "ratesDeviation": "10.00%",
-  //         "unitPrice": null,
-  //         "totalPrice": null
-  //       }
-  //     ]
-  //   },
-  //   "total": {
-  //     "合计": [
-  //       {
-  //         "assayName": null,
-  //         "assayCounts": 37,
-  //         "minVal": null,
-  //         "maxVal": null,
-  //         "passedRates": null,
-  //         "bx": "90.00%",
-  //         "ratesDeviation": "10.00%",
-  //         "unitPrice": null,
-  //         "totalPrice": null
-  //       }
-  //     ]
-  //   }
-  // }
+  const { data } = await getContinuousAssayList({...dateResult, deviceNo: queryParams.value.deviceNo});
 
   const whiteTableList = [
     // { title: '检测指标', key: 'assayName' },
@@ -320,7 +122,13 @@ const handleExport = () => {
   }, `${new Date().getTime()}.xlsx`);
 }
 
-onMounted(() => {
+onMounted(async() => {
+  getDeviceList().then(({ data }) => {
+    // const [ item ] = data;
+    // queryParams.value.deviceNo = item?.deviceNo;
+    options.value = data
+  });
+  
   initPageData();
 })
 </script>
@@ -335,7 +143,14 @@ onMounted(() => {
         </p>
       </template>
       <el-row class="pt-[5px]" justify="space-between" :gutter="20">
-        <el-col :span="18">
+        <el-col :span="6">
+          <el-form-item label="设备编号">
+            <el-select v-model="queryParams.deviceNo" placeholder="请选择" filterable>
+              <el-option v-for="item in options" :key="item.deviceNo" :label="item.deviceName" :value="item.deviceNo" />
+            </el-select>
+          </el-form-item>
+        </el-col>
+        <el-col :span="12">
           <div class="flex items-center space-x-[20px]">
             <el-form-item label="统计时段">
               <el-radio-group v-model="queryParams.activeRadioName" @change="onRadioChange">
@@ -346,7 +161,6 @@ onMounted(() => {
             <el-form-item :label="label">
               <el-date-picker
                 v-model="datePickerValue"
-                style="width: 300px"
                 :editable="false"
                 :clearable="false"
                 :type="queryParams.activeRadioName"
@@ -357,7 +171,7 @@ onMounted(() => {
             </el-form-item>
           </div>
         </el-col>
-        <el-col :span="6">
+        <el-col :span="4">
           <div class="flex justify-end">
             <el-button type="primary" @click="handlerQuery" :loading="loading">查询</el-button>
             <el-button @click="handlerReset" :loading="loading">重置</el-button>

+ 9 - 2
src/views/report/report-daily/index.vue

@@ -11,6 +11,7 @@ const total = ref(0);
 const selectOptions = ref({});
 const tableData = ref([]);
 const drawerData = ref({});
+const currentDateTime = ref('');
 
 const deviceNameEnum = {
   "0": "待机中",
@@ -89,9 +90,15 @@ onMounted( async () => {
   const { data } = await getHomeCounts(type);
   const { data: waterFactoryData } = await getWaterFactory();
 
-  pageCountNums.value = data;
+  pageCountNums.value = {
+    ...data,
+    passAssayRates: data.passAssayRates ? data.passAssayRates.toFixed(2) : 0 + "%"
+  };
   selectOptions.value = waterFactoryData;
   queryParams.value.type = type;
+
+  currentDateTime.value = dayjs(new Date()).format('YYYY-MM-DD hh:mm:ss');
+  
 })
 
 </script>
@@ -103,7 +110,7 @@ onMounted( async () => {
         <template #header>
           <p class="space-x-[10px]">
             <span class="font-bold">今日数据概览</span>
-            <span class="text-[#999]">统计时间 2024-08-01 12:22:59</span>
+            <span class="text-[#999]">统计时间 {{ currentDateTime }}</span>
           </p>
         </template>
         <el-row class="pt-[5px]" justify="space-between" :gutter="20">