9c4a66c914f50ae7f218f59cdbaa0fa200d8d7ff.svn-base 26 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606
  1. <template>
  2. <!-- 弹出窗 -->
  3. <el-dialog title="添加督查对象" width="60%" @close="closeDuChaDuiXiangDialog" :visible.sync="dialogFormVisible"
  4. :close-on-click-modal="false"
  5. :modal-append-to-body="true"
  6. :append-to-body="true">
  7. <el-container>
  8. <!--<el-aside width="200px" style="border:1px solid #d5d5ff">-->
  9. <!--<p style="font-weight:bolder;background-color:#d5d5ff;padding:3px;">-->
  10. <!--<i class="el-icon-share"></i>所属机构-->
  11. <!--</p>-->
  12. <!--<provTreeListQy-->
  13. <!--ref="provTreeListQyRef"-->
  14. <!--v-show="showLeftTree"-->
  15. <!--:ddczId='dczId'-->
  16. <!--rootCode="000000"-->
  17. <!--rootType="1"-->
  18. <!--style="max-height:485px;"-->
  19. <!--@treeDataEmit="treeDataEmit"-->
  20. <!--@provTreeSelectChange="provTreeSelectChangeHandler_qy">-->
  21. <!---->
  22. <!--</provTreeListQy>-->
  23. <!--<provTreeList-->
  24. <!--v-show="!showLeftTree"-->
  25. <!--rootCode="000000"-->
  26. <!--rootType="1"-->
  27. <!--style="max-height:485px;"-->
  28. <!--@provTreeSelectChange="provTreeSelectChangeHandler"-->
  29. <!--&gt;</provTreeList>-->
  30. <!--</el-aside>-->
  31. <el-main style="border:1px solid #d5d5ff;margin-left:5px;padding:0px;">
  32. <p style="font-weight:bolder;background-color:#d5d5ff;padding:3px;">督查对象</p>
  33. <el-form style="padding:10px">
  34. <div>
  35. <el-form size="mini" :inline="true" class="demo-form-inline">
  36. <el-form-item label="供水工程名称">
  37. <el-input
  38. style="width:140px;"
  39. v-model="searchNameOfRsName"
  40. clearable
  41. placeholder="请输入供水工程名称"
  42. ></el-input>
  43. </el-form-item>
  44. <el-form-item label="工程类型">
  45. <el-select style="width:200px;" v-model="engScal" clearable placeholder="请选择">
  46. <el-option label="万人工程" value="1"></el-option>
  47. <el-option label="千人工程" value="2"></el-option>
  48. <el-option label="千人以下集中供水工程" value="3"></el-option>
  49. </el-select>
  50. </el-form-item>
  51. <el-form-item>
  52. <el-button type="primary" @click="refreshCurrentShow">查询</el-button>
  53. </el-form-item>
  54. <el-form-item>
  55. <el-button type="primary" @click="toAddNewRsvr">添加新供水工程</el-button>
  56. </el-form-item>
  57. </el-form>
  58. <el-table
  59. border
  60. v-loading="loading"
  61. :data="currentShowList"
  62. tooltip-effect="dark"
  63. style="width: 100%"
  64. @selection-change="handleSelectionChange"
  65. >
  66. <el-table-column align="center" type="selection" width="60"></el-table-column>
  67. <el-table-column align="center" prop="index" label="序号" min-width="40"></el-table-column>
  68. <el-table-column
  69. align="center"
  70. show-overflow-tooltip
  71. prop="cwsName"
  72. label="供水工程名称"
  73. min-width="100"
  74. ></el-table-column>
  75. <el-table-column
  76. align="center"
  77. show-overflow-tooltip
  78. prop="cwsLoc"
  79. label="所在地点"
  80. min-width="100"
  81. ></el-table-column>
  82. <el-table-column
  83. align="center"
  84. show-overflow-tooltip
  85. prop="engType"
  86. label="工程类型"
  87. :formatter="engScalFormatter"
  88. min-width="80"
  89. ></el-table-column>
  90. </el-table>
  91. <div
  92. class="block"
  93. style="display:flex;flex-direction:row;justify-content:center;align-items:center;padding-top: 5px;background-color: #fff;"
  94. >
  95. <el-pagination
  96. small
  97. @current-change="handleCurrentChange"
  98. :pager-count="5"
  99. :current-page.sync="pageIndex"
  100. :page-size="pageSize"
  101. layout="total, prev, pager, next"
  102. :total="total"
  103. ></el-pagination>
  104. </div>
  105. </div>
  106. </el-form>
  107. </el-main>
  108. </el-container>
  109. <div slot="footer" class="dialog-footer">
  110. <el-button @click="closeDuChaDuiXiangDialog">取 消</el-button>
  111. <el-button type="primary" @click="saveChange">确 定</el-button>
  112. </div>
  113. <el-dialog title="添加新供水工程" :visible.sync="addRsvrVisible" append-to-body width="40%" >
  114. <el-form label-width="200px" :model="formObj" :rules="rules" ref="formObj">
  115. <el-form-item label="工程名称" prop="rsName">
  116. <el-input v-model="formObj.rsName" clearable autocomplete="off" style="width:60%;"></el-input>
  117. </el-form-item>
  118. <!--<el-form-item label="行政区域" required>-->
  119. <!--<div>-->
  120. <!--<el-select v-model="provName" placeholder="选择省" @change="provChange" style="width:20%">-->
  121. <!--<el-option-->
  122. <!--v-for="item in provList"-->
  123. <!--:key="item.adCode"-->
  124. <!--:label="item.adName"-->
  125. <!--:value="item.adCode">-->
  126. <!--</el-option>-->
  127. <!--</el-select>-->
  128. <!--<el-select v-model="cityName" placeholder="选择市" @change="cityChange" style="width:20%">-->
  129. <!--<el-option-->
  130. <!--v-for="item in cityList"-->
  131. <!--:key="item.adCode"-->
  132. <!--:label="item.adName"-->
  133. <!--:value="item.adCode">-->
  134. <!--</el-option>-->
  135. <!--</el-select>-->
  136. <!--<el-select v-model="countryName" placeholder="选择县" @change="countryChange" style="width:20%">-->
  137. <!--<el-option-->
  138. <!--v-for="item in countryList"-->
  139. <!--:key="item.adCode"-->
  140. <!--:label="item.adName"-->
  141. <!--:value="item.adCode">-->
  142. <!--</el-option>-->
  143. <!--</el-select>-->
  144. <!--</div>-->
  145. <!--</el-form-item>-->
  146. <el-form-item label="所在地点" prop="location">
  147. <el-input v-model="formObj.location" clearable autocomplete="off" style="width:60%;"></el-input>
  148. </el-form-item>
  149. <el-form-item label="工程类型" prop="engType">
  150. <el-select v-model="formObj.engType" clearable placeholder="请选择" autocomplete="off" style="width:60%;">
  151. <el-option label="万人工程" value="1"></el-option>
  152. <el-option label="千人工程" value="2"></el-option>
  153. <el-option label="千人以下集中供水工程" value="3"></el-option>
  154. </el-select>
  155. </el-form-item>
  156. </el-form>
  157. <div slot="footer" class="dialog-footer">
  158. <el-button @click="addRsvrVisible = false">取 消</el-button>
  159. <el-button type="primary" @click="addNewRsvr('formObj')">确 定</el-button>
  160. </div>
  161. </el-dialog>
  162. </el-dialog>
  163. </template>
  164. <script>
  165. import request from '@util/gw_ajax_request'
  166. import provTreeList from "@widget/provTreeList.vue";
  167. // import provTreeListQy from "../../widgets/provTreeList_quyu.vue"
  168. import {
  169. getObjListNotInspGroupId,
  170. addDcAndObjRel
  171. } from "@api/duChaDuiXiang_xsk_API.js";
  172. export default {
  173. components: {
  174. provTreeList: provTreeList,
  175. provTreeListQy: resolve => {
  176. require(['@widget/provTreeList_quyu.vue'], resolve)
  177. },
  178. },
  179. props: ["dczId", "dczName", "plnaId", "objType", "rowData","villageAdCode"],
  180. data() {
  181. return {
  182. addOnce: false,
  183. objTypeName: '小水库',
  184. xsk: true,
  185. ncys: false,
  186. shgc: false,
  187. dxs: false,
  188. searchNameOfRsName: "",
  189. searchNameOfAdName: "",
  190. searchNameOfwtdstNm: "",
  191. addLevel: "",
  192. rsAdmDep: "",
  193. engScal: "",
  194. wtdstState: "",
  195. engLevel: "",
  196. wtdstType: "",
  197. stnm: '',
  198. pageIndex: 1,
  199. pageSize: 10,
  200. total: 0,
  201. currentShowList: [],
  202. dialogFormVisible: true,
  203. formLabelWidth: "120",
  204. addArr: "",
  205. addName: "",
  206. addLttd: "",
  207. addLgtd: "",
  208. multipleSelection: [],
  209. searchProvTreeListCode: "",
  210. qyDataList: [],
  211. loading: false,
  212. showLeftTree: true,
  213. addRsvrVisible: false,
  214. formObj: {
  215. "rsName": "",
  216. "rsAdmName": "",
  217. "rsLoc": "",
  218. "location": "",
  219. "engType": ""
  220. },
  221. areasList: [],
  222. props: {
  223. value: 'id',
  224. label: 'label',
  225. children: 'cities'
  226. },
  227. rules: {
  228. rsName: [
  229. {required: true, message: '请输入工程名称', trigger: 'blur'},
  230. ],
  231. location: [
  232. {required: true, message: '请输入所在地点', trigger: 'blur'}
  233. ],
  234. engType: [
  235. {required: true, message: '请选择工程类型', trigger: 'blur'}
  236. ]
  237. },
  238. provList: [],
  239. cityList: [],
  240. countryList: [],
  241. provName: '',
  242. cityName: '',
  243. countryName: '',
  244. provNames: '',
  245. cityNames: '',
  246. countryNames: '',
  247. curSelectItem: 0
  248. }
  249. },
  250. watch: {
  251. dczId: function (n, o) {
  252. this.searchProvTreeListCode = "";
  253. },
  254. qyDataList(n, o) {
  255. if (this.qyDataList.length == 0) {
  256. this.showLeftTree = false;
  257. } else {
  258. this.showLeftTree = true;
  259. }
  260. console.log("区域树" + n.length + this.showLeftTree + this.objType);
  261. if (this.objType == '1') {
  262. this.getTableData_sk();
  263. this.getAreaList()
  264. } else if (this.objType == '5') {
  265. this.getTableData_dxs();
  266. }
  267. }
  268. },
  269. mounted() {
  270. this.getTableData_sk();
  271. },
  272. computed: {
  273. userId: function () {
  274. return localStorage.getItem("userid") ? localStorage.getItem("userid") : '1098101939614724096'
  275. },
  276. },
  277. methods: {
  278. changeCurrentObjSelectName(item) {
  279. this.objType = item;
  280. },
  281. selectChange(val) {
  282. console.log(val);
  283. this.objType = val;
  284. },
  285. engScalFormatter: function (row, column) {
  286. return row.engType == 1 ? "万人工程" :
  287. row.engType == 2 ? "千人工程" :
  288. row.engType == 3 ? "千人以下集中供水工程" : ""
  289. },
  290. wtdstStateFormatter: function (row, column) {
  291. return row.wtdstState == 1 ? "已修复" : "未修复";
  292. },
  293. rsAdmDepFormatter: function (row, column) {
  294. return row.rsAdmDep == 1
  295. ? "水利部门"
  296. : row.rsAdmDep == 2
  297. ? "电力部门"
  298. : row.rsAdmDep == 3
  299. ? "农业部门"
  300. : row.rsAdmDep == 4
  301. ? "林业部门"
  302. : row.rsAdmDep == 5
  303. ? "城建部门"
  304. : row.rsAdmDep == 6
  305. ? "航运部门"
  306. : row.rsAdmDep == 7
  307. ? "环保部门"
  308. : "其他部门";
  309. },
  310. adGradFormatter: function (row, column) {
  311. return row.adGrad == 1
  312. ? "国家级"
  313. : row.adGrad == 2
  314. ? "省级"
  315. : row.adGrad == 3
  316. ? "地市级"
  317. : row.adGrad == 4
  318. ? "县级"
  319. : row.adGrad == 5
  320. ? "乡级"
  321. : row.adGrad == 6
  322. ? "村"
  323. : "村组";
  324. },
  325. adNameFormatter: function (row, column) {
  326. return row.adName;
  327. },
  328. adFullNameFormatter: function (row, column) {
  329. return row.adFullName;
  330. },
  331. adCodeFormatter: function (row, column) {
  332. return row.adCode;
  333. },
  334. saveChange() {
  335. this.addObjectChange();
  336. },
  337. treeDataEmit(item) {
  338. this.qyDataList = item;
  339. if (this.qyDataList.length == 0) {
  340. this.showLeftTree = false;
  341. } else {
  342. this.showLeftTree = true;
  343. }
  344. },
  345. getTableData_sk() {
  346. var _self = this;
  347. // if(_self.qyDataList.length == 0){
  348. // _self.showLeftTree = false;
  349. // }else{
  350. // _self.showLeftTree = true;
  351. // }
  352. _self.loading = true;
  353. // var str = '';
  354. // for(var i=0;i<_self.qyDataList.length;i++){
  355. // str+= _self.qyDataList[i].adCode+',';
  356. // }
  357. // str = str.substring(0,str.length-1);
  358. // var obj = {
  359. // "adcd": str,
  360. // "rsName": _self.searchNameOfRsName,
  361. // "engScal": _self.engScal,
  362. // "id": _self.userId,
  363. // "groupId":_self.dczId,
  364. // "pageNum":_self.pageIndex,
  365. // "pageSize":_self.pageSize
  366. // }
  367. let obj = {
  368. "adCode": _self.villageAdCode.substr(0,6),
  369. "engType": _self.engScal,
  370. "name": _self.searchNameOfRsName,
  371. "pageNum": _self.pageIndex,
  372. "pageSize": _self.pageSize,
  373. "regstrId": _self.rowData.regstrId
  374. }
  375. request.post('/bis/insp/villqh/fee/pageNotDC', obj).then((res) => {
  376. _self.loading = false;
  377. _self.currentShowList = res.data.list;
  378. _self.currentShowList.forEach((element, index) => {
  379. element["index"] = _self.pageSize * (_self.pageIndex - 1) + index + 1;
  380. });
  381. _self.total = res.data.total;
  382. })
  383. },
  384. getTableData: function (callBackFunction = null) {
  385. var _self = this;
  386. if (!this.dczId) {
  387. // this.dczId = 'jwW2Wihf5E9X3UC9t45fmSHyffUs2rzI';
  388. }
  389. if (_self.objType == '1' || _self.objType == "5") {
  390. return;
  391. }
  392. let str = '';
  393. for (var i = 0; i < _self.qyDataList.length; i++) {
  394. str += _self.qyDataList[i].adCode + ',';
  395. }
  396. str = str.substring(0, str.length - 1);
  397. getObjListNotInspGroupId(
  398. this.dczId,
  399. this.objType,
  400. this.pageSize,
  401. this.pageIndex,
  402. this.searchNameOfRsName, //水库名称
  403. this.searchNameOfAdName, //农村饮水行政区划名称
  404. this.searchNameOfwtdstNm, //水毁工程名称
  405. this.engScal, //水库-工程规模
  406. this.rsAdmDep, //水库-归口管理部门
  407. this.wtdstType, //水毁-工程类别
  408. this.wtdstState, //水毁-修复状态
  409. this.searchProvTreeListCode == '' ? str : this.searchProvTreeListCode,
  410. ).then(
  411. res => {
  412. _self.currentShowList = [];
  413. res.data.list.forEach((element, index) => {
  414. element["index"] = _self.pageSize * (_self.pageIndex - 1) + index + 1;
  415. _self.currentShowList.push(element);
  416. });
  417. console.log(_self.currentShowList);
  418. _self.total = res.data.total;
  419. if (callBackFunction && typeof (callBackFunction) == 'function') {
  420. callBackFunction();
  421. }
  422. },
  423. err => {
  424. console.log("查询错误");
  425. if (callBackFunction && typeof (callBackFunction) == 'function') {
  426. callBackFunction();
  427. }
  428. }
  429. );
  430. },
  431. handleSelectionChange(val) {
  432. this.multipleSelection = val;
  433. },
  434. handleCurrentChange(val) {
  435. console.log(`当前页: ${val}`);
  436. this.refreshCurrentShow();
  437. },
  438. refreshCurrentShow: function () {
  439. this.getTableData_sk();
  440. },
  441. addObjectChange: function () {
  442. const length = this.multipleSelection.length;
  443. for (let i = 0; i < length; i++) {
  444. this.addArr += this.multipleSelection[i].cwsCode + ";";
  445. }
  446. this.addArr = this.addArr.substr(0, this.addArr.length - 1);
  447. try {
  448. let obj = {
  449. "adCode": this.villageAdCode,
  450. "cwsIds": this.addArr,
  451. "regstrId": this.rowData.rgstrId
  452. }
  453. request.post(`/bis/insp/villqh/fee/addBatch`,obj)
  454. .then(res =>{
  455. if(res.success){
  456. this.dialogFormVisible = false;
  457. this.$message.success("添加成功");
  458. this.$emit("addSuccess");
  459. _self.addArr = "";
  460. }else{
  461. this.$message.warning(res.message);
  462. }
  463. })
  464. } catch (e) {
  465. alert("暂无数据");
  466. }
  467. },
  468. provTreeSelectChangeHandler: function (params) {
  469. this.searchProvTreeListCode = params.code;
  470. if (this.objType == '1') {
  471. this.getTableData_sk1();
  472. } else if (this.objType == '2' || this.objType == '3') {
  473. this.getTableData();
  474. } else {
  475. }
  476. },
  477. provTreeSelectChangeHandler_qy(params) {
  478. this.searchProvTreeListCode = params.code;
  479. if (this.objType == '1') {
  480. this.getTableData_sk1();
  481. } else if (this.objType == '5') {
  482. this.getTableData_dxs1();
  483. } else if (this.objType == '2' || this.objType == '3') {
  484. this.getTableData();
  485. }
  486. },
  487. toAddNewRsvr() {
  488. this.cityList = [];
  489. this.countryList = [];
  490. this.provList = [];
  491. this.provName = "";
  492. this.cityName = "";
  493. this.countryName = "";
  494. for (var obj in this.formObj) {
  495. this.formObj[obj] = '';
  496. }
  497. this.addRsvrVisible = true;
  498. this.curSelectItem = null;
  499. this.getAreaList();
  500. },
  501. addNewRsvr(formName) {
  502. let obj = {
  503. "addvcd": this.villageAdCode,
  504. "cwsName": this.formObj.rsName,
  505. "cwsLoc": this.formObj.location,
  506. "engType": this.formObj.engType,
  507. }
  508. this.$refs[formName].validate((valid) => {
  509. if (valid) {
  510. request.post('/dc/att/cwsBase/insert', obj).then(res => {
  511. if (res.success) {
  512. this.$message.success('添加成功')
  513. this.getTableData_sk();
  514. this.addRsvrVisible = false
  515. } else {
  516. _this.$message.error(res.message)
  517. }
  518. }).catch(res => {
  519. this.$message.error(res.message)
  520. })
  521. } else {
  522. console.log('error submit!!');
  523. return false;
  524. }
  525. });
  526. },
  527. getAreaList(val) {
  528. let adCode = ''
  529. if (!val) {
  530. adCode = '000000000000'
  531. } else {
  532. adCode = val
  533. }
  534. request.get('/dc/ad/base/getAdData', {params: {'adCode': adCode}}).then(res => {
  535. if (res.success) {
  536. if (this.curSelectItem == 1) {
  537. this.cityList = res.data
  538. } else if (this.curSelectItem == 2) {
  539. this.countryList = res.data
  540. } else {
  541. this.provList = res.data
  542. }
  543. }
  544. })
  545. },
  546. handleItemChange(val) {
  547. this.getAreaList(val)
  548. },
  549. provChange(val) {
  550. this.curSelectItem = 1
  551. this.cityName = ''
  552. this.countryName = ''
  553. this.formObj.admDiv = val
  554. this.provList.forEach(ele => {
  555. if (ele.adCode == this.provName) {
  556. this.provNames = ele.adName
  557. }
  558. })
  559. this.formObj.location = this.provNames
  560. this.getAreaList(val)
  561. },
  562. cityChange(val) {
  563. this.curSelectItem = 2
  564. if (val && val != '') {
  565. this.formObj.admDiv = val
  566. this.countryName = ''
  567. this.cityList.forEach(ele => {
  568. if (ele.adCode == this.cityName) {
  569. this.cityNames = ele.adName
  570. }
  571. })
  572. this.formObj.location = this.provNames + this.cityNames
  573. this.getAreaList(val)
  574. }
  575. },
  576. countryChange(val) {
  577. if (val && val != '') {
  578. this.formObj.admDiv = val
  579. this.countryList.forEach(ele => {
  580. if (ele.adCode == this.countryName) {
  581. this.countryNames = ele.adName
  582. }
  583. })
  584. this.formObj.location = this.provNames + this.cityNames + this.countryNames
  585. }
  586. },
  587. closeDuChaDuiXiangDialog() {
  588. this.dialogFormVisible = false;
  589. this.$emit("closeDuChaDuiXiangDialog");
  590. }
  591. }
  592. };
  593. </script>
  594. <style>
  595. </style>