b128e7e88b83f557d01ecbc14144309da54b26f1.svn-base 6.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197
  1. <template>
  2. <div style="height:100%;max-height:100%;overflow-y:hidden;display:flex;flex-direction:column;justify-content:space-between;">
  3. <div class="box-card"
  4. style="background-color:#ECF8FF;height:40px;font-size:small;line-height:30px;display: flex;
  5. justify-content: space-between;align-items: center;">
  6. <div style="display:flex;">
  7. <!--<el-checkbox v-model="checked">本级</el-checkbox>-->
  8. <el-input placeholder="请输入对象名称" v-model="input5" style="width:200px;margin-left: 30px;" class="input-with-select">
  9. <el-button slot="append" @click="getDcdxList1" icon="el-icon-search"></el-button>
  10. </el-input>
  11. </div>
  12. <!--<el-button v-if="dczId.length==12" @click="editHandler" type="primary" icon="el-icon-edit" v-show="showEdit"-->
  13. <!--style="float:right;margin-right:10px;height: 30px;" plain size="mini" >添加对象</el-button>-->
  14. <el-button @click="editHandler" type="primary" icon="el-icon-edit" v-show="showEdit" style="float:right;margin-right:10px;height: 30px;" plain size="mini" v-if="nodeGroupId">添加对象</el-button>
  15. </div>
  16. <el-table key='firstTable' :data="tableData" style="width: 100%;max-height:85%;overflow:hidden;" :height="tableHeight1" >
  17. <el-table-column align="center" prop="index" label="序号" min-width="40"></el-table-column>
  18. <el-table-column align="center" show-overflow-tooltip prop="name" label="项目名称" min-width="100"></el-table-column>
  19. <el-table-column align="center" show-overflow-tooltip prop="type" label="项目类型" min-width="100"></el-table-column>
  20. <el-table-column align="center" show-overflow-tooltip prop="location" label="位置" min-width="150"></el-table-column>
  21. <el-table-column align="center" show-overflow-tooltip prop="admOrg" label="所属流域机构" min-width="100"></el-table-column>
  22. <el-table-column align="center" show-overflow-tooltip prop="pnm" label="所在分组" min-width="80"></el-table-column>
  23. <el-table-column fixed="right" prop="address" label="操作" min-width="60" v-if="ownPriv('manage')">
  24. <template slot-scope="scope">
  25. <el-button @click="deleteHandler(scope.row)" type="text" size="small">删除</el-button>
  26. </template>
  27. </el-table-column>
  28. </el-table>
  29. <div style="display:flex;flex-direction:row;justify-content:space-between;align-items:center;margin-top:5px;">
  30. <el-pagination
  31. @current-change="handleCurrentChange"
  32. :current-page.sync="pageIndex"
  33. :page-size="pageSize"
  34. layout="total, prev, pager, next"
  35. :total="total"
  36. ></el-pagination>
  37. </div>
  38. </div>
  39. </template>
  40. <script>
  41. import { getDcdxList, deleteDcdx } from "../../api/duChaPlan.js";
  42. import request from '../../utils/gw_ajax_request'
  43. export default {
  44. components: {},
  45. props: ['nodeGroupId','nodeBatchId'], //objType业务类型
  46. data: function() {
  47. return {
  48. input5:'',
  49. showEdit: true,
  50. tableData: [],
  51. pageIndex: 1,
  52. pageSize: 10,
  53. total: 0,
  54. tableHeight1:window.innerHeight - 355,
  55. checked:false,
  56. isAll:'1',
  57. };
  58. },
  59. created() {
  60. },
  61. watch: {
  62. // dczId: function(n, o) {
  63. // this.getDcdxList1(n);
  64. // },
  65. // checked(n,o){
  66. // if(n==true){
  67. // this.isAll = '0';
  68. // }else{
  69. // this.isAll = '1';
  70. // }
  71. // this.pageIndex = 1;
  72. // this.getDcdxList1();
  73. // }
  74. nodeBatchId(n,o){
  75. if(n && n != ""){
  76. this.getDcdxList1();
  77. }
  78. },
  79. nodeGroupId(n,o){
  80. if(n && n != ""){
  81. this.getDcdxList1();
  82. }
  83. }
  84. },
  85. mounted: function() {
  86. this.input5 = '';
  87. this.getDcdxList1()
  88. },
  89. computed: {
  90. isAdmin:function(){
  91. return localStorage.getItem("isAdmin")? localStorage.getItem("isAdmin"): ''
  92. },
  93. userId:function(){
  94. return localStorage.getItem("userid")? localStorage.getItem("userid"): '1098101939614724096'
  95. }
  96. },
  97. methods: {
  98. getDcdxList1() {
  99. var _self = this;
  100. // if(!this.dczId){
  101. // return;
  102. // }
  103. // getDcdxList(this.dczId, this.objType, this.pageSize, this.pageIndex,this.isAll,this.input5,this.input5,this.input5).then(
  104. // response => {
  105. request.post(`/tac/insp/year/batch/obj/getObjPage`,{
  106. "pageNum":_self.pageIndex,
  107. "pageSize":_self.pageSize,
  108. "persId": "4c33a340045e43cfb8eabc9eb5de2ff8",
  109. "ojbNm": this.input5,
  110. // "persId": _self.userId
  111. "groupId": this.nodeGroupId,
  112. "yearBatchId": this.nodeBatchId
  113. }).then(response =>{
  114. var res = response.data;
  115. _self.tableData = res.list;
  116. _self.total = res.total;
  117. _self.tableData.forEach((element, index) => {
  118. element["index"] = _self.pageSize * (_self.pageIndex - 1) + index + 1;
  119. });
  120. });
  121. },
  122. editHandler(item) {
  123. this.$emit("showEditDialog_dx", item);
  124. },
  125. handleSizeChange() {},
  126. handleCurrentChange(val) {
  127. console.log(`当前页: ${val}`);
  128. this.getDcdxList1();
  129. },
  130. deleteHandler(item) {
  131. var _self = this;
  132. var idType = '';
  133. _self.$confirm('是否确认删除?', '提示', {
  134. confirmButtonText: '确定',
  135. cancelButtonText: '取消',
  136. type: 'warning'
  137. }).then(() => {
  138. deleteDcdx(item.objId, this.objType, this.dczId, this.plnaId).then(res => {
  139. if(res.success){
  140. _self.getDcdxList1(); //删除成功之后 刷新表格数据
  141. _self.$message({
  142. type: 'success',
  143. message: '删除成功'
  144. });
  145. }else{
  146. if(res.message == "请先删除登记表"){
  147. _self.$message({
  148. type: 'warning',
  149. message: '请联系管理员,删除登记表!'
  150. });
  151. }else{
  152. _self.$message({
  153. type: 'error',
  154. message: '删除失败'
  155. });
  156. }
  157. }
  158. });
  159. }).catch(() => {
  160. _self.$message({
  161. type: 'info',
  162. message: '已取消删除'
  163. });
  164. });
  165. },
  166. engScalFormatter: function(row, column) {
  167. return row.engScal == 4 ? "小一型" : "小二型";
  168. },
  169. rsAdmDepFormatter: function(row, column) {
  170. return row.rsAdmDep == 1
  171. ? "水利部门"
  172. : row.rsAdmDep == 2
  173. ? "电力部门"
  174. : row.rsAdmDep == 3
  175. ? "农业部门"
  176. : row.rsAdmDep == 4
  177. ? "林业部门"
  178. : row.rsAdmDep == 5
  179. ? "城建部门"
  180. : row.rsAdmDep == 6
  181. ? "航运部门"
  182. : row.rsAdmDep == 7
  183. ? "环保部门"
  184. : "其他部门";
  185. },
  186. },
  187. };
  188. </script>
  189. <style>
  190. </style>