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

合并分支 'zax' 到 'master'

Zax 查看合并请求 !40
......@@ -66,7 +66,8 @@ export default {
productList: [],
text: '',
producer: '',
authority: true
authority: true,
id: ''
}
},
created() {
......@@ -83,6 +84,7 @@ export default {
this.form = String(this.productList.form);
this.model = this.productList.model;
this.producer = this.productList.producer;
this.id = this.productList.id;
this.text = '产品信息修改'
} else {
this.text = '产品新增'
......@@ -103,19 +105,33 @@ export default {
name: this.name,
producer: this.producer,
status: parseInt(this.status),
techId: 0,
techId: '',
id: this.id,
type: parseInt(this.type)
};
this.$server.postProduceAdd(data).then(res => {
if (res.data.code === 200) {
this.$message.success(this.text + '成功!');
this.$emit('on-cancel', true)
} else {
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 + '失败!');
}
}).catch(err => {
this.$message.error(this.text + '失败!');
})
})
} else {
this.$server.postProduceAdd(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 + '失败!');
})
}
}
},
components: {
......
......@@ -53,10 +53,12 @@
align="center">
</el-table-column>>
<el-table-column
:formatter="techIdChange"
prop="techId"
label="技术路线"
align="center">
<template slot-scope="scope">
<span v-if="scope.row.tech !== null">{{scope.row.tech.name}}</span>
</template>
</el-table-column>
</el-table>
</div>
......@@ -133,18 +135,6 @@ export default {
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) {
return this.formVal[row.form]
......
......@@ -65,7 +65,8 @@ export default {
form: '',
productList: [],
text: '',
producer: ''
producer: '',
id: ''
}
},
created() {
......@@ -79,6 +80,7 @@ export default {
this.form = String(this.productList.form);
this.model = this.productList.model;
this.producer = this.productList.producer;
this.id = this.productList.id;
this.text = '产品信息修改'
} else {
this.text = '产品新增'
......@@ -99,19 +101,34 @@ export default {
name: this.name,
producer: this.producer,
status: parseInt(this.status),
techId: 0,
techId: '',
id: this.id,
type: parseInt(this.type)
};
this.$server.postProduceAdd(data).then(res => {
if (res.data.code === 200) {
this.$message.success(this.text + '成功!');
this.$emit('on-cancel', true)
} else {
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 + '失败!');
}
}).catch(err => {
this.$message.error(this.text + '失败!');
})
})
} else {
this.$server.postProduceAdd(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 + '失败!');
})
}
}
},
components: {
......
......@@ -69,9 +69,12 @@
align="center">
</el-table-column>
<el-table-column
prop="tech.name"
prop="tech"
label="技术路线"
align="center">
<template slot-scope="scope">
<span v-if="scope.row.tech !== null">{{scope.row.tech.name}}</span>
</template>
</el-table-column>
</el-table>
</div>
......@@ -152,18 +155,6 @@ export default {
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) {
return this.formVal[row.form]
......
import Vue from 'vue'
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'
Vue.use(Row);
Vue.use(Col);
......@@ -26,3 +26,4 @@ Vue.use(Radio);
Vue.use(RadioGroup);
Vue.use(Upload);
Vue.use(DatePicker);
Vue.use(Checkbox);
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论