@bsgoal/common 0.1.0 → 0.1.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.
Files changed (39) hide show
  1. package/dist/index.mjs +208 -193
  2. package/dist/index.mjs.map +1 -1
  3. package/dist/index.umd.js +1 -1
  4. package/dist/index.umd.js.map +1 -1
  5. package/package.json +3 -2
  6. package/src/App.vue +9 -0
  7. package/src/combines/useComs.js +32 -0
  8. package/src/combines/useFetchs.js +48 -0
  9. package/src/components/bsgoal-base-dialog/demo.vue +50 -0
  10. package/src/components/bsgoal-base-dialog/index.vue +133 -0
  11. package/src/components/bsgoal-base-form/demo.vue +187 -0
  12. package/src/components/bsgoal-base-form/index.vue +499 -0
  13. package/src/components/bsgoal-base-frame/demo.vue +35 -0
  14. package/src/components/bsgoal-base-frame/index.vue +29 -0
  15. package/src/components/bsgoal-base-line/demo.vue +42 -0
  16. package/src/components/bsgoal-base-line/index.vue +54 -0
  17. package/src/components/bsgoal-base-search/demo.vue +197 -0
  18. package/src/components/bsgoal-base-search/index.vue +486 -0
  19. package/src/components/bsgoal-base-search-operation/index.vue +76 -0
  20. package/src/components/bsgoal-base-search-table/demo-table.vue +52 -0
  21. package/src/components/bsgoal-base-search-table/demo.vue +664 -0
  22. package/src/components/bsgoal-base-search-table/index.vue +159 -0
  23. package/src/components/bsgoal-base-table/demo.vue +270 -0
  24. package/src/components/bsgoal-base-table/index.vue +278 -0
  25. package/src/components/bsgoal-base-table-content/index.vue +42 -0
  26. package/src/components/bsgoal-base-table-pagination/index.vue +109 -0
  27. package/src/components/bsgoal-base-tree/demo.vue +113 -0
  28. package/src/components/bsgoal-base-tree/index.vue +213 -0
  29. package/src/components/bsgoal-base-tree-fold/index.vue +65 -0
  30. package/src/components/layout/layout-home.vue +60 -0
  31. package/src/components/layout/layout-left-menu.vue +48 -0
  32. package/src/components/layout/layout-right-container.vue +36 -0
  33. package/src/components/layout/layout-top-header.vue +40 -0
  34. package/src/directives/directiveBase.js +94 -0
  35. package/src/entry.js +35 -0
  36. package/src/enums/enumType.js +31 -0
  37. package/src/main.js +11 -0
  38. package/src/router/index.js +66 -0
  39. package/src/styles/index.css +14 -0
