| | |
| | | <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 { 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 { useUserStore } from '@vben/stores'; |
| | | import sendWorkDrawer from './send-work-drawer.vue'; |
| | | import RepairRecord from '#/views/eims/repair-record/index.vue'; |
| | | |
| | | 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, |
| | |
| | | }, |
| | | id: 'eims-repair-req-index' |
| | | }; |
| | | |
| | | const reqId = 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; |
| | | reqId.value = row.id; |
| | | } |
| | | } |
| | | }); |
| | | |
| | | const [RepairReqDrawer, repairReqDrawerApi] = useVbenDrawer({ |
| | | 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.DAIJIEDAN); |
| | | 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 }); |
| | |
| | | fieldMappingTime: formOptions.fieldMappingTime |
| | | }); |
| | | } |
| | | |
| | | /** |
| | | * 派工 |
| | | */ |
| | | function handleSendWork() {} |
| | | |
| | | onMounted(async () => { |
| | | await setupDeptSelect(); |
| | |
| | | } |
| | | ]); |
| | | } |
| | | // 选中数据 |
| | | 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="设备盘点列表"> |
| | | <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:repairReq:send']" @click="openSendWork"> 派工 </a-button> |
| | | <a-button v-access:code="['eims:repairReq:export']" @click="handleDownloadExcel"> |
| | | {{ $t('pages.common.export') }} |
| | | </a-button> |
| | |
| | | </Space> |
| | | </template> |
| | | </BasicTable> |
| | | <RepairRecord :req-id="reqId" class="h-1/3" table-title="维修记录" /> |
| | | </div> |
| | | <RepairReqDrawer @reload="tableApi.query()" /> |
| | | <SendWorkDrawer @reload="tableApi.query()" /> |
| | | </Page> |
| | | </template> |