index.vue 4.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145
  1. <template>
  2. <div class="app-container">
  3. <el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="68px">
  4. <el-form-item label="名称" prop="name">
  5. <el-input
  6. v-model="queryParams.name"
  7. placeholder="请输入表达式名称"
  8. clearable
  9. @keyup.enter.native="handleQuery"
  10. />
  11. </el-form-item>
  12. <el-form-item label="状态" prop="status">
  13. <el-select v-model="queryParams.status" placeholder="请选择状态" clearable>
  14. <el-option
  15. v-for="dict in dict.type.sys_common_status"
  16. :key="dict.value"
  17. :label="dict.label"
  18. :value="dict.value"
  19. />
  20. </el-select>
  21. </el-form-item>
  22. <el-form-item>
  23. <el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
  24. <el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
  25. </el-form-item>
  26. </el-form>
  27. <el-table v-loading="loading" :data="expressionList" row-key="id" @current-change="handleSingleExpSelect">
  28. <el-table-column width="55" align="center" >
  29. <template slot-scope="scope">
  30. <!-- 可以手动的修改label的值,从而控制选择哪一项 -->
  31. <el-radio v-model="radioSelected" :label="scope.row.id">{{''}}</el-radio>
  32. </template>
  33. </el-table-column>
  34. <el-table-column label="主键" align="center" prop="id" />
  35. <el-table-column label="名称" align="center" prop="name" />
  36. <el-table-column label="表达式内容" align="center" prop="expression" />
  37. <el-table-column label="表达式类型" align="center" prop="dataType" >
  38. <template slot-scope="scope">
  39. <dict-tag :options="dict.type.exp_data_type" :value="scope.row.dataType"/>
  40. </template>
  41. </el-table-column>
  42. <el-table-column label="备注" align="center" prop="remark" />
  43. </el-table>
  44. <pagination
  45. v-show="total>0"
  46. :total="total"
  47. :page-sizes="[5,10]"
  48. :page.sync="queryParams.pageNum"
  49. :limit.sync="queryParams.pageSize"
  50. @pagination="getList"
  51. />
  52. </div>
  53. </template>
  54. <script>
  55. import { listExpression } from "@/api/system/expression";
  56. import {StrUtil} from "@/utils/StrUtil";
  57. export default {
  58. name: "Expression",
  59. dicts: ['sys_common_status','exp_data_type'],
  60. // 接受父组件的值
  61. props: {
  62. // 回显数据传值
  63. selectValues: {
  64. type: Number | String,
  65. default: null,
  66. required: false
  67. }
  68. },
  69. data() {
  70. return {
  71. // 遮罩层
  72. loading: true,
  73. // 选中数组
  74. ids: [],
  75. // 非单个禁用
  76. single: true,
  77. // 非多个禁用
  78. multiple: true,
  79. // 显示搜索条件
  80. showSearch: true,
  81. // 总条数
  82. total: 0,
  83. // 流程达式表格数据
  84. expressionList: [],
  85. // 弹出层标题
  86. title: "",
  87. // 是否显示弹出层
  88. open: false,
  89. // 查询参数
  90. queryParams: {
  91. pageNum: 1,
  92. pageSize: 10,
  93. name: null,
  94. expression: null,
  95. status: null,
  96. },
  97. radioSelected: null // 单选框传值
  98. };
  99. },
  100. watch: {
  101. selectValues: {
  102. handler(newVal) {
  103. if (StrUtil.isNotBlank(newVal)) {
  104. this.radioSelected = newVal
  105. }
  106. },
  107. immediate: true,
  108. }
  109. },
  110. created() {
  111. this.getList();
  112. },
  113. methods: {
  114. /** 查询流程达式列表 */
  115. getList() {
  116. this.loading = true;
  117. listExpression(this.queryParams).then(response => {
  118. this.expressionList = response.rows;
  119. this.total = response.total;
  120. this.loading = false;
  121. });
  122. },
  123. /** 搜索按钮操作 */
  124. handleQuery() {
  125. this.queryParams.pageNum = 1;
  126. this.getList();
  127. },
  128. /** 重置按钮操作 */
  129. resetQuery() {
  130. this.resetForm("queryForm");
  131. this.handleQuery();
  132. },
  133. // 单选框选中数据
  134. handleSingleExpSelect(selection) {
  135. this.radioSelected = selection.id;//点击当前行时,radio同样有选中效果
  136. this.$emit('handleSingleExpSelect',selection);
  137. },
  138. }
  139. };
  140. </script>