浏览代码

科技人才更新完成

guhongwei 5 年之前
父节点
当前提交
bf5e054cfb

+ 101 - 0
src/layout/personnel/informate.vue

@@ -0,0 +1,101 @@
+<template>
+  <div id="column">
+    <el-row>
+      <el-col :span="24" class="info">
+        <el-col :span="24" class="top">
+          <el-col :span="12" class="topTitle">
+            <span>基本信息列表</span>
+          </el-col>
+          <el-col :span="12" class="topAdd">
+            <el-button type="primary" size="mini" @click="addData()"><i class="el-icon-plus"></i></el-button>
+          </el-col>
+        </el-col>
+        <el-col :span="24" class="list">
+          <template>
+            <el-table :data="informateInfo" style="width: 100%">
+              <el-table-column prop="name" label="名称" align="center"> </el-table-column>
+              <el-table-column prop="column_name" label="所属栏目" align="center"> </el-table-column>
+              <el-table-column prop="infotype" label="信息类型" align="center"> </el-table-column>
+              <el-table-column prop="user_name" label="发布人名称" align="center"> </el-table-column>
+              <el-table-column prop="infotype" label="信息类型" align="center"> </el-table-column>
+              <el-table-column prop="state" label="状态" align="center">
+                <template v-slot="scoped">
+                  {{ `${scoped.row.state}` === `0` ? '草稿' : `${scoped.row.state}` === `1` ? '发布' : '删除' }}
+                </template>
+              </el-table-column>
+              <el-table-column label="操作" align="center">
+                <template slot-scope="scoped">
+                  <el-button type="text" size="small" @click="$router.push({ path: '/personnel/informateDetail', query: { id: scoped.row.id } })"
+                    ><i class="el-icon-edit"></i
+                  ></el-button>
+                  <el-button type="text" size="small" @click="handleDelete(scoped.row)"><i class="el-icon-delete"></i></el-button>
+                </template>
+              </el-table-column>
+            </el-table>
+            <el-col :span="24" class="page">
+              <el-pagination
+                @size-change="handleSizeChange"
+                @current-change="handleCurrentChange"
+                :current-page="currentPage"
+                layout="total, prev, pager, next, jumper"
+                :total="total"
+              >
+              </el-pagination>
+            </el-col>
+          </template>
+        </el-col>
+      </el-col>
+    </el-row>
+  </div>
+</template>
+
+<script>
+export default {
+  name: 'column',
+  props: {
+    informateInfo: null,
+    total: null,
+  },
+  components: {},
+  data: () => ({
+    currentPage: 1,
+  }),
+  created() {},
+  computed: {},
+  methods: {
+    addData() {
+      this.$router.push({ path: '/personnel/informateDetail' });
+    },
+    handleDelete(item) {
+      this.$emit('delete', item);
+    },
+    handleClick(row) {
+      this.$emit('list', { data: row });
+    },
+    handleSizeChange(val) {
+      console.log(`每页 ${val} 条`);
+    },
+    handleCurrentChange(val) {
+      console.log(`当前页: ${val}`);
+    },
+  },
+};
+</script>
+
+<style lang="less" scoped>
+.top {
+  padding: 15px 0;
+  border-bottom: 1px solid #cccc;
+}
+.top .topTitle {
+  padding: 0 10px;
+}
+.top .topAdd {
+  padding: 0 10px 0 0;
+  text-align: right;
+}
+.page {
+  padding: 20px 0;
+  text-align: center;
+}
+</style>

+ 128 - 0
src/layout/personnel/informateDetail.vue

