heli-mes/mes-ui/mes-ui-admin-vue3/src/views/heli/matreq/storageLog.vue
2025-06-26 19:05:32 +08:00

176 lines
5.3 KiB
Vue

<template>
<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.name" placeholder="物料名称" clearable @keyup.enter="handleQuery" class="!w-240px" />
</el-form-item>
<el-form-item label="规格型号" prop="matName" >
<el-input v-model="queryParams.spec" 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>
</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 label="物料编码" align="center" prop="code" fixed min-width="120" />
<el-table-column label="物料名称" align="center" prop="name" fixed min-width="120"/>
<el-table-column label="物料类型" align="center" prop="materialType" min-width="120">
<template #default="scope">
<dict-tag :type="DICT_TYPE.HELI_MATERIAL_TYPE" :value="scope.row.materialType" />
</template>
</el-table-column>
<el-table-column label="物料简称" align="center" prop="shortName" min-width="120"/>
<el-table-column label="规格/型号" align="center" prop="spec" min-width="120"/>
</el-table>
<!-- 分页 -->
<Pagination
:total="total" v-model:page="queryParams.pageNo" v-model:limit="queryParams.pageSize"
@pagination="getList" />
</ContentWrap>
</el-card>
<template #footer>
<span class="dialog-footer">
<el-button @click="dialogVisible = false">取消</el-button>
<el-button type="primary" @click="success">
确认
</el-button>
</span>
</template>
</Dialog>
</template>
<script setup lang="ts">
import {DICT_TYPE} from "@/utils/dict";
import * as MaterialApi from "@/api/heli/material";
defineOptions({ name: 'StorageLog' })
const printref = ref()
const whList = ref([])
const rgList = ref([])
const pnList = ref([])
const dialogVisible = ref(false)
const message = useMessage() // 消息弹窗
const { t } = useI18n() // 国际化
const loading = ref(true) // 列表的加载中
const list = ref([]) // 列表的数据
const total = ref(0) // 列表的总页数
const queryParams = reactive({
pageNo: 1,
pageSize: 10,
code: undefined,
name: undefined,
matType: undefined,
lotNo: undefined,
whId: undefined,
rgId:undefined,
pnId: undefined,
headerNo: undefined,
spec:undefined,
materialType:5,
status:1,
shortName:undefined
})
const queryFormRef = ref() // 搜索的表单
const currentRow = ref()
const multipleTableRef = ref()
/** 查询列表 */
const getList = async () => {
loading.value = true
try {
const data = await MaterialApi.getbzjList(queryParams) ;
list.value = data.list
total.value = data.total
} finally {
loading.value = false
}
}
const clickItem = ref([])
const handleCurrentChange = (val) => {
clickItem.value = val;
if(val.length > 1){
multipleTableRef.value!.clearSelection()
multipleTableRef.value!.toggleRowSelection(val.pop())
}
};
const clickRow = (row) => {
if (clickItem.value==null){
clickItem.value = [];
}
// 单选选中行
if ( clickItem.value[0] == row) {
// 取消
clickItem.value = [];
multipleTableRef.value!.clearSelection()
} else {
// 选择
clickItem.value.push(row);
multipleTableRef.value!.clearSelection()
multipleTableRef.value!.toggleRowSelection(row, true);
}
}
/** 搜索按钮操作 */
const handleQuery = () => {
queryParams.pageNo = 1
getList()
}
/** 重置按钮操作 */
const resetQuery = () => {
queryFormRef.value.resetFields()
handleQuery()
}
const rowid = ref()
const open = async (rowids) => {
clickItem.value = null;
//multipleTableRef.value!.clearSelection()
dialogVisible.value = true
// queryParams.matName = matCode;
rowid.value = rowids
console.log(rowids)
console.log(rowid.value)
await getList();
}
defineExpose({ open }) // 提供 open 方法,用于打开弹窗
const emit = defineEmits(['success'])
// emit('success', multipleSelection.value)
const success = () => {
dialogVisible.value = false;
emit('success', rowid.value, clickItem.value[0].id, clickItem.value[0].code)
}
/** 初始化 **/
onMounted(async () => {
await getList()
})
</script>