提交 8e38d687 authored 作者: zax's avatar zax

合并分支 'zax' 到 'master'

Zax 查看合并请求 !40
...@@ -66,7 +66,8 @@ export default { ...@@ -66,7 +66,8 @@ export default {
productList: [], productList: [],
text: '', text: '',
producer: '', producer: '',
authority: true authority: true,
id: ''
} }
}, },
created() { created() {
...@@ -83,6 +84,7 @@ export default { ...@@ -83,6 +84,7 @@ export default {
this.form = String(this.productList.form); this.form = String(this.productList.form);
this.model = this.productList.model; this.model = this.productList.model;
this.producer = this.productList.producer; this.producer = this.productList.producer;
this.id = this.productList.id;
this.text = '产品信息修改' this.text = '产品信息修改'
} else { } else {
this.text = '产品新增' this.text = '产品新增'
...@@ -103,9 +105,22 @@ export default { ...@@ -103,9 +105,22 @@ export default {
name: this.name, name: this.name,
producer: this.producer, producer: this.producer,
status: parseInt(this.status), status: parseInt(this.status),
techId: 0, techId: '',
id: this.id,
type: parseInt(this.type) type: parseInt(this.type)
}; };
if ( this.text === '产品信息修改') {
this.$server.putProduceUpdate(data).then(res => {
if (res.data.code === 200) {
this.$message.success(this.text + '成功!');
this.$emit('on-cancel', true)
} else {
this.$message.error(this.text + '失败!');
}
}).catch(err => {
this.$message.error(this.text + '失败!');
})
} else {
this.$server.postProduceAdd(data).then(res => { this.$server.postProduceAdd(data).then(res => {
if (res.data.code === 200) { if (res.data.code === 200) {
this.$message.success(this.text + '成功!'); this.$message.success(this.text + '成功!');
...@@ -117,6 +132,7 @@ export default { ...@@ -117,6 +132,7 @@ export default {
this.$message.error(this.text + '失败!'); this.$message.error(this.text + '失败!');
}) })
} }
}
}, },
components: { components: {
}, },
......
...@@ -53,10 +53,12 @@ ...@@ -53,10 +53,12 @@
align="center"> align="center">
</el-table-column>> </el-table-column>>
<el-table-column <el-table-column
:formatter="techIdChange"
prop="techId" prop="techId"
label="技术路线" label="技术路线"
align="center"> align="center">
<template slot-scope="scope">
<span v-if="scope.row.tech !== null">{{scope.row.tech.name}}</span>
</template>
</el-table-column> </el-table-column>
</el-table> </el-table>
</div> </div>
...@@ -133,18 +135,6 @@ export default { ...@@ -133,18 +135,6 @@ export default {
this.$message.error('数据请求失败!'); this.$message.error('数据请求失败!');
}) })
}, },
// 技术路线值转换
techIdChange (row) {
if (row.techId === null) {
return ''
} else {
this.techList.map(item => {
if (item.id === row.techId) {
return item.name
}
})
}
},
// 产品分类转换 // 产品分类转换
formChange(row) { formChange(row) {
return this.formVal[row.form] return this.formVal[row.form]
......
...@@ -65,7 +65,8 @@ export default { ...@@ -65,7 +65,8 @@ export default {
form: '', form: '',
productList: [], productList: [],
text: '', text: '',
producer: '' producer: '',
id: ''
} }
}, },
created() { created() {
...@@ -79,6 +80,7 @@ export default { ...@@ -79,6 +80,7 @@ export default {
this.form = String(this.productList.form); this.form = String(this.productList.form);
this.model = this.productList.model; this.model = this.productList.model;
this.producer = this.productList.producer; this.producer = this.productList.producer;
this.id = this.productList.id;
this.text = '产品信息修改' this.text = '产品信息修改'
} else { } else {
this.text = '产品新增' this.text = '产品新增'
...@@ -99,9 +101,23 @@ export default { ...@@ -99,9 +101,23 @@ export default {
name: this.name, name: this.name,
producer: this.producer, producer: this.producer,
status: parseInt(this.status), status: parseInt(this.status),
techId: 0, techId: '',
id: this.id,
type: parseInt(this.type) type: parseInt(this.type)
}; };
console.log(data)
if ( this.text === '产品信息修改') {
this.$server.putProduceUpdate(data).then(res => {
if (res.data.code === 200) {
this.$message.success(this.text + '成功!');
this.$emit('on-cancel', true)
} else {
this.$message.error(this.text + '失败!');
}
}).catch(err => {
this.$message.error(this.text + '失败!');
})
} else {
this.$server.postProduceAdd(data).then(res => { this.$server.postProduceAdd(data).then(res => {
if (res.data.code === 200) { if (res.data.code === 200) {
this.$message.success(this.text + '成功!'); this.$message.success(this.text + '成功!');
...@@ -113,6 +129,7 @@ export default { ...@@ -113,6 +129,7 @@ export default {
this.$message.error(this.text + '失败!'); this.$message.error(this.text + '失败!');
}) })
} }
}
}, },
components: { components: {
}, },
......
...@@ -69,9 +69,12 @@ ...@@ -69,9 +69,12 @@
align="center"> align="center">
</el-table-column> </el-table-column>
<el-table-column <el-table-column
prop="tech.name" prop="tech"
label="技术路线" label="技术路线"
align="center"> align="center">
<template slot-scope="scope">
<span v-if="scope.row.tech !== null">{{scope.row.tech.name}}</span>
</template>
</el-table-column> </el-table-column>
</el-table> </el-table>
</div> </div>
...@@ -152,18 +155,6 @@ export default { ...@@ -152,18 +155,6 @@ export default {
this.$message.error('数据请求失败!'); this.$message.error('数据请求失败!');
}) })
}, },
// 技术路线值转换
techIdChange (row) {
if (row.techId === null) {
return ''
} else {
this.techList.map(item => {
if (item.id === row.techId) {
return item.name
}
})
}
},
// 产品分类转换 // 产品分类转换
formChange(row) { formChange(row) {
return this.formVal[row.form] return this.formVal[row.form]
......
import Vue from 'vue' import Vue from 'vue'
import { Row, Col, Carousel, CarouselItem, Scrollbar, Input, Button, Table, TableColumn, Pagination, Dialog, import { Row, Col, Carousel, CarouselItem, Scrollbar, Input, Button, Table, TableColumn, Pagination, Dialog,
Message,Select, Option, Form, FormItem, Radio, RadioGroup, Upload, DatePicker} from 'element-ui' Message,Select, Option, Form, FormItem, Radio, RadioGroup, Upload, DatePicker,Checkbox} from 'element-ui'
import './element-variables.scss' import './element-variables.scss'
Vue.use(Row); Vue.use(Row);
Vue.use(Col); Vue.use(Col);
...@@ -26,3 +26,4 @@ Vue.use(Radio); ...@@ -26,3 +26,4 @@ Vue.use(Radio);
Vue.use(RadioGroup); Vue.use(RadioGroup);
Vue.use(Upload); Vue.use(Upload);
Vue.use(DatePicker); Vue.use(DatePicker);
Vue.use(Checkbox);
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论