Przeglądaj źródła

Merge branch 'master' of http://47.107.245.0:3000/xiongxing/kyj-yanglao-web-new

unknown 2 tygodni temu
rodzic
commit
e47817ee6c

+ 8 - 0
src/api/elderly/fee/balance/index.ts

@@ -8,6 +8,14 @@ export const getBalancePage = (query) => {
   })
 }
 
+// 导出 Excel
+export const exportBalanceExcel = (params) => {
+  return request.download({
+    url: '/elderly/balance/exportExcel',
+    params
+  })
+}
+
 // 获取详情
 export const getBalanceDetail = (id) => {
   return request.get({

+ 2 - 2
src/views/elderly/elder/outward-registration/index.vue

@@ -105,7 +105,7 @@
         <template #default="scope">
           <el-button
             link
-            v-if="scope.row.updateDate === undefined || scope.row.updateDate === null"
+            v-if="scope.row.updateDate === undefined || scope.row.updateDate === null || scope.row.leaveStatus != 0"
             type="primary"
             @click="openReturnHospitalFormRef(scope.row, scope.row.id, false)"
             v-hasPermi="['bak:check-out:kinin']"
@@ -121,10 +121,10 @@
           >
             详情
           </el-button>
+          <!-- v-if="scope.row.updateDate === undefined || scope.row.updateDate === null" -->
           <el-button
             link
             type="danger"
-            v-if="scope.row.updateDate === undefined || scope.row.updateDate === null"
             @click="cancelDelete(scope.row.id)"
             v-hasPermi="['bak:check-out:cancel']"
           >

+ 41 - 2
src/views/elderly/fee/balance/index.vue

@@ -27,13 +27,16 @@
       <el-form-item>
         <el-button @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 v-hasPermi="['balance:export']" type="warning" plain :loading="exportLoading" @click="handleExport">
+          <Icon icon="ep:download" class="mr-5px" /> 导出
+        </el-button>
       </el-form-item>
     </el-form>
   </ContentWrap>
 
   <!-- 列表 -->
   <ContentWrap>
-    <TabBarBtn />
+    <!-- <TabBarBtn /> -->
 
     <Table2
       v-loading="loading"
@@ -76,14 +79,17 @@
 </template>
 <script lang="ts" setup>
 import { DICT_TYPE, getStrDictOptions } from '@/utils/dict'
-import { getBalancePage } from '@/api/elderly/fee/balance'
+import download from '@/utils/download'
+import { exportBalanceExcel, getBalancePage } from '@/api/elderly/fee/balance'
 import { balanceColumn } from '../column'
 import Form from './Form.vue'
 defineOptions({ name: 'Balance' })
 
 const loading = ref(true) // 列表的加载中
+const exportLoading = ref(false) // 导出的加载中
 const total = ref(0) // 列表的总页数
 const list = ref([]) // 列表的数据
+const message = useMessage() // 消息弹窗
 const queryParams = reactive({
   pageNo: 1,
   pageSize: 10,
@@ -105,6 +111,39 @@ const getList = async () => {
   }
 }
 
+/** 导出参数 */
+const buildExportParams = () => {
+  return {
+    pageNo: 1,
+    pageSize: 99999,
+    elderName: queryParams.elderName || undefined,
+    bedName: queryParams.bedName || undefined,
+    inStatus: queryParams.status
+  }
+}
+
+/** 导出按钮操作 */
+const handleExport = async () => {
+  if (exportLoading.value) return
+  exportLoading.value = true
+  const fullscreenLoading = ElLoading.service({
+    lock: true,
+    text: '正在导出,请稍候...',
+    background: 'rgba(0, 0, 0, 0.7)'
+  })
+  try {
+    const data = await exportBalanceExcel(buildExportParams())
+    download.excel(data, '长者余额.xls')
+    message.success('导出成功')
+  } catch (error) {
+    console.error('导出失败:', error)
+    message.error('导出失败!')
+  } finally {
+    fullscreenLoading.close()
+    exportLoading.value = false
+  }
+}
+
 /** 搜索按钮操作 */
 const handleQuery = () => {
   queryParams.pageNo = 1

+ 19 - 3
src/views/elderly/fee/bill-pay/preview.vue

@@ -76,7 +76,7 @@
               </tr>
               <tr align="center">
                 <td>支付方式描述</td>
-                <td colspan="5">{{ payText }}</td>
+                <td colspan="5" class="pay-text-cell">{{ payText }}</td>
               </tr>
               <!-- <tr align="center">
                 <td>预缴金额</td>
@@ -202,6 +202,12 @@ const longTermAmount = ref(0)
 const payText = ref('')
 const roundDown = ref(0)
 
+const formatPayCreatedTime = (createdTime) => {
+  if (!createdTime) return ''
+  const timestamp = String(createdTime).length === 10 ? Number(createdTime) * 1000 : Number(createdTime)
+  return dayjs(timestamp).format('YYYY-MM-DD')
+}
+
 /** 打开弹窗 */
 const open = async (id, row) => {
   dialogVisible.value = true
@@ -243,8 +249,14 @@ const open = async (id, row) => {
   let insurance = 0
   res.payInfos.map((item) => {
     item.items.map((info) => {
-      payText.value +=
-        getDictLabel(DICT_TYPE.BILL_PAY_TYPE, info.payType) + ':' + info.payAmount + '元;'
+      const payLine =
+        getDictLabel(DICT_TYPE.BILL_PAY_TYPE, info.payType) +
+        ':' +
+        info.payAmount +
+        '元(支付时间:' +
+        formatPayCreatedTime(info.createdTime) +
+        ')'
+      payText.value += payText.value ? '\n' + payLine : payLine
     })
     num += formatDecimal(item.payAmount) as number
     insurance += item.insuranceAmount ? (formatDecimal(item.insuranceAmount) as number) : 0
@@ -741,4 +753,8 @@ const printTab2 = {
     }
   }
 }
+
+.pay-text-cell {
+  white-space: pre-line;
+}
 </style>