You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

82 lines
2.1 KiB

4 years ago
  1. <template>
  2. <el-dialog
  3. width="350px"
  4. title="语言"
  5. :close-on-click-modal="false"
  6. :visible.sync="visible">
  7. <el-row v-for="(item,index) in dataList"
  8. :key="item.columnProp"
  9. :label="item.columnLabel"
  10. :prop="item.columnProp">
  11. <el-col :span="4">
  12. </el-col>
  13. <el-col :span="24">
  14. {{ languageList[index].languageCode==item.languageCode?languageList[index].languageName:item.languageCode }}
  15. <el-input v-model="item.languageValue" controls-position="right" style="display:inline"></el-input>
  16. </el-col>
  17. </el-row>
  18. <span slot="footer" class="dialog-footer">
  19. <el-button type="primary" @click="dataFormSubmit()"> {{ buttons.add }}</el-button>
  20. <el-button @click="visible = false" type="primary">{{ buttons.close }}</el-button>
  21. </span>
  22. </el-dialog>
  23. </template>
  24. <script>
  25. import {searchBaseLanguageList, saveBaseObjectLanguageList,searchSysLanguage} from '@/api/sysLanguage.js'
  26. export default {
  27. data() {
  28. return {
  29. visible: false,
  30. dataList: [],
  31. languageList: [],
  32. buttons: {
  33. add: '确认',
  34. close: '关闭',
  35. },
  36. }
  37. },
  38. methods: {
  39. async init(val) {
  40. this.visible = true
  41. await this.getLanguageList()
  42. searchBaseLanguageList(val).then(({data}) => {
  43. this.dataList = data.rows
  44. })
  45. },
  46. // 获取数据列表
  47. getDataList() {
  48. this.dataListLoading = false
  49. },
  50. // 表单提交
  51. dataFormSubmit(val) {
  52. saveBaseObjectLanguageList(this.dataList).then(({data}) => {
  53. if (data.code == 0) {
  54. this.$message.success(data.msg)
  55. this.visible = false
  56. } else {
  57. this.$message.error(data.msg)
  58. }
  59. })
  60. },
  61. // 获取多语言列表
  62. async getLanguageList() {
  63. await searchSysLanguage({ languageCode: this.$i18n.locale}).then(({data}) => {
  64. this.languageList = data.rows
  65. })
  66. },
  67. }
  68. }
  69. </script>
  70. <style lang="scss">
  71. .el-form-item--mini.el-form-item, .el-form-item--small.el-form-item {
  72. margin-bottom: 5px;
  73. }
  74. </style>