76e357a838e236f8d092d63aa21d898ea6aabfc5.svn-base 18 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573
  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="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" v-if="openType">添加</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" v-if="openType" @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" v-if="openType">添加</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" v-if="openType" @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.adName}}</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" :openType="openType" @closeDialog="closeDialog"
  121. @addShuiKuSuccess="addShuiKuSuccess" :currentObjectId="currentObjectId" :oriFatherName="oriFatherName"
  122. :villageNm="villageNm"></waterUser>
  123. <countryPro v-if="countryProTianBaoVisible" :gsgcRowData="gsgcRowData" :rowData="rowData" :openType="openType"
  124. @closeDialog="closeGsGcDialog"
  125. @addShuiKuSuccess="addShuiKuSuccess" :currentObjectId="currentObjectId" :oriFatherName="oriFatherName"
  126. :villageNm="villageNm"></countryPro>
  127. <!--添加供水工程-->
  128. <editDcdxInfo1 v-if="gsgcVisible" ref="editDcdxInfoRef" objType="71" :rowData="rowData"
  129. :villageAdCode="villageAdCode"
  130. @addSuccess="DuiXiangAddSuccessHandler"
  131. @closeDuChaDuiXiangDialog="closeDuChaDuiXiangDialog"></editDcdxInfo1>
  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 "./waterUser1"
  138. import countryPro from "./countryPro1"
  139. export default {
  140. components: {
  141. inputWith: inputWith,
  142. // problemDialog
  143. waterUser: waterUser,//用水户填报
  144. editDcdxInfo1: resolve => {
  145. require(['./editDcdxInfo1.vue'], resolve)
  146. },//添加供水工程
  147. countryPro
  148. },
  149. props: ['currentObjectId', 'currentObjectName', 'currentObjectRgstrId', 'rowData','openType'],
  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/insp/villqh/findCheckTree/${this.rowData.adCode}/${this.rowData.rgstrId}`)
  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/insp/villqh/rel/addbatch`, obj)
  255. .then(res => {
  256. if (res.success) {
  257. this.$message.success("添加行政村成功");
  258. this.getLeftTreeData();
  259. this.getYsGsdwList(this.adCode, this.rowData.rgstrId);
  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/insp/villqh/findTree/${this.rowData.adCode}/${this.rowData.rgstrId}`)
  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. j.adCode = j.villCode;
  285. })
  286. }
  287. })
  288. this.adCode = this.treeData[0].dcuserRelVilles[0].villCode ? this.treeData[0].dcuserRelVilles[0].villCode : "";
  289. this.villageAdCode = this.treeData[0].dcuserRelVilles[0].villCode ? this.treeData[0].dcuserRelVilles[0].villCode : "";
  290. this.villageNm = this.treeData[0].dcuserRelVilles[0].villageNm ? this.treeData[0].dcuserRelVilles[0].villageNm : "";
  291. this.oriFatherName = this.treeData[0].townName ? this.treeData[0].townName : "";
  292. console.log(this.villageNm, this.oriFatherName);
  293. this.getYsGsdwList(this.adCode, this.rowData.rgstrId);
  294. }
  295. })
  296. },
  297. //获取用水户、供水单位列表
  298. getYsGsdwList(code, rgstrId) {
  299. request.get(`/bis/insp/villqh/findNode/${code}/${rgstrId}`)
  300. .then(res => {
  301. if (res.success) {
  302. this.$nextTick(() => {
  303. this.gsdwList = res.data.fee;
  304. this.yshList = res.data.poor;
  305. })
  306. }
  307. })
  308. },
  309. //用水户添加
  310. addYsh() {
  311. if (this.adCode) {
  312. for (var obj in this.wateruserForm) {
  313. this.wateruserForm[obj] = '';
  314. }
  315. this.wateruserVisible = true;
  316. } else {
  317. this.$message.warning("请选择左侧行政村");
  318. }
  319. },
  320. //添加用水户保存
  321. waterUserSave() {
  322. if (!this.wateruserForm.userNm) {
  323. this.$message.warning("请填写用水户户主姓名");
  324. return;
  325. }
  326. let obj = {
  327. villageNm: this.villageNm,
  328. adCode: this.adCode,
  329. userNm: this.wateruserForm.userNm,
  330. telphone: this.wateruserForm.telphone,
  331. regstrId: this.rowData.rgstrId,
  332. }
  333. request.post(`/bis/insp/villqh/poor`, obj)
  334. .then(res => {
  335. if (res.success) {
  336. this.$message.success("添加用水户成功");
  337. this.wateruserVisible = false;
  338. this.getYsGsdwList(this.adCode, this.rowData.rgstrId);
  339. }
  340. })
  341. },
  342. //用水户row
  343. yshRow(row) {
  344. this.yshRowData = row;
  345. this.waterUserTianBaoVisible = true;
  346. },
  347. //用水户删除
  348. yshDelete(row) {
  349. this.$confirm('确定要删除该数据, 是否继续?', '提示', {
  350. confirmButtonText: '确定',
  351. cancelButtonText: '取消',
  352. type: 'warning'
  353. }).then(() => {
  354. request.post(`/bis/insp/villqh/poor/delete/${row.id}`)
  355. .then(res => {
  356. if (res.success) {
  357. this.$message.success("删除成功");
  358. this.getYsGsdwList(this.adCode, this.rowData.rgstrId);
  359. } else {
  360. this.$message.warning(res.message);
  361. }
  362. })
  363. .catch(err => {
  364. console.log(err);
  365. })
  366. }).catch(() => {
  367. this.$message({
  368. type: 'info',
  369. message: '已取消删除'
  370. });
  371. });
  372. },
  373. //供水单位添加
  374. addGsdw() {
  375. if (this.adCode) {
  376. this.gsgcVisible = true;
  377. } else {
  378. this.$message.warning("请选择左侧行政村");
  379. }
  380. },
  381. //供水单位row
  382. gsdwRow(row) {
  383. this.gsgcRowData = row;
  384. this.countryProTianBaoVisible = true;
  385. },
  386. //供水单位删除
  387. gsdwDelete(row) {
  388. this.$confirm('确定要删除该数据, 是否继续?', '提示', {
  389. confirmButtonText: '确定',
  390. cancelButtonText: '取消',
  391. type: 'warning'
  392. }).then(() => {
  393. request.post(`/bis/insp/villqh/fee/delete/${row.id}`)
  394. .then(res => {
  395. if (res.success) {
  396. this.$message.success("删除成功");
  397. this.getYsGsdwList(this.adCode, this.rowData.rgstrId);
  398. } else {
  399. this.$message.warning(res.message);
  400. }
  401. })
  402. .catch(err => {
  403. console.log(err);
  404. })
  405. }).catch(() => {
  406. this.$message({
  407. type: 'info',
  408. message: '已取消删除'
  409. });
  410. });
  411. },
  412. handleNodeClick(data) {
  413. this.$nextTick(() => {
  414. this.townName = data.adName;
  415. this.villageTableData = data.attCountryDtoList;
  416. })
  417. },
  418. handleNodeClickXzc(node, data) {
  419. console.log(node, data, '12131')
  420. this.$nextTick(() => {
  421. console.log(node, data);
  422. if (node.adCode && node.villageNm) {
  423. this.oriFatherName = data.parent.data.townName;
  424. this.adCode = node.adCode;
  425. this.villageNm = node.villageNm;
  426. this.getYsGsdwList(node.villCode, node.rgstrId);
  427. this.villageAdCode = node.adCode;
  428. }
  429. })
  430. },
  431. closeDialog() {
  432. this.waterUserTianBaoVisible = false;
  433. },
  434. closeGsGcDialog(val) {
  435. this.countryProTianBaoVisible = false;
  436. if (val === "success") {
  437. this.getYsGsdwList(this.adCode, this.rowData.rgstrId);
  438. }
  439. },
  440. addShuiKuSuccess() {
  441. this.waterUserTianBaoVisible = false;
  442. },
  443. // 删除左侧树行政村
  444. removeNode(node, data) {
  445. if (data.id) {
  446. this.$confirm('确定清空督查数据并将该村从督查任务中删除, 是否继续?', '提示', {
  447. confirmButtonText: '确定',
  448. cancelButtonText: '取消',
  449. type: 'warning'
  450. }).then(() => {
  451. request.post(`/bis/insp/villqh/rel/delete/${data.id}`)
  452. .then(res => {
  453. if (res.success) {
  454. this.$message.success("删除成功");
  455. this.getLeftTreeData();
  456. } else {
  457. this.$message.warning(res.message);
  458. }
  459. })
  460. .catch(err => {
  461. console.log(err);
  462. })
  463. }).catch(() => {
  464. this.$message({
  465. type: 'info',
  466. message: '已取消删除'
  467. });
  468. });
  469. }
  470. },
  471. DuiXiangAddSuccessHandler: function () {
  472. this.gsgcVisible = false;
  473. this.getYsGsdwList(this.adCode, this.rowData.rgstrId);
  474. },
  475. closeDuChaDuiXiangDialog() {
  476. this.gsgcVisible = false;
  477. }
  478. }
  479. }
  480. </script>
  481. <style lang="scss">
  482. /*.nygs{*/
  483. .aside_title {
  484. padding-right: 10px;
  485. height: 30px;
  486. line-height: 30px;
  487. text-align: end;
  488. border-bottom: 1px solid rgb(235, 238, 245);
  489. background-color: #d5d5ff;
  490. }
  491. .village_title {
  492. text-align: center;
  493. }
  494. .ul_height {
  495. height: 160px;
  496. overflow: auto;
  497. }
  498. .box-card {
  499. /*height: 200px;*/
  500. overflow: auto;
  501. }
  502. /*.mt20{*/
  503. /*margin-top: 20px;*/
  504. /*}*/
  505. .lh40 {
  506. list-style: none;
  507. height: 40px;
  508. line-height: 40px;
  509. cursor: pointer;
  510. padding: 0 10px;
  511. border-bottom: 1px solid rgb(235, 238, 245);
  512. }
  513. .flr {
  514. float: right;
  515. margin-right: 20px;
  516. }
  517. .nygs span.custom-tree-node {
  518. width: 100%;
  519. }
  520. .mr10 {
  521. margin-right: 20px;
  522. float: right;
  523. }
  524. .nygs .el-tree-node__content {
  525. height: 40px;
  526. line-height: 40px;
  527. }
  528. .nygs .el-tree > div > div:first-child .mr10 {
  529. display: none;
  530. }
  531. .nygs .el-tree-node.is-current > .el-tree-node__content {
  532. background-color: gainsboro !important;
  533. }
  534. /*}*/
  535. </style>