houzhongjian
2024-07-23 8501060c4f921d1e744c477e4dc08eb47b52693c
提交 | 用户 | 时间
850106 1 <template>
H 2   <el-card shadow="never" class="aui-card--fill">
3     <div>
4       <el-form :inline="true" :model="dataForm" @keyup.enter.native="getDataList()">
5         <el-form-item>
6           <el-input v-model="dataForm.modelname" placeholder="模型名称" clearable></el-input>
7         </el-form-item>
8         <el-form-item>
9           <el-input v-model="dataForm.username" placeholder="用户名称" clearable></el-input>
10         </el-form-item>
11         <el-form-item>
12           <el-input v-model="dataForm.energytypename" placeholder="能源类型" clearable></el-input>
13         </el-form-item>
14         <el-form-item>
15           <el-button @click="searchDataList()">查询</el-button>
16         </el-form-item>
17       </el-form>
18       <el-table
19               :data="dataList"
20               border
21               v-loading="dataListLoading"
22               @selection-change="selectionChangeHandle"
23               style="width: 100%;">
24         <el-table-column
25                 type="selection"
26                 header-align="center"
27                 align="center"
28                 width="50">
29         </el-table-column>
30         <el-table-column
31                 type="index"
32                 align="center"
33                 width="50"
34                 label="序号"
35         >
36         </el-table-column>
37         <el-table-column
38                 prop="modelname"
39                 header-align="center"
40                 align="center"
41                 label="模型名称">
42         </el-table-column>
43         <el-table-column
44                 prop="username"
45                 header-align="center"
46                 align="center"
47                 label="用户名称">
48         </el-table-column>
49         <el-table-column
50                 prop="energytypename"
51                 header-align="center"
52                 align="center"
53                 width="150"
54                 label="能源类型">
55         </el-table-column>
56         <el-table-column
57                 prop="upadjlimit"
58                 header-align="center"
59                 align="center"
60                 width="100"
61                 label="调整上限">
62         </el-table-column>
63         <el-table-column
64                 prop="downadjlimit"
65                 header-align="center"
66                 align="center"
67                 width="100"
68                 label="调整下限">
69         </el-table-column>
70         <el-table-column
71                 prop="adjorder"
72                 header-align="center"
73                 align="center"
74                 width="100"
75                 label="调整排序">
76         </el-table-column>
77         <el-table-column
78                 fixed="right"
79                 header-align="center"
80                 align="center"
81                 label="操作">
82           <template slot-scope="scope">
83             <el-button type="text" size="small" @click="viewChart(scope.row.id)">调整值</el-button>
84           </template>
85         </el-table-column>
86       </el-table>
87       <el-pagination
88               @size-change="sizeChangeHandle"
89               @current-change="currentChangeHandle"
90               :current-page="pageIndex"
91               :page-sizes="[10, 20, 50, 100]"
92               :page-size="pageSize"
93               :total="totalPage"
94               layout="total, sizes, prev, pager, next, jumper">
95       </el-pagination>
96       <!-- 弹窗, 预测结果 -->
97       <detail-chart v-if="detailChartVisible" ref="detailChart"></detail-chart>
98     </div>
99   </el-card>
100 </template>
101
102 <script>
103   import DetailChart from './st-schedule-model-user-param-chart'
104
105   export default {
106     data () {
107       return {
108         dataForm: {
109           modelname: '',
110           username: '',
111           energytypename: ''
112         },
113         dataList: [],
114         pageIndex: 1,
115         pageSize: 10,
116         totalPage: 0,
117         dataListLoading: false,
118         dataListSelections: [],
119         addOrUpdateVisible: false,
120         detailViewVisible: false,
121         detailChartVisible: false
122       }
123     },
124     components: {
125       DetailChart
126     },
127     activated () {
128       this.getDataList()
129     },
130     methods: {
131       searchDataList () {
132         this.pageIndex = 1
133         this.getDataList()
134       },
135       // 获取数据列表
136       getDataList () {
137         this.dataListLoading = true
138         this.$http({
139           url: '/iailab-ntt-model/mcs/schedule-model-user-param/list',
140           method: 'get',
141           params: this.$http.adornParams({
142             'page': this.pageIndex,
143             'limit': this.pageSize,
144             'modelname': this.dataForm.modelname,
145             'username': this.dataForm.username,
146             'energytypename': this.dataForm.energytypename
147           })
148         }).then(({data}) => {
149           if (data && data.code === 0) {
150             this.dataList = data.page.list
151             this.totalPage = data.page.totalCount
152           } else {
153             this.dataList = []
154             this.totalPage = 0
155           }
156           this.dataListLoading = false
157         })
158       },
159       // 格式状态
160       formatStatus: function (row, column, cellValue, index) {
161         if (cellValue === 1) {
162           return '是'
163         } else {
164           return '否'
165         }
166       },
167       // 每页数
168       sizeChangeHandle (val) {
169         this.pageSize = val
170         this.pageIndex = 1
171         this.getDataList()
172       },
173       // 当前页
174       currentChangeHandle (val) {
175         this.pageIndex = val
176         this.getDataList()
177       },
178       // 多选
179       selectionChangeHandle (val) {
180         this.dataListSelections = val
181       },
182       // 新增 / 修改
183       addOrUpdateHandle (id) {
184         this.addOrUpdateVisible = true
185         this.$nextTick(() => {
186           this.$refs.addOrUpdate.init(id)
187         })
188       },
189       // 详情
190       viewHandle (id) {
191         this.detailViewVisible = true
192         this.$nextTick(() => {
193           this.$refs.detailView.init(id)
194         })
195       },
196       // 预测结果
197       viewChart (id) {
198         this.detailChartVisible = true
199         this.$nextTick(() => {
200           this.$refs.detailChart.init(id)
201         })
202       },
203       // 删除
204       deleteHandle (id) {
205         var ids = id ? [id] : this.dataListSelections.map(item => {
206           return item.id
207         })
208         this.$confirm(`确定删除选中的${ids.length}项数据?`, '提示', {
209           confirmButtonText: '确定',
210           cancelButtonText: '取消',
211           type: 'warning'
212         }).then(() => {
213           this.$http({
214             url: '/iailab-ntt-model/mcs/schedule-model/delete',
215             method: 'post',
216             data: this.$http.adornData(ids, false)
217           }).then(({data}) => {
218             if (data && data.code === 0) {
219               this.$message({
220                 message: '操作成功',
221                 type: 'success',
222                 duration: 1500,
223                 onClose: () => {
224                   this.getDataList()
225                 }
226               })
227             } else {
228               this.$message.error(data.msg)
229             }
230           })
231         }).catch(() => {})
232       }
233     }
234   }
235 </script>