Commit 49687882eea3ae23aab0a8b9b710d4415173d884
Merge branch 'ww' into 'main'
fix: DEFECT-736 reset default color after color picker clean color See merge request huang/yun-teng-iot-front!321
Showing
12 changed files
with
198 additions
and
42 deletions
| ... | ... | @@ -18,6 +18,10 @@ |
| 18 | 18 | config: { |
| 19 | 19 | type: Object as PropType<ColorPicker.Options>, |
| 20 | 20 | }, |
| 21 | + defaultValue: { | |
| 22 | + type: String, | |
| 23 | + default: '', | |
| 24 | + }, | |
| 21 | 25 | }); |
| 22 | 26 | |
| 23 | 27 | const emit = defineEmits(['update:value']); |
| ... | ... | @@ -47,6 +51,12 @@ |
| 47 | 51 | unref(picker)?.hide(); |
| 48 | 52 | }; |
| 49 | 53 | |
| 54 | + const onClear = () => { | |
| 55 | + emit('update:value', props.defaultValue); | |
| 56 | + unref(picker)?.hide(); | |
| 57 | + unref(picker)?.setColor(props.defaultValue); | |
| 58 | + }; | |
| 59 | + | |
| 50 | 60 | const getOption = computed<ColorPicker.Options>(() => { |
| 51 | 61 | const { config = {} } = props; |
| 52 | 62 | return { |
| ... | ... | @@ -94,11 +104,13 @@ |
| 94 | 104 | picker.value = ColorPicker.create(unref(getOption)); |
| 95 | 105 | unref(picker)?.on('init', onInit); |
| 96 | 106 | unref(picker)?.on('save', onSave); |
| 107 | + unref(picker)?.on('clear', onClear); | |
| 97 | 108 | }); |
| 98 | 109 | |
| 99 | 110 | onUnmounted(() => { |
| 100 | 111 | unref(picker)?.off('init', onInit); |
| 101 | 112 | unref(picker)?.off('save', onSave); |
| 113 | + unref(picker)?.off('clear', onClear); | |
| 102 | 114 | |
| 103 | 115 | unref(picker)?.destroyAndRemove(); |
| 104 | 116 | }); | ... | ... |
| ... | ... | @@ -60,19 +60,31 @@ |
| 60 | 60 | } |
| 61 | 61 | |
| 62 | 62 | const getRadio = computed(() => { |
| 63 | - const { radio } = props.radio; | |
| 64 | - return radio; | |
| 63 | + // const { radio } = props.radio; | |
| 64 | + return props.radio; | |
| 65 | + }); | |
| 66 | + | |
| 67 | + const getChardRadio = computed(() => { | |
| 68 | + const realWidth = unref(chartRef)?.getWidth(); | |
| 69 | + const realHeight = unref(chartRef)?.getHeight(); | |
| 70 | + const radioRecord = props.radio; | |
| 71 | + // const widht | |
| 72 | + return { | |
| 73 | + ...radioRecord, | |
| 74 | + height: realHeight || radioRecord.height, | |
| 75 | + width: realWidth || radioRecord.height, | |
| 76 | + }; | |
| 65 | 77 | }); |
| 66 | 78 | |
| 67 | 79 | const beforeUpdateFn = (componentType: InstrumentComponentType) => { |
| 68 | 80 | if (componentType === 'instrument-component-1') return update_instrument_1_font; |
| 69 | 81 | if (componentType === 'instrument-component-2') return update_instrument_2_font; |
| 70 | - return (_radio: number) => {}; | |
| 82 | + return (_radio: RadioRecord) => {}; | |
| 71 | 83 | }; |
| 72 | 84 | |
| 73 | 85 | function update() { |
| 74 | 86 | const option = beforeUpdateFn(props.layout.componentType); |
| 75 | - unref(chartRef)?.setOption((option(unref(getRadio)) as unknown as EChartsOption) || {}); | |
| 87 | + unref(chartRef)?.setOption((option(unref(getChardRadio)) as unknown as EChartsOption) || {}); | |
| 76 | 88 | unref(chartRef)?.resize(); |
| 77 | 89 | } |
| 78 | 90 | |
| ... | ... | @@ -97,7 +109,7 @@ |
| 97 | 109 | const updateChartFont = useThrottleFn(() => { |
| 98 | 110 | const option = beforeUpdateFn(props.layout.componentType); |
| 99 | 111 | setTimeout(() => { |
| 100 | - unref(chartRef)?.setOption((option(unref(getRadio)) as unknown as EChartsOption) || {}); | |
| 112 | + unref(chartRef)?.setOption((option(unref(getChardRadio)) as unknown as EChartsOption) || {}); | |
| 101 | 113 | }); |
| 102 | 114 | }, 500); |
| 103 | 115 | |
| ... | ... | @@ -143,7 +155,10 @@ |
| 143 | 155 | <div> |
| 144 | 156 | <div |
| 145 | 157 | class="text-center" |
| 146 | - :style="{ fontSize: fontSize({ radio: getRadio, basic: 16, max: 18 }), color: '#666' }" | |
| 158 | + :style="{ | |
| 159 | + fontSize: fontSize({ radioRecord: getRadio, basic: 16, max: 18 }), | |
| 160 | + color: '#666', | |
| 161 | + }" | |
| 147 | 162 | > |
| 148 | 163 | {{ props.value.name }} |
| 149 | 164 | </div> |
| ... | ... | @@ -157,7 +172,10 @@ |
| 157 | 172 | > |
| 158 | 173 | <div |
| 159 | 174 | class="text-xs text-center truncate p-5" |
| 160 | - :style="{ fontSize: fontSize({ radio: getRadio, basic: 12, max: 12 }), color: '#999' }" | |
| 175 | + :style="{ | |
| 176 | + fontSize: fontSize({ radioRecord: getRadio, basic: 12, max: 12 }), | |
| 177 | + color: '#999', | |
| 178 | + }" | |
| 161 | 179 | > |
| 162 | 180 | <span class="mr-2">更新时间:</span> |
| 163 | 181 | <span> | ... | ... |
| ... | ... | @@ -53,8 +53,9 @@ |
| 53 | 53 | }); |
| 54 | 54 | |
| 55 | 55 | const getRadio = computed(() => { |
| 56 | - const { radio } = props.radio || DEFAULT_RADIO_RECORD; | |
| 57 | - return radio; | |
| 56 | + // const { radio } = props.radio || DEFAULT_RADIO_RECORD; | |
| 57 | + // return radio; | |
| 58 | + return props.radio || DEFAULT_RADIO_RECORD; | |
| 58 | 59 | }); |
| 59 | 60 | |
| 60 | 61 | let timeout: Nullable<number> = null; |
| ... | ... | @@ -91,7 +92,7 @@ |
| 91 | 92 | :size="4" |
| 92 | 93 | :style="{ |
| 93 | 94 | backgroundColor: '#585357', |
| 94 | - padding: fontSize({ radio: getRadio, basic: 10 }), | |
| 95 | + padding: fontSize({ radioRecord: getRadio, basic: 10 }), | |
| 95 | 96 | }" |
| 96 | 97 | > |
| 97 | 98 | <div |
| ... | ... | @@ -100,8 +101,8 @@ |
| 100 | 101 | class="digital-wrapper__int" |
| 101 | 102 | :style="{ |
| 102 | 103 | color: getPropsValue.fontColor, |
| 103 | - fontSize: fontSize({ radio: getRadio, basic: 20, max: 20 }), | |
| 104 | - padding: fontSize({ radio: getRadio, basic: 5 }), | |
| 104 | + fontSize: fontSize({ radioRecord: getRadio, basic: 20, max: 20 }), | |
| 105 | + padding: fontSize({ radioRecord: getRadio, basic: 5 }), | |
| 105 | 106 | }" |
| 106 | 107 | > |
| 107 | 108 | <div class="digital-text__int p-1 text-light-50"> {{ number }}</div> |
| ... | ... | @@ -118,7 +119,7 @@ |
| 118 | 119 | :size="4" |
| 119 | 120 | :style="{ |
| 120 | 121 | backgroundColor: '#b74940', |
| 121 | - padding: fontSize({ radio: getRadio, basic: 10 }), | |
| 122 | + padding: fontSize({ radioRecord: getRadio, basic: 10 }), | |
| 122 | 123 | }" |
| 123 | 124 | > |
| 124 | 125 | <div |
| ... | ... | @@ -127,8 +128,8 @@ |
| 127 | 128 | class="digital-wrapper__float" |
| 128 | 129 | :style="{ |
| 129 | 130 | color: getPropsValue.fontColor, |
| 130 | - fontSize: fontSize({ radio: getRadio, basic: 20, max: 20 }), | |
| 131 | - padding: fontSize({ radio: getRadio, basic: 5 }), | |
| 131 | + fontSize: fontSize({ radioRecord: getRadio, basic: 20, max: 20 }), | |
| 132 | + padding: fontSize({ radioRecord: getRadio, basic: 5 }), | |
| 132 | 133 | }" |
| 133 | 134 | > |
| 134 | 135 | <div class="digital-text__float p-1 text-light-50"> |
| ... | ... | @@ -137,8 +138,8 @@ |
| 137 | 138 | </div> |
| 138 | 139 | </Space> |
| 139 | 140 | <div |
| 140 | - class="px-1" | |
| 141 | - :style="{ fontSize: fontSize({ radio: getRadio, basic: 18, max: 18 }) }" | |
| 141 | + class="px-1 font-bold" | |
| 142 | + :style="{ fontSize: fontSize({ radioRecord: getRadio, basic: 18, max: 18 }) }" | |
| 142 | 143 | > |
| 143 | 144 | {{ getPropsValue.unit }} |
| 144 | 145 | </div> |
| ... | ... | @@ -147,7 +148,7 @@ |
| 147 | 148 | |
| 148 | 149 | <div |
| 149 | 150 | class="text-center truncate" |
| 150 | - :style="{ fontSize: fontSize({ radio: getRadio, basic: 18 }) }" | |
| 151 | + :style="{ fontSize: fontSize({ radioRecord: getRadio, basic: 18 }) }" | |
| 151 | 152 | > |
| 152 | 153 | <span>{{ props.value.name || '电表' }}</span> |
| 153 | 154 | </div> |
| ... | ... | @@ -161,7 +162,10 @@ |
| 161 | 162 | > |
| 162 | 163 | <div |
| 163 | 164 | class="text-center text-xs truncate p-5" |
| 164 | - :style="{ fontSize: fontSize({ radio: getRadio, basic: 12, max: 16 }), color: '#999' }" | |
| 165 | + :style="{ | |
| 166 | + fontSize: fontSize({ radioRecord: getRadio, basic: 12, max: 16 }), | |
| 167 | + color: '#999', | |
| 168 | + }" | |
| 165 | 169 | > |
| 166 | 170 | <span class="mr-1">更新时间:</span> |
| 167 | 171 | <span> | ... | ... |
| 1 | 1 | import { EChartsOption } from 'echarts'; |
| 2 | -import { fontSize } from '../../detail/config/util'; | |
| 2 | +import { fontSize, RadioRecord } from '../../detail/config/util'; | |
| 3 | 3 | import { Gradient, visualOptionField } from '../../detail/config/visualOptions'; |
| 4 | 4 | import { |
| 5 | 5 | ComponentInfo, |
| ... | ... | @@ -240,8 +240,8 @@ export const getGradient = (key: Gradient, record: GradientInfo[] = []) => { |
| 240 | 240 | return record.find((item) => item.key === key); |
| 241 | 241 | }; |
| 242 | 242 | |
| 243 | -export const update_instrument_1_font = (radio: number) => { | |
| 244 | - const basicFontSize = fontSize({ radio, basic: 16, max: 16, min: 12 }); | |
| 243 | +export const update_instrument_1_font = (radioRecord: RadioRecord) => { | |
| 244 | + const basicFontSize = fontSize({ radioRecord, basic: 16, max: 16, min: 12 }); | |
| 245 | 245 | return { |
| 246 | 246 | series: [ |
| 247 | 247 | { |
| ... | ... | @@ -256,9 +256,9 @@ export const update_instrument_1_font = (radio: number) => { |
| 256 | 256 | } as EChartsOption; |
| 257 | 257 | }; |
| 258 | 258 | |
| 259 | -export const update_instrument_2_font = (radio: number) => { | |
| 260 | - const axisLabelFontSize = fontSize({ radio, basic: 10, max: 16 }); | |
| 261 | - const detailFontSize = fontSize({ radio, basic: 16, max: 16, min: 10 }); | |
| 259 | +export const update_instrument_2_font = (radioRecord: RadioRecord) => { | |
| 260 | + const axisLabelFontSize = fontSize({ radioRecord, basic: 10, max: 16 }); | |
| 261 | + const detailFontSize = fontSize({ radioRecord, basic: 16, max: 16, min: 10 }); | |
| 262 | 262 | return { |
| 263 | 263 | series: [ |
| 264 | 264 | { | ... | ... |
| ... | ... | @@ -22,8 +22,9 @@ |
| 22 | 22 | const getImagBase64 = ref(fallback); |
| 23 | 23 | |
| 24 | 24 | const getRadio = computed(() => { |
| 25 | - const { radio } = props.radio || DEFAULT_RADIO_RECORD; | |
| 26 | - return radio; | |
| 25 | + // const { radio } = props.radio || DEFAULT_RADIO_RECORD; | |
| 26 | + // return radio; | |
| 27 | + return props.radio || DEFAULT_RADIO_RECORD; | |
| 27 | 28 | }); |
| 28 | 29 | |
| 29 | 30 | const getWidth = computed(() => { |
| ... | ... | @@ -69,7 +70,7 @@ |
| 69 | 70 | <!-- <Image :style="{ width: `${getWidth}px` }" :src="getImagBase64" /> --> |
| 70 | 71 | <div |
| 71 | 72 | class="w-full text-center truncate p-5" |
| 72 | - :style="{ fontSize: fontSize({ radio: getRadio, basic: 12, max: 12 }), color: '#999' }" | |
| 73 | + :style="{ fontSize: fontSize({ radioRecord: getRadio, basic: 12, max: 12 }), color: '#999' }" | |
| 73 | 74 | > |
| 74 | 75 | <Tooltip |
| 75 | 76 | placement="top" | ... | ... |
| ... | ... | @@ -47,8 +47,9 @@ |
| 47 | 47 | }); |
| 48 | 48 | |
| 49 | 49 | const getRadio = computed(() => { |
| 50 | - const { radio } = props.radio; | |
| 51 | - return radio; | |
| 50 | + // const { radio } = props.radio; | |
| 51 | + // return radio; | |
| 52 | + return props.radio || DEFAULT_RADIO_RECORD; | |
| 52 | 53 | }); |
| 53 | 54 | </script> |
| 54 | 55 | |
| ... | ... | @@ -66,8 +67,8 @@ |
| 66 | 67 | prefix="iconfont" |
| 67 | 68 | :style="{ |
| 68 | 69 | color: props.value.iconColor, |
| 69 | - width: fontSize({ radio: getRadio, basic: 50, min: 16 }), | |
| 70 | - height: fontSize({ radio: getRadio, basic: 50, min: 16 }), | |
| 70 | + width: fontSize({ radioRecord: getRadio, basic: 50, min: 16 }), | |
| 71 | + height: fontSize({ radioRecord: getRadio, basic: 50, min: 16 }), | |
| 71 | 72 | }" |
| 72 | 73 | /> |
| 73 | 74 | </div> |
| ... | ... | @@ -77,12 +78,12 @@ |
| 77 | 78 | class="truncate" |
| 78 | 79 | :suffix="getShowUnit ? props.value.unit : ''" |
| 79 | 80 | :value-style="{ |
| 80 | - fontSize: fontSize({ radio: getRadio, basic: 24, min: 16 }), | |
| 81 | + fontSize: fontSize({ radioRecord: getRadio, basic: 24, min: 16 }), | |
| 81 | 82 | color: props.value.fontColor, |
| 82 | 83 | }" |
| 83 | 84 | /> |
| 84 | 85 | </div> |
| 85 | - <div :style="{ color: '#666', fontSize: fontSize({ radio: getRadio, basic: 16 }) }"> | |
| 86 | + <div :style="{ color: '#666', fontSize: fontSize({ radioRecord: getRadio, basic: 16 }) }"> | |
| 86 | 87 | <!-- {{ getShowUnit ? props.value.unit : '' }} --> |
| 87 | 88 | {{ props.value.name }} |
| 88 | 89 | </div> |
| ... | ... | @@ -103,7 +104,7 @@ |
| 103 | 104 | > |
| 104 | 105 | <div class="text-center text-xs truncate p-5" style="color: #999"> |
| 105 | 106 | <div |
| 106 | - :style="{ fontSize: fontSize({ radio: getRadio, basic: 12, max: 12 }) }" | |
| 107 | + :style="{ fontSize: fontSize({ radioRecord: getRadio, basic: 12, max: 12 }) }" | |
| 107 | 108 | class="truncate" |
| 108 | 109 | > |
| 109 | 110 | <span class="mr-1">更新时间:</span> | ... | ... |
| ... | ... | @@ -63,7 +63,7 @@ |
| 63 | 63 | :key="index" |
| 64 | 64 | > |
| 65 | 65 | <Tooltip :title="item.deviceName" placement="top"> |
| 66 | - <span> | |
| 66 | + <span class="font-bold"> | |
| 67 | 67 | <!-- <SvgIcon name="" prefix="iconfont" class="!fill-emerald-400" /> --> |
| 68 | 68 | <span>{{ item.deviceRename || item.deviceName }}</span> |
| 69 | 69 | </span> | ... | ... |
| 1 | +import { getOrganizationList } from '/@/api/system/system'; | |
| 1 | 2 | import { FormSchema } from '/@/components/Form'; |
| 3 | +import { copyTransFun } from '/@/utils/fnUtils'; | |
| 2 | 4 | export enum ViewType { |
| 3 | 5 | PRIVATE_VIEW = 'PRIVATE_VIEW', |
| 4 | 6 | PUBLIC_VIEW = 'PUBLIC_VIEW', |
| ... | ... | @@ -9,12 +11,29 @@ export const formSchema: FormSchema[] = [ |
| 9 | 11 | field: 'name', |
| 10 | 12 | label: '名称', |
| 11 | 13 | component: 'Input', |
| 12 | - required: true, | |
| 14 | + rules: [{ required: true, message: '请输入看板名称' }], | |
| 13 | 15 | componentProps: { |
| 14 | 16 | placeholder: '请输入看板名称', |
| 15 | 17 | }, |
| 16 | 18 | }, |
| 17 | 19 | { |
| 20 | + field: 'organizationId', | |
| 21 | + component: 'ApiTreeSelect', | |
| 22 | + label: '组织', | |
| 23 | + rules: [{ required: true, message: '组织为必填项' }], | |
| 24 | + componentProps() { | |
| 25 | + return { | |
| 26 | + placeholder: '请选择组织', | |
| 27 | + api: async () => { | |
| 28 | + const data = await getOrganizationList(); | |
| 29 | + copyTransFun(data as any as any[]); | |
| 30 | + return data; | |
| 31 | + }, | |
| 32 | + getPopupContainer: () => document.body, | |
| 33 | + }; | |
| 34 | + }, | |
| 35 | + }, | |
| 36 | + { | |
| 18 | 37 | field: 'viewType', |
| 19 | 38 | label: '名称', |
| 20 | 39 | component: 'RadioGroup', | ... | ... |
src/views/visual/board/config/searchForm.ts
0 → 100644
| 1 | +import { getOrganizationList } from '/@/api/system/system'; | |
| 2 | +import { FormSchema } from '/@/components/Form'; | |
| 3 | +import { ColEx } from '/@/components/Form/src/types'; | |
| 4 | +import { useGridLayout } from '/@/hooks/component/useGridLayout'; | |
| 5 | +import { copyTransFun } from '/@/utils/fnUtils'; | |
| 6 | + | |
| 7 | +export const formSchema: FormSchema[] = [ | |
| 8 | + { | |
| 9 | + field: 'name', | |
| 10 | + label: '看板名称', | |
| 11 | + component: 'Input', | |
| 12 | + // colProps: { span: 10 }, | |
| 13 | + colProps: useGridLayout(2, 3, 4) as unknown as ColEx, | |
| 14 | + }, | |
| 15 | + { | |
| 16 | + field: 'organizationId', | |
| 17 | + component: 'ApiTreeSelect', | |
| 18 | + label: '组织', | |
| 19 | + // colProps: { span: 10 }, | |
| 20 | + colProps: useGridLayout(2, 3, 4) as unknown as ColEx, | |
| 21 | + componentProps() { | |
| 22 | + return { | |
| 23 | + placeholder: '请选择组织', | |
| 24 | + api: async () => { | |
| 25 | + const data = await getOrganizationList(); | |
| 26 | + copyTransFun(data as any as any[]); | |
| 27 | + return data; | |
| 28 | + }, | |
| 29 | + getPopupContainer: () => document.body, | |
| 30 | + }; | |
| 31 | + }, | |
| 32 | + }, | |
| 33 | +]; | ... | ... |
| ... | ... | @@ -25,7 +25,7 @@ export const calcScale = ( |
| 25 | 25 | width = width * (widthRadio / 100); |
| 26 | 26 | height = height * (heightRadio / 100); |
| 27 | 27 | |
| 28 | - const temp = width * height; | |
| 28 | + const temp = width > height ? height ** 2 : width ** 2; | |
| 29 | 29 | |
| 30 | 30 | const isLess = temp < 300 * 300; |
| 31 | 31 | |
| ... | ... | @@ -40,16 +40,17 @@ export const calcScale = ( |
| 40 | 40 | }; |
| 41 | 41 | |
| 42 | 42 | export const fontSize = ({ |
| 43 | - radio, | |
| 43 | + radioRecord, | |
| 44 | 44 | basic, |
| 45 | 45 | max, |
| 46 | 46 | min, |
| 47 | 47 | }: { |
| 48 | - radio: number; | |
| 48 | + radioRecord: RadioRecord; | |
| 49 | 49 | basic: number; |
| 50 | 50 | max?: number; |
| 51 | 51 | min?: number; |
| 52 | 52 | }) => { |
| 53 | + const { radio } = radioRecord; | |
| 53 | 54 | let res = basic * radio; |
| 54 | 55 | if (max && res > max) res = max; |
| 55 | 56 | if (min && res < min) res = min; | ... | ... |
| ... | ... | @@ -28,6 +28,11 @@ export enum Gradient { |
| 28 | 28 | SECOND = 'second', |
| 29 | 29 | THIRD = 'third', |
| 30 | 30 | } |
| 31 | +export enum GradientColor { | |
| 32 | + FIRST = '#67e0e3', | |
| 33 | + SECOND = '#37a2da', | |
| 34 | + THIRD = '#fd666d', | |
| 35 | +} | |
| 31 | 36 | |
| 32 | 37 | export enum visualOptionField { |
| 33 | 38 | FONT_COLOR = 'fontColor', |
| ... | ... | @@ -48,6 +53,9 @@ export const modeOne: FormSchema[] = [ |
| 48 | 53 | label: '数值字体颜色', |
| 49 | 54 | component: 'ColorPicker', |
| 50 | 55 | changeEvent: 'update:value', |
| 56 | + componentProps: { | |
| 57 | + defaultValue: '#000', | |
| 58 | + }, | |
| 51 | 59 | }, |
| 52 | 60 | ]; |
| 53 | 61 | |
| ... | ... | @@ -57,6 +65,9 @@ export const modeTwo: FormSchema[] = [ |
| 57 | 65 | label: '数值字体颜色', |
| 58 | 66 | component: 'ColorPicker', |
| 59 | 67 | changeEvent: 'update:value', |
| 68 | + componentProps: { | |
| 69 | + defaultValue: '#000', | |
| 70 | + }, | |
| 60 | 71 | }, |
| 61 | 72 | { |
| 62 | 73 | field: visualOptionField.UNIT, |
| ... | ... | @@ -71,6 +82,9 @@ export const modeTwo: FormSchema[] = [ |
| 71 | 82 | label: '图标颜色', |
| 72 | 83 | component: 'ColorPicker', |
| 73 | 84 | changeEvent: 'update:value', |
| 85 | + componentProps: { | |
| 86 | + defaultValue: '#367BFF', | |
| 87 | + }, | |
| 74 | 88 | }, |
| 75 | 89 | { |
| 76 | 90 | field: visualOptionField.ICON, |
| ... | ... | @@ -92,6 +106,9 @@ export const modeThree: FormSchema[] = [ |
| 92 | 106 | label: '数值字体颜色', |
| 93 | 107 | component: 'ColorPicker', |
| 94 | 108 | changeEvent: 'update:value', |
| 109 | + componentProps: { | |
| 110 | + defaultValue: '#000', | |
| 111 | + }, | |
| 95 | 112 | }, |
| 96 | 113 | { |
| 97 | 114 | field: visualOptionField.UNIT, |
| ... | ... | @@ -106,6 +123,9 @@ export const modeThree: FormSchema[] = [ |
| 106 | 123 | label: '一阶段颜色', |
| 107 | 124 | component: 'ColorPicker', |
| 108 | 125 | changeEvent: 'update:value', |
| 126 | + componentProps: { | |
| 127 | + defaultValue: GradientColor.FIRST, | |
| 128 | + }, | |
| 109 | 129 | }, |
| 110 | 130 | { |
| 111 | 131 | field: visualOptionField.FIRST_PHASE_VALUE, |
| ... | ... | @@ -121,6 +141,9 @@ export const modeThree: FormSchema[] = [ |
| 121 | 141 | label: '二阶段颜色', |
| 122 | 142 | component: 'ColorPicker', |
| 123 | 143 | changeEvent: 'update:value', |
| 144 | + componentProps: { | |
| 145 | + defaultValue: GradientColor.SECOND, | |
| 146 | + }, | |
| 124 | 147 | }, |
| 125 | 148 | { |
| 126 | 149 | field: visualOptionField.SECOND_PHASE_VALUE, |
| ... | ... | @@ -138,6 +161,9 @@ export const modeThree: FormSchema[] = [ |
| 138 | 161 | label: '三阶段颜色', |
| 139 | 162 | component: 'ColorPicker', |
| 140 | 163 | changeEvent: 'update:value', |
| 164 | + componentProps: { | |
| 165 | + defaultValue: GradientColor.THIRD, | |
| 166 | + }, | |
| 141 | 167 | }, |
| 142 | 168 | { |
| 143 | 169 | field: visualOptionField.THIRD_PHASE_VALUE, |
| ... | ... | @@ -158,6 +184,9 @@ export const modeFour: FormSchema[] = [ |
| 158 | 184 | label: '数值字体颜色', |
| 159 | 185 | component: 'ColorPicker', |
| 160 | 186 | changeEvent: 'update:value', |
| 187 | + componentProps: { | |
| 188 | + defaultValue: '#000', | |
| 189 | + }, | |
| 161 | 190 | }, |
| 162 | 191 | { |
| 163 | 192 | field: visualOptionField.UNIT, | ... | ... |
| ... | ... | @@ -19,6 +19,8 @@ |
| 19 | 19 | import { computed } from '@vue/reactivity'; |
| 20 | 20 | import { usePermission } from '/@/hooks/web/usePermission'; |
| 21 | 21 | import { encode } from './config/config'; |
| 22 | + import { useForm, BasicForm } from '/@/components/Form'; | |
| 23 | + import { formSchema } from './config/searchForm'; | |
| 22 | 24 | |
| 23 | 25 | const ListItem = List.Item; |
| 24 | 26 | const router = useRouter(); |
| ... | ... | @@ -28,6 +30,21 @@ |
| 28 | 30 | const listEL = ref(); |
| 29 | 31 | const loading = ref(false); |
| 30 | 32 | const dataBoardList = ref<DataBoardRecord[]>([]); |
| 33 | + | |
| 34 | + const [searchFormRegister, searchFormMethod] = useForm({ | |
| 35 | + schemas: formSchema, | |
| 36 | + labelWidth: 80, | |
| 37 | + layout: 'inline', | |
| 38 | + submitButtonOptions: { | |
| 39 | + loading: loading, | |
| 40 | + }, | |
| 41 | + submitFunc: async () => { | |
| 42 | + try { | |
| 43 | + await getDatasource(); | |
| 44 | + } catch (error) {} | |
| 45 | + }, | |
| 46 | + }); | |
| 47 | + | |
| 31 | 48 | //分页相关 |
| 32 | 49 | const page = ref(1); |
| 33 | 50 | const pageSize = ref(10); |
| ... | ... | @@ -87,9 +104,11 @@ |
| 87 | 104 | const getDatasource = async () => { |
| 88 | 105 | try { |
| 89 | 106 | loading.value = true; |
| 107 | + const params = searchFormMethod.getFieldsValue() || {}; | |
| 90 | 108 | const { total, items } = await getDataBoardList({ |
| 91 | 109 | page: unref(paginationProp).current, |
| 92 | 110 | pageSize: unref(paginationProp).pageSize, |
| 111 | + ...params, | |
| 93 | 112 | }); |
| 94 | 113 | dataBoardList.value = items; |
| 95 | 114 | paginationProp.value.total = total; |
| ... | ... | @@ -176,12 +195,16 @@ |
| 176 | 195 | |
| 177 | 196 | <template> |
| 178 | 197 | <PageWrapper> |
| 179 | - <div class="flex mb-6 items-center bg-light-100 h-78px"> | |
| 198 | + <div class="flex items-center mb-3 bg-light-100 h-78px"> | |
| 180 | 199 | <div class="text-lg ml-30px mr-9px font-bold">自定义看板</div> |
| 181 | 200 | <Authority value="api:yt:data_board:add:post"> |
| 182 | 201 | <Button type="primary" @click="handleOpenDetailModal">创建看板</Button> |
| 183 | 202 | </Authority> |
| 184 | 203 | </div> |
| 204 | + <div class="bg-light-100 mb-6 w-full p-3 search-form"> | |
| 205 | + <BasicForm class="flex-auto w-full" @register="searchFormRegister" /> | |
| 206 | + </div> | |
| 207 | + <!-- <div> </div> --> | |
| 185 | 208 | <Spin :spinning="loading"> |
| 186 | 209 | <List |
| 187 | 210 | ref="listEL" |
| ... | ... | @@ -193,7 +216,7 @@ |
| 193 | 216 | <ListItem> |
| 194 | 217 | <Card class="data-card cursor-pointer"> |
| 195 | 218 | <template #title> |
| 196 | - <div>{{ item.name }}</div> | |
| 219 | + <div class="font-bold">{{ item.name }}</div> | |
| 197 | 220 | </template> |
| 198 | 221 | <template #extra> |
| 199 | 222 | <Dropdown |
| ... | ... | @@ -266,4 +289,19 @@ |
| 266 | 289 | background-image: url('/@/assets/svg/component.svg'); |
| 267 | 290 | } |
| 268 | 291 | } |
| 292 | + | |
| 293 | + .search-form { | |
| 294 | + width: 100%; | |
| 295 | + form { | |
| 296 | + width: 100%; | |
| 297 | + :deep(.ant-row) { | |
| 298 | + width: 100%; | |
| 299 | + } | |
| 300 | + | |
| 301 | + :deep(.ant-row > div:last-child) { | |
| 302 | + flex: 1; | |
| 303 | + max-width: 100%; | |
| 304 | + } | |
| 305 | + } | |
| 306 | + } | |
| 269 | 307 | </style> | ... | ... |