|
@@ -0,0 +1,97 @@
|
|
|
+<template>
|
|
|
+ <div id="columnDetail">
|
|
|
+ <el-row>
|
|
|
+ <el-col :span="24">
|
|
|
+ <el-col :span="24" class="top">
|
|
|
+ <el-col :span="12" class="topTitle">
|
|
|
+ 添加栏目
|
|
|
+ </el-col>
|
|
|
+ <el-col :span="12" class="topBtn">
|
|
|
+ <el-button type="primary" size="mini" @click="returnBtn()">返回</el-button>
|
|
|
+ </el-col>
|
|
|
+ </el-col>
|
|
|
+ <el-col :span="24" class="messgae">
|
|
|
+ <el-form ref="form" :model="form" label-width="80px">
|
|
|
+ <el-form-item label="栏目名称">
|
|
|
+ <el-input v-model="form.name"></el-input>
|
|
|
+ </el-form-item>
|
|
|
+ <el-form-item label="所在位置">
|
|
|
+ <el-select v-model="form.site" placeholder="请选择所在位置">
|
|
|
+ <el-option label="最新资讯" value="zixun"></el-option>
|
|
|
+ <el-option label="通知公告" value="tonggao"></el-option>
|
|
|
+ </el-select>
|
|
|
+ </el-form-item>
|
|
|
+ <el-form-item>
|
|
|
+ <el-button type="primary" @click="onSubmit()">提交</el-button>
|
|
|
+ </el-form-item>
|
|
|
+ </el-form>
|
|
|
+ </el-col>
|
|
|
+ </el-col>
|
|
|
+ </el-row>
|
|
|
+ </div>
|
|
|
+</template>
|
|
|
+
|
|
|
+<script>
|
|
|
+import { createNamespacedHelpers } from 'vuex';
|
|
|
+const { mapActions } = createNamespacedHelpers('column');
|
|
|
+export default {
|
|
|
+ name: 'columnDetail',
|
|
|
+ props: {},
|
|
|
+ components: {},
|
|
|
+ data: () => ({
|
|
|
+ form: {},
|
|
|
+ }),
|
|
|
+ created() {
|
|
|
+ // this.search();
|
|
|
+ },
|
|
|
+ computed: {
|
|
|
+ id() {
|
|
|
+ return this.$route.query.id;
|
|
|
+ },
|
|
|
+ keyWord() {
|
|
|
+ let meta = this.$route.meta;
|
|
|
+ let main = meta.title || '';
|
|
|
+ return main;
|
|
|
+ },
|
|
|
+ },
|
|
|
+ methods: {
|
|
|
+ ...mapActions(['fetch', 'create', 'update']),
|
|
|
+ // async search() {
|
|
|
+ // if (this.$route.query.id) {
|
|
|
+ // const res = await this.fetch(this.id);
|
|
|
+ // this.$set(this, `form`, res.data);
|
|
|
+ // }
|
|
|
+ // },
|
|
|
+ async onSubmit(form) {
|
|
|
+ let data = this.form;
|
|
|
+ console.log(data);
|
|
|
+ let res;
|
|
|
+ let msg;
|
|
|
+ if (data.id) {
|
|
|
+ res = await this.update(data);
|
|
|
+ msg = `${this.keyWord}修改成功`;
|
|
|
+ } else {
|
|
|
+ res = await this.create(data);
|
|
|
+ msg = `${this.keyWord}添加成功`;
|
|
|
+ }
|
|
|
+ if (this.$checkRes(res, msg)) this.$router.push({ path: '/government/index' });
|
|
|
+ },
|
|
|
+ returnBtn() {
|
|
|
+ this.$router.push({ path: '/government/index' });
|
|
|
+ },
|
|
|
+ },
|
|
|
+};
|
|
|
+</script>
|
|
|
+
|
|
|
+<style lang="less" scoped>
|
|
|
+.top {
|
|
|
+ padding: 15px 0;
|
|
|
+}
|
|
|
+.top .topTitle {
|
|
|
+ text-align: left;
|
|
|
+}
|
|
|
+.top .topBtn {
|
|
|
+ text-align: right;
|
|
|
+ padding: 0 5px;
|
|
|
+}
|
|
|
+</style>
|