|
@@ -14,19 +14,16 @@
|
|
|
<el-option label="是" :value="1"></el-option>
|
|
|
</el-select>
|
|
|
</el-form-item>-->
|
|
|
- <el-form-item
|
|
|
- label="段落标题:"
|
|
|
- prop="title"
|
|
|
- label-width="160px"
|
|
|
- class="is-required"
|
|
|
- >
|
|
|
+ <el-form-item label="段落标题:" prop="title" label-width="160px" class="is-required">
|
|
|
<el-input v-model="data.title"></el-input>
|
|
|
</el-form-item>
|
|
|
<el-form-item label="内容类型:" prop="position" label-width="160px">
|
|
|
<el-checkbox-group v-model="data.position">
|
|
|
- <el-checkbox v-for="it in positions" :key="it.key" :label="it.key">{{
|
|
|
+ <el-checkbox v-for="it in positions" :key="it.key" :label="it.key">
|
|
|
+ {{
|
|
|
it.name
|
|
|
- }}</el-checkbox>
|
|
|
+ }}
|
|
|
+ </el-checkbox>
|
|
|
</el-checkbox-group>
|
|
|
</el-form-item>
|
|
|
<el-form-item label="内容" prop="content" label-width="160px" ref="editor">
|
|
@@ -50,7 +47,7 @@
|
|
|
@click="reOrder(0)"
|
|
|
>下降</a
|
|
|
>
|
|
|
- </div> -->
|
|
|
+ </div>-->
|
|
|
<div class="move_btn">
|
|
|
<div
|
|
|
v-if="index !== 0"
|
|
@@ -65,7 +62,7 @@
|
|
|
? require('@/images/icon_hover_top.png')
|
|
|
: require('@/images/icon_default_top.png')
|
|
|
"
|
|
|
- alt=""
|
|
|
+ alt
|
|
|
/>
|
|
|
</div>
|
|
|
<div
|
|
@@ -81,7 +78,7 @@
|
|
|
? require('@/images/icon_hover_down.png')
|
|
|
: require('@/images/icon_default_down.png')
|
|
|
"
|
|
|
- alt=""
|
|
|
+ alt
|
|
|
/>
|
|
|
</div>
|
|
|
</div>
|
|
@@ -89,7 +86,7 @@
|
|
|
<!-- <el-button size="small" @click="addEmit">添加段落</el-button>
|
|
|
<el-button size="small" @click="delEmit" type="info"
|
|
|
>删除本段落</el-button
|
|
|
- > -->
|
|
|
+ >-->
|
|
|
<div class="change_btns">
|
|
|
<div @click="addEmit">添加段落</div>
|
|
|
<div @click="delEmit">删除本段落</div>
|
|
@@ -99,17 +96,17 @@
|
|
|
</template>
|
|
|
|
|
|
<script>
|
|
|
-import api from "@api/knowledgeTree.js";
|
|
|
-import "quill/dist/quill.core.css";
|
|
|
-import "quill/dist/quill.snow.css";
|
|
|
-import "quill/dist/quill.bubble.css";
|
|
|
-import { quillEditor, Quill } from "vue-quill-editor";
|
|
|
-import config from "@api/config";
|
|
|
-import { container, ImageExtend, QuillWatch } from "quill-image-extend-module";
|
|
|
-Quill.register("modules/ImageExtend", ImageExtend);
|
|
|
+import api from '@api/knowledgeTree.js';
|
|
|
+import 'quill/dist/quill.core.css';
|
|
|
+import 'quill/dist/quill.snow.css';
|
|
|
+import 'quill/dist/quill.bubble.css';
|
|
|
+import { quillEditor, Quill } from 'vue-quill-editor';
|
|
|
+import config from '@api/config';
|
|
|
+import { container, ImageExtend, QuillWatch } from 'quill-image-extend-module';
|
|
|
+Quill.register('modules/ImageExtend', ImageExtend);
|
|
|
export default {
|
|
|
- props: ["data", "index", "isEdit", "isCopy", "total", "showType"],
|
|
|
- name: "DevInfo",
|
|
|
+ props: ['data', 'index', 'isEdit', 'isCopy', 'total', 'showType'],
|
|
|
+ name: 'DevInfo',
|
|
|
components: {
|
|
|
quillEditor
|
|
|
},
|
|
@@ -119,12 +116,12 @@ export default {
|
|
|
moveBottomHover: false,
|
|
|
toolbars: [
|
|
|
[
|
|
|
- ["bold", "underline", "strike"],
|
|
|
- [{ list: "ordered" }, { list: "bullet" }],
|
|
|
- [{ script: "sub" }, { script: "super" }],
|
|
|
+ ['bold', 'underline', 'strike'],
|
|
|
+ [{ list: 'ordered' }, { list: 'bullet' }],
|
|
|
+ [{ script: 'sub' }, { script: 'super' }],
|
|
|
[{ color: [] }, { background: [] }],
|
|
|
[{ align: [] }],
|
|
|
- ["image"]
|
|
|
+ ['image']
|
|
|
]
|
|
|
],
|
|
|
toolbarMode: 0,
|
|
@@ -132,24 +129,24 @@ export default {
|
|
|
modules: {
|
|
|
ImageExtend: {
|
|
|
loading: true,
|
|
|
- name: "upfile",
|
|
|
+ name: 'upfile',
|
|
|
size: 1,
|
|
|
sizeError: () => {
|
|
|
this.$message({
|
|
|
showClose: true,
|
|
|
- message: "请上传 1M 以内的图片!",
|
|
|
- type: "warning"
|
|
|
+ message: '请上传 1M 以内的图片!',
|
|
|
+ type: 'warning'
|
|
|
});
|
|
|
},
|
|
|
action: config.urls.promptServer,
|
|
|
- response: (res) => {
|
|
|
- if (res.code == "0") {
|
|
|
+ response: res => {
|
|
|
+ if (res.code == '0') {
|
|
|
return config.imgHost + res.data.url;
|
|
|
} else {
|
|
|
this.$message({
|
|
|
showClose: true,
|
|
|
message: res.msg,
|
|
|
- type: "warning"
|
|
|
+ type: 'warning'
|
|
|
});
|
|
|
}
|
|
|
}
|
|
@@ -157,7 +154,7 @@ export default {
|
|
|
toolbar: {
|
|
|
container: container,
|
|
|
handlers: {
|
|
|
- image: function () {
|
|
|
+ image: function() {
|
|
|
QuillWatch.emit(this.quill.id);
|
|
|
}
|
|
|
}
|
|
@@ -173,66 +170,68 @@ export default {
|
|
|
};
|
|
|
},
|
|
|
watch: {
|
|
|
- "data.content": function () {
|
|
|
- if (this.data.content !== "") {
|
|
|
+ 'data.content': function() {
|
|
|
+ if (this.data.content !== '') {
|
|
|
this.$refs.editor && this.$refs.editor.clearValidate(); // 清除校验
|
|
|
}
|
|
|
- if (this.data.content === "") {
|
|
|
+ if (this.data.content === '') {
|
|
|
// console.log('内容为空');
|
|
|
- this.$refs["form"].validateField("content"); // 手动校验
|
|
|
+ this.$refs['form'].validateField('content'); // 手动校验
|
|
|
}
|
|
|
this.data.text = this.$refs.quillEditor.quill.root.innerText;
|
|
|
}
|
|
|
},
|
|
|
created() {
|
|
|
// console.log(this.showType, 'showType','需要显示的类型');
|
|
|
- this.editorOption.modules.toolbar.container =
|
|
|
- this.toolbars[this.toolbarMode];
|
|
|
- this.renderPositions();
|
|
|
+ this.editorOption.modules.toolbar.container = this.toolbars[
|
|
|
+ this.toolbarMode
|
|
|
+ ];
|
|
|
+ this.zskgetDict();
|
|
|
+
|
|
|
if (this.isEdit || this.isCopy) {
|
|
|
setTimeout(() => {
|
|
|
this.rules = {
|
|
|
position: [
|
|
|
- { required: true, message: "请选择内容类型", trigger: "change" }
|
|
|
+ { required: true, message: '请选择内容类型', trigger: 'change' }
|
|
|
],
|
|
|
title: [
|
|
|
{
|
|
|
validator: (rule, value, callback) => {
|
|
|
if (!value.trim()) {
|
|
|
- callback(new Error("请输入段落标题"));
|
|
|
+ callback(new Error('请输入段落标题'));
|
|
|
} else {
|
|
|
callback();
|
|
|
}
|
|
|
},
|
|
|
- trigger: "change"
|
|
|
+ trigger: 'change'
|
|
|
},
|
|
|
- { max: 30, message: "标题名称不能超过30字", trigger: "change" }
|
|
|
+ { max: 30, message: '标题名称不能超过30字', trigger: 'change' }
|
|
|
],
|
|
|
content: [
|
|
|
- { required: true, message: "请输入段落内容", trigger: "change" }
|
|
|
+ { required: true, message: '请输入段落内容', trigger: 'change' }
|
|
|
]
|
|
|
};
|
|
|
}, 100);
|
|
|
} else {
|
|
|
this.rules = {
|
|
|
position: [
|
|
|
- { required: true, message: "请选择内容类型", trigger: "change" }
|
|
|
+ { required: true, message: '请选择内容类型', trigger: 'change' }
|
|
|
],
|
|
|
title: [
|
|
|
{
|
|
|
validator: (rule, value, callback) => {
|
|
|
if (!value.trim()) {
|
|
|
- callback(new Error("请输入段落标题"));
|
|
|
+ callback(new Error('请输入段落标题'));
|
|
|
} else {
|
|
|
callback();
|
|
|
}
|
|
|
},
|
|
|
- trigger: "change"
|
|
|
+ trigger: 'change'
|
|
|
},
|
|
|
- { max: 30, message: "标题名称不能超过30字", trigger: "change" }
|
|
|
+ { max: 30, message: '标题名称不能超过30字', trigger: 'change' }
|
|
|
],
|
|
|
content: [
|
|
|
- { required: true, message: "请输入段落内容", trigger: "change" }
|
|
|
+ { required: true, message: '请输入段落内容', trigger: 'change' }
|
|
|
]
|
|
|
};
|
|
|
}
|
|
@@ -242,34 +241,33 @@ export default {
|
|
|
},
|
|
|
mounted() {
|
|
|
let quill = this.$refs.quillEditor.quill;
|
|
|
- console.log(quill);
|
|
|
quill.root.addEventListener(
|
|
|
- "paste",
|
|
|
- (evt) => {
|
|
|
- console.log("evt", evt);
|
|
|
+ 'paste',
|
|
|
+ evt => {
|
|
|
+ console.log('evt', evt);
|
|
|
if (
|
|
|
evt.clipboardData &&
|
|
|
evt.clipboardData.files &&
|
|
|
evt.clipboardData.files.length
|
|
|
) {
|
|
|
- console.log("ddadada");
|
|
|
+ console.log('ddadada');
|
|
|
evt.preventDefault();
|
|
|
- [].forEach.call(evt.clipboardData.files, (file) => {
|
|
|
- console.log("file", file);
|
|
|
+ [].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") {
|
|
|
+ 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);
|
|
|
+ console.log('range', range);
|
|
|
if (range) {
|
|
|
// this.uploadAttachment(res, file, null);
|
|
|
let length = quill.getSelection().index;
|
|
|
- quill.insertEmbed(length, "image", imgUrl);
|
|
|
+ quill.insertEmbed(length, 'image', imgUrl);
|
|
|
quill.setSelection(length + 1);
|
|
|
// 将光标移动到图片后面
|
|
|
this.$refs.quillEditor.quill.setSelection(range.index + 1);
|
|
@@ -278,7 +276,7 @@ export default {
|
|
|
this.$message({
|
|
|
showClose: true,
|
|
|
message: res.msg,
|
|
|
- type: "warning"
|
|
|
+ type: 'warning'
|
|
|
});
|
|
|
}
|
|
|
});
|
|
@@ -289,56 +287,88 @@ export default {
|
|
|
);
|
|
|
},
|
|
|
methods: {
|
|
|
+ zskgetDict() {
|
|
|
+ api
|
|
|
+ .zskgetDict()
|
|
|
+ .then(res => {
|
|
|
+ if (res.data.code == '0') {
|
|
|
+ const data = res.data.data;
|
|
|
+ this.positions = data['50'];
|
|
|
+ this.renderPositions(data['50'], data['51']);
|
|
|
+ }
|
|
|
+ })
|
|
|
+ .catch(error => {
|
|
|
+ console.log(error);
|
|
|
+ });
|
|
|
+ },
|
|
|
reOrder(i) {
|
|
|
- this.$emit("reOrder", i, this.index);
|
|
|
+ this.$emit('reOrder', i, this.index);
|
|
|
},
|
|
|
addEmit() {
|
|
|
- this.$emit("add");
|
|
|
+ this.$emit('add');
|
|
|
},
|
|
|
delEmit() {
|
|
|
- this.$emit("del", this.index);
|
|
|
+ this.$emit('del', this.index);
|
|
|
},
|
|
|
filterHiddenPosition() {
|
|
|
const pos = this.data.position;
|
|
|
- const pArr = this.positions.map((it) => {
|
|
|
+ const pArr = this.positions.map(it => {
|
|
|
return it.key;
|
|
|
});
|
|
|
- const pStr = pArr.join(",");
|
|
|
- const arr = pos.filter((it) => {
|
|
|
+ const pStr = pArr.join(',');
|
|
|
+ const arr = pos.filter(it => {
|
|
|
return pStr.indexOf(it) > -1;
|
|
|
});
|
|
|
this.data.position = arr;
|
|
|
},
|
|
|
// 渲染内容类型
|
|
|
- renderPositions() {
|
|
|
+ renderPositions(data1, data2) {
|
|
|
//显示位置枚举列表
|
|
|
- const pos = localStorage.getItem("knowledgeEnumsData");
|
|
|
- let positions = config.contentTypes;
|
|
|
- if (this.showType == 1) {
|
|
|
- // 诊断
|
|
|
- this.positions = positions.filter((item) => item.key !== 2);
|
|
|
- } else if (
|
|
|
- this.showType == 3 ||
|
|
|
- this.showType == 4 ||
|
|
|
- this.showType == 5 ||
|
|
|
- this.showType == 6
|
|
|
- ) {
|
|
|
- // 检验/检查
|
|
|
- this.positions = positions.filter((item) => {
|
|
|
- return item.key <= 2;
|
|
|
+ if (this.showType>0) {
|
|
|
+ data2 = data2.filter(item => item.name == this.showType);
|
|
|
+ let val = data2[0].val.split(',');
|
|
|
+ this.positions = data1.filter(it => {
|
|
|
+ let arr = val.map(v => v);
|
|
|
+ return arr.includes(it.val);
|
|
|
});
|
|
|
- } else if (
|
|
|
- this.showType == 2 ||
|
|
|
- this.showType == 7 ||
|
|
|
- this.showType == 8 ||
|
|
|
- this.showType == 9 ||
|
|
|
- this.showType == 10
|
|
|
- ) {
|
|
|
- // 药品/手术
|
|
|
- this.positions = positions.filter((item) => item.key === 1);
|
|
|
- } else {
|
|
|
- this.positions = positions;
|
|
|
}
|
|
|
+
|
|
|
+ // let obj = {};
|
|
|
+ // let arr = formData.klDiagnoseTypeVO[inx].groupVO[index].klDiagnoseDetail[
|
|
|
+ // i
|
|
|
+ // ].basConceptList.concat(data2);
|
|
|
+ // arr = arr.reduce(function(item, next) {
|
|
|
+ // obj[next.conceptId]
|
|
|
+ // ? ''
|
|
|
+ // : (obj[next.conceptId] = true && item.push(next));
|
|
|
+ // return item;
|
|
|
+ // }, []);
|
|
|
+ // let positions = config.contentTypes;
|
|
|
+ // if (this.showType == 1) {
|
|
|
+ // // 诊断
|
|
|
+ // this.positions = positions.filter((item) => item.key !== 2);
|
|
|
+ // } else if (
|
|
|
+ // this.showType == 3 ||
|
|
|
+ // this.showType == 4 ||
|
|
|
+ // this.showType == 5 ||
|
|
|
+ // this.showType == 6
|
|
|
+ // ) {
|
|
|
+ // // 检验/检查
|
|
|
+ // this.positions = positions.filter((item) => {
|
|
|
+ // return item.key <= 2;
|
|
|
+ // });
|
|
|
+ // } else if (
|
|
|
+ // this.showType == 2 ||
|
|
|
+ // this.showType == 7 ||
|
|
|
+ // this.showType == 8 ||
|
|
|
+ // this.showType == 9 ||
|
|
|
+ // this.showType == 10
|
|
|
+ // ) {
|
|
|
+ // // 药品/手术
|
|
|
+ // this.positions = positions.filter((item) => item.key === 1);
|
|
|
+ // } else {
|
|
|
+ // this.positions = positions;
|
|
|
+ // }
|
|
|
}
|
|
|
|
|
|
/*emitVal(){
|