|
@@ -29,8 +29,12 @@
|
|
<el-form-item label="已选择标准术语:" label-width="160px">
|
|
<el-form-item label="已选择标准术语:" label-width="160px">
|
|
{{form.selectedTermName}}
|
|
{{form.selectedTermName}}
|
|
</el-form-item>
|
|
</el-form-item>
|
|
|
|
+
|
|
<p class="line"></p>
|
|
<p class="line"></p>
|
|
|
|
+
|
|
|
|
+
|
|
<InfoParagraph v-for="(f,i) in form.prags"
|
|
<InfoParagraph v-for="(f,i) in form.prags"
|
|
|
|
+ v-if="!upload"
|
|
:data="f"
|
|
:data="f"
|
|
:index="i"
|
|
:index="i"
|
|
:total="form.prags.length"
|
|
:total="form.prags.length"
|
|
@@ -39,6 +43,28 @@
|
|
@add="addParagraph(i)"
|
|
@add="addParagraph(i)"
|
|
@del="delParagraph"
|
|
@del="delParagraph"
|
|
@reOrder="reOrder"></InfoParagraph>
|
|
@reOrder="reOrder"></InfoParagraph>
|
|
|
|
+ <el-form-item v-if="upload" label="标题名称:" prop="fileTitle" label-width="160px">
|
|
|
|
+ <el-input v-model="form.fileTitle"></el-input>
|
|
|
|
+ </el-form-item>
|
|
|
|
+ <el-form-item v-if="upload" label="上传文件:" label-width="160px">
|
|
|
|
+ <el-upload
|
|
|
|
+
|
|
|
|
+ class="upload-demo"
|
|
|
|
+ :action="config.urls.promptServer"
|
|
|
|
+ name="upfile"
|
|
|
|
+ :multiple=false
|
|
|
|
+ :limit="1"
|
|
|
|
+ :on-preview="handlePreview"
|
|
|
|
+ :on-remove="handleRemove"
|
|
|
|
+ :before-remove="beforeRemove"
|
|
|
|
+ :on-change="handleChange"
|
|
|
|
+ :on-success="handleSuccess"
|
|
|
|
+ :show-file-list="showFileList"
|
|
|
|
+ :file-list="form.fileList">
|
|
|
|
+ <el-button size="small" type="primary" v-if="showUpLoad">点击上传</el-button>
|
|
|
|
+ <!-- <div slot="tip" class="el-upload__tip">只能上传jpg/png文件,且不超过500kb</div> -->
|
|
|
|
+ </el-upload>
|
|
|
|
+ </el-form-item>
|
|
</el-form>
|
|
</el-form>
|
|
<div class="btn">
|
|
<div class="btn">
|
|
<el-button
|
|
<el-button
|
|
@@ -75,23 +101,40 @@
|
|
isTip:0, //是否要覆盖,0不覆盖,1覆盖
|
|
isTip:0, //是否要覆盖,0不覆盖,1覆盖
|
|
selectedTerm:'', //术语标签
|
|
selectedTerm:'', //术语标签
|
|
termType:'',
|
|
termType:'',
|
|
|
|
+ typeId:'',
|
|
selectedTermName:'',
|
|
selectedTermName:'',
|
|
selectedTermType:'',
|
|
selectedTermType:'',
|
|
|
|
+ fileList:[],
|
|
prags:[{ //单个段落相关
|
|
prags:[{ //单个段落相关
|
|
title:'',
|
|
title:'',
|
|
content:'',
|
|
content:'',
|
|
isReason:0,
|
|
isReason:0,
|
|
orderNo:0,
|
|
orderNo:0,
|
|
position:[],
|
|
position:[],
|
|
- text:''}]
|
|
|
|
|
|
+ text:''}],
|
|
|
|
+ fileTitle:''
|
|
|
|
+
|
|
},
|
|
},
|
|
rules: {
|
|
rules: {
|
|
selectedTerm: [
|
|
selectedTerm: [
|
|
{ required: true, message: '请选择术语标签', trigger: 'change' }
|
|
{ required: true, message: '请选择术语标签', trigger: 'change' }
|
|
- ]
|
|
|
|
|
|
+ ],
|
|
|
|
+ fileTitle: [
|
|
|
|
+ { required: true, message: '请输入段落标题', trigger: 'change' },
|
|
|
|
+ { validator: (rule,value,callback)=>{
|
|
|
|
+ if(value.length>30){
|
|
|
|
+ callback(new Error('段落标题不能超过30字'));
|
|
|
|
+ }else{
|
|
|
|
+ callback();
|
|
|
|
+ }}, trigger: 'change' }
|
|
|
|
+ ],
|
|
},
|
|
},
|
|
saveDisable: false, //保存按钮禁止点击
|
|
saveDisable: false, //保存按钮禁止点击
|
|
showDrop:false, //下拉框显示文字bug1774
|
|
showDrop:false, //下拉框显示文字bug1774
|
|
|
|
+ config:config,
|
|
|
|
+ showUpLoad:true,
|
|
|
|
+ showFileList: false,
|
|
|
|
+ upload: false,
|
|
}
|
|
}
|
|
},
|
|
},
|
|
/*watch:{
|
|
/*watch:{
|
|
@@ -114,15 +157,27 @@
|
|
api.getTremList({conceptId:data.conceptId}).then((res) => {
|
|
api.getTremList({conceptId:data.conceptId}).then((res) => {
|
|
if (res.data.code == '0') {
|
|
if (res.data.code == '0') {
|
|
const data = res.data.data;
|
|
const data = res.data.data;
|
|
- this.form.prags=data&&data.map((it)=>{
|
|
|
|
- return {
|
|
|
|
- title:it.title,
|
|
|
|
- position:this.mapStringToNum(it.position),
|
|
|
|
- content:it.content.replace(/{imageUrlPrefix}/g,config.imgHost),
|
|
|
|
- isReason:it.isReason,
|
|
|
|
- text:it.text,
|
|
|
|
- disabled:true};
|
|
|
|
- });
|
|
|
|
|
|
+
|
|
|
|
+ if(this.form.typeId === 82 || this.form.typeId === 83){
|
|
|
|
+ this.form.fileList=data&&data.map((it)=>{
|
|
|
|
+ return {
|
|
|
|
+ name: it.text,
|
|
|
|
+ url: it.content.replace(config.imgHost,"")
|
|
|
|
+ };
|
|
|
|
+ });
|
|
|
|
+ this.showFileList = true
|
|
|
|
+ this.showUpLoad = false
|
|
|
|
+ }else{
|
|
|
|
+ this.form.prags=data&&data.map((it)=>{
|
|
|
|
+ return {
|
|
|
|
+ title:it.title,
|
|
|
|
+ position:this.mapStringToNum(it.position),
|
|
|
|
+ content:it.content.replace(/{imageUrlPrefix}/g,config.imgHost),
|
|
|
|
+ isReason:it.isReason,
|
|
|
|
+ text:it.text,
|
|
|
|
+ disabled:true};
|
|
|
|
+ });
|
|
|
|
+ }
|
|
|
|
|
|
}
|
|
}
|
|
}).catch((error) => {
|
|
}).catch((error) => {
|
|
@@ -132,11 +187,24 @@
|
|
},
|
|
},
|
|
methods: {
|
|
methods: {
|
|
changeWord(newVal){
|
|
changeWord(newVal){
|
|
|
|
+ console.log('newVal',newVal)
|
|
const name = newVal.nameType;
|
|
const name = newVal.nameType;
|
|
this.form.selectedTermName = name;
|
|
this.form.selectedTermName = name;
|
|
this.form.selectedTerm=name;
|
|
this.form.selectedTerm=name;
|
|
this.form.conceptId = newVal.conceptId;
|
|
this.form.conceptId = newVal.conceptId;
|
|
|
|
+ this.form.fileList=[]
|
|
|
|
+ this.showFileList = false
|
|
|
|
+ this.form.typeId = newVal.typeId || ""
|
|
|
|
+ this.showUpLoad = true
|
|
|
|
+ this.form.fileTitle = ""
|
|
|
|
+ if(newVal.typeId === 82 || newVal.typeId === 83){
|
|
|
|
+ this.upload = true
|
|
|
|
+ this.form.fileTitle = newVal.title
|
|
|
|
+ }else{
|
|
|
|
+ this.upload = false
|
|
|
|
+ }
|
|
},
|
|
},
|
|
|
|
+
|
|
reOrder(isUp,i){
|
|
reOrder(isUp,i){
|
|
let temp = {},it={};
|
|
let temp = {},it={};
|
|
if(isUp===1){
|
|
if(isUp===1){
|
|
@@ -221,27 +289,43 @@
|
|
}
|
|
}
|
|
});
|
|
});
|
|
//验证段落表单
|
|
//验证段落表单
|
|
- for(let i=0;i<this.$refs.subForm.length;i++){
|
|
|
|
- it=this.$refs.subForm[i];
|
|
|
|
- it.$refs.form.validate((valid) =>{
|
|
|
|
- if(!valid){
|
|
|
|
- goOn = false;
|
|
|
|
- }
|
|
|
|
- });
|
|
|
|
- };
|
|
|
|
|
|
+ if(this.form.typeId !== 82 && this.form.typeId !== 83){
|
|
|
|
+ for(let i=0;i<this.$refs.subForm.length;i++){
|
|
|
|
+ it=this.$refs.subForm[i];
|
|
|
|
+ it.$refs.form.validate((valid) =>{
|
|
|
|
+ if(!valid){
|
|
|
|
+ goOn = false;
|
|
|
|
+ }
|
|
|
|
+ });
|
|
|
|
+ };
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
|
|
if(!goOn){
|
|
if(!goOn){
|
|
return;
|
|
return;
|
|
}
|
|
}
|
|
//通过必填验证,提交保存
|
|
//通过必填验证,提交保存
|
|
const item=this.form.prags;
|
|
const item=this.form.prags;
|
|
- const param =item.map((it,i)=>{
|
|
|
|
- return Object.assign({},it,{
|
|
|
|
- position:typeof it.position=='string'?it.position:it.position.join(","),
|
|
|
|
- conceptId:this.form.conceptId,
|
|
|
|
- orderNo:i,
|
|
|
|
- content:it.content.replace(new RegExp(config.imgHost,'g'),'{imageUrlPrefix}')});
|
|
|
|
- });
|
|
|
|
|
|
+ let param= []
|
|
|
|
+ if(this.form.typeId === 82 || this.form.typeId === 83){
|
|
|
|
+ param.push(Object.assign({},{
|
|
|
|
+ position: this.form.typeId === 82 ? "8" : "9",
|
|
|
|
+ conceptId:this.form.conceptId,
|
|
|
|
+ title: this.form.fileTitle,
|
|
|
|
+ orderNo:0,
|
|
|
|
+ content:this.form.fileList[0].url,
|
|
|
|
+ text:this.form.fileList[0].name
|
|
|
|
+ }))
|
|
|
|
+
|
|
|
|
+ }else {
|
|
|
|
+ param =item.map((it,i)=>{
|
|
|
|
+ return Object.assign({},it,{
|
|
|
|
+ position:typeof it.position=='string'?it.position:it.position.join(","),
|
|
|
|
+ conceptId:this.form.conceptId,
|
|
|
|
+ orderNo:i,
|
|
|
|
+ content:it.content.replace(new RegExp(config.imgHost,'g'),'{imageUrlPrefix}')});
|
|
|
|
+ });
|
|
|
|
+ }
|
|
this.showSaveDialog(param,'是否保存该静态知识?');
|
|
this.showSaveDialog(param,'是否保存该静态知识?');
|
|
},
|
|
},
|
|
showSaveDialog(param,msg) {
|
|
showSaveDialog(param,msg) {
|
|
@@ -279,6 +363,48 @@
|
|
type: type || 'warning'
|
|
type: type || 'warning'
|
|
})
|
|
})
|
|
},
|
|
},
|
|
|
|
+ handleChange(file, fileList){
|
|
|
|
+ // if(fileList&&fileList[0]&&fileList[0].response&&fileList[0].response.code==='0'){
|
|
|
|
+ // this.showUpLoad = false
|
|
|
|
+ // this.showFileList = true
|
|
|
|
+ // }else{
|
|
|
|
+ // this.showUpLoad = true
|
|
|
|
+ // this.showFileList = false
|
|
|
|
+ // }
|
|
|
|
+ // console.log(fileList,this.form.fileList,'aa')
|
|
|
|
+
|
|
|
|
+ },
|
|
|
|
+ handleSuccess(response, file, fileList){
|
|
|
|
+ if(response.code == "0"){
|
|
|
|
+ this.showFileList=true
|
|
|
|
+ this.form.fileList=[]
|
|
|
|
+ this.form.fileList.push({
|
|
|
|
+ name: response.data.title,
|
|
|
|
+ url: config.imgHost+response.data.url
|
|
|
|
+ })
|
|
|
|
+ this.showUpLoad = false
|
|
|
|
+ if(!this.form.fileTitle){
|
|
|
|
+
|
|
|
|
+ this.form.fileTitle = response.data.title
|
|
|
|
+ }
|
|
|
|
+ }else{
|
|
|
|
+ this.warning(response.msg||'上传失败')
|
|
|
|
+ // this.form.fileList = []
|
|
|
|
+ this.showUpLoad = true
|
|
|
|
+ this.showFileList=false
|
|
|
|
+ this.form.fileList=[]
|
|
|
|
+ }
|
|
|
|
+ },
|
|
|
|
+ handleRemove(file, fileList) {
|
|
|
|
+ this.showUpLoad = true
|
|
|
|
+ this.form.fileList=[]
|
|
|
|
+ },
|
|
|
|
+ handlePreview(file) {
|
|
|
|
+ console.log(file);
|
|
|
|
+ },
|
|
|
|
+ beforeRemove(file, fileList) {
|
|
|
|
+ return this.$confirm(`确定移除 ${ file.name }?`);
|
|
|
|
+ }
|
|
}
|
|
}
|
|
}
|
|
}
|
|
</script>
|
|
</script>
|