index.vue 5.2 KB

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