mirror of
http://112.124.100.131/ebiz-ai/ebiz-ai-knowledge-manage.git
synced 2025-12-09 10:56:50 +08:00
refactor: 移除冗余代码并优化代码格式
- 删除了多处不必要的 console.log 语句 - 优化了部分代码的格式和结构 - 移除了无用的注释 - 统一了部分组件的样式
This commit is contained in:
@@ -13,7 +13,6 @@ console.log('token:' + getToken())
|
||||
router.beforeEach((to, from, next) => {
|
||||
NProgress.start()
|
||||
if (getToken()) {
|
||||
console.log(getToken())
|
||||
/* has token*/
|
||||
if (to.path === '/login') {
|
||||
removeToken()
|
||||
@@ -24,12 +23,7 @@ router.beforeEach((to, from, next) => {
|
||||
store
|
||||
.dispatch('user/getInfo')
|
||||
.then(() => {
|
||||
console.log(to)
|
||||
store.dispatch('app/GenerateRoutes').then(accessRoutes => {
|
||||
// // 根据roles权限生成可访问的路由表
|
||||
// router.addRoutes(accessRoutes) // 动态添加可访问路由表
|
||||
// // getArea();//初始化省市区划配置信息
|
||||
// next({ ...to, replace: true }) // hack方法 确保addRoutes已完成
|
||||
next()
|
||||
})
|
||||
})
|
||||
@@ -41,9 +35,6 @@ router.beforeEach((to, from, next) => {
|
||||
})
|
||||
}
|
||||
} else {
|
||||
console.log('没有token')
|
||||
console.log(to.path)
|
||||
console.log(to.fullPath)
|
||||
// 没有token
|
||||
if (whiteList.indexOf(to.path) !== -1) {
|
||||
// 在免登录白名单,直接进入
|
||||
|
||||
@@ -35,8 +35,6 @@ service.interceptors.request.use(
|
||||
endLoading()
|
||||
}
|
||||
|
||||
// console.log(config.noLoading)
|
||||
//linkage 接口
|
||||
// config.type 可以从api的接口地址定义 可以不触发loading
|
||||
if (config.noLoading !== true) {
|
||||
startLoading()
|
||||
|
||||
@@ -38,7 +38,7 @@ export default {
|
||||
[{ list: 'ordered' }, { list: 'bullet' }, { list: 'check' }],
|
||||
[{ indent: '-1' }, { indent: '+1' }], // outdent/indent
|
||||
[{ color: [] }, { background: [] }], // dropdown with defaults from theme
|
||||
['clean','link', 'image']
|
||||
['clean', 'link', 'image']
|
||||
]
|
||||
}
|
||||
},
|
||||
@@ -46,14 +46,10 @@ export default {
|
||||
handleImageAdded(file, Editor, cursorLocation, resetUploader) {
|
||||
let formData = new FormData()
|
||||
formData.append('file', file) //第一个file 后台接收的参数名
|
||||
uploadFileComponentForEditor(formData)
|
||||
.then(result => {
|
||||
let url = result.content.fileUrl // 返回给你的图片路径
|
||||
Editor.insertEmbed(cursorLocation, 'image', url)
|
||||
})
|
||||
.catch(err => {
|
||||
console.log(err)
|
||||
})
|
||||
uploadFileComponentForEditor(formData).then(result => {
|
||||
let url = result.content.fileUrl // 返回给你的图片路径
|
||||
Editor.insertEmbed(cursorLocation, 'image', url)
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -55,7 +55,6 @@ const actions = {
|
||||
return new Promise(resolve => {
|
||||
// 向后端请求路由数据
|
||||
getRouters().then(res => {
|
||||
console.log(res)
|
||||
if (res) {
|
||||
if (res.content.result === '0') {
|
||||
commit('SET_SIDEBAR_LIST', res.content.content)
|
||||
|
||||
@@ -22,7 +22,6 @@ export default {
|
||||
})
|
||||
return channelInfo
|
||||
})
|
||||
console.log(newArr)
|
||||
await importChannel(newArr)
|
||||
this.$message.success('导入成功')
|
||||
}
|
||||
|
||||
@@ -1,18 +1,18 @@
|
||||
<template>
|
||||
<div class='container index-container'>
|
||||
<div class="container index-container">
|
||||
<el-card shadow="hover">
|
||||
<div slot="header" class="clearfix">
|
||||
<h3>新增知识库</h3>
|
||||
</div>
|
||||
<el-row >
|
||||
<el-col :span='21' :offset='1'>
|
||||
<el-row>
|
||||
<el-col :span="21" :offset="1">
|
||||
<el-form :model="model" ref="model" label-width="100px">
|
||||
<el-form-item label="知识库名称:" prop="knowledgeName">
|
||||
<el-input></el-input>
|
||||
</el-form-item>
|
||||
|
||||
<el-form-item label="描述(可选):" prop="knowledgeName" requried>
|
||||
<el-input type='textarea'></el-input>
|
||||
<el-input type="textarea"></el-input>
|
||||
</el-form-item>
|
||||
|
||||
<el-form-item label="分段模式:" prop="knowledgeName" requried>
|
||||
@@ -24,20 +24,12 @@
|
||||
</el-form>
|
||||
</el-col>
|
||||
|
||||
<el-col :span='24' class='text-center'>
|
||||
<el-button type='primary' size='medium' @click='save'>创建</el-button>
|
||||
<el-button size='medium'>取消 </el-button>
|
||||
<el-col :span="24" class="text-center">
|
||||
<el-button type="primary" size="medium" @click="save">创建</el-button>
|
||||
<el-button size="medium">取消 </el-button>
|
||||
</el-col>
|
||||
|
||||
|
||||
|
||||
|
||||
</el-row>
|
||||
|
||||
|
||||
|
||||
</el-card>
|
||||
|
||||
</div>
|
||||
</template>
|
||||
<script>
|
||||
@@ -54,7 +46,7 @@ export default {
|
||||
type: Object,
|
||||
default: () => {
|
||||
return {
|
||||
knowledgeName:''
|
||||
knowledgeName: ''
|
||||
}
|
||||
}
|
||||
},
|
||||
@@ -66,42 +58,36 @@ export default {
|
||||
components: {},
|
||||
filters: {},
|
||||
methods: {
|
||||
save(){
|
||||
|
||||
// 配置进度条参数
|
||||
// NProgress.configure({
|
||||
// showSpinner: false, // 隐藏转圈圈
|
||||
// })
|
||||
save() {
|
||||
// 配置进度条参数
|
||||
// NProgress.configure({
|
||||
// showSpinner: false, // 隐藏转圈圈
|
||||
// })
|
||||
|
||||
// setTimeout(()=>{
|
||||
//
|
||||
// NProgress.done();
|
||||
// },5000)
|
||||
|
||||
let loadingDom = document.getElementById('knowledgeFormDrawer').querySelector('.el-drawer')
|
||||
let loadingDom = document
|
||||
.getElementById('knowledgeFormDrawer')
|
||||
.querySelector('.el-drawer')
|
||||
|
||||
|
||||
console.log(loadingDom)
|
||||
let loading = renderLoading.service({
|
||||
target:loadingDom,
|
||||
target: loadingDom
|
||||
})
|
||||
|
||||
loading.close()
|
||||
|
||||
},
|
||||
},
|
||||
created() {
|
||||
},
|
||||
mounted() {
|
||||
}
|
||||
},
|
||||
created() {},
|
||||
mounted() {},
|
||||
computed: {
|
||||
// model 获取 knowledgeForm
|
||||
// model 获取 knowledgeForm
|
||||
model() {
|
||||
return this.knowledgeForm
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
<style scoped lang='scss'>
|
||||
|
||||
</style>
|
||||
<style scoped lang="scss"></style>
|
||||
|
||||
@@ -115,7 +115,6 @@ export default {
|
||||
watch: {
|
||||
'form.beMinerU': {
|
||||
handler(value) {
|
||||
console.log(`是否进行预处理:${value}`)
|
||||
// 如果不进行预处理,不进行ocr
|
||||
if (!value) {
|
||||
this.form.beOcr = false
|
||||
@@ -144,9 +143,7 @@ export default {
|
||||
input.accept = '.xlsx,.doc,.docx,.pdf,.txt'
|
||||
|
||||
input.onchange = e => {
|
||||
// this.$emit('getFile', e.target.files[0])
|
||||
this.filed = e.target.files[0]
|
||||
console.log(this.filed.name)
|
||||
}
|
||||
input.click()
|
||||
},
|
||||
|
||||
@@ -402,7 +402,6 @@ export default {
|
||||
// 调用查询分段信息接口
|
||||
datasetQuerySegments({ documentId: row.id }).then(res => {
|
||||
if (res) {
|
||||
console.log(res.content.content)
|
||||
this.descriptions = {
|
||||
dataset: {
|
||||
knowledgeName: this.knowledgeName,
|
||||
|
||||
@@ -178,7 +178,6 @@ export default {
|
||||
},
|
||||
// 处理修改规则
|
||||
handleEdit(row, isPreview = false) {
|
||||
console.log(`isPreview`, isPreview)
|
||||
this.dialogOptions.currentComponent =
|
||||
row.ruleType === 1 ? 'EditSplitRule' : 'EditPromptRule'
|
||||
|
||||
|
||||
@@ -1,5 +1,9 @@
|
||||
<script>
|
||||
import { addPromptRule, getRuleDetail, updatePromptRule } from '@/api/rules/index'
|
||||
import {
|
||||
addPromptRule,
|
||||
getRuleDetail,
|
||||
updatePromptRule
|
||||
} from '@/api/rules/index'
|
||||
|
||||
export default {
|
||||
name: 'EditPromptRule',
|
||||
@@ -48,8 +52,6 @@ export default {
|
||||
}
|
||||
},
|
||||
save() {
|
||||
console.log('save this form ', this.form)
|
||||
|
||||
// 判断是新增还是更新,新增调用 addPromptRule,更新调用 updatePromptRule
|
||||
if (this.type === 'add') {
|
||||
// 配置对应表单
|
||||
@@ -70,14 +72,12 @@ export default {
|
||||
this.tableData.unshift(this.form)
|
||||
})
|
||||
.catch(err => {
|
||||
console.error(`add prompt rule failed: ${err}`)
|
||||
// 可以添加错误提示
|
||||
this.$message && this.$message.error('保存失败')
|
||||
})
|
||||
} else {
|
||||
updatePromptRule(this.form)
|
||||
.then(() => {
|
||||
console.log('update prompt rule success')
|
||||
this.dialogOptions.visible = false
|
||||
// 可以添加成功提示
|
||||
this.$message && this.$message.success('保存成功')
|
||||
@@ -102,7 +102,6 @@ export default {
|
||||
getRuleDetail(currentRow.id)
|
||||
.then(res => {
|
||||
const { content } = res.content
|
||||
console.log('origin query request', content)
|
||||
|
||||
// 一次性设置表单数据,确保响应式更新
|
||||
this.form = {
|
||||
@@ -157,13 +156,23 @@ export default {
|
||||
</el-tabs>
|
||||
</el-card>
|
||||
</el-form>
|
||||
<div slot="footer" class="dialog-footer flex mt10" style="justify-content: space-between;">
|
||||
<div
|
||||
slot="footer"
|
||||
class="dialog-footer flex mt10"
|
||||
style="justify-content: space-between;"
|
||||
>
|
||||
<div>
|
||||
<el-button :size="'mini'" type="primary" @click="handleAdd">+ 新增题词</el-button>
|
||||
<el-button type="info" :size="'mini'" @click="handleDelete">- 删除题词</el-button>
|
||||
<el-button :size="'mini'" type="primary" @click="handleAdd"
|
||||
>+ 新增题词</el-button
|
||||
>
|
||||
<el-button type="info" :size="'mini'" @click="handleDelete"
|
||||
>- 删除题词</el-button
|
||||
>
|
||||
</div>
|
||||
<div>
|
||||
<el-button :size="'mini'" @click="dialogOptions.visible = false">取 消</el-button>
|
||||
<el-button :size="'mini'" @click="dialogOptions.visible = false"
|
||||
>取 消</el-button
|
||||
>
|
||||
<el-button :size="'mini'" type="primary" @click="save">确 定</el-button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -33,7 +33,6 @@ export default {
|
||||
getRuleDetail(currentRow.id)
|
||||
.then(res => {
|
||||
const { content } = res.content
|
||||
console.log('origin query request', content)
|
||||
// 一次性设置表单数据,确保响应式更新
|
||||
this.form = {
|
||||
id: content.id,
|
||||
@@ -69,9 +68,7 @@ export default {
|
||||
// 确保 index 是数字
|
||||
const numIndex = Number(index)
|
||||
if (!isNaN(numIndex)) {
|
||||
console.log(numIndex)
|
||||
const payload = this.form.ruleList.splice(numIndex, 1)
|
||||
console.log(...payload)
|
||||
}
|
||||
}
|
||||
},
|
||||
@@ -81,7 +78,6 @@ export default {
|
||||
*/
|
||||
handleSave() {
|
||||
// 使用正确的API保存数据到后端
|
||||
console.log(`this.form`, this.form)
|
||||
|
||||
// 判断是新增还是更新,新增调用 addSplitRule,更新调用 updateSplitRule
|
||||
if (this.type === 'add') {
|
||||
@@ -108,13 +104,11 @@ export default {
|
||||
} else {
|
||||
updateSplitRule(this.form)
|
||||
.then(() => {
|
||||
console.log('update split rule success')
|
||||
this.dialogOptions.visible = false
|
||||
// 可以添加成功提示
|
||||
this.$message && this.$message.success('保存成功')
|
||||
})
|
||||
.catch(err => {
|
||||
console.error(`update split rule failed: ${err}`)
|
||||
.catch(() => {
|
||||
// 可以添加错误提示
|
||||
this.$message && this.$message.error('保存失败')
|
||||
})
|
||||
@@ -140,7 +134,12 @@ export default {
|
||||
>
|
||||
<el-form-item label="样式">
|
||||
<el-select v-model="item.titleLevel" placeholder="请选择">
|
||||
<el-option v-for="level in 6" :key="level" :label="level" :value="level" />
|
||||
<el-option
|
||||
v-for="level in 6"
|
||||
:key="level"
|
||||
:label="level"
|
||||
:value="level"
|
||||
/>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="规则">
|
||||
@@ -153,7 +152,11 @@ export default {
|
||||
</el-tabs>
|
||||
</el-card>
|
||||
</el-form>
|
||||
<div slot="footer" class="dialog-footer flex mt15" style="justify-content: space-between;">
|
||||
<div
|
||||
slot="footer"
|
||||
class="dialog-footer flex mt15"
|
||||
style="justify-content: space-between;"
|
||||
>
|
||||
<!-- 只有当点击保存的时候才能和服务端通信新增和删除 -->
|
||||
<div>
|
||||
<el-button type="primary" @click="handleAdd">+ 新增拆分</el-button>
|
||||
|
||||
@@ -30,7 +30,6 @@ export default {
|
||||
// 获取规则详情
|
||||
getRuleDetail(this.dialogOptions.currentRow.id).then(res => {
|
||||
const { content } = res.content
|
||||
console.log('origin query request', content)
|
||||
// 设置表单数据
|
||||
this.form.ruleName = content.ruleName
|
||||
this.form.createdDate = content.createdDate
|
||||
@@ -39,7 +38,11 @@ export default {
|
||||
|
||||
// 1. 是 提示词规则
|
||||
if (content.ruleType.toString() === '1') {
|
||||
this.tableDate.columns = [{ prop: 'titleLevel', key: '样式' }, { prop: 'ruleRegex', key: '提示词' }, { prop: 'description', key: '备注' }]
|
||||
this.tableDate.columns = [
|
||||
{ prop: 'titleLevel', key: '样式' },
|
||||
{ prop: 'ruleRegex', key: '提示词' },
|
||||
{ prop: 'description', key: '备注' }
|
||||
]
|
||||
}
|
||||
// 2. 是 拆分规则
|
||||
else if (content.ruleType.toString() === '2') {
|
||||
@@ -72,7 +75,11 @@ export default {
|
||||
</el-col>
|
||||
</el-form>
|
||||
<!-- 规则详情列表 -->
|
||||
<r-table :deletion="false" :data="tableDate.data" :columns="tableDate.columns"></r-table>
|
||||
<r-table
|
||||
:deletion="false"
|
||||
:data="tableDate.data"
|
||||
:columns="tableDate.columns"
|
||||
></r-table>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
|
||||
@@ -367,12 +367,9 @@ export default {
|
||||
},
|
||||
// 修改权限
|
||||
handleOnSave() {
|
||||
console.log('this.roleMenuForm')
|
||||
console.log(this.roleMenuForm)
|
||||
const menuRoles = this.checkedKeys
|
||||
.filter(menuId => menuId !== '' && menuId !== null)
|
||||
.map(menuId => ({ menuId }))
|
||||
debugger
|
||||
const requestData = {
|
||||
id: this.roleMenuForm.id,
|
||||
sysMenuRoleDTOs: menuRoles,
|
||||
|
||||
Reference in New Issue
Block a user