diff --git a/src/layout/components/el-data-table/components/el-data-table-column.js b/src/components/el-data-table/components/el-data-table-column.js
similarity index 100%
rename from src/layout/components/el-data-table/components/el-data-table-column.js
rename to src/components/el-data-table/components/el-data-table-column.js
diff --git a/src/layout/components/el-data-table/components/self-loading-button.vue b/src/components/el-data-table/components/self-loading-button.vue
similarity index 100%
rename from src/layout/components/el-data-table/components/self-loading-button.vue
rename to src/components/el-data-table/components/self-loading-button.vue
diff --git a/src/layout/components/el-data-table/components/text-button.vue b/src/components/el-data-table/components/text-button.vue
similarity index 100%
rename from src/layout/components/el-data-table/components/text-button.vue
rename to src/components/el-data-table/components/text-button.vue
diff --git a/src/layout/components/el-data-table/components/the-dialog.vue b/src/components/el-data-table/components/the-dialog.vue
similarity index 100%
rename from src/layout/components/el-data-table/components/the-dialog.vue
rename to src/components/el-data-table/components/the-dialog.vue
diff --git a/src/layout/components/el-data-table/el-data-table.md b/src/components/el-data-table/el-data-table.md
similarity index 100%
rename from src/layout/components/el-data-table/el-data-table.md
rename to src/components/el-data-table/el-data-table.md
diff --git a/src/layout/components/el-data-table/el-data-table.vue b/src/components/el-data-table/el-data-table.vue
similarity index 91%
rename from src/layout/components/el-data-table/el-data-table.vue
rename to src/components/el-data-table/el-data-table.vue
index 907197391..ab4d640d2 100644
--- a/src/layout/components/el-data-table/el-data-table.vue
+++ b/src/components/el-data-table/el-data-table.vue
@@ -9,7 +9,7 @@
-
-
-
+ @slot 额外的搜索内容, 当searchForm不满足需求时可以使用-->
+
-
+
@@ -66,10 +66,58 @@
:disabled="selected.length === 0 || (single && selected.length > 1)"
@click="onDefaultDelete(single ? selected[0] : selected)"
>{{ deleteText }}
-
+
+
+
+ 更多菜单
+
+
+ 批量删除
+ 批量更新
+ 禁用所选
+ 激活所选
+
+
+
+
+
+ CSV
+
+
+ 上传
+ 下载
+ 更新
+
+
+
+
+
+
+
+
+ 查询
+ 重置
+
+
-
+
+
+
+
+ {{ scope.row.name }}
+
+
+
@@ -436,6 +498,20 @@ export default {
type: Boolean,
default: true
},
+ /**
+ * 是否有动作按钮
+ */
+ hasAction: {
+ type: Boolean,
+ default: true
+ },
+ /**
+ * 是否有动作按钮
+ */
+ hasUpload: {
+ type: Boolean,
+ default: true
+ },
/**
* 是否有编辑按钮
*/
@@ -813,14 +889,12 @@ export default {
hasSelect() {
return this.columns.length && this.columns[0].type === 'selection'
},
-
selectable() {
if (this.hasSelect && this.columns[0].selectable) {
return this.columns[0].selectable
}
return () => true
},
-
columnsAlign() {
if (this.columns.some(col => col.columns && col.columns.length)) {
// 多级表头默认居中
@@ -1091,8 +1165,8 @@ export default {
// 弹窗相关
// 除非树形结构在操作列点击新增, 否则 row 是 MouseEvent
onDefaultNew(row) {
- this.row = row
- this.$refs.dialog.show(dialogModes.new)
+ // 屏蔽默认New方法
+ this.onNew()
},
onDefaultView(row) {
this.row = row
diff --git a/src/layout/components/el-data-table/index.js b/src/components/el-data-table/index.js
similarity index 100%
rename from src/layout/components/el-data-table/index.js
rename to src/components/el-data-table/index.js
diff --git a/src/layout/components/el-data-table/index.less b/src/components/el-data-table/index.less
similarity index 100%
rename from src/layout/components/el-data-table/index.less
rename to src/components/el-data-table/index.less
diff --git a/src/layout/components/el-data-table/utils/extract-keys.js b/src/components/el-data-table/utils/extract-keys.js
similarity index 100%
rename from src/layout/components/el-data-table/utils/extract-keys.js
rename to src/components/el-data-table/utils/extract-keys.js
diff --git a/src/layout/components/el-data-table/utils/is-falsey.js b/src/components/el-data-table/utils/is-falsey.js
similarity index 100%
rename from src/layout/components/el-data-table/utils/is-falsey.js
rename to src/components/el-data-table/utils/is-falsey.js
diff --git a/src/layout/components/el-data-table/utils/query.js b/src/components/el-data-table/utils/query.js
similarity index 100%
rename from src/layout/components/el-data-table/utils/query.js
rename to src/components/el-data-table/utils/query.js
diff --git a/src/layout/components/el-data-table/utils/search-immediately-item.js b/src/components/el-data-table/utils/search-immediately-item.js
similarity index 100%
rename from src/layout/components/el-data-table/utils/search-immediately-item.js
rename to src/components/el-data-table/utils/search-immediately-item.js
diff --git a/src/layout/components/el-data-table/utils/select-strategy.js b/src/components/el-data-table/utils/select-strategy.js
similarity index 100%
rename from src/layout/components/el-data-table/utils/select-strategy.js
rename to src/components/el-data-table/utils/select-strategy.js
diff --git a/src/layout/components/el-form-renderer/components/render-form-group.vue b/src/components/el-form-renderer/components/render-form-group.vue
similarity index 100%
rename from src/layout/components/el-form-renderer/components/render-form-group.vue
rename to src/components/el-form-renderer/components/render-form-group.vue
diff --git a/src/layout/components/el-form-renderer/components/render-form-item.vue b/src/components/el-form-renderer/components/render-form-item.vue
similarity index 100%
rename from src/layout/components/el-form-renderer/components/render-form-item.vue
rename to src/components/el-form-renderer/components/render-form-item.vue
diff --git a/src/layout/components/el-form-renderer/el-form-renderer.md b/src/components/el-form-renderer/el-form-renderer.md
similarity index 100%
rename from src/layout/components/el-form-renderer/el-form-renderer.md
rename to src/components/el-form-renderer/el-form-renderer.md
diff --git a/src/layout/components/el-form-renderer/el-form-renderer.vue b/src/components/el-form-renderer/el-form-renderer.vue
similarity index 100%
rename from src/layout/components/el-form-renderer/el-form-renderer.vue
rename to src/components/el-form-renderer/el-form-renderer.vue
diff --git a/src/layout/components/el-form-renderer/index.js b/src/components/el-form-renderer/index.js
similarity index 100%
rename from src/layout/components/el-form-renderer/index.js
rename to src/components/el-form-renderer/index.js
diff --git a/src/layout/components/el-form-renderer/util/enable-when.js b/src/components/el-form-renderer/util/enable-when.js
similarity index 100%
rename from src/layout/components/el-form-renderer/util/enable-when.js
rename to src/components/el-form-renderer/util/enable-when.js
diff --git a/src/layout/components/el-form-renderer/util/transform-content.js b/src/components/el-form-renderer/util/transform-content.js
similarity index 100%
rename from src/layout/components/el-form-renderer/util/transform-content.js
rename to src/components/el-form-renderer/util/transform-content.js
diff --git a/src/layout/components/el-form-renderer/util/utils.js b/src/components/el-form-renderer/util/utils.js
similarity index 100%
rename from src/layout/components/el-form-renderer/util/utils.js
rename to src/components/el-form-renderer/util/utils.js
diff --git a/src/i18n/i18n.js b/src/i18n/i18n.js
index 5cc800484..74e61f157 100644
--- a/src/i18n/i18n.js
+++ b/src/i18n/i18n.js
@@ -11,4 +11,8 @@ const i18n = new VueI18n({
})
locale.i18n((key, value) => i18n.t(key, value)) // 重点: 为了实现element插件的多语言切换
+Vue.prototype.$ti = (key) => {
+ i18n.t(key.toLowerCase)
+}
+
export default i18n
diff --git a/src/layout/components/Page/PageContent.vue b/src/layout/components/Page/PageContent.vue
index 6429d5d6b..be3f480f0 100644
--- a/src/layout/components/Page/PageContent.vue
+++ b/src/layout/components/Page/PageContent.vue
@@ -1,6 +1,6 @@
-
+
diff --git a/src/layout/components/Page/PageHeading.vue b/src/layout/components/Page/PageHeading.vue
index 10f02d8c1..56b9a7eba 100644
--- a/src/layout/components/Page/PageHeading.vue
+++ b/src/layout/components/Page/PageHeading.vue
@@ -4,7 +4,7 @@
{{ title }}
-
+
diff --git a/src/layout/components/Page/index.vue b/src/layout/components/Page/index.vue
index c918fbaa1..572cd7ee6 100644
--- a/src/layout/components/Page/index.vue
+++ b/src/layout/components/Page/index.vue
@@ -4,7 +4,7 @@
{{ pageTitle }}
-
+
diff --git a/src/layout/components/index.js b/src/layout/components/index.js
index aec829fbb..748a8db5f 100644
--- a/src/layout/components/index.js
+++ b/src/layout/components/index.js
@@ -4,6 +4,5 @@ export { default as AppMain } from './AppMain'
export { default as Page } from './Page'
export { default as ListTables } from './ListTables'
export { default as TagsView } from './TagsView'
-export { default as ElDataTable } from './el-data-table'
export { default as Footer } from './Footer'
export { default as IBox } from './IBox'
diff --git a/src/main.js b/src/main.js
index 2bba465ae..14bd30106 100644
--- a/src/main.js
+++ b/src/main.js
@@ -36,8 +36,8 @@ Vue.use(ElementUI, { locale })
Vue.config.productionTip = false
-import ElDataTable from '@/layout/components/el-data-table/el-data-table.vue'
-import ElFormRenderer from '@/layout/components/el-form-renderer/el-form-renderer.vue'
+import ElDataTable from '@/components/el-data-table/el-data-table.vue'
+import ElFormRenderer from '@/components/el-form-renderer/el-form-renderer.vue'
import {
Message,
MessageBox
diff --git a/src/views/users/UserList.vue b/src/views/users/UserList.vue
index e9c549dd8..105354766 100644
--- a/src/views/users/UserList.vue
+++ b/src/views/users/UserList.vue
@@ -1,20 +1,6 @@
-
-
-
-
- 更多菜单
-
-
- 批量删除
- 批量更新
- 禁用所选
- 激活所选
-
-
-
-
+
@@ -41,6 +27,8 @@ export default {
hasEdit: false, // 有编辑按钮
newText: '创建',
hasDelete: false,
+ hasAction: true, // 是否有更多操作
+ hasUpload: false,
hasNew: true,
// editText: this.$t('action.update'), // 编辑按钮文案
tableAttrs: {
@@ -67,6 +55,15 @@ export default {
}
}
],
+ searchForm: [
+ {
+ type: 'input',
+ id: 'search', // 发起请求附带的查询参数
+ width: '200px',
+ el: { placeholder: '搜索', clearable: true, size: 'small' },
+ rules: [{ required: false, trigger: 'blur', max: 12 }]
+ }
+ ],
columns: [
{ type: 'selection' },
// Bug
@@ -74,7 +71,8 @@ export default {
{
prop: 'name',
label: this.$t('users.name'),
- sortable: true // 可排序
+ sortable: true, // 可排序
+ url: 'UserDetail' // 第一个函数指定 路由Template
},
{
prop: 'username',
@@ -104,7 +102,9 @@ export default {
created() {
},
methods: {
-
+ onNew: () => {
+ alert('创建')
+ }
}
}