el-plus-crud 0.0.35 → 0.0.39
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/CHANGELOG.md +75 -67
- package/dist/el-plus-crud.mjs +2317 -2287
- package/dist/el-plus-crud.umd.js +14 -14
- package/dist/style.css +1 -1
- package/lib/components/el-plus-form/ElPlusForm.vue +2 -0
- package/lib/components/el-plus-form/components/ElPlusFormCascaderPanel.vue +3 -1
- package/lib/components/el-plus-form/components/ElPlusFormCheckbox.vue +3 -1
- package/lib/components/el-plus-form/components/ElPlusFormCheckboxButton.vue +3 -1
- package/lib/components/el-plus-form/components/ElPlusFormDaterange.vue +3 -1
- package/lib/components/el-plus-form/components/ElPlusFormDatetime.vue +3 -1
- package/lib/components/el-plus-form/components/ElPlusFormDatetimerange.vue +3 -1
- package/lib/components/el-plus-form/components/ElPlusFormInput.vue +61 -59
- package/lib/components/el-plus-form/components/ElPlusFormNbinput.vue +3 -1
- package/lib/components/el-plus-form/components/ElPlusFormNumber.vue +3 -1
- package/lib/components/el-plus-form/components/ElPlusFormPassword.vue +43 -41
- package/lib/components/el-plus-form/components/ElPlusFormQuickInput.vue +3 -1
- package/lib/components/el-plus-form/components/ElPlusFormTextarea.vue +3 -1
- package/lib/components/el-plus-table/ElPlusTable.vue +773 -767
- package/lib/components/el-plus-table/components/settingColumn.vue +178 -178
- package/package.json +1 -1
|
@@ -1,178 +1,178 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<div class="el-plus-table-edit-column">
|
|
3
|
-
<el-button v-if="showText" type="primary" @click="showSettingDialog" :size="size" plain>编辑显示列</el-button>
|
|
4
|
-
<el-button v-else type="primary" icon="ele-Setting" @click="showSettingDialog" :size="size" title="编辑显示列" plain circle />
|
|
5
|
-
|
|
6
|
-
<!-- 编辑列 -->
|
|
7
|
-
<el-dialog title="编辑显示列" v-model="showSettingColumn" width="40%">
|
|
8
|
-
<template #default>
|
|
9
|
-
<div class="select-panel">
|
|
10
|
-
<el-checkbox v-model="checkAll" :indeterminate="isIndeterminate" @change="selectAll"> 全选 </el-checkbox>
|
|
11
|
-
</div>
|
|
12
|
-
<el-checkbox-group v-model="localColumn" @change="changeSelect" style="padding: 0 10px; flex-wrap: wrap; display: flex">
|
|
13
|
-
<template v-for="item in props.column" :key="item.label">
|
|
14
|
-
<el-checkbox v-if="item._vif" :label="item.label" :disabled="item.required || item.noHide || false">
|
|
15
|
-
{{ item.label }}
|
|
16
|
-
</el-checkbox>
|
|
17
|
-
</template>
|
|
18
|
-
</el-checkbox-group>
|
|
19
|
-
</template>
|
|
20
|
-
<template #footer>
|
|
21
|
-
<div class="dialog-footer">
|
|
22
|
-
<el-button :size="size" @click="handelCancel"> 取 消 </el-button>
|
|
23
|
-
<el-button :size="size" type="primary" @click="changeColumnData"> 确 定 </el-button>
|
|
24
|
-
</div>
|
|
25
|
-
</template>
|
|
26
|
-
</el-dialog>
|
|
27
|
-
</div>
|
|
28
|
-
</template>
|
|
29
|
-
<script lang="ts" setup>
|
|
30
|
-
import { ref, onMounted, inject } from 'vue'
|
|
31
|
-
import { ElMessage } from 'element-plus'
|
|
32
|
-
|
|
33
|
-
const defaultConf = inject('defaultConf') as ICRUDConfig
|
|
34
|
-
|
|
35
|
-
const props = defineProps<{
|
|
36
|
-
column: Array<IColumnItem>
|
|
37
|
-
tbName: string
|
|
38
|
-
size: string
|
|
39
|
-
showText?: boolean
|
|
40
|
-
}>()
|
|
41
|
-
|
|
42
|
-
const showSettingColumn = ref(false)
|
|
43
|
-
const localColumn = ref([] as Array<String>)
|
|
44
|
-
const localOldColumn = ref([] as Array<String>)
|
|
45
|
-
const isIndeterminate = ref(false)
|
|
46
|
-
const checkAll = ref(false)
|
|
47
|
-
|
|
48
|
-
/**
|
|
49
|
-
* 打开弹框
|
|
50
|
-
*/
|
|
51
|
-
function showSettingDialog() {
|
|
52
|
-
showSettingColumn.value = true
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
function changeColumnData() {
|
|
56
|
-
if (localColumn.value.length <= 0) {
|
|
57
|
-
ElMessage.warning('请至少选择一列!')
|
|
58
|
-
return false
|
|
59
|
-
}
|
|
60
|
-
// 定义一个需要隐藏的列表-存储到本地用
|
|
61
|
-
const hideList = [] as Array<String>
|
|
62
|
-
props.column.map((item: any) => {
|
|
63
|
-
if (localColumn.value.indexOf(item.label) < 0) {
|
|
64
|
-
hideList.push(item.label)
|
|
65
|
-
item.scShow = false
|
|
66
|
-
} else {
|
|
67
|
-
item.scShow = true
|
|
68
|
-
}
|
|
69
|
-
})
|
|
70
|
-
if (hideList.length > 0) {
|
|
71
|
-
localStorage.setItem(defaultConf.storagePrefix + 'hideColumnsList_' + props.tbName, hideList.join('__'))
|
|
72
|
-
} else {
|
|
73
|
-
// 如果是对象,删除
|
|
74
|
-
localStorage.removeItem(defaultConf.storagePrefix + 'hideColumnsList_' + props.tbName)
|
|
75
|
-
}
|
|
76
|
-
showSettingColumn.value = false
|
|
77
|
-
// 赋值
|
|
78
|
-
localOldColumn.value = localColumn.value
|
|
79
|
-
}
|
|
80
|
-
|
|
81
|
-
/**
|
|
82
|
-
* 全选列
|
|
83
|
-
*/
|
|
84
|
-
function selectAll() {
|
|
85
|
-
localColumn.value = [] as Array<String>
|
|
86
|
-
if (checkAll.value) {
|
|
87
|
-
localColumn.value = props.column.map((item: any) => item.label)
|
|
88
|
-
} else {
|
|
89
|
-
// 这里要屏蔽掉禁止勾选的项
|
|
90
|
-
localColumn.value = props.column.filter((item) => item.required || item.noHide).map((item: any) => item.label)
|
|
91
|
-
}
|
|
92
|
-
isIndeterminate.value = false
|
|
93
|
-
}
|
|
94
|
-
|
|
95
|
-
/**
|
|
96
|
-
* 复选框改变时触发
|
|
97
|
-
*/
|
|
98
|
-
function changeSelect() {
|
|
99
|
-
if (localColumn.value.length === 0) {
|
|
100
|
-
isIndeterminate.value = false
|
|
101
|
-
checkAll.value = false
|
|
102
|
-
} else if (props.column.length === localColumn.value.length) {
|
|
103
|
-
isIndeterminate.value = false
|
|
104
|
-
checkAll.value = true
|
|
105
|
-
} else {
|
|
106
|
-
isIndeterminate.value = true
|
|
107
|
-
checkAll.value = false
|
|
108
|
-
}
|
|
109
|
-
}
|
|
110
|
-
|
|
111
|
-
/**
|
|
112
|
-
* 初始化选择列
|
|
113
|
-
* @param init
|
|
114
|
-
*/
|
|
115
|
-
function initLocalCheckList(init?: Boolean) {
|
|
116
|
-
// 从本地获取处理过的字段一级顺序
|
|
117
|
-
const tempLocalStr = localStorage.getItem(defaultConf.storagePrefix + 'hideColumnsList_' + props.tbName) as String
|
|
118
|
-
let tempList: any[] = []
|
|
119
|
-
|
|
120
|
-
// 判断为空
|
|
121
|
-
if (tempLocalStr !== undefined && tempLocalStr !== null && tempLocalStr.length > 0) {
|
|
122
|
-
// 用两个下划线拆分
|
|
123
|
-
tempList = tempLocalStr.split('__')
|
|
124
|
-
}
|
|
125
|
-
props.column.map((item: any) => {
|
|
126
|
-
// 这里初始化一下vif
|
|
127
|
-
if (item.vif !== undefined && item.vif !== null) {
|
|
128
|
-
if (typeof item.vif === 'function') {
|
|
129
|
-
item._vif = item.vif(item)
|
|
130
|
-
} else {
|
|
131
|
-
item._vif = !!item.vif
|
|
132
|
-
}
|
|
133
|
-
} else {
|
|
134
|
-
item._vif = true
|
|
135
|
-
}
|
|
136
|
-
if (
|
|
137
|
-
localColumn.value.push(item.label)
|
|
138
|
-
}
|
|
139
|
-
})
|
|
140
|
-
|
|
141
|
-
// 初始化的时候需要执行一次全选的状态校验
|
|
142
|
-
changeSelect()
|
|
143
|
-
if (init) {
|
|
144
|
-
changeColumnData()
|
|
145
|
-
}
|
|
146
|
-
}
|
|
147
|
-
|
|
148
|
-
/**
|
|
149
|
-
* 取消
|
|
150
|
-
*/
|
|
151
|
-
function handelCancel() {
|
|
152
|
-
showSettingColumn.value = false
|
|
153
|
-
// 还原
|
|
154
|
-
localColumn.value = localOldColumn.value
|
|
155
|
-
}
|
|
156
|
-
|
|
157
|
-
onMounted(() => {
|
|
158
|
-
if (props.tbName) {
|
|
159
|
-
initLocalCheckList(true)
|
|
160
|
-
}
|
|
161
|
-
})
|
|
162
|
-
|
|
163
|
-
defineExpose({ initCol: initLocalCheckList })
|
|
164
|
-
</script>
|
|
165
|
-
<style lang="scss" scoped>
|
|
166
|
-
.el-plus-table-edit-column {
|
|
167
|
-
margin: 0 10px;
|
|
168
|
-
display: inline-block;
|
|
169
|
-
|
|
170
|
-
.select-panel {
|
|
171
|
-
width: 100%;
|
|
172
|
-
height: 30px;
|
|
173
|
-
padding: 0 10px;
|
|
174
|
-
border-bottom: 1px solid #eee;
|
|
175
|
-
margin-bottom: 10px;
|
|
176
|
-
}
|
|
177
|
-
}
|
|
178
|
-
</style>
|
|
1
|
+
<template>
|
|
2
|
+
<div class="el-plus-table-edit-column">
|
|
3
|
+
<el-button v-if="showText" type="primary" @click="showSettingDialog" :size="size" plain>编辑显示列</el-button>
|
|
4
|
+
<el-button v-else type="primary" icon="ele-Setting" @click="showSettingDialog" :size="size" title="编辑显示列" plain circle />
|
|
5
|
+
|
|
6
|
+
<!-- 编辑列 -->
|
|
7
|
+
<el-dialog title="编辑显示列" v-model="showSettingColumn" width="40%">
|
|
8
|
+
<template #default>
|
|
9
|
+
<div class="select-panel">
|
|
10
|
+
<el-checkbox v-model="checkAll" :indeterminate="isIndeterminate" @change="selectAll"> 全选 </el-checkbox>
|
|
11
|
+
</div>
|
|
12
|
+
<el-checkbox-group v-model="localColumn" @change="changeSelect" style="padding: 0 10px; flex-wrap: wrap; display: flex">
|
|
13
|
+
<template v-for="item in props.column" :key="item.label">
|
|
14
|
+
<el-checkbox v-if="item._vif" :label="item.label" :disabled="item.required || item.noHide || false">
|
|
15
|
+
{{ item.label }}
|
|
16
|
+
</el-checkbox>
|
|
17
|
+
</template>
|
|
18
|
+
</el-checkbox-group>
|
|
19
|
+
</template>
|
|
20
|
+
<template #footer>
|
|
21
|
+
<div class="dialog-footer">
|
|
22
|
+
<el-button :size="size" @click="handelCancel"> 取 消 </el-button>
|
|
23
|
+
<el-button :size="size" type="primary" @click="changeColumnData"> 确 定 </el-button>
|
|
24
|
+
</div>
|
|
25
|
+
</template>
|
|
26
|
+
</el-dialog>
|
|
27
|
+
</div>
|
|
28
|
+
</template>
|
|
29
|
+
<script lang="ts" setup>
|
|
30
|
+
import { ref, onMounted, inject } from 'vue'
|
|
31
|
+
import { ElMessage } from 'element-plus'
|
|
32
|
+
|
|
33
|
+
const defaultConf = inject('defaultConf') as ICRUDConfig
|
|
34
|
+
|
|
35
|
+
const props = defineProps<{
|
|
36
|
+
column: Array<IColumnItem>
|
|
37
|
+
tbName: string
|
|
38
|
+
size: string
|
|
39
|
+
showText?: boolean
|
|
40
|
+
}>()
|
|
41
|
+
|
|
42
|
+
const showSettingColumn = ref(false)
|
|
43
|
+
const localColumn = ref([] as Array<String>)
|
|
44
|
+
const localOldColumn = ref([] as Array<String>)
|
|
45
|
+
const isIndeterminate = ref(false)
|
|
46
|
+
const checkAll = ref(false)
|
|
47
|
+
|
|
48
|
+
/**
|
|
49
|
+
* 打开弹框
|
|
50
|
+
*/
|
|
51
|
+
function showSettingDialog() {
|
|
52
|
+
showSettingColumn.value = true
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
function changeColumnData() {
|
|
56
|
+
if (localColumn.value.length <= 0) {
|
|
57
|
+
ElMessage.warning('请至少选择一列!')
|
|
58
|
+
return false
|
|
59
|
+
}
|
|
60
|
+
// 定义一个需要隐藏的列表-存储到本地用
|
|
61
|
+
const hideList = [] as Array<String>
|
|
62
|
+
props.column.map((item: any) => {
|
|
63
|
+
if (localColumn.value.indexOf(item.label) < 0) {
|
|
64
|
+
hideList.push(item.label)
|
|
65
|
+
item.scShow = false
|
|
66
|
+
} else {
|
|
67
|
+
item.scShow = true
|
|
68
|
+
}
|
|
69
|
+
})
|
|
70
|
+
if (hideList.length > 0) {
|
|
71
|
+
localStorage.setItem(defaultConf.storagePrefix + 'hideColumnsList_' + props.tbName, hideList.join('__'))
|
|
72
|
+
} else {
|
|
73
|
+
// 如果是对象,删除
|
|
74
|
+
localStorage.removeItem(defaultConf.storagePrefix + 'hideColumnsList_' + props.tbName)
|
|
75
|
+
}
|
|
76
|
+
showSettingColumn.value = false
|
|
77
|
+
// 赋值
|
|
78
|
+
localOldColumn.value = localColumn.value
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
/**
|
|
82
|
+
* 全选列
|
|
83
|
+
*/
|
|
84
|
+
function selectAll() {
|
|
85
|
+
localColumn.value = [] as Array<String>
|
|
86
|
+
if (checkAll.value) {
|
|
87
|
+
localColumn.value = props.column.map((item: any) => item.label)
|
|
88
|
+
} else {
|
|
89
|
+
// 这里要屏蔽掉禁止勾选的项
|
|
90
|
+
localColumn.value = props.column.filter((item) => item.required || item.noHide).map((item: any) => item.label)
|
|
91
|
+
}
|
|
92
|
+
isIndeterminate.value = false
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
/**
|
|
96
|
+
* 复选框改变时触发
|
|
97
|
+
*/
|
|
98
|
+
function changeSelect() {
|
|
99
|
+
if (localColumn.value.length === 0) {
|
|
100
|
+
isIndeterminate.value = false
|
|
101
|
+
checkAll.value = false
|
|
102
|
+
} else if (props.column.length === localColumn.value.length) {
|
|
103
|
+
isIndeterminate.value = false
|
|
104
|
+
checkAll.value = true
|
|
105
|
+
} else {
|
|
106
|
+
isIndeterminate.value = true
|
|
107
|
+
checkAll.value = false
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
/**
|
|
112
|
+
* 初始化选择列
|
|
113
|
+
* @param init
|
|
114
|
+
*/
|
|
115
|
+
function initLocalCheckList(init?: Boolean) {
|
|
116
|
+
// 从本地获取处理过的字段一级顺序
|
|
117
|
+
const tempLocalStr = localStorage.getItem(defaultConf.storagePrefix + 'hideColumnsList_' + props.tbName) as String
|
|
118
|
+
let tempList: any[] = []
|
|
119
|
+
|
|
120
|
+
// 判断为空
|
|
121
|
+
if (tempLocalStr !== undefined && tempLocalStr !== null && tempLocalStr.length > 0) {
|
|
122
|
+
// 用两个下划线拆分
|
|
123
|
+
tempList = tempLocalStr.split('__')
|
|
124
|
+
}
|
|
125
|
+
props.column.map((item: any) => {
|
|
126
|
+
// 这里初始化一下vif
|
|
127
|
+
if (item.vif !== undefined && item.vif !== null) {
|
|
128
|
+
if (typeof item.vif === 'function') {
|
|
129
|
+
item._vif = item.vif(item)
|
|
130
|
+
} else {
|
|
131
|
+
item._vif = !!item.vif
|
|
132
|
+
}
|
|
133
|
+
} else {
|
|
134
|
+
item._vif = true
|
|
135
|
+
}
|
|
136
|
+
if (tempList.indexOf(item.label) < 0 || item.required || item.noHide) {
|
|
137
|
+
localColumn.value.push(item.label)
|
|
138
|
+
}
|
|
139
|
+
})
|
|
140
|
+
|
|
141
|
+
// 初始化的时候需要执行一次全选的状态校验
|
|
142
|
+
changeSelect()
|
|
143
|
+
if (init) {
|
|
144
|
+
changeColumnData()
|
|
145
|
+
}
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
/**
|
|
149
|
+
* 取消
|
|
150
|
+
*/
|
|
151
|
+
function handelCancel() {
|
|
152
|
+
showSettingColumn.value = false
|
|
153
|
+
// 还原
|
|
154
|
+
localColumn.value = localOldColumn.value
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
onMounted(() => {
|
|
158
|
+
if (props.tbName) {
|
|
159
|
+
initLocalCheckList(true)
|
|
160
|
+
}
|
|
161
|
+
})
|
|
162
|
+
|
|
163
|
+
defineExpose({ initCol: initLocalCheckList })
|
|
164
|
+
</script>
|
|
165
|
+
<style lang="scss" scoped>
|
|
166
|
+
.el-plus-table-edit-column {
|
|
167
|
+
margin: 0 10px;
|
|
168
|
+
display: inline-block;
|
|
169
|
+
|
|
170
|
+
.select-panel {
|
|
171
|
+
width: 100%;
|
|
172
|
+
height: 30px;
|
|
173
|
+
padding: 0 10px;
|
|
174
|
+
border-bottom: 1px solid #eee;
|
|
175
|
+
margin-bottom: 10px;
|
|
176
|
+
}
|
|
177
|
+
}
|
|
178
|
+
</style>
|