Browse Source

招聘信息

guhongwei 4 years ago
parent
commit
ae38c54239
2 changed files with 133 additions and 8 deletions
  1. 130 7
      src/views/recruit/detail.vue
  2. 3 1
      src/views/recruit/index.vue

+ 130 - 7
src/views/recruit/detail.vue

@@ -1,31 +1,154 @@
 <template>
   <div id="detail">
     <el-row>
-      <el-col :span="24">
-        <p>detail</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="add">
+            <el-button type="primary" size="mini" @click="back()">返回</el-button>
+          </el-col>
+          <el-col :span="24" v-if="loading">
+            <data-form :data="form" :fields="Fields" :rules="{}" @save="turnSave">
+              <template #options="{item}">
+                <template v-if="item.model == 'column_id'">
+                  <el-option v-for="(item, index) in columnList" :key="index" :label="item.name" :value="item.id"></el-option>
+                </template>
+                <template v-if="item.model == 'education'">
+                  <el-option v-for="(item, index) in educationList" :key="index" :label="item.name" :value="item.name"></el-option>
+                </template>
+              </template>
+              <template #radios="{item}">
+                <template v-if="item.model === 'job_nature'">
+                  <el-radio label="0">兼职</el-radio>
+                  <el-radio label="1">全职</el-radio>
+                </template>
+              </template>
+            </data-form>
+          </el-col>
+        </el-col>
       </el-col>
     </el-row>
   </div>
 </template>
 
 <script>
+import breadcrumb from '@c/common/breadcrumb.vue';
+import dataForm from '@c/frame/form.vue';
 import { mapState, createNamespacedHelpers } from 'vuex';
+const { mapActions: mapColumn } = createNamespacedHelpers('talentColumn');
+const { mapActions: mapNews } = createNamespacedHelpers('talentRecruitment');
 export default {
   metaInfo() {
     return { title: this.$route.meta.title };
   },
   name: 'detail',
   props: {},
-  components: {},
+  components: {
+    breadcrumb,
+    dataForm,
+  },
   data: function() {
-    return {};
+    return {
+      form: {},
+      Fields: [
+        { label: '信用代码', model: 'license', type: 'number' },
+        { label: '招聘信息名称', model: 'name' },
+        { label: '所属栏目', model: 'column_id', type: 'select' },
+        { label: '职位月薪', model: 'salary' },
+        { label: '工作性质', model: 'job_nature', type: 'radio' },
+        { label: '公司名称', model: 'profession' },
+        { label: '工作地点', model: 'workplace' },
+        { label: '工作经验', model: 'workexp' },
+        { label: '学历', model: 'education', type: 'select' },
+        { label: '招聘人数', model: 'people_number', type: 'number' },
+        { label: '职位说明', model: 'explains', type: 'textarea' },
+      ],
+      loading: true,
+      // 栏目列表
+      columnList: [],
+      // 学历
+      educationList: [{ name: '中专及以上' }, { name: '大专及以上' }, { name: '本科及以上' }, { name: '研究生及以上' }],
+    };
+  },
+  async created() {
+    await this.searchcol();
+    await this.search();
+  },
+  methods: {
+    ...mapColumn({ colquery: 'query' }),
+    ...mapNews({ newfetch: 'fetch', newcreate: 'create', newupdate: 'update' }),
+    // 查询详情
+    async search() {
+      if (this.id) {
+        this.loading = false;
+        const res = await this.newfetch(this.id);
+        if (this.$checkRes(res)) {
+          this.$set(this, `form`, res.data);
+          this.loading = true;
+        } else {
+          this.$message({
+            message: res.errmsg,
+            type: 'error',
+          });
+        }
+      }
+    },
+    // 保存信息
+    async turnSave({ data }) {
+      if (data.id) {
+        const res = await this.newupdate(data);
+        if (this.$checkRes(res)) {
+          this.$message({
+            message: '修改成功',
+            type: 'success',
+          });
+          this.back();
+        } else {
+          this.$message({
+            message: res.errmsg,
+            type: 'error',
+          });
+        }
+      } else {
+        const res = await this.newcreate(data);
+        if (this.$checkRes(res)) {
+          this.$message({
+            message: '添加成功',
+            type: 'success',
+          });
+          this.back();
+        } else {
+          this.$message({
+            message: res.errmsg,
+            type: 'error',
+          });
+        }
+      }
+    },
+    // 返回
+    back() {
+      this.form = {};
+      this.$router.push({ path: '/recruit' });
+    },
+    // 查询栏目
+    async searchcol() {
+      let res = await this.colquery();
+      if (res.errcode == 0) {
+        this.$set(this, `columnList`, res.data);
+      }
+    },
   },
-  created() {},
-  methods: {},
   computed: {
     ...mapState(['user']),
+    id() {
+      return this.$route.query.id;
+    },
   },
 };
 </script>
 
-<style lang="less" scoped></style>
+<style lang="less" scoped>
+.add {
+  text-align: right;
+}
+</style>

+ 3 - 1
src/views/recruit/index.vue

@@ -107,7 +107,9 @@ export default {
       }
     },
     // 修改
-    toEdit({ data }) {},
+    toEdit({ data }) {
+      this.$router.push({ path: 'recruit/detail', query: { id: data.id } });
+    },
     // 删除
     async toDelete({ data }) {
       const res = await this.delete(data.id);