Search.vue 4.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172
  1. <template>
  2. <div class="wrapper">
  3. <span class="sqrk" @click="showModal">申请库({{ resNum }})</span>
  4. <span>
  5. <a-select ref="select" v-model:value="value" style="width: 200px" :options="options"
  6. @change="handleChange">
  7. </a-select>
  8. </span>
  9. <span>
  10. <a-input-search v-model:value="key" placeholder="请输入搜索内容" style="width: 200px" @search="onSearch" />
  11. </span>
  12. <div class="total-num">
  13. <!-- <a-checkbox v-model:checked="checked1">全部</a-checkbox>
  14. <a-checkbox v-model:checked="checked2">测试数据1</a-checkbox>
  15. <a-checkbox v-model:checked="checked3">测试数据2</a-checkbox>
  16. <a-checkbox v-model:checked="checked4">测试数据3</a-checkbox> -->
  17. 共有<span>{{ num }}</span>个通用接口
  18. </div>
  19. <!-- <a-modal style="top: 50px" v-model:visible="visible" title="申请库" @ok="handleOk" width="1440px">
  20. <library></library>
  21. </a-modal> -->
  22. <InterfaceCarModal v-if="visible" @closeModal="visible = false"/>
  23. </div>
  24. </template>
  25. <script>
  26. import { defineComponent, ref, computed, unref, watch, onMounted } from 'vue';
  27. import library from "../../library/index.vue";
  28. import InterfaceCarModal from './InterfaceCarModal.vue';
  29. import { getResInCar } from '/@/api/resource/plat';
  30. import { session } from '/@/utils/Memory';
  31. import { message } from 'ant-design-vue';
  32. const props = {
  33. totalNum:{
  34. type:Number,
  35. default:0
  36. }
  37. }
  38. export default defineComponent({
  39. name: 'Search',
  40. components: { library, InterfaceCarModal },
  41. props,
  42. setup(props,{emit}) {
  43. const value = ref('1');
  44. const key = ref('');
  45. const checked1 = ref(false);
  46. const checked2 = ref(false);
  47. const checked3 = ref(false);
  48. const checked4 = ref(false);
  49. const options = ref([
  50. {
  51. value: '1',
  52. label: '已审核',
  53. },
  54. {
  55. value: '2',
  56. label: '未审核',
  57. },
  58. {
  59. value: '3',
  60. label: '未通过',
  61. },
  62. ]);
  63. function onSearch(e) {
  64. emit("interfaceSearch", e);
  65. }
  66. const visible = ref(false);
  67. const showModal = () => {
  68. visible.value = true;
  69. };
  70. // const handleOk = (e) => {
  71. // console.log(e);
  72. // visible.value = false;
  73. // };
  74. const num = ref(props.totalNum);
  75. const resNum = ref(0)
  76. onMounted(() => {
  77. getResData();
  78. })
  79. const getResData = () => {
  80. getResInCar({
  81. userId: session.getItem('userId'),
  82. }).then((res) => {
  83. if (res.datas) {
  84. let resData = res.datas.filter(item=>item.applyCarInfo.workflowType==='INTERFACE')
  85. resNum.value = resData.length
  86. }
  87. })
  88. }
  89. watch(
  90. ()=>props.totalNum,
  91. (val)=>{
  92. num.value = val
  93. }
  94. )
  95. const handleChange = ()=>{
  96. }
  97. return {
  98. num,
  99. resNum,
  100. visible,
  101. showModal,
  102. // handleOk,
  103. options,
  104. value,
  105. key,
  106. onSearch,
  107. checked1,
  108. checked2,
  109. checked3,
  110. checked4,
  111. handleChange,
  112. getResData
  113. };
  114. },
  115. });
  116. </script>
  117. <style scoped>
  118. .wrapper>div {
  119. float: right;
  120. height: 32px;
  121. padding: 5px 0;
  122. }
  123. .wrapper>span {
  124. display: inline-block;
  125. margin-right: 20px
  126. }
  127. .wrapper {
  128. width: 100%;
  129. height: 54px;
  130. padding: 11px;
  131. margin-bottom: 10px;
  132. /* border-bottom: solid 1px #DEDEDE; */
  133. background: #F8F8F8;
  134. border-radius: 4px;
  135. }
  136. .sqrk {
  137. cursor: pointer;
  138. width: 94px;
  139. height: 32px;
  140. background: #0671DD;
  141. color: #fff;
  142. line-height: 32px;
  143. display: block;
  144. text-align: center;
  145. border-radius: 4px;
  146. }
  147. .total-num {
  148. font-family: Source Han Sans CN;
  149. font-size: 16px;
  150. font-weight: normal;
  151. color: #333333;
  152. }
  153. .total-num>span{
  154. font-size: 20px;
  155. color: #0671DD;
  156. }
  157. </style>