From fc8aea41a2795aa60f0f3bb3c795c4f0979c3eaa Mon Sep 17 00:00:00 2001 From: shuiluo Date: Sat, 17 Jul 2021 09:48:28 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E4=BB=A3=E7=A0=81=E4=BC=98=E5=8C=96?= =?UTF-8?q?=EF=BC=8C=20=E9=83=A8=E5=88=86=E5=9B=BD=E9=99=85=E5=8C=96?= =?UTF-8?q?=E5=AE=8C=E5=96=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/table/table.vue | 23 +- src/components/tool/Drawer.vue | 196 +++++++++--------- src/local/index.js | 2 + src/local/table.js | 7 + .../frame/components/setting/Setting.vue | 17 +- src/pages/frame/layouts/AdminLayout.vue | 4 +- .../ranger/task_managment/center/index.vue | 29 +-- 7 files changed, 149 insertions(+), 129 deletions(-) create mode 100644 src/local/table.js diff --git a/src/components/table/table.vue b/src/components/table/table.vue index dc767b2..fe15913 100644 --- a/src/components/table/table.vue +++ b/src/components/table/table.vue @@ -13,10 +13,10 @@ - 更多查询 + {{ $t('table.moreSearch') }} - 重置 - 查询 + {{ $t('table.reset') }} + {{ $t('table.search') }} @@ -24,7 +24,7 @@ - {{ newBtn.text || '新增' }} + {{ newBtn.text || $t('table.add') }} @@ -42,7 +42,7 @@ > @@ -65,7 +65,7 @@ :width="dWidth" @close="hidden" :maskClosable="false" - :title="title" + :title="drawerTitle" :afterVisibleChange="afterVisibleChange" > @@ -83,8 +83,6 @@ const initQuery = { pageNum: 1, }; -const defaultTitle = '新增'; - export default { props: { url: String, @@ -123,7 +121,7 @@ export default { loading: false, total: 0, visible: false, - title: newBtn.title ?? defaultTitle, + title: null, drawerStyle: { display: 'flex', flexDirection: 'column', @@ -160,7 +158,7 @@ export default { newButtons() { return this.buttons ? Array.isArray(this.buttons) - ? { data: this.buttons, title: '操作' } + ? { data: this.buttons } : this.buttons : null; }, @@ -188,6 +186,9 @@ export default { } : {}; }, + drawerTitle() { + return this.title ?? this.addBtn?.title ?? this.$t('table.add'); + }, }, methods: { @@ -228,7 +229,7 @@ export default { }, afterVisibleChange(visible) { if (!visible) { - this.title = this.addBtn?.title ?? defaultTitle; + this.title = null; this.type = null; this.row = null; this.dWidth = this.drawerWidth; diff --git a/src/components/tool/Drawer.vue b/src/components/tool/Drawer.vue index f3810e9..8d2ec5f 100644 --- a/src/components/tool/Drawer.vue +++ b/src/components/tool/Drawer.vue @@ -1,64 +1,68 @@ diff --git a/src/local/index.js b/src/local/index.js index 2fd0f73..5cd2aea 100644 --- a/src/local/index.js +++ b/src/local/index.js @@ -1,4 +1,5 @@ import selectLang from './select'; +import TableLang from './table'; const zh_CN = {}; const en_US = {}; @@ -12,5 +13,6 @@ function formatLang(langObject) { } formatLang(selectLang); +formatLang(TableLang); export { en_US, zh_CN }; diff --git a/src/local/table.js b/src/local/table.js new file mode 100644 index 0000000..875567c --- /dev/null +++ b/src/local/table.js @@ -0,0 +1,7 @@ +export default { + 'table.operation': ['操作', 'Operation'], + 'table.moreSearch': ['更多查询', 'More Search'], + 'table.reset': ['重置', 'Reset'], + 'table.add': ['新增', 'Add'], + 'table.search': ['查询', 'Search'], +}; diff --git a/src/pages/frame/components/setting/Setting.vue b/src/pages/frame/components/setting/Setting.vue index fd5a45d..3825e7c 100644 --- a/src/pages/frame/components/setting/Setting.vue +++ b/src/pages/frame/components/setting/Setting.vue @@ -8,7 +8,7 @@ - + @@ -113,7 +113,7 @@ item.name == this.animate.name).directions; + return this.animates.find((item) => item.name == this.animate.name).directions; }, ...mapState('settingModule', [ 'theme', @@ -254,7 +254,7 @@ export default { ]), }, watch: { - 'animate.name': function(val) { + 'animate.name': function (val) { this.setAnimate({ name: val, direction: this.directions[0] }); }, }, @@ -282,7 +282,7 @@ export default { let config = {}; let mySetting = this.$store.state.settingModule; let dftSetting = local ? settingConfig : settingConfig; - Object.keys(mySetting).forEach(key => { + Object.keys(mySetting).forEach((key) => { const dftValue = dftSetting[key], myValue = mySetting[key]; if (dftValue != undefined && !fastEqual(dftValue, myValue)) { @@ -309,6 +309,7 @@ export default {