Skip to content

Commit

Permalink
封装上传组件
Browse files Browse the repository at this point in the history
  • Loading branch information
BoBoooooo committed Oct 29, 2018
1 parent 0ad9128 commit 0a50a1c
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 13 deletions.
26 changes: 19 additions & 7 deletions src/components/UploadAffix/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,11 @@
:headers="token"
:on-success="fetchData_File(Params['ParamID']['MasterID'])"
>
<el-button size="small" type="primary">点击上传</el-button>
<el-button size="small" style="float:left;margin-top:10px 0" type="primary">点击上传</el-button>
</el-upload>


<!--
-->
<el-table :default-sort="{prop: 'name', order: 'descending'}" :data="filelist" v-loading.body="listLoading" element-loading-text="拼命加载中" border fit highlight-current-row>

<el-table-column label="文件名" prop="filename" sortable align="center">
Expand Down Expand Up @@ -49,13 +50,17 @@ export default {
filelist:null,
token:{
auth:getToken()
}
},
listLoading: true
};
},
props: {
Params: {
type: Object
},
test:{
type:String
}
},
methods: {
Expand All @@ -76,19 +81,26 @@ export default {
fetchData_File(id) {
this.listLoading = true;
GetFileList(id).then(response => {
this.filelist = response.data.list;
this.listLoading = false;
});
},
timestampToTime(timestamp) {
timestampToTime(timestamp);
}
},
watch:{
"Params['ParamID']['MasterID']" : function(){
"Params.ParamID.MasterID":{
handler:function(id){
this.$nextTick(()=>{
this.fetchData_File(id)
})
}
this.fetchData_File(id)
  }
}
}
};
</script>
Expand Down
9 changes: 3 additions & 6 deletions src/views/Archive/person.vue
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@
</el-form-item>
</el-col>

<upload-affix :Params="uploadParams"></upload-affix>
<upload-affix :Params="uploadParams" :test="uploadParams['ParamID']['MasterID']"></upload-affix>
</el-form>
<div slot="footer" class="dialog-footer">
<el-button @click="dialogFormVisible = false">取 消</el-button>
Expand Down Expand Up @@ -221,8 +221,7 @@ export default {
Edit(id) {
this.dialogStatus = "update";
this.formData.MasterID = id;
this.fetchData_File(id);
this.uploadParams.ParamID.MasterID = id;
GetUsersDetail(id).then(response => {
this.temp_obj = response.data;
Expand All @@ -246,9 +245,7 @@ export default {
this.fetchData(this.listQuery);
});
},
timestampToTime(timestamp) {
timestampToTime(timestamp);
}
}
};
</script>

0 comments on commit 0a50a1c

Please sign in to comment.