b25b036d
wuxw
v1.9 优化日期
|
1
|
<template>
|
bc37d685
wuxw
开发完成合同功能
|
2
|
<el-dialog :title="$t('contractTypeManage.template.title')" :visible.sync="visible" width="80%" @close="handleClose">
|
eb48bd86
wuxw
合同功能测试完成
|
3
4
5
6
7
8
|
<div class="attr-buttons">
<el-button v-for="(item, index) in contractTypeAttrs" :key="index" type="primary" size="small"
@click="insertAttrs(item)">
{{ item }}
</el-button>
</div>
|
bc37d685
wuxw
开发完成合同功能
|
9
|
|
eb48bd86
wuxw
合同功能测试完成
|
10
11
12
13
14
15
16
17
|
<el-form label-width="120px">
<el-form-item :label="$t('contractTypeManage.template.content')">
<div class="editor-container">
<el-input type="textarea" :rows="15" v-model="context"
:placeholder="$t('contractTypeManage.template.placeholder')" />
</div>
</el-form-item>
</el-form>
|
bc37d685
wuxw
开发完成合同功能
|
18
19
20
21
22
23
24
25
26
27
28
29
|
<div slot="footer" class="dialog-footer">
<el-button @click="visible = false">
{{ $t('common.cancel') }}
</el-button>
<el-button type="primary" @click="saveTemplateInfo">
{{ $t('common.submit') }}
</el-button>
</div>
</el-dialog>
</template>
<script>
|
eb48bd86
wuxw
合同功能测试完成
|
30
|
import { saveContractTypeTemplate, updateContractTypeTemplate, queryContractTypeTemplate, printContractTemplate } from '@/api/contract/contractTypeManageApi'
|
bc37d685
wuxw
开发完成合同功能
|
31
32
33
34
35
36
37
38
39
40
|
export default {
name: 'AddTemplateView',
data() {
return {
visible: false,
contractTypeId: '',
context: '',
templateId: '',
contractTypeAttrs: [],
|
eb48bd86
wuxw
合同功能测试完成
|
41
|
contractTypeSpec: []
|
bc37d685
wuxw
开发完成合同功能
|
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
|
}
},
methods: {
open(contractType) {
this.contractTypeId = contractType.contractTypeId
this.visible = true
this._loadContractAttrs(contractType.contractTypeId)
this._loadTemplate()
},
async _loadContractAttrs(contractTypeId) {
try {
const params = {
page: 1,
row: 1,
contractTypeId
}
const { data } = await printContractTemplate(params)
this.contractTypeAttrs = []
this.contractTypeSpec = data.contractTypeSpec
this.contractTypeSpec.forEach(e => {
const rname = e.specName
const reg = `#${rname}#`
this.contractTypeAttrs.push(reg)
})
} catch (error) {
console.error('加载合同属性失败:', error)
}
},
insertAttrs(attr) {
this.context += attr
},
async saveTemplateInfo() {
if (!this.addTemplateValidate()) {
return
}
try {
// const url = this.templateId ? '/contract/updateContractTypeTemplate' : '/contract/saveContractTypeTemplate'
const data = {
contractTypeId: this.contractTypeId,
context: this.context,
templateId: this.templateId
}
const res = this.templateId
? await updateContractTypeTemplate(data)
: await saveContractTypeTemplate(data)
if (res.code === 0) {
|
6ec243d6
wuxw
v1.9 点击提交后,成功提示没有...
|
92
|
this.$message.success(this.$t('common.operationSuccess'))
|
bc37d685
wuxw
开发完成合同功能
|
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
|
this.visible = false
this.$emit('success')
} else {
this.$message.error(res.msg)
}
} catch (error) {
this.$message.error(this.$t('common.operateFailed'))
}
},
addTemplateValidate() {
if (!this.contractTypeId) {
this.$message.error(this.$t('contractTypeManage.validate.contractTypeRequired'))
return false
}
if (!this.context) {
this.$message.error(this.$t('contractTypeManage.validate.contentRequired'))
return false
}
return true
},
async _loadTemplate() {
try {
const params = {
page: 1,
row: 1,
contractTypeId: this.contractTypeId
}
const { data } = await queryContractTypeTemplate(params)
if (data.length > 0) {
this.templateId = data[0].templateId
this.context = data[0].context
} else {
this.templateId = ''
this.context = ''
}
} catch (error) {
console.error('加载模板失败:', error)
}
},
handleClose() {
this.contractTypeId = ''
this.context = ''
this.templateId = ''
}
}
}
</script>
<style lang="scss" scoped>
.attr-buttons {
margin-bottom: 20px;
.el-button {
margin-right: 10px;
margin-bottom: 10px;
}
}
.editor-container {
::v-deep .el-textarea__inner {
min-height: 300px;
}
}
</style>
|