| | |
| | | import type { IDS, PageQuery, PageResult } from '#/api/common'; |
| | | import type { EquVO } from '#/api/eims/equ/model'; |
| | | import type { EquImportParam, EquVO } from '#/api/eims/equ/model'; |
| | | |
| | | import { commonExport } from '#/api/helper'; |
| | | import { commonExport, ContentTypeEnum } from '#/api/helper'; |
| | | import { requestClient } from '#/api/request'; |
| | | |
| | | enum Api { |
| | | equExport = '/eims/equ/export', |
| | | equImport = '/eims/equ/importData', |
| | | equList = '/eims/equ/list', |
| | | root = '/eims/equ' |
| | | root = '/eims/equ', |
| | | userImportTemplate = '/eims/equ/importTemplate' |
| | | } |
| | | |
| | | /** |
| | |
| | | export function equExport(data: any) { |
| | | return commonExport(Api.equExport, data); |
| | | } |
| | | |
| | | /** |
| | | * ä»excel导å
¥è®¾å¤ |
| | | * @param data |
| | | * @returns void |
| | | */ |
| | | export function equImportData(data: EquImportParam) { |
| | | return requestClient.post<{ code: number; msg: string }>(Api.equImport, data, { |
| | | headers: { |
| | | 'Content-Type': ContentTypeEnum.FORM_DATA |
| | | }, |
| | | isTransformResponse: false |
| | | }); |
| | | } |
| | | |
| | | /** |
| | | * ä¸è½½å¯¼å
¥æ¨¡æ¿ |
| | | * @returns blob |
| | | */ |
| | | export function downloadImportTemplate() { |
| | | return requestClient.post<Blob>( |
| | | Api.userImportTemplate, |
| | | {}, |
| | | { |
| | | isTransformResponse: false, |
| | | responseType: 'blob' |
| | | } |
| | | ); |
| | | } |
| | |
| | | */ |
| | | serviceLife: number; |
| | | } |
| | | /** |
| | | * @description: 设å¤å¯¼å
¥ |
| | | * @param updateSupport æ¯å¦è¦çæ°æ® |
| | | * @param file excelæä»¶ |
| | | */ |
| | | export interface EquImportParam { |
| | | updateSupport: boolean; |
| | | file: Blob | File; |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | <script setup lang="ts"> |
| | | import { ref } from 'vue'; |
| | | |
| | | import { useVbenModal } from '@vben/common-ui'; |
| | | |
| | | import { message } from 'ant-design-vue'; |
| | | |
| | | import UserView from '#/views/system/user/index.vue'; |
| | | |
| | | const emit = defineEmits<{ selectUser: [any] }>(); |
| | | |
| | | const [BasicModal, modalApi] = useVbenModal({ |
| | | fullscreenButton: false, |
| | | draggable: true, |
| | | onCancel: handleCancel, |
| | | onConfirm: handleConfirm |
| | | }); |
| | | const userView = ref(); |
| | | |
| | | async function handleConfirm() { |
| | | try { |
| | | modalApi.modalLoading(true); |
| | | const tableSelect = userView.value.tableSelect(); |
| | | if (tableSelect.length > 1) { |
| | | message.error('æå¤åªè½éæ©ä¸ä¸ªæåï¼'); |
| | | modalApi.modalLoading(false); |
| | | return false; |
| | | } |
| | | emit('selectUser', tableSelect[0]); |
| | | await handleCancel(); |
| | | } catch (error) { |
| | | console.error(error); |
| | | } finally { |
| | | modalApi.modalLoading(false); |
| | | } |
| | | } |
| | | |
| | | async function handleCancel() { |
| | | modalApi.close(); |
| | | } |
| | | </script> |
| | | |
| | | <template> |
| | | <BasicModal :fullscreen-button="true" class="w-[800px]"> |
| | | <UserView ref="userView" /> |
| | | </BasicModal> |
| | | </template> |
| | | |
| | | <style scoped></style> |
| | |
| | | { |
| | | title: '设å¤åç§°', |
| | | field: 'equName', |
| | | minWidth: 100, |
| | | minWidth: 140, |
| | | fixed: 'left', |
| | | slots: { default: 'equName' } |
| | | }, |
| | |
| | | sortable: true, |
| | | slots: { |
| | | default: ({ row }) => { |
| | | if (row.status === null || row.status === '') { |
| | | return ''; |
| | | } |
| | | return renderDict(row.status, DictEnum.SYS_EQU_STATUS); |
| | | } |
| | | }, |
| | |
| | | title: 'èµäº§ç¼å·', |
| | | field: 'assetNo', |
| | | sortable: true, |
| | | minWidth: 100, |
| | | minWidth: 140, |
| | | fixed: 'left' |
| | | }, |
| | | { |
| | |
| | | { |
| | | title: '设å¤ç±»å', |
| | | field: 'equTypeName', |
| | | minWidth: 100 |
| | | }, |
| | | { |
| | | title: 'éå®å', |
| | | field: 'seller', |
| | | minWidth: 100 |
| | | }, |
| | | { |
| | | title: 'åä½', |
| | | field: 'unit', |
| | | minWidth: 60 |
| | | }, |
| | | { |
| | | title: 'éè´äºº', |
| | | field: 'purchaseUser', |
| | | minWidth: 100 |
| | | }, |
| | | { |
| | | title: 'ç»æäºº', |
| | | field: 'handleUser', |
| | | minWidth: 100 |
| | | }, |
| | | { |
| | | title: 'èµæ', |
| | | field: 'profile', |
| | | minWidth: 100 |
| | | }, |
| | | { |
| | |
| | | { |
| | | title: '导å
¥ç¶æ', |
| | | field: 'importStatus', |
| | | slots: { default: 'importStatus' }, |
| | | slots: { |
| | | default: ({ row }) => { |
| | | return row.importStatus === null || row.importStatus === '' ? '' : renderDict(row.importStatus, DictEnum.EQU_IMPORT_STATU); |
| | | } |
| | | }, |
| | | minWidth: 100 |
| | | }, |
| | | { |
| | | title: 'çç¹æ å¿', |
| | | field: 'inventoryFlag', |
| | | slots: { default: 'inventoryFlag' }, |
| | | slots: { |
| | | default: ({ row }) => { |
| | | return row.inventoryFlag === null || row.inventoryFlag === '' ? '' : renderDict(row.inventoryFlag, DictEnum.EIMS_INVENTORY_STATU); |
| | | } |
| | | }, |
| | | minWidth: 100 |
| | | }, |
| | | { |
| | |
| | | label: 'èµäº§ç¼å·' |
| | | }, |
| | | { |
| | | component: 'Select', |
| | | componentProps: { |
| | | options: getDictOptions(DictEnum.EIMS_EQU_UNIT) |
| | | }, |
| | | fieldName: 'unit', |
| | | label: 'åä½' |
| | | }, |
| | | { |
| | | component: 'Input', |
| | | fieldName: 'purchaseUserName', |
| | | label: 'éè´äºº' |
| | | }, |
| | | { |
| | | component: 'Input', |
| | | fieldName: 'purchaseUser', |
| | | label: 'éè´äºº', |
| | | dependencies: { |
| | | show: () => false, |
| | | triggerFields: [''] |
| | | } |
| | | }, |
| | | { |
| | | component: 'Input', |
| | | fieldName: 'handleUserName', |
| | | label: 'ç»æäºº' |
| | | }, |
| | | { |
| | | component: 'Input', |
| | | fieldName: 'handleUser', |
| | | label: 'ç»æäºº', |
| | | dependencies: { |
| | | show: () => false, |
| | | triggerFields: [''] |
| | | } |
| | | }, |
| | | { |
| | | component: 'Input', |
| | | fieldName: 'modelNo', |
| | | label: 'åå·' |
| | |
| | | component: 'Input', |
| | | fieldName: 'madeIn', |
| | | label: 'å¶é å' |
| | | }, |
| | | { |
| | | component: 'Input', |
| | | fieldName: 'seller', |
| | | label: 'éå®å' |
| | | }, |
| | | { |
| | | component: 'Input', |
| | |
| | | options: getDictOptions(DictEnum.SYS_EQU_STATUS), |
| | | optionType: 'button' |
| | | }, |
| | | defaultValue: '0', |
| | | defaultValue: '5', |
| | | fieldName: 'status', |
| | | label: 'ç¶æ' |
| | | }, |
| | |
| | | component: 'RadioGroup', |
| | | componentProps: { |
| | | buttonStyle: 'solid', |
| | | options: getDictOptions(DictEnum.SYS_NORMAL_DISABLE), |
| | | options: getDictOptions(DictEnum.EQU_IMPORT_STATU), |
| | | optionType: 'button' |
| | | }, |
| | | defaultValue: '0', |
| | |
| | | component: 'RadioGroup', |
| | | componentProps: { |
| | | buttonStyle: 'solid', |
| | | options: getDictOptions(DictEnum.SYS_NORMAL_DISABLE), |
| | | options: getDictOptions(DictEnum.EIMS_INVENTORY_STATU), |
| | | optionType: 'button' |
| | | }, |
| | | defaultValue: '0', |
| | | fieldName: 'inventoryFlag', |
| | | formItemClass: 'col-span-2 lg:col-span-1', |
| | | formItemClass: 'col-span-2', |
| | | label: 'çç¹æ å¿' |
| | | }, |
| | | { |
| | |
| | | <script setup lang="ts"> |
| | | import { computed, ref } from 'vue'; |
| | | |
| | | import { useVbenDrawer } from '@vben/common-ui'; |
| | | import { useVbenDrawer, useVbenModal } from '@vben/common-ui'; |
| | | import { $t } from '@vben/locales'; |
| | | import { addFullName, cloneDeep, getPopupContainer, listToTree } from '@vben/utils'; |
| | | |
| | | import { InputSearch } from 'ant-design-vue'; |
| | | |
| | | import { useVbenForm } from '#/adapter/form'; |
| | | import { addEqu, getEqu, updateEqu } from '#/api/eims/equ'; |
| | | import { getEquType, listEquType } from '#/api/eims/equ-type'; |
| | | import { getDeptTree, userList } from '#/api/system/user'; |
| | | import userModal from '#/views/eims/components/user-modal.vue'; |
| | | |
| | | import { drawerSchema } from './data'; |
| | | |
| | |
| | | const record = await getEqu(id); |
| | | await formApi.setValues(record); |
| | | if(isUpdate.value && record.deptUsed){ |
| | | await setupUserOptions(record.deptUsed) |
| | | await setupUserOptions(record.deptUsed); |
| | | } |
| | | |
| | | } |
| | | |
| | | // å 载设å¤ç±»åæ éæ© |
| | |
| | | } |
| | | }); |
| | | |
| | | // user modal |
| | | const [UserModal, userModalApi] = useVbenModal({ |
| | | connectedComponent: userModal, |
| | | draggable: true, |
| | | title: 'éæ©æå' |
| | | }); |
| | | |
| | | function handleOpenModal() { |
| | | userModalApi.setData({}); |
| | | userModalApi.open(); |
| | | } |
| | | |
| | | /** |
| | | * æå¼éæ©æå |
| | | */ |
| | | const column = ref<string>(); |
| | | function onOpenSelectUser(type: any) { |
| | | column.value = type; |
| | | handleOpenModal(); |
| | | } |
| | | |
| | | /** |
| | | * æ´æ°éæ©çæå |
| | | * @param user |
| | | */ |
| | | async function selectUser(user: any) { |
| | | if (column.value === 'purchaseUser') { |
| | | await formApi.setValues({ 'purchaseUser': user.userId, 'purchaseUserName': user.nickName }); |
| | | } else if (column.value === 'handleUserName') { |
| | | await formApi.setValues({ 'handleUser': user.userId, 'handleUserName': user.nickName }); |
| | | } |
| | | } |
| | | |
| | | async function setupEquTypeSelect() { |
| | | // status-0 åªæ¥è¯¢æªåç¨è®¾å¤ |
| | |
| | | { |
| | | equTypeId: 0, |
| | | typeName: $t('menu.root'), |
| | | children: equTree, |
| | | }, |
| | | children: equTree |
| | | } |
| | | ]; |
| | | addFullName(fullEquTree, 'typeName', ' / '); |
| | | formApi.updateSchema([ |
| | |
| | | componentProps: { |
| | | fieldNames: { |
| | | label: 'typeName', |
| | | value: 'equTypeId', |
| | | value: 'equTypeId' |
| | | }, |
| | | getPopupContainer, |
| | | // è®¾ç½®å¼¹çªæ»å¨é«åº¦ é»è®¤256 |
| | |
| | | treeLine: { showLeafIcon: false }, |
| | | // çéçåæ®µ |
| | | treeNodeFilterProp: 'typeName', |
| | | treeNodeLabelProp: 'fullName', |
| | | treeNodeLabelProp: 'fullName' |
| | | }, |
| | | fieldName: 'equTypeId', |
| | | }, |
| | | fieldName: 'equTypeId' |
| | | } |
| | | ]); |
| | | } |
| | | |
| | |
| | | |
| | | <template> |
| | | <BasicDrawer :close-on-click-modal="false" :title="title" class="w-[600px]"> |
| | | <BasicForm /> |
| | | <BasicForm> |
| | | <template #purchaseUserName="slotProps"> |
| | | <InputSearch :enter-button="true" placeholder="è¯·éæ©" @search="onOpenSelectUser('purchaseUser')" v-bind="slotProps" /> |
| | | </template> |
| | | <template #handleUserName="slotProps"> |
| | | <InputSearch :enter-button="true" placeholder="è¯·éæ©" @search="onOpenSelectUser('handleUserName')" v-bind="slotProps" /> |
| | | </template> |
| | | </BasicForm> |
| | | <UserModal class="w-[1200px]" @select-user="selectUser" /> |
| | | </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> |
| | |
| | | import { ref } from 'vue'; |
| | | import { useRouter } from 'vue-router'; |
| | | |
| | | import { Page, useVbenDrawer, type VbenFormProps } from '@vben/common-ui'; |
| | | import { Page, useVbenDrawer, useVbenModal, type VbenFormProps } from '@vben/common-ui'; |
| | | import { $t } from '@vben/locales'; |
| | | import { getVxePopupContainer } from '@vben/utils'; |
| | | |
| | | import { Modal, Popconfirm, Space } from 'ant-design-vue'; |
| | |
| | | |
| | | import { columns, querySchema } from './data'; |
| | | import equDrawer from './equ-drawer.vue'; |
| | | import equImportModal from './equ-import-modal.vue'; |
| | | import EquTypeTree from './equ-type-tree.vue'; |
| | | |
| | | // 左边é¨é¨ç¨ |
| | |
| | | connectedComponent: equDrawer |
| | | }); |
| | | |
| | | /** |
| | | * 导å
¥ |
| | | */ |
| | | const [EquImportModal, equImportModalApi] = useVbenModal({ |
| | | connectedComponent: equImportModal |
| | | }); |
| | | |
| | | function handleImport() { |
| | | equImportModalApi.open(); |
| | | } |
| | | |
| | | function handleAdd() { |
| | | equDrawerApi.setData({}); |
| | | equDrawerApi.open(); |
| | |
| | | return importStatus ? 'æªå¯¼å
¥' : '已导å
¥'; |
| | | } |
| | | |
| | | function getInventoryFlag(row: any) { |
| | | const inventoryFlag = row.inventoryFlag === null || row.inventoryFlag; |
| | | return inventoryFlag ? 'æªçç¹' : 'å·²çç¹'; |
| | | } |
| | | |
| | | const router = useRouter(); |
| | | function handleDetail(record: Recordable<any>) { |
| | | router.push(`/equ/detail/${record.equId}`); |
| | |
| | | <Space> |
| | | <a-button v-access:code="['eims:equ:export']" @click="handleDownloadExcel"> |
| | | {{ $t('pages.common.export') }} |
| | | </a-button> |
| | | <a-button v-access:code="['eims:equ:import']" @click="handleImport"> |
| | | {{ $t('pages.common.import') }} |
| | | </a-button> |
| | | <a-button :disabled="!vxeCheckboxChecked(tableApi)" danger type="primary" v-access:code="['eims:equ:remove']" @click="handleMultiDelete"> |
| | | {{ $t('pages.common.delete') }} |
| | |
| | | <template #importStatus="{ row }"> |
| | | <span>{{ getImportStatus(row) }}</span> |
| | | </template> |
| | | |
| | | <template #inventoryFlag="{ row }"> |
| | | <span>{{ getInventoryFlag(row) }}</span> |
| | | </template> |
| | | </BasicTable> |
| | | </div> |
| | | <EquDrawer @reload="tableApi.query()" /> |
| | | <EquImportModal @reload="tableApi.query()" /> |
| | | </Page> |
| | | </template> |
| | |
| | | minWidth: 200 |
| | | }, |
| | | { |
| | | title: '设å¤åç§°', |
| | | field: 'equName', |
| | | sortable: true, |
| | | minWidth: 120 |
| | | }, |
| | | { |
| | | title: 'æ
éç±»å«', |
| | | field: 'faultType', |
| | | minWidth: 100, |
| | |
| | | import { delRepairReq, listRepairReq, repairReqExport } from '#/api/eims/repair-req'; |
| | | import { getDeptTree, userList } from '#/api/system/user'; |
| | | import { commonDownloadExcel } from '#/utils/file/download'; |
| | | import { useRoleBaseFilters } from '#/views/eims/repair-req/use-role-base-filters'; |
| | | |
| | | import { columns, querySchema } from './data'; |
| | | import repairReqDrawer from './repair-req-drawer.vue'; |
| | |
| | | return await listRepairReq({ |
| | | pageNum: page.currentPage, |
| | | pageSize: page.pageSize, |
| | | ...formValues |
| | | ...formValues, |
| | | ...useRoleBaseFilters() |
| | | }); |
| | | } |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | import { computed } from 'vue'; |
| | | |
| | | import { useAccess } from '@vben/access'; |
| | | import { useUserStore } from '@vben/stores'; |
| | | |
| | | const userStore = useUserStore(); |
| | | const userId = userStore.userInfo?.userId; |
| | | |
| | | const { hasAccessByRoles } = useAccess(); |
| | | // æä½å·¥ |
| | | const operator = computed(() => hasAccessByRoles(['operator'])); |
| | | // 维修工 |
| | | const repair = computed(() => hasAccessByRoles(['repair'])); |
| | | |
| | | export function useRoleBaseFilters() { |
| | | const params: any = {}; |
| | | // æä½å·¥åªè½æ¥è¯¢èªå·±åå»ºçæ°æ® |
| | | if (operator.value) { |
| | | params.createBy = userId; |
| | | } |
| | | // 维修工åªè½æ¥è¯¢æªæ¥åç¶æçæ¥ä¿®åï¼å
·ä½ç¶æåå åå
¸repair_req_statusï¼ |
| | | if (repair.value) { |
| | | params.status = '0'; |
| | | } |
| | | return { params }; |
| | | } |
| | |
| | | import { ref } from 'vue'; |
| | | |
| | | import { useAccess } from '@vben/access'; |
| | | import { |
| | | Page, |
| | | useVbenDrawer, |
| | | useVbenModal, |
| | | type VbenFormProps, |
| | | } from '@vben/common-ui'; |
| | | import { Page, useVbenDrawer, useVbenModal, type VbenFormProps } from '@vben/common-ui'; |
| | | import { $t } from '@vben/locales'; |
| | | import { preferences } from '@vben/preferences'; |
| | | import { getVxePopupContainer } from '@vben/utils'; |
| | | |
| | | import { |
| | | Avatar, |
| | | Dropdown, |
| | | Menu, |
| | | MenuItem, |
| | | Modal, |
| | | Popconfirm, |
| | | Space, |
| | | } from 'ant-design-vue'; |
| | | import { Avatar, Dropdown, Menu, MenuItem, Modal, Popconfirm, Space } from 'ant-design-vue'; |
| | | |
| | | import { useVbenVxeGrid, type VxeGridProps } from '#/adapter/vxe-table'; |
| | | import { vxeCheckboxChecked } from '#/adapter/vxe-table'; |
| | | import { |
| | | userExport, |
| | | userList, |
| | | userRemove, |
| | | userStatusChange, |
| | | } from '#/api/system/user'; |
| | | import { userExport, userList, userRemove, userStatusChange } from '#/api/system/user'; |
| | | import { TableSwitch } from '#/components/table'; |
| | | import { commonDownloadExcel } from '#/utils/file/download'; |
| | | |
| | |
| | | * 导å
¥ |
| | | */ |
| | | const [UserImpotModal, userImportModalApi] = useVbenModal({ |
| | | connectedComponent: userImportModal, |
| | | connectedComponent: userImportModal |
| | | }); |
| | | |
| | | function handleImport() { |
| | |
| | | |
| | | // 左边é¨é¨ç¨ |
| | | const selectDeptId = ref<string[]>([]); |
| | | defineExpose({ |
| | | tableSelect |
| | | }); |
| | | |
| | | const formOptions: VbenFormProps = { |
| | | schema: querySchema(), |
| | | commonConfig: { |
| | | labelWidth: 80, |
| | | componentProps: { |
| | | allowClear: true, |
| | | }, |
| | | allowClear: true |
| | | } |
| | | }, |
| | | wrapperClass: 'grid-cols-1 md:grid-cols-2 lg:grid-cols-3 xl:grid-cols-4', |
| | | handleReset: async () => { |
| | |
| | | await reload(formValues); |
| | | }, |
| | | // æ¥æéæ©æ ¼å¼å |
| | | fieldMappingTime: [ |
| | | [ |
| | | 'createTime', |
| | | ['params[beginTime]', 'params[endTime]'], |
| | | ['YYYY-MM-DD 00:00:00', 'YYYY-MM-DD 23:59:59'], |
| | | ], |
| | | ], |
| | | fieldMappingTime: [['createTime', ['params[beginTime]', 'params[endTime]'], ['YYYY-MM-DD 00:00:00', 'YYYY-MM-DD 23:59:59']]] |
| | | }; |
| | | |
| | | const gridOptions: VxeGridProps = { |
| | |
| | | reserve: true, |
| | | // ç¹å»è¡éä¸ |
| | | trigger: 'default', |
| | | checkMethod: ({ row }) => row?.userId !== 1, |
| | | checkMethod: ({ row }) => row?.userId !== 1 |
| | | }, |
| | | columns, |
| | | height: 'auto', |
| | |
| | | return await userList({ |
| | | pageNum: page.currentPage, |
| | | pageSize: page.pageSize, |
| | | ...formValues, |
| | | ...formValues |
| | | }); |
| | | }, |
| | | }, |
| | | } |
| | | } |
| | | }, |
| | | rowConfig: { |
| | | isHover: true, |
| | | keyField: 'userId', |
| | | height: 48, |
| | | height: 48 |
| | | }, |
| | | id: 'system-user-index', |
| | | id: 'system-user-index' |
| | | }; |
| | | const [BasicTable, tableApi] = useVbenVxeGrid({ |
| | | formOptions, |
| | | gridOptions, |
| | | gridOptions |
| | | }); |
| | | |
| | | const [UserDrawer, userDrawerApi] = useVbenDrawer({ |
| | | connectedComponent: userDrawer, |
| | | connectedComponent: userDrawer |
| | | }); |
| | | |
| | | function handleAdd() { |
| | |
| | | onOk: async () => { |
| | | await userRemove(ids); |
| | | await tableApi.query(); |
| | | }, |
| | | } |
| | | }); |
| | | } |
| | | |
| | | function handleDownloadExcel() { |
| | | commonDownloadExcel(userExport, 'ç¨æ·ç®¡ç', tableApi.formApi.form.values, { |
| | | fieldMappingTime: formOptions.fieldMappingTime, |
| | | fieldMappingTime: formOptions.fieldMappingTime |
| | | }); |
| | | } |
| | | |
| | | const [UserInfoModal, userInfoModalApi] = useVbenModal({ |
| | | connectedComponent: userInfoModal, |
| | | connectedComponent: userInfoModal |
| | | }); |
| | | function handleUserInfo(row: Recordable<any>) { |
| | | userInfoModalApi.setData({ userId: row.userId }); |
| | |
| | | } |
| | | |
| | | const [UserResetPwdModal, userResetPwdModalApi] = useVbenModal({ |
| | | connectedComponent: userResetPwdModal, |
| | | connectedComponent: userResetPwdModal |
| | | }); |
| | | |
| | | function handleResetPwd(record: Recordable<any>) { |
| | | userResetPwdModalApi.setData({ record }); |
| | | userResetPwdModalApi.open(); |
| | | } |
| | | |
| | | // é䏿°æ® |
| | | function tableSelect() { |
| | | return tableApi.grid.getCheckboxRecords(); |
| | | } |
| | | |
| | | const { hasAccessByCodes } = useAccess(); |
| | |
| | | <template> |
| | | <Page :auto-content-height="true"> |
| | | <div class="flex h-full gap-[8px]"> |
| | | <DeptTree |
| | | v-model:select-dept-id="selectDeptId" |
| | | class="w-[260px]" |
| | | @reload="() => tableApi.reload()" |
| | | @select="() => tableApi.reload()" |
| | | /> |
| | | <DeptTree v-model:select-dept-id="selectDeptId" 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="['system:user:export']" |
| | | @click="handleDownloadExcel" |
| | | > |
| | | <a-button v-access:code="['system:user:export']" @click="handleDownloadExcel"> |
| | | {{ $t('pages.common.export') }} |
| | | </a-button> |
| | | <a-button |
| | | v-access:code="['system:user:import']" |
| | | @click="handleImport" |
| | | > |
| | | <a-button v-access:code="['system:user:import']" @click="handleImport"> |
| | | {{ $t('pages.common.import') }} |
| | | </a-button> |
| | | <a-button |
| | |
| | | > |
| | | {{ $t('pages.common.delete') }} |
| | | </a-button> |
| | | <a-button |
| | | type="primary" |
| | | v-access:code="['system:user:add']" |
| | | @click="handleAdd" |
| | | > |
| | | <a-button type="primary" v-access:code="['system:user:add']" @click="handleAdd"> |
| | | {{ $t('pages.common.add') }} |
| | | </a-button> |
| | | </Space> |
| | |
| | | <TableSwitch |
| | | v-model="row.status" |
| | | :api="() => userStatusChange(row)" |
| | | :disabled=" |
| | | row.userId === 1 || !hasAccessByCodes(['system:user:edit']) |
| | | " |
| | | :disabled="row.userId === 1 || !hasAccessByCodes(['system:user:edit'])" |
| | | :reload="() => tableApi.query()" |
| | | /> |
| | | </template> |
| | | <template #action="{ row }"> |
| | | <template v-if="row.userId !== 1"> |
| | | <Space> |
| | | <ghost-button |
| | | v-access:code="['system:user:edit']" |
| | | @click.stop="handleEdit(row)" |
| | | > |
| | | <ghost-button v-access:code="['system:user:edit']" @click.stop="handleEdit(row)"> |
| | | {{ $t('pages.common.edit') }} |
| | | </ghost-button> |
| | | <Popconfirm |
| | | :get-popup-container="getVxePopupContainer" |
| | | placement="left" |
| | | title="确认å é¤ï¼" |
| | | @confirm="handleDelete(row)" |
| | | > |
| | | <ghost-button |
| | | danger |
| | | v-access:code="['system:user:remove']" |
| | | @click.stop="" |
| | | > |
| | | <Popconfirm :get-popup-container="getVxePopupContainer" placement="left" title="确认å é¤ï¼" @confirm="handleDelete(row)"> |
| | | <ghost-button danger v-access:code="['system:user:remove']" @click.stop=""> |
| | | {{ $t('pages.common.delete') }} |
| | | </ghost-button> |
| | | </Popconfirm> |
| | | </Space> |
| | | <Dropdown |
| | | :get-popup-container="getVxePopupContainer" |
| | | placement="bottomRight" |
| | | > |
| | | <Dropdown :get-popup-container="getVxePopupContainer" placement="bottomRight"> |
| | | <template #overlay> |
| | | <Menu> |
| | | <MenuItem key="1" @click="handleUserInfo(row)"> |
| | | ç¨æ·ä¿¡æ¯ |
| | | </MenuItem> |
| | | <MenuItem key="1" @click="handleUserInfo(row)"> ç¨æ·ä¿¡æ¯ </MenuItem> |
| | | <span v-access:code="['system:user:resetPwd']"> |
| | | <MenuItem key="2" @click="handleResetPwd(row)"> |
| | | éç½®å¯ç |
| | | </MenuItem> |
| | | <MenuItem key="2" @click="handleResetPwd(row)"> éç½®å¯ç </MenuItem> |
| | | </span> |
| | | </Menu> |
| | | </template> |
| | |
| | | export enum DictEnum { |
| | | EIMS_EQU_UNIT = 'eims_equ_unit', // 设å¤çç¹ç¶æ |
| | | EIMS_INVENTORY_DETAIL_STATU = 'inventory_detail_statu', // 设å¤çç¹ç¶æ |
| | | EIMS_INVENTORY_STATU = 'inventory_statu', // 设å¤çç¹ç¶æ |
| | | REPAIR_REQ_STATUS = 'repair_req_status', // æ¥ä¿®ç¶æ |
| | | EQU_IMPORT_STATU = 'equ_import_status', // 设å¤å¯¼å
¥ç¶æ |
| | | REPAIR_FAULT_TYPE = 'repair_fault_type', // æ¥ä¿®ç¶æ |
| | | REPAIR_REQ_STATUS = 'repair_req_status', // æ¥ä¿®ç¶æ |
| | | REPAIR_REQ_TYPE = 'repair_req_type', // æ¥ä¿®ç±»å |
| | | REPAIR_URGENCY_LEVEL = 'repair_urgency_level', // æ¥ä¿®ç´§æ¥ç¨åº¦ |
| | | SYS_COMMON_STATUS = 'sys_common_status', |
| | |
| | | 'Content-Type': 'application/json;charset=utf-8', |
| | | }, |
| | | // é»è®¤è¶
æ¶æ¶é´ |
| | | timeout: 10_000, |
| | | timeout: 30_000, |
| | | }; |
| | | const { ...axiosConfig } = options; |
| | | const requestConfig = merge(axiosConfig, defaultConfig); |
| | |
| | | */ |
| | | String EIMS_GENERATE_CODE = "eims_generate_code:"; |
| | | |
| | | /** |
| | | * ***********************åå
¸*********************** |
| | | */ |
| | | |
| | | |
| | | /** |
| | | * 设å¤åä½unit |
| | | */ |
| | | String EIMS_EQU_UNIT = "eims_equ_unit"; |
| | | |
| | | } |
| | |
| | | <groupId>org.dromara</groupId> |
| | | <artifactId>ruoyi-common-websocket</artifactId> |
| | | </dependency> |
| | | <dependency> |
| | | <groupId>org.dromara</groupId> |
| | | <artifactId>ruoyi-system</artifactId> |
| | | </dependency> |
| | | |
| | | </dependencies> |
| | | </project> |
| | |
| | | package org.dromara.eims.controller; |
| | | |
| | | import java.util.ArrayList; |
| | | import java.util.List; |
| | | |
| | | import org.dromara.common.excel.core.ExcelResult; |
| | | import org.dromara.eims.domain.bo.EimsEquBo; |
| | | import org.dromara.eims.domain.vo.EimsEquImportVo; |
| | | import org.dromara.eims.domain.vo.EimsEquVo; |
| | | import org.dromara.eims.listener.EimsEquImportListener; |
| | | import org.dromara.eims.service.IEimsEquService; |
| | | import lombok.RequiredArgsConstructor; |
| | | import jakarta.servlet.http.HttpServletResponse; |
| | | import jakarta.validation.constraints.*; |
| | | import cn.dev33.satoken.annotation.SaCheckPermission; |
| | | import org.springframework.http.MediaType; |
| | | import org.springframework.web.bind.annotation.*; |
| | | import org.springframework.validation.annotation.Validated; |
| | | import org.dromara.common.idempotent.annotation.RepeatSubmit; |
| | |
| | | |
| | | |
| | | import org.dromara.common.mybatis.core.page.TableDataInfo; |
| | | import org.springframework.web.multipart.MultipartFile; |
| | | |
| | | /** |
| | | * ã设å¤å°è´¦ã |
| | |
| | | @PathVariable Long[] equIds) { |
| | | return toAjax(eimsEquipmentService.deleteWithValidByIds(List.of(equIds), true)); |
| | | } |
| | | |
| | | /** |
| | | * 导å
¥æ°æ® |
| | | * |
| | | * @param file 导å
¥æä»¶ |
| | | * @param updateSupport æ¯å¦æ´æ°å·²å卿°æ® |
| | | */ |
| | | @Log(title = "设å¤ç®¡ç", businessType = BusinessType.IMPORT) |
| | | @SaCheckPermission("eims:equ:import") |
| | | @PostMapping(value = "/importData", consumes = MediaType.MULTIPART_FORM_DATA_VALUE) |
| | | public R<Void> importData(@RequestPart("file") MultipartFile file, boolean updateSupport) throws Exception { |
| | | ExcelResult<EimsEquImportVo> result = ExcelUtil.importExcel(file.getInputStream(), EimsEquImportVo.class, new EimsEquImportListener(updateSupport)); |
| | | return R.ok(result.getAnalysis()); |
| | | } |
| | | |
| | | /** |
| | | * è·å导å
¥æ¨¡æ¿ |
| | | */ |
| | | @PostMapping("/importTemplate") |
| | | public void importTemplate(HttpServletResponse response) { |
| | | ExcelUtil.exportExcel(new ArrayList<>(), "è®¾å¤æ°æ®", EimsEquVo.class, response); |
| | | } |
| | | } |
| | |
| | | package org.dromara.eims.domain; |
| | | |
| | | import com.alibaba.excel.annotation.ExcelProperty; |
| | | import com.fasterxml.jackson.annotation.JsonFormat; |
| | | import org.dromara.common.mybatis.core.domain.BaseEntity; |
| | | import com.baomidou.mybatisplus.annotation.*; |
| | |
| | | */ |
| | | private Long serviceLife; |
| | | |
| | | /** |
| | | * éå®å |
| | | */ |
| | | private String seller; |
| | | |
| | | /** |
| | | * åä½ |
| | | */ |
| | | private String unit; |
| | | |
| | | /** |
| | | * ç»æäºº |
| | | */ |
| | | private Long handleUser; |
| | | |
| | | /** |
| | | * éè´äºº |
| | | */ |
| | | private Long purchaseUser; |
| | | |
| | | /** |
| | | * éä»¶ |
| | | */ |
| | | private String attachments; |
| | | |
| | | /** |
| | | * èµæ |
| | | */ |
| | | private String profile; |
| | | |
| | | |
| | | } |
| | |
| | | package org.dromara.eims.domain.bo; |
| | | |
| | | |
| | | import com.alibaba.excel.annotation.ExcelProperty; |
| | | import com.fasterxml.jackson.annotation.JsonFormat; |
| | | import org.dromara.eims.domain.EimsEqu; |
| | | import io.github.linpeilie.annotations.AutoMapper; |
| | |
| | | */ |
| | | private Long serviceLife; |
| | | |
| | | /** |
| | | * éå®å |
| | | */ |
| | | @ExcelProperty(value = "éå®å") |
| | | private String seller; |
| | | |
| | | /** |
| | | * åä½ |
| | | */ |
| | | @ExcelProperty(value = "åä½") |
| | | private String unit; |
| | | |
| | | /** |
| | | * ç»æäºº |
| | | */ |
| | | @ExcelProperty(value = "ç»æäºº") |
| | | private Long handleUser; |
| | | |
| | | /** |
| | | * éè´äºº |
| | | */ |
| | | @ExcelProperty(value = "éè´äºº") |
| | | private Long purchaseUser; |
| | | |
| | | /** |
| | | * éä»¶ |
| | | */ |
| | | @ExcelProperty(value = "éä»¶") |
| | | private String attachments; |
| | | |
| | | /** |
| | | * èµæ |
| | | */ |
| | | @ExcelProperty(value = "èµæ") |
| | | private String profile; |
| | | |
| | | |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package org.dromara.eims.domain.vo; |
| | | |
| | | import com.alibaba.excel.annotation.ExcelProperty; |
| | | import com.fasterxml.jackson.annotation.JsonFormat; |
| | | import lombok.Data; |
| | | import lombok.NoArgsConstructor; |
| | | import org.dromara.common.excel.annotation.ExcelDictFormat; |
| | | import org.dromara.common.excel.convert.ExcelDictConvert; |
| | | |
| | | import java.io.Serial; |
| | | import java.io.Serializable; |
| | | import java.util.Date; |
| | | |
| | | /** |
| | | * 设å¤å¯¹è±¡å¯¼å
¥VO |
| | | * |
| | | * @author zhuguifei |
| | | */ |
| | | @Data |
| | | @NoArgsConstructor |
| | | public class EimsEquImportVo implements Serializable { |
| | | @Serial |
| | | private static final long serialVersionUID = 1L; |
| | | /** |
| | | * |
| | | */ |
| | | private Long equId; |
| | | |
| | | /** |
| | | * 设å¤åç§° |
| | | */ |
| | | @ExcelProperty(value = "设å¤åç§°") |
| | | private String equName; |
| | | |
| | | /** |
| | | * è§æ ¼åå· |
| | | */ |
| | | @ExcelProperty(value = "åå·è§æ ¼") |
| | | private String modelNo; |
| | | |
| | | /** |
| | | * å¶é åå®¶ |
| | | */ |
| | | @ExcelProperty(value = "å¶é åå®¶") |
| | | private String madeIn; |
| | | |
| | | |
| | | /** |
| | | * éå®å |
| | | */ |
| | | @ExcelProperty(value = "éå®å") |
| | | private String seller; |
| | | |
| | | /** |
| | | * åä½ |
| | | */ |
| | | @ExcelProperty(value = "åä½") |
| | | private String unit; |
| | | |
| | | /** |
| | | * èµäº§ç¼å· |
| | | */ |
| | | @ExcelProperty(value = "èµäº§ç¼å·") |
| | | private String assetNo; |
| | | |
| | | /** |
| | | * æå¨åºæ |
| | | */ |
| | | @ExcelProperty(value = "æå¨åºæ") |
| | | private String location; |
| | | |
| | | /** |
| | | * 管çè
|
| | | */ |
| | | @ExcelProperty(value = "管çè
") |
| | | private String respPersonName; |
| | | |
| | | /** |
| | | * è´ä¹°æ¥æ |
| | | */ |
| | | @ExcelProperty(value = "è´ä¹°æ¥æ") |
| | | private String purchaseDateStr; |
| | | private Date purchaseDate; |
| | | |
| | | /** |
| | | * å®é
éªæ¶æ¥æ |
| | | */ |
| | | @ExcelProperty(value = "éªæ¶æ¥æ") |
| | | private String actualAcceptDateStr; |
| | | private Date actualAcceptDate; |
| | | |
| | | /** |
| | | * ç»æäºº |
| | | */ |
| | | @ExcelProperty(value = "ç»æäºº") |
| | | private String handleUserName; |
| | | |
| | | /** |
| | | * éè´äºº |
| | | */ |
| | | @ExcelProperty(value = "éè´äºº") |
| | | private String purchaseUserName; |
| | | |
| | | /** |
| | | * é¢å®åç |
| | | */ |
| | | @ExcelProperty(value = "åç") |
| | | private String ratedPower; |
| | | |
| | | /** |
| | | * èç³»çµè¯ |
| | | */ |
| | | @ExcelProperty(value = "èç³»çµè¯") |
| | | private String contactPhone; |
| | | |
| | | /** |
| | | * 使ç¨ç¶æ |
| | | */ |
| | | @ExcelProperty(value = "使ç¨ç¶æ", converter = ExcelDictConvert.class) |
| | | @ExcelDictFormat(dictType = "sys_equ_status") |
| | | private String status; |
| | | |
| | | /** |
| | | * 夿³¨ |
| | | */ |
| | | @ExcelProperty(value = "夿³¨") |
| | | private String remark; |
| | | |
| | | /** |
| | | * éä»¶ |
| | | */ |
| | | @ExcelProperty(value = "éä»¶") |
| | | private String attachments; |
| | | |
| | | /** |
| | | * èµæ |
| | | */ |
| | | @ExcelProperty(value = "èµæ") |
| | | private String profile; |
| | | |
| | | } |
| | |
| | | package org.dromara.eims.domain.vo; |
| | | |
| | | import java.util.Date; |
| | | |
| | | import com.alibaba.excel.annotation.ExcelIgnoreUnannotated; |
| | | import com.alibaba.excel.annotation.ExcelProperty; |
| | | import com.alibaba.excel.annotation.write.style.ColumnWidth; |
| | | import com.fasterxml.jackson.annotation.JsonFormat; |
| | | import org.dromara.common.mybatis.core.domain.BaseEntity; |
| | | import org.dromara.common.translation.annotation.Translation; |
| | | import org.dromara.common.translation.constant.TransConstant; |
| | | import org.dromara.eims.domain.EimsEqu; |
| | |
| | | @Data |
| | | @ExcelIgnoreUnannotated |
| | | @AutoMapper(target = EimsEqu.class) |
| | | public class EimsEquVo implements Serializable { |
| | | public class EimsEquVo extends BaseEntity implements Serializable { |
| | | |
| | | @Serial |
| | | private static final long serialVersionUID = 1L; |
| | |
| | | /** |
| | | * |
| | | */ |
| | | @ExcelProperty(value = "") |
| | | private Long equId; |
| | | |
| | | /** |
| | | * 设å¤åç§° |
| | | */ |
| | | @ExcelProperty(value = "设å¤åç§°") |
| | | private String equName; |
| | | |
| | | /** |
| | | * è§æ ¼åå· |
| | | */ |
| | | @ExcelProperty(value = "è§æ ¼åå·") |
| | | private String modelNo; |
| | | |
| | | /** |
| | | * å¶é åå®¶ |
| | | */ |
| | | @ExcelProperty(value = "å¶é åå®¶") |
| | | private String madeIn; |
| | | |
| | | |
| | | /** |
| | | * éå®å |
| | | */ |
| | | @ExcelProperty(value = "éå®å") |
| | | private String seller; |
| | | |
| | | /** |
| | | * åä½ |
| | | */ |
| | | @ExcelProperty(value = "åä½") |
| | | private String unit; |
| | | |
| | | /** |
| | | * èµäº§ç¼å· |
| | | */ |
| | | @ExcelProperty(value = "èµäº§ç¼å·") |
| | | private String assetNo; |
| | | |
| | | /** |
| | | * æå¨åºæ |
| | | */ |
| | | @ExcelProperty(value = "æå¨åºæ") |
| | | private String location; |
| | | |
| | | /** |
| | | * 管çè
|
| | | */ |
| | | @Translation(type = TransConstant.USER_ID_TO_NICKNAME, mapper = "respPerson") |
| | | @ExcelProperty(value = "管çè
") |
| | | private String respPersonName; |
| | | |
| | | /** |
| | | * è´ä¹°æ¥æ |
| | | */ |
| | | @ExcelProperty(value = "è´ä¹°æ¥æ") |
| | | @ColumnWidth(24) |
| | | @JsonFormat(pattern = "yyyy-MM-dd") |
| | | private Date purchaseDate; |
| | | |
| | | /** |
| | | * å®é
éªæ¶æ¥æ |
| | | */ |
| | | @ExcelProperty(value = "éªæ¶æ¥æ") |
| | | @ColumnWidth(24) |
| | | @JsonFormat(pattern = "yyyy-MM-dd") |
| | | private Date actualAcceptDate; |
| | | |
| | | /** |
| | | * ç»æäºº |
| | | */ |
| | | @Translation(type = TransConstant.USER_ID_TO_NICKNAME, mapper = "handleUser") |
| | | @ExcelProperty(value = "ç»æäºº") |
| | | private String handleUserName; |
| | | |
| | | /** |
| | | * éè´äºº |
| | | */ |
| | | @Translation(type = TransConstant.USER_ID_TO_NICKNAME, mapper = "purchaseUser") |
| | | @ExcelProperty(value = "éè´äºº") |
| | | private String purchaseUserName; |
| | | |
| | | /** |
| | | * é¢å®åç |
| | | */ |
| | | @ExcelProperty(value = "åç") |
| | | private String ratedPower; |
| | | |
| | | /** |
| | | * èç³»çµè¯ |
| | | */ |
| | | @ExcelProperty(value = "èç³»çµè¯") |
| | | private String contactPhone; |
| | | |
| | | /** |
| | | * 使ç¨ç¶æ |
| | | */ |
| | | @ExcelProperty(value = "使ç¨ç¶æ", converter = ExcelDictConvert.class) |
| | | @ExcelDictFormat(dictType = "sys_equ_status") |
| | | private String status; |
| | | |
| | | /** |
| | | * 夿³¨ |
| | | */ |
| | | @ExcelProperty(value = "夿³¨") |
| | | private String remark; |
| | | |
| | | /** |
| | | * éä»¶ |
| | | */ |
| | | @ExcelProperty(value = "éä»¶") |
| | | private String attachments; |
| | | |
| | | |
| | | /** |
| | | * 设å¤ç¼ç |
| | | */ |
| | | @ExcelProperty(value = "设å¤ç¼ç ") |
| | | //@ExcelProperty(value = "设å¤ç¼ç ") |
| | | private String equCode; |
| | | |
| | | |
| | |
| | | /** |
| | | * 设å¤ç±»ååç§° |
| | | */ |
| | | @ExcelProperty(value = "设å¤ç±»å") |
| | | //@ExcelProperty(value = "设å¤ç±»å") |
| | | @Translation(type = TransConstant.EQU_YPE_ID_TO_NAME, mapper = "equTypeId") |
| | | private String equTypeName; |
| | | |
| | | /** |
| | | * èµäº§ç¼å· |
| | | */ |
| | | @ExcelProperty(value = "èµäº§ç¼å·") |
| | | private String assetNo; |
| | | |
| | | /** |
| | | * 设å¤åç§° |
| | | |
| | | */ |
| | | @ExcelProperty(value = "设å¤åç§°") |
| | | private String equName; |
| | | |
| | | /** |
| | | * åå· |
| | | */ |
| | | @ExcelProperty(value = "åå·") |
| | | private String modelNo; |
| | | |
| | | /** |
| | | * å¶é å |
| | | */ |
| | | @ExcelProperty(value = "å¶é å") |
| | | private String madeIn; |
| | | |
| | | /** |
| | | * é¢åº¦åç |
| | | */ |
| | | @ExcelProperty(value = "é¢åº¦åç") |
| | | private String ratedPower; |
| | | |
| | | /** |
| | | * éçä¿¡æ¯ |
| | | */ |
| | | @ExcelProperty(value = "éçä¿¡æ¯") |
| | | //@ExcelProperty(value = "éçä¿¡æ¯") |
| | | private String plateInfo; |
| | | |
| | | /** |
| | | * éè´æ¥æ |
| | | */ |
| | | @ExcelProperty(value = "éè´æ¥æ") |
| | | @JsonFormat(pattern = "yyyy-MM-dd") |
| | | private Date purchaseDate; |
| | | |
| | | /** |
| | | * ç¶æ |
| | | */ |
| | | @ExcelProperty(value = "ç¶æ", converter = ExcelDictConvert.class) |
| | | @ExcelDictFormat(dictType = "sys_equ_status") |
| | | private String status; |
| | | |
| | | /** |
| | | * æå¨åºæ |
| | | */ |
| | | @ExcelProperty(value = "æå¨åºæ") |
| | | private String location; |
| | | |
| | | /** |
| | | * 使ç¨é¨é¨ï¼å
³èidï¼ |
| | | */ |
| | | @ExcelProperty(value = "使ç¨é¨é¨", converter = ExcelDictConvert.class) |
| | | //@ExcelProperty(value = "使ç¨é¨é¨", converter = ExcelDictConvert.class) |
| | | @ExcelDictFormat(readConverterExp = "å
³=èid") |
| | | private Long deptUsed; |
| | | /** |
| | |
| | | /** |
| | | * 责任人(å
³èid) |
| | | */ |
| | | @ExcelProperty(value = "责任人(å
³èid)") |
| | | //@ExcelProperty(value = "责任人(å
³èid)") |
| | | private Long respPerson; |
| | | /** |
| | | * é¨é¨å |
| | | */ |
| | | @Translation(type = TransConstant.USER_ID_TO_NICKNAME, mapper = "respPerson") |
| | | private String respPersonName; |
| | | |
| | | /** |
| | | * èç³»çµè¯ |
| | | */ |
| | | @ExcelProperty(value = "èç³»çµè¯") |
| | | private String contactPhone; |
| | | |
| | | /** |
| | | * æ£å¼ä½¿ç¨æ¥æ |
| | | */ |
| | | @ExcelProperty(value = "æ£å¼ä½¿ç¨æ¥æ") |
| | | //@ExcelProperty(value = "æ£å¼ä½¿ç¨æ¥æ") |
| | | @JsonFormat(pattern = "yyyy-MM-dd") |
| | | private Date deployDate; |
| | | |
| | | /** |
| | | * å¼å§è¯ç¨æ¥æ |
| | | */ |
| | | @ExcelProperty(value = "å¼å§è¯ç¨æ¥æ") |
| | | //@ExcelProperty(value = "å¼å§è¯ç¨æ¥æ") |
| | | @JsonFormat(pattern = "yyyy-MM-dd") |
| | | private Date trialDate; |
| | | |
| | | /** |
| | | * 计åéªæ¶æ¥æ |
| | | */ |
| | | @ExcelProperty(value = "计åéªæ¶æ¥æ") |
| | | //@ExcelProperty(value = "计åéªæ¶æ¥æ") |
| | | @JsonFormat(pattern = "yyyy-MM-dd") |
| | | private Date planAcceptDate; |
| | | |
| | | /** |
| | | * å®é
éªæ¶æ¥æ |
| | | */ |
| | | @ExcelProperty(value = "å®é
éªæ¶æ¥æ") |
| | | @JsonFormat(pattern = "yyyy-MM-dd") |
| | | private Date actualAcceptDate; |
| | | |
| | | /** |
| | | * 导å
¥ç¶æï¼åå
¸ï¼ |
| | | */ |
| | | @ExcelProperty(value = "导å
¥ç¶æ", converter = ExcelDictConvert.class) |
| | | //@ExcelProperty(value = "导å
¥ç¶æ", converter = ExcelDictConvert.class) |
| | | @ExcelDictFormat(readConverterExp = "å=å
¸") |
| | | private String importStatus; |
| | | |
| | | |
| | | |
| | | /** |
| | | * çç¹æ å¿ |
| | | */ |
| | | @ExcelProperty(value = "çç¹æ å¿") |
| | | //@ExcelProperty(value = "çç¹æ å¿") |
| | | private String inventoryFlag; |
| | | |
| | | /** |
| | | * 䏿¬¡çç¹æ¥æ |
| | | */ |
| | | @ExcelProperty(value = "䏿¬¡çç¹æ¥æ") |
| | | //@ExcelProperty(value = "䏿¬¡çç¹æ¥æ") |
| | | @JsonFormat(pattern = "yyyy-MM-dd") |
| | | private Date inventoryDate; |
| | | |
| | | /** |
| | | * 使ç¨å¹´é |
| | | */ |
| | | @ExcelProperty(value = "使ç¨å¹´é") |
| | | //@ExcelProperty(value = "使ç¨å¹´é") |
| | | private Long serviceLife; |
| | | |
| | | |
| | | /** |
| | | * ç»æäºº |
| | | */ |
| | | //@ExcelProperty(value = "ç»æäºº") |
| | | private Long handleUser; |
| | | |
| | | /** |
| | | * éè´äºº |
| | | */ |
| | | //@ExcelProperty(value = "éè´äºº") |
| | | private Long purchaseUser; |
| | | |
| | | /** |
| | | * èµæ |
| | | */ |
| | | @ExcelProperty(value = "èµæ") |
| | | private String profile; |
| | | |
| | | |
| | | |
| | | |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package org.dromara.eims.listener; |
| | | |
| | | import cn.hutool.core.bean.BeanUtil; |
| | | import cn.hutool.core.util.ObjectUtil; |
| | | import com.alibaba.excel.context.AnalysisContext; |
| | | import com.alibaba.excel.event.AnalysisEventListener; |
| | | import com.alibaba.excel.exception.ExcelDataConvertException; |
| | | import org.dromara.common.core.constant.CacheConstants; |
| | | import org.dromara.common.core.constant.Constants; |
| | | import org.dromara.common.core.exception.ServiceException; |
| | | import org.dromara.common.core.service.DictService; |
| | | import org.dromara.common.core.utils.DateUtils; |
| | | import org.dromara.common.core.utils.SpringUtils; |
| | | import org.dromara.common.core.utils.StringUtils; |
| | | import org.dromara.common.excel.core.ExcelListener; |
| | | import org.dromara.common.excel.core.ExcelResult; |
| | | import org.dromara.common.satoken.utils.LoginHelper; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.dromara.eims.domain.bo.EimsEquBo; |
| | | import org.dromara.eims.domain.vo.EimsEquImportVo; |
| | | import org.dromara.eims.domain.vo.EimsEquVo; |
| | | import org.dromara.eims.service.IEimsEquService; |
| | | import org.dromara.system.domain.bo.SysUserBo; |
| | | import org.dromara.system.service.ISysUserService; |
| | | |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | | /** |
| | | * 设å¤èªå®ä¹å¯¼å
¥ |
| | | * |
| | | * @author zhuguifei |
| | | */ |
| | | @Slf4j |
| | | public class EimsEquImportListener extends AnalysisEventListener<EimsEquImportVo> implements ExcelListener<EimsEquImportVo> { |
| | | |
| | | private final IEimsEquService equService; |
| | | |
| | | private final ISysUserService userService; |
| | | |
| | | private final DictService dictService; |
| | | // å½å导å
¥ç¨æ· |
| | | private final Long operUserId; |
| | | |
| | | private final Boolean isUpdateSupport; |
| | | |
| | | //unitåå
¸ |
| | | private final Map<String, String> unitDictMap; |
| | | |
| | | |
| | | private int successNum = 0; |
| | | private int failureNum = 0; |
| | | private final StringBuilder successMsg = new StringBuilder(); |
| | | private final StringBuilder failureMsg = new StringBuilder(); |
| | | |
| | | public EimsEquImportListener(Boolean isUpdateSupport) { |
| | | this.equService = SpringUtils.getBean(IEimsEquService.class); |
| | | ; |
| | | this.userService = SpringUtils.getBean(ISysUserService.class); |
| | | this.dictService = SpringUtils.getBean(DictService.class); |
| | | this.isUpdateSupport = isUpdateSupport; |
| | | this.operUserId = LoginHelper.getUserId(); |
| | | this.unitDictMap = dictService.getAllDictByDictType(CacheConstants.EIMS_EQU_UNIT); |
| | | } |
| | | |
| | | @Override |
| | | public void invoke(EimsEquImportVo equVo, AnalysisContext context) { |
| | | try { |
| | | // æ ¹æ®èµäº§ç¼å·æ¥è¯¢è®¾å¤æ¯å¦å·²åå¨ |
| | | EimsEquVo eimsEquVo = equService.queryByAssetNo(equVo.getAssetNo()); |
| | | // å¤çä¸è§åæ°æ® |
| | | //1.åä½unit-excel导å
¥æ°æ®ä¸åä½å段ä¸è§åï¼ç¹æ®å¤ç |
| | | normalizeUnit(equVo, unitDictMap); |
| | | //2.è´ä¹°æ¥æãéªæ¶æ¥æ ç¹æ®å¤ç |
| | | if (StringUtils.isNotEmpty(equVo.getPurchaseDateStr())) { |
| | | try { |
| | | equVo.setPurchaseDate(DateUtils.parseDate(equVo.getPurchaseDateStr())); |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | } |
| | | } |
| | | if (StringUtils.isNotEmpty(equVo.getActualAcceptDateStr())) { |
| | | try { |
| | | equVo.setActualAcceptDate(DateUtils.parseDate(equVo.getActualAcceptDateStr())); |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | } |
| | | } |
| | | |
| | | // éªè¯æ¯å¦åå¨è¿ä¸ªç¨æ· |
| | | if (ObjectUtil.isNull(eimsEquVo)) { |
| | | EimsEquBo equ = BeanUtil.toBean(equVo, EimsEquBo.class); |
| | | // TODO æ ¡éª |
| | | //ValidatorUtils.validate(equ); |
| | | equ.setCreateBy(operUserId); |
| | | equService.insertByBo(equ); |
| | | successNum++; |
| | | successMsg.append("<br/>").append(successNum).append("ãè®¾å¤ ").append(equ.getEquName()).append(" 导å
¥æå"); |
| | | } else if (isUpdateSupport) { |
| | | // TODO æ§è¡è¦çé»è¾ |
| | | //successNum++; |
| | | //successMsg.append("<br/>").append(successNum).append("ãè®¾å¤ ").append(equ.getEquName()).append(" æ´æ°æå"); |
| | | } else { |
| | | failureNum++; |
| | | failureMsg.append("<br/>").append(failureNum).append("ãè®¾å¤ ").append(eimsEquVo.getEquName()).append(eimsEquVo.getAssetNo()).append(" å·²åå¨"); |
| | | } |
| | | } catch (Exception e) { |
| | | failureNum++; |
| | | String msg = "<br/>" + failureNum + "ãè®¾å¤ " + equVo.getEquName() + " 导å
¥å¤±è´¥ï¼"; |
| | | failureMsg.append(msg).append(e.getMessage()); |
| | | log.error(msg, e); |
| | | } |
| | | } |
| | | |
| | | @Override |
| | | public void doAfterAllAnalysed(AnalysisContext context) { |
| | | |
| | | } |
| | | |
| | | @Override |
| | | public ExcelResult<EimsEquImportVo> getExcelResult() { |
| | | return new ExcelResult<>() { |
| | | |
| | | @Override |
| | | public String getAnalysis() { |
| | | if (failureNum > 0) { |
| | | failureMsg.insert(0, "徿±æï¼å¯¼å
¥å¤±è´¥ï¼å
± " + failureNum + " æ¡æ°æ®æ ¼å¼ä¸æ£ç¡®ï¼é误å¦ä¸ï¼"); |
| | | throw new ServiceException(failureMsg.toString()); |
| | | } else { |
| | | successMsg.insert(0, "æåæ¨ï¼æ°æ®å·²å
¨é¨å¯¼å
¥æåï¼å
± " + successNum + " æ¡ï¼æ°æ®å¦ä¸ï¼"); |
| | | } |
| | | return successMsg.toString(); |
| | | } |
| | | |
| | | @Override |
| | | public List<EimsEquImportVo> getList() { |
| | | return null; |
| | | } |
| | | |
| | | @Override |
| | | public List<String> getErrorList() { |
| | | return null; |
| | | } |
| | | }; |
| | | } |
| | | |
| | | @Override |
| | | public void onException(Exception exception, AnalysisContext context) throws Exception { |
| | | log.error("è§£æå¤±è´¥ï¼ä½æ¯ç»§ç»è§£æä¸ä¸è¡:{}", exception.getMessage()); |
| | | // å¦ææ¯æä¸ä¸ªåå
æ ¼ç转æ¢å¼å¸¸ è½è·åå°å
·ä½è¡å· |
| | | // 妿è¦è·å头çä¿¡æ¯ é
åinvokeHeadMapä½¿ç¨ |
| | | if (exception instanceof ExcelDataConvertException) { |
| | | ExcelDataConvertException excelDataConvertException = (ExcelDataConvertException) exception; |
| | | log.error("第{}è¡ï¼ç¬¬{}åè§£æå¼å¸¸ï¼æ°æ®ä¸º:{}", excelDataConvertException.getRowIndex(), |
| | | excelDataConvertException.getColumnIndex(), excelDataConvertException.getCellData()); |
| | | } |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 为导å
¥è®¾å¤å¹é
åä½ |
| | | * |
| | | * @param equVo |
| | | * @param unitDictMap |
| | | */ |
| | | private void normalizeUnit(EimsEquImportVo equVo, Map<String, String> unitDictMap) { |
| | | if (equVo == null || StringUtils.isEmpty(equVo.getUnit()) || unitDictMap == null || unitDictMap.isEmpty()) { |
| | | return; |
| | | } |
| | | String originalUnit = equVo.getUnit(); |
| | | //é¿å
é误åä½ |
| | | equVo.setUnit(null); |
| | | for (Map.Entry<String, String> entry : unitDictMap.entrySet()) { |
| | | if (originalUnit.contains(entry.getValue())) { |
| | | equVo.setUnit(entry.getValue()); |
| | | break; |
| | | } |
| | | } |
| | | } |
| | | |
| | | } |
| | |
| | | EimsEquVo queryById(Long equId); |
| | | |
| | | /** |
| | | * æ¥è¯¢ã设å¤å°è´¦ã |
| | | * |
| | | * @param assetNo èµäº§ç¼å· |
| | | * @return ã设å¤å°è´¦ã |
| | | */ |
| | | EimsEquVo queryByAssetNo(String assetNo); |
| | | |
| | | /** |
| | | * å页æ¥è¯¢ã设å¤å°è´¦ãå表 |
| | | * |
| | | * @param bo æ¥è¯¢æ¡ä»¶ |
| | |
| | | return baseMapper.selectVoById(equId); |
| | | } |
| | | |
| | | @Override |
| | | public EimsEquVo queryByAssetNo(String assetNo) { |
| | | LambdaQueryWrapper<EimsEqu> lqw = new LambdaQueryWrapper<>(); |
| | | lqw.eq(EimsEqu::getAssetNo, assetNo); |
| | | return baseMapper.selectVoOne(lqw); |
| | | } |
| | | |
| | | /** |
| | | * å页æ¥è¯¢ã设å¤å°è´¦ãå表 |
| | | * |
| | |
| | | |
| | | /** |
| | | * æ ¹æ®idï¼è·åææå代id |
| | | * |
| | | * @param rootId |
| | | * @return |
| | | */ |
| | |
| | | } |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * æ°å¢ã设å¤å°è´¦ã |
| | | * |
| | |
| | | private QueryWrapper<EimsRepairReq> buildWrapper(EimsRepairReqBo bo) { |
| | | Map<String, Object> params = bo.getParams(); |
| | | QueryWrapper<EimsRepairReq> qw = Wrappers.query(); |
| | | qw.eq(StringUtils.isNotBlank(bo.getCode()),"code", bo.getCode()); |
| | | qw.eq(StringUtils.isNotBlank(bo.getStatus()), "status", bo.getStatus()); |
| | | qw.eq(bo.getReqTime() != null, "req_time", bo.getReqTime()); |
| | | qw.eq(bo.getReqDept() != null, "req_dept", bo.getReqDept()); |
| | | qw.eq(bo.getReqUser() != null,"req_user", bo.getReqUser()); |
| | | qw.eq(StringUtils.isNotBlank(bo.getUrgencyLevel()), "urgency_level", bo.getUrgencyLevel()); |
| | | qw.eq(StringUtils.isNotBlank(bo.getReqType()), "req_type", bo.getReqType()); |
| | | qw.eq(bo.getEquId() != null, "equ_id", bo.getEquId()); |
| | | qw.eq(bo.getRepairDept() != null,"repair_dept", bo.getRepairDept()); |
| | | qw.eq(bo.getRepairUser() != null, "repair_user", bo.getRepairUser()); |
| | | qw.eq(StringUtils.isNotBlank(bo.getFaultType()), "fault_type", bo.getFaultType()); |
| | | qw.like(StringUtils.isNotBlank(bo.getCode()),"a.code", bo.getCode()); |
| | | qw.eq(StringUtils.isNotBlank(bo.getStatus()), "a.status", bo.getStatus()); |
| | | qw.eq(bo.getReqTime() != null, "a.req_time", bo.getReqTime()); |
| | | qw.eq(bo.getReqDept() != null, "a.req_dept", bo.getReqDept()); |
| | | qw.eq(bo.getReqUser() != null,"a.req_user", bo.getReqUser()); |
| | | qw.eq(StringUtils.isNotBlank(bo.getUrgencyLevel()), "a.urgency_level", bo.getUrgencyLevel()); |
| | | qw.eq(StringUtils.isNotBlank(bo.getReqType()), "a.req_type", bo.getReqType()); |
| | | qw.eq(bo.getEquId() != null, "a.equ_id", bo.getEquId()); |
| | | qw.eq(bo.getRepairDept() != null,"a.repair_dept", bo.getRepairDept()); |
| | | qw.eq(bo.getRepairUser() != null, "a.repair_user", bo.getRepairUser()); |
| | | qw.eq(StringUtils.isNotBlank(bo.getFaultType()), "a,fault_type", bo.getFaultType()); |
| | | qw.eq(params.containsKey("createBy"), "a.create_by", params.get("createBy")); |
| | | qw.eq(params.containsKey("status"), "a.status", params.get("status")); |
| | | qw.between(params.get("beginReqTime") != null && params.get("endReqTime") != null, |
| | | "req_time", params.get("beginReqTime"), params.get("endReqTime")); |
| | | "a.req_time", params.get("beginReqTime"), params.get("endReqTime")); |
| | | return qw; |
| | | } |
| | | |