|
@@ -0,0 +1,814 @@
|
|
|
+import { computed, reactive, ref, toRefs, onMounted,onBeforeMount, onBeforeUnmount, getCurrentInstance } from 'vue'
|
|
|
+import { without, throttle } from 'lodash'
|
|
|
+import { useStore } from '@/store'
|
|
|
+import { useRoute, useRouter } from 'vue-router/composables'
|
|
|
+import { MessageBox } from 'element-ui'
|
|
|
+import {
|
|
|
+ FilterHistoryAjaxModelRestore,
|
|
|
+ FilterHistoryAjaxModel2ViewModel,
|
|
|
+ getParam,
|
|
|
+ openLinkInWorkspace,
|
|
|
+ InContainer
|
|
|
+} from '@/utils'
|
|
|
+import $bus from '@/utils/bus'
|
|
|
+// 筛选条件动态组件方法
|
|
|
+import { getCreateSearchSchema } from '@/views/collection/constant/index'
|
|
|
+// API 业务模型
|
|
|
+import useQuickCollectBidModel from '@jy/data-models/modules/quick-collect-bid/model'
|
|
|
+// 扩展业务模型
|
|
|
+import { useSearchFilterModel } from './modules/filter'
|
|
|
+import { useSearchListHeaderActionsModel } from './modules/list-header-actions'
|
|
|
+// 数据导出业务
|
|
|
+import { dataExportActionsModel } from './modules/data-export-actions'
|
|
|
+// 标讯收藏业务
|
|
|
+import { dataCollectActionModel } from './modules/data-collect-actions'
|
|
|
+// 添加业务
|
|
|
+import { dataAddActionsModel } from './modules/data-add-actions'
|
|
|
+// 标签业务
|
|
|
+import { dataCollectTagModel } from './modules/data-collect-tag'
|
|
|
+// 参标业务
|
|
|
+import { joinBidActionsModel } from './modules/join-bid-actions'
|
|
|
+
|
|
|
+
|
|
|
+export default function () {
|
|
|
+ const that = getCurrentInstance().proxy
|
|
|
+
|
|
|
+ const router = useRouter()
|
|
|
+ // 是否是免费用户
|
|
|
+ const isFree = computed(() => {
|
|
|
+ return useStore().getters['user/isFree']
|
|
|
+ })
|
|
|
+ // 企业管理员
|
|
|
+ const isEntAdmin = computed(() => {
|
|
|
+ return useStore().getters['user/isEntAdmin']
|
|
|
+ })
|
|
|
+ // 部门管理员
|
|
|
+ const isDepartmentAdmin = computed(() => {
|
|
|
+ return useStore().getters['user/isDepartmentAdmin']
|
|
|
+ })
|
|
|
+ // 是否登录
|
|
|
+ const isLogin = computed(() => {
|
|
|
+ return useStore().getters['user/loginFlag']
|
|
|
+ })
|
|
|
+ // 用户权限
|
|
|
+ const userPowerInfo = computed(() => {
|
|
|
+ return useStore().getters['user/getInfo']
|
|
|
+ })
|
|
|
+ // 是否是vip
|
|
|
+ const isVip = computed (() => {
|
|
|
+ const { entniche, memberStatus, vipStatus } = userPowerInfo.value
|
|
|
+ return entniche || memberStatus > 0 || vipStatus > 0
|
|
|
+ })
|
|
|
+ // 是否是老用户
|
|
|
+ const isOld = computed (() => {
|
|
|
+ const { isOld } = userPowerInfo.value
|
|
|
+ return isOld
|
|
|
+ })
|
|
|
+
|
|
|
+ // 是否在工作台内
|
|
|
+ // 本地调试,可改为工作台内isInApp = ref(true), isInWeb = ref(false)
|
|
|
+ const isInApp = ref(InContainer.inApp)
|
|
|
+ const isInWeb = ref(InContainer.inWeb)
|
|
|
+
|
|
|
+ // 是否山川应用嵌入环境 添加操作按钮 (个人年终报告嵌套)
|
|
|
+ const inInjectBI = useRoute().query.report === 'bi'
|
|
|
+
|
|
|
+ // 是否是BI嵌套页面
|
|
|
+ const isInBI = computed(() => {
|
|
|
+ return inInjectBI
|
|
|
+ })
|
|
|
+
|
|
|
+ onMounted(() => {
|
|
|
+ window.addEventListener('scroll', watchScroll)
|
|
|
+ })
|
|
|
+
|
|
|
+
|
|
|
+ // 解构基础业务
|
|
|
+ const APIModel = useQuickCollectBidModel({})
|
|
|
+ /**
|
|
|
+ * 列表相关model
|
|
|
+ */
|
|
|
+ const {
|
|
|
+ list,
|
|
|
+ total,
|
|
|
+ loading,
|
|
|
+ finished,
|
|
|
+ selectIds,
|
|
|
+ listIds,
|
|
|
+ searchResultCount,
|
|
|
+ isSelectSomeCheckbox,
|
|
|
+ selectCheckboxCount,
|
|
|
+ isSelectListAllCheckbox,
|
|
|
+ doToggleItemSelection,
|
|
|
+ doToggleListSelection,
|
|
|
+ doClearAllSelection,
|
|
|
+ doQuery: doRunQuery,
|
|
|
+ getLabelQuery,
|
|
|
+ tagsList
|
|
|
+ } = APIModel
|
|
|
+ console.log(APIModel, 'APIModel')
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 筛选v-model数据
|
|
|
+ */
|
|
|
+ const {
|
|
|
+ filterState,
|
|
|
+ getFormatAPIParams: getFormatOfFilter,
|
|
|
+ updateFilterBase
|
|
|
+ } = useSearchFilterModel({ isFree, isInApp })
|
|
|
+ /**
|
|
|
+ * 列表头操作
|
|
|
+ */
|
|
|
+ const {
|
|
|
+ limitActions,
|
|
|
+ headerActions,
|
|
|
+ listItemStyleType,
|
|
|
+ activeItemStyleType,
|
|
|
+ activeHeaderActions,
|
|
|
+ disabledHeaderActions
|
|
|
+ } = useSearchListHeaderActionsModel()
|
|
|
+
|
|
|
+ $bus.$on('bidding:updateInputKeywords', function (obj) {
|
|
|
+ updateInputKeywordsState(obj)
|
|
|
+ })
|
|
|
+
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 筛选条件动态配置处理
|
|
|
+ */
|
|
|
+ const {
|
|
|
+ createSearchBidBaseSchema,
|
|
|
+ createSearchBidMoreSchema
|
|
|
+ } = getCreateSearchSchema()
|
|
|
+ // 处理当前信息类型--展示数据类型
|
|
|
+ const infoTypeDataType = computed(() => {
|
|
|
+ let result = 'all'
|
|
|
+ return result
|
|
|
+ })
|
|
|
+
|
|
|
+ // 筛选条件动态配置处理
|
|
|
+ function disposeFilterSchema() {
|
|
|
+ const conf = computed(() => {
|
|
|
+ return {
|
|
|
+ isInApp: isInApp.value,
|
|
|
+ isLogin: isLogin.value,
|
|
|
+ vipUser: isVip.value && isInApp.value,
|
|
|
+ oldUser: isOld.value && isInApp.value,
|
|
|
+ showVip: isLogin.value && isInApp.value,
|
|
|
+ infoType: infoTypeDataType.value,
|
|
|
+ isVip: isVip.value,
|
|
|
+ isInBI: isInBI.value,
|
|
|
+ tagsList: tagsList
|
|
|
+ }
|
|
|
+ })
|
|
|
+
|
|
|
+ // 标准筛选
|
|
|
+ const SearchBidBaseSchema = ref([])
|
|
|
+ const SearchBidMoreSchema = ref([])
|
|
|
+ // 更多筛选
|
|
|
+ const searchBidMoreFreeSchema = ref([])
|
|
|
+ const searchBidMoreVipSchema = ref([])
|
|
|
+
|
|
|
+ SearchBidBaseSchema.value = createSearchBidBaseSchema(conf.value)
|
|
|
+ SearchBidMoreSchema.value = createSearchBidMoreSchema(null, conf.value)
|
|
|
+
|
|
|
+ searchBidMoreFreeSchema.value = SearchBidMoreSchema.value?.filter(
|
|
|
+ (s) => !s.vipMark
|
|
|
+ )
|
|
|
+ searchBidMoreVipSchema.value = SearchBidMoreSchema.value?.filter(
|
|
|
+ (s) => s.vipMark
|
|
|
+ )
|
|
|
+ console.log(searchBidMoreFreeSchema.value, searchBidMoreVipSchema.value, 'base')
|
|
|
+
|
|
|
+
|
|
|
+ function doUpdateData(schema, type) {
|
|
|
+ const payload = schema || conf.value
|
|
|
+ if(type === 'more') {
|
|
|
+ SearchBidMoreSchema.value = createSearchBidMoreSchema(schema, conf.value)
|
|
|
+ } else {
|
|
|
+ SearchBidBaseSchema.value = createSearchBidBaseSchema(payload)
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ return {
|
|
|
+ SearchBidBaseSchema,
|
|
|
+ SearchBidMoreSchema,
|
|
|
+ searchBidMoreFreeSchema,
|
|
|
+ searchBidMoreVipSchema,
|
|
|
+ doUpdateData
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ // 列表状态
|
|
|
+ const listState = reactive({
|
|
|
+ finished,
|
|
|
+ loading,
|
|
|
+ pageNum: 1,
|
|
|
+ pageSize: 50,
|
|
|
+ total,
|
|
|
+ pageTotal: 0
|
|
|
+ })
|
|
|
+ // 当前展示的列表
|
|
|
+ const activeList = computed(() => {
|
|
|
+ let arr = []
|
|
|
+ if(list.value && list.value.length > 0) {
|
|
|
+ arr = list.value.map((v) => {
|
|
|
+ // v._id = v.id
|
|
|
+ v.id = v._id
|
|
|
+ v.checked = selectIds.value.includes(v.id)
|
|
|
+ // 中标单位联系方式处理
|
|
|
+ if(!v.winnerTel && v.winnerInfo && v.winnerInfo.length > 0) {
|
|
|
+ v.winnerTel = v.winnerInfo[0].winnerTel || ''
|
|
|
+ v.winnerPerson = v.winnerInfo[0].winnerPerson || ''
|
|
|
+ }
|
|
|
+ const region = []
|
|
|
+ if(v.area && (v.city && v.city.indexOf(v.area) === -1)) {
|
|
|
+ region.push(v.area)
|
|
|
+ }
|
|
|
+ if(v.city) {
|
|
|
+ region.push(v.city)
|
|
|
+ }
|
|
|
+ if(v.district) {
|
|
|
+ region.push(v.district)
|
|
|
+ }
|
|
|
+ v.region = region.join('-')
|
|
|
+ return v
|
|
|
+ })
|
|
|
+ }
|
|
|
+ return arr
|
|
|
+ })
|
|
|
+ // 表格展示的数据
|
|
|
+ const tableList = ref([])
|
|
|
+
|
|
|
+ // 根据权限处理列表头部的操作按钮展示
|
|
|
+ const limitFilterHeaderActions = computed(() => {
|
|
|
+ // BI营销以及个人分析报告不展示以下操作
|
|
|
+ if(!inInjectBI) {
|
|
|
+ // 数据导出
|
|
|
+ limitActions.value['data-export'] = true
|
|
|
+ limitActions.value['refined-list'] = true
|
|
|
+ limitActions.value['table'] = true
|
|
|
+ limitActions.value['edit-tags'] = true
|
|
|
+ limitActions.value['cancel-collect'] = true
|
|
|
+ // 登录后才展示详细列表
|
|
|
+ if(isLogin.value) {
|
|
|
+ limitActions.value['detailed-list'] = true
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return headerActions.value
|
|
|
+ })
|
|
|
+
|
|
|
+ // search-list 组件所需参数
|
|
|
+ const searchListProps = computed(() => {
|
|
|
+ return {
|
|
|
+ isSelectAllCheckbox: isSelectListAllCheckbox.value,
|
|
|
+ isSelectSomeCheckbox: isSelectSomeCheckbox.value,
|
|
|
+ selectCheckboxCount: selectCheckboxCount.value,
|
|
|
+ searchResultCount: searchResultCount.value,
|
|
|
+ headerActions: limitFilterHeaderActions.value,
|
|
|
+ list: activeList.value,
|
|
|
+ listState: listState
|
|
|
+ }
|
|
|
+ })
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 切换列表展示风格
|
|
|
+ * @param type - 可选风格 ['refined-list', 'detailed-list', 'table']
|
|
|
+ */
|
|
|
+ function doChangeItemStyleType(type) {
|
|
|
+ const styleTypes = ['refined-list', 'detailed-list', 'table']
|
|
|
+ if (!styleTypes.includes(type)) {
|
|
|
+ return console.warn('Not find style type!')
|
|
|
+ }
|
|
|
+ listItemStyleType.value = type
|
|
|
+ activeHeaderActions.value = without(
|
|
|
+ activeHeaderActions.value,
|
|
|
+ ...styleTypes
|
|
|
+ )
|
|
|
+ activeHeaderActions.value.push(type)
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 列表顶部按钮操作事件统一入口
|
|
|
+ * @param item - 按钮原型
|
|
|
+ * @param item.key - 按钮标识
|
|
|
+ */
|
|
|
+ function doListHeaderAction(item, $event) {
|
|
|
+ const { key } = item
|
|
|
+ switch (key) {
|
|
|
+ case 'refined-list': {
|
|
|
+ doChangeItemStyleType(key)
|
|
|
+ break
|
|
|
+ }
|
|
|
+ case 'detailed-list': {
|
|
|
+ detailListClick(key)
|
|
|
+ break
|
|
|
+ }
|
|
|
+ case 'table': {
|
|
|
+ doChangeItemStyleType(key)
|
|
|
+ break
|
|
|
+ }
|
|
|
+ case 'data-export': {
|
|
|
+ onClickDataExport()
|
|
|
+ break
|
|
|
+ }
|
|
|
+ case 'edit-tags': {
|
|
|
+ onClickEditTags($event)
|
|
|
+ break
|
|
|
+ }
|
|
|
+ case 'cancel-collect': {
|
|
|
+ onClickCancelCollect($event)
|
|
|
+ break
|
|
|
+ }
|
|
|
+ // case 'collect-bid' : {
|
|
|
+ // onClickDataCollect($event)
|
|
|
+ // break
|
|
|
+ // }
|
|
|
+ // case 'distribute-bid': {
|
|
|
+ // onClickDataDistribute()
|
|
|
+ // break
|
|
|
+ // }
|
|
|
+ // case 'employ-bid' : {
|
|
|
+ // onClickDataEmploy()
|
|
|
+ // break
|
|
|
+ // }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ function detailListClick (key) {
|
|
|
+ if(isFree.value) {
|
|
|
+ openListVipDialog()
|
|
|
+ return
|
|
|
+ }
|
|
|
+ doChangeItemStyleType(key)
|
|
|
+ }
|
|
|
+ // 全选复选框事件
|
|
|
+ function doChangeAllSelect(type) {
|
|
|
+ doToggleListSelection(type)
|
|
|
+ }
|
|
|
+
|
|
|
+ // 单个复选框事件
|
|
|
+ function doChangeSelect(item) {
|
|
|
+ doToggleItemSelection(item.id)
|
|
|
+ }
|
|
|
+
|
|
|
+ // 分页事件
|
|
|
+ function doChangePageNum(page) {
|
|
|
+ listState.pageNum = page
|
|
|
+ doQuery({}, 'pageNumChange', page)
|
|
|
+ }
|
|
|
+ // 分页大小事件
|
|
|
+ function doChangePageSize(size) {
|
|
|
+ listState.pageSize = size
|
|
|
+ listState.pageNum = 1
|
|
|
+ doQuery({}, 'pageNumChange', 1)
|
|
|
+ }
|
|
|
+ // 登录
|
|
|
+ $bus.$on('bidding:goLogin', goLogin)
|
|
|
+ function goLogin () {
|
|
|
+ that.$showLoginDialog()
|
|
|
+ }
|
|
|
+ // 跳转详情页
|
|
|
+ function toDetail(item) {
|
|
|
+ let aHref = ".html"
|
|
|
+
|
|
|
+ const id = item.id
|
|
|
+ try {
|
|
|
+ that.$visited.push({
|
|
|
+ type: 'articleContent',
|
|
|
+ id: id
|
|
|
+ })
|
|
|
+ item.visited = true
|
|
|
+ } catch(e) {
|
|
|
+ console.log(e)
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ if(isLogin.value) {
|
|
|
+ const prefix = isInApp.value ? '/article/content/' : '/nologin/content/'
|
|
|
+ const targetLink = `${prefix}${id}${aHref}`
|
|
|
+
|
|
|
+ // 在iframe里,往工作桌面跳转。不在iframe里,正常跳转
|
|
|
+ openLinkInWorkspace(isInApp.value, {
|
|
|
+ url: targetLink,
|
|
|
+ newTab: true,
|
|
|
+ })
|
|
|
+ } else{
|
|
|
+ const targetLink = `/nologin/content/${id}${aHref}`
|
|
|
+ window.open(targetLink)
|
|
|
+ }
|
|
|
+ }
|
|
|
+ // 列表tag跳转处理
|
|
|
+ function tagToDetail (item, label) {
|
|
|
+ if(label === 'subtype' && (item['subtype'] === '拟建' || item['subtype'] === '采购意向')) {
|
|
|
+ return
|
|
|
+ }
|
|
|
+ let link = ''
|
|
|
+ if(label === 'subtype') {
|
|
|
+ link = item['subtypeUrl']
|
|
|
+ } else if(label === 'area'){
|
|
|
+ link = item['areaUrl']
|
|
|
+ }
|
|
|
+ if(link) {
|
|
|
+ window.open(link)
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 格式化请求参数
|
|
|
+ * @param [params] - 可选值,部分情况会提供,默认会和该函数返回值进行合并
|
|
|
+ */
|
|
|
+
|
|
|
+ function getParams(params = {}) {
|
|
|
+ // 合并所有模型的搜索筛选项
|
|
|
+ const result = Object.assign(
|
|
|
+ {
|
|
|
+ searchGroup: '',
|
|
|
+ // reqType: 'lastNews', // cache:空搜索缓存数据;lastNews:最新数据
|
|
|
+ pageNum: listState.pageNum,
|
|
|
+ pageSize: listState.pageSize
|
|
|
+ },
|
|
|
+ getFormatOfFilter(),
|
|
|
+ params
|
|
|
+ )
|
|
|
+ return result
|
|
|
+ }
|
|
|
+
|
|
|
+ // 搜索前 处理一些事情
|
|
|
+ function beforeSearchSomething (pageNum) {
|
|
|
+ // 列表清空
|
|
|
+ list.value = []
|
|
|
+ listState.total = 0
|
|
|
+ // 列表重新获取时
|
|
|
+ if(!pageNum) {
|
|
|
+ listState.pageNum = 1
|
|
|
+ // 清空已选中数据
|
|
|
+ doClearAllSelection()
|
|
|
+ // 清空表格数据
|
|
|
+ tableList.value = []
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 统一查询入口
|
|
|
+ * - 拦截 doQuery 进行一些返回值处理
|
|
|
+ * @param [params] - 可选值,默认会和 getParams(params) 返回值进行合并
|
|
|
+ */
|
|
|
+ function doQuery(params = {}, pageNum) {
|
|
|
+ beforeSearchSomething (pageNum)
|
|
|
+ // Ajax请求
|
|
|
+ return doRunQuery(getParams(params)).then((res) => {
|
|
|
+ afterQueryAjax(res)
|
|
|
+ })
|
|
|
+ }
|
|
|
+ // 处理查询请求后的数据以及其他业务
|
|
|
+ function afterQueryAjax (res) {
|
|
|
+
|
|
|
+ const { origin } = res
|
|
|
+
|
|
|
+ listState.pageTotal = origin?.count || 0
|
|
|
+
|
|
|
+ //表格列表数据--只取第一页的前20条展示
|
|
|
+ if(listState.pageNum === 1) {
|
|
|
+ if(listState.total > 0) {
|
|
|
+ tableList.value = list.value.slice(0, 20)
|
|
|
+ } else {
|
|
|
+ tableList.value = []
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ // 列表无数据,禁用数据导出按钮
|
|
|
+ if(listState.total === 0) {
|
|
|
+ disabledHeaderActions.value = ['data-export']
|
|
|
+ } else {
|
|
|
+ disabledHeaderActions.value = []
|
|
|
+ }
|
|
|
+
|
|
|
+ if(isLogin.value) {
|
|
|
+ // 获取参标的数据
|
|
|
+ getJoinBidInfo(listIds.value)
|
|
|
+ // BI 是否批量收录,获取收录数据
|
|
|
+ // if(inBIPropertyIframe || inResourceBIIframe) {
|
|
|
+ // getEmployData(listIds.value)
|
|
|
+ // }
|
|
|
+ // 个人报告嵌套BI页面
|
|
|
+ if(inInjectBI) {
|
|
|
+ getBidAddInfos()
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ list.value = list.value.map(item => {
|
|
|
+ // 是否已读字段
|
|
|
+ const visited = that.$visited.check({
|
|
|
+ type: 'articleContent',
|
|
|
+ id: item.id
|
|
|
+ })
|
|
|
+ that.$set(item, 'visited', visited)
|
|
|
+
|
|
|
+ // 收藏字段显示
|
|
|
+ that.$set(item, 'collection', 1)
|
|
|
+
|
|
|
+ return item
|
|
|
+ })
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ // 组合好的组件格式的筛选条件
|
|
|
+ function packageFilter () {
|
|
|
+ const originParams = Object.assign(
|
|
|
+ filterState.value
|
|
|
+ )
|
|
|
+
|
|
|
+ return originParams
|
|
|
+ }
|
|
|
+
|
|
|
+ /******开通超级订阅弹窗start**********/
|
|
|
+
|
|
|
+ // 开通超级订阅弹窗配置
|
|
|
+ const vipDialogConfig = reactive({
|
|
|
+ type: 'filter',
|
|
|
+ show: false,
|
|
|
+ text: '立享更多搜索权限,寻找商机更精准'
|
|
|
+ })
|
|
|
+
|
|
|
+ // 筛选条件打开超级订阅弹窗
|
|
|
+ function openFilterVipDialog () {
|
|
|
+ vipDialogConfig.type = 'filter'
|
|
|
+ vipDialogConfig.show = true
|
|
|
+ vipDialogConfig.text = '立享更多搜索权限,寻找商机更精准'
|
|
|
+ }
|
|
|
+ // 关闭超级订阅弹窗
|
|
|
+ function closeVipDialog () {
|
|
|
+ vipDialogConfig.show = false
|
|
|
+ }
|
|
|
+ // 数据列表--开通超级订阅弹窗
|
|
|
+ function openListVipDialog () {
|
|
|
+ vipDialogConfig.type = 'list'
|
|
|
+ vipDialogConfig.show = true
|
|
|
+ vipDialogConfig.text = '立享列表展示更多公告关键信息,例如:采购单位、中标单位、招标代理机构等,提高公告查看效率'
|
|
|
+ }
|
|
|
+
|
|
|
+ const vipDialogConf = toRefs(vipDialogConfig)
|
|
|
+
|
|
|
+ // 筛选条件无权限提示开通超级订阅弹窗
|
|
|
+ $bus.$on('search:filter:no-power', openFilterVipDialog)
|
|
|
+
|
|
|
+ /******开通超级订阅弹窗end**********/
|
|
|
+
|
|
|
+
|
|
|
+ /*** 筛选条件头部、列表头部滚动start *****/
|
|
|
+
|
|
|
+ // 页面滚动方法 用于悬浮吸顶,将【筛选条件】置顶
|
|
|
+ const fixedTop = ref(false)
|
|
|
+ // 表格顶部操作方法滚动吸顶
|
|
|
+ const tableFixedTop = ref(false)
|
|
|
+
|
|
|
+ function watchScroll () {
|
|
|
+ const scrollTop = window.pageYOffset || document.documentElement.scrollTop || document.body.scrollTop
|
|
|
+ const watchTable = document.querySelector('.page-list-container').offsetTop - 15 // 15为margin-top值
|
|
|
+ if (scrollTop >= watchTable) {
|
|
|
+ tableFixedTop.value = true
|
|
|
+ fixedTop.value = false
|
|
|
+ } else {
|
|
|
+ tableFixedTop.value = false
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ /*** 筛选条件头部、列表头部滚动end *****/
|
|
|
+
|
|
|
+ /*******数据导出 start **********/
|
|
|
+ const {
|
|
|
+ dataExport,
|
|
|
+ setExport,
|
|
|
+ exportDialogChange,
|
|
|
+ showDataExportDialog,
|
|
|
+ toPayDataExport
|
|
|
+ } = dataExportActionsModel ()
|
|
|
+
|
|
|
+ // 数据导出操作
|
|
|
+ function onClickDataExport (table) {
|
|
|
+ if(!isLogin.value) {
|
|
|
+ goLogin()
|
|
|
+ return
|
|
|
+ }
|
|
|
+
|
|
|
+ const originParams = packageFilter()
|
|
|
+ const params = {
|
|
|
+ listState: listState,
|
|
|
+ selectCheckboxCount: selectCheckboxCount.value,
|
|
|
+ selectIds: selectIds.value,
|
|
|
+ filter: originParams
|
|
|
+ }
|
|
|
+ if(table) {
|
|
|
+ toPayDataExport(params)
|
|
|
+ } else {
|
|
|
+ dataExport(params)
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ /*******数据导出 end ***********/
|
|
|
+
|
|
|
+ /*******修改标签 start ***********/
|
|
|
+ const { onEditTags } = dataCollectTagModel({ that })
|
|
|
+ function onClickEditTags(e) {
|
|
|
+ console.log('修改标签')
|
|
|
+ const config = {
|
|
|
+ total: listState.total,
|
|
|
+ isSelectSomeCheckbox: isSelectSomeCheckbox.value,
|
|
|
+ selectIds: selectIds.value,
|
|
|
+ event: e
|
|
|
+ }
|
|
|
+ onEditTags(config)
|
|
|
+ }
|
|
|
+ /*******修改标签 end ***********/
|
|
|
+
|
|
|
+ /********* 标讯收藏部分start ********/
|
|
|
+ const { onCollect } = dataCollectActionModel({ that })
|
|
|
+
|
|
|
+ // 批量取消标讯收藏
|
|
|
+ function onClickCancelCollect(e) {
|
|
|
+ const config = {
|
|
|
+ total: listState.total,
|
|
|
+ isSelectSomeCheckbox: isSelectSomeCheckbox.value,
|
|
|
+ event: e,
|
|
|
+ selectIds: selectIds.value,
|
|
|
+ }
|
|
|
+ onCollect(config, 'batch')
|
|
|
+ }
|
|
|
+
|
|
|
+ // 单个标讯收藏
|
|
|
+ function onClickSingleCollect (data) {
|
|
|
+ const config = {
|
|
|
+ item: data.item,
|
|
|
+ total: listState.total,
|
|
|
+ event: data.event
|
|
|
+ }
|
|
|
+ onCollect(config, 'single')
|
|
|
+ }
|
|
|
+ // 挂载搜索事件,供模块js回调
|
|
|
+ $bus.$on('bidding:updateListCollectStatus', function () {
|
|
|
+ doQuery({}, 'pageNumChange', listState.pageNum)
|
|
|
+ })
|
|
|
+ /********* 标讯收藏部分end ********/
|
|
|
+
|
|
|
+ // 处理数据列表为空时,需要展示的提示文案包含时间
|
|
|
+ const timeSelectorText = computed(() => {
|
|
|
+ const publishTime = filterState.value.publishTime
|
|
|
+ const split = '_'
|
|
|
+ const { publishTimeText } = FilterHistoryAjaxModel2ViewModel.formatTime(publishTime, split)
|
|
|
+ let result = ''
|
|
|
+ if(publishTimeText) {
|
|
|
+ if(publishTimeText.includes('最')) {
|
|
|
+ result = publishTimeText.replace('最', '')
|
|
|
+ } else if(publishTimeText.includes('以后')){
|
|
|
+ result = publishTimeText.replace('以后', '')
|
|
|
+ }else if(publishTimeText.includes('以前')) {
|
|
|
+ result = publishTimeText.replace('以前', '')
|
|
|
+ } else {
|
|
|
+ result = publishTimeText
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ result = '近一年'
|
|
|
+ }
|
|
|
+
|
|
|
+ return result
|
|
|
+ })
|
|
|
+
|
|
|
+ /********参标start *********/
|
|
|
+ // 参标只有莱茵有权限
|
|
|
+ const {
|
|
|
+ BidrenewalDialogRef,
|
|
|
+ getJoinBidInfo,
|
|
|
+ onJoinBid
|
|
|
+ } = joinBidActionsModel ()
|
|
|
+
|
|
|
+ // 窗口切换刷新参标数据
|
|
|
+ // document.addEventListener('visibilitychange', function () {
|
|
|
+ // if (document.visibilityState === 'visible') {
|
|
|
+ // that.$visited.refreshVisited()
|
|
|
+ // if(isLogin.value) {
|
|
|
+ // getJoinBidInfo(listIds.value)
|
|
|
+ // }
|
|
|
+ // }
|
|
|
+ // })
|
|
|
+
|
|
|
+ // 变更列表数据的参标状态
|
|
|
+ $bus.$on('bidding:updateListJoinStatus', function (obj) {
|
|
|
+ const {item, joinData } = obj
|
|
|
+ if(joinData) {
|
|
|
+ for (const temp of joinData) {
|
|
|
+ list.value = list.value.map(v => {
|
|
|
+ if (temp.id === v.id) {
|
|
|
+ that.$set(v, 'joinBid', Boolean(temp.value))
|
|
|
+ }
|
|
|
+ return v
|
|
|
+ })
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ list.value = list.value.map((temp) => {
|
|
|
+ if (temp.id === item?.id) {
|
|
|
+ that.$set(temp, 'joinBid', true)
|
|
|
+ }
|
|
|
+ return temp
|
|
|
+ })
|
|
|
+ }
|
|
|
+ })
|
|
|
+ /*******参标end ***********/
|
|
|
+
|
|
|
+ /*****BI添加操作start*********/
|
|
|
+ const {
|
|
|
+ getBidAddInfos,
|
|
|
+ doAddInfoOfBI
|
|
|
+ } = dataAddActionsModel()
|
|
|
+
|
|
|
+ $bus.$on('bidding:updateDataAddStatus', function(params) {
|
|
|
+ const { type, ids } = params
|
|
|
+ list.value = list.value.map(function (item) {
|
|
|
+ // 添加收录
|
|
|
+ if(type === 'add' && ids.includes(item.id)) {
|
|
|
+ item.isAdd = true
|
|
|
+ }
|
|
|
+ // 取消收录
|
|
|
+ if(type === 'cancel' && ids.includes(item.id)) {
|
|
|
+ item.isAdd = false
|
|
|
+ }
|
|
|
+ return item
|
|
|
+ })
|
|
|
+ })
|
|
|
+ // 批量添加
|
|
|
+ function onAddInfoOfBI () {
|
|
|
+ doAddInfoOfBI({ ids: selectIds.value })
|
|
|
+ }
|
|
|
+ // 单个添加
|
|
|
+ function onSingleAddInfo (item) {
|
|
|
+ doAddInfoOfBI({ item })
|
|
|
+ }
|
|
|
+ /*****BI添加操作end*********/
|
|
|
+
|
|
|
+
|
|
|
+ /*********页面留资相关************/
|
|
|
+ // 打开留资弹窗
|
|
|
+ const collectElementRef = ref(null)
|
|
|
+ // 免费用户点免费体验留资
|
|
|
+ function onFreeTaste () {
|
|
|
+ if( collectElementRef.value) {
|
|
|
+ collectElementRef.value.isNeedSubmit('jylab_see500_plus', () => {
|
|
|
+ })
|
|
|
+ }
|
|
|
+ }
|
|
|
+ /*******工作台跳转end***********/
|
|
|
+
|
|
|
+ // 页面初始化
|
|
|
+ function initPage () {
|
|
|
+ // getTagsList()
|
|
|
+ }
|
|
|
+ initPage()
|
|
|
+
|
|
|
+ return {
|
|
|
+ isLogin,
|
|
|
+ isInApp,
|
|
|
+ isInWeb,
|
|
|
+ isInBI,
|
|
|
+ inInjectBI,
|
|
|
+ isFree,
|
|
|
+ isVip,
|
|
|
+ goLogin,
|
|
|
+ list,
|
|
|
+ tableList,
|
|
|
+ searchListProps,
|
|
|
+ filterState,
|
|
|
+ updateFilterBase,
|
|
|
+ listState,
|
|
|
+ activeItemStyleType,
|
|
|
+ disposeFilterSchema,
|
|
|
+ doQuery,
|
|
|
+ doListHeaderAction,
|
|
|
+ doChangeAllSelect,
|
|
|
+ doChangeSelect,
|
|
|
+ doChangePageNum,
|
|
|
+ doChangePageSize,
|
|
|
+ vipDialogConf,
|
|
|
+ closeVipDialog,
|
|
|
+ fixedTop,
|
|
|
+ tableFixedTop,
|
|
|
+ toDetail,
|
|
|
+ tagToDetail,
|
|
|
+ onClickDataExport, // 以下为导出相关
|
|
|
+ setExport,
|
|
|
+ exportDialogChange,
|
|
|
+ showDataExportDialog,
|
|
|
+ onClickSingleCollect, // 收藏
|
|
|
+ onJoinBid,//以下 参标
|
|
|
+ onAddInfoOfBI,
|
|
|
+ onSingleAddInfo,
|
|
|
+ BidrenewalDialogRef,
|
|
|
+ timeSelectorText,
|
|
|
+ collectElementRef,
|
|
|
+ onFreeTaste,
|
|
|
+ getLabelQuery,
|
|
|
+ tagsList
|
|
|
+ }
|
|
|
+}
|