index.vue 8.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276
  1. <template>
  2. <div class="app-container">
  3. <el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-position="top">
  4. <el-row :gutter="20">
  5. <el-col :span="6">
  6. <el-form-item label="名称" prop="name">
  7. <el-input v-model="queryParams.name" placeholder="请输入名称" clearable @keyup.enter.native="handleQuery" />
  8. </el-form-item>
  9. </el-col>
  10. <el-col :span="6">
  11. <el-form-item label="开始时间" prop="deployTime">
  12. <el-date-picker style="width: 100%;" clearable v-model="queryParams.deployTime" type="date"
  13. value-format="yyyy-MM-dd" placeholder="选择时间">
  14. </el-date-picker>
  15. </el-form-item>
  16. </el-col>
  17. <el-col :span="6"></el-col>
  18. <el-col :span="6"></el-col>
  19. </el-row>
  20. <el-row :gutter="20">
  21. <el-col :span="6">
  22. <el-form-item label="搜索">
  23. <el-button style="width: 100%;" type="primary" icon="el-icon-search" @click="handleQuery">搜索</el-button>
  24. </el-form-item>
  25. </el-col>
  26. <el-col :span="6">
  27. <el-form-item label="重置">
  28. <el-button style="width: 100%;" icon="el-icon-refresh" type="primary" @click="resetQuery">重置</el-button>
  29. </el-form-item>
  30. </el-col>
  31. </el-row>
  32. </el-form>
  33. <el-row :gutter="10" class="mb8">
  34. <el-col :span="1.5">
  35. <el-button type="danger" icon="el-icon-delete" size="small" :disabled="multiple" @click="handleDelete"
  36. v-hasPermi="['system:deployment:remove']">删除
  37. </el-button>
  38. </el-col>
  39. <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
  40. </el-row>
  41. <div class="border-card">
  42. <el-table height="450" v-loading="loading" :data="finishedList" border @selection-change="handleSelectionChange">
  43. <el-table-column type="selection" width="55" align="center" />
  44. <el-table-column label="任务编号" align="center" prop="taskId" :show-overflow-tooltip="true" />
  45. <el-table-column label="流程名称" align="center" prop="procDefName" :show-overflow-tooltip="true" />
  46. <el-table-column label="任务节点" align="center" prop="taskName" />
  47. <el-table-column label="流程发起人" align="center">
  48. <template slot-scope="scope">
  49. <label>{{ scope.row.startUserName }} <el-tag type="info"
  50. size="small">{{ scope.row.startDeptName }}</el-tag></label>
  51. </template>
  52. </el-table-column>
  53. <el-table-column label="接收时间" align="center" prop="createTime" width="180" />
  54. <el-table-column label="审批时间" align="center" prop="finishTime" width="180" />
  55. <el-table-column label="耗时" align="center" prop="duration" width="180" />
  56. <el-table-column label="操作" align="center" width="150" class-name="small-padding fixed-width">
  57. <template slot-scope="scope">
  58. <el-button style="color:#1890ff" size="small" type="text" icon="el-icon-tickets"
  59. @click="handleFlowRecord(scope.row)">流转记录</el-button>
  60. <el-button size="small" type="text" icon="el-icon-refresh-left" @click="handleRevoke(scope.row)">撤回
  61. </el-button>
  62. </template>
  63. </el-table-column>
  64. </el-table>
  65. <pagination v-show="total > 0" :total="total" :page.sync="queryParams.pageNum" :limit.sync="queryParams.pageSize"
  66. @pagination="getList" />
  67. </div>
  68. </div>
  69. </template>
  70. <script>
  71. import { finishedList, getDeployment, delDeployment, addDeployment, updateDeployment, exportDeployment, revokeProcess } from '@/api/flowable/finished'
  72. export default {
  73. name: 'Deploy',
  74. components: {
  75. },
  76. data() {
  77. return {
  78. // 遮罩层
  79. loading: true,
  80. // 选中数组
  81. ids: [],
  82. // 非单个禁用
  83. single: true,
  84. // 非多个禁用
  85. multiple: true,
  86. // 显示搜索条件
  87. showSearch: true,
  88. // 总条数
  89. total: 0,
  90. // 已办任务列表数据
  91. finishedList: [],
  92. // 弹出层标题
  93. title: '',
  94. // 是否显示弹出层
  95. open: false,
  96. src: '',
  97. // 查询参数
  98. queryParams: {
  99. pageNum: 1,
  100. pageSize: 10,
  101. name: null,
  102. category: null,
  103. key: null,
  104. tenantId: null,
  105. deployTime: null,
  106. derivedFrom: null,
  107. derivedFromRoot: null,
  108. parentDeploymentId: null,
  109. engineVersion: null
  110. },
  111. // 表单参数
  112. form: {},
  113. // 表单校验
  114. rules: {
  115. }
  116. }
  117. },
  118. created() {
  119. this.getList()
  120. },
  121. methods: {
  122. /** 查询流程定义列表 */
  123. getList() {
  124. this.loading = true
  125. finishedList(this.queryParams).then(response => {
  126. this.finishedList = response.data.records
  127. this.total = response.data.total
  128. this.loading = false
  129. })
  130. },
  131. // 取消按钮
  132. cancel() {
  133. this.open = false
  134. this.reset()
  135. },
  136. // 表单重置
  137. reset() {
  138. this.form = {
  139. id: null,
  140. name: null,
  141. category: null,
  142. key: null,
  143. tenantId: null,
  144. deployTime: null,
  145. derivedFrom: null,
  146. derivedFromRoot: null,
  147. parentDeploymentId: null,
  148. engineVersion: null
  149. }
  150. this.resetForm('form')
  151. },
  152. setIcon(val) {
  153. if (val) {
  154. return 'el-icon-check'
  155. } else {
  156. return 'el-icon-time'
  157. }
  158. },
  159. setColor(val) {
  160. if (val) {
  161. return '#2bc418'
  162. } else {
  163. return '#b3bdbb'
  164. }
  165. },
  166. /** 搜索按钮操作 */
  167. handleQuery() {
  168. this.queryParams.pageNum = 1
  169. this.getList()
  170. },
  171. /** 重置按钮操作 */
  172. resetQuery() {
  173. this.resetForm('queryForm')
  174. this.handleQuery()
  175. },
  176. // 多选框选中数据
  177. handleSelectionChange(selection) {
  178. this.ids = selection.map(item => item.id)
  179. this.single = selection.length !== 1
  180. this.multiple = !selection.length
  181. },
  182. /** 新增按钮操作 */
  183. handleAdd() {
  184. this.reset()
  185. this.open = true
  186. this.title = '添加流程定义'
  187. },
  188. /** 流程流转记录 */
  189. handleFlowRecord(row) {
  190. this.$router.push({
  191. path: '/flowable/task/finished/detail/index',
  192. query: {
  193. procInsId: row.procInsId,
  194. deployId: row.deployId,
  195. taskId: row.taskId
  196. }
  197. })
  198. },
  199. /** 撤回任务 */
  200. handleRevoke(row) {
  201. const params = {
  202. instanceId: row.procInsId
  203. }
  204. revokeProcess(params).then(res => {
  205. this.$modal.msgSuccess(res.msg)
  206. this.getList()
  207. })
  208. },
  209. /** 修改按钮操作 */
  210. handleUpdate(row) {
  211. this.reset()
  212. const id = row.id || this.ids
  213. getDeployment(id).then(response => {
  214. this.form = response.data
  215. this.open = true
  216. this.title = '修改流程定义'
  217. })
  218. },
  219. /** 提交按钮 */
  220. submitForm() {
  221. this.$refs['form'].validate(valid => {
  222. if (valid) {
  223. if (this.form.id != null) {
  224. updateDeployment(this.form).then(response => {
  225. this.$modal.msgSuccess('修改成功')
  226. this.open = false
  227. this.getList()
  228. })
  229. } else {
  230. addDeployment(this.form).then(response => {
  231. this.$modal.msgSuccess('新增成功')
  232. this.open = false
  233. this.getList()
  234. })
  235. }
  236. }
  237. })
  238. },
  239. /** 删除按钮操作 */
  240. handleDelete(row) {
  241. const ids = row.id || this.ids
  242. this.$confirm('是否确认删除流程定义编号为"' + ids + '"的数据项?', '警告', {
  243. confirmButtonText: '确定',
  244. cancelButtonText: '取消',
  245. type: 'warning'
  246. }).then(function() {
  247. return delDeployment(ids)
  248. }).then(() => {
  249. this.getList()
  250. this.$modal.msgSuccess('删除成功')
  251. })
  252. },
  253. /** 导出按钮操作 */
  254. handleExport() {
  255. const queryParams = this.queryParams
  256. this.$confirm('是否确认导出所有流程定义数据项?', '警告', {
  257. confirmButtonText: '确定',
  258. cancelButtonText: '取消',
  259. type: 'warning'
  260. }).then(function() {
  261. return exportDeployment(queryParams)
  262. }).then(response => {
  263. this.download(response.msg)
  264. })
  265. }
  266. }
  267. }
  268. </script>