| ¶Ô±ÈÐÂÎļþ |
| | |
| | | <template> |
| | | <div class="app-container"> |
| | | <el-form :model="filters" :inline="true"> |
| | | <el-form-item label="忬¾äººå§å:"> |
| | | <el-input |
| | | v-model="filters.borrowerName" |
| | | placeholder="请è¾å
¥å款人å§å" |
| | | clearable |
| | | style="width: 200px;" |
| | | /> |
| | | </el-form-item> |
| | | <el-form-item label="忬¾æ¥æ:"> |
| | | <el-date-picker |
| | | v-model="filters.borrowDate" |
| | | value-format="YYYY-MM-DD" |
| | | format="YYYY-MM-DD" |
| | | type="daterange" |
| | | range-separator="è³" |
| | | start-placeholder="å¼å§æ¥æ" |
| | | end-placeholder="ç»ææ¥æ" |
| | | clearable |
| | | @change="changeDaterange" |
| | | /> |
| | | </el-form-item> |
| | | <el-form-item label="忬¾ç¶æ:"> |
| | | <el-select |
| | | v-model="filters.status" |
| | | placeholder="è¯·éæ©" |
| | | clearable |
| | | style="width: 200px;" |
| | | > |
| | | <el-option label="å¾
è¿æ¬¾" :value="1" /> |
| | | <el-option label="å·²è¿æ¬¾" :value="2" /> |
| | | </el-select> |
| | | </el-form-item> |
| | | <el-form-item> |
| | | <el-button type="primary" @click="getTableData">æç´¢</el-button> |
| | | <el-button @click="resetFilters">éç½®</el-button> |
| | | </el-form-item> |
| | | </el-form> |
| | | <div class="table_list"> |
| | | <div class="actions"> |
| | | <div></div> |
| | | <div> |
| | | <el-button type="primary" @click="add" icon="Plus"> æ°å¢ </el-button> |
| | | <el-button @click="handleOut" icon="download">导åº</el-button> |
| | | <el-button |
| | | type="danger" |
| | | icon="Delete" |
| | | :disabled="multipleList.length <= 0" |
| | | @click="deleteRow(multipleList.map((item) => item.id))" |
| | | > |
| | | æ¹éå é¤ |
| | | </el-button> |
| | | </div> |
| | | </div> |
| | | <PIMTable |
| | | rowKey="id" |
| | | isSelection |
| | | :column="columns" |
| | | :tableData="dataList" |
| | | :page="{ |
| | | current: pagination.currentPage, |
| | | size: pagination.pageSize, |
| | | total: pagination.total, |
| | | }" |
| | | @selection-change="handleSelectionChange" |
| | | @pagination="changePage" |
| | | > |
| | | <template #operation="{ row }"> |
| | | <el-button type="primary" link @click="edit(row)"> |
| | | ç¼è¾ |
| | | </el-button> |
| | | <el-button |
| | | :disabled="row.status !== 1" |
| | | type="primary" |
| | | link |
| | | @click="repay(row)" |
| | | > |
| | | è¿æ¬¾ |
| | | </el-button> |
| | | </template> |
| | | </PIMTable> |
| | | </div> |
| | | <Modal ref="modalRef" @success="getTableData"></Modal> |
| | | </div> |
| | | </template> |
| | | |
| | | <script setup> |
| | | import { usePaginationApi } from "@/hooks/usePaginationApi"; |
| | | import { listPage, delAccountLoan } from "@/api/financialManagement/loanManagement"; |
| | | import { onMounted, getCurrentInstance, ref, nextTick } from "vue"; |
| | | import Modal from "./Modal.vue"; |
| | | import { ElMessageBox, ElMessage } from "element-plus"; |
| | | import dayjs from "dayjs"; |
| | | |
| | | defineOptions({ |
| | | name: "忬¾ç®¡ç", |
| | | }); |
| | | |
| | | // è¡¨æ ¼å¤éæ¡éä¸é¡¹ |
| | | const multipleList = ref([]); |
| | | const { proxy } = getCurrentInstance(); |
| | | const modalRef = ref(); |
| | | |
| | | const { |
| | | filters, |
| | | columns, |
| | | dataList, |
| | | pagination, |
| | | getTableData, |
| | | resetFilters, |
| | | onCurrentChange, |
| | | } = usePaginationApi( |
| | | listPage, |
| | | { |
| | | borrowerName: undefined, |
| | | borrowDate: undefined, |
| | | status: undefined, |
| | | }, |
| | | [ |
| | | { |
| | | label: "忬¾äººå§å", |
| | | prop: "borrowerName", |
| | | }, |
| | | { |
| | | label: "忬¾éé¢ï¼å
ï¼", |
| | | prop: "borrowAmount", |
| | | formatData: (val) => { |
| | | return val ? `Â¥${parseFloat(val).toLocaleString('zh-CN', { minimumFractionDigits: 2, maximumFractionDigits: 2 })}` : 'Â¥0.00'; |
| | | }, |
| | | }, |
| | | { |
| | | label: "忬¾å©çï¼%ï¼", |
| | | prop: "interestRate", |
| | | formatData: (val) => { |
| | | return val ? `${parseFloat(val).toFixed(2)}%` : '-'; |
| | | }, |
| | | }, |
| | | { |
| | | label: "忬¾æ¥æ", |
| | | prop: "borrowDate", |
| | | }, |
| | | { |
| | | label: "å®é
è¿æ¬¾æ¥æ", |
| | | prop: "repayDate", |
| | | }, |
| | | { |
| | | label: "忬¾ç¶æ", |
| | | prop: "status", |
| | | dataType: "tag", |
| | | align: 'center', |
| | | formatData: (params) => { |
| | | if (params == 1) { |
| | | return "å¾
è¿æ¬¾"; |
| | | } else if (params == 2) { |
| | | return "å·²è¿æ¬¾"; |
| | | } |
| | | return null; |
| | | }, |
| | | formatType: (params) => { |
| | | if (params == 1) { |
| | | return "error"; |
| | | } else if (params == 2) { |
| | | return "success"; |
| | | } |
| | | return null; |
| | | }, |
| | | }, |
| | | { |
| | | fixed: "right", |
| | | label: "æä½", |
| | | dataType: "slot", |
| | | slot: "operation", |
| | | align: "center", |
| | | width: "120px", |
| | | }, |
| | | ], |
| | | null, |
| | | { |
| | | // å°åç«¯åæ¬¾æ¥æèå´è½¬æ¢ä¸ºå端éè¦ç entryDateStart / entryDateEndï¼å¹¶ä¸ä¸ä¼ borrowDate |
| | | borrowDate: (val) => { |
| | | if (val && val.length === 2) { |
| | | return { |
| | | entryDateStart: dayjs(val[0]).format("YYYY-MM-DD"), |
| | | entryDateEnd: dayjs(val[1]).format("YYYY-MM-DD"), |
| | | }; |
| | | } |
| | | return {}; |
| | | }, |
| | | } |
| | | ); |
| | | |
| | | // å¤éååä»ä¹ |
| | | const handleSelectionChange = (selectionList) => { |
| | | multipleList.value = selectionList; |
| | | }; |
| | | |
| | | const add = () => { |
| | | modalRef.value.openModal(); |
| | | }; |
| | | |
| | | const edit = (row) => { |
| | | modalRef.value.loadForm(row); |
| | | }; |
| | | |
| | | const repay = (row) => { |
| | | modalRef.value.repay(row); |
| | | }; |
| | | |
| | | const changePage = ({ page, limit }) => { |
| | | pagination.currentPage = page; |
| | | pagination.pageSize = limit; |
| | | onCurrentChange(page); |
| | | }; |
| | | |
| | | const deleteRow = (id) => { |
| | | ElMessageBox.confirm("æ¤æä½å°æ°¸ä¹
å é¤è¯¥æ°æ®, æ¯å¦ç»§ç»?", "æç¤º", { |
| | | confirmButtonText: "ç¡®å®", |
| | | cancelButtonText: "åæ¶", |
| | | type: "warning", |
| | | }).then(async () => { |
| | | const { code } = await delAccountLoan(id); |
| | | if (code == 200) { |
| | | ElMessage({ |
| | | type: "success", |
| | | message: "å 餿å", |
| | | }); |
| | | getTableData(); |
| | | } |
| | | }); |
| | | }; |
| | | |
| | | const changeDaterange = (value) => { |
| | | if (value) { |
| | | filters.borrowDate = value; |
| | | } else { |
| | | filters.borrowDate = null; |
| | | } |
| | | getTableData(); |
| | | }; |
| | | |
| | | const handleOut = () => { |
| | | ElMessageBox.confirm("éä¸çå
容å°è¢«å¯¼åºï¼æ¯å¦ç¡®è®¤å¯¼åºï¼", "导åº", { |
| | | confirmButtonText: "确认", |
| | | cancelButtonText: "åæ¶", |
| | | type: "warning", |
| | | }) |
| | | .then(() => { |
| | | proxy.download(`/borrowInfo/export`, {}, "忬¾å°è´¦.xlsx"); |
| | | }) |
| | | .catch(() => { |
| | | proxy.$modal.msg("已忶"); |
| | | }); |
| | | }; |
| | | |
| | | onMounted(() => { |
| | | getTableData(); |
| | | }); |
| | | </script> |
| | | |
| | | <style lang="scss" scoped> |
| | | .table_list { |
| | | margin-top: unset; |
| | | } |
| | | .actions { |
| | | display: flex; |
| | | justify-content: space-between; |
| | | margin-bottom: 10px; |
| | | } |
| | | </style> |