| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550 |
- <template>
- <div class="container-fluid">
- <div class="form-inline">
- <div class="page-header">
- <h1>
- 工作流管理 <small>管理所有工作流</small>
- </h1>
- </div>
- <div class="form-inline">
- <div class="form-group">
- <label for="documentNo">文件编码</label>
- <input
- id="documentNo"
- v-model="documentNo"
- autocomplete="off"
- type="text"
- class="form-control"
- />
- </div>
- <div class="form-group">
- <label for="title">单据主题</label>
- <input
- id="title"
- v-model="title"
- autocomplete="off"
- type="text"
- class="form-control"
- />
- </div>
- <div class="form-group">
- <label for="content">审批摘要</label>
- <input
- id="content"
- v-model="content"
- autocomplete="off"
- type="text"
- class="form-control"
- />
- </div>
- <div class="form-group">
- <label for="status">单据状态</label>
- <select
- v-model="status"
- class="form-control"
- >
- <option value="Running">运行中</option>
- <option value="Suspended">已暂停</option>
- <option value="Finished">已完成</option>
- </select>
- </div>
- <div class="form-group">
- <label for="startAfter">开始时间</label>
- <input
- id="startAfter"
- v-model="startAfter"
- autocomplete="off"
- type="date"
- class="form-control"
- />
- </div>
- <div class="form-group">
- <label for="startBefore">~</label>
- <input
- id="startBefore"
- v-model="startBefore"
- autocomplete="off"
- type="date"
- class="form-control"
- />
- </div>
- <button
- class="btn btn-default"
- @click="requery"
- >
- 查询
- </button>
- </div>
- <table class="table table-bordered table-hover table-condensed">
- <thead>
- <tr>
- <th style="width: 60px;">
- 序号
- </th>
- <th style="width: 100px;">
- 文件编码
- </th>
- <th style="width: 100px;">
- 单据主题
- </th>
- <th>
- 审批摘要
- </th>
- <th style="width: 60px;">
- 状态
- </th>
- <th style="width: 100px;">
- 开始时间
- </th>
- <th style="width: 100px;">
- 结束时间
- </th>
- <th style="width: 100px;">
- 流程实例Id
- </th>
- <th style="width: 100px;">
- 操作
- </th>
- </tr>
- </thead>
- <tbody>
- <template v-for="(data, index) in datas" :key="data.processInstanceId">
- <tr>
- <td>
- {{ index + ((pagination.current_page - 1) * (pagination.per_page)) + 1 }}
- </td>
- <td>
- {{ data.documentNo }}
- </td>
- <td>
- {{ data.title }}
- </td>
- <td>
- <span
- v-if="data.content != null && data.content != 'null'"
- style="white-space: pre-line"
- >{{ data.content }}</span>
- </td>
- <td>
- {{ data.status === 'Running' ? '运行中' : (data.status === 'Suspended' ? '暂停' : (data.status === 'Finished' ? '已完成' : (''))) }}
- </td>
- <td>
- {{ data.startTime }}
- </td>
- <td>
- {{ data.endTime }}
- </td>
- <td>
- {{ data.processInstanceId }}
- </td>
- <td>
- <button
- v-if="data.status === 'Running'"
- class="td-button"
- @click="changeProcessInstance(data, 'suspend', null)"
- >
- 暂停
- </button>
- <button
- v-if="data.status === 'Suspended'"
- class="td-button"
- @click="changeProcessInstance(data, 'activate', null)"
- >
- 激活
- </button>
- <button
- v-if="data.status === 'Running'"
- class="td-button"
- @click="deleteProcessInstance(data, 'delete', null)"
- >
- 删除
- </button>
- <button
- class="td-button"
- @click="listTaskInfo(data)"
- >
- 查看任务
- </button>
- </td>
- </tr>
- <template v-if="data.taskDocInfos != null && data.taskDocInfos.length > 0">
- <tr
- :key="'tasks-title' + data.processInstanceId"
- class="info"
- >
- <td colspan="9">进行中的任务</td>
- </tr>
- <tr
- :key="'tasks' + data.processInstanceId"
- class="info"
- >
- <td
- colspan="9"
- style="padding:0px;"
- >
- <table class="table table-bordered table-hover table-condensed inner-table">
- <thead>
- <tr class="warning">
- <th style="width: 60px;">
- 序号
- </th>
- <th style="width: 200px;">
- 任务名称
- </th>
- <th style="width: 100px;">
- 审批人
- </th>
- <th style="width: 100px;">
- 发起日期
- </th>
- <th>
- 评论信息
- </th>
- </tr>
- </thead>
- <tbody>
- <template v-for="(taskDocInfo, index1) in data.taskDocInfos" :key="taskDocInfo.id">
- <tr
-
- class="warning"
- >
- <td>
- {{ index1 }}
- </td>
- <td>
- {{ taskDocInfo.name }}
- </td>
- <td>
- {{ taskDocInfo.assigneeName }}
- </td>
- <td>
- {{ taskDocInfo.createTime }}
- </td>
- <td>
- {{ taskDocInfo.comments }}
- </td>
- </tr>
- </template>
- </tbody>
- </table>
- </td>
- </tr>
- </template>
- <template v-if="data.historicTaskDocInfos != null && data.historicTaskDocInfos.length > 0">
- <tr
- :key="'historicTasks-title' + data.processInstanceId"
- class="success"
- >
- <td colspan="9">已完成的任务</td>
- </tr>
- <tr
- :key="'historicTasks' + data.processInstanceId"
- class="success"
- >
- <td
- colspan="9"
- style="padding:0px;"
- >
- <table class="table table-bordered table-hover table-condensed inner-table">
- <thead>
- <tr class="warning">
- <th style="width: 60px;">
- 序号
- </th>
- <th style="width: 200px;">
- 任务名称
- </th>
- <th style="width: 100px;">
- 审批人
- </th>
- <th style="width: 100px;">
- 发起日期
- </th>
- <th style="width: 100px;">
- 完成日期
- </th>
- <th>
- 评论信息
- </th>
- </tr>
- </thead>
- <tbody>
- <template v-for="(historicTaskDocInfo, index2) in data.historicTaskDocInfos" :key="historicTaskDocInfo.id">
- <tr
-
- class="warning"
- >
- <td>
- {{ index2 }}
- </td>
- <td>
- {{ historicTaskDocInfo.name }}
- </td>
- <td>
- {{ historicTaskDocInfo.assigneeName }}
- </td>
- <td>
- {{ historicTaskDocInfo.createTime }}
- </td>
- <td>
- {{ historicTaskDocInfo.endTime }}
- </td>
- <td>
- {{ historicTaskDocInfo.comments }}
- </td>
- </tr>
- </template>
- </tbody>
- </table>
- </td>
- </tr>
- </template>
- </template>
- </tbody>
- </table>
- </div>
- <VueBootstrapPagination
- :pagination="pagination"
- :callback="listProcessInstanceDoc"
- />
- </div>
- </template>
- <script>
- import Common from '../common/Common.js';
- export default {
- components: {
-
- },
- data: function () {
- return {
- 'documentNo': null,
- 'title': null,
- 'content': null,
- 'status': 'Running',
- 'startAfter': null,
- 'startBefore': null,
- 'datas': [],
- 'pagination': {
- total: 0,
- per_page: 20, // required
- current_page: 1, // required
- last_page: 0, // required
- },
- };
- },
- mounted: function () {
- this.listProcessInstanceDoc();
- },
- methods: {
- /**
- * 重新查询
- */
- requery: function () {
- this.pagination.total = 0;
- this.pagination.per_page = 20;
- this.pagination.current_page = 1;
- this.pagination.last_page = 0;
- this.listProcessInstanceDoc();
- },
- /**
- * 查询所有的单据流程实例
- */
- listProcessInstanceDoc: function () {
- let _self = this;
- let processInstanceDocRequest = {
- 'documentNo': this.documentNo,
- 'title': this.title,
- 'content': this.content,
- 'status': this.status,
- 'startAfter': this.startAfter,
- 'startBefore': this.startBefore,
- 'start': (this.pagination.current_page - 1) * this.pagination.per_page,
- 'length': this.pagination.per_page,
- };
- $.ajax({
- url: Common.getApiURL('DocManagmentResource/query'),
- type: 'POST',
- contentType: 'application/json',
- dataType: 'json',
- data: JSON.stringify(processInstanceDocRequest),
- beforeSend: function (request) {
- Common.addTokenToRequest(request);
- },
- success: function (data) {
- data.datas.forEach(item => {
- try {
- var content = JSON.parse(item.content);
- var parentForm = '';
- if (content != null && content.parentForm != null) {
- content.parentForm.forEach(item => {
- parentForm = parentForm + item.title + ':' + item.content + '\n';
- });
- item.content = parentForm;
- }
- } catch (error) {
- console.error(error);
- } finally{
- item.taskDocInfos = [];
- item.historicTaskDocInfos = [];
- }
- });
- _self.datas = data.datas;
- _self.pagination.total = data.total;
- _self.pagination.last_page = Math.ceil(data.total / _self.pagination.per_page);
- },
- error: function (XMLHttpRequest, textStatus, errorThrown) {
- Common.processException(XMLHttpRequest, textStatus, errorThrown);
- },
- });
- },
- /**
- * 查询流程实例的任务信息
- */
- listTaskInfo(processInstanceInfo) {
- $.ajax({
- url: Common.getApiURL('DocManagmentResource/listTasks'),
- type: 'GET',
- dataType: 'json',
- data: {
- processInstanceId: processInstanceInfo.processInstanceId,
- },
- beforeSend: function (request) {
- Common.addTokenToRequest(request);
- },
- success: function (datas) {
- processInstanceInfo.taskDocInfos = datas;
- },
- error: function (XMLHttpRequest, textStatus, errorThrown) {
- Common.processException(XMLHttpRequest, textStatus, errorThrown);
- },
- });
- $.ajax({
- url: Common.getApiURL('DocManagmentResource/listHistoricTasks'),
- type: 'GET',
- dataType: 'json',
- data: {
- processInstanceId: processInstanceInfo.processInstanceId,
- },
- beforeSend: function (request) {
- Common.addTokenToRequest(request);
- },
- success: function (datas) {
- processInstanceInfo.historicTaskDocInfos = datas;
- },
- error: function (XMLHttpRequest, textStatus, errorThrown) {
- Common.processException(XMLHttpRequest, textStatus, errorThrown);
- },
- });
- },
- /**
- * 删除流程实例
- */
- deleteProcessInstance(processInstanceInfo, changeType, reason) {
- let _self = this;
- BootstrapDialog.show({
- title: '确认',
- message: '删除流程实例是不可恢复的操作,您确认要删除流程实例吗?',
- buttons: [{
- label: '确认',
- action: function (dialogItself) {
- _self.changeProcessInstance(processInstanceInfo, changeType, reason);
- dialogItself.close();
- },
- },
- {
- label: '取消',
- action: function (dialogItself) {
- dialogItself.close();
- },
- }],
- });
- },
- /**
- * 修改流程实例的状态
- */
- changeProcessInstance(processInstanceInfo, changeType, reason) {
- let _self = this;
- $.ajax({
- url: Common.getApiURL('DocManagmentResource/changeProcessInstance'),
- type: 'GET',
- dataType: 'json',
- data: {
- processInstanceId: processInstanceInfo.processInstanceId,
- changeType: changeType,
- reason: reason,
- },
- beforeSend: function (request) {
- Common.addTokenToRequest(request);
- },
- success: function (datas) {
- _self.listProcessInstanceDoc();
- },
- error: function (XMLHttpRequest, textStatus, errorThrown) {
- Common.processException(XMLHttpRequest, textStatus, errorThrown);
- },
- });
- },
- },
- };
- </script>
- <style scoped>
- label {
- width: 80px;
- text-align: left;
- padding-left: 10px;
- }
- button {
- margin-bottom: 5px;
- }
- input,
- select {
- width: 200px !important;
- }
- .form-group {
- margin-bottom: 5px;
- }
- table tr {
- height: 40px;
- }
- .td-button {
- width: 100px;
- }
- .inner-table {
- margin-bottom: 0px;
- }
- </style>
|