Bläddra i källkod

5号国日报

yanghao 6 dagar sedan
förälder
incheckning
94fb920558

+ 16 - 0
src/api/pms/fiveconstructiondailyreport/index.ts

@@ -0,0 +1,16 @@
+import request from '@/config/axios'
+
+export const FiveIotProjectDailyReportApi = {
+  // 获取项目日报分页
+  getIotProjectDailyReportPage: async (params) => {
+    return await request.get({ url: '/pms/iot-five-daily-report/page', params })
+  },
+  // 查看项目日报详情
+  getIotProjectDailyReport: async (id) => {
+    return await request.get({ url: '/pms/iot-five-daily-report/get?id=' + id })
+  },
+  // 填报项目日报
+  updateIotProjectDailyReport: async (data) => {
+    return await request.put({ url: '/pms/iot-five-daily-report/update', data })
+  }
+}

+ 9 - 9
src/views/pms/constructionDailyReport/components/ConstructionDailyReportDrawer.vue

@@ -1,5 +1,5 @@
 <script setup lang="ts">
-import { IotProjectDailyReportApi } from '@/api/pms/iotprojectdailyreport'
+import { FiveIotProjectDailyReportApi } from '@/api/pms/fiveconstructiondailyreport'
 import dayjs from 'dayjs'
 import type { FormInstance } from 'element-plus'
 import ConstructionDailyReportFormSection from './ConstructionDailyReportFormSection.vue'
@@ -24,7 +24,9 @@ const drawerMode = ref<'edit' | 'readonly'>('edit')
 const form = ref<ConstructionDailyReportRow>(createEmptyConstructionDailyReport())
 const message = useMessage()
 
