Commit 2f127339 authored by 何虹's avatar 何虹 💬

升级控件

parent dbc2e6d7
...@@ -16,89 +16,94 @@ ...@@ -16,89 +16,94 @@
> >
<el-table-column v-if='false' type="selection" width="55" fixed="left"></el-table-column> <el-table-column v-if='false' type="selection" width="55" fixed="left"></el-table-column>
<el-table-column type="index" fixed="left" label="索引" ></el-table-column> <el-table-column type="index" fixed="left" label="索引" ></el-table-column>
<el-table-column prop="label" label="标题" fixed="left"> <el-table-column prop="label" label="标题" fixed="left">
<template slot-scope="scope"> <template slot-scope="scope">
<el-input clearable v-model="scope.row.label" size='mini'></el-input> <el-input :disabled='isUserSet' clearable v-model="scope.row.label" size='mini'></el-input>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column prop='lineNumber' label='行号' width='80' v-if="controlType!='queryArea'"> <el-table-column prop="prop" label="字段" width="150" fixed="left">
<template slot-scope="scope">
<el-input disabled clearable v-model="scope.row.prop" size='mini'></el-input>
</template>
</el-table-column>
<el-table-column v-if="isEditZone" prop='lineNumber' label='行号' min-width='80'>
<template slot-scope="scope"> <template slot-scope="scope">
<el-input clearable v-model="scope.row.lineNumber" size='mini'></el-input> <el-input :disabled='isUserSet' clearable v-model="scope.row.lineNumber" size='mini'></el-input>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column prop='lineSerialNumber' label='列号' width='80' v-if='controlType!=="queryArea"'> <el-table-column v-if="isEditZone" prop='lineSerialNumber' label='列号' min-width='80'>
<template slot-scope="scope"> <template slot-scope="scope">
<el-input clearable v-model="scope.row.lineSerialNumber" size='mini'></el-input> <el-input :disabled='isUserSet' clearable v-model="scope.row.lineSerialNumber" size='mini'></el-input>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column prop="columnWidth" label="列宽" width='120' v-if='controlType!=="queryArea"'> <el-table-column v-if='isEditZone' prop="columnWidth" label="列宽" min-width='120'>
<template slot-scope="scope"> <template slot-scope="scope">
<el-input clearable v-model="scope.row.columnWidth" size='mini'></el-input> <el-input :disabled='isUserSet' clearable v-model="scope.row.columnWidth" size='mini'></el-input>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column prop="labelWidth" label="label宽" width='120'> <el-table-column prop="labelWidth" label="label宽" min-width='120'>
<template slot-scope="scope"> <template slot-scope="scope">
<el-input clearable v-model="scope.row.labelWidth" size='mini' placeholder="120"></el-input> <el-input :disabled='isUserSet' clearable v-model="scope.row.labelWidth" size='mini' placeholder="120"></el-input>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column prop="width" label="控件宽" width='120'> <el-table-column prop="width" label="控件宽" min-width='120'>
<template slot-scope="scope"> <template slot-scope="scope">
<el-input clearable v-model="scope.row.width" size='mini' placeholder="173"></el-input> <el-input :disabled='isUserSet' clearable v-model="scope.row.width" size='mini' placeholder="173"></el-input>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column prop="rowspan" label="跨行" v-if='controlType!=="queryArea"' width='80'> <el-table-column prop="rowspan" label="跨行" v-if='controlType!=="queryArea"' width='80'>
<template slot-scope="scope"> <template slot-scope="scope">
<el-input clearable v-model="scope.row.rowspan" size='mini'></el-input> <el-input :disabled='isUserSet' clearable v-model="scope.row.rowspan" size='mini'></el-input>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column prop="colspan" label="跨列" v-if='controlType!=="queryArea"' width='80'> <el-table-column v-if='isEditZone' prop="colspan" label="跨列" min-width='80'>
<template slot-scope="scope"> <template slot-scope="scope">
<el-input clearable v-model="scope.row.colspan" size='mini'></el-input> <el-input :disabled='isUserSet' clearable v-model="scope.row.colspan" size='mini'></el-input>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column prop='isHide' label='隐藏控件' width='100'> <el-table-column prop='isHide' label='隐藏控件' min-width='100'>
<template slot-scope="scope"> <template slot-scope="scope">
<el-switch <el-switch
v-if='isBoolean(scope.row.isHide)' v-if='isBoolean(scope.row.isHide)'
:disabled='isDisabled(scope.row,"isHide")' :disabled='isDisabled(scope.row,"isHide")||isUserEdit'
v-model="scope.row.isHide" v-model="scope.row.isHide"
/> />
<span v-else-if="isAction(scope.row.isHide)">{{'action:'+scope.row.isHide}}</span> <span v-else-if="isAction(scope.row.isHide)">{{'action:'+scope.row.isHide}}</span>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column prop='isHide' label='隐藏label' width='100'> <el-table-column prop='isHide' label='隐藏label' min-width='100'>
<template slot-scope="scope"> <template slot-scope="scope">
<el-switch v-model="scope.row.isHideLabel"> <el-switch :disabled='isUserEdit' v-model="scope.row.isHideLabel">
</el-switch> </el-switch>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column prop='isRequired' label='必填' width='70'> <el-table-column prop='isRequired' label='必填' min-width='70'>
<template slot-scope="scope"> <template slot-scope="scope">
<el-switch <el-switch
v-if='isBoolean(scope.row.isRequired)' v-if='isBoolean(scope.row.isRequired)'
:disabled='isDisabled(scope.row,"isRequired")' :disabled='isDisabled(scope.row,"isRequired")||isUserSet'
v-model="scope.row.isRequired" v-model="scope.row.isRequired"
/> />
<span v-else-if="isAction(scope.row.isRequired)">{{'action:'+scope.row.isRequired}}</span> <span v-else-if="isAction(scope.row.isRequired)">{{'action:'+scope.row.isRequired}}</span>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column v-if='false' prop='isDisabled' label='只读' width='70'> <el-table-column v-if='false' prop='isDisabled' label='只读' min-width='70'>
<template slot-scope="scope"> <template slot-scope="scope">
<el-switch <el-switch
v-if='isBoolean(scope.row.isDisabled)' v-if='isBoolean(scope.row.isDisabled)'
:disabled='isDisabled(scope.row,"isDisabled")' :disabled='isDisabled(scope.row,"isDisabled")||isUserSet'
v-model="scope.row.isDisabled" v-model="scope.row.isDisabled"
/> />
<span v-else-if="isAction(scope.row.isDisabled)">{{'action:'+scope.row.isDisabled}}</span> <span v-else-if="isAction(scope.row.isDisabled)">{{'action:'+scope.row.isDisabled}}</span>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column prop='isMoreSearch' label='更多搜索' width='100' v-if='controlType=="queryArea"'> <el-table-column v-if='isQueryZone' prop='isMoreSearch' label='更多搜索' min-width='100'>
<template slot-scope="scope"> <template slot-scope="scope">
<el-switch v-model="scope.row.isMoreSearch"> <el-switch v-model="scope.row.isMoreSearch">
</el-switch> </el-switch>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column label="操作" width='120' fixed="right"> <el-table-column v-if='isQueryZone' label="操作" min-width='120' fixed="right">
<template slot-scope="scope"> <template slot-scope="scope">
<el-button class="handleBut" size='mini' @click="upGoAsync(scope.$index)">上移</el-button> <el-button class="handleBut" size='mini' @click="upGoAsync(scope.$index)">上移</el-button>
<el-button class="handleBut" size='mini' @click="downGoAsync(scope.$index)">下移</el-button> <el-button class="handleBut" size='mini' @click="downGoAsync(scope.$index)">下移</el-button>
...@@ -150,6 +155,29 @@ export default { ...@@ -150,6 +155,29 @@ export default {
return list return list
} }
}, },
// 用户配置编辑区域禁用
isUserEdit() {
return this.isEditZone && this.isUserSet
},
// 查询+可用
isQueryAdminZoneUsable: function() {
return this.controlType === 'queryArea'
},
isQueryZone: function() {
return this.controlType === 'queryArea'
},
isEditZone: function() {
return this.controlType !== 'queryArea'
},
isAdminEditZone: function() {
return this.isAdminSet && this.controlType !== 'queryArea'
},
isUserSet: function() {
return this.configRole !== '0'
},
isAdminSet: function() {
return this.configRole === '0'
},
configType: function() { configType: function() {
return this.configRole === '0' ? '0' : '1' return this.configRole === '0' ? '0' : '1'
}, },
......
// 折线图和柱状图原始配置和数据 // 折线图和柱状图原始配置和数据
const initLineBar = { const hsLineBar = {
config: { config: {
isTransverse: false, isTransverse: false,
'title': { 'title': {
...@@ -30,11 +30,11 @@ const initLineBar = { ...@@ -30,11 +30,11 @@ const initLineBar = {
} }
}, },
'data': [ 'data': [
'DKN1', '五车间',
'DKN2', '六车间',
'DKN3', '七车间',
'DKN4', '八车间',
'DKN5' '九车间'
] ]
}, },
'yAxis': [ 'yAxis': [
...@@ -125,7 +125,7 @@ const initLineBar = { ...@@ -125,7 +125,7 @@ const initLineBar = {
}, },
{ {
'name': '完成数', 'name': '完成数',
'type': 'bar', type: 'line',
'yAxisIndex': 0, 'yAxisIndex': 0,
'barWidth': '12', 'barWidth': '12',
'data': [], 'data': [],
...@@ -166,51 +166,6 @@ const initLineBar = { ...@@ -166,51 +166,6 @@ const initLineBar = {
'fontSize': 12 'fontSize': 12
}, },
'xData': [] 'xData': []
},
{
'name': 'G04',
'type': 'bar',
'yAxisIndex': 0,
'barWidth': '12',
'stack': '这个值相同的话 就会叠加',
'data': [],
'itemStyle': {
'color': {
'x': 0,
'y': 0,
'x2': 0,
'y2': 1,
'type': 'linear',
'global': false,
'colorStops': [
{
'offset': 0,
'color': '#436EEE'
},
{
'offset': 1,
'color': '#8B2252'
}
]
},
'barBorderRadius': [
10,
10,
0,
0
],
'hsColor': [
'#4fcee4',
'#ab5ee2'
]
},
'label': {
'show': true,
'position': 'top',
'color': '#8888b0',
'fontSize': 12
},
'xData': []
} }
] ]
}, },
...@@ -2506,7 +2461,7 @@ const hsButton = { ...@@ -2506,7 +2461,7 @@ const hsButton = {
} }
} }
const mockData = { const mockData = {
hsLineBar: initLineBar, hsLineBar: hsLineBar,
hsPie: initPie, hsPie: initPie,
hsRadar: initRadar, hsRadar: initRadar,
hsSelectPlus: hsSelectPlus, hsSelectPlus: hsSelectPlus,
......
...@@ -47,12 +47,28 @@ ...@@ -47,12 +47,28 @@
> >
<template slot-scope="scope"> <template slot-scope="scope">
<el-input <el-input
:disabled='isUserSet'
size='mini' size='mini'
v-model="scope.row.label" v-model="scope.row.label"
clearable clearable
> </el-input> > </el-input>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column
prop="prop"
label="字段"
width="150"
fixed="left"
>
<template slot-scope="scope">
<el-input
disabled
clearable
v-model="scope.row.prop"
size='mini'
></el-input>
</template>
</el-table-column>
<el-table-column <el-table-column
prop='topTitle' prop='topTitle'
label='一级标题' label='一级标题'
...@@ -61,6 +77,7 @@ ...@@ -61,6 +77,7 @@
> >
<template slot-scope="scope"> <template slot-scope="scope">
<el-input <el-input
:disabled='isUserSet'
size='mini' size='mini'
v-model="scope.row.topTitle" v-model="scope.row.topTitle"
clearable clearable
...@@ -91,7 +108,7 @@ ...@@ -91,7 +108,7 @@
/> />
</template> </template>
</el-table-column> </el-table-column>
<el-table-column <el-table-column
prop='summarizing' prop='summarizing'
label='是否汇总' label='是否汇总'
> >
...@@ -115,7 +132,7 @@ ...@@ -115,7 +132,7 @@
</el-table-column> </el-table-column>
<el-table-column <el-table-column
v-if='false' v-if='false'
prop='isDisabled' prop='isDisabled'
label='只读' label='只读'
width='70' width='70'
...@@ -137,7 +154,7 @@ ...@@ -137,7 +154,7 @@
<template slot-scope="scope"> <template slot-scope="scope">
<el-switch <el-switch
v-if='isBoolean(scope.row.isRequired)' v-if='isBoolean(scope.row.isRequired)'
:disabled='isDisabled(scope.row,"isRequired")' :disabled='isDisabled(scope.row,"isRequired")||isUserSet'
v-model="scope.row.isRequired" v-model="scope.row.isRequired"
/> />
<span v-else-if="isAction(scope.row.isRequired)">{{'action:'+scope.row.isRequired}}</span> <span v-else-if="isAction(scope.row.isRequired)">{{'action:'+scope.row.isRequired}}</span>
...@@ -217,6 +234,12 @@ export default { ...@@ -217,6 +234,12 @@ export default {
return list return list
} }
}, },
isUserSet: function() {
return this.configRole !== '0'
},
isAdminSet: function() {
return this.configRole === '0'
},
// 0 系统配置 1 用户配置 // 0 系统配置 1 用户配置
configType: function() { configType: function() {
return this.configRole === '0' ? '0' : '1' return this.configRole === '0' ? '0' : '1'
...@@ -227,9 +250,7 @@ export default { ...@@ -227,9 +250,7 @@ export default {
return this.configRole === '0' ? '0' : userInfo.user_id return this.configRole === '0' ? '0' : userInfo.user_id
}, },
getDialogTitle: function() { getDialogTitle: function() {
return this.configRole === '0' return this.configRole === '0' ? '表格设置(系统)' : '表格设置(用户)'
? '表格设置(系统)'
: '表格设置(用户)'
} }
}, },
data() { data() {
...@@ -352,7 +373,7 @@ export default { ...@@ -352,7 +373,7 @@ export default {
} }
}, },
methods: { methods: {
isBooleanDisabled() { isBooleanDisabled(row, prop) {
const isBoolean = this.isBoolean(row[prop]) const isBoolean = this.isBoolean(row[prop])
const isDisabeld = this.isDisabled(row, prop) const isDisabeld = this.isDisabled(row, prop)
return isBoolean && isDisabeld return isBoolean && isDisabeld
......
...@@ -67,7 +67,6 @@ ...@@ -67,7 +67,6 @@
</el-dialog> </el-dialog>
</template> </template>
<script> <script>
import elementUiMinins from '../../ucClass/elementUiMinins'
import left from './left' import left from './left'
import 'codemirror/theme/ambiance.css' import 'codemirror/theme/ambiance.css'
import 'codemirror/lib/codemirror.css' import 'codemirror/lib/codemirror.css'
...@@ -80,7 +79,6 @@ require('codemirror/addon/edit/matchbrackets') ...@@ -80,7 +79,6 @@ require('codemirror/addon/edit/matchbrackets')
require('codemirror/addon/selection/active-line') require('codemirror/addon/selection/active-line')
require('codemirror/addon/hint/show-hint') require('codemirror/addon/hint/show-hint')
export default { export default {
mixins: [elementUiMinins],
name: 'hs-action-set', name: 'hs-action-set',
components: { left }, components: { left },
props: { props: {
......
...@@ -210,25 +210,11 @@ export default { ...@@ -210,25 +210,11 @@ export default {
} else if (buttonList) { } else if (buttonList) {
tempList = buttonList tempList = buttonList
} }
const { dev } = this.getConfigRight() // 非dev权限的隐藏页面配置和action
const user_info = sessionStorage['user_info'] if (!dev) {
if (user_info) { tempList = tempList.filter(
const user_info_json = JSON.parse(user_info) item => item.click !== '$setAction' && item.click !== '$setPageConfig'
const { is_admin } = user_info_json )
if (!is_admin || is_admin === 0) {
// 不是管理员的情况下隐藏页面设置和action设置
tempList = tempList.filter(
item =>
item.click !== '$setAction' && item.click !== '$setPageConfig'
)
}
} else {
if (self !== top && location.hostname !== '0.0.0.0') {
tempList = tempList.filter(
item =>
item.click !== '$setAction' && item.click !== '$setPageConfig'
)
}
} }
return tempList.filter(item => this.showItem(item)) return tempList.filter(item => this.showItem(item))
} }
......
...@@ -53,10 +53,9 @@ export default { ...@@ -53,10 +53,9 @@ export default {
) { return true } ) { return true }
} else { } else {
// 这是在本地开发时使用没有user_info时 // 这是在本地开发时使用没有user_info时
const hostname=location.hostname const hostname = location.hostname
if (top === self && (hostname === '0.0.0.0'||hostname==='localhost')) return true if (top === self && (hostname === '0.0.0.0' || hostname === 'localhost')) return true
if (top !== self && (hostname !== '0.0.0.0'||hostname !== 'localhost')) return false if (top !== self && (hostname !== '0.0.0.0' || hostname !== 'localhost')) return false
} }
}, },
boxEventMouse(event) { boxEventMouse(event) {
......
...@@ -13,9 +13,9 @@ ...@@ -13,9 +13,9 @@
</div> </div>
</template> </template>
<script> <script>
import commonboxUc from './commonboxUc.js' import awakeDrive from '../../ucClass/awakeDrive'
export default { export default {
mixins: [commonboxUc], mixins: [awakeDrive],
props: { props: {
elInfo: {} elInfo: {}
}, },
......
...@@ -42,9 +42,7 @@ ...@@ -42,9 +42,7 @@
</template> </template>
<script> <script>
import elementUiMinins from '../../ucClass/elementUiMinins'
export default { export default {
mixins: [elementUiMinins],
name: 'hs-dialog-dyncform', name: 'hs-dialog-dyncform',
data() { data() {
return { return {
......
...@@ -27,9 +27,7 @@ ...@@ -27,9 +27,7 @@
</el-dialog> </el-dialog>
</template> </template>
<script> <script>
import elementUiMinins from '../../ucClass/elementUiMinins'
export default { export default {
mixins: [elementUiMinins],
name: 'hs-dialog-rejact-prompt-textarea', name: 'hs-dialog-rejact-prompt-textarea',
data() { data() {
return { return {
......
...@@ -50,9 +50,7 @@ ...@@ -50,9 +50,7 @@
</template> </template>
<script> <script>
import elementUiMinins from '../../ucClass/elementUiMinins'
export default { export default {
mixins: [elementUiMinins],
name: 'hs-dialog-table', name: 'hs-dialog-table',
data() { data() {
return { return {
......
...@@ -26,10 +26,9 @@ ...@@ -26,10 +26,9 @@
</div> </div>
</template> </template>
<script> <script>
import ucComponent from '../../ucClass/uc_component' import awakeDrive from '../../ucClass/awakeDrive'
import elementUiMinins from '../../ucClass/elementUiMinins'
export default { export default {
mixins: [ucComponent, elementUiMinins], mixins: [awakeDrive],
name: 'hs-dialog', name: 'hs-dialog',
props: { props: {
visible: {}, visible: {},
......
...@@ -104,26 +104,26 @@ export default { ...@@ -104,26 +104,26 @@ export default {
}, },
computed: { computed: {
contextmenuItems: function() { contextmenuItems: function() {
const isDev = this.getIsDev() const { user, admin, dev } = this.getConfigRight()
const isAdmin = this.getIsAdmin() console.log(this.controlType)
const list = [ const list = [
{ {
label: '配置(用户)', label: '配置(用户)',
isShow: false, isShow: user,
onClick: () => { onClick: () => {
this.userSysSet('1') this.userSysSet('1')
} }
}, },
{ {
label: '配置(系统)', label: '配置(系统)',
isShow: isAdmin, isShow: admin,
onClick: () => { onClick: () => {
this.userSysSet('0') this.userSysSet('0')
} }
}, },
{ {
label: '配置(开发)', label: '配置(开发)',
isShow: isDev, isShow: dev,
onClick: () => { onClick: () => {
this.devSet() this.devSet()
} }
...@@ -185,29 +185,6 @@ export default { ...@@ -185,29 +185,6 @@ export default {
) { return false } ) { return false }
} }
}, },
getIsDev() {
const user_info = sessionStorage['user_info']
if (user_info) {
const user_info_json = JSON.parse(user_info)
const { systemSysDevDb } = user_info_json
if (
systemSysDevDb === true ||
systemSysDevDb === '1' ||
systemSysDevDb === 1
) { return true }
} else {
// 这是在本地开发时使用没有user_info时
const hostname = location.hostname
if (
top === self &&
(hostname === '0.0.0.0' || hostname === 'localhost')
) { return true }
if (
top !== self &&
(hostname !== '0.0.0.0' || hostname !== 'localhost')
) { return false }
}
},
onContextmenu(event) { onContextmenu(event) {
this.$contextmenu({ this.$contextmenu({
items: this.contextmenuItems, items: this.contextmenuItems,
......
...@@ -16,7 +16,7 @@ ...@@ -16,7 +16,7 @@
{{item.label}} {{item.label}}
</label> </label>
<div <div
class="el-form-item__label" class="el-form-item__label controlItem"
:style="{width:item.width+'px','height':item.height+'px'}" :style="{width:item.width+'px','height':item.height+'px'}"
> >
<childItem <childItem
...@@ -76,4 +76,7 @@ export default { ...@@ -76,4 +76,7 @@ export default {
.labelDefaultWidth { .labelDefaultWidth {
width: 120px; width: 120px;
} }
.controlItem{
padding: 2px 12px 2px 0;
}
</style> </style>
...@@ -24,8 +24,7 @@ ...@@ -24,8 +24,7 @@
</template> </template>
<template v-else-if="item.type==='elDatePicker'"> <template v-else-if="item.type==='elDatePicker'">
<el-date-picker <el-date-picker
v-click-outside="clickoutsideDom" v-click-outside="clickoutsideDom1"
@blur='blur'
ref='currentDom' ref='currentDom'
clearable clearable
style="width:100%" style="width:100%"
...@@ -428,8 +427,14 @@ export default { ...@@ -428,8 +427,14 @@ export default {
} }
} }
} }
},
mounted() {
}, },
methods: { methods: {
clickoutsideDom1() {
this.hidePicker()
},
clickoutsideDom() { clickoutsideDom() {
this.hidePicker() this.hidePicker()
}, },
......
...@@ -84,16 +84,10 @@ ...@@ -84,16 +84,10 @@
</div> </div>
</template> </template>
<script> <script>
import elementUiMinins from '../../ucClass/elementUiMinins'
import asyncFormItem from './dyncFormItemComponent' import asyncFormItem from './dyncFormItemComponent'
import childItem from './dyncFormItemComponentChild' import childItem from './dyncFormItemComponentChild'
import ClickOutside from 'vue-click-outside'
export default { export default {
mixins: [elementUiMinins],
name: 'dyncFormItemComponentQuery', name: 'dyncFormItemComponentQuery',
directives: {
ClickOutside
},
components: { components: {
asyncFormItem, asyncFormItem,
childItem childItem
......
import { EleResize } from '../../funTools/self-adaption/ezresize.js' import { EleResize } from '../../funTools/self-adaption/ezresize.js'
import echarts from 'echarts' import * as echarts from 'echarts'
export default { export default {
data() { data() {
return { return {
......
...@@ -48,6 +48,7 @@ export default { ...@@ -48,6 +48,7 @@ export default {
window.removeEventListener('message', this.handleMessage, false) window.removeEventListener('message', this.handleMessage, false)
}, },
handleMessage(message) { handleMessage(message) {
if (!message.data) return
if (message.data.type === 'popSaveData') { if (message.data.type === 'popSaveData') {
this.ok(message.data.data) this.ok(message.data.data)
} else if (message.data.type === 'isReadeyWindow') { } else if (message.data.type === 'isReadeyWindow') {
......
<template> <template>
<div class="box" :style="{width:configData.width||'150px',height:configData.height||'150px'}"> <div
class="box"
:style="{width:configData.width||'150px',height:configData.height||'150px'}"
>
<template v-if='!this.value'>
<img
class="imgStyle"
:src='defaultImg'
:width="150"
:height="150"
>
</template>
<template v-else>
<img <img
class="imgStyle" class="imgStyle"
:src='innerValue' :src='innerValue'
:width="configData.width||150" :width="configData.width||150"
:height="configData.height||150" :height="configData.height||150"
:onerror="errorImg01" :onerror="errorImg01"
> >
<div class="icon_box"> </template>
<i
class="el-icon-close closeIcon" <div class="icon_box">
@click="deleteImg" <i
></i> class="el-icon-close closeIcon"
<i @click="deleteImg"
class="el-icon-upload2" ></i>
@click="upload_dialogVisible=true" <i
></i> class="el-icon-upload2"
</div> @click="upload_dialogVisible=true"
<el-dialog ></i>
</div>
<el-dialog
top='10px' top='10px'
:center='true' :center='true'
title="上传" title="上传"
...@@ -27,13 +41,23 @@ ...@@ -27,13 +41,23 @@
@close='closeImgDialog' @close='closeImgDialog'
> >
<div v-if='upload_dialogVisible'> <div v-if='upload_dialogVisible'>
<img <template v-if='!upload_src&&!value'>
class="imgStyle" <img
width="200" class="imgStyle"
height="200" :src='defaultImg'
:src='dialogImgSrc' :width="150"
:onerror="errorImg01" :height="150"
> >
</template>
<template v-else>
<img
class="imgStyle"
:src='dialogImgSrc'
width="200"
height="200"
:onerror="errorImg01"
>
</template>
<div class="file"> <div class="file">
选择图片 选择图片
<input <input
...@@ -60,7 +84,7 @@ ...@@ -60,7 +84,7 @@
>确 定</el-button> >确 定</el-button>
</span> </span>
</el-dialog> </el-dialog>
</div> </div>
</template> </template>
<script> <script>
...@@ -81,7 +105,7 @@ export default { ...@@ -81,7 +105,7 @@ export default {
return this.value return this.value
} else { } else {
const appCode = const appCode =
(this.configData && this.configData.appCode) || this.appCode (this.configData && this.configData.appCode) || this.appCode
const userInfo = this.getUserInfo() const userInfo = this.getUserInfo()
const tenant = userInfo.tenant || '' const tenant = userInfo.tenant || ''
const src = `FILE_RESOURCE_PROXY/file/${appCode}/${this.value}?tenant_code=${tenant}` const src = `FILE_RESOURCE_PROXY/file/${appCode}/${this.value}?tenant_code=${tenant}`
...@@ -105,11 +129,11 @@ export default { ...@@ -105,11 +129,11 @@ export default {
accept: 'image/*', accept: 'image/*',
width: 200, width: 200,
height: 200 height: 200
} },
defaultImg: require('./default.png')
} }
}, },
methods: { methods: {
closeImgDialog() { closeImgDialog() {
this.upload_src = '' this.upload_src = ''
}, },
...@@ -155,7 +179,8 @@ export default { ...@@ -155,7 +179,8 @@ export default {
const res_data = res && res.data const res_data = res && res.data
if (Array.isArray(res_data) && res_data.length) { if (Array.isArray(res_data) && res_data.length) {
const file_result = res_data[0] const file_result = res_data[0]
if (file_result.Sucess === false) { // fileResouce 出错会抛出错误,但是code是200,所以要再次判断结果 if (file_result.Sucess === false) {
// fileResouce 出错会抛出错误,但是code是200,所以要再次判断结果
this.$message.error(file_result.Error) this.$message.error(file_result.Error)
return return
} }
...@@ -176,7 +201,7 @@ export default { ...@@ -176,7 +201,7 @@ export default {
} }
</script> </script>
<style scoped> <style scoped>
.box{ .box {
display: flex; display: flex;
flex-direction: column; flex-direction: column;
} }
...@@ -223,7 +248,7 @@ export default { ...@@ -223,7 +248,7 @@ export default {
display: flex; display: flex;
justify-content: flex-end; justify-content: flex-end;
} }
.imgStyle{ .imgStyle {
border: 1px solid #c1c1c1; border: 1px solid #c1c1c1;
} }
</style> </style>
...@@ -6,6 +6,7 @@ ...@@ -6,6 +6,7 @@
>{{configData.title}}</div> >{{configData.title}}</div>
<div class="inputCurr"> <div class="inputCurr">
<el-input-number <el-input-number
ref='currentRef'
@focus="selectContent($event)" @focus="selectContent($event)"
:size='configData.size' :size='configData.size'
@keyup.enter.native="submitInput" @keyup.enter.native="submitInput"
...@@ -101,13 +102,20 @@ export default { ...@@ -101,13 +102,20 @@ export default {
this.execAction(changeed, value) this.execAction(changeed, value)
}, },
submitInput(val) { submitInput(val) {
const { entered } = this.configData const { entered, enterToNextRow } = this.configData
this.execAction(entered, val, this.elInfo) this.execAction(entered, val, this.elInfo)
this.$emit('enterInput', this.innerValue, this.elInfo) this.$emit('enterInput', this.innerValue, this.elInfo)
// 判断一下配置 中如果有配置enter 换行到下一行 则发出 enterNextToRow
if (enterToNextRow) {
this.$emit('enterToNextRow', this.innerValue)
}
}, },
getNumber(num) { getNumber(num) {
if (num === undefined) return if (num === undefined) return
return Number(num) return Number(num)
},
focus() {
this.$refs.currentRef.focus()
} }
} }
} }
......
...@@ -12,7 +12,6 @@ ...@@ -12,7 +12,6 @@
:size='configData.size' :size='configData.size'
@clear='clear' @clear='clear'
@keyup.enter.native="submitInput" @keyup.enter.native="submitInput"
@input='inputFun' @input='inputFun'
@change='changeFun' @change='changeFun'
@blur="inputBlur" @blur="inputBlur"
...@@ -212,9 +211,13 @@ export default { ...@@ -212,9 +211,13 @@ export default {
} }
}, },
submitInput(val) { submitInput(val) {
const { entered } = this.configData const { entered, enterToNextRow } = this.configData
this.execAction(entered, val, this.elInfo) this.execAction(entered, val, this.elInfo)
this.$emit('enterInput', this.innerValue, this.elInfo) this.$emit('enterInput', this.innerValue, this.elInfo)
// 判断一下配置 中如果有配置enter 换行到下一行 则发出 enterNextToRow
if (enterToNextRow) {
this.$emit('enterToNextRow', this.innerValue)
}
} }
} }
} }
......
...@@ -14,10 +14,13 @@ class DataTool { ...@@ -14,10 +14,13 @@ class DataTool {
const { name } = item const { name } = item
// 按照x轴(xData)的顺序进行取值 // 按照x轴(xData)的顺序进行取值
const sdata = gp[name] const sdata = gp[name]
if (!sdata) return
const list = [] const list = []
xData.forEach(x => { xData.forEach(x => {
const targetX = sdata.find(sx => sx.sName === x) const targetX = sdata.find(sx => sx.sName === x)
list.push(targetX.dValue) if (targetX) {
list.push(targetX.dValue)
}
}) })
item.data = list item.data = list
}) })
......
import { EleResize } from '../../funTools/self-adaption/ezresize.js' import { EleResize } from '../../funTools/self-adaption/ezresize.js'
import echarts from 'echarts' import * as echarts from 'echarts'
export default { export default {
data() { data() {
return { return {
...@@ -30,6 +30,7 @@ export default { ...@@ -30,6 +30,7 @@ export default {
}, },
offEchartsListener(id, handle) { offEchartsListener(id, handle) {
const dom = document.getElementById(id) const dom = document.getElementById(id)
if (!dom) return
EleResize.on(dom, handle) EleResize.on(dom, handle)
} }
} }
......
...@@ -13,12 +13,11 @@ ...@@ -13,12 +13,11 @@
</template> </template>
<script> <script>
import mockData from '../../common/initDbConfigDataJson' import mockData from '../../common/initDbConfigDataJson'
import ucComponent from '../../ucClass/uc_component' import awakeDrive from '../../ucClass/awakeDrive'
import echartResize from './echartResize' import echartResize from './echartResize'
import _ from 'lodash'
import DataTool from './dataTool' import DataTool from './dataTool'
export default { export default {
mixins: [ucComponent, echartResize], mixins: [awakeDrive, echartResize],
name: 'hs-line-bar', name: 'hs-line-bar',
props: { props: {
elInfo: { elInfo: {
...@@ -27,17 +26,8 @@ export default { ...@@ -27,17 +26,8 @@ export default {
return {} return {}
} }
}, },
config:{}, config: {},
data:{}, data: {},
allSourceData: {
type: Object,
default() {
return {
config: {},
sourceData: []
}
}
},
mock: { mock: {
type: Boolean, type: Boolean,
default: false default: false
...@@ -45,31 +35,17 @@ export default { ...@@ -45,31 +35,17 @@ export default {
echartType: { echartType: {
type: String, type: String,
default: 'hsLineBar' default: 'hsLineBar'
},
layout: {},
jsoneditorCloseAfter: {
type: Function
},
jsoneditorOpenAfter: {
type: Function
} }
}, },
watch: { watch: {
data: { data: {
handler: function(newVal, oldVal) { handler() {
this.$nextTick(() => { this.dEcharts()
const newVal_copy = _.cloneDeep(newVal)
if (Object.keys(this.config).length && data) {
this.drowEchart(newVal_copy)
} else {
this.initMockData()
}
})
}, },
deep: true, immediate: true,
immediate: true // 默认立即触发一次 deep: true
} }
}, },
data() { data() {
return { return {
...@@ -86,19 +62,27 @@ export default { ...@@ -86,19 +62,27 @@ export default {
} }
}, },
mounted() { mounted() {
// this.initMockData()
}, },
methods: { methods: {
dEcharts() {
if (this.config && Object.keys(this.config).length) {
this.generateEcharts(this.config, this.data)
} else {
this.initMockData()
}
},
initMockData() { initMockData() {
this.initMockLineBar(this.elInfo.el) this.initMockLineBar(this.elInfo.el)
}, },
// 折线图的模拟数据 // 折线图的模拟数据
initMockLineBar(type) { initMockLineBar(type) {
const mockData_ = mockData[type] const mockData_ = mockData[type]
this.drowEchart(mockData_.config,mockData_.sourceData) this.generateEcharts(mockData_.config, mockData_.data)
}, },
drowEchart(config,data) { generateEcharts(config, data) {
this.initEachart() this.initEachart()
const option = this.dealLine(config,data) const option = this.dealLine(config, data)
this.draw_complate_options(option) this.draw_complate_options(option)
}, },
initEachart() { initEachart() {
...@@ -123,10 +107,10 @@ export default { ...@@ -123,10 +107,10 @@ export default {
}) })
// 新增双击事件 // 新增双击事件
}, },
dealLine(config,data) { dealLine(config, data) {
const tool = new DataTool() const tool = new DataTool()
const { el } = this.elInfo const { el } = this.elInfo
if (el === 'hsLine') { // 折线图 if (el === 'hsLineBar') { // 折线图
return tool.processDataLine(config, data) return tool.processDataLine(config, data)
} else if (el === 'hsBar') { // 柱状图 } else if (el === 'hsBar') { // 柱状图
return tool.processDataBar(config, data) return tool.processDataBar(config, data)
......
...@@ -20,6 +20,8 @@ ...@@ -20,6 +20,8 @@
</template> </template>
<template v-else-if="item.showType==='hsInput'"> <template v-else-if="item.showType==='hsInput'">
<hs-input <hs-input
@enterToNextRow="enterToNextRow"
@enterInput='enterEvent'
:prop='item.prop' :prop='item.prop'
v-model="formParms[item.prop]" v-model="formParms[item.prop]"
:config='item.config' :config='item.config'
...@@ -117,6 +119,8 @@ ...@@ -117,6 +119,8 @@
</template> </template>
<template v-else-if="item.showType==='hsInputNumber'"> <template v-else-if="item.showType==='hsInputNumber'">
<hs-input-number <hs-input-number
ref='currentRef'
@enterToNextRow="enterToNextRow"
:prop='item.prop' :prop='item.prop'
v-model="formParms[item.prop]" v-model="formParms[item.prop]"
:config='item.config' :config='item.config'
...@@ -256,9 +260,12 @@ export default { ...@@ -256,9 +260,12 @@ export default {
}, },
name: 'dyncFormItemComponentChild_', name: 'dyncFormItemComponentChild_',
props: { props: {
prop: {},
item: {}, item: {},
formParms: {}, formParms: {},
disabled: {} disabled: {},
index: {},
focusRow: {}
}, },
watch: { watch: {
item: { item: {
...@@ -305,6 +312,13 @@ export default { ...@@ -305,6 +312,13 @@ export default {
} }
}, },
methods: { methods: {
enterToNextRow() {
this.$emit('enterToNextRow', this.item.prop, this.index)
},
enterEvent() {
// 输入框enter事件
this.$emit('enterInput', this.item.prop, this.index)
},
hidePicker() { hidePicker() {
// console.log(this.item.showType) // console.log(this.item.showType)
// if (this.$refs.currentDom && this.$refs.currentDom.hidePicker) { // if (this.$refs.currentDom && this.$refs.currentDom.hidePicker) {
...@@ -313,6 +327,9 @@ export default { ...@@ -313,6 +327,9 @@ export default {
}, },
enterInput(val) { enterInput(val) {
this.$emit('enterInput', val) this.$emit('enterInput', val)
},
controlFocus() {
this.$refs.currentRef.focus()
} }
} }
} }
......
...@@ -2,9 +2,8 @@ ...@@ -2,9 +2,8 @@
<div <div
class="_hs_table" class="_hs_table"
ref='boxtable' ref='boxtable'
@contextmenu.prevent="onContextmenu"
> >
<div class='titleToolbox'> <div class='titleToolbox' @contextmenu.prevent="onContextmenu">
<div v-show="tableConfig.title">{{tableConfig.title}}</div> <div v-show="tableConfig.title">{{tableConfig.title}}</div>
<div <div
v-show="tableConfig.toolDirection==='row'&&tableConfig.isShowTools" v-show="tableConfig.toolDirection==='row'&&tableConfig.isShowTools"
...@@ -17,6 +16,7 @@ ...@@ -17,6 +16,7 @@
</div> </div>
</div> </div>
<span <span
@contextmenu.prevent="onContextmenu"
v-show="!tableConfig.toolDirection||tableConfig.toolDirection==='column'&&tableConfig.isShowTools" v-show="!tableConfig.toolDirection||tableConfig.toolDirection==='column'&&tableConfig.isShowTools"
class="iconTool" class="iconTool"
> >
...@@ -69,15 +69,6 @@ ...@@ -69,15 +69,6 @@
<rowTable :rowTable='scope.row._childTable'></rowTable> <rowTable :rowTable='scope.row._childTable'></rowTable>
</template> </template>
</u-table-column> </u-table-column>
<!-- <u-table-column
v-if='tableConfig.expandChild'
:key="index"
type="expand"
>
<template slot-scope="props">
<rowTable :rowTable='props.row._childTable'></rowTable>
</template>
</u-table-column> -->
<u-table-column <u-table-column
v-else-if="columnItem.showType==='index'" v-else-if="columnItem.showType==='index'"
:key="index" :key="index"
...@@ -118,6 +109,7 @@ ...@@ -118,6 +109,7 @@
:class="rowCellBoolean(scope.row[columnItem.prop])" :class="rowCellBoolean(scope.row[columnItem.prop])"
></i> ></i>
<childItem <childItem
:ref='columnItem.prop+scope.$index'
v-else v-else
:disabled='disabled' :disabled='disabled'
:editable='editable' :editable='editable'
...@@ -125,6 +117,9 @@ ...@@ -125,6 +117,9 @@
:item='columnItem' :item='columnItem'
:prop="columnItem.prop" :prop="columnItem.prop"
:formParms='scope.row' :formParms='scope.row'
:index='scope.$index'
:focusRow='focusRow'
@enterToNextRow='enterToNextRow'
> >
</childItem> </childItem>
</template> </template>
...@@ -479,7 +474,8 @@ export default { ...@@ -479,7 +474,8 @@ export default {
click: 'devSet' click: 'devSet'
} }
], ],
targetDom: null targetDom: null,
focusRow: null
} }
}, },
watch: { watch: {
...@@ -502,12 +498,11 @@ export default { ...@@ -502,12 +498,11 @@ export default {
}, },
computed: { computed: {
contextmenuItems: function() { contextmenuItems: function() {
const isDev = this.getIsDev() const { user, admin, dev } = this.getConfigRight()
const isAdmin = this.getIsAdmin()
const list = [ const list = [
{ {
label: '配置(用户)', label: '配置(用户)',
isShow: false, isShow: user,
onClick: () => { onClick: () => {
// this.userSysSet('1') // this.userSysSet('1')
this.userSysTableColumnSet('1') this.userSysTableColumnSet('1')
...@@ -515,7 +510,7 @@ export default { ...@@ -515,7 +510,7 @@ export default {
}, },
{ {
label: '配置(系统)', label: '配置(系统)',
isShow: isAdmin, isShow: admin,
onClick: () => { onClick: () => {
// this.userSysSet('0') // this.userSysSet('0')
this.userSysTableColumnSet('0') this.userSysTableColumnSet('0')
...@@ -523,7 +518,7 @@ export default { ...@@ -523,7 +518,7 @@ export default {
}, },
{ {
label: '配置(开发)', label: '配置(开发)',
isShow: isDev, isShow: dev,
onClick: () => { onClick: () => {
this.tableColumnSet() this.tableColumnSet()
// this.devSet() // this.devSet()
...@@ -606,6 +601,17 @@ export default { ...@@ -606,6 +601,17 @@ export default {
this.targetDom = this.$refs.boxtable this.targetDom = this.$refs.boxtable
}, },
methods: { methods: {
enterToNextRow(prop, index) {
const p1 = prop + '' + (index + 1)
if (this.$refs[p1]) {
this.$refs[p1][0].$children[0].$children[0].$children[0].$children[0].focus()
// setTimeout(() => {
// }, 500)
this.$refs.plTable.setCurrentRow(this.tableData[index + 1])
this.emitSetCurrentRow(this.tableData[index + 1])
}
},
getSpanArr(data, spanArrConfig) { getSpanArr(data, spanArrConfig) {
spanArrConfig.forEach(item => { spanArrConfig.forEach(item => {
const { calculatedColumns } = item const { calculatedColumns } = item
...@@ -673,54 +679,8 @@ export default { ...@@ -673,54 +679,8 @@ export default {
} }
} }
}, },
getIsAdmin() {
const user_info = sessionStorage['user_info']
if (user_info) {
const user_info_json = JSON.parse(user_info)
const { is_admin } = user_info_json
if (is_admin === true || is_admin === '1' || is_admin === 1) return true
} else {
// 这是在本地开发时使用没有user_info时
const hostname = location.hostname
if (
top === self &&
(hostname === '0.0.0.0' || hostname === 'localhost')
) { return true }
if (
top !== self &&
(hostname !== '0.0.0.0' || hostname !== 'localhost')
) { return false }
}
},
getIsDev() {
const user_info = sessionStorage['user_info']
if (user_info) {
const user_info_json = JSON.parse(user_info)
const { systemSysDevDb } = user_info_json
if (
systemSysDevDb === true ||
systemSysDevDb === '1' ||
systemSysDevDb === 1
) {
return true
} else {
return false
}
} else {
// 这是在本地开发时使用没有user_info时
const hostname = location.hostname
if (
top === self &&
(hostname === '0.0.0.0' || hostname === 'localhost')
) { return true }
if (
top !== self &&
(hostname !== '0.0.0.0' || hostname !== 'localhost')
) { return false }
}
},
onContextmenu(event) { onContextmenu(event) {
event.preventDefault() // 阻止元素的默认行为
this.$contextmenu({ this.$contextmenu({
items: this.contextmenuItems, items: this.contextmenuItems,
event, event,
...@@ -803,17 +763,24 @@ export default { ...@@ -803,17 +763,24 @@ export default {
'<span class="caret-wrapper"><i class="sort-caret ascending"></i><i class="sort-caret descending"></i></span>' '<span class="caret-wrapper"><i class="sort-caret ascending"></i><i class="sort-caret descending"></i></span>'
} }
return h( return h(
'span', 'div',
{ {
style: {
width: '100%',
height: '100%'
},
domProps: { domProps: {
innerHTML: innerHtml innerHTML: innerHtml
}, },
on: { on: {
// click: this.ascendingClick contextmenu: this.onContextmenu
} }
}, },
[h('span')] [h('div')]
) )
},
test() {
}, },
getTableHandleColumns(row) { getTableHandleColumns(row) {
const list = this.dealWithHandleColumns() const list = this.dealWithHandleColumns()
...@@ -933,20 +900,26 @@ export default { ...@@ -933,20 +900,26 @@ export default {
return newList.filter(item => item.isShow) return newList.filter(item => item.isShow)
}, },
handleInnerSetItem(newList) { handleInnerSetItem(newList) {
const { user, admin, dev } = this.getConfigRight()
// 用户配置
const target_userColumnSet = newList.find(
item => item.click === '$userTableColumnSet'
)
if (target_userColumnSet && !user) {
target_userColumnSet.isShow = false
}
// 开发配置 // 开发配置
const isDev = this.getIsDev()
const target_devColumnSet = newList.find( const target_devColumnSet = newList.find(
item => item.click === '$tableColumnSet' item => item.click === '$tableColumnSet'
) )
if (target_devColumnSet && !isDev) { if (target_devColumnSet && !dev) {
target_devColumnSet.isShow = false target_devColumnSet.isShow = false
} }
// 系统配置 // 系统配置
const isAdmin = this.getIsAdmin()
const target_sysColumnSet = newList.find( const target_sysColumnSet = newList.find(
item => item.click === '$sysTableColumnSet' item => item.click === '$sysTableColumnSet'
) )
if (target_sysColumnSet && !isAdmin) { if (target_sysColumnSet && !admin) {
target_sysColumnSet.isShow = false target_sysColumnSet.isShow = false
} }
}, },
......
...@@ -153,7 +153,7 @@ function getTableColums(colums, allColumns) { ...@@ -153,7 +153,7 @@ function getTableColums(colums, allColumns) {
colums.forEach(item => { colums.forEach(item => {
if (item.prop && item.prop.includes('*')) { if (item.prop && item.prop.includes('*')) {
const dynamicColumns = filterDynamicColumns(allColumns, item.prop, colums) const dynamicColumns = filterDynamicColumns(allColumns, item.prop, colums)
const { showType, isDisabled, isRequired, fixed, isSort, width, control_name, elInfo, allSourceData } = item const { showType, isDisabled, isRequired, fixed, isSort, width, control_name, elInfo, config, data } = item
dynamicColumns.forEach(fieldName => { dynamicColumns.forEach(fieldName => {
if (addedColumn.includes(fieldName)) { if (addedColumn.includes(fieldName)) {
return return
...@@ -195,7 +195,8 @@ function getTableColums(colums, allColumns) { ...@@ -195,7 +195,8 @@ function getTableColums(colums, allColumns) {
width, width,
control_name, control_name,
elInfo, elInfo,
allSourceData config,
data
}) })
} }
}) })
......
...@@ -393,7 +393,7 @@ export default { ...@@ -393,7 +393,7 @@ export default {
<style scoped> <style scoped>
.selectCurr { .selectCurr {
overflow: scroll; overflow-x: auto;
} }
.noneStyle >>> .el-input__inner { .noneStyle >>> .el-input__inner {
background: inherit; background: inherit;
...@@ -417,4 +417,9 @@ export default { ...@@ -417,4 +417,9 @@ export default {
display: flex; display: flex;
justify-content: flex-end; justify-content: flex-end;
} }
.selectCurr >>> .el-tag{
height: 25px;
padding: 0;
line-height: 25px;
}
</style> </style>
...@@ -32,9 +32,7 @@ ...@@ -32,9 +32,7 @@
</el-dialog> </el-dialog>
</template> </template>
<script> <script>
import elementUiMinins from '../../ucClass/elementUiMinins'
export default { export default {
mixins:[elementUiMinins],
name: 'hs-upload-excel', name: 'hs-upload-excel',
props: { props: {
visible: { visible: {
......
import { v1 as uuidv1 } from 'uuid' import { v1 as uuidv1 } from 'uuid'
import hsrightCommon from './hsrightCommon'
export default { export default {
data () { mixins: [hsrightCommon],
data() {
return { return {
elId: '', elId: '',
outBoxDom: null, outBoxDom: null,
jsoneditorVisible: false jsoneditorVisible: false
} }
}, },
created () { created() {
this.initElid() this.initElid()
}, },
mounted () { mounted() {
this.initElid() this.initElid()
const { dev } = this.getConfigRight()
if (!dev) return
setTimeout(() => { setTimeout(() => {
this.showEditJsonDialog() this.showEditJsonDialog()
}, 2000) }, 2000)
}, },
destroyed () { destroyed() {
if (this.outBoxDom) { if (this.outBoxDom) {
this.outBoxDom.removeEventListener('mousedown', this.boxEventMouse) this.outBoxDom.removeEventListener('mousedown', this.boxEventMouse)
this.outBoxDom = null this.outBoxDom = null
} }
this.chart = null this.chart = null
}, },
beforeDestroy () { beforeDestroy() {
clearInterval(this.timer)// 清除定时器 clearInterval(this.timer)// 清除定时器
this.timer = null this.timer = null
if (this.chart) { if (this.chart) {
...@@ -33,20 +37,23 @@ export default { ...@@ -33,20 +37,23 @@ export default {
} }
}, },
methods: { methods: {
initElid () { showJsonEditDialog() {
this.jsoneditorVisible = true
},
initElid() {
if (!this.elId) { if (!this.elId) {
this.elId = uuidv1() // 获取随机id this.elId = uuidv1() // 获取随机id
} }
}, },
boxEventMouse (event) { boxEventMouse(event) {
const that = this const that = this
event.stopPropagation() event.stopPropagation()
if (event.shiftKey && event.altKey && !event.ctrlKey) { if (event.shiftKey && event.altKey && !event.ctrlKey) {
that.jsoneditorVisible = true that.showJsonEditDialog()
} }
}, },
// 弹出可编辑的弹框 // 弹出可编辑的弹框
showEditJsonDialog () { showEditJsonDialog() {
this.outBoxDom = document.getElementById(this.elId) this.outBoxDom = document.getElementById(this.elId)
this.outBoxDom && this.outBoxDom.addEventListener('mousedown', this.boxEventMouse) this.outBoxDom && this.outBoxDom.addEventListener('mousedown', this.boxEventMouse)
} }
......
export default {
bind(el, binding, vnode) {
el.handler = function(e) {
if (el.contains(e.target)) {
return false
}
// vnode.context[binding.expression] = false
binding.value()
}
el.stopProp = function(event) {
event.stopPropagation()
}
el.addEventListener('click', el.stopProp)
document.body.addEventListener('click', el.handler)
},
unbind(el, binding) {
el.removeEventListener('click', el.stopProp)
document.body.removeEventListener('click', el.handler)
},
install(Vue) {
Vue.directive('clickoutside', {
bind: this.bind,
unbind: this.unbind
})
}
}
import Clickoutside from './clickoutside' import Clickoutside from './clickoutside'
import hsrightCommon from './hsrightCommon'
export default { export default {
// mixins:[elementUiMinins], mixins: [hsrightCommon],
directives: { directives: {
ClickOutside: Clickoutside ClickOutside: Clickoutside
}, },
......
import {
Button,
ButtonGroup,
Dropdown,
DropdownMenu,
DropdownItem,
Dialog,
Input,
Carousel,
CarouselItem,
Cascader,
Checkbox,
CheckboxGroup,
TimePicker,
DatePicker,
Row,
Divider,
Popover,
Link,
Progress,
RadioGroup,
Radio,
Rate,
Switch,
Table,
Tabs,
TablePane,
Tag,
Tree,
Upload
} from 'element-ui'
export default {
components: {
'el-dropdown-menu': DropdownMenu,
'el-dropdown': Dropdown,
'el-dropdown-item':DropdownItem,
'el-button': Button,
'el-button-group': ButtonGroup,
'el-dialog': Dialog,
'el-input': Input,
'el-carousel': Carousel,
'el-carousel-item': CarouselItem,
'el-cascader': Cascader,
'el-checkbox': Checkbox,
'el-checkbox-group': CheckboxGroup,
'el-time-picker': TimePicker,
'el-date-picker': DatePicker,
'el-row': Row,
'el-divider': Divider,
'el-popover': Popover,
'el-link': Link,
'el-progress': Progress,
'el-radio-group': RadioGroup,
'el-radio': Radio,
'el-rate': Rate,
'el-switch': Switch,
'el-table': Table,
'el-tabs': Tabs,
'el-tab-pane': TablePane,
'el-tag': Tag,
'el-tree': Tree,
'el-upload':Upload
},
}
export default {
methods: {
getConfigRight() {
const user_info = sessionStorage['user_info']
const obj = {
user: true,
dev: true,
admin: true
}
if (user_info) {
const user_info_json = JSON.parse(user_info)
const { systemSysDevDb, show_userSet, is_admin } = user_info_json
// const props = ['systemSysDevDb', 'show_userSet', 'is_admin']
if (
systemSysDevDb === true ||
systemSysDevDb === '1' ||
systemSysDevDb === 1
) { obj.dev = true } else {
obj.dev = false
}
if (
show_userSet === true ||
show_userSet === '1' ||
show_userSet === 1 ||
show_userSet === undefined
) { obj.user = true } else {
obj.user = false
}
if (
is_admin === true ||
is_admin === '1' ||
is_admin === 1
) { obj.admin = true } else {
obj.admin = false
}
} else {
// 这是在本地开发时使用没有user_info时
const hostname = location.hostname
if (
top === self &&
(hostname === '0.0.0.0' || hostname === 'localhost')
) {
obj.dev = true
obj.user = true
obj.admin = true
}
if (
top !== self &&
(hostname !== '0.0.0.0' || hostname !== 'localhost')
) {
obj.dev = false
obj.user = false
obj.admin = false
}
}
return obj
}
}
}
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