1
1
<template >
2
- <content-wrap >
2
+ <ContentWrap >
3
3
<!-- 搜索工作栏 -->
4
4
<el-form
5
5
class =" -mb-15px"
56
56
<el-form-item >
57
57
<el-button @click =" handleQuery" ><Icon icon =" ep:search" class =" mr-5px" /> 搜索</el-button >
58
58
<el-button @click =" resetQuery" ><Icon icon =" ep:refresh" class =" mr-5px" /> 重置</el-button >
59
- <el-button @click =" handleCreate()"
60
- > <Icon icon =" ep:plus" class =" mr-5px" /> 发起请假</ el-button
61
- >
59
+ <el-button type = " primary " plain @click =" handleCreate()" >
60
+ <Icon icon =" ep:plus" class =" mr-5px" /> 发起请假
61
+ </ el-button >
62
62
</el-form-item >
63
63
</el-form >
64
- </content-wrap >
64
+ </ContentWrap >
65
65
66
66
<!-- 列表 -->
67
- <content-wrap >
67
+ <ContentWrap >
68
68
<el-table v-loading =" loading" :data =" list" >
69
69
<el-table-column label =" 申请编号" align =" center" prop =" id" />
70
70
<el-table-column label =" 状态" align =" center" prop =" result" >
99
99
width =" 180"
100
100
:formatter =" dateFormatter"
101
101
/>
102
-
103
- <el-table-column
104
- label =" 操作"
105
- align =" center"
106
- class-name =" small-padding fixed-width"
107
- width =" 200"
108
- >
102
+ <el-table-column label =" 操作" align =" center" width =" 200" >
109
103
<template #default =" scope " >
110
- <el-button
111
- link
112
- type =" primary"
113
- @click =" cancelLeave(scope.row)"
114
- v-hasPermi =" ['bpm:oa-leave:create']"
115
- v-if =" scope.row.result === 1"
116
- >取消</el-button
117
- >
118
104
<el-button
119
105
link
120
106
type =" primary"
121
107
@click =" handleDetail(scope.row)"
122
108
v-hasPermi =" ['bpm:oa-leave:query']"
123
- >详情</el-button
124
109
>
110
+ 详情
111
+ </el-button >
125
112
<el-button
126
113
link
127
114
type =" primary"
128
115
@click =" handleProcessDetail(scope.row)"
129
116
v-hasPermi =" ['bpm:oa-leave:query']"
130
- >进度</el-button
131
117
>
118
+ 进度
119
+ </el-button >
120
+ <el-button
121
+ link
122
+ type =" danger"
123
+ @click =" cancelLeave(scope.row)"
124
+ v-hasPermi =" ['bpm:oa-leave:create']"
125
+ v-if =" scope.row.result === 1"
126
+ >
127
+ 取消
128
+ </el-button >
132
129
</template >
133
130
</el-table-column >
134
131
</el-table >
139
136
v-model:limit =" queryParams.pageSize"
140
137
@pagination =" getList"
141
138
/>
142
- </content-wrap >
139
+ </ContentWrap >
143
140
144
141
<!-- 表单弹窗:详情 -->
145
142
<LeaveDetail ref =" detailRef" />
146
-
147
143
<!-- 表单弹窗:添加 -->
148
144
<LeaveForm ref =" formRef" @success =" getList" />
149
145
</template >
150
- <script setup lang="ts" name="OaLeave ">
146
+ <script setup lang="ts" name="BpmOALeave ">
151
147
import { DICT_TYPE , getIntDictOptions } from ' @/utils/dict'
152
148
import { dateFormatter } from ' @/utils/formatTime'
153
149
import * as LeaveApi from ' @/api/bpm/leave'
154
150
import * as ProcessInstanceApi from ' @/api/bpm/processInstance'
155
151
import LeaveDetail from ' ./detail.vue'
156
152
import LeaveForm from ' ./create.vue'
153
+ const message = useMessage () // 消息弹窗
154
+ const router = useRouter () // 路由
155
+ const { t } = useI18n () // 国际化
157
156
158
157
const loading = ref (true ) // 列表的加载中
159
158
const total = ref (0 ) // 列表的总页数
160
159
const list = ref ([]) // 列表的数据
161
-
162
- const message = useMessage () // 消息弹窗
163
- const router = useRouter ()
164
160
const queryParams = reactive ({
165
161
pageNo: 1 ,
166
162
pageSize: 10 ,
@@ -175,7 +171,7 @@ const queryFormRef = ref() // 搜索的表单
175
171
const getList = async () => {
176
172
loading .value = true
177
173
try {
178
- const data = await LeaveApi .getLeavePageApi (queryParams )
174
+ const data = await LeaveApi .getLeavePage (queryParams )
179
175
list .value = data .list
180
176
total .value = data .total
181
177
} finally {
@@ -207,20 +203,23 @@ const handleDetail = (data: LeaveApi.LeaveVO) => {
207
203
detailRef .value .open (data )
208
204
}
209
205
210
- // 取消请假弹窗
211
- const cancelLeave = (row ) => {
212
- ElMessageBox .prompt (' 请输入取消原因' , ' 取消流程' , {
213
- confirmButtonText: ' 确定' ,
214
- cancelButtonText: ' 取消' ,
206
+ /** 取消请假操作 */
207
+ const cancelLeave = async (row ) => {
208
+ // 二次确认
209
+ const { value } = await ElMessageBox .prompt (' 请输入取消原因' , ' 取消流程' , {
210
+ confirmButtonText: t (' common.ok' ),
211
+ cancelButtonText: t (' common.cancel' ),
215
212
inputPattern: / ^ [\s\S ] * . * \S [\s\S ] * $ / , // 判断非空,且非空格
216
213
inputErrorMessage: ' 取消原因不能为空'
217
- }).then (async ({ value }) => {
218
- await ProcessInstanceApi .cancelProcessInstanceApi (row .id , value )
219
- message .success (' 取消成功' )
220
214
})
215
+ // 发起取消
216
+ await ProcessInstanceApi .cancelProcessInstance (row .id , value )
217
+ message .success (' 取消成功' )
218
+ // 刷新列表
219
+ await getList ()
221
220
}
222
221
223
- // 审批进度
222
+ /** 审批进度 */
224
223
const handleProcessDetail = (row ) => {
225
224
router .push ({
226
225
name: ' BpmProcessInstanceDetail' ,
0 commit comments