CN-1096 知识库UI开发

CN-1179 知识库内新增格式错误的Tag,文件导入形式和手动增加形式报错不一致
This commit is contained in:
hyx
2023-08-03 15:48:44 +08:00
parent aea46b0437
commit 6a7713ad98
10 changed files with 2236 additions and 1270 deletions

View File

@@ -82,7 +82,7 @@ export default {
res.loginSuccessPath = this.$route.query.redirect res.loginSuccessPath = this.$route.query.redirect
this.loginSuccess(res) this.loginSuccess(res)
localStorage.setItem(storageKey.username, this.username) localStorage.setItem(storageKey.username, this.username)
localStorage.setItem(storageKey.userId, res.data.data.userId) localStorage.setItem(storageKey.userId, res.data.data.user ? res.data.data.user.userId : res.data.data.userId)
localStorage.setItem(storageKey.token, res.data.data.token) localStorage.setItem(storageKey.token, res.data.data.token)
} else if (res.data.code === 518005) { } else if (res.data.code === 518005) {
this.$message.error(this.$t('Incorrect username or password')) this.$message.error(this.$t('Incorrect username or password'))

View File

@@ -1,4 +1,6 @@
.knowledge-base { .knowledge-base {
height: 100%;
overflow:auto;
&.list-page { &.list-page {
height: calc(100% - 52px); height: calc(100% - 52px);
} }
@@ -17,6 +19,10 @@
text-overflow: ellipsis; text-overflow: ellipsis;
} }
.knowledge-base__top {
display:flex;
justify-content: space-between ;
align-items:center;
.top-title { .top-title {
font-size: 24px; font-size: 24px;
color: #353636; color: #353636;
@@ -28,7 +34,313 @@
padding-top: 20px; padding-top: 20px;
margin-left:20px; margin-left:20px;
} }
.knowledge-base__content { .builtIn-to-user-defined {
margin-right:20px;
margin-top: 20px;
}
}
.top-tool-btn--user_defined_library {
background: #F5F8FA;
border: 1px solid rgba(222,222,222,1);
box-shadow: 0px 2px 4px 0px rgba(51,51,51,0.02);
border-radius: 2px;
height:28px;
padding:8px 10px;
font-size: 12px;
color: #353636;
font-weight: 500;
line-height: 28px;
display: flex;
justify-content: center;
align-items: center;
i {
color: #575757;
font-size:14px !important;
margin-right:6px;
}
}
.top-tool-btn--user_defined_library:hover {
border: 1px solid $--border-color-primary;
background-color: $--button-gray-hover-background-color;
cursor: pointer;
}
.knowledge-base-built-in__content {
display:flex;
flex-direction:row;
padding:12px 20px 20px 20px;
height:calc(100% - 52px);
.list-card {
display:flex;
flex-direction:column;
justify-content: space-between;
width: 100%;
.card-type-title {
font-size: 14px;
color: #353636;
font-weight: 500;
display: flex;
align-items: center;
margin-bottom:10px;
}
.list-mode__card {
width: 100%;
padding-right: 2px;
position:relative;
.table-no-data{
height: 100%;
display: flex;
align-items: center;
justify-content: center;
line-height: 60px;
color: #909399;
}
.el-checkbox-group {
display: flex;
flex-wrap: wrap;
flex-direction:row;
}
.card-selected{
box-shadow: 3px 3px 11px 0 rgba(0,0,0,0.1);
border: 1px solid rgba(197,197,197,1) !important;
}
.card-item {
background: #FFFFFF;
border: 1px solid rgba(226,229,236,1);
border-radius: 4px;
margin-bottom:16px;
margin-right:16px;
height:258px;
width:300px;
display:flex;
flex-direction:column;
.card-content {
height:calc(100% - 32px);
padding:15px;
display:flex;
flex-direction: column;
.card-operate {
position:relative;
.card-enable {
position:absolute;
right:0px;
top:0px;
}
}
.card-icon {
margin-top:9px;
width:100%;
height:50px;
color:red;
display:flex;
justify-content: center;
align-items: center;
.cn-icon-add-knowledge-base {
font-size:50px;
}
}
.card-title {
font-size: 16px;
color: #353636;
font-weight: 700;
margin-bottom:15px;
margin-top:10px;
display: flex;
justify-content: center;
align-items: center;
.card-title-name {
width:100%;
overflow: hidden; //超出的文本隐藏
text-overflow: ellipsis; //溢出用省略号显示
white-space:nowrap;
word-break: break-all;
text-align: center;
font-family: NotoSansSC-Bold;
font-size: 14px;
color: #333333;
letter-spacing: 0;
font-weight: 700;
}
.card-title-more {
position: relative;
color:#575757;
.el-checkbox__input.is-checked .el-checkbox__inner {
background-color: #38ACD2;
border-color: #38ACD2;
}
.el-checkbox__input.is-checked .el-checkbox__inner::after {
left: 5px;
top: 2px;
}
.el-checkbox__inner {
border-radius: 50%;
width:16px;
height:16px;
background-color: #DEDEDE;
border-color: #DEDEDE;
z-index:1;
}
.el-checkbox__inner::after {
left: 5px;
top: 2px;
transform: rotate(45deg) scaleY(1);
}
.card-operate {
background: #FFFFFF;
border: 1px solid rgba(197,197,197,1);
box-shadow: -1px 1px 10px -1px rgba(205,205,205,0.85);
border-radius: 2px;
position: absolute;
top: 20px;
right: -10px;
height: 56px;
width: 80px;
display:flex;
flex-direction: column;
padding-top:4px;
padding-bottom:4px;
font-family: Helvetica;
font-size: 12px;
font-weight: 400;
.card-title-more-delete {
z-index: 1;
line-height: 24px;
height: 24px;
background: #FFFFFF;
padding-left: 9px;
color: #666666;
}
.card-title-more-delete:hover {
background: #F7F7F7;
color: #046ECA;
}
.card-title-more-delete:active {
background: #F7F7F7;
color: #046ECA;
}
.card-title-more-edit {
z-index: 1;
line-height: 24px;
height: 24px;
background: #FFFFFF;
padding-left: 9px;
color: #666666;
}
.card-title-more-edit:hover {
background: #F7F7F7;
color: #046ECA;
}
.card-title-more-edit:active {
background: #F7F7F7;
color: #046ECA;
}
}
}
}
.card-desc {
font-size: 12px;
color: #717171;
line-height: 18px;
font-weight: 400;
margin-bottom:0px;
max-height:88px;
overflow: hidden;
display: -webkit-box;
-webkit-line-clamp: 5;
line-clamp: 5;
-webkit-box-orient: vertical;
}
}
.card-operate__footer {
height:40px;
display:flex;
flex-direction: row;
justify-content:center;
font-size: 14px;
font-weight: 400;
align-items: center;
padding-left:16px;
padding-right:16px;
padding-bottom:20px;
.top-tool-btn--update {
background-color: #38ACD2 !important;
padding-left:7px;
padding-right:7px;
color:#FFFFFF;
font-size: 12px;
font-weight: 500;
border: 1px solid rgba(46,136,166,0.85);
border-radius: 2px;
line-height: 28px;
height:28px;
cursor: pointer;
display: flex;
justify-content: center;
align-items: center;
i {
color: #FFFFFF;
font-size:14px !important;
margin-right:5px;
}
}
.top-tool-btn--update:hover {
background-color: #57B8D9 !important;
border-color: #2E88A6 !important;
}
.card-type {
display:flex;
flex-direction:row;
.card-category {
font-size: 12px;
line-height: 16px;
color: #38ACD2;
font-weight: 400;
border: 1px solid rgba(56,172,210,1);
height:20px;
width: fit-content;
padding-left:11px;
padding-right:11px;
box-shadow: 0 2px 4px 0 rgba(51,51,51,0.02);
border-radius: 10px;
margin-right:4px;
}
.card-source {
height:20px;
width: fit-content;
padding-left:11px;
padding-right:11px;
background: rgba(56,172,210,0.10);
box-shadow: 0 2px 4px 0 rgba(51,51,51,0.02);
border-radius: 10px;
font-size: 12px;
color: #046ECA;
font-weight: 400;
}
}
.card-enable {
}
}
}
.card-item:hover{
background: rgba(56,172,210,0.04);
border: 1px solid rgba(56,172,210,0.48);
box-shadow: 0px 1px 4px 0px rgba(56,172,210,0.13);
border-radius: 4px;
}
.card-item__enable {
background: #FFFFFF;
border: 1px solid rgba(226,229,236,1);
box-shadow: 3px 3px 11px 0 rgba(0,0,0,0.1);
border-radius: 4px;
}
}
}
}
.knowledge-base-user-defined__content {
display:flex; display:flex;
flex-direction:row; flex-direction:row;
padding:12px 20px 20px 20px; padding:12px 20px 20px 20px;
@@ -55,7 +367,6 @@
font-size: 14px; font-size: 14px;
color: #353636; color: #353636;
font-weight: 500; font-weight: 500;
//font-family: $fontFamily !important;
} }
.knowledge-filter { .knowledge-filter {
display: flex; display: flex;
@@ -82,7 +393,6 @@
transform: rotate(90deg) translate(2px, 3px); transform: rotate(90deg) translate(2px, 3px);
} }
.new-knowledge-filter-header-title { .new-knowledge-filter-header-title {
//font-family: $fontFamily !important;
font-size: 14px; font-size: 14px;
color: #353636; color: #353636;
font-weight: 500; font-weight: 500;
@@ -166,12 +476,10 @@
justify-content: space-between; justify-content: space-between;
align-items: center; align-items: center;
font-weight: 400; font-weight: 400;
//font-family: NotoSansSChineseRegular !important;
color: #353636; color: #353636;
font-size: 14px; font-size: 14px;
.filter-label { .filter-label {
display: flex; display: flex;
//color: #353636;
} }
.filter-count { .filter-count {
color: #717171 !important; color: #717171 !important;
@@ -199,23 +507,19 @@
display:flex; display:flex;
flex-direction:column; flex-direction:column;
justify-content: space-between; justify-content: space-between;
width: calc(100% - 340px); width: 100%;
max-width: calc(100% - 340px);
height:100%; height:100%;
.top-tools { .top-tools {
display: flex; display: flex;
align-items : center; align-items : center;
flex-direction:row; flex-direction:row;
justify-content: space-between ; justify-content: space-between ;
//height:28px;
width:100%; width:100%;
margin-bottom:20px; margin-bottom:20px;
.top-tools__right { .top-tools__right {
display: flex; display: flex;
justify-content: flex-end; justify-content: flex-end;
align-items: center; align-items: center;
//padding-bottom: 18px;
&>div { &>div {
//padding: 0 0 0 10px; //padding: 0 0 0 10px;
} }
@@ -248,7 +552,6 @@
transition: background-color linear .1s; transition: background-color linear .1s;
font-size:12px; font-size:12px;
font-weight: 500; font-weight: 500;
//font-family: $fontFamily !important;
i { i {
font-size: 14px; font-size: 14px;
color: #575757; color: #575757;
@@ -259,7 +562,6 @@
cursor: not-allowed; cursor: not-allowed;
opacity: 0.66; opacity: 0.66;
i { i {
} }
} }
.top-tool-btn:hover:not(.cn-btn-disabled) { .top-tool-btn:hover:not(.cn-btn-disabled) {
@@ -288,6 +590,22 @@
color: #FFFFFF; color: #FFFFFF;
} }
} }
.top-tool-btn--user_defined_library {
background: #F5F8FA !important;
border: 1px solid rgba(222,222,222,1);
box-shadow: 0px 2px 4px 0px rgba(51,51,51,0.02);
border-radius: 2px;
height:28px;
padding:8px 10px;
font-size: 12px;
color: #353636;
font-weight: 500;
i {
color: #575757;
font-size:14px !important;
margin-right:6px;
}
}
.top-tool-btn--create:hover { .top-tool-btn--create:hover {
background-color: #57B8D9 !important; background-color: #57B8D9 !important;
border-color: #2E88A6 !important; border-color: #2E88A6 !important;
@@ -315,7 +633,7 @@
} }
.top-tool-search { .top-tool-search {
display:flex; display:flex;
width:242px;//calc(100% - 256px); width:242px;
.el-input--small{ .el-input--small{
line-height: 27px; line-height: 27px;
.el-input__inner { .el-input__inner {
@@ -341,7 +659,6 @@
.list-mode__row { .list-mode__row {
width: 100%; width: 100%;
height:calc(100% - 102px); height:calc(100% - 102px);
//overflow-y:auto;
margin-bottom:0px; margin-bottom:0px;
padding-bottom:30px; padding-bottom:30px;
.el-checkbox .el-checkbox__input.is-checked .el-checkbox__inner { .el-checkbox .el-checkbox__input.is-checked .el-checkbox__inner {
@@ -356,7 +673,6 @@
.el-table--border { .el-table--border {
border: 1px solid rgba(226,229,236,1); border: 1px solid rgba(226,229,236,1);
border-radius: 4px; border-radius: 4px;
border-right:none;
border-bottom:none; border-bottom:none;
} }
.el-table--border th ,.el-table--border td { .el-table--border th ,.el-table--border td {
@@ -380,10 +696,38 @@
font-weight: 400; font-weight: 400;
} }
.cell { .cell {
height: 20px; height: fit-content;
max-height:64px;
min-height:32px;
line-height: 20px; line-height: 20px;
.reference-tag__show {
display: flex;
flex-direction: row;
.reference-tag__group {
display: flex;
flex-direction: column;
.reference-tag {
display: inline-block;
padding: 0 10px;
background-color: #EBF7FA;
color: #046ECA;
box-shadow: 0 2px 4px 0 rgba(51,51,51,0.02);
border-radius: 12px;
margin-bottom: 8px;
width: fit-content;
min-width:fit-content;
}
.reference-tag:last-of-type {
margin-bottom:0px !important;
margin-right:6px;
}
}
.reference-more {
display:flex;
flex-direction:column-reverse;
}
}
} }
} }
} }
.list-mode__card { .list-mode__card {
@@ -414,9 +758,6 @@
background: #FFFFFF; background: #FFFFFF;
border: 1px solid rgba(226,229,236,1); border: 1px solid rgba(226,229,236,1);
border-radius: 4px; border-radius: 4px;
/*width:282px;
margin-bottom:30px;
margin-right:30px;*/
height:218px; height:218px;
display:flex; display:flex;
flex-direction:column; flex-direction:column;
@@ -427,7 +768,6 @@
display:flex; display:flex;
flex-direction: column; flex-direction: column;
.card-title { .card-title {
//font-family: NotoSansSC-Bold;
font-size: 16px; font-size: 16px;
color: #353636; color: #353636;
font-weight: 700; font-weight: 700;
@@ -488,47 +828,37 @@
line-height: 24px; line-height: 24px;
height: 24px; height: 24px;
background: #FFFFFF; background: #FFFFFF;
//box-shadow: -1px 1px 10px -1px rgba(205,205,205,0.85);
//border-radius: 2px;
padding-left: 9px; padding-left: 9px;
color: #666666; color: #666666;
} }
.card-title-more-delete:hover { .card-title-more-delete:hover {
//background: #EBF1F4;
background: #F7F7F7; background: #F7F7F7;
color: #046ECA; color: #046ECA;
//border: 1px solid rgba(0,0,0,0.15);
} }
.card-title-more-delete:active { .card-title-more-delete:active {
background: #F7F7F7; background: #F7F7F7;
color: #046ECA; color: #046ECA;
//border: 1px solid rgba(0,0,0,0.15);
} }
.card-title-more-edit { .card-title-more-edit {
z-index: 1; z-index: 1;
line-height: 24px; line-height: 24px;
height: 24px; height: 24px;
background: #FFFFFF; background: #FFFFFF;
//box-shadow: -1px 1px 10px -1px rgba(205,205,205,0.85);
//border-radius: 2px;
padding-left: 9px; padding-left: 9px;
color: #666666; color: #666666;
} }
.card-title-more-edit:hover { .card-title-more-edit:hover {
background: #F7F7F7; background: #F7F7F7;
color: #046ECA; color: #046ECA;
//border: 1px solid rgba(0,0,0,0.15);
} }
.card-title-more-edit:active { .card-title-more-edit:active {
background: #F7F7F7; background: #F7F7F7;
color: #046ECA; color: #046ECA;
//border: 1px solid rgba(0,0,0,0.15);
} }
} }
} }
} }
.card-id { .card-id {
//font-family: NotoSansSChineseRegular;
font-size: 12px; font-size: 12px;
color: #999999; color: #999999;
font-weight: 400; font-weight: 400;
@@ -536,7 +866,6 @@
line-height: 12px; line-height: 12px;
} }
.card-desc { .card-desc {
//font-family: NotoSansSChineseRegular;
font-size: 12px; font-size: 12px;
color: #717171; color: #717171;
line-height: 18px; line-height: 18px;
@@ -553,7 +882,6 @@
} }
.card-operate__footer { .card-operate__footer {
height:40px; height:40px;
//border:1px solid #7E9F54;
display:flex; display:flex;
flex-direction: row; flex-direction: row;
justify-content:space-between ; justify-content:space-between ;
@@ -616,6 +944,22 @@
} }
} }
} }
.reference-tag__tip {
display: flex;
flex-direction: column;
font-size: 12px;
color: #575757;
font-weight: 400;
min-width:130px;
max-height:240px;
overflow-y:auto;
cursor:pointer;
.reference-tag {
height:24px;
min-height:24px;
padding-top: 3px;
}
}
.edit-knowledge-base { .edit-knowledge-base {
height: 100%; height: 100%;
@@ -640,7 +984,6 @@
.el-steps { .el-steps {
margin-left: 10px; margin-left: 10px;
.el-step { .el-step {
transition: flex-basis ease-in-out .28s; transition: flex-basis ease-in-out .28s;
} }
@@ -1164,7 +1507,6 @@
.el-button { .el-button {
padding:8px 21px !important; padding:8px 21px !important;
line-height: 12px; line-height: 12px;
//font-family: NotoSansHans-Medium !important;
font-size: 12px; font-size: 12px;
font-weight: 500; font-weight: 500;
min-height: 28px; min-height: 28px;
@@ -1188,3 +1530,314 @@
} }
} }
} }
.update-knowledge-tip {
display:flex;
flex-direction: column;
padding-bottom:0px !important;
width:480px !important;
.el-dialog__header{
display: flex;
flex-direction: row;
border-bottom:1px solid #eee;
height:42px;
min-height:42px;
background: #F7F7F7;
box-shadow: 0 1px 0 0 rgba(53,54,54,0.08);
padding-left:20px;
padding-top:14px;
padding-bottom:14px;
.el-dialog__headerbtn {
display: flex !important;
flex-direction: row-reverse;
justify-content: center;
align-items: center;
font-size: 10px;
line-height: 10px;
padding-right: 5px !important;
i {
width:10px;
height:10px;
}
}
.el-dialog__title {
font-size: 14px !important;
color: #353636;
letter-spacing: 0;
font-weight: 400;
}
}
.el-dialog__body {
height:96px;
min-height:96px;
font-size: 14px;
color: #353636;
letter-spacing: 0;
line-height: 22px;
font-weight: 400;
padding-top:8px;
padding-right:20px;
padding-left:20px;
.dialog-message {
padding-left:0px !important;
padding-right:0px !important;
}
}
.el-dialog__footer {
height:52px;
min-height:52px;
border-top:1px solid #eee;
box-shadow: inset 0 -1px 0 0 rgba(0,0,0,0.07);
padding:11px 0 12px!important;
.el-button {
padding:8px 21px !important;
line-height: 12px;
font-size: 12px;
font-weight: 500;
min-height: 28px;
}
.el-button:nth-child(1) {
margin-right:20px;
width:80px;
height:28px;
color: #353636;
background: #F5F6F7;
border: 1px solid rgba(215,215,215,1);
border-radius: 2px;
}
.el-button:nth-child(2) {
width:80px;
height:28px;
margin-right:20px;
margin-left:0px !important;
background: #38ACD2;
border: 1px solid rgba(46,136,166,1);
border-radius: 2px;
}
}
}
.center-dialog {
display: flex;
align-items: center;
justify-content: center;
}
.update-knowledge {
display:flex;
flex-direction: column;
padding-bottom:0px !important;
width:1080px !important;
height:fit-content;
margin:15vh auto !important;
top:0;
left:0;
.knowledge-update__top {
display: flex;
flex-direction: row;
margin-bottom:22px;
.update-left__icon {
margin-top:3px;
width:107px;
height:60px;
color:red;
display:flex;
justify-content: center;
align-items: center;
.cn-icon-add-knowledge-base {
font-size:60px;
}
}
.update-right {
display: flex;
flex-direction: column;
width:893px;
.knowledge-enable {
display: flex;
flex-direction: row;
justify-content: space-between;
margin-bottom:7px;
.update-title {
font-size: 16px;
color: #333333;
letter-spacing: 0;
font-weight: 500;
height:24px;
font-family: NotoSansSC-Medium;
}
}
.knowledge-desc {
font-family: Roboto-Regular;
font-size: 14px;
color: #717171;
letter-spacing: 0;
line-height: 16px;
font-weight: 400;
}
}
}
.knowledge-update {
display: flex;
flex-direction: row;
justify-content: space-between;
align-items:flex-end;
margin-bottom:12px;
.update-title {
line-height: 14px;
font-family: NotoSansSC-Bold;
font-size: 14px;
color: #353636;
font-weight: 700;
}
.update-operate {
height:28px;
display:flex;
flex-direction: row;
justify-content:center;
font-size: 14px;
font-weight: 400;
align-items: center;
.top-tool-btn--update {
background-color: #38ACD2 !important;
padding-left:7px;
padding-right:7px;
color:#FFFFFF;
font-size: 12px;
font-weight: 500;
border: 1px solid rgba(46,136,166,0.85);
border-radius: 2px;
line-height: 28px;
height:28px;
cursor: pointer;
display: flex;
justify-content: center;
align-items: center;
i {
color: #FFFFFF;
font-size:14px !important;
margin-right:5px;
}
}
.top-tool-btn--update:hover {
background-color: #57B8D9 !important;
border-color: #2E88A6 !important;
}
}
}
.el-dialog__header{
display: flex;
flex-direction: row;
height:32px;
min-height:32px;
padding-left:20px;
padding-top:20px;
padding-bottom:0px;
.el-dialog__headerbtn {
display: flex !important;
flex-direction: row-reverse;
justify-content: center;
align-items: center;
line-height: 12px;
i {
font-size:12px;
color:#999999;
}
}
.el-dialog__title {
font-size: 14px !important;
color: #353636;
letter-spacing: 0;
font-weight: 400;
}
}
.el-dialog__body {
font-size: 14px;
color: #353636;
letter-spacing: 0;
line-height: 22px;
font-weight: 400;
padding-top:0px;
padding-right:30px;
padding-left:30px;
.dialog-message {
padding-left:0px !important;
padding-right:0px !important;
}
.update-dialog__table {
border-bottom: none;
border-radius: 0.28571rem;
.el-table--border th, .el-table--border td {
border-right: none;
}
}
.update-knowledge-form {
.el-upload {
width:100%;
}
.form-input {
.el-input__inner{
padding-right: 50px !important;
font-size: 14px;
}
}
.uploadBtn {
background: #F5F8FA;
border: 1px solid rgba(222,222,222,1);
box-shadow: 0px 2px 4px 0px rgba(51,51,51,0.02);
border-radius: 2px;
width:100%;
height:28px;
min-height:28px !important;
color: #575757;
padding-top:0px;
padding-bottom:0px;
i {
font-size:12px;
}
}
.el-form-item__label {
font-family: NotoSansHans-Medium;
font-size: 14px;
color: #333333;
font-weight: 500;
padding-bottom:12px;
line-height:14px;
}
.el-form-item__content {
line-height:normal;
}
.el-form-item {
margin-bottom:20px;
}
.knowledge-remark {
margin-bottom:0px !important;
}
}
.dialog-footer {
display:flex;
justify-content: flex-end;
padding-top:32px;
.el-button {
padding:10px 21px !important;
line-height: 12px;
font-size: 12px;
font-weight: 500;
min-height: 32px;
width:80px;
height:32px;
}
.el-button:nth-child(1) {
margin-right:20px;
color: #353636;
background: #F5F6F7;
border: 1px solid rgba(215,215,215,1);
border-radius: 2px;
}
.el-button:nth-child(2) {
color: #FFFFFF;
margin-left:0px !important;
background: #38ACD2;
border: 1px solid rgba(46,136,166,1);
border-radius: 2px;
}
}
}
}

View File

@@ -18,7 +18,7 @@
width="55"> width="55">
</el-table-column> </el-table-column>
<el-table-column <el-table-column
v-for="(item, index) in customTableTitles" v-for="(item, index) in tableTitle"
:key="`col-${index}`" :key="`col-${index}`"
:fixed="item.fixed" :fixed="item.fixed"
:label="item.label" :label="item.label"
@@ -52,6 +52,29 @@
<template v-else-if="item.prop === 'source'"> <template v-else-if="item.prop === 'source'">
<span class="type-tag">{{tagSourceText(scope.row[item.prop])}}</span> <span class="type-tag">{{tagSourceText(scope.row[item.prop])}}</span>
</template> </template>
<template v-else-if="item.prop === 'reference'" >
<templage v-if="scope.row[item.prop] && scope.row[item.prop].length > 2" >
<el-popover placement="right-end" trigger="hover" :show-arrow="false" offset="0" ref="referenceMoreInfo"
hide-after="0" >
<template #reference>
<div class="reference-tag__show">
<div class="reference-tag__group">
<span class="reference-tag" v-for="(refer, index) in scope.row[item.prop].slice(0,2)" >{{refer}}</span>
</div>
<div class="reference-more">+{{scope.row[item.prop].length - 2}} more</div>
</div>
</template>
<div class="reference-tag__tip">
<span class="reference-tag" v-for="(refer, index) in scope.row[item.prop].slice(2)" >{{refer}}</span>
</div>
</el-popover>
</templage>
<template v-else>
<template v-for="(refer, index) in scope.row[item.prop]">
<div class="type-tag">{{refer}}</div>
</template>
</template>
</template>
<template v-else-if="item.prop === 'opTime' || item.prop === 'ctime'"> <template v-else-if="item.prop === 'opTime' || item.prop === 'ctime'">
<template v-if="scope.row[item.prop]"> <template v-if="scope.row[item.prop]">
{{dateFormatByAppearance(scope.row[item.prop])}} {{dateFormatByAppearance(scope.row[item.prop])}}
@@ -71,17 +94,6 @@
<template v-else-if="item.prop === 'description'"> <template v-else-if="item.prop === 'description'">
<span class="list-desc" :title="scope.row[item.prop]">{{scope.row[item.prop]}}</span> <span class="list-desc" :title="scope.row[item.prop]">{{scope.row[item.prop]}}</span>
</template> </template>
<template v-else-if="item.prop === 'status'">
<el-switch class="card-enable"
v-model="scope.row.status"
active-color="#38ACD2"
inactive-color="#C0CEDB"
:active-value="1"
:inactive-value="0"
@change="changeStatus($event,scope.row.knowledgeId)"
>
</el-switch>
</template>
<span v-else>{{scope.row[item.prop] || '-'}}</span> <span v-else>{{scope.row[item.prop] || '-'}}</span>
</template> </template>
</el-table-column> </el-table-column>
@@ -112,30 +124,32 @@ export default {
label: 'ID', label: 'ID',
prop: 'knowledgeId', prop: 'knowledgeId',
show: true, show: true,
width: 60, width: 100,
sortable: 'custom' sortable: 'custom'
}, { }, {
label: this.$t('config.roles.name'), label: this.$t('overall.name'),
prop: 'name', prop: 'name',
minWidth: 100, minWidth: 100,
width: 150,
show: true, show: true,
sortable: 'custom' sortable: 'custom'
}, { }, {
label: this.$t('overall.category'), label: this.$t('overall.type'),
prop: 'category',
width: 100,
show: true
}, {
label: this.$t('overall.source'),
prop: 'source', prop: 'source',
width: 130, width: 130,
show: true show: true
}, {
label: this.$t('knowledge.reference'),
prop: 'reference',
width: 180,
show: true
}, { }, {
label: this.$t('overall.remark'), label: this.$t('overall.remark'),
prop: 'description', prop: 'description',
minWidth: 150, minWidth: 150,
show: true show: true
}, },
/*
{ {
label: this.$t('overall.createdBy'), label: this.$t('overall.createdBy'),
prop: 'opUser', prop: 'opUser',
@@ -151,22 +165,34 @@ export default {
label: this.$t('overall.updatedBy'), label: this.$t('overall.updatedBy'),
prop: 'uuser', prop: 'uuser',
show: false show: false
}, }, */
{ {
label: this.$t('overall.updateTime'), label: this.$t('overall.updateTime'),
prop: 'opTime', prop: 'opTime',
show: true, show: true,
width: 150,
sortable: 'custom' sortable: 'custom'
},
{
label: this.$t('knowledge.status'),
prop: 'status',
show: true,
minWidth: 40
} }
] ]
} }
}, },
watch: {
tableData: {
handler (n) {
if (this.tableData && this.tableData.length > 0) {
this.tableData.forEach(item => {
item.reference = []
if (item.refRule && item.refRule.length > 0) {
item.refRule.forEach(ref => {
item.reference.push(ref.name)
})
}
})
}
}
}
},
computed: { computed: {
tagCategoryText () { tagCategoryText () {
return function (type) { return function (type) {

View File

@@ -1,29 +1,12 @@
<template> <template>
<el-checkbox-group v-model="checkList" v-if="!isNoData"> <template v-if="!isNoData">
<div @click="isSelectedStatus && data.isBuiltIn !== 1 && clickCard(data,$event)" @mouseenter="mouseenter(data)" @mouseleave="mouseleave(data)" v-for="data in tableData" :key="data.knowledgeId" class="card-item" :class="data.isSelected ? 'card-selected' : ''"> <div class="card-type-title" v-if="aiTaggingList.length > 0">{{$t('knowledgeBase.intelligenceLearning')}}</div>
<el-checkbox-group v-model="checkList" >
<div @click="isSelectedStatus && data.isBuiltIn !== 1 && clickCard(data,$event)" @mouseenter="mouseenter(data)" @mouseleave="mouseleave(data)" v-for="data in aiTaggingList" :key="data.knowledgeId" class="card-item" :class="data.isSelected ? 'card-selected' : ''">
<div class="card-content"> <div class="card-content">
<div class="card-title"> <div class="card-operate">
<div class="card-title-name" :title="data.name">{{data.name}}</div> <el-switch v-model="data.status"
<div class="card-title-more"> class="card-enable"
<span v-show="!isSelectedStatus && data.showMore && data.isBuiltIn !== 1"><i class="cn-icon cn-icon-more-dark" @mouseenter="mouseenterMore(data)" test-id="mouseenter-dark"></i></span>
<div class="card-operate" v-show="!isSelectedStatus && data.moreOptions" @mouseleave="mouseleaveMore(data)">
<div class="card-title-more-edit" @click="edit(data.knowledgeId)" >{{$t('overall.edit')}}</div>
<div class="card-title-more-delete" @click="del(data)" >{{$t('overall.delete')}}</div>
</div>
<el-checkbox @click.stop="" :disabled="data.isBuiltIn === 1" @change="(val) => {checkboxStatusChange(val,data)}" style="position: absolute;right: -12px;" v-if="isSelectedStatus" :key="data.knowledgeId" :label="data"><br></el-checkbox>
</div>
</div>
<div class="card-id">ID:{{data.knowledgeId}}</div>
<div class="card-desc" :title="data.description">{{data.description?data.description:'—'}}</div>
</div>
<div class="card-operate__footer">
<div class="card-type">
<div class="card-category">{{tagCategoryText(data.category)}}</div>
<div class="card-source">{{tagSourceText(data.source)}}</div>
</div>
<el-switch class="card-enable"
v-model="data.status"
active-color="#38ACD2" active-color="#38ACD2"
inactive-color="#C0CEDB" inactive-color="#C0CEDB"
:active-value="1" :active-value="1"
@@ -32,16 +15,169 @@
> >
</el-switch> </el-switch>
</div> </div>
<div class="card-icon">
<i class="cn-icon-add-knowledge-base cn-icon" ></i>
</div>
<div class="card-title">
<div class="card-title-name" :title="data.name">{{data.name}}</div>
</div>
<div class="card-desc" :title="data.description">{{data.description?data.description:'—'}}</div>
</div>
<div class="card-operate__footer">
<button v-if="data.showUpdate"
:title="$t('overall.update')" class="top-tool-btn--update"
@click="jumpToUpdatePage(data,true)">
<i class="cn-icon-update-knowledge-base cn-icon"></i>
<span>{{$t('overall.update')}}</span>
</button>
</div>
</div> </div>
</el-checkbox-group> </el-checkbox-group>
<div class="card-type-title" style="margin-top:4px;" v-if="websketchList.length > 0">{{$t('knowledgeBase.websketchIntegration')}}</div>
<el-checkbox-group v-model="checkList" >
<div @click="isSelectedStatus && data.isBuiltIn !== 1 && clickCard(data,$event)" @mouseenter="mouseenter(data)" @mouseleave="mouseleave(data)" v-for="data in websketchList" :key="data.knowledgeId" class="card-item" :class="data.isSelected ? 'card-selected' : ''">
<div class="card-content">
<div class="card-icon">
<i class="cn-icon-add-knowledge-base cn-icon" ></i>
</div>
<div class="card-title">
<div class="card-title-name" :title="data.name">{{data.name}}</div>
</div>
<div class="card-desc" :title="data.description">{{data.description?data.description:'—'}}</div>
</div>
<div class="card-operate__footer">
<button v-if="data.showUpdate" :title="$t('overall.update')" class="top-tool-btn--update"
@click="jumpToUpdatePage(data,false)">
<i class="cn-icon-update-knowledge-base cn-icon"></i>
<span>{{$t('overall.update')}}</span>
</button>
</div>
</div>
</el-checkbox-group>
</template>
<div class="table-no-data" v-else="isNoData"> <div class="table-no-data" v-else="isNoData">
<div class="table-no-data__title">{{ $t('npm.noData') }}</div> <div class="table-no-data__title">{{ $t('npm.noData') }}</div>
</div> </div>
<div class="center-dialog">
<el-dialog v-model="showUpdateDialog"
custom-class="update-knowledge"
:before-close="handleClose">
<div class="knowledge-update__top" >
<div class="update-left__icon">
<i class="cn-icon-add-knowledge-base cn-icon" ></i>
</div>
<div class="update-right">
<div class="knowledge-enable">
<div class="update-title">
<div class="card-title-name" :title="updateKnowledge.name">{{updateKnowledge.name}}</div>
</div>
<el-switch v-model="updateKnowledge.status"
v-if="showEnable"
active-color="#38ACD2"
inactive-color="#C0CEDB"
:active-value="1"
:inactive-value="0"
@change="changeStatus($event,updateKnowledge.knowledgeId)"
>
</el-switch>
</div>
<div class="knowledge-desc" :title="updateKnowledge.description">{{updateKnowledge.description?updateKnowledge.description:'—'}}</div>
</div>
</div>
<template v-if="!showAddUpdateDialog">
<div class="knowledge-update" >
<div class="update-title">
<div class="card-title-name">update record</div>
</div>
<div class="update-operate">
<button :title="$t('overall.update')" class="top-tool-btn--update"
@click="uploadRecord()">
<i class="cn-icon-update-knowledge-base cn-icon"></i>
<span>{{$t('overall.update')}}</span>
</button>
</div>
</div>
<el-table ref="updateDataTable"
border
:data="updateHistoryList"
@selection-change="secondSelectionChange"
max-height="653px"
width="100%"
class="update-dialog__table"
cell-style="padding:6px 0px;font-size: 12px;color: #353636;font-weight: 400;line-height: 20px;border-right:none;"
header-cell-style="padding:8px 0px;font-size: 12px;color: #353636;font-weight: 500;border-right:none;">
<el-table-column property="opTime" label="Update time" width="150" ></el-table-column>
<el-table-column property="opUser" label="Operating user" width="150" ></el-table-column>
<el-table-column property="version" label="Version information" width="150" ></el-table-column>
<el-table-column property="description" label="Description"></el-table-column>
</el-table>
</template>
<template v-if="showAddUpdateDialog">
<div class="update-knowledge-form" >
<el-form :model="updateObject" label-position="top" ref="form" :rules="rules">
<!--name-->
<el-form-item :label="$t('overall.name')" prop="name">
<el-input class="form-input" maxlength="64" placeholder="" disabled show-word-limit
size="mini" type="text" v-model="updateObject.name" @blur="tagNameBlur"></el-input>
</el-form-item>
<el-form-item :label="$t('knowledge.upload')" prop="file">
<el-upload :action="`${baseUrl}${apiVersion}/knowledgeBase/items/batch`"
:headers="uploadHeaders"
:multiple="false"
:file-list="fileList"
:data="uploadParams"
:on-change="fileChange"
:on-success="uploadSuccess"
:before-upload="beforeUpload"
:on-progress="onUpload"
:on-error="uploadError"
:class="uploadErrorTip ? 'el-upload--error' : ''"
:accept="fileTypeLimit"
ref="knowledgeUpload"
id="knowledgeUpload"
>
<el-button type="primary" class="uploadBtn"><i class="cn-icon cn-icon-a-1"></i></el-button>
</el-upload>
</el-form-item>
<el-form-item :label="$t('knowledge.version')" prop="version">
<el-input class="form-input" maxlength="64" placeholder="" disabled show-word-limit
size="mini" type="text" v-model="updateObject.version" @blur="tagNameBlur"></el-input>
</el-form-item>
<el-form-item :label="$t('overall.remark')" prop="description" class="knowledge-remark">
<el-input maxlength="255" show-word-limit :rows="4" size='mini' type="textarea" resize='none'
v-model="updateObject.description" id="role-box-input-remark"/>
</el-form-item>
</el-form>
</div>
<div class="dialog-footer">
<el-button @click="showAddUpdateDialog = false">{{ $t('overall.cancel') }}</el-button>
<el-button type="primary" @click="submitConfirm">{{ $t('tip.confirm') }}</el-button>
</div>
</template>
</el-dialog>
<el-dialog v-model="showConfirmDialog"
:title="$t('overall.tips')"
custom-class="update-knowledge-tip"
:before-close="handleConfirmClose">
<div class="dialog-message">{{$t('knowledge.updateTips')}}</div>
<template #footer>
<span class="dialog-footer">
<el-button @click="showConfirmDialog = false">{{ $t('overall.cancel') }}</el-button>
<el-button type="primary" @click="submit">{{ $t('tip.confirm') }}</el-button>
</span>
</template>
</el-dialog>
</div>
</template> </template>
<script> <script>
import table from '@/mixins/table' import table from '@/mixins/table'
import { knowledgeBaseCategory, knowledgeBaseSource } from '@/utils/constants' import { knowledgeCategoryValue, storageKey } from '@/utils/constants'
import { ref } from 'vue'
import { updateKnowledgeUrl } from '@/utils/api'
export default { export default {
name: 'knowledgeBaseTableForCard', name: 'knowledgeBaseTableForCard',
mixins: [table], mixins: [table],
@@ -57,10 +193,78 @@ export default {
data () { data () {
return { return {
tableTitle: [], tableTitle: [],
checkList: [] checkList: [],
aiTaggingList: [],
websketchList: [],
showUpdateDialog: false,
showConfirmDialog: false,
showAddUpdateDialog: false,
updateKnowledge: {},
showEnable: false,
updateHistoryList: [],
updateObject: {},
updateKnowledgeUrl: updateKnowledgeUrl
}
},
setup () {
// 没上传过文件的提示
const uploadErrorTip = ref('')
return {
baseUrl: BASE_CONFIG.baseUrl,
apiVersion: BASE_CONFIG.apiVersion,
uploadHeaders: {
'Cn-Authorization': localStorage.getItem(storageKey.token)
},
uploadErrorTip,
fileTypeLimit: '.csv',
fileList: ref([])
} }
}, },
methods: { methods: {
fileChange (files, fileList) {
this.fileList = fileList.slice(-1)
},
uploadError () {
this.$message.error(this.$t('tip.uploadFailed', { msg: 'error' }))
},
uploadSuccess (response) {
const uploadFile = this.fileList ? this.fileList[0] : null
let fileName = uploadFile ? uploadFile.name : ''
fileName = fileName.substring(0, fileName.indexOf('.'))
this.updateObject.version = fileName.length >= 8 ? fileName.substring(fileName.length - 8) : fileName
this.uploaded = response.code === 200
if (response.code === 200) {
} else {
this.$message.error(this.$t('tip.uploadFailed', { msg: response.message }))
}
},
beforeUpload (file) {
},
onUpload () {
},
updateKnowledgeBase () {
axios.post(this.updateKnowledgeUrl + '?knowledgeIds=' + ids).then(response => {
if (response.data.code === 200) {
this.$message({ duration: 2000, type: 'success', message: this.$t('tip.success') })
// 重新查询历史记录
} else {
this.$message.error(response.data.message)
}
}).finally(() => {
})
},
submitConfirm () {
this.showConfirmDialog = true
},
submit () {
// this.updateKnowledgeBase()//更新列表数据
this.showConfirmDialog = false
this.showAddUpdateDialog = false
},
clickCard (data, event) { clickCard (data, event) {
if (data.isSelected) { // 原来为选中,当前点击后未选中 if (data.isSelected) { // 原来为选中,当前点击后未选中
const index = this.checkList.indexOf(data) const index = this.checkList.indexOf(data)
@@ -81,11 +285,29 @@ export default {
data.isSelected = val data.isSelected = val
this.$emit('checkboxStatusChange', val, data) this.$emit('checkboxStatusChange', val, data)
}, },
showSelect () { handleClose () {
// this.isSelectedStatus = true this.showUpdateDialog = false
this.showAddUpdateDialog = false
}, },
hideSelect () { handleConfirmClose () {
// this.isSelectedStatus = false this.showConfirmDialog = false
},
handleUpdateClose () {
this.showAddUpdateDialog = false
},
showUpdate () {
this.showUpdateDialog = true
this.showAddUpdateDialog = false
},
jumpToUpdatePage (data, showEnable) {
this.updateKnowledge = data
this.showEnable = showEnable
this.showUpdate()
},
uploadRecord () {
this.showAddUpdateDialog = true
this.updateObject.name = this.updateKnowledge.name
this.updateObject.version = ''
}, },
clearSelect () { clearSelect () {
this.$nextTick(() => { this.$nextTick(() => {
@@ -97,32 +319,17 @@ export default {
} }
}) })
}, },
mouseenterMore (card) {
this.tableData.forEach(t => {
if (t.knowledgeId === card.knowledgeId) {
t.moreOptions = true
}
})
},
mouseleaveMore (card) {
this.tableData.forEach(t => {
if (t.knowledgeId === card.knowledgeId) {
t.moreOptions = false
}
})
},
mouseenter (card) { mouseenter (card) {
this.tableData.forEach(t => { this.tableData.forEach(t => {
if (t.knowledgeId === card.knowledgeId) { if (t.knowledgeId === card.knowledgeId) {
t.showMore = true t.showUpdate = true
} }
}) })
}, },
mouseleave (card) { mouseleave (card) {
this.tableData.forEach(t => { this.tableData.forEach(t => {
if (t.knowledgeId === card.knowledgeId) { if (t.knowledgeId === card.knowledgeId) {
t.showMore = false t.showUpdate = false
t.moreOptions = false
} }
}) })
}, },
@@ -131,38 +338,74 @@ export default {
}, },
edit (id) { edit (id) {
const pageNo = this.$router.currentRoute.value.query.pageNo const pageNo = this.$router.currentRoute.value.query.pageNo
const listMode = this.$router.currentRoute.value.query.listMode const dataType = this.$router.currentRoute.value.query.dataType
this.$router.push({ this.$router.push({
path: '/knowledgeBase/edit', path: '/knowledgeBase/edit',
query: { query: {
t: +new Date(), t: +new Date(),
pageNoForTable: pageNo || 1, pageNoForTable: pageNo || 1,
id: id, id: id,
listMode: listMode dataType: dataType
} }
}) })
} }
}, },
watch: {
tableData: {
handler (n) {
if (this.tableData && this.tableData.length > 0) {
this.aiTaggingList = []
this.websketchList = []
this.tableData.forEach(item => {
item.showUpdate = false
if (item.category === knowledgeCategoryValue.aiTagging) {
this.aiTaggingList.push(item)
} else if (item.category === knowledgeCategoryValue.webSketch) {
this.websketchList.push(item)
}
})
}
}
},
showAddUpdateDialog: {
handler (n) {
if (!n) {
this.fileList = []
}
}
}
},
mounted () { mounted () {
this.aiTaggingList = []
this.websketchList = []
this.tableData.forEach(item => { this.tableData.forEach(item => {
item.showMore = false item.showUpdate = false
item.moreOptions = false if (item.category === knowledgeCategoryValue.aiTagging) {
this.aiTaggingList.push(item)
} else if (item.category === knowledgeCategoryValue.webSketch) {
this.websketchList.push(item)
}
}) })
const update = {
opTime: '2023-07-26 16:27:55',
opUser: 'admin',
version: 'v2.8',
description: ' It can\'t be identified by the payload signature.'
}
this.updateHistoryList.push(update)
this.updateHistoryList.push(update)
this.updateHistoryList.push(update)
this.updateHistoryList.push(update)
this.updateHistoryList.push(update)
}, },
computed: { computed: {
tagCategoryText () { uploadParams () {
return function (type) { return {
const t = knowledgeBaseCategory.find(t => t.value === type) knowledgeId: this.updateKnowledge.knowledgeId,
return t ? t.name : '' action: 'update'
}
},
tagSourceText () {
return function (type) {
const t = knowledgeBaseSource.find(t => t.value === type)
return t ? t.name : ''
} }
} }
} }
} }
</script> </script>

View File

@@ -107,10 +107,10 @@ export default {
} else if (isClearType) { } else if (isClearType) {
this.searchLabel.type = ''// 换新接口需要修改的属性名称 this.searchLabel.type = ''// 换新接口需要修改的属性名称
} }
this.searchLabel = { ...this.searchLabel, ...this.pageObj }
if (params) { if (params) {
this.searchLabel = { ...this.searchLabel, ...params } this.searchLabel = { ...this.searchLabel, ...params }
} }
this.searchLabel = { ...this.searchLabel, ...this.pageObj }
this.isNoData = false this.isNoData = false
this.toggleLoading(true) this.toggleLoading(true)
delete this.searchLabel.total delete this.searchLabel.total
@@ -442,7 +442,7 @@ export default {
} }
} }
this.tools.customTableTitle = localStorageTableTitle this.tools.customTableTitle = localStorageTableTitle
if (localStorageTableTitle && (localStorageTableTitle.length > this.$refs.dataTable.tableTitle.length)) { if (localStorageTableTitle && this.$refs.dataTable && this.$refs.dataTable.tableTitle && (localStorageTableTitle.length > this.$refs.dataTable.tableTitle.length)) {
const arr = localStorageTableTitle.splice(this.$refs.dataTable.tableTitle.length, localStorageTableTitle.length) const arr = localStorageTableTitle.splice(this.$refs.dataTable.tableTitle.length, localStorageTableTitle.length)
this.tools.customTableTitle = this.tools.customTableTitle.concat(arr) this.tools.customTableTitle = this.tools.customTableTitle.concat(arr)
} }

View File

@@ -1,4 +1,4 @@
import { chartTableOrderOptionsMapping, storageKey } from '@/utils/constants' import { chartTableOrderOptionsMapping, storageKey,knowledgeCategoryValue } from '@/utils/constants'
import { getWidthByLanguage } from '@/utils/tools' import { getWidthByLanguage } from '@/utils/tools'
import { put, patch } from '@/utils/http' import { put, patch } from '@/utils/http'
import { api } from '@/utils/api' import { api } from '@/utils/api'
@@ -40,13 +40,6 @@ export default {
} }
}, 200) }, 200)
} }
},
tableData: {
handler (n) {
if (this.tableData && this.tableData.length > 0) {
// this.isInit = false
}
}
} }
}, },
data () { data () {

View File

@@ -48,11 +48,15 @@ const routes = [
component: () => import('@/views/setting/KnowledgeBase') component: () => import('@/views/setting/KnowledgeBase')
}, },
{ {
path: '/knowledgeBase/create', path: '/knowledgeBase/userDefinedLibrary',
component: () => import('@/views/setting/KnowledgeBase')
},
{
path: '/knowledgeBase/userDefinedLibrary/create',
component: () => import('@/views/setting/KnowledgeBaseForm') component: () => import('@/views/setting/KnowledgeBaseForm')
}, },
{ {
path: '/knowledgeBase/edit', path: '/knowledgeBase/userDefinedLibrary/edit',
component: () => import('@/views/setting/KnowledgeBaseForm') component: () => import('@/views/setting/KnowledgeBaseForm')
}, },
{ {

View File

@@ -40,6 +40,7 @@ export const api = {
knowledgeBaseList: BASE_CONFIG.apiVersion + '/knowledgeBase/list', knowledgeBaseList: BASE_CONFIG.apiVersion + '/knowledgeBase/list',
knowledgeBaseEnable: BASE_CONFIG.apiVersion + '/knowledgeBase/status', knowledgeBaseEnable: BASE_CONFIG.apiVersion + '/knowledgeBase/status',
knowledgeBaseStatistics: BASE_CONFIG.apiVersion + '/knowledgeBase/statistics', knowledgeBaseStatistics: BASE_CONFIG.apiVersion + '/knowledgeBase/statistics',
updateKnowledgeUrl: BASE_CONFIG.apiVersion + '/knowledgeBase/audit/log',
// 报告相关 // 报告相关
reportJob: '/report/job', reportJob: '/report/job',

View File

@@ -1,15 +1,39 @@
<template> <template>
<div style="height: 100%;overflow:auto;" class="knowledge-base"> <div class="knowledge-base">
<div class="knowledge-base__top">
<div class="top-title"> <div class="top-title">
{{$t('overall.knowledgeBase')}} {{$t('overall.knowledgeBase')}}
</div> </div>
<div class="knowledge-base__content" > <div class="builtIn-to-user-defined" v-if="dataType === 'builtInList'">
<div class="left-filter" style=""> <button :title="$t('knowledgeBase.userDefinedLibrary')" class="top-tool-btn--user_defined_library"
<knowledge-filter ref="knowledgeFilter" @click="changeToUserDefinedList">
:keyWord="keyWord" <i class="cn-icon-add-knowledge-base cn-icon" ></i>
@reload="reload" <span>{{$t('knowledgeBase.userDefinedLibrary')}}</span>
@clearList="clearList"></knowledge-filter> </button>
</div> </div>
</div>
<!-- 内置库列表 -->
<div class="knowledge-base-built-in__content" v-if="dataType === 'builtInList'">
<div class="list-card" >
<div class="list-mode__card" >
<loading :loading="loading"></loading>
<knowledge-base-table-for-card
ref="dataTableCard"
:api="url"
:isNoData="isNoData"
:table-data="tableData"
:is-selected-status="isSelectedStatus"
@delete="toDelete"
@checkboxStatusChange="checkboxStatusChange"
@reload="getBuiltInData"
@toggleLoading="toggleLoading"
></knowledge-base-table-for-card>
</div>
</div>
</div>
<!-- 用户自定义列表 -->
<div class="knowledge-base-user-defined__content" v-else-if="dataType === 'userDefinedList'">
<div class="right-list-card" > <div class="right-list-card" >
<div class="top-tools" > <div class="top-tools" >
<div class="top-tools__left"> <div class="top-tools__left">
@@ -19,13 +43,7 @@
<i class="cn-icon-xinjian cn-icon"></i> <i class="cn-icon-xinjian cn-icon"></i>
<span>{{$t('overall.create')}}</span> <span>{{$t('overall.create')}}</span>
</button> </button>
<button v-if="listMode === 'block'" id="knowledge-base-select" :title="$t('knowledgeBase.select')" class="top-tool-btn margin-r-10" <button id="knowledge-base-edit" :title="$t('knowledgeBase.editKnowledgeBase')" class="top-tool-btn margin-r-10" :disabled="disableEdit"
style="width:72px;"
@click="toSelect">
<i class="cn-icon-select cn-icon" ></i>
<span>{{$t('overall.select')}}</span>
</button>
<button v-if="listMode === 'list'" id="knowledge-base-edit" :title="$t('knowledgeBase.editKnowledgeBase')" class="top-tool-btn margin-r-10" :disabled="disableEdit"
style="width:72px;" style="width:72px;"
@click="editSelectRecord"> @click="editSelectRecord">
<i class="cn-icon-edit cn-icon" ></i> <i class="cn-icon-edit cn-icon" ></i>
@@ -37,22 +55,14 @@
<i class="cn-icon-delete cn-icon"></i> <i class="cn-icon-delete cn-icon"></i>
<span>{{$t('overall.delete')}}</span> <span>{{$t('overall.delete')}}</span>
</button> </button>
<div class="top-tool-search margin-l-10" style=""> <div class="top-tool-search margin-l-10" >
<el-input v-model="keyWord" size="small" @keyup.enter="onSearch"></el-input> <el-input v-model="keyWord" size="small" @keyup.enter="onSearch"></el-input>
<button class="top-tool-btn top-tool-btn--search" style="border-radius: 0 2px 2px 0 !important;" @click="onSearch"> <button class="top-tool-btn top-tool-btn--search" style="border-radius: 0 2px 2px 0 !important;" @click="onSearch">
<i class="el-icon-search"></i> <i class="el-icon-search"></i>
</button> </button>
</div> </div>
</div> </div>
<div class="top-tools__right" >
<el-button-group size="mini">
<el-button size="mini" @click="modeChange('list')" :class="{'active': listMode === 'list'}"><i class="cn-icon cn-icon-list"></i></el-button>
<el-button size="mini" @click="modeChange('block')" :class="{'active': listMode === 'block'}"><i class="cn-icon cn-icon-blocks"></i></el-button>
</el-button-group>
</div> </div>
</div>
<!-- 列表式 -->
<template v-if="listMode === 'list'">
<div class="list-mode__row" style="position:relative;"> <div class="list-mode__row" style="position:relative;">
<loading :loading="loading"></loading> <loading :loading="loading"></loading>
<knowledge-base-table-for-row <knowledge-base-table-for-row
@@ -63,7 +73,6 @@
:custom-table-title="tools.customTableTitle" :custom-table-title="tools.customTableTitle"
:table-data="tableData" :table-data="tableData"
:is-selected-status="isSelectedStatus" :is-selected-status="isSelectedStatus"
:all-count="18"
@delete="toDelete" @delete="toDelete"
@selectionChange="selectionChange" @selectionChange="selectionChange"
@edit="edit" @edit="edit"
@@ -72,27 +81,7 @@
@toggleLoading="toggleLoading" @toggleLoading="toggleLoading"
></knowledge-base-table-for-row> ></knowledge-base-table-for-row>
</div> </div>
</template> <div class="knowledge-pagination" >
<!-- 卡片式 -->
<template v-else-if="listMode === 'block'">
<div class="list-mode__card" style="position:relative;">
<loading :loading="loading"></loading>
<knowledge-base-table-for-card
ref="dataTableCard"
:api="url"
:isNoData="isNoData"
:custom-table-title="tools.customTableTitle"
:table-data="tableData"
:is-selected-status="isSelectedStatus"
:all-count="18"
@delete="toDelete"
@checkboxStatusChange="checkboxStatusChange"
@reload="reloadRowList"
@toggleLoading="toggleLoading"
></knowledge-base-table-for-card>
</div>
</template>
<div class="knowledge-pagination" style="">
<pagination ref="pagination" :page-obj="pageObj" :table-id="tableId" @pageNo='pageNo' @pageSize='pageSize'></pagination> <pagination ref="pagination" :page-obj="pageObj" :table-id="tableId" @pageNo='pageNo' @pageSize='pageSize'></pagination>
</div> </div>
</div> </div>
@@ -111,20 +100,18 @@
height="156px" height="156px"
width="100%" width="100%"
class="dialog-table" class="dialog-table"
:row-style="rowStyle"
cell-style="padding:4px 0px;font-size: 12px;color: #353636;font-weight: 400;" cell-style="padding:4px 0px;font-size: 12px;color: #353636;font-weight: 400;"
header-cell-style="padding:4px 0px;background: #F5F8FA;font-size: 12px;color: #353636;font-weight: 500;" header-cell-style="padding:4px 0px;background: #F5F8FA;font-size: 12px;color: #353636;font-weight: 500;">
:header-row-style="tableHeaderRowStyle">
<el-table-column <el-table-column
:resizable="false" :resizable="false"
align="center" align="center"
type="selection" type="selection"
width="50"> width="50">
</el-table-column> </el-table-column>
<el-table-column property="knowledgeId" label="ID" width="50"></el-table-column> <el-table-column property="knowledgeId" label="ID" width="150"></el-table-column>
<el-table-column property="name" label="Name"></el-table-column> <el-table-column property="name" label="Name"></el-table-column>
<el-table-column property="category" label="Category" width="100" :formatter = "categoryFormat"></el-table-column> <!-- <el-table-column property="category" label="Category" width="100" :formatter = "categoryFormat"></el-table-column>
<el-table-column property="source" label="Source" width="110" :formatter = "sourceFormat"></el-table-column> <el-table-column property="source" label="Source" width="110" :formatter = "sourceFormat"></el-table-column> -->
</el-table> </el-table>
<template #footer> <template #footer>
<span class="dialog-footer"> <span class="dialog-footer">
@@ -139,17 +126,16 @@ import dataListMixin from '@/mixins/data-list'
import KnowledgeBaseTableForCard from '@/components/table/setting/knowledgeBaseTableForCard' import KnowledgeBaseTableForCard from '@/components/table/setting/knowledgeBaseTableForCard'
import KnowledgeBaseTableForRow from '@/components/table/setting/KnowledgeBaseTableForRow' import KnowledgeBaseTableForRow from '@/components/table/setting/KnowledgeBaseTableForRow'
import { api } from '@/utils/api' import { api } from '@/utils/api'
import { get } from '@/utils/http'
import { urlParamsHandler, overwriteUrl } from '@/utils/tools' import { urlParamsHandler, overwriteUrl } from '@/utils/tools'
import { knowledgeBaseCategory, knowledgeBaseSource } from '@/utils/constants' import { knowledgeBaseCategory, knowledgeBaseSource, knowledgeCategoryValue } from '@/utils/constants'
import axios from 'axios' import axios from 'axios'
import KnowledgeFilter from '@/views/setting/KnowledgeFilter'
export default { export default {
name: 'knowledgeBase', name: 'knowledgeBase',
components: { components: {
KnowledgeBaseTableForCard, KnowledgeBaseTableForCard,
KnowledgeBaseTableForRow, KnowledgeBaseTableForRow
KnowledgeFilter
}, },
mixins: [dataListMixin], mixins: [dataListMixin],
data () { data () {
@@ -165,7 +151,7 @@ export default {
showConfirmDialog: false, showConfirmDialog: false,
delItemList: [], delItemList: [],
secondBatchDeleteObjs: [], secondBatchDeleteObjs: [],
listMode: 'list' // 列表的模式list|block dataType: 'builtInList' // userDefinedList|builtInList
} }
}, },
watch: { watch: {
@@ -176,13 +162,15 @@ export default {
...this.filterParams, ...this.filterParams,
name: this.keyWord name: this.keyWord
} }
if (this.dataType === 'userDefinedList') {
params.category = knowledgeCategoryValue.userDefined
}
this.clearList() this.clearList()
this.search(params) this.search(params)
this.$refs.knowledgeFilter.reloadFilter(this.checkedCategoryIds, this.checkedStatusIds)
}, },
reloadRowList () { reloadRowList () {
this.searchLabel.category = knowledgeCategoryValue.userDefined
this.getTableData() this.getTableData()
this.$refs.knowledgeFilter.reloadFilter()
}, },
categoryFormat (row, column) { categoryFormat (row, column) {
const category = row.category const category = row.category
@@ -257,11 +245,22 @@ export default {
ids.push(item.knowledgeId) ids.push(item.knowledgeId)
}) })
} }
let hasReference = false
let referenceKnowledge = null
this.batchDeleteObjs.forEach(item => {
if (item.reference && item.reference.length > 0) {
hasReference = true
referenceKnowledge = item
}
})
if (ids.length === 0) { if (ids.length === 0) {
this.$alert(this.$t('tip.pleaseSelect'), { this.$alert(this.$t('tip.pleaseSelect'), {
confirmButtonText: this.$t('tip.yes'), confirmButtonText: this.$t('tip.yes'),
type: 'warning' type: 'warning'
}).catch(() => {}) }).catch(() => {})
} else if (hasReference) {
this.$message.error(this.$t('knowledgeBase.deleteReferenceObjects', { name: referenceKnowledge.name }))
} else { } else {
this.toggleLoading(true) this.toggleLoading(true)
axios.delete(this.url + '?knowledgeIds=' + ids).then(response => { axios.delete(this.url + '?knowledgeIds=' + ids).then(response => {
@@ -271,11 +270,11 @@ export default {
this.secondBatchDeleteObjs.forEach((item) => { this.secondBatchDeleteObjs.forEach((item) => {
this.$refs.delDataTable.toggleRowSelection(item, false) this.$refs.delDataTable.toggleRowSelection(item, false)
}) })
this.$refs.knowledgeFilter.reloadFilter()
this.secondBatchDeleteObjs = [] this.secondBatchDeleteObjs = []
this.batchDeleteObjs = [] this.batchDeleteObjs = []
delete this.searchLabel.category // delete this.searchLabel.category
delete this.searchLabel.source delete this.searchLabel.source
this.searchLabel.category = knowledgeCategoryValue.userDefined
this.getTableData() this.getTableData()
} else { } else {
this.$message.error(response.data.message) this.$message.error(response.data.message)
@@ -292,14 +291,6 @@ export default {
}) })
} }
}, },
tableHeaderRowStyle ({ row, rowIndex }) {
// if (rowIndex === 0) {
// return 'font-weight: 500;font-size: 14px;'
// }
},
rowStyle ({ row, rowIndex }) {
// return 'height:32px !important;'//font-size: 14px;color: #666666;font-weight: 400;
},
submit () { submit () {
this.delBatchKnowledge() this.delBatchKnowledge()
this.showConfirmDialog = false this.showConfirmDialog = false
@@ -358,6 +349,16 @@ export default {
this.jumpToEditPage(this.batchDeleteObjs[0].knowledgeId) this.jumpToEditPage(this.batchDeleteObjs[0].knowledgeId)
} }
}, },
changeToUserDefinedList () {
this.dataType = 'userDefinedList'
this.$router.push({
path: '/knowledgeBase/userDefinedLibrary',
query: {
t: +new Date(),
dataType: 'userDefinedList'
}
})
},
toDelete (data) { toDelete (data) {
if (data && data.knowledgeId) { if (data && data.knowledgeId) {
this.secondBatchDeleteObjs = [] this.secondBatchDeleteObjs = []
@@ -372,12 +373,12 @@ export default {
this.isSelectedStatus = false this.isSelectedStatus = false
this.batchDeleteObjs = [] this.batchDeleteObjs = []
this.secondBatchDeleteObjs = [] this.secondBatchDeleteObjs = []
this.listMode = mode this.dataType = mode
if (this.$refs.dataTableCard) { if (this.$refs.dataTableCard) {
this.$refs.dataTableCard.clearSelect() this.$refs.dataTableCard.clearSelect()
} }
const { query } = this.$route const { query } = this.$route
const newUrl = urlParamsHandler(window.location.href, query, { listMode: mode }) const newUrl = urlParamsHandler(window.location.href, query, { dataType: mode })
overwriteUrl(newUrl) overwriteUrl(newUrl)
}, },
del (row) { del (row) {
@@ -391,8 +392,9 @@ export default {
if (response.data.code === 200) { if (response.data.code === 200) {
this.delFlag = true this.delFlag = true
this.$message({ duration: 2000, type: 'success', message: this.$t('tip.deleteSuccess') }) this.$message({ duration: 2000, type: 'success', message: this.$t('tip.deleteSuccess') })
delete this.searchLabel.category // delete this.searchLabel.category
delete this.searchLabel.source delete this.searchLabel.source
this.searchLabel.category = knowledgeCategoryValue.userDefined
this.getTableData() this.getTableData()
} else { } else {
this.$message.error(response.data.message) this.$message.error(response.data.message)
@@ -412,29 +414,64 @@ export default {
jumpToEditPage (id) { jumpToEditPage (id) {
const pageNo = this.$router.currentRoute.value.query.pageNo const pageNo = this.$router.currentRoute.value.query.pageNo
this.$router.push({ this.$router.push({
path: '/knowledgeBase/edit', path: '/knowledgeBase/userDefinedLibrary/edit',
query: { query: {
t: +new Date(), t: +new Date(),
pageNoForTable: pageNo || 1, pageNoForTable: pageNo || 1,
id: id, id: id,
listMode: this.listMode dataType: this.dataType
} }
}) })
}, },
jumpToCreatePage () { jumpToCreatePage () {
this.$router.push({ this.$router.push({
path: '/knowledgeBase/create', path: '/knowledgeBase/userDefinedLibrary/create',
query: { query: {
t: +new Date(), t: +new Date(),
listMode: this.listMode dataType: this.dataType
} }
}) })
},
getBuiltInData () {
this.isNoData = false
this.toggleLoading(true)
const params = {
category: knowledgeCategoryValue.aiTagging + ',' + knowledgeCategoryValue.webSketch,
pageSize: -1
}
get(this.listUrl, params).then(response => {
if (response.code === 200) {
this.tableData = response.data.list
if (!this.tableData || this.tableData.length === 0) {
this.isNoData = true
} else {
this.isNoData = false
}
} else {
console.error(response)
this.isNoData = true
if (response.message) {
this.$message.error(response.message)
} else {
this.$message.error(this.$t('tip.somethingWentWrong'))
}
}
}).catch(() => {
this.isNoData = true
}).finally(() => {
this.toggleLoading(false)
})
} }
}, },
mounted () { mounted () {
const curMode = this.$router.currentRoute.value.query.listMode const curMode = this.$router.currentRoute.value.query.dataType
this.listMode = curMode || 'list' this.dataType = curMode || 'builtInList'
this.filterParams = {} this.filterParams = {}
if (this.dataType === 'builtInList') {
this.getBuiltInData()
} else if (this.dataType === 'userDefinedList') {
this.searchLabel.category = knowledgeCategoryValue.userDefined
}
}, },
computed: { computed: {
} }

View File

@@ -136,7 +136,7 @@
<span v-else>{{ d.tagValue }}</span> <span v-else>{{ d.tagValue }}</span>
</td> </td>
<td class="imported-data-msg" :title="d.msg"> <td class="imported-data-msg" :title="d.msg">
<i :class="d.isValid === 1 ? 'el-icon-success' : (d.isValid === 0 ? 'el-icon-error' : '')"></i>&nbsp;&nbsp;{{(d.isValid === 1 && (d.msg==='' || !d.msg) )? 'success': d.msg }} <i :class="d.isValid === 1 ? 'el-icon-success' : (d.isValid === 0 ? 'el-icon-error' : '')"></i>&nbsp;&nbsp;{{(d.isValid === 1 && (d.msg==='' || !d.msg) )? $t('overall.success'): d.msg }}
</td> </td>
<!--返回和保存按钮:修改记录--> <!--返回和保存按钮:修改记录-->
<td v-if="backEditFlag && !addEditFlag && editIndex === i" class="imported-data-btn"> <td v-if="backEditFlag && !addEditFlag && editIndex === i" class="imported-data-btn">
@@ -214,7 +214,7 @@
import { useRoute } from 'vue-router' import { useRoute } from 'vue-router'
import { nextTick, reactive, ref } from 'vue' import { nextTick, reactive, ref } from 'vue'
import _ from 'lodash' import _ from 'lodash'
import { knowledgeBaseType, storageKey, unitTypes, knowledgeSourceValue, itemListHeight } from '@/utils/constants' import { knowledgeBaseType, storageKey, unitTypes, knowledgeSourceValue, itemListHeight, knowledgeCategoryValue } from '@/utils/constants'
import Pagination from '@/components/common/Pagination' import Pagination from '@/components/common/Pagination'
import ChartNoData from '@/views/charts/charts/ChartNoData' import ChartNoData from '@/views/charts/charts/ChartNoData'
import axios from 'axios' import axios from 'axios'
@@ -490,7 +490,7 @@ export default {
isPreviewChange: false, isPreviewChange: false,
isClick: false, isClick: false,
pageNoForTable: 1, pageNoForTable: 1,
listMode: 'list', dataType: 'builtInList',
status: 1, status: 1,
oldItemIds: [], oldItemIds: [],
oldTagItem: {} oldTagItem: {}
@@ -545,6 +545,15 @@ export default {
this.importedType = this.editObject.source this.importedType = this.editObject.source
const originalImportedData = _.cloneDeep(response.data.data) const originalImportedData = _.cloneDeep(response.data.data)
this.importedDataNoData = originalImportedData.length === 0 this.importedDataNoData = originalImportedData.length === 0
if (originalImportedData.length > 0) {
originalImportedData.forEach(data => {
if (data.isValid === 1) {
data.msg = this.$t('overall.success')
} else if (data.isValid === 0) {
data.msg = this.$t('validate.wrongFormat')
}
})
}
this.originalImportInfo = { this.originalImportInfo = {
total: originalImportedData.length, total: originalImportedData.length,
succeeded: originalImportedData.filter(d => d.isValid === 1).length, succeeded: originalImportedData.filter(d => d.isValid === 1).length,
@@ -765,21 +774,21 @@ export default {
customClass: 'del-model' customClass: 'del-model'
}).then(() => { }).then(() => {
this.$router.push({ this.$router.push({
path: '/knowledgeBase', path: '/knowledgeBase/userDefinedLibrary',
query: { query: {
pageNo: self.pageNoForTable ? Number(self.pageNoForTable) : 1, pageNo: self.pageNoForTable ? Number(self.pageNoForTable) : 1,
t: +new Date(), t: +new Date(),
listMode: this.listMode dataType: this.dataType
} }
}) })
}).catch(() => {}) }).catch(() => {})
} else { } else {
this.$router.push({ this.$router.push({
path: '/knowledgeBase', path: '/knowledgeBase/userDefinedLibrary',
query: { query: {
pageNo: self.pageNoForTable ? Number(self.pageNoForTable) : 1, pageNo: self.pageNoForTable ? Number(self.pageNoForTable) : 1,
t: +new Date(), t: +new Date(),
listMode: this.listMode dataType: this.dataType
} }
}) })
} }
@@ -816,7 +825,7 @@ export default {
const userId = localStorage.getItem(storageKey.userId) const userId = localStorage.getItem(storageKey.userId)
const postData = { const postData = {
name: this.editObject.name, name: this.editObject.name,
category: 'user_defined', category: knowledgeCategoryValue.userDefined,
source: this.editObject.source, source: this.editObject.source,
description: this.editObject.description, description: this.editObject.description,
status: this.editObject.status, status: this.editObject.status,
@@ -840,11 +849,11 @@ export default {
message: this.$t('tip.saveSuccess') message: this.$t('tip.saveSuccess')
}) })
this.$router.push({ this.$router.push({
path: '/knowledgeBase', path: '/knowledgeBase/userDefinedLibrary',
query: { query: {
pageNo: self.pageNoForTable ? Number(self.pageNoForTable) : 1, pageNo: self.pageNoForTable ? Number(self.pageNoForTable) : 1,
t: +new Date(), t: +new Date(),
listMode: this.listMode dataType: this.dataType
} }
}) })
} else { } else {
@@ -869,11 +878,11 @@ export default {
message: this.$t('tip.saveSuccess') message: this.$t('tip.saveSuccess')
}) })
this.$router.push({ this.$router.push({
path: '/knowledgeBase', path: '/knowledgeBase/userDefinedLibrary',
query: { query: {
pageNo: self.pageNoForTable ? Number(self.pageNoForTable) : 1, pageNo: self.pageNoForTable ? Number(self.pageNoForTable) : 1,
t: +new Date(), t: +new Date(),
listMode: this.listMode dataType: this.dataType
} }
}) })
} else { } else {
@@ -1095,7 +1104,7 @@ export default {
if (valid) { if (valid) {
this.editTagErrorTip = '' this.editTagErrorTip = ''
this.showImportedData[index].isValid = 1 this.showImportedData[index].isValid = 1
this.showImportedData[index].msg = 'success' this.showImportedData[index].msg = this.$t('overall.success')
} else { } else {
this.showImportedData[index].isValid = 0 this.showImportedData[index].isValid = 0
} }
@@ -1151,9 +1160,9 @@ export default {
}, },
mounted () { mounted () {
const pageNo = this.$router.currentRoute.value.query.pageNoForTable const pageNo = this.$router.currentRoute.value.query.pageNoForTable
const listMode = this.$router.currentRoute.value.query.listMode const dataType = this.$router.currentRoute.value.query.dataType
this.pageNoForTable = pageNo || 1 this.pageNoForTable = pageNo || 1
this.listMode = listMode || 'list' this.dataType = dataType || 'builtInList'
const div = document.getElementsByClassName('el-upload-dragger')[0] const div = document.getElementsByClassName('el-upload-dragger')[0]
const self = this const self = this
div.addEventListener('click', function (event) { div.addEventListener('click', function (event) {
@@ -1192,11 +1201,11 @@ export default {
console.error(e) console.error(e)
this.$message.error(this.errorMsgHandler(e)) this.$message.error(this.errorMsgHandler(e))
this.$router.push({ this.$router.push({
path: '/knowledgeBase', path: '/knowledgeBase/userDefinedLibrary',
query: { query: {
pageNo: self.pageNoForTable ? Number(self.pageNoForTable) : 1, pageNo: self.pageNoForTable ? Number(self.pageNoForTable) : 1,
t: +new Date(), t: +new Date(),
listMode: this.listMode dataType: this.dataType
} }
}) })
}) })