Browse Source

系统设置多语言 2023年2月13日 sxm

master
[li_she] 3 years ago
parent
commit
23f69d7451
  1. 78
      src/views/modules/oss/file-menu.vue
  2. 46
      src/views/modules/oss/oss.vue
  3. 2
      src/views/modules/sys/config-add-or-update.vue
  4. 228
      src/views/modules/sys/log.vue

78
src/views/modules/oss/file-menu.vue

@ -1,6 +1,6 @@
<template>
<el-dialog
title="菜单列表"
:title="buttons.menuList || '菜单列表'"
@close="close"
:close-on-click-modal="false"
:visible.sync="visible">
@ -15,19 +15,19 @@
prop="name"
header-align="center"
min-width="150"
label="名称">
:label="buttons.name || '名称'">
</el-table-column>
<el-table-column
prop="parentName"
header-align="center"
align="center"
width="120"
label="上级菜单">
:label="buttons.parentName || '上级菜单'">
</el-table-column>
<el-table-column
header-align="center"
align="center"
label="图标">
:label="buttons.icon || '图标'">
<template slot-scope="scope">
<icon-svg :name="scope.row.icon || ''"></icon-svg>
</template>
@ -36,11 +36,12 @@
prop="type"
header-align="center"
align="center"
label="类型">
:label="buttons.type || '类型'">
<template slot-scope="scope">
<el-link v-if="scope.row.type === 0" type="success">目录</el-link>
<el-link v-else-if="scope.row.type === 1" size="small" type="success">菜单</el-link>
<el-link v-else-if="scope.row.type === 2" size="small" type="info">按钮</el-link>
<el-link v-if="scope.row.type === 0" type="success">{{ buttons.type1 || '目录' }}</el-link>
<el-link v-else-if="scope.row.type === 1" size="small" type="success">{{ buttons.type2 || '菜单' }}
</el-link>
<el-link v-else-if="scope.row.type === 2" size="small" type="info">{{ buttons.type3 || '按钮' }}</el-link>
</template>
</el-table-column>
<el-table-column
@ -48,10 +49,10 @@
header-align="center"
align="center"
width="150"
label="操作">
:label="buttons.cz || '操作'">
<template slot-scope="scope">
<a v-if="isAuth('sys:oss:all') && scope.row.type === 1 " type="text" size="small"
@click="helpFileList(scope.row.menuId)">帮助文档</a>
@click="helpFileList(scope.row.menuId)">{{ buttons.helpFileList || '帮助文档' }}</a>
</template>
</el-table-column>
</el-table>
@ -59,15 +60,18 @@
<FileList ref="helpFileList" v-if="helpFileVisible"></FileList>
</div>
<span slot="footer" class="dialog-footer">
<el-button type="primary" @click="visible = false">关闭</el-button>
<el-button type="primary" @click="visible = false">{{ buttons.close || '关闭' }}</el-button>
</span>
</el-dialog>
</template>
<script>
import {
searchFunctionButtonList,
} from "@/api/sysLanguage.js"
import FileList from '../common/file-list'
import { treeDataTranslate } from '@/utils'
import {treeDataTranslate} from '@/utils'
export default {
data() {
return {
@ -75,11 +79,28 @@ export default {
dataForm: {},
dataList: [],
tableHeight: 0,
visible:false,
visible: false,
dataListLoading: false,
addOrUpdateVisible: false,
menuLanguageVisible: false,
helpFileVisible: false,
buttons: {
menuList: '菜单列表',
name: '名称',
cz: '操作',
upload: '上传',
delete: '删除',
fileDownload: '下载',
deleteList: '批量删除',
helpFileList: '帮助文档',
parentName: '上级菜单',
icon: '图标',
type: '类型',
type1: '目录',
type2: '菜单',
type3: '按钮',
close: '关闭'
},
}
},
components: {
@ -90,22 +111,36 @@ export default {
},
mounted() {
this.$nextTick(() => {
this.tableHeight = (window.innerHeight*0.65);
this.tableHeight = (window.innerHeight * 0.65);
})
},
methods: {
init(){
// button
getFunctionButtonList() {
let queryButton = {
functionId: this.$route.meta.menuId,
tableId: '*',
languageCode: this.$i18n.locale,
objectType: 'button'
}
searchFunctionButtonList(queryButton).then(({data}) => {
if (data.code == 0 && data.data) {
this.buttons = data.data
}
})
},
init() {
this.visible = true
this.getDataList()
},
getDataList () {
getDataList() {
this.dataListLoading = true
this.$http({
url: this.$http.adornUrl('/sys/menu/list/'+this.$i18n.locale),
url: this.$http.adornUrl('/sys/menu/list/' + this.$i18n.locale),
method: 'get',
params: this.$http.adornParams()
}).then(({data}) => {
this.dataList = data.filter( item => item.type === 1 && item.menuType === 'pc')
this.dataList = data.filter(item => item.type === 1 && item.menuType === 'pc')
this.dataListLoading = false
})
},
@ -123,9 +158,12 @@ export default {
this.$refs.helpFileList.init(fileMappingDto)
})
},
close(){
close() {
this.dataList = []
}
},
created() {
this.getFunctionButtonList()
}
}
</script>

46
src/views/modules/oss/oss.vue

@ -5,10 +5,12 @@
<el-input v-model="dataForm.fileName"></el-input>
</el-form-item>
<el-form-item>
<el-button type="primary" @click="getDataList()">查询</el-button>
<el-button type="primary" @click="getDataList()"> {{ buttons.search || '查询' }}</el-button>
</el-form-item>
<el-form-item>
<el-button type="danger" @click="deleteHandle()" :disabled="dataListSelections.length <= 0">批量删除</el-button>
<el-button type="danger" @click="deleteHandle()" :disabled="dataListSelections.length <= 0">
{{ buttons.deleteList || '批量删除' }}
</el-button>
</el-form-item>
<el-form-item>
<download-excel
@ -23,11 +25,12 @@
:before-finish="finishDownload"
worksheet="导出信息"
class="el-button el-button--primary el-button--medium">
{{ buttons.download }}
{{ buttons.download || '导出' }}
</download-excel>
</el-form-item>
<el-form-item>
<el-button type="primary" @click="openMenuList()">上传<i class="el-icon-upload el-icon--right"></i></el-button>
<el-button type="primary" @click="openMenuList()">{{ buttons.upload || '上传' }}<i
class="el-icon-upload el-icon--right"></i></el-button>
</el-form-item>
</el-form>
<el-table
@ -54,9 +57,10 @@
width="150"
label="操作">
<template slot-scope="scope">
<a type="text" size="small" @click="deleteHandle(scope.row.id)">删除</a>
<a type="text" size="small" @click="deleteHandle(scope.row.id)">{{ buttons.delete || '删除' }}</a>
<a @click="fileDownload(scope.row)">下载</a>
<a v-if="isAuth('sys:oss:all')" type="text" size="small" @click="helpFileList(scope.row.orderRef1)">帮助文档</a>
<a v-if="isAuth('sys:oss:all')" type="text" size="small" @click="helpFileList(scope.row.orderRef1)">
{{ buttons.helpFileList || '帮助文档' }}</a>
</template>
</el-table-column>
</el-table>
@ -80,7 +84,9 @@ import FileList from '../common/file-list'
import FileMenu from './file-menu.vue'
import axios from "axios";
import Vue from "vue";
import {
searchFunctionButtonList,
} from "@/api/sysLanguage.js"
export default {
data() {
@ -93,7 +99,14 @@ export default {
fileName: ''
},
buttons: {
download: '导出'
download: '导出',
search: '查询',
cz: '操作',
upload: '上传',
delete: '删除',
fileDownload: '下载',
deleteList: '批量删除',
helpFileList: '帮助文档',
},
dataList: [],
pageIndex: 1,
@ -236,6 +249,20 @@ export default {
})
},
methods: {
// button
getFunctionButtonList() {
let queryButton = {
functionId: this.$route.meta.menuId,
tableId: '*',
languageCode: this.$i18n.locale,
objectType: 'button'
}
searchFunctionButtonList(queryButton).then(({data}) => {
if (data.code == 0 && data.data) {
this.buttons = data.data
}
})
},
//
openMenuList() {
this.$nextTick(() => {
@ -386,6 +413,9 @@ export default {
},
finishDownload() {
}
},
created() {
this.getFunctionButtonList()
}
}
</script>

2
src/views/modules/sys/config-add-or-update.vue

@ -120,7 +120,7 @@ export default {
}).then(({data}) => {
if (data && data.code === 0) {
this.$message.success('操作成功')
this.visible = false
this.$emit('refreshDataList')
} else {
this.$message.error(data.msg)

228
src/views/modules/sys/log.vue

@ -2,10 +2,10 @@
<div class="mod-log">
<el-form :inline="true" :model="dataForm" @keyup.enter.native="getDataList()">
<el-form-item>
<el-input v-model="dataForm.key" placeholder="用户名/用户操作" clearable></el-input>
<el-input v-model="dataForm.key" clearable></el-input>
</el-form-item>
<el-form-item>
<el-button @click="getDataList()">查询</el-button>
<el-button type="primary" @click="getDataList()">{{ buttons.search || '查询' }}</el-button>
</el-form-item>
</el-form>
<el-table
@ -22,19 +22,19 @@
header-align="center"
align="center"
width="80"
label="ID">
:label="buttons.id || 'ID'">
</el-table-column>
<el-table-column
prop="username"
header-align="center"
align="center"
label="用户名">
:label="buttons.username || '用户名'">
</el-table-column>
<el-table-column
prop="operation"
header-align="center"
align="center"
label="用户操作">
:label="buttons.operation || '用户操作'">
</el-table-column>
<el-table-column
prop="method"
@ -42,7 +42,7 @@
align="center"
width="150"
:show-overflow-tooltip="true"
label="请求方法">
:label="buttons.method || '请求方法'">
</el-table-column>
<el-table-column
prop="params"
@ -50,27 +50,27 @@
align="center"
width="150"
:show-overflow-tooltip="true"
label="请求参数">
:label="buttons.params || '请求参数'">
</el-table-column>
<el-table-column
prop="time"
header-align="center"
align="center"
label="执行时长(毫秒)">
:label="buttons.time || '执行时长(毫秒)'">
</el-table-column>
<el-table-column
prop="ip"
header-align="center"
align="center"
width="150"
label="IP地址">
:label="buttons.ip || 'IP地址'">
</el-table-column>
<el-table-column
prop="createDate"
header-align="center"
align="center"
width="180"
label="创建时间">
:label="buttons.createDate || '创建时间'">
</el-table-column>
</el-table>
<el-pagination
@ -86,102 +86,132 @@
</template>
<script>
import {
searchFunctionButtonList,
} from "@/api/sysLanguage.js"
let rolltimer = '' //
export default {
data () {
return {
dataForm: {
key: ''
},
dataList: [],
pageIndex: 1,
pageSize: 19,
totalPage: 0,
dataListLoading: false,
selectionDataList: [],
tableHeight: 0,
//
refreshTime: 5,
rollTime: 5,
rollPx: 1,
export default {
data() {
return {
dataForm: {
key: ''
},
dataList: [],
pageIndex: 1,
pageSize: 19,
totalPage: 0,
dataListLoading: false,
selectionDataList: [],
tableHeight: 0,
//
refreshTime: 5,
rollTime: 5,
rollPx: 1,
buttons: {
search: '查询',
id: 'ID',
username: '用户名',
operation: '用户操作',
method: '请求方法',
params: '请求参数',
time: '执行时长(毫秒)',
ip: 'IP地址',
createDate: '创建时间',
},
}
},
created() {
this.getDataList()
this.getFunctionButtonList()
// this.autoRoll()
},
mounted() {
this.$nextTick(() => {
this.tableHeight = window.innerHeight - 170;
//50
})
},
methods: {
// button
getFunctionButtonList() {
let queryButton = {
functionId: this.$route.meta.menuId,
tableId: '*',
languageCode: this.$i18n.locale,
objectType: 'button'
}
searchFunctionButtonList(queryButton).then(({data}) => {
if (data.code == 0 && data.data) {
this.buttons = data.data
}
})
},
created () {
this.getDataList()
this.autoRoll()
//
mouseEnter(time) {
//
// this.autoRoll(true)
},
mounted() {
this.$nextTick(() => {
this.tableHeight = window.innerHeight - 170;
//50
})
//
mouseLeave() {
//
//this.autoRoll()
},
methods: {
//
mouseEnter(time) {
//
// this.autoRoll(true)
},
//
mouseLeave() {
//
//this.autoRoll()
},
//
autoRoll(stop) {
if (stop) {
clearInterval(rolltimer)
return
//
autoRoll(stop) {
if (stop) {
clearInterval(rolltimer)
return
}
// DOM
const table = this.$refs.wt_table
// div
const divData = table.bodyWrapper
//
rolltimer = setInterval(() => {
//
divData.scrollTop = this.decimalUtil.add(Number(divData.scrollTop), Number(this.rollPx))
// (+=)
if (divData.clientHeight + divData.scrollTop >= divData.scrollHeight) {
// table
divData.scrollTop = 0
}
// DOM
const table = this.$refs.wt_table
// div
const divData = table.bodyWrapper
//
rolltimer = setInterval(() => {
//
divData.scrollTop = this.decimalUtil.add(Number(divData.scrollTop),Number(this.rollPx))
// (+=)
if (divData.clientHeight + divData.scrollTop >= divData.scrollHeight) {
// table
divData.scrollTop = 0
}
}, this.rollTime * 10)
},
//
getDataList () {
this.dataListLoading = true
this.$http({
url: this.$http.adornUrl('/sys/log/list'),
method: 'get',
params: this.$http.adornParams({
'page': this.pageIndex,
'limit': this.pageSize,
'key': this.dataForm.key
})
}).then(({data}) => {
if (data && data.code === 0) {
this.dataList = data.page.list
this.totalPage = data.page.totalCount
} else {
this.dataList = []
this.totalPage = 0
}
this.dataListLoading = false
}, this.rollTime * 10)
},
//
getDataList() {
this.dataListLoading = true
this.$http({
url: this.$http.adornUrl('/sys/log/list'),
method: 'get',
params: this.$http.adornParams({
'page': this.pageIndex,
'limit': this.pageSize,
'key': this.dataForm.key
})
},
//
sizeChangeHandle (val) {
this.pageSize = val
this.pageIndex = 1
this.getDataList()
},
//
currentChangeHandle (val) {
this.pageIndex = val
this.getDataList()
}
}).then(({data}) => {
if (data && data.code === 0) {
this.dataList = data.page.list
this.totalPage = data.page.totalCount
} else {
this.dataList = []
this.totalPage = 0
}
this.dataListLoading = false
})
},
//
sizeChangeHandle(val) {
this.pageSize = val
this.pageIndex = 1
this.getDataList()
},
//
currentChangeHandle(val) {
this.pageIndex = val
this.getDataList()
}
}
}
</script>
Loading…
Cancel
Save