diff --git a/src/assets/sass/public.scss b/src/assets/sass/public.scss index fc7fed9..8519881 100644 --- a/src/assets/sass/public.scss +++ b/src/assets/sass/public.scss @@ -238,3 +238,20 @@ body .el-collapse-item__wrap { .el-card{ border-radius: 10px; } + + +.danger{ + color: #F56C6C!important; + & :disabled{ + color: rgba(0,0,0,.25); + } + & :hover{ + color: #dd6161; + } + & :focus{ + color: #dd6161; + } + & :active{ + color: #dd6161; + } +} diff --git a/src/components/RenderLoading/loading/index.js b/src/components/RenderLoading/loading/index.js new file mode 100644 index 0000000..6d28faf --- /dev/null +++ b/src/components/RenderLoading/loading/index.js @@ -0,0 +1,11 @@ +import directive from './src/directive'; +import service from './src/index'; + +export default { + install(Vue) { + Vue.use(directive); + Vue.prototype.$loading = service; + }, + directive, + service +}; diff --git a/src/components/RenderLoading/loading/src/directive.js b/src/components/RenderLoading/loading/src/directive.js new file mode 100644 index 0000000..f4400fe --- /dev/null +++ b/src/components/RenderLoading/loading/src/directive.js @@ -0,0 +1,133 @@ +import Vue from 'vue'; +import Loading from './loading.vue'; +import { addClass, removeClass, getStyle } from 'element-ui/src/utils/dom'; +import { PopupManager } from 'element-ui/src/utils/popup'; +import afterLeave from 'element-ui/src/utils/after-leave'; +const Mask = Vue.extend(Loading); + +const loadingDirective = {}; +loadingDirective.install = Vue => { + if (Vue.prototype.$isServer) return; + const toggleLoading = (el, binding) => { + if (binding.value) { + Vue.nextTick(() => { + if (binding.modifiers.fullscreen) { + el.originalPosition = getStyle(document.body, 'position'); + el.originalOverflow = getStyle(document.body, 'overflow'); + el.maskStyle.zIndex = PopupManager.nextZIndex(); + + addClass(el.mask, 'is-fullscreen'); + insertDom(document.body, el, binding); + } else { + removeClass(el.mask, 'is-fullscreen'); + + if (binding.modifiers.body) { + el.originalPosition = getStyle(document.body, 'position'); + + ['top', 'left'].forEach(property => { + const scroll = property === 'top' ? 'scrollTop' : 'scrollLeft'; + el.maskStyle[property] = el.getBoundingClientRect()[property] + + document.body[scroll] + + document.documentElement[scroll] - + parseInt(getStyle(document.body, `margin-${ property }`), 10) + + 'px'; + }); + ['height', 'width'].forEach(property => { + el.maskStyle[property] = el.getBoundingClientRect()[property] + 'px'; + }); + + insertDom(document.body, el, binding); + } else { + el.originalPosition = getStyle(el, 'position'); + insertDom(el, el, binding); + } + } + }); + } else { + afterLeave(el.instance, _ => { + if (!el.instance.hiding) return; + el.domVisible = false; + const target = binding.modifiers.fullscreen || binding.modifiers.body + ? document.body + : el; + removeClass(target, 'el-loading-parent--relative'); + removeClass(target, 'el-loading-parent--hidden'); + el.instance.hiding = false; + }, 300, true); + el.instance.visible = false; + el.instance.hiding = true; + } + }; + const insertDom = (parent, el, binding) => { + if (!el.domVisible && getStyle(el, 'display') !== 'none' && getStyle(el, 'visibility') !== 'hidden') { + Object.keys(el.maskStyle).forEach(property => { + el.mask.style[property] = el.maskStyle[property]; + }); + + if (el.originalPosition !== 'absolute' && el.originalPosition !== 'fixed') { + addClass(parent, 'el-loading-parent--relative'); + } + if (binding.modifiers.fullscreen && binding.modifiers.lock) { + addClass(parent, 'el-loading-parent--hidden'); + } + el.domVisible = true; + + parent.appendChild(el.mask); + Vue.nextTick(() => { + if (el.instance.hiding) { + el.instance.$emit('after-leave'); + } else { + el.instance.visible = true; + } + }); + el.domInserted = true; + } else if (el.domVisible && el.instance.hiding === true) { + el.instance.visible = true; + el.instance.hiding = false; + } + }; + + Vue.directive('loading', { + bind: function(el, binding, vnode) { + const textExr = el.getAttribute('element-loading-text'); + const spinnerExr = el.getAttribute('element-loading-spinner'); + const backgroundExr = el.getAttribute('element-loading-background'); + const customClassExr = el.getAttribute('element-loading-custom-class'); + const vm = vnode.context; + const mask = new Mask({ + el: document.createElement('div'), + data: { + text: vm && vm[textExr] || textExr, + spinner: vm && vm[spinnerExr] || spinnerExr, + background: vm && vm[backgroundExr] || backgroundExr, + customClass: vm && vm[customClassExr] || customClassExr, + fullscreen: !!binding.modifiers.fullscreen + } + }); + el.instance = mask; + el.mask = mask.$el; + el.maskStyle = {}; + + binding.value && toggleLoading(el, binding); + }, + + update: function(el, binding) { + el.instance.setText(el.getAttribute('element-loading-text')); + if (binding.oldValue !== binding.value) { + toggleLoading(el, binding); + } + }, + + unbind: function(el, binding) { + if (el.domInserted) { + el.mask && + el.mask.parentNode && + el.mask.parentNode.removeChild(el.mask); + toggleLoading(el, { value: false, modifiers: binding.modifiers }); + } + el.instance && el.instance.$destroy(); + } + }); +}; + +export default loadingDirective; diff --git a/src/components/RenderLoading/loading/src/index.js b/src/components/RenderLoading/loading/src/index.js new file mode 100644 index 0000000..97e175d --- /dev/null +++ b/src/components/RenderLoading/loading/src/index.js @@ -0,0 +1,106 @@ +import Vue from 'vue'; +import loadingVue from './loading.vue'; +import { addClass, removeClass, getStyle } from 'element-ui/src/utils/dom'; +import { PopupManager } from 'element-ui/src/utils/popup'; +import afterLeave from 'element-ui/src/utils/after-leave'; +import merge from 'element-ui/src/utils/merge'; + +const LoadingConstructor = Vue.extend(loadingVue); + +const defaults = { + text: null, + fullscreen: true, + body: false, + lock: false, + customClass: '' +}; + +let fullscreenLoading; + +LoadingConstructor.prototype.originalPosition = ''; +LoadingConstructor.prototype.originalOverflow = ''; + +LoadingConstructor.prototype.close = function() { + if (this.fullscreen) { + fullscreenLoading = undefined; + } + afterLeave(this, _ => { + const target = this.fullscreen || this.body + ? document.body + : this.target; + removeClass(target, 'el-loading-parent--relative'); + removeClass(target, 'el-loading-parent--hidden'); + if (this.$el && this.$el.parentNode) { + this.$el.parentNode.removeChild(this.$el); + } + this.$destroy(); + }, 300); + this.visible = false; +}; + +const addStyle = (options, parent, instance) => { + let maskStyle = {}; + if (options.fullscreen) { + instance.originalPosition = getStyle(document.body, 'position'); + instance.originalOverflow = getStyle(document.body, 'overflow'); + maskStyle.zIndex = PopupManager.nextZIndex(); + } else if (options.body) { + instance.originalPosition = getStyle(document.body, 'position'); + ['top', 'left'].forEach(property => { + let scroll = property === 'top' ? 'scrollTop' : 'scrollLeft'; + maskStyle[property] = options.target.getBoundingClientRect()[property] + + document.body[scroll] + + document.documentElement[scroll] + + 'px'; + }); + ['height', 'width'].forEach(property => { + maskStyle[property] = options.target.getBoundingClientRect()[property] + 'px'; + }); + } else { + instance.originalPosition = getStyle(parent, 'position'); + } + Object.keys(maskStyle).forEach(property => { + instance.$el.style[property] = maskStyle[property]; + }); +}; + +const Loading = (options = {}) => { + if (Vue.prototype.$isServer) return; + options = merge({}, defaults, options); + if (typeof options.target === 'string') { + options.target = document.querySelector(options.target); + } + options.target = options.target || document.body; + if (options.target !== document.body) { + options.fullscreen = false; + } else { + options.body = true; + } + if (options.fullscreen && fullscreenLoading) { + return fullscreenLoading; + } + + let parent = options.body ? document.body : options.target; + let instance = new LoadingConstructor({ + el: document.createElement('div'), + data: options + }); + + addStyle(options, parent, instance); + if (instance.originalPosition !== 'absolute' && instance.originalPosition !== 'fixed') { + addClass(parent, 'el-loading-parent--relative'); + } + if (options.fullscreen && options.lock) { + addClass(parent, 'el-loading-parent--hidden'); + } + parent.appendChild(instance.$el); + Vue.nextTick(() => { + instance.visible = true; + }); + if (options.fullscreen) { + fullscreenLoading = instance; + } + return instance; +}; + +export default Loading; diff --git a/src/components/RenderLoading/loading/src/loading.vue b/src/components/RenderLoading/loading/src/loading.vue new file mode 100644 index 0000000..8d4ad65 --- /dev/null +++ b/src/components/RenderLoading/loading/src/loading.vue @@ -0,0 +1,44 @@ + + + + + + + + + + + + + + + + + + diff --git a/src/components/RenderLoading/loading/src/pig.vue b/src/components/RenderLoading/loading/src/pig.vue new file mode 100644 index 0000000..72ab65f --- /dev/null +++ b/src/components/RenderLoading/loading/src/pig.vue @@ -0,0 +1,622 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Loading... + + + + + + + + diff --git a/src/components/progress/progress.vue b/src/components/progress/progress.vue new file mode 100644 index 0000000..1bf8992 --- /dev/null +++ b/src/components/progress/progress.vue @@ -0,0 +1 @@ + diff --git a/src/router/generatedRouter/index.js b/src/router/generatedRouter/index.js index af06d39..f6fed76 100644 --- a/src/router/generatedRouter/index.js +++ b/src/router/generatedRouter/index.js @@ -45,6 +45,18 @@ export default [ icon: "el-icon-s-home" }, children: [ + { + path: '/knowledge/knowledge-create', + name: 'knowledge-create', + component: () => import('@/views/knowledge/detail/components/knowledgeForm.vue'), + meta: { + breadcrumb:false, + title: '知识库详情', + icon: 'el-icon-s-home', + }, + }, + + { path: "/knowledge/detail", name: "detail", diff --git a/src/views/knowledge/detail/components/knowledgeForm.vue b/src/views/knowledge/detail/components/knowledgeForm.vue new file mode 100644 index 0000000..61c192b --- /dev/null +++ b/src/views/knowledge/detail/components/knowledgeForm.vue @@ -0,0 +1,107 @@ + + + + + 新增知识库 + + + + + + + + + + + + + + + 通用分段模式 + Q&A分段模式 + + + + + + + 创建 + 取消 + + + + + + + + + + + + + + + diff --git a/src/views/knowledge/detail/components/knowledgeResult.vue b/src/views/knowledge/detail/components/knowledgeResult.vue new file mode 100644 index 0000000..61c192b --- /dev/null +++ b/src/views/knowledge/detail/components/knowledgeResult.vue @@ -0,0 +1,107 @@ + + + + + 新增知识库 + + + + + + + + + + + + + + + 通用分段模式 + Q&A分段模式 + + + + + + + 创建 + 取消 + + + + + + + + + + + + + + + diff --git a/src/views/knowledge/detail/index.vue b/src/views/knowledge/detail/index.vue index 1abb7f4..9295560 100644 --- a/src/views/knowledge/detail/index.vue +++ b/src/views/knowledge/detail/index.vue @@ -1,24 +1,61 @@ - + - 监管法规知识库 - - 描述: - - - 分段模式: - - 修改知识库 - 上传知识 + {{ knowledgeName }} + 描述:{{ knowledgeDesc }} + 分段模式:{{ segmentedMode }} + 修改知识库 + 上传知识 - - - - 立即添加 + + + + 立即添加 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 查询 + 重置 + + + + + + + 11. @@ -26,26 +63,76 @@ export default { name: 'index', data() { - return {} + return { + form: {}, + //知识库名称 + knowledgeName: '监管', + knowledgeDesc: '监管', + segmentedMode: '分段模式', + list: [{}] + } }, props: {}, watch: {}, components: {}, filters: {}, methods: { - handleAddKnowledge(){ + // 跳转 + handleAddKnowledge() { this.$router.push({ path: '/knowledge/detail/create' }) }, + + /** + * @name 根据id 获取知识内容详情 + * @author Chen Yuda + * @created_date 2025/4/9 + * @description + **/ + getKnowledgeDetail() {} }, - created() { - }, - mounted() { - }, - computed: {} + created() {}, + mounted() {}, + computed: { + columns() { + return [ + { + key: '知识文件名称', + prop: 'knowledgeName', + width: '200px', + align: 'center', + render: (h, params) => { + return h('div', [h('span', params.row.knowledgeName)]) + } + }, + { + key: '知识文件来源', + prop: 'knowledgeDesc' + }, + { + key: '召回次数', + prop: 'knowledgeDesc' + }, + { + key: '上传用户', + prop: 'knowledgeDesc' + }, + { + key: '上传时间', + prop: 'knowledgeDesc' + }, + { + key: '操作', + prop: 'knowledgeDesc', + width: '200px', + render: (h, params) => { + return h('div', [h('span', params.row.knowledgeDesc)]) + } + } + ] + } + } } - + diff --git a/src/views/knowledge/index.vue b/src/views/knowledge/index.vue index c1ccd20..b9d7dc4 100644 --- a/src/views/knowledge/index.vue +++ b/src/views/knowledge/index.vue @@ -12,14 +12,18 @@ - - + + - 新增知识库 + + + 新增知识库 + + @@ -33,47 +37,70 @@ - 查看详情 + 查看详情 修改 - 删除 + 删除 - - -
- 描述: -
- 分段模式: -
描述:{{ knowledgeDesc }}
分段模式:{{ segmentedMode }}