|
@@ -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>
|