Browse Source

职位修改该

bobo 3 years ago
parent
commit
c7aae8a992
5 changed files with 143 additions and 13 deletions
  1. 1 0
      package.json
  2. 1 1
      src/components/edit/index.vue
  3. 2 1
      src/components/jobs.scss
  4. 121 11
      src/components/jobs.vue
  5. 18 0
      yarn.lock

+ 1 - 0
package.json

@@ -10,6 +10,7 @@
   "dependencies": {
     "axios": "^0.24.0",
     "core-js": "^3.6.5",
+    "element-china-area-data": "^5.0.2",
     "element-ui": "^2.15.6",
     "vue": "^2.6.11",
     "vue-quill-editor": "^3.0.6",

+ 1 - 1
src/components/edit/index.vue

@@ -91,7 +91,7 @@ export default {
             ["link", "image", "video"]                       // 链接、图片、视频
           ]
         },
-        placeholder: "请输入内容",
+        placeholder: "请添加描述",
         readOnly: this.readOnly,
       },
     };

+ 2 - 1
src/components/jobs.scss

@@ -76,7 +76,8 @@
       border: 1px solid #efefef;
       padding: 16px 24px 20px 15px;
       overflow: hidden;
-      margin-bottom: 10px;
+      border-left: rgb(0,179,138) 5px solid;
+      margin-bottom: 25px;
       .left {
         float: left;
         .name {

+ 121 - 11
src/components/jobs.vue

@@ -21,7 +21,7 @@
             <span class=""
               >{{ item.lowestSalary }}K-{{ item.highestSalary }}K</span
             >
-            工作年限:{{ item.workYear }} 年 / 最低学历:{{ item.educationBg }}
+            工作年限:{{ item.workYear }} 年以上 / {{ useJobList(item.educationBg) }}
           </div>
         </div>
         <div class="right">
@@ -77,12 +77,10 @@
               <text-edit
                   :minHeight="jobForm.description.minHeight"
                   :show-tool="1"
+                  v-model="form.description"
               ></text-edit>
             </el-col>
           </el-form-item>
-          <!-- <el-form-item label="工资待遇" :label-width="formLabelWidth">
-            <el-input v-model="form.name" autocomplete="off"></el-input>
-          </el-form-item> -->
           <el-form-item
             label="最低工资"
             prop="lowestSalary"
@@ -119,10 +117,16 @@
           </el-form-item>
           <el-form-item
             label="工作地点"
-            prop="workPlace"
             :label-width="formLabelWidth"
           >
-            <el-input v-model="form.workPlace" autocomplete="off"></el-input>
+            <el-cascader
+                size="large"
+                ref="addressSelect"
+                :options="addressOptions"
+                v-model="form.workPlace"
+                :leafOnly="true"
+                @change="handleChange">
+            </el-cascader>
           </el-form-item>
         </el-form>
         <div slot="footer" class="dialog-footer">
@@ -135,7 +139,9 @@
 </template>
 
 <script>
-import { addcomPost, getComPostList, updateComPost,getDicData } from "@/utils/api";
+import { addcomPost, getComPostList, updateComPost,getDicData,dlComPost } from "@/utils/api";
+
+import { regionDataPlus } from 'element-china-area-data'
 import textEdit from './edit/index'
 export default {
   name: "",
@@ -144,6 +150,7 @@ export default {
   },
   data() {
     return {
+      addressOptions: regionDataPlus,
       queryParams: {
         pageNum: 1,
         pageSize: 10,
@@ -179,18 +186,32 @@ export default {
         highestSalary: [
           { required: true, message: "请输入最高工资(单位k)", trigger: "blur" },
         ],
-        workPlace: [
-          { required: true, message: "请输入工作地点", trigger: "blur" },
-        ],
       },
     };
+  },
+  computed:{
+
+
   },
   created() {
     this.handlegetComPostList();
     this.getDicData();
+    this.initMap();
   },
   methods: {
 
+    useJobList: function(data){
+      debugger;
+      let useList = '不限';
+
+      let index = this.jobForm.educations.find(item => {
+
+        return item.dictValue == data
+      })
+      useList=index.dictLabel;
+      return useList;
+    },
+
     getDicData(){
       let eduDictType = 'degr_educ';
       getDicData(eduDictType)
@@ -200,6 +221,81 @@ export default {
         })
 
     },
+
+
+    //初始化省市的数据  修改“全部" 为 "全国" "全省" "全市"
+    initMap(){
+      let mapInitData = []
+      regionDataPlus.forEach(function (item,index) {
+        if (item.label=="全部"){
+          item.label = "全国";
+          mapInitData.push(item);
+        }else if (item.children){
+          let childerCity = [];
+          item.children.forEach(function (cityItem,index){
+            if (cityItem.label=="全部"){
+              cityItem.label = "全省";
+              childerCity.push(cityItem);
+            }else if (cityItem.children){
+              let childerArea = [];
+              cityItem.children.forEach(function (areaItem,index){
+                if (areaItem.label=="全部"){
+                  areaItem.label = "全市";
+                  childerArea.push(areaItem);
+                }else {
+                  childerArea.push(areaItem);
+                }
+              })
+              cityItem.children=childerArea;
+              childerCity.push(cityItem);
+            }
+          });
+          item.children=childerCity;
+          mapInitData.push(item);
+        }
+      })
+      this.addressOptions=mapInitData;
+    },
+
+    //修改以后数据的值
+    handleChange (value) {
+      if (value.length!=0){
+        let arr = this.$refs['addressSelect'].getCheckedNodes()[0].pathLabels;
+        delete this.form['grovinceId'];
+        delete this.form['grovinceName'];
+
+        delete this.form['cityId'];
+        delete this.form['cityName'];
+
+        delete this.form['areaId'];
+        delete this.form['areaName'];
+
+        value.forEach((addId,index)=>{
+
+              if (!addId==''){
+
+                switch (index) {
+                  case 0:
+                    this.form.grovinceId = addId;
+                    this.form.grovinceName = arr[index];
+                    break;
+                  case 1:
+                    this.form.cityId = addId;
+                    this.form.cityName = arr[index];
+                    break;
+                  case 2:
+                    this.form.areaId = addId;
+                    this.form.areaName = arr[index];
+                    break;
+                }
+
+              }
+
+
+        })
+      }
+      console.log(this.form);
+    },
     goDetails(id) {
       this.$router.push({ path: "/jobdetails", query: { id: id } });
     },
@@ -216,6 +312,13 @@ export default {
       this.form = item;
       console.log("item", item);
     },
+    del(item) {
+      dlComPost(item).then(
+          (res)=>{
+            this.handlegetComPostList();
+          }
+      )
+    },
     handlegetComPostList() {
       getComPostList({ pageNum: 1, pageSize: 30, postName: "" })
         .then((res) => {
@@ -233,8 +336,9 @@ export default {
           if (valid) {
             addcomPost(this.form)
               .then((res) => {
-                console.log("addcomPost", res);
                 this.$message(res.msg);
+                this.dialogVisible = false;
+                this.handlegetComPostList();
               })
               .catch((err) => {
                 this.$message.error(err.msg);
@@ -290,6 +394,12 @@ export default {
   }
 }
 ::v-deep{
+  .el-cascader{
+    width: 100%;
+  }
+  .el-select{
+    width: 100%;
+  }
   .el-dialog{
     -moz-box-shadow: rgba(169, 169, 169, 0.6) 0px 0px 0px 20px; /* 老的 Firefox */
     box-shadow: rgba(169, 169, 169, 0.6) 0px 0px 0px 20px;

+ 18 - 0
yarn.lock

@@ -2407,6 +2407,11 @@ check-types@^8.0.3:
   resolved "https://registry.nlark.com/check-types/download/check-types-8.0.3.tgz#3356cca19c889544f2d7a95ed49ce508a0ecf552"
   integrity sha1-M1bMoZyIlUTy16le1JzlCKDs9VI=
 
+china-area-data@^5.0.1:
+  version "5.0.1"
+  resolved "https://registry.npm.taobao.org/china-area-data/download/china-area-data-5.0.1.tgz#7943b83a0619f033bb5893da80cb46e52e44be66"
+  integrity sha1-eUO4OgYZ8DO7WJPagMtG5S5EvmY=
+
 chokidar@^2.1.8:
   version "2.1.8"
   resolved "https://registry.nlark.com/chokidar/download/chokidar-2.1.8.tgz#804b3a7b6a99358c3c5c61e71d8728f041cff917"
@@ -3419,6 +3424,14 @@ electron-to-chromium@^1.3.878:
   resolved "https://registry.npmmirror.com/electron-to-chromium/download/electron-to-chromium-1.3.878.tgz?cache=0&sync_timestamp=1635094527403&other_urls=https%3A%2F%2Fregistry.npmmirror.com%2Felectron-to-chromium%2Fdownload%2Felectron-to-chromium-1.3.878.tgz#baa9fb5c24b9b580f08fb245cbb52a22f8fc8fa8"
   integrity sha1-uqn7XCS5tYDwj7JFy7UqIvj8j6g=
 
+element-china-area-data@^5.0.2:
+  version "5.0.2"
+  resolved "https://registry.npm.taobao.org/element-china-area-data/download/element-china-area-data-5.0.2.tgz?cache=0&sync_timestamp=1601348231529&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Felement-china-area-data%2Fdownload%2Felement-china-area-data-5.0.2.tgz#006c26594b8865cb619994063c732562e4583d30"
+  integrity sha1-AGwmWUuIZcthmZQGPHMlYuRYPTA=
+  dependencies:
+    china-area-data "^5.0.1"
+    lodash-es "^4.17.15"
+
 element-ui@^2.15.6:
   version "2.15.6"
   resolved "https://registry.nlark.com/element-ui/download/element-ui-2.15.6.tgz#c9609add35af5a686a4b7685dc1d757c75e01df3"
@@ -5475,6 +5488,11 @@ locate-path@^5.0.0:
   dependencies:
     p-locate "^4.1.0"
 
+lodash-es@^4.17.15:
+  version "4.17.21"
+  resolved "https://registry.npm.taobao.org/lodash-es/download/lodash-es-4.17.21.tgz?cache=0&sync_timestamp=1613835893273&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Flodash-es%2Fdownload%2Flodash-es-4.17.21.tgz#43e626c46e6591b7750beb2b50117390c609e3ee"
+  integrity sha1-Q+YmxG5lkbd1C+srUBFzkMYJ4+4=
+
 lodash.debounce@^4.0.8:
   version "4.0.8"
   resolved "https://registry.nlark.com/lodash.debounce/download/lodash.debounce-4.0.8.tgz?cache=0&sync_timestamp=1618847031591&other_urls=https%3A%2F%2Fregistry.nlark.com%2Flodash.debounce%2Fdownload%2Flodash.debounce-4.0.8.tgz#82d79bff30a67c4005ffd5e2515300ad9ca4d7af"