¶Ô±ÈÐÂÎļþ |
| | |
| | | import type { RepairResVO } from './model'; |
| | | |
| | | import type { ID, IDS } from '#/api/common'; |
| | | |
| | | import { commonExport } from '#/api/helper'; |
| | | import { requestClient } from '#/api/request'; |
| | | |
| | | enum Api { |
| | | repairResExport = '/eims/repairRes/export', |
| | | repairResList = '/eims/repairRes/list', |
| | | root = '/eims/repairRes' |
| | | } |
| | | |
| | | /** |
| | | * æ¥è¯¢ç»´ä¿®å·¥åå表 |
| | | * @param query |
| | | * @returns {*} |
| | | */ |
| | | |
| | | export function listRepairRes(params?: any) { |
| | | return requestClient.get<RepairResVO[]>(Api.repairResList, { params }); |
| | | } |
| | | |
| | | /** |
| | | * æ¥è¯¢ç»´ä¿®å·¥åè¯¦ç» |
| | | * @param repairResId |
| | | */ |
| | | export function getRepairRes(repairResId: ID) { |
| | | return requestClient.get<RepairResVO>(`${Api.root}/${repairResId}`); |
| | | } |
| | | |
| | | /** |
| | | * æ°å¢ç»´ä¿®å·¥å |
| | | * @param data |
| | | */ |
| | | export function addRepairRes(data: any) { |
| | | return requestClient.postWithMsg<void>(Api.root, data); |
| | | } |
| | | |
| | | /** |
| | | * ä¿®æ¹ç»´ä¿®å·¥å |
| | | * @param data |
| | | */ |
| | | export function updateRepairRes(data: any) { |
| | | return requestClient.putWithMsg<void>(Api.root, data); |
| | | } |
| | | |
| | | /** |
| | | * å é¤ç»´ä¿®å·¥å |
| | | * @param repairResId |
| | | */ |
| | | export function delRepairRes(repairResId: IDS) { |
| | | return requestClient.deleteWithMsg<void>(`${Api.root}/${repairResId}`); |
| | | } |
| | | /** |
| | | * å¯¼åº |
| | | * @param |
| | | */ |
| | | export function repairResExport(data: any) { |
| | | return commonExport(Api.repairResExport, data); |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | export interface RepairResVO { |
| | | /** |
| | | * |
| | | */ |
| | | id: number | string; |
| | | |
| | | /** |
| | | * æ¥ä¿®åid |
| | | */ |
| | | reqId: number | string; |
| | | |
| | | /** |
| | | * ç»´ä¿®åå· |
| | | */ |
| | | resCode: string; |
| | | |
| | | /** |
| | | * 维修人 |
| | | */ |
| | | resUser: number; |
| | | |
| | | /** |
| | | * 维修人é¨é¨ |
| | | */ |
| | | resDept: number; |
| | | |
| | | /** |
| | | * åå åæ |
| | | |
| | | */ |
| | | resReason: string; |
| | | |
| | | /** |
| | | * å¤çæªæ½ |
| | | */ |
| | | resHandle: string; |
| | | |
| | | /** |
| | | * é¢é²æªæ½ |
| | | */ |
| | | resPrevent: string; |
| | | |
| | | /** |
| | | * ç»´ä¿®ç¶æ(åå
¸) |
| | | */ |
| | | status: string; |
| | | |
| | | /** |
| | | * å¼å§æ¶é´ |
| | | */ |
| | | startTime: string; |
| | | |
| | | /** |
| | | * ç»ææ¶é´ |
| | | */ |
| | | endTime: string; |
| | | |
| | | /** |
| | | * 使ç¨å·¥å
· |
| | | */ |
| | | useFixture: string; |
| | | |
| | | /** |
| | | * 使ç¨å¤ä»¶ |
| | | */ |
| | | useParts: string; |
| | | |
| | | /** |
| | | * 夿³¨ |
| | | */ |
| | | remark: string; |
| | | } |
| | | |
| | | export interface RepairResForm extends BaseEntity { |
| | | /** |
| | | * |
| | | */ |
| | | id?: number | string; |
| | | |
| | | /** |
| | | * æ¥ä¿®åid |
| | | */ |
| | | reqId?: number | string; |
| | | |
| | | /** |
| | | * 维修人 |
| | | */ |
| | | resUser?: number; |
| | | |
| | | /** |
| | | * 维修人é¨é¨ |
| | | */ |
| | | resDept?: number; |
| | | |
| | | /** |
| | | * åå åæ |
| | | |
| | | */ |
| | | resReason?: string; |
| | | |
| | | /** |
| | | * å¤çæªæ½ |
| | | */ |
| | | resHandle?: string; |
| | | |
| | | /** |
| | | * é¢é²æªæ½ |
| | | */ |
| | | resPrevent?: string; |
| | | |
| | | /** |
| | | * ç»´ä¿®ç¶æ(åå
¸) |
| | | */ |
| | | status?: string; |
| | | |
| | | /** |
| | | * å¼å§æ¶é´ |
| | | */ |
| | | startTime?: string; |
| | | |
| | | /** |
| | | * ç»ææ¶é´ |
| | | */ |
| | | endTime?: string; |
| | | |
| | | /** |
| | | * 使ç¨å·¥å
· |
| | | */ |
| | | useFixture?: string; |
| | | |
| | | /** |
| | | * 使ç¨å¤ä»¶ |
| | | */ |
| | | useParts?: string; |
| | | |
| | | /** |
| | | * 夿³¨ |
| | | */ |
| | | remark?: string; |
| | | } |
| | | |
| | | export interface RepairResQuery extends PageQuery { |
| | | /** |
| | | * 维修人 |
| | | */ |
| | | resUser?: number; |
| | | |
| | | /** |
| | | * 维修人é¨é¨ |
| | | */ |
| | | resDept?: number; |
| | | |
| | | /** |
| | | * ç»´ä¿®ç¶æ(åå
¸) |
| | | */ |
| | | status?: string; |
| | | |
| | | /** |
| | | * å¼å§æ¶é´ |
| | | */ |
| | | startTime?: string; |
| | | |
| | | /** |
| | | * ç»ææ¶é´ |
| | | */ |
| | | endTime?: string; |
| | | |
| | | /** |
| | | * æ¥æèå´åæ° |
| | | */ |
| | | params?: any; |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | <script setup lang="ts"> |
| | | import { ref } from 'vue'; |
| | | |
| | | import { useVbenModal } from '@vben/common-ui'; |
| | | |
| | | import { message } from 'ant-design-vue'; |
| | | |
| | | import InnerView from '#/views/eims/repair-req/index.vue'; |
| | | |
| | | const emit = defineEmits<{ updateSelect: [any] }>(); |
| | | |
| | | const [BasicModal, modalApi] = useVbenModal({ |
| | | fullscreenButton: false, |
| | | draggable: true, |
| | | onCancel: handleCancel, |
| | | onConfirm: handleConfirm |
| | | }); |
| | | const innerView = ref(); |
| | | |
| | | async function handleConfirm() { |
| | | try { |
| | | modalApi.modalLoading(true); |
| | | const tableSelect = innerView.value.tableSelect(); |
| | | if (tableSelect.length > 1) { |
| | | message.error('æå¤åªè½éæ©ä¸æ¡æ°æ®ï¼'); |
| | | modalApi.modalLoading(false); |
| | | return false; |
| | | } |
| | | emit('updateSelect', 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]"> |
| | | <InnerView ref="innerView" :filter-flag="true" status="0" /> |
| | | </BasicModal> |
| | | </template> |
| | | |
| | | <style scoped></style> |
| | |
| | | } |
| | | }, |
| | | { |
| | | title: 'ç»´ä¿®åå·', |
| | | field: 'resCode', |
| | | minWidth: 200 |
| | | }, |
| | | { |
| | | title: 'æ¥ä¿®ç±»å', |
| | | field: 'reqType', |
| | | sortable: true, |
| | |
| | | |
| | | import { Page, useVbenDrawer, type VbenFormProps } from '@vben/common-ui'; |
| | | import { $t } from '@vben/locales'; |
| | | import { useUserStore } from '@vben/stores'; |
| | | import { addFullName, getPopupContainer, getVxePopupContainer } from '@vben/utils'; |
| | | |
| | | import { Modal, Popconfirm, Space } from 'ant-design-vue'; |
| | |
| | | |
| | | import { columns, querySchema } from './data'; |
| | | import repairReqDrawer from './repair-req-drawer.vue'; |
| | | import { useUserStore } from '@vben/stores'; |
| | | |
| | | |
| | | interface Props { |
| | | filterFlag?: boolean; |
| | | status?: string; |
| | | } |
| | | const props = withDefaults(defineProps<Props>(), { filterFlag: false, status: undefined }); |
| | | |
| | | |
| | | const userStore = useUserStore(); |
| | | const userId = userStore.userInfo?.userId; |
| | | const deptId = userStore.userInfo?.deptId; |
| | | |
| | | defineExpose({ |
| | | tableSelect |
| | | }); |
| | | |
| | | |
| | | const formOptions: VbenFormProps = { |
| | | commonConfig: { |
| | |
| | | // ç¹å»è¡éä¸ |
| | | // trigger: 'row' |
| | | }, |
| | | columns, |
| | | columns: columns?.filter((item) => (props.filterFlag ? item.field !== 'action' : item.field !== '-1')), |
| | | height: 'auto', |
| | | keepSource: true, |
| | | pagerConfig: {}, |
| | | toolbarConfig: { |
| | | enabled: !props.filterFlag |
| | | }, |
| | | proxyConfig: { |
| | | ajax: { |
| | | query: async ({ page }, formValues = {}) => { |
| | | // å¦æä¼ å
¥äºequIdååªæ¥è¯¢å½åidæ°æ® |
| | | if (props.filterFlag && props.status) { |
| | | const params = { status: props.status }; |
| | | Object.assign(formValues, params); |
| | | } |
| | | return await listRepairReq({ |
| | | pageNum: page.currentPage, |
| | | pageSize: page.pageSize, |
| | |
| | | } |
| | | ]); |
| | | } |
| | | // é䏿°æ® |
| | | function tableSelect() { |
| | | return tableApi.grid.getCheckboxRecords(); |
| | | } |
| | | </script> |
| | | |
| | | <template> |
| | | <Page :auto-content-height="true"> |
| | | <div class="flex h-full gap-[8px]"> |
| | | <BasicTable class="flex-1 overflow-hidden" table-title="设å¤çç¹å表"> |
| | | <BasicTable class="flex-1 overflow-hidden" table-title="æ
éæ¥ä¿®å表"> |
| | | <template #toolbar-tools> |
| | | <Space> |
| | | <a-button v-access:code="['eims:repairReq:export']" @click="handleDownloadExcel"> |
¶Ô±ÈÐÂÎļþ |
| | |
| | | import type { VxeGridProps } from '#/adapter/vxe-table'; |
| | | |
| | | import { DictEnum } from '@vben/constants'; |
| | | import { getPopupContainer } from '@vben/utils'; |
| | | |
| | | import dayjs from 'dayjs'; |
| | | |
| | | import { type FormSchemaGetter } from '#/adapter/form'; |
| | | import { REPAIR_REQ_TYPE } from '#/constants/dict'; |
| | | import { getDictOptions } from '#/utils/dict'; |
| | | import { renderDict } from '#/utils/render'; |
| | | |
| | | const curDateTime = dayjs().format('YYYY-MM-DD HH:mm:ss'); |
| | | |
| | | export const querySchema: FormSchemaGetter = () => [ |
| | | { |
| | | component: 'Input', |
| | | fieldName: 'resCode', |
| | | label: 'ç»´ä¿®åå·' |
| | | }, |
| | | { |
| | | component: 'Input', |
| | | fieldName: 'reqCode', |
| | | label: 'æ¥ä¿®åå·' |
| | | }, |
| | | { |
| | | component: 'Select', |
| | | componentProps: { |
| | | options: getDictOptions(DictEnum.REPAIR_RES_STATUS) |
| | | }, |
| | | fieldName: 'status', |
| | | label: 'ç¶æ' |
| | | }, |
| | | { |
| | | component: 'TreeSelect', |
| | | // å¨draweréæ´æ° è¿éä¸éè¦é»è®¤çcomponentProps |
| | | defaultValue: undefined, |
| | | fieldName: 'resDept', |
| | | label: 'ç»´ä¿®é¨é¨' |
| | | // rules: 'selectRequired', |
| | | }, |
| | | { |
| | | component: 'Select', |
| | | componentProps: { |
| | | showSearch: true, |
| | | allowClear: true, |
| | | getPopupContainer |
| | | }, |
| | | fieldName: 'resUser', |
| | | label: '维修人' |
| | | } |
| | | ]; |
| | | |
| | | export const columns: VxeGridProps['columns'] = [ |
| | | { type: 'checkbox', width: 60, fixed: 'left' }, |
| | | { |
| | | title: 'ç»´ä¿®åå·', |
| | | field: 'resCode', |
| | | minWidth: 160, |
| | | fixed: 'left' |
| | | }, |
| | | { |
| | | title: 'ç»´ä¿®ç¶æ', |
| | | field: 'status', |
| | | minWidth: 100, |
| | | fixed: 'left', |
| | | slots: { |
| | | default: ({ row }) => { |
| | | if (row.status === null || row.status === '') { |
| | | return ''; |
| | | } |
| | | return renderDict(row.status, DictEnum.REPAIR_RES_STATUS); |
| | | } |
| | | } |
| | | }, |
| | | { |
| | | title: 'æ¥ä¿®åå·', |
| | | field: 'reqCode', |
| | | minWidth: 160, |
| | | }, |
| | | { |
| | | title: 'ç»´ä¿®é¨é¨', |
| | | field: 'resDeptName', |
| | | minWidth: 100 |
| | | }, |
| | | { |
| | | title: '维修人', |
| | | field: 'resUserName', |
| | | minWidth: 100 |
| | | }, |
| | | { |
| | | title: 'æ¥ä¿®ç±»å', |
| | | field: 'reqType', |
| | | sortable: true, |
| | | minWidth: 100, |
| | | slots: { |
| | | default: ({ row }) => { |
| | | if (row.reqType === null || row.reqType === '') { |
| | | return ''; |
| | | } |
| | | return renderDict(row.reqType, DictEnum.REPAIR_REQ_TYPE); |
| | | } |
| | | } |
| | | }, |
| | | { |
| | | title: 'æ¥ä¿®æ¶é´', |
| | | field: 'reqTime', |
| | | sortable: true, |
| | | minWidth: 200 |
| | | }, |
| | | { |
| | | title: '设å¤(å·¥å
·)åç§°', |
| | | sortable: true, |
| | | minWidth: 150, |
| | | slots: { |
| | | default: ({ row }) => { |
| | | if (!row.reqType) { |
| | | return ''; |
| | | } |
| | | |
| | | // æ ¹æ®ä¸åç请æ±ç±»åè¿åç¸åºçåç§° |
| | | switch (row.reqType) { |
| | | case REPAIR_REQ_TYPE.EQU: { |
| | | return row.equName; |
| | | } |
| | | case REPAIR_REQ_TYPE.FIXTURE: { |
| | | return row.fixtureName; |
| | | } |
| | | default: { |
| | | // å¦æè¯·æ±ç±»åæ¢ä¸æ¯ EQU ä¹ä¸æ¯ FIXTUREï¼åè¿å空å符串 |
| | | return ''; |
| | | } |
| | | } |
| | | } |
| | | } |
| | | }, |
| | | { |
| | | title: 'æ
éç±»å«', |
| | | field: 'faultType', |
| | | minWidth: 100, |
| | | slots: { |
| | | default: ({ row }) => { |
| | | if (row.faultType === null || row.faultType === '') { |
| | | return ''; |
| | | } |
| | | return renderDict(row.faultType, DictEnum.REPAIR_FAULT_TYPE); |
| | | } |
| | | } |
| | | }, |
| | | { |
| | | title: 'æ¥ä¿®é¨é¨', |
| | | field: 'reqDeptName', |
| | | minWidth: 100 |
| | | }, |
| | | { |
| | | title: 'æ¥ä¿®äºº', |
| | | field: 'reqUserName', |
| | | minWidth: 100 |
| | | }, |
| | | { |
| | | title: 'æ
éæè¿°', |
| | | field: 'reqDesc', |
| | | minWidth: 120 |
| | | }, |
| | | { |
| | | field: 'action', |
| | | fixed: 'right', |
| | | slots: { default: 'action' }, |
| | | title: 'æä½', |
| | | width: 130 |
| | | } |
| | | ]; |
| | | |
| | | export const drawerSchema: FormSchemaGetter = () => [ |
| | | { |
| | | component: 'Input', |
| | | dependencies: { |
| | | show: () => false, |
| | | triggerFields: [''] |
| | | }, |
| | | fieldName: 'id' |
| | | }, |
| | | { |
| | | component: 'Input', |
| | | fieldName: 'reqId', |
| | | dependencies: { |
| | | show: () => false, |
| | | triggerFields: [''] |
| | | }, |
| | | label: 'æ¥ä¿®id' |
| | | }, |
| | | { |
| | | component: 'Input', |
| | | fieldName: 'reqCode', |
| | | label: 'æ¥ä¿®åå·' |
| | | }, |
| | | { |
| | | component: 'Input', |
| | | fieldName: 'resCode', |
| | | label: 'ç»´ä¿®åå·' |
| | | }, |
| | | { |
| | | component: 'Textarea', |
| | | formItemClass: 'items-baseline', |
| | | fieldName: 'resReason', |
| | | label: 'åå åæ' |
| | | }, |
| | | { |
| | | component: 'Textarea', |
| | | formItemClass: 'items-baseline', |
| | | fieldName: 'resHandle', |
| | | label: 'å¤çæªæ½' |
| | | }, |
| | | { |
| | | component: 'Textarea', |
| | | formItemClass: 'items-baseline', |
| | | fieldName: 'resPrevent', |
| | | label: 'é¢é²æªæ½' |
| | | }, |
| | | { |
| | | component: 'Input', |
| | | fieldName: 'fixtureName', |
| | | label: 'å·¥å
·åç§°', |
| | | dependencies: { |
| | | show: () => false, |
| | | triggerFields: [''] |
| | | } |
| | | }, |
| | | { |
| | | component: 'Input', |
| | | fieldName: 'fixtureId', |
| | | label: 'å·¥å
·id', |
| | | dependencies: { |
| | | show: () => false, |
| | | triggerFields: [''] |
| | | } |
| | | }, |
| | | { |
| | | component: 'Select', |
| | | componentProps: { |
| | | getPopupContainer, |
| | | options: getDictOptions(DictEnum.REPAIR_RES_STATUS) |
| | | }, |
| | | fieldName: 'status', |
| | | defaultValue: '0', |
| | | label: 'ç»´ä¿®ç¶æ' |
| | | }, |
| | | { |
| | | component: 'DatePicker', |
| | | componentProps: { |
| | | format: 'YYYY-MM-DD HH:mm:ss', |
| | | showTime: true, |
| | | valueFormat: 'YYYY-MM-DD HH:mm:ss', |
| | | getPopupContainer |
| | | }, |
| | | defaultValue: curDateTime, |
| | | fieldName: 'startTime', |
| | | label: 'å¼å§æ¶é´' |
| | | }, |
| | | { |
| | | component: 'DatePicker', |
| | | componentProps: { |
| | | format: 'YYYY-MM-DD HH:mm:ss', |
| | | showTime: true, |
| | | valueFormat: 'YYYY-MM-DD HH:mm:ss', |
| | | getPopupContainer |
| | | }, |
| | | fieldName: 'endTime', |
| | | label: 'ç»ææ¶é´' |
| | | }, |
| | | { |
| | | component: 'TreeSelect', |
| | | // å¨draweréæ´æ° è¿éä¸éè¦é»è®¤çcomponentProps |
| | | defaultValue: undefined, |
| | | fieldName: 'resDept', |
| | | label: 'ç»´ä¿®é¨é¨', |
| | | help: `æ¥ä¿®äººåæå±é¨é¨` |
| | | // rules: 'selectRequired', |
| | | }, |
| | | { |
| | | component: 'Select', |
| | | componentProps: { |
| | | showSearch: true, |
| | | allowClear: true, |
| | | getPopupContainer |
| | | }, |
| | | fieldName: 'resUser', |
| | | label: '维修人' |
| | | }, |
| | | { |
| | | component: 'Textarea', |
| | | formItemClass: 'items-baseline', |
| | | fieldName: 'remark', |
| | | label: '夿³¨' |
| | | }, |
| | | ]; |
¶Ô±ÈÐÂÎļþ |
| | |
| | | <script setup lang="ts"> |
| | | import type { Recordable } from '@vben/types'; |
| | | |
| | | import { onMounted } from 'vue'; |
| | | |
| | | import { Page, useVbenDrawer, type VbenFormProps } from '@vben/common-ui'; |
| | | import { $t } from '@vben/locales'; |
| | | import { addFullName, getPopupContainer, getVxePopupContainer } from '@vben/utils'; |
| | | |
| | | import { Modal, Popconfirm, Space } from 'ant-design-vue'; |
| | | |
| | | import { useVbenVxeGrid, vxeCheckboxChecked, type VxeGridProps, vxeSortEvent } from '#/adapter/vxe-table'; |
| | | import { delRepairRes, listRepairRes, repairResExport } from '#/api/eims/repair-res'; |
| | | import { getDeptTree, userList } from '#/api/system/user'; |
| | | import { commonDownloadExcel } from '#/utils/file/download'; |
| | | |
| | | import { columns, querySchema } from './data'; |
| | | import repairResDrawer from './repair-res-drawer.vue'; |
| | | import { useUserStore } from '@vben/stores'; |
| | | |
| | | const userStore = useUserStore(); |
| | | const userId = userStore.userInfo?.userId; |
| | | const deptId = userStore.userInfo?.deptId; |
| | | |
| | | const formOptions: VbenFormProps = { |
| | | commonConfig: { |
| | | labelWidth: 80, |
| | | componentProps: { |
| | | allowClear: true |
| | | } |
| | | }, |
| | | schema: querySchema(), |
| | | collapsed: true, |
| | | wrapperClass: 'grid-cols-1 md:grid-cols-2 lg:grid-cols-3 xl:grid-cols-4', |
| | | // æ¥æéæ©æ ¼å¼å |
| | | fieldMappingTime: [['startTime', ['params[beginStartTime]', 'params[endStartTime]'], ['YYYY-MM-DD 00:00:00', 'YYYY-MM-DD 23:59:59']]] |
| | | }; |
| | | |
| | | const gridOptions: VxeGridProps = { |
| | | checkboxConfig: { |
| | | // é«äº® |
| | | highlight: true, |
| | | // 翻页æ¶ä¿çéä¸ç¶æ |
| | | reserve: true |
| | | // ç¹å»è¡éä¸ |
| | | // trigger: 'row' |
| | | }, |
| | | columns, |
| | | height: 'auto', |
| | | keepSource: true, |
| | | pagerConfig: {}, |
| | | proxyConfig: { |
| | | ajax: { |
| | | query: async ({ page }, formValues = {}) => { |
| | | return await listRepairRes({ |
| | | pageNum: page.currentPage, |
| | | pageSize: page.pageSize, |
| | | ...formValues |
| | | // ...useRoleBaseFilters() |
| | | }); |
| | | } |
| | | } |
| | | }, |
| | | rowConfig: { |
| | | isHover: true, |
| | | keyField: 'id' |
| | | }, |
| | | sortConfig: { |
| | | // è¿ç¨æåº |
| | | remote: true, |
| | | // æ¯æå¤å段æåº é»è®¤å
³é |
| | | multiple: true |
| | | }, |
| | | id: 'eims-repair-res-index' |
| | | }; |
| | | |
| | | const [BasicTable, tableApi] = useVbenVxeGrid({ |
| | | formOptions, |
| | | gridOptions, |
| | | gridEvents: { |
| | | sortChange: (sortParams) => vxeSortEvent(tableApi, sortParams) |
| | | } |
| | | }); |
| | | |
| | | const [RepairResDrawer, repairResDrawerApi] = useVbenDrawer({ |
| | | connectedComponent: repairResDrawer |
| | | }); |
| | | |
| | | function handleAdd() { |
| | | repairResDrawerApi.setData({ resUser: userId, resDept: deptId }); |
| | | repairResDrawerApi.open(); |
| | | } |
| | | |
| | | async function handleEdit(record: Recordable<any>) { |
| | | repairResDrawerApi.setData({ id: record.id }); |
| | | repairResDrawerApi.open(); |
| | | } |
| | | |
| | | async function handleDelete(row: Recordable<any>) { |
| | | await delRepairRes(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 delRepairRes(ids); |
| | | await tableApi.query(); |
| | | } |
| | | }); |
| | | } |
| | | |
| | | function handleDownloadExcel() { |
| | | commonDownloadExcel(repairResExport, '维修工åè®°å½', tableApi.formApi.form.values, { |
| | | fieldMappingTime: formOptions.fieldMappingTime |
| | | }); |
| | | } |
| | | |
| | | onMounted(async () => { |
| | | await setupDeptSelect(); |
| | | }); |
| | | |
| | | /** |
| | | * ç¨æ·çå è½½ |
| | | */ |
| | | async function setupUserOptions(deptId: any) { |
| | | const params = { deptId }; |
| | | const userPageResult = await userList({ |
| | | pageNum: 1, |
| | | pageSize: 500, |
| | | ...params |
| | | }); |
| | | const options = userPageResult.rows.map((item) => ({ |
| | | label: item.nickName || item.userName, |
| | | value: item.userId |
| | | })); |
| | | // çé |
| | | const filterOption = (input: string, option: any) => { |
| | | return option.label.toLowerCase().includes(input.toLowerCase()); |
| | | }; |
| | | |
| | | const placeholder = options.length > 0 ? 'è¯·éæ©' : '该é¨é¨ä¸ææ ç¨æ·'; |
| | | tableApi.formApi.updateSchema([ |
| | | { |
| | | componentProps: { options, placeholder, filterOption }, |
| | | fieldName: 'resUser' |
| | | } |
| | | ]); |
| | | } |
| | | |
| | | /** |
| | | * åå§åé¨é¨éæ© |
| | | */ |
| | | 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.reqUser = undefined; |
| | | }, |
| | | placeholder: 'è¯·éæ©', |
| | | showSearch: true, |
| | | treeData: deptTree, |
| | | treeDefaultExpandAll: true, |
| | | treeLine: { showLeafIcon: false }, |
| | | // çéçåæ®µ |
| | | treeNodeFilterProp: 'label', |
| | | // éä¸åæ¾ç¤ºå¨è¾å
¥æ¡çå¼ |
| | | treeNodeLabelProp: 'fullName' |
| | | }), |
| | | fieldName: 'resDept' |
| | | } |
| | | ]); |
| | | } |
| | | </script> |
| | | |
| | | <template> |
| | | <Page :auto-content-height="true"> |
| | | <div class="flex h-full gap-[8px]"> |
| | | <BasicTable class="flex-1 overflow-hidden" table-title="维修工åå表"> |
| | | <template #toolbar-tools> |
| | | <Space> |
| | | <a-button v-access:code="['eims:repairRes:export']" @click="handleDownloadExcel"> |
| | | {{ $t('pages.common.export') }} |
| | | </a-button> |
| | | <a-button |
| | | :disabled="!vxeCheckboxChecked(tableApi)" |
| | | danger |
| | | type="primary" |
| | | v-access:code="['eims:repairRes:remove']" |
| | | @click="handleMultiDelete" |
| | | > |
| | | {{ $t('pages.common.delete') }} |
| | | </a-button> |
| | | <a-button type="primary" v-access:code="['eims:repairRes:add']" @click="handleAdd"> |
| | | {{ $t('pages.common.add') }} |
| | | </a-button> |
| | | </Space> |
| | | </template> |
| | | |
| | | <template #action="{ row }"> |
| | | <Space> |
| | | <ghost-button v-access:code="['eims:repairRes:edit']" @click.stop="handleEdit(row)"> |
| | | {{ $t('pages.common.edit') }} |
| | | </ghost-button> |
| | | <Popconfirm :get-popup-container="getVxePopupContainer" placement="left" title="确认å é¤ï¼" @confirm="handleDelete(row)"> |
| | | <ghost-button danger v-access:code="['eims:repairRes:remove']" @click.stop=""> |
| | | {{ $t('pages.common.delete') }} |
| | | </ghost-button> |
| | | </Popconfirm> |
| | | </Space> |
| | | </template> |
| | | </BasicTable> |
| | | </div> |
| | | <RepairResDrawer @reload="tableApi.query()" /> |
| | | </Page> |
| | | </template> |
¶Ô±ÈÐÂÎļþ |
| | |
| | | <script setup lang="ts"> |
| | | import { computed, ref } from 'vue'; |
| | | |
| | | import { useVbenDrawer, useVbenModal } from '@vben/common-ui'; |
| | | import { $t } from '@vben/locales'; |
| | | import { addFullName, cloneDeep, getPopupContainer } from '@vben/utils'; |
| | | |
| | | import { InputSearch, Modal } from 'ant-design-vue'; |
| | | |
| | | import { useVbenForm } from '#/adapter/form'; |
| | | import { addRepairRes, getRepairRes, updateRepairRes } from '#/api/eims/repair-res'; |
| | | import { getDeptTree, userList } from '#/api/system/user'; |
| | | import reqModal from '#/views/eims/components/repair-req-modal.vue'; |
| | | |
| | | import { drawerSchema } from './data'; |
| | | |
| | | const emit = defineEmits<{ reload: [] }>(); |
| | | |
| | | const isUpdate = ref(false); |
| | | const title = computed(() => { |
| | | return isUpdate.value ? $t('pages.common.edit') : $t('pages.common.add'); |
| | | }); |
| | | |
| | | const [BasicForm, formApi] = useVbenForm({ |
| | | commonConfig: { |
| | | formItemClass: 'col-span-2', |
| | | componentProps: { |
| | | class: 'w-full' |
| | | }, |
| | | labelWidth: 120 |
| | | }, |
| | | schema: drawerSchema(), |
| | | showDefaultActions: false, |
| | | wrapperClass: 'grid-cols-2' |
| | | }); |
| | | |
| | | const [BasicDrawer, drawerApi] = useVbenDrawer({ |
| | | onCancel: handleCancel, |
| | | onConfirm: handleConfirm, |
| | | async onOpenChange(isOpen) { |
| | | if (!isOpen) { |
| | | return null; |
| | | } |
| | | |
| | | drawerApi.drawerLoading(true); |
| | | const { id } = drawerApi.getData() as { id?: number | string }; |
| | | const { resUser } = drawerApi.getData() as { resUser?: number | string }; |
| | | const { resDept } = drawerApi.getData() as { resDept?: number | string }; |
| | | isUpdate.value = !!id; |
| | | // åå§å |
| | | await setupDeptSelect(); |
| | | // æ°å¢æ¶é»è®¤å¡«å
ç»å½äººä¸ºæ¥ä¿®äºº |
| | | if (!isUpdate.value && resUser !== null && resDept !== null) { |
| | | await formApi.setValues({ 'resUser': resUser, 'resDept': resDept }); |
| | | await setupUserOptions(resDept); |
| | | } |
| | | formApi.updateSchema([ |
| | | { |
| | | componentProps: { |
| | | disabled: isUpdate.value |
| | | }, |
| | | fieldName: 'resCode' |
| | | } |
| | | ]); |
| | | // æ´æ° && èµå¼ |
| | | if (isUpdate.value && id) { |
| | | const record = await getRepairRes(id); |
| | | await formApi.setValues(record); |
| | | if (isUpdate.value && record.resDept) { |
| | | await setupUserOptions(record.resDept); |
| | | } |
| | | } |
| | | |
| | | drawerApi.drawerLoading(false); |
| | | } |
| | | }); |
| | | |
| | | const [ReqModal, reqModalApi] = useVbenModal({ |
| | | connectedComponent: reqModal, |
| | | draggable: true, |
| | | title: 'éæ©æ¥ä¿®å' |
| | | }); |
| | | |
| | | function handleReqModal() { |
| | | reqModalApi.setData({}); |
| | | reqModalApi.open(); |
| | | } |
| | | /** |
| | | * ç¨æ·çå è½½ |
| | | */ |
| | | 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: 'resUser' |
| | | } |
| | | ]); |
| | | } |
| | | |
| | | /** |
| | | * åå§åé¨é¨éæ© |
| | | */ |
| | | 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.resUser = undefined; |
| | | }, |
| | | placeholder: 'è¯·éæ©', |
| | | showSearch: true, |
| | | treeData: deptTree, |
| | | treeDefaultExpandAll: true, |
| | | treeLine: { showLeafIcon: false }, |
| | | // çéçåæ®µ |
| | | treeNodeFilterProp: 'label', |
| | | // éä¸åæ¾ç¤ºå¨è¾å
¥æ¡çå¼ |
| | | treeNodeLabelProp: 'fullName' |
| | | }), |
| | | fieldName: 'resDept' |
| | | } |
| | | ]); |
| | | } |
| | | |
| | | async function handleConfirm() { |
| | | try { |
| | | drawerApi.drawerLoading(true); |
| | | const { valid } = await formApi.validate(); |
| | | if (!valid) { |
| | | return; |
| | | } |
| | | const data = cloneDeep(await formApi.getValues()); |
| | | await (isUpdate.value ? updateRepairRes(data) : addRepairRes(data)); |
| | | emit('reload'); |
| | | await handleCancel(); |
| | | } catch (error) { |
| | | console.error(error); |
| | | } finally { |
| | | drawerApi.drawerLoading(false); |
| | | } |
| | | } |
| | | |
| | | async function handleCancel() { |
| | | drawerApi.close(); |
| | | await formApi.resetForm(); |
| | | } |
| | | |
| | | /** |
| | | * æå¼æ¥è¯¢æ¥ä¿®å |
| | | */ |
| | | function onSearchReq() { |
| | | handleReqModal(); |
| | | } |
| | | /** |
| | | * æ´æ°éæ©çæ¥ä¿®å |
| | | * @param req |
| | | */ |
| | | async function updateSelect(req: any) { |
| | | // éæ©æ¥ä¿®ååçæç»´ä¿®åå· |
| | | if (!req.code || !req.id) { |
| | | Modal.error({ |
| | | content: 'è·åä¿ä¿®å失败ï¼è¯·éæ°ç»å½åéè¯ï¼', |
| | | title: 'æç¤º' |
| | | }); |
| | | } |
| | | const resCode = `WXD${req.code.slice(3)}`; |
| | | await formApi.setValues({ 'reqId': req.id, 'reqCode': req.code, 'resCode': resCode }); |
| | | } |
| | | </script> |
| | | |
| | | <template> |
| | | <BasicDrawer :close-on-click-modal="false" :title="title" class="w-[600px]"> |
| | | <BasicForm> |
| | | <template #reqCode="slotProps"> |
| | | <InputSearch :enter-button="true" placeholder="è¯·éæ©" @search="onSearchReq" v-bind="slotProps" :disabled="isUpdate" /> |
| | | </template> |
| | | </BasicForm> |
| | | <ReqModal class="w-[1200px]" @update-select="updateSelect" /> |
| | | </BasicDrawer> |
| | | </template> |
| | |
| | | FIXTURE_BORROW_STATUS = 'fixture_borrow_status', // å·¥å
·ï¼æ²»å
·ï¼åç¨ç¶æ |
| | | REPAIR_FAULT_TYPE = 'repair_fault_type', // æ¥ä¿®ç¶æ |
| | | REPAIR_REQ_STATUS = 'repair_req_status', // æ¥ä¿®ç¶æ |
| | | REPAIR_RES_STATUS = 'repair_res_status', // ç»´ä¿®ç¶æ |
| | | REPAIR_REQ_TYPE = 'repair_req_type', // æ¥ä¿®ç±»å |
| | | REPAIR_URGENCY_LEVEL = 'repair_urgency_level', // æ¥ä¿®ç´§æ¥ç¨åº¦ |
| | | SYS_COMMON_STATUS = 'sys_common_status', |
| | |
| | | */ |
| | | String EIMS_GENERATE_CODE = "eims_generate_code:"; |
| | | |
| | | /** |
| | | * ***********************åå
¸*********************** |
| | | */ |
| | | |
| | | |
| | | /** |
| | | * 设å¤åä½unit |
| | | */ |
| | | String EIMS_EQU_UNIT = "eims_equ_unit"; |
| | | |
| | | /** |
| | | * 设å¤å¯¼å
¥ç¶æ |
| | | */ |
| | | String EIMS_IMPORT_STATUS = "equ_import_status"; |
| | | |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package org.dromara.common.core.constant; |
| | | |
| | | /** |
| | | * åå
¸ |
| | | */ |
| | | public interface DictConstants { |
| | | |
| | | |
| | | /** |
| | | * 设å¤åä½unit |
| | | */ |
| | | String EIMS_EQU_UNIT = "eims_equ_unit"; |
| | | |
| | | /** |
| | | * 设å¤å¯¼å
¥ç¶æ |
| | | */ |
| | | String EIMS_IMPORT_STATUS = "equ_import_status"; |
| | | /** |
| | | * æ¥ä¿®ç¶æ |
| | | */ |
| | | String REPAIR_REQ_STATUS = "repair_req_status"; |
| | | interface REPAIR_REQ_STATUS_DETAIL { |
| | | /** |
| | | * æ¥å |
| | | */ |
| | | String JIEDAN = "0"; |
| | | /** |
| | | * ç»´ä¿® |
| | | */ |
| | | String WEIXIU = "1"; |
| | | /** |
| | | * 宿 |
| | | */ |
| | | String WANCHENG = "2"; |
| | | } |
| | | |
| | | /** |
| | | * 维修工åç¶æ |
| | | */ |
| | | String REPAIR_RES_STATUS = "repair_res_status"; |
| | | interface REPAIR_RES_STATUS_DETAIL { |
| | | /** |
| | | * ç»´ä¿® |
| | | */ |
| | | String WEIXIU = "0"; |
| | | /** |
| | | * 宿 |
| | | */ |
| | | String WANCHENG = "1"; |
| | | } |
| | | |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package org.dromara.common.core.service; |
| | | |
| | | public interface RepairReqService { |
| | | /** |
| | | * éè¿æ¥ä¿®åIDæ¥è¯¢ä¿ä¿®åcode |
| | | * |
| | | * @param reqIds æ¥ä¿®åID串éå·åé |
| | | * @return æ¥ä¿®åå称串éå·åé |
| | | */ |
| | | String selectRepairReqCodeByIds(String reqIds); |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package org.dromara.common.core.service; |
| | | |
| | | public interface RepairResService { |
| | | /** |
| | | * éè¿ç»´ä¿®å·¥åIDæ¥è¯¢ç»´ä¿®å·¥åcode |
| | | * |
| | | * @param resIds 维修工åID串éå·åé |
| | | * @return 维修工åå称串éå·åé |
| | | */ |
| | | String selectRepairResCodeByIds(String resIds); |
| | | } |
| | |
| | | */ |
| | | String FIXTURE_ID_TO_NAME = "fixture_id_to_name"; |
| | | |
| | | /** |
| | | * æ¥ä¿®åid转code |
| | | */ |
| | | String REPAIR_REQ_ID_TO_CODE = "repair_req_id_to_code"; |
| | | |
| | | /** |
| | | * 维修工åid转code |
| | | */ |
| | | String REPAIR_RES_ID_TO_CODE = "repair_res_id_to_code"; |
| | | |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package org.dromara.common.translation.core.impl; |
| | | |
| | | import lombok.AllArgsConstructor; |
| | | import org.dromara.common.core.service.FixtureService; |
| | | import org.dromara.common.core.service.RepairReqService; |
| | | import org.dromara.common.translation.annotation.TranslationType; |
| | | import org.dromara.common.translation.constant.TransConstant; |
| | | import org.dromara.common.translation.core.TranslationInterface; |
| | | |
| | | /** |
| | | * æ¥ä¿®åid转code |
| | | * |
| | | * @author zhuguifei |
| | | */ |
| | | @AllArgsConstructor |
| | | @TranslationType(type = TransConstant.REPAIR_REQ_ID_TO_CODE) |
| | | public class RepairReqCodeTranslationImpl implements TranslationInterface<String> { |
| | | |
| | | private final RepairReqService repairReqService; |
| | | |
| | | @Override |
| | | public String translation(Object key, String other) { |
| | | if (key instanceof String ids) { |
| | | return repairReqService.selectRepairReqCodeByIds(ids); |
| | | } else if (key instanceof Long id) { |
| | | return repairReqService.selectRepairReqCodeByIds(id.toString()); |
| | | } |
| | | return null; |
| | | } |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package org.dromara.common.translation.core.impl; |
| | | |
| | | import lombok.AllArgsConstructor; |
| | | import org.dromara.common.core.service.RepairReqService; |
| | | import org.dromara.common.core.service.RepairResService; |
| | | import org.dromara.common.translation.annotation.TranslationType; |
| | | import org.dromara.common.translation.constant.TransConstant; |
| | | import org.dromara.common.translation.core.TranslationInterface; |
| | | |
| | | /** |
| | | * 维修工åid转code |
| | | * |
| | | * @author zhuguifei |
| | | */ |
| | | @AllArgsConstructor |
| | | @TranslationType(type = TransConstant.REPAIR_RES_ID_TO_CODE) |
| | | public class RepairResCodeTranslationImpl implements TranslationInterface<String> { |
| | | |
| | | private final RepairResService repairResService; |
| | | |
| | | @Override |
| | | public String translation(Object key, String other) { |
| | | if (key instanceof String ids) { |
| | | return repairResService.selectRepairResCodeByIds(ids); |
| | | } else if (key instanceof Long id) { |
| | | return repairResService.selectRepairResCodeByIds(id.toString()); |
| | | } |
| | | return null; |
| | | } |
| | | } |
| | |
| | | org.dromara.common.translation.core.impl.EquNameTranslationImpl |
| | | org.dromara.common.translation.core.impl.FixtureTypeNameTranslationImpl |
| | | org.dromara.common.translation.core.impl.FixtureNameTranslationImpl |
| | | org.dromara.common.translation.core.impl.RepairReqCodeTranslationImpl |
| | | org.dromara.common.translation.core.impl.RepairResCodeTranslationImpl |
¶Ô±ÈÐÂÎļþ |
| | |
| | | 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.EimsRepairResVo; |
| | | import org.dromara.eims.domain.bo.EimsRepairResBo; |
| | | import org.dromara.eims.service.IEimsRepairResService; |
| | | import org.dromara.common.mybatis.core.page.TableDataInfo; |
| | | |
| | | /** |
| | | * 维修工å |
| | | * |
| | | * @author zhuguifei |
| | | * @date 2025-02-25 |
| | | */ |
| | | @Validated |
| | | @RequiredArgsConstructor |
| | | @RestController |
| | | @RequestMapping("/eims/repairRes") |
| | | public class EimsRepairResController extends BaseController { |
| | | |
| | | private final IEimsRepairResService eimsRepairResService; |
| | | |
| | | /** |
| | | * æ¥è¯¢ç»´ä¿®å·¥åå表 |
| | | */ |
| | | @SaCheckPermission("eims:repairRes:list") |
| | | @GetMapping("/list") |
| | | public TableDataInfo<EimsRepairResVo> list(EimsRepairResBo bo, PageQuery pageQuery) { |
| | | //return eimsRepairResService.queryPageList(bo, pageQuery); |
| | | return eimsRepairResService.queryPageListCustom(bo, pageQuery); |
| | | } |
| | | |
| | | /** |
| | | * 导åºç»´ä¿®å·¥åå表 |
| | | */ |
| | | @SaCheckPermission("eims:repairRes:export") |
| | | @Log(title = "维修工å", businessType = BusinessType.EXPORT) |
| | | @PostMapping("/export") |
| | | public void export(EimsRepairResBo bo, HttpServletResponse response) { |
| | | List<EimsRepairResVo> list = eimsRepairResService.queryList(bo); |
| | | ExcelUtil.exportExcel(list, "维修工å", EimsRepairResVo.class, response); |
| | | } |
| | | |
| | | /** |
| | | * è·å维修工å详ç»ä¿¡æ¯ |
| | | * |
| | | * @param id ä¸»é® |
| | | */ |
| | | @SaCheckPermission("eims:repairRes:query") |
| | | @GetMapping("/{id}") |
| | | public R<EimsRepairResVo> getInfo(@NotNull(message = "主é®ä¸è½ä¸ºç©º") |
| | | @PathVariable Long id) { |
| | | return R.ok(eimsRepairResService.queryById(id)); |
| | | } |
| | | |
| | | /** |
| | | * æ°å¢ç»´ä¿®å·¥å |
| | | */ |
| | | @SaCheckPermission("eims:repairRes:add") |
| | | @Log(title = "维修工å", businessType = BusinessType.INSERT) |
| | | @RepeatSubmit() |
| | | @PostMapping() |
| | | public R<Void> add(@Validated(AddGroup.class) @RequestBody EimsRepairResBo bo) { |
| | | return toAjax(eimsRepairResService.insertByBo(bo)); |
| | | } |
| | | |
| | | /** |
| | | * ä¿®æ¹ç»´ä¿®å·¥å |
| | | */ |
| | | @SaCheckPermission("eims:repairRes:edit") |
| | | @Log(title = "维修工å", businessType = BusinessType.UPDATE) |
| | | @RepeatSubmit() |
| | | @PutMapping() |
| | | public R<Void> edit(@Validated(EditGroup.class) @RequestBody EimsRepairResBo bo) { |
| | | return toAjax(eimsRepairResService.updateByBo(bo)); |
| | | } |
| | | |
| | | /** |
| | | * å é¤ç»´ä¿®å·¥å |
| | | * |
| | | * @param ids 主é®ä¸² |
| | | */ |
| | | @SaCheckPermission("eims:repairRes:remove") |
| | | @Log(title = "维修工å", businessType = BusinessType.DELETE) |
| | | @DeleteMapping("/{ids}") |
| | | public R<Void> remove(@NotEmpty(message = "主é®ä¸è½ä¸ºç©º") |
| | | @PathVariable Long[] ids) { |
| | | return toAjax(eimsRepairResService.deleteWithValidByIds(List.of(ids), true)); |
| | | } |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package org.dromara.eims.domain; |
| | | |
| | | import com.alibaba.excel.annotation.ExcelProperty; |
| | | 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_repair_res |
| | | * |
| | | * @author zhuguifei |
| | | * @date 2025-02-25 |
| | | */ |
| | | @Data |
| | | @EqualsAndHashCode(callSuper = true) |
| | | @TableName("eims_repair_res") |
| | | public class EimsRepairRes extends BaseEntity { |
| | | |
| | | @Serial |
| | | private static final long serialVersionUID = 1L; |
| | | |
| | | /** |
| | | * |
| | | */ |
| | | @TableId(value = "id") |
| | | private Long id; |
| | | |
| | | /** |
| | | * æ¥ä¿®åid |
| | | */ |
| | | private Long reqId; |
| | | |
| | | /** |
| | | * ç»´ä¿®åå· |
| | | */ |
| | | private String resCode; |
| | | |
| | | /** |
| | | * 维修人 |
| | | */ |
| | | private Long resUser; |
| | | |
| | | /** |
| | | * 维修人é¨é¨ |
| | | */ |
| | | private Long resDept; |
| | | |
| | | /** |
| | | * åå åæ |
| | | |
| | | */ |
| | | private String resReason; |
| | | |
| | | /** |
| | | * å¤çæªæ½ |
| | | */ |
| | | private String resHandle; |
| | | |
| | | /** |
| | | * é¢é²æªæ½ |
| | | */ |
| | | private String resPrevent; |
| | | |
| | | /** |
| | | * ç»´ä¿®ç¶æ(åå
¸) |
| | | */ |
| | | private String status; |
| | | |
| | | /** |
| | | * å¼å§æ¶é´ |
| | | */ |
| | | private Date startTime; |
| | | |
| | | /** |
| | | * ç»ææ¶é´ |
| | | */ |
| | | private Date endTime; |
| | | |
| | | /** |
| | | * 使ç¨å·¥å
· |
| | | */ |
| | | private String useFixture; |
| | | |
| | | /** |
| | | * 使ç¨å¤ä»¶ |
| | | */ |
| | | private String useParts; |
| | | |
| | | /** |
| | | * 夿³¨ |
| | | */ |
| | | private String remark; |
| | | |
| | | |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package org.dromara.eims.domain.bo; |
| | | |
| | | import com.alibaba.excel.annotation.ExcelProperty; |
| | | import org.dromara.eims.domain.EimsRepairRes; |
| | | 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_repair_res |
| | | * |
| | | * @author zhuguifei |
| | | * @date 2025-02-25 |
| | | */ |
| | | @Data |
| | | @EqualsAndHashCode(callSuper = true) |
| | | @AutoMapper(target = EimsRepairRes.class, reverseConvertGenerate = false) |
| | | public class EimsRepairResBo extends BaseEntity { |
| | | |
| | | /** |
| | | * |
| | | */ |
| | | @NotNull(message = "ä¸è½ä¸ºç©º", groups = { EditGroup.class }) |
| | | private Long id; |
| | | |
| | | /** |
| | | * æ¥ä¿®åid |
| | | */ |
| | | @NotNull(message = "æ¥ä¿®åä¸è½ä¸ºç©º", groups = { AddGroup.class, EditGroup.class }) |
| | | private Long reqId; |
| | | |
| | | /** |
| | | * ç»´ä¿®åå· |
| | | */ |
| | | @NotNull(message = "æ¥ä¿®åç¼å·ä¸è½ä¸ºç©º", groups = { AddGroup.class, EditGroup.class }) |
| | | private String resCode; |
| | | |
| | | /** |
| | | * 维修人 |
| | | */ |
| | | @NotNull(message = "维修人ä¸è½ä¸ºç©º", groups = { AddGroup.class, EditGroup.class }) |
| | | private Long resUser; |
| | | |
| | | /** |
| | | * 维修人é¨é¨ |
| | | */ |
| | | @NotNull(message = "维修人é¨é¨ä¸è½ä¸ºç©º", groups = { AddGroup.class, EditGroup.class }) |
| | | private Long resDept; |
| | | |
| | | /** |
| | | * åå åæ |
| | | |
| | | */ |
| | | private String resReason; |
| | | |
| | | /** |
| | | * å¤çæªæ½ |
| | | */ |
| | | private String resHandle; |
| | | |
| | | /** |
| | | * é¢é²æªæ½ |
| | | */ |
| | | private String resPrevent; |
| | | |
| | | /** |
| | | * ç»´ä¿®ç¶æ(åå
¸) |
| | | */ |
| | | @NotBlank(message = "ç»´ä¿®ç¶æ(åå
¸)ä¸è½ä¸ºç©º", groups = { AddGroup.class, EditGroup.class }) |
| | | private String status; |
| | | |
| | | /** |
| | | * å¼å§æ¶é´ |
| | | */ |
| | | @NotNull(message = "å¼å§æ¶é´ä¸è½ä¸ºç©º", groups = { AddGroup.class, EditGroup.class }) |
| | | private Date startTime; |
| | | |
| | | /** |
| | | * ç»ææ¶é´ |
| | | */ |
| | | private Date endTime; |
| | | |
| | | /** |
| | | * 使ç¨å·¥å
· |
| | | */ |
| | | private String useFixture; |
| | | |
| | | /** |
| | | * 使ç¨å¤ä»¶ |
| | | */ |
| | | private String useParts; |
| | | |
| | | /** |
| | | * 夿³¨ |
| | | */ |
| | | private String remark; |
| | | |
| | | |
| | | // å
³èè¡¨åæ®µ |
| | | private String reqCode;//æ¥ä¿®åç¼ç |
| | | private String reqUser;//æ¥ä¿®äºº |
| | | |
| | | |
| | | } |
| | |
| | | private Long repairId; |
| | | |
| | | /** |
| | | * 维修工åcode |
| | | */ |
| | | @Translation(type = TransConstant.REPAIR_RES_ID_TO_CODE, mapper = "repairId") |
| | | private String resCode; |
| | | |
| | | /** |
| | | * 维修人é¨é¨ |
| | | */ |
| | | @ExcelProperty(value = "维修人é¨é¨") |
¶Ô±ÈÐÂÎļþ |
| | |
| | | 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.EimsRepairRes; |
| | | 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_repair_res |
| | | * |
| | | * @author zhuguifei |
| | | * @date 2025-02-25 |
| | | */ |
| | | @Data |
| | | @ExcelIgnoreUnannotated |
| | | @AutoMapper(target = EimsRepairRes.class) |
| | | public class EimsRepairResVo implements Serializable { |
| | | |
| | | @Serial |
| | | private static final long serialVersionUID = 1L; |
| | | |
| | | /** |
| | | * |
| | | */ |
| | | @ExcelProperty(value = "") |
| | | private Long id; |
| | | |
| | | /** |
| | | * æ¥ä¿®åid |
| | | */ |
| | | @ExcelProperty(value = "æ¥ä¿®åid") |
| | | private Long reqId; |
| | | |
| | | /** |
| | | * ç»´ä¿®åå· |
| | | */ |
| | | @ExcelProperty(value = "ç»´ä¿®åå·") |
| | | private String resCode; |
| | | |
| | | /** |
| | | * 维修人 |
| | | */ |
| | | private Long resUser; |
| | | |
| | | @ExcelProperty(value = "维修人") |
| | | @Translation(type = TransConstant.USER_ID_TO_NICKNAME, mapper = "resUser") |
| | | private String resUserName; |
| | | |
| | | /** |
| | | * 维修人é¨é¨ |
| | | */ |
| | | |
| | | private Long resDept; |
| | | @ExcelProperty(value = "维修人é¨é¨") |
| | | @Translation(type = TransConstant.DEPT_ID_TO_NAME, mapper = "resDept") |
| | | private String resDeptName; |
| | | |
| | | /** |
| | | * åå åæ |
| | | |
| | | */ |
| | | @ExcelProperty(value = "åå åæ") |
| | | private String resReason; |
| | | |
| | | /** |
| | | * å¤çæªæ½ |
| | | */ |
| | | @ExcelProperty(value = "å¤çæªæ½") |
| | | private String resHandle; |
| | | |
| | | /** |
| | | * é¢é²æªæ½ |
| | | */ |
| | | @ExcelProperty(value = "é¢é²æªæ½") |
| | | private String resPrevent; |
| | | |
| | | /** |
| | | * ç»´ä¿®ç¶æ(åå
¸) |
| | | */ |
| | | @ExcelProperty(value = "ç»´ä¿®ç¶æ(åå
¸)", converter = ExcelDictConvert.class) |
| | | @ExcelDictFormat(dictType = "repair_res_status") |
| | | private String status; |
| | | |
| | | /** |
| | | * å¼å§æ¶é´ |
| | | */ |
| | | @ExcelProperty(value = "å¼å§æ¶é´") |
| | | private Date startTime; |
| | | |
| | | /** |
| | | * ç»ææ¶é´ |
| | | */ |
| | | @ExcelProperty(value = "ç»ææ¶é´") |
| | | private Date endTime; |
| | | |
| | | /** |
| | | * 使ç¨å·¥å
· |
| | | */ |
| | | @ExcelProperty(value = "使ç¨å·¥å
·") |
| | | private String useFixture; |
| | | |
| | | /** |
| | | * 使ç¨å¤ä»¶ |
| | | */ |
| | | @ExcelProperty(value = "使ç¨å¤ä»¶") |
| | | private String useParts; |
| | | |
| | | /** |
| | | * 夿³¨ |
| | | */ |
| | | @ExcelProperty(value = "夿³¨") |
| | | private String remark; |
| | | |
| | | |
| | | // å
³èè¡¨åæ®µ |
| | | private String reqType;//æ¥ä¿®ç±»å |
| | | @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") |
| | | private Date reqTime;//æ¥ä¿®æ¶é´ |
| | | private String equName;//设å¤åç§° |
| | | private String fixtureName;//å·¥å
·åç§° |
| | | private String faultType;//æ
éç±»å« |
| | | private String reqDeptName;//æ¥ä¿®é¨é¨ |
| | | private String reqUserName;//æ¥ä¿®äºº |
| | | private String reqDesc;//æ
éæè¿° |
| | | @Translation(type = TransConstant.REPAIR_REQ_ID_TO_CODE, mapper = "reqId") |
| | | private String reqCode;//æ¥ä¿®ç¼ç |
| | | |
| | | |
| | | } |
| | |
| | | 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.constant.DictConstants; |
| | | import org.dromara.common.core.exception.ServiceException; |
| | | import org.dromara.common.core.service.DictService; |
| | | import org.dromara.common.core.utils.DateUtils; |
| | |
| | | this.dictService = SpringUtils.getBean(DictService.class); |
| | | this.isUpdateSupport = isUpdateSupport; |
| | | this.operUserId = LoginHelper.getUserId(); |
| | | this.unitDictMap = dictService.getAllDictByDictType(CacheConstants.EIMS_EQU_UNIT); |
| | | this.unitDictMap = dictService.getAllDictByDictType(DictConstants.EIMS_EQU_UNIT); |
| | | } |
| | | |
| | | @Override |
| | |
| | | //ValidatorUtils.validate(equ); |
| | | |
| | | //æ·»å åæ®µé»è®¤å±æ§ |
| | | equ.setImportStatus(dictService.getDictValue(CacheConstants.EIMS_IMPORT_STATUS,"æ°å¯¼å
¥")); |
| | | equ.setImportStatus(dictService.getDictValue(DictConstants.EIMS_IMPORT_STATUS,"æ°å¯¼å
¥")); |
| | | equ.setCreateBy(operUserId); |
| | | equService.insertByBo(equ); |
| | | successNum++; |
| | |
| | | import com.baomidou.mybatisplus.core.toolkit.Constants; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import org.apache.ibatis.annotations.Param; |
| | | import org.dromara.common.mybatis.annotation.DataColumn; |
| | | import org.dromara.common.mybatis.annotation.DataPermission; |
| | | import org.dromara.common.mybatis.core.mapper.BaseMapperPlus; |
| | | import org.dromara.eims.domain.EimsRepairReq; |
| | | import org.dromara.eims.domain.vo.EimsRepairReqVo; |
| | |
| | | * @author zhuguifei |
| | | * @date 2025-02-11 |
| | | */ |
| | | @DataPermission({ |
| | | @DataColumn(key = "deptName", value = "a.create_dept"), |
| | | @DataColumn(key = "userName", value = "a.create_by") |
| | | }) |
| | | public interface EimsRepairReqMapper extends BaseMapperPlus<EimsRepairReq, EimsRepairReqVo> { |
| | | |
| | | Page<EimsRepairReqVo> selectRepairReqList(@Param("page") Page<EimsRepairReqVo> page, @Param(Constants.WRAPPER) Wrapper<EimsRepairReq> queryWrapper); |
| | | |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package org.dromara.eims.mapper; |
| | | |
| | | import com.baomidou.mybatisplus.core.conditions.Wrapper; |
| | | import com.baomidou.mybatisplus.core.toolkit.Constants; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import org.apache.ibatis.annotations.Param; |
| | | import org.dromara.common.mybatis.core.mapper.BaseMapperPlus; |
| | | import org.dromara.eims.domain.EimsRepairRes; |
| | | import org.dromara.eims.domain.vo.EimsRepairResVo; |
| | | |
| | | /** |
| | | * 维修工åMapperæ¥å£ |
| | | * |
| | | * @author zhuguifei |
| | | * @date 2025-02-25 |
| | | */ |
| | | public interface EimsRepairResMapper extends BaseMapperPlus<EimsRepairRes, EimsRepairResVo> { |
| | | Page<EimsRepairResVo> selectRepairResList(@Param("page") Page<EimsRepairResVo> page, @Param(Constants.WRAPPER) Wrapper<EimsRepairRes> queryWrapper); |
| | | |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package org.dromara.eims.service; |
| | | |
| | | import org.dromara.eims.domain.bo.EimsRepairReqBo; |
| | | import org.dromara.eims.domain.vo.EimsRepairReqVo; |
| | | import org.dromara.eims.domain.vo.EimsRepairResVo; |
| | | import org.dromara.eims.domain.bo.EimsRepairResBo; |
| | | 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-25 |
| | | */ |
| | | public interface IEimsRepairResService { |
| | | |
| | | /** |
| | | * æ¥è¯¢ç»´ä¿®å·¥å |
| | | * |
| | | * @param id ä¸»é® |
| | | * @return 维修工å |
| | | */ |
| | | EimsRepairResVo queryById(Long id); |
| | | |
| | | /** |
| | | * å页æ¥è¯¢ç»´ä¿®å·¥åå表 |
| | | * |
| | | * @param bo æ¥è¯¢æ¡ä»¶ |
| | | * @param pageQuery å页忰 |
| | | * @return 维修工åå页å表 |
| | | */ |
| | | TableDataInfo<EimsRepairResVo> queryPageList(EimsRepairResBo bo, PageQuery pageQuery); |
| | | |
| | | /** |
| | | * æ¥è¯¢ç¬¦åæ¡ä»¶ç维修工åå表 |
| | | * |
| | | * @param bo æ¥è¯¢æ¡ä»¶ |
| | | * @return 维修工åå表 |
| | | */ |
| | | List<EimsRepairResVo> queryList(EimsRepairResBo bo); |
| | | |
| | | /** |
| | | * æ°å¢ç»´ä¿®å·¥å |
| | | * |
| | | * @param bo 维修工å |
| | | * @return æ¯å¦æ°å¢æå |
| | | */ |
| | | Boolean insertByBo(EimsRepairResBo bo); |
| | | |
| | | /** |
| | | * ä¿®æ¹ç»´ä¿®å·¥å |
| | | * |
| | | * @param bo 维修工å |
| | | * @return æ¯å¦ä¿®æ¹æå |
| | | */ |
| | | Boolean updateByBo(EimsRepairResBo bo); |
| | | |
| | | /** |
| | | * æ ¡éªå¹¶æ¹éå é¤ç»´ä¿®å·¥åä¿¡æ¯ |
| | | * |
| | | * @param ids å¾
å é¤ç主é®éå |
| | | * @param isValid æ¯å¦è¿è¡æææ§æ ¡éª |
| | | * @return æ¯å¦å 餿å |
| | | */ |
| | | Boolean deleteWithValidByIds(Collection<Long> ids, Boolean isValid); |
| | | |
| | | |
| | | /** |
| | | * å页æ¥è¯¢ç»´ä¿®å·¥åå表-å¤è¡¨æ¥è¯¢ |
| | | * |
| | | * @param bo æ¥è¯¢æ¡ä»¶ |
| | | * @param pageQuery å页忰 |
| | | * @return 维修工åå页å表 |
| | | */ |
| | | TableDataInfo<EimsRepairResVo> queryPageListCustom(EimsRepairResBo bo, PageQuery pageQuery); |
| | | } |
| | |
| | | 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.service.RepairReqService; |
| | | 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 lombok.RequiredArgsConstructor; |
| | | import org.dromara.eims.domain.EimsEqu; |
| | | import org.dromara.eims.domain.EimsFixtureBorrow; |
| | | import org.dromara.eims.domain.vo.EimsFixtureVo; |
| | | import org.dromara.eims.domain.vo.EimsInventoryDetailVo; |
| | | import org.dromara.eims.utils.DataFilterUtil; |
| | | import org.dromara.system.domain.SysDept; |
| | |
| | | */ |
| | | @RequiredArgsConstructor |
| | | @Service |
| | | public class EimsRepairReqServiceImpl implements IEimsRepairReqService { |
| | | public class EimsRepairReqServiceImpl implements IEimsRepairReqService, RepairReqService { |
| | | |
| | | private final EimsRepairReqMapper baseMapper; |
| | | private final SysDeptMapper sysDeptMapper; |
| | |
| | | |
| | | @Override |
| | | public TableDataInfo<EimsRepairReqVo> queryPageListCustom(EimsRepairReqBo bo, PageQuery pageQuery) { |
| | | DataFilterUtil.getInstance().filterRepairReq(bo); |
| | | //DataFilterUtil.getInstance().filterRepairReq(bo); |
| | | Page<EimsRepairReqVo> page = baseMapper.selectRepairReqList(pageQuery.build(), buildWrapper(bo)); |
| | | return TableDataInfo.build(page); |
| | | } |
| | |
| | | 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.in(params.containsKey("createBy"), "a.create_by", (List<Long>) params.get("createBy")); |
| | | qw.eq(params.containsKey("status"), "a.status", params.get("status")); |
| | | qw.between(params.get("beginReqTime") != null && params.get("endReqTime") != null, |
| | | "a.req_time", params.get("beginReqTime"), params.get("endReqTime")); |
| | |
| | | } |
| | | |
| | | |
| | | @Override |
| | | public String selectRepairReqCodeByIds(String reqIds) { |
| | | List<String> list = new ArrayList<>(); |
| | | for (Long id : StringUtils.splitTo(reqIds, Convert::toLong)) { |
| | | EimsRepairReqVo vo = SpringUtils.getAopProxy(this).queryById(id); |
| | | if (ObjectUtil.isNotNull(vo)) { |
| | | list.add(vo.getCode()); |
| | | } |
| | | } |
| | | return String.join(StringUtils.SEPARATOR, list); |
| | | } |
| | | |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | 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.constant.DictConstants; |
| | | import org.dromara.common.core.service.RepairResService; |
| | | 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.EimsFixture; |
| | | import org.dromara.eims.domain.EimsRepairReq; |
| | | import org.dromara.eims.domain.vo.EimsRepairReqVo; |
| | | import org.dromara.eims.mapper.EimsRepairReqMapper; |
| | | import org.dromara.eims.utils.DataFilterUtil; |
| | | import org.dromara.system.domain.SysDept; |
| | | import org.dromara.system.domain.vo.SysDeptVo; |
| | | import org.dromara.system.mapper.SysDeptMapper; |
| | | import org.springframework.stereotype.Service; |
| | | import org.dromara.eims.domain.bo.EimsRepairResBo; |
| | | import org.dromara.eims.domain.vo.EimsRepairResVo; |
| | | import org.dromara.eims.domain.EimsRepairRes; |
| | | import org.dromara.eims.mapper.EimsRepairResMapper; |
| | | import org.dromara.eims.service.IEimsRepairResService; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | |
| | | import java.util.ArrayList; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | import java.util.Collection; |
| | | |
| | | /** |
| | | * 维修工åServiceä¸å¡å±å¤ç |
| | | * |
| | | * @author zhuguifei |
| | | * @date 2025-02-25 |
| | | */ |
| | | @RequiredArgsConstructor |
| | | @Service |
| | | public class EimsRepairResServiceImpl implements IEimsRepairResService, RepairResService { |
| | | |
| | | private final EimsRepairResMapper baseMapper; |
| | | private final EimsRepairReqMapper reqMapper; |
| | | private final SysDeptMapper deptMapper; |
| | | |
| | | /** |
| | | * æ¥è¯¢ç»´ä¿®å·¥å |
| | | * |
| | | * @param id ä¸»é® |
| | | * @return 维修工å |
| | | */ |
| | | @Override |
| | | public EimsRepairResVo queryById(Long id) { |
| | | return baseMapper.selectVoById(id); |
| | | } |
| | | |
| | | /** |
| | | * å页æ¥è¯¢ç»´ä¿®å·¥åå表 |
| | | * |
| | | * @param bo æ¥è¯¢æ¡ä»¶ |
| | | * @param pageQuery å页忰 |
| | | * @return 维修工åå页å表 |
| | | */ |
| | | @Override |
| | | public TableDataInfo<EimsRepairResVo> queryPageList(EimsRepairResBo bo, PageQuery pageQuery) { |
| | | LambdaQueryWrapper<EimsRepairRes> lqw = buildQueryWrapper(bo); |
| | | Page<EimsRepairResVo> result = baseMapper.selectVoPage(pageQuery.build(), lqw); |
| | | return TableDataInfo.build(result); |
| | | } |
| | | |
| | | /** |
| | | * æ¥è¯¢ç¬¦åæ¡ä»¶ç维修工åå表 |
| | | * |
| | | * @param bo æ¥è¯¢æ¡ä»¶ |
| | | * @return 维修工åå表 |
| | | */ |
| | | @Override |
| | | public List<EimsRepairResVo> queryList(EimsRepairResBo bo) { |
| | | LambdaQueryWrapper<EimsRepairRes> lqw = buildQueryWrapper(bo); |
| | | List<EimsRepairResVo> eimsRepairResVos = baseMapper.selectVoList(lqw); |
| | | return eimsRepairResVos; |
| | | } |
| | | |
| | | private LambdaQueryWrapper<EimsRepairRes> buildQueryWrapper(EimsRepairResBo bo) { |
| | | Map<String, Object> params = bo.getParams(); |
| | | LambdaQueryWrapper<EimsRepairRes> lqw = Wrappers.lambdaQuery(); |
| | | lqw.eq(bo.getResUser() != null, EimsRepairRes::getResUser, bo.getResUser()); |
| | | lqw.eq(bo.getResDept() != null, EimsRepairRes::getResDept, bo.getResDept()); |
| | | lqw.eq(StringUtils.isNotBlank(bo.getStatus()), EimsRepairRes::getStatus, bo.getStatus()); |
| | | lqw.between(params.get("beginStartTime") != null && params.get("endStartTime") != null, |
| | | EimsRepairRes::getStartTime, params.get("beginStartTime"), params.get("endStartTime")); |
| | | lqw.between(params.get("beginEndTime") != null && params.get("endEndTime") != null, |
| | | EimsRepairRes::getEndTime, params.get("beginEndTime"), params.get("endEndTime")); |
| | | return lqw; |
| | | } |
| | | |
| | | /** |
| | | * æ°å¢ç»´ä¿®å·¥å |
| | | * |
| | | * @param bo 维修工å |
| | | * @return æ¯å¦æ°å¢æå |
| | | */ |
| | | @Transactional(rollbackFor = Exception.class) |
| | | @Override |
| | | public Boolean insertByBo(EimsRepairResBo bo) { |
| | | EimsRepairRes add = MapstructUtils.convert(bo, EimsRepairRes.class); |
| | | validEntityBeforeSave(add); |
| | | boolean flag = baseMapper.insert(add) > 0; |
| | | if (flag) { |
| | | bo.setId(add.getId()); |
| | | // æ°å¢ç»´ä¿®å·¥åçæ¶åæ´æ°æ¥ä¿®åæ°æ® |
| | | EimsRepairReqVo reqVo = reqMapper.selectVoById(bo.getReqId()); |
| | | reqVo.setRepairId(add.getId()); |
| | | reqVo.setStatus(DictConstants.REPAIR_REQ_STATUS_DETAIL.WEIXIU); |
| | | EimsRepairReq req = MapstructUtils.convert(reqVo, EimsRepairReq.class); |
| | | reqMapper.updateById(req); |
| | | } |
| | | return flag; |
| | | } |
| | | |
| | | /** |
| | | * ä¿®æ¹ç»´ä¿®å·¥å |
| | | * |
| | | * @param bo 维修工å |
| | | * @return æ¯å¦ä¿®æ¹æå |
| | | */ |
| | | @Transactional(rollbackFor = Exception.class) |
| | | @Override |
| | | public Boolean updateByBo(EimsRepairResBo bo) { |
| | | EimsRepairRes update = MapstructUtils.convert(bo, EimsRepairRes.class); |
| | | |
| | | EimsRepairResVo resVo = baseMapper.selectVoById(bo.getId()); |
| | | String status = resVo.getStatus(); |
| | | //馿¬¡æ´æ°éè¦åæ¥æ´æ°æ¥ä¿®åç¶æ |
| | | if (bo.getStatus().equals(DictConstants.REPAIR_RES_STATUS_DETAIL.WANCHENG) && |
| | | status.equals(DictConstants.REPAIR_RES_STATUS_DETAIL.WEIXIU)) { |
| | | EimsRepairReqVo reqVo = reqMapper.selectVoById(bo.getReqId()); |
| | | reqVo.setStatus(DictConstants.REPAIR_REQ_STATUS_DETAIL.WANCHENG); |
| | | EimsRepairReq req = MapstructUtils.convert(reqVo, EimsRepairReq.class); |
| | | reqMapper.updateById(req); |
| | | } |
| | | validEntityBeforeSave(update); |
| | | return baseMapper.updateById(update) > 0; |
| | | } |
| | | |
| | | /** |
| | | * ä¿ååçæ°æ®æ ¡éª |
| | | */ |
| | | private void validEntityBeforeSave(EimsRepairRes 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 TableDataInfo<EimsRepairResVo> queryPageListCustom(EimsRepairResBo bo, PageQuery pageQuery) { |
| | | Page<EimsRepairResVo> page = baseMapper.selectRepairResList(pageQuery.build(), buildWrapper(bo)); |
| | | return TableDataInfo.build(page); |
| | | } |
| | | |
| | | private QueryWrapper<EimsRepairRes> buildWrapper(EimsRepairResBo bo) { |
| | | Map<String, Object> params = bo.getParams(); |
| | | QueryWrapper<EimsRepairRes> qw = Wrappers.query(); |
| | | qw.like(StringUtils.isNotBlank(bo.getResCode()), "res.res_code", bo.getResCode()); |
| | | qw.like(StringUtils.isNotBlank(bo.getReqCode()), "req.code", bo.getReqCode()); |
| | | qw.eq(bo.getResUser() != null, "res.res_user", bo.getResUser()); |
| | | |
| | | List<Long> allDescendantIds = getAllDescendantIds(bo.getResDept()); |
| | | qw.in(bo.getResDept() != null, "res.res_dept", allDescendantIds); |
| | | |
| | | qw.eq(StringUtils.isNotBlank(bo.getStatus()), "res.status", bo.getStatus()); |
| | | qw.orderByDesc("res.create_time"); |
| | | return qw; |
| | | } |
| | | |
| | | |
| | | /** |
| | | * æ ¹æ®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<SysDept> sysDeptWrapper = new QueryWrapper<>(); |
| | | sysDeptWrapper.lambda().eq(SysDept::getParentId, currentId); |
| | | |
| | | List<SysDeptVo> children = deptMapper.selectVoList(sysDeptWrapper); |
| | | if (children != null && !children.isEmpty()) { |
| | | for (SysDeptVo child : children) { |
| | | Long childId = child.getDeptId(); |
| | | collector.add(childId); |
| | | collectDescendants(childId, collector); |
| | | } |
| | | } |
| | | } |
| | | |
| | | |
| | | @Override |
| | | public String selectRepairResCodeByIds(String resIds) { |
| | | List<String> list = new ArrayList<>(); |
| | | for (Long id : StringUtils.splitTo(resIds, Convert::toLong)) { |
| | | EimsRepairResVo vo = SpringUtils.getAopProxy(this).queryById(id); |
| | | if (ObjectUtil.isNotNull(vo)) { |
| | | list.add(vo.getResCode()); |
| | | } |
| | | } |
| | | return String.join(StringUtils.SEPARATOR, list); |
| | | } |
| | | } |
| | |
| | | package org.dromara.eims.utils; |
| | | |
| | | import org.dromara.common.core.constant.DictConstants; |
| | | import org.dromara.common.core.domain.model.LoginUser; |
| | | import org.dromara.common.satoken.utils.LoginHelper; |
| | | import org.dromara.eims.domain.bo.EimsRepairReqBo; |
| | | import org.dromara.eims.domain.bo.EimsRepairResBo; |
| | | |
| | | import java.util.Set; |
| | | import java.util.*; |
| | | |
| | | /** |
| | | * èªå®ä¹æ°æ®é离 |
| | |
| | | //æ¥ä¿®å |
| | | public void filterRepairReq(EimsRepairReqBo bo){ |
| | | LoginUser loginUser = LoginHelper.getLoginUser(); |
| | | if (loginUser == null) return; |
| | | Set<String> rolePermission = loginUser.getRolePermission(); |
| | | if (rolePermission == null) return; |
| | | if (rolePermission.contains(Role.operator.name())) { |
| | | //维修工åªè½æ¥è¯¢èªå·±çæ°æ® |
| | | bo.setCreateBy(loginUser.getUserId()); |
| | | Map<String, Object> params = bo.getParams(); |
| | | List<Long> userList = new ArrayList<>(); |
| | | if (rolePermission == null) { |
| | | //没ææéä¸å
许æ¥è¯¢æ°æ® |
| | | userList.add(-1L); |
| | | |
| | | }else if (rolePermission.contains(Role.operator.name())) { |
| | | //æä½å·¥åªè½æ¥è¯¢èªå·±çæ°æ® |
| | | userList.add(loginUser.getUserId()); |
| | | }else if (rolePermission.contains(Role.repair.name())) { |
| | | //TODO 维修工åªè½æ¥è¯¢æªæ¥åç¶æçæ¥ä¿®åï¼å
·ä½ç¶æåèåå
¸repair_req_statusï¼ |
| | | bo.setStatus("0"); |
| | | bo.setStatus(DictConstants.REPAIR_REQ_STATUS_DETAIL.JIEDAN); |
| | | } |
| | | System.err.println(loginUser); |
| | | params.put("createBy", userList); |
| | | } |
| | | |
| | | //维修工å |
| | | public void filterRepairRes(EimsRepairResBo bo){ |
| | | LoginUser loginUser = LoginHelper.getLoginUser(); |
| | | Set<String> rolePermission = loginUser.getRolePermission(); |
| | | Map<String, Object> params = bo.getParams(); |
| | | List<Long> userList = new ArrayList<>(); |
| | | if (rolePermission == null) { |
| | | //没ææéä¸å
许æ¥è¯¢æ°æ® |
| | | userList.add(-1L); |
| | | |
| | | }else if (rolePermission.contains(Role.operator.name())) { |
| | | //æä½å·¥åªè½æ¥è¯¢èªå·±çæ°æ® |
| | | userList.add(loginUser.getUserId()); |
| | | }else if (rolePermission.contains(Role.repair.name())) { |
| | | //TODO 维修工åªè½æ¥è¯¢æªæ¥åç¶æçæ¥ä¿®åï¼å
·ä½ç¶æåèåå
¸repair_req_statusï¼ |
| | | bo.setStatus(DictConstants.REPAIR_REQ_STATUS_DETAIL.JIEDAN); |
| | | } |
| | | params.put("createBy", userList); |
| | | } |
| | | |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | <?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.EimsRepairResMapper"> |
| | | <resultMap type="org.dromara.eims.domain.vo.EimsRepairResVo" id="EimsRepairResResult"> |
| | | </resultMap> |
| | | <select id="selectRepairResList" resultMap="EimsRepairResResult"> |
| | | SELECT res.*,req.req_type reqType,req.req_time reqTime,equ.equ_name equName,req.fault_type faultType, |
| | | fix.fixture_name fixtureName,dep.dept_name reqDeptName,usr.nick_name reqUserName,req.req_desc reqDesc, |
| | | req.code reqCode |
| | | FROM eims_repair_res res |
| | | LEFT JOIN eims_repair_req req on res.req_id = req.id |
| | | LEFT JOIN eims_equ equ ON req.equ_id = equ.equ_id |
| | | LEFT JOIN eims_fixture fix ON req.fixture_id = fix.id |
| | | LEFT JOIN sys_dept dep ON req.req_dept = dep.dept_id |
| | | LEFT JOIN sys_user usr ON req.req_user = usr.user_id |
| | | ${ew.getCustomSqlSegment} |
| | | </select> |
| | | |
| | | </mapper> |