publish_present.vue 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384
  1. <template>
  2. <div id="publish-present">
  3. <el-row>
  4. <el-col :span="24" align="center">
  5. <h2>驻场招聘信息表</h2>
  6. </el-col>
  7. </el-row>
  8. <el-row>
  9. <el-col :span="19">
  10. <h3>基本信息</h3>
  11. </el-col>
  12. </el-row>
  13. <el-row>
  14. <el-col :span="12">
  15. 项目ID:
  16. <span>{{related_id}}</span>
  17. </el-col>
  18. <el-col :span="12">
  19. 需求方:
  20. <span>{{uid}}</span>
  21. </el-col>
  22. </el-row>
  23. <el-row>
  24. <el-col :span="24">
  25. 项目名称:
  26. <span>{{title}}</span>
  27. </el-col>
  28. </el-row>
  29. <el-row>
  30. <el-col :span="24">
  31. 项目类型:
  32. <span>{{related_type}}</span>
  33. <span style="display: none">{{job_type}}</span>
  34. </el-col>
  35. </el-row>
  36. <el-row>
  37. <el-col :span="12">
  38. 客户经理:
  39. <span>{{manager}}</span>
  40. </el-col>
  41. <el-col :span="12">
  42. <div class="inlineb">
  43. <span class>开放状态:</span>
  44. <div class="inlineb">
  45. <el-select v-model="statusValue">
  46. <el-option
  47. v-for="item of openStatus"
  48. :key="item.id"
  49. :label="item.label"
  50. :value="item.id"
  51. ></el-option>
  52. </el-select>
  53. </div>
  54. </div>
  55. </el-col>
  56. </el-row>
  57. <el-row>
  58. <el-col :span="24">
  59. <h3>驻场信息</h3>
  60. </el-col>
  61. </el-row>
  62. <el-row>
  63. <el-col :span="24">
  64. <div class="inlineb">
  65. <span class>薪酬范围:</span>
  66. <div class="inlineb">
  67. <el-input style="width: 230px;" v-model="salary_from"></el-input>至
  68. </div>
  69. <div class="inlineb">
  70. <el-input style="width: 230px;" v-model="salary_to"></el-input>
  71. </div>
  72. <el-alert title class="top" id="salaryAlert" type="error" style="display: none" show-icon></el-alert>
  73. </div>
  74. </el-col>
  75. </el-row>
  76. <el-row>
  77. <el-col :span="24">
  78. <div class="inlineb">
  79. <span class>驻场地点:</span>
  80. <div class="inlineb">
  81. <el-select v-model="city">
  82. <el-option
  83. v-for="item of citys"
  84. :key="item.city"
  85. :label="item.label"
  86. :value="item.city"
  87. ></el-option>
  88. </el-select>
  89. </div>
  90. </div>
  91. </el-col>
  92. </el-row>
  93. <el-row>
  94. <el-col :span="24">
  95. <div class="inlineb">
  96. <span class>驻场周期:</span>
  97. <div class="inlineb">
  98. <el-input style="width: 230px;" v-model="month"></el-input>个月
  99. </div>
  100. <el-alert title class="top" id="monthAlert" type="error" style="display: none" show-icon></el-alert>
  101. </div>
  102. </el-col>
  103. </el-row>
  104. <el-row>
  105. <el-col :span="24">
  106. <div class="inlineb">
  107. <span class>工作年限:</span>
  108. <div class="inlineb">
  109. <el-input style="width: 230px;" v-model="work_year"></el-input>年
  110. </div>
  111. <el-alert title class="top" id="workYear" type="error" style="display: none" show-icon></el-alert>
  112. </div>
  113. </el-col>
  114. </el-row>
  115. <el-row>
  116. <el-col :span="24">
  117. <div class="inlineb">
  118. <span class>是否有文件:</span>
  119. <div class="inlineb">
  120. <el-select v-model="file">
  121. <el-option v-for="item of files" :key="item.id" :label="item.label" :value="item.id"></el-option>
  122. </el-select>
  123. </div>
  124. </div>
  125. </el-col>
  126. </el-row>
  127. <el-row>
  128. <el-col :span="24">
  129. 职位方向:
  130. <span>{{directions}}</span>
  131. <span style="display: none">{{match_directions}}</span>
  132. </el-col>
  133. </el-row>
  134. <el-row>
  135. <el-col :span="24">
  136. 技能要求:
  137. <span>{{skill}}</span>
  138. <span style="display: none">{{match_skills}}</span>
  139. </el-col>
  140. </el-row>
  141. <el-row>
  142. <el-col :span="20">
  143. 工作内容:
  144. <el-alert title class="top" id="jobInfoAlert" type="error" style="display: none" show-icon></el-alert>
  145. <el-input
  146. type="textarea"
  147. :autosize="{ minRows: 5, maxRows: 4}"
  148. placeholder="请输入内容"
  149. v-model="job_description"
  150. ></el-input>
  151. </el-col>
  152. </el-row>
  153. <el-row>
  154. <el-col :span="24">
  155. <el-button type="primary" @click="savePresent">保存</el-button>
  156. <el-button type="info" @click="cancelPresent">取消</el-button>
  157. </el-col>
  158. </el-row>
  159. </div>
  160. </template>
  161. <script>
  162. export default {
  163. data() {
  164. return {
  165. related_id: "",
  166. uid: "",
  167. title: "",
  168. related_type: "",
  169. job_type: "",
  170. manager: "",
  171. salary_from: "",
  172. salary_to: "",
  173. month: "",
  174. work_year: "",
  175. directions: "",
  176. match_skills: "",
  177. skill: "",
  178. job_description: "",
  179. match_directions: "",
  180. jump_url: "",
  181. citys: [
  182. {
  183. city: "0",
  184. label: "不限"
  185. },
  186. {
  187. city: "1",
  188. label: "北京"
  189. },
  190. {
  191. city: "2",
  192. label: "上海"
  193. },
  194. {
  195. city: "3",
  196. label: "广州"
  197. },
  198. {
  199. city: "4",
  200. label: "深圳"
  201. },
  202. {
  203. city: "5",
  204. label: "成都"
  205. },
  206. {
  207. city: "6",
  208. label: "杭州"
  209. }
  210. ],
  211. city: "0",
  212. openStatus: [
  213. {
  214. id: 0,
  215. label: "下架隐藏"
  216. },
  217. {
  218. id: 1,
  219. label: "开放中"
  220. },
  221. {
  222. id: 2,
  223. label: "停止申请"
  224. },
  225. {
  226. id: 3,
  227. label: "开发中"
  228. },
  229. {
  230. id: 4,
  231. label: "已结束"
  232. }
  233. ],
  234. statusValue: 0,
  235. files: [
  236. {
  237. id: "1",
  238. label: "是"
  239. },
  240. {
  241. id: "0",
  242. label: "否"
  243. }
  244. ],
  245. file: "0"
  246. };
  247. },
  248. mounted() {
  249. this.getPresentInfo();
  250. },
  251. methods: {
  252. async getPresentInfo() {
  253. let query = window.location.search.substring(1);
  254. let vars = query.split("&");
  255. let body = {
  256. job_id: vars[0].split("=")[1],
  257. job_type: vars[1].split("=")[1]
  258. };
  259. let url = window.location.href;
  260. this.jump_url =
  261. this.$store.state.domainConfig.siteUrl + "/rooter/cloudjobitem/";
  262. const res = await this.$post("/api/admin/present_job/present_info", body);
  263. this.related_id = res.data.job.id;
  264. this.uid = res.data.job.uid;
  265. this.title = res.data.job.title2;
  266. this.related_type = res.data.job_type;
  267. this.manager = res.data.manager;
  268. this.salary_from = res.data.job.match_salary_min;
  269. this.salary_to = res.data.job.match_salary_max;
  270. this.month = res.data.job.month ? res.data.job.month : "";
  271. this.work_year = res.data.job.work_year ? res.data.job.work_year : "";
  272. this.directions = res.data.job.directions;
  273. this.match_skills = res.data.job.match_skills;
  274. this.skill = res.data.job.skill;
  275. this.statusValue = res.data.job.status ? res.data.job.status : 0;
  276. this.city = res.data.job.city ? res.data.job.city : "0";
  277. this.file = res.data.job.show_file ? res.data.job.show_file : "0";
  278. this.job_type = vars[1].split("=")[1];
  279. this.job_description = res.data.job.description;
  280. this.match_directions = res.data.job.match_directions;
  281. },
  282. async cancelPresent() {
  283. window.history.back();
  284. },
  285. async savePresent() {
  286. let flag = false;
  287. let salaryAlert = document.getElementById("salaryAlert");
  288. let monthAlert = document.getElementById("monthAlert");
  289. let jobInfoAlert = document.getElementById("jobInfoAlert");
  290. let workYearAlert = document.getElementById("workYear");
  291. if (this.work_year.length == 0) {
  292. workYearAlert.innerText = "请输入工作年限";
  293. workYearAlert.style.display = "block";
  294. flag = true;
  295. }
  296. if (this.salary_from.length == 0 || this.salary_to.length == 0) {
  297. salaryAlert.innerText = "请正确输入薪酬范围";
  298. salaryAlert.style.display = "block";
  299. flag = true;
  300. }
  301. if (this.month.length == 0) {
  302. monthAlert.innerText = "请输入驻场周期";
  303. monthAlert.style.display = "block";
  304. flag = true;
  305. }
  306. if (this.job_description.length == 0) {
  307. jobInfoAlert.innerText = "请输入工作内容";
  308. jobInfoAlert.style.display = "block";
  309. flag = true;
  310. }
  311. if (
  312. (this.work_year < 0 || this.work_year > 99) &&
  313. this.work_year.length != 0
  314. ) {
  315. workYearAlert.innerText = "工作年限正确填写范围0-99";
  316. workYearAlert.style.display = "block";
  317. flag = true;
  318. }
  319. this.salary_from = parseInt(this.salary_from);
  320. this.salary_to = parseInt(this.salary_to);
  321. if (
  322. this.salary_from < 1 ||
  323. this.salary_from > 1000000 ||
  324. this.salary_to < 1 ||
  325. this.salary_to > 1000000 ||
  326. this.salary_from >= this.salary_to
  327. ) {
  328. salaryAlert.innerText = "薪酬填写范围1-1000000且前一个值要小于后一个值";
  329. salaryAlert.style.display = "block";
  330. flag = true;
  331. }
  332. if ((this.month < 1 || this.month > 99) && this.month.length != 0) {
  333. monthAlert.innerText = "驻场周期正确填写范围1-99";
  334. monthAlert.style.display = "block";
  335. flag = true;
  336. }
  337. if (this.job_description.length > 10000) {
  338. jobInfoAlert.innerText = "工作内容填写最多10000个字符且不能为空";
  339. jobInfoAlert.style.display = "block";
  340. flag = true;
  341. }
  342. if (flag) {
  343. return false;
  344. }
  345. let body = {
  346. related_id: this.related_id,
  347. title: this.title,
  348. related_type: this.job_type,
  349. status: this.statusValue,
  350. salary_from: this.salary_from,
  351. salary_to: this.salary_to,
  352. city: this.city,
  353. show_file: this.file,
  354. month: this.month,
  355. work_year: this.work_year,
  356. job_direction: this.match_directions,
  357. job_skills: this.match_skills,
  358. job_description: this.job_description
  359. };
  360. const res = await this.$post("/api/admin/present_job/present_edit", body);
  361. if (res.status == 1) {
  362. alert(res.info);
  363. location.href = this.jump_url + this.related_id;
  364. }
  365. }
  366. }
  367. };
  368. </script>
  369. <style lang="scss" scoped>
  370. .el-row {
  371. margin-bottom: 20px;
  372. }
  373. .top {
  374. margin-top: 10px;
  375. }
  376. </style>