From 85fd8ec92dc19f1a478f010723fa85ec7ec670a2 Mon Sep 17 00:00:00 2001 From: xwt <2740516069@qq.com> Date: 星期六, 19 七月 2025 14:47:15 +0800 Subject: [PATCH] 来料检获取附件 --- pages/QC/LLJ/Add.vue | 763 +++++++++++++++++++++++++++++++++++++++++++++++----------- 1 files changed, 614 insertions(+), 149 deletions(-) diff --git a/pages/QC/LLJ/Add.vue b/pages/QC/LLJ/Add.vue index 905357b..04f0623 100644 --- a/pages/QC/LLJ/Add.vue +++ b/pages/QC/LLJ/Add.vue @@ -4,9 +4,10 @@ <view class="sheet-header"> <h1>鏉ユ枡妫�楠屽崟</h1> <view class="inspection-number">妫�楠屽崟鍙凤細{{formData.releaseNo}}</view> - <!-- 閫犳ⅵ鑰呯壒娈婂姛鑳� --> - <view style="text-align: right;" v-if="this.current"><a class="sysLike" - @click="toSysSubmitFrom(formData.releaseNo)">瀹為獙瀹ら�佹</a></view> + <!--瀹為獙瀹ら�佹 --> + <view style="text-align: right;" class="action-buttons"> + <a class="sysLike" v-if="this.current" @click="toSysSubmitFrom(formData.releaseNo)">瀹為獙瀹ら�佹</a> + </view> </view> <!-- 鍩烘湰淇℃伅鍖� --> @@ -88,26 +89,37 @@ </select> </view> - <view class="dropdown-row"> - <view class="info-label">澶囨敞锛�</view> - <input type="text" id="remark" v-model="REMARK" placeholder="璇疯緭鍏ュ娉ㄤ俊鎭�" /> + <view class="info-block" style="margin-top: 10px;"> + <view class="info-label">澶囨敞锛�</view> + <input type="text" id="lotNo1" v-model="formData.lotNo1" + placeholder="璇疯緭鍏ュ娉ㄤ俊鎭�" + style="color: red; font-weight: bold;"/> </view> + <view class="info-block" style="margin-top: 10px;"> + <view class="info-label">鐮村潖瀹為獙鏁伴噺锛�</view> + <view class="info-value highlight">{{formData.phsy}}</view> + </view> + <!-- 鎿嶄綔鎸夐挳鍖� --> <view class="action-buttons" v-if="this.current"> - <button class="secondary-btn" @click="getInspectionItems">鑾峰彇妫�楠岄」鐩�</button> + <button class="secondary-btn" @click="handleEmergencyRelease">绱ф�ユ斁琛�</button> + <button class="secondary-btn" @click="handleWithdraw">鎾ゅ洖</button> + <button class="secondary-btn" @click="getInspectionItems">鑾峰彇妫�楠岄」鐩�</button> </view> + + <!-- 妫�楠岄」鐩〃鏍� --> <view class="inspection-table"> <table> <thead> <tr> - <th width="15%" style="text-align: center;">妫�楠岄」鐩�</th> + <th width="20%" style="text-align: center;">妫�楠岄」鐩�</th> <th width="50%" style="text-align: center;">妫�楠屾弿杩�</th> - <th width="20%" style="text-align: center;">璁板綍(鐐瑰嚮)</th> + <th width="15%" style="text-align: center;">璁板綍(鐐瑰嚮)</th> </tr> </thead> <tbody> @@ -129,6 +141,7 @@ <button v-if="item.current" class="record-btn" @click="fillRecord(item,index)">濉啓</button> <button v-if="!item.current" class="record-btn" @click="fillRecord(item,index)">鏌ョ湅</button> </td> + </tr> </tbody> </table> @@ -136,8 +149,10 @@ <!-- 鎿嶄綔鎸夐挳鍖� --> <view class="action-buttons"> + <button class="secondary-btn" @click="addDestruction" v-if="this.current">鐮村潖瀹為獙</button> <button class="secondary-btn" @click="uploadImages">涓婁紶/鏌ョ湅鍥剧墖</button> <button class="secondary-btn" @click="fetchDrawingNumber">璋冨彇PLM鍥剧焊</button> + <button class="secondary-btn" @click="viewAttachmentInfo">鏌ョ湅闄勪欢淇℃伅</button> <button class="secondary-btn" @click="addDefectDescription" v-if="this.current">娣诲姞涓嶈壇鎻忚堪</button> <button class="primary-btn" @click="submitInspection" v-if="this.current">妫�楠屾彁浜�</button> </view> @@ -155,7 +170,23 @@ <button @click="remarksPopup = !remarksPopup">鍙栨秷</button> </view> </view> - + + <view v-if="destructionPopup" class="overlay"> + <view class="popup"> + <h3>鐮村潖瀹為獙鏁伴噺</h3> + <form> + <view class="form-group"> + <label class="form-label">鐮村潖瀹為獙鏁伴噺:</label> + <input class="form-input" type="text" v-model="PHSY" placeholder="鐣欑┖琛ㄧず娓呴櫎鏁伴噺" /> + </view> + </form> + <div v-if="!isInteger" class="error-message">璇疯緭鍏ユ暣鏁板�兼垨鐣欑┖</div> + <button class="updateBut" @click="editDestruction">淇敼</button> + <button @click="clearDestruction">娓呴櫎</button> + <button @click="destructionPopup = !destructionPopup">鍙栨秷</button> + </view> + </view> + <view class="barcode"> <u-modal :show="drawingShow" title="鍥剧焊鏄庣粏" @confirm="drawingConfirm" @cancel="drawingCancel" showCancelButton> @@ -183,8 +214,60 @@ </uni-table> </u-modal> </view> - + <!-- 闄勪欢璇︽儏寮圭獥 --> + <view v-if="showAttachmentDetail" class="overlay"> + <view class="popup attachment-detail-popup"> + <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 v-if="isPreviewable(selectedAttachment.fattach)" class="attachment-preview-area"> + <div v-if="['pdf','jpg','jpeg','png','gif'].includes(selectedAttachment.fattach.trim().split('.').pop().toLowerCase())"> + <iframe :src="getAttachmentUrl(selectedAttachment)" style="width:100%;height:320px;border-radius:10px;background:#f8fafc;" frameborder="0"></iframe> + </div> + <div v-else-if="['txt'].includes(selectedAttachment.fattach.trim().split('.').pop().toLowerCase())"> + <iframe :src="getAttachmentUrl(selectedAttachment)" style="width:100%;height:320px;border-radius:10px;background:#f8fafc;" frameborder="0"></iframe> + </div> + <div v-else-if="['doc','docx','xls','xlsx'].includes(selectedAttachment.fattach.trim().split('.').pop().toLowerCase())"> + <iframe :src="'https://view.officeapps.live.com/op/view.aspx?src=' + encodeURIComponent(getAttachmentUrl(selectedAttachment))" style="width:100%;height:320px;border-radius:10px;background:#f8fafc;" frameborder="0"></iframe> + </div> + </div> + <div v-else class="attachment-download-area"> + <button class="attachment-download-link" @click="downloadAttachment(selectedAttachment)">涓嬭浇闄勪欢</button> + </div> + </div> + <div v-else class="attachment-detail-empty">鏆傛棤闄勪欢淇℃伅</div> + <button class="attachment-popup-close" @click="closeAttachmentDetail">杩斿洖闄勪欢鍒楄〃</button> + </view> + </view> + <!-- 闄勪欢鍒楄〃寮圭獥 --> + <view v-if="showAttachmentPopup" class="overlay"> + <view class="popup" style="width: 60vw; max-width: 500px;"> + <h3>闄勪欢鍒楄〃</h3> + <div v-if="attachmentsLoading">鍔犺浇涓�...</div> + <div v-else-if="attachments.length === 0">鏆傛棤闄勪欢</div> + <ul class="attachment-list" v-else> + <li v-for="item in attachments" :key="item.id"> + <span class="attachment-name" @click="showAttachmentDetailDialog(item)"> + {{ item.fattach }} + </span> + <div class="attachment-actions"> + <button class="secondary-btn" @click="showAttachmentDetailDialog(item)">璇︽儏</button> + <button class="secondary-btn" @click="downloadAttachment(item)">涓嬭浇</button> + </div> + </li> + </ul> + <button class="attachment-popup-close" @click="closeAttachmentPopup">鍏抽棴</button> + </view> + </view> </view> + </template> <script> @@ -207,10 +290,21 @@ planQty: "", mocode: "", boardStyle: "", - itemId: "" + itemId: "", + emergencyStatus: false, + lotNo1: '', + emergency:'', + permissionModalVisible: false, + permissionAccount: '', + hasEmergencyPermission: false, + showPopup: false, + PHSY:'', + EMERGENCY: '0', + }, tableData: [], remarksPopup: false, + meomPopup: false, current: true, drawing: [], drawingShow: false, @@ -220,18 +314,33 @@ REMARK: '', checkState: false, writeStatu: true, - fileName:'' + fileName:'', + originalRemarks: '', + hasEmergencyPermission: false, + destructionPopup: false, + PHSY: '', + isInteger: true, + attachments: [], + showAttachmentPopup: false, + attachmentsLoading: false, + selectedAttachment: null, + showAttachmentDetail: false, + } }, onLoad(options) { //options涓寘鍚簡url闄勫甫鐨勫弬鏁� let params = options; - + + + if (params["id"]) { this.formData.id = params["id"]; this.formData.releaseNo = params["releaseNo"]; this.formData.lotNo = params["lotNo"]; this.msgId = params["msgId"]; + this.emergency = params["emergency"] + this.meom = params["meom"] if (params["current"] === 'A') { this.current = true; @@ -254,6 +363,11 @@ }); } + if (this.$loginInfo.account === 'PL017') {this.hasEmergencyPermission = true;} + + // 娴嬭瘯闄勪欢鏈嶅姟鍣ㄨ繛鎺� + + }, methods: { @@ -279,7 +393,8 @@ data: { itemNo: this.formData.itemId, quantity: this.formData.fcovertQty, - releaseNo: this.formData.releaseNo + releaseNo: this.formData.releaseNo, + PHSY: this.formData.PHSY } }).then(res => { if (res.status == 0) { @@ -306,6 +421,7 @@ } }); }, + fillRecord(item, index) { // 濉啓璁板綍鐨勯�昏緫 uni.navigateTo({ @@ -374,7 +490,8 @@ staffNo: 'HMCS', // staffNo: this.$loginInfo.account, iqcStatus: this.PSTYPE, - department: this.DEPARTMENT + department: this.DEPARTMENT, + EMERGENCY: this.formData.emergencyStatus ? "1" : "0" // 纭繚绱ф�ユ斁琛岀姸鎬佹纭紶閫� }; } else{ @@ -391,14 +508,16 @@ // staffNo: 'HMCS', staffNo: this.$loginInfo.account, iqcStatus: this.PSTYPE, - department: this.DEPARTMENT + department: this.DEPARTMENT, + EMERGENCY: this.formData.emergencyStatus ? "1" : "0" // 纭繚绱ф�ユ斁琛岀姸鎬佹纭紶閫� }; } - console.log(this.QcIssueResultDetailes) + console.log("鎻愪氦鐨勭揣鎬ユ斁琛岀姸鎬侊細", this.formData.emergencyStatus ? "1" : "0"); + console.log("瀹屾暣鐨勬彁浜ゆ暟鎹細", this.QcIssueResultDetailes); - const url = `http://192.168.1.22:10054/api/QcIssueResult/GetProcessNo`; - // 鍙戦�� POST 璇锋眰 + const url = this.$store.state.serverInfo.serverAPI+`/QcIssueResult/GetProcessNo`; + if (this.PSTYPE === '鐗归噰/璁╂浣跨敤') {// 鍙戦�� POST 璇锋眰 uni.request({ url: url, // 璇锋眰鍦板潃 method: 'POST', // 璇锋眰鏂规硶 @@ -415,7 +534,10 @@ // 濡傛灉鏈夐〉闈㈣烦杞紝闇�瑕佺敤瀹氭椂鍣ㄥ欢杩� setTimeout(() => { - uni.navigateTo({ + // 璁剧疆涓�涓爣璁帮紝鍛婅瘔List椤甸潰闇�瑕佸埛鏂� + getApp().globalData = getApp().globalData || {}; + getApp().globalData.needRefreshList = true; + uni.redirectTo({ url: 'List' }); }, 2000); // 淇濇寔涓� duration 鐩稿悓鐨勬椂闀� @@ -430,7 +552,7 @@ }); } }); - + } uni.showToast({ title: res.message.toString(), icon: 'success', @@ -469,11 +591,11 @@ }) // 濡傛灉鏈夐〉闈㈣烦杞紝闇�瑕佺敤瀹氭椂鍣ㄥ欢杩� setTimeout(() => { - uni.navigateTo({ - url: 'List' - }); + // 璁剧疆涓�涓爣璁帮紝鍛婅瘔List椤甸潰闇�瑕佸埛鏂� + getApp().globalData = getApp().globalData || {}; + getApp().globalData.needRefreshList = true; + uni.navigateBack(); }, 2000); // 淇濇寔涓� duration 鐩稿悓鐨勬椂闀� - } else { uni.showModal({ title: "鎻愮ず", @@ -508,8 +630,16 @@ }).then(res => { let data = res.data.tbBillList[0]; if (data) { - this.formData = data; - + this.formData = { + ...data, + emergencyStatus: data.emergency === 1 || data.emergency === "1" || data.emergency === true + }; + + // 纭繚PHSY瀛楁琚纭缃� + this.formData.PHSY = data.PHSY; + + console.log("鍔犺浇鐨勭揣鎬ユ斁琛岀姸鎬�:", this.formData.emergencyStatus); + this.$post({ url: "/LLJ/getJYItem", data: { @@ -562,58 +692,25 @@ }); }, editRemarks() { - if (this.remarks) { - //saveRemarksGid - this.$post({ - url: "/LLJ/saveRemarksGid", - data: { - gid: this.formData.id, - remarks: this.remarks, - releaseNo: this.formData.releaseNo, - } - }).then(res => { - if (res.data.tbBillList > 0) { - this.formData.remarks = this.remarks; - this.remarksPopup = !this.remarksPopup; - this.$showMessage("淇濆瓨鎴愬姛"); - setTimeout(() => { - let pages = getCurrentPages(); - let beforePage = pages[pages.length - 2]; - uni.navigateBack({ - delta: 1, //杩斿洖鐨勯〉闈㈡暟锛屽鏋滀负1琛ㄧず杩斿洖涓婁竴椤� - success: (event) => { - beforePage.$vm.reload() - } - }); - }, 2000); - } - }) - } else { - this.$post({ - url: "/LLJ/saveRemarksGid", - data: { - gid: this.formData.id, - remarks: '', - releaseNo: this.formData.releaseNo, - } - }).then(res => { - if (res.data.tbBillList > 0) { - this.formData.remarks = this.remarks; - this.remarksPopup = !this.remarksPopup; - this.$showMessage("淇濆瓨鎴愬姛"); - setTimeout(() => { - let pages = getCurrentPages(); - let beforePage = pages[pages.length - 2]; - uni.navigateBack({ - delta: 1, //杩斿洖鐨勯〉闈㈡暟锛屽鏋滀负1琛ㄧず杩斿洖涓婁竴椤� - success: (event) => { - beforePage.$vm.reload() - } - }); - }, 2000); - } - }) - } + // 淇濆瓨涓嶈壇鎻忚堪 + this.$post({ + url: "/LLJ/saveRemarksGid", + data: { + gid: this.formData.id, + remarks: this.remarks || '', + releaseNo: this.formData.releaseNo + // 涓嶅啀鍖呭惈PHSY瀛楁 + } + }).then(res => { + if (res.data.tbBillList > 0) { + this.formData.remarks = this.remarks; + this.remarksPopup = !this.remarksPopup; + this.$showMessage("淇濆瓨鎴愬姛"); + setTimeout(() => { + this.init(); + }, 2000); + } + }) }, drawingConfirm() { @@ -986,7 +1083,281 @@ // title: '鏃犲搴擯DF鏂囦欢锛屾墦寮�澶辫触', // icon: 'none' // }); // } - } + }, + // 澶勭悊绱ф�ユ斁琛� + handleEmergencyRelease() { + if (this.formData.emergencyStatus) { + uni.showModal({ + title: "鎻愮ず", + content: '璇ュ崟宸茬揣鎬ユ斁琛岋紝璇峰嬁閲嶅鎿嶄綔', + showCancel: false + }); + return; + } + + uni.showModal({ + title: '纭', + content: '纭畾瑕佹墽琛岀揣鎬ユ斁琛屽悧锛�', + success: (res) => { + if (res.confirm) { + // 璋冪敤鏂扮殑鍚庣鎺ュ彛 + this.$post({ + url: "/LLJ/EmergencyRelease", + data: { + id: this.formData.id + } + }).then(res => { + if (res.data && res.status === 0) { + const result = res.data.tbBillList[0]; + const message = res.data.tbBillList[1]; + const lotNo1 = res.data.tbBillList[2] || ""; + + if (result === "0") { + this.formData.emergencyStatus = true; + this.originalLotNo1 = lotNo1; + this.formData.lotNo1 = lotNo1; + // 鏇存柊绱ф�ユ斁琛岀姸鎬侊紝纭繚鎻愪氦鏃惰兘姝g‘浼犻�� + this.formData.EMERGENCY = "1"; + + uni.showToast({ + title: message || '绱ф�ユ斁琛屾垚鍔�', + icon: 'success', + duration: 2000 + }); + this.init(); + } else { + uni.showModal({ + title: "鎻愮ず", + content: message || '鎿嶄綔澶辫触', + showCancel: false + }); + } + } + }).catch(error => { + uni.showModal({ + title: "閿欒", + content: '缃戠粶閿欒锛岃妫�鏌ョ綉缁滆繛鎺�', + showCancel: false + }); + }); + } + } + }); + }, + + // 澶勭悊鎾ゅ洖 + handleWithdraw() { + uni.showModal({ + title: '纭', + content: '纭畾瑕佹挙鍥炵揣鎬ユ斁琛屽悧锛�', + success: (res) => { + if (res.confirm) { + // 璋冪敤鏂扮殑鍚庣鎺ュ彛 + this.$post({ + url: "/LLJ/WithdrawEmergencyRelease", + data: { + id: this.formData.id + } + }).then(res => { + if (res.data && res.status === 0) { + const result = res.data.tbBillList[0]; + const message = res.data.tbBillList[1]; + + if (result === "0") { + this.formData.emergencyStatus = false; + // 鏇存柊绱ф�ユ斁琛岀姸鎬侊紝纭繚鎻愪氦鏃惰兘姝g‘浼犻�� + this.formData.EMERGENCY = "0"; + + uni.showToast({ + title: message || '鎾ゅ洖鎴愬姛', + icon: 'success', + duration: 2000 + }); + this.init(); + } else { + uni.showModal({ + title: "鎻愮ず", + content: message || '鎿嶄綔澶辫触', + showCancel: false + }); + } + } + }).catch(error => { + uni.showModal({ + title: "閿欒", + content: '缃戠粶閿欒锛岃妫�鏌ョ綉缁滆繛鎺�', + showCancel: false + }); + }); + } + } + }); + }, + editRemarks() { + // 淇濆瓨涓嶈壇鎻忚堪 + this.$post({ + url: "/LLJ/saveRemarksGid", + data: { + gid: this.formData.id, + remarks: this.remarks || '', + releaseNo: this.formData.releaseNo + // 涓嶅啀鍖呭惈PHSY瀛楁 + } + }).then(res => { + if (res.data.tbBillList > 0) { + this.formData.remarks = this.remarks; + this.remarksPopup = !this.remarksPopup; + this.$showMessage("淇濆瓨鎴愬姛"); + setTimeout(() => { + this.init(); + }, 2000); + } + }) + }, + addDestruction() { + // 娣诲姞鐮村潖瀹為獙鐨勯�昏緫 + this.destructionPopup = !this.destructionPopup; + this.PHSY = this.formData.PHSY || ''; + this.isInteger = true; + }, + editDestruction() { + // 楠岃瘉杈撳叆鏄惁涓烘暣鏁� + if(this.PHSY === '') { + this.isInteger = true; + // 濡傛灉涓虹┖锛屼紶閫掔┖瀛楃涓诧紝鍚庣浼氬鐞嗕负null + } else { + const isInteger = /^-?\d+$/.test(this.PHSY); + this.isInteger = isInteger; + if (!isInteger) { + return; + } + } + + // 淇濆瓨鐮村潖瀹為獙鏁伴噺 + this.$post({ + url: "/LLJ/saveRemarksGid", + data: { + gid: this.formData.id, + releaseNo: this.formData.releaseNo, + PHSY: this.PHSY // 鍙互鏄┖瀛楃涓叉垨鏈夋晥鏁存暟 + // 涓嶅啀鍖呭惈remarks瀛楁 + } + }).then(res => { + if (res.data.tbBillList > 0) { + // 濡傛灉杈撳叆涓虹┖锛岃缃负null浠ヤ究涓嶆樉绀� + this.formData.PHSY = this.PHSY === '' ? null : this.PHSY; + this.destructionPopup = false; + this.$showMessage("淇濆瓨鎴愬姛"); + setTimeout(() => { + this.init(); + }, 2000); + } + }) + }, + clearDestruction() { + // 娓呴櫎鐮村潖瀹為獙鏁伴噺 + this.PHSY = ''; + this.$post({ + url: "/LLJ/saveRemarksGid", + data: { + gid: this.formData.id, + releaseNo: this.formData.releaseNo, + PHSY: '' // 绌哄瓧绗︿覆锛屽悗绔細澶勭悊涓簄ull + } + }).then(res => { + if (res.data.tbBillList > 0) { + this.formData.PHSY = null; // 纭繚鍓嶇涔熶负null锛屼笉鏄剧ず + this.destructionPopup = false; + this.$showMessage("娓呴櫎鎴愬姛"); + setTimeout(() => { + this.init(); + }, 2000); + } + }) + }, + viewAttachmentInfo() { + this.showAttachmentPopup = true; // 鍏堝脊绐� + this.attachmentsLoading = true; + this.attachments = []; + this.$post({ + url: "/LLJ/getAttachments", + data: { releaseNo: this.formData.releaseNo } + }).then(res => { + this.attachmentsLoading = false; + if (res.status === 0) { + this.attachments = res.data.tbBillList; + } else if (res.status === 1 && res.message === "璇ユ楠屽崟鏈笂浼犻檮浠朵俊鎭紒") { + uni.showToast({ title: res.message, icon: "none" }); + } else { + uni.showToast({ title: "鑾峰彇闄勪欢澶辫触", icon: "none" }); + } + }); + }, + closeAttachmentPopup() { + this.showAttachmentPopup = false; + }, + getAttachmentUrl(item) { + const baseUrl = "http://192.168.1.22:10054"; + // 鍘婚櫎鎵�鏈夌┖鐧藉瓧绗︼紙鍖呮嫭涓嫳鏂囩┖鏍笺�佸埗琛ㄧ绛夛級 + let fileName = item.fattach.replace(/[\s\u3000]+/g, '').trim(); + return baseUrl + "/api/LLJ/DownloadAttachment?itemNo=" + encodeURIComponent(item.itemNo) + "&fileName=" + encodeURIComponent(fileName); + }, + 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', 'jpg', 'jpeg', 'png', 'gif', 'txt', 'doc', 'docx', 'xls', 'xlsx' + ].includes(ext); + }, + // 澶勭悊闄勪欢涓嬭浇閿欒 + handleAttachmentError(item) { + uni.showModal({ + title: '涓嬭浇澶辫触', + content: `鏃犳硶涓嬭浇闄勪欢锛�${item.fattach}\n璇锋鏌ョ綉缁滆繛鎺ユ垨鑱旂郴绠$悊鍛榒, + showCancel: false + }); + }, + downloadAttachment(item) { + const baseUrl = "http://192.168.1.22:10054"; + // 鍘婚櫎鎵�鏈夌┖鏍笺�佸叏瑙掔┖鏍笺�佸洖杞︺�佹崲琛� + const fileName = item.fattach.replace(/[\s\u3000\r\n]+/g, '').trim(); + const url = baseUrl + "/api/Llj/DownloadFtpFile?itemNo=" + encodeURIComponent(item.itemNo) + "&fileName=" + encodeURIComponent(fileName); + uni.downloadFile({ + url: url, + success: (res) => { + if (res.statusCode === 200) { + if (typeof plus !== 'undefined' && plus.runtime && plus.runtime.openFile) { + plus.runtime.openFile({ path: res.tempFilePath }, () => { + uni.showToast({ title: '鎵撳紑鎴愬姛', icon: 'success' }); + }, (e) => { + uni.showModal({ title: '鎻愮ず', content: '鏂囦欢涓嬭浇鎴愬姛锛屼絾鏃犳硶鑷姩鎵撳紑銆傝鍦ㄦ枃浠剁鐞嗕腑鎵嬪姩鏌ユ壘骞舵墦寮�銆�', showCancel: false }); + }); + } else { + uni.showModal({ title: '鎻愮ず', content: '鏂囦欢涓嬭浇鎴愬姛锛屼絾褰撳墠鐜鏃犳硶鑷姩鎵撳紑銆傝鍦ㄦ枃浠剁鐞嗕腑鎵嬪姩鏌ユ壘骞舵墦寮�銆�', showCancel: false }); + } + } else { + uni.showModal({ title: '涓嬭浇澶辫触', content: `涓嬭浇澶辫触锛岀姸鎬佺爜锛�${res.statusCode}`, showCancel: false }); + } + }, + fail: (error) => { + uni.showModal({ title: '涓嬭浇澶辫触', content: `涓嬭浇澶辫触锛岃妫�鏌ョ綉缁滆繛鎺ャ��${error.errMsg}`, showCancel: false }); + } + }); + }, + } } </script> @@ -1080,12 +1451,9 @@ } .sysLike { - color: #3498db; + color: #1890ff; text-decoration: none; - margin-left: 15px; - padding: 3px 8px; - border-radius: 3px; - font-size: 12px; + cursor: pointer; } .doc-link:hover { @@ -1126,13 +1494,31 @@ /* 鎸夐挳鏍峰紡 */ .action-buttons { display: flex; - justify-content: flex-end; gap: 10px; - margin-top: 20px; + margin: 15px 0; + justify-content: flex-end; } - .primary-btn, .secondary-btn { + background-color: #ecf0f1; + color: #7f8c8d; + padding: 8px 15px; + border: none; + border-radius: 4px; + cursor: pointer; + } + + .secondary-btn:hover { + background-color: #d5dbdb; + } + + .secondary-btn:disabled { + background-color: #d9d9d9; + cursor: not-allowed; + opacity: 0.7; + } + + .primary-btn { padding: 10px 20px; border: none; border-radius: 4px; @@ -1141,22 +1527,8 @@ transition: all 0.3s; } - .primary-btn { - background-color: #3498db; - color: white; - } - .primary-btn:hover { background-color: #2980b9; - } - - .secondary-btn { - background-color: #ecf0f1; - color: #7f8c8d; - } - - .secondary-btn:hover { - background-color: #d5dbdb; } .record-btn { @@ -1231,56 +1603,149 @@ z-index: 10; } - .popup { - background-color: #fff; - padding: 20px; - border: 1px solid #ccc; - box-shadow: 0 0 10px rgba(0, 0, 0, 0.1); - width: 68vw; - /* 璁剧疆瀹藉害涓鸿鍙e搴︾殑80% */ - height: 25vh; - /* 璁剧疆楂樺害涓鸿鍙i珮搴︾殑80% */ + /* 寮圭獥鏁翠綋缇庡寲 */ + .popup, .attachment-detail-popup { + background: #fff; + border-radius: 16px; + box-shadow: 0 8px 32px rgba(60,60,60,0.18); + padding: 28px 28px 18px 28px; + border: none; + position: relative; + min-width: 260px; } - - .form-group { + .attachment-popup-title { + font-size: 22px; + font-weight: 700; + color: #222; + margin-bottom: 8px; + letter-spacing: 1px; + text-align: center; + } + .attachment-popup-divider { + height: 1px; + 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; - border-bottom: 1px solid #c9c9c9; + margin-bottom: 8px; + font-size: 15px; } - - .updateBut { - background-color: #3498db; - color: white; + .attachment-label { + min-width: 80px; + color: #1976d2; + font-weight: 500; + margin-right: 8px; } - - /* 鍝嶅簲寮忚璁� */ - @media (max-width: 500px) { - - .info-row, - .info-block { - flex-direction: column; - align-items: flex-start; - } - - .doc-links { - margin-left: 0; - margin-top: 10px; - } - - .action-buttons { - flex-direction: column; - } - - .inspection-table table { - display: block; - overflow-x: auto; - } - - .click-wd { - color: #056cba; - font-size: 1.25rem; - text-decoration: underline; - } - + .attachment-preview-area { + margin: 18px 0 8px 0; + border-radius: 10px; + background: #f8fafc; + padding: 10px; + box-shadow: 0 2px 8px rgba(60,60,60,0.06); + } + .attachment-download-area { + margin: 18px 0 8px 0; + text-align: center; + } + .attachment-download-link { + display: inline-block; + padding: 7px 18px; + background: linear-gradient(90deg,#4f8cff 0%,#1976d2 100%); + color: #fff; + border-radius: 6px; + font-weight: 500; + text-decoration: none; + transition: background 0.2s; + box-shadow: 0 2px 8px rgba(60,60,60,0.08); + } + .attachment-download-link:hover { + background: linear-gradient(90deg,#1976d2 0%,#4f8cff 100%); + } + .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%); + color: #444; + border-radius: 8px; + font-size: 16px; + padding: 10px 0; + border: none; + font-weight: 600; + letter-spacing: 1px; + transition: background 0.2s, color 0.2s; + box-shadow: 0 2px 8px rgba(60,60,60,0.06); + } + .attachment-popup-close:hover { + background: linear-gradient(90deg,#bdbdbd 0%,#e0e0e0 100%); + color: #1976d2; + } + /* 鍒楄〃寮圭獥缇庡寲锛堜繚鐣欏師鏈夛級 */ + .attachment-list { + padding: 0; + margin: 0; + list-style: none; + max-height: 300px; + overflow-y: auto; + } + .attachment-list li { + display: flex; + align-items: center; + justify-content: space-between; + padding: 8px 0; + border-bottom: 1px solid #f0f0f0; + } + .attachment-name { + flex: 1; + color: #3498db; + cursor: pointer; + font-weight: 500; + transition: color 0.2s; + margin-right: 10px; + } + .attachment-name:hover { + color: #217dbb; + text-decoration: underline; + } + .attachment-actions { + display: flex; + gap: 8px; + } + .attachment-list .secondary-btn { + padding: 4px 10px; + font-size: 13px; + border-radius: 3px; + background: #f5f7fa; + color: #333; + border: 1px solid #dbe2ea; + transition: background 0.2s, color 0.2s; + } + .attachment-list .secondary-btn:hover { + background: #e6f0fa; + color: #1976d2; + } + .attachment-popup-close { + margin-top: 18px; + width: 100%; + background: #e0e0e0; + color: #444; + border-radius: 4px; + font-size: 15px; + padding: 8px 0; + border: none; + transition: background 0.2s; + } + .attachment-popup-close:hover { + background: #bdbdbd; } </style> \ No newline at end of file -- Gitblit v1.9.3