From 2fb5713f6542664374e8a5c0305952aa478b82b2 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E6=9D=8E=E6=83=B3?= <826276471@qq.com>
Date: Wed, 19 Mar 2025 17:21:23 +0800
Subject: [PATCH] =?UTF-8?q?feat:=E7=9F=A5=E8=AF=86=E7=AE=A1=E7=90=86?=
=?UTF-8?q?=E9=A1=B5=E9=9D=A2=E6=8E=A5=E5=8F=A3=E5=AF=B9=E6=8E=A5=E5=AE=8C?=
=?UTF-8?q?=E6=88=90?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
main/src/apis/common/index.js | 15 +++
.../components/custom-rich-editor/index.vue | 25 ++--
.../components/custom-rich-editor/upFile.js | 10 ++
.../src/apis/inputSuppliesApi/index.js | 2 +-
.../src/apis/inputSuppliesApi/knowledge.js | 11 +-
.../src/apis/inputSuppliesApi/material.js | 3 +-
.../knowledgeManage/index.vue | 119 +++++++++++-------
7 files changed, 116 insertions(+), 69 deletions(-)
create mode 100644 main/src/apis/common/index.js
create mode 100644 main/src/components/custom-rich-editor/upFile.js
diff --git a/main/src/apis/common/index.js b/main/src/apis/common/index.js
new file mode 100644
index 0000000..1890406
--- /dev/null
+++ b/main/src/apis/common/index.js
@@ -0,0 +1,15 @@
+import request from '@/utils/axios';
+
+/**
+ * @Title: 上传图片
+ */
+export function CommonUpload(data, params) {
+ return request({
+ url: `/upload`,
+ method: 'POST',
+ apisType: 'upload',
+ uploadType: 'multipart/form-data',
+ data,
+ params,
+ });
+}
diff --git a/main/src/components/custom-rich-editor/index.vue b/main/src/components/custom-rich-editor/index.vue
index 1e4bad9..6cca864 100644
--- a/main/src/components/custom-rich-editor/index.vue
+++ b/main/src/components/custom-rich-editor/index.vue
@@ -7,7 +7,7 @@
-->
-
-
+
+
@@ -28,6 +35,8 @@
import { ref, reactive, onMounted, h } from 'vue';
import CustomCard from '@/components/CustomCard.vue';
import { CRUD_OPTIONS } from '@/config';
+import inputSuppliesApi from '@/apis/inputSuppliesApi';
+import { ElMessage } from 'element-plus';
onMounted(getData);
/* --------------- data --------------- */
@@ -36,19 +45,19 @@ const curdRef = ref();
const _loading = ref(false);
const data = ref([]);
const searchCondition = ref({
- keywords: '',
+ problemName: '',
status: '',
});
const option = reactive({
...CRUD_OPTIONS,
addBtn: false,
selection: false,
- dialogWidth: 800,
+ dialogWidth: '60%',
editTitle: '回复',
column: [
{
label: '关键词',
- prop: 'keywords',
+ prop: 'problemName',
hide: true,
search: true,
editDisplay: false,
@@ -69,47 +78,46 @@ const option = reactive({
},
{
label: '名称',
- prop: 'question',
+ prop: 'problemName',
renderForm: ({ row }) => {
- console.log('row ---', row);
- return h('span', {}, row.question);
+ return h('span', {}, row.problemName);
},
span: 24,
},
{
label: '提问时间',
- prop: 'questionDate',
+ prop: 'createTime',
viewDisplay: false,
renderForm: ({ row }) => {
- return h('span', {}, row.questionDate);
+ return h('span', {}, row.createTime);
},
span: 24,
},
+ {
+ hide: true,
+ label: '回复内容',
+ prop: 'replyContent',
+ span: 24,
+ },
{
label: '专家姓名',
prop: 'expertName',
editDisplay: false,
- viewDisplay: false,
+ span: 24,
},
{
label: '回复时间',
- prop: 'replyDate',
+ prop: 'updateTime',
editDisplay: false,
- viewDisplay: false,
- },
- {
- label: '回复内容Text',
- prop: 'replyContentText',
- editDisplay: false,
- viewDisplay: false,
- },
- {
- hide: true,
- label: '回复内容',
- prop: 'replyContent',
- viewDisplay: false,
span: 24,
},
+ // {
+ // label: '回复内容Text',
+ // prop: 'replyContentText',
+ // editDisplay: false,
+ // viewDisplay: false,
+ // render: ({ row }) => row.replyContent,
+ // },
],
});
const pageData = reactive({
@@ -136,7 +144,8 @@ const richText = ref();
/* --------------- methods --------------- */
// #region
-function getData() {
+async function getData() {
+ _loading.value = true;
let params = Object.assign(
{
currentPage: pageData.currentPage,
@@ -144,19 +153,23 @@ function getData() {
},
searchCondition.value
);
- console.log('params', params);
-
- for (let i = 0; i < 13; i++) {
- data.value.push({
- id: i + Date.now(),
- question: '我是问题' + i,
- questionDate: '2022-01-01',
- expertName: '专家' + i,
- replyDate: '2022-01-01',
- replyContent: `- ${i}${i}${i}${i}${i}
333
4534
`,
- status: !(i % 2) ? '0' : '1',
- });
+ let res = await inputSuppliesApi.getQuestionList(params);
+ _loading.value = false;
+ if (res.code == 200) {
+ data.value = res.data.records;
+ pageData.total = res.data.total;
}
+ // for (let i = 0; i < 13; i++) {
+ // data.value.push({
+ // id: i + Date.now(),
+ // problemName: '我是问题' + i,
+ // createTime: '2022-01-01',
+ // expertName: '专家' + i,
+ // updateTime: '2022-01-01',
+ // replyContent: `- ${i}${i}${i}${i}${i}
333
4534
`,
+ // status: !(i % 2) ? '0' : '1',
+ // });
+ // }
}
function handleSearch(form, done) {
resetGet();
@@ -166,31 +179,45 @@ function handleSearchReset() {
resetGet();
}
function handleCurrentChange(val) {
- console.log(val);
+ pageData.currentPage = val;
+ getData();
}
function handleSizeChange(val) {
- console.log(val);
+ pageData.size = val;
+ resetGet();
}
-function handleRowUpdate(form, done, loading) {
- console.log('rich', richText.value);
- console.log('update ', form);
+async function handleRowUpdate(form, index, done, loading) {
+ let data = {
+ id: form.id,
+ replyContent: richText.value,
+ };
+ let res = await inputSuppliesApi.getQuestionReply(data);
loading();
+ if (res.code == 200) {
+ ElMessage.success('回复成功!');
+ getData();
+ done();
+ }
}
+
function handleRowSave(form, done, loading) {
loading();
}
function resetGet() {
pageData.currentPage = 1;
- getData;
+ getData();
}
function handleReply({ row }) {
- console.log('reply', row);
curdRef.value.rowEdit(row);
}
function handleInfo({ row }) {
- console.log('info', row);
+ richText.value = row.replyContent;
curdRef.value.rowView(row);
}
+function handleDialogClose(done) {
+ richText.value = '';
+ done();
+}
// #endregion