heli-mes/mes-ui/mes-ui-admin-vue3/src/views/heli/storagelog/supplementManagement.vue
2025-06-25 19:09:52 +08:00

198 lines
6.0 KiB
Vue

<template>
<el-card class="hl-card">
<template #header>
<span>库存补充管理</span>
</template>
<ContentWrap class="borderxx">
<!-- 搜索工作栏 -->
<el-form class="-mb-15px" :model="queryParams" ref="queryFormRef" :inline="true" label-width="130px">
<el-form-item label="制单日期" prop="startTime">
<el-date-picker
v-model="queryParams.matPlanDate"
value-format="YYYY-MM-DD HH:mm:ss"
type="daterange"
start-placeholder="开始日期"
end-placeholder="结束日期"
class="!w-280px"
/>
</el-form-item>
<el-form-item label="需求计划单号" prop="projectMaterialPlanNo">
<el-input v-model="queryParams.projectMaterialPlanNo" placeholder="需求计划单号" clearable @keyup.enter="handleQuery"
class="!w-240px" />
</el-form-item>
<el-form-item label="物料名称" prop="materialName">
<el-input v-model="queryParams.materialName" placeholder="请输入物料名称" clearable @keyup.enter="handleQuery" class="!w-240px" />
</el-form-item>
<el-form-item style="margin-left:15px">
<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 v-loading="loading" :data="list" :stripe="true" :show-overflow-tooltip="true" class="hl-table">
<el-table-column label="序号" type="index" align="center" fixed min-width="70px" />
<el-table-column label="物料需求计划单号" align="center" prop="projectMaterialPlanNo" min-width="180" fixed>
<template #default="scope">
<el-button text type="primary" @click="openForm('detail', scope.row.id)">
{{ scope.row.projectMaterialPlanNo }}
</el-button>
</template>
</el-table-column>
<el-table-column label="制单日期" align="center" prop="matPlanDate" :formatter="dateFormatter1" min-width="150" />
<el-table-column label="制单人" align="center" prop="creator" width="150">
<template #default="scope">
{{ userInit.find((user) => user.id == scope.row.creator)?.nickname }}
</template>
</el-table-column>
<el-table-column label="需求计划类型" align="center" prop="matType" min-width="150">
<template #default="scope">
<dict-tag :type="DICT_TYPE.HELI_MAT_TYPE" :value="scope.row.matType" />
</template>
</el-table-column>
<el-table-column label="操作" align="center" fixed="right" min-width="180">
<template #default="scope">
<el-button
link
type="danger"
@click="handleDelete(scope.row.id)"
>
删除
</el-button>
<el-button link type="primary" @click="openForm('detail', scope.row.id)">
详情信息
</el-button>
</template>
</el-table-column>
</el-table>
<!-- 分页 -->
<Pagination :total="total" v-model:page="queryParams.pageNo" v-model:limit="queryParams.pageSize"
@pagination="getList" />
</ContentWrap>
</el-card>
</template>
<script setup lang="ts">
import { DICT_TYPE } from '@/utils/dict'
import { dateFormatter1} from '@/utils/formatTime'
import * as MaterialPlanApi from '@/api/heli/materialplan'
import * as UserApi from '@/api/system/user'
import dayjs from "dayjs";
import {delMaterial} from "@/api/heli/materialplan";
defineOptions({ name: 'MaterialPlan' })
const router = useRouter()
const message = useMessage() // 消息弹窗
const { t } = useI18n() // 国际化
const loading = ref(true) // 列表的加载中
const list = ref([]) // 列表的数据
const total = ref(0) // 列表的总页数
const queryParams = reactive({
pageNo: 1,
pageSize: 10,
id: undefined,
projectMaterialPlanNo: undefined,
projectId: undefined,
projectPlanId: undefined,
submitUserId: undefined,
projectName: undefined,
projectSubName: undefined,
materialName:undefined,
submitTime: [],
auditor: undefined,
auditTime: [],
status: undefined,
description: undefined,
createTime: [],
matType:2,
matPlanDate:undefined,
})
const queryFormRef = ref() // 搜索的表单
const exportLoading = ref(false) // 导出的加载中
/** 查询列表 */
const getList = async () => {
loading.value = true
try {
const data = await MaterialPlanApi.getMaterialPlanPages(queryParams)
list.value = data.list
total.value = data.total
} finally {
loading.value = false
}
}
/** 搜索按钮操作 */
const handleQuery = () => {
queryParams.pageNo = 1
getList()
}
/** 重置按钮操作 */
const resetQuery = () => {
queryFormRef.value.resetFields()
handleQuery()
}
/** 添加/修改操作 */
const openForm = (type: string, id?: number) => {
switch (type) {
case 'create':
router.push({ path: '/purchase/materialplanadd', query: { id: id } })
break;
case 'update':
router.push({ path: '/purchase/materialplanedit', query: { id: id } })
break;
case 'detail':
console.log("0000")
router.push({ path: '/inventory/supplemanagementdetail', query: { id: id } })
break;
default:
break;
}
}
/** 删除按钮操作 */
const handleDelete = async (id: number) => {
try {
// 删除的二次确认
await message.delConfirm()
// 发起删除
await MaterialPlanApi.delMaterial(id)
message.success(t('common.delSuccess'))
// 刷新列表
await getList()
} catch { }
}
const setDefaultDate = () => {
queryParams.matPlanDate = [
dayjs().startOf('day').format('YYYY-MM-DD HH:mm:ss'),
dayjs().endOf('day').format('YYYY-MM-DD HH:mm:ss')
]
}
const userInit = ref()
/** 初始化 **/
onMounted(async () => {
userInit.value = await UserApi.getSimpleUserList()
//用户列表数据
setDefaultDate()
getList()
})
</script>