资产审批

This commit is contained in:
mocheng 2025-06-25 11:37:28 +08:00
parent f620debe43
commit 8d517b3133
18 changed files with 606 additions and 341 deletions

View File

@ -0,0 +1,65 @@
import type { AssetTypeVO, AssetTypeForm, AssetTypeQuery } from './model';
import type { ID, IDS } from '#/api/common';
import type { PageResult } from '#/api/common';
import { commonExport } from '#/api/helper';
import { requestClient } from '#/api/request';
/**
*
* @param params
* @returns
*/
export function assetTypeList(params?: AssetTypeQuery) {
return requestClient.get<PageResult<AssetTypeVO>>('/property/assetType/list', { params });
}
export function assetTypeselect() {
return requestClient.get<AssetTypeVO[]>('/property/assetType/list');
}
/**
*
* @param params
* @returns
*/
export function assetTypeExport(params?: AssetTypeQuery) {
return commonExport('/property/assetType/export', params ?? {});
}
/**
*
* @param id id
* @returns
*/
export function assetTypeInfo(id: ID) {
return requestClient.get<AssetTypeVO>(`/property/assetType/${id}`);
}
/**
*
* @param data
* @returns void
*/
export function assetTypeAdd(data: AssetTypeForm) {
return requestClient.postWithMsg<void>('/property/assetType', data);
}
/**
*
* @param data
* @returns void
*/
export function assetTypeUpdate(data: AssetTypeForm) {
return requestClient.putWithMsg<void>('/property/assetType', data);
}
/**
*
* @param id id
* @returns void
*/
export function assetTypeRemove(id: ID | IDS) {
return requestClient.deleteWithMsg<void>(`/property/assetType/${id}`);
}

View File

@ -0,0 +1,64 @@
import type { PageQuery, BaseEntity } from '#/api/common';
export interface AssetTypeVO {
/**
*
*/
id: string | number;
/**
*
*/
assetTypeName: string;
/**
*
*/
sort: number;
/**
*
*/
createTime: string;
/**
*
*/
createBy: string;
}
export interface AssetTypeForm extends BaseEntity {
/**
*
*/
id?: string | number;
/**
*
*/
assetTypeName?: string;
/**
*
*/
sort?: number;
}
export interface AssetTypeQuery extends PageQuery {
/**
*
*/
assetTypeName?: string;
/**
*
*/
sort?: number;
/**
*
*/
params?: any;
}

View File

