| | |
| | | VITE_GLOB_API_URL=/prod-api |
| | | |
| | | # å
¨å±å å¯å¼å
³(å³å¼å¯äºå è§£å¯åè½æä¼çæ 䏿¯å
¨é¨æ¥å£å å¯ éè¦åå端对åº) |
| | | VITE_GLOB_ENABLE_ENCRYPT=true |
| | | VITE_GLOB_ENABLE_ENCRYPT=false |
| | | # RSAå
¬é¥ 请æ±å å¯ä½¿ç¨ 注æè¿ä¸¤ä¸ªæ¯ä¸¤å¯¹RSAå
¬ç§é¥ 请æ±å å¯-åç«¯è§£å¯æ¯ä¸å¯¹ ååºè§£å¯-å端å 坿¯ä¸å¯¹ |
| | | VITE_GLOB_RSA_PUBLIC_KEY=MFwwDQYJKoZIhvcNAQEBBQADSwAwSAJBAKoR8mX0rGKLqzcWmOzbfj64K8ZIgOdHnzkXSOVOZbFu/TJhZ7rFAN+eaGkl3C4buccQd/EjEsj9ir7ijT7h96MCAwEAAQ== |
| | | # RSAç§é¥ ååºè§£å¯ä½¿ç¨ 注æè¿ä¸¤ä¸ªæ¯ä¸¤å¯¹RSAå
¬ç§é¥ 请æ±å å¯-åç«¯è§£å¯æ¯ä¸å¯¹ ååºè§£å¯-å端å 坿¯ä¸å¯¹ |
| | |
| | | VITE_GLOB_APP_CLIENT_ID=e5cd7e4891bf95d1d19206ce24a7b32e |
| | | |
| | | # å¼å¯SSE |
| | | VITE_GLOB_SSE_ENABLE=true |
| | | VITE_GLOB_SSE_ENABLE=false |
| | | |
| | |
| | | chargeUser: number; |
| | | |
| | | /** |
| | | * ç»åé¨é¨ |
| | | */ |
| | | chargeDept: number; |
| | | |
| | | /** |
| | | * å·¥åç±»åï¼1-å
¥åºå 2-åºåºåï¼ åå
¸ |
| | | */ |
| | | type: string; |
| | |
| | | * 夿³¨ |
| | | */ |
| | | remark: string; |
| | | /** |
| | | * åºå
¥åºéæ©çå¤ä»¶å表 |
| | | */ |
| | | spareList: any; |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | import type { IDS, PageQuery, PageResult } from '#/api/common'; |
| | | import type { SpareInoutdtVO } from '#/api/eims/spare-inoutdt/model'; |
| | | |
| | | import { commonExport } from '#/api/helper'; |
| | | import { requestClient } from '#/api/request'; |
| | | |
| | | enum Api { |
| | | root = '/eims/spareInoutdt', |
| | | spareInoutdtExport = '/eims/spareInoutdt/export', |
| | | spareInoutdtList = '/eims/spareInoutdt/list' |
| | | } |
| | | |
| | | /** |
| | | * æ¥è¯¢ãå¤ä»¶åºå
¥åºæç»ãå表 |
| | | * @param query |
| | | * @returns {*} |
| | | */ |
| | | |
| | | export function listSpareInoutdt(params?: PageQuery) { |
| | | return requestClient.get<PageResult<SpareInoutdtVO>>(Api.spareInoutdtList, { params }); |
| | | } |
| | | |
| | | /** |
| | | * æ¥è¯¢ãå¤ä»¶åºå
¥åºæç»ãè¯¦ç» |
| | | * @param spareInoutdtId |
| | | */ |
| | | export function getSpareInoutdt(spareInoutdtId: any) { |
| | | return requestClient.get<SpareInoutdtVO>(`${Api.root}/${spareInoutdtId}`); |
| | | } |
| | | |
| | | /** |
| | | * æ°å¢ãå¤ä»¶åºå
¥åºæç»ã |
| | | * @param data |
| | | */ |
| | | export function addSpareInoutdt(data: any) { |
| | | return requestClient.postWithMsg<void>(Api.root, data); |
| | | } |
| | | |
| | | /** |
| | | * ä¿®æ¹ãå¤ä»¶åºå
¥åºæç»ã |
| | | * @param data |
| | | */ |
| | | export function updateSpareInoutdt(data: any) { |
| | | return requestClient.putWithMsg<void>(Api.root, data); |
| | | } |
| | | |
| | | /** |
| | | * å é¤ãå¤ä»¶åºå
¥åºæç»ã |
| | | * @param spareInoutdtIds |
| | | */ |
| | | export function delSpareInoutdt(spareInoutdtIds: IDS) { |
| | | return requestClient.deleteWithMsg<void>(`${Api.root}/${spareInoutdtIds}`); |
| | | } |
| | | |
| | | /** |
| | | * 导åºãå¤ä»¶åºå
¥åºæç»ã |
| | | * @param data |
| | | */ |
| | | export function spareInoutdtExport(data: any) { |
| | | return commonExport(Api.spareInoutdtExport, data); |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | export interface SpareInoutdtVO { |
| | | /** |
| | | * |
| | | */ |
| | | id: number | string; |
| | | |
| | | /** |
| | | * åºåºåæå
¥åºåid |
| | | */ |
| | | inoutId: number | string; |
| | | |
| | | /** |
| | | * å¤ä»¶id |
| | | */ |
| | | spareId: number | string; |
| | | |
| | | /** |
| | | * ä¹ååºå |
| | | */ |
| | | beforeStock: number; |
| | | |
| | | /** |
| | | * å®é
åºå |
| | | */ |
| | | actualStock: number; |
| | | |
| | | /** |
| | | * æ°é |
| | | */ |
| | | quantity: number; |
| | | |
| | | /** |
| | | * åä»· |
| | | */ |
| | | unitPrice: number; |
| | | |
| | | /** |
| | | * éé¢ |
| | | */ |
| | | amount: number; |
| | | |
| | | /** |
| | | * 夿³¨ |
| | | */ |
| | | remark: string; |
| | | } |
| | |
| | | import { requestClient } from '#/api/request'; |
| | | |
| | | enum Api { |
| | | inoutList = '/eims/spare/listInout', |
| | | root = '/eims/spare', |
| | | spareExport = '/eims/spare/export', |
| | | spareList = '/eims/spare/list' |
| | |
| | | return requestClient.get<PageResult<SpareVO>>(Api.spareList, { params }); |
| | | } |
| | | |
| | | export function listInout(params?: PageQuery) { |
| | | return requestClient.get<PageResult<any>>(Api.inoutList, { params }); |
| | | } |
| | | |
| | | /** |
| | | * æ¥è¯¢ãå¤ä»¶å°è´¦ãè¯¦ç» |
| | | * @param spareId |
| | |
| | | const columns = props?.columns?.filter((i) => i.field !== 'action'); |
| | | |
| | | const gridOptions: VxeGridProps = { |
| | | size: 'mini', |
| | | checkboxConfig: { |
| | | // é«äº® |
| | | highlight: true, |
¶Ô±ÈÐÂÎļþ |
| | |
| | | <script setup lang="ts"> |
| | | import type { VxeGridProps } from '#/adapter/vxe-table'; |
| | | |
| | | import { ref } from 'vue'; |
| | | |
| | | import { useVbenModal } from '@vben/common-ui'; |
| | | import { DictEnum } from '@vben/constants'; |
| | | |
| | | import { message } from 'ant-design-vue'; |
| | | |
| | | import { renderDict } from '#/utils/render'; |
| | | import InnerView from '#/views/eims/spare/index.vue'; |
| | | |
| | | const emit = defineEmits<{ updateSelect: [any] }>(); |
| | | |
| | | const [BasicModal, modalApi] = useVbenModal({ |
| | | fullscreenButton: false, |
| | | draggable: true, |
| | | onCancel: handleCancel, |
| | | onConfirm: handleConfirm |
| | | }); |
| | | const innerView = ref(); |
| | | |
| | | async function handleConfirm() { |
| | | try { |
| | | modalApi.modalLoading(true); |
| | | const tableSelect = innerView.value.tableSelect(); |
| | | const eList = tableSelect.filter((item: any) => !item.actualStock && item.actualStock <= 0); |
| | | // æ£æµéæ©çå¤ä»¶åºåæ¯å¦æ£å¸¸ |
| | | if (eList.length > 0) { |
| | | message.error('åå¨åºåä¸è¶³å¤ä»¶ï¼è¯·éæ°éæ©'); |
| | | return false; |
| | | } |
| | | emit('updateSelect', tableSelect); |
| | | await handleCancel(); |
| | | } catch (error) { |
| | | console.error(error); |
| | | } finally { |
| | | modalApi.modalLoading(false); |
| | | } |
| | | } |
| | | |
| | | async function handleCancel() { |
| | | modalApi.close(); |
| | | } |
| | | </script> |
| | | |
| | | <template> |
| | | <BasicModal :fullscreen-button="true" class="w-[800px]"> |
| | | <InnerView ref="innerView" /> |
| | | </BasicModal> |
| | | </template> |
| | | |
| | | <style scoped></style> |
| | |
| | | label: 'ä¾åºå' |
| | | }, |
| | | { |
| | | component: 'Input', |
| | | fieldName: 'openSpare', |
| | | label: 'éæ©å¤ä»¶', |
| | | formItemClass: 'col-span-1 w-[80px]' |
| | | }, |
| | | { |
| | | component: 'Input', |
| | | fieldName: 'outSpareList', |
| | | label: '' |
| | | }, |
| | | { |
| | | component: 'TreeSelect', |
| | | // å¨draweréæ´æ° è¿éä¸éè¦é»è®¤çcomponentProps |
| | | defaultValue: undefined, |
| | |
| | | <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 { columns, querySchema } from './data'; |
| | | import drawer from './spare-in-drawer.vue'; |
| | | import { columns as inoutCol } from '#/views/eims/spare-inoutdt/data'; |
| | | import { listSpareInoutdt } from '#/api/eims/spare-inoutdt'; |
| | | import BasisSubTable from '#/views/eims/components/basis-sub-table.vue'; |
| | | |
| | | const formOptions: VbenFormProps = { |
| | | commonConfig: { |
| | |
| | | }, |
| | | id: 'spre-inout-index' |
| | | }; |
| | | |
| | | const inoutId = 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; |
| | | inoutId.value = row.id; |
| | | } |
| | | } |
| | | }); |
| | | |
| | |
| | | |
| | | <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:spareInout:export']" @click="handleDownloadExcel"> |
| | |
| | | </Space> |
| | | </template> |
| | | </BasicTable> |
| | | <BasisSubTable |
| | | :columns="inoutCol" |
| | | :list-api="listSpareInoutdt" |
| | | :req-value="inoutId" |
| | | class="h-1/3" |
| | | req-key="inoutId" |
| | | title="å
¥åºæç»" |
| | | /> |
| | | </div> |
| | | <Drawer @reload="tableApi.query()" /> |
| | | </Page> |
| | |
| | | <script setup lang="ts"> |
| | | import { computed, ref } from 'vue'; |
| | | |
| | | import { useVbenDrawer } from '@vben/common-ui'; |
| | | import { useVbenDrawer, useVbenModal } from '@vben/common-ui'; |
| | | import { $t } from '@vben/locales'; |
| | | import { addFullName, cloneDeep, getPopupContainer } from '@vben/utils'; |
| | | |
| | |
| | | |
| | | import { drawerSchema } from './data'; |
| | | import CodeInput from '#/views/eims/components/code-input.vue'; |
| | | import spareModal from '#/views/eims/components/spare-modal.vue'; |
| | | import SelectSpareTable from '#/views/eims/spare-out/select-spare-table.vue'; |
| | | import { message } from 'ant-design-vue'; |
| | | import type { VxeGridProps } from '#/adapter/vxe-table'; |
| | | import { renderDict } from '#/utils/render'; |
| | | import { DictEnum } from '@vben/constants'; |
| | | /** |
| | | * åºåºåéæ©çå¤ä»¶æ°æ® |
| | | */ |
| | | const outSpareList = ref([]); |
| | | const selectSpareTable = ref(); |
| | | const outCol: VxeGridProps['columns'] = [ |
| | | { |
| | | field: 'action', |
| | | slots: { default: 'action' }, |
| | | title: 'å é¤', |
| | | width: 60 |
| | | }, |
| | | { |
| | | title: 'å¤ä»¶åç§°', |
| | | field: 'name', |
| | | width: 180 |
| | | }, |
| | | { |
| | | title: 'å¤ä»¶ç¼ç ', |
| | | field: 'code', |
| | | width: 120 |
| | | }, |
| | | { |
| | | title: 'å¤ä»¶åå·', |
| | | field: 'modelNo', |
| | | width: 100 |
| | | }, |
| | | { |
| | | title: '计éåä½', |
| | | field: 'unit', |
| | | slots: { |
| | | default: ({ row }) => { |
| | | if (!row.unit || row.unit === '') { |
| | | return ''; |
| | | } |
| | | return renderDict(row.unit, DictEnum.EIMS_SPARE_UNIT); |
| | | } |
| | | }, |
| | | width: 80 |
| | | }, |
| | | |
| | | { |
| | | title: 'å®é
åºå', |
| | | field: 'actualStock', |
| | | width: 100 |
| | | }, |
| | | { |
| | | title: 'æ°é', |
| | | field: 'quantity', |
| | | editRender: { |
| | | name: 'input' |
| | | }, |
| | | width: 80 |
| | | }, |
| | | { |
| | | title: 'åèä»·', |
| | | field: 'referPrice', |
| | | width: 90 |
| | | } |
| | | ]; |
| | | const emit = defineEmits<{ reload: [] }>(); |
| | | |
| | | const isUpdate = ref(false); |
| | |
| | | if (!isOpen) { |
| | | return null; |
| | | } |
| | | outSpareList.value = []; |
| | | drawerApi.drawerLoading(true); |
| | | const { id } = drawerApi.getData() as { id?: number | string }; |
| | | isUpdate.value = !!id; |
| | |
| | | if (isUpdate.value && id) { |
| | | const record = await getSpareInout(id); |
| | | await formApi.setValues(record); |
| | | outSpareList.value = record?.spareList; |
| | | if (isUpdate.value && record.chargeDept) { |
| | | await setupUserOptions(record.chargeDept); |
| | | } |
| | | } |
| | | |
| | | drawerApi.drawerLoading(false); |
| | |
| | | if (!valid) { |
| | | return; |
| | | } |
| | | const selectSpareList = selectSpareTable.value.tableData(); |
| | | // æ£æµæ¯å¦è¾å
¥åºåºæ°é |
| | | const eList = selectSpareList.filter((item: any) => !item.quantity || item.quantity <= 0); |
| | | if (selectSpareList.length<= 0 || eList.length > 0) { |
| | | message.error('å
¥åºæ°é为空ï¼è¯·æ£æ¥ï¼'); |
| | | return false; |
| | | } |
| | | const data = cloneDeep(await formApi.getValues()); |
| | | data.spareList = selectSpareList; |
| | | await (isUpdate.value ? updateSpareInout(data) : addSpareInout(data)); |
| | | emit('reload'); |
| | | await handleCancel(); |
| | |
| | | drawerApi.close(); |
| | | await formApi.resetForm(); |
| | | } |
| | | |
| | | // å¤ä»¶modal |
| | | const [SpareModal, spareModalApi] = useVbenModal({ |
| | | connectedComponent: spareModal, |
| | | draggable: true, |
| | | title: 'éæ©å¤ä»¶' |
| | | }); |
| | | |
| | | function handleSpareModal() { |
| | | spareModalApi.setData({}); |
| | | spareModalApi.open(); |
| | | } |
| | | |
| | | /** |
| | | * éæ©çå¤ä»¶ |
| | | * @param spareList |
| | | */ |
| | | function selectSpare(spareList: any) { |
| | | outSpareList.value = spareList; |
| | | } |
| | | </script> |
| | | |
| | | <template> |
| | | <BasicDrawer :close-on-click-modal="false" :title="title" class="w-[600px]"> |
| | | <BasicDrawer :close-on-click-modal="false" :title="title" class="w-[1000px]"> |
| | | <BasicForm> |
| | | <template #orderCode="slotProps"> |
| | | <CodeInput v-bind="slotProps" :disabled="isUpdate" prefix="RK" /> |
| | | </template> |
| | | <template #openSpare="slotProps"> |
| | | <a-button type="primary" v-bind="slotProps" :disabled="isUpdate" @click.stop="handleSpareModal">æ·»å å¤ä»¶</a-button> |
| | | </template> |
| | | <template #outSpareList> |
| | | <SelectSpareTable ref="selectSpareTable" :columns="outCol" :data="outSpareList" :is-update="isUpdate" /> |
| | | </template> |
| | | </BasicForm> |
| | | |
| | | <SpareModal class="w-[1200px]" @update-select="selectSpare" /> |
| | | </BasicDrawer> |
| | | </template> |
¶Ô±ÈÐÂÎļþ |
| | |
| | | import type { VxeGridProps } from '#/adapter/vxe-table'; |
| | | |
| | | import { type FormSchemaGetter } from '#/adapter/form'; |
| | | import { renderDict } from '#/utils/render'; |
| | | import { DictEnum } from '@vben/constants'; |
| | | export const querySchema: FormSchemaGetter = () => []; |
| | | |
| | | export const columns: VxeGridProps['columns'] = [ |
| | | { type: 'checkbox', width: 60, fixed: 'left' }, |
| | | { |
| | | title: 'å¤ä»¶åç§°', |
| | | field: 'spareName', |
| | | minWidth: 120 |
| | | }, |
| | | { |
| | | title: 'å¤ä»¶ç¼å·', |
| | | field: 'spareCode', |
| | | minWidth: 120 |
| | | }, |
| | | { |
| | | title: 'è§æ ¼åå·', |
| | | field: 'modelNo', |
| | | minWidth: 100 |
| | | }, |
| | | { |
| | | title: '计éåä½', |
| | | field: 'unit', |
| | | sortable: true, |
| | | slots: { |
| | | default: ({ row }) => { |
| | | if (!row.unit || row.unit === '') { |
| | | return ''; |
| | | } |
| | | return renderDict(row.unit, DictEnum.EIMS_SPARE_UNIT); |
| | | } |
| | | }, |
| | | width: 100 |
| | | }, |
| | | { |
| | | title: 'ä¹ååºå', |
| | | field: 'beforeStock', |
| | | minWidth: 100 |
| | | }, |
| | | { |
| | | title: 'å½ååºå', |
| | | field: 'actualStock', |
| | | minWidth: 100 |
| | | }, |
| | | { |
| | | title: 'æ°é', |
| | | field: 'quantity', |
| | | minWidth: 80 |
| | | }, |
| | | { |
| | | title: 'åä»·', |
| | | field: 'unitPrice', |
| | | minWidth: 80 |
| | | }, |
| | | { |
| | | title: 'éé¢', |
| | | field: 'amount', |
| | | minWidth: 80 |
| | | } |
| | | ]; |
| | | export const drawerSchema: FormSchemaGetter = () => []; |
| | |
| | | } |
| | | ]; |
| | | |
| | | |
| | | |
| | | export const drawerSchema: FormSchemaGetter = () => [ |
| | | { |
| | | component: 'Input', |
| | |
| | | label: '客æ·' |
| | | }, |
| | | { |
| | | component: 'Input', |
| | | fieldName: 'openSpare', |
| | | label: 'éæ©å¤ä»¶', |
| | | formItemClass: 'col-span-1 w-[80px]' |
| | | }, |
| | | { |
| | | component: 'Input', |
| | | fieldName: 'outSpareList', |
| | | label: '' |
| | | }, |
| | | { |
| | | component: 'TreeSelect', |
| | | // å¨draweréæ´æ° è¿éä¸éè¦é»è®¤çcomponentProps |
| | | defaultValue: undefined, |
| | |
| | | <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 { columns, querySchema } from './data'; |
| | | import drawer from './spare-out-drawer.vue'; |
| | | import { columns as inoutCol } from '#/views/eims/spare-inoutdt/data'; |
| | | import { listSpareInoutdt } from '#/api/eims/spare-inoutdt'; |
| | | import BasisSubTable from '#/views/eims/components/basis-sub-table.vue'; |
| | | |
| | | const formOptions: VbenFormProps = { |
| | | commonConfig: { |
| | |
| | | }, |
| | | id: 'spre-inout-index' |
| | | }; |
| | | |
| | | const inoutId = 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; |
| | | inoutId.value = row.id; |
| | | } |
| | | } |
| | | }); |
| | | |
| | |
| | | |
| | | <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:spareInout:export']" @click="handleDownloadExcel"> |
| | |
| | | </Space> |
| | | </template> |
| | | </BasicTable> |
| | | <BasisSubTable |
| | | :columns="inoutCol" |
| | | :list-api="listSpareInoutdt" |
| | | :req-value="inoutId" |
| | | class="h-1/3" |
| | | req-key="inoutId" |
| | | title="åºåºæç»" |
| | | /> |
| | | </div> |
| | | <Drawer @reload="tableApi.query()" /> |
| | | </Page> |
¶Ô±ÈÐÂÎļþ |
| | |
| | | <script setup lang="ts"> |
| | | import type { Recordable } from '@vben/types'; |
| | | |
| | | import { reactive, ref, watch } from 'vue'; |
| | | |
| | | import { $t } from '@vben/locales'; |
| | | import { getVxePopupContainer } from '@vben/utils'; |
| | | |
| | | import { Popconfirm, Space } from 'ant-design-vue'; |
| | | |
| | | import { useVbenVxeGrid, type VxeGridProps, vxeSortEvent } from '#/adapter/vxe-table'; |
| | | |
| | | |
| | | interface Props { |
| | | title?: string; |
| | | columns?: VxeGridProps['columns']; |
| | | data: any; |
| | | isUpdate?: boolean; |
| | | } |
| | | const props = defineProps<Props>(); |
| | | |
| | | const responsiveData = reactive(props.data); |
| | | defineExpose({ |
| | | tableData |
| | | }); |
| | | |
| | | watch( |
| | | () => props.data, |
| | | (data) => { |
| | | responsiveData.splice(0, responsiveData.length, ...data); |
| | | } |
| | | ); |
| | | |
| | | const gridOptions: VxeGridProps = { |
| | | checkboxConfig: { |
| | | // é«äº® |
| | | highlight: true, |
| | | // 翻页æ¶ä¿çéä¸ç¶æ |
| | | reserve: true |
| | | // ç¹å»è¡éä¸ |
| | | // trigger: 'row' |
| | | }, |
| | | columns: props.columns, |
| | | height: 'auto', |
| | | keepSource: true, |
| | | data: responsiveData, |
| | | pagerConfig: { |
| | | enabled: false |
| | | }, |
| | | toolbarConfig: { |
| | | enabled: false |
| | | }, |
| | | rowConfig: { |
| | | isHover: true, |
| | | keyField: 'id' |
| | | }, |
| | | sortConfig: { |
| | | // è¿ç¨æåº |
| | | remote: true, |
| | | // æ¯æå¤å段æåº é»è®¤å
³é |
| | | multiple: true |
| | | }, |
| | | editConfig: { |
| | | mode: 'cell', |
| | | trigger: 'click' |
| | | }, |
| | | id: 'local-table' |
| | | }; |
| | | |
| | | const [BasicTable, tableApi] = useVbenVxeGrid({ |
| | | gridOptions, |
| | | gridEvents: { |
| | | sortChange: (sortParams) => vxeSortEvent(tableApi, sortParams) |
| | | } |
| | | }); |
| | | |
| | | function handleDelete(row: Recordable<any>) { |
| | | const index = responsiveData.findIndex((item: any) => item.id === row.id); |
| | | if (index !== -1) { |
| | | responsiveData.splice(index, 1); |
| | | } |
| | | } |
| | | // é䏿°æ® |
| | | function tableData() { |
| | | return tableApi.grid.getData(); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * TODO åç»æ©å±ç¹å»äºä»¶ |
| | | */ |
| | | const slotName = ref<string>('equName'); |
| | | </script> |
| | | |
| | | <template> |
| | | <div class="w-full h-min"> |
| | | <BasicTable :table-title="title" size="small"> |
| | | <template #[slotName]="{ row }"> |
| | | <Space> |
| | | <span>{{ row[slotName] }}</span> |
| | | </Space> |
| | | </template> |
| | | |
| | | <template #action="{ row }"> |
| | | <Space> |
| | | <Popconfirm :get-popup-container="getVxePopupContainer" placement="left" title="确认å é¤ï¼" @confirm="handleDelete(row)"> |
| | | <ghost-button :disabled="isUpdate" danger @click.stop=""> |
| | | {{ $t('pages.common.delete') }} |
| | | </ghost-button> |
| | | </Popconfirm> |
| | | </Space> |
| | | </template> |
| | | </BasicTable> |
| | | </div> |
| | | </template> |
| | | |
| | | <style lang="scss" scoped> |
| | | :deep(.p-2) { |
| | | padding: 0; |
| | | } |
| | | </style> |
| | |
| | | <script setup lang="ts"> |
| | | import type { VxeGridProps } from '#/adapter/vxe-table'; |
| | | |
| | | import { computed, ref } from 'vue'; |
| | | |
| | | import { useVbenDrawer } from '@vben/common-ui'; |
| | | import { useVbenDrawer, useVbenModal } from '@vben/common-ui'; |
| | | import { DictEnum } from '@vben/constants'; |
| | | import { $t } from '@vben/locales'; |
| | | import { addFullName, cloneDeep, getPopupContainer } from '@vben/utils'; |
| | | |
| | | import { message } from 'ant-design-vue'; |
| | | |
| | | import { useVbenForm } from '#/adapter/form'; |
| | | import { addSpareInout, getSpareInout, updateSpareInout } from '#/api/eims/spare-inout'; |
| | | import { getDeptTree, userList } from '#/api/system/user'; |
| | | import { renderDict } from '#/utils/render'; |
| | | import CodeInput from '#/views/eims/components/code-input.vue'; |
| | | import spareModal from '#/views/eims/components/spare-modal.vue'; |
| | | |
| | | import { drawerSchema } from './data'; |
| | | import CodeInput from '#/views/eims/components/code-input.vue'; |
| | | import SelectSpareTable from './select-spare-table.vue'; |
| | | |
| | | const emit = defineEmits<{ reload: [] }>(); |
| | | |
| | | /** |
| | | * åºåºåéæ©çå¤ä»¶æ°æ® |
| | | */ |
| | | const outSpareList = ref([]); |
| | | const selectSpareTable = ref(); |
| | | |
| | | const outCol: VxeGridProps['columns'] = [ |
| | | { |
| | | field: 'action', |
| | | slots: { default: 'action' }, |
| | | title: 'å é¤', |
| | | width: 60 |
| | | }, |
| | | { |
| | | title: 'å¤ä»¶åç§°', |
| | | field: 'name', |
| | | width: 180 |
| | | }, |
| | | { |
| | | title: 'å¤ä»¶ç¼ç ', |
| | | field: 'code', |
| | | width: 120 |
| | | }, |
| | | { |
| | | title: 'å¤ä»¶åå·', |
| | | field: 'modelNo', |
| | | width: 100 |
| | | }, |
| | | { |
| | | title: '计éåä½', |
| | | field: 'unit', |
| | | slots: { |
| | | default: ({ row }) => { |
| | | if (!row.unit || row.unit === '') { |
| | | return ''; |
| | | } |
| | | return renderDict(row.unit, DictEnum.EIMS_SPARE_UNIT); |
| | | } |
| | | }, |
| | | width: 80 |
| | | }, |
| | | |
| | | { |
| | | title: 'å®é
åºå', |
| | | field: 'actualStock', |
| | | width: 100 |
| | | }, |
| | | { |
| | | title: 'æ°é', |
| | | field: 'quantity', |
| | | editRender: { |
| | | name: 'input' |
| | | }, |
| | | width: 80 |
| | | }, |
| | | { |
| | | title: 'åèä»·', |
| | | field: 'referPrice', |
| | | width: 90 |
| | | } |
| | | ]; |
| | | |
| | | const isUpdate = ref(false); |
| | | const title = computed(() => { |
| | |
| | | drawerApi.drawerLoading(true); |
| | | const { id } = drawerApi.getData() as { id?: number | string }; |
| | | isUpdate.value = !!id; |
| | | outSpareList.value = []; |
| | | // åå§å |
| | | await setupDeptSelect(); |
| | | // æ´æ° && èµå¼ |
| | | if (isUpdate.value && id) { |
| | | const record = await getSpareInout(id); |
| | | await formApi.setValues(record); |
| | | // æ´æ°åºåºåçå¤ä»¶æç» |
| | | outSpareList.value = record?.spareList; |
| | | if (isUpdate.value && record.chargeDept) { |
| | | await setupUserOptions(record.chargeDept); |
| | | } |
| | | } |
| | | |
| | | drawerApi.drawerLoading(false); |
| | |
| | | /** æ ¹æ®é¨é¨IDå è½½ç¨æ· */ |
| | | await setupUserOptions(deptId); |
| | | /** åååéè¦éæ°éæ©ç¨æ· */ |
| | | formModel.operatorId = undefined; |
| | | formModel.chargeUser = undefined; |
| | | }, |
| | | placeholder: 'è¯·éæ©', |
| | | showSearch: true, |
| | |
| | | } |
| | | ]); |
| | | } |
| | | |
| | | async function handleConfirm() { |
| | | try { |
| | | drawerApi.drawerLoading(true); |
| | |
| | | if (!valid) { |
| | | return; |
| | | } |
| | | const selectSpareList = selectSpareTable.value.tableData(); |
| | | // æ£æµæ¯å¦è¾å
¥åºåºæ°é |
| | | const eList = selectSpareList.filter((item: any) => !item.quantity || item.quantity <= 0 || item.quantity > item.actualStock); |
| | | if (selectSpareList.length<= 0 ||eList.length > 0) { |
| | | message.error('åºåºæ°é为空æå¤§äºåºåï¼è¯·æ£æ¥ï¼'); |
| | | return false; |
| | | } |
| | | const data = cloneDeep(await formApi.getValues()); |
| | | data.spareList = selectSpareList; |
| | | await (isUpdate.value ? updateSpareInout(data) : addSpareInout(data)); |
| | | emit('reload'); |
| | | await handleCancel(); |
| | |
| | | drawerApi.close(); |
| | | await formApi.resetForm(); |
| | | } |
| | | |
| | | // å¤ä»¶modal |
| | | const [SpareModal, spareModalApi] = useVbenModal({ |
| | | connectedComponent: spareModal, |
| | | draggable: true, |
| | | title: 'éæ©å¤ä»¶' |
| | | }); |
| | | |
| | | function handleSpareModal() { |
| | | spareModalApi.setData({}); |
| | | spareModalApi.open(); |
| | | } |
| | | |
| | | /** |
| | | * éæ©çå¤ä»¶ |
| | | * @param spareList |
| | | */ |
| | | function selectSpare(spareList: any) { |
| | | outSpareList.value = spareList; |
| | | } |
| | | </script> |
| | | |
| | | <template> |
| | | <BasicDrawer :close-on-click-modal="false" :title="title" class="w-[600px]"> |
| | | <BasicDrawer :close-on-click-modal="false" :title="title" class="w-[1000px]"> |
| | | <BasicForm> |
| | | <template #orderCode="slotProps"> |
| | | <CodeInput v-bind="slotProps" :disabled="isUpdate" prefix="CK" /> |
| | | </template> |
| | | |
| | | <template #openSpare="slotProps"> |
| | | <a-button type="primary" v-bind="slotProps" :disabled="isUpdate" @click.stop="handleSpareModal">æ·»å å¤ä»¶</a-button> |
| | | </template> |
| | | |
| | | <template #outSpareList> |
| | | <SelectSpareTable ref="selectSpareTable" :columns="outCol" :data="outSpareList" :is-update="isUpdate" /> |
| | | </template> |
| | | </BasicForm> |
| | | <SpareModal class="w-[1200px]" @update-select="selectSpare" /> |
| | | </BasicDrawer> |
| | | </template> |
| | |
| | | import type { VxeGridProps } from '#/adapter/vxe-table'; |
| | | |
| | | import { DictEnum } from '@vben/constants'; |
| | | import { getPopupContainer } from '@vben/utils'; |
| | | |
| | | import { Tag } from 'ant-design-vue'; |
| | | |
| | | import { type FormSchemaGetter } from '#/adapter/form'; |
| | | import { getDictOptions } from '#/utils/dict'; |
| | | import { renderDict } from '#/utils/render'; |
| | | import { getPopupContainer } from '@vben/utils'; |
| | | |
| | | export const querySchema: FormSchemaGetter = () => [ |
| | | { |
| | |
| | | sortable: true, |
| | | slots: { |
| | | default: ({ row }) => { |
| | | if (row.unit === null || row.unit === '') { |
| | | if (!row.unit || row.unit === '') { |
| | | return ''; |
| | | } |
| | | return renderDict(row.unit, DictEnum.EIMS_SPARE_UNIT); |
| | |
| | | } |
| | | ]; |
| | | |
| | | export const inoutCol: VxeGridProps['columns'] = [ |
| | | { |
| | | title: 'åºå
¥åºåå·', |
| | | field: 'orderCode', |
| | | width: 180 |
| | | }, |
| | | { |
| | | title: 'æ¥æ', |
| | | field: 'orderTime', |
| | | width: 180 |
| | | }, |
| | | { |
| | | title: 'æ¹å', |
| | | field: 'type1', |
| | | width: 80, |
| | | slots: { |
| | | default: ({ row }) => { |
| | | const type = row.type; |
| | | switch (type) { |
| | | case '1': { |
| | | return <Tag color="green"> å
¥åº </Tag>; |
| | | } |
| | | case '2': { |
| | | return <Tag color="blue"> åºåº </Tag>; |
| | | } |
| | | // No default |
| | | } |
| | | return ''; |
| | | } |
| | | } |
| | | }, |
| | | { |
| | | title: 'ç±»å', |
| | | field: 'type', |
| | | width: 100, |
| | | slots: { |
| | | default: ({ row }) => { |
| | | if (!row.type || row.type === '') { |
| | | return ''; |
| | | } |
| | | return renderDict(row.type, DictEnum.SPARE_INOUT_TYPE); |
| | | } |
| | | } |
| | | }, |
| | | { |
| | | title: 'å
¥åº', |
| | | field: 'inQuantity', |
| | | width: 120, |
| | | slots: { |
| | | default: ({ row }) => { |
| | | return row.type && row.type === '1' ? row.quantity : ''; |
| | | } |
| | | } |
| | | }, |
| | | { |
| | | title: 'åºåº', |
| | | field: 'outQuantity', |
| | | width: 120, |
| | | slots: { |
| | | default: ({ row }) => { |
| | | return row.type && row.type === '2' ? row.quantity : ''; |
| | | } |
| | | } |
| | | }, |
| | | { |
| | | title: 'åºå', |
| | | field: 'actualStock', |
| | | width: 80 |
| | | }, |
| | | { |
| | | title: 'åä»·', |
| | | field: 'unitPrice', |
| | | width: 80 |
| | | }, |
| | | { |
| | | title: 'éé¢', |
| | | field: 'amount', |
| | | width: 80 |
| | | } |
| | | ]; |
| | | |
| | | export const drawerSchema: FormSchemaGetter = () => [ |
| | | { |
| | | component: 'Input', |
| | |
| | | show: () => false, |
| | | triggerFields: ['imgUrl'] |
| | | }, |
| | | label: 'å¤ä»¶é¢è§', |
| | | label: 'å¤ä»¶é¢è§' |
| | | }, |
| | | { |
| | | component: 'Input', |
| | |
| | | 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; |
| | |
| | | driverClassName: com.mysql.cj.jdbc.Driver |
| | | # jdbc ææåæ°é
ç½®åè https://lionli.blog.csdn.net/article/details/122018562 |
| | | # rewriteBatchedStatements=true æ¹å¤çä¼å 大å¹
æåæ¹éæå
¥æ´æ°å 餿§è½(å¯¹æ°æ®åºææ§è½æè ä½¿ç¨æ¹éæä½åºèèæ§è½é®é¢) |
| | | url: jdbc:mysql://localhost:3306/ry-vue?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8&autoReconnect=true&rewriteBatchedStatements=true&allowPublicKeyRetrieval=true&nullCatalogMeansCurrent=true |
| | | url: jdbc:mysql://localhost:3306/eims?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8&autoReconnect=true&rewriteBatchedStatements=true&allowPublicKeyRetrieval=true&nullCatalogMeansCurrent=true |
| | | username: root |
| | | password: root |
| | | password: 123456 |
| | | # ä»åºæ°æ®æº |
| | | slave: |
| | | lazy: true |
| | |
| | | # æ°æ®åºç´¢å¼ |
| | | database: 0 |
| | | # redis å¯ç å¿
é¡»é
ç½® |
| | | password: ruoyi123 |
| | | #password: ruoyi123 |
| | | # è¿æ¥è¶
æ¶æ¶é´ |
| | | timeout: 10s |
| | | # æ¯å¦å¼å¯ssl |
| | |
| | | } |
| | | |
| | | |
| | | /** |
| | | *å¤ä»¶åºå
¥åºç±»å |
| | | */ |
| | | String SPARE_INOUT_TYPE = "spare_inout_type"; |
| | | interface SPARE_INOUT_TYPE_DETAIL { |
| | | String RK = "1";// éè´å
¥åº |
| | | String CK = "2"; // é¢ç¨åºåº |
| | | } |
| | | |
| | | |
| | | |
| | | |
| | | } |