From 7c803e1ce6c6d9765a99203544bf200ecd52aa2d Mon Sep 17 00:00:00 2001 From: cnf <3200815559@qq.com> Date: 星期三, 17 九月 2025 14:04:40 +0800 Subject: [PATCH] 首检巡检入库检修改,增加bom物料plm图纸查看 --- pages/QC/RKJ/Add.vue | 3465 +++++++++++++++++++++++++++++++++-------------------------- 1 files changed, 1,950 insertions(+), 1,515 deletions(-) diff --git a/pages/QC/RKJ/Add.vue b/pages/QC/RKJ/Add.vue index ceb1d79..1c04a15 100644 --- a/pages/QC/RKJ/Add.vue +++ b/pages/QC/RKJ/Add.vue @@ -5,7 +5,7 @@ <h2>鏂板缓鍏ュ簱妫�楠屽崟</h2> <p class="form-subtitle">璇锋寜椤哄簭濉啓浠ヤ笅淇℃伅</p> </view> - + <view class="form-content"> <!-- 妫�楠屽崟鍙� --> <view class="form-section"> @@ -15,92 +15,82 @@ <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> + <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> + 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> + 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="large-quantity-input" - @input="onQuantityChange"/> + <input type="number" v-model="formData.quantity" placeholder="璇疯緭鍏ラ�佹鏁伴噺" class="large-quantity-input" + @input="onQuantityChange" /> </view> </view> - + <!-- 浜у搧淇℃伅 --> - <view class="form-section" v-if="formData.itemName || formData.itemNo || formData.itemModel || formData.planQty"> + <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 class="form-row" v-if="formData.rbillNo"> <label class="form-label">閫佹鎵规锛�</label> <span class="form-value">{{formData.rbillNo}}</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"> + <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"> + <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"> <!-- 澶撮儴淇℃伅 --> @@ -192,7 +182,8 @@ </view> <view class="dropdown-row"> <view class="info-label">涓嶈壇鎻忚堪锛�</view> - <input v-if="!isUpdate" v-model="formData.fngDesc" placeholder="璇疯緭鍏ヤ笉鑹弿杩�" class="input-field" @blur="saveFngDesc" /> + <input v-if="!isUpdate" v-model="formData.fngDesc" placeholder="璇疯緭鍏ヤ笉鑹弿杩�" class="input-field" + @blur="saveFngDesc" /> <view v-else class="info-value">{{ formData.fngDesc }}</view> </view> @@ -227,7 +218,8 @@ <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-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> @@ -241,9 +233,16 @@ <!-- 琛ㄥ崟涓嬫柟鎿嶄綔鎸夐挳鍖� --> <view class="bottom-action-buttons"> <button class="action-btn small" @click="toImage">涓婁紶/鏌ョ湅鍥剧墖</button> + <button class="action-btn small" @click="fetchDrawingNumber(formData.itemNo)"> + 璋冨彇PLM鍥剧焊 + </button> + <button class="action-btn small" @click="getBom"> + Bom鐢ㄦ枡娓呭崟 + </button> <button class="action-btn small" @click="viewAttachmentInfo">鏌ョ湅闄勪欢淇℃伅</button> <button class="action-btn small" @click="saveRemarks" v-if="formData.fsubmit != 1">娣诲姞涓嶅悎鏍兼弿杩�</button> - <button class="action-btn small primary" @click="submitInspection" v-if="formData.fsubmit != 1 && tableData.length > 0">鎻愪氦妫�楠�</button> + <button class="action-btn small primary" @click="submitInspection" + v-if="formData.fsubmit != 1 && tableData.length > 0">鎻愪氦妫�楠�</button> </view> <!-- 淇敼涓嶅悎鏍兼弿杩板脊鍑烘 --> @@ -253,7 +252,7 @@ <form> <view class="form-group"> <label class="form-label">涓嶅悎鏍兼弿杩�:</label> - <input class="form-input" type="text" v-model="remarks" placeholder="璇疯緭鍏ヤ笉鍚堟牸鎻忚堪"/> + <input class="form-input" type="text" v-model="remarks" placeholder="璇疯緭鍏ヤ笉鍚堟牸鎻忚堪" /> </view> </form> <button class="updateBut" @click="edit">淇敼</button> @@ -267,20 +266,27 @@ <h3 class="attachment-popup-title">闄勪欢璇︽儏</h3> <div class="attachment-popup-divider"></div> <div v-if="selectedAttachment" class="attachment-detail-content"> - <div class="attachment-detail-row"><span class="attachment-label">ID锛�</span><span>{{ Math.trunc(selectedAttachment.id) }}</span></div> - <div class="attachment-detail-row"><span class="attachment-label">闄勪欢鍚嶏細</span><span>{{ selectedAttachment.fattach }}</span></div> - <div class="attachment-detail-row"><span class="attachment-label">绫诲瀷锛�</span><span>{{ selectedAttachment.ftype }}</span></div> - <div class="attachment-detail-row"><span class="attachment-label">鐗堟湰锛�</span><span>{{ selectedAttachment.fversion }}</span></div> - <div class="attachment-detail-row"><span class="attachment-label">鍙楁帶鏃ユ湡锛�</span><span>{{ selectedAttachment.fdate }}</span></div> - <div class="attachment-detail-row"><span class="attachment-label">涓婁紶浜猴細</span><span>{{ selectedAttachment.createBy }}</span></div> - <div class="attachment-detail-row"><span class="attachment-label">涓婁紶鏃堕棿锛�</span><span>{{ selectedAttachment.createDate }}</span></div> + <div class="attachment-detail-row"><span + class="attachment-label">ID锛�</span><span>{{ Math.trunc(selectedAttachment.id) }}</span> + </div> + <div class="attachment-detail-row"><span + class="attachment-label">闄勪欢鍚嶏細</span><span>{{ selectedAttachment.fattach }}</span></div> + <div class="attachment-detail-row"><span + class="attachment-label">绫诲瀷锛�</span><span>{{ selectedAttachment.ftype }}</span></div> + <div class="attachment-detail-row"><span + class="attachment-label">鐗堟湰锛�</span><span>{{ selectedAttachment.fversion }}</span></div> + <div class="attachment-detail-row"><span + class="attachment-label">鍙楁帶鏃ユ湡锛�</span><span>{{ selectedAttachment.fdate }}</span></div> + <div class="attachment-detail-row"><span + class="attachment-label">涓婁紶浜猴細</span><span>{{ selectedAttachment.createBy }}</span></div> + <div class="attachment-detail-row"><span + class="attachment-label">涓婁紶鏃堕棿锛�</span><span>{{ selectedAttachment.createDate }}</span></div> <div class="attachment-actions-detail"> - <button class="attachment-action-btn preview-btn" - @click="previewFtpFile(selectedAttachment)" + <button class="attachment-action-btn preview-btn" @click="previewFtpFile(selectedAttachment)" v-if="isPreviewable(selectedAttachment.fattach)"> 馃攳 鍦ㄧ嚎棰勮 </button> - <button class="attachment-action-btn download-btn" + <button class="attachment-action-btn download-btn" @click="downloadAttachment(selectedAttachment)"> 馃摜 涓嬭浇鏂囦欢 </button> @@ -309,7 +315,7 @@ </div> <div class="attachment-actions"> <button class="secondary-btn" @click="showAttachmentDetailDialog(item)">璇︽儏</button> - <button class="secondary-btn preview-btn" @click="previewFtpFile(item)" + <button class="secondary-btn preview-btn" @click="previewFtpFile(item)" v-if="isPreviewable(item.fattach)">棰勮</button> <button class="secondary-btn" @click="downloadAttachment(item)">涓嬭浇</button> </div> @@ -318,7 +324,64 @@ <button class="attachment-popup-close" @click="closeAttachmentPopup">鍏抽棴</button> </view> </view> - + + + <view class="barcode"> + <u-modal :show="itemShow" title="鐗╂枡鏄庣粏" @confirm="drawingConfirm" @cancel="itemCancel" showCancelButton + :z-index="1000"> + <uni-table border stripe emptyText="鏆傛棤鏇村鏁版嵁" + style="margin-left: 5px;margin-right: 5px;height: 400px;max-height: 60vh;overflow-y: auto;"> + <uni-tr> + <uni-th align="center">鏂欏彿</uni-th> + <uni-th align="center" width="90">鍚嶇О</uni-th> + <uni-th align="center" width="90">瑙勬牸鍨嬪彿</uni-th> + <uni-th align="center" width="150">璋冨彇PLM鍥剧焊</uni-th> + </uni-tr> + <uni-tr v-for="(item,index) in (drawing || [])" style="height: 100px;"> + <uni-td align="center">{{item.itemNo}}</uni-td> + <uni-td align="center"> + <div>{{item.itemName}}</div> + </uni-td> + <uni-td align="center"> + <div>{{item.itemModel}}</div> + </uni-td> + <uni-td align="center" class="click-wd"> + <div @click="fetchDrawingNumber(item.itemNo)">璋冨彇鍥剧焊</div> + </uni-td> + </uni-tr> + </uni-table> + </u-modal> + </view> + + <view class="barcode"> + <u-modal :show="drawingShow" title="鍥剧焊鏄庣粏" @confirm="drawingConfirm" @cancel="drawingCancel" showCancelButton + :z-index="1000"> + <uni-table border stripe emptyText="鏆傛棤鏇村鏁版嵁" + style="margin-left: 5px;margin-right: 5px;height: 400px;max-height: 60vh;overflow-y: auto;"> + <uni-tr> + <uni-th align="center">鐩稿叧鏂囨。</uni-th> + <uni-th align="center" width="90">鏈夋棤鍏宠仈PDF鏂囦欢</uni-th> + <uni-th align="center" width="90">鑳藉惁鎵撳紑鏂囦欢</uni-th> + <uni-th align="center" width="150">鎿嶄綔锛堢偣鍑伙級</uni-th> + </uni-tr> + <uni-tr v-for="(item,index) in (drawing || [])" style="height: 100px;"> + <uni-td align="center">{{item.fName}}</uni-td> + <uni-td align="center" style="font-size:25px;"> + <div v-if="item.fRelevantObject==' '" style="color: #E47470;">脳</div> + <div style="color: #90BA87;" v-else>鈭�</div> + </uni-td> + <uni-td align="center" style="font-size:25px;"> + <div v-if="item.isSupported || item.fRelevantObject!=' '" style="color: #90BA87;">鈭�</div> + <div style="color: #E47470;" v-else>脳</div> + </uni-td> + <uni-td align="center" class="click-wd"> + <div @click="openDrawings(item)">鎵撳紑鏂囨。</div> + </uni-td> + </uni-tr> + </uni-table> + </u-modal> + </view> + <!-- 鏂囦欢棰勮寮圭獥 --> <view v-if="showFilePreviewPopup" class="overlay"> <view class="popup file-preview-popup"> @@ -327,26 +390,21 @@ <div class="file-preview-content"> <!-- 鏂囨湰鍐呭棰勮 --> <pre v-if="previewType === 'text'">{{ previewContent }}</pre> - + <!-- 鍥剧墖鍐呭棰勮 --> <view v-else-if="previewType === 'image'" class="image-preview-container"> - <image - :src="previewContent" - mode="aspectFit" - class="preview-image-clickable" - @click="previewImageInPopup" - style="width: 100%; max-height: 400px; cursor: pointer;" - /> + <image :src="previewContent" mode="aspectFit" class="preview-image-clickable" + @click="previewImageInPopup" style="width: 100%; max-height: 400px; cursor: pointer;" /> <div class="image-zoom-hint">鐐瑰嚮鍥剧墖鍙斁澶ф煡鐪�</div> </view> - + <!-- Excel 绛� Office 鏂囦欢鎻愮ず --> <view v-else-if="previewType === 'excel'" class="unsupported-preview"> <view class="unsupported-icon">馃搳</view> <view class="unsupported-text">Excel 鏂囦欢鏆備笉鏀寔鍦ㄧ嚎棰勮</view> <view class="unsupported-hint">璇风偣鍑讳笅杞芥寜閽幏鍙栧畬鏁存枃浠�</view> </view> - + <!-- 涓嶆敮鎸佺殑鏂囦欢绫诲瀷 --> <view v-else class="unsupported-preview"> <view class="unsupported-icon">馃搫</view> @@ -355,1367 +413,1735 @@ </view> </div> <div class="file-preview-actions"> - <button v-if="previewType !== 'text'" class="file-preview-btn download-btn" @click="downloadPreviewFile">馃摜 涓嬭浇鏂囦欢</button> + <button v-if="previewType !== 'text'" class="file-preview-btn download-btn" + @click="downloadPreviewFile">馃摜 涓嬭浇鏂囦欢</button> <button class="file-preview-btn close-btn" @click="closeFilePreview">鍏抽棴</button> </div> </view> </view> </view> </template> - - <script> - export default { - data() { - return { - formData: { - id: "", - releaseNo: "", - createBy: "", - createDate: "", - daa020: "", - itemNo: "", - itemId: "", // 鐗╂枡ID - billNo: "", - lineNo: "", // 鐢熶骇绾跨紪鍙� - catQty: "", - detailMem: "", - taskNo: "", - fcheckResu: "", - fsubmit: "", // 鎻愪氦鐘舵�� - remarks: "", - rbillNo: "", - workShop: "", // 宸ヤ綔杞﹂棿 - lineName: "", // 绾夸綋鍚嶇О - quantity: "", // 閫佹鏁伴噺 - planQty: "", // 宸ュ崟璁″垝鏁伴噺 - fngDesc: "" // 涓嶈壇鎻忚堪 - }, - - DAA020List: [], - - DAA001List: [], - - BillNoList: [], - - lineList: [], - - lineNo: "", - - tableData: [], - - isSubmit: true, - - isUpdate: true, - - isShowTable: false, - - remarks: "", - - showPopup: false, - departmentList: [], // 杞﹂棿鍒楄〃 - selectedDepartmentId: "", // 閫変腑鐨勮溅闂碔D - // 闄勪欢鐩稿叧鏁版嵁 - attachments: [], - showAttachmentPopup: false, - attachmentsLoading: false, - selectedAttachment: null, - showAttachmentDetail: false, - showFilePreviewPopup: false, - previewContent: '', - previewTitle: '', - previewItemNo: '', - previewType: '', // 'text', 'image', 'excel', 'unsupported' - - // 鏂板涓嬫媺妗嗙浉鍏虫暟鎹� - badreason: '', - PSTYPE: '', - WORKSHOP: '', - badreasonOptions: ['', '澶栬涓嶈壇', '灏哄涓嶈壇', '鍖呰涓嶈壇', '鎬ц兘涓嶈壇', '瑁呴厤涓嶈壇', '瀹夎涓嶈壇'], - badreasonIndex: 0, - workshopOptions: ['', '鐢熶骇涓�閮�', '鐢熶骇浜岄儴', '娉ㄥ杞﹂棿', '鍏朵粬'], - workshopIndex: 0, - pstypeOptions: ['', '鐗归噰/璁╂浣跨敤', '鎸戦��/杩斿伐浣跨敤', '閫�璐�', '寰呭垽'], - pstypeIndex: 0, - }; - }, - onLoad(options) { - //options涓寘鍚簡url闄勫甫鐨勫弬鏁� - - let params = options; - - if (params["id"]) { - this.isUpdate = false; - this.formData.id = params["id"]; - this.formData.releaseNo = params["releaseNo"]; - //getQaItemXj02 - this.init(); - } else { - //鍒濆鍖栨楠屽崟鍙� - this.$post({ - url: "/RKJ/getMaxReleaseNo" - }).then(res => { - this.formData.releaseNo = res.data.tbBillList; - this.formData.createBy = this.$loginInfo.account; - this.formData.createDate = this.$getDate("yyyy-mm-dd"); - }); - // 鍒濆鍖栬溅闂翠笅鎷夋 - this.$post({ - url: "/RKJ/GetDepartmentsWithLines" - }).then(res => { - this.departmentList = res.data.tbBillList.map(item => item.departmentname); - }) - } - }, - methods: { - getStatusClass(result) { - if (result === '鍚堟牸') return 'status-pass'; - if (result === '涓嶅悎鏍�') return 'status-fail'; - return 'status-pending'; - }, - - getStatusText(status) { - const statusMap = { - approved: '鍚堟牸', - rejected: '涓嶅悎鏍�', - pending: '寰呯‘璁�' - } - if (status == null || status == '鏈畬鎴�') { - return statusMap['pending'] || '寰呯‘璁�'; - } else if (status == '鍚堟牸') { - return statusMap['approved'] || '鍚堟牸'; - } else { - return statusMap['rejected'] || '涓嶅悎鏍�'; - } - }, - - removeXJ() { - if (this.formData.id) { - this.$post({ - url: "/RKJ/removeXJ", - data: { - id: this.formData.id - } - }).then(res => { - if (res.data.tbBillList > 0) { - this.$showMessage("鍒犻櫎鎴愬姛"); - //鍏抽棴褰撳墠椤甸潰锛岃繑鍥炰笂涓�椤甸潰鎴栧绾ч〉闈� - uni.navigateBack(); - } else { - this.$showMessage("鍒犻櫎澶辫触"); - } - }); - } else { - this.$showMessage("璇峰厛閫夋嫨妫�楠屽崟鍙�"); - } - }, - 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("宸ュ崟鍙疯幏鍙栧け璐ワ紝璇烽噸鏂伴�夋嫨宸ュ崟"); - return; - } - - // 璁剧疆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; - - // 淇濆瓨杞﹂棿閫夋嫨淇℃伅 - 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; - }); - }, - //鐢熶骇绾垮埆閫夋嫨骞跺垵濮嬭瘽宸ュ崟鍙� - onDaa020Change(event) { - //鑾峰彇鐢熶骇绾垮埆鐨勪笅鏍囧湴鍧� - this.formData.lineName = event; +<script> + export default { + data() { + return { + formData: { + id: "", + releaseNo: "", + createBy: "", + createDate: "", + daa020: "", + itemNo: "", + itemId: "", // 鐗╂枡ID + billNo: "", + lineNo: "", // 鐢熶骇绾跨紪鍙� + catQty: "", + detailMem: "", + taskNo: "", + fcheckResu: "", + fsubmit: "", // 鎻愪氦鐘舵�� + remarks: "", + rbillNo: "", + workShop: "", // 宸ヤ綔杞﹂棿 + lineName: "", // 绾夸綋鍚嶇О + quantity: "", // 閫佹鏁伴噺 + planQty: "", // 宸ュ崟璁″垝鏁伴噺 + fngDesc: "" // 涓嶈壇鎻忚堪 + }, - const selectedLine = this.lineList[this.DAA020List.indexOf(event)]; - this.lineNo = selectedLine.lineno; - - // 璁剧疆鐢熶骇绾跨紪鍙峰埌formData - this.formData.lineNo = this.lineNo; + DAA020List: [], - this.$post({ - url: "/RKJ/getDaa001", - data: { - lineNo: this.lineNo - } - }).then(res => { - this.BillNoList = res.data.tbBillList; - // 宸ュ崟鍙峰幓閲嶏紝鍙樉绀哄敮涓� - this.DAA001List = Array.from(new Set(res.data.tbBillList.map(s => s.daa001))); - this.formData.rBillNo = ""; - // 涓嶆竻绌洪�佹鏁伴噺锛屼繚鎸佺敤鎴峰凡杈撳叆鐨勫�� - this.formData.itemName = ""; - this.formData.itemNo = ""; - this.formData.itemId = ""; // 娓呯┖鐗╂枡ID - this.formData.itemModel = ""; - this.formData.planQty = ""; - this.formData.rbillNo = ""; // 娓呯┖閫佹鎵规鍙� - 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.formData.rbillNo = ""; // 娓呯┖閫佹鎵规鍙� - this.tableData = []; - }); - } - }); - }, - //閫夊彇宸ュ崟濉厖鐗╂枡鍙峰拰鍏朵粬淇℃伅 - onDaa001Change(e) { - this.formData.rBillNo = 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.rbillNo = ""; - this.formData.quantity = ""; - this.formData.itemModel = ""; - this.tableData = []; - return; - } - - // 鑷姩濉厖鐗╂枡淇℃伅 - this.formData.itemName = data.daa003; // 浜у搧鍚嶇О - this.formData.itemNo = data.daa002; // 浜у搧缂栫爜 - this.formData.itemId = data.itemId || ""; // 鐗╂枡ID - this.formData.billNo = data.daa001; // 宸ュ崟鍙蜂綔涓篵illNo - this.formData.rbillNo = "鏃犳簮鍗�"; // 閫佹鎵规鍙凤紙浣跨敤榛樿鍊硷級 - 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({ - url: "/RKJ/getPage", - data: { - id: this.formData.id, - createUser: this.$loginInfo.account, - pageIndex: 1, - limit: 1, - } - }).then(res => { - let data = res.data.tbBillList[0]; - if (data) { - // 淇濆瓨鍘熸湁鐨勬楠屽崟鍙� - 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; - - // 鍔犺浇涓嬫媺妗嗗瓧娈垫暟鎹� - this.badreason = data.blyy || ''; - this.PSTYPE = data.pszt || ''; - this.WORKSHOP = data.sscj || ''; - this.formData.fngDesc = data.fngDesc || ''; // 鍔犺浇涓嶈壇鎻忚堪 - - // 璁剧疆 picker 绱㈠紩 - this.badreasonIndex = this.badreasonOptions.indexOf(this.badreason); - this.workshopIndex = this.workshopOptions.indexOf(this.WORKSHOP); - this.pstypeIndex = this.pstypeOptions.indexOf(this.PSTYPE); - - // 璁剧疆鐢熶骇绾垮悕绉帮紙濡傛灉鏈塴ineNo锛� - if (this.formData.lineNo && this.formData.workShop) { - this.formData.lineName = this.formData.lineNo; - } - - // 鍔犺浇杞﹂棿鍒楄〃鍜岀浉鍏充俊鎭� - this.loadDepartmentAndLineInfo(); - - // 鍔犺浇妫�楠岄」鐩� - this.loadInspectionItems(); - } - }); - }, - - // 鍔犺浇杞﹂棿鍜岀嚎浣撲俊鎭� - 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() { - if (this.formData.fsubmit == 1) { - this.$showMessage("璇ユ楠屽崟宸叉彁浜わ紝涓嶈兘淇敼涓嶅悎鏍兼弿杩�"); - return; - } - this.showPopup = !this.showPopup; - this.remarks = this.formData.remarks; - }, - edit() { - if (this.remarks) { - //saveRemarksGid - this.$post({ - url: "/RKJ/saveRemarksGid", - data: { - gid: this.formData.id, - remarks: this.remarks - } - }).then(res => { - if(res.data.tbBillList > 0){ - this.formData.remarks = this.remarks; - this.showPopup = !this.showPopup; - this.$showMessage("淇濆瓨鎴愬姛"); - } - }) - } - },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 - } - }).then(res => { - - this.tableData = res.data.tbBillList; - if (this.tableData.length === 0) { - this.$showMessage("璇ョ墿鏂欐湭缁存姢妫�楠岄」鐩紝璇峰厛缁存姢妫�楠岄」鐩紒"); - this.isSubmit = true; - this.tableData = []; - this.isShowTable = true; - // 淇濇寔鏂板缓妯″紡锛屼笉鍒囨崲鍒版煡鐪嬫ā寮� - this.isUpdate = true; - } else { - this.isSubmit = false; - this.isShowTable = true; - this.isUpdate = true; - } - }); - }, - saveTable() { - if (this.tableData.length === 0) { - return; - } - - this.$post({ - url: "/RKJ/saveItem", - data: { - gid: this.formData.id, - items: this.tableData, - userNo: this.$loginInfo.account - } - }).then(res => { - this.formData.id = res.data.tbBillList; - this.isShowTable = false; - this.isUpdate = false; - this.init(); - }) - }, - 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; - } - - // 妫�鏌ラ拤閽夋帹閫佹潯浠讹細PSZT涓哄緟鍒わ紝涓斾笉鑹師鍥犮�佷笉鑹弿杩般�佹墍灞炶溅闂翠笉涓虹┖ - const shouldPushToDingTalk = this.PSTYPE === '寰呭垽' && - this.badreason && - this.formData.fngDesc && - this.WORKSHOP; - - let confirmMessage = '纭畾瑕佹彁浜ゆ妫�楠屽崟鍚楋紵鎻愪氦鍚庡皢鏃犳硶淇敼銆�'; - if (shouldPushToDingTalk) { - confirmMessage += '\n\n婊¤冻閽夐拤鎺ㄩ�佹潯浠讹紝灏嗚嚜鍔ㄦ帹閫佸埌閽夐拤瀹℃壒娴佺▼銆�'; - } - - // 纭鎻愪氦 - uni.showModal({ - title: '纭鎻愪氦', - content: confirmMessage, - 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) { - let successMessage = "妫�楠屽崟鎻愪氦鎴愬姛锛�"; - if (shouldPushToDingTalk) { - successMessage += "\n宸叉帹閫佸埌閽夐拤瀹℃壒娴佺▼銆�"; - } - this.$showMessage(successMessage); - // 鏇存柊鏈湴鐘舵�� - this.formData.fsubmit = 1; - // 鍒锋柊鏁版嵁 - this.init(); - } else { - this.$showMessage(res.message || "鎻愪氦澶辫触"); - } - }).catch(error => { - console.error("鎻愪氦澶辫触:", error); - this.$showMessage("鎻愪氦澶辫触锛岃閲嶈瘯"); - }); - } - } - }); - }, - viewAttachmentInfo() { - this.showAttachmentPopup = true; // 鍏堝脊绐� - this.attachmentsLoading = true; - this.attachments = []; - this.$post({ - url: "/RKJ/getAttachments", - data: { itemNo: this.formData.itemNo } - }).then(res => { - this.attachmentsLoading = false; - if (res.status === 0) { - this.attachments = res.data.tbBillList; - // 涓烘瘡涓檮浠惰缃粯璁ゅ彲鐢ㄧ姸鎬� - this.attachments.forEach((item, index) => { - this.$set(item, 'ftpAvailable', true); // 榛樿璁や负鏂囦欢鍙敤 - this.$set(item, 'checking', false); - }); - } else if (res.status === 1 && res.message === "璇ユ楠屽崟鏈笂浼犻檮浠朵俊鎭紒") { - uni.showToast({ title: res.message, icon: "none" }); - } else { - uni.showToast({ title: "鑾峰彇闄勪欢澶辫触", icon: "none" }); - } - }); - }, - downloadAttachment(item) { - // 鍘婚櫎鎵�鏈夌┖鏍笺�佸叏瑙掔┖鏍笺�佸洖杞︺�佹崲琛� - const fileName = item.fattach.replace(/[\s\u3000\r\n]+/g, '').trim(); - // 浣跨敤閰嶇疆鐨勬湇鍔″櫒鍦板潃鍜孎TP鏈嶅姟鍣ㄥ湴鍧� - const url = this.$store.state.serverInfo.serverAPI + "/RKJ/DownloadFtpFile?itemNo=" + encodeURIComponent(item.itemNo) + "&fileName=" + encodeURIComponent(fileName) + "&ftpServer=" + encodeURIComponent(this.$store.state.serverInfo.ftpServer); - - // 妫�鏌ヨ繍琛岀幆澧� - // #ifdef H5 - // H5鐜锛氫娇鐢ㄦ祻瑙堝櫒涓嬭浇 - this.downloadFileInBrowser(url, fileName); - // #endif - - // #ifdef APP-PLUS - // APP鐜锛氫娇鐢╱ni.downloadFile - this.downloadFileInApp(url, fileName); - // #endif - - // #ifdef MP - // 灏忕▼搴忕幆澧冿細浣跨敤uni.downloadFile - this.downloadFileInApp(url, fileName); - // #endif - }, - // 鍦ㄦ祻瑙堝櫒涓笅杞芥枃浠� - downloadFileInBrowser(url, fileName) { - uni.showLoading({ title: '姝e湪鍑嗗涓嬭浇...' }); - - // 鏂规硶1锛氬垱寤洪殣钘忕殑a鏍囩涓嬭浇 - try { - const link = document.createElement('a'); - link.href = url; - link.download = fileName; - link.style.display = 'none'; - document.body.appendChild(link); - link.click(); - document.body.removeChild(link); - - uni.hideLoading(); - uni.showToast({ - title: '涓嬭浇宸插紑濮�', - icon: 'success', - duration: 2000 - }); - } catch (error) { - console.log('a鏍囩涓嬭浇澶辫触锛屽皾璇晈indow.open鏂瑰紡:', error); - // 鏂规硶2锛氫娇鐢╳indow.open - try { - window.open(url, '_blank'); - uni.hideLoading(); - uni.showToast({ - title: '涓嬭浇宸插紑濮�', - icon: 'success', - duration: 2000 - }); - } catch (error2) { - console.log('window.open涓嬭浇澶辫触锛屽皾璇昮etch鏂瑰紡:', error2); - // 鏂规硶3锛氫娇鐢╢etch涓嬭浇 - this.downloadFileWithFetch(url, fileName); - } - } - }, - // 浣跨敤fetch涓嬭浇鏂囦欢 - downloadFileWithFetch(url, fileName) { - fetch(url) - .then(response => { - if (!response.ok) { - throw new Error(`HTTP error! status: ${response.status}`); - } - return response.blob(); - }) - .then(blob => { - // 鍒涘缓blob URL - const blobUrl = window.URL.createObjectURL(blob); - - // 鍒涘缓涓嬭浇閾炬帴 - const link = document.createElement('a'); - link.href = blobUrl; - link.download = fileName; - link.style.display = 'none'; - document.body.appendChild(link); - link.click(); - document.body.removeChild(link); - - // 閲婃斁blob URL - window.URL.revokeObjectURL(blobUrl); - - uni.hideLoading(); - uni.showToast({ - title: '涓嬭浇鎴愬姛', - icon: 'success', - duration: 2000 - }); - }) - .catch(error => { - console.error('Fetch涓嬭浇澶辫触:', error); - uni.hideLoading(); - if (error.message.includes('404')) { - uni.showModal({ - title: '鏂囦欢涓嶅瓨鍦�', - content: `璇ラ檮浠跺湪FTP鏈嶅姟鍣ㄤ笂涓嶅瓨鍦╜, - showCancel: false - }); - } else { - uni.showModal({ - title: '涓嬭浇澶辫触', - content: `涓嬭浇澶辫触: ${error.message}`, - showCancel: false - }); - } - }); - }, - // 鍦ˋPP涓笅杞芥枃浠� - downloadFileInApp(url, fileName) { - // #ifdef APP-PLUS - uni.showLoading({ title: '浠嶧TP鏈嶅姟鍣ㄤ笅杞戒腑...' }); - - // Android 鑾峰彇瀛樺偍璺緞 - const saveDir = plus.os.name === 'Android' ? plus.io.convertLocalFileSystemURL('_downloads/') : plus.io.convertLocalFileSystemURL('_documents/'); - const filePath = `${saveDir}${fileName}`; - - const downloadTask = uni.downloadFile({ - url: url, - filePath: filePath, // 鎸囧畾淇濆瓨璺緞 - success: (res) => { - uni.hideLoading(); - if (res.statusCode === 200) { - const fileInfo = { - name: fileName, - path: res.filePath || filePath, - tempPath: res.tempFilePath - }; - - uni.showModal({ - title: '涓嬭浇鎴愬姛', - content: `鏂囦欢宸蹭繚瀛樺埌锛�${fileInfo.path}`, - showCancel: true, - confirmText: '鎵撳紑鏂囦欢', - cancelText: '纭畾', - success: (modalRes) => { - if (modalRes.confirm) { - // 鐢ㄦ埛閫夋嫨鎵撳紑鏂囦欢 - this.openFileInApp(fileInfo); - } - } - }); - } else if (res.statusCode === 404) { - uni.showModal({ - title: '鏂囦欢涓嶅瓨鍦�', - content: `璇ラ檮浠跺湪FTP鏈嶅姟鍣ㄤ笂涓嶅瓨鍦╜, - showCancel: false - }); - } else { - uni.showModal({ - title: '涓嬭浇澶辫触', - content: `鐘舵�佺爜锛�${res.statusCode}`, - showCancel: false - }); - } - }, - fail: (error) => { - uni.hideLoading(); - console.error('涓嬭浇澶辫触:', error); - uni.showModal({ - title: '涓嬭浇澶辫触', - content: `缃戠粶閿欒锛�${error.errMsg}`, - showCancel: false - }); - } - }); - - // 鐩戝惉涓嬭浇杩涘害 - downloadTask.onProgressUpdate((res) => { - const progress = Math.round(res.progress); - uni.showLoading({ - title: `涓嬭浇涓� ${progress}%`, - mask: true - }); - }); - // #endif - - // #ifdef MP - // 灏忕▼搴忕幆澧冪殑绠�鍖栧疄鐜� - uni.showLoading({ title: '涓嬭浇涓�...' }); - uni.downloadFile({ - url: url, - success: (res) => { - uni.hideLoading(); - if (res.statusCode === 200) { - uni.showToast({ title: '涓嬭浇瀹屾垚', icon: 'success' }); - } - }, - fail: (error) => { - uni.hideLoading(); - uni.showModal({ title: '涓嬭浇澶辫触', content: error.errMsg, showCancel: false }); - } - }); - // #endif - }, - // APP涓墦寮�鏂囦欢 - openFileInApp(fileInfo) { - // #ifdef APP-PLUS - if (typeof plus !== 'undefined') { - const filePath = fileInfo.path || fileInfo.tempPath; - - // 灏濊瘯鎵撳紑鏂囦欢 - plus.runtime.openFile(filePath, {}, (error) => { - console.error('鎵撳紑鏂囦欢澶辫触:', error); - uni.showModal({ - title: '鏃犳硶鎵撳紑', - content: '绯荤粺涓病鏈夋壘鍒拌兘鎵撳紑姝ゆ枃浠剁殑搴旂敤绋嬪簭', - showCancel: false - }); - }); - } - // #endif - }, - // 棰勮FTP鏂囦欢 - previewFtpFile(item) { - const fileName = item.fattach.replace(/[\s\u3000\r\n]+/g, '').trim(); - const fileExt = fileName.split('.').pop().toLowerCase(); - - // 妫�鏌ユ枃浠剁被鍨嬫槸鍚︽敮鎸侀瑙� - if (!this.isPreviewable(fileName)) { - uni.showModal({ - title: '涓嶆敮鎸侀瑙�', - content: '璇ユ枃浠剁被鍨嬩笉鏀寔鍦ㄧ嚎棰勮锛岃涓嬭浇鍚庢煡鐪�', - showCancel: false - }); - return; - } - - const previewUrl = this.$store.state.serverInfo.serverAPI + "/RKJ/PreviewFtpFile?itemNo=" + encodeURIComponent(item.itemNo) + "&fileName=" + encodeURIComponent(fileName) + "&ftpServer=" + encodeURIComponent(this.$store.state.serverInfo.ftpServer); - - // 鏍规嵁鏂囦欢绫诲瀷杩涜涓嶅悓鐨勯瑙堝鐞� - if (['pdf'].includes(fileExt)) { - this.previewPdfFile(previewUrl, fileName); - } else if (['jpg', 'jpeg', 'png', 'gif', 'bmp'].includes(fileExt)) { - this.previewImageFile(previewUrl, fileName); - } else if (['txt'].includes(fileExt)) { - this.previewTextFile(previewUrl, fileName); - } else if (['doc', 'docx', 'xls', 'xlsx', 'ppt', 'pptx'].includes(fileExt)) { - this.previewOfficeFile(previewUrl, fileName); - } else { - // 灏濊瘯閫氱敤棰勮 - this.previewGenericFile(previewUrl, fileName); - } - }, - - // 棰勮PDF鏂囦欢 - previewPdfFile(url, fileName) { - // 鍏堜笅杞絇DF鏂囦欢锛岃浆涓篵ase64鍚庨瑙� - uni.request({ - url: url, - method: 'GET', - responseType: 'arraybuffer', - success: (res) => { - if (res.statusCode === 200) { - const base64Data = uni.arrayBufferToBase64(res.data); - // 瀛樺偍鍒板叏灞�鍙橀噺 - getApp().globalData.tempPDF = base64Data; - uni.navigateTo({ - url: `/pages/fileView/pdfView` - }); - } else { - this.handlePreviewError(res.statusCode, fileName); - } - }, - fail: (error) => { - this.handlePreviewError(0, fileName, error.errMsg); - } - }); - }, - - // 棰勮鍥剧墖鏂囦欢 - previewImageFile(url, fileName) { - // #ifdef APP-PLUS - // APP鐜锛氬厛涓嬭浇鍒版湰鍦板啀棰勮锛岄伩鍏嶇綉缁滃浘鐗囧姞杞介棶棰� - uni.showLoading({ title: '鍔犺浇鍥剧墖...' }); - uni.downloadFile({ - url: url, - success: (res) => { - uni.hideLoading(); - if (res.statusCode === 200) { - // 浣跨敤鏈湴涓存椂璺緞 - uni.navigateTo({ - url: `/pages/fileView/imageView?url=${encodeURIComponent(res.tempFilePath)}` - }); - } else { - this.handlePreviewError(res.statusCode, fileName); - } - }, - fail: (error) => { - uni.hideLoading(); - this.handlePreviewError(0, fileName, error.errMsg); - } - }); - // #endif - - // #ifdef H5 || MP - // H5鍜屽皬绋嬪簭锛氱洿鎺ヤ娇鐢ㄧ綉缁淯RL - uni.navigateTo({ - url: `/pages/fileView/imageView?url=${encodeURIComponent(url)}` - }); - // #endif - }, - - // 棰勮鏂囨湰鏂囦欢 - previewTextFile(url, fileName) { - // 鏂囨湰鏂囦欢鐩存帴鏄剧ず鍦ㄥ脊绐椾腑 - uni.showLoading({ title: '鍔犺浇鏂囦欢鍐呭...' }); - uni.request({ - url: url, - method: 'GET', - success: (res) => { - uni.hideLoading(); - if (res.statusCode === 200) { - const fileType = this.getFileType(fileName); - - if (fileType === 'text') { - // 鏂囨湰鏂囦欢锛氭樉绀哄唴瀹� - this.showFilePreview(res.data, fileName); - } else if (fileType === 'image') { - // 鍥剧墖鏂囦欢锛氭樉绀哄浘鐗嘦RL - this.showFilePreview(url, fileName); - } else { - // 鍏朵粬鏂囦欢绫诲瀷锛氭樉绀烘彁绀轰俊鎭� - this.showFilePreview('', fileName); - } - } else { - this.handlePreviewError(res.statusCode, fileName); - } - }, - fail: (error) => { - uni.hideLoading(); - this.handlePreviewError(0, fileName, error.errMsg); - } - }); - }, - - // 妫�娴嬫枃浠剁被鍨� - getFileType(fileName) { - const fileExt = fileName.split('.').pop().toLowerCase(); - - if (['txt', 'log', 'md', 'csv', 'json', 'xml'].includes(fileExt)) { - return 'text'; - } else if (['jpg', 'jpeg', 'png', 'gif', 'bmp', 'webp'].includes(fileExt)) { - return 'image'; - } else if (['xls', 'xlsx', 'doc', 'docx', 'ppt', 'pptx'].includes(fileExt)) { - return 'excel'; - } else { - return 'unsupported'; - } - }, - - // 鏄剧ず鏂囦欢棰勮寮圭獥 - showFilePreview(content, fileName) { - this.previewContent = content; - this.previewTitle = fileName; - this.previewItemNo = this.selectedAttachment?.itemNo || ''; - this.previewType = this.getFileType(fileName); - this.showFilePreviewPopup = true; - }, - - // 鍏抽棴鏂囦欢棰勮寮圭獥 - closeFilePreview() { - this.showFilePreviewPopup = false; - this.previewContent = ''; - this.previewTitle = ''; - this.previewItemNo = ''; - this.previewType = ''; - }, - - // 涓嬭浇棰勮鏂囦欢 - downloadPreviewFile() { - const item = { fattach: this.previewTitle, itemNo: this.previewItemNo }; - this.downloadAttachment(item); - this.closeFilePreview(); - }, - - // 鍦ㄥ脊绐椾腑棰勮鍥剧墖锛堟斁澶у姛鑳斤級 - previewImageInPopup() { - // 浣跨敤uni.previewImage API瀹炵幇鍥剧墖鏀惧ぇ棰勮 - uni.previewImage({ - current: this.previewContent, // 褰撳墠鏄剧ず鍥剧墖鐨勯摼鎺� - urls: [this.previewContent], // 闇�瑕侀瑙堢殑鍥剧墖閾炬帴鍒楄〃 - loop: false, // 鏄惁寮�鍚浘鐗囪疆鎾� - indicator: 'default', // 鍥剧墖鎸囩ず鍣ㄧ被鍨� - longPressActions: { - itemList: ['鍙戦�佺粰鏈嬪弸', '淇濆瓨鍥剧墖', '鏀惰棌'], - success: function (data) { - console.log('閫変腑浜嗙' + (data.tapIndex + 1) + '涓寜閽�'); - }, - fail: function (err) { - console.log(err.errMsg); - } - }, - success: () => { - console.log('鍥剧墖棰勮鎴愬姛'); - }, - fail: (err) => { - console.error('鍥剧墖棰勮澶辫触:', err); - uni.showToast({ - title: '鍥剧墖棰勮澶辫触', - icon: 'none' - }); - } - }); - }, - - // 棰勮Office鏂囦欢 - previewOfficeFile(url, fileName) { - // 鍏堟鏌xcel鏂囦欢锛屼娇鐢ㄤ笓闂ㄧ殑Excel棰勮椤甸潰 - const fileExt = fileName.split('.').pop().toLowerCase(); - if (['xls', 'xlsx'].includes(fileExt)) { - // Excel鏂囦欢棰勮 - uni.request({ - url: url, - method: 'GET', - responseType: 'arraybuffer', - success: (res) => { - if (res.statusCode === 200) { - const base64Data = uni.arrayBufferToBase64(res.data); - // 瀛樺偍 Base64 鏁版嵁鍒版湰鍦板瓨鍌� - uni.setStorageSync('excelBase64Data', base64Data); - uni.navigateTo({ - url: `/pages/fileView/excelView` - }); - } else { - this.handlePreviewError(res.statusCode, fileName); - } - }, - fail: (error) => { - this.handlePreviewError(0, fileName, error.errMsg); - } - }); - } else if (['doc', 'docx'].includes(fileExt)) { - // Word鏂囦欢锛屽皾璇曚娇鐢╓ord棰勮椤甸潰鎴栬�呭井杞湪绾块瑙� - try { - const officePreviewUrl = `https://view.officeapps.live.com/op/view.aspx?src=${encodeURIComponent(url)}`; - // 濡傛灉鏈墂ebView椤甸潰锛屼娇鐢╳ebView棰勮 - this.previewGenericFile(officePreviewUrl, fileName); - } catch (error) { - this.handlePreviewError(0, fileName, '涓嶆敮鎸佹Office鏂囦欢绫诲瀷鐨勯瑙�'); - } - } else { - // 鍏朵粬Office鏂囦欢锛屼娇鐢ㄥ井杞湪绾块瑙堟湇鍔� - const officePreviewUrl = `https://view.officeapps.live.com/op/view.aspx?src=${encodeURIComponent(url)}`; - this.previewGenericFile(officePreviewUrl, fileName); - } - }, - - // 閫氱敤鏂囦欢棰勮 - previewGenericFile(url, fileName) { - // 鐢变簬娌℃湁閫氱敤鐨剋ebView椤甸潰锛屾樉绀烘彁绀哄苟鎻愪緵涓嬭浇 - uni.showModal({ - title: '鏂囦欢棰勮', - content: `鏂囦欢 "${fileName}" 闇�瑕佷笅杞藉悗鏌ョ湅锛屾槸鍚︾珛鍗充笅杞斤紵`, - showCancel: true, - confirmText: '涓嬭浇', - cancelText: '鍙栨秷', - success: (res) => { - if (res.confirm) { - const item = { fattach: fileName, itemNo: this.selectedAttachment.itemNo }; - this.downloadAttachment(item); - } - } - }); - }, - - // 澶勭悊棰勮閿欒 - handlePreviewError(statusCode, fileName, errorMsg = '') { - let message = ''; - if (statusCode === 404) { - message = `鏂囦欢 ${fileName} 鍦‵TP鏈嶅姟鍣ㄤ笂涓嶅瓨鍦╜; - } else if (statusCode === 0) { - message = `棰勮澶辫触锛�${errorMsg}`; - } else { - message = `棰勮澶辫触锛岀姸鎬佺爜锛�${statusCode}`; - } - - uni.showModal({ - title: '棰勮澶辫触', - content: message, - showCancel: true, - confirmText: '涓嬭浇', - cancelText: '鍙栨秷', - success: (res) => { - if (res.confirm) { - // 鐢ㄦ埛閫夋嫨涓嬭浇鏂囦欢 - const item = { fattach: fileName, itemNo: this.selectedAttachment.itemNo }; - this.downloadAttachment(item); - } - } - }); - }, - onShow() { - //姣忔杩涘叆椤甸潰閮戒細鎵ц鐨勬柟娉� - if (this.formData.id) { - this.init(); - } - }, - // 闄勪欢鐩稿叧鏂规硶 - closeAttachmentPopup() { - this.showAttachmentPopup = false; - }, - showAttachmentDetailDialog(item) { - console.log('鏌ョ湅璇︽儏', item); - this.selectedAttachment = item; - this.showAttachmentPopup = false; - this.showAttachmentDetail = true; - console.log('showAttachmentDetail:', this.showAttachmentDetail); - }, - closeAttachmentDetail() { - this.showAttachmentDetail = false; - this.selectedAttachment = null; - this.showAttachmentPopup = true; - }, - isPreviewable(filename) { - if (!filename) return false; - const ext = filename.trim().split('.').pop().toLowerCase(); - // 鏀寔鍦ㄧ嚎棰勮鐨勬枃浠剁被鍨� - return [ - 'pdf', // PDF鏂囦欢 - 'jpg', 'jpeg', 'png', 'gif', 'bmp', 'webp', // 鍥剧墖鏂囦欢 - 'txt', 'log', 'md', // 鏂囨湰鏂囦欢 - 'doc', 'docx', // Word鏂囨。 - 'xls', 'xlsx', // Excel琛ㄦ牸 - 'ppt', 'pptx', // PowerPoint婕旂ず鏂囩 - 'csv' // CSV鏂囦欢 - ].includes(ext); - }, - - // 涓嬫媺妗嗕簨浠跺鐞嗘柟娉� - onBadreasonChange(e) { - const index = e.detail.value; - this.badreasonIndex = index; - this.badreason = this.badreasonOptions[index]; - this.saveDropdownFields('badreason'); - }, - onWorkshopChange(e) { - const index = e.detail.value; - this.workshopIndex = index; - this.WORKSHOP = this.workshopOptions[index]; - this.saveDropdownFields('WORKSHOP'); - }, - onPstypeChange(e) { - const index = e.detail.value; - this.pstypeIndex = index; - this.PSTYPE = this.pstypeOptions[index]; - this.saveDropdownFields('PSTYPE'); - }, - saveDropdownFields(fieldName) { - // 鐩存帴淇濆瓨鍒版暟鎹簱 - const requestData = { - gid: this.formData.id, - releaseNo: this.formData.releaseNo, - BLYY: this.badreason || '', - SSCJ: this.WORKSHOP || '', - PSZT: this.PSTYPE || '' - }; - console.log('鍙戦�佺殑鏁版嵁:', requestData); - console.log('badreason:', this.badreason); - console.log('WORKSHOP:', this.WORKSHOP); - console.log('PSTYPE:', this.PSTYPE); - console.log('閫夋嫨鐨勫瓧娈�:', fieldName); - this.$post({ - url: "/RKJ/saveDropdownFields", - data: requestData - }).then(res => { - if (res && res.data && res.data.data && res.data.data.tbBillList && res.data.data.tbBillList.length > 0) { - // 寤惰繜閲嶆柊鍔犺浇鏁版嵁锛岀‘淇濇暟鎹簱鏇存柊瀹屾垚 - setTimeout(() => { - this.init(); - }, 500); - } - }).catch(err => { - console.error('淇濆瓨澶辫触锛�', err); - }); - }, - saveFngDesc() { - // 淇濆瓨涓嶈壇鎻忚堪鍒版暟鎹簱 - this.$post({ - url: "/RKJ/saveFngDesc", - data: { - gid: this.formData.id, - fngDesc: this.formData.fngDesc - } - }).then(res => { - if (res.status == 0) { - this.$showMessage("涓嶈壇鎻忚堪淇濆瓨鎴愬姛"); - } else { - this.$showMessage("涓嶈壇鎻忚堪淇濆瓨澶辫触"); - } - }).catch(error => { - console.error("淇濆瓨涓嶈壇鎻忚堪澶辫触:", error); - this.$showMessage("淇濆瓨涓嶈壇鎻忚堪澶辫触锛岃閲嶈瘯"); - }); - } - } - }; - </script> - - <style> + DAA001List: [], + + BillNoList: [], + + lineList: [], + + lineNo: "", + + tableData: [], + drawing: [], + + isSubmit: true, + + isUpdate: true, + + isShowTable: false, + + drawingShow: false, + itemShow: false, + + remarks: "", + + showPopup: false, + departmentList: [], // 杞﹂棿鍒楄〃 + selectedDepartmentId: "", // 閫変腑鐨勮溅闂碔D + // 闄勪欢鐩稿叧鏁版嵁 + attachments: [], + showAttachmentPopup: false, + attachmentsLoading: false, + selectedAttachment: null, + showAttachmentDetail: false, + showFilePreviewPopup: false, + previewContent: '', + previewTitle: '', + previewItemNo: '', + previewType: '', // 'text', 'image', 'excel', 'unsupported' + + // 鏂板涓嬫媺妗嗙浉鍏虫暟鎹� + badreason: '', + PSTYPE: '', + WORKSHOP: '', + badreasonOptions: ['', '澶栬涓嶈壇', '灏哄涓嶈壇', '鍖呰涓嶈壇', '鎬ц兘涓嶈壇', '瑁呴厤涓嶈壇', '瀹夎涓嶈壇'], + badreasonIndex: 0, + workshopOptions: ['', '鐢熶骇涓�閮�', '鐢熶骇浜岄儴', '娉ㄥ杞﹂棿', '鍏朵粬'], + workshopIndex: 0, + pstypeOptions: ['', '鐗归噰/璁╂浣跨敤', '鎸戦��/杩斿伐浣跨敤', '閫�璐�', '寰呭垽'], + pstypeIndex: 0, + }; + }, + onLoad(options) { + //options涓寘鍚簡url闄勫甫鐨勫弬鏁� + + let params = options; + + if (params["id"]) { + this.isUpdate = false; + this.formData.id = params["id"]; + this.formData.releaseNo = params["releaseNo"]; + //getQaItemXj02 + this.init(); + } else { + //鍒濆鍖栨楠屽崟鍙� + this.$post({ + url: "/RKJ/getMaxReleaseNo" + }).then(res => { + this.formData.releaseNo = res.data.tbBillList; + this.formData.createBy = this.$loginInfo.account; + this.formData.createDate = this.$getDate("yyyy-mm-dd"); + }); + + // 鍒濆鍖栬溅闂翠笅鎷夋 + this.$post({ + url: "/RKJ/GetDepartmentsWithLines" + }).then(res => { + this.departmentList = res.data.tbBillList.map(item => item.departmentname); + }) + } + }, + methods: { + getStatusClass(result) { + if (result === '鍚堟牸') return 'status-pass'; + if (result === '涓嶅悎鏍�') return 'status-fail'; + return 'status-pending'; + }, + + getStatusText(status) { + const statusMap = { + approved: '鍚堟牸', + rejected: '涓嶅悎鏍�', + pending: '寰呯‘璁�' + } + if (status == null || status == '鏈畬鎴�') { + return statusMap['pending'] || '寰呯‘璁�'; + } else if (status == '鍚堟牸') { + return statusMap['approved'] || '鍚堟牸'; + } else { + return statusMap['rejected'] || '涓嶅悎鏍�'; + } + }, + + removeXJ() { + if (this.formData.id) { + this.$post({ + url: "/RKJ/removeXJ", + data: { + id: this.formData.id + } + }).then(res => { + if (res.data.tbBillList > 0) { + this.$showMessage("鍒犻櫎鎴愬姛"); + //鍏抽棴褰撳墠椤甸潰锛岃繑鍥炰笂涓�椤甸潰鎴栧绾ч〉闈� + uni.navigateBack(); + } else { + this.$showMessage("鍒犻櫎澶辫触"); + } + }); + } else { + this.$showMessage("璇峰厛閫夋嫨妫�楠屽崟鍙�"); + } + }, + 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("宸ュ崟鍙疯幏鍙栧け璐ワ紝璇烽噸鏂伴�夋嫨宸ュ崟"); + return; + } + + // 璁剧疆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; + + // 淇濆瓨杞﹂棿閫夋嫨淇℃伅 + 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; + }); + }, + //鐢熶骇绾垮埆閫夋嫨骞跺垵濮嬭瘽宸ュ崟鍙� + onDaa020Change(event) { + //鑾峰彇鐢熶骇绾垮埆鐨勪笅鏍囧湴鍧� + this.formData.lineName = event; + + const selectedLine = this.lineList[this.DAA020List.indexOf(event)]; + this.lineNo = selectedLine.lineno; + + // 璁剧疆鐢熶骇绾跨紪鍙峰埌formData + this.formData.lineNo = this.lineNo; + + this.$post({ + url: "/RKJ/getDaa001", + data: { + lineNo: this.lineNo + } + }).then(res => { + this.BillNoList = res.data.tbBillList; + // 宸ュ崟鍙峰幓閲嶏紝鍙樉绀哄敮涓� + this.DAA001List = Array.from(new Set(res.data.tbBillList.map(s => s.daa001))); + this.formData.rBillNo = ""; + // 涓嶆竻绌洪�佹鏁伴噺锛屼繚鎸佺敤鎴峰凡杈撳叆鐨勫�� + this.formData.itemName = ""; + this.formData.itemNo = ""; + this.formData.itemId = ""; // 娓呯┖鐗╂枡ID + this.formData.itemModel = ""; + this.formData.planQty = ""; + this.formData.rbillNo = ""; // 娓呯┖閫佹鎵规鍙� + 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.formData.rbillNo = ""; // 娓呯┖閫佹鎵规鍙� + this.tableData = []; + }); + } + }); + }, + //閫夊彇宸ュ崟濉厖鐗╂枡鍙峰拰鍏朵粬淇℃伅 + onDaa001Change(e) { + this.formData.rBillNo = 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.rbillNo = ""; + this.formData.quantity = ""; + this.formData.itemModel = ""; + this.tableData = []; + return; + } + + // 鑷姩濉厖鐗╂枡淇℃伅 + this.formData.itemName = data.daa003; // 浜у搧鍚嶇О + this.formData.itemNo = data.daa002; // 浜у搧缂栫爜 + this.formData.itemId = data.itemId || ""; // 鐗╂枡ID + this.formData.billNo = data.daa001; // 宸ュ崟鍙蜂綔涓篵illNo + this.formData.rbillNo = "鏃犳簮鍗�"; // 閫佹鎵规鍙凤紙浣跨敤榛樿鍊硷級 + 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({ + url: "/RKJ/getPage", + data: { + id: this.formData.id, + createUser: this.$loginInfo.account, + pageIndex: 1, + limit: 1, + } + }).then(res => { + let data = res.data.tbBillList[0]; + if (data) { + // 淇濆瓨鍘熸湁鐨勬楠屽崟鍙� + 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; + + // 鍔犺浇涓嬫媺妗嗗瓧娈垫暟鎹� + this.badreason = data.blyy || ''; + this.PSTYPE = data.pszt || ''; + this.WORKSHOP = data.sscj || ''; + this.formData.fngDesc = data.fngDesc || ''; // 鍔犺浇涓嶈壇鎻忚堪 + + // 璁剧疆 picker 绱㈠紩 + this.badreasonIndex = this.badreasonOptions.indexOf(this.badreason); + this.workshopIndex = this.workshopOptions.indexOf(this.WORKSHOP); + this.pstypeIndex = this.pstypeOptions.indexOf(this.PSTYPE); + + // 璁剧疆鐢熶骇绾垮悕绉帮紙濡傛灉鏈塴ineNo锛� + if (this.formData.lineNo && this.formData.workShop) { + this.formData.lineName = this.formData.lineNo; + } + + // 鍔犺浇杞﹂棿鍒楄〃鍜岀浉鍏充俊鎭� + this.loadDepartmentAndLineInfo(); + + // 鍔犺浇妫�楠岄」鐩� + this.loadInspectionItems(); + } + }); + }, + + // 鍔犺浇杞﹂棿鍜岀嚎浣撲俊鎭� + 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() { + if (this.formData.fsubmit == 1) { + this.$showMessage("璇ユ楠屽崟宸叉彁浜わ紝涓嶈兘淇敼涓嶅悎鏍兼弿杩�"); + return; + } + this.showPopup = !this.showPopup; + this.remarks = this.formData.remarks; + }, + edit() { + if (this.remarks) { + //saveRemarksGid + this.$post({ + url: "/RKJ/saveRemarksGid", + data: { + gid: this.formData.id, + remarks: this.remarks + } + }).then(res => { + if (res.data.tbBillList > 0) { + this.formData.remarks = this.remarks; + this.showPopup = !this.showPopup; + this.$showMessage("淇濆瓨鎴愬姛"); + } + }) + } + }, + 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 + } + }).then(res => { + + this.tableData = res.data.tbBillList; + if (this.tableData.length === 0) { + this.$showMessage("璇ョ墿鏂欐湭缁存姢妫�楠岄」鐩紝璇峰厛缁存姢妫�楠岄」鐩紒"); + this.isSubmit = true; + this.tableData = []; + this.isShowTable = true; + // 淇濇寔鏂板缓妯″紡锛屼笉鍒囨崲鍒版煡鐪嬫ā寮� + this.isUpdate = true; + } else { + this.isSubmit = false; + this.isShowTable = true; + this.isUpdate = true; + } + }); + }, + saveTable() { + if (this.tableData.length === 0) { + return; + } + + this.$post({ + url: "/RKJ/saveItem", + data: { + gid: this.formData.id, + items: this.tableData, + userNo: this.$loginInfo.account + } + }).then(res => { + this.formData.id = res.data.tbBillList; + this.isShowTable = false; + this.isUpdate = false; + this.init(); + }) + }, + 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; + } + + // 妫�鏌ラ拤閽夋帹閫佹潯浠讹細PSZT涓哄緟鍒わ紝涓斾笉鑹師鍥犮�佷笉鑹弿杩般�佹墍灞炶溅闂翠笉涓虹┖ + const shouldPushToDingTalk = this.PSTYPE === '寰呭垽' && + this.badreason && + this.formData.fngDesc && + this.WORKSHOP; + + let confirmMessage = '纭畾瑕佹彁浜ゆ妫�楠屽崟鍚楋紵鎻愪氦鍚庡皢鏃犳硶淇敼銆�'; + if (shouldPushToDingTalk) { + confirmMessage += '\n\n婊¤冻閽夐拤鎺ㄩ�佹潯浠讹紝灏嗚嚜鍔ㄦ帹閫佸埌閽夐拤瀹℃壒娴佺▼銆�'; + } + + // 纭鎻愪氦 + uni.showModal({ + title: '纭鎻愪氦', + content: confirmMessage, + 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) { + let successMessage = "妫�楠屽崟鎻愪氦鎴愬姛锛�"; + if (shouldPushToDingTalk) { + successMessage += "\n宸叉帹閫佸埌閽夐拤瀹℃壒娴佺▼銆�"; + } + this.$showMessage(successMessage); + // 鏇存柊鏈湴鐘舵�� + this.formData.fsubmit = 1; + // 鍒锋柊鏁版嵁 + this.init(); + } else { + this.$showMessage(res.message || "鎻愪氦澶辫触"); + } + }).catch(error => { + console.error("鎻愪氦澶辫触:", error); + this.$showMessage("鎻愪氦澶辫触锛岃閲嶈瘯"); + }); + } + } + }); + }, + viewAttachmentInfo() { + this.showAttachmentPopup = true; // 鍏堝脊绐� + this.attachmentsLoading = true; + this.attachments = []; + this.$post({ + url: "/RKJ/getAttachments", + data: { + itemNo: this.formData.itemNo + } + }).then(res => { + this.attachmentsLoading = false; + if (res.status === 0) { + this.attachments = res.data.tbBillList; + // 涓烘瘡涓檮浠惰缃粯璁ゅ彲鐢ㄧ姸鎬� + this.attachments.forEach((item, index) => { + this.$set(item, 'ftpAvailable', true); // 榛樿璁や负鏂囦欢鍙敤 + this.$set(item, 'checking', false); + }); + } else if (res.status === 1 && res.message === "璇ユ楠屽崟鏈笂浼犻檮浠朵俊鎭紒") { + uni.showToast({ + title: res.message, + icon: "none" + }); + } else { + uni.showToast({ + title: "鑾峰彇闄勪欢澶辫触", + icon: "none" + }); + } + }); + }, + downloadAttachment(item) { + // 鍘婚櫎鎵�鏈夌┖鏍笺�佸叏瑙掔┖鏍笺�佸洖杞︺�佹崲琛� + const fileName = item.fattach.replace(/[\s\u3000\r\n]+/g, '').trim(); + // 浣跨敤閰嶇疆鐨勬湇鍔″櫒鍦板潃鍜孎TP鏈嶅姟鍣ㄥ湴鍧� + const url = this.$store.state.serverInfo.serverAPI + "/RKJ/DownloadFtpFile?itemNo=" + encodeURIComponent( + item.itemNo) + "&fileName=" + encodeURIComponent(fileName) + "&ftpServer=" + encodeURIComponent( + this.$store.state.serverInfo.ftpServer); + + // 妫�鏌ヨ繍琛岀幆澧� + // #ifdef H5 + // H5鐜锛氫娇鐢ㄦ祻瑙堝櫒涓嬭浇 + this.downloadFileInBrowser(url, fileName); + // #endif + + // #ifdef APP-PLUS + // APP鐜锛氫娇鐢╱ni.downloadFile + this.downloadFileInApp(url, fileName); + // #endif + + // #ifdef MP + // 灏忕▼搴忕幆澧冿細浣跨敤uni.downloadFile + this.downloadFileInApp(url, fileName); + // #endif + }, + // 鍦ㄦ祻瑙堝櫒涓笅杞芥枃浠� + downloadFileInBrowser(url, fileName) { + uni.showLoading({ + title: '姝e湪鍑嗗涓嬭浇...' + }); + + // 鏂规硶1锛氬垱寤洪殣钘忕殑a鏍囩涓嬭浇 + try { + const link = document.createElement('a'); + link.href = url; + link.download = fileName; + link.style.display = 'none'; + document.body.appendChild(link); + link.click(); + document.body.removeChild(link); + + uni.hideLoading(); + uni.showToast({ + title: '涓嬭浇宸插紑濮�', + icon: 'success', + duration: 2000 + }); + } catch (error) { + console.log('a鏍囩涓嬭浇澶辫触锛屽皾璇晈indow.open鏂瑰紡:', error); + // 鏂规硶2锛氫娇鐢╳indow.open + try { + window.open(url, '_blank'); + uni.hideLoading(); + uni.showToast({ + title: '涓嬭浇宸插紑濮�', + icon: 'success', + duration: 2000 + }); + } catch (error2) { + console.log('window.open涓嬭浇澶辫触锛屽皾璇昮etch鏂瑰紡:', error2); + // 鏂规硶3锛氫娇鐢╢etch涓嬭浇 + this.downloadFileWithFetch(url, fileName); + } + } + }, + // 浣跨敤fetch涓嬭浇鏂囦欢 + downloadFileWithFetch(url, fileName) { + fetch(url) + .then(response => { + if (!response.ok) { + throw new Error(`HTTP error! status: ${response.status}`); + } + return response.blob(); + }) + .then(blob => { + // 鍒涘缓blob URL + const blobUrl = window.URL.createObjectURL(blob); + + // 鍒涘缓涓嬭浇閾炬帴 + const link = document.createElement('a'); + link.href = blobUrl; + link.download = fileName; + link.style.display = 'none'; + document.body.appendChild(link); + link.click(); + document.body.removeChild(link); + + // 閲婃斁blob URL + window.URL.revokeObjectURL(blobUrl); + + uni.hideLoading(); + uni.showToast({ + title: '涓嬭浇鎴愬姛', + icon: 'success', + duration: 2000 + }); + }) + .catch(error => { + console.error('Fetch涓嬭浇澶辫触:', error); + uni.hideLoading(); + if (error.message.includes('404')) { + uni.showModal({ + title: '鏂囦欢涓嶅瓨鍦�', + content: `璇ラ檮浠跺湪FTP鏈嶅姟鍣ㄤ笂涓嶅瓨鍦╜, + showCancel: false + }); + } else { + uni.showModal({ + title: '涓嬭浇澶辫触', + content: `涓嬭浇澶辫触: ${error.message}`, + showCancel: false + }); + } + }); + }, + // 鍦ˋPP涓笅杞芥枃浠� + downloadFileInApp(url, fileName) { + // #ifdef APP-PLUS + uni.showLoading({ + title: '浠嶧TP鏈嶅姟鍣ㄤ笅杞戒腑...' + }); + + // Android 鑾峰彇瀛樺偍璺緞 + const saveDir = plus.os.name === 'Android' ? plus.io.convertLocalFileSystemURL('_downloads/') : plus.io + .convertLocalFileSystemURL('_documents/'); + const filePath = `${saveDir}${fileName}`; + + const downloadTask = uni.downloadFile({ + url: url, + filePath: filePath, // 鎸囧畾淇濆瓨璺緞 + success: (res) => { + uni.hideLoading(); + if (res.statusCode === 200) { + const fileInfo = { + name: fileName, + path: res.filePath || filePath, + tempPath: res.tempFilePath + }; + + uni.showModal({ + title: '涓嬭浇鎴愬姛', + content: `鏂囦欢宸蹭繚瀛樺埌锛�${fileInfo.path}`, + showCancel: true, + confirmText: '鎵撳紑鏂囦欢', + cancelText: '纭畾', + success: (modalRes) => { + if (modalRes.confirm) { + // 鐢ㄦ埛閫夋嫨鎵撳紑鏂囦欢 + this.openFileInApp(fileInfo); + } + } + }); + } else if (res.statusCode === 404) { + uni.showModal({ + title: '鏂囦欢涓嶅瓨鍦�', + content: `璇ラ檮浠跺湪FTP鏈嶅姟鍣ㄤ笂涓嶅瓨鍦╜, + showCancel: false + }); + } else { + uni.showModal({ + title: '涓嬭浇澶辫触', + content: `鐘舵�佺爜锛�${res.statusCode}`, + showCancel: false + }); + } + }, + fail: (error) => { + uni.hideLoading(); + console.error('涓嬭浇澶辫触:', error); + uni.showModal({ + title: '涓嬭浇澶辫触', + content: `缃戠粶閿欒锛�${error.errMsg}`, + showCancel: false + }); + } + }); + + // 鐩戝惉涓嬭浇杩涘害 + downloadTask.onProgressUpdate((res) => { + const progress = Math.round(res.progress); + uni.showLoading({ + title: `涓嬭浇涓� ${progress}%`, + mask: true + }); + }); + // #endif + + // #ifdef MP + // 灏忕▼搴忕幆澧冪殑绠�鍖栧疄鐜� + uni.showLoading({ + title: '涓嬭浇涓�...' + }); + uni.downloadFile({ + url: url, + success: (res) => { + uni.hideLoading(); + if (res.statusCode === 200) { + uni.showToast({ + title: '涓嬭浇瀹屾垚', + icon: 'success' + }); + } + }, + fail: (error) => { + uni.hideLoading(); + uni.showModal({ + title: '涓嬭浇澶辫触', + content: error.errMsg, + showCancel: false + }); + } + }); + // #endif + }, + // APP涓墦寮�鏂囦欢 + openFileInApp(fileInfo) { + // #ifdef APP-PLUS + if (typeof plus !== 'undefined') { + const filePath = fileInfo.path || fileInfo.tempPath; + + // 灏濊瘯鎵撳紑鏂囦欢 + plus.runtime.openFile(filePath, {}, (error) => { + console.error('鎵撳紑鏂囦欢澶辫触:', error); + uni.showModal({ + title: '鏃犳硶鎵撳紑', + content: '绯荤粺涓病鏈夋壘鍒拌兘鎵撳紑姝ゆ枃浠剁殑搴旂敤绋嬪簭', + showCancel: false + }); + }); + } + // #endif + }, + // 棰勮FTP鏂囦欢 + previewFtpFile(item) { + const fileName = item.fattach.replace(/[\s\u3000\r\n]+/g, '').trim(); + const fileExt = fileName.split('.').pop().toLowerCase(); + + // 妫�鏌ユ枃浠剁被鍨嬫槸鍚︽敮鎸侀瑙� + if (!this.isPreviewable(fileName)) { + uni.showModal({ + title: '涓嶆敮鎸侀瑙�', + content: '璇ユ枃浠剁被鍨嬩笉鏀寔鍦ㄧ嚎棰勮锛岃涓嬭浇鍚庢煡鐪�', + showCancel: false + }); + return; + } + + const previewUrl = this.$store.state.serverInfo.serverAPI + "/RKJ/PreviewFtpFile?itemNo=" + + encodeURIComponent(item.itemNo) + "&fileName=" + encodeURIComponent(fileName) + "&ftpServer=" + + encodeURIComponent(this.$store.state.serverInfo.ftpServer); + + // 鏍规嵁鏂囦欢绫诲瀷杩涜涓嶅悓鐨勯瑙堝鐞� + if (['pdf'].includes(fileExt)) { + this.previewPdfFile(previewUrl, fileName); + } else if (['jpg', 'jpeg', 'png', 'gif', 'bmp'].includes(fileExt)) { + this.previewImageFile(previewUrl, fileName); + } else if (['txt'].includes(fileExt)) { + this.previewTextFile(previewUrl, fileName); + } else if (['doc', 'docx', 'xls', 'xlsx', 'ppt', 'pptx'].includes(fileExt)) { + this.previewOfficeFile(previewUrl, fileName); + } else { + // 灏濊瘯閫氱敤棰勮 + this.previewGenericFile(previewUrl, fileName); + } + }, + + // 棰勮PDF鏂囦欢 + previewPdfFile(url, fileName) { + // 鍏堜笅杞絇DF鏂囦欢锛岃浆涓篵ase64鍚庨瑙� + uni.request({ + url: url, + method: 'GET', + responseType: 'arraybuffer', + success: (res) => { + if (res.statusCode === 200) { + const base64Data = uni.arrayBufferToBase64(res.data); + // 瀛樺偍鍒板叏灞�鍙橀噺 + getApp().globalData.tempPDF = base64Data; + uni.navigateTo({ + url: `/pages/fileView/pdfView` + }); + } else { + this.handlePreviewError(res.statusCode, fileName); + } + }, + fail: (error) => { + this.handlePreviewError(0, fileName, error.errMsg); + } + }); + }, + + // 棰勮鍥剧墖鏂囦欢 + previewImageFile(url, fileName) { + // #ifdef APP-PLUS + // APP鐜锛氬厛涓嬭浇鍒版湰鍦板啀棰勮锛岄伩鍏嶇綉缁滃浘鐗囧姞杞介棶棰� + uni.showLoading({ + title: '鍔犺浇鍥剧墖...' + }); + uni.downloadFile({ + url: url, + success: (res) => { + uni.hideLoading(); + if (res.statusCode === 200) { + // 浣跨敤鏈湴涓存椂璺緞 + uni.navigateTo({ + url: `/pages/fileView/imageView?url=${encodeURIComponent(res.tempFilePath)}` + }); + } else { + this.handlePreviewError(res.statusCode, fileName); + } + }, + fail: (error) => { + uni.hideLoading(); + this.handlePreviewError(0, fileName, error.errMsg); + } + }); + // #endif + + // #ifdef H5 || MP + // H5鍜屽皬绋嬪簭锛氱洿鎺ヤ娇鐢ㄧ綉缁淯RL + uni.navigateTo({ + url: `/pages/fileView/imageView?url=${encodeURIComponent(url)}` + }); + // #endif + }, + + // 棰勮鏂囨湰鏂囦欢 + previewTextFile(url, fileName) { + // 鏂囨湰鏂囦欢鐩存帴鏄剧ず鍦ㄥ脊绐椾腑 + uni.showLoading({ + title: '鍔犺浇鏂囦欢鍐呭...' + }); + uni.request({ + url: url, + method: 'GET', + success: (res) => { + uni.hideLoading(); + if (res.statusCode === 200) { + const fileType = this.getFileType(fileName); + + if (fileType === 'text') { + // 鏂囨湰鏂囦欢锛氭樉绀哄唴瀹� + this.showFilePreview(res.data, fileName); + } else if (fileType === 'image') { + // 鍥剧墖鏂囦欢锛氭樉绀哄浘鐗嘦RL + this.showFilePreview(url, fileName); + } else { + // 鍏朵粬鏂囦欢绫诲瀷锛氭樉绀烘彁绀轰俊鎭� + this.showFilePreview('', fileName); + } + } else { + this.handlePreviewError(res.statusCode, fileName); + } + }, + fail: (error) => { + uni.hideLoading(); + this.handlePreviewError(0, fileName, error.errMsg); + } + }); + }, + + // 妫�娴嬫枃浠剁被鍨� + getFileType(fileName) { + const fileExt = fileName.split('.').pop().toLowerCase(); + + if (['txt', 'log', 'md', 'csv', 'json', 'xml'].includes(fileExt)) { + return 'text'; + } else if (['jpg', 'jpeg', 'png', 'gif', 'bmp', 'webp'].includes(fileExt)) { + return 'image'; + } else if (['xls', 'xlsx', 'doc', 'docx', 'ppt', 'pptx'].includes(fileExt)) { + return 'excel'; + } else { + return 'unsupported'; + } + }, + + // 鏄剧ず鏂囦欢棰勮寮圭獥 + showFilePreview(content, fileName) { + this.previewContent = content; + this.previewTitle = fileName; + this.previewItemNo = this.selectedAttachment?.itemNo || ''; + this.previewType = this.getFileType(fileName); + this.showFilePreviewPopup = true; + }, + + // 鍏抽棴鏂囦欢棰勮寮圭獥 + closeFilePreview() { + this.showFilePreviewPopup = false; + this.previewContent = ''; + this.previewTitle = ''; + this.previewItemNo = ''; + this.previewType = ''; + }, + + // 涓嬭浇棰勮鏂囦欢 + downloadPreviewFile() { + const item = { + fattach: this.previewTitle, + itemNo: this.previewItemNo + }; + this.downloadAttachment(item); + this.closeFilePreview(); + }, + + // 鍦ㄥ脊绐椾腑棰勮鍥剧墖锛堟斁澶у姛鑳斤級 + previewImageInPopup() { + // 浣跨敤uni.previewImage API瀹炵幇鍥剧墖鏀惧ぇ棰勮 + uni.previewImage({ + current: this.previewContent, // 褰撳墠鏄剧ず鍥剧墖鐨勯摼鎺� + urls: [this.previewContent], // 闇�瑕侀瑙堢殑鍥剧墖閾炬帴鍒楄〃 + loop: false, // 鏄惁寮�鍚浘鐗囪疆鎾� + indicator: 'default', // 鍥剧墖鎸囩ず鍣ㄧ被鍨� + longPressActions: { + itemList: ['鍙戦�佺粰鏈嬪弸', '淇濆瓨鍥剧墖', '鏀惰棌'], + success: function(data) { + console.log('閫変腑浜嗙' + (data.tapIndex + 1) + '涓寜閽�'); + }, + fail: function(err) { + console.log(err.errMsg); + } + }, + success: () => { + console.log('鍥剧墖棰勮鎴愬姛'); + }, + fail: (err) => { + console.error('鍥剧墖棰勮澶辫触:', err); + uni.showToast({ + title: '鍥剧墖棰勮澶辫触', + icon: 'none' + }); + } + }); + }, + + // 棰勮Office鏂囦欢 + previewOfficeFile(url, fileName) { + // 鍏堟鏌xcel鏂囦欢锛屼娇鐢ㄤ笓闂ㄧ殑Excel棰勮椤甸潰 + const fileExt = fileName.split('.').pop().toLowerCase(); + if (['xls', 'xlsx'].includes(fileExt)) { + // Excel鏂囦欢棰勮 + uni.request({ + url: url, + method: 'GET', + responseType: 'arraybuffer', + success: (res) => { + if (res.statusCode === 200) { + const base64Data = uni.arrayBufferToBase64(res.data); + // 瀛樺偍 Base64 鏁版嵁鍒版湰鍦板瓨鍌� + uni.setStorageSync('excelBase64Data', base64Data); + uni.navigateTo({ + url: `/pages/fileView/excelView` + }); + } else { + this.handlePreviewError(res.statusCode, fileName); + } + }, + fail: (error) => { + this.handlePreviewError(0, fileName, error.errMsg); + } + }); + } else if (['doc', 'docx'].includes(fileExt)) { + // Word鏂囦欢锛屽皾璇曚娇鐢╓ord棰勮椤甸潰鎴栬�呭井杞湪绾块瑙� + try { + const officePreviewUrl = + `https://view.officeapps.live.com/op/view.aspx?src=${encodeURIComponent(url)}`; + // 濡傛灉鏈墂ebView椤甸潰锛屼娇鐢╳ebView棰勮 + this.previewGenericFile(officePreviewUrl, fileName); + } catch (error) { + this.handlePreviewError(0, fileName, '涓嶆敮鎸佹Office鏂囦欢绫诲瀷鐨勯瑙�'); + } + } else { + // 鍏朵粬Office鏂囦欢锛屼娇鐢ㄥ井杞湪绾块瑙堟湇鍔� + const officePreviewUrl = + `https://view.officeapps.live.com/op/view.aspx?src=${encodeURIComponent(url)}`; + this.previewGenericFile(officePreviewUrl, fileName); + } + }, + + // 閫氱敤鏂囦欢棰勮 + previewGenericFile(url, fileName) { + // 鐢变簬娌℃湁閫氱敤鐨剋ebView椤甸潰锛屾樉绀烘彁绀哄苟鎻愪緵涓嬭浇 + uni.showModal({ + title: '鏂囦欢棰勮', + content: `鏂囦欢 "${fileName}" 闇�瑕佷笅杞藉悗鏌ョ湅锛屾槸鍚︾珛鍗充笅杞斤紵`, + showCancel: true, + confirmText: '涓嬭浇', + cancelText: '鍙栨秷', + success: (res) => { + if (res.confirm) { + const item = { + fattach: fileName, + itemNo: this.selectedAttachment.itemNo + }; + this.downloadAttachment(item); + } + } + }); + }, + + // 澶勭悊棰勮閿欒 + handlePreviewError(statusCode, fileName, errorMsg = '') { + let message = ''; + if (statusCode === 404) { + message = `鏂囦欢 ${fileName} 鍦‵TP鏈嶅姟鍣ㄤ笂涓嶅瓨鍦╜; + } else if (statusCode === 0) { + message = `棰勮澶辫触锛�${errorMsg}`; + } else { + message = `棰勮澶辫触锛岀姸鎬佺爜锛�${statusCode}`; + } + + uni.showModal({ + title: '棰勮澶辫触', + content: message, + showCancel: true, + confirmText: '涓嬭浇', + cancelText: '鍙栨秷', + success: (res) => { + if (res.confirm) { + // 鐢ㄦ埛閫夋嫨涓嬭浇鏂囦欢 + const item = { + fattach: fileName, + itemNo: this.selectedAttachment.itemNo + }; + this.downloadAttachment(item); + } + } + }); + }, + onShow() { + //姣忔杩涘叆椤甸潰閮戒細鎵ц鐨勬柟娉� + if (this.formData.id) { + this.init(); + } + }, + // 闄勪欢鐩稿叧鏂规硶 + closeAttachmentPopup() { + this.showAttachmentPopup = false; + }, + showAttachmentDetailDialog(item) { + console.log('鏌ョ湅璇︽儏', item); + this.selectedAttachment = item; + this.showAttachmentPopup = false; + this.showAttachmentDetail = true; + console.log('showAttachmentDetail:', this.showAttachmentDetail); + }, + closeAttachmentDetail() { + this.showAttachmentDetail = false; + this.selectedAttachment = null; + this.showAttachmentPopup = true; + }, + isPreviewable(filename) { + if (!filename) return false; + const ext = filename.trim().split('.').pop().toLowerCase(); + // 鏀寔鍦ㄧ嚎棰勮鐨勬枃浠剁被鍨� + return [ + 'pdf', // PDF鏂囦欢 + 'jpg', 'jpeg', 'png', 'gif', 'bmp', 'webp', // 鍥剧墖鏂囦欢 + 'txt', 'log', 'md', // 鏂囨湰鏂囦欢 + 'doc', 'docx', // Word鏂囨。 + 'xls', 'xlsx', // Excel琛ㄦ牸 + 'ppt', 'pptx', // PowerPoint婕旂ず鏂囩 + 'csv' // CSV鏂囦欢 + ].includes(ext); + }, + + // 涓嬫媺妗嗕簨浠跺鐞嗘柟娉� + onBadreasonChange(e) { + const index = e.detail.value; + this.badreasonIndex = index; + this.badreason = this.badreasonOptions[index]; + this.saveDropdownFields('badreason'); + }, + onWorkshopChange(e) { + const index = e.detail.value; + this.workshopIndex = index; + this.WORKSHOP = this.workshopOptions[index]; + this.saveDropdownFields('WORKSHOP'); + }, + onPstypeChange(e) { + const index = e.detail.value; + this.pstypeIndex = index; + this.PSTYPE = this.pstypeOptions[index]; + this.saveDropdownFields('PSTYPE'); + }, + saveDropdownFields(fieldName) { + // 鐩存帴淇濆瓨鍒版暟鎹簱 + const requestData = { + gid: this.formData.id, + releaseNo: this.formData.releaseNo, + BLYY: this.badreason || '', + SSCJ: this.WORKSHOP || '', + PSZT: this.PSTYPE || '' + }; + console.log('鍙戦�佺殑鏁版嵁:', requestData); + console.log('badreason:', this.badreason); + console.log('WORKSHOP:', this.WORKSHOP); + console.log('PSTYPE:', this.PSTYPE); + console.log('閫夋嫨鐨勫瓧娈�:', fieldName); + this.$post({ + url: "/RKJ/saveDropdownFields", + data: requestData + }).then(res => { + if (res && res.data && res.data.data && res.data.data.tbBillList && res.data.data.tbBillList + .length > 0) { + // 寤惰繜閲嶆柊鍔犺浇鏁版嵁锛岀‘淇濇暟鎹簱鏇存柊瀹屾垚 + setTimeout(() => { + this.init(); + }, 500); + } + }).catch(err => { + console.error('淇濆瓨澶辫触锛�', err); + }); + }, + + + + drawingConfirm() { + this.drawingShow = false + this.imageShow = false + this.productionShow = false + this.itemShow=false + }, + drawingCancel() { + this.drawingShow = false + this.imageShow = false + this.productionShow = false + // const item = '83040700101' + const item = this.formData.billNo; + console.log(this.formData.billNo ); + console.log('daa001:', item); + console.log('ItemNo:', this.formData.itemNo); + + const url = this.$store.state.serverInfo.serverAPI + "/LLJ/getWomdab"; + // 鎴栬�呭鏋滆矾寰勪笉鍚岋紝璇蜂娇鐢ㄦ纭殑绔偣 + // const url = "http://192.168.0.100:10054/api/getWomdab" + + let _this = this; + + uni.request({ + url: url, + method: 'POST', + header: { + 'Content-Type': 'application/json' + }, + data: { + daa001: item, // 鏍规嵁DTO灞炴�у悕浼犻�� + ItemNo: this.formData.itemNo // 娉ㄦ剰澶у皬鍐欏尮閰� + }, + success: (response) => { + console.log(response); + console.log("-------------------------------------"); + // 鏍规嵁鍚庣杩斿洖鐨勬暟鎹粨鏋勮繘琛岃皟鏁� + if (response.data.status === 1) { + // 鐘舵�佷负1琛ㄧず娌℃湁鏁版嵁 + _this.drawing = []; + uni.showToast({ + title: response.data.message || '璇ユ楠屽崟鏈笂浼犻檮浠朵俊鎭�', + icon: 'none' + }); + } else if (response.data.status === 0) { + // 鐘舵�佷负0琛ㄧず鎴愬姛 + if (response.data.data && response.data.data.tbBillList) { + _this.drawing = response.data.data.tbBillList; + + // 閬嶅巻鏁版嵁锛屽垽鏂枃浠跺悗缂�骞舵坊鍔犲瓧娈� + _this.drawing.forEach((file) => { + // 鑾峰彇鏂囦欢鍚嶇殑鍚庣紑 + const fileExtension = file.fName ? file.fName.split('.').pop().toLowerCase() : ''; + + // 瀹氫箟鏀寔鐨勬枃浠剁被鍨� + const supportedExtensions = ['jpg', 'pdf', 'xlsx', 'doc', 'docx', 'xls']; + + // 鍒ゆ柇鏄惁鏀寔璇ユ枃浠剁被鍨� + file.isSupported = supportedExtensions.includes(fileExtension); + }); + } else { + _this.drawing = []; + } + } else { + // 鍏朵粬鐘舵�佺爜澶勭悊 + _this.drawing = []; + uni.showToast({ + title: response.data.message || '璇锋眰澶辫触', + icon: 'none' + }); + } + }, + fail: (error) => { + uni.showToast({ + title: '璇锋眰鍥剧焊閾炬帴澶辫触', + icon: 'none' + }); + console.error('璇锋眰澶辫触:', error); + } + }); + }, + itemCancel() { + this.itemShow=false + }, + + + fetchDrawingNumber(itemNo) { + // const item = '83040700101' + const item = itemNo; + console.log(itemNo) + // console.log(item) + const url = this.$store.state.serverInfo.serverAPI +"/PLM/RetrieveDrawings?ItemNo=" + item + + // const item = '5.06.04.4002'; + // const url = "http://192.168.0.100:10054/api/PLM/RetrieveDrawings?ItemNo=" + item + + let _this = this; + + uni.request({ + url: url, + method: 'POST', + success: (response) => { + console.log(response) + if (response.data.data == '杩斿洖缁撴灉涓虹┖') { + _this.drawing = [] + } else { + _this.drawing = response.data.data + // 閬嶅巻鏁版嵁锛屽垽鏂枃浠跺悗缂�骞舵坊鍔犲瓧娈� + _this.drawing.forEach((file) => { + // 鑾峰彇鏂囦欢鍚嶇殑鍚庣紑 + const fileExtension = file.fName.split('.').pop() + .toLowerCase(); + + // 瀹氫箟鏀寔鐨勬枃浠剁被鍨� + const supportedExtensions = ['jpg', 'pdf', 'xlsx', 'doc', + 'docx', + 'xls' + ]; + + // 鍒ゆ柇鏄惁鏀寔璇ユ枃浠剁被鍨� + file.isSupported = supportedExtensions.includes(fileExtension); + }); + } + }, + fail: (error) => { + uni.showToast({ + title: '璇锋眰鍥剧焊閾炬帴澶辫触', + icon: 'none' + }); + } + }); + this.drawingShow = true + }, + + getBom(){ + // const item = '83040700101' + const item = this.formData.BillNo; + console.log(this.formData.BillNo ); + console.log('daa001:', item); + console.log('ItemNo:', this.formData.itemNo); + + const url = this.$store.state.serverInfo.serverAPI + "/LLJ/getWomdab"; + // 鎴栬�呭鏋滆矾寰勪笉鍚岋紝璇蜂娇鐢ㄦ纭殑绔偣 + // const url = "http://192.168.0.100:10054/api/getWomdab" + + let _this = this; + + uni.request({ + url: url, + method: 'POST', + header: { + 'Content-Type': 'application/json' + }, + data: { + daa001: item, // 鏍规嵁DTO灞炴�у悕浼犻�� + ItemNo: this.formData.itemNo // 娉ㄦ剰澶у皬鍐欏尮閰� + }, + success: (response) => { + console.log(response); + console.log("-------------------------------------"); + // 鏍规嵁鍚庣杩斿洖鐨勬暟鎹粨鏋勮繘琛岃皟鏁� + if (response.data.status === 1) { + // 鐘舵�佷负1琛ㄧず娌℃湁鏁版嵁 + _this.drawing = []; + uni.showToast({ + title: response.data.message || '璇ユ楠屽崟鏈笂浼犻檮浠朵俊鎭�', + icon: 'none' + }); + } else if (response.data.status === 0) { + // 鐘舵�佷负0琛ㄧず鎴愬姛 + if (response.data.data && response.data.data.tbBillList) { + _this.drawing = response.data.data.tbBillList; + + // 閬嶅巻鏁版嵁锛屽垽鏂枃浠跺悗缂�骞舵坊鍔犲瓧娈� + _this.drawing.forEach((file) => { + // 鑾峰彇鏂囦欢鍚嶇殑鍚庣紑 + const fileExtension = file.fName ? file.fName.split('.').pop().toLowerCase() : ''; + + // 瀹氫箟鏀寔鐨勬枃浠剁被鍨� + const supportedExtensions = ['jpg', 'pdf', 'xlsx', 'doc', 'docx', 'xls']; + + // 鍒ゆ柇鏄惁鏀寔璇ユ枃浠剁被鍨� + file.isSupported = supportedExtensions.includes(fileExtension); + }); + } else { + _this.drawing = []; + } + } else { + // 鍏朵粬鐘舵�佺爜澶勭悊 + _this.drawing = []; + uni.showToast({ + title: response.data.message || '璇锋眰澶辫触', + icon: 'none' + }); + } + }, + fail: (error) => { + uni.showToast({ + title: '璇锋眰鍥剧焊閾炬帴澶辫触', + icon: 'none' + }); + console.error('璇锋眰澶辫触:', error); + } + }); + this.itemShow = true + }, + + //鍥剧焊鐩稿叧鏂囨。 + openDrawings(item) { + console.log("jkjoi", item) + if (item.fRelevantObject.length > 2) { + // 鐢熸垚璇锋眰URL锛堢畝鍖栫紪鐮侀�昏緫锛� + const encodedName = encodeURIComponent(item.fName); + const url = this.$store.state.serverInfo.serverAPI+`/PLM/OpenDrawingsGet?fileId=${item.fRelevantObject}&fName=${encodedName}`; + console.log('璇锋眰URL:', url); + + const now = new Date(); + const timestamp = [ + now.getFullYear(), + String(now.getMonth() + 1).padStart(2, '0'), + String(now.getDate()).padStart(2, '0'), + String(now.getHours()).padStart(2, '0'), + String(now.getMinutes()).padStart(2, '0'), + String(now.getSeconds()).padStart(2, '0') + ].join(''); + + // 鐢熸垚鏂版枃浠跺悕锛堝熀纭�鍚峗鏃堕棿鎴�.鍚庣紑锛� + this.fileName = `${item.fName}_${timestamp}.pdf`; + console.log('鏂版枃浠跺悕:', this.fileName); + + uni.downloadFile({ + url: url, + success: (res) => { + console.log(res); + let fileName = this.fileName; + let fileExt = fileName.split('.').pop(); + // let newFilePath = "_doc/uniapp_temp_1742877118745/download" + "/" + fileName; + // console.log('newFilePath', newFilePath) + if (fileExt === 'xls' || fileExt === 'xlsx' || fileExt === 'pdf'|| fileExt === 'jpg'|| fileExt === 'png') { + plus.io.resolveLocalFileSystemURL(res.tempFilePath, (entry) => { + // 鑾峰彇鏂囦欢鎵�鍦ㄧ殑鐩綍 + entry.getParent((parentEntry) => { + let newFileName = this.fileName; // 鏂扮殑鏂囦欢鍚� + + // 绉诲姩骞堕噸鍛藉悕鏂囦欢 + entry.moveTo( + parentEntry, + newFileName, + (newEntry) => { + console.log('閲嶅懡鍚嶆垚鍔�:', newEntry.fullPath); + + // 鎵撳紑 Excel 鏂囦欢 + plus.runtime.openFile(newEntry.fullPath, {}, (e) => { + console.error('鏃犳硶鎵撳紑 Excel 鏂囦欢:', e); + }); + + // let pages = getCurrentPages(); + // let beforePage = pages[pages.length - 2]; + // uni.navigateBack({ + // delta: 1, //杩斿洖鐨勯〉闈㈡暟锛屽鏋滀负1琛ㄧず杩斿洖涓婁竴椤� + // success: (event) => { + // beforePage.$vm.reload() + // } + // }); + + }, + (err) => { + console.error('閲嶅懡鍚嶅け璐�:', err); + } + ); + }, (err) => { + console.error('鑾峰彇鐖剁洰褰曞け璐�:', err); + }); + }, (err) => { + console.error('鑾峰彇鏂囦欢澶辫触:', err); + }); + } else { + console.error('鏂囦欢鏍煎紡涓嶅尮閰�:', fileExt); + uni.showToast({ + title: '鏂囦欢鏍煎紡涓嶆敮鎸�', + icon: 'none' + }); + } + } + }) + uni.request({ + url: url, + method: 'POST', + responseType: 'arraybuffer', + success: (response) => { + console.log(response.data) + if (!response) { + uni.showToast({ + title: "鍗忚棰勮澶辫触", + duration: 2000 + }); + } + + }, + fail: (error) => { + console.log(error) + uni.showToast({ + title: '璇锋眰棰勮閾炬帴澶辫触', + icon: 'none' + }); + } + }); + } + else + { + uni.showToast({ + title: '璇锋眰棰勮閾炬帴澶辫触', + icon: 'none' + }); + } + }, + + saveFngDesc() { + // 淇濆瓨涓嶈壇鎻忚堪鍒版暟鎹簱 + this.$post({ + url: "/RKJ/saveFngDesc", + data: { + gid: this.formData.id, + fngDesc: this.formData.fngDesc + } + }).then(res => { + if (res.status == 0) { + this.$showMessage("涓嶈壇鎻忚堪淇濆瓨鎴愬姛"); + } else { + this.$showMessage("涓嶈壇鎻忚堪淇濆瓨澶辫触"); + } + }).catch(error => { + console.error("淇濆瓨涓嶈壇鎻忚堪澶辫触:", error); + this.$showMessage("淇濆瓨涓嶈壇鎻忚堪澶辫触锛岃閲嶈瘯"); + }); + } + } + }; +</script> + +<style> /* 鏂板缓琛ㄥ崟 - 浼樺寲鍚庣殑UI鏍峰紡 */ .create-form { padding: 20px; @@ -1723,7 +2149,7 @@ min-height: 100vh; font-family: 'Microsoft YaHei', 'Segoe UI', sans-serif; } - + .form-header { text-align: center; margin-bottom: 30px; @@ -1732,20 +2158,20 @@ 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; @@ -1753,16 +2179,16 @@ 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; @@ -1773,14 +2199,14 @@ display: flex; align-items: center; } - + .section-title::before { content: "鈼�"; color: #3498db; margin-right: 8px; font-size: 12px; } - + .form-row { display: flex; align-items: center; @@ -1788,18 +2214,18 @@ 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: 100px; font-weight: 500; @@ -1809,13 +2235,13 @@ display: flex; align-items: center; } - + .form-label.required::after { content: " *"; color: #e74c3c; font-weight: bold; } - + .form-value { color: #2c3e50; flex: 1; @@ -1825,7 +2251,7 @@ border-radius: 6px; border: 1px solid #e9ecef; } - + .form-select { flex: 1; padding: 10px 12px; @@ -1836,13 +2262,13 @@ 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; min-width: 200px; @@ -1853,7 +2279,7 @@ background-color: white; box-sizing: border-box; } - + .large-quantity-input { min-width: 200px !important; padding: 8px 12px !important; @@ -1866,19 +2292,19 @@ text-align: left !important; flex: 1; } - + .large-quantity-input:focus { border-color: #3498db; box-shadow: 0 0 0 2px rgba(52, 152, 219, 0.2); outline: none; background-color: white; } - + .large-quantity-input::placeholder { color: #95a5a6; font-size: 16px; } - + .input-field { width: 100%; padding: 8px 12px; @@ -1889,13 +2315,13 @@ box-sizing: border-box; min-height: 36px; } - + .input-field:focus { outline: none; border-color: #3498db; box-shadow: 0 0 0 2px rgba(52, 152, 219, 0.2); } - + .form-hint { flex: 1; color: #95a5a6; @@ -1906,7 +2332,7 @@ border-radius: 8px; border: 1px dashed #bdc3c7; } - + .form-actions { text-align: center; padding: 20px; @@ -1914,7 +2340,7 @@ border-radius: 8px; box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1); } - + .btn-primary { background-color: #3498db; color: white; @@ -1931,23 +2357,23 @@ 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; @@ -1958,7 +2384,8 @@ font-family: 'Microsoft YaHei', 'Segoe UI', sans-serif; max-width: 1000px; margin: 0 auto; - padding: 20px 20px 100px 20px; /* 搴曢儴澧炲姞鍐呰竟璺濅负鍥哄畾鎸夐挳鐣欑┖闂� */ + padding: 20px 20px 100px 20px; + /* 搴曢儴澧炲姞鍐呰竟璺濅负鍥哄畾鎸夐挳鐣欑┖闂� */ background-color: #fff; box-shadow: 0 0 10px rgba(0, 0, 0, 0.1); min-height: 100vh; @@ -2008,7 +2435,7 @@ color: #2c3e50; margin-right: 20px; } - + .picker-text { padding: 6px 10px; border: 1px solid #ddd; @@ -2021,7 +2448,7 @@ align-items: center; max-width: 150px; } - + .picker-text.selected { color: #e74c3c; font-weight: 500; @@ -2098,19 +2525,19 @@ left: 50%; transform: translate(-50%, -50%) rotate(-15deg); } - + .watermark.approved { color: #2ecc71; } - + .watermark.rejected { color: #e74c3c; } - + .watermark.pending { color: #f39c12; } - + /* 鎻忚堪鏂囨湰瀹瑰櫒 */ .description-text { position: relative; @@ -2118,7 +2545,7 @@ padding: 25px; background-color: rgba(255, 255, 255, 0.7); } - + /* 璋冩暣琛ㄦ牸鍗曞厓鏍� */ .inspection-table td:nth-child(2) { position: relative; @@ -2146,14 +2573,22 @@ 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); /* 椤堕儴闃村奖 */ + 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 { @@ -2298,22 +2733,22 @@ .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; @@ -2328,7 +2763,7 @@ display: flex; flex-direction: column; } - + .attachment-popup-title { font-size: 22px; font-weight: 700; @@ -2337,42 +2772,42 @@ letter-spacing: 1px; text-align: center; } - + .attachment-popup-divider { height: 1px; - background: linear-gradient(90deg,#e0e7ef 0%,#f5f7fa 100%); + background: linear-gradient(90deg, #e0e7ef 0%, #f5f7fa 100%); margin-bottom: 18px; } - + .attachment-detail-content { margin-bottom: 18px; } - + .attachment-detail-row { display: flex; align-items: center; margin-bottom: 8px; font-size: 15px; } - + .attachment-label { min-width: 80px; color: #1976d2; font-weight: 500; margin-right: 8px; } - + .attachment-detail-empty { color: #888; text-align: center; margin: 30px 0; font-size: 16px; } - + .attachment-popup-close { margin-top: 18px; width: 100%; - background: linear-gradient(90deg,#e0e0e0 0%,#f5f7fa 100%); + background: linear-gradient(90deg, #e0e0e0 0%, #f5f7fa 100%); color: #444; border-radius: 8px; font-size: 16px; @@ -2381,14 +2816,14 @@ font-weight: 600; letter-spacing: 1px; transition: background 0.2s, color 0.2s; - box-shadow: 0 2px 8px rgba(60,60,60,0.06); + box-shadow: 0 2px 8px rgba(60, 60, 60, 0.06); } - + .attachment-popup-close:hover { - background: linear-gradient(90deg,#bdbdbd 0%,#e0e0e0 100%); + background: linear-gradient(90deg, #bdbdbd 0%, #e0e0e0 100%); color: #1976d2; } - + /* 闄勪欢璇︽儏椤甸潰鐨勬搷浣滄寜閽� */ .attachment-actions-detail { margin: 20px 0; @@ -2397,7 +2832,7 @@ justify-content: center; flex-wrap: wrap; } - + .attachment-action-btn { padding: 10px 20px; border: none; @@ -2410,31 +2845,31 @@ align-items: center; justify-content: center; min-width: 120px; - box-shadow: 0 2px 4px rgba(0,0,0,0.1); + box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1); } - + .attachment-action-btn.preview-btn { background: linear-gradient(135deg, #4CAF50, #45a049); color: white; } - + .attachment-action-btn.preview-btn:hover { background: linear-gradient(135deg, #45a049, #3d8b40); transform: translateY(-1px); - box-shadow: 0 4px 8px rgba(0,0,0,0.15); + box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15); } - + .attachment-action-btn.download-btn { background: linear-gradient(135deg, #2196F3, #1976D2); color: white; } - + .attachment-action-btn.download-btn:hover { background: linear-gradient(135deg, #1976D2, #1565C0); transform: translateY(-1px); - box-shadow: 0 4px 8px rgba(0,0,0,0.15); + box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15); } - + /* 鏂囦欢棰勮寮圭獥鏍峰紡 */ .file-preview-popup { width: 80vw; @@ -2443,7 +2878,7 @@ display: flex; flex-direction: column; } - + .file-preview-title { font-size: 18px; font-weight: 700; @@ -2452,13 +2887,13 @@ text-align: center; word-break: break-all; } - + .file-preview-divider { height: 1px; - background: linear-gradient(90deg,#e0e7ef 0%,#f5f7fa 100%); + background: linear-gradient(90deg, #e0e7ef 0%, #f5f7fa 100%); margin-bottom: 16px; } - + .file-preview-content { flex: 1; max-height: 400px; @@ -2469,7 +2904,7 @@ margin-bottom: 16px; border: 1px solid #e2e8f0; } - + .file-preview-content pre { font-family: 'Consolas', 'Monaco', 'Courier New', monospace; font-size: 12px; @@ -2479,7 +2914,7 @@ word-wrap: break-word; margin: 0; } - + /* 鍥剧墖棰勮鏍峰紡 */ .image-preview-container { display: flex; @@ -2487,38 +2922,38 @@ align-items: center; min-height: 200px; } - + /* 涓嶆敮鎸佹枃浠剁被鍨嬬殑鎻愮ず鏍峰紡 */ .unsupported-preview { text-align: center; padding: 40px 20px; color: #666; } - + .unsupported-icon { font-size: 48px; margin-bottom: 16px; } - + .unsupported-text { font-size: 16px; font-weight: 600; color: #333; margin-bottom: 8px; } - + .unsupported-hint { font-size: 14px; color: #999; line-height: 1.4; } - + .file-preview-actions { display: flex; gap: 12px; justify-content: center; } - + .file-preview-btn { padding: 8px 20px; border: none; @@ -2532,27 +2967,27 @@ justify-content: center; min-width: 120px; } - + .file-preview-btn.download-btn { background: linear-gradient(135deg, #2196F3, #1976D2); color: white; } - + .file-preview-btn.download-btn:hover { background: linear-gradient(135deg, #1976D2, #1565C0); transform: translateY(-1px); } - + .file-preview-btn.close-btn { background: linear-gradient(135deg, #e0e0e0, #bdbdbd); color: #444; } - + .file-preview-btn.close-btn:hover { background: linear-gradient(135deg, #bdbdbd, #9e9e9e); transform: translateY(-1px); } - + /* 鍒楄〃寮圭獥缇庡寲 */ .attachment-list { padding: 0; @@ -2561,7 +2996,7 @@ max-height: 300px; overflow-y: auto; } - + .attachment-list li { display: flex; align-items: center; @@ -2569,12 +3004,12 @@ padding: 12px 0; border-bottom: 1px solid #f0f0f0; } - + .attachment-info { flex: 1; margin-right: 10px; } - + .attachment-name { color: #3498db; cursor: pointer; @@ -2583,27 +3018,27 @@ display: block; margin-bottom: 4px; } - + .attachment-name:hover { color: #217dbb; text-decoration: underline; } - + .attachment-meta { font-size: 12px; } - + .attachment-type { color: #7f8c8d; font-style: italic; } - + .attachment-actions { display: flex; gap: 8px; flex-shrink: 0; } - + .attachment-list .secondary-btn { padding: 4px 10px; font-size: 13px; @@ -2613,35 +3048,35 @@ border: 1px solid #dbe2ea; transition: background 0.2s, color 0.2s; } - + .attachment-list .secondary-btn:hover { background: #e6f0fa; color: #1976d2; } - + .preview-btn { background: #e8f5e8 !important; color: #2e7d2e !important; border-color: #a5d6a5 !important; } - + .preview-btn:hover { background: #d4eecc !important; color: #1e5f1e !important; } - + /* 鍥剧墖鏀惧ぇ棰勮鐩稿叧鏍峰紡 */ .preview-image-clickable { transition: transform 0.2s ease; border-radius: 8px; box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1); } - + .preview-image-clickable:hover { transform: scale(1.02); box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15); } - + .image-zoom-hint { text-align: center; margin-top: 8px; @@ -2649,7 +3084,7 @@ color: #666; font-style: italic; } - + .image-preview-container { position: relative; display: flex; -- Gitblit v1.9.3