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