|
@@ -3,9 +3,10 @@
|
|
<crumbs :title="title" linkTo="/admin/LT-YXSJWH-BBXXWH"></crumbs>
|
|
<crumbs :title="title" linkTo="/admin/LT-YXSJWH-BBXXWH"></crumbs>
|
|
<div class="contents">
|
|
<div class="contents">
|
|
<div class="content">
|
|
<div class="content">
|
|
- <el-form ref="form" :label-position="labelPosition" label-width="95px" class="add-admin-form" :model="form" :rules="rules">
|
|
|
|
- <el-form-item label="版本号:" prop="name">
|
|
|
|
- <el-input v-model="form.name" placeholder="请输入版本号" maxlength="120"></el-input>
|
|
|
|
|
|
+ <!-- <el-form ref="form" :label-position="labelPosition" label-width="95px" class="add-admin-form" :model="form" :rules="rules"> -->
|
|
|
|
+ <el-form ref="form" :label-position="labelPosition" label-width="95px" class="add-version-form" :model="form" :rules="rules">
|
|
|
|
+ <el-form-item label="版本号:" prop="name" class="version-num">
|
|
|
|
+ <el-input v-model="form.name" placeholder="请输入版本号" maxlength="30"></el-input>
|
|
</el-form-item>
|
|
</el-form-item>
|
|
<el-form-item label="版本时间:" prop="refreshTime">
|
|
<el-form-item label="版本时间:" prop="refreshTime">
|
|
<el-date-picker
|
|
<el-date-picker
|
|
@@ -22,9 +23,11 @@
|
|
</el-form-item>
|
|
</el-form-item>
|
|
<el-form-item label="版本说明:" v-if="list&&list.length>0">
|
|
<el-form-item label="版本说明:" v-if="list&&list.length>0">
|
|
</el-form-item>
|
|
</el-form-item>
|
|
|
|
+ <VersionDesc :detail="list" :versionId="id" :isFirst="isFirst" :isCopy="copy" @func="getDetailList"/>
|
|
|
|
+ <el-button class="disclButn" size="small" type="primary" @click="comfirn('form')">确定</el-button>
|
|
</el-form>
|
|
</el-form>
|
|
- <VersionDesc :detail="list" :versionId="id" :isFirst="isFirst" :isCopy="copy" @func="getDetailList"/>
|
|
|
|
- <el-button class="disclButn" size="small" type="primary" @click="comfirn">确定</el-button>
|
|
|
|
|
|
+ <!-- <VersionDesc :detail="list" :versionId="id" :isFirst="isFirst" :isCopy="copy" @func="getDetailList"/>
|
|
|
|
+ <el-button class="disclButn" size="small" type="primary" @click="comfirn">确定</el-button> -->
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
@@ -35,6 +38,20 @@
|
|
export default {
|
|
export default {
|
|
name:'AddVersion',
|
|
name:'AddVersion',
|
|
data(){
|
|
data(){
|
|
|
|
+ const titleVaild = (rule, value, callback) => {
|
|
|
|
+ if (!value) {
|
|
|
|
+ return callback(new Error('请输入版本号'));
|
|
|
|
+ }
|
|
|
|
+ if (value.length >= 30) {
|
|
|
|
+ this.form.name = value.substr(0, 30);
|
|
|
|
+ this.$message({
|
|
|
|
+ showClose: true,
|
|
|
|
+ type: 'warning',
|
|
|
|
+ message: '已超过最大字数限制'
|
|
|
|
+ })
|
|
|
|
+ }
|
|
|
|
+ callback();
|
|
|
|
+ };
|
|
return{
|
|
return{
|
|
// data:{},
|
|
// data:{},
|
|
list:[],
|
|
list:[],
|
|
@@ -48,7 +65,8 @@
|
|
},
|
|
},
|
|
id:null,
|
|
id:null,
|
|
rules:{
|
|
rules:{
|
|
- name:{ required: true, message: '请输入版本号', trigger: ['blur', 'change'] },
|
|
|
|
|
|
+ name:[{ required: true, validator: titleVaild, trigger: [ 'change'] },
|
|
|
|
+ { required: true, message: '请输入版本号',trigger: ['blur', 'change'] }],
|
|
refreshTime:{ required: true, message: '请选择时间', trigger: ['blur', 'change'] }
|
|
refreshTime:{ required: true, message: '请选择时间', trigger: ['blur', 'change'] }
|
|
},
|
|
},
|
|
pickerOptions1:{
|
|
pickerOptions1:{
|
|
@@ -89,60 +107,66 @@
|
|
getDetailList(data){//子组件数据
|
|
getDetailList(data){//子组件数据
|
|
this.list = data;
|
|
this.list = data;
|
|
},
|
|
},
|
|
- comfirn(){
|
|
|
|
- if(!this.form.name.trim() || !this.form.refreshTime.trim()){
|
|
|
|
|
|
+ comfirn(form){
|
|
|
|
+ /*if(!this.form.name.trim() || !this.form.refreshTime.trim()){
|
|
this.$message({
|
|
this.$message({
|
|
message:'请填写相关内容',
|
|
message:'请填写相关内容',
|
|
type:'warning'
|
|
type:'warning'
|
|
});
|
|
});
|
|
return
|
|
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){
|
|
|
|
- this.$message({
|
|
|
|
- message:"修改成功",
|
|
|
|
- type:'success'
|
|
|
|
|
|
+ }*/
|
|
|
|
+ this.$refs[form].validate((valid) => {
|
|
|
|
+ if (valid) {
|
|
|
|
+ if(this.id && !this.copy){//修改
|
|
|
|
+ const param = Object.assign({},this.form,{id:this.id})
|
|
|
|
+ api.updateVersInfo(param).then((res)=>{
|
|
|
|
+ if(res.data.code==0){
|
|
|
|
+ this.$message({
|
|
|
|
+ message:"修改成功",
|
|
|
|
+ type:'success'
|
|
|
|
+ })
|
|
|
|
+ this.$router.push({path: 'LT-YXSJWH-BBXXWH'});
|
|
|
|
+ }else{
|
|
|
|
+ this.$message({
|
|
|
|
+ message:res.data.msg,
|
|
|
|
+ type:'warning'
|
|
|
|
+ });
|
|
|
|
+ }
|
|
})
|
|
})
|
|
- this.$router.push({path: 'LT-YXSJWH-BBXXWH'});
|
|
|
|
- }else{
|
|
|
|
- this.$message({
|
|
|
|
- message:res.data.msg,
|
|
|
|
- type:'warning'
|
|
|
|
- });
|
|
|
|
- }
|
|
|
|
- })
|
|
|
|
- }else{//添加
|
|
|
|
- // 复制时把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:"添加成功",
|
|
|
|
- type:'success'
|
|
|
|
|
|
+ }else{//添加
|
|
|
|
+ // 复制时把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:"添加成功",
|
|
|
|
+ type:'success'
|
|
|
|
+ })
|
|
|
|
+ this.$router.push({path: 'LT-YXSJWH-BBXXWH'});
|
|
|
|
+ }else{
|
|
|
|
+ this.$message({
|
|
|
|
+ message:res.data.msg,
|
|
|
|
+ type:'warning'
|
|
|
|
+ });
|
|
|
|
+ }
|
|
})
|
|
})
|
|
- this.$router.push({path: 'LT-YXSJWH-BBXXWH'});
|
|
|
|
- }else{
|
|
|
|
- this.$message({
|
|
|
|
- message:res.data.msg,
|
|
|
|
- type:'warning'
|
|
|
|
- });
|
|
|
|
- }
|
|
|
|
- })
|
|
|
|
- }
|
|
|
|
|
|
+ }
|
|
|
|
+ } else {
|
|
|
|
+ return false;
|
|
|
|
+ }
|
|
|
|
+ });
|
|
},
|
|
},
|
|
},
|
|
},
|
|
components:{
|
|
components:{
|
|
@@ -150,7 +174,7 @@
|
|
}
|
|
}
|
|
}
|
|
}
|
|
</script>
|
|
</script>
|
|
-<style lang="less" scoped>
|
|
|
|
|
|
+<style lang="less">
|
|
@import "../../less/admin.less";
|
|
@import "../../less/admin.less";
|
|
.content{
|
|
.content{
|
|
background: #fff;
|
|
background: #fff;
|
|
@@ -165,7 +189,12 @@
|
|
.disclButn{
|
|
.disclButn{
|
|
position: absolute;
|
|
position: absolute;
|
|
right: 80px;
|
|
right: 80px;
|
|
- bottom: 0px;
|
|
|
|
|
|
+ bottom: 10px;
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ .add-version-form{
|
|
|
|
+ .version-num{
|
|
|
|
+ width: 500px;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|