b17aab830be7eefecbdde3941fbde71532bab0b7.svn-base 22 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597
  1. <template>
  2. <div>
  3. <el-container>
  4. <!-- <el-aside
  5. width="318px"
  6. style="border-right:2px solid #d5d5ff;float:left;height:calc(100vh - 100px)">
  7. <div class="tree" style="height: 100%;width: 100%;overflow: auto;display: inline-flex;">
  8. <el-tree
  9. :highlight-current="true"
  10. style="height:100%;"
  11. :data="treeData"
  12. node-key="id"
  13. show-checkbox
  14. @check-change="handleCheckChange"
  15. ref="jigou_tree">
  16. <div class="custom-tree-node" slot-scope="{ node, data }">
  17. <span style="float:left;">
  18. {{ data.pnm}}
  19. </span>
  20. <div style="float:right;display: flex;justify-content: flex-end;align-items: center;width:50%;">
  21. <span style="color:blue;width:80px;"></span>
  22. </div>
  23. </div>
  24. </el-tree>
  25. </div>
  26. </el-aside> -->
  27. <el-main style="margin:0px;padding:10px;overflow-y:hidden;">
  28. <div class="search_wrapper">
  29. <el-form :inline="true" :model="problemSearch" class="demo-form-inline">
  30. <el-form-item label="问题标题">
  31. <el-input type="input" v-model.trim="problemSearch.cpTitle" clearable style="width: 140px"></el-input>
  32. </el-form-item>
  33. <el-form-item label="问题描述">
  34. <el-input type="input" v-model.trim="problemSearch.cpDesc" clearable style="width: 140px"></el-input>
  35. </el-form-item>
  36. <el-form-item label="发现时间">
  37. <el-date-picker
  38. v-model="findTime"
  39. type="daterange"
  40. clearable
  41. value-format="yyyy-MM-dd"
  42. range-separator="至"
  43. start-placeholder="开始日期"
  44. end-placeholder="结束日期">
  45. </el-date-picker>
  46. </el-form-item>
  47. <el-form-item label="上报人">
  48. <el-input type="input" v-model.trim="problemSearch.cpResnm" clearable style="width: 140px"></el-input>
  49. </el-form-item>
  50. </el-form>
  51. <div>
  52. <el-button style="color:rgba(255,255,255,1);float:right;margin-right:10px;"
  53. type="primary"
  54. icon="el-icon-plus"
  55. @click="toAddProblem">添 加
  56. </el-button>
  57. <el-button style="color:rgba(255,255,255,1);float:right;margin-right:10px;"
  58. type="primary"
  59. icon="el-icon-search"
  60. @click="search">查 询
  61. </el-button>
  62. </div>
  63. </div>
  64. <el-table
  65. v-loading="loading"
  66. :data="tableData"
  67. border
  68. :height="tableHeight"
  69. style="width: 100%">
  70. <el-table-column
  71. fixed
  72. label="序号"
  73. type="index"
  74. width="50">
  75. <template slot-scope="scope">
  76. {{ (pageIndex - 1) * pageSize + (scope.$index + 1) }}
  77. </template>
  78. </el-table-column>
  79. <el-table-column
  80. fixed
  81. prop="cpTitle"
  82. show-overflow-tooltip
  83. label="问题标题"
  84. min-width="160">
  85. </el-table-column>
  86. <el-table-column
  87. show-overflow-tooltip
  88. prop="cpDesc"
  89. label="问题描述"
  90. min-width="250">
  91. </el-table-column>
  92. <el-table-column
  93. show-overflow-tooltip
  94. prop="cpLgtd"
  95. label="经度"
  96. min-width="100">
  97. </el-table-column>
  98. <el-table-column
  99. show-overflow-tooltip
  100. prop="cpLttd"
  101. label="纬度"
  102. min-width="100">
  103. </el-table-column>
  104. <el-table-column
  105. prop="cpIttm"
  106. label="记录时间"
  107. min-width="150">
  108. </el-table-column>
  109. <el-table-column
  110. prop="cpResnm"
  111. label="上报人"
  112. min-width="100">
  113. </el-table-column>
  114. <!-- <el-table-column
  115. label="有无多媒体"
  116. min-width="100">
  117. <template slot-scope="scope">
  118. <p v-if="scope.row.fileList">是</p>
  119. <p v-else>否</p>
  120. </template>
  121. </el-table-column> -->
  122. <el-table-column
  123. fixed="right"
  124. label="操作"
  125. min-width="100">
  126. <template slot-scope="scope">
  127. <el-button type="text" icon="el-icon-edit" v-if="ownPriv('manage')" @click="toEditProblem(scope.row)"></el-button>
  128. <el-button type="text" icon="el-icon-view" title="查看详情"@click="toShowDetail(scope.row)"></el-button>
  129. <el-button type="text" icon="el-icon-delete" title="删除问题" @click="deteleProblem(scope.row)" v-if="ownPriv('manage')"></el-button>
  130. </template>
  131. </el-table-column>
  132. </el-table>
  133. <el-pagination :pager-count="5" :current-page="pageIndex" background
  134. :page-size="pageSize" layout="total, sizes, prev, pager, next, jumper" :total="total"
  135. :page-sizes="[10, 20, 50, 100]"
  136. @current-change="pageIndexChange" @size-change="handleSizeChange"
  137. ></el-pagination>
  138. </el-main>
  139. </el-container>
  140. <!-- 添加问题弹窗 -->
  141. <el-dialog
  142. :title="dialogType + '问题'"
  143. width="50%"
  144. :visible.sync="add_dialogVisible">
  145. <el-form ref="form" :model="problemForm" label-width="160px">
  146. <el-form-item label="问题标题">
  147. <el-input v-model="problemForm.cpTitle"></el-input>
  148. </el-form-item>
  149. <el-form-item label="问题描述">
  150. <el-input v-model="problemForm.cpDesc"></el-input>
  151. </el-form-item>
  152. <el-form-item label="问题所在位置经度">
  153. <el-input v-model="problemForm.cpLgtd"></el-input>
  154. </el-form-item>
  155. <el-form-item label="问题所在位置纬度">
  156. <el-input v-model="problemForm.cpLttd"></el-input>
  157. </el-form-item>
  158. <el-form-item label="相关文件">
  159. <upload ref="uploadFile" :url="`/pdcApi/file/insert?bizId=`" @uploadOver="removeNewSupervision"></upload>
  160. </el-form-item>
  161. <el-form-item style="margin-top: 50px">
  162. <el-button type="primary" @click="addProblem" style="width: 100px;float:right">保存</el-button>
  163. </el-form-item>
  164. </el-form>
  165. </el-dialog>
  166. <!-- 修改弹窗 -->
  167. <problem-modify :editId="cpId" v-if="showModifyDialog" @closeEditDialog="handleClose"></problem-modify>
  168. <!-- 详情弹框 -->
  169. <el-dialog
  170. class="outerDialog custom_dialog"
  171. title="问题详情"
  172. width="60%"
  173. v-if="supervisionDetailsVisible"
  174. :visible.sync="supervisionDetailsVisible">
  175. <problem-detail ref="xianqing" :problemId="cpId"></problem-detail>
  176. <span slot="footer">
  177. <el-button style="margin-top:5px;" @click="supervisionDetailsVisible = false">返回</el-button>
  178. </span>
  179. </el-dialog>
  180. </div>
  181. </template>
  182. <script>
  183. import {tongYongList,deleteTongYong,gettongYongDetail} from '@api/duChaAPI.js'
  184. import {dateFormat} from '@util/gw_date.js'
  185. import request from '../../utils/gw_ajax_request.js'
  186. import { hostUrl } from "@util/global_variable.js";
  187. import problemModify from './supervisionModify_tongyong.vue'
  188. import problemDetail from './supervisionDetails_tongyong.vue'
  189. export default {
  190. props: [],
  191. data(){
  192. return{
  193. tableHeight: window.innerHeight - 200,
  194. tableData:[
  195. {
  196. cpTitle: '',
  197. cpDesc: '',
  198. cpLgtd: '',
  199. cpLttd: '',
  200. cpIttm: '',
  201. cpResnm: ''
  202. }
  203. ],
  204. problemSearch:{
  205. cpTitle: '',
  206. cpDesc: '',
  207. sttm: '',
  208. entm: '',
  209. cpResnm: '',
  210. pageSize: '20',
  211. pageNum: 1
  212. },
  213. problemForm:{
  214. cpTitle: '',
  215. cpDesc: '',
  216. cpLgtd: '',
  217. cpLttd: '',
  218. cpIttm: '',
  219. cpRes: '', //填报人id
  220. cpResnm: '', //填报人姓名
  221. fileList: []
  222. },
  223. cpId: '',
  224. pblmPointNum: '',
  225. pblmsTypeId: '',
  226. pblmId: '',
  227. imgList: [],
  228. videoList:[],
  229. audioList: [],
  230. pblmStat: '',
  231. gwComFiles: [],
  232. dialogType: '添加',
  233. dialogVisible: true,
  234. add_dialogVisible: false,
  235. checked: false,
  236. problemId: '',
  237. supervisionDetailsVisible:false,
  238. problemDeleteVisible: false,
  239. showModifyDialog: false,
  240. findTime: [],
  241. activeName: 'problem-detail',
  242. pageIndex: 1,
  243. pageSize: 20,
  244. total: 0,
  245. treeData: [],
  246. findUseOrgArray: [],
  247. treeNodeArray: [],
  248. loading: true,
  249. multipleSelection: [], // 已选
  250. }
  251. },
  252. computed: {
  253. persId() {
  254. return localStorage.getItem("userid")
  255. ? localStorage.getItem("userid")
  256. : "1098101939614724096";
  257. },
  258. persNm() {
  259. return localStorage.getItem("account")
  260. ? localStorage.getItem("account")
  261. : "";
  262. },
  263. hostUrl(){
  264. return hostUrl
  265. }
  266. },
  267. components: {
  268. upload: resolve => {
  269. require(["../../widgets/uploadFile.vue"], resolve);
  270. },
  271. problemModify: problemModify,
  272. problemDetail: problemDetail
  273. },
  274. mounted(){
  275. this.getLeftTreeData();
  276. this.searchList()
  277. },
  278. activated(){
  279. // this.getLeftTreeData();
  280. this.search();
  281. this.findParams = {
  282. adCode: "",
  283. pblmStat: "",
  284. persId: localStorage.getItem("userid")
  285. }
  286. },
  287. methods:{
  288. getLeftTreeData() {
  289. var _self = this;
  290. request.get("/dc/organization/base/getAllNode", {
  291. params: {
  292. userId: this.persId,
  293. orgType: "007"
  294. }
  295. }).then(res => {
  296. let data = res.data;
  297. data.forEach(ele => {
  298. if (ele.pid == null || ele.pid == "") {
  299. ele.pid = "007";
  300. }
  301. });
  302. data = _self.getTrees(data);
  303. _self.treeData = data;
  304. console.log(data);
  305. });
  306. },
  307. search(){
  308. this.searchList()
  309. },
  310. searchList(){
  311. let _self = this;
  312. this.problemSearch.cpRes = this.persId
  313. if(this.findTime && this.findTime.length){
  314. this.problemSearch.sttm = this.findTime[0]
  315. this.problemSearch.entm = this.findTime[1]
  316. }else{
  317. this.problemSearch.sttm = ''
  318. this.problemSearch.entm = ''
  319. }
  320. this.problemSearch.pageSize = this.pageSize
  321. this.problemSearch.pageNum = this.pageIndex
  322. tongYongList(this.problemSearch).then(res => {
  323. _self.loading = false;
  324. if (res.success) {
  325. this.tableData = res.data.list;
  326. this.total = res.data.total;
  327. }
  328. });
  329. },
  330. toAddProblem(){
  331. this.add_dialogVisible = true
  332. },
  333. addProblem(){
  334. this.problemForm.cpRes = this.persId
  335. this.problemForm.cpResnm = this.persNm
  336. this.problemForm.cpIttm = dateFormat(new Date(),'yyyy-MM-dd hh:mm:ss')
  337. request.post('/biz/insp/compblm/insert',this.problemForm).then(res=>{
  338. if (res.success) {
  339. this.pblmId = res.data.id;
  340. this.gwComFiles = [];
  341. this.searchList()
  342. this.problemForm = {
  343. cpTitle: '',
  344. cpDesc: '',
  345. cpLgtd: '',
  346. cpLttd: ''
  347. }
  348. if (this.$refs.uploadFile.submitUpload(this.pblmId)) {
  349. this.removeNewSupervision();
  350. }
  351. }
  352. })
  353. },
  354. toEditProblem(row){
  355. this.dialogType = '修改'
  356. this.cpId = row.cpId
  357. this.showModifyDialog = true
  358. },
  359. // 查看详情
  360. toShowDetail(row){
  361. this.cpId = row.cpId
  362. this.supervisionDetailsVisible = true
  363. },
  364. // 删除弹窗
  365. deteleProblem(row) {
  366. this.cpId = row.cpId
  367. this.$confirm("确定删除该问题吗?", "提示", {
  368. confirmButtonText: "确定",
  369. cancelButtonText: "返回",
  370. type: "warning"
  371. }).then(
  372. res => {
  373. if (res === "confirm") {
  374. request.post(`/biz/insp/compblm/delete/${this.cpId}`).then(res1 => {
  375. if (res1.success) {
  376. this.$message.success('删除成功');
  377. this.searchList();
  378. } else {
  379. this.$message.success(res1.message);
  380. }
  381. });
  382. }
  383. },
  384. res => {
  385. console.log("返回");
  386. }
  387. );
  388. },
  389. removeNewSupervision(arg){
  390. if (arg) {
  391. var args = this.gwComFiles.concat(arg);
  392. this.updatefilelist(args);
  393. }
  394. this.$message.success('保存成功')
  395. this.add_dialogVisible = false
  396. this.gwComFiles = [];
  397. this.$refs.uploadFile.init();
  398. },
  399. updatefilelist(arg) {
  400. request.post('/dc/insp/pblm/update',{
  401. cpId: this.pblmId,
  402. fileList: arg
  403. }).then(res => {
  404. this.searchList()
  405. this.removeNewSupervision()
  406. });
  407. },
  408. handleClose(){
  409. this.searchList()
  410. this.showModifyDialog = false
  411. },
  412. handleDetailClick(tab, event) {
  413. console.log(tab, event);
  414. },
  415. pageIndexChange(val) {
  416. this.pageIndex = val;
  417. this.searchList();
  418. },
  419. handleSizeChange(val) {
  420. this.pageSize = val;
  421. this.searchList();
  422. },
  423. //格式化树形数据
  424. getTrees(list) {
  425. //@wxcwater重写方法 适应多个树
  426. let highLevelLength = 99;//预设最大节点id长度,目前最大应该为12,所以设置为99保证正常
  427. let _self =this;
  428. list.forEach((item,index)=>{
  429. item['pidLength'] = item.pid&&item.pid!=''?item.pid.length:0;
  430. if(highLevelLength>item.pidLength){
  431. highLevelLength = item.pidLength;
  432. }
  433. });
  434. console.log(highLevelLength);
  435. let heightLevelNode = [];
  436. list.forEach((item,index)=>{
  437. if(highLevelLength>=item.pidLength){
  438. heightLevelNode.push(item);
  439. }
  440. });
  441. list.forEach((item,index)=>{
  442. heightLevelNode.forEach((pItem)=>{
  443. _self.addTreeNode(pItem,item);
  444. });
  445. });
  446. console.log(heightLevelNode);
  447. return heightLevelNode;
  448. },
  449. addTreeNode:function(treeNode,leafNode){
  450. let _self = this;
  451. if(!treeNode.hasOwnProperty('children')){
  452. treeNode['children'] = [];
  453. }
  454. if(leafNode.pid == treeNode.id){
  455. treeNode.children.push(leafNode);
  456. return;
  457. }
  458. treeNode.children.forEach((item) => {
  459. _self.addTreeNode(item,leafNode);
  460. });
  461. },
  462. handleCheckChange(data, checked, indeterminate) {
  463. let cNarray = this.$refs["jigou_tree"].getCheckedNodes();
  464. console.log(cNarray);
  465. this.treeNodeArray = cNarray;
  466. },
  467. // 已选择项
  468. handleSelectionChange(val) {
  469. this.multipleSelection = val;
  470. },
  471. exportExcel() {
  472. let _self = this;
  473. request.get("/dc/organization/base/getAllNode", {
  474. params: {
  475. userId: this.persId,
  476. orgType: "007"
  477. }
  478. }).then(res => {
  479. let orgAllNode = res.data;
  480. let data = _self.findParams;
  481. data.pageNum = _self.pageIndex;
  482. data.pageSize = _self.pageSize;
  483. data.villType = "9";
  484. data.pType = "7";
  485. _self.treeNodeArray.forEach(item => {
  486. console.log(item);
  487. if (item.id.length < 12) {
  488. orgAllNode.forEach(orgItem => {
  489. if (orgItem.id.startsWith(item.id)) {
  490. _self.findUseOrgArray.push(orgItem.id);
  491. }
  492. });
  493. } else {
  494. _self.findUseOrgArray.push(item.id);
  495. }
  496. });
  497. var xhr = new XMLHttpRequest();
  498. xhr.open("post", "/pdcApi/dc/insp/pblm/page/keyReg/export", true);
  499. xhr.responseType = "blob";
  500. xhr.setRequestHeader(
  501. "Content-Type",
  502. "application/json;charset=utf-8"
  503. );
  504. xhr.setRequestHeader(
  505. "persId",
  506. localStorage.getItem("userid") ? localStorage.getItem("userid") : ""
  507. );
  508. xhr.onload = function() {
  509. if (this.status == 200) {
  510. var blob = this.response;
  511. var a = document.createElement("a");
  512. var url = window.URL.createObjectURL(blob);
  513. a.href = url;
  514. //设置文件名称
  515. a.download = "水利工程运行问题列表.xls";
  516. a.click();
  517. }
  518. };
  519. xhr.send(JSON.stringify(data));
  520. });
  521. },
  522. exportWord() {
  523. let _self = this;
  524. request.get("/dc/organization/base/getAllNode", {
  525. params: {
  526. userId: this.persId,
  527. orgType: "007"
  528. }
  529. }).then(res => {
  530. let orgAllNode = res.data;
  531. let data = _self.findParams;
  532. data.pageNum = _self.pageIndex;
  533. data.pageSize = _self.pageSize;
  534. data.villType = "9";
  535. data.pType = "7";
  536. _self.treeNodeArray.forEach(item => {
  537. if (item.id.length < 12) {
  538. orgAllNode.forEach(orgItem => {
  539. if (orgItem.id.startsWith(item.id)) {
  540. _self.findUseOrgArray.push(orgItem.id);
  541. }
  542. });
  543. } else {
  544. _self.findUseOrgArray.push(item.id);
  545. }
  546. });
  547. //下载word文档2
  548. request.post('/keyReg/doc',data).then(res=>{
  549. if(res.success){
  550. console.log(this.response)
  551. var a = document.createElement('a');
  552. a.href = `${this.hostUrl}${res.data.downloadPath}`;
  553. //设置文件名称
  554. a.download = '水利工程运行问题详情.doc';
  555. a.click();
  556. // window.open(`${this.hostUrl}${res.data.downloadPath}`)
  557. }else{
  558. _self.$mesage.error(res.message)
  559. }
  560. }).catch(res=>{
  561. _self.$mesage.error(res.message)
  562. })
  563. });
  564. },
  565. },
  566. watch:{
  567. },
  568. }
  569. </script>
  570. <style lang="scss">
  571. .search_wrapper{
  572. display: flex;
  573. justify-content: space-between;
  574. min-height: 60px;
  575. div:last-child{
  576. min-width: 160px;
  577. }
  578. }
  579. .slide-line{
  580. width: 96%;
  581. margin-left: 3%;
  582. height: 1px;
  583. margin-bottom: 10px;
  584. border-bottom: dashed 1px #DCDFE6;
  585. }
  586. .detail_dialog .el-dialog__body{
  587. padding: 0 20px 30px;
  588. }
  589. </style>