21d39b2dd7ea952dbf9dbb081a912d8d77960683.svn-base 5.2 KB

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