| | |
| | | </div> |
| | | </el-form> --> |
| | | |
| | | <el-table :data="tableData" style="width: 100%;" height="590"> |
| | | <el-table :data="localizedRoles" style="width: 100%;" height="590"> |
| | | <el-table-column prop="id" label="id" width="80"> |
| | | </el-table-column> |
| | | <el-table-column prop="content" label="content"> |
| | |
| | | |
| | | <script > |
| | | import { setAll } from "../../api/alarm"; |
| | | import LanguageMixin from '../../lang/LanguageMixin' |
| | | let socket; |
| | | export default { |
| | | name: "alarm", |
| | | mixins: [LanguageMixin], |
| | | data () { |
| | | return { |
| | | record: { |
| | |
| | | // xyData: [], |
| | | |
| | | }, |
| | | tableData: [], |
| | | |
| | | roles: [], |
| | | localizedRoles:[], |
| | | messagepack: { |
| | | data: { taskname: "" } |
| | | }, |
| | |
| | | created () { |
| | | this.init(); |
| | | this.load(); |
| | | |
| | | }, |
| | | methods: { |
| | | load () { |
| | | setAll().then(res => { |
| | | this.tableData = res.data.list; |
| | | //console.log(this.tableData); |
| | | |
| | | }); |
| | | }, |
| | | load() { |
| | | setAll().then(res => { |
| | | this.roles = res.data.list; |
| | | const language = this.$i18n.locale; |
| | | if (language === 'zh-CN') { |
| | | this.replaceChineseWithEnglish(); |
| | | } else { |
| | | this.localizedRoles = [...this.roles]; |
| | | } |
| | | console.log(this.localizedRoles); |
| | | }); |
| | | }, |
| | | replaceChineseWithEnglish() { |
| | | const translation = this.$t('translation'); |
| | | this.localizedRoles = this.roles.map(role => ({ |
| | | ...role, |
| | | content: translation[role.content] || role.content |
| | | })); |
| | | }, |
| | | init () { |
| | | let viewname = "alarm"; |
| | | |