This commit is contained in:
@@ -1,9 +1,9 @@
|
||||
<script setup lang="ts">
|
||||
|
||||
import { Page, useVbenModal, type VbenFormProps } from '@vben/common-ui';
|
||||
import { getVxePopupContainer } from '@vben/utils';
|
||||
import {Page, useVbenModal, type VbenFormProps} from '@vben/common-ui';
|
||||
import {getVxePopupContainer} from '@vben/utils';
|
||||
|
||||
import { Modal, Popconfirm, Space } from 'ant-design-vue';
|
||||
import {Modal, Popconfirm, Space} from 'ant-design-vue';
|
||||
|
||||
import {
|
||||
useVbenVxeGrid,
|
||||
@@ -16,22 +16,27 @@ import {
|
||||
assetList,
|
||||
assetRemove,
|
||||
} from '#/api/property/assetManage/asset';
|
||||
import type { AssetForm } from '#/api/property/assetManage/asset/model';
|
||||
import { commonDownloadExcel } from '#/utils/file/download';
|
||||
import type {AssetForm} from '#/api/property/assetManage/asset/model';
|
||||
import {commonDownloadExcel} from '#/utils/file/download';
|
||||
|
||||
import assetModal from './asset-modal.vue';
|
||||
import { columns, querySchema } from './data';
|
||||
import {columns, querySchema} from './data';
|
||||
import {assetTypeList} from "#/api/property/assetManage/assetType";
|
||||
import type {AssertType} from "vitest";
|
||||
import {computed, onMounted, ref} from "vue";
|
||||
|
||||
const formOptions: VbenFormProps = {
|
||||
const assetTypeOptions=ref<AssertType[]>([])
|
||||
|
||||
const formOptions = computed(() => ({
|
||||
commonConfig: {
|
||||
labelWidth: 80,
|
||||
componentProps: {
|
||||
allowClear: true,
|
||||
},
|
||||
},
|
||||
schema: querySchema(),
|
||||
schema: querySchema(assetTypeOptions.value),
|
||||
wrapperClass: 'grid-cols-1 md:grid-cols-2 lg:grid-cols-3 xl:grid-cols-4',
|
||||
};
|
||||
}));
|
||||
|
||||
const gridOptions: VxeGridProps = {
|
||||
checkboxConfig: {
|
||||
@@ -47,7 +52,7 @@ const gridOptions: VxeGridProps = {
|
||||
pagerConfig: {},
|
||||
proxyConfig: {
|
||||
ajax: {
|
||||
query: async ({ page }, formValues = {}) => {
|
||||
query: async ({page}, formValues = {}) => {
|
||||
return await assetList({
|
||||
pageNum: page.currentPage,
|
||||
pageSize: page.pageSize,
|
||||
@@ -73,12 +78,12 @@ const [AssetModal, modalApi] = useVbenModal({
|
||||
});
|
||||
|
||||
function handleAdd() {
|
||||
modalApi.setData({});
|
||||
modalApi.setData({assetTypeOptions:assetTypeOptions.value});
|
||||
modalApi.open();
|
||||
}
|
||||
|
||||
async function handleEdit(row: Required<AssetForm>) {
|
||||
modalApi.setData({ id: row.id });
|
||||
modalApi.setData({id: row.id,assetTypeOptions:assetTypeOptions.value});
|
||||
modalApi.open();
|
||||
}
|
||||
|
||||
@@ -106,6 +111,24 @@ function handleDownloadExcel() {
|
||||
fieldMappingTime: formOptions.fieldMappingTime,
|
||||
});
|
||||
}
|
||||
|
||||
async function queryAssetType() {
|
||||
let params = {
|
||||
pageSize: 1000,
|
||||
pageNum: 1,
|
||||
}
|
||||
const res = await assetTypeList(params)
|
||||
assetTypeOptions.value = res.rows.map((item) => ({
|
||||
label: item.assetTypeName,
|
||||
value: item.id,
|
||||
}));
|
||||
return assetTypeOptions.value
|
||||
}
|
||||
|
||||
onMounted(()=>{
|
||||
queryAssetType()
|
||||
})
|
||||
|
||||
</script>
|
||||
|
||||
<template>
|
||||
@@ -161,6 +184,6 @@ function handleDownloadExcel() {
|
||||
</Space>
|
||||
</template>
|
||||
</BasicTable>
|
||||
<AssetModal @reload="tableApi.query()" />
|
||||
<AssetModal @reload="tableApi.query()"/>
|
||||
</Page>
|
||||
</template>
|
||||
|
Reference in New Issue
Block a user