Commit a752cff5 by Tippi.Rao

源码更新

parent 65f48332
<template> <template>
<div id="app"> <div id="app">
<router-view /> <router-view />
<plugin-com v-show="false" ref="de-theme" component-name="ThemeSetting" /> <plugin-com
v-show="false"
ref="de-theme"
component-name="ThemeSetting"
/>
<el-dialog <el-dialog
v-if="$route.path !== '/login'" v-if="$route.path !== '/login'"
:visible.sync="showPasswordModifiedDialog" :visible.sync="showPasswordModifiedDialog"
...@@ -15,36 +19,36 @@ ...@@ -15,36 +19,36 @@
</template> </template>
<script> <script>
import PluginCom from "@/views/system/plugin/PluginCom"; import PluginCom from '@/views/system/plugin/PluginCom'
import { mapState } from "vuex"; import { mapState } from 'vuex'
import PasswordUpdateForm from "@/views/system/user/PasswordUpdateForm.vue"; import PasswordUpdateForm from '@/views/system/user/PasswordUpdateForm.vue'
export default { export default {
name: "App", name: 'App',
components: { PluginCom, PasswordUpdateForm }, components: { PluginCom, PasswordUpdateForm },
computed: { computed: {
...mapState("user", ["passwordModified"]), ...mapState('user', [
'passwordModified',
])
}, },
data() { data() {
return { return {
showPasswordModifiedDialog: false, showPasswordModifiedDialog: false
}; }
}, },
mounted() { mounted() {
const passwordModified = JSON.parse( const passwordModified = JSON.parse(localStorage.getItem('passwordModified'))
localStorage.getItem("passwordModified") if (typeof passwordModified === 'boolean') {
); this.$store.commit('user/SET_PASSWORD_MODIFIED', passwordModified)
if (typeof passwordModified === "boolean") {
this.$store.commit("user/SET_PASSWORD_MODIFIED", passwordModified);
} }
}, },
watch: { watch: {
passwordModified: { passwordModified: {
handler(val) { handler(val) {
this.showPasswordModifiedDialog = !val; this.showPasswordModifiedDialog = !val
}, },
immediate: true, immediate: true
}, }
}, }
}; }
</script> </script>
...@@ -3,6 +3,8 @@ ...@@ -3,6 +3,8 @@
:is="mode" :is="mode"
:ref="refId" :ref="refId"
:obj="obj" :obj="obj"
:bus="bus"
:axios-request="request"
v-bind="$attrs" v-bind="$attrs"
v-on="$listeners" v-on="$listeners"
/> />
...@@ -11,6 +13,9 @@ ...@@ -11,6 +13,9 @@
<script> <script>
import { uuid } from 'vue-uuid' import { uuid } from 'vue-uuid'
import { get } from '@/api/system/dynamic' import { get } from '@/api/system/dynamic'
import bus from '@/utils/bus'
import request from '@/utils/request'
export default { export default {
name: 'AsyncComponent', name: 'AsyncComponent',
inheritAttrs: true, inheritAttrs: true,
...@@ -29,7 +34,9 @@ export default { ...@@ -29,7 +34,9 @@ export default {
return { return {
resData: '', resData: '',
mode: '', mode: '',
refId: null refId: null,
bus: bus,
request: request
} }
}, },
watch: { watch: {
...@@ -47,15 +54,13 @@ export default { ...@@ -47,15 +54,13 @@ export default {
// window.SyncComponentCache[this.url] = Axios.get(this.url) // window.SyncComponentCache[this.url] = Axios.get(this.url)
res = await window.SyncComponentCache[this.url] res = await window.SyncComponentCache[this.url]
} else { } else {
this.mode = await window.SyncComponentCache[this.url] res = await window.SyncComponentCache[this.url]
return
} }
if (res) { if (res) {
const Fn = Function const Fn = Function
const dynamicCode = res.data || res const dynamicCode = res.data || res
const component = new Fn(`return ${dynamicCode}`)() const component = new Fn(`return ${dynamicCode}`)()
this.mode = component.default || component this.mode = component.default || component
window.SyncComponentCache[this.url] = this.mode
} }
} }
} }
......
...@@ -82,10 +82,10 @@ ...@@ -82,10 +82,10 @@
/> />
</span> </span>
<span :title="$t('route.exportExcel')"> <span :title="$t('route.exportExcel')">
<svg-icon <i
v-if="exportExcelShow" v-if="exportExcelShow"
style="color: white" style="line-height: 24px"
icon-class="file-excel" class="el-icon-document-delete"
@click.stop="exportExcelDownload()" @click.stop="exportExcelDownload()"
/> />
</span> </span>
...@@ -469,7 +469,7 @@ export default { ...@@ -469,7 +469,7 @@ export default {
this.$emit('showViewDetails', { openType: openType }) this.$emit('showViewDetails', { openType: openType })
}, },
exportExcelDownload() { exportExcelDownload() {
exportExcelDownload(this.chart, null, null, null, null, null) exportExcelDownload(this.chart)
}, },
auxiliaryMatrixChange() { auxiliaryMatrixChange() {
if (this.curComponent.auxiliaryMatrix) { if (this.curComponent.auxiliaryMatrix) {
......
...@@ -171,23 +171,19 @@ export default { ...@@ -171,23 +171,19 @@ export default {
return this.targetLinkageInfo[this.curLinkageView.propValue.viewId] return this.targetLinkageInfo[this.curLinkageView.propValue.viewId]
}, },
...mapState([ ...mapState([
'menuTop',
'menuLeft',
'menuShow',
'curComponent',
'componentData',
'canvasStyleData',
'linkageSettingStatus',
'targetLinkageInfo', 'targetLinkageInfo',
'curLinkageView' 'curLinkageView'
]) ])
}, },
mounted() { mounted() {
const _this = this
// 初始化映射关系 如果当前是相同的数据集且没有关联关系,则自动补充映射关系 // 初始化映射关系 如果当前是相同的数据集且没有关联关系,则自动补充映射关系
checkSameDataSet(this.curLinkageView.propValue.viewId, this.element.propValue.viewId).then(res => { checkSameDataSet(this.curLinkageView.propValue.viewId, this.element.propValue.viewId).then(res => {
if (res.data === 'YES' && this.linkageInfo.linkageFields.length === 0) { if (res.data === 'YES' && this.linkageInfo.linkageFields.length === 0) {
this.sourceLinkageInfo.targetViewFields.forEach(item => { this.sourceLinkageInfo.targetViewFields.forEach(item => {
this.addLinkageField(item.id, item.id) _this.$nextTick(() => {
this.addLinkageField(item.id, item.id)
})
}) })
} }
}) })
......
...@@ -360,7 +360,7 @@ export default { ...@@ -360,7 +360,7 @@ export default {
computed: { computed: {
// 首次加载且非编辑状态新复制的视图,使用外部filter // 首次加载且非编辑状态新复制的视图,使用外部filter
initLoad() { initLoad() {
return !(this.isEdit && this.currentCanvasNewId.includes(this.element.id)) && this.isFirstLoad return !(this.isEdit && this.currentCanvasNewId.includes(this.element.id)) && this.isFirstLoad && this.canvasId === 'canvas-main'
}, },
scaleCoefficient() { scaleCoefficient() {
if (this.terminal === 'pc' && !this.mobileLayoutStatus) { if (this.terminal === 'pc' && !this.mobileLayoutStatus) {
......
...@@ -429,7 +429,10 @@ export function getCacheTree(treeName) { ...@@ -429,7 +429,10 @@ export function getCacheTree(treeName) {
} }
export function exportExcelDownload(chart, snapshot, width, height, loadingWrapper, callBack) { export function exportExcelDownload(chart, snapshot, width, height, loadingWrapper, callBack) {
if (!chart.data?.data?.length) { if (chart.render === 'antv' && !chart.data?.data?.length) {
return
}
if (chart.type === 'echarts' && !(chart.data?.series?.length && chart.data?.series[0].data?.length)) {
return return
} }
const fields = JSON.parse(JSON.stringify(chart.data.fields)) const fields = JSON.parse(JSON.stringify(chart.data.fields))
......
...@@ -6,7 +6,16 @@ ...@@ -6,7 +6,16 @@
class="item-axis" class="item-axis"
@close="removeItem" @close="removeItem"
> >
{{ item.name }} <el-tooltip
v-if="toolTip"
class="item"
effect="dark"
:content="toolTip || item.name"
placement="top"
>
<span>{{ item.name }}</span>
</el-tooltip>
<span v-else>{{ item.name }}</span>
</el-tag> </el-tag>
</span> </span>
</template> </template>
...@@ -22,6 +31,11 @@ export default { ...@@ -22,6 +31,11 @@ export default {
index: { index: {
type: Number, type: Number,
required: true required: true
},
toolTip: {
type: String,
required: false,
default: ''
} }
}, },
......
...@@ -410,7 +410,7 @@ export default { ...@@ -410,7 +410,7 @@ export default {
}, },
_filterFun(value, data, node) { _filterFun(value, data, node) {
if (!value) return true if (!value) return true
return data[this.propsLabel].indexOf(value) !== -1 return data[this.propsLabel?.toLocaleUpperCase()].indexOf(value.toLocaleUpperCase()) !== -1
}, },
_treeNodeClickFun(data, node, vm) { _treeNodeClickFun(data, node, vm) {
const { multiple } = this.selectParams const { multiple } = this.selectParams
......
...@@ -121,7 +121,7 @@ export default { ...@@ -121,7 +121,7 @@ export default {
}, },
keyWord(val, old) { keyWord(val, old) {
if (val === old) return if (val === old) return
const results = val ? this.list.filter(item => item.text.includes(val)) : null const results = val ? this.vagueFilter(val, this.list) : null
this.resetList(results) this.resetList(results)
this.reCacularHeight() this.reCacularHeight()
this.$nextTick(() => { this.$nextTick(() => {
...@@ -136,6 +136,11 @@ export default { ...@@ -136,6 +136,11 @@ export default {
}) })
}, },
methods: { methods: {
vagueFilter(val, nodes) {
if (!val || !val.trim()) return nodes
const results = nodes.filter(item => item.text?.toLocaleUpperCase().includes(val.toLocaleUpperCase()))
return results
},
resetSelectAll() { resetSelectAll() {
this.selectAll = false this.selectAll = false
}, },
...@@ -148,7 +153,7 @@ export default { ...@@ -148,7 +153,7 @@ export default {
selectAllChange(val) { selectAllChange(val) {
let vals = val ? [...this.list.map(ele => ele.id)] : [] let vals = val ? [...this.list.map(ele => ele.id)] : []
if (this.keyWord.trim() && val) { if (this.keyWord.trim() && val) {
vals = this.list.filter(item => item.text.includes(this.keyWord.trim())).map(ele => ele.id) vals = this.vagueFilter(this.keyWord.trim(), this.list).map(ele => ele.id)
} }
this.visualChange(vals) this.visualChange(vals)
this.selectValue = vals this.selectValue = vals
...@@ -233,14 +238,14 @@ export default { ...@@ -233,14 +238,14 @@ export default {
isAllSelect() { isAllSelect() {
let vals = this.list.length let vals = this.list.length
if (this.keyWord.trim()) { if (this.keyWord.trim()) {
vals = this.list.filter(item => item.text.includes(this.keyWord.trim())).map(ele => ele.id).filter(ele => this.selectValue.includes(ele)).length vals = this.vagueFilter(this.keyWord.trim(), this.list).map(ele => ele.id).filter(ele => this.selectValue.includes(ele)).length
} }
return vals return vals
}, },
halfSelect() { halfSelect() {
let vals = this.list.length let vals = this.list.length
if (this.keyWord.trim()) { if (this.keyWord.trim()) {
vals = this.list.filter(item => item.text.includes(this.keyWord.trim())).map(ele => ele.id).length vals = this.vagueFilter(this.keyWord.trim(), this.list).map(ele => ele.id).length
} }
return vals return vals
}, },
......
...@@ -31,7 +31,7 @@ ...@@ -31,7 +31,7 @@
v-model="value" v-model="value"
@change="handleCheckedChange" @change="handleCheckedChange"
> >
<template v-for="item in data.filter(node => !keyWord || (node.id && node.id.includes(keyWord)))"> <template v-for="item in data.filter(node => !keyWord || (node.id && node.id.toLocaleUpperCase().includes(keyWord.toLocaleUpperCase())))">
<el-checkbox <el-checkbox
:key="item.id" :key="item.id"
:label="item.id" :label="item.id"
...@@ -51,7 +51,7 @@ ...@@ -51,7 +51,7 @@
@change="changeRadioBox" @change="changeRadioBox"
> >
<el-radio <el-radio
v-for="(item, index) in data.filter(node => !keyWord || (node.id && node.id.includes(keyWord)))" v-for="(item, index) in data.filter(node => !keyWord || (node.id && node.id.toLocaleUpperCase().includes(keyWord.toLocaleUpperCase())))"
:key="index" :key="index"
:label="item.id" :label="item.id"
@click.native.prevent="testChange(item)" @click.native.prevent="testChange(item)"
......
...@@ -381,7 +381,7 @@ export default { ...@@ -381,7 +381,7 @@ export default {
_filterFun(value, data, node) { _filterFun(value, data, node) {
if (!value) return true if (!value) return true
return data.id.toString().indexOf(value.toString()) !== -1 return data.id.toString().toLocaleUpperCase().indexOf(value.toString().toLocaleUpperCase()) !== -1
}, },
// 树点击 // 树点击
_nodeClickFun(data, node, vm) { _nodeClickFun(data, node, vm) {
......
...@@ -626,7 +626,8 @@ export default { ...@@ -626,7 +626,8 @@ export default {
status: 'Authorization status', status: 'Authorization status',
valid: 'Valid', valid: 'Valid',
invalid: 'Invalid', invalid: 'Invalid',
expired: 'Expired' expired: 'Expired',
expired_msg: 'license has expired since {0}. It is recommended to update the license, which does not affect the use of enterprise version functions'
}, },
member: { member: {
create: 'Add members', create: 'Add members',
......
...@@ -626,7 +626,8 @@ export default { ...@@ -626,7 +626,8 @@ export default {
status: '授權狀態', status: '授權狀態',
valid: '有效', valid: '有效',
invalid: '無效', invalid: '無效',
expired: '已過期' expired: '已過期',
expired_msg: 'License已過期,過期時間:{0},為了不影響企業版功能的使用,建議您更新License'
}, },
member: { member: {
create: '添加成員', create: '添加成員',
......
...@@ -625,7 +625,8 @@ export default { ...@@ -625,7 +625,8 @@ export default {
status: '授权状态', status: '授权状态',
valid: '有效', valid: '有效',
invalid: '无效', invalid: '无效',
expired: '已过期' expired: '已过期',
expired_msg: 'License已过期,过期时间:{0},为了不影响企业版功能的使用,建议您更新License'
}, },
member: { member: {
create: '添加成员', create: '添加成员',
...@@ -1938,7 +1939,7 @@ export default { ...@@ -1938,7 +1939,7 @@ export default {
jsonpath_info: '请填入JsonPath', jsonpath_info: '请填入JsonPath',
req_param: '请求参数', req_param: '请求参数',
headers: '请求头', headers: '请求头',
query_param: "QUERY參數", query_param: "QUERY参数",
query_info: "地址栏中跟在?后面的参数,如: updateapi?id=112", query_info: "地址栏中跟在?后面的参数,如: updateapi?id=112",
key: '键', key: '键',
value: '值', value: '值',
......
<template> <template>
<div <div
v-if="!licValidate && licStatus !== 'no_record'" v-if="!licValidate && licStatus !== 'no_record' && !tipClosed"
class="lic" class="lic_tips"
> >
<strong>{{ $t(licMsg) }}</strong> <el-alert
class="lic_alert"
:title="$t(licMsg)"
type="warning"
show-icon
center
@close="closeTip"
/>
</div> </div>
</template> </template>
...@@ -20,9 +29,7 @@ export default { ...@@ -20,9 +29,7 @@ export default {
} }
}, },
computed: { computed: {
/* theme() {
return this.$store.state.settings.theme
}, */
licValidate() { licValidate() {
return this.$store.state.lic.validate return this.$store.state.lic.validate
}, },
...@@ -30,40 +37,40 @@ export default { ...@@ -30,40 +37,40 @@ export default {
return this.$store.state.lic.licStatus || '' return this.$store.state.lic.licStatus || ''
}, },
licMsg() { licMsg() {
if (this.$store.state.lic?.licMsg?.includes('expired')) {
const message = this.$store.state.lic.licMsg
const exp = message.substring(message.indexOf('since ') + 6, message.indexOf(','))
return this.$t('license.expired_msg').replace('{0}', exp)
}
return this.$store.state.lic.licMsg ? ('license.' + this.$store.state.lic.licMsg) : null return this.$store.state.lic.licMsg ? ('license.' + this.$store.state.lic.licMsg) : null
},
tipClosed() {
return localStorage.getItem('lic_closed')
} }
}, },
mounted() { mounted() {
// this.validate()
}, },
methods: { methods: {
// validate() { closeTip() {
// validateLic().then(res => { localStorage.setItem('lic_closed', true)
// this.lic = true }
// this.$store.dispatch('lic/setValidate', true)
// }).catch((e) => {
// this.msg = e.response.data.message
// this.lic = false
// this.$store.dispatch('lic/setValidate', false)
// })
// }
} }
} }
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>
.lic_tips {
.lic { position: absolute;
height: 24px; z-index: 2000;
background-color: #c92100; position:absolute;
color: #fff; top: 0;left:0;right:0;
text-align: center; margin: auto;
/* padding: 6px 11px; */ }
position: fixed; .lic_alert ::v-deep .el-icon-close{
z-index: 1002; top: 16px !important;
top: 0; right: 10px !important;
width: 100%; }
}
</style> </style>
...@@ -281,7 +281,7 @@ export default { ...@@ -281,7 +281,7 @@ export default {
unloadHandler(e) { unloadHandler(e) {
this.gap_time = new Date().getTime() - this.beforeUnload_time this.gap_time = new Date().getTime() - this.beforeUnload_time
if (this.gap_time <= 5) { if (this.gap_time <= 5) {
this.logout().then(res => {}) // this.logout().then(res => {})
} }
}, },
......
import Vue from "vue"; import Vue from 'vue'
import Cookies from "js-cookie"; import Cookies from 'js-cookie'
import "@/styles/index.scss"; // global css import '@/styles/index.scss' // global css
import ElementUI from "element-ui"; import ElementUI from 'element-ui'
import Vuetify from "vuetify"; import Vuetify from 'vuetify'
import Fit2CloudUI from "fit2cloud-ui"; import Fit2CloudUI from 'fit2cloud-ui'
import i18n from "./lang"; // internationalization import i18n from './lang' // internationalization
import App from "./App"; import App from './App'
import store from "./store"; import store from './store'
import router from "./router"; import router from './router'
import message from "./utils/message"; import message from './utils/message'
import "@/icons"; // icon import '@/icons' // icon
import "@/permission"; // permission control import '@/permission' // permission control
import api from "@/api/index.js"; import api from '@/api/index.js'
import filter from "@/filter/filter"; import filter from '@/filter/filter'
import directives from "./directive"; import directives from './directive'
import VueClipboard from "vue-clipboard2"; import VueClipboard from 'vue-clipboard2'
import widgets from "@/components/widget"; import widgets from '@/components/widget'
import Treeselect from "@riophae/vue-treeselect"; import Treeselect from '@riophae/vue-treeselect'
import "@riophae/vue-treeselect/dist/vue-treeselect.css"; import '@riophae/vue-treeselect/dist/vue-treeselect.css'
import "./utils/dialog"; import './utils/dialog'
import DeComplexInput from "@/components/business/conditionTable/DeComplexInput"; import DeComplexInput from '@/components/business/conditionTable/DeComplexInput'
import DeComplexSelect from "@/components/business/conditionTable/DeComplexSelect"; import DeComplexSelect from '@/components/business/conditionTable/DeComplexSelect'
import DeViewSelect from "@/components/deViewSelect"; import DeViewSelect from '@/components/deViewSelect'
import RemarkEditor from "@/views/chart/components/componentStyle/dialog/RemarkEditor"; import RemarkEditor from '@/views/chart/components/componentStyle/dialog/RemarkEditor'
import TitleRemark from "@/views/chart/view/TitleRemark"; import TitleRemark from '@/views/chart/view/TitleRemark'
import "@/components/canvas/customComponent"; // 注册自定义组件 import '@/components/canvas/customComponent' // 注册自定义组件
import deBtn from "@/components/deCustomCm/DeBtn.vue"; import deBtn from '@/components/deCustomCm/DeBtn.vue'
import "@/utils/DateUtil"; import '@/utils/DateUtil'
import draggable from "vuedraggable"; import draggable from 'vuedraggable'
import deWebsocket from "@/websocket"; import deWebsocket from '@/websocket'
import { GaodeMap } from "@antv/l7-maps"; import { GaodeMap } from '@antv/l7-maps'
import * as echarts from "echarts"; import * as echarts from 'echarts'
import UmyUi from "umy-ui"; import UmyUi from 'umy-ui'
// 全屏插件 // 全屏插件
import fullscreen from "vue-fullscreen"; import fullscreen from 'vue-fullscreen'
import VueFriendlyIframe from "vue-friendly-iframe"; import VueFriendlyIframe from 'vue-friendly-iframe'
import vueToPdf from "vue-to-pdf"; import vueToPdf from 'vue-to-pdf'
import VueVideoPlayer from "vue-video-player"; import VueVideoPlayer from 'vue-video-player'
import "video.js/dist/video-js.css"; import 'video.js/dist/video-js.css'
// 控制标签宽高成比例的指令 // 控制标签宽高成比例的指令
import proportion from "vue-proportion-directive"; import proportion from 'vue-proportion-directive'
import xss from "xss"; import xss from 'xss'
// 定义全局XSS解决方法 // 定义全局XSS解决方法
Object.defineProperty(Vue.prototype, "$xss", { Object.defineProperty(Vue.prototype, '$xss', {
value: xss, value: xss
}); })
Vue.config.productionTip = false; Vue.config.productionTip = false
Vue.use(VueClipboard); Vue.use(VueClipboard)
Vue.use(widgets); Vue.use(widgets)
Vue.component("Draggable", draggable); Vue.component('Draggable', draggable)
Vue.prototype.$api = api; Vue.prototype.$api = api
Vue.prototype.$echarts = echarts; Vue.prototype.$echarts = echarts
Vue.prototype.$gaodeMap = GaodeMap; Vue.prototype.$gaodeMap = GaodeMap
Vue.use(UmyUi); Vue.use(UmyUi)
Vue.use(fullscreen); Vue.use(fullscreen)
Vue.use(VueFriendlyIframe); Vue.use(VueFriendlyIframe)
Vue.use(Vuetify); Vue.use(Vuetify)
// import TEditor from '@/components/Tinymce/index.vue' // import TEditor from '@/components/Tinymce/index.vue'
// Vue.component('TEditor', TEditor) // Vue.component('TEditor', TEditor)
...@@ -75,83 +75,80 @@ Vue.use(Vuetify); ...@@ -75,83 +75,80 @@ Vue.use(Vuetify);
* Currently MockJs will be used in the production environment, * Currently MockJs will be used in the production environment,
* please remove it before going online ! ! ! * please remove it before going online ! ! !
*/ */
if (process.env.NODE_ENV === "production") { if (process.env.NODE_ENV === 'production') {
// const { mockXHR } = require('../mock') // const { mockXHR } = require('../mock')
// mockXHR() // mockXHR()
} }
// set ElementUI lang to EN // set ElementUI lang to EN
// Vue.use(ElementUI, { locale }) // Vue.use(ElementUI, { locale })
// 如果想要中文版 element-ui,按如下方式声明 // 如果想要中文版 element-ui,按如下方式声明
ElementUI.Dialog.props.closeOnClickModal.default = false; ElementUI.Dialog.props.closeOnClickModal.default = false
ElementUI.Dialog.props.closeOnPressEscape.default = false; ElementUI.Dialog.props.closeOnPressEscape.default = false
Vue.use(ElementUI, { Vue.use(ElementUI, {
size: Cookies.get("size") || "medium", // set element-ui default size size: Cookies.get('size') || 'medium', // set element-ui default size
i18n: (key, value) => i18n.t(key, value), i18n: (key, value) => i18n.t(key, value)
}); })
Vue.use(Fit2CloudUI, { Vue.use(Fit2CloudUI, {
i18n: (key, value) => i18n.t(key, value), i18n: (key, value) => i18n.t(key, value)
}); })
// Vue.use(VueAxios, axios) // Vue.use(VueAxios, axios)
Vue.use(filter); Vue.use(filter)
Vue.use(directives); Vue.use(directives)
Vue.use(message); Vue.use(message)
Vue.component("Treeselect", Treeselect); Vue.component('Treeselect', Treeselect)
Vue.component("DeComplexInput", DeComplexInput); Vue.component('DeComplexInput', DeComplexInput)
Vue.component("DeComplexSelect", DeComplexSelect); Vue.component('DeComplexSelect', DeComplexSelect)
Vue.component("DeViewSelect", DeViewSelect); Vue.component('DeViewSelect', DeViewSelect)
Vue.component("RemarkEditor", RemarkEditor); Vue.component('RemarkEditor', RemarkEditor)
Vue.component("TitleRemark", TitleRemark); Vue.component('TitleRemark', TitleRemark)
Vue.component("DeBtn", deBtn); Vue.component('DeBtn', deBtn)
Vue.config.productionTip = false; Vue.config.productionTip = false
Vue.use(vueToPdf); Vue.use(vueToPdf)
Vue.use(VueVideoPlayer); Vue.use(VueVideoPlayer)
Vue.use(proportion); Vue.use(proportion)
Vue.prototype.hasDataPermission = function (pTarget, pSource) { Vue.prototype.hasDataPermission = function(pTarget, pSource) {
if (this.$store.state.user.user.isAdmin || pSource === "ignore") { if (this.$store.state.user.user.isAdmin || pSource === 'ignore') {
return true; return true
} }
if (pSource && pTarget) { if (pSource && pTarget) {
return pSource.indexOf(pTarget) > -1; return pSource.indexOf(pTarget) > -1
} }
return false; return false
}; }
Vue.prototype.checkPermission = function (pers) { Vue.prototype.checkPermission = function(pers) {
const permissions = store.getters.permissions; const permissions = store.getters.permissions
const hasPermission = pers.every((needP) => { const hasPermission = pers.every(needP => {
const result = permissions.includes(needP); const result = permissions.includes(needP)
return result; return result
}); })
return hasPermission; return hasPermission
}; }
Vue.use(deWebsocket); Vue.use(deWebsocket)
Vue.prototype.$currentHttpRequestList = new Map(); Vue.prototype.$currentHttpRequestList = new Map()
Vue.prototype.$cancelRequest = function (cancelkey) { Vue.prototype.$cancelRequest = function(cancelkey) {
if (cancelkey) { if (cancelkey) {
if (cancelkey.indexOf("/**") > -1) { if (cancelkey.indexOf('/**') > -1) {
Vue.prototype.$currentHttpRequestList.forEach((item, key) => { Vue.prototype.$currentHttpRequestList.forEach((item, key) => {
key.indexOf(cancelkey.split("/**")[0]) > -1 && key.indexOf(cancelkey.split('/**')[0]) > -1 && item('Operation canceled by the user.')
item("Operation canceled by the user."); })
});
} else { } else {
Vue.prototype.$currentHttpRequestList.get(cancelkey) && Vue.prototype.$currentHttpRequestList.get(cancelkey) && Vue.prototype.$currentHttpRequestList.get(cancelkey)('Operation canceled by the user.')
Vue.prototype.$currentHttpRequestList.get(cancelkey)(
"Operation canceled by the user."
);
} }
} }
}; }
new Vue({ new Vue({
router, router,
store, store,
i18n, i18n,
render: (h) => h(App), render: h => h(App)
}).$mount("#app"); }).$mount('#app')
import router from "@/router"; import router from '@/router'
import store from "./store"; import store from './store'
// import { Message } from 'element-ui' // import { Message } from 'element-ui'
import NProgress from "nprogress"; // progress bar import NProgress from 'nprogress' // progress bar
import "nprogress/nprogress.css"; // progress bar style import 'nprogress/nprogress.css' // progress bar style
import { getToken } from "@/utils/auth"; // get token from cookie import {
import getPageTitle from "@/utils/get-page-title"; getToken
import { buildMenus } from "@/api/system/menu"; } from '@/utils/auth' // get token from cookie
import { filterAsyncRouter } from "@/store/modules/permission"; import getPageTitle from '@/utils/get-page-title'
import { isMobile, changeFavicon } from "@/utils/index"; import {
import Layout from "@/layout/index"; buildMenus
import { getSysUI } from "@/utils/auth"; } from '@/api/system/menu'
import {
filterAsyncRouter
} from '@/store/modules/permission'
import {
isMobile,
changeFavicon
} from '@/utils/index'
import Layout from '@/layout/index'
import {
getSysUI
} from '@/utils/auth'
import { getSocket } from "@/websocket"; import {
getSocket
} from '@/websocket'
NProgress.configure({ NProgress.configure({
showSpinner: false, showSpinner: false
}); // NProgress Configuration }) // NProgress Configuration
const whiteList = [ const whiteList = ['/login', '/401', '/404', '/delink', '/nolic', '/de-auto-login'] // no redirect whitelist
"/login",
"/401",
"/404",
"/delink",
"/nolic",
"/de-auto-login",
]; // no redirect whitelist
const routeBefore = (callBack) => { const routeBefore = (callBack) => {
let uiInfo = getSysUI(); let uiInfo = getSysUI()
if (!uiInfo || Object.keys(uiInfo).length === 0) { if (!uiInfo || Object.keys(uiInfo).length === 0) {
store store.dispatch('user/getUI').then(() => {
.dispatch("user/getUI") document.title = getPageTitle()
.then(() => { uiInfo = getSysUI()
document.title = getPageTitle(); if (uiInfo['ui.favicon'] && uiInfo['ui.favicon'].paramValue) {
uiInfo = getSysUI(); const faviconUrl = '/system/ui/image/' + uiInfo['ui.favicon'].paramValue
if (uiInfo["ui.favicon"] && uiInfo["ui.favicon"].paramValue) { changeFavicon(faviconUrl)
const faviconUrl = }
"/system/ui/image/" + uiInfo["ui.favicon"].paramValue; callBack()
changeFavicon(faviconUrl); }).catch(err => {
} document.title = getPageTitle()
callBack(); console.error(err)
}) callBack()
.catch((err) => { })
document.title = getPageTitle();
console.error(err);
callBack();
});
} else { } else {
document.title = getPageTitle(); document.title = getPageTitle()
if (!!uiInfo && uiInfo["ui.favicon"] && uiInfo["ui.favicon"].paramValue) { if (!!uiInfo && uiInfo['ui.favicon'] && uiInfo['ui.favicon'].paramValue) {
const faviconUrl = "/system/ui/image/" + uiInfo["ui.favicon"].paramValue; const faviconUrl = '/system/ui/image/' + uiInfo['ui.favicon'].paramValue
changeFavicon(faviconUrl); changeFavicon(faviconUrl)
} }
callBack(); callBack()
} }
}; }
router.beforeEach(async (to, from, next) => router.beforeEach(async (to, from, next) => routeBefore(() => {
routeBefore(() => { // start progress bar
// start progress bar NProgress.start()
NProgress.start(); const mobileIgnores = ['/delink', '/de-auto-login']
const mobileIgnores = ["/delink", "/de-auto-login"]; const mobilePreview = '/preview/'
const mobilePreview = "/preview/"; const hasToken = getToken()
const hasToken = getToken();
if ( if (isMobile() && !to.path.includes(mobilePreview) && mobileIgnores.indexOf(to.path) === -1) {
isMobile() && let urlSuffix = '/app.html'
!to.path.includes(mobilePreview) && if (hasToken) {
mobileIgnores.indexOf(to.path) === -1 urlSuffix += ('?detoken=' + hasToken)
) {
let urlSuffix = "/app.html";
if (hasToken) {
urlSuffix += "?detoken=" + hasToken;
}
localStorage.removeItem("user-info");
localStorage.removeItem("userId");
localStorage.removeItem("Authorization");
window.location.href = window.origin + urlSuffix;
NProgress.done();
} }
localStorage.removeItem('user-info')
localStorage.removeItem('userId')
localStorage.removeItem('Authorization')
window.location.href = window.origin + urlSuffix
NProgress.done()
}
// set page title // set page title
document.title = getPageTitle(to.meta.title); document.title = getPageTitle(to.meta.title)
// determine whether the user has logged in // determine whether the user has logged in
debugger;
if (hasToken) { if (hasToken) {
if (to.path === "/login") { if (to.path === '/login') {
// if is logged in, redirect to the home page // if is logged in, redirect to the home page
next({ next({
path: "/", path: '/'
}); })
NProgress.done(); NProgress.done()
} else {
const hasGetUserInfo = store.getters.name
if (hasGetUserInfo || to.path.indexOf('/previewScreenShot/') > -1 || to.path.indexOf('/preview/') > -1 || to.path.indexOf('/delink') > -1 || to.path.indexOf('/nolic') > -1) {
next()
store.dispatch('permission/setCurrentPath', to.path)
let route = store.getters.permission_routes.find(
item => item.path === '/' + to.path.split('/')[1]
)
// 如果找不到这个路由,说明是首页
if (!route) {
route = store.getters.permission_routes.find(item => item.path === '/')
}
store.commit('permission/SET_CURRENT_ROUTES', route)
if (['system'].includes(route.name)) {
store.dispatch('app/toggleSideBarHide', false)
}
} else { } else {
const hasGetUserInfo = store.getters.name; if (store.getters.roles.length === 0) { // 判断当前用户是否已拉取完user_info信息
if ( // get user info
hasGetUserInfo || store.dispatch('user/getInfo').then(() => {
to.path.indexOf("/previewScreenShot/") > -1 || const deWebsocket = getSocket()
to.path.indexOf("/preview/") > -1 || deWebsocket && deWebsocket.reconnect && deWebsocket.reconnect()
to.path.indexOf("/delink") > -1 || store.dispatch('lic/getLicInfo').then(() => {
to.path.indexOf("/nolic") > -1 loadMenus(next, to)
) { }).catch(() => {
next(); loadMenus(next, to)
store.dispatch("permission/setCurrentPath", to.path); })
let route = store.getters.permission_routes.find( }).catch(() => {
(item) => item.path === "/" + to.path.split("/")[1] store.dispatch('user/logout').then(() => {
); location.reload() // 为了重新实例化vue-router对象 避免bug
// 如果找不到这个路由,说明是首页 })
if (!route) { })
route = store.getters.permission_routes.find( } else if (store.getters.loadMenus) {
(item) => item.path === "/" // 修改成false,防止死循环
); store.dispatch('user/updateLoadMenus')
} store.dispatch('lic/getLicInfo').then(() => {
store.commit("permission/SET_CURRENT_ROUTES", route); loadMenus(next, to)
if (["system"].includes(route.name)) { }).catch(() => {
store.dispatch("app/toggleSideBarHide", false); loadMenus(next, to)
} })
} else { } else {
if (store.getters.roles.length === 0) { next()
// 判断当前用户是否已拉取完user_info信息
// get user info
store
.dispatch("user/getInfo")
.then(() => {
const deWebsocket = getSocket();
deWebsocket && deWebsocket.reconnect && deWebsocket.reconnect();
store
.dispatch("lic/getLicInfo")
.then(() => {
loadMenus(next, to);
})
.catch(() => {
loadMenus(next, to);
});
})
.catch(() => {
store.dispatch("user/logout").then(() => {
location.reload(); // 为了重新实例化vue-router对象 避免bug
});
});
} else if (store.getters.loadMenus) {
// 修改成false,防止死循环
store.dispatch("user/updateLoadMenus");
store
.dispatch("lic/getLicInfo")
.then(() => {
loadMenus(next, to);
})
.catch(() => {
loadMenus(next, to);
});
} else {
next();
}
} }
} }
} else { }
/* has no token*/ } else {
/* has no token*/
if (whiteList.indexOf(to.path) !== -1) { if (whiteList.indexOf(to.path) !== -1) {
// in the free login whitelist, go directly // in the free login whitelist, go directly
next(); next()
} else { } else {
// other pages that do not have permission to access are redirected to the login page. // other pages that do not have permission to access are redirected to the login page.
next(`/login?redirect=${to.fullPath}`); next(`/login?redirect=${to.fullPath}`)
NProgress.done(); NProgress.done()
}
} }
}) }
); }))
export const loadMenus = (next, to) => { export const loadMenus = (next, to) => {
buildMenus().then((res) => { buildMenus().then(res => {
const data = res.data; const data = res.data
const filterData = filterRouter(data); const filterData = filterRouter(data)
const asyncRouter = filterAsyncRouter(filterData); const asyncRouter = filterAsyncRouter(filterData)
// 如果包含首页 则默认页面是 首页 否则默认页面是仪表板页面 // 如果包含首页 则默认页面是 首页 否则默认页面是仪表板页面
if (JSON.stringify(data).indexOf("wizard") > -1) { if (JSON.stringify(data).indexOf('wizard') > -1) {
asyncRouter.push({ asyncRouter.push({
path: "/", path: '/',
component: Layout, component: Layout,
redirect: "/wizard/index", redirect: '/wizard/index',
hidden: true, hidden: true
}); })
} else { } else {
asyncRouter.push({ asyncRouter.push({
path: "/", path: '/',
component: Layout, component: Layout,
redirect: "/panel/index", redirect: '/panel/index',
hidden: true, hidden: true
}); })
} }
asyncRouter.push({ asyncRouter.push({
path: "*", path: '*',
redirect: "/404", redirect: '/404',
hidden: true, hidden: true
}); })
store.dispatch("permission/GenerateRoutes", asyncRouter).then(() => { store.dispatch('permission/GenerateRoutes', asyncRouter).then(() => { // 存储路由
// 存储路由 router.addRoutes(asyncRouter)
router.addRoutes(asyncRouter);
if (pathValid(to.path, asyncRouter)) { if (pathValid(to.path, asyncRouter)) {
next({ next({
...to, ...to,
replace: true, replace: true
}); })
} else { } else {
next("/"); next('/')
} }
}); })
}); })
}; }
/** /**
* 验证path是否有效 * 验证path是否有效
...@@ -217,14 +194,14 @@ export const loadMenus = (next, to) => { ...@@ -217,14 +194,14 @@ export const loadMenus = (next, to) => {
* @returns * @returns
*/ */
const pathValid = (path, routers) => { const pathValid = (path, routers) => {
const temp = path.startsWith("/") ? path.substr(1) : path; const temp = path.startsWith('/') ? path.substr(1) : path
const locations = temp.split("/"); const locations = temp.split('/')
if (locations.length === 0) { if (locations.length === 0) {
return false; return false
} }
return hasCurrentRouter(locations, routers, 0); return hasCurrentRouter(locations, routers, 0)
}; }
/** /**
* 递归验证every level * 递归验证every level
* @param {*} locations * @param {*} locations
...@@ -233,69 +210,62 @@ const pathValid = (path, routers) => { ...@@ -233,69 +210,62 @@ const pathValid = (path, routers) => {
* @returns * @returns
*/ */
const hasCurrentRouter = (locations, routers, index) => { const hasCurrentRouter = (locations, routers, index) => {
const location = locations[index]; const location = locations[index]
let kids = []; let kids = []
const isvalid = routers.some((router) => { const isvalid = routers.some(router => {
kids = router.children; kids = router.children
return router.path === location || "/" + location === router.path; return (router.path === location || ('/' + location) === router.path)
}); })
if (isvalid && index < locations.length - 1) { if (isvalid && index < locations.length - 1) {
return hasCurrentRouter(locations, kids, index + 1); return hasCurrentRouter(locations, kids, index + 1)
} }
return isvalid; return isvalid
}; }
// 根据权限过滤菜单 // 根据权限过滤菜单
const filterRouter = (routers) => { const filterRouter = routers => {
const user_permissions = store.getters.permissions; const user_permissions = store.getters.permissions
// if (!user_permissions || user_permissions.length === 0) { // if (!user_permissions || user_permissions.length === 0) {
// return routers // return routers
// } // }
const tempResults = routers.filter((router) => const tempResults = routers.filter(router => hasPermission(router, user_permissions))
hasPermission(router, user_permissions)
);
// 如果是一级菜单(目录) 没有字菜单 那就移除 // 如果是一级菜单(目录) 没有字菜单 那就移除
return tempResults.filter((item) => { return tempResults.filter(item => {
if (item.type === 0 && (!item.children || item.children.length === 0)) { if (item.type === 0 && (!item.children || item.children.length === 0)) {
return false; return false
} }
return true; return true
}); })
}; }
const hasPermission = (router, user_permissions) => { const hasPermission = (router, user_permissions) => {
// 判断是否有符合权限 eg. user:read,user:delete // 判断是否有符合权限 eg. user:read,user:delete
if (router.permission && router.permission.indexOf(",") > -1) { if (router.permission && router.permission.indexOf(',') > -1) {
const permissions = router.permission.split(","); const permissions = router.permission.split(',')
const permissionsFilter = permissions.filter((permission) => { const permissionsFilter = permissions.filter(permission => {
return user_permissions.includes(permission); return user_permissions.includes(permission)
}); })
if (!permissionsFilter || permissionsFilter.length === 0) { if (!permissionsFilter || permissionsFilter.length === 0) {
return false; return false
} }
} else if ( } else if (router.permission && !user_permissions.includes(router.permission)) {
router.permission &&
!user_permissions.includes(router.permission)
) {
// 菜单要求权限 但是当前用户权限没有包含菜单权限 // 菜单要求权限 但是当前用户权限没有包含菜单权限
return false; return false
} }
if (!filterLic(router)) { if (!filterLic(router)) {
return false; return false
} }
// 如果有字菜单 则 判断是否满足 ‘任意一个子菜单有权限’ // 如果有字菜单 则 判断是否满足 ‘任意一个子菜单有权限’
if (router.children && router.children.length) { if (router.children && router.children.length) {
const permissionChildren = router.children.filter((item) => const permissionChildren = router.children.filter(item => hasPermission(item, user_permissions))
hasPermission(item, user_permissions) router.children = permissionChildren
); return router.children.length > 0
router.children = permissionChildren;
return router.children.length > 0;
} }
return true; return true
}; }
const filterLic = (router) => { const filterLic = (router) => {
return !router.isPlugin || store.getters.validate; return !router.isPlugin || store.getters.validate
}; }
router.afterEach(() => { router.afterEach(() => {
// finish progress bar // finish progress bar
NProgress.done(); NProgress.done()
}); })
import Vue from "vue"; import Vue from 'vue'
import Router from "vue-router"; import Router from 'vue-router'
Vue.use(Router); Vue.use(Router)
/* Layout */ /* Layout */
import Layout from "@/layout"; import Layout from '@/layout'
/** /**
* Note: sub-menu only appear when route children.length >= 1 * Note: sub-menu only appear when route children.length >= 1
...@@ -32,74 +32,71 @@ import Layout from "@/layout"; ...@@ -32,74 +32,71 @@ import Layout from "@/layout";
*/ */
export const constantRoutes = [ export const constantRoutes = [
{ {
path: "/redirect", path: '/redirect',
component: Layout, component: Layout,
hidden: true, hidden: true,
children: [ children: [
{ {
path: "/redirect/:path(.*)", path: '/redirect/:path(.*)',
component: () => import("@/views/redirect/index"), component: () => import('@/views/redirect/index')
}, }
], ]
}, },
{ {
path: "/login", path: '/login',
component: () => import("@/views/login/index"), component: () => import('@/views/login/index'),
hidden: true, hidden: true
}, },
{ {
path: "/404", path: '/404',
component: () => import("@/views/404"), component: () => import('@/views/404'),
hidden: true, hidden: true
}, },
{ {
path: "/401", path: '/401',
component: (resolve) => require(["@/views/401"], resolve), component: (resolve) => require(['@/views/401'], resolve),
hidden: true, hidden: true
}, },
{ {
path: "/panelEdit", path: '/panelEdit',
component: Layout, component: Layout,
redirect: "/panelEdit/edit", redirect: '/panelEdit/edit',
hidden: true, hidden: true,
children: [ children: [
{ {
path: "edit", path: 'edit',
component: () => import("@/views/panel/edit"), component: () => import('@/views/panel/edit')
}, }
], ]
}, },
{ {
path: "/delink", path: '/delink',
component: () => import("@/views/link"), component: () => import('@/views/link'),
hidden: true, hidden: true
}, },
{ {
path: "/preview/:reportId", path: '/preview/:reportId',
component: () => component: () => import('@/components/canvas/components/editor/PreviewEject'),
import("@/components/canvas/components/editor/PreviewEject"), hidden: true
hidden: true,
}, },
{ {
path: "/previewScreenShot/:reportId/:backScreenShot", path: '/previewScreenShot/:reportId/:backScreenShot',
component: () => component: () => import('@/components/canvas/components/editor/PreviewEject'),
import("@/components/canvas/components/editor/PreviewEject"), hidden: true
hidden: true,
}, },
{ {
path: "/previewFullScreen", path: '/previewFullScreen',
component: () => component: () => import('@/components/canvas/components/editor/PreviewFullScreen'),
import("@/components/canvas/components/editor/PreviewFullScreen"), hidden: true
hidden: true,
}, },
{ {
path: "/de-auto-login", path: '/de-auto-login',
component: () => import("@/views/DeAutoLogin"), component: () => import('@/views/DeAutoLogin'),
hidden: true, hidden: true
}, }
// { // {
// path: '/', // path: '/',
...@@ -217,22 +214,21 @@ export const constantRoutes = [ ...@@ -217,22 +214,21 @@ export const constantRoutes = [
// }, // },
// 404 page must be placed at the end !!! // 404 page must be placed at the end !!!
// { path: '*', redirect: '/404', hidden: true } // { path: '*', redirect: '/404', hidden: true }
]; ]
const createRouter = () => const createRouter = () => new Router({
new Router({ // mode: 'history', // require service support
// mode: 'history', // require service support mode: 'hash',
mode: "hash", scrollBehavior: () => ({ y: 0 }),
scrollBehavior: () => ({ y: 0 }), routes: constantRoutes
routes: [], })
});
const router = createRouter(); const router = createRouter()
// Detail see: https://github.com/vuejs/vue-router/issues/1234#issuecomment-357941465 // Detail see: https://github.com/vuejs/vue-router/issues/1234#issuecomment-357941465
export function resetRouter() { export function resetRouter() {
const newRouter = createRouter(); const newRouter = createRouter()
router.matcher = newRouter.matcher; // reset router router.matcher = newRouter.matcher // reset router
} }
export default router; export default router
import Cookies from "js-cookie"; import Cookies from 'js-cookie'
import i18n from "@/lang"; import i18n from '@/lang'
import { $error, $confirm } from "@/utils/message"; import { $error, $confirm } from '@/utils/message'
import { seizeLogin } from "@/api/user"; import { seizeLogin } from '@/api/user'
import router from "@/router"; import router from '@/router'
import store from "@/store"; import store from '@/store'
import { Loading } from "element-ui"; import { Loading } from 'element-ui'
export function timeSection(date, type, labelFormat = "yyyy-MM-dd") { export function timeSection(date, type, labelFormat = 'yyyy-MM-dd') {
if (!date) { if (!date) {
return null; return null
} }
if (!(date instanceof Date)) { if (!(date instanceof Date)) {
date = new Date(date); date = new Date(date)
} }
const timeRanger = new Array(2); const timeRanger = new Array(2)
const formatArr = labelFormat ? labelFormat.split(" ") : []; const formatArr = labelFormat ? labelFormat.split(' ') : []
const methods = ["setHours", "setMinutes", "setSeconds", "setMilliseconds"]; const methods = ['setHours', 'setMinutes', 'setSeconds', 'setMilliseconds']
let methodsLen = methods.length; let methodsLen = methods.length
if (type === "datetime" && formatArr.length > 1) { if (type === 'datetime' && formatArr.length > 1) {
const childArr = formatArr[1] ? formatArr[1].split(":") : []; const childArr = formatArr[1] ? formatArr[1].split(':') : []
const childArrLength = childArr ? childArr.length : 0; const childArrLength = childArr ? childArr.length : 0
while (--methodsLen >= childArrLength) { while (--methodsLen >= childArrLength) {
date[methods[methodsLen]](0); date[methods[methodsLen]](0)
} }
} else { } else {
methods.forEach((m) => date[m](0)); methods.forEach(m => date[m](0))
} }
const end = new Date(date); const end = new Date(date)
if (type === "year") { if (type === 'year') {
date.setDate(1); date.setDate(1)
date.setMonth(0); date.setMonth(0)
end.setFullYear(date.getFullYear() + 1); end.setFullYear(date.getFullYear() + 1)
timeRanger[1] = end.getTime() - 1; timeRanger[1] = end.getTime() - 1
} }
if (type === "month") { if (type === 'month') {
date.setDate(1); date.setDate(1)
const currentMonth = date.getMonth(); const currentMonth = date.getMonth()
if (currentMonth === 11) { if (currentMonth === 11) {
end.setFullYear(date.getFullYear() + 1); end.setFullYear(date.getFullYear() + 1)
end.setMonth(0); end.setMonth(0)
} else { } else {
end.setMonth(date.getMonth() + 1); end.setMonth(date.getMonth() + 1)
} }
timeRanger[1] = end.getTime() - 1; timeRanger[1] = end.getTime() - 1
} }
if (type === "date") { if (type === 'date') {
end.setHours(23); end.setHours(23)
end.setMinutes(59); end.setMinutes(59)
end.setSeconds(59); end.setSeconds(59)
end.setMilliseconds(999); end.setMilliseconds(999)
timeRanger[1] = end.getTime(); timeRanger[1] = end.getTime()
} }
if (type === "datetime") { if (type === 'datetime') {
methodsLen = methods.length; methodsLen = methods.length
if (formatArr.length > 1) { if (formatArr.length > 1) {
const childArr = formatArr[1] ? formatArr[1].split(":") : []; const childArr = formatArr[1] ? formatArr[1].split(':') : []
const childArrLength = childArr ? childArr.length : 0; const childArrLength = childArr ? childArr.length : 0
while (--methodsLen >= childArrLength) { while (--methodsLen >= childArrLength) {
end[methods[methodsLen]]( end[methods[methodsLen]](methodsLen === 0 ? 23 : methodsLen === 3 ? 999 : 59)
methodsLen === 0 ? 23 : methodsLen === 3 ? 999 : 59
);
} }
} else { } else {
while (--methodsLen >= 0) { while (--methodsLen >= 0) {
end[methods[methodsLen]]( end[methods[methodsLen]](methodsLen === 0 ? 23 : methodsLen === 3 ? 999 : 59)
methodsLen === 0 ? 23 : methodsLen === 3 ? 999 : 59
);
} }
} }
timeRanger[1] = end.getTime(); timeRanger[1] = end.getTime()
} }
timeRanger[0] = date.getTime(); timeRanger[0] = date.getTime()
return timeRanger; return timeRanger
} }
export function dateFormat(date, fmt) { export function dateFormat(date, fmt) {
let ret; let ret
const opt = { const opt = {
"y+": date.getFullYear().toString(), // 年 'y+': date.getFullYear().toString(), // 年
"M+": (date.getMonth() + 1).toString(), // 月 'M+': (date.getMonth() + 1).toString(), // 月
"d+": date.getDate().toString(), // 日 'd+': date.getDate().toString(), // 日
"H+": date.getHours().toString(), // 时 'H+': date.getHours().toString(), // 时
"m+": date.getMinutes().toString(), // 分 'm+': date.getMinutes().toString(), // 分
"s+": date.getSeconds().toString(), // 秒 's+': date.getSeconds().toString() // 秒
// 有其他格式化字符需求可以继续添加,必须转化成字符串 // 有其他格式化字符需求可以继续添加,必须转化成字符串
}; }
for (const k in opt) { for (const k in opt) {
ret = new RegExp("(" + k + ")").exec(fmt); ret = new RegExp('(' + k + ')').exec(fmt)
if (ret) { if (ret) {
fmt = fmt.replace( fmt = fmt.replace(ret[1], (ret[1].length === 1) ? (opt[k]) : (opt[k].padStart(ret[1].length, '0')))
ret[1],
ret[1].length === 1 ? opt[k] : opt[k].padStart(ret[1].length, "0")
);
} }
} }
return fmt; return fmt
} }
/** /**
...@@ -110,20 +103,20 @@ export function dateFormat(date, fmt) { ...@@ -110,20 +103,20 @@ export function dateFormat(date, fmt) {
*/ */
export function parseTime(time, cFormat) { export function parseTime(time, cFormat) {
if (arguments.length === 0) { if (arguments.length === 0) {
return null; return null
} }
const format = cFormat || "{y}-{m}-{d} {h}:{i}:{s}"; const format = cFormat || '{y}-{m}-{d} {h}:{i}:{s}'
let date; let date
if (typeof time === "object") { if (typeof time === 'object') {
date = time; date = time
} else { } else {
if (typeof time === "string" && /^[0-9]+$/.test(time)) { if ((typeof time === 'string') && (/^[0-9]+$/.test(time))) {
time = parseInt(time); time = parseInt(time)
} }
if (typeof time === "number" && time.toString().length === 10) { if ((typeof time === 'number') && (time.toString().length === 10)) {
time = time * 1000; time = time * 1000
} }
date = new Date(time); date = new Date(time)
} }
const formatObj = { const formatObj = {
y: date.getFullYear(), y: date.getFullYear(),
...@@ -132,17 +125,17 @@ export function parseTime(time, cFormat) { ...@@ -132,17 +125,17 @@ export function parseTime(time, cFormat) {
h: date.getHours(), h: date.getHours(),
i: date.getMinutes(), i: date.getMinutes(),
s: date.getSeconds(), s: date.getSeconds(),
a: date.getDay(), a: date.getDay()
}; }
const time_str = format.replace(/{([ymdhisa])+}/g, (result, key) => { const time_str = format.replace(/{([ymdhisa])+}/g, (result, key) => {
const value = formatObj[key]; const value = formatObj[key]
// Note: getDay() returns 0 on Sunday // Note: getDay() returns 0 on Sunday
if (key === "a") { if (key === 'a') {
return ["日", "一", "二", "三", "四", "五", "六"][value]; return ['日', '一', '二', '三', '四', '五', '六'][value]
} }
return value.toString().padStart(2, "0"); return value.toString().padStart(2, '0')
}); })
return time_str; return time_str
} }
/** /**
...@@ -152,7 +145,7 @@ export function parseTime(time, cFormat) { ...@@ -152,7 +145,7 @@ export function parseTime(time, cFormat) {
* @returns {boolean} * @returns {boolean}
*/ */
export function hasClass(ele, cls) { export function hasClass(ele, cls) {
return !!ele.className.match(new RegExp("(\\s|^)" + cls + "(\\s|$)")); return !!ele.className.match(new RegExp('(\\s|^)' + cls + '(\\s|$)'))
} }
/** /**
...@@ -161,7 +154,7 @@ export function hasClass(ele, cls) { ...@@ -161,7 +154,7 @@ export function hasClass(ele, cls) {
* @param {string} cls * @param {string} cls
*/ */
export function addClass(ele, cls) { export function addClass(ele, cls) {
if (!hasClass(ele, cls)) ele.className += " " + cls; if (!hasClass(ele, cls)) ele.className += ' ' + cls
} }
/** /**
...@@ -171,8 +164,8 @@ export function addClass(ele, cls) { ...@@ -171,8 +164,8 @@ export function addClass(ele, cls) {
*/ */
export function removeClass(ele, cls) { export function removeClass(ele, cls) {
if (hasClass(ele, cls)) { if (hasClass(ele, cls)) {
const reg = new RegExp("(\\s|^)" + cls + "(\\s|$)"); const reg = new RegExp('(\\s|^)' + cls + '(\\s|$)')
ele.className = ele.className.replace(reg, " "); ele.className = ele.className.replace(reg, ' ')
} }
} }
...@@ -182,40 +175,40 @@ export function removeClass(ele, cls) { ...@@ -182,40 +175,40 @@ export function removeClass(ele, cls) {
* @returns {string} * @returns {string}
*/ */
export function formatTime(time, option) { export function formatTime(time, option) {
if (("" + time).length === 10) { if (('' + time).length === 10) {
time = parseInt(time) * 1000; time = parseInt(time) * 1000
} else { } else {
time = +time; time = +time
} }
const d = new Date(time); const d = new Date(time)
const now = Date.now(); const now = Date.now()
const diff = (now - d) / 1000; const diff = (now - d) / 1000
if (diff < 30) { if (diff < 30) {
return "刚刚"; return '刚刚'
} else if (diff < 3600) { } else if (diff < 3600) {
// less 1 hour // less 1 hour
return Math.ceil(diff / 60) + "分钟前"; return Math.ceil(diff / 60) + '分钟前'
} else if (diff < 3600 * 24) { } else if (diff < 3600 * 24) {
return Math.ceil(diff / 3600) + "小时前"; return Math.ceil(diff / 3600) + '小时前'
} else if (diff < 3600 * 24 * 2) { } else if (diff < 3600 * 24 * 2) {
return "1天前"; return '1天前'
} }
if (option) { if (option) {
return parseTime(time, option); return parseTime(time, option)
} else { } else {
return ( return (
d.getMonth() + d.getMonth() +
1 + 1 +
"月" + '月' +
d.getDate() + d.getDate() +
"日" + '日' +
d.getHours() + d.getHours() +
"时" + '时' +
d.getMinutes() + d.getMinutes() +
"分" '分'
); )
} }
} }
...@@ -224,33 +217,33 @@ export function formatTime(time, option) { ...@@ -224,33 +217,33 @@ export function formatTime(time, option) {
* @returns {Object} * @returns {Object}
*/ */
export function param2Obj(url) { export function param2Obj(url) {
const search = url.split("?")[1]; const search = url.split('?')[1]
if (!search) { if (!search) {
return {}; return {}
} }
return JSON.parse( return JSON.parse(
'{"' + '{"' +
decodeURIComponent(search) decodeURIComponent(search)
.replace(/"/g, '\\"') .replace(/"/g, '\\"')
.replace(/&/g, '","') .replace(/&/g, '","')
.replace(/=/g, '":"') .replace(/=/g, '":"')
.replace(/\+/g, " ") + .replace(/\+/g, ' ') +
'"}' '"}'
); )
} }
export function formatCondition(param) { export function formatCondition(param) {
if (!param) { if (!param) {
return null; return null
} }
const result = { const result = {
conditions: [], conditions: []
}; }
// eslint-disable-next-line no-unused-vars // eslint-disable-next-line no-unused-vars
for (const [key, value] of Object.entries(param)) { for (const [key, value] of Object.entries(param)) {
result.conditions.push(value); result.conditions.push(value)
} }
return result; return result
} }
/** /**
* 驼峰转下划线 * 驼峰转下划线
...@@ -258,170 +251,152 @@ export function formatCondition(param) { ...@@ -258,170 +251,152 @@ export function formatCondition(param) {
* @returns * @returns
*/ */
export function toLine(name) { export function toLine(name) {
return name.replace(/([A-Z])/g, "_$1").toLowerCase(); return name.replace(/([A-Z])/g, '_$1').toLowerCase()
} }
export function addOrder(order, orders) { export function addOrder(order, orders) {
order.field = toLine(order.field); order.field = toLine(order.field)
if (order.value.startsWith("desc")) { if (order.value.startsWith('desc')) {
order.value = "desc"; order.value = 'desc'
} else { } else {
order.value = "asc"; order.value = 'asc'
} }
orders = orders || []; orders = orders || []
for (let index = 0; index < orders.length; index++) { for (let index = 0; index < orders.length; index++) {
const element = orders[index]; const element = orders[index]
if (order.field === element.field) { if (order.field === element.field) {
orders[index] = order; orders[index] = order
return; return
} }
} }
orders.push(order); orders.push(order)
} }
export function formatOrders(orders) { export function formatOrders(orders) {
return orders.map((order) => order.field + " " + order.value); return orders.map(order => order.field + ' ' + order.value)
} }
export function formatQuickCondition(param, quickField) { export function formatQuickCondition(param, quickField) {
let quickObj = null; let quickObj = null
if (!param || !(quickObj = param.quick) || !quickField) { if (!param || !(quickObj = param.quick) || !quickField) {
quickObj && delete param.quick; quickObj && delete param.quick
return param; return param
} }
param[quickField] = { param[quickField] = {
field: quickField, field: quickField,
operator: "like", operator: 'like',
value: quickObj.value, value: quickObj.value
}; }
delete param.quick; delete param.quick
return param; return param
} }
export function getQueryVariable(variable) { export function getQueryVariable(variable) {
let query = window.location.search.substring(1); let query = window.location.search.substring(1)
if (!query) { if (!query) {
query = Cookies.get(variable); query = Cookies.get(variable)
} }
if (query !== undefined) { if (query !== undefined) {
const vars = query.split("&"); const vars = query.split('&')
for (var i = 0; i < vars.length; i++) { for (var i = 0; i < vars.length; i++) {
const pair = vars[i].split("="); const pair = vars[i].split('=')
if (pair[0] === variable) { if (pair[0] === variable) {
return pair[1]; return pair[1]
} }
} }
} }
return false; return (false)
} }
export function isMobile() { export function isMobile() {
const flag = navigator.userAgent.match( const flag = navigator.userAgent.match(/(phone|pad|pod|iPhone|iPod|ios|iPad|Android|Mobile|BlackBerry|IEMobile|MQQBrowser|JUC|Fennec|wOSBrowser|BrowserNG|WebOS|Symbian|Windows Phone)/i)
/(phone|pad|pod|iPhone|iPod|ios|iPad|Android|Mobile|BlackBerry|IEMobile|MQQBrowser|JUC|Fennec|wOSBrowser|BrowserNG|WebOS|Symbian|Windows Phone)/i return flag
);
return flag;
} }
export const isSameVueObj = (source, target) => { export const isSameVueObj = (source, target) => {
if (!source && !target) return true; if (!source && !target) return true
if (!!source && !!target) { if (!!source && !!target) {
return JSON.stringify(source) === JSON.stringify(target); return JSON.stringify(source) === JSON.stringify(target)
} }
return false; return false
}; }
export const isSameArr = (source, target) => { export const isSameArr = (source, target) => {
if (!source && !target) return true; if (!source && !target) return true
if (source?.length && target?.length && source.length === target.length) { if (source?.length && target?.length && source.length === target.length) {
const sortSource = source.sort(); const sortSource = source.sort()
const sortTarget = target.sort(); const sortTarget = target.sort()
return JSON.stringify(sortSource) === JSON.stringify(sortTarget); return JSON.stringify(sortSource) === JSON.stringify(sortTarget)
} }
return false; return false
}; }
export const changeFavicon = (link) => { export const changeFavicon = link => {
let $favicon = document.querySelector('link[rel="icon"]'); let $favicon = document.querySelector('link[rel="icon"]')
if ($favicon !== null) { if ($favicon !== null) {
$favicon.href = link; $favicon.href = link
} else { } else {
$favicon = document.createElement("link"); $favicon = document.createElement('link')
$favicon.rel = "icon"; $favicon.rel = 'icon'
$favicon.href = link; $favicon.href = link
document.head.appendChild($favicon); document.head.appendChild($favicon)
} }
}; }
export const mergeCustomSortOption = (customSortList, sourceList) => { export const mergeCustomSortOption = (customSortList, sourceList) => {
if (!customSortList?.length) return sourceList?.length ? sourceList : []; if (!customSortList?.length) return sourceList?.length ? sourceList : []
if (!sourceList?.length) return customSortList?.length ? customSortList : []; if (!sourceList?.length) return customSortList?.length ? customSortList : []
const result = [...customSortList, ...sourceList]; const result = [...customSortList, ...sourceList]
return [...new Set(result)]; return [...new Set(result)]
}; }
export const inOtherPlatform = () => { export const inOtherPlatform = () => {
const cookieStr = Cookies.get("inOtherPlatform"); const cookieStr = Cookies.get('inOtherPlatform')
if (cookieStr && cookieStr === "true") { if (cookieStr && cookieStr === 'true') {
return true; return true
} }
return false; return false
}; }
export const showMultiLoginMsg = () => { export const showMultiLoginMsg = () => {
const multiLoginError1 = Cookies.get("MultiLoginError1"); const multiLoginError1 = Cookies.get('MultiLoginError1')
if (multiLoginError1) { if (multiLoginError1) {
Cookies.remove("MultiLoginError1"); Cookies.remove('MultiLoginError1')
const infos = JSON.parse(multiLoginError1); const infos = JSON.parse(multiLoginError1)
const content = infos const content = infos.map(info => buildMultiLoginErrorItem(info)).join('</br>')
.map((info) => buildMultiLoginErrorItem(info)) let msgContent = '<strong>' + i18n.t('multi_login_lang.title') + '</strong>'
.join("</br>"); msgContent += content + '<p>' + i18n.t('multi_login_lang.label') + '</p>'
let msgContent = $error(msgContent, 10000, true)
"<strong>" + i18n.t("multi_login_lang.title") + "</strong>"; }
msgContent += content + "<p>" + i18n.t("multi_login_lang.label") + "</p>"; const multiLoginError2 = Cookies.get('MultiLoginError2')
$error(msgContent, 10000, true);
}
const multiLoginError2 = Cookies.get("MultiLoginError2");
if (multiLoginError2) { if (multiLoginError2) {
const infos = JSON.parse(multiLoginError2); const infos = JSON.parse(multiLoginError2)
Cookies.remove("MultiLoginError2"); Cookies.remove('MultiLoginError2')
const content = infos const content = infos.map(info => buildMultiLoginErrorItem(info)).join('</br>')
.map((info) => buildMultiLoginErrorItem(info)) let msgContent = '<strong>' + i18n.t('multi_login_lang.confirm_title') + '</strong>'
.join("</br>"); msgContent += content + '<p>' + i18n.t('multi_login_lang.confirm') + '</p>'
let msgContent =
"<strong>" + i18n.t("multi_login_lang.confirm_title") + "</strong>";
msgContent += content + "<p>" + i18n.t("multi_login_lang.confirm") + "</p>";
$confirm(msgContent, () => seize(infos[0]), { $confirm(msgContent, () => seize(infos[0]), {
dangerouslyUseHTMLString: true, dangerouslyUseHTMLString: true
}); })
} }
}; }
const seize = (model) => { const seize = model => {
const loadingInstance = Loading.service({}); const loadingInstance = Loading.service({})
const token = model.token; const token = model.token
const param = { const param = {
token, token
}; }
seizeLogin(param).then((res) => { seizeLogin(param).then(res => {
const resultToken = res.data.token; const resultToken = res.data.token
store.dispatch("user/refreshToken", resultToken); store.dispatch('user/refreshToken', resultToken)
router.push("/"); router.push('/')
loadingInstance.close(); loadingInstance.close()
}); })
}; }
const buildMultiLoginErrorItem = (info) => { const buildMultiLoginErrorItem = (info) => {
if (!info) return null; if (!info) return null
const ip = i18n.t("multi_login_lang.ip"); const ip = i18n.t('multi_login_lang.ip')
const time = i18n.t("multi_login_lang.time"); const time = i18n.t('multi_login_lang.time')
return ( return '<p>' + ip + ': ' + info.ip + ', ' + time + ': ' + new Date(info.loginTime).format('yyyy-MM-dd hh:mm:ss') + '</p>'
"<p>" + }
ip +
": " +
info.ip +
", " +
time +
": " +
new Date(info.loginTime).format("yyyy-MM-dd hh:mm:ss") +
"</p>"
);
};
...@@ -481,9 +481,11 @@ export default { ...@@ -481,9 +481,11 @@ export default {
trackClick(trackAction) { trackClick(trackAction) {
const param = this.pointParam const param = this.pointParam
if (!param || !param.data || !param.data.dimensionList) { if (!param || !param.data || !param.data.dimensionList) {
// 地图提示没有关联字段 其他没有维度信息的 直接返回
if (this.chart.type === 'map') { if (this.chart.type === 'map') {
this.$warning(this.$t('panel.no_drill_field')) const zoom = this.myChart.getOption().geo[0].zoom
if (zoom <= 1) {
this.$warning(this.$t('panel.no_drill_field'))
}
} }
return return
} }
......
...@@ -14,6 +14,22 @@ ...@@ -14,6 +14,22 @@
<script> <script>
import tinymce from 'tinymce/tinymce' // tinymce默认hidden,不引入不显示 import tinymce from 'tinymce/tinymce' // tinymce默认hidden,不引入不显示
import Editor from '@tinymce/tinymce-vue' import Editor from '@tinymce/tinymce-vue'
import 'tinymce/themes/silver/theme' // 编辑器主题
import 'tinymce/icons/default' // 引入编辑器图标icon,不引入则不显示对应图标
// 引入编辑器插件(基本免费插件都在这儿了)
import 'tinymce/plugins/advlist' // 高级列表
import 'tinymce/plugins/autolink' // 自动链接
import 'tinymce/plugins/link' // 超链接
import 'tinymce/plugins/image' // 插入编辑图片
import 'tinymce/plugins/lists' // 列表插件
import 'tinymce/plugins/charmap' // 特殊字符
import 'tinymce/plugins/media' // 插入编辑媒体
import 'tinymce/plugins/wordcount' // 字数统计
import 'tinymce/plugins/table' // 表格
import 'tinymce/plugins/contextmenu' // contextmenu
import 'tinymce/plugins/directionality'
import 'tinymce/plugins/nonbreaking'
import 'tinymce/plugins/pagebreak'
import { imgUrlTrans } from '@/components/canvas/utils/utils' import { imgUrlTrans } from '@/components/canvas/utils/utils'
import { mapState } from 'vuex' import { mapState } from 'vuex'
// 编辑器引入 // 编辑器引入
......
...@@ -449,7 +449,7 @@ export default { ...@@ -449,7 +449,7 @@ export default {
valueFormatter() { valueFormatter() {
this.item.index = this.index this.item.index = this.index
this.item.formatterType = 'quota' this.item.formatterType = 'quotaExt'
this.$emit('valueFormatter', this.item) this.$emit('valueFormatter', this.item)
} }
} }
......
...@@ -117,6 +117,13 @@ export default { ...@@ -117,6 +117,13 @@ export default {
value: 'ge', value: 'ge',
label: this.$t('chart.filter_ge') label: this.$t('chart.filter_ge')
}] }]
},
{
label: '',
options: [{
value: 'not_null',
label: this.$t('chart.filter_not_null')
}]
}], }],
logic: '' logic: ''
} }
......
...@@ -194,6 +194,13 @@ export default { ...@@ -194,6 +194,13 @@ export default {
value: 'ge', value: 'ge',
label: this.$t('chart.filter_ge') label: this.$t('chart.filter_ge')
}] }]
},
{
label: '',
options: [{
value: 'not_null',
label: this.$t('chart.filter_not_null')
}]
} }
], ],
valueOptions: [ valueOptions: [
...@@ -226,6 +233,13 @@ export default { ...@@ -226,6 +233,13 @@ export default {
value: 'ge', value: 'ge',
label: this.$t('chart.filter_ge') label: this.$t('chart.filter_ge')
}] }]
},
{
label: '',
options: [{
value: 'not_null',
label: this.$t('chart.filter_not_null')
}]
} }
], ],
options: [], options: [],
......
...@@ -473,7 +473,8 @@ ...@@ -473,7 +473,8 @@
<plugin-com <plugin-com
v-if="view.isPlugin" v-if="view.isPlugin"
:component-name="view.type + '-data'" :component-name="view.type + '-data'"
:obj="{view, param, chart, dimensionData, quotaData}" :obj="{view, param, chart, dimension, dimensionData, quota, quotaData}"
:bus="bus"
/> />
<div v-else> <div v-else>
...@@ -819,6 +820,7 @@ ...@@ -819,6 +820,7 @@
@editItemFilter="showQuotaEditFilter" @editItemFilter="showQuotaEditFilter"
@onNameEdit="showRename" @onNameEdit="showRename"
@editItemCompare="showQuotaEditCompare" @editItemCompare="showQuotaEditCompare"
@valueFormatter="valueFormatter"
/> />
</transition-group> </transition-group>
</draggable> </draggable>
...@@ -1795,7 +1797,7 @@ export default { ...@@ -1795,7 +1797,7 @@ export default {
DrillPath, DrillPath,
PluginCom, PluginCom,
MapMapping, MapMapping,
MarkMapDataEditor, MarkMapDataEditor
}, },
props: { props: {
param: { param: {
...@@ -1815,6 +1817,7 @@ export default { ...@@ -1815,6 +1817,7 @@ export default {
}, },
data() { data() {
return { return {
bus: bus,
positionActiveNames: 'positionAdjust', positionActiveNames: 'positionAdjust',
loading: false, loading: false,
table: {}, table: {},
...@@ -2954,7 +2957,7 @@ export default { ...@@ -2954,7 +2957,7 @@ export default {
// 更换数据集 // 更换数据集
changeChart() { changeChart() {
const optType = this.view.tableId === this.changeTable.id && this.view.dataFrom!=='template' ? 'same' : 'change' const optType = this.view.tableId === this.changeTable.id && this.view.dataFrom !== 'template' ? 'same' : 'change'
// 更换数据集后清空视图字段,并重新请求数据;否则没有操作 // 更换数据集后清空视图字段,并重新请求数据;否则没有操作
if (optType === 'change') { if (optType === 'change') {
this.view.dataFrom = 'dataset' this.view.dataFrom = 'dataset'
......
...@@ -81,7 +81,7 @@ export default { ...@@ -81,7 +81,7 @@ export default {
props: {}, props: {},
data() { data() {
return { return {
maxHeight: 2000, maxHeight: 10000,
maxTop: 20000 maxTop: 20000
} }
}, },
......
...@@ -10,7 +10,7 @@ ...@@ -10,7 +10,7 @@
<div <div
class="remark-style" class="remark-style"
:style="{backgroundColor:remarkCfg.bgFill}" :style="{backgroundColor:remarkCfg.bgFill}"
v-html="remarkCfg.content" v-html="$xss(remarkCfg.content)"
/> />
<i <i
slot="reference" slot="reference"
......
...@@ -21,8 +21,8 @@ ...@@ -21,8 +21,8 @@
<el-col class="info-item"> <el-col class="info-item">
<p class="info-title">{{ $t('chart.chart_type') }}</p> <p class="info-title">{{ $t('chart.chart_type') }}</p>
<svg-icon <svg-icon
v-if="detail.chart.type" :icon-class="detail.chart.isPlugin && detail.chart.type && detail.chart.type !== 'buddle-map' ? ('/api/pluginCommon/staticInfo/' + detail.chart.type + '/svg') : detail.chart.type"
:icon-class="detail.chart.type" class="chart-icon"
/> />
</el-col> </el-col>
<el-col class="info-item"> <el-col class="info-item">
......
...@@ -34,7 +34,7 @@ ...@@ -34,7 +34,7 @@
<span> <span>
<span <span
style="margin-left: 6px" style="margin-left: 6px"
v-html="data.name" v-html="$xss(data.name)"
/> />
</span> </span>
<span <span
......
...@@ -34,7 +34,7 @@ ...@@ -34,7 +34,7 @@
text-overflow: ellipsis; text-overflow: ellipsis;
" "
:title="data.name" :title="data.name"
v-html="highlights(data.name)" v-html="$xss(highlights(data.name))"
/> />
</span> </span>
</span> </span>
......
...@@ -216,6 +216,7 @@ import { changeFavicon, showMultiLoginMsg } from '@/utils/index' ...@@ -216,6 +216,7 @@ import { changeFavicon, showMultiLoginMsg } from '@/utils/index'
import { initTheme } from '@/utils/ThemeUtil' import { initTheme } from '@/utils/ThemeUtil'
import PluginCom from '@/views/system/plugin/PluginCom' import PluginCom from '@/views/system/plugin/PluginCom'
import Cookies from 'js-cookie' import Cookies from 'js-cookie'
import xss from 'xss'
export default { export default {
name: 'Login', name: 'Login',
components: { PluginCom }, components: { PluginCom },
...@@ -449,7 +450,27 @@ export default { ...@@ -449,7 +450,27 @@ export default {
this.showFoot = this.uiInfo['ui.showFoot'].paramValue === true || this.uiInfo['ui.showFoot'].paramValue === 'true' this.showFoot = this.uiInfo['ui.showFoot'].paramValue === true || this.uiInfo['ui.showFoot'].paramValue === 'true'
if (this.showFoot) { if (this.showFoot) {
const content = this.uiInfo['ui.footContent'] && this.uiInfo['ui.footContent'].paramValue const content = this.uiInfo['ui.footContent'] && this.uiInfo['ui.footContent'].paramValue
this.footContent = content const myXss = new xss.FilterXSS({
css: {
whiteList: {
'background-color': true,
'text-align': true,
'color': true,
'margin-top': true,
'margin-bottom': true,
'line-height': true,
'box-sizing': true,
'padding-top': true,
'padding-bottom': true
}
},
whiteList: {
...xss.whiteList,
p: ['style'],
span: ['style']
}
})
this.footContent = myXss.process(content)
} }
} }
}, },
......
...@@ -15,7 +15,7 @@ ...@@ -15,7 +15,7 @@
<div <div
class="export_body_inner_class" class="export_body_inner_class"
:style="templateHtmlStyle" :style="templateHtmlStyle"
v-html="templateContentChange" v-html="$xss(templateContentChange)"
/> />
</div> </div>
</el-row> </el-row>
......
...@@ -266,6 +266,7 @@ ...@@ -266,6 +266,7 @@
<div v-if="currentElement.options && currentElement.options.attrs"> <div v-if="currentElement.options && currentElement.options.attrs">
<filter-head <filter-head
:element="currentElement" :element="currentElement"
@dataset-name="dataSetName"
/> />
<filter-control <filter-control
...@@ -463,6 +464,23 @@ export default { ...@@ -463,6 +464,23 @@ export default {
bus.$off('valid-values-change', this.validateFilterValue) bus.$off('valid-values-change', this.validateFilterValue)
}, },
methods: { methods: {
dataSetName(tableId, callback) {
let result = null
if (tableId) {
const stack = [...this.defaultData]
while (stack.length) {
const tableNode = stack.pop()
if (tableNode.id === tableId) {
result = tableNode.name
break
}
if (tableNode.children?.length) {
tableNode.children.forEach(kid => stack.push(kid))
}
}
}
callback && callback(result)
},
async checkSuperior(list, anotherTableIds) { async checkSuperior(list, anotherTableIds) {
let fieldValid = false let fieldValid = false
const fieldId = this.myAttrs?.fieldId const fieldId = this.myAttrs?.fieldId
......
...@@ -25,6 +25,7 @@ ...@@ -25,6 +25,7 @@
:key="item.id" :key="item.id"
:item="item" :item="item"
:index="index" :index="index"
:tool-tip="getTableName(item.tableId)"
@closeItem="closeItem" @closeItem="closeItem"
/> />
...@@ -70,7 +71,12 @@ export default { ...@@ -70,7 +71,12 @@ export default {
}, },
methods: { methods: {
getTableName(tableId) {
let tableName = null
this.$emit('dataset-name', tableId, t => { tableName = t })
console.log(tableName)
return tableName
},
onMove(e, originalEvent) { onMove(e, originalEvent) {
return true return true
}, },
......
...@@ -670,7 +670,10 @@ export default { ...@@ -670,7 +670,10 @@ export default {
if (this.editPanel.optType === 'toDefaultPanel') { if (this.editPanel.optType === 'toDefaultPanel') {
this.defaultTree(false) this.defaultTree(false)
} }
updateCacheTree(this.editPanel.optType, 'panel-main-tree', panelInfo, this.tData)
updateCacheTree(this.editPanel.optType,
panelInfo.panelType === 'system' ? 'panel-default-tree' : 'panel-main-tree', panelInfo,
panelInfo.panelType === 'system' ? this.defaultData : this.tData)
if (this.editPanel.optType === 'rename' && panelInfo.id === this.$store.state.panel.panelInfo.id) { if (this.editPanel.optType === 'rename' && panelInfo.id === this.$store.state.panel.panelInfo.id) {
this.$store.state.panel.panelInfo.name = panelInfo.name this.$store.state.panel.panelInfo.name = panelInfo.name
} }
...@@ -850,7 +853,7 @@ export default { ...@@ -850,7 +853,7 @@ export default {
delete(data) { delete(data) {
const params = { const params = {
title: data.nodeType === 'folder'?'commons.delete_this_folder':'commons.delete_this_dashboard', title: data.nodeType === 'folder' ? 'commons.delete_this_folder' : 'commons.delete_this_dashboard',
type: 'danger', type: 'danger',
cb: () => { cb: () => {
delGroup(data.id).then((response) => { delGroup(data.id).then((response) => {
......
...@@ -249,6 +249,7 @@ ...@@ -249,6 +249,7 @@
<Preview <Preview
v-if="showMainFlag" v-if="showMainFlag"
ref="paneViewPreviewRef" ref="paneViewPreviewRef"
:class="fullscreen && 'fullscreen-visual-selects'"
:component-data="mainCanvasComponentData" :component-data="mainCanvasComponentData"
:canvas-style-data="canvasStyleData" :canvas-style-data="canvasStyleData"
:active-tab="activeTab" :active-tab="activeTab"
...@@ -923,5 +924,12 @@ export default { ...@@ -923,5 +924,12 @@ export default {
color: inherit; color: inherit;
margin-right: 5px; margin-right: 5px;
} }
.fullscreen-visual-selects {
.VisualSelects {
top: inherit !important;
left: inherit !important;
}
}
</style> </style>
...@@ -202,7 +202,7 @@ ...@@ -202,7 +202,7 @@
<!-- // {{}}会将数据解释为普通文本,而非 HTML 代码。 --> <!-- // {{}}会将数据解释为普通文本,而非 HTML 代码。 -->
<div <div
slot="content" slot="content"
v-html="filterRoles(scope.row.roles)" v-html="$xss(filterRoles(scope.row.roles))"
/> />
<div class="de-one-line">{{ filterRoles(scope.row.roles) }}</div> <div class="de-one-line">{{ filterRoles(scope.row.roles) }}</div>
</el-tooltip> </el-tooltip>
......
...@@ -9,7 +9,7 @@ ...@@ -9,7 +9,7 @@
{{ details.head }} {{ details.head }}
</el-row> </el-row>
<el-row class="card_content"> <el-row class="card_content">
<span v-html="details.content" /> <span v-html="$xss(details.content)" />
</el-row> </el-row>
<el-row class="card_bottom"> <el-row class="card_bottom">
{{ $t('wizard.click_show') }} {{ $t('wizard.click_show') }}
......
...@@ -9,7 +9,7 @@ ...@@ -9,7 +9,7 @@
{{ details.head }} {{ details.head }}
</el-row> </el-row>
<el-row class="card_content"> <el-row class="card_content">
<span v-html="details.content" /> <span v-html="$xss(details.content)" />
</el-row> </el-row>
<el-row class="card_bottom"> <el-row class="card_bottom">
{{ $t('wizard.apply') }} {{ $t('wizard.apply') }}
......
...@@ -18,7 +18,7 @@ ...@@ -18,7 +18,7 @@
<span>{{ details.head }}</span> <span>{{ details.head }}</span>
</el-row> </el-row>
<el-row class="content"> <el-row class="content">
<span v-html="details.content" /> <span v-html="$xss(details.content)" />
</el-row> </el-row>
<el-row class="bottom"> <el-row class="bottom">
<span class="span-box">{{ details.bottom }}</span> <span class="span-box">{{ details.bottom }}</span>
......
...@@ -18,7 +18,7 @@ ...@@ -18,7 +18,7 @@
<span>{{ details.head }}</span> <span>{{ details.head }}</span>
</el-row> </el-row>
<el-row class="content"> <el-row class="content">
<span v-html="details.content" /> <span v-html="$xss(details.content)" />
</el-row> </el-row>
<el-row class="bottom"> <el-row class="bottom">
<span class="span-box">{{ details.bottom }}</span> <span class="span-box">{{ details.bottom }}</span>
......
"use strict"; 'use strict'
const path = require("path"); const path = require('path')
const defaultSettings = require("./src/settings.js"); const defaultSettings = require('./src/settings.js')
const pkg = require("./package.json"); const pkg = require('./package.json')
const CopyWebpackPlugin = require("copy-webpack-plugin"); const CopyWebpackPlugin = require('copy-webpack-plugin')
// const CompressionPlugin = require('compression-webpack-plugin') // const CompressionPlugin = require('compression-webpack-plugin')
const webpack = require("webpack"); const webpack = require('webpack')
const AddAssetHtmlPlugin = require("add-asset-html-webpack-plugin"); const AddAssetHtmlPlugin = require('add-asset-html-webpack-plugin')
function resolve(dir) { function resolve(dir) {
return path.join(__dirname, dir); return path.join(__dirname, dir)
} }
const name = defaultSettings.title || "vue Admin Template"; // page title const name = defaultSettings.title || 'vue Admin Template' // page title
const port = process.env.port || process.env.npm_config_port || 9528; // dev port const port = process.env.port || process.env.npm_config_port || 9528 // dev port
const parallel = process.env.NODE_ENV === "development"; const parallel = process.env.NODE_ENV === 'development'
module.exports = { module.exports = {
productionSourceMap: true, productionSourceMap: true,
parallel, parallel,
...@@ -23,78 +23,76 @@ module.exports = { ...@@ -23,78 +23,76 @@ module.exports = {
devServer: { devServer: {
port: port, port: port,
proxy: { proxy: {
"^(?!/login)": { '^(?!/login)': {
target: "http://192.168.1.100:8081/", target: 'http://localhost:8081/',
ws: true, ws: true
}, }
}, },
open: true, open: true,
overlay: { overlay: {
warnings: false, warnings: false,
errors: true, errors: true
}, }
}, },
pages: { pages: {
index: { index: {
entry: "src/main.js", entry: 'src/main.js',
template: "public/index.html", template: 'public/index.html',
filename: "index.html", filename: 'index.html'
}, }
}, },
configureWebpack: { configureWebpack: {
name: name, name: name,
devtool: "source-map", devtool: 'source-map',
resolve: { resolve: {
alias: { alias: {
"@": resolve("src"), '@': resolve('src')
}, }
},
output: process.env.NODE_ENV === 'development' ? {} : {
filename: `js/[name].[contenthash:8].${pkg.version}.js`,
publicPath: '/',
chunkFilename: `js/[name].[contenthash:8].${pkg.version}.js`
}, },
output:
process.env.NODE_ENV === "development"
? {}
: {
filename: `js/[name].[contenthash:8].${pkg.version}.js`,
publicPath: "/",
chunkFilename: `js/[name].[contenthash:8].${pkg.version}.js`,
},
plugins: [ plugins: [
new CopyWebpackPlugin([ new CopyWebpackPlugin([
{ {
from: path.join(__dirname, "static"), from: path.join(__dirname, 'static'),
to: path.join(__dirname, "dist/static"), to: path.join(__dirname, 'dist/static')
}, }
]), ]),
new webpack.DllReferencePlugin({ new webpack.DllReferencePlugin({
context: process.cwd(), context: process.cwd(),
manifest: require("./public/vendor/vendor-manifest.json"), manifest: require('./public/vendor/vendor-manifest.json')
}), }),
// 将 dll 注入到 生成的 html 模板中 // 将 dll 注入到 生成的 html 模板中
new AddAssetHtmlPlugin({ new AddAssetHtmlPlugin({
// dll文件位置 // dll文件位置
filepath: path.resolve(__dirname, "./public/vendor/*.js"), filepath: path.resolve(__dirname, './public/vendor/*.js'),
// dll 引用路径 // dll 引用路径
publicPath: "./vendor", publicPath: './vendor',
// dll最终输出的目录 // dll最终输出的目录
outputPath: "./vendor", outputPath: './vendor'
}), })
], ]
}, },
chainWebpack: (config) => { chainWebpack: config => {
config.module.rules.delete("svg"); // 删除默认配置中处理svg, config.module.rules.delete('svg') // 删除默认配置中处理svg,
// const svgRule = config.module.rule('svg') // const svgRule = config.module.rule('svg')
// svgRule.uses.clear() // svgRule.uses.clear()
config.module config.module
.rule("svg-sprite-loader") .rule('svg-sprite-loader')
.test(/\.svg$/) .test(/\.svg$/)
.include.add(resolve("src/icons")) // 处理svg目录 .include
.add(resolve('src/icons')) // 处理svg目录
.end() .end()
.use("svg-sprite-loader") .use('svg-sprite-loader')
.loader("svg-sprite-loader") .loader('svg-sprite-loader')
.options({ .options({
symbolId: "icon-[name]", symbolId: 'icon-[name]'
}); })
if (process.env.NODE_ENV === "production") { if (process.env.NODE_ENV === 'production') {
/* config.plugin('compressionPlugin').use(new CompressionPlugin({ /* config.plugin('compressionPlugin').use(new CompressionPlugin({
test: /\.(js|css|less)$/, // 匹配文件名 test: /\.(js|css|less)$/, // 匹配文件名
threshold: 10240, // 对超过10k的数据压缩 threshold: 10240, // 对超过10k的数据压缩
...@@ -104,24 +102,25 @@ module.exports = { ...@@ -104,24 +102,25 @@ module.exports = {
} }
config.module config.module
.rule("icons") .rule('icons')
.test(/\.svg$/) .test(/\.svg$/)
.include.add(resolve("src/deicons")) .include.add(resolve('src/deicons'))
.end() .end()
.use("svg-sprite-loader") .use('svg-sprite-loader')
.loader("svg-sprite-loader") .loader('svg-sprite-loader')
.options({ .options({
symbolId: "[name]", symbolId: '[name]'
}); })
}, },
css: { css: {
loaderOptions: { loaderOptions: {
sass: { sass: {
prependData: `@import "@/style/index.scss"`, prependData: `@import "@/style/index.scss"`
}, }
}, },
extract: { extract: {
ignoreOrder: true, ignoreOrder: true
}, }
}, }
};
}
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论