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) { if (item.filters && item.filters.length > 0) {
item.filters = [] item.filters = []
} }

View File

@ -64,6 +64,9 @@ export default {
viewIds() { viewIds() {
if (!this.element || !this.element.options || !this.element.options.attrs.viewIds) return '' if (!this.element || !this.element.options || !this.element.options.attrs.viewIds) return ''
return this.element.options.attrs.viewIds.toString() return this.element.options.attrs.viewIds.toString()
},
manualModify() {
return !!this.element.options.manualModify
} }
}, },
watch: { watch: {
@ -111,6 +114,18 @@ export default {
this.$refs.dateRef.hidePicker() 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: { methods: {
onBlur() { onBlur() {
@ -138,6 +153,9 @@ export default {
} else { } else {
this.element.options.value = Array.isArray(value) ? value.join() : value.toString() 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.setCondition()
this.styleChange() this.styleChange()

View File

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

View File

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

View File

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

View File

@ -38,6 +38,7 @@
<script> <script>
import { multFieldValues, linkMultFieldValues } from '@/api/dataset/dataset' import { multFieldValues, linkMultFieldValues } from '@/api/dataset/dataset'
import { getLinkToken, getToken } from '@/utils/auth' import { getLinkToken, getToken } from '@/utils/auth'
import bus from '@/utils/bus'
export default { export default {
props: { props: {
@ -89,6 +90,9 @@ export default {
viewIds() { viewIds() {
if (!this.element || !this.element.options || !this.element.options.attrs.viewIds) return '' if (!this.element || !this.element.options || !this.element.options.attrs.viewIds) return ''
return this.element.options.attrs.viewIds.toString() return this.element.options.attrs.viewIds.toString()
},
manualModify() {
return !!this.element.options.manualModify
} }
}, },
watch: { watch: {
@ -137,6 +141,19 @@ export default {
created() { created() {
this.initLoad() 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: { methods: {
initLoad() { initLoad() {
@ -168,6 +185,9 @@ export default {
} else { } else {
this.element.options.value = Array.isArray(value) ? value.join() : value this.element.options.value = Array.isArray(value) ? value.join() : value
} }
this.element.options.manualModify = false
} else {
this.element.options.manualModify = true
} }
this.setCondition() this.setCondition()
this.styleChange() this.styleChange()

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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