addHouse.vue 8.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255
  1. <template>
  2. <div>
  3. <div>
  4. <el-row class="handle-box">
  5. <el-col :span="24">
  6. <span class="card_title">房屋信息</span>
  7. <el-button style="float: right" type="text" size="small" @click="handleAdd()">
  8. 去选房
  9. </el-button>
  10. </el-col>
  11. </el-row>
  12. <el-divider />
  13. <el-row class="handle-box">
  14. <el-col :span="24">
  15. <el-table
  16. ref="multipleTable"
  17. v-loading="loading"
  18. :data="AllData"
  19. stripe
  20. row-class-name="g_table_row"
  21. :header-cell-style="{textAlign: 'center'}"
  22. :cell-style="{ textAlign: 'center' }"
  23. @selection-change="handleSelectionChange"
  24. >
  25. <el-table-column
  26. type="selection"
  27. width="55"
  28. />
  29. <el-table-column type="index" label="序号" width="60" />
  30. <el-table-column label="单元/楼栋号" prop="buildName" width="180" />
  31. <el-table-column label="户室号" prop="roomNo" />
  32. <el-table-column label="套内面积(㎡)" prop="actualInternalArea" />
  33. <el-table-column label="建筑面积(㎡)" prop="actualBuildArea" />
  34. <el-table-column label="装修情况" prop="decorationSituationStr" />
  35. <el-table-column label="经办人" prop="createdName" />
  36. <el-table-column label="经办时间" prop="createdAt" />
  37. <el-table-column label="操作" width="180">
  38. <template scope="scope">
  39. <el-button
  40. size="mini"
  41. type="text"
  42. @click="handleDelete(scope.$index)"
  43. >删除
  44. </el-button>
  45. <el-button
  46. size="mini"
  47. type="text"
  48. @click="downLoad(scope.row)"
  49. > 房源确认单下载
  50. </el-button>
  51. </template>
  52. </el-table-column>
  53. </el-table>
  54. </el-col>
  55. </el-row>
  56. <!-- <el-row class="handle-box">-->
  57. <!-- <span>经办时间&nbsp;{{ dataStr }}</span>-->
  58. <!-- </el-row>-->
  59. <!-- <el-row class="handle-box">-->
  60. <!-- <span>经办人&nbsp;{{ username }}</span>-->
  61. <!-- </el-row>-->
  62. </div>
  63. <div style="text-align: right;margin-top: 50px">
  64. <el-button @click="cancel">取 消</el-button>
  65. <el-button v-if="fromAddress!== 'intentionalDepositManagement'" type="primary" @click="confirmSubmit()">提交选房</el-button>
  66. <el-button v-if="fromAddress=== 'intentionalDepositManagement'" type="primary" @click="intentionalDepositConfirmSubmit()">意向金提交选房</el-button>
  67. </div>
  68. <!--选房-->
  69. <el-dialog
  70. :visible.sync="dialogRoomVisible"
  71. :close-on-click-modal="false"
  72. :close-on-press-escape="false"
  73. width="90%"
  74. top="20px"
  75. class="statistic_base"
  76. :append-to-body="true"
  77. :modal-append-to-body="true"
  78. custom-class="tagdialog"
  79. >
  80. <park-room v-if="dialogRoomVisible" ref="parkRoom" @getChildrenData="getChildrenData" />
  81. </el-dialog>
  82. </div>
  83. </template>
  84. <script>
  85. import Base from '@/views/base/base.vue'
  86. import BaseData from '@/views/base/baseData.vue'
  87. import ParkRoom from '@/views/customerManagement/roomChose/roomIndex.vue'
  88. import constant from '@/static/utils/constant'
  89. export default {
  90. name: 'AddHouse',
  91. components: { ParkRoom },
  92. mixins: [Base, BaseData],
  93. props: {
  94. // 确认从哪个页面跳转过来的,这样可以做相应的操作
  95. fromAddress: {
  96. type: String,
  97. default: ''
  98. }
  99. },
  100. data() {
  101. return {
  102. dc_key: ['DECORATION_SITUATION'],
  103. loading: false,
  104. AllData: [],
  105. dialogRoomVisible: false,
  106. customerManagementId: '',
  107. dataStr: '',
  108. username: '',
  109. groupId: '',
  110. discId: ''
  111. }
  112. },
  113. mounted() {
  114. const myDate = new Date()
  115. const dateStr = myDate.getFullYear() + '-' + (myDate.getMonth() + 1) + '-' + myDate.getDate()
  116. const username = this.$common.currUser().username
  117. this.dataStr = dateStr
  118. this.username = username
  119. },
  120. methods: {
  121. initData(data) {
  122. this.initDict(this.dc_key).then(res => {
  123. this.customerManagementId = data.id
  124. this.groupId = data.groupId
  125. this.discId = data.discId
  126. this.getData(data.id)
  127. })
  128. },
  129. handleAdd() {
  130. this.dialogRoomVisible = true
  131. const data = {
  132. level: 2,
  133. nodeId: this.discId
  134. }
  135. // 新vue时调用的方法
  136. this.$nextTick(() => {
  137. this.$refs.parkRoom.initData(data)
  138. })
  139. },
  140. getData: function(val) {
  141. const _this = this
  142. _this.loading = true
  143. _this.AllData = []
  144. const data = {
  145. customerManagementId: val
  146. }
  147. this.baseRequest('listAll', data).then((res) => {
  148. if (res.data) {
  149. res.data.forEach(function(item) {
  150. const json = _this.getItemJson(item)
  151. _this.AllData.push(json)
  152. })
  153. }
  154. _this.loading = false
  155. }).catch(() => {
  156. })
  157. },
  158. getItemJson: function(item) {
  159. item.decorationSituationStr = this.dc_map.DECORATION_SITUATION[item.decorationSituation]
  160. return item
  161. },
  162. confirmSubmit: function() {
  163. if (!this.AllData || this.AllData.length === 0) {
  164. this.$message({
  165. message: '请选择房间',
  166. type: 'warning'
  167. })
  168. }
  169. const data = {
  170. houseIds: this.AllData.map(obj => { return obj.houseId }).join(','),
  171. customerManagementId: this.customerManagementId
  172. }
  173. this.baseRequest('submit', data).then(res => {
  174. if (res.data.code === 200) {
  175. this.$message({
  176. message: '提交成功',
  177. type: 'success'
  178. })
  179. this.cancel()
  180. }
  181. }).catch((err) => {
  182. this.$message({
  183. message: err,
  184. type: 'error'
  185. })
  186. })
  187. },
  188. intentionalDepositConfirmSubmit: function() {
  189. if (!this.AllData) {
  190. if (this.AllData.length === 0) {
  191. this.$message({
  192. message: '请选择房间',
  193. type: 'warning'
  194. })
  195. }
  196. if (this.AllData.length > 1) {
  197. this.$message({
  198. message: '只能选择一个房间',
  199. type: 'warning'
  200. })
  201. }
  202. return
  203. }
  204. const obj = this.AllData[0]
  205. const data = {
  206. houseId: obj.id,
  207. customerManagementId: this.customerManagementId,
  208. buildName: obj.buildName,
  209. roomNo: obj.roomNo
  210. }
  211. this.cancel(data)
  212. },
  213. cancel(data) {
  214. this.$emit('cancel', data)
  215. },
  216. // 删除单个行
  217. handleDelete(index) {
  218. this.AllData.splice(index, 1)
  219. },
  220. downLoad(row) {
  221. // const data = {
  222. // customerManagementId: this.customerManagementId,
  223. // houseId: row.houseId
  224. // }
  225. // const url = constant.BASE_URI + '/RoomSelectionInfoController/download?customerManagementId=' + this.customerManagementId + '&houseId=' + row.houseId
  226. // window.location.href = url
  227. },
  228. getChildrenData(data) {
  229. if (data) {
  230. data.forEach(item => {
  231. item.createdName = this.username
  232. item.createdAt = this.dataStr
  233. })
  234. this.AllData = data
  235. }
  236. this.dialogRoomVisible = false
  237. },
  238. baseRequest(opUrl, postData) {
  239. return this.$channel.globeRequest('RoomSelectionInfoController', opUrl, postData, 'project')
  240. }
  241. }
  242. }
  243. </script>
  244. <style scoped>
  245. </style>