1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
<template>
<div>
<div style="text-align: center;font-size: 16px;font-weight: bold;"><span>知情同意书</span></div>
<a-form-model ref="formRef" :model="formData" :rules="formRules" style="margin-top: 20px">
<a-row>
<a-col :span="24">
<!--label="模板内容"-->
<a-form-model-item prop="content" :wrapper-col="{span: 24}">
<baiduEditor ref="baiduEditor" v-model="formData.content"></baiduEditor>
</a-form-model-item>
</a-col>
</a-row>
</a-form-model>
<a-button style="margin-left: 36%" @click="backList">取消</a-button>
<a-button type="primary" style="margin-left: 20px" class="search_btn"
@click="submitForm">保存
</a-button>
</div>
</template>
<script>
import typeSelect from "../../components/commonSelect/typeSelect";
import baiduEditor from "../../components/baiduEditor";
import {closedDetail, isBlank} from "../../utils/common";
export default {
components: {typeSelect, baiduEditor},
name: "addTemplate",
data() {
return {
// form表单
formData: {
id: "",
content: ""
},
formRules: {
content: [
{required: true, message: '请输入模板内容', trigger: 'blur'}
]
},
formDisabled: false,
modeType: "update"
}
},
created() {
let vm = this;
this.$api.common.fetchConsentInfo().then(res => {
if (res.code == 'SUCCESS') {
if (isBlank(res.data)) {
this.modeType = 'add';
} else {
setTimeout(function () {
vm.$refs.baiduEditor.setContent(res.data.content,false)
},500);
this.formData.content = res.data.content;
this.formData.id = res.data.id;
}
}
})
},
methods: {
// 弹窗确定按钮
submitForm() {
let vm = this;
this.formData.content = this.$refs.baiduEditor.getContent();
this.$refs.formRef.validate(valid => {
if (valid) {
this.$confirm({
title: '确定提交吗?',
okType: 'success',
onOk: () => {
if (this.modeType === "add") {
vm.$api.common.fetchAddConsentInfo(this.formData).then(res => {
if (res.code === 'SUCCESS') {
vm.$message.success('操作成功!')
}
})
} else {
vm.$api.common.fetchUpdateConsentInfo(this.formData).then(res => {
if (res.code === 'SUCCESS') {
vm.$message.success('操作成功!')
}
})
}
},
onCancel: () => {
},
});
}
});
},
backList() {
closedDetail('/system/addTemplate')
}
},
}
</script>
<style lang="less">
.edui-default .edui-toolbar .edui-combox .edui-combox-body {
line-height: 21px !important;
}
.edui-default .edui-button-body, .edui-splitbutton-body, .edui-menubutton-body, .edui-combox-body {
line-height: 20px !important;
}
</style>