ylwl-cpscoms 1.1.0 → 1.2.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/package.json +2 -3
- package/src/DtTable/DtTable/347/273/204/344/273/266/344/275/277/347/224/250/346/226/207/346/241/243.md +0 -819
- package/src/DtTable/index.vue +0 -779
- package/src/SlAlert/SlAlert.stories.js +0 -108
- package/src/SlAlert/index.vue +0 -55
- package/src/SlAlert/remark.md +0 -16
- package/src/SlDescriptions/SlDescriptions.stories.js +0 -119
- package/src/SlDescriptions/index.vue +0 -60
- package/src/SlDescriptions/renderOptions.vue +0 -27
- package/src/SlDialog/README-PLUS.md +0 -74
- package/src/SlDialog/README.md +0 -114
- package/src/SlDialog/dialogPlus.js +0 -160
- package/src/SlDialog/index.js +0 -170
- package/src/SlDrawer/SlDrawer.stories.js +0 -154
- package/src/SlDrawer/index.js +0 -62
- package/src/SlForm/SlForm.stories.js +0 -120
- package/src/SlForm/index.vue +0 -506
- package/src/SlForm/mixinRender.js +0 -228
- package/src/SlForm/otherItem/titleItem.vue +0 -31
- package/src/SlForm/remark.md +0 -607
- package/src/SlGuide/SlGuide.stories.js +0 -100
- package/src/SlGuide/index.vue +0 -166
- package/src/SlGuide/remark.md +0 -90
- package/src/SlMessageBox/index.js +0 -35
- package/src/SlPage/README.md +0 -515
- package/src/SlPage/SlPage.stories.js +0 -125
- package/src/SlPage/index.vue +0 -303
- package/src/SlPage/remark.md +0 -283
- package/src/SlTable/SlTable.stories.js +0 -118
- package/src/SlTable/components/colSetting.vue +0 -86
- package/src/SlTable/index.vue +0 -541
- package/src/SlTitle/SlTitle.stories.js +0 -98
- package/src/SlTitle/index.vue +0 -49
- package/src/global.css +0 -5
- package/src/index.js +0 -49
- package/src/store/index.js +0 -20
- package/src/utils/index.js +0 -47
- package/src/utils/tableConfig.js +0 -33
|
@@ -1,118 +0,0 @@
|
|
|
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, '&').replace(/</g, '<').replace(/>/g, '>')
|
|
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 = '无分页模式'
|
|
@@ -1,86 +0,0 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<div>
|
|
3
|
-
<el-table ref="dragTable" :data="columns" :border="true" row-key="prop" default-expand-all >
|
|
4
|
-
<el-table-column prop="drag" align="center" label="拖拽" width="60">
|
|
5
|
-
<template slot-scope="scope">
|
|
6
|
-
<i class="el-icon-rank" style="cursor: move;"></i>
|
|
7
|
-
</template>
|
|
8
|
-
</el-table-column>
|
|
9
|
-
<el-table-column prop="label" align="center" label="列名" />
|
|
10
|
-
<el-table-column prop="isShow" align="center" label="显示">
|
|
11
|
-
<template slot-scope="scope">
|
|
12
|
-
<el-switch v-model="scope.row.isShow" @change="changeTableColumn"></el-switch>
|
|
13
|
-
</template>
|
|
14
|
-
</el-table-column>
|
|
15
|
-
|
|
16
|
-
<template #empty>
|
|
17
|
-
<div class="table-empty">
|
|
18
|
-
<!-- <img src="../assets/images/notData.png" alt="notData" /> -->
|
|
19
|
-
<div>暂无可配置列</div>
|
|
20
|
-
</div>
|
|
21
|
-
</template>
|
|
22
|
-
</el-table>
|
|
23
|
-
</div>
|
|
24
|
-
</template>
|
|
25
|
-
<script>
|
|
26
|
-
import Sortable from 'sortablejs'
|
|
27
|
-
export default {
|
|
28
|
-
props: {
|
|
29
|
-
columns: { type: Array, default: () => [] }
|
|
30
|
-
},
|
|
31
|
-
data() {
|
|
32
|
-
return {
|
|
33
|
-
localColumns: []
|
|
34
|
-
}
|
|
35
|
-
},
|
|
36
|
-
watch: {
|
|
37
|
-
columns: {
|
|
38
|
-
handler(newVal) {
|
|
39
|
-
this.localColumns = [...newVal]
|
|
40
|
-
this.$nextTick(() => {
|
|
41
|
-
this.setSort()
|
|
42
|
-
})
|
|
43
|
-
},
|
|
44
|
-
deep: true,
|
|
45
|
-
immediate: true
|
|
46
|
-
|
|
47
|
-
}
|
|
48
|
-
},
|
|
49
|
-
mounted() {
|
|
50
|
-
this.$nextTick(() => {
|
|
51
|
-
this.setSort()
|
|
52
|
-
})
|
|
53
|
-
},
|
|
54
|
-
methods: {
|
|
55
|
-
setSort() {
|
|
56
|
-
const el = this.$refs.dragTable.$el.querySelectorAll('.el-table__body-wrapper > table > tbody')[0]
|
|
57
|
-
this.sortable = Sortable.create(el, {
|
|
58
|
-
ghostClass: 'sortable-ghost',
|
|
59
|
-
setData: function(dataTransfer) {
|
|
60
|
-
dataTransfer.setData('Text', '')
|
|
61
|
-
},
|
|
62
|
-
onEnd: evt => {
|
|
63
|
-
const { oldIndex, newIndex } = evt
|
|
64
|
-
this.handleDragEnd(oldIndex, newIndex)
|
|
65
|
-
}
|
|
66
|
-
})
|
|
67
|
-
},
|
|
68
|
-
handleDragEnd(oldIndex, newIndex) {
|
|
69
|
-
const columns = [...this.localColumns]
|
|
70
|
-
const targetRow = columns.splice(oldIndex, 1)[0]
|
|
71
|
-
columns.splice(newIndex, 0, targetRow)
|
|
72
|
-
this.localColumns = columns
|
|
73
|
-
this.$emit('update-columns', columns)
|
|
74
|
-
},
|
|
75
|
-
changeTableColumn() {
|
|
76
|
-
this.$emit('change-columns')
|
|
77
|
-
}
|
|
78
|
-
}
|
|
79
|
-
}
|
|
80
|
-
</script>
|
|
81
|
-
<style scoped>
|
|
82
|
-
.sortable-ghost {
|
|
83
|
-
opacity: 0.8;
|
|
84
|
-
background: #f0f9eb;
|
|
85
|
-
}
|
|
86
|
-
</style>
|