123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132 |
- <template>
- <div id="index">
- <el-row>
- <el-col :span="24" class="style">
- <el-col :span="24" class="top">
- <NavBar v-show="navShow" :title="title" :isleftarrow="isleftarrow"> </NavBar>
- </el-col>
- <el-col :span="24" class="main">
- <detail :form="form" @onSubmit="onSubmit" @placesubmit="placesubmit" :option="option" :options="options"></detail>
- </el-col>
- </el-col>
- </el-row>
- </div>
- </template>
- <script>
- import NavBar from '@/layout/common/topInfo.vue';
- import detail from '@/layout/duijiehui/detail.vue';
- import { mapState, createNamespacedHelpers } from 'vuex';
- const { mapActions: dock } = createNamespacedHelpers('dock');
- const { mapActions: place } = createNamespacedHelpers('place');
- export default {
- name: 'index',
- props: {},
- components: {
- NavBar,
- detail, //个人信息维护
- },
- data: () => ({
- // 头部标题
- title: '',
- // meta为true
- isleftarrow: '',
- // 返回
- navShow: true,
- // 个人信息
- form: {},
- option: [],
- options: [],
- }),
- created() {
- this.searchinfo();
- this.search();
- this.searchplace();
- },
- computed: {
- ...mapState(['user']),
- id() {
- return this.$route.query.id;
- },
- role() {
- return this.$route.query.role;
- },
- },
- methods: {
- ...place({ palcequery: 'query', transactiondtetle: 'delete' }),
- ...dock({ livefetch: 'fetch', livelist: 'query', livecreate: 'create', liveupdate: 'update' }),
- async placesubmit({ value }) {
- let level = 2;
- let parent = value;
- let res = await this.palcequery({ level, parent });
- this.$set(this, `options`, res.data);
- },
- async searchplace() {
- if (this.id) {
- let level = 2;
- let ress = await this.livefetch(this.id);
- let parent = ress.data.place;
- let res = await this.palcequery({ level, parent });
- this.$set(this, `options`, res.data);
- }
- },
- async searchinfo() {
- let level = 1;
- let res = await this.palcequery({ level });
- console.log(res.data);
- console.log(res.data);
- this.$set(this, `option`, res.data);
- },
- async search() {
- if (this.id) {
- let res = await this.livefetch(this.id);
- this.$set(this, `form`, res.data);
- }
- },
- async onSubmit({ data }) {
- console.log(data);
- if (this.id) {
- let res = await this.liveupdate(data);
- this.$checkRes(res, '修改成功', '修改失败');
- } else {
- this.form.user_id = this.user.uid;
- this.form.is_allowed = '1';
- let res = await this.livecreate(data);
- this.$checkRes(res, '创建成功', '添加失败');
- }
- this.$router.push({ path: './index' });
- },
- },
- mounted() {
- this.title = this.$route.meta.title;
- this.isleftarrow = this.$route.meta.isleftarrow;
- },
- };
- </script>
- <style lang="less" scoped>
- .style {
- width: 100%;
- min-height: 667px;
- position: relative;
- background-color: #f9fafc;
- }
- .top {
- height: 46px;
- overflow: hidden;
- position: relative;
- z-index: 999;
- }
- .main {
- min-height: 570px;
- }
- .foot {
- position: absolute;
- bottom: 0;
- }
- </style>
|