wasteUpdateInfo.vue 5.58 KB
<template>
  <div class="app-body">
    <div class="content">
      <table>
        <tr>
          <th colspan="4" style="margin:0 auto;text-align: center">危险废物</th>
        </tr>
        <tr>
          <td colspan="2">废物名称:{{ wasteData.wasteName }}</td>
          <td rowspan="6">
            <div style="display: flex;flex-direction: column;align-items: center;height: 100%;">
              <div style="font-size: 1rem;">危险特性</div>
              <img style="width: 15vw;" src="../../assets/waste2.png" alt=""/>
              <img style="width: 15vw;margin: 5px 0;" src="../../assets/waste3.png" alt=""/>
              <img v-if="type=='1'" style="width: 15vw;" src="../../assets/waste1.png" alt=""/>
            </div>
          </td>
        </tr>

        <tr>
          <td>废物类别: {{ wasteData.wasteType }}</td>
        </tr>
        <tr>
          <td>废物代码: {{ wasteData.wasteCode }}</td>
        </tr>
        <tr>
          <td>废物形态: {{ wasteData.wasteForm }}</td>
        </tr>
        <tr style="word-break:break-all;overflow:hidden;">
          <td>主要成分: <br/>{{ wasteData.mainComponent }}</td>
        </tr>
        <tr style="word-break:break-all;overflow:hidden;">
          <td>有害成分: <br/>{{ wasteData.harmfulIngredient }}</td>
        </tr>
        <tr style="word-break:break-all;overflow:hidden;">
          <td colspan="4">注意事项: <br/>{{ wasteData.announcements }}</td>
        </tr>
        <tr>
          <td colspan="4">数字识别码: {{ wasteData.numericIdentificationCode }}</td>
        </tr>
        <tr style="word-break:break-all;overflow:hidden;">
          <td colspan="4">产生/收集单位 : {{ wasteData.produceUnit }}</td>
        </tr>
        <tr style="word-break:break-all;overflow:hidden;">
          <td colspan="4" style="color: white">废物总重量: {{ wasteData.wasteWeight }}/kg</td>
        </tr>
        <tr style="height: 80px;">
          <td colspan="4">
            <div style="width: 100%;height: 100%;">
              <label style="font-weight: 800;">操作:</label>
              <select v-model="opp_type"
                      style="width: 61vw;
                                height: 3.8vh;
                                margin-left: 5vw;"
              >
                <option value="1">转入</option>
                <option value="2">转出</option>
              </select>
            </div>
          </td>
        </tr>
        <tr height="50px" v-if="opp_type=='2'">
          <td colspan="4"><label style="font-weight: 800;">转出单位:</label> <input v-model="receivingUnitr"
                                                                                style="height: 30px;width: 60vw"
                                                                                type="text"/></td>
        </tr>
        <tr>
          <td colspan="4"><label style="font-weight: 800;">转出重量:</label> <input v-model.number="weight"
                                                                                style="height: 30px;width: 60vw"
                                                                                type="text"/>/kg
          </td>
        </tr>
        <tr>

          <td colspan="4">
            <div style="display: flex;">
              <label style="font-weight: 800;margin-top: 2rem">操作备注:</label>
              <textarea v-model="opp_remark" maxlength="120"
                        style="height: 80px;width: 60vw;word-break:break-all;overflow:hidden;"
                        type="text"/>
            </div>

          </td>
        </tr>

        <tr style="height: 80px;">
          <td colspan="4" style="text-align: center;">
            <button style="width: 20rem;height: 3rem;" @click="submit">提交</button>
          </td>
        </tr>
      </table>
    </div>
  </div>
</template>

<script>
import {getWasteInfo, updateWaste} from '@/api/api';

export default {
  name: "wasteUpdateInfo",
  data() {
    return {
      id: '',
      type: '',
      wasteData: [],
      weight: '',
      opp_type: '1',
      receivingUnitr: '',
      opp_remark: '',
    }
  },
  created() {
    this.getWasteInfo();
  },
  methods: {
    getWasteInfo() {
      var params = {};
      location.search.substr(1).split('&').forEach(function (item) {
        var s = item.split('=');
        params[s[0]] = s[1];
        params[s[1]] = s[2];
      });
      this.id = params.id
      this.type = params.type
      let params2 = {
        'id': this.id
      }
      getWasteInfo(params2).then(res => {
        this.wasteData = res.result;

      })
    },
    submit() {
      if (typeof this.weight !== 'number') {
        alert('请输入正确的重量')
        return
      }
      let params3 = {
        'headId': this.wasteData.id,
        'wasteWeight': this.weight,
        'type': this.opp_type,
        'receivingUnitr': this.receivingUnitr,
        'remark': this.opp_remark
      }
      updateWaste(params3).then(res => {
        this.getWasteInfo();
        this.clearInput();
        alert(res.result);
      })

    },
    clearInput() {
      this.weight = '';
      this.opp_type = '1';
      this.receivingUnitr = '';
      this.opp_remark = '';
    }
  },
}
</script>

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

.content {
  width: 99.1%;
  height: 100%;
  border: 1px solid yellowgreen;
  margin: 0 auto;
  background-color: #ec9627;
}

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;
}

.form-group {
  margin: 10px;
}
</style>