1、资产管理
Some checks failed
Gitea Actions Demo / Explore-Gitea-Actions (push) Failing after 6m27s

This commit is contained in:
2025-06-24 14:52:45 +08:00
parent ed326906f5
commit a107323e36
37 changed files with 521 additions and 454 deletions

View File

@@ -1,100 +1,49 @@
import type { FormSchemaGetter } from '#/adapter/form';
import type { VxeGridProps } from '#/adapter/vxe-table';
import type {FormSchemaGetter} from '#/adapter/form';
import type {VxeGridProps} from '#/adapter/vxe-table';
import { getDictOptions } from '#/utils/dict';
import { renderDict } from '#/utils/render';
import {getDictOptions} from '#/utils/dict';
import {renderDict} from '#/utils/render';
export const querySchema: FormSchemaGetter = () => [
{
component: 'Input',
fieldName: 'accessCode',
label: '门禁设备编码',
label: '设备编码',
},
{
component: 'Input',
fieldName: 'accessName',
label: '门禁名称',
},
{
component: 'Input',
fieldName: 'communityCode',
label: '园区编码',
},
{
component: 'Input',
fieldName: 'buildingCode',
label: '建筑编码',
},
{
component: 'Input',
fieldName: 'accessIp',
label: '门禁设备ip',
},
{
component: 'Input',
fieldName: 'accessPort',
label: '端口',
},
{
component: 'Input',
fieldName: 'accessType',
label: '门禁设备类型',
},
{
component: 'Input',
fieldName: 'factoryCode',
label: '工厂编码',
label: '设备名称',
},
{
component: 'Select',
fieldName: 'controlType',
componentProps: {
// 可选从DictEnum中获取 DictEnum.WY_KZKLX 便于维护
options: getDictOptions('wy_kzklx'),
},
fieldName: 'controlType',
label: '控制卡类型1-系统2-E8',
},
{
component: 'Input',
fieldName: 'controlCode',
label: '控制卡类型编码',
},
{
component: 'Input',
fieldName: 'outCode',
label: '外部编码',
},
{
component: 'Input',
fieldName: 'orgCode',
label: '组织编码',
},
{
component: 'Input',
fieldName: 'dataState',
label: '数据状态1有效0无效',
},
{
component: 'Input',
fieldName: 'searchValue',
label: '搜索值',
label: '控制卡类型',
},
];
// 需要使用i18n注意这里要改成getter形式 否则切换语言不会刷新
// export const columns: () => VxeGridProps['columns'] = () => [
export const columns: VxeGridProps['columns'] = [
{ type: 'checkbox', width: 60 },
{type: 'checkbox', width: 60},
{
title: '主键',
title: '序号',
field: 'id',
slots: {
default: ({rowIndex}) => {
return rowIndex + 1;
},
},
},
{
title: '门禁设备编码',
title: '设备编码',
field: 'accessCode',
},
{
title: '门禁名称',
title: '设备名称',
field: 'accessName',
},
{
@@ -106,7 +55,7 @@ export const columns: VxeGridProps['columns'] = [
field: 'buildingCode',
},
{
title: '门禁设备ip',
title: '设备IP',
field: 'accessIp',
},
{
@@ -114,7 +63,7 @@ export const columns: VxeGridProps['columns'] = [
field: 'accessPort',
},
{
title: '门禁设备类型',
title: '设备类型',
field: 'accessType',
},
{
@@ -122,11 +71,10 @@ export const columns: VxeGridProps['columns'] = [
field: 'factoryCode',
},
{
title: '控制卡类型1-系统2-E8',
title: '控制卡类型',
field: 'controlType',
slots: {
default: ({ row }) => {
// 可选从DictEnum中获取 DictEnum.WY_KZKLX 便于维护
default: ({row}) => {
return renderDict(row.controlType, 'wy_kzklx');
},
},
@@ -143,18 +91,10 @@ export const columns: VxeGridProps['columns'] = [
title: '组织编码',
field: 'orgCode',
},
{
title: '数据状态1有效0无效',
field: 'dataState',
},
{
title: '搜索值',
field: 'searchValue',
},
{
field: 'action',
fixed: 'right',
slots: { default: 'action' },
slots: {default: 'action'},
title: '操作',
width: 180,
},
@@ -171,13 +111,13 @@ export const modalSchema: FormSchemaGetter = () => [
},
},
{
label: '门禁设备编码',
label: '设备编码',
fieldName: 'accessCode',
component: 'Input',
rules: 'required',
},
{
label: '门禁名称',
label: '设备名称',
fieldName: 'accessName',
component: 'Input',
rules: 'required',
@@ -195,7 +135,7 @@ export const modalSchema: FormSchemaGetter = () => [
rules: 'required',
},
{
label: '门禁设备ip',
label: '设备IP',
fieldName: 'accessIp',
component: 'Input',
},
@@ -205,7 +145,7 @@ export const modalSchema: FormSchemaGetter = () => [
component: 'Input',
},
{
label: '门禁设备类型',
label: '设备类型',
fieldName: 'accessType',
component: 'Input',
rules: 'required',
@@ -217,7 +157,7 @@ export const modalSchema: FormSchemaGetter = () => [
rules: 'required',
},
{
label: '控制卡类型1-系统2-E8',
label: '控制卡类型',
fieldName: 'controlType',
component: 'Select',
componentProps: {
@@ -242,15 +182,4 @@ export const modalSchema: FormSchemaGetter = () => [
component: 'Input',
rules: 'required',
},
{
label: '数据状态1有效0无效',
fieldName: 'dataState',
component: 'Input',
rules: 'required',
},
{
label: '搜索值',
fieldName: 'searchValue',
component: 'Input',
},
];

View File

@@ -9,10 +9,10 @@ import { getVxePopupContainer } from '@vben/utils';
import { Modal, Popconfirm, Space } from 'ant-design-vue';
import dayjs from 'dayjs';
import {
import {
useVbenVxeGrid,
vxeCheckboxChecked,
type VxeGridProps
type VxeGridProps
} from '#/adapter/vxe-table';
import {
@@ -23,12 +23,12 @@ import {
import type { AccessControlForm } from '#/api/property/accessControl/model';
import { commonDownloadExcel } from '#/utils/file/download';
import accessControlModal from './accessControl-modal.vue';
import accessControlModal from './accessControlModal.vue';
import { columns, querySchema } from './data';
const formOptions: VbenFormProps = {
commonConfig: {
labelWidth: 80,
labelWidth: 100,
componentProps: {
allowClear: true,
},
@@ -126,7 +126,7 @@ function handleDownloadExcel() {
<template>
<Page :auto-content-height="true">
<BasicTable table-title="门禁管理列表">
<BasicTable table-title="门禁设备列表">
<template #toolbar-tools>
<Space>
<a-button
@@ -138,8 +138,8 @@ function handleDownloadExcel() {
<a-button
:disabled="!vxeCheckboxChecked(tableApi)"
danger
type="primary"
v-access:code="['property:accessControl:remove']"
type="primary"
v-access:code="['property:accessControl:remove']"
@click="handleMultiDelete">
{{ $t('pages.common.delete') }}
</a-button>

View File

@@ -6,7 +6,7 @@ import { $t } from '@vben/locales';
import { cloneDeep } from '@vben/utils';
import { useVbenForm } from '#/adapter/form';
import { applicationAdd, applicationInfo, applicationUpdate } from '#/api/property/application';
import { applicationAdd, applicationInfo, applicationUpdate } from '#/api/property/assetManage/application';
import { defaultFormValueGetter, useBeforeCloseDiff } from '#/utils/popup';
import { modalSchema } from './data';

View File

@@ -1,26 +1,22 @@
<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 {
import {
useVbenVxeGrid,
vxeCheckboxChecked,
type VxeGridProps
type VxeGridProps
} from '#/adapter/vxe-table';
import {
applicationExport,
applicationList,
applicationRemove,
} from '#/api/property/application';
import type { ApplicationForm } from '#/api/property/application/model';
} from '#/api/property/assetManage/application';
import type { ApplicationForm } from '#/api/property/assetManage/application/model';
import { commonDownloadExcel } from '#/utils/file/download';
import applicationModal from './application-modal.vue';
@@ -35,15 +31,6 @@ const formOptions: VbenFormProps = {
},
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 = {
@@ -138,8 +125,8 @@ function handleDownloadExcel() {
<a-button
:disabled="!vxeCheckboxChecked(tableApi)"
danger
type="primary"
v-access:code="['property:application:remove']"
type="primary"
v-access:code="['property:application:remove']"
@click="handleMultiDelete">
{{ $t('pages.common.delete') }}
</a-button>

View File

@@ -6,7 +6,7 @@ import { $t } from '@vben/locales';
import { cloneDeep } from '@vben/utils';
import { useVbenForm } from '#/adapter/form';
import { assetAdd, assetInfo, assetUpdate } from '#/api/property/asset';
import { assetAdd, assetInfo, assetUpdate } from '#/api/property/assetManage/asset';
import { defaultFormValueGetter, useBeforeCloseDiff } from '#/utils/popup';
import { modalSchema } from './data';

View File

@@ -1,5 +1,6 @@
import type { FormSchemaGetter } from '#/adapter/form';
import type { VxeGridProps } from '#/adapter/vxe-table';
import type {FormSchemaGetter} from '#/adapter/form';
import type {VxeGridProps} from '#/adapter/vxe-table';
import {getDictOptions} from "#/utils/dict";
export const querySchema: FormSchemaGetter = () => [
@@ -9,78 +10,40 @@ export const querySchema: FormSchemaGetter = () => [
label: '资产名称',
},
{
component: 'Textarea',
component: 'Select',
fieldName: 'model',
label: '类型',
},
{
component: 'Textarea',
fieldName: 'specs',
label: '规格',
},
{
component: 'Input',
fieldName: 'price',
label: '价格',
},
{
component: 'Input',
fieldName: 'stock',
label: '库存',
},
{
component: 'Input',
fieldName: 'unit',
label: '计量单位',
},
{
component: 'Input',
fieldName: 'depotId',
label: '仓库id',
},
{
component: 'Textarea',
fieldName: 'msg',
label: '描述信息',
},
{
component: 'Input',
fieldName: 'suppliersId',
label: '供应商id',
},
{
component: 'DatePicker',
componentProps: {
showTime: true,
format: 'YYYY-MM-DD HH:mm:ss',
valueFormat: 'YYYY-MM-DD HH:mm:ss',
},
fieldName: 'storageTime',
label: '入库时间',
label: '资产类型',
},
{
component: 'Select',
componentProps: {
options: getDictOptions('wy_sf'),
},
fieldName: 'type',
label: '固定资产类型',
label: '固定资产',
},
];
// 需要使用i18n注意这里要改成getter形式 否则切换语言不会刷新
// export const columns: () => VxeGridProps['columns'] = () => [
export const columns: VxeGridProps['columns'] = [
{ type: 'checkbox', width: 60 },
{type: 'checkbox', width: 60},
{
title: '主键',
title: '序号',
field: 'id',
slots: {
default: ({ rowIndex }) => {
return (rowIndex + 1).toString();
},
},
},
{
title: '资产名称',
field: 'name',
},
{
title: '类型',
title: '资产类型',
field: 'model',
},
{
@@ -116,7 +79,7 @@ export const columns: VxeGridProps['columns'] = [
field: 'storageTime',
},
{
title: '固定资产类型',
title: '固定资产',
field: 'type',
},
{
@@ -126,7 +89,7 @@ export const columns: VxeGridProps['columns'] = [
{
field: 'action',
fixed: 'right',
slots: { default: 'action' },
slots: {default: 'action'},
title: '操作',
width: 180,
},
@@ -201,7 +164,6 @@ export const modalSchema: FormSchemaGetter = () => [
label: '固定资产类型',
fieldName: 'type',
component: 'Select',
componentProps: {
},
componentProps: {},
},
];

View File

@@ -1,26 +1,22 @@
<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 {
import {
useVbenVxeGrid,
vxeCheckboxChecked,
type VxeGridProps
type VxeGridProps
} from '#/adapter/vxe-table';
import {
assetExport,
assetList,
assetRemove,
} from '#/api/property/asset';
import type { AssetForm } from '#/api/property/asset/model';
} from '#/api/property/assetManage/asset';
import type { AssetForm } from '#/api/property/assetManage/asset/model';
import { commonDownloadExcel } from '#/utils/file/download';
import assetModal from './asset-modal.vue';
@@ -35,15 +31,6 @@ const formOptions: VbenFormProps = {
},
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 = {
@@ -53,10 +40,7 @@ const gridOptions: VxeGridProps = {
//
reserve: true,
//
// trigger: 'row',
},
// 使i18ngetter
// columns: columns(),
columns,
height: 'auto',
keepSource: true,
@@ -126,7 +110,7 @@ function handleDownloadExcel() {
<template>
<Page :auto-content-height="true">
<BasicTable table-title="资产管理列表">
<BasicTable table-title="资产列表">
<template #toolbar-tools>
<Space>
<a-button
@@ -138,8 +122,8 @@ function handleDownloadExcel() {
<a-button
:disabled="!vxeCheckboxChecked(tableApi)"
danger
type="primary"
v-access:code="['property:asset:remove']"
type="primary"
v-access:code="['property:asset:remove']"
@click="handleMultiDelete">
{{ $t('pages.common.delete') }}
</a-button>

View File

@@ -0,0 +1,110 @@
import type {FormSchemaGetter} from '#/adapter/form';
import type {VxeGridProps} from '#/adapter/vxe-table';
import {renderDict} from "#/utils/render";
import {getDictOptions} from "#/utils/dict";
export const querySchema: FormSchemaGetter = () => [
{
component: 'Input',
fieldName: 'depotName',
label: '仓库名称',
},
{
component: 'Select',
fieldName: 'modelType',
label: '仓库类型',
componentProps: {
options: getDictOptions('wy_cclx'),
},
},
{
component: 'Select',
fieldName: 'state',
label: '状态',
componentProps: {
options: getDictOptions('wy_state'),
},
},
];
export const columns: VxeGridProps['columns'] = [
{type: 'checkbox', width: 60},
{
title: '序号',
field: 'id',
slots: {
default: ({rowIndex}) => {
return (rowIndex + 1).toString();
}
}
},
{
title: '仓库名称',
field: 'depotName',
},
{
title: '仓库类型',
field: 'modelType',
slots: {
default: ({row}) => {
return renderDict(row.modelType, 'wy_cclx')
}
}
},
{
title: '状态',
field: 'state',
slots: {default: 'state'}
},
{
title: '描述信息',
field: 'msg',
},
{
title: '创建时间',
field: 'createTime',
},
{
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: 'depotName',
component: 'Input',
rules:'required'
},
{
label: '仓库类型',
fieldName: 'modelType',
component: 'Select',
componentProps: {
options: getDictOptions('wy_cclx'),
},
rules:'selectRequired'
},
{
label: '描述信息',
fieldName: 'msg',
component: 'Textarea',
formItemClass:'col-span-2'
},
];

View File

@@ -0,0 +1,69 @@
<script setup lang="ts">
import type {Unit} from '#/api/property/resident/unit/model';
import {shallowRef} from 'vue';
import {useVbenModal} from '@vben/common-ui';
import {Descriptions, DescriptionsItem} from 'ant-design-vue';
import dayjs from 'dayjs';
import duration from 'dayjs/plugin/duration';
import relativeTime from 'dayjs/plugin/relativeTime';
import { depotInfo} from '#/api/property/assetManage/depot';
import {renderDict} from "#/utils/render";
import type {DepotVO} from "#/api/property/assetManage/depot/model";
dayjs.extend(duration);
dayjs.extend(relativeTime);
const [BasicModal, modalApi] = useVbenModal({
onOpenChange: handleOpenChange,
onClosed() {
depotDetail.value = null;
},
});
const depotDetail = shallowRef<null | DepotVO>(null);
async function handleOpenChange(open: boolean) {
if (!open) {
return null;
}
modalApi.modalLoading(true);
const {id} = modalApi.getData() as { id: number | string };
// 赋值
depotDetail.value = await depotInfo(id);
modalApi.modalLoading(false);
}
</script>
<template>
<BasicModal :footer="false" :fullscreen-button="false" title="仓库详情" class="w-[70%]">
<Descriptions v-if="depotDetail" size="small" :column="2" bordered :labelStyle="{width:'100px'}">
<DescriptionsItem label="仓库名称">
{{ depotDetail.depotName }}
</DescriptionsItem>
<DescriptionsItem label="仓库类型" v-if="depotDetail.modelType!=null">
<component
:is="renderDict(depotDetail.modelType,'wy_cclx')"
/>
</DescriptionsItem>
<DescriptionsItem label="状态" v-if="depotDetail.state!=null">
<component
:is="renderDict(depotDetail.state,'wy_state')"
/>
</DescriptionsItem>
<DescriptionsItem label="创建时间">
{{ depotDetail.createTime}}
</DescriptionsItem>
<DescriptionsItem label="描述信息">
{{ depotDetail.msg}}
</DescriptionsItem>
</Descriptions>
</BasicModal>
</template>

View File

@@ -6,7 +6,7 @@ import { $t } from '@vben/locales';
import { cloneDeep } from '@vben/utils';
import { useVbenForm } from '#/adapter/form';
import { depotAdd, depotInfo, depotUpdate } from '#/api/property/depot';
import { depotAdd, depotInfo, depotUpdate } from '#/api/property/assetManage/depot';
import { defaultFormValueGetter, useBeforeCloseDiff } from '#/utils/popup';
import { modalSchema } from './data';
@@ -21,9 +21,9 @@ const title = computed(() => {
const [BasicForm, formApi] = useVbenForm({
commonConfig: {
//
formItemClass: 'col-span-2',
formItemClass: 'col-span-1',
// label px
labelWidth: 80,
labelWidth: 100,
//
componentProps: {
class: 'w-full',
@@ -43,7 +43,7 @@ const { onBeforeClose, markInitialized, resetInitialized } = useBeforeCloseDiff(
const [BasicModal, modalApi] = useVbenModal({
//
class: 'w-[550px]',
class: 'w-[70%]',
fullscreenButton: false,
onBeforeClose,
onClosed: handleClosed,

View File

@@ -1,30 +1,28 @@
<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 {
import {
useVbenVxeGrid,
vxeCheckboxChecked,
type VxeGridProps
type VxeGridProps
} from '#/adapter/vxe-table';
import {
depotExport,
depotList,
depotRemove,
} from '#/api/property/depot';
import type { DepotForm } from '#/api/property/depot/model';
depotRemove, depotUpdate,
} from '#/api/property/assetManage/depot';
import type { DepotForm } from '#/api/property/assetManage/depot/model';
import { commonDownloadExcel } from '#/utils/file/download';
import depotModal from './depot-modal.vue';
import depotDetail from './depot-detail.vue';
import { columns, querySchema } from './data';
import {TableSwitch} from "#/components/table";
import {useAccess} from "@vben/access";
const formOptions: VbenFormProps = {
commonConfig: {
@@ -35,15 +33,6 @@ const formOptions: VbenFormProps = {
},
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 = {
@@ -84,6 +73,10 @@ const [BasicTable, tableApi] = useVbenVxeGrid({
gridOptions,
});
const [DepotDetail, detailApi] = useVbenModal({
connectedComponent: depotDetail,
});
const [DepotModal, modalApi] = useVbenModal({
connectedComponent: depotModal,
});
@@ -92,6 +85,11 @@ function handleAdd() {
modalApi.setData({});
modalApi.open();
}
async function handleInfo(row: Required<DepotForm>) {
detailApi.setData({ id: row.id });
detailApi.open();
}
async function handleEdit(row: Required<DepotForm>) {
modalApi.setData({ id: row.id });
@@ -122,11 +120,12 @@ function handleDownloadExcel() {
fieldMappingTime: formOptions.fieldMappingTime,
});
}
const { hasAccessByCodes } = useAccess();
</script>
<template>
<Page :auto-content-height="true">
<BasicTable table-title="仓库管理列表">
<BasicTable table-title="仓库列表">
<template #toolbar-tools>
<Space>
<a-button
@@ -138,8 +137,8 @@ function handleDownloadExcel() {
<a-button
:disabled="!vxeCheckboxChecked(tableApi)"
danger
type="primary"
v-access:code="['property:depot:remove']"
type="primary"
v-access:code="['property:depot:remove']"
@click="handleMultiDelete">
{{ $t('pages.common.delete') }}
</a-button>
@@ -152,8 +151,24 @@ function handleDownloadExcel() {
</a-button>
</Space>
</template>
<template #state="{ row }">
<TableSwitch
:checkedValue="1"
:unCheckedValue="0"
v-model:value="row.state"
:api="() => depotUpdate(row)"
:disabled="!hasAccessByCodes(['property:depot:edit'])"
@reload="() => tableApi.query()"
/>
</template>
<template #action="{ row }">
<Space>
<ghost-button
v-access:code="['property:depot:info']"
@click.stop="handleInfo(row)"
>
{{ $t('pages.common.info') }}
</ghost-button>
<ghost-button
v-access:code="['property:depot:edit']"
@click.stop="handleEdit(row)"
@@ -178,5 +193,6 @@ function handleDownloadExcel() {
</template>
</BasicTable>
<DepotModal @reload="tableApi.query()" />
<DepotDetail></DepotDetail>
</Page>
</template>

View File

@@ -9,18 +9,18 @@ import { getVxePopupContainer } from '@vben/utils';
import { Modal, Popconfirm, Space } from 'ant-design-vue';
import dayjs from 'dayjs';
import {
import {
useVbenVxeGrid,
vxeCheckboxChecked,
type VxeGridProps
type VxeGridProps
} from '#/adapter/vxe-table';
import {
logExport,
logList,
logRemove,
} from '#/api/property/log';
import type { LogForm } from '#/api/property/log/model';
} from '#/api/property/assetManage/log';
import type { LogForm } from '#/api/property/assetManage/log/model';
import { commonDownloadExcel } from '#/utils/file/download';
import logModal from './log-modal.vue';
@@ -138,8 +138,8 @@ function handleDownloadExcel() {
<a-button
:disabled="!vxeCheckboxChecked(tableApi)"
danger
type="primary"
v-access:code="['property:log:remove']"
type="primary"
v-access:code="['property:log:remove']"
@click="handleMultiDelete">
{{ $t('pages.common.delete') }}
</a-button>

View File

@@ -6,7 +6,7 @@ import { $t } from '@vben/locales';
import { cloneDeep } from '@vben/utils';
import { useVbenForm } from '#/adapter/form';
import { logAdd, logInfo, logUpdate } from '#/api/property/log';
import { logAdd, logInfo, logUpdate } from '#/api/property/assetManage/log';
import { defaultFormValueGetter, useBeforeCloseDiff } from '#/utils/popup';
import { modalSchema } from './data';

View File

@@ -1,5 +1,7 @@
import type { FormSchemaGetter } from '#/adapter/form';
import type { VxeGridProps } from '#/adapter/vxe-table';
import type {FormSchemaGetter} from '#/adapter/form';
import type {VxeGridProps} from '#/adapter/vxe-table';
import {getDictOptions} from "#/utils/dict";
import {z} from "#/adapter/form";
export const querySchema: FormSchemaGetter = () => [
@@ -9,49 +11,44 @@ export const querySchema: FormSchemaGetter = () => [
label: '供应商名称',
},
{
component: 'Textarea',
fieldName: 'phone',
label: '电话',
},
{
component: 'Textarea',
fieldName: 'location',
label: '地址',
},
{
component: 'Textarea',
component: 'Input',
fieldName: 'user',
label: '联系人',
},
{
component: 'Input',
fieldName: 'phone',
label: '电话',
},
{
component: 'Select',
fieldName: 'state',
label: '状态',
},
{
component: 'Textarea',
fieldName: 'bank',
label: '开户行',
},
{
component: 'Textarea',
fieldName: 'bankNumber',
label: '卡号',
componentProps:{
options: getDictOptions('wy_state'),
}
},
];
// 需要使用i18n注意这里要改成getter形式 否则切换语言不会刷新
// export const columns: () => VxeGridProps['columns'] = () => [
export const columns: VxeGridProps['columns'] = [
{ type: 'checkbox', width: 60 },
{type: 'checkbox', width: 60},
{
title: '主键',
title: '序号',
field: 'id',
slots: {
default: ({rowIndex}) => {
return rowIndex + 1;
}
}
},
{
title: '供应商名称',
field: 'suppliersName',
},
{
title: '联系人',
field: 'user',
},
{
title: '电话',
field: 'phone',
@@ -60,14 +57,6 @@ export const columns: VxeGridProps['columns'] = [
title: '地址',
field: 'location',
},
{
title: '联系人',
field: 'user',
},
{
title: '状态',
field: 'state',
},
{
title: '开户行',
field: 'bank',
@@ -76,6 +65,11 @@ export const columns: VxeGridProps['columns'] = [
title: '卡号',
field: 'bankNumber',
},
{
title: '状态',
field: 'state',
slots: {default: 'state'}
},
{
title: '备注',
field: 'remark',
@@ -87,7 +81,7 @@ export const columns: VxeGridProps['columns'] = [
{
field: 'action',
fixed: 'right',
slots: { default: 'action' },
slots: {default: 'action'},
title: '操作',
width: 180,
},
@@ -108,43 +102,43 @@ export const modalSchema: FormSchemaGetter = () => [
fieldName: 'suppliersName',
component: 'Input',
rules: 'required',
},
{
label: '电话',
fieldName: 'phone',
component: 'Textarea',
rules: 'required',
},
{
label: '地址',
fieldName: 'location',
component: 'Textarea',
rules: 'required',
formItemClass:'col-span-2'
},
{
label: '联系人',
fieldName: 'user',
component: 'Textarea',
component: 'Input',
rules: 'required',
},
{
label: '状态',
fieldName: 'state',
label: '电话',
fieldName: 'phone',
component: 'Input',
rules: z.string().regex(/^1[3-9]\d{9}$/, { message: '格式错误' }),
},
{
label: '地址',
fieldName: 'location',
component: 'Input',
rules: 'required',
formItemClass:'col-span-2'
},
{
label: '开户行',
fieldName: 'bank',
component: 'Textarea',
component: 'Input',
rules: 'required',
},
{
label: '卡号',
fieldName: 'bankNumber',
component: 'Textarea',
component: 'Input',
rules: z.string().regex(/^\d{12,19}$/, { message: '格式错误' }),
},
{
label: '备注',
fieldName: 'remark',
component: 'Textarea',
formItemClass:'col-span-2'
},
];

View File

@@ -1,30 +1,28 @@
<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 {
import {
useVbenVxeGrid,
vxeCheckboxChecked,
type VxeGridProps
type VxeGridProps
} from '#/adapter/vxe-table';
import {
suppliersExport,
suppliersList,
suppliersRemove,
} from '#/api/property/suppliers';
import type { SuppliersForm } from '#/api/property/suppliers/model';
suppliersRemove, suppliersUpdate,
} from '#/api/property/assetManage/suppliers';
import type { SuppliersForm } from '#/api/property/assetManage/suppliers/model';
import { commonDownloadExcel } from '#/utils/file/download';
import suppliersModal from './suppliers-modal.vue';
import suppliersDetail from './suppliers-detail.vue';
import { columns, querySchema } from './data';
import {useAccess} from "@vben/access";
import {TableSwitch} from "#/components/table";
const formOptions: VbenFormProps = {
commonConfig: {
@@ -35,15 +33,6 @@ const formOptions: VbenFormProps = {
},
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 = {
@@ -55,8 +44,6 @@ const gridOptions: VxeGridProps = {
//
// trigger: 'row',
},
// 使i18ngetter
// columns: columns(),
columns,
height: 'auto',
keepSource: true,
@@ -87,6 +74,9 @@ const [BasicTable, tableApi] = useVbenVxeGrid({
const [SuppliersModal, modalApi] = useVbenModal({
connectedComponent: suppliersModal,
});
const [SuppliersDetail, detailApi] = useVbenModal({
connectedComponent: suppliersDetail,
});
function handleAdd() {
modalApi.setData({});
@@ -98,6 +88,11 @@ async function handleEdit(row: Required<SuppliersForm>) {
modalApi.open();
}
async function handleInfo(row: Required<SuppliersForm>) {
detailApi.setData({ id: row.id });
detailApi.open();
}
async function handleDelete(row: Required<SuppliersForm>) {
await suppliersRemove(row.id);
await tableApi.query();
@@ -122,6 +117,8 @@ function handleDownloadExcel() {
fieldMappingTime: formOptions.fieldMappingTime,
});
}
const { hasAccessByCodes } = useAccess();
</script>
<template>
@@ -138,8 +135,8 @@ function handleDownloadExcel() {
<a-button
:disabled="!vxeCheckboxChecked(tableApi)"
danger
type="primary"
v-access:code="['property:suppliers:remove']"
type="primary"
v-access:code="['property:suppliers:remove']"
@click="handleMultiDelete">
{{ $t('pages.common.delete') }}
</a-button>
@@ -152,8 +149,24 @@ function handleDownloadExcel() {
</a-button>
</Space>
</template>
<template #state="{row}">
<TableSwitch
:checkedValue="1"
:unCheckedValue="0"
v-model:value="row.state"
:api="() => suppliersUpdate(row)"
:disabled="!hasAccessByCodes(['property:suppliers:update'])"
@reload="() => tableApi.query()"
/>
</template>
<template #action="{ row }">
<Space>
<ghost-button
v-access:code="['property:suppliers:info']"
@click.stop="handleInfo(row)"
>
{{ $t('pages.common.info') }}
</ghost-button>
<ghost-button
v-access:code="['property:suppliers:edit']"
@click.stop="handleEdit(row)"
@@ -178,5 +191,6 @@ function handleDownloadExcel() {
</template>
</BasicTable>
<SuppliersModal @reload="tableApi.query()" />
<SuppliersDetail/>
</Page>
</template>

View File

@@ -0,0 +1,77 @@
<script setup lang="ts">
import {shallowRef} from 'vue';
import {useVbenModal} from '@vben/common-ui';
import {Descriptions, DescriptionsItem} from 'ant-design-vue';
import dayjs from 'dayjs';
import duration from 'dayjs/plugin/duration';
import relativeTime from 'dayjs/plugin/relativeTime';
import { suppliersInfo} from '#/api/property/assetManage/suppliers';
import {renderDict} from "#/utils/render";
import type {SuppliersVO} from "#/api/property/assetManage/suppliers/model";
dayjs.extend(duration);
dayjs.extend(relativeTime);
const [BasicModal, modalApi] = useVbenModal({
onOpenChange: handleOpenChange,
onClosed() {
supplierDetail.value = null;
},
});
const supplierDetail = shallowRef<null | SuppliersVO>(null);
async function handleOpenChange(open: boolean) {
if (!open) {
return null;
}
modalApi.modalLoading(true);
const {id} = modalApi.getData() as { id: number | string };
// 赋值
supplierDetail.value = await suppliersInfo(id);
modalApi.modalLoading(false);
}
</script>
<template>
<BasicModal :footer="false" :fullscreen-button="false" title="供应商详情" class="w-[70%]">
<Descriptions v-if="supplierDetail" size="small" :column="2" bordered :labelStyle="{width:'110px'}">
<DescriptionsItem label="供应商名称" :span="2">
{{ supplierDetail.suppliersName }}
</DescriptionsItem>
<DescriptionsItem label="联系人">
{{supplierDetail.user}}
</DescriptionsItem>
<DescriptionsItem label="电话">
{{supplierDetail.phone}}
</DescriptionsItem>
<DescriptionsItem label="地址" :span="2">
{{ supplierDetail.location}}
</DescriptionsItem>
<DescriptionsItem label="开户行">
{{ supplierDetail.bank}}
</DescriptionsItem>
<DescriptionsItem label="卡号">
{{ supplierDetail.bankNumber}}
</DescriptionsItem>
<DescriptionsItem label="状态" v-if="supplierDetail.state!=null">
<component
:is="renderDict(supplierDetail.state,'wy_state')"
/>
</DescriptionsItem>
<DescriptionsItem label="创建时间">
{{ supplierDetail.createTime}}
</DescriptionsItem>
<DescriptionsItem label="备注">
{{ supplierDetail.remark}}
</DescriptionsItem>
</Descriptions>
</BasicModal>
</template>

View File

@@ -6,7 +6,7 @@ import { $t } from '@vben/locales';
import { cloneDeep } from '@vben/utils';
import { useVbenForm } from '#/adapter/form';
import { suppliersAdd, suppliersInfo, suppliersUpdate } from '#/api/property/suppliers';
import { suppliersAdd, suppliersInfo, suppliersUpdate } from '#/api/property/assetManage/suppliers';
import { defaultFormValueGetter, useBeforeCloseDiff } from '#/utils/popup';
import { modalSchema } from './data';
@@ -21,9 +21,9 @@ const title = computed(() => {
const [BasicForm, formApi] = useVbenForm({
commonConfig: {
//
formItemClass: 'col-span-2',
formItemClass: 'col-span-1',
// label px
labelWidth: 80,
labelWidth: 100,
//
componentProps: {
class: 'w-full',
@@ -43,7 +43,7 @@ const { onBeforeClose, markInitialized, resetInitialized } = useBeforeCloseDiff(
const [BasicModal, modalApi] = useVbenModal({
//
class: 'w-[550px]',
class: 'w-[70%]',
fullscreenButton: false,
onBeforeClose,
onClosed: handleClosed,

View File

@@ -1,95 +0,0 @@
import type { FormSchemaGetter } from '#/adapter/form';
import type { VxeGridProps } from '#/adapter/vxe-table';
export const querySchema: FormSchemaGetter = () => [
{
component: 'Input',
fieldName: 'depotName',
label: '类型名称',
},
{
component: 'Input',
fieldName: 'msg',
label: '描述信息',
},
{
component: 'Input',
fieldName: 'modelType',
label: '类型',
},
{
component: 'Input',
fieldName: 'state',
label: '状态',
},
];
// 需要使用i18n注意这里要改成getter形式 否则切换语言不会刷新
// export const columns: () => VxeGridProps['columns'] = () => [
export const columns: VxeGridProps['columns'] = [
{ type: 'checkbox', width: 60 },
{
title: '主键',
field: 'id',
},
{
title: '类型名称',
field: 'depotName',
},
{
title: '描述信息',
field: 'msg',
},
{
title: '类型',
field: 'modelType',
},
{
title: '状态',
field: 'state',
},
{
title: '创建时间',
field: 'createTime',
},
{
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: 'depotName',
component: 'Input',
},
{
label: '描述信息',
fieldName: 'msg',
component: 'Input',
},
{
label: '类型',
fieldName: 'modelType',
component: 'Input',
},
{
label: '状态',
fieldName: 'state',
component: 'Input',
},
];

View File

@@ -198,3 +198,8 @@ function handleInfo(row: Required<PersonForm>) {
<PersonDetail></PersonDetail>
</Page>
</template>
<style scoped>
:where(.css-dev-only-do-not-override-aza1th).ant-avatar{
border-radius: 0;
}
</style>

View File

@@ -26,6 +26,7 @@ let userInfo = reactive({
gender: '',
});
let unitName = ref('');
const userId = ref<number | string>(0);
const [BasicForm, formApi] = useVbenForm({
commonConfig: {
// 默认占满两列
@@ -67,6 +68,8 @@ const [BasicModal, modalApi] = useVbenModal({
if (isUpdate.value && id) {
const record = await personInfo(id);
userId.value = record.userId;
console.log(userId.value,'====================1111')
await formApi.setValues(record);
}
await markInitialized();
@@ -119,7 +122,7 @@ function getUnitInfo(unit: { name: string }) {
<BasicModal :title="title">
<BasicForm>
<template #userId="slotProps">
<QueryUserList @update:userInfo="getUserInfo" v-bind="slotProps" :disabled="isUpdate"/>
<QueryUserList @update:userInfo="getUserInfo" v-bind="slotProps" :isUpdate="isUpdate" :userId="userId"/>
</template>
<template #unitId="slotProps">
<QueryUnitList @update:unitInfo="getUnitInfo" v-bind="slotProps" :disabled="isUpdate"/>

View File

@@ -1,8 +1,7 @@
<script lang="ts" setup>
import {ref} from 'vue';
import {Select} from 'ant-design-vue';
// import {resident_unitList} from "#/api/property/resident/unit";
import {userList} from "#/api/system/user";
import {resident_unitList} from "#/api/property/resident/unit";
defineOptions({name: 'QueryUnitList'});
@@ -10,30 +9,17 @@ withDefaults(defineProps<{ disabled?: boolean; placeholder?: string }>(), {
disabled: false,
placeholder: '可根据单位名称进行搜索...',
});
//todo
// async function queryUnit(value: string, callback: any) {
// const queryData = {
// nickName: value,
// pageSize: 100,
// pageNum: 1,
// }
// const res = await resident_unitList(queryData);
// const options = res.rows.map((unit) => ({
// label: unit.name+'-'+unit.unitNumber,
// value: unit.id,
// }));
// callback(options);
// }
async function queryUnit(value: string, callback: any) {
const queryData = {
nickName: value,
name: value,
pageSize: 100,
pageNum: 1,
}
const res = await userList(queryData);
const res = await resident_unitList(queryData);
const options = res.rows.map((unit) => ({
label: unit.nickName+'-'+unit.phonenumber,
value: unit.userId,
label: unit.name+'-'+unit.id,
value: unit.id,
}));
callback(options);
}

View File

@@ -1,15 +1,28 @@
<script lang="ts" setup>
import {ref} from 'vue';
import {ref, watch} from 'vue';
import {Select} from 'ant-design-vue';
import {userList} from "#/api/system/user";
import {findUserInfo, userList} from "#/api/system/user";
import {renderDictValue} from "#/utils/render";
defineOptions({name: 'QueryUserList'});
withDefaults(defineProps<{ disabled?: boolean; placeholder?: string }>(), {
const props = withDefaults(defineProps<{
disabled?: boolean;
placeholder?: string;
isUpdate?: boolean;
userId?: number;
}>(), {
disabled: false,
placeholder: '可根据员工姓名进行搜索...',
isUpdate: false,
userId: 0
});
watch(() => props.isUpdate,
(newX) => {
if (newX) {
getUserInfo()
}
}, {immediate: true})
async function queryUser(value: string, callback: any) {
const queryData = {
@@ -21,36 +34,47 @@ async function queryUser(value: string, callback: any) {
const options = res.rows.map((user) => ({
label: user.nickName + '-' + renderDictValue(user.sex, 'sys_user_sex') + '-' + user.phonenumber,
value: user.userId,
userName: user.userName,
gender: user.sex,
phone: user.phonenumber,
}));
callback(options);
}
const data = ref<any[]>([]);
const value = ref();
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 userInfoStr = data.value.find(option => option.value === val)?.label;
let arr = userInfoStr.split('-')
let userInfo = {
userName: arr[0],
gender: arr[1],
phone: arr[2],
}
// 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() {
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,
}]
}
}
</script>
<template>
<!-- v-model:value="value"-->
<Select
v-model="value"
show-search
:placeholder="placeholder"
style="width: 100%"

View File

@@ -2,6 +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 {z} from "#/adapter/form";
export const querySchema: FormSchemaGetter = () => [
{
@@ -134,7 +135,7 @@ export const modalSchema: FormSchemaGetter = () => [
label: '联系电话',
fieldName: 'phone',
component: 'Input',
rules: 'required',
rules: z.string().regex(/^1[3-9]\d{9}$/, { message: '格式错误' }),
},
{

View File

@@ -22,7 +22,7 @@ import { commonDownloadExcel } from '#/utils/file/download';
import resident_unitModal from './unit-modal.vue';
import unitInfoModal from './unit-detail.vue';
import { columns, querySchema } from './data';
import {userStatusChange} from "#/api/system/user";
import {resident_unitUpdate} from "#/api/property/resident/unit";
import {TableSwitch} from "#/components/table";
import {useAccess} from "@vben/access";
@@ -150,10 +150,11 @@ const { hasAccessByCodes } = useAccess();
</template>
<template #state="{ row }">
<TableSwitch
:checkedValue="1"
:unCheckedValue="0"
v-model:value="row.state"
:api="() => userStatusChange(row)"
:disabled=" !hasAccessByCodes(['property:unit:edit'])
"
:api="() => resident_unitUpdate(row)"
:disabled=" !hasAccessByCodes(['property:unit:edit'])"
@reload="() => tableApi.query()"
/>
</template>