todo.vue 6.63 KB
Newer Older
sunhongwei's avatar
sunhongwei committed
1 2 3 4
<template>
  <div class="app-container">
    <!-- 搜索工作栏 -->
    <el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="68px">
dragondean@qq.com's avatar
dragondean@qq.com committed
5
      <el-form-item :label="$t('流程编号')" prop="processInstanceId">
chenjiuping's avatar
chenjiuping committed
6 7 8
        <el-input v-model="queryParams.processInstanceId" :placeholder="$t('流程编号')" clearable
                  @keyup.enter.native="handleQuery"/>
      </el-form-item>
dragondean@qq.com's avatar
dragondean@qq.com committed
9
      <el-form-item :label="$t('流程名称')" prop="name">
chenjiuping's avatar
chenjiuping committed
10
        <el-input v-model="queryParams.name" :placeholder="$t('任务名称')" clearable @keyup.enter.native="handleQuery"/>
sunhongwei's avatar
sunhongwei committed
11
      </el-form-item>
dragondean@qq.com's avatar
dragondean@qq.com committed
12 13
      <el-form-item :label="$t('流程分类')" prop="category">
        <el-select v-model="queryParams.category" :placeholder="$t('请选择流程分类')" clearable>
chenjiuping's avatar
chenjiuping committed
14
          <el-option v-for="dict in this.getDictDatas(DICT_TYPE.BPM_MODEL_CATEGORY)"
dragondean@qq.com's avatar
dragondean@qq.com committed
15
                     :key="dict.value" :label="$l(dict, 'label')" :value="dict.value"/>
chenjiuping's avatar
chenjiuping committed
16 17
        </el-select>
      </el-form-item>
dragondean@qq.com's avatar
dragondean@qq.com committed
18
      <el-form-item :label="$t('提交时间')">
sunhongwei's avatar
sunhongwei committed
19
        <el-date-picker v-model="dateRangeCreateTime" style="width: 240px" value-format="yyyy-MM-dd"
chenjiuping's avatar
chenjiuping committed
20 21
                        type="daterange" range-separator="-" :start-placeholder="$t('开始日期')"
                        :end-placeholder="$t('结束日期')"/>
dragondean@qq.com's avatar
dragondean@qq.com committed
22
      </el-form-item>
dragondean@qq.com's avatar
dragondean@qq.com committed
23 24 25 26
      <el-form-item :label="$t('业务编号')" prop="businessNo">
        <el-input v-model="queryParams.businessNo" :placeholder="$t('请输入业务编号')" clearable
                  @keyup.enter.native="handleQuery"/>
      </el-form-item>
27

sunhongwei's avatar
sunhongwei committed
28
      <el-form-item>
chenjiuping's avatar
chenjiuping committed
29 30
        <el-button type="primary" icon="el-icon-search" @click="handleQuery">{{ $t('搜索') }}</el-button>
        <el-button icon="el-icon-refresh" @click="resetQuery">{{ $t('重置') }}</el-button>
sunhongwei's avatar
sunhongwei committed
31 32 33 34 35
      </el-form-item>
    </el-form>

    <!-- 列表 -->
    <el-table v-loading="loading" :data="list">
36
      <el-table-column :label="$t('流程编号')" align="center" prop="processInstance.id" width="320"/>
dragondean@qq.com's avatar
dragondean@qq.com committed
37 38
      <el-table-column :label="$t('流程名称')" align="center" prop="processInstance.name" width="320"/>
      
dragondean@qq.com's avatar
dragondean@qq.com committed
39
      <el-table-column :label="$t('流程分类')" align="center" prop="category">
chenjiuping's avatar
chenjiuping committed
40 41 42 43
        <template slot-scope="scope">
          <dict-tag :type="DICT_TYPE.BPM_MODEL_CATEGORY" :value="scope.row.category"/>
        </template>
      </el-table-column>
dragondean@qq.com's avatar
dragondean@qq.com committed
44
      <el-table-column :label="$t('业务编号')" align="center" prop="businessNo"/>
45 46

      <el-table-column :label="$t('当前审批节点')" align="center" prop="name"/>
dragondean@qq.com's avatar
dragondean@qq.com committed
47
      <!-- <el-table-column :label="$t('状态')" align="center" prop="version" width="80">
48
        <template slot-scope="scope">
chenjiuping's avatar
chenjiuping committed
49 50
          <el-tag type="success" v-if="scope.row.suspensionState === 1">{{ $t('激活') }}</el-tag>
          <el-tag type="warning" v-if="scope.row.suspensionState === 2">{{ $t('挂起') }}</el-tag>
51
        </template>
dragondean@qq.com's avatar
dragondean@qq.com committed
52
      </el-table-column> -->
53

dragondean@qq.com's avatar
dragondean@qq.com committed
54
      <!-- <el-table-column :label="$t('结果')" align="center" prop="result">
chenjiuping's avatar
chenjiuping committed
55 56 57
        <template slot-scope="scope">
          <dict-tag :type="DICT_TYPE.BPM_PROCESS_INSTANCE_RESULT" :value="scope.row.result"/>
        </template>
dragondean@qq.com's avatar
dragondean@qq.com committed
58
      </el-table-column> -->
