feat(RealTimeInventory): 添加双击单元格显示库存详情功能

添加双击表格单元格事件处理,当单元格有数据时显示WMS库存详情对话框。包括处理无效数据检查、列类型过滤以及参数提取逻辑。
master
huangjinysf 2 months ago
parent 78d422f3f7
commit ab5bb998d6

@ -20,6 +20,7 @@
:header-cell-style="{ backgroundColor: '#f5f7fa', color: '#606266' }"
empty-text="暂无数据"
:scrollbar-always-on="true"
@cell-dblclick="handleCellDblClick"
>
<!-- 规格列 -->
<el-table-column
@ -57,17 +58,42 @@
</el-table-column>
</el-table>
</div>
<!-- WmsTable 详情对话框 -->
<el-dialog
v-model="wmsDialogVisible"
title="库存详情"
width="80%"
destroy-on-close
>
<WmsTable
v-if="wmsDialogVisible"
ref="wmsTableRef"
:model="currentWmsModel"
:specification="currentWmsSpecification"
:loading-height="200"
:show-action="true"
/>
</el-dialog>
</div>
</template>
<script setup>
import { ref, onMounted, computed } from 'vue'
import { API_CONFIG } from "@/config/api"
import { ElMessage } from 'element-plus'
import WmsTable from '@/components/WmsTable/index.vue'
//
const loading = ref(false)
const records = ref([])
// WMS
const wmsDialogVisible = ref(false)
const currentWmsModel = ref('')
const currentWmsSpecification = ref('')
const wmsTableRef = ref(null)
//
const dynamicColumns = computed(() => {
if (!records.value.length) return [];
@ -186,6 +212,42 @@ const refreshData = () => {
fetchData();
};
//
const handleCellDblClick = (row, column, cell, event) => {
const cellValue = row[column.property];
//
if (!cellValue || cellValue === '-' || cellValue === null || cellValue === undefined) {
ElMessage.warning('该单元格暂无数据');
return;
}
// WMS
if (column.property === 'specification' || column.property === 'total') {
ElMessage.info('该列不支持查看详情');
return;
}
// modelwire_disc
const columnKey = column.property;
const hasWireDisc = columnKey.includes('::');
let model, wire_disc;
if (hasWireDisc) {
[model, wire_disc] = columnKey.split('::');
} else {
model = columnKey;
wire_disc = null;
}
// WMS
currentWmsModel.value = model;
currentWmsSpecification.value = row.specification;
// WMS
wmsDialogVisible.value = true;
};
//
onMounted(() => {
fetchData();

Loading…
Cancel
Save