zs 1 年之前
父節點
當前提交
da4e0d6228
共有 1 個文件被更改,包括 29 次插入4 次删除
  1. 29 4
      src/views/demand/index.vue

+ 29 - 4
src/views/demand/index.vue

@@ -229,7 +229,6 @@ import demand from '@/assets/innovation.png'
 const router = useRouter()
 // 加载中
 const loading = ref(false)
-const searchForm = ref({})
 // 列表
 const list = ref([])
 let skip = 0
@@ -277,10 +276,30 @@ const search = async (query = { skip: 0, limit }) => {
   const info = {
     skip: query.skip,
     limit: query.limit,
-    ...searchForm.value,
     is_use: '0',
     status: '1'
   }
+  if (oneList.value.length > 0) {
+    const one = oneList.value.map((i) => {
+      return i.value
+    })
+    info.one = one
+  }
+  if (twoList.value.length > 0) {
+    info.two = twoList.value.map((i) => {
+      return i.value
+    })
+  }
+  if (thrList.value.length > 0) {
+    info.thr = thrList.value.map((i) => {
+      return i.label
+    })
+  }
+  if (fourList.value.length > 0) {
+    info.four = fourList.value.map((i) => {
+      return i.value
+    })
+  }
   const res = await store.list(info)
   if (res.errcode == '0') {
     list.value = res.data
@@ -299,7 +318,7 @@ const getArea = (data) => {
   else return '暂无地区'
 }
 // 选择查询
-const toSelect = (item, num) => {
+const toSelect = async (item, num) => {
   if (item.is_active) return
   if (num == 'one') {
     for (const val of fieldList.value) {
@@ -333,9 +352,12 @@ const toSelect = (item, num) => {
     if (!four) fourList.value.push(item)
     else fourList.value = fourList.value.filter((f) => f.value == item.value)
   }
+  loading.value = true
+  await search({ skip, limit })
+  loading.value = false
 }
 // 删除标签
-const toDel = (item, type) => {
+const toDel = async (item, type) => {
   if (type == 'one') {
     const one = oneList.value.filter((f) => f.value != item.value)
     oneList.value = one
@@ -364,6 +386,9 @@ const toDel = (item, type) => {
       if (i.value == item.value) i.is_active = !i.is_active
     }
   }
+  loading.value = true
+  await search({ skip, limit })
+  loading.value = false
 }
 const formatName = (str) => {
   if (str) return str.substr(0, 1) + new Array(str.length).join('*')