package/package.json CHANGED
@@ -1,9 +1,10 @@
1
1
  {
2
2
  "name": "@bsgoal/common",
3
- "version": "0.1.0",
3
+ "version": "0.1.1",
4
4
  "private": false,
5
5
  "files": [
6
- "dist"
6
+ "dist",
7
+ "src"
7
8
  ],
8
9
  "main": "dist/index.umd.js",
9
10
  "module": "dist/index.mjs",
package/src/App.vue ADDED
@@ -0,0 +1,9 @@
1
+ <script setup>
2
+
3
+
4
+ </script>
5
+ <template>
6
+ <RouterView />
7
+ </template>
8
+ <style scoped>
9
+ </style>
@@ -0,0 +1,32 @@
1
+ /*
2
+ * @Author: canlong.shen
3
+ * @Date: 2023-04-19 09:10:00
4
+ * @LastEditors: canlong.shen
5
+ * @LastEditTime: 2023-04-25 10:45:14
6
+ * @FilePath: \common\src\combines\useComs.js
7
+ * @Description: 组件相关的组合函数
8
+ *
9
+ */
10
+
11
+ import { unref, nextTick } from 'vue'
12
+
13
+ /**
14
+ * @Author: canlong.shen
15
+ * @description: 自动计算表格高度
16
+ * @param {*} el
17
+ * @param {*} expression
18
+ * @default:
19
+ * @return {*}
20
+ */
21
+ export const useAutoHeight = (el = null, { expression = 75 , arg ={}} = {}) => {
22
+ const elValue = unref(el)
23
+ if (elValue) {
24
+ const elTable = elValue.querySelector('.el-table')
25
+ if (elTable) {
26
+ nextTick(() => {
27
+ const { y = 0 } = elTable.getBoundingClientRect()
28
+ elTable.style.height = `calc(100vh - ${y + expression}px)`
29
+ })
30
+ }
31
+ }
32
+ }
@@ -0,0 +1,48 @@
1
+ /*
2
+ * @Author: canlong.shen
3
+ * @Date: 2023-04-18 16:46:18
4
+ * @LastEditors: canlong.shen
5
+ * @LastEditTime: 2023-04-19 17:45:09
6
+ * @FilePath: \common\src\combines\useFetchs.js
7
+ * @Description: 请求组合函数
8
+ *
9
+ */
10
+
11
+ import { ref } from 'vue'
12
+
13
+ /**
14
+ * @Author: canlong.shen
15
+ * @description: 请求的组合函数
16
+ * @param {*} request
17
+ * @default:
18
+ * @return {*}
19
+ */
20
+ export const useFetch = (request = Promise.resolve(), call = null, loading = ref(false) ,data = ref(null) ) => {
21
+ const message = ref('')
22
+ loading.value = true
23
+ request
24
+ .then((res = {}) => {
25
+ const { data: resData = {}, message: resMessage = '' } = res
26
+ data.value = resData
27
+ message.value = resMessage
28
+ if (call) {
29
+ call(true, resData)
30
+ }
31
+ loading.value = false
32
+ })
33
+ .catch((err = {}) => {
34
+ if (typeof err === 'object') {
35
+ const { message: errMessage = '' } = err
36
+ message.value = errMessage
37
+ } else {
38
+ message.value = err
39
+ }
40
+ call(false, err)
41
+ loading.value = false
42
+ })
43
+ .finally(() => {
44
+ loading.value = false
45
+ })
46
+
47
+ return { data, message, loading }
48
+ }
@@ -0,0 +1,50 @@
1
+ <!--
2
+ * @Author: canlong.shen
3
+ * @Date: 2023-04-23 16:35:24
4
+ * @LastEditors: canlong.shen
5
+ * @LastEditTime: 2023-04-24 14:36:55
6
+ * @FilePath: \common\src\components\bsgoal-base-dialog\demo.vue
7
+ * @Description: 弹窗公共组件 演示
8
+ *
9
+ -->
10
+
11
+ <script>
12
+ export default {
13
+ name: 'BsgoalBaseDialogDemo'
14
+ }
15
+ </script>
16
+ <script setup>
17
+ /* setup模板
18
+ ---------------------------------------------------------------- */
19
+ import { ref } from 'vue'
20
+ import BsgoalBaseDialog from './index.vue'
21
+
22
+
23
+ // props
24
+ const props = defineProps({})
25
+
26
+ const dialogVisible = ref(false)
27
+
28
+ const test = () => {
29
+ console.log('点击了');
30
+ dialogVisible.value = true
31
+
32
+ }
33
+
34
+ </script>
35
+ <template>
36
+ <div class="bsgoal-base-dialog-demo">
37
+ <div class="base_dialog_demo">
38
+ <BsgoalBaseDialog v-model="dialogVisible" />
39
+ <el-button type="primary" @click="test">打开弹窗22</el-button>
40
+ </div>
41
+ </div>
42
+ </template>
43
+ <style lang="scss" scoped>
44
+ /* 自定义样式
45
+ ---------------------------------------------------------------- */
46
+ </style>
47
+ <style lang="scss">
48
+ /* 覆盖样式
49
+ ---------------------------------------------------------------- */
50
+ </style>
@@ -0,0 +1,133 @@
1
+ <!--
2
+ * @Author: canlong.shen
3
+ * @Date: 2023-04-23 16:35:19
4
+ * @LastEditors: canlong.shen
5
+ * @LastEditTime: 2023-04-25 09:12:42
6
+ * @FilePath: \common\src\components\bsgoal-base-dialog\index.vue
7
+ * @Description: 弹窗公共组件
8
+ *
9
+ -->
10
+
11
+ <script>
12
+ export default {
13
+ name: 'BsgoalBaseDialog'
14
+ }
15
+ </script>
16
+ <script setup>
17
+ /* setup模板
18
+ ---------------------------------------------------------------- */
19
+ import { ref, watch } from 'vue'
20
+ // props
21
+ const props = defineProps({
22
+ /**
23
+ * 弹窗状态
24
+ */
25
+ modelValue: {
26
+ type: [Boolean],
27
+ default: false
28
+ },
29
+ /**
30
+ * 标题
31
+ */
32
+ title: {
33
+ type: [String],
34
+ default: '标题'
35
+ },
36
+ /**
37
+ * 取消的文本
38
+ */
39
+ cancelTxt: {
40
+ type: [String],
41
+ default: '取消'
42
+ },
43
+ /**
44
+ * 确定的文本
45
+ */
46
+ confirmTxt: {
47
+ type: [String],
48
+ default: '确定'
49
+ }
50
+ })
51
+
52
+ const emits = defineEmits(['update:modelValue', 'on-confirm'])
53
+ const dialogVisible = ref(props.modelValue.value)
54
+
55
+ /**
56
+ * @Author: canlong.shen
57
+ * @description: 取消弹窗
58
+ * @default:
59
+ * @return {*}
60
+ */
61
+ const cancel = () => {
62
+ dialogVisible.value = false
63
+ }
64
+ /**
65
+ * @Author: canlong.shen
66
+ * @description: 确定弹窗
67
+ * @default:
68
+ * @return {*}
69
+ */
70
+ const confirm = () => {
71
+ dialogVisible.value = false
72
+ emits('on-confirm')
73
+ }
74
+
75
+ watch(
76
+ () => props.modelValue,
77
+ (v) => {
78
+ dialogVisible.value = v
79
+ }
80
+ )
81
+
82
+ watch(dialogVisible, (v) => {
83
+ emits('update:modelValue', v)
84
+ })
85
+ </script>
86
+ <template>
87
+ <div class="bsgoal-base-dialog">
88
+ <div class="base_dialog">
89
+ <!-- S 组件实体 -->
90
+ <el-dialog v-model="dialogVisible" custom-class="bsgoal_base_dialog_main">
91
+ <template #header>
92
+ <div class="base_dialog_header">{{ title }}</div>
93
+ </template>
94
+ <div class="base_dialog_content">
95
+ <slot></slot>
96
+ </div>
97
+ <template #footer>
98
+ <span class="base_dialog_footer">
99
+ <el-button @click="cancel">{{ cancelTxt }}</el-button>
100
+ <el-button type="primary" @click="confirm"> {{ confirmTxt }} </el-button>
101
+ </span>
102
+ </template>
103
+ </el-dialog>
104
+ <!-- E 组件实体 -->
105
+ </div>
106
+ </div>
107
+ </template>
108
+ <style lang="scss">
109
+ /* 覆盖样式
110
+ ---------------------------------------------------------------- */
111
+ .bsgoal-base-dialog {
112
+ .base_dialog_header {
113
+ font-weight: 500;
114
+ color: #303133;
115
+ font-size: 16px;
116
+ }
117
+
118
+ .bsgoal_base_dialog_main {
119
+ .el-dialog__header {
120
+ padding: 16px 30px;
121
+ margin-right: 0px;
122
+ background-color: #f5f7fa;
123
+ .el-dialog__headerbtn {
124
+ top: 0px;
125
+ right: 8px;
126
+ }
127
+ }
128
+ .el-dialog__body {
129
+ padding: 0px 0px 30px 30px;
130
+ }
131
+ }
132
+ }
133
+ </style>
@@ -0,0 +1,187 @@
1
+ <!--
2
+ * @Author: canlong.shen
3
+ * @Date: 2023-04-10 15:00:00
4
+ * @LastEditors: canlong.shen
5
+ * @LastEditTime: 2023-04-20 17:47:40
6
+ * @FilePath: \common\src\components\bsgoal-base-form\demo.vue
7
+ * @Description: 表单公共组件演示组件
8
+ *
9
+ -->
10
+
11
+ <template>
12
+ <div class="bsgoal-base-form-demo">
13
+ <BsgoalBaseForm ref="BSGOAL_BASE_FORM_REF" :config-options="configOptions" :values="values" />
14
+ <el-button type="primary" @click="confirm">提交</el-button>
15
+ </div>
16
+ </template>
17
+ <script>
18
+ export default {
19
+ name: 'BsgoalBaseFormDemo'
20
+ }
21
+ </script>
22
+ <script setup>
23
+ /* setup模板
24
+ ---------------------------------------------------------------- */
25
+ import BsgoalBaseForm from './index.vue'
26
+ import { ref, computed, toRefs, watch, unref } from 'vue'
27
+ import EnumType from '../../enums/enumType.js'
28
+
29
+ const values = ref({
30
+ prop1:'6666'
31
+ })
32
+
33
+ const BSGOAL_BASE_FORM_REF = ref(null)
34
+
35
+ const confirm = () => {
36
+ BSGOAL_BASE_FORM_REF.value.validateForm( (res) => {
37
+
38
+ console.log('res',res);
39
+
40
+ } )
41
+
42
+ }
43
+
44
+ // 配置项
45
+ const configOptions = ref([
46
+ {
47
+ label: 'prop1',
48
+ // value: '111',
49
+ prop: 'prop1',
50
+ type: EnumType.INPUT,
51
+ width: '100px',
52
+ rules:true
53
+ },
54
+ {
55
+ label: 'prop2',
56
+ value: 'select2',
57
+ type: EnumType.SELECT,
58
+ prop: 'prop2',
59
+ range: [
60
+ {
61
+ label: 'select1',
62
+ value: 'select1'
63
+ },
64
+ {
65
+ label: 'select2',
66
+ value: 'select2'
67
+ },
68
+ {
69
+ label: 'select3',
70
+ value: 'select3'
71
+ },
72
+ {
73
+ label: 'select4',
74
+ value: 'select5'
75
+ }
76
+ ]
77
+ },
78
+ {
79
+ label: 'prop3',
80
+ // value: '111',
81
+ type: EnumType.SLIDER,
82
+ prop: 'prop3'
83
+ },
84
+ {
85
+ label: 'prop4',
86
+ // value: '111',
87
+ type: EnumType.SWITCH,
88
+ prop: 'prop4'
89
+ },
90
+ {
91
+ label: 'prop5',
92
+ // value: '111',
93
+ type: EnumType.RADIO,
94
+ prop: 'prop5',
95
+ range: [
96
+ {
97
+ label: 'radio1',
98
+ value: 'radio1'
99
+ },
100
+ {
101
+ label: 'radio2',
102
+ value: 'radio2'
103
+ }
104
+ ]
105
+ },
106
+ {
107
+ label: 'prop6',
108
+ value: [],
109
+ type: EnumType.CHECKBOX,
110
+ prop: 'prop6',
111
+ range: [
112
+ {
113
+ label: 'checkbox1',
114
+ value: 'checkbox1'
115
+ },
116
+ {
117
+ label: 'checkbox2',
118
+ value: 'checkbox2'
119
+ }
120
+ ]
121
+ },
122
+ {
123
+ label: 'prop7',
124
+ // value: '111',
125
+ type: EnumType.DATE,
126
+ prop: 'prop7',
127
+ format: 'YYYY-MM-DD'
128
+ },
129
+ {
130
+ label: 'prop9',
131
+ // value: '111',
132
+ type: EnumType.MONTH,
133
+ prop: 'prop9'
134
+ },
135
+ {
136
+ label: 'prop10',
137
+ // value: '111',
138
+ type: EnumType.YEAR,
139
+ prop: 'prop10'
140
+ },
141
+ {
142
+ label: 'prop11',
143
+ // value: '111',
144
+ type: EnumType.DATE_RANGE,
145
+ prop: 'prop11',
146
+ range: ['startDate', 'endDate']
147
+ },
148
+ {
149
+ label: 'prop12',
150
+ // value: '111',
151
+ type: EnumType.MONTH_RANGE,
152
+ prop: 'prop12'
153
+ },
154
+ {
155
+ label: 'prop13',
156
+ // value: '111',
157
+ type: EnumType.TIME,
158
+ prop: 'prop13'
159
+ },
160
+ {
161
+ label: 'prop14',
162
+ // value: '111',
163
+ type: EnumType.TIME_RANGE,
164
+ prop: 'prop14'
165
+ },
166
+ {
167
+ label: 'prop15',
168
+ // value: '111',
169
+ type: EnumType.DATE_TIME,
170
+ prop: 'prop15'
171
+ },
172
+ {
173
+ label: 'prop16',
174
+ // value: '111',
175
+ type: EnumType.DATE_TIME_RANGE,
176
+ prop: 'prop16'
177
+ }
178
+ ])
179
+ </script>
180
+ <style lang="scss" scoped>
181
+ /* 自定义样式
182
+ ---------------------------------------------------------------- */
183
+ </style>
184
+ <style lang="scss">
185
+ /* 覆盖样式
186
+ ---------------------------------------------------------------- */
187
+ </style>