| ¶Ô±ÈÐÂÎļþ |
| | |
| | | <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> |