Merge remote-tracking branch 'origin/dev' into dev

This commit is contained in:
wangjiahao 2022-01-14 14:30:16 +08:00
commit 7a61f375fa
19 changed files with 117 additions and 17 deletions

View File

@ -74,6 +74,9 @@ export function panelInit(componentDatas) {
}
}
}
if (item.type === 'custom') {
item.options.manualModify = false
}
if (item.filters && item.filters.length > 0) {
item.filters = []
}

View File

@ -64,6 +64,9 @@ export default {
viewIds() {
if (!this.element || !this.element.options || !this.element.options.attrs.viewIds) return ''
return this.element.options.attrs.viewIds.toString()
},
manualModify() {
return !!this.element.options.manualModify
}
},
watch: {
@ -111,6 +114,18 @@ export default {
this.$refs.dateRef.hidePicker()
}
})
bus.$on('reset-default-value', id => {
if (this.inDraw && this.manualModify && this.element.id === id) {
if (!this.element.options.attrs.default.isDynamic) {
this.values = this.fillValueDerfault()
this.dateChange(this.values)
return
}
const widget = ApplicationContext.getService(this.element.serviceName)
this.values = widget.dynamicDateFormNow(this.element)
this.dateChange(this.values)
}
})
},
methods: {
onBlur() {
@ -138,6 +153,9 @@ export default {
} else {
this.element.options.value = Array.isArray(value) ? value.join() : value.toString()
}
this.element.options.manualModify = false
} else {
this.element.options.manualModify = true
}
this.setCondition()
this.styleChange()

View File

@ -17,6 +17,7 @@
</template>
<script>
import bus from '@/utils/bus'
export default {
props: {
@ -45,6 +46,9 @@ export default {
viewIds() {
if (!this.element || !this.element.options || !this.element.options.attrs.viewIds) return ''
return this.element.options.attrs.viewIds.toString()
},
manualModify() {
return !!this.element.options.manualModify
}
},
watch: {
@ -64,6 +68,14 @@ export default {
this.search()
}
},
mounted() {
bus.$on('reset-default-value', id => {
if (this.inDraw && this.manualModify && this.element.id === id) {
this.value = this.fillValueDerfault()
this.search()
}
})
},
methods: {
search() {
if (!this.inDraw) {
@ -85,6 +97,9 @@ export default {
valueChange(val) {
if (!this.inDraw) {
this.element.options.value = val
this.element.options.manualModify = false
} else {
this.element.options.manualModify = true
}
},
fillValueDerfault() {

View File

@ -17,6 +17,7 @@
<script>
const MIN_NUMBER = -2147483648
const MAX_NUMBER = 2147483647
import bus from '@/utils/bus'
export default {
props: {
@ -64,6 +65,9 @@ export default {
viewIds() {
if (!this.element || !this.element.options || !this.element.options.attrs.viewIds) return ''
return this.element.options.attrs.viewIds.toString()
},
manualModify() {
return !!this.element.options.manualModify
}
},
watch: {
@ -99,6 +103,18 @@ export default {
this.search()
}
},
mounted() {
bus.$on('reset-default-value', id => {
if (this.inDraw && this.manualModify && this.element.id === id) {
const values = this.element.options.value
this.form.min = values[0]
if (values.length > 1) {
this.form.max = values[1]
}
this.search()
}
})
},
methods: {
searchWithKey(index) {
this.timeMachine = setTimeout(() => {
@ -211,6 +227,9 @@ export default {
if (!this.inDraw) {
const values = [this.form.min, this.form.max]
this.element.options.value = values
this.element.options.manualModify = false
} else {
this.element.options.manualModify = true
}
}
}

View File

@ -28,9 +28,9 @@
</template>
<script>
import { multFieldValues, linkMultFieldValues} from '@/api/dataset/dataset'
import { multFieldValues, linkMultFieldValues } from '@/api/dataset/dataset'
import bus from '@/utils/bus'
import {getLinkToken, getToken} from "@/utils/auth";
import { getLinkToken, getToken } from '@/utils/auth'
export default {
props: {
@ -70,6 +70,9 @@ export default {
viewIds() {
if (!this.element || !this.element.options || !this.element.options.attrs.viewIds) return ''
return this.element.options.attrs.viewIds.toString()
},
manualModify() {
return !!this.element.options.manualModify
}
},
@ -87,7 +90,7 @@ export default {
if (typeof value === 'undefined' || value === old) return
this.datas = []
let method = multFieldValues
let method = multFieldValues
const token = this.$store.getters.token || getToken()
const linkToken = this.$store.getters.linkToken || getLinkToken()
if (!token && linkToken) {
@ -95,7 +98,7 @@ export default {
}
this.element.options.attrs.fieldId &&
this.element.options.attrs.fieldId.length > 0 &&
method({fieldIds: this.element.options.attrs.fieldId.split(',')}).then(res => {
method({ fieldIds: this.element.options.attrs.fieldId.split(',') }).then(res => {
this.datas = this.optionDatas(res.data)
}) || (this.element.options.value = '')
},
@ -122,6 +125,12 @@ export default {
this.$refs.deSelect.blur()
}
})
bus.$on('reset-default-value', id => {
if (this.inDraw && this.manualModify && this.element.id === id) {
this.value = this.fillValueDerfault()
this.changeValue(this.value)
}
})
},
methods: {
@ -132,13 +141,13 @@ export default {
this.value = this.fillValueDerfault()
this.datas = []
if (this.element.options.attrs.fieldId) {
let method = multFieldValues
let method = multFieldValues
const token = this.$store.getters.token || getToken()
const linkToken = this.$store.getters.linkToken || getLinkToken()
if (!token && linkToken) {
method = linkMultFieldValues
}
method({fieldIds: this.element.options.attrs.fieldId.split(',')}).then(res => {
method({ fieldIds: this.element.options.attrs.fieldId.split(',') }).then(res => {
this.datas = this.optionDatas(res.data)
})
}
@ -154,6 +163,9 @@ export default {
} else {
this.element.options.value = Array.isArray(value) ? value.join() : value
}
this.element.options.manualModify = false
} else {
this.element.options.manualModify = true
}
this.setCondition()
this.styleChange()

View File

@ -38,6 +38,7 @@
<script>
import { multFieldValues, linkMultFieldValues } from '@/api/dataset/dataset'
import { getLinkToken, getToken } from '@/utils/auth'
import bus from '@/utils/bus'
export default {
props: {
@ -89,6 +90,9 @@ export default {
viewIds() {
if (!this.element || !this.element.options || !this.element.options.attrs.viewIds) return ''
return this.element.options.attrs.viewIds.toString()
},
manualModify() {
return !!this.element.options.manualModify
}
},
watch: {
@ -137,6 +141,19 @@ export default {
created() {
this.initLoad()
},
mounted() {
bus.$on('reset-default-value', id => {
if (this.inDraw && this.manualModify && this.element.id === id) {
this.value = this.fillValueDerfault()
this.changeValue(this.value)
if (this.element.options.attrs.multiple) {
this.checkAll = this.value.length === this.datas.length
this.isIndeterminate = this.value.length > 0 && this.value.length < this.datas.length
}
}
})
},
methods: {
initLoad() {
@ -168,6 +185,9 @@ export default {
} else {
this.element.options.value = Array.isArray(value) ? value.join() : value
}
this.element.options.manualModify = false
} else {
this.element.options.manualModify = true
}
this.setCondition()
this.styleChange()

View File

@ -15,7 +15,8 @@ const dialogPanel = {
fieldId: '',
dragItems: []
},
value: ''
value: '',
manualModify: false
},
defaultClass: 'tree-filter',
component: 'de-number-range'

View File

@ -20,7 +20,8 @@ const dialogPanel = {
fieldId: '',
dragItems: []
},
value: ''
value: '',
manualModify: false
},
defaultClass: 'tree-filter',
component: 'de-select-grid'

View File

@ -20,7 +20,8 @@ const dialogPanel = {
fieldId: '',
dragItems: []
},
value: ''
value: '',
manualModify: false
},
defaultClass: 'tree-filter',
component: 'de-select'

View File

@ -15,7 +15,8 @@ const dialogPanel = {
dragItems: []
},
value: ''
value: '',
manualModify: false
},
defaultClass: 'text-filter',
component: 'de-input-search'

View File

@ -20,7 +20,8 @@ const dialogPanel = {
fieldId: '',
dragItems: []
},
value: ''
value: '',
manualModify: false
},
defaultClass: 'text-filter',
component: 'de-select-grid'

View File

@ -20,7 +20,8 @@ const dialogPanel = {
fieldId: '',
dragItems: []
},
value: ''
value: '',
manualModify: false
},
defaultClass: 'text-filter',
component: 'de-select'

View File

@ -29,7 +29,8 @@ const dialogPanel = {
eDynamicSuffix: 'after'
}
},
value: ''
value: '',
manualModify: false
},
defaultClass: 'time-filter',
component: 'de-date'

View File

@ -40,7 +40,8 @@ const dialogPanel = {
}
}
},
value: ''
value: '',
manualModify: false
},
defaultClass: 'time-filter',
component: 'de-date'

View File

@ -35,7 +35,8 @@ const dialogPanel = {
}
}
},
value: ''
value: '',
manualModify: false
},
defaultClass: 'time-filter',
component: 'de-date'

View File

@ -34,7 +34,8 @@ const dialogPanel = {
}
}
},
value: ''
value: '',
manualModify: false
},
defaultClass: 'time-filter',
component: 'de-date'

View File

@ -688,7 +688,7 @@ export default {
},
cancelFilter() {
this.closeFilter()
if(this.filterFromDrag){
if (this.filterFromDrag) {
bus.$emit('onRemoveLastItem')
}
},
@ -697,6 +697,7 @@ export default {
this.$store.commit('setComponentWithId', this.currentFilterCom)
this.$store.commit('recordSnapshot', 'sureFilter')
this.$store.commit('setCurComponent', { component: this.currentFilterCom, index: this.curComponentIndex })
bus.$emit('reset-default-value', this.currentFilterCom.id)
this.closeFilter()
},
reFreshComponent(component) {

View File

@ -169,6 +169,7 @@ export default {
const widget = ApplicationContext.getService(this.element.serviceName)
const time = widget.dynamicDateFormNow(this.element)
this.dval = time
this.element.options.manualModify = false
}
}
}

View File

@ -213,6 +213,7 @@ export default {
const time = widget.dynamicDateFormNow(this.element)
this.dval = time
bus.$emit('valid-values-change', (!time || time.length === 0 || time[1] > time[0]))
this.element.options.manualModify = false
}
}
}