525ece0e0cbe5c5fa030d20f53b46ae5c98b79e7.svn-base 18 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565
  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.projectNm }}
  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" :oriFatherName="oriFatherName"
  122. :villageNm="villageNm"></waterUser>
  123. <countryPro v-if="countryProTianBaoVisible" :gsgcRowData="gsgcRowData" :rowData="rowData"
  124. @closeDialog="closeGsGcDialog"
  125. @addShuiKuSuccess="addShuiKuSuccess" :currentObjectId="currentObjectId" :oriFatherName="oriFatherName"
  126. :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][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/new/vill/rgstr/findCheckTree/${this.rowData.code}/${this.rowData.regstrId}`)
  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.regstrId,
  252. "townName": this.townName
  253. }]
  254. request.post(`/bis/new/dcuser/rel/vill/addbatch`, obj)
  255. .then(res => {
  256. if (res.success) {
  257. this.$message.success("添加行政村成功");
  258. this.getLeftTreeData();
  259. this.getYsGsdwList(this.adCode, this.rowData.regstrId);
  260. this.villageVisible = false;
  261. } else {
  262. this.$message.warning(res.message);
  263. }
  264. })
  265. },
  266. handleSelectionChange(val) {
  267. this.adCodes = "";
  268. this.multipleSelection = val;
  269. this.multipleSelection.map(i => {
  270. return this.adCodes += i.adCode + ";";
  271. })
  272. this.adCodes = this.adCodes.substr(0, this.adCodes.length - 1);
  273. },
  274. //左侧树数据
  275. getLeftTreeData() {
  276. request.get(`/bis/new/vill/rgstr/findTree/${this.rowData.code}/${this.rowData.regstrId}`)
  277. .then(res => {
  278. if (res.success && res.data) {
  279. this.treeData = res.data;
  280. this.treeData.forEach(i => {
  281. if (i["dcuserRelVilles"]) {
  282. i["dcuserRelVilles"].forEach(j => {
  283. j.townName = j.villageNm;
  284. })
  285. }
  286. })
  287. this.adCode = this.treeData[0].dcuserRelVilles[0].adCode ? this.treeData[0].dcuserRelVilles[0].adCode : "";
  288. this.villageAdCode = this.treeData[0].dcuserRelVilles[0].adCode ? this.treeData[0].dcuserRelVilles[0].adCode : "";
  289. this.villageNm = this.treeData[0].dcuserRelVilles[0].villageNm ? this.treeData[0].dcuserRelVilles[0].villageNm : "";
  290. this.oriFatherName = this.treeData[0].townName ? this.treeData[0].townName : "";
  291. console.log(this.villageNm, this.oriFatherName);
  292. this.getYsGsdwList(this.adCode, this.rowData.regstrId);
  293. }
  294. })
  295. },
  296. //获取用水户、供水单位列表
  297. getYsGsdwList(code, regstrId) {
  298. request.get(`/bis/new/vill/rgstr/findNode/${code}/${regstrId}`)
  299. .then(res => {
  300. if (res.success) {
  301. this.$nextTick(() => {
  302. this.gsdwList = res.data.countryPro;
  303. this.yshList = res.data.waterUsers;
  304. })
  305. }
  306. })
  307. },
  308. //用水户添加
  309. addYsh() {
  310. if (this.adCode) {
  311. for (var obj in this.wateruserForm) {
  312. this.wateruserForm[obj] = '';
  313. }
  314. this.wateruserVisible = true;
  315. } else {
  316. this.$message.warning("请选择左侧行政村");
  317. }
  318. },
  319. //添加用水户保存
  320. waterUserSave() {
  321. if (!this.wateruserForm.userNm) {
  322. this.$message.warning("请填写用水户户主姓名");
  323. return;
  324. }
  325. let obj = {
  326. villageNm: this.villageNm,
  327. adCode: this.adCode,
  328. userNm: this.wateruserForm.userNm,
  329. telphone: this.wateruserForm.telphone,
  330. regstrId: this.rowData.regstrId,
  331. }
  332. request.post(`bis/new/wateruser/info`, obj)
  333. .then(res => {
  334. if (res.success) {
  335. this.$message.success("添加用水户成功");
  336. this.wateruserVisible = false;
  337. this.getYsGsdwList(this.adCode, this.rowData.regstrId);
  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/new/wateruser/info/del/${row.id}`)
  354. .then(res => {
  355. if (res.success) {
  356. this.$message.success("删除成功");
  357. this.getYsGsdwList(this.adCode, this.rowData.regstrId);
  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/new/country/fee/del/${row.id}`)
  393. .then(res => {
  394. if (res.success) {
  395. this.$message.success("删除成功");
  396. this.getYsGsdwList(this.adCode, this.rowData.regstrId);
  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. console.log(node, data, '12131')
  419. this.$nextTick(() => {
  420. console.log(node, data);
  421. if (node.adCode && node.villageNm) {
  422. this.oriFatherName = data.parent.data.townName;
  423. this.adCode = node.adCode;
  424. this.villageNm = node.villageNm;
  425. this.getYsGsdwList(node.adCode, node.regstrId);
  426. this.villageAdCode = node.adCode;
  427. }
  428. })
  429. },
  430. closeDialog() {
  431. this.waterUserTianBaoVisible = false;
  432. },
  433. closeGsGcDialog(val) {
  434. this.countryProTianBaoVisible = false;
  435. if (val === "success") {
  436. this.getYsGsdwList(this.adCode, this.rowData.regstrId);
  437. }
  438. },
  439. addShuiKuSuccess() {
  440. this.waterUserTianBaoVisible = false;
  441. },
  442. // 删除左侧树行政村
  443. removeNode(node, data) {
  444. if (data.id) {
  445. this.$confirm('确定清空督查数据并将该村从督查任务中删除, 是否继续?', '提示', {
  446. confirmButtonText: '确定',
  447. cancelButtonText: '取消',
  448. type: 'warning'
  449. }).then(() => {
  450. request.get(`/bis/new/dcuser/rel/vill/del/${data.id}`)
  451. .then(res => {
  452. if (res.success) {
  453. this.$message.success("删除成功");
  454. this.getLeftTreeData();
  455. } else {
  456. this.$message.warning(res.message);
  457. }
  458. })
  459. .catch(err => {
  460. console.log(err);
  461. })
  462. }).catch(() => {
  463. this.$message({
  464. type: 'info',
  465. message: '已取消删除'
  466. });
  467. });
  468. }
  469. },
  470. DuiXiangAddSuccessHandler: function () {
  471. this.gsgcVisible = false;
  472. this.getYsGsdwList(this.adCode, this.rowData.regstrId);
  473. },
  474. closeDuChaDuiXiangDialog() {
  475. this.gsgcVisible = false;
  476. }
  477. }
  478. }
  479. </script>
  480. <style lang="scss">
  481. /*.nygs{*/
  482. .aside_title {
  483. padding-right: 10px;
  484. height: 30px;
  485. line-height: 30px;
  486. text-align: end;
  487. border-bottom: 1px solid rgb(235, 238, 245);
  488. background-color: #d5d5ff;
  489. }
  490. .village_title {
  491. text-align: center;
  492. }
  493. .ul_height {
  494. height: 160px;
  495. overflow: auto;
  496. }
  497. .box-card {
  498. /*height: 200px;*/
  499. overflow: auto;
  500. }
  501. /*.mt20{*/
  502. /*margin-top: 20px;*/
  503. /*}*/
  504. .lh40 {
  505. list-style: none;
  506. height: 40px;
  507. line-height: 40px;
  508. cursor: pointer;
  509. padding: 0 10px;
  510. border-bottom: 1px solid rgb(235, 238, 245);
  511. }
  512. .flr {
  513. float: right;
  514. margin-right: 20px;
  515. }
  516. .nygs span.custom-tree-node {
  517. width: 100%;
  518. }
  519. .mr10 {
  520. margin-right: 20px;
  521. float: right;
  522. }
  523. .nygs .el-tree-node__content {
  524. height: 40px;
  525. line-height: 40px;
  526. }
  527. .nygs .el-tree > div > div:first-child .mr10 {
  528. display: none;
  529. }
  530. .nygs .el-tree-node.is-current > .el-tree-node__content {
  531. background-color: gainsboro !important;
  532. }
  533. /*}*/
  534. </style>