审查视图

src/views/technological/example.vue 26.7 KB
小范 authored
1 2 3 4
<template>
    <el-container>
        <el-main>
            <el-row>
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
                <el-tabs type="border-card" @tab-click="handleClick">
                    <el-tab-pane label="执行中">
                        <!--检索条件-->
                        <el-row class="toolbar" style="background-color: white;margin-bottom: 10px">
                            <el-col :span="6">
                                <el-input v-model="queryinfo.processInstanceId " placeholder="实例ID" style="width: 200px" clearable>
                                    <template slot="prepend">实例ID</template>
                                </el-input>
                            </el-col>
                            <el-col :span="7">
                                <el-input v-model="queryinfo.processDefinitionKey" placeholder="实例关键字" style="width: 220px" clearable>
                                    <template slot="prepend">实例关键字</template>
                                </el-input>
                            </el-col>
                            <el-col :span="8">
                                <el-button type="primary" v-on:click="getList">查询</el-button>
                            </el-col>
                        </el-row>
                        <el-row>
                            <el-table
                                    v-loading="tableloading"
                                    :data="tableData"
                                    style="width: 100%"
                                    :default-sort = "{prop: 'date', order: 'descending'}"
                                    :header-cell-style="{background:'#6F8294',color:'#FFFFFF'}" size="small">
                                <el-table-column type="expand">
                                    <template slot-scope="props">
                                        <el-form label-position="right" label-width="120px" style="text-align: left">
                                            <el-row>
                                                <el-form-item label="id:">
                                                    <span>{{ props.row.id}}</span>
                                                </el-form-item>
                                            </el-row>
                                            <el-row>
                                                <el-form-item label="执行人id:">
                                                    <span>{{ props.row.deploymentId}}</span>
                                                </el-form-item>
                                            </el-row>
                                            <el-row>
                                                <el-form-item label="变量数量:">
                                                    <span>{{ props.row.variableCount}}</span>
                                                </el-form-item>
                                            </el-row>
                                            <el-row>
                                                <el-form-item label="瞬时变量:">
                                                    <span>{{ JSON.stringify(props.row.transientVariables)}}</span>
                                                </el-form-item>
                                            </el-row>
                                            <el-row>
                                                <el-form-item label="流程定义ID:">
                                                    <span>{{ props.row.processDefinitionId}}</span>
                                                </el-form-item>
                                            </el-row>
                                            <el-row>
                                                <el-form-item label="流程实例ID:">
                                                    <span>{{ props.row.processInstanceId}}</span>
                                                </el-form-item>
                                            </el-row>
                                            <el-row>
                                                <el-form-item label="流程定义版本:">
                                                    <span>{{ props.row.processDefinitionVersion}}</span>
                                                </el-form-item>
                                            </el-row>
                                        </el-form>
                                    </template>
                                </el-table-column>
                                <el-table-column
                                        fixed="left"
                                        label="操作">
                                    <template slot-scope="scope">
                                        <el-button type="success" size="mini" @click="chart(scope.$index,scope.row)">流程图</el-button>
76
                                        <el-button type="warning" size="mini" @click="jobsCancel(scope.$index,scope.row)">停&nbsp;&nbsp;止</el-button>
77 78 79 80 81 82 83 84 85 86
                                        <!--                            <el-button type="warning" size="mini" @click="remove(scope.$index,scope.row)">删除</el-button>-->
                                        <!--                            <el-button type="danger" size="mini" @click="removeDel(scope.$index,scope.row)">彻底删除</el-button>-->
                                    </template>
                                </el-table-column>
                                <el-table-column
                                        label="实例名称"
                                        prop="name"
                                        width="160">
                                </el-table-column>
                                <el-table-column
小范 authored
87 88 89
                                        label="发起人"
                                        prop="startUserId"
                                        width="100">
90 91
                                </el-table-column>
                                <el-table-column
小范 authored
92 93
                                        label="开始时间"
                                        prop="startTime"
94 95
                                        width="160">
                                </el-table-column>
小范 authored
96 97 98 99 100
<!--                                <el-table-column-->
<!--                                        label="结束时间"-->
<!--                                        prop="endTime"-->
<!--                                        width="160">-->
<!--                                </el-table-column>-->
101 102 103
                                <el-table-column
                                        label="执行中"
                                        prop="isActive">
小范 authored
104 105 106 107
                                    <template slot-scope="scope">
                                        <span  v-if="scope.row.isActive ===true">是</span>
                                        <span  v-else>否</span>
                                    </template>
