IndexEdit.vue 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118
  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="700px"
  11. custom-class="xl-dialog"
  12. center
  13. >
  14. <base-form ref="ruleForm" class="lib-edit" :data="formData" :is-inline="false" label-width="110px">
  15. <div slot="footer" style="padding-top: 20px;">
  16. <el-button class="xl-form-btn t2" @click="close">关 闭</el-button>
  17. <el-button class="xl-form-btn t1" @click="close('confirm')">确定</el-button>
  18. </div>
  19. </base-form>
  20. </el-dialog>
  21. </div>
  22. </template>
  23. <script>
  24. export default {
  25. components: { },
  26. mixins,
  27. props: {
  28. isShow: Boolean,
  29. curObj: Object
  30. },
  31. inject: ['parentData'],
  32. data() {
  33. return {
  34. formData: [],
  35. loading: true,
  36. cObj: {},
  37. isShowMap: false
  38. }
  39. },
  40. watch: {
  41. isShow: function(val) {
  42. if (val) {
  43. if (val) {
  44. if (this.curObj.id) {
  45. this.$api.house.admlanddetail({id: this.curObj.id}).then(res => {
  46. let curData = res || {}
  47. this.cObj = curData || {}
  48. this.getDef()
  49. })
  50. } else {
  51. this.cObj = this.curObj
  52. this.getDef()
  53. }
  54. }
  55. }
  56. },
  57. },
  58. methods: {
  59. getDef() {
  60. const params = { ...this.cObj }
  61. this.formData = [
  62. { label: '地块编号', key: 'no', class: 'c-2' },
  63. { label: '区域', key: 'area_type', type: 'select', class: 'c-2', options: this.$dictData.area_type },
  64. { label: '竞得单位', key: 'company', class: 'c-2' },
  65. { label: '成交日期', key: 'deal_time', class: 'c-2', type: 'datePicker', type2: 'date'},
  66. { label: '成交总价', key: 'final_price', class: 'c-2', type: 'inputFont', appendFont: '万元'},
  67. { label: '成交楼面价', key: 'floor_price', class: 'c-2', type: 'inputFont', appendFont: '元' },
  68. { label: '起拍总价', key: 'start_total_price', class: 'c-2', type: 'inputFont', appendFont: '万元' },
  69. { label: '起拍楼面价', key: 'start_unit_price', class: 'c-2', type: 'inputFont', appendFont: '元' },
  70. { label: '溢价率', key: 'premium_rate', class: 'c-2', type: 'inputFont', appendFont: '%' },
  71. { label: '出让年限', key: 'sell_ownership', class: 'c-2', type: 'inputFont', appendFont: '年' },
  72. { label: '出让面积', key: 'sell_area', class: 'c-2', type: 'inputFont', appendFont: '㎡'},
  73. { label: '建筑面积', key: 'built_area', class: 'c-2', type: 'inputFont', appendFont: '㎡' },
  74. { label: '用途', key: 'purpose', class: 'c-2' },
  75. { label: '容积率', key: 'plot_ratio', class: 'c-2' },
  76. { label: '地块位置', key: 'land_name', class: 'c-2', type: 'textarea' },
  77. { label: '土拍主图', key: 'pri_image', type: 'upload', class: 'c-2' },
  78. ]
  79. this.setDefaultValue(params)
  80. },
  81. close(str) {
  82. if (str === 'confirm') {
  83. this.$refs['ruleForm'].$refs['baseForm'].validate((valid) => {
  84. if (valid) {
  85. const oldform = this.$refs.ruleForm.baseForm
  86. const newForm = { ...oldform }
  87. if (this.curObj.id) newForm.id = this.curObj.id
  88. let apiStr = 'admlandadd'
  89. if (newForm.id) apiStr = 'admlandedit'
  90. this.$api.house[apiStr](newForm).then(data => {
  91. this.$msgs(newForm.id ? '编辑成功' : '新增成功')
  92. this.$emit('close', newForm)
  93. })
  94. }
  95. })
  96. } else {
  97. this.$emit('close')
  98. this.setDefaultValue()
  99. }
  100. }
  101. }
  102. }
  103. </script>
  104. <style lang="scss" scoped>
  105. @import '../../../../styles/libEdit.scss';
  106. .lib-edit {
  107. padding-top: 0;
  108. ::v-deep .el-form-item {
  109. margin-bottom: 10px;
  110. }
  111. ::v-deep .el-date-editor.el-input {
  112. width: 100%;
  113. }
  114. }
  115. ::v-deep .xl-form .el-textarea__inner {
  116. height: 180px;
  117. }
  118. </style>