|
@@ -279,6 +279,8 @@
|
|
|
:disable="state.disable"
|
|
|
placeholder="请填写知识内容"
|
|
|
@blur="isRepeat('content')"
|
|
|
+ :defaultContent="defaultContent"
|
|
|
+ ref="editorRef"
|
|
|
/>
|
|
|
</el-form-item>
|
|
|
</template>
|
|
@@ -325,7 +327,7 @@
|
|
|
</template>
|
|
|
|
|
|
<script setup lang="ts" name="knowledgeEdit">
|
|
|
-import { defineAsyncComponent, onMounted, reactive, ref } from 'vue';
|
|
|
+import { defineAsyncComponent, nextTick, onMounted, reactive, ref } from 'vue';
|
|
|
import type { FormInstance } from 'element-plus';
|
|
|
import { ElMessage } from 'element-plus';
|
|
|
import mittBus from '@/utils/mitt';
|
|
@@ -418,6 +420,14 @@ const isRepeat = (type: string) => {
|
|
|
});
|
|
|
}
|
|
|
};
|
|
|
+// 默认配置
|
|
|
+const defaultContent = ref([
|
|
|
+ {
|
|
|
+ type: "paragraph",
|
|
|
+ children: [ { text: '', fontFamily: '仿宋', fontSize: '20px' },],
|
|
|
+ lineHeight: '1',
|
|
|
+ },
|
|
|
+])
|
|
|
// 展示编写规范
|
|
|
const KnowledgeStandardRef = ref<RefType>();
|
|
|
const showStandard = () => {
|
|
@@ -591,12 +601,14 @@ const getKnowledgeType = async () => {
|
|
|
state.typeData = typeDataRes.result ?? [];
|
|
|
state.knowledgeOptions = knowledgeOptionsRes.result ?? [];
|
|
|
orgsOptions.value = orgsOptionsRes.result ?? [];
|
|
|
- await getDetail();
|
|
|
+
|
|
|
state.loading = false;
|
|
|
} catch (error) {
|
|
|
+ console.log(error)
|
|
|
state.loading = false;
|
|
|
}
|
|
|
};
|
|
|
+const editorRef = ref<RefType>();
|
|
|
const getDetail = async () => {
|
|
|
if (route.params.id) {
|
|
|
const res: any = await KnowledgeInfo(route.params.id); //知识详情
|
|
@@ -611,9 +623,12 @@ const getDetail = async () => {
|
|
|
state.ruleForm.keywordsName = state.ruleForm.keywordsDto.map((item: any) => item.tag).join(',');
|
|
|
}
|
|
|
state.ruleForm.knowledgeTypeId = state.ruleForm.knowledgeType.map((item: any) => item.knowledgeTypeId);
|
|
|
+
|
|
|
}
|
|
|
};
|
|
|
-onMounted(() => {
|
|
|
- getKnowledgeType();
|
|
|
+onMounted(async () => {
|
|
|
+ await getKnowledgeType();
|
|
|
+ await nextTick();
|
|
|
+ await getDetail();
|
|
|
});
|
|
|
</script>
|