1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859 |
- import { productTypeQuery } from '@/api/productType'
- const ProductType = {
- template: `
- <a-cascader
- @change="handleChange"
- change-on-select
- :value="defaultVal"
- expand-trigger="hover"
- :options="productTypeList"
- :fieldNames="{ label: 'productTypeName', value: 'productTypeSn', children: 'children' }"
- :id="id"
- placeholder="请选择结算方式"
- allowClear />
- `,
- props: {
- value: {
- type: Array,
- defatut: function () {
- return []
- }
- },
- id: {
- type: String,
- default: ''
- }
- },
- data () {
- return {
- defaultVal: this.value,
- productTypeList: []
- }
- },
- watch: {
- value (newValue, oldValue) {
- this.defaultVal = newValue
- }
- },
- mounted () {
- this.getProductType()
- },
- methods: {
- handleChange (value) {
- this.defaultVal = value
- this.$emit('change', this.defaultVal)
- },
- // 产品分类列表
- getProductType () {
- productTypeQuery({}).then(res => {
- if (res.status == 200) {
- this.productTypeList = res.data
- } else {
- this.productTypeList = []
- }
- })
- }
- }
- }
- export default ProductType
|