a270bdd44d5716b52cdfce553a36f65baa76994e.svn-base 21 KB

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