From 8b9330a58d6dbaeec10172d31c99791d3566e61a Mon Sep 17 00:00:00 2001 From: xieyonghong <18010623010@163.com> Date: Mon, 27 Mar 2023 13:39:46 +0800 Subject: [PATCH 1/6] =?UTF-8?q?style:=20=E4=BC=98=E5=8C=96=E5=9C=BA?= =?UTF-8?q?=E6=99=AF=E8=81=94=E5=8A=A8=E5=9B=9E=E6=98=BE=E6=A0=A1=E9=AA=8C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Scene/Save/action/ListItem/CheckItem.vue | 14 ++++++++------ .../Scene/Save/action/ListItem/FilterGroup.vue | 10 ++++++++-- .../Scene/Save/components/Terms/ParamsItem.vue | 2 +- .../Scene/Save/components/Terms/util.ts | 4 +++- yarn.lock | 4 ++-- 5 files changed, 22 insertions(+), 12 deletions(-) diff --git a/src/views/rule-engine/Scene/Save/action/ListItem/CheckItem.vue b/src/views/rule-engine/Scene/Save/action/ListItem/CheckItem.vue index 9f18ab54..47e1c542 100644 --- a/src/views/rule-engine/Scene/Save/action/ListItem/CheckItem.vue +++ b/src/views/rule-engine/Scene/Save/action/ListItem/CheckItem.vue @@ -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 + } } } diff --git a/src/views/rule-engine/Scene/Save/action/ListItem/FilterGroup.vue b/src/views/rule-engine/Scene/Save/action/ListItem/FilterGroup.vue index 48542851..3e7c95c7 100644 --- a/src/views/rule-engine/Scene/Save/action/ListItem/FilterGroup.vue +++ b/src/views/rule-engine/Scene/Save/action/ListItem/FilterGroup.vue @@ -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) +}) + \ No newline at end of file diff --git a/src/components/index.ts b/src/components/index.ts index 9af226d5..71e6d881 100644 --- a/src/components/index.ts +++ b/src/components/index.ts @@ -9,8 +9,8 @@ import NormalUpload from './NormalUpload/index.vue' import FileFormat from './FileFormat/index.vue' import JProUpload from './Upload/index.vue' import { BasicLayoutPage, BlankLayoutPage } from './Layout' -import { PageContainer, AIcon } from 'jetlinks-ui-components' -import Ellipsis from './Ellipsis/index.vue' +import { PageContainer, AIcon, Ellipsis } from 'jetlinks-ui-components' +// import Ellipsis from './Ellipsis/index.vue' import JEmpty from './Empty/index.vue' import AMapComponent from './AMapComponent/index.vue' import PathSimplifier from './AMapComponent/PathSimplifier.vue' From a887be421e68c2850fcc1f3509d177ced86970c1 Mon Sep 17 00:00:00 2001 From: xieyonghong <18010623010@163.com> Date: Mon, 27 Mar 2023 15:58:03 +0800 Subject: [PATCH 5/6] =?UTF-8?q?update:=20=E6=9B=B4=E6=96=B0=E7=BB=84?= =?UTF-8?q?=E4=BB=B6=E5=BA=93?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- yarn.lock | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/yarn.lock b/yarn.lock index cd047e8c..e886d399 100644 --- a/yarn.lock +++ b/yarn.lock @@ -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#6a3cc76cd6d98319e070da597bfcf146fa12d375" - integrity sha512-ASPqiWprK2v4/zQIYxOytjkVFgx+AkBaD5Klg2ik88y9uDAW/Ylvqa91v149znihU1y8Q2Nm2PXvUSJFD7HPpw== + resolved "http://47.108.170.157:9013/jetlinks-ui-components/-/jetlinks-ui-components-1.0.5.tgz#27312836506c4833dcaaef075e1d3c694d75ae4d" + integrity sha512-oum7zipoDUVkm/tPd7yu+mw9mR5NmfBcvBf49ebf55s+nz4zyArFOITzldQJ3Wx6BwaUUH/BiDwskHH+KgBVyg== dependencies: "@vueuse/core" "^9.12.0" ant-design-vue "^3.2.15" From dbd14ce4d63f9a6fe1d9d26e8fe9c7c3946ca4c6 Mon Sep 17 00:00:00 2001 From: JiangQiming <291854119@qq.com> Date: Mon, 27 Mar 2023 16:11:06 +0800 Subject: [PATCH 6/6] =?UTF-8?q?fix:=20bug#10924=E3=80=8111001?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/utils/validate.ts | 10 +++++- .../system/Apply/Save/components/EditForm.vue | 31 +++++++++++++++++-- 2 files changed, 38 insertions(+), 3 deletions(-) diff --git a/src/utils/validate.ts b/src/utils/validate.ts index 8ac2aef3..85542cb4 100644 --- a/src/utils/validate.ts +++ b/src/utils/validate.ts @@ -16,4 +16,12 @@ export const phoneRegEx = (value: string) => { export const passwordRegEx = (value: string) => { const password = new RegExp(/^\S*(?=\S{8,})(?=\S*\d)(?=\S*[A-Z])(?=\S*[a-z])\S*$/) return password.test(value) -} \ No newline at end of file +} +/** + * 判断是否为正确的IP地址 + */ +export const testIP = (value: string) => { + const ip = + /^([0-9]|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.([0-9]|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.([0-9]|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.([0-9]|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])$/; + return ip.test(value); +}; \ No newline at end of file diff --git a/src/views/system/Apply/Save/components/EditForm.vue b/src/views/system/Apply/Save/components/EditForm.vue index 17c572e1..595f957a 100644 --- a/src/views/system/Apply/Save/components/EditForm.vue +++ b/src/views/system/Apply/Save/components/EditForm.vue @@ -824,7 +824,15 @@ placeholder="请输入redirectUrl" /> - + import { BASE_API_PATH, TOKEN_KEY } from '@/utils/variable'; import { LocalStore, filterSelectNode } from '@/utils/comm'; +import { testIP } from '@/utils/validate'; import { getDepartmentList_api, @@ -1454,6 +1463,7 @@ import { import { randomString } from '@/utils/utils'; import { cloneDeep, difference } from 'lodash'; import { useMenuStore } from '@/store/menu'; +import { Rule } from 'ant-design-vue/lib/form'; const emit = defineEmits(['changeApplyType']); const routeQuery = useRoute().query; @@ -1836,7 +1846,7 @@ function getErrorNum( } } -const imageTypes = ref(['image/jpg', 'image/png']); +const imageTypes = ref(['image/jpg', 'image/png', 'image/jpeg']); const beforeLogoUpload = (file: any) => { const isType: any = imageTypes.value.includes(file.type); if (!isType) { @@ -1871,6 +1881,23 @@ function clearNullProp(obj: object) { } } } + +/** + * 验证IP合法性 + * @param _rule + * @param value + */ +const validateIP = (_rule: Rule, value: string) => { + const ipList = value?.split(/[\n,]/g).filter((i: string) => i && i.trim()); + const errorIPList = ipList.filter( + (f: string) => !testIP(f.replace(/\s*/g, '')), + ); + return new Promise((resolve, reject) => { + !errorIPList.length + ? resolve('') + : reject(`[${errorIPList}]不是正确的IP地址`); + }); +};