소스 검색

feat(ledger): 增加按月封装功能

duy 2 달 전
부모
커밋
bd154d3c80
2개의 변경된 파일112개의 추가작업 그리고 12개의 파일을 삭제
  1. 24 0
      src/api/modules/ledger/query.js
  2. 88 12
      src/views/ledger/components/table-list.vue

+ 24 - 0
src/api/modules/ledger/query.js

@@ -184,4 +184,28 @@ export default {
             data: form,
         })
     },
+    //按月封装
+    async byMonthPack(form) {
+        return HcApi({
+            url: '/api/blade-business/contractLog/byMonthPack',
+            method: 'post',
+            data: form,
+        })
+    },
+    //
+    //查询按月封装
+    async selectByMonthPack(form) {
+        return HcApi({
+            url: '/api/blade-business/contractLog/selectByMonthPack',
+            method: 'post',
+            data: form,
+        })
+    },
+    async deleteByMonthPack(form) {
+        return HcApi({
+            url: '/api/blade-business/contractLog/deleteByMonthPack',
+            method: 'get',
+            params: form,
+        })
+    },
 }

+ 88 - 12
src/views/ledger/components/table-list.vue

@@ -90,7 +90,7 @@
                 <template #action="{ row }">
                     <HcTooltip keys="ledger_query_table_query">
                         <el-button plain size="small" type="primary" @click="handleTableQuery(row)">
-                            查
+                            查
                         </el-button>
                     </HcTooltip>
                     <HcTooltip keys="ledger_query_table_del">
@@ -124,13 +124,13 @@
                 :loading="tableLoadingMonth"
                 is-new
                 :index-style="{ width: 60 }"
-                is-check
             >
                 <template #action="{ row }">
-                    <el-button plain size="small" type="primary">
+                    <el-button plain size="small" type="primary" @click="handleTableQueryMonth(row)">
                         查看
                     </el-button>
                     <el-button
+                        v-del-com:[delItemFun]="row"
                         plain
                         size="small"
                         type="danger"
@@ -681,6 +681,7 @@ const moreSMenuClick = (item) => {
 
 const byMonth = () => { 
     byMonthModal.value = true
+     
 
 }
 const byMonthModal = ref(false)
@@ -688,26 +689,49 @@ const byMonthModalLoading = ref(false)
 const byMonthModalClose = () => {
     byMonthModal.value = false
     byMonthModalLoading.value = false
+    monthCheckVal.value = []
 }
 const monthCheckVal = ref([])
-const byMonthModalSave = () => {
-
+const byMonthModalSave = async () => {
+    const { primaryKeyId } = menuItem.value
     if (monthCheckVal.value.length !== 2) {
         window.$message?.warning('请选择开始和结束月份')
         return
     }
-    
+    const startTimeAndEndTimes = [{
+        startTime: monthCheckVal.value[0],
+        endTime: monthCheckVal.value[1],
+    }]
+    byMonthModalLoading.value = true
+    const { error, code, msg } = await queryApi.byMonthPack({
+      startTimeAndEndTimes: startTimeAndEndTimes,
+      wbsNodeId:primaryKeyId,
+      contractId: contractId.value,
+      projectId: projectId.value,
+    })
+    //处理数据
+    byMonthModalLoading.value = false
+
+    if (!error && code === 200) {
+        window.$message?.success(msg ?? '操作成功')
+      byMonthModalClose()
+        getTableData().then()
+
+    } else {
+        window.$message?.error(msg ?? '操作失败')
+    }
 }
 
 const monthList = () => { 
     listShow.value = false
+       getTableDataMonth().then()
 }
 const tableListColumnMonth = ref([
-    { key: 'key1', name: '文件名称' },
-    { key: 'key2', name: '日期' },
-    { key: 'key3', name: '责任者' },
-    { key: 'key4', name: '页数' },
-    { key: 'action', name: '操作', width: 200 },
+    { key: 'fileName', name: '文件名称' },
+    { key: 'recordTime', name: '日期' },
+    { key: 'contractName', name: '责任者' },
+    { key: 'page', name: '页数', width: 80 },
+    { key: 'action', name: '操作', width: 120 },
 ])
 const tableListDataMonth = ref([])
 const tableLoadingMonth = ref(false)
@@ -722,7 +746,59 @@ const searchFormMonth = ref({
 const pageChangeMonth = ({ current, size }) => {
     searchFormMonth.value.current = current
     searchFormMonth.value.size = size
-    // getTableDataMonth()
+    getTableDataMonth()
+}
+const getTableDataMonth = async () => {
+    //初始数据处理
+    tableLoadingMonth.value = true
+    const { primaryKeyId } = menuItem.value
+   
+  
+    //请求数据
+    const { error, code, data } = await queryApi.selectByMonthPack({
+        ...searchFormMonth.value,
+        wbsNodeId: primaryKeyId,
+        projectId: projectId.value,
+        contractId: contractId.value,
+    })
+    console.log(data)
+    //处理数据
+    tableLoadingMonth.value = false
+    if (!error && code === 200) {
+        tableListDataMonth.value = getArrValue(data['records'])
+        searchFormMonth.value.total = data.total || 0
+    } else {
+        tableListDataMonth.value = []
+        searchFormMonth.value.total = 0
+    }
+}
+//查询
+const handleTableQueryMonth = ({ pdfUrl }) => {
+   if (!pdfUrl) {
+    window.$message?.warning('文件不存在')
+    return
+   }
+    toPdfPage(pdfUrl)
+}
+const delItemFun = async ({ item }, resolve) => {
+    const { id } = item
+    //这里可以写一些操作
+  await theLogRemoveByIdsMonth(id)
+    resolve() //这个一定要存在,否则不会关闭弹窗
+}
+//删除
+
+const theLogRemoveByIdsMonth = async (id) => {
+
+    const { error, code, msg } = await queryApi.deleteByMonthPack({
+        id: id,
+    })
+    deleteLoading.value = false
+    if (!error && code === 200) {
+        window.$message?.success(msg || '操作成功')
+       
+        getTableDataMonth()
+    }
 }
 </script>