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