瀏覽代碼

别名维护-添加标签归属;免责声明停用功能去掉;版本信息新增复制功能

liucf 6 年之前
父節點
當前提交
973f08050c

+ 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') {

+ 15 - 4
src/components/icss/AddIndeptLabel.vue

@@ -195,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 - 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'

+ 27 - 7
src/components/icss/AddVersion.vue

@@ -23,7 +23,7 @@
           <el-form-item label="版本说明:" v-if="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,12 @@
             });
           }
         })
+      },*/
+      getDetailList(data){//子组件数据
+        this.list = data;
       },
       comfirn(){
-        if(this.id){//修改
+        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 +108,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:"添加成功",

+ 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();

+ 14 - 3
src/components/icss/NoiseTemplate.vue

@@ -252,9 +252,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)

+ 114 - 59
src/components/icss/VersionDesc.vue

@@ -11,6 +11,7 @@
                 width="60">
         </el-table-column>
         <el-table-column
+                v-if="!isCopy"
                 prop="gmtCreate"
                 label="建立时间"
                 :show-overflow-tooltip="true">
@@ -20,6 +21,7 @@
                 label="标题">
         </el-table-column>
         <el-table-column
+                v-if="!isCopy"
                 prop="modifierid"
                 label="操作人">
         </el-table-column>
@@ -69,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',
@@ -100,12 +102,16 @@
       }
     },
     created(){
-      if(this.versionId){
-        this.getList();
-      }
+      // if(this.versionId){
+      //   this.getList();
+      // }
+    },
+    mounted(){
+      this.list = JSON.parse(JSON.stringify(this.detail));
     },
-    props:['detail','versionId','isFirst'],
+    props:['detail','versionId','isFirst','isCopy'],
     methods:{
+      //用于修改时及时更新明细信息,若用本地信息,建立时间和操作人无法及时更新。
       getList(){
         api.getVersionDetlInfo({id:this.versionId}).then((res)=>{
           const result = res.data;
@@ -120,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;
@@ -136,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){//明细
-
-        }else{//添加
-          const params = {
-            versionDetail: [
-              {
-                description: this.form.description,
-                title: this.form.title,
+            
+          }else if(this.showDesc){//明细
+            this.reset();
+          }else{//添加
+            const item = {
+              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;
@@ -220,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(){