creatJob.vue 37 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026
  1. <template>
  2. <div class="mainBox">
  3. <div class="layerBox">
  4. <tableTitle :name="tableDivTitle" />
  5. <el-form :model="form" ref="form" :rules="formRules" label-position="left" label-width="120px">
  6. <div class="formDiv">
  7. <div v-if="creatNews_user_type == 10000">
  8. <el-form-item label="站点名称:" prop="web_site_id" class="custom-align-right">
  9. <el-cascader :key="parentKey" v-model="form.web_site_id" placeholder="请选择站点名称" popper-class="my_cascader"
  10. :options="creatNews_nav_pool_arr" @change="creatNews_nav_pool_change_fun(form.web_site_id)" filterable
  11. clearable></el-cascader>
  12. </el-form-item>
  13. </div>
  14. <el-form-item label="导航池名称:" prop="cat_arr_id" class="custom-align-right">
  15. <el-cascader :key="parentKey_2" v-model="form.cat_arr_id" placeholder="请选择导航池名称" :props="parentData_2"
  16. popper-class="my_cascader" filterable clearable></el-cascader>
  17. </el-form-item>
  18. <el-form-item label="招聘职位名称:" prop="title" class="custom-align-right">
  19. <el-input v-model="form.title" autocomplete="off" placeholder="请输入招聘职位名称"></el-input>
  20. </el-form-item>
  21. <el-form-item label="工作地点:" prop="province_id" class="custom-align-right">
  22. <el-select v-model="form.province_id" placeholder="请选择省" style="display:inline-block;width:50%"
  23. @change="province_change">
  24. <el-option v-for="item in province_array" :key="item.id" :label="item.name" :value="item.id">
  25. </el-option>
  26. </el-select>
  27. <el-select v-model="form.city_id" placeholder="请选择市" style="width:50%">
  28. <el-option v-for="item in city_array" :key="item.id" :label="item.name" :value="item.id">
  29. </el-option>
  30. </el-select>
  31. </el-form-item>
  32. <el-form-item label="行业类别:" prop="hy_id" class="custom-align-right">
  33. <el-select v-model="form.hy_id" placeholder="请选择行业类别">
  34. <el-option v-for="item in hy_array" :key="item.hyid" :label="item.hyname" :value="item.hyid">
  35. </el-option>
  36. </el-select>
  37. </el-form-item>
  38. <el-form-item label="职位类别:" prop="zw_id" class="custom-align-right">
  39. <el-select v-model="form.zw_id" placeholder="请选择职位类别" @change="zwid_change">
  40. <el-option v-for="item in zw_array" :key="item.zwid" :label="item.zwname" :value="item.zwid">
  41. </el-option>
  42. </el-select>
  43. </el-form-item>
  44. <el-form-item label="具体职位:" prop="jtzw_id" class="custom-align-right">
  45. <el-select v-model="form.jtzw_id" placeholder="请选择具体职位">
  46. <el-option v-for="item in jtzw_array" :key="item.zwid" :label="item.zwname" :value="item.zwid">
  47. </el-option>
  48. </el-select>
  49. </el-form-item>
  50. <el-form-item label="职位性质:" prop="nature_id" class="custom-align-right">
  51. <el-select v-model="form.nature_id" placeholder="请选择职位性质">
  52. <el-option v-for="item in nature_array" :key="item.evalue" :label="item.ename" :value="item.evalue">
  53. </el-option>
  54. </el-select>
  55. </el-form-item>
  56. <div>
  57. <el-form-item label="截止日期:" prop="due_data" class="custom-align-right">
  58. <el-date-picker v-model="form.due_data" placeholder="请选择截止日期"> </el-date-picker>
  59. </el-form-item>
  60. <el-form-item label="工作经验:" prop="experience" class="custom-align-right">
  61. <el-select v-model="form.experience" clearable placeholder="请选择工作经验">
  62. <el-option v-for="item in experience_array" :key="item.evalue" :label="item.ename"
  63. :value="item.evalue"></el-option>
  64. </el-select>
  65. </el-form-item>
  66. <el-form-item label="学历要求:" prop="educational" class="custom-align-right">
  67. <el-select v-model="form.educational" clearable placeholder="请选择学历要求">
  68. <el-option v-for="item in educational_array" :key="item.evalue" :label="item.ename"
  69. :value="item.evalue"></el-option>
  70. </el-select>
  71. </el-form-item>
  72. <el-form-item label="月薪:" prop="salary" class="custom-align-right">
  73. <el-select v-model="form.salary" clearable placeholder="请输入月薪">
  74. <el-option v-for="item in salary_array" :key="item.evalue" :label="item.ename"
  75. :value="item.evalue"></el-option>
  76. </el-select>
  77. </el-form-item>
  78. <el-form-item label="招聘人数:" prop="number" class="custom-align-right">
  79. <el-input v-model="form.number" autocomplete="off" placeholder="请输入招聘人数"></el-input>
  80. </el-form-item>
  81. <el-form-item label="语言能力:" prop="language" class="custom-align-right"
  82. style="width: 50%;display: inline-block;">
  83. <el-select v-model="form.language" clearable placeholder="请选择语种">
  84. <el-option v-for="item in language_array" :key="item.evalue" :label="item.ename"
  85. :value="item.evalue"></el-option>
  86. </el-select>
  87. </el-form-item>
  88. <el-form-item label="掌握程度:" prop="level" class="custom-align-right"
  89. style="width: 50%;display: inline-block;">
  90. <el-select v-model="form.level" clearable placeholder="请选择掌握程度">
  91. <el-option v-for="item in level_array" :key="item.evalue" :label="item.ename" :value="item.evalue">
  92. </el-option>
  93. </el-select>
  94. </el-form-item>
  95. <el-form-item label="职位描述:" prop="description" class="custom-align-right" style="display:block;">
  96. <el-input v-model="form.description" type="textarea" :rows="2" placeholder="介绍公司对该职位的职位描述..."> </el-input>
  97. </el-form-item>
  98. <el-form-item label="具体要求:" prop="jt_description" class="custom-align-right" style="display:block;">
  99. <el-input v-model="form.jt_description" type="textarea" :rows="2" placeholder="介绍公司对该职位的具体要求...">
  100. </el-input>
  101. </el-form-item>
  102. </div>
  103. <div>
  104. <!--公司信息 start-->
  105. <el-form-item label="公司名称:" prop="business_name" class="custom-align-right">
  106. <el-input v-model="form.business_name" autocomplete="off" placeholder="请输入公司名称"
  107. :disabled="creatNews_user_type !== '10000'"></el-input>
  108. </el-form-item>
  109. <el-form-item label="所属行业:" prop="company_hy_id" class="custom-align-right">
  110. <el-select v-model="form.company_hy_id" clearable placeholder="请选择公司所属的行业"
  111. :disabled="creatNews_user_type !== '10000'">
  112. <el-option v-for="item in hy_array" :key="item.hyid" :label="item.hyname" :value="item.hyid">
  113. </el-option>
  114. </el-select>
  115. </el-form-item>
  116. <el-form-item label="公司规模:" prop="company_size" class="custom-align-right">
  117. <el-select v-model="form.company_size" clearable placeholder="请选择公司的规模"
  118. :disabled="creatNews_user_type !== '10000'">
  119. <el-option v-for="item in companysize_array" :key="item.evalue" :label="item.ename"
  120. :value="item.evalue">
  121. </el-option>
  122. </el-select>
  123. </el-form-item>
  124. <el-form-item label="公司性质:" prop="company_nature" class="custom-align-right">
  125. <el-select v-model="form.company_nature" clearable placeholder="请选择公司的性质"
  126. :disabled="creatNews_user_type !== '10000'">
  127. <el-option v-for="item in companynature_array" :key="item.id" :label="item.nature_name"
  128. :value="item.id">
  129. </el-option>
  130. </el-select>
  131. </el-form-item>
  132. <el-form-item label="公司简介:" prop="introduction" class="custom-align-right">
  133. <el-input v-model="form.introduction" autocomplete="off" :disabled="creatNews_user_type !== '10000'"
  134. type="textarea" :rows="2" placeholder="请填写公司简介..."> </el-input>
  135. </el-form-item>
  136. <el-form-item label="联系人:" prop="real_name" class="custom-align-right">
  137. <el-input v-model="form.real_name" autocomplete="off" :disabled="creatNews_user_type !== '10000'"
  138. placeholder="请输入联系人"></el-input>
  139. </el-form-item>
  140. <el-form-item label="联系电话:" prop="mobile" class="custom-align-right">
  141. <el-input v-model="form.mobile" autocomplete="off" :disabled="creatNews_user_type !== '10000'"
  142. placeholder="请输入联系电话"></el-input>
  143. </el-form-item>
  144. <el-form-item label="公司网址:" prop="company_url" class="custom-align-right">
  145. <el-input v-model="form.company_url" autocomplete="off" :disabled="creatNews_user_type !== '10000'"
  146. placeholder="请输入公司网址"></el-input>
  147. </el-form-item>
  148. <el-form-item label="地址:" prop="address_arr_id" class="custom-align-right">
  149. <CityCascader v-model="form.address_arr_id" @update-city-id="update_address_arr_id"
  150. :user_type="creatNews_user_type"></CityCascader>
  151. <el-input v-model="form.address" autocomplete="off" :disabled="creatNews_user_type !== '10000'"
  152. placeholder="请输入公司地址"></el-input>
  153. </el-form-item>
  154. <el-form-item label="邮箱:" prop="email" class="custom-align-right">
  155. <el-input v-model="form.email" autocomplete="off" :disabled="creatNews_user_type !== '10000'"
  156. placeholder="请输入邮箱"></el-input>
  157. </el-form-item>
  158. <!--公司信息 end-->
  159. </div>
  160. </div>
  161. </el-form>
  162. </div>
  163. <div class="bottomBtnBox">
  164. <el-button type="info" @click="returnPage">返回</el-button>
  165. <el-button type="primary" @click="editToServe" v-if="editStatus == true">确定</el-button>
  166. <el-button type="primary" @click="addToServe" v-else>发布职位</el-button>
  167. </div>
  168. </div>
  169. </template>
  170. <script>
  171. import { getWebSiteId, getUseType } from '@/utils/auth'
  172. //表格标题
  173. import tableTitle from './components/tableTitle';
  174. //引入公用样式
  175. import '@/styles/global.less';
  176. import { create } from 'sortablejs';
  177. import CityCascader from './components/CityCascader';
  178. import { formatLocalDate } from '@/utils/public';
  179. export default {
  180. components: {
  181. tableTitle,
  182. CityCascader
  183. },
  184. data() {
  185. //0.全局操作 start ------------------------------------------------------------>
  186. //表单验证
  187. const validateEmpty = (rule, value, callback) => {
  188. if (value.length == 0) {
  189. callback(new Error('该项不能为空!'))
  190. } else {
  191. callback()
  192. }
  193. }
  194. const validateArray = (rule, value, callback) => {
  195. if (value.length == 0) {
  196. callback(new Error('该项不能为空!'))
  197. } else {
  198. callback()
  199. }
  200. }
  201. let self = this;
  202. //0.全局操作 end ------------------------------------------------------------>
  203. return {
  204. websiteid: 0,
  205. creatNews_pid_num: "0",//请求子导航用的pid
  206. creatNews_nav_pool_arr: [],//
  207. creatNews_add_nav_pool_arr: [],//
  208. creatNews_son_website_id_num: "",
  209. checked: false,
  210. formLabelWidth: '80px',//表单的长度
  211. //1.表单项 start ------------------------------------------------------------>
  212. editStatus: false,
  213. tableDivTitle: "添加职位",
  214. // disclaimer: true,//免责声明
  215. //提交表单
  216. province_array: [],//省份
  217. city_array: [],//城市
  218. hy_array: [],//行业分类
  219. zw_array: [],//职位类别
  220. jtzw_array: [],//具体职位
  221. nature_array: [],//职位性质
  222. experience_array: [],//工作经验
  223. educational_array: [],//学历
  224. salary_array: [],//薪资
  225. language_array: [],//语言能力
  226. level_array: [],//掌握程度
  227. companysize_array: [],//公司规模
  228. companynature_array: [],//公司性质
  229. address_arr_id: [],//地址
  230. // company_hyid_array: [],//所属行业
  231. creatNews_user_type: '0',//判断用户类型'
  232. form: {
  233. web_site_id: '',//站点名称
  234. user_type: "??",//判断用户类型'
  235. // cat_arr_id: 0,//导航池名称
  236. nav_add_pool_id: [],//导航池子级
  237. city_arr_id: [],//城市
  238. // websiteName: "",//站点名称
  239. cat_arr_id: [],//导航池名称
  240. title: "",//招聘职位名称
  241. province_id: "",//省份
  242. job_pronviceid: "",//省份id
  243. city_id: "",//城市
  244. hy_id: "",//行业分类
  245. zw_id: "",//职位类别
  246. jtzw_id: "",//具体职位
  247. nature_id: "",//职位性质
  248. createjob_pronvice: "",//工作省份
  249. experience: "",//工作经验
  250. educational: "",//学历
  251. salary: "",//月薪
  252. number: "",//招聘人数
  253. language: "",//语言能力
  254. level: "",//掌握程度
  255. description: "",//职位描述
  256. jt_description: "",//具体要求
  257. due_data: "",//截止日期
  258. business_name: "",//公司名称
  259. company_hy_id: "",//所属行业
  260. company_size: "",//公司规模
  261. company_nature: "",//公司性质
  262. introduction: "",//公司简介
  263. real_name: "",//联系人
  264. mobile: "",//联系电话
  265. company_url: "",//公司网址
  266. address_arr_id: [],//地址
  267. address: "",//地址
  268. email: "",//邮箱
  269. },
  270. //1.2 表单验证规则
  271. formRules: {
  272. // 站点名称
  273. web_site_id: [{ required: true, trigger: 'blur', validator: validateEmpty }],
  274. //导航池名称不能为空
  275. cat_arr_id: [{ required: true, trigger: 'blur', validator: validateArray }],
  276. province_id: [{ required: true, trigger: 'blur', validator: validateEmpty }],
  277. // 招聘职位名称
  278. title: [{ required: true, trigger: 'blur', validator: validateEmpty }],
  279. // 职位类别
  280. zw_id: [{ required: true, trigger: 'blur', validator: validateEmpty }],
  281. //具体职位
  282. jtzw_id: [{ required: true, trigger: 'blur', validator: validateEmpty }],
  283. // 职位性质
  284. nature_id: [{ required: true, trigger: 'blur', validator: validateEmpty }],
  285. // 工作省份
  286. province_id: [{ required: true, trigger: 'blur', validator: validateEmpty }],
  287. // 工作城市
  288. city_id: [{ required: true, trigger: 'blur', validator: validateEmpty }],
  289. // 行业分类
  290. hy_id: [{ required: true, trigger: 'blur', validator: validateEmpty }],
  291. // 职位描述
  292. description: [{ required: true, trigger: 'blur', validator: validateEmpty }],
  293. // 具体要求
  294. jt_description: [{ required: true, trigger: 'blur', validator: validateEmpty }],
  295. // 截止日期
  296. due_data: [{ required: true, trigger: 'blur', validator: validateEmpty }],
  297. // 薪水
  298. salary: [{ required: true, trigger: 'blur', validator: validateEmpty }],
  299. // 公司名称
  300. business_name: [{ required: true, trigger: 'blur', validator: validateEmpty }],
  301. // 所属行业
  302. company_hy_id: [{ required: true, trigger: 'blur', validator: validateEmpty }],
  303. // 公司规模
  304. company_size: [{ required: true, trigger: 'blur', validator: validateEmpty }],
  305. // 公司简介
  306. introduction: [{ required: true, trigger: 'blur', validator: validateEmpty }],
  307. // 联系人
  308. real_name: [{ required: true, trigger: 'blur', validator: validateEmpty }],
  309. // 联系电话
  310. mobile: [{ required: true, trigger: 'blur', validator: validateEmpty }],
  311. // 地址
  312. // address_arr_id: [{ required: true, trigger: 'blur', validator: validateEmpty }] ,
  313. // 具体地址
  314. address: [{ required: true, trigger: 'blur', validator: validateEmpty }],
  315. // 邮箱
  316. email: [{ required: true, trigger: 'blur', validator: validateEmpty }],
  317. },
  318. //获取父级导航池
  319. parentKey: 0,//获取父级导航
  320. webDpate: {
  321. checkStrictly: true,
  322. lazy: true,
  323. },
  324. parentData: {
  325. checkStrictly: true,
  326. lazy: true,
  327. async lazyLoad(node, resolve) {
  328. const { level, data } = node;
  329. if (data && data.children && data.children.length !== 0) {
  330. return resolve(node)
  331. }
  332. let parentId = level == 0 ? 0 : data.value
  333. let parames = {
  334. 'pid': parentId
  335. }
  336. self.$store.dispatch('pool/categoryList', parames).then(res => {
  337. if (res.data) {
  338. const nodes = res.data.map(item => ({
  339. value: item.id,
  340. label: item.name,
  341. leaf: level >= 3,
  342. children: []
  343. }))
  344. resolve(nodes)
  345. }
  346. })
  347. }
  348. },
  349. parentKey_2: 0,//获取父级导航
  350. parentData_2: {
  351. checkStrictly: true,
  352. lazy: true,
  353. async lazyLoad(node, resolve) {
  354. const { level, data } = node;
  355. if (data && data.children && data.children.length !== 0) {
  356. return resolve(node)
  357. }
  358. let parentId;
  359. if (data != undefined) {
  360. parentId = data.value;
  361. } else {
  362. parentId = self.creatNews_pid_num.toString();
  363. }
  364. let parames = {
  365. 'website_id': self.form.web_site_id ? self.form.web_site_id : self.websiteid,
  366. 'pid': parentId
  367. }
  368. self.$store.dispatch('pool/get_creatNews_nav_son_actions', parames).then(res => {
  369. if (res.data) {
  370. const nodes = res.data.map(item => ({
  371. value: item.category_id,
  372. label: item.name,
  373. leaf: level >= 3,
  374. children: []
  375. }))
  376. resolve(nodes)
  377. }
  378. })
  379. }
  380. },
  381. inputList: [
  382. { value: '' }
  383. ]
  384. //表单项 end ------------------------------------------------------------>
  385. };
  386. },
  387. methods: {
  388. //---------------------------
  389. // 下拉列表
  390. // 1.获取省
  391. get_provinceid(value) {
  392. this.$store.dispatch('news/getJobRecruitingArea').then(res => {
  393. this.province_array = res.data;
  394. })
  395. },
  396. province_change(value) {
  397. this.form.city_id = ''; // 清空城市选择
  398. this.$store.dispatch('news/getJobRecruitingArea', { pid: value }).then(res => {
  399. this.city_array = res.data;
  400. })
  401. },
  402. // 3.获取行业分类
  403. get_hyid(value) {
  404. this.$store.dispatch('news/getIndustry').then(res => {
  405. this.hy_array = res.data;
  406. })
  407. },
  408. // 4.获取职位类别
  409. get_zwid(value) {
  410. this.$store.dispatch('news/getPositionList').then(res => {
  411. this.zw_array = res.data;
  412. })
  413. },
  414. zwid_change(value) {
  415. // 修改此处,确保传递的是正确的参数对象
  416. this.form.jtzw_id = ''; // 清空具体职位选择
  417. this.$store.dispatch('news/getPositionList', { zwpid: value }).then(res => {
  418. this.jtzw_array = res.data;
  419. })
  420. },
  421. // 6.获取职位性质
  422. get_natureid(value) {
  423. this.$store.dispatch('news/getJobNature').then(res => {
  424. this.nature_array = res.data;
  425. })
  426. },
  427. // 7.获取工作经验
  428. get_experience(value) {
  429. this.$store.dispatch('news/getExperience').then(res => {
  430. this.experience_array = res.data;
  431. })
  432. },
  433. // 8.获取学历
  434. get_educational(value) {
  435. this.$store.dispatch('news/getEducation').then(res => {
  436. this.educational_array = res.data;
  437. })
  438. },
  439. // 9.获取薪资
  440. get_salary(value) {
  441. this.$store.dispatch('news/getSalary').then(res => {
  442. this.salary_array = res.data;
  443. })
  444. },
  445. // 10.获取语言能力
  446. get_language(value) {
  447. this.$store.dispatch('news/getLanguage').then(res => {
  448. this.language_array = res.data;
  449. })
  450. },
  451. // 11.获取掌握程度
  452. get_level(value) {
  453. this.$store.dispatch('news/getLevel').then(res => {
  454. this.level_array = res.data;
  455. })
  456. },
  457. // 12.获取公司分类
  458. get_company_hyid(value) {
  459. this.$store.dispatch('news/getIndustry').then(res => {
  460. this.hy_array = res.data;
  461. })
  462. },
  463. //13.获取公司规模
  464. get_company_size(value) {
  465. this.$store.dispatch('news/getCompanySize').then(res => {
  466. this.companysize_array = res.data;
  467. })
  468. },
  469. //14.获取公司性质
  470. get_company_nature(value) {
  471. this.$store.dispatch('news/getCompanyNature').then(res => {
  472. this.companynature_array = res.data;
  473. })
  474. },
  475. // 15.获取地址
  476. get_address_arr_id(value) {
  477. this.$store.dispatch('news/getJobRecruitingArea').then(res => {
  478. this.address_arr_id = res.data;
  479. })
  480. },
  481. //1.提交表单 start ------------------------------------------------------------>
  482. //1.2 提交表单
  483. addToServe() {
  484. this.$refs.form.validate(valid => {
  485. if (valid) {
  486. // if(this.creatNews_user_type === '10000'){
  487. this.form.user_type = this.creatNews_user_type;
  488. this.form.website_id = this.websiteid;
  489. if (this.form.province_id != '' && this.form.province_id != null && this.form.province_id != undefined) {
  490. this.form.city_arr_id[0] = this.form.province_id;
  491. } else {
  492. this.form.city_arr_id[0] = null;
  493. }
  494. if (this.form.city_id != '' && this.form.city_id != null && this.form.city_id != undefined) {
  495. this.form.city_arr_id[1] = this.form.city_id;
  496. } else {
  497. this.form.city_arr_id[1] = null;
  498. }
  499. if (this.form.due_data != '' && this.form.due_data != null && this.form.due_data != undefined) {
  500. this.form.due_data = formatLocalDate(this.form.due_data);
  501. } else {
  502. this.form.due_data = null;
  503. }
  504. delete this.form.nav_add_pool_id;
  505. delete this.form.province_id;
  506. delete this.form.job_pronviceid;
  507. delete this.form.city_id;
  508. delete this.form.createjob_pronvice;
  509. delete this.form.web_site_id;
  510. this.$store.dispatch('news/addJobRecruiting', this.form).then(res => {
  511. if (res.code == 200) {
  512. //汇报结果
  513. this.$message({
  514. type: 'success',
  515. message: '已成功发布职位!'
  516. });
  517. this.cleatForm(2);
  518. //返回列表页
  519. this.returnPage()
  520. } else {
  521. this.$message({
  522. type: 'error',
  523. message: ": '发布失败!'.".this.$message
  524. });
  525. }
  526. }).catch(() => {
  527. this.$message({
  528. type: 'info',
  529. message: '网络错误,请重试!'
  530. });
  531. })
  532. // }
  533. }
  534. })
  535. },
  536. //1.3 清理表单
  537. cleatForm(type) {
  538. // if (type == 1) {
  539. //使用了外链,进行部分表单清理
  540. //this.form.cat_arr_id = "";
  541. this.form.cat_arr_id = "";
  542. this.form.province_id = "";
  543. this.form.title = "";
  544. this.form.zw_id = "";
  545. this.form.jtzw_id = "";
  546. this.form.nature_id = "";
  547. this.form.city_id = "";
  548. this.form.hy_id = "";
  549. this.form.description = "";
  550. this.form.due_data = "";
  551. // }
  552. if (this.creatNews_user_type == '10000') {
  553. //完全清理表单
  554. this.form.business_name = "";
  555. this.form.company_hy_id = "";
  556. this.form.company_size = "";
  557. this.form.introduction = "";
  558. this.form.real_name = "";
  559. this.form.mobile = "";
  560. this.form.address_arr_id = [];
  561. this.form.address = "";
  562. }
  563. },
  564. //1.4更新详细地址
  565. update_address_arr_id(value) {
  566. console.log("行政区划ID已更新:", value);
  567. this.form.address_arr_id = value;
  568. },
  569. //提交表单 end ------------------------------------------------------------>
  570. //2.跳转操作 start ------------------------------------------------------------>
  571. returnPage() {
  572. if (this.$route.query.to == "checkjob") {
  573. this.$router.push({
  574. path: '/checkjobRecruitingList',
  575. });
  576. } else {
  577. this.$router.push({
  578. path: '/jobRecruitingList',
  579. });
  580. }
  581. },
  582. //跳转操作 end ------------------------------------------------------------>
  583. //3.回显操作 ------------------------------------------------------------>
  584. // //3.1回显数据
  585. //3.1回显数据
  586. getMainData() {
  587. if (this.creatNews_user_type === '10000' || this.$route.query.id != undefined) {
  588. let data = {
  589. id: this.$route.query.id
  590. };
  591. this.$store.dispatch('news/getJobRecruitingInfo', data).then(res => {
  592. //判断web_site_id是否为字符串,如果是转换为数字、
  593. //职位信息
  594. if (typeof res.data.web_site_id === 'string') {
  595. this.form.web_site_id = Number(res.data.website_id);
  596. } else {
  597. this.form.web_site_id = res.data.website_id //站点名称
  598. }
  599. this.form.cat_arr_id = Array.isArray(res.data.cat_arr_id) ? res.data.cat_arr_id : JSON.parse(res.data.cat_arr_id);
  600. this.parentKey_2 += 1; // 触发级联选择器重新加载
  601. this.loadCascaderPath(this.form.cat_arr_id); // 加载路径数据
  602. //回显行政区划
  603. this.form.city_arr_id = Array.isArray(res.data.city_arr_id) ? res.data.city_arr_id : JSON.parse(res.data.city_arr_id);
  604. this.form.title = res.data.title; //职位名称
  605. this.parentKey += 1; // 触发级联选择器重新加载
  606. if (this.form.city_arr_id.length > 0) {
  607. this.form.province_id = this.form.city_arr_id[0] ?? '';
  608. if (this.form.city_arr_id.length > 1) {
  609. this.province_change(this.form.city_arr_id[0]);
  610. this.form.city_id = this.form.city_arr_id[1] ?? '';
  611. } else {
  612. let data = {
  613. 'pid': this.form.city_arr_id[0]
  614. }
  615. this.$store.dispatch('news/getJobRecruitingArea', data).then(res => {
  616. this.city_id = res.data;
  617. })
  618. }
  619. }
  620. this.form.hy_id = res.data.hy_id; //行业分类
  621. this.form.zw_id = res.data.zw_id; //职位类别
  622. this.zwid_change(this.form.zw_id);
  623. this.form.jtzw_id = res.data.jtzw_id; //具体职位
  624. this.form.nature_id = res.data.nature_id; //职位性质
  625. this.form.due_data = res.data.due_data; //截止日期
  626. this.form.experience = res.data.experience; //工作经验
  627. this.form.educational = res.data.educational; //学历
  628. this.form.salary = res.data.salary; //薪资
  629. this.form.number = res.data.number; //招聘人数
  630. this.form.language = res.data.language; //语言能力
  631. this.form.level = res.data.level; //掌握程度
  632. this.form.description = res.data.description; //职位描述
  633. this.form.jt_description = res.data.jt_description;//具体要求
  634. this.form.business_name = res.data.business_name;
  635. this.form.company_hy_id = res.data.company_hy_id;
  636. this.form.company_size = res.data.company_size;
  637. this.form.company_nature = res.data.company_nature;
  638. this.form.introduction = res.data.introduction;
  639. this.form.real_name = res.data.real_name;
  640. this.form.mobile = res.data.mobile;
  641. this.form.company_url = res.data.company_url;
  642. this.form.address = res.data.address;
  643. this.form.address_arr_id = Array.isArray(res.data.address_arr_id) ? res.data.address_arr_id : JSON.parse(res.data.address_arr_id);
  644. this.form.email = res.data.email;
  645. this.inputList = [];
  646. console.log(this.inputList)
  647. })
  648. } else {
  649. this.$store.dispatch('news/getJobCompany').then(res => {
  650. // 企业信息
  651. this.form.business_name = res.data.business_name;
  652. this.form.company_hy_id = res.data.company_hy_id;
  653. this.form.company_size = res.data.company_size;
  654. this.form.company_nature = res.data.company_nature;
  655. this.form.introduction = res.data.introduction;
  656. this.form.real_name = res.data.real_name;
  657. this.form.mobile = res.data.mobile;
  658. this.form.company_url = res.data.company_url;
  659. this.form.address = res.data.address;
  660. this.form.address_arr_id = Array.isArray(res.data.address_arr_id) ? res.data.address_arr_id : JSON.parse(res.data.address_arr_id);
  661. this.form.email = res.data.email;
  662. this.inputList = [];
  663. })
  664. }
  665. },
  666. async loadCascaderPath(path) {
  667. for (let i = 0; i < path.length; i++) {
  668. const parentId = path[i - 1] || 0; // 获取当前层级的父级ID
  669. const level = i; // 当前层级的索引
  670. await this.$store.dispatch('pool/categoryList', { pid: parentId })
  671. .then((res) => {
  672. const nodes = res.data.map(item => ({
  673. value: item.id,
  674. label: item.name,
  675. leaf: level >= 3, // 假设4层结构,设置叶子节点标记
  676. }));
  677. // 级联选择器加载数据
  678. if (level === path.length - 1) {
  679. this.form.cat_arr_id = path; // 确保最后一级路径正确设置
  680. this.parentKey += 1; // 强制刷新 cascader
  681. }
  682. });
  683. }
  684. },
  685. //1.3提交修改
  686. editToServe() {
  687. //添加要修改的id
  688. this.form.id = this.editId;
  689. this.form.website_id = this.form.web_site_id;
  690. // console.log('===========editId==============',this.form.web_site_id)
  691. //先进行验证
  692. this.$refs.form.validate(valid => {
  693. if (valid) {
  694. this.form.city_arr_id[0] = this.form.province_id;
  695. if (this.form.city_id != '' && this.form.city_id != null && this.form.city_id != undefined) {
  696. this.form.city_arr_id[1] = this.form.city_id;
  697. }
  698. // 假设你有一个 JSON 字符串变量 jsonStr,这里将其转换为数组
  699. try {
  700. this.form.address_arr_id = JSON.parse(this.form.address_arr_id);
  701. } catch (error) {
  702. console.error('JSON 解析出错:', error);
  703. }
  704. // console.log('===========city_arr_id==============', typeof(this.form.address_arr_id));
  705. // console.log('===========city_arr_id==============', this.form.city_arr_id);
  706. delete this.form.nav_add_pool_id;
  707. delete this.form.province_id;
  708. delete this.form.job_pronviceid;
  709. delete this.form.city_id;
  710. delete this.form.createjob_pronvice;
  711. delete this.form.web_site_id;
  712. this.$store.dispatch('news/upJobRecruiting', this.form).then(res => {
  713. if (res.code != 200) {
  714. this.$message.error("修改失败,请稍后再试!");
  715. } else {
  716. //汇报结果
  717. this.$message({
  718. type: 'success',
  719. message: '已成功修改职位信息!'
  720. });
  721. this.cleatForm(2);
  722. //返回列表页
  723. this.returnPage()
  724. }
  725. }).catch(() => {
  726. this.$message({
  727. type: 'info',
  728. message: '网络错误,请重试!'
  729. });
  730. })
  731. }
  732. })
  733. },
  734. //跳转操作 end ------------------------------------------------------------>
  735. get_creatNews_form_id_fun() {//判断用户类型ajax
  736. this.$store.dispatch('public/getInfo').then(res => {
  737. this.form.user_type = res.data.type_id;
  738. }).catch(() => {
  739. this.$message({
  740. type: 'info',
  741. message: '网络错误,请重试!'
  742. });
  743. })
  744. // console.log("this.form.user_type==",this.form);
  745. // console.log("this.form.user_type==2",this.form.user_type);
  746. },
  747. get_creatNews_nav_pool_arr_fun() {//xx
  748. this.$store.dispatch('pool/get_creatNews_nav_actions', { page: 1, pageSize: 666666 }).then(res => {
  749. res.data.rows.forEach((per_obj) => {
  750. let new_per = {
  751. label: per_obj.website_name,
  752. value: per_obj.id,
  753. }
  754. this.creatNews_nav_pool_arr.push(new_per)
  755. })
  756. }).catch(() => {
  757. this.$message({
  758. type: 'info',
  759. message: '网络错误,请重试!'
  760. });
  761. })
  762. },
  763. creatNews_nav_pool_change_fun() {
  764. //xx 导航池级
  765. let that = this;
  766. this.form.web_site_id = this.form.web_site_id[0]
  767. that.parentKey_2 += 1;
  768. 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 => {
  769. if (res.data.length == 0) {//没有导航池子级
  770. // alert("没有导航池子级");
  771. return
  772. }
  773. this.creatNews_add_nav_pool_arr = res.data;
  774. this.creatNews_add_nav_pool_arr.forEach((per_obj) => {
  775. per_obj.label = per_obj.name,
  776. per_obj.value = per_obj.id,
  777. this.creatNews_pid_num = per_obj.category_id
  778. })
  779. }).catch(() => {
  780. this.$message({
  781. type: 'info',
  782. message: '网络错误,请重试!'
  783. });
  784. })
  785. },
  786. },
  787. mounted() {
  788. this.creatNews_user_type = getUseType()
  789. this.websiteid = getWebSiteId()
  790. if (this.creatNews_user_type !== '10000') {
  791. this.form.web_site_id = this.websiteid;
  792. // console.log("this.form.web_site_id==",this.form.web_site_id)
  793. }
  794. // console.log("============================",this.creatNews_user_type)
  795. //1.判断是新建还是回显
  796. this.get_hyid()
  797. this.get_provinceid()
  798. this.get_zwid()
  799. this.get_natureid()
  800. this.get_experience()
  801. this.get_educational()
  802. this.get_salary()
  803. this.get_language()
  804. this.get_level()
  805. this.get_company_hyid()
  806. this.get_company_size()
  807. this.get_company_nature()
  808. // this.getMainData()
  809. // this.get_createjob_pronvice ()
  810. this.get_address_arr_id()
  811. this.get_creatNews_form_id_fun()//
  812. this.get_creatNews_nav_pool_arr_fun()//
  813. if (this.$route.query.id != undefined) {
  814. this.editId = this.$route.query.id;
  815. this.editStatus = true;
  816. console.log("编辑新闻!")
  817. this.getMainData();
  818. } else {
  819. this.editStatus = false;
  820. console.log(typeof (this.creatNews_user_type))
  821. if (this.creatNews_user_type === '3') {
  822. this.getMainData();
  823. console.log("添加新闻!", this.creatNews_user_type)
  824. }
  825. }
  826. },
  827. watch: {
  828. '$route'(to, from) {
  829. console.log(from, '---------------------------------------');
  830. // 监听路由参数中的 id 变化,若变化则更新页面状态并获取数据
  831. if (to.query.id) {
  832. this.getMainData();
  833. }
  834. },
  835. }
  836. };
  837. </script>
  838. <style scoped lang="less">
  839. .language {
  840. overflow: hidden;
  841. }
  842. //文本编辑器
  843. .QuillTitle {
  844. line-height: 36px;
  845. font-size: 14px;
  846. color: #606266;
  847. font-weight: bold;
  848. padding-left: 30px;
  849. span {
  850. color: #ff4949
  851. }
  852. .QuillModelBtn {
  853. display: inline-block;
  854. margin-left: 10px;
  855. font-size: 12px;
  856. color: #999;
  857. cursor: pointer;
  858. }
  859. }
  860. .editor-container {
  861. height: 420px;
  862. padding-bottom: 20px;
  863. }
  864. .my-quill-editor {
  865. height: 320px;
  866. }
  867. .ql-editor {
  868. height: 320px;
  869. }
  870. /* 富文本对齐方式 */
  871. .ql-align-center {
  872. text-align: center;
  873. }
  874. .ql-align-right {
  875. text-align: right;
  876. }
  877. .ql-indent-1 {
  878. padding-left: 16px;
  879. }
  880. .ql-indent-2 {
  881. padding-left: 32px;
  882. }
  883. .ql-indent-3 {
  884. padding-left: 48px;
  885. }
  886. .ql-indent-4 {
  887. padding-left: 64px;
  888. }
  889. .ql-indent-5 {
  890. padding-left: 80px;
  891. }
  892. .ql-indent-6 {
  893. padding-left: 96px;
  894. }
  895. .ql-indent-7 {
  896. padding-left: 112px;
  897. }
  898. .ql-indent-8 {
  899. padding-left: 128px;
  900. }
  901. #company_list {
  902. height: 500px;
  903. overflow: auto;
  904. padding: 20px 50px;
  905. }
  906. #company_list .descriptions {
  907. line-height: 36px;
  908. font-size: 16px;
  909. color: #606266;
  910. font-weight: bold;
  911. padding-left: 30px;
  912. width: 500px;
  913. margin-right: 200px;
  914. background-color: aquamarine;
  915. }
  916. //执行v-deep穿透scope选择器 start------------------------------------------------------------>*/
  917. ::v-deep .custom-form-item>.el-form-item__label {
  918. line-height: 140px !important;
  919. }
  920. ::v-deep .custom-textarea .el-textarea__inner {
  921. resize: none;
  922. /* 禁止用户拖拽调整大小 */
  923. }
  924. ::v-deep .custom-align-right .el-form-item__label {
  925. text-align: right;
  926. /* 设置标签文字右对齐 */
  927. }
  928. ::v-deep .el-select {
  929. width: 100%;
  930. /* 禁止用户拖拽调整大小 */
  931. }
  932. ::v-deep .el-input-group__prepend {
  933. color: black !important;
  934. }
  935. .formLabelFloatBox {
  936. margin-bottom: 10px;
  937. position: relative;
  938. .formLabeladdIcon {
  939. position: absolute;
  940. right: 45px;
  941. top: 5px;
  942. width: 38px;
  943. height: 24px;
  944. }
  945. .formLabelDelIcon {
  946. position: absolute;
  947. right: 5px;
  948. top: 5px;
  949. width: 38px;
  950. height: 24px;
  951. }
  952. }
  953. //执行v-deep穿透scope选择器 end------------------------------------------------------------>*/</style>