Browse Source

Merge branch 'feature/v1.0.36' into dev/1.0.36_zsy

zhangsiya 1 year ago
parent
commit
1bd62a2360

+ 15 - 7
apps/bigmember_pc/src/components/filter-items/CommonCheckboxSelector.vue

@@ -10,8 +10,8 @@
       >
       <el-checkbox-button
         class="j-checkbox-button"
-        v-for="state in options.value"
-        :key="state"
+        v-for="(state, index) in options.value"
+        :key="index"
         :label="setSelectValue(state)"
       >
         {{ field ? setSelectValue(state) : state }}
@@ -26,7 +26,7 @@ const props = defineProps({
   // 是否单选
   sigle: {
     type: Boolean,
-    default: false
+    default: true
   },
   // field: 空代表字符串数组
   // 其他: options是对象数组,field是对象数组的某个字段
@@ -44,7 +44,7 @@ const props = defineProps({
   }
 })
 function setSelectValue(state) {
-  if (props.dataType === '') {
+  if (props.field === '') {
     return state
   } else {
     return state[props.field]
@@ -56,9 +56,17 @@ function onIssueStateChange(value) {
   if (isAllBtn.length > 0) {
     value = ['全部']
   } else {
-    value = value.filter((item) => item !== '全部')
-    if (value.length === 0) {
-      value = ['全部']
+    // 如果是单选,则只取最新一个
+    if (props.sigle) {
+      const nonAllValues = value.filter((item) => item !== '全部')
+      value = nonAllValues.length
+        ? [nonAllValues[nonAllValues.length - 1]]
+        : ['全部']
+    } else {
+      value = value.filter((item) => item !== '全部')
+      if (value.length === 0) {
+        value = ['全部']
+      }
     }
   }
   emit('input', value)

+ 13 - 0
apps/bigmember_pc/src/components/selector/TimeSelector.vue

@@ -41,6 +41,12 @@ export default {
     showExact: {
       type: Boolean,
       default: true
+    },
+    value: {
+      type: [Object, String],
+      default: () => {
+        return {}
+      }
     }
   },
   data() {
@@ -51,6 +57,13 @@ export default {
     prop: 'value',
     event: 'change'
   },
+  watch: {
+    value (val) {
+      if (val) {
+        this.setState(val)
+      }
+    }
+  },
   methods: {
     setState(data) {
       return this.$refs.content.setState(data)

+ 1 - 2
apps/bigmember_pc/src/views/search/components/search-header-card.vue

@@ -71,9 +71,8 @@ function goWorkSpaceCustom() {
 
 <style lang="scss" scoped>
 .search-header-card {
-  //
   .tab-header {
-    padding: 0 32px;
+    padding: 0 16px;
     height: 48px;
     line-height: 48px;
     border-bottom: 1px solid #ececec;

+ 2 - 0
apps/bigmember_pc/src/views/search/nzj/model/base.js

@@ -137,6 +137,7 @@ export default function () {
   }
 
   function doChangeInput(data) {
+    console.log(data)
     let { area, build, civil, electromechanical, project_stage, ownerclass } =
       data
     const areaJudge = checkIfArrayHasOnlyValue(area, '全部')
@@ -200,6 +201,7 @@ export default function () {
   }
 
   function checkIfArrayHasOnlyValue(arr, value) {
+    if (!arr) arr = []
     return arr.length === 1 && arr[0] === value
   }
 

+ 1 - 1
apps/bigmember_pc/src/views/search/supply/constant/search-filters.js

@@ -49,7 +49,7 @@ const SearchSupplyBaseSchema = [
   {
     key: 'time',
     label: '发布时间:',
-    defaultVal: [],
+    defaultVal: {},
     _name: 'type',
     _type: 'component',
     expand: {

+ 15 - 0
apps/bigmember_pc/src/views/search/supply/index.vue

@@ -3,6 +3,7 @@ import SearchHeaderCard from '@/views/search/components/search-header-card.vue'
 import SearchSchemaFilter from '@/views/search/components/search-schema-filter.vue'
 import SearchList from '@/views/search/layout/search-list.vue'
 import { SupplyArticleItem } from '@jy/pc-ui'
+import { onMounted } from 'vue'
 import { SearchSupplyBaseSchema } from './constant/search-filters'
 // 导入业务模型
 import { useSearchSupplyModel, SearchSupplyModel } from './model/index'
@@ -18,6 +19,7 @@ const {
   searchTabs,
   inputKeywordsState,
   doSearch,
+  getFormatAPIParams,
   searchListProps,
   doChangePageNum,
   doChangePageSize,
@@ -38,6 +40,18 @@ function goDetail(item) {
   const routerUrl = `/swordfish/page_web_pc/demand/detail/${id}?matchKey=${inputKeywordsState.value.input}`
   window.open(routerUrl)
 }
+
+function goWorkSpaceCustom() {
+  const supplyData = {
+    showFilter: showFilter.value,
+    keywords: inputKeywordsState.value.input,
+    filterState: filterState.value,
+    ...getFormatAPIParams()
+  }
+  // 保存数据,进入工作台
+  sessionStorage.setItem('supplyData', JSON.stringify(supplyData))
+  window.location.replace('/page_workDesktop/work-bench/app/search/supply')
+}
 </script>
 
 <template>
@@ -48,6 +62,7 @@ function goDetail(item) {
         :tabs="searchTabs"
         placeholder="输入您想要查询的供应信息,多个关键词用空格隔开"
         @search="doSearch"
+        @goWorkSpace="goWorkSpaceCustom"
       >
         <div
           class="toggle-filter m-l-16px font-size-14px"

+ 21 - 2
apps/bigmember_pc/src/views/search/supply/model/base.js

@@ -41,7 +41,25 @@ export default function () {
   }
 
   function doSearch() {
-    return doQuery()
+    const supplyData = sessionStorage.getItem('supplyData')
+    if (supplyData) {
+      const data = JSON.parse(supplyData)
+      const { searchType, status, province, city, time, filterState: filterMap } = data
+      const params = {
+        searchType,
+        status,
+        province,
+        city,
+        time,
+        keywords: data.keywords || ''
+      }
+      inputKeywordsState.value.input = data.keywords
+      filterState.value = filterMap
+      sessionStorage.removeItem('supplyData')
+      return doQuery(params)
+    } else {
+      return doQuery()
+    }
   }
 
   // 列表状态
@@ -138,7 +156,6 @@ export default function () {
       getFormatAPIParams(),
       params
     )
-    console.log(result, 'result')
     return result
   }
 
@@ -148,10 +165,12 @@ export default function () {
     goToPublish,
     // 列表
     list,
+    listState,
     doQuery,
     searchListProps,
     // 搜索UI
     filterState,
+    getFormatAPIParams,
     doChangeFilter,
     searchTabs,
     inputKeywordsState,