Jelajahi Sumber

项目管理-上传添加遮罩

lizhenhao 2 tahun lalu
induk
melakukan
bd90663fef

+ 2 - 2
src/api/sys/OSSService.js

@@ -129,7 +129,7 @@ export function exnameFix (file, isShow, names) {
   return true
 }
 
-export function httpRequest (file, name, type) { // 阿里云OSS上传
+export async function httpRequest (file, name, type) { // 阿里云OSS上传
   console.log('开始上传')
   // 判断扩展名
   const tmpcnt = file.file.name.lastIndexOf('.') // 获取.的下标
@@ -143,7 +143,7 @@ export function httpRequest (file, name, type) { // 阿里云OSS上传
   console.log(filePath, '文件存储路径')
   const fileName = filePath + name + '.' + exname
   console.log(fileName, '文件名')
-  client.put(
+  await client.put(
     fileName,
     file.file,
     {

+ 15 - 5
src/views/modules/sys/project/AssessForm.vue

@@ -8,7 +8,15 @@
       @close="close"
       @keyup.enter.native="doSubmit"
       :visible.sync="visible">
-      <el-form size="middle" :model="inputForm" ref="inputForm" v-loading="loading" :class="method==='view'?'readonly':''"  :disabled="method==='view'"
+      <el-form size="middle"
+               :model="inputForm"
+               ref="inputForm"
+               v-loading="loading"
+               element-loading-text="拼命上传中"
+               element-loading-spinner="el-icon-loading"
+               element-loading-background="rgba(0, 0, 0, 0.5)"
+               :class="method==='view'?'readonly':''"
+               :disabled="method==='view'"
                label-width="150px">
         <el-row  :gutter="15">
           <el-col :span="12">
@@ -387,8 +395,8 @@
         :url-list="[url]"
         zIndex="9999"/>
       <span slot="footer" class="dialog-footer">
-      <el-button size="small" @click="close()" icon="el-icon-circle-close">关闭</el-button>
-      <el-button size="small" type="primary" v-if="method != 'view'" @click="doSubmit()" icon="el-icon-circle-check" v-noMoreClick>确定</el-button>
+      <el-button  @click="close()" icon="el-icon-circle-close">关闭</el-button>
+      <el-button  type="primary" v-if="method != 'view'" @click="doSubmit()" v-loading="loading" icon="el-icon-circle-check" v-noMoreClick>确定</el-button>
     </span>
     </el-dialog>
   </div>
@@ -663,8 +671,10 @@
         this.visible = false
         this.showVi = true
       },
-      httpRequest (file) {
-        httpRequest(file, fileName(file), 'projectRecords')
+      async httpRequest (file) {
+        this.loading = true
+        await httpRequest(file, fileName(file), 'projectRecords')
+        this.loading = false
       },
       handleRemove () {
         this.fileList = handleRemove()

+ 15 - 5
src/views/modules/sys/project/ConsultationForm.vue

@@ -8,7 +8,15 @@
       @close="close"
       @keyup.enter.native="doSubmit"
       :visible.sync="visible">
-      <el-form size="middle" :model="inputForm" ref="inputForm" v-loading="loading" :class="method==='view'?'readonly':''"  :disabled="method==='view'"
+      <el-form size="middle"
+               :model="inputForm"
+               ref="inputForm"
+               :class="method==='view'?'readonly':''"
+               :disabled="method==='view'"
+               v-loading="loading"
+               element-loading-text="拼命上传中"
+               element-loading-spinner="el-icon-loading"
+               element-loading-background="rgba(0, 0, 0, 0.5)"
                label-width="150px">
         <el-row  :gutter="15">
           <el-col :span="12">
@@ -390,8 +398,8 @@
         :url-list="[url]"
         zIndex="9999"/>
       <span slot="footer" class="dialog-footer">
-      <el-button size="small" @click="close()" icon="el-icon-circle-close">关闭</el-button>
-      <el-button size="small" type="primary" v-if="method != 'view'" @click="doSubmit()" icon="el-icon-circle-check" v-noMoreClick>确定</el-button>
+      <el-button  @click="close()" icon="el-icon-circle-close">关闭</el-button>
+      <el-button  type="primary" v-if="method != 'view'" v-loading="loading" @click="doSubmit()" icon="el-icon-circle-check" v-noMoreClick>确定</el-button>
     </span>
     </el-dialog>
   </div>
@@ -646,8 +654,10 @@
         this.visible = false
         this.showVi = true
       },
-      httpRequest (file) {
-        httpRequest(file, fileName(file), 'projectRecords')
+      async httpRequest (file) {
+        this.loading = true
+        await httpRequest(file, fileName(file), 'projectRecords')
+        this.loading = false
       },
       handleRemove () {
         this.fileList = handleRemove()