ylwl-cpscoms 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.
Files changed (80) hide show
  1. package/README.md +15 -0
  2. package/es/SlAlert/index.vue.js +58 -0
  3. package/es/SlAlert/index.vue2.js +37 -0
  4. package/es/SlAlert/index.vue3.js +6 -0
  5. package/es/SlDescriptions/index.vue.js +55 -0
  6. package/es/SlDescriptions/index.vue2.js +57 -0
  7. package/es/SlDescriptions/index.vue3.js +6 -0
  8. package/es/SlDescriptions/renderOptions.vue.js +25 -0
  9. package/es/SlDescriptions/renderOptions.vue2.js +31 -0
  10. package/es/SlDialog/dialogPlus.js +159 -0
  11. package/es/SlDialog/index.js +202 -0
  12. package/es/SlDrawer/index.js +54 -0
  13. package/es/SlForm/index.vue.js +26 -0
  14. package/es/SlForm/index.vue2.js +433 -0
  15. package/es/SlForm/index.vue3.js +6 -0
  16. package/es/SlForm/mixinRender.js +239 -0
  17. package/es/SlForm/otherItem/titleItem.vue.js +39 -0
  18. package/es/SlForm/otherItem/titleItem.vue2.js +20 -0
  19. package/es/SlForm/otherItem/titleItem.vue3.js +6 -0
  20. package/es/SlGuide/index.vue.js +38 -0
  21. package/es/SlGuide/index.vue2.js +133 -0
  22. package/es/SlGuide/index.vue3.js +6 -0
  23. package/es/SlGuide/index.vue4.js +6 -0
  24. package/es/SlMessageBox/index.js +46 -0
  25. package/es/SlPage/index.vue.js +147 -0
  26. package/es/SlPage/index.vue2.js +312 -0
  27. package/es/SlPage/index.vue3.js +6 -0
  28. package/es/SlTable/components/colSetting.vue.js +94 -0
  29. package/es/SlTable/components/colSetting.vue2.js +66 -0
  30. package/es/SlTable/components/colSetting.vue3.js +6 -0
  31. package/es/SlTable/index.vue.js +171 -0
  32. package/es/SlTable/index.vue2.js +390 -0
  33. package/es/SlTable/index.vue3.js +6 -0
  34. package/es/SlTitle/index.vue.js +41 -0
  35. package/es/SlTitle/index.vue2.js +26 -0
  36. package/es/SlTitle/index.vue3.js +6 -0
  37. package/es/_virtual/_rollupPluginBabelHelpers.js +247 -0
  38. package/es/index.js +41 -0
  39. package/es/node_modules/shepherd.js/dist/css/shepherd.css.js +7 -0
  40. package/es/node_modules/style-inject/dist/style-inject.es.js +28 -0
  41. package/es/node_modules/vue-runtime-helpers/dist/normalize-component.js +76 -0
  42. package/es/utils/index.js +51 -0
  43. package/package.json +106 -0
  44. package/src/SlAlert/SlAlert.stories.js +108 -0
  45. package/src/SlAlert/index.vue +54 -0
  46. package/src/SlAlert/remark.md +16 -0
  47. package/src/SlDescriptions/SlDescriptions.stories.js +119 -0
  48. package/src/SlDescriptions/index.vue +60 -0
  49. package/src/SlDescriptions/renderOptions.vue +27 -0
  50. package/src/SlDialog/README-PLUS.md +74 -0
  51. package/src/SlDialog/README.md +114 -0
  52. package/src/SlDialog/dialogPlus.js +160 -0
  53. package/src/SlDialog/index.js +170 -0
  54. package/src/SlDrawer/SlDrawer.stories.js +154 -0
  55. package/src/SlDrawer/index.js +62 -0
  56. package/src/SlForm/SlForm.stories.js +120 -0
  57. package/src/SlForm/index.css +141 -0
  58. package/src/SlForm/index.vue +365 -0
  59. package/src/SlForm/mixinRender.js +228 -0
  60. package/src/SlForm/otherItem/titleItem.vue +31 -0
  61. package/src/SlForm/remark.md +607 -0
  62. package/src/SlGuide/SlGuide.stories.js +100 -0
  63. package/src/SlGuide/index.vue +166 -0
  64. package/src/SlGuide/remark.md +90 -0
  65. package/src/SlMessageBox/index.js +35 -0
  66. package/src/SlPage/README.md +515 -0
  67. package/src/SlPage/SlPage.stories.js +125 -0
  68. package/src/SlPage/index.css +38 -0
  69. package/src/SlPage/index.vue +266 -0
  70. package/src/SlPage/remark.md +283 -0
  71. package/src/SlTable/SlTable.stories.js +118 -0
  72. package/src/SlTable/components/colSetting.vue +86 -0
  73. package/src/SlTable/index.vue +541 -0
  74. package/src/SlTitle/SlTitle.stories.js +98 -0
  75. package/src/SlTitle/index.vue +49 -0
  76. package/src/global.css +5 -0
  77. package/src/index.js +47 -0
  78. package/src/store/index.js +20 -0
  79. package/src/utils/index.js +47 -0
  80. package/src/utils/tableConfig.js +33 -0
