Files
JY1.0/src/views/WarehouseManagement/Replenishment/index.vue

956 lines
38 KiB
Vue
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
<template>
<!-- 修改人:Ld 修改时间:2026-08-11 09:14:50; 为报缺补货页面增加专用作用域类,避免样式影响其他组件布局。 -->
<div class="app-container replenishment-page">
<el-card class="replenishment-card" style="height: 850px ;display:flex">
<el-col style="width: 930px">
<div style="margin-top: 7px; margin-bottom: 7px">
<el-cascader ref="cascader" :options="product" :show-all-levels="false" placeholder="产品名称" clearable size="small" @clear="clearData" @change="getData"/>
<el-input v-model="specificationsValue" style="width:200px" placeholder="名称/规格/型号" size="small" clearable @keyup.enter.native="pageCurrent=1;updateCheck()"/>
<!-- <el-button :disabled="disabled1" icon="el-icon-edit" type="primary" style="margin-left: 10px" plain size="small" @click="setUpInventory()">最低库存</el-button> -->
<el-button :disabled="disabled" type="distribution" icon="el-icon-check" size="small" @click="openOrder()">提交补货</el-button>
<!-- 修改人:Ld 修改时间:2026-08-03 16:35:25; 新增关联合同补货入口,原提交补货按钮不变。 -->
<el-button :disabled="disabled" type="warning" plain icon="el-icon-connection" size="small" @click="openLinkedOrder()">关联合同补货</el-button>
<el-checkbox v-model="checked" style="margin-left: 40px" @change="updateCheck">自制补货</el-checkbox>
<el-badge :value="numberReturnedItems" class="item">
<el-button type="text" size="small" style="margin-left: 70px" @click="viewReturnedContracts()">打回通知</el-button>
</el-badge>
</div>
<div >
<el-table
v-loading="loading"
ref="table"
:data="tableData"
:row-class-name="tableRowClassName"
:summary-method="getSummaries"
highlight-current-row
show-summary
border
size="small"
height="740px"
@sort-change="sortChange"
@row-click="updateStock">
<el-table-column :width="setColumnWidth('序号')" style="width: 55px;" label="选入" align="center">
<template slot-scope="scope">
<el-button type="text" size="mini" @click="selectIn(scope.row)"><svg-icon icon-class="右箭头" style="width: 20px;height: 20px"/></el-button>
</template>
</el-table-column>
<el-table-column :width="setColumnWidth('类型')" label="类型" align="center" show-overflow-tooltip>
<template slot-scope="scope">
{{ scope.row.补货类型 }}
</template>
</el-table-column>
<el-table-column width="130px" label="名称" align="center" prop="物料名称" sortable="物料名称" show-overflow-tooltip>
<template slot-scope="scope">
{{ scope.row.物料名称 }}
</template>
</el-table-column>
<el-table-column width="120px" label="图号或型号" align="center" prop="图号或型号" sortable="图号或型号" show-overflow-tooltip>
<template slot-scope="scope">
{{ scope.row.图号或型号 }}
</template>
</el-table-column>
<el-table-column :width="setColumnWidth('单位')" label="单位" align="center">
<template slot-scope="scope">
{{ scope.row.单位 }}
</template>
</el-table-column>
<el-table-column :width="setColumnWidth('数量')" label="库存" align="center" prop="库存" sortable="库存">
<template slot-scope="scope">
{{ scope.row.库存 }}
</template>
</el-table-column>
<el-table-column width="85px" label="补货中" align="center" prop="补货中" sortable="补货中">
<template slot-scope="scope">
{{ scope.row.补货中 }}
</template>
</el-table-column>
<el-table-column width="85px" label="需求量" align="center" prop="需求量" sortable="需求量">
<template slot-scope="scope">
<el-popover
placement="bottom"
width="400"
trigger="click"
@show="getDemandDetail(scope.row)">
<!-- 修改人:Ld 修改时间:2026-08-03 16:44:10; 调整属性顺序以通过单文件模板校验。 -->
<el-table v-loading="demandDetailLoading" :data="demandDetailData" border stripe size="mini" max-height="300">
<el-table-column prop="订单编号" label="订单号" align="center" show-overflow-tooltip/>
<el-table-column prop="最终需求量" label="需求量" align="center"/>
<el-table-column prop="简称" label="客户" align="center"/>
</el-table>
<span slot="reference" style="cursor: pointer; color: #409EFF; text-decoration: underline;">{{ scope.row.需求量 }}</span>
</el-popover>
</template>
</el-table-column>
<el-table-column width="85px" label="可用库存" align="center">
<template slot-scope="scope">
{{ (Number(scope.row.库存) || 0) - (Number(scope.row.需求量) || 0) }}
</template>
</el-table-column>
<el-table-column width="73px" label="最高库存" align="center" prop="最高库存">
<template slot-scope="scope">
{{ scope.row.最高库存 }}
</template>
</el-table-column>
<el-table-column width="73px" label="安全库存" align="center" prop="安全库存">
<template slot-scope="scope">
{{ scope.row.安全库存 }}
</template>
</el-table-column>
<el-table-column width="73px" label="最低库存" align="center" prop="最低库存">
<template slot-scope="scope">
<span
:class="{
'red': Number(scope.row.最低库存) === 1,
'yellow': Number(scope.row.最低库存) === 2
}">{{ scope.row.最低库存 }}</span>
</template>
</el-table-column>
<el-table-column label="补货数" width="130px" align="center" prop="补货数" fixed="right">
<template slot-scope="scope">
<el-input-number v-model="scope.row.补货数" :min="1" size="mini" style="margin: 0;width: 100%"/>
</template>
</el-table-column>
</el-table>
<div class="block" style="margin-top: 10px;">
<el-pagination
:current-page="pageCurrent"
:page-sizes="[10, 20, 30, 40, 100]"
:page-size="pageSize"
:total="total"
layout="total, sizes, prev, pager, next, jumper"
@size-change="handleSizeChanges"
@current-change="handleCurrentChanges"/>
</div>
</div>
</el-col>
<el-col style="width: 720px;margin-left: 30px">
<div style="margin-top: 7px">
<p v-if="!checked" style="margin-bottom: 0px;margin-left: 270px; font-size: 20px;font-weight:bold">外购件补货单</p>
<p v-if="checked" style="margin-bottom: 0px;margin-left: 270px;color: #919ae9;font-size: 20px;font-weight:bold">自制件补货单</p>
<el-table
v-loading="loading1"
ref="table1"
:data="tableData1"
:header-cell-style="{background: '#2283D4',color: 'white'}"
highlight-current-row
show-summary
border
stripe
size="small"
style="width: 661px"
height="740px">
<el-table-column :width="setColumnWidth('序号')" label="选出" align="center">
<template slot-scope="scope">
<el-button type="text" size="mini" @click="deleteProduct(scope.row)"><svg-icon icon-class="箭头2" class="is-rotate" style="width: 20px;height: 20px"/></el-button>
</template>
</el-table-column>
<el-table-column width="180px" label="名称" align="center" show-overflow-tooltip>
<template slot-scope="scope">
{{ scope.row.名称 }}
</template>
</el-table-column>
<el-table-column width="120px" label="图号或型号" align="center" show-overflow-tooltip>
<template slot-scope="scope">
{{ scope.row.代号 }}
</template>
</el-table-column>
<el-table-column :width="setColumnWidth('单位')" label="单位" align="center">
<template slot-scope="scope">
{{ scope.row.单位 }}
</template>
</el-table-column>
<el-table-column :width="setColumnWidth('补货数量')" label="补货数量" align="center" prop="补货数量">
<template slot-scope="scope">
{{ scope.row.补货数量 }}
</template>
</el-table-column>
<el-table-column label="操作" align="center" width="50">
<template slot-scope="scope">
<el-tooltip :open-delay="700" effect="dark" content="上传照片" placement="top">
<el-button type="text" icon="el-icon-picture-outline" size="mini" @click="handlePicture(scope.row)"/>
</el-tooltip>
</template>
</el-table-column>
<el-table-column :width="setColumnWidth('类型')" label="类型" align="center">
<template slot-scope="scope">
{{ scope.row.类型 }}
</template>
</el-table-column>
</el-table>
</div>
</el-col>
</el-card>
<el-dialog v-el-drag-dialog :visible.sync="dialogFormVisible" title="最低库存" center width="300px">
<el-form ref="form" :model="form">
<el-form-item prop="最低库存">
<el-input-number v-model="form.最低库存" :min="0" :step="1" size="small" clearable style="width:200px;margin-left: 25px"/>
</el-form-item>
</el-form>
<div slot="footer" class="dialog-footer">
<el-button @click="callOff()">取 消</el-button>
<el-button type="primary" @click="submitStock()">确 定</el-button>
</div>
</el-dialog>
<el-dialog v-el-drag-dialog :visible.sync="dialogFormVisible1" title="补货期限" center width="300px">
<el-date-picker
v-model="finishTime"
size="small"
align="center"
style="width: 100%"
value-format="yyyy-MM-dd"
format="yyyy-MM-dd"
placeholder="选择日期"/>
<el-input
:rows="3"
v-model="orderRemarks"
style="margin-top: 30px"
type="textarea"
placeholder="请输入订单备注!"/>
<div slot="footer" class="dialog-footer">
<el-button @click="callOff()">取 消</el-button>
<el-button type="primary" @click="submitOrder()">确 定</el-button>
</div>
</el-dialog>
<!-- 修改人:Ld 修改时间:2026-08-03 16:35:25; 新增合同缺件/仓库备货补货来源弹窗。 -->
<el-dialog v-el-drag-dialog :visible.sync="dialogFormVisibleLink" title="关联合同补货" center width="760px">
<el-form label-position="right" label-width="95px" size="small">
<el-form-item label="补货来源">
<el-radio-group v-model="linkForm.来源类型" @change="changeLinkSource">
<el-radio-button label="合同缺件">合同零件不足</el-radio-button>
<el-radio-button label="仓库备货">仓库备货</el-radio-button>
</el-radio-group>
</el-form-item>
<el-form-item v-if="linkForm.来源类型 === '合同缺件'" label="合同查询">
<el-input v-model="linkForm.关键字" clearable placeholder="合同编号 / 客户 / 订单编号" style="width: 360px" @keyup.enter.native="searchLinkContract"/>
<el-button type="primary" plain icon="el-icon-search" style="margin-left: 8px" @click="searchLinkContract">查询</el-button>
</el-form-item>
<el-form-item v-if="linkForm.来源类型 === '合同缺件'" label="查询结果">
<el-table
v-loading="linkContractLoading"
:data="linkContractList"
border
highlight-current-row
size="mini"
max-height="220"
style="width: 620px"
@row-click="selectLinkContract">
<el-table-column width="130px" label="合同编号" align="center" show-overflow-tooltip>
<template slot-scope="scope">
{{ scope.row.合同编号 }}
</template>
</el-table-column>
<el-table-column width="150px" label="客户" align="center" show-overflow-tooltip>
<template slot-scope="scope">
{{ scope.row.客户名称 || scope.row.客户简称 }}
</template>
</el-table-column>
<el-table-column width="150px" label="订单编号" align="center" show-overflow-tooltip>
<template slot-scope="scope">
{{ scope.row.订单编号 }}
</template>
</el-table-column>
<el-table-column label="交货日期" align="center">
<template slot-scope="scope">
{{ scope.row.交货日期 }}
</template>
</el-table-column>
</el-table>
</el-form-item>
<el-form-item v-if="linkForm.来源类型 === '合同缺件'" label="已选择">
<el-tag v-if="linkForm.项目流水号" type="success">
{{ linkForm.合同编号 }} / {{ linkForm.客户名称 }} / {{ linkForm.订单编号 || '未选订单' }}
</el-tag>
<span v-else style="color: #909399">请选择要关联的销售合同或订单</span>
</el-form-item>
<el-form-item v-if="linkForm.来源类型 === '仓库备货'" label="备货合同">
<!-- 修改人:Ld 修改时间:2026-08-04 08:29:13; 仓库备货改为提交时自动生成CKBH前缀合同。 -->
<el-tag type="warning">自动生成CKBH合同</el-tag>
<span style="margin-left: 10px;color: #909399">提交后生成独立仓库备货合同,收货人为仓库、单价为0</span>
</el-form-item>
<el-form-item label="补货期限">
<el-date-picker
v-model="linkForm.补货期限"
value-format="yyyy-MM-dd"
format="yyyy-MM-dd"
placeholder="选择日期"
style="width: 220px"/>
</el-form-item>
<el-form-item label="订单备注">
<el-input
:rows="3"
v-model="linkForm.订单备注"
type="textarea"
placeholder="请输入补货原因或备货说明"
style="width: 520px"/>
</el-form-item>
</el-form>
<div slot="footer" class="dialog-footer">
<el-button :disabled="linkSubmitting" size="small" @click="dialogFormVisibleLink=false">取 消</el-button>
<!-- 修改人:Ld 修改时间:2026-08-11 09:42:28; 关联合同补货提交期间禁用确认按钮,避免重复点击生成多张订单。 -->
<el-button :loading="linkSubmitting" :disabled="linkSubmitting" type="primary" size="small" @click="submitLinkedOrder">确 定</el-button>
</div>
</el-dialog>
<el-dialog v-el-drag-dialog :visible.sync="dialogFormVisible2" title="上传图片" center style="height: 800px" width="30%">
<el-upload
id="invoiceScan"
ref="upload"
:multiple="true"
:auto-upload="false"
:on-success="uploadSuccess"
:before-upload="beforeUpload"
:on-exceed="warningExceed"
:limit="limit"
:data="Data"
:action="upload"
style="margin-left: 60px"
list-type="picture-card">
<i class="el-icon-plus"/>
</el-upload>
<div slot="footer" class="dialog-footer">
<el-button @click="dialogFormVisible2=false">取消</el-button>
<el-button type="primary" style="width: 70px" @click="submitPicture()">确定</el-button>
</div>
</el-dialog>
<el-dialog v-el-drag-dialog :visible.sync="dialogFormVisibleReturnContract" center width="1120px">
<div style="width: 100%;overflow: hidden">
<el-table
:data="tableData100"
:header-cell-style="{background: '#383E4B',color: 'white'}"
highlight-current-row
border
stripe
size="mini"
style="width: 1090px;margin-top: 10px;"
height="440px">
<el-table-column width="80px" label="序号" type="index" align="center"/>
<el-table-column width="150px" label="订单编号" show-overflow-tooltip align="center">
<template slot-scope="scope">
{{ scope.row.订单编号 }}
</template>
</el-table-column>
<el-table-column width="150px" label="名称" show-overflow-tooltip align="center">
<template slot-scope="scope">
{{ scope.row.名称 }}
</template>
</el-table-column>
<el-table-column width="180px" label="图号或型号" show-overflow-tooltip align="center">
<template slot-scope="scope">
{{ scope.row.图号或型号 }}
</template>
</el-table-column>
<el-table-column :width="setColumnWidth('数量')" label="补货数量" align="center">
<template slot-scope="scope">
{{ scope.row.补货数量 }}
</template>
</el-table-column>
<el-table-column width="200px" label="打回原因" align="center" show-overflow-tooltip>
<template slot-scope="scope">
{{ scope.row.打回原因 }}
</template>
</el-table-column>
<el-table-column :width="setColumnWidth('姓名')" label="打回人" align="center">
<template slot-scope="scope">
{{ scope.row.姓名 }}
</template>
</el-table-column>
<el-table-column label="打回日期" align="center">
<template slot-scope="scope">
{{ scope.row.打回日期 }}
</template>
</el-table-column>
</el-table>
</div>
</el-dialog>
</div>
</template>
<script>
import { mapGetters } from 'vuex'
import { url } from '@/utils/request'
export default {
data() {
return {
tableData100: [],
numberReturnedItems: '',
orderRemarks: '',
checked: false,
showInput: false,
disabled: true,
disabled1: true,
stockValue: '', // 累计库存流水号
number: '',
specificationsValue: '', // 规格型号
loading: false, // 数据加载
loading1: false, // 数据加载
dialogFormVisible: false,
dialogFormVisible2: false,
dialogFormVisibleReturnContract: false,
form: {
最低库存: ''
},
product: [], // 产品名称数组
productValue: '',
finishTime: '',
limit: 5,
Data: {},
upload: url,
dialogFormVisible1: false,
total: 0, // 分页总数
tableData: [],
tableData1: [],
pageCurrent: 1, // 分页当前页
pageSize: 20, // 分页每页显示条数
orderName: '', // 排序列名
order: '', // 排序方式
// 修改人:Ld 修改时间:2026-08-03 16:35:25; 关联合同补货弹窗数据,独立于原补货提交。
dialogFormVisibleLink: false,
linkContractLoading: false,
linkSubmitting: false, // 修改人:Ld 修改时间:2026-08-11 09:42:28; 关联合同补货提交中状态,用于防止重复提交。
linkContractList: [],
linkForm: {
来源类型: '合同缺件',
关键字: '',
项目流水号: '',
订单流水号: '',
合同编号: '',
客户名称: '',
订单编号: '',
补货期限: '',
订单备注: ''
},
demandDetailData: [],
demandDetailLoading: false
}
},
computed: {
...mapGetters([
'id',
'token'
])
},
updated() {
this.$nextTick(() => {
this.$refs['table'].doLayout()
this.$refs['table1'].doLayout()
})
},
created() {
this.searchTable()
this.searchNumber()
this.getTreeData()
},
methods: {
getDemandDetail(row) {
this.demandDetailLoading = true
this.demandDetailData = []
var param = []
param[0] = ['物料流水号', row.物料流水号]
var Data = this.CreateData('11', '仓储管理_报缺补货_需求量明细_查询', param)
this.ExecDatabase(Data).then(response => {
this.demandDetailData = response.data.filter(item => item.最终需求量 !== 0)
this.demandDetailLoading = false
}).catch(() => {
this.demandDetailLoading = false
})
},
getData(val) {
this.pageCurrent = 1
this.productValue = val[val.length - 1]
this.updateCheck()
},
clearData() {
this.pageCurrent = 1
this.productValue = ''
this.updateCheck()
},
getTreeData() {
var param = []
param[0] = ['子节点', 0]
var Data = this.CreateData('11', '产品关系_查询节点', param)
this.ExecDatabase(Data).then(response => {
const data = response.data
this.product = this.tree(data, 0)
})
},
tree(data, pid) {
const result = []
let temp
for (let i = 0; i < data.length; i++) {
if (data[i].父节点 === pid) {
const obj = { label: data[i].节点名称, value: data[i].子节点 }
temp = this.tree(data, data[i].子节点)
if (temp.length > 0) {
obj.children = temp
}
result.push(obj)
}
}
return result
},
viewReturnedContracts() {
this.dialogFormVisibleReturnContract = true
this.searchTable100()
this.updateNumber()
},
searchTable100() {
var param = []
var Data = this.CreateData('11', '仓储管理_补货订单打回_查询', param)
this.ExecDatabase(Data).then(response => {
this.tableData100 = response.data
})
},
updateNumber() {
var param = []
var Data = this.CreateData('12', '仓储管理_补货订单打回_查看', param)
this.ExecDatabase(Data).then(response => {
this.searchNumber()
})
},
searchNumber() {
var param = []
var Data = this.CreateData('11', '仓储管理_补货订单打回_未查看数量', param)
this.ExecDatabase(Data).then(response => {
this.numberReturnedItems = response.data[0].数量
})
},
sortChange(column) {
if (column.prop === '物料名称') {
this.orderName = 1
} else if (column.prop === '图号或型号') {
this.orderName = 2
} else if (column.prop === '库存') {
this.orderName = 3
} else if (column.prop === '补货中') {
this.orderName = 4
} else if (column.prop === '需求量') {
this.orderName = 5
} else {
this.orderName = 0
}
if (column.order === 'ascending') {
this.order = 1
} else if (column.order === 'descending') { this.order = 2 } else {
this.order = ''
}
this.searchTable()
},
warningExceed() {
this.$message.error('仅可上传五张照片')
},
beforeUpload(file) { // 上传前检测
const isJPG = /^image\/.*/.test(file.type)
if (!isJPG) {
this.$message.error('只能上传图片。。')
}
return isJPG
},
uploadSuccess(res) { // 上传成功回调
this.dialogFormVisible2 = false
this.$refs.upload.clearFiles()
},
setUpInventory() {
this.dialogFormVisible = true
},
openOrder() {
this.finishTime = ''
this.dialogFormVisible1 = true
},
// 修改人:Ld 修改时间:2026-08-03 16:35:25; 打开关联合同补货弹窗,不影响原 openOrder。
openLinkedOrder() {
this.resetLinkForm()
this.dialogFormVisibleLink = true
},
// 修改人:Ld 修改时间:2026-08-03 16:35:25; 重置关联合同补货表单。
resetLinkForm() {
this.linkContractList = []
this.linkContractLoading = false
this.linkForm = {
来源类型: '合同缺件',
关键字: '',
项目流水号: '',
订单流水号: '',
合同编号: '',
客户名称: '',
订单编号: '',
补货期限: '',
订单备注: ''
}
},
// 修改人:Ld 修改时间:2026-08-03 16:35:25; 切换补货来源时清理已选择合同。
changeLinkSource() {
this.linkContractList = []
this.linkForm.关键字 = ''
this.linkForm.项目流水号 = ''
this.linkForm.订单流水号 = ''
this.linkForm.合同编号 = ''
this.linkForm.客户名称 = ''
this.linkForm.订单编号 = ''
},
// 修改人:Ld 修改时间:2026-08-03 16:35:25; 查询可关联销售合同/订单。
searchLinkContract() {
this.linkContractLoading = true
var param = []
// 修改人:Ld 修改时间:2026-08-03 17:01:30; 后端通用入口按过程参数解析,查询过程入参全部传递,避免返回 result=0。
param[0] = ['关键字', this.linkForm.关键字]
param[1] = ['合同编号', '']
param[2] = ['客户', '']
param[3] = ['订单编号', '']
var Data = this.CreateData('11', '仓储管理_补货关联合同_查询数据', param)
this.ExecDatabase(Data).then(response => {
if (response.data[0] && response.data[0].result === '0') {
this.linkContractList = []
this.$message.error('合同查询失败,请确认当前为测试环境')
} else {
this.linkContractList = response.data
}
this.linkContractLoading = false
}).catch(() => {
this.linkContractLoading = false
})
},
// 修改人:Ld 修改时间:2026-08-03 16:35:25; 选择补货要挂靠的销售合同/订单。
selectLinkContract(row) {
this.linkForm.项目流水号 = row.项目流水号
this.linkForm.订单流水号 = row.订单流水号 || ''
this.linkForm.合同编号 = row.合同编号 || ''
this.linkForm.客户名称 = row.客户名称 || row.客户简称 || ''
this.linkForm.订单编号 = row.订单编号 || ''
},
handlePicture(row) {
this.dialogFormVisible2 = true
this.replenishmentOrderId = row.补货单明细中间表流水号
// this.PersonId = row.人员编号
},
submitPicture() {
let check
this.checked ? check = 0 : check = 1
var param = []
param[0] = ['补货单明细中间表流水号', this.replenishmentOrderId]
param[1] = ['是否外购', check]
param[2] = ['文件名称', '']
param[3] = ['文件后缀', '']
param[4] = ['文件内容', null]
var Data1 = this.CreateData('15', '补货单_上传图片', param)
this.Data.param = Data1
this.$refs.upload.submit()
this.dialogFormVisible2 = false
},
submitOrder() {
if (this.finishTime) {
let check
this.checked ? check = 0 : check = 1
var param = []
param[0] = ['是否外购', check]
param[1] = ['操作者', this.id]
param[2] = ['补货期限', this.finishTime]
param[3] = ['订单备注', this.orderRemarks]
var Data = this.CreateData('12', '报缺补货_提交', param)
this.ExecDatabase(Data).then(response => {
if (response.data[0].result === '1') {
this.$message.success('提交成功')
this.dialogFormVisible1 = false
this.updateCheck()
} else {
this.$message.error('提交失败')
}
})
} else {
this.$message.warning('请选择补货期限')
}
},
// 修改人:Ld 修改时间:2026-08-03 16:35:25; 提交带合同/仓库备货来源的补货单,原 submitOrder 不变。
submitLinkedOrder() {
// 修改人:Ld 修改时间:2026-08-11 09:42:28; 请求未返回前直接拦截后续提交,避免同一补货单重复生成订单。
if (this.linkSubmitting) {
return
}
if (this.linkForm.来源类型 === '合同缺件' && !this.linkForm.项目流水号) {
this.$message.warning('请选择关联销售合同')
return
}
if (!this.linkForm.补货期限) {
this.$message.warning('请选择补货期限')
return
}
if (this.linkForm.来源类型 === '仓库备货' && !this.linkForm.订单备注) {
this.$message.warning('请填写仓库备货说明')
return
}
let check
this.checked ? check = 0 : check = 1
var param = []
param[0] = ['是否外购', check]
param[1] = ['操作者', this.id]
param[2] = ['补货期限', this.linkForm.补货期限]
param[3] = ['订单备注', this.linkForm.订单备注]
param[4] = ['来源类型', this.linkForm.来源类型]
param[5] = ['项目流水号', this.linkForm.项目流水号 || 0]
param[6] = ['订单流水号', this.linkForm.订单流水号 || 0]
var Data = this.CreateData('12', '报缺补货_提交_关联合同', param)
this.linkSubmitting = true
this.ExecDatabase(Data).then(response => {
if (response.data[0].result === '1') {
this.$message.success('提交成功')
this.dialogFormVisibleLink = false
this.updateCheck()
} else {
this.$message.error(response.data[0].message || '提交失败')
}
this.linkSubmitting = false
}).catch(() => {
this.linkSubmitting = false
})
},
selectIn(row) {
if (row.补货数 !== 0 && row.补货数 !== undefined) {
let check
this.checked ? check = 0 : check = 1
var param = []
param[0] = ['累计库存流水号', row.累计库存流水号]
param[1] = ['补货数', row.补货数]
param[2] = ['物料流水号', row.物料流水号]
param[3] = ['是否外购', check]
var Data = this.CreateData('12', '报缺补货_选入', param)
this.ExecDatabase(Data).then(response => {
if (response.data[0].result === '1') {
this.updateCheck()
this.$message.success('选入成功')
} else {
this.$message.error('选入失败')
}
})
} else {
this.$message.warning('补货数不能为0或空')
}
},
deleteProduct(row) {
let check
this.checked ? check = 0 : check = 1
var param = []
param[0] = ['补货单明细中间表流水号', row.补货单明细中间表流水号]
param[1] = ['是否外购', check]
param[2] = ['补货数量', row.补货数量]
var Data = this.CreateData('12', '报缺补货_选出', param)
this.ExecDatabase(Data).then(response => {
if (response.data[0].result === '1') {
this.updateCheck()
this.$message.success('移出成功')
} else {
this.$message.error('移出失败')
}
})
},
updateStock(row) {
this.stockValue = row.累计库存流水号
this.form.最低库存 = Number(row.最低库存)
this.disabled1 = false
},
callOff() {
this.dialogFormVisible = false
this.dialogFormVisible1 = false
},
submitStock() {
if (this.form.最低库存 !== '' && this.form.最低库存 !== undefined) {
var param = []
param[0] = ['累计库存流水号', this.stockValue]
param[1] = ['类型流水号', 1]
param[2] = ['最低库存', this.form.最低库存]
var Data = this.CreateData('12', '最低库存_编辑数据', param)
this.ExecDatabase(Data).then(response => {
if (response.data[0].result === '1') {
this.updateCheck()
this.dialogFormVisible = false
this.$message.success('编辑成功')
} else {
this.$message.error('编辑失败')
}
})
} else {
this.$message.warning('不能为空')
}
},
tableRowClassName({ row, rowIndex }) {
if (Number(row.库存预警) === 0) {
if (row.补货类型 === '外购') {
return 'Outsourcing'
}
} else if (Number(row.库存预警) === 1) {
return 'red'
} else if (Number(row.库存预警) === 2) {
return 'yellow'
}
},
updateCheck() {
if (this.checked) {
this.searchTable1()
} else {
this.searchTable()
}
this.disabled1 = true
},
searchTable() {
let specificationsValue_check, product_check
this.specificationsValue ? specificationsValue_check = 1 : specificationsValue_check = 0
this.productValue ? product_check = 1 : product_check = 0
var param = []
param[0] = ['品名', this.specificationsValue]
param[1] = ['品名_check', specificationsValue_check]
param[2] = ['产品', this.productValue]
param[3] = ['产品_check', product_check]
param[4] = ['排序名称', this.orderName]
param[5] = ['排序方式', this.order]
var Data = this.CreateData('11', '仓储管理_报缺补货_外购件_查询', param, this.pageSize, this.pageCurrent)
this.ExecDatabase(Data).then(response => {
console.log(response.data.rows, 2222)
this.tableData = response.data.rows
this.total = response.data.total
})
var param1 = []
var Data1 = this.CreateData('11', '仓储管理_外购补货中间表_查询', param1)
this.ExecDatabase(Data1).then(response => {
this.tableData1 = response.data
if (response.data.length === 0) {
this.disabled = true
} else {
this.disabled = false
}
})
},
searchTable1() {
let specificationsValue_check, product_check
this.specificationsValue ? specificationsValue_check = 1 : specificationsValue_check = 0
this.productValue ? product_check = 1 : product_check = 0
var param = []
param[0] = ['品名', this.specificationsValue]
param[1] = ['品名_check', specificationsValue_check]
param[2] = ['产品', this.productValue]
param[3] = ['产品_check', product_check]
param[4] = ['排序名称', this.orderName]
param[5] = ['排序方式', this.order]
var Data = this.CreateData('11', '仓储管理_报缺补货_外购件_查询', param, this.pageSize, this.pageCurrent)
this.ExecDatabase(Data).then(response => {
this.tableData = response.data.rows
this.total = response.data.total
})
var param1 = []
var Data1 = this.CreateData('11', '仓储管理_自制补货中间表_查询', param1)
this.ExecDatabase(Data1).then(response => {
this.tableData1 = response.data
if (response.data.length === 0) {
this.disabled = true
} else {
this.disabled = false
}
})
},
// 表格统计1
getSummaries(param) {
const { columns, data } = param
const sums = []
columns.forEach((column, index) => {
if (index === 0) {
sums[index] = '合计'
return
} else if (index === 5) {
const values = data.map(item => Number(item[column.property]))
if (!values.every(value => isNaN(value))) {
sums[index] = values.reduce((prev, curr) => {
const value = Number(curr)
if (!isNaN(value)) {
return prev + curr
} else {
return prev
}
}, 0)
sums[index] = sums[index]
} else {
sums[index] = 'N/A'
}
} else if (index === 6) {
const values = data.map(item => Number(item[column.property]))
if (!values.every(value => isNaN(value))) {
sums[index] = values.reduce((prev, curr) => {
const value = Number(curr)
if (!isNaN(value)) {
return prev + curr
} else {
return prev
}
}, 0)
sums[index] = sums[index]
} else {
sums[index] = 'N/A'
}
} else if (index === 7) {
const values = data.map(item => Number(item[column.property]))
if (!values.every(value => isNaN(value))) {
sums[index] = values.reduce((prev, curr) => {
const value = Number(curr)
if (!isNaN(value)) {
return prev + curr
} else {
return prev
}
}, 0)
sums[index] = sums[index]
} else {
sums[index] = 'N/A'
}
} else if (index === 8) {
const values = data.map(item => Number(item[column.property]))
if (!values.every(value => isNaN(value))) {
sums[index] = values.reduce((prev, curr) => {
const value = Number(curr)
if (!isNaN(value)) {
return prev + curr
} else {
return prev
}
}, 0)
sums[index] = sums[index]
} else {
sums[index] = 'N/A'
}
}
})
return sums
},
handleSizeChanges(val) {
this.pageCurrent = 1
this.pageSize = val
this.updateCheck()
},
handleCurrentChanges(val) {
this.pageCurrent = val
this.updateCheck()
}
}
}
</script>
<style>
/* 修改人:Ld 修改时间:2026-08-11 09:14:50; 限定报缺补货页面样式作用域,避免全局 el-card__body flex 导致其他页面表格偏移。 */
.replenishment-page .is-rotate {
-webkit-transform: rotate(180deg);
-moz-transform: rotate(180deg);
-o-transform: rotate(180deg);
-ms-transform: rotate(180deg);
transform: rotate(180deg);
}
.replenishment-page .Outsourcing {
background: #D9FFFF!important;
}
.replenishment-page .red {
color: #e88383!important;
font-weight: bold;
}
.replenishment-page .yellow {
color: orange!important;
font-weight: bold;
}
.replenishment-page .replenishment-card > .el-card__body{
display: flex;
}
</style>