戴艳蓉 3 years ago
parent
commit
7758f6cb6c

+ 7 - 3
src/views/purchaseAndSale/adjust/addEdit.vue

@@ -79,9 +79,7 @@
 import asyncRequest from "@/apis/service/purchaseAndSale/adjust";
 import resToken from "@/mixins/resToken";
 import Tinymce from "@/components/Tinymce";
-import {
- platformType,
-} from "./columns";
+import { platformType } from "./columns";
 export default {
   name: "adjust",
   props: ["showModel", "id", "isDetail", "sitem"],
@@ -183,6 +181,12 @@ export default {
           this.loading = true;
           let model = JSON.parse(JSON.stringify(this.ruleForm));
           model.model_id = model.model_id.toString();
+          let length = 5000;
+          if (model.remark.length > length) {
+            this.$message.warning("描述文字及标签总长度不能超过5000!");
+            this.loading = false;
+            return;
+          }
           let res = await asyncRequest.add(model);
           this.loading = false;
           if (res && res.code === 0) {

+ 34 - 19
src/views/purchaseAndSale/adjust/comModule.vue

@@ -22,7 +22,7 @@ import urlConfig from "@/apis/url-config";
 import { getToken } from "@/utils/auth";
 export default {
   name: "comModule",
-  
+
   mixins: [resToken],
   props: ["id", "value"],
   data() {
@@ -44,6 +44,9 @@ export default {
       event.stopPropagation();
       let focusOffset = 0;
       let anchorOffset = 0;
+      let einput = this.$refs.txt1.innerHTML || "";
+      const typeList = ["image/jpg", "image/png", "image/jpeg"];
+      let len = einput.length;
       if (
         window.getSelection().focusOffset <= window.getSelection().anchorOffset
       ) {
@@ -53,25 +56,33 @@ export default {
         focusOffset = window.getSelection().anchorOffset;
         anchorOffset = window.getSelection().focusOffset;
       }
-
+      console.log(focusOffset, anchorOffset, len);
+      let left = "",
+        right = "";
+      if (focusOffset !== 0) {
+        left = einput.slice(0, focusOffset);
+      }
+      if (anchorOffset !== len) {
+        right = einput.slice(anchorOffset);
+      }
       const items = (event.clipboardData || window.clipboardData).items;
       let file = null;
-
+      let findex = -1;
       if (!items || items.length === 0) {
         this.$message.error("当前浏览器不支持本地或请打开图片再复制");
         return;
       }
-      let typeList = ["image/jpg", "image/png", "image/jpeg"];
-      // 搜索剪切板items
       for (let i = 0; i < items.length; i++) {
-        items[i].getAsFileSystemHandle().then((re) => {
-          console.log(re);
-        });
-
-        let index = typeList.findIndex((v) => v == items[i].type);
-        if (index !== -1) {
-          file = items[i].getAsFile();
-          break;
+        if (items[i].type === "text/plain") {
+          let clipboardData = event.clipboardData || window.clipboardData;
+          let pastedData = clipboardData.getData("Text");
+          this.input = `${left}${pastedData}${right}`;
+        } else {
+          findex = typeList.findIndex((v) => v == items[i].type);
+          if (findex !== -1) {
+            file = items[i].getAsFile();
+            break;
+          }
         }
       }
       if (!file) {
@@ -88,13 +99,11 @@ export default {
         await this.logout();
       } else {
         const { name, url } = res;
-        this.input = `${this.input.slice(
-          0,
-          focusOffset
-        )}<img style='display: inline-block;max-width: 100%;height: auto;' src='${url}'/>${this.input.slice(
-          anchorOffset
-        )}`;
+        this.input = `${left}<img style='display: inline-block;max-width: 50%;' src='${url}'/>${right}`;
       }
+      // console.log(left);
+      // console.log(right);
+      // console.log(this.input);
     },
 
     async httpupLoad(file) {
@@ -132,7 +141,13 @@ export default {
     async submitForm() {
       this.loading = true;
       let str = this.$refs.txt1.innerHTML;
+      let length = 2000;
       if (str) {
+        if (str.length > length) {
+          this.$message.warning("评论文字及图片总长度不能超过2000!");
+          this.loading = false;
+          return;
+        }
         this.loading = false;
         this.$emit("submit", {
           id: this.id,

+ 23 - 12
src/views/purchaseAndSale/adjust/detail.vue

@@ -81,7 +81,7 @@
                     />
                   </div>
                   <div
-                    class="talk_note-main"
+                    class="talk-note-main"
                     v-else
                     v-html="item.talk_note"
                   ></div>
@@ -110,17 +110,18 @@
       </div>
     </div>
     <div class="right">
-      <div class="tijiaoBTN">
+      <div class="title">
+        基本信息
         <el-button
           class="fr"
           :size="'mini'"
           v-if="!isDetail"
           type="primary"
+          style="margin: 6px 0 0 0"
           @click="submitForm"
           >保存
         </el-button>
       </div>
-      <div class="title">基本信息</div>
       <el-form
         ref="ruleForm"
         :model="ruleForm"
@@ -150,7 +151,7 @@
             v-model="ruleForm.deal_id"
             style="width: 100%"
             filterable
-             clearable
+            clearable
             placeholder="处理人:"
           >
             <el-option
@@ -235,6 +236,7 @@
           </div>
         </el-form-item>
       </el-form>
+      <div class="tijiaoBTN"></div>
     </div>
     <select-handler-model
       :id="queryId"
@@ -513,8 +515,14 @@ export default {
         if (valid) {
           this.loading = true;
           let model = JSON.parse(JSON.stringify(this.ruleForm));
-          delete model['company_name']
-          delete model['apply_name']
+          delete model["company_name"];
+          delete model["apply_name"];
+          let length = 5000;
+          if (model.remark.length > length) {
+            this.$message.warning("描述文字及标签总长度不能超过5000!");
+            this.loading = false;
+            return;
+          }
           let res = await asyncRequest.update(model);
           if (res && res.code === 0) {
             this.$notify.success({
@@ -696,6 +704,13 @@ export default {
           margin: -11px 0 0 0;
           padding: 32px 16px 50px 32px;
           font-size: 12px;
+          .talk-note-main {
+            word-break: break-all;
+            line-height: 22px;
+            /deep/ * {
+              word-break: break-all;
+            }
+          }
         }
       }
     }
@@ -703,13 +718,9 @@ export default {
   .right {
     width: 350px;
     float: right;
-    padding: 0 0 0 18px;
+    padding: 40px 0 0 18px;
     box-sizing: border-box;
-    .tijiaoBTN {
-      height: 40px;
-      line-height: 40px;
-      text-align: right;
-    }
+
     .title {
       width: 100%;
       padding: 0 20px;