@tmesoft/data-screen-set 0.0.1 → 0.0.3

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,30 +1,68 @@
1
- # Vue 3 + TypeScript + Vite
2
-
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.
4
-
5
- ## Recommended IDE Setup
6
-
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).
8
-
9
- ## Type Support For `.vue` Imports in TS
10
-
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.
12
-
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:
14
-
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.
1
+ # data-screen-set
2
+ ## 如何使用
3
+ 用于渲染数据大屏设置
4
+ 1. pnpm i @tmesoft/data-screen-set
19
5
 
6
+ ## demo
7
+ ```vue
8
+ <!--ts-->
9
+ import DataScreenSet from '@tmesoft/data-screen-set'
10
+ /**
11
+ * @description: 监听数据卡编辑、自定义卡上传、编辑事件
12
+ * @param type 卡类型
13
+ * @param id 卡id值
14
+ */
15
+ const editBtnClick = (type:CardType,id:number)=>{
16
+ console.log(type,id,'editBtnClick')
17
+ }
18
+ /**
19
+ * @description: 点击拖拽卡事件
20
+ * @param type 卡类型
21
+ * @param id 卡id值
22
+ */
23
+ const changeActive = (type:CardType,id:number) => {
24
+ console.log(type,id,'changeActive')
25
+ }
26
+ /**
27
+ * @description: 更新坐标信息
28
+ * @param coordinate 位置信息包括数据卡和自定义卡
29
+ * @return
30
+ */
31
+ const addOrUpCoordinate = (coordinate:{dataCard:{ id: number; detail: IbigScreenCoordinate }[],customCard:{ id: number; detail: IbigScreenCoordinate }[]})=>{
32
+ console.log(coordinate)
33
+ }
34
+ const dataScreenSetRef = ref()
35
+ // 传入json数据
20
36
 
21
- import DataScreenSet from './components/data-screen-set/index.vue'
22
- import {nextTick, onMounted, ref} from "vue";
23
- import {CustomListPage} from "./components/data-screen-set/types.ts";
37
+ const dataScreenSetRef = ref()
38
+ onMounted(()=>{
39
+ dataScreenSetRef.value?.setDataCardListJson(
40
+ {'师资队伍' :{id:1,idEditBtn:true},
41
+ '科研成果':{id:2,idEditBtn:true},
42
+ '设备资产':{id:3,idEditBtn:false},
43
+ '预约开放':{id:4,idEditBtn:false},
44
+ '实验室运行':{id:5,idEditBtn:true},
45
+ '安全数据':{id:6,idEditBtn:false},
46
+ '实验人次':{id:7,idEditBtn:false},
47
+ '实验报告':{id:8,idEditBtn:false},
48
+ '实验成绩':{id:9,idEditBtn:false},
49
+ '实验交流':{id:10,idEditBtn:false}})})
50
+ // ------------------------------ 给子组件传递参数 ------------------------------
51
+ /**
52
+ * @description: 大屏标题
53
+ */
54
+ const title = ref('智慧化实验室')
55
+ /**
56
+ * @description: 自定义卡列表坐标
57
+ */
24
58
  const customCardCoordinateList = ref([{"id":133,"detail":{"left":1129,"width":380,"top":397,"height":228}},
25
59
  {"id":134,"detail":{"left":120,"width":308,"top":210,"height":273}},
26
60
  {"id":135,"detail":{"left":649,"width":360,"top":235,"height":271}}])
27
- const emits = defineEmits(['changeDataActive','editBtnClick'])
61
+ /**
62
+ * @description: 自定义卡列表数据
63
+ * @param
64
+ * @return
65
+ */
28
66
  const _customCardList = [
29
67
  {
30
68
  "id": 133,
@@ -64,7 +102,7 @@ isEdit: false
64
102
  }
65
103
  })
66
104
  : [])
67
- // ------------------------------ 数据卡 ------------------------------
105
+ // 数据卡列表数据
68
106
  const dataCardCoordinateList = ref([
69
107
  {"id":1,"detail":{"left":0,"width":367,"top":75,"height":173}},
70
108
  {"id":2,"detail":{"left":0,"width":365,"top":270,"height":172}},
@@ -76,43 +114,35 @@ const dataCardCoordinateList = ref([
76
114
  {"id":8,"detail":{"left":865,"width":365,"top":250,"height":172}},
77
115
  {"id":9,"detail":{"left":1225,"width":276,"top":355,"height":131}},
78
116
  {"id":10,"detail":{"left":895,"width":324,"top":695,"height":153}}])
79
- // 当前拖拽元素
80
- const targets = ref()
81
- onMounted(() => {
117
+ // 当前拖拽卡片类型
118
+ const activeType = ref<CardType>()
119
+ // 当前拖拽卡片id
120
+ const activeId = ref<number>()
121
+ <!--template-->
122
+ <data-screen-set :customCardList="customCardList"
123
+ :customCardCoordinateList="customCardCoordinateList"
124
+ :dataCardCoordinateList="dataCardCoordinateList"
125
+ :activeType="activeType"
126
+ :activeId="activeId"
127
+ :title="title"
128
+ @addOrUpCoordinate="addOrUpCoordinate"
129
+ @changeActive="changeActive"
130
+ @editBtnClick="editBtnClick"
131
+ ref="dataScreenSetRef"
132
+ />
133
+ ```
82
134
 
83
- nextTick(()=>{
135
+ ## 方法
84
136
 
85
- targets.value = document.querySelector('.data-target1')
86
- })})
137
+ | Name | Description | type |
138
+ |--------------|-----------------|-------------------------------|
139
+ | setRootWidthHeight | 设置大屏宽高 | object {width:number,height:number} |
140
+ | setDataCardListJson | 获取组件内的数据卡json内容 | |
87
141
 
88
- // 点击自定义拖拽组件
89
- const changeCustomActive = (id:number) => {
90
- targets.value = document.querySelector(`.target${id}`)
91
- }
92
- type CardType = 'data-target' | 'custom-target'
93
- const changeDataActive = (type:CardType,id:number) => {
94
- targets.value = document.querySelector(`.data-target${id}`)
95
- emits('changeDataActive',type,id)
142
+ ## 事件
96
143
 
97
- }
98
- const EDataCardType = {
99
- '师资队伍' : 1,
100
- '科研成果' : 2,
101
- '设备资产' : 3,
102
- '预约开放' : 4,
103
- '实验室运行' : 5,
104
- '安全数据' : 6,
105
- '实验人次' : 7,
106
- '实验报告':8,
107
- '实验成绩':9,
108
- '实验交流':10
109
- }
110
- /**
111
- * @description: 编辑按钮点击
112
- * @param type 数据卡、自定义卡
113
- * @param id 当前卡id
114
- * @return
115
- */
116
- const editBtnClick = (type:CardType,id)=>{
117
- emits('editBtnClick',type,id)
118
- }
144
+ | Name | Description |
145
+ |------------|-------------------|
146
+ | addOrUpCoordinate | 更新坐标信息 |
147
+ | changeActive | 修改当前拖拽元素 |
148
+ | editBtnClick | 点击数据卡、自定义卡的编辑上传按钮 |