前端使用Pagination分页

 <template>
  <div class="app-container">
    <div class="filter-container">
      <el-button type="primary" @click="add">
        新增
      </el-button>
      <div class="filter-container">
        <el-input
          v-model="listQuery.projectName"
          placeholder="项目名称"
          style="width: 200px"
          class="filter-item"
        />
        <el-button class="filter-item" type="primary" icon="el-icon-search" @click="handleFilter">
          搜索
        </el-button>
        <el-button class="filter-item" type="reset" icon="el-icon-reset" @click="reset">
          重置
        </el-button>
      <!-- <el-button v-if="buttonPermissions.add" type="primary" @click="add">
        新增
      </el-button> -->
      </div>

    </div>
    <div>
      <el-table
        :data="data"
        highlight-current-row
        stripe
        :default-sort="{prop: 'code', order: 'descending'}"
        :header-cell-style="{background:'#6B9BCC', color:'#fff'}"
        class="table-margin"
        border
        :height="tableHeight"
      >
        <el-table-column
          prop="projectType"
          header-align="center"
          align="center"
          label="项目名称"
        />
        <el-table-column
          prop="jcsj"
          header-align="center"
          label="基础数据"
          align="center"
        >
          <template slot-scope="scop">
            <el-tag v-if="scop.row.jcsj!==null" type="success">已提交数据</el-tag>
            <el-tag v-else type="warning">未提交数据</el-tag>
          </template>
        </el-table-column>
        <el-table-column
          prop="tfsjyz"
          header-align="center"
          label="通风设计原则"
          align="center"
        >
          <template slot-scope="scop">
            <el-tag v-if="scop.row.tfsjyz!==null" type="success">已提交数据</el-tag>
            <el-tag v-else type="warning">未提交数据</el-tag>
          </template>
        </el-table-column>
        <el-table-column
          prop="tfjs"
          header-align="center"
          label="通风计算"
          align="center"
        >
          <template slot-scope="scop">
            <el-tag v-if="scop.row.tfjs!==null" type="success">已提交数据</el-tag>
            <el-tag v-else type="warning">未提交数据</el-tag>
          </template>

        </el-table-column>
        <el-table-column
          prop="ftktjs"
          header-align="center"
          label="分体空调计算"
          align="center"
        >
          <template slot-scope="scop">
            <el-tag v-if="scop.row.ftktjs!==null" type="success">已提交数据</el-tag>
            <el-tag v-else type="warning">未提交数据</el-tag>
          </template>

        </el-table-column>
        <el-table-column
          prop="dyjss"
          header-align="center"
          label="打印机算书"
          align="center"
        >
          <template slot-scope="scop">
            <el-tag v-if="scop.row.dyjss!==null" type="success">已提交数据</el-tag>
            <el-tag v-else type="warning">未提交数据</el-tag>
          </template>

        </el-table-column>
        <el-table-column
          prop="listairconditioners"
          header-align="center"
          label="LIST-AIR CONDITIONERS"
          align="center"
        >
          <template slot-scope="scop">
            <el-tag v-if="scop.row.listairconditioners!==null" type="success">已提交数据</el-tag>
            <el-tag v-else type="warning">未提交数据</el-tag>
          </template>
        </el-table-column>
        <el-table-column
          prop="listfans"
          header-align="center"
          label="LIST-FANS"
          align="center"
        >
          <template slot-scope="scop">
            <el-tag v-if="scop.row.listfans!==null" type="success">已提交数据</el-tag>
            <el-tag v-else type="warning">未提交数据</el-tag>
          </template>
        </el-table-column>
        <el-table-column
          prop="listheatingfan"
          header-align="center"
          label="LIST-FANS"
          align="center"
        >
          <template slot-scope="scop">
            <el-tag v-if="scop.row.listheatingfan!==null" type="success">已提交数据</el-tag>
            <el-tag v-else type="warning">未提交数据</el-tag>
          </template>

        </el-table-column>
        <el-table-column
          prop="listfiredampers"
          header-align="center"
          label="LIST-FIRE DAMPERS"
          align="center"
        >
          <template slot-scope="scop">
            <el-tag v-if="scop.row.listfiredampers!==null" type="success">已提交数据</el-tag>
            <el-tag v-else type="warning">未提交数据</el-tag>
          </template>

        </el-table-column>
        <el-table-column
          prop="listotherdamper"
          header-align="center"
          label="LIST-OTHER DAMPER"
          align="center"
        >
          <template slot-scope="scop">
            <el-tag v-if="scop.row.listotherdamper!==null" type="success">已提交数据</el-tag>
            <el-tag v-else type="warning">未提交数据</el-tag>
          </template>

        </el-table-column>
        <el-table-column
          prop="xfljs"
          header-align="center"
          label="新风量计算"
          align="center"
        >
          <template slot-scope="scop">
            <el-tag v-if="scop.row.xfljs!==null" type="success">已提交数据</el-tag>
            <el-tag v-else type="warning">未提交数据</el-tag>
          </template>

        </el-table-column>
        <el-table-column
          prop="tbld"
          header-align="center"
          label="投标料单"
          align="center"
        >
          <template slot-scope="scop">
            <el-tag v-if="scop.row.tbld!==null" type="success">已提交数据</el-tag>
            <el-tag v-else type="warning">未提交数据</el-tag>
          </template>

        </el-table-column>
        <el-table-column
          header-align="center"
          label="操作"
          align="center"
        >
          <template slot-scope="scope">
            <el-button
              type="text"
              size="small"
              @click="modifyRow(scope.row)"
            >
              编辑
            </el-button>
            <el-button
              type="text"
              size="small"
              @click="deleteData(scope.row)"
            >
              移除
            </el-button>
          </template>
        </el-table-column>
      </el-table>
      <pagination v-show="total > 0" :total="total" :page.sync="listQuery.page" :limit.sync="listQuery.size" @pagination="getList" />
    </div>
    <div>
      <el-dialog title="新增" :visible.sync="dialogVisible" width="50%" center>
        <el-form ref="dataForm" :model="temp" label-width="80px" label-position="left" style="width: 40%; margin: 0px auto" :rules="rules">
          <el-form-item label="项目名称" prop="projectType">
            <el-input v-model="temp.projectType" auto-complete="off" placeholder="项目名称" style="width: 300px" />
          </el-form-item>
        </el-form>
        <span slot="footer" class="dialog-footer">
          <el-button type="danger" @click="dialogVisible = false">取消</el-button>
          <el-button type="primary" @click="confirm">确认</el-button>
        </span>
      </el-dialog>
    </div>
  </div>
