df2960499492e4d45380a8692bb05ab92199f775.svn-base 17 KB

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