Merge remote-tracking branch 'origin/master'

main
liu.shiyi 2 years ago
commit 96549d971e

@ -1,13 +1,14 @@
<template> <template>
<el-date-picker <el-date-picker
:key="config.customize.type" :key="config.customize.type"
v-model="config.customize.value" v-model="value"
:picker-options="config.customize.pickerOptions" :picker-options="config.customize.pickerOptions"
:type="config.customize.type" :type="config.customize.type"
clearable clearable
:class="['basic-component-date-picker', `date-picker-${config.code}`]" :class="['basic-component-date-picker', `date-picker-${config.code}`]"
:popper-class="'basic-component-date-picker date-picker-popper-' + config.code" :popper-class="'basic-component-date-picker date-picker-popper-' + config.code"
:value-format="config.customize.valueFormat" :value-format="config.customize.valueFormat"
:default-value="value"
size="large" size="large"
@focus="focusEvent" @focus="focusEvent"
@change="changeValue" @change="changeValue"
@ -16,6 +17,7 @@
</template> </template>
<script> <script>
import moment from 'moment'
import cloneDeep from 'lodash/cloneDeep' import cloneDeep from 'lodash/cloneDeep'
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'
@ -35,6 +37,7 @@ export default {
}, },
data () { data () {
return { return {
value: '',
innerConfig: {} innerConfig: {}
} }
}, },
@ -47,16 +50,30 @@ export default {
} }
}, },
watch: { watch: {
config: { 'config.customize.formatType': {
handler: function (val) { handler (val) {
if (val && val.customize && val.customize.formatType === 'custom') { if (val === 'timestamp') {
// this.value = 0
this.$nextTick(() => { this.valueFormat = 'timestamp'
this.config.customize.value = toString(this.config.customize.value) } else if (val === 'custom') {
}) this.value = ''
this.valueFormat = 'YYYY-MM-DD HH:mm:ss'
}
},
immediate: true
},
'config.customize.type': {
handler (val) {
if (['year', 'month', 'date', 'week', 'datetime'].includes(val)) {
this.value = moment(new Date()).format('YYYY-MM-DD HH:mm:ss')
} else {
this.value = [
moment(new Date()).subtract(7, 'days').format('YYYY-MM-DD HH:mm:ss'),
moment(new Date()).format('YYYY-MM-DD HH:mm:ss')
]
} }
}, },
deep: true immediate: true
} }
}, },
created () { }, created () { },
@ -65,9 +82,11 @@ export default {
document.querySelector(`.date-picker-${this.config.code}`).style.pointerEvents = 'none' document.querySelector(`.date-picker-${this.config.code}`).style.pointerEvents = 'none'
} }
this.changeStyle(this.config) this.changeStyle(this.config)
// config.customize.value if (this.value === '') {
if (this.config.customize.value === '') { this.value = [
this.config.customize.value = new Date() moment(new Date()).subtract(7, 'days').format('YYYY-MM-DD HH:mm:ss'),
moment(new Date()).format('YYYY-MM-DD HH:mm:ss')
]
} }
}, },
beforeDestroy () { beforeDestroy () {
@ -128,6 +147,11 @@ export default {
}, },
// //
changeValue (val) { changeValue (val) {
// val
if (Array.isArray(val)) {
val = val.join(',')
}
console.log('val', val)
this.linkage({ [this.config.code]: val }) this.linkage({ [this.config.code]: val })
}, },
focusEvent () { focusEvent () {
@ -171,7 +195,7 @@ export default {
}) })
}, },
mouseenter () { mouseenter () {
if (this.config.customize.value) { if (this.value) {
setTimeout(() => { setTimeout(() => {
// //
const timePickerCloseIcon = document.querySelector(`.date-picker-${this.innerConfig.code} .el-icon-circle-close`) const timePickerCloseIcon = document.querySelector(`.date-picker-${this.innerConfig.code} .el-icon-circle-close`)

@ -114,7 +114,6 @@
class="bs-el-select" class="bs-el-select"
popper-class="bs-el-select" popper-class="bs-el-select"
clearable clearable
@change="selectFormatType"
> >
<el-option <el-option
v-for="(type) in formatTypeOptions" v-for="(type) in formatTypeOptions"
@ -163,6 +162,7 @@
</div> </div>
</template> </template>
<script> <script>
import moment from 'moment'
import SettingTitle from 'data-room-ui/SettingTitle/index.vue' import SettingTitle from 'data-room-ui/SettingTitle/index.vue'
import ColorPicker from 'data-room-ui/ColorPicker/index.vue' import ColorPicker from 'data-room-ui/ColorPicker/index.vue'
import PosWhSetting from 'data-room-ui/BigScreenDesign/RightSetting/PosWhSetting.vue' import PosWhSetting from 'data-room-ui/BigScreenDesign/RightSetting/PosWhSetting.vue'
@ -210,7 +210,6 @@ export default {
{ label: '年', value: 'year' }, { label: '年', value: 'year' },
{ label: '月', value: 'month' }, { label: '月', value: 'month' },
{ label: '日', value: 'date' }, { label: '日', value: 'date' },
{ label: '周', value: 'week' },
{ label: '日期时间', value: 'datetime' }, { label: '日期时间', value: 'datetime' },
{ label: '日期时间范围', value: 'datetimerange' }, { label: '日期时间范围', value: 'datetimerange' },
{ label: '日期范围', value: 'daterange' } { label: '日期范围', value: 'daterange' }
@ -219,16 +218,7 @@ export default {
}, },
watch: {}, watch: {},
mounted () {}, mounted () {},
methods: { methods: { }
selectFormatType (type) {
if (type === 'timestamp') {
this.config.customize.value = 0
this.config.customize.valueFormat = 'timestamp'
} else if (type === 'custom') {
this.config.customize.valueFormat = 'yyyy-MM-dd HH:mm:ss'
}
}
}
} }
</script> </script>

@ -22,15 +22,14 @@ const customConfig = {
}, },
// 自定义属性 // 自定义属性
customize: { customize: {
value: '',
// 选择框背景颜色 // 选择框背景颜色
bgColor: '#35393F', bgColor: '#35393F',
// 选择框文字颜色 // 选择框文字颜色
fontColor: '#FFFFFF', fontColor: '#FFFFFF',
// 选择框文字大小 // 选择框文字大小
fontSize: 20, fontSize: 20,
// 显示类型 year/month/date/week/ datetime/datetimerange/daterange // 显示类型 year/month/date/ datetime/datetimerange/daterange
type: 'datetime', type: 'datetimerange',
// 时间格式化类型:时间戳timestamp自定义custom // 时间格式化类型:时间戳timestamp自定义custom
formatType: 'custom', formatType: 'custom',
// 绑定值的格式 // 绑定值的格式

@ -1,12 +1,13 @@
<template> <template>
<el-time-picker <el-time-picker
v-model="config.customize.value" v-model="value"
:picker-options="config.customize.pickerOptions" :picker-options="config.customize.pickerOptions"
placeholder="选择时间" placeholder="选择时间"
clearable clearable
:class="['basic-component-time-picker', `time-picker-${config.code}`]" :class="['basic-component-time-picker', `time-picker-${config.code}`]"
:popper-class="'basic-component-time-picker time-picker-popper-' + config.code" :popper-class="'basic-component-time-picker time-picker-popper-' + config.code"
:value-format="config.customize.valueFormat" :value-format="config.customize.valueFormat"
:default-value="value"
@focus="focusEvent" @focus="focusEvent"
@change="changeValue" @change="changeValue"
@mouseenter.native="mouseenter" @mouseenter.native="mouseenter"
@ -48,31 +49,30 @@ export default {
} }
}, },
watch: { watch: {
config: {
handler: function (val) { 'config.customize.formatType': {
if (val && val.customize && val.customize.formatType === 'custom') { handler (val) {
this.$nextTick(() => { if (val === 'timestamp') {
this.config.customize.value = toString(this.config.customize.value) this.value = 0
}) this.config.customize.valueFormat = 'timestamp'
} else if (val === 'custom') {
this.config.customize.valueFormat = 'HH:mm:ss'
this.value = ''
} }
}, },
deep: true immediate: true
} }
}, },
created () { }, created () { },
mounted () { mounted () {
if (!this.isPreview) { if (!this.isPreview) {
// document.querySelector(`.time-picker-${this.config.code}`).style.pointerEvents = 'none' document.querySelector(`.time-picker-${this.config.code}`).style.pointerEvents = 'none'
}
if (this.value === '') {
this.value = moment(new Date()).format(this.config.customize.valueFormat)
} }
this.changeStyle(this.config) this.changeStyle(this.config)
// config.customize.value HH:mm:ss
// if (this.config.customize.value === '') {
// this.config.customize.valueFormat = 'HH:mm:ss'
// this.$nextTick(() => {
// this.config.customize.value = moment(new Date()).format('HH:mm:ss')
// console.log(this.config.customize.value)
// })
// }
}, },
beforeDestroy () { }, beforeDestroy () { },
methods: { methods: {
@ -170,7 +170,7 @@ export default {
}) })
}, },
mouseenter () { mouseenter () {
if (this.config.customize.value) { if (this.value) {
setTimeout(() => { setTimeout(() => {
// //
const timePickerCloseIcon = document.querySelector(`.time-picker-${this.innerConfig.code} .el-icon-circle-close`) const timePickerCloseIcon = document.querySelector(`.time-picker-${this.innerConfig.code} .el-icon-circle-close`)

@ -89,8 +89,6 @@
v-model="config.customize.formatType" v-model="config.customize.formatType"
class="bs-el-select" class="bs-el-select"
popper-class="bs-el-select" popper-class="bs-el-select"
clearable
@change="selectFormatType"
> >
<el-option <el-option
v-for="(type) in formatTypeOptions" v-for="(type) in formatTypeOptions"
@ -177,16 +175,7 @@ export default {
}, },
watch: {}, watch: {},
mounted () {}, mounted () {},
methods: { methods: { }
selectFormatType (type) {
if (type === 'timestamp') {
this.config.customize.value = 0
this.config.customize.valueFormat = 'timestamp'
} else if (type === 'custom') {
this.config.customize.valueFormat = 'HH:mm:ss'
}
}
}
} }
</script> </script>

@ -205,7 +205,7 @@ export default {
} }
}, },
watch: { watch: {
chartList(val){ chartList (val) {
// console.log(val,this.activeCode) // console.log(val,this.activeCode)
// if(val.findIndex(item=>item.code==this.activeCode)==-1){ // if(val.findIndex(item=>item.code==this.activeCode)==-1){
// this.updateRightVisiable(false) // this.updateRightVisiable(false)
@ -263,7 +263,7 @@ export default {
mounted () { mounted () {
EventBus.$on('closeRightPanel', () => { EventBus.$on('closeRightPanel', () => {
this.updateRightVisiable(false) this.updateRightVisiable(false)
}) })
}, },
beforeDestroy () { beforeDestroy () {
this.clearTimeline() this.clearTimeline()
@ -309,27 +309,27 @@ export default {
getScreenInfo(component.code).then(res => { getScreenInfo(component.code).then(res => {
res.chartList.forEach((item) => { res.chartList.forEach((item) => {
if (!item.border) { if (!item.border) {
item.border={type:'',titleHeight:60,fontSize:16,isTitle:true,padding:[0,0,0,0]} item.border = { type: '', titleHeight: 60, fontSize: 16, isTitle: true, padding: [0, 0, 0, 0] }
} }
if(!item.border.padding){ if (!item.border.padding) {
item.border.padding=[0,0,0,0] item.border.padding = [0, 0, 0, 0]
} }
if (item.type == 'customComponent'){ if (item.type == 'customComponent') {
plotSettings[Symbol.iterator]=function*(){ plotSettings[Symbol.iterator] = function * () {
let keys=Object.keys(plotSettings) const keys = Object.keys(plotSettings)
for(let k of keys){ for (const k of keys) {
yield [k,plotSettings[k]] yield [k, plotSettings[k]]
} }
} }
for(let [key,value] of plotSettings){ for (const [key, value] of plotSettings) {
if (item.name == value.name) { if (item.name == value.name) {
const settings=JSON.parse(JSON.stringify(value.setting)) const settings = JSON.parse(JSON.stringify(value.setting))
item.setting=settings.map((x)=>{ item.setting = settings.map((x) => {
const index=item.setting.findIndex(y=>y.field==x.field) const index = item.setting.findIndex(y => y.field == x.field)
x.field = item.setting[index].field x.field = item.setting[index].field
x.value=item.setting[index].value x.value = item.setting[index].value
return x return x
}) })
} }
} }
} }
@ -441,7 +441,7 @@ export default {
}, },
// //
updateSetting (config) { updateSetting (config) {
if (config.type === 'map' || config.type==='screenScrollBoard'|| config.type === 'remoteComponent' || config.type === 'video' || config.type === 'flyMap') { if (config.type === 'map' || config.type === 'screenScrollBoard' || config.type === 'remoteComponent' || config.type === 'video' || config.type === 'flyMap') {
config.key = new Date().getTime() config.key = new Date().getTime()
} }
this.changeChartConfig(cloneDeep(config)) this.changeChartConfig(cloneDeep(config))

@ -140,7 +140,7 @@
</div> </div>
</template> </template>
<script> <script>
import { toJpeg, toPng } from 'html-to-image' import { toJpeg } from 'html-to-image'
import CusBtn from 'data-room-ui/BigScreenDesign/BtnLoading' import CusBtn from 'data-room-ui/BigScreenDesign/BtnLoading'
// import MonacoEditor from 'data-room-ui/MonacoEditor' // import MonacoEditor from 'data-room-ui/MonacoEditor'
import BizComponentPreview from './Preview' import BizComponentPreview from './Preview'

@ -237,7 +237,6 @@ export default {
return config return config
}, },
dataFormatting (config, data) { dataFormatting (config, data) {
console.log('config', config);
// config = this.config // config = this.config
// //
if (data.success) { if (data.success) {

Loading…
Cancel
Save