Merge branch 'master' of http://47.109.37.87:3000/by2025/admin-vben5
Some checks are pending
Gitea Actions Demo / Explore-Gitea-Actions (push) Waiting to run

This commit is contained in:
FLL 2025-06-30 17:58:46 +08:00
commit 86e928430a
19 changed files with 313 additions and 61707 deletions

View File

@ -59,7 +59,7 @@ export interface PersonVO {
/** /**
* *
*/ */
state: number; state: number|string;
/** /**
* *

File diff suppressed because it is too large Load Diff

View File

@ -161,7 +161,8 @@ export function renderDict(value: number | string, dictName: string) {
} }
export function renderDictValue(value: number | string, dictName: string) { export function renderDictValue(value: number | string, dictName: string) {
const dictInfo = getDictOptions(dictName); const dictInfo = getDictOptions(dictName);
return dictInfo[0].label??''; const matchedItem = dictInfo.find((item) => item.value == value);
return matchedItem ? matchedItem.label : value;
} }
export function renderIconSpan( export function renderIconSpan(
icon: ComponentType, icon: ComponentType,

View File

@ -6,7 +6,7 @@ import { computed, ref } from 'vue';
import { useVbenModal } from '@vben/common-ui'; import { useVbenModal } from '@vben/common-ui';
import { $t } from '@vben/locales'; import { $t } from '@vben/locales';
import { cloneDeep } from '@vben/utils'; import { cloneDeep,handleNode,getPopupContainer } from '@vben/utils';
import { Button, Table } from 'ant-design-vue'; import { Button, Table } from 'ant-design-vue';
import dayjs from 'dayjs'; import dayjs from 'dayjs';
@ -20,12 +20,11 @@ import {
clean_orderUpdate, clean_orderUpdate,
} from '#/api/property/clean_order'; } from '#/api/property/clean_order';
import { resident_unitList } from '#/api/property/resident/unit'; import { resident_unitList } from '#/api/property/resident/unit';
import RoomSelect from '#/components/roomSelect/room-select.vue';
import { defaultFormValueGetter, useBeforeCloseDiff } from '#/utils/popup'; import { defaultFormValueGetter, useBeforeCloseDiff } from '#/utils/popup';
import cleanDetailModal from './clean-detail-modal.vue'; import cleanDetailModal from './clean-detail-modal.vue';
import { modalSchema } from './data'; import { modalSchema } from './data';
import { communityTree } from '#/api/property/community';
const emit = defineEmits<{ reload: [] }>(); const emit = defineEmits<{ reload: [] }>();
// //
@ -118,6 +117,7 @@ const [BasicModal, modalApi] = useVbenModal({
if (!isOpen) { if (!isOpen) {
return null; return null;
} }
setupCommunitySelect()
modalApi.modalLoading(true); modalApi.modalLoading(true);
const { id, readonly } = modalApi.getData() as { const { id, readonly } = modalApi.getData() as {
id?: number | string; id?: number | string;
@ -216,44 +216,39 @@ const detailGridOptions: VxeGridProps = {
data: [], data: [],
}; };
const detailColumns = [ const detailColumns = [
{ title: '序号', key: 'index', width: 'auto' }, { title: '序号', key: 'index' },
{ title: '劳务名称', dataIndex: 'name', key: 'name', width: 'auto' }, { title: '劳务名称', dataIndex: 'name', key: 'name' },
{ title: '计量单位', dataIndex: 'measure', key: 'measure', width: 'auto' }, { title: '计量单位', dataIndex: 'measure', key: 'measure' },
{ title: '计算方式', dataIndex: 'method', key: 'method', width: 'auto' }, { title: '计算方式', dataIndex: 'method', key: 'method' },
{ {
title: '申报单价含税(元)', title: '申报单价含税(元)',
dataIndex: 'peices', dataIndex: 'peices',
key: 'peices', key: 'peices',
width: 'auto',
}, },
{ {
title: '保洁频率', title: '保洁频率',
dataIndex: 'frequency', dataIndex: 'frequency',
key: 'frequency', key: 'frequency',
width: 'auto',
}, },
{ title: '保洁标准', dataIndex: 'standard', key: 'standard', width: 'auto' }, { title: '保洁标准', dataIndex: 'standard', key: 'standard' },
{ title: '备注', dataIndex: 'remark', key: 'remark', width: 'auto' }, { title: '备注', dataIndex: 'remark', key: 'remark' },
{ {
title: '状态', title: '状态',
dataIndex: 'stater', dataIndex: 'stater',
key: 'stater', key: 'stater',
width: 'auto',
customRender: ({ value }: { value: number }) => customRender: ({ value }: { value: number }) =>
value === 1 ? '启用' : '禁用', value === 1 ? '启用' : '禁用',
}, },
{ title: '保洁面积', dataIndex: 'area', key: 'area', width: 'auto' }, { title: '保洁面积', dataIndex: 'area', key: 'area' },
{ {
title: '合计费用', title: '合计费用',
dataIndex: 'sumPeices', dataIndex: 'sumPeices',
key: 'sumPeices', key: 'sumPeices',
width: 'auto',
}, },
{ {
title: '操作', title: '操作',
key: 'action', key: 'action',
fixed: 'right' as const, fixed: 'right' as const,
width: 'auto',
}, },
]; ];
@ -281,6 +276,8 @@ function handleDeleteDetail(record: any, index: number) {
} }
async function handleConfirm() { async function handleConfirm() {
console.log('handleConfirm123123123');
if (isReadonly.value) { if (isReadonly.value) {
modalApi.close(); modalApi.close();
return; return;
@ -301,6 +298,8 @@ async function handleConfirm() {
// cleanListData // cleanListData
// label // label
const unitObj = unitListData.find((item) => item.id === data.unit); const unitObj = unitListData.find((item) => item.id === data.unit);
console.log(unitObj,'unitObj');
const cleanObj = cleanListData.find((item) => item.id === data.name); const cleanObj = cleanListData.find((item) => item.id === data.name);
data.unit = unitObj ? unitObj.name : data.unit || ''; data.unit = unitObj ? unitObj.name : data.unit || '';
@ -311,12 +310,16 @@ async function handleConfirm() {
: isUpdate.value : isUpdate.value
? editCleanId.value ? editCleanId.value
: ''; : '';
data.sumPeices = totalSumPeices; // data.sumPeices = totalSumPeices;
// cleanIds // cleanIds
data.cleanIds = detailTable.value.map((item: any) => item.id); data.cleanIds = detailTable.value.map((item: any) => item.id);
data.details = detailTable.value; data.details = detailTable.value;
console.log(data);
console.log(12037847120120);
await clean_orderAdd(data)
// isUpdate.value ? await clean_orderUpdate(data) : await clean_orderAdd(data);
console.log('1231273');
await (isUpdate.value ? clean_orderUpdate(data) : clean_orderAdd(data));
resetInitialized(); resetInitialized();
emit('reload'); emit('reload');
modalApi.close(); modalApi.close();
@ -331,14 +334,47 @@ async function handleClosed() {
await formApi.resetForm(); await formApi.resetForm();
resetInitialized(); resetInitialized();
} }
//
async function setupCommunitySelect() {
const areaList = await communityTree(5);
// /
// addFullName(areaList, 'areaName', ' / ');
const splitStr = '/';
handleNode(areaList, 'label', splitStr, function (node: any) {
if (node.level != 5) {
node.disabled = true;
}
});
formApi.updateSchema([
{
componentProps: () => ({
class: 'w-full',
fieldNames: {
key: 'id',
label: 'label',
value: 'code',
children: 'children',
},
getPopupContainer,
placeholder: '请选择服务地址',
showSearch: true,
treeData: areaList,
treeDefaultExpandAll: true,
treeLine: { showLeafIcon: false },
//
treeNodeFilterProp: 'label',
//
treeNodeLabelProp: 'fullName',
}),
fieldName: 'location',
},
]);
}
</script> </script>
<template> <template>
<BasicModal :title="title"> <BasicModal :title="title">
<BasicForm> <BasicForm>
<template #location="soltProps">
<RoomSelect v-bind="soltProps" />
</template>
</BasicForm> </BasicForm>
<!-- 添加订单详情部分 --> <!-- 添加订单详情部分 -->
<div class="mt-4"> <div class="mt-4">
@ -399,4 +435,15 @@ async function handleClosed() {
.font-medium { .font-medium {
font-weight: 500; font-weight: 500;
} }
/* 使用 :deep() 穿透 scoped 样式,影响子组件 */
:deep(.ant-input[disabled]),
:deep(.ant-input-number-disabled .ant-input-number-input),
:deep(.ant-select-disabled .ant-select-selection-item),
:deep(.ant-picker-disabled .ant-picker-input > input) {
/* 设置一个更深的颜色 */
color: rgb(0 0 0 / 65%) !important;
/* 有些浏览器需要这个来覆盖默认颜色 */
-webkit-text-fill-color: rgb(0 0 0 / 65%) !important;
}
</style> </style>

View File

@ -14,6 +14,13 @@ export const querySchema: FormSchemaGetter = () => [
}, },
// { // {
// label: '服务地址(房间号)', // label: '服务地址(房间号)',
// component: 'TreeSelect',
// defaultValue: undefined,
// fieldName: 'location',
// rules: 'required',
// },
// {
// label: '服务地址(房间号)',
// fieldName: 'location', // fieldName: 'location',
// component: 'ApiSelect', // component: 'ApiSelect',
// componentProps: { // componentProps: {
@ -161,14 +168,9 @@ export const modalSchema: FormSchemaGetter = () => [
}, },
{ {
label: '服务地址(房间号)', label: '服务地址(房间号)',
component: 'Input',
defaultValue: undefined,
fieldName: 'location', fieldName: 'location',
componentProps: {
placeholder: '请选择房间',
},
slots: {
default: 'location',
},
formItemClass: 'col-span-2',
rules: 'required', rules: 'required',
}, },
// { // {