59
      <el-table-column :label="$t('提交时间')" align="center" prop="createTime" width="180">
sunhongwei's avatar
sunhongwei committed
60 61 62 63
        <template slot-scope="scope">
          <span>{{ parseTime(scope.row.createTime) }}</span>
        </template>
      </el-table-column>
dragondean@qq.com's avatar
dragondean@qq.com committed
64
      <!-- <el-table-column :label="$t('结束时间')" align="center" prop="createTime" width="180">
sunhongwei's avatar
sunhongwei committed
65
        <template slot-scope="scope">
chenjiuping's avatar
chenjiuping committed
66
          <span>{{ parseTime(scope.row.endTime) }}</span>
sunhongwei's avatar
sunhongwei committed
67
        </template>
dragondean@qq.com's avatar
dragondean@qq.com committed
68
      </el-table-column> -->
69
      <el-table-column :label="$t('操作')" align="center" fixed="right" class-name="small-padding fixed-width">
sunhongwei's avatar
sunhongwei committed
70
        <template slot-scope="scope">
dragondean@qq.com's avatar
dragondean@qq.com committed
71 72 73 74 75 76
          <!-- <el-button size="mini" type="text" icon="el-icon-edit" @click="handleCancel(scope.row)"
                     v-hasPermi="['bpm:task:update']">{{ $t('取消') }}
          </el-button> -->
          <el-button size="mini" type="text" icon="el-icon-edit" @click="handleAudit(scope.row)"
                     v-hasPermi="['bpm:task:update']">{{ $t('详情') }}
          </el-button>
sunhongwei's avatar
sunhongwei committed
77
          <el-button size="mini" type="text" icon="el-icon-edit" @click="handleAudit(scope.row)"
chenjiuping's avatar
chenjiuping committed
78
                     v-hasPermi="['bpm:task:update']">{{ $t('审批') }}
chenjiuping's avatar
chenjiuping committed
79
          </el-button>
dragondean@qq.com's avatar
dragondean@qq.com committed
80

sunhongwei's avatar
sunhongwei committed
81 82 83 84 85 86 87 88 89 90 91 92
        </template>
      </el-table-column>
    </el-table>
    <!-- 分页组件 -->
    <pagination v-show="total > 0" :total="total" :page.sync="queryParams.pageNo" :limit.sync="queryParams.pageSize"
                @pagination="getList"/>

  </div>
</template>

<script>
import {getTodoTaskPage} from '@/api/bpm/task'
dragondean@qq.com's avatar
dragondean@qq.com committed
93
import { cancelProcessInstance } from "@/api/bpm/processInstance";
sunhongwei's avatar
sunhongwei committed
94 95
export default {
  name: "Todo",
chenjiuping's avatar
chenjiuping committed
96
  components: {},
sunhongwei's avatar
sunhongwei committed
97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112
  data() {
    return {
      // 遮罩层
      loading: true,
      // 显示搜索条件
      showSearch: true,
      // 总条数
      total: 0,
      // 待办任务列表
      list: [],
      // 查询参数
      dateRangeCreateTime: [],
      queryParams: {
        pageNo: 1,
        pageSize: 10,
        name: null,
chenjiuping's avatar
chenjiuping committed
113 114
        businessNo: null,
        category: null,
sunhongwei's avatar
sunhongwei committed
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
      },
    };
  },
  created() {
    this.getList();
  },
  methods: {
    /** 查询列表 */
    getList() {
      this.loading = true;
      // 处理查询参数
      let params = {...this.queryParams};
      this.addBeginAndEndTime(params, this.dateRangeCreateTime, 'createTime');
      getTodoTaskPage(params).then(response => {
        this.list = response.data.list;
        this.total = response.data.total;
        this.loading = false;
      });
    },
    /** 搜索按钮操作 */
    handleQuery() {
      this.queryParams.pageNo = 1;
      this.getList();
    },
    /** 重置按钮操作 */
    resetQuery() {
      this.dateRangeCreateTime = [];
      this.resetForm("queryForm");
      this.handleQuery();
    },
    /** 处理审批按钮 */
    handleAudit(row) {
chenjiuping's avatar
chenjiuping committed
147
      this.$router.push({path: "/bpm/process-instance/detail", query: {id: row.processInstance.id}});
sunhongwei's avatar
sunhongwei committed
148
    },
dragondean@qq.com's avatar
dragondean@qq.com committed
149 150 151 152 153 154 155 156 157 158 159 160 161 162 163
    handleCancel(row) {
      const id = row.id;
      this.$prompt(this.$t('请输入取消原因?'), this.$t("取消流程"), {
        type: 'warning',
        confirmButtonText: this.$t("确定"),
        cancelButtonText: this.$t("取消"),
        inputPattern: /^[\s\S]*.*[^\s][\s\S]*$/, // 判断非空,且非空格
        inputErrorMessage: this.$t("取消原因不能为空"),
      }).then(({ value }) => {
        return cancelProcessInstance(id, value);
      }).then(() => {
        this.getList();
        this.$modal.msgSuccess(this.$t("取消成功"));
      })
    },
sunhongwei's avatar
sunhongwei committed
164 165 166
  }
};
</script>