wasteList.vue 1.7 KB
<template>
  <div class="content">
    <table>
      <tr>
        <th>名称</th>
        <th>代码</th>
        <th>重量</th>
        <th>操作</th>
      </tr>
      <tr v-for="(item, index) in wasteList" :key="index">
        <td>{{ item.wasteName }}</td>
        <td>{{ item.wasteCode }}</td>
        <td>{{ item.wasteWeight }}/kg</td>

        <td :class="'text-center'">
          <button @click="Jump(item)">跳转</button>
        </td>
      </tr>
    </table>
  </div>
</template>

<script>
import {getWasteInfoList} from '@/api/api';

export default {
  name: "wasteList",
  data() {
    return {
      wasteList: []
    }
  },
  created() {
    getWasteInfoList().then(res => {
      this.wasteList = res.result;

    })
  },
  methods: {
    Jump(record) {
      var url = this.MTS.base_pro_URL + '/waste/wasteInfo?id=' + record.id + '&type=' + record.picType;
      window.location.href = url
    },
  },
}
</script>

<style scoped>
.app-body {
  width: 100%;
  height: 100%;
}

.content {
  width: 99.1%;
  height: 100%;
  border: 1px solid yellowgreen;
  margin: 0 auto;
}

body {
  font-size: 1rem;
}

table,
td,
th {
  border-collapse: collapse;
  border-spacing: 0;
}

table {
  width: 100%;
  margin-top: 10px;
}

td,
th {
  border: 2px solid #000000;
  padding: 5px 10px;
}

th {
  background: #42b983;
  font-size: 1.2rem;
  font-weight: 400;
  color: #fff;
  cursor: pointer;
}

tr:nth-of-type(odd) {
  background: #fff;
}

tr:nth-of-type(even) {
  background: #eee;
}

button {
  outline: none;
  padding: 5px 8px;
  color: #fff;
  border: 1px solid #bcbcbc;
  border-radius: 3px;
  background-color: #009a61;
  cursor: pointer;
}

button:hover {
  opacity: 0.8;
}

.text-center {
  text-align: center;
}
</style>