<template>
|
<ProDialog
|
title="批量登记"
|
v-model="visible"
|
@close="onDialogClose"
|
destroy-on-close
|
draggable
|
width="700px"
|
>
|
<ProForm :model="form" ref="dialogForm" label-width="120px">
|
<ProFormItemV2 prop="ids" class="pro-form-item-label-hidden">
|
<div class="batchEntryRewardBody">
|
<el-transfer
|
v-model="deleteList"
|
filterable
|
:filter-method="filterMethod"
|
filter-placeholder="请输入搜索内容"
|
:data="form.companyList"
|
:titles="['登记', '不登记']"
|
:props="prop"
|
@change="handleChange"
|
/>
|
</div>
|
</ProFormItemV2>
|
<ProFormItemV2 label="登记类型:" prop="incomeType" required>
|
<ProFormRadio
|
v-model="form.incomeType"
|
:value-enum="incomeTypeEnum"
|
:button-style="false"
|
@change="handleIncomeTypeChange"
|
/>
|
</ProFormItemV2>
|
<ProFormItemV2
|
label="登记金额:"
|
prop="amount"
|
:check-rules="[{ message: '请输入登记金额', type: 'number' }]"
|
>
|
<ProFormInputNumber
|
v-model="form.amount"
|
:controls="false"
|
:min="0"
|
unit="元"
|
:precision="2"
|
></ProFormInputNumber>
|
</ProFormItemV2>
|
<ProFormItemV2
|
label="上传登记凭证:"
|
prop="fileUrl"
|
:check-rules="[{ message: '请上传登记凭证', type: 'upload' }]"
|
>
|
<ProFormUpload
|
v-model:file-url="form.fileUrl"
|
:limitFileSize="50"
|
accept="doc,docx,pdf,xls,xlsx,jpg/jpeg,png"
|
></ProFormUpload>
|
</ProFormItemV2>
|
</ProForm>
|
<template #footer>
|
<span class="dialog-footer">
|
<el-button @click="emit('onCancel')">取 消</el-button>
|
<el-button type="primary" @click="handleConfirm">确 定</el-button>
|
</span>
|
</template>
|
</ProDialog>
|
</template>
|
|
<script setup lang="ts">
|
import { FormInstance, TransferPropsAlias } from 'element-plus';
|
import {
|
ProDialog,
|
ProForm,
|
ProFormItemV2,
|
ProFormInputNumber,
|
ProFormRadio,
|
ProFormUpload,
|
UploadUserFile,
|
} from '@bole-core/components';
|
import { Message } from '@bole-core/core';
|
import { IncomeTypeEnumText, IncomeTypeEnum } from '@/constants';
|
import * as parkBountyApplyServices from '@/services/api/ParkBountyApply';
|
|
defineOptions({
|
name: 'BatchRegisterDialog',
|
});
|
|
type Props = {
|
/**
|
* @deprecated
|
*/
|
financeSumAmount?: number;
|
};
|
|
const props = withDefaults(defineProps<Props>(), {});
|
|
const visible = defineModel({ type: Boolean });
|
|
type Form = {
|
title?: string;
|
parkBountyApplyDetailIds: string[];
|
amount: number;
|
companyList: API.GetNotTransferCompanyNameListOutput[];
|
incomeType: IncomeTypeEnum;
|
parkBountyApplyId: string;
|
showSuportPlatRecharge: boolean;
|
|
fileUrl: UploadUserFile[];
|
};
|
|
const form = defineModel<Form>('form');
|
|
const incomeTypeEnum = computed(() => {
|
return [
|
{
|
label: IncomeTypeEnumText[IncomeTypeEnum.Fiscal],
|
value: IncomeTypeEnum.Fiscal,
|
},
|
form.value.showSuportPlatRecharge && {
|
label: IncomeTypeEnumText[IncomeTypeEnum.Platform],
|
value: IncomeTypeEnum.Platform,
|
},
|
].filter(Boolean);
|
});
|
|
const deleteList = ref<string[]>([]);
|
|
watch(visible, (value, oldValue) => {
|
if (value && !oldValue) {
|
getParkBountyApplyBatchFinanceEnterprise();
|
}
|
});
|
|
async function getParkBountyApplyBatchTransferEnterprise() {
|
try {
|
let res = await parkBountyApplyServices.getParkBountyApplyBatchTransferRegEnterprise({
|
parkBountyApplyId: form.value.parkBountyApplyId,
|
});
|
if (res) {
|
form.value.companyList = res;
|
form.value.parkBountyApplyDetailIds = res.map((x) => x.parkBountyApplyDetailId);
|
deleteList.value = [];
|
}
|
} catch (error) {}
|
}
|
|
async function getParkBountyApplyBatchFinanceEnterprise() {
|
try {
|
let res = await parkBountyApplyServices.getParkBountyApplyBatchFinanceRegEnterprise({
|
parkBountyApplyId: form.value.parkBountyApplyId,
|
});
|
if (res) {
|
form.value.companyList = res;
|
form.value.parkBountyApplyDetailIds = res.map((x) => x.parkBountyApplyDetailId);
|
deleteList.value = [];
|
}
|
} catch (error) {}
|
}
|
function handleIncomeTypeChange() {
|
if (form.value.incomeType === IncomeTypeEnum.Fiscal) {
|
getParkBountyApplyBatchFinanceEnterprise();
|
} else {
|
getParkBountyApplyBatchTransferEnterprise();
|
}
|
}
|
|
function handleChange(ids: string[]) {
|
form.value.parkBountyApplyDetailIds = form.value.companyList
|
.filter((item) => !ids.includes(item.companyId))
|
.map((item) => item.parkBountyApplyDetailId);
|
}
|
|
const emit = defineEmits<{
|
(e: 'onConfirm'): void;
|
(e: 'onCancel'): void;
|
}>();
|
|
const dialogForm = ref<FormInstance>();
|
|
function onDialogClose() {
|
if (!dialogForm.value) return;
|
dialogForm.value.resetFields();
|
}
|
|
function handleConfirm() {
|
if (!form.value.parkBountyApplyDetailIds.length) {
|
Message.warnMessage('请选择入账企业');
|
return;
|
}
|
if (!dialogForm.value) return;
|
dialogForm.value.validate((valid) => {
|
if (valid) {
|
emit('onConfirm');
|
} else {
|
return;
|
}
|
});
|
}
|
|
const prop = {
|
label: 'name',
|
key: 'companyId',
|
} as TransferPropsAlias;
|
|
const filterMethod = (query: string, item: API.GetCompanyNameListOutput) => {
|
return item.name.toLowerCase().includes(query.toLowerCase());
|
};
|
</script>
|
|
<style lang="scss" scoped>
|
.batchEntryRewardBody {
|
display: flex;
|
justify-content: center;
|
width: 100%;
|
}
|
</style>
|