Browse Source

2026-07-02

优化文件上传
master
fengyuan_yang 4 weeks ago
parent
commit
5be87702c4
  1. 18
      src/main.js
  2. 16
      src/views/modules/oss/ossComponents.vue

18
src/main.js

@ -66,8 +66,12 @@ new Vue({
components: { App }, components: { App },
mounted() { mounted() {
Vue.nextTick(() => { Vue.nextTick(() => {
const rootEl = this && this.$el
if (!rootEl || typeof rootEl.querySelectorAll !== 'function') {
return
}
// 在这里调用自定义指令的绑定逻辑 // 在这里调用自定义指令的绑定逻辑
this.$el.querySelectorAll('[v-highlight-container]').forEach(el => {
rootEl.querySelectorAll('[v-highlight-container]').forEach(el => {
highlightContainer.bind.call({ el, bind: {} }, el); highlightContainer.bind.call({ el, bind: {} }, el);
}); });
}); });
@ -90,9 +94,13 @@ document.addEventListener('keydown', function(event) {
Vue.prototype.$clearHighLight = function () { Vue.prototype.$clearHighLight = function () {
const rootEl = this && this.$el
if (!rootEl || typeof rootEl.querySelectorAll !== 'function') {
return
}
// 查找所有带有 highlight 类的元素 // 查找所有带有 highlight 类的元素
const highlightedElements = this.$el.querySelectorAll('.highlight');
const highlightedElements = rootEl.querySelectorAll('.highlight');
// 移除 highlight 类 // 移除 highlight 类
highlightedElements.forEach(el => { highlightedElements.forEach(el => {
@ -102,8 +110,12 @@ Vue.prototype.$clearHighLight = function () {
Vue.prototype.$triggerInputEvent = function (inputRef) { Vue.prototype.$triggerInputEvent = function (inputRef) {
const inputRootEl = inputRef && inputRef.$el
if (!inputRootEl || typeof inputRootEl.querySelector !== 'function') {
return
}
const inputElement = inputRef.$el.querySelector('.el-input__inner');
const inputElement = inputRootEl.querySelector('.el-input__inner');
if (inputElement) { if (inputElement) {
inputElement.dispatchEvent(new Event('input')); inputElement.dispatchEvent(new Event('input'));
} }

16
src/views/modules/oss/ossComponents.vue

@ -225,6 +225,9 @@ export default {
return list return list
.map(item => String(item || '').trim()) .map(item => String(item || '').trim())
.filter(item => { .filter(item => {
if (!item) {
return false
}
if (cache.has(item)) { if (cache.has(item)) {
return false return false
} }
@ -318,11 +321,16 @@ export default {
const queryList = this.resolveFilterQueryOrderRef3(selectedType) const queryList = this.resolveFilterQueryOrderRef3(selectedType)
return queryList.length > 0 ? queryList[0] : selectedType return queryList.length > 0 ? queryList[0] : selectedType
} }
const directOrderRef3 = String(this.orderRef3 || '').trim()
if (directOrderRef3) {
return directOrderRef3
}
const queryList = this.buildQueryOrderRef3List() const queryList = this.buildQueryOrderRef3List()
if ((!this.orderRef3 || !String(this.orderRef3).trim()) && queryList.length > 0) {
if (queryList.length > 0) {
return queryList[0] return queryList[0]
} }
return this.orderRef3
// orderRef3
return ''
}, },
handleUpload(){ handleUpload(){
this.$nextTick(()=>{ this.$nextTick(()=>{
@ -387,10 +395,10 @@ export default {
formData.append('orderRef1', this.orderRef1); formData.append('orderRef1', this.orderRef1);
formData.append('orderRef2', this.ossForm.orderRef2); formData.append('orderRef2', this.ossForm.orderRef2);
const uploadOrderRef3 = this.resolveUploadOrderRef3() const uploadOrderRef3 = this.resolveUploadOrderRef3()
if (!uploadOrderRef3) {
if (this.showOrderRef3Filter && !uploadOrderRef3) {
return return
} }
formData.append('orderRef3', uploadOrderRef3);
formData.append('orderRef3', uploadOrderRef3 || '');
formData.append('fileRemark', this.ossForm.remark); formData.append('fileRemark', this.ossForm.remark);
if (this.requireFileNoRev){ if (this.requireFileNoRev){
formData.append('fileNo', this.ossForm.fileNo); formData.append('fileNo', this.ossForm.fileNo);

Loading…
Cancel
Save