|
@@ -35,6 +35,21 @@
|
|
|
<el-radio :label="0">否</el-radio>
|
|
|
</el-radio-group>
|
|
|
</el-form-item>
|
|
|
+ <el-form-item label="供应商:" prop="compId">
|
|
|
+ <el-select
|
|
|
+ filterable
|
|
|
+ v-model="brand.compId"
|
|
|
+ @change="handleSupplierChange"
|
|
|
+ placeholder="请选择供应商"
|
|
|
+ >
|
|
|
+ <el-option
|
|
|
+ v-for="item in supplierOptList"
|
|
|
+ :key="item.value"
|
|
|
+ :label="item.label"
|
|
|
+ :value="item.value"
|
|
|
+ ></el-option>
|
|
|
+ </el-select>
|
|
|
+ </el-form-item>
|
|
|
<el-form-item>
|
|
|
<el-button type="primary" @click="onSubmit('brandFrom')">提交</el-button>
|
|
|
<el-button v-if="!isEdit" @click="resetForm('brandFrom')">重置</el-button>
|
|
@@ -45,7 +60,8 @@
|
|
|
<script>
|
|
|
import {createBrand, getBrand, updateBrand} from '@/api/brand'
|
|
|
import SingleUpload from '@/components/Upload/singleUpload'
|
|
|
- console.log('BASE_API',process.env.BASE_API);
|
|
|
+ import {selectCompList} from '@/api/product';
|
|
|
+ // console.log('BASE_API',process.env.BASE_API);
|
|
|
const defaultBrand={
|
|
|
bigPic: '',
|
|
|
brandStory: '',
|
|
@@ -54,7 +70,9 @@
|
|
|
logo: '',
|
|
|
name: '',
|
|
|
showStatus: 1,
|
|
|
- sort: 0
|
|
|
+ sort: 0,
|
|
|
+ compId:'',
|
|
|
+ compName:'',
|
|
|
};
|
|
|
export default {
|
|
|
name: 'BrandDetail',
|
|
@@ -68,6 +86,7 @@
|
|
|
data() {
|
|
|
return {
|
|
|
brand:Object.assign({}, defaultBrand),
|
|
|
+ supplierOptList:[],
|
|
|
rules: {
|
|
|
name: [
|
|
|
{required: true, message: '请输入品牌名称', trigger: 'blur'},
|
|
@@ -76,6 +95,7 @@
|
|
|
logo: [
|
|
|
{required: true, message: '请输入品牌logo', trigger: 'blur'}
|
|
|
],
|
|
|
+ compId: [{required: true, message: '请选择供应商', trigger: 'blur'}],
|
|
|
sort: [
|
|
|
{type: 'number', message: '排序必须为数字'}
|
|
|
],
|
|
@@ -83,6 +103,7 @@
|
|
|
}
|
|
|
},
|
|
|
created() {
|
|
|
+ this.getSupplierOptList();
|
|
|
if (this.isEdit) {
|
|
|
getBrand(this.$route.query.id).then(response => {
|
|
|
this.brand = response.data;
|
|
@@ -92,6 +113,22 @@
|
|
|
}
|
|
|
},
|
|
|
methods: {
|
|
|
+ /** 获取供应商下拉列表 */
|
|
|
+ getSupplierOptList() {
|
|
|
+ selectCompList().then(response => {
|
|
|
+ // console.log("获取供应商下拉列表",response);
|
|
|
+ this.supplierOptList = response.data;
|
|
|
+ });
|
|
|
+ },
|
|
|
+ handleSupplierChange(val) {
|
|
|
+ // this.placeOfProductionId = '';
|
|
|
+ // this.getOriginList(val);
|
|
|
+ let supplierInfoObj = {};
|
|
|
+ supplierInfoObj = this.supplierOptList.find(item => {
|
|
|
+ return item.value === val;
|
|
|
+ });
|
|
|
+ this.brand.compName = supplierInfoObj.label;
|
|
|
+ },
|
|
|
onSubmit(formName) {
|
|
|
this.$refs[formName].validate((valid) => {
|
|
|
if (valid) {
|