|
|
|
@ -329,6 +329,11 @@ export default {
|
|
|
|
|
},
|
|
|
|
|
//图片上传删除
|
|
|
|
|
handleRemove(file, fileList) {
|
|
|
|
|
const url = file.url;
|
|
|
|
|
console.log(url);
|
|
|
|
|
const i = this.imgAddress.findIndex((x)=> x.url === url);
|
|
|
|
|
this.imgAddress.splice(i,1);
|
|
|
|
|
console.log(this.imgAddress)
|
|
|
|
|
//根据传进来删除的file里图片,同时删除保存在fileListPut的相同图片
|
|
|
|
|
if(this.fileListPut.length > 0){
|
|
|
|
|
this.fileListPut = this.fileListPut.filter((item, index)=>{
|
|
|
|
@ -353,6 +358,7 @@ export default {
|
|
|
|
|
//往此数组中保存当前图片对象
|
|
|
|
|
this.fileListPut.push(currentFile);
|
|
|
|
|
console.log(this.fileListPut)
|
|
|
|
|
console.log(this.imgAddress)
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@ -427,6 +433,8 @@ export default {
|
|
|
|
|
},
|
|
|
|
|
/** 新增按钮操作 */
|
|
|
|
|
handleAdd() {
|
|
|
|
|
console.log(this.imgAddress.length)
|
|
|
|
|
this.imgAddress.length=0;
|
|
|
|
|
this.reset();
|
|
|
|
|
this.fileListShow = [];
|
|
|
|
|
this.open = true;
|
|
|
|
@ -437,8 +445,13 @@ export default {
|
|
|
|
|
this.reset();
|
|
|
|
|
const knowledgeMaintId = row.knowledgeMaintId || this.ids
|
|
|
|
|
getKonwledgeMaint(knowledgeMaintId).then(response => {
|
|
|
|
|
console.log(response.data.systemFiles)
|
|
|
|
|
for (let element of response.data.systemFiles) {
|
|
|
|
|
this.imgAddress.push(element.url)
|
|
|
|
|
}
|
|
|
|
|
this.form = response.data;
|
|
|
|
|
this.fileListShow = response.data.systemFiles
|
|
|
|
|
console.log(this.fileListShow)
|
|
|
|
|
this.open = true;
|
|
|
|
|
this.title = "修改保养知识库";
|
|
|
|
|
});
|
|
|
|
@ -448,21 +461,23 @@ export default {
|
|
|
|
|
this.$refs["form"].validate(valid => {
|
|
|
|
|
if (valid) {
|
|
|
|
|
if (this.form.knowledgeMaintId != null) {
|
|
|
|
|
this.form.fileUrls = [];
|
|
|
|
|
this.form.fileUrls = this.imgAddress;
|
|
|
|
|
updateKonwledgeMaint(this.form).then(response => {
|
|
|
|
|
this.$modal.msgSuccess("修改成功");
|
|
|
|
|
this.imgAddress.length = 0;
|
|
|
|
|
this.form.fileUrls.length=0;
|
|
|
|
|
this.open = false;
|
|
|
|
|
// this.imgAddress.length = 0;
|
|
|
|
|
this.getList();
|
|
|
|
|
});
|
|
|
|
|
} else {
|
|
|
|
|
this.form.fileUrls = this.imgAddress;
|
|
|
|
|
|
|
|
|
|
addKonwledgeMaint(this.form).then(response => {
|
|
|
|
|
|
|
|
|
|
this.$modal.msgSuccess("新增成功");
|
|
|
|
|
this.imgAddress.length = 0;
|
|
|
|
|
this.open = false;
|
|
|
|
|
console.log(this.imgAddress)
|
|
|
|
|
this.imgAddress.length = 0;
|
|
|
|
|
this.getList();
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|