| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173 |
- <template>
- <div style="height:100%;max-height:100%;overflow-y:hidden;display:flex;flex-direction:column;justify-content:space-between;">
- <div class="box-card"
- style="background-color:#ECF8FF;height:40px;font-size:small;line-height:30px;display: flex;
- justify-content: space-between;align-items: center;">
- <div style="display:flex;">
- <el-checkbox v-model="checked">本级</el-checkbox>
- <el-input placeholder="请输入对象名称" v-model="input5" style="width:200px;margin-left: 30px;" class="input-with-select">
- <el-button slot="append" @click="getDcdxList1" icon="el-icon-search"></el-button>
- </el-input>
- </div>
- <el-button v-if="dczId.length==12" @click="editHandler" type="primary" icon="el-icon-edit" v-show="showEdit"
- style="float:right;margin-right:10px;height: 30px;" plain size="mini" >添加对象</el-button>
- </div>
- <el-table key='firstTable' :data="tableData" style="width: 100%;max-height:85%;overflow:hidden;" :height="tableHeight1" >
- <el-table-column align="center" prop="index" label="序号" min-width="40"></el-table-column>
- <el-table-column align="center" show-overflow-tooltip prop="name" label="项目名称" min-width="100"></el-table-column>
- <el-table-column align="center" show-overflow-tooltip prop="type" label="项目类型" min-width="100"></el-table-column>
- <el-table-column align="center" show-overflow-tooltip prop="location" label="位置" min-width="150"></el-table-column>
- <el-table-column align="center" show-overflow-tooltip prop="admOrg" label="所属流域机构" min-width="100"></el-table-column>
- <el-table-column align="center" show-overflow-tooltip prop="pnm" label="所在分组" min-width="80"></el-table-column>
- <el-table-column fixed="right" prop="address" label="操作" min-width="60" v-if="ownPriv('manage')">
- <template slot-scope="scope">
- <el-button @click="deleteHandler(scope.row)" type="text" size="small">删除</el-button>
- </template>
- </el-table-column>
- </el-table>
- <div style="display:flex;flex-direction:row;justify-content:space-between;align-items:center;margin-top:5px;">
- <el-pagination
- @current-change="handleCurrentChange"
- :current-page.sync="pageIndex"
- :page-size="pageSize"
- layout="total, prev, pager, next"
- :total="total"
- ></el-pagination>
- </div>
- </div>
- </template>
- <script>
- import Vue from "vue";
- import { getDcdxList, deleteDcdx } from "../../api/duChaPlan.js";
- export default {
- components: {},
- props: ["dczId", "zuName", "objType", "plnaId"], //objType业务类型
- data: function() {
- return {
- input5:'',
- showEdit: true,
- tableData: [],
- pageIndex: 1,
- pageSize: 10,
- total: 0,
- tableHeight1:window.innerHeight - 355,
- checked:false,
- isAll:'1',
- };
- },
- created() {
-
- },
- watch: {
- dczId: function(n, o) {
- this.getDcdxList1(n);
- },
- checked(n,o){
- if(n==true){
- this.isAll = '0';
- }else{
- this.isAll = '1';
- }
- this.pageIndex = 1;
- this.getDcdxList1();
- }
- },
- mounted: function() {
- this.input5 = '';
- this.getDcdxList1()
- },
- computed: {
- isAdmin:function(){
- return localStorage.getItem("isAdmin")? localStorage.getItem("isAdmin"): ''
- },
- },
- methods: {
- getDcdxList1() {
- var _self = this;
- if(!this.dczId){
- return;
- }
- getDcdxList(this.dczId, this.objType, this.pageSize, this.pageIndex,this.isAll,this.input5,this.input5,this.input5).then(
- response => {
- var res = response.data;
- _self.tableData = res.list;
- _self.total = res.total;
- _self.tableData.forEach((element, index) => {
- element["index"] = _self.pageSize * (_self.pageIndex - 1) + index + 1;
- });
- });
- },
- editHandler(item) {
- this.$emit("showEditDialog_dx", item);
- },
- handleSizeChange() {},
- handleCurrentChange(val) {
- console.log(`当前页: ${val}`);
- this.getDcdxList1();
- },
- deleteHandler(item) {
- var _self = this;
- var idType = '';
- _self.$confirm('是否确认删除?', '提示', {
- confirmButtonText: '确定',
- cancelButtonText: '取消',
- type: 'warning'
- }).then(() => {
- deleteDcdx(item.objId, this.objType, this.dczId, this.plnaId).then(res => {
- if(res.success){
- _self.getDcdxList1(); //删除成功之后 刷新表格数据
- _self.$message({
- type: 'success',
- message: '删除成功'
- });
- }else{
- if(res.message == "请先删除登记表"){
- _self.$message({
- type: 'warning',
- message: '请联系管理员,删除登记表!'
- });
- }else{
- _self.$message({
- type: 'error',
- message: '删除失败'
- });
- }
- }
- });
- }).catch(() => {
- _self.$message({
- type: 'info',
- message: '已取消删除'
- });
- });
- },
- engScalFormatter: function(row, column) {
- return row.engScal == 4 ? "小一型" : "小二型";
- },
- rsAdmDepFormatter: function(row, column) {
- return row.rsAdmDep == 1
- ? "水利部门"
- : row.rsAdmDep == 2
- ? "电力部门"
- : row.rsAdmDep == 3
- ? "农业部门"
- : row.rsAdmDep == 4
- ? "林业部门"
- : row.rsAdmDep == 5
- ? "城建部门"
- : row.rsAdmDep == 6
- ? "航运部门"
- : row.rsAdmDep == 7
- ? "环保部门"
- : "其他部门";
- },
- },
- };
- </script>
- <style>
- </style>
|