|
|
@@ -53,22 +53,7 @@
|
|
|
export default {
|
|
|
name: 'PackageEdit',
|
|
|
created() {
|
|
|
- if (this.$route.query.id) {
|
|
|
- this.packageId = this.$route.query.id;
|
|
|
- this.$http
|
|
|
- .get('package/get/' + this.$route.query.id)
|
|
|
- .then(res => {
|
|
|
- this.formData = res;
|
|
|
- this.list = JSON.parse(res.workflow) || [];
|
|
|
- })
|
|
|
- .catch(e => {
|
|
|
- console.log(e);
|
|
|
- this.$message.error(e.error);
|
|
|
- });
|
|
|
- // this.$http.get('/stock/byPackageId', { packageId: this.$route.query.id }).then(res => {
|
|
|
- // this.stockList = res;
|
|
|
- // });
|
|
|
- }
|
|
|
+ this.init();
|
|
|
// this.$http
|
|
|
// .post('/attractions/all', { size: 1000, query: { del: false, brand: false } }, { body: 'json' })
|
|
|
// .then(res => {
|
|
|
@@ -181,6 +166,24 @@ export default {
|
|
|
}
|
|
|
},
|
|
|
methods: {
|
|
|
+ init() {
|
|
|
+ if (this.$route.query.id) {
|
|
|
+ this.packageId = this.$route.query.id;
|
|
|
+ this.$http
|
|
|
+ .get('package/get/' + this.$route.query.id)
|
|
|
+ .then(res => {
|
|
|
+ this.formData = res;
|
|
|
+ this.list = JSON.parse(res.workflow) || [];
|
|
|
+ })
|
|
|
+ .catch(e => {
|
|
|
+ console.log(e);
|
|
|
+ this.$message.error(e.error);
|
|
|
+ });
|
|
|
+ // this.$http.get('/stock/byPackageId', { packageId: this.$route.query.id }).then(res => {
|
|
|
+ // this.stockList = res;
|
|
|
+ // });
|
|
|
+ }
|
|
|
+ },
|
|
|
onSave() {
|
|
|
if (this.list.length <= 0) {
|
|
|
this.$refs.form.validate(valid => {
|
|
|
@@ -204,6 +207,9 @@ export default {
|
|
|
},
|
|
|
submit() {
|
|
|
let data = { ...this.formData };
|
|
|
+ if (this.packageId) {
|
|
|
+ data.id = this.packageId;
|
|
|
+ }
|
|
|
data.workflow = JSON.stringify(this.list);
|
|
|
this.saving = true;
|
|
|
this.$http
|
|
|
@@ -212,21 +218,22 @@ export default {
|
|
|
this.saving = false;
|
|
|
// this.$message.success('成功');
|
|
|
this.packageId = res.id;
|
|
|
- this.$nextTick(() => {
|
|
|
- // this.$http.post('/stock/batchSave', {
|
|
|
- // stocks: this.saveOtherJson
|
|
|
- // });
|
|
|
- this.$message.success('成功');
|
|
|
- this.$router.go(-1);
|
|
|
- });
|
|
|
- this.$emit('next', 'second');
|
|
|
- this.$router.replace({
|
|
|
- name: 'PackageEdit',
|
|
|
- query: {
|
|
|
- id: res.id,
|
|
|
- attractionsId: res.attractionsId
|
|
|
- }
|
|
|
- });
|
|
|
+ this.$emit('save', 'page2');
|
|
|
+ // this.$nextTick(() => {
|
|
|
+ // // this.$http.post('/stock/batchSave', {
|
|
|
+ // // stocks: this.saveOtherJson
|
|
|
+ // // });
|
|
|
+ // this.$message.success('成功');
|
|
|
+ // this.$router.go(-1);
|
|
|
+ // });
|
|
|
+ // this.$emit('next', 'second');
|
|
|
+ // this.$router.replace({
|
|
|
+ // name: 'PackageEdit',
|
|
|
+ // query: {
|
|
|
+ // id: res.id,
|
|
|
+ // attractionsId: res.attractionsId
|
|
|
+ // }
|
|
|
+ // });
|
|
|
})
|
|
|
.catch(e => {
|
|
|
console.log(e);
|