Files
Mediation-Frontend/src/views/officialSeal/components/editTemplate.vue
T

235 lines
9.9 KiB
Vue
Raw Normal View History

2024-01-08 15:38:36 +08:00
<template>
<div>
<el-dialog title="修改模板" :visible="editVisable" v-if="editVisable" @close="cancel" width="600px" center>
2024-02-21 17:38:00 +08:00
<el-form :model="ruleForm" label-position="left" :rules="rules" ref="ruleForm" label-width="170px"
2024-01-08 15:38:36 +08:00
class="demo-ruleForm">
<el-form-item label="模板名称" prop="temName">
<el-input v-model="ruleForm.temName"></el-input>
</el-form-item>
2024-02-06 15:49:17 +08:00
<!-- <el-form-item label="模板类型" prop="temType">
2024-01-08 15:38:36 +08:00
<el-select v-model="ruleForm.temType" placeholder="请选择">
<el-option v-for="dict in dict.type.template_type" :key="dict.value" :label="dict.label"
:value="dict.value"></el-option>
</el-select>
2024-02-06 15:49:17 +08:00
</el-form-item> -->
2024-02-21 17:38:00 +08:00
<el-form-item label="自然人调解申请书模板" v-if="ruleForm.personApplicationFile && ruleForm.personApplicationFile.fileName">
<span style="color: #0e5ce3;cursor:pointer" @click="openUrl(ruleForm.personApplicationFile.temOrigPath)">{{
ruleForm.personApplicationFile.fileName ? ruleForm.personApplicationFile.fileName : ""
}}</span>
</el-form-item>
<el-form-item label="机构调解申请书模板" v-if="ruleForm.applicationFile.fileName">
2024-02-06 15:49:17 +08:00
<span style="color: #0e5ce3;cursor:pointer" @click="openUrl(ruleForm.applicationFile.temOrigPath)">{{
ruleForm.applicationFile.fileName ? ruleForm.applicationFile.fileName : ""
}}</span>
2024-01-08 15:38:36 +08:00
</el-form-item>
2024-02-06 15:49:17 +08:00
<el-form-item label="和解协议模板" v-if="ruleForm.agreementFile.fileName">
<!-- <span style="color: #0e5ce3;cursor:pointer" @click="openUrl(editData.temOrigPath)">{{ editData.fileName
}}</span> -->
<span style="color: #0e5ce3;cursor:pointer" @click="openUrl(ruleForm.agreementFile.temOrigPath)">{{
ruleForm.agreementFile.fileName ? ruleForm.agreementFile.fileName : ""
}}</span>
</el-form-item>
<el-form-item label="调解书模板" v-if="ruleForm.bookFile.fileName">
<span style="color: #0e5ce3;cursor:pointer" @click="openUrl(ruleForm.bookFile.temOrigPath)">{{
ruleForm.bookFile.fileName ? ruleForm.bookFile.fileName : ""
2024-01-08 15:38:36 +08:00
}}</span>
</el-form-item>
</el-form>
2024-02-21 17:38:00 +08:00
<el-upload class="avatar-uploader" :on-success="handleSuccessC" ref="upload" :action="UploadUrl()"
:headers="headers" :data="filedataC" :on-remove="handleRemoveC" :on-change="handleChangeC" accept=".doc,.docx"
:file-list="fileListC" :limit="1">
<el-button size="small" type="primary">选择自然人调解申请书模板</el-button>
</el-upload>
2024-02-06 15:49:17 +08:00
<el-upload class="avatar-uploader" :on-success="handleSuccess" ref="upload" :action="UploadUrl()"
:headers="headers" :data="filedata" :on-remove="handleRemove" :on-change="handleChange" accept=".doc,.docx"
:file-list="fileList" :limit="1">
2024-02-21 17:38:00 +08:00
<el-button size="small" type="primary">选择机构调解申请书模板</el-button>
2024-02-06 15:49:17 +08:00
</el-upload>
<el-upload class="avatar-uploader" :on-success="handleSuccessA" ref="uploadA" :action="UploadUrl()"
:headers="headers" :data="filedataA" :on-remove="handleRemoveA" :on-change="handleChangeA"
accept=".doc,.docx" :file-list="fileListA" :limit="1">
<el-button size="small" type="primary">选择和解协议模板</el-button>
</el-upload>
<el-upload class="avatar-uploader" :on-success="handleSuccessB" ref="upload" :action="UploadUrl()"
:headers="headers" :data="filedataB" :on-remove="handleRemoveB" :on-change="handleChangeB"
accept=".doc,.docx" :file-list="fileListB" :limit="1">
<el-button size="small" type="primary">选择调解书模板</el-button>
2024-01-08 15:38:36 +08:00
</el-upload>
<div slot="footer" class="dialog-footer">
<el-button @click="cancel" class="endbutton"><span>取 消</span></el-button>
<el-button type="primary" @click="submitUpload" class="endbutton"><span>确认</span></el-button>
</div>
</el-dialog>
</div>
</template>
<script>
import { getToken } from "@/utils/auth";
2024-02-06 15:49:17 +08:00
import { updateTemplate, getTemplateDetail } from "@/api/officialSeal/officialSeal"
2024-01-08 15:38:36 +08:00
export default {
props: ["editVisable", "editData", "queryParams"],
dicts: ["template_type"],
data() {
return {
fileList: [],
2024-02-06 15:49:17 +08:00
fileListA: [],
fileListB: [],
2024-02-21 17:38:00 +08:00
fileListC: [],
2024-01-08 15:38:36 +08:00
data: [],
headers: {
Authorization: "Bearer " + getToken(),
},
isImg: true,
2024-02-06 15:49:17 +08:00
filedata: {
annexType: 1
},
filedataA: {
annexType: 2
},
filedataB: {
annexType: 3
},
2024-02-21 17:38:00 +08:00
filedataC: {
annexType: 4
},
2024-01-08 15:38:36 +08:00
flagBtn: false,
2024-02-06 15:49:17 +08:00
ruleForm: {
agreementFile:{},
applicationFile:{},
bookFile:{}
},
2024-01-08 15:38:36 +08:00
rules: {
temName: [
{ required: true, message: '请输入模板名称', trigger: 'blur' },
],
2024-02-06 15:49:17 +08:00
},
submitForm: {
annexIds: []
2024-01-08 15:38:36 +08:00
}
};
},
watch: {
editData(val) {
if (val) {
this.fileList = [];
2024-02-06 15:49:17 +08:00
}
},
editVisable(val){
if(val){
2024-02-26 18:00:14 +08:00
this.getTemplateDetailFn({ id: this.editData.id });
this.submitForm.annexIds = []
2024-01-08 15:38:36 +08:00
}
}
},
created() {
},
methods: {
// 打开链接
openUrl(urlTemp) {
let headPath = window.location.origin + "/API/";
window.open(headPath + urlTemp);
},
cancel() {
this.$emit("cancelEdit");
},
UploadUrl() {
return window.location.origin + "/API/deptIdentify/updateTemplate";
},
2024-02-06 15:49:17 +08:00
/**根据id查看详情*/
getTemplateDetailFn(data) {
getTemplateDetail(data).then(res => {
this.ruleForm = res;
2024-02-26 18:00:14 +08:00
// this.submitForm.annexIds = [this.ruleForm.agreementFile.fileId,this.ruleForm.applicationFile.fileId,this.ruleForm.bookFile.fileId]
2024-02-06 15:49:17 +08:00
})
},
2024-01-08 15:38:36 +08:00
submitUpload() {
this.$refs['ruleForm'].validate((valid) => {
if (valid) {
2024-02-06 15:49:17 +08:00
this.$refs['ruleForm'].validate((valid) => {
if (valid) {
this.submitForm.identifyId = this.ruleForm.identifyId;
this.submitForm.temName = this.ruleForm.temName;
this.submitForm.id = this.ruleForm.id;
2024-02-21 17:38:00 +08:00
console.log(this.submitForm,'ooooooooooooooooooooooooooooo');
2024-02-06 15:49:17 +08:00
updateTemplate(this.submitForm).then(res => {
this.$message.success('修改成功');
this.$emit("cancelEdit");
this.$emit('getList', this.queryParams);
})
2024-01-08 15:38:36 +08:00
}
2024-02-06 15:49:17 +08:00
});
2024-01-08 15:38:36 +08:00
}
});
},
2024-02-06 15:49:17 +08:00
handleChange(file, fileList) {
this.isImg = file.type === '.doc' || '.docx'
},
UploadUrl() {
return window.location.origin + "/API/deptIdentify/upload";
},
2024-01-08 15:38:36 +08:00
handleRemove(file, fileList) {
console.log(file, fileList);
},
2024-02-21 17:38:00 +08:00
// 机构
2024-02-06 15:49:17 +08:00
handleSuccess(res) {
2024-02-21 17:38:00 +08:00
console.log(res,'机构上传成功');
2024-02-06 15:49:17 +08:00
this.$message.success('上传成功');
// this.submitForm.annexIds.push(res.annexId);
2024-02-26 18:00:14 +08:00
this.submitForm.annexIds.push(res.annexId);
2024-01-08 15:38:36 +08:00
},
2024-02-21 17:38:00 +08:00
// 自然人
handleSuccessC(res) {
console.log(res,'自然人上传成功');
this.$message.success('上传成功');
2024-02-26 18:00:14 +08:00
this.submitForm.annexIds.push(res.annexId);
2024-02-21 17:38:00 +08:00
},
handleRemoveC(file, fileList) {
console.log(file, fileList);
},
handleChangeC(file, fileList) {
this.isImg = file.type === '.doc' || '.docx'
},
2024-02-06 15:49:17 +08:00
handleChangeA(file, fileList) {
this.isImg = file.type === '.doc' || '.docx'
},
UploadUrl() {
return window.location.origin + "/API/deptIdentify/upload";
},
handleRemoveA(file, fileList) {
console.log(file, fileList);
},
2024-02-21 17:38:00 +08:00
// 和解协议
2024-02-06 15:49:17 +08:00
handleSuccessA(res) {
this.$message.success('上传成功');
// this.submitForm.annexIds.push(res.annexId);
2024-02-26 18:00:14 +08:00
this.submitForm.annexIds.push(res.annexId);
2024-02-06 15:49:17 +08:00
},
handleChangeB(file, fileList) {
this.isImg = file.type === '.doc' || '.docx'
},
UploadUrl() {
return window.location.origin + "/API/deptIdentify/upload";
},
handleRemoveB(file, fileList) {
console.log(file, fileList);
},
2024-02-21 17:38:00 +08:00
// 调解书
2024-02-06 15:49:17 +08:00
handleSuccessB(res) {
this.$message.success('上传成功');
// this.submitForm.annexIds.push(res.annexId);
2024-02-26 18:00:14 +08:00
this.submitForm.annexIds.push(res.annexId);
2024-02-06 15:49:17 +08:00
},
// handleSuccess() {
// this.$message.success('修改成功');
// this.$emit("cancelEdit");
// this.$emit('getList', this.queryParams);
// }
2024-01-08 15:38:36 +08:00
},
};
</script>
2024-02-06 15:49:17 +08:00
<style lang="scss" scoped>
.avatar-uploader {
margin-bottom: 20px;
}</style>