From 9f7151820f0334e4f9969218d976f4545184cd1d Mon Sep 17 00:00:00 2001 From: kuaifan Date: Thu, 1 Dec 2022 18:18:45 +0800 Subject: [PATCH] =?UTF-8?q?perf:=20=E4=BC=98=E5=8C=96=E5=9B=BD=E9=99=85?= =?UTF-8?q?=E5=8C=96=E6=8F=90=E5=8D=87=E8=AE=BF=E9=97=AE=E9=80=9F=E5=BA=A6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- resources/assets/js/App.vue | 7 +- resources/assets/js/app.js | 6 +- resources/assets/js/components/Drawio.vue | 3 +- resources/assets/js/components/OnlyOffice.vue | 3 +- resources/assets/js/language/data.js | 4 + resources/assets/js/language/index.js | 467 ++++++++---------- resources/assets/js/language/language.js | 3 - resources/assets/js/pages/index.vue | 18 +- resources/assets/js/pages/login.vue | 14 +- resources/assets/js/pages/manage.vue | 26 +- resources/assets/js/pages/manage/calendar.vue | 103 ++-- .../manage/components/ProjectArchived.vue | 46 +- .../manage/components/ProjectManagement.vue | 46 +- .../js/pages/manage/components/ReportMy.vue | 62 ++- .../pages/manage/components/ReportReceive.vue | 68 ++- .../pages/manage/components/TaskArchived.vue | 64 ++- .../pages/manage/components/TaskDeleted.vue | 64 ++- .../manage/components/TeamManagement.vue | 210 ++++---- resources/assets/js/pages/manage/file.vue | 384 +++++++------- .../js/pages/manage/setting/language.vue | 7 +- .../js/pages/manage/setting/password.vue | 20 +- .../js/pages/manage/setting/personal.vue | 30 +- resources/assets/js/pages/pro.vue | 13 +- resources/assets/js/store/actions.js | 9 +- 24 files changed, 810 insertions(+), 867 deletions(-) create mode 100644 resources/assets/js/language/data.js delete mode 100644 resources/assets/js/language/language.js diff --git a/resources/assets/js/App.vue b/resources/assets/js/App.vue index 61552e72e..dcdbecae4 100755 --- a/resources/assets/js/App.vue +++ b/resources/assets/js/App.vue @@ -44,6 +44,7 @@ import NetworkException from "./components/NetworkException"; import AudioManager from "./components/AudioManager"; import TaskOperation from "./pages/manage/components/TaskOperation"; import {mapState} from "vuex"; +import {languageType} from "./language"; export default { components: {TaskOperation, AudioManager, NetworkException, PreviewImageState, RightBottom, FloatSpinner}, @@ -153,10 +154,6 @@ export default { themeMode() { this.synchThemeLanguage(); - }, - - languageType() { - this.synchThemeLanguage(); } }, @@ -198,7 +195,7 @@ export default { this.iframes = this.iframes.filter(({key}) => key != 'synchThemeLanguage') this.iframes.push({ key: 'synchThemeLanguage', - url: $A.apiUrl(`../setting/theme_language?theme=${this.themeMode}&language=${this.languageType}`) + url: $A.apiUrl(`../setting/theme_language?theme=${this.themeMode}&language=${languageType}`) }) } }, diff --git a/resources/assets/js/app.js b/resources/assets/js/app.js index fbbb05478..3fb917c76 100644 --- a/resources/assets/js/app.js +++ b/resources/assets/js/app.js @@ -1,6 +1,8 @@ const isElectron = window && window.process && window.process.type; const isEEUiApp = window && window.navigator && /eeui/i.test(window.navigator.userAgent); +import {switchLanguage as $L} from "./language"; + import './functions/common' import './functions/eeui' import './functions/web' @@ -12,7 +14,6 @@ import routes from './routes' import VueRouter from 'vue-router' import VueClipboard from 'vue-clipboard2' import ViewUI from 'view-design-hi' -import Language from './language/index' import store from './store/index' import mixin from "./store/mixin" @@ -28,7 +29,6 @@ Vue.use(VueClipboard, { } }); Vue.use(VueRouter); -Vue.use(Language); import PageTitle from './components/PageTitle.vue' import Loading from './components/Loading.vue' @@ -149,6 +149,7 @@ if (isElectron) { } Vue.prototype.$A = $A; +Vue.prototype.$L = $L; Vue.prototype.$Electron = $A.Electron; Vue.prototype.$Platform = $A.Platform; Vue.prototype.$isMainElectron = $A.isMainElectron; @@ -170,7 +171,6 @@ const app = new Vue({ $A.goForward = app.goForward; $A.goBack = app.goBack; -$A.getLanguage = app.getLanguage; $A.Message = app.$Message; $A.Notice = app.$Notice; $A.Modal = app.$Modal; diff --git a/resources/assets/js/components/Drawio.vue b/resources/assets/js/components/Drawio.vue index db3ab1e10..5bd4c86a5 100644 --- a/resources/assets/js/components/Drawio.vue +++ b/resources/assets/js/components/Drawio.vue @@ -37,6 +37,7 @@ diff --git a/resources/assets/js/pages/manage.vue b/resources/assets/js/pages/manage.vue index 9e6ce6e71..a7913c008 100644 --- a/resources/assets/js/pages/manage.vue +++ b/resources/assets/js/pages/manage.vue @@ -99,7 +99,7 @@ placement="right-start" transfer transfer-class-name="page-manage-menu-dropdown" - @on-click="setLanguage"> + @on-click="onLanguage">
{{currentLanguage}} @@ -111,7 +111,7 @@ v-for="(item, key) in languageList" :key="key" :name="key" - :selected="getLanguage() === key">{{item}} + :selected="languageType === key">{{item}} @@ -375,6 +375,7 @@ import DialogModal from "./manage/components/DialogModal"; import TaskModal from "./manage/components/TaskModal"; import notificationKoro from "notification-koro1"; import {Store} from "le5le-store"; +import {languageList, languageType, setLanguage} from "../language"; export default { components: { @@ -396,6 +397,9 @@ export default { return { loadIng: 0, + languageList, + languageType, + mateName: /macintosh|mac os x/i.test(navigator.userAgent) ? '⌘' : 'Ctrl', addShow: false, @@ -404,7 +408,12 @@ export default { columns: '', flow: 'open', }, - addRule: {}, + addRule: { + name: [ + { required: true, message: this.$L('请填写项目名称!'), trigger: 'change' }, + { type: 'string', min: 2, message: this.$L('项目名称至少2个字!'), trigger: 'change' } + ] + }, addTaskShow: false, addTaskSubscribe: null, @@ -564,7 +573,7 @@ export default { }, currentLanguage() { - return this.languageList[this.languageType] || 'Language' + return languageList[languageType] || 'Language' }, menu() { @@ -733,13 +742,8 @@ export default { }, methods: { - initLanguage() { - this.addRule = { - name: [ - { required: true, message: this.$L('请填写项目名称!'), trigger: 'change' }, - { type: 'string', min: 2, message: this.$L('项目名称至少2个字!'), trigger: 'change' } - ] - }; + onLanguage(l) { + setLanguage(l) }, chackPass() { diff --git a/resources/assets/js/pages/manage/calendar.vue b/resources/assets/js/pages/manage/calendar.vue index 43623ebea..cd10b651e 100644 --- a/resources/assets/js/pages/manage/calendar.vue +++ b/resources/assets/js/pages/manage/calendar.vue @@ -52,6 +52,7 @@ import Calendar from "./components/Calendar"; import moment from "moment"; import {Store} from "le5le-store"; import TaskMenu from "./components/TaskMenu"; +import {addLanguage} from "../../language"; export default { components: {TaskMenu, Calendar}, @@ -78,6 +79,57 @@ export default { } }, + created() { + addLanguage([ + {"_": "{日}","CN": "日","EN": "Sun","TC": "日","KM": "Sun","TH": "Sun","KO": "Sun","JA": "Sun"}, + {"_": "{一}","CN": "一","EN": "Mon","TC": "一","KM": "Mon","TH": "Mon","KO": "Mon","JA": "Mon"}, + {"_": "{二}","CN": "二","EN": "Tue","TC": "二","KM": "Tue","TH": "Tue","KO": "Tue","JA": "Tue"}, + {"_": "{三}","CN": "三","EN": "Wed","TC": "三","KM": "Wed","TH": "Wed","KO": "Wed","JA": "Wed"}, + {"_": "{四}","CN": "四","EN": "Thu","TC": "四","KM": "Thu","TH": "Thu","KO": "Thu","JA": "Thu"}, + {"_": "{五}","CN": "五","EN": "Fri","TC": "五","KM": "Fri","TH": "Fri","KO": "Fri","JA": "Fri"}, + {"_": "{六}","CN": "六","EN": "Sat","TC": "六","KM": "Sat","TH": "Sat","KO": "Sat","JA": "Sat"}, + ]); + let daynames = [ + this.$L('{日}'), + this.$L('{一}'), + this.$L('{二}'), + this.$L('{三}'), + this.$L('{四}'), + this.$L('{五}'), + this.$L('{六}') + ]; + this.calendarWeek = {daynames}; + this.calendarMonth = {daynames}; + this.calendarTheme = { + 'common.border': '1px solid rgba(0,0,0,0)', + 'month.dayname.fontSize': '14px', + 'month.dayname.borderLeft': '1px solid rgba(0,0,0,0)', + 'month.dayname.height': '50px', + } + if (this.windowLarge) { + this.calendarTheme = { + 'common.border': '1px solid #f4f5f5', + 'month.dayname.fontSize': '14px', + 'month.dayname.borderLeft': '1px solid #f4f5f5', + 'month.dayname.height': '50px', + } + } + this.calendarTemplate = { + titlePlaceholder: () => { + return this.$L("任务描述") + }, + popupSave: () => { + return this.$L("保存"); + }, + popupEdit: () => { + return this.$L("详情"); + }, + popupDelete: () => { + return this.$L("删除"); + } + } + }, + activated() { this.$refs.cal.resetRender(); this.setRenderRange(); @@ -187,57 +239,6 @@ export default { }, methods: { - initLanguage() { - this.addLanguageData([ - {"_": "{日}","CN": "日","EN": "Sun","TC": "日","KM": "Sun","TH": "Sun","KO": "Sun","JA": "Sun"}, - {"_": "{一}","CN": "一","EN": "Mon","TC": "一","KM": "Mon","TH": "Mon","KO": "Mon","JA": "Mon"}, - {"_": "{二}","CN": "二","EN": "Tue","TC": "二","KM": "Tue","TH": "Tue","KO": "Tue","JA": "Tue"}, - {"_": "{三}","CN": "三","EN": "Wed","TC": "三","KM": "Wed","TH": "Wed","KO": "Wed","JA": "Wed"}, - {"_": "{四}","CN": "四","EN": "Thu","TC": "四","KM": "Thu","TH": "Thu","KO": "Thu","JA": "Thu"}, - {"_": "{五}","CN": "五","EN": "Fri","TC": "五","KM": "Fri","TH": "Fri","KO": "Fri","JA": "Fri"}, - {"_": "{六}","CN": "六","EN": "Sat","TC": "六","KM": "Sat","TH": "Sat","KO": "Sat","JA": "Sat"}, - ]); - let daynames = [ - this.$L('{日}'), - this.$L('{一}'), - this.$L('{二}'), - this.$L('{三}'), - this.$L('{四}'), - this.$L('{五}'), - this.$L('{六}') - ]; - this.calendarWeek = {daynames}; - this.calendarMonth = {daynames}; - this.calendarTheme = { - 'common.border': '1px solid rgba(0,0,0,0)', - 'month.dayname.fontSize': '14px', - 'month.dayname.borderLeft': '1px solid rgba(0,0,0,0)', - 'month.dayname.height': '50px', - } - if (this.windowLarge) { - this.calendarTheme = { - 'common.border': '1px solid #f4f5f5', - 'month.dayname.fontSize': '14px', - 'month.dayname.borderLeft': '1px solid #f4f5f5', - 'month.dayname.height': '50px', - } - } - this.calendarTemplate = { - titlePlaceholder: () => { - return this.$L("任务描述") - }, - popupSave: () => { - return this.$L("保存"); - }, - popupEdit: () => { - return this.$L("详情"); - }, - popupDelete: () => { - return this.$L("删除"); - } - } - }, - getTask(time) { if (this.loadIng > 0) { clearTimeout(this.loadTimeout) diff --git a/resources/assets/js/pages/manage/components/ProjectArchived.vue b/resources/assets/js/pages/manage/components/ProjectArchived.vue index 1015ff938..17357eeb4 100644 --- a/resources/assets/js/pages/manage/components/ProjectArchived.vue +++ b/resources/assets/js/pages/manage/components/ProjectArchived.vue @@ -66,29 +66,7 @@ export default { keys: {}, keyIs: false, - columns: [], - list: [], - - page: 1, - pageSize: 20, - total: 0, - noText: '' - } - }, - mounted() { - this.getLists(); - }, - watch: { - keyIs(v) { - if (!v) { - this.keys = {} - this.setPage(1) - } - } - }, - methods: { - initLanguage() { - this.columns = [ + columns: [ { title: 'ID', key: 'id', @@ -198,9 +176,27 @@ export default { }, vNode); }, } - ] - }, + ], + list: [], + page: 1, + pageSize: 20, + total: 0, + noText: '' + } + }, + mounted() { + this.getLists(); + }, + watch: { + keyIs(v) { + if (!v) { + this.keys = {} + this.setPage(1) + } + } + }, + methods: { onSearch() { this.page = 1; this.getLists(); diff --git a/resources/assets/js/pages/manage/components/ProjectManagement.vue b/resources/assets/js/pages/manage/components/ProjectManagement.vue index 88d90a80c..56fe6ecc7 100644 --- a/resources/assets/js/pages/manage/components/ProjectManagement.vue +++ b/resources/assets/js/pages/manage/components/ProjectManagement.vue @@ -90,29 +90,7 @@ export default { keys: {}, keyIs: false, - columns: [], - list: [], - - page: 1, - pageSize: 20, - total: 0, - noText: '' - } - }, - mounted() { - this.getLists(); - }, - watch: { - keyIs(v) { - if (!v) { - this.keys = {} - this.setPage(1) - } - } - }, - methods: { - initLanguage() { - this.columns = [ + columns: [ { title: 'ID', key: 'id', @@ -195,9 +173,27 @@ export default { key: 'created_at', width: 168, }, - ] - }, + ], + list: [], + page: 1, + pageSize: 20, + total: 0, + noText: '' + } + }, + mounted() { + this.getLists(); + }, + watch: { + keyIs(v) { + if (!v) { + this.keys = {} + this.setPage(1) + } + } + }, + methods: { onSearch() { this.page = 1; this.getLists(); diff --git a/resources/assets/js/pages/manage/components/ReportMy.vue b/resources/assets/js/pages/manage/components/ReportMy.vue index 8d39c3229..517b3258d 100644 --- a/resources/assets/js/pages/manage/components/ReportMy.vue +++ b/resources/assets/js/pages/manage/components/ReportMy.vue @@ -76,37 +76,7 @@ export default { data() { return { loadIng: 0, - columns: [], - lists: [], - listPage: 1, - listTotal: 0, - listPageSize: 20, - noDataText: "数据加载中.....", - - keys: {}, - keyIs: false, - - reportTypeList: [ - {value: "", label: this.$L('全部')}, - {value: "weekly", label: this.$L('周报')}, - {value: "daily", label: this.$L('日报')}, - ], - } - }, - mounted() { - this.getLists(); - }, - watch: { - keyIs(v) { - if (!v) { - this.keys = {} - this.setPage(1) - } - } - }, - methods: { - initLanguage() { - this.columns = [{ + columns: [{ title: this.$L("名称"), key: 'title', sortable: true, @@ -157,9 +127,35 @@ export default { } }); }, - }]; - }, + }], + lists: [], + listPage: 1, + listTotal: 0, + listPageSize: 20, + noDataText: "数据加载中.....", + keys: {}, + keyIs: false, + + reportTypeList: [ + {value: "", label: this.$L('全部')}, + {value: "weekly", label: this.$L('周报')}, + {value: "daily", label: this.$L('日报')}, + ], + } + }, + mounted() { + this.getLists(); + }, + watch: { + keyIs(v) { + if (!v) { + this.keys = {} + this.setPage(1) + } + } + }, + methods: { onSearch() { this.listPage = 1; this.getLists(); diff --git a/resources/assets/js/pages/manage/components/ReportReceive.vue b/resources/assets/js/pages/manage/components/ReportReceive.vue index 2f8dc3099..1de604051 100644 --- a/resources/assets/js/pages/manage/components/ReportReceive.vue +++ b/resources/assets/js/pages/manage/components/ReportReceive.vue @@ -91,40 +91,7 @@ export default { data() { return { loadIng: 0, - columns: [], - lists: [], - listPage: 1, - listTotal: 0, - listPageSize: 20, - noDataText: "数据加载中.....", - - keys: {}, - keyIs: false, - - selectIds: [], - selectAction: '', - - reportTypeList: [ - {value: "", label: this.$L('全部')}, - {value: "weekly", label: this.$L('周报')}, - {value: "daily", label: this.$L('日报')}, - ], - } - }, - mounted() { - this.getLists(); - }, - watch: { - keyIs(v) { - if (!v) { - this.keys = {} - this.setPage(1) - } - } - }, - methods: { - initLanguage() { - this.columns = [{ + columns: [{ type: 'selection', width: 50, align: 'right' @@ -195,9 +162,38 @@ export default { } }); }, - }]; - }, + }], + lists: [], + listPage: 1, + listTotal: 0, + listPageSize: 20, + noDataText: "数据加载中.....", + keys: {}, + keyIs: false, + + selectIds: [], + selectAction: '', + + reportTypeList: [ + {value: "", label: this.$L('全部')}, + {value: "weekly", label: this.$L('周报')}, + {value: "daily", label: this.$L('日报')}, + ], + } + }, + mounted() { + this.getLists(); + }, + watch: { + keyIs(v) { + if (!v) { + this.keys = {} + this.setPage(1) + } + } + }, + methods: { onSearch() { this.listPage = 1; this.getLists(); diff --git a/resources/assets/js/pages/manage/components/TaskArchived.vue b/resources/assets/js/pages/manage/components/TaskArchived.vue index 1ba0b775b..e946a1ce6 100644 --- a/resources/assets/js/pages/manage/components/TaskArchived.vue +++ b/resources/assets/js/pages/manage/components/TaskArchived.vue @@ -72,38 +72,7 @@ export default { keys: {}, keyIs: false, - columns: [], - list: [], - - page: 1, - pageSize: 20, - total: 0, - noText: '' - } - }, - mounted() { - - }, - computed: { - ...mapState(['cacheTasks']) - }, - watch: { - projectId: { - handler() { - this.getLists(); - }, - immediate: true - }, - keyIs(v) { - if (!v) { - this.keys = {} - this.setPage(1) - } - } - }, - methods: { - initLanguage() { - this.columns = [ + columns: [ { title: 'ID', key: 'id', @@ -238,9 +207,36 @@ export default { }, vNodes); } } - ] - }, + ], + list: [], + page: 1, + pageSize: 20, + total: 0, + noText: '' + } + }, + mounted() { + + }, + computed: { + ...mapState(['cacheTasks']) + }, + watch: { + projectId: { + handler() { + this.getLists(); + }, + immediate: true + }, + keyIs(v) { + if (!v) { + this.keys = {} + this.setPage(1) + } + } + }, + methods: { onSearch() { this.page = 1; this.getLists(); diff --git a/resources/assets/js/pages/manage/components/TaskDeleted.vue b/resources/assets/js/pages/manage/components/TaskDeleted.vue index b318b8ae5..594f56c4f 100644 --- a/resources/assets/js/pages/manage/components/TaskDeleted.vue +++ b/resources/assets/js/pages/manage/components/TaskDeleted.vue @@ -72,38 +72,7 @@ export default { keys: {}, keyIs: false, - columns: [], - list: [], - - page: 1, - pageSize: 20, - total: 0, - noText: '' - } - }, - mounted() { - - }, - computed: { - ...mapState(['cacheTasks']) - }, - watch: { - projectId: { - handler() { - this.getLists(); - }, - immediate: true - }, - keyIs(v) { - if (!v) { - this.keys = {} - this.setPage(1) - } - } - }, - methods: { - initLanguage() { - this.columns = [ + columns: [ { title: 'ID', key: 'id', @@ -186,9 +155,36 @@ export default { }, vNodes); } } - ] - }, + ], + list: [], + page: 1, + pageSize: 20, + total: 0, + noText: '' + } + }, + mounted() { + + }, + computed: { + ...mapState(['cacheTasks']) + }, + watch: { + projectId: { + handler() { + this.getLists(); + }, + immediate: true + }, + keyIs(v) { + if (!v) { + this.keys = {} + this.setPage(1) + } + } + }, + methods: { onSearch() { this.page = 1; this.getLists(); diff --git a/resources/assets/js/pages/manage/components/TeamManagement.vue b/resources/assets/js/pages/manage/components/TeamManagement.vue index 019dc4aac..dd4be414d 100644 --- a/resources/assets/js/pages/manage/components/TeamManagement.vue +++ b/resources/assets/js/pages/manage/components/TeamManagement.vue @@ -266,111 +266,7 @@ export default { keys: {}, keyIs: false, - columns: [], - list: [], - - page: 1, - pageSize: 20, - total: 0, - noText: '', - - departmentEditShow: false, - departmentEditLoading: 0, - departmentEditData: {}, - - disableShow: false, - disableLoading: 0, - disableData: {}, - disableOptions: { - shortcuts: [ - { - text: this.$L('12:00'), - value () { - return $A.Date($A.formatDate("Y-m-d 12:00:00")); - }, - onClick: (picker) => { - picker.handlePickSuccess(); - } - }, - { - text: this.$L('17:00'), - value () { - return $A.Date($A.formatDate("Y-m-d 17:00:00")); - }, - onClick: (picker) => { - picker.handlePickSuccess(); - } - }, - { - text: this.$L('18:00'), - value () { - return $A.Date($A.formatDate("Y-m-d 18:00:00")); - }, - onClick: (picker) => { - picker.handlePickSuccess(); - } - }, - { - text: this.$L('19:00'), - value () { - return $A.Date($A.formatDate("Y-m-d 19:00:00")); - }, - onClick: (picker) => { - picker.handlePickSuccess(); - } - }, - { - text: this.$L('现在'), - value () { - return new Date(); - }, - onClick: (picker) => { - picker.handlePickSuccess(); - } - }, - ] - }, - - departmentShow: false, - departmentLoading: 0, - departmentSelect: -1, - departmentData: { - id: 0, - name: '', - parent_id: 0, - owner_userid: [], - dialog_group: 'new', - dialog_useid: 0 - }, - departmentList: [], - - dialogLoad: false, - dialogList: [], - } - }, - mounted() { - this.getLists(); - this.getDepartmentLists(); - }, - watch: { - keyIs(v) { - if (!v) { - this.keys = {} - this.setPage(1) - } - }, - departmentSelect() { - this.setPage(1) - } - }, - computed: { - departmentParentDisabled() { - return !!(this.departmentData.id > 0 && this.departmentList.find(({parent_id}) => parent_id == this.departmentData.id)); - }, - }, - methods: { - initLanguage() { - this.columns = [ + columns: [ { title: 'ID', key: 'userid', @@ -632,9 +528,109 @@ export default { ]); } } - ] - }, + ], + list: [], + page: 1, + pageSize: 20, + total: 0, + noText: '', + + departmentEditShow: false, + departmentEditLoading: 0, + departmentEditData: {}, + + disableShow: false, + disableLoading: 0, + disableData: {}, + disableOptions: { + shortcuts: [ + { + text: this.$L('12:00'), + value () { + return $A.Date($A.formatDate("Y-m-d 12:00:00")); + }, + onClick: (picker) => { + picker.handlePickSuccess(); + } + }, + { + text: this.$L('17:00'), + value () { + return $A.Date($A.formatDate("Y-m-d 17:00:00")); + }, + onClick: (picker) => { + picker.handlePickSuccess(); + } + }, + { + text: this.$L('18:00'), + value () { + return $A.Date($A.formatDate("Y-m-d 18:00:00")); + }, + onClick: (picker) => { + picker.handlePickSuccess(); + } + }, + { + text: this.$L('19:00'), + value () { + return $A.Date($A.formatDate("Y-m-d 19:00:00")); + }, + onClick: (picker) => { + picker.handlePickSuccess(); + } + }, + { + text: this.$L('现在'), + value () { + return new Date(); + }, + onClick: (picker) => { + picker.handlePickSuccess(); + } + }, + ] + }, + + departmentShow: false, + departmentLoading: 0, + departmentSelect: -1, + departmentData: { + id: 0, + name: '', + parent_id: 0, + owner_userid: [], + dialog_group: 'new', + dialog_useid: 0 + }, + departmentList: [], + + dialogLoad: false, + dialogList: [], + } + }, + mounted() { + this.getLists(); + this.getDepartmentLists(); + }, + watch: { + keyIs(v) { + if (!v) { + this.keys = {} + this.setPage(1) + } + }, + departmentSelect() { + this.setPage(1) + } + }, + computed: { + departmentParentDisabled() { + return !!(this.departmentData.id > 0 && this.departmentList.find(({parent_id}) => parent_id == this.departmentData.id)); + }, + }, + methods: { onSearch() { this.page = 1; this.getLists(); diff --git a/resources/assets/js/pages/manage/file.vue b/resources/assets/js/pages/manage/file.vue index b098338df..7442ba547 100644 --- a/resources/assets/js/pages/manage/file.vue +++ b/resources/assets/js/pages/manage/file.vue @@ -512,6 +512,198 @@ export default { } }, + created() { + const sort = $A.getStorageJson("cacheFileSort") + this.columns = [ + { + type: 'selection', + width: 50, + align: 'right' + }, + { + title: this.$L('文件名'), + key: 'name', + minWidth: 300, + sortable: true, + render: (h, {row}) => { + let array = []; + let isCreate = !/^\d+$/.test(row.id); + if (isCreate) { + // 新建 + array.push(h('Input', { + props: { + elementId: 'input_' + row.id, + value: row.newname, + autofocus: true, + disabled: !!row._load, + }, + style: { + width: 'auto' + }, + on: { + 'on-change': (event) => { + row.newname = event.target.value; + }, + 'on-blur': () => { + const file = this.files.find(({id}) => id == row.id); + if (file) { + file.newname = row.newname; + this.onBlur(file) + } + }, + 'on-enter': () => { + const file = this.files.find(({id}) => id == row.id); + if (file) { + file.newname = row.newname; + this.onEnter(file) + } + } + } + })) + return h('div', { + class: 'file-nbox' + }, [ + h('div', { + class: `no-dark-before file-name file-icon ${row.type}`, + }, array), + ]); + } else { + // 编辑、查看 + array.push(h('QuickEdit', { + props: { + value: row.name, + autoEdit: !!row._edit, + clickOutSide: false, + }, + on: { + 'on-edit-change': (b) => { + const file = this.files.find(({id}) => id == row.id); + if (file) { + setTimeout(() => { + this.setEdit(file.id, b) + }, 100); + } + }, + 'on-update': (val, cb) => { + const file = this.files.find(({id}) => id == row.id); + if (file) { + file.newname = val + this.onEnter(file); + } + cb(); + } + } + }, [ + h('AutoTip', { + props: { + placement: 'right' + } + }, $A.getFileName(row)) + ])); + // + const iconArray = []; + if (row.share) { + if (row.userid != this.userId) { + iconArray.push(h('UserAvatar', { + props: { + userid: row.userid, + size: 20 + }, + })) + } else { + iconArray.push(h('i', { + class: 'taskfont', + domProps: { + innerHTML: '' + }, + })) + } + } else if (this.isParentShare) { + iconArray.push(h('UserAvatar', { + props: { + userid: row.created_id, + size: 20 + }, + }, [ + row.created_id != row.userid ? h('p', [h('strong', this.$L('成员创建于') + ": " + row.created_at)]) : h('p', this.$L('所有者创建') + ": " + row.created_at) + ])) + } + const shearClass = this.shearIds.includes(row.id) ? ' shear' : ''; + const shareClass = row.share ? ' share' : ''; + return h('div', { + class: `file-nbox${shearClass}`, + attrs: { + 'data-id': row.id + } + }, [ + h('div', { + class: `no-dark-before file-name file-icon ${row.type}${shareClass}`, + }, array), + iconArray + ]); + } + } + }, + { + title: this.$L('大小'), + key: 'size', + width: 110, + resizable: true, + sortable: true, + render: (h, {row}) => { + if (row.type == 'folder') { + return h('div', '-') + } + return h('AutoTip', $A.bytesToSize(row.size)); + } + }, + { + title: this.$L('类型'), + key: 'type', + width: 110, + resizable: true, + sortable: true, + render: (h, {row}) => { + let type = this.types.find(({value, name}) => value == row.type && name); + if (type) { + return h('AutoTip', this.$L(type.name)); + } else { + return h('div', (row.ext || row.type).toUpperCase()) + } + } + }, + { + title: this.$L('所有者'), + key: 'userid', + width: 130, + resizable: true, + sortable: true, + render: (h, {row}) => { + return h('UserAvatar', { + props: { + size: 18, + userid: row.userid, + showIcon: false, + showName: true, + } + }); + } + }, + { + title: this.$L('最后修改'), + key: 'updated_at', + width: 168, + resizable: true, + sortable: true, + }, + ].map(item => { + if (item.key === sort.key) { + item.sortType = sort.order + } + return item; + }); + }, + mounted() { if (!this.tableMode && this.$isEEUiApp) { this.tableMode = 'block'; @@ -702,198 +894,6 @@ export default { }, methods: { - initLanguage() { - const sort = $A.getStorageJson("cacheFileSort") - this.columns = [ - { - type: 'selection', - width: 50, - align: 'right' - }, - { - title: this.$L('文件名'), - key: 'name', - minWidth: 300, - sortable: true, - render: (h, {row}) => { - let array = []; - let isCreate = !/^\d+$/.test(row.id); - if (isCreate) { - // 新建 - array.push(h('Input', { - props: { - elementId: 'input_' + row.id, - value: row.newname, - autofocus: true, - disabled: !!row._load, - }, - style: { - width: 'auto' - }, - on: { - 'on-change': (event) => { - row.newname = event.target.value; - }, - 'on-blur': () => { - const file = this.files.find(({id}) => id == row.id); - if (file) { - file.newname = row.newname; - this.onBlur(file) - } - }, - 'on-enter': () => { - const file = this.files.find(({id}) => id == row.id); - if (file) { - file.newname = row.newname; - this.onEnter(file) - } - } - } - })) - return h('div', { - class: 'file-nbox' - }, [ - h('div', { - class: `no-dark-before file-name file-icon ${row.type}`, - }, array), - ]); - } else { - // 编辑、查看 - array.push(h('QuickEdit', { - props: { - value: row.name, - autoEdit: !!row._edit, - clickOutSide: false, - }, - on: { - 'on-edit-change': (b) => { - const file = this.files.find(({id}) => id == row.id); - if (file) { - setTimeout(() => { - this.setEdit(file.id, b) - }, 100); - } - }, - 'on-update': (val, cb) => { - const file = this.files.find(({id}) => id == row.id); - if (file) { - file.newname = val - this.onEnter(file); - } - cb(); - } - } - }, [ - h('AutoTip', { - props: { - placement: 'right' - } - }, $A.getFileName(row)) - ])); - // - const iconArray = []; - if (row.share) { - if (row.userid != this.userId) { - iconArray.push(h('UserAvatar', { - props: { - userid: row.userid, - size: 20 - }, - })) - } else { - iconArray.push(h('i', { - class: 'taskfont', - domProps: { - innerHTML: '' - }, - })) - } - } else if (this.isParentShare) { - iconArray.push(h('UserAvatar', { - props: { - userid: row.created_id, - size: 20 - }, - }, [ - row.created_id != row.userid ? h('p', [h('strong', this.$L('成员创建于') + ": " + row.created_at)]) : h('p', this.$L('所有者创建') + ": " + row.created_at) - ])) - } - const shearClass = this.shearIds.includes(row.id) ? ' shear' : ''; - const shareClass = row.share ? ' share' : ''; - return h('div', { - class: `file-nbox${shearClass}`, - attrs: { - 'data-id': row.id - } - }, [ - h('div', { - class: `no-dark-before file-name file-icon ${row.type}${shareClass}`, - }, array), - iconArray - ]); - } - } - }, - { - title: this.$L('大小'), - key: 'size', - width: 110, - resizable: true, - sortable: true, - render: (h, {row}) => { - if (row.type == 'folder') { - return h('div', '-') - } - return h('AutoTip', $A.bytesToSize(row.size)); - } - }, - { - title: this.$L('类型'), - key: 'type', - width: 110, - resizable: true, - sortable: true, - render: (h, {row}) => { - let type = this.types.find(({value, name}) => value == row.type && name); - if (type) { - return h('AutoTip', this.$L(type.name)); - } else { - return h('div', (row.ext || row.type).toUpperCase()) - } - } - }, - { - title: this.$L('所有者'), - key: 'userid', - width: 130, - resizable: true, - sortable: true, - render: (h, {row}) => { - return h('UserAvatar', { - props: { - size: 18, - userid: row.userid, - showIcon: false, - showName: true, - } - }); - } - }, - { - title: this.$L('最后修改'), - key: 'updated_at', - width: 168, - resizable: true, - sortable: true, - }, - ].map(item => { - if (item.key === sort.key) { - item.sortType = sort.order - } - return item; - }); - }, - getFileList() { if (this.$route.name !== 'manage-file') { return; diff --git a/resources/assets/js/pages/manage/setting/language.vue b/resources/assets/js/pages/manage/setting/language.vue index cdc8298ad..fd41fbfb7 100644 --- a/resources/assets/js/pages/manage/setting/language.vue +++ b/resources/assets/js/pages/manage/setting/language.vue @@ -16,6 +16,7 @@