add.vue 32 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018
  1. <template>
  2. <div class="main">
  3. <div class="landlord-title">
  4. <span>添加房东(</span>
  5. <span>*</span>
  6. <span>为必填项)</span>
  7. </div>
  8. <el-form
  9. ref="ruleForm"
  10. :model="formData"
  11. label-width="100px"
  12. :rules="formRules"
  13. >
  14. <div class="formContent">
  15. <div class="formContent-item">
  16. <div class="formContent-item_title">基础信息</div>
  17. <div class="formContent-formList">
  18. <div>
  19. <el-form-item
  20. label="姓名"
  21. prop="name"
  22. >
  23. <el-input
  24. v-model="formData.name"
  25. placeholder="请输入姓名"
  26. ></el-input>
  27. </el-form-item>
  28. <el-form-item
  29. label="手机号"
  30. prop="phone"
  31. >
  32. <el-input
  33. v-model="formData.phone"
  34. placeholder="请输入手机号"
  35. maxlength="11"
  36. ></el-input>
  37. </el-form-item>
  38. <el-form-item label="房东编号">
  39. <el-input
  40. v-model="formData.personnelNumber"
  41. placeholder="请输入房东编号"
  42. ></el-input>
  43. </el-form-item>
  44. <el-form-item
  45. label="性别"
  46. required
  47. >
  48. <el-radio
  49. v-model="formData.sex"
  50. :label="1"
  51. >男</el-radio>
  52. <el-radio
  53. v-model="formData.sex"
  54. :label="2"
  55. >女</el-radio>
  56. </el-form-item>
  57. <el-form-item label="备注">
  58. <el-input
  59. type="textarea"
  60. v-model="formData.remark"
  61. placeholder="请输入备注"
  62. ></el-input>
  63. </el-form-item>
  64. </div>
  65. <div class="clickUpload">
  66. <div class="clickUpText">
  67. <img
  68. class="dataImg"
  69. v-if="!!formData.facePictureUrl"
  70. :src="formData.facePictureUrl"
  71. />
  72. <template v-else>
  73. <img
  74. class="bg-img"
  75. src="@/assets/img/ownerManagement/img_zhaopian2@2x.png"
  76. alt=""
  77. />
  78. <div>点击添加人脸照片</div>
  79. </template>
  80. </div>
  81. <el-upload
  82. :headers="token"
  83. ref="uploaduserlogo"
  84. class="mini-upload"
  85. limit="1"
  86. action="/czc-community/upload/uploadFile"
  87. :on-success="uploadsuccess"
  88. :before-upload="beforeAvatarUpload"
  89. :auto-upload="true"
  90. name="file"
  91. >
  92. </el-upload>
  93. </div>
  94. </div>
  95. </div>
  96. <div class="formContent-item">
  97. <div class="formContent-item_title">证件信息</div>
  98. <el-form-item label="证件类型">
  99. <el-select
  100. v-model="formData.idType"
  101. class="width100"
  102. >
  103. <el-option
  104. v-for="(item, index) in idTypeArray"
  105. :key="index"
  106. :label="item.label"
  107. :value="item.status"
  108. >{{item.label}}</el-option>
  109. </el-select>
  110. </el-form-item>
  111. <el-form-item
  112. label="证件号码"
  113. class="width100"
  114. >
  115. <el-input
  116. v-model="formData.idNumber"
  117. placeholder="请输入证件号码"
  118. maxlength="18"
  119. ></el-input>
  120. </el-form-item>
  121. <el-form-item
  122. label="户籍地址"
  123. class="width100"
  124. >
  125. <el-input
  126. v-model="formData.permanentAddress"
  127. placeholder="请输入户籍地址"
  128. ></el-input>
  129. </el-form-item>
  130. <el-form-item
  131. label="签发机关"
  132. class="width100"
  133. >
  134. <el-input
  135. v-model="formData.issuingAuthority"
  136. placeholder="请输入签发机关"
  137. ></el-input>
  138. </el-form-item>
  139. <el-form-item
  140. label="有效期"
  141. style="width: 100%;"
  142. >
  143. <div style="width: 100%; float: left; margin-right: 7px;">
  144. <el-date-picker
  145. class="width100"
  146. v-model="effectiveDate"
  147. value-format="yyyy-MM-dd HH:mm:ss"
  148. type="daterange"
  149. range-separator="至"
  150. start-placeholder="开始日期"
  151. end-placeholder="结束日期"
  152. @change="effectiveDateToggle"
  153. :editable="false"
  154. ></el-date-picker>
  155. </div>
  156. <!-- <div style="width: 20%; float: left;">
  157. <el-checkbox v-model="checked">长期</el-checkbox>
  158. </div> -->
  159. </el-form-item>
  160. <el-form-item label="国籍">
  161. <el-select
  162. v-model="formData.nationality"
  163. clearable
  164. class="width100"
  165. >
  166. <el-option
  167. v-for="(item, index) in nationalityArray"
  168. :key="index"
  169. :label="item.label"
  170. :value="item.status"
  171. >{{item.label}}</el-option>
  172. </el-select>
  173. </el-form-item>
  174. <el-form-item label="籍贯">
  175. <el-select
  176. v-model="formData.nativePlace"
  177. clearable
  178. class="width100"
  179. >
  180. <el-option
  181. v-for="(item, index) in nativePlaceArray"
  182. :key="index"
  183. :label="item.name"
  184. :value="item.code"
  185. >{{item.name}}</el-option>
  186. </el-select>
  187. </el-form-item>
  188. <el-form-item label="民族">
  189. <el-select
  190. v-model="formData.nation"
  191. clearable
  192. class="width100"
  193. >
  194. <el-option
  195. v-for="(item, index) in nationArray"
  196. :key="index"
  197. :label="item.name"
  198. :value="item.code"
  199. >{{item.name}}</el-option>
  200. </el-select>
  201. </el-form-item>
  202. <el-form-item label="出生日期">
  203. <el-date-picker
  204. class="width100"
  205. v-model="formData.birthDate"
  206. value-format="yyyy-MM-dd HH:mm:ss"
  207. type="date"
  208. :picker-options="pickerOptions"
  209. placeholder="选择日期"
  210. >
  211. </el-date-picker>
  212. </el-form-item>
  213. </div>
  214. <div class="formContent-item">
  215. <div class="formContent-item_title">物业信息</div>
  216. <div
  217. style="max-height: 400px; overflow: hidden; overflow-y: auto; padding-right: 10px;"
  218. class="formContent-item_title_center"
  219. >
  220. <div
  221. v-for="(items, indexs) in houseInformation"
  222. :key="indexs"
  223. >
  224. <!-- <span style="color:red;float: left;">*</span> -->
  225. <el-form-item
  226. label="房屋信息"
  227. class="width100"
  228. :required="true"
  229. >
  230. <div style="width: 49%; float: left;">
  231. <el-radio
  232. :label="1"
  233. v-model="items.choice"
  234. @click.native="elRadio(indexs)"
  235. >按楼栋</el-radio>
  236. <el-radio
  237. :label="2"
  238. v-model="items.choice"
  239. @click.native="elRadios(indexs)"
  240. >按房间</el-radio>
  241. </div>
  242. <div
  243. style="width: 50%;float: left; "
  244. v-if="items.choice == 1 ? true : flase"
  245. >
  246. <el-cascader
  247. :ref="`getCheckeds`+indexs"
  248. :props="{emitPath:false}"
  249. :options="options"
  250. class="width100"
  251. placeholder="请选择"
  252. @change="shareScopeChange1(indexs)"
  253. v-model="items.region"
  254. clearable
  255. ></el-cascader>
  256. </div>
  257. <div
  258. style="width: 50%;float: left;"
  259. v-if="items.choice == 2 ? true : flase && this.isAdd"
  260. >
  261. <el-cascader
  262. :ref="`getChecked`+indexs"
  263. :options="scopeList"
  264. :props="props"
  265. class="width100"
  266. placeholder="请选择"
  267. @change="shareScopeChange(indexs)"
  268. v-model="items.region"
  269. clearable
  270. :show-all-levels="false"
  271. :filter-node-method="filterNodeHouse"
  272. collapse-tags
  273. ></el-cascader>
  274. </div>
  275. <!-- :props="{ label: 'name', value: 'code' }" -->
  276. </el-form-item>
  277. <el-form-item
  278. label="计费规则"
  279. class="width100"
  280. :required="true"
  281. >
  282. <el-select
  283. v-model="houseInformation[indexs].billingRules"
  284. clearable
  285. class="width100"
  286. @click.native="houseCommunityRules(indexs)"
  287. >
  288. <el-option
  289. v-for="(item, index) in houseInformation[indexs].billing"
  290. :key="index"
  291. :label="item.name"
  292. :value="item.value"
  293. >{{item.name}}</el-option>
  294. </el-select>
  295. </el-form-item>
  296. <el-form-item
  297. label="计费面积"
  298. class="width100"
  299. :required="true"
  300. >
  301. <el-input
  302. class="aaaa"
  303. v-model="houseInformation[indexs].billingArea"
  304. placeholder="请输入计费面积"
  305. type="number"
  306. ></el-input>
  307. </el-form-item>
  308. <div
  309. style="width: 100%;"
  310. v-if="houseInformation.length == 1 ? flase : true"
  311. >
  312. <el-button
  313. type="primary"
  314. style="float: right; position: relative; z-index: 100;"
  315. key="indexs"
  316. @click="closeshouseInformation(indexs)"
  317. >删除</el-button>
  318. </div>
  319. <div style="width: 100%; height: 0.005vw; background: #E0E1E3; margin: 20px 0; float: left;"></div>
  320. </div>
  321. <div>
  322. <el-button
  323. @click="addhouseInformation"
  324. style="float: left;"
  325. type="primary"
  326. >新增物业信息</el-button>
  327. </div>
  328. </div>
  329. </div>
  330. </div>
  331. </el-form>
  332. <div class="buttons">
  333. <el-button @click="closes">取消</el-button>
  334. <el-button
  335. type="primary"
  336. @click="addEdit()"
  337. >保存</el-button>
  338. </div>
  339. </div>
  340. </template>
  341. <script>
  342. // import
  343. export default {
  344. props: {
  345. params: {
  346. type: Object
  347. },
  348. isAdd: {
  349. type: Boolean,
  350. default: true
  351. }
  352. },
  353. data () {
  354. return {
  355. props: { multiple: true, emitPath: true, value: 'value', label: 'name', children: 'children', },
  356. optionsxx: [],
  357. checked: false,
  358. formData: {
  359. name: '',
  360. phone: '',
  361. personnelNumber: '',
  362. sex: 1,
  363. remark: '',
  364. facePictureUrl: '',
  365. idType: '',
  366. idNumber: '',
  367. permanentAddress: '',
  368. issuingAuthority: '',
  369. nationality: '',
  370. nativePlace: '',
  371. nation: '',
  372. birthDate: ''
  373. },
  374. effectiveDate: [],
  375. idTypeArray: [
  376. {
  377. status: 1,
  378. label: '居民身份证'
  379. },
  380. {
  381. status: 2,
  382. label: '居民户口簿'
  383. },
  384. {
  385. status: 3,
  386. label: '暂住证'
  387. },
  388. {
  389. status: 4,
  390. label: '其他'
  391. }
  392. ],
  393. nationalityArray: [
  394. {
  395. status: 1,
  396. label: '中国'
  397. },
  398. {
  399. status: 2,
  400. label: '其他'
  401. }
  402. ],
  403. formRules: {
  404. name: [this.$valid.selectRequireds('填写姓名')],
  405. phone: [this.$valid.patternPhone('填写手机号')],
  406. },
  407. houseInformation: [
  408. {
  409. choice: 1,
  410. billingArea: '',
  411. billingRules: '',
  412. region: [],
  413. billing: []//计费规则
  414. },
  415. ],
  416. // houseCommunity: [
  417. // {
  418. // billing: []
  419. // }
  420. // ],
  421. options: [],
  422. billing: [
  423. {
  424. id: 1,
  425. name: '房东'
  426. },
  427. {
  428. id: 2,
  429. name: '二房东'
  430. },
  431. ],
  432. optionTree: [],
  433. shareScope: [],
  434. shareScopeID: [],
  435. communityIdTree: [],
  436. communityId: []
  437. }
  438. },
  439. methods: {
  440. elRadio (indexs) {
  441. this.houseInformation[indexs].billingRules = '';
  442. this.houseInformation[indexs].billing = [];
  443. },
  444. elRadios (indexs) {
  445. this.houseInformation[indexs].billingRules = '';
  446. this.houseInformation[indexs].billing = [];
  447. },
  448. uploadsuccess (response, file, fileList) {
  449. this.$refs.uploaduserlogo.clearFiles();
  450. if (0 === response.status) {
  451. this.formData.facePictureUrl = response.data;
  452. }
  453. },
  454. beforeAvatarUpload (file) {
  455. const isJPG = file.type === 'image/jpeg';
  456. const isLt2M = file.size / 1024 / 1024 < 2;
  457. if (!isJPG) {
  458. this.$message.error('上传头像图片只能是 JPG 格式!');
  459. }
  460. if (!isLt2M) {
  461. this.$message.error('上传头像图片大小不能超过 2MB!');
  462. }
  463. return isJPG && isLt2M;
  464. },
  465. shareScopeChange (index) {
  466. var data = this.$refs[`getChecked${index}`][0].getCheckedNodes();
  467. if (data.length == 0) {
  468. this.houseInformation[index].billingRules = '';
  469. this.houseInformation[index].billing = [];
  470. // this.communityId = '';
  471. return;
  472. }
  473. this.shareScope = [];
  474. this.communityIdTree = [];
  475. for (let a = 0; a < data.length; a++) {
  476. if (data[a].children.length != 0) {
  477. if (data[0].path[0] == data[data.length - 1].path[0]) {
  478. for (let i = 0; i < data.length; i++) {
  479. this.shareScope.push(data[i].path[1]);
  480. this.communityIdTree.push(data[i].path[0]);
  481. }
  482. // this.houseInformation[index].region = [];
  483. // var houseInformation = [];
  484. // for (let i = 0; i < data.length; i++) {
  485. // if (data[i].path[3] != undefined) {
  486. // houseInformation.push(data[i].path)
  487. // this.shareScope = data[i].path[1]
  488. // }
  489. // }
  490. // this.houseInformation[index].region = houseInformation
  491. // // scopeList
  492. // debugger
  493. // this.$refs[`getChecked${index}`][0].$refs.panel.clearCheckedNodes();
  494. // console.log('同一个单元', this.houseInformation[index].region)
  495. } else {
  496. // 不同
  497. this.houseInformation[index].region = [];
  498. var houseInformation = [];
  499. this.shareScope = [];
  500. this.communityIdTree = [];
  501. for (let k = 0; k < data.length; k++) {
  502. if (data[k].path[0] == data[data.length - 1].path[0]) {
  503. if (data[k].path[3] != undefined) {
  504. houseInformation.push(data[k].path)
  505. this.shareScope.push(data[k].path[1])
  506. this.communityIdTree.push(data[k].path[0]);
  507. }
  508. }
  509. }
  510. // this.$refs[`getChecked${index}`][0].$refs.panel.clearCheckedNodes();
  511. // this.$refs[`getChecked${index}`][0].$refs.panel.activePath = [];
  512. // data = [];
  513. // this.$refs[`getChecked${index}`][0].getCheckedNodes() = [];
  514. this.houseInformation[index].region = houseInformation
  515. this.$nextTick(() => {
  516. // this.$forceUpdate();
  517. this.$refs[`getChecked${index}`][0].$refs.panel.clearCheckedNodes();
  518. })
  519. }
  520. } else {
  521. this.shareScope = [];
  522. this.communityIdTree = [];
  523. if (data[0].path[0] == data[data.length - 1].path[0]) {
  524. for (let i = 0; i < data.length; i++) {
  525. this.shareScope.push(data[i].path[1])
  526. this.communityIdTree.push(data[i].path[0]);
  527. }
  528. } else {
  529. this.shareScope = [];
  530. this.communityIdTree = [];
  531. for (let k = 0; k < data.length; k++) {
  532. this.shareScope.push(data[k].path[1])
  533. this.communityIdTree.push(data[k].path[0]);
  534. }
  535. this.$nextTick(() => {
  536. // this.$forceUpdate();
  537. this.$refs[`getChecked${index}`][0].$refs.panel.clearCheckedNodes();
  538. })
  539. // this.houseInformation[index].region = [];
  540. // var houseInformation = [];
  541. // this.shareScope = [];
  542. // for (let k = 0; k < data.length; k++) {
  543. // if (data[k].path[0] == data[data.length - 1].path[0]) {
  544. // if (data[k].path[3] != undefined) {
  545. // houseInformation.push(data[k].path)
  546. // this.shareScope.push(data[k].path[1])
  547. // }
  548. // }
  549. // }
  550. }
  551. // this.houseInformation[index].region = houseInformation
  552. // this.$nextTick(() => {
  553. // // this.$forceUpdate();
  554. // this.$refs[`getChecked${index}`][0].$refs.panel.clearCheckedNodes();
  555. // })
  556. // debugger
  557. // // this.shareScope = data[index].parent.parent.value;
  558. // if (data[0].path[0] == data[data.length - 1].path[0]) {
  559. // this.houseInformation[index].region = [];
  560. // var houseInformation = [];
  561. // // var houseInformation = [];
  562. // for (let i = 0; i < data.length; i++) {
  563. // houseInformation.push(data[i].path)
  564. // // houseInformation.push(this.houseInformation[index].region[i][3])
  565. // this.shareScope = data[i].path[1]
  566. // }
  567. // this.houseInformation[index].region = houseInformation
  568. // console.log('同社区', this.houseInformation[index].region)
  569. // } else {
  570. // this.houseInformation[index].region = [];
  571. // var houseInformation = [];
  572. // for (let j = 0; j < data.length; j++) {
  573. // if (data[j].path[0] != data[j + 1].path[0]) {
  574. // debugger
  575. // houseInformation.push(data[j + 1].path)
  576. // this.shareScope = data[j + 1].path[1]
  577. // }
  578. // }
  579. // this.houseInformation[index].region = houseInformation
  580. // console.log('不同社区', this.houseInformation[index].region)
  581. // }
  582. }
  583. }
  584. this.shareScope = Array.from(new Set(this.shareScope))
  585. this.communityIdTree = Array.from(new Set(this.communityIdTree))
  586. this.shareScopeID[index] = this.shareScope;
  587. this.communityId[index] = this.communityIdTree
  588. this.communityRules(index);
  589. // 判断点击是否为单元
  590. },
  591. houseCommunityRules (index) {
  592. this.communityRules(index);
  593. },
  594. // 获取对应社区的规则
  595. communityRules (index) {
  596. this.$http.get('/czc-charge/scChargeStrategy/list', { communityId: this.communityId[index][0] }).then(({ status, data, msg }) => {
  597. if (status == 0) {
  598. this.houseInformation[index].billing = [];
  599. // this.houseInformation[index].billingRules = ''
  600. if (data.length == 0) {
  601. this.houseInformation[index].billing = [];
  602. this.houseInformation[index].billingRules = ''
  603. } else {
  604. data.map((item, indexs) => {
  605. this.houseInformation[index].billing.push({
  606. name: item.chargeName,
  607. value: item.id
  608. })
  609. })
  610. }
  611. }
  612. })
  613. },
  614. // 回填规则
  615. RescommunityRules (index, communityId) {
  616. this.$http.get('/czc-charge/scChargeStrategy/list', { communityId: communityId }).then(({ status, data, msg }) => {
  617. if (status == 0) {
  618. this.houseInformation[index].billing = [];
  619. // this.houseInformation[index].billingRules = ''
  620. if (data.length == 0) {
  621. this.houseInformation[index].billing = [];
  622. this.houseInformation[index].billingRules = ''
  623. } else {
  624. data.map((item, indexs) => {
  625. //
  626. this.houseInformation[index].billing.push({
  627. name: item.chargeName,
  628. value: item.id
  629. })
  630. })
  631. }
  632. }
  633. })
  634. },
  635. shareScopeChange1 (index) {
  636. var data = this.$refs[`getCheckeds${index}`][0].getCheckedNodes();
  637. if (data.length != 0) {
  638. var id = data[0].path[0];
  639. this.RescommunityRules(index, id);
  640. } else {
  641. this.houseInformation[index].billingRules = '';
  642. this.houseInformation[index].billing = [];
  643. }
  644. },
  645. closes () {
  646. this.$emit('clerOwnerStatus');
  647. },
  648. addEdit () {
  649. this.$refs['ruleForm'].validate((valid) => {
  650. if (valid) {
  651. for (let a = 0; a < this.houseInformation.length; a++) {
  652. if (this.houseInformation[a].region == null) {
  653. if (this.houseInformation[a].region == null || this.houseInformation[a].billingRules.length == 0 || this.houseInformation[a].billingArea.length == 0) {
  654. this.$message.error('请填写物业信息');
  655. return;
  656. }
  657. } else {
  658. if (this.houseInformation[a].region.length == 0 || this.houseInformation[a].billingRules.length == 0 || this.houseInformation[a].billingArea.length == 0) {
  659. this.$message.error('请填写物业信息');
  660. return;
  661. }
  662. }
  663. }
  664. var url = '/czc-community/landlord/add';
  665. var params = {
  666. name: this.formData.name,
  667. phone: this.formData.phone,
  668. personnelNumber: this.formData.personnelNumber,
  669. sex: this.formData.sex,
  670. remarks: this.formData.remark,
  671. facePictureUrl: this.formData.facePictureUrl,
  672. idType: this.formData.idType,
  673. idNumber: this.formData.idNumber,
  674. permanentAddress: this.formData.permanentAddress,
  675. issuingAuthority: this.formData.issuingAuthority,
  676. effectiveDateStart: this.effectiveDate[0],
  677. effectiveDateEnd: this.effectiveDate[1],
  678. nationality: this.formData.nationality,
  679. nation: this.formData.nation,
  680. birthDate: this.formData.birthDate,
  681. nativePlace: this.formData.nativePlace,
  682. buildingList: []
  683. };
  684. if (!this.isAdd) {
  685. var url = '/czc-community/landlord/update'
  686. var params = {
  687. id: this.params,
  688. name: this.formData.name,
  689. phone: this.formData.phone,
  690. personnelNumber: this.formData.personnelNumber,
  691. sex: this.formData.sex,
  692. remarks: this.formData.remark,
  693. facePictureUrl: this.formData.facePictureUrl,
  694. idType: this.formData.idType,
  695. idNumber: this.formData.idNumber,
  696. permanentAddress: this.formData.permanentAddress,
  697. issuingAuthority: this.formData.issuingAuthority,
  698. effectiveDateStart: this.effectiveDate[0],
  699. effectiveDateEnd: this.effectiveDate[1],
  700. nationality: this.formData.nationality,
  701. nation: this.formData.nation,
  702. birthDate: this.formData.birthDate,
  703. nativePlace: this.formData.nativePlace,
  704. buildingList: []
  705. };
  706. }
  707. for (let i = 0; i < this.houseInformation.length; i++) {
  708. if (this.houseInformation[i].choice == 1) {
  709. params.buildingList.push({
  710. type: this.houseInformation[i].choice,
  711. buildingId: this.houseInformation[i].region,
  712. strategyId: this.houseInformation[i].billingRules,
  713. area: this.houseInformation[i].billingArea,
  714. houseList: []
  715. })
  716. } else if (this.houseInformation[i].choice == 2) {
  717. params.buildingList.push({
  718. type: this.houseInformation[i].choice,
  719. buildingId: this.shareScopeID[i][0] || this.shareScopeID[i][1],
  720. strategyId: this.houseInformation[i].billingRules,
  721. area: this.houseInformation[i].billingArea,
  722. houseList: []
  723. })
  724. for (let j = 0; j < this.houseInformation[i].region.length; j++) {
  725. params.buildingList[i].houseList.push({
  726. houseId: this.houseInformation[i].region[j][3] || this.houseInformation[i].region[j][2]
  727. })
  728. }
  729. }
  730. }
  731. this.$http.post(url, params).then(({ status, msg }) => {
  732. if (status == 0) {
  733. this.$message.success(msg);
  734. this.closes();
  735. } else {
  736. this.$message.error(msg);
  737. }
  738. }).catch(() => { });
  739. } else {
  740. return false;
  741. }
  742. });
  743. },
  744. addhouseInformation () {
  745. this.houseInformation.push({
  746. choice: 1,
  747. billingArea: '',
  748. billingRules: '',
  749. region: [],
  750. billing: []
  751. })
  752. },
  753. closeshouseInformation (id) {
  754. if (this.houseInformation.length > 1) {
  755. this.houseInformation.splice(id, 1);
  756. }
  757. if (this.shareScopeID.length > 1 && this.shareScopeID[id] != undefined) {
  758. this.shareScopeID.splice(id, 1);
  759. }
  760. },
  761. getOrgTreeList () {
  762. this.$http
  763. .get('/czc-community/assets/tree/community/find', { buildingType: 1 })
  764. .then(({ status, data, msg }) => {
  765. if (status === 0 && data) {
  766. this.optionTree = data;
  767. this.scopeList = data;
  768. this.TreeList();
  769. }
  770. });
  771. },
  772. TreeList () {
  773. this.options = [];
  774. for (let i = 0; i < this.optionTree.length; i++) {
  775. this.options.push({
  776. value: this.optionTree[i].value,
  777. label: this.optionTree[i].name,
  778. children: [],
  779. });
  780. for (let k = 0; k < this.optionTree[i].children.length; k++) {
  781. this.options[i].children.push({
  782. value: this.optionTree[i].children[k].value,
  783. label: this.optionTree[i].children[k].name,
  784. })
  785. }
  786. }
  787. if (!this.isAdd) {
  788. this.getDetails();
  789. }
  790. },
  791. getDetails () {
  792. let url = '/czc-community/landlord/find/' + this.params;
  793. this.$http.get(url).then(({ data, status, msg }) => {
  794. if (status == 0) {
  795. this.effectiveDate = [];
  796. this.formData.name = data.name;
  797. this.formData.phone = data.phone;
  798. this.formData.personnelNumber = data.personnelNumber;
  799. this.formData.sex = data.sex;
  800. this.formData.remark = data.remarks;
  801. this.formData.facePictureUrl = data.facePictureUrl;
  802. this.formData.idType = data.idType;
  803. this.formData.idNumber = data.idNumber;
  804. this.formData.permanentAddress = data.permanentAddress;
  805. this.formData.issuingAuthority = data.issuingAuthority;
  806. this.effectiveDate.push(data.effectiveDateStart, data.effectiveDateEnd)
  807. this.formData.nationality = data.nationality;
  808. this.formData.nation = data.nation;
  809. this.formData.birthDate = data.birthDate;
  810. this.formData.nativePlace = data.nativePlace
  811. let newHouse = [];
  812. for (let i = 0; i < data.buildingList.length; i++) {
  813. if (data.buildingList[i].type == 1) {
  814. newHouse.push({
  815. choice: data.buildingList[i].type,
  816. region: data.buildingList[i].buildingId + '',
  817. billingRules: data.buildingList[i].strategyId,
  818. billingArea: data.buildingList[i].area,
  819. billing: [],
  820. })
  821. this.RescommunityRules(i, data.buildingList[i].communityId);
  822. } else if (data.buildingList[i].type == 2) {
  823. this.shareScopeID[i] = [data.buildingList[i].buildingId + ''];
  824. var communityId = data.buildingList[i].communityId + '';
  825. var buildingId = data.buildingList[i].buildingId + '';
  826. var resDateRegion = []
  827. var houseId = [];
  828. var unitName = [];
  829. for (let k = 0; k < data.buildingList[i].houseList.length; k++) {
  830. houseId.push(data.buildingList[i].houseList[k].houseId);
  831. unitName.push(data.buildingList[i].houseList[k].unitName)
  832. if (unitName.length != 0 && unitName[0] != null) {
  833. resDateRegion[k] = [communityId, buildingId, unitName[k], houseId[k]];
  834. } else {
  835. resDateRegion[k] = [communityId, buildingId, houseId[k]];
  836. }
  837. }
  838. newHouse.push({
  839. choice: data.buildingList[i].type,
  840. region: resDateRegion,
  841. billingRules: data.buildingList[i].strategyId,
  842. billingArea: data.buildingList[i].area,
  843. billing: [],
  844. })
  845. }
  846. this.RescommunityRules(i, data.buildingList[i].communityId);
  847. }
  848. this.houseInformation = newHouse;
  849. }
  850. })
  851. }
  852. },
  853. created () {
  854. this.getOrgTreeList();
  855. if (!this.isAdd) {
  856. this.getDetails();
  857. }
  858. },
  859. computed: {
  860. nationArray () {
  861. return this.$store.getters['getNationArray'];
  862. },
  863. nativePlaceArray () {
  864. return this.$store.getters['getNativeArray'];
  865. }
  866. },
  867. }
  868. </script>
  869. <style lang="scss" scoped >
  870. @import '../../style.scss';
  871. .landlord-title {
  872. margin-bottom: 20px;
  873. background: white;
  874. height: 60px;
  875. display: flex;
  876. align-items: center;
  877. padding: 20px;
  878. span {
  879. font-size: 16px;
  880. }
  881. }
  882. .landlord-title span:nth-child(2) {
  883. color: red;
  884. }
  885. /deep/ .el-range-separator {
  886. width: 8% !important;
  887. }
  888. .formContent-item .ownerScroll[data-v-2c08d612]::-webkit-scrollbar {
  889. width: 5px;
  890. }
  891. .formContent-item .ownerScroll[data-v-2c08d612]::-webkit-scrollbar-thumb {
  892. background: #c6c4c4a9;
  893. }
  894. .formContent-item_title_center::-webkit-scrollbar {
  895. width: 5px !important;
  896. }
  897. .formContent-item_title_center::-webkit-scrollbar {
  898. /*滚动条整体样式*/
  899. width: 10px; /*高宽分别对应横竖滚动条的尺寸*/
  900. height: 1px;
  901. }
  902. .formContent-item_title_center::-webkit-scrollbar-thumb {
  903. /*滚动条里面小方块*/
  904. border-radius: 10px;
  905. // -webkit-box-shadow: inset 0 0 5px rgba(0, 0, 0, 0.2);
  906. background: #c6c4c4a9;
  907. }
  908. .formContent-item_title_center::-webkit-scrollbar-track {
  909. /*滚动条里面轨道*/
  910. // -webkit-box-shadow: inset 0 0 5px rgba(0, 0, 0, 0.2);
  911. border-radius: 10px;
  912. background: #f4f7f9a8;
  913. }
  914. </style>
  915. <style lang="scss">
  916. .el-cascader-panel {
  917. .el-scrollbar:first-child {
  918. .el-checkbox {
  919. display: none !important;
  920. }
  921. }
  922. .el-scrollbar:nth-child(2) {
  923. .el-checkbox {
  924. display: none !important;
  925. }
  926. }
  927. }
  928. .aaaa input::-webkit-outer-spin-button,
  929. .aaaa input::-webkit-inner-spin-button {
  930. -webkit-appearance: none;
  931. }
  932. .aaaa input[type='number'] {
  933. -moz-appearance: textfield;
  934. }
  935. </style>