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-st/index.vue
Îļþ´Ó eims-ui/apps/web-antd/src/views/eims/maint-order-st/index.vue ¸´ÖÆ |
| | |
| | | import { Page, useVbenDrawer, type VbenFormProps } from '@vben/common-ui'; |
| | | 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 { delMaintOrder, listMaintOrderGroupDetail } from '#/api/eims/maint-order'; |
| | | import { delInspectSt, listInspectSt } from '#/api/eims/insp-st'; |
| | | 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 { columns as recordCol } from '#/views/eims/insp-record/data'; |
| | | |
| | | import { columns, querySchema } from './data'; |
| | | import maintOrderStDrawer from './maint-order-st-drawer.vue'; |
| | | import inspStDrawer from './insp-st-drawer.vue'; |
| | | import type { Recordable } from '@vben/types'; |
| | | import { MAINT_ORDER_STATUS } from '#/constants/dict'; |
| | | import { $t } from '@vben/locales'; |
| | | |
| | | defineExpose({ |
| | |
| | | proxyConfig: { |
| | | ajax: { |
| | | query: async ({ page }, formValues = {}) => { |
| | | return await listMaintOrderSt({ |
| | | return await listInspectSt({ |
| | | pageNum: page.currentPage, |
| | | pageSize: page.pageSize, |
| | | ...formValues |
| | |
| | | // æ¯æå¤å段æåº é»è®¤å
³é |
| | | multiple: true |
| | | }, |
| | | id: 'maint-order-group-index' |
| | | id: 'insp-st-index' |
| | | }; |
| | | const orderId = ref<string>(); |
| | | const recordId = ref<string>(); |
| | | const [BasicTable, tableApi] = useVbenVxeGrid({ |
| | | formOptions, |
| | | gridOptions, |
| | |
| | | sortChange: (sortParams) => vxeSortEvent(tableApi, sortParams), |
| | | cellClick: (e: any) => { |
| | | const { row } = e; |
| | | orderId.value = `${row.equId}_${row.planTime}`; |
| | | recordId.value = `${row.equId}_${row.planTime}`; |
| | | } |
| | | } |
| | | }); |
| | |
| | | /** æ ¹æ®é¨é¨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 |
| | | const [InspStDrawer, inspStDrawerApi] = useVbenDrawer({ |
| | | connectedComponent: inspStDrawer |
| | | }); |
| | | |
| | | function handleAdd() { |
| | | maintOrderStDrawerApi.setData({}); |
| | | maintOrderStDrawerApi.open(); |
| | | } |
| | | |
| | | async function handleEdit(record: Recordable<any>) { |
| | | maintOrderStDrawerApi.setData({ id: record.id }); |
| | | maintOrderStDrawerApi.open(); |
| | | inspStDrawerApi.setData({ id: record.id }); |
| | | inspStDrawerApi.open(); |
| | | } |
| | | async function handleDelete(row: Recordable<any>) { |
| | | await delMaintOrderSt(row.id); |
| | | await delInspectSt(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 delInspectSt(ids); |
| | | 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 class="h-2/3" table-title="ç¹æ£è®°å½å表"> |
| | | <template #toolbar-tools> |
| | | <Space /> |
| | | <Space > |
| | | <a-button |
| | | :disabled="!vxeCheckboxChecked(tableApi)" |
| | | danger |
| | | type="primary" |
| | | v-access:code="['eims:inspectSt:remove']" |
| | | @click="handleMultiDelete" |
| | | > |
| | | {{ $t('pages.common.delete') }} |
| | | </a-button> |
| | | </Space> |
| | | </template> |
| | | |
| | | <template #equName="{ row }"> |
| | |
| | | </template> |
| | | <template #action="{ row }"> |
| | | <Space> |
| | | <ghost-button v-access:code="['eims:maintOrderSt:edit']" @click.stop="handleEdit(row)"> |
| | | <ghost-button v-access:code="['eims:inspectSt: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=""> |
| | | <ghost-button danger v-access:code="['eims:inspectSt:remove']" @click.stop=""> |
| | | {{ $t('pages.common.delete') }} |
| | | </ghost-button> |
| | | </Popconfirm> |
| | |
| | | |
| | | </BasicTable> |
| | | <BasisSubTable |
| | | :columns="orderCol" |
| | | :columns="recordCol" |
| | | :list-api="listMaintOrderGroupDetail" |
| | | :req-value="orderId" |
| | | class="h-2/5" |
| | | :req-value="recordId" |
| | | class="h-1/3" |
| | | req-key="maintCode" |
| | | title="ä¿å
»å®æ½é¡¹ç®" |
| | | /> |
| | | </div> |
| | | <MaintOrderStDrawer @reload="tableApi.query()" /> |
| | | <InspStDrawer @reload="tableApi.query()" /> |
| | | </Page> |
| | | </template> |