Quellcode durchsuchen

Merge branch 'test' into dev2/zhangxc

zhangxc vor 6 Jahren
Ursprung
Commit
079755eebd

+ 12 - 3
src/components/icss/AddDisclInfo.vue

@@ -6,7 +6,7 @@
         <div class="contents">
             <el-form ref="form" :label-position="labelPosition" :model="form" :rules="rules" label-width="65px" class="add-discl-form">
                 <el-form-item label="标题:" prop="title">
-                    <el-input v-model="form.title" placeholder="请输入标题"></el-input>
+                    <el-input v-model="form.title" placeholder="请输入标题" maxlength="30"></el-input>
                 </el-form-item>
                 <el-form-item label="内容:" prop="description" class="discDesc">
                     <el-input type="textarea" :rows="3" placeholder="请输入内容述" v-model="form.description" maxlength="1024"></el-input>
@@ -37,7 +37,7 @@
           return callback(new Error('请输入标题'));
         }
         if (value.length > 30) {
-           this.form.name = value.substr(0, 120);
+           this.form.name = value.substr(0, 30);
            this.$message({
              showClose: true,
              type: 'warning',
@@ -115,11 +115,20 @@
           if (valid) {
             // 有id是修改,没有id是添加
             if(this.id){
+              let code = this.form.disclaimerCode;
+              // 修改没有操作时 code为字符串,需转成code
+              if(typeof code == 'string'){
+                for(let i in this.options){
+                  if(this.options[i].name==code){
+                    code = this.options[i].key;
+                  }
+                }
+              }
               let param = {
                 id:this.id,
                 title:this.form.title,
                 description:this.form.description,
-                disclaimerCode:this.form.disclaimerCode
+                disclaimerCode:code
               }
               api.modifDiscInformation(param).then((res) => {
                 if (res.data.code == '0') {

+ 24 - 8
src/components/icss/AddIndeptLabel.vue

@@ -174,12 +174,17 @@
           })
         });*/
         const h = this.$createElement;
+        const {isEdit} = this.$route.params;
+      const addMsg = h('div',{style:'padding-bottom:10px'},[
+            h('p',{style:'font-size:15px;margin-bottom:10px'},'是否保存该标签?')
+          ])
+      const modMsg = h('div',{style:'padding-bottom:10px'},[
+            h('p',{style:'font-size:15px;margin-bottom:10px'},'是否保存该标签?'),
+            h('span',{style:'color:red;font-size:12px'},'若标签系统名称已经改变,请去别名维护中修改相关信息'),
+          ])
         this.$msgbox({
           title:'提示',
-          message:h('div',{style:'padding-bottom:10px'},[
-              h('p',{style:'font-size:15px;margin-bottom:10px'},'是否保存该标签?'),
-              h('span',{style:'color:red;font-size:12px'},'标签系统名称已经改变,请去别名维护中修改相关信息'),
-            ]),
+          message:isEdit?modMsg:addMsg,
           showCancelButton: true,
           distinguishCancelAndClose:true,
           confirmButtonText: '确认并前往别名维护',
@@ -190,10 +195,21 @@
           api.saveOrUpdate(param).then((res) => {
             if (res.data.code === '0') {
               this.warning(res.data.msg || '保存成功', 'success');
-              this.$router.push({
-                name:'AddSimilarName',
-                params: {id:param.questionWrapper.id,name:param.questionWrapper.tagName}
-              })
+              // 判断是否已有别名--有(修改),无(新增)
+              const item = {id:param.questionWrapper.id,name:param.questionWrapper.tagName};
+              api.similarNameDetl(item).then((res)=>{
+                if(res.data.code=='0'){
+                  this.$router.push({
+                    name:'AddSimilarName',
+                    params: item
+                  })
+                }else{
+                  this.$router.push({
+                    name:'AddSimilarName',
+                    params: {}
+                  })
+                }
+              })  
             } else {
               this.warning(res.data.msg)
             }

+ 3 - 8
src/components/icss/AddMedicalInfo.vue

@@ -11,7 +11,7 @@
                      ref="groups">
                 <el-form-item label="搜索概念:">
                   <div class="conceptSearch">
-                    <input v-model="conceptText" @focus="focusInput" type="text" class="searchText">
+                    <input v-model="conceptText" type="text" class="searchText">
                     <span class="searchName" @click="searchConcept">搜索</span>
                     <ul class="conceptList" ref="conceptList">
                       <li 
@@ -52,7 +52,7 @@
                 </el-form-item>
                 <el-form-item label="搜索小类名称:" >
                   <div class="conceptSearch  termMiniClassSearch">
-                    <input v-model="termMiniClassText" @focus="focusInput" type="text" class="searchText">
+                    <input v-model="termMiniClassText" type="text" class="searchText">
                     <span class="searchName" @click="searchTermMiniClass">搜索</span>
                     <ul class="conceptList" ref="termMiniClassNameList">
                       <li 
@@ -79,7 +79,7 @@
                 </el-form-item>
                  <el-form-item label="搜索术语类组:">
                   <div class="conceptSearch termClassSearch">
-                    <input v-model="termClassText" @focus="focusInput" type="text"  class="searchText">
+                    <input v-model="termClassText" type="text" class="searchText">
                     <span class="searchName" @click="searchTermClass">搜索</span>
                     <ul class="conceptList" ref="termClassList">
                       <li 
@@ -468,11 +468,6 @@
           }
         })
       },
-      focusInput() {
-         this.$refs['conceptList'].style.display = 'none'
-         this.$refs['termClassList'].style.display = 'none'
-         this.$refs['termMiniClassNameList'].style.display = 'none'
-      },
       selectPrimarySite() {
         this.form.twoLevelPosition = '';
         this.getTwoLevelPosition();

+ 20 - 14
src/components/icss/AddPromptInfo.vue

@@ -15,7 +15,6 @@
                 <InfoParagraph v-for="(f,i) in form.prags"
                                :data="f"
                                :index="i"
-                               :len="len"
                                :isEdit = "isEdit"
                                @add="addParagraph"
                                @del="delParagraph" ref="subForm"></InfoParagraph>
@@ -46,9 +45,7 @@
    *
    */
   import api from '@api/icss.js';
-  import utils from '@api/utils.js';
   import TagPool from './PromptTagPool';
-  import schema from 'async-validator';
   import InfoParagraph from './InfoParagraph';
 
   export default {
@@ -59,16 +56,15 @@
     },
     data() {
       const validateTags = (rule,value,callback)=>{
-        if(this.form.selectedTags.length==0){
+        /*if(this.form.selectedTags.length==0){
           this.warning('请选择关联标签!');
-          return;
-        }
+          return false;
+        }*/
         callback();
       };
       return {
         isEdit:false,
         tagPool:[],                 //标签池数据
-        len:0,
         Adscriptions:[],            //归属列表
         editData:{
           id:'',
@@ -90,10 +86,16 @@
         },
         rules: {
           name: [
-            { required: true, message: '静态知识名称不能为空', trigger: 'change' }
+            { required: true, message: '静态知识名称不能为空', trigger: 'change' },
+            { validator: (rule,value,callback)=>{
+              if(value.length>120){
+                callback(new Error('静态知识名称不能超过120字'));
+            }else{
+              callback();
+              }}, trigger: 'change' }
           ],
           tags:[
-            { required: true, validator: validateTags, trigger: 'submit' }
+            { required: true,validator:validateTags, message: '关联标签必填', trigger: 'change' }
           ]
         }
       }
@@ -108,7 +110,7 @@
           if(res.data.code === '0') {
             this.form = this.parseData(res.data.data);
             this.editData = Object.assign({},this.form);
-            this.len=res.data.data.details&&res.data.data.details.length;
+            //this.len=res.data.data.details&&res.data.data.details.length;
           }else{
             this.warning("数据获取失败");
           }
@@ -125,13 +127,13 @@
       parseData(info){
         let detail = [];
         info.details.forEach((it)=>{
-          detail.push(Object.assign({},it,{position:this.mapStringToNum(it.position)}));
+          detail.push(Object.assign({},it,{position:this.mapStringToNum(it.position),disabled:true}));
         });
         return {
           id:info.id,
           name:info.name,
-          tagFor:info.questionList[0].type+'',
-          selectedTags:info.questionList,
+          tagFor:info.questionList?info.questionList[0].type+'':'',
+          selectedTags:info.questionList||[],
           prags:detail
         };
       },
@@ -185,6 +187,10 @@
         if(!goOn){
           return;
         }
+        if(!this.form.selectedTags||this.form.selectedTags.length==0){
+          this.warning('请选择关联标签!');
+          return;
+        }
         //通过必填验证,提交保存
        const param = {
           id:this.editData.id||undefined,
@@ -201,7 +207,7 @@
         return arr;
       },
       parseTagsForSubmit(data){
-        return data.map((it)=>{
+        return data&&data.map((it)=>{
           return {questionId:it.id,introduceId:'',type:it.type};
         });
       },

+ 3 - 7
src/components/icss/AddSimilarName.vue

@@ -9,7 +9,7 @@
           <input type="text" name="" v-model="searchStr" class="name">
           <span class="search" @click.stop="search">搜索</span>
           <ul v-if="showFlag">
-            <li v-for="it in searchDatas" :key="it.id" @click="choose(it)" :title="it.tagName.length>10?it.tagName:''">{{it.tagName}}</li>
+            <li v-for="it in searchDatas" :key="it.id" @click="choose(it)" :title="it.tagName.length>10?it.tagName+'('+it.typeName+')':''">{{it.tagName+'('+it.typeName+')'}}</li>
           </ul>
         </div>   
         <span></span>
@@ -132,7 +132,7 @@
       }
     },
     created(){
-      const id = this.$route.params.id;console.log(66,this.$route.params);
+      const id = this.$route.params.id;
       if(id){
         this.id = id;
         this.name = this.$route.params.name;
@@ -161,7 +161,6 @@
               }
             }
           }else{
-            // console.log(result.msg);
             this.$message({
               message:result.msg,
               type:'warning'
@@ -188,7 +187,6 @@
         let dataList = [];
         if(this.flag){ //修改
           if(!selfName[0].retrievalSpell){
-            // this.$message.error("本体拼音不能为空");
             this.$message({
               message:"本体拼音不能为空",
               type:'warning'
@@ -199,7 +197,6 @@
           this.toast = "修改成功";
         }else{
           if(!selfEmpty[0].retrievalSpell){
-            // this.$message.error("本体拼音不能为空");
             this.$message({
               message:"本体拼音不能为空",
               type:'warning'
@@ -213,7 +210,7 @@
         let filterData = dataList.filter((item)=>{
           return item.retrievalName||item.retrievalSpell;
         })
-        // console.log(111,dataList,filterData);
+        
         let emptyData = filterData.filter((item)=>{
           return !item.retrievalName|| !item.retrievalSpell;
         })
@@ -238,7 +235,6 @@
             });
             this.$router.push({path:'LT-YXSJWH-BMWH'});
           }else{
-            // console.log(result.msg);
             this.$message({
               message:result.msg,
               type:'warning'

+ 35 - 8
src/components/icss/AddVersion.vue

@@ -20,10 +20,10 @@
           <el-form-item label="版本备注:" prop="remark" class="discDesc">
               <el-input type="textarea" :rows="3" placeholder="请输入版本备注" v-model="form.remark" maxlength="120"></el-input>
           </el-form-item>
-          <el-form-item label="版本说明:" v-if="list.length>0">
+          <el-form-item label="版本说明:" v-if="list&&list.length>0">
           </el-form-item>
         </el-form>
-        <VersionDesc v-if="id" :detail="list" :versionId="id" :isFirst="isFirst"/>
+        <VersionDesc v-if="id" :detail="list" :versionId="id" :isFirst="isFirst" :isCopy="copy" @func="getDetailList"/>
         <el-button class="disclButn" size="small" type="primary" @click="comfirn">确定</el-button>
       </div>    
     </div>
@@ -55,23 +55,26 @@
           disabledDate(time) {
             return time.getTime() < Date.now();
           },
-        }
+        },
+        copy:null
       }
     },
     created(){
       let info = this.$route.params.info;
+      this.copy = this.$route.params.copy;
       if(info){
         this.id = info.id;
         this.form.name = info.name;
         this.form.refreshTime = info.refreshTime;
         this.form.remark = info.remark;
-        this.title = "版本信息维护-修改版本信息";
+        this.title = this.copy?"版本信息维护-复制版本信息":"版本信息维护-修改版本信息";
         this.isFirst = true;
-        this.getList();
+        // this.getList();
+        this.list = info.detail;
       }
     },
     methods:{
-      getList(){
+      /*getList(){
         api.getVersionDetlInfo({id:this.id}).then((res)=>{
           const result = res.data;
           if(result.code==0){
@@ -83,9 +86,19 @@
             });
           }
         })
+      },*/
+      getDetailList(data){//子组件数据
+        this.list = data;
       },
       comfirn(){
-        if(this.id){//修改
+        if(!this.form.name.trim() || !this.form.refreshTime.trim()){
+          this.$message({
+            message:'请填写相关内容',
+            type:'warning'
+          });
+          return
+        }
+        if(this.id && !this.copy){//修改
           const param = Object.assign({},this.form,{id:this.id})
           api.updateVersInfo(param).then((res)=>{
             if(res.data.code==0){
@@ -102,7 +115,21 @@
             }
           })
         }else{//添加
-          api.addVersInfo(this.form).then((res)=>{
+          // 复制时把list多余字段过滤掉,如id等
+          const detail = this.list;
+          let copyDetail=[];
+          let item={};
+          if(detail && detail.length>0){
+            for(let i=0; i<detail.length; i++){
+              item.title = detail[i].title;
+              item.description = detail[i].description;
+              copyDetail.push(item);
+              item={};
+            }
+          }
+          const params = Object.assign({},this.form,{'versionDetail':copyDetail});
+          // api.addVersInfo(this.form).then((res)=>{
+          api.addVersInfo(params).then((res)=>{
             if(res.data.code==0){
               this.$message({
                 message:"添加成功",

+ 1 - 1
src/components/icss/CommonSymptom.vue

@@ -181,7 +181,7 @@
         }).catch(() => {});
       },
       showDelDialog(row){
-        this.showConfirmDialog('是否删除该科室常见症状?',()=>{
+        this.showConfirmDialog('是否删除该常见选项?',()=>{
           const param = {
             "deptId": row.id,
             "type": row.type

+ 7 - 5
src/components/icss/DisclaimerInformation.vue

@@ -44,8 +44,8 @@
                         label="状态">
                     <template slot-scope="scope">
                         <el-button type="text" size="small" :class="{forbid:scope.row.status==0}" @click="toOpen(scope.row)">启用</el-button>
-                        <span style="margin:0 3px;">|</span>
-                        <el-button type="text" size="small" :class="['delete',{'forbid':scope.row.status==1}]" @click="toClose(scope.row)">停用</el-button>
+                        <!-- <span style="margin:0 3px;">|</span>
+                        <el-button type="text" size="small" :class="['delete',{'forbid':scope.row.status==1}]" @click="toClose(scope.row)">停用</el-button> -->
                     </template>
                 </el-table-column>
                 <el-table-column
@@ -53,7 +53,7 @@
                     <template slot-scope="scope">
                         <el-button type="text" size="small" @click="toEditDiscl(scope.row)">修改</el-button>
                         <span style="margin:0 3px;">|</span>
-                        <el-button type="text" size="small" class="delete" @click="showDelDialog(scope.row.id)">删除</el-button>
+                        <el-button type="text" size="small" :class="['delete',{'forbid':scope.row.status==1}]" @click="showDelDialog(scope.row)">删除</el-button>
                     </template>
                 </el-table-column>
                 <el-table-column
@@ -160,9 +160,11 @@
           resolve();
         }).catch(() => {});
       },
-      showDelDialog(id){
+      showDelDialog(item){
+        // 启用状态下不能删除
+        if(item.status==1){return}
         this.showConfirmDialog('是否删除该免责声明?',()=>{
-          api.delDiscInformation({id}).then((res)=>{
+          api.delDiscInformation({id:item.id}).then((res)=>{
             if(res.data.code=='0'){
               this.warning(res.data.msg||'操作成功','success');
               this.getDataList();

+ 12 - 6
src/components/icss/InfoParagraph.vue

@@ -2,19 +2,19 @@
     <el-form :rules="rules" :model="data" ref="form" class="sub-form">
             <p class="line"></p>
             <!--<el-input v-model="form.orderNo" :value="index" type="hidden"></el-input>-->
-            <el-form-item label="是否属于诊断:" prop="isReason">
-                <el-select v-model="data.isReason" placeholder="请选择" :disabled="isEdit&&index<len">
+            <el-form-item label="是否属于诊断依据:" prop="isReason">
+                <el-select v-model="data.isReason" placeholder="请选择" :disabled="isEdit&&data.disabled">
                     <el-option label="否" :value="0"></el-option>
                     <el-option label="是" :value="1"></el-option>
                 </el-select>
             </el-form-item>
             <el-form-item label="显示位置:" prop="position" label-width="130px">
-                <el-checkbox-group v-model="data.position" :disabled="isEdit&&index<len">
+                <el-checkbox-group v-model="data.position" :disabled="isEdit&&data.disabled">
                     <el-checkbox v-for="it in positions" :key="it.key" :label="it.key">{{it.name}}</el-checkbox>
                 </el-checkbox-group>
             </el-form-item>
             <el-form-item label="标题" prop="title" label-width="130px">
-                <el-input v-model="data.title" maxlength="120"></el-input>
+                <el-input v-model="data.title"></el-input>
             </el-form-item>
             <el-form-item label="内容" prop="content" label-width="130px">
                 <quillEditor v-model="data.content" :options="editorOption"></quillEditor>
@@ -35,7 +35,7 @@
   import {container, ImageExtend, QuillWatch} from 'quill-image-extend-module';
   Quill.register('modules/ImageExtend', ImageExtend);
   export default{
-    props:['data','index','isEdit','len'],
+    props:['data','index','isEdit'],
     name:'InfoParagraph',
     components:{
       quillEditor
@@ -75,7 +75,13 @@
               { required: true, message: '请选择显示位置', trigger: 'change' }
             ],
             title: [
-              { required: true, message: '请输入段落标题', trigger: 'change' }
+              { required: true, message: '请输入段落标题', trigger: 'change' },
+              { validator: (rule,value,callback)=>{
+                  if(value.length>120){
+                    callback(new Error('段落标题不能超过120字'));
+                  }else{
+                    callback();
+                  }}, trigger: 'change' }
             ],
             content: [
               { required: true, message: '请输入段落内容', trigger: 'change' }

+ 23 - 7
src/components/icss/NoiseTemplate.vue

@@ -232,12 +232,17 @@ export default {
         })
       });*/
       const h = this.$createElement;
+      const {isEdit} = this.$route.params;
+      const addMsg = h('div',{style:'padding-bottom:10px'},[
+            h('p',{style:'font-size:15px;margin-bottom:10px'},'是否保存该标签组?')
+          ])
+      const modMsg = h('div',{style:'padding-bottom:10px'},[
+            h('p',{style:'font-size:15px;margin-bottom:10px'},'是否保存该标签组?'),
+            h('span',{style:'color:red;font-size:12px'},'若标签系统名称已经改变,请去别名维护中修改相关信息'),
+          ])
       this.$msgbox({
         title:'提示',
-        message:h('div',{style:'padding-bottom:10px'},[
-            h('p',{style:'font-size:15px;margin-bottom:10px'},'是否保存该标签组?'),
-            h('span',{style:'color:red;font-size:12px'},'标签系统名称已经改变,请去别名维护中修改相关信息'),
-          ]),
+        message:isEdit?modMsg:addMsg,
         showCancelButton: true,
         distinguishCancelAndClose:true,
         confirmButtonText: '确认并前往别名维护',
@@ -248,9 +253,20 @@ export default {
         api.saveOrUpdate(param).then((res) => {
           if (res.data.code === '0') {
             this.warning(res.data.msg || '保存成功', 'success');
-            this.$router.push({
-              name:'AddSimilarName',
-              params: {id:param.questionWrapper.id,name:param.questionWrapper.tagName}
+            // 判断是否已有别名--有(修改),无(新增)
+            const item = {id:param.questionWrapper.id,name:param.questionWrapper.tagName};
+            api.similarNameDetl(item).then((res)=>{
+              if(res.data.code=='0'){
+                this.$router.push({
+                  name:'AddSimilarName',
+                  params: item
+                })
+              }else{
+                this.$router.push({
+                  name:'AddSimilarName',
+                  params: {}
+                })
+              }
             })
           } else {
             this.warning(res.data.msg)

+ 2 - 2
src/components/icss/PromptTagPool.vue

@@ -169,11 +169,11 @@
         }
         let param = {
           "tagName": this.searchVal,
-          "tagType": [1, 2],
+          "tagType": [],
           "controlType": [],
           "type": this.type || '',
           "notIds": notIds,
-          "sexType": 3,
+          "sexType": '',
 
         }
         api.searchTagList(param).then((res) => {

+ 8 - 2
src/components/icss/TemplateMaintenanceWrap.vue

@@ -71,10 +71,16 @@ export default {
       //仍需验证标签明细是否选择
       let type = this.dataPub.region1,name=this.dataPub.region2;
       let detailLis = utils.orderTemplateData(this.sendIds)
-      console.log(detailLis)
+      // console.log(detailLis.text == '' , detailLis.questionId == '')
       if (JSON.stringify(this.sendIds) == '[]' || !detailLis) {
         this.$message({
-          message: '请选择模板内容',
+          message: '模板至少包含一个标签池标签',
+          type: 'warning'
+        });
+        return;
+      }else if(detailLis[0].text == '' && detailLis[0].questionId == ''){
+        this.$message({
+          message: '保存模版时,无法保存单独的输入栏',
           type: 'warning'
         });
         return;

+ 119 - 60
src/components/icss/VersionDesc.vue

@@ -1,6 +1,6 @@
 <template>
   <div class="version-desc">
-    <el-table v-if="list.length>0" 
+    <el-table v-if="list&&list.length>0" 
               :data="list"
               border
               style="width: 100%">
@@ -11,11 +11,17 @@
                 width="60">
         </el-table-column>
         <el-table-column
+                v-if="!isCopy"
                 prop="gmtCreate"
                 label="建立时间"
                 :show-overflow-tooltip="true">
         </el-table-column>
         <el-table-column
+                prop="title"
+                label="标题">
+        </el-table-column>
+        <el-table-column
+                v-if="!isCopy"
                 prop="modifierid"
                 label="操作人">
         </el-table-column>
@@ -65,7 +71,7 @@
           return callback(new Error('请输入标题'));
         }
         if (value.length > 30) {
-           this.form.name = value.substr(0, 120);
+           this.form.name = value.substr(0, 30);
            this.$message({
              showClose: true,
              type: 'warning',
@@ -96,12 +102,16 @@
       }
     },
     created(){
-      if(this.versionId){
-        this.getList();
-      }
+      // if(this.versionId){
+      //   this.getList();
+      // }
     },
-    props:['detail','versionId','isFirst'],
+    mounted(){
+      this.list = JSON.parse(JSON.stringify(this.detail));
+    },
+    props:['detail','versionId','isFirst','isCopy'],
     methods:{
+      //用于修改时及时更新明细信息,若用本地信息,建立时间和操作人无法及时更新。
       getList(){
         api.getVersionDetlInfo({id:this.versionId}).then((res)=>{
           const result = res.data;
@@ -116,11 +126,9 @@
         })
       },
       indexMethod(index) {
-        // return ((1 - 1) * 10) + index + 1;
         return index + 1;
       },
       toEditDesc(item){//修改备注
-        console.log(124,item);
         this.minTitle='修改说明';
         this.showBox = true;
         this.form.title = item.title;
@@ -132,54 +140,83 @@
         this.showBox = true;
       },
       comfirn(){//记得清空modiId
-        if(this.modiId){//修改
-          const param = {
-            title:this.form.title,
-            description:this.form.description,
-            detailId:this.modiId
-          }
-          api.modiVersionInfo(param).then((res)=>{
-            if(res.data.code==0){
-              this.$message({
-                message:"添加成功",
-                type:'success'
+        // 修改--直接调修改接口;复制--新增
+          if(this.modiId){//修改
+            if(!this.isCopy){
+              const param = {
+                title:this.form.title,
+                description:this.form.description,
+                detailId:this.modiId
+              }
+              api.modiVersionInfo(param).then((res)=>{
+                if(res.data.code==0){
+                  this.$message({
+                    message:"修改成功",
+                    type:'success'
+                  })
+                  this.getList();
+                  /*for(let i in this.list){
+                    if(this.list[i].id==this.modiId){
+                      this.list[i].title=this.form.title;
+                      this.list[i].description=this.form.description;
+                    }
+                  }*/
+                  this.reset();
+                }else{
+                  this.$message({
+                    message:res.data.msg,
+                    type:'warning'
+                  });
+                }
               })
-              this.getList();
             }else{
-              this.$message({
-                message:res.data.msg,
-                type:'warning'
-              });
+              for(let i in this.list){
+                if(this.list[i].id==this.modiId){
+                  this.list[i].title=this.form.title;
+                  this.list[i].description=this.form.description;
+                }
+              }
+              this.$emit('func',this.list);//向父组件传明细
+              this.reset();
+            }
+            
+          }else if(this.showDesc){//明细
+            this.reset();
+          }else{//添加
+            const item = {
+              description: this.form.description,
+              title: this.form.title,
             }
-          })
-        }else if(this.showDesc){//明细
-
-        }else{//添加
-          const params = {
-            versionDetail: [
-              {
-                description: this.form.description,
-                title: this.form.title,
+            if(!this.isCopy){
+              const params = {
+                versionDetail: [
+                  item
+                ],
+                versionInfoId: this.versionId
               }
-            ],
-            versionInfoId: this.versionId
-          }
-          api.addVersionInfo(params).then((res)=>{
-            if(res.data.code==0){
-              this.$message({
-                message:"添加成功",
-                type:'success'
+              api.addVersionInfo(params).then((res)=>{
+                if(res.data.code==0){
+                  this.$message({
+                    message:"添加成功",
+                    type:'success'
+                  })
+                  this.getList();
+                  /*this.list.push(item);*/
+                  this.reset();
+                }else{
+                  this.$message({
+                    message:res.data.msg,
+                    type:'warning'
+                  });
+                }
               })
-              this.getList();
-            }else{
-              this.$message({
-                message:res.data.msg,
-                type:'warning'
-              });
-            }
-          })
-        }
-        this.reset();
+            }else{//仅添加到本地list
+              this.list.push(item);
+              this.$emit('func',this.list);
+              this.reset();
+            } 
+          }
+          // this.reset();
       },
       reset(){//关闭弹窗复原数据
         this.showBox = false;
@@ -216,18 +253,40 @@
       },
       showDelDialog(id){
         this.showConfirmDialog('是否删除该版本说明?',()=>{
-          api.delVersionInfo({id}).then((res)=>{
-            if(res.data.code=='0'){
-              this.warning(res.data.msg||'操作成功','success');
-              this.getList();
-            }else{
-              this.warning(res.data.msg);
+          if(!this.isCopy){
+            api.delVersionInfo({id}).then((res)=>{
+              if(res.data.code=='0'){
+                this.warning(res.data.msg||'操作成功','success');
+                this.getList();
+                /*let newList = JSON.parse(JSON.stringify(this.list));
+                for(let i in newList){
+                  if(newList[i].id==id){
+                    this.list.splice(i,1);
+                  }
+                }*/
+              }else{
+                this.warning(res.data.msg);
+              }
+            }).catch((error)=>{
+              this.warning(error);
+            })
+          }else{
+            let newList = JSON.parse(JSON.stringify(this.list));
+            for(let i in newList){
+              if(newList[i].id==id){
+                this.list.splice(i,1);
+              }
             }
-          }).catch((error)=>{
-            this.warning(error);
-          })
+            this.$emit('func',this.list);
+          }
+          
         });
       },
+    },
+    watch:{
+      list:function(newVal,oldVal){
+        return newVal;
+      }
     }
   }
 </script>

+ 5 - 3
src/components/icss/VersionInfo.vue

@@ -43,7 +43,9 @@
                 <el-table-column
                         label="操作">
                     <template slot-scope="scope">
-                        <el-button type="text" size="small" :class="{forbid:scope.row.id !=list[0].id}" @click="scope.row.id ==list[0].id?toEditVersion(scope.row):''">修改</el-button>
+                        <el-button type="text" size="small" :class="{forbid:scope.row.id !=list[0].id}" @click="scope.row.id ==list[0].id?toEditVersion(scope.row,false):''">修改</el-button>
+                        <span style="margin:0 3px;">|</span>
+                        <el-button type="text" size="small" :class="{forbid:scope.row.id !=list[0].id}" @click="scope.row.id ==list[0].id?toEditVersion(scope.row,true):''">复制</el-button>
                     </template>
                 </el-table-column>
                 <el-table-column
@@ -87,10 +89,10 @@
       this.getDataList();
     },
     methods: {
-      toEditVersion(row){
+      toEditVersion(row,flag){
         this.$router.push({
           name:'AddVersion',
-          params: {info:row}
+          params: {info:row,copy:flag}
         })
       },
       filterDatas(){