QueryConditionSimple.vue 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158
  1. <!-- 简单查询过滤 -->
  2. <template>
  3. <div>
  4. <div>
  5. <input
  6. v-model="simpleConditionValue"
  7. type="text"
  8. class="form-control input-simple"
  9. :placeholder="$t('lang.QueryConditionSimple.enterSearchCriteria')"
  10. @keyup.enter="simpleSearch"
  11. />
  12. </div>
  13. <div v-if="showButton" style="margin-top: 5px">
  14. <div>
  15. <button
  16. id="filter"
  17. type="button"
  18. class="btn btn-primary m-btn"
  19. @click="simpleSearch()"
  20. >
  21. {{ $t('lang.QueryConditionSimple.filter') }}
  22. </button>
  23. <button
  24. id="filter"
  25. type="button"
  26. class="btn btn-primary m-btn"
  27. @click="refreshSearch()"
  28. >
  29. {{ $t('lang.QueryConditionSimple.refresh') }}
  30. </button>
  31. <template v-if="!isSearchWidget">
  32. <button
  33. type="button"
  34. class="btn btn-success m-btn"
  35. @click="executeExport()"
  36. >
  37. {{ $t('lang.QueryConditionSimple.export') }}
  38. </button>
  39. <template v-for="infoButton in infoButtons" :key="infoButton.name">
  40. <button
  41. v-tooltip.right="Language.getHelpTrl($i18n.locale, infoButton)"
  42. class="btn btn-info btn-process m-btn"
  43. @click="executeProcess(infoButton)"
  44. >
  45. {{ Language.getNameTrl($i18n.locale, infoButton) }}
  46. </button>
  47. </template>
  48. </template>
  49. </div>
  50. </div>
  51. </div>
  52. </template>
  53. <script>
  54. var Language = require('../../common/Language.js').default;
  55. export default {
  56. components: {
  57. },
  58. props: {
  59. 'infoFilterFields': {
  60. type: Array,
  61. default: null,
  62. },
  63. 'infoButtons': {
  64. type: Array,
  65. default: null,
  66. },
  67. 'isSearchWidget':{
  68. type: Boolean,
  69. default: false,
  70. },
  71. 'showButton':{
  72. type: Boolean,
  73. default: false,
  74. },
  75. },
  76. emits: ['simpleSearch', 'refreshSearch', 'executeExport', 'executeProcess'],
  77. data: function () {
  78. this.Language = Language;
  79. return {
  80. simpleConditionValue: '',
  81. selectedText: [],
  82. };
  83. },
  84. methods: {
  85. /**
  86. * 触发简单查询
  87. * @return {void}
  88. */
  89. simpleSearch: function () {
  90. this.$emit('simpleSearch');
  91. },
  92. /**
  93. * 刷新搜索
  94. */
  95. refreshSearch: function () {
  96. this.$emit('refreshSearch');
  97. },
  98. /**
  99. * 执行导出
  100. * @return {void}
  101. */
  102. executeExport: function () {
  103. this.$emit('executeExport');
  104. },
  105. /**
  106. * 执行流程
  107. *
  108. */
  109. executeProcess: function (infoButton) {
  110. this.$emit('executeProcess', infoButton);
  111. },
  112. /**
  113. * 获取查询条件供外部调用
  114. * @return {Object} 查询条件
  115. */
  116. getQueryCondition: function () {
  117. var _self = this;
  118. var values = [];
  119. _self.infoFilterFields.forEach(function (item) {
  120. if (item.displayType == 'TextEditor' && item.constraintEnum != 'Between') {
  121. item.value.value1 = _self.simpleConditionValue;
  122. item.value.fieldName = item.fieldName;
  123. values.push(item.value);
  124. }
  125. });
  126. return values;
  127. },
  128. },
  129. };
  130. </script>
  131. <style scoped>
  132. .m-row {
  133. margin-bottom: 5px;
  134. text-align: left;
  135. }
  136. .input-simple {
  137. width: 100% !important;
  138. }
  139. </style>