[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],
paramsTemplatePublishVersion: this.version,
projectId: this.projectId
} }
if (this.formData.id) { console.log(this.selectedRowKeysDate,'this.selectedRowKeysDate')
//编辑 axios({
postDate = { url: `/jero-boot/params/manifest/copy`,
id : this.formData.id, method: 'post',
...postDate data: _tt,
transformRequest: [function (data) {
let ret = ''
for (let it in data) {
ret += encodeURIComponent(it) + '=' + encodeURIComponent(data[it]) + '&'
} }
postAction(`params/manifest/edit`, postDate).then(res => { return ret
if (res.success) { }],
this.newVisible = false headers: {
this.$emit('areaVisible', false) 'Content-Type': 'application/x-www-form-urlencoded',
this.$message.success(this.$t('OperationSuccessful')) 'X-Access-Token':_this.token
} else {
this.$message.warning(res.message)
} }
}
).finally(() => {
this.flag = false
this.spinLoading = false
this.newVisible = false
}) })
} else { .then( (res) =>{
//新增 if (res.data.success) {
postAction(`params/manifest/add`, postDate).then(res => { _this.$message.success(res.data.result)
if (res.success) { }else{
this.newVisible = false _this.$message.warning(res.data.result)
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(() => {
this.loading = false
}) })
.catch( (error) =>{
console.log(error);
});
} else { } else {
return false return false
} }