fix: 复制模板没有复制关联的字段

This commit is contained in:
chenjianxing 2021-04-23 10:12:58 +08:00 committed by jianxing
parent 5fe9234da6
commit a2ea71614f
4 changed files with 10 additions and 14 deletions

View File

@ -89,17 +89,16 @@ export default {
} }
}, },
methods: { methods: {
open(data) { open(data, isCopy) {
if (data) { if (data) {
Object.assign(this.form, data); Object.assign(this.form, data);
if (!(data.options instanceof Array)) { if (!(data.options instanceof Array)) {
this.form.options = data.options ? JSON.parse(data.options) : []; this.form.options = data.options ? JSON.parse(data.options) : [];
} }
if (data.id) { if (isCopy) {
this.url = 'field/template/issue/update';
} else {
//copy
this.url = 'field/template/issue/add'; this.url = 'field/template/issue/add';
} else {
this.url = 'field/template/issue/update';
} }
} else { } else {
this.form = { this.form = {

View File

@ -152,9 +152,8 @@ export default {
handleCopy(data) { handleCopy(data) {
let copyData = {}; let copyData = {};
Object.assign(copyData, data); Object.assign(copyData, data);
copyData.id = null;
copyData.name = data.name + '_copy'; copyData.name = data.name + '_copy';
this.$refs.templateEdit.open(copyData); this.$refs.templateEdit.open(copyData, true);
}, },
handleDelete(data) { handleDelete(data) {
this.result = this.$get('field/template/issue/delete/' + data.id, () => { this.result = this.$get('field/template/issue/delete/' + data.id, () => {

View File

@ -93,17 +93,16 @@ export default {
} }
}, },
methods: { methods: {
open(data) { open(data, isCopy) {
if (data) { if (data) {
Object.assign(this.form, data); Object.assign(this.form, data);
if (!(data.options instanceof Array)) { if (!(data.options instanceof Array)) {
this.form.options = data.options ? JSON.parse(data.options) : []; this.form.options = data.options ? JSON.parse(data.options) : [];
} }
if (data.id) { if (isCopy) {
this.url = 'field/template/case/update';
} else {
//copy
this.url = 'field/template/case/add'; this.url = 'field/template/case/add';
} else {
this.url = 'field/template/case/update';
} }
} else { } else {
this.form = { this.form = {

View File

@ -161,9 +161,8 @@ export default {
handleCopy(data) { handleCopy(data) {
let copyData = {}; let copyData = {};
Object.assign(copyData, data); Object.assign(copyData, data);
copyData.id = null;
copyData.name = data.name + '_copy'; copyData.name = data.name + '_copy';
this.$refs.templateEdit.open(copyData); this.$refs.templateEdit.open(copyData, true);
}, },
handleDelete(data) { handleDelete(data) {
this.result = this.$get('field/template/case/delete/' + data.id, () => { this.result = this.$get('field/template/case/delete/' + data.id, () => {