| | |
| | | <template> |
| | | <el-container> |
| | | <el-header>交通统计报表审核系统 - 规则管理</el-header> |
| | | <el-container direction="vertical"> |
| | | <app-header title="交通统计报表审核系统 - 规则管理"></app-header> |
| | | <el-container> |
| | | <el-aside width="200px"> |
| | | <el-menu router default-active="/rules"> |
| | |
| | | <el-menu-item index="/report">报表生成</el-menu-item> |
| | | <el-menu-item index="/rules">规则管理</el-menu-item> |
| | | <el-menu-item index="/users">用户管理</el-menu-item> |
| | | <el-menu-item index="/login" @click="logout">退出登录</el-menu-item> |
| | | </el-menu> |
| | | </el-menu> |
| | | </el-aside> |
| | | <el-main> |
| | | <h3>审核规则管理</h3> |
| | |
| | | </template> |
| | | <script> |
| | | import api from '@/api' |
| | | import AppHeader from '@/components/AppHeader.vue' |
| | | const TYPE_CN = { |
| | | DIFF: '差值对比', RATIO: '比例对比', MOM: '环比新增', NULL_CHECK: '必填/一致性', |
| | | OUT_RANGE: '范围检查', MOM_EQ_ZERO: '环比为0', MOM_PCT: '环比百分比', |
| | |
| | | AVG_DIST_VS_H2032: '平均运距对比', LOADED_TON_RATIO: '载货吨位比值' |
| | | } |
| | | export default { |
| | | components: { AppHeader }, |
| | | name: 'RuleManage', |
| | | data() { |
| | | return { reportType: 'H2032', rules: [], loading: false } |
| | |
| | | this.loading = true |
| | | api.get('/rules/list', { params: { reportType: this.reportType } }) |
| | | .then(res => { this.rules = res.data || [] }) |
| | | .catch(() => { this.$message.error('规则加载失败') }) |
| | | .catch(e => { if (e && e._toast) return; this.$message.error('规则加载失败') }) |
| | | .finally(() => { this.loading = false }) |
| | | }, |
| | | toggleRule(row) { |
| | | api.post('/rules/toggle', null, { params: { id: row.id, enabled: row.isEnabled } }) |
| | | .then(() => { this.$message.success((row.isEnabled ? '已启用:' : '已停用:') + row.ruleCode) }) |
| | | .catch(() => { row.isEnabled = row.isEnabled ? 0 : 1; this.$message.error('操作失败') }) |
| | | .catch(e => { if (e && e._toast) return; row.isEnabled = row.isEnabled ? 0 : 1; this.$message.error('操作失败') }) |
| | | }, |
| | | saveThreshold(row) { |
| | | api.post('/rules/update', { |
| | | id: row.id, threshold: row.threshold, alertLevel: row.alertLevel |
| | | }).then(() => { this.$message.success('已保存:' + row.ruleCode) }) |
| | | .catch(() => { this.$message.error('保存失败') }) |
| | | .catch(e => { if (e && e._toast) return; this.$message.error('保存失败') }) |
| | | } |
| | | }, |
| | | mounted() { this.loadRules() } |
| | | } |
| | | </script> |
| | | <style scoped> |
| | | .el-header { background: #409EFF; color: white; line-height: 60px; font-size: 18px; } |
| | | </style> |