综合办公系统
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

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353
  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" width="60%" append-to-body>
  97. <RowDetail :rows="clickRow"></RowDetail>
  98. </el-dialog>
  99. </div>
  100. </template>
  101. <script>
  102. import {
  103. getDeployment,
  104. delDeployment,
  105. addDeployment,
  106. updateDeployment,
  107. exportDeployment,
  108. flowRecord
  109. } from "@/api/flowable/finished";
  110. import { myProcessList, stopProcess } from "@/api/flowable/process";
  111. import { listDefinition } from "@/api/flowable/definition";
  112. import RowDetail from './send/rowDetail.vue'
  113. export default {
  114. name: "Deploy",
  115. components: {
  116. RowDetail
  117. },
  118. data() {
  119. return {
  120. // 遮罩层
  121. loading: true,
  122. processLoading: true,
  123. // 选中数组
  124. ids: [],
  125. // 非单个禁用
  126. single: true,
  127. // 非多个禁用
  128. multiple: true,
  129. // 显示搜索条件
  130. showSearch: true,
  131. // 总条数
  132. total: 0,
  133. processTotal: 0,
  134. // 我发起的流程列表数据
  135. myProcessList: [],
  136. // 弹出层标题
  137. title: "",
  138. // 是否显示弹出层
  139. open: false,
  140. // 详情弹出框
  141. detailsOpen: false,
  142. src: "",
  143. definitionList: [],
  144. // 查询参数
  145. queryParams: {
  146. pageNum: 1,
  147. pageSize: 10,
  148. name: null,
  149. category: null,
  150. key: null,
  151. tenantId: null,
  152. deployTime: null,
  153. derivedFrom: null,
  154. derivedFromRoot: null,
  155. parentDeploymentId: null,
  156. engineVersion: null
  157. },
  158. // 查询参数
  159. queryProcessParams: {
  160. pageNum: 1,
  161. pageSize: 10,
  162. name: null,
  163. category: null,
  164. key: null,
  165. tenantId: null,
  166. deployTime: null,
  167. derivedFrom: null,
  168. derivedFromRoot: null,
  169. parentDeploymentId: null,
  170. engineVersion: null
  171. },
  172. // 表单参数
  173. form: {},
  174. // 表单校验
  175. rules: {
  176. },
  177. // 当前点击的行数据
  178. clickRow:{}
  179. };
  180. },
  181. created() {
  182. this.getList();
  183. },
  184. methods: {
  185. /** 查询流程定义列表 */
  186. getList() {
  187. this.loading = true;
  188. myProcessList(this.queryParams).then(response => {
  189. this.myProcessList = response.data.records;
  190. this.total = response.data.total;
  191. this.loading = false;
  192. });
  193. },
  194. // 取消按钮
  195. cancel() {
  196. this.open = false;
  197. this.reset();
  198. },
  199. // 表单重置
  200. reset() {
  201. this.form = {
  202. id: null,
  203. name: null,
  204. category: null,
  205. key: null,
  206. tenantId: null,
  207. deployTime: null,
  208. derivedFrom: null,
  209. derivedFromRoot: null,
  210. parentDeploymentId: null,
  211. engineVersion: null
  212. };
  213. this.resetForm("form");
  214. },
  215. /** 搜索按钮操作 */
  216. handleQuery() {
  217. this.queryParams.pageNum = 1;
  218. this.getList();
  219. },
  220. /** 重置按钮操作 */
  221. resetQuery() {
  222. this.resetForm("queryForm");
  223. this.handleQuery();
  224. },
  225. /** 搜索按钮操作 */
  226. handleProcessQuery() {
  227. this.queryProcessParams.pageNum = 1;
  228. this.listDefinition();
  229. },
  230. /** 重置按钮操作 */
  231. resetProcessQuery() {
  232. this.resetForm("queryProcessForm");
  233. this.handleProcessQuery();
  234. },
  235. // 多选框选中数据
  236. handleSelectionChange(selection) {
  237. this.ids = selection.map(item => item.procInsId)
  238. this.single = selection.length !== 1
  239. this.multiple = !selection.length
  240. },
  241. /** 新增按钮操作 */
  242. handleAdd() {
  243. this.open = true;
  244. this.title = "发起流程";
  245. this.listDefinition();
  246. },
  247. listDefinition() {
  248. listDefinition(this.queryProcessParams).then(response => {
  249. this.definitionList = response.data.records;
  250. this.processTotal = response.data.total;
  251. this.processLoading = false;
  252. });
  253. },
  254. /** 发起流程申请 */
  255. handleStartProcess(row) {
  256. this.$router.push({
  257. path: '/flowable/task/myProcess/send/index',
  258. query: {
  259. deployId: row.deploymentId,
  260. procDefId: row.id
  261. }
  262. })
  263. },
  264. /** 取消流程申请 */
  265. handleStop(row) {
  266. const params = {
  267. instanceId: row.procInsId
  268. }
  269. stopProcess(params).then(res => {
  270. this.$modal.msgSuccess(res.msg);
  271. this.getList();
  272. });
  273. },
  274. /** 流程流转记录 */
  275. handleFlowRecord(row) {
  276. // this.$router.push({
  277. // path: '/flowable/task/myProcess/detail/index',
  278. // query: {
  279. // procInsId: row.procInsId,
  280. // deployId: row.deployId,
  281. // taskId: row.taskId
  282. // }
  283. // })
  284. console.log(row);
  285. this.clickRow = row;
  286. this.detailsOpen = true;
  287. },
  288. /** 修改按钮操作 */
  289. handleUpdate(row) {
  290. this.reset();
  291. const id = row.id || this.ids
  292. getDeployment(id).then(response => {
  293. this.form = response.data;
  294. this.open = true;
  295. this.title = "修改流程定义";
  296. });
  297. },
  298. /** 提交按钮 */
  299. submitForm() {
  300. this.$refs["form"].validate(valid => {
  301. if (valid) {
  302. if (this.form.id != null) {
  303. updateDeployment(this.form).then(response => {
  304. this.$modal.msgSuccess("修改成功");
  305. this.open = false;
  306. this.getList();
  307. });
  308. } else {
  309. addDeployment(this.form).then(response => {
  310. this.$modal.msgSuccess("新增成功");
  311. this.open = false;
  312. this.getList();
  313. });
  314. }
  315. }
  316. });
  317. },
  318. /** 删除按钮操作 */
  319. handleDelete(row) {
  320. const ids = row.procInsId || this.ids;// 暂不支持删除多个流程
  321. this.$confirm('是否确认删除流程定义编号为"' + ids + '"的数据项?', "警告", {
  322. confirmButtonText: "确定",
  323. cancelButtonText: "取消",
  324. type: "warning"
  325. }).then(() => {
  326. return delDeployment(ids);
  327. }).then(() => {
  328. this.getList();
  329. this.$modal.msgSuccess("删除成功");
  330. })
  331. },
  332. /** 导出按钮操作 */
  333. handleExport() {
  334. const queryParams = this.queryParams;
  335. this.$confirm('是否确认导出所有流程定义数据项?', "警告", {
  336. confirmButtonText: "确定",
  337. cancelButtonText: "取消",
  338. type: "warning"
  339. }).then(() => {
  340. return exportDeployment(queryParams);
  341. }).then(response => {
  342. this.download(response.msg);
  343. })
  344. }
  345. }
  346. };
  347. </script>