[update] 复制

This commit is contained in:
zhaomeijing
2022-05-31 14:58:32 +08:00
parent 38e86f5e46
commit 9f7389a862
@@ -52,7 +52,7 @@
:rowSelection='{selectedRowKeys: selectedRowKeys, onChange: onSelectChange}' :rowSelection='{selectedRowKeys: selectedRowKeys, onChange: onSelectChange}'
@change='handleTableChange'> @change='handleTableChange'>
<span slot='click' slot-scope='text, record'> <span slot='click' slot-scope='text, record'>
<a class='action-edit' @click='editArea(record.id)' v-has="'area:edit'">{{ text }}</a> <a class='action-edit' @click='editArea(record)' v-has="'area:edit'">{{ text }}</a>
</span> </span>
</a-table> </a-table>
<div class="page" style='display: flex;justify-content: flex-end;'> <div class="page" style='display: flex;justify-content: flex-end;'>
@@ -169,10 +169,22 @@ export default {
methods: { methods: {
// 清单列表传出数据 // 清单列表传出数据
listVisibleRow(val) { listVisibleRow(val) {
this.listVisibleRowDate = val this.selectedRowKeys = []
let newAreaTable=JSON.parse(JSON.stringify(this.areaTable))
newAreaTable.forEach((item, index) => {
if( item.id == this.listVisibleRowDate.id ) {
let _obj = {...item}
_obj.paramsTemplateId = val[0].id
_obj.paramsTemplateName = val[0].paramsTemplateName
this.areaTable.splice(index, 1,_obj)
}
})
console.log(this.areaTable,'this.areaTable')
this.listVisible = false this.listVisible = false
}, },
editArea() { editArea(val) {
this.listVisibleRowDate = val
console.log(val)
this.listVisible = true this.listVisible = true
}, },
pageOnChange(page, pageSize) { pageOnChange(page, pageSize) {
@@ -255,61 +267,40 @@ export default {
if (valid) { if (valid) {
this.flag = true this.flag = true
this.spinLoading = true this.spinLoading = true
// 新增編輯之前 判断 标题唯一 let _tt = {
getAction(`params/manifest/verifyTitle?projectId=${this.$route.query.id} paramsTemplateId: this.selectedRowKeysDate[0].paramsTemplateId,
&title=${this.formData.title}`, {}) projectId: this.selectedRowKeysDate[0].projectId,
.then(res => { title: this.selectedRowKeysDate[0].title,
if (res.result) { // paramsTemplatePublishVersion:
let postDate = { sourceManifestId: this.selectedRowKeysDate[0].id,
title: this.formData.title, }
paramsTemplateId: this.paramsTemplateId || this.selectedRowKeys[0], console.log(this.selectedRowKeysDate,'this.selectedRowKeysDate')
paramsTemplatePublishVersion: this.version, axios({
projectId: this.projectId url: `/jero-boot/params/manifest/copy`,
} method: 'post',
if (this.formData.id) { data: _tt,
//编辑 transformRequest: [function (data) {
postDate = { let ret = ''
id : this.formData.id, for (let it in data) {
...postDate ret += encodeURIComponent(it) + '=' + encodeURIComponent(data[it]) + '&'
}
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
} }
}).finally(() => { return ret
this.loading = false }],
headers: {
'Content-Type': 'application/x-www-form-urlencoded',
'X-Access-Token':_this.token
}
}) })
.then( (res) =>{
if (res.data.success) {
_this.$message.success(res.data.result)
}else{
_this.$message.warning(res.data.result)
}
})
.catch( (error) =>{
console.log(error);
});
} else { } else {
return false return false
} }