123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188 |
- import { activity, User } from "@/config/api.js";
- let app = getApp();
- export default {
- data() {
- return {
- isShowJurisdiction: false, // 权限
- isGetJurisdiction: 0, // 权限
- listChartPermission: [], // 行业
- listChartPermissionInit: [],
- chartPermissionName: "全行业",
- chartPermissionIds: "",
- whichDay: "", //选择今日/明日\本、上周 月
- selectActiveId: "", //专家、分析师的id
- ResearchExternalAct: "",
- activityTimeList: [
- { Id: 1, IsChoose: false, StatusName: "今日活动" },
- { Id: 2, IsChoose: false, StatusName: "明日活动" },
- ],
- activityTypeList: [
- { Id: 1, IsChoose: false, StatusName: "专家电话会" },
- { Id: 2, IsChoose: false, StatusName: "分析师电话会" },
- ],
- activityMonthWeekList: [
- { Id: 3, IsChoose: false, StatusName: "本周", type: "week" },
- { Id: 4, IsChoose: false, StatusName: "上周", type: "week" },
- { Id: 5, IsChoose: false, StatusName: "本月", type: "month" },
- { Id: 6, IsChoose: false, StatusName: "上月", type: "month" },
- ],
- ResearchExternal: [
- { Id: 1, IsChoose: false, StatusName: "研选扣点" },
- { Id: 2, IsChoose: false, StatusName: "外部资源" },
- ],
- };
- },
- methods: {
- // 获取权限、所有的行业
- async getUserSearchContent() {
- // IsHideResearch 行业列表是否隐藏 买方研选
- const res = await activity.getUserSearchContent({
- IsShowJurisdiction: this.isGetJurisdiction,
- IsHideResearch:this.hideResearch
- });
- if (res.Ret === 200) {
- this.isShowJurisdiction = res.Data.IsShowJurisdiction;
- this.listChartPermission = res.Data.ListChartPermission;
- this.listChartPermissionInit = res.Data.ListChartPermission2;
- this.clickPermission();
- if (this.chartPermissionIds) {
- this.closeTheWindow();
- }
- }
- },
- // 点击后有权限的
- clickPermission() {
- if (this.isShowJurisdiction) {
- const arr = [];
- this.listChartPermission &&
- this.listChartPermission.forEach((key) => {
- if (key.IsChoose) {
- arr.push(key.ChartPermissionId);
- }
- });
- this.chartPermissionIds = arr.join(",");
- }
- },
- // 下拉的选择的关闭事件
- closeTheWindow() {
- const types = this.chartPermissionIds ? this.chartPermissionIds.split(",").map(Number) : [];
- if (types.length > 0) {
- const str = [];
- this.listChartPermission.forEach((item) => {
- if (types.includes(item.ChartPermissionId)) {
- item.IsChoose = true;
- str.push(item.PermissionName);
- } else {
- item.IsChoose = false;
- }
- });
- this.chartPermissionName = str.length == 6 ? "全行业" : str.join(",");
- }
- },
- // 是否有权限的点击事件
- async permissioActivity() {
- this.page_no = 1;
- if (!this.$store.state.isAuth && !this.$store.state.isBind) {
- this.selectComponent("#industry").toggle(false);
- this.isShowJurisdiction = !this.isShowJurisdiction;
- this.isGetJurisdiction = this.isShowJurisdiction ? 1 : 2;
- await this.getUserSearchContent();
- if (this.isShowJurisdiction) {
- this.getActivityList();
- this.replacementConfirm();
- } else {
- this.replacementBtn();
- }
- } else {
- //已授权未绑定
- this.$store.dispatch("checkHandle");
- }
- },
- // 下拉选择的确定事件
- replacementConfirm() {
- this.page_no = 1;
- const arr = [];
- const str = [];
- this.listChartPermission &&
- this.listChartPermission.forEach((key) => {
- if (key.IsChoose) {
- arr.push(key.ChartPermissionId);
- str.push(key.PermissionName);
- }
- });
- if ((str.length == this.listChartPermission.length) || str.length <= 0) {
- this.chartPermissionName = "全行业";
- } else {
- this.chartPermissionName = str.join(",");
- }
- this.chartPermissionIds = arr.join(",");
- this.getActivityList();
- this.selectComponent("#industry").toggle(false);
- },
- // 下拉的选择的重置事件
- replacementBtn() {
- this.page_no = 1;
- this.listChartPermission = this.listChartPermissionInit;
- this.chartPermissionIds = "";
- this.isShowJurisdiction = false;
- this.listChartPermission.map((item) => (item.IsChoose = false));
- this.chartPermissionName = "全行业";
- this.getActivityList();
- },
- // 选择的选中事件
- overallClick(item) {
- if (this.isShowJurisdiction) return;
- item.IsChoose = !item.IsChoose;
- },
- // 本周上周、本月上月的筛选
- monthWeekHandler(item) {
- if (this.$refs["select-conyent"]) {
- this.selectComponent("#industry").toggle(false);
- }
- if (this.dateType !== item.type) {
- this.dateType = item.type;
- this.activityMonthWeekList.forEach((key) => {
- if (key.type !== item.type) {
- }
- key.IsChoose = false;
- });
- }
- item.IsChoose = !item.IsChoose;
- let val = this.obtainSelectId(this.activityMonthWeekList);
- this.whichDay = val;
- this.getActivityList();
- },
- // 今日、明日、专家、分析师的筛选
- selectMultipleHandler(item, type) {
- if (this.$refs["select-conyent"]) {
- this.selectComponent("#industry").toggle(false);
- }
- item.IsChoose = !item.IsChoose;
- let val = this.obtainSelectId(type == "类型" ? this.activityTypeList : type == "扣点" ? this.ResearchExternal : this.activityTimeList);
- type == "类型" ? (this.selectActiveId = val) : type == "扣点" ? (this.ResearchExternalAct = val) : (this.whichDay = val);
- this.getActivityList();
- },
- // 获取筛选后的id
- obtainSelectId(value) {
- let arr = [];
- value.forEach((item) => {
- if (item.IsChoose) {
- arr.push(item.Id);
- }
- });
- return arr.join(",");
- },
- },
- onLoad() {
- // this.$nextTick(() => {
- setTimeout(() => {
- this.getUserSearchContent();
- });
- // });
- },
- };
|