@@ -0,0 +1,266 @@
1
+ <template>
2
+ <main :style="{ padding: notShowPadding ? '' : '20px' }" class="content-box">
3
+ <div class="sl-form">
4
+ <transition-group name="fade" tag="span" >
5
+ <slForm key="slForm" ref="slForm" v-model="form" :data="filterForm" :showlabel="false" :form-props="{ inline: true, size: 'small', labelStyle: { textAlign: 'left' }, labelWidth: 'auto' }" />
6
+ </transition-group>
7
+ <div class="search-btn">
8
+ <el-button type="primary" size="small" icon="el-icon-search" @click="searchTableData">搜索</el-button>
9
+ <el-button size="small" icon="el-icon-search" @click="resetTableData">重置</el-button>
10
+ <el-button v-show="options.length > showFormItem " size="small" type="text" @click="isShowMoreFilter">{{ isFold ? '折叠' : '展开' }}<i :class="isFold ? 'el-icon-arrow-up' : 'el-icon-arrow-down'" style="margin-left:3px"></i></el-button>
11
+ </div>
12
+ </div>
13
+ <div class="sl-table-header">
14
+ <div>
15
+ <slot :tablefilterFormData="$refs.slTable ? $refs.slTable.processedParams : {}" name="tableLeftButtons"></slot>
16
+ </div>
17
+ <div>
18
+ <slot :tablefilterFormData="$refs.slTable ? $refs.slTable.processedParams : {}" name="tableRightButtons" ></slot>
19
+ <el-button v-if="isShowColSetting" size="small" icon="el-icon-setting" @click="editCol">列设置</el-button>
20
+ </div>
21
+ </div>
22
+ <slTable ref="slTable" :table-api="tableApi" :columns="tableColumns" :project-from="projectFrom" :params="form" :filter-form="filterForm" :other-config="otherConfig" :default-seach-params="defaultSeachParams" v-bind="$attrs" v-on="$listeners" @setStorageCustomCol="setStorageCustomCol">
23
+ <template v-for="slotName in Object.keys($scopedSlots)" slot-scope="scope" :slot="slotName" >
24
+ <slot :name="slotName" v-bind="{ row: scope.row }"></slot>
25
+ </template>
26
+ </slTable>
27
+ </main>
28
+ </template>
29
+ <script>
30
+ // import { mapGetters } from 'vuex'
31
+ import slForm from '../SlForm/index.vue'
32
+ import slTable from '../SlTable/index.vue'
33
+ import { createCommandDrawer } from '@/components/global/SlDrawer'
34
+ import colSetting from '@/components/global/SlTable/components/colSetting.vue'
35
+ import { generateUniqueId, hasKey } from '@/components/global/utils'
36
+ import store from '@/store'
37
+ export default {
38
+ components: {
39
+ slForm,
40
+ slTable
41
+ },
42
+ props: {
43
+ tableApi: { type: Function, default: () => ({}) },
44
+ autoRequest: { type: Boolean, default: false },
45
+ tableColumns: { type: Array, default: () => [] },
46
+ filterForm: { type: Array, default: () => [] },
47
+ showFormItem: { type: Number, default: 3 },
48
+ projectFrom: { type: String, default: 'oldCpsb' },
49
+ initSeachParams: { type: Object, default: () => ({}) },
50
+ defaultSeachParams: { type: Object, default: () => ({}) },
51
+ isShowColSetting: { type: Boolean, default: true },
52
+ notShowPadding: { type: Boolean, default: false }, // 是否要padding效果
53
+ otherConfig: { type: Object, default: () => ({
54
+ rowKey: 'id',
55
+ responderCof: {},
56
+ requestBodyCof: {}
57
+ })
58
+ }
59
+ },
60
+ data() {
61
+ return {
62
+ options: this.filterForm,
63
+ form: {},
64
+ isFold: false,
65
+ headKey: '',
66
+ uniqueId: ''
67
+ }
68
+ },
69
+ computed: {
70
+ // ...mapGetters([
71
+ // 'currentColConfig'
72
+ // ]),
73
+ currentColConfig() {
74
+ // console.log(store.getters, "store.gettersxxxxxxx")
75
+ return store.state.tableConfig.colConfig[this.uniqueId] || {}
76
+ },
77
+ allColConfig() {
78
+ return store.state.tableConfig.colConfig
79
+ },
80
+ selectedList() {
81
+ return this.$refs.slTable ? this.$refs.slTable.selectedList : []
82
+ },
83
+ selectedListIds() {
84
+ return this.$refs.slTable ? this.$refs.slTable.selectedListIds : []
85
+ }
86
+
87
+ },
88
+ created() {
89
+ this.uniqueId = generateUniqueId(this.tableApi.toString())
90
+ // console.log(this.uniqueId, "this.uniqueIdthis.uniqueIdthis.uniqueIdthis.uniqueId", this.tableApi.toString())
91
+ store.dispatch('getStorageCustomCol', this.uniqueId)
92
+ this.options.forEach((option, index) => {
93
+ if (index > this.showFormItem - 1) {
94
+ option.show = false
95
+ }
96
+ })
97
+ this.tableColumns.forEach(item => {
98
+ if (!hasKey(item, 'isShow')) {
99
+ this.$set(item, 'isShow', true)
100
+ }
101
+ if (this.currentColConfig.hide && this.currentColConfig.hide.includes(item.prop)) {
102
+ this.$set(item, 'isShow', false)
103
+ }
104
+ })
105
+ // 表格排序
106
+ this.sortTalbeColumns()
107
+
108
+ if (this.initSeachParams && Object.keys(this.initSeachParams).length > 0) {
109
+ for (const key in this.initSeachParams) {
110
+ this.form[key] = this.initSeachParams[key]
111
+ }
112
+ }
113
+ },
114
+ async mounted() {
115
+ this.autoRequest && this.$refs.slTable.getTableData()
116
+ this.$refs.slTable.resetColumns(this.tableColumns.filter(item => item.isShow && this.isShowTableColumn(item)))
117
+ },
118
+ methods: {
119
+ hasKey,
120
+ generateUniqueId,
121
+ // 永久删除的
122
+ isShowTableColumn(item) {
123
+ if (hasKey(item, 'isAlwaysShow') && typeof item.isAlwaysShow === 'function') {
124
+ return item.isAlwaysShow({
125
+ item: item
126
+ })
127
+ } else if (hasKey(item, 'isAlwaysShow') && typeof item.isAlwaysShow === 'string') {
128
+ return item.isAlwaysShow
129
+ } else {
130
+ return true
131
+ }
132
+ },
133
+ sortTalbeColumns() {
134
+ // console.log(this.currentColConfig.sort && this.currentColConfig.sort.length > 0, '是否');
135
+ // console.log(store, 'store.getters', this.allColConfig);
136
+ if (this.currentColConfig.sort && this.currentColConfig.sort.length > 0) {
137
+ this.tableColumns.sort((a, b) => {
138
+ return this.currentColConfig.sort.indexOf(a.prop) - this.currentColConfig.sort.indexOf(b.prop)
139
+ })
140
+ }
141
+ },
142
+ searchTableData() {
143
+ console.log(this.form, this.$refs.slForm.$refs.form, this.$refs.slTable.processedParams)
144
+ this.$refs.slForm.$refs.form.validate((valid) => {
145
+ if (valid) {
146
+ this.$refs.slTable.handleCurrentChange(1)
147
+ } else {
148
+ console.log('error submit!!')
149
+ return false
150
+ }
151
+ })
152
+ },
153
+ resetTableData() {
154
+ this.$refs.slForm.$refs.form.resetFields()
155
+ for (const key in this.form) {
156
+ if (this.form.hasOwnProperty(key)) {
157
+ this.form[key] = ''
158
+ }
159
+ }
160
+ // console.log(this.form, "xxxxx");
161
+ this.$refs.slForm.$refs.form.validate((valid) => {
162
+ if (valid) {
163
+ this.$refs.slTable.handleCurrentChange(1)
164
+ } else {
165
+ console.log('error submit!!')
166
+ return false
167
+ }
168
+ })
169
+ // this.$refs.slTable.handleCurrentChange(1)
170
+ },
171
+ getTableData() {
172
+ this.$refs.slForm.$refs.form.validate((valid) => {
173
+ if (valid) {
174
+ this.$refs.slTable.getCurrentPageList()
175
+ } else {
176
+ console.log('error getCurrentPageList submit!!')
177
+ return false
178
+ }
179
+ })
180
+ },
181
+ isShowMoreFilter() {
182
+ this.isFold = !this.isFold
183
+ if (this.isFold) {
184
+ this.options.forEach(option => {
185
+ this.$set(option, 'show', true)
186
+ })
187
+ } else {
188
+ this.options.forEach((option, index) => {
189
+ if (index > this.showFormItem - 1) {
190
+ this.$set(option, 'show', false)
191
+ }
192
+ })
193
+ }
194
+ // this.$forceUpdate()
195
+ },
196
+ saveKeeyAlive() {
197
+ const hideColArray = this.tableColumns.reduce((acc, item) => {
198
+ if (!item.isShow) {
199
+ acc.push(item.prop)
200
+ }
201
+ return acc
202
+ }, [])
203
+ store.dispatch('saveStorageCustomCol', {
204
+ key: this.uniqueId,
205
+ type: 'hide',
206
+ value: hideColArray
207
+ })
208
+ },
209
+ editCol() {
210
+ console.log(this.tableColumns.filter(item => item.prop !== 'operate' || item.type !== 'selection' || item.isShow), 'this.tableColumns', this.tableColumns)
211
+ // console.log(this.tableColumns, "在这里点开");
212
+ this.sortTalbeColumns()
213
+ // console.log(this.tableColumns, "在这里点开2");
214
+ createCommandDrawer({
215
+ title: '列设置(可拖拽排序)',
216
+ size: '20%',
217
+ direction: 'rtl',
218
+ contentComponent: colSetting,
219
+ closeDrawer: () => {
220
+ this.saveKeeyAlive()
221
+ this.$refs.slTable.headKey = new Date().getTime() + ''
222
+ // this.$refs.slTable.resetColumns(this.tableColumns.filter(item => item.isShow))
223
+ },
224
+ contentProps: {
225
+ columns: this.tableColumns.filter(item => item.prop !== 'operate' && item.type !== 'selection' && this.isShowTableColumn(item))
226
+ }, // 如果需要传递 props 给内容组件,可以在这里定义
227
+ contentListeners: {
228
+ 'update-columns': (columns) => {
229
+ // 处理列更新事件
230
+ // console.log('接收到更新的列数据:', columns, this.tableColumns)
231
+ // 如果有多选框和操作,要加上
232
+ const sortColumns = [...columns]
233
+ const findSelection = this.tableColumns.find(item => item.type === 'selection')
234
+ const findOperate = this.tableColumns.find(item => item.prop === 'operate')
235
+ if (findSelection) {
236
+ sortColumns.unshift(findSelection)
237
+ }
238
+ if (findOperate) {
239
+ sortColumns.push(findOperate)
240
+ }
241
+ // console.log(sortColumns, "sortColumns")
242
+ this.$refs.slTable.resetColumns(sortColumns.filter(item => item.isShow))
243
+ this.setStorageCustomCol(columns)
244
+ },
245
+ 'change-columns': () => {
246
+ this.$refs.slTable.resetColumns(this.tableColumns.filter(item => item.isShow))
247
+ this.$refs.slTable.headKey = new Date().getTime() + ''
248
+ }
249
+ }
250
+ })
251
+ },
252
+ setStorageCustomCol(columns) {
253
+ // console.log(this.uniqueId, 'a ?');
254
+ store.dispatch('saveStorageCustomCol', {
255
+ key: this.uniqueId,
256
+ type: 'sort',
257
+ value: columns.map(item => item.prop)
258
+ })
259
+ }
260
+ }
261
+ }
262
+ </script>
263
+ <style scoped >
264
+ @import url('./index.css');
265
+ </style>
266
+
@@ -0,0 +1,283 @@
1
+ <template>
2
+
3
+ <div class="slPage_main">
4
+ <SlMessage>
5
+ <template slot="operate">
6
+ <el-button>123</el-button>
7
+ </template>
8
+ <template slot="message">
9
+ <span>123</span><br>
10
+ <span>123</span><br>
11
+ </template>
12
+ </SlMessage>
13
+ <!-- project-from 艾瑞斯的数组入参不一致
14
+ initSeachParams 初始化参数
15
+ -->
16
+ <SlPage
17
+ :table-api="rechargeApi.getRechargeList"
18
+ :auto-request="true"
19
+ :table-columns="columns"
20
+ :filter-form="filterForm"
21
+ :initSeachParams="initSeachParams"
22
+ :show-form-item="5"
23
+ :project-from="'ares'"
24
+ :other-config= "{
25
+ rowKey: 'buserId',
26
+ responderCof: {
27
+ 'total': ['data', 'page', 'total'],
28
+ 'list': ['data', 'page', 'list'],
29
+ 'statusCode': 'flag',
30
+ },
31
+ requestBodyCof: {
32
+ currentPage: 'pageNo',
33
+ },
34
+ responderCof: {
35
+ 'total': ['data', 'count'],
36
+ },
37
+ donShowOverflowTooltip: true,
38
+ }"
39
+ >
40
+ <template slot="tableLeftButtons" slot-scope="{ tablefilterFormData }">
41
+ <el-button size="small" type="primary">新增</el-button>
42
+ <el-button size="small" type="success">导出</el-button>
43
+ </template>
44
+ <template slot="tableRightButtons" slot-scope="{ tablefilterFormData }">
45
+ <el-button size="small" type="primary">新增</el-button>
46
+ <el-button size="small" type="success">导出</el-button>
47
+ </template>
48
+ </SlPage>
49
+ <!-- <SlTable /> -->
50
+ </div>
51
+ </template>
52
+
53
+ <script>
54
+ import SlPage from '@/components/global/SlPage'
55
+ import SlTable from '@/components/global/SlTable'
56
+ import SlForm from '@/components/global/SlForm'
57
+ import * as rechargeApi from '@/api/propertyManagement/rechargeOrder'
58
+ import SlMessage from '@/components/global/SlAlert'
59
+ import { showConfirmMessageBox } from '@/components/global/SlMessageBox'
60
+ import { createCommandDialog } from '@/components/global/SlDialog'
61
+ import aa from './aa.vue'
62
+ export default {
63
+ components: {
64
+ SlPage,
65
+ SlTable,
66
+ SlMessage,
67
+ SlForm
68
+ },
69
+ data() {
70
+ const tableData = [
71
+ { id: 10001, name: 'Test1', role: 'Develop', flag1: false, flag2: false },
72
+ { id: 10002, name: 'Test2', role: 'Test', flag1: true, flag2: true },
73
+ { id: 10003, name: 'Test3', role: 'PM', flag1: false, flag2: false }
74
+ ]
75
+ const columns = [
76
+ { prop: 'buserId', label: '日期', width: '180', sortable: true, isShow: false },
77
+ { prop: 'applyTime', label: '姓名', width: '180', isShow: false },
78
+ { prop: 'coinName', label: '姓名zzzzz', width: '180', isShow: false, tip: {
79
+ key: 'cuserAccount',
80
+ isShow: (row) => row.id === 513910
81
+
82
+ }},
83
+ { prop: 'depositOrderType', label: '姓名', width: '180', isShow: false,
84
+
85
+ // tip: {
86
+ // // key: 'cuserAccount'
87
+ // }
88
+ },
89
+ { prop: 'completeTime', label: '姓名', width: '180', isShow: false },
90
+ { prop: 'coinType', label: '姓名', width: '180', isShow: false },
91
+ { prop: 'id', label: '姓名123', width: '180', isShow: false },
92
+ { prop: 'paymentType', label: '姓名423', width: '180', isShow: false },
93
+ { prop: 'paymentVoucher', label: '姓名77', width: '180', isShow: false },
94
+ { prop: 'rechargeRatio', label: '姓名', width: '180', isShow: false },
95
+ { prop: 'rechargeRealAmount', label: '姓名', width: '180', isShow: false },
96
+ { prop: 'rechargeStatusName', label: '姓名', width: '180', isShow: false },
97
+ { prop: 'rechargeStatus', label: '姓名', width: '180', isShow: false },
98
+ { prop: 'rechargeType', label: '姓名', width: '180', isShow: false },
99
+ { prop: 'reviewRemark', label: '姓名', width: '180', isShow: false },
100
+
101
+ { prop: 'rechargeNum', label: '地址', isShow: false },
102
+ { prop: 'operate', label: '操作', fixed: 'right', list: [
103
+ {
104
+ label: '编辑',
105
+ type: 'primary',
106
+ size: 'mini',
107
+ isShow: (row, column, $index) => {
108
+ console.log(row, column, $index, this, "000000")
109
+ return row.id === 513910
110
+ },
111
+ click: (row, column, $index, $event) => {
112
+ console.log(row, column, $index, $event, this, "000000")
113
+ this.$message.success('编辑')
114
+ showConfirmMessageBox({
115
+ message: '是否删除爱吧爱吧',
116
+ api: async(aaaa) => {
117
+ console.log("---------", aaaa)
118
+ },
119
+ params: {
120
+ bbbb: '人啊人啊'
121
+ }
122
+ })
123
+ }
124
+ },
125
+ {
126
+ label: '编辑2',
127
+ type: 'primary',
128
+ size: 'mini',
129
+ click: (row, column, $index, $event) => {
130
+ console.log(row, column, $index, $event, this, "000000")
131
+ this.$message.success('编辑')
132
+ createCommandDialog({
133
+ title: 'My Dialog',
134
+ width: '50%',
135
+ contentComponent: aa,
136
+ // footerSlot: 'footerSlot'
137
+ // contentProps: {
138
+ // data: this.filterForms
139
+ // },
140
+ // footerSlot: aa
141
+ })
142
+ }
143
+ }
144
+ ] }
145
+ ]
146
+ const filterForm = [
147
+
148
+ // {
149
+ // type: 'select',
150
+ // model: 'publisherId',
151
+ // label: '聚的话',
152
+ // labelKey: 'label',
153
+ // valueKey: 'value',
154
+ // props: { placeholder: '请输入聚合', disabled: false },
155
+ // rules: [{ required: true, message: '该项为必填', trigger: 'change' }],
156
+ // options: [ { label: 'Android', value: 1 },
157
+ // { label: 'iOS', value: 2 },
158
+ // { label: 'H5', value: 3 }],
159
+ // view: 'auto'
160
+ // },
161
+ // {
162
+ // label: '聚戏ID',
163
+ // type: 'input',
164
+ // model: 'aggGameId',
165
+ // privateAttrs: { placeholder: '请输入聚合游戏ID' },
166
+ // rules: [{ required: true, message: '该项为必填', trigger: 'change' }],
167
+ // view: 'auto'
168
+ // },
169
+ // {
170
+ // type: 'select',
171
+ // model: 'publisherId',
172
+ // label: '哈苏话',
173
+ // labelKey: 'label',
174
+ // valueKey: 'value',
175
+ // props: { placeholder: '请输入聚合', disabled: false },
176
+ // rules: [{ required: true, message: '该项为必填', trigger: 'change' }],
177
+ // options: [ { label: 'Android', value: 1 },
178
+ // { label: 'iOS', value: 2 },
179
+ // { label: 'H5', value: 3 }],
180
+ // view: 'auto'
181
+ // },
182
+ {
183
+ label: '游戏ID',
184
+ type: 'input',
185
+ rules: [{ required: true, message: '该项为必填', trigger: 'change' }],
186
+ model: 'aggGxxzxcameId',
187
+ privateAttrs: { placeholder: '请输入聚合游戏ID' },
188
+ // rules: [{ required: true, message: '该项为必填', trigger: 'change' }],
189
+ view: 'auto'
190
+ },
191
+ {
192
+ type: 'select',
193
+ model: 'publisherId',
194
+ label: '聚c23213',
195
+ labelKey: 'label',
196
+ valueKey: 'value',
197
+ props: { placeholder: '请输入聚合', disabled: false },
198
+ // rules: [{ required: true, message: '该项为必填', trigger: 'change' }],
199
+ options: [ { label: 'Android', value: 1 },
200
+ { label: 'iOS', value: 2 },
201
+ { label: 'H5', value: 3 }],
202
+ view: 'auto'
203
+ },
204
+ {
205
+ label: '游戏ID',
206
+ type: 'input',
207
+ model: 'aggzxczzxcameId',
208
+ privateAttrs: { placeholder: '请输入聚合游戏ID' },
209
+ // rules: [{ required: true, message: '该项为必填', trigger: 'change' }],
210
+ view: 'auto'
211
+ },
212
+ {
213
+ label: '时间',
214
+ type: 'datePicker',
215
+ model: 'aggGamezxcId',
216
+ privateProps: { type: 'daterange', startPlaceholder: '我是开始时间' },
217
+ attrs: { placeholder: '请输入聚合游戏ID', type: 'daterange' },
218
+ view: 'auto'
219
+ },
220
+ {
221
+ type: 'select',
222
+ model: 'publisasaherId',
223
+ label: '桑的话',
224
+ labelKey: 'label',
225
+ valueKey: 'value',
226
+ props: { placeholder: '请输入聚合', disabled: false },
227
+ options: [ { label: 'Android', value: 1 },
228
+ { label: 'iOS', value: 2 },
229
+ { label: 'H5', value: 3 }],
230
+ view: 'auto'
231
+ },
232
+ {
233
+ label: '聚合游戏ID',
234
+ type: 'input',
235
+ model: 'aggGameId',
236
+ privateAttrs: { placeholder: '请输入聚合游戏ID' },
237
+ rules: [{ required: true, message: '该项为必填', trigger: 'change' }],
238
+ view: 'auto'
239
+ },
240
+ // {
241
+ // label: 'swich',
242
+ // type: 'switch', // 渲染为select
243
+ // model: 'problemxxFileInfo', // 给form对象绑定followUserId字段
244
+ // // rules: [{ required: true, message: '该项为必填', trigger: 'change' }], //规则
245
+ // view: 'auto',
246
+ // props: {
247
+ // stip: '最多20张,每个大小不超过100M,支持 .png .jpg .jpeg .mp4',
248
+ // limit: 20,
249
+ // perSize: 100,
250
+ // accept: '.png, .jpg, .jpeg, .mp4, .MP4',
251
+ // max: 2000
252
+ // // style: 'width:350px'
253
+ // },
254
+ // privateAttrs: {
255
+ // style: 'width:350px'
256
+ // },
257
+ // remark: '备注'
258
+ // // show: false
259
+ // }
260
+ // {
261
+ // label: '多选框',
262
+ // type: 'checkbox',
263
+ // model: 'gameApk',
264
+ // options: [
265
+ // { label: 'Android', value: 1 },
266
+ // { label: 'iOS', value: 2 },
267
+ // { label: 'H5', value: 3 }
268
+ // ],
269
+ // rules: [{ required: true, message: '该项为必填', trigger: 'change' }],
270
+ // view: 'auto',
271
+ // },
272
+
273
+ ]
274
+ return {
275
+ rechargeApi,
276
+ tableData,
277
+ filterForm,
278
+ columns
279
+ }
280
+ },
281
+
282
+ }
283
+ </script>
@@ -0,0 +1,118 @@
1
+ import SlTable from './index.vue'
2
+
3
+ export default {
4
+ title: 'Components/SlTable',
5
+ component: SlTable,
6
+ parameters: {
7
+ docs: {
8
+ description: {
9
+ component: '业务表格组件,基于 el-table 封装。支持远程分页、多选、排序、自定义列、操作列渲染、列拖拽排序等功能。通过 columns 配置驱动表格渲染。'
10
+ }
11
+ }
12
+ }
13
+ }
14
+
15
+ const codeBlock = (code) => `
16
+ <div style="margin-top:24px;border-top:1px solid #eee;padding-top:16px">
17
+ <p style="font-size:14px;font-weight:600;color:#666;margin-bottom:8px;">使用代码:</p>
18
+ <pre style="background:#f5f5f5;padding:16px;border-radius:4px;overflow-x:auto;font-size:13px;line-height:1.6;white-space:pre-wrap;word-break:break-all"><code>${escapeHtml(code.trim())}</code></pre>
19
+ </div>`
20
+
21
+ function escapeHtml(str) {
22
+ return str.replace(/&/g, '&amp;').replace(/</g, '&lt;').replace(/>/g, '&gt;')
23
+ }
24
+
25
+ // mock 数据
26
+ const mockData = [
27
+ { id: 1, name: '张三', age: 28, dept: '研发部', status: 1 },
28
+ { id: 2, name: '李四', age: 32, dept: '产品部', status: 0 },
29
+ { id: 3, name: '王五', age: 25, dept: '设计部', status: 1 },
30
+ { id: 4, name: '赵六', age: 30, dept: '研发部', status: 1 },
31
+ { id: 5, name: '孙七', age: 27, dept: '运营部', status: 0 }
32
+ ]
33
+
34
+ function mockApi(params) {
35
+ const { currentPage, pageSize } = params
36
+ const start = (currentPage - 1) * pageSize
37
+ const list = mockData.slice(start, start + pageSize)
38
+ return Promise.resolve({
39
+ code: 1,
40
+ data: { list, total: mockData.length }
41
+ })
42
+ }
43
+
44
+ // ---- 基础用法 ----
45
+ const defaultColumns = [
46
+ { type: 'selection' },
47
+ { prop: 'id', label: 'ID', width: '80' },
48
+ { prop: 'name', label: '姓名' },
49
+ { prop: 'age', label: '年龄', sortable: true },
50
+ { prop: 'dept', label: '部门' },
51
+ { prop: 'status', label: '状态', template: 'statusTpl' },
52
+ { prop: 'operate', label: '操作', width: '150', list: [
53
+ { label: '编辑', click: () => {} },
54
+ { label: '删除', type: 'danger', click: () => {} }
55
+ ]}
56
+ ]
57
+
58
+ const defaultCode = `<!-- 使用方式 -->
59
+ <sl-table ref="table" :table-api="fetchList" :columns="columns"
60
+ :auto-request="true" />
61
+
62
+ <!-- columns 配置 -->
63
+ columns: [
64
+ { type: 'selection' },
65
+ { prop: 'id', label: 'ID', width: '80' },
66
+ { prop: 'name', label: '姓名' },
67
+ { prop: 'operate', label: '操作', list: [...] }
68
+ ]`
69
+
70
+ export const Default = () => ({
71
+ components: { SlTable },
72
+ data() {
73
+ return {
74
+ tableApi: mockApi,
75
+ columns: defaultColumns
76
+ }
77
+ },
78
+ template: `
79
+ <div>
80
+ <sl-table ref="table" :table-api="tableApi" :columns="columns" :auto-request="true">
81
+ <template slot="statusTpl" slot-scope="scope">
82
+ <el-tag :type="scope.row.status === 1 ? 'success' : 'danger'" size="small">
83
+ {{ scope.row.status === 1 ? '启用' : '禁用' }}
84
+ </el-tag>
85
+ </template>
86
+ </sl-table>
87
+ ${codeBlock(defaultCode)}
88
+ </div>`
89
+ })
90
+
91
+ Default.storyName = '基础用法'
92
+
93
+ // ---- 无分页 ----
94
+ const noPageCode = `<!-- 无分页模式 -->
95
+ <sl-table :table-api="fetchList" :columns="columns"
96
+ :show-pagination="false" :auto-request="true" />`
97
+
98
+ export const NoPagination = () => ({
99
+ components: { SlTable },
100
+ data() {
101
+ return {
102
+ tableApi: mockApi,
103
+ columns: [
104
+ { prop: 'id', label: 'ID', width: '80' },
105
+ { prop: 'name', label: '姓名' },
106
+ { prop: 'age', label: '年龄' },
107
+ { prop: 'dept', label: '部门' }
108
+ ]
109
+ }
110
+ },
111
+ template: `
112
+ <div>
113
+ <sl-table :table-api="tableApi" :columns="columns" :show-pagination="false" :auto-request="true" />
114
+ ${codeBlock(noPageCode)}
115
+ </div>`
116
+ })
117
+
118
+ NoPagination.storyName = '无分页模式'