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

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

@ -5,10 +5,12 @@
<el-input v-model="dataForm.fileName"></el-input> <el-input v-model="dataForm.fileName"></el-input>
</el-form-item> </el-form-item>
<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-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>
<el-form-item> <el-form-item>
<download-excel <download-excel
@ -23,11 +25,12 @@
:before-finish="finishDownload" :before-finish="finishDownload"
worksheet="导出信息" worksheet="导出信息"
class="el-button el-button--primary el-button--medium"> class="el-button el-button--primary el-button--medium">
{{ buttons.download }}
{{ buttons.download || '导出' }}
</download-excel> </download-excel>
</el-form-item> </el-form-item>
<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-item>
</el-form> </el-form>
<el-table <el-table
@ -54,9 +57,10 @@
width="150" width="150"
label="操作"> label="操作">
<template slot-scope="scope"> <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 @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> </template>
</el-table-column> </el-table-column>
</el-table> </el-table>
@ -80,7 +84,9 @@ import FileList from '../common/file-list'
import FileMenu from './file-menu.vue' import FileMenu from './file-menu.vue'
import axios from "axios"; import axios from "axios";
import Vue from "vue"; import Vue from "vue";
import {
searchFunctionButtonList,
} from "@/api/sysLanguage.js"
export default { export default {
data() { data() {
@ -93,7 +99,14 @@ export default {
fileName: '' fileName: ''
}, },
buttons: { buttons: {
download: '导出'
download: '导出',
search: '查询',
cz: '操作',
upload: '上传',
delete: '删除',
fileDownload: '下载',
deleteList: '批量删除',
helpFileList: '帮助文档',
}, },
dataList: [], dataList: [],
pageIndex: 1, pageIndex: 1,
@ -236,6 +249,20 @@ export default {
}) })
}, },
methods: { 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() { openMenuList() {
this.$nextTick(() => { this.$nextTick(() => {
@ -386,6 +413,9 @@ export default {
}, },
finishDownload() { finishDownload() {
} }
},
created() {
this.getFunctionButtonList()
} }
} }
</script> </script>

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

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

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

@ -2,10 +2,10 @@
<div class="mod-log"> <div class="mod-log">
<el-form :inline="true" :model="dataForm" @keyup.enter.native="getDataList()"> <el-form :inline="true" :model="dataForm" @keyup.enter.native="getDataList()">
<el-form-item> <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-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-item>
</el-form> </el-form>
<el-table <el-table
@ -22,19 +22,19 @@
header-align="center" header-align="center"
align="center" align="center"
width="80" width="80"
label="ID">
:label="buttons.id || 'ID'">
</el-table-column> </el-table-column>
<el-table-column <el-table-column
prop="username" prop="username"
header-align="center" header-align="center"
align="center" align="center"
label="用户名">
:label="buttons.username || '用户名'">
</el-table-column> </el-table-column>
<el-table-column <el-table-column
prop="operation" prop="operation"
header-align="center" header-align="center"
align="center" align="center"
label="用户操作">
:label="buttons.operation || '用户操作'">
</el-table-column> </el-table-column>
<el-table-column <el-table-column
prop="method" prop="method"
@ -42,7 +42,7 @@
align="center" align="center"
width="150" width="150"
:show-overflow-tooltip="true" :show-overflow-tooltip="true"
label="请求方法">
:label="buttons.method || '请求方法'">
</el-table-column> </el-table-column>
<el-table-column <el-table-column
prop="params" prop="params"
@ -50,27 +50,27 @@
align="center" align="center"
width="150" width="150"
:show-overflow-tooltip="true" :show-overflow-tooltip="true"
label="请求参数">
:label="buttons.params || '请求参数'">
</el-table-column> </el-table-column>
<el-table-column <el-table-column
prop="time" prop="time"
header-align="center" header-align="center"
align="center" align="center"
label="执行时长(毫秒)">
:label="buttons.time || '执行时长(毫秒)'">
</el-table-column> </el-table-column>
<el-table-column <el-table-column
prop="ip" prop="ip"
header-align="center" header-align="center"
align="center" align="center"
width="150" width="150"
label="IP地址">
:label="buttons.ip || 'IP地址'">
</el-table-column> </el-table-column>
<el-table-column <el-table-column
prop="createDate" prop="createDate"
header-align="center" header-align="center"
align="center" align="center"
width="180" width="180"
label="创建时间">
:label="buttons.createDate || '创建时间'">
</el-table-column> </el-table-column>
</el-table> </el-table>
<el-pagination <el-pagination
@ -86,102 +86,132 @@
</template> </template>
<script> <script>
import {
searchFunctionButtonList,
} from "@/api/sysLanguage.js"
let rolltimer = '' // 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> </script>
Loading…
Cancel
Save