综合办公系统
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

index.vue 12KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355
  1. <template>
  2. <div class="app-container">
  3. <el-form :model="queryParams" ref="queryForm" :inline="true" v-show="showSearch" label-width="68px">
  4. <el-form-item label="名称" prop="name">
  5. <el-input v-model="queryParams.name" placeholder="请输入名称" clearable size="small"
  6. @keyup.enter.native="handleQuery" />
  7. </el-form-item>
  8. <el-form-item label="开始时间" prop="deployTime">
  9. <el-date-picker clearable size="small" v-model="queryParams.deployTime" type="date" value-format="yyyy-MM-dd"
  10. placeholder="选择时间">
  11. </el-date-picker>
  12. </el-form-item>
  13. <el-form-item>
  14. <el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
  15. <el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
  16. </el-form-item>
  17. </el-form>
  18. <el-row :gutter="10" class="mb8">
  19. <el-col :span="1.5">
  20. <el-button type="primary" plain icon="el-icon-plus" size="mini" @click="handleAdd"
  21. v-hasPermi="['system:deployment:add']">新增流程</el-button>
  22. </el-col>
  23. <el-col :span="1.5">
  24. <el-button type="danger" plain icon="el-icon-delete" size="mini" :disabled="multiple" @click="handleDelete"
  25. v-hasPermi="['system:deployment:remove']">删除</el-button>
  26. </el-col>
  27. <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
  28. </el-row>
  29. <el-table v-loading="loading" :data="myProcessList" border @selection-change="handleSelectionChange">
  30. <el-table-column type="selection" width="55" align="center" />
  31. <el-table-column label="流程编号" align="center" prop="procInsId" :show-overflow-tooltip="true" />
  32. <el-table-column label="流程名称" align="center" prop="procDefName" :show-overflow-tooltip="true" />
  33. <el-table-column label="流程类别" align="center" prop="category" width="100px" />
  34. <el-table-column label="流程版本" align="center" width="80px">
  35. <template slot-scope="scope">
  36. <el-tag size="medium">v{{ scope.row.procDefVersion }}</el-tag>
  37. </template>
  38. </el-table-column>
  39. <el-table-column label="提交时间" align="center" prop="createTime" width="180" />
  40. <el-table-column label="流程状态" align="center" width="100">
  41. <template slot-scope="scope">
  42. <el-tag v-if="scope.row.finishTime == null" size="mini">进行中</el-tag>
  43. <el-tag type="success" v-if="scope.row.finishTime != null" size="mini">已完成</el-tag>
  44. </template>
  45. </el-table-column>
  46. <el-table-column label="耗时" align="center" prop="duration" width="180" />
  47. <el-table-column label="当前节点" align="center" prop="taskName" />
  48. <el-table-column label="办理人" align="center">
  49. <template slot-scope="scope">
  50. <label v-if="scope.row.assigneeName">{{ scope.row.assigneeName }} <el-tag type="info"
  51. size="mini">{{ scope.row.assigneeDeptName }}</el-tag></label>
  52. <!-- <label v-if="scope.row.candidate">{{scope.row.candidate}}</label>-->
  53. </template>
  54. </el-table-column>
  55. <el-table-column label="操作" width="150" fixed="right" class-name="small-padding fixed-width">
  56. <template slot-scope="scope">
  57. <el-button @click="handleFlowRecord(scope.row)" type="text" size="small">详情</el-button>
  58. <el-button @click="handleStop(scope.row)" type="text" size="small">取消申请</el-button>
  59. <el-button @click="handleDelete(scope.row)" type="text" size="small"
  60. v-hasPermi="['system:deployment:remove']">删除</el-button>
  61. </template>
  62. </el-table-column>
  63. </el-table>
  64. <pagination v-show="total > 0" :total="total" :page.sync="queryParams.pageNum" :limit.sync="queryParams.pageSize"
  65. @pagination="getList" />
  66. <!-- 发起流程 -->
  67. <el-dialog :title="title" :visible.sync="open" width="60%" append-to-body>
  68. <el-form :model="queryProcessParams" ref="queryProcessForm" :inline="true" v-show="showSearch" label-width="68px">
  69. <el-form-item label="名称" prop="name">
  70. <el-input v-model="queryProcessParams.name" placeholder="请输入名称" clearable size="small"
  71. @keyup.enter.native="handleQuery" />
  72. </el-form-item>
  73. <el-form-item>
  74. <el-button type="primary" icon="el-icon-search" size="mini" @click="handleProcessQuery">搜索</el-button>
  75. <el-button icon="el-icon-refresh" size="mini" @click="resetProcessQuery">重置</el-button>
  76. </el-form-item>
  77. </el-form>
  78. <el-table v-loading="processLoading" fit :data="definitionList" border>
  79. <el-table-column label="流程名称" align="center" prop="name" />
  80. <el-table-column label="流程版本" align="center">
  81. <template slot-scope="scope">
  82. <el-tag size="medium">v{{ scope.row.version }}</el-tag>
  83. </template>
  84. </el-table-column>
  85. <el-table-column label="流程分类" align="center" prop="category" />
  86. <el-table-column label="操作" align="center" width="300" class-name="small-padding fixed-width">
  87. <template slot-scope="scope">
  88. <el-button size="mini" type="text" icon="el-icon-edit-outline"
  89. @click="handleStartProcess(scope.row)">发起流程</el-button>
  90. </template>
  91. </el-table-column>
  92. </el-table>
  93. <pagination v-show="processTotal > 0" :total="processTotal" :page.sync="queryProcessParams.pageNum"
  94. :limit.sync="queryProcessParams.pageSize" @pagination="listDefinition" />
  95. </el-dialog>
  96. <el-dialog title="流程详情" :visible.sync="detailsOpen" append-to-body width="600px">
  97. <el-scrollbar style="height: 600px;">
  98. <RowDetail :rows="clickRow"></RowDetail>
  99. </el-scrollbar>
  100. </el-dialog>
  101. </div>
  102. </template>
  103. <script>
  104. import {
  105. getDeployment,
  106. delDeployment,
  107. addDeployment,
  108. updateDeployment,
  109. exportDeployment,
  110. flowRecord
  111. } from "@/api/flowable/finished";
  112. import { myProcessList, stopProcess } from "@/api/flowable/process";
  113. import { listDefinition } from "@/api/flowable/definition";
  114. import RowDetail from './send/rowDetail.vue'
  115. export default {
  116. name: "Deploy",
  117. components: {
  118. RowDetail
  119. },
  120. data() {
  121. return {
  122. // 遮罩层
  123. loading: true,
  124. processLoading: true,
  125. // 选中数组
  126. ids: [],
  127. // 非单个禁用
  128. single: true,
  129. // 非多个禁用
  130. multiple: true,
  131. // 显示搜索条件
  132. showSearch: true,
  133. // 总条数
  134. total: 0,
  135. processTotal: 0,
  136. // 我发起的流程列表数据
  137. myProcessList: [],
  138. // 弹出层标题
  139. title: "",
  140. // 是否显示弹出层
  141. open: false,
  142. // 详情弹出框
  143. detailsOpen: false,
  144. src: "",
  145. definitionList: [],
  146. // 查询参数
  147. queryParams: {
  148. pageNum: 1,
  149. pageSize: 10,
  150. name: null,
  151. category: null,
  152. key: null,
  153. tenantId: null,
  154. deployTime: null,
  155. derivedFrom: null,
  156. derivedFromRoot: null,
  157. parentDeploymentId: null,
  158. engineVersion: null
  159. },
  160. // 查询参数
  161. queryProcessParams: {
  162. pageNum: 1,
  163. pageSize: 10,
  164. name: null,
  165. category: null,
  166. key: null,
  167. tenantId: null,
  168. deployTime: null,
  169. derivedFrom: null,
  170. derivedFromRoot: null,
  171. parentDeploymentId: null,
  172. engineVersion: null
  173. },
  174. // 表单参数
  175. form: {},
  176. // 表单校验
  177. rules: {
  178. },
  179. // 当前点击的行数据
  180. clickRow:{}
  181. };
  182. },
  183. created() {
  184. this.getList();
  185. },
  186. methods: {
  187. /** 查询流程定义列表 */
  188. getList() {
  189. this.loading = true;
  190. myProcessList(this.queryParams).then(response => {
  191. this.myProcessList = response.data.records;
  192. this.total = response.data.total;
  193. this.loading = false;
  194. });
  195. },
  196. // 取消按钮
  197. cancel() {
  198. this.open = false;
  199. this.reset();
  200. },
  201. // 表单重置
  202. reset() {
  203. this.form = {
  204. id: null,
  205. name: null,
  206. category: null,
  207. key: null,
  208. tenantId: null,
  209. deployTime: null,
  210. derivedFrom: null,
  211. derivedFromRoot: null,
  212. parentDeploymentId: null,
  213. engineVersion: null
  214. };
  215. this.resetForm("form");
  216. },
  217. /** 搜索按钮操作 */
  218. handleQuery() {
  219. this.queryParams.pageNum = 1;
  220. this.getList();
  221. },
  222. /** 重置按钮操作 */
  223. resetQuery() {
  224. this.resetForm("queryForm");
  225. this.handleQuery();
  226. },
  227. /** 搜索按钮操作 */
  228. handleProcessQuery() {
  229. this.queryProcessParams.pageNum = 1;
  230. this.listDefinition();
  231. },
  232. /** 重置按钮操作 */
  233. resetProcessQuery() {
  234. this.resetForm("queryProcessForm");
  235. this.handleProcessQuery();
  236. },
  237. // 多选框选中数据
  238. handleSelectionChange(selection) {
  239. this.ids = selection.map(item => item.procInsId)
  240. this.single = selection.length !== 1
  241. this.multiple = !selection.length
  242. },
  243. /** 新增按钮操作 */
  244. handleAdd() {
  245. this.open = true;
  246. this.title = "发起流程";
  247. this.listDefinition();
  248. },
  249. listDefinition() {
  250. listDefinition(this.queryProcessParams).then(response => {
  251. this.definitionList = response.data.records;
  252. this.processTotal = response.data.total;
  253. this.processLoading = false;
  254. });
  255. },
  256. /** 发起流程申请 */
  257. handleStartProcess(row) {
  258. this.$router.push({
  259. path: '/flowable/task/myProcess/send/index',
  260. query: {
  261. deployId: row.deploymentId,
  262. procDefId: row.id
  263. }
  264. })
  265. },
  266. /** 取消流程申请 */
  267. handleStop(row) {
  268. const params = {
  269. instanceId: row.procInsId
  270. }
  271. stopProcess(params).then(res => {
  272. this.$modal.msgSuccess(res.msg);
  273. this.getList();
  274. });
  275. },
  276. /** 流程流转记录 */
  277. handleFlowRecord(row) {
  278. // this.$router.push({
  279. // path: '/flowable/task/myProcess/detail/index',
  280. // query: {
  281. // procInsId: row.procInsId,
  282. // deployId: row.deployId,
  283. // taskId: row.taskId
  284. // }
  285. // })
  286. console.log(row);
  287. this.clickRow = row;
  288. this.detailsOpen = true;
  289. },
  290. /** 修改按钮操作 */
  291. handleUpdate(row) {
  292. this.reset();
  293. const id = row.id || this.ids
  294. getDeployment(id).then(response => {
  295. this.form = response.data;
  296. this.open = true;
  297. this.title = "修改流程定义";
  298. });
  299. },
  300. /** 提交按钮 */
  301. submitForm() {
  302. this.$refs["form"].validate(valid => {
  303. if (valid) {
  304. if (this.form.id != null) {
  305. updateDeployment(this.form).then(response => {
  306. this.$modal.msgSuccess("修改成功");
  307. this.open = false;
  308. this.getList();
  309. });
  310. } else {
  311. addDeployment(this.form).then(response => {
  312. this.$modal.msgSuccess("新增成功");
  313. this.open = false;
  314. this.getList();
  315. });
  316. }
  317. }
  318. });
  319. },
  320. /** 删除按钮操作 */
  321. handleDelete(row) {
  322. const ids = row.procInsId || this.ids;// 暂不支持删除多个流程
  323. this.$confirm('是否确认删除流程定义编号为"' + ids + '"的数据项?', "警告", {
  324. confirmButtonText: "确定",
  325. cancelButtonText: "取消",
  326. type: "warning"
  327. }).then(() => {
  328. return delDeployment(ids);
  329. }).then(() => {
  330. this.getList();
  331. this.$modal.msgSuccess("删除成功");
  332. })
  333. },
  334. /** 导出按钮操作 */
  335. handleExport() {
  336. const queryParams = this.queryParams;
  337. this.$confirm('是否确认导出所有流程定义数据项?', "警告", {
  338. confirmButtonText: "确定",
  339. cancelButtonText: "取消",
  340. type: "warning"
  341. }).then(() => {
  342. return exportDeployment(queryParams);
  343. }).then(response => {
  344. this.download(response.msg);
  345. })
  346. }
  347. }
  348. };
  349. </script>