@bsgoal/common 2.12.1 → 2.13.1

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bsgoal/common",
3
- "version": "2.12.1",
3
+ "version": "2.13.1",
4
4
  "private": false,
5
5
  "files": [
6
6
  "dist",
@@ -28,7 +28,8 @@
28
28
  "dependencies": {
29
29
  "element-plus": "^2.3.3",
30
30
  "vue": "^3.3.4",
31
- "vue-router": "^4.1.6"
31
+ "vue-router": "^4.1.6",
32
+ "vue3-image-preview": "^0.2.6"
32
33
  },
33
34
  "devDependencies": {
34
35
  "@rushstack/eslint-patch": "^1.2.0",
@@ -2,7 +2,7 @@
2
2
  * @Author: canlong.shen
3
3
  * @Date: 2023-04-21 08:43:39
4
4
  * @LastEditors: canlong.shen
5
- * @LastEditTime: 2023-06-21 17:57:30
5
+ * @LastEditTime: 2023-06-25 09:47:05
6
6
  * @FilePath: \common\src\components\bsgoal-base-tree\demo.vue
7
7
  * @Description: 左侧树的演示
8
8
  *
@@ -45,10 +45,11 @@ const createData = (maxDeep, maxChildren, minNodesNumber, deep = 1, key = 'node'
45
45
  treeData.value = createData(4, 4, 4)
46
46
 
47
47
  const triggerTreeClick = (value, node, treeNode, event) => {
48
- console.log('value', value)
49
- console.log('node', node)
50
- console.log('treeNode', treeNode)
51
- console.log('event', event)
48
+ console.log('triggerTreeClick ================');
49
+ // console.log('value', value)
50
+ // console.log('node', node)
51
+ // console.log('treeNode', treeNode)
52
+ // console.log('event', event)
52
53
  }
53
54
 
54
55
  const treeLazyLoad = (node) => {
@@ -93,7 +94,7 @@ const treeInitNode = (node) => {
93
94
  }
94
95
 
95
96
  const triggerAddClick = (params = '') => {
96
- console.log('params', params)
97
+ console.log('triggerAddClick', params)
97
98
  }
98
99
  </script>
99
100
  <template>
@@ -2,7 +2,7 @@
2
2
  * @Author: canlong.shen
3
3
  * @Date: 2023-04-21 08:43:33
4
4
  * @LastEditors: canlong.shen
5
- * @LastEditTime: 2023-06-21 17:57:59
5
+ * @LastEditTime: 2023-06-25 10:05:14
6
6
  * @FilePath: \common\src\components\bsgoal-base-tree\index.vue
7
7
  * @Description: 虚拟化树型结构 公共组件
8
8
  *
@@ -30,7 +30,7 @@ const props = defineProps({
30
30
  /**
31
31
  * 数据
32
32
  */
33
- data: {
33
+ treeData: {
34
34
  type: [Object, Array],
35
35
  default: () => []
36
36
  },
@@ -69,7 +69,7 @@ const props = defineProps({
69
69
  }
70
70
  })
71
71
 
72
- const emits = defineEmits(['on-click', 'on-switch', 'on-click-add'])
72
+ const emits = defineEmits(['on-click', 'on-switch', 'on-add'])
73
73
 
74
74
  // 计算高度的指令
75
75
  const vHeight = directiveBase.height
@@ -132,8 +132,8 @@ const loadNode = async (node, resolve, props) => {
132
132
  }
133
133
 
134
134
  const lazyGet = computed(() => {
135
- const { data = [] } = props
136
- if (!data || !data.length) {
135
+ const { treeData = [] } = props
136
+ if (!treeData || !treeData.length) {
137
137
  return true
138
138
  }
139
139
 
@@ -149,7 +149,7 @@ const lazyGet = computed(() => {
149
149
  * @return {*}
150
150
  */
151
151
  const handleItemAdd = (node = null, data = {}) => {
152
- emits('on-click-add', { node, data })
152
+ emits('on-add', { node, data })
153
153
  }
154
154
  </script>
155
155
  <template>
@@ -164,7 +164,7 @@ const handleItemAdd = (node = null, data = {}) => {
164
164
  ref="EL_TREE_REF"
165
165
  highlight-current
166
166
  empty-text="暂无数据"
167
- :data="data"
167
+ :data="treeData"
168
168
  :lazy="lazyGet"
169
169
  :load="(node, resolve) => loadNode(node, resolve, props)"
170
170
  :expand-on-click-node="false"
@@ -181,7 +181,7 @@ const handleItemAdd = (node = null, data = {}) => {
181
181
  <!-- E 节点名称 -->
182
182
  <!-- S 操作符号 -->
183
183
  <span class="base_tree_node_icon" v-show="data.hasIcon">
184
- <el-icon color="#409EFF" @click="handleItemAdd(node, data)">
184
+ <el-icon color="#409EFF" @click.stop="handleItemAdd(node, data)">
185
185
  <Plus />
186
186
  </el-icon>
187
187
  </span>
@@ -2,7 +2,7 @@
2
2
  * @Author: canlong.shen
3
3
  * @Date: 2023-06-20 09:20:51
4
4
  * @LastEditors: canlong.shen
5
- * @LastEditTime: 2023-06-20 19:33:11
5
+ * @LastEditTime: 2023-06-25 15:22:12
6
6
  * @FilePath: \common\src\components\bsgoal-base-tree-table\demo.vue
7
7
  * @Description: 树 + 列表 + 演示
8
8
  *
@@ -10,11 +10,10 @@
10
10
  <script setup>
11
11
  /* setup模板
12
12
  ---------------------------------------------------------------- */
13
- import { ref ,unref } from 'vue'
13
+ import { ref, unref } from 'vue'
14
14
  import BsgoalBaseTreeTable from './index.vue'
15
15
  import ComponentTypeEnums from '../../enums/componentTypeEnums.js'
16
16
 
17
-
18
17
  defineOptions({
19
18
  name: 'BsgoalBaseTreeTableDemo'
20
19
  })
@@ -24,6 +23,7 @@ const props = defineProps({})
24
23
  // ---> S 树 <---
25
24
 
26
25
  const triggerTreeClick = (value, node, treeNode, event) => {
26
+ console.log('triggerTreeClick =========================')
27
27
  console.log('value', value)
28
28
  console.log('node', node)
29
29
  console.log('treeNode', treeNode)
@@ -74,7 +74,6 @@ const treeInitNode = (node) => {
74
74
 
75
75
  // ---> S 列表 <---
76
76
 
77
-
78
77
  const configOptions = ref([
79
78
  {
80
79
  label: 'prop1',
@@ -748,7 +747,6 @@ const tableData = ref([
748
747
  }
749
748
  ])
750
749
 
751
-
752
750
  const tableDataVal = unref(tableData)
753
751
 
754
752
  const fetch = (params) => {
@@ -767,22 +765,50 @@ const fetch = (params) => {
767
765
  })
768
766
  }
769
767
 
768
+ const triggerTreeAddClick = (params = '') => {
769
+ console.log('triggerTreeAddClick', params)
770
+ }
771
+
772
+ const treeData = ref([
773
+ {
774
+ label: 'label2-1',
775
+ isLeaf: true,
776
+ hasIcon: true
777
+ },
778
+ {
779
+ label: 'label2-2',
780
+ children: [
781
+ {
782
+ label: 'label2-2-1'
783
+ }
784
+ ]
785
+ },
786
+ {
787
+ label: 'label2-3'
788
+ }
789
+ ])
790
+ const BSGOAL_BASE_TREE_TABLE_REF = ref(null)
791
+ const test = () => {
792
+ BSGOAL_BASE_TREE_TABLE_REF.value.refreshList({ prop: 111 })
793
+ }
770
794
 
771
795
  // ---> E 列表 <---
772
796
  </script>
773
797
  <template>
774
798
  <div class="bsgoal-base-tree-table-demo">
775
799
  <div class="base_tree_table_demo">
800
+ <!-- <div @click="test">点击</div> -->
776
801
  <BsgoalBaseTreeTable
802
+ ref="BSGOAL_BASE_TREE_TABLE_REF"
777
803
  selection
778
804
  operation
805
+ :tree-data="treeData"
779
806
  :page-size="40"
780
- :lazy-load="treeLazyLoad"
781
- :init-node="treeInitNode"
782
807
  :fetch="fetch"
783
808
  :config-options="configOptions"
784
809
  :expression="77"
785
- @on-click="triggerTreeClick"
810
+ @on-click-tree="triggerTreeClick"
811
+ @on-add-tree="triggerTreeAddClick"
786
812
  ></BsgoalBaseTreeTable>
787
813
  </div>
788
814
  </div>
@@ -2,7 +2,7 @@
2
2
  * @Author: canlong.shen
3
3
  * @Date: 2023-06-20 09:20:44
4
4
  * @LastEditors: canlong.shen
5
- * @LastEditTime: 2023-06-21 10:21:31
5
+ * @LastEditTime: 2023-06-25 15:20:18
6
6
  * @FilePath: \common\src\components\bsgoal-base-tree-table\index.vue
7
7
  * @Description: 树结构 + 列表
8
8
  *
@@ -29,7 +29,7 @@ const props = defineProps({
29
29
  /**
30
30
  * 数据
31
31
  */
32
- data: {
32
+ treeData: {
33
33
  type: [Object, Array],
34
34
  default: () => []
35
35
  },
@@ -157,7 +157,7 @@ const props = defineProps({
157
157
  }
158
158
  })
159
159
 
160
-
160
+ const emits = defineEmits(['on-click-tree', 'on-switch-tree', 'on-add-tree'])
161
161
 
162
162
  // ---> S 注入插槽 <---
163
163
  const slots = useSlots()
@@ -166,13 +166,51 @@ const slotNames = ref(Object.keys(slots))
166
166
 
167
167
  // ---> S 树 <---
168
168
  const switchStatus = ref(true)
169
- const switchTree = (status = '') => {
169
+ const triggerTreeSwitch = (status = '') => {
170
170
  switchStatus.value = status
171
171
  }
172
172
  provide('TREE_SWITCH_STATUS', switchStatus)
173
+ /**
174
+ * @Author: canlong.shen
175
+ * @description: 触发树 添加按钮 事件
176
+ * @param {*} node
177
+ * @param {*} data
178
+ * @default:
179
+ * @return {*}
180
+ */
181
+ const triggerTreeAdd = ({ node, data } = {}) => {
182
+ emits('on-add-tree', { node, data })
183
+ }
184
+ /**
185
+ * @Author: canlong.shen
186
+ * @description: 触发树 单击项事件
187
+ * @param {*} value
188
+ * @param {*} node
189
+ * @param {*} treeNode
190
+ * @param {*} event
191
+ * @default:
192
+ * @return {*}
193
+ */
194
+ const triggerTreeClick = (value, node, treeNode, event) => {
195
+ emits('on-click-tree', value, node, treeNode, event)
196
+ }
173
197
 
174
198
  // ---> E 树 <---
175
199
 
200
+ // ---> S 表 <---
201
+ const BSGOAL_BASE_SEARCH_TABLE_REF = ref(null)
202
+ const refreshList = (params = {}) => {
203
+ console.log('params',params);
204
+ BSGOAL_BASE_SEARCH_TABLE_REF.value.refreshList(params)
205
+ }
206
+
207
+ // 暴露的属性
208
+ defineExpose({
209
+ refreshList
210
+ })
211
+
212
+ // ---> E 表 <---
213
+
176
214
  const tableStyler = computed(() => {
177
215
  const styler = {}
178
216
  const switchStatusValue = switchStatus.value
@@ -193,13 +231,15 @@ const tableStyler = computed(() => {
193
231
  <BsgoalBaseTree
194
232
  v-bind="$props"
195
233
  class="base_tree_table--tree"
196
- @on-switch="switchTree"
234
+ @on-switch="triggerTreeSwitch"
235
+ @on-add="triggerTreeAdd"
236
+ @on-click="triggerTreeClick"
197
237
  ></BsgoalBaseTree>
198
238
  <!-- E 树 -->
199
239
  </div>
200
240
  <div class="base_tree_table--table" :style="tableStyler">
201
241
  <!-- S 列表 -->
202
- <BsgoalBaseSearchTable v-bind="$props">
242
+ <BsgoalBaseSearchTable ref="BSGOAL_BASE_SEARCH_TABLE_REF" v-bind="$props">
203
243
  <template v-for="slotName of slotNames" v-slot:[slotName]="{ row = {} }">
204
244
  <slot :name="slotName" :row="row"></slot>
205
245
  </template>
@@ -0,0 +1,13 @@
1
+ <svg width="70" height="70" viewBox="0 0 70 70" fill="none" xmlns="http://www.w3.org/2000/svg">
2
+ <g id=".upload/&#229;&#141;&#160;&#228;&#189;&#141;&#229;&#155;&#190;" clip-path="url(#clip0_15278_44270)">
3
+ <rect width="70" height="70" fill="#F0F2F5"/>
4
+ <g id="&#229;&#155;&#190;&#231;&#137;&#135;&#229;&#141;&#160;&#228;&#189;&#141;&#229;&#155;&#190;">
5
+ <path id="Vector" d="M33.54 35.432L41 23L57 53H15L29 27L33.54 35.432V35.432ZM35.78 39.476L40.974 49H50.334L40.794 31.116L35.78 39.476V39.476ZM21.696 49H36.304L29 35.438L21.696 49ZM22 27C20.6739 27 19.4021 26.4732 18.4645 25.5355C17.5268 24.5979 17 23.3261 17 22C17 20.6739 17.5268 19.4021 18.4645 18.4645C19.4021 17.5268 20.6739 17 22 17C23.3261 17 24.5979 17.5268 25.5355 18.4645C26.4732 19.4021 27 20.6739 27 22C27 23.3261 26.4732 24.5979 25.5355 25.5355C24.5979 26.4732 23.3261 27 22 27Z" fill="#DDDFE5"/>
6
+ </g>
7
+ </g>
8
+ <defs>
9
+ <clipPath id="clip0_15278_44270">
10
+ <rect width="70" height="70" fill="white"/>
11
+ </clipPath>
12
+ </defs>
13
+ </svg>
@@ -0,0 +1,35 @@
1
+ <!--
2
+ * @Author: canlong.shen
3
+ * @Date: 2023-06-21 16:08:07
4
+ * @LastEditors: canlong.shen
5
+ * @LastEditTime: 2023-06-25 09:59:14
6
+ * @FilePath: \common\src\components\bsgoal-base-viewer\demo.vue
7
+ * @Description: 图片预览 演示
8
+ *
9
+ -->
10
+
11
+ <script setup>
12
+ /* setup模板
13
+ ---------------------------------------------------------------- */
14
+ import { ref } from 'vue'
15
+ import BsgoalBaseViewer from './index.vue'
16
+ defineOptions({
17
+ name: 'BsgoalBaseViewerDemo'
18
+ })
19
+
20
+ const props = defineProps({})
21
+ const src = ref('https://img.phb123.com/uploads/allimg/200615/60-2006151H317-52.jpg')
22
+ </script>
23
+ <template>
24
+ <div class="bsgoal-base-viewer-demo">
25
+ <BsgoalBaseViewer :src="src" />
26
+ </div>
27
+ </template>
28
+ <style lang="scss" scoped>
29
+ /* 自定义样式
30
+ ---------------------------------------------------------------- */
31
+ </style>
32
+ <style lang="scss">
33
+ /* 覆盖样式
34
+ ---------------------------------------------------------------- */
35
+ </style>
@@ -0,0 +1,66 @@
1
+ <!--
2
+ * @Author: canlong.shen
3
+ * @Date: 2023-06-21 16:08:00
4
+ * @LastEditors: canlong.shen
5
+ * @LastEditTime: 2023-06-25 10:00:41
6
+ * @FilePath: \common\src\components\bsgoal-base-viewer\index.vue
7
+ * @Description: 图片 预览
8
+ *
9
+ -->
10
+ <script setup>
11
+ /* setup模板
12
+ ---------------------------------------------------------------- */
13
+ import { ref, computed } from 'vue'
14
+ import { preview, vPreview, Vue3ImagePreview } from 'vue3-image-preview'
15
+ import uploadDefaultIcon from './assets/upload_default.svg'
16
+ defineOptions({
17
+ name: 'BsgoalBaseViewer'
18
+ })
19
+
20
+ const props = defineProps({
21
+ /**
22
+ * 宽度
23
+ */
24
+ width: {
25
+ type: [String, Number],
26
+ default: '48'
27
+ },
28
+ /**
29
+ * 宽度
30
+ */
31
+ height: {
32
+ type: [String, Number],
33
+ default: '48'
34
+ },
35
+ /**
36
+ * 预览图片路径
37
+ */
38
+ src: {
39
+ type: [String],
40
+ default: ''
41
+ }
42
+ })
43
+
44
+ const srcGet = computed(() => {
45
+ const { src = '' } = props
46
+ if (!src) {
47
+ return uploadDefaultIcon
48
+ }
49
+ return src
50
+ })
51
+ </script>
52
+ <template>
53
+ <div class="bsgoal-base-viewer">
54
+ <div class="base_viewer">
55
+ <img v-preview :src="srcGet" :style="{ width: `${width}px`, height: `${height}px` }" />
56
+ </div>
57
+ </div>
58
+ </template>
59
+ <style lang="scss">
60
+ .bsgoal-base-viewer {
61
+ display: inline-block;
62
+ .base_viewer {
63
+ margin: 4px 8px;
64
+ }
65
+ }
66
+ </style>
@@ -2,7 +2,7 @@
2
2
  * @Author: canlong.shen
3
3
  * @Date: 2023-04-10 10:41:52
4
4
  * @LastEditors: canlong.shen
5
- * @LastEditTime: 2023-06-20 10:07:27
5
+ * @LastEditTime: 2023-06-21 16:56:42
6
6
  * @FilePath: \common\src\router\index.js
7
7
  * @Description: 路由配置
8
8
  *
@@ -18,6 +18,11 @@ const router = createRouter({
18
18
  name: 'home',
19
19
  component: LayoutHome,
20
20
  children: [
21
+ {
22
+ path: '/bsgoal-base-viewer-demo',
23
+ name: '图片预览',
24
+ component: import('@/components/bsgoal-base-viewer/demo.vue')
25
+ },
21
26
  {
22
27
  path: '/bsgoal-baes-popover-demo',
23
28
  name: '弹出框',