creatJob.vue 37 KB

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