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

View File

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