选煤厂生产管理平台前端代码
dongyukun
2024-12-10 5cc1d92af645c2f8f4f6d1d3777283b70df78ccd
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
<template>
  <div class="mod-prod-plan-det">
    <el-form :inline="true" :model="dataForm">
      <el-form-item>
        <span>入洗明细</span><span>【{{dataForm.lsh}}】</span>
      </el-form-item>
      <el-form-item>
        <el-button size="mini" @click="getDataList()">{{ $t('refresh') }}</el-button>
        <el-button size="mini" type="primary" @click="openForm(dataForm.id)">新增</el-button>
      </el-form-item>
    </el-form>
    <el-table
        ref="table"
        :data="dataList"
        border
        height="400"
        highlight-current-row
        v-loading="dataListLoading"
        style="width: 100%;">
      <el-table-column type="index" header-align="center" align="center" width="50" label="序号"></el-table-column>
      <el-table-column prop="mzName" header-align="center" align="center" label="入洗煤种"></el-table-column>
      <el-table-column prop="bl" header-align="center" align="center" label="入洗比例(%)"></el-table-column>
      <el-table-column prop="rxl" header-align="center" align="center" label="入洗量"></el-table-column>
      <el-table-column prop="bz" header-align="center" align="center" label="备注"></el-table-column>
      <el-table-column :label="$t('handle')" fixed="right" header-align="center" align="center" width="150">
          <template slot-scope="scope">
            <el-button type="text" size="small" @click="openForm(dataForm.id,scope.row.id)">修改</el-button>
            <el-button type="text" size="small" @click="handleDelete(scope.row.id)">删除</el-button>
          </template>
      </el-table-column>
    </el-table>
    <add-or-update v-if="addOrUpdateVisible" ref="addOrUpdate" @refreshDataList="getDataList"></add-or-update>
  </div>
</template>
<script>
  import mixinViewModule from '@/mixins/view-module'
  import AddOrUpdate from './list-add-or-update';
  export default {
    mixins: [mixinViewModule],
    data() {
      return {
        dataList: [],
        dataForm: {
          id: '',
          lsh: ''
        },
        dataListLoading: false
      }
    },
    components: {
    AddOrUpdate
    },
    methods: {
      // 新增 或 修改
      openForm (washId,id) {
        if( washId == ''){
        this.$alert('请先选择要编辑的总入洗量', '提示', {
          confirmButtonText: '确定',
        });
      }else{
        this.addOrUpdateVisible = true
        this.$nextTick(() => {
          this.$refs.addOrUpdate.init(id,washId)
        })
      }
      },
      //删除
      handleDelete(id){
      this.$confirm(`确定对所选项目进行[删除]操作?`, '提示', {
        confirmButtonText: '确定',
        cancelButtonText: '取消',
        type: 'warning'
      }).then(() => {
        this.$http.post(`/iailab-iems-coal-proddisp/wash/to-wash/deleteDet/${id}`).then(({data: res}) => {
           if (res.code !== 0) {
            this.$message.error(data.msg)
          } else {
            this.$message({
              message: '操作成功',
              type: 'success',
              duration: 1500,
            })
            this.getDataList()
          }
        })
      }).catch(() => {})
    },
 
      init(row) {
        this.dataForm.id = row.id || '0'
        this.dataForm.lsh = row.lsh
        this.$nextTick(() => {
          this.getDataList()
        })
      },
      // 获取数据列表
      getDataList() {
        this.dataListLoading = true
        this.$http.get(`/iailab-iems-coal-proddisp/wash/to-wash/selectDetList/${this.dataForm.id}`).then(({data: res}) => {
          if (res.code !== 0) {
            return this.$message.error(res.msg)
            this.dataListLoading = false
          }
          this.dataList = res.list
          this.dataListLoading = false
        }).catch(() => {
        })
      }
    }
  }
</script>