ソースを参照

feat: 报表中心问题修改

sunxiao 5 ヶ月 前
コミット
f0ae12e719

+ 9 - 1
src/views/report/components/RecordDrawer.vue

@@ -3,6 +3,8 @@ import { ElMessageBox } from 'element-plus';
 import * as echarts from 'echarts';
 import { getReportLineOptions } from './echartOptions';
 import { getDrawerData } from '@/api/report/lab';
+import { onMounted } from 'vue';
+import { useRoute } from 'vue-router';
 
 const props = defineProps({
   data: {
@@ -11,6 +13,8 @@ const props = defineProps({
   }
 })
 
+const route = useRoute();
+
 const echartInstance = {};
 const listRefs = [];
 
@@ -131,7 +135,7 @@ const getList = async () => {
   loading.value = true;
 
   const { deviceNo, currentDate } = props.data;
-  const { rows, total: tableTotal } = await getDrawerData({ deviceNo, timeBegin: currentDate, timeEnd: currentDate, ...queryParams.value });
+  const { rows, total: tableTotal } = await getDrawerData({ deviceNo, timeBegin: currentDate, timeEnd: currentDate, ...queryParams.value, type: props.data.type });
   total.value = tableTotal;
   tableData.value = rows;
   loading.value = false;
@@ -160,6 +164,10 @@ const onDrawerClosed = () => {
   };
   tableData.value = [];
 }
+
+onMounted(() => {
+  console.log( route.query.type );
+})
 </script>
 
 <template>

+ 37 - 3
src/views/report/laboratory-month/index.vue

@@ -211,6 +211,36 @@ const handleExport = () => {
   // }
 }
 
+const test = (key, item) => {
+
+  let color = '#606266';
+  const whitelist = [
+    'highCodDeviationRate',
+    'lowCodDeviationRate',
+    'anDanDeviationRate',
+    'tnDeviationRate',
+    'tpDeviationRate',
+    'xsydDeviationRate',
+    'yxsyDeviationRate',
+    'zlsyDeviationRate',
+    'totalDeviationRate'
+  ]
+
+  if ( whitelist.includes(key) ) {
+    const n = item[key];
+    
+    if (!n) return {};
+    
+    const num = Number(n.replace('%', ''))
+
+    if ( (num || num == 0) && num > 90 ) {
+      color = 'red'
+    }
+  }
+
+  return {color};
+}
+
 onMounted(async () => {
 
   datePickerValue.value = [dateBeforeSevenDays.value, new Date()];
@@ -286,11 +316,15 @@ onMounted(async () => {
       </div>
       <!-- :span-method="arraySpanMethod" -->
       <el-table :data="tableData" style="width: 100%" v-loading="tableLoading">
-        <el-table-column prop="worksName" label="用户" width="200" fixed="left" header-align="center" />
+        <el-table-column prop="worksName" label="用户" width="200" fixed="left" header-align="center" v-if="finalyColumns.length"/>
         <el-table-column :label="col.label" :min-width="col.width" :fixed="col.fixed" align="center" v-for="col in finalyColumns">
-          <el-table-column :prop="child.prop" :label="child.label" :min-width="child.width" v-for="child in col.children"/>
+          <el-table-column :prop="child.prop" :label="child.label" :min-width="child.width" v-for="child in col.children">
+            <template #default="scope">
+              <span :style="test(child.prop, scope.row)">{{ scope.row[child.prop] }}</span>
+            </template>
+          </el-table-column>
         </el-table-column>
-        <el-table-column prop="totalDeviationRate" label="总质控合格率" width="120" header-align="center" fixed="right" align="center"/>
+        <el-table-column prop="totalDeviationRate" label="总质控合格率" width="120" header-align="center" fixed="right" align="center" v-if="finalyColumns.length"/>
       </el-table>
     </el-card>
   </div>

+ 1 - 1
src/views/report/record/index.vue

@@ -103,7 +103,7 @@ const initPageData = async () => {
   loading.value = true;
 
   const [ timeBegin, timeEnd ] = datePieckerValue.value;
-  const { total: tableTotal, rows } = await getDrawerData({ ...queryParams.value, timeBegin, timeEnd });
+  const { total: tableTotal, rows } = await getDrawerData({ ...queryParams.value, timeBegin, timeEnd, type: route.query.t });
   
   const arr = [];
 

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

@@ -87,11 +87,11 @@ const handleRadioChange = () => {
 
 // table btn 化验记录
 const handleTableBtnClick = async (row) => {
-  const { deviceNo, deviceName, worksName } = row;
+  const { deviceNo, deviceName, worksName, type } = row;
   const currentDate = queryParams.value.assayDate;
 
   drawerData.value = {
-    deviceName, deviceNo, worksName, currentDate
+    deviceName, deviceNo, worksName, currentDate, type
   }
 
   drawerVisible.value = true;