|
@@ -0,0 +1,512 @@
|
|
|
+var winnerMatchTypeList = [
|
|
|
+ {
|
|
|
+ label: '项目名称/标的物',
|
|
|
+ value: 'purchasing'
|
|
|
+ },
|
|
|
+ {
|
|
|
+ label: '采购单位',
|
|
|
+ value: 'buyer'
|
|
|
+ },
|
|
|
+ {
|
|
|
+ label: '招标代理机构',
|
|
|
+ value: 'agency'
|
|
|
+ }
|
|
|
+]
|
|
|
+var buyerMatchTypeList = [
|
|
|
+ {
|
|
|
+ label: '项目名称/标的物',
|
|
|
+ value: 'purchasing'
|
|
|
+ },
|
|
|
+ {
|
|
|
+ label: '中标企业',
|
|
|
+ value: 'winner'
|
|
|
+ },
|
|
|
+ {
|
|
|
+ label: '招标代理机构',
|
|
|
+ value: 'agency'
|
|
|
+ }
|
|
|
+]
|
|
|
+var matchTypeList = []
|
|
|
+if (utils.getParam('entName')) {
|
|
|
+ matchTypeList = buyerMatchTypeList
|
|
|
+} else {
|
|
|
+ matchTypeList = winnerMatchTypeList
|
|
|
+}
|
|
|
+var highSet = new Vue({
|
|
|
+ delimiters: ['${', '}'],
|
|
|
+ el: '#high-set',
|
|
|
+ components: {
|
|
|
+ popupSelectComponent: popupSelectComponent,
|
|
|
+ areaComponent: areaComponent,
|
|
|
+ industryComponent: industryComponent,
|
|
|
+ dateComponent: dateComponent,
|
|
|
+ yearsComponent: yearsComponent
|
|
|
+ },
|
|
|
+ data () {
|
|
|
+ return {
|
|
|
+ conf: {
|
|
|
+ keywords: '',
|
|
|
+ scope: '项目名称/标的物',
|
|
|
+ area: '全国',
|
|
|
+ industry: '全部',
|
|
|
+ start: new Date().getFullYear() - 2,
|
|
|
+ end: new Date().getFullYear(),
|
|
|
+ match: 0
|
|
|
+ },
|
|
|
+ popInfo: {
|
|
|
+ title: '',
|
|
|
+ show: false,
|
|
|
+ type: ''
|
|
|
+ },
|
|
|
+ entInfo: {
|
|
|
+ eid: '',
|
|
|
+ entName: ''
|
|
|
+ },
|
|
|
+ reqSign: 'bigmember',
|
|
|
+ filterInitData: {
|
|
|
+ areaArr: [],
|
|
|
+ industry: []
|
|
|
+ },
|
|
|
+ selectAreaList: ['全国'],
|
|
|
+ selectIndustryList: [],
|
|
|
+ selectScopeList: ['purchasing'],
|
|
|
+ matchTypeList: matchTypeList,
|
|
|
+ startRange: [],
|
|
|
+ endRange: [],
|
|
|
+ bigStatus: 0,
|
|
|
+ power:[]
|
|
|
+ }
|
|
|
+ },
|
|
|
+ watch: {
|
|
|
+ // 监听初始时间 如果结束时间小于初始时间 则两个调换位置
|
|
|
+ 'conf.start': function(newVal) {
|
|
|
+ // console.log(this.conf.end, newVal)
|
|
|
+ if (this.conf.end < newVal) {
|
|
|
+ this.conf.start = this.conf.end
|
|
|
+ this.conf.end = newVal
|
|
|
+ }
|
|
|
+ },
|
|
|
+ 'conf.area': function (newVal) {
|
|
|
+ console.log(newVal)
|
|
|
+ if (newVal == '全国') {
|
|
|
+ $('.area-class .van-cell__value span').html('全部')
|
|
|
+ } else {
|
|
|
+ $('.area-class .van-cell__value span').html(newVal)
|
|
|
+ }
|
|
|
+ }
|
|
|
+ },
|
|
|
+ computed: {
|
|
|
+ disabledConfirm: function () {
|
|
|
+ var key = this.conf.keywords
|
|
|
+ var scope = this.conf.scope
|
|
|
+ var area = this.conf.area
|
|
|
+ var industry = this.conf.industry
|
|
|
+ var start = this.conf.start
|
|
|
+ var end = this.conf.end
|
|
|
+ return !(key || scope || area || industry || start || end)
|
|
|
+ },
|
|
|
+ hasSpace () {
|
|
|
+ var key = this.conf.keywords
|
|
|
+ return key && key.replace(/^\s\s*/,'').indexOf(' ') > -1
|
|
|
+ },
|
|
|
+ filterInfoUrl: function () {
|
|
|
+ var path = ''
|
|
|
+ if (this.entInfo.eid) {
|
|
|
+ path = 'winner/selects'
|
|
|
+ } else if (this.entInfo.entName) {
|
|
|
+ path = 'buyer/selects'
|
|
|
+ }
|
|
|
+ var urlMap = {
|
|
|
+ bigmember: '/bigmember/portrait/' + path, // 大会员
|
|
|
+ svip: '/bigmember/subVipPortrait/' + path // 超级订阅
|
|
|
+ }
|
|
|
+ console.log(this.bigStatus, this.power)
|
|
|
+ var isMember = this.bigStatus > 0 && this.power.indexOf(5) > -1
|
|
|
+ var url = '/entnicheNew/portrait/buyer/selects'
|
|
|
+ // if (urlMap[this.reqSign]) {
|
|
|
+ // url = urlMap[this.reqSign]
|
|
|
+ // }
|
|
|
+ return url
|
|
|
+ }
|
|
|
+ },
|
|
|
+ created () {
|
|
|
+ var eid = utils.getParam('eid')
|
|
|
+ var reqSign = utils.getParam('reqSign')
|
|
|
+ var entName = decodeURIComponent(utils.getParam('entName'))
|
|
|
+ var winnerStorage = JSON.parse(sessionStorage.getItem('winner_high_set'))
|
|
|
+ var buyerStorage = JSON.parse(sessionStorage.getItem('buyer_high_set'))
|
|
|
+ if (eid) {
|
|
|
+ this.entInfo.eid = decodeURIComponent(eid)
|
|
|
+ if (winnerStorage) {
|
|
|
+ this.formatterStorage(winnerStorage)
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if (entName) {
|
|
|
+ this.entInfo.entName = entName
|
|
|
+ if (buyerStorage) {
|
|
|
+ this.formatterStorage(buyerStorage)
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if (reqSign) {
|
|
|
+ this.reqSign = reqSign
|
|
|
+ }
|
|
|
+ this.getUserInfo()
|
|
|
+ },
|
|
|
+ mounted () {
|
|
|
+ var header = decodeURIComponent(utils.getParam('header'))
|
|
|
+ this.setHeaderTitle(header)
|
|
|
+
|
|
|
+ if (this.conf.area == '全国') {
|
|
|
+ $('.area-class .van-cell__value span').html('全部')
|
|
|
+ } else {
|
|
|
+ $('.area-class .van-cell__value span').html(this.conf.area)
|
|
|
+ }
|
|
|
+ },
|
|
|
+ methods: {
|
|
|
+ // 设置title
|
|
|
+ setHeaderTitle: function setHeaderTitle (header) {
|
|
|
+ document.title = header || document.title
|
|
|
+ },
|
|
|
+ getUserInfo: function() {
|
|
|
+ var _this = this
|
|
|
+ $.ajax({
|
|
|
+ type: 'POST',
|
|
|
+ url: '/bigmember/use/isAdd?t=' + Date.now(),
|
|
|
+ success: function (res) {
|
|
|
+ if (res.error_code == 0 && res.data) {
|
|
|
+ _this.bigStatus = res.data.memberStatus
|
|
|
+ _this.power = res.data.power
|
|
|
+ _this.getFilterApi()
|
|
|
+ } else {
|
|
|
+ _this.showToast(res.error_msg)
|
|
|
+ }
|
|
|
+ },
|
|
|
+ error: function (error) {
|
|
|
+ console.log(error)
|
|
|
+ }
|
|
|
+ })
|
|
|
+ },
|
|
|
+ // 将缓存中的项目搜索范围英文字段转换为中文用于在输入框展示
|
|
|
+ formatterLabel: function(data) {
|
|
|
+ var arr = []
|
|
|
+ var list = this.matchTypeList
|
|
|
+ var sArr = data.split(',')
|
|
|
+ list.forEach(function(item){
|
|
|
+ sArr.forEach(function(v){
|
|
|
+ if(item.value == v) {
|
|
|
+ arr.push(item.label)
|
|
|
+ }
|
|
|
+ })
|
|
|
+ })
|
|
|
+ return arr.join(',')
|
|
|
+ },
|
|
|
+ // 回显缓存中的数据
|
|
|
+ formatterStorage: function (data) {
|
|
|
+ var timeRange = data.timeRange.split('_')
|
|
|
+ this.conf.keywords = data.match
|
|
|
+ this.conf.area = data.area ? data.area : '全国'
|
|
|
+ this.conf.scope = this.formatterLabel(data.matchRange)
|
|
|
+ this.conf.industry = data.scopeClass ? data.scopeClass : '全部'
|
|
|
+ this.conf.start = timeRange[0]
|
|
|
+ this.conf.end = timeRange[1]
|
|
|
+ this.conf.match = data.exactMatch
|
|
|
+ this.selectAreaList = data.area ? data.area.split(',') : ['全国']
|
|
|
+ this.selectScopeList = data.matchRange.split(',')
|
|
|
+ this.selectIndustryList = data.scopeClass.split(',')
|
|
|
+ },
|
|
|
+ // 取近四年的年份
|
|
|
+ getCurFourYears: function () {
|
|
|
+ var endYear = new Date().getFullYear()
|
|
|
+ var startYear = endYear - 4
|
|
|
+ var years = []
|
|
|
+ for(var i = startYear ; i <= endYear; i ++) {
|
|
|
+ years.push(i + '年')
|
|
|
+ }
|
|
|
+ return years
|
|
|
+ },
|
|
|
+ // 处理截止日期
|
|
|
+ getEndRangeYears: function () {
|
|
|
+ var endArr = []
|
|
|
+ var years = this.getCurFourYears()
|
|
|
+ var start = this.conf.start
|
|
|
+ if (start) {
|
|
|
+ endArr = years.filter(function (v) {
|
|
|
+ return v.replace('年', '') >= start.replace('年', '')
|
|
|
+ })
|
|
|
+ } else {
|
|
|
+ endArr =years
|
|
|
+ }
|
|
|
+ return endArr
|
|
|
+ },
|
|
|
+ showToast: function (message) {
|
|
|
+ this.$toast({
|
|
|
+ duration: 1500,
|
|
|
+ forbidClick: true,
|
|
|
+ message: message,
|
|
|
+ })
|
|
|
+ },
|
|
|
+ showLoading: function () {
|
|
|
+ var loading = this.$toast.loading({
|
|
|
+ duration: 0,
|
|
|
+ forbidClick: true,
|
|
|
+ message: 'loading...',
|
|
|
+ })
|
|
|
+ return loading
|
|
|
+ },
|
|
|
+ // 获取筛选条件
|
|
|
+ getFilterApi () {
|
|
|
+ var _this = this
|
|
|
+ var loading = this.showLoading()
|
|
|
+ var data = {
|
|
|
+ buyer: _this.entInfo.entName
|
|
|
+ }
|
|
|
+ $.ajax({
|
|
|
+ type: 'POST',
|
|
|
+ url: '/entnicheNew/portrait/buyer/selects',
|
|
|
+ data: data,
|
|
|
+ success: function (res) {
|
|
|
+ if (res.error_code == 0) {
|
|
|
+ loading.clear()
|
|
|
+ _this.filterInitData.areaArr = res.data.areaArr || []
|
|
|
+ _this.filterInitData.scopeArr = res.data.scopeArr || []
|
|
|
+ // _this.initSelector(res.data)
|
|
|
+ } else {
|
|
|
+ _this.showToast(res.error_msg)
|
|
|
+ }
|
|
|
+ },
|
|
|
+ error: function (error) {
|
|
|
+ loading.clear()
|
|
|
+ console.log(error)
|
|
|
+ }
|
|
|
+ })
|
|
|
+ },
|
|
|
+ // 选择器
|
|
|
+ popClick: function (type) {
|
|
|
+ this.popInfo.type = type
|
|
|
+ switch (type) {
|
|
|
+ case 'scope':
|
|
|
+ this.popInfo.show = true
|
|
|
+ this.initSelector()
|
|
|
+ this.popInfo.title = '请选择项目搜索范围'
|
|
|
+ break;
|
|
|
+ case 'area':
|
|
|
+ this.popInfo.show = true
|
|
|
+ this.initSelector(this.filterInitData)
|
|
|
+ this.popInfo.title = '请选择项目地区'
|
|
|
+ break;
|
|
|
+ case 'industry':
|
|
|
+ this.popInfo.show = true
|
|
|
+ this.initSelector(this.filterInitData)
|
|
|
+ this.popInfo.title = '请选择行业'
|
|
|
+ break;
|
|
|
+ case 'start':
|
|
|
+ this.popInfo.show = true
|
|
|
+ this.initSelector()
|
|
|
+ this.popInfo.title = '请选择开始年份'
|
|
|
+ break;
|
|
|
+ case 'end':
|
|
|
+ this.popInfo.show = true
|
|
|
+ this.initSelector()
|
|
|
+ this.popInfo.title = '请选择结束年份'
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ },
|
|
|
+ initSelector: function (data) {
|
|
|
+ var _this = this
|
|
|
+ this.$nextTick(function() {
|
|
|
+ switch (_this.popInfo.type) {
|
|
|
+ case 'scope':
|
|
|
+ _this.initMatchTypeSelector()
|
|
|
+ break;
|
|
|
+ case 'area':
|
|
|
+ _this.filterInitData.areaArr = data.areaArr
|
|
|
+ _this.initProjectAreaSelector(data.areaArr)
|
|
|
+ break;
|
|
|
+ case 'industry':
|
|
|
+ _this.filterInitData.industry = data.scopeArr
|
|
|
+ _this.initProjectIndustrySelector(data.scopeArr)
|
|
|
+ break;
|
|
|
+ case 'start':
|
|
|
+ _this.startRange = _this.getCurFourYears()
|
|
|
+ break;
|
|
|
+ case 'end':
|
|
|
+ _this.endRange = _this.getEndRangeYears()
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ })
|
|
|
+ },
|
|
|
+ // 项目搜索范围
|
|
|
+ initMatchTypeSelector: function () {
|
|
|
+ this.$refs.matchTypeSelector.setState(this.selectScopeList)
|
|
|
+ },
|
|
|
+ // 过滤地区
|
|
|
+ initProjectAreaSelector: function (areaArr) {
|
|
|
+ if (!Array.isArray(areaArr)) return
|
|
|
+ if (areaArr.indexOf('全国') === -1) {
|
|
|
+ areaArr.unshift('全国')
|
|
|
+ }
|
|
|
+ var areaMap = this.$refs.projectAreaSelector.provinceListMap
|
|
|
+ var map = {}
|
|
|
+ for (var key in areaMap) {
|
|
|
+ var arr = []
|
|
|
+ areaMap[key].forEach(function (item) {
|
|
|
+ if (areaArr.indexOf(item) !== -1) {
|
|
|
+ arr.push(item)
|
|
|
+ }
|
|
|
+ })
|
|
|
+ if (arr.length) {
|
|
|
+ map[key] = arr
|
|
|
+ }
|
|
|
+ }
|
|
|
+ this.$refs.projectAreaSelector.arrangeListMap(map)
|
|
|
+ this.$refs.projectAreaSelector.setState(this.selectAreaList)
|
|
|
+ $('.area-card-item').each(function(){
|
|
|
+ if($(this).html() == '全国') {
|
|
|
+ $(this).html('全部')
|
|
|
+ }
|
|
|
+ })
|
|
|
+ },
|
|
|
+ // 过滤行业数据
|
|
|
+ initProjectIndustrySelector: function (data) {
|
|
|
+ var arr = []
|
|
|
+ data.forEach(function(s) {
|
|
|
+ var key = s.substring(0, s.indexOf('_'))
|
|
|
+ var value = s.substring(s.indexOf('_') + 1)
|
|
|
+ arr.push({
|
|
|
+ name: key,
|
|
|
+ value: value
|
|
|
+ })
|
|
|
+ })
|
|
|
+ var newArr = []
|
|
|
+ arr.forEach(function(item, index) {
|
|
|
+ let newItem = newArr.find(function(i) {
|
|
|
+ return i.name == item.name
|
|
|
+ })
|
|
|
+ if (!newItem) {
|
|
|
+ newArr.push({
|
|
|
+ name: item.name,
|
|
|
+ value: [item.value]
|
|
|
+ })
|
|
|
+ } else {
|
|
|
+ newItem.value.push(item.value)
|
|
|
+ }
|
|
|
+ })
|
|
|
+ var resArr = []
|
|
|
+ newArr.forEach(function(s) {
|
|
|
+ var obj = {}
|
|
|
+ obj[s.name] = s.value
|
|
|
+ resArr.push(obj)
|
|
|
+ })
|
|
|
+ // console.log(resArr, '过滤好的行业数据')
|
|
|
+ this.$refs.industryCom.formatIndustryData(resArr)
|
|
|
+ this.$refs.industryCom.canClick = false
|
|
|
+ // this.$refs.industryCom.setState(this.selectIndustryList)
|
|
|
+ },
|
|
|
+ // 分析方式
|
|
|
+ checkMatch: function (item) {
|
|
|
+ this.conf.match = item
|
|
|
+ },
|
|
|
+ onKeywords: function (val) {
|
|
|
+ // 过滤首个空格
|
|
|
+ this.conf.keywords = val.replace(/^\s\s*/,'').replace(/(\r\n)|(\n)/g, '')
|
|
|
+ },
|
|
|
+ onCancel: function (data) {
|
|
|
+ if (!data) {
|
|
|
+ this.selectScopeList = ['purchasing']
|
|
|
+ this.$refs.matchTypeSelector.setState(this.selectScopeList)
|
|
|
+ } else if (data.name == 'areaItem') {
|
|
|
+ this.$refs.projectAreaSelector.setState(this.selectAreaList)
|
|
|
+ } else if (data.name == 'industryItem') {
|
|
|
+ this.$refs.industryCom.setState([])
|
|
|
+ this.$refs.industryCom.canClick = false
|
|
|
+ } else if (data.name == 'dateItem') {
|
|
|
+
|
|
|
+ }
|
|
|
+ },
|
|
|
+ onConfirm: function (data) {
|
|
|
+ // console.log(data, 'data')
|
|
|
+ if (data.name === 'areaItem') {
|
|
|
+ if (data.data.length === 0) {
|
|
|
+ this.conf.area = '全国'
|
|
|
+ this.selectAreaList = ['全国']
|
|
|
+ } else {
|
|
|
+ this.conf.area = data.data.join(',')
|
|
|
+ this.selectAreaList = data.data
|
|
|
+ }
|
|
|
+ } else if (data.name === 'scopeItem') {
|
|
|
+ if (data.data.length === 0) {
|
|
|
+ this.conf.scope = ''
|
|
|
+ } else {
|
|
|
+ this.conf.scope = data.checkedList.map(function(v) {
|
|
|
+ return v.label
|
|
|
+ }).join(',')
|
|
|
+ this.selectScopeList = data.data
|
|
|
+ }
|
|
|
+ } else if (data.name === 'industryItem') {
|
|
|
+ if (data.data.length === 0) {
|
|
|
+ this.conf.industry = '全部'
|
|
|
+ this.selectIndustryList = data.data
|
|
|
+ } else {
|
|
|
+ this.conf.industry = data.data.join(',')
|
|
|
+ this.selectIndustryList = data.data
|
|
|
+ }
|
|
|
+ } else if (data.name === 'yearsItem') {
|
|
|
+ if (data.type === 'start') {
|
|
|
+ this.conf.start = data.data
|
|
|
+ } else if (data.type === 'end') {
|
|
|
+ this.conf.end = data.data
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ return console.log('暂无数据')
|
|
|
+ }
|
|
|
+ this.setToggle()
|
|
|
+ },
|
|
|
+ setToggle: function() {
|
|
|
+ this.popInfo.show = false
|
|
|
+ },
|
|
|
+ // 开始分析
|
|
|
+ startStatistic: function() {
|
|
|
+ var conf = this.conf
|
|
|
+ var list = this.matchTypeList
|
|
|
+ var arr = []
|
|
|
+ var sArr = conf.scope.split(',')
|
|
|
+ list.forEach(function(item){
|
|
|
+ sArr.forEach(function(v){
|
|
|
+ if(item.label == v) {
|
|
|
+ arr.push(item.value)
|
|
|
+ }
|
|
|
+ })
|
|
|
+ })
|
|
|
+ var obj = {
|
|
|
+ match: conf.keywords,
|
|
|
+ exactMatch: conf.match,
|
|
|
+ matchRange: arr.join(','),
|
|
|
+ area: conf.area.indexOf('全国') > -1 ? '' : conf.area,
|
|
|
+ scopeClass: conf.industry.indexOf('全部') > -1 ? '' : conf.industry,
|
|
|
+ timeRange: conf.start.replace('年', '') + '_' + conf.end.replace('年', '')
|
|
|
+ }
|
|
|
+ if (this.entInfo.entName) {
|
|
|
+ window.sessionStorage.setItem('buyer_high_set', JSON.stringify(obj))
|
|
|
+ window.sessionStorage.setItem('buyer_high_name', encodeURIComponent(this.entInfo.entName))
|
|
|
+ } else if (this.entInfo.eid) {
|
|
|
+ window.sessionStorage.setItem('winner_high_set', JSON.stringify(obj))
|
|
|
+ window.sessionStorage.setItem('winner_high_eid', this.entInfo.eid)
|
|
|
+ }
|
|
|
+ window.history.back()
|
|
|
+ },
|
|
|
+ // 重置
|
|
|
+ onReset: function () {
|
|
|
+ this.conf.keywords = ''
|
|
|
+ this.conf.scope = '项目名称/标的物'
|
|
|
+ this.conf.area = '全国'
|
|
|
+ this.conf.industry = '全部'
|
|
|
+ this.conf.start = new Date().getFullYear() - 2
|
|
|
+ this.conf.end = new Date().getFullYear()
|
|
|
+ this.conf.match = 0
|
|
|
+ this.filterInitData.area = []
|
|
|
+ this.selectAreaList = ['全国']
|
|
|
+ this.selectIndustryList = []
|
|
|
+ this.selectScopeList = ['purchasing']
|
|
|
+ }
|
|
|
+ }
|
|
|
+})
|