diff --git a/src/api/credit.js b/src/api/credit.js index dcdc27e..23e4658 100644 --- a/src/api/credit.js +++ b/src/api/credit.js @@ -22,6 +22,17 @@ export function getContentsWithBizseq(data) { }) } +/** + * 获取行政处罚文书模板内容 + */ +export function getRemPunishmentContentsWithBizseq(data) { + return request({ + url: '/tswrittemplate/getRemPunishmentContentsWithBizseq', + method: 'post', + data + }) +} + /** * 根据工作流id及意见类型获取最新意见 * @param {string} workflowId 工作流id diff --git a/src/views/credit/rempunish/accept.vue b/src/views/credit/rempunish/accept.vue index 7bd033e..5f9d007 100644 --- a/src/views/credit/rempunish/accept.vue +++ b/src/views/credit/rempunish/accept.vue @@ -72,41 +72,41 @@ - - - - - - - + + + + + - + + + - + - + - + - + + + + +
+ 点击上传 +
只能上传jpg/png/pdf/doc/docx/xls/xlsx/rar/zip/7z文件,且单个文件不能超过20M
+
+
+
+
@@ -201,21 +228,37 @@ + + + + 准予修复 + 不予修复 + + + + + + + 不予信用修复决定书 + 准予信用修复决定书 + + + @@ -223,7 +266,7 @@ - + @@ -243,11 +286,43 @@
返回
+ + +
+ + + + {{ user.orgName }} + + + + + {{ dialogTitle }} + + + + + {{ IlcPunInfo.dsrmc }} + + + +
+ + + 保存 + +
@@ -257,9 +332,12 @@ import { validBeforeUpload } from '@/api/fileUpload' import { removeAttachementById } from '@/api/attachment' import { getInfo, listFile, submitTask } from '@/api/remPunish' import {getUsersWithPermission} from "@/api/user"; +import Editor from '@/components/editor.vue' +import {getRemPunishmentContentsWithBizseq, saveOrUpdateContent} from "@/api/credit"; export default { data() { return { + submitLoading: false, fullscreenLoading: false, user: JSON.parse(sessionStorage.getItem('user')), bizSeq: this.$route.query.bizSeq, @@ -270,27 +348,28 @@ export default { uploadPath: `${process.env.VUE_APP_BASE_API}/punishment/tBizRemPunishment/upload`, onlyShow: this.$route.query.onlyShow === '1', fileList: [], + dialogTitle: '', + eidtDialog: false, + firstEnt: {}, + isClear: false, + editorDisable: false, + eidtContent: '', + contentText: '', + tswrittemplate: { + bizseq: '', + writsType: '', + isTemplate: '', + type: 'punishment' // 设置为行政处罚类型 + }, formRules: { applyDate: [ { required: true, message: '请选择主体申请修复日期', trigger: 'blur' } ], - repairNo: [ - { required: true, message: '请录入准予修复决定书文号', trigger: 'blur' } - ], repairDate: [ { required: true, message: '请选择信用修复决定时间', trigger: 'blur' } ], repairOrgCn: [ { required: true, message: '请录入作出信用修复决定机关', trigger: 'blur' } - ], - files_1: [ - { required: true, message: '请上传信用修复决定审批表', validator: this.validateFile } - ], - files_2: [ - { required: true, message: '请上传准予信用修复决定文书', validator: this.validateFile } - ], - files_3: [ - { required: true, message: '请上传补充材料', validator: this.validateFile } ] }, processRules: { @@ -335,6 +414,15 @@ export default { this.punishInfo.repairOrgCn = this.user.orgName this.initFileList() + + // 初始化文书内容 + this.$nextTick(() => { + if (this.punishInfo.isAgreeRepair === '0') { + this.getNoRepairDecContent() + } else if (this.punishInfo.isAgreeRepair === '1') { + this.getRepairDecContent() + } + }) }).finally(() => { this.fullscreenLoading = false }) @@ -359,8 +447,8 @@ export default { }, submit() { this.submitLoading = true - // 判断是否为"不予受理"或"不予修复"状态 - const isNotAgree = this.punishInfo.status === '3' + // 判断是否为"不予受理"状态 + const isNotAgree = this.punishInfo.isAccept === '0' if (isNotAgree) { // 不需要验证,直接提交 @@ -373,7 +461,7 @@ export default { // 需要验证表单 this.validateBusinessForm() .then(() => { - return this.$confirm('确定提交后,上述行政处罚信息将从国家企业信用信息公示系统撤下,不再对外公示。'); + return this.$confirm('确定提交?'); }) .then(() => { this.performSubmit(); @@ -387,10 +475,20 @@ export default { }, // 提取公共提交逻辑 performSubmit() { + // 只在 linkType 不为 '1' 时显示提交提示 + if (this.punishInfo.linkType !== '1') { + this.$message({ + message: '提醒!后台正在生成文书,过程需要耐心等待,切勿重复点击提交,待生成完毕页面会自动返回待办。', + type: 'warning', + duration: 5000 // 5秒后自动消失 + }); + } submitTask(this.punishInfo).then(res => { if (res.code === 0) { this.$message.success('提交成功') this.$router.back() + } else if (res.code === 5002) { + this.$message.error('须保存文书内容') } else { this.$message.error('提交失败,' + res.msg) } @@ -427,8 +525,12 @@ export default { window.open(`${process.env.VUE_APP_BASE_API}/attachment/download?id=${file.id}`, '_blank') }, uploadCallback(res, file) { - this.$message.success('上传成功') - this.initFileList() + if (res.code === 0) { + this.$message.success('上传成功') + this.initFileList() + } else { + this.$message.error('上传失败') + } }, // 移除文件回调 removeFile(file) { @@ -456,7 +558,6 @@ export default { // 验证必填字段 const validations = [ { field: 'applyDate', name: '主体申请修复日期', value: this.punishInfo.applyDate }, - { field: 'repairNo', name: '准予修复决定书文号', value: this.punishInfo.repairNo }, { field: 'repairDate', name: '信用修复决定时间', value: this.punishInfo.repairDate }, { field: 'repairOrgCn', name: '作出信用修复决定机关', value: this.punishInfo.repairOrgCn } ]; @@ -469,28 +570,114 @@ export default { } } - // 验证文件上传 - const fileTypes = ['1', '2', '3']; - const fileLabels = ['信用修复决定审批表', '准予信用修复决定文书', '补充材料']; - - for (let i = 0; i < fileTypes.length; i++) { - const fileType = fileTypes[i]; - const fileLabel = fileLabels[i]; - const files = this.fileList.filter(item => item.attachtype === fileType); - - if (files.length === 0) { - this.$message.warning(`请上传${fileLabel}`); - reject(new Error(`请上传${fileLabel}`)); - return; - } - } - resolve(true); }); + }, + handleAcceptChange(value) { + // 当选择受理时,清空之前的是否准予修复选择 + if (value === '1') { + this.punishInfo.isAgreeRepair = ''; + } + }, + openDialog(type) { + // 验证日期字段是否为空 + if (!this.punishInfo.applyDate) { + this.$message.warning('请先填写主体申请修复日期'); + return; + } + if (!this.punishInfo.repairDate) { + this.$message.warning('请先填写信用修复决定时间'); + return; + } + var title = '' + if (type === 'creidtRepair') { + // 点击准予信用修复决定书时,获取最新内容 + this.getRepairDecContent() + title = '准予信用修复决定书' + } else if (type === 'noCreidtRepair') { + this.getNoRepairDecContent() + title = '不予信用修复决定书' + } + this.eidtDialog = true + this.dialogLoading = true + this.dialogTitle = title + }, + changeEditor(val) { + // 处理编辑器变化 + }, + getTextVal(res) { + this.contentText = res + }, + async saveTempalte(alertMsg) { + this.submitLoading = true + this.tswrittemplate.content = this.eidtContent + var resData = false + + // 这里需要根据实际的API接口调整 + try { + const response = await saveOrUpdateContent(this.tswrittemplate) + resData = response.data + } catch (error) { + console.error('保存决定书失败:', error) + } + + if (resData === true) { + this.submitLoading = false + this.eidtDialog = false + if (alertMsg) { + return this.$message.success('保存成功') + } else { + return true + } + } else { + if (alertMsg) { + return this.$message.error('保存决定书失败') + } else { + return false + } + } + }, + // 获取准予信用修复决定书内容 + async getRepairDecContent() { + this.tswrittemplate.bizseq = this.bizSeq + this.tswrittemplate.writsType = '65' // 准予信用修复决定书类型码 + this.tswrittemplate.type = 'punishment' + // 添加日期参数 + this.tswrittemplate.applyDate = this.punishInfo.applyDate + this.tswrittemplate.repairDate = this.punishInfo.repairDate + + getRemPunishmentContentsWithBizseq(this.tswrittemplate).then(res => { + if (res.code === 0) { + this.$nextTick(() => { + this.$set(this.tswrittemplate, 'content', res.data.content) + this.$set(this, 'eidtContent', res.data.content) + }) + } + }) + }, + // 获取不予信用修复决定书内容 + async getNoRepairDecContent() { + this.tswrittemplate.bizseq = this.bizSeq + this.tswrittemplate.writsType = '66' // 不予信用修复决定书类型码 + this.tswrittemplate.type = 'punishment' + // 添加日期参数 + this.tswrittemplate.applyDate = this.punishInfo.applyDate + this.tswrittemplate.repairDate = this.punishInfo.repairDate + + getRemPunishmentContentsWithBizseq(this.tswrittemplate).then(res => { + if (res.code === 0) { + this.$nextTick(() => { + this.$set(this.tswrittemplate, 'content', res.data.content) + this.$set(this.tswrittemplate, 'writsType', res.data.writsType) + this.$set(this, 'eidtContent', res.data.content) + }) + } + }) } }, components: { - DetailHead + DetailHead, + Editor } }