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.rq" placeholder="日期" clearable></el-input>
7         </el-form-item>
8         <el-form-item>
9           <el-input v-model="dataForm.bc" placeholder="班次" clearable></el-input>
10         </el-form-item>
11         <el-form-item>
12           <el-button @click="searchDataList()">查询</el-button>
13           <el-button v-if="$hasPermission('coal:prod-quality-bc:add')" type="primary" @click="addOrUpdateHandle()">新增</el-button>
14           <el-button v-if="$hasPermission('coal:prod-quality-bc:delete')" type="danger" @click="deleteHandle()" :disabled="dataListSelections.length <= 0">批量删除</el-button>
15         </el-form-item>
16       </el-form>
17       <el-table
18               :data="dataList"
19               border
20               v-loading="dataListLoading"
21               @selection-change="selectionChangeHandle"
22               style="width: 100%;">
23         <el-table-column
24                 type="selection"
25                 header-align="center"
26                 align="center"
27                 width="50">
28         </el-table-column>
29         <el-table-column
30                 type="index"
31                 align="center"
32                 width="50"
33                 label="序号">
34         </el-table-column>
35         <el-table-column
36                 prop="rq"
37                 header-align="center"
38                 align="center"
39                 width="200"
40                 label="日期">
41         </el-table-column>
42         <el-table-column
43                 prop="bc"
44                 header-align="center"
45                 align="center"
46                 width="100"
47                 label="班次">
48         </el-table-column>
49         <el-table-column
50                 prop="cyd"
51                 header-align="center"
52                 align="center"
53                 width="100"
54                 label="采样点">
55         </el-table-column>
56         <el-table-column
57                 prop="cysj"
58                 header-align="center"
59                 align="center"
60                 width="200"
61                 label="采样时间">
62         </el-table-column>
63         <el-table-column
64                 prop="hysj"
65                 header-align="center"
66                 align="center"
67                 width="200"
68                 label="化验时间">
69         </el-table-column>
70         <el-table-column
71                 prop="cysl"
72                 header-align="center"
73                 align="center"
74                 min-width="100"
75                 label="采样数量">
76         </el-table-column>
77         <el-table-column
78                 prop="hf"
79                 header-align="center"
80                 align="center"
81                 width="100"
82                 label="灰分(Aad)%">
83         </el-table-column>
84         <el-table-column
85                 prop="qsf"
86                 header-align="center"
87                 align="center"
88                 width="120"
89                 label="全水分(Mt)%">
90         </el-table-column>
91         <el-table-column
92                 prop="fxs"
93                 header-align="center"
94                 align="center"
95                 width="120"
96                 label="分析水(Mad)%">
97         </el-table-column>
98         <el-table-column
99                 prop="hff"
100                 header-align="center"
101                 align="center"
102                 width="120"
103                 label="挥发分(Vad)%">
104         </el-table-column>
105         <el-table-column
106                 prop="ql"
107                 header-align="center"
108                 align="center"
109                 width="100"
110                 label="全硫(St)%">
111         </el-table-column>
112         <el-table-column
113                 prop="gdt"
114                 header-align="center"
115                 align="center"
116                 width="120"
117                 label="固定碳(FCad)%">
118         </el-table-column>
119         <el-table-column
120                 prop="frl"
121                 header-align="center"
122                 align="center"
123                 width="120"
124                 label="发热量(kcal/kg)">
125         </el-table-column>
126         <el-table-column
127                 v-if="$hasPermission('coal:prod-quality-bc:edit')"
128                 fixed="right"
129                 header-align="center"
130                 align="center"
131                 width="100"
132                 label="操作">
133           <template slot-scope="scope">
134             <el-button type="text" size="small" @click="addOrUpdateHandle(scope.row.id)">修改</el-button>
135           </template>
136         </el-table-column>
137       </el-table>
138       <el-pagination
139               @size-change="sizeChangeHandle"
140               @current-change="currentChangeHandle"
141               :current-page="pageIndex"
142               :page-sizes="[10, 20, 50, 100]"
143               :page-size="pageSize"
144               :total="totalPage"
145               layout="total, sizes, prev, pager, next, jumper">
146       </el-pagination>
147       <!-- 弹窗, 新增 / 修改 -->
148       <add-or-update v-if="addOrUpdateVisible" ref="addOrUpdate" @refreshDataList="getDataList"></add-or-update>
149     </div>
150   </el-card>
151 </template>
152
153 <script>
154   import AddOrUpdate from './prod-quality-bc-add-or-update'
155
156   export default {
157     data () {
158       return {
159         dataForm: {
160           rq: '',
161           bc: ''
162         },
163         dataList: [],
164         pageIndex: 1,
165         pageSize: 10,
166         totalPage: 0,
167         dataListLoading: false,
168         dataListSelections: [],
169         addOrUpdateVisible: false
170       }
171     },
172     components: {
173       AddOrUpdate
174     },
175     mounted () {
176       this.getDataList()
177     },
178     methods: {
179       searchDataList () {
180         this.pageIndex = 1
181         this.getDataList()
182       },
183       // 获取数据列表
184       getDataList () {
185         this.dataListLoading = true
186         this.$http({
187           url: '/data/coal/prod-quality-bc/list',
188           method: 'get',
189           params: this.$http.adornParams({
190             'page': this.pageIndex,
191             'limit': this.pageSize,
192             'rq': this.dataForm.rq,
193             'bc': this.dataForm.bc
194           })
195         }).then(({data}) => {
196           if (data && data.code === 0) {
197             this.dataList = data.page.list
198             this.totalPage = data.page.totalCount
199           } else {
200             this.dataList = []
201             this.totalPage = 0
202           }
203           this.dataListLoading = false
204         })
205       },
206       // 每页数
207       sizeChangeHandle (val) {
208         this.pageSize = val
209         this.pageIndex = 1
210         this.getDataList()
211       },
212       // 当前页
213       currentChangeHandle (val) {
214         this.pageIndex = val
215         this.getDataList()
216       },
217       // 多选
218       selectionChangeHandle (val) {
219         this.dataListSelections = val
220       },
221       // 新增 / 修改
222       addOrUpdateHandle (id) {
223         this.addOrUpdateVisible = true
224         this.$nextTick(() => {
225           this.$refs.addOrUpdate.init(id)
226         })
227       },
228       // 删除
229       deleteHandle (id) {
230         var ids = id ? [id] : this.dataListSelections.map(item => {
231           return item.id
232         })
233         this.$confirm(`确定删除选中的${ids.length}项数据?`, '提示', {
234           confirmButtonText: '确定',
235           cancelButtonText: '取消',
236           type: 'warning'
237         }).then(() => {
238           this.$http({
239             url: '/data/coal/prod-quality-bc/delete',
240             method: 'post',
241             data: this.$http.adornData(ids, false)
242           }).then(({data}) => {
243             if (data && data.code === 0) {
244               this.$message({
245                 message: '操作成功',
246                 type: 'success',
247                 duration: 1500,
248                 onClose: () => {
249                   this.getDataList()
250                 }
251               })
252             } else {
253               this.$message.error(data.msg)
254             }
255           })
256         }).catch(() => {})
257       }
258     }
259   }
260 </script>