1129测试

This commit is contained in:
fz
2023-11-29 22:56:06 +08:00
parent c507f28f3f
commit b537bd958d
3 changed files with 28 additions and 12 deletions
@@ -31,6 +31,7 @@
</template>
<script>
import { getToken } from "@/utils/auth";
import { updateTemplate } from "@/api/officialSeal/officialSeal"
export default {
props: ["editVisable", "editData", "queryParams"],
dicts: ["template_type"],
@@ -41,7 +42,7 @@ export default {
headers: {
Authorization: "Bearer " + getToken(),
},
isImg: false,
isImg: true,
filedata: {},
flagBtn: false,
ruleForm: {},
@@ -77,19 +78,32 @@ export default {
},
handleChange(file, fileList) {
this.isImg = file.type === '.doc' || '.docx';
this.fileList = fileList;
},
UploadUrl() {
return window.location.origin + "/API/deptIdentify/updateTemplate";
},
submitUpload() {
let that = this;
this.$refs['ruleForm'].validate((valid) => {
if (valid) {
this.filedata.id = this.editData.id;
this.filedata.temName = this.ruleForm.temName;
if (this.isImg) {
this.$refs.upload.submit();
}else{
this.$message.error('只能上传doc,docx格式的文件')
if (that.fileList.length > 0) {
that.filedata.id = that.editData.id;
that.filedata.temName = that.ruleForm.temName;
if (that.isImg) {
that.$refs.upload.submit();
} else {
that.$message.error('只能上传doc,docx格式的文件')
}
} else {
updateTemplate({
id: that.editData.id,
temName: that.ruleForm.temName
}).then(res => {
that.$message.success('修改成功');
that.$emit("cancelEdit");
that.$emit('getList', that.queryParams);
})
}
}
});
@@ -101,7 +115,7 @@ export default {
// this.isImg = file.type === '.doc' || '.docx'
},
handleSuccess() {
this.$message.success('上传成功');
this.$message.success('修改成功');
this.$emit("cancelEdit");
this.$emit('getList', this.queryParams);
}
@@ -7,7 +7,7 @@
<el-input v-model="ruleForm.sealName"></el-input>
</el-form-item>
</el-form>
<el-upload class="avatar-uploader" :before-upload="beforeUpload" :on-success="handleSuccess" ref="upload"
<el-upload class="avatar-uploader" accept="image/png" :before-upload="beforeUpload" :on-success="handleSuccess" ref="upload"
:action="UploadUrl()" :headers="headers" :data="filedata" :on-remove="handleRemove"
:on-change="handleChange" :show-file-list="false" :file-list="fileList" :auto-upload="false">
<img v-if="imageUrl" :src="imageUrl" class="avatar">
@@ -47,7 +47,8 @@ export default {
watch: {
uploadVisable(val) {
if (val) {
this.imageUrl = ""
this.imageUrl = "",
this.ruleForm = {}
}
}
},
@@ -85,7 +86,8 @@ export default {
},
handleSuccess(response) {
if (response.code == 200) {
this.$message.success('上传成功')
this.$message.success('上传成功');
this.cancel()
} else {
this.$message.error(response.msg);
}