QueryConditions.vue 7.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216
  1. <!--
  2. * @Author: your name
  3. * @Date: 2021-09-18 10:40:12
  4. * @LastEditTime: 2021-12-27 18:16:01
  5. * @LastEditors: Please set LastEditors
  6. * @Description: 查询条件组件
  7. * @FilePath: \hyyfClient\src\components\bioSafety\QueryConditions.vue
  8. -->
  9. <template>
  10. <div class="query-conditions">
  11. <!-- 标题 -->
  12. <div class="header">
  13. <div class="left">
  14. <svg
  15. t="1631933864759"
  16. class="icon"
  17. viewBox="0 0 1024 1024"
  18. version="1.1"
  19. xmlns="http://www.w3.org/2000/svg"
  20. p-id="2456"
  21. width="22"
  22. >
  23. <path
  24. d="M908.01726 958.059428c-10.45791 0-20.988969-3.181243-30.10259-9.661849-1.28353-0.913181-2.559665-1.904509-3.903953-3.032344-1.103452-0.926572-2.3592-2.032822-3.949122-3.483238-2.290247-2.086186-5.416727-5.012801-9.561118-8.945935-7.259678-6.891528-17.807926-17.040447-31.352143-30.16195-22.664234-21.957713-54.141892-52.652701-93.557768-91.231545-38.567451-37.748806-77.366346-75.833785-103.500427-101.507778-47.976472 33.203488-119.532357 68.915475-205.342977 68.915475-48.764138 0-96.103042-9.456389-140.699006-28.108542-43.08219-18.018384-81.772158-43.810496-114.994034-76.661623-33.257851-32.886103-59.379541-71.205123-77.63996-113.894979-18.931964-44.258193-28.531256-91.248933-28.531256-139.665507s9.599292-95.406115 28.531256-139.665507c18.260419-42.689856 44.382109-81.009875 77.640959-113.894779 33.221876-32.850128 71.911644-58.64344 114.993834-76.661623 44.595964-18.652154 91.933869-28.108542 140.699206-28.108542s96.103042 9.457588 140.699006 28.108542c43.08219 18.018184 81.772158 43.810496 114.992835 76.661623 33.257851 32.885104 59.379341 71.205123 77.63996 113.894779 18.932164 44.259392 28.531256 91.250132 28.531256 139.665507 0 79.223486-28.180494 155.447607-80.261383 219.23316 26.086713 25.282658 63.012877 61.094378 99.684014 96.731216 39.474436 38.364189 70.938903 69.027399 93.516596 91.142206 13.472266 13.193455 23.919782 23.479881 31.053945 30.576869 4.021074 3.999888 7.018841 7.011846 9.164187 9.209956 5.674952 5.815057 17.481947 17.914454 17.649634 38.753525l0.173682 21.502621-15.218482 15.220081C934.396175 952.954089 921.264279 958.059428 908.01726 958.059428zM426.747361 165.008916c-142.825764 0-259.022982 114.666256-259.022982 255.609697s116.197218 255.609697 259.022982 255.609697c76.88827 0 140.284687-43.093583 172.900773-70.593937l1.615705-1.506978c54.494453-50.839731 84.506704-116.010945 84.506704-183.508781C685.770344 279.675172 569.573125 165.008916 426.747361 165.008916z"
  25. p-id="2457"
  26. fill="#bfbfbf"
  27. ></path>
  28. </svg>
  29. <span>筛选查询</span>
  30. </div>
  31. <!-- 收起筛选 + 按钮 -->
  32. <div class="right">
  33. <div class="collapse">
  34. <svg
  35. t="1631934898695"
  36. class="icon"
  37. viewBox="0 0 1536 1024"
  38. version="1.1"
  39. xmlns="http://www.w3.org/2000/svg"
  40. p-id="4286"
  41. width="18"
  42. >
  43. <path
  44. d="M967.338667 722.602667a128 128 0 0 1-154.282667 11.434666l-15.36-11.434666-482.645333-426.666667A128 128 0 0 1 469.504 92.501333L484.693333 104.106667 882.688 455.68 1280.512 104.106667a128 128 0 0 1 167.253333-2.218667l13.482667 13.312c42.666667 48.128 42.325333 119.466667 2.048 167.082667l-13.141333 13.653333-482.816 426.666667z"
  45. p-id="4287"
  46. fill="#bfbfbf"
  47. ></path>
  48. </svg>
  49. <span>收起筛选</span>
  50. </div>
  51. </div>
  52. </div>
  53. <!-- 筛选条件 -->
  54. <div class="query-form">
  55. <el-form :inline="true" size="small">
  56. <el-row>
  57. <template v-for="item in formItems">
  58. <el-col :span="4" :key="item.label">
  59. <el-form-item :label="item.label">
  60. <template v-if="item.type === 'input'">
  61. <el-input
  62. style="width: 150px;"
  63. :placeholder="item.placeholder"
  64. v-model="formData[`${item.field}`]"
  65. clearable
  66. >
  67. </el-input>
  68. </template>
  69. <template v-else-if="item.type === 'select'">
  70. <el-select
  71. style="width: 150px;"
  72. :placeholder="item.placeholder"
  73. v-model="formData[`${item.field}`]"
  74. clearable
  75. >
  76. <el-option
  77. v-for="option in item.options"
  78. :key="option.value"
  79. :value="option.value"
  80. :label="option.label"
  81. >
  82. </el-option>
  83. </el-select>
  84. </template>
  85. <template v-else-if="item.type === 'datepicker'">
  86. <el-date-picker
  87. v-model="formData[`${item.field}`]"
  88. :start-placeholder="item.placeholder[0]"
  89. :end-placeholder="item.placeholder[1]"
  90. value-format="yyyy-MM-dd"
  91. type="daterange"
  92. clearable
  93. class="date-picker-reset"
  94. ref="123"
  95. >
  96. </el-date-picker>
  97. </template>
  98. </el-form-item>
  99. </el-col>
  100. </template>
  101. <el-col :span="3">
  102. <el-form-item>
  103. <el-button
  104. type="primary"
  105. size="small"
  106. @click="handleClick"
  107. style="margin-left: 30px"
  108. >
  109. 查询结果
  110. </el-button>
  111. </el-form-item>
  112. </el-col>
  113. </el-row>
  114. </el-form>
  115. </div>
  116. </div>
  117. </template>
  118. <script>
  119. export default {
  120. props: {
  121. formItems: {
  122. type: Array,
  123. default: () => [],
  124. },
  125. propFormData: {
  126. type: Object,
  127. default: () => {},
  128. },
  129. defaultEmit: {
  130. type: Boolean,
  131. default: false,
  132. },
  133. },
  134. data() {
  135. return {
  136. formData: {},
  137. };
  138. },
  139. methods: {
  140. handleClick() {
  141. this.$emit("getQueryParams", this.formData);
  142. },
  143. },
  144. mounted() {
  145. this.$nextTick(() => {
  146. if (this.propFormData.time) {
  147. this.formData.time = this.propFormData.time;
  148. if (this.defaultEmit) {
  149. this.$emit("getQueryParams", this.formData);
  150. }
  151. }
  152. });
  153. },
  154. watch: {
  155. propFormData: {
  156. handler(newValue) {
  157. this.formData = { ...newValue };
  158. },
  159. deep: true,
  160. },
  161. },
  162. };
  163. </script>
  164. <style scoped>
  165. .query-conditions {
  166. border: 1px solid rgba(228, 228, 228, 1);
  167. }
  168. /* 标题栏 */
  169. .header {
  170. background-color: #f3f3f3;
  171. color: #bcbcbc;
  172. font-size: 12px;
  173. padding: 12px 15px;
  174. border-bottom: 1px solid rgba(228, 228, 228, 1);
  175. }
  176. /* 左边 */
  177. .header > .left {
  178. position: relative;
  179. display: inline-block;
  180. }
  181. .header > .left > svg {
  182. position: absolute;
  183. padding-left: 4px;
  184. }
  185. .header > .left > span {
  186. margin-left: 25px;
  187. }
  188. /* 右边 */
  189. .header > .right {
  190. float: right;
  191. }
  192. .header > .right > .collapse {
  193. margin-right: 10px;
  194. }
  195. .header > .right > .collapse > svg {
  196. position: relative;
  197. top: 4px;
  198. margin-right: 2px;
  199. }
  200. /* form */
  201. .query-form {
  202. padding: 20px 22px 5px;
  203. position: relative;
  204. }
  205. .date-picker-reset {
  206. position: absolute;
  207. width: 230px;
  208. }
  209. </style>