Commit a9ddc543f951322c43140598f8534be87bcd4024

Authored by xp.Huang
2 parents 14c92d61 cb127b93

Merge branch 'ww' into 'main'

fix: Bug in teambition

See merge request huang/yun-teng-iot-front!310
Showing 45 changed files with 97 additions and 43 deletions
1 -import { RadioRecord } from '/@/views/data/board/detail/config/util'; 1 +import { RadioRecord } from '../../../views/visual/board/detail/config/util';
2 2
3 export interface AddDataBoardParams { 3 export interface AddDataBoardParams {
4 name: string; 4 name: string;
@@ -49,6 +49,10 @@ export const useRedo = (_router?: Router) => { @@ -49,6 +49,10 @@ export const useRedo = (_router?: Router) => {
49 params['_redirect_type'] = 'path'; 49 params['_redirect_type'] = 'path';
50 params['path'] = fullPath; 50 params['path'] = fullPath;
51 } 51 }
  52 + // TODO DEFECT-687 teambition
  53 + if (fullPath.includes('/visual/board/detail/')) {
  54 + params['path'] = fullPath;
  55 + }
52 push({ name: REDIRECT_NAME, params, query }).then(() => resolve(true)); 56 push({ name: REDIRECT_NAME, params, query }).then(() => resolve(true));
53 }); 57 });
54 } 58 }
@@ -6,7 +6,7 @@ import { @@ -6,7 +6,7 @@ import {
6 EXCEPTION_COMPONENT, 6 EXCEPTION_COMPONENT,
7 PAGE_NOT_FOUND_NAME, 7 PAGE_NOT_FOUND_NAME,
8 } from '/@/router/constant'; 8 } from '/@/router/constant';
9 -import { DATA_BOARD_SHARE_URL } from '/@/views/data/board/config/config'; 9 +import { DATA_BOARD_SHARE_URL } from '../../views/visual/board/config/config';
10 10
11 // 404 on a page 11 // 404 on a page
12 export const PAGE_NOT_FOUND_ROUTE: AppRouteRecordRaw = { 12 export const PAGE_NOT_FOUND_ROUTE: AppRouteRecordRaw = {
@@ -81,7 +81,7 @@ export const ERROR_LOG_ROUTE: AppRouteRecordRaw = { @@ -81,7 +81,7 @@ export const ERROR_LOG_ROUTE: AppRouteRecordRaw = {
81 export const DATA_BOARD_SHARE: AppRouteRecordRaw = { 81 export const DATA_BOARD_SHARE: AppRouteRecordRaw = {
82 path: DATA_BOARD_SHARE_URL(), 82 path: DATA_BOARD_SHARE_URL(),
83 name: 'dataBoardSharePage', 83 name: 'dataBoardSharePage',
84 - component: () => import('/@/views/data/board/detail/index.vue'), 84 + component: () => import('/@/views/visual/board/detail/index.vue'),
85 meta: { 85 meta: {
86 ignoreAuth: true, 86 ignoreAuth: true,
87 title: '分享看板', 87 title: '分享看板',
@@ -14,7 +14,7 @@ @@ -14,7 +14,7 @@
14 Reflect.deleteProperty(params, 'path'); 14 Reflect.deleteProperty(params, 'path');
15 15
16 const _path = Array.isArray(path) ? path.join('/') : path; 16 const _path = Array.isArray(path) ? path.join('/') : path;
17 - 17 + console.log(unref(currentRoute));
18 if (_redirect_type === 'name') { 18 if (_redirect_type === 'name') {
19 replace({ 19 replace({
20 name: _path, 20 name: _path,
src/views/visual/board/components/InstrumentComponent/DashBoardComponent.vue renamed from src/views/data/board/components/InstrumentComponent/DashBoardComponent.vue
@@ -79,15 +79,20 @@ @@ -79,15 +79,20 @@
79 const getUpdateValueFn = (componentType: InstrumentComponentType) => { 79 const getUpdateValueFn = (componentType: InstrumentComponentType) => {
80 if (componentType === 'instrument-component-1') return update_instrument_1_value; 80 if (componentType === 'instrument-component-1') return update_instrument_1_value;
81 if (componentType === 'instrument-component-2') return update_instrument_2_value; 81 if (componentType === 'instrument-component-2') return update_instrument_2_value;
82 - return (_radio: number) => {}; 82 + return (_radio: DashBoardValue) => {};
83 }; 83 };
84 84
85 - const updateChartValue = useThrottleFn((newValue) => { 85 + const updateChartValue = useThrottleFn(() => {
86 const updateFn = getUpdateValueFn(props.layout.componentType); 86 const updateFn = getUpdateValueFn(props.layout.componentType);
87 - unref(chartRef)?.setOption((updateFn(newValue || 0) as unknown as EChartsOption) || {}); 87 + unref(chartRef)?.setOption((updateFn(props.value) as unknown as EChartsOption) || {});
88 }, 500); 88 }, 500);
89 89
90 - watch(() => props.value.value, updateChartValue); 90 + watch(() => props.value, updateChartValue);
  91 +
  92 + // watch(
  93 + // () => [props.value.gradientInfo, props.value.unit, props.value.valueColor, props.value.name],
  94 + // updateChartValue
  95 + // );
91 96
92 const updateChartFont = useThrottleFn(() => { 97 const updateChartFont = useThrottleFn(() => {
93 const option = beforeUpdateFn(props.layout.componentType); 98 const option = beforeUpdateFn(props.layout.componentType);
@@ -110,7 +115,9 @@ @@ -110,7 +115,9 @@
110 function handleRandomValue() { 115 function handleRandomValue() {
111 const newValue = Math.floor(Math.random() * 100); 116 const newValue = Math.floor(Math.random() * 100);
112 const updateFn = getUpdateValueFn(props.layout.componentType); 117 const updateFn = getUpdateValueFn(props.layout.componentType);
113 - unref(chartRef)?.setOption((updateFn(newValue) as unknown as EChartsOption) || {}); 118 + unref(chartRef)?.setOption(
  119 + (updateFn({ ...props.value, value: newValue }) as unknown as EChartsOption) || {}
  120 + );
114 } 121 }
115 122
116 onMounted(() => { 123 onMounted(() => {
@@ -135,20 +142,20 @@ @@ -135,20 +142,20 @@
135 <div class="text-center" :style="{ fontSize: fontSize({ radio: getRadio, basic: 16 }) }"> 142 <div class="text-center" :style="{ fontSize: fontSize({ radio: getRadio, basic: 16 }) }">
136 {{ props.value.name }} 143 {{ props.value.name }}
137 </div> 144 </div>
138 - <div  
139 - class="text-xs text-center truncate p-5"  
140 - :style="{ fontSize: fontSize({ radio: getRadio, basic: 12, max: 16 }), color: '#999' }" 145 + <Tooltip
  146 + placement="top"
  147 + :title="dateUtil(props?.value?.updateTime || new Date()).format(DEFAULT_DATE_FORMAT)"
141 > 148 >
142 - <Tooltip  
143 - placement="top"  
144 - :title="dateUtil(props?.value?.updateTime || new Date()).format(DEFAULT_DATE_FORMAT)" 149 + <div
  150 + class="text-xs text-center truncate p-5"
  151 + :style="{ fontSize: fontSize({ radio: getRadio, basic: 12, max: 16 }), color: '#999' }"
145 > 152 >
146 <span class="mr-2">更新时间:</span> 153 <span class="mr-2">更新时间:</span>
147 <span> 154 <span>
148 {{ dateUtil(props?.value?.updateTime || new Date()).format(DEFAULT_DATE_FORMAT) }} 155 {{ dateUtil(props?.value?.updateTime || new Date()).format(DEFAULT_DATE_FORMAT) }}
149 </span> 156 </span>
150 - </Tooltip>  
151 - </div> 157 + </div>
  158 + </Tooltip>
152 </div> 159 </div>
153 </div> 160 </div>
154 </template> 161 </template>
src/views/visual/board/components/InstrumentComponent/DigitalDashBoard.vue renamed from src/views/data/board/components/InstrumentComponent/DigitalDashBoard.vue
@@ -151,20 +151,20 @@ @@ -151,20 +151,20 @@
151 > 151 >
152 <span>{{ props.value.name || '电表' }}</span> 152 <span>{{ props.value.name || '电表' }}</span>
153 </div> 153 </div>
154 - <div  
155 - class="text-center text-xs truncate p-5"  
156 - :style="{ fontSize: fontSize({ radio: getRadio, basic: 12, max: 16 }), color: '#999' }" 154 + <Tooltip
  155 + placement="top"
  156 + :title="dateUtil(props?.value?.updateTime || new Date()).format(DEFAULT_DATE_FORMAT)"
157 > 157 >
158 - <Tooltip  
159 - placement="top"  
160 - :title="dateUtil(props?.value?.updateTime || new Date()).format(DEFAULT_DATE_FORMAT)" 158 + <div
  159 + class="text-center text-xs truncate p-5"
  160 + :style="{ fontSize: fontSize({ radio: getRadio, basic: 12, max: 16 }), color: '#999' }"
161 > 161 >
162 <span class="mr-1">更新时间:</span> 162 <span class="mr-1">更新时间:</span>
163 <span> 163 <span>
164 {{ dateUtil(props?.value?.updateTime || new Date()).format(DEFAULT_DATE_FORMAT) }} 164 {{ dateUtil(props?.value?.updateTime || new Date()).format(DEFAULT_DATE_FORMAT) }}
165 </span> 165 </span>
166 - </Tooltip>  
167 - </div> 166 + </div>
  167 + </Tooltip>
168 </div> 168 </div>
169 <div></div> 169 <div></div>
170 </section> 170 </section>
src/views/visual/board/components/InstrumentComponent/dashBoardComponent.config.ts renamed from src/views/data/board/components/InstrumentComponent/dashBoardComponent.config.ts
@@ -32,7 +32,7 @@ export interface DashBoardValue { @@ -32,7 +32,7 @@ export interface DashBoardValue {
32 name?: string; 32 name?: string;
33 updateTime?: string; 33 updateTime?: string;
34 value?: number; 34 value?: number;
35 - valueColor?: string; 35 + fontColor?: string;
36 gradientInfo?: GradientInfoRecord[]; 36 gradientInfo?: GradientInfoRecord[];
37 } 37 }
38 38
@@ -53,6 +53,7 @@ export const instrumentComponent1 = (params?: Partial<ComponentInfo>): EChartsOp @@ -53,6 +53,7 @@ export const instrumentComponent1 = (params?: Partial<ComponentInfo>): EChartsOp
53 series: [ 53 series: [
54 { 54 {
55 type: 'gauge', 55 type: 'gauge',
  56 + radius: '50%',
56 center: ['50%', '60%'], 57 center: ['50%', '60%'],
57 startAngle: 200, 58 startAngle: 200,
58 endAngle: -20, 59 endAngle: -20,
@@ -83,15 +84,15 @@ export const instrumentComponent1 = (params?: Partial<ComponentInfo>): EChartsOp @@ -83,15 +84,15 @@ export const instrumentComponent1 = (params?: Partial<ComponentInfo>): EChartsOp
83 }, 84 },
84 }, 85 },
85 splitLine: { 86 splitLine: {
86 - distance: -45,  
87 - length: 14, 87 + distance: -40,
  88 + length: 10,
88 lineStyle: { 89 lineStyle: {
89 width: 3, 90 width: 3,
90 color: '#999', 91 color: '#999',
91 }, 92 },
92 }, 93 },
93 axisLabel: { 94 axisLabel: {
94 - distance: -5, 95 + distance: 0,
95 color: '#999', 96 color: '#999',
96 // fontSize: 20, 97 // fontSize: 20,
97 }, 98 },
@@ -120,6 +121,7 @@ export const instrumentComponent1 = (params?: Partial<ComponentInfo>): EChartsOp @@ -120,6 +121,7 @@ export const instrumentComponent1 = (params?: Partial<ComponentInfo>): EChartsOp
120 }, 121 },
121 { 122 {
122 type: 'gauge', 123 type: 'gauge',
  124 + radius: '50%',
123 center: ['50%', '60%'], 125 center: ['50%', '60%'],
124 startAngle: 200, 126 startAngle: 200,
125 endAngle: -20, 127 endAngle: -20,
@@ -239,7 +241,7 @@ export const getGradient = (key: Gradient, record: GradientInfo[] = []) => { @@ -239,7 +241,7 @@ export const getGradient = (key: Gradient, record: GradientInfo[] = []) => {
239 }; 241 };
240 242
241 export const update_instrument_1_font = (radio: number) => { 243 export const update_instrument_1_font = (radio: number) => {
242 - const basicFontSize = fontSize({ radio, basic: 20, max: 25, min: 12 }); 244 + const basicFontSize = fontSize({ radio, basic: 16, max: 16, min: 12 });
243 return { 245 return {
244 series: [ 246 series: [
245 { 247 {
@@ -256,7 +258,7 @@ export const update_instrument_1_font = (radio: number) => { @@ -256,7 +258,7 @@ export const update_instrument_1_font = (radio: number) => {
256 258
257 export const update_instrument_2_font = (radio: number) => { 259 export const update_instrument_2_font = (radio: number) => {
258 const axisLabelFontSize = fontSize({ radio, basic: 10, max: 16 }); 260 const axisLabelFontSize = fontSize({ radio, basic: 10, max: 16 });
259 - const detailFontSize = fontSize({ radio, basic: 20, max: 25, min: 12 }); 261 + const detailFontSize = fontSize({ radio, basic: 16, max: 16, min: 10 });
260 return { 262 return {
261 series: [ 263 series: [
262 { 264 {
@@ -275,11 +277,16 @@ const handleValue = (value: any) => { @@ -275,11 +277,16 @@ const handleValue = (value: any) => {
275 return Number(value).toFixed(2); 277 return Number(value).toFixed(2);
276 }; 278 };
277 279
278 -export const update_instrument_1_value = (value: number) => { 280 +export const update_instrument_1_value = (params: DashBoardValue) => {
  281 + const { value = 0, unit = '°C', fontColor } = params;
279 return { 282 return {
280 series: [ 283 series: [
281 { 284 {
282 data: [{ value: handleValue(value) }], 285 data: [{ value: handleValue(value) }],
  286 + detail: {
  287 + formatter: `{value} ${unit ?? ''}`,
  288 + color: fontColor || 'inherit',
  289 + },
283 }, 290 },
284 { 291 {
285 data: [{ value: handleValue(value) }], 292 data: [{ value: handleValue(value) }],
@@ -288,11 +295,35 @@ export const update_instrument_1_value = (value: number) => { @@ -288,11 +295,35 @@ export const update_instrument_1_value = (value: number) => {
288 } as EChartsOption; 295 } as EChartsOption;
289 }; 296 };
290 297
291 -export const update_instrument_2_value = (value: number) => { 298 +export const update_instrument_2_value = (params: DashBoardValue) => {
  299 + const { value = 0, unit = 'km/h', fontColor, gradientInfo } = params;
  300 + const firstRecord = getGradient(Gradient.FIRST, gradientInfo);
  301 + const secondRecord = getGradient(Gradient.SECOND, gradientInfo);
  302 + const thirdRecord = getGradient(Gradient.THIRD, gradientInfo);
  303 +
  304 + let max = thirdRecord?.value || secondRecord?.value || firstRecord?.value || 70;
  305 + max = Number(1 + Array(String(max).length).fill(0).join(''));
  306 +
  307 + const firstGradient = firstRecord?.value ? firstRecord.value / max : 0.3;
  308 + const secondGradient = secondRecord?.value ? secondRecord.value / max : 0.7;
292 return { 309 return {
293 series: [ 310 series: [
294 { 311 {
295 data: [{ value: handleValue(value) }], 312 data: [{ value: handleValue(value) }],
  313 + detail: {
  314 + formatter: `{value} ${unit ?? ''}`,
  315 + color: fontColor || 'inherit',
  316 + },
  317 + axisLine: {
  318 + lineStyle: {
  319 + width: 20,
  320 + color: [
  321 + [firstGradient, firstRecord?.color || GradientColor.FIRST],
  322 + [secondGradient, secondRecord?.color || GradientColor.SECOND],
  323 + [1, thirdRecord?.color || GradientColor.THIRD],
  324 + ],
  325 + },
  326 + },
296 }, 327 },
297 ], 328 ],
298 } as EChartsOption; 329 } as EChartsOption;
src/views/visual/board/components/InstrumentComponent/digitalDashBoard.config.ts renamed from src/views/data/board/components/InstrumentComponent/digitalDashBoard.config.ts
src/views/visual/board/components/InstrumentComponent/index.ts renamed from src/views/data/board/components/InstrumentComponent/index.ts
src/views/visual/board/components/Other/CommandSendButton.vue renamed from src/views/data/board/components/Other/CommandSendButton.vue
src/views/visual/board/components/Other/IndicatorLight.vue renamed from src/views/data/board/components/Other/IndicatorLight.vue
src/views/visual/board/components/Other/InformationPanel.vue renamed from src/views/data/board/components/Other/InformationPanel.vue
src/views/visual/board/components/Other/LightBulbSwitch.vue renamed from src/views/data/board/components/Other/LightBulbSwitch.vue
src/views/visual/board/components/Other/RockerSwitch.vue renamed from src/views/data/board/components/Other/RockerSwitch.vue
src/views/visual/board/components/Other/SlidingSwitch.vue renamed from src/views/data/board/components/Other/SlidingSwitch.vue
src/views/visual/board/components/Other/ToggleSwitch.vue renamed from src/views/data/board/components/Other/ToggleSwitch.vue
src/views/visual/board/components/PanelDetailModal.vue renamed from src/views/data/board/components/PanelDetailModal.vue
src/views/visual/board/components/PictureComponent/PictureComponent.vue renamed from src/views/data/board/components/PictureComponent/PictureComponent.vue
src/views/visual/board/components/PictureComponent/index.ts renamed from src/views/data/board/components/PictureComponent/index.ts
src/views/visual/board/components/PictureComponent/pictureComponent.config.ts renamed from src/views/data/board/components/PictureComponent/pictureComponent.config.ts
src/views/visual/board/components/TextComponent/TextComponent.vue renamed from src/views/data/board/components/TextComponent/TextComponent.vue
@@ -91,11 +91,12 @@ @@ -91,11 +91,12 @@
91 </div> 91 </div>
92 </div> 92 </div>
93 </div> 93 </div>
94 - <div v-if="getShowUpdate" class="text-center text-xs truncate p-5" style="color: #999">  
95 - <Tooltip  
96 - placement="top"  
97 - :title="dateUtil(props?.value?.updateTime || new Date()).format(DEFAULT_DATE_FORMAT)"  
98 - > 94 + <Tooltip
  95 + v-if="getShowUpdate"
  96 + placement="top"
  97 + :title="dateUtil(props?.value?.updateTime || new Date()).format(DEFAULT_DATE_FORMAT)"
  98 + >
  99 + <div class="text-center text-xs truncate p-5" style="color: #999">
99 <div 100 <div
100 :style="{ fontSize: fontSize({ radio: getRadio, basic: 12, max: 14 }) }" 101 :style="{ fontSize: fontSize({ radio: getRadio, basic: 12, max: 14 }) }"
101 class="truncate" 102 class="truncate"
@@ -105,7 +106,7 @@ @@ -105,7 +106,7 @@
105 {{ dateUtil(props?.value?.updateTime || new Date()).format(DEFAULT_DATE_FORMAT) }} 106 {{ dateUtil(props?.value?.updateTime || new Date()).format(DEFAULT_DATE_FORMAT) }}
106 </span> 107 </span>
107 </div> 108 </div>
108 - </Tooltip>  
109 - </div> 109 + </div>
  110 + </Tooltip>
110 </div> 111 </div>
111 </template> 112 </template>
src/views/visual/board/components/TextComponent/config.ts renamed from src/views/data/board/components/TextComponent/config.ts
src/views/visual/board/components/WidgetHeader/BaseWidgetHeader.vue renamed from src/views/data/board/components/WidgetHeader/BaseWidgetHeader.vue
src/views/visual/board/components/WidgetWrapper/WidgetWrapper.vue renamed from src/views/data/board/components/WidgetWrapper/WidgetWrapper.vue
src/views/visual/board/components/WidgetWrapper/type.ts renamed from src/views/data/board/components/WidgetWrapper/type.ts
src/views/visual/board/config/componentMap.ts renamed from src/views/data/board/config/componentMap.ts
src/views/visual/board/config/config.ts renamed from src/views/data/board/config/config.ts
src/views/visual/board/config/panelDetail.ts renamed from src/views/data/board/config/panelDetail.ts
src/views/visual/board/detail/components/BasicConfiguration.vue renamed from src/views/data/board/detail/components/BasicConfiguration.vue
src/views/visual/board/detail/components/DataBindModal.vue renamed from src/views/data/board/detail/components/DataBindModal.vue
src/views/visual/board/detail/components/HistoryTrendModal.vue renamed from src/views/data/board/detail/components/HistoryTrendModal.vue
src/views/visual/board/detail/components/VisualConfiguration.vue renamed from src/views/data/board/detail/components/VisualConfiguration.vue
src/views/visual/board/detail/components/VisualOptionsModal.vue renamed from src/views/data/board/detail/components/VisualOptionsModal.vue
src/views/visual/board/detail/components/VisualWidgetSelect.vue renamed from src/views/data/board/detail/components/VisualWidgetSelect.vue
src/views/visual/board/detail/config/basicConfiguration.ts renamed from src/views/data/board/detail/config/basicConfiguration.ts
src/views/visual/board/detail/config/help.ts renamed from src/views/data/board/detail/config/help.ts
src/views/visual/board/detail/config/historyTrend.config.ts renamed from src/views/data/board/detail/config/historyTrend.config.ts
src/views/visual/board/detail/config/util.ts renamed from src/views/data/board/detail/config/util.ts
src/views/visual/board/detail/config/visualOptions.ts renamed from src/views/data/board/detail/config/visualOptions.ts
src/views/visual/board/detail/index.vue renamed from src/views/data/board/detail/index.vue
@@ -49,6 +49,8 @@ @@ -49,6 +49,8 @@
49 49
50 const ROUTER = useRouter(); 50 const ROUTER = useRouter();
51 51
  52 + // unref(ROUTE).name = unref(ROUTE).fullPath;
  53 +
52 const { createMessage, createConfirm } = useMessage(); 54 const { createMessage, createConfirm } = useMessage();
53 55
54 const getBoardId = computed(() => { 56 const getBoardId = computed(() => {
src/views/visual/board/hook/useCalcGridLayout.ts renamed from src/views/data/board/hook/useCalcGridLayout.ts
src/views/visual/board/hook/useSocketConnect.ts renamed from src/views/data/board/hook/useSocketConnect.ts
src/views/visual/board/hook/useUpdateCenter.ts renamed from src/views/data/board/hook/useUpdateCenter.ts
src/views/visual/board/index.vue renamed from src/views/data/board/index.vue
@@ -136,9 +136,18 @@ @@ -136,9 +136,18 @@
136 136
137 const handleViewBoard = (record: DataBoardRecord) => { 137 const handleViewBoard = (record: DataBoardRecord) => {
138 const hasDetailPermission = hasPermission('api:yt:data_component:list'); 138 const hasDetailPermission = hasPermission('api:yt:data_component:list');
139 - if (hasDetailPermission)  
140 - router.push(`/data/board/detail/${encode(record.id)}/${encode(record.name)}`);  
141 - else createMessage.warning('没有权限'); 139 + if (hasDetailPermission) {
  140 + const boardId = encode(record.id);
  141 + const boardName = encode(record.name);
  142 + router.push(`/visual/board/detail/${boardId}/${boardName}`);
  143 + // router.push({
  144 + // name: 'visualBoardDetail'
  145 + // params: {
  146 + // boardId: encode(record.id),
  147 + // boardName: encode(record.name),
  148 + // },
  149 + // });
  150 + } else createMessage.warning('没有权限');
142 }; 151 };
143 152
144 const handlePagenationPosition = () => { 153 const handlePagenationPosition = () => {
src/views/visual/board/types/type.ts renamed from src/views/data/board/types/type.ts