BrokerageEdit.vue 2.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485
  1. <template>
  2. <div>
  3. <el-dialog
  4. v-loading="loading"
  5. :show-close="false"
  6. :close-on-click-modal="false"
  7. :visible.sync="isShow"
  8. :title="curObj.id ? '编辑渠道佣金' : '新增渠道佣金'"
  9. :fullscreen="false"
  10. width="400px"
  11. custom-class="xl-dialog"
  12. center
  13. >
  14. <base-form ref="ruleForm" :data="formData" :is-inline="false" label-width="80px">
  15. </base-form>
  16. <div class="xl-form">
  17. <div class="xl-form-footer">
  18. <el-button class="xl-form-btn t2" @click="close">关 闭</el-button>
  19. <el-button class="xl-form-btn t1" @click="close('confirm')">确定</el-button>
  20. </div>
  21. </div>
  22. </el-dialog>
  23. </div>
  24. </template>
  25. <script>
  26. import { arrToObj } from '@/utils'
  27. export default {
  28. components: { },
  29. mixins,
  30. props: {
  31. isShow: Boolean,
  32. curObj: Object
  33. },
  34. inject: ['parentData'],
  35. data() {
  36. return {
  37. loading: false,
  38. formData: [],
  39. }
  40. },
  41. watch: {
  42. isShow: function(val) {
  43. if (val) {
  44. this.getDef()
  45. }
  46. },
  47. },
  48. methods: {
  49. getDef (str) {
  50. let params = { ...this.curObj }
  51. this.formData = [
  52. { label: '渠道平台', key: 'company', type: 'select', options: this.$dictData.brokerage_company, rules: 1 },
  53. { label: '佣金描述', key: 'brokerage', type: 'textarea', rules: 1 },
  54. { label: '带看材料', key: 'report_visit', type: 'textarea' },
  55. ]
  56. this.setDefaultValue(params)
  57. },
  58. close (str) {
  59. if (str === 'confirm') {
  60. this.$refs['ruleForm'].$refs['baseForm'].validate((valid) => {
  61. if (valid) {
  62. const oldform = this.$refs.ruleForm.baseForm
  63. const newForm = { ...oldform }
  64. newForm.estate_lib_id = this.parentData.searchForm.estate_lib_id
  65. let apiStr = 'admbrokerageadd'
  66. if (this.curObj.id) {
  67. newForm.id = this.curObj.id
  68. apiStr = 'admbrokerageedit'
  69. }
  70. this.$api.house[apiStr](newForm).then(data => {
  71. this.$msgs('操作成功')
  72. this.$emit('close', newForm)
  73. })
  74. }
  75. })
  76. } else {
  77. this.$emit('close')
  78. this.setDefaultValue()
  79. }
  80. },
  81. }
  82. }
  83. </script>
  84. <style lang="scss" scoped>
  85. </style>