generated from Leo_Ding/web-template
购房记录
This commit is contained in:
parent
be2c76d9bc
commit
32693979d5
@ -13,3 +13,12 @@ export const createHomer = (params) => request.basic.post('/api/v1/customers/up_
|
||||
export const updateItem = (id, params) => request.basic.put(`/api/v1/customers/${id}`, params)
|
||||
// 删除数据
|
||||
export const delItem = (id) => request.basic.delete(`/api/v1/customers/${id}`)
|
||||
|
||||
// 获取购房记录
|
||||
export const getHouseOwners = (params) => request.basic.get('/api/v1/house-owners', params)
|
||||
|
||||
// 删除购房记录
|
||||
export const delHouseOwner = (id) => request.basic.delete(`/api/v1/house-owners/${id}`)
|
||||
|
||||
// 上传文件
|
||||
export const pushFile = (areaId, params) => request.basic.post(`/api/v1/house-owners/push/${areaId}`, params)
|
||||
|
||||
@ -11,3 +11,4 @@ export const getcustomers = (params) => request.basic.get('/api/v1/customers', p
|
||||
// export const updatePassword = (_, params) => request.basic.put(`/api/v1/current/password`, params)
|
||||
// // 用户权限菜单
|
||||
// export const getUserMenu = () => request.basic.get('/api/v1/current/menus')
|
||||
|
||||
|
||||
@ -1,7 +1,8 @@
|
||||
<template>
|
||||
<div class="clearfix">
|
||||
<a-upload list-type="picture-card" :multiple="multiple" v-model:file-list="fileList" @preview="handlePreview"
|
||||
@change="handleChange" :customRequest="handleCustomRequest" :beforeUpload="beforeUpload">
|
||||
@change="handleChange" :customRequest="handleCustomRequest" :beforeUpload="beforeUpload"
|
||||
:accept="acceptTypes">
|
||||
<div v-if="fileList.length < fileNumber">
|
||||
<plus-outlined />
|
||||
<div class="ant-upload-text">上传</div>
|
||||
@ -15,9 +16,8 @@
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import { ref, watch, onMounted } from 'vue';
|
||||
import { ref, watch, onMounted, computed } from 'vue';
|
||||
import { PlusOutlined } from '@ant-design/icons-vue';
|
||||
import { UploadOutlined } from '@ant-design/icons-vue';
|
||||
import { message } from 'ant-design-vue';
|
||||
import { config } from '@/config'
|
||||
import apis from '@/apis'
|
||||
@ -46,14 +46,25 @@ const props = defineProps({
|
||||
type: Number,
|
||||
default: 120,
|
||||
},
|
||||
customUploadHandler: {
|
||||
type: Function,
|
||||
default: null // 如果没传,就用默认的图片上传逻辑
|
||||
},
|
||||
});
|
||||
|
||||
const emit = defineEmits(['update:modelValue', 'uploadSuccess', 'uploadError']);
|
||||
const uploadUrl = config('http.apiBasic') + '/api/v1/upload'
|
||||
const fileList = ref([]);
|
||||
|
||||
// 判断是否为Excel文件
|
||||
const isExcelFile = (fileName) => {
|
||||
const excelExtensions = ['.xlsx', '.xls'];
|
||||
const fileSuffix = fileName.substring(fileName.lastIndexOf('.')).toLowerCase();
|
||||
return excelExtensions.includes(fileSuffix);
|
||||
};
|
||||
|
||||
// 初始化文件列表
|
||||
onMounted(() => {
|
||||
console.log(' props.modelValue', props.modelValue)
|
||||
fileList.value = props.modelValue.map(url => ({
|
||||
uid: `preview-${Date.now()}-${Math.random()}`,
|
||||
name: url.substring(url.lastIndexOf('/') + 1),
|
||||
@ -61,25 +72,16 @@ onMounted(() => {
|
||||
url: url
|
||||
}));
|
||||
});
|
||||
|
||||
// 文件上传前校验
|
||||
const beforeUpload = (file) => {
|
||||
// const isValidType = props.acceptTypes === '*' ||
|
||||
// props.acceptTypes.split(',').some(type => file.name.endsWith(type.replace('*', '')));
|
||||
// const isValidSize = file.size / 1024 / 1024 < props.maxSize;
|
||||
|
||||
// if (!isValidType) {
|
||||
// message.error(`仅支持 ${props.acceptTypes} 格式文件`);
|
||||
// return false;
|
||||
// }
|
||||
// if (!isValidSize) {
|
||||
// message.error(`文件大小不能超过 ${props.maxSize}MB`);
|
||||
// return false;
|
||||
// }
|
||||
return true;
|
||||
};
|
||||
|
||||
const handleCancel = () => {
|
||||
previewVisible.value = false;
|
||||
};
|
||||
|
||||
const getBase64 = (file) => {
|
||||
return new Promise((resolve, reject) => {
|
||||
const reader = new FileReader();
|
||||
@ -88,23 +90,48 @@ const getBase64 = (file) => {
|
||||
reader.onerror = error => reject(error);
|
||||
});
|
||||
}
|
||||
|
||||
const handlePreview = async (file) => {
|
||||
console.log(file.name)
|
||||
const list = ['.avi', '.mp4', '.mov', '.wmv', '.mkv', '.m4v']
|
||||
const fileSuffix = file.name.substring(file.name.lastIndexOf('.'))
|
||||
if (list.includes(fileSuffix)) {
|
||||
fileType.value = 'video'
|
||||
const videoExtensions = ['.avi', '.mp4', '.mov', '.wmv', '.mkv', '.m4v'];
|
||||
const imageExtensions = ['.png', '.jpg', '.jpeg', '.gif', '.bmp', '.webp'];
|
||||
const excelExtensions = ['.xlsx', '.xls'];
|
||||
|
||||
const fileSuffix = file.name.substring(file.name.lastIndexOf('.')).toLowerCase();
|
||||
|
||||
// 如果是 Excel 文件,不预览
|
||||
if (excelExtensions.includes(fileSuffix)) {
|
||||
message.info('Excel 文件不支持预览');
|
||||
return;
|
||||
}
|
||||
|
||||
// 判断是图片还是视频
|
||||
if (videoExtensions.includes(fileSuffix)) {
|
||||
fileType.value = 'video';
|
||||
} else if (imageExtensions.includes(fileSuffix)) {
|
||||
fileType.value = 'img';
|
||||
} else {
|
||||
// 其他类型(如 pdf 等)也可按需处理,这里默认当图片(或不支持)
|
||||
fileType.value = 'img';
|
||||
}
|
||||
|
||||
if (!file.url && !file.preview) {
|
||||
file.preview = await getBase64(file.originFileObj)
|
||||
file.preview = await getBase64(file.originFileObj);
|
||||
}
|
||||
previewImage.value = file.url || file.preview;
|
||||
previewVisible.value = true;
|
||||
};
|
||||
|
||||
|
||||
// 修改handleChange方法
|
||||
const handleChange = ({ file, fileList: updatedList }) => {
|
||||
// 如果是Excel文件且上传失败,不显示错误消息
|
||||
if (isExcelFile(file.name) && file.status === 'error') {
|
||||
// 从列表中移除错误项
|
||||
const filteredList = updatedList.filter(item => item.uid !== file.uid);
|
||||
fileList.value = filteredList;
|
||||
// 不显示错误消息,直接返回
|
||||
return;
|
||||
}
|
||||
|
||||
// 处理上传成功的情况
|
||||
if (file.status === 'done') {
|
||||
const response = file.response;
|
||||
@ -113,8 +140,11 @@ const handleChange = ({ file, fileList: updatedList }) => {
|
||||
const targetFile = updatedList.find(f => f.uid === file.uid);
|
||||
if (targetFile) {
|
||||
targetFile.url = response.url;
|
||||
// 如果是Excel文件,不上传成功的提示
|
||||
if (!isExcelFile(file.name)) {
|
||||
message.success(`${file.name} 上传成功`);
|
||||
}
|
||||
}
|
||||
|
||||
// 更新外部绑定值
|
||||
const urls = updatedList
|
||||
@ -127,41 +157,64 @@ const handleChange = ({ file, fileList: updatedList }) => {
|
||||
const urls = updatedList
|
||||
.filter(item => item.status === 'done')
|
||||
.map(item => item.url);
|
||||
emit('update:modelValue', urls);
|
||||
emit('update:modelValue', urls)
|
||||
} else if (file.status === 'uploading') {
|
||||
// 如果是Excel文件,不上传中的提示
|
||||
if (!isExcelFile(file.name)) {
|
||||
message.success(`${file.name} 上传成功`);
|
||||
}
|
||||
} else if (file.status === 'error') {
|
||||
// 非Excel文件显示错误提示
|
||||
if (!isExcelFile(file.name)) {
|
||||
message.error(`${file.name} 上传失败`);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
// 修复自定义上传方法
|
||||
const handleCustomRequest = async (options) => {
|
||||
const { file, onProgress, onSuccess, onError } = options;
|
||||
const { file, onSuccess, onError } = options;
|
||||
|
||||
try {
|
||||
let result;
|
||||
let fullUrl;
|
||||
|
||||
if (props.customUploadHandler) {
|
||||
// 使用调用方提供的上传函数
|
||||
result = await props.customUploadHandler(file);
|
||||
// 假设返回的是完整 URL 或相对路径
|
||||
fullUrl = typeof result === 'string'
|
||||
? result.startsWith('http') ? result : config('http.apiBasic') + result
|
||||
: result.url; // 也支持对象形式 { url: '...' }
|
||||
} else {
|
||||
// 默认走图片上传逻辑(保持兼容)
|
||||
const formData = new FormData();
|
||||
formData.append('file', file);
|
||||
const { data } = await apis.common.uploadImg(formData);
|
||||
const fullUrl = config('http.apiBasic') + data;
|
||||
// 正确构造文件对象
|
||||
fullUrl = config('http.apiBasic') + data;
|
||||
}
|
||||
|
||||
onSuccess({
|
||||
uid: file.uid,
|
||||
name: file.name,
|
||||
status: 'done',
|
||||
url: fullUrl,
|
||||
response: { url: fullUrl } // 确保response包含URL
|
||||
response: { url: fullUrl }
|
||||
}, file);
|
||||
|
||||
// 触发成功事件
|
||||
emit('uploadSuccess', data);
|
||||
emit('uploadSuccess', fullUrl); // 或者只传 data 部分,按需调整
|
||||
} catch (err) {
|
||||
onError(err);
|
||||
// 如果是Excel文件,不显示全局错误提示
|
||||
if (!isExcelFile(file.name)) {
|
||||
message.error('上传失败');
|
||||
}
|
||||
emit('uploadError', err);
|
||||
}
|
||||
};
|
||||
|
||||
// 同步外部v-model变化
|
||||
watch(() => props.modelValue, (newVal) => {
|
||||
// fileList.value=[...newVal]
|
||||
// 仅同步已完成的项目
|
||||
const doneFiles = fileList.value.filter(f => f.status === 'done');
|
||||
const doneUrls = doneFiles.map(f => f.url);
|
||||
@ -181,6 +234,7 @@ watch(() => props.modelValue, (newVal) => {
|
||||
}
|
||||
}, { deep: true });
|
||||
</script>
|
||||
|
||||
<style>
|
||||
/* you can make up upload button and sample style by using stylesheets */
|
||||
.ant-upload-select-picture-card i {
|
||||
|
||||
@ -109,4 +109,5 @@ export default {
|
||||
earnPointModule:'赚海贝模块',
|
||||
earnPointLog:'赚海贝记录',
|
||||
earnPointRule:'赚海贝规则',
|
||||
houseList:'购房记录',
|
||||
}
|
||||
|
||||
@ -70,6 +70,17 @@ export default [
|
||||
permission: '*',
|
||||
},
|
||||
},
|
||||
{
|
||||
path: 'houseList',
|
||||
name: 'houseList',
|
||||
component: 'userManagement/houseList/index.vue',
|
||||
meta: {
|
||||
title: '购房记录',
|
||||
isMenu: true,
|
||||
keepAlive: true,
|
||||
permission: '*',
|
||||
},
|
||||
},
|
||||
],
|
||||
},
|
||||
]
|
||||
|
||||
151
src/views/userManagement/houseList/components/EditDialog.vue
Normal file
151
src/views/userManagement/houseList/components/EditDialog.vue
Normal file
@ -0,0 +1,151 @@
|
||||
<template>
|
||||
<a-modal :open="modal.open" :title="modal.title" :width="640" :confirm-loading="modal.confirmLoading"
|
||||
:after-close="onAfterClose" :cancel-text="cancelText" :ok-text="okText" @ok="handleOk" @cancel="handleCancel">
|
||||
<a-spin :spinning="spining">
|
||||
<a-form ref="formRef" :model="formData" :rules="formRules">
|
||||
<a-card class="mb-8-2">
|
||||
<a-col :span="24">
|
||||
<a-form-item label="所属区域" name="areaId">
|
||||
<a-select v-model:value="formData.areaId" allowClear>
|
||||
<a-select-option :value="1">南通</a-select-option>
|
||||
<a-select-option :value="2">盐城</a-select-option>
|
||||
</a-select>
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
<a-col :span="24">
|
||||
<a-form-item :label="'导入文件'" name="fileList">
|
||||
<gx-upload v-model="formData.fileList" accept=".xlsx,.xls"
|
||||
:customUploadHandler="uploadExcelFile" @uploadSuccess="uploadSuccess" />
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
</a-card>
|
||||
</a-form>
|
||||
</a-spin>
|
||||
</a-modal>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import { ref, onBeforeMount } from 'vue'
|
||||
import { config } from '@/config'
|
||||
import apis from '@/apis'
|
||||
import { useForm, useModal, useSpining } from '@/hooks'
|
||||
import { message } from 'ant-design-vue'
|
||||
import { useI18n } from 'vue-i18n'
|
||||
import dayjs from 'dayjs'
|
||||
import GxUpload from '@/components/GxUpload/index.vue'
|
||||
const emit = defineEmits(['ok'])
|
||||
const { t } = useI18n() // 解构出t方法
|
||||
const { modal, showModal, hideModal, showLoading, hideLoading } = useModal()
|
||||
const { formData, formRef, formRules, resetForm } = useForm()
|
||||
const { spining, showSpining, hideSpining } = useSpining()
|
||||
const cancelText = ref(t('button.cancel'))
|
||||
const okText = ref(t('button.confirm'))
|
||||
const fileList = ref([])
|
||||
|
||||
onBeforeMount(() => {
|
||||
formData.value.areaId = ''
|
||||
})
|
||||
|
||||
/**
|
||||
* 新建
|
||||
*/
|
||||
function handleCreate() {
|
||||
showModal({
|
||||
type: 'create',
|
||||
title: '导入文件',
|
||||
})
|
||||
// initData()
|
||||
// formData.value.status = 'enabled'
|
||||
}
|
||||
|
||||
/**
|
||||
* 编辑
|
||||
*/
|
||||
async function handleEdit(record = {}) {
|
||||
showModal({
|
||||
type: 'edit',
|
||||
title: '编辑客户',
|
||||
})
|
||||
try {
|
||||
showSpining()
|
||||
const { data, success } = await apis.customer.getItem(record.id).catch()
|
||||
if (!success) {
|
||||
hideModal()
|
||||
return
|
||||
}
|
||||
hideSpining()
|
||||
formData.value = { ...data }
|
||||
formData.value.birthday = dayjs(data.birthday)
|
||||
if (data.avatar) {
|
||||
formData.value.fileList = [config('http.apiBasic') + data.avatar]
|
||||
}
|
||||
} catch (error) {
|
||||
message.error({ content: error.message })
|
||||
hideSpining()
|
||||
}
|
||||
|
||||
}
|
||||
const uploadSuccess = (data) => {
|
||||
fileList.value.push(data)
|
||||
}
|
||||
/**
|
||||
* 确定
|
||||
*/
|
||||
function handleOk() {
|
||||
hideModal()
|
||||
formData.value.areaId = null
|
||||
fileList.value = []
|
||||
}
|
||||
|
||||
|
||||
// 上传 Excel 的专用方法
|
||||
const uploadExcelFile = async (file) => {
|
||||
const areaId = formData.value.areaId
|
||||
if (!areaId) {
|
||||
message.error('请先选择所属区域')
|
||||
throw new Error('缺少 areaId')
|
||||
}
|
||||
|
||||
const formDataUpload = new FormData()
|
||||
formDataUpload.append('file', file)
|
||||
|
||||
// 明确获取响应
|
||||
const res = await apis.customer.pushFile(areaId, formDataUpload)
|
||||
|
||||
if (!res.success) {
|
||||
// message.error('Excel 上传失败')
|
||||
throw new Error(res.message)
|
||||
}
|
||||
|
||||
message.success('Excel 上传成功')
|
||||
emit('ok')
|
||||
hideModal()
|
||||
formData.value.areaId = null
|
||||
fileList.value = []
|
||||
return res.data
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 取消
|
||||
*/
|
||||
function handleCancel() {
|
||||
formData.value.areaId = null
|
||||
hideModal()
|
||||
}
|
||||
|
||||
/**
|
||||
* 关闭后
|
||||
*/
|
||||
function onAfterClose() {
|
||||
resetForm()
|
||||
hideLoading()
|
||||
}
|
||||
|
||||
defineExpose({
|
||||
handleCreate,
|
||||
handleEdit,
|
||||
})
|
||||
</script>
|
||||
|
||||
<style lang="less" scoped></style>
|
||||
206
src/views/userManagement/houseList/index.vue
Normal file
206
src/views/userManagement/houseList/index.vue
Normal file
@ -0,0 +1,206 @@
|
||||
<template>
|
||||
<x-search-bar class="mb-8-2">
|
||||
<template #default="{ gutter, colSpan }">
|
||||
<a-form :model="searchFormData" layout="inline">
|
||||
<a-row :gutter="gutter">
|
||||
<a-col v-bind="colSpan">
|
||||
<a-form-item label="所属区域" name="areaId">
|
||||
<a-select v-model:value="searchFormData.areaId" allowClear>
|
||||
<a-select-option :value="1">南通</a-select-option>
|
||||
<a-select-option :value="2">盐城</a-select-option>
|
||||
</a-select>
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
|
||||
<a-col v-bind="colSpan">
|
||||
<a-form-item label="客户姓名" name="customerName">
|
||||
<a-input placeholder="请输入客户姓名" v-model:value="searchFormData.customerName"></a-input>
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
<a-col v-bind="colSpan">
|
||||
<a-form-item label="客户手机号" name="customerPhone">
|
||||
<a-input placeholder="请输入客户手机号" v-model:value="searchFormData.customerPhone"></a-input>
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
<a-col v-bind="colSpan">
|
||||
<a-form-item label="客户身份证号" name="idCard">
|
||||
<a-input placeholder="请输入客户身份证号" v-model:value="searchFormData.idCard"></a-input>
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
|
||||
<a-col class="align-right" v-bind="colSpan">
|
||||
<a-space>
|
||||
<a-button @click="handleResetSearch">{{ $t('button.reset') }}</a-button>
|
||||
<a-button ghost type="primary" @click="handleSearch">
|
||||
{{ $t('button.search') }}
|
||||
</a-button>
|
||||
</a-space>
|
||||
</a-col>
|
||||
</a-row>
|
||||
</a-form>
|
||||
</template>
|
||||
</x-search-bar>
|
||||
<a-row :gutter="8" :wrap="false">
|
||||
<a-col flex="auto">
|
||||
<a-card type="flex">
|
||||
<x-action-bar class="mb-8-2">
|
||||
<a-button type="primary" @click="$refs.editDialogRef.handleCreate()">
|
||||
<template #icon>
|
||||
<plus-outlined></plus-outlined>
|
||||
</template>
|
||||
导入记录
|
||||
</a-button>
|
||||
</x-action-bar>
|
||||
<a-table :columns="columns" :data-source="listData" bordered="true" :loading="loading"
|
||||
:pagination="paginationState" :scroll="{ x: 'max-content' }" @change="onTableChange">
|
||||
<template #bodyCell="{ column, record }">
|
||||
|
||||
|
||||
<template v-if="column.dataIndex === 'areaId'">
|
||||
<span>{{ record.areaId === 1 ? '南通' : '盐城' }}</span>
|
||||
</template>
|
||||
<template v-if="column.dataIndex === 'status'">
|
||||
<span>{{ record.status == "uncheck" ? '未审核' : '已审核' }}</span>
|
||||
</template>
|
||||
<template v-if="'action' === column.key">
|
||||
<!-- <x-action-button @click="$refs.editDialogRef.handleEdit(record)">
|
||||
<a-tooltip>
|
||||
<template #title> {{ $t('pages.system.user.edit') }}</template>
|
||||
<edit-outlined /> </a-tooltip></x-action-button> -->
|
||||
<x-action-button @click="handleDelete(record)">
|
||||
<a-tooltip>
|
||||
<template #title>{{ $t('pages.system.delete') }}</template>
|
||||
<delete-outlined style="color: #ff4d4f" /> </a-tooltip></x-action-button>
|
||||
</template>
|
||||
</template>
|
||||
</a-table>
|
||||
</a-card>
|
||||
</a-col>
|
||||
</a-row>
|
||||
|
||||
<edit-dialog ref="editDialogRef" @ok="onOk"></edit-dialog>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import { message, Modal } from 'ant-design-vue'
|
||||
import { ref } from 'vue'
|
||||
import apis from '@/apis'
|
||||
import { formatUtcDateTime } from '@/utils/util'
|
||||
import { config } from '@/config'
|
||||
import dayjs from 'dayjs'
|
||||
import { usePagination } from '@/hooks'
|
||||
import { customersEnum, areaEnum } from "@/enums/useEnum"
|
||||
import EditDialog from './components/EditDialog.vue'
|
||||
import { PlusOutlined, EditOutlined, DeleteOutlined } from '@ant-design/icons-vue'
|
||||
import { useI18n } from 'vue-i18n'
|
||||
import { render } from 'less'
|
||||
defineOptions({
|
||||
name: 'owner',
|
||||
})
|
||||
const { t } = useI18n() // 解构出t方法
|
||||
const columns = [
|
||||
{ title: '所属城市', dataIndex: 'areaId', width: 120, align: 'center' },
|
||||
{ title: '楼盘名称', dataIndex: 'productName', width: 120, align: 'center' },
|
||||
{ title: '楼盘期数', dataIndex: 'productStages', width: 120, align: 'center' },
|
||||
{ title: '房源信息', dataIndex: 'roomName', width: 120, align: 'center' },
|
||||
{ title: '客户姓名', dataIndex: 'customerName', width: 120 },
|
||||
{ title: '客户手机号', dataIndex: 'customerPhone', width: 120 },
|
||||
{ title: '客户身份证号', dataIndex: 'idCard', width: 300, align: 'center' },
|
||||
{ title: '来源信息', dataIndex: 'formInfo', width: 300, align: 'center' },
|
||||
{ title: '积分', dataIndex: 'point', width: 60, align: 'center' },
|
||||
{ title: '状态', dataIndex: 'status', width: 60, align: 'center' },
|
||||
{ title: t('button.action'), key: 'action', fixed: 'right', width: 100, align: 'center' },
|
||||
]
|
||||
|
||||
const { listData, loading, showLoading, hideLoading, paginationState, resetPagination, searchFormData } =
|
||||
usePagination()
|
||||
|
||||
const editDialogRef = ref()
|
||||
getPageList()
|
||||
/**
|
||||
* 获取表格数据
|
||||
* @returns {Promise<void>}
|
||||
*/
|
||||
async function getPageList() {
|
||||
try {
|
||||
showLoading()
|
||||
const { pageSize, current } = paginationState
|
||||
const { success, data, total } = await apis.customer
|
||||
.getHouseOwners({
|
||||
pageSize,
|
||||
current: current,
|
||||
...searchFormData.value,
|
||||
})
|
||||
.catch(() => {
|
||||
throw new Error()
|
||||
})
|
||||
hideLoading()
|
||||
if (config('http.code.success') === success) {
|
||||
listData.value = data
|
||||
paginationState.total = total
|
||||
}
|
||||
} catch (error) {
|
||||
hideLoading()
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除
|
||||
*/
|
||||
function handleDelete({ id }) {
|
||||
console.log(id);
|
||||
Modal.confirm({
|
||||
title: t('pages.system.user.delTip'),
|
||||
content: t('button.confirm'),
|
||||
okText: t('button.confirm'),
|
||||
onOk: async () => {
|
||||
try {
|
||||
const { success } = await apis.customer.delHouseOwner(id);
|
||||
if (success === config('http.code.success')) {
|
||||
message.success('删除成功');
|
||||
await getPageList();
|
||||
} else {
|
||||
message.error('删除失败');
|
||||
throw new Error('Delete API returned non-success status');
|
||||
}
|
||||
} catch (error) {
|
||||
message.error('删除失败');
|
||||
throw error; // 阻止 Modal 关闭,并避免 unhandled rejection
|
||||
}
|
||||
},
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* 分页
|
||||
*/
|
||||
function onTableChange({ current, pageSize }) {
|
||||
paginationState.current = current
|
||||
paginationState.pageSize = pageSize
|
||||
getPageList()
|
||||
}
|
||||
|
||||
/**
|
||||
* 搜索
|
||||
*/
|
||||
function handleSearch() {
|
||||
resetPagination()
|
||||
getPageList()
|
||||
}
|
||||
/**
|
||||
* 重置
|
||||
*/
|
||||
function handleResetSearch() {
|
||||
searchFormData.value = {}
|
||||
resetPagination()
|
||||
getPageList()
|
||||
}
|
||||
/**
|
||||
* 编辑完成
|
||||
*/
|
||||
async function onOk() {
|
||||
await getPageList()
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="less" scoped></style>
|
||||
Loading…
x
Reference in New Issue
Block a user