style(knowledge): 格式化规则管理页面代码

- 使用 ESLint 规则格式化了 JavaScript 代码
- 优化了 Vue 组件的结构和缩进- 调整了模板中的 HTML 标签格式
This commit is contained in:
陈昱达
2025-04-10 16:27:36 +08:00
parent 1527715a0a
commit a2aebffee0
3 changed files with 145 additions and 131 deletions

View File

@@ -94,20 +94,24 @@ export default [
path: '/knowledge/track',
name: 'track',
component: () => import('@/views/knowledge/track/Index.vue'),
meta: {
breadcrumb: false,
title: '任务轨迹',
icon: 'el-icon-s-home'
}
}, {
path: "/rules",
name: "rules",
component: () => import("@/views/knowledge/rules/Index.vue"),
meta: {
title: "规则管理",
icon: "el-icon-s-home"
}
},
{
path: '/rules',
name: 'rules',
component: () => import('@/views/knowledge/rules/Index.vue'),
hidden: true,
meta: {
title: '规则管理',
icon: 'el-icon-s-home'
}
}
]
}
]

View File

@@ -20,31 +20,31 @@ export default {
computed: {
// 当前的分页数据
currentTableDate() {
const start = (this.currentPage - 1) * 10;
const end = this.currentPage * 10;
return this.tableData.slice(start, end);
const start = (this.currentPage - 1) * 10
const end = this.currentPage * 10
return this.tableData.slice(start, end)
}
},
beforeMount() {
getRuleList().then(res => {
const { content } = res.content
console.log(content);
console.log(content)
this.tableData = content
})
},
methods: {
handleCurrentChange(val) {
console.log(`current page: ${val}`);
console.log(`current page: ${val}`)
this.currentPage = val;
this.currentPage = val
},
edit(row, index) {
console.log(row, index);
console.log(row, index)
},
del(row, index) {
console.log(row, index);
console.log(row, index)
}
}
}
@@ -85,9 +85,15 @@ export default {
<!-- 创建时间 -->
<el-col :span="8">
<el-form-item label="创建时间">
<el-date-picker v-model="form.value2" type="daterange" unlink-panels range-separator="至"
start-placeholder="开始日期" end-placeholder="结束日期"
:picker-options="form.pickerOptions">
<el-date-picker
v-model="form.value2"
type="daterange"
unlink-panels
range-separator=""
start-placeholder="开始日期"
end-placeholder="结束日期"
:picker-options="form.pickerOptions"
>
</el-date-picker>
</el-form-item>
</el-col>
@@ -112,10 +118,8 @@ export default {
<el-table-column prop="createdDate" label="创建时间"></el-table-column>
<el-table-column label="操作">
<template #default="scope">
<el-button type="primary" size="mini" plain
@click="edit(scope.row, scope.$index)">编辑</el-button>
<el-button type="danger" size="mini" plain
@click="del(scope.row, scope.$index)">删除</el-button>
<el-button type="primary" size="mini" plain @click="edit(scope.row, scope.$index)">编辑</el-button>
<el-button type="danger" size="mini" plain @click="del(scope.row, scope.$index)">删除</el-button>
</template>
</el-table-column>
</el-table>
@@ -123,8 +127,14 @@ export default {
<!-- 分页 -->
<el-row>
<el-col :span="24" class="flex" style="justify-content: right;">
<el-pagination background layout="prev, pager, next" @current-change="handleCurrentChange"
:current-page="currentPage" :hide-on-single-page="true" :total="tableData.length">
<el-pagination
background
layout="prev, pager, next"
@current-change="handleCurrentChange"
:current-page="currentPage"
:hide-on-single-page="true"
:total="tableData.length"
>
</el-pagination>
</el-col>
</el-row>