fix: 修复知识库新增编辑页的代码报警问题
This commit is contained in:
@@ -273,7 +273,6 @@
|
|||||||
|
|
||||||
.imported-table-box {
|
.imported-table-box {
|
||||||
position: relative;
|
position: relative;
|
||||||
//height: 413px;
|
|
||||||
height: 394px !important;
|
height: 394px !important;
|
||||||
border: 1px solid #DEDEDE;
|
border: 1px solid #DEDEDE;
|
||||||
border-radius: 2px;
|
border-radius: 2px;
|
||||||
@@ -414,40 +413,6 @@
|
|||||||
.el-form-item__error {
|
.el-form-item__error {
|
||||||
display: none;
|
display: none;
|
||||||
}
|
}
|
||||||
|
|
||||||
.addTagBtn {
|
|
||||||
position: absolute;
|
|
||||||
bottom: 9px;
|
|
||||||
height: 24px !important;
|
|
||||||
min-height: 24px !important;
|
|
||||||
font-size: 12px;
|
|
||||||
color: #353636;
|
|
||||||
font-weight: 500;
|
|
||||||
width: 598px;
|
|
||||||
margin-left: 10px;
|
|
||||||
background: rgb(245, 248, 250);
|
|
||||||
border: 1px #DEDEDE solid;
|
|
||||||
padding: 0 !important;
|
|
||||||
box-shadow: 0 2px 4px 0 rgba(51, 51, 51, 0.02);
|
|
||||||
border-radius: 2px;
|
|
||||||
font-family: NotoSansHans-Medium !important;
|
|
||||||
|
|
||||||
.add-tag-btn {
|
|
||||||
color: #575757 !important;
|
|
||||||
font-size: 9px !important;
|
|
||||||
margin: 0 8px 2px 8px;
|
|
||||||
}
|
|
||||||
|
|
||||||
span {
|
|
||||||
font-family: NotoSansHans-Medium !important;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
.addTagBtn:hover {
|
|
||||||
i {
|
|
||||||
color: #699DC9 !important;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -496,3 +461,37 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.addTagBtn {
|
||||||
|
position: absolute;
|
||||||
|
bottom: 9px;
|
||||||
|
height:24px !important;
|
||||||
|
min-height: 24px !important;
|
||||||
|
font-size: 12px;
|
||||||
|
color: #353636;
|
||||||
|
font-weight: 500;
|
||||||
|
width: 598px;
|
||||||
|
margin-left: 10px;
|
||||||
|
background: rgb(245, 248, 250);
|
||||||
|
border: 1px #DEDEDE solid;
|
||||||
|
padding: 0px !important;
|
||||||
|
box-shadow: 0 2px 4px 0 rgba(51,51,51,0.02);
|
||||||
|
border-radius: 2px;
|
||||||
|
font-family:NotoSansHans-Medium !important;
|
||||||
|
|
||||||
|
.add-tag-btn {
|
||||||
|
color: #575757 !important;
|
||||||
|
font-size: 9px !important;
|
||||||
|
margin: 0 8px 2px 8px;
|
||||||
|
}
|
||||||
|
|
||||||
|
&:hover {
|
||||||
|
i {
|
||||||
|
color: #699DC9 !important;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
span {
|
||||||
|
font-family:NotoSansHans-Medium !important;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|||||||
@@ -53,7 +53,6 @@
|
|||||||
:before-upload="beforeUpload"
|
:before-upload="beforeUpload"
|
||||||
:on-progress="onUpload"
|
:on-progress="onUpload"
|
||||||
:on-error="uploadError"
|
:on-error="uploadError"
|
||||||
@click=""
|
|
||||||
:class="uploadErrorTip ? 'el-upload--error' : ''"
|
:class="uploadErrorTip ? 'el-upload--error' : ''"
|
||||||
drag
|
drag
|
||||||
:accept="fileTypeLimit"
|
:accept="fileTypeLimit"
|
||||||
@@ -99,10 +98,10 @@
|
|||||||
<el-form ref="editForm" :model="editTagForm" :rules="editTagFormRules">
|
<el-form ref="editForm" :model="editTagForm" :rules="editTagFormRules">
|
||||||
<table class="imported-table" v-if="!importedDataNoData">
|
<table class="imported-table" v-if="!importedDataNoData">
|
||||||
<tr>
|
<tr>
|
||||||
<th width="230">{{ importedTableFirstColumn }}</th>
|
<th style="width: 230px">{{ importedTableFirstColumn }}</th>
|
||||||
<th width="180">Label</th>
|
<th style="width: 180px">Label</th>
|
||||||
<th v-if="!editObject.id">{{ $t('overall.import') }}</th>
|
<th v-if="!editObject.id">{{ $t('overall.import') }}</th>
|
||||||
<th width="16"></th>
|
<th style="width: 16px"></th>
|
||||||
</tr>
|
</tr>
|
||||||
<tr v-for="(d, i) in showImportedData" :key="importedType + d.tagItem + d.tagValue + i">
|
<tr v-for="(d, i) in showImportedData" :key="importedType + d.tagItem + d.tagValue + i">
|
||||||
<td class="imported-data-item" :title="d.tagItem">
|
<td class="imported-data-item" :title="d.tagItem">
|
||||||
@@ -185,7 +184,7 @@
|
|||||||
</template>
|
</template>
|
||||||
<script>
|
<script>
|
||||||
import { useRoute } from 'vue-router'
|
import { useRoute } from 'vue-router'
|
||||||
import { ref, nextTick, reactive } from 'vue'
|
import { nextTick, reactive, ref } from 'vue'
|
||||||
import _ from 'lodash'
|
import _ from 'lodash'
|
||||||
import { knowledgeBaseType, storageKey, unitTypes } from '@/utils/constants'
|
import { knowledgeBaseType, storageKey, unitTypes } from '@/utils/constants'
|
||||||
import Pagination from '@/components/common/Pagination'
|
import Pagination from '@/components/common/Pagination'
|
||||||
@@ -204,12 +203,10 @@ export default {
|
|||||||
Loading
|
Loading
|
||||||
},
|
},
|
||||||
data () {
|
data () {
|
||||||
const nameValidator = (rule, value, callback) => {
|
const nameValidator = (rule, value) => {
|
||||||
let validate = true
|
|
||||||
// /^[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEFA-Za-z0-9\-\_]*$/
|
// /^[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEFA-Za-z0-9\-\_]*$/
|
||||||
const reg = /^[\u4e00-\u9fa5A-Za-z0-9\-\_]*$/
|
const reg = /^[\u4e00-\u9fa5A-Za-z0-9\-\_]*$/
|
||||||
validate = reg.test(value)
|
return reg.test(value)
|
||||||
return validate
|
|
||||||
}
|
}
|
||||||
const nameAndTypeValidator = async (rule, value, callback) => {
|
const nameAndTypeValidator = async (rule, value, callback) => {
|
||||||
let validate = true
|
let validate = true
|
||||||
@@ -285,7 +282,7 @@ export default {
|
|||||||
const tagType = this.editObject.tagType// 当前选中的类型
|
const tagType = this.editObject.tagType// 当前选中的类型
|
||||||
if (tagType === 'ip') {
|
if (tagType === 'ip') {
|
||||||
const formal = value.replace(/\s+/g, '')// 去掉空格
|
const formal = value.replace(/\s+/g, '')// 去掉空格
|
||||||
if (formal.indexOf('/') != -1) {
|
if (formal.indexOf('/') !== -1) {
|
||||||
if (!(regular.ipv4CIDR.test(formal)) && !(regular.ipv6CIDR.test(formal))) {
|
if (!(regular.ipv4CIDR.test(formal)) && !(regular.ipv6CIDR.test(formal))) {
|
||||||
validate = false
|
validate = false
|
||||||
this.editTagErrorTip = rule.message
|
this.editTagErrorTip = rule.message
|
||||||
@@ -465,7 +462,7 @@ export default {
|
|||||||
this.$message.error(this.$t('tip.uploadFailed', { msg: response.message }))
|
this.$message.error(this.$t('tip.uploadFailed', { msg: response.message }))
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
onRemove (files, fileList) {
|
onRemove (files) {
|
||||||
if (files && files.status === 'success') {
|
if (files && files.status === 'success') {
|
||||||
this.uploaded = false
|
this.uploaded = false
|
||||||
this.typeSelectDisable = false
|
this.typeSelectDisable = false
|
||||||
@@ -487,7 +484,7 @@ export default {
|
|||||||
this.fileList[0] = this.fileListBack
|
this.fileList[0] = this.fileListBack
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
uploadTip (e) {
|
uploadTip () {
|
||||||
if (!this.isShowUploadTips) {
|
if (!this.isShowUploadTips) {
|
||||||
this.isShowUploadTips = true
|
this.isShowUploadTips = true
|
||||||
const self = this
|
const self = this
|
||||||
@@ -503,7 +500,7 @@ export default {
|
|||||||
}).then(() => {
|
}).then(() => {
|
||||||
this.isClick = true
|
this.isClick = true
|
||||||
self.$refs.upload.$refs.uploadRef.handleClick()
|
self.$refs.upload.$refs.uploadRef.handleClick()
|
||||||
}).catch(e => {}).finally(() => {
|
}).catch(() => {}).finally(() => {
|
||||||
this.isShowUploadTips = false
|
this.isShowUploadTips = false
|
||||||
})
|
})
|
||||||
} else {
|
} else {
|
||||||
@@ -519,7 +516,7 @@ export default {
|
|||||||
.then(v => (v === t) ? 'pending' : 'fulfilled', () => 'rejected')
|
.then(v => (v === t) ? 'pending' : 'fulfilled', () => 'rejected')
|
||||||
},
|
},
|
||||||
beforeUpload (file) {
|
beforeUpload (file) {
|
||||||
const promise = new Promise((resolve, reject) => {
|
return new Promise((resolve, reject) => {
|
||||||
// 判断后缀,仅支持.csv
|
// 判断后缀,仅支持.csv
|
||||||
if (!_.endsWith(file.name, '.csv')) {
|
if (!_.endsWith(file.name, '.csv')) {
|
||||||
this.$message.error(this.$t('validate.fileTypeLimit', { types: this.fileTypeLimit }))
|
this.$message.error(this.$t('validate.fileTypeLimit', { types: this.fileTypeLimit }))
|
||||||
@@ -553,9 +550,8 @@ export default {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
return promise
|
|
||||||
},
|
},
|
||||||
onUpload (event, file) {
|
onUpload () {
|
||||||
this.uploadLoading = true
|
this.uploadLoading = true
|
||||||
this.typeSelectDisable = true
|
this.typeSelectDisable = true
|
||||||
this.isClick = false
|
this.isClick = false
|
||||||
@@ -620,7 +616,7 @@ export default {
|
|||||||
path: '/knowledgeBase',
|
path: '/knowledgeBase',
|
||||||
t: +new Date()
|
t: +new Date()
|
||||||
})
|
})
|
||||||
}).catch(e => {})
|
}).catch(() => {})
|
||||||
} else {
|
} else {
|
||||||
this.$router.push({
|
this.$router.push({
|
||||||
path: '/knowledgeBase',
|
path: '/knowledgeBase',
|
||||||
@@ -819,8 +815,7 @@ export default {
|
|||||||
const total = this.importedData.length
|
const total = this.importedData.length
|
||||||
this.addEditFlag = true
|
this.addEditFlag = true
|
||||||
// 如果已经有新增空白项,则不再进行新增操作
|
// 如果已经有新增空白项,则不再进行新增操作
|
||||||
if (this.importedData.length === 0 ||
|
if (this.importedData.length === 0 || (this.importedData[this.importedData.length - 1].tagItem !== '' && this.importedData[this.importedData.length - 1].tagValue !== '')) {
|
||||||
this.importedData[this.importedData.length - 1].tagItem !== '' && this.importedData[this.importedData.length - 1].tagValue !== '') {
|
|
||||||
if (total > 0 && total < 10) {
|
if (total > 0 && total < 10) {
|
||||||
this.importedData.push({ tagItem: '', tagValue: '', status: 1 })
|
this.importedData.push({ tagItem: '', tagValue: '', status: 1 })
|
||||||
this.showImportedData.push({ tagItem: '', tagValue: '', status: 1 })
|
this.showImportedData.push({ tagItem: '', tagValue: '', status: 1 })
|
||||||
@@ -935,7 +930,7 @@ export default {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
'importedPageObj.pageNo': {
|
'importedPageObj.pageNo': {
|
||||||
handler (n) {
|
handler () {
|
||||||
this.handleShowImportedData()
|
this.handleShowImportedData()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user