Commit 0948b630 authored by 黄卓's avatar 黄卓

选择产品类型和产品

parent cdeb8f0a
......@@ -34,6 +34,14 @@ export function getProduct(id) {
})
}
// 获得产品列表
export function getProductList() {
return request({
url: '/ecw/product/list',
method: 'get'
})
}
// 获得产品分页
export function getProductPage(query) {
return request({
......
......@@ -74,16 +74,16 @@
</el-col>
<el-col :span="12">
<el-form-item label="主营类别" prop="productType">
<el-cascader :options="productTypeList" :props="{label: 'titleZh', value: 'id', lazy: true, lazyLoad}"></el-cascader>
<!-- <el-cascader :options="productTypeList" :props="{label: 'titleZh', value: 'id', lazy: true, lazyLoad}"></el-cascader>-->
<el-row :gutter="10">
<el-col :span="11">
<el-select v-model="form.productType" placeholder="请选择产品类别">
<!-- <el-option label="请选择字典生成" value="" />-->
<el-select v-model="form.productType" placeholder="请选择产品类别" @change="form.productId = ''">
<el-option :label="item.titleZh" :value="item.id" v-for="(item) in productTypeList" :key="item.id"/>
</el-select>
</el-col>
<el-col :span="11">
<el-select v-model="form.productType" placeholder="请选择主营类别">
<!-- <el-option label="请选择字典生成" value="" />-->
<el-select v-model="form.productId" placeholder="请选择">
<el-option :label="item.titleZh" :value="parseInt(item.id)" v-for="(item) in productListFilter" :key="item.id"/>
</el-select>
</el-col>
</el-row>
......@@ -359,6 +359,7 @@ import upload from '@/components/ImageUpload'
import {createCustomer, getCustomer, updateCustomer} from '@/api/ecw/customer'
import {getNodeList} from "@/api/ecw/node"
import { getProductTypeList } from '@/api/ecw/productType'
import { getProductList } from '@/api/ecw/product'
export default {
name: "edit",
......@@ -368,16 +369,20 @@ export default {
created() {
this.customerId = this.$route.params && this.$route.params.customerId;
console.log(this.customerId)
if(!!this.customerId)
this.reset()
if(this.customerId !== '0')
this.getCustomer(this.customerId)
getNodeList().then(r => {
this.nodeList = r.data
})
getProductTypeList().then(r => {
this.productTypeList = r.data
})
getProductList().then(r => {
this.productList = r.data
})
},
data(){
return {
......@@ -402,12 +407,15 @@ export default {
// 网点
nodeList: [],
productTypeList: [],
productList: [],
showLine: false
}
},
methods: {
lazyLoad(node, resolve) {
const r = this.productList.filter((p) => p.typeId === node.value)
console.log(r)
resolve(r)
},
/** 取消按钮 */
cancel() {
......@@ -479,14 +487,17 @@ export default {
this.resetForm("form");
},
getCustomer(id) {
this.reset();
getCustomer(id).then(response => {
this.form = { ...this.form, ...response.data };
this.open = true;
this.title = "修改客户";
});
}
},
computed: {
productListFilter(){
return this.productList.filter((p) => p.typeId === this.form.productType)
}
}
}
</script>
......
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