123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131 |
- <template>
- <div id="adviserList">
- <duijiedetail-detail
- :info="info"
- :options="options"
- :form="form"
- @onSubmit="onSubmit"
- :liebiaoList="liebiaoList"
- @onsave="onsaveClick"
- :option="option"
- @placesubmit="placesubmit"
- ></duijiedetail-detail>
- </div>
- </template>
- <script>
- import duijiedetailDetail from '@/components/enterprise/duijiedetail.vue';
- import { createNamespacedHelpers, mapGetters, mapState } from 'vuex';
- const { mapActions: login } = createNamespacedHelpers('login');
- const { mapActions: dock } = createNamespacedHelpers('dock');
- const { mapActions: place } = createNamespacedHelpers('place');
- export default {
- name: 'adviserList',
- props: {},
- components: {
- duijiedetailDetail,
- },
- data: () => ({
- form: {},
- info: {},
- options: [],
- option: [],
- liebiaoList: [
- { name: '基本信息' },
- { name: '消息管理' },
- { name: '我的发布' },
- { name: '事项管理' },
- { name: '展会管理' },
- // { name: '返回首页' },
- { name: '修改密码' },
- { name: '注销账号' },
- ],
- }),
- created() {
- this.searchInfo();
- this.search();
- },
- computed: {
- ...mapState(['user']),
- id() {
- return this.$route.query.id;
- },
- keyWord() {
- let meta = this.$route.meta;
- let main = meta.title || '';
- return main;
- },
- },
- methods: {
- ...dock(['query', 'delete', 'update', 'create', 'fetch']),
- ...place({ palcequery: 'query', transactiondtetle: 'delete' }),
- ...login({ logout: 'logout', transactiondtetle: 'delete' }),
- // 查询基本信息
- async searchInfo() {
- if (this.id) {
- let res = await this.fetch(this.id);
- if (res.errcode === 0) {
- this.$set(this, `form`, res.data);
- }
- }
- },
- async search() {
- // let parent = 220000;
- let level = 1;
- let res = await this.palcequery({ level });
- this.$set(this, `option`, res.data);
- },
- async placesubmit({ value }) {
- let level = 2;
- let parent = value;
- console.log(parent);
- let res = await this.palcequery({ level, parent });
- this.$set(this, `options`, res.data);
- },
- async onSubmit({ data }) {
- let res;
- let msg;
- data.user_id = this.user.uid;
- if (data.id) {
- res = await this.update(data);
- this.$checkRes(res, '修改成功', res.errmsg || '删除失败');
- } else {
- res = await this.create(data);
- this.$checkRes(res, '添加成功', res.errmsg || '删除失败');
- }
- this.$router.push({ path: '/enterprise/appointment' });
- },
- async onsaveClick({ id }) {
- console.log(id);
- if (id === '基本信息') {
- this.$router.push({ path: '/enterprise/enterprisejb' });
- } else if (id === '消息管理') {
- this.$router.push({ path: '/enterprise/enterprisexx' });
- } else if (id === '我的发布') {
- this.$router.push({ path: '/enterprise/enterprisefabu' });
- } else if (id === '事项管理') {
- this.$router.push({ path: '/enterprise/enterprisedg' });
- } else if (id === '展会管理') {
- this.$router.push({ path: '/enterprise/appointment' });
- } else if (id === '修改密码') {
- this.$router.push({ path: '/enterprise/xiugai' });
- } else if (id === '返回首页') {
- this.$router.push({ path: '/' });
- } else if (id === '注销账号') {
- this.logout();
- this.$message({
- message: '注销成功',
- type: 'success',
- });
- this.toLogin();
- }
- },
- async toLogin() {
- this.$router.push({ path: '/platlive' });
- },
- },
- };
- </script>
- <style lang="less" scoped></style>
|