index.vue 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109
  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="16rpx 24rpx"
  9. :input-style="{
  10. fontSize: variables.mainFontSize,
  11. padding: '0rpx 40rpx',
  12. }"
  13. :action-style="{fontSize: variables.mainFontSize}"
  14. :border-color="'#F2F2F2'"
  15. :bg-color="'#F2F2F2'"
  16. :height="74"
  17. @search="() => searchKeyWord = keyword"
  18. @custom="() => searchKeyWord = keyword"
  19. :show-action="false"
  20. input-align="center"
  21. />
  22. </view>
  23. <view class="approve-list">
  24. <todo-list :approve-list-height="approveListHeight" :search-key-word="searchKeyWord" v-if="type === 'todo'"/>
  25. <done-list :approve-list-height="approveListHeight" :search-key-word="searchKeyWord" v-else-if="type === 'done'"/>
  26. <launch-list :approve-list-height="approveListHeight" :search-key-word="searchKeyWord" v-else/>
  27. </view>
  28. </view>
  29. </template>
  30. <script>
  31. import variables from '@/styles/variables.scss'
  32. import doneList from './doneList'
  33. import launchList from './launchList'
  34. import todoList from './todoList'
  35. export default {
  36. components: {
  37. todoList,
  38. launchList,
  39. doneList
  40. },
  41. data() {
  42. return {
  43. keyword: '',
  44. searchKeyWord: '',
  45. current: 0,
  46. variables,
  47. searchHeight: 0,
  48. approveContainerHeight: 0
  49. };
  50. },
  51. created() {
  52. this.computedHeight()
  53. },
  54. computed: {
  55. approveListHeight() {
  56. return this.approveContainerHeight - this.searchHeight
  57. }
  58. },
  59. props: {
  60. type: {
  61. type: String,
  62. required: true
  63. }
  64. },
  65. methods: {
  66. handleChange(index) {
  67. this.current = index
  68. this.keyword = ''
  69. this.searchKeyWord = ''
  70. },
  71. async computedHeight() {
  72. await this.$nextTick()
  73. const query = uni.createSelectorQuery().in(this)
  74. query.select(".approve-container")
  75. .boundingClientRect(data => {
  76. this.approveContainerHeight = data.height
  77. }).exec()
  78. query.select(".approve-search")
  79. .boundingClientRect(data => {
  80. this.searchHeight = data.height
  81. }).exec()
  82. }
  83. }
  84. }
  85. </script>
  86. <style lang="scss">
  87. .approve-container {
  88. height: 100%;
  89. display: flex;
  90. flex-direction: column;
  91. // background-color: #fff;
  92. // padding: 10rpx;
  93. .approve-search{
  94. background-color: #fff;
  95. padding: 0 10rpx;
  96. }
  97. }
  98. ::v-deep {
  99. .u-content {
  100. background-color: #F2F2F2 !important;
  101. }
  102. }
  103. </style>