[update] 参数模板 复制

This commit is contained in:
zhaomeijing
2022-06-08 14:39:43 +08:00
parent 40addf6193
commit 7c3a919ff6
@@ -20,8 +20,6 @@
<a-col :span='9'>
</a-col>
<a-col :span='6'>
<!-- <a-button class='box-button' type='primary' @click='searchQuery'>{{ $t('query') }}</a-button>-->
<!-- <a-button class='box-button' style='margin-left: 8px' @click='searchReset'>{{ $t('reset') }}</a-button>-->
</a-col>
</a-row>
<a-row :gutter='24'>
@@ -130,7 +128,8 @@ export default {
confirmLoading: false,
selectedRowKeys: [],
pageNo: 1,
pageSize: 10
pageSize: 10,
row: {}
}
},
props: {
@@ -189,34 +188,6 @@ export default {
handleCancel() {
this.$emit('areaVisible', false)
},
// onGetCheckboxProps(val,value) {
// let _val = {}
// // 新增时没有
// if(this.formData.id === undefined) {
// props : {}
// } else {
// // 编辑
// props : {
// disabled: val.id === 'ce879dab56a243fd99119553d3899e62'
// }
// }
// console.log(this.formData.id,'this.formData.id')
// console.log(val)
// return(_val
// // {
// // props: {
// //
// // // console.log(value,'value')
// // // // 全部默认禁止选中
// // // // disabled: true,
// // // // 某几项默认禁止选中(R: 当state等于1时)
// // disabled: val.id === 'ce879dab56a243fd99119553d3899e62'
// // // // 某几项默认选中(R: 当state等于1时)
// // // // defaultChecked: record.state == 1,
// // }
// // }
// )
// },
onSelectChange(selectedRowKeys, selectedRowKeysDate) {
this.selectedRowKeysDate = selectedRowKeysDate
this.selectedRowKeys = selectedRowKeys
@@ -230,12 +201,14 @@ export default {
this.form = {}
},
editData(edit) {
// 编辑一行的数据
this.row = edit
this.formData = {...edit}
this.selectedRowKeys = edit.paramsTemplateId.split(',')
},
//新增
handleSubmit() {
console.log(this.row.version,'this.row.versionthis.row.version')
if (this.selectedRowKeys.length == 0) {
this.$message.warning(this.$t('pleaseSelectData'))
} else if (this.selectedRowKeys.length > 1) {
@@ -245,64 +218,53 @@ export default {
if (valid) {
this.flag = true
this.spinLoading = true
// 新增編輯之前 判断 标题唯一
getAction(`params/manifest/verifyTitle?projectId=${this.$route.query.id}
&title=${this.formData.title}`, {})
.then(res => {
if (res.result) {
let postDate = {
title: this.formData.title,
paramsTemplateId: this.paramsTemplateId || this.selectedRowKeys[0],
paramsTemplatePublishVersion: this.selectedRowKeysDate[0].version,
projectId: this.projectId
}
if (this.formData.id) {
//编辑
postDate = {
id : this.formData.id,
...postDate
}
postAction(`params/manifest/edit`, postDate).then(res => {
if (res.success) {
this.newVisible = false
this.$emit('areaVisible', false)
this.$message.success(this.$t('OperationSuccessful'))
} else {
this.$message.warning(res.message)
}
}
).finally(() => {
this.flag = false
this.spinLoading = false
this.newVisible = false
})
} else {
//新增
postAction(`params/manifest/add`, postDate).then(res => {
if (res.success) {
this.newVisible = false
this.$emit('areaVisible', false)
this.$message.success(this.$t('OperationSuccessful'))
} else {
this.$message.warning(res.message)
}
}
).finally(() => {
this.flag = false
this.spinLoading = false
this.newVisible = false
})
}
} else {
this.$message.warning(this.$t('changeTheTitle'))
this.spinLoading = false
let postDate = {
title: this.formData.title,
paramsTemplateId: this.paramsTemplateId || this.selectedRowKeys[0],
paramsTemplatePublishVersion: this.row.version,
projectId: this.projectId
}
if (this.formData.id) {
//编辑
postDate = {
id : this.formData.id,
...postDate
}
}).finally(() => {
this.loading = false
})
} else {
return false
}
postAction(`params/manifest/edit`, postDate).then(res => {
if (res.success) {
this.newVisible = false
this.$emit('areaVisible', false)
this.$message.success(this.$t('OperationSuccessful'))
} else {
this.$message.warning(res.message)
}
}
).finally(() => {
this.flag = false
this.spinLoading = false
this.newVisible = false
})
} else {
//新增
postAction(`params/manifest/add`, postDate).then(res => {
if (res.success) {
this.newVisible = false
this.$emit('areaVisible', false)
this.$message.success(this.$t('OperationSuccessful'))
} else {
this.$message.warning(res.message)
}
}
).finally(() => {
this.flag = false
this.spinLoading = false
this.newVisible = false
})
}
} else {
this.$message.warning(this.$t('changeTheTitle'))
this.spinLoading = false
}
})
}
},