¶Ô±ÈÐÂÎļþ |
| | |
| | | import type { FixtureTypeTree, FixtureTypeVO } from './model'; |
| | | |
| | | import type { ID, IDS } from '#/api/common'; |
| | | |
| | | import { commonExport } from '#/api/helper'; |
| | | import { requestClient } from '#/api/request'; |
| | | |
| | | enum Api { |
| | | fixtureTypeExport = '/eims/fixtureType/export', |
| | | fixtureTypeList = '/eims/fixtureType/list', |
| | | fixtureTypeTree = '/eims/fixtureType/tree', |
| | | root = '/eims/fixtureType' |
| | | } |
| | | |
| | | /** |
| | | * æ¥è¯¢å·¥å
·ç±»åå表 |
| | | * @param query |
| | | * @returns {*} |
| | | */ |
| | | |
| | | export function listFixtureType(params?: any) { |
| | | return requestClient.get<FixtureTypeVO[]>(Api.fixtureTypeList, { params }); |
| | | } |
| | | |
| | | /** |
| | | * è·åå·¥å
·ç±»åæ |
| | | * @returns å·¥å
·æ æ°ç» |
| | | */ |
| | | export function getFixtureTypeTree() { |
| | | return requestClient.get<FixtureTypeTree[]>(Api.fixtureTypeTree); |
| | | } |
| | | |
| | | /** |
| | | * æ¥è¯¢å·¥å
·ç±»åè¯¦ç» |
| | | * @param fixTypeId |
| | | */ |
| | | export function getFixtureType(fixTypeId: ID) { |
| | | return requestClient.get<FixtureTypeVO>(`${Api.root}/${fixTypeId}`); |
| | | } |
| | | |
| | | /** |
| | | * æ°å¢å·¥å
፱Ȍ |
| | | * @param data |
| | | */ |
| | | export function addFixtureType(data: any) { |
| | | return requestClient.postWithMsg<void>(Api.root, data); |
| | | } |
| | | /** |
| | | * ä¿®æ¹å·¥å
፱Ȍ |
| | | * @param data |
| | | */ |
| | | export function updateFixtureType(data: any) { |
| | | return requestClient.putWithMsg<void>(Api.root, data); |
| | | } |
| | | |
| | | /** |
| | | * å é¤å·¥å
፱Ȍ |
| | | * @param fixTypeId |
| | | */ |
| | | export function delFixtureType(fixTypeId: IDS) { |
| | | return requestClient.deleteWithMsg<void>(`${Api.root}/${fixTypeId}`); |
| | | } |
| | | /** |
| | | * å¯¼åº |
| | | * @param |
| | | */ |
| | | export function fixtureTypeExport(data: any) { |
| | | return commonExport(Api.fixtureTypeExport, data); |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | export interface FixtureTypeVO { |
| | | /** |
| | | * ç±»åid |
| | | */ |
| | | id: number | string; |
| | | |
| | | /** |
| | | * ç±»ååç§° |
| | | */ |
| | | typeName: string; |
| | | |
| | | /** |
| | | * ç±»åç¼ç |
| | | */ |
| | | typeCode: string; |
| | | |
| | | /** |
| | | * ç¶id |
| | | */ |
| | | parentId: number | string; |
| | | |
| | | /** |
| | | * æ¾ç¤ºé¡ºåº |
| | | */ |
| | | orderNum: number; |
| | | |
| | | /** |
| | | * èåç±»åï¼Mç®å½ Cèå Fæé®ï¼ |
| | | */ |
| | | menuType: string; |
| | | |
| | | /** |
| | | * èå徿 |
| | | */ |
| | | icon: string; |
| | | |
| | | /** |
| | | * èåç¶æï¼0æ£å¸¸ 1åç¨ï¼ |
| | | */ |
| | | status: string; |
| | | |
| | | /** |
| | | * 夿³¨ |
| | | */ |
| | | remark: string; |
| | | |
| | | /** |
| | | * å对象 |
| | | */ |
| | | children: FixtureTypeVO[]; |
| | | } |
| | | |
| | | /** |
| | | * @description: 设å¤ç±»åæ |
| | | */ |
| | | export interface FixtureTypeTree { |
| | | id: number; |
| | | /** |
| | | * antdç»ä»¶å¿
é¡»è¦è¿ä¸ªå±æ§ å®é
æ¯æ²¡æè¿ä¸ªå±æ§ç |
| | | */ |
| | | key: string; |
| | | parentId: number; |
| | | label: string; |
| | | weight: number; |
| | | children?: FixtureTypeTree[]; |
| | | } |
| | | |
¶Ô±ÈÐÂÎļþ |
| | |
| | | import type { IDS, PageQuery, PageResult } from '#/api/common'; |
| | | import type { FixtureImportParam, FixtureVO } from '#/api/eims/fixture/model'; |
| | | |
| | | import { commonExport, ContentTypeEnum } from '#/api/helper'; |
| | | import { requestClient } from '#/api/request'; |
| | | |
| | | enum Api { |
| | | fixtureExport = '/eims/fixture/export', |
| | | fixtureImport = '/eims/fixture/importData', |
| | | fixtureImportTemplate = '/eims/fixture/importTemplate', |
| | | fixtureList = '/eims/fixture/list', |
| | | root = '/eims/fixture' |
| | | } |
| | | |
| | | /** |
| | | * æ¥è¯¢ãå·¥å
·å°è´¦ãå表 |
| | | * @param query |
| | | * @returns {*} |
| | | */ |
| | | |
| | | export function listFixture(params?: PageQuery) { |
| | | return requestClient.get<PageResult<FixtureVO>>(Api.fixtureList, { params }); |
| | | } |
| | | |
| | | /** |
| | | * æ¥è¯¢ãå·¥å
·å°è´¦ãè¯¦ç» |
| | | * @param fixId |
| | | */ |
| | | export function getFixture(fixId: any) { |
| | | return requestClient.get<FixtureVO>(`${Api.root}/${fixId}`); |
| | | } |
| | | |
| | | /** |
| | | * æ°å¢ãå·¥å
·å°è´¦ã |
| | | * @param data |
| | | */ |
| | | export function addFixture(data: any) { |
| | | return requestClient.postWithMsg<void>(Api.root, data); |
| | | } |
| | | |
| | | /** |
| | | * ä¿®æ¹ãå·¥å
·å°è´¦ã |
| | | * @param data |
| | | */ |
| | | export function updateFixture(data: any) { |
| | | return requestClient.putWithMsg<void>(Api.root, data); |
| | | } |
| | | |
| | | /** |
| | | * å é¤ãå·¥å
·å°è´¦ã |
| | | * @param fixIds |
| | | */ |
| | | export function delFixture(fixIds: IDS) { |
| | | return requestClient.deleteWithMsg<void>(`${Api.root}/${fixIds}`); |
| | | } |
| | | |
| | | /** |
| | | * 导åºãå·¥å
·å°è´¦ã |
| | | * @param data |
| | | */ |
| | | export function fixtureExport(data: any) { |
| | | return commonExport(Api.fixtureExport, data); |
| | | } |
| | | |
| | | /** |
| | | * ä»excel导å
¥è®¾å¤ |
| | | * @param data |
| | | * @returns void |
| | | */ |
| | | export function fixtureImportData(data: FixtureImportParam) { |
| | | return requestClient.post<{ code: number; msg: string }>(Api.fixtureImport, data, { |
| | | headers: { |
| | | 'Content-Type': ContentTypeEnum.FORM_DATA |
| | | }, |
| | | isTransformResponse: false |
| | | }); |
| | | } |
| | | |
| | | /** |
| | | * ä¸è½½å¯¼å
¥æ¨¡æ¿ |
| | | * @returns blob |
| | | */ |
| | | export function downloadImportTemplate() { |
| | | return requestClient.post<Blob>( |
| | | Api.fixtureImportTemplate, |
| | | {}, |
| | | { |
| | | isTransformResponse: false, |
| | | responseType: 'blob' |
| | | } |
| | | ); |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | export interface FixtureVO { |
| | | /** |
| | | * |
| | | */ |
| | | id: number | string; |
| | | |
| | | /** |
| | | * æ²»å
·ç¼ç |
| | | */ |
| | | fixtureCode: string; |
| | | |
| | | /** |
| | | * æ²»å
·åç§° |
| | | */ |
| | | fixtureName: string; |
| | | |
| | | /** |
| | | * æ²»å
·ï¼å·¥å
·ï¼ç±»å |
| | | */ |
| | | fixtureType: number; |
| | | |
| | | /** |
| | | * æ²»å
·æè¿° |
| | | */ |
| | | fixtureDesc: string; |
| | | |
| | | /** |
| | | * åç¨é¨é¨ |
| | | */ |
| | | borrowDept: number | string; |
| | | /** |
| | | * åç¨é¨é¨ |
| | | */ |
| | | borrowDeptName: string; |
| | | |
| | | /** |
| | | * åç¨äºº |
| | | */ |
| | | borrowUser: number | string; |
| | | /** |
| | | * åç¨äºº |
| | | */ |
| | | borrowUserName: string; |
| | | |
| | | /** |
| | | * ç¶æï¼åå
¸ï¼ |
| | | */ |
| | | status: string; |
| | | |
| | | /** |
| | | * èµäº§ç¼å· |
| | | */ |
| | | assetNo: string; |
| | | |
| | | /** |
| | | * åå· |
| | | */ |
| | | modelNo: string; |
| | | |
| | | /** |
| | | * è§æ ¼ |
| | | */ |
| | | specNo: string; |
| | | |
| | | /** |
| | | * å¶é å |
| | | */ |
| | | madeIn: string; |
| | | |
| | | /** |
| | | * éè´æ¥æ |
| | | */ |
| | | purchaseDate: string; |
| | | |
| | | /** |
| | | * ä½¿ç¨æ¥æ |
| | | */ |
| | | deployDate: string; |
| | | |
| | | /** |
| | | * 使ç¨å¹´é |
| | | */ |
| | | serviceLife: number; |
| | | |
| | | /** |
| | | * 夿³¨ |
| | | */ |
| | | remark: string; |
| | | } |
| | | |
| | | export interface FixtureForm extends BaseEntity { |
| | | /** |
| | | * |
| | | */ |
| | | id?: number | string; |
| | | |
| | | /** |
| | | * æ²»å
·ç¼ç |
| | | */ |
| | | fixtureCode?: string; |
| | | |
| | | /** |
| | | * æ²»å
·åç§° |
| | | */ |
| | | fixtureName?: string; |
| | | |
| | | /** |
| | | * æ²»å
·ï¼å·¥å
·ï¼ç±»å |
| | | */ |
| | | fixtureType?: number; |
| | | |
| | | /** |
| | | * æ²»å
·æè¿° |
| | | */ |
| | | fixtureDesc?: string; |
| | | |
| | | /** |
| | | * ç¶æï¼åå
¸ï¼ |
| | | */ |
| | | status?: string; |
| | | |
| | | /** |
| | | * èµäº§ç¼å· |
| | | */ |
| | | assetNo?: string; |
| | | |
| | | /** |
| | | * åå· |
| | | */ |
| | | modelNo?: string; |
| | | |
| | | /** |
| | | * è§æ ¼ |
| | | */ |
| | | specNo?: string; |
| | | |
| | | /** |
| | | * å¶é å |
| | | */ |
| | | madeIn?: string; |
| | | |
| | | /** |
| | | * éè´æ¥æ |
| | | */ |
| | | purchaseDate?: string; |
| | | |
| | | /** |
| | | * ä½¿ç¨æ¥æ |
| | | */ |
| | | deployDate?: string; |
| | | |
| | | /** |
| | | * 使ç¨å¹´é |
| | | */ |
| | | serviceLife?: number; |
| | | |
| | | /** |
| | | * 夿³¨ |
| | | */ |
| | | remark?: string; |
| | | } |
| | | |
| | | /** |
| | | * @description: 设å¤å¯¼å
¥ |
| | | * @param updateSupport æ¯å¦è¦çæ°æ® |
| | | * @param file excelæä»¶ |
| | | */ |
| | | export interface FixtureImportParam { |
| | | updateSupport: boolean; |
| | | file: Blob | File; |
| | | } |
| | | |
| | |
| | | |
| | | <template> |
| | | <Page :auto-content-height="true"> |
| | | <BasicTable table-title="èåå表" table-title-help="åå»å±å¼/æ¶èµ·åèå"> |
| | | <BasicTable table-title="设å¤ç±»åå表" table-title-help="åå»å±å¼/æ¶èµ·åèå"> |
| | | <template #toolbar-tools> |
| | | <Space> |
| | | <a-button @click="setExpandOrCollapse(false)"> |
| | |
| | | <div v-else class="mt-5"> |
| | | <Empty |
| | | :image="Empty.PRESENTED_IMAGE_SIMPLE" |
| | | description="æ é¨é¨æ°æ®" |
| | | description="æ 设å¤ç±»åæ°æ®" |
| | | /> |
| | | </div> |
| | | </div> |
| | |
| | | }); |
| | | } |
| | | |
| | | function getImportStatus(row: any) { |
| | | const importStatus = row.importStatus === null || row.importStatus; |
| | | return importStatus ? 'æªå¯¼å
¥' : '已导å
¥'; |
| | | } |
| | | |
| | | const router = useRouter(); |
| | | function handleDetail(record: Recordable<any>) { |
| | |
| | | </ghost-button> |
| | | </Popconfirm> |
| | | </Space> |
| | | </template> |
| | | |
| | | <template #importStatus="{ row }"> |
| | | <span>{{ getImportStatus(row) }}</span> |
| | | </template> |
| | | </BasicTable> |
| | | </div> |
¶Ô±ÈÐÂÎļþ |
| | |
| | | import type { VxeGridProps } from '#/adapter/vxe-table'; |
| | | |
| | | import { h } from 'vue'; |
| | | |
| | | import { DictEnum } from '@vben/constants'; |
| | | import { FolderIcon, MenuIcon, VbenIcon } from '@vben/icons'; |
| | | import { getPopupContainer } from '@vben/utils'; |
| | | |
| | | import { type FormSchemaGetter } from '#/adapter/form'; |
| | | import { getDictOptions } from '#/utils/dict'; |
| | | import { renderDict } from '#/utils/render'; |
| | | |
| | | export const querySchema: FormSchemaGetter = () => [ |
| | | { |
| | | component: 'Input', |
| | | fieldName: 'typeName', |
| | | label: 'ç±»ååç§° ' |
| | | }, |
| | | { |
| | | component: 'Select', |
| | | componentProps: { |
| | | getPopupContainer, |
| | | options: getDictOptions(DictEnum.SYS_NORMAL_DISABLE) |
| | | }, |
| | | fieldName: 'status', |
| | | label: 'ç±»åç¶æ ' |
| | | } |
| | | ]; |
| | | |
| | | // èåç±»åï¼Mç®å½ Cèå Fæé®ï¼ |
| | | export const fixtureTypeOptions = [ |
| | | { label: 'ç®å½', value: 'M' }, |
| | | { label: 'ç±»å', value: 'C' } |
| | | ]; |
| | | |
| | | export const yesNoOptions = [ |
| | | { label: 'æ¯', value: '0' }, |
| | | { label: 'å¦', value: '1' } |
| | | ]; |
| | | |
| | | // ï¼Mç®å½ Cèåï¼ |
| | | const menuTypes = { |
| | | M: { icon: FolderIcon, value: 'ç®å½' }, |
| | | C: { icon: MenuIcon, value: 'ç±»å' } |
| | | }; |
| | | export const columns: VxeGridProps['columns'] = [ |
| | | { |
| | | title: 'ç±»ååç§°', |
| | | field: 'typeName', |
| | | treeNode: true, |
| | | width: 200 |
| | | }, |
| | | { |
| | | title: 'ç±»åç¼ç ', |
| | | field: 'typeCode', |
| | | width: 200 |
| | | }, |
| | | { |
| | | title: '徿 ', |
| | | field: 'icon', |
| | | width: 80, |
| | | slots: { |
| | | default: ({ row }) => { |
| | | if (row?.icon === '#') { |
| | | return ''; |
| | | } |
| | | return ( |
| | | <span class={'flex justify-center'}> |
| | | <VbenIcon icon={row.icon} /> |
| | | </span> |
| | | ); |
| | | } |
| | | } |
| | | }, |
| | | { |
| | | title: 'æåº', |
| | | field: 'orderNum', |
| | | width: 120 |
| | | }, |
| | | { |
| | | title: 'èç¹ç±»å', |
| | | field: 'menuType', |
| | | width: 150, |
| | | slots: { |
| | | default: ({ row }) => { |
| | | const current = menuTypes[row.menuType as 'C' | 'M']; |
| | | if (!current) { |
| | | return 'æªç¥'; |
| | | } |
| | | return ( |
| | | <span class="flex items-center justify-center gap-1"> |
| | | {h(current.icon, { class: 'size-[18px]' })} |
| | | <span>{current.value}</span> |
| | | </span> |
| | | ); |
| | | } |
| | | } |
| | | }, |
| | | { |
| | | title: 'ç¶æ', |
| | | field: 'status', |
| | | width: 100, |
| | | slots: { |
| | | default: ({ row }) => { |
| | | return renderDict(row.status, DictEnum.SYS_NORMAL_DISABLE); |
| | | } |
| | | } |
| | | }, |
| | | { |
| | | title: 'å建æ¶é´', |
| | | field: 'createTime' |
| | | }, |
| | | { |
| | | field: 'action', |
| | | fixed: 'right', |
| | | slots: { default: 'action' }, |
| | | title: 'æä½', |
| | | width: 200 |
| | | } |
| | | ]; |
| | | |
| | | export const drawerSchema: FormSchemaGetter = () => [ |
| | | { |
| | | component: 'Input', |
| | | dependencies: { |
| | | show: () => false, |
| | | triggerFields: [''] |
| | | }, |
| | | fieldName: 'id' |
| | | }, |
| | | { |
| | | component: 'TreeSelect', |
| | | defaultValue: 0, |
| | | fieldName: 'parentId', |
| | | label: 'ä¸çº§èå', |
| | | rules: 'selectRequired' |
| | | }, |
| | | { |
| | | component: 'RadioGroup', |
| | | componentProps: { |
| | | buttonStyle: 'solid', |
| | | options: fixtureTypeOptions, |
| | | optionType: 'button' |
| | | }, |
| | | defaultValue: 'M', |
| | | dependencies: { |
| | | componentProps: (_, api) => { |
| | | // åæ¢æ¶æ¸
ç©ºæ ¡éª |
| | | // ç´æ¥æçæºç æ²¡ææ¸
ç©ºæ ¡éªçæ¹æ³ |
| | | Object.keys(api.errors.value).forEach((key) => { |
| | | api.setFieldError(key, undefined); |
| | | }); |
| | | return {}; |
| | | }, |
| | | triggerFields: ['menuType'] |
| | | }, |
| | | fieldName: 'menuType', |
| | | label: 'èç¹ç±»å' |
| | | }, |
| | | { |
| | | component: 'Input', |
| | | fieldName: 'typeName', |
| | | label: 'ç±»ååç§°', |
| | | rules: 'required' |
| | | }, |
| | | { |
| | | component: 'Input', |
| | | fieldName: 'typeCode', |
| | | label: 'ç±»åç¼ç ', |
| | | rules: 'required' |
| | | }, |
| | | { |
| | | component: 'InputNumber', |
| | | fieldName: 'orderNum', |
| | | help: 'æåº, æ°åè¶å°è¶é å', |
| | | label: 'æ¾ç¤ºæåº', |
| | | rules: 'required' |
| | | }, |
| | | { |
| | | component: 'RadioGroup', |
| | | componentProps: { |
| | | buttonStyle: 'solid', |
| | | options: getDictOptions(DictEnum.SYS_NORMAL_DISABLE), |
| | | optionType: 'button' |
| | | }, |
| | | defaultValue: '0', |
| | | dependencies: { |
| | | // ç±»åä¸ä¸ºæé®æ¶æ¾ç¤º |
| | | show: (values) => values.menuType !== 'F', |
| | | triggerFields: ['menuType'] |
| | | }, |
| | | fieldName: 'status', |
| | | help: 'åç¨åä¸ä¼åºç°å¨å表', |
| | | 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 { addFixtureType, getFixtureType, listFixtureType, updateFixtureType } from '#/api/eims/fixture-type'; |
| | | |
| | | import { drawerSchema } from './data'; |
| | | |
| | | interface ModalProps { |
| | | id?: number | string; |
| | | update: boolean; |
| | | } |
| | | |
| | | 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: { |
| | | componentProps: { |
| | | class: 'w-full' |
| | | }, |
| | | formItemClass: 'col-span-2', |
| | | labelWidth: 90 |
| | | }, |
| | | schema: drawerSchema(), |
| | | showDefaultActions: false, |
| | | wrapperClass: 'grid-cols-2' |
| | | }); |
| | | |
| | | async function setupFixtureTypeSelect() { |
| | | // menu |
| | | const menuArray = await listFixtureType({ status: '0' }); |
| | | // support i18n |
| | | menuArray.forEach((item) => { |
| | | item.typeName = $t(item.typeName); |
| | | }); |
| | | // const folderArray = menuArray.filter((item) => item.menuType === 'M'); |
| | | const menuTree = listToTree(menuArray, { id: 'id', pid: 'parentId' }); |
| | | const fullMenuTree = [ |
| | | { |
| | | id: 0, |
| | | typeName: $t('menu.root'), |
| | | children: menuTree |
| | | } |
| | | ]; |
| | | addFullName(fullMenuTree, 'typeName', ' / '); |
| | | formApi.updateSchema([ |
| | | { |
| | | componentProps: { |
| | | fieldNames: { |
| | | label: 'typeName', |
| | | value: 'id' |
| | | }, |
| | | getPopupContainer, |
| | | // è®¾ç½®å¼¹çªæ»å¨é«åº¦ é»è®¤256 |
| | | listHeight: 300, |
| | | showSearch: true, |
| | | treeData: fullMenuTree, |
| | | treeDefaultExpandAll: false, |
| | | // é»è®¤å±å¼çæ èç¹ |
| | | treeDefaultExpandedKeys: [0], |
| | | treeLine: { showLeafIcon: false }, |
| | | // çéçåæ®µ |
| | | treeNodeFilterProp: 'typeName', |
| | | treeNodeLabelProp: 'fullName' |
| | | }, |
| | | fieldName: 'parentId' |
| | | } |
| | | ]); |
| | | } |
| | | |
| | | const [BasicDrawer, drawerApi] = useVbenDrawer({ |
| | | onCancel: handleCancel, |
| | | onConfirm: handleConfirm, |
| | | async onOpenChange(isOpen) { |
| | | if (!isOpen) { |
| | | return null; |
| | | } |
| | | drawerApi.drawerLoading(true); |
| | | const { id, update } = drawerApi.getData() as ModalProps; |
| | | isUpdate.value = update; |
| | | |
| | | // å 载设å¤ç±»åæ éæ© |
| | | await setupFixtureTypeSelect(); |
| | | if (id) { |
| | | await formApi.setFieldValue('parentId', id); |
| | | if (update) { |
| | | const record = await getFixtureType(id); |
| | | await formApi.setValues(record); |
| | | } |
| | | } |
| | | drawerApi.drawerLoading(false); |
| | | } |
| | | }); |
| | | |
| | | async function handleConfirm() { |
| | | try { |
| | | drawerApi.drawerLoading(true); |
| | | const { valid } = await formApi.validate(); |
| | | if (!valid) { |
| | | return; |
| | | } |
| | | const data = cloneDeep(await formApi.getValues()); |
| | | await (isUpdate.value ? updateFixtureType(data) : addFixtureType(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 { Recordable } from '@vben/types'; |
| | | |
| | | import { Page, useVbenDrawer, type VbenFormProps } from '@vben/common-ui'; |
| | | import { $t } from '@vben/locales'; |
| | | import { eachTree, getVxePopupContainer } from '@vben/utils'; |
| | | |
| | | import { Popconfirm, Space } from 'ant-design-vue'; |
| | | |
| | | import { useVbenVxeGrid, type VxeGridProps } from '#/adapter/vxe-table'; |
| | | import { delFixtureType, fixtureTypeExport, listFixtureType } from '#/api/eims/fixture-type'; |
| | | import { commonDownloadExcel } from '#/utils/file/download'; |
| | | |
| | | import { columns, querySchema } from './data'; |
| | | import fixtureTypeDrawer from './fixture-type-drawer.vue'; |
| | | |
| | | /** |
| | | * ä¸è¦é®ä¸ºä»ä¹æä¸¤ä¸ªæ ¹èç¹ v-if伿§å¶åªä¼æ¸²æä¸ä¸ª |
| | | */ |
| | | |
| | | 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' |
| | | }; |
| | | |
| | | const gridOptions: VxeGridProps = { |
| | | columns, |
| | | height: 'auto', |
| | | keepSource: true, |
| | | pagerConfig: { |
| | | enabled: false |
| | | }, |
| | | proxyConfig: { |
| | | ajax: { |
| | | query: async (_, formValues = {}) => { |
| | | const resp = await listFixtureType({ |
| | | ...formValues |
| | | }); |
| | | return { rows: resp }; |
| | | } |
| | | } |
| | | }, |
| | | rowConfig: { |
| | | isHover: true, |
| | | keyField: 'id' |
| | | }, |
| | | /** |
| | | * å¼å¯èææ»å¨ |
| | | * æ°æ®éå°å¯ä»¥éæ©å
³é |
| | | * 妿éå°æ ·å¼é®é¢(空ç½ãéä½ æ»å¨ç)å¯ä»¥éæ©å
³éèææ»å¨ |
| | | */ |
| | | scrollY: { |
| | | enabled: true, |
| | | gt: 0 |
| | | }, |
| | | treeConfig: { |
| | | parentField: 'parentId', |
| | | rowField: 'id', |
| | | // èªå¨è½¬æ¢ä¸ºtree ç±vxeå¤ç æ éæå¨è½¬æ¢ |
| | | transform: true |
| | | }, |
| | | id: 'fixture-type-index' |
| | | }; |
| | | |
| | | const [BasicTable, tableApi] = useVbenVxeGrid({ |
| | | formOptions, |
| | | gridOptions, |
| | | gridEvents: { |
| | | cellDblclick: (e: any) => { |
| | | const { row = {} } = e; |
| | | if (!row?.children) { |
| | | return; |
| | | } |
| | | const isExpanded = row?.expand; |
| | | tableApi.grid.setTreeExpand(row, !isExpanded); |
| | | row.expand = !isExpanded; |
| | | }, |
| | | // éè¦çå¬ä½¿ç¨ç®å¤´å±å¼çæ
åµ å¦åå±å¼/æå çæ°æ®ä¸ä¸è´ |
| | | toggleTreeExpand: (e: any) => { |
| | | const { row = {}, expanded } = e; |
| | | row.expand = expanded; |
| | | } |
| | | } |
| | | }); |
| | | const [FixtureTypeDrawer, drawerApi] = useVbenDrawer({ |
| | | connectedComponent: fixtureTypeDrawer |
| | | }); |
| | | |
| | | function handleAdd() { |
| | | drawerApi.setData({}); |
| | | drawerApi.open(); |
| | | } |
| | | |
| | | function handleSubAdd(row: Recordable<any>) { |
| | | const { id } = row; |
| | | drawerApi.setData({ id, update: false }); |
| | | drawerApi.open(); |
| | | } |
| | | |
| | | async function handleEdit(record: Recordable<any>) { |
| | | drawerApi.setData({ id: record.id, update: true }); |
| | | drawerApi.open(); |
| | | } |
| | | |
| | | async function handleDelete(row: Recordable<any>) { |
| | | await delFixtureType(row.id); |
| | | await tableApi.query(); |
| | | } |
| | | |
| | | function handleDownloadExcel() { |
| | | commonDownloadExcel(fixtureTypeExport, 'å·¥å
፱Ȍ', tableApi.formApi.form.values, { |
| | | fieldMappingTime: formOptions.fieldMappingTime |
| | | }); |
| | | } |
| | | |
| | | /** |
| | | * å
¨é¨å±å¼/æå |
| | | * @param expand æ¯å¦å±å¼ |
| | | */ |
| | | function setExpandOrCollapse(expand: boolean) { |
| | | eachTree(tableApi.grid.getData(), (item) => (item.expand = expand)); |
| | | tableApi.grid?.setAllTreeExpand(expand); |
| | | } |
| | | </script> |
| | | |
| | | <template> |
| | | <Page :auto-content-height="true"> |
| | | <BasicTable table-title="å·¥å
·ç±»åå表" table-title-help="åå»å±å¼/æ¶èµ·åèå"> |
| | | <template #toolbar-tools> |
| | | <Space> |
| | | <a-button @click="setExpandOrCollapse(false)"> |
| | | {{ $t('pages.common.collapse') }} |
| | | </a-button> |
| | | <a-button @click="setExpandOrCollapse(true)"> |
| | | {{ $t('pages.common.expand') }} |
| | | </a-button> |
| | | <a-button v-access:code="['eims:fixtureType:export']" @click="handleDownloadExcel"> |
| | | {{ $t('pages.common.export') }} |
| | | </a-button> |
| | | <a-button type="primary" v-access:code="['eims:fixtureType:add']" @click="handleAdd"> |
| | | {{ $t('pages.common.add') }} |
| | | </a-button> |
| | | </Space> |
| | | </template> |
| | | <template #action="{ row }"> |
| | | <Space> |
| | | <ghost-button v-access:code="['eims:fixtureType:edit']" @click="handleEdit(row)"> |
| | | {{ $t('pages.common.edit') }} |
| | | </ghost-button> |
| | | <!-- 'æé®ç±»å'æ æ³åæ·»å åèå --> |
| | | <ghost-button v-if="row.menuType !== 'F'" class="btn-success" v-access:code="['eims:fixtureType:add']" @click="handleSubAdd(row)"> |
| | | {{ $t('pages.common.add') }} |
| | | </ghost-button> |
| | | <Popconfirm :get-popup-container="getVxePopupContainer" placement="left" title="确认å é¤ï¼" @confirm="handleDelete(row)"> |
| | | <ghost-button danger v-access:code="['eims:fixtureType:remove']" @click.stop=""> |
| | | {{ $t('pages.common.delete') }} |
| | | </ghost-button> |
| | | </Popconfirm> |
| | | </Space> |
| | | </template> |
| | | </BasicTable> |
| | | <FixtureTypeDrawer @reload="tableApi.query()" /> |
| | | </Page> |
| | | </template> |
¶Ô±ÈÐÂÎļþ |
| | |
| | | import type { VxeGridProps } from '#/adapter/vxe-table'; |
| | | |
| | | import { DictEnum } from '@vben/constants'; |
| | | import { getPopupContainer } from '@vben/utils'; |
| | | |
| | | import { type FormSchemaGetter } from '#/adapter/form'; |
| | | import { getDictOptions } from '#/utils/dict'; |
| | | import { renderDict } from '#/utils/render'; |
| | | |
| | | export const querySchema: FormSchemaGetter = () => [ |
| | | { |
| | | component: 'Input', |
| | | fieldName: 'fixtureName', |
| | | label: 'å·¥å
·åç§°' |
| | | }, |
| | | { |
| | | component: 'Input', |
| | | fieldName: 'fixtureCode', |
| | | label: 'å·¥å
·ç¼ç ' |
| | | }, |
| | | { |
| | | component: 'Select', |
| | | componentProps: { |
| | | options: getDictOptions(DictEnum.EIMS_FIXTURE_STATUS) |
| | | }, |
| | | fieldName: 'status', |
| | | label: 'å·¥å
·ç¶æ' |
| | | }, |
| | | { |
| | | component: 'Input', |
| | | fieldName: 'assetNo', |
| | | label: 'èµäº§ç¼å·' |
| | | }, |
| | | { |
| | | component: 'Input', |
| | | fieldName: 'modelNo', |
| | | label: 'å·¥å
·åå·' |
| | | }, |
| | | { |
| | | component: 'Input', |
| | | fieldName: 'specNo', |
| | | label: 'å·¥å
·è§æ ¼' |
| | | }, |
| | | { |
| | | component: 'TreeSelect', |
| | | // å¨draweréæ´æ° è¿éä¸éè¦é»è®¤çcomponentProps |
| | | defaultValue: undefined, |
| | | fieldName: 'borrowDept', |
| | | label: 'åç¨é¨é¨', |
| | | // rules: 'selectRequired', |
| | | }, |
| | | { |
| | | component: 'Select', |
| | | componentProps: { |
| | | showSearch: true, |
| | | allowClear: true, |
| | | getPopupContainer |
| | | }, |
| | | fieldName: 'borrowUser', |
| | | label: 'åç¨äºº' |
| | | }, |
| | | { |
| | | component: 'Input', |
| | | fieldName: 'madeIn', |
| | | label: 'å¶é å' |
| | | }, |
| | | { |
| | | component: 'RangePicker', |
| | | fieldName: 'purchaseDate', |
| | | label: 'éè´æ¥æ' |
| | | }, |
| | | { |
| | | component: 'RangePicker', |
| | | fieldName: 'deployDate', |
| | | label: 'ä½¿ç¨æ¥æ' |
| | | } |
| | | ]; |
| | | |
| | | export const columns: VxeGridProps['columns'] = [ |
| | | { type: 'checkbox', width: 60, fixed: 'left' }, |
| | | { |
| | | title: 'å·¥å
·(æ²»å
·)åç§°', |
| | | field: 'fixtureName', |
| | | minWidth: 140, |
| | | fixed: 'left' |
| | | }, |
| | | |
| | | { |
| | | title: 'ç¶æ', |
| | | field: 'status', |
| | | sortable: true, |
| | | slots: { |
| | | default: ({ row }) => { |
| | | if (row.status === null || row.status === '') { |
| | | return ''; |
| | | } |
| | | return renderDict(row.status, DictEnum.EIMS_FIXTURE_STATUS); |
| | | } |
| | | }, |
| | | minWidth: 80, |
| | | fixed: 'left' |
| | | }, |
| | | { |
| | | title: 'ç±»å', |
| | | field: 'fixtureTypeName', |
| | | minWidth: 100 |
| | | }, |
| | | { |
| | | title: 'èµäº§ç¼å·', |
| | | field: 'assetNo', |
| | | sortable: true, |
| | | minWidth: 140 |
| | | }, |
| | | { |
| | | title: 'å·¥å
·ç¼ç ', |
| | | field: 'fixtureCode', |
| | | sortable: true, |
| | | minWidth: 100 |
| | | }, |
| | | { |
| | | title: 'åå·', |
| | | field: 'modelNo', |
| | | minWidth: 100 |
| | | }, |
| | | { |
| | | title: 'è§æ ¼', |
| | | field: 'specNo', |
| | | minWidth: 100 |
| | | }, |
| | | { |
| | | title: 'å¶é å', |
| | | field: 'madeIn', |
| | | minWidth: 140 |
| | | }, |
| | | { |
| | | title: 'éè´æ¥æ', |
| | | field: 'purchaseDate', |
| | | minWidth: 140 |
| | | }, |
| | | { |
| | | title: 'ä½¿ç¨æ¥æ', |
| | | field: 'deployDate', |
| | | minWidth: 140 |
| | | }, |
| | | { |
| | | title: '使ç¨å¹´é', |
| | | field: 'serviceLife', |
| | | minWidth: 100 |
| | | }, |
| | | { |
| | | field: 'action', |
| | | fixed: 'right', |
| | | slots: { default: 'action' }, |
| | | title: 'æä½', |
| | | width: 200 |
| | | } |
| | | ]; |
| | | |
| | | export const drawerSchema: FormSchemaGetter = () => [ |
| | | { |
| | | component: 'Input', |
| | | dependencies: { |
| | | show: () => false, |
| | | triggerFields: [''] |
| | | }, |
| | | fieldName: 'id' |
| | | }, |
| | | { |
| | | component: 'TreeSelect', |
| | | defaultValue: 0, |
| | | fieldName: 'fixtureType', |
| | | label: 'å·¥å
፱Ȍ', |
| | | rules: 'selectRequired' |
| | | }, |
| | | { |
| | | component: 'Input', |
| | | fieldName: 'fixtureName', |
| | | label: 'å·¥å
·åç§°', |
| | | rules: 'required' |
| | | }, |
| | | { |
| | | component: 'Input', |
| | | fieldName: 'fixtureCode', |
| | | label: 'å·¥å
·ç¼ç ', |
| | | rules: 'required' |
| | | }, |
| | | { |
| | | component: 'Input', |
| | | fieldName: 'assetNo', |
| | | label: 'èµäº§ç¼å·' |
| | | }, |
| | | { |
| | | component: 'Input', |
| | | fieldName: 'modelNo', |
| | | label: 'åå·' |
| | | }, |
| | | { |
| | | component: 'Input', |
| | | fieldName: 'specNo', |
| | | label: 'è§æ ¼' |
| | | }, |
| | | { |
| | | component: 'Input', |
| | | fieldName: 'madeIn', |
| | | label: 'å¶é å' |
| | | }, |
| | | { |
| | | component: 'RadioGroup', |
| | | componentProps: { |
| | | buttonStyle: 'solid', |
| | | options: getDictOptions(DictEnum.EIMS_FIXTURE_STATUS), |
| | | optionType: 'button' |
| | | }, |
| | | defaultValue: '0', |
| | | fieldName: 'status', |
| | | label: 'ç¶æ' |
| | | }, |
| | | { |
| | | component: 'DatePicker', |
| | | componentProps: { |
| | | format: 'YYYY-MM-DD', |
| | | showTime: false, |
| | | valueFormat: 'YYYY-MM-DD', |
| | | getPopupContainer |
| | | }, |
| | | fieldName: 'purchaseDate', |
| | | label: 'éè´æ¥æ' |
| | | }, |
| | | { |
| | | component: 'DatePicker', |
| | | componentProps: { |
| | | format: 'YYYY-MM-DD', |
| | | showTime: false, |
| | | valueFormat: 'YYYY-MM-DD', |
| | | getPopupContainer |
| | | }, |
| | | fieldName: 'deployDate', |
| | | label: 'ä½¿ç¨æ¥æ' |
| | | }, |
| | | { |
| | | component: 'Input', |
| | | fieldName: 'serviceLife', |
| | | 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 { addFixture, getFixture, updateFixture } from '#/api/eims/fixture'; |
| | | import { getFixtureType, listFixtureType } from '#/api/eims/fixture-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, |
| | | closeOnPressEscape: true, |
| | | placement: 'left', |
| | | 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 getFixture(id); |
| | | await formApi.setValues(record); |
| | | if (isUpdate.value && record.borrowDept) { |
| | | await setupUserOptions(record.borrowDept); |
| | | } |
| | | } |
| | | |
| | | // å 载工å
·ç±»åæ éæ© |
| | | await setupFixtureTypeSelect(); |
| | | if (id) { |
| | | await formApi.setFieldValue('parentId', id); |
| | | if (isUpdate.value && id) { |
| | | const record = await getFixtureType(id); |
| | | await formApi.setValues(record); |
| | | } |
| | | } |
| | | drawerApi.drawerLoading(false); |
| | | } |
| | | }); |
| | | |
| | | async function setupFixtureTypeSelect() { |
| | | // status-0 åªæ¥è¯¢æªåç¨å·¥å
· |
| | | const fixArray = await listFixtureType({ status: 0 }); |
| | | // support i18n |
| | | fixArray.forEach((item) => { |
| | | item.typeName = $t(item.typeName); |
| | | }); |
| | | const fixTree = listToTree(fixArray, { id: 'id', pid: 'parentId' }); |
| | | const fullTree = [ |
| | | { |
| | | id: 0, |
| | | typeName: $t('menu.root'), |
| | | children: fixTree |
| | | } |
| | | ]; |
| | | addFullName(fullTree, 'typeName', ' / '); |
| | | formApi.updateSchema([ |
| | | { |
| | | componentProps: { |
| | | fieldNames: { |
| | | label: 'typeName', |
| | | value: 'id' |
| | | }, |
| | | getPopupContainer, |
| | | // è®¾ç½®å¼¹çªæ»å¨é«åº¦ é»è®¤256 |
| | | listHeight: 300, |
| | | showSearch: true, |
| | | treeData: fullTree, |
| | | disabled: typeDisabled.value, |
| | | treeDefaultExpandAll: false, |
| | | // é»è®¤å±å¼çæ èç¹ |
| | | treeDefaultExpandedKeys: [0], |
| | | treeLine: { showLeafIcon: false }, |
| | | // çéçåæ®µ |
| | | treeNodeFilterProp: 'typeName', |
| | | treeNodeLabelProp: 'fullName' |
| | | }, |
| | | fieldName: 'fixtureType' |
| | | } |
| | | ]); |
| | | } |
| | | |
| | | /** |
| | | * ç¨æ·çå è½½ |
| | | */ |
| | | 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: 'borrowUser' |
| | | } |
| | | ]); |
| | | } |
| | | |
| | | /** |
| | | * åå§åé¨é¨éæ© |
| | | */ |
| | | 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: 'borrowDept' |
| | | } |
| | | ]); |
| | | } |
| | | |
| | | async function handleConfirm() { |
| | | try { |
| | | drawerApi.drawerLoading(true); |
| | | const { valid } = await formApi.validate(); |
| | | if (!valid) { |
| | | return; |
| | | } |
| | | const data = cloneDeep(await formApi.getValues()); |
| | | await (isUpdate.value ? updateFixture(data) : addFixture(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 { UploadFile } from 'ant-design-vue/es/upload/interface'; |
| | | |
| | | import { h, ref, unref } from 'vue'; |
| | | |
| | | import { useVbenModal } from '@vben/common-ui'; |
| | | import { ExcelIcon, InBoxIcon } from '@vben/icons'; |
| | | |
| | | import { Modal, Switch, Upload } from 'ant-design-vue'; |
| | | |
| | | import { downloadImportTemplate, equImportData } from '#/api/eims/equ'; |
| | | import { commonDownloadExcel } from '#/utils/file/download'; |
| | | |
| | | const emit = defineEmits<{ reload: [] }>(); |
| | | |
| | | const UploadDragger = Upload.Dragger; |
| | | |
| | | const [BasicModal, modalApi] = useVbenModal({ |
| | | onCancel: handleCancel, |
| | | onConfirm: handleSubmit, |
| | | }); |
| | | |
| | | const fileList = ref<UploadFile[]>([]); |
| | | const checked = ref(false); |
| | | |
| | | async function handleSubmit() { |
| | | try { |
| | | modalApi.modalLoading(true); |
| | | if (fileList.value.length !== 1) { |
| | | handleCancel(); |
| | | return; |
| | | } |
| | | const data = { |
| | | file: fileList.value[0]!.originFileObj as Blob, |
| | | updateSupport: unref(checked), |
| | | }; |
| | | const { code, msg } = await equImportData(data); |
| | | let modal = Modal.success; |
| | | if (code === 200) { |
| | | emit('reload'); |
| | | } else { |
| | | emit('reload'); |
| | | modal = Modal.error; |
| | | } |
| | | handleCancel(); |
| | | modal({ |
| | | content: h('div', { |
| | | class: 'max-h-[260px] overflow-y-auto', |
| | | innerHTML: msg, // åå°å·²ç»å¤çxssé®é¢ |
| | | }), |
| | | title: 'æç¤º', |
| | | }); |
| | | } catch (error) { |
| | | console.warn(error); |
| | | modalApi.close(); |
| | | } finally { |
| | | modalApi.modalLoading(false); |
| | | } |
| | | } |
| | | |
| | | function handleCancel() { |
| | | modalApi.close(); |
| | | fileList.value = []; |
| | | checked.value = false; |
| | | } |
| | | </script> |
| | | |
| | | <template> |
| | | <BasicModal |
| | | :close-on-click-modal="false" |
| | | :fullscreen-button="false" |
| | | title="设å¤å¯¼å
¥" |
| | | > |
| | | <!-- z-indexä¸è®¾ç½®ä¼é®æ¡æ¨¡æ¿ä¸è½½loading --> |
| | | <!-- æå¨å¤ç è䏿¯æ¾å
¥æä»¶å°±ä¸ä¼ --> |
| | | <UploadDragger |
| | | v-model:file-list="fileList" |
| | | :before-upload="() => false" |
| | | :max-count="1" |
| | | :show-upload-list="true" |
| | | accept="application/vnd.openxmlformats-officedocument.spreadsheetml.sheet, application/vnd.ms-excel" |
| | | > |
| | | <p class="ant-upload-drag-icon flex items-center justify-center"> |
| | | <InBoxIcon class="text-primary size-[48px]" /> |
| | | </p> |
| | | <p class="ant-upload-text">ç¹å»æè
ææ½å°æ¤å¤ä¸ä¼ æä»¶</p> |
| | | </UploadDragger> |
| | | <div class="mt-2 flex flex-col gap-2"> |
| | | <div class="flex items-center gap-2"> |
| | | <span>å
许导å
¥xlsx, xlsæä»¶</span> |
| | | <a-button |
| | | type="link" |
| | | @click="commonDownloadExcel(downloadImportTemplate, '设å¤å¯¼å
¥æ¨¡æ¿')" |
| | | > |
| | | <div class="flex items-center gap-[4px]"> |
| | | <ExcelIcon /> |
| | | <span>ä¸è½½æ¨¡æ¿</span> |
| | | </div> |
| | | </a-button> |
| | | </div> |
| | | <div class="flex items-center gap-2"> |
| | | <span class="text-red-500">â ï¸ç¹å«æ³¨æâ ï¸ï¼è¯·ä¸è½½æ¨¡çä¿æå¯¼å
¥æä»¶è¡¨å¤´å模çä¸è´å导å
¥</span> |
| | | </div> |
| | | <div class="flex items-center gap-2"> |
| | | <span :class="{ 'text-red-500': checked }"> |
| | | æ¯å¦æ´æ°/è¦çå·²åå¨çç¨æ·æ°æ® |
| | | </span> |
| | | <Switch v-model:checked="checked" /> |
| | | </div> |
| | | </div> |
| | | </BasicModal> |
| | | </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 { getFixtureTypeTree } from '#/api/eims/fixture-type'; |
| | | |
| | | defineOptions({ inheritAttrs: false }); |
| | | |
| | | const emit = defineEmits<{ |
| | | /** |
| | | * ç¹å»å·æ°æé®çäºä»¶ |
| | | */ |
| | | reload: []; |
| | | /** |
| | | * ç¹å»èç¹çäºä»¶ |
| | | */ |
| | | select: []; |
| | | }>(); |
| | | |
| | | const selectTypeId = defineModel('selectTypeId', { |
| | | 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 = ''; |
| | | selectTypeId.value = []; |
| | | |
| | | const ret = await getFixtureTypeTree(); |
| | | |
| | | 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="selectTypeId" |
| | | :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 { onMounted, ref } from 'vue'; |
| | | import { useRouter } from 'vue-router'; |
| | | |
| | | import { Page, useVbenDrawer, useVbenModal, 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 { delFixture, fixtureExport, listFixture } from '#/api/eims/fixture'; |
| | | import { getDeptTree, userList } from '#/api/system/user'; |
| | | import { commonDownloadExcel } from '#/utils/file/download'; |
| | | |
| | | import { columns, querySchema } from './data'; |
| | | import fixtureDrawer from './fixture-drawer.vue'; |
| | | import fixtureImportModal from './fixture-import-modal.vue'; |
| | | import FixtureTypeTree from './fixture-type-tree.vue'; |
| | | |
| | | // 左边工å
፱Ȍ |
| | | const selectTypeId = ref<string[]>([]); |
| | | |
| | | const formOptions: VbenFormProps = { |
| | | commonConfig: { |
| | | labelWidth: 80, |
| | | componentProps: { |
| | | allowClear: true |
| | | } |
| | | }, |
| | | collapsed: 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: [ |
| | | ['purchaseDate', ['params[beginPurchaseDate]', 'params[endPurchaseDate]'], ['YYYY-MM-DD', 'YYYY-MM-DD']], |
| | | ['deployDate', ['params[beginDeployDate]', 'params[endDeployDate]'], ['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 = {}) => { |
| | | // é¨é¨æ éæ©å¤ç |
| | | if (selectTypeId.value.length === 1) { |
| | | formValues.fixtureType = selectTypeId.value[0]; |
| | | } else { |
| | | Reflect.deleteProperty(formValues, 'fixtureType'); |
| | | } |
| | | return await listFixture({ |
| | | pageNum: page.currentPage, |
| | | pageSize: page.pageSize, |
| | | ...formValues |
| | | }); |
| | | } |
| | | } |
| | | }, |
| | | rowConfig: { |
| | | isHover: true, |
| | | keyField: 'fixtureId' |
| | | }, |
| | | sortConfig: { |
| | | // è¿ç¨æåº |
| | | remote: true, |
| | | // æ¯æå¤å段æåº é»è®¤å
³é |
| | | multiple: true |
| | | }, |
| | | id: 'eims-fixture-index' |
| | | }; |
| | | |
| | | const [BasicTable, tableApi] = useVbenVxeGrid({ |
| | | formOptions, |
| | | gridOptions, |
| | | gridEvents: { |
| | | sortChange: (sortParams) => vxeSortEvent(tableApi, sortParams) |
| | | } |
| | | }); |
| | | |
| | | const [FixtureDrawer, fixtureDrawerApi] = useVbenDrawer({ |
| | | connectedComponent: fixtureDrawer |
| | | }); |
| | | |
| | | /** |
| | | * 导å
¥ |
| | | */ |
| | | const [FixtureImportModal, fixtureImportModalApi] = useVbenModal({ |
| | | connectedComponent: fixtureImportModal |
| | | }); |
| | | |
| | | function handleImport() { |
| | | fixtureImportModalApi.open(); |
| | | } |
| | | |
| | | function handleAdd() { |
| | | fixtureDrawerApi.setData({}); |
| | | fixtureDrawerApi.open(); |
| | | } |
| | | |
| | | async function handleEdit(record: Recordable<any>) { |
| | | fixtureDrawerApi.setData({ id: record.id }); |
| | | fixtureDrawerApi.open(); |
| | | } |
| | | |
| | | async function handleDelete(row: Recordable<any>) { |
| | | await delFixture(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 delFixture(ids); |
| | | await tableApi.query(); |
| | | } |
| | | }); |
| | | } |
| | | |
| | | function handleDownloadExcel() { |
| | | commonDownloadExcel(fixtureExport, 'å·¥å
·å°è´¦', tableApi.formApi.form.values, { |
| | | fieldMappingTime: formOptions.fieldMappingTime |
| | | }); |
| | | } |
| | | |
| | | const router = useRouter(); |
| | | |
| | | function handleDetail(record: Recordable<any>) { |
| | | router.push(`/fixture/detail/${record.id}`); |
| | | } |
| | | |
| | | /** |
| | | * åå§åé¨é¨éæ© |
| | | */ |
| | | 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.inventoryUser = undefined; |
| | | }, |
| | | placeholder: 'è¯·éæ©', |
| | | showSearch: true, |
| | | treeData: deptTree, |
| | | treeDefaultExpandAll: true, |
| | | treeLine: { showLeafIcon: false }, |
| | | // çéçåæ®µ |
| | | treeNodeFilterProp: 'label', |
| | | // éä¸åæ¾ç¤ºå¨è¾å
¥æ¡çå¼ |
| | | treeNodeLabelProp: 'fullName' |
| | | }), |
| | | fieldName: 'borrowDept' |
| | | } |
| | | ]); |
| | | } |
| | | |
| | | /** |
| | | * ç¨æ·çå è½½ |
| | | */ |
| | | 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: 'borrowUser' |
| | | } |
| | | ]); |
| | | } |
| | | |
| | | onMounted(async () => { |
| | | await setupDeptSelect(); |
| | | }); |
| | | </script> |
| | | |
| | | <template> |
| | | <Page :auto-content-height="true"> |
| | | <div class="flex h-full gap-[8px]"> |
| | | <FixtureTypeTree v-model:select-type-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:fixture:export']" @click="handleDownloadExcel"> |
| | | {{ $t('pages.common.export') }} |
| | | </a-button> |
| | | <a-button v-access:code="['eims:fixture:import']" @click="handleImport"> |
| | | {{ $t('pages.common.import') }} |
| | | </a-button> |
| | | <a-button |
| | | :disabled="!vxeCheckboxChecked(tableApi)" |
| | | danger |
| | | type="primary" |
| | | v-access:code="['eims:fixture:remove']" |
| | | @click="handleMultiDelete" |
| | | > |
| | | {{ $t('pages.common.delete') }} |
| | | </a-button> |
| | | <a-button type="primary" v-access:code="['eims:fixture: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:fixture: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:fixture: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:fixture:remove']" @click.stop=""> |
| | | {{ $t('pages.common.delete') }} |
| | | </ghost-button> |
| | | </Popconfirm> |
| | | </Space> |
| | | </template> |
| | | </BasicTable> |
| | | </div> |
| | | <FixtureDrawer @reload="tableApi.query()" /> |
| | | <FixtureImportModal @reload="tableApi.query()" /> |
| | | </Page> |
| | | </template> |
| | |
| | | export enum DictEnum { |
| | | EIMS_EQU_UNIT = 'eims_equ_unit', // 设å¤çç¹ç¶æ |
| | | EIMS_FIXTURE_STATUS = 'eims_fixture_status', // 设å¤çç¹ç¶æ |
| | | EIMS_INVENTORY_DETAIL_STATU = 'inventory_detail_statu', // 设å¤çç¹ç¶æ |
| | | EIMS_INVENTORY_STATU = 'inventory_statu', // 设å¤çç¹ç¶æ |
| | | EQU_IMPORT_STATU = 'equ_import_status', // 设å¤å¯¼å
¥ç¶æ |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package org.dromara.common.core.service; |
| | | |
| | | public interface FixtureTypeService { |
| | | /** |
| | | * éè¿å·¥å
·ç±»åIDæ¥è¯¢å·¥å
·åç§° |
| | | * |
| | | * @param fixIds å·¥å
·ID串éå·åé |
| | | * @return å·¥å
·ç±»åå称串éå·åé |
| | | */ |
| | | String selectFixtureTypeNameByIds(String fixIds); |
| | | } |
| | |
| | | * 设å¤åç§°id转åç§° |
| | | */ |
| | | String EQU_ID_TO_NAME = "equ_id_to_name"; |
| | | /** |
| | | * å·¥å
·ç±»å(æ²»å
·)id转åç§° |
| | | */ |
| | | String FIXTURE_TYPE_ID_TO_NAME = "fixture_type_id_to_name"; |
| | | |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package org.dromara.common.translation.core.impl; |
| | | |
| | | import lombok.AllArgsConstructor; |
| | | import org.dromara.common.core.service.FixtureTypeService; |
| | | import org.dromara.common.translation.annotation.TranslationType; |
| | | import org.dromara.common.translation.constant.TransConstant; |
| | | import org.dromara.common.translation.core.TranslationInterface; |
| | | |
| | | /** |
| | | * å·¥å
·åç§°ç¿»è¯å®ç° |
| | | * |
| | | * @author zhuguifei |
| | | */ |
| | | @AllArgsConstructor |
| | | @TranslationType(type = TransConstant.FIXTURE_TYPE_ID_TO_NAME) |
| | | public class FixtureTypeNameTranslationImpl implements TranslationInterface<String> { |
| | | |
| | | private final FixtureTypeService fixtureTypeService; |
| | | |
| | | @Override |
| | | public String translation(Object key, String other) { |
| | | if (key instanceof String ids) { |
| | | return fixtureTypeService.selectFixtureTypeNameByIds(ids); |
| | | } else if (key instanceof Long id) { |
| | | return fixtureTypeService.selectFixtureTypeNameByIds(id.toString()); |
| | | } |
| | | return null; |
| | | } |
| | | } |
| | |
| | | org.dromara.common.translation.core.impl.NicknameTranslationImpl |
| | | org.dromara.common.translation.core.impl.EquTypeNameTranslationImpl |
| | | org.dromara.common.translation.core.impl.EquNameTranslationImpl |
| | | org.dromara.common.translation.core.impl.FixtureTypeNameTranslationImpl |
¶Ô±ÈÐÂÎļþ |
| | |
| | | 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.EimsFixtureVo; |
| | | import org.dromara.eims.domain.bo.EimsFixtureBo; |
| | | import org.dromara.eims.service.IEimsFixtureService; |
| | | import org.dromara.common.mybatis.core.page.TableDataInfo; |
| | | |
| | | /** |
| | | * å·¥å
·(æ²»å
·)å°è´¦ |
| | | * |
| | | * @author zhuguifei |
| | | * @date 2025-02-14 |
| | | */ |
| | | @Validated |
| | | @RequiredArgsConstructor |
| | | @RestController |
| | | @RequestMapping("/eims/fixture") |
| | | public class EimsFixtureController extends BaseController { |
| | | |
| | | private final IEimsFixtureService eimsFixtureService; |
| | | |
| | | /** |
| | | * æ¥è¯¢å·¥å
·(æ²»å
·)å°è´¦å表 |
| | | */ |
| | | @SaCheckPermission("eims:fixture:list") |
| | | @GetMapping("/list") |
| | | public TableDataInfo<EimsFixtureVo> list(EimsFixtureBo bo, PageQuery pageQuery) { |
| | | return eimsFixtureService.queryPageList(bo, pageQuery); |
| | | } |
| | | |
| | | /** |
| | | * 导åºå·¥å
·(æ²»å
·)å°è´¦å表 |
| | | */ |
| | | @SaCheckPermission("eims:fixture:export") |
| | | @Log(title = "å·¥å
·(æ²»å
·)å°è´¦", businessType = BusinessType.EXPORT) |
| | | @PostMapping("/export") |
| | | public void export(EimsFixtureBo bo, HttpServletResponse response) { |
| | | List<EimsFixtureVo> list = eimsFixtureService.queryList(bo); |
| | | ExcelUtil.exportExcel(list, "å·¥å
·(æ²»å
·)å°è´¦", EimsFixtureVo.class, response); |
| | | } |
| | | |
| | | /** |
| | | * è·åå·¥å
·(æ²»å
·)å°è´¦è¯¦ç»ä¿¡æ¯ |
| | | * |
| | | * @param id ä¸»é® |
| | | */ |
| | | @SaCheckPermission("eims:fixture:query") |
| | | @GetMapping("/{id}") |
| | | public R<EimsFixtureVo> getInfo(@NotNull(message = "主é®ä¸è½ä¸ºç©º") |
| | | @PathVariable Long id) { |
| | | return R.ok(eimsFixtureService.queryById(id)); |
| | | } |
| | | |
| | | /** |
| | | * æ°å¢å·¥å
·(æ²»å
·)å°è´¦ |
| | | */ |
| | | @SaCheckPermission("eims:fixture:add") |
| | | @Log(title = "å·¥å
·(æ²»å
·)å°è´¦", businessType = BusinessType.INSERT) |
| | | @RepeatSubmit() |
| | | @PostMapping() |
| | | public R<Void> add(@Validated(AddGroup.class) @RequestBody EimsFixtureBo bo) { |
| | | return toAjax(eimsFixtureService.insertByBo(bo)); |
| | | } |
| | | |
| | | /** |
| | | * ä¿®æ¹å·¥å
·(æ²»å
·)å°è´¦ |
| | | */ |
| | | @SaCheckPermission("eims:fixture:edit") |
| | | @Log(title = "å·¥å
·(æ²»å
·)å°è´¦", businessType = BusinessType.UPDATE) |
| | | @RepeatSubmit() |
| | | @PutMapping() |
| | | public R<Void> edit(@Validated(EditGroup.class) @RequestBody EimsFixtureBo bo) { |
| | | return toAjax(eimsFixtureService.updateByBo(bo)); |
| | | } |
| | | |
| | | /** |
| | | * å é¤å·¥å
·(æ²»å
·)å°è´¦ |
| | | * |
| | | * @param ids 主é®ä¸² |
| | | */ |
| | | @SaCheckPermission("eims:fixture:remove") |
| | | @Log(title = "å·¥å
·(æ²»å
·)å°è´¦", businessType = BusinessType.DELETE) |
| | | @DeleteMapping("/{ids}") |
| | | public R<Void> remove(@NotEmpty(message = "主é®ä¸è½ä¸ºç©º") |
| | | @PathVariable Long[] ids) { |
| | | return toAjax(eimsFixtureService.deleteWithValidByIds(List.of(ids), true)); |
| | | } |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package org.dromara.eims.controller; |
| | | |
| | | import java.util.List; |
| | | |
| | | import cn.hutool.core.lang.tree.Tree; |
| | | import lombok.RequiredArgsConstructor; |
| | | import jakarta.servlet.http.HttpServletResponse; |
| | | import jakarta.validation.constraints.*; |
| | | import cn.dev33.satoken.annotation.SaCheckPermission; |
| | | import org.dromara.eims.domain.bo.EimsEquTypeBo; |
| | | 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.EimsFixtureTypeVo; |
| | | import org.dromara.eims.domain.bo.EimsFixtureTypeBo; |
| | | import org.dromara.eims.service.IEimsFixtureTypeService; |
| | | |
| | | /** |
| | | * å·¥å
፱Ȍ |
| | | * |
| | | * @author zhuguifei |
| | | * @date 2025-02-17 |
| | | */ |
| | | @Validated |
| | | @RequiredArgsConstructor |
| | | @RestController |
| | | @RequestMapping("/eims/fixtureType") |
| | | public class EimsFixtureTypeController extends BaseController { |
| | | |
| | | private final IEimsFixtureTypeService eimsFixtureTypeService; |
| | | |
| | | /** |
| | | * æ¥è¯¢å·¥å
·ç±»åå表 |
| | | */ |
| | | @SaCheckPermission("eims:fixtureType:list") |
| | | @GetMapping("/list") |
| | | public R<List<EimsFixtureTypeVo>> list(EimsFixtureTypeBo bo) { |
| | | List<EimsFixtureTypeVo> list = eimsFixtureTypeService.queryList(bo); |
| | | return R.ok(list); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * è·å设å¤ç±»åæ å表 |
| | | */ |
| | | @SaCheckPermission("eims:fixtureType:list") |
| | | @GetMapping("/tree") |
| | | public R<List<Tree<Long>>> fixtureTypeTree(EimsFixtureTypeBo bo) { |
| | | return R.ok(eimsFixtureTypeService.selectFixtureTypeTreeList(bo)); |
| | | } |
| | | |
| | | /** |
| | | * 导åºå·¥å
·ç±»åå表 |
| | | */ |
| | | @SaCheckPermission("eims:fixtureType:export") |
| | | @Log(title = "å·¥å
፱Ȍ", businessType = BusinessType.EXPORT) |
| | | @PostMapping("/export") |
| | | public void export(EimsFixtureTypeBo bo, HttpServletResponse response) { |
| | | List<EimsFixtureTypeVo> list = eimsFixtureTypeService.queryList(bo); |
| | | ExcelUtil.exportExcel(list, "å·¥å
፱Ȍ", EimsFixtureTypeVo.class, response); |
| | | } |
| | | |
| | | /** |
| | | * è·åå·¥å
·ç±»å详ç»ä¿¡æ¯ |
| | | * |
| | | * @param id ä¸»é® |
| | | */ |
| | | @SaCheckPermission("eims:fixtureType:query") |
| | | @GetMapping("/{id}") |
| | | public R<EimsFixtureTypeVo> getInfo(@NotNull(message = "主é®ä¸è½ä¸ºç©º") |
| | | @PathVariable Long id) { |
| | | return R.ok(eimsFixtureTypeService.queryById(id)); |
| | | } |
| | | |
| | | /** |
| | | * æ°å¢å·¥å
፱Ȍ |
| | | */ |
| | | @SaCheckPermission("eims:fixtureType:add") |
| | | @Log(title = "å·¥å
፱Ȍ", businessType = BusinessType.INSERT) |
| | | @RepeatSubmit() |
| | | @PostMapping() |
| | | public R<Void> add(@Validated(AddGroup.class) @RequestBody EimsFixtureTypeBo bo) { |
| | | return toAjax(eimsFixtureTypeService.insertByBo(bo)); |
| | | } |
| | | |
| | | /** |
| | | * ä¿®æ¹å·¥å
፱Ȍ |
| | | */ |
| | | @SaCheckPermission("eims:fixtureType:edit") |
| | | @Log(title = "å·¥å
፱Ȍ", businessType = BusinessType.UPDATE) |
| | | @RepeatSubmit() |
| | | @PutMapping() |
| | | public R<Void> edit(@Validated(EditGroup.class) @RequestBody EimsFixtureTypeBo bo) { |
| | | return toAjax(eimsFixtureTypeService.updateByBo(bo)); |
| | | } |
| | | |
| | | /** |
| | | * å é¤å·¥å
፱Ȍ |
| | | * |
| | | * @param ids 主é®ä¸² |
| | | */ |
| | | @SaCheckPermission("eims:fixtureType:remove") |
| | | @Log(title = "å·¥å
፱Ȍ", businessType = BusinessType.DELETE) |
| | | @DeleteMapping("/{ids}") |
| | | public R<Void> remove(@NotEmpty(message = "主é®ä¸è½ä¸ºç©º") |
| | | @PathVariable Long[] ids) { |
| | | return toAjax(eimsFixtureTypeService.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_fixture |
| | | * |
| | | * @author zhuguifei |
| | | * @date 2025-02-14 |
| | | */ |
| | | @Data |
| | | @EqualsAndHashCode(callSuper = true) |
| | | @TableName("eims_fixture") |
| | | public class EimsFixture extends BaseEntity { |
| | | |
| | | @Serial |
| | | private static final long serialVersionUID = 1L; |
| | | |
| | | /** |
| | | * |
| | | */ |
| | | @TableId(value = "id") |
| | | private Long id; |
| | | |
| | | /** |
| | | * æ²»å
·ç¼ç |
| | | */ |
| | | private String fixtureCode; |
| | | |
| | | /** |
| | | * æ²»å
·åç§° |
| | | */ |
| | | private String fixtureName; |
| | | |
| | | /** |
| | | * æ²»å
·ï¼å·¥å
·ï¼ç±»å |
| | | */ |
| | | private Long fixtureType; |
| | | |
| | | /** |
| | | * æ²»å
·æè¿° |
| | | */ |
| | | private String fixtureDesc; |
| | | |
| | | /** |
| | | * åç¨é¨é¨ |
| | | */ |
| | | private Long borrowDept; |
| | | |
| | | /** |
| | | * åç¨äºº |
| | | */ |
| | | private Long borrowUser; |
| | | |
| | | /** |
| | | * ç¶æï¼åå
¸ï¼ |
| | | */ |
| | | private String status; |
| | | |
| | | /** |
| | | * èµäº§ç¼å· |
| | | */ |
| | | private String assetNo; |
| | | |
| | | /** |
| | | * åå· |
| | | */ |
| | | private String modelNo; |
| | | |
| | | /** |
| | | * è§æ ¼ |
| | | */ |
| | | private String specNo; |
| | | |
| | | /** |
| | | * å¶é å |
| | | */ |
| | | private String madeIn; |
| | | |
| | | /** |
| | | * éè´æ¥æ |
| | | */ |
| | | @JsonFormat(pattern = "yyyy-MM-dd") |
| | | private Date purchaseDate; |
| | | |
| | | /** |
| | | * ä½¿ç¨æ¥æ |
| | | */ |
| | | @JsonFormat(pattern = "yyyy-MM-dd") |
| | | private Date deployDate; |
| | | |
| | | /** |
| | | * 使ç¨å¹´é |
| | | */ |
| | | private Long serviceLife; |
| | | |
| | | /** |
| | | * 夿³¨ |
| | | */ |
| | | 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_fixture_type |
| | | * |
| | | * @author zhuguifei |
| | | * @date 2025-02-17 |
| | | */ |
| | | @Data |
| | | @EqualsAndHashCode(callSuper = true) |
| | | @TableName("eims_fixture_type") |
| | | public class EimsFixtureType extends BaseEntity { |
| | | |
| | | @Serial |
| | | private static final long serialVersionUID = 1L; |
| | | |
| | | /** |
| | | * |
| | | */ |
| | | @TableId(value = "id") |
| | | private Long id; |
| | | |
| | | /** |
| | | * ç±»ååç§° |
| | | */ |
| | | private String typeName; |
| | | |
| | | /** |
| | | * ç±»åç¼ç |
| | | */ |
| | | private String typeCode; |
| | | |
| | | /** |
| | | * ç¶id |
| | | */ |
| | | private Long parentId; |
| | | |
| | | /** |
| | | * æ¾ç¤ºé¡ºåº |
| | | */ |
| | | private Long orderNum; |
| | | |
| | | /** |
| | | * èåç±»åï¼Mç®å½ Cèå Fæé®ï¼ |
| | | */ |
| | | private String menuType; |
| | | |
| | | /** |
| | | * èå徿 |
| | | */ |
| | | private String icon; |
| | | |
| | | /** |
| | | * èåç¶æï¼0æ£å¸¸ 1åç¨ï¼ |
| | | */ |
| | | private String status; |
| | | |
| | | /** |
| | | * 夿³¨ |
| | | */ |
| | | private String remark; |
| | | |
| | | |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package org.dromara.eims.domain.bo; |
| | | |
| | | import org.dromara.eims.domain.EimsFixture; |
| | | 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 com.fasterxml.jackson.annotation.JsonFormat; |
| | | |
| | | /** |
| | | * å·¥å
·(æ²»å
·)å°è´¦ä¸å¡å¯¹è±¡ eims_fixture |
| | | * |
| | | * @author zhuguifei |
| | | * @date 2025-02-14 |
| | | */ |
| | | @Data |
| | | @EqualsAndHashCode(callSuper = true) |
| | | @AutoMapper(target = EimsFixture.class, reverseConvertGenerate = false) |
| | | public class EimsFixtureBo extends BaseEntity { |
| | | |
| | | /** |
| | | * |
| | | */ |
| | | @NotNull(message = "ä¸è½ä¸ºç©º", groups = { EditGroup.class }) |
| | | private Long id; |
| | | |
| | | /** |
| | | * æ²»å
·ç¼ç |
| | | */ |
| | | private String fixtureCode; |
| | | |
| | | /** |
| | | * æ²»å
·åç§° |
| | | */ |
| | | @NotBlank(message = "æ²»å
·åç§°ä¸è½ä¸ºç©º", groups = { AddGroup.class, EditGroup.class }) |
| | | private String fixtureName; |
| | | |
| | | /** |
| | | * æ²»å
·ï¼å·¥å
·ï¼ç±»å |
| | | */ |
| | | private Long fixtureType; |
| | | |
| | | /** |
| | | * æ²»å
·æè¿° |
| | | */ |
| | | private String fixtureDesc; |
| | | |
| | | /** |
| | | * åç¨é¨é¨ |
| | | */ |
| | | private Long borrowDept; |
| | | |
| | | /** |
| | | * åç¨äºº |
| | | */ |
| | | private Long borrowUser; |
| | | |
| | | /** |
| | | * ç¶æï¼åå
¸ï¼ |
| | | */ |
| | | private String status; |
| | | |
| | | /** |
| | | * èµäº§ç¼å· |
| | | */ |
| | | private String assetNo; |
| | | |
| | | /** |
| | | * åå· |
| | | */ |
| | | private String modelNo; |
| | | |
| | | /** |
| | | * è§æ ¼ |
| | | */ |
| | | private String specNo; |
| | | |
| | | /** |
| | | * å¶é å |
| | | */ |
| | | private String madeIn; |
| | | |
| | | /** |
| | | * éè´æ¥æ |
| | | */ |
| | | @JsonFormat(pattern = "yyyy-MM-dd") |
| | | private Date purchaseDate; |
| | | |
| | | /** |
| | | * ä½¿ç¨æ¥æ |
| | | */ |
| | | @JsonFormat(pattern = "yyyy-MM-dd") |
| | | private Date deployDate; |
| | | |
| | | /** |
| | | * 使ç¨å¹´é |
| | | */ |
| | | private Long serviceLife; |
| | | |
| | | /** |
| | | * 夿³¨ |
| | | */ |
| | | private String remark; |
| | | |
| | | |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package org.dromara.eims.domain.bo; |
| | | |
| | | import org.dromara.eims.domain.EimsFixtureType; |
| | | 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_fixture_type |
| | | * |
| | | * @author zhuguifei |
| | | * @date 2025-02-17 |
| | | */ |
| | | @Data |
| | | @EqualsAndHashCode(callSuper = true) |
| | | @AutoMapper(target = EimsFixtureType.class, reverseConvertGenerate = false) |
| | | public class EimsFixtureTypeBo extends BaseEntity { |
| | | |
| | | /** |
| | | * |
| | | */ |
| | | @NotNull(message = "ä¸è½ä¸ºç©º", groups = { EditGroup.class }) |
| | | private Long id; |
| | | |
| | | /** |
| | | * ç±»ååç§° |
| | | */ |
| | | @NotBlank(message = "ç±»ååç§°ä¸è½ä¸ºç©º", groups = { AddGroup.class, EditGroup.class }) |
| | | private String typeName; |
| | | |
| | | /** |
| | | * ç±»åç¼ç |
| | | */ |
| | | @NotBlank(message = "ç±»åç¼ç ä¸è½ä¸ºç©º", groups = { AddGroup.class, EditGroup.class }) |
| | | private String typeCode; |
| | | |
| | | /** |
| | | * ç¶id |
| | | */ |
| | | @NotNull(message = "ç¶idä¸è½ä¸ºç©º", groups = { AddGroup.class, EditGroup.class }) |
| | | private Long parentId; |
| | | |
| | | /** |
| | | * æ¾ç¤ºé¡ºåº |
| | | */ |
| | | @NotNull(message = "æ¾ç¤ºé¡ºåºä¸è½ä¸ºç©º", groups = { AddGroup.class, EditGroup.class }) |
| | | private Long orderNum; |
| | | |
| | | /** |
| | | * èåç±»åï¼Mç®å½ Cèå Fæé®ï¼ |
| | | */ |
| | | @NotBlank(message = "èåç±»åï¼Mç®å½ Cèå Fæé®ï¼ä¸è½ä¸ºç©º", groups = { AddGroup.class, EditGroup.class }) |
| | | private String menuType; |
| | | |
| | | /** |
| | | * èå徿 |
| | | */ |
| | | private String icon; |
| | | |
| | | /** |
| | | * èåç¶æï¼0æ£å¸¸ 1åç¨ï¼ |
| | | */ |
| | | @NotBlank(message = "èåç¶æï¼0æ£å¸¸ 1åç¨ï¼ä¸è½ä¸ºç©º", groups = { AddGroup.class, EditGroup.class }) |
| | | private String status; |
| | | |
| | | /** |
| | | * 夿³¨ |
| | | */ |
| | | private String remark; |
| | | |
| | | |
| | | } |
| | |
| | | package org.dromara.eims.domain.vo; |
| | | |
| | | import org.dromara.common.mybatis.core.domain.BaseEntity; |
| | | import org.dromara.eims.domain.EimsEquType; |
| | | import com.alibaba.excel.annotation.ExcelIgnoreUnannotated; |
| | | import com.alibaba.excel.annotation.ExcelProperty; |
| | |
| | | @Data |
| | | @ExcelIgnoreUnannotated |
| | | @AutoMapper(target = EimsEquType.class) |
| | | public class EimsEquTypeVo implements Serializable { |
| | | public class EimsEquTypeVo extends BaseEntity implements Serializable { |
| | | |
| | | @Serial |
| | | private static final long serialVersionUID = 1L; |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package org.dromara.eims.domain.vo; |
| | | |
| | | import org.dromara.common.mybatis.core.domain.BaseEntity; |
| | | import org.dromara.eims.domain.EimsFixtureType; |
| | | 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_fixture_type |
| | | * |
| | | * @author zhuguifei |
| | | * @date 2025-02-17 |
| | | */ |
| | | @Data |
| | | @ExcelIgnoreUnannotated |
| | | @AutoMapper(target = EimsFixtureType.class) |
| | | public class EimsFixtureTypeVo extends BaseEntity implements Serializable { |
| | | |
| | | @Serial |
| | | private static final long serialVersionUID = 1L; |
| | | |
| | | /** |
| | | * |
| | | */ |
| | | @ExcelProperty(value = "") |
| | | private Long id; |
| | | |
| | | /** |
| | | * ç±»ååç§° |
| | | */ |
| | | @ExcelProperty(value = "ç±»ååç§°") |
| | | private String typeName; |
| | | |
| | | /** |
| | | * ç±»åç¼ç |
| | | */ |
| | | @ExcelProperty(value = "ç±»åç¼ç ") |
| | | private String typeCode; |
| | | |
| | | /** |
| | | * ç¶id |
| | | */ |
| | | @ExcelProperty(value = "ç¶id") |
| | | private Long parentId; |
| | | |
| | | /** |
| | | * æ¾ç¤ºé¡ºåº |
| | | */ |
| | | @ExcelProperty(value = "æ¾ç¤ºé¡ºåº") |
| | | private Long orderNum; |
| | | |
| | | /** |
| | | * èåç±»åï¼Mç®å½ Cèå Fæé®ï¼ |
| | | */ |
| | | @ExcelProperty(value = "èåç±»å", converter = ExcelDictConvert.class) |
| | | @ExcelDictFormat(readConverterExp = "M=ç®å½,C=èå,F=æé®") |
| | | private String menuType; |
| | | |
| | | /** |
| | | * èå徿 |
| | | */ |
| | | @ExcelProperty(value = "èå徿 ") |
| | | private String icon; |
| | | |
| | | /** |
| | | * èåç¶æï¼0æ£å¸¸ 1åç¨ï¼ |
| | | */ |
| | | @ExcelProperty(value = "èåç¶æ", converter = ExcelDictConvert.class) |
| | | @ExcelDictFormat(dictType = "sys_show_hide") |
| | | private String status; |
| | | |
| | | /** |
| | | * 夿³¨ |
| | | */ |
| | | @ExcelProperty(value = "夿³¨") |
| | | private String remark; |
| | | |
| | | |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package org.dromara.eims.domain.vo; |
| | | |
| | | import java.util.Date; |
| | | import com.fasterxml.jackson.annotation.JsonFormat; |
| | | import org.dromara.common.translation.annotation.Translation; |
| | | import org.dromara.common.translation.constant.TransConstant; |
| | | import org.dromara.eims.domain.EimsFixture; |
| | | 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_fixture |
| | | * |
| | | * @author zhuguifei |
| | | * @date 2025-02-14 |
| | | */ |
| | | @Data |
| | | @ExcelIgnoreUnannotated |
| | | @AutoMapper(target = EimsFixture.class) |
| | | public class EimsFixtureVo implements Serializable { |
| | | |
| | | @Serial |
| | | private static final long serialVersionUID = 1L; |
| | | |
| | | /** |
| | | * |
| | | */ |
| | | @ExcelProperty(value = "") |
| | | private Long id; |
| | | |
| | | /** |
| | | * æ²»å
·ç¼ç |
| | | */ |
| | | @ExcelProperty(value = "æ²»å
·ç¼ç ") |
| | | private String fixtureCode; |
| | | |
| | | /** |
| | | * æ²»å
·åç§° |
| | | */ |
| | | @ExcelProperty(value = "æ²»å
·åç§°") |
| | | private String fixtureName; |
| | | |
| | | |
| | | /** |
| | | * æ²»å
·ï¼å·¥å
·ï¼ç±»å |
| | | */ |
| | | private Long fixtureType; |
| | | |
| | | /** |
| | | * æ²»å
·ï¼å·¥å
·ï¼ç±»å |
| | | */ |
| | | @ExcelProperty(value = "æ²»å
፱Ȍ") |
| | | @Translation(type = TransConstant.FIXTURE_TYPE_ID_TO_NAME, mapper = "fixtureType") |
| | | private String fixtureTypeName; |
| | | |
| | | /** |
| | | * æ²»å
·æè¿° |
| | | */ |
| | | @ExcelProperty(value = "æ²»å
·æè¿°") |
| | | private String fixtureDesc; |
| | | |
| | | /** |
| | | * åç¨é¨é¨ |
| | | */ |
| | | private Long borrowDept; |
| | | |
| | | /** |
| | | * åç¨é¨é¨ |
| | | */ |
| | | private String borrowDeptName; |
| | | |
| | | /** |
| | | * åç¨äºº |
| | | */ |
| | | private Long borrowUser; |
| | | |
| | | /** |
| | | * åç¨äºº |
| | | */ |
| | | private String borrowUserName; |
| | | |
| | | /** |
| | | * ç¶æï¼åå
¸ï¼ |
| | | */ |
| | | @ExcelProperty(value = "ç¶æ", converter = ExcelDictConvert.class) |
| | | @ExcelDictFormat(dictType = "eims_fixture_status") |
| | | private String status; |
| | | |
| | | /** |
| | | * èµäº§ç¼å· |
| | | */ |
| | | @ExcelProperty(value = "èµäº§ç¼å·") |
| | | private String assetNo; |
| | | |
| | | /** |
| | | * åå· |
| | | */ |
| | | @ExcelProperty(value = "åå·") |
| | | private String modelNo; |
| | | |
| | | /** |
| | | * è§æ ¼ |
| | | */ |
| | | @ExcelProperty(value = "è§æ ¼") |
| | | private String specNo; |
| | | |
| | | /** |
| | | * å¶é å |
| | | */ |
| | | @ExcelProperty(value = "å¶é å") |
| | | private String madeIn; |
| | | |
| | | /** |
| | | * éè´æ¥æ |
| | | */ |
| | | @ExcelProperty(value = "éè´æ¥æ") |
| | | @JsonFormat(pattern = "yyyy-MM-dd") |
| | | private Date purchaseDate; |
| | | |
| | | /** |
| | | * ä½¿ç¨æ¥æ |
| | | */ |
| | | @ExcelProperty(value = "ä½¿ç¨æ¥æ") |
| | | @JsonFormat(pattern = "yyyy-MM-dd") |
| | | private Date deployDate; |
| | | |
| | | /** |
| | | * 使ç¨å¹´é |
| | | */ |
| | | @ExcelProperty(value = "使ç¨å¹´é") |
| | | private Long serviceLife; |
| | | |
| | | /** |
| | | * 夿³¨ |
| | | */ |
| | | @ExcelProperty(value = "夿³¨") |
| | | private String remark; |
| | | |
| | | |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package org.dromara.eims.mapper; |
| | | |
| | | import org.dromara.eims.domain.EimsFixture; |
| | | import org.dromara.eims.domain.vo.EimsFixtureVo; |
| | | import org.dromara.common.mybatis.core.mapper.BaseMapperPlus; |
| | | |
| | | /** |
| | | * å·¥å
·(æ²»å
·)å°è´¦Mapperæ¥å£ |
| | | * |
| | | * @author zhuguifei |
| | | * @date 2025-02-14 |
| | | */ |
| | | public interface EimsFixtureMapper extends BaseMapperPlus<EimsFixture, EimsFixtureVo> { |
| | | |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package org.dromara.eims.mapper; |
| | | |
| | | import org.dromara.eims.domain.EimsFixtureType; |
| | | import org.dromara.eims.domain.vo.EimsFixtureTypeVo; |
| | | import org.dromara.common.mybatis.core.mapper.BaseMapperPlus; |
| | | |
| | | /** |
| | | * å·¥å
·ç±»åMapperæ¥å£ |
| | | * |
| | | * @author zhuguifei |
| | | * @date 2025-02-17 |
| | | */ |
| | | public interface EimsFixtureTypeMapper extends BaseMapperPlus<EimsFixtureType, EimsFixtureTypeVo> { |
| | | |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package org.dromara.eims.service; |
| | | |
| | | import org.dromara.eims.domain.vo.EimsFixtureVo; |
| | | import org.dromara.eims.domain.bo.EimsFixtureBo; |
| | | 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-14 |
| | | */ |
| | | public interface IEimsFixtureService { |
| | | |
| | | /** |
| | | * æ¥è¯¢å·¥å
·(æ²»å
·)å°è´¦ |
| | | * |
| | | * @param id ä¸»é® |
| | | * @return å·¥å
·(æ²»å
·)å°è´¦ |
| | | */ |
| | | EimsFixtureVo queryById(Long id); |
| | | |
| | | /** |
| | | * å页æ¥è¯¢å·¥å
·(æ²»å
·)å°è´¦å表 |
| | | * |
| | | * @param bo æ¥è¯¢æ¡ä»¶ |
| | | * @param pageQuery å页忰 |
| | | * @return å·¥å
·(æ²»å
·)å°è´¦å页å表 |
| | | */ |
| | | TableDataInfo<EimsFixtureVo> queryPageList(EimsFixtureBo bo, PageQuery pageQuery); |
| | | |
| | | /** |
| | | * æ¥è¯¢ç¬¦åæ¡ä»¶çå·¥å
·(æ²»å
·)å°è´¦å表 |
| | | * |
| | | * @param bo æ¥è¯¢æ¡ä»¶ |
| | | * @return å·¥å
·(æ²»å
·)å°è´¦å表 |
| | | */ |
| | | List<EimsFixtureVo> queryList(EimsFixtureBo bo); |
| | | |
| | | /** |
| | | * æ°å¢å·¥å
·(æ²»å
·)å°è´¦ |
| | | * |
| | | * @param bo å·¥å
·(æ²»å
·)å°è´¦ |
| | | * @return æ¯å¦æ°å¢æå |
| | | */ |
| | | Boolean insertByBo(EimsFixtureBo bo); |
| | | |
| | | /** |
| | | * ä¿®æ¹å·¥å
·(æ²»å
·)å°è´¦ |
| | | * |
| | | * @param bo å·¥å
·(æ²»å
·)å°è´¦ |
| | | * @return æ¯å¦ä¿®æ¹æå |
| | | */ |
| | | Boolean updateByBo(EimsFixtureBo bo); |
| | | |
| | | /** |
| | | * æ ¡éªå¹¶æ¹éå é¤å·¥å
·(æ²»å
·)å°è´¦ä¿¡æ¯ |
| | | * |
| | | * @param ids å¾
å é¤ç主é®éå |
| | | * @param isValid æ¯å¦è¿è¡æææ§æ ¡éª |
| | | * @return æ¯å¦å 餿å |
| | | */ |
| | | Boolean deleteWithValidByIds(Collection<Long> ids, Boolean isValid); |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package org.dromara.eims.service; |
| | | |
| | | import cn.hutool.core.lang.tree.Tree; |
| | | import org.dromara.eims.domain.bo.EimsEquTypeBo; |
| | | import org.dromara.eims.domain.vo.EimsFixtureTypeVo; |
| | | import org.dromara.eims.domain.bo.EimsFixtureTypeBo; |
| | | |
| | | import java.util.Collection; |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * å·¥å
·ç±»åServiceæ¥å£ |
| | | * |
| | | * @author zhuguifei |
| | | * @date 2025-02-17 |
| | | */ |
| | | public interface IEimsFixtureTypeService { |
| | | |
| | | /** |
| | | * æ¥è¯¢å·¥å
፱Ȍ |
| | | * |
| | | * @param id ä¸»é® |
| | | * @return å·¥å
፱Ȍ |
| | | */ |
| | | EimsFixtureTypeVo queryById(Long id); |
| | | |
| | | |
| | | /** |
| | | * æ¥è¯¢ç¬¦åæ¡ä»¶çå·¥å
·ç±»åå表 |
| | | * |
| | | * @param bo æ¥è¯¢æ¡ä»¶ |
| | | * @return å·¥å
·ç±»åå表 |
| | | */ |
| | | List<EimsFixtureTypeVo> queryList(EimsFixtureTypeBo bo); |
| | | |
| | | /** |
| | | * æ°å¢å·¥å
፱Ȍ |
| | | * |
| | | * @param bo å·¥å
፱Ȍ |
| | | * @return æ¯å¦æ°å¢æå |
| | | */ |
| | | Boolean insertByBo(EimsFixtureTypeBo bo); |
| | | |
| | | /** |
| | | * ä¿®æ¹å·¥å
፱Ȍ |
| | | * |
| | | * @param bo å·¥å
፱Ȍ |
| | | * @return æ¯å¦ä¿®æ¹æå |
| | | */ |
| | | Boolean updateByBo(EimsFixtureTypeBo bo); |
| | | |
| | | /** |
| | | * æ ¡éªå¹¶æ¹éå é¤å·¥å
·ç±»åä¿¡æ¯ |
| | | * |
| | | * @param ids å¾
å é¤ç主é®éå |
| | | * @param isValid æ¯å¦è¿è¡æææ§æ ¡éª |
| | | * @return æ¯å¦å 餿å |
| | | */ |
| | | Boolean deleteWithValidByIds(Collection<Long> ids, Boolean isValid); |
| | | |
| | | /** |
| | | * è·åå·¥å
·ç±»åæ å表 |
| | | * |
| | | * @param bo |
| | | * @return æ å表 |
| | | */ |
| | | List<Tree<Long>> selectFixtureTypeTreeList(EimsFixtureTypeBo bo); |
| | | } |
| | |
| | | */ |
| | | @Override |
| | | public List<Tree<Long>> selectEquTypeTreeList(EimsEquTypeBo bo) { |
| | | // åªæ¥è¯¢æªç¦ç¨é¨é¨ |
| | | // åªæ¥è¯¢æªç¦ç¨ç±»å |
| | | bo.setStatus(UserConstants.DEPT_NORMAL); |
| | | LambdaQueryWrapper<EimsEquType> lqw = buildQueryWrapper(bo); |
| | | List<EimsEquTypeVo> equTypeVoList = baseMapper.selectVoList(lqw); |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package org.dromara.eims.service.impl; |
| | | |
| | | import cn.hutool.core.convert.Convert; |
| | | 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.SpringUtils; |
| | | 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.eims.domain.EimsEqu; |
| | | import org.dromara.eims.domain.EimsEquType; |
| | | import org.dromara.eims.domain.EimsFixtureType; |
| | | import org.dromara.eims.domain.vo.EimsEquTypeVo; |
| | | import org.dromara.eims.domain.vo.EimsEquVo; |
| | | import org.dromara.eims.domain.vo.EimsFixtureTypeVo; |
| | | import org.dromara.eims.mapper.EimsFixtureTypeMapper; |
| | | import org.springframework.stereotype.Service; |
| | | import org.dromara.eims.domain.bo.EimsFixtureBo; |
| | | import org.dromara.eims.domain.vo.EimsFixtureVo; |
| | | import org.dromara.eims.domain.EimsFixture; |
| | | import org.dromara.eims.mapper.EimsFixtureMapper; |
| | | import org.dromara.eims.service.IEimsFixtureService; |
| | | |
| | | import java.util.ArrayList; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | import java.util.Collection; |
| | | |
| | | /** |
| | | * å·¥å
·(æ²»å
·)å°è´¦Serviceä¸å¡å±å¤ç |
| | | * |
| | | * @author zhuguifei |
| | | * @date 2025-02-14 |
| | | */ |
| | | @RequiredArgsConstructor |
| | | @Service |
| | | public class EimsFixtureServiceImpl implements IEimsFixtureService { |
| | | |
| | | private final EimsFixtureMapper baseMapper; |
| | | private final EimsFixtureTypeMapper fixtureTypeMapper; |
| | | |
| | | /** |
| | | * æ¥è¯¢å·¥å
·(æ²»å
·)å°è´¦ |
| | | * |
| | | * @param id ä¸»é® |
| | | * @return å·¥å
·(æ²»å
·)å°è´¦ |
| | | */ |
| | | @Override |
| | | public EimsFixtureVo queryById(Long id){ |
| | | return baseMapper.selectVoById(id); |
| | | } |
| | | |
| | | /** |
| | | * å页æ¥è¯¢å·¥å
·(æ²»å
·)å°è´¦å表 |
| | | * |
| | | * @param bo æ¥è¯¢æ¡ä»¶ |
| | | * @param pageQuery å页忰 |
| | | * @return å·¥å
·(æ²»å
·)å°è´¦å页å表 |
| | | */ |
| | | @Override |
| | | public TableDataInfo<EimsFixtureVo> queryPageList(EimsFixtureBo bo, PageQuery pageQuery) { |
| | | LambdaQueryWrapper<EimsFixture> lqw = buildQueryWrapper(bo); |
| | | Page<EimsFixtureVo> result = baseMapper.selectVoPage(pageQuery.build(), lqw); |
| | | return TableDataInfo.build(result); |
| | | } |
| | | |
| | | /** |
| | | * æ¥è¯¢ç¬¦åæ¡ä»¶çå·¥å
·(æ²»å
·)å°è´¦å表 |
| | | * |
| | | * @param bo æ¥è¯¢æ¡ä»¶ |
| | | * @return å·¥å
·(æ²»å
·)å°è´¦å表 |
| | | */ |
| | | @Override |
| | | public List<EimsFixtureVo> queryList(EimsFixtureBo bo) { |
| | | LambdaQueryWrapper<EimsFixture> lqw = buildQueryWrapper(bo); |
| | | return baseMapper.selectVoList(lqw); |
| | | } |
| | | |
| | | private LambdaQueryWrapper<EimsFixture> buildQueryWrapper(EimsFixtureBo bo) { |
| | | Map<String, Object> params = bo.getParams(); |
| | | LambdaQueryWrapper<EimsFixture> lqw = Wrappers.lambdaQuery(); |
| | | lqw.like(StringUtils.isNotBlank(bo.getFixtureCode()), EimsFixture::getFixtureCode, bo.getFixtureCode()); |
| | | lqw.like(StringUtils.isNotBlank(bo.getFixtureName()), EimsFixture::getFixtureName, bo.getFixtureName()); |
| | | Long fixtureType = bo.getFixtureType(); |
| | | /** |
| | | * equTypeId = 0 æ¶æ¥è¯¢ææè®¾å¤ï¼é»è®¤æ ¹ç®å½id为0ï¼è¯¦è§SysEquTypeServiceImplä¸selectEquTypeTreeListï¼ |
| | | * equTypeId 为å
¶ä»å¼æ¶åªæ¥å½å设å¤ç±»åidåå代设å¤ç±»åid |
| | | */ |
| | | if (fixtureType != null && fixtureType > 0) { |
| | | List<Long> allDescendantIds = getAllDescendantIds(fixtureType); |
| | | lqw.in(EimsFixture::getFixtureType, allDescendantIds); |
| | | } |
| | | |
| | | |
| | | lqw.eq(StringUtils.isNotBlank(bo.getFixtureDesc()), EimsFixture::getFixtureDesc, bo.getFixtureDesc()); |
| | | lqw.eq(bo.getBorrowDept()!=null, EimsFixture::getBorrowDept, bo.getBorrowDept()); |
| | | lqw.eq(bo.getBorrowUser()!=null, EimsFixture::getBorrowUser, bo.getBorrowUser()); |
| | | lqw.eq(StringUtils.isNotBlank(bo.getStatus()), EimsFixture::getStatus, bo.getStatus()); |
| | | lqw.like(StringUtils.isNotBlank(bo.getAssetNo()), EimsFixture::getAssetNo, bo.getAssetNo()); |
| | | lqw.like(StringUtils.isNotBlank(bo.getModelNo()), EimsFixture::getModelNo, bo.getModelNo()); |
| | | lqw.like(StringUtils.isNotBlank(bo.getSpecNo()), EimsFixture::getSpecNo, bo.getSpecNo()); |
| | | lqw.like(StringUtils.isNotBlank(bo.getMadeIn()), EimsFixture::getMadeIn, bo.getMadeIn()); |
| | | lqw.between(params.get("beginPurchaseDate") != null && params.get("endPurchaseDate") != null, |
| | | EimsFixture::getPurchaseDate ,params.get("beginPurchaseDate"), params.get("endPurchaseDate")); |
| | | lqw.between(params.get("beginDeployDate") != null && params.get("endDeployDate") != null, |
| | | EimsFixture::getDeployDate ,params.get("beginDeployDate"), params.get("endDeployDate")); |
| | | lqw.eq(bo.getServiceLife() != null, EimsFixture::getServiceLife, bo.getServiceLife()); |
| | | return lqw; |
| | | } |
| | | |
| | | /** |
| | | * æ ¹æ®idï¼è·åææå代id |
| | | * |
| | | * @param rootId |
| | | * @return |
| | | */ |
| | | public List<Long> getAllDescendantIds(Long rootId) { |
| | | List<Long> result = new ArrayList<>(); |
| | | result.add(rootId); |
| | | collectDescendants(rootId, result); |
| | | return result; |
| | | } |
| | | |
| | | private void collectDescendants(Long currentId, List<Long> collector) { |
| | | QueryWrapper<EimsFixtureType> fixTypeWrapper = new QueryWrapper<>(); |
| | | fixTypeWrapper.lambda().eq(EimsFixtureType::getParentId, currentId); |
| | | |
| | | List<EimsFixtureTypeVo> children = fixtureTypeMapper.selectVoList(fixTypeWrapper); |
| | | if (children != null && !children.isEmpty()) { |
| | | for (EimsFixtureTypeVo child : children) { |
| | | Long childId = child.getId(); |
| | | collector.add(childId); |
| | | collectDescendants(childId, collector); |
| | | } |
| | | } |
| | | } |
| | | |
| | | |
| | | /** |
| | | * æ°å¢å·¥å
·(æ²»å
·)å°è´¦ |
| | | * |
| | | * @param bo å·¥å
·(æ²»å
·)å°è´¦ |
| | | * @return æ¯å¦æ°å¢æå |
| | | */ |
| | | @Override |
| | | public Boolean insertByBo(EimsFixtureBo bo) { |
| | | EimsFixture add = MapstructUtils.convert(bo, EimsFixture.class); |
| | | validEntityBeforeSave(add); |
| | | boolean flag = baseMapper.insert(add) > 0; |
| | | if (flag) { |
| | | bo.setId(add.getId()); |
| | | } |
| | | return flag; |
| | | } |
| | | |
| | | /** |
| | | * ä¿®æ¹å·¥å
·(æ²»å
·)å°è´¦ |
| | | * |
| | | * @param bo å·¥å
·(æ²»å
·)å°è´¦ |
| | | * @return æ¯å¦ä¿®æ¹æå |
| | | */ |
| | | @Override |
| | | public Boolean updateByBo(EimsFixtureBo bo) { |
| | | EimsFixture update = MapstructUtils.convert(bo, EimsFixture.class); |
| | | validEntityBeforeSave(update); |
| | | return baseMapper.updateById(update) > 0; |
| | | } |
| | | |
| | | /** |
| | | * ä¿ååçæ°æ®æ ¡éª |
| | | */ |
| | | private void validEntityBeforeSave(EimsFixture 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.convert.Convert; |
| | | import cn.hutool.core.lang.tree.Tree; |
| | | import cn.hutool.core.util.ObjectUtil; |
| | | import org.dromara.common.core.constant.UserConstants; |
| | | import org.dromara.common.core.service.FixtureTypeService; |
| | | import org.dromara.common.core.utils.MapstructUtils; |
| | | import org.dromara.common.core.utils.SpringUtils; |
| | | import org.dromara.common.core.utils.StringUtils; |
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | | import com.baomidou.mybatisplus.core.toolkit.Wrappers; |
| | | import lombok.RequiredArgsConstructor; |
| | | import org.dromara.common.core.utils.TreeBuildUtils; |
| | | import org.dromara.eims.domain.EimsEquType; |
| | | import org.dromara.eims.domain.bo.EimsEquTypeBo; |
| | | import org.dromara.eims.domain.vo.EimsEquTypeVo; |
| | | import org.springframework.stereotype.Service; |
| | | import org.dromara.eims.domain.bo.EimsFixtureTypeBo; |
| | | import org.dromara.eims.domain.vo.EimsFixtureTypeVo; |
| | | import org.dromara.eims.domain.EimsFixtureType; |
| | | import org.dromara.eims.mapper.EimsFixtureTypeMapper; |
| | | import org.dromara.eims.service.IEimsFixtureTypeService; |
| | | |
| | | import java.util.ArrayList; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | import java.util.Collection; |
| | | |
| | | /** |
| | | * å·¥å
·ç±»åServiceä¸å¡å±å¤ç |
| | | * |
| | | * @author zhuguifei |
| | | * @date 2025-02-17 |
| | | */ |
| | | @RequiredArgsConstructor |
| | | @Service |
| | | public class EimsFixtureTypeServiceImpl implements IEimsFixtureTypeService, FixtureTypeService { |
| | | |
| | | private final EimsFixtureTypeMapper baseMapper; |
| | | |
| | | /** |
| | | * æ¥è¯¢å·¥å
፱Ȍ |
| | | * |
| | | * @param id ä¸»é® |
| | | * @return å·¥å
፱Ȍ |
| | | */ |
| | | @Override |
| | | public EimsFixtureTypeVo queryById(Long id){ |
| | | return baseMapper.selectVoById(id); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * æ¥è¯¢ç¬¦åæ¡ä»¶çå·¥å
·ç±»åå表 |
| | | * |
| | | * @param bo æ¥è¯¢æ¡ä»¶ |
| | | * @return å·¥å
·ç±»åå表 |
| | | */ |
| | | @Override |
| | | public List<EimsFixtureTypeVo> queryList(EimsFixtureTypeBo bo) { |
| | | LambdaQueryWrapper<EimsFixtureType> lqw = buildQueryWrapper(bo); |
| | | return baseMapper.selectVoList(lqw); |
| | | } |
| | | |
| | | private LambdaQueryWrapper<EimsFixtureType> buildQueryWrapper(EimsFixtureTypeBo bo) { |
| | | Map<String, Object> params = bo.getParams(); |
| | | LambdaQueryWrapper<EimsFixtureType> lqw = Wrappers.lambdaQuery(); |
| | | lqw.like(StringUtils.isNotBlank(bo.getTypeName()), EimsFixtureType::getTypeName, bo.getTypeName()); |
| | | lqw.like(StringUtils.isNotBlank(bo.getTypeCode()), EimsFixtureType::getTypeCode, bo.getTypeCode()); |
| | | lqw.eq(StringUtils.isNotBlank(bo.getStatus()), EimsFixtureType::getStatus, bo.getStatus()); |
| | | return lqw; |
| | | } |
| | | |
| | | /** |
| | | * æ°å¢å·¥å
፱Ȍ |
| | | * |
| | | * @param bo å·¥å
፱Ȍ |
| | | * @return æ¯å¦æ°å¢æå |
| | | */ |
| | | @Override |
| | | public Boolean insertByBo(EimsFixtureTypeBo bo) { |
| | | EimsFixtureType add = MapstructUtils.convert(bo, EimsFixtureType.class); |
| | | validEntityBeforeSave(add); |
| | | boolean flag = baseMapper.insert(add) > 0; |
| | | if (flag) { |
| | | bo.setId(add.getId()); |
| | | } |
| | | return flag; |
| | | } |
| | | |
| | | /** |
| | | * ä¿®æ¹å·¥å
፱Ȍ |
| | | * |
| | | * @param bo å·¥å
፱Ȍ |
| | | * @return æ¯å¦ä¿®æ¹æå |
| | | */ |
| | | @Override |
| | | public Boolean updateByBo(EimsFixtureTypeBo bo) { |
| | | EimsFixtureType update = MapstructUtils.convert(bo, EimsFixtureType.class); |
| | | validEntityBeforeSave(update); |
| | | return baseMapper.updateById(update) > 0; |
| | | } |
| | | |
| | | /** |
| | | * ä¿ååçæ°æ®æ ¡éª |
| | | */ |
| | | private void validEntityBeforeSave(EimsFixtureType entity){ |
| | | //TODO åä¸äºæ°æ®æ ¡éª,å¦å¯ä¸çº¦æ |
| | | } |
| | | |
| | | /** |
| | | * æ ¡éªå¹¶æ¹éå é¤å·¥å
·ç±»åä¿¡æ¯ |
| | | * |
| | | * @param ids å¾
å é¤ç主é®éå |
| | | * @param isValid æ¯å¦è¿è¡æææ§æ ¡éª |
| | | * @return æ¯å¦å 餿å |
| | | */ |
| | | @Override |
| | | public Boolean deleteWithValidByIds(Collection<Long> ids, Boolean isValid) { |
| | | if(isValid){ |
| | | //TODO åä¸äºä¸å¡ä¸çæ ¡éª,夿æ¯å¦éè¦æ ¡éª |
| | | } |
| | | return baseMapper.deleteByIds(ids) > 0; |
| | | } |
| | | |
| | | @Override |
| | | public List<Tree<Long>> selectFixtureTypeTreeList(EimsFixtureTypeBo bo) { |
| | | // åªæ¥è¯¢æªç¦ç¨ç±»å |
| | | bo.setStatus(UserConstants.DEPT_NORMAL); |
| | | LambdaQueryWrapper<EimsFixtureType> lqw = buildQueryWrapper(bo); |
| | | List<EimsFixtureTypeVo> fixtureTypeVoList = baseMapper.selectVoList(lqw); |
| | | |
| | | for (int i = 0; i < fixtureTypeVoList.size(); i++) { |
| | | EimsFixtureTypeVo fixtureTypeVo = fixtureTypeVoList.get(i); |
| | | if(fixtureTypeVo.getParentId() == null){ |
| | | fixtureTypeVoList.get(i).setParentId(0L); |
| | | } |
| | | } |
| | | //å æ ¹ç®å½ |
| | | EimsFixtureTypeVo root = new EimsFixtureTypeVo(); |
| | | root.setId(0L); |
| | | root.setMenuType("M"); |
| | | root.setTypeName("ææå·¥å
·"); |
| | | root.setStatus("0"); |
| | | root.setTypeCode("0"); |
| | | root.setOrderNum(0L); |
| | | root.setIcon("#"); |
| | | fixtureTypeVoList.add(root); |
| | | fixtureTypeVoList.sort((o1, o2) -> o1.getId().compareTo(o2.getId())); |
| | | return buildEquTypeTreeSelect(fixtureTypeVoList); |
| | | } |
| | | |
| | | /** |
| | | * æå»ºå端æéè¦ä¸ææ ç»æ |
| | | * |
| | | * @param fixtureTypeVoList å·¥å
·ç±»åå表 |
| | | * @return 䏿æ ç»æå表 |
| | | */ |
| | | public List<Tree<Long>> buildEquTypeTreeSelect(List<EimsFixtureTypeVo> fixtureTypeVoList) { |
| | | if (CollUtil.isEmpty(fixtureTypeVoList)) { |
| | | return CollUtil.newArrayList(); |
| | | } |
| | | return TreeBuildUtils.build(fixtureTypeVoList, (dept, tree) -> |
| | | tree.setId(dept.getId()) |
| | | .setParentId(dept.getParentId()) |
| | | .setName(dept.getTypeName()) |
| | | .setWeight(dept.getOrderNum())); |
| | | } |
| | | |
| | | @Override |
| | | public String selectFixtureTypeNameByIds(String fixIds) { |
| | | List<String> list = new ArrayList<>(); |
| | | for (Long id : StringUtils.splitTo(fixIds, Convert::toLong)) { |
| | | EimsFixtureTypeVo vo = SpringUtils.getAopProxy(this).queryById(id); |
| | | if (ObjectUtil.isNotNull(vo)) { |
| | | list.add(vo.getTypeName()); |
| | | } |
| | | } |
| | | return String.join(StringUtils.SEPARATOR, list); |
| | | } |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | <?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.EimsFixtureMapper"> |
| | | |
| | | </mapper> |