search.vue 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111
  1. <template>
  2. <u-collapse :value="collapseOpen">
  3. <u-collapse-item title="查询条件" icon="search">
  4. <u--form labelPosition="left">
  5. <u-form-item label="企业名称" labelWidth="80" borderBottom><u--input placeholder="请输入企业名称" v-model="searchInfo.company_name" border="none"></u--input></u-form-item>
  6. <u-form-item
  7. label="告警类型"
  8. borderBottom
  9. labelWidth="80"
  10. @click="
  11. showAlarmType = true;
  12. hideKeyboard();
  13. "
  14. >
  15. <u--input v-model="alarmTypeName" disabled disabledColor="#ffffff" placeholder="请选择告警类型" border="none"></u--input>
  16. <u-icon slot="right" name="arrow-right"></u-icon>
  17. </u-form-item>
  18. <view class="btn-search-group">
  19. <u-button type="primary" customStyle="margin:0 20px;" text="查询" @click="confirm"></u-button>
  20. <u-button type="error" customStyle="margin:0 20px;" text="重置" @click="reset"></u-button>
  21. </view>
  22. </u--form>
  23. <u-action-sheet :show="showAlarmType" :actions="alarmTypeActions" title="请选择告警类型" @close="showAlarmType = false" @select="alarmTypeSelect"></u-action-sheet>
  24. </u-collapse-item>
  25. </u-collapse>
  26. </template>
  27. <script>
  28. import { log } from "@/utils/base.js";
  29. import api from "@/common/api.js";
  30. export default {
  31. name: "inspector_search",
  32. data() {
  33. return {
  34. collapseOpen: [],
  35. needQuery: true,
  36. isQuerying: false,
  37. showAlarmType: false,
  38. alarmTypeActions: [],
  39. searchInfo: {
  40. company_name: "",
  41. warn_type: "",
  42. },
  43. };
  44. },
  45. computed: {
  46. alarmTypeName: {
  47. get() {
  48. if (this.alarmTypeActions && this.alarmTypeActions.length) {
  49. var active = this.alarmTypeActions.find(v => v.code == this.searchInfo.warn_type);
  50. if (active) {
  51. return active.name;
  52. }
  53. }
  54. return "";
  55. },
  56. set() {},
  57. },
  58. },
  59. mounted() {
  60. this.getExceedWarnTypeAction();
  61. },
  62. methods: {
  63. hideKeyboard() {
  64. uni.hideKeyboard();
  65. },
  66. alarmTypeSelect(e) {
  67. this.searchInfo.warn_type = e.code;
  68. },
  69. getExceedWarnTypeAction() {
  70. api.getExceedWarnType(1).then(({ data }) => {
  71. log("getExceedWarnType", data);
  72. this.alarmTypeActions = data.list;
  73. });
  74. },
  75. reset() {
  76. this.searchInfo.company_name = "";
  77. this.searchInfo.warn_type = "";
  78. this.$emit("reset");
  79. },
  80. confirm() {
  81. this.$emit("confirm");
  82. this.collapseOpen = [];
  83. console.log(this.collapseOpen);
  84. },
  85. },
  86. };
  87. </script>
  88. <style lang="scss">
  89. .btn-search-group {
  90. display: flex;
  91. justify-content: space-between;
  92. margin-top: 15px;
  93. }
  94. /deep/ .u-collapse-item {
  95. position: relative;
  96. &__content {
  97. position: absolute;
  98. top: 43px;
  99. width: 100%;
  100. z-index: 1000;
  101. background: #f5f5f5;
  102. }
  103. }
  104. /deep/ .u-input.u-input--square {
  105. background: transparent !important;
  106. }
  107. </style>