</template>

<script>
import { getAllCalculationResultList, updateAllCalculationResult } from '@/api/projectMaintenance/projectMaintenance'
import Pagination from '@/components/Pagination'
export default {
  components: {
    Pagination
  },
  data() {
    return {
      tableHeight: window.innerHeight - 250,
      dialogVisible: false,
      temp: {
        projectType: null
      },
      data: null,
      listQuery: {
        projectName: '',
        page: 1,
        size: 10
      },
      total: 0,
      rules: {
        projectType: [{ required: true, message: '请输入项目名称', trigger: 'blur' }]
      }
    }
  },
  created() {
    this.getList()
  },
  methods: {
    getList() {
      getAllCalculationResultList(this.listQuery).then(response => {
        this.data = response.data
        this.total = response.totalElements
        console.log(this.data)
      })
    },
    handleFilter() {
      this.listQuery.page = 1
      this.getList()
    },
    confirm() {
      this.$refs['dataForm'].validate((valid) => {
        if (valid) {
          updateAllCalculationResult(this.temp).then(response => {
            if (response.success) {
              this.$notify({
                title: '提示',
                message: '添加成功',
                type: 'success',
                duration: 2000
              })
              this.getList()
              this.dialogVisible = false
            } else {
              this.$notify({
                title: '提示',
                message: response.msg,
                type: 'warning',
                duration: 2000
              })
            }
          })
        }
      })
    },
    add() {
      this.dialogVisible = true
    }
  }
}

</script>
  <style lang="scss" scoped>
  .el-dialog{
    border-radius: 15px;
    margin-bottom: 100px;
  }
  .el-dialog__header{
    border-radius: 15px 15px 0px 0px;
    border-bottom: 1px solid #e8eaec;
    background-color: #66B1FF;
  }
  .el-dialog__title {
      line-height: 24px;
      letter-spacing:18px;
      font-size: 20px;
      color: #fefeff;
  }
  .el-dialog__footer {
    border-top: 1px solid #e8eaec;
  }
  .filter-container {
          margin-top: 0.5%;
  }
  </style> 

链接: 后台代码

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值