123456789101112131415161718192021222324252627282930313233343536373839404142434445464748 |
- import cacheMixin from '@/components/Cache/mx-cache-mixin.js'
- export default {
- mixins: [cacheMixin],
- data() {
- return {
- formTypeList: [],
- formStatusList: [],
- formAuditList: [],
- formTranslateReady: false
- }
- },
- beforeMount() {
- this.loadTranslateForm()
- },
- methods: {
- async loadTranslateForm() {
- this.formTypeList = await this.getFormTypeListByCache()
- this.formStatusList = await this.getFormStatusListByCache()
- this.formAuditList = await this.getFormAuditListByCache()
- this.formTranslateReady = true
- this.translateFormReady()
- },
- translateFormReady() {
- //to be overrided for non-computed needs
- },
- translateForm(item) {
- // 未准备好不翻译
- // TODO: 这里与APP处理有细微差别, 待后续看APP是否也需要照这里调整 22.1.23
- if (!this.formTranslateReady) return
- this.$set(item, 'formTypeName', this.translateFormType(item.formType))
- this.$set(item, 'formStatusName', this.translateFormStatus(item.formStatus))
- this.$set(item, 'formAuditName', this.translateFormAudit(item.formAudit))
- },
- translateFormType(type) {
- const item = this.formTypeList.find(t => t.value == type)
- return item?.label || '未知类型'
- },
- translateFormStatus(status) {
- const item = this.formStatusList.find(s => s.value == status)
- return item?.label || '未知状态'
- },
- translateFormAudit(audit) {
- const item = this.formAuditList.find(a => a.value == audit)
- return item?.label || '未知类型'
- }
- }
- }
|