Browse Source

框架升级,样式升级

master
陈裕财 5 years ago
parent
commit
36ec3384e1
  1. 91
      src/views/mdp/arc/archiveAttachment/AttachmentUpload.vue

91
src/views/mdp/arc/archiveAttachment/AttachmentUpload.vue

@ -56,19 +56,9 @@
:disabled="isDisabled" :disabled="isDisabled"
> >
<el-button type="text" :class="{ change: isDisabled }">上传附件</el-button> <el-button type="text" :class="{ change: isDisabled }">上传附件</el-button>
<!-- <el-button >查看附件</el-button> -->
</el-upload> </el-upload>
</el-col> </el-col>
<el-col v-if="isUserInfo&&isUserInfo==1" :span="6" style="padding-right: 50px;">
<el-button v-if="fileList==[]||fileList.length==0" @click="showFile">显示附件</el-button>
<el-button v-else @click="hideFile">隐藏附件</el-button>
<!-- <el-button
@click="handleOnlinePeview"
:disabled="previewOnlineUrls.length<=0"
>预览{{previewOnlineUrls.length}}张图</el-button> -->
</el-col>
<el-col v-else :span="6" style="padding-right: 50px;">
<el-col :span="6" style="padding-right: 50px;">
<el-button <el-button
@click="handleOnlinePeview" @click="handleOnlinePeview"
:disabled="previewOnlineUrls.length<=0" :disabled="previewOnlineUrls.length<=0"
@ -84,7 +74,7 @@ import {
listArchiveAttachment, listArchiveAttachment,
delArchiveAttachment delArchiveAttachment
} from "@/api/mdp/arc/archiveAttachment"; } from "@/api/mdp/arc/archiveAttachment";
import {listHrUserAccessory} from "@/api/oa/hr/user/hrUserAccessory";
export default { export default {
props: [ props: [
"branchId", "branchId",
@ -94,37 +84,22 @@ export default {
"listType", "listType",
"limit", "limit",
"eliminate", "eliminate",
"isDisabled",
"userId",
"isUserInfo"
"isDisabled"
], ],
watch: { watch: {
// archiveId: function(archiveId){
// this.fileList = [];
// console.log(1,archiveId);
// // listHrUserAccessory({relevanceId:this.archiveId}).then(res => {
// // var files1 = res.data.data
// // files1.forEach(i => (i.name = i.name));
// // console.log(2,files1);
// // });
// },
archiveId: function(archiveId) { archiveId: function(archiveId) {
var that = this; var that = this;
this.$nextTick(_ => { this.$nextTick(_ => {
this.fileList = []; this.fileList = [];
if(this.isUserInfo==1){
}else{
listArchiveAttachment({ archiveId: that.archiveId }).then(res => {
var files = res.data.data;
if (files && files.length > 0) {
files.forEach(i => {
i.name = i.name;
that.fileList.push(i);
});
}
});
}
listArchiveAttachment({ archiveId: this.archiveId }).then(res => {
var files = res.data.data;
if (files && files.length > 0) {
files.forEach(i => {
i.name = i.name;
that.fileList.push(i);
});
}
});
}); });
}, },
eliminate: function(eliminate) { eliminate: function(eliminate) {
@ -153,7 +128,7 @@ export default {
}); });
previewOnlineUrls.forEach(i => { previewOnlineUrls.forEach(i => {
i.url = i.url =
config.getArcFileUploadBasePath() + "/" + i.accessory + "?name=" + i.name;
config.getArcFileUploadBasePath() + "/" + i.url + "?name=" + i.name;
}); });
console.log( console.log(
"xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx00000000000000000000000000000000000" "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx00000000000000000000000000000000000"
@ -169,9 +144,7 @@ export default {
fileList: [], fileList: [],
showPreviewImage: false, showPreviewImage: false,
showOnePreviewImage: false, showOnePreviewImage: false,
image: null,
isshow:false,
isshowtrue:false
image: null
/**end 在上面加自定义属性**/ /**end 在上面加自定义属性**/
}; //end return }; //end return
}, //end data }, //end data
@ -184,39 +157,16 @@ export default {
handleSuccess(res, file) { handleSuccess(res, file) {
if (res.tips.isOk) { if (res.tips.isOk) {
file = Object.assign(file, res.data); file = Object.assign(file, res.data);
console.log(this.isshowtrue);
this.fileList.push(res.data); this.fileList.push(res.data);
if(!this.isshowtrue){
this.fileList = [];
}
console.log(this.fileList);
this.$emit('getCarFrontImageUrl',res.data.url) this.$emit('getCarFrontImageUrl',res.data.url)
this.$emit('getCarBackImageUrl',res.data.url) this.$emit('getCarBackImageUrl',res.data.url)
this.$emit('getCarInnerImageUrl',res.data.url) this.$emit('getCarInnerImageUrl',res.data.url)
this.$emit('uploadSuccess',file) this.$emit('uploadSuccess',file)
this.$message.success('上传附件成功');
} else { } else {
this.$message.warning(res.tips.msg); this.$message.warning(res.tips.msg);
return false; return false;
} }
}, },
showFile(){
console.log(6,this.fileList);
this.isshowtrue = true;
listHrUserAccessory({relevanceId:this.archiveId,userid:this.userId}).then(res => {
var files = res.data.data;
files.forEach(i => (i.name = i.name));
this.fileList = files;
console.log(2,this.fileList);
if(this.fileList.length == 0||!this.fileList.length){
this.$message('暂无附件');
}
});
},
hideFile(){
this.isshowtrue = false;
this.fileList = [];
},
handleRemove(file, fileList) { handleRemove(file, fileList) {
if (!file.id || file.id == null || file.id == "") { if (!file.id || file.id == null || file.id == "") {
return true; return true;
@ -276,14 +226,13 @@ export default {
var canDel = false; var canDel = false;
this.fileList.forEach(item => { this.fileList.forEach(item => {
if (item.name == file.name) { if (item.name == file.name) {
if (item.canDel == "1"||item.type == "1") {
if (item.canDel == "1") {
canDel = true; canDel = true;
return; return;
} }
} }
}); });
if (canDel == false && file.id && file.id != null && file.id != "") { if (canDel == false && file.id && file.id != null && file.id != "") {
console.log(66);
this.$message.warning(file.name + "设置了不允许删除"); this.$message.warning(file.name + "设置了不允许删除");
return false; return false;
} else if ( } else if (
@ -303,13 +252,13 @@ export default {
this.$message({ message: "文件已经存在", type: "warning" }); this.$message({ message: "文件已经存在", type: "warning" });
return false; return false;
} else { } else {
if (file.size > 1024 * 1024) {
if (file.size > 1024 * 1024 * 4) {
//4M //4M
this.$message({ this.$message({
message: message:
"文件大小为" + "文件大小为" +
file.size / (1024 * 1024) + file.size / (1024 * 1024) +
"M,大于1M,不允许上传。",
"M,大于4M,不允许上传。",
type: "warning" type: "warning"
}); });
return false; return false;
@ -332,6 +281,12 @@ export default {
if (!this.archiveId) { if (!this.archiveId) {
return; return;
} }
listArchiveAttachment({ archiveId: this.archiveId }).then(res => {
var files = res.data.data;
files.forEach(i => (i.name = i.name));
this.fileList = files;
});
/**在下面写其它函数***/ /**在下面写其它函数***/
} //end mounted } //end mounted
}; };

Loading…
Cancel
Save