9e71d993b82a0d16d652335eb4e56e1497ad8bea.svn-base 22 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564
  1. <template>
  2. <div class="nygs">
  3. <el-container style="height:520px;">
  4. <el-aside width="300px" style="border:1px solid #d5d5ff">
  5. <p class="aside_title">
  6. <el-button type="text" @click="addVillage">添加行政村</el-button>
  7. </p>
  8. <el-tree :data="treeData" :props="defaultPropsXzc" @node-click="handleNodeClickXzc"
  9. node-key="id"
  10. default-expand-all
  11. :expand-on-click-node="false">
  12. <span class="custom-tree-node" slot-scope="{ node, data }">
  13. <span>{{ node.label }}</span>
  14. <span class="mr10">
  15. <i class="el-icon-delete" @click.stop="removeNode(node, data)"></i>
  16. </span>
  17. </span>
  18. </el-tree>
  19. </el-aside>
  20. <el-main style="border:1px solid #d5d5ff;margin-left:5px;padding:0;">
  21. <el-card class="box-card">
  22. <div slot="header" class="clearfix">
  23. <span>贫困户</span>
  24. <el-button style="float: right; padding: 3px 0" type="text" @click="addYsh">添加</el-button>
  25. </div>
  26. <ul class="ul_height">
  27. <li v-for="(item,index) in yshList" :key="index" class="text item lh40">
  28. <p @click="yshRow(item)">
  29. {{ item.userNm }}
  30. <span class="flr"><i class="el-icon-delete" @click.stop="yshDelete(item)"></i></span>
  31. </p>
  32. </li>
  33. </ul>
  34. </el-card>
  35. <el-card class="box-card mt20">
  36. <div slot="header" class="clearfix">
  37. <span>供水单位</span>
  38. <el-button style="float: right; padding: 3px 0" type="text" @click="addGsdw">添加</el-button>
  39. </div>
  40. <ul class="ul_height">
  41. <li v-for="(item,index) in gsdwList" :key="index" class="text item lh40">
  42. <p @click="gsdwRow(item)">
  43. {{ item.prjNm }}
  44. <span class="flr"><i class="el-icon-delete" @click.stop="gsdwDelete(item)"></i></span>
  45. </p>
  46. </li>
  47. </ul>
  48. </el-card>
  49. </el-main>
  50. </el-container>
  51. <!--添加行政村-->
  52. <el-dialog
  53. class="outerDialog custom_dialog"
  54. title="添加行政村"
  55. width="40%"
  56. :visible.sync="villageVisible"
  57. :modal-append-to-body="true"
  58. :append-to-body="true">
  59. <el-container style="height:520px;">
  60. <el-aside width="300px" style="border:1px solid #d5d5ff">
  61. <p class="aside_title village_title">{{rowData.nm}}</p>
  62. <el-tree :data="villageTreeData" :props="defaultProps" @node-click="handleNodeClick"></el-tree>
  63. </el-aside>
  64. <el-main style="border:1px solid #d5d5ff;margin-left:5px;padding:0px;">
  65. <el-table
  66. ref="multipleTable"
  67. :data="villageTableData"
  68. tooltip-effect="dark"
  69. max-height="510"
  70. style="width: 100%"
  71. @selection-change="handleSelectionChange">
  72. <el-table-column
  73. type="selection"
  74. width="55">
  75. </el-table-column>
  76. <el-table-column
  77. prop="adName"
  78. label="行政村名称"
  79. min-width="120"
  80. show-overflow-tooltip>
  81. </el-table-column>
  82. <el-table-column
  83. prop="isPoveryt"
  84. label="是否贫困村"
  85. min-width="120">
  86. <template slot-scope="scope">
  87. <span>{{ scope.row.isPoveryt == '1' ? "是" : "否"}}</span>
  88. </template>
  89. </el-table-column>
  90. </el-table>
  91. </el-main>
  92. </el-container>
  93. <span slot="footer">
  94. <el-button style="margin-top:5px;" @click="villageSave">确定</el-button>
  95. </span>
  96. </el-dialog>
  97. <!--贫困户-->
  98. <el-dialog
  99. class="outerDialog custom_dialog"
  100. title="添加贫困户"
  101. width="40%"
  102. :visible.sync="wateruserVisible"
  103. :close-on-click-modal="false"
  104. :modal-append-to-body="true"
  105. :append-to-body="true">
  106. <el-form :model="wateruserForm" ref="wateruserForm" label-width="200px">
  107. <el-form-item label="户主姓名" required>
  108. <el-input type="text" v-model="wateruserForm.userNm" clearable placeholder="请输入户主姓名"
  109. style="width:60%;"></el-input>
  110. </el-form-item>
  111. <el-form-item label="联系方式">
  112. <el-input type="text" v-model="wateruserForm.telphone" clearable placeholder="请输入联系方式"
  113. style="width:60%;"></el-input>
  114. </el-form-item>
  115. </el-form>
  116. <span slot="footer">
  117. <el-button style="margin-top:5px;" @click="waterUserSave">确定</el-button>
  118. </span>
  119. </el-dialog>
  120. <waterUser v-if="waterUserTianBaoVisible" :yshRowData="yshRowData" :rowData="rowData" @closeDialog="closeDialog"
  121. @addShuiKuSuccess="addShuiKuSuccess" :currentObjectId="currentObjectId"
  122. :oriFatherName="oriFatherName" :villageNm="villageNm"></waterUser>
  123. <countryPro v-if="countryProTianBaoVisible" :gsgcRowData="gsgcRowData" :rowData="rowData"
  124. @closeDialog="closeGsGcDialog"
  125. @addShuiKuSuccess="addShuiKuSuccess" :currentObjectId="currentObjectId"
  126. :oriFatherName="oriFatherName" :villageNm="villageNm"></countryPro>
  127. <!--添加供水工程-->
  128. <editDcdxInfo v-if="gsgcVisible" ref="editDcdxInfoRef" objType="25" :rowData="rowData"
  129. :villageAdCode="villageAdCode"
  130. @addSuccess="DuiXiangAddSuccessHandler"
  131. @closeDuChaDuiXiangDialog="closeDuChaDuiXiangDialog"></editDcdxInfo>
  132. </div>
  133. </template>
  134. <script>
  135. import inputWith from "@widget/inuptWith.vue"
  136. import request from "@util/gw_ajax_request.js"
  137. import waterUser from "./waterUser"
  138. import countryPro from "./countryPro"
  139. export default {
  140. components: {
  141. inputWith: inputWith,
  142. // problemDialog
  143. waterUser: waterUser,//贫困户填报
  144. editDcdxInfo: resolve => {
  145. require(['./editDcdxInfo.vue'], resolve)
  146. },//添加供水工程
  147. countryPro
  148. },
  149. props: ['currentObjectId', 'currentObjectName', 'currentObjectRgstrId', 'rowData'],
  150. data() {
  151. var checkTel = (rule, value, callback) => {
  152. if (value == '') {
  153. callback();
  154. }
  155. if (isNaN(value)) {
  156. callback(new Error('请输入合理电话'));
  157. }
  158. var isPhone = /^([0-9]{3,4}-)?[0-9]{7,8}$/; //座机
  159. var isMob = /^[1][3,4,5,7,8,9][0-9]{9}$/; // 座机格式
  160. if (!isMob.test(value) && !isPhone.test(value)) {
  161. callback(new Error('请输入合理电话'));
  162. } else {
  163. callback();
  164. }
  165. };
  166. return {
  167. yshList: [],
  168. gsdwList: [],
  169. wateruserVisible: false,
  170. villageVisible: false,
  171. waterUserTianBaoVisible: false,
  172. countryProTianBaoVisible: false,
  173. gsgcVisible: false,
  174. waterUserDialog: false,
  175. villageTableData: [],
  176. multipleSelection: [],
  177. wateruserForm: {
  178. userNm: "",
  179. telphone: "",
  180. },
  181. treeData: [],
  182. villageTreeData: [],
  183. defaultProps: {
  184. // children: 'children',
  185. label: 'adName'
  186. },
  187. defaultPropsXzc: {
  188. children: 'dcuserRelVilles',
  189. label: 'townName'
  190. },
  191. adCodes: "",
  192. townName: "",
  193. villageNm: "",
  194. adCode: "",
  195. yshRowData: null,
  196. gsgcRowData: null,
  197. rules: {
  198. telphone: [{
  199. validator: checkTel,
  200. trigger: 'change',
  201. }],
  202. },
  203. oriFatherName: "",
  204. villageAdCode: ""
  205. }
  206. },
  207. computed: {
  208. recPersId() {
  209. return localStorage.getItem("userid") ? localStorage.getItem("userid") : ''
  210. }
  211. },
  212. created() {
  213. },
  214. mounted() {
  215. this.getLeftTreeData();
  216. },
  217. watch: {
  218. // currentObjectRgstrId(n, o) {
  219. // this.getRgstridObj();
  220. // },
  221. },
  222. methods: {
  223. //添加行政村
  224. addVillage() {
  225. this.villageVisible = true;
  226. this.getVillageTreeList();
  227. },
  228. getVillageTreeList() {
  229. request.get(`/bis/rdwsp/rgstr/findCheckTree/${this.rowData.code}/${this.currentObjectRgstrId}`)
  230. .then(res => {
  231. if (res.success && res.data) {
  232. this.$nextTick(() => {
  233. if (res.data.length) {
  234. this.villageTreeData = res.data;
  235. let length = this.villageTreeData - 1
  236. this.villageTableData = res.data[length].attCountryDtoList;
  237. this.townName = res.data[length].adName;
  238. }
  239. })
  240. }
  241. })
  242. },
  243. //villageSave添加行政村确定
  244. villageSave() {
  245. if (!this.multipleSelection.length) {
  246. this.$message.warning("请至少选择一个行政村");
  247. return;
  248. }
  249. let obj = [{
  250. "codes": this.adCodes,
  251. "regstrId": this.rowData.rgstrId,
  252. "townName": this.townName
  253. }]
  254. request.post(`/bis/rdwsp/rgstr/rel/vill/addbatch`, obj)
  255. .then(res => {
  256. if (res.success) {
  257. this.$message.success("添加行政村成功");
  258. this.getLeftTreeData();
  259. this.villageVisible = false;
  260. } else {
  261. this.$message.warning(res.message);
  262. }
  263. })
  264. },
  265. handleSelectionChange(val) {
  266. this.adCodes = "";
  267. this.multipleSelection = val;
  268. this.multipleSelection.map(i => {
  269. return this.adCodes += i.adCode + ";";
  270. })
  271. this.adCodes = this.adCodes.substr(0, this.adCodes.length - 1);
  272. },
  273. //左侧树数据
  274. async getLeftTreeData() {
  275. await request.get(`/bis/rdwsp/rgstr/findTree/${this.rowData.code}/${this.currentObjectRgstrId}`)
  276. .then(res => {
  277. if (res.success && res.data) {
  278. this.treeData = res.data;
  279. this.treeData.forEach(i => {
  280. if (i["dcuserRelVilles"]) {
  281. i["dcuserRelVilles"].forEach(j => {
  282. j.townName = j.villageNm;
  283. })
  284. }
  285. })
  286. this.adCode = this.treeData[0].dcuserRelVilles[0].adCode ? this.treeData[0].dcuserRelVilles[0].adCode : "";
  287. this.villageAdCode = this.treeData[0].dcuserRelVilles[0].adCode ? this.treeData[0].dcuserRelVilles[0].adCode : "";
  288. this.villageNm = this.treeData[0].dcuserRelVilles[0].villageNm ? this.treeData[0].dcuserRelVilles[0].villageNm : "";
  289. this.oriFatherName = this.treeData[0].townName ? this.treeData[0].townName : "";
  290. console.log(this.villageNm, this.oriFatherName);
  291. }
  292. })
  293. await this.getYsGsdwList(this.adCode, this.rowData.rgstrId);
  294. },
  295. //获取贫困户、供水单位列表
  296. getYsGsdwList(code, regstrId) {
  297. request.get(`/bis/rdwsp/rgstr/findNode/${code}/${regstrId}`)
  298. .then(res => {
  299. if (res.success) {
  300. this.$nextTick(() => {
  301. this.gsdwList = res.data.countryPro;
  302. this.yshList = res.data.waterUsers;
  303. })
  304. }
  305. })
  306. },
  307. //贫困户添加
  308. addYsh() {
  309. if (this.adCode) {
  310. for (var obj in this.wateruserForm) {
  311. this.wateruserForm[obj] = '';
  312. }
  313. this.wateruserVisible = true;
  314. } else {
  315. this.$message.warning("请选择左侧行政村");
  316. }
  317. },
  318. //添加贫困户保存
  319. waterUserSave() {
  320. if (!this.wateruserForm.userNm) {
  321. this.$message.warning("请填写贫困户户主姓名");
  322. return;
  323. }
  324. let obj = {
  325. villageNm: this.villageNm,
  326. adCode: this.adCode,
  327. userNm: this.wateruserForm.userNm,
  328. telphone: this.wateruserForm.telphone,
  329. regstrId: this.rowData.rgstrId,
  330. }
  331. request.post(`/bis/rdwsp/rgstr/poor`, obj)
  332. .then(res => {
  333. if (res.success) {
  334. this.$message.success("添加贫困户成功");
  335. this.wateruserVisible = false;
  336. this.getYsGsdwList(this.adCode, this.rowData.rgstrId);
  337. this.yshRow(res.data);
  338. }
  339. })
  340. },
  341. //贫困户row
  342. yshRow(row) {
  343. this.yshRowData = row;
  344. this.waterUserTianBaoVisible = true;
  345. },
  346. //贫困户删除
  347. yshDelete(row) {
  348. this.$confirm('确定要删除该数据, 是否继续?', '提示', {
  349. confirmButtonText: '确定',
  350. cancelButtonText: '取消',
  351. type: 'warning'
  352. }).then(() => {
  353. request.get(`/bis/rdwsp/rgstr/poor/del/${row.id}`)
  354. .then(res => {
  355. if (res.success) {
  356. this.$message.success("删除成功");
  357. this.getYsGsdwList(this.adCode, this.rowData.rgstrId);
  358. } else {
  359. this.$message.warning(res.message);
  360. }
  361. })
  362. .catch(err => {
  363. console.log(err);
  364. })
  365. }).catch(() => {
  366. this.$message({
  367. type: 'info',
  368. message: '已取消删除'
  369. });
  370. });
  371. },
  372. //供水单位添加
  373. addGsdw() {
  374. if (this.adCode) {
  375. this.gsgcVisible = true;
  376. } else {
  377. this.$message.warning("请选择左侧行政村");
  378. }
  379. },
  380. //供水单位row
  381. gsdwRow(row) {
  382. this.gsgcRowData = row;
  383. this.countryProTianBaoVisible = true;
  384. },
  385. //供水单位删除
  386. gsdwDelete(row) {
  387. this.$confirm('确定要删除该数据, 是否继续?', '提示', {
  388. confirmButtonText: '确定',
  389. cancelButtonText: '取消',
  390. type: 'warning'
  391. }).then(() => {
  392. request.get(`/bis/bis/rdwsp/rgstr/fee/del/${row.id}`)
  393. .then(res => {
  394. if (res.success) {
  395. this.$message.success("删除成功");
  396. this.getYsGsdwList(this.adCode, this.rowData.rgstrId);
  397. } else {
  398. this.$message.warning(res.message);
  399. }
  400. })
  401. .catch(err => {
  402. console.log(err);
  403. })
  404. }).catch(() => {
  405. this.$message({
  406. type: 'info',
  407. message: '已取消删除'
  408. });
  409. });
  410. },
  411. handleNodeClick(data) {
  412. this.$nextTick(() => {
  413. this.townName = data.adName;
  414. this.villageTableData = data.attCountryDtoList;
  415. })
  416. },
  417. handleNodeClickXzc(node, data) {
  418. this.$nextTick(() => {
  419. console.log(node, data);
  420. if (node.adCode && node.villageNm) {
  421. this.oriFatherName = data.parent.data.townName;
  422. this.adCode = node.adCode;
  423. this.villageNm = node.villageNm;
  424. this.getYsGsdwList(node.adCode, node.regstrId);
  425. this.villageAdCode = node.adCode;
  426. }
  427. })
  428. },
  429. closeDialog() {
  430. this.waterUserTianBaoVisible = false;
  431. },
  432. closeGsGcDialog(val) {
  433. this.countryProTianBaoVisible = false;
  434. if (val === "success") {
  435. this.getYsGsdwList(this.adCode, this.rowData.rgstrId);
  436. }
  437. },
  438. addShuiKuSuccess() {
  439. this.waterUserTianBaoVisible = false;
  440. },
  441. // 删除左侧树行政村
  442. removeNode(node, data) {
  443. if (data.id) {
  444. this.$confirm('确定清空督查数据并将该村从督查任务中删除, 是否继续?', '提示', {
  445. confirmButtonText: '确定',
  446. cancelButtonText: '取消',
  447. type: 'warning'
  448. }).then(() => {
  449. request.get(`/bis/rdwsp/rgstr/rel/vill/del/${data.id}`)
  450. .then(res => {
  451. if (res.success) {
  452. this.$message.success("删除成功");
  453. this.getLeftTreeData();
  454. } else {
  455. this.$message.warning(res.message);
  456. }
  457. })
  458. .catch(err => {
  459. console.log(err);
  460. })
  461. }).catch(() => {
  462. this.$message({
  463. type: 'info',
  464. message: '已取消删除'
  465. });
  466. });
  467. }
  468. },
  469. DuiXiangAddSuccessHandler: function () {
  470. this.gsgcVisible = false;
  471. this.getYsGsdwList(this.adCode, this.rowData.rgstrId);
  472. },
  473. closeDuChaDuiXiangDialog() {
  474. this.gsgcVisible = false;
  475. }
  476. }
  477. }
  478. </script>
  479. <style lang="scss">
  480. /*.nygs{*/
  481. .aside_title {
  482. padding-right: 10px;
  483. height: 30px;
  484. line-height: 30px;
  485. text-align: end;
  486. border-bottom: 1px solid rgb(235, 238, 245);
  487. background-color: #d5d5ff;
  488. }
  489. .village_title {
  490. text-align: center;
  491. }
  492. .ul_height {
  493. height: 160px;
  494. overflow: auto;
  495. }
  496. .box-card {
  497. /*height: 200px;*/
  498. overflow: auto;
  499. }
  500. /*.mt20{*/
  501. /*margin-top: 20px;*/
  502. /*}*/
  503. .lh40 {
  504. list-style: none;
  505. height: 40px;
  506. line-height: 40px;
  507. cursor: pointer;
  508. padding: 0 10px;
  509. border-bottom: 1px solid rgb(235, 238, 245);
  510. }
  511. .flr {
  512. float: right;
  513. margin-right: 20px;
  514. }
  515. .nygs span.custom-tree-node {
  516. width: 100%;
  517. }
  518. .mr10 {
  519. margin-right: 20px;
  520. float: right;
  521. }
  522. .nygs .el-tree-node__content {
  523. height: 40px;
  524. line-height: 40px;
  525. }
  526. .nygs .el-tree > div > div:first-child .mr10 {
  527. display: none;
  528. }
  529. .nygs .el-tree-node.is-current > .el-tree-node__content {
  530. background-color: gainsboro !important;
  531. }
  532. /*}*/
  533. </style>