shudonghui 1 gadu atpakaļ
vecāks
revīzija
fdef7184b6

+ 47 - 36
src/views/work-hours/work-hours-manage/work-attendance/detail-dialog.vue

@@ -28,7 +28,7 @@
                 </t-form-item>
               </t-col>
               <t-col :span="3">
-                <t-form-item label="所属供应商"  label-width="100px">{{ row.supplierName}}
+                <t-form-item label="所属供应商" label-width="100px">{{ row.supplierName }}
                 </t-form-item>
               </t-col>
               <t-col :span="3">
@@ -61,12 +61,12 @@
                   }}
                 </t-form-item>
               </t-col>
-<!--              <t-col :span="3">-->
-<!--                <t-form-item label="实施产品">{{-->
-<!--                    row.productName-->
-<!--                  }}-->
-<!--                </t-form-item>-->
-<!--              </t-col>-->
+              <!--              <t-col :span="3">-->
+              <!--                <t-form-item label="实施产品">{{-->
+              <!--                    row.productName-->
+              <!--                  }}-->
+              <!--                </t-form-item>-->
+              <!--              </t-col>-->
               <t-col :span="3">
                 <t-form-item label="服务单元">{{
                     row.serviceUnitName
@@ -78,17 +78,26 @@
         </t-collapse-panel>
       </t-collapse>
       <div style="margin-bottom: 20px">
-        <t-button   variant="outline">
-          <template #icon><svg-icon name="effective-attendance" color="#00B42A" /></template
-          >有效出勤&nbsp;&nbsp;&nbsp;&nbsp;{{row.actualDays}}天
+        <t-button variant="outline">
+          <template #icon>
+            <svg-icon name="effective-attendance" color="#00B42A"/>
+          </template
+          >
+          有效出勤&nbsp;&nbsp;&nbsp;&nbsp;{{ row.actualDays }}天
         </t-button>&nbsp;&nbsp;
-        <t-button   variant="outline">
-          <template #icon><svg-icon name="working-hours" color="#262626" /></template
-          >共计工时&nbsp;&nbsp;&nbsp;&nbsp;{{row.workHours}}天
+        <t-button variant="outline">
+          <template #icon>
+            <svg-icon name="working-hours" color="#262626"/>
+          </template
+          >
+          共计工时&nbsp;&nbsp;&nbsp;&nbsp;{{ row.workHours }}天
         </t-button>&nbsp;&nbsp;
-        <t-button   variant="outline">
-          <template #icon><svg-icon name="anomalies" color="#F53F3F" /></template
-          >异常共计&nbsp;&nbsp;&nbsp;&nbsp;{{row.exceptionCount}}天
+        <t-button variant="outline">
+          <template #icon>
+            <svg-icon name="anomalies" color="#F53F3F"/>
+          </template
+          >
+          异常共计&nbsp;&nbsp;&nbsp;&nbsp;{{ row.exceptionCount }}天
         </t-button>
       </div>
       <t-table
@@ -106,18 +115,19 @@
         }"
       >
         <template #signIn="{ col, row }">
-          {{ row.signInTime?timestampFilter(row[col.colKey],'tt')+row.signInAddress:'异常' }}
+          {{ row.signInTime ? timestampFilter(row[col.colKey], 'tt') + row.signInAddress : '异常' }}
         </template>
         <template #signOut="{ col, row }">
-          {{ row.signOutTime?timestampFilter(row[col.colKey],'tt')+row.signOutAddress:'异常' }}
+          {{ row.signOutTime ? timestampFilter(row[col.colKey], 'tt') + row.signOutAddress : '异常' }}
         </template>
         <template #workHours="{ col, row }">
-          {{ row.signOutTime&&row.signInTime?(row.signOutTime-row.signInTime)/1000/60/60:''}}
+          {{ row.signOutTime && row.signInTime ? ((row.signOutTime - row.signInTime) / 1000 / 60 / 60).toFixed(2) : '' }}
         </template>
       </t-table>
       <t-space class="sop-step-footer" style="flex-direction: row">
         <t-button theme="primary" @click="emit('update:visible', false)"
-        >返回</t-button
+        >返回
+        </t-button
         >
       </t-space>
     </div>
@@ -127,9 +137,10 @@
 
 <script setup name="DetailDialog">
 import {timestampFilter, roleTypeFilter, customerTypeFilter, attendanceSubmitStatusFilter} from '@/utils/filter';
-import {reactive, watch} from 'vue';
+import {computed, reactive, watch} from 'vue';
 import useFetchTable from "@/hooks/useFetchTable";
 import {detail} from "@/api/work-hours";
+import {randomCode} from "@/utils/tool";
 
 const emit = defineEmits(['update:visible', 'confirm']);
 const props = defineProps({
@@ -142,34 +153,34 @@ const props = defineProps({
   },
 });
 const columns = [
-  { colKey: 'signDate', title: '日期', width: 120 },
-  { colKey: 'signInTime', title: '签到', cell: 'signIn' },
-  { colKey: 'signOutTime', title: '签退', width: 140, cell: 'signOut' },
-  { colKey: 'workHours', title: '工时(小时)', width: 140, cell: 'workHours' },
+  {colKey: 'signDate', title: '日期', width: 120},
+  {colKey: 'signInTime', title: '签到', cell: 'signIn'},
+  {colKey: 'signOutTime', title: '签退', width: 140, cell: 'signOut'},
+  {colKey: 'workHours', title: '工时(小时)', width: 140, cell: 'workHours'},
 ];
-let params = reactive({
-  sopNo: props.row.sopNo,
-  archivesId:props.row.archivesId,
+
+const params = computed(() => {
+  return {
+    sopNo: props.row.sopNo,
+    archivesId: props.row.archivesId,
+  };
 });
 
-const { pagination, tableData,fetchData } = useFetchTable(
+const {pagination, tableData, fetchData} = useFetchTable(
     detail,
     {
       params,
-    },false
+    }, false
 );
 
 
 watch(
     () => props.visible,
     (val) => {
-      if (val){
-        params = reactive({
-          sopNo: props.row.sopNo,
-          archivesId:props.row.archivesId,
-        });
+      if (val)
+
         fetchData()
-      }
+
     }
 );
 </script>