108 109 110 111
                                </el-table-column>
                                <el-table-column
                                        label="是否结束"
                                        prop="isEnded">
小范 authored
112 113 114 115
                                    <template slot-scope="scope">
                                        <span  v-if="scope.row.isEnded ===true">是</span>
                                        <span  v-else>否</span>
                                    </template>
116 117 118 119 120 121 122 123 124 125 126 127 128
                                </el-table-column>
                                <el-table-column
                                        label="流程状态"
                                        prop="suspensionState">
                                    <template slot-scope="scope">
                                        <span  v-if="scope.row.suspensionState ===1">活跃</span>
                                        <span  v-else>中断</span>
                                    </template>
                                </el-table-column>
                                <el-table-column
                                        label="实例关键字"
                                        prop="processDefinitionKey">
                                </el-table-column>
小范 authored
129 130 131 132 133 134 135 136 137
<!--                                <el-table-column-->
<!--                                        label="用时"-->
<!--                                        prop="durationInMillis">-->
<!--                                    <template slot-scope="scope">-->
<!--                                       <span>-->
<!--                                        {{ scope.row.durationInMillis | formatSeconds }}-->
<!--                                    </span>-->
<!--                                    </template>-->
<!--                                </el-table-column>-->
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 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245
                                <el-table-column
                                        label="流程定义名称"
                                        prop="processDefinitionName"
                                        width="140">
                                </el-table-column>
                                <el-table-column
                                        label="isDeleted"
                                        prop="isDeleted">
                                </el-table-column>
                            </el-table>
                        </el-row>
                        <!--分页模块-->
                        <el-row style="float: right;margin-top: 20px">
                            <el-col>
                                <div class="block">
                                    <el-pagination
                                            @size-change="handleSizeChange"
                                            @current-change="handleCurrentChange"
                                            :current-page="queryinfo.pageNum"
                                            :page-sizes="[10, 20, 30, 40]"
                                            :page-size="queryinfo.pageSize"
                                            layout="total, sizes, prev, pager, next, jumper"
                                            :total="total">
                                    </el-pagination>
                                </div>
                            </el-col>
                        </el-row>
                    </el-tab-pane>
                    <el-tab-pane label="已完成">
                        <!--检索条件-->
                        <el-row class="toolbar" style="background-color: white;margin-bottom: 10px">
                            <el-col :span="6">
                                <el-input v-model="queryinfo.processInstanceId " placeholder="实例ID" style="width: 200px" clearable>
                                    <template slot="prepend">实例ID</template>
                                </el-input>
                            </el-col>
                            <el-col :span="7">
                                <el-input v-model="queryinfo.processDefinitionKey" placeholder="实例关键字" style="width: 220px" clearable>
                                    <template slot="prepend">实例关键字</template>
                                </el-input>
                            </el-col>
                            <el-col :span="8">
                                <el-button type="primary" v-on:click="getHistroyList">查询</el-button>
                            </el-col>
                        </el-row>
                        <el-row>
                            <el-table
                                    v-loading="tableloading"
                                    :data="tableData"
                                    style="width: 100%"
                                    :default-sort = "{prop: 'date', order: 'descending'}"
                                    :header-cell-style="{background:'#6F8294',color:'#FFFFFF'}" size="small">
                                <el-table-column type="expand">
                                    <template slot-scope="props">
                                        <el-form label-position="right" label-width="120px" style="text-align: left">
                                            <el-row>
                                                <el-form-item label="id:">
                                                    <span>{{ props.row.id}}</span>
                                                </el-form-item>
                                            </el-row>
                                            <el-row>
                                                <el-form-item label="执行人id:">
                                                    <span>{{ props.row.deploymentId}}</span>
                                                </el-form-item>
                                            </el-row>
                                            <el-row>
                                                <el-form-item label="变量数量:">
                                                    <span>{{ props.row.variableCount}}</span>
                                                </el-form-item>
                                            </el-row>
                                            <el-row>
                                                <el-form-item label="瞬时变量:">
                                                    <span>{{ JSON.stringify(props.row.transientVariables)}}</span>
                                                </el-form-item>
                                            </el-row>
                                            <el-row>
                                                <el-form-item label="流程定义ID:">
                                                    <span>{{ props.row.processDefinitionId}}</span>
                                                </el-form-item>
                                            </el-row>
                                            <el-row>
                                                <el-form-item label="流程实例ID:">
                                                    <span>{{ props.row.processInstanceId}}</span>
                                                </el-form-item>
                                            </el-row>
                                            <el-row>
                                                <el-form-item label="流程定义版本:">
                                                    <span>{{ props.row.processDefinitionVersion}}</span>
                                                </el-form-item>
                                            </el-row>
                                        </el-form>
                                    </template>
                                </el-table-column>
                                <el-table-column
                                        fixed="left"
                                        label="操作">
                                    <template slot-scope="scope">
                                        <el-button type="success" size="mini" @click="chart(scope.$index,scope.row)">流程图</el-button>
                                        <!--                            <el-button type="warning" size="mini" @click="remove(scope.$index,scope.row)">删除</el-button>-->
                                        <!--                            <el-button type="danger" size="mini" @click="removeDel(scope.$index,scope.row)">彻底删除</el-button>-->
                                    </template>
                                </el-table-column>
                                <el-table-column
                                        label="实例名称"
                                        prop="name"
                                        width="160">
                                </el-table-column>
                                <el-table-column
