e9830b34e391cf3754c91e6b194ead401073a7c1.svn-base 18 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567
  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.nm }}
  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. <!-- -->
  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. <p class="aside_title village_title">{{rowData.adName}}</p>
  66. <el-table
  67. ref="multipleTable"
  68. :data="villageTableData"
  69. tooltip-effect="dark"
  70. max-height="510"
  71. style="width: 100%"
  72. @selection-change="handleSelectionChange">
  73. <el-table-column
  74. type="selection"
  75. width="55">
  76. </el-table-column>
  77. <el-table-column
  78. prop="adName"
  79. label="团"
  80. align="center"
  81. min-width="120"
  82. show-overflow-tooltip>
  83. </el-table-column>
  84. </el-table>
  85. </el-main>
  86. </el-container>
  87. <span slot="footer">
  88. <el-button style="margin-top:5px;" @click="villageSave">确定</el-button>
  89. </span>
  90. </el-dialog>
  91. <!--用水户-->
  92. <el-dialog
  93. class="outerDialog custom_dialog"
  94. title="添加用水户"
  95. width="40%"
  96. :visible.sync="wateruserVisible"
  97. :close-on-click-modal="false"
  98. :modal-append-to-body="true"
  99. :append-to-body="true">
  100. <el-form :model="wateruserForm" ref="wateruserForm" label-width="200px">
  101. <el-form-item label="户主姓名" required>
  102. <el-input type="text" v-model="wateruserForm.userNm" clearable placeholder="请输入户主姓名"
  103. style="width:60%;"></el-input>
  104. </el-form-item>
  105. <el-form-item label="联系方式">
  106. <el-input type="text" v-model="wateruserForm.telphone" clearable placeholder="请输入联系方式"
  107. style="width:60%;"></el-input>
  108. </el-form-item>
  109. </el-form>
  110. <span slot="footer">
  111. <el-button style="margin-top:5px;" @click="waterUserSave">确定</el-button>
  112. </span>
  113. </el-dialog>
  114. <waterUser v-if="waterUserTianBaoVisible" :yshRowData="yshRowData" :rowData="rowData" :openType="openType" @closeDialog="closeDialog"
  115. @addShuiKuSuccess="addShuiKuSuccess" :currentObjectId="currentObjectId" :oriFatherName="oriFatherName"
  116. :villageNm="villageNm"></waterUser>
  117. <gongcheng1Xjbt v-if="countryProTianBaoVisible && (gsgcRowData.prjType=='3' || gsgcRowData.prjType=='4')" :gsgcRowData="gsgcRowData" :rowData="rowData" :openType="openType"
  118. @closeDialog="closeGsGcDialog"
  119. @addShuiKuSuccess="addShuiKuSuccess" :currentObjectId="currentObjectId" :oriFatherName="oriFatherName"
  120. :villageNm="villageNm"></gongcheng1Xjbt>
  121. <gongcheng2Xjbt v-if="countryProTianBaoVisible && (gsgcRowData.prjType=='1' || gsgcRowData.prjType=='2' || gsgcRowData.prjType=='5' || gsgcRowData.prjType=='6' || gsgcRowData.prjType=='7')" :gsgcRowData="gsgcRowData" :rowData="rowData" :openType="openType"
  122. @closeDialog="closeGsGcDialog"
  123. @addShuiKuSuccess="addShuiKuSuccess" :currentObjectId="currentObjectId" :oriFatherName="oriFatherName"
  124. :villageNm="villageNm"></gongcheng2Xjbt>
  125. <!--添加供水工程-->
  126. <editDcdxInfoXjbt v-if="gsgcVisible" ref="editDcdxInfoRef" objType="108" :rowData="rowData"
  127. :villageAdCode="villageAdCode"
  128. @addSuccess="DuiXiangAddSuccessHandler"
  129. @closeDuChaDuiXiangDialog="closeDuChaDuiXiangDialog"></editDcdxInfoXjbt>
  130. </div>
  131. </template>
  132. <script>
  133. import inputWith from "@widget/inuptWith.vue"
  134. import request from "@util/gw_ajax_request.js"
  135. import waterUser from "./waterUserXjbt"
  136. import gongcheng1Xjbt from "./gongcheng1Xjbt"
  137. import gongcheng2Xjbt from "./gongcheng2Xjbt"
  138. export default {
  139. components: {
  140. inputWith: inputWith,
  141. // problemDialog
  142. waterUser: waterUser,//用水户填报
  143. editDcdxInfoXjbt: resolve => {
  144. require(['./editDcdxInfoXjbt.vue'], resolve)
  145. },//添加供水工程
  146. gongcheng1Xjbt,
  147. gongcheng2Xjbt
  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/xjvill/findCheckTree/${this.rowData.rgstrId}`)
  230. .then(res => {
  231. if (res.success && res.data) {
  232. this.$nextTick(() => {
  233. if (res.data.length) {
  234. this.villageTableData = 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/xjvill/regm/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/xjvill/findTree/${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].id;
  289. this.villageAdCode = null;
  290. this.villageNm = null;
  291. this.oriFatherName = "";
  292. this.getYsGsdwList(this.adCode, this.rowData.rgstrId);
  293. }
  294. })
  295. },
  296. //获取用水户、供水单位列表
  297. getYsGsdwList(code, rgstrId) {
  298. request.get(`/bis/insp/xjvill/findNode/${this.adCode}/${rgstrId}`)
  299. .then(res => {
  300. if (res.success) {
  301. this.$nextTick(() => {
  302. this.gsdwList = res.data.fee;
  303. this.yshList = res.data.poor;
  304. })
  305. }
  306. })
  307. },
  308. //用水户添加
  309. addYsh() {
  310. for (var obj in this.wateruserForm) {
  311. this.wateruserForm[obj] = '';
  312. }
  313. this.wateruserVisible = true;
  314. },
  315. //添加用水户保存
  316. waterUserSave() {
  317. if (!this.wateruserForm.userNm) {
  318. this.$message.warning("请填写用水户户主姓名");
  319. return;
  320. }
  321. let obj = {
  322. villageNm: this.villageNm,
  323. regmId: this.adCode,
  324. userNm: this.wateruserForm.userNm,
  325. telphone: this.wateruserForm.telphone,
  326. rgstrId: this.rowData.rgstrId,
  327. }
  328. request.post(`/bis/insp/xjvill/usr`, obj)
  329. .then(res => {
  330. if (res.success) {
  331. this.$message.success("添加用水户成功");
  332. this.wateruserVisible = false;
  333. this.getYsGsdwList(this.adCode, this.rowData.rgstrId);
  334. }
  335. })
  336. },
  337. //用水户row
  338. yshRow(row) {
  339. this.yshRowData = row;
  340. this.waterUserTianBaoVisible = true;
  341. },
  342. //用水户删除
  343. yshDelete(row) {
  344. this.$confirm('确定要删除该数据, 是否继续?', '提示', {
  345. confirmButtonText: '确定',
  346. cancelButtonText: '取消',
  347. type: 'warning'
  348. }).then(() => {
  349. request.post(`/bis/insp/xjvill/usr/delete/${row.id}`)
  350. .then(res => {
  351. if (res.success) {
  352. this.$message.success("删除成功");
  353. this.getYsGsdwList(this.adCode, this.rowData.rgstrId);
  354. } else {
  355. this.$message.warning(res.message);
  356. }
  357. })
  358. .catch(err => {
  359. console.log(err);
  360. })
  361. }).catch(() => {
  362. this.$message({
  363. type: 'info',
  364. message: '已取消删除'
  365. });
  366. });
  367. },
  368. //供水单位添加
  369. addGsdw() {
  370. this.gsgcVisible = true;
  371. },
  372. //供水单位row
  373. gsdwRow(row) {
  374. this.gsgcRowData = row;
  375. this.countryProTianBaoVisible = true;
  376. },
  377. //供水单位删除
  378. gsdwDelete(row) {
  379. this.$confirm('确定要删除该数据, 是否继续?', '提示', {
  380. confirmButtonText: '确定',
  381. cancelButtonText: '取消',
  382. type: 'warning'
  383. }).then(() => {
  384. request.post(`/bis/insp/xjvill/run/delete/${row.id}`)
  385. .then(res => {
  386. if (res.success) {
  387. this.$message.success("删除成功");
  388. this.getYsGsdwList(this.adCode, this.rowData.rgstrId);
  389. } else {
  390. this.$message.warning(res.message);
  391. }
  392. })
  393. .catch(err => {
  394. console.log(err);
  395. })
  396. }).catch(() => {
  397. this.$message({
  398. type: 'info',
  399. message: '已取消删除'
  400. });
  401. });
  402. },
  403. handleNodeClick(data) {
  404. this.$nextTick(() => {
  405. this.townName = data.adName;
  406. this.villageTableData = data.attCountryDtoList;
  407. })
  408. },
  409. handleNodeClickXzc(node, data) {
  410. this.$nextTick(() => {
  411. if (node.townCode!=null && node.townCode!=undefined) {
  412. this.oriFatherName = "";
  413. this.adCode = node.id;
  414. this.villageNm = null;
  415. this.getYsGsdwList(null, node.rgstrId);
  416. this.villageAdCode = null;
  417. }else{
  418. this.oriFatherName = data.parent.data.townName;
  419. this.adCode = node.id;
  420. this.villageNm = node.adName;
  421. this.getYsGsdwList(node.id, node.rgstrId);
  422. this.villageAdCode = node.id;
  423. }
  424. })
  425. },
  426. closeDialog() {
  427. this.waterUserTianBaoVisible = false;
  428. },
  429. closeGsGcDialog(val) {
  430. this.countryProTianBaoVisible = false;
  431. if (val === "success") {
  432. this.getYsGsdwList(this.adCode, this.rowData.rgstrId);
  433. }
  434. },
  435. addShuiKuSuccess() {
  436. this.waterUserTianBaoVisible = false;
  437. },
  438. // 删除左侧树行政村
  439. removeNode(node, data) {
  440. if (data.id) {
  441. this.$confirm('确定清空督查数据并将该村从督查任务中删除, 是否继续?', '提示', {
  442. confirmButtonText: '确定',
  443. cancelButtonText: '取消',
  444. type: 'warning'
  445. }).then(() => {
  446. request.post(`/bis/insp/xjvill/regm/delete/${data.id}`)
  447. .then(res => {
  448. if (res.success) {
  449. this.$message.success("删除成功");
  450. this.getLeftTreeData();
  451. } else {
  452. this.$message.warning(res.message);
  453. }
  454. })
  455. .catch(err => {
  456. console.log(err);
  457. })
  458. }).catch(() => {
  459. this.$message({
  460. type: 'info',
  461. message: '已取消删除'
  462. });
  463. });
  464. }
  465. },
  466. DuiXiangAddSuccessHandler: function () {
  467. this.gsgcVisible = false;
  468. this.getYsGsdwList(this.adCode, this.rowData.rgstrId);
  469. },
  470. closeDuChaDuiXiangDialog() {
  471. this.gsgcVisible = false;
  472. }
  473. }
  474. }
  475. </script>
  476. <style lang="scss">
  477. /*.nygs{*/
  478. .aside_title {
  479. padding-right: 10px;
  480. height: 30px;
  481. line-height: 30px;
  482. text-align: end;
  483. border-bottom: 1px solid rgb(235, 238, 245);
  484. background-color: #d5d5ff;
  485. }
  486. .village_title {
  487. text-align: center;
  488. }
  489. .ul_height {
  490. height: 160px;
  491. overflow: auto;
  492. }
  493. .box-card {
  494. /*height: 200px;*/
  495. overflow: auto;
  496. }
  497. /*.mt20{*/
  498. /*margin-top: 20px;*/
  499. /*}*/
  500. .lh40 {
  501. list-style: none;
  502. height: 40px;
  503. line-height: 40px;
  504. cursor: pointer;
  505. padding: 0 10px;
  506. border-bottom: 1px solid rgb(235, 238, 245);
  507. }
  508. .flr {
  509. float: right;
  510. margin-right: 20px;
  511. }
  512. .nygs span.custom-tree-node {
  513. width: 100%;
  514. }
  515. .mr10 {
  516. margin-right: 20px;
  517. float: right;
  518. }
  519. .nygs .el-tree-node__content {
  520. height: 40px;
  521. line-height: 40px;
  522. }
  523. .nygs .el-tree > div > div:first-child .mr10 {
  524. display: none;
  525. }
  526. .nygs .el-tree-node.is-current > .el-tree-node__content {
  527. background-color: gainsboro !important;
  528. }
  529. /*}*/
  530. </style>