Zimo 1 dzień temu
rodzic
commit
4a68e31173
1 zmienionych plików z 80 dodań i 3 usunięć
  1. 80 3
      src/views/pms/iotrddailyreport/index.vue

+ 80 - 3
src/views/pms/iotrddailyreport/index.vue

@@ -1,6 +1,9 @@
 <script lang="ts" setup>
+import { IotRdDailyReportApi } from '@/api/pms/iotrddailyreport'
+import { useTableComponents } from '@/components/ZmTable/useTableComponents'
 import { useUserStore } from '@/store/modules/user'
 import { rangeShortcuts } from '@/utils/formatTime'
+import { useDebounceFn } from '@vueuse/core'
 
 const { t } = useI18n()
 
@@ -19,7 +22,7 @@ interface Query {
 
 const query = ref<Query>({
   pageNo: 1,
-  pageSize: 12,
+  pageSize: 10,
   deptId: id
 })
 
@@ -54,18 +57,77 @@ interface ListItem {
   partyaPrepare: number
   partyaResource: number
   otherNptTime: number
+  otherNptReason: string
+  nonProductFlag: boolean
+  nonProductionRate: number
+  contractName: string
+  timeRange: string
   auditStatus: number
 }
 
-const handleQuery = () => {}
+const list = ref<ListItem[]>([])
+const total = ref(0)
 
-const resetQuery = () => {}
+const loading = ref(false)
+
+const loadList = useDebounceFn(async function () {
+  loading.value = true
+  try {
+    const data = await IotRdDailyReportApi.getIotRdDailyReportPage(query.value)
+    list.value = data.list
+    total.value = data.total
+  } finally {
+    loading.value = false
+  }
+})
+
+function handleSizeChange(val: number) {
+  query.value.pageSize = val
+  handleQuery()
+}
+
+function handleCurrentChange(val: number) {
+  query.value.pageNo = val
+  loadList()
+}
+
+function handleQuery(setPage = true) {
+  if (setPage) {
+    query.value.pageNo = 1
+  }
+  loadList()
+}
+
+function resetQuery() {
+  query.value = {
+    pageNo: 1,
+    pageSize: 10,
+    deptId: id
+  }
+
+  handleQuery()
+}
+
+watch(
+  [
+    () => query.value.deptId,
+    () => query.value.contractName,
+    () => query.value.taskName,
+    () => query.value.createTime
+  ],
+  () => {
+    handleQuery()
+  },
+  { immediate: true }
+)
 
 const openForm = (type: 'create' | 'detail') => {}
 
 const exportLoading = ref(false)
 
 async function handleExport() {}
+
+const { ZmTable, ZmTableColumn } = useTableComponents<ListItem>()
 </script>
 
 <template>
@@ -135,6 +197,21 @@ async function handleExport() {}
         </el-button>
       </el-form-item>
     </el-form>
+    <div class="bg-white dark:bg-[#1d1e1f] shadow rounded-lg flex flex-col p-4">
+      <div class="flex-1 relative">
+        <el-auto-resizer class="absolute">
+          <template #default="{ width, height }">
+            <zm-table
+              :data="list"
+              :loading="loading"
+              :width="width"
+              :max-height="height"
+              :height="height"
+            />
+          </template>
+        </el-auto-resizer>
+      </div>
+    </div>
   </div>
 </template>