0c65b7f6cfda6a62dbc2aeedbeff6f899b30792d.svn-base 19 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523
  1. <template>
  2. <!-- 弹出窗 -->
  3. <el-dialog title="添加稽察对象" :visible.sync="dialogFormVisible" width="80%" @close="CloseDialog" :modal-append-to-body="true" :append-to-body="true">
  4. <el-container>
  5. <el-aside width="200px" style="border:1px solid #d5d5ff">
  6. <p style="font-weight:bolder;background-color:#d5d5ff;padding:3px;">
  7. <i class="el-icon-share"></i>所属机构
  8. </p>
  9. <!--<provTreeList-->
  10. <!--rootCode="000000"-->
  11. <!--style="max-height:485px;"-->
  12. <!--@provTreeSelectChange="provTreeSelectChangeHandler">-->
  13. <!--</provTreeList>-->
  14. <el-tree :data="treeData" :props="defaultProps" @node-click="handleNodeClick" default-expand-all="true"></el-tree>
  15. </el-aside>
  16. <el-main style="border:1px solid #d5d5ff;margin-left:5px;padding:0px;">
  17. <p style="font-weight:bolder;background-color:#d5d5ff;padding:3px;">督查对象</p>
  18. <el-form style="padding:10px">
  19. <div>
  20. <el-form size="mini" :inline="true" class="demo-form-inline">
  21. <el-form-item label="项目名称">
  22. <el-input style="width:140px;" v-model="searchNameOfSzName" clearable placeholder="请输入项目名称" ></el-input>
  23. </el-form-item>
  24. <el-form-item>
  25. <el-button type="primary" @click="refreshCurrentShow">查询</el-button>
  26. </el-form-item>
  27. <!-- <el-form-item>
  28. <el-button type="primary" @click="toAddNewObj">添加</el-button>
  29. </el-form-item>-->
  30. </el-form>
  31. <el-table
  32. border
  33. v-loading="loading"
  34. :data="currentShowList"
  35. tooltip-effect="dark"
  36. style="width: 100%"
  37. @selection-change="handleSelectionChange">
  38. <el-table-column align="center" type="selection" width="60"></el-table-column>
  39. <el-table-column align="center" prop="index" label="序号" min-width="40"></el-table-column>
  40. <el-table-column align="center" show-overflow-tooltip prop="name" label="项目名称" min-width="100"></el-table-column>
  41. <el-table-column align="center" show-overflow-tooltip prop="type" label="项目类型" min-width="100"></el-table-column>
  42. <el-table-column align="center" show-overflow-tooltip prop="location" label="位置" min-width="150"></el-table-column>
  43. <el-table-column align="center" show-overflow-tooltip prop="admOrg" label="所属流域机构" min-width="100"></el-table-column>
  44. <!--<el-table-column align="center" fixed="right" prop="address" label="操作" min-width="60">
  45. &lt;!&ndash;<el-table-column align="center" fixed="right" prop="address" label="操作" min-width="60" v-if="ownPriv('manage')">&ndash;&gt;
  46. <template slot-scope="scope">
  47. <el-button @click="editHandler(scope.row)" type="text" size="small">编辑</el-button>
  48. <el-button @click="deleteHandler(scope.row)" type="text" size="small">删除</el-button>
  49. </template>
  50. </el-table-column>-->
  51. </el-table>
  52. <div class="block"
  53. style="display:flex;flex-direction:row;justify-content:center;align-items:center;padding-top: 5px;background-color: #fff;">
  54. <el-pagination
  55. small
  56. @current-change="handleCurrentChange"
  57. :pager-count="5"
  58. :current-page.sync="pageIndex"
  59. :page-size="pageSize"
  60. layout="total, prev, pager, next"
  61. :total="total">
  62. </el-pagination>
  63. </div>
  64. </div>
  65. </el-form>
  66. </el-main>
  67. </el-container>
  68. <el-dialog title="添加项目" :visible.sync="addObjDialogVisible" append-to-body>
  69. <el-form label-width="120px" :model="formObj" ref="formObj">
  70. <el-form-item label="项目名称" required >
  71. <el-input v-model="formObj.name" autocomplete="off" style="width:70%;"></el-input>
  72. </el-form-item>
  73. <el-form-item label="项目类型" required>
  74. <el-input v-model="formObj.type" autocomplete="off" style="width:70%;"></el-input>
  75. <!-- <el-select v-model="formObj.type" placeholder="请选择">
  76. <el-option v-for="item in gongchengguimo" :key="item.value" :label="item.label" :value="item.value"></el-option>
  77. </el-select> -->
  78. </el-form-item>
  79. <el-form-item label="行政区域" required>
  80. <div>
  81. <el-select v-model="provName" placeholder="选择省" @change="provChange" style="width:20%">
  82. <el-option
  83. v-for="item in provList"
  84. :key="item.adCode"
  85. :label="item.adName"
  86. :value="item.adCode">
  87. </el-option>
  88. </el-select>
  89. <el-select v-model="cityName" placeholder="选择市" @change="cityChange" style="width:20%">
  90. <el-option
  91. v-for="item in cityList"
  92. :key="item.adCode"
  93. :label="item.adName"
  94. :value="item.adCode">
  95. </el-option>
  96. </el-select>
  97. <el-select v-model="countryName" placeholder="选择县" @change="countryChange" style="width:20%">
  98. <el-option
  99. v-for="item in countryList"
  100. :key="item.adCode"
  101. :label="item.adName"
  102. :value="item.adCode">
  103. </el-option>
  104. </el-select>
  105. </div>
  106. </el-form-item>
  107. <el-form-item label="所在地点" required >
  108. <el-input v-model="formObj.location" autocomplete="off" style="width:70%;"></el-input>
  109. </el-form-item>
  110. <el-form-item label="流域机构" >
  111. <el-input v-model="formObj.admOrg" autocomplete="off" style="width:70%;"></el-input>
  112. </el-form-item>
  113. <!-- <el-form-item label="创建时间" >
  114. <el-date-picker v-model="formObj.intm" type="date" value-format="yyyy-MM-dd" placeholder="选择日期">
  115. </el-date-picker>
  116. </el-form-item> -->
  117. <el-form-item label="经度">
  118. <el-input v-model="formObj.centerX" autocomplete="off" style="width:70%;"></el-input>
  119. </el-form-item>
  120. <el-form-item label="纬度">
  121. <el-input v-model="formObj.centerY" autocomplete="off" style="width:70%;"></el-input>
  122. </el-form-item>
  123. </el-form>
  124. <div slot="footer" class="dialog-footer">
  125. <el-button @click="addObjDialogVisible = false">取 消</el-button>
  126. <el-button type="primary" @click="addNewJcObj('formObj')">确 定</el-button>
  127. </div>
  128. </el-dialog>
  129. <div slot="footer" class="dialog-footer">
  130. <el-button @click="dialogFormVisible = false">取 消</el-button>
  131. <el-button type="primary" @click="saveChange">确 定</el-button>
  132. </div>
  133. </el-dialog>
  134. </template>
  135. <script>
  136. import request from '../../utils/gw_ajax_request.js';
  137. import provTreeList from "../../widgets/provTreeList.vue";
  138. export default {
  139. components: {
  140. provTreeList: provTreeList,
  141. provTreeListQy:resolve => {require(['../../widgets/provTreeList_quyu.vue'],resolve)},
  142. },
  143. props: ["dczId", "dczName", "plnaId", "objType","nodeAreaList","nodeRow"],
  144. computed: {
  145. userId:function(){
  146. return localStorage.getItem("userid")? localStorage.getItem("userid"): '1098101939614724096'
  147. }
  148. },
  149. data() {
  150. return {
  151. addOnce:false,
  152. searchNameOfSzName: "",
  153. searchNameOfAdName: "",
  154. searchNameOfwtdstNm: "",
  155. rsAdmDep: "",
  156. type: "",
  157. wtdstState: "",
  158. engLevel: "",
  159. wtdstType: "",
  160. stnm:'',
  161. pageIndex: 1,
  162. pageSize: 10,
  163. total: 0,
  164. currentShowList: [],
  165. dialogFormVisible: true,
  166. formLabelWidth: "120",
  167. addArr: "",
  168. addName:"",
  169. addLttd:"",
  170. addLgtd:"",
  171. multipleSelection: [],
  172. gongchengguimo:[
  173. {
  174. value: "类型一",
  175. label: "类型一"
  176. },
  177. {
  178. value: "类型二",
  179. label: "类型二"
  180. }
  181. ],
  182. searchProvTreeListCode: "",
  183. qyDataList:[],
  184. loading:false,
  185. showLeftTree:true,
  186. addObjDialogVisible: false,
  187. formObj: {
  188. "name": '',
  189. "admOrg": "",
  190. "rsLoc": "",
  191. "location": '',
  192. "intm": "",
  193. "type": "",
  194. "regCode": "",
  195. "centerX": "",
  196. "centerY": "",
  197. "adCode": ""
  198. },
  199. currentAdCode:'',
  200. props: {
  201. value: 'id',
  202. label: 'label',
  203. children: 'cities'
  204. },
  205. provList: [],
  206. cityList: [],
  207. countryList: [],
  208. provName: '',
  209. cityName: '',
  210. countryName: '',
  211. provNames: '',
  212. cityNames: '',
  213. countryNames: '',
  214. curSelectItem: 0,
  215. treeData:[],
  216. defaultProps: {
  217. label: "adName"
  218. },
  219. leftAdCode:"",
  220. ifLeftClick: true
  221. }
  222. },
  223. watch: {
  224. nodeAreaList(n){
  225. this.$nextTick(()=>{
  226. this.treeData = n;
  227. })
  228. },
  229. leftAdCode(){
  230. this.getTableData_jc();
  231. }
  232. },
  233. mounted() {
  234. this.$nextTick(()=>{
  235. this.getTableData_jc();
  236. this.treeData = this.nodeAreaList;
  237. })
  238. },
  239. computed:{
  240. userId:function(){
  241. return localStorage.getItem("userid")? localStorage.getItem("userid"): '1098101939614724096'
  242. },
  243. },
  244. methods: {
  245. gateTypeFormatter(row,column){
  246. return row.gateType == '1'? "分(泄)洪闸":
  247. row.gateType == '2'? "节制闸":
  248. row.gateType == '3'? "排(退)水闸":
  249. row.gateType == '4'? "引(进)水闸":
  250. row.gateType == '5'? "挡潮闸":
  251. row.gateType == '6'? "船闸":
  252. row.gateType == '9'? "其它": '';
  253. },
  254. showDialog() {
  255. this.dialogFormVisible = true;
  256. if(this.$refs['provTreeListQyRef']){
  257. this.$refs['provTreeListQyRef'].getQyList();
  258. }
  259. this.getTableData_jc();
  260. },
  261. saveChange() {
  262. this.addObjectChange();
  263. },
  264. treeDataEmit(item){
  265. this.qyDataList = item;
  266. if(this.qyDataList.length == 0){
  267. this.showLeftTree = false;
  268. }else{
  269. this.showLeftTree = true;
  270. }
  271. },
  272. getTableData_jc(){
  273. let _self = this;
  274. let str = "";
  275. if(this.ifLeftClick){
  276. if(this.nodeAreaList && this.nodeAreaList.length > 0){
  277. _self.nodeAreaList.forEach(item =>{
  278. str += item.adCode + ",";
  279. })
  280. }
  281. _self.leftAdCode = str.substring(0, str.length - 1);
  282. }else{
  283. _self.leftAdCode = _self.leftAdCode;
  284. }
  285. request.post(`/tac/insp/year/batch/obj/getBaseNotInGroupPageByGroupId`,{
  286. 'adCode': this.leftAdCode,
  287. 'ojbNm': this.searchNameOfSzName,
  288. 'pageSize': this.pageSize,
  289. 'pageNum': this.pageIndex,
  290. 'groupId': this.nodeRow.id,
  291. }).then(res =>{
  292. if(res.success){
  293. _self.$nextTick(() =>{
  294. _self.loading = false;
  295. _self.currentShowList = res.data.list;
  296. _self.currentShowList.forEach((element, index) => {
  297. element["index"] = _self.pageSize * (_self.pageIndex - 1) + index + 1;
  298. });
  299. _self.total = res.data.total;
  300. })
  301. }
  302. })
  303. },
  304. handleSelectionChange(val) {
  305. this.multipleSelection = val;
  306. },
  307. handleCurrentChange(val) {
  308. console.log(`当前页: ${val}`);
  309. this.refreshCurrentShow();
  310. },
  311. refreshCurrentShow: function() {
  312. if(this.searchProvTreeListCode){
  313. this.getTableData_jc1();
  314. }else{
  315. this.getTableData_jc();
  316. }
  317. },
  318. toAddNewObj(){
  319. this.provName = "";
  320. this.cityName = "";
  321. this.countryName = "";
  322. for(var obj in this.formObj){
  323. this.formObj[obj] ='';
  324. }
  325. this.addObjDialogVisible = true;
  326. this.curSelectItem = null;
  327. this.getAreaList();
  328. },
  329. addNewJcObj(formName){
  330. let _this = this
  331. if(!this.formObj.name){
  332. this.$message.warning('请输入项目名称')
  333. return
  334. }
  335. if(!this.formObj.type){
  336. this.$message.warning('请选择项目类型')
  337. return
  338. }
  339. if(!this.formObj.location){
  340. this.$message.warning('请输入所在地')
  341. return
  342. }
  343. if(!this.provName){
  344. this.$message.warning('请选择省')
  345. return
  346. }
  347. this.formObj.adCode = this.currentAdCode
  348. this.formObj.persId = this.userId;
  349. this.$refs[formName].validate((valid) => {
  350. if (valid) {
  351. request.post('/tac/att/pawp/base',this.formObj).then(res=>{
  352. if(res.success){
  353. _this.$message.success('添加成功')
  354. _this.getTableData_jc();
  355. _this.addObjDialogVisible = false
  356. _this.formObj = {
  357. "name": '',
  358. "admOrg": "",
  359. "rsLoc": "",
  360. "location": '',
  361. "type": "",
  362. "regCode": "",
  363. "intm": "",
  364. "adCode": "",
  365. "centerX": "",
  366. "centerY": "",
  367. };
  368. }else{
  369. _this.$message.error(res.message)
  370. }
  371. }).catch(res=>{
  372. _this.$message.error('请求错误'+ res.message)
  373. })
  374. } else {
  375. console.log('error submit!!');
  376. return false;
  377. }
  378. });
  379. },
  380. editHandler(row){
  381. let rowObj = {};
  382. Object.assign(rowObj, row);
  383. this.formObj = rowObj;
  384. this.addObjDialogVisible = true;
  385. this.curSelectItem = null;
  386. this.getAreaList();
  387. },
  388. deleteHandler(row){
  389. var _self = this;
  390. var url = '/tac/att/pawp/base/del/'+row.id
  391. _self.$confirm('是否确认删除?', '提示', {
  392. confirmButtonText: '确定',
  393. cancelButtonText: '取消',
  394. type: 'warning'
  395. }).then(() => {
  396. request.get(url,{}).then(res=>{
  397. if(res.success){
  398. _self.$message.success('删除成功')
  399. _self.getTableData_jc();
  400. }else{
  401. _this.$message.error('删除失败')
  402. }
  403. })
  404. }).catch(() => {
  405. _self.$message({
  406. type: 'info',
  407. message: '已取消删除'
  408. });
  409. });
  410. },
  411. addObjectChange: function() {
  412. //提交当前选中对象
  413. var _self = this;
  414. try {
  415. request.post("/tac/insp/year/batch/obj/inesrtBatchObj", {
  416. "groupNm": _self.nodeRow.group,
  417. "groupId": _self.nodeRow.id,
  418. "persId": _self.userId,
  419. "yearBatchId": _self.nodeRow.yearBatchId,
  420. "baseList": _self.multipleSelection
  421. }).then(response => {
  422. if (response.success == true) {
  423. // _self.addOnce = false;
  424. _self.dialogFormVisible = false;
  425. _self.$message.success("添加成功");
  426. _self.$emit("closeDialog");
  427. }
  428. });
  429. } catch (e) {
  430. alert("暂无数据");
  431. }
  432. },
  433. provTreeSelectChangeHandler: function(params) {
  434. this.searchProvTreeListCode = params.code;
  435. this.getTableData_jc1();
  436. },
  437. provTreeSelectChangeHandler_qy(params){
  438. this.searchProvTreeListCode = params.code;
  439. this.getTableData_jc1();
  440. },
  441. getAreaList(val){
  442. let adCode = ''
  443. if(!val){
  444. adCode = '000000000000'
  445. }else{
  446. adCode = val
  447. }
  448. request.get('/dc/ad/base/getAdData',{params:{'adCode':adCode}}).then(res=>{
  449. if(res.success){
  450. if(this.curSelectItem == 1){
  451. this.cityList = res.data
  452. }else if(this.curSelectItem == 2){
  453. this.countryList = res.data
  454. }else{
  455. this.provList = res.data
  456. }
  457. }
  458. })
  459. },
  460. provChange(val){
  461. this.curSelectItem = 1
  462. this.cityName = ''
  463. this.countryName = ''
  464. this.formObj.adCode = val
  465. this.currentAdCode = val
  466. this.provList.forEach(ele=>{
  467. if(ele.adCode == this.provName){
  468. this.provNames = ele.adName
  469. }
  470. })
  471. this.formObj.location = this.provNames
  472. this.getAreaList(val)
  473. },
  474. cityChange(val){
  475. this.curSelectItem = 2
  476. if(val && val != ''){
  477. this.formObj.adCode = val
  478. this.currentAdCode = val
  479. this.countryName = ''
  480. this.cityList.forEach(ele=>{
  481. if(ele.adCode == this.cityName){
  482. this.cityNames = ele.adName
  483. }
  484. })
  485. this.formObj.location = this.provNames + this.cityNames
  486. this.getAreaList(val)
  487. }
  488. },
  489. countryChange(val){
  490. if(val && val != ''){
  491. this.formObj.adCode = val
  492. this.currentAdCode = val
  493. this.countryList.forEach(ele=>{
  494. if(ele.adCode == this.countryName){
  495. this.countryNames = ele.adName
  496. }
  497. })
  498. this.formObj.location = this.provNames + this.cityNames + this.countryNames
  499. }
  500. },
  501. handleNodeClick(node,data){
  502. this.leftAdCode = "";
  503. console.log(node, data);
  504. this.leftAdCode = node.adCode;
  505. this.ifLeftClick = false;
  506. },
  507. CloseDialog(){
  508. this.$emit("closeDialog")
  509. }
  510. }
  511. };
  512. </script>
  513. <style>
  514. </style>