creatJob.vue 38 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037
  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. parentData: {
  321. checkStrictly: true,
  322. lazy: true,
  323. async lazyLoad(node, resolve) {
  324. const { level, data } = node;
  325. if (data && data.children && data.children.length !== 0) {
  326. return resolve(node)
  327. }
  328. let parentId;
  329. parentId = level == 0 ? 0 : data.value;
  330. let parames = {
  331. 'type': 1,
  332. 'website_id': getWebSiteId(),
  333. 'pid': parentId
  334. }
  335. self.$store.dispatch('pool/get_creatNews_nav_son_actions', parames).then(res => {
  336. if (res.data) {
  337. const nodes = res.data.map(item => ({
  338. value: item.category_id,
  339. label: item.alias,
  340. leaf: level >= 3,
  341. children: [],
  342. disabled: item.type != 1
  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. 'type': 5,
  366. 'website_id': self.form.web_site_id ? self.form.web_site_id : self.getWebSiteId(),
  367. 'pid': parentId ? parentId : 0
  368. }
  369. self.$store.dispatch('news/getWebsiteNavList', parames).then(res => {
  370. if (res.data) {
  371. const nodes = res.data.map(item => ({
  372. value: item.category_id,
  373. label: item.name,
  374. leaf: level >= 3,
  375. children: []
  376. }))
  377. resolve(nodes)
  378. }
  379. })
  380. }
  381. },
  382. inputList: [
  383. { value: '' }
  384. ]
  385. //表单项 end ------------------------------------------------------------>
  386. };
  387. },
  388. methods: {
  389. //---------------------------
  390. // 下拉列表
  391. // 1.获取省
  392. get_provinceid(value) {
  393. this.$store.dispatch('news/getJobRecruitingArea').then(res => {
  394. this.province_array = res.data;
  395. })
  396. },
  397. province_change(value) {
  398. this.form.city_id = ''; // 清空城市选择
  399. this.$store.dispatch('news/getJobRecruitingArea', { pid: value }).then(res => {
  400. this.city_array = res.data;
  401. })
  402. },
  403. // 3.获取行业分类
  404. get_hyid(value) {
  405. this.$store.dispatch('news/getIndustry').then(res => {
  406. this.hy_array = res.data;
  407. })
  408. },
  409. // 4.获取职位类别
  410. get_zwid(value) {
  411. this.$store.dispatch('news/getPositionList').then(res => {
  412. this.zw_array = res.data;
  413. })
  414. },
  415. zwid_change(value) {
  416. // 修改此处,确保传递的是正确的参数对象
  417. this.form.jtzw_id = ''; // 清空具体职位选择
  418. this.$store.dispatch('news/getPositionList', { zwpid: value }).then(res => {
  419. this.jtzw_array = res.data;
  420. })
  421. },
  422. // 6.获取职位性质
  423. get_natureid(value) {
  424. this.$store.dispatch('news/getJobNature').then(res => {
  425. this.nature_array = res.data;
  426. })
  427. },
  428. // 7.获取工作经验
  429. get_experience(value) {
  430. this.$store.dispatch('news/getExperience').then(res => {
  431. this.experience_array = res.data;
  432. })
  433. },
  434. // 8.获取学历
  435. get_educational(value) {
  436. this.$store.dispatch('news/getEducation').then(res => {
  437. this.educational_array = res.data;
  438. })
  439. },
  440. // 9.获取薪资
  441. get_salary(value) {
  442. this.$store.dispatch('news/getSalary').then(res => {
  443. this.salary_array = res.data;
  444. })
  445. },
  446. // 10.获取语言能力
  447. get_language(value) {
  448. this.$store.dispatch('news/getLanguage').then(res => {
  449. this.language_array = res.data;
  450. })
  451. },
  452. // 11.获取掌握程度
  453. get_level(value) {
  454. this.$store.dispatch('news/getLevel').then(res => {
  455. this.level_array = res.data;
  456. })
  457. },
  458. // 12.获取公司分类
  459. get_company_hyid(value) {
  460. this.$store.dispatch('news/getIndustry').then(res => {
  461. this.hy_array = res.data;
  462. })
  463. },
  464. //13.获取公司规模
  465. get_company_size(value) {
  466. this.$store.dispatch('news/getCompanySize').then(res => {
  467. this.companysize_array = res.data;
  468. })
  469. },
  470. //14.获取公司性质
  471. get_company_nature(value) {
  472. this.$store.dispatch('news/getCompanyNature').then(res => {
  473. this.companynature_array = res.data;
  474. })
  475. },
  476. // 15.获取地址
  477. get_address_arr_id(value) {
  478. this.$store.dispatch('news/getJobRecruitingArea').then(res => {
  479. this.address_arr_id = res.data;
  480. })
  481. },
  482. //1.提交表单 start ------------------------------------------------------------>
  483. //1.2 提交表单
  484. addToServe() {
  485. this.$refs.form.validate(valid => {
  486. if (valid) {
  487. // if(this.creatNews_user_type === '10000'){
  488. this.form.user_type = this.creatNews_user_type;
  489. // this.form.website_id = this.websiteid;
  490. if (this.form.province_id != '' && this.form.province_id != null && this.form.province_id != undefined) {
  491. this.form.city_arr_id[0] = this.form.province_id;
  492. } else {
  493. this.form.city_arr_id[0] = null;
  494. }
  495. if (this.form.city_id != '' && this.form.city_id != null && this.form.city_id != undefined) {
  496. this.form.city_arr_id[1] = this.form.city_id;
  497. } else {
  498. this.form.city_arr_id[1] = null;
  499. }
  500. if (this.form.due_data != '' && this.form.due_data != null && this.form.due_data != undefined) {
  501. this.form.due_data = formatLocalDate(this.form.due_data);
  502. } else {
  503. this.form.due_data = null;
  504. }
  505. delete this.form.nav_add_pool_id;
  506. delete this.form.province_id;
  507. delete this.form.job_pronviceid;
  508. delete this.form.city_id;
  509. delete this.form.createjob_pronvice;
  510. if (this.creatNews_user_type === '10000') {
  511. this.form.website_id = this.form.web_site_id;
  512. } else {
  513. this.form.website_id = this.websiteid;
  514. }
  515. delete this.form.web_site_id;
  516. console.log("提交的数据:", this.form);
  517. this.$store.dispatch('news/addJobRecruiting', this.form).then(res => {
  518. if (res.code == 200) {
  519. //汇报结果
  520. this.$message({
  521. type: 'success',
  522. message: '已成功发布职位!'
  523. });
  524. this.cleatForm(2);
  525. //返回列表页
  526. this.returnPage()
  527. } else {
  528. this.$message({
  529. type: 'error',
  530. message: ": '发布失败!'.".this.$message
  531. });
  532. }
  533. }).catch(() => {
  534. this.$message({
  535. type: 'info',
  536. message: '网络错误,请重试!'
  537. });
  538. })
  539. // }
  540. }
  541. })
  542. },
  543. //1.3 清理表单
  544. cleatForm(type) {
  545. // if (type == 1) {
  546. //使用了外链,进行部分表单清理
  547. //this.form.cat_arr_id = "";
  548. this.form.cat_arr_id = "";
  549. this.form.province_id = "";
  550. this.form.title = "";
  551. this.form.zw_id = "";
  552. this.form.jtzw_id = "";
  553. this.form.nature_id = "";
  554. this.form.city_id = "";
  555. this.form.hy_id = "";
  556. this.form.description = "";
  557. this.form.due_data = "";
  558. // }
  559. if (this.creatNews_user_type == '10000') {
  560. //完全清理表单
  561. this.form.business_name = "";
  562. this.form.company_hy_id = "";
  563. this.form.company_size = "";
  564. this.form.introduction = "";
  565. this.form.real_name = "";
  566. this.form.mobile = "";
  567. this.form.address_arr_id = [];
  568. this.form.address = "";
  569. }
  570. },
  571. //1.4更新详细地址
  572. update_address_arr_id(value) {
  573. console.log("行政区划ID已更新:", value);
  574. this.form.address_arr_id = value;
  575. },
  576. //提交表单 end ------------------------------------------------------------>
  577. //2.跳转操作 start ------------------------------------------------------------>
  578. returnPage() {
  579. if (this.$route.query.to == "checkjob") {
  580. this.$router.push({
  581. path: '/checkjobRecruitingList',
  582. });
  583. } else {
  584. this.$router.push({
  585. path: '/jobRecruitingList',
  586. });
  587. }
  588. },
  589. //跳转操作 end ------------------------------------------------------------>
  590. //3.回显操作 ------------------------------------------------------------>
  591. // //3.1回显数据
  592. //3.1回显数据
  593. getMainData() {
  594. if (this.creatNews_user_type === '10000' || this.$route.query.id != undefined) {
  595. let data = {
  596. id: this.$route.query.id
  597. };
  598. this.$store.dispatch('news/getJobRecruitingInfo', data).then(res => {
  599. //判断web_site_id是否为字符串,如果是转换为数字、
  600. //职位信息
  601. if (typeof res.data.web_site_id === 'string') {
  602. this.form.web_site_id = Number(res.data.website_id);
  603. } else {
  604. this.form.web_site_id = res.data.website_id //站点名称
  605. }
  606. this.form.cat_arr_id = Array.isArray(res.data.cat_arr_id) ? res.data.cat_arr_id : JSON.parse(res.data.cat_arr_id);
  607. this.parentKey_2 += 1; // 触发级联选择器重新加载
  608. this.loadCascaderPath(this.form.cat_arr_id); // 加载路径数据
  609. //回显行政区划
  610. this.form.city_arr_id = Array.isArray(res.data.city_arr_id) ? res.data.city_arr_id : JSON.parse(res.data.city_arr_id);
  611. this.form.title = res.data.title; //职位名称
  612. this.parentKey += 1; // 触发级联选择器重新加载
  613. if (this.form.city_arr_id.length > 0) {
  614. this.form.province_id = this.form.city_arr_id[0] ?? '';
  615. if (this.form.city_arr_id.length > 1) {
  616. this.province_change(this.form.city_arr_id[0]);
  617. this.form.city_id = this.form.city_arr_id[1] ?? '';
  618. } else {
  619. let data = {
  620. 'pid': this.form.city_arr_id[0]
  621. }
  622. this.$store.dispatch('news/getJobRecruitingArea', data).then(res => {
  623. this.city_id = res.data;
  624. })
  625. }
  626. }
  627. this.form.hy_id = res.data.hy_id; //行业分类
  628. this.form.zw_id = res.data.zw_id; //职位类别
  629. this.zwid_change(this.form.zw_id);
  630. this.form.jtzw_id = res.data.jtzw_id; //具体职位
  631. this.form.nature_id = res.data.nature_id; //职位性质
  632. this.form.due_data = res.data.due_data; //截止日期
  633. this.form.experience = res.data.experience; //工作经验
  634. this.form.educational = res.data.educational; //学历
  635. this.form.salary = res.data.salary; //薪资
  636. this.form.number = res.data.number; //招聘人数
  637. this.form.language = res.data.language; //语言能力
  638. this.form.level = res.data.level; //掌握程度
  639. this.form.description = res.data.description; //职位描述
  640. this.form.jt_description = res.data.jt_description;//具体要求
  641. this.form.business_name = res.data.business_name;
  642. this.form.company_hy_id = res.data.company_hy_id;
  643. this.form.company_size = res.data.company_size;
  644. this.form.company_nature = res.data.company_nature;
  645. this.form.introduction = res.data.introduction;
  646. this.form.real_name = res.data.real_name;
  647. this.form.mobile = res.data.mobile;
  648. this.form.company_url = res.data.company_url;
  649. this.form.address = res.data.address;
  650. this.form.address_arr_id = Array.isArray(res.data.address_arr_id) ? res.data.address_arr_id : JSON.parse(res.data.address_arr_id);
  651. this.form.email = res.data.email;
  652. this.inputList = [];
  653. console.log(this.inputList)
  654. })
  655. } else {
  656. this.$store.dispatch('news/getJobCompany').then(res => {
  657. // 企业信息
  658. this.form.business_name = res.data.business_name;
  659. this.form.company_hy_id = res.data.company_hy_id;
  660. this.form.company_size = res.data.company_size;
  661. this.form.company_nature = res.data.company_nature;
  662. this.form.introduction = res.data.introduction;
  663. this.form.real_name = res.data.real_name;
  664. this.form.mobile = res.data.mobile;
  665. this.form.company_url = res.data.company_url;
  666. this.form.address = res.data.address;
  667. this.form.address_arr_id = Array.isArray(res.data.address_arr_id) ? res.data.address_arr_id : JSON.parse(res.data.address_arr_id);
  668. this.form.email = res.data.email;
  669. this.inputList = [];
  670. })
  671. }
  672. },
  673. async loadCascaderPath(path) {
  674. for (let i = 0; i < path.length; i++) {
  675. const parentId = path[i - 1] || 0; // 获取当前层级的父级ID
  676. const level = i; // 当前层级的索引
  677. await this.$store.dispatch('pool/categoryList', { pid: parentId })
  678. .then((res) => {
  679. const nodes = res.data.map(item => ({
  680. value: item.id,
  681. label: item.name,
  682. leaf: level >= 3, // 假设4层结构,设置叶子节点标记
  683. }));
  684. // 级联选择器加载数据
  685. if (level === path.length - 1) {
  686. this.form.cat_arr_id = path; // 确保最后一级路径正确设置
  687. this.parentKey += 1; // 强制刷新 cascader
  688. }
  689. });
  690. }
  691. },
  692. //1.3提交修改
  693. editToServe() {
  694. //添加要修改的id
  695. this.form.id = this.editId;
  696. this.form.website_id = this.form.web_site_id;
  697. // console.log('===========editId==============',this.form.web_site_id)
  698. //先进行验证
  699. this.$refs.form.validate(valid => {
  700. if (valid) {
  701. this.form.city_arr_id[0] = this.form.province_id;
  702. if (this.form.city_id != '' && this.form.city_id != null && this.form.city_id != undefined) {
  703. this.form.city_arr_id[1] = this.form.city_id;
  704. }
  705. // 假设你有一个 JSON 字符串变量 jsonStr,这里将其转换为数组
  706. try {
  707. this.form.address_arr_id = JSON.parse(this.form.address_arr_id);
  708. } catch (error) {
  709. console.error('JSON 解析出错:', error);
  710. }
  711. // console.log('===========city_arr_id==============', typeof(this.form.address_arr_id));
  712. // console.log('===========city_arr_id==============', this.form.city_arr_id);
  713. delete this.form.nav_add_pool_id;
  714. delete this.form.province_id;
  715. delete this.form.job_pronviceid;
  716. delete this.form.city_id;
  717. delete this.form.createjob_pronvice;
  718. delete this.form.web_site_id;
  719. this.$store.dispatch('news/upJobRecruiting', this.form).then(res => {
  720. if (res.code != 200) {
  721. this.$message.error("修改失败,请稍后再试!");
  722. } else {
  723. //汇报结果
  724. this.$message({
  725. type: 'success',
  726. message: '已成功修改职位信息!'
  727. });
  728. this.cleatForm(2);
  729. //返回列表页
  730. this.returnPage()
  731. }
  732. }).catch(() => {
  733. this.$message({
  734. type: 'info',
  735. message: '网络错误,请重试!'
  736. });
  737. })
  738. }
  739. })
  740. },
  741. //跳转操作 end ------------------------------------------------------------>
  742. get_creatNews_form_id_fun() {//判断用户类型ajax
  743. this.$store.dispatch('public/getInfo').then(res => {
  744. this.form.user_type = res.data.type_id;
  745. }).catch(() => {
  746. this.$message({
  747. type: 'info',
  748. message: '网络错误,请重试!'
  749. });
  750. })
  751. // console.log("this.form.user_type==",this.form);
  752. // console.log("this.form.user_type==2",this.form.user_type);
  753. },
  754. get_creatNews_nav_pool_arr_fun() {//xx
  755. this.$store.dispatch('pool/get_creatNews_nav_actions', { page: 1, pageSize: 666666 }).then(res => {
  756. res.data.rows.forEach((per_obj) => {
  757. let new_per = {
  758. label: per_obj.website_name,
  759. value: per_obj.id,
  760. }
  761. this.creatNews_nav_pool_arr.push(new_per)
  762. })
  763. }).catch(() => {
  764. this.$message({
  765. type: 'info',
  766. message: '网络错误,请重试!'
  767. });
  768. })
  769. },
  770. creatNews_nav_pool_change_fun() {
  771. //xx 导航池级
  772. let that = this;
  773. this.form.web_site_id = this.form.web_site_id[0]
  774. that.parentKey_2 += 1;
  775. // this.$store.dispatch('pool/get_creatNews_nav_son_actions', {
  776. // 'type': 5,
  777. // pid: String(this.creatNews_pid_num), website_id: String(this.form.web_site_id)
  778. // }).then(res => {
  779. // if (res.data.length == 0) {//没有导航池子级
  780. // // alert("没有导航池子级");
  781. // return
  782. // }
  783. // this.creatNews_add_nav_pool_arr = res.data;
  784. // this.creatNews_add_nav_pool_arr.forEach((per_obj) => {
  785. // per_obj.label = per_obj.name,
  786. // per_obj.value = per_obj.id,
  787. // this.creatNews_pid_num = per_obj.category_id
  788. // })
  789. // }).catch(() => {
  790. // this.$message({
  791. // type: 'info',
  792. // message: '网络错误,请重试!'
  793. // });
  794. // })
  795. },
  796. },
  797. mounted() {
  798. this.creatNews_user_type = getUseType()
  799. this.websiteid = getWebSiteId()
  800. if (this.creatNews_user_type !== '10000') {
  801. this.form.web_site_id = this.websiteid;
  802. // console.log("this.form.web_site_id==",this.form.web_site_id)
  803. }
  804. // console.log("============================",this.creatNews_user_type)
  805. //1.判断是新建还是回显
  806. this.get_hyid()
  807. this.get_provinceid()
  808. this.get_zwid()
  809. this.get_natureid()
  810. this.get_experience()
  811. this.get_educational()
  812. this.get_salary()
  813. this.get_language()
  814. this.get_level()
  815. this.get_company_hyid()
  816. this.get_company_size()
  817. this.get_company_nature()
  818. // this.getMainData()
  819. // this.get_createjob_pronvice ()
  820. this.get_address_arr_id()
  821. this.get_creatNews_form_id_fun()//
  822. this.get_creatNews_nav_pool_arr_fun()//
  823. if (this.$route.query.id != undefined) {
  824. this.editId = this.$route.query.id;
  825. this.editStatus = true;
  826. console.log("编辑新闻!")
  827. this.getMainData();
  828. } else {
  829. this.editStatus = false;
  830. console.log(typeof (this.creatNews_user_type))
  831. if (this.creatNews_user_type === '3') {
  832. this.getMainData();
  833. console.log("添加新闻!", this.creatNews_user_type)
  834. }
  835. }
  836. },
  837. watch: {
  838. '$route'(to, from) {
  839. console.log(from, '---------------------------------------');
  840. // 监听路由参数中的 id 变化,若变化则更新页面状态并获取数据
  841. if (to.query.id) {
  842. this.getMainData();
  843. }
  844. },
  845. }
  846. };
  847. </script>
  848. <style scoped lang="less">
  849. .language {
  850. overflow: hidden;
  851. }
  852. //文本编辑器
  853. .QuillTitle {
  854. line-height: 36px;
  855. font-size: 14px;
  856. color: #606266;
  857. font-weight: bold;
  858. padding-left: 30px;
  859. span {
  860. color: #ff4949
  861. }
  862. .QuillModelBtn {
  863. display: inline-block;
  864. margin-left: 10px;
  865. font-size: 12px;
  866. color: #999;
  867. cursor: pointer;
  868. }
  869. }
  870. .editor-container {
  871. height: 420px;
  872. padding-bottom: 20px;
  873. }
  874. .my-quill-editor {
  875. height: 320px;
  876. }
  877. .ql-editor {
  878. height: 320px;
  879. }
  880. /* 富文本对齐方式 */
  881. .ql-align-center {
  882. text-align: center;
  883. }
  884. .ql-align-right {
  885. text-align: right;
  886. }
  887. .ql-indent-1 {
  888. padding-left: 16px;
  889. }
  890. .ql-indent-2 {
  891. padding-left: 32px;
  892. }
  893. .ql-indent-3 {
  894. padding-left: 48px;
  895. }
  896. .ql-indent-4 {
  897. padding-left: 64px;
  898. }
  899. .ql-indent-5 {
  900. padding-left: 80px;
  901. }
  902. .ql-indent-6 {
  903. padding-left: 96px;
  904. }
  905. .ql-indent-7 {
  906. padding-left: 112px;
  907. }
  908. .ql-indent-8 {
  909. padding-left: 128px;
  910. }
  911. #company_list {
  912. height: 500px;
  913. overflow: auto;
  914. padding: 20px 50px;
  915. }
  916. #company_list .descriptions {
  917. line-height: 36px;
  918. font-size: 16px;
  919. color: #606266;
  920. font-weight: bold;
  921. padding-left: 30px;
  922. width: 500px;
  923. margin-right: 200px;
  924. background-color: aquamarine;
  925. }
  926. //执行v-deep穿透scope选择器 start------------------------------------------------------------>*/
  927. ::v-deep .custom-form-item>.el-form-item__label {
  928. line-height: 140px !important;
  929. }
  930. ::v-deep .custom-textarea .el-textarea__inner {
  931. resize: none;
  932. /* 禁止用户拖拽调整大小 */
  933. }
  934. ::v-deep .custom-align-right .el-form-item__label {
  935. text-align: right;
  936. /* 设置标签文字右对齐 */
  937. }
  938. ::v-deep .el-select {
  939. width: 100%;
  940. /* 禁止用户拖拽调整大小 */
  941. }
  942. ::v-deep .el-input-group__prepend {
  943. color: black !important;
  944. }
  945. .formLabelFloatBox {
  946. margin-bottom: 10px;
  947. position: relative;
  948. .formLabeladdIcon {
  949. position: absolute;
  950. right: 45px;
  951. top: 5px;
  952. width: 38px;
  953. height: 24px;
  954. }
  955. .formLabelDelIcon {
  956. position: absolute;
  957. right: 5px;
  958. top: 5px;
  959. width: 38px;
  960. height: 24px;
  961. }
  962. }
  963. //执行v-deep穿透scope选择器 end------------------------------------------------------------>*/</style>