<template>
|
<view class="page">
|
<!-- 表单区域 -->
|
<view class="form-container">
|
<form :modelValue="formData">
|
<view class="form-group">
|
<label class="form-label">退换料单号:</label>
|
<superwei-combox
|
:candidates="docList"
|
placeholder="请选择"
|
v-model="formData.docNo"
|
@select="onDocChange"
|
class="form-input"
|
/>
|
</view>
|
<view class="form-group">
|
<label class="form-label">生产工单:</label>
|
<input class="form-input" type="text" v-model="formData.moNo" disabled />
|
</view>
|
<view class="form-group">
|
<label class="form-label">退补料类型:</label>
|
<input class="form-input" type="text" v-model="formData.type" disabled />
|
</view>
|
<view class="form-group">
|
<label class="form-label">产品编码:</label>
|
<input class="form-input" type="text" v-model="formData.productCode" disabled />
|
</view>
|
<view class="form-group">
|
<label class="form-label">部门名称:</label>
|
<input class="form-input" type="text" v-model="formData.deptName" disabled />
|
</view>
|
<view class="form-group">
|
<label class="form-label">创建时间:</label>
|
<input class="form-input" type="text" v-model="formData.createTime" disabled />
|
</view>
|
</form>
|
</view>
|
|
<!-- 明细表格 -->
|
<view class="list-container">
|
<uni-table border stripe emptyText="暂无明细数据">
|
<uni-tr>
|
<uni-th align="center">序号</uni-th>
|
<uni-th align="center">物料</uni-th>
|
<uni-th align="center">规格</uni-th>
|
<uni-th align="center">申请数量</uni-th>
|
<uni-th align="center">退料原因</uni-th>
|
</uni-tr>
|
<uni-tr v-for="(item, index) in detailList" :key="index">
|
<uni-td align="center">{{ index + 1 }}</uni-td>
|
<uni-td align="center">{{ item.material }}</uni-td>
|
<uni-td align="center">{{ item.spec }}</uni-td>
|
<uni-td align="center">{{ item.qty }}</uni-td>
|
<uni-td align="center">
|
<input class="form-input" type="text" v-model="item.reason" />
|
</uni-td>
|
</uni-tr>
|
</uni-table>
|
</view>
|
|
<!-- 审核按钮 -->
|
<view class="plus-button">
|
<button type="warn" @click="confirmReview">确认审核</button>
|
<button type="default" @click="rejectReview" style="margin-left: 10px;">驳回</button>
|
</view>
|
|
</view>
|
</template>
|
|
<script>
|
export default {
|
data() {
|
return {
|
docList: [],
|
formData: {
|
docNo: '',
|
moNo: '',
|
type: '',
|
productCode: '',
|
deptName: '',
|
createTime: ''
|
},
|
detailList: [],
|
readonlyFields: [
|
{ label: '生产工单:', field: 'moNo' },
|
{ label: '退补料类型:', field: 'type' },
|
{ label: '产品编码:', field: 'productCode' },
|
{ label: '部门名称:', field: 'deptName' },
|
{ label: '创建时间:', field: 'createTime' }
|
]
|
};
|
},
|
methods: {
|
onDocChange(selectedDoc) {
|
|
this.formData.docNo = selectedDoc;
|
|
// 根据 docNo 获取表头数据
|
this.$post({
|
url: "/RetMat/GetHeader",
|
data: { docNo: selectedDoc }
|
}).then(res => {
|
if (res.status === 0) {
|
this.formData = {
|
...this.formData,
|
moNo: res.data.mono,
|
type: res.data.type,
|
productCode: res.data.productcode,
|
deptName: res.data.deptname,
|
createTime: res.data.createtime
|
};
|
} else {
|
uni.showToast({ title: '获取表头失败', icon: 'none' });
|
}
|
});
|
|
// 获取明细数据
|
this.$post({
|
url: "/RetMat/GetList",
|
data: { docNo: selectedDoc }
|
}).then(res => {
|
if (res.status === 0) {
|
this.detailList = res.data.map(item => ({
|
material: item.material,
|
spec: item.spec,
|
qty: item.qty,
|
reason: item.reason || '',
|
ItemId: item.itemid
|
}));
|
} else {
|
uni.showToast({ title: '获取明细失败', icon: 'none' });
|
}
|
});
|
}
|
,
|
confirmReview() {
|
if (!this.formData.docNo) {
|
uni.showToast({ title: '请先选择退换料单号', icon: 'none' });
|
return;
|
}
|
const dataToSave = {
|
docNo: this.formData.docNo,
|
user: this.$loginInfo.account,
|
items: this.detailList.map(item => ({
|
material: "",
|
ItemId: item.ItemId,
|
Reason: item.reason
|
}))
|
|
};
|
console.log(dataToSave);
|
this.$post({
|
url: "/RetMat/SaveReview",
|
data: dataToSave
|
}).then(res => {
|
if (res.status === 0) {
|
uni.showToast({ title: '审核成功', icon: 'success' });
|
} else {
|
uni.showToast({ title: res.message, icon: 'none' });
|
}
|
});
|
},
|
|
rejectReview() {
|
if (!this.formData.docNo) {
|
uni.showToast({ title: '请先选择退换料单号', icon: 'none' });
|
return;
|
}
|
|
uni.showModal({
|
title: '确认驳回',
|
content: '是否确认驳回该退换料申请?',
|
success: res => {
|
if (res.confirm) {
|
const dataToReject = {
|
docNo: this.formData.docNo,
|
user: this.$loginInfo.account,
|
items: this.detailList.map(item => ({
|
material: item.material,
|
reason: item.reason,
|
itemId: item.ItemId
|
}))
|
};
|
|
this.$post({
|
url: "/RetMat/Reject",
|
data: dataToReject
|
}).then(res => {
|
if (res.status === 0) {
|
uni.showToast({ title: '驳回成功', icon: 'success' });
|
this.formData = {};
|
this.detailList = [];
|
} else {
|
uni.showToast({ title: res.message, icon: 'none' });
|
}
|
});
|
}
|
}
|
});
|
}
|
|
|
|
|
},
|
onLoad() {
|
this.$post({ url: "/RetMat/GetAllDocs" }).then(res => {
|
//this.docList = res.data;
|
this.docList = res.data.map(item => item.thL_NO);
|
});
|
}
|
};
|
</script>
|
|
<style>
|
.page {
|
padding: 10px;
|
}
|
.form-container {
|
padding: 12px;
|
}
|
.form-row {
|
display: flex;
|
align-items: center;
|
margin-bottom: 10px;
|
}
|
.form-group {
|
display: flex;
|
align-items: center;
|
border-bottom: 1px solid #c9c9c9;
|
}
|
.form-label {
|
margin-bottom: 0;
|
padding: 5px;
|
}
|
.form-input {
|
flex: 1;
|
margin-bottom: 0;
|
padding: 5px;
|
}
|
.list-container {
|
padding: 10px;
|
height: 60vh;
|
overflow-y: auto;
|
}
|
.plus-button {
|
display: flex;
|
justify-content: center;
|
margin: 20px 0;
|
}
|
|
</style>
|