creatJob.vue 36 KB

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