addHouse.vue 11 KB

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