search.vue.btl 4.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899
  1. <template>
  2. <%
  3. var searchCount = 0;
  4. var row = 0;
  5. %>
  6. <% for(var i = 0; i < configList.~size; i++) { %>
  7. <% if(!configList[i].needTableId && configList[i].needPage) { searchCount ++; }%>
  8. <% } %>
  9. <uv-popup ref="popRef" mode="bottom" bg-color="null" z-index="99">
  10. <view class="container">
  11. <view class="close">
  12. <icon type="clear" :size="20" color="#5677fc" @click="close"></icon>
  13. </view>
  14. <% if (searchCount > 0) { %>
  15. <uv-form ref="formRef" :model="searchFormState" label-position="top" labelWidth="auto" :labelStyle="{marginBottom: '25rpx', fontSize: '27rpx', color: '#606266'}">
  16. <% for(var i = 0; i < configList.~size; i++) { %>
  17. <% if(!configList[i].needTableId && configList[i].needPage) { %>
  18. <% if(configList[i].effectType == 'input' || configList[i].effectType == 'textarea') { %>
  19. <uv-form-item label="${configList[i].fieldRemark}" prop="${configList[i].fieldNameCamelCase}">
  20. <uv-input v-model="searchFormState.${configList[i].fieldNameCamelCase}" placeholder="请输入${configList[i].fieldRemark}"></uv-input>
  21. </uv-form-item>
  22. <% } else if (configList[i].effectType == 'select' || configList[i].effectType == 'radio' || configList[i].effectType == 'checkbox') {%>
  23. <uv-form-item label="${configList[i].fieldRemark}" prop="${configList[i].fieldNameCamelCase}">
  24. <snowy-sel-picker :map="{key: 'value', label: 'text'}" v-model="searchFormState.${configList[i].fieldNameCamelCase}" :rangeData="${configList[i].fieldNameCamelCase}Options" placeholder="请选择${configList[i].fieldRemark}"></snowy-sel-picker>
  25. </uv-form-item>
  26. <% } else {%>
  27. <uv-form-item label="${configList[i].fieldRemark}" prop="${configList[i].fieldNameCamelCase}">
  28. <uv-input v-model="searchFormState.${configList[i].fieldNameCamelCase}" placeholder="请输入${configList[i].fieldRemark}"></uv-input>
  29. </uv-form-item>
  30. <% } %>
  31. <% } %>
  32. <% } %>
  33. </uv-form>
  34. <% } %>
  35. <uv-row :gutter="10">
  36. <uv-col :span="6">
  37. <tui-button height="90rpx" type="gray" @click="reset">重置</tui-button>
  38. </uv-col>
  39. <uv-col :span="6">
  40. <tui-button height="90rpx" type="primary" @click="confirm">确认</tui-button>
  41. </uv-col>
  42. </uv-row>
  43. </view>
  44. </uv-popup>
  45. </template>
  46. <script setup name="${classNameFirstLower}Search">
  47. import { ref } from "vue"
  48. const emits = defineEmits(['reset', 'confirm'])
  49. const props = defineProps({
  50. searchFormState: {
  51. type: Object,
  52. required: true
  53. },
  54. })
  55. <% if (searchCount > 0) { %>
  56. <% for(var i = 0; i < configList.~size; i++) { %>
  57. <% if(!configList[i].needTableId && configList[i].needPage) { %>
  58. <% if (configList[i].effectType == 'select' || configList[i].effectType == 'radio' || configList[i].effectType == 'checkbox') { %>
  59. const ${configList[i].fieldNameCamelCase}Options = uni.$snowy.tool.dictList('${configList[i].dictTypeCode}')
  60. <% } %>
  61. <% } %>
  62. <% } %>
  63. <% } %>
  64. const popRef = ref()
  65. const open = () => {
  66. popRef.value.open()
  67. }
  68. const reset = () =>{
  69. // 重置数据
  70. <% for(var i = 0; i < configList.~size; i++) { %>
  71. <% if(!configList[i].needTableId && configList[i].needPage) { %>
  72. props.searchFormState.${configList[i].fieldNameCamelCase} = ''
  73. <% } %>
  74. <% } %>
  75. emits('reset', props.searchFormState)
  76. }
  77. const confirm = () => {
  78. popRef.value.close()
  79. emits('confirm', props.searchFormState)
  80. }
  81. const close = () => {
  82. popRef.value.close()
  83. }
  84. defineExpose({
  85. open
  86. })
  87. </script>
  88. <style lang="scss" scoped>
  89. .container {
  90. margin: 5rpx;
  91. border-radius: 10rpx;
  92. padding: 20rpx;
  93. background-color: white;
  94. .close {
  95. display: flex;
  96. justify-content: flex-end;
  97. }
  98. }
  99. </style>