enterprisexuqiu.vue 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112
  1. <template>
  2. <div id="adviserList">
  3. <enterprisexuqiu-detail
  4. :info="info"
  5. :columnList="columnList"
  6. :liebiaoList="liebiaoList"
  7. @onsaves="onsaveClicks"
  8. :form="form"
  9. @onsave="onsaveClick"
  10. ></enterprisexuqiu-detail>
  11. <!-- @detailcm="clickDetailcm" -->
  12. </div>
  13. </template>
  14. <script>
  15. import enterprisexuqiuDetail from '@/components/enterprise/enterprisexuqiu.vue';
  16. import { createNamespacedHelpers, mapGetters } from 'vuex';
  17. const { mapActions: mapSite } = createNamespacedHelpers('site');
  18. const { mapActions: mapRecruit } = createNamespacedHelpers('market');
  19. const { mapActions: marketproduct } = createNamespacedHelpers('marketproduct');
  20. const { mapActions: mapColumn } = createNamespacedHelpers('markettype');
  21. export default {
  22. name: 'adviserList',
  23. props: {},
  24. components: {
  25. enterprisexuqiuDetail,
  26. },
  27. data: () => ({
  28. info: {},
  29. liebiaoList: [{ name: '基本信息' }, { name: '消息管理' }, { name: '我的发布' }, { name: '我的订购' }, { name: '注销账号' }],
  30. columnName: '',
  31. recruitData: [],
  32. columnList: [],
  33. form: {},
  34. }),
  35. created() {
  36. this.search();
  37. this.searchSite();
  38. this.searchColumn();
  39. },
  40. computed: {
  41. id() {
  42. return this.$route.query.id;
  43. },
  44. keyWord() {
  45. let meta = this.$route.meta;
  46. let main = meta.title || '';
  47. return main;
  48. },
  49. },
  50. methods: {
  51. ...mapSite(['showInfo']),
  52. ...marketproduct({ list: 'query', columnInfo: 'fetch', marketcerate: 'create' }),
  53. ...mapColumn({ queryList: 'query' }),
  54. async search() {
  55. this.loading = false;
  56. if (this.$route.query.id) {
  57. const res = await this.columnInfo(this.id);
  58. this.$set(this, `form`, res.data);
  59. }
  60. this.loading = true;
  61. },
  62. async searchColumn({ ...info } = {}) {
  63. const res = await this.queryList({ ...info });
  64. if (this.$checkRes(res)) {
  65. this.$set(this, `columnList`, res.data);
  66. }
  67. },
  68. // 查询站点信息
  69. async searchSite() {
  70. let res = await this.showInfo();
  71. let object = JSON.parse(JSON.stringify(res.data));
  72. if (object) {
  73. this.$set(this, `info`, res.data);
  74. } else {
  75. this.$message.error(res.errmsg ? res.errmsg : 'error');
  76. }
  77. },
  78. async onsaveClick({ id }) {
  79. console.log(id);
  80. if (id === '基本信息') {
  81. this.$router.push({ path: '/enterprise/enterprisejb' });
  82. } else if (id === '消息管理') {
  83. this.$router.push({ path: '/enterprise/enterprisexx' });
  84. } else if (id === '我的发布') {
  85. this.$router.push({ path: '/enterprise/enterprisefabu' });
  86. } else if (id === '我的订购') {
  87. this.$router.push({ path: '/enterprise/enterprisedg' });
  88. }
  89. },
  90. async onsaveClicks(form) {
  91. let data = this.form;
  92. console.log(data);
  93. let res;
  94. let msg;
  95. if (data.id) {
  96. res = await this.columnInfo(data);
  97. msg = `${this.keyWord}修改成功`;
  98. } else {
  99. res = await this.marketcerate(data);
  100. msg = `${this.keyWord}添加成功`;
  101. }
  102. if (this.$checkRes(res, msg)) this.$router.push({ path: '/policy/index' });
  103. },
  104. },
  105. };
  106. </script>
  107. <style lang="less" scoped></style>