FlowManage.vue 4.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177
  1. <template>
  2. <div class="flow-manage">
  3. <div class="part-box part-box-filter part-box-flex">
  4. <el-form ref="FilterForm" label-position="left" label-width="85px" inline>
  5. <template v-if="checkPrivilege('condition', 'condition')">
  6. <el-form-item label="名称:">
  7. <el-input
  8. style="width: 200px;"
  9. v-model.trim="filter.name"
  10. placeholder="请输入内容"
  11. clearable
  12. ></el-input>
  13. </el-form-item>
  14. </template>
  15. <el-form-item>
  16. <el-button
  17. v-if="checkPrivilege('button', 'select')"
  18. type="primary"
  19. @click="toPage(1)"
  20. >查询</el-button
  21. >
  22. </el-form-item>
  23. </el-form>
  24. <div class="part-box-action">
  25. <el-button
  26. v-if="checkPrivilege('button', 'register')"
  27. type="primary"
  28. icon="el-icon-circle-plus-outline"
  29. @click="toAdd"
  30. >添加流程</el-button
  31. >
  32. </div>
  33. </div>
  34. <div class="part-box part-box-pad">
  35. <el-table ref="TableList" :data="dataList">
  36. <el-table-column
  37. type="index"
  38. label="序号"
  39. width="70"
  40. :index="indexMethod"
  41. ></el-table-column>
  42. <el-table-column prop="name" label="流程名称"></el-table-column>
  43. <el-table-column prop="type" label="流程类型" width="160">
  44. <span slot-scope="scope">{{ scope.row.type | flowTypeFilter }}</span>
  45. </el-table-column>
  46. <el-table-column class-name="action-column" label="操作" width="160">
  47. <template slot-scope="scope">
  48. <el-button
  49. v-if="checkPrivilege('link', 'edit')"
  50. class="btn-primary"
  51. type="text"
  52. @click="toEditDetail(scope.row)"
  53. >编辑</el-button
  54. >
  55. <el-button
  56. v-if="checkPrivilege('link', 'edit')"
  57. class="btn-primary"
  58. type="text"
  59. @click="toEdit(scope.row)"
  60. >重命名</el-button
  61. >
  62. <el-button
  63. v-if="checkPrivilege('link', 'delete')"
  64. class="btn-danger"
  65. type="text"
  66. @click="toDelete(scope.row)"
  67. >删除</el-button
  68. >
  69. </template>
  70. </el-table-column>
  71. </el-table>
  72. <div class="part-page">
  73. <el-pagination
  74. background
  75. layout="total, sizes, prev, pager, next, jumper"
  76. :pager-count="5"
  77. :current-page="current"
  78. :total="total"
  79. :page-size="size"
  80. @current-change="toPage"
  81. @size-change="pageSizeChange"
  82. >
  83. </el-pagination>
  84. </div>
  85. </div>
  86. <!-- ModifyFlow -->
  87. <modify-flow
  88. ref="ModifyFlow"
  89. :instance="curFlow"
  90. @modified="flowModified"
  91. ></modify-flow>
  92. <!-- ModifyFlowDetail -->
  93. <modify-flow-detail
  94. ref="ModifyFlowDetail"
  95. :instance="curFlow"
  96. @modified="getList"
  97. ></modify-flow-detail>
  98. </div>
  99. </template>
  100. <script>
  101. import { flowListPage, flowDelete } from "../api";
  102. import ModifyFlow from "../components/ModifyFlow";
  103. import ModifyFlowDetail from "../components/ModifyFlowDetail";
  104. export default {
  105. name: "flow-manage",
  106. components: {
  107. ModifyFlow,
  108. ModifyFlowDetail
  109. },
  110. data() {
  111. return {
  112. filter: {
  113. name: ""
  114. },
  115. current: 1,
  116. size: this.GLOBAL.pageSize,
  117. total: 0,
  118. dataList: [],
  119. curFlow: {}
  120. };
  121. },
  122. mounted() {
  123. this.toPage(1);
  124. },
  125. methods: {
  126. async getList() {
  127. if (!this.checkPrivilege("list", "list")) return;
  128. const datas = {
  129. ...this.filter,
  130. pageNumber: this.current,
  131. pageSize: this.size
  132. };
  133. const data = await flowListPage(datas);
  134. this.dataList = data.records;
  135. this.total = data.total;
  136. },
  137. toPage(page) {
  138. this.current = page;
  139. this.getList();
  140. },
  141. toAdd() {
  142. this.curFlow = {};
  143. this.$refs.ModifyFlow.open();
  144. },
  145. toEdit(row) {
  146. this.curFlow = { ...row };
  147. this.$refs.ModifyFlow.open();
  148. },
  149. toEditDetail(row) {
  150. this.curFlow = { ...row };
  151. this.$refs.ModifyFlowDetail.open();
  152. },
  153. flowModified({ isEdit, data }) {
  154. if (!isEdit) {
  155. this.curFlow = data;
  156. this.$refs.ModifyFlowDetail.open();
  157. return;
  158. }
  159. this.getList();
  160. },
  161. toDelete(row) {
  162. this.$confirm(`确定要删除流程【${row.name}】吗?`, "提示", {
  163. type: "warning"
  164. })
  165. .then(async () => {
  166. await flowDelete({ id: row.id, enable: 0 });
  167. this.$message.success("操作成功!");
  168. this.getList();
  169. })
  170. .catch(() => {});
  171. }
  172. }
  173. };
  174. </script>