|
|
@ -181,340 +181,340 @@ import Setting from '@/setting' |
|
|
|
let startTimeLimit = '' |
|
|
|
let startTimeLimit = '' |
|
|
|
let endTimeLimit = '' |
|
|
|
let endTimeLimit = '' |
|
|
|
export default { |
|
|
|
export default { |
|
|
|
data() { |
|
|
|
data() { |
|
|
|
return { |
|
|
|
return { |
|
|
|
that: this, |
|
|
|
that: this, |
|
|
|
token: util.local.get(Setting.tokenKey), |
|
|
|
token: util.local.get(Setting.tokenKey), |
|
|
|
typeId: this.$route.query.typeId, // 从首页跳转过来传的分类id |
|
|
|
typeId: this.$route.query.typeId, // 从首页跳转过来传的分类id |
|
|
|
typeList: [], |
|
|
|
typeList: [], |
|
|
|
defaultType: '', |
|
|
|
defaultType: '', |
|
|
|
defaultOpenType: [], |
|
|
|
defaultOpenType: [], |
|
|
|
introduce: '', |
|
|
|
introduce: '', |
|
|
|
dataSource: '', |
|
|
|
dataSource: '', |
|
|
|
keyword: '', |
|
|
|
keyword: '', |
|
|
|
search:'', |
|
|
|
search: '', |
|
|
|
listData: [], |
|
|
|
listData: [], |
|
|
|
listDataAll: [], |
|
|
|
listDataAll: [], |
|
|
|
searchListData: [], |
|
|
|
searchListData: [], |
|
|
|
page: 1, |
|
|
|
page: 1, |
|
|
|
pageSize: 10, |
|
|
|
pageSize: 10, |
|
|
|
total: 0, |
|
|
|
total: 0, |
|
|
|
previewHead: [], |
|
|
|
previewHead: [], |
|
|
|
previewData: [], |
|
|
|
previewData: [], |
|
|
|
downloadVisible: false, |
|
|
|
downloadVisible: false, |
|
|
|
curRow: {}, |
|
|
|
curRow: {}, |
|
|
|
checkAllFields: false, |
|
|
|
checkAllFields: false, |
|
|
|
fields: [], |
|
|
|
fields: [], |
|
|
|
fieldsList: [], |
|
|
|
fieldsList: [], |
|
|
|
startTime: '', |
|
|
|
startTime: '', |
|
|
|
endTime: '', |
|
|
|
endTime: '', |
|
|
|
startTimeLimit: '', |
|
|
|
startTimeLimit: '', |
|
|
|
startTimeDisabled: false, |
|
|
|
startTimeDisabled: false, |
|
|
|
endTimeLimit: '', |
|
|
|
endTimeLimit: '', |
|
|
|
endTimeDisabled: false, |
|
|
|
endTimeDisabled: false, |
|
|
|
timeDefault: '', |
|
|
|
timeDefault: '', |
|
|
|
timeOptions: { |
|
|
|
timeOptions: { |
|
|
|
disabledDate(time) { |
|
|
|
disabledDate(time) { |
|
|
|
return time.getTime() < startTimeLimit || time.getTime() > endTimeLimit |
|
|
|
return time.getTime() < startTimeLimit || time.getTime() > endTimeLimit |
|
|
|
}, |
|
|
|
}, |
|
|
|
}, |
|
|
|
}, |
|
|
|
frequency: '', |
|
|
|
frequency: '', |
|
|
|
frequencyList: [ |
|
|
|
frequencyList: [ |
|
|
|
{ |
|
|
|
{ |
|
|
|
id: 1, |
|
|
|
id: 1, |
|
|
|
name: '日频' |
|
|
|
name: '日频' |
|
|
|
},{ |
|
|
|
}, { |
|
|
|
id: 2, |
|
|
|
id: 2, |
|
|
|
name: '周频' |
|
|
|
name: '周频' |
|
|
|
},{ |
|
|
|
}, { |
|
|
|
id: 3, |
|
|
|
id: 3, |
|
|
|
name: '月频' |
|
|
|
name: '月频' |
|
|
|
},{ |
|
|
|
}, { |
|
|
|
id: 4, |
|
|
|
id: 4, |
|
|
|
name: '季频' |
|
|
|
name: '季频' |
|
|
|
},{ |
|
|
|
}, { |
|
|
|
id: 5, |
|
|
|
id: 5, |
|
|
|
name: '年频' |
|
|
|
name: '年频' |
|
|
|
}, |
|
|
|
}, |
|
|
|
], |
|
|
|
], |
|
|
|
currentRow: null, |
|
|
|
currentRow: null, |
|
|
|
searchTimer:null |
|
|
|
searchTimer: null |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
}, |
|
|
|
|
|
|
|
computed: { |
|
|
|
|
|
|
|
...mapState('user', [ |
|
|
|
|
|
|
|
'schoolId' |
|
|
|
|
|
|
|
]), |
|
|
|
|
|
|
|
}, |
|
|
|
|
|
|
|
watch: { |
|
|
|
|
|
|
|
keyword: function(val) { |
|
|
|
|
|
|
|
clearTimeout(this.searchTimer) |
|
|
|
|
|
|
|
if (!this.rendered) { |
|
|
|
|
|
|
|
this.searchTimer = setTimeout(() => { |
|
|
|
|
|
|
|
this.initData() |
|
|
|
|
|
|
|
}, 500) |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
this.rendered = false |
|
|
|
|
|
|
|
}, |
|
|
|
|
|
|
|
}, |
|
|
|
|
|
|
|
mounted() { |
|
|
|
|
|
|
|
this.getType() |
|
|
|
|
|
|
|
// 如果是从首页点下载按钮跳转过来的,就直接显示下载弹框 |
|
|
|
|
|
|
|
if (this.$route.query.download) { |
|
|
|
|
|
|
|
this.download({ |
|
|
|
|
|
|
|
id: this.$route.query.id, |
|
|
|
|
|
|
|
name: this.$route.query.name, |
|
|
|
|
|
|
|
showName: this.$route.query.showName, |
|
|
|
|
|
|
|
}) |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
}, |
|
|
|
|
|
|
|
methods: { |
|
|
|
|
|
|
|
getType() { |
|
|
|
|
|
|
|
// 获取分类 |
|
|
|
|
|
|
|
this.$post(this.api.getTableByClassification).then(res => { |
|
|
|
|
|
|
|
let typeId = this.typeId // 取得传值的id |
|
|
|
|
|
|
|
let introduce = ''// 对应股票的介绍,规则为无children则取上级 |
|
|
|
|
|
|
|
let dataSource = '' // 数据来源,同上 |
|
|
|
|
|
|
|
let action |
|
|
|
|
|
|
|
// 取得选中的那一栏 |
|
|
|
|
|
|
|
function actionId(arr) {//传入res |
|
|
|
|
|
|
|
arr && arr.map((e, i) => { |
|
|
|
|
|
|
|
e.id = String(e.id) |
|
|
|
|
|
|
|
if (!i) { |
|
|
|
|
|
|
|
// 获取介绍和来源 |
|
|
|
|
|
|
|
if (e.introduce) introduce = e.introduce |
|
|
|
|
|
|
|
if (e.dataSource) dataSource = e.dataSource |
|
|
|
|
|
|
|
if (!action) action = e.children[0].children.length ? String(e.children[0].children[0].id) : String(e.children[0].id) |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
if (typeId && e.id == typeId) {// 若id匹配 |
|
|
|
|
|
|
|
action = String(e.id) |
|
|
|
|
|
|
|
if (e.children.length) {// 若有下级 |
|
|
|
|
|
|
|
if (!e.children[0].children.length) {// 找到下级的下级若无子级,则赋值勾选 |
|
|
|
|
|
|
|
action = String(e.children[0].id) |
|
|
|
|
|
|
|
} else {// 直接赋值 |
|
|
|
|
|
|
|
action = String(e.children[0].children[0].id) |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} else if (e.children.length) {// id不匹配,递归找 |
|
|
|
|
|
|
|
actionId(e.children) |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
}) |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
this.typeList = res |
|
|
|
|
|
|
|
actionId(res) |
|
|
|
|
|
|
|
this.defaultType = action |
|
|
|
|
|
|
|
this.introduce = introduce |
|
|
|
|
|
|
|
this.dataSource = dataSource |
|
|
|
|
|
|
|
this.getData() |
|
|
|
|
|
|
|
}).catch(res => { }) |
|
|
|
}, |
|
|
|
}, |
|
|
|
computed: { |
|
|
|
getData() { |
|
|
|
...mapState('user', [ |
|
|
|
this.$post(`${this.api.getIdQueryTable}?categoryId=${this.defaultType}&showName=${this.keyword}&pageNum=${this.page}&pageSize=${this.pageSize}&updateTime=`).then(res => { |
|
|
|
'schoolId' |
|
|
|
this.listData = res.pageList.records |
|
|
|
]), |
|
|
|
this.total = res.pageList.total |
|
|
|
|
|
|
|
// 默认显示第一条数据的字段 |
|
|
|
|
|
|
|
this.listData.length && this.preview(this.listData[0], 1) |
|
|
|
|
|
|
|
}).catch(res => { }) |
|
|
|
}, |
|
|
|
}, |
|
|
|
watch:{ |
|
|
|
initData() { |
|
|
|
keyword: function(val) { |
|
|
|
this.page = 1 |
|
|
|
clearTimeout(this.searchTimer) |
|
|
|
this.getData() |
|
|
|
if(!this.rendered){ |
|
|
|
|
|
|
|
this.searchTimer = setTimeout(() => { |
|
|
|
|
|
|
|
this.initData() |
|
|
|
|
|
|
|
},500) |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
this.rendered = false |
|
|
|
|
|
|
|
}, |
|
|
|
|
|
|
|
}, |
|
|
|
}, |
|
|
|
mounted() { |
|
|
|
handleCurrentChange(val) { |
|
|
|
this.getType() |
|
|
|
this.page = val |
|
|
|
// 如果是从首页点下载按钮跳转过来的,就直接显示下载弹框 |
|
|
|
this.$refs.table.clearSelection() |
|
|
|
if(this.$route.query.download){ |
|
|
|
this.getData() |
|
|
|
this.download({ |
|
|
|
|
|
|
|
id: this.$route.query.id, |
|
|
|
|
|
|
|
name: this.$route.query.name, |
|
|
|
|
|
|
|
showName: this.$route.query.showName, |
|
|
|
|
|
|
|
}) |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
}, |
|
|
|
}, |
|
|
|
methods: { |
|
|
|
// 分类展开及点击回调 |
|
|
|
getType(){ |
|
|
|
selectType(index, indexPath) { |
|
|
|
// 获取分类 |
|
|
|
let introduce = '' |
|
|
|
this.$post(this.api.getTableByClassification).then(res => { |
|
|
|
let dataSource = '' |
|
|
|
let typeId = this.typeId // 取得传值的id |
|
|
|
this.keyword = '' |
|
|
|
let introduce = ''// 对应股票的介绍,规则为无children则取上级 |
|
|
|
let list = this.typeList |
|
|
|
let dataSource = '' // 数据来源,同上 |
|
|
|
let select = '' |
|
|
|
let action |
|
|
|
function handleData(data) { |
|
|
|
// 取得选中的那一栏 |
|
|
|
data.map((n, i) => { |
|
|
|
function actionId(arr){//传入res |
|
|
|
// 匹配到点击的分类,默认展开子级第一个分类 |
|
|
|
arr && arr.map((e, i) => { |
|
|
|
if (n.id == index) { |
|
|
|
e.id = String(e.id) |
|
|
|
if (n.introduce) introduce = n.introduce |
|
|
|
if (!i) { |
|
|
|
if (n.dataSource) dataSource = n.dataSource |
|
|
|
// 获取介绍和来源 |
|
|
|
if (!select) select = n.children.length ? (n.children[0].children.length ? n.children[0].children[0].id : n.children[0].id) : n.id |
|
|
|
if (e.introduce) introduce = e.introduce |
|
|
|
} else { |
|
|
|
if (e.dataSource) dataSource = e.dataSource |
|
|
|
handleData(n.children) |
|
|
|
if (!action) action = e.children[0].children.length ? String(e.children[0].children[0].id) : String(e.children[0].id) |
|
|
|
} |
|
|
|
} |
|
|
|
}) |
|
|
|
if(typeId && e.id == typeId) {// 若id匹配 |
|
|
|
} |
|
|
|
action = String(e.id) |
|
|
|
handleData(list) |
|
|
|
if(e.children.length){// 若有下级 |
|
|
|
if (!introduce) introduce = list.find(n => n.id == indexPath[0]).introduce |
|
|
|
if(!e.children[0].children.length){// 找到下级的下级若无子级,则赋值勾选 |
|
|
|
if (!dataSource) dataSource = list.find(n => n.id == indexPath[0]).dataSource |
|
|
|
action = String(e.children[0].id) |
|
|
|
this.defaultType = select |
|
|
|
}else{// 直接赋值 |
|
|
|
this.introduce = introduce |
|
|
|
action = String(e.children[0].children[0].id) |
|
|
|
this.dataSource = dataSource |
|
|
|
} |
|
|
|
this.previewHead = [] |
|
|
|
} |
|
|
|
this.previewData = [] |
|
|
|
}else if(e.children.length){// id不匹配,递归找 |
|
|
|
this.initData() |
|
|
|
actionId(e.children) |
|
|
|
}, |
|
|
|
} |
|
|
|
previewCurrentChange(val) { |
|
|
|
}) |
|
|
|
this.currentRow = val |
|
|
|
} |
|
|
|
}, |
|
|
|
this.typeList = res |
|
|
|
preview(row, isDefault) { |
|
|
|
actionId(res) |
|
|
|
this.$get(`${this.api.previewData}?tableName=${row.name}&tableId=${row.id}`).then(res => { |
|
|
|
this.defaultType = action |
|
|
|
// 查询次数+1 |
|
|
|
this.introduce = introduce |
|
|
|
this.$post(this.api.saveRecord, { |
|
|
|
this.dataSource = dataSource |
|
|
|
tableId: row.id, |
|
|
|
this.getData() |
|
|
|
type: 2, |
|
|
|
}).catch(res => {}) |
|
|
|
}).then(res => { }).catch(res => { }) |
|
|
|
}, |
|
|
|
|
|
|
|
getData(){ |
|
|
|
|
|
|
|
this.$post(`${this.api.getIdQueryTable}?categoryId=${this.defaultType}&showName=${this.keyword}&pageNum=${this.page}&pageSize=${this.pageSize}&updateTime=`).then(res => { |
|
|
|
|
|
|
|
this.listData = res.pageList.records |
|
|
|
|
|
|
|
this.total = res.pageList.total |
|
|
|
|
|
|
|
// 默认显示第一条数据的字段 |
|
|
|
|
|
|
|
this.listData.length && this.preview(this.listData[0],1) |
|
|
|
|
|
|
|
}).catch(res => {}) |
|
|
|
|
|
|
|
}, |
|
|
|
|
|
|
|
initData(){ |
|
|
|
|
|
|
|
this.page = 1 |
|
|
|
|
|
|
|
this.getData() |
|
|
|
|
|
|
|
}, |
|
|
|
|
|
|
|
handleCurrentChange(val) { |
|
|
|
|
|
|
|
this.page = val |
|
|
|
|
|
|
|
this.$refs.table.clearSelection() |
|
|
|
|
|
|
|
this.getData() |
|
|
|
|
|
|
|
}, |
|
|
|
|
|
|
|
// 分类展开及点击回调 |
|
|
|
|
|
|
|
selectType(index,indexPath){ |
|
|
|
|
|
|
|
let introduce = '' |
|
|
|
|
|
|
|
let dataSource = '' |
|
|
|
|
|
|
|
this.keyword = '' |
|
|
|
|
|
|
|
let list = this.typeList |
|
|
|
|
|
|
|
let select = '' |
|
|
|
|
|
|
|
function handleData(data) { |
|
|
|
|
|
|
|
data.map((n, i) => { |
|
|
|
|
|
|
|
// 匹配到点击的分类,默认展开子级第一个分类 |
|
|
|
|
|
|
|
if(n.id == index){ |
|
|
|
|
|
|
|
if (n.introduce) introduce = n.introduce |
|
|
|
|
|
|
|
if (n.dataSource) dataSource = n.dataSource |
|
|
|
|
|
|
|
if (!select) select = n.children.length ? (n.children[0].children.length ? n.children[0].children[0].id : n.children[0].id) : n.id |
|
|
|
|
|
|
|
}else{ |
|
|
|
|
|
|
|
handleData(n.children) |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
}) |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
handleData(list) |
|
|
|
|
|
|
|
if(!introduce) introduce = list.find(n => n.id == indexPath[0]).introduce |
|
|
|
|
|
|
|
if(!dataSource) dataSource = list.find(n => n.id == indexPath[0]).dataSource |
|
|
|
|
|
|
|
this.defaultType = select |
|
|
|
|
|
|
|
this.introduce = introduce |
|
|
|
|
|
|
|
this.dataSource = dataSource |
|
|
|
|
|
|
|
this.previewHead = [] |
|
|
|
|
|
|
|
this.previewData = [] |
|
|
|
|
|
|
|
this.initData() |
|
|
|
|
|
|
|
}, |
|
|
|
|
|
|
|
previewCurrentChange(val){ |
|
|
|
|
|
|
|
this.currentRow = val |
|
|
|
|
|
|
|
}, |
|
|
|
|
|
|
|
preview(row,isDefault){ |
|
|
|
|
|
|
|
this.$get(`${this.api.previewData}?tableName=${row.name}&tableId=${row.id}`).then(res => { |
|
|
|
|
|
|
|
// 查询次数+1 |
|
|
|
|
|
|
|
this.$post(this.api.saveRecord,{ |
|
|
|
|
|
|
|
tableId: row.id, |
|
|
|
|
|
|
|
type: 2, |
|
|
|
|
|
|
|
}).then(res => {}).catch(res => {}) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
let comment = res.comment |
|
|
|
let comment = res.comment |
|
|
|
let previewHead = [] |
|
|
|
let previewHead = [] |
|
|
|
comment.map(n => { |
|
|
|
comment.map(n => { |
|
|
|
// id和操作时间不用显示 |
|
|
|
// id和操作时间不用显示 |
|
|
|
n.field != 'id' && n.field != 'operation_time' && previewHead.push(n) |
|
|
|
n.field != 'id' && n.field != 'operation_time' && previewHead.push(n) |
|
|
|
}) |
|
|
|
}) |
|
|
|
this.previewHead = previewHead |
|
|
|
this.previewHead = previewHead |
|
|
|
|
|
|
|
|
|
|
|
let data = res.data |
|
|
|
let data = res.data |
|
|
|
data.map(n => { |
|
|
|
data.map(n => { |
|
|
|
for(let i in n){ |
|
|
|
for (let i in n) { |
|
|
|
// 如果是以+0000结尾的,就表明这个是时间,则转化为正常的时间格式 |
|
|
|
// 如果是以+0000结尾的,就表明这个是时间,则转化为正常的时间格式 |
|
|
|
if(typeof n[i] == 'string' && n[i].endsWith('+0000')) n[i] = util.formatDate('yyyy-MM-dd hh:mm:ss',new Date(n[i])) |
|
|
|
if (typeof n[i] == 'string' && n[i].endsWith('+0000')) n[i] = util.formatDate('yyyy-MM-dd hh:mm:ss', new Date(n[i])) |
|
|
|
} |
|
|
|
} |
|
|
|
}) |
|
|
|
}) |
|
|
|
this.previewData = data |
|
|
|
this.previewData = data |
|
|
|
// 如果不是加载完数据默认显示的情况,就滚动到页面可视位置 |
|
|
|
// 如果不是加载完数据默认显示的情况,就滚动到页面可视位置 |
|
|
|
isDefault || this.$nextTick(() => { |
|
|
|
isDefault || this.$nextTick(() => { |
|
|
|
document.querySelector('#previewTable').scrollIntoView() |
|
|
|
document.querySelector('#previewTable').scrollIntoView() |
|
|
|
}) |
|
|
|
}) |
|
|
|
|
|
|
|
|
|
|
|
}).catch(res => {}) |
|
|
|
}).catch(res => { }) |
|
|
|
}, |
|
|
|
}, |
|
|
|
checkAllFieldsChange(val) { |
|
|
|
checkAllFieldsChange(val) { |
|
|
|
this.fields = val ? this.fieldsList.map(n => n.comment) : [] |
|
|
|
this.fields = val ? this.fieldsList.map(n => n.comment) : [] |
|
|
|
}, |
|
|
|
}, |
|
|
|
download(row){ |
|
|
|
download(row) { |
|
|
|
// 查询是否购买了该数据,只有购买了才能下载 |
|
|
|
// 查询是否购买了该数据,只有购买了才能下载 |
|
|
|
this.$get(`${this.api.isDownload}`,{ |
|
|
|
this.$get(`${this.api.isDownload}`, { |
|
|
|
tableId: row.id, |
|
|
|
tableId: row.id, |
|
|
|
schoolId: this.schoolId, |
|
|
|
schoolId: this.schoolId, |
|
|
|
}).then(res => { |
|
|
|
}).then(res => { |
|
|
|
this.curRow = row |
|
|
|
this.curRow = row |
|
|
|
this.downloadVisible = true |
|
|
|
this.downloadVisible = true |
|
|
|
|
|
|
|
|
|
|
|
// 查询有数据的时间段,接口会返回开始时间和结束时间,但也有写数据是没有这两个时间的 |
|
|
|
// 查询有数据的时间段,接口会返回开始时间和结束时间,但也有写数据是没有这两个时间的 |
|
|
|
this.$get(`${this.api.getTableTime}`,{ |
|
|
|
this.$get(`${this.api.getTableTime}`, { |
|
|
|
tableId: row.id |
|
|
|
tableId: row.id |
|
|
|
}).then(res => { |
|
|
|
}).then(res => { |
|
|
|
let list = res.message |
|
|
|
let list = res.message |
|
|
|
if(list.startTime){ |
|
|
|
if (list.startTime) { |
|
|
|
startTimeLimit = new Date(list.startTime).getTime() |
|
|
|
startTimeLimit = new Date(list.startTime).getTime() |
|
|
|
}else{ |
|
|
|
} else { |
|
|
|
// 如果没有开始时间,则禁止选择开始时间 |
|
|
|
// 如果没有开始时间,则禁止选择开始时间 |
|
|
|
this.startTimeDisabled = true |
|
|
|
this.startTimeDisabled = true |
|
|
|
} |
|
|
|
} |
|
|
|
if(list.endTime){ |
|
|
|
if (list.endTime) { |
|
|
|
endTimeLimit = new Date(list.endTime).getTime() |
|
|
|
endTimeLimit = new Date(list.endTime).getTime() |
|
|
|
this.timeDefault = list.endTime |
|
|
|
this.timeDefault = list.endTime |
|
|
|
}else{ |
|
|
|
} else { |
|
|
|
// 如果没有结束时间,则禁止选择结束时间 |
|
|
|
// 如果没有结束时间,则禁止选择结束时间 |
|
|
|
this.endTimeDisabled = true |
|
|
|
this.endTimeDisabled = true |
|
|
|
} |
|
|
|
} |
|
|
|
}).catch(res => {}) |
|
|
|
}).catch(res => { }) |
|
|
|
|
|
|
|
|
|
|
|
this.$get(`${this.api.previewData}?tableName=${row.name}&tableId=${row.id}`).then(res => { |
|
|
|
this.$get(`${this.api.previewData}?tableName=${row.name}&tableId=${row.id}`).then(res => { |
|
|
|
let comment = res.comment |
|
|
|
let comment = res.comment |
|
|
|
let fieldsList = [] |
|
|
|
let fieldsList = [] |
|
|
|
comment.map(n => { |
|
|
|
comment.map(n => { |
|
|
|
n.field != 'id' && n.field != 'operation_time' && fieldsList.push(n) |
|
|
|
n.field != 'id' && n.field != 'operation_time' && fieldsList.push(n) |
|
|
|
}) |
|
|
|
}) |
|
|
|
this.fieldsList = fieldsList |
|
|
|
this.fieldsList = fieldsList |
|
|
|
}).catch(res => {}) |
|
|
|
}).catch(res => { }) |
|
|
|
}).catch(res => {}) |
|
|
|
}).catch(res => { }) |
|
|
|
}, |
|
|
|
}, |
|
|
|
closeDownload(){ |
|
|
|
closeDownload() { |
|
|
|
this.checkAllFields = false |
|
|
|
this.checkAllFields = false |
|
|
|
this.fields = [] |
|
|
|
this.fields = [] |
|
|
|
this.startTime = '' |
|
|
|
this.startTime = '' |
|
|
|
this.endTime = '' |
|
|
|
this.endTime = '' |
|
|
|
this.frequency = '' |
|
|
|
this.frequency = '' |
|
|
|
this.$router.push('/data').catch(err => {}) |
|
|
|
this.$router.push('/data').catch(err => { }) |
|
|
|
}, |
|
|
|
}, |
|
|
|
confirmDown(){ |
|
|
|
confirmDown() { |
|
|
|
let fields = this.fields |
|
|
|
let fields = this.fields |
|
|
|
if(!fields.length) return util.warningMsg('请选择字段') |
|
|
|
if (!fields.length) return util.warningMsg('请选择字段') |
|
|
|
if(!this.startTime) return util.warningMsg('请选择开始时间') |
|
|
|
if (!this.startTime) return util.warningMsg('请选择开始时间') |
|
|
|
if(!this.endTime) return util.warningMsg('请选择结束时间') |
|
|
|
if (!this.endTime) return util.warningMsg('请选择结束时间') |
|
|
|
if(!this.frequency) return util.warningMsg('请选择数据频率') |
|
|
|
if (!this.frequency) return util.warningMsg('请选择数据频率') |
|
|
|
let invalid = false |
|
|
|
let invalid = false |
|
|
|
|
|
|
|
|
|
|
|
if(this.startTime && this.endTime){ |
|
|
|
if (this.startTime && this.endTime) { |
|
|
|
let startTime = new Date(this.startTime) |
|
|
|
let startTime = new Date(this.startTime) |
|
|
|
let endTime = new Date(this.endTime) |
|
|
|
let endTime = new Date(this.endTime) |
|
|
|
let frequency = this.frequency |
|
|
|
let frequency = this.frequency |
|
|
|
|
|
|
|
|
|
|
|
// 只要选择的不是日频,则要判断选择的日期区间有没有包含这段频率对应的完整交易日段 |
|
|
|
// 只要选择的不是日频,则要判断选择的日期区间有没有包含这段频率对应的完整交易日段 |
|
|
|
// 比如选的是周频,则判断选择的时间区间有没有包含一段完整的星期交易日,即星期1~5, |
|
|
|
// 比如选的是周频,则判断选择的时间区间有没有包含一段完整的星期交易日,即星期1~5, |
|
|
|
// 选的是月频的话,则判断选择的时间区间有没有包含一个完整的月份,即30天;年份同理 |
|
|
|
// 选的是月频的话,则判断选择的时间区间有没有包含一个完整的月份,即30天;年份同理 |
|
|
|
if(frequency == 2){ |
|
|
|
if (frequency == 2) { |
|
|
|
let week = [] |
|
|
|
let week = [] |
|
|
|
while(startTime <= endTime){ |
|
|
|
while (startTime <= endTime) { |
|
|
|
let weekNum = startTime.getDay() |
|
|
|
let weekNum = startTime.getDay() |
|
|
|
if(weekNum == 0) weekNum = 7 |
|
|
|
if (weekNum == 0) weekNum = 7 |
|
|
|
week.push(weekNum) |
|
|
|
week.push(weekNum) |
|
|
|
startTime.setTime(startTime.getTime() + 86400000) |
|
|
|
startTime.setTime(startTime.getTime() + 86400000) |
|
|
|
} |
|
|
|
} |
|
|
|
// 如果没有包含1~5,则提示请选择完整区间,下面同理 |
|
|
|
// 如果没有包含1~5,则提示请选择完整区间,下面同理 |
|
|
|
for(let i = 1;i <= 5;i++){ |
|
|
|
for (let i = 1; i <= 5; i++) { |
|
|
|
if(!week.includes(i)){ |
|
|
|
if (!week.includes(i)) { |
|
|
|
invalid = true |
|
|
|
invalid = true |
|
|
|
break |
|
|
|
break |
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
}else if(frequency == 3){ |
|
|
|
|
|
|
|
if((endTime.getTime() - startTime.getTime()) / 86400000 < 30) invalid = true |
|
|
|
|
|
|
|
}else if(frequency == 4){ |
|
|
|
|
|
|
|
if((endTime.getTime() - startTime.getTime()) / 86400000 < 90) invalid = true |
|
|
|
|
|
|
|
}else if(frequency == 5){ |
|
|
|
|
|
|
|
if((endTime.getTime() - startTime.getTime()) / 86400000 < 365) invalid = true |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} else if (frequency == 3) { |
|
|
|
|
|
|
|
if ((endTime.getTime() - startTime.getTime()) / 86400000 < 30) invalid = true |
|
|
|
|
|
|
|
} else if (frequency == 4) { |
|
|
|
|
|
|
|
if ((endTime.getTime() - startTime.getTime()) / 86400000 < 90) invalid = true |
|
|
|
|
|
|
|
} else if (frequency == 5) { |
|
|
|
|
|
|
|
if ((endTime.getTime() - startTime.getTime()) / 86400000 < 365) invalid = true |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
if(invalid) return util.warningMsg('请选择完整区间') |
|
|
|
if (invalid) return util.warningMsg('请选择完整区间') |
|
|
|
|
|
|
|
|
|
|
|
let newFields = [] |
|
|
|
let newFields = [] |
|
|
|
let fieldsList = this.fieldsList |
|
|
|
let fieldsList = this.fieldsList |
|
|
|
fields.map(n => { |
|
|
|
fields.map(n => { |
|
|
|
newFields.push(fieldsList.find(e => e.comment == n).field) |
|
|
|
newFields.push(fieldsList.find(e => e.comment == n).field) |
|
|
|
}) |
|
|
|
}) |
|
|
|
let msgObj = util.successMsg('数据正在生成中,请稍等片刻,生成后会自动下载,您可以先访问其他页面。',5000) |
|
|
|
let msgObj = util.successMsg('数据正在生成中,请稍等片刻,生成后会自动下载,您可以先访问其他页面。', 5000) |
|
|
|
this.downloadVisible = false |
|
|
|
this.downloadVisible = false |
|
|
|
|
|
|
|
|
|
|
|
let startTime = this.startTime ? this.startTime : '' |
|
|
|
let startTime = this.startTime ? this.startTime : '' |
|
|
|
let endTime = this.endTime ? this.endTime : '' |
|
|
|
let endTime = this.endTime ? this.endTime : '' |
|
|
|
let frequency = this.frequency |
|
|
|
let frequency = this.frequency |
|
|
|
axios.get(`${this.api.downloadData}?tableName=${this.curRow.name}&table_id=${this.curRow.id}&fields=${newFields.join()}&startTime=${startTime}&endTime=${endTime}&frequency=${frequency}`,{ |
|
|
|
axios.get(`${this.api.downloadData}?tableName=${this.curRow.name}&table_id=${this.curRow.id}&fields=${newFields.join()}&startTime=${startTime}&endTime=${endTime}&frequency=${frequency}`, { |
|
|
|
headers: { |
|
|
|
headers: { |
|
|
|
token: this.token |
|
|
|
token: this.token |
|
|
|
}, |
|
|
|
}, |
|
|
|
responseType: 'blob' |
|
|
|
responseType: 'blob' |
|
|
|
}).then((res) => { |
|
|
|
}).then((res) => { |
|
|
|
msgObj.close() |
|
|
|
msgObj.close() |
|
|
|
if(res.data.type != 'multipart/form-data') return util.warningMsg('数据总数为零!') |
|
|
|
if (res.data.type != 'multipart/form-data') return util.warningMsg('数据总数为零!') |
|
|
|
// 统一调用该方法去下载excel |
|
|
|
// 统一调用该方法去下载excel |
|
|
|
util.downloadFileDirect(`${this.curRow.showName}.xls`,new Blob([res.data])) |
|
|
|
util.downloadFileDirect(`${this.curRow.showName}.xls`, new Blob([res.data])) |
|
|
|
|
|
|
|
|
|
|
|
// 下载记录 |
|
|
|
// 下载记录 |
|
|
|
this.$get(`${this.api.downloadRecord}?tableId=${this.curRow.id}&fields=${newFields.join()}` + (startTime ? `&startTime=${startTime}` : '') + (endTime ? `&endTime=${endTime}` : '') + `&frequency=${frequency}`).then(res => {}).catch(res => {}) |
|
|
|
this.$get(`${this.api.downloadRecord}?tableId=${this.curRow.id}&fields=${newFields.join()}` + (startTime ? `&startTime=${startTime}` : '') + (endTime ? `&endTime=${endTime}` : '') + `&frequency=${frequency}`).then(res => { }).catch(res => { }) |
|
|
|
|
|
|
|
|
|
|
|
// 下载次数+1 |
|
|
|
// 下载次数+1 |
|
|
|
this.$post(this.api.saveRecord,{ |
|
|
|
this.$post(this.api.saveRecord, { |
|
|
|
tableId: this.curRow.id, |
|
|
|
tableId: this.curRow.id, |
|
|
|
type: 1, |
|
|
|
type: 1, |
|
|
|
}).then(res => {}).catch(res => {}) |
|
|
|
}).then(res => { }).catch(res => { }) |
|
|
|
}).catch(res => { |
|
|
|
}).catch(res => { |
|
|
|
msgObj.close() |
|
|
|
msgObj.close() |
|
|
|
}) |
|
|
|
}) |
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
}; |
|
|
|
}; |
|
|
|
</script> |
|
|
|
</script> |
|
|
|
|
|
|
|
|
|
|
@ -526,10 +526,8 @@ export default { |
|
|
|
|
|
|
|
|
|
|
|
.menu{ |
|
|
|
.menu{ |
|
|
|
width: 200px; |
|
|
|
width: 200px; |
|
|
|
border-radius: 8px; |
|
|
|
|
|
|
|
overflow: hidden; |
|
|
|
overflow: hidden; |
|
|
|
&>.el-menu-item,.el-submenu__title{ |
|
|
|
&>.el-menu-item,.el-submenu__title{ |
|
|
|
background-color: rgba(228,237,255,.4); |
|
|
|
|
|
|
|
span{ |
|
|
|
span{ |
|
|
|
font-size: 15px; |
|
|
|
font-size: 15px; |
|
|
|
color: #3381d2; |
|
|
|
color: #3381d2; |
|
|
@ -540,14 +538,13 @@ export default { |
|
|
|
} |
|
|
|
} |
|
|
|
.el-submenu.is-active{ |
|
|
|
.el-submenu.is-active{ |
|
|
|
.el-submenu__title{ |
|
|
|
.el-submenu__title{ |
|
|
|
background-color: rgba(147,184,255,.3); |
|
|
|
|
|
|
|
&+.el-menu .el-submenu__title{ |
|
|
|
&+.el-menu .el-submenu__title{ |
|
|
|
background-color: rgba(147,184,255,.15); |
|
|
|
background-color: rgba(147,184,255,.15); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
.el-menu-item.is-active{ |
|
|
|
.el-menu-item.is-active{ |
|
|
|
color: $main-color; |
|
|
|
background-color: #0070FF; |
|
|
|
} |
|
|
|
} |
|
|
|
.level-6 { |
|
|
|
.level-6 { |
|
|
|
padding-right: 0; |
|
|
|
padding-right: 0; |
|
|
|