diff --git a/dev_wms_client/src/api/stand.js b/dev_wms_client/src/api/stand.js
index 9deb18d..8669537 100644
--- a/dev_wms_client/src/api/stand.js
+++ b/dev_wms_client/src/api/stand.js
@@ -1,8 +1,8 @@
import request from "@/http/request";
-const getStandsByPage = (params) => {
+const getAllStands = (params) => {
return request({
- url: '/stand/getStandsByPage',
+ url: '/stand/getAllStands',
method: 'post',
data: params
})
@@ -17,6 +17,6 @@ const updateStandInfo = (params) => {
}
export {
- getStandsByPage,
+ getAllStands,
updateStandInfo
}
\ No newline at end of file
diff --git a/dev_wms_client/src/layout/standSettings.vue b/dev_wms_client/src/layout/standSettings.vue
index 8d2111b..263f73c 100644
--- a/dev_wms_client/src/layout/standSettings.vue
+++ b/dev_wms_client/src/layout/standSettings.vue
@@ -7,21 +7,13 @@
label-width="158px" style="max-width: 100%" status-icon>
-
-
+
-
-
-
-
-
-
-
-
+
+
@@ -40,121 +32,81 @@
@sort-change="handleSortChange">
-
+
-
-
-
-
-
-
-
+
-
-
-
-
-
+
-
+
-
-
+
+
-
-
+
+
-
-
+
+
-
-
+
+
-
-
+
+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
@@ -182,37 +134,48 @@ import {ElMessage} from 'element-plus'
import {genTableRequest, addAllOptionOfOptions} from '@/utils/generator.js'
import {labelPosition} from '@/constant/form.js'
import {loading} from '@/utils/loading'
-import {queryLocationsByPage} from "@/api/location";
-import {lockOptions, occupyOptions} from "@/constant/options";
+import {getAllStands, updateStandInfo} from "@/api/stand";
/**
* 常量定义
*/
const STAND_ID = store.getters.getStandId
const USER_NAME = store.getters.getUserName
+
+// 站台类型选项
+const standTypeOptions = [
+ { value: 1, label: '拣选站台' },
+ { value: 2, label: '入库站台' }
+]
+
+// 站台状态选项
+const standStatusOptions = [
+ { value: 0, label: '可用' },
+ { value: 1, label: '不可用' }
+]
+
/**
* 变量定义
*/
let maxHeight = ref(window.innerHeight * 0.55)
let tableLoading = ref(false)
let tableData = ref([])
+let allTableData = ref([]) // 存储完整的数据,用于前端分页和排序
let baseTableQuery = reactive({
currentPage: 1,
pageSize: 10,
total: 0,
- sortBy: new Map([['lDepth', true], ['lLayer', true], ['lCol', true], ['lRow', true]]),// 按照成品号顺序排序
+ sortBy: new Map([['standId', true]]),// 按照站台ID排序
standId: STAND_ID,
userName: USER_NAME
})
let searchQueryFormEntity = reactive({
- locationId: '',
- vehicleId: '',
- isLock: -99,
- isOccupy: -99
+ standId: '',
+ standType: -99
})
let searchQueryFormRef = ref()
let rowEditFlag = ref(false)
-let locationId = ''
+let standId = ''
let rowEditFormRef = ref()
let rowFormEntity = reactive({})
/**
@@ -238,20 +201,26 @@ const resizeHeight = () => {
// 查询
const search = () => {
tableLoading.value = true
- let request = genTableRequest(baseTableQuery)
+ let request = {}
// 设定查询参数
- request.locationId = searchQueryFormEntity.locationId.trim()
- request.vehicleId = searchQueryFormEntity.vehicleId.trim()
- request.isLock = searchQueryFormEntity.isLock === -99 ? null : searchQueryFormEntity.isLock
- request.isOccupy = searchQueryFormEntity.isOccupy === -99 ? null : searchQueryFormEntity.isOccupy
- queryLocationsByPage(request).then((res) => {
+ if (searchQueryFormEntity.standId.trim()) {
+ request.standId = searchQueryFormEntity.standId.trim()
+ }
+ if (searchQueryFormEntity.standType !== -99) {
+ request.standType = searchQueryFormEntity.standType
+ }
+
+ getAllStands(request).then((res) => {
const response = res.data
if (response.code === 0) {
const data = response.data
if (data != null) {
- tableData.value = data.lists
- baseTableQuery.total = data.total
+ allTableData.value = data
+ baseTableQuery.total = data.length
+ // 处理分页和排序
+ processTableData()
} else {
+ allTableData.value = []
tableData.value = []
baseTableQuery.total = 0
}
@@ -265,82 +234,153 @@ const search = () => {
tableLoading.value = false
})
}
-const clearQuery = () => {
- searchQueryFormEntity.locationId = ''
- searchQueryFormEntity.vehicleId = ''
-}
-const handleSortChange = (data) => {
- if (baseTableQuery.sortBy.has(data.prop)) {
- baseTableQuery.sortBy.delete(data.prop)
+
+// 处理分页和排序
+const processTableData = () => {
+ let data = [...allTableData.value]
+
+ // 前端排序处理
+ if (baseTableQuery.sortBy.size > 0) {
+ data = sortTableData(data, baseTableQuery.sortBy)
}
- baseTableQuery.sortBy.set(data.prop, data.order.toLowerCase() === 'ascending')
+
+ // 前端分页处理
+ const startIndex = (baseTableQuery.currentPage - 1) * baseTableQuery.pageSize
+ const endIndex = startIndex + baseTableQuery.pageSize
+ tableData.value = data.slice(startIndex, endIndex)
+}
+
+// 前端排序函数
+const sortTableData = (data, sortBy) => {
+ if (sortBy.size === 0) {
+ return data
+ }
+
+ return data.slice().sort((a, b) => {
+ for (const [key, ascending] of sortBy) {
+ let aValue = a[key]
+ let bValue = b[key]
+
+ // 处理null/undefined值
+ if (aValue == null && bValue == null) continue
+ if (aValue == null) return ascending ? 1 : -1 // null值排在后面
+ if (bValue == null) return ascending ? -1 : 1
+
+ // 处理时间字符串
+ if (key === 'lastUpdateTime') {
+ aValue = new Date(aValue).getTime()
+ bValue = new Date(bValue).getTime()
+ }
+
+ // 处理数字类型(standType, standStatus等)
+ if (typeof aValue === 'number' && typeof bValue === 'number') {
+ if (aValue !== bValue) {
+ return ascending ? aValue - bValue : bValue - aValue
+ }
+ continue
+ }
+
+ // 处理字符串
+ if (typeof aValue === 'string' && typeof bValue === 'string') {
+ aValue = aValue.toLowerCase()
+ bValue = bValue.toLowerCase()
+ }
+
+ // 转换为字符串进行比较(兼容混合类型)
+ aValue = String(aValue)
+ bValue = String(bValue)
+
+ if (aValue < bValue) {
+ return ascending ? -1 : 1
+ }
+ if (aValue > bValue) {
+ return ascending ? 1 : -1
+ }
+ }
+ return 0
+ })
+}
+const clearQuery = () => {
+ searchQueryFormEntity.standId = ''
+ searchQueryFormEntity.standType = -99
+ // 重置分页
+ baseTableQuery.currentPage = 1
+ // 重置排序
+ baseTableQuery.sortBy.clear()
+ baseTableQuery.sortBy.set('standId', true) // 默认按站台ID升序排序
search()
}
+
+// 处理页面大小变化
+const handlePageSizeChange = () => {
+ // 页面大小变化时,重置到第一页
+ baseTableQuery.currentPage = 1
+ processTableData()
+}
+const handleSortChange = (data) => {
+ // 临时调试信息
+ console.log('handleSortChange called with:', data)
+ console.log('allTableData length:', allTableData.value.length)
+
+ // 清空当前排序设置
+ baseTableQuery.sortBy.clear()
+
+ // 如果排序不为null,则设置新的排序
+ if (data.order) {
+ const isAscending = data.order.toLowerCase() === 'ascending'
+ baseTableQuery.sortBy.set(data.prop, isAscending)
+ console.log('Setting sort:', data.prop, isAscending)
+ } else {
+ // 如果order为null,恢复默认排序
+ baseTableQuery.sortBy.set('standId', true)
+ console.log('Resetting to default sort: standId')
+ }
+
+ // 排序变化时,重置到第一页
+ baseTableQuery.currentPage = 1
+ processTableData()
+}
const getCurrentRow = (row) => {
- locationId = row.locationId
+ standId = row.standId
}
const timeFormat = (row, column, cellValue, index) => {
return timeFormatter(cellValue)
}
-const isLockFormat = (row, column, cellValue, index) => {
- return cellValue === 1 ? '已锁定' : '未锁定'
+const standTypeFormat = (row, column, cellValue, index) => {
+ const typeMap = {
+ 1: '拣选站台',
+ 2: '入库站台'
+ }
+ return typeMap[cellValue] || '未知'
}
-const isOccupyFormat = (row, column, cellValue, index) => {
- return cellValue === 1 ? '占用' : '空闲'
+const standStatusFormat = (row, column, cellValue, index) => {
+ return cellValue === 1 ? '可用' : '不可用'
}
// 编辑弹框
const editCurrentRowFormEntity = (row) => {
// 设置form值
- rowFormEntity.workIndex = row.workIndex
- rowFormEntity.workOrder = row.workOrder
- rowFormEntity.productId = row.productId
- rowFormEntity.singleProductId = row.singleProductId
- rowFormEntity.boxNo = row.boxNo
- rowFormEntity.goodsId = row.goodsId
- rowFormEntity.needNum = row.needNum
- rowFormEntity.distributeNum = row.distributeNum
- rowFormEntity.finishNum = row.finishNum
- rowFormEntity.workStatus = row.workStatus
- rowFormEntity.lackStatus = row.lackStatus
+ rowFormEntity.standId = row.standId
+ rowFormEntity.standName = row.standName
+ rowFormEntity.standType = row.standType
+ rowFormEntity.standStatus = row.standStatus
+ rowFormEntity.standIp = row.standIp
+ rowFormEntity.standDesc = row.standDesc
// 弹出框
rowEditFlag.value = true
}
-// 关闭当前缺料工作
-const closeLackWork = (row) => {
- const request = {
- workIndex: row.workIndex,
- standId: STAND_ID,
- userName: USER_NAME
- }
- loading.open('关闭中...')
- closeCurrentWorks(request).then(res => {
- const response = res.data
- if (response.code == 0) {
- ElMessage.success(response.message)
- search()
- } else {
- ElMessage.error(response.message)
- }
- }).catch(err => {
- console.log(err)
- ElMessage.error('请求异常。')
- }).finally(() => {
- loading.close()
- })
-}
// 更新当前行数据
const submitUpdateRow = (rowFormEntity) => {
const request = {
- workIndex: rowFormEntity.workIndex,
- distributeNum: rowFormEntity.distributeNum,
- finishNum: rowFormEntity.finishNum,
- workStatus: rowFormEntity.workStatus,
- lackStatus: rowFormEntity.lackStatus,
- standId: STAND_ID,
- userName: USER_NAME
+ standId: rowFormEntity.standId,
+ standName: rowFormEntity.standName,
+ standType: rowFormEntity.standType,
+ standStatus: rowFormEntity.standStatus,
+ standIp: rowFormEntity.standIp,
+ standDesc: rowFormEntity.standDesc,
+ userName: 'wms-web'
}
loading.open('更新中...')
- updateKateWorks(request).then(res => {
+ updateStandInfo(request).then(res => {
if (res.data.code == 0) {
ElMessage.success('更新数据成功。')
rowEditFlag.value = false