| | |
| | | import { Page, useVbenDrawer, type VbenFormProps } from '@vben/common-ui'; |
| | | import { getVxePopupContainer } from '@vben/utils'; |
| | | |
| | | import { Dropdown, Menu, MenuItem, Modal, Popconfirm, Space } from 'ant-design-vue'; |
| | | import { Modal, Popconfirm, Space } from 'ant-design-vue'; |
| | | |
| | | import { useVbenVxeGrid, vxeCheckboxChecked, type VxeGridProps } from '#/adapter/vxe-table'; |
| | | import { useVbenVxeGrid, vxeCheckboxChecked, type VxeGridProps, vxeSortEvent } from '#/adapter/vxe-table'; |
| | | import { delEqu, equExport, listEqu } from '#/api/eims/equ'; |
| | | import { commonDownloadExcel } from '#/utils/file/download'; |
| | | |
| | |
| | | isHover: true, |
| | | keyField: 'equId' |
| | | }, |
| | | sortConfig: { |
| | | // 远程排序 |
| | | remote: true, |
| | | // 支持多字段排序 默认关闭 |
| | | multiple: true, |
| | | }, |
| | | id: 'eims-equ-index' |
| | | }; |
| | | |
| | | const [BasicTable, tableApi] = useVbenVxeGrid({ |
| | | formOptions, |
| | | gridOptions |
| | | gridOptions, |
| | | gridEvents: { |
| | | sortChange: (sortParams) => vxeSortEvent(tableApi, sortParams), |
| | | }, |
| | | }); |
| | | |
| | | const [EquDrawer, equDrawerApi] = useVbenDrawer({ |
| | | connectedComponent: equDrawer |
| | | }); |
| | | |
| | | |
| | | |
| | | function handleAdd() { |
| | | equDrawerApi.setData({}); |
| | |
| | | }); |
| | | } |
| | | |
| | | function getImportStatus(row: any) { |
| | | const importStatus = row.importStatus === null || row.importStatus; |
| | | return importStatus ? '未导入' : '已导入'; |
| | | } |
| | | |
| | | function getInventoryFlag(row: any) { |
| | | const inventoryFlag = row.inventoryFlag === null || row.inventoryFlag; |
| | | return inventoryFlag ? '未盘点' : '已盘点'; |
| | | } |
| | | |
| | | const router = useRouter(); |
| | | function handleDetail(record: Recordable<any>) { |
| | |
| | | <template> |
| | | <Page :auto-content-height="true"> |
| | | <div class="flex h-full gap-[8px]"> |
| | | <EquTypeTree |
| | | v-model:select-dept-id="selectDeptId" |
| | | class="w-[260px]" |
| | | @reload="() => tableApi.reload()" |
| | | @select="() => tableApi.reload()" |
| | | /> |
| | | <EquTypeTree v-model:select-dept-id="selectDeptId" class="w-[260px]" @reload="() => tableApi.reload()" @select="() => tableApi.reload()" /> |
| | | <BasicTable class="flex-1 overflow-hidden" table-title="设备列表"> |
| | | <template #toolbar-tools> |
| | | <Space> |
| | | <a-button v-access:code="['eims:equ:export']" @click="handleDownloadExcel"> |
| | | {{ $t('pages.common.export') }} |
| | | </a-button> |
| | | <a-button |
| | | :disabled="!vxeCheckboxChecked(tableApi)" |
| | | danger |
| | | type="primary" |
| | | v-access:code="['eims:equ:remove']" |
| | | @click="handleMultiDelete" |
| | | > |
| | | <a-button :disabled="!vxeCheckboxChecked(tableApi)" danger type="primary" v-access:code="['eims:equ:remove']" @click="handleMultiDelete"> |
| | | {{ $t('pages.common.delete') }} |
| | | </a-button> |
| | | <a-button type="primary" v-access:code="['eims:equ:add']" @click="handleAdd"> |
| | |
| | | |
| | | <template #action="{ row }"> |
| | | <Space> |
| | | <ghost-button v-access:code="['system:role:edit']" @click.stop="handleEdit(row)"> |
| | | <ghost-button v-access:code="['eims:equ:edit']" @click.stop="handleEdit(row)"> |
| | | {{ $t('pages.common.edit') }} |
| | | </ghost-button> |
| | | <ghost-button v-if="row.menuType !== 'F'" class="btn-success" v-access:code="['eims:equ:list']" @click="handleDetail(row)"> |
| | | {{ $t('pages.common.info') }} |
| | | </ghost-button> |
| | | <Popconfirm :get-popup-container="getVxePopupContainer" placement="left" title="确认删除?" @confirm="handleDelete(row)"> |
| | | <ghost-button danger v-access:code="['system:role:remove']" @click.stop=""> |
| | | <ghost-button danger v-access:code="['eims:equ:remove']" @click.stop=""> |
| | | {{ $t('pages.common.delete') }} |
| | | </ghost-button> |
| | | </Popconfirm> |
| | | </Space> |
| | | <Dropdown :get-popup-container="getVxePopupContainer" placement="bottomRight"> |
| | | <template #overlay> |
| | | <Menu> |
| | | <MenuItem key="1" @click="handleDetail(row)"> 详情 </MenuItem> |
| | | </Menu> |
| | | </template> |
| | | <a-button size="small" type="link"> |
| | | {{ $t('pages.common.more') }} |
| | | </a-button> |
| | | </Dropdown> |
| | | </template> |
| | | |
| | | <template #importStatus="{ row }"> |
| | | <span>{{ getImportStatus(row) }}</span> |
| | | </template> |
| | | |
| | | <template #inventoryFlag="{ row }"> |
| | | <span>{{ getInventoryFlag(row) }}</span> |
| | | </template> |
| | | </BasicTable> |
| | | </div> |