Browse Source

简历,城市部分需要修改

lrf402788946 5 years ago
parent
commit
b426672593
4 changed files with 114 additions and 221 deletions
  1. 5 1
      src/components/form-item.vue
  2. 9 8
      src/components/tag-all-select.vue
  3. 13 0
      src/store.js
  4. 87 212
      src/views/want/resume/index.vue

+ 5 - 1
src/components/form-item.vue

@@ -2,7 +2,11 @@
   <div id="form-item">
     <el-row class="input_row">
       <el-form-item :prop="prop">
-        <el-col :span="4">{{ label }}</el-col>
+        <el-col :span="4">
+          <slot name="title">
+            {{ label }}
+          </slot>
+        </el-col>
         <el-col :span="20">
           <slot></slot>
         </el-col>

+ 9 - 8
src/components/tag-all-select.vue

@@ -11,7 +11,7 @@
             style="margin-right:0.5rem;"
             :disable-transitions="true"
           >
-            {{ item.label }}
+            {{ item.name }}
           </el-tag>
         </el-col>
         <el-col :span="24" style="width:100%" @click.native="changeDisplay" v-else>
@@ -30,7 +30,7 @@
               "
             >
               <el-col v-for="(item, index) in firstList" :key="index" class="word">
-                <el-checkbox :label="item.value">{{ item.label }}</el-checkbox>
+                <el-checkbox :label="item.code">{{ item.name }}</el-checkbox>
               </el-col>
             </el-checkbox-group>
           </el-col>
@@ -44,7 +44,7 @@
               "
             >
               <el-col :span="6" v-for="(item, index) in secondList" :key="index" class="word">
-                <el-checkbox :label="item.value">{{ item.label }}</el-checkbox>
+                <el-checkbox :label="item.code">{{ item.name }}</el-checkbox>
               </el-col>
             </el-checkbox-group>
           </el-col>
