|
@@ -4,7 +4,7 @@
|
|
v-model="value"
|
|
v-model="value"
|
|
:popper-class="'basic-component-select select-popper-' + config.code"
|
|
:popper-class="'basic-component-select select-popper-' + config.code"
|
|
:class="['basic-component-select', `select-${config.code}`]"
|
|
:class="['basic-component-select', `select-${config.code}`]"
|
|
- :placeholder="`请选择${placeholder || newPlaceholder}`"
|
|
|
|
|
|
+ :placeholder="config.customize.placeholder"
|
|
clearable
|
|
clearable
|
|
:filterable="filterable"
|
|
:filterable="filterable"
|
|
@visible-change="visibleChange"
|
|
@visible-change="visibleChange"
|
|
@@ -21,10 +21,8 @@
|
|
</template>
|
|
</template>
|
|
|
|
|
|
<script>
|
|
<script>
|
|
-import { EventBus } from 'data-room-ui/js/utils/eventBus'
|
|
|
|
import commonMixins from 'data-room-ui/js/mixins/commonMixins'
|
|
import commonMixins from 'data-room-ui/js/mixins/commonMixins'
|
|
import linkageMixins from 'data-room-ui/js/mixins/linkageMixins'
|
|
import linkageMixins from 'data-room-ui/js/mixins/linkageMixins'
|
|
-import { getDataSetDetails } from 'data-room-ui/js/api/bigScreenApi'
|
|
|
|
import { settingToTheme } from 'data-room-ui/js/utils/themeFormatting'
|
|
import { settingToTheme } from 'data-room-ui/js/utils/themeFormatting'
|
|
import cloneDeep from 'lodash/cloneDeep'
|
|
import cloneDeep from 'lodash/cloneDeep'
|
|
window.dataSetFields = []
|
|
window.dataSetFields = []
|
|
@@ -44,53 +42,26 @@ export default {
|
|
value: '',
|
|
value: '',
|
|
innerConfig: {},
|
|
innerConfig: {},
|
|
optionData: [],
|
|
optionData: [],
|
|
- newPlaceholder: '',
|
|
|
|
filterable: false
|
|
filterable: false
|
|
}
|
|
}
|
|
},
|
|
},
|
|
computed: {
|
|
computed: {
|
|
isPreview () {
|
|
isPreview () {
|
|
return (this.$route.path === window?.BS_CONFIG?.routers?.previewUrl) || (this.$route.path === '/big-screen/preview')
|
|
return (this.$route.path === window?.BS_CONFIG?.routers?.previewUrl) || (this.$route.path === '/big-screen/preview')
|
|
- },
|
|
|
|
- placeholder: {
|
|
|
|
- get () {
|
|
|
|
- return window.dataSetFields.find(field => field.value === this.config.dataSource.dimensionField)?.label || ''
|
|
|
|
- },
|
|
|
|
- set (val) {
|
|
|
|
- this.newPlaceholder = val
|
|
|
|
- }
|
|
|
|
}
|
|
}
|
|
},
|
|
},
|
|
watch: { },
|
|
watch: { },
|
|
created () {
|
|
created () {
|
|
},
|
|
},
|
|
mounted () {
|
|
mounted () {
|
|
- window.dataSetFields = []
|
|
|
|
this.changeStyle(this.config)
|
|
this.changeStyle(this.config)
|
|
- EventBus.$on('changeBusinessKey', () => {
|
|
|
|
- window.dataSetFields = []
|
|
|
|
- })
|
|
|
|
if (this.isPreview) {
|
|
if (this.isPreview) {
|
|
this.filterable = true
|
|
this.filterable = true
|
|
- document.querySelector(`.select-${this.config.code}`).style.pointerEvents = 'all'
|
|
|
|
- if (this.config.dataSource.businessKey && window.dataSetFields.length === 0) {
|
|
|
|
- getDataSetDetails(this.config.dataSource.businessKey).then(res => {
|
|
|
|
- window.dataSetFields = res.fields.map(field => {
|
|
|
|
- return {
|
|
|
|
- label: field.comment || field.fieldDesc,
|
|
|
|
- value: field.name || field.fieldName
|
|
|
|
- }
|
|
|
|
- })
|
|
|
|
- this.placeholder = window.dataSetFields.find(field => field.value === this.config.dataSource.dimensionField)?.label || ''
|
|
|
|
- })
|
|
|
|
- }
|
|
|
|
} else {
|
|
} else {
|
|
document.querySelector(`.select-${this.config.code}`).style.pointerEvents = 'none'
|
|
document.querySelector(`.select-${this.config.code}`).style.pointerEvents = 'none'
|
|
}
|
|
}
|
|
},
|
|
},
|
|
- beforeDestroy () {
|
|
|
|
- EventBus.$off('changeBusinessKey')
|
|
|
|
- },
|
|
|
|
|
|
+ beforeDestroy () { },
|
|
methods: {
|
|
methods: {
|
|
dataFormatting (config, data) {
|
|
dataFormatting (config, data) {
|
|
// 数据返回成功则赋值
|
|
// 数据返回成功则赋值
|
|
@@ -105,20 +76,8 @@ export default {
|
|
console.info(e)
|
|
console.info(e)
|
|
}
|
|
}
|
|
}
|
|
}
|
|
- config.option.data = data
|
|
|
|
this.optionData = data
|
|
this.optionData = data
|
|
config.customize.title = config.option.data[config.dataSource.dimensionField] || config.customize.title
|
|
config.customize.title = config.option.data[config.dataSource.dimensionField] || config.customize.title
|
|
- if (window.dataSetFields.length === 0) {
|
|
|
|
- getDataSetDetails(this.config.dataSource.businessKey).then(res => {
|
|
|
|
- window.dataSetFields = res.fields.map(field => {
|
|
|
|
- return {
|
|
|
|
- label: field.comment || field.fieldDesc,
|
|
|
|
- value: field.name || field.fieldName
|
|
|
|
- }
|
|
|
|
- })
|
|
|
|
- this.placeholder = window.dataSetFields.find(field => field.value === this.config.dataSource.dimensionField)?.label || ''
|
|
|
|
- })
|
|
|
|
- }
|
|
|
|
// 语音播报
|
|
// 语音播报
|
|
} else {
|
|
} else {
|
|
// 数据返回失败则赋前端的模拟数据
|
|
// 数据返回失败则赋前端的模拟数据
|