Selaa lähdekoodia

富文本图片上传

wangziqian 5 vuotta sitten
vanhempi
sitoutus
1c1c1e5966

+ 18 - 2
src/components/input/textArea.vue

@@ -1,6 +1,12 @@
 <template>
   <div>
-    <article :id="id">
+    <article
+      :id="id"
+      v-loading="loading"
+      element-loading-text="数据上传中,请稍后"
+      element-loading-spinner="el-icon-loading"
+      element-loading-background="rgba(0, 0, 0, 0.8)"
+    >
       <div v-show="isEmpty && !edit" class="text-edit">
         {{ emptyText }}
         <el-button type="text" @click="ImmediateAddition">{{ inputButton }}</el-button>
@@ -22,6 +28,7 @@
   </div>
 </template>
 <script>
+import { getContainImgHTMLNode } from '@/utils/handleTinymce'
 import tinymce from 'tinymce/tinymce'
 import Editor from '@tinymce/tinymce-vue'
 import 'tinymce/themes/silver/theme'
@@ -60,6 +67,7 @@ export default {
   },
   data() {
     return {
+      loading: false,
       inputValue: '',
       edit: false,
       init: {
@@ -114,8 +122,16 @@ export default {
     changeText(e) { // 富文本内容改变
       this.inputValue = e
     },
-    blur_textarea() {
+    async blur_textarea() {
       if (this.edit) {
+        this.loading = true
+        try {
+          this.inputValue = await getContainImgHTMLNode(this.inputValue)
+        } catch (error) {
+          this.loading = false
+          throw error
+        }
+        this.loading = false
         this.edit = false
         this.$emit('update:value', this.inputValue)
         this.$emit('change', this.inputValue)

+ 16 - 2
src/views/projectManage/taskList/childrenTask/createChildren.vue

@@ -1,10 +1,14 @@
 <template>
   <normal-dialog
+    v-loading="loading"
     :show-dialog.sync="show"
     title="新建子任务"
     :is-default-close="false"
     submit-button="创建"
     width="65%"
+    element-loading-text="数据上传中,请稍后"
+    element-loading-spinner="el-icon-loading"
+    element-loading-background="rgba(0, 0, 0, 0.8)"
     @confirm="confirmForm()"
     @cancel="cancel()"
   >
@@ -88,6 +92,7 @@ import searchPeople from '@/components/select/searchPeople'
 import normalDialog from '@/components/dialog/normalDialog'
 import normalArea from '@/components/input/normalArea'
 import addChildrenList from './addChildrenList'
+import { getContainImgHTMLNode } from '@/utils/handleTinymce'// 富文本本图片转换
 export default {
   components: {
     addChildrenList,
@@ -146,7 +151,8 @@ export default {
         { code: 1, msg: '进行中' },
         { code: 2, msg: '已上线' }
       ], // 任务所有状态
-      childrenList: [] // 子任务列表
+      childrenList: [], // 子任务列表
+      loading: false // loading状态
     }
   },
   watch: {
@@ -223,7 +229,7 @@ export default {
         this.$message({ message: '存在未确认的子任务', type: 'error', duration: 1000, offset: 150 })
         return false
       }
-      this.$refs['form'].validate((valid) => {
+      this.$refs['form'].validate(async(valid) => {
         if (valid) {
           const params = _.cloneDeep(this.formData)
           params.process = Number(params.process)
@@ -234,6 +240,14 @@ export default {
             return { ...item }
           })
           params.participants = params.participants.join()
+          this.loading = true
+          try {
+            this.formData.remark = await getContainImgHTMLNode(this.formData.remark)
+          } catch (error) {
+            this.loading = false
+            throw error
+          }
+          this.loading = false
           this.createChildren(params)
         }
       })

+ 1 - 1
src/views/reportManagement/daily/dailyTemplate.vue

@@ -47,7 +47,7 @@ import normalArea from '@/components/input/normalArea'
 import { taskList as allTaskList } from '@/api/taskIndex'
 import iconDisplay from '@/views/reportManagement/daily/components/iconDisplay.vue'
 import { settingGetReportModuleById, dailyReportCreate, dailyReportUpdate } from '@/api/reportTemplate' // 模版添删改查
-import { getContainImgHTMLNode } from '@/utils/handleTinymce'
+import { getContainImgHTMLNode } from '@/utils/handleTinymce' // 富文本本图片转换
 
 export default {
   name: 'DailyNewsAdded',

+ 18 - 3
src/views/reportManagement/daily/newReportTemplate.vue

@@ -1,6 +1,11 @@
 <template>
   <!-- 新建报告模版 -->
-  <div>
+  <div
+    v-loading="loading"
+    element-loading-text="数据上传中,请稍后"
+    element-loading-spinner="el-icon-loading"
+    element-loading-background="rgba(0, 0, 0, 0.8)"
+  >
     <el-form ref="fromCreateData" :model="fromCreateData" :rules="serviceDataRules">
       <el-form-item label="模版名称" prop="moduleName" label-width="80px">
         <el-input v-model="fromCreateData.moduleName" size="small" style="width:100%;" placeholder="请输入模版名称(不可与现有模版重名)" />
@@ -54,6 +59,7 @@ import echarts from 'echarts'
 import normalArea from '@/components/input/normalArea' // 富文本
 import 'tinymce/plugins/table'// 插入表格插件
 import { settingAddReportModule, settingUpdateReportModule, settingGetReportModuleById } from '@/api/reportTemplate' // 模版添删改查
+import { getContainImgHTMLNode } from '@/utils/handleTinymce'// 富文本本图片转换
 
 export default {
   components: {
@@ -71,7 +77,8 @@ export default {
         moduleName: [{ required: true, message: '模版名称不能为空', trigger: 'change' }]
       },
       fromCreateData: {},
-      TLstatus: false // 模版状态
+      TLstatus: false, // 模版状态
+      loading: false // loading状态
     }
   },
   watch: {
@@ -121,10 +128,18 @@ export default {
 
     // 新建模版
     getCreateData(e) {
-      this.$refs['fromCreateData'].validate((valid) => {
+      this.$refs['fromCreateData'].validate(async(valid) => {
         if (valid) {
           this.fromCreateData.bizId = localStorage.getItem('bizId')
           this.fromCreateData.type = e
+          this.loading = true
+          try {
+            this.fromCreateData.content = await getContainImgHTMLNode(this.fromCreateData.content)
+          } catch (error) {
+            this.loading = false
+            throw error
+          }
+          this.loading = false
           if (this.tpltId) {
             settingUpdateReportModule(this.fromCreateData).then(res => {
               if (res.code === 200) {