소스 검색

1129测试

fz 2 년 전
부모
커밋
b537bd958d
3개의 변경된 파일28개의 추가작업 그리고 12개의 파일을 삭제
  1. 1
    1
      src/api/officialSeal/officialSeal.js
  2. 22
    8
      src/views/officialSeal/components/editTemplate.vue
  3. 5
    3
      src/views/officialSeal/components/uploadSeal.vue

+ 1
- 1
src/api/officialSeal/officialSeal.js 파일 보기

78
     return request({
78
     return request({
79
         url: '/deptIdentify/updateTemplate',
79
         url: '/deptIdentify/updateTemplate',
80
         method: 'post',
80
         method: 'post',
81
-        data: data
81
+        params: data
82
     })
82
     })
83
 }
83
 }
84
 // 删除模板
84
 // 删除模板

+ 22
- 8
src/views/officialSeal/components/editTemplate.vue 파일 보기

31
 </template>
31
 </template>
32
 <script>
32
 <script>
33
 import { getToken } from "@/utils/auth";
33
 import { getToken } from "@/utils/auth";
34
+import { updateTemplate } from "@/api/officialSeal/officialSeal"
34
 export default {
35
 export default {
35
     props: ["editVisable", "editData", "queryParams"],
36
     props: ["editVisable", "editData", "queryParams"],
36
     dicts: ["template_type"],
37
     dicts: ["template_type"],
41
             headers: {
42
             headers: {
42
                 Authorization: "Bearer " + getToken(),
43
                 Authorization: "Bearer " + getToken(),
43
             },
44
             },
44
-            isImg: false,
45
+            isImg: true,
45
             filedata: {},
46
             filedata: {},
46
             flagBtn: false,
47
             flagBtn: false,
47
             ruleForm: {},
48
             ruleForm: {},
77
         },
78
         },
78
         handleChange(file, fileList) {
79
         handleChange(file, fileList) {
79
             this.isImg = file.type === '.doc' || '.docx';
80
             this.isImg = file.type === '.doc' || '.docx';
81
+            this.fileList = fileList;
80
         },
82
         },
81
         UploadUrl() {
83
         UploadUrl() {
82
             return window.location.origin + "/API/deptIdentify/updateTemplate";
84
             return window.location.origin + "/API/deptIdentify/updateTemplate";
83
         },
85
         },
84
         submitUpload() {
86
         submitUpload() {
87
+            let that = this;
85
             this.$refs['ruleForm'].validate((valid) => {
88
             this.$refs['ruleForm'].validate((valid) => {
86
                 if (valid) {
89
                 if (valid) {
87
-                    this.filedata.id = this.editData.id;
88
-                    this.filedata.temName = this.ruleForm.temName;
89
-                    if (this.isImg) {
90
-                        this.$refs.upload.submit();
91
-                    }else{
92
-                        this.$message.error('只能上传doc,docx格式的文件')
90
+                    if (that.fileList.length > 0) {
91
+                        that.filedata.id = that.editData.id;
92
+                        that.filedata.temName = that.ruleForm.temName;
93
+                        if (that.isImg) {
94
+                            that.$refs.upload.submit();
95
+                        } else {
96
+                            that.$message.error('只能上传doc,docx格式的文件')
97
+                        }
98
+                    } else {
99
+                        updateTemplate({
100
+                            id: that.editData.id,
101
+                            temName: that.ruleForm.temName
102
+                        }).then(res => {
103
+                            that.$message.success('修改成功');
104
+                            that.$emit("cancelEdit");
105
+                            that.$emit('getList', that.queryParams);
106
+                        })
93
                     }
107
                     }
94
                 }
108
                 }
95
             });
109
             });
101
             // this.isImg = file.type === '.doc' || '.docx'
115
             // this.isImg = file.type === '.doc' || '.docx'
102
         },
116
         },
103
         handleSuccess() {
117
         handleSuccess() {
104
-            this.$message.success('上传成功');
118
+            this.$message.success('修改成功');
105
             this.$emit("cancelEdit");
119
             this.$emit("cancelEdit");
106
             this.$emit('getList', this.queryParams);
120
             this.$emit('getList', this.queryParams);
107
         }
121
         }

+ 5
- 3
src/views/officialSeal/components/uploadSeal.vue 파일 보기

7
                     <el-input v-model="ruleForm.sealName"></el-input>
7
                     <el-input v-model="ruleForm.sealName"></el-input>
8
                 </el-form-item>
8
                 </el-form-item>
9
             </el-form>
9
             </el-form>
10
-            <el-upload class="avatar-uploader" :before-upload="beforeUpload" :on-success="handleSuccess" ref="upload"
10
+            <el-upload class="avatar-uploader" accept="image/png" :before-upload="beforeUpload" :on-success="handleSuccess" ref="upload"
11
                 :action="UploadUrl()" :headers="headers" :data="filedata" :on-remove="handleRemove"
11
                 :action="UploadUrl()" :headers="headers" :data="filedata" :on-remove="handleRemove"
12
                 :on-change="handleChange" :show-file-list="false" :file-list="fileList" :auto-upload="false">
12
                 :on-change="handleChange" :show-file-list="false" :file-list="fileList" :auto-upload="false">
13
                 <img v-if="imageUrl" :src="imageUrl" class="avatar">
13
                 <img v-if="imageUrl" :src="imageUrl" class="avatar">
47
     watch: {
47
     watch: {
48
         uploadVisable(val) {
48
         uploadVisable(val) {
49
             if (val) {
49
             if (val) {
50
-                this.imageUrl = ""
50
+                this.imageUrl = "",
51
+                this.ruleForm = {}
51
             }
52
             }
52
         }
53
         }
53
     },
54
     },
85
         },
86
         },
86
         handleSuccess(response) {
87
         handleSuccess(response) {
87
             if (response.code == 200) {
88
             if (response.code == 200) {
88
-                this.$message.success('上传成功')
89
+                this.$message.success('上传成功');
90
+                this.cancel()
89
             } else {
91
             } else {
90
                 this.$message.error(response.msg);
92
                 this.$message.error(response.msg);
91
             }
93
             }