feat: 更新业务需求
This commit is contained in:
@@ -65,6 +65,10 @@ export interface OrderChargeVO {
|
||||
* 收费状态
|
||||
*/
|
||||
chargeStatus: string | number;
|
||||
/**
|
||||
* 单位
|
||||
*/
|
||||
residentUnitId: string;
|
||||
}
|
||||
|
||||
export interface OrderChargeForm extends BaseEntity {
|
||||
@@ -269,5 +273,5 @@ export interface orderChargeDetailForm extends BaseEntity {
|
||||
/**
|
||||
* 租赁单位
|
||||
*/
|
||||
unitName?: string;
|
||||
residentUnitText?: string;
|
||||
}
|
||||
|
@@ -7,14 +7,22 @@ import { commonExport } from '#/api/helper';
|
||||
import { requestClient } from '#/api/request';
|
||||
|
||||
/**
|
||||
* 查询绿植租赁-订单管理列表
|
||||
* @param params
|
||||
* @returns 绿植租赁-订单管理列表
|
||||
*/
|
||||
* 查询绿植租赁-订单管理列表
|
||||
* @param params
|
||||
* @returns 绿植租赁-订单管理列表
|
||||
*/
|
||||
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
|
||||
|
@@ -89,7 +89,7 @@ export interface RentalOrderVO {
|
||||
/**
|
||||
* 单位名称
|
||||
*/
|
||||
unitName: string;
|
||||
residentUnitText: string;
|
||||
}
|
||||
|
||||
export interface RentalOrderForm extends BaseEntity {
|
||||
|
@@ -185,33 +185,14 @@ export const modalSchema: FormSchemaGetter = () => [
|
||||
api: rentalOrderList,
|
||||
resultField: 'rows',
|
||||
labelField: 'orderNo',
|
||||
valueField: 'id',
|
||||
},
|
||||
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',
|
||||
fieldName: 'unitId',
|
||||
fieldName: 'residentUnitId',
|
||||
label: '租赁单位',
|
||||
componentProps: {
|
||||
componentProps: () => ({
|
||||
api: getUnitList,
|
||||
resultField: 'data',
|
||||
labelField: 'label',
|
||||
@@ -219,11 +200,20 @@ export const modalSchema: FormSchemaGetter = () => [
|
||||
immediate: true,
|
||||
debounceTime: 500,
|
||||
allowClear: true,
|
||||
placeholder: '请选择租赁单位',
|
||||
placeholder: '',
|
||||
filterOption: true,
|
||||
},
|
||||
}),
|
||||
|
||||
rules: 'selectRequired',
|
||||
disabled: true,
|
||||
},
|
||||
{
|
||||
label: '租赁人',
|
||||
fieldName: 'userName',
|
||||
component: 'Select',
|
||||
rules: 'selectRequired',
|
||||
},
|
||||
|
||||
{
|
||||
label: '租金',
|
||||
fieldName: 'rent',
|
||||
|
@@ -56,7 +56,7 @@ async function handleOpenChange(open: boolean) {
|
||||
{{ orderChargeDetail.userName }}
|
||||
</DescriptionsItem>
|
||||
<DescriptionsItem label="租赁单位">
|
||||
{{ orderChargeDetail.unitName }}
|
||||
{{ orderChargeDetail.residentUnitText }}
|
||||
</DescriptionsItem>
|
||||
<DescriptionsItem label="租金">
|
||||
{{ orderChargeDetail.rent }}
|
||||
|
@@ -1,13 +1,21 @@
|
||||
<script setup lang="ts">
|
||||
import {computed, reactive, ref} from 'vue';
|
||||
import { computed, reactive, ref } from 'vue';
|
||||
import { useVbenModal } from '@vben/common-ui';
|
||||
import { $t } from '@vben/locales';
|
||||
import { cloneDeep } from '@vben/utils';
|
||||
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 { modalSchema } from './data';
|
||||
import QueryUserList from "#/views/property/greenPlantRentalManagement/chargeManagement/query-user-list.vue";
|
||||
// import { modalSchema } from './data';
|
||||
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 isUpdate = ref(false);
|
||||
@@ -15,16 +23,167 @@ const isUpdate = ref(false);
|
||||
const title = computed(() => {
|
||||
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({
|
||||
commonConfig: {
|
||||
formItemClass: 'col-span-1',
|
||||
labelWidth: 80,
|
||||
componentProps: {
|
||||
class: 'w-full',
|
||||
}
|
||||
},
|
||||
},
|
||||
schema: modalSchema(),
|
||||
schema: modalSchema,
|
||||
showDefaultActions: false,
|
||||
wrapperClass: 'grid-cols-2',
|
||||
});
|
||||
@@ -55,6 +214,8 @@ const [BasicModal, modalApi] = useVbenModal({
|
||||
record.paymentMethod = record.paymentMethod?.toString();
|
||||
record.invoiceType = record.invoiceType?.toString();
|
||||
record.invoiceStatus = record.invoiceStatus?.toString();
|
||||
record.orderId = record.orderId;
|
||||
record.residentUnitId = record.residentUnitId;
|
||||
await formApi.setValues(record);
|
||||
}
|
||||
await markInitialized();
|
||||
@@ -71,8 +232,8 @@ async function handleConfirm() {
|
||||
}
|
||||
const data = cloneDeep(await formApi.getValues());
|
||||
if (userInfo) {
|
||||
data.userId = userInfo.userId
|
||||
data.userName = userInfo.userName
|
||||
data.userId = userInfo.userId;
|
||||
data.userName = userInfo.userName;
|
||||
}
|
||||
await (isUpdate.value ? orderChargeUpdate(data) : orderChargeAdd(data));
|
||||
resetInitialized();
|
||||
@@ -102,9 +263,13 @@ async function handleClosed() {
|
||||
<BasicModal :title="title">
|
||||
<BasicForm>
|
||||
<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>
|
||||
</BasicForm>
|
||||
</BasicModal>
|
||||
</template>
|
||||
|
||||
|
@@ -67,7 +67,7 @@ async function handleOpenChange(open: boolean) {
|
||||
<component :is="renderDict(orderDetail.customerType, 'wy_khlx')" />
|
||||
</DescriptionsItem>
|
||||
<DescriptionsItem label="租赁单位">
|
||||
{{ orderDetail.unitName }}
|
||||
{{ orderDetail.residentUnitText }}
|
||||
</DescriptionsItem>
|
||||
<DescriptionsItem label="租赁周期">
|
||||
{{ orderDetail.rentalPeriod }}
|
||||
|
@@ -1,26 +1,26 @@
|
||||
<script setup lang="ts">
|
||||
import {computed, ref} from 'vue';
|
||||
import { computed, ref } from 'vue';
|
||||
|
||||
import {useVbenModal} from '@vben/common-ui';
|
||||
import {$t} from '@vben/locales';
|
||||
import {cloneDeep} from '@vben/utils';
|
||||
import { useVbenModal } from '@vben/common-ui';
|
||||
import { $t } from '@vben/locales';
|
||||
import { cloneDeep } from '@vben/utils';
|
||||
|
||||
import {useVbenForm} from '#/adapter/form';
|
||||
import { useVbenForm } from '#/adapter/form';
|
||||
import {
|
||||
rentalOrderAdd,
|
||||
rentalOrderInfo,
|
||||
rentalOrderUpdate
|
||||
rentalOrderUpdate,
|
||||
} from '#/api/property/rentalOrder';
|
||||
import {defaultFormValueGetter, useBeforeCloseDiff} from '#/utils/popup';
|
||||
import { defaultFormValueGetter, useBeforeCloseDiff } from '#/utils/popup';
|
||||
|
||||
import {plantsProductList} from "#/api/property/productManagement";
|
||||
import {rentalPlanInfo, rentalPlanList} from "#/api/property/rentalPlan";
|
||||
import {getDictOptions} from "#/utils/dict";
|
||||
import type {PropertyVO} from "#/api/property/productManagement/model";
|
||||
import type {RentalPlanVO} from "#/api/property/rentalPlan/model";
|
||||
import {planInfoColumns} from './data';
|
||||
import {Table} from "ant-design-vue";
|
||||
import { resident_unitList } from '#/api/property/resident/unit'
|
||||
import { plantsProductList } from '#/api/property/productManagement';
|
||||
import { rentalPlanInfo, rentalPlanList } from '#/api/property/rentalPlan';
|
||||
import { getDictOptions } from '#/utils/dict';
|
||||
import type { PropertyVO } from '#/api/property/productManagement/model';
|
||||
import type { RentalPlanVO } from '#/api/property/rentalPlan/model';
|
||||
import { planInfoColumns } from './data';
|
||||
import { Table } from 'ant-design-vue';
|
||||
import { resident_unitList } from '#/api/property/resident/unit';
|
||||
|
||||
const emit = defineEmits<{ reload: [] }>();
|
||||
|
||||
@@ -55,13 +55,13 @@ const modalSchema = [
|
||||
fieldName: 'customerType',
|
||||
component: 'Select',
|
||||
componentProps: {
|
||||
options: getDictOptions('wy_khlx')
|
||||
options: getDictOptions('wy_khlx'),
|
||||
},
|
||||
rules: 'selectRequired',
|
||||
},
|
||||
{
|
||||
{
|
||||
component: 'ApiSelect',
|
||||
fieldName: 'unitId',
|
||||
fieldName: 'residentUnitId',
|
||||
label: '租赁单位',
|
||||
componentProps: {
|
||||
api: getUnitList,
|
||||
@@ -74,14 +74,14 @@ const modalSchema = [
|
||||
placeholder: '请选择租赁单位',
|
||||
filterOption: true,
|
||||
},
|
||||
rules:'selectRequired',
|
||||
rules: 'selectRequired',
|
||||
},
|
||||
{
|
||||
label: '租赁周期',
|
||||
fieldName: 'rentalPeriod',
|
||||
component: 'Select',
|
||||
componentProps: {
|
||||
options: getDictOptions('wy_time_unit')
|
||||
options: getDictOptions('wy_time_unit'),
|
||||
},
|
||||
rules: 'selectRequired',
|
||||
},
|
||||
@@ -101,10 +101,10 @@ const modalSchema = [
|
||||
fieldName: 'rentalType',
|
||||
component: 'Select',
|
||||
componentProps: {
|
||||
options: getDictOptions('wy_zlfs')
|
||||
options: getDictOptions('wy_zlfs'),
|
||||
},
|
||||
rules: 'selectRequired',
|
||||
formItemClass: 'col-span-2'
|
||||
formItemClass: 'col-span-2',
|
||||
},
|
||||
{
|
||||
label: '租赁方案',
|
||||
@@ -119,29 +119,34 @@ const modalSchema = [
|
||||
formItemClass: 'col-span-2',
|
||||
componentProps: {
|
||||
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 || [];
|
||||
return planList.value.map(item => ({
|
||||
return planList.value.map((item) => ({
|
||||
label: item.planName,
|
||||
value: item.id,
|
||||
}));
|
||||
},
|
||||
onChange: async (value: string) => {
|
||||
await getPlanProducts(value)
|
||||
await getPlanProducts(value);
|
||||
},
|
||||
showSearch: true,
|
||||
filterOption: (input: any, option: any) =>
|
||||
option.label.toLowerCase().includes(input.toLowerCase()),
|
||||
}
|
||||
},
|
||||
},
|
||||
{
|
||||
label: '方案详情',
|
||||
fieldName: 'planInfo',
|
||||
component: 'Input',
|
||||
slots: {default: 'planInfo'},
|
||||
slots: { default: 'planInfo' },
|
||||
dependencies: {
|
||||
// 仅当 租赁方式 为 2(套餐) 时显示
|
||||
show: (formValues: any) => formValues.rentalType === '2' && formValues.planId != null,
|
||||
show: (formValues: any) =>
|
||||
formValues.rentalType === '2' && formValues.planId != null,
|
||||
triggerFields: ['planId', 'rentalType'],
|
||||
},
|
||||
formItemClass: 'col-span-2',
|
||||
@@ -159,36 +164,51 @@ const modalSchema = [
|
||||
formItemClass: 'col-span-2',
|
||||
componentProps: {
|
||||
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 || [];
|
||||
return plantsList.value.map(item => ({
|
||||
label: item.plantName + '-' + item.plantCode + '\xa0\xa0租金(元):' + item.rent + '\xa0\xa0库存数量:' + item.inventory,
|
||||
return plantsList.value.map((item) => ({
|
||||
label:
|
||||
item.plantName +
|
||||
'-' +
|
||||
item.plantCode +
|
||||
'\xa0\xa0租金(元):' +
|
||||
item.rent +
|
||||
'\xa0\xa0库存数量:' +
|
||||
item.inventory,
|
||||
value: item.id,
|
||||
}));
|
||||
},
|
||||
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) {
|
||||
formApi.updateSchema([{
|
||||
componentProps: () => ({
|
||||
min: 1,
|
||||
max: plantInfo.value?.inventory,
|
||||
precision: 0,
|
||||
onChange: async () => {
|
||||
const formValues = await formApi.getValues();
|
||||
if (formValues.productNum && plantInfo.value?.rent) {
|
||||
singleAmount.value = (plantInfo.value.rent * formValues.productNum).toFixed(2);
|
||||
}
|
||||
},
|
||||
}),
|
||||
fieldName: 'productNum',
|
||||
}])
|
||||
formApi.updateSchema([
|
||||
{
|
||||
componentProps: () => ({
|
||||
min: 1,
|
||||
max: plantInfo.value?.inventory,
|
||||
precision: 0,
|
||||
onChange: async () => {
|
||||
const formValues = await formApi.getValues();
|
||||
if (formValues.productNum && plantInfo.value?.rent) {
|
||||
singleAmount.value = (
|
||||
plantInfo.value.rent * formValues.productNum
|
||||
).toFixed(2);
|
||||
}
|
||||
},
|
||||
}),
|
||||
fieldName: 'productNum',
|
||||
},
|
||||
]);
|
||||
}
|
||||
},
|
||||
showSearch: true,
|
||||
filterOption: (input: any, option: any) =>
|
||||
option.label.toLowerCase().includes(input.toLowerCase()),
|
||||
}
|
||||
},
|
||||
},
|
||||
{
|
||||
label: '租赁数量',
|
||||
@@ -216,14 +236,17 @@ const modalSchema = [
|
||||
label: '总金额(元)',
|
||||
fieldName: 'totalAmount',
|
||||
component: 'InputNumber',
|
||||
slots: {default: 'totalAmount'},
|
||||
slots: { default: 'totalAmount' },
|
||||
dependencies: {
|
||||
// 仅当 租赁方式 为 1(单点) 时显示
|
||||
show: (formValues: any) => formValues.productNum && formValues.productId && formValues.rentalType === '1',
|
||||
show: (formValues: any) =>
|
||||
formValues.productNum &&
|
||||
formValues.productId &&
|
||||
formValues.rentalType === '1',
|
||||
triggerFields: ['productNum', 'rentalType'],
|
||||
disabled: true,
|
||||
},
|
||||
labelWidth: 110
|
||||
labelWidth: 110,
|
||||
},
|
||||
{
|
||||
label: '是否续租',
|
||||
@@ -234,7 +257,7 @@ const modalSchema = [
|
||||
optionType: 'button',
|
||||
options: getDictOptions('wy_sf'),
|
||||
},
|
||||
rules: 'required'
|
||||
rules: 'required',
|
||||
},
|
||||
{
|
||||
label: '合同状态',
|
||||
@@ -243,17 +266,18 @@ const modalSchema = [
|
||||
componentProps: {
|
||||
options: getDictOptions('wy_htzt'),
|
||||
},
|
||||
rules: 'selectRequired'
|
||||
rules: 'selectRequired',
|
||||
},
|
||||
{
|
||||
label: '合同编号',
|
||||
fieldName: 'contractCode',
|
||||
component: 'Input',
|
||||
dependencies: {
|
||||
show: (formValues: any) => formValues.contractStatus != null && formValues.contractStatus != 1,
|
||||
show: (formValues: any) =>
|
||||
formValues.contractStatus != null && formValues.contractStatus != 1,
|
||||
triggerFields: ['contractStatus'],
|
||||
},
|
||||
rules: 'required'
|
||||
rules: 'required',
|
||||
},
|
||||
{
|
||||
label: '签署时间',
|
||||
@@ -265,10 +289,11 @@ const modalSchema = [
|
||||
valueFormat: 'YYYY-MM-DD',
|
||||
},
|
||||
dependencies: {
|
||||
show: (formValues: any) => formValues.contractStatus != null && formValues.contractStatus != 1,
|
||||
show: (formValues: any) =>
|
||||
formValues.contractStatus != null && formValues.contractStatus != 1,
|
||||
triggerFields: ['contractStatus'],
|
||||
},
|
||||
rules: 'required'
|
||||
rules: 'required',
|
||||
},
|
||||
];
|
||||
const [BasicForm, formApi] = useVbenForm({
|
||||
@@ -280,15 +305,14 @@ const [BasicForm, formApi] = useVbenForm({
|
||||
// 通用配置项 会影响到所有表单项
|
||||
componentProps: {
|
||||
class: 'w-full',
|
||||
}
|
||||
},
|
||||
},
|
||||
schema: modalSchema,
|
||||
showDefaultActions: false,
|
||||
wrapperClass: 'grid-cols-2',
|
||||
});
|
||||
|
||||
|
||||
const {onBeforeClose, markInitialized, resetInitialized} = useBeforeCloseDiff(
|
||||
const { onBeforeClose, markInitialized, resetInitialized } = useBeforeCloseDiff(
|
||||
{
|
||||
initializedGetter: defaultFormValueGetter(formApi),
|
||||
currentGetter: defaultFormValueGetter(formApi),
|
||||
@@ -307,7 +331,7 @@ const [BasicModal, modalApi] = useVbenModal({
|
||||
return null;
|
||||
}
|
||||
modalApi.modalLoading(true);
|
||||
const {id} = modalApi.getData() as { id?: number | string };
|
||||
const { id } = modalApi.getData() as { id?: number | string };
|
||||
isUpdate.value = !!id;
|
||||
if (isUpdate.value && id) {
|
||||
const record = await rentalOrderInfo(id);
|
||||
@@ -318,26 +342,26 @@ const [BasicModal, modalApi] = useVbenModal({
|
||||
modalApi.modalLoading(false);
|
||||
},
|
||||
});
|
||||
async function getUnitList(){
|
||||
async function getUnitList() {
|
||||
const queryParam = {
|
||||
pageNum: 1,
|
||||
pageSize: 1000,
|
||||
}
|
||||
const res = await resident_unitList(queryParam)
|
||||
const data: { value: number; label: string }[] = []
|
||||
};
|
||||
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;
|
||||
}
|
||||
async function handleConfirm() {
|
||||
try {
|
||||
modalApi.lock(true);
|
||||
const {valid} = await formApi.validate();
|
||||
const { valid } = await formApi.validate();
|
||||
if (!valid) {
|
||||
return;
|
||||
}
|
||||
@@ -345,18 +369,18 @@ async function handleConfirm() {
|
||||
const data = cloneDeep(await formApi.getValues());
|
||||
if (data.rentalType == 1) {
|
||||
data.planId = undefined;
|
||||
data.totalAmount = singleAmount.value
|
||||
data.totalAmount = singleAmount.value;
|
||||
} else {
|
||||
data.productId = undefined;
|
||||
data.productNum = undefined;
|
||||
data.productList = planProducts.value
|
||||
data.totalAmount = totalAmount.value
|
||||
data.productList = planProducts.value;
|
||||
data.totalAmount = totalAmount.value;
|
||||
}
|
||||
if (data.rentalTime) {
|
||||
data.startTime = data.rentalTime[0];
|
||||
data.endTime = data.rentalTime[1];
|
||||
}
|
||||
data.paymentStatus = 0
|
||||
data.paymentStatus = 0;
|
||||
await (isUpdate.value ? rentalOrderUpdate(data) : rentalOrderAdd(data));
|
||||
resetInitialized();
|
||||
emit('reload');
|
||||
@@ -370,22 +394,22 @@ async function handleConfirm() {
|
||||
|
||||
//获取有库存的绿植
|
||||
async function getPlanProducts(id: string) {
|
||||
const res = await rentalPlanInfo(id)
|
||||
planProducts.value = res.productList.map(item => ({
|
||||
id:item.productId,
|
||||
const res = await rentalPlanInfo(id);
|
||||
planProducts.value = res.productList.map((item) => ({
|
||||
id: item.productId,
|
||||
plantName: item.product?.plantName,
|
||||
rent: item.product?.rent,
|
||||
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() {
|
||||
await formApi.resetForm();
|
||||
resetInitialized();
|
||||
}
|
||||
|
||||
</script>
|
||||
|
||||
<template>
|
||||
@@ -393,8 +417,13 @@ async function handleClosed() {
|
||||
<BasicForm>
|
||||
<template #planInfo="slotProps">
|
||||
<div v-if="planProducts.length" style="width: 100%" v-bind="slotProps">
|
||||
<Table :dataSource="planProducts" :columns="planInfoColumns" :pagination="false"
|
||||
bordered size="small">
|
||||
<Table
|
||||
:dataSource="planProducts"
|
||||
:columns="planInfoColumns"
|
||||
:pagination="false"
|
||||
bordered
|
||||
size="small"
|
||||
>
|
||||
<template #bodyCell="{ column, record, index }">
|
||||
<template v-if="column.field === 'id'">
|
||||
{{ index + 1 }}
|
||||
@@ -404,7 +433,7 @@ async function handleClosed() {
|
||||
</template>
|
||||
</template>
|
||||
<template #footer>
|
||||
<div style="text-align: right;margin-right: 20px">
|
||||
<div style="text-align: right; margin-right: 20px">
|
||||
<b>总金额(元):</b>
|
||||
{{ totalAmount }}
|
||||
</div>
|
||||
@@ -418,4 +447,3 @@ async function handleClosed() {
|
||||
</BasicForm>
|
||||
</BasicModal>
|
||||
</template>
|
||||
|
||||
|
Reference in New Issue
Block a user