From 62cb247da5cc1cc097c5afea402aabee05260431 Mon Sep 17 00:00:00 2001 From: xwt <2740516069@qq.com> Date: 星期四, 14 八月 2025 19:56:50 +0800 Subject: [PATCH] 首检巡检来料检入库检 --- pages/QC/XJ/Add.vue | 265 ++++-- pages/QC/RKJ/Add.vue | 1867 ++++++++++++++++++++++++++++++++++---------------- pages/QC/LLJ/Add.vue | 52 pages/QC/LLJ/List.vue | 34 4 files changed, 1,476 insertions(+), 742 deletions(-) diff --git a/pages/QC/LLJ/Add.vue b/pages/QC/LLJ/Add.vue index 4492c63..73e4d0b 100644 --- a/pages/QC/LLJ/Add.vue +++ b/pages/QC/LLJ/Add.vue @@ -575,42 +575,22 @@ }).then(res => { if (res.status == 0) { - if(this.$loginInfo.account == 'PL017'){ - this.QcIssueResultDetailes = { - fbatchQty: this.formData.fbatchQty, - itemName: this.formData.itemName, - itemNo: this.formData.itemNo, - suppName: this.formData.suppName, - appicationReason: this.formData.fngDesc, - badReason: this.badreason, - remark: this.remarks || '', - workShop: this.WORKSHOP, - releaseNo: this.formData.releaseNo, - staffNo: 'HMCS', - // staffNo: this.$loginInfo.account, - iqcStatus: this.PSTYPE, - department: this.WORKSHOP, // 浣跨敤WORKSHOP鏇夸唬鏈畾涔夌殑DEPARTMENT - EMERGENCY: this.formData.emergencyStatus ? "1" : "0" // 纭繚绱ф�ユ斁琛岀姸鎬佹纭紶閫� - }; - } - else{ - this.QcIssueResultDetailes = { - fbatchQty: this.formData.fbatchQty, - itemName: this.formData.itemName, - itemNo: this.formData.itemNo, - suppName: this.formData.suppName, - appicationReason: this.formData.fngDesc, - badReason: this.badreason, - remark: this.remarks || '', - workShop: this.WORKSHOP, - releaseNo: this.formData.releaseNo, - // staffNo: 'HMCS', - staffNo: this.$loginInfo.account, - iqcStatus: this.PSTYPE, - department: this.WORKSHOP, // 浣跨敤WORKSHOP鏇夸唬鏈畾涔夌殑DEPARTMENT - EMERGENCY: this.formData.emergencyStatus ? "1" : "0" // 纭繚绱ф�ユ斁琛岀姸鎬佹纭紶閫� - }; - } + // 缁熶竴鎺ㄩ�佺粰HMCS锛屼笉绠″摢涓处鍙� + this.QcIssueResultDetailes = { + fbatchQty: this.formData.fbatchQty, + itemName: this.formData.itemName, + itemNo: this.formData.itemNo, + suppName: this.formData.suppName, + appicationReason: this.formData.fngDesc, + badReason: this.badreason, + remark: this.remarks || '', + workShop: this.WORKSHOP, + releaseNo: this.formData.releaseNo, + staffNo: 'HMCS', // 缁熶竴鎺ㄩ�佺粰HMCS + iqcStatus: this.PSTYPE, + department: this.WORKSHOP, // 浣跨敤WORKSHOP鏇夸唬鏈畾涔夌殑DEPARTMENT + EMERGENCY: this.formData.emergencyStatus ? "1" : "0" // 纭繚绱ф�ユ斁琛岀姸鎬佹纭紶閫� + }; console.log("鎻愪氦鐨勭揣鎬ユ斁琛岀姸鎬侊細", this.formData.emergencyStatus ? "1" : "0"); console.log("瀹屾暣鐨勬彁浜ゆ暟鎹細", this.QcIssueResultDetailes); diff --git a/pages/QC/LLJ/List.vue b/pages/QC/LLJ/List.vue index d02936a..4b8dc8f 100644 --- a/pages/QC/LLJ/List.vue +++ b/pages/QC/LLJ/List.vue @@ -43,7 +43,7 @@ <text class="card-title">妫�楠屽崟鍙�: {{item.releaseNo}}</text> <view v-if="item.userName == null && item.activeTab == 0"> <text class="status pending" :class="{ 'emergency-pending': item.lotNo1 === '绱ф�ユ斁琛岋紝璇峰嬁楠岄��!' }"> - {{ item.lotNo1 === '绱ф�ユ斁琛岋紝璇峰嬁楠岄��!' ? '绱ф�ユ斁琛�/寰呭垎閰�' : '寰呭垎閰�' }} + {{ item.lotNo1 === '绱ф�ユ斁琛岋紝璇峰嬁楠岄��!' ? '绱ф�ユ斁琛�/' + getStatusText(item) : getStatusText(item) }} </text> </view> @@ -185,9 +185,12 @@ emergency:this.meergency, } }).then(res => { + // 鍘婚噸澶勭悊 - 鏍规嵁 releaseNo 鍘婚噸 + const uniqueList = this.removeDuplicatesByReleaseNo(res.data.tbBillList); + if (this.pageIndex === 1) { // 濡傛灉鏄涓�椤碉紝鐩存帴瑕嗙洊鍘熸暟鎹� - this.inspectionList = res.data.tbBillList; + this.inspectionList = uniqueList; //娣诲姞Tab淇℃伅锛屽垽鏂槸宸叉杩樻槸鏈鏁版嵁 this.inspectionList.forEach((item, index) => { this.$set(item, 'activeTab', this.activeTab); @@ -196,9 +199,9 @@ }); } else { - if (res.data.tbBillList.length > 0) { + if (uniqueList.length > 0) { // 濡傛灉鏄笅涓�椤碉紝杩藉姞鏂版暟鎹� - this.inspectionList = [...this.inspectionList, ...res.data.tbBillList]; + this.inspectionList = [...this.inspectionList, ...uniqueList]; //娣诲姞Tab淇℃伅锛屽垽鏂槸宸叉杩樻槸鏈鏁版嵁 this.inspectionList.forEach((item, index) => { this.$set(item, 'activeTab', this.activeTab); @@ -323,6 +326,29 @@ } await this.init(); // 鑷畾涔夌殑鍒锋柊鍑芥暟 + }, + + // 鏍规嵁 releaseNo 鍘婚噸鐨勬柟娉� + removeDuplicatesByReleaseNo(array) { + const seen = new Set(); + return array.filter(item => { + const releaseNo = item.releaseNo; + if (seen.has(releaseNo)) { + return false; + } + seen.add(releaseNo); + return true; + }); + }, + + // 鏍规嵁妫�楠岄」鐩暟閲忚幏鍙栫姸鎬佹枃鏈� + getStatusText(item) { + // 濡傛灉娌℃湁妫�楠岄」鐩紝鏄剧ず"鏈淮鎶�" + if (!item.inspectionItemCount || item.inspectionItemCount === 0) { + return '鏈淮鎶�'; + } + // 濡傛灉鏈夋楠岄」鐩紝鏄剧ず"寰呮楠�" + return '寰呮楠�'; } } } diff --git a/pages/QC/RKJ/Add.vue b/pages/QC/RKJ/Add.vue index d4a4d1c..9791f40 100644 --- a/pages/QC/RKJ/Add.vue +++ b/pages/QC/RKJ/Add.vue @@ -1,175 +1,256 @@ <template> - <view class="container"> - <!-- 澶撮儴 --> - <view class="header"> - <view class="title">鍏ュ簱妫�楠�</view> - <view class="order-number">妫�楠屽崟鍙�: {{formData.releaseNo}}</view> - </view> - - <!-- 鍩烘湰淇℃伅 --> - <view class="section"> - <view class="section-header">鍩烘湰淇℃伅</view> - <view class="section-body"> - <view class="info-grid"> - <view class="info-item"> - <view class="info-label">妫�楠屽崟鍙�</view> - <view class="info-value">{{ formData.releaseNo }}</view> - </view> - <view class="info-item"> - <view class="info-label">鍒涘缓浜�</view> - <view class="info-value">{{ formData.createBy }}</view> - </view> - <view class="info-item"> - <view class="info-label">鍒涘缓鏃堕棿</view> - <view class="info-value">{{ formData.createDate }}</view> - </view> - <view class="info-item"> - <view class="info-label">鐢熶骇绾垮埆</view> - <superwei-combox v-if="isUpdate" :candidates="DAA020List" placeholder="璇烽�夋嫨鎴栬緭鍏�" - v-model="formData.lineName" - @select="onDaa020Change" - class="picker-input"></superwei-combox> - <view v-else class="info-value">{{ formData.daa015 }}</view> - </view> - <view class="info-item"> - <view class="info-label">宸ュ崟鍙�</view> - <superwei-combox v-if="isUpdate" :candidates="DAA001List" placeholder="璇烽�夋嫨鎴栬緭鍏�" - v-model="formData.rBillNo" - @select="onDaa001Change" - class="picker-input"></superwei-combox> - <view v-else class="info-value">{{ formData.rBillNo }}</view> - </view> - <view class="info-item"> - <view class="info-label">閫佹鎵规</view> - <superwei-combox v-if="isUpdate" :candidates="billNoList" placeholder="璇烽�夋嫨" - v-model="formData.billNo" - @select="onBillNoChange" - class="picker-input"></superwei-combox> - <view v-else class="info-value">{{ formData.billNo }}</view> - </view> - <view class="info-item"> - <view class="info-label">鐗╂枡缂栫爜</view> - <view class="info-value">{{ formData.itemNo }}</view> - </view> - <view class="info-item"> - <view class="info-label">浜у搧鍚嶇О</view> - <view class="info-value">{{ formData.itemName }}</view> - </view> - <view class="info-item"> - <view class="info-label">瑙勬牸鍨嬪彿</view> - <view class="info-value">{{ formData.itemModel }}</view> - </view> - <view class="info-item"> - <view class="info-label">閫佹鏁伴噺</view> - <view class="info-value highlight">{{ formData.quantity }}</view> - </view> - <view class="info-item"> - <view class="info-label">鎶ュ伐浜�</view> - <view class="info-value">{{ formData.bgr }}</view> - </view> - <view class="info-item"> - <view class="info-label">妫�楠岀粨鏋�</view> - <view class="info-value">{{ formData.fcheckResu }}</view> - </view> - <view class="info-item" v-if="formData.remarks"> - <view class="info-label">涓嶅悎鏍兼弿杩�</view> - <view class="info-value danger">{{ formData.remarks }}</view> - </view> - </view> - </view> - </view> - - <!-- 妫�楠岄」鐩� --> - <view class="section" v-if="tableData.length > 0"> - <view class="section-header">妫�楠岄」鐩�</view> - <view class="section-body"> - <view class="inspection-table"> - <table> - <thead> - <tr> - <th width="20%" style="text-align: center;">妫�楠岄」鐩�</th> - <th width="50%" style="text-align: center;">妫�楠屾弿杩�</th> - <th width="15%" style="text-align: center;">璁板綍(鐐瑰嚮)</th> - </tr> - </thead> - <tbody> - <tr v-for="(item, index) in tableData" :key="index"> - <td>{{ item.projName }}</td> - <td> - <view v-if="item.result=='鍚堟牸'" class="watermark approved"> - {{ getStatusText(item.result) }} - </view> - <view v-if="item.result=='涓嶅悎鏍�'" class="watermark rejected"> - {{ getStatusText(item.result) }} - </view> - <view v-if="item.result==null || item.result=='鏈畬鎴�'" class="watermark pending"> - {{ getStatusText(item.result) }} - </view> - <view class="description-text">{{ item.projName }}</view> - </td> - <td> - <button v-if="item.isCheck >= item.levelNum" class="record-btn" @click="toDetail(item)">鏌ョ湅</button> - <button v-else class="record-btn" @click="toDetail(item)">濉啓</button> - </td> - </tr> - </tbody> - </table> - </view> - </view> - </view> - - <!-- 鎿嶄綔鎸夐挳 --> - <view class="action-buttons"> - <button class="action-btn primary" v-if="isUpdate && !isShowTable" @click="getItem">鐢熸垚妫�楠屽崟</button> - <button class="action-btn secondary" v-if="!isUpdate && !isShowTable" @click="toImage">涓婁紶/鏌ョ湅鍥剧墖</button> - <button class="action-btn warning" v-if="!isUpdate && !isShowTable" @click="saveRemarks">娣诲姞涓嶅悎鏍兼弿杩�</button> - <button class="action-btn danger" v-if="!isUpdate && !isShowTable && this.formData.fsubmit != 1" @click="cleanResult">娓呴櫎妫�楠岀粨鏋�</button> - <button class="action-btn primary" v-if="isShowTable" @click="getTable">鑾峰彇妫�楠岄」鐩�</button> - <button class="action-btn primary" v-if="isShowTable && isUpdate" @click="saveTable">鐢熸垚妫�楠岄」鐩�</button> - </view> - - - <!-- 淇敼涓嶅悎鏍兼弿杩板脊鍑烘 --> - <view v-if="showPopup" class="overlay"> - <view class="popup"> - <view class="popup-header"> - <h3>淇敼涓嶅悎鏍兼弿杩�</h3> - </view> - <view class="popup-content"> - <view class="input-group"> - <view class="input-label">涓嶅悎鏍兼弿杩帮細</view> - <input class="input-field" type="text" v-model="remarks" placeholder="璇疯緭鍏ヤ笉鍚堟牸鎻忚堪"/> - </view> - </view> - <view class="popup-actions"> - <button class="action-btn primary" @click="edit">淇敼</button> - <button class="action-btn secondary" @click="showPopup = !showPopup">鍙栨秷</button> - </view> - </view> - </view> - - </view> - </template> + <!-- 鏂板缓琛ㄥ崟 - 浼樺寲鍚庣殑UI鏍峰紡 --> + <view v-if="isUpdate" class="create-form"> + <view class="form-header"> + <h2>鏂板缓鍏ュ簱妫�楠屽崟</h2> + <p class="form-subtitle">璇锋寜椤哄簭濉啓浠ヤ笅淇℃伅</p> + </view> + + <view class="form-content"> + <!-- 妫�楠屽崟鍙� --> + <view class="form-section"> + <view class="section-title">鍩烘湰淇℃伅</view> + <view class="form-row"> + <label class="form-label">妫�楠屽崟鍙凤細</label> + <span class="form-value">{{formData.releaseNo}}</span> + </view> + </view> + + <!-- 閫夋嫨鍖哄煙 --> + <view class="form-section"> + <view class="section-title">閫夋嫨淇℃伅</view> + <view class="form-row"> + <label class="form-label required">宸ヤ綔杞﹂棿锛�</label> + <superwei-combox :candidates="departmentList" placeholder="璇烽�夋嫨杞﹂棿" + v-model="formData.workShop" + @select="onDepartmentChange" + class="form-select"></superwei-combox> + </view> + + <view class="form-row"> + <label class="form-label required">鐢熶骇绾垮埆锛�</label> + <superwei-combox v-if="formData.workShop" :candidates="DAA020List" placeholder="璇烽�夋嫨绾夸綋" + v-model="formData.lineName" + @select="onDaa020Change" + class="form-select"></superwei-combox> + <span v-else class="form-hint">璇峰厛閫夋嫨宸ヤ綔杞﹂棿</span> + </view> + + <view class="form-row"> + <label class="form-label required">鐢熶骇宸ュ崟锛�</label> + <superwei-combox v-if="formData.lineName" :candidates="DAA001List" placeholder="璇烽�夋嫨宸ュ崟" + v-model="formData.rBillNo" + @select="onDaa001Change" + class="form-select"></superwei-combox> + <span v-else class="form-hint">璇峰厛閫夋嫨鐢熶骇绾垮埆</span> + </view> + + <view class="form-row"> + <label class="form-label required">閫佹鏁伴噺锛�</label> + <input type="number" + v-model="formData.quantity" + placeholder="璇疯緭鍏ラ�佹鏁伴噺" + class="form-input" + @input="onQuantityChange"/> + </view> + </view> + + <!-- 浜у搧淇℃伅 --> + <view class="form-section" v-if="formData.itemName || formData.itemNo || formData.itemModel || formData.planQty"> + <view class="section-title">浜у搧淇℃伅</view> + <view class="form-row" v-if="formData.itemName"> + <label class="form-label">浜у搧鍚嶇О锛�</label> + <span class="form-value">{{formData.itemName}}</span> + </view> + + <view class="form-row" v-if="formData.itemNo"> + <label class="form-label">鐗╂枡缂栫爜锛�</label> + <span class="form-value">{{formData.itemNo}}</span> + </view> + + <view class="form-row" v-if="formData.itemModel"> + <label class="form-label">瑙勬牸鍨嬪彿锛�</label> + <span class="form-value">{{formData.itemModel}}</span> + </view> + + <view class="form-row" v-if="formData.planQty"> + <label class="form-label">宸ュ崟鏁伴噺锛�</label> + <span class="form-value">{{formData.planQty}}</span> + </view> + </view> + </view> + + <view class="form-actions"> + <button class="btn-primary" + v-if="!isShowTable && formData.workShop && formData.lineName && formData.rBillNo && formData.quantity" + @click="getItem"> + <text class="btn-icon">鉁�</text> + 鐢熸垚妫�楠屽崟 + </button> + <button class="btn-primary" + v-if="isShowTable && isUpdate" + @click="saveTable"> + <text class="btn-icon">鉁�</text> + 鐢熸垚妫�楠岄」鐩� + </button> + </view> + </view> + + <!-- 鏌ョ湅/缂栬緫琛ㄥ崟 - 浣跨敤LLJ绫讳技鐨勬牱寮� --> + <view v-else class="inspection-sheet"> + <!-- 澶撮儴淇℃伅 --> + <view class="sheet-header"> + <h1>鍏ュ簱妫�楠屽崟</h1> + <view class="inspection-number">妫�楠屽崟鍙凤細{{formData.releaseNo}}</view> + </view> + + <!-- 鍩烘湰淇℃伅鍖� --> + <view class="basic-info"> + <view class="info-row"> + <span class="info-label">宸ュ崟鍙凤細</span> + <span class="info-value">{{formData.billNo || formData.rBillNo}}</span> + <span class="info-label">鍒涘缓浜猴細</span> + <span class="info-value">{{formData.createBy}}</span> + </view> + <view class="info-row"> + <span class="info-label">鍒涘缓鏃堕棿锛�</span> + <span class="info-value">{{formData.createDate}}</span> + <span class="info-label"> 鎻愪氦鐘舵�侊細</span> + <span class="info-value">{{formData.fsubmit == 1 ? '宸叉彁浜�' : '鏈彁浜�'}}</span> + </view> + </view> + + <!-- 鐗╂枡淇℃伅鍖� --> + <view class="material-info"> + <view class="info-block"> + <view class="info-label">鐗╂枡缂栫爜锛�</view> + <view class="info-value">{{formData.itemNo}}</view> + </view> + <view class="info-block"> + <view class="info-label">浜у搧鍚嶇О锛�</view> + <view class="info-value">{{formData.itemName}}</view> + </view> + <view class="info-block"> + <view class="info-label">瑙勬牸鍨嬪彿锛�</view> + <view class="info-value">{{formData.itemModel}}</view> + </view> + <view class="info-block"> + <view class="info-label">閫佹鏁伴噺锛�</view> + <view class="info-value highlight">{{formData.quantity}}</view> + </view> + <view class="info-block" v-if="formData.remarks"> + <view class="info-label">涓嶅悎鏍兼弿杩帮細</view> + <view class="info-value">{{formData.remarks}}</view> + </view> + </view> + + <!-- 涓嬫媺閫夋嫨鍖哄煙 --> + <view class="dropdown-row"> + <view class="info-label">宸ヤ綔杞﹂棿锛�</view> + <view class="info-value">{{formData.workShop}}</view> + </view> + <view class="dropdown-row"> + <view class="info-label">鐢熶骇绾垮埆锛�</view> + <view class="info-value">{{formData.lineName || formData.daa015}}</view> + </view> + <view class="dropdown-row"> + <view class="info-label">鐢熶骇宸ュ崟锛�</view> + <view class="info-value">{{formData.billNo || formData.rBillNo}}</view> + </view> + + <!-- 琛ㄥ崟涓婃柟鎿嶄綔鎸夐挳鍖� --> + <view class="top-action-buttons"> + <button class="action-btn" v-if="tableData.length === 0 && formData.fsubmit != 1" @click="getInspectionItems">鑾峰彇妫�楠岄」鐩�</button> + </view> + + <!-- 妫�楠岄」鐩〃鏍� --> + <view class="inspection-table" v-if="formData.id"> + <table> + <thead> + <tr> + <th width="20%" style="text-align: center;">妫�楠岄」鐩�</th> + <th width="50%" style="text-align: center;">妫�楠屾弿杩�</th> + <th width="15%" style="text-align: center;">璁板綍(鐐瑰嚮)</th> + </tr> + </thead> + <tbody> + <tr v-for="(item, index) in tableData" :key="index"> + <td>{{ item.projName }}</td> + <td> + <view v-if="item.result=='鍚堟牸'" class="watermark approved"> + {{ getStatusText(item.result) }} + </view> + <view v-if="item.result=='涓嶅悎鏍�'" class="watermark rejected"> + {{ getStatusText(item.result) }} + </view> + <view v-if="item.result==null || item.result=='鏈畬鎴�'" class="watermark pending"> + {{ getStatusText(item.result) }} + </view> + <view class="description-text">{{ item.projName }}</view> + </td> + <td> + <button v-if="item.isCheck >= item.levelNum || formData.fsubmit == 1" class="record-btn" @click="toDetail(item)">鏌ョ湅</button> + <button v-else class="record-btn" @click="toDetail(item)">濉啓</button> + </td> + </tr> + </tbody> + </table> + <view v-if="tableData.length === 0" class="no-data-tip"> + <text style="color: #999; font-size: 16px;">璇ユ楠屽崟鏆傛棤妫�楠岄」鐩紝璇风偣鍑�"鑾峰彇妫�楠岄」鐩�"鎸夐挳娣诲姞妫�楠岄」鐩�</text> + </view> + </view> + + <!-- 琛ㄥ崟涓嬫柟鎿嶄綔鎸夐挳鍖� --> + <view class="bottom-action-buttons"> + <button class="action-btn small" @click="toImage">涓婁紶/鏌ョ湅鍥剧墖</button> + <button class="action-btn small" @click="saveRemarks" v-if="formData.fsubmit != 1">娣诲姞涓嶅悎鏍兼弿杩�</button> + <button class="action-btn small" @click="cleanResult" v-if="formData.fsubmit != 1">娓呴櫎妫�楠岀粨鏋�</button> + <button class="action-btn small primary" @click="submitInspection" v-if="formData.fsubmit != 1 && tableData.length > 0">鎻愪氦妫�楠�</button> + </view> + + <!-- 淇敼涓嶅悎鏍兼弿杩板脊鍑烘 --> + <view v-if="showPopup" class="overlay"> + <view class="popup"> + <h3>淇敼涓嶅悎鏍兼弿杩�</h3> + <form> + <view class="form-group"> + <label class="form-label">涓嶅悎鏍兼弿杩�:</label> + <input class="form-input" type="text" v-model="remarks" placeholder="璇疯緭鍏ヤ笉鍚堟牸鎻忚堪"/> + </view> + </form> + <button class="updateBut" @click="edit">淇敼</button> + <button @click="showPopup = !showPopup">鍙栨秷</button> + </view> + </view> + </view> +</template> <script> export default { data() { return { - formData: { - id: "", - releaseNo: "", - createBy: "", - createDate: "", - daa020: "", - itemNo: "", - billNo: "", - catQty: "", - detailMem: "", - taskNo: "", - fcheckResu: "", - remarks: "", - rbillNo: "" - }, + formData: { + id: "", + releaseNo: "", + createBy: "", + createDate: "", + daa020: "", + itemNo: "", + itemId: "", // 鐗╂枡ID + billNo: "", + lineNo: "", // 鐢熶骇绾跨紪鍙� + catQty: "", + detailMem: "", + taskNo: "", + fcheckResu: "", + fsubmit: "", // 鎻愪氦鐘舵�� + remarks: "", + rbillNo: "", + workShop: "", // 宸ヤ綔杞﹂棿 + lineName: "", // 绾夸綋鍚嶇О + quantity: "", // 閫佹鏁伴噺 + planQty: "" // 宸ュ崟璁″垝鏁伴噺 + }, DAA020List: [], @@ -192,7 +273,8 @@ remarks: "", showPopup: false, - billNoList: [], + departmentList: [], // 杞﹂棿鍒楄〃 + selectedDepartmentId: "", // 閫変腑鐨勮溅闂碔D }; }, onLoad(options) { @@ -215,13 +297,12 @@ this.formData.createBy = this.$loginInfo.account; this.formData.createDate = this.$getDate("yyyy-mm-dd"); }); - - //杞﹂棿涓嬫媺妗嗙殑鍒濆鍖� + + // 鍒濆鍖栬溅闂翠笅鎷夋 this.$post({ - url: "/XJ/getLineAll" + url: "/RKJ/GetDepartmentsWithLines" }).then(res => { - this.lineList = res.data.tbBillList; - this.DAA020List = res.data.tbBillList.map(item => item.lineName); + this.departmentList = res.data.tbBillList.map(item => item.departmentname); }) } }, @@ -269,28 +350,77 @@ }, getItem() { + if (!this.formData.workShop) { + this.$showMessage("璇烽�夋嫨宸ヤ綔杞﹂棿"); + return; + } + + if (!this.formData.lineName) { + this.$showMessage("璇烽�夋嫨鐢熶骇绾夸綋"); + return; + } + + if (!this.formData.rBillNo) { + this.$showMessage("璇烽�夋嫨鐢熶骇宸ュ崟"); + return; + } + + if (!this.formData.quantity || parseFloat(this.formData.quantity) <= 0) { + this.$showMessage("璇疯緭鍏ユ湁鏁堢殑閫佹鏁伴噺"); + return; + } + + const quantity = parseFloat(this.formData.quantity); + const planQty = parseFloat(this.formData.planQty); + + if (quantity > planQty) { + this.$showMessage("閫佹鏁伴噺涓嶈兘澶т簬宸ュ崟鏁伴噺"); + return; + } + + // 纭繚蹇呰瀛楁琚纭缃� + if (!this.formData.itemId) { + this.$showMessage("鐗╂枡ID鑾峰彇澶辫触锛岃閲嶆柊閫夋嫨宸ュ崟"); + return; + } + if (!this.formData.billNo) { - this.$showMessage("璇烽�夋嫨宸ュ崟鍙�"); + this.$showMessage("宸ュ崟鍙疯幏鍙栧け璐ワ紝璇烽噸鏂伴�夋嫨宸ュ崟"); return; } - - if (this.isSubmit) { - this.$showMessage("姝ょ墿鏂欐棤鍚敤鐨勬楠岄」鐩紝璇风淮鎶�!"); - return; - } - - this.$post({ - url: "/RKJ/save", - data: { - from: this.formData, - userNo: this.$loginInfo.account, - //moidNum: this.formData.moidNum - items: this.tableData - } - }).then(res => { + + // 璁剧疆Daa015瀛楁锛堢敓浜х嚎鍒級 + this.formData.daa015 = this.formData.lineNo; + + // 璁剧疆榛樿鎻愪氦鐘舵�佷负鏈彁浜わ紙0锛� + this.formData.fsubmit = 0; + + this.$post({ + url: "/RKJ/save", + data: { + from: this.formData, + userNo: this.$loginInfo.account, + quantity: this.formData.quantity, + //moidNum: this.formData.moidNum + items: this.tableData + } + }).then(res => { this.formData.id = res.data.tbBillList; - this.$showMessage("鐢熸垚妫�楠岄」鐩垚鍔�"); - this.init(); + + // 淇濆瓨杞﹂棿閫夋嫨淇℃伅 + if (this.formData.workShop && this.selectedDepartmentId) { + this.$post({ + url: "/RKJ/SaveDepartmentSelection", + data: { + id: this.formData.id, + departmentId: this.selectedDepartmentId, + departmentName: this.formData.workShop + } + }); + } + + this.$showMessage("妫�楠屽崟鍒涘缓鎴愬姛锛佽妫�楠屽崟鏈淮鎶ゆ楠岄」鐩紝璇峰厛缁存姢妫�楠岄」鐩紒"); + // 涓嶈皟鐢╥nit鏂规硶锛岄伩鍏嶆楠屽崟鍙峰彂鐢熷彉鍖� this.isUpdate = false; }); }, @@ -298,11 +428,13 @@ onDaa020Change(event) { //鑾峰彇鐢熶骇绾垮埆鐨勪笅鏍囧湴鍧� this.formData.lineName = event; - - this.lineNo = this.lineList[this.DAA020List.indexOf(event)].lineNo; - - this.formData.line = this.lineNo; - + + const selectedLine = this.lineList[this.DAA020List.indexOf(event)]; + this.lineNo = selectedLine.lineno; + + // 璁剧疆鐢熶骇绾跨紪鍙峰埌formData + this.formData.lineNo = this.lineNo; + this.$post({ url: "/RKJ/getDaa001", data: { @@ -311,46 +443,115 @@ }).then(res => { this.BillNoList = res.data.tbBillList; // 宸ュ崟鍙峰幓閲嶏紝鍙樉绀哄敮涓� - this.DAA001List = Array.from(new Set(res.data.tbBillList.map(s => s.rBillNo))); + this.DAA001List = Array.from(new Set(res.data.tbBillList.map(s => s.daa001))); this.formData.rBillNo = ""; - this.formData.billNo = ""; + // 涓嶆竻绌洪�佹鏁伴噺锛屼繚鎸佺敤鎴峰凡杈撳叆鐨勫�� this.formData.itemName = ""; this.formData.itemNo = ""; - this.formData.quantity = ""; - this.billNoList = []; + this.formData.itemId = ""; // 娓呯┖鐗╂枡ID + this.formData.itemModel = ""; + this.formData.planQty = ""; this.tableData = []; }) }, + // 杞﹂棿閫夋嫨浜嬩欢 + onDepartmentChange(event) { + this.formData.workShop = event; + + // 鏍规嵁杞﹂棿鍚嶇О鑾峰彇杞﹂棿ID + this.$post({ + url: "/RKJ/GetDepartmentsWithLines" + }).then(res => { + const department = res.data.tbBillList.find(item => item.departmentname === event); + if (department) { + this.selectedDepartmentId = department.departmentid; + + // 鏍规嵁杞﹂棿ID鑾峰彇绾夸綋鍒楄〃 + this.$post({ + url: "/RKJ/GetLinesByDepartment", + data: { + departmentId: this.selectedDepartmentId + } + }).then(lineRes => { + console.log("绾夸綋鏁版嵁:", lineRes.data.tbBillList); // 娣诲姞璋冭瘯鏃ュ織 + this.lineList = lineRes.data.tbBillList; + this.DAA020List = lineRes.data.tbBillList.map(item => item.linename); + + // 娓呯┖鐩稿叧鏁版嵁 + this.formData.lineName = ""; + this.formData.lineNo = ""; // 娓呯┖鐢熶骇绾跨紪鍙� + this.formData.rBillNo = ""; + this.formData.billNo = ""; // 娓呯┖宸ュ崟鍙� + // 涓嶆竻绌洪�佹鏁伴噺锛屼繚鎸佺敤鎴峰凡杈撳叆鐨勫�� + this.formData.itemName = ""; + this.formData.itemNo = ""; + this.formData.itemId = ""; // 娓呯┖鐗╂枡ID + this.formData.itemModel = ""; + this.formData.planQty = ""; + this.tableData = []; + }); + } + }); + }, //閫夊彇宸ュ崟濉厖鐗╂枡鍙峰拰鍏朵粬淇℃伅 onDaa001Change(e) { - this.formData.rBillNo = e; - - // 鎵惧嚭鎵�鏈夊睘浜庤宸ュ崟鍙风殑閫佹鎵规 - this.billNoList = this.BillNoList.filter(item => item.rBillNo === e).map(item => item.billNo); - this.formData.billNo = ""; - this.formData.itemName = ""; - this.formData.itemNo = ""; - this.formData.quantity = ""; - this.tableData = []; - }, - onBillNoChange(e) { - this.formData.billNo = e; - // 鎵惧埌褰撳墠宸ュ崟鍙�+閫佹鎵规鍙风殑瀹屾暣鏁版嵁 - let data = this.BillNoList.find(item => item.rBillNo === this.formData.rBillNo && item.billNo === e); + + // 鎵惧埌褰撳墠宸ュ崟鍙风殑瀹屾暣鏁版嵁 + let data = this.BillNoList.find(item => item.daa001 === e); if (!data) { this.formData.itemName = ""; this.formData.itemNo = ""; + this.formData.itemId = ""; + this.formData.billNo = ""; this.formData.quantity = ""; this.formData.itemModel = ""; this.tableData = []; return; } - this.formData.itemName = data.itemName; - this.formData.itemNo = data.itemNo; - this.formData.quantity = data.quantity; - this.formData.itemModel = data.itemModel || ""; - // 濡傞渶鑷姩璇锋眰妫�楠岄」鐩紝鍙湪姝ゅ琛ュ厖閫昏緫 + + // 鑷姩濉厖鐗╂枡淇℃伅 + this.formData.itemName = data.daa003; // 浜у搧鍚嶇О + this.formData.itemNo = data.daa002; // 浜у搧缂栫爜 + this.formData.itemId = data.itemId || ""; // 鐗╂枡ID + this.formData.billNo = data.daa001; // 宸ュ崟鍙蜂綔涓篵illNo + this.formData.itemModel = data.daa004 || ""; // 浜у搧瑙勬牸 + this.formData.planQty = data.daa008 || ""; // 宸ュ崟鏁伴噺 + // 涓嶆竻绌洪�佹鏁伴噺锛屼繚鎸佺敤鎴峰凡杈撳叆鐨勫�� + this.tableData = []; + }, + // 閫佹鏁伴噺鍙樺寲浜嬩欢 + onQuantityChange(event) { + // 濡傛灉杈撳叆涓虹┖锛屼笉杩涜楠岃瘉 + if (!this.formData.quantity || this.formData.quantity === "") { + return; + } + + const quantity = parseFloat(this.formData.quantity); + + // 妫�鏌ユ槸鍚︿负鏈夋晥鏁板瓧 + if (isNaN(quantity)) { + this.$showMessage("璇疯緭鍏ユ湁鏁堢殑鏁板瓧"); + this.formData.quantity = ""; + return; + } + + // 鍙湁鍦ㄨ緭鍏ュ畬鎴愪笖鏁伴噺澶т簬0鏃舵墠杩涜楠岃瘉 + if (quantity <= 0) { + this.$showMessage("閫佹鏁伴噺蹇呴』澶т簬0"); + this.formData.quantity = ""; + return; + } + + // 鍙湁鍦ㄥ凡閫夋嫨宸ュ崟涓旀湁宸ュ崟鏁伴噺鏃舵墠杩涜鏁伴噺姣旇緝 + if (this.formData.planQty) { + const planQty = parseFloat(this.formData.planQty); + if (!isNaN(planQty) && quantity > planQty) { + this.$showMessage("閫佹鏁伴噺涓嶈兘澶т簬宸ュ崟鏁伴噺"); + this.formData.quantity = ""; + return; + } + } }, init() { this.$post({ @@ -364,60 +565,167 @@ }).then(res => { let data = res.data.tbBillList[0]; if (data) { - this.formData = data; - - this.$post({ - url: "/RKJ/getItems", - data: { - pid: this.formData.id - } - }).then(res1 => { - - let tableData = res1.data.tbBillList - - //褰撳凡妫�楠屼釜鏁伴兘涓嶄负绌烘椂鎸夌収妫�娴嬬粨鏋勬帓搴� - tableData.sort((a, b) => { - if (a.result === '鏈畬鎴�' && b.result === '鍚堟牸') { - return -1; - } else if (a.result === '鍚堟牸' && b.result === '鏈畬鎴�') { - return 1; - } else { - return 0; - } - }); - this.tableData = tableData; - - if (this.tableData.length === 0) { - this.isShowTable = true; - } - }) + // 淇濆瓨鍘熸湁鐨勬楠屽崟鍙� + const originalReleaseNo = this.formData.releaseNo; + + // 鏄犲皠鏁版嵁搴撳瓧娈靛埌鍓嶇瀛楁 + this.formData.id = data.id; + this.formData.releaseNo = data.releaseNo || originalReleaseNo; + this.formData.createBy = data.createBy; + this.formData.createDate = data.createDate; + this.formData.billNo = data.billNo; + this.formData.rbillNo = data.rbillNo; + this.formData.itemNo = data.itemNo; + this.formData.itemId = data.itemId; + this.formData.lineNo = data.lineNo; + this.formData.quantity = data.quantity; + this.formData.fcheckResu = data.fcheckResu; + this.formData.fcheckBy = data.fcheckBy; + this.formData.fcheckDate = data.fcheckDate; + this.formData.fsubmit = data.fsubmit; // 鎻愪氦鐘舵�� + this.formData.remarks = data.remarks; + this.formData.workShop = data.workShop; + this.formData.departmentId = data.departmentId; + + // 浠庡叧鑱旇〃鑾峰彇鐨勫瓧娈� + this.formData.itemName = data.itemName; + this.formData.itemModel = data.itemModel; + this.formData.daa015 = data.daa015; + + // 璁剧疆鐢熶骇绾垮悕绉帮紙濡傛灉鏈塴ineNo锛� + if (this.formData.lineNo && this.formData.workShop) { + this.formData.lineName = this.formData.lineNo; + } + + // 鍔犺浇杞﹂棿鍒楄〃鍜岀浉鍏充俊鎭� + this.loadDepartmentAndLineInfo(); + + // 鍔犺浇妫�楠岄」鐩� + this.loadInspectionItems(); } }); }, - toDetail(item) { - - if (this.isUpdate) { - uni.showToast({ - icon: "none", - title: "璇峰厛鐢熸垚妫�楠岄」鐩�", - duration: 2000, - }); - } else { - uni.navigateTo({ - url: 'detail?id=' + item.id + '&billNo=' + this.formData.billNo + '&gid=' + this.formData - .id + '&itemInId=' + this.formData.itemInId + + // 鍔犺浇杞﹂棿鍜岀嚎浣撲俊鎭� + loadDepartmentAndLineInfo() { + this.$post({ + url: "/RKJ/GetDepartmentsWithLines" + }).then(deptRes => { + this.departmentList = deptRes.data.tbBillList.map(item => item.departmentname); + + if (this.formData.workShop) { + const department = deptRes.data.tbBillList.find(item => item.departmentname === this.formData.workShop); + if (department) { + this.selectedDepartmentId = department.departmentid; + this.loadLineInfo(); + } + } + }); + }, + + // 鍔犺浇绾夸綋淇℃伅 + loadLineInfo() { + if (this.selectedDepartmentId) { + this.$post({ + url: "/RKJ/GetLinesByDepartment", + data: { + departmentId: this.selectedDepartmentId + } + }).then(lineRes => { + this.lineList = lineRes.data.tbBillList; + this.DAA020List = lineRes.data.tbBillList.map(item => item.linename); + + if (this.formData.lineNo) { + const selectedLine = this.lineList.find(line => line.lineNo === this.formData.lineNo); + if (selectedLine) { + this.formData.lineName = selectedLine.lineName; + } + this.loadWorkOrderInfo(); + } }); } }, + + // 鍔犺浇宸ュ崟淇℃伅 + loadWorkOrderInfo() { + if (this.formData.lineNo) { + this.$post({ + url: "/RKJ/getDaa001", + data: { + lineNo: this.formData.lineNo + } + }).then(workOrderRes => { + this.BillNoList = workOrderRes.data.tbBillList; + this.DAA001List = Array.from(new Set(workOrderRes.data.tbBillList.map(s => s.daa001))); + }); + } + }, + + // 鍔犺浇妫�楠岄」鐩� + loadInspectionItems() { + this.$post({ + url: "/RKJ/getItems", + data: { + pid: this.formData.id + } + }).then(res1 => { + let tableData = res1.data.tbBillList || []; + + //褰撳凡妫�楠屼釜鏁伴兘涓嶄负绌烘椂鎸夌収妫�娴嬬粨鏋勬帓搴� + tableData.sort((a, b) => { + if (a.result === '鏈畬鎴�' && b.result === '鍚堟牸') { + return -1; + } else if (a.result === '鍚堟牸' && b.result === '鏈畬鎴�') { + return 1; + } else { + return 0; + } + }); + this.tableData = tableData; + + // 濡傛灉娌℃湁妫�楠岄」鐩紝鏄剧ず鎻愮ず淇℃伅 + if (this.tableData.length === 0) { + console.log("娌℃湁鎵惧埌妫�楠岄」鐩�"); + } + }).catch(error => { + console.error("鍔犺浇妫�楠岄」鐩け璐�:", error); + this.tableData = []; + }); + }, + toDetail(item) { + + if (this.isUpdate) { + uni.showToast({ + icon: "none", + title: "璇峰厛鐢熸垚妫�楠岄」鐩�", + duration: 2000, + }); + } else if (this.formData.fsubmit == 1) { + uni.showToast({ + icon: "none", + title: "璇ユ楠屽崟宸叉彁浜わ紝涓嶈兘淇敼", + duration: 2000, + }); + } else { + uni.navigateTo({ + url: 'detail?id=' + item.id + '&billNo=' + this.formData.billNo + '&gid=' + this.formData + .id + '&itemInId=' + this.formData.itemInId + }); + } + }, toImage() { uni.navigateTo({ url: 'ImageItem?id=' + this.formData.id }); }, - saveRemarks() { - this.showPopup = !this.showPopup; - this.remarks = this.formData.remarks; - }, + saveRemarks() { + if (this.formData.fsubmit == 1) { + this.$showMessage("璇ユ楠屽崟宸叉彁浜わ紝涓嶈兘淇敼涓嶅悎鏍兼弿杩�"); + return; + } + this.showPopup = !this.showPopup; + this.remarks = this.formData.remarks; + }, edit() { if (this.remarks) { //saveRemarksGid @@ -435,22 +743,61 @@ } }) } - },getTable() { + },getInspectionItems() { + // 鑾峰彇妫�楠岄」鐩殑閫昏緫 - 璋冪敤瀛樺偍杩囩▼ + this.$post({ + url: "/RKJ/genUpdate", + data: { + id: this.formData.id, + no: this.formData.releaseNo, + user: this.$loginInfo.account + } + }).then(res => { + if (res.status == 0) { + uni.showToast({ + title: res.data.message || "妫�楠岄」鐩敓鎴愭垚鍔�", + icon: 'success', + duration: 2000 + }); + // 寤惰繜閲嶆柊鍔犺浇鏁版嵁 + setTimeout(() => { + this.init(); + }, 2000); + } else { + uni.showToast({ + title: res.data.message || "妫�楠岄」鐩敓鎴愬け璐�", + icon: 'error', + duration: 2000 + }); + } + }).catch(error => { + console.error("鑾峰彇妫�楠岄」鐩け璐�:", error); + this.$showMessage("鑾峰彇妫�楠岄」鐩け璐ワ紝璇烽噸璇�"); + }); + }, + getTable() { + // 纭繚quantity鏈夊�� + if (!this.formData.quantity || parseFloat(this.formData.quantity) <= 0) { + this.$showMessage("璇峰厛杈撳叆鏈夋晥鐨勯�佹鏁伴噺"); + return; + } + this.$post({ url: "/RKJ/setJYItem", data: { itemNo: this.formData.itemNo, - quantity:this.formData.quantity + quantity: this.formData.quantity } }).then(res => { this.tableData = res.data.tbBillList; if (this.tableData.length === 0) { - this.$showMessage("璇ョ墿鏂欐潯鐮佹病鏈夋楠岄」鐩�"); + this.$showMessage("璇ョ墿鏂欐湭缁存姢妫�楠岄」鐩紝璇峰厛缁存姢妫�楠岄」鐩紒"); this.isSubmit = true; this.tableData = []; this.isShowTable = true; - this.isUpdate = false; + // 淇濇寔鏂板缓妯″紡锛屼笉鍒囨崲鍒版煡鐪嬫ā寮� + this.isUpdate = true; } else { this.isSubmit = false; this.isShowTable = true; @@ -477,23 +824,82 @@ this.init(); }) }, - cleanResult(){ - this.$post({ - url: "/RKJ/cleanReqResult", - data: { - gid: this.formData.id, - userNo: this.$loginInfo.account - } - }).then(res => { - console.log(res); - if(res.status == 0){ - this.init(); - }else{ - this.$showMessage(res.message); - } - - }) - } + cleanResult(){ + if (this.formData.fsubmit == 1) { + this.$showMessage("璇ユ楠屽崟宸叉彁浜わ紝涓嶈兘娓呴櫎妫�楠岀粨鏋�"); + return; + } + this.$post({ + url: "/RKJ/cleanReqResult", + data: { + gid: this.formData.id, + userNo: this.$loginInfo.account + } + }).then(res => { + console.log(res); + if(res.status == 0){ + this.init(); + }else{ + this.$showMessage(res.message); + } + + }) + }, + + // 鎻愪氦妫�楠屾柟娉� + submitInspection() { + // 妫�鏌ユ槸鍚﹀凡鎻愪氦 + if (this.formData.fsubmit == 1) { + this.$showMessage("璇ユ楠屽崟宸叉彁浜わ紝涓嶈兘閲嶅鎻愪氦"); + return; + } + + // 妫�鏌ユ槸鍚︽湁妫�楠岄」鐩� + if (this.tableData.length === 0) { + this.$showMessage("璇峰厛鑾峰彇妫�楠岄」鐩�"); + return; + } + + // 妫�鏌ユ槸鍚︽墍鏈夋楠岄」鐩兘宸插畬鎴� + const unfinishedItems = this.tableData.filter(item => + item.result === null || item.result === '鏈畬鎴�' + ); + + if (unfinishedItems.length > 0) { + this.$showMessage("杩樻湁妫�楠岄」鐩湭瀹屾垚锛岃鍏堝畬鎴愭墍鏈夋楠岄」鐩�"); + return; + } + + // 纭鎻愪氦 + uni.showModal({ + title: '纭鎻愪氦', + content: '纭畾瑕佹彁浜ゆ妫�楠屽崟鍚楋紵鎻愪氦鍚庡皢鏃犳硶淇敼銆�', + success: (res) => { + if (res.confirm) { + this.$post({ + url: "/RKJ/submitInspection", + data: { + id: this.formData.id, + userNo: this.$loginInfo.account + } + }).then(res => { + if (res.status == 0) { + this.$showMessage("妫�楠屽崟鎻愪氦鎴愬姛锛�"); + // 鏇存柊鏈湴鐘舵�� + this.formData.fsubmit = 1; + // 鍒锋柊鏁版嵁 + this.init(); + } else { + this.$showMessage(res.message || "鎻愪氦澶辫触"); + } + }).catch(error => { + console.error("鎻愪氦澶辫触:", error); + this.$showMessage("鎻愪氦澶辫触锛岃閲嶈瘯"); + }); + } + } + }); + } }, onShow() { //姣忔杩涘叆椤甸潰閮戒細鎵ц鐨勬柟娉� @@ -504,328 +910,575 @@ }; </script> - <style scoped> - /* 鍩虹鏍峰紡 */ - .container { - padding: 10px; - background-color: #f5f7fa; - min-height: 100vh; - } - - /* 澶撮儴鏍峰紡 */ - .header { - background-color: white; - padding: 20px; - border-radius: 8px; - box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05); - margin-bottom: 20px; - } - - .title { - font-size: 24px; - font-weight: 600; - color: #2c3e50; - margin-bottom: 8px; - } - - .order-number { - font-size: 14px; - color: #3498db; - font-weight: 500; - } - - /* 鍖哄煙鏍峰紡 */ - .section { - background-color: white; - border-radius: 8px; - box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05); - margin-bottom: 20px; - overflow: hidden; - } - - .section-header { - background-color: #f8f9fa; - padding: 32px 32px; - border-bottom: 1px solid #eee; - font-size: 20px; - font-weight: 600; - color: #2c3e50; - } - - .section-body { - padding: 56px 40px; - } - - /* 淇℃伅缃戞牸 */ - .info-grid { - display: grid; - grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); - gap: 48px; - } - - .info-item { - display: flex; - flex-direction: column; - gap: 5px; - } - - .info-label { - font-size: 16px; - font-weight: 600; - color: #7f8c8d; - } - - .info-value { - font-size: 18px; - font-weight: 500; - color: #2c3e50; - } - - .info-value.highlight { - font-weight: 600; - color: #3498db; - font-size: 16px; - } - - .info-value.danger { - color: #e74c3c; - font-weight: 500; - } - - /* 杈撳叆妗嗘牱寮� */ - .info-input { - padding: 14px 20px; - border: 1px solid #ddd; - border-radius: 4px; - font-size: 16px; - background-color: white; - } - - /* 閫夋嫨鍣ㄦ牱寮� */ - .picker-input { - border: 1px solid #ddd; - border-radius: 4px; - padding: 14px 20px; - background-color: white; - cursor: pointer; - font-size: 16px; - color: #2c3e50; - } - - /* 妫�楠岄」鐩〃鏍� */ - .inspection-table { - width: 100%; - border-radius: 8px; - overflow: hidden; - box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1); - margin: 25px 0; - } - - .inspection-table table { - width: 100%; - border-collapse: collapse; - } - - .inspection-table th { - background-color: #f8f9fa; - color: #34495e; - padding: 12px 15px; - font-weight: bold; - text-align: left; - border: 1px solid #ddd; - } - - .inspection-table td { - padding: 12px 15px; - text-align: left; - border: 1px solid #ddd; - } - - .inspection-table tr:nth-child(even) { - background-color: #f9f9f9; - } - - .inspection-table tr:hover { - background-color: #f1f5f9; - } - - /* 姘村嵃鏍峰紡 */ - .watermark { - position: absolute; - font-size: 40px; - font-weight: bold; - opacity: 1; - z-index: 1; - pointer-events: none; - transform: rotate(-15deg); - width: 100%; - text-align: center; - top: 50%; - left: 50%; - transform: translate(-50%, -50%) rotate(-15deg); - } - - .watermark.approved { - color: #2ecc71; - } - - .watermark.rejected { - color: #e74c3c; - } - - .watermark.pending { - color: #f39c12; - } - - /* 鎻忚堪鏂囨湰瀹瑰櫒 */ - .description-text { - position: relative; - z-index: 2; - padding: 25px; - background-color: rgba(255, 255, 255, 0.7); - } - - /* 璋冩暣琛ㄦ牸鍗曞厓鏍� */ - .inspection-table td:nth-child(2) { - position: relative; - overflow: hidden; - padding: 0; - } - - .record-btn { - padding: 6px 12px; - background-color: #f8f9fa; - border: 1px solid #ddd; - border-radius: 3px; - cursor: pointer; - transition: all 0.2s; - font-size: 14px; - color: #333; - } - - .record-btn:hover { - background-color: #e9ecef; - } - - - /* 鎿嶄綔鎸夐挳 */ - .action-buttons { - display: flex; - flex-direction: row; - justify-content: flex-end; - gap: 20px; - margin-bottom: 20px; - } - - .action-btn { - padding: 12px 20px; - border: none; - border-radius: 6px; - font-size: 14px; - font-weight: 500; - cursor: pointer; - transition: all 0.2s; - } - - .action-btn.primary { - background-color: #3498db; - color: white; - } - - .action-btn.secondary { - background-color: #95a5a6; - color: white; - } - - .action-btn.danger { - background-color: #e74c3c; - color: white; - } - - .action-btn.warning { - background-color: #f39c12; - color: white; - } - - /* 寮瑰嚭妗嗘牱寮� */ - .overlay { - position: fixed; - top: 0; - left: 0; - width: 100%; - height: 100%; - background-color: rgba(0, 0, 0, 0.5); - display: flex; - justify-content: center; - align-items: center; - z-index: 1000; - } - - .popup { - background-color: white; - border-radius: 8px; - box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15); - width: 90%; - max-width: 400px; - max-height: 80vh; - overflow-y: auto; - } - - .popup-header { - padding: 20px; - border-bottom: 1px solid #eee; - } - - .popup-header h3 { - font-size: 18px; - font-weight: 600; - color: #2c3e50; - margin: 0; - } - - .popup-content { - padding: 20px; - } - - .input-group { - display: flex; - flex-direction: column; - gap: 8px; - } - - .input-label { - font-size: 14px; - color: #7f8c8d; - font-weight: 500; - } - - .input-field { - padding: 8px 12px; - border: 1px solid #ddd; - border-radius: 4px; - font-size: 14px; - background-color: white; - } - - .popup-actions { - padding: 20px; - border-top: 1px solid #eee; - display: flex; - gap: 10px; - justify-content: flex-end; - } - - /* 鍝嶅簲寮忚璁� */ - @media (max-width: 768px) { - .info-grid { - grid-template-columns: 1fr; - gap: 20px; - } - - .action-buttons { - flex-direction: column; - justify-content: flex-start; - gap: 10px; - } - } - </style> \ No newline at end of file + <style> + /* 鏂板缓琛ㄥ崟 - 浼樺寲鍚庣殑UI鏍峰紡 */ + .create-form { + padding: 20px; + background-color: #f5f5f5; + min-height: 100vh; + font-family: 'Microsoft YaHei', 'Segoe UI', sans-serif; + } + + .form-header { + text-align: center; + margin-bottom: 30px; + padding: 20px; + background-color: #fff; + border-radius: 8px; + box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1); + } + + .form-header h2 { + color: #2c3e50; + font-size: 24px; + margin: 0 0 8px 0; + font-weight: 600; + } + + .form-subtitle { + color: #7f8c8d; + font-size: 14px; + margin: 0; + } + + .form-content { + background-color: #fff; + border-radius: 8px; + box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1); + margin-bottom: 20px; + overflow: hidden; + } + + .form-section { + padding: 20px; + border-bottom: 1px solid #ecf0f1; + } + + .form-section:last-child { + border-bottom: none; + } + + .section-title { + font-size: 16px; + font-weight: 600; + color: #2c3e50; + margin-bottom: 15px; + padding-bottom: 8px; + border-bottom: 2px solid #3498db; + display: flex; + align-items: center; + } + + .section-title::before { + content: "鈼�"; + color: #3498db; + margin-right: 8px; + font-size: 12px; + } + + .form-row { + display: flex; + align-items: center; + margin-bottom: 15px; + padding: 12px 0; + transition: all 0.3s ease; + } + + .form-row:hover { + background-color: #f8f9fa; + border-radius: 8px; + padding-left: 8px; + padding-right: 8px; + } + + .form-row:last-child { + margin-bottom: 0; + } + + .form-label { + width: 120px; + font-weight: 500; + color: #34495e; + flex-shrink: 0; + font-size: 14px; + display: flex; + align-items: center; + } + + .form-label.required::after { + content: " *"; + color: #e74c3c; + font-weight: bold; + } + + .form-value { + color: #2c3e50; + flex: 1; + font-weight: 500; + padding: 8px 12px; + background-color: #f8f9fa; + border-radius: 6px; + border: 1px solid #e9ecef; + } + + .form-select { + flex: 1; + padding: 10px 12px; + border: 2px solid #e9ecef; + border-radius: 8px; + background-color: white; + color: #2c3e50; + font-size: 14px; + transition: all 0.3s ease; + } + + .form-select:focus { + border-color: #3498db; + box-shadow: 0 0 0 3px rgba(52, 152, 219, 0.1); + outline: none; + } + + .form-input { + flex: 1; + padding: 15px 12px; + border: 2px solid #e9ecef; + border-radius: 8px; + font-size: 14px; + background-color: white; + color: #2c3e50; + transition: all 0.3s ease; + min-width: 200px; + width: 100%; + min-height: 50px; + } + + .form-input:focus { + border-color: #3498db; + box-shadow: 0 0 0 3px rgba(52, 152, 219, 0.1); + outline: none; + } + + .form-hint { + flex: 1; + color: #95a5a6; + font-size: 14px; + font-style: italic; + padding: 10px 12px; + background-color: #f8f9fa; + border-radius: 8px; + border: 1px dashed #bdc3c7; + } + + .form-actions { + text-align: center; + padding: 20px; + background-color: #fff; + border-radius: 8px; + box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1); + } + + .btn-primary { + background-color: #3498db; + color: white; + padding: 14px 32px; + border: none; + border-radius: 8px; + font-size: 16px; + font-weight: 500; + cursor: pointer; + transition: all 0.3s ease; + display: inline-flex; + align-items: center; + justify-content: center; + gap: 8px; + box-shadow: 0 2px 8px rgba(52, 152, 219, 0.3); + } + + .btn-primary:hover { + transform: translateY(-2px); + box-shadow: 0 6px 20px rgba(52, 152, 219, 0.4); + } + + .btn-primary:active { + transform: translateY(0); + } + + .btn-primary:disabled { + background: #bdc3c7; + cursor: not-allowed; + transform: none; + box-shadow: none; + } + + .btn-icon { + font-size: 16px; + font-weight: bold; + } + + /* 鏌ョ湅/缂栬緫琛ㄥ崟 - LLJ绫讳技鐨勬牱寮� */ + .inspection-sheet { + font-family: 'Microsoft YaHei', 'Segoe UI', sans-serif; + max-width: 1000px; + margin: 0 auto; + padding: 20px 20px 100px 20px; /* 搴曢儴澧炲姞鍐呰竟璺濅负鍥哄畾鎸夐挳鐣欑┖闂� */ + background-color: #fff; + box-shadow: 0 0 10px rgba(0, 0, 0, 0.1); + min-height: 100vh; + position: relative; + } + + /* 澶撮儴鏍峰紡 */ + .sheet-header { + text-align: center; + margin-bottom: 20px; + padding-bottom: 15px; + border-bottom: 2px solid #e0e0e0; + } + + .sheet-header h1 { + color: #2c3e50; + font-size: 24px; + margin-bottom: 5px; + } + + .inspection-number { + font-size: 16px; + font-weight: bold; + color: #3498db; + } + + /* 鍩烘湰淇℃伅鍖烘牱寮� */ + .basic-info, + .material-info { + margin-bottom: 20px; + } + + .info-row { + display: flex; + margin-bottom: 10px; + flex-wrap: wrap; + } + + .info-label { + font-weight: bold; + color: #34495e; + min-width: 80px; + margin-right: 5px; + } + + .info-value { + color: #2c3e50; + margin-right: 20px; + } + + .picker-text { + padding: 6px 10px; + border: 1px solid #ddd; + border-radius: 4px; + background-color: white; + color: #999; + font-size: 14px; + min-height: 32px; + display: flex; + align-items: center; + max-width: 150px; + } + + .picker-text.selected { + color: #e74c3c; + font-weight: 500; + } + + .highlight { + font-weight: bold; + color: #e74c3c; + } + + /* 鐗╂枡淇℃伅鍖烘牱寮� */ + .material-info { + border: 1px solid #eee; + padding: 15px; + border-radius: 5px; + } + + .info-block { + display: flex; + align-items: center; + margin-bottom: 10px; + flex-wrap: wrap; + } + + .dropdown-row { + display: flex; + align-items: center; + margin-bottom: 10px; + } + + /* 琛ㄦ牸鏍峰紡 */ + .inspection-table { + margin: 25px 0; + } + + .inspection-table table { + width: 100%; + border-collapse: collapse; + } + + .inspection-table th, + .inspection-table td { + padding: 12px 15px; + border: 1px solid #ddd; + text-align: left; + } + + .inspection-table th { + background-color: #f8f9fa; + font-weight: bold; + color: #34495e; + } + + .inspection-table tr:nth-child(even) { + background-color: #f9f9f9; + } + + .inspection-table tr:hover { + background-color: #f1f5f9; + } + + /* 姘村嵃鏍峰紡 */ + .watermark { + position: absolute; + font-size: 40px; + font-weight: bold; + opacity: 1; + z-index: 1; + pointer-events: none; + transform: rotate(-15deg); + width: 100%; + text-align: center; + top: 50%; + left: 50%; + transform: translate(-50%, -50%) rotate(-15deg); + } + + .watermark.approved { + color: #2ecc71; + } + + .watermark.rejected { + color: #e74c3c; + } + + .watermark.pending { + color: #f39c12; + } + + /* 鎻忚堪鏂囨湰瀹瑰櫒 */ + .description-text { + position: relative; + z-index: 2; + padding: 25px; + background-color: rgba(255, 255, 255, 0.7); + } + + /* 璋冩暣琛ㄦ牸鍗曞厓鏍� */ + .inspection-table td:nth-child(2) { + position: relative; + overflow: hidden; + padding: 0; + } + + /* 琛ㄥ崟涓婃柟鎿嶄綔鎸夐挳鍖烘牱寮� */ + .top-action-buttons { + display: flex; + justify-content: flex-end; + gap: 10px; + margin: 20px 0; + padding: 15px; + background-color: #f8f9fa; + border-radius: 8px; + border: 1px solid #e9ecef; + } + + /* 琛ㄥ崟涓嬫柟鎿嶄綔鎸夐挳鍖烘牱寮� */ + .bottom-action-buttons { + display: flex; + justify-content: center; + gap: 8px; + padding: 12px; + flex-wrap: wrap; + align-items: center; + position: fixed; /* 鍥哄畾鍦ㄥ睆骞曞簳閮� */ + bottom: 0; /* 璺濈搴曢儴0px */ + left: 0; /* 璺濈宸﹁竟0px */ + right: 0; /* 璺濈鍙宠竟0px */ + background-color: #fff; /* 鑳屾櫙鑹� */ + border-top: 1px solid #e9ecef; /* 椤堕儴杈规 */ + z-index: 1000; /* 纭繚鍦ㄦ渶涓婂眰 */ + box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.1); /* 椤堕儴闃村奖 */ + } + + .action-btn { + background-color: #ecf0f1; + color: #34495e; + padding: 12px 15px; + border: none; + border-radius: 6px; + cursor: pointer; + font-size: 14px; + font-weight: 500; + transition: all 0.3s ease; + text-align: center; + min-height: 44px; + display: flex; + align-items: center; + justify-content: center; + } + + .action-btn:hover { + background-color: #d5dbdb; + transform: translateY(-1px); + } + + .action-btn.primary { + background-color: #3498db; + color: #fff; + } + + .action-btn.primary:hover { + background-color: #2980b9; + } + + /* 灏忓昂瀵告寜閽牱寮� */ + .action-btn.small { + padding: 10px 12px; + font-size: 14px; + min-height: 44px; + white-space: nowrap; + flex-shrink: 0; + min-width: 80px; + max-width: 120px; + flex: 1; + } + + .record-btn { + padding: 6px 12px; + background-color: #f8f9fa; + border: 1px solid #ddd; + border-radius: 3px; + cursor: pointer; + transition: all 0.2s; + font-size: 14px; + color: #333; + } + + .record-btn:hover { + background-color: #e9ecef; + } + + /* 寮瑰嚭妗嗘牱寮� */ + .overlay { + position: fixed; + top: 0; + left: 0; + width: 100%; + height: 100%; + background-color: rgba(0, 0, 0, 0.5); + display: flex; + justify-content: center; + align-items: center; + z-index: 1000; + } + + .popup { + background-color: white; + border-radius: 8px; + box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15); + width: 90%; + max-width: 400px; + max-height: 80vh; + overflow-y: auto; + padding: 20px; + } + + .popup h3 { + font-size: 18px; + font-weight: 600; + color: #2c3e50; + margin: 0 0 20px 0; + } + + .form-group { + margin-bottom: 15px; + } + + .form-label { + display: block; + font-size: 14px; + color: #7f8c8d; + font-weight: 500; + margin-bottom: 5px; + } + + .form-input { + width: 100%; + padding: 8px 12px; + border: 1px solid #ddd; + border-radius: 4px; + font-size: 14px; + background-color: white; + box-sizing: border-box; + } + + .updateBut { + background-color: #3498db; + color: white; + padding: 10px 20px; + border: none; + border-radius: 4px; + cursor: pointer; + font-size: 14px; + margin-right: 10px; + } + + .updateBut:hover { + background-color: #2980b9; + } + + /* 鏃犳暟鎹彁绀烘牱寮� */ + .no-data-tip { + text-align: center; + padding: 40px 20px; + background-color: #f8f9fa; + border: 1px dashed #ddd; + border-radius: 8px; + margin: 20px 0; + } + + /* 鍝嶅簲寮忚璁� */ + @media (max-width: 768px) { + .info-row { + flex-direction: column; + } + + .info-block { + flex-direction: column; + align-items: flex-start; + } + + .dropdown-row { + flex-direction: column; + align-items: flex-start; + } + + .bottom-action-buttons { + flex-direction: column; + gap: 5px; + } + + .action-btn.small { + min-width: 100%; + max-width: none; + } + } +</style> \ No newline at end of file diff --git a/pages/QC/XJ/Add.vue b/pages/QC/XJ/Add.vue index e393806..7dbd87b 100644 --- a/pages/QC/XJ/Add.vue +++ b/pages/QC/XJ/Add.vue @@ -110,17 +110,24 @@ </view> </view> - <!-- 鎿嶄綔鎸夐挳 --> - <view class="action-buttons"> - <button class="action-btn primary" v-if="isUpdate && !isShowTable" @click="getItem">鍒涘缓妫�楠屽崟骞剁敓鎴愰儴鍒嗛粯璁ゅ��</button> - <button class="action-btn secondary" v-if="!isUpdate && !isShowTable" @click="toImage">涓婁紶/鏌ョ湅鍥剧墖</button> - <button class="action-btn danger" v-if="!isUpdate && !formData.fcheckResu && !isShowTable" @click="removeXJ">鍒犻櫎鍗曟嵁</button> - <button class="action-btn warning" v-if="!isUpdate && !isShowTable" @click="saveRemarks">娣诲姞涓嶅悎鏍兼弿杩�</button> - <button class="action-btn primary" v-if="isShowTable" @click="getTable">鑾峰彇妫�楠岄」鐩�</button> - <button class="action-btn primary" v-if="isShowTable && isUpdate" @click="saveTable">鐢熸垚妫�楠岄」鐩�</button> - <button class="action-btn success" v-if="!isUpdate && !isShowTable" @click="getGenUpdate">鑾峰彇妫�楠岄」鐩�</button> - <button class="action-btn success" v-if="!isUpdate && !isShowTable" @click="submitInspection">鎻愪氦妫�楠�</button> - </view> + <!-- 鎿嶄綔鎸夐挳 --> + <view class="action-buttons"> + <!-- 鏂板缓鍗曟嵁鏃剁殑鍒涘缓鎸夐挳 --> + <button class="action-btn primary" v-if="isUpdate && !isShowTable" @click="save"> + 鍒涘缓妫�楠屽崟骞剁敓鎴愰儴鍒嗛粯璁ゅ�� + </button> + + <!-- 宸叉湁鍗曟嵁鐨勬搷浣滄寜閽� --> + <button class="action-btn secondary" v-if="!isUpdate && !isShowTable" @click="toImage">涓婁紶/鏌ョ湅鍥剧墖</button> + <button class="action-btn danger" v-if="!isUpdate && !formData.fcheckResu && !isShowTable && formData.fsubmit !== 1" @click="removeXJ">鍒犻櫎鍗曟嵁</button> + <button class="action-btn warning" v-if="!isUpdate && !isShowTable && formData.fsubmit !== 1" @click="saveRemarks">娣诲姞涓嶅悎鏍兼弿杩�</button> + + <!-- 妫�楠岄」鐩鐞嗘寜閽� --> + <button class="action-btn primary" v-if="isShowTable" @click="getTable">鑾峰彇妫�楠岄」鐩�</button> + <button class="action-btn primary" v-if="isShowTable && isUpdate" @click="saveTable">鐢熸垚妫�楠岄」鐩�</button> + <button class="action-btn success" v-if="!isUpdate && !isShowTable && formData.fsubmit !== 1" @click="getGenUpdate">鑾峰彇妫�楠岄」鐩�</button> + <button class="action-btn success" v-if="!isUpdate && !isShowTable && formData.fsubmit !== 1" @click="submitInspection">鎻愪氦妫�楠�</button> + </view> <!-- 淇敼涓嶅悎鏍兼弿杩板脊鍑烘 --> <view v-if="remarksPopup" class="overlay"> <view class="popup"> @@ -147,23 +154,27 @@ export default { data() { return { - formData: { - id: "", - releaseNo: "", - createBy: "", - createDate: "", - daa020: "", - itemNo: "", - billNo: "", - catQty: "", - detailMem: "", - taskNo: "", - fcheckResu: "", - boardModel: "", - planQty: "", - mocode: "", - boardStyle: "" - }, + formData: { + id: "", + releaseNo: "", + createBy: "", + createDate: "", + daa020: "", + daa002: "", // 娣诲姞浜у搧ID瀛楁 + itemNo: "", + itemName: "", // 娣诲姞鐗╂枡鍚嶇О + itemModel: "", // 娣诲姞瑙勬牸鍨嬪彿 + billNo: "", + catQty: "", + detailMem: "", + taskNo: "", + fcheckResu: "", + fsubmit: 0, // 娣诲姞鎻愪氦鐘舵�佸瓧娈� + boardModel: "", + planQty: "", + mocode: "", + boardStyle: "" + }, DAA020List: [], DAA020Index: -1, @@ -270,29 +281,75 @@ this.$showMessage("璇峰厛閫夋嫨妫�楠屽崟鍙�"); } }, - getItem() { - + save() { + // 楠岃瘉蹇呭~瀛楁 - 鍊熼壌SJ鐨勯獙璇侀�昏緫锛屼絾淇濇寔XJ鐨勫瓧娈甸獙璇� + if (!this.formData.billNo) { + this.$showMessage("璇烽�夋嫨宸ュ崟鍗曞彿"); + return; + } + + if (!this.formData.itemNo) { + this.$showMessage("鐗╂枡淇℃伅鑾峰彇澶辫触锛岃閲嶆柊閫夋嫨宸ュ崟"); + return; + } + + if (!this.tableData || this.tableData.length === 0) { + this.$showMessage("姝ょ墿鏂欐病鏈夊惎鐢ㄧ殑妫�楠岄」鐩紝璇风淮鎶�!"); + return; + } - - if (!this.formData.billNo) { - this.$showMessage("璇烽�夋嫨宸ュ崟鍗曞彿"); - return; - } - - this.$post({ - url: "/XJ/save", - data: { - from: this.formData, - userNo: this.$loginInfo.account, - items: this.tableData - } - }).then(res => { - this.formData.id = res.data.tbBillList; - this.$showMessage("鐢熸垚妫�楠岄」鐩垚鍔�"); - this.init(); - this.isUpdate = false; - }); - }, + const saveData = { + ReleaseNo: this.formData.releaseNo, + ItemNo: this.formData.itemNo, + BillNo: this.formData.billNo, + DepartmentId: this.selectedDepartment, // 鍙娇鐢ㄩ儴闂↖D + WorkShop: null, // 鏄庣‘璁剧疆涓簄ull锛岄伩鍏嶆暟鎹簱瀛楁閿欒 + ItemId: this.formData.daa002, // 浣跨敤宸ュ崟涓殑浜у搧ID + PlanQty: this.formData.planQty, + CreateBy: this.formData.createBy, + CreateDate: this.formData.createDate, + FcheckDate: new Date(), + Remarks: this.formData.remarks || "" + }; + + // 璋冭瘯淇℃伅 + console.log("鍒涘缓妫�楠屽崟鏁版嵁:", { + formData: this.formData, + selectedDepartment: this.selectedDepartment, + WORKSHOP: this.WORKSHOP, + saveData: saveData, + tableData: this.tableData + }); + + this.$post({ + url: "/XJ/save", + data: { + from: saveData, + userNo: this.$loginInfo.account, + items: this.tableData + } + }).then(res => { + if (res.data.tbBillList) { + this.formData.id = res.data.tbBillList; + + // 濡傛灉杩斿洖浜嗗畬鏁寸殑妫�楠岄」鐩俊鎭紝鏇存柊tableData + if (res.data.xjDto && res.data.xjDto.items) { + this.tableData = res.data.xjDto.items; + } + + this.$showMessage("鍒涘缓妫�楠屽崟骞剁敓鎴愰粯璁ゅ�兼垚鍔�"); + this.isUpdate = false; + + // 鏇存柊formData鐨勫叾浠栧瓧娈� + this.formData = { ...this.formData, ...saveData }; + } else { + this.$showMessage("鍒涘缓妫�楠屽崟澶辫触锛岃妫�鏌ユ暟鎹�"); + } + }).catch(err => { + console.error("鍒涘缓妫�楠屽崟閿欒:", err); + this.$showMessage("鍒涘缓妫�楠屽崟澶辫触锛�" + (err.message || "鏈煡閿欒")); + }); + }, // 鍔犺浇閮ㄩ棬鍒楄〃 loadDepartments() { @@ -374,20 +431,28 @@ this.DAA020Index = event.mp.detail.value; this.lineNo = this.lineList[this.DAA020Index].lineNo; + // 璁剧疆绾夸綋缂栧彿鍒癴ormData + this.formData.daa020 = this.lineList[this.DAA020Index].lineName; this.$post({ - url: "/XJ/getDaa001", + url: "/XJ/getWorkOrderWithItem", // 璋冪敤鏂扮殑API鑾峰彇宸ュ崟璇︾粏淇℃伅 data: { daa020: this.lineNo } }).then(res => { //濉厖宸ュ崟鍙风殑鏁版嵁婧� this.schemeResult = res.data.tbBillList; - this.DAA001List = this.schemeResult.map(s => s.Daa001); + this.DAA001List = this.schemeResult.map(s => s.daa001); // 淇敼涓哄皬鍐� //鍙樹负榛樿绌哄�肩殑鐘舵�� this.DAA001Index = -1; this.formData.billNo = ""; + // 娓呯┖鐗╂枡淇℃伅 + this.formData.itemNo = ""; + this.formData.itemName = ""; + this.formData.itemModel = ""; + this.formData.planQty = ""; + this.tableData = []; }) }, @@ -396,13 +461,16 @@ onDaa001Change(event) { this.DAA001Index = event.mp.detail.value; const selectedWorkOrder = this.schemeResult[this.DAA001Index]; - this.formData.billNo = selectedWorkOrder.Daa001; - this.formData.planQty = selectedWorkOrder.Daa008; + + // 璁剧疆宸ュ崟淇℃伅 + this.formData.billNo = selectedWorkOrder.daa001; // 淇敼涓哄皬鍐� + this.formData.planQty = selectedWorkOrder.daa008; // 淇敼涓哄皬鍐� + this.formData.daa002 = selectedWorkOrder.daa002; // 璁剧疆浜у搧ID // 浠庡伐鍗曟暟鎹腑鑾峰彇鐗╂枡淇℃伅 - this.formData.itemNo = selectedWorkOrder.ItemNo; // 鐗╂枡缂栫爜 - this.formData.itemName = selectedWorkOrder.ItemName; // 鐗╂枡鍚嶇О - this.formData.itemModel = selectedWorkOrder.ItemModel; // 瑙勬牸鍨嬪彿 + this.formData.itemNo = selectedWorkOrder.itemNo; // 淇敼涓哄皬鍐� + this.formData.itemName = selectedWorkOrder.itemName; // 淇敼涓哄皬鍐� + this.formData.itemModel = selectedWorkOrder.itemModel; // 淇敼涓哄皬鍐� // 鑾峰彇妫�楠岄」鐩� this.$post({ @@ -419,46 +487,53 @@ this.isSubmit = true; this.tableData = []; } + }).catch(err => { + console.error("鑾峰彇妫�楠岄」鐩敊璇�:", err); + this.$showMessage("鑾峰彇妫�楠岄」鐩け璐�"); + this.tableData = []; }); }, - init() { - this.$post({ - url: "/XJ/getPage", - data: { - id: this.formData.id, - pageIndex: 1, - limit: 1, - } - }).then(res => { - let data = res.data.tbBillList[0]; - if (data) { - this.formData = data; - - this.$post({ - url: "/XJ/getJYItem", - data: { - pid: this.formData.id - } - }).then(res1 => { - let tableData = res1.data.tbBillList - //褰撳凡妫�楠屼釜鏁伴兘涓嶄负绌烘椂鎸夌収妫�娴嬬粨鏋勬帓搴� - tableData.sort((a, b) => { - if (a.result === '鏈畬鎴�' && b.result === '鍚堟牸') { - return -1; - } else if (a.result === '鍚堟牸' && b.result === '鏈畬鎴�') { - return 1; - } else { - return 0; - } - }); - this.tableData = tableData; - if (this.tableData.length === 0) { - this.isShowTable = true; - } - }) - } - }); - }, + init() { + this.$post({ + url: "/XJ/getPage", + data: { + id: this.formData.id, + pageIndex: 1, + limit: 1, + } + }).then(res => { + let data = res.data.tbBillList[0]; + if (data) { + this.formData = data; + + // 涓嶅啀鏍规嵁fsubmit瀛楁淇敼isUpdate鐘舵�� + // 鑰屾槸閫氳繃鎸夐挳鐨剉-if鏉′欢鏉ユ帶鍒舵樉绀� + + this.$post({ + url: "/XJ/getJYItem", + data: { + pid: this.formData.id + } + }).then(res1 => { + let tableData = res1.data.tbBillList + //褰撳凡妫�楠屼釜鏁伴兘涓嶄负绌烘椂鎸夌収妫�娴嬬粨鏋勬帓搴� + tableData.sort((a, b) => { + if (a.result === '鏈畬鎴�' && b.result === '鍚堟牸') { + return -1; + } else if (a.result === '鍚堟牸' && b.result === '鏈畬鎴�') { + return 1; + } else { + return 0; + } + }); + this.tableData = tableData; + if (this.tableData.length === 0) { + this.isShowTable = true; + } + }) + } + }); + }, toDetail(item) { if (this.isUpdate) { uni.showToast({ -- Gitblit v1.9.3