Merge branch 'master' of http://47.109.37.87:3000/by2025/admin-vben5
Some checks failed
Gitea Actions Demo / Explore-Gitea-Actions (push) Failing after 8s

This commit is contained in:
fyy
2025-07-05 09:11:56 +08:00
47 changed files with 2087 additions and 858 deletions

View File

@@ -2,7 +2,7 @@ import type { FormSchemaGetter } from '#/adapter/form';
import type { VxeGridProps } from '#/adapter/vxe-table';
import { getDictOptions } from '#/utils/dict';
import { renderDict } from '#/utils/render';
import {orderChargeList} from "#/api/property/chargeManagement";
import {rentalOrderList} from "#/api/property/rentalOrder";
export const querySchema: FormSchemaGetter = () => [
{
@@ -64,38 +64,47 @@ export const columns: VxeGridProps['columns'] = [
return (rowIndex + 1).toString();
},
},
minWidth: '120'
},
{
title: '订单号',
field: 'orderId',
minWidth: '120'
},
{
title: '租赁合同编号',
field: 'userId',
minWidth: '120'
},
{
title: '租赁人',
field: 'userName',
minWidth: '120'
},
{
title: '租金',
field: 'rent',
minWidth: '120'
},
{
title: '押金',
field: 'deposit',
minWidth: '120'
},
{
title: '违约金',
field: 'penalty',
minWidth: '120'
},
{
title: '总金额',
field: 'totalAmount',
minWidth: '120'
},
{
title: '收费日期',
field: 'chargeDate',
minWidth: '120'
},
{
title: '支付方式',
@@ -105,6 +114,7 @@ export const columns: VxeGridProps['columns'] = [
return renderDict(row.paymentMethod, 'pro_payment_method');
},
},
minWidth: '120'
},
{
title: '开票状态',
@@ -114,10 +124,12 @@ export const columns: VxeGridProps['columns'] = [
return renderDict(row.invoiceStatus, 'pro_invoice_status');
},
},
minWidth: '120'
},
{
title: '发票类型',
field: 'invoiceType',
minWidth: '120'
},
{
title: '收费状态',
@@ -127,10 +139,12 @@ export const columns: VxeGridProps['columns'] = [
return renderDict(row.chargeStatus, 'pro_charging_status');
},
},
minWidth: '120'
},
{
title: '创建时间',
field: 'createTime',
minWidth: '120'
},
{
field: 'action',
@@ -151,28 +165,35 @@ export const modalSchema: FormSchemaGetter = () => [
triggerFields: [''],
},
},
// {
// label: '订单号',
// fieldName: 'orderId',
// component: 'Input',
// rules: 'required',
// },
{
label: '订单号',
fieldName: 'orderId',
component: 'ApiSelect',
componentProps: {
api: orderChargeList,
api: rentalOrderList,
resultField: 'rows',
valueField: 'orderId',
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: 'Input',
rules: 'required',
component: "Select",
rules: 'selectRequired',
},
{
label: '租金',
@@ -192,6 +213,12 @@ export const modalSchema: FormSchemaGetter = () => [
component: 'Input',
rules: 'required',
},
{
label: '总金额',
fieldName: 'totalAmount',
component: 'Input',
rules: 'required',
},
{
label: '开票状态',
fieldName: 'invoiceStatus',
@@ -204,8 +231,11 @@ export const modalSchema: FormSchemaGetter = () => [
{
label: '发票类型',
fieldName: 'invoiceType',
component: 'Input',
rules: 'required',
component: 'Select',
componentProps: {
options: getDictOptions('pro_invoice_type'),
},
rules: 'selectRequired',
},
{
label: '收费状态',
@@ -216,4 +246,24 @@ export const modalSchema: FormSchemaGetter = () => [
},
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',
},
];

View File

@@ -2,6 +2,7 @@
import { Page, useVbenModal, type VbenFormProps } from '@vben/common-ui';
import { getVxePopupContainer } from '@vben/utils';
import { Modal, Popconfirm, Space } from 'ant-design-vue';
import { $t } from '@vben/locales';
import {
useVbenVxeGrid,
vxeCheckboxChecked,

View File

@@ -72,11 +72,11 @@ async function handleOpenChange(open: boolean) {
<DescriptionsItem label="购买植物">
{{ orderChargeDetail.createTime }}
</DescriptionsItem>
<DescriptionsItem label="价格">
{{ orderChargeDetail.createTime }}
<DescriptionsItem label="总金额">
{{ orderChargeDetail.totalAmount }}
</DescriptionsItem>
<DescriptionsItem label="产品图片">
<img :src="orderChargeDetail.imgPath" alt="">
<img :src="orderChargeDetail.createTime" alt="">
</DescriptionsItem>
</Descriptions>
</BasicModal>

View File

@@ -1,5 +1,5 @@
<script setup lang="ts">
import { computed, 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';
@@ -7,6 +7,7 @@ import { useVbenForm } from '#/adapter/form';
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";
const emit = defineEmits<{ reload: [] }>();
const isUpdate = ref(false);
@@ -65,6 +66,10 @@ async function handleConfirm() {
return;
}
const data = cloneDeep(await formApi.getValues());
if (userInfo) {
data.userId = userInfo.userId
data.userName = userInfo.userName
}
await (isUpdate.value ? orderChargeUpdate(data) : orderChargeAdd(data));
resetInitialized();
emit('reload');
@@ -75,7 +80,14 @@ async function handleConfirm() {
modalApi.lock(false);
}
}
let userInfo = reactive({
userId: '',
userName: '',
});
const userName = ref<number | string>('');
function getUserInfo(user: any) {
userInfo = user;
}
async function handleClosed() {
await formApi.resetForm();
resetInitialized();
@@ -84,7 +96,11 @@ async function handleClosed() {
<template>
<BasicModal :title="title">
<BasicForm />
<BasicForm>
<template #userName="slotProps">
<QueryUserList @update:userInfo="getUserInfo" v-bind="slotProps" :isUpdate="isUpdate" :userName="userName"/>
</template>
</BasicForm>
</BasicModal>
</template>

View File

@@ -0,0 +1,81 @@
<script lang="ts" setup>
import {ref, watch} from 'vue';
import {Select} from 'ant-design-vue';
import {personInfo, personList} from "#/api/property/resident/person";
defineOptions({name: 'QueryUserList'});
const props = withDefaults(defineProps<{
isUpdate?: boolean;
userName?: string;
}>(), {
isUpdate: false,
userName: ''
});
watch(() => props.userName,
(newX) => {
if (props.isUpdate) {
getUserInfo(newX)
}
}, {immediate: true})
async function queryUser(value: string, callback: any) {
const queryData = {
customerName: value,
pageSize: 100,
pageNum: 1,
}
const res = await personList(queryData);
const options = res.rows.map((user) => ({
label: user.userName,
value: user.userName,
userId: user.userId,
userName: user.userName,
}));
callback(options);
}
const data = ref<any[]>([]);
const value = ref('');
const handleSearch = (val: string) => {
queryUser(val, (d: any[]) => (data.value = d));
};
const emit = defineEmits(['update:userInfo']);
const handleChange = (val: string) => {
value.value = val;
const userInfo = data.value.find(option => option.value === val);
queryUser(val, (d: any[]) => (data.value = d));
emit('update:userInfo', userInfo);
};
async function getUserInfo(val:number|string) {
if (!val) return;
const user = await personInfo(val)
if (user) {
data.value = [{
userId: user.userId,
userName: user.userName,
}]
emit('update:userInfo', data.value[0]);
}
}
</script>
<template>
<Select
v-model="value"
show-search
placeholder="可根据租赁人名称进行搜索..."
style="width: 100%"
:default-active-first-option="false"
:show-arrow="false"
:filter-option="false"
:not-found-content="null"
:options="data"
@search="handleSearch"
@change="handleChange"
></Select>
</template>

View File

@@ -14,6 +14,7 @@ export const querySchema: FormSchemaGetter = () => [
{
component: 'Select',
componentProps: {
options: getDictOptions('pro_processing_status'),
},
fieldName: 'state',
label: '处理状态',
@@ -22,59 +23,80 @@ export const querySchema: FormSchemaGetter = () => [
export const columns: VxeGridProps['columns'] = [
{ type: 'checkbox', width: 60 },
{
title: '序号',
field: 'id',
slots: {
default: ({ rowIndex }) => {
return (rowIndex + 1).toString();
},
},
minWidth: '120'
},
{
title: '养护名称',
field: 'maintainName',
minWidth: '120'
},
{
title: '小区id',
field: 'communityId',
},
{
title: '建筑id',
field: 'buildingId',
},
{
title: '楼层id',
field: 'floorId',
title: '服务地点(房间id',
field: 'roomId',
minWidth: '120'
},
{
title: '服务类型',
field: 'serveType',
slots: {
default: ({ row }) => {
return renderDict(row.serveType, 'pro_service_type');
},
},
minWidth: '120'
},
{
title: '养护周期类型',
field: 'periodType',
slots: {
default: ({ row }) => {
// 可选从DictEnum中获取 DictEnum.WY_TIME_UNIT 便于维护
return renderDict(row.periodType, 'wy_time_unit');
},
},
minWidth: '120'
},
{
title: '养护周期频次',
field: 'periodFrequency',
minWidth: '120'
},
{
title: '订单id',
title: '关联订单',
field: 'orderId',
minWidth: '120'
},
{
title: '计划执行时间',
field: 'startTime',
minWidth: '120'
},
{
title: '计划完成时间',
field: 'endTime',
minWidth: '120'
},
{
title: '巡检结果',
field: 'inspectResult',
slots: {
default: ({ row }) => {
return renderDict(row.inspectResult, 'pro_inspection_results');
},
},
minWidth: '120'
},
{
title: '处理措施',
field: 'measure',
minWidth: '120'
},
{
title: '客户评分',
@@ -87,15 +109,22 @@ export const columns: VxeGridProps['columns'] = [
});
},
},
width:200
minWidth: '120'
},
{
title: '客户反馈',
field: 'customerAdvice',
minWidth: '120'
},
{
title: '处理状态',
field: 'state',
slots: {
default: ({ row }) => {
return renderDict(row.state, 'pro_processing_status');
},
},
minWidth: '120'
},
{
field: 'action',
@@ -121,32 +150,24 @@ export const modalSchema: FormSchemaGetter = () => [
fieldName: 'maintainName',
component: 'Input',
rules: 'required',
labelWidth:100
},
{
label: '小区id',
label: '服务地点',
fieldName: 'communityId',
component: 'Input',
rules: 'required',
},
{
label: '建筑id',
fieldName: 'buildingId',
component: 'Input',
rules: 'required',
},
{
label: '楼层id',
fieldName: 'floorId',
component: 'Input',
rules: 'required',
labelWidth:100
},
{
label: '服务类型',
fieldName: 'serveType',
component: 'Select',
componentProps: {
options: getDictOptions('pro_service_type'),
},
rules: 'selectRequired',
labelWidth:100
},
{
label: '养护周期类型',
@@ -157,18 +178,21 @@ export const modalSchema: FormSchemaGetter = () => [
options: getDictOptions('wy_time_unit'),
},
rules: 'selectRequired',
labelWidth:100
},
{
label: '养护周期频次',
fieldName: 'periodFrequency',
component: 'Input',
rules: 'required',
labelWidth:100
},
{
label: '订单id',
label: '关联订单',
fieldName: 'orderId',
component: 'Input',
rules: 'required',
labelWidth:100
},
{
label: '计划执行时间',
@@ -180,6 +204,7 @@ export const modalSchema: FormSchemaGetter = () => [
valueFormat: 'YYYY-MM-DD HH:mm:ss',
},
rules: 'required',
labelWidth:100
},
{
label: '计划完成时间',
@@ -191,16 +216,24 @@ export const modalSchema: FormSchemaGetter = () => [
valueFormat: 'YYYY-MM-DD HH:mm:ss',
},
rules: 'required',
labelWidth:100
},
{
label: '巡检结果',
fieldName: 'inspectResult',
component: 'Input',
component: 'Select',
componentProps: {
options: getDictOptions('pro_inspection_results'),
},
rules: 'selectRequired',
labelWidth:100
},
{
label: '处理措施',
fieldName: 'measure',
component: 'Input',
rules: 'required',
labelWidth:100
},
{
label: '客户评分',
@@ -213,17 +246,22 @@ export const modalSchema: FormSchemaGetter = () => [
defaultValue: 0
},
rules: 'required',
labelWidth:100
},
{
label: '客户反馈',
fieldName: 'customerAdvice',
component: 'Textarea',
labelWidth:100
},
{
label: '处理状态',
fieldName: 'state',
component: 'Select',
componentProps: {
options: getDictOptions('pro_processing_status'),
},
rules: 'selectRequired',
labelWidth:100
},
];

View File

@@ -2,6 +2,7 @@
import { Page, useVbenModal, type VbenFormProps } from '@vben/common-ui';
import { getVxePopupContainer } from '@vben/utils';
import { Modal, Popconfirm, Space } from 'ant-design-vue';
import { $t } from '@vben/locales';
import {
useVbenVxeGrid,
vxeCheckboxChecked,
@@ -14,6 +15,7 @@ import {
import type { OrderMaintainForm } from '#/api/property/conservationManagement/model';
import orderMaintainModal from './orderMaintain-modal.vue';
import { columns, querySchema } from './data';
import orderMaintainDetail from "#/views/property/greenPlantRentalManagement/conservationManagement/orderMaintain-detail.vue";
const formOptions: VbenFormProps = {
commonConfig: {
@@ -61,6 +63,15 @@ const [OrderMaintainModal, modalApi] = useVbenModal({
connectedComponent: orderMaintainModal,
});
const [orderMaintainDetailModal, orderMaintainDetailApi] = useVbenModal({
connectedComponent: orderMaintainDetail,
});
async function handleInfo(row: Required<OrderMaintainForm>) {
orderMaintainDetailApi.setData({ id: row.id });
orderMaintainDetailApi.open();
}
function handleAdd() {
modalApi.setData({});
modalApi.open();
@@ -115,6 +126,11 @@ function handleMultiDelete() {
</template>
<template #action="{ row }">
<Space>
<ghost-button
@click.stop="handleInfo(row)"
>
{{ $t('pages.common.info') }}
</ghost-button>
<ghost-button
v-access:code="['property:orderMaintain:edit']"
@click.stop="handleEdit(row)"
@@ -139,5 +155,6 @@ function handleMultiDelete() {
</template>
</BasicTable>
<OrderMaintainModal @reload="tableApi.query()" />
<orderMaintainDetailModal/>
</Page>
</template>

View File

@@ -0,0 +1,77 @@
<script setup lang="ts">
import type {conservationManagement} from '#/api/property/conservationManagement/model';
import {shallowRef} from 'vue';
import {useVbenModal} from '@vben/common-ui';
import {Descriptions, DescriptionsItem, Rate} from 'ant-design-vue';
import {orderMaintainInfo} from '#/api/property/conservationManagement';
import {renderDict} from "#/utils/render";
const [BasicModal, modalApi] = useVbenModal({
onOpenChange: handleOpenChange,
onClosed() {
conservationManagementDetail.value = null;
},
});
const conservationManagementDetail = shallowRef<null | conservationManagement>(null);
async function handleOpenChange(open: boolean) {
if (!open) {
return null;
}
modalApi.modalLoading(true);
const {id} = modalApi.getData() as { id: number | string };
const response = await orderMaintainInfo(id);
conservationManagementDetail.value = response;
modalApi.modalLoading(false);
}
</script>
<template>
<BasicModal :footer="false" :fullscreen-button="false" title="养护管理信息" class="w-[70%]">
<Descriptions v-if="conservationManagementDetail" size="small" :column="2" bordered :labelStyle="{width:'100px'}">
<DescriptionsItem label="养护名称">
{{ conservationManagementDetail.maintainName }}
</DescriptionsItem>
<DescriptionsItem label="服务地点">
{{ conservationManagementDetail.roomId }}
</DescriptionsItem>
<DescriptionsItem label="服务类型" v-if="conservationManagementDetail.serveType!=null">
<component
:is="renderDict(conservationManagementDetail.serveType,'pro_service_type')"
/>
</DescriptionsItem>
<DescriptionsItem label="养护周期">
{{ conservationManagementDetail.orderId }}
</DescriptionsItem>
<DescriptionsItem label="关联订单">
{{ conservationManagementDetail.orderId }}
</DescriptionsItem>
<DescriptionsItem label="计划执行时间">
{{ conservationManagementDetail.startTime }}
</DescriptionsItem>
<DescriptionsItem label="计划完成时间">
{{ conservationManagementDetail.endTime }}
</DescriptionsItem>
<DescriptionsItem label="巡检结果" v-if="conservationManagementDetail.inspectResult!=null">
<component
:is="renderDict(conservationManagementDetail.inspectResult,'pro_inspection_results')"
/>
</DescriptionsItem>
<DescriptionsItem label="处理措施">
{{ conservationManagementDetail.measure }}
</DescriptionsItem>
<DescriptionsItem label="客户评分">
<Rate :value="conservationManagementDetail.customerScore" disabled />
</DescriptionsItem>
<DescriptionsItem label="客户反馈">
{{ conservationManagementDetail.customerAdvice }}
</DescriptionsItem>
<DescriptionsItem label="处理状态" v-if="conservationManagementDetail.state!=null">
<component
:is="renderDict(conservationManagementDetail.state,'pro_processing_status')"
/>
</DescriptionsItem>
</Descriptions>
</BasicModal>
</template>

View File

@@ -17,7 +17,7 @@ const title = computed(() => {
const [BasicForm, formApi] = useVbenForm({
commonConfig: {
formItemClass: 'col-span-2',
formItemClass: 'col-span-1',
labelWidth: 80,
componentProps: {
class: 'w-full',
@@ -36,7 +36,7 @@ const { onBeforeClose, markInitialized, resetInitialized } = useBeforeCloseDiff(
);
const [BasicModal, modalApi] = useVbenModal({
class: 'w-[550px]',
class: 'w-[60%]',
fullscreenButton: false,
onBeforeClose,
onClosed: handleClosed,
@@ -52,6 +52,9 @@ const [BasicModal, modalApi] = useVbenModal({
if (isUpdate.value && id) {
const record = await orderMaintainInfo(id);
record.serveType = record.serveType?.toString();
record.state = record.state?.toString();
record.inspectResult = record.inspectResult?.toString();
await formApi.setValues(record);
}
await markInitialized();

View File

@@ -69,7 +69,7 @@ export const columns: VxeGridProps['columns'] = [
field: 'rentalPeriod',
slots: {
default: ({ row }) => {
return renderDict(row.rentalPeriod, 'wy_sjdw');
return renderDict(row.rentalPeriod, 'wy_time_unit');
},
},
width: 100
@@ -149,170 +149,29 @@ export const columns: VxeGridProps['columns'] = [
},
];
export const modalSchema: FormSchemaGetter = () => [
export const planInfoColumns: VxeGridProps['columns'] = [
{
label: '主键',
fieldName: 'id',
component: 'Input',
dependencies: {
show: () => false,
triggerFields: [''],
},
title: '序号',
field: 'id',
width: 100,
align: 'center'
},
{
label: '客户名称',
fieldName: 'customerName',
component: 'Input',
rules: 'required',
title: '产品名称',
field: 'plantName',
minWidth: 100,
align: 'center'
},
{
label: '客户类型',
fieldName: 'customerType',
component: 'Select',
componentProps: {
options: getDictOptions('wy_khlx')
},
rules: 'selectRequired',
title: '产品租金',
field: 'rent',
minWidth: 100,
align: 'center'
},
{
label: '租赁周期',
fieldName: 'rentalPeriod',
component: 'Select',
componentProps: {
options: getDictOptions('wy_time_unit')
},
rules: 'selectRequired',
title: '产品数量',
field: 'inventory',
minWidth: 100,
align: 'center'
},
{
label: '租赁时间',
fieldName: 'rentalTime',
component: 'RangePicker',
componentProps: {
showTime: true,
format: 'YYYY-MM-DD',
valueFormat: 'YYYY-MM-DD',
},
rules: 'selectRequired',
},
{
label: '租赁方式',
fieldName: 'rentalType',
component: 'Select',
componentProps: {
options: getDictOptions('wy_zlfs')
},
rules: 'selectRequired',
formItemClass: 'col-span-2'
},
{
label: '租赁方案',
fieldName: 'planId',
component: 'Select',
dependencies: {
// 仅当 租赁方式 为 2套餐 时显示
show: (formValues) => formValues.rentalType === '2',
triggerFields: ['rentalType'],
},
rules: 'selectRequired',
formItemClass: 'col-span-2'
},
{
label: '方案详情',
fieldName: 'planInfo',
component: 'Input',
dependencies: {
// 仅当 租赁方式 为 2套餐 时显示
show: (formValues) => formValues.rentalType === '2' && formValues.planId != null,
triggerFields: ['rentalType'],
},
formItemClass: 'col-span-2'
},
{
label: '绿植产品',
fieldName: 'productId',
component: 'Select',
dependencies: {
// 仅当 租赁方式 为 1单点 时显示
show: (formValues) => formValues.rentalType === '1',
triggerFields: ['rentalType'],
},
rules: 'selectRequired',
formItemClass: 'col-span-2'
},
{
label: '租赁数量',
fieldName: 'productNum',
component: 'InputNumber',
componentProps: {
min: 1,
precision: 0,
step: 1,
placeholder:'租赁数量不可超出绿植产品库存数量'
},
dependencies: {
// 仅当 租赁方式 为 1单点 时显示
show: (formValues) => formValues.rentalType === '1',
triggerFields: ['rentalType', 'productId'],
},
rules: 'required',
},
// {
// label: '应付总额',
// fieldName: 'totalAmount',
// component: 'Input',
// rules: 'required',
// },
// {
// label: '支付状态',
// fieldName: 'paymentStatus',
// component: 'Select',
// componentProps: {
// options: getDictOptions('pro_charging_status'),
// },
// rules: 'selectRequired',
// },
// {
// label: '是否续租',
// fieldName: 'isRelet',
// component: 'RadioGroup',
// componentProps: {
// buttonStyle: 'solid',
// optionType: 'button',
// options: getDictOptions('wy_sf'),
// },
// },
{
label: '合同状态',
fieldName: 'contractStatus',
component: 'Select',
componentProps: {
options: getDictOptions('wy_htzt'),
},
rules: 'selectRequired'
},
{
label: '合同编号',
fieldName: 'contractCode',
component: 'Input',
dependencies: {
show: (formValues) => formValues.contractStatus != null && formValues.contractStatus != 1,
triggerFields: ['contractStatus'],
},
rules: 'required'
},
{
label: '签署时间',
fieldName: 'signTime',
component: 'DatePicker',
componentProps: {
showTime: true,
format: 'YYYY-MM-DD',
valueFormat: 'YYYY-MM-DD',
},
dependencies: {
show: (formValues) => formValues.contractStatus != null && formValues.contractStatus != 1,
triggerFields: ['contractStatus'],
},
rules: 'required'
},
];
]

View File

@@ -89,10 +89,10 @@ function handleAdd() {
modalApi.open();
}
async function handleEdit(row: Required<RentalOrderForm>) {
modalApi.setData({ id: row.id });
modalApi.open();
}
// async function handleEdit(row: Required<RentalOrderForm>) {
// modalApi.setData({ id: row.id });
// modalApi.open();
// }
async function handleDelete(row: Required<RentalOrderForm>) {
await rentalOrderRemove(row.id);
@@ -150,12 +150,12 @@ function handleDownloadExcel() {
</template>
<template #action="{ row }">
<Space>
<ghost-button
v-access:code="['property:rentalOrder:edit']"
@click.stop="handleEdit(row)"
>
{{ $t('pages.common.edit') }}
</ghost-button>
<!-- <ghost-button-->
<!-- v-access:code="['property:rentalOrder:edit']"-->
<!-- @click.stop="handleEdit(row)"-->
<!-- >-->
<!-- {{ $t('pages.common.edit') }}-->
<!-- </ghost-button>-->
<Popconfirm
:get-popup-container="getVxePopupContainer"
placement="left"

View File

@@ -14,15 +14,22 @@ import {
import {defaultFormValueGetter, useBeforeCloseDiff} from '#/utils/popup';
import {plantsProductList} from "#/api/property/productManagement";
import {rentalPlanList} from "#/api/property/rentalPlan";
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";
const emit = defineEmits<{ reload: [] }>();
const isUpdate = ref(false);
const planList = ref<RentalPlanVO[]>([]);
const plantsList = ref<PropertyVO[]>([]);
const planProducts = ref<any[]>([]);
const totalAmount = ref(0);
const singleAmount = ref(0);
const plantInfo = ref<PropertyVO>();
const title = computed(() => {
return isUpdate.value ? $t('pages.common.edit') : $t('pages.common.add');
});
@@ -84,27 +91,42 @@ const modalSchema = [
{
label: '租赁方案',
fieldName: 'planId',
component: 'Select',
component: 'ApiSelect',
dependencies: {
// 仅当 租赁方式 为 2套餐 时显示
show: (formValues: any) => formValues.rentalType === '2',
triggerFields: ['rentalType'],
},
rules: 'selectRequired',
formItemClass: 'col-span-2'
formItemClass: 'col-span-2',
componentProps: {
api: async () => {
const res = await rentalPlanList({pageNum: 1, pageSize: 1000, state: 1});
planList.value = res.rows || [];
return planList.value.map(item => ({
label: item.planName,
value: item.id,
}));
},
onChange: async (value: string) => {
await getPlanProducts(value)
},
showSearch: true,
filterOption: (input: any, option: any) =>
option.label.toLowerCase().includes(input.toLowerCase()),
}
},
{
label: '方案详情',
fieldName: 'planInfo',
component: 'Input',
slots: {default: 'planInfo'},
dependencies: {
// 仅当 租赁方式 为 2套餐 时显示
show: (formValues: any) => formValues.rentalType === '2' && formValues.planId != null,
triggerFields: ['rentalType'],
triggerFields: ['planId', 'rentalType'],
},
formItemClass: 'col-span-2',
componentProps: {}
},
{
label: '绿植产品',
@@ -127,16 +149,12 @@ const modalSchema = [
}));
},
onChange: async (value: string) => {
const plants = plantsList.value.find(item => item.id === value);
if (plants) {
formApi.updateSchema([{
componentProps: () => ({
min: 1,
max: plants.inventory,
precision: 0,
}),
fieldName: 'productNum',
}])
plantInfo.value = plantsList.value.find(item => item.id === value);
if (plantInfo.value) {
const formValues = await formApi.getValues();
if (formValues.productNum) {
singleAmount.value = (plantInfo.value.rent * formValues.productNum).toFixed(2);
}
}
},
showSearch: true,
@@ -152,7 +170,12 @@ const modalSchema = [
min: 1,
precision: 0,
step: 1,
placeholder: '租赁数量不可超出绿植产品库存数量'
placeholder: '租赁数量不可超出绿植产品库存数量',
onChange: async (value: number) => {
if (plantInfo.value) {
singleAmount.value = (plantInfo.value.rent * value).toFixed(2);
}
},
},
dependencies: {
// 仅当 租赁方式 为 1单点 时显示
@@ -162,34 +185,29 @@ const modalSchema = [
rules: 'required',
},
{
label: '应付总额',
label: '总金额(元)',
fieldName: 'totalAmount',
component: 'span',
component: 'InputNumber',
slots: {default: 'totalAmount'},
dependencies: {
// 仅当 租赁方式 为 1单点 时显示
show: (formValues: any) => formValues.totalAmount,
triggerFields: ['totalAmount'],
show: (formValues: any) => formValues.productNum&&formValues.productId&&formValues.rentalType === '1',
triggerFields: ['productNum','rentalType'],
disabled: true,
},
labelWidth: 110
},
{
label: '是否续租',
fieldName: 'isRelet',
component: 'RadioGroup',
componentProps: {
buttonStyle: 'solid',
optionType: 'button',
options: getDictOptions('wy_sf'),
},
rules: 'required'
},
// {
// label: '支付状态',
// fieldName: 'paymentStatus',
// component: 'Select',
// componentProps: {
// options: getDictOptions('pro_charging_status'),
// },
// rules: 'selectRequired',
// },
// {
// label: '是否续租',
// fieldName: 'isRelet',
// component: 'RadioGroup',
// componentProps: {
// buttonStyle: 'solid',
// optionType: 'button',
// options: getDictOptions('wy_sf'),
// },
// },
{
label: '合同状态',
fieldName: 'contractStatus',
@@ -263,8 +281,6 @@ const [BasicModal, modalApi] = useVbenModal({
modalApi.modalLoading(true);
const {id} = modalApi.getData() as { id?: number | string };
isUpdate.value = !!id;
await getPlanList()
// await getPlantsList()
if (isUpdate.value && id) {
const record = await rentalOrderInfo(id);
await formApi.setValues(record);
@@ -286,10 +302,18 @@ async function handleConfirm() {
const data = cloneDeep(await formApi.getValues());
if (data.rentalType == 1) {
data.planId = undefined;
data.totalAmount = singleAmount.value
} else {
data.productId = undefined;
data.productNum = undefined;
data.productList = plantsList.value
data.totalAmount = totalAmount.value
}
if (data.rentalTime) {
data.startTime = data.rentalTime[0];
data.endTime = data.rentalTime[1];
}
await (isUpdate.value ? rentalOrderUpdate(data) : rentalOrderAdd(data));
resetInitialized();
emit('reload');
@@ -302,57 +326,21 @@ async function handleConfirm() {
}
//获取有库存的绿植
async function getPlantsList() {
let params = {
pageNum: 1,
pageSize: 1000,
inventory: 0
}
const res = await plantsProductList(params)
plantsList.value = res.rows
// formApi.updateSchema([
// {
// componentProps: () => ({
// class: 'w-full',
// options: res.rows.map(item => ({
// label: item.plantName + '-' + item.plantCode + '\xa0\xa0租金' + item.rent + '\xa0\xa0库存数量' + item.inventory,
// value: item.id,
// })),
// placeholder: '请选择绿植',
// showSearch: true,
// filterOption: (input: any, option: any) =>
// option.label.toLowerCase().includes(input.toLowerCase()),
// }),
// fieldName: 'productId',
// },
// ]);
}
async function getPlanProducts(id: string) {
const res = await rentalPlanInfo(id)
plantsList.value=res.productList;
// planProducts.value = [{
// plantName: '发财树',
// inventory: 3,
// rent: 10,
// }, {
// plantName: '绿萝',
// inventory: 5,
// rent: 3,
// }
// ]
totalAmount.value = planProducts.value?.reduce((sum, item: any) => sum + (item.rent * item.inventory), 0).toFixed(2)
//获取绿植租赁方案
async function getPlanList() {
let params = {
pageNum: 1,
pageSize: 1000,
state: 0,
}
const res = await rentalPlanList(params)
planList.value = res.rows
formApi.updateSchema([
{
componentProps: () => ({
class: 'w-full',
options: res.rows.map(item => ({
label: item.planName,
value: item.id,
})),
placeholder: '请选择绿植',
showSearch: true,
filterOption: (input: any, option: any) =>
option.label.toLowerCase().includes(input.toLowerCase()),
}),
fieldName: 'planId',
},
]);
}
async function handleClosed() {
@@ -364,7 +352,32 @@ async function handleClosed() {
<template>
<BasicModal :title="title">
<BasicForm/>
<BasicForm>
<template #planInfo="slotProps">
<div v-if="planProducts.length" style="width: 100%">
<Table :dataSource="planProducts" :columns="planInfoColumns" :pagination="false"
bordered size="small">
<template #bodyCell="{ column, record, index }">
<template v-if="column.field === 'id'">
{{ index + 1 }}
</template>
<template v-else>
{{ record[column.field] }}
</template>
</template>
<template #footer>
<div style="text-align: right;margin-right: 20px">
<b>总金额</b>
{{ totalAmount }}
</div>
</template>
</Table>
</div>
</template>
<template #totalAmount="slotProps">
<div>{{ singleAmount }}</div>
</template>
</BasicForm>
</BasicModal>
</template>

View File

@@ -26,15 +26,6 @@ export const querySchema: FormSchemaGetter = () => [
export const columns: VxeGridProps['columns'] = [
{ type: 'checkbox', width: 60 },
{
title: '序号',
field: 'id',
slots: {
default: ({ rowIndex }) => {
return (rowIndex + 1).toString();
},
},
},
{
title: '产品编号',
field: 'plantCode',
@@ -104,12 +95,6 @@ export const modalSchema: FormSchemaGetter = () => [
triggerFields: [''],
},
},
{
label: '产品编号',
fieldName: 'plantCode',
component: 'Input',
rules: 'required',
},
{
label: '产品名称',
fieldName: 'plantName',

View File

@@ -2,7 +2,7 @@
import type {plantsProduct} from '#/api/property/productManagement/model';
import {shallowRef} from 'vue';
import {useVbenModal} from '@vben/common-ui';
import {Descriptions, DescriptionsItem, Rate} from 'ant-design-vue';
import {Descriptions, DescriptionsItem} from 'ant-design-vue';
import {plantsProductInfo} from '#/api/property/productManagement';
import {renderDict} from "#/utils/render";