修改保存设备图片时传参

main
jinna 2 years ago
parent 79ee4f9eb4
commit 30b4d9db8a
  1. 36
      src/views/equipment/index.vue

@ -259,7 +259,8 @@
getLc,
getQy1,
getLc1,
saveImg
saveImg,
getDetail
} from "@/api/equipment/index";
import {
mapGetters
@ -665,6 +666,14 @@
}
},
mounted() {
if(this.$route.query.code){
getDetail({equipCode:this.$route.query.code}).then(res =>{
console.log(res)
this.ruleForm = res.data.data;
this.equipmentBox = true;
this.eqiupType = 'look'
})
}
getDeptLazyTree2().then(res => {
let data = res.data.data;
for(let i=0;i<data.length;i++){
@ -713,6 +722,7 @@
if(response.code == 200){
this.imgList.push(response.data.link)
}
console.log(this.imgList)
},
beforeRemove(file,fileList){
if(this.eqiupType == 'look'){
@ -726,6 +736,7 @@
}else{
this.imgList = this.imgList.filter(item => item !== file.url.slice(file.url))
}
console.log(this.imgList)
},
//
handleDelete() {
@ -806,7 +817,7 @@
this.equipmentBox = true;
this.iDisabled = false;
this.eqiupType = type;
console.log(this.eqiupType,type)
this.imgList = []
this.fileList = []
if (type == "add") {
//
@ -869,15 +880,18 @@
if (!this.iDisabled) {
this.$refs[formName].validate((valid) => {
if (valid) {
let data = []
if(this.imgList.length !== 0){
this.imgList.map(item =>{
data.push({
equipCode:this.ruleForm.code,
filePath:item
})
})
}
// let data = []
// if(this.imgList.length !== 0){
// this.imgList.map(item =>{
// data.push({
// equipCode:this.ruleForm.code,
// filePath:item
// })
// })
// }
console.log(this.imgList)
let data = {equipCode:this.ruleForm.code,filepaths:this.imgList.join(',')}
console.log(data)
saveImg(data).then(res =>{
if(res.data.code == 200){
add(this.ruleForm).then(res => {

Loading…
Cancel
Save