| | |
| | | import { Image, Modal, Popconfirm, Space } from 'ant-design-vue'; |
| | | |
| | | import { useVbenVxeGrid, vxeCheckboxChecked, type VxeGridProps, vxeSortEvent } from '#/adapter/vxe-table'; |
| | | import { delSpare, listSpare, spareExport } from '#/api/eims/spare'; |
| | | import { delSpare, listInout, listSpare, spareExport } from '#/api/eims/spare'; |
| | | import { configInfoByKey } from '#/api/system/config'; |
| | | import { commonDownloadExcel } from '#/utils/file/download'; |
| | | import BasisSubTable from '#/views/eims/components/basis-sub-table.vue'; |
| | | |
| | | import { columns, querySchema } from './data'; |
| | | import { columns, inoutCol, querySchema } from './data'; |
| | | import spareDrawer from './spare-drawer.vue'; |
| | | import SpareTypeTree from './spare-type-tree.vue'; |
| | | |
| | |
| | | height: 'auto', |
| | | keepSource: true, |
| | | pagerConfig: { |
| | | enabled: false, |
| | | enabled: false |
| | | }, |
| | | proxyConfig: { |
| | | enabled: true, |
| | |
| | | keyField: 'id' |
| | | }, |
| | | columnConfig: { |
| | | resizable: true, |
| | | resizable: true |
| | | }, |
| | | sortConfig: { |
| | | // 远程排序 |
| | |
| | | }, |
| | | id: 'eims-spare-index' |
| | | }; |
| | | |
| | | const id = 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; |
| | | id.value = row.id; |
| | | } |
| | | } |
| | | }); |
| | | |
| | |
| | | <Page :auto-content-height="true"> |
| | | <div class="flex h-full gap-[8px]"> |
| | | <SpareTypeTree v-model:select-type-id="selectTypeId" 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:spare:export']" @click="handleDownloadExcel"> |
| | | {{ $t('pages.common.export') }} |
| | | </a-button> |
| | | <a-button |
| | | :disabled="!vxeCheckboxChecked(tableApi)" |
| | | danger |
| | | type="primary" |
| | | v-access:code="['eims:spare:remove']" |
| | | @click="handleMultiDelete" |
| | | > |
| | | {{ $t('pages.common.delete') }} |
| | | </a-button> |
| | | <a-button type="primary" v-access:code="['eims:spare:add']" @click="handleAdd"> |
| | | {{ $t('pages.common.add') }} |
| | | </a-button> |
| | | </Space> |
| | | </template> |
| | | <div class="flex-1 overflow-hidden"> |
| | | <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:spare:export']" @click="handleDownloadExcel"> |
| | | {{ $t('pages.common.export') }} |
| | | </a-button> |
| | | <a-button |
| | | :disabled="!vxeCheckboxChecked(tableApi)" |
| | | danger |
| | | type="primary" |
| | | v-access:code="['eims:spare:remove']" |
| | | @click="handleMultiDelete" |
| | | > |
| | | {{ $t('pages.common.delete') }} |
| | | </a-button> |
| | | <a-button type="primary" v-access:code="['eims:spare:add']" @click="handleAdd"> |
| | | {{ $t('pages.common.add') }} |
| | | </a-button> |
| | | </Space> |
| | | </template> |
| | | |
| | | <template #imgUrl="{ row }"> |
| | | <Image v-if="preview && isImageFile(row.imgUrl)" :src="row.imgUrl" height="38px" /> |
| | | <span v-else>{{ row.imgUrl }}</span> |
| | | </template> |
| | | <template #imgUrl="{ row }"> |
| | | <Image v-if="preview && isImageFile(row.imgUrl)" :src="row.imgUrl" height="38px" /> |
| | | <span v-else>{{ row.imgUrl }}</span> |
| | | </template> |
| | | |
| | | <template #action="{ row }"> |
| | | <Space> |
| | | <ghost-button v-access:code="['eims:spare: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:spare:remove']" @click.stop=""> |
| | | {{ $t('pages.common.delete') }} |
| | | </ghost-button> |
| | | </Popconfirm> |
| | | </Space> |
| | | </template> |
| | | </BasicTable> |
| | | <template #action="{ row }"> |
| | | <Space> |
| | | <ghost-button v-access:code="['eims:spare: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:spare:remove']" @click.stop=""> |
| | | {{ $t('pages.common.delete') }} |
| | | </ghost-button> |
| | | </Popconfirm> |
| | | </Space> |
| | | </template> |
| | | </BasicTable> |
| | | <BasisSubTable :columns="inoutCol" :list-api="listInout" :req-value="id" class="h-1/3" req-key="id" title="出入库明细" /> |
| | | </div> |
| | | </div> |
| | | </div> |
| | | <SpareDrawer @reload="tableApi.query()" /> |
| | | </Page> |
| | | </template> |
| | | |
| | | <style> |
| | | <style lang="scss" scoped> |
| | | /* 统一所有列的边框和行高 */ |
| | | .vxe-table--body .vxe-body--row .vxe-body--column { |
| | | height: 56px !important; |