小范 authored
246 247 248 249 250
                                        label="发起人"
                                        prop="startUserId"
                                        width="100">
                                </el-table-column>
                                <el-table-column
251 252 253 254 255 256 257 258 259 260 261 262
                                        label="开始时间"
                                        prop="startTime"
                                        width="160">
                                </el-table-column>
                                <el-table-column
                                        label="结束时间"
                                        prop="endTime"
                                        width="160">
                                </el-table-column>
                                <el-table-column
                                        label="执行中"
                                        prop="isActive">
小范 authored
263 264 265 266
                                    <template slot-scope="scope">
                                        <span  v-if="scope.row.isActive ===true">是</span>
                                        <span  v-else>否</span>
                                    </template>
267 268 269 270
                                </el-table-column>
                                <el-table-column
                                        label="是否结束"
                                        prop="isEnded">
小范 authored
271 272 273 274
                                    <template slot-scope="scope">
                                        <span  v-if="scope.row.isEnded ===true">是</span>
                                        <span  v-else>否</span>
                                    </template>
275 276 277 278 279 280 281 282 283 284 285 286 287 288 289
                                </el-table-column>
                                <el-table-column
                                        label="流程状态"
                                        prop="suspensionState">
                                    <template slot-scope="scope">
                                        <span  v-if="scope.row.suspensionState ===1">活跃</span>
                                        <span  v-else>中断</span>
                                    </template>
                                </el-table-column>
                                <el-table-column
                                        label="实例关键字"
                                        prop="processDefinitionKey">
                                </el-table-column>
                                <el-table-column
                                        prop="durationInMillis"
小范 authored
290 291
                                        label="用时"
                                        width="140">
292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327
                                    <template slot-scope="scope">
                                       <span>
                                        {{ scope.row.durationInMillis | formatSeconds }}
                                    </span>
                                    </template>
                                </el-table-column>
                                <el-table-column
                                        label="流程定义名称"
                                        prop="processDefinitionName"
                                        width="140">
                                </el-table-column>
                                <el-table-column
                                        label="isDeleted"
                                        prop="isDeleted">
                                </el-table-column>
                            </el-table>
                        </el-row>
                        <!--分页模块-->
                        <el-row style="float: right;margin-top: 20px">
                            <el-col>
                                <div class="block">
                                    <el-pagination
                                            @size-change="handleSizeChange"
                                            @current-change="handleCurrentChange"
                                            :current-page="queryinfo.pageNum"
                                            :page-sizes="[10, 20, 30, 40]"
                                            :page-size="queryinfo.pageSize"
                                            layout="total, sizes, prev, pager, next, jumper"
                                            :total="total">
                                    </el-pagination>
                                </div>
                            </el-col>
                        </el-row>
                    </el-tab-pane>

                </el-tabs>
小范 authored
328
            </el-row>
329 330
<!--            流程图弹框-->
            <el-row>
小范 authored
331
                <el-dialog title="流程图" :visible.sync="dialogFormVisible" v-loading="dialogloading">
332 333 334 335 336 337 338 339 340 341 342 343 344 345 346
                    <el-form :model="form">
                        <el-form-item>
                            <div class="demo-image__preview">
                                <el-image

                                        :src="form.url">
                                </el-image>
                            </div>
                        </el-form-item>
                    </el-form>
                    <div slot="footer" class="dialog-footer">
                        <el-button @click="dialogFormVisible = false">取 消</el-button>
                    </div>
                </el-dialog>
            </el-row>
小范 authored
347 348 349 350 351
        </el-main>
    </el-container>
</template>

<script>
352
    import {instanceList,processDiagram,histroyList,jobsCancelApi} from "../../api/technological";
