feat: 设置-合同设置-合同条款设置
This commit is contained in:
@@ -21,9 +21,9 @@
|
||||
<icon-idcard v-if="record.isManager === 1" />
|
||||
</template>
|
||||
<template #status="{ record }">
|
||||
<a-tag :color="record.status == 1 ? 'green' : 'red'">
|
||||
{{ record.status == 1 ? $t('enable') : $t('disable') }}</a-tag
|
||||
>
|
||||
<a-tag :color="record.status === 1 ? 'green' : 'red'">
|
||||
{{ record.status === 1 ? $t('enable') : $t('disable') }}
|
||||
</a-tag>
|
||||
</template>
|
||||
<template #operate="{ record }">
|
||||
<a-space>
|
||||
@@ -35,7 +35,7 @@
|
||||
<template #content>
|
||||
<a-space direction="vertical">
|
||||
<a-button @click="handleToggleStatus(record.id, record.status)">
|
||||
{{ record.status == 1 ? $t('disable') : $t('enable') }}
|
||||
{{ record.status === 1 ? $t('disable') : $t('enable') }}
|
||||
</a-button>
|
||||
<a-button status="danger" @click="handleDel(record.id)">
|
||||
{{ $t('delete') }}
|
||||
@@ -48,7 +48,7 @@
|
||||
</DataTable>
|
||||
<contractNumberFormDrawer
|
||||
v-model:visible="showModal"
|
||||
:record="currentNumberInfo"
|
||||
:record="currentTermInfo"
|
||||
:is-edit="isEdit"
|
||||
@submitted="getTermsSettingListData"
|
||||
/>
|
||||
@@ -66,8 +66,7 @@
|
||||
disableTermsSetting,
|
||||
delTermsSetting,
|
||||
} from '@/api/setting';
|
||||
import { ContractTermInfo, UserStatus } from '@/types/setting';
|
||||
import { camelToSnake } from '@/utils/caseConvert';
|
||||
import { TermSettingItem, UserStatus } from '@/types/setting';
|
||||
import contractNumberFormDrawer from './drawer/contract-terms-form-drawer.vue';
|
||||
|
||||
const {
|
||||
@@ -89,10 +88,10 @@
|
||||
pageSizeOptions: [10, 20, 50, 100],
|
||||
});
|
||||
|
||||
const contractNumbeList = ref<ContractTermInfo[]>([]);
|
||||
const contractNumbeList = ref<TermSettingItem[]>([]);
|
||||
const showModal = ref<boolean>(false);
|
||||
const isEdit = ref<boolean>(false);
|
||||
const currentNumberInfo = ref<any>(null);
|
||||
const currentTermInfo = ref<any>(null);
|
||||
// 列配置
|
||||
const columns: TableColumnData[] = [
|
||||
{
|
||||
@@ -106,7 +105,6 @@
|
||||
title: '条款类别',
|
||||
dataIndex: 'type',
|
||||
key: 'type',
|
||||
// width: 250,
|
||||
ellipsis: true,
|
||||
render: ({ record }) => record.type || '-',
|
||||
},
|
||||
@@ -138,9 +136,9 @@
|
||||
setLoading(true);
|
||||
const { code, data } = await getTermsSettingList(params);
|
||||
if (code === 200 && data) {
|
||||
const { contractCodeSetting, page } = data;
|
||||
contractNumbeList.value = Array.isArray(contractCodeSetting)
|
||||
? contractCodeSetting
|
||||
const { contractTermsSetting, page } = data;
|
||||
contractNumbeList.value = Array.isArray(contractTermsSetting)
|
||||
? contractTermsSetting
|
||||
: [];
|
||||
setData(contractNumbeList.value);
|
||||
if (page?.total) setTotal(page?.total);
|
||||
@@ -190,22 +188,18 @@
|
||||
const getTermsSettingFromIdData = async (id: number) => {
|
||||
const { code, data } = await getTermsSettingFromId(id);
|
||||
if (code === 200 && data) {
|
||||
const { contractCodeSetting } = data;
|
||||
currentNumberInfo.value = contractCodeSetting || null;
|
||||
currentNumberInfo.value.arrange = camelToSnake(
|
||||
currentNumberInfo.value.arrange
|
||||
);
|
||||
const { contractTermsSetting } = data;
|
||||
currentTermInfo.value = contractTermsSetting || null;
|
||||
}
|
||||
};
|
||||
const handleAddContractNumber = () => {
|
||||
currentNumberInfo.value = null;
|
||||
currentTermInfo.value = null;
|
||||
isEdit.value = false;
|
||||
showModal.value = true;
|
||||
};
|
||||
const handleEditContractNumber = async (id: number) => {
|
||||
await getTermsSettingFromIdData(id);
|
||||
isEdit.value = true;
|
||||
// currentNumberInfo.value = info
|
||||
showModal.value = true;
|
||||
};
|
||||
// 初始化数据
|
||||
|
||||
@@ -25,38 +25,100 @@
|
||||
</a-form-item>
|
||||
<!-- 条款类别 -->
|
||||
<a-form-item label="条款类别" field="type" required>
|
||||
<a-select v-model="form.type">
|
||||
<a-select v-model="form.type" @change="onChangeFeeType">
|
||||
<a-option
|
||||
v-for="item in termsType"
|
||||
:key="item.type"
|
||||
:value="item.type"
|
||||
>{{ item.text }}</a-option
|
||||
v-for="item in feeTypeList"
|
||||
:key="item.value"
|
||||
:value="item.value"
|
||||
>{{ item.label }}</a-option
|
||||
>
|
||||
</a-select>
|
||||
</a-form-item>
|
||||
<!-- 条款项配置 -->
|
||||
<a-form-item label="条款项配置" required> </a-form-item>
|
||||
<a-form-item label="条款项配置" required>
|
||||
<a-space direction="vertical">
|
||||
<a-checkbox
|
||||
:model-value="form.is_fee === 1"
|
||||
@change="(val) => onCheckChange('is_fee', val)"
|
||||
>条款费项</a-checkbox
|
||||
>
|
||||
<a-space>
|
||||
<a-select
|
||||
v-model="form.finance_fee_id"
|
||||
:style="{ width: '200px' }"
|
||||
placeholder="请选择..."
|
||||
>
|
||||
<a-option
|
||||
v-for="item in financeFeeList"
|
||||
:key="item.id"
|
||||
:value="item.id"
|
||||
>{{ item.name }}</a-option
|
||||
>
|
||||
</a-select>
|
||||
<a-select
|
||||
v-model="form.finance_fee_periodicity"
|
||||
:style="{ width: '200px' }"
|
||||
:options="financeFeeFeriodicityList"
|
||||
placeholder="请选择..."
|
||||
/>
|
||||
</a-space>
|
||||
<a-checkbox
|
||||
style="margin-top: 10px"
|
||||
:model-value="form.is_bond === 1"
|
||||
@change="(val) => onCheckChange('is_bond', val)"
|
||||
>保证金项</a-checkbox
|
||||
>
|
||||
<a-select v-model="form.finance_bond_fee_id" placeholder="请选择...">
|
||||
<a-option
|
||||
v-for="item in financeBondFeeList"
|
||||
:key="item.id"
|
||||
:value="item.id"
|
||||
>{{ item.name }}</a-option
|
||||
>
|
||||
</a-select>
|
||||
<a-checkbox
|
||||
style="margin-top: 10px"
|
||||
:model-value="form.is_incremental === 1"
|
||||
@change="(val) => onCheckChange('is_incremental', val)"
|
||||
>递增项</a-checkbox
|
||||
>
|
||||
<a-checkbox
|
||||
:model-value="form.is_discount === 1"
|
||||
@change="(val) => onCheckChange('is_discount', val)"
|
||||
>优惠项</a-checkbox
|
||||
>
|
||||
<a-checkbox
|
||||
:model-value="form.is_late_fee === 1"
|
||||
@change="(val) => onCheckChange('is_late_fee', val)"
|
||||
>滞纳金</a-checkbox
|
||||
>
|
||||
</a-space>
|
||||
</a-form-item>
|
||||
</a-form>
|
||||
</a-drawer>
|
||||
</template>
|
||||
|
||||
<script lang="ts" setup>
|
||||
import { ref, watch, reactive } from 'vue';
|
||||
import { ref, watch, reactive, onMounted } from 'vue';
|
||||
import type { FormInstance } from '@arco-design/web-vue';
|
||||
import { Message } from '@arco-design/web-vue';
|
||||
import { createCodeSetting, updateCodeSetting } from '@/api/setting';
|
||||
import {
|
||||
createTermsSetting,
|
||||
updateTermsSetting,
|
||||
getUseFeeList,
|
||||
} from '@/api/setting';
|
||||
import { feeTypeList, financeFeeFeriodicityList } from '@/utils/constant';
|
||||
import {
|
||||
FeeManagementType,
|
||||
CreateTermSettingParam,
|
||||
FeeManagement,
|
||||
} from '@/types/setting';
|
||||
|
||||
const props = defineProps<{
|
||||
visible: boolean;
|
||||
isEdit: boolean;
|
||||
record?: any | null;
|
||||
}>();
|
||||
const termsType = [
|
||||
{ text: '租赁类', type: 1 },
|
||||
{ text: '物业类', type: 2 },
|
||||
{ text: '特殊类', type: 3 },
|
||||
{ text: '其他类', type: 4 },
|
||||
];
|
||||
const emit = defineEmits<{
|
||||
(e: 'update:visible', val: boolean): void;
|
||||
(e: 'submitted'): void;
|
||||
@@ -64,15 +126,25 @@
|
||||
|
||||
// 表单数据
|
||||
const formRef = ref<FormInstance>();
|
||||
const defaultForm: any = {
|
||||
name: '',
|
||||
type: 1,
|
||||
const defaultForm: CreateTermSettingParam = {
|
||||
name: '', // 名称
|
||||
type: 1, // 条款类型:1租赁类,2物业类,3特殊类,4其他类
|
||||
is_fee: 1, // 是否勾选费项:1是,2否
|
||||
finance_fee_id: null, // 财务费项id(除保证金外
|
||||
finance_fee_periodicity: 1, // 周期性:1周期性付款,2一次性付款
|
||||
is_bond: 2, // 是否勾选保证金:1是,2否
|
||||
finance_bond_fee_id: null, // 财务保证金费项id
|
||||
is_incremental: 2, // 是否勾选递增项:1是,2否
|
||||
is_discount: 2, // 是否勾选优惠项:1是,2否
|
||||
is_late_fee: 2, // 是否勾选滞纳金:1是,2否
|
||||
};
|
||||
const financeFeeList = ref<FeeManagement[]>([]);
|
||||
const financeBondFeeList = ref<FeeManagement[]>([]);
|
||||
const form = reactive<any>({ ...defaultForm });
|
||||
// 校验规则
|
||||
const rules = reactive({
|
||||
name: [{ required: true, message: '请输入合同编号' }],
|
||||
type: [{ required: true, message: '请选择编号回收规则' }],
|
||||
name: [{ required: true, message: '请输入条款名称' }],
|
||||
type: [{ required: true, message: '请选择条款类别' }],
|
||||
});
|
||||
|
||||
watch(
|
||||
@@ -80,9 +152,7 @@
|
||||
(val) => {
|
||||
if (val) {
|
||||
if (props.isEdit && props.record) {
|
||||
Object.assign(form, { ...props.record, ecycling: [] });
|
||||
if (props.record.cancelCodeRecycling === 1) form.ecycling.push(1);
|
||||
if (props.record.delCodeRecycling === 1) form.ecycling.push(2);
|
||||
Object.assign(form, props.record);
|
||||
} else {
|
||||
Object.assign(form, defaultForm);
|
||||
}
|
||||
@@ -90,22 +160,50 @@
|
||||
},
|
||||
{ immediate: true }
|
||||
);
|
||||
const onCheckChange = (field: string, value: boolean) => {
|
||||
form[field] = value ? 1 : 2;
|
||||
};
|
||||
const getUseFeeListData = async () => {
|
||||
const param = {
|
||||
fee_attribute: 1 as FeeManagementType,
|
||||
fee_type: form.type,
|
||||
};
|
||||
const { code, data } = await getUseFeeList(param);
|
||||
if (code === 200 && data) {
|
||||
const { list } = data;
|
||||
financeFeeList.value = list.filter((i) => i.isBond === 2);
|
||||
financeBondFeeList.value = list.filter((i) => i.isBond === 1);
|
||||
if (financeFeeList.value.length) {
|
||||
form.finance_fee_id = financeFeeList.value[0]?.id;
|
||||
} else {
|
||||
form.finance_fee_id = null;
|
||||
}
|
||||
}
|
||||
};
|
||||
const onChangeFeeType = () => {
|
||||
getUseFeeListData();
|
||||
};
|
||||
|
||||
const handleOk = async () => {
|
||||
try {
|
||||
const valid = await formRef.value.validate();
|
||||
if (valid) return;
|
||||
// 同步编号排序
|
||||
|
||||
const params = {
|
||||
...form,
|
||||
cancel_code_recycling: form.ecycling.includes(1) ? 1 : 0,
|
||||
del_code_recycling: form.ecycling.includes(2) ? 1 : 0,
|
||||
};
|
||||
delete params.ecycling;
|
||||
console.log('提交参数:', params);
|
||||
const { is_bond, is_fee, finance_bond_fee_id, finance_fee_id } = form;
|
||||
if (is_bond === 2 && is_fee === 2) {
|
||||
Message.info('请先选择条款类型(条款费项或者保证金项)');
|
||||
return;
|
||||
}
|
||||
if (is_fee === 1 && finance_fee_id === null) {
|
||||
Message.info('请先选择条款费项');
|
||||
return;
|
||||
}
|
||||
if (is_bond === 1 && finance_bond_fee_id === null) {
|
||||
Message.info('请先选择保证金项');
|
||||
return;
|
||||
}
|
||||
const res = props?.isEdit
|
||||
? await updateCodeSetting(params)
|
||||
: await createCodeSetting(params);
|
||||
? await updateTermsSetting(form)
|
||||
: await createTermsSetting(form);
|
||||
if (res?.code === 200) {
|
||||
Message.success(res?.message);
|
||||
emit('submitted');
|
||||
@@ -119,6 +217,9 @@
|
||||
const handleCancel = () => {
|
||||
emit('update:visible', false);
|
||||
};
|
||||
onMounted(() => {
|
||||
getUseFeeListData();
|
||||
});
|
||||
</script>
|
||||
|
||||
<style lang="less" scoped>
|
||||
|
||||
@@ -44,7 +44,7 @@
|
||||
:key="item.value"
|
||||
:value="item.value"
|
||||
>
|
||||
{{ item.text }}</a-option
|
||||
{{ item.label }}</a-option
|
||||
>
|
||||
</a-select>
|
||||
</a-form-item>
|
||||
@@ -76,6 +76,7 @@
|
||||
import { Message } from '@arco-design/web-vue';
|
||||
import { createFee, updateFee } from '@/api/setting';
|
||||
import { CreateFeeParams } from '@/types/setting';
|
||||
import { feeTypeList } from '@/utils/constant';
|
||||
|
||||
const props = defineProps<{
|
||||
visible: boolean;
|
||||
@@ -86,12 +87,6 @@
|
||||
(e: 'update:visible', val: boolean): void;
|
||||
(e: 'submitted'): void;
|
||||
}>();
|
||||
const feeTypeList = [
|
||||
{ value: 1, text: '租赁类' },
|
||||
{ value: 2, text: '物业类' },
|
||||
{ value: 3, text: '特殊类' },
|
||||
{ value: 4, text: '其他类' },
|
||||
];
|
||||
// 表单数据
|
||||
const formRef = ref<FormInstance>();
|
||||
const defaultForm: CreateFeeParams = {
|
||||
|
||||
Reference in New Issue
Block a user