diff --git a/src/components/Search/Search.vue b/src/components/Search/Search.vue index b0b2bf94..14d4af0f 100644 --- a/src/components/Search/Search.vue +++ b/src/components/Search/Search.vue @@ -98,7 +98,11 @@ const props = defineProps({ class: { type: String, default: '' - } + }, + // defaultTerms: { + // type: Object, + // default: () => ({}) + // } }) const searchRef = ref(null) @@ -223,6 +227,7 @@ const handleParamsFormat = () => { */ const searchSubmit = () => { emit('search', handleParamsFormat()) + console.log('searchSubmit') if (props.type === 'advanced') { addUrlParams() } diff --git a/src/components/Table/index.tsx b/src/components/Table/index.tsx index e3c69329..1239c9f6 100644 --- a/src/components/Table/index.tsx +++ b/src/components/Table/index.tsx @@ -144,6 +144,10 @@ const JTable = defineComponent({ pageSize: 12 } } + }, + scroll: { + type: Object, + default: () => { x: 1366 } } } as any, setup(props: JTableProps, { slots, emit, expose }) { @@ -331,7 +335,7 @@ const JTable = defineComponent({ pagination={false} rowKey="id" rowSelection={props.rowSelection} - scroll={{ x: 1366 }} + scroll={props.scroll} v-slots={{ bodyCell: (dt: Record) => { const { column, record } = dt; diff --git a/src/store/scene.ts b/src/store/scene.ts index b5c9dc5f..c25514b2 100644 --- a/src/store/scene.ts +++ b/src/store/scene.ts @@ -68,7 +68,7 @@ const defaultOptions = { }; export const useSceneStore = defineStore('scene', () => { - const data = reactive({ + const data = reactive({ trigger: { type: ''}, options: defaultOptions, branches: defaultBranches, @@ -116,67 +116,3 @@ export const useSceneStore = defineStore('scene', () => { getDetail } }) -// -// export const useSceneStore = defineStore({ -// id: 'scene', -// state: (): DataType => { -// return { -// data: { -// trigger: { type: ''}, -// options: defaultOptions, -// branches: defaultBranches, -// description: '' -// }, -// productCache: {} -// } -// }, -// actions: { -// /** -// * 初始化数据 -// */ -// initData() { -// -// }, -// /** -// * 获取详情 -// * @param id -// */ -// async getDetail(id: string) { -// const resp = await detail(id) -// if (resp.success) { -// const result = resp.result as SceneItem -// const triggerType = result.triggerType -// let branches: any[] = result.branches -// -// if (!branches) { -// branches = cloneDeep(defaultBranches) -// if (triggerType === 'device') { -// branches.push(null) -// } -// } else { -// const branchesLength = branches.length; -// if ( -// triggerType === 'device' && -// ((branchesLength === 1 && !!branches[0]?.when?.length) || // 有一组数据并且when有值 -// (branchesLength > 1 && !branches[branchesLength - 1]?.when?.length)) // 有多组否则数据,并且最后一组when有值 -// ) { -// branches.push(null); -// } -// } -// -// this.data = { -// ...result, -// trigger: result.trigger || {}, -// branches: cloneDeep(assignmentKey(branches)), -// options: {...defaultOptions, ...result.options }, -// } -// } -// }, -// getProduct() { -// -// } -// }, -// getters: { -// -// } -// }) \ No newline at end of file diff --git a/src/utils/regular.ts b/src/utils/regular.ts index 7e7fa9cc..c98f5d64 100644 --- a/src/utils/regular.ts +++ b/src/utils/regular.ts @@ -7,4 +7,12 @@ export const isUrl = (path: string): boolean => urlReg.test(path) export const inputReg = /^[a-zA-Z0-9_\-]+$/ -export const isInput = (value: string) => inputReg.test(value) \ No newline at end of file +export const isInput = (value: string) => inputReg.test(value) + +// cron 表达式 + +export const CronRegEx = new RegExp( + '^\\s*($|#|\\w+\\s*=|(\\?|\\*|(?:[0-5]?\\d)(?:(?:-|\\/|\\,)(?:[0-5]?\\d))?(?:,(?:[0-5]?\\d)(?:(?:-|\\/|\\,)(?:[0-5]?\\d))?)*)\\s+(\\?|\\*|(?:[0-5]?\\d)(?:(?:-|\\/|\\,)(?:[0-5]?\\d))?(?:,(?:[0-5]?\\d)(?:(?:-|\\/|\\,)(?:[0-5]?\\d))?)*)\\s+(\\?|\\*|(?:[01]?\\d|2[0-3])(?:(?:-|\\/|\\,)(?:[01]?\\d|2[0-3]))?(?:,(?:[01]?\\d|2[0-3])(?:(?:-|\\/|\\,)(?:[01]?\\d|2[0-3]))?)*)\\s+(\\?|\\*|(?:0?[1-9]|[12]\\d|3[01])(?:(?:-|\\/|\\,)(?:0?[1-9]|[12]\\d|3[01]))?(?:,(?:0?[1-9]|[12]\\d|3[01])(?:(?:-|\\/|\\,)(?:0?[1-9]|[12]\\d|3[01]))?)*)\\s+(\\?|\\*|(?:[1-9]|1[012])(?:(?:-|\\/|\\,)(?:[1-9]|1[012]))?(?:L|W)?(?:,(?:[1-9]|1[012])(?:(?:-|\\/|\\,)(?:[1-9]|1[012]))?(?:L|W)?)*|\\?|\\*|(?:JAN|FEB|MAR|APR|MAY|JUN|JUL|AUG|SEP|OCT|NOV|DEC)(?:(?:-)(?:JAN|FEB|MAR|APR|MAY|JUN|JUL|AUG|SEP|OCT|NOV|DEC))?(?:,(?:JAN|FEB|MAR|APR|MAY|JUN|JUL|AUG|SEP|OCT|NOV|DEC)(?:(?:-)(?:JAN|FEB|MAR|APR|MAY|JUN|JUL|AUG|SEP|OCT|NOV|DEC))?)*)\\s+(\\?|\\*|(?:[0-6])(?:(?:-|\\/|\\,|#)(?:[0-6]))?(?:L)?(?:,(?:[0-6])(?:(?:-|\\/|\\,|#)(?:[0-6]))?(?:L)?)*|\\?|\\*|(?:MON|TUE|WED|THU|FRI|SAT|SUN)(?:(?:-)(?:MON|TUE|WED|THU|FRI|SAT|SUN))?(?:,(?:MON|TUE|WED|THU|FRI|SAT|SUN)(?:(?:-)(?:MON|TUE|WED|THU|FRI|SAT|SUN))?)*)(|\\s)+(\\?|\\*|(?:|\\d{4})(?:(?:-|\\/|\\,)(?:|\\d{4}))?(?:,(?:|\\d{4})(?:(?:-|\\/|\\,)(?:|\\d{4}))?)*))$', +); + +export const isCron = (value: string) => CronRegEx.test(value) \ No newline at end of file diff --git a/src/views/rule-engine/Scene/Save/Device/AddModal.vue b/src/views/rule-engine/Scene/Save/Device/AddModal.vue index 6aa25bc2..5bae6dc3 100644 --- a/src/views/rule-engine/Scene/Save/Device/AddModal.vue +++ b/src/views/rule-engine/Scene/Save/Device/AddModal.vue @@ -6,7 +6,7 @@ @click='save' @cancel='cancel' > - + @@ -17,19 +17,28 @@ +
- + + +
@@ -37,10 +46,12 @@ \ No newline at end of file diff --git a/src/views/rule-engine/Scene/Save/Device/DeviceSelect.vue b/src/views/rule-engine/Scene/Save/Device/DeviceSelect.vue new file mode 100644 index 00000000..b3aa34d6 --- /dev/null +++ b/src/views/rule-engine/Scene/Save/Device/DeviceSelect.vue @@ -0,0 +1,83 @@ + + + + + \ No newline at end of file diff --git a/src/views/rule-engine/Scene/Save/Device/OrgList.vue b/src/views/rule-engine/Scene/Save/Device/OrgList.vue new file mode 100644 index 00000000..1374b005 --- /dev/null +++ b/src/views/rule-engine/Scene/Save/Device/OrgList.vue @@ -0,0 +1,130 @@ + + + + + \ No newline at end of file diff --git a/src/views/rule-engine/Scene/Save/Device/Product.vue b/src/views/rule-engine/Scene/Save/Device/Product.vue index d9d778ac..705d4b9e 100644 --- a/src/views/rule-engine/Scene/Save/Device/Product.vue +++ b/src/views/rule-engine/Scene/Save/Device/Product.vue @@ -4,18 +4,25 @@ type='simple' @search="handleSearch" class='search' + target="scene-triggrt-device-device" /> +