345 lines
13 KiB
Vue
345 lines
13 KiB
Vue
<!--
|
|
* @Descripttion: (库存盘点)
|
|
* @Author: (admin)
|
|
* @Date: (2024-11-16)
|
|
-->
|
|
<template>
|
|
<div>
|
|
<el-form :model="queryParams" label-position="right" inline ref="queryRef" v-show="showSearch" @submit.prevent>
|
|
<el-form-item label="线别" prop="lineCode">
|
|
<el-select v-model="queryParams.lineCode" placeholder="全部">
|
|
<el-option label="全部" value="" />
|
|
<el-option v-for="(item, index) in allRouteOptions" :key="index" :label="item.label" :value="item.value" />
|
|
</el-select>
|
|
</el-form-item>
|
|
<el-form-item>
|
|
<el-button icon="search" type="primary" @click="handleQuery">{{ $t('btn.search') }}</el-button>
|
|
<el-button icon="refresh" @click="resetQuery">{{ $t('btn.reset') }}</el-button>
|
|
</el-form-item>
|
|
</el-form>
|
|
<!-- 工具区域 -->
|
|
<el-row :gutter="15" class="mb10">
|
|
<el-col :span="1.5">
|
|
<el-button type="warning" icon="MessageBox" @click="handleAdd"> 仓库盘点 </el-button>
|
|
</el-col>
|
|
<el-col :span="1.5">
|
|
<el-button type="info" icon="download" @click="handleAdd"> 导出盘点清单 </el-button>
|
|
</el-col>
|
|
<el-col :span="1.5">
|
|
<el-button type="success" icon="Check" :disabled="!multiple" @click="handleDoCorrecting"> 批量盘点确认 </el-button>
|
|
</el-col>
|
|
<right-toolbar v-model:showSearch="showSearch" @queryTable="getList" :columns="columns"></right-toolbar>
|
|
</el-row>
|
|
|
|
<el-table
|
|
:data="dataList"
|
|
@selection-change="handleSelectionChange"
|
|
v-loading="loading"
|
|
ref="table"
|
|
border
|
|
header-cell-class-name="el-table-header-cell"
|
|
highlight-current-row
|
|
@sort-change="sortChange"
|
|
>
|
|
<el-table-column type="selection" align="center" width="55" />
|
|
<el-table-column prop="id" label="雪花id" align="center" :show-overflow-tooltip="true" v-if="columns.showColumn('id')" />
|
|
<el-table-column prop="lineCode" label="线别" align="center" :show-overflow-tooltip="true" v-if="columns.showColumn('lineCode')" />
|
|
<el-table-column prop="lineName" label="产线名称" align="center" :show-overflow-tooltip="true" v-if="columns.showColumn('lineName')" />
|
|
<el-table-column prop="materialCode" label="物料编号" align="center" :show-overflow-tooltip="true" v-if="columns.showColumn('materialCode')" />
|
|
<el-table-column prop="materialName" label="物料名称" align="center" :show-overflow-tooltip="true" v-if="columns.showColumn('materialName')" />
|
|
<el-table-column prop="logicQuantity" label="库存数" align="center" v-if="columns.showColumn('logicQuantity')" />
|
|
<el-table-column prop="actualQuantity" label="盘点数" align="center" v-if="columns.showColumn('actualQuantity')" />
|
|
<el-table-column prop="isCorrecting" label="是否校正" align="center">
|
|
<template #default="scope">
|
|
<el-tag v-if="scope.row.isCorrecting == 1" type="success">是</el-tag>
|
|
<el-tag v-else type="danger">否</el-tag>
|
|
</template>
|
|
</el-table-column>
|
|
<el-table-column prop="remark" label="备注" align="center" :show-overflow-tooltip="true" v-if="columns.showColumn('remark')" />
|
|
<el-table-column prop="createdBy" label="创建人" align="center" :show-overflow-tooltip="true" v-if="columns.showColumn('createdBy')" />
|
|
<el-table-column prop="createdTime" label="创建时间" :show-overflow-tooltip="true" v-if="columns.showColumn('createdTime')" />
|
|
<el-table-column prop="updatedBy" label="更新人" align="center" :show-overflow-tooltip="true" v-if="columns.showColumn('updatedBy')" />
|
|
<el-table-column prop="updatedTime" label="更新时间" :show-overflow-tooltip="true" v-if="columns.showColumn('updatedTime')" />
|
|
<el-table-column label="操作" width="240">
|
|
<template #default="scope">
|
|
<el-button type="success" size="small" icon="Edit" @click="handleUpdate(scope.row)">信息修改</el-button>
|
|
<el-button type="warning" size="small" icon="Check" @click="handleDoCorrecting(scope.row)">确认盘点</el-button>
|
|
<!-- <el-button type="danger" size="small" icon="delete" title="删除" @click="handleDelete(scope.row)"></el-button> -->
|
|
</template>
|
|
</el-table-column>
|
|
</el-table>
|
|
<pagination :total="total" v-model:page="queryParams.pageNum" v-model:limit="queryParams.pageSize" @pagination="getList" />
|
|
|
|
<!-- 添加或修改线边库库存对话框 -->
|
|
<el-dialog :title="title" :lock-scroll="false" v-model="open">
|
|
<el-form ref="formRef" :model="form" :rules="rules" label-width="100px">
|
|
<el-row :gutter="20">
|
|
<el-col :lg="12">
|
|
<el-form-item label="线别" prop="lineCode">
|
|
<el-input readonly v-model="form.lineCode" placeholder="请输入产线编号" />
|
|
</el-form-item>
|
|
</el-col>
|
|
<el-col :lg="12">
|
|
<el-form-item label="物料编号" prop="materialCode">
|
|
<el-input readonly v-model="form.materialCode" placeholder="请输入物料编号" />
|
|
</el-form-item>
|
|
</el-col>
|
|
|
|
<el-col :lg="12">
|
|
<el-form-item label="物料名称" prop="materialName">
|
|
<el-input readonly v-model="form.materialName" placeholder="请输入物料名称" />
|
|
</el-form-item>
|
|
</el-col>
|
|
|
|
<el-col :lg="12">
|
|
<el-form-item label="库存数" prop="logicQuantity">
|
|
<el-input readonly v-model="form.logicQuantity" placeholder="请输入理论数量" />
|
|
</el-form-item>
|
|
</el-col>
|
|
|
|
<el-col :lg="12">
|
|
<el-form-item label="盘点数" prop="actualQuantity">
|
|
<el-input v-model="form.actualQuantity" placeholder="请输入盘点数量" />
|
|
</el-form-item>
|
|
</el-col>
|
|
|
|
<el-col :lg="24">
|
|
<el-form-item label="备注" prop="remark">
|
|
<el-input type="textarea" v-model="form.remark" placeholder="请输入备注" />
|
|
</el-form-item>
|
|
</el-col>
|
|
</el-row>
|
|
</el-form>
|
|
<template #footer v-if="opertype != 3">
|
|
<el-button text @click="cancel">{{ $t('btn.cancel') }}</el-button>
|
|
<el-button type="primary" @click="submitForm">{{ $t('btn.submit') }}</el-button>
|
|
</template>
|
|
</el-dialog>
|
|
</div>
|
|
</template>
|
|
|
|
<script setup name="mmlinesidebarinventory">
|
|
import { listMmLinesidebarInventoryCheck, getMmLinesidebarInventoryCheckDetail, updateMmLinesidebarInventoryCheck, doCorrecting } from '@/api/materialManagement/mmlinesidebarinventorycheck.js'
|
|
const { proxy } = getCurrentInstance()
|
|
|
|
const loading = ref(false)
|
|
const showSearch = ref(true)
|
|
const queryParams = reactive({
|
|
pageNum: 1,
|
|
pageSize: 10,
|
|
sort: '',
|
|
sortType: 'asc'
|
|
})
|
|
const columns = ref([
|
|
{ visible: false, prop: 'id', label: '雪花id' },
|
|
{ visible: true, prop: 'lineCode', label: '产线编号' },
|
|
{ visible: false, prop: 'lineName', label: '产线名称' },
|
|
{ visible: true, prop: 'materialCode', label: '物料编号' },
|
|
{ visible: true, prop: 'materialName', label: '物料名称' },
|
|
{ visible: true, prop: 'logicQuantity', label: '理论数量' },
|
|
{ visible: true, prop: 'actualQuantity', label: '实际库存' },
|
|
{ visible: true, prop: 'remark', label: '备注' },
|
|
{ visible: false, prop: 'createdBy', label: '创建人' },
|
|
{ visible: false, prop: 'createdTime', label: '创建时间' },
|
|
{ visible: false, prop: 'updatedBy', label: '更新人' },
|
|
{ visible: false, prop: 'updatedTime', label: '更新时间' }
|
|
])
|
|
const total = ref(0)
|
|
const dataList = ref([])
|
|
const queryRef = ref()
|
|
const defaultTime = ref([new Date(2000, 1, 1, 0, 0, 0), new Date(2000, 2, 1, 23, 59, 59)])
|
|
|
|
var dictParams = []
|
|
// =========== 获取所有线别 ==========
|
|
import { GetAllRoute } from '@/api/productManagement/proworkorder.js'
|
|
const allRouteOptions = ref([])
|
|
function getAllRouteOptions() {
|
|
GetAllRoute().then((res) => {
|
|
if (res.code === 200) {
|
|
allRouteOptions.value = res.data.map((item) => {
|
|
return {
|
|
id: item.id,
|
|
label: `${item.code}-${item.name}`,
|
|
value: `${item.code}`
|
|
}
|
|
})
|
|
}
|
|
})
|
|
}
|
|
getAllRouteOptions()
|
|
// ==================================
|
|
function getList() {
|
|
loading.value = true
|
|
listMmLinesidebarInventoryCheck(queryParams).then((res) => {
|
|
const { code, data } = res
|
|
if (code == 200) {
|
|
dataList.value = data.result
|
|
total.value = data.totalNum
|
|
loading.value = false
|
|
}
|
|
})
|
|
}
|
|
/// =========================== 处理多选 ==========================
|
|
const ids = ref([])
|
|
const idsStr = computed(() => {
|
|
return ids.value.join(',')
|
|
})
|
|
const multipleSelection = ref([])
|
|
const handleSelectionChange = (val) => {
|
|
if (val.length > 0) {
|
|
multiple.value = true
|
|
} else {
|
|
multiple.value = false
|
|
}
|
|
multipleSelection.value = val
|
|
ids.value = multipleSelection.value.map((item) => item.id)
|
|
}
|
|
/// ================================================================
|
|
// 查询
|
|
function handleQuery() {
|
|
queryParams.pageNum = 1
|
|
getList()
|
|
}
|
|
|
|
// 重置查询操作
|
|
function resetQuery() {
|
|
proxy.resetForm('queryRef')
|
|
handleQuery()
|
|
}
|
|
// 自定义排序
|
|
function sortChange(column) {
|
|
var sort = undefined
|
|
var sortType = undefined
|
|
|
|
if (column.prop != null && column.order != null) {
|
|
sort = column.prop
|
|
sortType = column.order
|
|
}
|
|
queryParams.sort = sort
|
|
queryParams.sortType = sortType
|
|
handleQuery()
|
|
}
|
|
|
|
/*************** form操作 ***************/
|
|
const formRef = ref()
|
|
const title = ref('')
|
|
// 操作类型 1、add 2、edit 3、view
|
|
const opertype = ref(0)
|
|
const open = ref(false)
|
|
const state = reactive({
|
|
single: true,
|
|
multiple: true,
|
|
form: {},
|
|
rules: {
|
|
actualQuantity: [{ required: true, message: '盘点数不能为空', trigger: 'blur' }]
|
|
},
|
|
options: {}
|
|
})
|
|
|
|
const { form, rules, options, single, multiple } = toRefs(state)
|
|
|
|
// 关闭dialog
|
|
function cancel() {
|
|
open.value = false
|
|
reset()
|
|
}
|
|
|
|
// 重置表单
|
|
function reset() {
|
|
form.value = {
|
|
id: null,
|
|
lineCode: null,
|
|
lineName: null,
|
|
materialCode: null,
|
|
materialName: null,
|
|
logicQuantity: null,
|
|
actualQuantity: null,
|
|
createdBy: null,
|
|
createdTime: null,
|
|
updatedBy: null,
|
|
updatedTime: null
|
|
}
|
|
proxy.resetForm('formRef')
|
|
}
|
|
// 添加按钮操作
|
|
function handleAdd() {
|
|
reset()
|
|
open.value = true
|
|
title.value = ''
|
|
opertype.value = 1
|
|
}
|
|
// 修改按钮操作
|
|
function handleUpdate(row) {
|
|
reset()
|
|
const id = row.id
|
|
getMmLinesidebarInventoryCheckDetail({ id }).then((res) => {
|
|
const { code, data } = res
|
|
if (code == 200) {
|
|
open.value = true
|
|
title.value = '修改盘点数据'
|
|
opertype.value = 2
|
|
form.value = {
|
|
...data
|
|
}
|
|
}
|
|
})
|
|
}
|
|
// 确认矫正按钮操作
|
|
function handleDoCorrecting(row) {
|
|
proxy
|
|
.$confirm('是否确认校正仓库零件数?', '提示', {
|
|
confirmButtonText: '确定',
|
|
cancelButtonText: '取消',
|
|
type: 'warning'
|
|
})
|
|
.then(() => {
|
|
const id = row.id || idsStr.value
|
|
doCorrecting({ ids: id }).then((res) => {
|
|
const { code, data } = res
|
|
if (code == 200) {
|
|
proxy.$message.success('校正成功')
|
|
getList()
|
|
}
|
|
})
|
|
})
|
|
}
|
|
|
|
// 添加&修改 表单提交
|
|
function submitForm() {
|
|
proxy.$refs['formRef'].validate((valid) => {
|
|
if (valid) {
|
|
if (form.value.id != undefined && opertype.value === 2) {
|
|
updateMmLinesidebarInventoryCheck(form.value).then((res) => {
|
|
proxy.$modal.msgSuccess('修改成功')
|
|
open.value = false
|
|
getList()
|
|
})
|
|
} else {
|
|
// addMmLinesidebarInventory(form.value).then((res) => {
|
|
// proxy.$modal.msgSuccess('新增成功')
|
|
// open.value = false
|
|
// getList()
|
|
// })
|
|
}
|
|
}
|
|
})
|
|
}
|
|
|
|
// 删除按钮操作
|
|
function handleDelete(row) {
|
|
const Ids = row.id || ids.value
|
|
|
|
// proxy
|
|
// .$confirm('是否确认删除参数编号为"' + Ids + '"的数据项?')
|
|
// .then(function () {
|
|
// return delMmLinesidebarInventory(Ids)
|
|
// })
|
|
// .then(() => {
|
|
// getList()
|
|
// proxy.$modal.msgSuccess('删除成功')
|
|
// })
|
|
}
|
|
|
|
handleQuery()
|
|
</script>
|