Commit c03ca1172092127ff2fc80cbf2ba20baf8230620
Merge branch 'perf/main_dev' of http://git.yunteng.com/yunteng/thingskit-scada into fix/zfl
Showing
6 changed files
with
42 additions
and
27 deletions
| ... | ... | @@ -53,9 +53,9 @@ const getTitle = computed(() => { |
| 53 | 53 | </p> |
| 54 | 54 | </div> |
| 55 | 55 | </template> |
| 56 | - <span :class="prefixCls"> | |
| 56 | + <span :class="prefixCls" class="flex items-center"> | |
| 57 | 57 | <component :is="slot as RendererElement" v-if="slots?.default" /> |
| 58 | - <Icon v-if="!slots?.default" icon="ph:question" class="svg:text-base" /> | |
| 58 | + <Icon v-if="!slots?.default" icon="ph:question" class="cursor-pointer text-base" /> | |
| 59 | 59 | </span> |
| 60 | 60 | </Tooltip> |
| 61 | 61 | </template> | ... | ... |
| ... | ... | @@ -253,7 +253,7 @@ export default defineComponent({ |
| 253 | 253 | return renderLabel |
| 254 | 254 | |
| 255 | 255 | return ( |
| 256 | - <span> | |
| 256 | + <span class='flex items-center'> | |
| 257 | 257 | {renderLabel} |
| 258 | 258 | <BasicHelp placement="top" class="mx-1" text={getHelpMessage} {...helpComponentProps} /> |
| 259 | 259 | </span> | ... | ... |
| ... | ... | @@ -28,7 +28,6 @@ const [registerForm, formActionType] = useForm({ |
| 28 | 28 | schemas: formSchemas, |
| 29 | 29 | showActionButtonGroup: false, |
| 30 | 30 | layout: FormLayoutEnum.VERTICAL, |
| 31 | - labelWidth: 70, | |
| 32 | 31 | getPopupContainer: () => document.body, |
| 33 | 32 | fieldMapToTime: [[AlarmListFieldsEnum.ALARM_LIST_QUERY_DATE, [AlarmListFieldsEnum.START_TIME, AlarmListFieldsEnum.END_TIME], DateFormatEnum.X]], |
| 34 | 33 | }) |
| ... | ... | @@ -82,7 +81,7 @@ onMounted(async () => { |
| 82 | 81 | </script> |
| 83 | 82 | |
| 84 | 83 | <template> |
| 85 | - <div class="m-1 w-full"> | |
| 84 | + <div class="m-1 w-full alarm-list-config-from"> | |
| 86 | 85 | <Divider orientation="left" class="!text-sm"> |
| 87 | 86 | 数据绑定 |
| 88 | 87 | </Divider> |
| ... | ... | @@ -95,6 +94,14 @@ onMounted(async () => { |
| 95 | 94 | </div> |
| 96 | 95 | </template> |
| 97 | 96 | |
| 98 | -<style> | |
| 99 | - | |
| 97 | +<style lang="less" scoped> | |
| 98 | +// .alarm-list-config-form { | |
| 99 | +// :deep(.ant-picker-input.ant-picker-input-active) { | |
| 100 | +// >input { | |
| 101 | +// overflow: hidden; | |
| 102 | +// text-overflow: ellipsis; | |
| 103 | +// white-space: nowrap; | |
| 104 | +// } | |
| 105 | +// } | |
| 106 | +// } | |
| 100 | 107 | </style> | ... | ... |
| ... | ... | @@ -133,6 +133,14 @@ export const formSchemas: FormSchema[] = [ |
| 133 | 133 | label: AlarmListFieldsNameEnum.ALARM_LIST_INTERVAL, |
| 134 | 134 | component: ComponentEnum.INPUT_NUMBER, |
| 135 | 135 | required: false, |
| 136 | + componentProps: { | |
| 137 | + min: 0, | |
| 138 | + }, | |
| 139 | + renderComponentContent: () => { | |
| 140 | + return { | |
| 141 | + addonAfter: () => '秒', | |
| 142 | + } | |
| 143 | + }, | |
| 136 | 144 | }, |
| 137 | 145 | { |
| 138 | 146 | field: AlarmListFieldsEnum.ALARM_LIST_POLLING, |
| ... | ... | @@ -140,5 +148,13 @@ export const formSchemas: FormSchema[] = [ |
| 140 | 148 | component: ComponentEnum.INPUT_NUMBER, |
| 141 | 149 | defaultValue: 30, |
| 142 | 150 | required: false, |
| 151 | + componentProps: { | |
| 152 | + min: 1, | |
| 153 | + }, | |
| 154 | + renderComponentContent: () => { | |
| 155 | + return { | |
| 156 | + addonAfter: () => '秒', | |
| 157 | + } | |
| 158 | + }, | |
| 143 | 159 | }, |
| 144 | 160 | ] | ... | ... |
| 1 | 1 | <script setup lang="ts"> |
| 2 | 2 | import { computed, nextTick, onMounted, reactive, unref } from 'vue' |
| 3 | -import { Divider, Tag } from 'ant-design-vue' | |
| 3 | +import { Tag } from 'ant-design-vue' | |
| 4 | +import { useIntervalFn } from '@vueuse/core' | |
| 4 | 5 | import { ScrollList } from './ScrollList' |
| 5 | 6 | import { fetchAlarmList } from '@/api/alarm' |
| 6 | 7 | import type { AlarmListItemType } from '@/api/alarm/model' |
| ... | ... | @@ -14,10 +15,6 @@ const props = defineProps<{ |
| 14 | 15 | config: CreateComponentType |
| 15 | 16 | }>() |
| 16 | 17 | |
| 17 | -const getCellBounds = computed( | |
| 18 | - () => props.config.cellBounds || { width: 290, height: 230, x: 0, y: 0 }, | |
| 19 | -) | |
| 20 | - | |
| 21 | 18 | const contentDataStore = useContentDataStore() |
| 22 | 19 | |
| 23 | 20 | const initOptions = reactive<{ |
| ... | ... | @@ -67,7 +64,7 @@ onMounted(async () => { |
| 67 | 64 | // 预览模式 |
| 68 | 65 | await initFetchAlarmList() |
| 69 | 66 | if (initOptions.polling) |
| 70 | - setInterval(initFetchAlarmList, initOptions.polling * 1000) | |
| 67 | + useIntervalFn(initFetchAlarmList, (initOptions.polling || 30) * 1000) | |
| 71 | 68 | } |
| 72 | 69 | else { |
| 73 | 70 | const statusList = Object.values(AlarmStatusEnum) |
| ... | ... | @@ -90,16 +87,13 @@ onMounted(async () => { |
| 90 | 87 | <div class="seamless-scroll w-full h-full flex justify-center items-center overflow-y-scroll"> |
| 91 | 88 | <ScrollList |
| 92 | 89 | v-model="initOptions.scroll" :single-wait-time="initOptions.interval" :list="initOptions.alarmList" |
| 93 | - :limit-scroll-num="10" :is-rem-unit="true" :delay="10" :wheel="true" hover :style="{ | |
| 94 | - width: `${getCellBounds.width}px`, | |
| 95 | - height: `${getCellBounds.height}px`, | |
| 96 | - }" | |
| 90 | + :is-rem-unit="true" :delay="10" :wheel="true" hover | |
| 97 | 91 | > |
| 98 | - <div v-for="(item, index) in initOptions.alarmList" :key="index" class="flex flex-col items-start h-15 px-2"> | |
| 99 | - <p class="text-xs"> | |
| 92 | + <div v-for="(item, index) in initOptions.alarmList" :key="index" class="flex flex-col items-start p-2 border-gray-600 border-b border-solid border-t-transparent border-l-transparent border-r-transparent"> | |
| 93 | + <div class="text-xs mb-2"> | |
| 100 | 94 | <span>设备:</span> |
| 101 | 95 | <span class="ml-1">{{ item.deviceAlias || item.deviceName }}</span> |
| 102 | - </p> | |
| 96 | + </div> | |
| 103 | 97 | <div class="flex items-center justify-between -mt-2 text-xs"> |
| 104 | 98 | <span>时间:</span> |
| 105 | 99 | <span class="ml-1">{{ item.startTs }}</span> |
| ... | ... | @@ -107,19 +101,17 @@ onMounted(async () => { |
| 107 | 101 | {{ AlarmStatusNameEnum[item.status] }} |
| 108 | 102 | </Tag> |
| 109 | 103 | </div> |
| 110 | - <Divider class="mt-2 divider" /> | |
| 111 | 104 | </div> |
| 112 | 105 | </ScrollList> |
| 113 | 106 | </div> |
| 114 | 107 | </template> |
| 115 | 108 | |
| 116 | 109 | <style scoped lang="less"> |
| 117 | -.seamless-scroll::-webkit-scrollbar { | |
| 118 | - display: none; | |
| 110 | +.seamless-scroll { | |
| 111 | + | |
| 112 | + ::-webkit-scrollbar { | |
| 113 | + display: none; | |
| 119 | 114 | |
| 120 | - .divider { | |
| 121 | - height: 0.3px; | |
| 122 | - background-color: black; | |
| 123 | 115 | } |
| 124 | 116 | } |
| 125 | 117 | </style> | ... | ... |