模板修改

This commit is contained in:
hanchaobo
2024-02-06 15:49:17 +08:00
parent 0213fca840
commit 85d3a33414
4 changed files with 226 additions and 83 deletions
+10 -2
View File
@@ -78,7 +78,7 @@ export function updateTemplate(data) {
return request({
url: '/deptIdentify/updateTemplate',
method: 'post',
params: data
data: data
})
}
// 删除模板
@@ -200,4 +200,12 @@ export function getTemplateInfoById(data) {
method: 'get',
params: data
})
}
}
// 查询模板详情
export function getTemplateDetail(data) {
return request({
url: '/deptIdentify/getTemplateDetail',
method: 'get',
params: data
})
}
@@ -6,12 +6,12 @@
<el-form-item label="模板名称" prop="temName">
<el-input v-model="ruleForm.temName"></el-input>
</el-form-item>
<el-form-item label="模板类型" prop="temType">
<!-- <el-form-item label="模板类型" prop="temType">
<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>
</el-form-item>
</el-form-item> -->
<el-form-item label="机构名称" prop="identifyId">
<el-select v-model="ruleForm.identifyId" placeholder="请选择">
<el-option v-for="item in tempList" :key="item.id" :label="item.identifyName" :value="item.id">
@@ -19,10 +19,20 @@
</el-select>
</el-form-item>
</el-form>
<el-upload class="avatar-uploader" :before-upload="beforeUpload" :on-success="handleSuccess" ref="upload"
:action="UploadUrl()" :headers="headers" :data="filedata" :on-remove="handleRemove"
:on-change="handleChange" accept=".doc,.docx" :file-list="fileList" :auto-upload="false">
<el-button size="small" type="primary">选择模板文件</el-button>
<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">
<el-button size="small" type="primary">选择调解申请书模板</el-button>
</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>
</el-upload>
<div slot="footer" class="dialog-footer">
<el-button @click="cancel" class="endbutton"><span>取 消</span></el-button>
@@ -35,6 +45,7 @@
import { getToken } from "@/utils/auth";
import {
deptIdentifyList,
insertTemplate
} from "@/api/officialSeal/officialSeal.js";
export default {
props: ["uploadVisable", "uploadData", "queryParams"],
@@ -42,25 +53,38 @@ export default {
data() {
return {
fileList: [],
fileListA: [],
fileListB: [],
data: [],
tempList: [],
isImg:false,
isImg: false,
headers: {
Authorization: "Bearer " + getToken(),
},
filedata: {},
filedata: {
annexType: 1
},
filedataA: {
annexType: 2
},
filedataB: {
annexType: 3
},
flagBtn: false,
ruleForm: {},
rules: {
temName: [
{ required: true, message: '请输入模板名称', trigger: 'blur' },
],
temType: [
{ required: true, message: '请输入模板名称', trigger: 'blur' },
],
// temType: [
// { required: true, message: '请输入模板名称', trigger: 'blur' },
// ],
identifyId: [
{ required: true, message: '请输入模板名称', trigger: 'blur' },
]
},
submitForm: {
annexIds: []
}
};
},
@@ -89,35 +113,67 @@ export default {
this.isImg = file.type === '.doc' || '.docx'
},
UploadUrl() {
return window.location.origin + "/API/deptIdentify/insertTemplate";
},
submitUpload() {
this.$refs['ruleForm'].validate((valid) => {
if (valid) {
this.filedata.identifyId = this.ruleForm.identifyId;
this.filedata.temName = this.ruleForm.temName;
if (this.isImg) {
this.$refs.upload.submit();
}else{
this.$message.error('只能上传doc,docx格式的文件')
}
}
});
return window.location.origin + "/API/deptIdentify/upload";
},
handleRemove(file, fileList) {
console.log(file, fileList);
},
beforeUpload(file) {
// debugger
// this.isImg = file.type === '.doc' || '.docx'
},
handleSuccess() {
handleSuccess(res) {
this.$message.success('上传成功');
this.$emit("cancelUpload");
this.$emit('getList', this.queryParams);
}
console.log(res, "OOOOOOOOOOOOOOOOO");
this.submitForm.annexIds.push(res.annexId)
},
handleChangeA(file, fileList) {
this.isImg = file.type === '.doc' || '.docx'
},
UploadUrl() {
return window.location.origin + "/API/deptIdentify/upload";
},
handleRemoveA(file, fileList) {
console.log(file, fileList);
},
handleSuccessA(res) {
this.$message.success('上传成功');
this.submitForm.annexIds.push(res.annexId)
},
handleChangeB(file, fileList) {
this.isImg = file.type === '.doc' || '.docx'
},
UploadUrl() {
return window.location.origin + "/API/deptIdentify/upload";
},
handleRemoveB(file, fileList) {
console.log(file, fileList);
},
handleSuccessB(res) {
this.$message.success('上传成功');
this.submitForm.annexIds.push(res.annexId)
},
submitUpload() {
this.$refs['ruleForm'].validate((valid) => {
if (valid) {
if(this.submitForm.annexIds.length < 3){
this.$message.error('三种类型模板必须上传');
return
}
this.submitForm.identifyId = this.ruleForm.identifyId;
this.submitForm.temName = this.ruleForm.temName;
insertTemplate(this.submitForm).then(res => {
this.$message.success('新增成功');
this.$emit("cancelUpload");
this.$emit('getList', this.queryParams);
})
}
});
},
},
};
</script>
<style lang="scss" scoped></style>
<style lang="scss" scoped>
.avatar-uploader {
margin-bottom: 20px;
}
</style>
@@ -6,21 +6,44 @@
<el-form-item label="模板名称" prop="temName">
<el-input v-model="ruleForm.temName"></el-input>
</el-form-item>
<el-form-item label="模板类型" prop="temType">
<!-- <el-form-item label="模板类型" prop="temType">
<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>
</el-form-item> -->
<el-form-item label="调节申请书模板" v-if="ruleForm.applicationFile.fileName">
<span style="color: #0e5ce3;cursor:pointer" @click="openUrl(ruleForm.applicationFile.temOrigPath)">{{
ruleForm.applicationFile.fileName ? ruleForm.applicationFile.fileName : ""
}}</span>
</el-form-item>
<el-form-item label="当前模板">
<span style="color: #0e5ce3;cursor:pointer" @click="openUrl(editData.temOrigPath)">{{ editData.fileName
<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 : ""
}}</span>
</el-form-item>
</el-form>
<el-upload class="avatar-uploader" :before-upload="beforeUpload" :on-success="handleSuccess" ref="upload"
:action="UploadUrl()" :headers="headers" :data="filedata" :on-remove="handleRemove"
:on-change="handleChange" accept=".doc,.docx" :file-list="fileList" :auto-upload="false">
<el-button size="small" type="primary">选择模板文件</el-button>
<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">
<el-button size="small" type="primary">选择调解申请书模板</el-button>
</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>
</el-upload>
<div slot="footer" class="dialog-footer">
<el-button @click="cancel" class="endbutton"><span>取 消</span></el-button>
@@ -31,37 +54,54 @@
</template>
<script>
import { getToken } from "@/utils/auth";
import { updateTemplate } from "@/api/officialSeal/officialSeal"
import { updateTemplate, getTemplateDetail } from "@/api/officialSeal/officialSeal"
export default {
props: ["editVisable", "editData", "queryParams"],
dicts: ["template_type"],
data() {
return {
fileList: [],
fileListA: [],
fileListB: [],
data: [],
headers: {
Authorization: "Bearer " + getToken(),
},
isImg: true,
filedata: {},
filedata: {
annexType: 1
},
filedataA: {
annexType: 2
},
filedataB: {
annexType: 3
},
flagBtn: false,
ruleForm: {},
ruleForm: {
agreementFile:{},
applicationFile:{},
bookFile:{}
},
rules: {
temName: [
{ required: true, message: '请输入模板名称', trigger: 'blur' },
],
temType: [
{ required: true, message: '请输入模板名称', trigger: 'blur' },
],
},
submitForm: {
annexIds: []
}
};
},
watch: {
editData(val) {
if (val) {
this.ruleForm = val;
this.fileList = [];
this.ruleForm.temType = this.ruleForm.temType + '';
}
},
editVisable(val){
if(val){
this.getTemplateDetailFn({ id: this.editData.id })
}
}
},
@@ -77,51 +117,90 @@ export default {
cancel() {
this.$emit("cancelEdit");
},
handleChange(file, fileList) {
this.isImg = file.type === '.doc' || '.docx';
this.fileList = fileList;
},
UploadUrl() {
return window.location.origin + "/API/deptIdentify/updateTemplate";
},
/**根据id查看详情*/
getTemplateDetailFn(data) {
getTemplateDetail(data).then(res => {
this.ruleForm = res;
this.submitForm.annexIds = [this.ruleForm.agreementFile.fileId,this.ruleForm.applicationFile.fileId,this.ruleForm.bookFile.fileId]
console.log(this.submitForm.annexIds,"PPPPPPPPPPPPPPPPPPPPPPPP");
})
},
submitUpload() {
let that = this;
this.$refs['ruleForm'].validate((valid) => {
if (valid) {
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格式的文件')
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;
console.log(this.submitForm.annexIds,'ooooooooooooooooooooooooooooo');
updateTemplate(this.submitForm).then(res => {
this.$message.success('修改成功');
this.$emit("cancelEdit");
this.$emit('getList', this.queryParams);
})
}
} else {
updateTemplate({
id: that.editData.id,
temName: that.ruleForm.temName
}).then(res => {
that.$message.success('修改成功');
that.$emit("cancelEdit");
that.$emit('getList', that.queryParams);
})
}
});
}
});
},
handleChange(file, fileList) {
this.isImg = file.type === '.doc' || '.docx'
},
UploadUrl() {
return window.location.origin + "/API/deptIdentify/upload";
},
handleRemove(file, fileList) {
console.log(file, fileList);
},
beforeUpload(file) {
// this.isImg = file.type === '.doc' || '.docx'
handleSuccess(res) {
this.$message.success('上传成功');
// this.submitForm.annexIds.push(res.annexId);
this.submitForm.annexIds[1] = res.annexId;
},
handleSuccess() {
this.$message.success('修改成功');
this.$emit("cancelEdit");
this.$emit('getList', this.queryParams);
}
handleChangeA(file, fileList) {
this.isImg = file.type === '.doc' || '.docx'
},
UploadUrl() {
return window.location.origin + "/API/deptIdentify/upload";
},
handleRemoveA(file, fileList) {
console.log(file, fileList);
},
handleSuccessA(res) {
this.$message.success('上传成功');
// this.submitForm.annexIds.push(res.annexId);
this.submitForm.annexIds[0] = res.annexId;
},
handleChangeB(file, fileList) {
this.isImg = file.type === '.doc' || '.docx'
},
UploadUrl() {
return window.location.origin + "/API/deptIdentify/upload";
},
handleRemoveB(file, fileList) {
console.log(file, fileList);
},
handleSuccessB(res) {
this.$message.success('上传成功');
// this.submitForm.annexIds.push(res.annexId);
this.submitForm.annexIds[3] = res.annexId;
},
// handleSuccess() {
// this.$message.success('修改成功');
// this.$emit("cancelEdit");
// this.$emit('getList', this.queryParams);
// }
},
};
</script>
<style lang="scss" scoped></style>
<style lang="scss" scoped>
.avatar-uploader {
margin-bottom: 20px;
}</style>
+2 -2
View File
@@ -12,9 +12,9 @@ const name = process.env.VUE_APP_TITLE || '调解系统' // 网页标题
const port = process.env.port || process.env.npm_config_port || 80 // 端口
// const API = 'http://121.40.189.20:9001' //生产
const API = 'http://121.40.189.20:6001' //测试
// const API = 'http://121.40.189.20:6001' //测试
// const API = 'http://192.168.3.18:6001' //B
// const API = 'http://192.168.3.77:6001' //Q
const API = 'http://172.16.0.237:6001' //Q
// const API = 'http://172.16.1.17:6001' //w
// vue.config.js 配置说明