+
+
+
+ 查询
+ 重置
+
+ 新建
+
+ 新建文件夹
+
+
+
+ 上传
+
+ 上传文件
+ 上传文件夹
+
+
+
-
+ @* 添加标签 *@
+ 下载
+ 复制到
+ 移动到
+
-
+
-
-
-
-
+
+
+
+
- {{ formatFileSize(scope.row.fileSize) }}
+
+ {{ scope.row.fileName }}
-
-
- 文本
- Word
- PowerPoint
- Excel
- 代码
- 其他
-
+
+ {{ scope.row.updaterDisplay || '—' }}
-
-
-
-
+
+ {{ formatFileSize(scope.row.fileSize) }}
-
-
- {{ dateFormatter(scope.row.uploadTime) }}
-
+
+ {{ dateFormatter(scope.row.uploadTime) }}
-
+
- 下载
- 删除
+
+
+ @* *@
+
+ handleRowMore(cmd, scope.row)">
+
+
+ 编辑备注
+ 删除
+
+
+
-
-
-
-
-
-
-
-
-
-
+
+ 取 消
确 定
+
+
+ 取 消
+ 确 定
+
+
+
+
+
@section scripts{
@@ -170,8 +257,10 @@
return {
tableData: [],
tableLoading: false,
- page: { page: 1, size: 10 },
+ page: { page: 1, size: 8 },
total: 0,
+ keyword: '',
+ folderKeyword: '',
currentFolderId: null,
folderPath: [],
folderTree: [{ id: null, name: '根目录', hasChildren: true }],
@@ -180,10 +269,32 @@
children: 'children',
isLeaf: function (data) { return data && data.hasChildren === false; }
},
+ multipleSelection: [],
uploadDialog: { visible: false, fileList: [], uploading: false },
- createFolderDialog: { visible: false, loading: false, form: { name: '', description: '' } }
+ createFolderDialog: { visible: false, loading: false, form: { name: '', description: '' } },
+ editNoteDialog: { visible: false, loading: false, form: { id: null, fileName: '', note: '' } },
+ moveCopyDialog: {
+ visible: false,
+ mode: 'move',
+ selectedFolderId: null,
+ selectedFolderName: '根目录',
+ treeData: [{ id: null, name: '根目录', hasChildren: true }],
+ folderKeyword: '',
+ recentFolderId: null,
+ recentFolderName: '',
+ submitting: false
+ }
};
},
+ computed: {
+ filteredTableData: function () {
+ var k = (this.keyword || '').toLowerCase();
+ if (!k) return this.tableData;
+ return this.tableData.filter(function (row) {
+ return (row.fileName || '').toLowerCase().indexOf(k) >= 0;
+ });
+ }
+ },
created: function () {
this.getList();
},
@@ -208,12 +319,163 @@
url += '&folderId=' + this.currentFolderId;
}
var res = await axios.get(url);
- this.tableData = res.data.data;
- this.total = res.data.data.totalCount;
+ var d = res.data.data || res.data;
+ var list = [];
+ if (Array.isArray(d)) {
+ list = d;
+ } else if (d && typeof d === 'object') {
+ var keys = Object.keys(d).filter(function (k) {
+ return k !== 'TotalCount' && k !== 'PageIndex' && k !== 'PageCount' && k !== 'SkipCount' && isNaN(Number(k)) === false;
+ });
+ keys.sort(function (a, b) { return Number(a) - Number(b); });
+ list = keys.map(function (k) { return d[k]; });
+ }
+ this.tableData = list;
+ this.total = (res.data.data && res.data.data.totalCount) || (d && (d.TotalCount !== undefined ? d.TotalCount : d.totalCount)) || (res.data.TotalCount) || (res.data.totalCount) || 0;
+ this.tableData.forEach(function (row) {
+ if (row.updaterDisplay === undefined) row.updaterDisplay = '—';
+ });
} finally {
this.tableLoading = false;
}
},
+ doSearch: function () {
+ this.page.page = 1;
+ this.getList();
+ },
+ handleSelectionChange: function (val) {
+ this.multipleSelection = val || [];
+ },
+ handleNewCommand: function (cmd) {
+ if (cmd === 'createFolder') this.showCreateFolderDialog();
+ },
+ handleUploadCommand: function (cmd) {
+ if (cmd === 'uploadFile') this.showUploadDialog();
+ else if (cmd === 'uploadFolder') this.$message.info('上传文件夹功能开发中');
+ },
+ batchAddTag: function () { this.$message.info('添加标签功能开发中'); },
+ batchDownload: function () {
+ this.multipleSelection.forEach(function (row) {
+ window.open('/Admin/FileManager/Index?handler=Download&id=' + row.id);
+ });
+ },
+ batchCopyTo: function () { this.openMoveCopyDialog('copy'); },
+ batchMoveTo: function () { this.openMoveCopyDialog('move'); },
+ openMoveCopyDialog: function (mode) {
+ this.moveCopyDialog.mode = mode;
+ this.moveCopyDialog.visible = true;
+ this.moveCopyDialog.selectedFolderId = null;
+ this.moveCopyDialog.selectedFolderName = '根目录';
+ this.moveCopyDialog.treeData = [{ id: null, name: '根目录', hasChildren: true }];
+ this.moveCopyDialog.folderKeyword = '';
+ this.moveCopyDialog.submitting = false;
+ },
+ closeMoveCopyDialog: function () {
+ this.moveCopyDialog.visible = false;
+ },
+ onMoveCopyDialogOpen: function () {
+ this.$nextTick(function () {
+ if (this.$refs.moveCopyTree && typeof this.$refs.moveCopyTree.setCurrentKey === 'function') {
+ this.$refs.moveCopyTree.setCurrentKey(null);
+ }
+ });
+ },
+ loadMoveCopyFolderChildren: async function (node, resolve) {
+ var self = this;
+ try {
+ var parentId = node.level === 0 ? null : node.data.id;
+ var url = '/Admin/FileManager/Index?handler=Folders';
+ if (parentId != null) { url += '&parentId=' + parentId; }
+ var res = await axios.get(url);
+ var list = (res.data && res.data.data) ? res.data.data : (res.data || []);
+ resolve((list || []).map(function (f) {
+ return { id: f.id, name: f.name, description: f.description, parentId: f.parentId, hasChildren: true };
+ }));
+ } catch (e) {
+ console.error(e);
+ resolve([]);
+ }
+ },
+ onMoveCopyFolderClick: function (data) {
+ this.moveCopyDialog.selectedFolderId = data.id === null ? null : data.id;
+ this.moveCopyDialog.selectedFolderName = data.name || '根目录';
+ },
+ useRecentPath: function () {
+ if (!this.moveCopyDialog.recentFolderName) return;
+ this.moveCopyDialog.selectedFolderId = this.moveCopyDialog.recentFolderId;
+ this.moveCopyDialog.selectedFolderName = this.moveCopyDialog.recentFolderName;
+ if (this.$refs.moveCopyTree && typeof this.$refs.moveCopyTree.setCurrentKey === 'function') {
+ this.$refs.moveCopyTree.setCurrentKey(this.moveCopyDialog.recentFolderId);
+ }
+ },
+ confirmMoveCopy: async function () {
+ this.moveCopyDialog.submitting = true;
+ try {
+ var targetFolderId = this.moveCopyDialog.selectedFolderId;
+ var ids = this.multipleSelection.map(function (r) { return r.id; });
+ if (ids.length === 0) {
+ this.$message.warning('请先选择要' + (this.moveCopyDialog.mode === 'move' ? '移动' : '复制') + '的文件');
+ return;
+ }
+ var url = this.moveCopyDialog.mode === 'move' ? '/Admin/FileManager/Index?handler=Move' : '/Admin/FileManager/Index?handler=Copy';
+ await axios.post(url, { fileIds: ids, targetFolderId: targetFolderId });
+ this.$message.success(this.moveCopyDialog.mode === 'move' ? '移动成功' : '复制成功');
+ this.moveCopyDialog.recentFolderId = targetFolderId;
+ this.moveCopyDialog.recentFolderName = this.moveCopyDialog.selectedFolderName;
+ this.moveCopyDialog.visible = false;
+ this.getList();
+ } catch (e) {
+ this.$message.info(this.moveCopyDialog.mode === 'move' ? '移动功能开发中' : '复制功能开发中');
+ } finally {
+ this.moveCopyDialog.submitting = false;
+ }
+ },
+ goParent: function () {
+ if (this.folderPath.length > 0) {
+ var parent = this.folderPath.length === 1 ? null : this.folderPath[this.folderPath.length - 2].id;
+ this.enterFolder(parent);
+ } else {
+ this.enterFolder(null);
+ }
+ },
+ copyNavPath: function () {
+ var path = '根目录';
+ if (this.folderPath.length > 0) {
+ path = this.folderPath.map(function (p) { return p.name; }).join(' / ');
+ }
+ var ta = document.createElement('textarea');
+ ta.value = path;
+ document.body.appendChild(ta);
+ ta.select();
+ try {
+ document.execCommand('copy');
+ this.$message.success('已复制路径');
+ } catch (e) { this.$message.error('复制失败'); }
+ document.body.removeChild(ta);
+ },
+ openPermission: function (row) { this.$message.info('权限管理功能开发中'); },
+ openShare: function (row) { this.$message.info('分享链接功能开发中'); },
+ handleRowMore: function (cmd, row) {
+ if (cmd === 'editNote') this.editNote(row);
+ else if (cmd === 'delete') this.deleteFile(row);
+ },
+ editNote: function (row) {
+ this.editNoteDialog.form = { id: row.id, fileName: row.fileName || '', note: row.description || '' };
+ this.editNoteDialog.visible = true;
+ },
+ submitEditNote: async function () {
+ this.editNoteDialog.loading = true;
+ try {
+ await axios.post('/Admin/FileManager/Index?handler=EditNote', { id: this.editNoteDialog.form.id, note: this.editNoteDialog.form.note });
+ this.$message.success('更新成功');
+ this.editNoteDialog.visible = false;
+ this.getList();
+ } catch (e) {
+ this.$message.error('更新失败');
+ } finally {
+ this.editNoteDialog.loading = false;
+ }
+ },
handleCurrentChange: function (val) {
this.page.page = val;
this.getList();
diff --git a/src/Extensions/Senparc.Xncf.FileManager/wwwroot/css/Admin/FileManager/index.css b/src/Extensions/Senparc.Xncf.FileManager/wwwroot/css/Admin/FileManager/index.css
index b4c8ae423..fa7e49d10 100644
--- a/src/Extensions/Senparc.Xncf.FileManager/wwwroot/css/Admin/FileManager/index.css
+++ b/src/Extensions/Senparc.Xncf.FileManager/wwwroot/css/Admin/FileManager/index.css
@@ -1,9 +1,198 @@
-.filter-container {
- padding-bottom: 10px;
+/* FileManager 左右布局 */
+.file-manager-layout {
+ display: flex;
+ gap: 0;
+ min-height: 560px;
+ background: #f5f7fa;
+}
+
+/* 左侧文件夹面板 */
+.folder-panel {
+ width: 260px;
+ min-width: 260px;
+ background: #fff;
+ border-right: 1px solid #e4e7ed;
+ display: flex;
+ flex-direction: column;
+}
+
+.folder-panel-header {
+ padding: 16px;
+ border-bottom: 1px solid #ebeef5;
+}
+
+.folder-panel-title {
+ font-size: 16px;
+ font-weight: 600;
+ color: #303133;
+}
+
+.folder-search {
+ padding: 12px;
+ border-bottom: 1px solid #ebeef5;
+}
+
+.folder-search .el-input {
+ width: 100%;
+}
+
+.folder-tree-wrap {
+ flex: 1;
+ overflow: auto;
+ padding: 8px 0;
+}
+
+.folder-tree-wrap .custom-tree-node {
+ display: inline-flex;
+ align-items: center;
+}
+
+.folder-tree-wrap .tree-node-label {
+ margin-left: 6px;
+}
+
+/* 右侧内容区 */
+.content-panel {
+ flex: 1;
+ display: flex;
+ flex-direction: column;
+ min-width: 0;
+ background: #fff;
+ margin: 0;
+ padding: 16px 20px;
+}
+
+/* 查询区与工具栏同一行 */
+.query-toolbar-row {
+ display: flex;
+ align-items: center;
+ gap: 10px;
+ margin-bottom: 12px;
+ flex-wrap: wrap;
+}
+
+.query-input {
+ width: 260px;
+}
+
+/* 搜索框内图标垂直居中 */
+.query-toolbar-row .el-input__prefix {
+ display: flex;
+ align-items: center;
+ left: 10px;
+}
+
+.query-toolbar-row .query-input-prefix {
+ margin: 0;
+ line-height: 1;
+}
+
+.toolbar-selection {
+ display: inline-flex;
+ align-items: center;
+ gap: 8px;
+ margin-left: 8px;
+ padding-left: 12px;
+ border-left: 1px solid #dcdfe6;
+}
+
+/* 新建下拉项中图标与文字间距 */
+.query-toolbar-row .el-dropdown-menu__item .el-icon-folder {
+ margin-right: 6px;
+}
+
+/* 导航栏 */
+.nav-bar {
+ display: flex;
+ align-items: center;
+ gap: 10px;
+ margin-bottom: 12px;
+ padding: 8px 0;
+ border-bottom: 1px solid #ebeef5;
+}
+
+.nav-back {
+ color: #606266;
+ font-size: 13px;
+ text-decoration: none;
+ white-space: nowrap;
+}
+
+.nav-back:hover {
+ color: #409eff;
+}
+
+.nav-breadcrumb {
+ flex: 1;
+ font-size: 13px;
+}
+
+.nav-copy {
+ cursor: pointer;
+ color: #909399;
+ font-size: 16px;
+}
+
+.nav-copy:hover {
+ color: #409eff;
+}
+
+/* 表格:行悬停时显示操作图标 */
+.file-table .el-table__row .row-actions {
+ visibility: hidden;
+}
+
+.file-table .el-table__row:hover .row-actions {
+ visibility: visible;
+}
+
+.file-table .col-row-actions {
+ padding: 8px 0;
}
-.pagination-container {
- padding: 20px 0;
+.row-actions {
+ display: inline-flex;
+ align-items: center;
+ gap: 8px;
+}
+
+.row-actions .action-icon,
+.row-actions .action-icon-wrap {
+ cursor: pointer;
+ color: #909399;
+ font-size: 16px;
+}
+
+.row-actions .action-icon:hover,
+.row-actions .action-icon-wrap:hover {
+ color: #409eff;
+}
+
+.file-icon {
+ margin-right: 8px;
+ color: #409eff;
+}
+
+/* 更新时间列不换行,单行完整显示 */
+.file-table .col-upload-time .cell {
+ white-space: nowrap;
+}
+
+.file-table .cell-upload-time {
+ white-space: nowrap;
+}
+
+/* 分页 */
+.pagination-wrap {
+ margin-top: 16px;
+ padding: 12px 0;
+ display: flex;
+ justify-content: flex-end;
+}
+
+/* 对话框与上传 */
+.filter-container {
+ padding-bottom: 10px;
}
.el-upload-dragger {
@@ -16,4 +205,190 @@
.el-dialog .el-upload {
width: auto;
-}
\ No newline at end of file
+}
+
+/* ========== 新建文件夹 / 编辑备注 弹窗统一样式 ========== */
+.file-manager-dialog.el-dialog {
+ border-radius: 8px;
+ overflow: hidden;
+}
+
+.file-manager-dialog .el-dialog__header {
+ padding: 16px 20px 12px;
+ border-bottom: 1px solid #ebeef5;
+ background: #fafafa;
+}
+
+.file-manager-dialog .el-dialog__title {
+ font-size: 16px;
+ font-weight: 600;
+ color: #303133;
+}
+
+.file-manager-dialog .el-dialog__body {
+ padding: 24px 20px 20px;
+}
+
+.file-manager-dialog .dialog-body-inner {
+ min-height: 60px;
+}
+
+.file-manager-dialog .dialog-form .el-form-item {
+ margin-bottom: 20px;
+}
+
+.file-manager-dialog .dialog-form .el-form-item__label {
+ color: #606266;
+ line-height: 40px;
+ padding-right: 16px;
+}
+
+.file-manager-dialog .dialog-form .el-input__inner,
+.file-manager-dialog .dialog-form .el-textarea__inner {
+ border-radius: 4px;
+}
+
+.file-manager-dialog .dialog-form .el-textarea__inner {
+ padding: 10px 12px;
+ line-height: 1.6;
+ resize: vertical;
+ min-height: 88px;
+}
+
+.file-manager-dialog .el-dialog__footer {
+ padding: 12px 20px 16px;
+ border-top: 1px solid #ebeef5;
+ text-align: right;
+}
+
+.file-manager-dialog .dialog-footer .el-button {
+ min-width: 72px;
+}
+
+/* 编辑备注 - 文件名只读展示 */
+.dialog-edit-note .edit-note-filename {
+ display: inline-flex;
+ align-items: center;
+ gap: 8px;
+ padding: 8px 12px;
+ background: #f5f7fa;
+ border-radius: 4px;
+ color: #606266;
+ font-size: 13px;
+ line-height: 1.5;
+ max-width: 100%;
+ word-break: break-all;
+}
+
+.dialog-edit-note .edit-note-filename .el-icon-document {
+ color: #909399;
+ flex-shrink: 0;
+}
+
+/* ========== 移动到 / 复制到 弹窗 ========== */
+.dialog-move-copy .el-dialog__body {
+ padding: 16px 20px 12px;
+}
+
+.dialog-move-copy .el-dialog__footer {
+ padding: 0;
+}
+
+.move-copy-body {
+ display: flex;
+ flex-direction: column;
+ gap: 12px;
+}
+
+.move-copy-search {
+ flex-shrink: 0;
+}
+
+.move-copy-search-input {
+ width: 100%;
+}
+
+.move-copy-search .el-input__prefix {
+ display: flex;
+ align-items: center;
+}
+
+.move-copy-tree-wrap {
+ border: 1px solid #ebeef5;
+ border-radius: 4px;
+ padding: 12px;
+ min-height: 240px;
+ max-height: 320px;
+ overflow: auto;
+ background: #fafafa;
+}
+
+.dialog-move-copy .move-copy-tree-wrap .custom-tree-node {
+ display: inline-flex;
+ align-items: center;
+}
+
+.dialog-move-copy .move-copy-tree-wrap .tree-node-label {
+ margin-left: 6px;
+}
+
+.move-copy-current {
+ flex-shrink: 0;
+ padding: 10px 12px;
+ background: #f0f9ff;
+ border-radius: 4px;
+ border: 1px solid #d9ecff;
+ font-size: 13px;
+}
+
+.move-copy-current-label {
+ color: #606266;
+ margin-right: 6px;
+}
+
+.move-copy-current-value {
+ color: #303133;
+ font-weight: 500;
+}
+
+.move-copy-footer {
+ display: flex;
+ flex-direction: column;
+ gap: 14px;
+ padding: 14px 20px 16px;
+ border-top: 1px solid #ebeef5;
+ background: #fafafa;
+}
+
+.move-copy-recent {
+ font-size: 13px;
+ color: #606266;
+}
+
+.move-copy-recent-label {
+ margin-right: 8px;
+}
+
+.move-copy-recent-path {
+ color: #303133;
+ margin-right: 8px;
+}
+
+.move-copy-use-recent {
+ padding: 0 4px;
+ font-size: 13px;
+}
+
+.move-copy-recent-empty {
+ color: #909399;
+}
+
+.move-copy-actions {
+ display: flex;
+ justify-content: flex-end;
+ gap: 10px;
+}
+
+.move-copy-actions .el-button {
+ min-width: 72px;
+}
diff --git a/src/Extensions/Senparc.Xncf.KnowledgeBase/Areas/Admin/Pages/KnowledgeBase/Index.cshtml b/src/Extensions/Senparc.Xncf.KnowledgeBase/Areas/Admin/Pages/KnowledgeBase/Index.cshtml
index a2ac9e88e..40e98cf73 100644
--- a/src/Extensions/Senparc.Xncf.KnowledgeBase/Areas/Admin/Pages/KnowledgeBase/Index.cshtml
+++ b/src/Extensions/Senparc.Xncf.KnowledgeBase/Areas/Admin/Pages/KnowledgeBase/Index.cshtml
@@ -11,39 +11,48 @@
@section breadcrumbs {
+
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ {{ editNoteDialog.form.fileName || '—' }}
+
+
+
+
+
+
+
+
+
+ {{ data.name }}
+
+
+
+
+ 当前选择:
+ {{ moveCopyDialog.selectedFolderName }}
+
+
+
+
+ 最近保存路径:
+
+ {{ moveCopyDialog.recentFolderName }}
+ 使用该路径
+
+ 暂无
+
+
+ 取 消
+ 移动到这里
+ 复制到这里
+
+
+
-
-
-
-
- 查询
- 重置
-
-
-
-
-
- 新增
-
-
-
-
-
-
-
-
-
-
+ @* 查询区:按知识库名称查询 *@
+
+
+ @* 表格区域 *@
+
-
+ @* 分页:首页、上一页、下一页、尾页、跳转、每页条数 5/10/15/20/50/100,默认 10 *@
+
+ width="560px"
+ custom-class="kb-form-dialog"
+ class="kb-form-dialog-scope">
-
-
-
-
-
-
-
+ size="small"
+ label-position="top"
+ class="kb-form-dialog__form">
+
+
-
-
-
+
-
+
+
-
-
-
-
+
+
+ @* 工具栏:添加按钮、列筛选 *@
+
+
+
+ 查询
+ 重置
+
+
+ 添加
+
+
+
+
+ 列筛选
+
-
+
@@ -61,94 +70,109 @@
{{formaTableTime(scope.row.addTime)}}
-
+
- 配置
- 向量化
- 编辑
-
- 删除
+ 配置
+ 向量化
+ 编辑
+
+ 删除
+
-
+
+
+
+
+
+
+
+
+
+
+
-
-
-
-
+
+
+
+
+
+
+
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
- 模型与向量库
+
- 取消
- 确认
+ OnGetKnowledgeBasesAsync(string keyword, string orderField, int pageIndex, int pageSize)
{
var seh = new SenparcExpressionHelper();
- //seh.ValueCompare.AndAlso(!string.IsNullOrEmpty(keyword), _ => _.Name.Contains(keyword));
+ seh.ValueCompare.AndAlso(!string.IsNullOrEmpty(keyword), _ => _.Name.Contains(keyword));
var where = seh.BuildWhereExpression();
var response = await _knowledgeBaseService.GetObjectListAsync(pageIndex, pageSize, where, orderField);
return Ok(new
- {
- response.TotalCount,
- response.PageIndex,
- List = response.Select(_ => new {
- _.Id,
- _.LastUpdateTime,
- _.Remark,
- _.EmbeddingModelId,
- _.VectorDBId,
- _.ChatModelId,
- _.Name,
- _.Content,
- _.AddTime
- })
- });
+ {
+ response.TotalCount,
+ response.PageIndex,
+ List = response.Select(_ => new
+ {
+ _.Id,
+ _.LastUpdateTime,
+ _.Remark,
+ _.EmbeddingModelId,
+ _.VectorDBId,
+ _.ChatModelId,
+ _.Name,
+ _.Content,
+ _.AddTime
+ })
+ });
}
}
}
diff --git a/src/Extensions/Senparc.Xncf.KnowledgeBase/wwwroot/css/KnowledgeBase/KnowledgeBase/KnowledgeBase.css b/src/Extensions/Senparc.Xncf.KnowledgeBase/wwwroot/css/KnowledgeBase/KnowledgeBase/KnowledgeBase.css
index df4135105..329f554bd 100644
--- a/src/Extensions/Senparc.Xncf.KnowledgeBase/wwwroot/css/KnowledgeBase/KnowledgeBase/KnowledgeBase.css
+++ b/src/Extensions/Senparc.Xncf.KnowledgeBase/wwwroot/css/KnowledgeBase/KnowledgeBase/KnowledgeBase.css
@@ -1,12 +1,180 @@
-.el-dialog .el-form-item .el-input,
-.el-dialog .el-form-item .el-textarea {
- width: 15rem;
+/* 新增/编辑知识库弹框 */
+.kb-form-dialog .el-dialog__header {
+ padding: 18px 24px 14px;
+ border-bottom: 1px solid #ebeef5;
+}
+
+.kb-form-dialog .el-dialog__title {
+ font-size: 16px;
+ font-weight: 600;
+ color: #303133;
+}
+
+.kb-form-dialog .el-dialog__body {
+ padding: 24px 24px 20px;
+}
+
+.kb-form-dialog__form {
+ max-width: 100%;
+}
+
+.kb-form-dialog__form .el-form-item {
+ margin-bottom: 20px;
+}
+
+.kb-form-dialog__form .kb-form-item .el-form-item__label {
+ font-size: 13px;
+ color: #606266;
+ line-height: 1.4;
+ padding-bottom: 8px;
+}
+
+.kb-form-dialog__form .el-form-item__content {
+ line-height: 1.5;
+}
+
+.kb-form-dialog__form .el-input__inner,
+.kb-form-dialog__form .el-textarea__inner {
+ font-size: 13px;
+}
+
+.kb-form-dialog__form .el-textarea__inner {
+ padding: 10px 12px;
+ line-height: 1.6;
+}
+
+.kb-form-group {
+ margin-bottom: 20px;
+ padding: 16px;
+ background: #fafbfc;
+ border: 1px solid #e8eaec;
+ border-radius: 6px;
+}
+
+.kb-form-group__title {
+ font-size: 13px;
+ font-weight: 600;
+ color: #303133;
+ margin-bottom: 14px;
+ padding-bottom: 8px;
+ border-bottom: 1px solid #ebeef5;
+}
+
+.kb-form-group .el-form-item {
+ margin-bottom: 16px;
+}
+
+.kb-form-group .el-form-item:last-child {
+ margin-bottom: 0;
+}
+
+.kb-form-group .hidden {
+ margin-bottom: 0;
+}
+
+.kb-form-dialog__footer {
+ display: flex;
+ justify-content: flex-end;
+ gap: 12px;
+ padding: 14px 24px 18px;
+ border-top: 1px solid #ebeef5;
+}
+
+.kb-form-dialog__footer .el-button {
+ min-width: 80px;
}
.el-form-item__content {
/*width: 30rem;*/
}
+/* 知识库列表页整体 */
+.kb-index-page {
+ padding: 20px 24px;
+ background: #f0f2f5;
+ min-height: 100%;
+ box-sizing: border-box;
+}
+
+.admin-role {
+ background: #fff;
+ border-radius: 8px;
+ padding: 20px 24px;
+ box-shadow: 0 1px 4px rgba(0,0,0,0.06);
+}
+
+/* 查询区 */
+.kb-query-section {
+ margin-bottom: 20px;
+ padding: 16px 18px;
+ background: #fafbfc;
+ border: 1px solid #e8eaec;
+ border-radius: 6px;
+}
+
+.kb-query-row {
+ display: flex;
+ align-items: center;
+ flex-wrap: wrap;
+ gap: 12px;
+}
+
+.kb-query-label {
+ flex: 0 0 auto;
+ font-size: 14px;
+ color: #606266;
+ margin: 0;
+}
+
+.kb-query-input {
+ width: 260px;
+}
+
+.kb-query-row .el-button {
+ margin-left: 0;
+}
+
+/* 工具栏 */
+.kb-toolbar {
+ display: flex;
+ align-items: center;
+ gap: 12px;
+ margin-bottom: 16px;
+}
+
+.kb-toolbar .el-button {
+ margin: 0;
+}
+
+/* 表格区域 */
+.kb-table-wrap {
+ margin-bottom: 16px;
+ overflow-x: auto;
+}
+
+.kb-table-wrap .el-table {
+ font-size: 13px;
+}
+
+.kb-table-wrap .el-table th {
+ background: #f5f7fa;
+ color: #303133;
+ font-weight: 600;
+}
+
+/* 分页 */
+.kb-pagination-wrap {
+ display: flex;
+ justify-content: flex-end;
+ padding-top: 12px;
+ border-top: 1px solid #ebeef5;
+}
+
+.kb-pagination-wrap .el-pagination {
+ flex-wrap: nowrap;
+ white-space: nowrap;
+}
+
.filter-condition {
margin-bottom: 0.5rem;
}
diff --git a/src/Extensions/Senparc.Xncf.KnowledgeBase/wwwroot/js/KnowledgeBase/Pages/KnowledgeBase/knowledgeBase.js b/src/Extensions/Senparc.Xncf.KnowledgeBase/wwwroot/js/KnowledgeBase/Pages/KnowledgeBase/knowledgeBase.js
index c2e136eb7..4a4bc07fb 100644
--- a/src/Extensions/Senparc.Xncf.KnowledgeBase/wwwroot/js/KnowledgeBase/Pages/KnowledgeBase/knowledgeBase.js
+++ b/src/Extensions/Senparc.Xncf.KnowledgeBase/wwwroot/js/KnowledgeBase/Pages/KnowledgeBase/knowledgeBase.js
@@ -1,1070 +1,1084 @@
new Vue({
- el: "#app",
- data() {
- var validateCode = (rule, value, callback) => {
- callback();
+ el: "#app",
+ data() {
+ var validateCode = (rule, value, callback) => {
+ callback();
+ };
+ return {
+ defaultMSG: null,
+ editorData: '',
+ elSize: 'medium', // el 组件尺寸大小 默认为空 medium、small、mini
+ // 显隐 visible
+ visible: {
+ drawerGroup: false, // 组 新增|编辑
+ dialogFile: false, // 配置抽屉内「新建文件」上传弹框
+ embeddingProgress: false, // 向量化进度弹窗
+ embeddingResult: false, // 向量化结果展示弹窗
+ },
+ embeddingProgressPercent: 0,
+ embeddingProgressStatus: '', // '' | success | exception
+ embeddingProgressText: '正在准备...',
+ embeddingResultText: '',
+ _embeddingTimer: null,
+ configUploadFileList: [], // 新建文件弹框内的上传列表(仅展示用,关闭时清空)
+ form:
+ {
+ content: ''
+ },
+ config:
+ {
+ initialFrameHeight: 500
+ },
+ //分页参数
+ paginationQuery:
+ {
+ total: 5
+ },
+ //分页接口传参
+ listQuery: {
+ pageIndex: 1,
+ pageSize: 10,
+ keyword: '',
+ orderField: ''
+ },
+ selectDefaultEmbeddingModel: [],
+ embeddingModelData: [],
+ selectDefaultVectorDB: [],
+ vectorDBData: [],
+ selectDefaultChatModel: [],
+ chatModelData: [],
+ page: {
+ page: 1,
+ size: 10,
+ modelCount: 999
+ },
+ filterTableHeader: {
+ embeddingModelId: [],
+ vectorDBId: [],
+ chatModelId: [],
+ name: []
+ },
+ colData: [
+ { title: "Embedding模型Id", istrue: false },
+ { title: "向量数据库Id", istrue: false },
+ { title: "对话模型Id", istrue: false },
+ { title: "名称", istrue: true },
+ { title: "内容", istrue: true },
+ ],
+ checkBoxGroup: [
+ "Embedding模型Id", "向量数据库Id", "对话模型Id", "名称", "内容"
+ ],
+ checkedColumns: [],
+ contentTypeData: [
+ { value: 1, label: '输入' },
+ { value: 2, label: '文件' },
+ { value: 3, label: '采集外部数据' }
+ ],
+ keyword: '',
+ multipleSelection: '',
+ radio: '',
+ props: { multiple: true },
+ // 表格数据
+ tableData: [],
+ uid: '',
+ fileList: [],
+ sizeForm: {
+ name: '',
+ region: '',
+ date1: '',
+ date2: '',
+ delivery: false,
+ type: [],
+ resource: '',
+ desc: ''
+ },
+ size: 'mini',
+ dialogImageUrl: '',
+ dialogVisible: false,
+ dialog:
+ {
+ title: '新增知识库管理',
+ visible: false,
+ data:
+ {
+ id: '', embeddingModelId: '', vectorDBId: '', chatModelId: '', name: '', content: ''
+ },
+ rules:
+ {
+ name:
+ [
+ { required: true, message: "知识库管理名称为必填项", trigger: "blur" }
+ ]
+ },
+ updateLoading: false,
+ disabled: false,
+ checkStrictly: true // 是否严格的遵守父子节点不互相关联
+ },
+ detailDialog:
+ {
+ title: '知识库管理详情',
+ visible: false,
+ data:
+ {
+ id: '', embeddingModelId: '', vectorDBId: '', chatModelId: '', name: '', content: ''
+ },
+ rules:
+ {
+ name:
+ [
+ { required: true, message: "知识库管理名称为必填项", trigger: "blur" }
+ ]
+ },
+ updateLoading: false,
+ disabled: false,
+ checkStrictly: true // 是否严格的遵守父子节点不互相关联
+ },
+ // 组 新增|编辑(内容类型:1=输入 2=文件 3=采集外部数据,默认文件)
+ groupForm: {
+ contentType: 2, // 内容类型,默认「文件」
+ files: [], // 文件列表
+ content: '', // 内容
+ knowledgeBasesId: '' //知识库ID
+ },
+ groupFormRules: {
+ name: [
+ { required: true, message: '请填写', trigger: 'blur' },
+ ],
+ members: [
+ { required: true, message: '请填写', trigger: 'change' },
+ ],
+ adminAgentTemplateId: [
+ { required: true, message: '请填写', trigger: 'change' },
+ ],
+ enterAgentTemplateId: [
+ { required: true, message: '请选择', trigger: 'change' },
+ ],
+ // description: [
+ // { required: true, message: '请填写', trigger: 'blur' },
+ // ],
+ },
+ // 组 新增|编辑 智能体
+ groupAgentQueryList: {
+ pageIndex: 0,
+ pageSize: 0,
+ filter: '', // 筛选文本
+ timeSort: false, // 默认降序
+ proce: false, // 进行中
+ stop: false, // 停用
+ stand: false, // 待命
+ },
+ groupAgentList: [], // 组新增时的智能体列表
+ // 配置页文件列表查询与分页
+ fileQueryList: {
+ pageIndex: 1,
+ pageSize: 10,
+ filter: '', // 文件名称筛选
+ },
+ fileListTotal: 0, // 文件列表总条数,用于分页
+ fileList: [], // 配置页文件列表
+ fileNamesToSelect: [], // 打开配置时待选中的文件名(从 KnowledgeBaseItem 回显用)
+ }
+ },
+ created: function () {
+ let that = this
+ that.getList();
+ that.getEmbeddingModelList();
+ that.getVectorDBList();
+ that.getChatModelList();
+ //debugger
+ // 获取文件数据
+ that.getFileListData('file');
+
+ //TODO:初始化设置选中的字段
+ that.checkedColumns = that.colData.filter(item => item.istrue).map(item => item.title);
+ console.log(`that.checkedColumns --- ${JSON.stringify(that.checkedColumns)}`)
+ },
+ watch:
+ {
+ 'dialog.visible': function (val, old) {
+ // 关闭dialog,清空
+ if (!val) {
+ this.dialog.data = {
+ id: '', embeddingModelId: '', vectorDBId: '', chatModelId: '', name: '', content: ''
};
- return {
- defaultMSG: null,
- editorData: '',
- elSize: 'medium', // el 组件尺寸大小 默认为空 medium、small、mini
- // 显隐 visible
- visible: {
- drawerGroup: false, // 组 新增|编辑
- dialogFile: false, // 配置抽屉内「新建文件」上传弹框
- embeddingProgress: false, // 向量化进度弹窗
- embeddingResult: false, // 向量化结果展示弹窗
- },
- embeddingProgressPercent: 0,
- embeddingProgressStatus: '', // '' | success | exception
- embeddingProgressText: '正在准备...',
- embeddingResultText: '',
- _embeddingTimer: null,
- configUploadFileList: [], // 新建文件弹框内的上传列表(仅展示用,关闭时清空)
- form:
- {
- content: ''
- },
- config:
- {
- initialFrameHeight: 500
- },
- //分页参数
- paginationQuery:
- {
- total: 5
- },
- //分页接口传参
- listQuery: {
- pageIndex: 1,
- pageSize: 20,
- keyword: '',
- orderField: ''
- },
- selectDefaultEmbeddingModel: [],
- embeddingModelData: [],
- selectDefaultVectorDB: [],
- vectorDBData: [],
- selectDefaultChatModel: [],
- chatModelData: [],
- page: {
- page: 1,
- size: 10,
- modelCount: 999
- },
- filterTableHeader: {
- embeddingModelId: [],
- vectorDBId: [],
- chatModelId: [],
- name: []
- },
- colData: [
- { title: "Embedding模型Id", istrue: false },
- { title: "向量数据库Id", istrue: false },
- { title: "对话模型Id", istrue: false },
- { title: "名称", istrue: true },
- { title: "内容", istrue: true },
- ],
- checkBoxGroup: [
- "Embedding模型Id", "向量数据库Id", "对话模型Id", "名称", "内容"
- ],
- checkedColumns: [],
- contentTypeData: [
- { value: 1, label: '输入' },
- { value: 2, label: '文件' },
- { value: 3, label: '采集外部数据' }
- ],
- keyword: '',
- multipleSelection: '',
- radio: '',
- props: { multiple: true },
- // 表格数据
- tableData: [],
- uid: '',
- fileList: [],
- sizeForm: {
- name: '',
- region: '',
- date1: '',
- date2: '',
- delivery: false,
- type: [],
- resource: '',
- desc: ''
- },
- size: 'mini',
- dialogImageUrl: '',
- dialogVisible: false,
- dialog:
- {
- title: '新增知识库管理',
- visible: false,
- data:
- {
- id: '', embeddingModelId: '', vectorDBId: '', chatModelId: '', name: '', content: ''
- },
- rules:
- {
- name:
- [
- { required: true, message: "知识库管理名称为必填项", trigger: "blur" }
- ]
- },
- updateLoading: false,
- disabled: false,
- checkStrictly: true // 是否严格的遵守父子节点不互相关联
- },
- detailDialog:
- {
- title: '知识库管理详情',
- visible: false,
- data:
- {
- id: '', embeddingModelId: '', vectorDBId: '', chatModelId: '', name: '', content: ''
- },
- rules:
- {
- name:
- [
- { required: true, message: "知识库管理名称为必填项", trigger: "blur" }
- ]
- },
- updateLoading: false,
- disabled: false,
- checkStrictly: true // 是否严格的遵守父子节点不互相关联
- },
- // 组 新增|编辑(内容类型:1=输入 2=文件 3=采集外部数据,默认文件)
- groupForm: {
- contentType: 2, // 内容类型,默认「文件」
- files: [], // 文件列表
- content: '', // 内容
- knowledgeBasesId: '' //知识库ID
- },
- groupFormRules: {
- name: [
- { required: true, message: '请填写', trigger: 'blur' },
- ],
- members: [
- { required: true, message: '请填写', trigger: 'change' },
- ],
- adminAgentTemplateId: [
- { required: true, message: '请填写', trigger: 'change' },
- ],
- enterAgentTemplateId: [
- { required: true, message: '请选择', trigger: 'change' },
- ],
- // description: [
- // { required: true, message: '请填写', trigger: 'blur' },
- // ],
- },
- // 组 新增|编辑 智能体
- groupAgentQueryList: {
- pageIndex: 0,
- pageSize: 0,
- filter: '', // 筛选文本
- timeSort: false, // 默认降序
- proce: false, // 进行中
- stop: false, // 停用
- stand: false, // 待命
- },
- groupAgentList: [], // 组新增时的智能体列表
- // 配置页文件列表查询与分页
- fileQueryList: {
- pageIndex: 1,
- pageSize: 10,
- filter: '', // 文件名称筛选
- },
- fileListTotal: 0, // 文件列表总条数,用于分页
- fileList: [], // 配置页文件列表
- fileNamesToSelect: [], // 打开配置时待选中的文件名(从 KnowledgeBaseItem 回显用)
+ this.dialog.updateLoading = false;
+ this.dialog.disabled = false;
+ }
+ },
+ 'checkedColumns': function (val) {
+ //debugger
+ console.log(val);
+ let arr = this.checkBoxGroup.filter(i => !val.includes(i));
+ this.colData.filter(i => {
+ if (arr.indexOf(i.title) != -1) {
+ i.istrue = false;
+ } else {
+ i.istrue = true;
}
+ });
+ this.reload = Math.random()
+ }
+ },
+ methods:
+ {
+ handleChange(value) {
+ console.log(value);
},
- created: function () {
- let that = this
- that.getList();
- that.getEmbeddingModelList();
- that.getVectorDBList();
- that.getChatModelList();
- //debugger
- // 获取文件数据
- that.getFileListData('file');
-
- //TODO:初始化设置选中的字段
- that.checkedColumns = that.colData.filter(item => item.istrue).map(item => item.title);
- console.log(`that.checkedColumns --- ${JSON.stringify(that.checkedColumns)}`)
+ handleRemove(file, fileList) {
+ log(file, fileList, 2);
},
- watch:
- {
- 'dialog.visible': function (val, old) {
- // 关闭dialog,清空
- if (!val) {
- this.dialog.data = {
- id: '', embeddingModelId: '', vectorDBId: '', chatModelId: '', name: '', content: ''
- };
- this.dialog.updateLoading = false;
- this.dialog.disabled = false;
- }
- },
- 'checkedColumns': function (val) {
- //debugger
- console.log(val);
- let arr = this.checkBoxGroup.filter(i => !val.includes(i));
- this.colData.filter(i => {
- if (arr.indexOf(i.title) != -1) {
- i.istrue = false;
- } else {
- i.istrue = true;
- }
- });
- this.reload = Math.random()
+ handlePictureCardPreview(file) {
+ let that = this
+ that.dialogImageUrl = file.url;
+ that.dialogVisible = true;
+ },
+ uploadSuccess(res, file, fileList) {
+ let that = this;
+ // 上传成功
+ that.fileList = fileList;
+ //debugger
+ if (res.stateCode == 0) {
+ that.$notify({
+ title: '成功',
+ message: '恭喜你,上传成功',
+ type: 'success'
+ });
+ // 清空文件列表(关键)
+ that.$refs.uploadRef.clearFiles();
+ } else {
+ that.$notify.error({
+ title: '失败',
+ message: '上传失败,请重新上传'
+ });
+ }
+ },
+ uploadError() {
+ let that = this;
+ that.$notify.error({
+ title: '失败',
+ message: '上传失败,请重新上传'
+ });
+ },
+ // 配置抽屉「新建文件」弹框:上传成功后将文件写入 FileManage,并加入当前已选列表、刷新文件列表并勾选新文件
+ async configUploadSuccess(res, file, fileList) {
+ const that = this;
+ const ok = (res && (res.stateCode === 0 || res.success === true));
+ const fileId = res && res.data != null ? res.data : null;
+ if (ok && fileId != null) {
+ const id = typeof fileId === 'number' ? fileId : parseInt(fileId, 10);
+ if (!isNaN(id)) {
+ that.groupForm.files = that.groupForm.files || [];
+ that.groupForm.files.push({ id: id, name: file.name || file.fileName || '' });
}
+ await that.getFileListData('file');
+ that.$nextTick(() => {
+ const row = that.fileList.find(i => i.id === id);
+ if (row) that.toggleSelection(that.groupForm.files.map(f => that.fileList.find(i => i.id === f.id)).filter(Boolean));
+ });
+ that.$notify({ title: '成功', message: '文件已上传至文件管理', type: 'success' });
+ } else {
+ that.$notify.error({ title: '失败', message: (res && res.errorMessage) || '上传失败,请重试' });
+ }
+ that.$nextTick(() => {
+ if (that.$refs.configUploadRef) that.$refs.configUploadRef.clearFiles();
+ });
},
- methods:
- {
- handleChange(value) {
- console.log(value);
- },
- handleRemove(file, fileList) {
- log(file, fileList, 2);
- },
- handlePictureCardPreview(file) {
- let that = this
- that.dialogImageUrl = file.url;
- that.dialogVisible = true;
- },
- uploadSuccess(res, file, fileList) {
- let that = this;
- // 上传成功
- that.fileList = fileList;
- //debugger
- if (res.stateCode == 0) {
- that.$notify({
- title: '成功',
- message: '恭喜你,上传成功',
- type: 'success'
- });
- // 清空文件列表(关键)
- that.$refs.uploadRef.clearFiles();
- } else {
- that.$notify.error({
- title: '失败',
- message: '上传失败,请重新上传'
- });
- }
- },
- uploadError() {
- let that = this;
- that.$notify.error({
- title: '失败',
- message: '上传失败,请重新上传'
- });
- },
- // 配置抽屉「新建文件」弹框:上传成功后将文件写入 FileManage,并加入当前已选列表、刷新文件列表并勾选新文件
- async configUploadSuccess(res, file, fileList) {
- const that = this;
- const ok = (res && (res.stateCode === 0 || res.success === true));
- const fileId = res && res.data != null ? res.data : null;
- if (ok && fileId != null) {
- const id = typeof fileId === 'number' ? fileId : parseInt(fileId, 10);
- if (!isNaN(id)) {
- that.groupForm.files = that.groupForm.files || [];
- that.groupForm.files.push({ id: id, name: file.name || file.fileName || '' });
- }
- await that.getFileListData('file');
- that.$nextTick(() => {
- const row = that.fileList.find(i => i.id === id);
- if (row) that.toggleSelection(that.groupForm.files.map(f => that.fileList.find(i => i.id === f.id)).filter(Boolean));
- });
- that.$notify({ title: '成功', message: '文件已上传至文件管理', type: 'success' });
- } else {
- that.$notify.error({ title: '失败', message: (res && res.errorMessage) || '上传失败,请重试' });
- }
- that.$nextTick(() => {
- if (that.$refs.configUploadRef) that.$refs.configUploadRef.clearFiles();
- });
- },
- configUploadError() {
- this.$notify.error({ title: '失败', message: '上传失败,请重新上传' });
- },
- handleDialogFileClose() {
- this.configUploadFileList = [];
- if (this.$refs.configUploadRef) this.$refs.configUploadRef.clearFiles();
- },
- async getEmbeddingModelList() {
- //debugger
- let that = this
- let param = {
- page: that.page.page,
- size: that.page.modelCount,
- }
- await axios.post('/api/Senparc.Xncf.AIKernel/AIModelAppService/Xncf.AIKernel_AIModelAppService.GetPagedListAsync', param)
- .then(res => {
- console.log(res)
- that.embeddingModelData = res.data.data.data;
- })
+ configUploadError() {
+ this.$notify.error({ title: '失败', message: '上传失败,请重新上传' });
+ },
+ handleDialogFileClose() {
+ this.configUploadFileList = [];
+ if (this.$refs.configUploadRef) this.$refs.configUploadRef.clearFiles();
+ },
+ async getEmbeddingModelList() {
+ //debugger
+ let that = this
+ let param = {
+ page: that.page.page,
+ size: that.page.modelCount,
+ }
+ await axios.post('/api/Senparc.Xncf.AIKernel/AIModelAppService/Xncf.AIKernel_AIModelAppService.GetPagedListAsync', param)
+ .then(res => {
+ console.log(res)
+ that.embeddingModelData = res.data.data.data;
+ })
- },
- async getVectorDBList() {
- let that = this
- let param = {
- page: that.page.page,
- size: that.page.modelCount,
- }
- await axios.post('/api/Senparc.Xncf.AIKernel/AIVectorAppService/Xncf.AIKernel_AIVectorAppService.GetPagedListAsync', param)
- .then(res => {
- console.log(res)
- that.vectorDBData = res.data.data.data;
- })
- },
- async getChatModelList() {
- let that = this
- let param = {
- page: that.page.page,
- size: that.page.modelCount,
- }
- await axios.post('/api/Senparc.Xncf.AIKernel/AIModelAppService/Xncf.AIKernel_AIModelAppService.GetPagedListAsync', param)
- .then(res => {
- console.log(res)
- that.chatModelData = res.data.data.data;
- })
- },
- // 获取 文件 数据(支持分页与筛选)
- async getFileListData(listType, page) {
- const that = this
- if (listType === 'file') {
- if (page != null) that.fileQueryList.pageIndex = page
- }
- const queryList = {}
+ },
+ async getVectorDBList() {
+ let that = this
+ let param = {
+ page: that.page.page,
+ size: that.page.modelCount,
+ }
+ await axios.post('/api/Senparc.Xncf.AIKernel/AIVectorAppService/Xncf.AIKernel_AIVectorAppService.GetPagedListAsync', param)
+ .then(res => {
+ console.log(res)
+ that.vectorDBData = res.data.data.data;
+ })
+ },
+ async getChatModelList() {
+ let that = this
+ let param = {
+ page: that.page.page,
+ size: that.page.modelCount,
+ }
+ await axios.post('/api/Senparc.Xncf.AIKernel/AIModelAppService/Xncf.AIKernel_AIModelAppService.GetPagedListAsync', param)
+ .then(res => {
+ console.log(res)
+ that.chatModelData = res.data.data.data;
+ })
+ },
+ // 获取 文件 数据(支持分页与筛选)
+ async getFileListData(listType, page) {
+ const that = this
+ if (listType === 'file') {
+ if (page != null) that.fileQueryList.pageIndex = page
+ }
+ const queryList = {}
+ if (listType === 'file') {
+ Object.assign(queryList, that.fileQueryList)
+ }
+ await axios.get(`/api/Senparc.Xncf.FileManager/FileTemplateAppService/Xncf.FileManager_FileTemplateAppService.GetList?${getInterfaceQueryStr(queryList)}`)
+ .then(res => {
+ const data = res?.data ?? {}
+ if (data.success) {
+ const payload = data?.data ?? {}
+ const fileData = payload.list ?? []
if (listType === 'file') {
- Object.assign(queryList, that.fileQueryList)
- }
- await axios.get(`/api/Senparc.Xncf.FileManager/FileTemplateAppService/Xncf.FileManager_FileTemplateAppService.GetList?${getInterfaceQueryStr(queryList)}`)
- .then(res => {
- const data = res?.data ?? {}
- if (data.success) {
- const payload = data?.data ?? {}
- const fileData = payload.list ?? []
- if (listType === 'file') {
- that.$set(that, 'fileList', fileData)
- that.fileListTotal = payload.totalCount ?? 0
- that.$nextTick(() => {
- if (that.visible.drawerGroup && that.groupForm.files.length > 0) {
- const filterList = fileData.filter(i => that.groupForm.files.some(item => item.id === i.id))
- that.toggleSelection(filterList)
- }
- })
- }
- } else {
- app.$message({ message: data.errorMessage || data.data || 'Error', type: 'error', duration: 5 * 1000 })
- }
- }).catch((err) => {
- console.log('err', err)
- })
- },
- // 配置页文件列表:页码变化(首页/上一页/下一页/尾页/跳转)
- handleConfigFilePageChange(page) {
- this.fileQueryList.pageIndex = page
- this.getFileListData('file')
- },
- // 配置页文件列表:每页条数变化
- handleConfigFileSizeChange(size) {
- this.fileQueryList.pageSize = size
- this.fileQueryList.pageIndex = 1
- this.getFileListData('file')
- },
- // 打开配置时:根据当前知识库拉取 KnowledgeBaseItem 关联项,回填文件选中或内容
- async loadConfigKnowledgeBaseItems(knowledgeBaseId) {
- const that = this
- if (!knowledgeBaseId) {
- that.getFileListData('file')
- return
- }
- const url = '/api/Senparc.Xncf.KnowledgeBase/KnowledgeBaseItemAppService/Xncf.KnowledgeBase_KnowledgeBaseItemAppService.GetListByKnowledgeBaseId'
- try {
- const res = await axios.get(`${url}?knowledgeBaseId=${knowledgeBaseId}`)
- const data = res?.data ?? {}
- const list = (data.success && data.data) ? (Array.isArray(data.data) ? data.data : []) : []
- if (list.length === 0) {
- that.getFileListData('file')
- return
+ that.$set(that, 'fileList', fileData)
+ that.fileListTotal = payload.totalCount ?? 0
+ that.$nextTick(() => {
+ if (that.visible.drawerGroup && that.groupForm.files.length > 0) {
+ const filterList = fileData.filter(i => that.groupForm.files.some(item => item.id === i.id))
+ that.toggleSelection(filterList)
}
- const hasFileType = list.some(i => i.contentType === 100 || i.contentType === 200 || i.contentType === 300 || i.contentType === 400)
- if (hasFileType) {
- const fileNames = [...new Set(list.filter(i => i.fileName).map(i => i.fileName))]
- that.groupForm.contentType = 2
- that.groupForm.files = []
- that.fileNamesToSelect = fileNames
- that.fileQueryList.pageSize = 9999
- that.fileQueryList.pageIndex = 1
- await that.getFileListData('file')
- that.$nextTick(() => {
- if (that.fileNamesToSelect.length && that.fileList.length) {
- const matched = that.fileList.filter(f => that.fileNamesToSelect.includes(f.fileName))
- that.groupForm.files = matched.map(f => ({ id: f.id, name: f.fileName }))
- that.toggleSelection(matched)
- }
- that.fileNamesToSelect = []
- that.fileQueryList.pageSize = 10
- that.getFileListData('file')
- })
- } else {
- that.groupForm.contentType = (list.length && list[0].contentType === 0) ? 1 : 1
- that.groupForm.content = list.map(i => i.content).filter(Boolean).join('\n\n') || ''
- that.groupForm.files = []
- that.getFileListData('file')
- }
- } catch (e) {
- console.error(e)
- that.getFileListData('file')
+ })
}
- },
- // 获取列表
- async getList() {
- let that = this
- //that.uid = resizeUrl().uid
- let { pageIndex, pageSize, keyword, orderField } = that.listQuery;
- if (orderField == '' || orderField == undefined) {
- orderField = 'AddTime Desc';
- }
- if (that.keyword != '' && that.keyword != undefined) {
- keyword = that.keyword;
+ } else {
+ app.$message({ message: data.errorMessage || data.data || 'Error', type: 'error', duration: 5 * 1000 })
+ }
+ }).catch((err) => {
+ console.log('err', err)
+ })
+ },
+ // 配置页文件列表:页码变化(首页/上一页/下一页/尾页/跳转)
+ handleConfigFilePageChange(page) {
+ this.fileQueryList.pageIndex = page
+ this.getFileListData('file')
+ },
+ // 配置页文件列表:每页条数变化
+ handleConfigFileSizeChange(size) {
+ this.fileQueryList.pageSize = size
+ this.fileQueryList.pageIndex = 1
+ this.getFileListData('file')
+ },
+ // 打开配置时:根据当前知识库拉取 KnowledgeBaseItem 关联项,回填文件选中或内容
+ async loadConfigKnowledgeBaseItems(knowledgeBaseId) {
+ const that = this
+ if (!knowledgeBaseId) {
+ that.getFileListData('file')
+ return
+ }
+ const url = '/api/Senparc.Xncf.KnowledgeBase/KnowledgeBaseItemAppService/Xncf.KnowledgeBase_KnowledgeBaseItemAppService.GetListByKnowledgeBaseId'
+ try {
+ const res = await axios.get(`${url}?knowledgeBaseId=${knowledgeBaseId}`)
+ const data = res?.data ?? {}
+ const list = (data.success && data.data) ? (Array.isArray(data.data) ? data.data : []) : []
+ if (list.length === 0) {
+ that.getFileListData('file')
+ return
+ }
+ const hasFileType = list.some(i => i.contentType === 100 || i.contentType === 200 || i.contentType === 300 || i.contentType === 400)
+ if (hasFileType) {
+ const fileNames = [...new Set(list.filter(i => i.fileName).map(i => i.fileName))]
+ that.groupForm.contentType = 2
+ that.groupForm.files = []
+ that.fileNamesToSelect = fileNames
+ that.fileQueryList.pageSize = 9999
+ that.fileQueryList.pageIndex = 1
+ await that.getFileListData('file')
+ that.$nextTick(() => {
+ if (that.fileNamesToSelect.length && that.fileList.length) {
+ const matched = that.fileList.filter(f => that.fileNamesToSelect.includes(f.fileName))
+ that.groupForm.files = matched.map(f => ({ id: f.id, name: f.fileName }))
+ that.toggleSelection(matched)
}
+ that.fileNamesToSelect = []
+ that.fileQueryList.pageSize = 10
+ that.getFileListData('file')
+ })
+ } else {
+ that.groupForm.contentType = (list.length && list[0].contentType === 0) ? 1 : 1
+ that.groupForm.content = list.map(i => i.content).filter(Boolean).join('\n\n') || ''
+ that.groupForm.files = []
+ that.getFileListData('file')
+ }
+ } catch (e) {
+ console.error(e)
+ that.getFileListData('file')
+ }
+ },
+ // 获取列表
+ async getList() {
+ let that = this
+ //that.uid = resizeUrl().uid
+ let { pageIndex, pageSize, keyword, orderField } = that.listQuery;
+ if (orderField == '' || orderField == undefined) {
+ orderField = 'AddTime Desc';
+ }
+ if (that.keyword != '' && that.keyword != undefined) {
+ keyword = that.keyword;
+ }
+ debugger
+ await service.get(`/Admin/KnowledgeBase/Index?handler=KnowledgeBases&pageIndex=${pageIndex}&pageSize=${pageSize}&keyword=${keyword}&orderField=${orderField}`).then(res => {// 使用 map 转换为目标格式的对象数组
+ that.filterTableHeader.embeddingModelId = res.data.data.list.map(z => ({
+ text: z.embeddingModelId,
+ value: z.embeddingModelId
+ }));
+ that.filterTableHeader.vectorDBId = res.data.data.list.map(z => ({
+ text: z.vectorDBId,
+ value: z.vectorDBId
+ }));
+ that.filterTableHeader.chatModelId = res.data.data.list.map(z => ({
+ text: z.chatModelId,
+ value: z.chatModelId
+ }));
+ that.filterTableHeader.name = res.data.data.list.map(z => ({
+ text: z.name,
+ value: z.name
+ }));
+ that.filterTableHeader.content = res.data.data.list.map(z => ({
+ text: z.content,
+ value: z.content
+ }));
- await service.get(`/Admin/KnowledgeBase/Index?handler=KnowledgeBases&pageIndex=${pageIndex}&pageSize=${pageSize}&keyword=${keyword}&orderField=${orderField}`).then(res => {// 使用 map 转换为目标格式的对象数组
- that.filterTableHeader.embeddingModelId = res.data.data.list.map(z => ({
- text: z.embeddingModelId,
- value: z.embeddingModelId
- }));
- that.filterTableHeader.vectorDBId = res.data.data.list.map(z => ({
- text: z.vectorDBId,
- value: z.vectorDBId
- }));
- that.filterTableHeader.chatModelId = res.data.data.list.map(z => ({
- text: z.chatModelId,
- value: z.chatModelId
- }));
- that.filterTableHeader.name = res.data.data.list.map(z => ({
- text: z.name,
- value: z.name
- }));
- that.filterTableHeader.content = res.data.data.list.map(z => ({
- text: z.content,
- value: z.content
- }));
-
- that.tableData = res.data.data.list;
- that.paginationQuery.total = res.data.data.totalCount;
- });
- },
- async getCategoryList() {
- let that = this
- //获取分类列表数据
- await service.get('/Admin/KnowledgeBase/Index?handler=KnowledgeBasesCategory').then(res => {
- that.categoryData = res.data.data.list;
- log('categoryData', res, 2);
- });
- },
- // 编辑 // 新增知识库管理(文件在配置中上传,此处不再使用文件列表)
- handleEdit(index, row, flag) {
- let that = this;
- that.dialog.visible = false;
- that.$nextTick(() => {
- that.dialog.visible = true;
- });
+ that.tableData = res.data.data.list;
+ that.paginationQuery.total = res.data.data.totalCount;
+ });
+ },
+ async getCategoryList() {
+ let that = this
+ //获取分类列表数据
+ await service.get('/Admin/KnowledgeBase/Index?handler=KnowledgeBasesCategory').then(res => {
+ that.categoryData = res.data.data.list;
+ log('categoryData', res, 2);
+ });
+ },
+ // 编辑 // 新增知识库管理(文件在配置中上传,此处不再使用文件列表)
+ handleEdit(index, row, flag) {
+ let that = this;
+ that.dialog.visible = false;
+ that.$nextTick(() => {
+ that.dialog.visible = true;
+ });
- if (flag === 'add') {
- // 新增 - 初始化空数据
- that.dialog.title = '新增知识库管理';
- that.dialog.data = {
- id: 0,
- embeddingModelId: 0,
- vectorDBId: 0,
- chatModelId: 0,
- name: '',
- content: ''
- };
- that.selectDefaultEmbeddingModel = [];
- that.selectDefaultVectorDB = [];
- that.selectDefaultChatModel = [];
- that.dialogImageUrl = '';
- return;
- }
+ if (flag === 'add') {
+ // 新增 - 初始化空数据
+ that.dialog.title = '新增知识库管理';
+ that.dialog.data = {
+ id: 0,
+ embeddingModelId: 0,
+ vectorDBId: 0,
+ chatModelId: 0,
+ name: '',
+ content: ''
+ };
+ that.selectDefaultEmbeddingModel = [];
+ that.selectDefaultVectorDB = [];
+ that.selectDefaultChatModel = [];
+ that.dialogImageUrl = '';
+ return;
+ }
- // 编辑 - 使用现有数据
- let { id, embeddingModelId, vectorDBId, chatModelId, name, content } = row;
- that.dialog.data = {
- id: id || 0,
- embeddingModelId: embeddingModelId || 0,
- vectorDBId: vectorDBId || 0,
- chatModelId: chatModelId || 0,
- name: name || '',
- content: content || ''
- };
+ // 编辑 - 使用现有数据
+ let { id, embeddingModelId, vectorDBId, chatModelId, name, content } = row;
+ that.dialog.data = {
+ id: id || 0,
+ embeddingModelId: embeddingModelId || 0,
+ vectorDBId: vectorDBId || 0,
+ chatModelId: chatModelId || 0,
+ name: name || '',
+ content: content || ''
+ };
- // 设置下拉框默认值
- if (that.dialog.data.embeddingModelId) {
- that.selectDefaultEmbeddingModel = [parseInt(that.dialog.data.embeddingModelId)];
- }
- if (that.dialog.data.vectorDBId) {
- that.selectDefaultVectorDB = [parseInt(that.dialog.data.vectorDBId)];
- }
- if (that.dialog.data.chatModelId) {
- that.selectDefaultChatModel = [parseInt(that.dialog.data.chatModelId)];
- }
+ // 设置下拉框默认值
+ if (that.dialog.data.embeddingModelId) {
+ that.selectDefaultEmbeddingModel = [parseInt(that.dialog.data.embeddingModelId)];
+ }
+ if (that.dialog.data.vectorDBId) {
+ that.selectDefaultVectorDB = [parseInt(that.dialog.data.vectorDBId)];
+ }
+ if (that.dialog.data.chatModelId) {
+ that.selectDefaultChatModel = [parseInt(that.dialog.data.chatModelId)];
+ }
- if (flag === 'edit') {
- that.dialog.title = '编辑知识库管理';
- }
- },
- // 设置父级菜单默认显示 递归
- recursionFunc(row, source, dest) {
- if (row.chatModelId === null) {
- return;
- }
- for (let i in source) {
- let ele = source[i];
- if (row.chatModelId === ele.id) {
- this.recursionFunc(ele, this.chatModelData, dest);
- dest.push(ele.id);
- }
- else {
- this.recursionFunc(row, ele.children, dest);
- }
- }
- },
- // 保存 submitForm 数据(配置抽屉确认:内容类型为文件时导入选中文件,否则不校验文件)
- async saveSubmitFormData(saveType, serviceForm = {}) {
- const that = this;
- if (saveType === 'drawerGroup') {
- const contentType = serviceForm.contentType;
- const isFileType = contentType === 2; // 2=文件
+ if (flag === 'edit') {
+ that.dialog.title = '编辑知识库管理';
+ }
+ },
+ // 设置父级菜单默认显示 递归
+ recursionFunc(row, source, dest) {
+ if (row.chatModelId === null) {
+ return;
+ }
+ for (let i in source) {
+ let ele = source[i];
+ if (row.chatModelId === ele.id) {
+ this.recursionFunc(ele, this.chatModelData, dest);
+ dest.push(ele.id);
+ }
+ else {
+ this.recursionFunc(row, ele.children, dest);
+ }
+ }
+ },
+ // 保存 submitForm 数据(配置抽屉确认:内容类型为文件时导入选中文件,否则不校验文件)
+ async saveSubmitFormData(saveType, serviceForm = {}) {
+ const that = this;
+ if (saveType === 'drawerGroup') {
+ const contentType = serviceForm.contentType;
+ const isFileType = contentType === 2; // 2=文件
- if (isFileType) {
- const serviceURL = '/api/Senparc.Xncf.KnowledgeBase/KnowledgeBaseAppService/Xncf.KnowledgeBase_KnowledgeBaseAppService.ImportFilesToKnowledgeBase';
- const selectedFiles = serviceForm.files || [];
- const fileIds = selectedFiles.map(f => (typeof f.id === 'number' ? f.id : parseInt(f.id, 10))).filter(id => !isNaN(id));
+ if (isFileType) {
+ const serviceURL = '/api/Senparc.Xncf.KnowledgeBase/KnowledgeBaseAppService/Xncf.KnowledgeBase_KnowledgeBaseAppService.ImportFilesToKnowledgeBase';
+ const selectedFiles = serviceForm.files || [];
+ const fileIds = selectedFiles.map(f => (typeof f.id === 'number' ? f.id : parseInt(f.id, 10))).filter(id => !isNaN(id));
- if (fileIds.length === 0) {
- that.$notify({ title: '提示', message: '请至少选择一个文件后再保存', type: 'warning', duration: 2000 });
- return;
- }
+ if (fileIds.length === 0) {
+ that.$notify({ title: '提示', message: '请至少选择一个文件后再保存', type: 'warning', duration: 2000 });
+ return;
+ }
- const requestData = {
- knowledgeBaseId: parseInt(serviceForm.knowledgeBasesId, 10),
- fileIds: fileIds
- };
+ const requestData = {
+ knowledgeBaseId: parseInt(serviceForm.knowledgeBasesId, 10),
+ fileIds: fileIds
+ };
- try {
- const res = await service.post(serviceURL, requestData);
- const success = res && (res.data === true || (res.data && (res.data.success === true || res.data.data === true)));
- if (success) {
- that.$notify({ title: '成功', message: '文件已关联到知识库并写入条目', type: 'success', duration: 2000 });
- that.visible.drawerGroup = false;
- that.getList();
- } else {
- that.$notify({ title: '失败', message: (res && res.message) || (res && res.data && res.data.errorMessage) || '文件导入失败', type: 'error', duration: 3000 });
- }
- } catch (err) {
- console.error('Request Error:', err);
- that.$notify({ title: '错误', message: '文件导入失败: ' + (err.message || err), type: 'error', duration: 3000 });
- }
- } else {
- // 内容类型为「输入」或「采集外部数据」时,不校验文件,直接关闭
- that.$notify({ title: '成功', message: '已保存', type: 'success', duration: 2000 });
- that.visible.drawerGroup = false;
- }
- }
- },
- selectEmbeddingModel() {
- let that = this
- for (let i = 0; i < that.embeddingModelData.length; i++) {
- if (that.selectDefaultEmbeddingModel[0] == that.embeddingModelData[i].id) {
- that.dialog.data.embeddingModelId = that.embeddingModelData[i].id;
- //that.dialog.data.columnName = that.devicesData[i].name;
- }
- }
- },
- selectVectorDB() {
- let that = this
- for (let i = 0; i < that.vectorDBData.length; i++) {
- if (that.selectDefaultVectorDB[0] == that.vectorDBData[i].id) {
- that.dialog.data.vectorDBId = that.vectorDBData[i].id;
- //that.dialog.data.columnName = that.devicesData[i].name;
- }
+ try {
+ const res = await service.post(serviceURL, requestData);
+ const success = res && (res.data === true || (res.data && (res.data.success === true || res.data.data === true)));
+ if (success) {
+ that.$notify({ title: '成功', message: '文件已关联到知识库并写入条目', type: 'success', duration: 2000 });
+ that.visible.drawerGroup = false;
+ that.getList();
+ } else {
+ that.$notify({ title: '失败', message: (res && res.message) || (res && res.data && res.data.errorMessage) || '文件导入失败', type: 'error', duration: 3000 });
}
- },
- selectChatModel() {
- let that = this
- for (let i = 0; i < that.chatModelData.length; i++) {
- if (that.selectDefaultChatModel[0] == that.chatModelData[i].id) {
- that.dialog.data.chatModelId = that.chatModelData[i].id;
- //that.dialog.data.columnName = that.devicesData[i].name;
- }
+ } catch (err) {
+ console.error('Request Error:', err);
+ that.$notify({ title: '错误', message: '文件导入失败: ' + (err.message || err), type: 'error', duration: 3000 });
+ }
+ } else {
+ // 内容类型为「输入」或「采集外部数据」时,不校验文件,直接关闭
+ that.$notify({ title: '成功', message: '已保存', type: 'success', duration: 2000 });
+ that.visible.drawerGroup = false;
+ }
+ }
+ },
+ selectEmbeddingModel() {
+ let that = this
+ for (let i = 0; i < that.embeddingModelData.length; i++) {
+ if (that.selectDefaultEmbeddingModel[0] == that.embeddingModelData[i].id) {
+ that.dialog.data.embeddingModelId = that.embeddingModelData[i].id;
+ //that.dialog.data.columnName = that.devicesData[i].name;
+ }
+ }
+ },
+ selectVectorDB() {
+ let that = this
+ for (let i = 0; i < that.vectorDBData.length; i++) {
+ if (that.selectDefaultVectorDB[0] == that.vectorDBData[i].id) {
+ that.dialog.data.vectorDBId = that.vectorDBData[i].id;
+ //that.dialog.data.columnName = that.devicesData[i].name;
+ }
+ }
+ },
+ selectChatModel() {
+ let that = this
+ for (let i = 0; i < that.chatModelData.length; i++) {
+ if (that.selectDefaultChatModel[0] == that.chatModelData[i].id) {
+ that.dialog.data.chatModelId = that.chatModelData[i].id;
+ //that.dialog.data.columnName = that.devicesData[i].name;
+ }
+ }
+ },
+ // 更新新增、编辑(文件改为在「配置」中上传并关联,此处不再传文件)
+ updateData() {
+ let that = this;
+ that.dialog.updateLoading = true;
+ that.$refs['dataForm'].validate(valid => {
+ if (valid) {
+ let data = {
+ id: that.dialog.data.id || 0,
+ embeddingModelId: parseInt(that.dialog.data.embeddingModelId) || 0,
+ vectorDBId: parseInt(that.dialog.data.vectorDBId) || 0,
+ chatModelId: parseInt(that.dialog.data.chatModelId) || 0,
+ name: that.dialog.data.name,
+ content: that.dialog.data.content || '',
+ NcfFileIds: []
+ };
+ console.log('保存知识库数据:' + JSON.stringify(data));
+ service.post("/Admin/KnowledgeBase/Edit?handler=Save", data).then(res => {
+ console.log('保存响应:', res);
+ debugger
+ // res.data 是后端返回的对象:{success: true, data: true, msg: "保存成功"}
+ if (res.data && res.data.data.success && res.data.data.data === true) {
+ that.getList();
+ that.$notify({
+ title: "成功",
+ message: res.data.msg || "知识库保存成功",
+ type: "success",
+ duration: 2000
+ });
+ that.dialog.visible = false;
+ that.dialog.updateLoading = false;
+ } else {
+ that.$notify({
+ title: "失败",
+ message: (res.data && res.data.msg) || "保存失败,请检查数据",
+ type: "error",
+ duration: 3000
+ });
+ that.dialog.updateLoading = false;
}
- },
- // 更新新增、编辑(文件改为在「配置」中上传并关联,此处不再传文件)
- updateData() {
- let that = this;
- that.dialog.updateLoading = true;
- that.$refs['dataForm'].validate(valid => {
- if (valid) {
- let data = {
- id: that.dialog.data.id || 0,
- embeddingModelId: parseInt(that.dialog.data.embeddingModelId) || 0,
- vectorDBId: parseInt(that.dialog.data.vectorDBId) || 0,
- chatModelId: parseInt(that.dialog.data.chatModelId) || 0,
- name: that.dialog.data.name,
- content: that.dialog.data.content || '',
- NcfFileIds: []
- };
- console.log('保存知识库数据:' + JSON.stringify(data));
- service.post("/Admin/KnowledgeBase/Edit?handler=Save", data).then(res => {
- console.log('保存响应:', res);
- debugger
- // res.data 是后端返回的对象:{success: true, data: true, msg: "保存成功"}
- if (res.data && res.data.data.success && res.data.data.data === true) {
- that.getList();
- that.$notify({
- title: "成功",
- message: res.data.msg || "知识库保存成功",
- type: "success",
- duration: 2000
- });
- that.dialog.visible = false;
- that.dialog.updateLoading = false;
- } else {
- that.$notify({
- title: "失败",
- message: (res.data && res.data.msg) || "保存失败,请检查数据",
- type: "error",
- duration: 3000
- });
- that.dialog.updateLoading = false;
- }
- }).catch(err => {
- console.error('保存错误:', err);
- that.$notify({
- title: "错误",
- message: "保存出错:" + (err.message || err),
- type: "error",
- duration: 3000
- });
- that.dialog.updateLoading = false;
- });
- }
+ }).catch(err => {
+ console.error('保存错误:', err);
+ that.$notify({
+ title: "错误",
+ message: "保存出错:" + (err.message || err),
+ type: "error",
+ duration: 3000
});
- },
- // 删除
- handleDelete(index, row) {
- let that = this
- let ids = [row.id];
- service.post("/Admin/KnowledgeBase/edit?handler=Delete", ids).then(res => {
- if (res.data.success) {
- that.getList();
- that.$notify({
- title: "Success",
- message: "删除成功",
- type: "success",
- duration: 2000
- });
- }
- });
- },
- handleSelectionChange(val) {
- let that = this
- that.multipleSelection = val;
- console.log(`that.multipleSelection----${JSON.stringify(that.multipleSelection)}`);
- if (that.multipleSelection.length == 1) {
- //that.newsId = that.multipleSelection[0].id;
- //that.dialogVote.data.newsId = that.multipleSelection[0].id;
- //console.log(`that.newsId----${that.newsId}`);
- }
- },
- // 配置抽屉内「文件列表」表格勾选变化:同步到 groupForm.files,保存时用于关联知识库
- handleConfigFileSelectionChange(val) {
- this.groupForm.files = (val || []).map(r => ({
- id: r.id,
- name: r.fileName != null ? r.fileName : (r.name || '')
- }));
- },
- handleDbClick(row, column, event) {
- let that = this
- //that.multipleSelection = val;
- console.log(`row----${JSON.stringify(row)}`);
- console.log(`column----${JSON.stringify(column)}`);
- console.log(`event----${JSON.stringify(event)}`);
- //if (that.multipleSelection.length == 1) {
- // //that.newsId = that.multipleSelection[0].id;
- // //that.dialogVote.data.newsId = that.multipleSelection[0].id;
- // //console.log(`that.newsId----${that.newsId}`);
- //}
- that.detailDialog.visible = true;
- },
- // 筛选输入变化
- handleFilterChange(value, filterType) {
- console.log('handleFilterChange', filterType, value)
- if (filterType === 'groupAgent') {
- this.groupAgentQueryList.filter = value
- this.getAgentListData('groupAgent', 1)
- }
- },
- // 配置页文件列表:按文件名称搜索(调用接口过滤,并回到第一页)
- handleConfigFileSearch() {
- this.fileQueryList.pageIndex = 1
- this.getFileListData('file')
- },
- // 配置页文件列表:删除文件(删除数据库与物理文件,并刷新列表与已选)
- handleConfigFileDelete(row) {
- const that = this
- that.$confirm(`确认删除文件「${row.fileName || row.name}」吗?删除后数据库与物理文件均会移除。`, '删除确认', {
- confirmButtonText: '确定',
- cancelButtonText: '取消',
- type: 'warning'
- }).then(() => {
- that.doDeleteFileById(row.id).then(ok => {
- if (ok) {
- that.groupForm.files = (that.groupForm.files || []).filter(f => f.id !== row.id)
- that.getFileListData('file')
- }
- })
- }).catch(() => {})
- },
- // 配置页文件列表:批量删除(删除当前选中的多行,并同步数据库与物理文件)
- handleConfigFileBatchDelete() {
- const that = this
- const selected = (that.groupForm.files || []).slice()
- if (selected.length === 0) {
- that.$message.warning('请先勾选需要删除的文件')
- return
- }
- that.$confirm(`确认删除已选中的 ${selected.length} 个文件吗?删除后数据库与物理文件均会移除。`, '批量删除确认', {
- confirmButtonText: '确定',
- cancelButtonText: '取消',
- type: 'warning'
- }).then(() => {
- const deleteUrl = '/api/Senparc.Xncf.FileManager/FileTemplateAppService/Xncf.FileManager_FileTemplateAppService.DeleteFile'
- const promises = selected.map(f => service.post(deleteUrl, { id: f.id }).then(res => {
- const ok = res && (res.data === true || (res.data && (res.data.success === true || res.data.data === true)))
- return !!ok
- }).catch(() => false))
- Promise.all(promises).then(results => {
- const successCount = results.filter(Boolean).length
- that.groupForm.files = []
- that.getFileListData('file')
- that.$notify({
- title: successCount === selected.length ? '成功' : '部分完成',
- message: `已删除 ${successCount}/${selected.length} 个文件`,
- type: successCount === selected.length ? 'success' : 'warning'
- })
- })
- }).catch(() => {})
- },
- doDeleteFileById(id) {
- const url = '/api/Senparc.Xncf.FileManager/FileTemplateAppService/Xncf.FileManager_FileTemplateAppService.DeleteFile'
- return service.post(url, { id: id }).then(res => {
- const ok = res && (res.data === true || (res.data && (res.data.success === true || res.data.data === true)))
- if (ok) this.$notify({ title: '成功', message: '文件已删除', type: 'success' })
- else this.$notify({ title: '失败', message: (res && res.data && res.data.errorMessage) || '删除失败', type: 'error' })
- return ok
- }).catch(err => {
- this.$notify({ title: '错误', message: '删除失败: ' + (err.message || err), type: 'error' })
- return false
- })
- },
- getCurrentRow(row) {
- let that = this
- //获取选中数据
- //that.templateSelection = row;
- that.multipleSelection = row;
- log('multipleSelection', row, 2)
- //that.newsId = that.multipleSelection.id;
- //that.dialogVote.data.newsId = that.multipleSelection.id;
- },
- filterTag(value, row) {
- return row.tag === value;
- },
- filterHandler(value, row, column) {
- const property = column['property'];
- return row[property] === value;
- },
- handleSearch() {
- let that = this
- that.getList();
- },
- resetCondition() {
- let that = this
- that.keyword = '';
- },
- setRecommendFormat(row, column, cellValue, index) {
- if (cellValue) {
- return "Y";
- }
- return "N";
- },
- setBodyFormat(row, column, cellValue, index) {
- if (cellValue == undefined) {
- return '-';
- }
- else {
- return cellValue.substring(0, 16);
- }
- },
-
- setContentFormat(row, column, cellValue, index) {
- if (cellValue == undefined) {
- return '-';
- }
- else {
- return cellValue.replace(/<[^>]+>/gim, '').replace(/\[(\w+)[^\]]*](.*?)\[\/\1]/g, '$2 ').substring(0, 16);
- }
- },
- handleClick() {
+ that.dialog.updateLoading = false;
+ });
+ }
+ });
+ },
+ // 删除
+ handleDelete(index, row) {
+ let that = this
+ let ids = [row.id];
+ service.post("/Admin/KnowledgeBase/edit?handler=Delete", ids).then(res => {
+ if (res.data.success) {
+ that.getList();
+ that.$notify({
+ title: "Success",
+ message: "删除成功",
+ type: "success",
+ duration: 2000
+ });
+ }
+ });
+ },
+ handleSelectionChange(val) {
+ let that = this
+ that.multipleSelection = val;
+ console.log(`that.multipleSelection----${JSON.stringify(that.multipleSelection)}`);
+ if (that.multipleSelection.length == 1) {
+ //that.newsId = that.multipleSelection[0].id;
+ //that.dialogVote.data.newsId = that.multipleSelection[0].id;
+ //console.log(`that.newsId----${that.newsId}`);
+ }
+ },
+ // 配置抽屉内「文件列表」表格勾选变化:同步到 groupForm.files,保存时用于关联知识库
+ handleConfigFileSelectionChange(val) {
+ this.groupForm.files = (val || []).map(r => ({
+ id: r.id,
+ name: r.fileName != null ? r.fileName : (r.name || '')
+ }));
+ },
+ handleDbClick(row, column, event) {
+ let that = this
+ //that.multipleSelection = val;
+ console.log(`row----${JSON.stringify(row)}`);
+ console.log(`column----${JSON.stringify(column)}`);
+ console.log(`event----${JSON.stringify(event)}`);
+ //if (that.multipleSelection.length == 1) {
+ // //that.newsId = that.multipleSelection[0].id;
+ // //that.dialogVote.data.newsId = that.multipleSelection[0].id;
+ // //console.log(`that.newsId----${that.newsId}`);
+ //}
+ that.detailDialog.visible = true;
+ },
+ // 筛选输入变化
+ handleFilterChange(value, filterType) {
+ console.log('handleFilterChange', filterType, value)
+ if (filterType === 'groupAgent') {
+ this.groupAgentQueryList.filter = value
+ this.getAgentListData('groupAgent', 1)
+ }
+ },
+ // 配置页文件列表:按文件名称搜索(调用接口过滤,并回到第一页)
+ handleConfigFileSearch() {
+ this.fileQueryList.pageIndex = 1
+ this.getFileListData('file')
+ },
+ // 配置页文件列表:删除文件(删除数据库与物理文件,并刷新列表与已选)
+ handleConfigFileDelete(row) {
+ const that = this
+ that.$confirm(`确认删除文件「${row.fileName || row.name}」吗?删除后数据库与物理文件均会移除。`, '删除确认', {
+ confirmButtonText: '确定',
+ cancelButtonText: '取消',
+ type: 'warning'
+ }).then(() => {
+ that.doDeleteFileById(row.id).then(ok => {
+ if (ok) {
+ that.groupForm.files = (that.groupForm.files || []).filter(f => f.id !== row.id)
+ that.getFileListData('file')
+ }
+ })
+ }).catch(() => { })
+ },
+ // 配置页文件列表:批量删除(删除当前选中的多行,并同步数据库与物理文件)
+ handleConfigFileBatchDelete() {
+ const that = this
+ const selected = (that.groupForm.files || []).slice()
+ if (selected.length === 0) {
+ that.$message.warning('请先勾选需要删除的文件')
+ return
+ }
+ that.$confirm(`确认删除已选中的 ${selected.length} 个文件吗?删除后数据库与物理文件均会移除。`, '批量删除确认', {
+ confirmButtonText: '确定',
+ cancelButtonText: '取消',
+ type: 'warning'
+ }).then(() => {
+ const deleteUrl = '/api/Senparc.Xncf.FileManager/FileTemplateAppService/Xncf.FileManager_FileTemplateAppService.DeleteFile'
+ const promises = selected.map(f => service.post(deleteUrl, { id: f.id }).then(res => {
+ const ok = res && (res.data === true || (res.data && (res.data.success === true || res.data.data === true)))
+ return !!ok
+ }).catch(() => false))
+ Promise.all(promises).then(results => {
+ const successCount = results.filter(Boolean).length
+ that.groupForm.files = []
+ that.getFileListData('file')
+ that.$notify({
+ title: successCount === selected.length ? '成功' : '部分完成',
+ message: `已删除 ${successCount}/${selected.length} 个文件`,
+ type: successCount === selected.length ? 'success' : 'warning'
+ })
+ })
+ }).catch(() => { })
+ },
+ doDeleteFileById(id) {
+ const url = '/api/Senparc.Xncf.FileManager/FileTemplateAppService/Xncf.FileManager_FileTemplateAppService.DeleteFile'
+ return service.post(url, { id: id }).then(res => {
+ const ok = res && (res.data === true || (res.data && (res.data.success === true || res.data.data === true)))
+ if (ok) this.$notify({ title: '成功', message: '文件已删除', type: 'success' })
+ else this.$notify({ title: '失败', message: (res && res.data && res.data.errorMessage) || '删除失败', type: 'error' })
+ return ok
+ }).catch(err => {
+ this.$notify({ title: '错误', message: '删除失败: ' + (err.message || err), type: 'error' })
+ return false
+ })
+ },
+ getCurrentRow(row) {
+ let that = this
+ //获取选中数据
+ //that.templateSelection = row;
+ that.multipleSelection = row;
+ log('multipleSelection', row, 2)
+ //that.newsId = that.multipleSelection.id;
+ //that.dialogVote.data.newsId = that.multipleSelection.id;
+ },
+ filterTag(value, row) {
+ return row.tag === value;
+ },
+ filterHandler(value, row, column) {
+ const property = column['property'];
+ return row[property] === value;
+ },
+ handleSearch() {
+ let that = this;
+ that.listQuery.keyword = that.keyword || '';
+ that.listQuery.pageIndex = 1;
+ that.getList();
+ },
+ resetCondition() {
+ let that = this;
+ that.keyword = '';
+ that.listQuery.keyword = '';
+ that.listQuery.pageIndex = 1;
+ that.getList();
+ },
+ handlePageSizeChange(val) {
+ this.listQuery.pageSize = val;
+ this.listQuery.pageIndex = 1;
+ this.getList();
+ },
+ handlePageChange(val) {
+ this.listQuery.pageIndex = val;
+ this.getList();
+ },
+ setRecommendFormat(row, column, cellValue, index) {
+ if (cellValue) {
+ return "Y";
+ }
+ return "N";
+ },
+ setBodyFormat(row, column, cellValue, index) {
+ if (cellValue == undefined) {
+ return '-';
+ }
+ else {
+ return cellValue.substring(0, 16);
+ }
+ },
- },
- onSubmit() {
- console.log('submit!');
- },
- handleEmbeddingBtn(btnType, item) {
- const that = this;
- if (btnType === 'embedding') {
- this.$confirm(`确认对知识库 "${item.name}" 进行向量化处理吗?`, '向量化确认', {
- confirmButtonText: '确定',
- cancelButtonText: '取消',
- type: 'warning'
- }).then(() => {
- that.embeddingProgressPercent = 0;
- that.embeddingProgressStatus = '';
- that.embeddingProgressText = '正在准备...';
- that.visible.embeddingProgress = true;
+ setContentFormat(row, column, cellValue, index) {
+ if (cellValue == undefined) {
+ return '-';
+ }
+ else {
+ return cellValue.replace(/<[^>]+>/gim, '').replace(/\[(\w+)[^\]]*](.*?)\[\/\1]/g, '$2 ').substring(0, 16);
+ }
+ },
+ handleClick() {
- var progressVal = 0;
- that._embeddingTimer = setInterval(function () {
- progressVal += Math.random() * 8 + 4;
- if (progressVal > 90) progressVal = 90;
- that.embeddingProgressPercent = Math.floor(progressVal);
- that.embeddingProgressText = '正在向量化处理中... ' + that.embeddingProgressPercent + '%';
- }, 400);
+ },
+ onSubmit() {
+ console.log('submit!');
+ },
+ handleEmbeddingBtn(btnType, item) {
+ const that = this;
+ if (btnType === 'embedding') {
+ this.$confirm(`确认对知识库 "${item.name}" 进行向量化处理吗?`, '向量化确认', {
+ confirmButtonText: '确定',
+ cancelButtonText: '取消',
+ type: 'warning'
+ }).then(() => {
+ that.embeddingProgressPercent = 0;
+ that.embeddingProgressStatus = '';
+ that.embeddingProgressText = '正在准备...';
+ that.visible.embeddingProgress = true;
- const serviceURL = '/api/Senparc.Xncf.KnowledgeBase/KnowledgeBaseAppService/Xncf.KnowledgeBase_KnowledgeBaseAppService.EmbeddingKnowledgeBase';
- const dataTemp = { id: item?.id ?? '' };
+ var progressVal = 0;
+ that._embeddingTimer = setInterval(function () {
+ progressVal += Math.random() * 8 + 4;
+ if (progressVal > 90) progressVal = 90;
+ that.embeddingProgressPercent = Math.floor(progressVal);
+ that.embeddingProgressText = '正在向量化处理中... ' + that.embeddingProgressPercent + '%';
+ }, 400);
- service.post(serviceURL, dataTemp).then(res => {
- if (that._embeddingTimer) {
- clearInterval(that._embeddingTimer);
- that._embeddingTimer = null;
- }
- that.embeddingProgressPercent = 100;
- that.embeddingProgressStatus = 'success';
- that.embeddingProgressText = '向量化完成';
+ const serviceURL = '/api/Senparc.Xncf.KnowledgeBase/KnowledgeBaseAppService/Xncf.KnowledgeBase_KnowledgeBaseAppService.EmbeddingKnowledgeBase';
+ const dataTemp = { id: item?.id ?? '' };
- var body = res && res.data;
- var success = body && (body.success === true);
- var resultMessage = (body && body.data != null) ? (typeof body.data === 'string' ? body.data : (body.data.data != null ? body.data.data : '')) : '';
- if (success && resultMessage) {
- setTimeout(function () {
- that.visible.embeddingProgress = false;
- that.embeddingResultText = resultMessage;
- that.visible.embeddingResult = true;
- }, 400);
- } else if (success) {
- setTimeout(function () {
- that.visible.embeddingProgress = false;
- that.embeddingResultText = '知识库「' + (item.name || '') + '」向量化已完成。';
- that.visible.embeddingResult = true;
- }, 400);
- } else {
- that.embeddingProgressStatus = 'exception';
- that.embeddingProgressText = (res && res.errorMessage) || (res && res.message) || '向量化失败';
- setTimeout(function () {
- that.visible.embeddingProgress = false;
- that.$notify({ title: '向量化失败', message: that.embeddingProgressText, type: 'error', duration: 5000 });
- }, 800);
- }
- }).catch(err => {
- if (that._embeddingTimer) {
- clearInterval(that._embeddingTimer);
- that._embeddingTimer = null;
- }
- that.embeddingProgressStatus = 'exception';
- that.embeddingProgressPercent = Math.max(that.embeddingProgressPercent, 50);
- that.embeddingProgressText = '处理出错:' + (err.message || err);
- setTimeout(function () {
- that.visible.embeddingProgress = false;
- that.$notify({
- title: '错误',
- message: err.message || '向量化处理出错,请检查配置',
- type: 'error',
- duration: 5000
- });
- }, 800);
- });
- }).catch(function () {});
+ service.post(serviceURL, dataTemp).then(res => {
+ if (that._embeddingTimer) {
+ clearInterval(that._embeddingTimer);
+ that._embeddingTimer = null;
}
- },
- // Dailog|抽屉 打开 按钮
- handleElVisibleOpenBtn(btnType, item) {
- const that = this
- let visibleKey = btnType
- if (btnType === 'drawerGroup') {
- visibleKey = 'drawerGroup'
- that.groupForm.knowledgeBasesId = item?.id ?? ''
- that.fileQueryList.pageIndex = 1
- that.fileNamesToSelect = []
- that.visible[visibleKey] = true
- that.loadConfigKnowledgeBaseItems(item?.id)
- return
+ that.embeddingProgressPercent = 100;
+ that.embeddingProgressStatus = 'success';
+ that.embeddingProgressText = '向量化完成';
+
+ var body = res && res.data;
+ var success = body && (body.success === true);
+ var resultMessage = (body && body.data != null) ? (typeof body.data === 'string' ? body.data : (body.data.data != null ? body.data.data : '')) : '';
+ if (success && resultMessage) {
+ setTimeout(function () {
+ that.visible.embeddingProgress = false;
+ that.embeddingResultText = resultMessage;
+ that.visible.embeddingResult = true;
+ }, 400);
+ } else if (success) {
+ setTimeout(function () {
+ that.visible.embeddingProgress = false;
+ that.embeddingResultText = '知识库「' + (item.name || '') + '」向量化已完成。';
+ that.visible.embeddingResult = true;
+ }, 400);
+ } else {
+ that.embeddingProgressStatus = 'exception';
+ that.embeddingProgressText = (res && res.errorMessage) || (res && res.message) || '向量化失败';
+ setTimeout(function () {
+ that.visible.embeddingProgress = false;
+ that.$notify({ title: '向量化失败', message: that.embeddingProgressText, type: 'error', duration: 5000 });
+ }, 800);
}
- if (btnType === 'dialogFile') {
- visibleKey = 'dialogFile'
+ }).catch(err => {
+ if (that._embeddingTimer) {
+ clearInterval(that._embeddingTimer);
+ that._embeddingTimer = null;
}
- this.visible[visibleKey] = true
- },
- // Dailog|抽屉 关闭 按钮
- handleElVisibleClose(btnType) {
- // drawerAgent dialogGroupAgent drawerGroup drawerGroupStart
- this.$confirm('确认关闭?')
- .then(_ => {
- let refName = '', formName = ''
- // 组
- if (btnType === 'drawerGroup') {
- refName = 'groupELForm'
- formName = 'groupForm'
- this.visible[btnType] = false
+ that.embeddingProgressStatus = 'exception';
+ that.embeddingProgressPercent = Math.max(that.embeddingProgressPercent, 50);
+ that.embeddingProgressText = '处理出错:' + (err.message || err);
+ setTimeout(function () {
+ that.visible.embeddingProgress = false;
+ that.$notify({
+ title: '错误',
+ message: err.message || '向量化处理出错,请检查配置',
+ type: 'error',
+ duration: 5000
+ });
+ }, 800);
+ });
+ }).catch(function () { });
+ }
+ },
+ // Dailog|抽屉 打开 按钮
+ handleElVisibleOpenBtn(btnType, item) {
+ const that = this
+ let visibleKey = btnType
+ if (btnType === 'drawerGroup') {
+ visibleKey = 'drawerGroup'
+ that.groupForm.knowledgeBasesId = item?.id ?? ''
+ that.fileQueryList.pageIndex = 1
+ that.fileNamesToSelect = []
+ that.visible[visibleKey] = true
+ that.loadConfigKnowledgeBaseItems(item?.id)
+ return
+ }
+ if (btnType === 'dialogFile') {
+ visibleKey = 'dialogFile'
+ }
+ this.visible[visibleKey] = true
+ },
+ // Dailog|抽屉 关闭 按钮
+ handleElVisibleClose(btnType) {
+ // drawerAgent dialogGroupAgent drawerGroup drawerGroupStart
+ this.$confirm('确认关闭?')
+ .then(_ => {
+ let refName = '', formName = ''
+ // 组
+ if (btnType === 'drawerGroup') {
+ refName = 'groupELForm'
+ formName = 'groupForm'
+ this.visible[btnType] = false
- //// 重置 组获取智能体query
- //this.$set(this, 'groupAgentQueryList', this.$options.data().groupAgentQueryList)
- //this.groupAgentList = []
- }
+ //// 重置 组获取智能体query
+ //this.$set(this, 'groupAgentQueryList', this.$options.data().groupAgentQueryList)
+ //this.groupAgentList = []
+ }
- if (formName) {
- this.$set(this, `${formName}`, this.$options.data()[formName])
- // Object.assign(this[formName],this.$options.data()[formName])
- }
- if (refName) {
- this.$refs[refName].resetFields();
- }
- this.$nextTick(() => {
- this.visible[btnType] = false
- })
- // 清理 Function Calls 数据
- if (['drawerAgent', 'dialogGroupAgent'].includes(btnType)) {
- this.functionCallTags = []
- this.functionCallInputVisible = false
- this.functionCallInputValue = ''
- }
- })
- .catch(_ => { });
- },
- // Dailog|抽屉 提交 按钮
- handleElVisibleSubmit(btnType) {
- // drawerAgent dialogGroupAgent drawerGroup drawerGroupStart
- let refName = '', formName = ''
- // 组
- if (btnType === 'drawerGroup') {
- refName = 'groupELForm'
- formName = 'groupForm'
- }
- if (!refName) return
- this.$refs[refName].validate((valid) => {
- if (valid) {
- //debugger
- const submitForm = this[formName] ?? {}
- //提交数据给后端
- this.saveSubmitFormData(btnType, submitForm)
- //debugger
- // this.visible[btnType] = false
- } else {
- console.log('error submit!!');
- return false;
- }
- });
- },
- // 配置抽屉「已选择」文件列表中移除某一项,并同步表格勾选
- groupMembersCancel(item, index) {
- this.groupForm.files.splice(index, 1);
- this.$nextTick(() => {
- const tbl = this.$refs.groupAgentTable;
- if (!tbl) return;
- tbl.clearSelection();
- this.groupForm.files.forEach(f => {
- const row = this.fileList.find(i => i.id === f.id);
- if (row) tbl.toggleRowSelection(row, true);
- });
- });
- },
- // 编辑 Dailog|抽屉 按钮
- async handleEditDrawerOpenBtn(btnType, item) {
- // drawerAgent dialogGroupAgent drawerGroup drawerGroupStart
- //console.log('handleEditDrawerOpenBtn', btnType, item);
- let formName = ''
- // 智能体
- if (['dialogGroupAgent'].includes(btnType)) {
- formName = 'agentForm'
- }
+ if (formName) {
+ this.$set(this, `${formName}`, this.$options.data()[formName])
+ // Object.assign(this[formName],this.$options.data()[formName])
+ }
+ if (refName) {
+ this.$refs[refName].resetFields();
+ }
+ this.$nextTick(() => {
+ this.visible[btnType] = false
+ })
+ // 清理 Function Calls 数据
+ if (['drawerAgent', 'dialogGroupAgent'].includes(btnType)) {
+ this.functionCallTags = []
+ this.functionCallInputVisible = false
+ this.functionCallInputValue = ''
+ }
+ })
+ .catch(_ => { });
+ },
+ // Dailog|抽屉 提交 按钮
+ handleElVisibleSubmit(btnType) {
+ // drawerAgent dialogGroupAgent drawerGroup drawerGroupStart
+ let refName = '', formName = ''
+ // 组
+ if (btnType === 'drawerGroup') {
+ refName = 'groupELForm'
+ formName = 'groupForm'
+ }
+ if (!refName) return
+ this.$refs[refName].validate((valid) => {
+ if (valid) {
+ //debugger
+ const submitForm = this[formName] ?? {}
+ //提交数据给后端
+ this.saveSubmitFormData(btnType, submitForm)
+ //debugger
+ // this.visible[btnType] = false
+ } else {
+ console.log('error submit!!');
+ return false;
+ }
+ });
+ },
+ // 配置抽屉「已选择」文件列表中移除某一项,并同步表格勾选
+ groupMembersCancel(item, index) {
+ this.groupForm.files.splice(index, 1);
+ this.$nextTick(() => {
+ const tbl = this.$refs.groupAgentTable;
+ if (!tbl) return;
+ tbl.clearSelection();
+ this.groupForm.files.forEach(f => {
+ const row = this.fileList.find(i => i.id === f.id);
+ if (row) tbl.toggleRowSelection(row, true);
+ });
+ });
+ },
+ // 编辑 Dailog|抽屉 按钮
+ async handleEditDrawerOpenBtn(btnType, item) {
+ // drawerAgent dialogGroupAgent drawerGroup drawerGroupStart
+ //console.log('handleEditDrawerOpenBtn', btnType, item);
+ let formName = ''
+ // 智能体
+ if (['dialogGroupAgent'].includes(btnType)) {
+ formName = 'agentForm'
+ }
- if (formName) {
- if (btnType === 'drawerAgent' && item) {
- console.log('item', item);
- // 创建一个新的对象来存储表单数据
- const formData = item.agentTemplateDto ? { ...item.agentTemplateDto } : { ...item };
- console.log('formData', formData);
+ if (formName) {
+ if (btnType === 'drawerAgent' && item) {
+ console.log('item', item);
+ // 创建一个新的对象来存储表单数据
+ const formData = item.agentTemplateDto ? { ...item.agentTemplateDto } : { ...item };
+ console.log('formData', formData);
- // 确保 functionCallNames 被正确初始化
- this.functionCallTags = formData.functionCallNames ? formData.functionCallNames.split(',').filter(Boolean) : [];
+ // 确保 functionCallNames 被正确初始化
+ this.functionCallTags = formData.functionCallNames ? formData.functionCallNames.split(',').filter(Boolean) : [];
- // 将数据赋值给表单
- Object.assign(this[formName], formData);
+ // 将数据赋值给表单
+ Object.assign(this[formName], formData);
- // 打印日志以便调试
- console.log('Loaded form data:', formData);
- console.log('functionCallTags:', this.functionCallTags);
+ // 打印日志以便调试
+ console.log('Loaded form data:', formData);
+ console.log('functionCallTags:', this.functionCallTags);
- } else if (btnType === 'drawerGroup') {
- if (item.chatGroupDto) {
- Object.assign(this[formName], {
- ...item.chatGroupDto,
- members: item.agentTemplateDtoList || item.chatGroupMembers || []
- })
- } else {
- await serviceAM.post(`/api/Senparc.Xncf.AgentsManager/ChatGroupAppService/Xncf.AgentsManager_ChatGroupAppService.GetChatGroupItem?id=${item.id}`)
- .then(res => {
- const data = res?.data ?? {}
- if (data.success) {
- const groupDetail = data?.data ?? {}
- Object.assign(this[formName], {
- ...groupDetail.chatGroupDto,
- members: groupDetail.agentTemplateDtoList || groupDetail.chatGroupMembers || []
- })
- }
- })
- }
- // // 获取 全部智能体数据
- // this.getAgentListData('groupAgent')
- } else if (btnType === 'drawerTaskStart') {
- Object.assign(this[formName], {
- ...item
- // groupName: item?.name ?? ''
- })
- } else {
- Object.assign(this[formName], item)
+ } else if (btnType === 'drawerGroup') {
+ if (item.chatGroupDto) {
+ Object.assign(this[formName], {
+ ...item.chatGroupDto,
+ members: item.agentTemplateDtoList || item.chatGroupMembers || []
+ })
+ } else {
+ await serviceAM.post(`/api/Senparc.Xncf.AgentsManager/ChatGroupAppService/Xncf.AgentsManager_ChatGroupAppService.GetChatGroupItem?id=${item.id}`)
+ .then(res => {
+ const data = res?.data ?? {}
+ if (data.success) {
+ const groupDetail = data?.data ?? {}
+ Object.assign(this[formName], {
+ ...groupDetail.chatGroupDto,
+ members: groupDetail.agentTemplateDtoList || groupDetail.chatGroupMembers || []
+ })
}
- // 回显 表单值
- // this.$set(this, `${formName}`, deepClone(item))
- // 打开 抽屉
- this.handleElVisibleOpenBtn(btnType)
- }
- },
- // 组 新增|编辑 智能体table 切换table 选中
- toggleSelection(rows) {
- if (rows) {
- rows.forEach(row => {
- this.$refs?.groupAgentTable?.toggleRowSelection(row);
- });
- } else {
- this.$refs?.groupAgentTable?.clearSelection();
- }
- },
- }
+ })
+ }
+ // // 获取 全部智能体数据
+ // this.getAgentListData('groupAgent')
+ } else if (btnType === 'drawerTaskStart') {
+ Object.assign(this[formName], {
+ ...item
+ // groupName: item?.name ?? ''
+ })
+ } else {
+ Object.assign(this[formName], item)
+ }
+ // 回显 表单值
+ // this.$set(this, `${formName}`, deepClone(item))
+ // 打开 抽屉
+ this.handleElVisibleOpenBtn(btnType)
+ }
+ },
+ // 组 新增|编辑 智能体table 切换table 选中
+ toggleSelection(rows) {
+ if (rows) {
+ rows.forEach(row => {
+ this.$refs?.groupAgentTable?.toggleRowSelection(row);
+ });
+ } else {
+ this.$refs?.groupAgentTable?.clearSelection();
+ }
+ },
+ }
});
@@ -1074,34 +1088,34 @@ new Vue({
* @param {Object} queryObj // 原地址
*/
function getInterfaceQueryStr(queryObj) {
- if (!queryObj) return ''
- // 将对象转换为 URL 参数字符串
- return Object.entries(queryObj)
- .filter(([key, value]) => {
- // 过滤掉空值
- // console.log('value', typeof value)
- if (typeof value === 'string') {
- return value !== ''
- } else if (typeof value === 'object' && value instanceof Array) {
- return value.length > 0
- } else if (typeof value === 'number') {
- return true
- } else {
- // if(typeof value === 'undefined')
- return false
- }
- })
- .map(
- ([key, value]) => {
- if (Array.isArray(value)) {
- let str = ""
- for (let index in value) {
- str += `${index > 0 ? '&' : ''}${encodeURIComponent(key)}=${encodeURIComponent(value[index])}`
- }
- return str
- }
- return `${encodeURIComponent(key)}=${encodeURIComponent(value)}`
- }
- )
- .join('&')
+ if (!queryObj) return ''
+ // 将对象转换为 URL 参数字符串
+ return Object.entries(queryObj)
+ .filter(([key, value]) => {
+ // 过滤掉空值
+ // console.log('value', typeof value)
+ if (typeof value === 'string') {
+ return value !== ''
+ } else if (typeof value === 'object' && value instanceof Array) {
+ return value.length > 0
+ } else if (typeof value === 'number') {
+ return true
+ } else {
+ // if(typeof value === 'undefined')
+ return false
+ }
+ })
+ .map(
+ ([key, value]) => {
+ if (Array.isArray(value)) {
+ let str = ""
+ for (let index in value) {
+ str += `${index > 0 ? '&' : ''}${encodeURIComponent(key)}=${encodeURIComponent(value[index])}`
+ }
+ return str
+ }
+ return `${encodeURIComponent(key)}=${encodeURIComponent(value)}`
+ }
+ )
+ .join('&')
}
\ No newline at end of file
diff --git a/tools/NcfSimulatedSite/Senparc.Areas.Admin/Areas/Admin/Pages/AdminUserInfo/Index.cshtml b/tools/NcfSimulatedSite/Senparc.Areas.Admin/Areas/Admin/Pages/AdminUserInfo/Index.cshtml
index ca194494c..14451515a 100644
--- a/tools/NcfSimulatedSite/Senparc.Areas.Admin/Areas/Admin/Pages/AdminUserInfo/Index.cshtml
+++ b/tools/NcfSimulatedSite/Senparc.Areas.Admin/Areas/Admin/Pages/AdminUserInfo/Index.cshtml
@@ -1,4 +1,4 @@
-@page "{handler?}"
+@page "{handler?}"
@model Senparc.Areas.Admin.Areas.Admin.Pages.AdminUserInfo_IndexModel
@addTagHelper *, Senparc.Areas.Admin
@{
@@ -12,12 +12,38 @@
管理员列表
}
+ 取消
+ 确认
diff --git a/src/Extensions/Senparc.Xncf.KnowledgeBase/Areas/Admin/Pages/KnowledgeBase/Index.cshtml.cs b/src/Extensions/Senparc.Xncf.KnowledgeBase/Areas/Admin/Pages/KnowledgeBase/Index.cshtml.cs
index 80f87cf39..fb18734de 100644
--- a/src/Extensions/Senparc.Xncf.KnowledgeBase/Areas/Admin/Pages/KnowledgeBase/Index.cshtml.cs
+++ b/src/Extensions/Senparc.Xncf.KnowledgeBase/Areas/Admin/Pages/KnowledgeBase/Index.cshtml.cs
@@ -43,25 +43,26 @@ public Task OnGetAsync()
public async Task
-
-
- 增加
-
+
+
+ @* 查询区:按管理员名称关键字查询 *@
+
-
+
-
+
+
+ @* 分页:首页、上一页、下一页、尾页、跳转、每页条数 5/10/15/20/50/100,默认 10 *@
+
+
+ label-position="top"
+ size="small"
+ class="admin-user-dialog-form">
+
-
+
-
+
-
+
-
+
-
-
+
+
-
+
+
+ @* 工具栏 *@
+
+
+
+ 查询
+ 重置
+
+
+ 增加
+
+
+ @* 表格区域 *@
+
+
+
- 不建议修改用户名!
-
- 取 消
- 确 认
+
-
- {{item.text}}
-
- 菜单列表
}
+ 取消
+ 确认
-
- 取 消
- 确 认
+
+
diff --git a/tools/NcfSimulatedSite/Senparc.Areas.Admin/Areas/Admin/Pages/Menu/Index.cshtml b/tools/NcfSimulatedSite/Senparc.Areas.Admin/Areas/Admin/Pages/Menu/Index.cshtml
index e33e0e126..79bcdc248 100644
--- a/tools/NcfSimulatedSite/Senparc.Areas.Admin/Areas/Admin/Pages/Menu/Index.cshtml
+++ b/tools/NcfSimulatedSite/Senparc.Areas.Admin/Areas/Admin/Pages/Menu/Index.cshtml
@@ -1,4 +1,4 @@
-@page
+@page
@model Senparc.Areas.Admin.Areas.Admin.Pages.MenuIndexModel
@{
ViewData["Title"] = "菜单管理"; Layout = "_Layout_Vue";
@@ -11,12 +11,37 @@
+
+ {{item.text}}
+
+
+
+ 取消
+ 确认
-
-
- 增加菜单
-
+
+
+ @* 查询区:按菜单名称关键字查询 *@
+
-
+
-
-
+
+
+ @* 分页:首页、上一页、下一页、尾页、跳转、每页条数 5/10/15/20/50/100,默认 10 *@
+
-
-
+ label-position="top"
+ size="small"
+ class="menu-dialog-form">
+
+
-
+
-
-
+
+
-
+
菜单
页面
按钮
-
-
+
+
-
-
+
+
-
+
-
+
-
-
- 选择图标
+
+
-
+
+
+ @* 工具栏 *@
+
+
+
+ 查询
+ 重置
+
+
+ 增加菜单
+
+
+ @* 表格区域 *@
+
+
+
+
+
+
+
+ 选择图标
+
- 取 消
- 确 认
+ 系统管理
角色列表
}
+ 取消
+ 确认
diff --git a/tools/NcfSimulatedSite/Senparc.Areas.Admin/Areas/Admin/Pages/Role/Index.cshtml b/tools/NcfSimulatedSite/Senparc.Areas.Admin/Areas/Admin/Pages/Role/Index.cshtml
index 8e0ebe8d3..0568be354 100644
--- a/tools/NcfSimulatedSite/Senparc.Areas.Admin/Areas/Admin/Pages/Role/Index.cshtml
+++ b/tools/NcfSimulatedSite/Senparc.Areas.Admin/Areas/Admin/Pages/Role/Index.cshtml
@@ -1,20 +1,51 @@
-@page
+@page
@model Senparc.Areas.Admin.Areas.Admin.Pages.RoleIndexModel
@{
ViewData["Title"] = "角色管理"; Layout = "_Layout_Vue";
}
+
+@section Style{
+
+}
+
@section breadcrumbs {
-
-
- 增加
-
+
+ 系统信息
}
+ @* 查询区:按角色名称关键字查询 *@
+
@@ -46,7 +77,7 @@
{{formaTableTime(scope.row.addTime)}}
-
+
-
+
+
+ @* 分页:首页、上一页、下一页、尾页、跳转、每页条数 5/10/15/20/50/100,默认 10 *@
+
+
-
+ label-position="top"
+ size="small"
+ class="role-dialog-form">
+
-
+
-
+
-
-
+
+
-
-
+
+
-
+
+
diff --git a/tools/NcfSimulatedSite/Senparc.Areas.Admin/Areas/Admin/Pages/SystemConfig/Index.cshtml b/tools/NcfSimulatedSite/Senparc.Areas.Admin/Areas/Admin/Pages/SystemConfig/Index.cshtml
index 7bffb89da..3b12008c0 100644
--- a/tools/NcfSimulatedSite/Senparc.Areas.Admin/Areas/Admin/Pages/SystemConfig/Index.cshtml
+++ b/tools/NcfSimulatedSite/Senparc.Areas.Admin/Areas/Admin/Pages/SystemConfig/Index.cshtml
@@ -1,4 +1,4 @@
-@page "{handler?}"
+@page "{handler?}"
@addTagHelper *, Senparc.Areas.Admin
@model Senparc.Areas.Admin.Areas.Admin.Pages.SystemConfig_IndexModel
@{
@@ -15,57 +15,57 @@
+
+
+ @* 工具栏 *@
+
+
+
+ 查询
+ 重置
+
+
+ 增加
+
+
+ @* 表格区域 *@
+
+
+
-
- 取 消
- 确 认
+
-
- 系统管理
SenparcTrace 日志
}
();
+ if (!string.IsNullOrEmpty(keyword))
+ {
+ dateList = dateList
+ .Where(z => z != null && z.IndexOf(keyword, StringComparison.OrdinalIgnoreCase) >= 0)
+ .ToList();
+ }
+
+ var count = dateList.Count;
+ var list = dateList
+ .Skip((pageIndex - 1) * pageSize)
+ .Take(pageSize)
+ .ToList();
+
+ return Ok(new { count, pageIndex, list });
}
}
}
diff --git a/tools/NcfSimulatedSite/Senparc.Areas.Admin/Areas/Admin/Pages/Shared/_Layout_Vue.cshtml b/tools/NcfSimulatedSite/Senparc.Areas.Admin/Areas/Admin/Pages/Shared/_Layout_Vue.cshtml
index 2fd7571ed..1a98b33e4 100644
--- a/tools/NcfSimulatedSite/Senparc.Areas.Admin/Areas/Admin/Pages/Shared/_Layout_Vue.cshtml
+++ b/tools/NcfSimulatedSite/Senparc.Areas.Admin/Areas/Admin/Pages/Shared/_Layout_Vue.cshtml
@@ -1,4 +1,4 @@
-@model Senparc.Ncf.AreaBase.Admin.IAdminPageModelBase
+@model Senparc.Ncf.AreaBase.Admin.IAdminPageModelBase
@{
var thisYear = DateTime.Now.Year;
}
@@ -31,7 +31,7 @@
-
+ 取消
+ 确认
-
- 取 消
- 确 认
+
+
diff --git a/tools/NcfSimulatedSite/Senparc.Areas.Admin/Areas/Admin/Pages/SenparcTrace/Index.cshtml b/tools/NcfSimulatedSite/Senparc.Areas.Admin/Areas/Admin/Pages/SenparcTrace/Index.cshtml
index 143fb28ad..e480f5f32 100644
--- a/tools/NcfSimulatedSite/Senparc.Areas.Admin/Areas/Admin/Pages/SenparcTrace/Index.cshtml
+++ b/tools/NcfSimulatedSite/Senparc.Areas.Admin/Areas/Admin/Pages/SenparcTrace/Index.cshtml
@@ -1,41 +1,73 @@
-@page
+@page
@model Senparc.Areas.Admin.Areas.Admin.Pages.SenparcTrace_IndexModel
@{
ViewData["Title"] = "SenparcTrace 日志";
Layout = "_Layout_Vue";
}
+
+@section Style{
+
+}
+
@section breadcrumbs {
+
+
+
+ 取消
+ 确认
-
-
-
- {{ scope.row.no}}
-
-
-
-
-
- {{ scope.row.text }}
-
-
-
-
-
+
@section scripts{
-}
-
+}
\ No newline at end of file
diff --git a/tools/NcfSimulatedSite/Senparc.Areas.Admin/Areas/Admin/Pages/SenparcTrace/Index.cshtml.cs b/tools/NcfSimulatedSite/Senparc.Areas.Admin/Areas/Admin/Pages/SenparcTrace/Index.cshtml.cs
index ced9c1bd4..2d6756909 100644
--- a/tools/NcfSimulatedSite/Senparc.Areas.Admin/Areas/Admin/Pages/SenparcTrace/Index.cshtml.cs
+++ b/tools/NcfSimulatedSite/Senparc.Areas.Admin/Areas/Admin/Pages/SenparcTrace/Index.cshtml.cs
@@ -6,6 +6,7 @@
using Microsoft.AspNetCore.Mvc.RazorPages;
using Senparc.Areas.Admin.SenparcTraceManager;
using Senparc.Ncf.AreaBase.Admin.Filters;
+using System.Linq;
namespace Senparc.Areas.Admin.Areas.Admin.Pages
{
@@ -20,10 +21,23 @@ public void OnGet()
//DateList = SenparcTraceHelper.GetLogDate();
}
- public IActionResult OnGetList(int pageIndex = 1, int pageSize = 10)
+ public IActionResult OnGetList(string keyword, int pageIndex = 1, int pageSize = 10)
{
- var dateList = SenparcTraceHelper.GetLogDate();
- return Ok(new { dateList.Count, pageIndex, List = dateList.Skip((pageIndex - 1) * pageSize) });
+ var dateList = SenparcTraceHelper.GetLogDate() ?? new System.Collections.Generic.List
+
+ @* 查询区:按日志日期/名称关键字查询 *@
+
+
+
+
+ @* 表格区域 *@
+
+
+
+ 查询
+ 重置
+
+
+
+
+
+ {{ scope.row.no}}
+
+
+
+
+
+ {{ scope.row.text }}
+
+
+
+
+
+
+ @* 分页:首页、上一页、下一页、尾页、跳转、每页条数 5/10/15/20/50/100,默认 10 *@
+
+
+
+
-
@section scripts{
diff --git a/tools/NcfSimulatedSite/Senparc.Areas.Admin/wwwroot/css/Admin/AdminUserInfo/AdminUserInfo.css b/tools/NcfSimulatedSite/Senparc.Areas.Admin/wwwroot/css/Admin/AdminUserInfo/AdminUserInfo.css
index a491438bd..e292fd3e2 100644
--- a/tools/NcfSimulatedSite/Senparc.Areas.Admin/wwwroot/css/Admin/AdminUserInfo/AdminUserInfo.css
+++ b/tools/NcfSimulatedSite/Senparc.Areas.Admin/wwwroot/css/Admin/AdminUserInfo/AdminUserInfo.css
@@ -1,7 +1,142 @@
-.admin-user-info .username-tip {
+/* 页面整体 */
+.admin-user-info-page {
+ padding: 20px 24px;
+ background: #f0f2f5;
+ min-height: 100%;
+ box-sizing: border-box;
+}
+
+.admin-user-info-main {
+ background: #fff;
+ border-radius: 8px;
+ padding: 20px 24px;
+ box-shadow: 0 1px 4px rgba(0,0,0,0.06);
+}
+
+/* 查询区 */
+.admin-user-query-section {
+ margin-bottom: 20px;
+ padding: 16px 18px;
+ background: #fafbfc;
+ border: 1px solid #e8eaec;
+ border-radius: 6px;
+}
+
+.admin-user-query-row {
+ display: flex;
+ align-items: center;
+ flex-wrap: wrap;
+ gap: 12px;
+}
+
+.admin-user-query-label {
+ flex: 0 0 auto;
+ font-size: 14px;
+ color: #606266;
+ margin: 0;
+}
+
+.admin-user-query-input {
+ width: 260px;
+}
+
+.admin-user-query-row .el-button {
+ margin-left: 0;
+}
+
+/* 工具栏 */
+.admin-user-toolbar {
+ display: flex;
+ align-items: center;
+ gap: 12px;
+ margin-bottom: 16px;
+}
+
+.admin-user-toolbar .el-button {
+ margin: 0;
+}
+
+/* 表格区域 */
+.admin-user-table-wrap {
+ margin-bottom: 16px;
+}
+
+.admin-user-table-wrap .el-table {
+ margin-bottom: 0;
+}
+
+.admin-user-table-wrap .el-table th {
+ background: #f5f7fa;
+ color: #303133;
+ font-weight: 600;
+}
+
+/* 分页区域 */
+.admin-user-pagination-wrap {
+ display: flex;
+ justify-content: flex-end;
+ padding-top: 12px;
+ border-top: 1px solid #ebeef5;
+}
+
+.admin-user-info .username-tip {
padding-left: 100px;
}
+
.el-checkbox.is-bordered {
- margin:20px 0;
- margin-left:10px;
+ margin: 20px 0;
+ margin-left: 10px;
+}
+
+/* 弹框样式:新增/编辑管理员、设置角色 */
+.admin-user-form-dialog .el-dialog__header {
+ padding: 18px 24px 14px;
+ border-bottom: 1px solid #ebeef5;
+}
+
+.admin-user-form-dialog .el-dialog__title {
+ font-size: 16px;
+ font-weight: 600;
+ color: #303133;
+}
+
+.admin-user-form-dialog .el-dialog__body {
+ padding: 24px 24px 20px;
+}
+
+.admin-user-dialog-form .admin-user-form-item {
+ margin-bottom: 18px;
+}
+
+.admin-user-dialog-form .el-form-item__label {
+ font-size: 13px;
+ color: #606266;
+ line-height: 1.4;
+ padding-bottom: 6px;
+}
+
+.admin-user-dialog-form .el-form-item__content .el-input,
+.admin-user-dialog-form .el-form-item__content .el-textarea {
+ width: 100%;
+}
+
+.admin-user-dialog-footer {
+ display: flex;
+ justify-content: flex-end;
+ padding: 14px 24px 18px;
+ border-top: 1px solid #ebeef5;
+}
+
+.admin-user-dialog-footer .el-button {
+ min-width: 80px;
+}
+
+.admin-user-dialog-footer .el-button + .el-button {
+ margin-left: 12px;
+}
+
+.admin-user-role-body {
+ max-height: 320px;
+ overflow-y: auto;
+ padding: 8px 4px 0;
}
diff --git a/tools/NcfSimulatedSite/Senparc.Areas.Admin/wwwroot/css/Admin/Menu/Menu.css b/tools/NcfSimulatedSite/Senparc.Areas.Admin/wwwroot/css/Admin/Menu/Menu.css
index 358a87bda..18ccfbec3 100644
--- a/tools/NcfSimulatedSite/Senparc.Areas.Admin/wwwroot/css/Admin/Menu/Menu.css
+++ b/tools/NcfSimulatedSite/Senparc.Areas.Admin/wwwroot/css/Admin/Menu/Menu.css
@@ -1,4 +1,4 @@
-.menu-icons-grid{
+.menu-icons-grid{
position:relative;
display:grid;
grid-template-columns:repeat(auto-fill,minmax(120px,1fr));
@@ -24,6 +24,141 @@
margin-top: 10px;
}
+/* 页面整体 */
+.menu-index-page {
+ padding: 20px 24px;
+ background: #f0f2f5;
+ min-height: 100%;
+ box-sizing: border-box;
+}
+
+.menu-main {
+ background: #fff;
+ border-radius: 8px;
+ padding: 20px 24px;
+ box-shadow: 0 1px 4px rgba(0,0,0,0.06);
+}
+
+/* 查询区 */
+.menu-query-section {
+ margin-bottom: 20px;
+ padding: 16px 18px;
+ background: #fafbfc;
+ border: 1px solid #e8eaec;
+ border-radius: 6px;
+}
+
+.menu-query-row {
+ display: flex;
+ align-items: center;
+ flex-wrap: wrap;
+ gap: 12px;
+}
+
+.menu-query-label {
+ flex: 0 0 auto;
+ font-size: 14px;
+ color: #606266;
+ margin: 0;
+}
+
+.menu-query-input {
+ width: 260px;
+}
+
+.menu-query-row .el-button {
+ margin-left: 0;
+}
+
+/* 工具栏 */
+.menu-toolbar {
+ display: flex;
+ align-items: center;
+ gap: 12px;
+ margin-bottom: 16px;
+}
+
+.menu-toolbar .el-button {
+ margin: 0;
+}
+
+/* 表格区域 */
+.menu-table-wrap {
+ margin-bottom: 16px;
+}
+
+.menu-table-wrap .el-table {
+ margin-bottom: 0;
+}
+
+.menu-table-wrap .el-table th {
+ background: #f5f7fa;
+ color: #303133;
+ font-weight: 600;
+}
+
+/* 分页区域 */
+.menu-pagination-wrap {
+ display: flex;
+ justify-content: flex-end;
+ padding-top: 12px;
+ border-top: 1px solid #ebeef5;
+}
+
+/* 弹框样式:新增/编辑/增加下一级菜单 */
+.menu-form-dialog .el-dialog__header {
+ padding: 18px 24px 14px;
+ border-bottom: 1px solid #ebeef5;
+}
+
+.menu-form-dialog .el-dialog__title {
+ font-size: 16px;
+ font-weight: 600;
+ color: #303133;
+}
+
+.menu-form-dialog .el-dialog__body {
+ padding: 24px 24px 20px;
+}
+
+.menu-dialog-form .menu-form-item {
+ margin-bottom: 18px;
+}
+
+.menu-dialog-form .el-form-item__label {
+ font-size: 13px;
+ color: #606266;
+ line-height: 1.4;
+ padding-bottom: 6px;
+}
+
+.menu-dialog-form .el-form-item__content .el-input,
+.menu-dialog-form .el-form-item__content .el-textarea,
+.menu-dialog-form .el-form-item__content .el-cascader {
+ width: 100%;
+}
+
+.menu-dialog-footer {
+ display: flex;
+ justify-content: flex-end;
+ padding: 14px 24px 18px;
+ border-top: 1px solid #ebeef5;
+}
+
+.menu-dialog-footer .el-button {
+ min-width: 80px;
+}
+
+.menu-dialog-footer .el-button + .el-button {
+ margin-left: 12px;
+}
+
+.menu-icon-row {
+ display: flex;
+ align-items: center;
+ gap: 12px;
+}
+
/* 树形菜单固定行样式 */
.sticky-parent {
position: relative;
diff --git a/tools/NcfSimulatedSite/Senparc.Areas.Admin/wwwroot/css/Admin/Role/Index.css b/tools/NcfSimulatedSite/Senparc.Areas.Admin/wwwroot/css/Admin/Role/Index.css
new file mode 100644
index 000000000..a1e5e93f8
--- /dev/null
+++ b/tools/NcfSimulatedSite/Senparc.Areas.Admin/wwwroot/css/Admin/Role/Index.css
@@ -0,0 +1,134 @@
+/* 页面整体 */
+.role-index-page {
+ padding: 20px 24px;
+ background: #f0f2f5;
+ min-height: 100%;
+ box-sizing: border-box;
+}
+
+.role-main {
+ background: #fff;
+ border-radius: 8px;
+ padding: 20px 24px;
+ box-shadow: 0 1px 4px rgba(0,0,0,0.06);
+}
+
+/* 查询区 */
+.role-query-section {
+ margin-bottom: 20px;
+ padding: 16px 18px;
+ background: #fafbfc;
+ border: 1px solid #e8eaec;
+ border-radius: 6px;
+}
+
+.role-query-row {
+ display: flex;
+ align-items: center;
+ flex-wrap: wrap;
+ gap: 12px;
+}
+
+.role-query-label {
+ flex: 0 0 auto;
+ font-size: 14px;
+ color: #606266;
+ margin: 0;
+}
+
+.role-query-input {
+ width: 260px;
+}
+
+.role-query-row .el-button {
+ margin-left: 0;
+}
+
+/* 工具栏 */
+.role-toolbar {
+ display: flex;
+ align-items: center;
+ gap: 12px;
+ margin-bottom: 16px;
+}
+
+.role-toolbar .el-button {
+ margin: 0;
+}
+
+/* 表格区域 */
+.role-table-wrap {
+ margin-bottom: 16px;
+}
+
+.role-table-wrap .el-table {
+ margin-bottom: 0;
+}
+
+.role-table-wrap .el-table th {
+ background: #f5f7fa;
+ color: #303133;
+ font-weight: 600;
+}
+
+/* 分页区域 */
+.role-pagination-wrap {
+ display: flex;
+ justify-content: flex-end;
+ padding-top: 12px;
+ border-top: 1px solid #ebeef5;
+}
+
+/* 弹框样式:新增/编辑角色、权限授权 */
+.role-form-dialog .el-dialog__header {
+ padding: 18px 24px 14px;
+ border-bottom: 1px solid #ebeef5;
+}
+
+.role-form-dialog .el-dialog__title {
+ font-size: 16px;
+ font-weight: 600;
+ color: #303133;
+}
+
+.role-form-dialog .el-dialog__body {
+ padding: 24px 24px 20px;
+}
+
+.role-dialog-form .role-form-item {
+ margin-bottom: 18px;
+}
+
+.role-dialog-form .el-form-item__label {
+ font-size: 13px;
+ color: #606266;
+ line-height: 1.4;
+ padding-bottom: 6px;
+}
+
+.role-dialog-form .el-form-item__content .el-input,
+.role-dialog-form .el-form-item__content .el-textarea {
+ width: 100%;
+}
+
+.role-dialog-footer {
+ display: flex;
+ justify-content: flex-end;
+ padding: 14px 24px 18px;
+ border-top: 1px solid #ebeef5;
+}
+
+.role-dialog-footer .el-button {
+ min-width: 80px;
+}
+
+.role-dialog-footer .el-button + .el-button {
+ margin-left: 12px;
+}
+
+.role-permission-body {
+ max-height: 360px;
+ overflow-y: auto;
+ padding: 8px 4px 0;
+}
+
diff --git a/tools/NcfSimulatedSite/Senparc.Areas.Admin/wwwroot/css/Admin/SenparcTrace/Index.css b/tools/NcfSimulatedSite/Senparc.Areas.Admin/wwwroot/css/Admin/SenparcTrace/Index.css
new file mode 100644
index 000000000..44370d43f
--- /dev/null
+++ b/tools/NcfSimulatedSite/Senparc.Areas.Admin/wwwroot/css/Admin/SenparcTrace/Index.css
@@ -0,0 +1,69 @@
+/* 页面整体 */
+.senparctrace-page {
+ padding: 20px 24px;
+ background: #f0f2f5;
+ min-height: 100%;
+ box-sizing: border-box;
+}
+
+.senparctrace-main {
+ background: #fff;
+ border-radius: 8px;
+ padding: 20px 24px;
+ box-shadow: 0 1px 4px rgba(0,0,0,0.06);
+}
+
+/* 查询区 */
+.senparctrace-query-section {
+ margin-bottom: 20px;
+ padding: 16px 18px;
+ background: #fafbfc;
+ border: 1px solid #e8eaec;
+ border-radius: 6px;
+}
+
+.senparctrace-query-row {
+ display: flex;
+ align-items: center;
+ flex-wrap: wrap;
+ gap: 12px;
+}
+
+.senparctrace-query-label {
+ flex: 0 0 auto;
+ font-size: 14px;
+ color: #606266;
+ margin: 0;
+}
+
+.senparctrace-query-input {
+ width: 260px;
+}
+
+.senparctrace-query-row .el-button {
+ margin-left: 0;
+}
+
+/* 表格区域 */
+.senparctrace-table-wrap {
+ margin-bottom: 16px;
+}
+
+.senparctrace-table-wrap .el-table {
+ margin-bottom: 0;
+}
+
+.senparctrace-table-wrap .el-table th {
+ background: #f5f7fa;
+ color: #303133;
+ font-weight: 600;
+}
+
+/* 分页区域 */
+.senparctrace-pagination-wrap {
+ display: flex;
+ justify-content: flex-end;
+ padding-top: 12px;
+ border-top: 1px solid #ebeef5;
+}
+
diff --git a/tools/NcfSimulatedSite/Senparc.Areas.Admin/wwwroot/css/Admin/Shared/layout.css b/tools/NcfSimulatedSite/Senparc.Areas.Admin/wwwroot/css/Admin/Shared/layout.css
index 8d8c58a0c..83545528d 100644
--- a/tools/NcfSimulatedSite/Senparc.Areas.Admin/wwwroot/css/Admin/Shared/layout.css
+++ b/tools/NcfSimulatedSite/Senparc.Areas.Admin/wwwroot/css/Admin/Shared/layout.css
@@ -1,4 +1,4 @@
-
+
[v-cloak] {
display: none;
}
@@ -17,8 +17,10 @@ a {
text-decoration: none;
}
-body {
+html, body {
+ height: 100%;
margin: 0;
+ overflow: hidden;
}
img {
@@ -33,12 +35,55 @@ li {
#app {
height: 100%;
+ overflow: hidden;
}
.app-wrapper {
position: relative;
height: 100%;
width: 100%;
+ overflow: hidden;
+}
+
+/* 最外层不出现横向/纵向滚动条,仅主内容区内部滚动 */
+.app-wrapper .el-container {
+ height: 100vh;
+ overflow: hidden;
+ display: flex;
+}
+
+.app-wrapper .el-container .el-aside {
+ flex-shrink: 0;
+ height: 100vh;
+ overflow: hidden;
+ display: flex;
+ flex-direction: column;
+}
+
+.app-wrapper .el-container .el-aside .el-scrollbar {
+ flex: 1;
+ min-height: 0;
+}
+
+.app-wrapper .el-container .el-aside .el-scrollbar .scrollbar-wrapper {
+ height: 100% !important;
+}
+
+.app-wrapper .el-container > .el-container {
+ flex: 1;
+ min-width: 0;
+ min-height: 0;
+ overflow: hidden;
+ display: flex;
+ flex-direction: column;
+}
+
+.app-wrapper .el-header {
+ flex-shrink: 0;
+}
+
+.app-wrapper .el-footer {
+ flex-shrink: 0;
}
.footer {
@@ -51,10 +96,18 @@ li {
color: #23527c;
}
-.el-main
-{
- background-color: #e3e3e3;
- height: 730px;
+.app-wrapper .el-main {
+ flex: 1;
+ min-height: 0;
+ overflow-y: auto;
+ overflow-x: hidden;
+ background-color: rgba(0,21,41,0.08);
+ -webkit-overflow-scrolling: touch;
+}
+
+.app-wrapper .el-main .ifram-wrapper {
+ min-height: 100%;
+ box-sizing: border-box;
}
/*侧边栏*/
diff --git a/tools/NcfSimulatedSite/Senparc.Areas.Admin/wwwroot/css/Admin/SystemConfig/Index.css b/tools/NcfSimulatedSite/Senparc.Areas.Admin/wwwroot/css/Admin/SystemConfig/Index.css
index 179628c4f..01bdadf5e 100644
--- a/tools/NcfSimulatedSite/Senparc.Areas.Admin/wwwroot/css/Admin/SystemConfig/Index.css
+++ b/tools/NcfSimulatedSite/Senparc.Areas.Admin/wwwroot/css/Admin/SystemConfig/Index.css
@@ -1,4 +1,82 @@
-.admin-systemconfig-info h2{
+/* 页面整体 */
+.systemconfig-page {
+ padding: 20px 24px;
+ background: #f0f2f5;
+ min-height: 100%;
+ box-sizing: border-box;
+}
+
+.systemconfig-main {
+ background: #fff;
+ border-radius: 8px;
+ padding: 20px 24px;
+ box-shadow: 0 1px 4px rgba(0,0,0,0.06);
+}
+
+/* 头部区域 */
+.systemconfig-header {
+ display: flex;
+ justify-content: space-between;
+ align-items: center;
+ margin-bottom: 16px;
+}
+
+.systemconfig-header-text {
+ display: flex;
+ flex-direction: column;
+ gap: 4px;
+}
+
+.systemconfig-title {
+ font-size: 18px;
+ font-weight: 600;
+ color: #303133;
+ margin: 0;
+}
+
+.systemconfig-subtitle {
+ font-size: 13px;
+ color: #909399;
+ margin: 0;
+}
+
+.systemconfig-header-actions {
+ display: flex;
+ align-items: center;
+ gap: 8px;
+}
+
+.systemconfig-edit-actions {
+ display: flex;
+ align-items: center;
+ gap: 8px;
+}
+
+/* 表单区域 */
+.systemconfig-form {
+ margin-top: 8px;
+}
+
+.systemconfig-form .el-form-item__label {
+ font-size: 13px;
+ color: #606266;
+ padding-bottom: 6px;
+}
+
+.systemconfig-form .el-form-item {
+ margin-bottom: 18px;
+}
+
+.systemconfig-form .el-input {
+ width: 100%;
+}
+
+.systemconfig-field-readonly {
+ display: flex;
+ align-items: center;
+}
+
+.admin-systemconfig-info h2{
margin-bottom:22px;
}
diff --git a/tools/NcfSimulatedSite/Senparc.Areas.Admin/wwwroot/js/Admin/Pages/AdminUserInfo/Index.js b/tools/NcfSimulatedSite/Senparc.Areas.Admin/wwwroot/js/Admin/Pages/AdminUserInfo/Index.js
index 89ed6d3f9..2116c5621 100644
--- a/tools/NcfSimulatedSite/Senparc.Areas.Admin/wwwroot/js/Admin/Pages/AdminUserInfo/Index.js
+++ b/tools/NcfSimulatedSite/Senparc.Areas.Admin/wwwroot/js/Admin/Pages/AdminUserInfo/Index.js
@@ -1,4 +1,4 @@
-var app = new Vue({
+var app = new Vue({
el: "#app",
data() {
//const validatePass = (rule, value, callback) => {
@@ -26,9 +26,10 @@
//分页接口传参
listQuery: {
pageIndex: 1,
- pageSize: 20,
+ pageSize: 10,
adminUserInfoName: ''
},
+ keyword: '',
tableData: [],
dialog: {
title: '新增管理员',
@@ -141,6 +142,20 @@
this.paginationQuery.total = res.data.data.totalCount;
});
},
+ // 查询
+ handleSearch() {
+ this.listQuery.pageIndex = 1;
+ this.listQuery.adminUserInfoName = this.keyword;
+ this.getList();
+ },
+ // 重置
+ resetCondition() {
+ this.keyword = '';
+ this.listQuery.adminUserInfoName = '';
+ this.listQuery.pageIndex = 1;
+ this.listQuery.pageSize = 10;
+ this.getList();
+ },
// 编辑
handleEdit(index, row) {
this.dialog.visible = true;
diff --git a/tools/NcfSimulatedSite/Senparc.Areas.Admin/wwwroot/js/Admin/Pages/Menu/Index.js b/tools/NcfSimulatedSite/Senparc.Areas.Admin/wwwroot/js/Admin/Pages/Menu/Index.js
index c91acd34b..3a45fd1ef 100644
--- a/tools/NcfSimulatedSite/Senparc.Areas.Admin/wwwroot/js/Admin/Pages/Menu/Index.js
+++ b/tools/NcfSimulatedSite/Senparc.Areas.Admin/wwwroot/js/Admin/Pages/Menu/Index.js
@@ -1,4 +1,4 @@
-var app = new Vue({
+var app = new Vue({
el: "#app",
data() {
var validateCode = (rule, value, callback) => {
@@ -13,6 +13,17 @@
}
};
return {
+ // 分页参数
+ paginationQuery: {
+ total: 0
+ },
+ // 分页、查询参数
+ listQuery: {
+ pageIndex: 1,
+ pageSize: 10,
+ menuName: ''
+ },
+ keyword: '',
// 表格数据
tableData: [],
dialog: {
@@ -717,19 +728,73 @@
this.au.updateLoading = false;
}
},
- // 获取所有菜单
+ // 获取所有菜单,并根据查询和分页生成当前页数据
async getList() {
const a = await service.get('/Admin/Menu/Edit?handler=Menu');
- const b = a.data.data;
+ const source = a.data.data;
let allMenu = [];
- this.ddd(b, null, allMenu);
- this.tableData = allMenu;
-
+ this.ddd(source, null, allMenu);
+
+ const keyword = (this.keyword || '').trim();
+ let filtered = allMenu;
+ if (keyword) {
+ filtered = this.filterMenuTree(allMenu, keyword);
+ }
+
+ const total = filtered.length;
+ this.paginationQuery.total = total;
+
+ let { pageIndex, pageSize } = this.listQuery;
+ const totalPages = total > 0 ? Math.ceil(total / pageSize) : 1;
+ if (pageIndex > totalPages) {
+ pageIndex = totalPages;
+ this.listQuery.pageIndex = totalPages;
+ }
+ if (pageIndex < 1) {
+ pageIndex = 1;
+ this.listQuery.pageIndex = 1;
+ }
+
+ const start = (pageIndex - 1) * pageSize;
+ const end = start + pageSize;
+ this.tableData = filtered.slice(start, end);
+
// 数据加载完成后初始化固定效果
this.$nextTick(() => {
this.initStickyParents();
});
},
+ // 递归按名称过滤菜单树
+ filterMenuTree(nodes, keyword) {
+ const result = [];
+ nodes.forEach(node => {
+ const matchSelf = node.menuName && node.menuName.indexOf(keyword) !== -1;
+ let children = [];
+ if (node.children && node.children.length) {
+ children = this.filterMenuTree(node.children, keyword);
+ }
+ if (matchSelf || children.length > 0) {
+ const cloned = { ...node };
+ cloned.children = children;
+ result.push(cloned);
+ }
+ });
+ return result;
+ },
+ // 查询
+ handleSearch() {
+ this.listQuery.pageIndex = 1;
+ this.listQuery.menuName = this.keyword;
+ this.getList();
+ },
+ // 重置
+ resetCondition() {
+ this.keyword = '';
+ this.listQuery.menuName = '';
+ this.listQuery.pageIndex = 1;
+ this.listQuery.pageSize = 10;
+ this.getList();
+ },
// 数据处理
ddd(source, parentId, dest) {
var array = source.filter(_ => _.parentId === parentId);
diff --git a/tools/NcfSimulatedSite/Senparc.Areas.Admin/wwwroot/js/Admin/Pages/Role/Index.js b/tools/NcfSimulatedSite/Senparc.Areas.Admin/wwwroot/js/Admin/Pages/Role/Index.js
index b69b5dee0..996db735c 100644
--- a/tools/NcfSimulatedSite/Senparc.Areas.Admin/wwwroot/js/Admin/Pages/Role/Index.js
+++ b/tools/NcfSimulatedSite/Senparc.Areas.Admin/wwwroot/js/Admin/Pages/Role/Index.js
@@ -1,4 +1,4 @@
-var app = new Vue({
+var app = new Vue({
el: "#app",
data() {
return {
@@ -9,10 +9,11 @@
//分页接口传参
listQuery: {
pageIndex: 1,
- pageSize: 20,
+ pageSize: 10,
roleName: '',
orderField: ''
},
+ keyword: '',
tableData: [],
dialog: {
title: '新增角色',
@@ -154,6 +155,20 @@
this.paginationQuery.total = res.data.data.totalCount;
});
},
+ // 查询
+ handleSearch() {
+ this.listQuery.pageIndex = 1;
+ this.listQuery.roleName = this.keyword;
+ this.getList();
+ },
+ // 重置
+ resetCondition() {
+ this.keyword = '';
+ this.listQuery.roleName = '';
+ this.listQuery.pageIndex = 1;
+ this.listQuery.pageSize = 10;
+ this.getList();
+ },
// 编辑
handleEdit(index, row) {
this.dialog.visible = true;
diff --git a/tools/NcfSimulatedSite/Senparc.Areas.Admin/wwwroot/js/Admin/Pages/SenparcTrace/Index.js b/tools/NcfSimulatedSite/Senparc.Areas.Admin/wwwroot/js/Admin/Pages/SenparcTrace/Index.js
index a9f9c6c5b..40f7f7cbc 100644
--- a/tools/NcfSimulatedSite/Senparc.Areas.Admin/wwwroot/js/Admin/Pages/SenparcTrace/Index.js
+++ b/tools/NcfSimulatedSite/Senparc.Areas.Admin/wwwroot/js/Admin/Pages/SenparcTrace/Index.js
@@ -1,10 +1,11 @@
-var app = new Vue({
+var app = new Vue({
el: '#app',
data: {
searchData: {
pageIndex: 1,
pageSize: 10,
- total: 0
+ total: 0,
+ keyword: ''
},
tableData: []
},
@@ -15,11 +16,12 @@
},
methods: {
fetchData: function () {
- service.get(`/Admin/SenparcTrace/Index?handler=List&pageIndex=${this.searchData.pageIndex}&pageSize=${this.searchData.pageSize}`).then(res => {
+ const { pageIndex, pageSize, keyword } = this.searchData;
+ service.get(`/Admin/SenparcTrace/Index?handler=List&pageIndex=${pageIndex}&pageSize=${pageSize}&keyword=${encodeURIComponent(keyword || '')}`).then(res => {
var responseData = res.data.data;
const actualData = [];
- var startIndex = (this.searchData.pageIndex - 1) * this.searchData.pageSize;
- responseData.list.forEach(ele => {
+ var startIndex = (pageIndex - 1) * pageSize;
+ (responseData.list || []).forEach(ele => {
startIndex++;
actualData.push({ no: startIndex, text: ele });
});
@@ -27,6 +29,16 @@
this.searchData.total = responseData.count;
console.info(actualData);
});
+ },
+ handleSearch() {
+ this.searchData.pageIndex = 1;
+ this.fetchData();
+ },
+ resetCondition() {
+ this.searchData.keyword = '';
+ this.searchData.pageIndex = 1;
+ this.searchData.pageSize = 10;
+ this.fetchData();
}
}
});
\ No newline at end of file
diff --git a/tools/NcfSimulatedSite/Senparc.Areas.Admin/wwwroot/js/Admin/Pages/SystemConfig/Index.js b/tools/NcfSimulatedSite/Senparc.Areas.Admin/wwwroot/js/Admin/Pages/SystemConfig/Index.js
index 0f9a4037a..d7afa1a67 100644
--- a/tools/NcfSimulatedSite/Senparc.Areas.Admin/wwwroot/js/Admin/Pages/SystemConfig/Index.js
+++ b/tools/NcfSimulatedSite/Senparc.Areas.Admin/wwwroot/js/Admin/Pages/SystemConfig/Index.js
@@ -1,108 +1,88 @@
-var app = new Vue({
+var app = new Vue({
el: "#app",
data() {
return {
- //分页参数
- paginationQuery: {
- total: 5
+ loading: false,
+ saving: false,
+ isEditing: false,
+ form: {
+ id: 0,
+ systemName: '',
+ hideModuleManager: false
},
- //分页接口传参(只会有一个)
- listQuery: {
- pageIndex: 1,
- pageSize: 20,
- },
- tableData: [],
- tenantData: {},
- dialog: {
- title: '编辑系统信息',
- visible: false,
- data: {
- id: 0,
- systemName: '',
- },
- rules: {
- systemName: [
- { required: true, message: "用户名为必填项", trigger: "blur" }
- ]
- }
- },
- updateLoading: false,
- updateLoadingSet: false, // 确认loading按钮
+ rules: {
+ systemName: [
+ { required: true, message: "系统名称为必填项", trigger: "blur" }
+ ]
+ }
};
},
created: function () {
- this.getList();
- },
- computed: {
- },
- watch: {
- 'dialog.visible': function (val, old) {
- // 关闭dialog,清空
- if (!val) {
- this.dialog.data = {
- id: 0,
- systemName: ''
- };
- this.dialog.updateLoading = false;
- this.$refs['dataForm'].resetFields();
- }
- }
+ this.getConfig();
},
methods: {
- // 获取数据
- getList() {
- let { pageIndex, pageSize } = this.listQuery;
- service.get(`/Admin/SystemConfig/index?handler=List&&pageIndex=${pageIndex}&pageSize=${pageSize}`).then(res => {
- this.tableData = res.data.data.list;
- this.paginationQuery.total = res.data.data.totalCount;
+ // 获取系统配置(仅一条)
+ getConfig() {
+ this.loading = true;
+ service.get(`/Admin/SystemConfig/index?handler=List&pageIndex=1&pageSize=1`).then(res => {
+ const list = res.data.data.list || [];
+ if (list.length > 0) {
+ const row = list[0];
+ this.form = {
+ id: row.id,
+ systemName: row.systemName,
+ hideModuleManager: row.hideModuleManager
+ };
+ }
+ }).finally(() => {
+ this.loading = false;
});
},
- // 编辑
- handleEdit(index, row) {
- this.dialog.visible = true;
- if (row) {
- // 编辑
- let { systemName, id } = row;
- this.dialog.data = {
- systemName, id
- };
- this.dialog = Object.assign({}, this.dialog);
+ // 开始编辑
+ startEdit() {
+ this.isEditing = true;
+ },
+ // 取消编辑,恢复数据
+ cancelEdit() {
+ this.isEditing = false;
+ if (this.$refs.configForm) {
+ this.$refs.configForm.clearValidate();
}
+ this.getConfig();
},
- // 更新新增编辑
- updateData() {
- this.$refs['dataForm'].validate(valid => {
- // 表单校验
- if (valid) {
- this.dialog.updateLoading = true;
- let data = {
- Id: this.dialog.data.id,
- SystemName: this.dialog.data.systemName,
- };
- service.post("/Admin/SystemConfig/Edit?handler=Save", data).then(res => {
- if (res.data.success) {
- this.getList();
- this.$notify({
- title: "Success",
- message: "更新成功!",
- type: "success",
- duration: 2000
- });
- this.dialog.visible = false;
- this.dialog.updateLoading = false;
- } else {
- this.$notify({
- title: "Faild",
- message: "更新失败:" + res.data.msg,
- type: "success",
- duration: 2000
- });
- }
- }).catch(error => {
- this.dialog.updateLoading = false;
- });
+ // 保存配置
+ saveConfig() {
+ this.$refs.configForm.validate(valid => {
+ if (!valid) {
+ return;
}
+ this.saving = true;
+ const data = {
+ Id: this.form.id,
+ SystemName: this.form.systemName
+ };
+ service.post("/Admin/SystemConfig/Edit?handler=Save", data).then(res => {
+ if (res.data.success) {
+ this.$notify({
+ title: "Success",
+ message: "更新成功!",
+ type: "success",
+ duration: 2000
+ });
+ this.isEditing = false;
+ this.getConfig();
+ } else {
+ this.$notify({
+ title: "Failed",
+ message: "更新失败:" + (res.data.msg || ''),
+ type: "error",
+ duration: 2000
+ });
+ }
+ }).finally(() => {
+ this.saving = false;
+ });
});
- },
+ }
}
});
-
-
-
- {{ scope.row.systemName}}
-
-
-
-
- {{ scope.row.hideModuleManager }}
-
-
-
-
-
+
基础信息
- -
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 基础信息
+系统的基础配置,仅管理员可编辑。
+
+ 编辑
-
-
-
- @* *@
-
-
-
- @*
-
-
-
-
-
- 不建议修改用户名!
*@ -
- 取 消
- 确 认
+ @@click="startEdit">编辑
+
+ 取消
+ 保存
+
+
+
+ {{ form.hideModuleManager ? '隐藏模块管理(仅运行已发布模块)' : '显示模块管理(允许管理模块)' }}
+
+
+