View File

@ -95,7 +95,6 @@ export const columns: VxeGridProps['columns'] = [
fixed: 'right', fixed: 'right',
slots: { default: 'action' }, slots: { default: 'action' },
title: '操作', title: '操作',
width: 'auto',
}, },
]; ];

View File

@ -9,11 +9,13 @@ export const querySchema: FormSchemaGetter = () => [
component: 'Input', component: 'Input',
fieldName: 'planName', fieldName: 'planName',
label: '方案名称', label: '方案名称',
labelWidth: 120
}, },
{ {
component: 'Select', component: 'Select',
fieldName: 'rentalPeriod', fieldName: 'rentalPeriod',
label: '租赁周期', label: '租赁周期',
labelWidth: 120,
componentProps: { componentProps: {
options:[ options:[
{ label: '月', value: 0 }, { label: '月', value: 0 },
@ -121,7 +123,7 @@ export const modalSchema: FormSchemaGetter = () => [
{ {
label: '基础服务项', label: '基础服务项',
fieldName: 'price', fieldName: 'price',
component: 'Select', component: 'Input',
}, },
{ {
label: '优惠活动', label: '优惠活动',

View File

@ -21,9 +21,9 @@ const title = computed(() => {
const [BasicForm, formApi] = useVbenForm({ const [BasicForm, formApi] = useVbenForm({
commonConfig: { commonConfig: {
// //
formItemClass: 'col-span-2', formItemClass: 'col-span-1',
// label px // label px
labelWidth: 80, labelWidth: 120,
// //
componentProps: { componentProps: {
class: 'w-full', class: 'w-full',
@ -43,7 +43,7 @@ const { onBeforeClose, markInitialized, resetInitialized } = useBeforeCloseDiff(
const [BasicModal, modalApi] = useVbenModal({ const [BasicModal, modalApi] = useVbenModal({
// //
class: 'w-[550px]', class: 'w-[70%]',
fullscreenButton: false, fullscreenButton: false,
onBeforeClose, onBeforeClose,
onClosed: handleClosed, onClosed: handleClosed,
@ -91,11 +91,67 @@ async function handleClosed() {
await formApi.resetForm(); await formApi.resetForm();
resetInitialized(); resetInitialized();
} }
const detailColumns = [
{ title: '序号', key: 'index' },
{ title: '产品编号', dataIndex: 'plantCode', key: 'plantCode' },
{ title: '产品名称', dataIndex: 'plantName', key: 'plantName' },
{ title: '产品分类', dataIndex: 'plantType', key: 'plantType' },
{
title: '图片',
dataIndex: 'imgPath',
key: 'imgPath',
},
{
title: '规格',
dataIndex: 'specification',
key: 'specification',
},
{ title: '租金', dataIndex: 'rent', key: 'rent' },
{ title: '备注', dataIndex: 'remark', key: 'remark' },
{
title: '状态',
dataIndex: 'state',
key: 'state',
customRender: ({ value }: { value: number }) =>
value === 1 ? '上架' : '下架',
},
{
title: '操作',
key: 'action',
fixed: 'right' as const,
},
];
</script> </script>
<template> <template>
<BasicModal :title="title"> <BasicModal :title="title">
<BasicForm /> <BasicForm />
<!-- 添加订单详情部分 -->
<div class="mt-4">
<div class="mb-2 flex items-center justify-between">
<h3 class="text-lg font-medium">添加保洁订单详情</h3>
<a-button type="primary" @click="handleAddDetail">
{{ $t('pages.common.add') }}
</a-button>
</div>
<Table
:data-source="detailTable"
:columns="detailColumns"
:pagination="false"
>
<template #bodyCell="{ column, index, record }">
<template v-if="column.key === 'index'">
{{ index + 1 }}
</template>
<template v-else-if="column.key === 'action'">
<Button danger @click="handleDeleteDetail(record, index)">
删除
</Button>
</template>
</template>
</Table>
<div>费用合计{{ totalSumPeices }}</div>
</div>
</BasicModal> </BasicModal>
</template> </template>

View File

@ -7,7 +7,7 @@ export const querySchema: FormSchemaGetter = () => [
{ {
component: 'Input', component: 'Input',
fieldName: 'orderNo', fieldName: 'orderNo',
label: '订单号', label: '订单号',
}, },
{ {
component: 'Input', component: 'Input',
@ -17,6 +17,7 @@ export const querySchema: FormSchemaGetter = () => [
{ {
component: 'Select', component: 'Select',
componentProps: { componentProps: {
options:getDictOptions('wy_khlx')
}, },
fieldName: 'customerType', fieldName: 'customerType',
label: '客户类型', label: '客户类型',
@ -42,76 +43,84 @@ export const querySchema: FormSchemaGetter = () => [
export const columns: VxeGridProps['columns'] = [ export const columns: VxeGridProps['columns'] = [
{ type: 'checkbox', width: 60 }, { type: 'checkbox', width: 60 },
{
title: '订单号',
field: 'id',
},
{ {
title: '订单号', title: '订单号',
field: 'orderNo', field: 'orderNo',
width:100
}, },
{ {
title: '客户名称', title: '客户名称',
field: 'customerName', field: 'customerName',
width:100
}, },
{ {
title: '客户类型', title: '客户类型',
field: 'customerType', field: 'customerType',
slots: {default: 'customerType'},
width:100
}, },
{ {
title: '租赁周期', title: '租赁周期',
field: 'rentalPeriod', field: 'rentalPeriod',
slots: {default: 'rentalPeriod'},
width:100
}, },
{ {
title: '租赁开始时间', title: '租赁开始时间',
field: 'startTime', field: 'startTime',
width:120
}, },
{ {
title: '租赁结束时间', title: '租赁结束时间',
field: 'endTime', field: 'endTime',
width:120
}, },
{ {
title: '应付总额', title: '应付总额',
field: 'totalAmount', field: 'totalAmount',
width:100
}, },
{ {
title: '租赁方式', title: '租赁方式',
field: 'rentalType', field: 'rentalType',
slots: {default: 'rentalType'},
width:100
}, },
{ {
title: '租赁方案id', title: '租赁商品',
field: 'planId', field: 'planId',
}, slots: {default: 'planId'},
{ width:100
title: '绿植产品id',
field: 'productId',
},
{
title: '租赁产品数量',
field: 'productNum',
}, },
{ {
title: '支付状态', title: '支付状态',
field: 'paymentStatus', field: 'paymentStatus',
slots: {default: 'paymentStatus'},
width:100
}, },
{ {
title: '是否续租', title: '是否续租',
field: 'isRelet', field: 'isRelet',
slots: {default: 'isRelet'},
width:100
}, },
{ {
title: '合同状态', title: '合同状态',
field: 'contractStatus', field: 'contractStatus',
slots: {default: 'contractStatus'},
width:100
}, },
{ {
title: '签署时间', title: '签署时间',
field: 'signTime', field: 'signTime',
width:100
}, },
{ {
field: 'action', field: 'action',
fixed: 'right', fixed: 'right',
slots: { default: 'action' }, slots: { default: 'action' },
title: '操作', title: '操作',
width: 180, minWidth: 180,
}, },
]; ];
@ -142,6 +151,7 @@ export const modalSchema: FormSchemaGetter = () => [
fieldName: 'customerType', fieldName: 'customerType',
component: 'Select', component: 'Select',
componentProps: { componentProps: {
options:getDictOptions('wy_khlx')
}, },
rules: 'selectRequired', rules: 'selectRequired',
}, },
@ -150,30 +160,20 @@ export const modalSchema: FormSchemaGetter = () => [
fieldName: 'rentalPeriod', fieldName: 'rentalPeriod',
component: 'Select', component: 'Select',
componentProps: { componentProps: {
options:getDictOptions('wy_time_unit')
}, },
rules: 'selectRequired', rules: 'selectRequired',
}, },
{ {
label: '租赁开始时间', label: '租赁时间',
fieldName: 'startTime', fieldName: 'rentalTime',
component: 'DatePicker', component: 'RangePicker',
componentProps: { componentProps: {
showTime: true, showTime: true,
format: 'YYYY-MM-DD HH:mm:ss', format: 'YYYY-MM-DD HH:mm:ss',
valueFormat: 'YYYY-MM-DD HH:mm:ss', valueFormat: 'YYYY-MM-DD HH:mm:ss',
}, },
rules: 'required', rules: 'selectRequired',
},
{
label: '租赁结束时间',
fieldName: 'endTime',
component: 'DatePicker',
componentProps: {
showTime: true,
format: 'YYYY-MM-DD HH:mm:ss',
valueFormat: 'YYYY-MM-DD HH:mm:ss',
},
rules: 'required',
}, },
{ {
label: '应付总额', label: '应付总额',
@ -186,6 +186,7 @@ export const modalSchema: FormSchemaGetter = () => [
fieldName: 'rentalType', fieldName: 'rentalType',
component: 'Select', component: 'Select',
componentProps: { componentProps: {
options:getDictOptions('wy_sf')
}, },
rules: 'selectRequired', rules: 'selectRequired',
}, },
@ -193,16 +194,34 @@ export const modalSchema: FormSchemaGetter = () => [
label: '租赁方案id', label: '租赁方案id',
fieldName: 'planId', fieldName: 'planId',
component: 'Input', component: 'Input',
dependencies: {
// 仅当 租赁方式 为 2套餐 时显示
show: (formValues) => formValues.rentalType === '2',
triggerFields: ['rentalType'],
},
rules: 'required',
}, },
{ {
label: '绿植产品id', label: '绿植产品id',
fieldName: 'productId', fieldName: 'productId',
component: 'Input', component: 'Input',
dependencies: {
// 仅当 租赁方式 为 1单点 时显示
show: (formValues) => formValues.rentalType === '1',
triggerFields: ['rentalType'],
},
rules: 'required',
}, },
{ {
label: '租赁产品数量', label: '租赁产品数量',
fieldName: 'productNum', fieldName: 'productNum',
component: 'Input', component: 'Input',
dependencies: {
// 仅当 租赁方式 为 1单点 时显示
show: (formValues) => formValues.rentalType === '1',
triggerFields: ['rentalType'],
},
rules: 'required',
}, },
{ {
label: '支付状态', label: '支付状态',
@ -219,6 +238,7 @@ export const modalSchema: FormSchemaGetter = () => [
componentProps: { componentProps: {
buttonStyle: 'solid', buttonStyle: 'solid',
optionType: 'button', optionType: 'button',
options: getDictOptions('wy_sf'),
}, },
}, },
{ {

View File

@ -122,7 +122,7 @@ function handleDownloadExcel() {
<template> <template>
<Page :auto-content-height="true"> <Page :auto-content-height="true">
<BasicTable table-title="绿植租赁-订单管理列表"> <BasicTable table-title="租赁订单列表">
<template #toolbar-tools> <template #toolbar-tools>
<Space> <Space>
<a-button <a-button

View File

@ -21,7 +21,7 @@ const title = computed(() => {
const [BasicForm, formApi] = useVbenForm({ const [BasicForm, formApi] = useVbenForm({
commonConfig: { commonConfig: {
// //
formItemClass: 'col-span-2', formItemClass: 'col-span-1',
// label px // label px
labelWidth: 80, labelWidth: 80,
// //
@ -43,7 +43,7 @@ const { onBeforeClose, markInitialized, resetInitialized } = useBeforeCloseDiff(
const [BasicModal, modalApi] = useVbenModal({ const [BasicModal, modalApi] = useVbenModal({
// //
class: 'w-[550px]', class: 'w-[70%]',
fullscreenButton: false, fullscreenButton: false,
onBeforeClose, onBeforeClose,
onClosed: handleClosed, onClosed: handleClosed,

View File

@ -214,7 +214,16 @@ onMounted(() => {
</div> </div>
</div> </div>
<div class="content"> <div class="content">
<div class="row"></div> <div class="row">
<div class="box">
<div class="title">总订单数</div>
<div class="number">13,132</div>
<div class="percent">8.9%</div>
</div>
<div class="box"></div>
<div class="box"></div>
<div class="box"></div>
</div>
<div class="row-first"> <div class="row-first">
<div class="item1"> <div class="item1">
<EchartsUI <EchartsUI
@ -304,11 +313,26 @@ onMounted(() => {
flex: 1; flex: 1;
height: 100%; height: 100%;
padding: 10px; padding: 10px;
background-color: #962020;
.row { .row {
display: flex; display: flex;
justify-content: space-between; justify-content: space-between;
.box{
width: 300px;
height: 120px;
background-color: #fff;
border-radius: 8px;
margin: 40px 0px;
padding: 10px;
.title{
font-size: 20px;
}
.number{
font-size: 25px;
font-weight: bold;
}
.percent{
font-size: 15px; }
}
} }
.row-first { .row-first {

View File

@ -6,11 +6,6 @@ import {resident_unitList} from "#/api/property/resident/unit";
export const querySchema: FormSchemaGetter = () => [ export const querySchema: FormSchemaGetter = () => [
{
component: 'Input',
fieldName: 'unitId',
label: '所属单位',
},
{ {
component: 'ApiSelect', component: 'ApiSelect',
fieldName: 'unitId', fieldName: 'unitId',
@ -24,8 +19,8 @@ export const querySchema: FormSchemaGetter = () => [
debounceTime: 500, debounceTime: 500,
allowClear: true, allowClear: true,
placeholder: '请选择所属单位', placeholder: '请选择所属单位',
filterOption:true
}, },
rules: 'required',
}, },
{ {
component: 'Input', component: 'Input',
@ -56,24 +51,28 @@ export const columns: VxeGridProps['columns'] = [
{ {
title: '员工编号', title: '员工编号',
field: 'userId', field: 'userId',
width: 100
}, },
{ {
title: '员工名称', title: '员工名称',
field: 'userName', field: 'userName',
width: 100
}, },
{ {
title: '联系电话', title: '联系电话',
field: 'phone', field: 'phone',
width: 100
}, },
{ {
title: '性别', title: '性别',
field: 'gender', field: 'gender',
slots:{ slots:{
default: ({row})=>{ default: ({row})=>{
return renderDict(row.gender,'wy_rzryzt') return renderDict(row.gender,'sys_user_sex')
}
} }
}, },
width: 100
},
{ {
field: 'img', field: 'img',
title: '人脸图片', title: '人脸图片',
@ -83,18 +82,21 @@ export const columns: VxeGridProps['columns'] = [
{ {
title: '所属单位', title: '所属单位',
field: 'unitName', field: 'unitName',
width: 100
}, },
{ // {
title: '入驻位置', // title: '入驻位置',
field: 'locathon', // field: 'locathon',
}, // },
{ {
title: '入驻时间', title: '入驻时间',
field: 'time', field: 'time',
width: 100
}, },
{ {
title: '车牌号码', title: '车牌号码',
field: 'carNumber', field: 'carNumber',
width: 100
}, },
{ {
title: '状态', title: '状态',
@ -103,18 +105,20 @@ export const columns: VxeGridProps['columns'] = [
default: ({row})=>{ default: ({row})=>{
return renderDict(row.state,'wy_rzryzt') return renderDict(row.state,'wy_rzryzt')
} }
} },
width: 100
}, },
{ {
title: '备注', title: '备注',
field: 'remark', field: 'remark',
width: 100
}, },
{ {
field: 'action', field: 'action',
fixed: 'right', fixed: 'right',
slots: { default: 'action' }, slots: { default: 'action' },
title: '操作', title: '操作',
width: 180, minWidth: 180,
}, },
]; ];
@ -168,6 +172,7 @@ export const modalSchema: FormSchemaGetter = () => [
format: 'YYYY-MM-DD HH:mm:ss', format: 'YYYY-MM-DD HH:mm:ss',
valueFormat: 'YYYY-MM-DD HH:mm:ss', valueFormat: 'YYYY-MM-DD HH:mm:ss',
}, },
rules:"required"
}, },
{ {
label: '车牌号码', label: '车牌号码',
@ -181,6 +186,7 @@ export const modalSchema: FormSchemaGetter = () => [
componentProps: { componentProps: {
options: getDictOptions('wy_rzryzt'), options: getDictOptions('wy_rzryzt'),
}, },
rules:'selectRequired'
}, },
{ {
label: '备注', label: '备注',
@ -280,8 +286,8 @@ export async function getUnitList(): Promise<{ value: number; label: string }[]>
res.rows.forEach((r: any) => { res.rows.forEach((r: any) => {
data.push({ data.push({
value: r.name, value: r.id,
label: r.id, label: r.name,
}); });
}); });
return data; return data;

View File

@ -49,15 +49,14 @@ async function handleOpenChange(open: boolean) {
<BasicModal :footer="false" :fullscreen-button="false" title="入驻人员信息" class="w-[70%]"> <BasicModal :footer="false" :fullscreen-button="false" title="入驻人员信息" class="w-[70%]">
<Descriptions v-if="personDetail" size="small" :column="1" bordered :labelStyle="{width:'100px'}"> <Descriptions v-if="personDetail" size="small" :column="1" bordered :labelStyle="{width:'100px'}">
<DescriptionsItem label="入驻人员"> <DescriptionsItem label="入驻人员">
{{ personDetail.userName+'-'+personDetail.phone}} {{ personDetail.userName+'-'+renderDictValue(personDetail.gender,'sys_user_sex')+'-'+personDetail.phone}}
<!-- {{ personDetail.userName+'-'+renderDictValue(personDetail.gender,'sys_user_sex')+'-'+personDetail.phone}}-->
</DescriptionsItem> </DescriptionsItem>
<DescriptionsItem label="所属单位"> <DescriptionsItem label="所属单位">
{{personDetail.unitName+'-'+personDetail.unitId }} {{personDetail.unitName+'-'+personDetail.unitId }}
</DescriptionsItem> </DescriptionsItem>
<DescriptionsItem label="入驻位置"> <!-- <DescriptionsItem label="入驻位置">-->
{{ personDetail.locathon }} <!-- {{ personDetail.locathon }}-->
</DescriptionsItem> <!-- </DescriptionsItem>-->
<DescriptionsItem label="人脸图片"> <DescriptionsItem label="人脸图片">
{{ personDetail.img }} {{ personDetail.img }}
</DescriptionsItem> </DescriptionsItem>

View File

@ -27,7 +27,7 @@ let userInfo = reactive({
}); });
let unitName = ref(''); let unitName = ref('');
const userId = ref<number | string>(0); const userId = ref<number | string>(0);
const unitId = ref<number | string>(0); const unitId = ref<string>('');
const [BasicForm, formApi] = useVbenForm({ const [BasicForm, formApi] = useVbenForm({
commonConfig: { commonConfig: {
// //
@ -70,7 +70,8 @@ const [BasicModal, modalApi] = useVbenModal({
if (isUpdate.value && id) { if (isUpdate.value && id) {
const record = await personInfo(id); const record = await personInfo(id);
userId.value = record.userId; userId.value = record.userId;
unitId.value = record.unitId; unitId.value = record.unitId.toString();
record.state=record.state?.toString()
await formApi.setValues(record); await formApi.setValues(record);
} }
await markInitialized(); await markInitialized();

View File

@ -9,12 +9,12 @@ const props= withDefaults(defineProps<{
disabled?: boolean; disabled?: boolean;
placeholder?: string; placeholder?: string;
isUpdate?:boolean; isUpdate?:boolean;
unitId?:number; unitId?:string;
}>(), { }>(), {
disabled: false, disabled: false,
placeholder: '可根据单位名称进行搜索...', placeholder: '可根据单位名称进行搜索...',
isUpdate:false, isUpdate:false,
unitId:0, unitId:'',
}); });
async function queryUnit(value: string, callback: any) { async function queryUnit(value: string, callback: any) {
@ -46,7 +46,7 @@ const handleChange = (val: string) => {
emit('update:unitInfo', unitInfo); emit('update:unitInfo', unitInfo);
}; };
async function getUnitInfo(val:number) { async function getUnitInfo(val:string) {
const unit = await resident_unitInfo(val) const unit = await resident_unitInfo(val)
if (unit) { if (unit) {
data.value = [{ data.value = [{
@ -60,7 +60,7 @@ async function getUnitInfo(val:number) {
watch(() => props.unitId, watch(() => props.unitId,
(newX) => { (newX) => {
if (props.isUpdate) { if (props.isUpdate&&newX) {
getUnitInfo(newX) getUnitInfo(newX)
} }
}, {immediate: true}) }, {immediate: true})

View File

@ -35,6 +35,7 @@ export const columns: VxeGridProps['columns'] = [
return (rowIndex + 1).toString(); return (rowIndex + 1).toString();
}, },
}, },
width: 60
}, },
{ {
title: '单位编号', title: '单位编号',
@ -42,11 +43,13 @@ export const columns: VxeGridProps['columns'] = [
slots:{ slots:{
default: ({ row }) => { default: ({ row }) => {
return row.id; return row.id;
}} }},
width: 100
}, },
{ {
title: '单位名称', title: '单位名称',
field: 'name', field: 'name',
width: 100
}, },
{ {
title: '单位类型', title: '单位类型',
@ -56,46 +59,55 @@ export const columns: VxeGridProps['columns'] = [
return renderDict(row.type, 'wy_qylx'); return renderDict(row.type, 'wy_qylx');
}, },
}, },
width: 100
}, },
{ {
title: '联系人', title: '联系人',
field: 'contactPerson', field: 'contactPerson',
width: 100
}, },
{ {
title: '联系电话', title: '联系电话',
field: 'phone', field: 'phone',
width: 100
}, },
{ {
title: '入驻位置', title: '入驻位置',
field: 'location', field: 'location',
width: 100,
}, },
{ {
title: '入驻时间', title: '入驻时间',
field: 'time', field: 'time',
width: 100,
}, },
{ {
title: '状态', title: '状态',
field: 'state', field: 'state',
slots: {default: 'state'} slots: {default: 'state'},
width: 100,
}, },
{ {
title: '员工数量', title: '员工数量',
field: 'number', field: 'number',
width: 100,
}, },
{ {
title: '备注', title: '备注',
field: 'remark', field: 'remark',
width: 100,
}, },
{ {
title: '创建时间', title: '创建时间',
field: 'createTime', field: 'createTime',
width: 100,
}, },
{ {
field: 'action', field: 'action',
fixed: 'right', fixed: 'right',
slots: {default: 'action'}, slots: {default: 'action'},
title: '操作', title: '操作',
width: 180, minWidth: 180,
}, },
]; ];
@ -137,15 +149,11 @@ export const modalSchema: FormSchemaGetter = () => [
component: 'Input', component: 'Input',
rules: z.string().regex(/^1[3-9]\d{9}$/, { message: '格式错误' }), rules: z.string().regex(/^1[3-9]\d{9}$/, { message: '格式错误' }),
}, },
{ {
label: '入驻位置', label: '入驻位置',
fieldName: 'location', fieldName: 'location',
component: 'Select', component: 'TreeSelect',
slots:{ rules: 'selectRequired',
default:'location'
},
rules: 'required',
formItemClass: 'col-span-2' formItemClass: 'col-span-2'
}, },
{ {

View File

@ -3,7 +3,7 @@ import { computed, ref } from 'vue';
import { useVbenModal } from '@vben/common-ui'; import { useVbenModal } from '@vben/common-ui';
import { $t } from '@vben/locales'; import { $t } from '@vben/locales';
import { cloneDeep } from '@vben/utils'; import {cloneDeep, getPopupContainer, handleNode} from '@vben/utils';
import { useVbenForm } from '#/adapter/form'; import { useVbenForm } from '#/adapter/form';
import { resident_unitAdd, resident_unitInfo, resident_unitUpdate } from '#/api/property/resident/unit'; import { resident_unitAdd, resident_unitInfo, resident_unitUpdate } from '#/api/property/resident/unit';
@ -11,6 +11,7 @@ import { defaultFormValueGetter, useBeforeCloseDiff } from '#/utils/popup';
import { modalSchema } from './data'; import { modalSchema } from './data';
import RoomSelect from "#/views/property/room/room-select.vue"; import RoomSelect from "#/views/property/room/room-select.vue";
import {communityTree} from "#/api/property/community";
const emit = defineEmits<{ reload: [] }>(); const emit = defineEmits<{ reload: [] }>();
@ -57,7 +58,7 @@ const [BasicModal, modalApi] = useVbenModal({
const { id } = modalApi.getData() as { id?: number | string }; const { id } = modalApi.getData() as { id?: number | string };
isUpdate.value = !!id; isUpdate.value = !!id;
initLocationOptions()
if (isUpdate.value && id) { if (isUpdate.value && id) {
const record = await resident_unitInfo(id); const record = await resident_unitInfo(id);
await formApi.setValues(record); await formApi.setValues(record);
@ -87,6 +88,42 @@ async function handleConfirm() {
modalApi.lock(false); modalApi.lock(false);
} }
} }
/**
* 入驻位置数据
*/
async function initLocationOptions() {
const locationList = await communityTree(5);
const splitStr = '/';
handleNode(locationList, 'label', splitStr, function (node: any) {
if (node.level != 5) {
node.disabled = true;
}
});
formApi.updateSchema([
{
componentProps: () => ({
class: 'w-full',
fieldNames: {
key: 'id',
label: 'label',
value: 'code',
children: 'children',
},
getPopupContainer,
placeholder: '请选择入驻位置',
showSearch: true,
treeData: locationList,
treeDefaultExpandAll: true,
treeLine: { showLeafIcon: false },
//
treeNodeFilterProp: 'label',
//
treeNodeLabelProp: 'fullName',
}),
fieldName: 'location',
},
]);
}
async function handleClosed() { async function handleClosed() {
await formApi.resetForm(); await formApi.resetForm();
@ -97,9 +134,9 @@ async function handleClosed() {
<template> <template>
<BasicModal :title="title"> <BasicModal :title="title">
<BasicForm> <BasicForm>
<template #location="slotProps"> <!-- <template #location="slotProps">-->
<RoomSelect v-bind="slotProps" :isUpdate="isUpdate" :level="2"/> <!-- <RoomSelect v-bind="slotProps" :isUpdate="isUpdate" :level="2"/>-->
</template> <!-- </template>-->
</BasicForm> </BasicForm>
</BasicModal> </BasicModal>
</template> </template>