feat: 更新业务需求
This commit is contained in:
@@ -65,6 +65,10 @@ export interface OrderChargeVO {
|
|||||||
* 收费状态
|
* 收费状态
|
||||||
*/
|
*/
|
||||||
chargeStatus: string | number;
|
chargeStatus: string | number;
|
||||||
|
/**
|
||||||
|
* 单位
|
||||||
|
*/
|
||||||
|
residentUnitId: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface OrderChargeForm extends BaseEntity {
|
export interface OrderChargeForm extends BaseEntity {
|
||||||
@@ -269,5 +273,5 @@ export interface orderChargeDetailForm extends BaseEntity {
|
|||||||
/**
|
/**
|
||||||
* 租赁单位
|
* 租赁单位
|
||||||
*/
|
*/
|
||||||
unitName?: string;
|
residentUnitText?: string;
|
||||||
}
|
}
|
||||||
|
@@ -12,9 +12,17 @@ import { requestClient } from '#/api/request';
|
|||||||
* @returns 绿植租赁-订单管理列表
|
* @returns 绿植租赁-订单管理列表
|
||||||
*/
|
*/
|
||||||
export function rentalOrderList(params?: RentalOrderQuery) {
|
export function rentalOrderList(params?: RentalOrderQuery) {
|
||||||
return requestClient.get<PageResult<RentalOrderVO>>('/property/rentalOrder/list', { params });
|
return requestClient.get<PageResult<RentalOrderVO>>(
|
||||||
|
'/property/rentalOrder/list',
|
||||||
|
{ params },
|
||||||
|
);
|
||||||
|
}
|
||||||
|
export function rentalNotSelectList(params?: RentalOrderQuery) {
|
||||||
|
return requestClient.get<PageResult<RentalOrderVO>>(
|
||||||
|
'/property/rentalOrder/notSelectList',
|
||||||
|
{ params },
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 导出绿植租赁-订单管理列表
|
* 导出绿植租赁-订单管理列表
|
||||||
* @param params
|
* @param params
|
||||||
|
@@ -89,7 +89,7 @@ export interface RentalOrderVO {
|
|||||||
/**
|
/**
|
||||||
* 单位名称
|
* 单位名称
|
||||||
*/
|
*/
|
||||||
unitName: string;
|
residentUnitText: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface RentalOrderForm extends BaseEntity {
|
export interface RentalOrderForm extends BaseEntity {
|
||||||
|
@@ -185,33 +185,14 @@ export const modalSchema: FormSchemaGetter = () => [
|
|||||||
api: rentalOrderList,
|
api: rentalOrderList,
|
||||||
resultField: 'rows',
|
resultField: 'rows',
|
||||||
labelField: 'orderNo',
|
labelField: 'orderNo',
|
||||||
valueField: 'id',
|
|
||||||
},
|
},
|
||||||
rules: 'required',
|
rules: 'required',
|
||||||
},
|
},
|
||||||
// {
|
|
||||||
// label: '租赁人ID',
|
|
||||||
// fieldName: 'userId',
|
|
||||||
// component: 'ApiSelect',
|
|
||||||
// componentProps: {
|
|
||||||
// api: rentalOrderList,
|
|
||||||
// resultField: 'rows',
|
|
||||||
// labelField: 'customerName',
|
|
||||||
// valueField: 'id',
|
|
||||||
// },
|
|
||||||
// rules: 'required',
|
|
||||||
// },
|
|
||||||
{
|
|
||||||
label: '租赁人',
|
|
||||||
fieldName: 'userName',
|
|
||||||
component: 'Select',
|
|
||||||
rules: 'selectRequired',
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
component: 'ApiSelect',
|
component: 'ApiSelect',
|
||||||
fieldName: 'unitId',
|
fieldName: 'residentUnitId',
|
||||||
label: '租赁单位',
|
label: '租赁单位',
|
||||||
componentProps: {
|
componentProps: () => ({
|
||||||
api: getUnitList,
|
api: getUnitList,
|
||||||
resultField: 'data',
|
resultField: 'data',
|
||||||
labelField: 'label',
|
labelField: 'label',
|
||||||
@@ -219,11 +200,20 @@ export const modalSchema: FormSchemaGetter = () => [
|
|||||||
immediate: true,
|
immediate: true,
|
||||||
debounceTime: 500,
|
debounceTime: 500,
|
||||||
allowClear: true,
|
allowClear: true,
|
||||||
placeholder: '请选择租赁单位',
|
placeholder: '',
|
||||||
filterOption: true,
|
filterOption: true,
|
||||||
|
}),
|
||||||
|
|
||||||
|
rules: 'selectRequired',
|
||||||
|
disabled: true,
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
label: '租赁人',
|
||||||
|
fieldName: 'userName',
|
||||||
|
component: 'Select',
|
||||||
rules: 'selectRequired',
|
rules: 'selectRequired',
|
||||||
},
|
},
|
||||||
|
|
||||||
{
|
{
|
||||||
label: '租金',
|
label: '租金',
|
||||||
fieldName: 'rent',
|
fieldName: 'rent',
|
||||||
|
@@ -56,7 +56,7 @@ async function handleOpenChange(open: boolean) {
|
|||||||
{{ orderChargeDetail.userName }}
|
{{ orderChargeDetail.userName }}
|
||||||
</DescriptionsItem>
|
</DescriptionsItem>
|
||||||
<DescriptionsItem label="租赁单位">
|
<DescriptionsItem label="租赁单位">
|
||||||
{{ orderChargeDetail.unitName }}
|
{{ orderChargeDetail.residentUnitText }}
|
||||||
</DescriptionsItem>
|
</DescriptionsItem>
|
||||||
<DescriptionsItem label="租金">
|
<DescriptionsItem label="租金">
|
||||||
{{ orderChargeDetail.rent }}
|
{{ orderChargeDetail.rent }}
|
||||||
|
@@ -4,10 +4,18 @@ import { useVbenModal } from '@vben/common-ui';
|
|||||||
import { $t } from '@vben/locales';
|
import { $t } from '@vben/locales';
|
||||||
import { cloneDeep } from '@vben/utils';
|
import { cloneDeep } from '@vben/utils';
|
||||||
import { useVbenForm } from '#/adapter/form';
|
import { useVbenForm } from '#/adapter/form';
|
||||||
import { orderChargeAdd, orderChargeInfo, orderChargeUpdate } from '#/api/property/chargeManagement';
|
import {
|
||||||
|
orderChargeAdd,
|
||||||
|
orderChargeInfo,
|
||||||
|
orderChargeUpdate,
|
||||||
|
} from '#/api/property/chargeManagement';
|
||||||
import { defaultFormValueGetter, useBeforeCloseDiff } from '#/utils/popup';
|
import { defaultFormValueGetter, useBeforeCloseDiff } from '#/utils/popup';
|
||||||
import { modalSchema } from './data';
|
// import { modalSchema } from './data';
|
||||||
import QueryUserList from "#/views/property/greenPlantRentalManagement/chargeManagement/query-user-list.vue";
|
import QueryUserList from '#/views/property/greenPlantRentalManagement/chargeManagement/query-user-list.vue';
|
||||||
|
import { resident_unitList } from '#/api/property/resident/unit';
|
||||||
|
import type { FormSchemaGetter } from '#/adapter/form';
|
||||||
|
import { rentalNotSelectList } from '#/api/property/rentalOrder';
|
||||||
|
import { getDictOptions } from '#/utils/dict';
|
||||||
|
|
||||||
const emit = defineEmits<{ reload: [] }>();
|
const emit = defineEmits<{ reload: [] }>();
|
||||||
const isUpdate = ref(false);
|
const isUpdate = ref(false);
|
||||||
@@ -15,16 +23,167 @@ const isUpdate = ref(false);
|
|||||||
const title = computed(() => {
|
const title = computed(() => {
|
||||||
return isUpdate.value ? $t('pages.common.edit') : '添加收费';
|
return isUpdate.value ? $t('pages.common.edit') : '添加收费';
|
||||||
});
|
});
|
||||||
|
const modalSchema = [
|
||||||
|
{
|
||||||
|
label: '主键',
|
||||||
|
fieldName: 'id',
|
||||||
|
component: 'Input',
|
||||||
|
dependencies: {
|
||||||
|
show: () => false,
|
||||||
|
triggerFields: [''],
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: '订单号',
|
||||||
|
fieldName: 'orderId',
|
||||||
|
component: 'ApiSelect',
|
||||||
|
componentProps: {
|
||||||
|
api: rentalNotSelectList,
|
||||||
|
resultField: 'rows',
|
||||||
|
labelField: 'orderNo',
|
||||||
|
valueField: 'id',
|
||||||
|
onChange: async (value: string, option: any) => {
|
||||||
|
await formApi.setValues({
|
||||||
|
residentUnitId: option.residentUnitId, // 假设订单数据中有 residentUnitId 字段
|
||||||
|
// 其他需要自动填充的字段
|
||||||
|
});
|
||||||
|
},
|
||||||
|
},
|
||||||
|
disabled: isUpdate.value ? true : false,
|
||||||
|
rules: 'required',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
component: 'ApiSelect',
|
||||||
|
fieldName: 'residentUnitId',
|
||||||
|
label: '租赁单位',
|
||||||
|
componentProps: () => ({
|
||||||
|
api: getUnitList,
|
||||||
|
resultField: 'data',
|
||||||
|
labelField: 'label',
|
||||||
|
valueField: 'value',
|
||||||
|
immediate: true,
|
||||||
|
debounceTime: 500,
|
||||||
|
allowClear: true,
|
||||||
|
placeholder: '',
|
||||||
|
filterOption: true,
|
||||||
|
}),
|
||||||
|
|
||||||
|
rules: 'selectRequired',
|
||||||
|
disabled: true,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: '租赁人',
|
||||||
|
fieldName: 'userName',
|
||||||
|
component: 'Select',
|
||||||
|
rules: 'selectRequired',
|
||||||
|
},
|
||||||
|
|
||||||
|
{
|
||||||
|
label: '租金',
|
||||||
|
fieldName: 'rent',
|
||||||
|
component: 'InputNumber',
|
||||||
|
rules: 'required',
|
||||||
|
componentProps: {
|
||||||
|
precision: 2,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: '押金',
|
||||||
|
fieldName: 'deposit',
|
||||||
|
component: 'InputNumber',
|
||||||
|
rules: 'required',
|
||||||
|
componentProps: {
|
||||||
|
precision: 2,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: '违约金',
|
||||||
|
fieldName: 'penalty',
|
||||||
|
component: 'InputNumber',
|
||||||
|
rules: 'required',
|
||||||
|
componentProps: {
|
||||||
|
precision: 2,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
// {
|
||||||
|
// label: '总金额',
|
||||||
|
// fieldName: 'totalAmount',
|
||||||
|
// component: 'Input',
|
||||||
|
// rules: 'required',
|
||||||
|
// },
|
||||||
|
{
|
||||||
|
label: '开票状态',
|
||||||
|
fieldName: 'invoiceStatus',
|
||||||
|
component: 'Select',
|
||||||
|
componentProps: {
|
||||||
|
options: getDictOptions('pro_invoice_status'),
|
||||||
|
},
|
||||||
|
rules: 'selectRequired',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: '发票类型',
|
||||||
|
fieldName: 'invoiceType',
|
||||||
|
component: 'Select',
|
||||||
|
componentProps: {
|
||||||
|
options: getDictOptions('pro_invoice_type'),
|
||||||
|
},
|
||||||
|
rules: 'selectRequired',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: '收费状态',
|
||||||
|
fieldName: 'chargeStatus',
|
||||||
|
component: 'Select',
|
||||||
|
componentProps: {
|
||||||
|
options: getDictOptions('pro_charging_status'),
|
||||||
|
},
|
||||||
|
rules: 'selectRequired',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: '支付方式',
|
||||||
|
fieldName: 'paymentMethod',
|
||||||
|
component: 'Select',
|
||||||
|
componentProps: {
|
||||||
|
options: getDictOptions('pro_payment_method'),
|
||||||
|
},
|
||||||
|
rules: 'selectRequired',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: '收费日期',
|
||||||
|
fieldName: 'chargeDate',
|
||||||
|
component: 'DatePicker',
|
||||||
|
componentProps: {
|
||||||
|
showTime: true,
|
||||||
|
format: 'YYYY-MM-DD HH:mm:ss',
|
||||||
|
valueFormat: 'YYYY-MM-DD HH:mm:ss',
|
||||||
|
},
|
||||||
|
rules: 'required',
|
||||||
|
},
|
||||||
|
];
|
||||||
|
async function getUnitList() {
|
||||||
|
const queryParam = {
|
||||||
|
pageNum: 1,
|
||||||
|
pageSize: 1000,
|
||||||
|
};
|
||||||
|
const res = await resident_unitList(queryParam);
|
||||||
|
const data: { value: number; label: string }[] = [];
|
||||||
|
|
||||||
|
res.rows.forEach((r: any) => {
|
||||||
|
data.push({
|
||||||
|
value: r.id,
|
||||||
|
label: r.name,
|
||||||
|
});
|
||||||
|
});
|
||||||
|
return data;
|
||||||
|
}
|
||||||
const [BasicForm, formApi] = useVbenForm({
|
const [BasicForm, formApi] = useVbenForm({
|
||||||
commonConfig: {
|
commonConfig: {
|
||||||
formItemClass: 'col-span-1',
|
formItemClass: 'col-span-1',
|
||||||
labelWidth: 80,
|
labelWidth: 80,
|
||||||
componentProps: {
|
componentProps: {
|
||||||
class: 'w-full',
|
class: 'w-full',
|
||||||
}
|
|
||||||
},
|
},
|
||||||
schema: modalSchema(),
|
},
|
||||||
|
schema: modalSchema,
|
||||||
showDefaultActions: false,
|
showDefaultActions: false,
|
||||||
wrapperClass: 'grid-cols-2',
|
wrapperClass: 'grid-cols-2',
|
||||||
});
|
});
|
||||||
@@ -55,6 +214,8 @@ const [BasicModal, modalApi] = useVbenModal({
|
|||||||
record.paymentMethod = record.paymentMethod?.toString();
|
record.paymentMethod = record.paymentMethod?.toString();
|
||||||
record.invoiceType = record.invoiceType?.toString();
|
record.invoiceType = record.invoiceType?.toString();
|
||||||
record.invoiceStatus = record.invoiceStatus?.toString();
|
record.invoiceStatus = record.invoiceStatus?.toString();
|
||||||
|
record.orderId = record.orderId;
|
||||||
|
record.residentUnitId = record.residentUnitId;
|
||||||
await formApi.setValues(record);
|
await formApi.setValues(record);
|
||||||
}
|
}
|
||||||
await markInitialized();
|
await markInitialized();
|
||||||
@@ -71,8 +232,8 @@ async function handleConfirm() {
|
|||||||
}
|
}
|
||||||
const data = cloneDeep(await formApi.getValues());
|
const data = cloneDeep(await formApi.getValues());
|
||||||
if (userInfo) {
|
if (userInfo) {
|
||||||
data.userId = userInfo.userId
|
data.userId = userInfo.userId;
|
||||||
data.userName = userInfo.userName
|
data.userName = userInfo.userName;
|
||||||
}
|
}
|
||||||
await (isUpdate.value ? orderChargeUpdate(data) : orderChargeAdd(data));
|
await (isUpdate.value ? orderChargeUpdate(data) : orderChargeAdd(data));
|
||||||
resetInitialized();
|
resetInitialized();
|
||||||
@@ -102,9 +263,13 @@ async function handleClosed() {
|
|||||||
<BasicModal :title="title">
|
<BasicModal :title="title">
|
||||||
<BasicForm>
|
<BasicForm>
|
||||||
<template #userName="slotProps">
|
<template #userName="slotProps">
|
||||||
<QueryUserList @update:userInfo="getUserInfo" v-bind="slotProps" :isUpdate="isUpdate" :userName="userName"/>
|
<QueryUserList
|
||||||
|
@update:userInfo="getUserInfo"
|
||||||
|
v-bind="slotProps"
|
||||||
|
:isUpdate="isUpdate"
|
||||||
|
:userName="userName"
|
||||||
|
/>
|
||||||
</template>
|
</template>
|
||||||
</BasicForm>
|
</BasicForm>
|
||||||
</BasicModal>
|
</BasicModal>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
|
@@ -67,7 +67,7 @@ async function handleOpenChange(open: boolean) {
|
|||||||
<component :is="renderDict(orderDetail.customerType, 'wy_khlx')" />
|
<component :is="renderDict(orderDetail.customerType, 'wy_khlx')" />
|
||||||
</DescriptionsItem>
|
</DescriptionsItem>
|
||||||
<DescriptionsItem label="租赁单位">
|
<DescriptionsItem label="租赁单位">
|
||||||
{{ orderDetail.unitName }}
|
{{ orderDetail.residentUnitText }}
|
||||||
</DescriptionsItem>
|
</DescriptionsItem>
|
||||||
<DescriptionsItem label="租赁周期">
|
<DescriptionsItem label="租赁周期">
|
||||||
{{ orderDetail.rentalPeriod }}
|
{{ orderDetail.rentalPeriod }}
|
||||||
|
@@ -9,18 +9,18 @@ import {useVbenForm} from '#/adapter/form';
|
|||||||
import {
|
import {
|
||||||
rentalOrderAdd,
|
rentalOrderAdd,
|
||||||
rentalOrderInfo,
|
rentalOrderInfo,
|
||||||
rentalOrderUpdate
|
rentalOrderUpdate,
|
||||||
} from '#/api/property/rentalOrder';
|
} from '#/api/property/rentalOrder';
|
||||||
import { defaultFormValueGetter, useBeforeCloseDiff } from '#/utils/popup';
|
import { defaultFormValueGetter, useBeforeCloseDiff } from '#/utils/popup';
|
||||||
|
|
||||||
import {plantsProductList} from "#/api/property/productManagement";
|
import { plantsProductList } from '#/api/property/productManagement';
|
||||||
import {rentalPlanInfo, rentalPlanList} from "#/api/property/rentalPlan";
|
import { rentalPlanInfo, rentalPlanList } from '#/api/property/rentalPlan';
|
||||||
import {getDictOptions} from "#/utils/dict";
|
import { getDictOptions } from '#/utils/dict';
|
||||||
import type {PropertyVO} from "#/api/property/productManagement/model";
|
import type { PropertyVO } from '#/api/property/productManagement/model';
|
||||||
import type {RentalPlanVO} from "#/api/property/rentalPlan/model";
|
import type { RentalPlanVO } from '#/api/property/rentalPlan/model';
|
||||||
import { planInfoColumns } from './data';
|
import { planInfoColumns } from './data';
|
||||||
import {Table} from "ant-design-vue";
|
import { Table } from 'ant-design-vue';
|
||||||
import { resident_unitList } from '#/api/property/resident/unit'
|
import { resident_unitList } from '#/api/property/resident/unit';
|
||||||
|
|
||||||
const emit = defineEmits<{ reload: [] }>();
|
const emit = defineEmits<{ reload: [] }>();
|
||||||
|
|
||||||
@@ -55,13 +55,13 @@ const modalSchema = [
|
|||||||
fieldName: 'customerType',
|
fieldName: 'customerType',
|
||||||
component: 'Select',
|
component: 'Select',
|
||||||
componentProps: {
|
componentProps: {
|
||||||
options: getDictOptions('wy_khlx')
|
options: getDictOptions('wy_khlx'),
|
||||||
},
|
},
|
||||||
rules: 'selectRequired',
|
rules: 'selectRequired',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
component: 'ApiSelect',
|
component: 'ApiSelect',
|
||||||
fieldName: 'unitId',
|
fieldName: 'residentUnitId',
|
||||||
label: '租赁单位',
|
label: '租赁单位',
|
||||||
componentProps: {
|
componentProps: {
|
||||||
api: getUnitList,
|
api: getUnitList,
|
||||||
@@ -81,7 +81,7 @@ const modalSchema = [
|
|||||||
fieldName: 'rentalPeriod',
|
fieldName: 'rentalPeriod',
|
||||||
component: 'Select',
|
component: 'Select',
|
||||||
componentProps: {
|
componentProps: {
|
||||||
options: getDictOptions('wy_time_unit')
|
options: getDictOptions('wy_time_unit'),
|
||||||
},
|
},
|
||||||
rules: 'selectRequired',
|
rules: 'selectRequired',
|
||||||
},
|
},
|
||||||
@@ -101,10 +101,10 @@ const modalSchema = [
|
|||||||
fieldName: 'rentalType',
|
fieldName: 'rentalType',
|
||||||
component: 'Select',
|
component: 'Select',
|
||||||
componentProps: {
|
componentProps: {
|
||||||
options: getDictOptions('wy_zlfs')
|
options: getDictOptions('wy_zlfs'),
|
||||||
},
|
},
|
||||||
rules: 'selectRequired',
|
rules: 'selectRequired',
|
||||||
formItemClass: 'col-span-2'
|
formItemClass: 'col-span-2',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
label: '租赁方案',
|
label: '租赁方案',
|
||||||
@@ -119,20 +119,24 @@ const modalSchema = [
|
|||||||
formItemClass: 'col-span-2',
|
formItemClass: 'col-span-2',
|
||||||
componentProps: {
|
componentProps: {
|
||||||
api: async () => {
|
api: async () => {
|
||||||
const res = await rentalPlanList({pageNum: 1, pageSize: 1000, state: 1});
|
const res = await rentalPlanList({
|
||||||
|
pageNum: 1,
|
||||||
|
pageSize: 1000,
|
||||||
|
state: 1,
|
||||||
|
});
|
||||||
planList.value = res.rows || [];
|
planList.value = res.rows || [];
|
||||||
return planList.value.map(item => ({
|
return planList.value.map((item) => ({
|
||||||
label: item.planName,
|
label: item.planName,
|
||||||
value: item.id,
|
value: item.id,
|
||||||
}));
|
}));
|
||||||
},
|
},
|
||||||
onChange: async (value: string) => {
|
onChange: async (value: string) => {
|
||||||
await getPlanProducts(value)
|
await getPlanProducts(value);
|
||||||
},
|
},
|
||||||
showSearch: true,
|
showSearch: true,
|
||||||
filterOption: (input: any, option: any) =>
|
filterOption: (input: any, option: any) =>
|
||||||
option.label.toLowerCase().includes(input.toLowerCase()),
|
option.label.toLowerCase().includes(input.toLowerCase()),
|
||||||
}
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
label: '方案详情',
|
label: '方案详情',
|
||||||
@@ -141,7 +145,8 @@ const modalSchema = [
|
|||||||
slots: { default: 'planInfo' },
|
slots: { default: 'planInfo' },
|
||||||
dependencies: {
|
dependencies: {
|
||||||
// 仅当 租赁方式 为 2(套餐) 时显示
|
// 仅当 租赁方式 为 2(套餐) 时显示
|
||||||
show: (formValues: any) => formValues.rentalType === '2' && formValues.planId != null,
|
show: (formValues: any) =>
|
||||||
|
formValues.rentalType === '2' && formValues.planId != null,
|
||||||
triggerFields: ['planId', 'rentalType'],
|
triggerFields: ['planId', 'rentalType'],
|
||||||
},
|
},
|
||||||
formItemClass: 'col-span-2',
|
formItemClass: 'col-span-2',
|
||||||
@@ -159,17 +164,29 @@ const modalSchema = [
|
|||||||
formItemClass: 'col-span-2',
|
formItemClass: 'col-span-2',
|
||||||
componentProps: {
|
componentProps: {
|
||||||
api: async () => {
|
api: async () => {
|
||||||
const res = await plantsProductList({pageNum: 1, pageSize: 1000, inventory: 0});
|
const res = await plantsProductList({
|
||||||
|
pageNum: 1,
|
||||||
|
pageSize: 1000,
|
||||||
|
inventory: 0,
|
||||||
|
});
|
||||||
plantsList.value = res.rows || [];
|
plantsList.value = res.rows || [];
|
||||||
return plantsList.value.map(item => ({
|
return plantsList.value.map((item) => ({
|
||||||
label: item.plantName + '-' + item.plantCode + '\xa0\xa0租金(元):' + item.rent + '\xa0\xa0库存数量:' + item.inventory,
|
label:
|
||||||
|
item.plantName +
|
||||||
|
'-' +
|
||||||
|
item.plantCode +
|
||||||
|
'\xa0\xa0租金(元):' +
|
||||||
|
item.rent +
|
||||||
|
'\xa0\xa0库存数量:' +
|
||||||
|
item.inventory,
|
||||||
value: item.id,
|
value: item.id,
|
||||||
}));
|
}));
|
||||||
},
|
},
|
||||||
onChange: async (value: string) => {
|
onChange: async (value: string) => {
|
||||||
plantInfo.value = plantsList.value.find(item => item.id === value);
|
plantInfo.value = plantsList.value.find((item) => item.id === value);
|
||||||
if (plantInfo.value) {
|
if (plantInfo.value) {
|
||||||
formApi.updateSchema([{
|
formApi.updateSchema([
|
||||||
|
{
|
||||||
componentProps: () => ({
|
componentProps: () => ({
|
||||||
min: 1,
|
min: 1,
|
||||||
max: plantInfo.value?.inventory,
|
max: plantInfo.value?.inventory,
|
||||||
@@ -177,18 +194,21 @@ const modalSchema = [
|
|||||||
onChange: async () => {
|
onChange: async () => {
|
||||||
const formValues = await formApi.getValues();
|
const formValues = await formApi.getValues();
|
||||||
if (formValues.productNum && plantInfo.value?.rent) {
|
if (formValues.productNum && plantInfo.value?.rent) {
|
||||||
singleAmount.value = (plantInfo.value.rent * formValues.productNum).toFixed(2);
|
singleAmount.value = (
|
||||||
|
plantInfo.value.rent * formValues.productNum
|
||||||
|
).toFixed(2);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
}),
|
}),
|
||||||
fieldName: 'productNum',
|
fieldName: 'productNum',
|
||||||
}])
|
},
|
||||||
|
]);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
showSearch: true,
|
showSearch: true,
|
||||||
filterOption: (input: any, option: any) =>
|
filterOption: (input: any, option: any) =>
|
||||||
option.label.toLowerCase().includes(input.toLowerCase()),
|
option.label.toLowerCase().includes(input.toLowerCase()),
|
||||||
}
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
label: '租赁数量',
|
label: '租赁数量',
|
||||||
@@ -219,11 +239,14 @@ const modalSchema = [
|
|||||||
slots: { default: 'totalAmount' },
|
slots: { default: 'totalAmount' },
|
||||||
dependencies: {
|
dependencies: {
|
||||||
// 仅当 租赁方式 为 1(单点) 时显示
|
// 仅当 租赁方式 为 1(单点) 时显示
|
||||||
show: (formValues: any) => formValues.productNum && formValues.productId && formValues.rentalType === '1',
|
show: (formValues: any) =>
|
||||||
|
formValues.productNum &&
|
||||||
|
formValues.productId &&
|
||||||
|
formValues.rentalType === '1',
|
||||||
triggerFields: ['productNum', 'rentalType'],
|
triggerFields: ['productNum', 'rentalType'],
|
||||||
disabled: true,
|
disabled: true,
|
||||||
},
|
},
|
||||||
labelWidth: 110
|
labelWidth: 110,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
label: '是否续租',
|
label: '是否续租',
|
||||||
@@ -234,7 +257,7 @@ const modalSchema = [
|
|||||||
optionType: 'button',
|
optionType: 'button',
|
||||||
options: getDictOptions('wy_sf'),
|
options: getDictOptions('wy_sf'),
|
||||||
},
|
},
|
||||||
rules: 'required'
|
rules: 'required',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
label: '合同状态',
|
label: '合同状态',
|
||||||
@@ -243,17 +266,18 @@ const modalSchema = [
|
|||||||
componentProps: {
|
componentProps: {
|
||||||
options: getDictOptions('wy_htzt'),
|
options: getDictOptions('wy_htzt'),
|
||||||
},
|
},
|
||||||
rules: 'selectRequired'
|
rules: 'selectRequired',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
label: '合同编号',
|
label: '合同编号',
|
||||||
fieldName: 'contractCode',
|
fieldName: 'contractCode',
|
||||||
component: 'Input',
|
component: 'Input',
|
||||||
dependencies: {
|
dependencies: {
|
||||||
show: (formValues: any) => formValues.contractStatus != null && formValues.contractStatus != 1,
|
show: (formValues: any) =>
|
||||||
|
formValues.contractStatus != null && formValues.contractStatus != 1,
|
||||||
triggerFields: ['contractStatus'],
|
triggerFields: ['contractStatus'],
|
||||||
},
|
},
|
||||||
rules: 'required'
|
rules: 'required',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
label: '签署时间',
|
label: '签署时间',
|
||||||
@@ -265,10 +289,11 @@ const modalSchema = [
|
|||||||
valueFormat: 'YYYY-MM-DD',
|
valueFormat: 'YYYY-MM-DD',
|
||||||
},
|
},
|
||||||
dependencies: {
|
dependencies: {
|
||||||
show: (formValues: any) => formValues.contractStatus != null && formValues.contractStatus != 1,
|
show: (formValues: any) =>
|
||||||
|
formValues.contractStatus != null && formValues.contractStatus != 1,
|
||||||
triggerFields: ['contractStatus'],
|
triggerFields: ['contractStatus'],
|
||||||
},
|
},
|
||||||
rules: 'required'
|
rules: 'required',
|
||||||
},
|
},
|
||||||
];
|
];
|
||||||
const [BasicForm, formApi] = useVbenForm({
|
const [BasicForm, formApi] = useVbenForm({
|
||||||
@@ -280,14 +305,13 @@ const [BasicForm, formApi] = useVbenForm({
|
|||||||
// 通用配置项 会影响到所有表单项
|
// 通用配置项 会影响到所有表单项
|
||||||
componentProps: {
|
componentProps: {
|
||||||
class: 'w-full',
|
class: 'w-full',
|
||||||
}
|
},
|
||||||
},
|
},
|
||||||
schema: modalSchema,
|
schema: modalSchema,
|
||||||
showDefaultActions: false,
|
showDefaultActions: false,
|
||||||
wrapperClass: 'grid-cols-2',
|
wrapperClass: 'grid-cols-2',
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
const { onBeforeClose, markInitialized, resetInitialized } = useBeforeCloseDiff(
|
const { onBeforeClose, markInitialized, resetInitialized } = useBeforeCloseDiff(
|
||||||
{
|
{
|
||||||
initializedGetter: defaultFormValueGetter(formApi),
|
initializedGetter: defaultFormValueGetter(formApi),
|
||||||
@@ -322,16 +346,16 @@ async function getUnitList(){
|
|||||||
const queryParam = {
|
const queryParam = {
|
||||||
pageNum: 1,
|
pageNum: 1,
|
||||||
pageSize: 1000,
|
pageSize: 1000,
|
||||||
}
|
};
|
||||||
const res = await resident_unitList(queryParam)
|
const res = await resident_unitList(queryParam);
|
||||||
const data: { value: number; label: string }[] = []
|
const data: { value: number; label: string }[] = [];
|
||||||
|
|
||||||
res.rows.forEach((r: any) => {
|
res.rows.forEach((r: any) => {
|
||||||
data.push({
|
data.push({
|
||||||
value: r.id,
|
value: r.id,
|
||||||
label: r.name,
|
label: r.name,
|
||||||
})
|
});
|
||||||
})
|
});
|
||||||
return data;
|
return data;
|
||||||
}
|
}
|
||||||
async function handleConfirm() {
|
async function handleConfirm() {
|
||||||
@@ -345,18 +369,18 @@ async function handleConfirm() {
|
|||||||
const data = cloneDeep(await formApi.getValues());
|
const data = cloneDeep(await formApi.getValues());
|
||||||
if (data.rentalType == 1) {
|
if (data.rentalType == 1) {
|
||||||
data.planId = undefined;
|
data.planId = undefined;
|
||||||
data.totalAmount = singleAmount.value
|
data.totalAmount = singleAmount.value;
|
||||||
} else {
|
} else {
|
||||||
data.productId = undefined;
|
data.productId = undefined;
|
||||||
data.productNum = undefined;
|
data.productNum = undefined;
|
||||||
data.productList = planProducts.value
|
data.productList = planProducts.value;
|
||||||
data.totalAmount = totalAmount.value
|
data.totalAmount = totalAmount.value;
|
||||||
}
|
}
|
||||||
if (data.rentalTime) {
|
if (data.rentalTime) {
|
||||||
data.startTime = data.rentalTime[0];
|
data.startTime = data.rentalTime[0];
|
||||||
data.endTime = data.rentalTime[1];
|
data.endTime = data.rentalTime[1];
|
||||||
}
|
}
|
||||||
data.paymentStatus = 0
|
data.paymentStatus = 0;
|
||||||
await (isUpdate.value ? rentalOrderUpdate(data) : rentalOrderAdd(data));
|
await (isUpdate.value ? rentalOrderUpdate(data) : rentalOrderAdd(data));
|
||||||
resetInitialized();
|
resetInitialized();
|
||||||
emit('reload');
|
emit('reload');
|
||||||
@@ -370,22 +394,22 @@ async function handleConfirm() {
|
|||||||
|
|
||||||
//获取有库存的绿植
|
//获取有库存的绿植
|
||||||
async function getPlanProducts(id: string) {
|
async function getPlanProducts(id: string) {
|
||||||
const res = await rentalPlanInfo(id)
|
const res = await rentalPlanInfo(id);
|
||||||
planProducts.value = res.productList.map(item => ({
|
planProducts.value = res.productList.map((item) => ({
|
||||||
id: item.productId,
|
id: item.productId,
|
||||||
plantName: item.product?.plantName,
|
plantName: item.product?.plantName,
|
||||||
rent: item.product?.rent,
|
rent: item.product?.rent,
|
||||||
inventory: item.productNum,
|
inventory: item.productNum,
|
||||||
}))
|
}));
|
||||||
totalAmount.value = planProducts.value?.reduce((sum, item: any) => sum + (item.rent * item.inventory), 0).toFixed(2)
|
totalAmount.value = planProducts.value
|
||||||
|
?.reduce((sum, item: any) => sum + item.rent * item.inventory, 0)
|
||||||
|
.toFixed(2);
|
||||||
}
|
}
|
||||||
|
|
||||||
async function handleClosed() {
|
async function handleClosed() {
|
||||||
await formApi.resetForm();
|
await formApi.resetForm();
|
||||||
resetInitialized();
|
resetInitialized();
|
||||||
}
|
}
|
||||||
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
@@ -393,8 +417,13 @@ async function handleClosed() {
|
|||||||
<BasicForm>
|
<BasicForm>
|
||||||
<template #planInfo="slotProps">
|
<template #planInfo="slotProps">
|
||||||
<div v-if="planProducts.length" style="width: 100%" v-bind="slotProps">
|
<div v-if="planProducts.length" style="width: 100%" v-bind="slotProps">
|
||||||
<Table :dataSource="planProducts" :columns="planInfoColumns" :pagination="false"
|
<Table
|
||||||
bordered size="small">
|
:dataSource="planProducts"
|
||||||
|
:columns="planInfoColumns"
|
||||||
|
:pagination="false"
|
||||||
|
bordered
|
||||||
|
size="small"
|
||||||
|
>
|
||||||
<template #bodyCell="{ column, record, index }">
|
<template #bodyCell="{ column, record, index }">
|
||||||
<template v-if="column.field === 'id'">
|
<template v-if="column.field === 'id'">
|
||||||
{{ index + 1 }}
|
{{ index + 1 }}
|
||||||
@@ -418,4 +447,3 @@ async function handleClosed() {
|
|||||||
</BasicForm>
|
</BasicForm>
|
||||||
</BasicModal>
|
</BasicModal>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user