小范 authored
353 354 355 356 357 358 359 360 361 362 363 364 365 366

    export default {
        name: "example",
        data(){
            return{
                queryinfo: {
                    processInstanceId:'',
                    processDefinitionKey:'',
                    pageNum:1,
                    pageSize:10,
                },
                total:0,
                tableData: [],
                tableloading:false,
小范 authored
367
                dialogloading:false,
368 369 370 371
                dialogFormVisible: false,
                form: {
                    url: ''
                }
小范 authored
372 373
            }
        },
374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410
        filters: {
            formatSeconds(value) {
                console.log(value)
                let result = parseInt(value);

                let y =
                    Math.floor(result / 86400000) < 10
                        ? "0" + Math.floor(result / 86400000)
                        : Math.floor(result / 86400000);

                let h =
                    Math.floor((result / 3600000) % 24) < 10
                        ? "0" + Math.floor((result / 3600000) % 24)
                        : Math.floor((result / 3600000) % 24);

                let m =
                    Math.floor((result / 60000) % 60) < 10
                        ? "0" + Math.floor((result / 60000) % 60)
                        : Math.floor((result / 60000) % 60);

                let s =
                    Math.floor(result % 60) < 10
                        ? "0" + Math.floor(result % 60)
                        : Math.floor(result % 60);

                let res = "";
                if (y !== "00") res += `${y}天`;

                if (h !== "00") res += `${h}时`;

                if (m !== "00") res += `${m}分`;

                res += `${s}秒`;

                return res;
            },
        },
小范 authored
411 412 413 414
        mounted() {
            this.getList();
        },
        methods: {
415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431
            jobsCancel(index,row){
                let _this = this
                let para = {
                    processInstanceId: row.processInstanceId,
                    reason: "工单作废"
                }
                jobsCancelApi(para).then(response =>{
                    const res = response.data
                    if (res.code != '200') {
                        return _this.$message.error('作废失败!')
                    }
                    _this.$message.success('作废成功!')
                }).catch(error => {
                    // 关闭加载
                    _this.$message.error(error.toString())
                })
            },
432 433 434 435 436 437 438
            handleClick(tab){
                if (tab.index == 0) {
                    this.getList();
                } else {
                    this.getHistroyList();
                }
            },
小范 authored
439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468
// 分页
            handleSizeChange(val) {
                this.queryinfo.pageSize= val
                this.getList()
            },
            handleCurrentChange(val) {
                this.queryinfo.pageNum  = val
                this.getList()
            },
            getList() {
                const _this = this
                this.tableloading = true;
                instanceList(this.queryinfo).then((response) => {
                    console.log(response);
                    const res = response.data
                    if (res.code != '200') {
                        return _this.$message.error('获取消息收发记录,失败!')
                    }
                    // 获取列表数据
                    _this.tableData = res.data;
                    // 获取列表的总记录数
                    _this.total = res.total
                    this.tableloading = false;
                    _this.$message.success('获取消息收发记录,成功!')
                }).catch(error => {
                    // 关闭加载
                    _this.$message.error(error.toString())
                    this.tableloading = false;
                })
            },
469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492
            getHistroyList() {
                const _this = this
                this.tableloading = true;
                histroyList(this.queryinfo).then((response) => {
                    console.log(response);
                    const res = response.data
                    if (res.code != '200') {
                        return _this.$message.error('获取消息收发记录,失败!')
                    }
                    // 获取列表数据
                    _this.tableData = res.data;
                    // 获取列表的总记录数

                    _this.total = res.total
                    this.tableloading = false;
                    _this.$message.success('获取消息收发记录,成功!')
                }).catch(error => {

                    // 关闭加载
                    _this.$message.error(error.toString())
                    this.tableloading = false;

                })
            },
493 494 495
            // 打开流程图
            chart(index, row) {
                this.dialogFormVisible = true
小范 authored
496
                this.dialogloading = true;
497 498 499
                processDiagram({processId:row.processInstanceId}).then(res =>{
                    // eslint-disable-next-line no-console
                        this.form.url=window.URL.createObjectURL(res.data);
小范 authored
500 501
                    this.dialogloading = false;
                });
502
            },
503 504
        },
小范 authored
505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521
    }
</script>

<style scoped>
    .demo-table-expand {
        font-size: 0;
    }
    .demo-table-expand label {
        width: 90px;
        color: #99a9bf;
    }
    .demo-table-expand .el-form-item {
        margin-right: 0;
        margin-bottom: 0;
        width: 50%;
    }
</style>