123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993 |
- <template>
- <div class="mainBox">
- <div class="layerBox">
- <tableTitle :name="tableDivTitle" />
- <el-form :model="form" ref="form" :rules="formRules" label-position="left" label-width="120px">
- <div class="formDiv">
- <div v-if="creatNews_user_type == 10000">
- <el-form-item label="站点名称:" prop="web_site_id" class="custom-align-right">
- <el-cascader :key="parentKey" v-model="form.web_site_id" placeholder="请选择站点名称" popper-class="my_cascader" :options="creatNews_nav_pool_arr" @change="creatNews_nav_pool_change_fun(form.web_site_id)" filterable clearable></el-cascader>
- </el-form-item>
- </div>
- <el-form-item label="导航池名称:" prop="cat_arr_id" class="custom-align-right">
- <el-cascader :key="parentKey_2" v-model="form.cat_arr_id" placeholder="请选择导航池名称" :props="parentData_2" popper-class="my_cascader" filterable clearable></el-cascader>
- </el-form-item>
- <el-form-item label="招聘职位名称" prop="title" class="custom-align-right">
- <el-input v-model="form.title" autocomplete="off" placeholder="请输入招聘职位名称"></el-input>
- </el-form-item>
- <el-form-item label="工作地点:" prop="province_id" class="custom-align-right">
- <el-select v-model="form.province_id" placeholder="请选择省" style="display:inline-block;width:50%" @change = "province_change">
- <el-option v-for="item in province_array" :key="item.id" :label="item.name" :value="item.id" >
- </el-option>
- </el-select>
- <el-select v-model="form.city_id" placeholder="请选择市" style="width:50%">
- <el-option v-for="item in city_array" :key="item.id" :label="item.name" :value="item.id">
- </el-option>
- </el-select>
- </el-form-item>
- <el-form-item label="行业类别:" prop="hy_id" class="custom-align-right">
- <el-select v-model="form.hy_id" placeholder="请选择行业类别">
- <el-option v-for="item in hy_array" :key="item.hyid" :label="item.hyname" :value="item.hyid">
- </el-option>
- </el-select>
- </el-form-item>
- <el-form-item label="职位类别:" prop="zw_id" class="custom-align-right">
- <el-select v-model="form.zw_id" placeholder="请选择职位类别" @change = "zwid_change">
- <el-option v-for="item in zw_array" :key="item.zwid" :label="item.zwname" :value="item.zwid">
- </el-option>
- </el-select>
- </el-form-item>
- <el-form-item label="具体职位:" prop="jtzw_id" class="custom-align-right">
- <el-select v-model="form.jtzw_id" placeholder="请选择具体职位">
- <el-option v-for="item in jtzw_array" :key="item.zwid" :label="item.zwname" :value="item.zwid">
- </el-option>
- </el-select>
- </el-form-item>
- <el-form-item label="职位性质:" prop="nature_id" class="custom-align-right">
- <el-select v-model="form.nature_id" placeholder="请选择职位性质">
- <el-option v-for="item in nature_array" :key="item.evalue" :label="item.ename" :value="item.evalue">
- </el-option>
- </el-select>
- </el-form-item>
- <div>
- <el-form-item label="截止日期:" prop="due_data" class="custom-align-right">
- <el-date-picker v-model="form.due_data" placeholder="请选择截止日期"> </el-date-picker>
- </el-form-item>
- <el-form-item label="工作经验:" prop="experience" class="custom-align-right">
- <el-select v-model="form.experience" clearable placeholder="请选择工作经验">
- <el-option v-for="item in experience_array" :key="item.evalue" :label="item.ename" :value="item.evalue"></el-option>
- </el-select>
- </el-form-item>
- <el-form-item label="学历要求:" prop="educational" class="custom-align-right">
- <el-select v-model="form.educational" clearable placeholder="请选择学历要求">
- <el-option v-for="item in educational_array" :key="item.evalue" :label="item.ename" :value="item.evalue"></el-option>
- </el-select>
- </el-form-item>
- <el-form-item label="月薪:" prop="salary" class="custom-align-right">
- <el-select v-model="form.salary" clearable placeholder="请输入月薪">
- <el-option v-for="item in salary_array" :key="item.evalue" :label="item.ename" :value="item.evalue"></el-option>
- </el-select>
- </el-form-item>
- <el-form-item label="招聘人数:" prop="number" class="custom-align-right">
- <el-input v-model="form.number" autocomplete="off" placeholder="请输入招聘人数"></el-input>
- </el-form-item>
- <el-form-item label="语言能力:" prop="language" class="custom-align-right" style="width: 50%;display: inline-block;">
- <el-select v-model="form.language" clearable placeholder="请选择语种">
- <el-option v-for="item in language_array" :key="item.evalue" :label="item.ename" :value="item.evalue"></el-option>
- </el-select>
- </el-form-item>
-
- <el-form-item label="掌握程度:" prop="level" class="custom-align-right" style="width: 50%;display: inline-block;">
- <el-select v-model="form.level" clearable placeholder="请选择掌握程度">
- <el-option v-for="item in level_array" :key="item.evalue" :label="item.ename" :value="item.evalue">
- </el-option>
- </el-select>
- </el-form-item>
- <el-form-item label="职位描述:" prop="description" class="custom-align-right" style="display:block;">
- <el-input v-model="form.description" type="textarea" :rows="2" placeholder="介绍公司对该职位的职位描述..."> </el-input>
- </el-form-item>
- <el-form-item label="具体要求:" prop="jt_description" class="custom-align-right" style="display:block;">
- <el-input v-model="form.jt_description" type="textarea" :rows="2" placeholder="介绍公司对该职位的具体要求..."> </el-input>
- </el-form-item>
- </div>
- <div>
- <!--公司信息 start-->
- <el-form-item label="公司名称:" prop="business_name" class="custom-align-right">
- <el-input v-model="form.business_name" autocomplete="off" placeholder="请输入公司名称" :disabled="creatNews_user_type !== '10000'"></el-input>
- </el-form-item>
- <el-form-item label="所属行业:" prop="company_hy_id" class="custom-align-right">
- <el-select v-model="form.company_hy_id" clearable placeholder="请选择公司所属的行业" :disabled="creatNews_user_type !== '10000'">
- <el-option v-for="item in hy_array" :key="item.hyid" :label="item.hyname" :value="item.hyid">
- </el-option>
- </el-select>
- </el-form-item>
- <el-form-item label="公司规模:" prop="company_size" class="custom-align-right">
- <el-select v-model="form.company_size" clearable placeholder="请选择公司的规模" :disabled="creatNews_user_type !== '10000'">
- <el-option v-for="item in companysize_array" :key="item.evalue" :label="item.ename" :value="item.evalue">
- </el-option>
- </el-select>
- </el-form-item>
- <el-form-item label="公司性质:" prop="company_nature" class="custom-align-right">
- <el-select v-model="form.company_nature" clearable placeholder="请选择公司的性质" :disabled="creatNews_user_type !== '10000'">
- <el-option v-for="item in companynature_array" :key="item.id" :label="item.nature_name" :value="item.id">
- </el-option>
- </el-select>
- </el-form-item>
- <el-form-item label="公司简介:" prop="introduction" class="custom-align-right">
- <el-input v-model="form.introduction" autocomplete="off" :disabled="creatNews_user_type !== '10000'" type="textarea" :rows="2"
- placeholder="请填写公司简介..."> </el-input>
- </el-form-item>
- <el-form-item label="联系人:" prop="real_name" class="custom-align-right">
- <el-input v-model="form.real_name" autocomplete="off" :disabled="creatNews_user_type !== '10000'"
- placeholder="请输入联系人"></el-input>
- </el-form-item>
- <el-form-item label="联系电话:" prop="mobile" class="custom-align-right">
- <el-input v-model="form.mobile" autocomplete="off" :disabled="creatNews_user_type !== '10000'"
- placeholder="请输入联系电话"></el-input>
- </el-form-item>
- <el-form-item label="公司网址:" prop="company_url" class="custom-align-right">
- <el-input v-model="form.company_url" autocomplete="off" :disabled="creatNews_user_type !== '10000'"
- placeholder="请输入公司网址"></el-input>
- </el-form-item>
- <el-form-item label="地址:" prop="address_arr_id" class="custom-align-right">
- <CityCascader v-model="form.address_arr_id" @update-city-id="update_address_arr_id" :user_type="creatNews_user_type"></CityCascader>
- <el-input v-model="form.address" autocomplete="off" :disabled="creatNews_user_type !== '10000'"
- placeholder="请输入公司地址"></el-input>
- </el-form-item>
- <el-form-item label="邮箱:" prop="email" class="custom-align-right">
- <el-input v-model="form.email" autocomplete="off" :disabled="creatNews_user_type !== '10000'" placeholder="请输入邮箱"></el-input>
- </el-form-item>
- <!--公司信息 end-->
- </div>
- </div>
- </el-form>
- </div>
- <div class="bottomBtnBox">
- <el-button type="info" @click="returnPage">返回</el-button>
- <el-button type="primary" @click="editToServe" v-if="editStatus == true">确定</el-button>
- <el-button type="primary" @click="addToServe" v-else>发布职位</el-button>
- </div>
- </div>
- </template>
- <script>
- import { getWebSiteId, getUseType } from '@/utils/auth'
- //表格标题
- import tableTitle from './components/tableTitle';
- //引入公用样式
- import '@/styles/global.less';
- import { create } from 'sortablejs';
- import CityCascader from './components/CityCascader';
- import { formatLocalDate } from '@/utils/public';
- export default {
- components: {
- tableTitle,
- CityCascader
- },
- data() {
- //0.全局操作 start ------------------------------------------------------------>
- //表单验证
- const validateEmpty = (rule, value, callback) => {
- if (value.length == 0) {
- callback(new Error('该项不能为空!'))
- } else {
- callback()
- }
- }
- const validateArray = (rule, value, callback) => {
- if (value.length == 0) {
- callback(new Error('该项不能为空!'))
- } else {
- callback()
- }
- }
- let self = this;
- //0.全局操作 end ------------------------------------------------------------>
- return {
- websiteid: 0,
- creatNews_pid_num: "0",//请求子导航用的pid
- creatNews_nav_pool_arr: [],//
- creatNews_add_nav_pool_arr: [],//
- creatNews_son_website_id_num: "",
- checked: false,
- formLabelWidth: '80px',//表单的长度
- //1.表单项 start ------------------------------------------------------------>
- editStatus: false,
- tableDivTitle: "添加职位",
- // disclaimer: true,//免责声明
- //提交表单
- province_array: [],//省份
- city_array: [],//城市
- hy_array: [],//行业分类
- zw_array: [],//职位类别
- jtzw_array: [],//具体职位
- nature_array: [],//职位性质
- experience_array: [],//工作经验
- educational_array: [],//学历
- salary_array: [],//薪资
- language_array: [],//语言能力
- level_array: [],//掌握程度
- companysize_array: [],//公司规模
- companynature_array: [],//公司性质
- address_arr_id: [],//地址
- // company_hyid_array: [],//所属行业
- creatNews_user_type: '0',//判断用户类型'
-
- form: {
- user_type: "??",//判断用户类型'
- // cat_arr_id: 0,//导航池名称
- nav_add_pool_id: [],//导航池子级
- city_arr_id: [],//城市
- // websiteName: "",//站点名称
- cat_arr_id: [],//导航池名称
- title: "",//招聘职位名称
- province_id: "",//省份
- job_pronviceid: "",//省份id
- city_id: "",//城市
- hy_id: "",//行业分类
- zw_id: "",//职位类别
- jtzw_id: "",//具体职位
- nature_id: "",//职位性质
- createjob_pronvice: "",//工作省份
- experience: "",//工作经验
- educational: "",//学历
- salary: "",//月薪
- number: "",//招聘人数
- language: "",//语言能力
- level: "",//掌握程度
- description: "",//职位描述
- jt_description: "",//具体要求
- due_data: "",//截止日期
- business_name: "",//公司名称
- company_hy_id: "",//所属行业
- company_size: "",//公司规模
- company_nature: "",//公司性质
- introduction: "",//公司简介
- real_name: "",//联系人
- mobile: "",//联系电话
- company_url: "",//公司网址
- address_arr_id: [],//地址
- address: "",//地址
- email: "",//邮箱
- },
- //1.2 表单验证规则
- formRules: {
- // 站点名称
- // websiteName: [{ required: true, trigger: 'blur', validator: validateEmpty }],
- //导航池名称不能为空
- cat_arr_id: [{ required: true, trigger: 'blur', validator: validateArray }],
- province_id: [{ required: true, trigger: 'blur', validator: validateEmpty }],
- // 招聘职位名称
- title: [{ required: true, trigger: 'blur', validator: validateEmpty }],
- // 职位类别
- zw_id: [{ required: true, trigger: 'blur', validator: validateEmpty }],
- //具体职位
- jtzw_id: [{ required: true, trigger: 'blur', validator: validateEmpty }],
- // 职位性质
- nature_id: [{ required: true, trigger: 'blur', validator: validateEmpty }],
- // 工作省份
- province_id: [{ required: true, trigger: 'blur', validator: validateEmpty }],
- // 工作城市
- city_id: [{ required: true, trigger: 'blur', validator: validateEmpty }],
- // 行业分类
- hy_id: [{ required: true, trigger: 'blur', validator: validateEmpty }],
- // 职位描述
- description: [{ required: true, trigger: 'blur', validator: validateEmpty }],
- // 具体要求
- jt_description: [{ required: true, trigger: 'blur', validator: validateEmpty }],
- // 截止日期
- due_data: [{ required: true, trigger: 'blur', validator: validateEmpty }],
-
- // 公司名称
- business_name: [{ required: true, trigger: 'blur', validator: validateEmpty }],
- // 所属行业
- company_hy_id: [{ required: true, trigger: 'blur', validator: validateEmpty }],
- // 公司规模
- company_size: [{ required: true, trigger: 'blur', validator: validateEmpty }],
- // 公司简介
- introduction: [{ required: true, trigger: 'blur', validator: validateEmpty }],
- // 联系人
- real_name: [{ required: true, trigger: 'blur', validator: validateEmpty }],
- // 联系电话
- mobile: [{ required: true, trigger: 'blur', validator: validateEmpty }],
- // 地址
- // address_arr_id: [{ required: true, trigger: 'blur', validator: validateEmpty }] ,
- // 具体地址
- address: [{ required: true, trigger: 'blur', validator: validateEmpty }],
- },
- //获取父级导航池
- parentKey: 0,//获取父级导航
- webDpate: {
- checkStrictly: true,
- lazy: true,
- },
- parentData: {
- checkStrictly: true,
- lazy: true,
- async lazyLoad(node, resolve) {
- const { level, data } = node;
- if (data && data.children && data.children.length !== 0) {
- return resolve(node)
- }
- let parentId = level == 0 ? 0 : data.value
- let parames = {
- 'pid': parentId
- }
- self.$store.dispatch('pool/categoryList', parames).then(res => {
- if (res.data) {
- const nodes = res.data.map(item => ({
- value: item.id,
- label: item.name,
- leaf: level >= 3,
- children: []
- }))
- resolve(nodes)
- }
- })
- }
- },
- parentKey_2: 0,//获取父级导航
- parentData_2: {
- checkStrictly: true,
- lazy: true,
- async lazyLoad(node, resolve) {
- const { level, data } = node;
- if (data && data.children && data.children.length !== 0) {
- return resolve(node)
- }
- let parentId;
- if (data != undefined) {
- parentId = data.value;
- } else {
- parentId = self.creatNews_pid_num.toString();
- }
- let parames = {
- 'website_id': self.form.web_site_id ? self.form.web_site_id : self.websiteid,
- 'pid': parentId
- }
- self.$store.dispatch('pool/get_creatNews_nav_son_actions', parames).then(res => {
- if (res.data) {
- const nodes = res.data.map(item => ({
- value: item.category_id,
- label: item.name,
- leaf: level >= 3,
- children: []
- }))
- resolve(nodes)
- }
- })
- }
- },
-
- inputList: [
- { value: '' }
- ]
- //表单项 end ------------------------------------------------------------>
- };
- },
- methods: {
- //---------------------------
- // 下拉列表
- // 1.获取省
- get_provinceid(value) {
- this.$store.dispatch('news/getJobRecruitingArea').then(res => {
- this.province_array = res.data;
- })
- },
- province_change(value) {
- this.form.city_id = ''; // 清空城市选择
- this.$store.dispatch('news/getJobRecruitingArea', { pid: value }).then(res => {
- this.city_array = res.data;
- })
- },
- // 3.获取行业分类
- get_hyid(value) {
- this.$store.dispatch('news/getIndustry').then(res => {
- this.hy_array = res.data;
- })
- },
- // 4.获取职位类别
- get_zwid(value) {
- this.$store.dispatch('news/getPositionList').then(res => {
- this.zw_array = res.data;
-
- })
- },
- zwid_change(value) {
- // 修改此处,确保传递的是正确的参数对象
- this.form.jtzw_id = ''; // 清空具体职位选择
- this.$store.dispatch('news/getPositionList', { zwpid: value }).then(res => {
- this.jtzw_array = res.data;
- })
- },
-
- // 6.获取职位性质
- get_natureid(value) {
- this.$store.dispatch('news/getJobNature').then(res => {
- this.nature_array = res.data;
- })
- },
- // 7.获取工作经验
- get_experience(value) {
- this.$store.dispatch('news/getExperience').then(res => {
- this.experience_array = res.data;
- })
- },
- // 8.获取学历
- get_educational(value) {
- this.$store.dispatch('news/getEducation').then(res => {
- this.educational_array = res.data;
- })
- },
- // 9.获取薪资
- get_salary(value) {
- this.$store.dispatch('news/getSalary').then(res => {
- this.salary_array = res.data;
- })
- },
- // 10.获取语言能力
- get_language(value) {
- this.$store.dispatch('news/getLanguage').then(res => {
- this.language_array = res.data;
- })
- },
- // 11.获取掌握程度
- get_level(value) {
- this.$store.dispatch('news/getLevel').then(res => {
- this.level_array = res.data;
- })
- },
- // 12.获取公司分类
- get_company_hyid(value) {
- this.$store.dispatch('news/getIndustry').then(res => {
- this.hy_array = res.data;
- })
- },
- //13.获取公司规模
- get_company_size(value) {
- this.$store.dispatch('news/getCompanySize').then(res => {
- this.companysize_array = res.data;
- })
- },
- //14.获取公司性质
- get_company_nature(value) {
- this.$store.dispatch('news/getCompanyNature').then(res => {
- this.companynature_array = res.data;
- })
- },
- // 15.获取地址
- get_address_arr_id(value) {
- this.$store.dispatch('news/getJobRecruitingArea').then(res => {
- this.address_arr_id = res.data;
- })
- },
- //1.提交表单 start ------------------------------------------------------------>
- //1.2 提交表单
- addToServe() {
- this.$refs.form.validate(valid => {
- if (valid) {
- // if(this.creatNews_user_type === '10000'){
- this.form.user_type = this.creatNews_user_type;
- this.form.website_id = this.websiteid;
-
- if(this.form.province_id != '' && this.form.province_id != null && this.form.province_id != undefined){
- this.form.city_arr_id[0] = this.form.province_id;
- }else{
- this.form.city_arr_id[0] = null;
- }
- if(this.form.city_id != '' && this.form.city_id != null && this.form.city_id != undefined){
- this.form.city_arr_id[1] = this.form.city_id;
- }else{
- this.form.city_arr_id[1] = null;
- }
- if(this.form.due_data != '' && this.form.due_data != null && this.form.due_data != undefined){
- this.form.due_data = formatLocalDate(this.form.due_data);
- }else{
- this.form.due_data = null;
- }
- delete this.form.nav_add_pool_id;
- delete this.form.province_id;
- delete this.form.job_pronviceid;
- delete this.form.city_id;
- delete this.form.createjob_pronvice;
- delete this.form.web_site_id;
- this.$store.dispatch('news/addJobRecruiting', this.form).then(res => {
- if (res.code == 200) {
- //汇报结果
- this.$message({
- type: 'success',
- message: '已成功发布职位!'
- });
- this.cleatForm(2);
- //返回列表页
- this.returnPage()
- } else {
- this.$message({
- type: 'error',
- message: ": '发布失败!'.".this.$message
- });
- }
- }).catch(() => {
- this.$message({
- type: 'info',
- message: '网络错误,请重试!'
- });
- })
- // }
- }
- })
- },
-
- //1.3 清理表单
- cleatForm(type) {
- // if (type == 1) {
- //使用了外链,进行部分表单清理
- //this.form.cat_arr_id = "";
- this.form.cat_arr_id = "";
- this.form.province_id = "";
- this.form.title = "";
- this.form.zw_id = "";
- this.form.jtzw_id = "";
- this.form.nature_id = "";
- this.form.city_id = "";
- this.form.hy_id = "";
- this.form.description = "";
- this.form.due_data = "";
- // }
- if (this.creatNews_user_type == '10000') {
- //完全清理表单
- this.form.business_name = "";
- this.form.company_hy_id = "";
- this.form.company_size = "";
- this.form.introduction = "";
- this.form.real_name = "";
- this.form.mobile = "";
- this.form.address_arr_id = [];
- this.form.address = "";
- }
- },
- //1.4更新详细地址
- update_address_arr_id(value) {
- console.log("行政区划ID已更新:", value);
- this.form.address_arr_id = value;
- },
- //提交表单 end ------------------------------------------------------------>
- //2.跳转操作 start ------------------------------------------------------------>
- returnPage() {
- if (this.$route.query.to == "checkjob") {
- this.$router.push({
- path: '/checkjobRecruitingList',
- });
- } else {
- this.$router.push({
- path: '/jobRecruitingList',
- });
- }
- },
- //跳转操作 end ------------------------------------------------------------>
- //3.回显操作 ------------------------------------------------------------>
- // //3.1回显数据
- //3.1回显数据
- getMainData() {
- if(this.creatNews_user_type === '10000' || this.$route.query.id != undefined){
- let data = {
- id: this.$route.query.id
- };
- this.$store.dispatch('news/getJobRecruitingInfo', data).then(res => {
- //判断web_site_id是否为字符串,如果是转换为数字、
- //职位信息
- if (typeof res.data.web_site_id === 'string') {
- this.form.web_site_id = Number(res.data.website_id);
- } else {
- this.form.web_site_id = res.data.website_id //站点名称
- }
- this.form.cat_arr_id = Array.isArray(res.data.cat_arr_id) ? res.data.cat_arr_id : JSON.parse(res.data.cat_arr_id);
- this.parentKey_2 += 1; // 触发级联选择器重新加载
- this.loadCascaderPath(this.form.cat_arr_id); // 加载路径数据
- //回显行政区划
- this.form.city_arr_id = Array.isArray(res.data.city_arr_id) ? res.data.city_arr_id : JSON.parse(res.data.city_arr_id);
-
- this.form.title = res.data.title; //职位名称
-
- this.parentKey += 1; // 触发级联选择器重新加载
- if (this.form.city_arr_id.length > 0) {
- this.form.province_id = this.form.city_arr_id[0]?? '';
- if (this.form.city_arr_id.length > 1) {
- this.province_change(this.form.city_arr_id[0]);
- this.form.city_id = this.form.city_arr_id[1]?? '';
- }else{
- let data = {
- 'pid': this.form.city_arr_id[0]
- }
- this.$store.dispatch('news/getJobRecruitingArea',data ).then(res => {
- this.city_id = res.data;
- })
- }
- }
-
- this.form.hy_id = res.data.hy_id; //行业分类
- this.form.zw_id = res.data.zw_id; //职位类别
- this.zwid_change(this.form.zw_id);
- this.form.jtzw_id = res.data.jtzw_id; //具体职位
- this.form.nature_id = res.data.nature_id; //职位性质
- this.form.due_data = res.data.due_data; //截止日期
- this.form.experience = res.data.experience; //工作经验
- this.form.educational = res.data.educational; //学历
- this.form.salary = res.data.salary; //薪资
- this.form.number = res.data.number; //招聘人数
- this.form.language = res.data.language; //语言能力
- this.form.level = res.data.level; //掌握程度
- this.form.description = res.data.description; //职位描述
- this.form.jt_description = res.data.jt_description;//具体要求
- this.form.business_name = res.data.business_name;
- this.form.company_hy_id = res.data.company_hy_id;
- this.form.company_size = res.data.company_size;
- this.form.company_nature = res.data.company_nature;
- this.form.introduction = res.data.introduction;
- this.form.real_name = res.data.real_name;
- this.form.mobile = res.data.mobile;
- this.form.company_url = res.data.company_url;
- this.form.address = res.data.address;
- this.form.address_arr_id = Array.isArray(res.data.address_arr_id) ? res.data.address_arr_id : JSON.parse(res.data.address_arr_id);
- this.form.email = res.data.email;
- this.inputList = [];
- console.log(this.inputList)
- })
- }else{
- this.$store.dispatch('news/getJobCompany').then(res => {
- // 企业信息
- this.form.business_name = res.data.business_name;
- this.form.company_hy_id = res.data.company_hy_id;
- this.form.company_size = res.data.company_size;
- this.form.company_nature = res.data.company_nature;
- this.form.introduction = res.data.introduction;
- this.form.real_name = res.data.real_name;
- this.form.mobile = res.data.mobile;
- this.form.company_url = res.data.company_url;
- this.form.address = res.data.address;
- this.form.address_arr_id = Array.isArray(res.data.address_arr_id) ? res.data.address_arr_id : JSON.parse(res.data.address_arr_id);
- this.form.email = res.data.email;
- this.inputList = [];
- })
- }
-
- },
- async loadCascaderPath(path) {
- for (let i = 0; i < path.length; i++) {
- const parentId = path[i - 1] || 0; // 获取当前层级的父级ID
- const level = i; // 当前层级的索引
- await this.$store.dispatch('pool/categoryList', { pid: parentId })
- .then((res) => {
- const nodes = res.data.map(item => ({
- value: item.id,
- label: item.name,
- leaf: level >= 3, // 假设4层结构,设置叶子节点标记
- }));
- // 级联选择器加载数据
- if (level === path.length - 1) {
- this.form.cat_arr_id = path; // 确保最后一级路径正确设置
- this.parentKey += 1; // 强制刷新 cascader
- }
- });
- }
- },
- //1.3提交修改
- editToServe() {
- //添加要修改的id
- this.form.id = this.editId;
- this.form.website_id = this.form.web_site_id;
- // console.log('===========editId==============',this.form.web_site_id)
- //先进行验证
- this.$refs.form.validate(valid => {
- if (valid) {
- this.form.city_arr_id[0] = this.form.province_id;
- if(this.form.city_id!= '' && this.form.city_id!= null && this.form.city_id!= undefined){
- this.form.city_arr_id[1] = this.form.city_id;
- }
- // 假设你有一个 JSON 字符串变量 jsonStr,这里将其转换为数组
- try {
- this.form.address_arr_id = JSON.parse(this.form.address_arr_id);
- } catch (error) {
- console.error('JSON 解析出错:', error);
- }
- // console.log('===========city_arr_id==============', typeof(this.form.address_arr_id));
- // console.log('===========city_arr_id==============', this.form.city_arr_id);
- delete this.form.nav_add_pool_id;
- delete this.form.province_id;
- delete this.form.job_pronviceid;
- delete this.form.city_id;
- delete this.form.createjob_pronvice;
- delete this.form.web_site_id;
- this.$store.dispatch('news/upJobRecruiting', this.form).then(res => {
- if (res.code != 200) {
- this.$message.error("修改失败,请稍后再试!");
- } else {
- //汇报结果
- this.$message({
- type: 'success',
- message: '已成功修改职位信息!'
- });
- this.cleatForm(2);
- //返回列表页
- this.returnPage()
- }
- }).catch(() => {
- this.$message({
- type: 'info',
- message: '网络错误,请重试!'
- });
- })
- }
- })
- },
- //跳转操作 end ------------------------------------------------------------>
- get_creatNews_form_id_fun() {//判断用户类型ajax
- this.$store.dispatch('public/getInfo').then(res => {
- this.form.user_type = res.data.type_id;
- }).catch(() => {
- this.$message({
- type: 'info',
- message: '网络错误,请重试!'
- });
- })
- // console.log("this.form.user_type==",this.form);
- // console.log("this.form.user_type==2",this.form.user_type);
- },
- get_creatNews_nav_pool_arr_fun() {//xx
- this.$store.dispatch('pool/get_creatNews_nav_actions', { page: 1, pageSize: 666666 }).then(res => {
- res.data.rows.forEach((per_obj) => {
- let new_per = {
- label: per_obj.website_name,
- value: per_obj.id,
- }
- this.creatNews_nav_pool_arr.push(new_per)
- })
- }).catch(() => {
- this.$message({
- type: 'info',
- message: '网络错误,请重试!'
- });
- })
- },
- creatNews_nav_pool_change_fun() {
- //xx 导航池级
- let that = this;
- this.form.web_site_id = this.form.web_site_id[0]
- that.parentKey_2 += 1;
- this.$store.dispatch('pool/get_creatNews_nav_son_actions', { pid: String(this.creatNews_pid_num), website_id: String(this.form.web_site_id) }).then(res => {
- if (res.data.length == 0) {//没有导航池子级
- // alert("没有导航池子级");
- return
- }
- this.creatNews_add_nav_pool_arr = res.data;
- this.creatNews_add_nav_pool_arr.forEach((per_obj) => {
- per_obj.label = per_obj.name,
- per_obj.value = per_obj.id,
- this.creatNews_pid_num = per_obj.category_id
- })
- }).catch(() => {
- this.$message({
- type: 'info',
- message: '网络错误,请重试!'
- });
- })
- },
- },
- mounted() {
- this.creatNews_user_type = getUseType()
- this.websiteid = getWebSiteId()
- // console.log("============================",this.creatNews_user_type)
- //1.判断是新建还是回显
- this.get_hyid()
- this.get_provinceid()
- this.get_zwid()
- this.get_natureid()
- this.get_experience()
- this.get_educational()
- this.get_salary()
- this.get_language()
- this.get_level()
- this.get_company_hyid()
- this.get_company_size()
- this.get_company_nature()
- // this.getMainData()
- // this.get_createjob_pronvice ()
- this.get_address_arr_id()
- this.get_creatNews_form_id_fun()//
- this.get_creatNews_nav_pool_arr_fun()//
- if (this.$route.query.id != undefined) {
- this.editId = this.$route.query.id;
- this.editStatus = true;
- console.log("编辑新闻!")
- this.getMainData();
- } else {
- this.editStatus = false;
- console.log(typeof(this.creatNews_user_type))
- if(this.creatNews_user_type === '3'){
- this.getMainData();
- console.log("添加新闻!",this.creatNews_user_type)
- }
-
- }
-
- },
- };
- </script>
- <style scoped lang="less">
- .language {
- overflow: hidden;
- }
- //文本编辑器
- .QuillTitle {
- line-height: 36px;
- font-size: 14px;
- color: #606266;
- font-weight: bold;
- padding-left: 30px;
- span {
- color: #ff4949
- }
- .QuillModelBtn {
- display: inline-block;
- margin-left: 10px;
- font-size: 12px;
- color: #999;
- cursor: pointer;
- }
- }
- .editor-container {
- height: 420px;
- padding-bottom: 20px;
- }
- .my-quill-editor {
- height: 320px;
- }
- .ql-editor {
- height: 320px;
- }
- /* 富文本对齐方式 */
- .ql-align-center {
- text-align: center;
- }
- .ql-align-right {
- text-align: right;
- }
- .ql-indent-1 {
- padding-left: 16px;
- }
- .ql-indent-2 {
- padding-left: 32px;
- }
- .ql-indent-3 {
- padding-left: 48px;
- }
- .ql-indent-4 {
- padding-left: 64px;
- }
- .ql-indent-5 {
- padding-left: 80px;
- }
- .ql-indent-6 {
- padding-left: 96px;
- }
- .ql-indent-7 {
- padding-left: 112px;
- }
- .ql-indent-8 {
- padding-left: 128px;
- }
- #company_list{
- height: 500px;
- overflow: auto;
- padding: 20px 50px;
- }
- #company_list .descriptions{
- line-height: 36px;
- font-size: 16px;
- color: #606266;
- font-weight: bold;
- padding-left: 30px;
- width: 500px;
- margin-right:200px;
- background-color: aquamarine;
- }
- //执行v-deep穿透scope选择器 start------------------------------------------------------------>*/
- ::v-deep .custom-form-item>.el-form-item__label {
- line-height: 140px !important;
- }
- ::v-deep .custom-textarea .el-textarea__inner {
- resize: none;
- /* 禁止用户拖拽调整大小 */
- }
- ::v-deep .custom-align-right .el-form-item__label {
- text-align: right;
- /* 设置标签文字右对齐 */
- }
- ::v-deep .el-select {
- width: 100%;
- /* 禁止用户拖拽调整大小 */
- }
- ::v-deep .el-input-group__prepend {
- color: black !important;
- }
- .formLabelFloatBox {
- margin-bottom: 10px;
- position: relative;
- .formLabeladdIcon {
- position: absolute;
- right: 45px;
- top: 5px;
- width: 38px;
- height: 24px;
- }
- .formLabelDelIcon {
- position: absolute;
- right: 5px;
- top: 5px;
- width: 38px;
- height: 24px;
- }
- }
- //执行v-deep穿透scope选择器 end------------------------------------------------------------>*/</style>
|