index.vue 5.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161
  1. <template>
  2. <div class="app-container">
  3. <doc-alert title="工作流" url="https://doc.iocoder.cn/bpm" />
  4. <!-- 搜索工作栏 -->
  5. <el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="68px">
  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-form-item>
  10. <el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
  11. <el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
  12. </el-form-item>
  13. </el-form>
  14. <!-- 操作工具栏 -->
  15. <el-row :gutter="10" class="mb8">
  16. <el-col :span="1.5">
  17. <el-button type="primary" plain icon="el-icon-plus" size="mini" @click="handleAdd"
  18. v-hasPermi="['bpm:form:create']">新增</el-button>
  19. </el-col>
  20. <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
  21. </el-row>
  22. <!-- 列表 -->
  23. <el-table v-loading="loading" :data="list">
  24. <el-table-column label="编号" align="center" prop="id" />
  25. <el-table-column label="表单名" align="center" prop="name" />
  26. <el-table-column label="开启状态" align="center" prop="status">
  27. <template v-slot="scope">
  28. <dict-tag :type="DICT_TYPE.COMMON_STATUS" :value="scope.row.status"/>
  29. </template>
  30. </el-table-column>
  31. <el-table-column label="备注" align="center" prop="remark" />
  32. <el-table-column label="创建时间" align="center" prop="createTime" width="180">
  33. <template v-slot="scope">
  34. <span>{{ parseTime(scope.row.createTime) }}</span>
  35. </template>
  36. </el-table-column>
  37. <el-table-column label="操作" align="center" class-name="small-padding fixed-width">
  38. <template v-slot="scope">
  39. <el-button size="mini" type="text" icon="el-icon-edit" @click="handleDetail(scope.row)"
  40. v-hasPermi="['bpm:form:query']">详情</el-button>
  41. <el-button size="mini" type="text" icon="el-icon-edit" @click="handleUpdate(scope.row)"
  42. v-hasPermi="['bpm:form:update']">修改</el-button>
  43. <el-button size="mini" type="text" icon="el-icon-delete" @click="handleDelete(scope.row)"
  44. v-hasPermi="['bpm:form:delete']">删除</el-button>
  45. </template>
  46. </el-table-column>
  47. </el-table>
  48. <!-- 分页组件 -->
  49. <pagination v-show="total > 0" :total="total" :page.sync="queryParams.pageNo" :limit.sync="queryParams.pageSize"
  50. @pagination="getList"/>
  51. <!--表单配置详情-->
  52. <el-dialog title="表单详情" :visible.sync="detailOpen" width="50%" append-to-body>
  53. <div class="test-form">
  54. <parser :key="new Date().getTime()" :form-conf="detailForm" />
  55. </div>
  56. </el-dialog>
  57. </div>
  58. </template>
  59. <script>
  60. import {deleteForm, getForm, getFormPage} from "@/api/bpm/form";
  61. import Parser from '@/components/parser/Parser'
  62. import {decodeFields} from "@/utils/formGenerator";
  63. export default {
  64. name: "BpmForm",
  65. components: {
  66. Parser
  67. },
  68. data() {
  69. return {
  70. // 遮罩层
  71. loading: true,
  72. // 显示搜索条件
  73. showSearch: true,
  74. // 总条数
  75. total: 0,
  76. // 工作流的列表
  77. list: [],
  78. // 查询参数
  79. queryParams: {
  80. pageNo: 1,
  81. pageSize: 10,
  82. name: null,
  83. },
  84. // 表单详情
  85. detailOpen: false,
  86. detailForm: {
  87. fields: []
  88. }
  89. };
  90. },
  91. created() {
  92. this.getList();
  93. },
  94. methods: {
  95. /** 查询列表 */
  96. getList() {
  97. this.loading = true;
  98. // 执行查询
  99. getFormPage(this.queryParams).then(response => {
  100. this.list = response.data.list;
  101. this.total = response.data.total;
  102. this.loading = false;
  103. });
  104. },
  105. /** 搜索按钮操作 */
  106. handleQuery() {
  107. this.queryParams.pageNo = 1;
  108. this.getList();
  109. },
  110. /** 重置按钮操作 */
  111. resetQuery() {
  112. this.resetForm("queryForm");
  113. this.handleQuery();
  114. },
  115. /** 详情按钮操作 */
  116. handleDetail(row) {
  117. getForm(row.id).then(response => {
  118. // 设置值
  119. const data = response.data
  120. this.detailForm = {
  121. ...JSON.parse(data.conf),
  122. fields: decodeFields(data.fields)
  123. }
  124. // 弹窗打开
  125. this.detailOpen = true
  126. })
  127. },
  128. /** 新增按钮操作 */
  129. handleAdd() {
  130. this.$router.push({
  131. name: "BpmFormEditor"
  132. });
  133. },
  134. /** 修改按钮操作 */
  135. handleUpdate(row) {
  136. this.$router.push({
  137. name: "BpmFormEditor",
  138. query:{
  139. formId: row.id
  140. }
  141. });
  142. },
  143. /** 删除按钮操作 */
  144. handleDelete(row) {
  145. const id = row.id;
  146. this.$modal.confirm('是否确认删除工作表单的编号为"' + id + '"的数据项?').then(function() {
  147. return deleteForm(id);
  148. }).then(() => {
  149. this.getList();
  150. this.$modal.msgSuccess("删除成功");
  151. }).catch(() => {});
  152. }
  153. }
  154. };
  155. </script>