houzhongjian
2024-07-23 8501060c4f921d1e744c477e4dc08eb47b52693c
提交 | 用户 | 时间
850106 1 <template>
H 2   <el-card shadow="never" class="aui-card--fill">
3     <div class="mod-znfx__st-model}">
4       <el-form :inline="true" :model="dataForm" @keyup.enter.native="getDataList()">
5         <el-form-item>
6           <el-input v-model="dataForm.modelCode" placeholder="模型编码" clearable></el-input>
7         </el-form-item>
8         <el-form-item>
9           <el-input v-model="dataForm.modelName" placeholder="模型名称" clearable></el-input>
10         </el-form-item>
11         <el-form-item  prop="modelType">
12           <dict-select-tag style="width: 100%;" v-model="dataForm.modelType" dictCode="model_type"
13                            placeholder="模型类型" clearable></dict-select-tag>
14         </el-form-item>
15         <el-form-item  prop="modelType">
16           <dict-select-tag style="width: 100%;" v-model="dataForm.isEnable" dictCode="enable"
17                            placeholder="是否启用" clearable></dict-select-tag>
18         </el-form-item>
19         <el-form-item>
20           <el-button @click="getDataList()">{{ $t('query') }}</el-button>
21         </el-form-item>
22         <el-form-item>
23           <el-button type="primary" @click="addOrUpdateHandle()">{{
24             $t('add') }}
25           </el-button>
26         </el-form-item>
27         <el-form-item>
28           <el-button type="danger" @click="deleteHandle()">{{
29             $t('deleteBatch') }}
30           </el-button>
31         </el-form-item>
32         <el-form-item>
33           <el-button type="success" @click="enableHandle()">启用</el-button>
34         </el-form-item>
35         <el-form-item>
36           <el-button type="danger" @click="disableHandle()">禁用</el-button>
37         </el-form-item>
38       </el-form>
39       <el-table v-loading="dataListLoading" :data="dataList" border @selection-change="dataListSelectionChangeHandle"
40                 style="width: 100%;">
41         <el-table-column type="selection" header-align="center" align="center" width="50"></el-table-column>
42         <el-table-column prop="modelCode" :label="$t('model.modelCode')" header-align="center"
43                          align="left" min-width="150"></el-table-column>
44         <el-table-column prop="modelName" :label="$t('model.modelName')" header-align="center"
45                          align="left" min-width="150"></el-table-column>
46         <el-table-column prop="modelTypeName" :label="$t('model.modelType')" header-align="center"
47                          align="center" width="100"></el-table-column>
48         <el-table-column prop="modelParent" :label="$t('model.modelParent')" header-align="center"
49                          align="center" width="150"></el-table-column>
50         <el-table-column prop="modelPath" :label="$t('model.modelPath')" header-align="center"
51                          align="left" min-width="300"></el-table-column>
52         <el-table-column prop="methodName" :label="$t('model.methodName')" header-align="center"
53                          align="center" min-width="100"></el-table-column>
54         <el-table-column prop="paramsStructure" :label="$t('model.paramsStructure')" header-align="center"
55                          align="left" min-width="200"></el-table-column>
56         <el-table-column prop="isEnable" :label="$t('user.status')" header-align="center" align="center">
57           <template slot-scope="scope">
58             <el-tag v-if="scope.row.isEnable === 0" size="small" type="danger">禁用</el-tag>
59             <el-tag v-else size="small" type="success">启用</el-tag>
60           </template>
61         </el-table-column>
62         <el-table-column prop="runTime" :label="$t('model.runTime')" header-align="center"
63                          align="center" width="160"></el-table-column>
64         <el-table-column :label="$t('handle')" fixed="right" header-align="center" align="center" width="150">
65           <template slot-scope="scope">
66             <el-button type="text" size="small"
67                        @click="addOrUpdateHandle(scope.row.id)">{{ $t('update') }}
68             </el-button>
69             <el-button type="text" size="small"
70                        @click="deleteHandle(scope.row.id)">{{ $t('delete') }}
71             </el-button>
72             <el-button type="text" size="small"
73                        @click="logHandle(scope.row.id)">{{ $t('model.log') }}
74             </el-button>
75             <el-button type="text" size="small"
76                        @click="updateModelDoc(scope.row)">{{ $t('model.doc') }}
77             </el-button>
78           </template>
79         </el-table-column>
80       </el-table>
81       <el-pagination
82           :current-page="page"
83           :page-sizes="[10, 20, 50, 100]"
84           :page-size="limit"
85           :total="total"
86           layout="total, sizes, prev, pager, next, jumper"
87           @size-change="pageSizeChangeHandle"
88           @current-change="pageCurrentChangeHandle">
89       </el-pagination>
90       <!-- 弹窗, 新增 / 修改 -->
91       <add-or-update v-if="addOrUpdateVisible" ref="addOrUpdate" @refreshDataList="getDataList"></add-or-update>
92       <!-- 弹窗, 日志列表 -->
93       <log v-if="logVisible" ref="log"></log>
94       <doc-update v-if="docUpdateVisible" ref="docUpdate"> </doc-update>
95     </div>
96   </el-card>
97 </template>
98
99 <script>
100   import mixinViewModule from '@/mixins/view-module'
101   import AddOrUpdate from './st-model-add-or-update'
102   import Log from './st-model-log'
103   import DocUpdate from './st-model-doc-add-or-update'
104   import DictSelectTag from "@/components/dict/dict-select-tag.vue";
105
106   export default {
107     mixins: [mixinViewModule],
108     data() {
109       return {
110         mixinViewModuleOptions: {
111           getDataListURL: '/model/mcs/st-model/page',
112           getDataListIsPage: true,
113           exportURL: '/model/mcs/st-model/export',
114           deleteURL: '/model/mcs/st-model',
115           deleteIsBatch: true
116         },
117         dataForm: {
118           modelCode: '',
119           modelName: ''
120         },
121         logVisible: false,
122         docUpdateVisible: false
123       }
124     },
125     components: {
126       DictSelectTag,
127       AddOrUpdate,
128       Log,
129       DocUpdate
130     },
131     methods: {
132       // 日志列表
133       logHandle(id) {
134         this.logVisible = true
135         this.$nextTick(() => {
136           this.$refs.log.init(id)
137         })
138       },
139       // 修改文档
140       updateModelDoc(rwo) {
141         this.docUpdateVisible = true
142         this.$nextTick(() => {
143           this.$refs.docUpdate.init(rwo)
144         })
145       },
146
147       // 启用
148       enableHandle(id) {
149         if (!id && this.dataListSelections.length <= 0) {
150           return this.$message({
151             message: this.$t('prompt.checkBatch'),
152             type: 'warning',
153             duration: 500
154           })
155         }
156         this.$confirm(this.$t('prompt.info', {'handle': '启用'}), this.$t('prompt.title'), {
157           confirmButtonText: this.$t('confirm'),
158           cancelButtonText: this.$t('cancel'),
159           type: 'warning'
160         }).then(() => {
161           this.$http.put('/model/mcs/st-model/enable', id ? [id] : this.dataListSelections.map(item => item.id)).then(({data: res}) => {
162             if (res.code !== 0) {
163               return this.$message.error(res.msg)
164             }
165             this.$message({
166               message: this.$t('prompt.success'),
167               type: 'success',
168               duration: 500,
169               onClose: () => {
170                 this.getDataList()
171               }
172             })
173           }).catch(() => {
174           })
175         }).catch(() => {
176         })
177       },
178
179       // 禁用
180       disableHandle(id) {
181         if (!id && this.dataListSelections.length <= 0) {
182           return this.$message({
183             message: this.$t('prompt.checkBatch'),
184             type: 'warning',
185             duration: 500
186           })
187         }
188         this.$confirm(this.$t('prompt.info', {'handle': '禁用'}), this.$t('prompt.title'), {
189           confirmButtonText: this.$t('confirm'),
190           cancelButtonText: this.$t('cancel'),
191           type: 'warning'
192         }).then(() => {
193           this.$http.put('/model/mcs/st-model/disable', id ? [id] : this.dataListSelections.map(item => item.id)).then(({data: res}) => {
194             if (res.code !== 0) {
195               return this.$message.error(res.msg)
196             }
197             this.$message({
198               message: this.$t('prompt.success'),
199               type: 'success',
200               duration: 500,
201               onClose: () => {
202                 this.getDataList()
203               }
204             })
205           }).catch(() => {
206           })
207         }).catch(() => {
208         })
209       },
210     }
211   }
212 </script>