Search.vue 4.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149
  1. <template>
  2. <div class="wrapper">
  3. <span class="sqrk" @click="showModal">申请库({{ total }})</span>
  4. <span>
  5. <a-select ref="select" v-model:value="value" allowClear="true" style="width: 200px" :options="options"
  6. @change="handleChange"></a-select>
  7. </span>
  8. <span><a-input-search allowClear="true" v-model:value="key" placeholder="请输入搜索内容" style="width: 200px"
  9. @search="onSearch" /></span>
  10. <div>
  11. <!-- <a-checkbox v-model:checked="checked1">全部</a-checkbox> -->
  12. <!-- <a-checkbox v-model:checked="checked2">测试数据1</a-checkbox>
  13. <a-checkbox v-model:checked="checked3">测试数据2</a-checkbox>
  14. <a-checkbox v-model:checked="checked4">测试数据3</a-checkbox> -->
  15. </div>
  16. <a-modal v-model:visible="visible" title="申请库" @ok="handleOk" width="1440px" height="980px">
  17. <library></library>
  18. </a-modal>
  19. </div>
  20. </template>
  21. <script lang="ts">
  22. import { defineComponent, ref, computed, unref, onMounted, getCurrentInstance } from 'vue';
  23. import library from "../../library/index.vue"
  24. import { getAssemblyLibsTotal } from '/@/api/dataAdmin/assembly';
  25. import eventBus from '/@/utils/eventBus';
  26. export default defineComponent({
  27. name: 'Search',
  28. components: { library },
  29. setup() {
  30. const value = ref<string>('');
  31. const key = ref<string>('');
  32. const checked1 = ref<boolean>(false);
  33. const checked2 = ref<boolean>(false);
  34. const checked3 = ref<boolean>(false);
  35. const checked4 = ref<boolean>(false);
  36. const currentInstance = getCurrentInstance();
  37. const parentSetup = currentInstance.parent.setupState;
  38. const options = ref<SelectTypes['options']>([
  39. {
  40. value: '',
  41. label: '全部',
  42. },
  43. {
  44. value: '未加入',
  45. label: '加入申请库',
  46. },
  47. {
  48. value: '已加入',
  49. label: '已加入申请库',
  50. },
  51. {
  52. value: '审核通过',
  53. label: '审核通过',
  54. },
  55. {
  56. value: '审核不通过',
  57. label: '审核不通过',
  58. },
  59. {
  60. value: '审核中',
  61. label: '审核中',
  62. },
  63. ]);
  64. // 未加入、已加入、审核通过、审核不通过、审核中
  65. function onSearch() {
  66. parentSetup.getDataList({ sqkzt: value.value, filterValue: key.value })
  67. }
  68. const visible = ref<boolean>(false);
  69. const showModal = () => {
  70. visible.value = true;
  71. eventBus.emit("assemblyReload")
  72. };
  73. const handleOk = (e: MouseEvent) => {
  74. console.log(e);
  75. visible.value = false;
  76. };
  77. const total = ref(0);
  78. onMounted(() => getTotalNum())
  79. eventBus.on("getAssemblyLibsTotal", () => getTotalNum());
  80. function getTotalNum() {
  81. getAssemblyLibsTotal().then(i => total.value = i);
  82. }
  83. function handleChange(value: string) {
  84. console.log(value);
  85. parentSetup.getDataList({ sqkzt: value, filterValue: key.value })
  86. }
  87. return {
  88. handleChange,
  89. total,
  90. visible,
  91. showModal,
  92. handleOk,
  93. options,
  94. value,
  95. key,
  96. onSearch,
  97. checked1,
  98. checked2,
  99. checked3,
  100. checked4,
  101. };
  102. },
  103. });
  104. </script>
  105. <style scoped>
  106. .wrapper>div {
  107. float: right;
  108. height: 32px;
  109. padding: 5px 0;
  110. }
  111. .wrapper>span {
  112. display: inline-block;
  113. margin-right: 30px
  114. }
  115. .wrapper {
  116. width: 100%;
  117. height: 54px;
  118. padding: 11px;
  119. margin-bottom: 20px;
  120. border-bottom: solid 1px #DEDEDE;
  121. }
  122. .sqrk {
  123. cursor: pointer;
  124. width: 94px;
  125. height: 32px;
  126. background: #0671DD;
  127. color: #fff;
  128. line-height: 32px;
  129. display: block;
  130. text-align: center;
  131. border-radius: 4px;
  132. }
  133. </style>