mirror of https://github.com/veops/cmdb.git
fix i18n
This commit is contained in:
parent
2209d06d69
commit
0b08d85472
|
@ -44,13 +44,11 @@ export function writeExcel (columns, name) {
|
||||||
|
|
||||||
// Determines whether an array element is empty
|
// Determines whether an array element is empty
|
||||||
export function any (ArrayList) {
|
export function any (ArrayList) {
|
||||||
let flag = false
|
for (let i = 0; i < ArrayList.length; i++) {
|
||||||
ArrayList.forEach(item => {
|
if (ArrayList[i]) {
|
||||||
if (item) {
|
return true
|
||||||
flag = true
|
}
|
||||||
return flag
|
|
||||||
}
|
}
|
||||||
})
|
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -28,16 +28,15 @@ router.beforeEach((to, from, next) => {
|
||||||
.then(res => {
|
.then(res => {
|
||||||
const roles = res.result && res.result.role
|
const roles = res.result && res.result.role
|
||||||
store.dispatch('GenerateRoutes', { roles }).then(() => {
|
store.dispatch('GenerateRoutes', { roles }).then(() => {
|
||||||
// 根据roles权限生成可访问的路由表
|
// Generate an accessible routing table based on the roles permissions
|
||||||
// 动态添加可访问路由表
|
// Dynamically add accessible routing tables
|
||||||
router.addRoutes(store.getters.addRouters)
|
router.addRoutes(store.getters.addRouters)
|
||||||
|
|
||||||
const redirect = decodeURIComponent(from.query.redirect || to.path)
|
const redirect = decodeURIComponent(from.query.redirect || to.path)
|
||||||
if (to.path === redirect) {
|
if (to.path === redirect) {
|
||||||
// hack方法 确保addRoutes已完成 ,set the replace: true so the navigation will not leave a history record
|
// set the replace: true so the navigation will not leave a history record
|
||||||
next({ ...to, replace: true })
|
next({ ...to, replace: true })
|
||||||
} else {
|
} else {
|
||||||
// 跳转到目的路由
|
// Jump to destination route
|
||||||
next({ path: redirect })
|
next({ path: redirect })
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
@ -45,8 +44,8 @@ router.beforeEach((to, from, next) => {
|
||||||
.catch((e) => {
|
.catch((e) => {
|
||||||
console.log(e)
|
console.log(e)
|
||||||
notification.error({
|
notification.error({
|
||||||
message: '错误',
|
message: this.$t('tip.error'),
|
||||||
description: '请求用户信息失败,请重试'
|
description: 'Failed to request user information. Please try again!'
|
||||||
})
|
})
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
store.dispatch('Logout')
|
store.dispatch('Logout')
|
||||||
|
|
|
@ -44,7 +44,7 @@ export default {
|
||||||
this.upload2Server()
|
this.upload2Server()
|
||||||
},
|
},
|
||||||
computed: {
|
computed: {
|
||||||
mpercent () {
|
mPercent () {
|
||||||
return Math.round(this.complete / this.total * 10000) / 100
|
return Math.round(this.complete / this.total * 10000) / 100
|
||||||
},
|
},
|
||||||
progressStatus () {
|
progressStatus () {
|
||||||
|
|
|
@ -389,7 +389,7 @@ export default {
|
||||||
columns.push({
|
columns.push({
|
||||||
title: this.$t('tip.operate'),
|
title: this.$t('tip.operate'),
|
||||||
key: 'operation',
|
key: 'operation',
|
||||||
width: 100,
|
width: 115,
|
||||||
fixed: 'right',
|
fixed: 'right',
|
||||||
scopedSlots: { customRender: 'action' }
|
scopedSlots: { customRender: 'action' }
|
||||||
})
|
})
|
||||||
|
|
|
@ -79,6 +79,7 @@
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
|
import i18n from '@/locales'
|
||||||
import DescriptionList from '@/components/DescriptionList'
|
import DescriptionList from '@/components/DescriptionList'
|
||||||
|
|
||||||
import { getCITypeGroupById } from '@/api/cmdb/CIType'
|
import { getCITypeGroupById } from '@/api/cmdb/CIType'
|
||||||
|
@ -184,9 +185,9 @@ export default {
|
||||||
filters: {
|
filters: {
|
||||||
operateTypeFilter (operateType) {
|
operateTypeFilter (operateType) {
|
||||||
const operateTypeMap = {
|
const operateTypeMap = {
|
||||||
'0': this.$t('button.add'),
|
'0': i18n.t('button.add'),
|
||||||
'1': this.$t('button.delete'),
|
'1': i18n.t('button.delete'),
|
||||||
'2': this.$t('button.update')
|
'2': i18n.t('button.update')
|
||||||
}
|
}
|
||||||
return operateTypeMap[operateType]
|
return operateTypeMap[operateType]
|
||||||
}
|
}
|
||||||
|
|
|
@ -346,7 +346,6 @@ export default {
|
||||||
scrollX += columns[i].width
|
scrollX += columns[i].width
|
||||||
}
|
}
|
||||||
this.columns = columns
|
this.columns = columns
|
||||||
|
|
||||||
this.scrollX = scrollX
|
this.scrollX = scrollX
|
||||||
this.scrollY = window.innerHeight - this.$refs.table.$el.offsetTop - 300
|
this.scrollY = window.innerHeight - this.$refs.table.$el.offsetTop - 300
|
||||||
},
|
},
|
||||||
|
@ -424,14 +423,17 @@ export default {
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style lang='less'>
|
<style lang='less' scoped>
|
||||||
.ant-menu-horizontal {
|
/deep/ .ant-table-thead > tr > th,
|
||||||
|
/deep/ .ant-table-tbody > tr > td {
|
||||||
|
white-space: nowrap;
|
||||||
|
overflow: hidden;
|
||||||
|
}
|
||||||
|
|
||||||
|
/deep/ .ant-menu-horizontal {
|
||||||
border-bottom: 1px solid #ebedf0 !important;
|
border-bottom: 1px solid #ebedf0 !important;
|
||||||
}
|
}
|
||||||
.ant-menu-horizontal {
|
/deep/ .relation-card > .ant-card-body {
|
||||||
border-bottom: 1px solid #ebedf0 !important;
|
|
||||||
}
|
|
||||||
.relation-card > .ant-card-body {
|
|
||||||
padding-top: 0 !important;
|
padding-top: 0 !important;
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|
|
@ -244,11 +244,14 @@ export default {
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style scoped>
|
<style lang='less' scoped>
|
||||||
.ant-menu-horizontal {
|
/deep/ .ant-table-thead > tr > th,
|
||||||
border-bottom: 1px solid #ebedf0 !important;
|
/deep/ .ant-table-tbody > tr > td {
|
||||||
|
white-space: nowrap;
|
||||||
|
overflow: hidden;
|
||||||
}
|
}
|
||||||
.ant-menu-horizontal {
|
|
||||||
|
/deep/ .ant-menu-horizontal {
|
||||||
border-bottom: 1px solid #ebedf0 !important;
|
border-bottom: 1px solid #ebedf0 !important;
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|
|
@ -1258,6 +1258,40 @@ LOCK TABLES `c_value_integers` WRITE;
|
||||||
/*!40000 ALTER TABLE `c_value_integers` ENABLE KEYS */;
|
/*!40000 ALTER TABLE `c_value_integers` ENABLE KEYS */;
|
||||||
UNLOCK TABLES;
|
UNLOCK TABLES;
|
||||||
|
|
||||||
|
--
|
||||||
|
-- Table structure for table `c_value_json`
|
||||||
|
--
|
||||||
|
|
||||||
|
DROP TABLE IF EXISTS `c_value_json`;
|
||||||
|
/*!40101 SET @saved_cs_client = @@character_set_client */;
|
||||||
|
/*!40101 SET character_set_client = utf8 */;
|
||||||
|
CREATE TABLE `c_value_json` (
|
||||||
|
`deleted_at` datetime DEFAULT NULL,
|
||||||
|
`deleted` tinyint(1) DEFAULT NULL,
|
||||||
|
`created_at` datetime DEFAULT NULL,
|
||||||
|
`updated_at` datetime DEFAULT NULL,
|
||||||
|
`id` int(11) NOT NULL AUTO_INCREMENT,
|
||||||
|
`ci_id` int(11) NOT NULL,
|
||||||
|
`attr_id` int(11) NOT NULL,
|
||||||
|
`value` json NOT NULL,
|
||||||
|
PRIMARY KEY (`id`),
|
||||||
|
KEY `ci_id` (`ci_id`),
|
||||||
|
KEY `attr_id` (`attr_id`),
|
||||||
|
KEY `ix_c_value_json_deleted` (`deleted`),
|
||||||
|
CONSTRAINT `c_value_json_ibfk_1` FOREIGN KEY (`ci_id`) REFERENCES `c_cis` (`id`),
|
||||||
|
CONSTRAINT `c_value_json_ibfk_2` FOREIGN KEY (`attr_id`) REFERENCES `c_attributes` (`id`)
|
||||||
|
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
||||||
|
/*!40101 SET character_set_client = @saved_cs_client */;
|
||||||
|
|
||||||
|
--
|
||||||
|
-- Dumping data for table `c_value_json`
|
||||||
|
--
|
||||||
|
|
||||||
|
LOCK TABLES `c_value_json` WRITE;
|
||||||
|
/*!40000 ALTER TABLE `c_value_json` DISABLE KEYS */;
|
||||||
|
/*!40000 ALTER TABLE `c_value_json` ENABLE KEYS */;
|
||||||
|
UNLOCK TABLES;
|
||||||
|
|
||||||
--
|
--
|
||||||
-- Table structure for table `c_value_texts`
|
-- Table structure for table `c_value_texts`
|
||||||
--
|
--
|
||||||
|
@ -1345,4 +1379,4 @@ UNLOCK TABLES;
|
||||||
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
|
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
|
||||||
/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */;
|
/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */;
|
||||||
|
|
||||||
-- Dump completed on 2020-02-06 13:40:37
|
-- Dump completed on 2020-02-23 18:39:52
|
||||||
|
|
File diff suppressed because one or more lines are too long
Loading…
Reference in New Issue