index.vue 2.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091
  1. <template>
  2. <view class="approve-container">
  3. <view class="approve-search">
  4. <u-search
  5. placeholder="查询流程"
  6. v-model="keyword"
  7. bg-color="#fff"
  8. margin="0 0 10rpx 0"
  9. :input-style="{fontSize: variables.mainFontSize}"
  10. :action-style="{fontSize: variables.mainFontSize}"
  11. :border-color="variables.mainColor"
  12. @search="() => searchKeyWord = keyword"
  13. @custom="() => searchKeyWord = keyword"
  14. />
  15. </view>
  16. <view class="approve-list">
  17. <todo-list :approve-list-height="approveListHeight" :search-key-word="searchKeyWord" v-if="type === 'todo'"/>
  18. <done-list :approve-list-height="approveListHeight" :search-key-word="searchKeyWord" v-else-if="type === 'done'"/>
  19. <launch-list :approve-list-height="approveListHeight" :search-key-word="searchKeyWord" v-else/>
  20. </view>
  21. </view>
  22. </template>
  23. <script>
  24. import variables from '@/styles/variables.scss'
  25. import doneList from './doneList'
  26. import launchList from './launchList'
  27. import todoList from './todoList'
  28. export default {
  29. components: {
  30. todoList,
  31. launchList,
  32. doneList
  33. },
  34. data() {
  35. return {
  36. keyword: '',
  37. searchKeyWord: '',
  38. current: 0,
  39. variables,
  40. searchHeight: 0,
  41. approveContainerHeight: 0
  42. };
  43. },
  44. created() {
  45. this.computedHeight()
  46. },
  47. computed: {
  48. approveListHeight() {
  49. return this.approveContainerHeight - this.searchHeight
  50. }
  51. },
  52. props: {
  53. type: {
  54. type: String,
  55. required: true
  56. }
  57. },
  58. methods: {
  59. handleChange(index) {
  60. this.current = index
  61. this.keyword = ''
  62. this.searchKeyWord = ''
  63. },
  64. async computedHeight() {
  65. await this.$nextTick()
  66. const query = uni.createSelectorQuery().in(this)
  67. query.select(".approve-container")
  68. .boundingClientRect(data => {
  69. this.approveContainerHeight = data.height
  70. }).exec()
  71. query.select(".approve-search")
  72. .boundingClientRect(data => {
  73. this.searchHeight = data.height
  74. }).exec()
  75. }
  76. }
  77. }
  78. </script>
  79. <style lang="scss">
  80. .approve-container {
  81. height: 100%;
  82. display: flex;
  83. flex-direction: column;
  84. background-color: #fff;
  85. padding: 10rpx;
  86. }
  87. </style>