Commit e29e12b7 authored by zhouzihao's avatar zhouzihao

fix-项目页面没有正常显示项目类型

parent 6eaf574d
...@@ -50,7 +50,13 @@ ...@@ -50,7 +50,13 @@
<Input v-model="showData.description"></Input> <Input v-model="showData.description"></Input>
</FormItem> </FormItem>
<FormItem label="项目类型"> <FormItem label="项目类型">
<Input v-model="showData.type"></Input> <Select v-model="showData.type" style="width:200px">
<Option
v-for="item in typeList"
:value="item.type_id"
:key="item.type_id"
>{{ item.name }}</Option>
</Select>
</FormItem> </FormItem>
<FormItem label="项目版本"> <FormItem label="项目版本">
<Input v-model="showData.version"></Input> <Input v-model="showData.version"></Input>
...@@ -71,6 +77,7 @@ ...@@ -71,6 +77,7 @@
import MasterPage from "@/components/Master"; import MasterPage from "@/components/Master";
import axios from "axios"; import axios from "axios";
import config from "@/config/configs"; import config from "@/config/configs";
import _ from "lodash";
export default { export default {
components: { components: {
...@@ -108,7 +115,10 @@ export default { ...@@ -108,7 +115,10 @@ export default {
{ {
title: "项目类型", title: "项目类型",
key: "type", key: "type",
width: 100 width: 100,
render: (h, params) => {
return h("span", {}, this.getType(params.row.type));
}
}, },
{ {
title: "项目数据", title: "项目数据",
...@@ -179,7 +189,8 @@ export default { ...@@ -179,7 +189,8 @@ export default {
total: 0, total: 0,
isShow: false, isShow: false,
isAdd: false, isAdd: false,
showData: {} showData: {},
typeList: []
}; };
}, },
methods: { methods: {
...@@ -232,10 +243,26 @@ export default { ...@@ -232,10 +243,26 @@ export default {
pageChange: function(i) { pageChange: function(i) {
this.page = i; this.page = i;
this.getList(); this.getList();
},
getTypeList: function() {
axios
.get(config.serve_url + "/meta/names/")
.then(rs => {
if (rs.status == 200) {
this.typeList = rs.data;
}
})
.catch(err => {
console.log(JSON.stringify(err));
});
},
getType(type_id) {
return _.find(this.typeList, { type_id: type_id }).name;
} }
}, },
mounted: function() { mounted: function() {
this.getList(); this.getList();
this.getTypeList();
} }
}; };
</script> </script>
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment