@tmesoft/data-screen-show 0.0.5 → 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -1,18 +1,288 @@
1
- # Vue 3 + TypeScript + Vite
1
+ # data-screen-show
2
+ ## 如何使用
3
+ 目前用于ilim、rlim、hps-102d数据大屏项目,用于大屏显示
4
+ 1. pnpm i @tmesoft/data-screen-show
2
5
 
3
- This template should help get you started developing with Vue 3 and TypeScript in Vite. The template uses Vue 3 `<script setup>` SFCs, check out the [script setup docs](https://v3.vuejs.org/api/sfc-script-setup.html#sfc-script-setup) to learn more.
6
+ ## demo
7
+ ```vue
8
+ <!--ts-->
9
+ // 传入标题信息
10
+ // 大屏主标题
11
+ import {CustomListPage} from "./components";
12
+ // 标题
13
+ const pageTitle= 'ilim数据大屏'
14
+ // 副标题
15
+ const subTitle = 'ILIM-100智慧实验室信息化管理系统'
16
+ // ------------------------------ 数据卡‘师资队伍、科研成果、设备资产’数据 ------------------------------
17
+ // 设备资产数据
18
+ const equipmentInfoData = ref<any>({
19
+ count: undefined,
20
+ chartData: []
21
+ })
4
22
 
5
- ## Recommended IDE Setup
23
+ provide('equipmentInfoData',equipmentInfoData)
24
+ /**
25
+ * @description: 获取设备资产数据
26
+ */
27
+ const getEquipmentInfoData = ()=>{
28
+ // 获取设备状态数量
29
+ equipmentInfoData.value.count ={
30
+ normalCount:31,
31
+ repairCount : 2,
32
+ scrapCount : 3
33
+ }
34
+ equipmentInfoData.value.chartData = [
6
35
 
7
- - [VS Code](https://code.visualstudio.com/) + [Volar](https://marketplace.visualstudio.com/items?itemName=Vue.volar) (and disable Vetur) + [TypeScript Vue Plugin (Volar)](https://marketplace.visualstudio.com/items?itemName=Vue.vscode-typescript-vue-plugin).
36
+ {
37
+ "typeId": null,
38
+ "type": "人体生理类附近反复反复讲解",
39
+ "totalCount": 822,
40
+ "normalCount": null,
41
+ "repairCount": null,
42
+ "scrapCount": null
43
+ },
44
+ {
45
+ "typeId": null,
46
+ "type": "信号采集类烦烦烦烦烦烦烦烦烦方法",
47
+ "totalCount": 14222,
48
+ "normalCount": null,
49
+ "repairCount": null,
50
+ "scrapCount": null
51
+ },
52
+ {
53
+ "typeId": null,
54
+ "type": "教学仪器类烦烦烦烦烦烦烦烦烦方法",
55
+ "totalCount": 222222,
56
+ "normalCount": null,
57
+ "repairCount": null,
58
+ "scrapCount": null
59
+ }
60
+ ]
61
+ }
62
+ // ------------------------------ 科研成果数据 ------------------------------
63
+ const scientificInfochartData = ref<any[]>([])
64
+ provide('scientificInfochartData',scientificInfochartData)
65
+ /**
66
+ * @description: 获取科研成果数据
67
+ */
68
+ const getScientificInfochartData = ()=>{
69
+ scientificInfochartData.value = [
70
+ {
71
+ "id": 35,
72
+ "name": "科研论文啊啊啊啊",
73
+ "detail": "{\"2022\":99999,\"2023\":99999,\"2024\":99999}"
74
+ },
75
+ {
76
+ "id": 36,
77
+ "name": "专利证书1111",
78
+ "detail": "{\"2022\":88888,\"2023\":88888,\"2024\":88888}"
79
+ },
80
+ {
81
+ "id": 37,
82
+ "name": "教材著作吱吱吱吱",
83
+ "detail": "{\"2022\":77777,\"2023\":77777,\"2024\":77777}"
84
+ }
85
+ ]
86
+ }
87
+ // ------------------------------ 师资队伍数据 ------------------------------
88
+ const teacherInfochartData = ref<any[]>([])
89
+ provide('teacherInfochartData',teacherInfochartData)
90
+ /**
91
+ * @description: 获取师资队伍数据
92
+ */
93
+ const getTeacherInfochartData = ()=>{
8
94
 
9
- ## Type Support For `.vue` Imports in TS
95
+ teacherInfochartData.value =[
96
+ {
97
+ "id": 30,
98
+ "name": "教授教授教授11",
99
+ "count": 88888
100
+ },
101
+ {
102
+ "id": 31,
103
+ "name": "讲师222222",
104
+ "count": 99999
105
+ }
106
+ ]
10
107
 
11
- TypeScript cannot handle type information for `.vue` imports by default, so we replace the `tsc` CLI with `vue-tsc` for type checking. In editors, we need [TypeScript Vue Plugin (Volar)](https://marketplace.visualstudio.com/items?itemName=Vue.vscode-typescript-vue-plugin) to make the TypeScript language service aware of `.vue` types.
108
+ }
109
+ // 获取师资队伍、科研成果、设备资产数据
110
+ const getAllApiData = ()=>{
111
+ // const = centerIdValue as number
112
+ // const versionId = usePageStoreHook().versionId as number
113
+ setTimeout(getEquipmentInfoData,2000)
114
+ // 科研成果
115
+ setTimeout(
116
+ getScientificInfochartData
117
+ ,2000)
118
+ // 师资队伍
119
+ setTimeout(getTeacherInfochartData,1000)
120
+ }
121
+ // ------------------------------ 数据卡、自定义卡位置信息、数据信息 ------------------------------
122
+ // 根元素的宽高
123
+ const rootWidthHeight = {
124
+ width: 5760,
125
+ height: 3240
126
+ }
127
+ // 以下data数据来源于big-screen-version/version-detail 接口
128
+ const data = {
129
+ "dataCardIdList": [
130
+ 11,
131
+ 1,
132
+ 2,
133
+ 3
134
+ ],
135
+ "dataCardList": [
136
+ {
137
+ "id": 1,
138
+ "name": "师资队伍",
139
+ "type": 1
140
+ },
141
+ {
142
+ "id": 2,
143
+ "name": "科研成果",
144
+ "type": 1
145
+ },
146
+ {
147
+ "id": 3,
148
+ "name": "设备资产",
149
+ "type": 1
150
+ }
151
+ ],
152
+ "customList": [],
153
+ "coordinate": "{\"root\":{\"width\":1590,\"height\":894.375},\"dataCard\":[{\"id\":11,\"detail\":{\"left\":0,\"top\":0,\"width\":453,\"height\":214}},{\"id\":1,\"detail\":{\"left\":1228,\"top\":561,\"width\":362,\"height\":334}},{\"id\":2,\"detail\":{\"left\":865,\"width\":362,\"top\":723,\"height\":171}},{\"id\":3,\"detail\":{\"left\":75,\"width\":363,\"top\":107,\"height\":394}}],\"customCard\":[]}"
154
+ }
155
+ // 所有的数据卡id集合
156
+ const dataCardIdListIds = ref<number[]>([])
157
+ // 自定义卡数据变量
158
+ const customCardList = ref<CustomListPage[]>([])
159
+ // 大屏显示组件el
160
+ const dataScreenShowRef = ref()
161
+ onMounted(()=>{
162
+ dataScreenShowRef.value?.setDataCardJson( {
163
+ '师资队伍': 1,
164
+ '科研成果': 2,
165
+ '设备资产': 3,
166
+ '预约开放': 4,
167
+ '空间可视化': 5,
168
+ '安全数据': 6,
169
+ '实验人次': 7,
170
+ '实验报告': 8,
171
+ '实验成绩': 9,
172
+ '实验交流': 10
173
+ })
174
+ // ------------------------------ 以下是对data数据进行处理、获取需要的数据(目前处理方式相同);设置位置信息 ------------------------------
175
+ // 数据卡数据ids
176
+ dataCardIdListIds.value = data?.dataCardIdList?.length ? data.dataCardIdList : []
177
+ // 位置信息
178
+ const coordinate = data.coordinate ? JSON.parse(data.coordinate) : {}
179
+ // 主容器宽高
180
+ const root = coordinate?.root
181
+ const orginDataCardCoordinateList = coordinate?.dataCard || []
182
+ // 自定义卡列表
183
+ customCardList.value = data?.customList?.length
184
+ ? data.customList.map(item => {
185
+ const detail = item.detail ? JSON.parse(item.detail) : {}
186
+ return {
187
+ id: item.id,
188
+ bigScreenVersionId: item.bigScreenVersionId,
189
+ type: item.type,
190
+ name: item.name,
191
+ list: detail?.list || [],
192
+ swiperTime: detail?.swiperTime,
193
+ isLoop: detail?.isLoop,
194
+ volume: detail?.volume,
195
+ isEdit: false
196
+ }
197
+ })
198
+ : []
199
+ nextTick(() => {
200
+ // 数据卡坐标位置
201
+ if (orginDataCardCoordinateList?.length && dataCardIdListIds.value?.length) {
202
+ orginDataCardCoordinateList.forEach(item => {
203
+ const left = ((item.detail.left * rootWidthHeight.width) / root.width) * 0.01
204
+ const top = ((item.detail.top * rootWidthHeight.height) / root.height) * 0.01
205
+ const width = ((item.detail.width * rootWidthHeight.width) / root.width) * 0.01
206
+ const height = ((item.detail.height * rootWidthHeight.height) / root.height) * 0.01
207
+ const target = document.querySelector(`.data-target${item.id}`) as HTMLElement
208
+ if (!target) return
209
+ target.style.width = `${width}rem`
210
+ target.style.height = `${height}rem`
211
+ target.style.left = `${left}rem`
212
+ target.style.top = `${top}rem`
213
+ })
214
+ }
215
+ const customCardCoordinateList = coordinate?.customCard || []
216
+ // 自定义坐标位置
217
+ if (customCardCoordinateList?.length && customCardList.value?.length) {
218
+ customCardCoordinateList.forEach((item: any) => {
219
+ const left = ((item.detail.left * rootWidthHeight.width) / root.width) * 0.01
220
+ const top = ((item.detail.top * rootWidthHeight.height) / root.height) * 0.01
221
+ const width = ((item.detail.width * rootWidthHeight.width) / root.width) * 0.01
222
+ const height = ((item.detail.height * rootWidthHeight.height) / root.height) * 0.01
223
+ const target = document.querySelector(`.target${item.id}`) as HTMLElement
224
+ if (!target) return
225
+ target.style.width = `${width}rem`
226
+ target.style.height = `${height}rem`
227
+ target.style.left = `${left}rem`
228
+ target.style.top = `${top}rem`
229
+ })
230
+ }
231
+ })
232
+ // 获取师资队伍、科研成果、设备资产数据
233
+ getAllApiData()
234
+ })
12
235
 
13
- If the standalone TypeScript plugin doesn't feel fast enough to you, Volar has also implemented a [Take Over Mode](https://github.com/johnsoncodehk/volar/discussions/471#discussioncomment-1361669) that is more performant. You can enable it by the following steps:
236
+ <!--template-->
237
+ <DataScreenShow ref="dataScreenShowRef" :page-title="pageTitle" :sub-title="subTitle" :dataCardIdListIds="dataCardIdListIds" :customCardList="customCardList" >
238
+ <template #main-floor>
239
+ <div>3d楼层</div>
240
+ </template>
241
+ <!-- 预约开放 -->
242
+ <template #reservation-info>
14
243
 
15
- 1. Disable the built-in TypeScript Extension
16
- 1. Run `Extensions: Show Built-in Extensions` from VSCode's command palette
17
- 2. Find `TypeScript and JavaScript Language Features`, right click and select `Disable (Workspace)`
18
- 2. Reload the VSCode window by running `Developer: Reload Window` from the command palette.
244
+ <div>预约开放</div>
245
+ </template>
246
+ <!-- 安全模块-->
247
+ <template #safe-module>
248
+ <div>安全模块</div>
249
+ </template>
250
+
251
+
252
+ <!-- 实验人次 -->
253
+ <template #person-time-info>
254
+ <div>实验人次</div>
255
+ </template>
256
+
257
+ <!-- 实验报告 -->
258
+ <template #report-info>
259
+ <div>实验报告</div>
260
+ </template>
261
+
262
+ <!-- 实验成绩 -->
263
+ <template #experimental-results-info>
264
+ <div>实验成绩</div>
265
+ </template>
266
+
267
+ <!-- 实验交流 -->
268
+ <template #experimental-communication>
269
+ <div>实验交流</div>
270
+ </template>
271
+ </DataScreenShow>
272
+
273
+
274
+ ```
275
+
276
+ ## 方法
277
+
278
+ | Name | Description | type | default |
279
+ |--------------|-------------|-------------------------------|---------|
280
+ | setJSON | 设置所有数据卡 | | {'师资队伍': 1,} |
281
+ ## 传值
282
+
283
+ | Name | Description | type | default |
284
+ |-----------|--------------|--------|---------|
285
+ | pageTitle | 标题 | string | ‘’ |
286
+ | subTitle | 副标题标题 | string | ‘’ |
287
+ | dataCardIdListIds | 需要显示的数据卡id集合 | string | ‘’ |
288
+ | customCardList | 自定义卡数据 | CustomListPage[] | [] |
@@ -17,10 +17,6 @@ dataCardIdListIds: {
17
17
  type: PropType_2<number[]>;
18
18
  default: () => never[];
19
19
  };
20
- updataCardCoordinateList: {
21
- type: PropType_2<ICoordinateItem[]>;
22
- default: () => never[];
23
- };
24
20
  customCardList: {
25
21
  type: PropType_2<CustomListPage[]>;
26
22
  default: () => never[];
@@ -41,10 +37,6 @@ dataCardIdListIds: {
41
37
  type: PropType_2<number[]>;
42
38
  default: () => never[];
43
39
  };
44
- updataCardCoordinateList: {
45
- type: PropType_2<ICoordinateItem[]>;
46
- default: () => never[];
47
- };
48
40
  customCardList: {
49
41
  type: PropType_2<CustomListPage[]>;
50
42
  default: () => never[];
@@ -53,7 +45,6 @@ default: () => never[];
53
45
  subTitle: string;
54
46
  pageTitle: string;
55
47
  dataCardIdListIds: number[];
56
- updataCardCoordinateList: ICoordinateItem[];
57
48
  customCardList: CustomListPage[];
58
49
  }, {}, {}, {}, string, ComponentProvideOptions, true, {}, any>;
59
50
 
@@ -93,17 +84,4 @@ export declare enum EbigScreenCustomCardType {
93
84
  '文本' = 3
94
85
  }
95
86
 
96
- export declare interface IbigScreenCoordinate {
97
- left: number;
98
- width: number;
99
- top: number;
100
- height: number;
101
- }
102
-
103
- declare interface ICoordinateItem {
104
- id: number;
105
- width: number;
106
- height: number;
107
- }
108
-
109
87
  export { }