bin-code-editor=>bin-ace-editor

This commit is contained in:
aixianling
2023-02-01 14:59:50 +08:00
parent d4d662a201
commit d0965fddfe
2 changed files with 313 additions and 308 deletions

View File

@@ -63,7 +63,8 @@
</div>
</div>
</div>
<div class="layout-config__group" v-if="options.dataType !== 'staticData' && options.type === 'monitor' && (options.monitorType === 'cmcc' || options.monitorType === 'slw')">
<div class="layout-config__group"
v-if="options.dataType !== 'staticData' && options.type === 'monitor' && (options.monitorType === 'cmcc' || options.monitorType === 'slw')">
<h2>字段设置</h2>
<div class="layout-config__item">
<label>监控视频</label>
@@ -97,7 +98,8 @@
<div class="layout-config__item">
<label>Y轴设置</label>
<div class="layout-config__item--right">
<el-select size="mini" multiple :multiple-limit="options.type.indexOf('pie') > -1 ? 1 : 100" v-model="options.dataY" collapse-tags placeholder="请选择Y轴" @change="onChooseChange">
<el-select size="mini" multiple :multiple-limit="options.type.indexOf('pie') > -1 ? 1 : 100" v-model="options.dataY" collapse-tags placeholder="请选择Y轴"
@change="onChooseChange">
<el-option
v-for="(item, index) in keys"
:key="index"
@@ -112,13 +114,13 @@
</template>
<script>
import CodeEditor from 'bin-ace-editor'
require('brace/mode/json')
require('brace/snippets/json')
require('brace/theme/github')
require('brace/theme/monokai')
import CodeEditor from 'bin-ace-editor'
import 'brace/mode/json'
import 'brace/snippets/json';
import 'brace/theme/github';
import 'brace/theme/monokai';
export default {
export default {
name: 'dataConfig',
props: {
@@ -128,7 +130,7 @@
params: Object,
},
data () {
data() {
return {
dataTypes: [
{
@@ -159,7 +161,7 @@
CodeEditor
},
mounted () {
mounted() {
this.getDataList()
if ((this.options.dataY && this.options.dataY.length && this.options.dataX) || this.options.type === 'monitor') {
@@ -190,12 +192,12 @@
},
methods: {
showEditor () {
showEditor() {
this.json = JSON.stringify(this.options.staticData, null, 2)
this.isShowEditor = true
},
onMoniterId (e) {
onMoniterId(e) {
this.instance.post(`/app/appzyvideoequipment/getWebSdkUrl?deviceId=${e}`).then(res => {
if (res.code == 0) {
this.options.src = JSON.parse(res.data).url
@@ -203,7 +205,7 @@
})
},
getDataList () {
getDataList() {
this.instance.post(`/app/appdiylargescreen/allDatasourceByPage`, null, {
params: {
current: 1,
@@ -216,7 +218,7 @@
})
},
onApiChange () {
onApiChange() {
this.options.dataX = ''
this.options.dataY = []
this.instance.post(this.options.api).then(res => {
@@ -260,7 +262,7 @@
})
},
onChooseChange () {
onChooseChange() {
let arr = []
if (this.options.dataX && this.options.dataY.length) {
this.list.forEach(item => {
@@ -278,7 +280,7 @@
}
},
onDataChange (e) {
onDataChange(e) {
this.options.dataX = ''
this.options.dataY = []
this.instance.post(`/app/appdiylargescreen/statisticsByLsid?id=${e}`).then(res => {
@@ -316,17 +318,17 @@
})
},
onConfirm () {
onConfirm() {
this.$set(this.options, 'staticData', JSON.parse(this.json))
this.isShowEditor = false
this.$emit('change')
}
}
}
}
</script>
<style lang="scss">
.el-dialog__body {
.el-dialog__body {
.jsoneditor-vue {
height: 480px;
@@ -334,8 +336,9 @@
display: none;
}
}
}
.layout-config__group--wrapper {
}
.layout-config__group--wrapper {
.layout-config__code .bin-ace-editor {
}
@@ -437,5 +440,5 @@
}
}
}
}
}
</style>

View File

@@ -36,7 +36,6 @@
<code-editor v-model="form.config" auto-format :lint="false"/>
</el-form-item>
</el-form>
<el-row type="flex" justify="center" class="footer">
<el-button @click="drawer=false">取消</el-button>
<el-button type="primary" @click="submit">提交</el-button>
@@ -47,8 +46,11 @@
</template>
<script>
import {CodeEditor} from 'bin-code-editor'
import 'bin-code-editor/lib/styles/index.css'
import {CodeEditor} from 'bin-ace-editor'
import 'brace/mode/json'
import 'brace/snippets/json';
import 'brace/theme/github';
import 'brace/theme/monokai';
const label = "应用定制配置";
export default {