Commit 2813d7d8 authored by 陶进's avatar 陶进

提交一下

parent 528ab007
const { app } = require('electron').remote const axios = require("axios")
const axios = require('axios') const baseUrl = require(app.getAppPath() + '/build_config/url').baseUrl
const path = app.getAppPath()
const baseUrl = require(path + '/build_config/url').baseUrl
const { BrowserWindow } = require('electron').remote
var info = JSON.parse(localStorage.getItem('userInfo')) var info = JSON.parse(localStorage.getItem('userInfo'))
console.log(info)
var net = axios.create({ var net = axios.create({
baseURL: baseUrl, baseURL: baseUrl,
timeout: 1000000 timeout: 1000000
}); });
var netPost = function (url, data) { var netPost = function (url, data) {
return net.post(url, { return net.post(url, {
'Token': info.token, 'Token': info.token,
...@@ -77,7 +72,8 @@ net.interceptors.response.use(function (res) { ...@@ -77,7 +72,8 @@ net.interceptors.response.use(function (res) {
// 对响应错误做点什么 // 对响应错误做点什么
return Promise.reject(error) return Promise.reject(error)
}) })
module.exports = {
netPost function newHttp(){
return { netPost: netPost }
} }
// export default axios // export default axios
This source diff could not be displayed because it is too large. You can view the blob instead.
module.exports = (filename, dirname)=>{ const nodeHttp = require('http')
console.log(filename)
console.log(dirname) async function getVueFile(url) {
const fs = require('fs') return new Promise(function (resolve, reject) {
const os = require('os') nodeHttp.get(url, function (req, res) {
const platform = os.platform() var html = '';
const filePath = filename.replace('.js','.vue') req.on('data', (data) => {
const dirName = dirname.replace('.js','.vue') html += data
var name })
if(platform == 'darwin'){ req.on('end', () => {
name = dirName.split('/').pop() resolve(html)
}else{ });
name = dirName.split('\\').pop() req.on('error', (e) => {
} reject(e.message);
var data = fs.readFileSync(filePath); });
});
});
}
async function loadComponent(name, url) {
var data = await getVueFile(url)
var str = data.toString() var str = data.toString()
str = str.substring(0, str.lastIndexOf('</template>')) str = str.substring(0, str.lastIndexOf('</template>'))
str = str.replace('<template>','') str = str.replace('<template>','')
......
const fs = require('fs') async function getCalculater() {
const os = require('os') var value = await loadComponent('publicIndex', window.global.urls.loadUrl + '/src/views/main_views/indexManage/components/calculater/calculater.vue')
const platform = os.platform() return {
const filePath = __filename.replace('.js','.vue') name: value.name,
var name data: function () {
if(platform == 'darwin'){ return {
name = filePath.split('/').pop().replace('.vue','') initIndexId: 0,
}else{
name = filePath.split('\\').pop().replace('.vue','')
}
var data = fs.readFileSync(filePath);
var str = data.toString()
str.substring(0, str.lastIndexOf('</template>'))
str = str.replace('<template>','')
var keyBord = require('../../lib/keyBord')
var merge = require('../../lib/merge')
// const company = require('../../../components/indexConditions/company/company.js')
const conditionFuns = require('../../lib/conditionFun')
module.exports = {
name: name,
data: function () {
return {
initIndexId: 0,
indexParams: {},
numParams: {},
dateParams: {},
symbolParams: {},
functionParams: {},
keybordData: [],
mergeTypeData: merge.mergeData,
selectedController: {},
searchCompanyLoading: false,
companyData: [],
//添加指标
addIndexVisible: false,
modalActiveTab: '1',
selectedIndex: {
name: '',
code: '',
mark: '',
typeContent: null,
mergeType: '合并本期',
yearType: 1,
quarterType: 1,
t: 0,
q: 0,
inputYear: '',
inputQuarter: '',
needMergeType: false,
needReportData: false,
needCompany: false
},
selectedMergeType: '',
selectedReportYearType: '',
selectedReportQuarterType: '',
Tyear: 0,
Qquarter: 0,
selectedReportQuarter: '',
selectedReportYear: '',
filterInput: '',
treeProps: {
children: 'Sub',
label: 'Name'
},
indexNameData: [],
range: null,
selectedNum: 0,
selectedDate: '',
addNumVisible: false,
addDateVisible: false,
copiedController: {},
contentId: 0,
addFuncVisible: false,
editingFuncParamsIndex: 0
}
},
// components: {'company':company },
props:['treeData','type'],
template: str,
computed: {
},
watch: {
selectedController: {
handler: function() {
this.setAppointedIndexName(this.selectedController)
},
deep: true
}
},
mounted() {
this.initKeybord()
this.setSelfId()
this.setKeyboardData()
},
methods: {
deleteFuncParams (index) {
var origin = this.selectedController.originParams.params
var value = this.selectedController.paramsValue
origin.splice(index, 1)
value.splice(index, 1)
this.resetFuncValue(this.selectedController)
},
addMoreParams () {
var origin = this.selectedController.originParams.params
var value = this.selectedController.paramsValue
origin.push(JSON.parse(JSON.stringify(origin[0])))
value.push({})
this.selectedController = Object.assign({}, this.selectedController)
this.resetFuncValue(this.selectedController)
},
getFuncParamsName (arr) {
var obj = {
0: '指标',
1: '数字',
2: '字符',
3: '时间',
4: '公式'
}
var newArr = arr.map(item => {
return obj[item]
})
return newArr.join('或者')
},
openFunctionParams (index, type) {
this.editingFuncParamsIndex = index
this.$parent.editFuctionType = type
this.$parent.editFuctionVisible = true
},
receiveFunctionParam (params) {
this.selectedController.paramsValue[this.editingFuncParamsIndex] = params
this.selectedController = Object.assign({}, this.selectedController)
this.resetFuncValue(this.selectedController)
console.log(this.selectedController)
},
resetActiveInput () {
document.getElementById(this.selectedController.id).classList.add('active')
},
//重新设置指定id的方法的value
resetFuncValue (selectedController) {
var id = selectedController.id
var dom = document.getElementById(id)
var arr = []
selectedController.paramsValue.forEach(item => {
var text = this.getShowDomText(item.showDom)
arr.push(text)
})
var name = selectedController.key.replace('( )','')
var value = name + '(' + arr.join(', ') + ')'
dom.style.width = this.getInputLength(value) + 'px'
dom.setAttribute('value', value)
},
changeFuncParams (index) {
console.log(this.selectedController)
console.log(index)
this.$parent.editFuctionVisible = true
this.$nextTick(()=>{
//要先注入参数
this.$parent.resetFuncParams(this.selectedController, index)
})
},
getShowDomText (html) {
var div = document.createElement('div')
if(html){
div.innerHTML = html
return div.innerText
}else{
return '未设置'
}
},
//设置方法的参数
setKeyboardData () {
if(this.type == 'index'){
this.keybordData = keyBord.keybordData
}else if(this.type == 'function'){
this.keybordData = keyBord.functionKeybord
}
},
//向父组件传递数据
sendDataToHost (saveData) {
var content = document.getElementById(this.contentId)
var inputs = content.getElementsByTagName('input')
var params = {
indexParams: {}, indexParams: {},
dateParams: {},
numParams: {}, numParams: {},
dateParams: {},
symbolParams: {}, symbolParams: {},
functionParams: {}, functionParams: {},
dom: '' keybordData: [],
} mergeTypeData: ['合并本期','合并上期','母公司本期','母公司上期'],
var typeDic = { selectedController: {},
1: 'indexParams', searchCompanyLoading: false,
2: 'dateParams', companyData: [],
3: 'numParams', //添加指标
4: 'symbolParams', addIndexVisible: false,
5: 'functionParams' modalActiveTab: '1',
} selectedIndex: {
Array.from(inputs).forEach(item => { name: '',
var type = item.getAttribute('type') code: '',
var id = item.id mark: '',
var param = JSON.parse(JSON.stringify(this[typeDic[type]][id])) typeContent: null,
params[typeDic[type]][id] = param mergeType: '合并本期',
}) yearType: 1,
params.dom = content.innerHTML quarterType: 1,
params.showDom = this.changeInputToSpan(inputs) t: 0,
if(!saveData){ q: 0,
this.initCalData() inputYear: '',
inputQuarter: '',
needMergeType: false,
needReportData: false,
needCompany: false
},
selectedMergeType: '',
selectedReportYearType: '',
selectedReportQuarterType: '',
Tyear: 0,
Qquarter: 0,
selectedReportQuarter: '',
selectedReportYear: '',
filterInput: '',
treeProps: {
children: 'Sub',
label: 'Name'
},
indexNameData: [],
range: null,
selectedNum: 0,
selectedDate: '',
addNumVisible: false,
addDateVisible: false,
copiedController: {},
contentId: 0,
addFuncVisible: false,
editingFuncParamsIndex: 0
} }
return params
}, },
//重置所有参数 // components: {'company':company },
initCalData () { props: ['treeData', 'type'],
this.indexParams = {} template: value.template,
this.numParams = {} computed: {
this.dateParams = {}
this.symbolParams = {}
this.functionParams = {}
var content = document.getElementById(this.contentId)
content.innerHTML = ''
this.removeAllActive()
this.selectedController = {}
}, },
changeInputToSpan (inputs) { watch: {
var div = document.createElement('div') selectedController: {
Array.from(inputs).forEach(item => { handler: function () {
var span = document.createElement('span') this.setAppointedIndexName(this.selectedController)
span.innerHTML = item.value },
span.setAttribute('type', item.getAttribute('type')) deep: true
div.appendChild(span) }
})
var spans = div.getElementsByTagName('span')
this.formatShowDom(spans)
return div.innerHTML
}, },
formatShowDom (spans) { mounted() {
var brackets = [] this.initKeybord()
var numArea = [] this.setSelfId()
Array.from(spans).forEach(item => { this.setKeyboardData()
var value = item.innerText },
var br = document.createElement('br') methods: {
if('()&&||'.indexOf(value) >= 0 || (item.nextSibling && '()&&||'.indexOf(item.nextSibling.innerText) >= 0)){ deleteFuncParams(index) {
this.insertAfter(br,item) var origin = this.selectedController.originParams.params
var value = this.selectedController.paramsValue
origin.splice(index, 1)
value.splice(index, 1)
this.resetFuncValue(this.selectedController)
},
addMoreParams() {
var origin = this.selectedController.originParams.params
var value = this.selectedController.paramsValue
origin.push(JSON.parse(JSON.stringify(origin[0])))
value.push({})
this.selectedController = Object.assign({}, this.selectedController)
this.resetFuncValue(this.selectedController)
},
getFuncParamsName(arr) {
var obj = {
0: '指标',
1: '数字',
2: '字符',
3: '时间',
4: '公式'
} }
}) var newArr = arr.map(item => {
Array.from(spans).forEach((item, index) => { return obj[item]
var value = item.innerText })
if(value == '(' || value == ')'){ return newArr.join('或者')
brackets.push({ },
indet: 0, openFunctionParams(index, type) {
from: item, this.editingFuncParamsIndex = index
value: value, this.$parent.editFuctionType = type
originIndex: index this.$parent.editFuctionVisible = true
}) },
receiveFunctionParam(params) {
this.selectedController.paramsValue[this.editingFuncParamsIndex] = params
this.selectedController = Object.assign({}, this.selectedController)
this.resetFuncValue(this.selectedController)
console.log(this.selectedController)
},
resetActiveInput() {
document.getElementById(this.selectedController.id).classList.add('active')
},
//重新设置指定id的方法的value
resetFuncValue(selectedController) {
var id = selectedController.id
var dom = document.getElementById(id)
var arr = []
selectedController.paramsValue.forEach(item => {
var text = this.getShowDomText(item.showDom)
arr.push(text)
})
var name = selectedController.key.replace('( )', '')
var value = name + '(' + arr.join(', ') + ')'
dom.style.width = this.getInputLength(value) + 'px'
dom.setAttribute('value', value)
},
changeFuncParams(index) {
console.log(this.selectedController)
console.log(index)
this.$parent.editFuctionVisible = true
this.$nextTick(() => {
//要先注入参数
this.$parent.resetFuncParams(this.selectedController, index)
})
},
getShowDomText(html) {
var div = document.createElement('div')
if (html) {
div.innerHTML = html
return div.innerText
} else {
return '未设置'
} }
}) },
//设置方法的参数
brackets.forEach((item,index) => { setKeyboardData() {
if(index == 0){ if (this.type == 'index') {
item.indent = 0 this.keybordData = mytools.getKeyboard().keybordData
var text = this.createAppointedText(item.indent) } else if (this.type == 'function') {
item.from.parentNode.insertBefore(text, item.from) this.keybordData = mytools.getKeyboard().functionKeybord
}else{
var newIndent = brackets[index - 1].indent
if(brackets[index - 1].value !== item.value){
item.indent = newIndent
var text = this.createAppointedText(newIndent)
item.from.parentNode.insertBefore(text, item.from)
}else{
if(item.value == '('){
item.indent = newIndent + 4
}else{
item.indent = newIndent - 4
}
var text = this.createAppointedText(item.indent)
item.from.parentNode.insertBefore(text, item.from)
}
numArea.push({
start: brackets[index - 1].originIndex ,
end: item.originIndex,
indent: brackets[index - 1].indent,
value: brackets[index - 1].value
})
} }
}) console.log(this.keybordData)
},
Array.from(spans).forEach((item, index) => { //向父组件传递数据
var value = item.innerText sendDataToHost(saveData) {
if(value !== '(' && value !== ')' && item.previousSibling && item.previousSibling.nodeName == 'BR'){ var content = document.getElementById(this.contentId)
numArea.forEach(area => { var inputs = content.getElementsByTagName('input')
if(index > area.start && index < area.end){ var params = {
var newIndent indexParams: {},
if(area.value == '('){ dateParams: {},
newIndent = area.indent + 4 numParams: {},
}else{ symbolParams: {},
newIndent = area.indent functionParams: {},
} dom: ''
var text = this.createAppointedText(newIndent)
item.parentNode.insertBefore(text, item)
}
})
} }
}) var typeDic = {
}, 1: 'indexParams',
formatGrammar () { 2: 'dateParams',
var noOtherContent = this.emptyOtherText() //获取清空多余字段后的内容 3: 'numParams',
this.selectAllContent() //选中整个输入框 4: 'symbolParams',
var formatContent = document.createElement('div') 5: 'functionParams'
formatContent.innerHTML = noOtherContent
var inputs = formatContent.getElementsByTagName('input')
Array.from(inputs).forEach(item => {
var value = item.value
var br = document.createElement('br')
if('()&&||+-*/'.indexOf(value) >= 0 || (item.nextSibling && '()&&||+-*/'.indexOf(item.nextSibling.value) >= 0)){
this.insertAfter(br,item)
} }
}) Array.from(inputs).forEach(item => {
//此时得出一个没有缩进的内容 var type = item.getAttribute('type')
this.findAllbrackets(inputs) var id = item.id
document.execCommand('insertHTML', false, formatContent.innerHTML) var param = JSON.parse(JSON.stringify(this[typeDic[type]][id]))
return true params[typeDic[type]][id] = param
}, })
findAllbrackets (inputs) { params.dom = content.innerHTML
var brackets = [] params.showDom = this.changeInputToSpan(inputs)
var numArea = [] if (!saveData) {
Array.from(inputs).forEach((item, index) => { this.initCalData()
var value = item.value
if(value == '(' || value == ')'){
brackets.push({
indet: 0,
from: item,
value: value,
originIndex: index
})
} }
}) return params
brackets.forEach((item,index) => { },
if(index == 0){ //重置所有参数
item.indent = 0 initCalData() {
var text = this.createAppointedText(item.indent) this.indexParams = {}
item.from.parentNode.insertBefore(text, item.from) this.numParams = {}
}else{ this.dateParams = {}
var newIndent = brackets[index - 1].indent this.symbolParams = {}
if(brackets[index - 1].value !== item.value){ this.functionParams = {}
item.indent = newIndent var content = document.getElementById(this.contentId)
var text = this.createAppointedText(newIndent) content.innerHTML = ''
item.from.parentNode.insertBefore(text, item.from) this.removeAllActive()
}else{ this.selectedController = {}
if(item.value == '('){ },
item.indent = newIndent + 4 changeInputToSpan(inputs) {
}else{ var div = document.createElement('div')
item.indent = newIndent - 4 Array.from(inputs).forEach(item => {
} var span = document.createElement('span')
span.innerHTML = item.value
span.setAttribute('type', item.getAttribute('type'))
div.appendChild(span)
})
var spans = div.getElementsByTagName('span')
this.formatShowDom(spans)
return div.innerHTML
},
formatShowDom(spans) {
var brackets = []
var numArea = []
Array.from(spans).forEach(item => {
var value = item.innerText
var br = document.createElement('br')
if ('()&&||'.indexOf(value) >= 0 || (item.nextSibling && '()&&||'.indexOf(item.nextSibling.innerText) >= 0)) {
this.insertAfter(br, item)
}
})
Array.from(spans).forEach((item, index) => {
var value = item.innerText
if (value == '(' || value == ')') {
brackets.push({
indet: 0,
from: item,
value: value,
originIndex: index
})
}
})
brackets.forEach((item, index) => {
if (index == 0) {
item.indent = 0
var text = this.createAppointedText(item.indent) var text = this.createAppointedText(item.indent)
item.from.parentNode.insertBefore(text, item.from) item.from.parentNode.insertBefore(text, item.from)
} else {
var newIndent = brackets[index - 1].indent
if (brackets[index - 1].value !== item.value) {
item.indent = newIndent
var text = this.createAppointedText(newIndent)
item.from.parentNode.insertBefore(text, item.from)
} else {
if (item.value == '(') {
item.indent = newIndent + 4
} else {
item.indent = newIndent - 4
}
var text = this.createAppointedText(item.indent)
item.from.parentNode.insertBefore(text, item.from)
}
numArea.push({
start: brackets[index - 1].originIndex,
end: item.originIndex,
indent: brackets[index - 1].indent,
value: brackets[index - 1].value
})
} }
numArea.push({ })
start: brackets[index - 1].originIndex ,
end: item.originIndex,
indent: brackets[index - 1].indent,
value: brackets[index - 1].value
})
}
})
Array.from(inputs).forEach((item, index) => { Array.from(spans).forEach((item, index) => {
var value = item.value var value = item.innerText
if(value !== '(' && value !== ')' && item.previousSibling && item.previousSibling.nodeName == 'BR'){ if (value !== '(' && value !== ')' && item.previousSibling && item.previousSibling.nodeName == 'BR') {
numArea.forEach(area => { numArea.forEach(area => {
if(index > area.start && index < area.end){ if (index > area.start && index < area.end) {
var newIndent var newIndent
if(area.value == '('){ if (area.value == '(') {
newIndent = area.indent + 4 newIndent = area.indent + 4
}else{ } else {
newIndent = area.indent newIndent = area.indent
}
var text = this.createAppointedText(newIndent)
item.parentNode.insertBefore(text, item)
} }
})
}
})
},
formatGrammar() {
var noOtherContent = this.emptyOtherText() //获取清空多余字段后的内容
this.selectAllContent() //选中整个输入框
var formatContent = document.createElement('div')
formatContent.innerHTML = noOtherContent
var inputs = formatContent.getElementsByTagName('input')
Array.from(inputs).forEach(item => {
var value = item.value
var br = document.createElement('br')
if ('()&&||+-*/'.indexOf(value) >= 0 || (item.nextSibling && '()&&||+-*/'.indexOf(item.nextSibling.value) >= 0)) {
this.insertAfter(br, item)
}
})
//此时得出一个没有缩进的内容
this.findAllbrackets(inputs)
document.execCommand('insertHTML', false, formatContent.innerHTML)
return true
},
findAllbrackets(inputs) {
var brackets = []
var numArea = []
Array.from(inputs).forEach((item, index) => {
var value = item.value
if (value == '(' || value == ')') {
brackets.push({
indet: 0,
from: item,
value: value,
originIndex: index
})
}
})
brackets.forEach((item, index) => {
if (index == 0) {
item.indent = 0
var text = this.createAppointedText(item.indent)
item.from.parentNode.insertBefore(text, item.from)
} else {
var newIndent = brackets[index - 1].indent
if (brackets[index - 1].value !== item.value) {
item.indent = newIndent
var text = this.createAppointedText(newIndent) var text = this.createAppointedText(newIndent)
item.parentNode.insertBefore(text, item) item.from.parentNode.insertBefore(text, item.from)
} else {
if (item.value == '(') {
item.indent = newIndent + 4
} else {
item.indent = newIndent - 4
}
var text = this.createAppointedText(item.indent)
item.from.parentNode.insertBefore(text, item.from)
} }
}) numArea.push({
start: brackets[index - 1].originIndex,
end: item.originIndex,
indent: brackets[index - 1].indent,
value: brackets[index - 1].value
})
}
})
Array.from(inputs).forEach((item, index) => {
var value = item.value
if (value !== '(' && value !== ')' && item.previousSibling && item.previousSibling.nodeName == 'BR') {
numArea.forEach(area => {
if (index > area.start && index < area.end) {
var newIndent
if (area.value == '(') {
newIndent = area.indent + 4
} else {
newIndent = area.indent
}
var text = this.createAppointedText(newIndent)
item.parentNode.insertBefore(text, item)
}
})
}
})
},
createAppointedText(num) {
var str = '', text
for (var i = 0; i < num; i++) {
str += '\u00A0'
} }
}) text = document.createTextNode(str)
}, return text
createAppointedText (num) { },
var str = '', text insertAfter(newElement, targetElement) {
for(var i = 0; i < num; i++){ var parent = targetElement.parentNode
str+='\u00A0' if (parent.lastChild == targetElement) {
}
text = document.createTextNode(str)
return text
},
insertAfter(newElement, targetElement) {
var parent = targetElement.parentNode
if (parent.lastChild == targetElement){
parent.appendChild(targetElement) parent.appendChild(targetElement)
} else { } else {
parent.insertBefore(newElement, targetElement.nextSibling); parent.insertBefore(newElement, targetElement.nextSibling);
}
},
//清空多余字段并返回新的内容
emptyOtherText () {
var content = document.getElementById(this.contentId)
var newHTML = ''
var inputs = content.getElementsByTagName('input')
Array.from(inputs).forEach(item => {
newHTML+=item.outerHTML
})
this.selectAllContent()
return newHTML
},
//选中整个输入框
selectAllContent () {
var content = document.getElementById(this.contentId)
var selection = window.getSelection()
var range = document.createRange()
range.selectNodeContents(content)
selection.removeAllRanges()
selection.addRange(range)
},
setHtml (html) {
var content = document.getElementById(this.contentId)
content.innerHTML = html
this.$nextTick(()=>{
this.removeAllActive()
})
},
setSelfId () {
this.contentId = this.createIndexId()
},
//校验语法
checkGrammar (type) {
var content = document.getElementById(this.contentId)
var inputs = content.getElementsByTagName('input')
var code = 'var func;'
Array.from(inputs).forEach(item => {
var str = item.value
var type = item.getAttribute('type')
if(item.getAttribute('type') == 3){ //数字
str = str.replace(/\[.*?\]/g,'')
}else if(type == 1){ //指标
str = '100'
}else if(type == 5){ //函数
str = 'func'
} }
str.replace(/\[.*?\]/g,'') },
code+=str //清空多余字段并返回新的内容
}) emptyOtherText() {
console.log(code) var content = document.getElementById(this.contentId)
var isPass = false var newHTML = ''
setTimeout(()=>{ var inputs = content.getElementsByTagName('input')
if(isPass){ Array.from(inputs).forEach(item => {
newHTML += item.outerHTML
})
this.selectAllContent()
return newHTML
},
//选中整个输入框
selectAllContent() {
var content = document.getElementById(this.contentId)
var selection = window.getSelection()
var range = document.createRange()
range.selectNodeContents(content)
selection.removeAllRanges()
selection.addRange(range)
},
setHtml(html) {
var content = document.getElementById(this.contentId)
content.innerHTML = html
this.$nextTick(() => {
this.removeAllActive()
})
},
setSelfId() {
this.contentId = this.createIndexId()
},
//校验语法
checkGrammar(type) {
var content = document.getElementById(this.contentId)
var inputs = content.getElementsByTagName('input')
var code = 'var func;'
Array.from(inputs).forEach(item => {
var str = item.value
var type = item.getAttribute('type')
if (item.getAttribute('type') == 3) { //数字
str = str.replace(/\[.*?\]/g, '')
} else if (type == 1) { //指标
str = '100'
} else if (type == 5) { //函数
str = 'func'
}
str.replace(/\[.*?\]/g, '')
code += str
})
console.log(code)
var isPass = false
setTimeout(() => {
if (isPass) {
if(type == 'tip'){ if (type == 'tip') {
this.$message({
message: '语法校验通过',
type: 'success'
})
}
} else {
this.$message({ this.$message({
message: '语法校验通过', message: '语法校验通过',
type: 'success' type: 'error'
}) })
} }
}, 500)
}else{ eval(code)
this.$message({ isPass = true
message: '语法校验未通过', return isPass
type: 'error' },
}) //复制元素
copyIndex() {
this.copiedController = JSON.parse(JSON.stringify(this.selectedController))
this.$message({
message: '当前元素已复制到剪切板',
type: 'success'
})
},
//粘贴元素
pasteIndex() {
switch (this.copiedController.type) {
case 1: //指标
this.insertIndex(this.copiedController)
break;
case 2: //日期
this.insertDate(this.copiedController.value)
break;
case 3: //数字
this.insertNum(this.copiedController.value)
break;
case 4: //符号
this.insertSymbol(this.copiedController)
break;
case 5: //方法
this.pasteFunc(this.copiedController)
break;
} }
}, 500) },
eval(code) pasteFunc(copiedController) {
isPass = true var funcName = copiedController.key.replace('( )', '')
return isPass var arr = []
}, copiedController.paramsValue.forEach(item => {
//复制元素 var text = this.getShowDomText(item.showDom)
copyIndex () { arr.push(text)
this.copiedController = JSON.parse(JSON.stringify(this.selectedController)) })
this.$message({ var value = funcName + '(' + arr.join(', ') + ')'
message: '当前元素已复制到剪切板', var width = this.getInputLength(value) + 'px'
type: 'success'
})
},
//粘贴元素
pasteIndex () {
switch (this.copiedController.type) {
case 1: //指标
this.insertIndex(this.copiedController)
break;
case 2: //日期
this.insertDate(this.copiedController.value)
break;
case 3: //数字
this.insertNum(this.copiedController.value)
break;
case 4: //符号
this.insertSymbol(this.copiedController)
break;
case 5: //方法
this.pasteFunc(this.copiedController)
break;
}
},
pasteFunc (copiedController) {
var funcName = copiedController.key.replace('( )','')
var arr = []
copiedController.paramsValue.forEach(item => {
var text = this.getShowDomText(item.showDom)
arr.push(text)
})
var value = funcName + '(' + arr.join(', ') + ')'
var width = this.getInputLength(value) + 'px'
this.setRange() this.setRange()
var id = this.createIndexId() var id = this.createIndexId()
var width = this.getInputLength(value) + 'px' var width = this.getInputLength(value) + 'px'
this.$nextTick(()=>{ this.$nextTick(() => {
if(!document.execCommand('insertHTML', false, '<input readonly class="cal-index" type="5" id="'+ id +'" style="width:'+ width +'" value="'+ value +'" />')){ if (!document.execCommand('insertHTML', false, '<input readonly class="cal-index" type="5" id="' + id + '" style="width:' + width + '" value="' + value + '" />')) {
this.$message({ this.$message({
message: '请先在输入区定位光标!', message: '请先在输入区定位光标!',
type: 'warning' type: 'warning'
}) })
}else{ } else {
var newFuncObj = JSON.parse(JSON.stringify(copiedController)) var newFuncObj = JSON.parse(JSON.stringify(copiedController))
newFuncObj.id = id newFuncObj.id = id
this.functionParams[id] = newFuncObj this.functionParams[id] = newFuncObj
this.$set(this, 'selectedController', this.functionParams[id]) this.$set(this, 'selectedController', this.functionParams[id])
this.removeAllActive() this.removeAllActive()
document.getElementById(id).classList.add('active') document.getElementById(id).classList.add('active')
}
})
},
filterTreeNode (value, data) {
if (!value) return true;
return data.Name.indexOf(value) !== -1;
},
//过滤指标
filterIndexText () {
this.$refs.tree.filter(this.filterInput);
},
//搜索公司
searchCompany(query) {
var that = this
that.selectLoading = true
http.netPost('Data/Stock/GetHsData', {
'CollectionName': 'hs_stock_basic',
'WhereOr': [
{
'FieldName': 'hs_stock_basic.F001V',
'State': 2,
'Value': query
},
{
'FieldName': 'hs_stock_basic.SECCODE',
'State': 2,
'Value': query
},
{
'FieldName': 'hs_stock_basic.SECNAME',
'State': 2,
'Value': query
} }
],
'Current': 0,
'Psize': 10
})
.then((res) => {
that.companyData = res.data.Data.Records
that.searchCompanyLoading = false
})
},
inputKeydown (event) {
if(event.code !== 'Backspace'
&& event.code !== 'Space'
&& event.code !== 'ArrowUp'
&& event.code !== 'ArrowDown'
&& event.code !== 'ArrowLeft'
&& event.code !== 'ArrowRight'
){
if(event.code == 'Enter'){
document.execCommand('insertHTML', false, '<br>')
event.preventDefault();
}else{
event.preventDefault();
}
}else{
}
},
//指标点击事件
contentClick (e) {
if(e.target.classList.contains('cal-index')){
var id = e.target.id
var type = e.target.getAttribute('type')
this.setController(id, type)
this.removeAllActive()
e.target.classList.add('active')
}else{
this.removeAllActive()
this.selectedController = {}
}
},
//设置右侧面板
setController (id, type) {
var type = parseInt(type)
if(type == 1){
this.selectedController = this.indexParams[id]
}else if(type == 2){
this.selectedController = this.dateParams[id]
}else if(type == 3){
this.selectedController = this.numParams[id]
}else if(type == 4){
this.selectedController = this.symbolParams[id]
}else if(type == 5){
this.selectedController = this.functionParams[id]
}
},
//清除所有的active
removeAllActive () {
var containers = document.getElementsByClassName('calculater-display')
Array.from(containers).forEach(item => {
var indexs = item.getElementsByClassName('cal-index')
Array.from(indexs).forEach(index => {
index.classList.remove('active')
}) })
}) },
}, filterTreeNode(value, data) {
//keybord点击事件 if (!value) return true;
clickCalText (e, item) { return data.Name.indexOf(value) !== -1;
var select = window.getSelection() },
if(select.type == 'None'){ //过滤指标
this.$message({ filterIndexText() {
message: '请先定位光标!', this.$refs.tree.filter(this.filterInput);
type: 'warning' },
//搜索公司
searchCompany(query) {
var that = this
that.selectLoading = true
http.netPost('Data/Stock/GetHsData', {
'CollectionName': 'hs_stock_basic',
'WhereOr': [
{
'FieldName': 'hs_stock_basic.F001V',
'State': 2,
'Value': query
},
{
'FieldName': 'hs_stock_basic.SECCODE',
'State': 2,
'Value': query
},
{
'FieldName': 'hs_stock_basic.SECNAME',
'State': 2,
'Value': query
}
],
'Current': 0,
'Psize': 10
}) })
return false .then((res) => {
} that.companyData = res.data.Data.Records
switch (item.type) { that.searchCompanyLoading = false
case 1: //指标
this.selectedIndex = {}
this.addIndexVisible = true
break;
case 2: //日期
this.selectedDate = ''
this.addDateVisible = true
break;
case 3: //数字
this.selectedNum = 0
this.addNumVisible = true
break;
case 4: //计算符号
this.insertSymbol(item)
break;
case 5: //方法
// this.addFuncVisible = true
this.insertFunction(item)
break;
default:
break;
}
},
getNosetFuncValue (item) {
var arr = []
// if(item.isLimited){
// item.params.forEach(child => {
// arr.push('未设置')
// })
// }else{
// arr = ['未设置']
// }
item.params.forEach(child => {
arr.push('未设置')
})
return arr.join(', ')
},
//插入方法
insertFunction (item) {
console.log(item)
var funcName = item.key.replace('( )','')
var value = funcName + '(' + this.getNosetFuncValue(item) + ')'
this.setRange()
var id = this.createIndexId()
var width = this.getInputLength(value) + 'px'
this.$nextTick(()=>{
if(!document.execCommand('insertHTML', false, '<input readonly class="cal-index" type="5" id="'+ id +'" style="width:'+ width +'" value="'+ value +'" />')){
this.$message({
message: '请先在输入区定位光标!',
type: 'warning'
}) })
}else{ },
this.functionParams[id] = { inputKeydown(event) {
value: item.key, if (event.code !== 'Backspace'
key: item.key, && event.code !== 'Space'
type: 5, && event.code !== 'ArrowUp'
id: id, && event.code !== 'ArrowDown'
originParams: JSON.parse(JSON.stringify(item)), && event.code !== 'ArrowLeft'
paramsValue: [] && event.code !== 'ArrowRight'
) {
if (event.code == 'Enter') {
document.execCommand('insertHTML', false, '<br>')
event.preventDefault();
} else {
event.preventDefault();
} }
item.params.forEach((item,index) => { } else {
this.functionParams[id].paramsValue[index] = {}
}) }
// this.selectedController = this.functionParams[id] },
this.$set(this, 'selectedController', this.functionParams[id]) //指标点击事件
contentClick(e) {
if (e.target.classList.contains('cal-index')) {
var id = e.target.id
var type = e.target.getAttribute('type')
this.setController(id, type)
this.removeAllActive() this.removeAllActive()
document.getElementById(id).classList.add('active') e.target.classList.add('active')
} else {
this.removeAllActive()
this.selectedController = {}
} }
}) },
}, //设置右侧面板
//指标树点击事件 setController(id, type) {
treeNodeClick (obj) { var type = parseInt(type)
if(obj.DataType !== 'T'){ if (type == 1) {
var condition = conditionFuns.getIndexType(obj) this.selectedController = this.indexParams[id]
this.selectedIndex = { } else if (type == 2) {
type: 1, this.selectedController = this.dateParams[id]
name: obj.Name, } else if (type == 3) {
code: obj.Code, this.selectedController = this.numParams[id]
mark: obj.Mark, } else if (type == 4) {
typeContent: obj.TypeContent, this.selectedController = this.symbolParams[id]
mergeType: '合并本期', } else if (type == 5) {
yearType: 1, this.selectedController = this.functionParams[id]
quarterType: 1,
t: 0,
q: 0,
inputYear: '',
inputQuarter: '',
isAppointCompany: false,
selectedCompany: '',
needMergeType: condition.needMergeType,
needReportData: condition.needReportData,
needCompany: condition.needCompany
} }
}else{ },
return false //清除所有的active
} removeAllActive() {
}, var containers = document.getElementsByClassName('calculater-display')
//保存光标位置 Array.from(containers).forEach(item => {
saveRange () { var indexs = item.getElementsByClassName('cal-index')
var selection = window.getSelection() Array.from(indexs).forEach(index => {
var range = selection.getRangeAt(0) index.classList.remove('active')
this.range = range.cloneRange() })
},
//输出光标位置
setRange () {
var selection = window.getSelection()
selection.removeAllRanges()
if(this.range){
selection.addRange(this.range)
}else{
this.$message({
message: '请先在输入区定位光标!',
type: 'warning'
}) })
} },
}, //keybord点击事件
//插入指标事件 clickCalText(e, item) {
insertIndex (selectedIndex) { var select = window.getSelection()
this.setRange() if (select.type == 'None') {
var id = this.createIndexId()
var text = conditionFuns.getFullIndexName(selectedIndex)
var width = this.getInputLength(text) + 'px'
this.$nextTick(()=>{
if(!document.execCommand('insertHTML', false, '<input readonly class="cal-index" type="1" id="'+ id +'" style="width:'+ width +'" value="'+ text +'" />')){
this.$message({ this.$message({
message: '请先在输入区定位光标!', message: '请先定位光标!',
type: 'warning' type: 'warning'
}) })
}else{ return false
this.indexParams[id] = JSON.parse(JSON.stringify(selectedIndex))
this.indexParams[id].id = id
this.selectedController = this.indexParams[id]
this.removeAllActive()
document.getElementById(id).classList.add('active')
} }
}) switch (item.type) {
this.addIndexVisible = false case 1: //指标
}, this.selectedIndex = {}
//插入数字 this.addIndexVisible = true
insertNum (selectedNum) { break;
this.setRange() case 2: //日期
var id = this.createIndexId() this.selectedDate = ''
var text = selectedNum + "[" + this.getFormatValue(selectedNum) + "]" this.addDateVisible = true
var width = this.getInputLength(text) + 'px' break;
this.$nextTick(()=>{ case 3: //数字
if(!document.execCommand('insertHTML', false, '<input readonly class="cal-index" type="3" id="'+ id +'" style="width:'+ width +'" value="'+ text +'" />')){ this.selectedNum = 0
this.$message({ this.addNumVisible = true
message: '请先在输入区定位光标!', break;
type: 'warning' case 4: //计算符号
}) this.insertSymbol(item)
}else{ break;
this.numParams[id] = { case 5: //方法
type: 3, // this.addFuncVisible = true
value: selectedNum, this.insertFunction(item)
id: id break;
default:
break;
}
},
getNosetFuncValue(item) {
var arr = []
// if(item.isLimited){
// item.params.forEach(child => {
// arr.push('未设置')
// })
// }else{
// arr = ['未设置']
// }
item.params.forEach(child => {
arr.push('未设置')
})
return arr.join(', ')
},
//插入方法
insertFunction(item) {
console.log(item)
var funcName = item.key.replace('( )', '')
var value = funcName + '(' + this.getNosetFuncValue(item) + ')'
this.setRange()
var id = this.createIndexId()
var width = this.getInputLength(value) + 'px'
this.$nextTick(() => {
if (!document.execCommand('insertHTML', false, '<input readonly class="cal-index" type="5" id="' + id + '" style="width:' + width + '" value="' + value + '" />')) {
this.$message({
message: '请先在输入区定位光标!',
type: 'warning'
})
} else {
this.functionParams[id] = {
value: item.key,
key: item.key,
type: 5,
id: id,
originParams: JSON.parse(JSON.stringify(item)),
paramsValue: []
}
item.params.forEach((item, index) => {
this.functionParams[id].paramsValue[index] = {}
})
// this.selectedController = this.functionParams[id]
this.$set(this, 'selectedController', this.functionParams[id])
this.removeAllActive()
document.getElementById(id).classList.add('active')
} }
this.selectedController = this.numParams[id] })
this.removeAllActive() },
document.getElementById(id).classList.add('active') //指标树点击事件
treeNodeClick(obj) {
if (obj.DataType !== 'T') {
var condition = tools.getIndexType(obj)
this.selectedIndex = {
type: 1,
name: obj.Name,
code: obj.Code,
mark: obj.Mark,
typeContent: obj.TypeContent,
mergeType: '合并本期',
yearType: 1,
quarterType: 1,
t: 0,
q: 0,
inputYear: '',
inputQuarter: '',
isAppointCompany: false,
selectedCompany: '',
needMergeType: condition.needMergeType,
needReportData: condition.needReportData,
needCompany: condition.needCompany
}
} else {
return false
} }
}) },
this.addNumVisible = false //保存光标位置
}, saveRange() {
//插入日期 var selection = window.getSelection()
insertDate (selectedDate) { var range = selection.getRangeAt(0)
this.setRange() this.range = range.cloneRange()
var id = this.createIndexId() },
var text = selectedDate //输出光标位置
var width = this.getInputLength(text) + 'px' setRange() {
this.$nextTick(()=>{ var selection = window.getSelection()
if(!document.execCommand('insertHTML', false, '<input readonly class="cal-index" type="2" id="'+ id +'" style="width:'+ width +'" value="'+ text +'" />')){ selection.removeAllRanges()
if (this.range) {
selection.addRange(this.range)
} else {
this.$message({ this.$message({
message: '请先在输入区定位光标!', message: '请先在输入区定位光标!',
type: 'warning' type: 'warning'
}) })
}else{ }
this.dateParams[id] = { },
type: 2, //插入指标事件
value: selectedDate, insertIndex(selectedIndex) {
id: id this.setRange()
var id = this.createIndexId()
var text = tools.getFullIndexName(selectedIndex)
var width = this.getInputLength(text) + 'px'
this.$nextTick(() => {
if (!document.execCommand('insertHTML', false, '<input readonly class="cal-index" type="1" id="' + id + '" style="width:' + width + '" value="' + text + '" />')) {
this.$message({
message: '请先在输入区定位光标!',
type: 'warning'
})
} else {
this.indexParams[id] = JSON.parse(JSON.stringify(selectedIndex))
this.indexParams[id].id = id
this.selectedController = this.indexParams[id]
this.removeAllActive()
document.getElementById(id).classList.add('active')
} }
this.selectedController = this.dateParams[id] })
this.removeAllActive() this.addIndexVisible = false
document.getElementById(id).classList.add('active') },
//插入数字
insertNum(selectedNum) {
this.setRange()
var id = this.createIndexId()
var text = selectedNum + "[" + this.getFormatValue(selectedNum) + "]"
var width = this.getInputLength(text) + 'px'
this.$nextTick(() => {
if (!document.execCommand('insertHTML', false, '<input readonly class="cal-index" type="3" id="' + id + '" style="width:' + width + '" value="' + text + '" />')) {
this.$message({
message: '请先在输入区定位光标!',
type: 'warning'
})
} else {
this.numParams[id] = {
type: 3,
value: selectedNum,
id: id
}
this.selectedController = this.numParams[id]
this.removeAllActive()
document.getElementById(id).classList.add('active')
}
})
this.addNumVisible = false
},
//插入日期
insertDate(selectedDate) {
this.setRange()
var id = this.createIndexId()
var text = selectedDate
var width = this.getInputLength(text) + 'px'
this.$nextTick(() => {
if (!document.execCommand('insertHTML', false, '<input readonly class="cal-index" type="2" id="' + id + '" style="width:' + width + '" value="' + text + '" />')) {
this.$message({
message: '请先在输入区定位光标!',
type: 'warning'
})
} else {
this.dateParams[id] = {
type: 2,
value: selectedDate,
id: id
}
this.selectedController = this.dateParams[id]
this.removeAllActive()
document.getElementById(id).classList.add('active')
}
})
this.addDateVisible = false
},
//插入计算符号
insertSymbol(item) {
this.setRange()
var id = this.createIndexId()
var width = this.getInputLength(item.key) + 'px'
this.$nextTick(() => {
//加入额外的样式
var moreClass = ''
switch (item.key) {
case '(': case ')':
moreClass = 'brackets'
break;
default:
break;
}
if (!document.execCommand('insertHTML', false, '<input readonly class="cal-index ' + moreClass + '" type="4" id="' + id + '" style="width:' + width + '" value="' + item.key + '" />')) {
this.$message({
message: '请先在输入区定位光标!',
type: 'warning'
})
} else {
this.symbolParams[id] = {
value: item.key,
key: item.key,
type: 4,
id: id
}
this.selectedController = this.symbolParams[id]
this.removeAllActive()
document.getElementById(id).classList.add('active')
}
})
},
//数字格式化
getFormatValue(value) {
var unit = '', num = 1
if (value < 10000) {
unit = '', num = 1
} else if (10000 <= value && value < 100000000) {
unit = '', num = 10000
} else if (100000000 <= value && value < 1000000000000) {
unit = '亿', num = 100000000
} else if (value >= 1000000000000) {
unit = '万亿', num = 1000000000000
} }
}) return (value / num).toFixed(0) + unit
this.addDateVisible = false },
}, // getFullIndexName (index) {
//插入计算符号 // var indexName = index.name, merge = '', company = '', year = '', quarter = ''
insertSymbol (item) { // if(index.needMergeType){
this.setRange() // merge = '[' + index.mergeType + ']'
var id = this.createIndexId() // }
var width = this.getInputLength(item.key) + 'px' // if(index.needReportData){
this.$nextTick(()=>{ // if(index.yearType == 1){
//加入额外的样式 // year = '[T:' + index.t + ']'
var moreClass = '' // }else{
switch (item.key) { // year = '[T:' + index.inputYear + ']'
case '(': case ')': // }
moreClass = 'brackets' // if(index.quarterType == 1){
// quarter = '[Q:' + index.q + ']'
// }else{
// quarter = '[Q:' + index.inputQuarter + ']'
// }
// }
// if(index.needCompany && index.isAppointCompany){
// company = '[' + index.selectedCompany + ']'
// }
// return indexName + year + quarter + merge + company
// },
setAppointedIndexName(index) {
var id = index.id
var type = index.type
var indexDom = document.getElementById(id)
switch (type) {
case 1: //1是指标
indexDom.setAttribute('value', tools.getFullIndexName(index))
var value = indexDom.getAttribute('value')
indexDom.style.width = this.getInputLength(value) + 'px'
break;
case 2: //2是日期
indexDom.setAttribute('value', index.value)
indexDom.style.width = this.getInputLength(indexDom.value) + 'px'
break;
case 3: //3是数字
indexDom.setAttribute('value', index.value + "[" + this.getFormatValue(index.value) + "]")
indexDom.style.width = this.getInputLength(indexDom.value) + 'px'
break;
case 4: //4是符号
indexDom.setAttribute('value', index.value)
indexDom.style.width = this.getInputLength(indexDom.value) + 'px'
break; break;
default: default:
break; break;
} }
if(!document.execCommand('insertHTML', false, '<input readonly class="cal-index ' + moreClass + '" type="4" id="'+ id +'" style="width:'+ width +'" value="'+ item.key +'" />')){ },
this.$message({ // getIndexType (obj) {
message: '请先在输入区定位光标!', // var newObj = {
type: 'warning' // needMergeType: false,
}) // needReportData: false,
}else{ // needCompany: false
this.symbolParams[id] = { // }
value: item.key, // if(obj.TypeContent){
key: item.key, // obj.TypeContent.Parameters.forEach(item => {
type: 4, // if(item.Encode == 'F91997V'){
id: id // newObj.needMergeType = true
// }
// if(item.Encode == 'F91996D'){
// newObj.needReportData = true
// }
// if(item.Encode == 'F90001V'){
// newObj.needCompany = true
// }
// })
// }
// return newObj
// },
//判断制表格式
conditionContain(array, code) {
var has = false
array.forEach(item => {
if (item.Encode == code) {
has = true
} }
this.selectedController = this.symbolParams[id] })
this.removeAllActive() return has
document.getElementById(id).classList.add('active') },
} //创建一个id
}) createIndexId() {
}, this.initIndexId++
//数字格式化 var id = new Date().getTime() + this.initIndexId
getFormatValue (value) { return id
var unit = '', num = 1 },
if(value < 10000){ //获取input的长度
unit = '', num = 1 getInputLength(text) {
}else if(10000 <= value && value < 100000000){ var width = 0, span
unit = '', num = 10000 if (!document.getElementById('invented')) {
}else if(100000000 <= value && value < 1000000000000){ span = document.createElement('span')
unit = '亿', num = 100000000 span.id = 'invented'
}else if(value >= 1000000000000){ span.innerHTML = text
unit = '万亿', num = 1000000000000 document.body.appendChild(span)
} } else {
return (value/num).toFixed(0) + unit span = document.getElementById('invented')
}, span.innerHTML = text
// getFullIndexName (index) {
// var indexName = index.name, merge = '', company = '', year = '', quarter = ''
// if(index.needMergeType){
// merge = '[' + index.mergeType + ']'
// }
// if(index.needReportData){
// if(index.yearType == 1){
// year = '[T:' + index.t + ']'
// }else{
// year = '[T:' + index.inputYear + ']'
// }
// if(index.quarterType == 1){
// quarter = '[Q:' + index.q + ']'
// }else{
// quarter = '[Q:' + index.inputQuarter + ']'
// }
// }
// if(index.needCompany && index.isAppointCompany){
// company = '[' + index.selectedCompany + ']'
// }
// return indexName + year + quarter + merge + company
// },
setAppointedIndexName (index) {
var id = index.id
var type = index.type
var indexDom = document.getElementById(id)
switch (type) {
case 1: //1是指标
indexDom.setAttribute('value',conditionFuns.getFullIndexName(index))
var value = indexDom.getAttribute('value')
indexDom.style.width = this.getInputLength(value) + 'px'
break;
case 2: //2是日期
indexDom.setAttribute('value',index.value)
indexDom.style.width = this.getInputLength(indexDom.value) + 'px'
break;
case 3: //3是数字
indexDom.setAttribute('value', index.value + "[" + this.getFormatValue(index.value) + "]")
indexDom.style.width = this.getInputLength(indexDom.value) + 'px'
break;
case 4: //4是符号
indexDom.setAttribute('value',index.value)
indexDom.style.width = this.getInputLength(indexDom.value) + 'px'
break;
default:
break;
}
},
// getIndexType (obj) {
// var newObj = {
// needMergeType: false,
// needReportData: false,
// needCompany: false
// }
// if(obj.TypeContent){
// obj.TypeContent.Parameters.forEach(item => {
// if(item.Encode == 'F91997V'){
// newObj.needMergeType = true
// }
// if(item.Encode == 'F91996D'){
// newObj.needReportData = true
// }
// if(item.Encode == 'F90001V'){
// newObj.needCompany = true
// }
// })
// }
// return newObj
// },
//判断制表格式
conditionContain (array, code) {
var has = false
array.forEach(item => {
if(item.Encode == code){
has = true
}
})
return has
},
//创建一个id
createIndexId () {
this.initIndexId++
var id = new Date().getTime() + this.initIndexId
return id
},
//获取input的长度
getInputLength (text) {
var width = 0, span
if(!document.getElementById('invented')){
span = document.createElement('span')
span.id = 'invented'
span.innerHTML = text
document.body.appendChild(span)
}else{
span = document.getElementById('invented')
span.innerHTML = text
}
width = span.offsetWidth
return width + 4
},
//初始化撤销反撤销
initKeybord () {
document.onkeydown = function (e) {
var ctrlKey = e.ctrlKey || e.metaKey;
if (e.shiftKey && ctrlKey && e.keyCode == 90) {
document.execCommand('redo', false, null)
} }
if (ctrlKey && e.keyCode == 90 && !e.shiftKey) { width = span.offsetWidth
document.execCommand('undo', false, null) return width + 4
},
//初始化撤销反撤销
initKeybord() {
document.onkeydown = function (e) {
var ctrlKey = e.ctrlKey || e.metaKey;
if (e.shiftKey && ctrlKey && e.keyCode == 90) {
document.execCommand('redo', false, null)
}
if (ctrlKey && e.keyCode == 90 && !e.shiftKey) {
document.execCommand('undo', false, null)
}
} }
} }
} }
......
var init = require('../../lib/init.js') // var init = require('../../lib/init.js')
var value = init(__filename, __dirname) // var value = init(__filename, __dirname)
//以上代码引入vue、css等,初始化 //以上代码引入vue、css等,初始化
async function getCondition() {
module.exports = { var value = await loadComponent('publicIndex', window.global.urls.loadUrl + '/src/views/main_views/indexManage/components/condition/index.vue')
name: value.name, return {
data: function () { name: value.name,
return { data: function () {
testYear: '', return {
testQuarter: '', testYear: '',
testMergeType: '', testQuarter: '',
requiredCondition: [] testMergeType: '',
} requiredCondition: []
}, }
props:['params','allParams'], },
template: value.template, props:['params','allParams'],
computed: { template: value.template,
computed: {
},
mounted() { },
this.getRequiredCondition() mounted() {
}, this.getRequiredCondition()
methods: {
getRequiredCondition () { //1证券代码 2合并类型 4报告期
var arr = []
this.allParams.forEach(item => {
if (this.params & item.Id) {
arr.push(item)
}
})
this.requiredCondition = arr
}, },
isContains (id) { methods: {
console.log('执行') getRequiredCondition () { //1证券代码 2合并类型 4报告期
var isRequired = false var arr = []
this.requiredCondition.forEach(item => { this.allParams.forEach(item => {
if(item.Id == id){ if (this.params & item.Id) {
isRequired = true arr.push(item)
} }
}) })
return isRequired this.requiredCondition = arr
},
isContains (id) {
console.log('执行')
var isRequired = false
this.requiredCondition.forEach(item => {
if(item.Id == id){
isRequired = true
}
})
return isRequired
}
} }
} }
} }
\ No newline at end of file
...@@ -2012,4 +2012,269 @@ ...@@ -2012,4 +2012,269 @@
cursor: pointer; cursor: pointer;
box-sizing: border-box; box-sizing: border-box;
} }
.calculater-display{
border-bottom: 1px solid #eaeaea;
height: 320px;
box-sizing: border-box;
padding: 10px;
max-width: 600px;
overflow: scroll;
overflow-x: hidden;
}
.calculater-keybord{
font-size: 0px;
border-bottom: 1px solid #eaeaea;
border-top: 0;
/* border-bottom: 0; */
box-sizing: border-box;
max-width: 600px;
height: 40px;
}
.calculater-keybord .single-bord:last-child{
border-right: 1px solid #eaeaea;
}
.calculater-keybord .single-bord{
width: 40px;
height: 40px;
text-align: center;
line-height: 40px;
font-size: 20px;
color: #333;
box-sizing: border-box;
cursor: pointer;
user-select: none;
float: left;
border-right: 1px solid #eaeaea;
}
.calculater-keybord .single-bord.long{
width: 80px;
}
.calculater-keybord .single-bord.active{
color: #d0021b;
background: #FFE7E7;
}
.calculater-keybord .single-bord.active:active{
color: #fff;
background: #d0021b;
}
.calculater-keybord .single-bord:active{
background: #FFE7E7;
}
.calculater-keybord .single-bord:hover{
color: #d0021b;
}
.calculater-keybord .single-bord+.single-bord{
/* border-left: 1px solid #eaeaea; */
}
.calculater-keybord .single-bord.text{
font-size: 12px;
}
.calculater-operation{
margin-top: 12px;
}
/* .calculater-tip{
font-size: 12px;
} */
.calculater-operation span{
display: inline-block;
padding: 4px 8px;
border: 1px solid #eaeaea;
border-radius: 4px;
cursor: pointer;
}
.calculater-operation span:active{
color: #d0021b;
background: #FFE7E7;
}
.calculater-operation span:hover{
background: #FFE7E7;
}
.cal-index-detail{
border: 1px solid #eaeaea;
font-size: 12px;
padding: 10px;
box-sizing: border-box;
margin-left: 10px;
height: 400px;
overflow: overlay;
min-width: 240px;
max-width: 240px;
}
#invented{
position: fixed;
opacity: 0;
left: 0;
top: 0;
z-index: -1;
font-size: 12px;
}
.flex{
display: flex;
}
.calculater-display input{
outline: 0;
border: 0;
cursor: pointer;
font-size: 12px;
margin-bottom: 4px;
}
.calculater-display input:focus{
outline: 0;
}
.calculater-display .cal-index.brackets{
background: #d0daff;
}
.cal-index{
background: #FFE7E7;
margin: 0 2px;
}
.cal-index.active{
color: #d0021b;
}
.calculater-display:focus{
outline: 0;
}
.index-choose-dialog .single-column {
display: flex;
align-items: center;
padding: 8px 0;
}
.mini.el-input--mini .el-input__inner{
height: 20px;
line-height: 20px;
/* border-radius: 4px; */
padding: 0 4px;
}
.mini.el-input--mini .el-input-group__append{
min-width: 10px;
text-align: center;
padding: 0 4px;
}
.mini.el-select .el-input--mini .el-input__inner{
height: 20px;
line-height: 20px;
padding-left: 4px;
padding-right: 4px;
}
.mini.el-select .el-input .el-select__caret{
line-height: 20px;
}
.controller-item+.controller-item{
margin-top: 8px;
}
.mini .el-switch__core{
height: 14px;
}
.mini .el-switch__core:after{
height: 10px;
width: 10px;
}
.mini.el-switch.is-checked .el-switch__core::after{
width: 10px;
height: 10px;
}
.mini.el-switch.is-checked .el-switch__core::after{
margin-left: -11px;
}
.mini .el-input__inner{
height: 20px;
line-height: 20px;
font-size: 12px;
}
.mini .el-input__icon{
line-height: 20px;
}
.mini.el-input--suffix .el-input__inner{
padding-right: 0;
}
.mini .el-input__icon{
width: 20px;
}
.mini .el-input__inner{
font-size: 12px;
line-height: 20px;
height: 20px;
}
.mini.el-select .el-input__inner{
padding-left: 4px;
}
.absolute-operation{
position: absolute;
right: 4px;
top: 8px;
font-size: 14px;
cursor: pointer;
}
.absolute-operation:hover{
color: #D0021B;
}
.index-controller .column {
margin-bottom: 12px;
}
.index-controller .column .column-title {
color: #999;
margin-bottom: 6px;
}
.function-params-item {
background: rgb(245, 247, 250);
padding: 8px;
border-radius: 4px;
position: relative;
}
.function-params-item .item-title {
margin-bottom: 4px;
}
.func-show-dom {
padding-bottom: 4px;
}
.function-params-item+.function-params-item {
margin-top: 8px;
}
.index-choose-dialog-inner {
display: flex;
}
.index-choose-dialog .index-detail {
padding-left: 20px;
border-left: 1px solid #EBEEF5;
flex: auto;
}
.index-detail {
flex: auto;
padding-left: 20px;
display: flex;
flex-direction: column;
/* overflow: scroll; */
position: relative;
}
.index-choose-dialog .index-list {
padding-right: 20px;
}
.index-list {
border: 1px solid #f0f0f0;
background: #F9F9F9;
border-radius: 2px;
padding: 4px;
}
.index-choose-dialog .el-dialog__body{
font-size: 12px;
}
.cal-container{
border: 1px solid #eaeaea;
}
.index-list-tree{
overflow: scroll;
overflow-x: hidden;
}
.mini .el-radio__inner {
width: 10px;
height: 10px;
}
.mini .el-radio__label {
font-size: 12px;
font-weight: normal;
padding-left: 6px;
}
.mini .el-radio{
margin-right: 16px;
}
\ No newline at end of file
...@@ -14,41 +14,78 @@ ...@@ -14,41 +14,78 @@
<router-view></router-view> <router-view></router-view>
</div> </div>
</body> </body>
<script>
const { app } = require('electron').remote
const { ipcRenderer } = require('electron')
window.global.urls = require(app.getAppPath() + '/build_config/url')
</script>
<script src="../../../static/vue/vue.min.js"></script> <script src="../../../static/vue/vue.min.js"></script>
<script src="../../../static/element/index.js"></script> <script src="../../../static/element/index.js"></script>
<script src="../../../static/vue-router/vue-router.js"></script> <script src="../../../static/vue-router/vue-router.js"></script>
<script src='../../../static/xlsx/xlsx.full.min.js'></script> <script src='../../../static/xlsx/xlsx.full.min.js'></script>
<script src="../../../static/plTable/index.js"></script> <script src="../../../static/plTable/index.js"></script>
<!-- <script src="../../lib/vue/vue.js"></script>
<script src="../../lib/element/index.js"></script> <script src="../../../assist/loadVue.js"></script>
<script type="text/javascript" src='../../lib/xlsx/xlsx.full.min.js'></script> <script src="./routers/publicIndex/publicIndex.js"></script>
<script src="../../lib/vue-router/vue-router.js"></script> <script src="./routers/myIndex/myIndex.js"></script>
<script src="../../lib/plTable/index.js"></script> <script src="./routers/indexAudit/indexAudit.js"></script>
<script src="../../lib/echarts/echarts.min.js"></script> --> <script src="./routers/categoryAudit/categoryAudit.js"></script>
<script> <script src="./routers/indexRecord/indexRecord.js"></script>
const { app } = require('electron').remote <script src="./components/condition/index.js"></script>
const path = app.getAppPath() <script src="./components/calculater/calculater.js"></script>
const { routes } = require(path + '/src/views/main_views/indexManage/routers/router.js') <script src="../../../assist/axios.js"></script>
const router = new VueRouter({ routes }) <script src="./indexManage.js"></script>
const http = require(path + '/src/assist/axios.js')
var info = JSON.parse(localStorage.getItem('userInfo')) <script>
const { splitPane } = require('vue-splitpane') var http = newHttp()
Vue.component('split-pane', splitPane)
const mytools = new tools()
console.log(mytools)
var info = JSON.parse(localStorage.getItem('userInfo'))
const { splitPane } = require('vue-splitpane')
Vue.component('split-pane', splitPane)
async function init() {
var myIndex = await getMyIndex()
var indexAudit = await getIndexAudit()
var publicIndex = await getPublicIndex()
var categoryAudit = await getCategoryAudit()
var indexRecord = await getIndexRecord()
// var component = await getMain()
// var component = await getMain()
// var component = await getMain()
var routes = [
{ path: '/', component: myIndex },
{ path: '/indexAudit', component: indexAudit },
{ path: '/publicIndex', component: publicIndex },
{ path: '/categoryAudit', component: categoryAudit },
{ path: '/indexRecord', component: indexRecord }
]
console.log(routes)
var router = new VueRouter({ routes })
new Vue({ new Vue({
router, router,
el: '#app', el: '#app',
data: function() { data: function () {
return { return {
hasPadding: true
} }
}, },
mounted () { mounted() {
}, },
methods: { methods: {
} }
}) })
}
init()
</script> </script>
</html> </html>
\ No newline at end of file
class tools {
constructor() { }
getKeyboardObj(keyBord, keyboardObj) {
var arr = keyBord.keybordData
arr.forEach(item => {
item.forEach(sub => {
if (sub.type == 5) {
keyboardObj[sub.funcId] = sub
}
})
})
}
getIndexs(initIndexObj) {
return new Promise((resolve, reject) => {
http.netPost('Data/Encode/GetEncodeList', {
"Current": 0,
"Psize": 100,
"Code": "B",
'Name': '',
"AccountId": info.accountId
})
.then((res) => {
if (res.data.Status == 1) {
this.creatIndexObj(res.data.Data.Records, initIndexObj)
resolve()
}
})
})
}
egetKeyboardObj(keyBord, keyboardObj) {
var arr = keyBord.keybordData
arr.forEach(item => {
item.forEach(sub => {
if (sub.type == 5) {
keyboardObj[sub.funcId] = sub
}
})
})
}
getIndexs(initIndexObj) {
return new Promise((resolve, reject) => {
http.netPost('Data/Encode/GetEncodeList', {
"Current": 0,
"Psize": 100,
"Code": "B",
'Name': '',
"AccountId": info.accountId
})
.then((res) => {
if (res.data.Status == 1) {
this.creatIndexObj(res.data.Data.Records, initIndexObj)
resolve()
}
})
})
}
creatIndexObj(initData, initIndexObj) {
initData.forEach(element => {
if (element.Sub.length > 0) {
this.creatIndexObj(element.Sub, initIndexObj)
} else {
initIndexObj[element.Code] = element
var tableName = element.Origin ? element.Origin.TableComment : null
var dbName = element.Origin ? element.Origin.DbComment : null
initIndexObj[element.Code].originText = tableName + '-' + dbName
}
})
}
getUsedCompany(params, companyNameObj) {
var codes = []
params.forEach(item => {
if (item.OperandType == 0 && item.Where[2]) {
codes.push(item.Where[2].Value)
} else if (item.OperandType == 4) {
item.Args.forEach(sub => {
sub.forEach(child => {
if (child.OperandType == 0 && child.Where[2]) {
codes.push(child.Where[2].Value)
}
})
})
}
})
var where = [{
"Encode": "F90001V",
"State": 7,
"Value": codes.join(','),
}]
return new Promise((resolve, reject) => {
http.netPost('Data/Query/Query', {
"List": ['F90001V', 'F90002V'],
"Where": where,
"Current": 0,
"Psize": 100
})
.then((res) => {
if (res.data.Status == 1) {
res.data.Data.Records.forEach(item => {
companyNameObj[item.F90001V] = item.F90002V
})
resolve()
} else if (res.data.Status == 0) {
resolve()
} else {
reject()
}
})
})
}
getSaveCondition(activeIndexCondition, condition, initIndex, initIndexObj, companyNameObj, keyboardObj) {
condition.forEach(item => {
initIndex++
var id = new Date().getTime() + initIndex
var obj = {}
var inputDom = ''
var showDom = ''
var paramsType = ''
switch (item.OperandType) {
case 0: //指标
var index = initIndexObj[item.List[0]]
var condition = this.getIndexType(index)
var evalObj = this.getEval(item.Where[0])
obj = {
code: item.List[0],
id: id,
inputQuarter: evalObj.selsetQuarter,
inputYear: evalObj.selectYear,
q: evalObj.qQuarter,
t: evalObj.tYear,
quarterType: evalObj.reportQuarterType,
yearType: evalObj.reportYearType,
mergeType: item.Where[1].Value,
type: 1,
isAppointCompany: item.Where[2] ? true : false,
selectedCompany: item.Where[2] ? (companyNameObj[item.Where[2].Value] + '-' + item.Where[2].Value) : '',
mark: index.Mark,
name: index.Name,
needMergeType: condition.needMergeType,
needReportData: condition.needReportData,
needCompany: condition.needCompany,
typeContent: index.TypeContent || []
}
var text = this.getFullIndexName(obj)
var width = this.getInputLength(text) + 'px'
inputDom = '<input readonly class="cal-index" type="1" id="' + id + '" style="width:' + width + '" value="' + text + '" />'
showDom = '<span type="1">' + text + '</span>'
paramsType = 'indexParams'
break;
case 1: //符号
obj = {
id: id,
key: item.Value,
type: 4,
value: item.Value
}
var width = this.getInputLength(item.Value) + 'px'
var moreClass = ''
switch (item.Value) {
case '(': case ')':
moreClass = 'brackets'
break;
default:
break;
}
inputDom = '<input readonly class="cal-index ' + moreClass + '" type="4" id="' + id + '" style="width:' + width + '" value="' + item.Value + '" />'
showDom = '<span type="4">' + item.Value + '</span>'
paramsType = 'symbolParams'
break;
case 2: //数字
obj = {
id: id,
type: 3,
value: item.Value
}
var text = item.Value + "[" + this.getFormatValue(item.Value) + "]"
var width = this.getInputLength(text) + 'px'
inputDom = '<input readonly class="cal-index" type="3" id="' + id + '" style="width:' + width + '" value="' + text + '" />'
showDom = '<span type="3">' + text + '</span>'
paramsType = 'numParams'
break;
case 3: //时间
obj = {
id: id,
type: 2,
value: item.Value
}
var text = item.Value
var width = this.getInputLength(text) + 'px'
inputDom = '<input readonly class="cal-index" type="2" id="' + id + '" style="width:' + width + '" value="' + text + '" />'
showDom = '<span type="2">' + text + '</span>'
paramsType = 'dateParams'
break;
case 4:
var origin = keyboardObj[item.Action]
obj = {
value: origin.key,
key: origin.key,
type: 5,
id: id,
originParams: JSON.parse(JSON.stringify(origin)),
paramsValue: []
}
item.Args.forEach((sub, index) => {
if (index > origin.length) {
obj.originParams.params.push(JSON.parse(JSON.stringify(obj.originParams.params[0])))
}
obj.paramsValue[index] = {
indexParams: {},
dateParams: {},
numParams: {},
symbolParams: {},
functionParams: {},
dom: '',
showDom: ''
}
initIndex++
this.getSaveCondition(obj.paramsValue[index], item.Args[index], initIndex, initIndexObj, companyNameObj, keyboardObj)
})
// origin.params.forEach((item,index) => {
// this.getFuncCondition(obj.paramsValue[index], item.Args[index])
// })
var arr = []
obj.paramsValue.forEach(item => {
var text = this.getShowDomText(item.showDom)
arr.push(text)
})
var name = obj.key.replace('( )', '')
var value = name + '(' + arr.join(', ') + ')'
var text = value
var width = this.getInputLength(text) + 'px'
inputDom = '<input readonly class="cal-index" type="5" id="' + id + '" style="width:' + width + '" value="' + text + '" />'
showDom = '<span type="5">' + text + '</span>'
paramsType = 'functionParams'
break;
default:
break;
}
activeIndexCondition[paramsType][id] = obj
activeIndexCondition.dom += inputDom
activeIndexCondition.showDom += showDom
})
if (!activeIndexCondition.showDom) {
activeIndexCondition.showDom = '<span>暂未设置计算公式</span>'
}
}
getIndexType(obj) {
var newObj = {
needMergeType: false,
needReportData: false,
needCompany: false
}
if (obj.TypeContent) {
obj.TypeContent.Parameters.forEach(item => {
if (item.Encode == 'F91997V') {
newObj.needMergeType = true
}
if (item.Encode == 'F91996D') {
newObj.needReportData = true
}
if (item.Encode == 'F90001V') {
newObj.needCompany = true
}
})
}
return newObj
}
getEval(item) {
var newObj = {
reportYearType: 1,
tYear: 0,
selectYear: '',
reportQuarterType: 1,
qQuarter: 0,
selsetQuarter: ''
}
switch (item.Eval.length) {
case 0:
newObj.reportYearType = 2
newObj.selectYear = item.Value.slice(0, 4)
newObj.reportQuarterType = 2
newObj.qQuarter = 0
newObj.tYear = 0
newObj.selsetQuarter = item.Value.slice(5, 10)
break;
case 1:
if (item.Eval[0].EvalOption == 1) { //年度为t
newObj.reportYearType = 1
newObj.tYear = item.Eval[0].Value
newObj.selectYear = item.Value.slice(0, 4)
newObj.reportQuarterType = 2
newObj.qQuarter = 0
newObj.selsetQuarter = item.Value.slice(5, 10)
} else if (item.Eval[0].EvalOption == 2) {
newObj.reportYearType = 2
newObj.tYear = 0
newObj.selectYear = item.Value.slice(0, 4)
newObj.reportQuarterType = 1
newObj.qQuarter = item.Eval[0].Value
newObj.selsetQuarter = item.Value.slice(5, 10)
}
break;
case 2:
newObj.reportYearType = 1
newObj.selectYear = ''
newObj.reportQuarterType = 1
newObj.selsetQuarter = ''
newObj.qQuarter = item.Eval[1].Value
newObj.tYear = item.Eval[0].Value
break;
default:
break;
}
return newObj
}
getFullIndexName(index) {
var indexName = index.name, merge = '', company = '', year = '', quarter = ''
if (index.needMergeType) {
merge = '[' + index.mergeType + ']'
}
if (index.needReportData) {
if (index.yearType == 1) {
year = '[T:' + index.t + ']'
} else {
year = '[T:' + index.inputYear + ']'
}
if (index.quarterType == 1) {
quarter = '[Q:' + index.q + ']'
} else {
quarter = '[Q:' + index.inputQuarter + ']'
}
}
if (index.needCompany && index.isAppointCompany) {
company = '[' + index.selectedCompany + ']'
}
return indexName + year + quarter + merge + company
}
getInputLength(text) {
var width = 0, span
if (!document.getElementById('invented')) {
span = document.createElement('span')
span.id = 'invented'
span.innerHTML = text
document.body.appendChild(span)
} else {
span = document.getElementById('invented')
span.innerHTML = text
}
width = span.offsetWidth
return width + 4
}
getShowDomText(html) {
var div = document.createElement('div')
if (html) {
div.innerHTML = html
return div.innerText
} else {
return '未设置'
}
}
insertAfter(newElement, targetElement) {
var parent = targetElement.parentNode
if (parent.lastChild == targetElement) {
parent.appendChild(targetElement)
} else {
parent.insertBefore(newElement, targetElement.nextSibling);
}
}
createAppointedText(num) {
var str = '', text
for (var i = 0; i < num; i++) {
str += '\u00A0'
}
text = document.createTextNode(str)
return text
}
formatShowDom(spans) {
var brackets = []
var numArea = []
Array.from(spans).forEach(item => {
var value = item.innerText
var br = document.createElement('br')
if ('()&&||+-*/'.indexOf(value) >= 0 || (item.nextSibling && '()&&||+-*/'.indexOf(item.nextSibling.innerText) >= 0)) {
this.insertAfter(br, item)
}
})
Array.from(spans).forEach((item, index) => {
var value = item.innerText
if (value == '(' || value == ')') {
brackets.push({
indet: 0,
from: item,
value: value,
originIndex: index
})
}
})
brackets.forEach((item, index) => {
if (index == 0) {
item.indent = 0
var text = this.createAppointedText(item.indent)
item.from.parentNode.insertBefore(text, item.from)
} else {
var newIndent = brackets[index - 1].indent
if (brackets[index - 1].value !== item.value) {
item.indent = newIndent
var text = this.createAppointedText(newIndent)
item.from.parentNode.insertBefore(text, item.from)
} else {
if (item.value == '(') {
item.indent = newIndent + 4
} else {
item.indent = newIndent - 4
}
var text = this.createAppointedText(item.indent)
item.from.parentNode.insertBefore(text, item.from)
}
numArea.push({
start: brackets[index - 1].originIndex,
end: item.originIndex,
indent: brackets[index - 1].indent,
value: brackets[index - 1].value
})
}
})
Array.from(spans).forEach((item, index) => {
var value = item.innerText
if (value !== '(' && value !== ')' && item.previousSibling && item.previousSibling.nodeName == 'BR') {
numArea.forEach(area => {
if (index > area.start && index < area.end) {
var newIndent
if (area.value == '(') {
newIndent = area.indent + 4
} else {
newIndent = area.indent
}
var text = this.createAppointedText(newIndent)
item.parentNode.insertBefore(text, item)
}
})
}
})
}
getKeyboard() {
var keybordData = [
[
{
key: '插入指标',
isActive: false,
isText: true,
isLong: true,
isFunction: false,
tip: '插入指标',
type: 1,
},
{
key: '插入日期',
isActive: false,
isText: true,
isLong: true,
isFunction: false,
tip: '插入日期',
type: 2
},
{
key: '插入数字',
isActive: false,
isText: true,
isLong: true,
isFunction: false,
tip: '插入数字',
type: 3
},
{
key: 'Kdp( )',
isActive: false,
isText: true,
isLong: false,
isFunction: true,
tip: '保留小数位函数',
type: 5,
funcId: 0,
describe: '保留小数位',
case: 'Kdp(归属于母公司所有者的净利润[T:0][Q:0][合并本期], 2)',
params: [[0, 4], [1]], //0指标 1数字 2字符 3时间 4公式
isLimited: true
},
{
key: 'Abs( )',
isActive: false,
isText: true,
isLong: false,
isFunction: true,
tip: '绝对值函数',
type: 5,
funcId: 1,
describe: '求指标或计算片段的绝对值',
case: 'Abs(归属于母公司所有者的净利润[T:0][Q:0][合并本期])',
params: [[0, 4]], //0指标 1数字 2字符 3时间 4公式
isLimited: true
},
// {
// key: 'Tf( )',
// isActive: false,
// isText: true,
// isLong: false,
// isFunction: true,
// tip: '时间格式化函数',
// type: 5,
// funcId: 2,
// describe: '对时间进行格式化操作',
// case: 'Abs(上市日期, yyyy-MM-dd)',
// params: [[3],[2]], //0指标 1数字 2字符 3时间 4公式
// isLimited: true
// },
{
key: 'Ave( )',
isActive: false,
isText: true,
isLong: false,
isFunction: true,
tip: '平均值函数',
type: 5,
funcId: 3,
describe: '计算一组数据的平均值',
case: 'Ave(营业总收入[T:-1][Q:0][合并本期], 营业总收入[T:-2][Q:0][合并本期])',
params: [[0, 1, 4]], //0指标 1数字 2字符 3时间 4公式
isLimited: false
},
{
key: 'Mer( )',
isActive: false,
isText: true,
isLong: false,
isFunction: true,
tip: '当该指标为年报时,用下一年合并上期数据',
type: 5,
funcId: 8,
describe: '计算下一年年报合并上期',
case: 'Mer(营业总收入[T:-1][Q:0][合并本期])',
params: [[0]], //0指标 1数字 2字符 3时间 4公式
isLimited: true
}
], [
{
key: '+',
isActive: false,
isText: true,
isLong: false,
isFunction: false,
tip: '计算符号:加号',
type: 4
},
{
key: '-',
isActive: false,
isText: true,
isLong: false,
isFunction: false,
tip: '计算符号:减号',
type: 4
},
{
key: '*',
isActive: false,
isText: true,
isLong: false,
isFunction: false,
tip: '计算符号:乘号',
type: 4
},
{
key: '/',
isActive: false,
isText: true,
isLong: false,
isFunction: false,
tip: '计算符号:除号',
type: 4
},
{
key: '(',
isActive: false,
isText: true,
isLong: false,
isFunction: false,
tip: '计算符号:左括号',
type: 4
},
{
key: ')',
isActive: false,
isText: true,
isLong: false,
isFunction: false,
tip: '计算符号:右括号',
type: 4
},
{
key: 'Sum( )',
isActive: false,
isText: true,
isLong: false,
isFunction: true,
tip: '求和函数',
type: 5,
funcId: 4,
describe: '计算一组数据的总和',
case: 'Sum(营业总收入[T:-1][Q:0][合并本期], 营业总收入[T:-2][Q:0][合并本期])',
params: [[0, 1, 4]], //0指标 1数字 2字符 3时间 4公式
isLimited: false
},
{
key: 'Max( )',
isActive: false,
isText: true,
isLong: false,
isFunction: true,
tip: '最大值函数',
type: 5,
funcId: 5,
describe: '计算一组数据的最大值',
case: 'Max(营业总收入[T:-1][Q:0][合并本期], 营业总收入[T:-2][Q:0][合并本期])',
params: [[0, 1, 4]], //0指标 1数字 2字符 3时间 4公式
isLimited: false
},
{
key: 'Min( )',
isActive: false,
isText: true,
isLong: false,
isFunction: true,
tip: '最小值函数',
type: 5,
funcId: 6,
describe: '计算一组数据的最小值',
case: 'Min(营业总收入[T:-1][Q:0][合并本期], 营业总收入[T:-2][Q:0][合并本期])',
params: [[0, 1, 4]], //0指标 1数字 2字符 3时间 4公式
isLimited: false
},
{
key: 'Fac( )',
isActive: false,
isText: true,
isLong: false,
isFunction: true,
tip: '阶乘函数',
type: 5,
funcId: 7,
describe: '计算一组数据的阶乘',
case: 'Fac(营业总收入[T:-1][Q:0][合并本期])',
params: [[0, 1, 4]], //0指标 1数字 2字符 3时间 4公式
isLimited: true
}
]
]
//条件上的键盘
var functionKeybord = [
[
{
key: '插入指标',
isActive: false,
isText: true,
isLong: true,
isFunction: false,
tip: '插入指标',
type: 1,
},
{
key: '插入日期',
isActive: false,
isText: true,
isLong: true,
isFunction: false,
tip: '插入日期',
type: 2
},
{
key: '插入数字',
isActive: false,
isText: true,
isLong: true,
isFunction: false,
tip: '插入数字',
type: 3
}
], [
{
key: '+',
isActive: false,
isText: true,
isLong: false,
isFunction: false,
tip: '计算符号:加号',
type: 4
},
{
key: '-',
isActive: false,
isText: true,
isLong: false,
isFunction: false,
tip: '计算符号:减号',
type: 4
},
{
key: '*',
isActive: false,
isText: true,
isLong: false,
isFunction: false,
tip: '计算符号:乘号',
type: 4
},
{
key: '/',
isActive: false,
isText: true,
isLong: false,
isFunction: false,
tip: '计算符号:除号',
type: 4
},
{
key: '(',
isActive: false,
isText: true,
isLong: false,
isFunction: false,
tip: '计算符号:左括号',
type: 4
},
{
key: ')',
isActive: false,
isText: true,
isLong: false,
isFunction: false,
tip: '计算符号:右括号',
type: 4
}
]
]
return {
keybordData: keybordData,
functionKeybord: functionKeybord
}
}//有关于条件的一些方法
getFormatValue(value) {
var unit = '', num = 1
if (value < 10000) {
unit = '', num = 1
} else if (10000 <= value && value < 100000000) {
unit = '', num = 10000
} else if (100000000 <= value && value < 1000000000000) {
unit = '亿', num = 100000000
} else if (value >= 1000000000000) {
unit = '万亿', num = 1000000000000
}
return (value / num).toFixed(0) + unit
}
getFullIndexName = (index) => {
var indexName = index.name, merge = '', company = '', year = '', quarter = ''
if (index.needMergeType) {
merge = '[' + index.mergeType + ']'
}
if (index.needReportData) {
if (index.yearType == 1) {
year = '[T:' + index.t + ']'
} else {
year = '[T:' + index.inputYear + ']'
}
if (index.quarterType == 1) {
quarter = '[Q:' + index.q + ']'
} else {
quarter = '[Q:' + index.inputQuarter + ']'
}
}
if (index.needCompany && index.isAppointCompany) {
company = '[' + index.selectedCompany + ']'
}
return indexName + year + quarter + merge + company
}
getIndexType = (obj) => {
var newObj = {
needMergeType: false,
needReportData: false,
needCompany: false
}
if (obj.TypeContent) {
obj.TypeContent.Parameters.forEach(item => {
if (item.Encode == 'F91997V') {
newObj.needMergeType = true
}
if (item.Encode == 'F91996D') {
newObj.needReportData = true
}
if (item.Encode == 'F90001V') {
newObj.needCompany = true
}
})
}
return newObj
}
setSaveCondition(condition) { //格式化保存的条件,原名 getSaveCalCondition
var operands = []
var div = document.createElement('div')
div.innerHTML = condition.params.dom
var inputs = div.getElementsByTagName('input')
//后台的定义 0指标1符号2数字3时间4方法
//前台的定义 1指标2时间3数字4字符5方法
Array.from(inputs).forEach(item => {
var obj = {}, id = item.id
switch (parseInt(item.getAttribute('type'))) {
case 1: //指标
var param = condition.params.indexParams[id]
var dateYear = '1900'
var dateQuater = '06-30'
var evalArray = []
if (param.yearType == 1) {
evalArray.push({
"EvalOption": 1,
"Value": param.t
})
} else if (param.yearType == 2) {
dateYear = param.inputYear
}
if (param.quarterType == 1) {
evalArray.push({
"EvalOption": 2,
"Value": param.q
})
} else if (param.quarterType == 2) {
dateQuater = param.inputQuarter
}
var where = [
{
"State": 1,
"Encode": "F91996D",
"Value": dateYear + '-' + dateQuater,
"Eval": evalArray
},
{
"State": 1,
"Value": param.mergeType,
"Encode": "F91997V",
"Eval": []
}
]
if (param.isAppointCompany) {
where.push({
"State": 1,
"Value": param.selectedCompany.split('-')[1],
"Encode": "F90001V",
"Eval": []
})
}
obj = {
"List": [param.code],
"Where": where,
"OperandType": 0,
}
break;
case 2: //时间
obj = {
"Value": item.value,
"OperandType": 3
}
break;
case 3: //数字
obj = {
"Value": item.value.replace(/\[.*?\]/g, ''),
"OperandType": 2
}
break;
case 4: //字符
obj = {
"Value": item.value,
"OperandType": 1
}
break;
default:
break;
}
operands.push(obj)
})
return operands
}
getFullSaveCondition(
id, conditionContents, conditionSignature, paramsList, initIndexObj, companyNameObj, getEval, initIndex, that
) { //格式化获取的条件原名 setCalCondition, 启动参数中 setEditCondition, 公司名称 searchCompanyName, 所有指标 getIndexCateGory(initIndexObj)
if (conditionSignature && that.conditionIndex < parseInt(conditionSignature)) {
that.conditionIndex = parseInt(conditionSignature)
}
if (that) {
that.$set(paramsList, id, {
id: id == 'start' ? 'start' : (conditionSignature ? conditionSignature : null),
params: {
indexParams: {},
dateParams: {},
numParams: {},
symbolParams: {},
dom: '',
showDom: ''
}
})
}
var param = paramsList[id].params
conditionContents.forEach(item => {
initIndex++
var id = new Date().getTime() + initIndex
var obj = {}
var inputDom = ''
var showDom = ''
var paramsType = ''
switch (item.OperandType) {
case 0: //指标
var index = initIndexObj[item.List[0]]
var condition = this.getIndexType(index)
var evalObj = getEval(item.Where[0])
obj = {
code: item.List[0],
id: id,
inputQuarter: evalObj.selsetQuarter,
inputYear: evalObj.selectYear,
q: evalObj.qQuarter,
t: evalObj.tYear,
quarterType: evalObj.reportQuarterType,
yearType: evalObj.reportYearType,
mergeType: item.Where[1].Value,
type: 1,
isAppointCompany: item.Where[2] ? true : false,
selectedCompany: item.Where[2] ? (companyNameObj[item.Where[2].Value] + '-' + item.Where[2].Value) : '',
mark: index.Mark,
name: index.Name,
needMergeType: condition.needMergeType,
needReportData: condition.needReportData,
needCompany: condition.needCompany,
typeContent: index.TypeContent
}
var text = this.getFullIndexName(obj)
var width = this.getInputLength(text) + 'px'
inputDom = '<input readonly class="cal-index" type="1" id="' + id + '" style="width:' + width + '" value="' + text + '" />'
showDom = '<span type="1">' + text + '</span>'
paramsType = 'indexParams'
break;
case 1: //符号
obj = {
id: id,
key: item.Value,
type: 4,
value: item.Value
}
var width = this.getInputLength(item.Value) + 'px'
var moreClass = ''
switch (item.Value) {
case '(': case ')':
moreClass = 'brackets'
break;
default:
break;
}
inputDom = '<input readonly class="cal-index ' + moreClass + '" type="4" id="' + id + '" style="width:' + width + '" value="' + item.Value + '" />'
showDom = '<span type="4">' + item.Value + '</span>'
paramsType = 'symbolParams'
break;
case 2: //数字
obj = {
id: id,
type: 3,
value: item.Value
}
var text = item.Value + "[" + getFormatValue(item.Value) + "]"
var width = this.getInputLength(text) + 'px'
inputDom = '<input readonly class="cal-index" type="3" id="' + id + '" style="width:' + width + '" value="' + text + '" />'
showDom = '<span type="3">' + text + '</span>'
paramsType = 'numParams'
break;
case 3: //时间
obj = {
id: id,
type: 2,
value: item.Value
}
var text = item.Value
var width = this.getInputLength(text) + 'px'
inputDom = '<input readonly class="cal-index" type="2" id="' + id + '" style="width:' + width + '" value="' + text + '" />'
showDom = '<span type="2">' + text + '</span>'
paramsType = 'dateParams'
break;
case 4: //方法,暂不做处理
break;
default:
break;
}
// param[paramsType] = {}
param[paramsType][id] = obj
param.dom += inputDom
param.showDom += showDom
})
if (!param.showDom) {
param.showDom = '<span>暂未设置条件</span>'
}
}
}
\ No newline at end of file
const http = require('../../../lib/axios/axios.js') async function getCategoryAudit() {
const { dialog } = require('electron').remote var condition = await getCondition()
const officegen = require('officegen') var value = await loadComponent('publicIndex', window.global.urls.loadUrl + '/src/views/main_views/indexManage/routers/categoryAudit/categoryAudit.vue')
const path = require('path'); return {
const fs = require('fs')
const filePath = path.resolve(__dirname, './categoryAudit.vue')
let newTemplate = ''
var data = fs.readFileSync(filePath);
var str = data.toString()
var newStr = str.substring(0, str.lastIndexOf('</template>'))
newTemplate = newStr.replace('<template>','')
var keyBord = require('../../lib/keyBord')
var tools = require('../../lib/tools.js')
const condition = require('../../components/condition/index.js')
module.exports = {
categoryAudit: {
data: function () { data: function () {
return { return {
tableData: [], tableData: [],
...@@ -78,10 +64,10 @@ module.exports = { ...@@ -78,10 +64,10 @@ module.exports = {
} }
}, },
components: {condition}, components: {condition},
template: newTemplate, template: value.template,
mounted () { mounted () {
this.checkPermission(48, 'indexPermission') this.checkPermission(48, 'indexPermission')
this.currentAccount = store.get('accountId') this.currentAccount = info.accountId
this.getIndexData() this.getIndexData()
this.getBadge(1, 'isDotEdit') this.getBadge(1, 'isDotEdit')
this.getBadge(2, 'isDotSort') this.getBadge(2, 'isDotSort')
...@@ -98,7 +84,7 @@ module.exports = { ...@@ -98,7 +84,7 @@ module.exports = {
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
http.netPost('Account/Account/CheckPermission', { http.netPost('Account/Account/CheckPermission', {
"id": id, "id": id,
"AccountId": store.get('accountId') "AccountId": info.accountId
}) })
.then((res) => { .then((res) => {
if (res.data.Status == 1) { if (res.data.Status == 1) {
...@@ -115,7 +101,7 @@ module.exports = { ...@@ -115,7 +101,7 @@ module.exports = {
http.netPost('Data/CustomIndex/ViewIndexSort', { http.netPost('Data/CustomIndex/ViewIndexSort', {
"status": type == 'pass'?1:2, //1通过2拒绝 "status": type == 'pass'?1:2, //1通过2拒绝
"id": this.activeIndex.Id, "id": this.activeIndex.Id,
"AccountId": store.get('accountId') "AccountId": info.accountId
}) })
.then((res) => { .then((res) => {
if (res.data.Status == 1) { if (res.data.Status == 1) {
...@@ -135,7 +121,7 @@ module.exports = { ...@@ -135,7 +121,7 @@ module.exports = {
http.netPost('Data/CustomIndex/GetPendingViewIndexSort', { http.netPost('Data/CustomIndex/GetPendingViewIndexSort', {
"Current": (this.pageCurrent - 1) * this.psize, "Current": (this.pageCurrent - 1) * this.psize,
"Psize": this.psize, "Psize": this.psize,
"AccountId": store.get('accountId') "AccountId": info.accountId
}) })
.then((res) => { .then((res) => {
if (res.data.Status == 1) { if (res.data.Status == 1) {
...@@ -164,7 +150,7 @@ module.exports = { ...@@ -164,7 +150,7 @@ module.exports = {
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
http.netPost('Data/CustomIndex/GetTodoCustomIndexCount', { http.netPost('Data/CustomIndex/GetTodoCustomIndexCount', {
"countOption": type, "countOption": type,
"AccountId": store.get('accountId') "AccountId": info.accountId
}) })
.then((res) => { .then((res) => {
if (res.data.Status == 1) { if (res.data.Status == 1) {
......
const http = require('../../../lib/axios/axios.js') async function getIndexAudit() {
const { dialog } = require('electron').remote var condition = await getCondition()
const officegen = require('officegen') var calculater = await getCalculater()
const path = require('path'); var value = await loadComponent('publicIndex', window.global.urls.loadUrl + '/src/views/main_views/indexManage/routers/indexAudit/indexAudit.vue')
const fs = require('fs') return {
const filePath = path.resolve(__dirname, './indexAudit.vue')
let newTemplate = ''
var data = fs.readFileSync(filePath);
var str = data.toString()
var newStr = str.substring(0, str.lastIndexOf('</template>'))
newTemplate = newStr.replace('<template>','')
var keyBord = require('../../lib/keyBord')
var tools = require('../../lib/tools.js')
const condition = require('../../components/condition/index.js')
module.exports = {
indexAudit: {
data: function () { data: function () {
return { return {
tableData: [], tableData: [],
...@@ -80,13 +67,13 @@ module.exports = { ...@@ -80,13 +67,13 @@ module.exports = {
} }
}, },
components: {condition}, components: {condition},
template: newTemplate, template: value.template,
mounted () { mounted () {
this.currentAccount = store.get('accountId') this.currentAccount = info.accountId
this.getDefaultType() this.getDefaultType()
this.getPublicCategory() this.getPublicCategory()
tools.getKeyboardObj(keyBord, this.keyboardObj) mytools.getKeyboardObj(mytools.getKeyboard(), this.keyboardObj)
tools.getIndexs(this.initIndexObj).then(res => { mytools.getIndexs(this.initIndexObj).then(res => {
this.getIndexData() this.getIndexData()
}) })
this.getZjhIndustryCategoryList() this.getZjhIndustryCategoryList()
...@@ -111,7 +98,7 @@ module.exports = { ...@@ -111,7 +98,7 @@ module.exports = {
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
http.netPost('Account/Account/CheckPermission', { http.netPost('Account/Account/CheckPermission', {
"id": id, "id": id,
"AccountId": store.get('accountId') "AccountId": info.accountId
}) })
.then((res) => { .then((res) => {
if (res.data.Status == 1) { if (res.data.Status == 1) {
...@@ -693,7 +680,7 @@ module.exports = { ...@@ -693,7 +680,7 @@ module.exports = {
"status": type == 'pass'?16:32, "status": type == 'pass'?16:32,
"id": this.activeIndex.Id, "id": this.activeIndex.Id,
"codes": arr, "codes": arr,
"AccountId": store.get('accountId') "AccountId": info.accountId
}) })
.then((res) => { .then((res) => {
if (res.data.Status == 1) { if (res.data.Status == 1) {
...@@ -815,7 +802,7 @@ module.exports = { ...@@ -815,7 +802,7 @@ module.exports = {
getDefaultType () { getDefaultType () {
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
http.netPost('Data/CustomIndex/GetAllIndexArgs', { http.netPost('Data/CustomIndex/GetAllIndexArgs', {
"AccountId": store.get('accountId') "AccountId": info.accountId
}) })
.then((res) => { .then((res) => {
if (res.data.Status == 1) { if (res.data.Status == 1) {
...@@ -850,7 +837,7 @@ module.exports = { ...@@ -850,7 +837,7 @@ module.exports = {
"Current": (this.pageCurrent - 1) * this.psize, "Current": (this.pageCurrent - 1) * this.psize,
"Psize": this.psize, "Psize": this.psize,
"name": this.searchedName, "name": this.searchedName,
"AccountId": store.get('accountId') "AccountId": info.accountId
}) })
.then((res) => { .then((res) => {
if (res.data.Status == 1) { if (res.data.Status == 1) {
...@@ -904,7 +891,7 @@ module.exports = { ...@@ -904,7 +891,7 @@ module.exports = {
}, },
setDetailCondition (data, id, key) { setDetailCondition (data, id, key) {
tools.getUsedCompany(data.Algorithm.Object || data.Algorithm, this.companyNameObj).then(res => { mytools.getUsedCompany(data.Algorithm.Object || data.Algorithm, this.companyNameObj).then(res => {
this[key] = { this[key] = {
indexParams: {}, indexParams: {},
dateParams: {}, dateParams: {},
...@@ -914,7 +901,7 @@ module.exports = { ...@@ -914,7 +901,7 @@ module.exports = {
dom: '', dom: '',
showDom: '' showDom: ''
} }
tools.getSaveCondition(this[key], data.Algorithm.Object || data.Algorithm, this.initIndex, this.initIndexObj, this.companyNameObj, this.keyboardObj) mytools.getSaveCondition(this[key], data.Algorithm.Object || data.Algorithm, this.initIndex, this.initIndexObj, this.companyNameObj, this.keyboardObj)
this.$nextTick(()=>{ this.$nextTick(()=>{
var spans = document.getElementById(id).getElementsByTagName('span') var spans = document.getElementById(id).getElementsByTagName('span')
var html = '' var html = ''
...@@ -923,7 +910,7 @@ module.exports = { ...@@ -923,7 +910,7 @@ module.exports = {
}) })
document.getElementById(id).innerHTML = html document.getElementById(id).innerHTML = html
var spans = document.getElementById(id).getElementsByTagName('span') var spans = document.getElementById(id).getElementsByTagName('span')
tools.formatShowDom(spans) mytools.formatShowDom(spans)
}) })
}) })
}, },
...@@ -932,7 +919,7 @@ module.exports = { ...@@ -932,7 +919,7 @@ module.exports = {
this.activeIndex = data this.activeIndex = data
this.showIndexDetail = true this.showIndexDetail = true
tools.getUsedCompany(data.Algorithm.Object, this.companyNameObj).then(res => { mytools.getUsedCompany(data.Algorithm.Object, this.companyNameObj).then(res => {
this.activeIndexCondition = { this.activeIndexCondition = {
indexParams: {}, indexParams: {},
dateParams: {}, dateParams: {},
...@@ -943,7 +930,7 @@ module.exports = { ...@@ -943,7 +930,7 @@ module.exports = {
showDom: '' showDom: ''
} }
tools.getSaveCondition(this.activeIndexCondition, data.Algorithm.Object, this.initIndex, this.initIndexObj, this.companyNameObj, this.keyboardObj) mytools.getSaveCondition(this.activeIndexCondition, data.Algorithm.Object, this.initIndex, this.initIndexObj, this.companyNameObj, this.keyboardObj)
this.$nextTick(()=>{ this.$nextTick(()=>{
var spans = document.getElementById('conditionBox').getElementsByTagName('span') var spans = document.getElementById('conditionBox').getElementsByTagName('span')
...@@ -953,7 +940,7 @@ module.exports = { ...@@ -953,7 +940,7 @@ module.exports = {
}) })
document.getElementById('conditionBox').innerHTML = html document.getElementById('conditionBox').innerHTML = html
var spans = document.getElementById('conditionBox').getElementsByTagName('span') var spans = document.getElementById('conditionBox').getElementsByTagName('span')
tools.formatShowDom(spans) mytools.formatShowDom(spans)
}) })
}) })
}, },
...@@ -961,7 +948,7 @@ module.exports = { ...@@ -961,7 +948,7 @@ module.exports = {
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
http.netPost('Data/CustomIndex/GetTodoCustomIndexCount', { http.netPost('Data/CustomIndex/GetTodoCustomIndexCount', {
"countOption": type, "countOption": type,
"AccountId": store.get('accountId') "AccountId": info.accountId
}) })
.then((res) => { .then((res) => {
if (res.data.Status == 1) { if (res.data.Status == 1) {
......
const http = require('../../../lib/axios/axios.js') async function getIndexRecord() {
const { dialog } = require('electron').remote var condition = await getCondition()
const officegen = require('officegen') var value = await loadComponent('publicIndex', window.global.urls.loadUrl + '/src/views/main_views/indexManage/routers/indexRecord/indexRecord.vue')
const path = require('path'); return {
const fs = require('fs')
const filePath = path.resolve(__dirname, './indexRecord.vue')
let newTemplate = ''
var data = fs.readFileSync(filePath);
var str = data.toString()
var newStr = str.substring(0, str.lastIndexOf('</template>'))
newTemplate = newStr.replace('<template>','')
const condition = require('../../components/condition/index.js')
module.exports = {
indexRecord: {
data: function () { data: function () {
return { return {
tableData: [], tableData: [],
...@@ -79,10 +66,10 @@ module.exports = { ...@@ -79,10 +66,10 @@ module.exports = {
} }
}, },
components: {condition}, components: {condition},
template: newTemplate, template: value.template,
mounted () { mounted () {
this.checkPermission(48, 'indexPermission') this.checkPermission(48, 'indexPermission')
this.currentAccount = store.get('accountId') this.currentAccount = info.accountId
this.getIndexData() this.getIndexData()
this.getBadge(1, 'isDotEdit') this.getBadge(1, 'isDotEdit')
this.getBadge(2, 'isDotSort') this.getBadge(2, 'isDotSort')
...@@ -99,7 +86,7 @@ module.exports = { ...@@ -99,7 +86,7 @@ module.exports = {
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
http.netPost('Account/Account/CheckPermission', { http.netPost('Account/Account/CheckPermission', {
"id": id, "id": id,
"AccountId": store.get('accountId') "AccountId": info.accountId
}) })
.then((res) => { .then((res) => {
if (res.data.Status == 1) { if (res.data.Status == 1) {
...@@ -119,7 +106,7 @@ module.exports = { ...@@ -119,7 +106,7 @@ module.exports = {
"Current": (this.pageCurrent - 1) * this.psize, "Current": (this.pageCurrent - 1) * this.psize,
"Psize": this.psize, "Psize": this.psize,
"name": this.searchName, "name": this.searchName,
"AccountId": store.get('accountId') "AccountId": info.accountId
}) })
.then((res) => { .then((res) => {
if (res.data.Status == 1) { if (res.data.Status == 1) {
...@@ -152,7 +139,7 @@ module.exports = { ...@@ -152,7 +139,7 @@ module.exports = {
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
http.netPost('Data/CustomIndex/GetTodoCustomIndexCount', { http.netPost('Data/CustomIndex/GetTodoCustomIndexCount', {
"countOption": type, "countOption": type,
"AccountId": store.get('accountId') "AccountId": info.accountId
}) })
.then((res) => { .then((res) => {
if (res.data.Status == 1) { if (res.data.Status == 1) {
......
const http = require('../../../lib/axios/axios.js') async function getMyIndex() {
const { dialog } = require('electron').remote var condition = await getCondition()
const officegen = require('officegen') var calculater = await getCalculater()
const path = require('path'); var value = await loadComponent('publicIndex', window.global.urls.loadUrl + '/src/views/main_views/indexManage/routers/myIndex/myIndex.vue')
const fs = require('fs') return {
const filePath = path.resolve(__dirname, './myIndex.vue')
let newTemplate = ''
var data = fs.readFileSync(filePath);
var str = data.toString()
var newStr = str.substring(0, str.lastIndexOf('</template>'))
newTemplate = newStr.replace('<template>', '')
// const calculater = require('../components/calculater')
const calculater = require('../../../components/complexCondition/index')
var keyBord = require('../../lib/keyBord')
var tools = require('../../lib/tools.js')
const { ipcRenderer } = require('electron')
const condition = require('../../components/condition/index.js')
module.exports = {
myIndex: {
data: function () { data: function () {
return { return {
treeData: [], treeData: [],
...@@ -164,7 +148,7 @@ module.exports = { ...@@ -164,7 +148,7 @@ module.exports = {
computed: { computed: {
}, },
template: newTemplate, template: value.template,
mounted() { mounted() {
var that = this var that = this
ipcRenderer.on('copy-multiple-condition-reply', function (event, arg) { ipcRenderer.on('copy-multiple-condition-reply', function (event, arg) {
...@@ -174,7 +158,7 @@ module.exports = { ...@@ -174,7 +158,7 @@ module.exports = {
this.getIndexs().then(res => { this.getIndexs().then(res => {
this.getIndexCateGory('init') this.getIndexCateGory('init')
this.getDefaultType() this.getDefaultType()
tools.getKeyboardObj(keyBord, this.keyboardObj) mytools.getKeyboardObj(mytools.getKeyboard(), this.keyboardObj)
}) })
this.getZjhIndustryCategoryList() this.getZjhIndustryCategoryList()
...@@ -201,7 +185,7 @@ module.exports = { ...@@ -201,7 +185,7 @@ module.exports = {
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
http.netPost('Account/Account/CheckPermission', { http.netPost('Account/Account/CheckPermission', {
"id": id, "id": id,
"AccountId": store.get('accountId') "AccountId": info.accountId
}) })
.then((res) => { .then((res) => {
if (res.data.Status == 1) { if (res.data.Status == 1) {
...@@ -315,7 +299,7 @@ module.exports = { ...@@ -315,7 +299,7 @@ module.exports = {
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
http.netPost('Data/CustomIndex/UnSubmitIndex', { http.netPost('Data/CustomIndex/UnSubmitIndex', {
"id": this.activeIndex.PublicIndexId, "id": this.activeIndex.PublicIndexId,
"AccountId": store.get('accountId') "AccountId": info.accountId
}) })
.then((res) => { .then((res) => {
if (res.data.Status == 1) { if (res.data.Status == 1) {
...@@ -852,7 +836,7 @@ module.exports = { ...@@ -852,7 +836,7 @@ module.exports = {
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
http.netPost('Data/CustomIndex/RemoveCustomIndex', { http.netPost('Data/CustomIndex/RemoveCustomIndex', {
"id": this.activeIndex.Id, "id": this.activeIndex.Id,
"AccountId": store.get('accountId') "AccountId": info.accountId
}) })
.then((res) => { .then((res) => {
if (res.data.Status == 1) { if (res.data.Status == 1) {
...@@ -876,7 +860,7 @@ module.exports = { ...@@ -876,7 +860,7 @@ module.exports = {
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
http.netPost('Data/CustomIndex/IndexNameSimilarity', { http.netPost('Data/CustomIndex/IndexNameSimilarity', {
"customIndexId": this.activeIndex.Id, "customIndexId": this.activeIndex.Id,
"AccountId": store.get('accountId') "AccountId": info.accountId
}) })
.then((res) => { .then((res) => {
if (res.data.Status == 1) { if (res.data.Status == 1) {
...@@ -903,7 +887,7 @@ module.exports = { ...@@ -903,7 +887,7 @@ module.exports = {
http.netPost('Data/CustomIndex/SubmitIndexToView', { http.netPost('Data/CustomIndex/SubmitIndexToView', {
"id": this.activeIndex.Id, "id": this.activeIndex.Id,
"archiveCodes": arr, "archiveCodes": arr,
"AccountId": store.get('accountId') "AccountId": info.accountId
}) })
.then((res) => { .then((res) => {
if (res.data.Status == 1) { if (res.data.Status == 1) {
...@@ -993,7 +977,7 @@ module.exports = { ...@@ -993,7 +977,7 @@ module.exports = {
getDefaultType() { getDefaultType() {
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
http.netPost('Data/CustomIndex/GetAllIndexArgs', { http.netPost('Data/CustomIndex/GetAllIndexArgs', {
"AccountId": store.get('accountId') "AccountId": info.accountId
}) })
.then((res) => { .then((res) => {
if (res.data.Status == 1) { if (res.data.Status == 1) {
...@@ -1070,7 +1054,7 @@ module.exports = { ...@@ -1070,7 +1054,7 @@ module.exports = {
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
http.netPost('Data/CustomIndex/RemoveArchive', { http.netPost('Data/CustomIndex/RemoveArchive', {
"Id": this.activeIndex.Id, "Id": this.activeIndex.Id,
"AccountId": store.get('accountId') "AccountId": info.accountId
}) })
.then((res) => { .then((res) => {
if (res.data.Status == 1) { if (res.data.Status == 1) {
...@@ -1091,7 +1075,7 @@ module.exports = { ...@@ -1091,7 +1075,7 @@ module.exports = {
// "Psize": 100, // "Psize": 100,
// "Code": "B", // "Code": "B",
// 'Name': '', // 'Name': '',
// "AccountId": store.get('accountId') // "AccountId": info.accountId
// }) // })
// .then((res) => { // .then((res) => {
// if (res.data.Status == 1) { // if (res.data.Status == 1) {
...@@ -1113,7 +1097,7 @@ module.exports = { ...@@ -1113,7 +1097,7 @@ module.exports = {
"Psize": 100, "Psize": 100,
"Code": "B", "Code": "B",
'Name': '', 'Name': '',
"AccountId": store.get('accountId') "AccountId": info.accountId
}) })
.then((res) => { .then((res) => {
if (res.data.Status == 1) { if (res.data.Status == 1) {
...@@ -1297,7 +1281,7 @@ module.exports = { ...@@ -1297,7 +1281,7 @@ module.exports = {
dom: '', dom: '',
showDom: '' showDom: ''
} }
tools.getSaveCondition(this.activeIndexCondition, data.Algorithm.Object, this.initIndex, this.initIndexObj, this.companyNameObj, this.keyboardObj) mytools.getSaveCondition(this.activeIndexCondition, data.Algorithm.Object, this.initIndex, this.initIndexObj, this.companyNameObj, this.keyboardObj)
this.$nextTick(() => { this.$nextTick(() => {
var spans = document.getElementById('conditionBox').getElementsByTagName('span') var spans = document.getElementById('conditionBox').getElementsByTagName('span')
...@@ -1307,7 +1291,7 @@ module.exports = { ...@@ -1307,7 +1291,7 @@ module.exports = {
}) })
document.getElementById('conditionBox').innerHTML = html document.getElementById('conditionBox').innerHTML = html
var spans = document.getElementById('conditionBox').getElementsByTagName('span') var spans = document.getElementById('conditionBox').getElementsByTagName('span')
tools.formatShowDom(spans) mytools.formatShowDom(spans)
}) })
}) })
this.activeIndex = data this.activeIndex = data
...@@ -1450,7 +1434,7 @@ module.exports = { ...@@ -1450,7 +1434,7 @@ module.exports = {
this.treeLoading = true this.treeLoading = true
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
http.netPost('Data/CustomIndex/GetMyIndexArchivesLight', { http.netPost('Data/CustomIndex/GetMyIndexArchivesLight', {
"AccountId": store.get('accountId') "AccountId": info.accountId
}) })
.then((res) => { .then((res) => {
if (res.data.Status == 1) { if (res.data.Status == 1) {
...@@ -1537,7 +1521,7 @@ module.exports = { ...@@ -1537,7 +1521,7 @@ module.exports = {
"id": this.addCategoryType == 'add' ? 0 : this.activeIndex.Id, "id": this.addCategoryType == 'add' ? 0 : this.activeIndex.Id,
"archiveName": this.inputedCategoryName, "archiveName": this.inputedCategoryName,
"parentId": this.addCategoryType == 'add' ? this.activeIndex.Id : this.activeIndex.ParentId, "parentId": this.addCategoryType == 'add' ? this.activeIndex.Id : this.activeIndex.ParentId,
"AccountId": store.get('accountId') "AccountId": info.accountId
}) })
.then((res) => { .then((res) => {
this.createOrChangeCategoryLoading = false this.createOrChangeCategoryLoading = false
...@@ -1595,7 +1579,7 @@ module.exports = { ...@@ -1595,7 +1579,7 @@ module.exports = {
"remark": this.editIndexDetail, //备注 "remark": this.editIndexDetail, //备注
"keywordIds": keywordIds, "keywordIds": keywordIds,
"dimensionIds": dimensionIds, "dimensionIds": dimensionIds,
"AccountId": store.get('accountId') "AccountId": info.accountId
}) })
.then((res) => { .then((res) => {
if (res.data.Status == 1) { if (res.data.Status == 1) {
...@@ -1716,7 +1700,7 @@ module.exports = { ...@@ -1716,7 +1700,7 @@ module.exports = {
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
http.netPost('Data/CustomIndex/GetMyIndexByIds', { http.netPost('Data/CustomIndex/GetMyIndexByIds', {
"ids": ids, "ids": ids,
"AccountId": store.get('accountId') "AccountId": info.accountId
}) })
.then((res) => { .then((res) => {
if (res.data.Status == 1) { if (res.data.Status == 1) {
...@@ -1730,7 +1714,7 @@ module.exports = { ...@@ -1730,7 +1714,7 @@ module.exports = {
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
http.netPost('Data/CustomIndex/GetTodoCustomIndexCount', { http.netPost('Data/CustomIndex/GetTodoCustomIndexCount', {
"countOption": type, "countOption": type,
"AccountId": store.get('accountId') "AccountId": info.accountId
}) })
.then((res) => { .then((res) => {
if (res.data.Status == 1) { if (res.data.Status == 1) {
...@@ -1750,7 +1734,7 @@ module.exports = { ...@@ -1750,7 +1734,7 @@ module.exports = {
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
http.netPost('Data/Encode/GetEncodeDetailsByCodes', { http.netPost('Data/Encode/GetEncodeDetailsByCodes', {
"codes": codes, "codes": codes,
"AccountId": store.get('accountId') "AccountId": info.accountId
}) })
.then((res) => { .then((res) => {
if (res.data.Status == 1) { if (res.data.Status == 1) {
......
...@@ -251,7 +251,7 @@ ...@@ -251,7 +251,7 @@
<!-- 未选中指标的显示 --> <!-- 未选中指标的显示 -->
<div class="detail-container" v-if="!activeIndex.isIndex"> <div class="detail-container" v-if="!activeIndex.isIndex">
<div class="empty-status"> <div class="empty-status">
<img src="../../static/image/empty.png" alt /> <img src="../../../static/images/empty.png" alt />
<div class="empty-tip">请从左侧点击指标或者分类</div> <div class="empty-tip">请从左侧点击指标或者分类</div>
</div> </div>
</div> </div>
......
const http = require('../../../lib/axios/axios.js') async function getPublicIndex() {
const { dialog } = require('electron').remote var condition = await getCondition()
const officegen = require('officegen') var calculater = await getCalculater()
const path = require('path'); var value = await loadComponent('publicIndex', window.global.urls.loadUrl + '/src/views/main_views/indexManage/routers/publicIndex/publicIndex.vue')
const fs = require('fs') return {
const filePath = path.resolve(__dirname, './publicIndex.vue')
let newTemplate = ''
var data = fs.readFileSync(filePath);
var str = data.toString()
var newStr = str.substring(0, str.lastIndexOf('</template>'))
newTemplate = newStr.replace('<template>', '')
// const calculater = require('../components/calculater')
const calculater = require('../../../components/complexCondition/index')
var keyBord = require('../../lib/keyBord')
var tools = require('../../lib/tools.js')
const { ipcRenderer } = require('electron')
const condition = require('../../components/condition/index.js')
module.exports = {
publicIndex: {
data: function () { data: function () {
return { return {
treeData: [], treeData: [],
...@@ -190,7 +174,7 @@ module.exports = { ...@@ -190,7 +174,7 @@ module.exports = {
computed: { computed: {
}, },
template: newTemplate, template: value.template,
mounted() { mounted() {
var that = this var that = this
ipcRenderer.on('copy-multiple-condition-reply', function (event, arg) { ipcRenderer.on('copy-multiple-condition-reply', function (event, arg) {
...@@ -200,7 +184,7 @@ module.exports = { ...@@ -200,7 +184,7 @@ module.exports = {
this.getIndexs().then(res => { this.getIndexs().then(res => {
this.getIndexCateGory() this.getIndexCateGory()
this.getDefaultType() this.getDefaultType()
tools.getKeyboardObj(keyBord, this.keyboardObj) mytools.getKeyboardObj(mytools.getKeyboard(), this.keyboardObj)
}) })
this.getZjhIndustryCategoryList() this.getZjhIndustryCategoryList()
this.getSwIndustryCategoryList() this.getSwIndustryCategoryList()
...@@ -229,7 +213,7 @@ module.exports = { ...@@ -229,7 +213,7 @@ module.exports = {
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
http.netPost('Account/Account/CheckPermission', { http.netPost('Account/Account/CheckPermission', {
"id": id, "id": id,
"AccountId": store.get('accountId') "AccountId": info.accountId
}) })
.then((res) => { .then((res) => {
if (res.data.Status == 1) { if (res.data.Status == 1) {
...@@ -305,7 +289,7 @@ module.exports = { ...@@ -305,7 +289,7 @@ module.exports = {
http.netPost('Data/CustomIndex/SortPublicIndex', { http.netPost('Data/CustomIndex/SortPublicIndex', {
"sortedPublicIndex": this.confirmCopy(), "sortedPublicIndex": this.confirmCopy(),
"remark": this.copyIndexMemo, "remark": this.copyIndexMemo,
"accountId": store.get('accountId') "accountId": info.accountId
}) })
.then((res) => { .then((res) => {
if (res.data.Status == 1) { if (res.data.Status == 1) {
...@@ -329,7 +313,7 @@ module.exports = { ...@@ -329,7 +313,7 @@ module.exports = {
http.netPost('Data/CustomIndex/SortPublicIndex', { http.netPost('Data/CustomIndex/SortPublicIndex', {
"sortedPublicIndex": submitArr, "sortedPublicIndex": submitArr,
"remark": this.changePositionMemo, "remark": this.changePositionMemo,
"accountId": store.get('accountId') "accountId": info.accountId
}) })
.then((res) => { .then((res) => {
if (res.data.Status == 1) { if (res.data.Status == 1) {
...@@ -440,7 +424,7 @@ module.exports = { ...@@ -440,7 +424,7 @@ module.exports = {
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
http.netPost('Data/CustomIndex/CopyPublicToMyCustomIndex', { http.netPost('Data/CustomIndex/CopyPublicToMyCustomIndex', {
"id": this.activeIndex.Id, "id": this.activeIndex.Id,
"accountId": store.get('accountId') "accountId": info.accountId
}) })
.then((res) => { .then((res) => {
if (res.data.Status == 1) { if (res.data.Status == 1) {
...@@ -463,7 +447,7 @@ module.exports = { ...@@ -463,7 +447,7 @@ module.exports = {
http.netPost('Data/CustomIndex/EditPublicIndexWiki', { http.netPost('Data/CustomIndex/EditPublicIndexWiki', {
"id": this.activeIndex.Id, "id": this.activeIndex.Id,
"wiki": this.editWiki, "wiki": this.editWiki,
"AccountId": store.get('accountId') "AccountId": info.accountId
}) })
.then((res) => { .then((res) => {
if (res.data.Status == 1) { if (res.data.Status == 1) {
...@@ -484,7 +468,7 @@ module.exports = { ...@@ -484,7 +468,7 @@ module.exports = {
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
http.netPost('Account/Account/CheckPermission', { http.netPost('Account/Account/CheckPermission', {
"id": id, "id": id,
"AccountId": store.get('accountId') "AccountId": info.accountId
}) })
.then((res) => { .then((res) => {
if (res.data.Status == 1) { if (res.data.Status == 1) {
...@@ -503,7 +487,7 @@ module.exports = { ...@@ -503,7 +487,7 @@ module.exports = {
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
http.netPost('Data/CustomIndex/UnSubmitIndex', { http.netPost('Data/CustomIndex/UnSubmitIndex', {
"id": this.activeIndex.PublicIndexId, "id": this.activeIndex.PublicIndexId,
"AccountId": store.get('accountId') "AccountId": info.accountId
}) })
.then((res) => { .then((res) => {
if (res.data.Status == 1) { if (res.data.Status == 1) {
...@@ -1039,7 +1023,7 @@ module.exports = { ...@@ -1039,7 +1023,7 @@ module.exports = {
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
http.netPost('Data/CustomIndex/RemoveCustomIndex', { http.netPost('Data/CustomIndex/RemoveCustomIndex', {
"id": this.activeIndex.Id, "id": this.activeIndex.Id,
"AccountId": store.get('accountId') "AccountId": info.accountId
}) })
.then((res) => { .then((res) => {
if (res.data.Status == 1) { if (res.data.Status == 1) {
...@@ -1071,7 +1055,7 @@ module.exports = { ...@@ -1071,7 +1055,7 @@ module.exports = {
http.netPost('Data/CustomIndex/SubmitIndexToView', { http.netPost('Data/CustomIndex/SubmitIndexToView', {
"id": this.activeIndex.Id, "id": this.activeIndex.Id,
"archiveCode": this.submitCategory[this.submitCategory.length - 1], "archiveCode": this.submitCategory[this.submitCategory.length - 1],
"AccountId": store.get('accountId') "AccountId": info.accountId
}) })
.then((res) => { .then((res) => {
if (res.data.Status == 1) { if (res.data.Status == 1) {
...@@ -1151,7 +1135,7 @@ module.exports = { ...@@ -1151,7 +1135,7 @@ module.exports = {
getDefaultType() { getDefaultType() {
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
http.netPost('Data/CustomIndex/GetAllIndexArgs', { http.netPost('Data/CustomIndex/GetAllIndexArgs', {
"AccountId": store.get('accountId') "AccountId": info.accountId
}) })
.then((res) => { .then((res) => {
if (res.data.Status == 1) { if (res.data.Status == 1) {
...@@ -1249,7 +1233,7 @@ module.exports = { ...@@ -1249,7 +1233,7 @@ module.exports = {
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
http.netPost('Data/CustomIndex/RemoveEmptyPublicIndexArchiveReq', { http.netPost('Data/CustomIndex/RemoveEmptyPublicIndexArchiveReq', {
"code": this.activeIndex.Code, "code": this.activeIndex.Code,
"AccountId": store.get('accountId') "AccountId": info.accountId
}) })
.then((res) => { .then((res) => {
if (res.data.Status == 1) { if (res.data.Status == 1) {
...@@ -1272,7 +1256,7 @@ module.exports = { ...@@ -1272,7 +1256,7 @@ module.exports = {
"Psize": 100, "Psize": 100,
"Code": "B", "Code": "B",
'Name': '', 'Name': '',
"AccountId": store.get('accountId') "AccountId": info.accountId
}) })
.then((res) => { .then((res) => {
if (res.data.Status == 1) { if (res.data.Status == 1) {
...@@ -1412,55 +1396,7 @@ module.exports = { ...@@ -1412,55 +1396,7 @@ module.exports = {
status: status, status: status,
obj: params obj: params
} }
}, },
//指标点击
// selecteIndex(value, param) {
// var data = {}, arr = []
// data = value
// arr = value.isIndex?data.Algorithm.Object:[]
// data.status = value.CurrentFlowStatus
// //先恢复初始化
// if (this.detailShowType == 2) {
// return false
// }
// if (data.isIndex) {
// this.activeIndexStatus = data.status
// this.detailShowType = 1
// this.getUsedCompany(arr).then(res => {
// this.activeIndexCondition = {
// indexParams: {},
// dateParams: {},
// numParams: {},
// symbolParams: {},
// functionParams: {},
// dom: '',
// showDom: ''
// }
// tools.getSaveCondition(this.activeIndexCondition, arr, this.initIndex, this.initIndexObj, this.companyNameObj, this.keyboardObj)
// this.$nextTick(() => {
// var spans = document.getElementById('conditionBox').getElementsByTagName('span')
// var html = ''
// Array.from(spans).forEach(span => {
// html += span.outerHTML
// })
// document.getElementById('conditionBox').innerHTML = html
// var spans = document.getElementById('conditionBox').getElementsByTagName('span')
// tools.formatShowDom(spans)
// })
// })
// } else {
// console.log(data)
// this.detailShowType = 3
// if(!data.children || data.children.length == 0){
// data.allowedDelete = true
// }
// }
// this.activeIndex = data
// this.activeIndex.from = this.findPathByLeafId(value.myId, this.myTreeData)
// },
selecteIndex(value, param) { selecteIndex(value, param) {
console.log(value) console.log(value)
var arr = [value.Code] var arr = [value.Code]
...@@ -1491,7 +1427,7 @@ module.exports = { ...@@ -1491,7 +1427,7 @@ module.exports = {
showDom: '' showDom: ''
} }
this.initIndex++ this.initIndex++
tools.getSaveCondition(this.activeIndexCondition, data.Algorithm, this.initIndex, this.initIndexObj, this.companyNameObj, this.keyboardObj) mytools.getSaveCondition(this.activeIndexCondition, data.Algorithm, this.initIndex, this.initIndexObj, this.companyNameObj, this.keyboardObj)
this.$nextTick(() => { this.$nextTick(() => {
var spans = document.getElementById('conditionBox').getElementsByTagName('span') var spans = document.getElementById('conditionBox').getElementsByTagName('span')
...@@ -1501,7 +1437,7 @@ module.exports = { ...@@ -1501,7 +1437,7 @@ module.exports = {
}) })
document.getElementById('conditionBox').innerHTML = html document.getElementById('conditionBox').innerHTML = html
var spans = document.getElementById('conditionBox').getElementsByTagName('span') var spans = document.getElementById('conditionBox').getElementsByTagName('span')
tools.formatShowDom(spans) mytools.formatShowDom(spans)
}) })
}) })
this.activeIndex = data this.activeIndex = data
...@@ -1631,7 +1567,7 @@ module.exports = { ...@@ -1631,7 +1567,7 @@ module.exports = {
this.treeLoading = true this.treeLoading = true
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
http.netPost('Data/CustomIndex/GetPublicCustomIndexLight', { http.netPost('Data/CustomIndex/GetPublicCustomIndexLight', {
"AccountId": store.get('accountId') "AccountId": info.accountId
}) })
.then((res) => { .then((res) => {
if (res.data.Status == 1) { if (res.data.Status == 1) {
...@@ -1706,7 +1642,7 @@ module.exports = { ...@@ -1706,7 +1642,7 @@ module.exports = {
"code": this.addCategoryType == 'add' ? "" : this.activeIndex.Code, "code": this.addCategoryType == 'add' ? "" : this.activeIndex.Code,
"name": this.inputedCategoryName, "name": this.inputedCategoryName,
"parentCode": this.addCategoryType == 'add' ? this.activeIndex.Code : this.activeIndex.ParentCode, "parentCode": this.addCategoryType == 'add' ? this.activeIndex.Code : this.activeIndex.ParentCode,
"AccountId": store.get('accountId') "AccountId": info.accountId
}) })
.then((res) => { .then((res) => {
this.createOrChangeCategoryLoading = false this.createOrChangeCategoryLoading = false
...@@ -1770,7 +1706,7 @@ module.exports = { ...@@ -1770,7 +1706,7 @@ module.exports = {
"unit": this.editIndexUnit, //单位 "unit": this.editIndexUnit, //单位
"remark": this.editIndexRemark, //备注 "remark": this.editIndexRemark, //备注
"wiki": this.editIndexDetail, //百科 "wiki": this.editIndexDetail, //百科
"AccountId": store.get('accountId') "AccountId": info.accountId
}) })
.then((res) => { .then((res) => {
if (res.data.Status == 1) { if (res.data.Status == 1) {
...@@ -1917,7 +1853,7 @@ module.exports = { ...@@ -1917,7 +1853,7 @@ module.exports = {
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
http.netPost('Data/CustomIndex/GetPublicCustomIndexDetailsByCodes', { http.netPost('Data/CustomIndex/GetPublicCustomIndexDetailsByCodes', {
"codes": ids, "codes": ids,
"AccountId": store.get('accountId') "AccountId": info.accountId
}) })
.then((res) => { .then((res) => {
if (res.data.Status == 1) { if (res.data.Status == 1) {
...@@ -1931,7 +1867,7 @@ module.exports = { ...@@ -1931,7 +1867,7 @@ module.exports = {
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
http.netPost('Data/CustomIndex/GetTodoCustomIndexCount', { http.netPost('Data/CustomIndex/GetTodoCustomIndexCount', {
"countOption": type, "countOption": type,
"AccountId": store.get('accountId') "AccountId": info.accountId
}) })
.then((res) => { .then((res) => {
if (res.data.Status == 1) { if (res.data.Status == 1) {
...@@ -1992,4 +1928,4 @@ module.exports = { ...@@ -1992,4 +1928,4 @@ module.exports = {
} }
} }
} }
} }
\ No newline at end of file
...@@ -217,7 +217,7 @@ ...@@ -217,7 +217,7 @@
<!-- 未选中指标的显示 --> <!-- 未选中指标的显示 -->
<div class="detail-container" v-if="!activeIndex.DataType"> <div class="detail-container" v-if="!activeIndex.DataType">
<div class="empty-status"> <div class="empty-status">
<img src="../../static/image/empty.png" alt /> <img src="../../../static/images/empty.png" alt />
<div class="empty-tip">请从左侧点击指标或者分类</div> <div class="empty-tip">请从左侧点击指标或者分类</div>
</div> </div>
</div> </div>
......
const { publicIndex } = require('./publicIndex.js')
const { indexAudit } = require('./indexAudit.js')
const { myIndex } = require('./myIndex.js')
const { categoryAudit } = require('./categoryAudit.js')
const { indexRecord } = require('./indexRecord.js')
const routes = [
{ path: '/', component: myIndex },
{ path: '/indexAudit', component: indexAudit },
{ path: '/publicIndex', component: publicIndex },
{ path: '/categoryAudit', component: categoryAudit },
{ path: '/indexRecord', component: indexRecord }
]
module.exports = {
routes: routes
}
\ No newline at end of file
...@@ -214,22 +214,25 @@ ...@@ -214,22 +214,25 @@
</div> </div>
</body> </body>
<script>
const { ipcRenderer } = require('electron')
const { app } = require('electron').remote
</script>
<!-- import Vue before Element --> <!-- import Vue before Element -->
<script src="../../../static/vue/vue.js"></script> <script src="../../../static/vue/vue.js"></script>
<script src="../../../static/element/index.js"></script> <script src="../../../static/element/index.js"></script>
<script src="../../../assist/axios.js"></script>
<script src="./report.js"></script>
<script> <script>
const { ipcRenderer } = require('electron') const http = newHttp()
const { app } = require('electron').remote
const path = app.getAppPath()
const http = require(path + '/src/assist/axios.js')
const tools = require(path + '/src/views/main_views/report/report.js')
const { dialog } = require('electron').remote const { dialog } = require('electron').remote
const Datastore = require('nedb') const Datastore = require('nedb')
const { shell } = require('electron') const { shell } = require('electron')
var info = JSON.parse(localStorage.getItem('userInfo')) var info = JSON.parse(localStorage.getItem('userInfo'))
var menu = tools.hsmenu() var menu = hsmenu()
new Vue({ new Vue({
el: '#app', el: '#app',
......
module.exports.hsmenu = () => { function hsmenu () {
return [{ return [{
label: '全部', label: '全部',
code: [] code: []
......
const { app } = require('electron').remote
const path = app.getAppPath()
const init = require(path + '/src/assist/loadVue.js')
var value = init(__filename, __dirname)
console.log(__filename)
console.log(__dirname)
console.log(value)
//以上代码引入vue、css等,初始化 //以上代码引入vue、css等,初始化
const { ipcRenderer } = require('electron') const loadUrl = window.global.urls.loadUrl
const { historyListPrice } = require(path + '/src/assist/dictionary.js')
module.exports[value.name] = { async function getMain() {
data: function () { var value = await loadComponent('main', loadUrl + '/src/views/main_views/stockMarket/routers/main/main.vue')
return { return {
selectType: '1', data: function () {
inputCompany: '', return {
inputSearch: '', selectType: '1',
reportType: '2', inputCompany: '',
conditionWidth: '196px', inputSearch: '',
showCondition: true, reportType: '2',
tableData: [], conditionWidth: '196px',
defaultProps: { showCondition: true,
children: 'children', tableData: [],
label: 'label' defaultProps: {
}, children: 'children',
total: 0, label: 'label'
psize: 50, },
currentPage: 1, total: 0,
companyList: [], psize: 50,
selectLoading: false, currentPage: 1,
inputCode: [], companyList: [],
whereOr: [], selectLoading: false,
whereOrArrayAnd: [], inputCode: [],
showTable: false, whereOr: [],
industryData: [], whereOrArrayAnd: [],
positionData: [], showTable: false,
industryCompany: [], industryData: [],
// 新的数据 positionData: [],
historyPrice: historyListPrice(), industryCompany: [],
choosedDate: '2019-01-21', // 新的数据
sort: [{ historyPrice: getDictionary().historyListPrice(),
'FieldName': 'TRADEDATE', choosedDate: '2019-01-21',
'State': 2 sort: [{
}], 'FieldName': 'TRADEDATE',
tabTitle: ['行业', '地域'], 'State': 2
isShowTab: 0, }],
moveLeft: '0', tabTitle: ['行业', '地域'],
moveWidth: '0' isShowTab: 0,
} moveLeft: '0',
}, moveWidth: '0'
template: value.template,
computed: {
current() {
return (this.currentPage - 1) * this.psize
}
},
mounted() {
this.getIndustryData()
this.getPositionData()
// 新的请求
this.getStockList()
this.$nextTick(
function () {
this.changeTabs(0)
}
)
},
methods: {
changeTabs(index) {
this.isShowTab = index
var length = this.tabTitle[index].length * 13
var tab = document.getElementById('tab' + index).offsetLeft
var width = document.getElementById('tab' + index).offsetWidth
var move = (width - length) / 2
this.moveWidth = length + 'px'
this.moveLeft = tab + move + 'px'
},
goToCompanyIndex(name, code) {
// 前往公司Kline
var params = {
id: 'kilne' + code,
name: name + 'k线图',
src: './kline.html?id=' + code + '&name=' + name
} }
ipcRenderer.send('openPage', params)
},
hideSearch() {
this.conditionWidth = '16px'
this.showCondition = false
},
showSearch() {
this.conditionWidth = '196px'
this.showCondition = true
}, },
handleColor(e) { template: value.template,
if (e.column.property === 'F010N' && e.row.F010N > 0) { computed: {
return 'color: red' current() {
} else if (e.column.property === 'F010N' && e.row.F010N < 0) { return (this.currentPage - 1) * this.psize
return 'color: green'
}
if (e.column.property === 'SECNAME') {
return 'text-decoration: underline; cursor: pointer'
} }
}, },
changeSort(e) { mounted() {
if (e.order === null) { this.getIndustryData()
this.sort = [{ this.getPositionData()
'FieldName': 'TRADEDATE', // 新的请求
'State': 2
}]
} else if (e.order === 'ascending') {
this.sort = [{
'FieldName': 'TRADEDATE',
'State': 2
}, {
'FieldName': 'F010N',
'State': 1
}]
} else if (e.order === 'descending') {
this.sort = [{
'FieldName': 'TRADEDATE',
'State': 2
}, {
'FieldName': 'F010N',
'State': 2
}]
}
this.getStockList() this.getStockList()
this.$nextTick(
function () {
this.changeTabs(0)
}
)
}, },
//处理whereOr methods: {
handleArray(array, fieldName, newFieldName) { changeTabs(index) {
var newArray = [] this.isShowTab = index
array.map((item) => { var length = this.tabTitle[index].length * 13
var newObj = item var tab = document.getElementById('tab' + index).offsetLeft
newObj[fieldName] = newFieldName + '.' + newObj[fieldName].split('.')[0] var width = document.getElementById('tab' + index).offsetWidth
newArray.push(newObj) var move = (width - length) / 2
}) this.moveWidth = length + 'px'
return newArray this.moveLeft = tab + move + 'px'
}, },
getStockList() { goToCompanyIndex(name, code) {
var that = this // 前往公司Kline
that.showTable = false var params = {
console.log(that.whereOr) id: 'kilne' + code,
http.netPost('Data/Stock/GetHsData', { name: name + 'k线图',
'CollectionName': 'hs_stock_history_market', src: './kline.html?id=' + code + '&name=' + name
'Where': [ }
ipcRenderer.send('openPage', params)
},
hideSearch() {
this.conditionWidth = '16px'
this.showCondition = false
},
showSearch() {
this.conditionWidth = '196px'
this.showCondition = true
},
handleColor(e) {
if (e.column.property === 'F010N' && e.row.F010N > 0) {
return 'color: red'
} else if (e.column.property === 'F010N' && e.row.F010N < 0) {
return 'color: green'
}
if (e.column.property === 'SECNAME') {
return 'text-decoration: underline; cursor: pointer'
}
},
changeSort(e) {
if (e.order === null) {
this.sort = [{
'FieldName': 'TRADEDATE',
'State': 2
}]
} else if (e.order === 'ascending') {
this.sort = [{
'FieldName': 'TRADEDATE',
'State': 2
}, {
'FieldName': 'F010N',
'State': 1
}]
} else if (e.order === 'descending') {
this.sort = [{
'FieldName': 'TRADEDATE',
'State': 2
}, {
'FieldName': 'F010N',
'State': 2
}]
}
this.getStockList()
},
//处理whereOr
handleArray(array, fieldName, newFieldName) {
var newArray = []
array.map((item) => {
var newObj = item
newObj[fieldName] = newFieldName + '.' + newObj[fieldName].split('.')[0]
newArray.push(newObj)
})
return newArray
},
getStockList() {
var that = this
that.showTable = false
console.log(that.whereOr)
http.netPost('Data/Stock/GetHsData', {
'CollectionName': 'hs_stock_history_market',
'Where': [
{
'FieldName': 'hs_stock_history_market.TRADEDATE',
'State': 1,
'Value': that.choosedDate
}
],
'WhereOr': that.handleArray(that.whereOr, 'FieldName', 'hs_stock_history_market'),
'Sort': that.sort,
'Current': (that.currentPage - 1) * that.psize,
'Psize': that.psize
})
.then((res) => {
console.log(res)
that.total = res.data.Data.Total
that.showTable = true
that.tableData = res.data.Data.Records
console.log(that.tableData)
})
},
changeDate() {
this.getStockList()
},
marketNodeClick(e) {
console.log(e)
this.getMarketCompany(e.code)
},
// 获取行业信息
getIndustryData() {
var that = this
that.showTable = false
var Where = []
var WhereOr = [
{ {
'FieldName': 'hs_stock_history_market.TRADEDATE', 'FieldName': 'F003V',
'State': 1, 'State': 2,
'Value': that.choosedDate 'Value': '008001'
},
{
'FieldName': 'F003V',
'State': 2,
'Value': '008003'
}
]
http.netPost('Data/Data/GetData', {
"DBName": "bfstock_public",
'condition': {
'CollectionName': 'hs_industry_category',
'Where': Where,
'WhereOr': WhereOr,
'Current': 0,
'Psize': 9999
} }
],
'WhereOr': that.handleArray(that.whereOr, 'FieldName', 'hs_stock_history_market'),
'Sort': that.sort,
'Current': (that.currentPage - 1) * that.psize,
'Psize': that.psize
})
.then((res) => {
that.total = res.data.Data.Total
that.showTable = true
that.tableData = res.data.Data.Records
}) })
}, .then((res) => {
changeDate() { that.industryData = JSON.parse(JSON.stringify(that.toTree(res.data.Data.Records)))
this.getStockList() console.log(that.industryData)
}, })
marketNodeClick(e) { },
console.log(e) // 递归行业数据
this.getMarketCompany(e.code) toTree(data) {
}, var map = {}
// 获取行业信息 data.forEach(function (item) {
getIndustryData() { map[item.SORTCODE] = item
var that = this item.level = 0
that.showTable = false })
var Where = [] console.log(map)
var WhereOr = [ var val = []
{ data.forEach(function (item) {
'FieldName': 'F003V', // 以当前遍历项的pid,去map对象中找到索引的id
'State': 2, item.label = item.SORTNAME
'Value': '008001' var parent = map[item.PARENTCODE]
}, // console.log(map[item.PARENTCODE])
{ // 如果找到索引,那么说明此项不在顶级当中,那么需要把此项添加到,他对应的父级中
'FieldName': 'F003V', if (parent) {
'State': 2, (parent.children || (parent.children = [])).push(item)
'Value': '008003' } else {
// 如果没有在map中找到对应的索引ID,那么直接把 当前的item添加到 val结果集中,作为顶级
console.log('val')
val.push(item)
}
})
return val
},
// 获取行业公司
getIndustryCompany(level, query) {
var that = this
var code = ''
that.selectLoading = true
if (level === 1) {
code = 'F009V'
} else if (level === 2) {
code = 'F010V'
} else if (level === 3) {
code = 'F011V'
} else if (level === 4) {
code = 'F012V'
} else if (level === 5) {
code = 'F013V'
} }
] http.netPost('Data/Stock/GetHsData', {
http.netPost('Data/Data/GetData', { 'CollectionName': 'hs_stock_plate',
"DBName": "bfstock_public", 'Where': [
'condition': { {
'CollectionName': 'hs_industry_category', 'FieldName': code,
'Where': Where, 'State': 1,
'WhereOr': WhereOr, 'Value': query
}
],
'Current': 0, 'Current': 0,
'Psize': 9999 'Psize': 9999
}
})
.then((res) => {
that.industryData = JSON.parse(JSON.stringify(that.toTree(res.data.Data.Records)))
console.log(that.industryData)
}) })
}, .then((res) => {
// 递归行业数据 var newArray = []
toTree(data) { res.data.Data.Records.forEach((item) => {
var map = {} newArray.push(
data.forEach(function (item) { {
map[item.SORTCODE] = item 'FieldName': 'SECCODE',
item.level = 0 'State': 2,
}) 'Value': item.SECCODE
console.log(map) }
var val = [] )
data.forEach(function (item) { })
// 以当前遍历项的pid,去map对象中找到索引的id console.log(newArray)
item.label = item.SORTNAME that.whereOr = newArray
var parent = map[item.PARENTCODE] that.whereOrArrayAnd = []
// console.log(map[item.PARENTCODE]) that.getStockList()
// 如果找到索引,那么说明此项不在顶级当中,那么需要把此项添加到,他对应的父级中
if (parent) {
(parent.children || (parent.children = [])).push(item)
} else {
// 如果没有在map中找到对应的索引ID,那么直接把 当前的item添加到 val结果集中,作为顶级
console.log('val')
val.push(item)
}
})
return val
},
// 获取行业公司
getIndustryCompany(level, query) {
var that = this
var code = ''
that.selectLoading = true
if (level === 1) {
code = 'F009V'
} else if (level === 2) {
code = 'F010V'
} else if (level === 3) {
code = 'F011V'
} else if (level === 4) {
code = 'F012V'
} else if (level === 5) {
code = 'F013V'
}
http.netPost('Data/Stock/GetHsData', {
'CollectionName': 'hs_stock_plate',
'Where': [
{
'FieldName': code,
'State': 1,
'Value': query
}
],
'Current': 0,
'Psize': 9999
})
.then((res) => {
var newArray = []
res.data.Data.Records.forEach((item) => {
newArray.push(
{
'FieldName': 'SECCODE',
'State': 2,
'Value': item.SECCODE
}
)
}) })
console.log(newArray) },
that.whereOr = newArray industryNodeClick(a, b) {
that.whereOrArrayAnd = [] this.getIndustryCompany(b.level, a.SORTCODE)
that.getStockList() },
// 获取地域信息
getPositionData() {
var that = this
that.showTable = false
var Where = []
http.netPost('Data/Stock/GetHsData', {
'CollectionName': 'hs_district_category',
'Where': Where,
'Current': 0,
'Psize': 9999
}) })
}, .then((res) => {
industryNodeClick(a, b) { // that.positionData = JSON.parse(JSON.stringify(that.toTree(res.data.Data.Records)))
this.getIndustryCompany(b.level, a.SORTCODE) var newArray = []
}, for (var i = 0; i < res.data.Data.Records.length; i++) {
// 获取地域信息 res.data.Data.Records[i].label = res.data.Data.Records[i].SORTNAME
getPositionData() { if (res.data.Data.Records[i].PARENTCODE === '0') {
var that = this newArray.push(res.data.Data.Records[i])
that.showTable = false }
var Where = []
http.netPost('Data/Stock/GetHsData', {
'CollectionName': 'hs_district_category',
'Where': Where,
'Current': 0,
'Psize': 9999
})
.then((res) => {
// that.positionData = JSON.parse(JSON.stringify(that.toTree(res.data.Data.Records)))
var newArray = []
for (var i = 0; i < res.data.Data.Records.length; i++) {
res.data.Data.Records[i].label = res.data.Data.Records[i].SORTNAME
if (res.data.Data.Records[i].PARENTCODE === '0') {
newArray.push(res.data.Data.Records[i])
} }
} for (var x = 0; x < newArray.length; x++) {
for (var x = 0; x < newArray.length; x++) { newArray[x].children = []
newArray[x].children = [] for (var y = 0; y < res.data.Data.Records.length; y++) {
for (var y = 0; y < res.data.Data.Records.length; y++) { if (res.data.Data.Records[y].PARENTCODE === newArray[x].SORTCODE && res.data.Data.Records[y].SORTNAME !== '') {
if (res.data.Data.Records[y].PARENTCODE === newArray[x].SORTCODE && res.data.Data.Records[y].SORTNAME !== '') { var newCode = res.data.Data.Records[y].SORTCODE
var newCode = res.data.Data.Records[y].SORTCODE res.data.Data.Records[y].SORTCODE = []
res.data.Data.Records[y].SORTCODE = [] res.data.Data.Records[y].SORTCODE.push(newCode)
res.data.Data.Records[y].SORTCODE.push(newCode) newArray[x].children.push(res.data.Data.Records[y])
newArray[x].children.push(res.data.Data.Records[y]) } else if (res.data.Data.Records[y].PARENTCODE === newArray[x].SORTCODE && res.data.Data.Records[y].SORTNAME === '') {
} else if (res.data.Data.Records[y].PARENTCODE === newArray[x].SORTCODE && res.data.Data.Records[y].SORTNAME === '') { newArray[x].children[0].SORTCODE.push(res.data.Data.Records[y].SORTCODE)
newArray[x].children[0].SORTCODE.push(res.data.Data.Records[y].SORTCODE) }
} }
} }
that.positionData = newArray
})
},
// 获取地域公司
getPositionCompany(query, level) {
var that = this
var whereOr = []
var where = []
if (level === 2) {
for (var i = 0; i < query.length; i++) {
whereOr.push(
{
'FieldName': 'F010V',
'State': 2,
'Value': query[i]
}
)
} }
that.positionData = newArray } else if (level === 1) {
})
},
// 获取地域公司
getPositionCompany(query, level) {
var that = this
var whereOr = []
var where = []
if (level === 2) {
for (var i = 0; i < query.length; i++) {
whereOr.push( whereOr.push(
{ {
'FieldName': 'F010V', 'FieldName': 'F009V',
'State': 2, 'State': 2,
'Value': query[i] 'Value': query
} }
) )
} }
} else if (level === 1) { where.push({
whereOr.push( 'FieldName': 'F003V',
{ 'State': 1,
'FieldName': 'F009V', 'Value': 137006
'State': 2, })
'Value': query http.netPost('Data/Stock/GetHsData', {
} 'CollectionName': 'hs_stock_plate',
) 'Where': where,
} 'WhereOr': whereOr,
where.push({ 'AGGField': [
'FieldName': 'F003V', {
'State': 1, 'FieldName': 'SECCODE',
'Value': 137006 'State': 0,
}) 'ValState': 0
http.netPost('Data/Stock/GetHsData', { }
'CollectionName': 'hs_stock_plate', ],
'Where': where, 'GPBField': [
'WhereOr': whereOr, 'SECCODE'
'AGGField': [ ],
{ 'Current': 0,
'FieldName': 'SECCODE', 'Psize': 9999
'State': 0, })
'ValState': 0 .then((res) => {
} var newArray = []
], if (res.data.Data.Records.length === 0) {
'GPBField': [
'SECCODE'
],
'Current': 0,
'Psize': 9999
})
.then((res) => {
var newArray = []
if (res.data.Data.Records.length === 0) {
newArray.push(
{
'FieldName': 'SECCODE',
'State': 1,
'Value': ''
}
)
} else {
res.data.Data.Records.forEach((item) => {
newArray.push( newArray.push(
{ {
'FieldName': 'SECCODE', 'FieldName': 'SECCODE',
'State': 2, 'State': 1,
'Value': item.SECCODE 'Value': ''
} }
) )
}) } else {
} res.data.Data.Records.forEach((item) => {
that.whereOr = newArray newArray.push(
console.log(that.whereOr) {
that.whereOrArrayAnd = [] 'FieldName': 'SECCODE',
that.getStockList() 'State': 2,
}) 'Value': item.SECCODE
}, }
positionNodeClick(a, b) { )
this.getPositionCompany(a.SORTCODE, b.level) })
}, }
handleSizeChange(e) { that.whereOr = newArray
this.psize = e console.log(that.whereOr)
this.getStockList() that.whereOrArrayAnd = []
}, that.getStockList()
handleCurrentChange(e) { })
this.currentPage = e },
this.getStockList() positionNodeClick(a, b) {
this.getPositionCompany(a.SORTCODE, b.level)
},
handleSizeChange(e) {
this.psize = e
this.getStockList()
},
handleCurrentChange(e) {
this.currentPage = e
this.getStockList()
}
} }
} }
} }
\ No newline at end of file
// const { app } = require('electron').remote
// const path = app.getAppPath()
// const { main } = require(path + '/src/views/main_views/stockMarket/routers/main/main.js')
// const routes = [
// { path: '/', component: main }
// ]
// module.exports = {
// routes: routes
// }
class routers { class routers {
constructor() {} constructor() {}
getRouters() { getRouters(component) {
return [ return [
{ path: '/', component: 'main' } { path: '/', component: component }
] ]
} }
} }
......
<!DOCTYPE html> <!DOCTYPE html>
<html> <html>
<head> <head>
<meta charset="UTF-8"> <meta charset="UTF-8">
...@@ -9,49 +10,63 @@ ...@@ -9,49 +10,63 @@
<link rel="stylesheet" href="./stockMarket.css"> <link rel="stylesheet" href="./stockMarket.css">
</head> </head>
<body> <body>
<div id="app" class="report-page-container"> <div id="app" class="report-page-container">
<router-view></router-view> <router-view></router-view>
</div> </div>
</body> </body>
<script src="../../../static/vue/vue.min.js"></script> <script>
<script src="../../../static/element/index.js"></script> const { app } = require('electron').remote
<script src="../../../static/vue-router/vue-router.js"></script> const { ipcRenderer } = require('electron')
<script src='../../../static/xlsx/xlsx.full.min.js'></script> window.global.urls = require(app.getAppPath() + '/build_config/url')
<script src="../../../static/plTable/index.js"></script> </script>
<script src="./routers/router.js"></script> <script src="../../../static/vue/vue.min.js"></script>
<script src="../../../static/element/index.js"></script>
<script src="../../../static/vue-router/vue-router.js"></script>
<script src='../../../static/xlsx/xlsx.full.min.js'></script>
<script src="../../../static/plTable/index.js"></script>
<script src="../../../assist/loadVue.js"></script>
<script src="./routers/main/main.js"></script>
<script src="./routers/router.js"></script>
<script src="../../../assist/axios.js"></script>
<script> <script src="../../../assist/dictionary.js"></script>
const { app } = require('electron').remote
const path = app.getAppPath() <script>
var http = newHttp()
// const { routes } = require('./routers/router.js') var info = JSON.parse(localStorage.getItem('userInfo'))
const routes = new routers().getRouters()
console.log(routes) const { splitPane } = require('vue-splitpane')
Vue.component('split-pane', splitPane)
const router = new VueRouter({ routes }) async function init() {
const http = require(path + '/src/assist/axios.js')
var info = JSON.parse(localStorage.getItem('userInfo')) var component = await getMain()
const { splitPane } = require('vue-splitpane') var routes = new routers().getRouters(component)
Vue.component('split-pane', splitPane) var router = new VueRouter({ routes })
new Vue({ new Vue({
router, router,
el: '#app', el: '#app',
data: function() { data: function () {
return { return {
} }
}, },
mounted () { mounted() {
}, },
methods: { methods: {
} }
}) })
</script> }
init()
</script>
</html> </html>
\ No newline at end of file
This source diff could not be displayed because it is too large. You can view the blob instead.
const { app } = require('electron').remote class routers {
const path = app.getAppPath() constructor() {}
const { main } = require(path + '/src/views/main_views/szxData/routers/main/main.js') getRouters(component) {
return [
{ path: '/', component: component }
]
}
}
const routes = [
{ path: '/', component: main }
]
module.exports = {
routes: routes
}
\ No newline at end of file
<!DOCTYPE html> <!DOCTYPE html>
<html> <html>
<head> <head>
<meta charset="UTF-8"> <meta charset="UTF-8">
...@@ -9,40 +10,60 @@ ...@@ -9,40 +10,60 @@
<link rel="stylesheet" href="./szxData.css"> <link rel="stylesheet" href="./szxData.css">
</head> </head>
<body> <body>
<div id="app"> <div id="app">
<router-view></router-view> <router-view></router-view>
</div> </div>
</body> </body>
<script src="../../../static/vue/vue.min.js"></script> <script>
<script src="../../../static/element/index.js"></script> const { app } = require('electron').remote
<script src="../../../static/vue-router/vue-router.js"></script> const { ipcRenderer } = require('electron')
<script src='../../../static/xlsx/xlsx.full.min.js'></script> window.global.urls = require(app.getAppPath() + '/build_config/url')
<script src="../../../static/plTable/index.js"></script> </script>
<script> <script src="../../../static/vue/vue.min.js"></script>
const { app } = require('electron').remote <script src="../../../static/element/index.js"></script>
const path = app.getAppPath() <script src="../../../static/vue-router/vue-router.js"></script>
const { routes } = require(path + '/src/views/main_views/szxData/routers/router.js') <script src='../../../static/xlsx/xlsx.full.min.js'></script>
const router = new VueRouter({ routes }) <script src="../../../static/plTable/index.js"></script>
const http = require(path + '/src/assist/axios.js')
var info = JSON.parse(localStorage.getItem('userInfo')) <script src="../../../assist/loadVue.js"></script>
const { splitPane } = require('vue-splitpane') <script src="./routers/main/main.js"></script>
Vue.component('split-pane', splitPane) <script src="./routers/router.js"></script>
<script src="../../../assist/axios.js"></script>
<script>
var http = newHttp()
var info = JSON.parse(localStorage.getItem('userInfo'))
const { splitPane } = require('vue-splitpane')
Vue.component('split-pane', splitPane)
async function init() {
var component = await getMain()
var routes = new routers().getRouters(component)
var router = new VueRouter({ routes })
new Vue({ new Vue({
router, router,
el: '#app', el: '#app',
data: function() { data: function () {
return { return {
} }
}, },
mounted () { mounted() {
}, },
methods: { methods: {
} }
}) })
</script> }
init()
</script>
</html> </html>
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment