Browse Source

参研人员花名册增加工时不达标文字标红功能

ljb 10 months ago
parent
commit
2ed4a0d131
1 changed files with 15 additions and 0 deletions
  1. 15 0
      src/views/tech-person/cy-person-roster.vue

+ 15 - 0
src/views/tech-person/cy-person-roster.vue

@@ -34,6 +34,11 @@
           <avue-input-number v-model="params.situationCountMax" :min="0" style="width: 100px !important;"></avue-input-number>
         </div>
       </template>
+
+      <template v-for="col of redColKey" :slot="col" slot-scope="{ row }">
+        <span v-if="row.total < 183" style="color: red;" :key="col">{{ row[col] }}</span>
+        <span v-else style="color: #606266;" :key="col">{{ row[col] }}</span>
+      </template>
       
     </avue-crud>
 
@@ -57,6 +62,7 @@ import NProgress from 'nprogress';
 import 'nprogress/nprogress.css';
 import {getToken} from "@/util/auth";
 import {downloadXls} from "@/util/util";
+import Decimal from "decimal.js";
 
 
 export default window.$crudCommon({
@@ -70,6 +76,8 @@ export default window.$crudCommon({
       },
       wideTableColumns: [],
       printTitle: "",
+
+      redColKey: ['7', '8', '9', '10', '11', '12'],
     };
   },
   watch: {
@@ -117,6 +125,13 @@ export default window.$crudCommon({
         item[Number(hourItem.workDate.substring(hourItem.workDate.length - 2))] = hourItem.workHours;
       });
 
+      let total = new Decimal(0);
+      for (let i=0; i<12; i++) {
+        console.log(item[`${i+1}`])
+        total = total.add(new Decimal(item[`${i+1}`] || 0));
+      }
+      item.total = total;
+
 
       return item;
     });