|
67 | 67 | <!-- 列表 -->
|
68 | 68 | <ContentWrap>
|
69 | 69 | <el-table v-loading="loading" :data="list">
|
70 |
| - <el-table-column label="流程标识" align="center" prop="key" width="200" /> |
71 |
| - <el-table-column label="流程名称" align="center" prop="name" width="200"> |
72 |
| - <template #default="scope"> |
73 |
| - <el-button type="primary" link @click="handleBpmnDetail(scope.row)"> |
74 |
| - <span>{{ scope.row.name }}</span> |
75 |
| - </el-button> |
76 |
| - </template> |
77 |
| - </el-table-column> |
78 |
| - <el-table-column label="流程图标" align="center" prop="icon" width="100"> |
| 70 | + <el-table-column label="流程名称" align="center" prop="name" min-width="200" /> |
| 71 | + <el-table-column label="流程图标" align="center" prop="icon" min-width="100"> |
79 | 72 | <template #default="scope">
|
80 | 73 | <el-image :src="scope.row.icon" class="h-32px w-32px" />
|
81 | 74 | </template>
|
82 | 75 | </el-table-column>
|
83 |
| - <el-table-column label="流程分类" align="center" prop="categoryName" width="100" /> |
84 |
| - <el-table-column label="表单信息" align="center" prop="formType" width="200"> |
| 76 | + <el-table-column label="流程分类" align="center" prop="categoryName" min-width="100" /> |
| 77 | + <el-table-column label="表单信息" align="center" prop="formType" min-width="200"> |
85 | 78 | <template #default="scope">
|
86 | 79 | <el-button
|
87 | 80 | v-if="scope.row.formType === 10"
|
|
102 | 95 | <label v-else>暂无表单</label>
|
103 | 96 | </template>
|
104 | 97 | </el-table-column>
|
105 |
| - <el-table-column |
106 |
| - label="创建时间" |
107 |
| - align="center" |
108 |
| - prop="createTime" |
109 |
| - width="180" |
110 |
| - :formatter="dateFormatter" |
111 |
| - /> |
112 |
| - <el-table-column label="最新部署的流程定义" align="center"> |
113 |
| - <el-table-column |
114 |
| - label="流程版本" |
115 |
| - align="center" |
116 |
| - prop="processDefinition.version" |
117 |
| - width="100" |
118 |
| - > |
119 |
| - <template #default="scope"> |
120 |
| - <el-tag v-if="scope.row.processDefinition"> |
121 |
| - v{{ scope.row.processDefinition.version }} |
122 |
| - </el-tag> |
123 |
| - <el-tag v-else type="warning">未部署</el-tag> |
124 |
| - </template> |
125 |
| - </el-table-column> |
126 |
| - <el-table-column |
127 |
| - label="激活状态" |
128 |
| - align="center" |
129 |
| - prop="processDefinition.version" |
130 |
| - width="85" |
131 |
| - > |
132 |
| - <template #default="scope"> |
133 |
| - <el-switch |
134 |
| - v-if="scope.row.processDefinition" |
135 |
| - v-model="scope.row.processDefinition.suspensionState" |
136 |
| - :active-value="1" |
137 |
| - :inactive-value="2" |
138 |
| - @change="handleChangeState(scope.row)" |
139 |
| - /> |
140 |
| - </template> |
141 |
| - </el-table-column> |
142 |
| - <el-table-column label="部署时间" align="center" prop="deploymentTime" width="180"> |
143 |
| - <template #default="scope"> |
144 |
| - <span v-if="scope.row.processDefinition"> |
145 |
| - {{ formatDate(scope.row.processDefinition.deploymentTime) }} |
146 |
| - </span> |
147 |
| - </template> |
148 |
| - </el-table-column> |
| 98 | + <!-- <el-table-column label="激活状态" align="center" prop="processDefinition.version" width="85">--> |
| 99 | + <!-- <template #default="scope">--> |
| 100 | + <!-- <el-switch--> |
| 101 | + <!-- v-if="scope.row.processDefinition"--> |
| 102 | + <!-- v-model="scope.row.processDefinition.suspensionState"--> |
| 103 | + <!-- :active-value="1"--> |
| 104 | + <!-- :inactive-value="2"--> |
| 105 | + <!-- @change="handleChangeState(scope.row)"--> |
| 106 | + <!-- />--> |
| 107 | + <!-- </template>--> |
| 108 | + <!-- </el-table-column>--> |
| 109 | + <el-table-column label="最后发布" align="center" prop="deploymentTime" min-width="250"> |
| 110 | + <template #default="scope"> |
| 111 | + <span v-if="scope.row.processDefinition"> |
| 112 | + {{ formatDate(scope.row.processDefinition.deploymentTime) }} |
| 113 | + </span> |
| 114 | + <el-tag v-if="scope.row.processDefinition" class="ml-10px"> |
| 115 | + v{{ scope.row.processDefinition.version }} |
| 116 | + </el-tag> |
| 117 | + <el-tag v-else type="warning">未部署</el-tag> |
| 118 | + <el-tag |
| 119 | + v-if="scope.row.processDefinition.suspensionState === 2" |
| 120 | + type="warning" |
| 121 | + class="ml-10px" |
| 122 | + > |
| 123 | + 已停用 |
| 124 | + </el-tag> |
| 125 | + </template> |
149 | 126 | </el-table-column>
|
150 |
| - <el-table-column label="操作" align="center" width="250" fixed="right"> |
| 127 | + <el-table-column label="操作" align="center" width="200" fixed="right"> |
151 | 128 | <template #default="scope">
|
152 | 129 | <el-button
|
153 | 130 | link
|
|
159 | 136 | </el-button>
|
160 | 137 | <el-button
|
161 | 138 | link
|
| 139 | + class="!ml-5px" |
162 | 140 | type="primary"
|
163 | 141 | @click="handleDesign(scope.row)"
|
164 | 142 | v-hasPermi="['bpm:model:update']"
|
|
167 | 145 | </el-button>
|
168 | 146 | <el-button
|
169 | 147 | link
|
| 148 | + class="!ml-5px" |
170 | 149 | type="primary"
|
171 | 150 | @click="handleDeploy(scope.row)"
|
172 | 151 | v-hasPermi="['bpm:model:deploy']"
|
173 | 152 | >
|
174 | 153 | 发布
|
175 | 154 | </el-button>
|
176 |
| - <el-button |
177 |
| - link |
178 |
| - type="primary" |
179 |
| - v-hasPermi="['bpm:process-definition:query']" |
180 |
| - @click="handleDefinitionList(scope.row)" |
181 |
| - > |
182 |
| - 历史 |
183 |
| - </el-button> |
184 |
| - <el-button |
185 |
| - link |
186 |
| - type="danger" |
187 |
| - @click="handleDelete(scope.row.id)" |
188 |
| - v-hasPermi="['bpm:model:delete']" |
| 155 | + <el-dropdown |
| 156 | + class="!align-middle ml-5px" |
| 157 | + @command="(command) => handleCommand(command, scope.row)" |
| 158 | + v-hasPermi="['bpm:process-definition:query', 'bpm:model:update', 'bpm:model:delete']" |
189 | 159 | >
|
190 |
| - 删除 |
191 |
| - </el-button> |
| 160 | + <el-button type="primary" link>更多</el-button> |
| 161 | + <template #dropdown> |
| 162 | + <el-dropdown-menu> |
| 163 | + <el-dropdown-item |
| 164 | + command="handleDefinitionList" |
| 165 | + v-if="checkPermi(['bpm:process-definition:query'])" |
| 166 | + > |
| 167 | + 历史 |
| 168 | + </el-dropdown-item> |
| 169 | + <el-dropdown-item |
| 170 | + command="handleChangeState" |
| 171 | + v-if="checkPermi(['bpm:model:update'])" |
| 172 | + > |
| 173 | + {{ scope.row.processDefinition.suspensionState === 1 ? '停用' : '启用' }} |
| 174 | + </el-dropdown-item> |
| 175 | + <el-dropdown-item |
| 176 | + type="danger" |
| 177 | + command="handleDelete" |
| 178 | + v-if="checkPermi(['bpm:model:delete'])" |
| 179 | + > |
| 180 | + 删除 |
| 181 | + </el-dropdown-item> |
| 182 | + </el-dropdown-menu> |
| 183 | + </template> |
| 184 | + </el-dropdown> |
192 | 185 | </template>
|
193 | 186 | </el-table-column>
|
194 | 187 | </el-table>
|
|
208 | 201 | <Dialog title="表单详情" v-model="formDetailVisible" width="800">
|
209 | 202 | <form-create :rule="formDetailPreview.rule" :option="formDetailPreview.option" />
|
210 | 203 | </Dialog>
|
211 |
| - |
212 |
| - <!-- 弹窗:流程模型图的预览 --> |
213 |
| - <Dialog title="流程图" v-model="bpmnDetailVisible" width="800"> |
214 |
| - <MyProcessViewer |
215 |
| - key="designer" |
216 |
| - v-model="bpmnXML" |
217 |
| - :value="bpmnXML as any" |
218 |
| - v-bind="bpmnControlForm" |
219 |
| - :prefix="bpmnControlForm.prefix" |
220 |
| - /> |
221 |
| - </Dialog> |
222 | 204 | </template>
|
223 | 205 |
|
224 | 206 | <script lang="ts" setup>
|
225 |
| -import { dateFormatter, formatDate } from '@/utils/formatTime' |
226 |
| -import { MyProcessViewer } from '@/components/bpmnProcessDesigner/package' |
| 207 | +import { formatDate } from '@/utils/formatTime' |
227 | 208 | import * as ModelApi from '@/api/bpm/model'
|
228 | 209 | import * as FormApi from '@/api/bpm/form'
|
229 | 210 | import ModelForm from './ModelForm.vue'
|
230 | 211 | import { setConfAndFields2 } from '@/utils/formCreate'
|
231 | 212 | import { CategoryApi } from '@/api/bpm/category'
|
232 | 213 | import { BpmModelType } from '@/utils/constants'
|
| 214 | +import { checkPermi } from '@/utils/permission' |
233 | 215 |
|
234 | 216 | defineOptions({ name: 'BpmModel' })
|
235 | 217 |
|
@@ -274,42 +256,59 @@ const resetQuery = () => {
|
274 | 256 | handleQuery()
|
275 | 257 | }
|
276 | 258 |
|
| 259 | +/** '更多'操作按钮 */ |
| 260 | +const handleCommand = (command: string, row: any) => { |
| 261 | + switch (command) { |
| 262 | + case 'handleDefinitionList': |
| 263 | + handleDefinitionList(row) |
| 264 | + break |
| 265 | + case 'handleDelete': |
| 266 | + handleDelete(row) |
| 267 | + break |
| 268 | + case 'handleChangeState': |
| 269 | + handleChangeState(row) |
| 270 | + break |
| 271 | + default: |
| 272 | + break |
| 273 | + } |
| 274 | +} |
| 275 | +
|
277 | 276 | /** 添加/修改操作 */
|
278 | 277 | const formRef = ref()
|
279 | 278 | const openForm = (type: string, id?: number) => {
|
280 | 279 | formRef.value.open(type, id)
|
281 | 280 | }
|
282 | 281 |
|
283 | 282 | /** 删除按钮操作 */
|
284 |
| -const handleDelete = async (id: number) => { |
| 283 | +const handleDelete = async (row: any) => { |
285 | 284 | try {
|
286 | 285 | // 删除的二次确认
|
287 | 286 | await message.delConfirm()
|
288 | 287 | // 发起删除
|
289 |
| - await ModelApi.deleteModel(id) |
| 288 | + await ModelApi.deleteModel(row.id) |
290 | 289 | message.success(t('common.delSuccess'))
|
291 | 290 | // 刷新列表
|
292 | 291 | await getList()
|
293 | 292 | } catch {}
|
294 | 293 | }
|
295 | 294 |
|
296 | 295 | /** 更新状态操作 */
|
297 |
| -const handleChangeState = async (row) => { |
| 296 | +const handleChangeState = async (row: any) => { |
298 | 297 | const state = row.processDefinition.suspensionState
|
| 298 | + const newState = state === 1 ? 2 : 1 |
299 | 299 | try {
|
300 | 300 | // 修改状态的二次确认
|
301 | 301 | const id = row.id
|
302 |
| - const statusState = state === 1 ? '激活' : '挂起' |
| 302 | + debugger |
| 303 | + const statusState = state === 1 ? '停用' : '启用' |
303 | 304 | const content = '是否确认' + statusState + '流程名字为"' + row.name + '"的数据项?'
|
304 | 305 | await message.confirm(content)
|
305 | 306 | // 发起修改状态
|
306 |
| - await ModelApi.updateModelState(id, state) |
| 307 | + await ModelApi.updateModelState(id, newState) |
| 308 | + message.success(statusState + '成功') |
307 | 309 | // 刷新列表
|
308 | 310 | await getList()
|
309 |
| - } catch { |
310 |
| - // 取消后,进行恢复按钮 |
311 |
| - row.processDefinition.suspensionState = state === 1 ? 2 : 1 |
312 |
| - } |
| 311 | + } catch {} |
313 | 312 | }
|
314 | 313 |
|
315 | 314 | /** 设计流程 */
|
@@ -374,18 +373,6 @@ const handleFormDetail = async (row) => {
|
374 | 373 | }
|
375 | 374 | }
|
376 | 375 |
|
377 |
| -/** 流程图的详情按钮操作 */ |
378 |
| -const bpmnDetailVisible = ref(false) |
379 |
| -const bpmnXML = ref(null) |
380 |
| -const bpmnControlForm = ref({ |
381 |
| - prefix: 'flowable' |
382 |
| -}) |
383 |
| -const handleBpmnDetail = async (row) => { |
384 |
| - const data = await ModelApi.getModel(row.id) |
385 |
| - bpmnXML.value = data.bpmnXml || '' |
386 |
| - bpmnDetailVisible.value = true |
387 |
| -} |
388 |
| -
|
389 | 376 | /** 初始化 **/
|
390 | 377 | onMounted(async () => {
|
391 | 378 | await getList()
|
|
0 commit comments