InstanceModifyOpinion.vue
4.27 KB
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
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
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
<template>
<el-dialog
title="修改审批意见"
:visible.sync="commuDialog"
v-if="commuDialog"
@close="cancel"
:close-on-click-modal="false"
appendToBody
>
<table cellspacing="0" cellpadding="0" border="0" class="form-table">
<tbody>
<tr>
<th style="width: 100px;">
<span class="xh-star">*</span>审批意见:
</th>
<td>
<OpinionText
v-if="commuDialog"
:text="curModifyOpnion.opinion"
ref="opinionText"
/>
</td>
</tr>
<tr>
<th style="width: 100px;">
意见附件:
</th>
<td colspan="3">
<FileUpload ref="fileUpload" />
</td>
</tr>
<tr>
<th style="width: 100px;">
<span class="xh-star">*</span>修改原因:
</th>
<td colspan="3">
<el-input
type="textarea"
:rows="2"
:show-word-limit="true"
:maxlength="200"
placeholder="请输入修改原因"
v-model="reason"
>
</el-input>
</td>
</tr>
</tbody>
</table>
<div slot="footer" class="dialog-footer">
<el-button @click="cancel" size="small">取 消</el-button>
<el-button type="primary" @click="confirm" size="small">确 定</el-button>
</div>
</el-dialog>
</template>
<script>
import {mapState, mapActions} from 'vuex'
import OpinionText from '@/components/common/OpinionText.vue'
import FileUpload from '@/components/common/HtFileUpload.vue'
import {Message} from 'element-ui'
import utils from '@/hotent-ui-util.js'
import {Base64} from 'js-base64'
import req from '@/request.js'
export default {
name: 'instance-modify-opinion',
components: {OpinionText, FileUpload},
data() {
return {
commuDialog: false,
curModifyOpnion: {},
reason: ''
}
},
computed: mapState({
rows: state => state.storeProcess.rows
}),
methods: {
//鼠标点击页面其他其他位置不关闭弹框
show(opinion) {
this.curModifyOpnion = opinion
this.commuDialog = true
},
//取消
cancel() {
this.commuDialog = false
this.resetTable()
},
resetTable() {
this.curModifyOpnion = {}
this.reason = ''
this.$refs.fileUpload.$refs.fileUp.clearFiles()
},
//确认
confirm() {
let newOpinion = this.$refs.opinionText.getOpinion()
if (!newOpinion) {
this.$message.warning('意见不能为空')
return
}
if (!this.reason) {
this.$message.warning('修改原因不能为空')
return
}
this.curModifyOpnion.opinion = newOpinion
if (this.$refs.fileUpload.getFiles() != '') {
this.curModifyOpnion.files = JSON.stringify(
this.$refs.fileUpload.getFiles()
)
}
let obj = {
opinions: JSON.stringify(this.curModifyOpnion),
cause: this.reason
}
let this_ = this
req
.post(
window.context.bpmRunTime + '/runtime/instance/v1/updateFlowOpinions',
obj
)
.then(function(rep) {
let data = rep.data
if (data.state) {
this_.$message.success('修改成功')
this_.$emit('opinionModifysuccess', this_.curModifyOpnion)
this_.commuDialog = false
this_.resetTable()
this_.$parent.loadData()
} else {
this_.$message.fail(data.message)
}
})
}
}
}
</script>
<style lang="scss" scoped>
.el-dialog__footer {
padding: 10px 20px;
padding-top: 10px;
text-align: right;
-webkit-box-sizing: border-box;
box-sizing: border-box;
}
.form-table {
width: 100%;
border-top: 1px solid #ebeef5;
border-left: 1px solid #ebeef5;
}
.form-table th {
text-align: right;
color: #666;
}
.form-table th > span {
color: #f00;
}
.form-table th,
.form-table td {
border-right: 1px solid #ebeef5;
border-bottom: 1px solid #ebeef5;
padding: 10px;
min-width: 0;
box-sizing: border-box;
text-overflow: ellipsis;
vertical-align: middle;
position: relative;
}
.xh-star {
color: red;
}
div /deep/.el-dialog__header {
display: block;
}
</style>