You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

252 lines
7.2 KiB

This file contains ambiguous Unicode characters!

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

import {getSchemeDataToTheme} from "@/api/ThemeAnalize"
import {setSchemeData} from "@/api/ThemeAnalize"
import {delCarBigDataByGuid} from "@/api/ThemeAnalize"
import {getSchemeDataByGuid} from "@/api/ThemeAnalize"
export default {
getNowData() {
let obj = Object.assign({}, this.form);
getSchemeDataToTheme(obj).then(res => {
let data = res.data;
let themeArr = [];
data.forEach(ele => {
let obj = {
guids: ele.Guids,
name: ele.Name,
startTime: ele.StartTime,
endTime: ele.EndTime,
total: ele.ReportSum,
isCom: true
};
//判断是否到期
if(new Date(ele.EndTime) <= new Date(this.getDatetime().clock + '' + this.getDatetime().sClock)) {
obj.isCom = false
}
themeArr.push(obj);
})
this.myThemeArr = themeArr;
})
},
//回退
goBack() {
this.setHeaderType(3);
this.$router.go(-1);
},
//新增按钮
handlerAdd() {
this.modalObj.title = '新建主题'
this.reSet();
this.combo = {
number: 0,
display: []
};
this.combo2 = {
number: 0,
display: []
};
this.modalObj.visible = true
},
//编辑修改
handlerEdit(guids) {
this.modalObj.title = '编辑主题'
let obj = {
token: this.getToken,
Guids: guids
};
getSchemeDataByGuid(obj).then(res => {
let data = res.data;
this.addForm = data;
this.selTime = [data.StartTime, data.EndTime];
if(data.DetailsData[0].IsAdvancedQuery == 1) {
this.changeMode(1)
} else if(data.DetailsData[0].IsAdvancedQuery == 2) {
this.changeMode(0);
this.handlerHH(1);
} else {
this.changeMode(0);
this.handlerHH(0);
}
this.doCombo();
this.doCombo2();
this.modalObj.visible = true;
})
},
//删除
handlerDel(guids) {
let obj = {
token: this.getToken,
Guids: guids
}
delCarBigDataByGuid(obj).then(() => {
this.getNowData();
})
},
//删除确认框
cancel() {},
onClose() {
this.modalObj.visible = false;
},
//新增确认框
handlerOk() {
let newForm = {
token: "",
DataJson: ""
};
newForm.token = this.getToken;
newForm.DataJson = JSON.stringify(this.addForm);
let obj = Object.assign({}, newForm);
setSchemeData(obj).then(res => {
this.getNowData();
this.reSet();
})
this.modalObj.visible = false;
},
handlerCancel() {
this.addForm.Guids = null;
this.reSet();
this.modalObj.visible = false;
},
//配置示例
doCombo() {
let bArr = this.addForm.DetailsData[0].AnalyzeWord.replace(/,/g,'');
let bWord = bArr.split('');
let hArr = this.addForm.DetailsData[0].HuoWord.replace(/,/g,'');
let hWord = hArr.split('');
let arr = [];
let bString = '';
for(let i=0;i<bWord.length;i++) {
if(i < bWord.length - 1) {
bString = bString + bWord[i].trim() + '+'
} else {
bString = bString + bWord[i].trim()
}
}
hWord.forEach(ele => {
let str = '';
if(ele != '') {
str = bString + '+' + ele.trim();
} else {
str = bString + ele.trim();
}
arr.push(str)
})
this.combo.display = arr;
this.combo.number = arr.length;
},
doCombo2() {
let bArr = this.addForm.DetailsData[0].AnalyzeWord.replace(/,/g,'');
let bWord = bArr.split('');
let hArr = this.addForm.DetailsData[0].HuoWord.replace(/,/g,'');
let hWord = hArr.split('');
let hArr1 = this.addForm.DetailsData[0].HuoWord1.replace(/,/g,'');
let hWord1 = hArr1.split('');
let arr = [];
for(let i = 0; i<bWord.length; i++) {
for(let j = 0; j<hWord.length; j++) {
for(let k = 0; k<hWord1.length; k++) {
let str = bWord[i] + '+' + hWord[j] + '+' + hWord1[k]
arr.push(str)
}
}
};
this.combo2.display = arr;
this.combo2.number = arr.length;
},
//切换模式
handlerHH(activeTab) {
this.mode = activeTab;
if(this.isHigh != 1 && activeTab == 0) {
this.addForm.DetailsData[0].IsAdvancedQuery = 0;
this.activeAnd = 0;
this.doCombo();
}
if(this.isHigh != 1 && activeTab == 1) {
this.addForm.DetailsData[0].IsAdvancedQuery = 2;
this.activeAnd = 1;
this.doCombo2();
};
},
changeMode(activeTab) {
this.addForm.DetailsData[0].IsAdvancedQuery = activeTab;
this.isHigh = activeTab;
this.activeMode = activeTab
},
//切换主题
handlerChangeTheme(n) {
if(n == 1) {
this.form.sType = 'former';
}
if(n == 0) {
this.form.sType = 'now';
};
this.getNowData();
},
//重置表单
reSet() {
this.selTime = [];
this.activeAnd = 0;
this.activeMode = 0;
this.isHigh = 0;
this.addForm = {
Name: "",
Classify: 0,
StartTime: '',
EndTime: '',
Types: "theme_v6",
DetailsData: [
{AnalyzeWord: "",
HuoWord: "",
HuoWord1: "",
PaiChu: "",
Source: "",
Domain: "",
UserAuthor: "",
IsAdvancedQuery: this.addForm.DetailsData[0].IsAdvancedQuery //0普通 1高级
}
]
}
},
//前往详情页
toThemeData(guids,name) {
let obj = {
token: this.getToken,
Guids: guids
};
let sTime = '';
let eTime = '';
getSchemeDataByGuid(obj).then(res => {
let data = res.data;
sTime = data.StartTime;
eTime = data.EndTime;
this.$router.push(
{
path: '/ThemeData',
query: {
sGuid: guids,
name: name
},
}
)
})
},
//日期
calendarPriceRangeChange(date) {
this.selectPriceDate = date[0];
},
handlerChangeTime(val) {
this.addForm.StartTime = val[0];
this.addForm.EndTime = val[1];
this.selectPriceDate = "";
},
disabledDate(current) {
return false;
},
//主题对比
handlerCompare() {
this.$router.push(
{
path: '/ThemeComparison'
}
)
}
}