diff --git a/src/api/module/eam/device/storage.ts b/src/api/module/eam/device/storage.ts index 34b8f90..2b679b5 100644 --- a/src/api/module/eam/device/storage.ts +++ b/src/api/module/eam/device/storage.ts @@ -16,16 +16,22 @@ export const storageOutDevice = (params: IStorageOutParam) => data: params, }) -export const getStorageOutByDeviceId = (deviceId: number) => +export const getStorageByDeviceId = (deviceId: number) => eamServer({ - url: `/out-storage/get-by-device-id`, + url: `/storage/get-by-device-id`, method: 'get', params: { deviceId }, }) -export const getStorageOutPage = (params: PageParam) => +export const getStoragePage = (params: PageParam) => eamServer({ - url: `/out-storage/page`, + url: `/storage/page`, method: 'get', params, }) + +export const getStorageStatics = () => + eamServer({ + url: `/storage/statics`, + method: 'get', + }) diff --git a/src/pages/deviceInfo/components/DeliveryInfo.vue b/src/pages/deviceInfo/components/DeliveryInfo.vue index cb8dcd8..ded6e8e 100644 --- a/src/pages/deviceInfo/components/DeliveryInfo.vue +++ b/src/pages/deviceInfo/components/DeliveryInfo.vue @@ -49,7 +49,7 @@ import { getSimpleCustomerList, type CustomerVO } from '@/api/module/eam/custome import { isResError } from '@/hooks/useMessage' import type { IDevice } from '@/api/module/eam/device' import { - getStorageOutByDeviceId, + getStorageByDeviceId, storageOutDevice, type IStorageOutParam, } from '@/api/module/eam/device/storage' @@ -63,7 +63,7 @@ const props = defineProps<{ deviceId: number | undefined }>() const isShowSaveButton = computed(() => { - if(action === 'view') return false + if (action === 'view') return false return props.info?.status === undefined ? true : props.info.status < 3 }) @@ -107,8 +107,8 @@ watch( async function loadDeviceStorageInfo() { if (!props.deviceId) return - const res = await getStorageOutByDeviceId(props.deviceId) - if (isResError(res)) return + const res = await getStorageByDeviceId(props.deviceId) + if (isResError(res) || !res.data) return for (const key of Object.keys(params.value)) { params.value[key] = res.data[key] ?? '' } diff --git a/src/pages/deviceStorage/components/data-filter.vue b/src/pages/deviceStorage/components/data-filter.vue new file mode 100644 index 0000000..bcdcb8e --- /dev/null +++ b/src/pages/deviceStorage/components/data-filter.vue @@ -0,0 +1,190 @@ + + + + + diff --git a/src/pages/deviceStorage/components/pie-chart.vue b/src/pages/deviceStorage/components/pie-chart.vue new file mode 100644 index 0000000..3230ccc --- /dev/null +++ b/src/pages/deviceStorage/components/pie-chart.vue @@ -0,0 +1,124 @@ + + + + + diff --git a/src/pages/deviceStorage/index.vue b/src/pages/deviceStorage/index.vue index 82804cf..72957e6 100644 --- a/src/pages/deviceStorage/index.vue +++ b/src/pages/deviceStorage/index.vue @@ -1,48 +1,14 @@ - + @@ -91,10 +77,13 @@ import dayjs from 'dayjs' import EdfsWrap from '@/components/dashboard/Edfs-wrap.vue' import EdfsTable from '@/components/dashboard/Edfs-table/index.vue' -import { tableCol } from './utils' +import { statusList, tableCol } from './utils' import { isResError } from '@/hooks/useMessage' -import { getStorageOutPage } from '@/api/module/eam/device/storage' +import LeftFilter from './components/data-filter.vue' +import { getStoragePage, getStorageStatics } from '@/api/module/eam/device/storage' import { useRouter } from 'vue-router' +import PieChart from './components/pie-chart.vue' +import { getSimpleCustomerList, type CustomerVO } from '@/api/module/eam/customer' const router = useRouter() const loading = ref(true) @@ -103,17 +92,12 @@ const list = ref([]) const queryParams = reactive({ pageNo: 1, pageSize: 10, - // number: undefined, - // deviceName: undefined, - // status: undefined, - // code: undefined, - // createTime: [], }) const getList = async () => { loading.value = true - const res = await getStorageOutPage(queryParams) + const res = await getStoragePage(Object.assign({}, queryParams, filter.value)) if (!isResError(res)) { list.value = res.data.list @@ -123,10 +107,17 @@ const getList = async () => { loading.value = false } -const handleQuery = () => { +const storageStatus = computed( + () => statusList.find(item => item.value === filter.value.status)?.colName ?? '' +) + +const filter = ref({}) +function onSearch(search: any) { queryParams.pageNo = 1 + filter.value = search getList() } + function handleJump(page: number) { queryParams.pageNo = page getList() @@ -138,8 +129,31 @@ function addMaintain(row: any) { query: { action: 'update', type: 'maintain', id: row.deviceId }, }) } + +function addOutStorage(row: any) { + router.push({ + path: '/device/deviceOperation', + query: { action: 'update', type: 'delivery', id: row.deviceId }, + }) +} + +const customerList = ref>>([]) +async function loadCustomerList() { + const res = await getSimpleCustomerList() + if (isResError(res)) return + customerList.value = res.data +} + +const chartData = ref([]) as Ref +async function loadChartData() { + const res = await getStorageStatics() + if (!isResError(res)) { + chartData.value = res.data + } +} onMounted(() => { - getList() + loadCustomerList() + loadChartData() }) @@ -148,37 +162,47 @@ onMounted(() => { width: 100%; height: 100%; display: flex; - flex-direction: column; - row-gap: 10px; - .storage-info-from-wrap { - height: auto; - width: 100%; - .from { - display: flex; - flex-direction: column; - justify-content: space-around; - height: 100%; - width: 100%; - .from-input { - display: flex; - width: 100%; - column-gap: 20px; - row-gap: 10px; - flex-wrap: wrap; - .from-row { - min-width: 270px; - display: flex; - align-items: center; - column-gap: 4px; - .label { - white-space: nowrap; - width: 70px; - color: var(--label-text); - } - } + column-gap: 12px; + box-sizing: border-box; + font-size: 16px; + .left-wrap { + width: 280px; + min-width: 100px; + height: 100%; + background: var(--warp-bg); + display: flex; + flex-direction: column; + + box-sizing: border-box; + .station { + position: relative; + height: 60px; + padding-left: 20px; + border-bottom: 1px solid var(--pagination-border-color); + :deep(.el-input__inner) { + color: #666; + } + + :deep(.el-input__wrapper) { + padding: 0; + } + + :deep(.el-input__suffix) { + display: none; } } + .chart-box { + height: 300px; + } + .filter { + height: calc(100% - 300px); + overflow: hidden; + } + :deep(.edfs-wrap) { + box-shadow: none; + } } + .storage-info-table { flex: 1; .table { diff --git a/src/pages/deviceStorage/utils.ts b/src/pages/deviceStorage/utils.ts index 26ed765..2268dfb 100644 --- a/src/pages/deviceStorage/utils.ts +++ b/src/pages/deviceStorage/utils.ts @@ -1,7 +1,13 @@ export const tableCol = [ - { label: '出库设备', prop: 'deviceName', minWidth: '12%' }, - { label: '客户', prop: 'customerName', minWidth: '10%' }, + { label: '设备名称', prop: 'deviceName', minWidth: '10%' }, + { label: '设备sn', prop: 'sn', minWidth: '10%' }, + { label: '库存状态', prop: 'status', minWidth: '10%' }, + { label: '客户', prop: 'customerName', minWidth: '14%' }, { label: '出库价格', prop: 'price', minWidth: '10%' }, - // { label: '出库单名称', prop: 'name', minWidth: '10%' }, - { label: '描述', prop: 'description', minWidth: '16%' }, + { label: '时间', prop: 'updateTime', minWidth: '18%' }, +] + +export const statusList = [ + { label: '已入库', value: 2, colName: '入库' }, + { label: '已出库', value: 3, colName: '出库' }, ]