step-search.vue 2.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485
  1. <!-- 搜索表单 -->
  2. <template>
  3. <el-form
  4. label-width="77px"
  5. class="ele-form-search"
  6. @keyup.enter.native="search"
  7. @submit.native.prevent
  8. >
  9. <el-row :gutter="15">
  10. <el-col v-bind="styleResponsive ? { lg: 5, md: 12 } : { span: 6 }">
  11. <el-form-item label="编码:">
  12. <el-input clearable v-model="where.code" placeholder="请输入" />
  13. </el-form-item>
  14. </el-col>
  15. <el-col v-bind="styleResponsive ? { lg: 5, md: 12 } : { span: 6 }">
  16. <el-form-item label="名称:">
  17. <el-input clearable v-model="where.name" placeholder="请输入" />
  18. </el-form-item>
  19. </el-col>
  20. <el-col v-bind="styleResponsive ? { lg: 6, md: 12 } : { span: 6 }">
  21. <div class="ele-form-actions">
  22. <el-button
  23. type="primary"
  24. icon="el-icon-search"
  25. class="ele-btn-icon"
  26. @click="search"
  27. >
  28. 查询
  29. </el-button>
  30. <el-button @click="reset">重置</el-button>
  31. </div>
  32. </el-col>
  33. </el-row>
  34. </el-form>
  35. </template>
  36. import control from '@/api/technology/control';
  37. <script>
  38. import control from '@/api/technology/control';
  39. export default {
  40. data() {
  41. // 默认表单数据
  42. const defaultWhere = {
  43. code: '',
  44. name: '',
  45. controlId: null
  46. };
  47. return {
  48. // 表单数据
  49. where: { ...defaultWhere },
  50. controlList: []
  51. };
  52. },
  53. computed: {
  54. // 是否开启响应式布局
  55. styleResponsive() {
  56. return this.$store.state.theme.styleResponsive;
  57. }
  58. },
  59. created() {
  60. this.getControlList();
  61. },
  62. methods: {
  63. /* 搜索 */
  64. search() {
  65. this.$emit('search', this.where);
  66. },
  67. /* 重置 */
  68. reset() {
  69. this.where = { ...this.defaultWhere };
  70. this.search();
  71. },
  72. getControlList() {
  73. const params = {
  74. pageNum: 1,
  75. size: -1
  76. };
  77. control.list().then((res) => {
  78. this.controlList = res.list;
  79. });
  80. }
  81. }
  82. };
  83. </script>