|
@@ -329,7 +329,7 @@ it .ql-editor,
|
|
v-model="table.klScaleSaveGroup[0].content"
|
|
v-model="table.klScaleSaveGroup[0].content"
|
|
:options="editorOption"
|
|
:options="editorOption"
|
|
class="ql-editor"
|
|
class="ql-editor"
|
|
- ref="quillEditor"
|
|
|
|
|
|
+ ref="scalequillEditor"
|
|
@change="
|
|
@change="
|
|
onEditorChange(
|
|
onEditorChange(
|
|
$event,
|
|
$event,
|
|
@@ -383,6 +383,7 @@ it .ql-editor,
|
|
</template>
|
|
</template>
|
|
|
|
|
|
<script>
|
|
<script>
|
|
|
|
+import api from "@api/knowledgeTree.js";
|
|
import ScaleTable from "./scale-table.vue";
|
|
import ScaleTable from "./scale-table.vue";
|
|
import "quill/dist/quill.core.css";
|
|
import "quill/dist/quill.core.css";
|
|
import "quill/dist/quill.snow.css";
|
|
import "quill/dist/quill.snow.css";
|
|
@@ -508,7 +509,8 @@ export default {
|
|
loading: true,
|
|
loading: true,
|
|
name: "upfile",
|
|
name: "upfile",
|
|
size: 1,
|
|
size: 1,
|
|
- sizeError: () => {
|
|
|
|
|
|
+ sizeError: (err) => {
|
|
|
|
+ console.log("errrrrr", err);
|
|
this.$message({
|
|
this.$message({
|
|
showClose: true,
|
|
showClose: true,
|
|
message: "请上传 1M 以内的图片!",
|
|
message: "请上传 1M 以内的图片!",
|
|
@@ -710,6 +712,13 @@ export default {
|
|
} else if (table.textType === 12) {
|
|
} else if (table.textType === 12) {
|
|
// 文本类型单独处理
|
|
// 文本类型单独处理
|
|
// console.dir(table);
|
|
// console.dir(table);
|
|
|
|
+ // 处理富文本的图标 替换占位符 config.imgHost
|
|
|
|
+ let regExp = new RegExp(config.imgHost, "g");
|
|
|
|
+ let regContent = table.klScaleSaveGroup[0].content.replace(
|
|
|
|
+ regExp,
|
|
|
|
+ "{imageUrlPrefix}"
|
|
|
|
+ );
|
|
|
|
+ console.log("regContent", regContent);
|
|
params.klScaleParent.push({
|
|
params.klScaleParent.push({
|
|
...table,
|
|
...table,
|
|
klScaleSaveGroup: [
|
|
klScaleSaveGroup: [
|
|
@@ -718,7 +727,7 @@ export default {
|
|
klScaleSub: [
|
|
klScaleSub: [
|
|
{
|
|
{
|
|
constant: 0,
|
|
constant: 0,
|
|
- content: table.klScaleSaveGroup[0].content,
|
|
|
|
|
|
+ content: regContent,
|
|
factor: 0,
|
|
factor: 0,
|
|
orderNo: 0,
|
|
orderNo: 0,
|
|
remark: "string",
|
|
remark: "string",
|
|
@@ -1093,6 +1102,9 @@ export default {
|
|
]);
|
|
]);
|
|
if (e === 12) {
|
|
if (e === 12) {
|
|
this.scaleData.klScaleParent[tableIndex].resultType = null;
|
|
this.scaleData.klScaleParent[tableIndex].resultType = null;
|
|
|
|
+ setTimeout(() => {
|
|
|
|
+ this.initText();
|
|
|
|
+ }, 300);
|
|
} else if (e === 11) {
|
|
} else if (e === 11) {
|
|
this.scaleData.klScaleParent[tableIndex].resultType = 1;
|
|
this.scaleData.klScaleParent[tableIndex].resultType = 1;
|
|
}
|
|
}
|
|
@@ -1107,6 +1119,65 @@ export default {
|
|
this.$refs.ScoreResultsTable.resizeTable();
|
|
this.$refs.ScoreResultsTable.resizeTable();
|
|
// this.$refs.ScaleTable.resizeTable();
|
|
// this.$refs.ScaleTable.resizeTable();
|
|
});
|
|
});
|
|
|
|
+ },
|
|
|
|
+ initText() {
|
|
|
|
+ "upload";
|
|
|
|
+ let quillArr;
|
|
|
|
+ console.log("this.$refs.scalequillEditor", this.$refs.scalequillEditor);
|
|
|
|
+ if (this.$refs.scalequillEditor && this.$refs.scalequillEditor.length) {
|
|
|
|
+ quillArr = this.$refs.scalequillEditor;
|
|
|
|
+ }
|
|
|
|
+ console.log("s_quill", quillArr);
|
|
|
|
+ // return;
|
|
|
|
+ quillArr &&
|
|
|
|
+ quillArr.forEach((item) => {
|
|
|
|
+ let { quill } = item;
|
|
|
|
+ quill.root.addEventListener(
|
|
|
|
+ "paste",
|
|
|
|
+ (evt) => {
|
|
|
|
+ console.log("evt", evt);
|
|
|
|
+ if (
|
|
|
|
+ evt.clipboardData &&
|
|
|
|
+ evt.clipboardData.files &&
|
|
|
|
+ evt.clipboardData.files.length
|
|
|
|
+ ) {
|
|
|
|
+ console.log("ddadada");
|
|
|
|
+ evt.preventDefault();
|
|
|
|
+ [].forEach.call(evt.clipboardData.files, (file) => {
|
|
|
|
+ console.log("file", file);
|
|
|
|
+ if (!file.type.match(/^image\/(gif|jpe?g|a?png|bmp)/i))
|
|
|
|
+ return;
|
|
|
|
+ if (file.size > 1024 * 1000) return;
|
|
|
|
+ let formData = new FormData();
|
|
|
|
+ formData.append("upfile", file);
|
|
|
|
+ api.uploadFile(formData).then((res) => {
|
|
|
|
+ console.log("formData", res);
|
|
|
|
+ if (res.data.code == "0") {
|
|
|
|
+ let imgUrl = config.imgHost + res.data.data.url;
|
|
|
|
+ var range = quill.getSelection();
|
|
|
|
+ console.log("range", range);
|
|
|
|
+ if (range) {
|
|
|
|
+ // this.uploadAttachment(res, file, null);
|
|
|
|
+ let length = quill.getSelection().index;
|
|
|
|
+ quill.insertEmbed(length, "image", imgUrl);
|
|
|
|
+ quill.setSelection(length + 1);
|
|
|
|
+ // 将光标移动到图片后面
|
|
|
|
+ quill.setSelection(range.index + 1);
|
|
|
|
+ }
|
|
|
|
+ } else {
|
|
|
|
+ this.$message({
|
|
|
|
+ showClose: true,
|
|
|
|
+ message: res.msg,
|
|
|
|
+ type: "warning"
|
|
|
|
+ });
|
|
|
|
+ }
|
|
|
|
+ });
|
|
|
|
+ });
|
|
|
|
+ }
|
|
|
|
+ },
|
|
|
|
+ false
|
|
|
|
+ );
|
|
|
|
+ });
|
|
}
|
|
}
|
|
},
|
|
},
|
|
watch: {
|
|
watch: {
|
|
@@ -1192,6 +1263,11 @@ export default {
|
|
});
|
|
});
|
|
} else if (table.textType === 12) {
|
|
} else if (table.textType === 12) {
|
|
// 文本
|
|
// 文本
|
|
|
|
+ let regExp = new RegExp("{imageUrlPrefix}", "g");
|
|
|
|
+ let regContent = table.subMenuList[0].content.replace(
|
|
|
|
+ regExp,
|
|
|
|
+ config.imgHost
|
|
|
|
+ );
|
|
obj.klScaleParent.push({
|
|
obj.klScaleParent.push({
|
|
constant: table.constant,
|
|
constant: table.constant,
|
|
content: table.content,
|
|
content: table.content,
|
|
@@ -1216,7 +1292,7 @@ export default {
|
|
two_selectType: null,
|
|
two_selectType: null,
|
|
two_status: null,
|
|
two_status: null,
|
|
two_textType: null,
|
|
two_textType: null,
|
|
- content: table.subMenuList[0].content,
|
|
|
|
|
|
+ content: regContent,
|
|
orderNo: table.subMenuList[0].groupNum,
|
|
orderNo: table.subMenuList[0].groupNum,
|
|
pushInfo: table.subMenuList[0].pushInfo,
|
|
pushInfo: table.subMenuList[0].pushInfo,
|
|
remark: table.subMenuList[0].remark,
|
|
remark: table.subMenuList[0].remark,
|
|
@@ -1230,9 +1306,7 @@ export default {
|
|
});
|
|
});
|
|
}
|
|
}
|
|
});
|
|
});
|
|
- // console.dir(obj);
|
|
|
|
- // console.dir(scoreresults);
|
|
|
|
-
|
|
|
|
|
|
+ console.dir(obj);
|
|
this.scaleData = obj;
|
|
this.scaleData = obj;
|
|
if (scoreresults.scoreresultsdatas.length)
|
|
if (scoreresults.scoreresultsdatas.length)
|
|
this.scoreresults = scoreresults;
|
|
this.scoreresults = scoreresults;
|
|
@@ -1255,6 +1329,10 @@ export default {
|
|
this.editorOption.modules.toolbar.container =
|
|
this.editorOption.modules.toolbar.container =
|
|
this.toolbars[this.toolbarMode];
|
|
this.toolbars[this.toolbarMode];
|
|
},
|
|
},
|
|
- mounted() {}
|
|
|
|
|
|
+ mounted() {
|
|
|
|
+ setTimeout(() => {
|
|
|
|
+ this.initText();
|
|
|
|
+ }, 500);
|
|
|
|
+ }
|
|
};
|
|
};
|
|
</script>
|
|
</script>
|