copy from eims-ui/apps/web-antd/src/views/eims/maint-order-st/index.vue
copy to eims-ui/apps/web-antd/src/views/eims/insp-record/index.vue
Îļþ´Ó eims-ui/apps/web-antd/src/views/eims/maint-order-st/index.vue ¸´ÖÆ |
| | |
| | | <script setup lang="ts"> |
| | | import type { Recordable } from '@vben/types'; |
| | | |
| | | import { onMounted, ref } from 'vue'; |
| | | |
| | | import { Page, useVbenDrawer, type VbenFormProps } from '@vben/common-ui'; |
| | | import { $t } from '@vben/locales'; |
| | | import { addFullName, getPopupContainer, getVxePopupContainer } from '@vben/utils'; |
| | | |
| | | import { Popconfirm, Space } from 'ant-design-vue'; |
| | | import { Modal, Popconfirm, Space } from 'ant-design-vue'; |
| | | |
| | | import { useVbenVxeGrid, type VxeGridProps, vxeSortEvent } from '#/adapter/vxe-table'; |
| | | import { listMaintOrderGroupDetail } from '#/api/eims/maint-order'; |
| | | import { delMaintOrderSt, listMaintOrderSt } from '#/api/eims/maint-order-st'; |
| | | import { useVbenVxeGrid, vxeCheckboxChecked, type VxeGridProps, vxeSortEvent } from '#/adapter/vxe-table'; |
| | | import { delInspRecord, inspRecordExport, listInspRecord } from '#/api/eims/insp-record'; |
| | | import { getDeptTree, userList } from '#/api/system/user'; |
| | | import BasisSubTable from '#/views/eims/components/basis-sub-table.vue'; |
| | | import { columns as orderCol } from '#/views/eims/maint-order/data'; |
| | | import { commonDownloadExcel } from '#/utils/file/download'; |
| | | |
| | | import { columns, querySchema } from './data'; |
| | | import maintOrderStDrawer from './maint-order-st-drawer.vue'; |
| | | import type { Recordable } from '@vben/types'; |
| | | import { MAINT_ORDER_STATUS } from '#/constants/dict'; |
| | | import { $t } from '@vben/locales'; |
| | | import inspRecordDrawer from './insp-record-drawer.vue'; |
| | | |
| | | defineExpose({ |
| | | tableSelect |
| | |
| | | }, |
| | | collapsed: true, |
| | | schema: querySchema(), |
| | | wrapperClass: 'grid-cols-1 md:grid-cols-2 lg:grid-cols-3 xl:grid-cols-4', |
| | | // æ¥æéæ©æ ¼å¼å |
| | | fieldMappingTime: [['planTime', ['params[beginPlanTime]', 'params[endPlanTime]'], ['YYYY-MM-DD 00:00:00', 'YYYY-MM-DD 23:59:59']]] |
| | | wrapperClass: 'grid-cols-1 md:grid-cols-2 lg:grid-cols-3 xl:grid-cols-4' |
| | | }; |
| | | |
| | | const gridOptions: VxeGridProps = { |
| | |
| | | proxyConfig: { |
| | | ajax: { |
| | | query: async ({ page }, formValues = {}) => { |
| | | return await listMaintOrderSt({ |
| | | return await listInspRecord({ |
| | | pageNum: page.currentPage, |
| | | pageSize: page.pageSize, |
| | | ...formValues |
| | |
| | | // æ¯æå¤å段æåº é»è®¤å
³é |
| | | multiple: true |
| | | }, |
| | | id: 'maint-order-group-index' |
| | | id: 'insp-record-index' |
| | | }; |
| | | const orderId = ref<string>(); |
| | | const [BasicTable, tableApi] = useVbenVxeGrid({ |
| | |
| | | sortChange: (sortParams) => vxeSortEvent(tableApi, sortParams), |
| | | cellClick: (e: any) => { |
| | | const { row } = e; |
| | | orderId.value = `${row.equId}_${row.planTime}`; |
| | | orderId.value = row.id; |
| | | } |
| | | } |
| | | }); |
| | | |
| | | const [InspRecordDrawer, inspRecordDrawerApi] = useVbenDrawer({ |
| | | connectedComponent: inspRecordDrawer |
| | | }); |
| | | |
| | | function handleAdd() { |
| | | inspRecordDrawerApi.setData({}); |
| | | inspRecordDrawerApi.open(); |
| | | } |
| | | |
| | | async function handleEdit(record: Recordable<any>) { |
| | | inspRecordDrawerApi.setData({ id: record.id }); |
| | | inspRecordDrawerApi.open(); |
| | | } |
| | | |
| | | async function handleDelete(row: Recordable<any>) { |
| | | await delInspRecord(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 delInspRecord(ids); |
| | | await tableApi.query(); |
| | | } |
| | | }); |
| | | } |
| | | |
| | | function handleDownloadExcel() { |
| | | commonDownloadExcel(inspRecordExport, 'ç¹æ£è®°å½', tableApi.formApi.form.values, { |
| | | fieldMappingTime: formOptions.fieldMappingTime |
| | | }); |
| | | } |
| | | |
| | | /** |
| | | * åå§åé¨é¨éæ© |
| | |
| | | /** æ ¹æ®é¨é¨IDå è½½ç¨æ· */ |
| | | await setupUserOptions(deptId); |
| | | /** åååéè¦éæ°éæ©ç¨æ· */ |
| | | formModel.maintUser = undefined; |
| | | formModel.inspUser = undefined; |
| | | }, |
| | | placeholder: 'è¯·éæ©', |
| | | showSearch: true, |
| | |
| | | // éä¸åæ¾ç¤ºå¨è¾å
¥æ¡çå¼ |
| | | treeNodeLabelProp: 'fullName' |
| | | }), |
| | | fieldName: 'maintDept' |
| | | fieldName: 'inspDept' |
| | | } |
| | | ]); |
| | | } |
| | |
| | | tableApi.formApi.updateSchema([ |
| | | { |
| | | componentProps: { options, placeholder, filterOption }, |
| | | fieldName: 'maintUser' |
| | | fieldName: 'inspUser' |
| | | } |
| | | ]); |
| | | } |
| | | const [MaintOrderStDrawer, maintOrderStDrawerApi] = useVbenDrawer({ |
| | | connectedComponent: maintOrderStDrawer |
| | | }); |
| | | |
| | | function handleAdd() { |
| | | maintOrderStDrawerApi.setData({}); |
| | | maintOrderStDrawerApi.open(); |
| | | } |
| | | |
| | | async function handleEdit(record: Recordable<any>) { |
| | | maintOrderStDrawerApi.setData({ id: record.id }); |
| | | maintOrderStDrawerApi.open(); |
| | | } |
| | | async function handleDelete(row: Recordable<any>) { |
| | | await delMaintOrderSt(row.id); |
| | | await tableApi.query(); |
| | | } |
| | | |
| | | |
| | | onMounted(async () => { |
| | | await setupDeptSelect(); |
| | |
| | | <template> |
| | | <Page :auto-content-height="true"> |
| | | <div class="flex h-full gap-[8px] flex-col"> |
| | | <BasicTable class="h-3/5" table-title="ä¿å
»å·¥åå表"> |
| | | <BasicTable table-title="ç¹æ£è®°å½å表"> |
| | | <template #toolbar-tools> |
| | | <Space /> |
| | | <Space> |
| | | <a-button v-access:code="['eims:inspectRecord:export']" @click="handleDownloadExcel"> |
| | | {{ $t('pages.common.export') }} |
| | | </a-button> |
| | | <a-button |
| | | :disabled="!vxeCheckboxChecked(tableApi)" |
| | | danger |
| | | type="primary" |
| | | v-access:code="['eims:inspectRecord:remove']" |
| | | @click="handleMultiDelete" |
| | | > |
| | | {{ $t('pages.common.delete') }} |
| | | </a-button> |
| | | <!-- <a-button type="primary" v-access:code="['eims:inspectRecord:add']" @click="handleAdd"> |
| | | {{ $t('pages.common.add') }} |
| | | </a-button>--> |
| | | </Space> |
| | | </template> |
| | | |
| | | <template #equName="{ row }"> |
| | |
| | | <span>{{ row.equName }}</span> |
| | | </Space> |
| | | </template> |
| | | |
| | | <template #action="{ row }"> |
| | | <Space> |
| | | <ghost-button v-access:code="['eims:maintOrderSt:edit']" @click.stop="handleEdit(row)"> |
| | | <ghost-button v-access:code="['eims:inspectRecord: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:maintOrderSt:remove']" @click.stop=""> |
| | | <Popconfirm :get-popup-container="getVxePopupContainer" placement="left" title="确认å é¤ï¼" @confirm="handleDelete(row)"> |
| | | <ghost-button danger v-access:code="['eims:inspectRecord:remove']" @click.stop=""> |
| | | {{ $t('pages.common.delete') }} |
| | | </ghost-button> |
| | | </Popconfirm> |
| | | </Space> |
| | | </template> |
| | | |
| | | </BasicTable> |
| | | <BasisSubTable |
| | | :columns="orderCol" |
| | | :list-api="listMaintOrderGroupDetail" |
| | | :req-value="orderId" |
| | | class="h-2/5" |
| | | req-key="maintCode" |
| | | title="ä¿å
»å®æ½é¡¹ç®" |
| | | /> |
| | | <!--<BasisSubTable :columns="maintStandCol" :list-api="listMaintStand" :req-value="equId" class="h-1/3" req-key="equId" title="ä¿å
»å®æ½é¡¹ç®" />--> |
| | | </div> |
| | | <MaintOrderStDrawer @reload="tableApi.query()" /> |
| | | <InspRecordDrawer @reload="tableApi.query()" /> |
| | | </Page> |
| | | </template> |