|
@@ -41,14 +41,11 @@
|
|
|
<el-input v-if="!isEdit" v-model="form.source" placeholder="输入静态知识来源"></el-input>
|
|
|
{{isEdit?form.source:''}}
|
|
|
</el-form-item>
|
|
|
- <InfoParagraph v-for="(f,i) in form.prags"
|
|
|
- :data="f"
|
|
|
- :index="i"
|
|
|
+ <InfoParagraph :data="form.prags[0]"
|
|
|
+ :index="0"
|
|
|
:len="1"
|
|
|
:isEdit = "isEdit"
|
|
|
- @change="getPgValues"
|
|
|
- @add="addParagraph"
|
|
|
- @del="delParagraph" ref="subForm"></InfoParagraph>
|
|
|
+ ref="subForm"></InfoParagraph>
|
|
|
</el-form>
|
|
|
<div class="btn">
|
|
|
<el-button
|
|
@@ -64,7 +61,7 @@
|
|
|
*
|
|
|
*/
|
|
|
import api from '@api/icss.js';
|
|
|
- import InfoParagraph from './InfoParagraph';
|
|
|
+ import InfoParagraph from './MedicineInfoPg';
|
|
|
|
|
|
export default {
|
|
|
name: 'AddMedicinePrompt',
|
|
@@ -81,6 +78,8 @@
|
|
|
prags:[]
|
|
|
},
|
|
|
form:{
|
|
|
+ conceptId:'', //术语id
|
|
|
+ isTip:0, //是否要覆盖,0不覆盖,1覆盖
|
|
|
selectedTerm:'', //术语标签
|
|
|
termType:'',
|
|
|
source:'',
|
|
@@ -110,6 +109,7 @@
|
|
|
//this.editData.selectedTermName = name;
|
|
|
this.form.selectedTermName = name;
|
|
|
this.form.selectedTermType = newVal.type;
|
|
|
+ this.form.conceptId = newVal.conceptId;
|
|
|
}
|
|
|
},
|
|
|
created:function(){
|
|
@@ -128,10 +128,12 @@
|
|
|
}).catch((error) => {
|
|
|
console.log(error);
|
|
|
});*/
|
|
|
- this.form.selectedTermName = data.name;
|
|
|
- this.form.selectedTermType = data.type;
|
|
|
+ this.form.selectedTermName = data.conceptName;
|
|
|
+ this.form.selectedTermType = data.conceptType;
|
|
|
this.form.source = data.source;
|
|
|
+ this.form.conceptId = data.conceptId;
|
|
|
this.form.prags[0].content = data.content;
|
|
|
+ this.form.prags[0].isReason = data.isReason;
|
|
|
this.form.prags[0].position=this.mapStringToNum(data.position);
|
|
|
this.form.prags[0].title = data.title;
|
|
|
}
|
|
@@ -164,41 +166,6 @@
|
|
|
return +it;
|
|
|
})
|
|
|
},
|
|
|
- parseData(info){
|
|
|
- let detail = [];
|
|
|
- info.prags.forEach((it)=>{
|
|
|
- detail.push(Object.assign({},it,{position:it.position,source:this.form.source}));
|
|
|
- });
|
|
|
- return {
|
|
|
- oldterm:'',
|
|
|
- concept:'',
|
|
|
- oldtype:'',
|
|
|
- newterm:info.selectedTermName,
|
|
|
- newtype:info.selectedTermType,
|
|
|
- information:detail
|
|
|
- };
|
|
|
- },
|
|
|
- addParagraph(){
|
|
|
- this.form.prags.push({title:'',
|
|
|
- content:'',
|
|
|
- isReason:0,
|
|
|
- orderNo:0,
|
|
|
- position:[],
|
|
|
- text:''});
|
|
|
- },
|
|
|
- delParagraph(i){
|
|
|
- if(this.form.prags.length==1){
|
|
|
- this.warning('只剩一个段落,不能再删啦!');
|
|
|
- return;
|
|
|
- }
|
|
|
- this.showConfirmDialog('确定要删除该段落?', () => {
|
|
|
- this.form.prags.splice(i,1);
|
|
|
- });
|
|
|
- },
|
|
|
- getPgValues(i,data){
|
|
|
- this.form.prags[i] = data;
|
|
|
- //console.log(data,this.form.prags);
|
|
|
- },
|
|
|
submitForm() {
|
|
|
//验证外层表单
|
|
|
let goOn=true,it=null;
|
|
@@ -209,33 +176,36 @@
|
|
|
}
|
|
|
});
|
|
|
//验证段落表单
|
|
|
- for(let i=0;i<this.$refs.subForm.length;i++){
|
|
|
- it=this.$refs.subForm[i];
|
|
|
+ //for(let i=0;i<this.$refs.subForm.length;i++){
|
|
|
+ it=this.$refs.subForm;
|
|
|
it.$refs.form.validate((valid) =>{
|
|
|
if(!valid){
|
|
|
goOn = false;
|
|
|
}
|
|
|
});
|
|
|
- };
|
|
|
+ //};
|
|
|
|
|
|
if(!goOn){
|
|
|
return;
|
|
|
}
|
|
|
//通过必填验证,提交保存
|
|
|
- const param = this.parseData(this.form);/*{
|
|
|
- newterm:this.form.selectedTermName,
|
|
|
- newtype:this.form.termType,
|
|
|
- information:Object.assign(this.form.prags)
|
|
|
- };*/
|
|
|
- //console.log(param);
|
|
|
- this.showSaveDialog(param);
|
|
|
+ const item=this.form.prags[0];
|
|
|
+ const param = Object.assign({},item,{
|
|
|
+ position:typeof item.position=='string'?item.position:item.position.join(","),
|
|
|
+ source:this.form.source,
|
|
|
+ conceptId:this.form.conceptId,isTip:1,
|
|
|
+ });
|
|
|
+ this.showSaveDialog(param,'是否保存该静态知识?');
|
|
|
},
|
|
|
- showSaveDialog(param) {
|
|
|
- this.showConfirmDialog('是否保存该静态知识?', () => {
|
|
|
+ showSaveDialog(param,msg) {
|
|
|
+ this.showConfirmDialog(msg, () => {
|
|
|
api.saveTermPrompts(param).then((res) => {
|
|
|
if (res.data.code === '0') {
|
|
|
this.warning(res.data.msg || '保存成功', 'success');
|
|
|
this.$router.push("/admin/LT-YXSYKWH-YXSYJTZSWH");
|
|
|
+ } else if(res.data.code === '00000002'){
|
|
|
+ //已存在,选择是否覆盖
|
|
|
+ this.showSaveDialog(Object.assign({},param,{isTip:0}),res.data.msg);
|
|
|
} else {
|
|
|
this.warning(res.data.msg)
|
|
|
}
|
|
@@ -245,8 +215,10 @@
|
|
|
});
|
|
|
},
|
|
|
showConfirmDialog(msg, resolve) {
|
|
|
- this.$alert(msg, '提示', {
|
|
|
+ this.$confirm(msg, '提示', {
|
|
|
confirmButtonText: '确定',
|
|
|
+ cancelButtonText: '取消',
|
|
|
+ cancelButtonClass:'cancel',
|
|
|
type: 'warning'
|
|
|
}).then(() => {
|
|
|
resolve();
|
|
@@ -278,6 +250,9 @@
|
|
|
margin-bottom: 20px;
|
|
|
}
|
|
|
}
|
|
|
+ .cancel span{
|
|
|
+ color: #22ccc8;
|
|
|
+ }
|
|
|
.line{
|
|
|
border-top:1px #dcdfe6 solid;
|
|
|
margin-bottom: 25px;
|