@ -1,5 +1,8 @@
import type { FormSchemaGetter } from '#/adapter/form';
import type { VxeGridProps } from '#/adapter/vxe-table';
import { renderDict } from "#/utils/render";
import { DictEnum } from '@vben/constants';
export const querySchema: FormSchemaGetter = () => [
@ -59,12 +62,12 @@ export const columns: VxeGridProps['columns'] = [
field: 'id',
},
{
title: '资产id',
field: 'assetId',
title: '资产',
field: 'assetName',
},
{
title: '领用人id',
field: 'userId',
title: '领用人',
field: 'userName',
},
{
title: '数量',
@ -73,10 +76,15 @@ export const columns: VxeGridProps['columns'] = [
{
title: '状态',
field: 'state',
slots: {
default: ({ row }) => {
return renderDict(row.state, DictEnum.WY_ZCSHZT);
},
},
},
{
title: '审批人id',
field: 'acceptanceUserId',
title: '审批人',
field: 'acceptanceUserName',
},
{
title: '审批时间',

View File

@ -10,7 +10,8 @@ import { assetAdd, assetInfo, assetUpdate } from '#/api/property/assetManage/ass
import { defaultFormValueGetter, useBeforeCloseDiff } from '#/utils/popup';
import { modalSchema } from './data';
import { assetTypeselect } from "#/api/property/assetManage/assetType";
import { packageSelectList } from "#/api/system/tenant-package";
import { assetTypeselect } from "#/api/property/assetType";
import { depotList } from "#/api/property/assetManage/depot";
import { suppliersList } from "#/api/property/assetManage/suppliers";

View File

@ -1,8 +1,9 @@
import type {FormSchemaGetter} from '#/adapter/form';
import type {VxeGridProps} from '#/adapter/vxe-table';
import {getDictOptions} from "#/utils/dict";
import {assetTypeList} from "#/api/property/assetManage/assetType";
import type {AssetTypeVO} from "#/api/property/assetManage/assetType/model";
import { renderDict } from "#/utils/render";
import { DictEnum } from '@vben/constants';
export const querySchema: FormSchemaGetter = () => [
@ -15,13 +16,6 @@ export const querySchema: FormSchemaGetter = () => [
component: 'Select',
fieldName: 'model',
label: '资产类型',
componentProps: {
showSearch:true,
placeholder:'根据类型名称搜索...',
onSearch:handleSearch,
onChange:handleChange,
options:typeData
},
},
{
component: 'Select',
@ -34,6 +28,8 @@ export const querySchema: FormSchemaGetter = () => [
];
// 需要使用i18n注意这里要改成getter形式 否则切换语言不会刷新
// export const columns: () => VxeGridProps['columns'] = () => [
export const columns: VxeGridProps['columns'] = [
{type: 'checkbox', width: 60},
{
@ -51,7 +47,7 @@ export const columns: VxeGridProps['columns'] = [
},
{
title: '资产类型',
field: 'model',
field: 'modelName',
},
{
title: '规格',
@ -70,16 +66,16 @@ export const columns: VxeGridProps['columns'] = [
field: 'unit',
},
{
title: '仓库id',
field: 'depotId',
title: '仓库',
field: 'depotName',
},
{
title: '描述信息',
field: 'msg',
},
{
title: '供应商id',
field: 'suppliersId',
title: '供应商',
field: 'suppliersName',
},
{
title: '入库时间',
@ -88,6 +84,11 @@ export const columns: VxeGridProps['columns'] = [
{
title: '固定资产',
field: 'type',
slots: {
default: ({ row }) => {
return renderDict(row.type, DictEnum.WY_SF);
},
},
},
{
title: '创建时间',
@ -120,7 +121,7 @@ export const modalSchema: FormSchemaGetter = () => [
{
label: '类型',
fieldName: 'model',
component: 'Textarea',
component: 'Select',
},
{
label: '规格',
@ -143,9 +144,9 @@ export const modalSchema: FormSchemaGetter = () => [
component: 'Input',
},
{
label: '仓库id',
label: '仓库',
fieldName: 'depotId',
component: 'Input',
component: 'Select',
},
{
label: '描述信息',
@ -155,7 +156,7 @@ export const modalSchema: FormSchemaGetter = () => [
{
label: '供应商id',
fieldName: 'suppliersId',
component: 'Input',
component: 'Select',
},
{
label: '入库时间',
@ -171,34 +172,8 @@ export const modalSchema: FormSchemaGetter = () => [
label: '固定资产类型',
fieldName: 'type',
component: 'Select',
componentProps: {},
componentProps: {
options: getDictOptions('wy_sf'),
},
},
];
let typeData:AssetTypeVO[]=[]
const handleSearch = (val: string) => {
queryAssetsType(val, (d: any[]) => (typeData = d));
};
const handleChange = (val: string) => {
queryAssetsType(val, (d: any[]) => (typeData = d));
};
function queryAssetsType(value: string, callback: any) {
let queryParam={
pageNum:100,
pageSize:1,
assetTypeName:value
}
assetTypeList(queryParam).then(res=>{
const data: any[] = [];
res.rows.forEach((r: any) => {
data.push({
value: r.assetTypeName,
label: r.id,
});
});
callback(data);
})
}

View File

@ -110,7 +110,6 @@ function handleDownloadExcel() {
<template>
<Page :auto-content-height="true">
<BasicTable table-title="资产列表">
<template #toolbar-tools>
<Space>

View File

@ -0,0 +1,101 @@
<script setup lang="ts">
import { computed, 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 { assetTypeAdd, assetTypeInfo, assetTypeUpdate } from '#/api/property/assetType';
import { defaultFormValueGetter, useBeforeCloseDiff } from '#/utils/popup';
import { modalSchema } from './data';
const emit = defineEmits<{ reload: [] }>();
const isUpdate = ref(false);
const title = computed(() => {
return isUpdate.value ? $t('pages.common.edit') : $t('pages.common.add');
});
const [BasicForm, formApi] = useVbenForm({
commonConfig: {
//
formItemClass: 'col-span-2',
// label px
labelWidth: 80,
//
componentProps: {
class: 'w-full',
}
},
schema: modalSchema(),
showDefaultActions: false,
wrapperClass: 'grid-cols-2',
});
const { onBeforeClose, markInitialized, resetInitialized } = useBeforeCloseDiff(
{
initializedGetter: defaultFormValueGetter(formApi),
currentGetter: defaultFormValueGetter(formApi),
},
);
const [BasicModal, modalApi] = useVbenModal({
//
class: 'w-[550px]',
fullscreenButton: false,
onBeforeClose,
onClosed: handleClosed,
onConfirm: handleConfirm,
onOpenChange: async (isOpen) => {
if (!isOpen) {
return null;
}
modalApi.modalLoading(true);
const { id } = modalApi.getData() as { id?: number | string };
isUpdate.value = !!id;
if (isUpdate.value && id) {
const record = await assetTypeInfo(id);
await formApi.setValues(record);
}
await markInitialized();
modalApi.modalLoading(false);
},
});
async function handleConfirm() {
try {
modalApi.lock(true);
const { valid } = await formApi.validate();
if (!valid) {
return;
}
// getValuesreadonly
const data = cloneDeep(await formApi.getValues());
await (isUpdate.value ? assetTypeUpdate(data) : assetTypeAdd(data));
resetInitialized();
emit('reload');
modalApi.close();
} catch (error) {
console.error(error);
} finally {
modalApi.lock(false);
}
}
async function handleClosed() {
await formApi.resetForm();
resetInitialized();
}
</script>
<template>
<BasicModal :title="title">
<BasicForm />
</BasicModal>
</template>

View File

@ -0,0 +1,71 @@
import type { FormSchemaGetter } from '#/adapter/form';
import type { VxeGridProps } from '#/adapter/vxe-table';
export const querySchema: FormSchemaGetter = () => [
{
component: 'Input',
fieldName: 'assetTypeName',
label: '分类名称',
},
{
component: 'Input',
fieldName: 'sort',
label: '排序',
},
];
// 需要使用i18n注意这里要改成getter形式 否则切换语言不会刷新
// export const columns: () => VxeGridProps['columns'] = () => [
export const columns: VxeGridProps['columns'] = [
{ type: 'checkbox', width: 60 },
{
title: '主键',
field: 'id',
},
{
title: '分类名称',
field: 'assetTypeName',
},
{
title: '排序',
field: 'sort',
},
{
title: '创建时间',
field: 'createTime',
},
{
title: '创建人',
field: 'createBy',
},
{
field: 'action',
fixed: 'right',
slots: { default: 'action' },
title: '操作',
width: 180,
},
];
export const modalSchema: FormSchemaGetter = () => [
{
label: '主键',
fieldName: 'id',
component: 'Input',
dependencies: {
show: () => false,
triggerFields: [''],
},
},
{
label: '分类名称',
fieldName: 'assetTypeName',
component: 'Input',
},
{
label: '排序',
fieldName: 'sort',
component: 'Input',
},
];

View File

@ -0,0 +1,182 @@
<script setup lang="ts">
import type { Recordable } from '@vben/types';
import { ref } from 'vue';
import { Page, useVbenModal, type VbenFormProps } from '@vben/common-ui';
import { getVxePopupContainer } from '@vben/utils';
import { Modal, Popconfirm, Space } from 'ant-design-vue';
import dayjs from 'dayjs';
import {
useVbenVxeGrid,
vxeCheckboxChecked,
type VxeGridProps
} from '#/adapter/vxe-table';
import {
assetTypeExport,
assetTypeList,
assetTypeRemove,
} from '#/api/property/assetType';
import type { AssetTypeForm } from '#/api/property/assetType/model';
import { commonDownloadExcel } from '#/utils/file/download';
import assetTypeModal from './assetType-modal.vue';
import { columns, querySchema } from './data';
const formOptions: VbenFormProps = {
commonConfig: {
labelWidth: 80,
componentProps: {
allowClear: true,
},
},
schema: querySchema(),
wrapperClass: 'grid-cols-1 md:grid-cols-2 lg:grid-cols-3 xl:grid-cols-4',
// RangePicker /
//
// fieldMappingTime: [
// [
// 'createTime',
// ['params[beginTime]', 'params[endTime]'],
// ['YYYY-MM-DD 00:00:00', 'YYYY-MM-DD 23:59:59'],
// ],
// ],
};
const gridOptions: VxeGridProps = {
checkboxConfig: {
//
highlight: true,
//
reserve: true,
//
// trigger: 'row',
},
// 使i18ngetter
// columns: columns(),
columns,
height: 'auto',
keepSource: true,
pagerConfig: {},
proxyConfig: {
ajax: {
query: async ({ page }, formValues = {}) => {
return await assetTypeList({
pageNum: page.currentPage,
pageSize: page.pageSize,
...formValues,
});
},
},
},
rowConfig: {
keyField: 'id',
},
//
id: 'property-assetType-index'
};
const [BasicTable, tableApi] = useVbenVxeGrid({
formOptions,
gridOptions,
});
const [AssetTypeModal, modalApi] = useVbenModal({
connectedComponent: assetTypeModal,
});
function handleAdd() {
modalApi.setData({});
modalApi.open();
}
async function handleEdit(row: Required<AssetTypeForm>) {
modalApi.setData({ id: row.id });
modalApi.open();
}
async function handleDelete(row: Required<AssetTypeForm>) {
await assetTypeRemove(row.id);
await tableApi.query();
}
function handleMultiDelete() {
const rows = tableApi.grid.getCheckboxRecords();
const ids = rows.map((row: Required<AssetTypeForm>) => row.id);
Modal.confirm({
title: '提示',
okType: 'danger',
content: `确认删除选中的${ids.length}条记录吗?`,
onOk: async () => {
await assetTypeRemove(ids);
await tableApi.query();
},
});
}
function handleDownloadExcel() {
commonDownloadExcel(assetTypeExport, '资产类型数据', tableApi.formApi.form.values, {
fieldMappingTime: formOptions.fieldMappingTime,
});
}
</script>
<template>
<Page :auto-content-height="true">
<BasicTable table-title="资产类型列表">
<template #toolbar-tools>
<Space>
<a-button
v-access:code="['property:assetType:export']"
@click="handleDownloadExcel"
>
{{ $t('pages.common.export') }}
</a-button>
<a-button
:disabled="!vxeCheckboxChecked(tableApi)"
danger
type="primary"
v-access:code="['property:assetType:remove']"
@click="handleMultiDelete">
{{ $t('pages.common.delete') }}
</a-button>
<a-button
type="primary"
v-access:code="['property:assetType:add']"
@click="handleAdd"
>
{{ $t('pages.common.add') }}
</a-button>
</Space>
</template>
<template #action="{ row }">
<Space>
<ghost-button
v-access:code="['property:assetType:edit']"
@click.stop="handleEdit(row)"
>
{{ $t('pages.common.edit') }}
</ghost-button>
<Popconfirm
:get-popup-container="getVxePopupContainer"
placement="left"
title="确认删除?"
@confirm="handleDelete(row)"
>
<ghost-button
danger
v-access:code="['property:assetType:remove']"
@click.stop=""
>
{{ $t('pages.common.delete') }}
</ghost-button>
</Popconfirm>
</Space>
</template>
</BasicTable>
<AssetTypeModal @reload="tableApi.query()" />
</Page>
</template>

View File

@ -12,19 +12,11 @@ import type { CleanVO } from '#/api/property/clean/model';
import { clean_orderAdd, clean_orderInfo, clean_orderUpdate } from '#/api/property/clean_order';
import { defaultFormValueGetter, useBeforeCloseDiff } from '#/utils/popup';
import { resident_unitList } from '#/api/property/resident/unit';
import { useVbenVxeGrid } from '#/adapter/vxe-table';
import type { VxeGridProps } from '#/adapter/vxe-table';
import cleanDetailModal from './clean-detail-modal.vue';
import { Table, Button } from 'ant-design-vue';
import { modalSchema } from './data';
const totalSumPeices = computed(() => {
return detailTable.value
.reduce((total: number, item: any) => total + (Number(item.sumPeices) || 0), 0)
.toFixed(2);
});
const emit = defineEmits<{ reload: [] }>();
const isUpdate = ref(false);
const title = computed(() => {
return isUpdate.value ? $t('pages.common.edit') : $t('pages.common.add');
@ -107,9 +99,8 @@ const [BasicModal, modalApi] = useVbenModal({
const { id } = modalApi.getData() as { id?: number | string };
isUpdate.value = !!id;
if (isUpdate.value && id) {
const record:any = await clean_orderInfo(id);
const record = await clean_orderInfo(id);
if (record.starTime) record.starTime = dayjs(record.starTime);
if (record.endTime) record.endTime = dayjs(record.endTime);
editUnitId.value = record.unitId || '';
@ -121,121 +112,6 @@ const [BasicModal, modalApi] = useVbenModal({
},
});
//
const detailGridOptions: VxeGridProps = {
height: '300px',
columns: [
{ type: 'checkbox', width: 60 },
{
title: '序号',
field: 'index',
slots: {
default: ({ rowIndex }) => {
return (rowIndex + 1).toString();
},
},
},
{
title: '劳务名称',
field: 'name',
},
{
title: '计量单位',
field: 'measure',
},
{
title: '计算方式',
field: 'method',
},
{
title: '申报单价含税(元)',
field: 'peices',
},
{
title: '保洁频率',
field: 'frequency',
},
{
title: '保洁标准',
field: 'standard',
},
{
title: '备注',
field: 'remark',
},
{
title: '状态',
field: 'stater',
slots: {
default: ({ row }) => row.stater === 1 ? '启用' : '禁用',
},
},
{
title: '保洁面积',
field: 'area',
},
{
title: '合计费用',
field: 'sumPeices',
},
{
field: 'action',
fixed: 'right',
slots: { default: 'action' },
title: '操作',
width: 120,
},
],
data: [],
};
const detailColumns = [
{ title: '序号', key: 'index'},
{ title: '劳务名称', dataIndex: 'name', key: 'name' },
{ title: '计量单位', dataIndex: 'measure', key: 'measure' },
{ title: '计算方式', dataIndex: 'method', key: 'method' },
{ title: '申报单价含税(元)', dataIndex: 'peices', key: 'peices' },
{ title: '保洁频率', dataIndex: 'frequency', key: 'frequency' },
{ title: '保洁标准', dataIndex: 'standard', key: 'standard' },
{ title: '备注', dataIndex: 'remark', key: 'remark' },
{
title: '状态',
dataIndex: 'stater',
key: 'stater',
customRender: ({ value }: { value: number }) => (value === 1 ? '启用' : '禁用')
},
{ title: '保洁面积', dataIndex: 'area', key: 'area' },
{ title: '合计费用', dataIndex: 'sumPeices', key: 'sumPeices' },
{
title: '操作',
key: 'action',
fixed: 'right',
width: 120,
},
]
const [DetailTable, detailTableApi] = useVbenVxeGrid({
gridOptions: detailGridOptions,
});
const detailTable = ref<any>([])
const [CleanDetailModal, detailModalApi] = useVbenModal({
connectedComponent: cleanDetailModal,
});
function handleAddDetail() {
detailModalApi.setData({});
detailModalApi.open();
}
function handleDetailReload(data: any) {
detailTable.value.push(data)
}
function handleDeleteDetail(record: any,index: number) {
console.log(record,index);
detailTable.value.splice(index,1)
}
async function handleConfirm() {
try {
modalApi.lock(true);
@ -244,13 +120,15 @@ async function handleConfirm() {
return;
}
const data = cloneDeep(await formApi.getValues());
console.log(data);
console.log(data);
//
if (unitListData.length === 0) {
const res = await resident_unitList();
unitListData = res.rows || [];
}
// cleanListData
// label
const unitObj = unitListData.find(item => item.id === data.unit);
const cleanObj = cleanListData.find(item => item.id === data.name);
@ -282,54 +160,8 @@ async function handleClosed() {
</script>
<template>
<BasicModal :title="title" >
<BasicModal :title="title">
<BasicForm />
<!-- 添加订单详情部分 -->
<div class="mt-4">
<div class="flex items-center justify-between mb-2">
<h3 class="text-lg font-medium">添加保洁订单详情</h3>
<a-button type="primary" @click="handleAddDetail">
{{ $t('pages.common.add') }}
</a-button>
</div>
<Table :dataSource="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>
<CleanDetailModal @reload="handleDetailReload" />
</BasicModal>
</template>
<style scoped>
.mt-4 {
margin-top: 1rem;
}
.mb-2 {
margin-bottom: 0.5rem;
}
.flex {
display: flex;
}
.items-center {
align-items: center;
}
.justify-between {
justify-content: space-between;
}
.text-lg {
font-size: 1.125rem;
line-height: 1.75rem;
}
.font-medium {
font-weight: 500;
}
</style>

View File

@ -131,28 +131,28 @@ export const modalSchema: FormSchemaGetter = () => [
component: 'Input',
rules: 'required',
},
// {
// label: '劳务名称',
// fieldName: 'name',
// component: 'ApiSelect',
// componentProps: {
// api: cleanList,
// resultField: 'rows',
// labelField: 'name',
// valueField: 'id',
// },
// rules: 'required',
// },
// {
// label: '服务单价',
// fieldName: 'prices',
// component: 'Input',
// rules: 'required',
// componentProps: {
// placeholder: '',
// disabled: true,
// },
// },
{
label: '劳务名称',
fieldName: 'name',
component: 'ApiSelect',
componentProps: {
api: cleanList,
resultField: 'rows',
labelField: 'name',
valueField: 'id',
},
rules: 'required',
},
{
label: '服务单价',
fieldName: 'prices',
component: 'Input',
rules: 'required',
componentProps: {
placeholder: '',
disabled: true,
},
},
// {
// label: '保洁频率',
// fieldName: 'frequency',

View File

@ -1,7 +1,6 @@
import type { FormSchemaGetter } from '#/adapter/form';
import type { VxeGridProps } from '#/adapter/vxe-table';
import {getDictOptions} from "#/utils/dict";
import {renderDict} from "#/utils/render";
export const querySchema: FormSchemaGetter = () => [
{
@ -50,11 +49,6 @@ export const columns: VxeGridProps['columns'] = [
{
title: '性别',
field: 'gender',
slots:{
default: ({row})=>{
return renderDict(row.gender,'sys_user_sex')
}
}
},
{
field: 'img',
@ -81,9 +75,7 @@ export const columns: VxeGridProps['columns'] = [
{
title: '状态',
field: 'state',
slots:{
default: 'state'
}
// slots: { default: 'state' },
},
{
title: '备注',

View File

@ -14,7 +14,7 @@ import {
import {
personExport,
personList,
personRemove, personUpdate,
personRemove,
} from '#/api/property/resident/person';
import type { PersonForm } from '#/api/property/resident/person/model';
import { commonDownloadExcel } from '#/utils/file/download';
@ -22,8 +22,7 @@ import { commonDownloadExcel } from '#/utils/file/download';
import personModal from './person-modal.vue';
import personDetail from './person-detail.vue';
import { columns, querySchema } from './data';
import {useAccess} from "@vben/access";
import {TableSwitch} from "#/components/table";
// import {TableSwitch} from "#/components/table";
const formOptions: VbenFormProps = {
commonConfig: {
@ -45,6 +44,8 @@ const gridOptions: VxeGridProps = {
//
// trigger: 'row',
},
// 使i18ngetter
// columns: columns(),
columns,
height: 'auto',
keepSource: true,
@ -79,7 +80,6 @@ const [PersonDetail, personDetailApi] = useVbenModal({
connectedComponent: personDetail,
});
const { hasAccessByCodes } = useAccess();
function handleAdd() {
modalApi.setData({});
@ -120,6 +120,7 @@ function handleInfo(row: Required<PersonForm>) {
personDetailApi.setData({ id: row.id });
personDetailApi.open();
}
</script>
<template>
@ -153,16 +154,16 @@ function handleInfo(row: Required<PersonForm>) {
<template #img="{ row }">
<Avatar :src="row.img" />
</template>
<template #state="{ row }">
<TableSwitch
:checkedValue="1"
:unCheckedValue="0"
v-model:value="row.state"
:api="() => personUpdate(row)"
:disabled="!hasAccessByCodes(['property:person:edit'])"
@reload="() => tableApi.query()"
/>
</template>
<!-- <template #state="{ row }">-->
<!-- <TableSwitch-->
<!-- v-model:value="row.status"-->
<!-- :api="() => personStatusChange(row)"-->
<!-- :disabled="-->
<!-- row.userId === 1 || !hasAccessByCodes(['system:user:edit'])-->
<!-- "-->
<!-- @reload="() => tableApi.query()"-->
<!-- />-->
<!-- </template>-->
<template #action="{ row }">
<Space>
<ghost-button

View File

@ -8,10 +8,11 @@ import dayjs from 'dayjs';
import duration from 'dayjs/plugin/duration';
import relativeTime from 'dayjs/plugin/relativeTime';
import {personInfo} from '#/api/property/resident/person';
// import {personInfo} from '#/api/property/resident/person';
import type {Person} from "#/api/property/resident/person/model";
import {accessControlColumns,carColumns} from "#/views/property/resident/person/data";
import { renderDictValue} from "#/utils/render";
// import {personList} from "#/api/property/resident/person";
// import {renderDict} from "#/utils/render";
dayjs.extend(duration);
@ -35,9 +36,11 @@ async function handleOpenChange(open: boolean) {
}
modalApi.modalLoading(true);
const {id} = modalApi.getData() as { id: number | string };
// const {id} = modalApi.getData() as { id: number | string };
// const response = await personInfo(id);
const response = {id:1};
//
personDetail.value = await personInfo(id);
personDetail.value = response;
modalApi.modalLoading(false);
}
@ -49,25 +52,25 @@ async function handleOpenChange(open: boolean) {
<BasicModal :footer="false" :fullscreen-button="false" title="入驻人员信息" class="w-[70%]">
<Descriptions v-if="personDetail" size="small" :column="1" bordered :labelStyle="{width:'100px'}">
<DescriptionsItem label="入驻人员">
{{ personDetail.userName+'-'+renderDictValue(personDetail.gender,'sys_user_sex')+'-'+personDetail.phone}}
{{ '入驻人员' }}
</DescriptionsItem>
<DescriptionsItem label="所属单位">
{{personDetail.unitName+'-'+personDetail.unitId }}
{{ '单位名称' }}
</DescriptionsItem>
<DescriptionsItem label="入驻位置">
{{ personDetail.locathon }}
{{ '单位名称' }}
</DescriptionsItem>
<DescriptionsItem label="人脸图片">
{{ personDetail.img }}
{{ '单位名称' }}
</DescriptionsItem>
<DescriptionsItem label="入驻时间">
{{ personDetail.time}}
{{ '单位名称' }}
</DescriptionsItem>
<DescriptionsItem label="车牌号码">
{{personDetail.carNumber}}
{{ '单位名称' }}
</DescriptionsItem>
<DescriptionsItem label="备注">
{{ personDetail.remark }}
{{ '单位名称' }}
</DescriptionsItem>
</Descriptions>
@ -82,7 +85,7 @@ async function handleOpenChange(open: boolean) {
</template>
</Table>
</TabPane>
<TabPane key="2" tab="车辆记录" v-if="personDetail?.carNumber">
<TabPane key="2" tab="车辆记录">
<Table :dataSource="[]" :columns="carColumns" :pagination="false" >
<template #bodyCell="{ column, index }">
<template v-if="column.field === 'id'">

View File

@ -27,7 +27,6 @@ let userInfo = reactive({
});
let unitName = ref('');
const userId = ref<number | string>(0);
const unitId = ref<number | string>(0);
const [BasicForm, formApi] = useVbenForm({
commonConfig: {
//
@ -70,7 +69,7 @@ const [BasicModal, modalApi] = useVbenModal({
if (isUpdate.value && id) {
const record = await personInfo(id);
userId.value = record.userId;
unitId.value = record.unitId;
console.log(userId.value,'====================1111')
await formApi.setValues(record);
}
await markInitialized();
@ -88,12 +87,10 @@ async function handleConfirm() {
}
// getValuesreadonly
let data = cloneDeep(await formApi.getValues());
if (userInfo) {
if (!isUpdate.value) {
data.userName = userInfo.userName
data.phone = userInfo.phone
data.gender = userInfo.gender
}
if(unitName.value){
data.unitName = unitName.value
}
await (isUpdate.value ? personUpdate(data) : personAdd(data));
@ -128,7 +125,7 @@ function getUnitInfo(unit: { name: string }) {
<QueryUserList @update:userInfo="getUserInfo" v-bind="slotProps" :isUpdate="isUpdate" :userId="userId"/>
</template>
<template #unitId="slotProps">
<QueryUnitList @update:unitInfo="getUnitInfo" v-bind="slotProps" :isUpdate="isUpdate" :unitId="unitId"/>
<QueryUnitList @update:unitInfo="getUnitInfo" v-bind="slotProps" :disabled="isUpdate"/>
</template>
</BasicForm>
</BasicModal>

View File

@ -1,20 +1,13 @@
<script lang="ts" setup>
import {ref, watch} from 'vue';
import {ref} from 'vue';
import {Select} from 'ant-design-vue';
import {resident_unitList,resident_unitInfo} from "#/api/property/resident/unit";
import {resident_unitList} from "#/api/property/resident/unit";
defineOptions({name: 'QueryUnitList'});
const props= withDefaults(defineProps<{
disabled?: boolean;
placeholder?: string;
isUpdate?:boolean;
unitId?:string;
}>(), {
withDefaults(defineProps<{ disabled?: boolean; placeholder?: string }>(), {
disabled: false,
placeholder: '可根据单位名称进行搜索...',
isUpdate:false,
unitId:'',
});
async function queryUnit(value: string, callback: any) {
@ -22,14 +15,11 @@ async function queryUnit(value: string, callback: any) {
name: value,
pageSize: 100,
pageNum: 1,
state:1,
}
const res = await resident_unitList(queryData);
const options = res.rows.map((unit) => ({
label: unit.name+'-'+unit.id,
value: unit.id,
name:unit.name,
unitNumber:unit.unitNumber,
}));
callback(options);
}
@ -42,33 +32,19 @@ const handleSearch = (val: string) => {
const emit = defineEmits(['update:unitInfo']);
const handleChange = (val: string) => {
value.value = val;
const unitInfo = data.value.find(option => option.value === val);
const unitInfoStr = data.value.find(option => option.value === val)?.label;
let arr = unitInfoStr.split('-')
let unitInfo = {
name: arr[0],
unitNumber: arr[1],
}
emit('update:unitInfo', unitInfo);
};
async function getUnitInfo(val) {
const unit = await resident_unitInfo(val)
if (unit) {
data.value = [{
label: unit.name+'-'+unit.id,
value: unit.id,
name:unit.name,
unitNumber:unit.id,
}]
}
}
watch(() => props.unitId,
(newX) => {
if (props.isUpdate) {
getUnitInfo(newX)
}
}, {immediate: true})
</script>
<template>
<!-- v-model:value="value"-->
<Select
v-model="value"
show-search
:placeholder="placeholder"
style="width: 100%"

View File

@ -17,10 +17,10 @@ const props = withDefaults(defineProps<{
isUpdate: false,
userId: 0
});
watch(() => props.userId,
watch(() => props.isUpdate,
(newX) => {
if (props.isUpdate) {
getUserInfo(newX)
if (newX) {
getUserInfo()
}
}, {immediate: true})
@ -50,33 +50,30 @@ const handleSearch = (val: string) => {
};
const emit = defineEmits(['update:userInfo']);
const handleChange = (val: string) => {
value.value = val;
// 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) {
if (!val) return;
const res = await findUserInfo(val)
const user = res.user
if (user) {
data.value = [{
// label: user.nickName + '-' + renderDictValue(user.sex, 'sys_user_sex') + '-' + user.phonenumber,
label: user.nickName + '-' + user.phonenumber,
async function getUserInfo() {
console.log(value.value, '=============value')
const user = await (await findUserInfo(value.value)).user
console.log(user, '=================ss')
if(user){
data.value=[{
label: user.nickName + '-' + renderDictValue(user.sex, 'sys_user_sex') + '-' + user.phonenumber,
value: user.userId,
userName: user.userName,
gender: user.sex,
phone: user.phonenumber,
}]
emit('update:userInfo', data.value[0]);
}
}
</script>
<template>
<Select
:disabled="isUpdate"
v-model="value"
show-search
:placeholder="placeholder"

View File

@ -14,6 +14,7 @@ export const DictEnum = {
WF_FORM_TYPE: 'wf_form_type', // 表单类型
WF_TASK_STATUS: 'wf_task_status', // 任务状态
WY_SF: 'wy_sf',
WY_ZCSHZT: 'wy_zcshzt',
} as const;
export type DictEnumKey = keyof typeof DictEnum;