FlowManage.vue 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146
  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', 'add')"
  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 class-name="action-column" label="操作" width="120px">
  44. <template slot-scope="scope">
  45. <el-button
  46. v-if="checkPrivilege('link', 'delete')"
  47. class="btn-danger"
  48. type="text"
  49. @click="toDelete(scope.row)"
  50. >删除</el-button
  51. >
  52. </template>
  53. </el-table-column>
  54. </el-table>
  55. <div class="part-page">
  56. <el-pagination
  57. background
  58. layout="total,prev, pager, next"
  59. :current-page="current"
  60. :total="total"
  61. :page-size="size"
  62. @current-change="toPage"
  63. >
  64. </el-pagination>
  65. </div>
  66. </div>
  67. <!-- RegistFlowDialog -->
  68. <regist-flow-dialog
  69. ref="RegistFlowDialog"
  70. @modified="getList"
  71. ></regist-flow-dialog>
  72. </div>
  73. </template>
  74. <script>
  75. import { flowListPage, flowPublish, flowDelete } from "../api";
  76. import RegistFlowDialog from "../components/RegistFlowDialog";
  77. export default {
  78. name: "flow-manage",
  79. components: {
  80. RegistFlowDialog
  81. },
  82. data() {
  83. return {
  84. filter: {
  85. name: ""
  86. },
  87. current: 1,
  88. size: this.GLOBAL.pageSize,
  89. total: 0,
  90. dataList: [],
  91. curFlow: {}
  92. };
  93. },
  94. mounted() {
  95. this.toPage(1);
  96. },
  97. methods: {
  98. async getList() {
  99. if (!this.checkPrivilege("list", "list")) return;
  100. const datas = {
  101. ...this.filter,
  102. pageNumber: this.current,
  103. pageSize: this.size
  104. };
  105. const data = await flowListPage(datas);
  106. this.dataList = data.records;
  107. this.total = data.total;
  108. },
  109. toPage(page) {
  110. this.current = page;
  111. this.getList();
  112. },
  113. toAdd() {
  114. this.curFlow = {};
  115. this.$refs.RegistFlowDialog.open();
  116. },
  117. toPublish(row) {
  118. if (row.publish) return;
  119. this.$confirm(`确定要发布流程【${row.name}】吗?`, "提示", {
  120. type: "warning"
  121. })
  122. .then(async () => {
  123. await flowPublish(row.id);
  124. this.$message.success("操作成功!");
  125. row.publish = !row.publish;
  126. })
  127. .catch(() => {});
  128. },
  129. toDelete(row) {
  130. this.$confirm(`确定要删除流程【${row.name}】吗?`, "提示", {
  131. type: "warning"
  132. })
  133. .then(async () => {
  134. await flowDelete({ flowId: row.id, enable: false });
  135. this.$message.success("操作成功!");
  136. this.getList();
  137. })
  138. .catch(() => {});
  139. }
  140. }
  141. };
  142. </script>