-const drawerTitle = computed(() => (drawerMode.value === 'readonly' ? '查看施工日报' : '编辑施工日报'))
+const drawerTitle = computed(() =>
+  drawerMode.value === 'readonly' ? '查看施工日报' : '编辑施工日报'
+)
 const disabled = computed(() => drawerMode.value === 'readonly')
 
 function normalizeDetail(detail: Record<string, any> = {}) {
@@ -43,7 +45,7 @@ function normalizeDetail(detail: Record<string, any> = {}) {
 async function loadDetail(id: number) {
   loading.value = true
   try {
-    const detail = await IotProjectDailyReportApi.getIotProjectDailyReport(id)
+    const detail = await FiveIotProjectDailyReportApi.getIotProjectDailyReport(id)
     form.value = normalizeDetail(detail)
   } finally {
     loading.value = false
@@ -67,9 +69,9 @@ async function handleSubmit() {
   try {
     const payload = { ...form.value } as Record<string, any>
     if (payload.id) {
-      await IotProjectDailyReportApi.updateIotProjectDailyReport(payload)
+      await FiveIotProjectDailyReportApi.updateIotProjectDailyReport(payload)
     } else {
-      await IotProjectDailyReportApi.createIotProjectDailyReport(payload)
+      await FiveIotProjectDailyReportApi.updateIotProjectDailyReport(payload)
     }
     message.success('保存成功')
     emits('update:visible', false)
@@ -92,8 +94,7 @@ defineExpose({ handleOpenForm })
     size="80%"
     destroy-on-close
     header-class="mb-0!"
-    @update:model-value="emits('update:visible', $event)"
-  >
+    @update:model-value="emits('update:visible', $event)">
     <template #header>
       <span class="text-xl font-bold text-[var(--el-text-color-primary)]">{{ drawerTitle }}</span>
     </template>
@@ -106,8 +107,7 @@ defineExpose({ handleOpenForm })
           :model="form"
           :section="section"
           :disabled="disabled"
-          @update:model="handleModelChange"
-        />
+          @update:model="handleModelChange" />
       </div>
     </el-form>
 

+ 21 - 33
src/views/pms/constructionDailyReport/index.vue

@@ -1,12 +1,15 @@
 <script setup lang="ts">
-import { IotProjectDailyReportApi } from '@/api/pms/iotprojectdailyreport'
+import { FiveIotProjectDailyReportApi } from '@/api/pms/fiveconstructiondailyreport'
 import { useUserStore } from '@/store/modules/user'
 import { rangeShortcuts } from '@/utils/formatTime'
 import { useDebounceFn } from '@vueuse/core'
 import dayjs from 'dayjs'
 import ConstructionDailyReportDrawer from './components/ConstructionDailyReportDrawer.vue'
 import ConstructionDailyReportTable from './components/ConstructionDailyReportTable.vue'
-import type { ConstructionDailyReportQuery, ConstructionDailyReportRow } from './components/report-config'
+import type {
+  ConstructionDailyReportQuery,
+  ConstructionDailyReportRow
+} from './components/report-config'
 
 defineOptions({ name: 'ConstructionDailyReport' })
 
@@ -16,10 +19,10 @@ const deptId = userStore.getUser.deptId
 const initQuery: ConstructionDailyReportQuery = {
   pageNo: 1,
   pageSize: 10,
-  deptId,
-  createTime: [
-    ...rangeShortcuts[2].value().map((item) => dayjs(item).format('YYYY-MM-DD HH:mm:ss'))
-  ]
+  deptId
+  // createTime: [
+  //   ...rangeShortcuts[2].value().map((item) => dayjs(item).format('YYYY-MM-DD HH:mm:ss'))
+  // ]
 }
 
 const query = ref<ConstructionDailyReportQuery>({ ...initQuery })
@@ -33,7 +36,7 @@ const route = useRoute()
 const loadList = useDebounceFn(async () => {
   loading.value = true
   try {
-    const data = await IotProjectDailyReportApi.getIotProjectDailyReportPage(query.value as any)
+    const data = await FiveIotProjectDailyReportApi.getIotProjectDailyReportPage(query.value as any)
     list.value = data.list ?? []
     total.value = data.total ?? 0
   } finally {
@@ -87,19 +90,16 @@ onMounted(() => {
 
 <template>
   <div
-    class="grid grid-cols-[auto_1fr] grid-rows-[62px_1fr] gap-4 h-[calc(100vh-20px-var(--top-tool-height)-var(--tags-view-height)-var(--app-footer-height))]"
-  >
+    class="grid grid-cols-[auto_1fr] grid-rows-[62px_1fr] gap-4 h-[calc(100vh-20px-var(--top-tool-height)-var(--tags-view-height)-var(--app-footer-height))]">
     <DeptTreeSelect
       v-model="query.deptId"
       :top-id="158"
       :deptId="deptId"
       :show-title="false"
-      class="row-span-2"
-    />
+      class="row-span-2" />
     <el-form
       size="default"
-      class="bg-white dark:bg-[#1d1e1f] rounded-lg shadow px-8 gap-8 flex items-center justify-between"
-    >
+      class="bg-white dark:bg-[#1d1e1f] rounded-lg shadow px-8 gap-8 flex items-center justify-between">
       <div class="flex items-center gap-8">
         <el-form-item label="项目">
           <el-input
@@ -107,8 +107,7 @@ onMounted(() => {
             placeholder="请输入项目名称"
             clearable
             @keyup.enter="handleQuery()"
-            class="!w-240px"
-          />
+            class="!w-240px" />
         </el-form-item>
         <el-form-item label="生产任务">
           <el-input
@@ -116,8 +115,7 @@ onMounted(() => {
             placeholder="请输入生产任务"
             clearable
             @keyup.enter="handleQuery()"
-            class="!w-240px"
-          />
+            class="!w-240px" />
         </el-form-item>
         <el-form-item label="创建时间">
           <el-date-picker
@@ -128,17 +126,14 @@ onMounted(() => {
             end-placeholder="结束日期"
             :shortcuts="rangeShortcuts"
             :default-time="[new Date('1 00:00:00'), new Date('1 23:59:59')]"
-            class="!w-260px"
-          />
+            class="!w-260px" />
         </el-form-item>
       </div>
       <el-form-item>
         <el-button type="primary" @click="handleQuery()">
           <Icon icon="ep:search" class="mr-5px" /> 搜索
         </el-button>
-        <el-button @click="resetQuery">
-          <Icon icon="ep:refresh" class="mr-5px" /> 重置
-        </el-button>
+        <el-button @click="resetQuery"> <Icon icon="ep:refresh" class="mr-5px" /> 重置 </el-button>
       </el-form-item>
     </el-form>
 
@@ -149,15 +144,13 @@ onMounted(() => {
       :page-no="query.pageNo"
       :page-size="query.pageSize"
       @size-change="handleSizeChange"
-      @current-change="handleCurrentChange"
-    >
+      @current-change="handleCurrentChange">
       <template #action="{ row }">
         <el-button
           link
           type="success"
           @click="handleOpenForm(row.id!, 'readonly')"
-          v-hasPermi="['rq:iot-project-daily-report:query']"
-        >
+          v-hasPermi="['pms:iot-five-daily-report:query']">
           查看
         </el-button>
         <el-button
@@ -165,19 +158,14 @@ onMounted(() => {
           link
           type="primary"
           @click="handleOpenForm(row.id!, 'edit')"
-          v-hasPermi="['rq:iot-project-daily-report:update']"
-        >
+          v-hasPermi="['pms:iot-five-daily-report:update']">
           编辑
         </el-button>
       </template>
     </ConstructionDailyReportTable>
   </div>
 
-  <ConstructionDailyReportDrawer
-    ref="formRef"
-    v-model:visible="visible"
-    :load-list="loadList"
-  />
+  <ConstructionDailyReportDrawer ref="formRef" v-model:visible="visible" :load-list="loadList" />
 </template>
 
 <style scoped>