¶Ô±ÈÐÂÎļþ |
| | |
| | | import type { RepairRecordVO } from './model'; |
| | | |
| | | import type { ID, IDS } from '#/api/common'; |
| | | |
| | | import { commonExport } from '#/api/helper'; |
| | | import { requestClient } from '#/api/request'; |
| | | |
| | | enum Api { |
| | | repairRecordExport = '/eims/repairRecord/export', |
| | | repairRecordList = '/eims/repairRecord/list', |
| | | root = '/eims/repairRecord' |
| | | } |
| | | |
| | | /** |
| | | * æ¥è¯¢ç»´ä¿®è®°å½å表 |
| | | * @param query |
| | | * @returns {*} |
| | | */ |
| | | |
| | | export function listRepairRecord(params?: any) { |
| | | return requestClient.get<RepairRecordVO[]>(Api.repairRecordList, { params }); |
| | | } |
| | | |
| | | /** |
| | | * æ¥è¯¢ç»´ä¿®è®°å½è¯¦ç» |
| | | * @param RepairRecordId |
| | | */ |
| | | export function getRepairRecord(RepairRecordId: ID) { |
| | | return requestClient.get<RepairRecordVO>(`${Api.root}/${RepairRecordId}`); |
| | | } |
| | | |
| | | /** |
| | | * æ°å¢ç»´ä¿®è®°å½ |
| | | * @param data |
| | | */ |
| | | export function addRepairRecord(data: any) { |
| | | return requestClient.postWithMsg<void>(`${Api.root}`, data); |
| | | } |
| | | /** |
| | | * ä¿®æ¹ç»´ä¿®è®°å½ |
| | | * @param data |
| | | */ |
| | | export function updateRepairRecord(data: any) { |
| | | return requestClient.putWithMsg<void>(Api.root, data); |
| | | } |
| | | |
| | | /** |
| | | * å é¤ç»´ä¿®è®°å½ |
| | | * @param RepairRecordId |
| | | */ |
| | | export function delRepairRecord(RepairRecordId: IDS) { |
| | | return requestClient.deleteWithMsg<void>(`${Api.root}/${RepairRecordId}`); |
| | | } |
| | | /** |
| | | * å¯¼åº |
| | | * @param |
| | | */ |
| | | export function RepairRecordExport(data: any) { |
| | | return commonExport(Api.repairRecordExport, data); |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | export interface RepairRecordVO { |
| | | /** |
| | | * |
| | | */ |
| | | id: number | string; |
| | | |
| | | /** |
| | | * æ¥ä¿®åid |
| | | */ |
| | | reqId: number | string; |
| | | |
| | | /** |
| | | * ç»´ä¿®åid |
| | | */ |
| | | resId: number | string; |
| | | |
| | | /** |
| | | * å¤çæ¶é´ |
| | | */ |
| | | handleTime: string; |
| | | |
| | | /** |
| | | * æä½ç¨æ· |
| | | */ |
| | | operaUser: number; |
| | | |
| | | /** |
| | | * æä½(åå
¸) |
| | | */ |
| | | opera: string; |
| | | |
| | | /** |
| | | * æä½ç»æ |
| | | */ |
| | | operaResult: string; |
| | | |
| | | /** |
| | | * 夿³¨ |
| | | */ |
| | | remark: string; |
| | | } |
| | |
| | | * @param data |
| | | */ |
| | | export function addRepairRes(data: any) { |
| | | return requestClient.postWithMsg<void>(Api.root, data); |
| | | return requestClient.postWithMsg<void>(`${Api.root}/add`, data); |
| | | } |
| | | |
| | | /** |
| | | * æ°å¢ç»´ä¿®å·¥å-æ¹é |
| | | * @param data |
| | | */ |
| | | export function addBatchRepairRes(data: any) { |
| | | return requestClient.postWithMsg<void>(`${Api.root}/addBatch`, data); |
| | | } |
| | | |
| | | /** |
| | |
| | | import type { |
| | | DeptTree, |
| | | ResetPwdParam, |
| | | User, |
| | | UserImportParam, |
| | | UserInfoResponse, |
| | | } from './model'; |
| | | import type { DeptTree, ResetPwdParam, User, UserImportParam, UserInfoResponse } from './model'; |
| | | |
| | | import type { ID, IDS, PageQuery, PageResult } from '#/api/common'; |
| | | |
| | |
| | | import { requestClient } from '#/api/request'; |
| | | |
| | | enum Api { |
| | | deptRoleUserList = '/system/user/deptRoleUser', |
| | | deptTree = '/system/user/deptTree', |
| | | listDeptUsers = '/system/user/list/dept', |
| | | root = '/system/user', |
| | |
| | | userImportTemplate = '/system/user/importTemplate', |
| | | userList = '/system/user/list', |
| | | userResetPassword = '/system/user/resetPwd', |
| | | userStatusChange = '/system/user/changeStatus', |
| | | userStatusChange = '/system/user/changeStatus' |
| | | } |
| | | |
| | | /** |
| | |
| | | */ |
| | | export function userList(params?: PageQuery) { |
| | | return requestClient.get<PageResult<User>>(Api.userList, { params }); |
| | | } |
| | | |
| | | export function deptRoleUserList(params?: any) { |
| | | return requestClient.get<User[]>(Api.deptRoleUserList, { params }); |
| | | } |
| | | |
| | | /** |
| | |
| | | * @returns void |
| | | */ |
| | | export function userImportData(data: UserImportParam) { |
| | | return requestClient.post<{ code: number; msg: string }>( |
| | | Api.userImport, |
| | | data, |
| | | { |
| | | headers: { |
| | | 'Content-Type': ContentTypeEnum.FORM_DATA, |
| | | }, |
| | | isTransformResponse: false, |
| | | return requestClient.post<{ code: number; msg: string }>(Api.userImport, data, { |
| | | headers: { |
| | | 'Content-Type': ContentTypeEnum.FORM_DATA |
| | | }, |
| | | ); |
| | | isTransformResponse: false |
| | | }); |
| | | } |
| | | |
| | | /** |
| | |
| | | {}, |
| | | { |
| | | isTransformResponse: false, |
| | | responseType: 'blob', |
| | | }, |
| | | responseType: 'blob' |
| | | } |
| | | ); |
| | | } |
| | | |
| | |
| | | */ |
| | | export function userResetPassword(data: ResetPwdParam) { |
| | | return requestClient.putWithMsg<void>(Api.userResetPassword, data, { |
| | | encrypt: true, |
| | | encrypt: true |
| | | }); |
| | | } |
| | | |
| | |
| | | EQU = '1', // è®¾å¤æ
é |
| | | FIXTURE = '2', // å·¥å
·æ
é |
| | | OTHER = '3' // å
¶ä»æ
é |
| | | |
| | | } |
| | | /** |
| | | * æ¥ä¿®ç¶æ |
| | | */ |
| | | export enum REPAIR_REQ_STATUS { |
| | | JIEDAN = '0', // å¾
æ¥å |
| | | WEIXIU = '1', // ç»´ä¿®ä¸ |
| | | WANCHENG = '2' // 已宿 |
| | | } |
| | |
| | | sortChange: (sortParams) => vxeSortEvent(tableApi, sortParams), |
| | | cellClick: (e: any) => { |
| | | const { row } = e; |
| | | console.error() |
| | | handleBorroeList(row) |
| | | } |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | import type { VxeGridProps } from '#/adapter/vxe-table'; |
| | | |
| | | |
| | | |
| | | export const columns: VxeGridProps['columns'] = [ |
| | | { type: 'checkbox', width: 60, fixed: 'left' }, |
| | | { |
| | | title: 'æä½ç¨æ·', |
| | | field: 'operaUser', |
| | | width: 160, |
| | | }, |
| | | { |
| | | title: 'æä½', |
| | | field: 'opera', |
| | | width: 100, |
| | | }, |
| | | { |
| | | title: 'æä½ç»æ', |
| | | field: 'operaResult', |
| | | width: 160, |
| | | }, |
| | | { |
| | | title: '', |
| | | field: 'blank', |
| | | minWidth: 100, |
| | | } |
| | | ]; |
¶Ô±ÈÐÂÎļþ |
| | |
| | | <script setup lang="ts"> |
| | | import { watch } from 'vue'; |
| | | |
| | | import { useVbenVxeGrid, type VxeGridProps, vxeSortEvent } from '#/adapter/vxe-table'; |
| | | import { listRepairRecord } from '#/api/eims/repair-record'; |
| | | |
| | | import { columns } from '../repair-record/data'; |
| | | |
| | | interface Props { |
| | | reqId?: string; |
| | | resId?: string; |
| | | } |
| | | |
| | | const props = defineProps<Props>(); |
| | | |
| | | const gridOptions: VxeGridProps = { |
| | | checkboxConfig: { |
| | | // é«äº® |
| | | highlight: true, |
| | | // 翻页æ¶ä¿çéä¸ç¶æ |
| | | reserve: true |
| | | // ç¹å»è¡éä¸ |
| | | // trigger: 'row' |
| | | }, |
| | | columns, |
| | | height: 'auto', |
| | | keepSource: true, |
| | | pagerConfig: {}, |
| | | proxyConfig: { |
| | | ajax: { |
| | | query: async ({ page }, formValues = {}) => { |
| | | if (props.reqId) { |
| | | const params = { reqId: props.reqId }; |
| | | Object.assign(formValues, params); |
| | | } else if (props.resId) { |
| | | const params = { resId: props.resId }; |
| | | Object.assign(formValues, params); |
| | | } else { |
| | | const params = { resId: -1 }; |
| | | Object.assign(formValues, params); |
| | | } |
| | | return await listRepairRecord({ |
| | | pageNum: page.currentPage, |
| | | pageSize: page.pageSize, |
| | | ...formValues |
| | | // ...useRoleBaseFilters() |
| | | }); |
| | | } |
| | | } |
| | | }, |
| | | rowConfig: { |
| | | isHover: true, |
| | | keyField: 'id' |
| | | }, |
| | | sortConfig: { |
| | | // è¿ç¨æåº |
| | | remote: true, |
| | | // æ¯æå¤å段æåº é»è®¤å
³é |
| | | multiple: true |
| | | }, |
| | | id: 'eims-repair-record-index' |
| | | }; |
| | | |
| | | const [BasicTable, tableApi] = useVbenVxeGrid({ |
| | | gridOptions, |
| | | gridEvents: { |
| | | sortChange: (sortParams) => vxeSortEvent(tableApi, sortParams) |
| | | } |
| | | }); |
| | | |
| | | // ä½¿ç¨ watch çå¬ resId çåå |
| | | watch( |
| | | () => props.resId, |
| | | (newVal, oldVal) => { |
| | | if (newVal !== oldVal && newVal) { |
| | | tableApi.query(); |
| | | } |
| | | }, |
| | | { immediate: false } |
| | | ); |
| | | </script> |
| | | |
| | | <template> |
| | | <div class="w-full"> |
| | | <BasicTable table-title="æä½è®°å½" /> |
| | | </div> |
| | | </template> |
| | |
| | | label: 'æ¥ä¿®äºº' |
| | | } |
| | | ]; |
| | | |
| | | export const modalSchema: FormSchemaGetter = () => [ |
| | | { |
| | | component: 'Input', |
| | | dependencies: { |
| | | show: () => false, |
| | | triggerFields: [''] |
| | | }, |
| | | fieldName: 'id' |
| | | }, |
| | | { |
| | | component: 'Input', |
| | | dependencies: { |
| | | show: () => false, |
| | | triggerFields: [''] |
| | | }, |
| | | fieldName: 'batchReqIds' |
| | | }, |
| | | { |
| | | component: 'TreeSelect', |
| | | // å¨draweréæ´æ° è¿éä¸éè¦é»è®¤çcomponentProps |
| | | defaultValue: undefined, |
| | | fieldName: 'resDept', |
| | | label: 'ç»´ä¿®é¨é¨', |
| | | help: `æ¥ä¿®äººåæå±é¨é¨` |
| | | // rules: 'selectRequired', |
| | | }, |
| | | { |
| | | component: 'Select', |
| | | componentProps: { |
| | | showSearch: true, |
| | | allowClear: true, |
| | | getPopupContainer |
| | | }, |
| | | fieldName: 'resUser', |
| | | label: '维修人' |
| | | } |
| | | ]; |
| | |
| | | import { useUserStore } from '@vben/stores'; |
| | | import { addFullName, getPopupContainer, getVxePopupContainer } from '@vben/utils'; |
| | | |
| | | import { Modal, Popconfirm, Space } from 'ant-design-vue'; |
| | | import { message, Modal, Popconfirm, Space } from 'ant-design-vue'; |
| | | |
| | | import { useVbenVxeGrid, vxeCheckboxChecked, type VxeGridProps, vxeSortEvent } from '#/adapter/vxe-table'; |
| | | import { delRepairReq, listRepairReq, repairReqExport } from '#/api/eims/repair-req'; |
| | | import { getDeptTree, userList } from '#/api/system/user'; |
| | | import { REPAIR_REQ_STATUS } from '#/constants/dict'; |
| | | import { commonDownloadExcel } from '#/utils/file/download'; |
| | | |
| | | import { columns, querySchema } from './data'; |
| | | import repairReqDrawer from './repair-req-drawer.vue'; |
| | | |
| | | import sendWorkDrawer from './send-work-drawer.vue'; |
| | | |
| | | interface Props { |
| | | filterFlag?: boolean; |
| | | status?: string; |
| | | } |
| | | const props = withDefaults(defineProps<Props>(), { filterFlag: false, status: undefined }); |
| | | |
| | | |
| | | const userStore = useUserStore(); |
| | | const userId = userStore.userInfo?.userId; |
| | |
| | | defineExpose({ |
| | | tableSelect |
| | | }); |
| | | |
| | | |
| | | const formOptions: VbenFormProps = { |
| | | commonConfig: { |
| | |
| | | connectedComponent: repairReqDrawer |
| | | }); |
| | | |
| | | const [SendWorkDrawer, drawerApi] = useVbenDrawer({ |
| | | connectedComponent: sendWorkDrawer, |
| | | title: '派工' |
| | | }); |
| | | |
| | | function openSendWork() { |
| | | const rows = tableApi.grid.getCheckboxRecords(); |
| | | const ids = rows.map((row: any) => row.id).join(','); |
| | | const filterData = rows.filter((item) => item.status === REPAIR_REQ_STATUS.WEIXIU || item.status === REPAIR_REQ_STATUS.WANCHENG); |
| | | if (rows.length === 0) { |
| | | message.warn('è¯·éæ©æ¥ä¿®ååæ´¾å·¥ï¼'); |
| | | return; |
| | | } else if (filterData.length > 0) { |
| | | message.warn('è¯·éæ©æªæ¥åæ¥ä¿®ååæ´¾å·¥ï¼'); |
| | | return; |
| | | } |
| | | drawerApi.setData({ batchReqIds: ids }); |
| | | drawerApi.open(); |
| | | } |
| | | |
| | | function handleAdd() { |
| | | repairReqDrawerApi.setData({ reqUser: userId, reqDept: deptId }); |
| | | repairReqDrawerApi.open(); |
| | |
| | | fieldMappingTime: formOptions.fieldMappingTime |
| | | }); |
| | | } |
| | | |
| | | /** |
| | | * 派工 |
| | | */ |
| | | function handleSendWork() {} |
| | | |
| | | onMounted(async () => { |
| | | await setupDeptSelect(); |
| | |
| | | <BasicTable class="flex-1 overflow-hidden" table-title="æ
éæ¥ä¿®å表"> |
| | | <template #toolbar-tools> |
| | | <Space> |
| | | <a-button v-access:code="['eims:repairReq:send']" @click="openSendWork"> 派工 </a-button> |
| | | <a-button v-access:code="['eims:repairReq:export']" @click="handleDownloadExcel"> |
| | | {{ $t('pages.common.export') }} |
| | | </a-button> |
| | |
| | | </BasicTable> |
| | | </div> |
| | | <RepairReqDrawer @reload="tableApi.query()" /> |
| | | <SendWorkDrawer @reload="tableApi.query()" /> |
| | | </Page> |
| | | </template> |
| | |
| | | await setupDeptSelect(); |
| | | await setupEquTypeSelect(); |
| | | // æ°å¢æ¶é»è®¤å¡«å
ç»å½äººä¸ºæ¥ä¿®äºº |
| | | if (!isUpdate.value && reqUser !== null && reqDept !== null) { |
| | | if (!isUpdate.value && reqUser && reqDept ) { |
| | | await formApi.setValues({ 'reqUser': reqUser, 'reqDept': reqDept }); |
| | | await setupUserOptions(reqDept); |
| | | } |
| | |
| | | async function updateEqu(equ: any) { |
| | | await formApi.setValues({ 'equId': equ.equId, 'equName': equ.equName }); |
| | | } |
| | | |
| | | /** |
| | | * æ´æ°éæ©çå·¥å
· |
| | | * @param fixture |
| | |
| | | <CodeInput v-bind="slotProps" :disabled="isUpdate" prefix="BXD" /> |
| | | </template> |
| | | <template #equName="slotProps"> |
| | | <InputSearch :enter-button="true" placeholder="è¯·éæ©è®¾å¤" @search="onSearchEqu" v-bind="slotProps" :disabled="isUpdate" /> |
| | | <InputSearch :enter-button="true" placeholder="è¯·éæ©è®¾å¤" @search="onSearchEqu" v-bind="slotProps" |
| | | :disabled="isUpdate" /> |
| | | </template> |
| | | <template #fixtureName="slotProps"> |
| | | <InputSearch :enter-button="true" placeholder="è¯·éæ©å·¥å
·" @search="onSearchFixture" v-bind="slotProps" :disabled="isUpdate" /> |
| | | <InputSearch :enter-button="true" placeholder="è¯·éæ©å·¥å
·" @search="onSearchFixture" v-bind="slotProps" |
| | | :disabled="isUpdate" /> |
| | | </template> |
| | | </BasicForm> |
| | | <EquModal class="w-[1200px]" @update-equ="updateEqu" /> |
¶Ô±ÈÐÂÎļþ |
| | |
| | | <script setup lang="ts"> |
| | | import { ref } from 'vue'; |
| | | import { useVbenDrawer } from '@vben/common-ui'; |
| | | import { addFullName, cloneDeep, getPopupContainer } from '@vben/utils'; |
| | | |
| | | import { useVbenForm } from '#/adapter/form'; |
| | | import { addBatchRepairRes, getRepairRes, updateRepairRes } from '#/api/eims/repair-res'; |
| | | import { deptRoleUserList, getDeptTree } from '#/api/system/user'; |
| | | |
| | | import { modalSchema } from './data'; |
| | | |
| | | const emit = defineEmits<{ reload: [] }>(); |
| | | |
| | | const isUpdate = ref(false); |
| | | const [BasicForm, formApi] = useVbenForm({ |
| | | commonConfig: { |
| | | formItemClass: 'col-span-2', |
| | | componentProps: { |
| | | class: 'w-full' |
| | | }, |
| | | labelWidth: 120 |
| | | }, |
| | | schema: modalSchema(), |
| | | 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 { batchReqIds } = drawerApi.getData() as { batchReqIds?: string }; |
| | | await formApi.setValues({ batchReqIds }); |
| | | isUpdate.value = !!id; |
| | | // åå§å |
| | | await setupDeptSelect(); |
| | | // æ´æ° && èµå¼ |
| | | if (isUpdate.value && id) { |
| | | const record = await getRepairRes(id); |
| | | await formApi.setValues(record); |
| | | } |
| | | drawerApi.drawerLoading(false); |
| | | } |
| | | }); |
| | | |
| | | /** |
| | | * ç¨æ·çå è½½ |
| | | */ |
| | | async function setupUserOptions(deptId: any) { |
| | | const params = { deptId, roleKey: 'repair' }; |
| | | const userList = await deptRoleUserList(params); |
| | | const options = userList.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) : addBatchRepairRes(data)); |
| | | emit('reload'); |
| | | await handleCancel(); |
| | | } catch (error) { |
| | | console.error(error); |
| | | } finally { |
| | | drawerApi.drawerLoading(false); |
| | | } |
| | | } |
| | | |
| | | async function handleCancel() { |
| | | drawerApi.close(); |
| | | await formApi.resetForm(); |
| | | } |
| | | </script> |
| | | |
| | | <template> |
| | | <BasicDrawer :close-on-click-modal="false" class="w-[600px]"> |
| | | <BasicForm /> |
| | | </BasicDrawer> |
| | | </template> |
| | |
| | | }, |
| | | { |
| | | component: 'Input', |
| | | fieldName: 'reqUser', |
| | | dependencies: { |
| | | show: () => false, |
| | | triggerFields: [''] |
| | | }, |
| | | label: 'æ¥ä¿®äºº' |
| | | }, |
| | | { |
| | | component: 'Input', |
| | | fieldName: 'reqDept', |
| | | dependencies: { |
| | | show: () => false, |
| | | triggerFields: [''] |
| | | }, |
| | | label: 'æ¥ä¿®é¨é¨' |
| | | }, |
| | | { |
| | | component: 'Input', |
| | | fieldName: 'reqCode', |
| | | label: 'æ¥ä¿®åå·' |
| | | }, |
| | |
| | | label: '夿³¨' |
| | | }, |
| | | ]; |
| | | |
| | | |
| | |
| | | <script setup lang="ts"> |
| | | import type { Recordable } from '@vben/types'; |
| | | |
| | | import { onMounted } from 'vue'; |
| | | import { onMounted, ref } from 'vue'; |
| | | |
| | | 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 { getDeptTree, userList } from '#/api/system/user'; |
| | | import { commonDownloadExcel } from '#/utils/file/download'; |
| | | |
| | | import RepairRecord from '../repair-record/index.vue'; |
| | | 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; |
| | |
| | | id: 'eims-repair-res-index' |
| | | }; |
| | | |
| | | const resId = ref<string>(); |
| | | const [BasicTable, tableApi] = useVbenVxeGrid({ |
| | | formOptions, |
| | | gridOptions, |
| | | gridEvents: { |
| | | sortChange: (sortParams) => vxeSortEvent(tableApi, sortParams) |
| | | sortChange: (sortParams) => vxeSortEvent(tableApi, sortParams), |
| | | cellClick: (e: any) => { |
| | | const { row } = e; |
| | | resId.value = row.id; |
| | | } |
| | | } |
| | | }); |
| | | |
| | |
| | | |
| | | <template> |
| | | <Page :auto-content-height="true"> |
| | | <div class="flex h-full gap-[8px]"> |
| | | <BasicTable class="flex-1 overflow-hidden" table-title="维修工åå表"> |
| | | <div class="flex h-full gap-[8px] flex-col"> |
| | | <BasicTable class="h-2/3" table-title="维修工åå表"> |
| | | <template #toolbar-tools> |
| | | <Space> |
| | | <a-button v-access:code="['eims:repairRes:export']" @click="handleDownloadExcel"> |
| | |
| | | </Space> |
| | | </template> |
| | | </BasicTable> |
| | | <RepairRecord :res-id="resId" class="h-1/3" table-title="维修记å½" /> |
| | | </div> |
| | | <RepairResDrawer @reload="tableApi.query()" /> |
| | | </Page> |
| | |
| | | }); |
| | | } |
| | | const resCode = `WXD${req.code.slice(3)}`; |
| | | await formApi.setValues({ 'reqId': req.id, 'reqCode': req.code, 'resCode': resCode }); |
| | | await formApi.setValues({ 'reqId': req.id, 'reqUser': req.reqUser, 'reqDept': req.reqDept, 'reqCode': req.code, 'resCode': resCode }); |
| | | } |
| | | </script> |
| | | |
| | |
| | | String WANCHENG = "1"; |
| | | } |
| | | |
| | | /** |
| | | * 维修工åç¶æ |
| | | */ |
| | | String REPAIR_RECORD_HANDLE = "repair_record_handle"; |
| | | interface REPAIR_RECORD_HANDLE_DETAIL { |
| | | /** |
| | | * æ°å¢ |
| | | */ |
| | | String XINZENG = "1"; |
| | | /** |
| | | * æ¥å |
| | | */ |
| | | String JIEDAN = "2"; |
| | | |
| | | /** |
| | | * 宿 |
| | | */ |
| | | String WANCHENG = "3"; |
| | | } |
| | | |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | 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.EimsRepairRecordVo; |
| | | import org.dromara.eims.domain.bo.EimsRepairRecordBo; |
| | | import org.dromara.eims.service.IEimsRepairRecordService; |
| | | import org.dromara.common.mybatis.core.page.TableDataInfo; |
| | | |
| | | /** |
| | | * ç»´ä¿®è®°å½ |
| | | * |
| | | * @author zhuguifei |
| | | * @date 2025-02-26 |
| | | */ |
| | | @Validated |
| | | @RequiredArgsConstructor |
| | | @RestController |
| | | @RequestMapping("/eims/repairRecord") |
| | | public class EimsRepairRecordController extends BaseController { |
| | | |
| | | private final IEimsRepairRecordService eimsRepairRecordService; |
| | | |
| | | /** |
| | | * æ¥è¯¢ç»´ä¿®è®°å½å表 |
| | | */ |
| | | @SaCheckPermission("eims:repairRecord:list") |
| | | @GetMapping("/list") |
| | | public TableDataInfo<EimsRepairRecordVo> list(EimsRepairRecordBo bo, PageQuery pageQuery) { |
| | | return eimsRepairRecordService.queryPageList(bo, pageQuery); |
| | | } |
| | | |
| | | /** |
| | | * 导åºç»´ä¿®è®°å½å表 |
| | | */ |
| | | @SaCheckPermission("eims:repairRecord:export") |
| | | @Log(title = "维修记å½", businessType = BusinessType.EXPORT) |
| | | @PostMapping("/export") |
| | | public void export(EimsRepairRecordBo bo, HttpServletResponse response) { |
| | | List<EimsRepairRecordVo> list = eimsRepairRecordService.queryList(bo); |
| | | ExcelUtil.exportExcel(list, "维修记å½", EimsRepairRecordVo.class, response); |
| | | } |
| | | |
| | | /** |
| | | * è·å维修记å½è¯¦ç»ä¿¡æ¯ |
| | | * |
| | | * @param id ä¸»é® |
| | | */ |
| | | @SaCheckPermission("eims:repairRecord:query") |
| | | @GetMapping("/{id}") |
| | | public R<EimsRepairRecordVo> getInfo(@NotNull(message = "主é®ä¸è½ä¸ºç©º") |
| | | @PathVariable Long id) { |
| | | return R.ok(eimsRepairRecordService.queryById(id)); |
| | | } |
| | | |
| | | /** |
| | | * æ°å¢ç»´ä¿®è®°å½ |
| | | */ |
| | | @SaCheckPermission("eims:repairRecord:add") |
| | | @Log(title = "维修记å½", businessType = BusinessType.INSERT) |
| | | @RepeatSubmit() |
| | | @PostMapping() |
| | | public R<Void> add(@Validated(AddGroup.class) @RequestBody EimsRepairRecordBo bo) { |
| | | return toAjax(eimsRepairRecordService.insertByBo(bo)); |
| | | } |
| | | |
| | | /** |
| | | * ä¿®æ¹ç»´ä¿®è®°å½ |
| | | */ |
| | | @SaCheckPermission("eims:repairRecord:edit") |
| | | @Log(title = "维修记å½", businessType = BusinessType.UPDATE) |
| | | @RepeatSubmit() |
| | | @PutMapping() |
| | | public R<Void> edit(@Validated(EditGroup.class) @RequestBody EimsRepairRecordBo bo) { |
| | | return toAjax(eimsRepairRecordService.updateByBo(bo)); |
| | | } |
| | | |
| | | /** |
| | | * å é¤ç»´ä¿®è®°å½ |
| | | * |
| | | * @param ids 主é®ä¸² |
| | | */ |
| | | @SaCheckPermission("eims:repairRecord:remove") |
| | | @Log(title = "维修记å½", businessType = BusinessType.DELETE) |
| | | @DeleteMapping("/{ids}") |
| | | public R<Void> remove(@NotEmpty(message = "主é®ä¸è½ä¸ºç©º") |
| | | @PathVariable Long[] ids) { |
| | | return toAjax(eimsRepairRecordService.deleteWithValidByIds(List.of(ids), true)); |
| | | } |
| | | } |
| | |
| | | @SaCheckPermission("eims:repairRes:add") |
| | | @Log(title = "维修工å", businessType = BusinessType.INSERT) |
| | | @RepeatSubmit() |
| | | @PostMapping() |
| | | @PostMapping("add") |
| | | public R<Void> add(@Validated(AddGroup.class) @RequestBody EimsRepairResBo bo) { |
| | | return toAjax(eimsRepairResService.insertByBo(bo)); |
| | | } |
| | | |
| | | @SaCheckPermission("eims:repairRes:add") |
| | | @Log(title = "维修工å-æ¹é", businessType = BusinessType.INSERT) |
| | | @RepeatSubmit() |
| | | @PostMapping("addBatch") |
| | | public R<Void> addBatch(@RequestBody EimsRepairResBo bo) { |
| | | return toAjax(eimsRepairResService.insertBatchByBo(bo)); |
| | | } |
| | | |
| | | /** |
| | | * ä¿®æ¹ç»´ä¿®å·¥å |
| | | */ |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package org.dromara.eims.domain; |
| | | |
| | | import org.dromara.common.mybatis.core.domain.BaseEntity; |
| | | import com.baomidou.mybatisplus.annotation.*; |
| | | import lombok.Data; |
| | | import lombok.EqualsAndHashCode; |
| | | import java.util.Date; |
| | | import com.fasterxml.jackson.annotation.JsonFormat; |
| | | |
| | | import java.io.Serial; |
| | | |
| | | /** |
| | | * 维修记å½å¯¹è±¡ eims_repair_record |
| | | * |
| | | * @author zhuguifei |
| | | * @date 2025-02-26 |
| | | */ |
| | | @Data |
| | | @EqualsAndHashCode(callSuper = true) |
| | | @TableName("eims_repair_record") |
| | | public class EimsRepairRecord extends BaseEntity { |
| | | |
| | | @Serial |
| | | private static final long serialVersionUID = 1L; |
| | | |
| | | /** |
| | | * |
| | | */ |
| | | @TableId(value = "id") |
| | | private Long id; |
| | | |
| | | /** |
| | | * æ¥ä¿®åid |
| | | */ |
| | | private Long reqId; |
| | | |
| | | /** |
| | | * ç»´ä¿®åid |
| | | */ |
| | | private Long resId; |
| | | |
| | | /** |
| | | * å¤çæ¶é´ |
| | | */ |
| | | private Date handleTime; |
| | | |
| | | /** |
| | | * æä½ç¨æ· |
| | | */ |
| | | private Long operaUser; |
| | | |
| | | /** |
| | | * æä½(åå
¸) |
| | | */ |
| | | private String opera; |
| | | |
| | | /** |
| | | * æä½ç»æ |
| | | */ |
| | | private String operaResult; |
| | | |
| | | /** |
| | | * 夿³¨ |
| | | */ |
| | | private String remark; |
| | | |
| | | |
| | | } |
| | |
| | | */ |
| | | private Long reqId; |
| | | |
| | | private Long reqUser;//æ¥ä¿®äºº |
| | | |
| | | private Long reqDept;//æ¥ä¿®äººé¨é¨ |
| | | |
| | | /** |
| | | * ç»´ä¿®åå· |
| | | */ |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package org.dromara.eims.domain.bo; |
| | | |
| | | import org.dromara.eims.domain.EimsRepairRecord; |
| | | 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_record |
| | | * |
| | | * @author zhuguifei |
| | | * @date 2025-02-26 |
| | | */ |
| | | @Data |
| | | @EqualsAndHashCode(callSuper = true) |
| | | @AutoMapper(target = EimsRepairRecord.class, reverseConvertGenerate = false) |
| | | public class EimsRepairRecordBo extends BaseEntity { |
| | | |
| | | /** |
| | | * |
| | | */ |
| | | @NotNull(message = "ä¸è½ä¸ºç©º", groups = { EditGroup.class }) |
| | | private Long id; |
| | | |
| | | /** |
| | | * æ¥ä¿®åid |
| | | */ |
| | | @NotNull(message = "æ¥ä¿®åidä¸è½ä¸ºç©º", groups = { AddGroup.class, EditGroup.class }) |
| | | private Long reqId; |
| | | |
| | | /** |
| | | * ç»´ä¿®åid |
| | | */ |
| | | @NotNull(message = "ç»´ä¿®åidä¸è½ä¸ºç©º", groups = { AddGroup.class, EditGroup.class }) |
| | | private Long resId; |
| | | |
| | | /** |
| | | * å¤çæ¶é´ |
| | | */ |
| | | @NotNull(message = "å¤çæ¶é´ä¸è½ä¸ºç©º", groups = { AddGroup.class, EditGroup.class }) |
| | | private Date handleTime; |
| | | |
| | | /** |
| | | * æä½ç¨æ· |
| | | */ |
| | | @NotNull(message = "æä½ç¨æ·ä¸è½ä¸ºç©º", groups = { AddGroup.class, EditGroup.class }) |
| | | private Long operaUser; |
| | | |
| | | /** |
| | | * æä½(åå
¸) |
| | | */ |
| | | @NotBlank(message = "æä½(åå
¸)ä¸è½ä¸ºç©º", groups = { AddGroup.class, EditGroup.class }) |
| | | private String opera; |
| | | |
| | | /** |
| | | * æä½ç»æ |
| | | */ |
| | | @NotBlank(message = "æä½ç»æä¸è½ä¸ºç©º", groups = { AddGroup.class, EditGroup.class }) |
| | | private String operaResult; |
| | | |
| | | /** |
| | | * 夿³¨ |
| | | */ |
| | | private String remark; |
| | | |
| | | |
| | | } |
| | |
| | | @NotNull(message = "æ¥ä¿®åä¸è½ä¸ºç©º", groups = { AddGroup.class, EditGroup.class }) |
| | | private Long reqId; |
| | | |
| | | private Long reqUser;//æ¥ä¿®äºº |
| | | |
| | | private Long reqDept;//æ¥ä¿®äººé¨é¨ |
| | | |
| | | /** |
| | | * ç»´ä¿®åå· |
| | | */ |
| | |
| | | private String remark; |
| | | |
| | | |
| | | //è¾
å©å段 |
| | | /** |
| | | * éè¦æ¹éæ·»å çæ¥ä¿®åå· |
| | | */ |
| | | private String batchReqIds; |
| | | |
| | | |
| | | // å
³èè¡¨åæ®µ |
| | | private String reqCode;//æ¥ä¿®åç¼ç |
| | | private String reqUser;//æ¥ä¿®äºº |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package org.dromara.eims.domain.vo; |
| | | |
| | | import java.util.Date; |
| | | import com.fasterxml.jackson.annotation.JsonFormat; |
| | | import org.dromara.eims.domain.EimsRepairRecord; |
| | | 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_record |
| | | * |
| | | * @author zhuguifei |
| | | * @date 2025-02-26 |
| | | */ |
| | | @Data |
| | | @ExcelIgnoreUnannotated |
| | | @AutoMapper(target = EimsRepairRecord.class) |
| | | public class EimsRepairRecordVo implements Serializable { |
| | | |
| | | @Serial |
| | | private static final long serialVersionUID = 1L; |
| | | |
| | | /** |
| | | * |
| | | */ |
| | | @ExcelProperty(value = "") |
| | | private Long id; |
| | | |
| | | /** |
| | | * æ¥ä¿®åid |
| | | */ |
| | | @ExcelProperty(value = "æ¥ä¿®åid") |
| | | private Long reqId; |
| | | |
| | | /** |
| | | * ç»´ä¿®åid |
| | | */ |
| | | @ExcelProperty(value = "ç»´ä¿®åid") |
| | | private Long resId; |
| | | |
| | | /** |
| | | * å¤çæ¶é´ |
| | | */ |
| | | @ExcelProperty(value = "å¤çæ¶é´") |
| | | private Date handleTime; |
| | | |
| | | /** |
| | | * æä½ç¨æ· |
| | | */ |
| | | @ExcelProperty(value = "æä½ç¨æ·") |
| | | private Long operaUser; |
| | | |
| | | /** |
| | | * æä½(åå
¸) |
| | | */ |
| | | @ExcelProperty(value = "æä½(åå
¸)") |
| | | private String opera; |
| | | |
| | | /** |
| | | * æä½ç»æ |
| | | */ |
| | | @ExcelProperty(value = "æä½ç»æ") |
| | | private String operaResult; |
| | | |
| | | /** |
| | | * 夿³¨ |
| | | */ |
| | | @ExcelProperty(value = "夿³¨") |
| | | private String remark; |
| | | |
| | | |
| | | } |
| | |
| | | @ExcelProperty(value = "æ¥ä¿®åid") |
| | | private Long reqId; |
| | | |
| | | private Long reqUser;//æ¥ä¿®äºº |
| | | |
| | | private Long reqDept;//æ¥ä¿®äººé¨é¨ |
| | | |
| | | /** |
| | | * ç»´ä¿®åå· |
| | | */ |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package org.dromara.eims.mapper; |
| | | |
| | | import org.dromara.eims.domain.EimsRepairRecord; |
| | | import org.dromara.eims.domain.vo.EimsRepairRecordVo; |
| | | import org.dromara.common.mybatis.core.mapper.BaseMapperPlus; |
| | | |
| | | /** |
| | | * 维修记å½Mapperæ¥å£ |
| | | * |
| | | * @author zhuguifei |
| | | * @date 2025-02-26 |
| | | */ |
| | | public interface EimsRepairRecordMapper extends BaseMapperPlus<EimsRepairRecord, EimsRepairRecordVo> { |
| | | |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package org.dromara.eims.service; |
| | | |
| | | import org.dromara.eims.domain.vo.EimsRepairRecordVo; |
| | | import org.dromara.eims.domain.bo.EimsRepairRecordBo; |
| | | 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-26 |
| | | */ |
| | | public interface IEimsRepairRecordService { |
| | | |
| | | /** |
| | | * æ¥è¯¢ç»´ä¿®è®°å½ |
| | | * |
| | | * @param id ä¸»é® |
| | | * @return ç»´ä¿®è®°å½ |
| | | */ |
| | | EimsRepairRecordVo queryById(Long id); |
| | | |
| | | /** |
| | | * å页æ¥è¯¢ç»´ä¿®è®°å½å表 |
| | | * |
| | | * @param bo æ¥è¯¢æ¡ä»¶ |
| | | * @param pageQuery å页忰 |
| | | * @return 维修记å½å页å表 |
| | | */ |
| | | TableDataInfo<EimsRepairRecordVo> queryPageList(EimsRepairRecordBo bo, PageQuery pageQuery); |
| | | |
| | | /** |
| | | * æ¥è¯¢ç¬¦åæ¡ä»¶ç维修记å½å表 |
| | | * |
| | | * @param bo æ¥è¯¢æ¡ä»¶ |
| | | * @return 维修记å½å表 |
| | | */ |
| | | List<EimsRepairRecordVo> queryList(EimsRepairRecordBo bo); |
| | | |
| | | /** |
| | | * æ°å¢ç»´ä¿®è®°å½ |
| | | * |
| | | * @param bo ç»´ä¿®è®°å½ |
| | | * @return æ¯å¦æ°å¢æå |
| | | */ |
| | | Boolean insertByBo(EimsRepairRecordBo bo); |
| | | |
| | | /** |
| | | * ä¿®æ¹ç»´ä¿®è®°å½ |
| | | * |
| | | * @param bo ç»´ä¿®è®°å½ |
| | | * @return æ¯å¦ä¿®æ¹æå |
| | | */ |
| | | Boolean updateByBo(EimsRepairRecordBo bo); |
| | | |
| | | /** |
| | | * æ ¡éªå¹¶æ¹éå é¤ç»´ä¿®è®°å½ä¿¡æ¯ |
| | | * |
| | | * @param ids å¾
å é¤ç主é®éå |
| | | * @param isValid æ¯å¦è¿è¡æææ§æ ¡éª |
| | | * @return æ¯å¦å 餿å |
| | | */ |
| | | Boolean deleteWithValidByIds(Collection<Long> ids, Boolean isValid); |
| | | } |
| | |
| | | Boolean insertByBo(EimsRepairResBo bo); |
| | | |
| | | /** |
| | | * æ°å¢ç»´ä¿®å·¥å-æ¹é |
| | | * |
| | | * @param bo 维修工å |
| | | * @return æ¯å¦æ°å¢æå |
| | | */ |
| | | Boolean insertBatchByBo(EimsRepairResBo bo); |
| | | |
| | | /** |
| | | * ä¿®æ¹ç»´ä¿®å·¥å |
| | | * |
| | | * @param bo 维修工å |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package org.dromara.eims.service.impl; |
| | | |
| | | import org.dromara.common.core.utils.MapstructUtils; |
| | | import org.dromara.common.core.utils.StringUtils; |
| | | import org.dromara.common.mybatis.core.page.TableDataInfo; |
| | | import org.dromara.common.mybatis.core.page.PageQuery; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | | import com.baomidou.mybatisplus.core.toolkit.Wrappers; |
| | | import lombok.RequiredArgsConstructor; |
| | | import org.springframework.stereotype.Service; |
| | | import org.dromara.eims.domain.bo.EimsRepairRecordBo; |
| | | import org.dromara.eims.domain.vo.EimsRepairRecordVo; |
| | | import org.dromara.eims.domain.EimsRepairRecord; |
| | | import org.dromara.eims.mapper.EimsRepairRecordMapper; |
| | | import org.dromara.eims.service.IEimsRepairRecordService; |
| | | |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | import java.util.Collection; |
| | | |
| | | /** |
| | | * 维修记å½Serviceä¸å¡å±å¤ç |
| | | * |
| | | * @author zhuguifei |
| | | * @date 2025-02-26 |
| | | */ |
| | | @RequiredArgsConstructor |
| | | @Service |
| | | public class EimsRepairRecordServiceImpl implements IEimsRepairRecordService { |
| | | |
| | | private final EimsRepairRecordMapper baseMapper; |
| | | |
| | | /** |
| | | * æ¥è¯¢ç»´ä¿®è®°å½ |
| | | * |
| | | * @param id ä¸»é® |
| | | * @return ç»´ä¿®è®°å½ |
| | | */ |
| | | @Override |
| | | public EimsRepairRecordVo queryById(Long id){ |
| | | return baseMapper.selectVoById(id); |
| | | } |
| | | |
| | | /** |
| | | * å页æ¥è¯¢ç»´ä¿®è®°å½å表 |
| | | * |
| | | * @param bo æ¥è¯¢æ¡ä»¶ |
| | | * @param pageQuery å页忰 |
| | | * @return 维修记å½å页å表 |
| | | */ |
| | | @Override |
| | | public TableDataInfo<EimsRepairRecordVo> queryPageList(EimsRepairRecordBo bo, PageQuery pageQuery) { |
| | | LambdaQueryWrapper<EimsRepairRecord> lqw = buildQueryWrapper(bo); |
| | | Page<EimsRepairRecordVo> result = baseMapper.selectVoPage(pageQuery.build(), lqw); |
| | | return TableDataInfo.build(result); |
| | | } |
| | | |
| | | /** |
| | | * æ¥è¯¢ç¬¦åæ¡ä»¶ç维修记å½å表 |
| | | * |
| | | * @param bo æ¥è¯¢æ¡ä»¶ |
| | | * @return 维修记å½å表 |
| | | */ |
| | | @Override |
| | | public List<EimsRepairRecordVo> queryList(EimsRepairRecordBo bo) { |
| | | LambdaQueryWrapper<EimsRepairRecord> lqw = buildQueryWrapper(bo); |
| | | return baseMapper.selectVoList(lqw); |
| | | } |
| | | |
| | | private LambdaQueryWrapper<EimsRepairRecord> buildQueryWrapper(EimsRepairRecordBo bo) { |
| | | Map<String, Object> params = bo.getParams(); |
| | | LambdaQueryWrapper<EimsRepairRecord> lqw = Wrappers.lambdaQuery(); |
| | | lqw.eq(bo.getReqId() != null, EimsRepairRecord::getReqId, bo.getReqId()); |
| | | lqw.eq(bo.getResId() != null, EimsRepairRecord::getResId, bo.getResId()); |
| | | lqw.eq(bo.getHandleTime() != null, EimsRepairRecord::getHandleTime, bo.getHandleTime()); |
| | | lqw.eq(bo.getOperaUser() != null, EimsRepairRecord::getOperaUser, bo.getOperaUser()); |
| | | lqw.eq(StringUtils.isNotBlank(bo.getOpera()), EimsRepairRecord::getOpera, bo.getOpera()); |
| | | return lqw; |
| | | } |
| | | |
| | | /** |
| | | * æ°å¢ç»´ä¿®è®°å½ |
| | | * |
| | | * @param bo ç»´ä¿®è®°å½ |
| | | * @return æ¯å¦æ°å¢æå |
| | | */ |
| | | @Override |
| | | public Boolean insertByBo(EimsRepairRecordBo bo) { |
| | | EimsRepairRecord add = MapstructUtils.convert(bo, EimsRepairRecord.class); |
| | | validEntityBeforeSave(add); |
| | | boolean flag = baseMapper.insert(add) > 0; |
| | | if (flag) { |
| | | bo.setId(add.getId()); |
| | | } |
| | | return flag; |
| | | } |
| | | |
| | | /** |
| | | * ä¿®æ¹ç»´ä¿®è®°å½ |
| | | * |
| | | * @param bo ç»´ä¿®è®°å½ |
| | | * @return æ¯å¦ä¿®æ¹æå |
| | | */ |
| | | @Override |
| | | public Boolean updateByBo(EimsRepairRecordBo bo) { |
| | | EimsRepairRecord update = MapstructUtils.convert(bo, EimsRepairRecord.class); |
| | | validEntityBeforeSave(update); |
| | | return baseMapper.updateById(update) > 0; |
| | | } |
| | | |
| | | /** |
| | | * ä¿ååçæ°æ®æ ¡éª |
| | | */ |
| | | private void validEntityBeforeSave(EimsRepairRecord entity){ |
| | | //TODO åä¸äºæ°æ®æ ¡éª,å¦å¯ä¸çº¦æ |
| | | } |
| | | |
| | | /** |
| | | * æ ¡éªå¹¶æ¹éå é¤ç»´ä¿®è®°å½ä¿¡æ¯ |
| | | * |
| | | * @param ids å¾
å é¤ç主é®éå |
| | | * @param isValid æ¯å¦è¿è¡æææ§æ ¡éª |
| | | * @return æ¯å¦å 餿å |
| | | */ |
| | | @Override |
| | | public Boolean deleteWithValidByIds(Collection<Long> ids, Boolean isValid) { |
| | | if(isValid){ |
| | | //TODO åä¸äºä¸å¡ä¸çæ ¡éª,夿æ¯å¦éè¦æ ¡éª |
| | | } |
| | | return baseMapper.deleteByIds(ids) > 0; |
| | | } |
| | | } |
| | |
| | | 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.RepairReqService; |
| | | import org.dromara.common.core.utils.MapstructUtils; |
| | | import org.dromara.common.core.utils.SpringUtils; |
| | |
| | | import lombok.RequiredArgsConstructor; |
| | | import org.dromara.eims.domain.EimsEqu; |
| | | import org.dromara.eims.domain.EimsFixtureBorrow; |
| | | import org.dromara.eims.domain.EimsRepairRecord; |
| | | import org.dromara.eims.domain.vo.EimsFixtureVo; |
| | | import org.dromara.eims.domain.vo.EimsInventoryDetailVo; |
| | | import org.dromara.eims.mapper.EimsRepairRecordMapper; |
| | | import org.dromara.eims.utils.DataFilterUtil; |
| | | import org.dromara.system.domain.SysDept; |
| | | import org.dromara.system.domain.vo.SysDeptVo; |
| | |
| | | import org.dromara.eims.domain.EimsRepairReq; |
| | | import org.dromara.eims.mapper.EimsRepairReqMapper; |
| | | import org.dromara.eims.service.IEimsRepairReqService; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | |
| | | import java.util.ArrayList; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | import java.util.Collection; |
| | | import java.util.*; |
| | | |
| | | /** |
| | | * æ
éæ¥ä¿®Serviceä¸å¡å±å¤ç |
| | |
| | | public class EimsRepairReqServiceImpl implements IEimsRepairReqService, RepairReqService { |
| | | |
| | | private final EimsRepairReqMapper baseMapper; |
| | | private final EimsRepairRecordMapper recordMapper; |
| | | 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); |
| | | } |
| | |
| | | * @param bo æ
éæ¥ä¿® |
| | | * @return æ¯å¦æ°å¢æå |
| | | */ |
| | | @Transactional(rollbackFor = Exception.class) |
| | | @Override |
| | | public Boolean insertByBo(EimsRepairReqBo bo) { |
| | | EimsRepairReq add = MapstructUtils.convert(bo, EimsRepairReq.class); |
| | |
| | | boolean flag = baseMapper.insert(add) > 0; |
| | | if (flag) { |
| | | bo.setId(add.getId()); |
| | | //æ°å¢æ¥ä¿®åæ¶çæç»´ä¿®è®°å½ |
| | | EimsRepairRecord record = new EimsRepairRecord(); |
| | | record.setReqId(add.getId()); |
| | | record.setHandleTime(new Date()); |
| | | //æ°å¢ç¶æ |
| | | record.setOpera(DictConstants.REPAIR_RECORD_HANDLE_DETAIL.XINZENG); |
| | | record.setOperaUser(add.getCreateBy()); |
| | | record.setOperaResult("æ°å¢ï¼çææ¥ä¿®å"); |
| | | //æ°å¢æ¶çæè®°å½ |
| | | recordMapper.insert(record); |
| | | } |
| | | return flag; |
| | | } |
| | |
| | | import cn.hutool.core.convert.Convert; |
| | | import cn.hutool.core.util.ObjectUtil; |
| | | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
| | | import lombok.SneakyThrows; |
| | | import org.dromara.common.core.constant.DictConstants; |
| | | import org.dromara.common.core.service.RepairResService; |
| | | import org.dromara.common.core.utils.MapstructUtils; |
| | |
| | | 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.*; |
| | | import org.dromara.eims.domain.vo.EimsRepairReqVo; |
| | | import org.dromara.eims.mapper.EimsRepairRecordMapper; |
| | | import org.dromara.eims.mapper.EimsRepairReqMapper; |
| | | import org.dromara.eims.utils.DataFilterUtil; |
| | | import org.dromara.system.domain.SysDept; |
| | |
| | | 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; |
| | | import java.util.*; |
| | | |
| | | /** |
| | | * 维修工åServiceä¸å¡å±å¤ç |
| | |
| | | private final EimsRepairResMapper baseMapper; |
| | | private final EimsRepairReqMapper reqMapper; |
| | | private final SysDeptMapper deptMapper; |
| | | private final EimsRepairRecordMapper recordMapper; |
| | | |
| | | /** |
| | | * æ¥è¯¢ç»´ä¿®å·¥å |
| | |
| | | reqVo.setStatus(DictConstants.REPAIR_REQ_STATUS_DETAIL.WEIXIU); |
| | | EimsRepairReq req = MapstructUtils.convert(reqVo, EimsRepairReq.class); |
| | | reqMapper.updateById(req); |
| | | |
| | | //å°æ°å¢æ¥ä¿®åæ¶ç»´ä¿®è®°å½ç维修工åidæ´æ° |
| | | LambdaQueryWrapper<EimsRepairRecord> queryWrapper = new LambdaQueryWrapper<>(); |
| | | queryWrapper.eq(EimsRepairRecord::getReqId, add.getReqId()); |
| | | EimsRepairRecord one = recordMapper.selectOne(queryWrapper); |
| | | if(one!=null){ |
| | | one.setResId(add.getId()); |
| | | recordMapper.updateById(one); |
| | | } |
| | | |
| | | |
| | | //çæç»´ä¿®è®°å½ |
| | | EimsRepairRecord record = new EimsRepairRecord(); |
| | | record.setReqId(add.getReqId()); |
| | | record.setResId(add.getId()); |
| | | record.setHandleTime(new Date()); |
| | | //æ¥åç¶æ |
| | | record.setOpera(DictConstants.REPAIR_RECORD_HANDLE_DETAIL.JIEDAN); |
| | | record.setOperaUser(add.getCreateBy()); |
| | | record.setOperaResult("æ¥åï¼çæç»´ä¿®å·¥å"); |
| | | //æ°å¢æ¶çæè®°å½ |
| | | recordMapper.insert(record); |
| | | |
| | | |
| | | } |
| | | return flag; |
| | | } |
| | | |
| | | @SneakyThrows |
| | | @Transactional(rollbackFor = Exception.class) |
| | | @Override |
| | | public Boolean insertBatchByBo(EimsRepairResBo bo){ |
| | | String batchReqIds = bo.getBatchReqIds(); |
| | | boolean result = StringUtils.isNotEmpty(batchReqIds); |
| | | for (String reqId : batchReqIds.split(",")) { |
| | | EimsRepairReqVo reqVo = reqMapper.selectVoById(reqId); |
| | | EimsRepairResBo insert = new EimsRepairResBo(); |
| | | insert.setReqId(reqVo.getId()); |
| | | insert.setReqUser(reqVo.getReqUser()); |
| | | insert.setReqDept(reqVo.getReqDept()); |
| | | insert.setResCode(reqVo.getCode().replace("BXD","WXD")); |
| | | insert.setResUser(bo.getResUser()); |
| | | insert.setResDept(bo.getResDept()); |
| | | insert.setStatus(DictConstants.REPAIR_RES_STATUS_DETAIL.WEIXIU); |
| | | insert.setStartTime(new Date()); |
| | | Boolean b = insertByBo(insert); |
| | | if(!b)throw new Exception(""); |
| | | } |
| | | return result; |
| | | } |
| | | |
| | | /** |
| | |
| | | reqVo.setStatus(DictConstants.REPAIR_REQ_STATUS_DETAIL.WANCHENG); |
| | | EimsRepairReq req = MapstructUtils.convert(reqVo, EimsRepairReq.class); |
| | | reqMapper.updateById(req); |
| | | |
| | | //çæç»´ä¿®è®°å½ |
| | | EimsRepairRecord record = new EimsRepairRecord(); |
| | | record.setResId(bo.getId()); |
| | | record.setReqId(bo.getReqId()); |
| | | record.setHandleTime(new Date()); |
| | | //å®æç¶æ |
| | | record.setOpera(DictConstants.REPAIR_RECORD_HANDLE_DETAIL.WANCHENG); |
| | | record.setOperaUser(bo.getUpdateBy()); |
| | | record.setOperaResult("å®æç»´ä¿®å·¥å"); |
| | | recordMapper.insert(record); |
| | | |
| | | } |
| | | validEntityBeforeSave(update); |
| | | return baseMapper.updateById(update) > 0; |
| | |
| | | |
| | | @Override |
| | | public TableDataInfo<EimsRepairResVo> queryPageListCustom(EimsRepairResBo bo, PageQuery pageQuery) { |
| | | DataFilterUtil.getInstance().filterRepairRes(bo); |
| | | Page<EimsRepairResVo> page = baseMapper.selectRepairResList(pageQuery.build(), buildWrapper(bo)); |
| | | return TableDataInfo.build(page); |
| | | } |
| | |
| | | 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()); |
| | | qw.eq(bo.getReqUser() != null, "res.req_user", bo.getReqUser()); |
| | | |
| | | List<Long> allDescendantIds = getAllDescendantIds(bo.getResDept()); |
| | | qw.in(bo.getResDept() != null, "res.res_dept", allDescendantIds); |
| | | List<Long> resDeptIds = getAllDescendantIds(bo.getResDept()); |
| | | qw.in(bo.getResDept() != null, "res.res_dept", resDeptIds); |
| | | |
| | | List<Long> reqDeptIds = getAllDescendantIds(bo.getReqDept()); |
| | | qw.in(bo.getReqDept() != null, "res.req_dept", reqDeptIds); |
| | | |
| | | |
| | | qw.eq(StringUtils.isNotBlank(bo.getStatus()), "res.status", bo.getStatus()); |
| | | qw.orderByDesc("res.create_time"); |
| | |
| | | //TODO 维修工åªè½æ¥è¯¢æªæ¥åç¶æçæ¥ä¿®åï¼å
·ä½ç¶æåèåå
¸repair_req_statusï¼ |
| | | bo.setStatus(DictConstants.REPAIR_REQ_STATUS_DETAIL.JIEDAN); |
| | | } |
| | | params.put("createBy", userList); |
| | | if(userList.size()>0){ |
| | | params.put("createBy", userList); |
| | | } |
| | | |
| | | } |
| | | |
| | | //维修工å |
| | |
| | | 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); |
| | | bo.setReqUser(-1L); |
| | | bo.setResUser(-1L); |
| | | |
| | | }else if (rolePermission.contains(Role.operator.name())) { |
| | | //æä½å·¥åªè½æ¥è¯¢èªå·±çæ°æ® |
| | | userList.add(loginUser.getUserId()); |
| | | bo.setReqUser(loginUser.getUserId()); |
| | | }else if (rolePermission.contains(Role.repair.name())) { |
| | | //TODO 维修工åªè½æ¥è¯¢æªæ¥åç¶æçæ¥ä¿®åï¼å
·ä½ç¶æåèåå
¸repair_req_statusï¼ |
| | | bo.setStatus(DictConstants.REPAIR_REQ_STATUS_DETAIL.JIEDAN); |
| | | bo.setResUser(loginUser.getUserId()); |
| | | } |
| | | 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.EimsRepairRecordMapper"> |
| | | |
| | | </mapper> |
| | |
| | | return userService.selectPageUserList(user, pageQuery); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * è·åç¨æ·å表 |
| | | */ |
| | | @SaCheckPermission("system:user:list") |
| | | @GetMapping("/deptRoleUser") |
| | | public R<List<SysUserVo>> deptRoleUser(SysUserBo user) { |
| | | return R.ok(userService.selectDeptRoleUserList(user)); |
| | | } |
| | | |
| | | /** |
| | | * 导åºç¨æ·å表 |
| | | */ |
| | |
| | | */ |
| | | private Long roleId; |
| | | |
| | | |
| | | private String roleKey; |
| | | |
| | | /** |
| | | * æé¤ä¸æ¥è¯¢çç¨æ·(工使µç¨) |
| | | */ |
| | |
| | | * @return ç»æ |
| | | */ |
| | | List<SysUserVo> selectUserListByDept(Long deptId); |
| | | |
| | | /** |
| | | * éè¿é¨é¨åè§è²æ¥è¯¢ç¨æ· |
| | | * @param user |
| | | * @return |
| | | */ |
| | | List<SysUserVo> selectDeptRoleUserList(SysUserBo user); |
| | | } |
| | |
| | | import java.util.ArrayList; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | import java.util.Set; |
| | | import java.util.stream.Collectors; |
| | | |
| | | /** |
| | | * ç¨æ· ä¸å¡å±å¤ç |
| | |
| | | return baseMapper.selectVoList(lqw); |
| | | } |
| | | |
| | | @Override |
| | | public List<SysUserVo> selectDeptRoleUserList(SysUserBo user) { |
| | | List<SysUserVo> result = new ArrayList<>(); |
| | | if (user.getDeptId() == null) return result; |
| | | LambdaQueryWrapper<SysUser> queryWrapper = Wrappers.lambdaQuery(); |
| | | queryWrapper.eq(SysUser::getDeptId, user.getDeptId()); |
| | | List<SysUserVo> deptUserList = baseMapper.selectVoList(queryWrapper); |
| | | if (user.getRoleKey() != null) { |
| | | LambdaQueryWrapper<SysRole> roleWrapper = Wrappers.lambdaQuery(); |
| | | roleWrapper.eq(SysRole::getRoleKey, user.getRoleKey()); |
| | | SysRole sysRole = roleMapper.selectOne(roleWrapper); |
| | | if (sysRole != null) { |
| | | LambdaQueryWrapper<SysUserRole> userRoleWrapper = Wrappers.lambdaQuery(); |
| | | userRoleWrapper.eq(SysUserRole::getRoleId, sysRole.getRoleId()); |
| | | List<SysUserRole> sysUserRoles = userRoleMapper.selectList(userRoleWrapper); |
| | | Set<Long> roleUserIds = sysUserRoles.stream() |
| | | .map(SysUserRole::getUserId) |
| | | .collect(Collectors.toSet()); |
| | | deptUserList = deptUserList.stream() |
| | | .filter(u -> roleUserIds.contains(u.getUserId())) |
| | | .toList(); |
| | | result.addAll(deptUserList); |
| | | } |
| | | } |
| | | return result; |
| | | } |
| | | |
| | | /** |
| | | * éè¿ç¨æ·IDæ¥è¯¢ç¨æ·è´¦æ· |
| | | * |