Commit d1f4abc8 authored by 沈翠玲's avatar 沈翠玲

资产分配

parent a717b181
...@@ -24,7 +24,7 @@ VITE_GLOB_API_URL = ...@@ -24,7 +24,7 @@ VITE_GLOB_API_URL =
VITE_GLOB_API_URL_PREFIX = /api VITE_GLOB_API_URL_PREFIX = /api
# websocket地址 # websocket地址
VITE_APP_SOCKET_URL = ws://192.168.31.128:8080 VITE_APP_SOCKET_URL = ws://8.152.205.9:8080
# 文件上传地址 # 文件上传地址
VITE_GLOB_UPLOAD_URL= VITE_GLOB_UPLOAD_URL=
......
...@@ -3,3 +3,27 @@ import request from '@/utils/http/index'; ...@@ -3,3 +3,27 @@ import request from '@/utils/http/index';
export const getLoanDistribute = (params) => { export const getLoanDistribute = (params) => {
return request.get('/LoanDistribute/totalLoan', params); return request.get('/LoanDistribute/totalLoan', params);
}; };
// 案件管理统计
export const getLoantotal = (params) => {
return request.get('/LoanDistribute/total', params);
};
// 资产列表
export const getLoanpage = (params) => {
return request.get('/LoanDistribute/page', params);
};
// 分配到调节中心
export const distributeLoan = (tenantId, data) => {
return request.post(`/LoanDistribute/distribute?tenantId=${tenantId}`, data);
};
// 系统自动分配; 分配到CPE
export const distributeCpe = (data) => {
return request.post(`/LoanDistribute/distributeCpe?type=${data.type}`, data);
};
// 手动调整分配CPE
export const changeDistributeCpe = (data) => {
return request.post(`/LoanDistribute/changeDistributeCpe`, data);
};
// 撤回案件
export const backDistribute = (ids) => {
return request.get('/LoanDistribute/back', { ids });
};
import request from '@/utils/http/index';
export const saveManageOrg = (data) => {
return request.post('/ManageOrg/save', data);
};
export const getManageOrgPage = (params) => {
return request.get('/ManageOrg/page', params);
};
export const deleteManageOrgs = (ids) => {
return request.get('/ManageOrg/batchDeleteByIds', { ids });
};
import request from '@/utils/http/index';
export const savePlatform = (data) => {
return request.post('/LoanPlatform/save', data);
};
export const getPlatformPage = (params) => {
return request.get('/LoanPlatform/page', params);
};
export const deletePlatforms = (ids) => {
return request.get('/LoanPlatform/batchDeleteByIds', { ids });
};
This diff is collapsed.
<template> <template>
<div class="table-box"> <div class="table-box">
<div> <div>
<ProTable <ProTable :config="config" ref="caseLRef" :api="getLoanpage" :paramCallback="paramCallback">
:config="config"
ref="caseLRef"
:api="getLoanDistribute"
:paramCallback="paramCallback"
>
<template #table_top> <template #table_top>
<div class="flex"> <div class="flex">
<div class="mr-2" <div class="mr-2"
>未分配案件数:<span class="text-blue-500 mr-1">{{ statisis.unCaseNum }}</span >未分配案件数:<span class="text-blue-500 mr-1">{{ statisis.caseNum }}</span
></div ></div
> >
<div class="mr-2" <div class="mr-2"
>未分配CPE数:<span class="text-blue-500 mr-1">{{ statisis.unCustomerNum }}</span >未分配CPE数:<span class="text-blue-500 mr-1">{{ statisis.cpeNum }}</span
></div ></div
> >
<div class="mr-2" <div class="mr-2"
>未分配总金额数:<span class="text-blue-500 mr-1">{{ statisis.unAmount }}</span >未分配总金额数:<span class="text-blue-500 mr-1">{{ statisis.amount }}</span
></div ></div
> >
</div> </div>
...@@ -27,11 +22,14 @@ ...@@ -27,11 +22,14 @@
<template #left_buttons> <template #left_buttons>
<el-button <el-button
type="primary" type="primary"
:disabled="!selectdList || selectdList.length !== 1"
@click="allocation" @click="allocation"
:disabled="!selectdList || selectdList.length < 1"
>分配 >分配
</el-button> </el-button>
<el-button type="primary" :disabled="!selectdList || selectdList.length < 1" <el-button
type="primary"
:disabled="!selectdList || selectdList.length < 1"
@click="backCase"
>撤回 >撤回
</el-button> </el-button>
<el-button type="primary" :disabled="!selectdList || selectdList.length < 1" <el-button type="primary" :disabled="!selectdList || selectdList.length < 1"
...@@ -40,113 +38,173 @@ ...@@ -40,113 +38,173 @@
</template> </template>
</ProTable> </ProTable>
</div> </div>
<allocationModal ref="allocationModalRef" /> <allocationModal ref="allocationModalRef" @success="query" />
</div> </div>
</template> </template>
<script setup name="case-allocation"> <script setup name="case-allocation" lang="jsx">
import allocationModal from './components/allocationModal.vue'; import allocationModal from './components/allocationModal.vue';
import { getLoanDistribute } from '@/api/allcation'; import { getLoantotal, getLoanpage, backDistribute } from '@/api/allcation';
import { reactive, ref } from 'vue'; import { reactive, ref } from 'vue';
import { ElMessageBox, ElMessage } from 'element-plus';
import citydata from '../../../assets/citydata';
import { onMounted } from 'vue'; import { onMounted } from 'vue';
const allocationModalRef = ref(); const allocationModalRef = ref();
const caseLRef = ref(); const caseLRef = ref();
const selectdList = ref([]); const selectdList = ref([]);
const curParam = ref({});
const onCheckboxChange = (row) => { const onCheckboxChange = (row) => {
selectdList.value = row.records; selectdList.value = row.records;
}; };
const statisis = ref({}); const statisis = ref({});
const getStatisis = (params) => { const getStatisis = (params) => {
getLoanDistribute(params).then((res) => { getLoantotal(params).then((res) => {
if (res.success) { if (res.success) {
statisis.value = res.result; statisis.value = res.result;
} }
}); });
}; };
const backCase = async () => {
await ElMessageBox.confirm('是否确认撤回选中案件?', '提示', {
confirmButtonText: '确认',
cancelButtonText: '取消',
type: 'warning',
});
const ids = selectdList.value.map((v) => v.id).join(',');
await backDistribute(ids);
ElMessage({
type: 'success',
message: '撤回成功!',
plain: true,
});
query();
};
const paramCallback = (param) => { const paramCallback = (param) => {
const obj = JSON.parse(JSON.stringify(param)); const obj = JSON.parse(JSON.stringify(param));
getStatisis(); if (obj.arealist && obj.arealist.length > 0) {
obj['province'] = obj.arealist[0];
obj['city'] = obj.arealist.length > 1 ? obj.arealist[1] : null;
obj['district'] = obj.arealist.length > 2 ? obj.arealist[2] : null;
delete obj['arealist'];
}
curParam.value = obj;
getStatisis(obj);
return obj; return obj;
}; };
const distributeStatusOpt = [
{ label: '未分配', value: 'undistributed' },
{ label: '分配到调解中心', value: 'tenant' },
{ label: '分配到CPE', value: 'CPE' },
];
console.log('citydatacitydata', citydata);
const config = reactive({ const config = reactive({
columns: [ columns: [
{ type: 'checkbox', title: '', width: '40px' }, { type: 'checkbox', title: '', width: '40px' },
{ field: 'name', title: '案件ID/案件号', search: { el: 'input' } }, { field: 'caseId', title: '案件ID/案件号', search: { el: 'input' } },
{ {
field: 'code', field: 'arealist',
enum: citydata,
title: '所属区域', title: '所属区域',
search: { el: 'input', props: { clearable: true } }, fieldNames: { label: 'label', value: 'value' },
}, search: { el: 'cascader', props: { clearable: true } },
{ slots: {
field: 'code', default: ({ row }) => {
return (
<div>
{row.manageOrg.province}
{row.manageOrg.city ? '-' + row.manageOrg.city : ''}
{row.manageOrg.district ? '-' + row.manageOrg.district : ''}
</div>
);
},
},
},
{
field: 'payOrg',
title: '借款机构', title: '借款机构',
search: { el: 'input', props: { clearable: true } }, search: { el: 'input', props: { clearable: true } },
}, },
{ {
field: 'role', field: 'distributeStatus',
title: '分配状态', title: '分配状态',
search: { el: 'input', props: { clearable: true } }, enum: distributeStatusOpt,
}, search: { el: 'select', props: { filterable: true }, span: 1 },
{ fieldNames: { label: 'label', value: 'value' },
field: 'role', slots: {
default: ({ row }) => {
return (
<>
{row.distributeStatus
? distributeStatusOpt.find((v) => v.value === row.distributeStatus).label
: ''}
</>
);
},
},
},
{
field: 'tenant.name',
title: '调解中心', title: '调解中心',
search: { el: 'input', props: { clearable: true } }, search: { el: 'input', props: { clearable: true } },
}, },
{ {
field: 'role', field: 'manageOrg.orgName',
title: '资管公司', title: '资管公司',
search: { el: 'input', props: { clearable: true } }, search: { el: 'input', props: { clearable: true } },
}, },
{ {
field: 'role', field: 'cpe.name',
title: 'CPE', title: 'CPE',
search: { el: 'input', props: { clearable: true } }, search: { el: 'input', props: { clearable: true }, key: 'cpeName' },
}, },
{ {
field: 'role', field: 'tenantTime',
title: '分配中心日期', title: '分配中心日期',
search: { el: 'date-picker', props: { type: 'date', valueFormat: 'YYYY-MM-DD' } }, search: { el: 'date-picker', props: { type: 'date', valueFormat: 'YYYY-MM-DD' } },
}, },
{ {
field: 'role', field: 'commissionAmount',
title: '债权总额', title: '债权总额',
search: { el: 'input', props: { clearable: true } }, search: { el: 'input', props: { clearable: true } },
}, },
{ {
field: 'role', field: 'cpeDate',
title: '分配CPE日期', title: '分配CPE日期',
search: { el: 'date-picker', props: { type: 'date', valueFormat: 'YYYY-MM-DD' } }, search: { el: 'date-picker', props: { type: 'date', valueFormat: 'YYYY-MM-DD' } },
}, },
{ {
field: 'role', field: 'borrower.name',
title: '借款人姓名', title: '借款人姓名',
search: { el: 'input', props: { clearable: true } }, search: { el: 'input', key: 'borrowerName', props: { clearable: true } },
}, },
{ {
field: 'role', field: 'sumRepayAmount',
title: '已还总额', title: '已还总额',
search: { el: 'input', props: { clearable: true } }, search: { el: 'input', props: { clearable: true } },
}, },
{ {
field: 'role', field: 'borrower.idCard',
title: '身份证', title: '身份证',
search: { el: 'input', props: { clearable: true } }, search: { el: 'input', props: { clearable: true }, key: 'idCard' },
}, },
{ {
field: 'role', field: 'borrower.phone',
key: 'borrowerPhone',
title: '手机', title: '手机',
search: { el: 'input', props: { clearable: true } }, search: { el: 'input', props: { clearable: true } },
}, },
{ {
field: 'role', field: 'principalBalance',
title: '剩余本金', title: '剩余本金',
}, },
{ {
field: 'role', field: 'remaininginterest',
title: '剩余利息', title: '剩余利息',
}, },
{ {
field: 'role', field: 'commission',
title: '违约金', title: '违约金',
}, },
], ],
...@@ -154,7 +212,10 @@ ...@@ -154,7 +212,10 @@
}); });
const allocation = (row) => { const allocation = (row) => {
allocationModalRef.value.openModal(JSON.parse(JSON.stringify(row))); allocationModalRef.value.openModal(
JSON.parse(JSON.stringify(selectdList.value[0])),
JSON.parse(JSON.stringify(curParam.value))
);
}; };
const query = () => caseLRef.value?.search(); const query = () => caseLRef.value?.search();
......
<template>
<vxe-modal
v-model="showModal"
@hide="onHide"
title="分配成员"
width="900px"
show-maximize
show-footer
esc-closable
>
<div class="mb-1">
<el-button type="primary" @click="userModalRef?.openModal">新增成员</el-button>
<el-button type="danger" @click="handleRemove">删除成员</el-button>
</div>
<vxe-table ref="xTable" :data="tableData">
<vxe-column type="checkbox" width="50" />
<vxe-column field="username" title="用户账号" minWidth="120" />
<vxe-column field="nickName" title="昵称" minWidth="120" />
<vxe-column field="status" title="状态" width="120">
<template #default="{ row }">
<el-tag :type="row.status == 'enable' ? 'primary' : 'danger'">{{
row.status == 'enable' ? '启用' : '禁用'
}}</el-tag>
</template>
</vxe-column>
</vxe-table>
<template #footer>
<el-button type="default" @click="showModal = false">取消</el-button>
<el-button :loading="loading" type="primary" @click="submitForm">提交</el-button>
</template>
</vxe-modal>
<UserModal ref="userModalRef" @confirm="hanldeConfirm" />
</template>
<script setup name="AllocationUserModal">
import { ref } from 'vue';
import { ElMessage } from 'element-plus';
import { saveTenant } from '@/api/tenant';
import UserModal from '@/components/CommonModal/UserModal/index.vue';
const emits = defineEmits(['success']);
const xTable = ref(null);
const showModal = ref(false);
const userModalRef = ref(null);
const loading = ref(false);
const tableData = ref([]);
const currentRole = ref(null);
const submitForm = async () => {
try {
loading.value = true;
const params = {
...currentRole.value,
users: tableData.value.map((v) => ({ id: v.id })),
};
await saveTenant(params);
emits('success');
ElMessage({
type: 'success',
message: '设置成功!',
plain: true,
});
showModal.value = false;
} catch {}
loading.value = false;
};
const onHide = () => {
currentRole.value = null;
tableData.value = [];
};
const openModal = (role) => {
currentRole.value = role;
tableData.value = role.users;
showModal.value = true;
};
const hanldeConfirm = (rows) => {
tableData.value.unshift(...rows.filter((row) => !tableData.value.find((v) => v.id == row.id)));
};
const handleRemove = () => {
const checkedList = xTable.value.getCheckboxRecords();
if (!checkedList.length) {
return ElMessage({
type: 'warning',
message: '请选择有效数据!',
plain: true,
});
}
tableData.value = tableData.value.filter((row) => !checkedList.find((v) => v.id == row.id));
};
defineExpose({
openModal,
});
</script>
<template>
<vxe-modal
v-model="showModal"
:title="modalTitle"
@hide="onHide"
width="500px"
show-maximize
show-footer
esc-closable
>
<el-form ref="formRef" :model="form" :rules="rules" inline label-width="110px">
<el-row :gutter="10">
<el-col :span="24">
<el-form-item class="w-full" label="公司名称" prop="orgName">
<el-input v-model="form.orgName" placeholder="请输入公司名称" />
</el-form-item>
</el-col>
<el-col :span="24">
<el-form-item class="w-full" label="所属区域" prop="orgName">
<el-cascader v-model="form.arealist" class="w-full" :options="citydata" clearable />
</el-form-item>
</el-col>
<el-col :span="24">
<el-form-item class="w-full" label="负责人手机" prop="offenderPhone">
<el-input v-model="form.offenderPhone" placeholder="负责人手机" />
</el-form-item>
</el-col>
<el-col :span="24">
<el-form-item class="w-full" label="负责人" prop="offender">
<el-input v-model="form.offender" placeholder="负责人" />
</el-form-item>
</el-col>
<el-col :span="24">
<el-form-item class="w-full" label="是否共案处理" prop="mergerCase">
<el-radio-group v-model="form.mergerCase">
<el-radio value="Y"></el-radio>
<el-radio value="N"></el-radio>
</el-radio-group>
</el-form-item>
</el-col>
<el-col :span="24">
<el-form-item class="w-full" label="状态" prop="status">
<el-radio-group v-model="form.status">
<el-radio value="enable">启用</el-radio>
<el-radio value="disable">禁用</el-radio>
</el-radio-group>
</el-form-item>
</el-col>
</el-row>
</el-form>
<template #footer>
<el-button type="default" @click="showModal = false">取消</el-button>
<el-button :loading="loading" type="primary" @click="submitForm">提交</el-button>
</template>
</vxe-modal>
</template>
<script setup name="tenantFormModal">
import { ref, computed } from 'vue';
import { ElMessage } from 'element-plus';
import { saveManageOrg } from '@/api/manageOrg';
import citydata from '../../../../assets/citydata';
const emits = defineEmits(['success']);
const currentTenant = ref(null);
const showModal = ref(false);
const formRef = ref(null);
const isEdit = computed(() => !!currentTenant.value);
const modalTitle = computed(() => (isEdit.value ? '编辑公司' : '新增公司'));
const form = ref({
arealist: [],
orgName: '',
offenderPhone: '',
offender: '',
mergerCase: 'N',
status: 'enable',
});
const rules = ref({
orgName: { required: true, message: '请输入公司名称', trigger: 'blur' },
offenderPhone: { required: true, message: '请输入负责人手机', trigger: 'blur' },
offender: { required: true, message: '请输入负责人', trigger: 'blur' },
});
const loading = ref(false);
const submitForm = async () => {
try {
await formRef.value.validate();
loading.value = true;
const params = JSON.parse(JSON.stringify(form.value));
if (params.arealist && params.arealist.length > 0) {
params['province'] = params.arealist[0];
params['city'] = params.arealist.length > 1 ? params.arealist[1] : null;
params['district'] = params.arealist.length > 2 ? params.arealist[2] : null;
delete params['arealist'];
}
await saveManageOrg(params);
emits('success');
ElMessage({
type: 'success',
message: isEdit.value ? '修改成功!' : '添加成功!',
plain: true,
});
showModal.value = false;
} catch {}
loading.value = false;
};
const onHide = () => {
form.value = {
arealist: [],
orgName: '',
offenderPhone: '',
offender: '',
mergerCase: 'N',
status: 'enable',
};
formRef.value.clearValidate();
currentTenant.value = null;
};
const openModal = (role) => {
role && (form.value = role);
form.value.arealist = role ? [role.province, role.city, role.district] : [];
console.log('role', role, form.value.arealist);
currentTenant.value = role;
showModal.value = true;
};
defineExpose({
openModal,
});
</script>
<template>
<div class="table-box">
<ProTable
ref="proTable"
:config="config"
:api="getManageOrgPage"
:paramCallback="paramCallback"
>
<template #left_buttons>
<el-button type="primary" :icon="Plus" @click="ManageOrgModalRef?.openModal()"
>新增</el-button
>
<el-button type="danger" :icon="Delete" @click="onDelete">删除</el-button>
</template>
</ProTable>
<ManageOrgFormModal ref="ManageOrgModalRef" @success="query" />
<AllocationUserModal ref="allocationUserModalRef" @success="query" />
</div>
</template>
<script setup lang="jsx" name="ManageOrg">
import { ref, reactive, onMounted } from 'vue';
import { Plus, Delete, Edit, Setting } from '@element-plus/icons-vue';
import { getManageOrgPage, deleteManageOrgs } from '@/api/manageOrg';
import ManageOrgFormModal from './components/ManageOrgFormModal.vue';
import AllocationUserModal from './components/AllocationUserModal.vue';
import { ElMessageBox, ElMessage, ElButton, ElTag } from 'element-plus';
import citydata from '../../../assets/citydata';
const proTable = ref(null);
const ManageOrgModalRef = ref(null);
const allocationUserModalRef = ref(null);
const config = reactive({
columns: [
{ type: 'checkbox', width: 50 },
{ field: 'id', title: '资管公司ID' },
{ field: 'orgName', title: '公司名称', search: { el: 'input' } },
{
field: 'arealist',
enum: citydata,
title: '所属区域',
fieldNames: { label: 'label', value: 'value' },
search: { el: 'cascader', props: { clearable: true } },
slots: {
default: ({ row }) => {
return (
<div>
{row.province}
{row.city ? '-' + row.city : ''}
{row.district ? '-' + row.district : ''}
</div>
);
},
},
},
{
field: 'maxStagesNum',
title: '是否共案处理',
slots: {
default: ({ row }) => {
return <ElTag>{row.mergerCase == 'Y' ? '是' : '否'}</ElTag>;
},
},
},
{ field: 'offender', title: '负责人', search: { el: 'input' } },
{ field: 'offenderPhone', title: '负责人手机', search: { el: 'input' } },
{
field: 'status',
title: '状态',
width: 80,
slots: {
default: ({ row }) => {
return (
<ElTag type={row.status == 'enable' ? 'primary' : 'danger'}>
{row.status == 'enable' ? '启用' : '禁用'}
</ElTag>
);
},
},
},
{ field: 'createBy', title: '创建人' },
{ field: 'createTime', title: '创建时间' },
{
width: 200,
title: '操作',
slots: {
default: ({ row }) => (
<>
<ElButton type="primary" link icon={Edit} onClick={() => handleEdit(row)}>
编辑
</ElButton>
{/* <ElButton
type="primary"
link
icon={Setting}
onClick={() =>
allocationUserModalRef.value.openModal(JSON.parse(JSON.stringify(row)))
}
>
设置成员
</ElButton> */}
</>
),
},
},
],
});
const paramCallback = (param) => {
const obj = JSON.parse(JSON.stringify(param));
if (obj.arealist && obj.arealist.length > 0) {
obj['province'] = obj.arealist[0];
obj['city'] = obj.arealist.length > 1 ? obj.arealist[1] : null;
obj['district'] = obj.arealist.length > 2 ? obj.arealist[2] : null;
delete obj['arealist'];
}
return obj;
};
const query = () => proTable.value?.search();
const handleEdit = (row) => ManageOrgModalRef.value.openModal(JSON.parse(JSON.stringify(row)));
const onDelete = async () => {
const list = proTable.value.element.getCheckboxRecords();
if (list.length > 0) {
await ElMessageBox.confirm('是否确认删除选中的数据?', '删除提示', {
confirmButtonText: '确认',
cancelButtonText: '取消',
type: 'warning',
});
const ids = list.map((v) => v.id).join(',');
await deleteManageOrgs(ids);
ElMessage.success({
message: '删除成功',
plain: true,
});
query();
}
};
onMounted(() => {
query();
});
</script>
<template>
<vxe-modal
v-model="showModal"
@hide="onHide"
title="分配成员"
width="900px"
show-maximize
show-footer
esc-closable
>
<div class="mb-1">
<el-button type="primary" @click="userModalRef?.openModal">新增成员</el-button>
<el-button type="danger" @click="handleRemove">删除成员</el-button>
</div>
<vxe-table ref="xTable" :data="tableData">
<vxe-column type="checkbox" width="50" />
<vxe-column field="username" title="用户账号" minWidth="120" />
<vxe-column field="nickName" title="昵称" minWidth="120" />
<vxe-column field="status" title="状态" width="120">
<template #default="{ row }">
<el-tag :type="row.status == 'enable' ? 'primary' : 'danger'">{{
row.status == 'enable' ? '启用' : '禁用'
}}</el-tag>
</template>
</vxe-column>
</vxe-table>
<template #footer>
<el-button type="default" @click="showModal = false">取消</el-button>
<el-button :loading="loading" type="primary" @click="submitForm">提交</el-button>
</template>
</vxe-modal>
<UserModal ref="userModalRef" @confirm="hanldeConfirm" />
</template>
<script setup name="AllocationUserModal">
import { ref } from 'vue';
import { ElMessage } from 'element-plus';
import { saveTenant } from '@/api/tenant';
import UserModal from '@/components/CommonModal/UserModal/index.vue';
const emits = defineEmits(['success']);
const xTable = ref(null);
const showModal = ref(false);
const userModalRef = ref(null);
const loading = ref(false);
const tableData = ref([]);
const currentRole = ref(null);
const submitForm = async () => {
try {
loading.value = true;
const params = {
...currentRole.value,
users: tableData.value.map((v) => ({ id: v.id })),
};
await saveTenant(params);
emits('success');
ElMessage({
type: 'success',
message: '设置成功!',
plain: true,
});
showModal.value = false;
} catch {}
loading.value = false;
};
const onHide = () => {
currentRole.value = null;
tableData.value = [];
};
const openModal = (role) => {
currentRole.value = role;
tableData.value = role.users;
showModal.value = true;
};
const hanldeConfirm = (rows) => {
tableData.value.unshift(...rows.filter((row) => !tableData.value.find((v) => v.id == row.id)));
};
const handleRemove = () => {
const checkedList = xTable.value.getCheckboxRecords();
if (!checkedList.length) {
return ElMessage({
type: 'warning',
message: '请选择有效数据!',
plain: true,
});
}
tableData.value = tableData.value.filter((row) => !checkedList.find((v) => v.id == row.id));
};
defineExpose({
openModal,
});
</script>
<template>
<vxe-modal
v-model="showModal"
:title="modalTitle"
@hide="onHide"
width="500px"
show-maximize
show-footer
esc-closable
>
<el-form ref="formRef" :model="form" :rules="rules" inline label-width="110px">
<el-row :gutter="10">
<el-col :span="24">
<el-form-item class="w-full" label="平台名称" prop="name">
<el-input v-model="form.name" placeholder="请输入平台名称" />
</el-form-item>
</el-col>
<el-col :span="24">
<el-form-item class="w-full" label="最大分期数" prop="maxStagesNum">
<el-input v-model="form.maxStagesNum" placeholder="最大分期数" />
</el-form-item>
</el-col>
<el-col :span="24">
<el-form-item class="w-full" label="最低分期金额" prop="minAmount">
<el-input v-model="form.minAmount" placeholder="最低分期金额" />
</el-form-item>
</el-col>
<el-col :span="24">
<el-form-item class="w-full" label="状态" prop="status">
<el-radio-group v-model="form.status">
<el-radio value="enable">启用</el-radio>
<el-radio value="disable">禁用</el-radio>
</el-radio-group>
</el-form-item>
</el-col>
</el-row>
</el-form>
<template #footer>
<el-button type="default" @click="showModal = false">取消</el-button>
<el-button :loading="loading" type="primary" @click="submitForm">提交</el-button>
</template>
</vxe-modal>
</template>
<script setup name="tenantFormModal">
import { ref, computed } from 'vue';
import { ElMessage } from 'element-plus';
import { savePlatform } from '@/api/platform';
const emits = defineEmits(['success']);
const currentTenant = ref(null);
const showModal = ref(false);
const formRef = ref(null);
const isEdit = computed(() => !!currentTenant.value);
const modalTitle = computed(() => (isEdit.value ? '编辑平台' : '新增平台'));
const form = ref({
name: '',
maxStagesNum: '',
minAmount: '',
status: 'enable',
});
const rules = ref({
name: { required: true, message: '请输入平台名称', trigger: 'blur' },
maxStagesNum: { required: true, message: '请输入最大分期数', trigger: 'blur' },
minAmount: { required: true, message: '请输入最低分期金额', trigger: 'blur' },
});
const loading = ref(false);
const submitForm = async () => {
try {
await formRef.value.validate();
loading.value = true;
await savePlatform(form.value);
emits('success');
ElMessage({
type: 'success',
message: isEdit.value ? '修改成功!' : '添加成功!',
plain: true,
});
showModal.value = false;
} catch {}
loading.value = false;
};
const onHide = () => {
form.value = {
name: '',
maxStagesNum: '',
minAmount: '',
status: 'enable',
};
formRef.value.clearValidate();
currentTenant.value = null;
};
const openModal = (role) => {
role && (form.value = role);
currentTenant.value = role;
showModal.value = true;
};
defineExpose({
openModal,
});
</script>
<template>
<div class="table-box">
<ProTable ref="proTable" :config="config" :api="getPlatformPage">
<template #left_buttons>
<el-button type="primary" :icon="Plus" @click="platformModalRef?.openModal()"
>新增</el-button
>
<el-button type="danger" :icon="Delete" @click="onDelete">删除</el-button>
</template>
</ProTable>
<platformFormModal ref="platformModalRef" @success="query" />
<AllocationUserModal ref="allocationUserModalRef" @success="query" />
</div>
</template>
<script setup lang="jsx" name="platformManage">
import { ref, reactive, onMounted } from 'vue';
import { Plus, Delete, Edit, Setting } from '@element-plus/icons-vue';
import { getPlatformPage, deletePlatforms } from '@/api/platform';
import platformFormModal from './components/platformFormModal.vue';
import AllocationUserModal from './components/AllocationUserModal.vue';
import { ElMessageBox, ElMessage, ElButton, ElTag } from 'element-plus';
const proTable = ref(null);
const platformModalRef = ref(null);
const allocationUserModalRef = ref(null);
const config = reactive({
columns: [
{ type: 'checkbox', width: 50 },
{ field: 'id', title: '借款平台ID' },
{ field: 'name', title: '平台名称', search: { el: 'input' } },
{ field: 'maxStagesNum', title: '分期最大期数', search: { el: 'input' } },
{ field: 'minAmount', title: '分期最低金额' },
{
field: 'status',
title: '状态',
width: 80,
slots: {
default: ({ row }) => {
return (
<ElTag type={row.status == 'enable' ? 'primary' : 'danger'}>
{row.status == 'enable' ? '启用' : '禁用'}
</ElTag>
);
},
},
},
{
width: 200,
title: '操作',
slots: {
default: ({ row }) => (
<>
<ElButton type="primary" link icon={Edit} onClick={() => handleEdit(row)}>
编辑
</ElButton>
{/* <ElButton
type="primary"
link
icon={Setting}
onClick={() =>
allocationUserModalRef.value.openModal(JSON.parse(JSON.stringify(row)))
}
>
设置成员
</ElButton> */}
</>
),
},
},
],
});
const query = () => proTable.value?.search();
const handleEdit = (row) => platformModalRef.value.openModal(JSON.parse(JSON.stringify(row)));
const onDelete = async () => {
const list = proTable.value.element.getCheckboxRecords();
if (list.length > 0) {
await ElMessageBox.confirm('是否确认删除选中的数据?', '删除提示', {
confirmButtonText: '确认',
cancelButtonText: '取消',
type: 'warning',
});
const ids = list.map((v) => v.id).join(',');
await deletePlatforms(ids);
ElMessage.success({
message: '删除成功',
plain: true,
});
query();
}
};
onMounted(() => {
query();
});
</script>
...@@ -56,6 +56,7 @@ export default defineConfig(({ command, mode }) => { ...@@ -56,6 +56,7 @@ export default defineConfig(({ command, mode }) => {
proxy: { proxy: {
'/api': { '/api': {
target: 'http://192.168.31.128:8080', target: 'http://192.168.31.128:8080',
// target: 'http://8.152.205.9:8080',
changeOrigin: true, changeOrigin: true,
rewrite: (path) => path.replace(/^\/api/, ''), rewrite: (path) => path.replace(/^\/api/, ''),
}, },
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment