|
|
@@ -31,6 +31,7 @@
|
|
31
|
31
|
</template>
|
|
32
|
32
|
<script>
|
|
33
|
33
|
import { getToken } from "@/utils/auth";
|
|
|
34
|
+import { updateTemplate } from "@/api/officialSeal/officialSeal"
|
|
34
|
35
|
export default {
|
|
35
|
36
|
props: ["editVisable", "editData", "queryParams"],
|
|
36
|
37
|
dicts: ["template_type"],
|
|
|
@@ -41,7 +42,7 @@ export default {
|
|
41
|
42
|
headers: {
|
|
42
|
43
|
Authorization: "Bearer " + getToken(),
|
|
43
|
44
|
},
|
|
44
|
|
- isImg: false,
|
|
|
45
|
+ isImg: true,
|
|
45
|
46
|
filedata: {},
|
|
46
|
47
|
flagBtn: false,
|
|
47
|
48
|
ruleForm: {},
|
|
|
@@ -77,19 +78,32 @@ export default {
|
|
77
|
78
|
},
|
|
78
|
79
|
handleChange(file, fileList) {
|
|
79
|
80
|
this.isImg = file.type === '.doc' || '.docx';
|
|
|
81
|
+ this.fileList = fileList;
|
|
80
|
82
|
},
|
|
81
|
83
|
UploadUrl() {
|
|
82
|
84
|
return window.location.origin + "/API/deptIdentify/updateTemplate";
|
|
83
|
85
|
},
|
|
84
|
86
|
submitUpload() {
|
|
|
87
|
+ let that = this;
|
|
85
|
88
|
this.$refs['ruleForm'].validate((valid) => {
|
|
86
|
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,7 +115,7 @@ export default {
|
|
101
|
115
|
// this.isImg = file.type === '.doc' || '.docx'
|
|
102
|
116
|
},
|
|
103
|
117
|
handleSuccess() {
|
|
104
|
|
- this.$message.success('上传成功');
|
|
|
118
|
+ this.$message.success('修改成功');
|
|
105
|
119
|
this.$emit("cancelEdit");
|
|
106
|
120
|
this.$emit('getList', this.queryParams);
|
|
107
|
121
|
}
|