@@ -0,0 +1,128 @@
+<template>
+  <div id="recruitDetail">
+    <el-row v-if="loading">
+      <el-col :span="24">
+        <el-col :span="24" class="top">
+          <el-col :span="12" class="topTitle">
+            添加招聘信息
+          </el-col>
+          <el-col :span="12" class="topBtn">
+            <el-button type="primary" size="mini" @click="returnBtn()">返回</el-button>
+          </el-col>
+        </el-col>
+        <el-col :span="24" class="messgae">
+          <el-form ref="form" :model="form" label-width="100px">
+            <el-form-item label="信息名称">
+              <el-input v-model="form.name"></el-input>
+            </el-form-item>
+            <el-form-item label="发布人id">
+              <el-input v-model="form.user_id"></el-input>
+            </el-form-item>
+            <el-form-item label="发布人">
+              <el-input v-model="form.user_name"></el-input>
+            </el-form-item>
+            <el-form-item label="所在位置">
+              <el-select v-model="form.site" placeholder="请选择所在位置">
+                <el-option label="就业指导" value="jyzd"></el-option>
+                <el-option label="学习实践" value="xxsj"></el-option>
+                <el-option label="勤工俭学" value="qgjx"></el-option>
+                <el-option label="工作顾问" value="gzgw"></el-option>
+              </el-select>
+            </el-form-item>
+            <el-form-item label="信息类型">
+              <el-select v-model="form.infotype" placeholder="请选择信息类型">
+                <el-option v-for="(item, index) in infotype_list" :key="index" :label="item.name" :value="item.name"></el-option>
+              </el-select>
+            </el-form-item>
+            <el-form-item label="信息内容">
+              <wang-editor v-model="form.content" placeholder="请输入信息内容"></wang-editor>
+            </el-form-item>
+            <el-form-item label="状态">
+              <el-select v-model="form.state" placeholder="请选择信息状态">
+                <el-option label="草稿" value="0"></el-option>
+                <el-option label="发布" value="1" :disabled="true"></el-option>
+                <el-option label="删除" value="2" :disabled="true"></el-option>
+              </el-select>
+            </el-form-item>
+            <el-form-item>
+              <el-button type="primary" @click="onSubmit()">提交</el-button>
+            </el-form-item>
+          </el-form>
+        </el-col>
+      </el-col>
+    </el-row>
+  </div>
+</template>
+
+<script>
+import WangEditor from '@/components/wang-editor.vue';
+import { createNamespacedHelpers, mapGetters } from 'vuex';
+const { mapActions: mapDictionary } = createNamespacedHelpers('dictionary');
+export default {
+  name: 'recruitDetail',
+  props: {
+    form: null,
+    loading: null,
+  },
+  components: {
+    WangEditor,
+  },
+  data: () => ({
+    infotype_list: [
+      {
+        name: '就业指导',
+      },
+      {
+        name: '工作顾问',
+      },
+      {
+        name: '新闻',
+      },
+      {
+        name: '简历',
+      },
+      {
+        name: '面试',
+      },
+      {
+        name: '其他',
+      },
+    ],
+  }),
+  created() {
+    // this.otherList();
+  },
+  computed: {},
+  methods: {
+    ...mapDictionary(['dicOperation']),
+    onSubmit() {
+      this.$emit('submitDate', { data: this.form, id: this.form.id });
+    },
+    returnBtn() {
+      this.$router.push({ path: '/personnel/informate' });
+    },
+    // async otherList(type) {
+    //   console.log(type);
+    //   let result = await this.dicOperation('xl');
+    //   if (`${result.errcode}` === '0') {
+    //     this.$set(this, `edu_list`, result.data);
+    //   } else {
+    //     this.$message.error(result.errmsg ? result.errmsg : 'error');
+    //   }
+    // },
+  },
+};
+</script>
+
+<style lang="less" scoped>
+.top {
+  padding: 15px 0;
+}
+.top .topTitle {
+  text-align: left;
+}
+.top .topBtn {
+  text-align: right;
+  padding: 0 5px;
+}
+</style>

+ 5 - 0
src/router/index.js