@@ -59,7 +59,7 @@ import _ from 'lodash';
 export default {
   name: 'tag-all-select',
   props: {
-    selected: { type: Array, default: () => [] }, //已选项
+    selected: null, //已选项
     placeholder: { type: String, default: '请选择' }, //提示
     firstList: { type: Array, default: () => [] }, //一级选项列表
     secondList: { type: Array, default: () => [] }, //二级选项列表
@@ -165,13 +165,14 @@ export default {
     },
     //是不是直辖市
     haveCity(item) {
+      console.log(item);
       let value;
       if (typeof item === 'object') {
         value = item.value;
       } else {
         value = item;
       }
-      if (value === '110000') {
+      if (value === '110000' || value === '120000' || value === '310000' || value === '500000' || value === '810000' || value === '820000') {
         return false;
       } else if (value.indexOf('0000') > 0) {
         return true;
@@ -208,12 +209,12 @@ export default {
       this.$emit('selectChange', { val: val, type: this.type });
       this.$set(this, `displayList`, val);
     },
-    defalutSearch(label) {
-      let result = this.firstList.filter(fil => fil.label === label);
+    defalutSearch(name) {
+      let result = this.firstList.filter(fil => fil.name === name);
       if (result.length > 0) {
         return result[0];
       } else {
-        result = this.secondList.filter(fil => fil.label === label);
+        result = this.secondList.filter(fil => fil.name === name);
         if (result.length > 0) {
           return result[0];
         }

+ 13 - 0
src/store.js

@@ -24,6 +24,7 @@ const api = {
   wxtoken: '/weixin/qrcode/{qrcode}/token',
   studBind: '/api/stud/bind', //post=>query;corpid;body:mobile,wxtoken
   studLogin: '/api/stud/login',
+  dictionary: '/api/code/{type}/items', //type === xzqh:query:level(1/2);parent(无/code)
 };
 export default new Vuex.Store({
   state: {
@@ -185,6 +186,18 @@ export default new Vuex.Store({
       let result = await this.$axios.$post(api.studBind, info, {}, { userid: userid });
       return result;
     },
+    // 字典表
+    async dicOperation({ state }, type) {
+      let result;
+      if (!_.isObject(type)) {
+        result = await this.$axios.$get(api.dictionary, { type: type });
+      } else {
+        let { level, parent } = type;
+        result = await this.$axios.$get(api.dictionary, { type: 'xzqh' }, { level: level, parent: parent });
+      }
+
+      return result;
+    },
   },
 });
 

+ 87 - 212
src/views/want/resume/index.vue

@@ -19,20 +19,16 @@
               <el-row>
                 <form-item label="期望行业">
                   <el-select v-model="expect.industry" :multiple="true" :filterable="true" placeholder="请选择" style="width: 100%">
-                    <el-option v-for="(item, index) in options" :key="index" :label="item.label" :value="item.label"> </el-option>
+                    <el-option v-for="(item, index) in hylbList" :key="index" :label="item.name" :value="item.name"> </el-option>
                   </el-select>
                 </form-item>
-                <form-item label="期望职业"> <el-input v-model="expect.job" placeholder="请选择期望职业"></el-input></form-item>
+                <form-item label="期望职业">
+                  <el-input v-model="expect.job" placeholder="请选择期望职业"></el-input>
+                </form-item>
                 <form-item label="职位分类">
-                  <tag-checkbox
-                    :max="3"
-                    placeholder="点击选择职位分类,最多选择3个"
-                    :firstList="jobTypeList"
-                    @selectChange="selectChange"
-                    @listChange="listChange"
-                    :selected="expect.category"
-                    type="category"
-                  ></tag-checkbox>
+                  <el-select v-model="expect.category" :multiple="true" :filterable="true" placeholder="请选择期望职业" style="width: 100%">
+                    <el-option v-for="(item, index) in zwlbList" :key="index" :label="item.name" :value="item.name"> </el-option>
+                  </el-select>
                 </form-item>
                 <form-item label="期望城市">
                   <tag-all-select
@@ -48,7 +44,7 @@
                 <form-item label="期望薪资">
                   <template>
                     <el-select v-model="expect.salary" placeholder="请选择..." style="width: 100%">
-                      <el-option v-for="(item, index) in options4" :key="index" :label="item.label" :value="item.label"> </el-option>
+                      <el-option v-for="(item, index) in xzdyList" :key="index" :label="item.name" :value="item.name"> </el-option>
                     </el-select>
                   </template>
                 </form-item>
@@ -75,31 +71,25 @@
                 <form-item label="姓名"> <el-input v-model="info.info.xm" placeholder="请输入姓名" readonly></el-input></form-item>
                 <form-item label="性别">
                   <el-radio-group v-model="info.info.xb" disabled>
-                    <el-radio label="男"></el-radio>
-                    <el-radio label="女"></el-radio>
+                    <el-radio v-for="(item, index) in xbList" :key="index" :label="item.name"></el-radio>
                   </el-radio-group>
                 </form-item>
                 <!-- <form-item label="籍贯"> <el-input v-model="info.native" placeholder="请输入籍贯"></el-input></form-item> -->
                 <form-item label="政治面貌">
-                  <el-select v-model="info.info.zzmm" placeholder="请选择..." style="width: 100%">
-                    <el-option v-for="(item, index) in options5" :key="index" :label="item.label" :value="item.label"> </el-option>
+                  <el-select v-model="info.info.zzmm" placeholder="请选择政治面貌" style="width: 100%">
+                    <el-option v-for="(item, index) in zzmmList" :key="index" :label="item.name" :value="item.name"> </el-option>
+                  </el-select>
+                </form-item>
+                <form-item label="学历">
+                  <el-select v-model="info.info.xl" placeholder="请选择学历" style="width: 100%">
+                    <el-option v-for="(item, index) in xlList" :key="index" :label="item.name" :value="item.name"> </el-option>
                   </el-select>
                 </form-item>
-                <form-item label="学历"> <el-input v-model="info.info.xl" placeholder="请输入学历" readonly></el-input></form-item>
                 <form-item label="学校"> <el-input v-model="info.info.yx" placeholder="请输入院校" readonly></el-input></form-item>
                 <form-item label="所学专业"> <el-input v-model="info.info.zy" placeholder="请输入所学专业" readonly></el-input></form-item>
                 <form-item label="生源地"> <el-input v-model="info.info.syszd" placeholder="请输入学生生源地" readonly></el-input></form-item>
                 <form-item label="手机号"> <el-input v-model="info.contact.mobile" placeholder="请输入手机号"></el-input></form-item>
                 <form-item label="邮箱"> <el-input v-model="info.contact.email" placeholder="请输入邮箱"></el-input></form-item>
-                <!-- <form-item label="学历">
-                  <template>
-                    <el-select v-model="info.value6" placeholder="请选择..." style="width: 100%">
-                      <el-option v-for="(item, index) in options6" :key="index" :label="item.label" :value="item.value"> </el-option>
-                    </el-select>
-                  </template>
-                </form-item> -->
-                <!-- <form-item label="手机"> <el-input v-model="info.phone" placeholder=" "></el-input></form-item>
-                <form-item label="邮箱"> <el-input v-model="info.email" placeholder=" "></el-input></form-item> -->
               </el-row>
             </el-card>
             <el-card class="box-card" shadow="never" style="margin-top: 2rem">
@@ -110,7 +100,13 @@
               </template>
               <el-row>
                 <form-item label="一句话描述"> <el-input v-model="info.profile" placeholder="请输入一句话描述"></el-input></form-item>
-                <form-item label="专业技能"> <el-input v-model="info.skill" placeholder="请输入专业技能"></el-input></form-item>
+                <form-item>
+                  <template #title>
+                    <el-col :span="24">专业技能</el-col>
+                    <el-col :span="24" style="color:#ff4400;font-size:0.625rem;">(多项技能用','号隔开)</el-col>
+                  </template>
+                  <el-input v-model="info.skill" placeholder="请输入专业技能"></el-input>
+                </form-item>
                 <el-row>
                   <form-item label="个人介绍">
                     <el-input type="textarea" :rows="8" placeholder="请输入内容" v-model="info.content" maxlength="100" show-word-limit> </el-input>
@@ -338,7 +334,6 @@
 import resumes from '@resume/src/views/resume.vue';
 import uploadFile from '@/components/upload-file.vue';
 import upload from '@/components/upload.vue';
-import tagCheckbox from '@/components/tag-checkbox.vue';
 import tagAllSelect from '@/components/tag-all-select.vue';
 import formItem from '@/components/form-item.vue';
 import detailLayout from '@/layout/detail-layout.vue';
@@ -346,16 +341,12 @@ import { mapActions, mapState } from 'vuex';
 import _ from 'lodash';
 export default {
   name: 'resume',
-  props: {
-    original: { type: Object, default: () => {} },
-  },
   components: {
     detailLayout,
     formItem,
     tagAllSelect,
     upload,
     uploadFile,
-    tagCheckbox,
     resumes,
   },
   data: () => ({
@@ -367,10 +358,10 @@ export default {
     educationsForm: {},
     worksForm: {},
     uploads: {},
-    provinceList: [{ label: '北京市', value: '110000' }, { label: '吉林省', value: '220000' }, { label: '沈阳省', value: '210000' }],
+    provinceList: [],
     cityList: [],
-    secondList: [{ label: '长春市', value: '220100' }, { label: '吉林市', value: '220200' }],
-    secondList1: [{ label: '沈阳市', value: '210100' }, { label: '大连市', value: '210200' }],
+    secondList: [],
+    secondList1: [],
     info: {
       educations: [],
       works: [],
@@ -379,6 +370,12 @@ export default {
       shows: [],
       attachments: [],
     },
+    hylbList: [],
+    zwlbList: [],
+    xzdyList: [],
+    xbList: [],
+    zzmmList: [],
+    xlList: [],
     expect: {},
     eduRules: {
       yx: [{ required: true, message: '请输入院校', trigger: 'blur' }],
@@ -395,188 +392,21 @@ export default {
       begin: [{ required: true, message: '请选择开始时间', trigger: 'blur' }],
       end: [{ required: true, message: '请选择结束时间', trigger: 'blur' }],
     },
-    jobTypeList: [
-      {
-        label: 'IT',
-        value: '1',
-      },
-      {
-        label: 'test2',
-        value: '2',
-      },
-      {
-        label: 'test3',
-        value: '3',
-      },
-      {
-        label: 'test4',
-        value: '4',
-      },
-    ],
-    textarea: '',
-    options: [
-      {
-        value: '选项1',
-        label: '农、林、牧、渔业',
-      },
-      {
-        value: '选项2',
-        label: '采矿业',
-      },
-      {
-        value: '选项3',
-        label: '制造业',
-      },
-      {
-        value: '选项4',
-        label: '电力、热力、燃气及水生产和供应业',
-      },
-      {
-        value: '选项5',
-        label: '建筑业',
-      },
-    ],
-    options2: [
-      {
-        value: '选项1',
-        label: '产品',
-      },
-      {
-        value: '选项2',
-        label: '设计',
-      },
-      {
-        value: '选项3',
-        label: '编程/IT开发',
-      },
-      {
-        value: '选项4',
-        label: '测试',
-      },
-      {
-        value: '选项5',
-        label: 'IT运维',
-      },
-    ],
-    options3: [
-      {
-        label: '全国',
-        options3: [
-          {
-            value: 'Quanguo',
-            label: '全国',
-          },
-        ],
-      },
-      {
-        label: '直辖市',
-        options3: [
-          {
-            value: 'Beijing',
-            label: '成都',
-          },
-          {
-            value: 'Shanghai',
-            label: '上海',
-          },
-          {
-            value: 'Tianjin',
-            label: '天津',
-          },
-          {
-            value: 'Chongqin',
-            label: '重庆',
-          },
-        ],
-      },
-    ],
-    options4: [
-      {
-        value: '选项2',
-        label: '1K',
-      },
-      {
-        value: '选项3',
-        label: '2K',
-      },
-      {
-        value: '选项4',
-        label: '3K',
-      },
-      {
-        value: '选项5',
-        label: '4K',
-      },
-    ],
-    options5: [
-      {
-        value: '共青团员',
-        label: '共青团员',
-      },
-      {
-        value: '群众',
-        label: '群众',
-      },
-      {
-        value: '中共党员',
-        label: '中共党员',
-      },
-      {
-        value: '中共预备党员',
-        label: '中共预备党员',
-      },
-    ],
-    options6: [
-      {
-        value: '选项1',
-        label: '请选择...',
-      },
-      {
-        value: '选项2',
-        label: '博士',
-      },
-      {
-        value: '选项3',
-        label: '硕士',
-      },
-      {
-        value: '选项4',
-        label: '本科',
-      },
-      {
-        value: '选项5',
-        label: '大专',
-      },
-      {
-        value: '选项6',
-        label: '其他',
-      },
-    ],
     form: {
       name: '',
       place: '',
       num: '',
     },
-    value1: [],
-    value2: [],
-    value3: [],
-    value4: [],
-    value5: [],
-    value6: [],
   }),
   created() {
+    this.getOtherList();
     this.search();
   },
-  mounted() {
-    this.$nextTick(() => {
-      // this.$set(this, `info`, this.original);
-    });
-  },
   computed: {
     ...mapState(['user']),
   },
   methods: {
-    ...mapActions(['userOperation', 'resumesOperation']),
+    ...mapActions(['userOperation', 'resumesOperation', 'dicOperation']),
     async search() {
       let result = await this.resumesOperation({ type: 'search', data: { id: this.user.id } });
       this.$set(this, `expect`, result.data.expect);
@@ -606,10 +436,9 @@ export default {
 
     listChange({ val, type }) {
       //此方法是更换子列表的
-      if (val === '220000') {
-        this.$set(this, `cityList`, this.secondList);
-      } else if (val === '210000') {
-        this.$set(this, `cityList`, this.secondList1);
+      if (type === 'city') {
+        let res = this.provinceList.filter(fil => fil.code === val);
+        this.getCityList(res[0].name);
       } else if (type === 'zy_req') {
         //专业查询模拟
         this.$set(this, `subjectSubList`, val === '1' ? this.subjectSub : this.subjectSub2);
@@ -618,6 +447,7 @@ export default {
     selectChange({ val, type }) {
       //此方法是同步选择
       if (type === 'category' || type === 'city' || type === 'salary') {
+        console.log(val);
         this.$set(this.expect, type, val);
       } else {
         this.$set(this.info, type, val);
@@ -707,9 +537,9 @@ export default {
       mid = '';
       data.category.map(item => {
         if (mid === '') {
-          mid = item.label;
+          mid = item;
         } else {
-          mid += `,${item.label}`;
+          mid += `,${item}`;
         }
       });
       data.category = mid;
@@ -720,7 +550,6 @@ export default {
       data.abilities = _.get(this.uploads, `abilities`) === undefined ? [] : _.get(this.uploads, `abilities`);
       data.shows = _.get(this.uploads, `shows`) === undefined ? [] : _.get(this.uploads, `shows`);
       data.attachments = _.get(this.uploads, `attachments`) === undefined ? [] : _.get(this.uploads, `attachments`);
-      console.log(data);
       return data;
     },
     returnData(data) {
@@ -747,15 +576,18 @@ export default {
             }
           }
         }
+        console.log(selected);
         this.$set(this.expect, `city`, selected);
       }
       if (data.expect.category) {
         let ind = data.expect.category.split(',');
+        console.log(ind);
         let arr = [];
         for (const select of ind) {
-          let result = this.jobTypeList.filter(item => item.label === select);
+          let result = this.zwlbList.filter(item => item.name === select);
           arr = [...arr, ...result];
         }
+        arr = arr.map(item => item.name);
         this.$set(this.expect, `category`, arr);
       }
       if (data.expect.salary) {
@@ -793,6 +625,49 @@ export default {
         this.$set(list, `${index}`, newObject);
       }
     },
+    getOtherList() {
+      this.otherList('hylb');
+      this.otherList('zwlb');
+      this.otherList('xzdy');
+      this.otherList('xb');
+      this.otherList('zzmm');
+      this.otherList('xl');
+      this.otherList({ level: 1 });
+    },
+    async otherList(type) {
+      let result = await this.dicOperation(type);
+      if (`${result.errcode}` === '0') {
+        let list = result.data;
+        if (type === 'xb') {
+          list = list.filter(fil => fil.name === '男' || fil.name === '女');
+        }
+        if (_.isObject(type)) {
+          this.$set(this, `provinceList`, list);
+          return;
+        }
+        this.$set(this, `${type}List`, list);
+      }
+    },
+    async getCityList(name) {
+      let arr = await this.provinceList.filter(item => item.name === name && this.filterCity(name));
+      if (arr.length > 0) {
+        let pro = arr[0];
+        let result = await this.dicOperation({ level: 2, parent: pro.code });
+        if (`${result.errcode}` === '0') {
+          this.$set(this, `cityList`, result.data);
+        }
+      } else {
+        this.$set(this.info, `city`, '');
+        this.$set(this, `cityList`, [{ name: '无选项', code: 0, disabled: true }]);
+      }
+    },
+    filterCity(name) {
+      if (name.includes('特别行政区') || name.includes('北京市') || name.includes('天津市') || name.includes('上海市') || name.includes('重庆市')) {
+        return false;
+      } else {
+        return true;
+      }
+    },
   },
 };
 </script>