style: 优化场景联动回显校验

This commit is contained in:
xieyonghong 2023-03-27 13:39:46 +08:00
parent 9594893a50
commit 8b9330a58d
5 changed files with 22 additions and 12 deletions

View File

@ -58,12 +58,14 @@ const checkDeviceDelete = async () => {
formTouchOff()
return
}
const deviceList = item!.selectorValues?.map(item => item.value) || []
const deviceResp = await deviceQuery({ terms: [{ terms: [{ column: 'id', termType: 'in', value: deviceList.toString() }]}]})
if (deviceResp.success && (deviceResp.result as any)?.total < (item!.selectorValues?.length || 0)) { //
_data.value.branches![props.branchesName].then[props.thenName].actions[props.name].device!.selectorValues = undefined
formTouchOff()
return
if (item?.selector === 'fixed') {
const deviceList = item!.selectorValues?.map(item => item.value) || []
const deviceResp = await deviceQuery({ terms: [{ terms: [{ column: 'id', termType: 'in', value: deviceList.toString() }]}]})
if (deviceResp.success && (deviceResp.result as any)?.total < (item!.selectorValues?.length || 0)) { //
_data.value.branches![props.branchesName].then[props.thenName].actions[props.name].device!.selectorValues = undefined
formTouchOff()
return
}
}
}

View File

@ -107,9 +107,11 @@ const onKeys: string[] = EventSubscribeKeys({
action: props.actionName
})
EventEmitter.subscribe(onKeys, (d: any) => {
const handleRequest = () => {
columnRequest()
})
}
EventEmitter.subscribe(onKeys, handleRequest)
provide('filter-params', columnOptions)
@ -241,6 +243,10 @@ nextTick(() => {
columnRequest()
})
onUnmounted(() => {
EventEmitter.unSubscribe(onKeys, handleRequest)
})
</script>
<style scoped>

View File

@ -221,7 +221,7 @@ const showDouble = computed(() => {
} else {
metricOption.value = []
}
return isRange && !isMetric
return isRange && !isMetric.value
})
const mouseover = () => {

View File

@ -1,3 +1,5 @@
import { BranchesThen } from '@/views/rule-engine/Scene/typings'
export const ContextKey = 'columnOptions'
export const handleParamsData = (data: any[], key: string = 'column'): any[] => {
@ -12,7 +14,7 @@ export const handleParamsData = (data: any[], key: string = 'column'): any[] =>
}
export const thenRules = [{
validator(_: string, value: any) {
validator(_: string, value: BranchesThen[]) {
if (!value || (value && !value.length) || !value.some(item => item.actions && item.actions.length)) {
return Promise.reject('至少配置一个执行动作')
}

View File

@ -3700,8 +3700,8 @@ jetlinks-store@^0.0.3:
jetlinks-ui-components@^1.0.5:
version "1.0.5"
resolved "http://47.108.170.157:9013/jetlinks-ui-components/-/jetlinks-ui-components-1.0.5.tgz#593185f6313895485b59e9a79bc920c63374d84d"
integrity sha512-dkSOmatSPLHlV91YdTcHWO2wfwriUIZKEuLd5bJF2GsO9SvDMyJ2YJ4n/3fkklOoL5albhY37iX2Ot3A+7QYwA==
resolved "http://47.108.170.157:9013/jetlinks-ui-components/-/jetlinks-ui-components-1.0.5.tgz#6a3cc76cd6d98319e070da597bfcf146fa12d375"
integrity sha512-ASPqiWprK2v4/zQIYxOytjkVFgx+AkBaD5Klg2ik88y9uDAW/Ylvqa91v149znihU1y8Q2Nm2PXvUSJFD7HPpw==
dependencies:
"@vueuse/core" "^9.12.0"
ant-design-vue "^3.2.15"