liuhj преди 9 месеца
родител
ревизия
a9a56e0d00
променени са 1 файла, в които са добавени 97 реда и са изтрити 11 реда
  1. 97 11
      src/components/Finance/billUploading.vue

+ 97 - 11
src/components/Finance/billUploading.vue

@@ -21,6 +21,7 @@
                     </el-select>
                 </div>
             </div>
+            <el-button v-if="panduanbtn" @click="ExportGroupZip" type="primary">下载票据</el-button>
         </div>
         <div class="billUploading-content">
             <div class="billUploading-content-table">
@@ -35,6 +36,9 @@
                     <el-table-column
                     label="操作" 
                     width="180">
+                    <template slot-scope="scope">
+                        <el-button size="mini" @click="DeleteGroupFile(scope.row)"  type="danger" icon="el-icon-delete"></el-button>
+                    </template>
                     </el-table-column>
                 </el-table>
             </div>
@@ -44,15 +48,18 @@
                 action="http://132.232.92.186:8888/api/Groups/CommonSaveFile"
                 :on-preview="handlePreview"
                 :on-remove="handleRemove"
+                :on-success="handleSuccess"
                 :before-remove="beforeRemove"
                 multiple
-                :limit="3"
+                :limit="9"
                 :data="datas"
                 :on-exceed="handleExceed"
                 :file-list="fileList"
                 name="files">
-                <el-button size="small" type="primary">点击上传</el-button>
-                <div slot="tip" class="el-upload__tip">只能上传jpg/png文件,且不超过500kb</div>
+                <div style="display: flex;">
+                    <el-button style="margin-right: 10px;" size="small" type="primary">点击上传</el-button>
+                    <div slot="tip" class="el-upload__tip">选择文件上传,且不超过20M。</div>
+                </div>
                 </el-upload>
             </div>
         </div>
@@ -63,6 +70,7 @@ export default {
     data () {
         return {
             DiId:'',
+            userId:'',
             datas:{},
             fileList: [
                 // {name: 'food.jpeg', url: 'https://fuss10.elemecdn.com/3/63/4e7f3a15429bfda99bce42a18cdd1jpeg.jpeg?imageMogr2/thumbnail/360x360/format/webp/quality/100'}, 
@@ -71,7 +79,8 @@ export default {
             delegationInfoList:[],
             Ctable:'',
             Ctablelist:[],
-            tableData:[]
+            tableData:[],
+            panduanbtn:false
         }
     },
     methods:{
@@ -134,8 +143,11 @@ export default {
         handlePreview(file) {
             console.log(file);
         },
+        handleSuccess(file){
+            this.QueryGroupModelFile();
+        },
         handleExceed(files, fileList) {
-            this.$message.warning(`当前限制选择 3 个文件,本次选择了 ${files.length} 个文件,共选择了 ${files.length + fileList.length} 个文件`);
+            this.$message.warning(`当前限制选择 9 个文件,本次选择了 ${files.length} 个文件,共选择了 ${files.length + fileList.length} 个文件`);
         },
         beforeRemove(file, fileList) {
             return this.$confirm(`确定移除 ${ file.name }?`);
@@ -170,7 +182,7 @@ export default {
                     ctable: that.Ctable,
                     diid: that.DiId,
                     cid:0,
-                    userid:that.userId
+                    userid:that.panduanuserid(that.userId)
                 }
             }).then(function (res) {
                 if(res.data.code==200){
@@ -183,12 +195,90 @@ export default {
                 }
             })
         },
+        //下载票据
+        ExportGroupZip(){
+            var url = "/api/Groups/ExportGroupZip"
+            var that = this
+            this.$axios({
+                method: 'post',
+                url: url,
+                headers: {
+                    Authorization: 'Bearer ' + that.token
+                },
+                data:{
+                    diid: that.DiId,
+                }
+            }).then(function (res) {
+                if(res.data.code==200){
+                    window.open(res.data.data.url)
+                    that.$message({
+                        message:res.data.msg ,
+                        type: 'success',
+                    });
+                }else{
+                    that.$message({
+                        message:res.data.msg ,
+                        type: 'warning',
+                    });
+                }
+            })
+        },
+        //删除
+        DeleteGroupFile(row){
+            this.$confirm('此操作将永久删除该文件, 是否继续?', '提示', {
+            confirmButtonText: '确定',
+            cancelButtonText: '取消',
+            type: 'warning'
+            }).then(() => {
+                var url = "/api/Groups/DeleteGroupFile"
+                var that = this
+                this.$axios({
+                    method: 'post',
+                    url: url,
+                    headers: {
+                        Authorization: 'Bearer ' + that.token
+                    },
+                    data:{
+                        id: row.id,
+                        userId: that.userId,
+                    }
+                }).then(function (res) {
+                    if(res.data.code==200){
+                        that.$message({
+                            message:res.data.msg ,
+                            type: 'success',
+                        });
+                        that.QueryGroupModelFile();
+                    }else{
+                        that.$message({
+                            message:res.data.msg ,
+                            type: 'warning',
+                        });
+                    }
+                })
+            }).catch(() => {
+                this.$message({
+                    type: 'info',
+                    message: '已取消删除'
+                });          
+            });
+            
+        },
+        //panduan
+        panduanuserid(val){
+            if(val==187||val==21||val==22){
+                this.panduanbtn=true;
+                return -1
+            }else{
+                this.panduanbtn=false;
+                return val
+            }
+        }
     },
     mounted(){
         this.token = JSON.parse(localStorage.getItem('userinif')).token;
         this.userId = JSON.parse(localStorage.getItem('userinif')).userInfo.userId;
         this.GetGroupNameList();
-
     }
 }
 </script>
@@ -208,10 +298,7 @@ export default {
         color: #606266;
         font-size: 15px;
         font-weight: 600;
-        
     }
-
-    
     .billUploading-head {
         display: flex;
         justify-content: space-between;
@@ -226,6 +313,5 @@ export default {
     }
     .billUploading-content-upload{
         width: 38%;
-        
     }
 </style>