Merge branch 'zhipeng_dev' into shenzhen-dev
This commit is contained in:
commit
42444adfab
@ -18,7 +18,6 @@
|
||||
import { QuillEditor } from "@vueup/vue-quill";
|
||||
import "@vueup/vue-quill/dist/vue-quill.snow.css";
|
||||
import { reactive, onMounted, ref, toRaw, watch } from "vue";
|
||||
// import { backsite } from '@/api'
|
||||
import { upload } from "@/api/modules/upload";
|
||||
|
||||
const props = defineProps(["value"]);
|
||||
@ -30,17 +29,22 @@ const clearText = () => {
|
||||
toRaw(myQuillEditor.value).setHTML("");
|
||||
};
|
||||
|
||||
defineExpose<{ clearText: typeof clearText }>({ clearText });
|
||||
const setText = val => {
|
||||
toRaw(myQuillEditor.value).setHTML(val);
|
||||
};
|
||||
|
||||
defineExpose<{ clearText: typeof clearText; setText: typeof setText }>({ clearText, setText });
|
||||
|
||||
const myQuillEditor = ref();
|
||||
watch(
|
||||
() => props.value,
|
||||
val => {
|
||||
// console.log(toRaw(myQuillEditor.value));
|
||||
toRaw(myQuillEditor.value).getHTML(val);
|
||||
},
|
||||
{ deep: true }
|
||||
);
|
||||
|
||||
// watch(
|
||||
// () => props.value,
|
||||
// val => {
|
||||
// console.log(toRaw(myQuillEditor.value));
|
||||
// toRaw(myQuillEditor.value).setHTML(val);
|
||||
// }
|
||||
// );
|
||||
|
||||
const fileBtn = ref();
|
||||
const data = reactive({
|
||||
content: "",
|
||||
@ -98,6 +102,7 @@ onMounted(() => {
|
||||
if (myQuillEditor.value) {
|
||||
quill.getModule("toolbar").addHandler("image", imgHandler);
|
||||
}
|
||||
|
||||
toRaw(myQuillEditor.value).setHTML(props.value);
|
||||
});
|
||||
</script>
|
||||
|
||||
@ -115,11 +115,13 @@ const confirm = async (formEl: FormInstance | undefined, params: any) => {
|
||||
if (store.Message != undefined) {
|
||||
await editmyPost(formData.value);
|
||||
ElMessage.success("编辑成功");
|
||||
editorRef.value?.clearText();
|
||||
delete store.Message;
|
||||
} else {
|
||||
try {
|
||||
const res = await addLows(formData.value);
|
||||
ElMessage.success("发布成功");
|
||||
editorRef.value?.clearText();
|
||||
} catch (err) {}
|
||||
// 清空富文本
|
||||
editorRef.value?.clearText();
|
||||
@ -156,6 +158,7 @@ onMounted(async () => {
|
||||
annexFileList.value = [];
|
||||
if (store.Message) {
|
||||
formData.value = store.Message as formDataType;
|
||||
editorRef.value.setText(formData.value.content);
|
||||
// 备注一个
|
||||
annexFileList.value = [
|
||||
{ name: store.Message.annexFileList[0].fileName || null, url: store.Message.annexFileList[0].fileUrl || null }
|
||||
|
||||
@ -83,9 +83,15 @@ onMounted(async () => {
|
||||
if (store.Message && store.Message.engineeringMains.length) {
|
||||
formData.value = formData.value.map(item => {
|
||||
// console.log("main", store.Message.engineeringMains);
|
||||
const curr = store.Message.engineeringMains.find(main => item.type == main.type);
|
||||
let curr = store.Message.engineeringMains.find(main => item.type == main.type);
|
||||
if ("contractType" in item) {
|
||||
return curr;
|
||||
return (curr = {
|
||||
enterpriseSn: curr.enterpriseName,
|
||||
creditCode: curr.creditCode,
|
||||
legalPerson: curr.legalPerson,
|
||||
legalPersonTel: curr.legalPersonTel,
|
||||
contractType: curr.contractType
|
||||
});
|
||||
} else {
|
||||
delete curr["contractType"];
|
||||
return curr;
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user