| | |
| | | operatorId: number | string; |
| | | |
| | | /** |
| | | * æä½äººé¨é¨ |
| | | */ |
| | | operatorDept: operatorDept | string; |
| | | |
| | | /** |
| | | * å¼å§æ¶é´ |
| | | */ |
| | | startTime: string; |
¶Ô±ÈÐÂÎļþ |
| | |
| | | import type { InventoryDetailVO } from './model'; |
| | | |
| | | import type { ID, IDS } from '#/api/common'; |
| | | |
| | | import { commonExport } from '#/api/helper'; |
| | | import { requestClient } from '#/api/request'; |
| | | |
| | | enum Api { |
| | | inventoryDetailExport = '/eims/inventoryDetail/export', |
| | | inventoryDetailList = '/eims/inventoryDetail/list', |
| | | root = '/eims/inventoryDetail' |
| | | } |
| | | |
| | | /** |
| | | * æ¥è¯¢çç¹å表 |
| | | * @param query |
| | | * @returns {*} |
| | | */ |
| | | |
| | | export function listInventoryDetail(params?: any) { |
| | | return requestClient.get<InventoryDetailVO[]>(Api.inventoryDetailList, { params }); |
| | | } |
| | | |
| | | /** |
| | | * æ¥è¯¢çç¹æç» |
| | | * @param inventoryDetailId |
| | | */ |
| | | export function getInventoryDetail(inventoryDetailId: ID) { |
| | | return requestClient.get<InventoryDetailVO>(`${Api.root}/${inventoryDetailId}`); |
| | | } |
| | | |
| | | /** |
| | | * æ°å¢çç¹æç» |
| | | * @param data |
| | | */ |
| | | export function addInventoryDetail(data: any) { |
| | | return requestClient.postWithMsg<void>(Api.root, data); |
| | | } |
| | | |
| | | /** |
| | | * ä¿®æ¹çç¹æç» |
| | | * @param data |
| | | */ |
| | | export function updateInventoryDetail(data: any) { |
| | | return requestClient.putWithMsg<void>(Api.root, data); |
| | | } |
| | | |
| | | /** |
| | | * å é¤çç¹æç» |
| | | * @param inventoryId |
| | | */ |
| | | export function delInventoryDetail(inventoryDetailId: IDS) { |
| | | return requestClient.deleteWithMsg<void>(`${Api.root}/${inventoryDetailId}`); |
| | | } |
| | | /** |
| | | * å¯¼åº |
| | | * @param |
| | | */ |
| | | export function inventoryDetailExport(data: any) { |
| | | return commonExport(Api.inventoryDetailExport, data); |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | export interface InventoryDetailVO { |
| | | /** |
| | | * æç»id |
| | | */ |
| | | id: number | string; |
| | | |
| | | /** |
| | | * çç¹id |
| | | */ |
| | | inventoryId: number | string; |
| | | |
| | | /** |
| | | * ç¶æ |
| | | */ |
| | | status: string; |
| | | |
| | | /** |
| | | * 设å¤åç§° |
| | | */ |
| | | equName: string; |
| | | /** |
| | | * 设å¤ç¼ç |
| | | */ |
| | | equCode: string; |
| | | /** |
| | | * 设å¤èµäº§ç¼å· |
| | | */ |
| | | equAssetNo: string; |
| | | /** |
| | | * é¨é¨åç§° |
| | | */ |
| | | deptName: string; |
| | | /** |
| | | * 设å¤ç±»ååç§° |
| | | */ |
| | | equTypeName: string; |
| | | /** |
| | | * è®¾å¤æå¨ä½ç½® |
| | | */ |
| | | location: string; |
| | | /** |
| | | * 设å¤ç¶æ |
| | | */ |
| | | equStatus: string; |
| | | // |
| | | /** |
| | | * çç¹äºº |
| | | */ |
| | | inventoryUser: string; |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | import type { InventoryVO } from './model'; |
| | | |
| | | import type { ID, IDS } from '#/api/common'; |
| | | |
| | | import { commonExport } from '#/api/helper'; |
| | | import { requestClient } from '#/api/request'; |
| | | |
| | | enum Api { |
| | | inventoryExport = '/eims/inventory/export', |
| | | inventoryList = '/eims/inventory/list', |
| | | root = '/eims/inventory' |
| | | } |
| | | |
| | | /** |
| | | * æ¥è¯¢çç¹å表 |
| | | * @param query |
| | | * @returns {*} |
| | | */ |
| | | |
| | | export function listInventory(params?: any) { |
| | | return requestClient.get<InventoryVO[]>(Api.inventoryList, { params }); |
| | | } |
| | | |
| | | /** |
| | | * æ¥è¯¢çç¹è¯¦ç» |
| | | * @param inventoryId |
| | | */ |
| | | export function getInventory(inventoryId: ID) { |
| | | return requestClient.get<InventoryVO>(`${Api.root}/${inventoryId}`); |
| | | } |
| | | |
| | | /** |
| | | * æ°å¢çç¹ |
| | | * @param data |
| | | */ |
| | | export function addInventory(data: any) { |
| | | return requestClient.postWithMsg<void>(Api.root, data); |
| | | } |
| | | |
| | | /** |
| | | * ä¿®æ¹çç¹ |
| | | * @param data |
| | | */ |
| | | export function updateInventory(data: any) { |
| | | return requestClient.putWithMsg<void>(Api.root, data); |
| | | } |
| | | |
| | | /** |
| | | * å é¤çç¹ |
| | | * @param inventoryId |
| | | */ |
| | | export function delInventory(inventoryId: IDS) { |
| | | return requestClient.deleteWithMsg<void>(`${Api.root}/${inventoryId}`); |
| | | } |
| | | /** |
| | | * å¯¼åº |
| | | * @param |
| | | */ |
| | | export function inventoryExport(data: any) { |
| | | return commonExport(Api.inventoryExport, data); |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | export interface InventoryVO { |
| | | /** |
| | | * çç¹id |
| | | */ |
| | | inventoryId: number | string; |
| | | |
| | | /** |
| | | * çç¹åå· |
| | | */ |
| | | inventoryCode: string; |
| | | |
| | | /** |
| | | * çç¹åç§° |
| | | */ |
| | | inventoryName: string; |
| | | |
| | | /** |
| | | * çç¹äºº |
| | | */ |
| | | inventoryUser: number; |
| | | /** |
| | | * çç¹äººé¨é¨ |
| | | */ |
| | | userDept: number; |
| | | |
| | | /** |
| | | * å¼å§æ¥æ |
| | | */ |
| | | startDate: string; |
| | | |
| | | /** |
| | | * ç»ææ¥æ |
| | | */ |
| | | endDate: string; |
| | | |
| | | /** |
| | | * çç¹ç¶æ |
| | | */ |
| | | status: string; |
| | | |
| | | /** |
| | | * 夿³¨ |
| | | */ |
| | | remark: string; |
| | | } |
| | | |
| | | export interface InventoryForm extends BaseEntity { |
| | | /** |
| | | * çç¹id |
| | | */ |
| | | inventoryId?: number | string; |
| | | |
| | | /** |
| | | * çç¹åå· |
| | | */ |
| | | inventoryCode?: string; |
| | | |
| | | /** |
| | | * çç¹åç§° |
| | | */ |
| | | inventoryName?: string; |
| | | |
| | | /** |
| | | * çç¹äºº |
| | | */ |
| | | inventoryUser?: number; |
| | | |
| | | /** |
| | | * å¼å§æ¥æ |
| | | */ |
| | | startDate?: string; |
| | | |
| | | /** |
| | | * ç»ææ¥æ |
| | | */ |
| | | endDate?: string; |
| | | |
| | | /** |
| | | * çç¹ç¶æ |
| | | */ |
| | | status?: string; |
| | | |
| | | /** |
| | | * 夿³¨ |
| | | */ |
| | | remark?: string; |
| | | } |
| | |
| | | } |
| | | ] |
| | | }, |
| | | { |
| | | component: 'BasicLayout', |
| | | meta: { |
| | | hideChildrenInMenu: true, |
| | | hideInMenu: true, |
| | | title: 'çç¹æç»' |
| | | }, |
| | | name: 'InventoryDetail', |
| | | path: '/', |
| | | redirect: '/inventory/detail', |
| | | children: [ |
| | | { |
| | | component: '/eims/inventory-detail/index', |
| | | meta: { |
| | | activePath: '/equ/inventory', |
| | | icon: 'eos-icons:role-binding-outlined', |
| | | keepAlive: true, |
| | | title: 'çç¹æç»' |
| | | }, |
| | | name: 'InventoryDetailIndex', |
| | | path: '/inventory/detail/:inventoryId' |
| | | } |
| | | ] |
| | | }, |
| | | ]; |
| | | |
| | | /** |
| | |
| | | if (isUpdate.value && id) { |
| | | const record = await getEquStatu(id); |
| | | await formApi.setValues(record); |
| | | if(isUpdate.value && record.userDept){ |
| | | await setupUserOptions(record.userDept); |
| | | } |
| | | } |
| | | // 设å¤idæå¼æ¶ä¸å
许ç¼è¾ï¼1.ç¼è¾ 2.设å¤è¯¦æ
页æå¼ï¼ |
| | | const flag = equId !== undefined || isUpdate.value; |
| | |
| | | /** æ ¹æ®é¨é¨IDå è½½ç¨æ· */ |
| | | await setupUserOptions(deptId); |
| | | /** åååéè¦éæ°éæ©ç¨æ· */ |
| | | formModel.respPerson = undefined; |
| | | formModel.changeUser = undefined; |
| | | }, |
| | | placeholder: 'è¯·éæ©', |
| | | showSearch: true, |
| | |
| | | if (isUpdate.value && id) { |
| | | const record = await getEquTrial(id); |
| | | await formApi.setValues(record); |
| | | if(isUpdate.value && record.operatorDept){ |
| | | await setupUserOptions(record.operatorDept); |
| | | } |
| | | } |
| | | // 设å¤idæå¼æ¶ä¸å
许ç¼è¾ï¼1.ç¼è¾ 2.设å¤è¯¦æ
页æå¼ï¼ |
| | | const flag = equId !== undefined || isUpdate.value; |
| | |
| | | /** æ ¹æ®é¨é¨IDå è½½ç¨æ· */ |
| | | await setupUserOptions(deptId); |
| | | /** åååéè¦éæ°éæ©ç¨æ· */ |
| | | formModel.respPerson = undefined; |
| | | formModel.operatorId = undefined; |
| | | }, |
| | | placeholder: 'è¯·éæ©', |
| | | showSearch: true, |
¶Ô±ÈÐÂÎļþ |
| | |
| | | import type { VxeGridProps } from '#/adapter/vxe-table'; |
| | | |
| | | import { DictEnum } from '@vben/constants'; |
| | | import { getPopupContainer } from '@vben/utils'; |
| | | |
| | | import { Tag } from 'ant-design-vue'; |
| | | |
| | | import { type FormSchemaGetter, z } from '#/adapter/form'; |
| | | import { getDictOptions } from '#/utils/dict'; |
| | | |
| | | export const querySchema: FormSchemaGetter = () => [ |
| | | { |
| | | component: 'Input', |
| | | fieldName: 'equCode', |
| | | label: '设å¤ç¼ç ' |
| | | }, |
| | | { |
| | | component: 'Input', |
| | | fieldName: 'equName', |
| | | label: '设å¤åç§°' |
| | | }, |
| | | { |
| | | component: 'Input', |
| | | fieldName: 'equAssetNo', |
| | | label: 'èµäº§ç¼å·' |
| | | }, |
| | | { |
| | | component: 'Input', |
| | | fieldName: 'location', |
| | | label: 'æå¨åºæ' |
| | | }, |
| | | { |
| | | component: 'Select', |
| | | componentProps: { |
| | | options: getDictOptions(DictEnum.SYS_EQU_STATUS) |
| | | }, |
| | | fieldName: 'equStatus', |
| | | label: '设å¤ç¶æ' |
| | | }, |
| | | { |
| | | component: 'Select', |
| | | componentProps: { |
| | | options: getDictOptions(DictEnum.EIMS_INVENTORY_DETAIL_STATU) |
| | | }, |
| | | fieldName: 'status', |
| | | label: 'çç¹æç»' |
| | | } |
| | | ]; |
| | | |
| | | export const columns: VxeGridProps['columns'] = [ |
| | | { type: 'checkbox', width: 60, fixed: 'left' }, |
| | | { |
| | | title: '设å¤ç¼å·', |
| | | field: 'equCode', |
| | | minWidth: 120, |
| | | fixed: 'left', |
| | | }, |
| | | { |
| | | title: '设å¤åç§°', |
| | | field: 'equName', |
| | | minWidth: 100, |
| | | fixed: 'left', |
| | | }, |
| | | { |
| | | title: 'èµäº§ç¼å·', |
| | | field: 'equAssetNo', |
| | | sortable: true, |
| | | minWidth: 100, |
| | | }, |
| | | { |
| | | title: '使ç¨é¨é¨', |
| | | field: 'deptName', |
| | | minWidth: 100, |
| | | }, |
| | | { |
| | | title: '设å¤ç±»å', |
| | | field: 'equTypeName', |
| | | minWidth: 100, |
| | | }, |
| | | { |
| | | title: '设å¤ä½ç½®', |
| | | field: 'location', |
| | | minWidth: 100, |
| | | }, |
| | | { |
| | | title: '设å¤ç¶æ', |
| | | field: 'equStatus', |
| | | sortable: true, |
| | | slots: { |
| | | default: ({ row }) => { |
| | | const statu = row.status; |
| | | switch (statu) { |
| | | case '0': { |
| | | return <Tag color="cyan">è¯ç¨</Tag>; |
| | | } |
| | | case '1': { |
| | | return <Tag color="green">å
¥åº</Tag>; |
| | | } |
| | | case '2': { |
| | | return <Tag color="orange">è¿ç§»</Tag>; |
| | | } |
| | | case '3': { |
| | | return <Tag color="red">æ¥åº</Tag>; |
| | | } |
| | | case null: { |
| | | return ''; |
| | | } |
| | | // No default |
| | | } |
| | | return ''; |
| | | } |
| | | }, |
| | | minWidth: 80, |
| | | }, |
| | | |
| | | { |
| | | title: 'çç¹äºº', |
| | | field: 'inventoryUser', |
| | | sortable: true, |
| | | minWidth: 100 |
| | | }, |
| | | { |
| | | field: 'action', |
| | | fixed: 'right', |
| | | slots: { default: 'action' }, |
| | | title: 'æä½', |
| | | width: 200 |
| | | } |
| | | ]; |
| | | |
| | | export const drawerSchema: FormSchemaGetter = () => [ |
| | | { |
| | | component: 'Input', |
| | | dependencies: { |
| | | show: () => false, |
| | | triggerFields: [''] |
| | | }, |
| | | fieldName: 'equId' |
| | | }, |
| | | { |
| | | component: 'TreeSelect', |
| | | defaultValue: 0, |
| | | fieldName: 'equTypeId', |
| | | label: '设å¤ç±»å', |
| | | rules: 'selectRequired' |
| | | }, |
| | | { |
| | | component: 'Input', |
| | | fieldName: 'equName', |
| | | label: '设å¤åç§°', |
| | | rules: 'required' |
| | | }, |
| | | { |
| | | component: 'Input', |
| | | fieldName: 'equCode', |
| | | label: '设å¤ç¼ç ', |
| | | help: '设å¤å¯ä¸ç¼ç ' |
| | | }, |
| | | { |
| | | component: 'Input', |
| | | fieldName: 'assetNo', |
| | | label: 'èµäº§ç¼å·' |
| | | }, |
| | | { |
| | | component: 'Input', |
| | | fieldName: 'modelNo', |
| | | label: 'åå·' |
| | | }, |
| | | { |
| | | component: 'Input', |
| | | fieldName: 'madeIn', |
| | | label: 'å¶é å' |
| | | }, |
| | | { |
| | | component: 'Input', |
| | | fieldName: 'ratedPower', |
| | | label: 'é¢å®åç' |
| | | }, |
| | | { |
| | | component: 'Input', |
| | | fieldName: 'plateInfo', |
| | | label: 'éçä¿¡æ¯' |
| | | }, |
| | | { |
| | | component: 'DatePicker', |
| | | componentProps: { |
| | | format: 'YYYY-MM-DD', |
| | | showTime: false, |
| | | valueFormat: 'YYYY-MM-DD', |
| | | getPopupContainer |
| | | }, |
| | | fieldName: 'purchaseDate', |
| | | label: 'éè´æ¥æ' |
| | | }, |
| | | { |
| | | component: 'RadioGroup', |
| | | componentProps: { |
| | | buttonStyle: 'solid', |
| | | options: getDictOptions(DictEnum.SYS_EQU_STATUS), |
| | | optionType: 'button' |
| | | }, |
| | | defaultValue: '0', |
| | | fieldName: 'status', |
| | | label: 'ç¶æ' |
| | | }, |
| | | { |
| | | component: 'Input', |
| | | fieldName: 'location', |
| | | label: 'æå¨åºæ', |
| | | help: `设å¤å®é
ææ¾åºæ` |
| | | }, |
| | | |
| | | { |
| | | component: 'TreeSelect', |
| | | // å¨draweréæ´æ° è¿éä¸éè¦é»è®¤çcomponentProps |
| | | defaultValue: undefined, |
| | | fieldName: 'deptUsed', |
| | | label: '使ç¨é¨é¨' |
| | | // rules: 'selectRequired', |
| | | }, |
| | | { |
| | | component: 'Select', |
| | | componentProps: { |
| | | allowClear: true, |
| | | showSearch: true, |
| | | getPopupContainer |
| | | }, |
| | | fieldName: 'respPerson', |
| | | label: '责任人', |
| | | help: `设å¤è´è´£äººï¼ç®¡ç人å` |
| | | }, |
| | | { |
| | | component: 'Input', |
| | | fieldName: 'contactPhone', |
| | | label: 'èç³»çµè¯', |
| | | defaultValue: undefined, |
| | | rules: z |
| | | .string() |
| | | .regex(/^1[3-9]\d{9}$/, '请è¾å
¥æ£ç¡®çææºå·ç ') |
| | | .optional() |
| | | .or(z.literal('')) |
| | | }, |
| | | { |
| | | component: 'DatePicker', |
| | | componentProps: { |
| | | format: 'YYYY-MM-DD', |
| | | showTime: false, |
| | | valueFormat: 'YYYY-MM-DD', |
| | | getPopupContainer |
| | | }, |
| | | fieldName: 'deployDate', |
| | | label: 'æ£å¼ä½¿ç¨æ¥æ' |
| | | }, |
| | | { |
| | | component: 'DatePicker', |
| | | componentProps: { |
| | | format: 'YYYY-MM-DD', |
| | | showTime: false, |
| | | valueFormat: 'YYYY-MM-DD', |
| | | getPopupContainer |
| | | }, |
| | | fieldName: 'trialDate', |
| | | label: 'å¼å§è¯ç¨æ¥æ' |
| | | }, |
| | | { |
| | | component: 'DatePicker', |
| | | componentProps: { |
| | | format: 'YYYY-MM-DD', |
| | | showTime: false, |
| | | valueFormat: 'YYYY-MM-DD', |
| | | getPopupContainer |
| | | }, |
| | | fieldName: 'planAcceptDate', |
| | | label: '计åéªæ¶æ¥æ' |
| | | }, |
| | | { |
| | | component: 'DatePicker', |
| | | componentProps: { |
| | | format: 'YYYY-MM-DD', |
| | | showTime: false, |
| | | valueFormat: 'YYYY-MM-DD', |
| | | getPopupContainer |
| | | }, |
| | | fieldName: 'actualAcceptDate', |
| | | label: 'å®é
éªæ¶æ¥æ' |
| | | }, |
| | | { |
| | | component: 'RadioGroup', |
| | | componentProps: { |
| | | buttonStyle: 'solid', |
| | | options: getDictOptions(DictEnum.SYS_NORMAL_DISABLE), |
| | | optionType: 'button' |
| | | }, |
| | | defaultValue: '0', |
| | | fieldName: 'importStatus', |
| | | formItemClass: 'col-span-2 lg:col-span-1', |
| | | label: '导å
¥ç¶æ' |
| | | }, |
| | | |
| | | { |
| | | component: 'Input', |
| | | fieldName: 'serviceLife', |
| | | label: '使ç¨å¹´é' |
| | | }, |
| | | { |
| | | component: 'RadioGroup', |
| | | componentProps: { |
| | | buttonStyle: 'solid', |
| | | options: getDictOptions(DictEnum.SYS_NORMAL_DISABLE), |
| | | optionType: 'button' |
| | | }, |
| | | defaultValue: '0', |
| | | fieldName: 'inventoryFlag', |
| | | formItemClass: 'col-span-2 lg:col-span-1', |
| | | label: 'çç¹æ å¿' |
| | | }, |
| | | { |
| | | component: 'DatePicker', |
| | | componentProps: { |
| | | format: 'YYYY-MM-DD', |
| | | showTime: false, |
| | | valueFormat: 'YYYY-MM-DD', |
| | | getPopupContainer |
| | | }, |
| | | fieldName: 'inventoryDate', |
| | | label: '䏿¬¡çç¹æ¥æ' |
| | | } |
| | | ]; |
¶Ô±ÈÐÂÎļþ |
| | |
| | | <script setup lang="ts"> |
| | | import { computed, ref } from 'vue'; |
| | | |
| | | import { useVbenDrawer } from '@vben/common-ui'; |
| | | import { $t } from '@vben/locales'; |
| | | import { addFullName, cloneDeep, getPopupContainer, listToTree } from '@vben/utils'; |
| | | |
| | | import { useVbenForm } from '#/adapter/form'; |
| | | import { addEqu, getEqu, updateEqu } from '#/api/eims/equ'; |
| | | import { getEquType, listEquType } from '#/api/eims/equ-type'; |
| | | import { getDeptTree, userList } from '#/api/system/user'; |
| | | |
| | | import { drawerSchema } from './data'; |
| | | |
| | | const emit = defineEmits<{ reload: [] }>(); |
| | | const typeDisabled = ref(false); |
| | | |
| | | 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', |
| | | componentProps: { |
| | | class: 'w-full' |
| | | }, |
| | | labelWidth: 120 |
| | | }, |
| | | schema: drawerSchema(), |
| | | showDefaultActions: false, |
| | | wrapperClass: 'grid-cols-2' |
| | | }); |
| | | |
| | | const [BasicDrawer, drawerApi] = useVbenDrawer({ |
| | | onCancel: handleCancel, |
| | | onConfirm: handleConfirm, |
| | | async onOpenChange(isOpen) { |
| | | if (!isOpen) { |
| | | return null; |
| | | } |
| | | drawerApi.drawerLoading(true); |
| | | const { id } = drawerApi.getData() as { id?: number | string }; |
| | | const { typeDisable } = drawerApi.getData() as { typeDisable?: boolean }; |
| | | typeDisabled.value = !!typeDisable; |
| | | isUpdate.value = !!id; |
| | | // åå§å |
| | | await setupDeptSelect(); |
| | | // æ´æ° && èµå¼ |
| | | if (isUpdate.value && id) { |
| | | const record = await getEqu(id); |
| | | await formApi.setValues(record); |
| | | if(isUpdate.value && record.deptUsed){ |
| | | await setupUserOptions(record.deptUsed) |
| | | } |
| | | |
| | | } |
| | | |
| | | // å 载设å¤ç±»åæ éæ© |
| | | await setupEquTypeSelect(); |
| | | if (id) { |
| | | await formApi.setFieldValue('parentId', id); |
| | | if (isUpdate.value && id) { |
| | | const record = await getEquType(id); |
| | | await formApi.setValues(record); |
| | | } |
| | | } |
| | | drawerApi.drawerLoading(false); |
| | | } |
| | | }); |
| | | |
| | | |
| | | async function setupEquTypeSelect() { |
| | | // status-0 åªæ¥è¯¢æªåç¨è®¾å¤ |
| | | const equArray = await listEquType({ status: 0 }); |
| | | // support i18n |
| | | equArray.forEach((item) => { |
| | | item.typeName = $t(item.typeName); |
| | | }); |
| | | const equTree = listToTree(equArray, { id: 'equTypeId', pid: 'parentId' }); |
| | | const fullEquTree = [ |
| | | { |
| | | equTypeId: 0, |
| | | typeName: $t('menu.root'), |
| | | children: equTree, |
| | | }, |
| | | ]; |
| | | addFullName(fullEquTree, 'typeName', ' / '); |
| | | formApi.updateSchema([ |
| | | { |
| | | componentProps: { |
| | | fieldNames: { |
| | | label: 'typeName', |
| | | value: 'equTypeId', |
| | | }, |
| | | getPopupContainer, |
| | | // è®¾ç½®å¼¹çªæ»å¨é«åº¦ é»è®¤256 |
| | | listHeight: 300, |
| | | showSearch: true, |
| | | treeData: fullEquTree, |
| | | disabled: typeDisabled.value, |
| | | treeDefaultExpandAll: false, |
| | | // é»è®¤å±å¼çæ èç¹ |
| | | treeDefaultExpandedKeys: [0], |
| | | treeLine: { showLeafIcon: false }, |
| | | // çéçåæ®µ |
| | | treeNodeFilterProp: 'typeName', |
| | | treeNodeLabelProp: 'fullName', |
| | | }, |
| | | fieldName: 'equTypeId', |
| | | }, |
| | | ]); |
| | | } |
| | | |
| | | /** |
| | | * ç¨æ·çå è½½ |
| | | */ |
| | | async function setupUserOptions(deptId: any) { |
| | | const params = { deptId }; |
| | | const userPageResult = await userList({ |
| | | pageNum: 1, |
| | | pageSize: 500, |
| | | ...params |
| | | }); |
| | | const options = userPageResult.rows.map((item) => ({ |
| | | label: item.nickName || item.userName, |
| | | value: item.userId |
| | | })); |
| | | // çé |
| | | const filterOption = (input: string, option: any) => { |
| | | return option.label.toLowerCase().includes(input.toLowerCase()); |
| | | }; |
| | | |
| | | const placeholder = options.length > 0 ? 'è¯·éæ©' : '该é¨é¨ä¸ææ ç¨æ·'; |
| | | formApi.updateSchema([ |
| | | { |
| | | componentProps: { options, placeholder ,filterOption }, |
| | | fieldName: 'respPerson' |
| | | } |
| | | ]); |
| | | } |
| | | |
| | | /** |
| | | * åå§åé¨é¨éæ© |
| | | */ |
| | | async function setupDeptSelect() { |
| | | // updateSchema |
| | | const deptTree = await getDeptTree(); |
| | | // éä¸åæ¾ç¤ºå¨è¾å
¥æ¡çå¼ å³ç¶èç¹ / åèç¹ |
| | | addFullName(deptTree, 'label', ' / '); |
| | | formApi.updateSchema([ |
| | | { |
| | | componentProps: (formModel) => ({ |
| | | class: 'w-full', |
| | | fieldNames: { |
| | | key: 'id', |
| | | value: 'id', |
| | | children: 'children' |
| | | }, |
| | | getPopupContainer, |
| | | async onSelect(deptId: number | string) { |
| | | /** æ ¹æ®é¨é¨IDå è½½ç¨æ· */ |
| | | await setupUserOptions(deptId); |
| | | /** åååéè¦éæ°éæ©ç¨æ· */ |
| | | formModel.respPerson = undefined; |
| | | }, |
| | | placeholder: 'è¯·éæ©', |
| | | showSearch: true, |
| | | treeData: deptTree, |
| | | treeDefaultExpandAll: true, |
| | | treeLine: { showLeafIcon: false }, |
| | | // çéçåæ®µ |
| | | treeNodeFilterProp: 'label', |
| | | // éä¸åæ¾ç¤ºå¨è¾å
¥æ¡çå¼ |
| | | treeNodeLabelProp: 'fullName' |
| | | }), |
| | | fieldName: 'deptUsed' |
| | | } |
| | | ]); |
| | | } |
| | | |
| | | async function handleConfirm() { |
| | | try { |
| | | drawerApi.drawerLoading(true); |
| | | const { valid } = await formApi.validate(); |
| | | if (!valid) { |
| | | return; |
| | | } |
| | | const data = cloneDeep(await formApi.getValues()); |
| | | await (isUpdate.value ? updateEqu(data) : addEqu(data)); |
| | | emit('reload'); |
| | | await handleCancel(); |
| | | } catch (error) { |
| | | console.error(error); |
| | | } finally { |
| | | drawerApi.drawerLoading(false); |
| | | } |
| | | } |
| | | |
| | | async function handleCancel() { |
| | | drawerApi.close(); |
| | | await formApi.resetForm(); |
| | | } |
| | | </script> |
| | | |
| | | <template> |
| | | <BasicDrawer :close-on-click-modal="false" :title="title" class="w-[600px]"> |
| | | <BasicForm /> |
| | | </BasicDrawer> |
| | | </template> |
¶Ô±ÈÐÂÎļþ |
| | |
| | | <script setup lang="ts"> |
| | | import type { DeptTree } from '#/api/system/user/model'; |
| | | |
| | | import { onMounted, type PropType, ref } from 'vue'; |
| | | |
| | | import { SyncOutlined } from '@ant-design/icons-vue'; |
| | | import { Empty, InputSearch, Skeleton, Tree } from 'ant-design-vue'; |
| | | |
| | | import { getEquTypeTree } from '#/api/eims/equ-type'; |
| | | |
| | | defineOptions({ inheritAttrs: false }); |
| | | |
| | | const emit = defineEmits<{ |
| | | /** |
| | | * ç¹å»å·æ°æé®çäºä»¶ |
| | | */ |
| | | reload: []; |
| | | /** |
| | | * ç¹å»èç¹çäºä»¶ |
| | | */ |
| | | select: []; |
| | | }>(); |
| | | |
| | | const selectDeptId = defineModel('selectDeptId', { |
| | | required: true, |
| | | type: Array as PropType<string[]>, |
| | | }); |
| | | |
| | | const searchValue = defineModel('searchValue', { |
| | | type: String, |
| | | default: '', |
| | | }); |
| | | |
| | | /** é¨é¨æ°æ®æº */ |
| | | type DeptTreeArray = DeptTree[]; |
| | | const deptTreeArray = ref<DeptTreeArray>([]); |
| | | /** 骨æ¶å±å è½½ */ |
| | | const showTreeSkeleton = ref<boolean>(true); |
| | | |
| | | async function loadTree() { |
| | | showTreeSkeleton.value = true; |
| | | searchValue.value = ''; |
| | | selectDeptId.value = []; |
| | | |
| | | const ret = await getEquTypeTree(); |
| | | |
| | | deptTreeArray.value = ret; |
| | | showTreeSkeleton.value = false; |
| | | } |
| | | |
| | | async function handleReload() { |
| | | await loadTree(); |
| | | emit('reload'); |
| | | } |
| | | |
| | | onMounted(loadTree); |
| | | </script> |
| | | |
| | | <template> |
| | | <div :class="$attrs.class"> |
| | | <Skeleton |
| | | :loading="showTreeSkeleton" |
| | | :paragraph="{ rows: 8 }" |
| | | active |
| | | class="p-[8px]" |
| | | > |
| | | <div |
| | | class="bg-background flex h-full flex-col overflow-y-auto rounded-lg" |
| | | > |
| | | <!-- åºå®å¨é¡¶é¨ å¿
é¡»å ä¸bg-backgroundèæ¯è² å¦åä¼äº§ç'ç©¿é'ææ --> |
| | | <div class="bg-background z-100 sticky left-0 top-0 p-[8px]"> |
| | | <InputSearch |
| | | v-model:value="searchValue" |
| | | :placeholder="$t('pages.common.search')" |
| | | size="small" |
| | | > |
| | | <template #enterButton> |
| | | <a-button @click="handleReload"> |
| | | <SyncOutlined class="text-primary" /> |
| | | </a-button> |
| | | </template> |
| | | </InputSearch> |
| | | </div> |
| | | <div class="h-full overflow-x-hidden px-[8px]"> |
| | | <Tree |
| | | v-bind="$attrs" |
| | | v-if="deptTreeArray.length > 0" |
| | | v-model:selected-keys="selectDeptId" |
| | | :class="$attrs.class" |
| | | :field-names="{ title: 'label', key: 'id' }" |
| | | :show-line="{ showLeafIcon: false }" |
| | | :tree-data="deptTreeArray" |
| | | :virtual="false" |
| | | default-expand-all |
| | | @select="$emit('select')" |
| | | > |
| | | <template #title="{ label }"> |
| | | <span v-if="label.indexOf(searchValue) > -1"> |
| | | {{ label.substring(0, label.indexOf(searchValue)) }} |
| | | <span style="color: #f50">{{ searchValue }}</span> |
| | | {{ |
| | | label.substring( |
| | | label.indexOf(searchValue) + searchValue.length, |
| | | ) |
| | | }} |
| | | </span> |
| | | <span v-else>{{ label }}</span> |
| | | </template> |
| | | </Tree> |
| | | <!-- ä»
æ¬äººæ°æ®æé å¯ä»¥èèç´æ¥ä¸æ¾ç¤º --> |
| | | <div v-else class="mt-5"> |
| | | <Empty |
| | | :image="Empty.PRESENTED_IMAGE_SIMPLE" |
| | | description="æ é¨é¨æ°æ®" |
| | | /> |
| | | </div> |
| | | </div> |
| | | </div> |
| | | </Skeleton> |
| | | </div> |
| | | </template> |
¶Ô±ÈÐÂÎļþ |
| | |
| | | <script setup lang="ts"> |
| | | import type { Recordable } from '@vben/types'; |
| | | |
| | | import { ref } from 'vue'; |
| | | import { useRoute, useRouter } from 'vue-router'; |
| | | |
| | | import { Page, useVbenDrawer, type VbenFormProps } from '@vben/common-ui'; |
| | | import { $t } from '@vben/locales'; |
| | | import { getVxePopupContainer } from '@vben/utils'; |
| | | |
| | | import { Modal, Popconfirm, Space } from 'ant-design-vue'; |
| | | |
| | | import { useVbenVxeGrid, vxeCheckboxChecked, type VxeGridProps, vxeSortEvent } from '#/adapter/vxe-table'; |
| | | import { delInventoryDetail, inventoryDetailExport, listInventoryDetail } from '#/api/eims/inventory-detail'; |
| | | import { commonDownloadExcel } from '#/utils/file/download'; |
| | | |
| | | import { columns, querySchema } from './data'; |
| | | import equDrawer from './equ-drawer.vue'; |
| | | import EquTypeTree from './equ-type-tree.vue'; |
| | | |
| | | const route = useRoute(); |
| | | const inventoryId = route.params.inventoryId as string; |
| | | |
| | | // 左边é¨é¨ç¨ |
| | | const selectTypeId = ref<string[]>([]); |
| | | |
| | | 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', |
| | | handleReset: async () => { |
| | | selectTypeId.value = []; |
| | | // eslint-disable-next-line no-use-before-define |
| | | const { formApi, reload } = tableApi; |
| | | await formApi.resetForm(); |
| | | const formValues = formApi.form.values; |
| | | formApi.setLatestSubmissionValues(formValues); |
| | | await reload(formValues); |
| | | }, |
| | | // æ¥æéæ©æ ¼å¼å |
| | | 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' |
| | | }, |
| | | columns, |
| | | height: 'auto', |
| | | keepSource: true, |
| | | pagerConfig: {}, |
| | | proxyConfig: { |
| | | ajax: { |
| | | query: async ({ page }, formValues = {}) => { |
| | | // é¨é¨æ éæ©å¤ç |
| | | if (selectTypeId.value.length === 1) { |
| | | formValues.equTypeId = selectTypeId.value[0]; |
| | | } else { |
| | | Reflect.deleteProperty(formValues, 'equTypeId'); |
| | | } |
| | | return await listInventoryDetail({ |
| | | pageNum: page.currentPage, |
| | | pageSize: page.pageSize, |
| | | ...formValues |
| | | }); |
| | | } |
| | | } |
| | | }, |
| | | rowConfig: { |
| | | isHover: true, |
| | | keyField: 'id' |
| | | }, |
| | | sortConfig: { |
| | | // è¿ç¨æåº |
| | | remote: true, |
| | | // æ¯æå¤å段æåº é»è®¤å
³é |
| | | multiple: true |
| | | }, |
| | | id: 'eims-inventory-detail-index' |
| | | }; |
| | | |
| | | const [BasicTable, tableApi] = useVbenVxeGrid({ |
| | | formOptions, |
| | | gridOptions, |
| | | gridEvents: { |
| | | sortChange: (sortParams) => vxeSortEvent(tableApi, sortParams) |
| | | } |
| | | }); |
| | | |
| | | const [EquDrawer, equDrawerApi] = useVbenDrawer({ |
| | | connectedComponent: equDrawer |
| | | }); |
| | | |
| | | function handleAdd() { |
| | | equDrawerApi.setData({}); |
| | | equDrawerApi.open(); |
| | | } |
| | | |
| | | async function handleEdit(record: Recordable<any>) { |
| | | equDrawerApi.setData({ id: record.equId }); |
| | | equDrawerApi.open(); |
| | | } |
| | | |
| | | async function handleDelete(row: Recordable<any>) { |
| | | await delInventoryDetail(row.id); |
| | | await tableApi.query(); |
| | | } |
| | | |
| | | function handleMultiDelete() { |
| | | const rows = tableApi.grid.getCheckboxRecords(); |
| | | const ids = rows.map((row: any) => row.id); |
| | | Modal.confirm({ |
| | | title: 'æç¤º', |
| | | okType: 'danger', |
| | | content: `确认å é¤éä¸ç${ids.length}æ¡è®°å½åï¼`, |
| | | onOk: async () => { |
| | | await delInventoryDetail(ids); |
| | | await tableApi.query(); |
| | | } |
| | | }); |
| | | } |
| | | |
| | | function handleDownloadExcel() { |
| | | commonDownloadExcel(inventoryDetailExport, 'çç¹æç»', tableApi.formApi.form.values, { |
| | | fieldMappingTime: formOptions.fieldMappingTime |
| | | }); |
| | | } |
| | | |
| | | function getImportStatus(row: any) { |
| | | const importStatus = row.importStatus === null || row.importStatus; |
| | | return importStatus ? 'æªå¯¼å
¥' : '已导å
¥'; |
| | | } |
| | | |
| | | function getInventoryFlag(row: any) { |
| | | const inventoryFlag = row.inventoryFlag === null || row.inventoryFlag; |
| | | return inventoryFlag ? 'æªçç¹' : 'å·²çç¹'; |
| | | } |
| | | |
| | | const router = useRouter(); |
| | | function handleDetail(record: Recordable<any>) { |
| | | router.push(`/equ/detail/${record.id}`); |
| | | } |
| | | </script> |
| | | |
| | | <template> |
| | | <Page :auto-content-height="true"> |
| | | <div class="flex h-full gap-[8px]"> |
| | | <EquTypeTree v-model:select-dept-id="selectTypeId" class="w-[260px]" @reload="() => tableApi.reload()" @select="() => tableApi.reload()" /> |
| | | <BasicTable class="flex-1 overflow-hidden" table-title="çç¹æç»å表"> |
| | | <template #toolbar-tools> |
| | | <Space> |
| | | <a-button v-access:code="['eims:inventory:export']" @click="handleDownloadExcel"> |
| | | {{ $t('pages.common.export') }} |
| | | </a-button> |
| | | <a-button :disabled="!vxeCheckboxChecked(tableApi)" danger type="primary" v-access:code="['eims:inventory:remove']" @click="handleMultiDelete"> |
| | | {{ $t('pages.common.delete') }} |
| | | </a-button> |
| | | <a-button type="primary" v-access:code="['eims:inventory:add']" @click="handleAdd"> |
| | | {{ $t('pages.common.add') }} |
| | | </a-button> |
| | | </Space> |
| | | </template> |
| | | |
| | | <template #equName="{ row }"> |
| | | <Space> |
| | | <a-button type="link" @click="handleDetail(row)"> {{ row.equName }}</a-button> |
| | | </Space> |
| | | </template> |
| | | |
| | | <template #action="{ row }"> |
| | | <Space> |
| | | <ghost-button v-access:code="['eims:inventory:edit']" @click.stop="handleEdit(row)"> |
| | | {{ $t('pages.common.edit') }} |
| | | </ghost-button> |
| | | <ghost-button v-if="row.menuType !== 'F'" class="btn-success" v-access:code="['eims:inventory:list']" @click="handleDetail(row)"> |
| | | {{ $t('pages.common.info') }} |
| | | </ghost-button> |
| | | <Popconfirm :get-popup-container="getVxePopupContainer" placement="left" title="确认å é¤ï¼" @confirm="handleDelete(row)"> |
| | | <ghost-button danger v-access:code="['eims:inventory:remove']" @click.stop=""> |
| | | {{ $t('pages.common.delete') }} |
| | | </ghost-button> |
| | | </Popconfirm> |
| | | </Space> |
| | | </template> |
| | | |
| | | <template #importStatus="{ row }"> |
| | | <span>{{ getImportStatus(row) }}</span> |
| | | </template> |
| | | |
| | | <template #inventoryFlag="{ row }"> |
| | | <span>{{ getInventoryFlag(row) }}</span> |
| | | </template> |
| | | </BasicTable> |
| | | </div> |
| | | <EquDrawer @reload="tableApi.query()" /> |
| | | </Page> |
| | | </template> |
¶Ô±ÈÐÂÎļþ |
| | |
| | | import type { VxeGridProps } from '#/adapter/vxe-table'; |
| | | |
| | | import { DictEnum } from '@vben/constants'; |
| | | import { getPopupContainer } from '@vben/utils'; |
| | | |
| | | import { Badge } from 'ant-design-vue'; |
| | | |
| | | import { type FormSchemaGetter } from '#/adapter/form'; |
| | | import { getDictOptions } from '#/utils/dict'; |
| | | |
| | | export const querySchema: FormSchemaGetter = () => [ |
| | | { |
| | | component: 'Input', |
| | | fieldName: 'inventoryName', |
| | | label: 'çç¹åç§°' |
| | | }, |
| | | { |
| | | component: 'Input', |
| | | fieldName: 'inventoryCode', |
| | | label: 'çç¹åå·' |
| | | }, |
| | | { |
| | | component: 'TreeSelect', |
| | | // å¨draweréæ´æ° è¿éä¸éè¦é»è®¤çcomponentProps |
| | | defaultValue: undefined, |
| | | fieldName: 'userDept', |
| | | label: 'çç¹é¨é¨', |
| | | help: `çç¹æä½äººåæå±é¨é¨` |
| | | // rules: 'selectRequired', |
| | | }, |
| | | { |
| | | component: 'Select', |
| | | componentProps: { |
| | | showSearch: true, |
| | | allowClear: true, |
| | | getPopupContainer |
| | | }, |
| | | fieldName: 'inventoryUser', |
| | | label: 'çç¹äºº' |
| | | }, |
| | | { |
| | | component: 'RangePicker', |
| | | fieldName: 'startDate', |
| | | label: 'çç¹æ¥æ', |
| | | help: 'å¼å§çç¹æ¥æ' |
| | | } |
| | | ]; |
| | | |
| | | export const columns: VxeGridProps['columns'] = [ |
| | | { type: 'checkbox', width: 60, fixed: 'left' }, |
| | | { |
| | | title: 'çç¹åç§°', |
| | | field: 'inventoryName', |
| | | minWidth: 100 |
| | | }, |
| | | { |
| | | title: 'çç¹åå·', |
| | | field: 'inventoryCode', |
| | | minWidth: 100, |
| | | slots: { default: 'inventoryCode' } |
| | | }, |
| | | { |
| | | title: 'çç¹ç¶æ', |
| | | field: 'status', |
| | | minWidth: 100, |
| | | slots: { |
| | | default: ({ row }) => { |
| | | const statu = row.status; |
| | | switch (statu) { |
| | | case '0': { |
| | | return <Badge status="processing" text="çç¹ä¸" />; |
| | | } |
| | | case '1': { |
| | | return <Badge status="success" text="çç¹ç»æ" />; |
| | | } |
| | | case null: { |
| | | return <Badge status="processing" text="çç¹ä¸" />; |
| | | } |
| | | // No default |
| | | } |
| | | return ''; |
| | | } |
| | | } |
| | | }, |
| | | { |
| | | title: 'å¼å§æ¥æ', |
| | | field: 'startDate', |
| | | sortable: true, |
| | | minWidth: 120 |
| | | }, |
| | | { |
| | | title: 'ç»ææ¥æ', |
| | | field: 'endDate', |
| | | sortable: true, |
| | | minWidth: 120 |
| | | }, |
| | | { |
| | | title: 'çç¹äºº', |
| | | field: 'inventoryUserName', |
| | | minWidth: 100 |
| | | }, |
| | | { |
| | | field: 'action', |
| | | fixed: 'right', |
| | | slots: { default: 'action' }, |
| | | title: 'æä½', |
| | | width: 200 |
| | | } |
| | | ]; |
| | | |
| | | export const drawerSchema: FormSchemaGetter = () => [ |
| | | { |
| | | component: 'Input', |
| | | dependencies: { |
| | | show: () => false, |
| | | triggerFields: [''] |
| | | }, |
| | | fieldName: 'inventoryId' |
| | | }, |
| | | { |
| | | component: 'Input', |
| | | fieldName: 'inventoryName', |
| | | label: 'çç¹åç§°' |
| | | }, |
| | | { |
| | | component: 'Input', |
| | | fieldName: 'inventoryCode', |
| | | label: 'çç¹åå·' |
| | | }, |
| | | { |
| | | component: 'Radio', |
| | | dependencies: { |
| | | show: () => false, |
| | | triggerFields: [''], |
| | | }, |
| | | fieldName: 'checkStrictly', |
| | | label: 'ç¶åèå¨' |
| | | }, |
| | | { |
| | | component: 'Input', |
| | | defaultValue: [], |
| | | fieldName: 'equTypesList', |
| | | label: '设å¤ç±»å', |
| | | help: `设å¤ç±»åç空ä¸å¾éï¼ç³»ç»é»è®¤çç¹å
¨é¨`, |
| | | formItemClass: 'col-span-2', |
| | | }, |
| | | { |
| | | component: 'Select', |
| | | componentProps: { |
| | | getPopupContainer, |
| | | mode: 'multiple', |
| | | optionFilterProp: 'label', |
| | | options: getDictOptions(DictEnum.SYS_EQU_STATUS), |
| | | }, |
| | | fieldName: 'equStatusList', |
| | | label: '使ç¨ç¶æ', |
| | | help: `使ç¨ç¶æç空ä¸å¾éï¼ç³»ç»é»è®¤çç¹å
¨é¨`, |
| | | }, |
| | | { |
| | | component: 'RadioGroup', |
| | | componentProps: { |
| | | buttonStyle: 'solid', |
| | | options: getDictOptions(DictEnum.EIMS_INVENTORY_STATU), |
| | | optionType: 'button' |
| | | }, |
| | | defaultValue: '0', |
| | | fieldName: 'status', |
| | | label: 'ç¶æ' |
| | | }, |
| | | { |
| | | component: 'DatePicker', |
| | | componentProps: { |
| | | format: 'YYYY-MM-DD', |
| | | showTime: false, |
| | | valueFormat: 'YYYY-MM-DD', |
| | | getPopupContainer |
| | | }, |
| | | fieldName: 'startDate', |
| | | label: 'å¼å§æ¥æ' |
| | | }, |
| | | { |
| | | component: 'DatePicker', |
| | | componentProps: { |
| | | format: 'YYYY-MM-DD', |
| | | showTime: false, |
| | | valueFormat: 'YYYY-MM-DD', |
| | | getPopupContainer |
| | | }, |
| | | fieldName: 'endDate', |
| | | label: 'ç»ææ¥æ' |
| | | }, |
| | | { |
| | | component: 'TreeSelect', |
| | | // å¨draweréæ´æ° è¿éä¸éè¦é»è®¤çcomponentProps |
| | | defaultValue: undefined, |
| | | fieldName: 'userDept', |
| | | label: 'çç¹äººé¨é¨', |
| | | help: `çç¹æä½äººåæå±é¨é¨` |
| | | // rules: 'selectRequired', |
| | | }, |
| | | { |
| | | component: 'Select', |
| | | componentProps: { |
| | | showSearch: true, |
| | | allowClear: true, |
| | | getPopupContainer |
| | | }, |
| | | fieldName: 'inventoryUser', |
| | | label: 'çç¹äºº' |
| | | } |
| | | ]; |
¶Ô±ÈÐÂÎļþ |
| | |
| | | <script setup lang="ts"> |
| | | import type { Recordable } from '@vben/types'; |
| | | |
| | | import { onMounted } from 'vue'; |
| | | import { useRouter } from 'vue-router'; |
| | | |
| | | import { Page, useVbenDrawer, type VbenFormProps } from '@vben/common-ui'; |
| | | import { $t } from '@vben/locales'; |
| | | import { addFullName, getPopupContainer, getVxePopupContainer } from '@vben/utils'; |
| | | |
| | | import { Modal, Popconfirm, Space } from 'ant-design-vue'; |
| | | |
| | | import { useVbenVxeGrid, vxeCheckboxChecked, type VxeGridProps, vxeSortEvent } from '#/adapter/vxe-table'; |
| | | import { delInventory, inventoryExport, listInventory } from '#/api/eims/inventory'; |
| | | import { getDeptTree, userList } from '#/api/system/user'; |
| | | import { commonDownloadExcel } from '#/utils/file/download'; |
| | | |
| | | import { columns, querySchema } from './data'; |
| | | import inventoryDrawer from './inventory-drawer.vue'; |
| | | |
| | | 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', |
| | | // æ¥æéæ©æ ¼å¼å |
| | | fieldMappingTime: [['startDate', ['params[beginStartDate]', 'params[endStartDate]'], ['YYYY-MM-DD', 'YYYY-MM-DD']]] |
| | | }; |
| | | |
| | | const gridOptions: VxeGridProps = { |
| | | checkboxConfig: { |
| | | // é«äº® |
| | | highlight: true, |
| | | // 翻页æ¶ä¿çéä¸ç¶æ |
| | | reserve: true |
| | | // ç¹å»è¡éä¸ |
| | | // trigger: 'row' |
| | | }, |
| | | columns, |
| | | height: 'auto', |
| | | keepSource: true, |
| | | pagerConfig: {}, |
| | | proxyConfig: { |
| | | ajax: { |
| | | query: async ({ page }, formValues = {}) => { |
| | | return await listInventory({ |
| | | pageNum: page.currentPage, |
| | | pageSize: page.pageSize, |
| | | ...formValues |
| | | }); |
| | | } |
| | | } |
| | | }, |
| | | rowConfig: { |
| | | isHover: true, |
| | | keyField: 'inventoryId' |
| | | }, |
| | | sortConfig: { |
| | | // è¿ç¨æåº |
| | | remote: true, |
| | | // æ¯æå¤å段æåº é»è®¤å
³é |
| | | multiple: true |
| | | }, |
| | | id: 'eims-inventory-index' |
| | | }; |
| | | |
| | | const [BasicTable, tableApi] = useVbenVxeGrid({ |
| | | formOptions, |
| | | gridOptions, |
| | | gridEvents: { |
| | | sortChange: (sortParams) => vxeSortEvent(tableApi, sortParams) |
| | | } |
| | | }); |
| | | |
| | | const [InventoryDrawer, inventoryDrawerApi] = useVbenDrawer({ |
| | | connectedComponent: inventoryDrawer |
| | | }); |
| | | |
| | | function handleAdd() { |
| | | inventoryDrawerApi.setData({}); |
| | | inventoryDrawerApi.open(); |
| | | } |
| | | |
| | | async function handleEdit(record: Recordable<any>) { |
| | | inventoryDrawerApi.setData({ id: record.inventoryId }); |
| | | inventoryDrawerApi.open(); |
| | | } |
| | | |
| | | async function handleDelete(row: Recordable<any>) { |
| | | await delInventory(row.inventoryId); |
| | | await tableApi.query(); |
| | | } |
| | | |
| | | function handleMultiDelete() { |
| | | const rows = tableApi.grid.getCheckboxRecords(); |
| | | const ids = rows.map((row: any) => row.inventoryId); |
| | | Modal.confirm({ |
| | | title: 'æç¤º', |
| | | okType: 'danger', |
| | | content: `确认å é¤éä¸ç${ids.length}æ¡è®°å½åï¼`, |
| | | onOk: async () => { |
| | | await delInventory(ids); |
| | | await tableApi.query(); |
| | | } |
| | | }); |
| | | } |
| | | |
| | | function handleDownloadExcel() { |
| | | commonDownloadExcel(inventoryExport, '设å¤çç¹è®°å½', tableApi.formApi.form.values, { |
| | | fieldMappingTime: formOptions.fieldMappingTime |
| | | }); |
| | | } |
| | | |
| | | onMounted(async () => { |
| | | await setupDeptSelect(); |
| | | }); |
| | | |
| | | /** |
| | | * ç¨æ·çå è½½ |
| | | */ |
| | | async function setupUserOptions(deptId: any) { |
| | | const params = { deptId }; |
| | | const userPageResult = await userList({ |
| | | pageNum: 1, |
| | | pageSize: 500, |
| | | ...params |
| | | }); |
| | | const options = userPageResult.rows.map((item) => ({ |
| | | label: item.nickName || item.userName, |
| | | value: item.userId |
| | | })); |
| | | // çé |
| | | const filterOption = (input: string, option: any) => { |
| | | return option.label.toLowerCase().includes(input.toLowerCase()); |
| | | }; |
| | | |
| | | const placeholder = options.length > 0 ? 'è¯·éæ©' : '该é¨é¨ä¸ææ ç¨æ·'; |
| | | tableApi.formApi.updateSchema([ |
| | | { |
| | | componentProps: { options, placeholder, filterOption }, |
| | | fieldName: 'inventoryUser' |
| | | } |
| | | ]); |
| | | } |
| | | |
| | | /** |
| | | * åå§åé¨é¨éæ© |
| | | */ |
| | | async function setupDeptSelect() { |
| | | // updateSchema |
| | | const deptTree = await getDeptTree(); |
| | | // éä¸åæ¾ç¤ºå¨è¾å
¥æ¡çå¼ å³ç¶èç¹ / åèç¹ |
| | | addFullName(deptTree, 'label', ' / '); |
| | | tableApi.formApi.updateSchema([ |
| | | { |
| | | componentProps: (formModel) => ({ |
| | | class: 'w-full', |
| | | fieldNames: { |
| | | key: 'id', |
| | | value: 'id', |
| | | children: 'children' |
| | | }, |
| | | getPopupContainer, |
| | | async onSelect(deptId: number | string) { |
| | | /** æ ¹æ®é¨é¨IDå è½½ç¨æ· */ |
| | | await setupUserOptions(deptId); |
| | | /** åååéè¦éæ°éæ©ç¨æ· */ |
| | | formModel.respPerson = undefined; |
| | | }, |
| | | placeholder: 'è¯·éæ©', |
| | | showSearch: true, |
| | | treeData: deptTree, |
| | | treeDefaultExpandAll: true, |
| | | treeLine: { showLeafIcon: false }, |
| | | // çéçåæ®µ |
| | | treeNodeFilterProp: 'label', |
| | | // éä¸åæ¾ç¤ºå¨è¾å
¥æ¡çå¼ |
| | | treeNodeLabelProp: 'fullName' |
| | | }), |
| | | fieldName: 'userDept' |
| | | } |
| | | ]); |
| | | } |
| | | |
| | | const router = useRouter(); |
| | | function handleDetail(record: Recordable<any>) { |
| | | router.push(`/inventory/detail/${record.inventoryId}`); |
| | | } |
| | | |
| | | </script> |
| | | |
| | | <template> |
| | | <Page :auto-content-height="true"> |
| | | <div class="flex h-full gap-[8px]"> |
| | | <BasicTable class="flex-1 overflow-hidden" table-title="设å¤çç¹å表"> |
| | | <template #toolbar-tools> |
| | | <Space> |
| | | <a-button v-access:code="['eims:inventory:export']" @click="handleDownloadExcel"> |
| | | {{ $t('pages.common.export') }} |
| | | </a-button> |
| | | <a-button |
| | | :disabled="!vxeCheckboxChecked(tableApi)" |
| | | danger |
| | | type="primary" |
| | | v-access:code="['eims:inventory:remove']" |
| | | @click="handleMultiDelete" |
| | | > |
| | | {{ $t('pages.common.delete') }} |
| | | </a-button> |
| | | <a-button type="primary" v-access:code="['eims:inventory:add']" @click="handleAdd"> |
| | | {{ $t('pages.common.add') }} |
| | | </a-button> |
| | | </Space> |
| | | </template> |
| | | |
| | | <template #inventoryCode="{ row }"> |
| | | <Space> |
| | | <a-button type="link" @click="handleDetail(row)"> {{ row.inventoryCode }}</a-button> |
| | | </Space> |
| | | </template> |
| | | |
| | | <template #action="{ row }"> |
| | | <Space> |
| | | <ghost-button v-access:code="['eims:inventory: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="['eims:inventory:remove']" @click.stop=""> |
| | | {{ $t('pages.common.delete') }} |
| | | </ghost-button> |
| | | </Popconfirm> |
| | | </Space> |
| | | </template> |
| | | </BasicTable> |
| | | </div> |
| | | <InventoryDrawer @reload="tableApi.query()" /> |
| | | </Page> |
| | | </template> |
¶Ô±ÈÐÂÎļþ |
| | |
| | | <script setup lang="ts"> |
| | | import { computed, ref } from 'vue'; |
| | | |
| | | import { useVbenDrawer } from '@vben/common-ui'; |
| | | import { $t } from '@vben/locales'; |
| | | import { addFullName, cloneDeep, getPopupContainer, listToTree } from '@vben/utils'; |
| | | |
| | | import { useVbenForm } from '#/adapter/form'; |
| | | import { listEquType } from '#/api/eims/equ-type'; |
| | | import { addInventory, getInventory, updateInventory } from '#/api/eims/inventory'; |
| | | import { getDeptTree, userList } from '#/api/system/user'; |
| | | import { TreeSelectPanel } from '#/components/tree'; |
| | | |
| | | import { drawerSchema } 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', |
| | | componentProps: { |
| | | class: 'w-full' |
| | | }, |
| | | labelWidth: 120 |
| | | }, |
| | | schema: drawerSchema(), |
| | | showDefaultActions: false, |
| | | wrapperClass: 'grid-cols-2' |
| | | }); |
| | | |
| | | const [BasicDrawer, drawerApi] = useVbenDrawer({ |
| | | onCancel: handleCancel, |
| | | onConfirm: handleConfirm, |
| | | async onOpenChange(isOpen) { |
| | | if (!isOpen) { |
| | | return null; |
| | | } |
| | | drawerApi.drawerLoading(true); |
| | | const { id } = drawerApi.getData() as { id?: number | string }; |
| | | isUpdate.value = !!id; |
| | | // åå§å |
| | | await setupDeptSelect(); |
| | | await setupEquTypeSelect(); |
| | | |
| | | formApi.updateSchema([ |
| | | { |
| | | dependencies: { |
| | | show: () => !isUpdate.value, |
| | | triggerFields: [''] |
| | | }, |
| | | fieldName: 'equTypesList' |
| | | }, |
| | | { |
| | | dependencies: { |
| | | show: () => !isUpdate.value, |
| | | triggerFields: [''] |
| | | }, |
| | | fieldName: 'equStatusList' |
| | | } |
| | | ]); |
| | | // æ´æ° && èµå¼ |
| | | if (isUpdate.value && id) { |
| | | const record = await getInventory(id); |
| | | await formApi.setValues(record); |
| | | // æ´æ°æ¶ä¸å¯ä¿®æ¹çç¹èå´ |
| | | if (isUpdate.value && record.userDept) { |
| | | await setupUserOptions(record.userDept); |
| | | } |
| | | } |
| | | |
| | | drawerApi.drawerLoading(false); |
| | | } |
| | | }); |
| | | |
| | | /** |
| | | * å 载设å¤ç±»æ |
| | | */ |
| | | const equTypeTree = ref(); |
| | | async function setupEquTypeSelect() { |
| | | const result = (await listEquType()) || []; |
| | | // æå»ºç»ä»¶éè¦æ°æ® |
| | | const equArray = result.map((item) => { |
| | | return { |
| | | ...item, // ä¿çåæå¯¹è±¡çææå±æ§ |
| | | id: item.equTypeId, |
| | | label: item.typeName, |
| | | weight: item.orderNum |
| | | }; |
| | | }); |
| | | // support i18n |
| | | equArray.forEach((item) => { |
| | | item.typeName = $t(item.typeName); |
| | | }); |
| | | const equTree = listToTree(equArray, { id: 'id', pid: 'parentId' }); |
| | | equTypeTree.value = equTree; |
| | | } |
| | | |
| | | /** |
| | | * ç¨æ·çå è½½ |
| | | */ |
| | | async function setupUserOptions(deptId: any) { |
| | | const params = { deptId }; |
| | | const userPageResult = await userList({ |
| | | pageNum: 1, |
| | | pageSize: 500, |
| | | ...params |
| | | }); |
| | | const options = userPageResult.rows.map((item) => ({ |
| | | label: item.nickName || item.userName, |
| | | value: item.userId |
| | | })); |
| | | // çé |
| | | const filterOption = (input: string, option: any) => { |
| | | return option.label.toLowerCase().includes(input.toLowerCase()); |
| | | }; |
| | | |
| | | const placeholder = options.length > 0 ? 'è¯·éæ©' : '该é¨é¨ä¸ææ ç¨æ·'; |
| | | formApi.updateSchema([ |
| | | { |
| | | componentProps: { options, placeholder, filterOption }, |
| | | fieldName: 'inventoryUser' |
| | | } |
| | | ]); |
| | | } |
| | | |
| | | /** |
| | | * åå§åé¨é¨éæ© |
| | | */ |
| | | async function setupDeptSelect() { |
| | | // updateSchema |
| | | const deptTree = await getDeptTree(); |
| | | // éä¸åæ¾ç¤ºå¨è¾å
¥æ¡çå¼ å³ç¶èç¹ / åèç¹ |
| | | addFullName(deptTree, 'label', ' / '); |
| | | formApi.updateSchema([ |
| | | { |
| | | componentProps: (formModel) => ({ |
| | | class: 'w-full', |
| | | fieldNames: { |
| | | key: 'id', |
| | | value: 'id', |
| | | children: 'children' |
| | | }, |
| | | getPopupContainer, |
| | | async onSelect(deptId: number | string) { |
| | | /** æ ¹æ®é¨é¨IDå è½½ç¨æ· */ |
| | | await setupUserOptions(deptId); |
| | | /** åååéè¦éæ°éæ©ç¨æ· */ |
| | | formModel.respPerson = undefined; |
| | | }, |
| | | placeholder: 'è¯·éæ©', |
| | | showSearch: true, |
| | | treeData: deptTree, |
| | | treeDefaultExpandAll: true, |
| | | treeLine: { showLeafIcon: false }, |
| | | // çéçåæ®µ |
| | | treeNodeFilterProp: 'label', |
| | | // éä¸åæ¾ç¤ºå¨è¾å
¥æ¡çå¼ |
| | | treeNodeLabelProp: 'fullName' |
| | | }), |
| | | fieldName: 'userDept' |
| | | } |
| | | ]); |
| | | } |
| | | /** |
| | | * éè¿åè°æ´æ° æ æ³éè¿v-model |
| | | * @param value èåéæ©æ¯å¦ä¸¥æ ¼æ¨¡å¼ |
| | | */ |
| | | function handleCheckStrictlyChange(value: boolean) { |
| | | formApi.setFieldValue('checkStrictly', value); |
| | | } |
| | | |
| | | const equTypeSelectRef = ref(); |
| | | async function handleConfirm() { |
| | | try { |
| | | drawerApi.drawerLoading(true); |
| | | const { valid } = await formApi.validate(); |
| | | if (!valid) { |
| | | return; |
| | | } |
| | | // è¿ä¸ªç¨äºæäº¤ |
| | | const equTypes = equTypeSelectRef.value?.[0]?.getCheckedKeys() ?? []; |
| | | const data = cloneDeep(await formApi.getValues()); |
| | | data.equTypes = equTypes; |
| | | await (isUpdate.value ? updateInventory(data) : addInventory(data)); |
| | | emit('reload'); |
| | | await handleCancel(); |
| | | } catch (error) { |
| | | console.error(error); |
| | | } finally { |
| | | drawerApi.drawerLoading(false); |
| | | } |
| | | } |
| | | |
| | | async function handleCancel() { |
| | | drawerApi.close(); |
| | | await formApi.resetForm(); |
| | | } |
| | | </script> |
| | | |
| | | <template> |
| | | <BasicDrawer :close-on-click-modal="false" :title="title" class="w-[600px]"> |
| | | <BasicForm> |
| | | <template #equTypesList="slotProps"> |
| | | <!-- check-strictly为readonly ä¸è½éè¿v-modelç»å® --> |
| | | <TreeSelectPanel |
| | | ref="equTypeSelectRef" |
| | | :disabled="true" |
| | | v-bind="slotProps" |
| | | :check-strictly="formApi.form.values.checkStrictly" |
| | | :tree-data="equTypeTree" |
| | | @check-strictly-change="handleCheckStrictlyChange" |
| | | /> |
| | | </template> |
| | | </BasicForm> |
| | | </BasicDrawer> |
| | | </template> |
| | |
| | | export enum DictEnum { |
| | | EIMS_INVENTORY_STATU = 'inventory_statu', // 设å¤çç¹ç¶æ |
| | | EIMS_INVENTORY_DETAIL_STATU = 'inventory_detail_statu', // 设å¤çç¹ç¶æ |
| | | SYS_COMMON_STATUS = 'sys_common_status', |
| | | SYS_DEVICE_TYPE = 'sys_device_type', // 设å¤ç±»å |
| | | SYS_EQU_STATUS = 'sys_equ_status', // 设å¤ç¶æ |
| | |
| | | SYS_YES_NO = 'sys_yes_no', // æ¯å¦ |
| | | WF_BUSINESS_STATUS = 'wf_business_status', // ä¸å¡ç¶æ |
| | | |
| | | WF_FORM_TYPE = 'wf_form_type', // 表åç±»å |
| | | WF_FORM_TYPE = 'wf_form_type' // 表åç±»å |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package org.dromara.eims.controller; |
| | | |
| | | import java.util.List; |
| | | |
| | | import lombok.RequiredArgsConstructor; |
| | | import jakarta.servlet.http.HttpServletResponse; |
| | | import jakarta.validation.constraints.*; |
| | | import cn.dev33.satoken.annotation.SaCheckPermission; |
| | | import org.springframework.web.bind.annotation.*; |
| | | import org.springframework.validation.annotation.Validated; |
| | | import org.dromara.common.idempotent.annotation.RepeatSubmit; |
| | | import org.dromara.common.log.annotation.Log; |
| | | import org.dromara.common.web.core.BaseController; |
| | | import org.dromara.common.mybatis.core.page.PageQuery; |
| | | import org.dromara.common.core.domain.R; |
| | | import org.dromara.common.core.validate.AddGroup; |
| | | import org.dromara.common.core.validate.EditGroup; |
| | | import org.dromara.common.log.enums.BusinessType; |
| | | import org.dromara.common.excel.utils.ExcelUtil; |
| | | import org.dromara.eims.domain.vo.EimsInventoryVo; |
| | | import org.dromara.eims.domain.bo.EimsInventoryBo; |
| | | import org.dromara.eims.service.IEimsInventoryService; |
| | | import org.dromara.common.mybatis.core.page.TableDataInfo; |
| | | |
| | | /** |
| | | * çç¹ |
| | | * |
| | | * @author zhuguifei |
| | | * @date 2025-01-16 |
| | | */ |
| | | @Validated |
| | | @RequiredArgsConstructor |
| | | @RestController |
| | | @RequestMapping("/eims/inventory") |
| | | public class EimsInventoryController extends BaseController { |
| | | |
| | | private final IEimsInventoryService eimsInventoryService; |
| | | |
| | | /** |
| | | * æ¥è¯¢çç¹å表 |
| | | */ |
| | | @SaCheckPermission("eims:inventory:list") |
| | | @GetMapping("/list") |
| | | public TableDataInfo<EimsInventoryVo> list(EimsInventoryBo bo, PageQuery pageQuery) { |
| | | return eimsInventoryService.queryPageList(bo, pageQuery); |
| | | } |
| | | |
| | | /** |
| | | * 导åºçç¹å表 |
| | | */ |
| | | @SaCheckPermission("eims:inventory:export") |
| | | @Log(title = "çç¹", businessType = BusinessType.EXPORT) |
| | | @PostMapping("/export") |
| | | public void export(EimsInventoryBo bo, HttpServletResponse response) { |
| | | List<EimsInventoryVo> list = eimsInventoryService.queryList(bo); |
| | | ExcelUtil.exportExcel(list, "çç¹", EimsInventoryVo.class, response); |
| | | } |
| | | |
| | | /** |
| | | * è·åçç¹è¯¦ç»ä¿¡æ¯ |
| | | * |
| | | * @param inventoryId ä¸»é® |
| | | */ |
| | | @SaCheckPermission("eims:inventory:query") |
| | | @GetMapping("/{inventoryId}") |
| | | public R<EimsInventoryVo> getInfo(@NotNull(message = "主é®ä¸è½ä¸ºç©º") |
| | | @PathVariable Long inventoryId) { |
| | | return R.ok(eimsInventoryService.queryById(inventoryId)); |
| | | } |
| | | |
| | | /** |
| | | * æ°å¢çç¹ |
| | | */ |
| | | @SaCheckPermission("eims:inventory:add") |
| | | @Log(title = "çç¹", businessType = BusinessType.INSERT) |
| | | @RepeatSubmit() |
| | | @PostMapping() |
| | | public R<Void> add(@Validated(AddGroup.class) @RequestBody EimsInventoryBo bo) { |
| | | return toAjax(eimsInventoryService.insertByBo(bo)); |
| | | } |
| | | |
| | | /** |
| | | * ä¿®æ¹çç¹ |
| | | */ |
| | | @SaCheckPermission("eims:inventory:edit") |
| | | @Log(title = "çç¹", businessType = BusinessType.UPDATE) |
| | | @RepeatSubmit() |
| | | @PutMapping() |
| | | public R<Void> edit(@Validated(EditGroup.class) @RequestBody EimsInventoryBo bo) { |
| | | return toAjax(eimsInventoryService.updateByBo(bo)); |
| | | } |
| | | |
| | | /** |
| | | * å é¤çç¹ |
| | | * |
| | | * @param inventoryIds 主é®ä¸² |
| | | */ |
| | | @SaCheckPermission("eims:inventory:remove") |
| | | @Log(title = "çç¹", businessType = BusinessType.DELETE) |
| | | @DeleteMapping("/{inventoryIds}") |
| | | public R<Void> remove(@NotEmpty(message = "主é®ä¸è½ä¸ºç©º") |
| | | @PathVariable Long[] inventoryIds) { |
| | | return toAjax(eimsInventoryService.deleteWithValidByIds(List.of(inventoryIds), true)); |
| | | } |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package org.dromara.eims.controller; |
| | | |
| | | import java.util.List; |
| | | |
| | | import lombok.RequiredArgsConstructor; |
| | | import jakarta.servlet.http.HttpServletResponse; |
| | | import jakarta.validation.constraints.*; |
| | | import cn.dev33.satoken.annotation.SaCheckPermission; |
| | | import org.springframework.web.bind.annotation.*; |
| | | import org.springframework.validation.annotation.Validated; |
| | | import org.dromara.common.idempotent.annotation.RepeatSubmit; |
| | | import org.dromara.common.log.annotation.Log; |
| | | import org.dromara.common.web.core.BaseController; |
| | | import org.dromara.common.mybatis.core.page.PageQuery; |
| | | import org.dromara.common.core.domain.R; |
| | | import org.dromara.common.core.validate.AddGroup; |
| | | import org.dromara.common.core.validate.EditGroup; |
| | | import org.dromara.common.log.enums.BusinessType; |
| | | import org.dromara.common.excel.utils.ExcelUtil; |
| | | import org.dromara.eims.domain.vo.EimsInventoryDetailVo; |
| | | import org.dromara.eims.domain.bo.EimsInventoryDetailBo; |
| | | import org.dromara.eims.service.IEimsInventoryDetailService; |
| | | import org.dromara.common.mybatis.core.page.TableDataInfo; |
| | | |
| | | /** |
| | | * çç¹æç» |
| | | * |
| | | * @author zhuguifei |
| | | * @date 2025-02-06 |
| | | */ |
| | | @Validated |
| | | @RequiredArgsConstructor |
| | | @RestController |
| | | @RequestMapping("/eims/inventoryDetail") |
| | | public class EimsInventoryDetailController extends BaseController { |
| | | |
| | | private final IEimsInventoryDetailService eimsInventoryDetailService; |
| | | |
| | | /** |
| | | * æ¥è¯¢çç¹æç»å表 |
| | | */ |
| | | @SaCheckPermission("eims:inventoryDetail:list") |
| | | @GetMapping("/list") |
| | | public TableDataInfo<EimsInventoryDetailVo> list(EimsInventoryDetailBo bo, PageQuery pageQuery) { |
| | | //return eimsInventoryDetailService.queryPageList(bo, pageQuery); |
| | | return eimsInventoryDetailService.queryPageListCustom(bo, pageQuery); |
| | | } |
| | | |
| | | /** |
| | | * 导åºçç¹æç»å表 |
| | | */ |
| | | @SaCheckPermission("eims:inventoryDetail:export") |
| | | @Log(title = "çç¹æç»", businessType = BusinessType.EXPORT) |
| | | @PostMapping("/export") |
| | | public void export(EimsInventoryDetailBo bo, HttpServletResponse response) { |
| | | List<EimsInventoryDetailVo> list = eimsInventoryDetailService.queryList(bo); |
| | | ExcelUtil.exportExcel(list, "çç¹æç»", EimsInventoryDetailVo.class, response); |
| | | } |
| | | |
| | | /** |
| | | * è·åçç¹æç»è¯¦ç»ä¿¡æ¯ |
| | | * |
| | | * @param id ä¸»é® |
| | | */ |
| | | @SaCheckPermission("eims:inventoryDetail:query") |
| | | @GetMapping("/{id}") |
| | | public R<EimsInventoryDetailVo> getInfo(@NotNull(message = "主é®ä¸è½ä¸ºç©º") |
| | | @PathVariable Long id) { |
| | | return R.ok(eimsInventoryDetailService.queryById(id)); |
| | | } |
| | | |
| | | /** |
| | | * æ°å¢çç¹æç» |
| | | */ |
| | | @SaCheckPermission("eims:inventoryDetail:add") |
| | | @Log(title = "çç¹æç»", businessType = BusinessType.INSERT) |
| | | @RepeatSubmit() |
| | | @PostMapping() |
| | | public R<Void> add(@Validated(AddGroup.class) @RequestBody EimsInventoryDetailBo bo) { |
| | | return toAjax(eimsInventoryDetailService.insertByBo(bo)); |
| | | } |
| | | |
| | | /** |
| | | * ä¿®æ¹çç¹æç» |
| | | */ |
| | | @SaCheckPermission("eims:inventoryDetail:edit") |
| | | @Log(title = "çç¹æç»", businessType = BusinessType.UPDATE) |
| | | @RepeatSubmit() |
| | | @PutMapping() |
| | | public R<Void> edit(@Validated(EditGroup.class) @RequestBody EimsInventoryDetailBo bo) { |
| | | return toAjax(eimsInventoryDetailService.updateByBo(bo)); |
| | | } |
| | | |
| | | /** |
| | | * å é¤çç¹æç» |
| | | * |
| | | * @param ids 主é®ä¸² |
| | | */ |
| | | @SaCheckPermission("eims:inventoryDetail:remove") |
| | | @Log(title = "çç¹æç»", businessType = BusinessType.DELETE) |
| | | @DeleteMapping("/{ids}") |
| | | public R<Void> remove(@NotEmpty(message = "主é®ä¸è½ä¸ºç©º") |
| | | @PathVariable Long[] ids) { |
| | | return toAjax(eimsInventoryDetailService.deleteWithValidByIds(List.of(ids), true)); |
| | | } |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package org.dromara.eims.domain; |
| | | |
| | | import org.dromara.common.mybatis.core.domain.BaseEntity; |
| | | import com.baomidou.mybatisplus.annotation.*; |
| | | import lombok.Data; |
| | | import lombok.EqualsAndHashCode; |
| | | import java.util.Date; |
| | | import com.fasterxml.jackson.annotation.JsonFormat; |
| | | |
| | | import java.io.Serial; |
| | | |
| | | /** |
| | | * çç¹å¯¹è±¡ eims_inventory |
| | | * |
| | | * @author zhuguifei |
| | | * @date 2025-01-16 |
| | | */ |
| | | @Data |
| | | @EqualsAndHashCode(callSuper = true) |
| | | @TableName("eims_inventory") |
| | | public class EimsInventory extends BaseEntity { |
| | | |
| | | @Serial |
| | | private static final long serialVersionUID = 1L; |
| | | |
| | | /** |
| | | * çç¹id |
| | | */ |
| | | @TableId(value = "inventory_id") |
| | | private Long inventoryId; |
| | | |
| | | /** |
| | | * çç¹åå· |
| | | */ |
| | | private String inventoryCode; |
| | | |
| | | /** |
| | | * çç¹åç§° |
| | | */ |
| | | private String inventoryName; |
| | | /** |
| | | * çç¹èå´-设å¤ç±»åï¼è®¾å¤ç±»åid-éå·éå¼ï¼ |
| | | */ |
| | | private String equTypes; |
| | | /** |
| | | * çç¹èå´-设å¤ç¶æï¼è®¾å¤ç¶æ-åå
¸ï¼ |
| | | */ |
| | | private String equStatus; |
| | | |
| | | /** |
| | | * çç¹äºº |
| | | */ |
| | | private Long inventoryUser; |
| | | |
| | | /** |
| | | * çç¹äººé¨é¨ |
| | | */ |
| | | private Long userDept; |
| | | |
| | | /** |
| | | * å¼å§æ¥æ |
| | | */ |
| | | @JsonFormat(pattern = "yyyy-MM-dd") |
| | | private Date startDate; |
| | | |
| | | /** |
| | | * ç»ææ¥æ |
| | | */ |
| | | @JsonFormat(pattern = "yyyy-MM-dd") |
| | | private Date endDate; |
| | | |
| | | /** |
| | | * çç¹ç¶æ |
| | | */ |
| | | private String status; |
| | | |
| | | /** |
| | | * 夿³¨ |
| | | */ |
| | | private String remark; |
| | | |
| | | |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package org.dromara.eims.domain; |
| | | |
| | | import org.dromara.common.mybatis.core.domain.BaseEntity; |
| | | import com.baomidou.mybatisplus.annotation.*; |
| | | import lombok.Data; |
| | | import lombok.EqualsAndHashCode; |
| | | |
| | | import java.io.Serial; |
| | | |
| | | /** |
| | | * çç¹æç»å¯¹è±¡ eims_inventory_detail |
| | | * |
| | | * @author zhuguifei |
| | | * @date 2025-02-06 |
| | | */ |
| | | @Data |
| | | @EqualsAndHashCode(callSuper = true) |
| | | @TableName("eims_inventory_detail") |
| | | public class EimsInventoryDetail extends BaseEntity { |
| | | |
| | | @Serial |
| | | private static final long serialVersionUID = 1L; |
| | | |
| | | /** |
| | | * |
| | | */ |
| | | @TableId(value = "id") |
| | | private Long id; |
| | | |
| | | /** |
| | | * çç¹id |
| | | */ |
| | | private Long inventoryId; |
| | | |
| | | /** |
| | | * 设å¤id |
| | | */ |
| | | private Long equId; |
| | | |
| | | /** |
| | | * çç¹ç»æ |
| | | */ |
| | | private String status; |
| | | |
| | | /** |
| | | * 夿³¨ |
| | | */ |
| | | private String remark; |
| | | |
| | | |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package org.dromara.eims.domain.bo; |
| | | |
| | | import com.alibaba.excel.annotation.ExcelProperty; |
| | | import com.fasterxml.jackson.annotation.JsonFormat; |
| | | import org.dromara.common.mybatis.core.domain.BaseEntity; |
| | | import org.dromara.common.core.validate.AddGroup; |
| | | import org.dromara.common.core.validate.EditGroup; |
| | | import io.github.linpeilie.annotations.AutoMapper; |
| | | import lombok.Data; |
| | | import lombok.EqualsAndHashCode; |
| | | import jakarta.validation.constraints.*; |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | |
| | | import org.dromara.eims.domain.EimsInventory; |
| | | |
| | | /** |
| | | * çç¹ä¸å¡å¯¹è±¡ eims_inventory |
| | | * |
| | | * @author zhuguifei |
| | | * @date 2025-01-16 |
| | | */ |
| | | @Data |
| | | @EqualsAndHashCode(callSuper = true) |
| | | @AutoMapper(target = EimsInventory.class, reverseConvertGenerate = false) |
| | | public class EimsInventoryBo extends BaseEntity { |
| | | |
| | | /** |
| | | * çç¹id |
| | | */ |
| | | @NotNull(message = "çç¹idä¸è½ä¸ºç©º", groups = { EditGroup.class }) |
| | | private Long inventoryId; |
| | | |
| | | /** |
| | | * çç¹åå· |
| | | */ |
| | | @NotBlank(message = "çç¹åå·ä¸è½ä¸ºç©º", groups = { AddGroup.class, EditGroup.class }) |
| | | private String inventoryCode; |
| | | |
| | | /** |
| | | * çç¹åç§° |
| | | */ |
| | | @NotBlank(message = "çç¹åç§°ä¸è½ä¸ºç©º", groups = { AddGroup.class, EditGroup.class }) |
| | | private String inventoryName; |
| | | /** |
| | | * çç¹èå´-设å¤ç±»åï¼è®¾å¤ç±»åid-éå·éå¼ï¼ |
| | | */ |
| | | private List<String> equTypesList; |
| | | /** |
| | | * çç¹èå´-设å¤ç¶æï¼è®¾å¤ç¶æ-åå
¸ï¼ |
| | | */ |
| | | private List<String> equStatusList; |
| | | |
| | | /** |
| | | * çç¹äºº |
| | | */ |
| | | @NotNull(message = "çç¹äººä¸è½ä¸ºç©º", groups = { AddGroup.class, EditGroup.class }) |
| | | private Long inventoryUser; |
| | | |
| | | |
| | | /** |
| | | * çç¹äººé¨é¨ |
| | | */ |
| | | private Long userDept; |
| | | |
| | | /** |
| | | * å¼å§æ¥æ |
| | | */ |
| | | @NotNull(message = "å¼å§æ¥æä¸è½ä¸ºç©º", groups = { AddGroup.class, EditGroup.class }) |
| | | @JsonFormat(pattern = "yyyy-MM-dd") |
| | | private Date startDate; |
| | | |
| | | /** |
| | | * ç»ææ¥æ |
| | | */ |
| | | @NotNull(message = "ç»ææ¥æä¸è½ä¸ºç©º", groups = { AddGroup.class, EditGroup.class }) |
| | | @JsonFormat(pattern = "yyyy-MM-dd") |
| | | private Date endDate; |
| | | |
| | | /** |
| | | * çç¹ç¶æ |
| | | */ |
| | | private String status; |
| | | |
| | | /** |
| | | * 夿³¨ |
| | | */ |
| | | private String remark; |
| | | |
| | | |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package org.dromara.eims.domain.bo; |
| | | |
| | | import org.dromara.eims.domain.EimsInventoryDetail; |
| | | import org.dromara.common.mybatis.core.domain.BaseEntity; |
| | | import org.dromara.common.core.validate.AddGroup; |
| | | import org.dromara.common.core.validate.EditGroup; |
| | | import io.github.linpeilie.annotations.AutoMapper; |
| | | import lombok.Data; |
| | | import lombok.EqualsAndHashCode; |
| | | import jakarta.validation.constraints.*; |
| | | |
| | | /** |
| | | * çç¹æç»ä¸å¡å¯¹è±¡ eims_inventory_detail |
| | | * |
| | | * @author zhuguifei |
| | | * @date 2025-02-06 |
| | | */ |
| | | @Data |
| | | @EqualsAndHashCode(callSuper = true) |
| | | @AutoMapper(target = EimsInventoryDetail.class, reverseConvertGenerate = false) |
| | | public class EimsInventoryDetailBo extends BaseEntity { |
| | | |
| | | /** |
| | | * |
| | | */ |
| | | @NotNull(message = "ä¸è½ä¸ºç©º", groups = { EditGroup.class }) |
| | | private Long id; |
| | | |
| | | /** |
| | | * çç¹id |
| | | */ |
| | | @NotNull(message = "çç¹idä¸è½ä¸ºç©º", groups = { AddGroup.class, EditGroup.class }) |
| | | private Long inventoryId; |
| | | |
| | | /** |
| | | * 设å¤id |
| | | */ |
| | | @NotNull(message = "设å¤idä¸è½ä¸ºç©º", groups = { AddGroup.class, EditGroup.class }) |
| | | private Long equId; |
| | | |
| | | /** |
| | | * çç¹ç»æ |
| | | */ |
| | | @NotBlank(message = "çç¹ç»æä¸è½ä¸ºç©º", groups = { AddGroup.class, EditGroup.class }) |
| | | private String status; |
| | | |
| | | /** |
| | | * 夿³¨ |
| | | */ |
| | | private String remark; |
| | | |
| | | //设å¤åç§° |
| | | private String equName; |
| | | //设å¤ç¼ç |
| | | private String equCode; |
| | | //设å¤èµäº§ç¼å· |
| | | private String equAssetNo; |
| | | //é¨é¨åç§° |
| | | private String deptName; |
| | | //设å¤ç±»ååç§° |
| | | private String equTypeName; |
| | | //è®¾å¤æå¨ä½ç½® |
| | | private String location; |
| | | //设å¤ç¶æ |
| | | private String equStatus; |
| | | //çç¹äºº |
| | | private String inventoryUser; |
| | | |
| | | |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package org.dromara.eims.domain.vo; |
| | | |
| | | import org.dromara.eims.domain.EimsInventoryDetail; |
| | | import com.alibaba.excel.annotation.ExcelIgnoreUnannotated; |
| | | import com.alibaba.excel.annotation.ExcelProperty; |
| | | import org.dromara.common.excel.annotation.ExcelDictFormat; |
| | | import org.dromara.common.excel.convert.ExcelDictConvert; |
| | | import io.github.linpeilie.annotations.AutoMapper; |
| | | import lombok.Data; |
| | | |
| | | import java.io.Serial; |
| | | import java.io.Serializable; |
| | | import java.util.Date; |
| | | |
| | | |
| | | |
| | | /** |
| | | * çç¹æç»è§å¾å¯¹è±¡ eims_inventory_detail |
| | | * |
| | | * @author zhuguifei |
| | | * @date 2025-02-06 |
| | | */ |
| | | @Data |
| | | @ExcelIgnoreUnannotated |
| | | @AutoMapper(target = EimsInventoryDetail.class) |
| | | public class EimsInventoryDetailVo implements Serializable { |
| | | |
| | | @Serial |
| | | private static final long serialVersionUID = 1L; |
| | | |
| | | /** |
| | | * |
| | | */ |
| | | @ExcelProperty(value = "") |
| | | private Long id; |
| | | |
| | | /** |
| | | * çç¹id |
| | | */ |
| | | @ExcelProperty(value = "çç¹id") |
| | | private Long inventoryId; |
| | | |
| | | /** |
| | | * 设å¤id |
| | | */ |
| | | @ExcelProperty(value = "设å¤id") |
| | | private Long equId; |
| | | |
| | | /** |
| | | * çç¹ç»æ |
| | | */ |
| | | @ExcelProperty(value = "çç¹ç»æ") |
| | | private String status; |
| | | |
| | | /** |
| | | * 夿³¨ |
| | | */ |
| | | @ExcelProperty(value = "夿³¨") |
| | | private String remark; |
| | | //设å¤åç§° |
| | | private String equName; |
| | | //设å¤ç¼ç |
| | | private String equCode; |
| | | //设å¤èµäº§ç¼å· |
| | | private String equAssetNo; |
| | | //é¨é¨åç§° |
| | | private String deptName; |
| | | //设å¤ç±»ååç§° |
| | | private String equTypeName; |
| | | //è®¾å¤æå¨ä½ç½® |
| | | private String location; |
| | | //设å¤ç¶æ |
| | | private String equStatus; |
| | | //çç¹äºº |
| | | private String inventoryUser; |
| | | |
| | | |
| | | |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package org.dromara.eims.domain.vo; |
| | | |
| | | import java.util.Date; |
| | | import com.fasterxml.jackson.annotation.JsonFormat; |
| | | import com.alibaba.excel.annotation.ExcelIgnoreUnannotated; |
| | | import com.alibaba.excel.annotation.ExcelProperty; |
| | | import org.dromara.common.excel.annotation.ExcelDictFormat; |
| | | import org.dromara.common.excel.convert.ExcelDictConvert; |
| | | import io.github.linpeilie.annotations.AutoMapper; |
| | | import lombok.Data; |
| | | import org.dromara.common.translation.annotation.Translation; |
| | | import org.dromara.common.translation.constant.TransConstant; |
| | | import org.dromara.eims.domain.EimsInventory; |
| | | |
| | | import java.io.Serial; |
| | | import java.io.Serializable; |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | |
| | | |
| | | /** |
| | | * çç¹è§å¾å¯¹è±¡ eims_inventory |
| | | * |
| | | * @author zhuguifei |
| | | * @date 2025-01-16 |
| | | */ |
| | | @Data |
| | | @ExcelIgnoreUnannotated |
| | | @AutoMapper(target = EimsInventory.class) |
| | | public class EimsInventoryVo implements Serializable { |
| | | |
| | | @Serial |
| | | private static final long serialVersionUID = 1L; |
| | | |
| | | /** |
| | | * çç¹id |
| | | */ |
| | | @ExcelProperty(value = "çç¹id") |
| | | private Long inventoryId; |
| | | |
| | | /** |
| | | * çç¹åå· |
| | | */ |
| | | @ExcelProperty(value = "çç¹åå·") |
| | | private String inventoryCode; |
| | | |
| | | /** |
| | | * çç¹åç§° |
| | | */ |
| | | @ExcelProperty(value = "çç¹åç§°") |
| | | private String inventoryName; |
| | | /** |
| | | * çç¹èå´-设å¤ç±»åï¼è®¾å¤ç±»åid-éå·éå¼ï¼ |
| | | */ |
| | | @ExcelProperty(value = "çç¹èå´-设å¤ç±»å") |
| | | private String equTypes; |
| | | /** |
| | | * çç¹èå´-设å¤ç¶æï¼è®¾å¤ç¶æ-åå
¸ï¼ |
| | | */ |
| | | @ExcelProperty(value = "çç¹èå´-设å¤ç¶æ") |
| | | private String equStatus; |
| | | /** |
| | | * çç¹èå´-设å¤ç±»åï¼è®¾å¤ç±»åid-éå·éå¼ï¼ |
| | | */ |
| | | private List<Long> equTypesList; |
| | | /** |
| | | * çç¹èå´-设å¤ç¶æï¼è®¾å¤ç¶æ-åå
¸ï¼ |
| | | */ |
| | | private List<String> equStatusList; |
| | | |
| | | /** |
| | | * çç¹äºº |
| | | */ |
| | | private Long inventoryUser; |
| | | |
| | | @ExcelProperty(value = "çç¹äºº") |
| | | @Translation(type = TransConstant.USER_ID_TO_NICKNAME, mapper = "inventoryUser") |
| | | private String inventoryUserName; |
| | | |
| | | /** |
| | | * çç¹äººé¨é¨ |
| | | */ |
| | | @ExcelProperty(value = "çç¹äººé¨é¨") |
| | | private Long userDept; |
| | | |
| | | /** |
| | | * å¼å§æ¥æ |
| | | */ |
| | | @ExcelProperty(value = "å¼å§æ¥æ") |
| | | @JsonFormat(pattern = "yyyy-MM-dd") |
| | | private Date startDate; |
| | | |
| | | /** |
| | | * ç»ææ¥æ |
| | | */ |
| | | @ExcelProperty(value = "ç»ææ¥æ") |
| | | @JsonFormat(pattern = "yyyy-MM-dd") |
| | | private Date endDate; |
| | | |
| | | /** |
| | | * çç¹ç¶æ |
| | | */ |
| | | @ExcelProperty(value = "çç¹ç¶æ") |
| | | private String status; |
| | | |
| | | /** |
| | | * 夿³¨ |
| | | */ |
| | | @ExcelProperty(value = "夿³¨") |
| | | private String remark; |
| | | |
| | | |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package org.dromara.eims.mapper; |
| | | |
| | | import com.baomidou.mybatisplus.core.conditions.Wrapper; |
| | | import com.baomidou.mybatisplus.core.toolkit.Constants; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import org.apache.ibatis.annotations.Param; |
| | | import org.dromara.eims.domain.EimsInventoryDetail; |
| | | import org.dromara.eims.domain.bo.EimsInventoryDetailBo; |
| | | import org.dromara.eims.domain.vo.EimsInventoryDetailVo; |
| | | import org.dromara.common.mybatis.core.mapper.BaseMapperPlus; |
| | | |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * çç¹æç»Mapperæ¥å£ |
| | | * |
| | | * @author zhuguifei |
| | | * @date 2025-02-06 |
| | | */ |
| | | public interface EimsInventoryDetailMapper extends BaseMapperPlus<EimsInventoryDetail, EimsInventoryDetailVo> { |
| | | Page<EimsInventoryDetailVo> selectInventoryDetailList(@Param("page") Page<EimsInventoryDetailVo> page, @Param(Constants.WRAPPER) Wrapper<EimsInventoryDetail> queryWrapper); |
| | | |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package org.dromara.eims.mapper; |
| | | |
| | | |
| | | import org.dromara.common.mybatis.core.mapper.BaseMapperPlus; |
| | | import org.dromara.eims.domain.EimsInventory; |
| | | import org.dromara.eims.domain.vo.EimsInventoryVo; |
| | | |
| | | /** |
| | | * çç¹Mapperæ¥å£ |
| | | * |
| | | * @author zhuguifei |
| | | * @date 2025-01-16 |
| | | */ |
| | | public interface EimsInventoryMapper extends BaseMapperPlus<EimsInventory, EimsInventoryVo> { |
| | | |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package org.dromara.eims.service; |
| | | |
| | | import org.dromara.eims.domain.vo.EimsInventoryDetailVo; |
| | | import org.dromara.eims.domain.bo.EimsInventoryDetailBo; |
| | | import org.dromara.common.mybatis.core.page.TableDataInfo; |
| | | import org.dromara.common.mybatis.core.page.PageQuery; |
| | | |
| | | import java.util.Collection; |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * çç¹æç»Serviceæ¥å£ |
| | | * |
| | | * @author zhuguifei |
| | | * @date 2025-02-06 |
| | | */ |
| | | public interface IEimsInventoryDetailService { |
| | | |
| | | /** |
| | | * æ¥è¯¢çç¹æç» |
| | | * |
| | | * @param id ä¸»é® |
| | | * @return çç¹æç» |
| | | */ |
| | | EimsInventoryDetailVo queryById(Long id); |
| | | |
| | | |
| | | /** |
| | | * å页æ¥è¯¢çç¹æç»å表-å¤è¡¨æ¥è¯¢ |
| | | * |
| | | * @param bo æ¥è¯¢æ¡ä»¶ |
| | | * @param pageQuery å页忰 |
| | | * @return çç¹æç»å页å表 |
| | | */ |
| | | TableDataInfo<EimsInventoryDetailVo> queryPageListCustom(EimsInventoryDetailBo bo, PageQuery pageQuery); |
| | | |
| | | /** |
| | | * æ¥è¯¢ç¬¦åæ¡ä»¶ççç¹æç»å表 |
| | | * |
| | | * @param bo æ¥è¯¢æ¡ä»¶ |
| | | * @return çç¹æç»å表 |
| | | */ |
| | | List<EimsInventoryDetailVo> queryList(EimsInventoryDetailBo bo); |
| | | |
| | | /** |
| | | * æ°å¢çç¹æç» |
| | | * |
| | | * @param bo çç¹æç» |
| | | * @return æ¯å¦æ°å¢æå |
| | | */ |
| | | Boolean insertByBo(EimsInventoryDetailBo bo); |
| | | |
| | | /** |
| | | * ä¿®æ¹çç¹æç» |
| | | * |
| | | * @param bo çç¹æç» |
| | | * @return æ¯å¦ä¿®æ¹æå |
| | | */ |
| | | Boolean updateByBo(EimsInventoryDetailBo bo); |
| | | |
| | | /** |
| | | * æ ¡éªå¹¶æ¹éå é¤çç¹æç»ä¿¡æ¯ |
| | | * |
| | | * @param ids å¾
å é¤ç主é®éå |
| | | * @param isValid æ¯å¦è¿è¡æææ§æ ¡éª |
| | | * @return æ¯å¦å 餿å |
| | | */ |
| | | Boolean deleteWithValidByIds(Collection<Long> ids, Boolean isValid); |
| | | |
| | | |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package org.dromara.eims.service; |
| | | import org.dromara.common.mybatis.core.page.TableDataInfo; |
| | | import org.dromara.common.mybatis.core.page.PageQuery; |
| | | import org.dromara.eims.domain.bo.EimsInventoryBo; |
| | | import org.dromara.eims.domain.vo.EimsInventoryVo; |
| | | |
| | | import java.util.Collection; |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * çç¹Serviceæ¥å£ |
| | | * |
| | | * @author zhuguifei |
| | | * @date 2025-01-16 |
| | | */ |
| | | public interface IEimsInventoryService { |
| | | |
| | | /** |
| | | * æ¥è¯¢çç¹ |
| | | * |
| | | * @param inventoryId ä¸»é® |
| | | * @return çç¹ |
| | | */ |
| | | EimsInventoryVo queryById(Long inventoryId); |
| | | |
| | | /** |
| | | * å页æ¥è¯¢çç¹å表 |
| | | * |
| | | * @param bo æ¥è¯¢æ¡ä»¶ |
| | | * @param pageQuery å页忰 |
| | | * @return çç¹å页å表 |
| | | */ |
| | | TableDataInfo<EimsInventoryVo> queryPageList(EimsInventoryBo bo, PageQuery pageQuery); |
| | | |
| | | /** |
| | | * æ¥è¯¢ç¬¦åæ¡ä»¶ççç¹å表 |
| | | * |
| | | * @param bo æ¥è¯¢æ¡ä»¶ |
| | | * @return çç¹å表 |
| | | */ |
| | | List<EimsInventoryVo> queryList(EimsInventoryBo bo); |
| | | |
| | | /** |
| | | * æ°å¢çç¹ |
| | | * |
| | | * @param bo çç¹ |
| | | * @return æ¯å¦æ°å¢æå |
| | | */ |
| | | Boolean insertByBo(EimsInventoryBo bo); |
| | | |
| | | /** |
| | | * ä¿®æ¹çç¹ |
| | | * |
| | | * @param bo çç¹ |
| | | * @return æ¯å¦ä¿®æ¹æå |
| | | */ |
| | | Boolean updateByBo(EimsInventoryBo bo); |
| | | |
| | | /** |
| | | * æ ¡éªå¹¶æ¹éå é¤çç¹ä¿¡æ¯ |
| | | * |
| | | * @param ids å¾
å é¤ç主é®éå |
| | | * @param isValid æ¯å¦è¿è¡æææ§æ ¡éª |
| | | * @return æ¯å¦å 餿å |
| | | */ |
| | | Boolean deleteWithValidByIds(Collection<Long> ids, Boolean isValid); |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package org.dromara.eims.service.impl; |
| | | |
| | | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
| | | import org.dromara.common.core.utils.MapstructUtils; |
| | | import org.dromara.common.core.utils.StringUtils; |
| | | import org.dromara.common.mybatis.core.page.TableDataInfo; |
| | | import org.dromara.common.mybatis.core.page.PageQuery; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | | import com.baomidou.mybatisplus.core.toolkit.Wrappers; |
| | | import lombok.RequiredArgsConstructor; |
| | | import org.springframework.stereotype.Service; |
| | | import org.dromara.eims.domain.bo.EimsInventoryDetailBo; |
| | | import org.dromara.eims.domain.vo.EimsInventoryDetailVo; |
| | | import org.dromara.eims.domain.EimsInventoryDetail; |
| | | import org.dromara.eims.mapper.EimsInventoryDetailMapper; |
| | | import org.dromara.eims.service.IEimsInventoryDetailService; |
| | | |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | import java.util.Collection; |
| | | |
| | | /** |
| | | * çç¹æç»Serviceä¸å¡å±å¤ç |
| | | * |
| | | * @author zhuguifei |
| | | * @date 2025-02-06 |
| | | */ |
| | | @RequiredArgsConstructor |
| | | @Service |
| | | public class EimsInventoryDetailServiceImpl implements IEimsInventoryDetailService { |
| | | |
| | | private final EimsInventoryDetailMapper baseMapper; |
| | | |
| | | /** |
| | | * æ¥è¯¢çç¹æç» |
| | | * |
| | | * @param id ä¸»é® |
| | | * @return çç¹æç» |
| | | */ |
| | | @Override |
| | | public EimsInventoryDetailVo queryById(Long id) { |
| | | return baseMapper.selectVoById(id); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * å页æ¥è¯¢çç¹æç»å表-å¤è¡¨æ¥è¯¢ |
| | | * |
| | | * @param bo æ¥è¯¢æ¡ä»¶ |
| | | * @param pageQuery å页忰 |
| | | * @return çç¹æç»å页å表 |
| | | */ |
| | | @Override |
| | | public TableDataInfo<EimsInventoryDetailVo> queryPageListCustom(EimsInventoryDetailBo bo, PageQuery pageQuery) { |
| | | //TODO ç¹æ®å¤ç-å¤è¡¨ååæ®µå¯¼è´é®é¢ |
| | | String orderByColumn = pageQuery.getOrderByColumn(); |
| | | if (StringUtils.isNotEmpty(orderByColumn) && orderByColumn.contains("status")) { |
| | | pageQuery.setOrderByColumn(orderByColumn.replace("status", "a.status")); |
| | | } |
| | | Page<EimsInventoryDetailVo> page = baseMapper.selectInventoryDetailList(pageQuery.build(), buildQueryWrapper(bo)); |
| | | return TableDataInfo.build(page); |
| | | } |
| | | |
| | | /** |
| | | * æ¥è¯¢ç¬¦åæ¡ä»¶ççç¹æç»å表 |
| | | * |
| | | * @param bo æ¥è¯¢æ¡ä»¶ |
| | | * @return çç¹æç»å表 |
| | | */ |
| | | @Override |
| | | public List<EimsInventoryDetailVo> queryList(EimsInventoryDetailBo bo) { |
| | | QueryWrapper<EimsInventoryDetail> qw = buildQueryWrapper(bo); |
| | | return baseMapper.selectVoList(qw); |
| | | } |
| | | |
| | | private QueryWrapper<EimsInventoryDetail> buildQueryWrapper(EimsInventoryDetailBo bo) { |
| | | Map<String, Object> params = bo.getParams(); |
| | | QueryWrapper<EimsInventoryDetail> qw = Wrappers.query(); |
| | | qw.eq(bo.getInventoryId() != null, "a.inventory_id", bo.getInventoryId()); |
| | | qw.eq(bo.getEquId() != null, "a.equ_id", bo.getEquId()); |
| | | qw.eq(StringUtils.isNotBlank(bo.getStatus()), "a.status", bo.getStatus()); |
| | | |
| | | qw.like(StringUtils.isNotBlank(bo.getEquName()), "c.equ_name", bo.getEquName()); |
| | | return qw; |
| | | } |
| | | |
| | | /** |
| | | * æ°å¢çç¹æç» |
| | | * |
| | | * @param bo çç¹æç» |
| | | * @return æ¯å¦æ°å¢æå |
| | | */ |
| | | @Override |
| | | public Boolean insertByBo(EimsInventoryDetailBo bo) { |
| | | EimsInventoryDetail add = MapstructUtils.convert(bo, EimsInventoryDetail.class); |
| | | validEntityBeforeSave(add); |
| | | boolean flag = baseMapper.insert(add) > 0; |
| | | if (flag) { |
| | | bo.setId(add.getId()); |
| | | } |
| | | return flag; |
| | | } |
| | | |
| | | /** |
| | | * ä¿®æ¹çç¹æç» |
| | | * |
| | | * @param bo çç¹æç» |
| | | * @return æ¯å¦ä¿®æ¹æå |
| | | */ |
| | | @Override |
| | | public Boolean updateByBo(EimsInventoryDetailBo bo) { |
| | | EimsInventoryDetail update = MapstructUtils.convert(bo, EimsInventoryDetail.class); |
| | | validEntityBeforeSave(update); |
| | | return baseMapper.updateById(update) > 0; |
| | | } |
| | | |
| | | /** |
| | | * ä¿ååçæ°æ®æ ¡éª |
| | | */ |
| | | private void validEntityBeforeSave(EimsInventoryDetail entity) { |
| | | //TODO åä¸äºæ°æ®æ ¡éª,å¦å¯ä¸çº¦æ |
| | | } |
| | | |
| | | /** |
| | | * æ ¡éªå¹¶æ¹éå é¤çç¹æç»ä¿¡æ¯ |
| | | * |
| | | * @param ids å¾
å é¤ç主é®éå |
| | | * @param isValid æ¯å¦è¿è¡æææ§æ ¡éª |
| | | * @return æ¯å¦å 餿å |
| | | */ |
| | | @Override |
| | | public Boolean deleteWithValidByIds(Collection<Long> ids, Boolean isValid) { |
| | | if (isValid) { |
| | | //TODO åä¸äºä¸å¡ä¸çæ ¡éª,夿æ¯å¦éè¦æ ¡éª |
| | | } |
| | | return baseMapper.deleteByIds(ids) > 0; |
| | | } |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package org.dromara.eims.service.impl; |
| | | |
| | | import cn.hutool.core.collection.CollUtil; |
| | | import cn.hutool.core.util.ObjectUtil; |
| | | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
| | | import org.dromara.common.core.utils.MapstructUtils; |
| | | import org.dromara.common.core.utils.StreamUtils; |
| | | import org.dromara.common.core.utils.StringUtils; |
| | | import org.dromara.common.mybatis.core.page.TableDataInfo; |
| | | import org.dromara.common.mybatis.core.page.PageQuery; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | | import com.baomidou.mybatisplus.core.toolkit.Wrappers; |
| | | import lombok.RequiredArgsConstructor; |
| | | import org.dromara.common.mybatis.helper.DataBaseHelper; |
| | | import org.dromara.eims.domain.EimsEqu; |
| | | import org.dromara.eims.domain.EimsEquType; |
| | | import org.dromara.eims.domain.EimsInventoryDetail; |
| | | import org.dromara.eims.mapper.EimsEquMapper; |
| | | import org.dromara.eims.mapper.EimsEquTypeMapper; |
| | | import org.dromara.eims.mapper.EimsInventoryDetailMapper; |
| | | import org.springframework.stereotype.Service; |
| | | import org.dromara.eims.domain.bo.EimsInventoryBo; |
| | | import org.dromara.eims.domain.vo.EimsInventoryVo; |
| | | import org.dromara.eims.domain.EimsInventory; |
| | | import org.dromara.eims.mapper.EimsInventoryMapper; |
| | | import org.dromara.eims.service.IEimsInventoryService; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | |
| | | import java.util.Arrays; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | import java.util.Collection; |
| | | import java.util.stream.Collectors; |
| | | |
| | | /** |
| | | * çç¹Serviceä¸å¡å±å¤ç |
| | | * |
| | | * @author zhuguifei |
| | | * @date 2025-01-16 |
| | | */ |
| | | @RequiredArgsConstructor |
| | | @Service |
| | | public class EimsInventoryServiceImpl implements IEimsInventoryService { |
| | | |
| | | private final EimsInventoryMapper baseMapper; |
| | | private final EimsInventoryDetailMapper detailMapper; |
| | | private final EimsEquTypeMapper equTypeMapper; |
| | | private final EimsEquMapper equMapper; |
| | | |
| | | |
| | | /** |
| | | * æ¥è¯¢çç¹ |
| | | * |
| | | * @param inventoryId ä¸»é® |
| | | * @return çç¹ |
| | | */ |
| | | @Override |
| | | public EimsInventoryVo queryById(Long inventoryId) { |
| | | EimsInventoryVo vo = baseMapper.selectVoById(inventoryId); |
| | | if (StringUtils.isNotEmpty(vo.getEquTypes())) { |
| | | List<Long> numberList = Arrays.stream(vo.getEquTypes().split(",")) |
| | | .map(Long::parseLong) |
| | | .toList(); |
| | | vo.setEquTypesList(numberList); |
| | | } |
| | | if (StringUtils.isNotEmpty(vo.getEquStatus())) { |
| | | List<String> list = Arrays.asList(vo.getEquStatus().split(",")); |
| | | vo.setEquStatusList(list); |
| | | } |
| | | return vo; |
| | | } |
| | | |
| | | /** |
| | | * å页æ¥è¯¢çç¹å表 |
| | | * |
| | | * @param bo æ¥è¯¢æ¡ä»¶ |
| | | * @param pageQuery å页忰 |
| | | * @return çç¹å页å表 |
| | | */ |
| | | @Override |
| | | public TableDataInfo<EimsInventoryVo> queryPageList(EimsInventoryBo bo, PageQuery pageQuery) { |
| | | LambdaQueryWrapper<EimsInventory> lqw = buildQueryWrapper(bo); |
| | | Page<EimsInventoryVo> result = baseMapper.selectVoPage(pageQuery.build(), lqw); |
| | | return TableDataInfo.build(result); |
| | | } |
| | | |
| | | /** |
| | | * æ¥è¯¢ç¬¦åæ¡ä»¶ççç¹å表 |
| | | * |
| | | * @param bo æ¥è¯¢æ¡ä»¶ |
| | | * @return çç¹å表 |
| | | */ |
| | | @Override |
| | | public List<EimsInventoryVo> queryList(EimsInventoryBo bo) { |
| | | LambdaQueryWrapper<EimsInventory> lqw = buildQueryWrapper(bo); |
| | | return baseMapper.selectVoList(lqw); |
| | | } |
| | | |
| | | private LambdaQueryWrapper<EimsInventory> buildQueryWrapper(EimsInventoryBo bo) { |
| | | Map<String, Object> params = bo.getParams(); |
| | | LambdaQueryWrapper<EimsInventory> lqw = Wrappers.lambdaQuery(); |
| | | lqw.like(StringUtils.isNotBlank(bo.getInventoryCode()), EimsInventory::getInventoryCode, bo.getInventoryCode()); |
| | | lqw.like(StringUtils.isNotBlank(bo.getInventoryName()), EimsInventory::getInventoryName, bo.getInventoryName()); |
| | | lqw.eq(bo.getInventoryUser() != null, EimsInventory::getInventoryUser, bo.getInventoryUser()); |
| | | lqw.between(params.get("beginStartDate") != null && params.get("endStartDate") != null, |
| | | EimsInventory::getStartDate, params.get("beginStartDate"), params.get("endStartDate")); |
| | | lqw.between(params.get("beginEndDate") != null && params.get("endEndDate") != null, |
| | | EimsInventory::getEndDate, params.get("beginEndDate"), params.get("endEndDate")); |
| | | lqw.eq(StringUtils.isNotBlank(bo.getStatus()), EimsInventory::getStatus, bo.getStatus()); |
| | | lqw.between(params.get("beginCreateBy") != null && params.get("endCreateBy") != null, |
| | | EimsInventory::getCreateBy, params.get("beginCreateBy"), params.get("endCreateBy")); |
| | | lqw.eq(bo.getUserDept() != null, EimsInventory::getUserDept, bo.getUserDept()); |
| | | lqw.eq(bo.getInventoryUser() != null, EimsInventory::getInventoryUser, bo.getInventoryUser()); |
| | | |
| | | return lqw; |
| | | } |
| | | |
| | | /** |
| | | * æ°å¢çç¹ |
| | | * |
| | | * @param bo çç¹ |
| | | * @return æ¯å¦æ°å¢æå |
| | | */ |
| | | @Override |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public Boolean insertByBo(EimsInventoryBo bo) { |
| | | EimsInventory add = MapstructUtils.convert(bo, EimsInventory.class); |
| | | List<String> equTypesList = bo.getEquTypesList(); |
| | | if (equTypesList != null && !equTypesList.isEmpty()) { |
| | | String result = String.join(",", equTypesList); |
| | | if (add != null) { |
| | | add.setEquTypes(result); |
| | | } |
| | | } |
| | | List<String> equStatusList = bo.getEquStatusList(); |
| | | if (equStatusList != null && !equStatusList.isEmpty()) { |
| | | String result = String.join(",", equStatusList); |
| | | if (add != null) { |
| | | add.setEquStatus(result); |
| | | } |
| | | } |
| | | validEntityBeforeSave(add); |
| | | boolean flag = baseMapper.insert(add) > 0; |
| | | if (flag) { |
| | | bo.setInventoryId(add.getInventoryId()); |
| | | } |
| | | |
| | | //1.æ¥è¯¢ç±»å䏿æè®¾å¤ |
| | | QueryWrapper<EimsEqu> equQueryWrapper = new QueryWrapper<>(); |
| | | equQueryWrapper.lambda().in(CollUtil.isNotEmpty(equTypesList), EimsEqu::getEquTypeId, equTypesList); |
| | | equQueryWrapper.lambda().in(CollUtil.isNotEmpty(equStatusList), EimsEqu::getStatus, equStatusList); |
| | | List<EimsEqu> equList = equMapper.selectList(equQueryWrapper); |
| | | |
| | | //2.æ°å¢çç¹æç» |
| | | for (EimsEqu equ : equList) { |
| | | EimsInventoryDetail detail = new EimsInventoryDetail(); |
| | | detail.setEquId(equ.getEquId()); |
| | | detail.setInventoryId(add.getInventoryId()); |
| | | //设置为æªçç¹ |
| | | detail.setStatus("0"); |
| | | detailMapper.insert(detail); |
| | | } |
| | | |
| | | |
| | | return flag; |
| | | } |
| | | |
| | | /** |
| | | * ä¿®æ¹çç¹ |
| | | * |
| | | * @param bo çç¹ |
| | | * @return æ¯å¦ä¿®æ¹æå |
| | | */ |
| | | @Override |
| | | public Boolean updateByBo(EimsInventoryBo bo) { |
| | | EimsInventory update = MapstructUtils.convert(bo, EimsInventory.class); |
| | | if (bo.getEquTypesList() != null && !bo.getEquTypesList().isEmpty()) { |
| | | String result = String.join(",", bo.getEquTypesList()); |
| | | if (update != null) { |
| | | update.setEquTypes(result); |
| | | } |
| | | } |
| | | if (bo.getEquStatusList() != null && !bo.getEquStatusList().isEmpty()) { |
| | | String result = String.join(",", bo.getEquStatusList()); |
| | | if (update != null) { |
| | | update.setEquStatus(result); |
| | | } |
| | | } |
| | | validEntityBeforeSave(update); |
| | | return baseMapper.updateById(update) > 0; |
| | | } |
| | | |
| | | /** |
| | | * ä¿ååçæ°æ®æ ¡éª |
| | | */ |
| | | private void validEntityBeforeSave(EimsInventory entity) { |
| | | //TODO åä¸äºæ°æ®æ ¡éª,å¦å¯ä¸çº¦æ |
| | | } |
| | | |
| | | /** |
| | | * æ ¡éªå¹¶æ¹éå é¤çç¹ä¿¡æ¯ |
| | | * |
| | | * @param ids å¾
å é¤ç主é®éå |
| | | * @param isValid æ¯å¦è¿è¡æææ§æ ¡éª |
| | | * @return æ¯å¦å 餿å |
| | | */ |
| | | @Override |
| | | public Boolean deleteWithValidByIds(Collection<Long> ids, Boolean isValid) { |
| | | if (isValid) { |
| | | //TODO åä¸äºä¸å¡ä¸çæ ¡éª,夿æ¯å¦éè¦æ ¡éª |
| | | } |
| | | return baseMapper.deleteByIds(ids) > 0; |
| | | } |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | <?xml version="1.0" encoding="UTF-8" ?> |
| | | <!DOCTYPE mapper |
| | | PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" |
| | | "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> |
| | | <mapper namespace="org.dromara.eims.mapper.EimsInventoryDetailMapper"> |
| | | <resultMap type="org.dromara.eims.domain.vo.EimsInventoryDetailVo" id="EimsInventoryDetailResult"> |
| | | </resultMap> |
| | | |
| | | <select id="selectInventoryDetailList" resultMap="EimsInventoryDetailResult"> |
| | | SELECT c.equ_code equCode, |
| | | c.equ_name equName, |
| | | c.asset_no equAssetNo, |
| | | e.dept_name deptName, |
| | | d.type_name equTypeName, |
| | | c.location location, |
| | | b.`status` inventoryStatus, |
| | | c.`status` equStatus, |
| | | d.`status` typeStatus, |
| | | b.inventory_user inventoryUser |
| | | FROM eims_inventory_detail a |
| | | JOIN eims_inventory b on a.inventory_id = b.inventory_id |
| | | JOIN eims_equ c on a.equ_id = c.equ_id |
| | | JOIN eims_equ_type d on c.equ_type_id = d.equ_type_id |
| | | JOIN sys_dept e on e.dept_id = c.dept_used |
| | | ${ew.getCustomSqlSegment} |
| | | </select> |
| | | |
| | | |
| | | </mapper> |
¶Ô±ÈÐÂÎļþ |
| | |
| | | <?xml version="1.0" encoding="UTF-8" ?> |
| | | <!DOCTYPE mapper |
| | | PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" |
| | | "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> |
| | | <mapper namespace="org.dromara.eims.mapper.EimsInventoryMapper"> |
| | | |
| | | </mapper> |