This commit is contained in:
@@ -1,6 +1,5 @@
|
||||
import type { FormSchemaGetter } from '#/adapter/form';
|
||||
import type { VxeGridProps } from '#/adapter/vxe-table';
|
||||
|
||||
import { getDictOptions } from '#/utils/dict';
|
||||
import { renderDict } from '#/utils/render';
|
||||
|
||||
@@ -8,26 +7,23 @@ export const querySchema: FormSchemaGetter = () => [
|
||||
{
|
||||
component: 'Input',
|
||||
fieldName: 'plantName',
|
||||
label: '产品名称:',
|
||||
label: '产品名称',
|
||||
},
|
||||
{
|
||||
component: 'Input',
|
||||
fieldName: 'specification',
|
||||
label: '规格:',
|
||||
label: '规格',
|
||||
},
|
||||
{
|
||||
component: 'Select',
|
||||
componentProps: {
|
||||
// 可选从DictEnum中获取 DictEnum.PRODUCT_MANAGEMENT_STATUS 便于维护
|
||||
options: getDictOptions('product_management_status'),
|
||||
},
|
||||
fieldName: 'state',
|
||||
label: '状态:',
|
||||
label: '状态',
|
||||
},
|
||||
];
|
||||
|
||||
// 需要使用i18n注意这里要改成getter形式 否则切换语言不会刷新
|
||||
// export const columns: () => VxeGridProps['columns'] = () => [
|
||||
export const columns: VxeGridProps['columns'] = [
|
||||
{ type: 'checkbox', width: 60 },
|
||||
{
|
||||
@@ -72,7 +68,6 @@ export const columns: VxeGridProps['columns'] = [
|
||||
field: 'state',
|
||||
slots: {
|
||||
default: ({ row }) => {
|
||||
// 可选从DictEnum中获取 DictEnum.PRODUCT_MANAGEMENT_STATUS 便于维护
|
||||
return renderDict(row.state, 'product_management_status');
|
||||
},
|
||||
},
|
||||
@@ -153,7 +148,6 @@ export const modalSchema: FormSchemaGetter = () => [
|
||||
fieldName: 'state',
|
||||
component: 'Select',
|
||||
componentProps: {
|
||||
// 可选从DictEnum中获取 DictEnum.PRODUCT_MANAGEMENT_STATUS 便于维护
|
||||
options: getDictOptions('product_management_status'),
|
||||
},
|
||||
rules: 'selectRequired',
|
||||
@@ -163,9 +157,4 @@ export const modalSchema: FormSchemaGetter = () => [
|
||||
fieldName: 'remark',
|
||||
component: 'Input',
|
||||
},
|
||||
// {
|
||||
// label: '创建时间',
|
||||
// fieldName: 'creatTime',
|
||||
// component: 'Input',
|
||||
// },
|
||||
];
|
||||
|
@@ -2,13 +2,11 @@
|
||||
import { Page, useVbenModal, type VbenFormProps } from '@vben/common-ui';
|
||||
import { getVxePopupContainer } from '@vben/utils';
|
||||
import { Modal, Popconfirm, Space } from 'ant-design-vue';
|
||||
|
||||
import {
|
||||
useVbenVxeGrid,
|
||||
vxeCheckboxChecked,
|
||||
type VxeGridProps
|
||||
} from '#/adapter/vxe-table';
|
||||
|
||||
import {
|
||||
plantsProductExport,
|
||||
plantsProductList,
|
||||
@@ -16,12 +14,9 @@ import {
|
||||
} from '#/api/property/productManagement';
|
||||
import type { PropertyForm } from '#/api/property/productManagement/model';
|
||||
import { commonDownloadExcel } from '#/utils/file/download';
|
||||
|
||||
import PlantsProductModal from './plantsProduct-modal.vue';
|
||||
import PlantsProductDetail from './plantsProduct-detail.vue';
|
||||
import { columns, querySchema } from './data';
|
||||
import unitInfoModal from "#/views/property/resident/unit/unit-detail.vue";
|
||||
import type {Resident_unitForm} from "#/api/property/resident/unit/model";
|
||||
|
||||
const formOptions: VbenFormProps = {
|
||||
commonConfig: {
|
||||
@@ -32,28 +27,13 @@ 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 = {
|
||||
checkboxConfig: {
|
||||
// 高亮
|
||||
highlight: true,
|
||||
// 翻页时保留选中状态
|
||||
reserve: true,
|
||||
// 点击行选中
|
||||
// trigger: 'row',
|
||||
},
|
||||
// 需要使用i18n注意这里要改成getter形式 否则切换语言不会刷新
|
||||
// columns: columns(),
|
||||
columns,
|
||||
height: 'auto',
|
||||
keepSource: true,
|
||||
@@ -72,7 +52,6 @@ const gridOptions: VxeGridProps = {
|
||||
rowConfig: {
|
||||
keyField: 'id',
|
||||
},
|
||||
// 表格全局唯一表示 保存列配置需要用到
|
||||
id: 'property-property-index'
|
||||
};
|
||||
|
||||
@@ -88,6 +67,7 @@ const [PlantsProduct, modalApi] = useVbenModal({
|
||||
const [PlantsProductDetailModal, PlantsProductDetailApi] = useVbenModal({
|
||||
connectedComponent: PlantsProductDetail,
|
||||
});
|
||||
|
||||
async function handleInfo(row: Required<PropertyForm>) {
|
||||
PlantsProductDetailApi.setData({ id: row.id });
|
||||
PlantsProductDetailApi.open();
|
||||
|
@@ -22,7 +22,6 @@ async function handleOpenChange(open: boolean) {
|
||||
modalApi.modalLoading(true);
|
||||
const {id} = modalApi.getData() as { id: number | string };
|
||||
const response = await visitorManagementInfo(id);
|
||||
// 赋值
|
||||
plantsProductDetail.value = response;
|
||||
modalApi.modalLoading(false);
|
||||
}
|
||||
|
@@ -1,30 +1,24 @@
|
||||
<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 { plantsProductAdd, plantsProductInfo, plantsProductUpdate } from '#/api/property/productManagement';
|
||||
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',
|
||||
}
|
||||
@@ -42,7 +36,6 @@ const { onBeforeClose, markInitialized, resetInitialized } = useBeforeCloseDiff(
|
||||
);
|
||||
|
||||
const [BasicModal, modalApi] = useVbenModal({
|
||||
// 在这里更改宽度
|
||||
class: 'w-[550px]',
|
||||
fullscreenButton: false,
|
||||
onBeforeClose,
|
||||
@@ -53,16 +46,13 @@ const [BasicModal, modalApi] = useVbenModal({
|
||||
return null;
|
||||
}
|
||||
modalApi.modalLoading(true);
|
||||
|
||||
const { id } = modalApi.getData() as { id?: number | string };
|
||||
isUpdate.value = !!id;
|
||||
|
||||
if (isUpdate.value && id) {
|
||||
const record = await plantsProductInfo(id);
|
||||
await formApi.setValues(record);
|
||||
}
|
||||
await markInitialized();
|
||||
|
||||
modalApi.modalLoading(false);
|
||||
},
|
||||
});
|
||||
@@ -74,7 +64,6 @@ async function handleConfirm() {
|
||||
if (!valid) {
|
||||
return;
|
||||
}
|
||||
// getValues获取为一个readonly的对象 需要修改必须先深拷贝一次
|
||||
const data = cloneDeep(await formApi.getValues());
|
||||
await (isUpdate.value ? plantsProductUpdate(data) : plantsProductAdd(data));
|
||||
resetInitialized();
|
||||
|
Reference in New Issue
Block a user