vue 将编号转换成名字显示
效果:
vue代码:
1 created() { 2 if (this.$route.query.app_id) { 3 this.app_id = this.$route.query.app_id; 4 } 5 this.GetSettings(); 6 this.GetByParams(); 7 }, 8 mounted() { 9 this.GetByParams(); 10 } 11 methods: { 12 //查询 13 GetByParams() { 14 if (this.value && this.value != "") { 15 this.start_time = this.value[0]; 16 this.end_time = this.value[1]; 17 } 18 this.params = { 19 startTime: this.start_time, 20 endTime: this.end_time, 21 keyWord: this.keyWord, 22 typeId: this.typeid, 23 appId: this.app_id, 24 }; 25 GetAppDocBYParams(this.params).then((res) => { 26 if (res.code == 1) { 27 res.data.forEach((element) => { 28 var name; 29 for (var i = 0; i < this.docType.length; i++) { 30 if (element.doc_type == this.docType[i].id) 31 name = this.docType[i].name; 32 } 33 element.doc_type_name = name; 34 }); 35 this.doc = res.data; 36 } else { 37 showTip("error", "查询失败"); 38 } 39 }); 40 } 41 }