Browse Source

部门新增做了图片回显

gks 1 year ago
parent
commit
eb95d217b8
1 changed files with 17 additions and 5 deletions
  1. 17 5
      src/views/system/dept/index.vue

+ 17 - 5
src/views/system/dept/index.vue

@@ -295,7 +295,8 @@ export default {
   components: { Treeselect },
   data() {
     return {
-      changeShow:false,
+      fileName: "",
+      changeShow: false,
       // 文件列表
       fileList: [],
       uploadIs: false,
@@ -382,9 +383,8 @@ export default {
     this.getList();
   },
   methods: {
-
-        // 文件上传选择
-        handleSelect(file, list) {
+    // 文件上传选择
+    handleSelect(file, list) {
       this.fileList = list;
     },
     // 文件移除
@@ -393,7 +393,6 @@ export default {
     },
     // 文件上传成功
     handleSuccess(response, file, fileList) {
-      console.log(fileList);
       let imgList = [];
       fileList.forEach((i) => {
         if (i.response.fileName) {
@@ -510,6 +509,19 @@ export default {
       this.changeShow = true;
       this.reset();
       getDept(row.deptId).then((response) => {
+        if (response.data.sinfo03 != null) {
+          let imgList = response.data.sinfo03.split(",");
+          imgList.forEach((item, i) => {
+            let obj = {
+              name: item.slice(item.lastIndexOf("/") + 1),
+              url: this.ip + item,
+            };
+            imgList[i] = obj;
+          });
+          this.fileName = imgList[0].url;
+          this.fileList = imgList;
+        }
+
         this.form = response.data;
         this.open = true;
         this.title = "修改部门";