shelfSettleType.js 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  1. import { productTypeQuery } from '@/api/productType'
  2. const ProductType = {
  3. template: `
  4. <a-cascader
  5. @change="handleChange"
  6. change-on-select
  7. :value="defaultVal"
  8. expand-trigger="hover"
  9. :options="productTypeList"
  10. :fieldNames="{ label: 'productTypeName', value: 'productTypeSn', children: 'children' }"
  11. :id="id"
  12. placeholder="请选择结算方式"
  13. allowClear />
  14. `,
  15. props: {
  16. value: {
  17. type: Array,
  18. defatut: function () {
  19. return []
  20. }
  21. },
  22. id: {
  23. type: String,
  24. default: ''
  25. }
  26. },
  27. data () {
  28. return {
  29. defaultVal: this.value,
  30. productTypeList: []
  31. }
  32. },
  33. watch: {
  34. value (newValue, oldValue) {
  35. this.defaultVal = newValue
  36. }
  37. },
  38. mounted () {
  39. this.getProductType()
  40. },
  41. methods: {
  42. handleChange (value) {
  43. this.defaultVal = value
  44. this.$emit('change', this.defaultVal)
  45. },
  46. // 产品分类列表
  47. getProductType () {
  48. productTypeQuery({}).then(res => {
  49. if (res.status == 200) {
  50. this.productTypeList = res.data
  51. } else {
  52. this.productTypeList = []
  53. }
  54. })
  55. }
  56. }
  57. }
  58. export default ProductType