index.vue 39 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983
  1. <template>
  2. <div>
  3. <div class="custom-tree-container">
  4. <div class="block-l">
  5. <el-card shadow="hover" style="background: white">
  6. <el-tag class="full space-vertical">当前所选:载体结构</el-tag>
  7. <!-- @node-click="handleDeptNodeClick" -->
  8. <div style="height: 72vh;overflow-y: auto;">
  9. <el-tree
  10. ref="selectTree"
  11. :default-expand-all="false"
  12. :data="DeptTree"
  13. node-key="id"
  14. :indent="deptTreeIndent"
  15. accordion
  16. :expand-on-click-node="expandDeptClick"
  17. :default-expanded-keys="expandedDeptKey"
  18. node-click="(data, node, item) => nodeClick(data, node, item)"
  19. @node-click="getCheckedNodes"
  20. >
  21. <span slot-scope="{ node, data }" class="custom-tree-node">
  22. <span>
  23. <i v-if="data.level == 0" class="el-icon-s-home" />
  24. <i v-else-if="data.level == 1" class="el-icon-menu" />
  25. <i v-else class="el-icon-link" />
  26. {{ node.label }}
  27. </span>
  28. <span v-if="data.level == 0">
  29. <el-link class="space" type="primary" @click="() => unFoldAll()">展开</el-link>
  30. <el-link class="space" type="primary" @click="() => collapseAll()">折叠</el-link>
  31. </span>
  32. </span>
  33. </el-tree>
  34. </div>
  35. </el-card>
  36. </div>
  37. <div class="block-r">
  38. <div style="width: 100%;padding: 10px;background: white;margin-bottom: 10px;">
  39. <el-row class="lineheight20">
  40. <el-col :span="3">
  41. 用途:
  42. </el-col>
  43. <el-col :span="21">
  44. <el-checkbox-group
  45. v-model="roomUse"
  46. >
  47. <el-checkbox
  48. v-for="item in dc_data.HOUSE_USAGE"
  49. :key="item.value"
  50. :label="item.value"
  51. >{{ item.label }}</el-checkbox>
  52. </el-checkbox-group>
  53. </el-col>
  54. </el-row>
  55. <el-row class="lineheight20">
  56. <el-col :span="3">
  57. 装修情况:
  58. </el-col>
  59. <el-col :span="21">
  60. <el-checkbox-group
  61. v-model="decorationSituation"
  62. >
  63. <el-checkbox
  64. v-for="item in dc_data.DECORATION_SITUATION"
  65. :key="item.value"
  66. :label="item.value"
  67. >{{ item.label }}</el-checkbox>
  68. </el-checkbox-group>
  69. </el-col>
  70. </el-row>
  71. <el-row class="lineheight20">
  72. <el-col :span="3">
  73. 可售状态:
  74. </el-col>
  75. <el-col :span="21">
  76. <el-checkbox-group
  77. v-model="saleStatus"
  78. >
  79. <el-checkbox
  80. v-for="item in dc_data.SALE_STATUS"
  81. :key="item.value"
  82. :label="item.value"
  83. >{{ item.label }}</el-checkbox>
  84. </el-checkbox-group>
  85. </el-col>
  86. </el-row>
  87. <el-row class="lineheight20">
  88. <el-col :span="3">
  89. 已售状态:
  90. </el-col>
  91. <el-col :span="21">
  92. <el-checkbox-group
  93. v-model="soldStatus"
  94. >
  95. <el-checkbox
  96. v-for="item in dc_data.SOLD_STATUS"
  97. :key="item.value"
  98. :label="item.value"
  99. >{{ item.label }}</el-checkbox>
  100. </el-checkbox-group>
  101. </el-col>
  102. </el-row>
  103. <el-row class="lineheight20">
  104. <el-col :span="4">
  105. <div style="margin-top: 6px">套内面积(㎡):</div>
  106. </el-col>
  107. <el-col :span="6">
  108. <el-input v-model="queryParam.actualInternalArea" size="small" placeholder="请输入面积" class="ch-input-size" @keyup.enter.native="handleSearch()" />
  109. </el-col>
  110. <el-col :span="4">
  111. <div style="margin-top: 6px">建筑面积(㎡):</div>
  112. </el-col>
  113. <el-col :span="4">
  114. <el-input v-model="queryParam.actualBuildArea" size="small" placeholder="请输入面积" class="ch-input-size" @keyup.enter.native="handleSearch()" />
  115. </el-col>
  116. </el-row>
  117. <el-row class="lineheight20">
  118. <el-col :span="4">
  119. <div style="margin-top: 6px">关键字:</div>
  120. </el-col>
  121. <el-col :span="4">
  122. <el-input v-model="queryParam.roomNo" size="small" placeholder="请输入房号" class="ch-input-size" @keyup.enter.native="handleSearch()" />
  123. </el-col>
  124. </el-row>
  125. <el-row class="lineheight20">
  126. <el-col :span="24">
  127. <el-button size="small" class="ch-button-export" style="float: right; margin-top: 4px" @click="handleExcel"><i class="el-icon-menu" />&nbsp;导出EXCEL</el-button>
  128. <el-button size="small" class="ch-button-export" style="float: right;margin-top: 4px" @click="batchImport()"><i class="el-icon-menu" />&nbsp;批量导入</el-button>
  129. <el-button size="small" class="ch-button-add" style="float: right; margin-right: 10px; margin-top: 4px" @click="handleAdd()"><i class="el-icon-menu" />&nbsp;新增房间</el-button>
  130. <el-button size="small" class="ch-button" style="float: right;margin-top: 4px" @click="handleSearch()"><i class="el-icon-menu" />&nbsp;查询</el-button>
  131. <el-button size="small" class="ch-button-warning" style="float: right;margin-top: 4px" @click="handleReset()"><i class="el-icon-menu" />&nbsp;重置</el-button>
  132. </el-col>
  133. </el-row>
  134. </div>
  135. <el-row class="lineheight20">
  136. <el-col :span="24">
  137. <el-table
  138. ref="singleTable"
  139. v-loading="loading"
  140. :data="AllData"
  141. highlight-current-row
  142. height="300"
  143. @current-change="handleRowSelectChange"
  144. >
  145. <el-table-column label="编号" type="index" width="60" />
  146. <el-table-column label="单元/楼栋号" prop="buildName" />
  147. <el-table-column label="所在层" prop="floor" />
  148. <el-table-column label="户室号" prop="roomNo" />
  149. <el-table-column label="套内面积(㎡)" prop="actualInternalArea" />
  150. <el-table-column label="建筑面积(㎡)" prop="actualBuildArea" />
  151. <el-table-column label="用途" prop="roomUseStr" />
  152. <el-table-column label="装修情况" prop="decorationSituationStr" />
  153. <el-table-column label="可售状态" prop="saleStatusStr" />
  154. <el-table-column label="已售状态" prop="soldStatusStr" />
  155. <el-table-column label="操作" header-align="center" width="250">
  156. <template scope="scope">
  157. <el-button size="mini" type="text" @click="handleEdit(scope.row)">编辑</el-button>
  158. <el-button :disabled="scope.row.soldStatus!=1" size="mini" type="text" @click="handleDelete(scope.row)">删除</el-button>
  159. <el-button size="mini" type="text" @click="handleView(scope.row)">查看</el-button>
  160. </template>
  161. </el-table-column>
  162. </el-table>
  163. <div class="table-page">
  164. <el-pagination
  165. :current-page.sync="currentPage"
  166. :page-sizes="[10, 20, 50, 100]"
  167. :page-size="pageSize"
  168. background
  169. layout="total, sizes, prev, pager, next, jumper"
  170. :total="allpage"
  171. @size-change="handleSizeChange"
  172. @current-change="handleCurrentChange"
  173. />
  174. </div>
  175. </el-col>
  176. </el-row>
  177. </div>
  178. </div>
  179. <el-dialog
  180. :title="dialogTitle"
  181. :visible.sync="dialogVisible"
  182. :before-close="dialogChose"
  183. width="75%"
  184. top="50px"
  185. class="statistic_base"
  186. :append-to-body="true"
  187. :modal-append-to-body="true"
  188. custom-class="tagdialog"
  189. @open="dlgOpen"
  190. >
  191. <el-form ref="houseForm" :model="houseForm" style="width: 100%;padding: 5px" :rules="commitRules">
  192. <el-row>
  193. <el-col style="padding-bottom: 10px">
  194. <!-- <span class="card_title">基本信息</span>-->
  195. <el-card shadow="always" style="padding-top: 10px">
  196. <el-row>
  197. <el-col :span="3" class="col-txt"><span><span class="red-asterisk">*</span>父级</span></el-col>
  198. <el-col :span="21" class="col-input">
  199. <el-form-item prop="findids">
  200. <el-cascader
  201. v-model="houseForm.findids"
  202. :append-to-body="false"
  203. :disabled="isView"
  204. style="width: 100%;"
  205. :options="options"
  206. clearable
  207. @change="buildChange"
  208. />
  209. </el-form-item>
  210. </el-col>
  211. </el-row>
  212. <el-row>
  213. <el-col :span="3" class="col-txt"><span><span class="red-asterisk">*</span>户室号</span></el-col>
  214. <el-col :span="9" class="col-input">
  215. <el-form-item prop="roomNo">
  216. <el-input v-model="houseForm.roomNo" :disabled="isView" />
  217. </el-form-item>
  218. </el-col>
  219. <el-col :span="3" class="col-txt"><span><span class="red-asterisk">*</span>所在层</span></el-col>
  220. <el-col :span="9" class="col-input">
  221. <el-form-item prop="floor">
  222. <el-input v-model="houseForm.floor" :disabled="isView" />
  223. </el-form-item>
  224. </el-col>
  225. </el-row>
  226. <el-row>
  227. <el-col :span="3" class="col-txt"><span>预测套内面积(㎡)</span></el-col>
  228. <el-col :span="9" class="col-input">
  229. <el-form-item>
  230. <el-input v-model="houseForm.predictionInternalArea" :disabled="isView" type="number" />
  231. </el-form-item>
  232. </el-col>
  233. <el-col :span="3" class="col-txt"><span>预测分摊面积(㎡)</span></el-col>
  234. <el-col :span="9" class="col-input">
  235. <el-form-item>
  236. <el-input v-model="houseForm.predictionShareArea" :disabled="isView" type="number" />
  237. </el-form-item>
  238. </el-col>
  239. </el-row>
  240. <el-row>
  241. <el-col :span="3" class="col-txt"><span>预测建筑面积(㎡)</span></el-col>
  242. <el-col :span="9" class="col-input">
  243. <el-form-item>
  244. <el-input v-model="houseForm.predictionBuildArea" :disabled="isView" type="number" />
  245. </el-form-item>
  246. </el-col>
  247. <el-col :span="3" class="col-txt"><span>预测土地面积(㎡)</span></el-col>
  248. <el-col :span="9" class="col-input">
  249. <el-form-item>
  250. <el-input v-model="houseForm.predictionLandArea" :disabled="isView" type="number" />
  251. </el-form-item>
  252. </el-col>
  253. </el-row>
  254. <el-row>
  255. <el-col :span="3" class="col-txt"><span><span class="red-asterisk">*</span>实测套内面积(㎡)</span></el-col>
  256. <el-col :span="9" class="col-input">
  257. <el-form-item prop="actualInternalArea">
  258. <el-input v-model="houseForm.actualInternalArea" :disabled="isView" type="number" />
  259. </el-form-item>
  260. </el-col>
  261. <el-col :span="3" class="col-txt"><span><span class="red-asterisk">*</span>实测分摊面积(㎡)</span></el-col>
  262. <el-col :span="9" class="col-input">
  263. <el-form-item prop="actualShareArea">
  264. <el-input v-model="houseForm.actualShareArea" :disabled="isView" type="number" />
  265. </el-form-item>
  266. </el-col>
  267. </el-row>
  268. <el-row>
  269. <el-col :span="3" class="col-txt"><span><span class="red-asterisk">*</span>实测建筑面积(㎡)</span></el-col>
  270. <el-col :span="9" class="col-input">
  271. <el-form-item prop="actualBuildArea">
  272. <el-input v-model="houseForm.actualBuildArea" :disabled="isView" type="number" />
  273. </el-form-item>
  274. </el-col>
  275. <el-col :span="3" class="col-txt"><span>实测土地面积(㎡)</span></el-col>
  276. <el-col :span="9" class="col-input">
  277. <el-form-item>
  278. <el-input v-model="houseForm.actualLandArea" :disabled="isView" type="number" />
  279. </el-form-item>
  280. </el-col>
  281. </el-row>
  282. <el-row>
  283. <el-col :span="3" class="col-txt"><span><span class="red-asterisk">*</span>用途:</span></el-col>
  284. <el-col :span="9" class="col-input">
  285. <el-form-item prop="roomUse">
  286. <el-select
  287. v-model="houseForm.roomUse"
  288. placeholder=""
  289. filterable
  290. clearable
  291. :disabled="isView"
  292. >
  293. <el-option
  294. v-for="item in dc_data.HOUSE_USAGE"
  295. :key="item.value"
  296. :label="item.label"
  297. :value="item.value"
  298. />
  299. </el-select>
  300. </el-form-item>
  301. </el-col>
  302. <el-col :span="3" class="col-txt"><span>户编号</span></el-col>
  303. <el-col :span="9" class="col-input">
  304. <el-form-item>
  305. <el-input v-model="houseForm.roomNumber" :disabled="isView" />
  306. </el-form-item>
  307. </el-col>
  308. </el-row>
  309. <el-row>
  310. <el-col :span="3" class="col-txt"><span>装修情况:</span></el-col>
  311. <el-col :span="9" class="col-input">
  312. <el-form-item>
  313. <el-select
  314. v-model="houseForm.decorationSituation"
  315. placeholder=""
  316. filterable
  317. clearable
  318. :disabled="isView"
  319. >
  320. <el-option
  321. v-for="item in dc_data.DECORATION_SITUATION"
  322. :key="item.value"
  323. :label="item.label"
  324. :value="item.value"
  325. />
  326. </el-select>
  327. </el-form-item>
  328. </el-col>
  329. <el-col :span="3" class="col-txt"><span>2.2米以上面积</span></el-col>
  330. <el-col :span="9" class="col-input">
  331. <el-form-item>
  332. <el-input v-model="houseForm.twoPointTwo" :disabled="isView" />
  333. </el-form-item>
  334. </el-col>
  335. </el-row>
  336. <el-row>
  337. <el-col :span="3" class="col-txt"><span>户型</span></el-col>
  338. <el-col :span="9" class="col-input">
  339. <el-form-item>
  340. <el-select
  341. v-model="houseForm.houseTypeId"
  342. placeholder=""
  343. filterable
  344. clearable
  345. @change="houseTypeChange"
  346. >
  347. <el-option
  348. v-for="item in houseTypeOption"
  349. :key="item.value"
  350. :label="item.label"
  351. :value="item.value"
  352. />
  353. </el-select>
  354. </el-form-item>
  355. </el-col>
  356. </el-row>
  357. <el-row>
  358. <el-col :span="3" class="col-txt"><span>户型图:</span></el-col>
  359. <el-col v-if="fileList.length>0" :span="20" class="col-input">
  360. <el-form-item>
  361. <el-upload
  362. ref="upload"
  363. action
  364. accept="image/png,image/gif,image/jpg,image/jpeg"
  365. list-type="picture-card"
  366. :file-list="fileList"
  367. :limit="9"
  368. :http-request="uploadHouseTypePicture"
  369. :on-preview="handlePictureCardPreview"
  370. :on-remove="handleRemove"
  371. :on-exceed="handleExceed"
  372. disabled
  373. >
  374. <!-- <i class="el-icon-plus" />-->
  375. <div slot="tip" class="el-upload__tip">
  376. 只能上传jpg/png文件,限制上传9张
  377. </div>
  378. </el-upload>
  379. </el-form-item>
  380. </el-col>
  381. <el-col v-else :span="9" class="col-input">
  382. <el-form-item>
  383. <span>未上传</span>
  384. </el-form-item>
  385. </el-col>
  386. </el-row>
  387. <el-row>
  388. <el-col :span="3" class="col-txt"><span>备注:</span></el-col>
  389. <el-col :span="21" class="col-input">
  390. <el-form-item>
  391. <el-input v-model="houseForm.remark" type="textarea" maxlength="2000" show-word-limit :disabled="isView" />
  392. </el-form-item>
  393. </el-col>
  394. </el-row>
  395. <el-row>
  396. <el-col :span="3" class="col-txt"><span>可售状态:</span></el-col>
  397. <el-col :span="21" class="col-input">
  398. <el-form-item>
  399. <el-select
  400. v-model="houseForm.saleStatus"
  401. placeholder="请选择"
  402. size="small"
  403. :disabled="isView"
  404. clearable
  405. >
  406. <el-option
  407. v-for="item in dc_data.SALE_STATUS"
  408. :key="item.value"
  409. :label="item.label"
  410. :value="item.value"
  411. />
  412. </el-select>
  413. </el-form-item>
  414. </el-col>
  415. </el-row>
  416. </el-card>
  417. </el-col>
  418. </el-row>
  419. </el-form>
  420. <div slot="footer">
  421. <el-button @click="dialogChose">取 消</el-button>
  422. <el-button :loading="loadingFlag" type="primary" @click="confirmSubmit()">确 定</el-button>
  423. </div>
  424. </el-dialog>
  425. <el-dialog
  426. :visible.sync="dialogImageVisible"
  427. :close-on-click-modal="false"
  428. :close-on-press-escape="false"
  429. append-to-body
  430. >
  431. <img width="100%" :src="dialogImageUrl" alt="">
  432. </el-dialog>
  433. <!-- 批量导入 -->
  434. <upload-cost
  435. v-if="importVisible"
  436. :dialog-visible="importVisible"
  437. :import-type="importType"
  438. :upload-title="uploadTitle"
  439. :import-title="importTitle"
  440. @cancelUpload="cancelImport"
  441. />
  442. </div>
  443. </template>
  444. <script>
  445. import Base from '@/views/base/base'
  446. import BaseData from '@/views/base/baseData'
  447. import BaseDept from '@/views/base/baseDept'
  448. import { upload } from '@/static/utils/channel'
  449. import uploadCost from '@/views/parkAssets/component/uploadCost.vue'
  450. import constant from '@/static/utils/constant'
  451. export default {
  452. name: 'User',
  453. components: { uploadCost },
  454. mixins: [Base, BaseData, BaseDept],
  455. data() {
  456. return {
  457. dc_key: ['HOUSE_USAGE', 'DECORATION_SITUATION', 'SALE_STATUS', 'SOLD_STATUS'],
  458. // 查询参数
  459. queryParam: {
  460. nodeId: '',
  461. level: ''
  462. },
  463. options: [],
  464. houseForm: {
  465. houseTypeId: null
  466. },
  467. DeptTree: [],
  468. urlStr: 'add',
  469. AllData: [],
  470. loading: false,
  471. dialogVisible: false,
  472. dialogTitle: '',
  473. isAdd: true,
  474. commitRules: {
  475. findids: [{ required: true, trigger: 'blur', message: '请选择父级' }],
  476. roomNo: [{ required: true, trigger: 'blur', message: '请输入户室号' }],
  477. floor: [{ required: true, trigger: 'blur', message: '请输入所在层' }],
  478. // predictionInternalArea: [{ required: true, trigger: 'blur', message: '请输入预测套内面积' }],
  479. // predictionShareArea: [{ required: true, trigger: 'blur', message: '请输入预测分摊面积' }],
  480. // predictionBuildArea: [{ required: true, trigger: 'blur', message: '请输入预测建筑面积' }],
  481. // predictionLandArea: [{ required: true, trigger: 'blur', message: '请输入预测土地面积' }],
  482. actualInternalArea: [{ required: true, trigger: 'blur', message: '请输入实测套内面积' }],
  483. actualShareArea: [{ required: true, trigger: 'blur', message: '请输入实测分摊面积' }],
  484. actualBuildArea: [{ required: true, trigger: 'blur', message: '请输入实测建筑面积' }],
  485. // actualLandArea: [{ required: true, trigger: 'blur', message: '请输入实测土地面积' }],
  486. roomUse: [{ required: true, trigger: 'blur', message: '请输入用途' }]
  487. // roomNumber: [{ required: true, trigger: 'blur', message: '请输入户编号' }]
  488. },
  489. roomId: '',
  490. roomUse: [],
  491. saleStatus: [],
  492. soldStatus: [],
  493. decorationSituation: [],
  494. isView: false,
  495. fileList: [],
  496. houseTypeOption: [],
  497. // 图片预览及其他
  498. dialogImageUrl: '',
  499. dialogImageVisible: false,
  500. // 批量导入
  501. importVisible: false,
  502. importType: '',
  503. importTitle: '',
  504. uploadTitle: [],
  505. loadingFlag: false
  506. }
  507. },
  508. mounted() {
  509. this.initDict(this.dc_key).then((res) => {
  510. this.getData()
  511. })
  512. this.getTreeData()
  513. this.getTreeSelectData()
  514. },
  515. methods: {
  516. handleSearch: function() {
  517. this.getData()
  518. },
  519. // 导出
  520. handleExcel: function() {
  521. const _this = this
  522. _this.AllData = []
  523. _this.queryParam.pageNum = _this.currentPage
  524. _this.queryParam.pageSize = _this.pageSize
  525. _this.queryParam.roomUseStr = _this.roomUse.join(',')
  526. _this.queryParam.saleStatusStr = _this.saleStatus.join(',')
  527. _this.queryParam.soldStatusStr = _this.soldStatus.join(',')
  528. _this.queryParam.decorationSituationStr = _this.decorationSituation.join(',')
  529. this.OutData = []
  530. const title = ['单元/楼栋号', '所在层', '户室号', '套内面积', '建筑面积', '用途', '装修情况',
  531. '可售状态', '已售状态']
  532. this.OutData.push(title)
  533. const temp = []
  534. this.baseRequest('excelList', _this.queryParam).then(res => {
  535. const data = res.data
  536. data.data.forEach(function(item) {
  537. const json = _this.getItemJson(item)
  538. temp.push(json)
  539. })
  540. temp.forEach(function(item) {
  541. const jsonArray = []
  542. jsonArray.push(item.buildName)
  543. jsonArray.push(item.floor)
  544. jsonArray.push(item.roomNo)
  545. jsonArray.push(item.actualInternalArea)
  546. jsonArray.push(item.actualBuildArea)
  547. jsonArray.push(item.roomUseStr)
  548. jsonArray.push(item.decorationSituationStr)
  549. jsonArray.push(item.saleStatusStr)
  550. jsonArray.push(item.soldStatusStr)
  551. _this.OutData.push(jsonArray)
  552. })
  553. const OutSize = [{ wch: 15 }, { wch: 15 }, { wch: 15 }, { wch: 15 }, { wch: 15 }, { wch: 15 }, { wch: 15 },
  554. { wch: 15 }, { wch: 15 }]
  555. const fileName = '房间导出 ' + new Date().Format('yyyyMMddhhmm')
  556. this.$outputXlsxFile(this.OutData, OutSize, fileName)
  557. })
  558. },
  559. handleReset: function() {
  560. this.queryParam = {}
  561. this.roomUse = []
  562. this.saleStatus = []
  563. this.soldStatus = []
  564. this.decorationSituation = []
  565. this.getData()
  566. },
  567. getTreeData: function() {
  568. this.baseInfoRequest('getTreeData1', {}).then((res) => {
  569. this.DeptTree = res.data.data
  570. }).catch(() => {
  571. })
  572. },
  573. getTreeSelectData: function() {
  574. this.baseInfoRequest('getTreeData2', {}).then((res) => {
  575. this.options = res.data.data
  576. }).catch(() => {
  577. })
  578. },
  579. getData: function() {
  580. const _this = this
  581. _this.loading = true
  582. _this.AllData = []
  583. _this.queryParam.pageNum = _this.currentPage
  584. _this.queryParam.pageSize = _this.pageSize
  585. _this.queryParam.roomUseStr = _this.roomUse.join(',')
  586. _this.queryParam.saleStatusStr = _this.saleStatus.join(',')
  587. _this.queryParam.soldStatusStr = _this.soldStatus.join(',')
  588. _this.queryParam.decorationSituationStr = _this.decorationSituation.join(',')
  589. _this.baseRequest('listByModel', _this.queryParam).then((res) => {
  590. if (res.data.rows) {
  591. res.data.rows.forEach(function(item) {
  592. const json = _this.getItemJson(item)
  593. _this.AllData.push(json)
  594. })
  595. _this.allpage = res.data.total
  596. }
  597. _this.loading = false
  598. }).catch(() => {
  599. })
  600. },
  601. handleAdd: function() {
  602. this.isView = false
  603. this.urlStr = 'add'
  604. this.dialogVisible = true
  605. this.fileList = []
  606. this.houseTypeOption = []
  607. this.dialogTitle = '新增房间'
  608. },
  609. handleEdit: function(val) {
  610. this.isView = false
  611. this.urlStr = 'edit'
  612. this.houseForm = val
  613. this.fileList = []
  614. this.houseTypeOption = []
  615. this.dialogVisible = true
  616. this.dialogTitle = '编辑房间'
  617. },
  618. handleView: function(val) {
  619. this.isView = true
  620. this.houseForm.id = val.id
  621. this.dialogVisible = true
  622. this.dialogTitle = '查看房间'
  623. },
  624. getCheckedNodes(data, node, item) {
  625. console.log('节点====', node)
  626. console.log('节点id====', node.data.id)
  627. console.log('层级====', node.level)
  628. const _this = this
  629. _this.queryParam.nodeId = node.data.id
  630. _this.queryParam.level = node.level
  631. this.getData()
  632. },
  633. dialogChose() {
  634. this.houseForm = {}
  635. this.dialogVisible = false
  636. },
  637. confirmSubmit: function() {
  638. const _this = this
  639. this.$refs.houseForm.validate(valid => {
  640. if (valid) {
  641. _this.loadingFlag = true
  642. const ids = this.houseForm.findids
  643. if (ids != null && ids != [] && ids != '') {
  644. this.houseForm.groupId = ids[0]
  645. this.houseForm.discId = ids[1]
  646. this.houseForm.buildId = ids[2]
  647. }
  648. const extraData = {
  649. }
  650. const postData = Object.assign({}, this.houseForm, extraData)
  651. this.baseRequest(this.urlStr, postData).then((res) => {
  652. this.houseForm = {}
  653. this.dialogVisible = false
  654. this.getData()
  655. this.getTreeData()
  656. this.$message({
  657. message: '提交成功',
  658. type: 'success'
  659. })
  660. _this.loadingFlag = false
  661. }).catch(() => {
  662. })
  663. }
  664. })
  665. },
  666. getItemJson: function(item) {
  667. // 用途
  668. item.roomUseStr = this.dc_map.HOUSE_USAGE[item.roomUse]
  669. // 装修情况
  670. item.decorationSituationStr = this.dc_map.DECORATION_SITUATION[item.decorationSituation]
  671. // 可售状态
  672. item.saleStatusStr = this.dc_map.SALE_STATUS[item.saleStatus]
  673. // 可售状态
  674. item.soldStatusStr = this.dc_map.SOLD_STATUS[item.soldStatus]
  675. return item
  676. },
  677. handleRowSelectChange(val) {
  678. this.currentRow = val
  679. if (this.currentRow) {
  680. if (this.currentRow.id === '1') {
  681. this.isAdminSelect = true
  682. } else {
  683. this.isAdminSelect = false
  684. }
  685. }
  686. },
  687. dlgOpen: function() {
  688. const _this = this
  689. if (_this.houseForm.id) {
  690. const postData = {
  691. id: _this.houseForm.id
  692. }
  693. this.baseRequest('getById', postData)
  694. .then(res => {
  695. if (res.data) {
  696. _this.houseForm = Object.assign({}, _this.houseForm, res.data)
  697. if (res.data.roomUse) {
  698. _this.houseForm.roomUse = res.data.roomUse + ''
  699. }
  700. if (res.data.decorationSituation) {
  701. _this.houseForm.decorationSituation = res.data.decorationSituation + ''
  702. }
  703. if (res.data.houseTypeId) {
  704. _this.houseForm.houseTypeId = res.data.houseTypeId + ''
  705. }
  706. if (res.data.saleStatus) {
  707. _this.houseForm.saleStatus = res.data.saleStatus + ''
  708. }
  709. // 回显户型
  710. _this.houseTypeOption = []
  711. _this.baseHouseTypeRequest('listAll', { discId: _this.houseForm.discId }).then(res => {
  712. if (res.data) {
  713. res.data.forEach(item => {
  714. _this.houseTypeOption.push({
  715. label: item.name + ',建筑面积' + item.buildArea + ',使用面积' + item.useArea,
  716. value: item.id,
  717. files: item.fileList
  718. })
  719. })
  720. // 回显户型图片
  721. const obj = _this.houseTypeOption.find(item =>
  722. item.value === _this.houseForm.houseTypeId
  723. )
  724. if (obj !== undefined) {
  725. this.fileList = []
  726. const files = JSON.parse(obj.files)
  727. files.forEach(v => {
  728. if (v) {
  729. this.fileList.push({
  730. url: constant.BASE_URI + '/FileController/download/' + v.data,
  731. id: v.data
  732. })
  733. }
  734. })
  735. } else {
  736. _this.houseForm.houseTypeId = ''
  737. }
  738. }
  739. })
  740. // 填充父级
  741. this.houseForm.findids = []
  742. if (undefined != this.houseForm.groupId && this.houseForm.groupId != null &&
  743. this.houseForm.groupId != '') {
  744. this.houseForm.findids[0] = this.houseForm.groupId
  745. if (undefined != this.houseForm.discId && this.houseForm.discId != null &&
  746. this.houseForm.discId != '') {
  747. this.houseForm.findids[1] = this.houseForm.discId
  748. if (undefined != this.houseForm.buildId && this.houseForm.buildId != null &&
  749. this.houseForm.buildId != '') {
  750. this.houseForm.findids[2] = this.houseForm.buildId
  751. }
  752. }
  753. }
  754. }
  755. })
  756. .catch(() => {})
  757. }
  758. },
  759. // 上传相关,包括图片、文件
  760. handlePictureCardPreview: function(file) {
  761. this.handlePicturePreview(file.url)
  762. },
  763. handlePicturePreview: function(url) {
  764. this.dialogImageUrl = url
  765. this.dialogImageVisible = true
  766. },
  767. uploadHouseTypePicture: function(param) {
  768. upload(param, true).then((res) => {
  769. this.fileList.push(res)
  770. })
  771. },
  772. buildChange(val) {
  773. const postData = {
  774. discId: val[1]
  775. }
  776. this.getHouseTypeList(postData)
  777. this.houseForm.houseTypeId = ''
  778. this.fileList = []
  779. },
  780. getHouseTypeList(val) {
  781. const _this = this
  782. _this.houseTypeOption = []
  783. _this.baseHouseTypeRequest('listAll', val).then(res => {
  784. if (res.data) {
  785. res.data.forEach(item => {
  786. _this.houseTypeOption.push({
  787. label: item.name + ',建筑面积' + item.buildArea + ',使用面积' + item.useArea,
  788. value: item.id,
  789. files: item.fileList
  790. })
  791. })
  792. }
  793. })
  794. },
  795. // 导入
  796. batchImport() {
  797. this.importVisible = true
  798. this.importType = 'roomInsert'
  799. this.importTitle = '房间批量导入'
  800. },
  801. cancelImport(refresh) {
  802. this.importVisible = false
  803. this.importType = ''
  804. this.getTreeData()
  805. this.getData()
  806. },
  807. handleDelete(val) {
  808. this.$confirm('确认删除该数据,删除后将无法恢复,确认删除吗?', '提示', {
  809. confirmButtonText: '确定',
  810. cancelButtonText: '取消',
  811. type: 'warning'
  812. }).then(() => {
  813. this.baseRequest('delete', { id: val.id }).then(res => {
  814. if (res.data.code == 200) {
  815. this.getData()
  816. this.getTreeData()
  817. this.$message({
  818. type: 'success',
  819. message: '删除成功!'
  820. })
  821. } else {
  822. this.$message({
  823. type: 'error',
  824. message: res.data.msg
  825. })
  826. }
  827. }).catch((err) => {
  828. this.$message({
  829. type: 'error',
  830. message: err
  831. })
  832. })
  833. }).catch(() => {
  834. this.$message({
  835. type: 'info',
  836. message: '已取消删除'
  837. })
  838. })
  839. },
  840. houseTypeChange(val) {
  841. this.fileList = []
  842. const obj = this.houseTypeOption.find(item =>
  843. item.value === val
  844. )
  845. if (obj !== undefined) {
  846. const files = JSON.parse(obj.files)
  847. files.forEach(v => {
  848. if (v) {
  849. this.fileList.push({
  850. url: constant.BASE_URI + '/FileController/download/' + v.data,
  851. id: v.data
  852. })
  853. }
  854. })
  855. }
  856. },
  857. handleExceed: function() {
  858. this.$message.info('超过文件个数限制')
  859. },
  860. handleRemove: function(item) {
  861. const id = item.id
  862. const idx = this.fileList.findIndex(item => item.id === id)
  863. this.fileList.splice(idx, 1)
  864. },
  865. // 请求封装,继承类中调用,必须存在
  866. baseRequest: function(opUrl, postData) {
  867. return this.$channel.baseRequest('ParkRoomController', opUrl, postData, 'User')
  868. },
  869. baseInfoRequest: function(opUrl, postData) {
  870. return this.$channel.baseRequest('ParkInfoController', opUrl, postData, 'User')
  871. },
  872. baseHouseTypeRequest: function(opUrl, postData) {
  873. return this.$channel.baseRequest('HouseTypeController', opUrl, postData, 'Post')
  874. }
  875. }
  876. }
  877. </script>
  878. <style scoped>
  879. .custom-tree-node {
  880. flex: 1;
  881. display: flex;
  882. align-items: center;
  883. justify-content: space-between;
  884. font-size: 16px;
  885. padding-right: 8px;
  886. }
  887. .custom-tree-container{
  888. display: flex;
  889. }
  890. .custom-tree-container .block-l {
  891. /*flex-grow: 2 ;*/
  892. //float: left;
  893. width: 20%;
  894. padding: 0 8px 0 0;
  895. }
  896. .custom-tree-container .block-r {
  897. /*flex-grow: 10;*/
  898. //float: left;
  899. width: 80%;
  900. /*padding: 0 0 0 8px;*/
  901. }
  902. </style>
  903. <style scoped>
  904. .lineheight20{
  905. padding: 7px;
  906. background-color: white;
  907. line-height: 15rpx;
  908. }
  909. .ch-input .el-input__inner {
  910. border-color: #32323A;
  911. }
  912. .ch-input-size {
  913. width: 150px;
  914. }
  915. .ch-button {
  916. border-color: #32323A;
  917. background-color: #32323A;
  918. color: #fff;
  919. }
  920. .ch-button-warning {
  921. margin-left: 10px;
  922. border-color: #E6A23C;
  923. background-color: #E6A23C;
  924. color: #fff;
  925. }
  926. .ch-button-export {
  927. margin-left: 10px;
  928. border-color: #98CC1F;
  929. background-color: #98CC1F;
  930. color: #fff;
  931. }
  932. .listBox{
  933. display: flex;
  934. flex-wrap: wrap;
  935. }
  936. .list {
  937. border: 1px solid #BEC3CB;
  938. padding: 0px 40px;
  939. border-radius: 10px;
  940. margin-right: 20px;
  941. cursor: pointer;
  942. height: 30px;
  943. line-height: 30px;
  944. background: #F2F2F2;
  945. color: #333333;
  946. }
  947. .checked {
  948. color: #FFFFFF;
  949. background: #6600FF;
  950. border: 1px solid #3377FF;
  951. }
  952. .red-asterisk {
  953. color: red;
  954. }
  955. </style>