2025-06-24 13:43:23 +08:00
|
|
|
<template>
|
2025-07-05 02:52:44 +08:00
|
|
|
<Dialog title="实时库存" v-model="dialogVisible" width="80%">
|
|
|
|
|
<el-card class="hl-card">
|
|
|
|
|
|
|
|
|
|
<ContentWrap class="borderxx">
|
|
|
|
|
<el-form class="-mb-15px" :model="queryParams" ref="queryFormRef" :inline="true" label-width="120px">
|
|
|
|
|
<el-form-item label="物料名称" prop="matName" >
|
|
|
|
|
<el-input v-model="queryParams.matName" placeholder="物料名称" clearable @keyup.enter="handleQuery" class="!w-240px" />
|
|
|
|
|
</el-form-item>
|
|
|
|
|
<el-form-item label="规格型号" prop="matSpec" >
|
|
|
|
|
<el-input v-model="queryParams.matSpec" placeholder="规格型号" clearable @keyup.enter="handleQuery" class="!w-240px" />
|
|
|
|
|
</el-form-item>
|
|
|
|
|
<el-form-item label="物料简称" prop="shortName" >
|
|
|
|
|
<el-input v-model="queryParams.shortName" placeholder="物料简称" clearable @keyup.enter="handleQuery" class="!w-240px" />
|
|
|
|
|
</el-form-item>
|
|
|
|
|
<el-form-item >
|
|
|
|
|
<el-button @click="handleQuery" type="primary">
|
|
|
|
|
<Icon icon="ep:search" class="mr-5px" /> 搜索
|
|
|
|
|
</el-button>
|
|
|
|
|
<el-button @click="resetQuery">
|
|
|
|
|
<Icon icon="ep:refresh" class="mr-5px" /> 重置
|
|
|
|
|
</el-button>
|
2025-08-04 15:43:45 +08:00
|
|
|
|
2025-07-05 02:52:44 +08:00
|
|
|
</el-form-item>
|
|
|
|
|
</el-form>
|
|
|
|
|
</ContentWrap>
|
|
|
|
|
|
|
|
|
|
<!-- 列表 -->
|
|
|
|
|
<ContentWrap>
|
|
|
|
|
<el-table ref="multipleTableRef" v-loading="loading" :data="list" :stripe="true" @row-click="clickRow" @selection-change="handleCurrentChange" :show-overflow-tooltip="true" class="hl-table">
|
|
|
|
|
<el-table-column
|
|
|
|
|
type="selection"
|
|
|
|
|
width="55"/>
|
|
|
|
|
<el-table-column type="index" width="100" fixed label="序号" align="center" />
|
|
|
|
|
<el-table-column prop="matCode" label="物料编码" :fixed="left" min-width="120" align="center" />
|
|
|
|
|
<el-table-column prop="matName" label="物料名称" :fixed="left" min-width="140" align="center" />
|
|
|
|
|
<el-table-column prop="matType" label="物料类型" min-width="120" align="center" />
|
|
|
|
|
<el-table-column prop="shortName" label="物料简称" min-width="120" align="center" />
|
|
|
|
|
<el-table-column prop="matSpec" label="规格/型号" min-width="120" align="center" />
|
|
|
|
|
<el-table-column prop="matBrand" label="品牌" min-width="120" align="center" />
|
|
|
|
|
<el-table-column prop="whName" label="仓库" min-width="120" align="center" >
|
|
|
|
|
<template #default="scope">
|
|
|
|
|
{{scope.row.whName}}
|
|
|
|
|
</template>
|
|
|
|
|
</el-table-column>
|
|
|
|
|
<el-table-column prop="rgName" label="库区" min-width="120" align="center" >
|
|
|
|
|
<template #default="scope">
|
|
|
|
|
{{scope.row.rgName}}
|
|
|
|
|
</template>
|
|
|
|
|
</el-table-column>
|
|
|
|
|
<el-table-column prop="pnName" label="库位" min-width="140" align="center" >
|
|
|
|
|
<template #default="scope">
|
|
|
|
|
{{scope.row.pnName}}
|
|
|
|
|
</template>
|
|
|
|
|
</el-table-column>
|
|
|
|
|
<el-table-column prop="matRest" label="库存数量" min-width="120" align="center" />
|
|
|
|
|
<el-table-column prop="matUnit" label="库存单位" min-width="120" align="center" />
|
|
|
|
|
</el-table>
|
|
|
|
|
<!-- 分页 -->
|
|
|
|
|
<Pagination
|
|
|
|
|
:total="total" v-model:page="queryParams.pageNo" v-model:limit="queryParams.pageSize"
|
|
|
|
|
@pagination="getList" />
|
|
|
|
|
</ContentWrap>
|
|
|
|
|
</el-card>
|
2025-06-24 13:43:23 +08:00
|
|
|
<template #footer>
|
|
|
|
|
<span class="dialog-footer">
|
|
|
|
|
<el-button @click="dialogVisible = false">取消</el-button>
|
|
|
|
|
<el-button type="primary" @click="success">
|
|
|
|
|
确认
|
|
|
|
|
</el-button>
|
|
|
|
|
</span>
|
|
|
|
|
</template>
|
2025-07-05 02:52:44 +08:00
|
|
|
</Dialog>
|
2025-08-04 15:43:45 +08:00
|
|
|
|
2025-06-24 13:43:23 +08:00
|
|
|
</template>
|
|
|
|
|
|
|
|
|
|
<script setup lang="ts">
|
2025-07-05 02:52:44 +08:00
|
|
|
import {DICT_TYPE} from "@/utils/dict";
|
|
|
|
|
import * as MaterialApi from "@/api/heli/material";
|
|
|
|
|
import * as StorageInventoryApi from "@/api/heli/storageinventory";
|
2025-08-04 15:43:45 +08:00
|
|
|
import MaterialForm from "./MaterialForm.vue";
|
2025-06-24 13:43:23 +08:00
|
|
|
defineOptions({ name: 'StorageLog' })
|
|
|
|
|
const printref = ref()
|
|
|
|
|
const whList = ref([])
|
|
|
|
|
const rgList = ref([])
|
|
|
|
|
const pnList = ref([])
|
|
|
|
|
const dialogVisible = ref(false)
|
2025-07-05 02:52:44 +08:00
|
|
|
|
2025-06-24 13:43:23 +08:00
|
|
|
|
|
|
|
|
const message = useMessage() // 消息弹窗
|
|
|
|
|
const { t } = useI18n() // 国际化
|
|
|
|
|
|
2025-07-05 02:52:44 +08:00
|
|
|
|
2025-06-24 13:43:23 +08:00
|
|
|
const loading = ref(true) // 列表的加载中
|
|
|
|
|
const list = ref([]) // 列表的数据
|
|
|
|
|
const total = ref(0) // 列表的总页数
|
|
|
|
|
const queryParams = reactive({
|
|
|
|
|
pageNo: 1,
|
|
|
|
|
pageSize: 10,
|
2025-07-05 02:52:44 +08:00
|
|
|
code: undefined,
|
|
|
|
|
name: undefined,
|
2025-06-24 13:43:23 +08:00
|
|
|
matType: undefined,
|
|
|
|
|
lotNo: undefined,
|
|
|
|
|
whId: undefined,
|
|
|
|
|
rgId:undefined,
|
|
|
|
|
pnId: undefined,
|
|
|
|
|
headerNo: undefined,
|
2025-07-05 02:52:44 +08:00
|
|
|
spec:undefined,
|
|
|
|
|
shortName:undefined,
|
|
|
|
|
matName:undefined,
|
|
|
|
|
matSpec:undefined,
|
2025-06-24 13:43:23 +08:00
|
|
|
})
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const queryFormRef = ref() // 搜索的表单
|
|
|
|
|
|
|
|
|
|
const currentRow = ref()
|
|
|
|
|
const multipleTableRef = ref()
|
2025-08-04 15:43:45 +08:00
|
|
|
|
2025-06-24 13:43:23 +08:00
|
|
|
/** 查询列表 */
|
|
|
|
|
const getList = async () => {
|
|
|
|
|
loading.value = true
|
|
|
|
|
try {
|
2025-07-05 02:52:44 +08:00
|
|
|
const data = await StorageInventoryApi.getStorageInventoryPage(queryParams)
|
2025-06-24 13:43:23 +08:00
|
|
|
list.value = data.list
|
|
|
|
|
total.value = data.total
|
|
|
|
|
} finally {
|
|
|
|
|
loading.value = false
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
const clickItem = ref([])
|
|
|
|
|
const handleCurrentChange = (val) => {
|
|
|
|
|
clickItem.value = val;
|
2025-06-26 15:45:26 +08:00
|
|
|
if(val.length > 1){
|
2025-07-05 02:52:44 +08:00
|
|
|
multipleTableRef.value!.clearSelection()
|
|
|
|
|
multipleTableRef.value!.toggleRowSelection(val.pop())
|
2025-06-26 15:45:26 +08:00
|
|
|
}
|
2025-07-05 02:52:44 +08:00
|
|
|
};
|
2025-06-26 15:45:26 +08:00
|
|
|
const clickRow = (row) => {
|
2025-07-05 02:52:44 +08:00
|
|
|
if (clickItem.value==null){
|
|
|
|
|
clickItem.value = [];
|
2025-06-24 13:43:23 +08:00
|
|
|
|
2025-07-05 02:52:44 +08:00
|
|
|
}
|
|
|
|
|
// 单选选中行
|
|
|
|
|
if ( clickItem.value[0] == row) {
|
|
|
|
|
// 取消
|
|
|
|
|
clickItem.value = [];
|
|
|
|
|
multipleTableRef.value!.clearSelection()
|
|
|
|
|
} else {
|
|
|
|
|
// 选择
|
|
|
|
|
clickItem.value.push(row);
|
|
|
|
|
multipleTableRef.value!.clearSelection()
|
|
|
|
|
multipleTableRef.value!.toggleRowSelection(row, true);
|
|
|
|
|
}
|
|
|
|
|
}
|
2025-06-24 13:43:23 +08:00
|
|
|
/** 搜索按钮操作 */
|
|
|
|
|
const handleQuery = () => {
|
|
|
|
|
queryParams.pageNo = 1
|
|
|
|
|
getList()
|
|
|
|
|
}
|
2025-07-05 02:52:44 +08:00
|
|
|
|
2025-06-24 13:43:23 +08:00
|
|
|
/** 重置按钮操作 */
|
|
|
|
|
const resetQuery = () => {
|
|
|
|
|
queryFormRef.value.resetFields()
|
|
|
|
|
handleQuery()
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
const rowid = ref()
|
|
|
|
|
const open = async (rowids,matCode) => {
|
|
|
|
|
clickItem.value = null;
|
|
|
|
|
//multipleTableRef.value!.clearSelection()
|
|
|
|
|
dialogVisible.value = true
|
2025-07-05 02:52:44 +08:00
|
|
|
// queryParams.matName = matCode;
|
2025-06-24 13:43:23 +08:00
|
|
|
rowid.value = rowids
|
2025-07-05 02:52:44 +08:00
|
|
|
queryParams.matName = matCode;
|
|
|
|
|
|
|
|
|
|
console.log(rowids)
|
|
|
|
|
console.log(rowid.value)
|
2025-06-24 13:43:23 +08:00
|
|
|
await getList();
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
defineExpose({ open }) // 提供 open 方法,用于打开弹窗
|
|
|
|
|
const emit = defineEmits(['success'])
|
|
|
|
|
// emit('success', multipleSelection.value)
|
2025-07-05 02:52:44 +08:00
|
|
|
const success = () => {
|
2025-06-24 13:43:23 +08:00
|
|
|
dialogVisible.value = false;
|
2025-07-05 02:52:44 +08:00
|
|
|
const data={
|
|
|
|
|
rowid:rowid.value,
|
|
|
|
|
materialId:clickItem.value[0].materialId,
|
|
|
|
|
matCode:clickItem.value[0].matCode,
|
|
|
|
|
matName: clickItem.value[0].matName,
|
|
|
|
|
whId:clickItem.value[0].whId,
|
|
|
|
|
rgId:clickItem.value[0].rgId,
|
|
|
|
|
pnId:clickItem.value[0].pnId,
|
|
|
|
|
rgName:clickItem.value[0].rgName,
|
|
|
|
|
pnName:clickItem.value[0].pnName,
|
|
|
|
|
matRest:clickItem.value[0].matRest
|
|
|
|
|
}
|
|
|
|
|
emit('success', data)
|
|
|
|
|
|
2025-06-24 13:43:23 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/** 初始化 **/
|
|
|
|
|
onMounted(async () => {
|
2025-07-05 02:52:44 +08:00
|
|
|
|
2025-06-24 13:43:23 +08:00
|
|
|
await getList()
|
|
|
|
|
})
|
|
|
|
|
</script>
|