|
@@ -1,7 +1,15 @@
|
|
<template>
|
|
<template>
|
|
<div v-if="form">
|
|
<div v-if="form">
|
|
<main-top></main-top>
|
|
<main-top></main-top>
|
|
- <editcon :key="type" ref="child" :type="type" :rule="rule" :form="form" @cancel="backList" @save="save">
|
|
|
|
|
|
+ <editcon
|
|
|
|
+ :key="type"
|
|
|
|
+ ref="child"
|
|
|
|
+ :type="type"
|
|
|
|
+ :rule="rule"
|
|
|
|
+ :form="form"
|
|
|
|
+ @cancel="backList"
|
|
|
|
+ @save="save"
|
|
|
|
+ >
|
|
<template slot-scope="{ form }" slot="content">
|
|
<template slot-scope="{ form }" slot="content">
|
|
<component :data="form" :is="cp" :roleList="roleList" />
|
|
<component :data="form" :is="cp" :roleList="roleList" />
|
|
</template>
|
|
</template>
|
|
@@ -16,18 +24,18 @@ import { formKey, rules } from "./data";
|
|
import { save, getDetail } from "@/configue/api";
|
|
import { save, getDetail } from "@/configue/api";
|
|
|
|
|
|
export default {
|
|
export default {
|
|
- name:'Edit',
|
|
|
|
|
|
+ name: "Edit",
|
|
components: {
|
|
components: {
|
|
- vdetail
|
|
|
|
|
|
+ vdetail,
|
|
},
|
|
},
|
|
data() {
|
|
data() {
|
|
let { type, id } = this.$route.params;
|
|
let { type, id } = this.$route.params;
|
|
return {
|
|
return {
|
|
- val: 'exhibition',
|
|
|
|
|
|
+ val: "exhibition",
|
|
type,
|
|
type,
|
|
id: String(id),
|
|
id: String(id),
|
|
- form: '',
|
|
|
|
- roleList: []
|
|
|
|
|
|
+ form: "",
|
|
|
|
+ roleList: [],
|
|
};
|
|
};
|
|
},
|
|
},
|
|
computed: {
|
|
computed: {
|
|
@@ -39,7 +47,7 @@ export default {
|
|
},
|
|
},
|
|
},
|
|
},
|
|
mounted() {
|
|
mounted() {
|
|
- this.getDetail()
|
|
|
|
|
|
+ this.getDetail();
|
|
},
|
|
},
|
|
methods: {
|
|
methods: {
|
|
validate(cb) {
|
|
validate(cb) {
|
|
@@ -53,30 +61,29 @@ export default {
|
|
cancel() {
|
|
cancel() {
|
|
this.$router.back();
|
|
this.$router.back();
|
|
},
|
|
},
|
|
- save(submit = '', cb = null) {
|
|
|
|
|
|
+ save(submit = "", cb = null) {
|
|
this.validate(() => {
|
|
this.validate(() => {
|
|
let params = {
|
|
let params = {
|
|
- "description": "",
|
|
|
|
- "fileName": "",
|
|
|
|
- "filePath": "",
|
|
|
|
- "museumId": 0,
|
|
|
|
- "name": "",
|
|
|
|
- "thumb": "",
|
|
|
|
- "type": "",
|
|
|
|
|
|
+ description: "",
|
|
|
|
+ fileName: "",
|
|
|
|
+ filePath: "",
|
|
|
|
+ museumId: 0,
|
|
|
|
+ name: "",
|
|
|
|
+ thumb: "",
|
|
|
|
+ type: "",
|
|
id: this.id == "none" ? null : this.id,
|
|
id: this.id == "none" ? null : this.id,
|
|
...this.form,
|
|
...this.form,
|
|
- "timeEnd": this.form.type == 'temp' ? this.form.opening[1] : null,
|
|
|
|
- "timeStart": this.form.type == 'temp' ? this.form.opening[0] : null,
|
|
|
|
|
|
+ timeEnd: this.form.type == "temp" ? this.form.opening[1] : null,
|
|
|
|
+ timeStart: this.form.type == "temp" ? this.form.opening[0] : null,
|
|
};
|
|
};
|
|
save(this.val, params, () => {
|
|
save(this.val, params, () => {
|
|
if (submit) {
|
|
if (submit) {
|
|
- cb && cb()
|
|
|
|
- }
|
|
|
|
- else {
|
|
|
|
|
|
+ cb && cb();
|
|
|
|
+ } else {
|
|
this.$alert("编辑成功", "提示", {
|
|
this.$alert("编辑成功", "提示", {
|
|
confirmButtonText: "确定",
|
|
confirmButtonText: "确定",
|
|
callback: () => {
|
|
callback: () => {
|
|
- this.backList()
|
|
|
|
|
|
+ this.backList();
|
|
},
|
|
},
|
|
});
|
|
});
|
|
}
|
|
}
|
|
@@ -84,24 +91,18 @@ export default {
|
|
});
|
|
});
|
|
},
|
|
},
|
|
|
|
|
|
-
|
|
|
|
async getDetail() {
|
|
async getDetail() {
|
|
- if (this.id == 'none') {
|
|
|
|
- this.form = this.cloneObject(formKey[this.$route.params.type])
|
|
|
|
|
|
+ if (this.id == "none") {
|
|
|
|
+ this.form = this.cloneObject(formKey[this.$route.params.type]);
|
|
} else {
|
|
} else {
|
|
- await getDetail(this.val, { id: this.id }, res => {
|
|
|
|
-
|
|
|
|
- let opening = [
|
|
|
|
- res.data.timeStart,
|
|
|
|
- res.data.timeEnd
|
|
|
|
- ]
|
|
|
|
- this.form = { ...this.form, ...res.data, opening }
|
|
|
|
|
|
+ await getDetail(this.val, { id: this.id }, (res) => {
|
|
|
|
+ let opening = [res.data.timeStart, res.data.timeEnd];
|
|
|
|
+ this.form = { ...this.form, ...res.data, opening };
|
|
|
|
|
|
console.log(res);
|
|
console.log(res);
|
|
-
|
|
|
|
- })
|
|
|
|
|
|
+ });
|
|
}
|
|
}
|
|
- }
|
|
|
|
|
|
+ },
|
|
},
|
|
},
|
|
};
|
|
};
|
|
</script>
|
|
</script>
|