From c7cf7505b885d327e341fc17089172fa49bbbdba Mon Sep 17 00:00:00 2001 From: wangjiahao <1522128093@qq.com> Date: Fri, 21 May 2021 10:23:56 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E7=A7=BB=E5=8A=A8=E5=AF=BC=E5=85=A5?= =?UTF-8?q?=E6=A8=A1=E6=9D=BF=E4=BD=8D=E7=BD=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../panel/PanelTemplateController.java | 4 +- .../resources/db/migration/V3__init_data.sql | 1 + .../resources/i18n/messages_en_US.properties | 2 + .../resources/i18n/messages_zh_CN.properties | 2 + .../resources/i18n/messages_zh_TW.properties | 74 +++++----- frontend/src/api/system/template.js | 38 +++++ frontend/src/lang/en.js | 1 + frontend/src/lang/tw.js | 1 + frontend/src/lang/zh.js | 1 + .../panel/list/EditPanel/TemplateAllList.vue | 17 +-- .../src/views/panel/list/EditPanel/index.vue | 6 +- frontend/src/views/panel/list/PanelList.vue | 4 +- .../template/component/TemplateImport.vue | 136 ++++++++++++++++++ .../panel/template/component/TemplateItem.vue | 8 +- .../panel/template/component/TemplateList.vue | 22 +-- frontend/src/views/panel/template/index.vue | 62 ++++++-- 16 files changed, 303 insertions(+), 76 deletions(-) create mode 100644 frontend/src/api/system/template.js create mode 100644 frontend/src/views/panel/template/component/TemplateImport.vue diff --git a/backend/src/main/java/io/dataease/controller/panel/PanelTemplateController.java b/backend/src/main/java/io/dataease/controller/panel/PanelTemplateController.java index 491606ed93..a90ddd7114 100644 --- a/backend/src/main/java/io/dataease/controller/panel/PanelTemplateController.java +++ b/backend/src/main/java/io/dataease/controller/panel/PanelTemplateController.java @@ -1,6 +1,7 @@ package io.dataease.controller.panel; import io.dataease.base.domain.PanelTemplateWithBLOBs; +import io.dataease.controller.handler.annotation.I18n; import io.dataease.controller.request.panel.PanelTemplateRequest; import io.dataease.dto.panel.PanelTemplateDTO; import io.dataease.service.panel.PanelTemplateService; @@ -22,6 +23,7 @@ public class PanelTemplateController { private PanelTemplateService panelTemplateService; @PostMapping("/templateList") + @I18n public List templateList(@RequestBody PanelTemplateRequest request) { return panelTemplateService.templateList(request); } @@ -31,7 +33,7 @@ public class PanelTemplateController { return panelTemplateService.save(request); } - @PostMapping("/delete/{id}") + @DeleteMapping("/delete/{id}") public void delete(@PathVariable String id) { panelTemplateService.delete(id); } diff --git a/backend/src/main/resources/db/migration/V3__init_data.sql b/backend/src/main/resources/db/migration/V3__init_data.sql index 5fc8d69862..397af9e899 100644 --- a/backend/src/main/resources/db/migration/V3__init_data.sql +++ b/backend/src/main/resources/db/migration/V3__init_data.sql @@ -160,6 +160,7 @@ COMMIT; INSERT INTO `panel_template`(`id`, `name`, `pid`, `level`, `node_type`, `create_by`, `create_time`, `snapshot`, `template_type`, `template_style`, `template_data`, `dynamic_data`) VALUES ('self', '用户模板', '', -1, 'folder', NULL, NULL, '', 'self', '', '', NULL); INSERT INTO `panel_template`(`id`, `name`, `pid`, `level`, `node_type`, `create_by`, `create_time`, `snapshot`, `template_type`, `template_style`, `template_data`, `dynamic_data`) VALUES ('system', '系统模板', '', -1, 'folder', NULL, NULL, NULL, 'system', NULL, NULL, NULL); + -- ---------------------------- diff --git a/backend/src/main/resources/i18n/messages_en_US.properties b/backend/src/main/resources/i18n/messages_en_US.properties index 83076a4f3c..9a8a5d4257 100644 --- a/backend/src/main/resources/i18n/messages_en_US.properties +++ b/backend/src/main/resources/i18n/messages_en_US.properties @@ -226,3 +226,5 @@ i18n_auth_view=View i18n_auth_use=Use i18n_auth_export=Export i18n_auth_manage=Manage +i18n_template_system=System Template +i18n_template_self=Self Template diff --git a/backend/src/main/resources/i18n/messages_zh_CN.properties b/backend/src/main/resources/i18n/messages_zh_CN.properties index 86a6411db6..cb7b0cb00f 100644 --- a/backend/src/main/resources/i18n/messages_zh_CN.properties +++ b/backend/src/main/resources/i18n/messages_zh_CN.properties @@ -227,3 +227,5 @@ i18n_auth_view=查看 i18n_auth_use=使用 i18n_auth_export=导出 i18n_auth_manage=管理 +i18n_template_system=系统模板 +i18n_template_self=用户模板 diff --git a/backend/src/main/resources/i18n/messages_zh_TW.properties b/backend/src/main/resources/i18n/messages_zh_TW.properties index 6fd799065e..56d9f07e56 100644 --- a/backend/src/main/resources/i18n/messages_zh_TW.properties +++ b/backend/src/main/resources/i18n/messages_zh_TW.properties @@ -159,7 +159,7 @@ quota_duration_excess_organization=壓測時長超過組織限額 license_valid_license_error=授權驗證失敗 license_valid_license_code=授權碼已經存在 import_xmind_count_error=思維導圖導入用例數量不能超過 500 條 -import_xmind_not_found=未找到测试用例 +import_xmind_not_found=未找到測試用例 test_review_task_notice=測試評審任務通知 test_track.length_less_than=標題過長,字數必須小於 @@ -186,44 +186,46 @@ automation_exec_info=沒有測試步驟,無法執行 authsource_name_already_exists=認證源名稱已經存在 authsource_name_is_null=認證源名稱不能為空 authsource_configuration_is_null=認證源配置不能為空 -个人信息=個人信息 -仪表盘=儀表盤 -修改密码=修改密碼 -创建用户=創建用戶 -创建组织=創建組織 -创建菜单=創建菜單 -创建角色=創建角色 -创建连接=創建鏈接 -删除用户=刪除用戶 -删除组织=刪除組織 -删除菜单=刪除菜單 -删除角色=刪除角色 -删除连接=删除鏈接 -参数管理=參數管理 -数据源=數據源 -数据源表单=數據源表單 -数据集=數據集 -权限管理=權限管理 -校验连接=校驗鏈接 +個人信息=個人信息 +儀表盤=儀表盤 +修改密碼=修改密碼 +創建用戶=創建用戶 +創建組織=創建組織 +創建菜單=創建菜單 +創建角色=創建角色 +創建連接=創建鏈接 +刪除用戶=刪除用戶 +刪除組織=刪除組織 +刪除菜單=刪除菜單 +刪除角色=刪除角色 +刪除連接=刪除鏈接 +參數管理=參數管理 +數據源=數據源 +數據源表單=數據源表單 +數據集=數據集 +權限管理=權限管理 +校驗連接=校驗鏈接 模板管理=模板管理 -用户管理=用戶管理 -用户表单=用戶表單 -系统管理=系統管理 -组织管理=組織管理 -组织表单=組織表單 -编辑用户=編輯用戶 -编辑组织=編輯組織 -编辑菜单=編輯菜單 -编辑角色=編輯角色 -编辑连接=編輯鏈接 -菜单管理=菜單管理 -菜单表单=表單管理 -视图=視圖 +用戶管理=用戶管理 +用戶表單=用戶表單 +系統管理=系統管理 +組織管理=組織管理 +組織表單=組織表單 +編輯用戶=編輯用戶 +編輯組織=編輯組織 +編輯菜單=編輯菜單 +編輯角色=編輯角色 +編輯連接=編輯鏈接 +菜單管理=菜單管理 +菜單表單=表單管理 +視圖=視圖 角色管理=角色管理 -角色表单=角色表單 -重置密码=重置密碼 -关于=關於 +角色表單=角色表單 +重置密碼=重置密碼 +關於=關於 i18n_auth_view=查看 i18n_auth_use=使用 i18n_auth_export=導出 i18n_auth_manage=管理 +i18n_template_system=系統模板 +i18n_template_self=用戶模板 diff --git a/frontend/src/api/system/template.js b/frontend/src/api/system/template.js new file mode 100644 index 0000000000..2259c59e36 --- /dev/null +++ b/frontend/src/api/system/template.js @@ -0,0 +1,38 @@ +import request from '@/utils/request' + +export function save(data) { + return request({ + url: '/template/save', + data: data, + method: 'post' + }) +} +export function templateDelete(id) { + return request({ + url: '/template/delete/' + id, + method: 'delete' + }) +} + +export function showTemplateList(data) { + return request({ + url: '/template/templateList', + data: data, + method: 'post' + }) +} + +export function findOne(id) { + return request({ + url: '/template/findOne/' + id, + method: 'get' + }) +} + +export function find(data) { + return request({ + url: '/template/find', + data: data, + method: 'post' + }) +} diff --git a/frontend/src/lang/en.js b/frontend/src/lang/en.js index e11fae5de8..362e5ee8bf 100644 --- a/frontend/src/lang/en.js +++ b/frontend/src/lang/en.js @@ -828,6 +828,7 @@ export default { delete: 'Delete', move_to: 'Move', rename: 'Rename', + import: 'Import', tips: 'Tips', confirm_delete: 'Confirm Delete', delete_success: 'Delete Success', diff --git a/frontend/src/lang/tw.js b/frontend/src/lang/tw.js index 54cde526c4..36bddd9694 100644 --- a/frontend/src/lang/tw.js +++ b/frontend/src/lang/tw.js @@ -828,6 +828,7 @@ export default { delete: '刪除', move_to: '移動到', rename: '重命名', + import: '导入模板', tips: '提示', confirm_delete: '確認刪除', delete_success: '刪除成功', diff --git a/frontend/src/lang/zh.js b/frontend/src/lang/zh.js index 6e43c72bce..9a98579c8b 100644 --- a/frontend/src/lang/zh.js +++ b/frontend/src/lang/zh.js @@ -830,6 +830,7 @@ export default { delete: '删除', move_to: '移动到', rename: '重命名', + import: '导入模板', tips: '提示', confirm_delete: '确认删除', delete_success: '删除成功', diff --git a/frontend/src/views/panel/list/EditPanel/TemplateAllList.vue b/frontend/src/views/panel/list/EditPanel/TemplateAllList.vue index 6b779b5f7d..c799ce90bc 100644 --- a/frontend/src/views/panel/list/EditPanel/TemplateAllList.vue +++ b/frontend/src/views/panel/list/EditPanel/TemplateAllList.vue @@ -22,22 +22,17 @@ @node-click="nodeClick" > - + - + - + - {{ data.name }} + {{ data.name }} - + + diff --git a/frontend/src/views/panel/list/EditPanel/index.vue b/frontend/src/views/panel/list/EditPanel/index.vue index 94331d0a8c..ec712aa61d 100644 --- a/frontend/src/views/panel/list/EditPanel/index.vue +++ b/frontend/src/views/panel/list/EditPanel/index.vue @@ -3,7 +3,7 @@ {{ $t('panel.custom') }} - {{ $t('panel.import_template') }} + {{ $t('panel.copy_template') }} @@ -18,7 +18,7 @@ - + @@ -157,7 +157,7 @@ export default { margin-top: 5px; border:1px solid #E6E6E6; height:300px !important; - overflow:auto; + overflow:hidden; background-size: 100% 100% !important; } .preview-show { diff --git a/frontend/src/views/panel/list/PanelList.vue b/frontend/src/views/panel/list/PanelList.vue index 9b3ac90d28..3454ccb421 100644 --- a/frontend/src/views/panel/list/PanelList.vue +++ b/frontend/src/views/panel/list/PanelList.vue @@ -48,7 +48,7 @@ - + {{ data.name }} @@ -64,7 +64,7 @@ -   {{ $t('panel.groupAdd') }} +   {{ $t('panel.groupAdd') }}   {{ $t('panel.panelAdd') }} diff --git a/frontend/src/views/panel/template/component/TemplateImport.vue b/frontend/src/views/panel/template/component/TemplateImport.vue new file mode 100644 index 0000000000..7337a13429 --- /dev/null +++ b/frontend/src/views/panel/template/component/TemplateImport.vue @@ -0,0 +1,136 @@ + + + + + diff --git a/frontend/src/views/panel/template/component/TemplateItem.vue b/frontend/src/views/panel/template/component/TemplateItem.vue index 21c451db2a..64a50fd975 100644 --- a/frontend/src/views/panel/template/component/TemplateItem.vue +++ b/frontend/src/views/panel/template/component/TemplateItem.vue @@ -4,7 +4,9 @@ - {{ template.name }} + + {{ template.name }} + @@ -34,7 +36,7 @@ export default { }, methods: { templateDelete() { - this.$alert(this.$t('panel.confirm_delete') + this.$t('panel.template') + ': ' + this.template.name + '?', '', { + this.$alert(this.$t('panel.confirm_delete') + this.$t('panel.template') + ': ' + this.template.name + '?', '', { confirmButtonText: this.$t('panel.confirm'), callback: (action) => { if (action === 'confirm') { @@ -63,6 +65,8 @@ export default { .demonstration { display: block; + font-size: 14px; + color: gray; text-align: center; margin: 10px auto; width: 150px; diff --git a/frontend/src/views/panel/template/component/TemplateList.vue b/frontend/src/views/panel/template/component/TemplateList.vue index 1323b9ed53..11f50ced1e 100644 --- a/frontend/src/views/panel/template/component/TemplateList.vue +++ b/frontend/src/views/panel/template/component/TemplateList.vue @@ -27,14 +27,11 @@ @node-click="nodeClick" > - + - + - {{ data.name }} + {{ data.name }} @@ -47,8 +44,11 @@ /> + + {{ $t('panel.import') }} + - {{ $t('panel.rename') }} + {{ $t('panel.rename') }} {{ $t('panel.delete') }} @@ -108,6 +108,9 @@ export default { case 'delete': this.templateDelete(param.data) break + case 'import': + this.templateImport(param.data) + break } }, beforeClickMore(type, data, node) { @@ -129,7 +132,7 @@ export default { this.$emit('showTemplateEditDialog', 'new') }, templateDelete(template) { - this.$alert(this.$t('panel.confirm_delete') + this.$t('panel.category') + ': ' + template.name + '?', '', { + this.$alert(this.$t('panel.confirm_delete') + this.$t('panel.category') + ': ' + template.name + '?', '', { confirmButtonText: this.$t('panel.confirm_delete'), callback: (action) => { if (action === 'confirm') { @@ -140,6 +143,9 @@ export default { }, templateEdit(template) { this.$emit('templateEdit', template) + }, + templateImport(template) { + this.$emit('templateImport', template.id) } } } diff --git a/frontend/src/views/panel/template/index.vue b/frontend/src/views/panel/template/index.vue index 77c2af3519..3aa1bb725a 100644 --- a/frontend/src/views/panel/template/index.vue +++ b/frontend/src/views/panel/template/index.vue @@ -4,16 +4,28 @@ {{ $t('panel.sys_template') }} - + {{ $t('panel.user_template') }} - + @@ -38,6 +50,15 @@ + + + + + @@ -47,11 +68,12 @@ import DeContainer from '@/components/dataease/DeContainer' import DeAsideContainer from '@/components/dataease/DeAsideContainer' import TemplateList from './component/TemplateList' import TemplateItem from './component/TemplateItem' -import { get, post } from '@/api/panel/panel' +import TemplateImport from './component/TemplateImport' +import { save, templateDelete, showTemplateList } from '@/api/system/template' export default { name: 'PanelMain', - components: { DeMainContainer, DeContainer, DeAsideContainer, TemplateList, TemplateItem }, + components: { DeMainContainer, DeContainer, DeAsideContainer, TemplateList, TemplateItem, TemplateImport }, data() { return { showShare: false, @@ -66,7 +88,12 @@ export default { templateEditForm: {}, editTemplate: false, dialogTitle: '', - templateList: [] + templateList: [], + templateDialog: { + title: this.$t('panel.import_template'), + visible: false, + pid: '' + } } }, mounted() { @@ -79,14 +106,14 @@ export default { showCurrentTemplate(pid) { this.currentTemplateId = pid if (this.currentTemplateId) { - post('/template/templateList', { pid: this.currentTemplateId }).then(response => { + showTemplateList({ pid: this.currentTemplateId }).then(response => { this.currentTemplateShowList = response.data }) } }, templateDelete(id) { if (id) { - post('/template/delete/' + id, null).then(response => { + templateDelete(id).then(response => { this.$message({ message: this.$t('commons.delete_success'), type: 'success', @@ -110,7 +137,7 @@ export default { this.showTemplateEditDialog('edit', templateInfo) }, saveTemplateEdit(templateEditForm) { - post('/template/save', templateEditForm).then(response => { + save(templateEditForm).then(response => { this.$message({ message: this.$t('commons.save_success'), type: 'success', @@ -128,7 +155,7 @@ export default { templateType: this.currentTemplateType, level: '0' } - post('/template/templateList', request).then(res => { + showTemplateList(request).then(res => { this.templateList = res.data this.showFirst() }) @@ -153,6 +180,15 @@ export default { } else { this.currentTemplateShowList = [] } + }, + closeEditTemplateDialog() { + debugger + this.templateDialog.visible = false + this.showCurrentTemplate(this.templateDialog.pid) + }, + templateImport(pid) { + this.templateDialog.visible = true + this.templateDialog.pid = pid } } }