|
|
|
|
@ -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;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// 从列属性中提取model和wire_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();
|
|
|
|
|
|