yls 1 yıl önce
ebeveyn
işleme
6f1098f5ba

+ 2 - 2
src/components/ListHeader.vue

@@ -11,7 +11,7 @@
         <span>下载</span>
       </div>
     </div>
-    <el-input v-model="inputVal" class="list-search" placeholder="请输入搜索关键字">
+    <el-input v-model="inputVal" class="list-search" placeholder="请输入搜索关键字" clearable @clear="handleSearch">
       <template #suffix>
         <img class="search-btn" src="../assets/imgs/pages/btn-search.png" alt="" @click="handleSearch">
       </template>
@@ -37,7 +37,7 @@ const props = defineProps({
 const inputVal = ref('')
 
 function handleSearch() {
-  console.log(inputVal.value)
+  emit('search', inputVal.value)
 }
 
 const emit = defineEmits(['addItem'])

+ 1 - 1
src/service/servicePublish.js

@@ -4,7 +4,7 @@ export function ServicePublishList(page,limit,quickSearch) {
     return request({
         url: '/service/dataService/list',
         method: "post",
-        data: {page,limit,quickSearch }
+        data: {page,limit,quickSearch:JSON.stringify((quickSearch)) }
     })
 }
 

+ 1 - 1
src/service/warrantManage.js

@@ -4,7 +4,7 @@ export function WarrantManageList(page,limit,quickSearch) {
     return request({
         url: 'service/dataApplication/listForAudit',
         method: "post",
-        data: {page,limit,quickSearch }
+        data: {page,limit,quickSearch:JSON.stringify((quickSearch)) }
     })
 }
 // 服务基础信息

+ 9 - 4
src/views/servicePublish/Index.vue

@@ -1,6 +1,7 @@
 <template>
+
     <div id="service-publish" class="page-list">
-        <ListHeader title="数据列表" :add-btn-name="'新建服务'" @add-item="handleAdd"/>
+        <ListHeader title="数据列表" :add-btn-name="'新建服务'" @add-item="handleAdd" @search="val=>handleSearch(val)"/>
         <div class="list-main">
             <el-table :data="tableData.value" ref="table" class="table-default" id="table-list" stripe>
                 <el-table-column type="index" :index="indexCreate" label="序号" min-width="50"/>
@@ -73,7 +74,7 @@
 
     const currentPage = ref(1)
     const pageSize = ref(10)
-    const quickSearch = ref("{\"serviceName\":\"\"}")
+    const quickSearch = reactive({serviceName:''})
     const tableTotal = ref(20)
 
     function pagi_changePage(page) {
@@ -84,9 +85,13 @@
     function indexCreate(index) {
         return index + 1 + pageSize.value * (currentPage.value - 1)
     }
-
+    //搜索
+    function handleSearch (val){
+        quickSearch.serviceName=val
+        getData()
+    }
     function getData() {
-        ServicePublishList(currentPage.value, pageSize.value, quickSearch.value).then(res => {
+        ServicePublishList(currentPage.value, pageSize.value, quickSearch).then(res => {
             tableData.value = res.data.records
             tableTotal.value = res.data.total
             for (let data of tableData.value) {

+ 7 - 4
src/views/warrantManage/Index.vue

@@ -1,6 +1,6 @@
 <template>
   <div id="warrant-manage" class="page-list">
-    <ListHeader title="数据列表"/>
+    <ListHeader title="数据列表" @search="val=>handleSearch(val)"/>
     <div class="list-main">
       <el-table :data="tableData.value" ref="table" class="table-default" id="table-list" stripe>
         <el-table-column type="index" :index="indexCreate" label="序号" min-width="50"/>
@@ -52,7 +52,7 @@ onMounted(() => {
 
 const currentPage = ref(1)
 const pageSize = ref(10)
-const quickSearch = ref("{\"name\":null}")
+const quickSearch = reactive({name:''})
 const tableTotal = ref(20)
 
 function pagi_changePage(page) {
@@ -63,9 +63,12 @@ function pagi_changePage(page) {
 function indexCreate(index) {
   return index + 1 + pageSize.value*(currentPage.value - 1)
 }
-
+function handleSearch (val){
+  quickSearch.name=val
+  getData()
+}
 function getData(page, size) {
-  WarrantManageList(currentPage.value, pageSize.value, quickSearch.value).then(res => {
+  WarrantManageList(currentPage.value, pageSize.value, quickSearch).then(res => {
     tableData.value = res.data.records
     tableTotal.value = res.data.total
     for (let data of tableData.value) {