guhongwei 4 năm trước cách đây
mục cha
commit
cea2449073
3 tập tin đã thay đổi với 171 bổ sung7 xóa
  1. 4 0
      src/store/index.js
  2. 38 0
      src/store/talentRecruitment.js
  3. 129 7
      src/views/recruit/index.vue

+ 4 - 0
src/store/index.js

@@ -11,7 +11,10 @@ import site from './site';
 import column from './column';
 import news from './news';
 // 科技人才
+// 科技人才-栏目
 import talentColumn from './talentColumn';
+// 科技人才-招聘信息
+import talentRecruitment from './talentRecruitment';
 Vue.use(Vuex);
 
 export default new Vuex.Store({
@@ -25,5 +28,6 @@ export default new Vuex.Store({
     column,
     news,
     talentColumn,
+    talentRecruitment,
   },
 });

+ 38 - 0
src/store/talentRecruitment.js

@@ -0,0 +1,38 @@
+import Vue from 'vue';
+import Vuex from 'vuex';
+import _ from 'lodash';
+Vue.use(Vuex);
+const api = {
+  recruit: `/api/talent/recruitment`,
+};
+const state = () => ({});
+const mutations = {};
+
+const actions = {
+  async query({ commit }, { skip = 0, limit, ...info } = {}) {
+    const res = await this.$axios.$get(`${api.recruit}`, { skip, limit, ...info });
+    return res;
+  },
+  async create({ commit }, payload) {
+    const res = await this.$axios.$post(`${api.recruit}`, payload);
+    return res;
+  },
+  async fetch({ commit }, payload) {
+    const res = await this.$axios.$get(`${api.recruit}/${payload}`);
+    return res;
+  },
+  async update({ commit }, { id, ...data }) {
+    const res = await this.$axios.$post(`${api.recruit}/update/${id}`, data);
+    return res;
+  },
+  async delete({ commit }, payload) {
+    const res = await this.$axios.$delete(`${api.recruit}/${payload}`);
+    return res;
+  },
+};
+export default {
+  namespaced: true,
+  state,
+  mutations,
+  actions,
+};

+ 129 - 7
src/views/recruit/index.vue

@@ -1,31 +1,153 @@
 <template>
   <div id="index">
     <el-row>
-      <el-col :span="24">
-        <p>index</p>
+      <el-col :span="24" class="main">
+        <breadcrumb :breadcrumbTitle="this.$route.meta.title"></breadcrumb>
+        <el-col :span="24" class="container">
+          <el-col :span="24" class="top">
+            <el-button type="primary" size="mini" @click="$router.push({ path: '/links/detail' })">添加</el-button>
+          </el-col>
+          <el-col :span="24" class="list">
+            <data-table
+              :fields="fields"
+              :opera="opera"
+              :data="list"
+              :total="total"
+              :toFormat="toFormat"
+              @edit="toEdit"
+              @delete="toDelete"
+              @query="search"
+            ></data-table>
+          </el-col>
+        </el-col>
       </el-col>
     </el-row>
   </div>
 </template>
 
 <script>
+import breadcrumb from '@c/common/breadcrumb.vue';
+import dataTable from '@/components/frame/filter-page-table.vue';
 import { mapState, createNamespacedHelpers } from 'vuex';
+const { mapActions: talentRecruitment } = createNamespacedHelpers('talentRecruitment');
+const { mapActions: talentColumn } = createNamespacedHelpers('talentColumn');
 export default {
   metaInfo() {
     return { title: this.$route.meta.title };
   },
   name: 'index',
   props: {},
-  components: {},
+  components: {
+    breadcrumb,
+    dataTable,
+  },
   data: function() {
-    return {};
+    return {
+      opera: [
+        {
+          label: '修改',
+          icon: 'el-icon-edit',
+          method: 'edit',
+        },
+        {
+          label: '删除',
+          icon: 'el-icon-delete',
+          method: 'delete',
+        },
+      ],
+      fields: [
+        { label: '信用代码', prop: 'license', showTip: true },
+        { label: '招聘信息名称', prop: 'name', showTip: true, filter: 'input' },
+        { label: '所属栏目', prop: 'column_id', showTip: true, format: true },
+        { label: '职位月薪', prop: 'salary' },
+        {
+          label: '工作性质',
+          prop: 'job_nature',
+          format: item => {
+            return item === '0' ? '兼职' : '全职';
+          },
+        },
+        { label: '公司名称', prop: 'profession', showTip: true },
+        { label: '公司地址', prop: 'workplace', showTip: true },
+        { label: '工作经验', prop: 'workexp' },
+        { label: '学历', prop: 'education', showTip: true },
+        { label: '招聘人数', prop: 'people_number' },
+      ],
+      list: [],
+      total: 0,
+      // 栏目列表
+      column: [],
+    };
+  },
+  created() {
+    this.searchcolumn();
+    this.search();
+  },
+  methods: {
+    ...talentRecruitment(['query', 'delete', 'fetch']),
+    ...talentColumn({ columnquery: 'query' }),
+    // 查询列表
+    async search({ skip = 0, limit = 10, ...info } = {}) {
+      const res = await this.query({ skip, limit, ...info });
+      if (this.$checkRes(res)) {
+        this.$set(this, `list`, res.data);
+        this.$set(this, `total`, res.total);
+      } else {
+        this.$message({
+          message: res.errmsg,
+          type: 'error',
+        });
+      }
+    },
+    // 过滤栏目
+    toFormat({ model, value }) {
+      if (model == 'column_id') {
+        const res = this.column.find(f => f.id == value);
+        if (res) return res.name;
+      }
+    },
+    // 修改
+    toEdit({ data }) {},
+    // 删除
+    async toDelete({ data }) {
+      const res = await this.delete(data.id);
+      if (this.$checkRes(res)) {
+        this.$message({
+          message: '刪除成功',
+          type: 'success',
+        });
+        this.search();
+      } else {
+        this.$message({
+          message: res.errmsg,
+          type: 'error',
+        });
+      }
+    },
+    // 查询栏目
+    async searchcolumn() {
+      const res = await this.columnquery();
+      if (this.$checkRes(res)) {
+        this.$set(this, `column`, res.data);
+      } else {
+        this.$message({
+          message: res.errmsg,
+          type: 'error',
+        });
+      }
+    },
   },
-  created() {},
-  methods: {},
   computed: {
     ...mapState(['user']),
   },
 };
 </script>
 
-<style lang="less" scoped></style>
+<style lang="less" scoped>
+.main {
+  .top {
+    text-align: right;
+    margin: 15px 0;
+  }
+}
+</style>