@@ -126,6 +126,11 @@ export default new Router({
       path: '/personnel/informate',
       component: () => import('../views/personnel/informate.vue'),
     },
+    // 科技人才-添加基本信息
+    {
+      path: '/personnel/informateDetail',
+      component: () => import('../views/personnel/informateDetail.vue'),
+    },
     // 站点信息
     {
       path: '/site/index',

+ 47 - 6
src/views/personnel/informate.vue

@@ -1,19 +1,60 @@
 <template>
   <div id="informate">
-    <p>informate</p>
+    <el-row>
+      <el-col :span="24" class="top">
+        <topInfo :topTitle="topTitle"></topInfo>
+      </el-col>
+      <el-col :span="24" class="main">
+        <informateInfo :informateInfo="informateInfo" :total="total" @delete="deleteData"></informateInfo>
+      </el-col>
+    </el-row>
   </div>
 </template>
 
 <script>
+import topInfo from '@/layout/public/top.vue';
+import informateInfo from '@/layout/personnel/informate.vue';
+import { createNamespacedHelpers, mapGetters } from 'vuex';
+const { mapActions: mapColumn } = createNamespacedHelpers('talentInformation');
 export default {
   name: 'informate',
   props: {},
-  components: {},
-  data: () => ({}),
-  created() {},
+  components: {
+    topInfo,
+    informateInfo,
+  },
+  data: () => ({
+    topTitle: '基本信息管理',
+    informateInfo: [],
+    total: 1,
+  }),
+  created() {
+    this.search();
+  },
   computed: {},
-  methods: {},
+  methods: {
+    ...mapColumn(['query', 'delete', 'fetch']),
+    async search({ skip = 0, limit = 10, ...info } = {}) {
+      const res = await this.query({ skip, limit, ...info });
+      if (this.$checkRes(res)) {
+        this.$set(this, `informateInfo`, res.data);
+        this.$set(this, `total`, res.total);
+      }
+    },
+    async deleteData(item) {
+      const res = await this.delete(item.id);
+      this.$checkRes(res, '删除成功', '删除失败');
+      this.search();
+    },
+  },
 };
 </script>
 
-<style lang="less" scoped></style>
+<style lang="less" scoped>
+.main {
+  padding: 20px;
+  margin: 10px 20px;
+  border: 1px solid #ccc;
+  width: 96%;
+}
+</style>

+ 79 - 0
src/views/personnel/informateDetail.vue

@@ -0,0 +1,79 @@
+<template>
+  <div id="informateDetail">
+    <el-row>
+      <el-col :span="24" class="top">
+        <topInfo :topTitle="topTitle"></topInfo>
+      </el-col>
+      <el-col :span="24" class="main">
+        <column :form="form" @submitDate="onSubmit" :loading="loading"></column>
+      </el-col>
+    </el-row>
+  </div>
+</template>
+
+<script>
+import topInfo from '@/layout/public/top.vue';
+import column from '@/layout/personnel/informateDetail.vue';
+import { createNamespacedHelpers, mapGetters } from 'vuex';
+const { mapActions: mapTalentRecruitment } = createNamespacedHelpers('talentInformation');
+export default {
+  name: 'informateDetail',
+  props: {},
+  components: {
+    column,
+    topInfo,
+  },
+  data: () => ({
+    topTitle: '添加基本信息',
+    form: {},
+    loading: true,
+  }),
+  created() {
+    this.search();
+  },
+  computed: {
+    id() {
+      return this.$route.query.id;
+    },
+    keyWord() {
+      let meta = this.$route.meta;
+      let main = meta.title || '';
+      return main;
+    },
+  },
+  methods: {
+    ...mapTalentRecruitment(['fetch', 'create', 'update']),
+    async search() {
+      this.loading = false;
+      if (this.$route.query.id) {
+        const res = await this.fetch(this.id);
+        this.$set(this, `form`, res.data);
+      }
+      this.loading = true;
+    },
+    async onSubmit(form) {
+      let data = this.form;
+      console.log(data);
+      let res;
+      let msg;
+      if (data.id) {
+        res = await this.update(data);
+        msg = `${this.keyWord}修改成功`;
+      } else {
+        res = await this.create(data);
+        msg = `${this.keyWord}添加成功`;
+      }
+      if (this.$checkRes(res, msg)) this.$router.push({ path: '/personnel/informate' });
+    },
+  },
+};
+</script>
+
+<style lang="less" scoped>
+.main {
+  padding: 20px;
+  margin: 10px 20px;
+  border: 1px solid #ccc;
+  width: 96%;
+}
+</style>