Преглед изворни кода

修改收据删除功能,修改表格显示字段

丁烨烨 пре 6 месеци
родитељ
комит
02a628adeb
5 измењених фајлова са 171 додато и 19 уклоњено
  1. 0 9
      components.d.ts
  2. 6 3
      src/stores/permissionStore.ts
  3. 79 1
      src/views/zf/fwxq.vue
  4. 83 2
      src/views/zfgl/zfhtgl.vue
  5. 3 4
      src/views/zfgl/zfsjgl.vue

+ 0 - 9
components.d.ts

@@ -8,30 +8,21 @@ export {}
 /* prettier-ignore */
 declare module 'vue' {
   export interface GlobalComponents {
-    ElBadge: typeof import('element-plus/es')['ElBadge']
     ElButton: typeof import('element-plus/es')['ElButton']
-    ElCheckbox: typeof import('element-plus/es')['ElCheckbox']
     ElContainer: typeof import('element-plus/es')['ElContainer']
     ElDatePicker: typeof import('element-plus/es')['ElDatePicker']
     ElDialog: typeof import('element-plus/es')['ElDialog']
     ElForm: typeof import('element-plus/es')['ElForm']
     ElFormItem: typeof import('element-plus/es')['ElFormItem']
     ElHeader: typeof import('element-plus/es')['ElHeader']
-    ElIcon: typeof import('element-plus/es')['ElIcon']
     ElInput: typeof import('element-plus/es')['ElInput']
     ElInputNumber: typeof import('element-plus/es')['ElInputNumber']
     ElMain: typeof import('element-plus/es')['ElMain']
-    ElMenu: typeof import('element-plus/es')['ElMenu']
-    ElMenuItem: typeof import('element-plus/es')['ElMenuItem']
     ElOption: typeof import('element-plus/es')['ElOption']
     ElPagination: typeof import('element-plus/es')['ElPagination']
     ElSelect: typeof import('element-plus/es')['ElSelect']
-    ElSubMenu: typeof import('element-plus/es')['ElSubMenu']
     ElTable: typeof import('element-plus/es')['ElTable']
     ElTableColumn: typeof import('element-plus/es')['ElTableColumn']
-    ElTabPane: typeof import('element-plus/es')['ElTabPane']
-    ElTabs: typeof import('element-plus/es')['ElTabs']
-    ElTag: typeof import('element-plus/es')['ElTag']
     ElUpload: typeof import('element-plus/es')['ElUpload']
     IconCommunity: typeof import('./src/components/icons/IconCommunity.vue')['default']
     IconDocumentation: typeof import('./src/components/icons/IconDocumentation.vue')['default']

+ 6 - 3
src/stores/permissionStore.ts

@@ -19,9 +19,10 @@ export const usePermissionStore = defineStore('permission', () => {
   const search = window.location.search // 获取"?appToken=xxx&appId=xxx"
   const params = new URLSearchParams(search)
   const getUserPermission = async () => {
-    if (!params.get('appId') || !params.get('appToken')) {
-      return
-    }
+
+    // if (!params.get('appId') || !params.get('appToken')) {
+    //   return
+    // }
     const res = await clientPost<null, PermissionReponse>(
       '/userPermissions/queryUserPermissions',
       null,
@@ -32,6 +33,8 @@ export const usePermissionStore = defineStore('permission', () => {
         },
       },
     )
+
+    console.log(11111,res)
     if (res.code !== 200) {
       ElMessage.error(res.msg)
       return

+ 79 - 1
src/views/zf/fwxq.vue

@@ -21,7 +21,19 @@ import {
   ElSteps,
   ElTag,
 } from 'element-plus'
-import { ArrowLeft, Cpu, Eye, FileText, Home, MapPin, Plus, User, X } from 'lucide-vue-next'
+import {
+  ArrowLeft,
+  Cpu,
+  Eye,
+  FileText,
+  Home,
+  MapPin,
+  Plus,
+  User,
+  X,
+  BookText,
+  Download
+} from 'lucide-vue-next'
 import { useRoute, useRouter } from 'vue-router'
 import { clientGet, clientPost } from '@/utils/request.ts'
 // 导入docx-preview库
@@ -54,6 +66,8 @@ const propertyInfo = ref({
   assetType: '', //公租房|厂房|创新创业基地
 })
 
+const receiptData = ref({})
+
 const basicInfo = ref({
   buildYear: '',
   orientation: '',
@@ -497,6 +511,10 @@ interface HouseInfoResponse extends BaseResponse {
   data: HouseInfoVo
 }
 
+interface AReceiptInfoResponse extends BaseResponse {
+  data: PageType<AReceiptInfo>
+}
+
 interface TenantInfo {
   tenantName: string | null
   tenantNumber: string | null
@@ -883,6 +901,39 @@ const confirmTerminate = async () => {
   }
 }
 
+const getReceiptData = async (contractNumber) => {
+  loading.value = true
+  try {
+    const res = await clientGet<
+      {
+        receiptNumber: string
+        payer: string
+        paymentMethod: string
+        contractNumber: string
+      },
+      AReceiptInfoResponse
+    >('/AReceiptInfo//findByPageWithContract', {
+      params: {
+        pageNum: 1,
+        pageSize: 10000,
+        contractNumber: contractNumber,
+      },
+    })
+
+    if (res.code !== 200) {
+      ElMessage.error(res.msg)
+      return
+    }
+    receiptData.value = res.data.records || {}
+
+  } catch (error) {
+    console.error(error)
+    ElMessage.error('获取数据失败')
+  } finally {
+    loading.value = false
+  }
+}
+
 const getData = async () => {
   try {
     loading.value = true
@@ -901,6 +952,9 @@ const getData = async () => {
       return
     }
     const data = res.data
+    // 新增:获取收据信息
+    await getReceiptData(data.contractInfo?.contractNumber || '')
+
     console.log('接口返回数据:', data)
 
     propertyInfo.value = {
@@ -1182,6 +1236,7 @@ onMounted(() => {
               </el-col>
             </el-row>
           </el-card>
+
           <el-card class="mb-6 shadow-lg rounded-2xl border-0">
             <template #header>
               <div class="flex items-center">
@@ -1350,6 +1405,29 @@ onMounted(() => {
               </el-col>
             </el-row>
           </el-card>
+          <el-card
+            v-if="propertyInfo.status === '已租' && tenantInfo"
+            class="mb-6 shadow-lg rounded-2xl border-0"
+          >
+            <template #header>
+              <div class="flex items-center">
+                <el-icon class="mr-2 text-blue-500"><BookText /></el-icon>
+                <span class="text-lg font-semibold">收据信息</span>
+              </div>
+            </template>
+            <el-table
+              :data="receiptData"
+              v-loading="loading"
+              stripe
+              class="w-full"
+            >
+              <el-table-column type="index" label="序号" min-width="80" />
+              <el-table-column prop="startDate" label="开始时间" min-width="80" />
+              <el-table-column prop="endDate" label="结束时间" min-width="80" />
+              <el-table-column prop="receiptReason" label="收款事由" />
+            </el-table>
+          </el-card>
+
           <div class="flex justify-center gap-4">
             <el-button
               v-if="propertyInfo.status === '空闲'"

+ 83 - 2
src/views/zfgl/zfhtgl.vue

@@ -21,7 +21,7 @@ import {
   ElUpload,
 } from 'element-plus'
 import {
-  AlertCircle,
+  AlertCircle, Delete,
   Download,
   Eye,
   FileText,
@@ -50,12 +50,20 @@ export interface AContractInfo {
   signContractUrl: string
   createTime: string
   updateTime: string
+  houseName: string
+  floor: string
+  building: string
+  assetType: string
 }
 
 interface AContractInfoListResponse extends BaseResponse {
   data: PageType<AContractInfo>
 }
 
+interface HouseInfoResponse extends BaseResponse {
+
+}
+
 interface CanBeReceiptDataReponse extends BaseResponse {
   data: {
     zj: number //租金
@@ -292,6 +300,13 @@ const getList = async () => {
       },
     })
     if (response.code === 200 && response.data) {
+      for (const item of response.data.records) {
+        const roomDetails = await getRoomDetailsData(item.simplifiedHouseId);
+        item.houseName = roomDetails.houseName ;
+        item.floor = roomDetails.floor;
+        item.building = roomDetails.building;
+        item.assetType = roomDetails.assetType;
+      }
       tableData.value = response.data.records
       total.value = response.data.total
       currentPage.value = response.data.current || 1
@@ -306,6 +321,35 @@ const getList = async () => {
   }
 }
 
+
+const getRoomDetailsData = async (simplifiedHouseId: any) => {
+  try {
+    loading.value = true
+    const res = await clientGet<
+      HouseInfoResponse
+    >('/asimplifiedHouseInfo/getById/' + simplifiedHouseId, {
+    })
+    if (res.code !== 200) {
+      ElMessage.error(res.msg)
+      return
+    }
+    if (!res.data) {
+      return {
+        houseName: '/',
+        floor: '/',
+        building: '/',
+        assetType: '/',
+      }
+    }
+    return res.data;
+  } catch (error) {
+    console.error('获取房屋详情失败:', error)
+    ElMessage.error('获取房屋详情失败')
+  } finally {
+    loading.value = false
+  }
+}
+
 // 搜索
 const handleSearch = () => {
   currentPage.value = 1
@@ -624,6 +668,7 @@ const getCanBeReceiptData = async (contractId: string) => {
 
 // 获取收据
 const gainReceipt = async (contractId: string, dto: ReceiptDto) => {
+  console.log(111,dto)
   const convertReceiptDtoForBackend = (dto: ReceiptDto): any => {
     return {
       ...dto,
@@ -645,6 +690,8 @@ const gainReceipt = async (contractId: string, dto: ReceiptDto) => {
 
 // 打开收据对话框
 const openReceiptDialog = async (contractId: string, contractNumber: string) => {
+  console.log(2222,userInfo.value?.personName)
+
   currentReceiptContractId.value = contractId
   currentReceiptContractNumber.value = contractNumber
   receiptVisible.value = true
@@ -661,7 +708,7 @@ const openReceiptDialog = async (contractId: string, contractNumber: string) =>
     sf: 0,
     paymentReason: ['房屋租赁费用', '押金'],
     rzrq: '',
-    operator: '',
+    operator: userInfo.value?.personName,
     startDate: '',
     endDate: '',
   })
@@ -744,6 +791,7 @@ watch(
 
 // 生成收据
 const generateReceipt = async () => {
+
   // 使用 Element Plus 表单验证
   if (!receiptFormRef.value) return
 
@@ -909,6 +957,32 @@ const openReturnReceiptDialog = async (contractId: string, contractNumber: strin
   }
 }
 
+const handleDelete = async (row: AContractInfo) => {
+  try {
+    await ElMessageBox.confirm('确定要删除这条记录吗?', '提示', {
+      confirmButtonText: '确定',
+      cancelButtonText: '取消',
+      type: 'warning',
+    })
+    const success = await deleteBatchRentingHouse([row.id])
+    if (success) {
+      getList()
+    }
+  } catch {
+    // 用户取消删除
+  }
+}
+
+const deleteBatchRentingHouse = async (ids: string[]) => {
+  const res = await clientPost<string[], BaseResponse>('/acontractInfo/deleteBatch', ids)
+  if (res.code !== 200) {
+    ElMessage.error(res.msg)
+    return false
+  }
+  ElMessage.success(res.msg)
+  return true
+}
+
 // 计算退据总金额
 const calculateReturnTotalAmount = () => {
   returnReceiptForm.rmb = returnReceiptForm.yj + returnReceiptForm.zj + returnReceiptForm.wyf
@@ -1061,6 +1135,10 @@ onMounted(() => {
         class="rounded-lg overflow-hidden"
       >
         <ElTableColumn prop="contractNumber" label="合同编号" width="160" />
+        <ElTableColumn prop="building" label="楼栋"/>
+        <ElTableColumn prop="floor" label="楼层"/>
+        <ElTableColumn prop="houseName" label="房间名称"/>
+        <ElTableColumn prop="assetType" label="房屋类型"/>
         <ElTableColumn prop="contractDate" label="签约日期" width="140" />
         <ElTableColumn prop="contractTime" label="合同期限" width="120" />
         <ElTableColumn prop="contractExpirationDate" label="到期日期" width="140" />
@@ -1179,6 +1257,9 @@ onMounted(() => {
                 >
                   获取退据
                 </ElButton>
+                <el-button type="danger" size="small" @click="handleDelete(row)" :icon="Delete">
+                  删除
+                </el-button>
               </div>
             </div>
           </template>

+ 3 - 4
src/views/zfgl/zfsjgl.vue

@@ -321,7 +321,9 @@ onMounted(() => {
 
           <el-table-column prop="receiptNumber" label="收据单号" width="180" />
 
-          <el-table-column prop="payer" label="交款单位" min-width="150" />
+          <el-table-column prop="payer" label="交款单位" min-width="80" />
+
+          <el-table-column prop="contactNumber" label="合同编号" min-width="150" />
 
           <el-table-column prop="paymentMethod" label="收款方式" width="100" />
 
@@ -370,9 +372,6 @@ onMounted(() => {
               {{ formatDate(row.generationDate) }}
             </template>
           </el-table-column>
-
-          <el-table-column prop="contactNumber" label="合同编号" min-width="150" />
-
           <el-table-column label="操作" width="120" fixed="right">
             <template #default="{ row }">
               <el-button