Răsfoiți Sursa

接口调试

duy 1 an în urmă
părinte
comite
7b160ae1f7

+ 32 - 0
src/api/modules/agree/land.js

@@ -47,4 +47,36 @@ export default {
             params: form,
         }, msg)
     },
+    //分页查询补偿协议
+    async getPage(form, msg = true) {
+        return httpApi({
+            url: '/api/blade-land/compensationInfo/page',
+            method: 'get',
+            params: form,
+        }, msg)
+    },
+    //多表预览
+    async getBussPdfs(form, msg = true) {
+        return httpApi({
+            url: '/api/blade-land/compensationInfo/get-buss-pdfs',
+            method: 'get',
+            params: form,
+        }, msg)
+    },
+    //删除协议
+    async remove(form, msg = true) {
+        return httpApi({
+            url: '/api/blade-land/compensationInfo/remove',
+            method: 'post',
+            data: form,
+        }, msg)
+    },
+    //表单复制blade-land/compensationInfo/cope-tab
+    async copeTab(form, msg = true) {
+        return httpApi({
+            url: '/api/blade-land/compensationInfo/cope-tab',
+            method: 'post',
+            data: form,
+        }, msg)
+    },
 }

+ 13 - 40
src/views/agree/land/collapse-form/index.vue

@@ -688,24 +688,24 @@ const copySaveClick = async ()=>{
 const copyClickModalLoading = ref(false)
 const copyClickLoading = ref(false)
 const copyClick = async (items) => {
-    const { pkeyId, isTableRender, isTableForm } = items
-    if (pkeyId) {
+    const { id, isTableRender, isTableForm } = items
+    if (id) {
         if (isStatus.value !== 3) {
             if (!isTableRender) {
-                await copeBussTab(pkeyId)
+                await copeBussTab(id)
             } else if (!isTableForm) {
                 window?.$message?.warning('暂无表单数据')
             } else if (isTableRender) {
                 copyClickLoading.value = true
                 const isSave = await saveExcelBussData(items, null, false)
                 if (isSave) {
-                    await copeBussTab(pkeyId)
+                    await copeBussTab(id)
                 } else {
                     copyClickLoading.value = false
                     window?.$message?.warning('复制本表操作失败')
                 }
             } else {
-                window?.$message?.warning(`数据异常了, isRenderTableForm: ${isTableRender}, isTableForm: ${isTableForm}, pkeyIds:${pkeyId}`)
+                window?.$message?.warning(`数据异常了, isRenderTableForm: ${isTableRender}, isTableForm: ${isTableForm}, pkeyIds:${id}`)
             }
         } else {
             window?.$message?.warning('已上报的资料,不允许复制')
@@ -725,8 +725,8 @@ const copyItems = ref([])
 //复制表的请求
 const copeBussTab = async (pkeyId) => {
     copyClickLoading.value = true
-    const { error, code } = await wbsApi.copeBussTab({
-        pkeyId: pkeyId,
+    const { error, code } = await landApi.copeTab({
+        id: pkeyId,
     })
     copyClickLoading.value = false
     if (!error && code === 200) {
@@ -735,33 +735,6 @@ const copeBussTab = async (pkeyId) => {
     }
 }
 
-//隐藏本表
-const tableFormHideLoading = ref(false)
-const hideClick = async ({ pkeyId, isBussShow }) => {
-    if (pkeyId) {
-        if (isStatus.value !== 3) {
-            tableFormHideLoading.value = true
-            const bussShow = isBussShow === 2 ? 1 : 2 //状态(1显示 2隐藏)
-            const { error, code } = await wbsApi.showBussTab({
-                pkeyId: pkeyId,
-                status: bussShow,
-            })
-            tableFormHideLoading.value = false
-            if (!error && code === 200) {
-                window?.$message?.success('操作成功')
-                if (bussShow === 2) {
-                    //判断是否存在窗口,如果存在,就删除窗口
-                    delWindowRefs(pkeyId)
-                }
-                renewData()
-            }
-        } else {
-            window?.$message?.warning('已上报的资料,不允许隐藏')
-        }
-    } else {
-        window?.$message?.warning('pkeyId为空')
-    }
-}
 
 //预览本表
 const tableFormPreviewLoading = ref(false)
@@ -850,13 +823,13 @@ const tableFormSaveClick = async (item, dragItem = null) => {
 }
 
 //保存表单数据
-const saveExcelBussData = async ({ pkeyId }, dragItem = null, showTip = true) => {
+const saveExcelBussData = async ({ id }, dragItem = null, showTip = true) => {
     setDragModalLoading(dragItem, '保存中...', true)
-    const refs = await getFormRef(pkeyId)
+    const refs = await getFormRef(id)
     const isRegExp = await refs?.isFormRegExp()
     if (isRegExp) {
         const formData = refs?.getFormData()
-        const { error, code } = await wbsApi.saveExcelBussData(formData)
+        const { error, code } = await landApi.saveBussData(formData)
         setDragModalLoading(dragItem)
         if (!error && code === 200) {
             if (showTip) {
@@ -873,10 +846,10 @@ const saveExcelBussData = async ({ pkeyId }, dragItem = null, showTip = true) =>
 }
 
 //预览PDF
-const getBussPdfInfo = async ({ pkeyId }, dragItem = null, showTip = true) => {
+const getBussPdfInfo = async ({ id }, dragItem = null, showTip = true) => {
     setDragModalLoading(dragItem, '获取pdf中...', true)
-    const { error, code, data } = await wbsApi.getBussPdfInfo({
-        pkeyId: pkeyId,
+    const { error, code, data } = await landApi.getBussPdfInfo({
+        id: id,
     }, false)
     setDragModalLoading(dragItem)
     if (!error && code === 200) {

+ 19 - 10
src/views/agree/land/form.vue

@@ -24,7 +24,7 @@
                 <HcIcon name="draft" />
                 <span>一键生成协议</span>
             </el-button>
-            <el-button size="large" type="warning" hc-btn>
+            <el-button size="large" type="warning" hc-btn :loading="bussPdfsLoading" @click="bussPdfsClick">
                 <HcIcon name="eye" />
                 <span>预览</span>
             </el-button>
@@ -64,7 +64,7 @@ onActivated(() => {
     agreementId.value = useRoutes?.query?.id ?? ''
     areaId.value = useRoutes?.query?.areaId ?? ''
     if (agreementId.value.length > 0) {
-        updateGetTablesData()
+        updateGetTablesData( agreementId.value)
     } else {
         searchNodeAllTable()
     }
@@ -126,12 +126,8 @@ const tableFormSaveClick = async () => {
     let FormData = []
         FormData = await ListItemRef.value?.getFormData()
     //效验数据
-    console.log( FormData, ' FormData')
-
     if (FormData.length > 0) {
-        console.log('保存')
         tableFormSaveLoading.value = true
-        console.log('FormData', FormData)
         FormData.forEach(ele => {
             delete ele['pkeyId']
         })
@@ -141,17 +137,30 @@ const tableFormSaveClick = async () => {
         tableFormSaveLoading.value = false
         if (!error && code === 200) {
             window?.$message?.success('保存成功')
-            // dataId.value = data
             dataType.value = 2
-             // await bussPdfsClick()
-            updateGetTablesData()
-            // goBackClick()
+             await bussPdfsClick()
+             updateGetTablesData(agreementId.value)
         }
     } else {
         console.log('预览')
         // await bussPdfsClick()
     }
 }
+//多表预览
+const bussPdfsLoading = ref(false)
+const bussPdfsClick = async () => {
+    bussPdfsLoading.value = true
+    const { error, code, data } = await landApi.getBussPdfs({
+        agreementId:agreementId.value,
+    })
+    tableFormSaveLoading.value = false
+    bussPdfsLoading.value = false
+    if (!error && code === 200) {
+        window.open(data, '_blank')
+    } else {
+        window.$message?.warning('获取PDF失败')
+    }
+}
 </script>
 
 <style lang="scss" scoped>

+ 55 - 27
src/views/agree/land/land.vue

@@ -10,7 +10,7 @@
         <HcCard>
             <template #header>
                 <div class="w-52">
-                    <el-input v-model="searchForm.queryValue" clearable placeholder="请输入名称进行查询" size="large" />
+                    <el-input v-model="searchForm.name" clearable placeholder="请输入名称进行查询" size="large" />
                 </div>
                 <div class="ml-4">
                     <el-button type="primary" size="large" @click="searchClick">
@@ -38,10 +38,10 @@
                     <el-button size="small" type="primary" @click="editRowClick(row)">
                         修改
                     </el-button>
-                    <el-button size="small" type="warning">
+                    <el-button size="small" type="warning" @click="viewPdf(row)">
                         查看
                     </el-button>
-                    <el-button size="small" type="danger">
+                    <el-button size="small" type="danger" @click="delAgree(row)">
                         删除
                     </el-button>
                 </template>
@@ -59,6 +59,7 @@ import { useRouter } from 'vue-router'
 import landApi from '~api/agree/land.js'
 import { useAppStore } from '~src/store'
 import { getArrValue } from 'js-fast-way'
+import { delMessageV2 } from '~com/message/index.js'
 const useAppState = useAppStore()
 const projectId = ref(useAppState.getProjectId)
 const router = useRouter()
@@ -66,11 +67,13 @@ const areaId = ref('')
 //树节点被点击
 const treeNodeTap = ({ node, data }) => {
     areaId.value = data.id
+    searchForm.value.areaId = data.id
+    getTableData()
 }
 
 //搜索表单
 const searchForm = ref({
-    projectType: null, queryValue: null, startTime: null, endTime: null,
+    projectType: null, name: null, startTime: null, endTime: null,
     current: 1, size: 20, total: 0,
 })
 
@@ -90,34 +93,31 @@ const pageChange = ({ current, size }) => {
 //获取数据
 const tableLoading = ref(false)
 const tableColumn = [
-    { key: 'key1', name: '协议编号' },
-    { key: 'key2', name: '协议书名称' },
-    { key: 'key3', name: '地类补偿金额' },
-    { key: 'key4', name: '青苗及附着物补偿金额' },
-    { key: 'key5', name: '补偿总金额' },
+    { key: 'number', name: '协议编号' },
+    { key: 'name', name: '协议书名称' },
+    { key: 'landMoney', name: '地类补偿金额' },
+    { key: 'cropsMoney', name: '青苗及附着物补偿金额' },
+    { key: 'allMoney', name: '补偿总金额' },
     { key: 'action', name: '操作', width: '190', align: 'center' },
 ]
 const tableData = ref([
-    { id: 1, key1: 'xxxx', key2: 'xxxx', key3: '65632' },
-    { id: 2, key1: 'xxxx', key2: 'xxxx', key3: '65632' },
-    { id: 3, key1: 'xxxx', key2: 'xxxx', key3: '65632' },
-    { id: 4, key1: 'xxxx', key2: 'xxxx', key3: '65632' },
+
 ])
 const getTableData = async () => {
-    // tableLoading.value = true
-    // const { error, code, data } = await landApi.getPage({
-    //     ...searchForm.value,
-    //     projectId: projectId.value,
-    //     type:1,
-    // })
-    // tableLoading.value = false
-    // if (!error && code === 200) {
-    //     tableData.value = getArrValue(data['records'])
-    //     searchForm.value.total = data['total'] || 0
-    // } else {
-    //     tableData.value = []
-    //     searchForm.value.total = 0
-    // }
+    tableLoading.value = true
+    const { error, code, data } = await landApi.getPage({
+        ...searchForm.value,
+        projectId: projectId.value,
+        type:1,
+    })
+    tableLoading.value = false
+    if (!error && code === 200) {
+        tableData.value = getArrValue(data['records'])
+        searchForm.value.total = data['total'] || 0
+    } else {
+        tableData.value = []
+        searchForm.value.total = 0
+    }
 }
 
 //多选事件
@@ -147,6 +147,34 @@ const editRowClick = (row) => {
         },
     })
 }
+//查看pdf
+const viewPdf = ({ mergePdfUrl }) => {
+    if (mergePdfUrl) {
+        window.open(mergePdfUrl, '_blank')
+    } else {
+        window.$message.error('暂无文件')
+    }
+}
+const delAgree = (row)=>{
+    delMessageV2(async (action, instance, done) => {
+            if (action === 'confirm') {
+                instance.confirmButtonLoading = true
+                const { error, code, msg } = await landApi.remove({
+                            ids: row?.id,
+                        })
+                        if (!error && code === 200) {
+                            window?.$message?.success('删除成功')
+                            getTableData()
+                        } else {
+                            window?.$message?.warning(msg)
+                        }
+                instance.confirmButtonLoading = false
+                done()
+            } else {
+                done()
+            }
+     })
+}
 </script>
 
 <style lang="scss" scoped>