cloud_job.vue 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574
  1. <template>
  2. <div id="cloud-job">
  3. <div class="top">
  4. <h3>云端工作</h3>
  5. <div class="top-info">
  6. <div class="top-info-left">
  7. <span>
  8. 待审核:
  9. <b>{{nums.waitCheckNum && nums.waitCheckNum.num}}</b>
  10. </span>
  11. <span>
  12. 对接面试中:
  13. <b>{{nums.selectDeveloperNum && (nums.selectDeveloperNum.num + nums.waitInterviewNum.num)}}</b>
  14. </span>
  15. <span>
  16. 待托管费用:
  17. <b>{{nums.waitPayNum && nums.waitPayNum.num}}</b>
  18. </span>
  19. <span>
  20. 开发中:
  21. <b>{{nums.waitSettNum && nums.waitSettNum.num}}</b>
  22. </span>
  23. </div>
  24. <div class="top-info-right">
  25. <span @click="createPeriod">生成20天内的账单</span>
  26. <span @click="finishPeriod">生成待结薪的账单</span>
  27. </div>
  28. </div>
  29. </div>
  30. <div class="form">
  31. <div class="left">
  32. <el-select v-model="selectedStatus" placeholder="工作状态">
  33. <el-option
  34. v-for="(item, index) of statuses"
  35. :key="index"
  36. :label="item.name"
  37. :value="index"
  38. >
  39. <div>
  40. {{item.name}}
  41. <span
  42. class="num"
  43. :style="`color: ${STATUS_COLOR[item.name]};`"
  44. >{{item.num}}</span>
  45. </div>
  46. </el-option>
  47. </el-select>
  48. <el-select v-model="selectedDirection" placeholder="职位方向">
  49. <el-option
  50. v-for="(item, index) of directions"
  51. :key="index"
  52. :label="item.direction_name"
  53. :value="item.direction_id"
  54. ></el-option>
  55. </el-select>
  56. <el-input placeholder="工作ID" v-model="jobID"></el-input>
  57. <el-input placeholder="企业方ID" v-model="comID"></el-input>
  58. <el-input placeholder="开发者ID" v-model="devID"></el-input>
  59. <el-select v-model="checkID" placeholder="客户经理">
  60. <el-option
  61. v-for="item in checkIdData"
  62. :key="item.uid"
  63. :label="item.nickname"
  64. :value="item.nickname">
  65. </el-option>
  66. </el-select>
  67. <el-checkbox v-model="presentHire">驻场招聘</el-checkbox>
  68. <el-checkbox v-model="unDeposit" @change="changeDeposit">本期未托管</el-checkbox>
  69. <el-button @click="getCloudJob">筛选</el-button>
  70. </div>
  71. <div class="right">
  72. <el-button @click="doManager">结算管理</el-button>
  73. <el-button @click="doExport">导出报表</el-button>
  74. </div>
  75. </div>
  76. <div class="table" style>
  77. <el-table
  78. v-if="tableData.length"
  79. stripe
  80. style="width: 100%;"
  81. :data="tableData"
  82. @row-click="clickRow"
  83. >
  84. <el-table-column
  85. v-for="(prop, index) of tableProps"
  86. :key="index"
  87. :prop="prop"
  88. :label="tableHeaders[index]"
  89. :fixed="index < 4"
  90. :width="columnWidth(prop)"
  91. >
  92. <template slot-scope="scope">
  93. <el-button
  94. type="text"
  95. v-if="prop === 'ctrl'"
  96. @click="clickDetail(scope.row['id'])"
  97. >{{scope.row[prop]}}</el-button>
  98. <span
  99. v-else-if="prop === 'status'"
  100. :style="`color: ${STATUS_COLOR[scope.row['statusName']]};`"
  101. >{{scope.row['statusName']}}</span>
  102. <span v-else-if="prop === 'id'">
  103. {{scope.row['id']}}
  104. <span v-if="!scope.row.deposit_status" style="color: red;">(待托管)</span>
  105. </span>
  106. <span v-else-if="prop === 'source_type'">
  107. <span v-if="scope.row.source_type">
  108. <el-tooltip class="item" effect="dark" :content="scope.row.version" placement="top">
  109. <el-link type="primary">{{scope.row['source_type'] || '--'}}</el-link>
  110. </el-tooltip>
  111. </span>
  112. <span v-else>
  113. --
  114. </span>
  115. </span>
  116. <span v-else>{{scope.row[prop] || '--'}}</span>
  117. </template>
  118. </el-table-column>
  119. </el-table>
  120. </div>
  121. <el-pagination
  122. @current-change="changePagination"
  123. :current-page.sync="currentPage"
  124. :page-size="20"
  125. layout="total, prev, pager, next"
  126. :total="totalCount"
  127. ></el-pagination>
  128. </div>
  129. </template>
  130. <script>
  131. const tableHeaders = [
  132. "工作ID",
  133. "方向",
  134. "企业方",
  135. "开发者",
  136. "状态",
  137. "驻场",
  138. "发布时间",
  139. "客户经理",
  140. "来源",
  141. "工作时长",
  142. "雇佣方式",
  143. "基本薪资",
  144. "每周工时",
  145. "用户来源",
  146. "本期托管",
  147. "下期托管",
  148. "开始时间",
  149. "结薪时间",
  150. "发薪时间",
  151. "试用期",
  152. "开票",
  153. "纳税",
  154. "企业方费用",
  155. "开发者工资",
  156. "试用期",
  157. "开票",
  158. "纳税",
  159. "企业方费用",
  160. "开发者薪资"
  161. ];
  162. const tableProps = [
  163. "id",
  164. "matchDirections",
  165. "nickname",
  166. "devNickname",
  167. "status",
  168. "publish_present_hire",
  169. "createTime",
  170. "userManagerName",
  171. "source_type",
  172. "work_time_type",
  173. "work_time_point",
  174. "salary",
  175. "workHours",
  176. "remark_user_from",
  177. "current_deposit_num",
  178. "next_deposit_num",
  179. "startTime",
  180. "endTime",
  181. "sendSalaryTime",
  182. "isNeedProbation",
  183. "isInvoice",
  184. "devIsInvoice",
  185. "companyTotalPrice",
  186. "personTotalPrice"
  187. ];
  188. const STATUS_COLOR = {
  189. 待审核: "#F56C6C",
  190. 审核拒绝: "#909399",
  191. 对接开发者: "#E6A23C",
  192. 面试中: "#E6A23C",
  193. 确认聘用: "#E6A23C",
  194. 开发中: "#67C23A",
  195. 结束合作: "#909399",
  196. 取消: "#909399"
  197. };
  198. export default {
  199. data() {
  200. return {
  201. uid: "",
  202. // 开发者id
  203. devID: "",
  204. // 企业id
  205. comID: "",
  206. work_time_type: "",
  207. work_time_point: "",
  208. // 工作ID
  209. jobID: "",
  210. // 审核人员id
  211. checkID: "",
  212. checkIdData:[],
  213. unDeposit: false,
  214. presentHire: false,
  215. totalFee: 11,
  216. // 工作状态
  217. statuses: [],
  218. // 职位方向
  219. directions: [],
  220. selectedDirection: "",
  221. selectedStatus: "",
  222. // 数据总条目
  223. totalCount: 0,
  224. currentPage: 1,
  225. // 列表头显示内容
  226. tableHeaders,
  227. // 列表头字段
  228. tableProps,
  229. // 状态颜色
  230. STATUS_COLOR,
  231. // 列表数据
  232. tableData: [],
  233. nums: {}
  234. };
  235. },
  236. watch: {
  237. comID: function(val) {
  238. console.log(val);
  239. }
  240. },
  241. mounted() {
  242. // this.getNums()
  243. this.getJobStatus();
  244. this.getDirection();
  245. this.getCloudJob();
  246. this.getManagers();
  247. },
  248. methods: {
  249. /**
  250. * 获取用户客户经理基本信息
  251. */
  252. getUserManager() {},
  253. columnWidth(item){
  254. if(item==="status") return "80";
  255. if(item==="publish_present_hire") return "80";
  256. return "150";
  257. },
  258. /**
  259. * 获取顶部数据
  260. */
  261. async getNums() {
  262. let res = {
  263. data: {
  264. userinvite: 0,
  265. outsourcecoder: 1,
  266. project_progress: 7,
  267. suggestion: 3,
  268. projectmanage: 581,
  269. hiremanage: "116",
  270. coderverify: "9",
  271. companyverify: "0",
  272. realnameverify: "8",
  273. experience_audit: "4",
  274. take_big_coins_audit: 4,
  275. rooter_notify: 0,
  276. cloudjob: 523,
  277. cloudjobArr: {
  278. all: {
  279. num: 523
  280. },
  281. waitCheckNum: {
  282. status: 2,
  283. num: 170
  284. },
  285. selectDeveloperNum: {
  286. status: 4,
  287. num: 25
  288. },
  289. waitInterviewNum: {
  290. status: 5,
  291. num: 13
  292. },
  293. waitSettNum: {
  294. status: 7,
  295. num: "315"
  296. }
  297. }
  298. },
  299. info: "返回统计数据",
  300. status: "yes"
  301. };
  302. if (res) {
  303. console.log(res.data);
  304. }
  305. },
  306. /**
  307. * 获取主列表数据
  308. */
  309. async getCloudJob() {
  310. let res = await this.$post("/api/admin/job/cloud_job", {
  311. uid: this.uid,
  312. developer_id: this.devID,
  313. uid: this.comID,
  314. checker_id: this.checkID,
  315. job_id: this.jobID,
  316. direction_id: this.selectedDirection,
  317. status: this.selectedStatus,
  318. not_deposit: this.unDeposit ? "1" : "0",
  319. present_hire: this.presentHire ? "1" : "0",
  320. page: this.currentPage
  321. });
  322. if (res) {
  323. this.tableData = [];
  324. const data = res.data.listData;
  325. const list = data.list;
  326. this.tableData = this.formatTableData(list);
  327. this.totalCount = Number(data.total);
  328. this.totalPage = data.totalPage;
  329. }
  330. },
  331. async getManagers() {
  332. let res = await this.$post("/api/admin/accountManager/getManagers");
  333. if (res) {
  334. this. checkIdData= res.data;
  335. }
  336. },
  337. /**
  338. * 获取全部工作方向和ID
  339. */
  340. async getDirection() {
  341. let res = await this.$post("/api/admin/job/get_direction");
  342. if (res) {
  343. this.directions = res.data;
  344. }
  345. },
  346. /**
  347. * 获取云端工作的全部状态以及对应状态的个数
  348. */
  349. async getJobStatus() {
  350. let res = await this.$post("/api/admin/job/getJobStatus");
  351. if (res) {
  352. let numObj = res.data.status_num;
  353. this.nums = numObj;
  354. this.statuses = res.data.status_name.map(name => {
  355. let item = { name };
  356. switch (name) {
  357. case "全部":
  358. item.num = numObj.all.num;
  359. break;
  360. case "对接开发者":
  361. item.num = numObj.selectDeveloperNum.num;
  362. item.color = "#F0F9EB";
  363. break;
  364. case "待审核":
  365. item.num = numObj.waitCheckNum.num;
  366. item.color = "#e1f3d8";
  367. break;
  368. case "面试中":
  369. item.num = numObj.waitInterviewNum.num;
  370. item.color = "#F0F9EB";
  371. break;
  372. case "开发中":
  373. item.num = numObj.waitSettNum.num;
  374. item.color = "#FAECD8";
  375. break;
  376. case "待托管费用":
  377. item.num = numObj.waitPayNum.num;
  378. item.color = "#F0F9EB";
  379. break;
  380. case "确认聘用":
  381. item.num = numObj.interviewOkNum.num;
  382. item.color = "#F0F9EB";
  383. break;
  384. case "面试通过":
  385. item.num = numObj.interviewOkNum.num;
  386. item.color = "#F0F9EB";
  387. break;
  388. case "等待确定工资":
  389. item.num = numObj.interviewOkNum.num;
  390. item.color = "#F0F9EB";
  391. break;
  392. }
  393. return item;
  394. });
  395. }
  396. },
  397. // 筛选框变动
  398. changeSelect(index) {
  399. this.currentPage = 1;
  400. this.getCloudJob(index);
  401. },
  402. // 点击详情
  403. clickDetail(id) {
  404. window.open(`/rooter/cloudjobitem/${id}`);
  405. },
  406. // 根据状态显示图表样式
  407. tableRowClassName({ row, rowIndex }) {
  408. let className;
  409. switch (row.statusName) {
  410. case "待审核":
  411. className = "background: #E1F3D8;";
  412. break;
  413. case "对接开发者":
  414. className = "background: #F0F9EB;";
  415. break;
  416. case "面试中":
  417. className = "background: #F0F9EB;";
  418. break;
  419. case "确认聘用":
  420. className = "background: #F0F9EB;";
  421. break;
  422. case "开发中":
  423. className = "background: #FAECD8;";
  424. break;
  425. case "结束合作":
  426. className = "background: #F4F4F5;";
  427. break;
  428. // case '待托管费用':
  429. // className = 'background: #F0F9EB;'
  430. // break
  431. // case '确认聘用':
  432. // className = 'background: #F0F9EB;'
  433. // break
  434. }
  435. return className;
  436. },
  437. get_work_time_point(work_time_point)
  438. {
  439. if(work_time_point==="1") return "1-3个月";
  440. if(work_time_point==="2") return "3-6个月";
  441. if(work_time_point==="3") return "6个月以上";
  442. if(work_time_point==="0") return "-";
  443. },
  444. get_work_time_type(work_time_type)
  445. {
  446. if(work_time_type==="1") return "全日工作";
  447. if(work_time_type==="2") return "半日工作";
  448. if(work_time_type==="3") return "全日半日都可以";
  449. if(work_time_type==="0") return "-";
  450. },
  451. // 格式化列表数据
  452. formatTableData(data) {
  453. var that=this;
  454. return data.map(i => ({
  455. ...i,
  456. nickname: i.companyUser.nickname,
  457. devNickname: i.developerUser ? i.developerUser.nickname : "",
  458. direction: i.developerUser ? i.developerUser.direction_name : "",
  459. work_time_point:that.get_work_time_point(i.work_time_point),
  460. work_time_type:that.get_work_time_type(i.work_time_type),
  461. workHours:
  462. i.hours === "0"
  463. ? i.workHours
  464. ? i.workHours.name.replace("小时", "")
  465. : ""
  466. : i.hours,
  467. endTime: `每月${i.end_time}号`,
  468. salary:
  469. i.salary !== "0"
  470. ? i.salary
  471. : `${i.match_salary_min}-${i.match_salary_max}`,
  472. sendSalaryTime: `每月${i.send_salary_time}号`,
  473. isNeedProbation: i.is_need_probation === "1" ? i.probation_days : "--",
  474. isInvoice: i.is_invoice === "1" ? "是" : "否",
  475. devIsInvoice: i.dev_is_invoice === "1" ? "是" : "否",
  476. userManagerName: i.user_manager ? i.user_manager.nickname : ""
  477. }));
  478. },
  479. // 页码变动
  480. changePagination(page) {
  481. this.getCloudJob();
  482. },
  483. /**
  484. * 修改未托管
  485. */
  486. changeDeposit(val) {
  487. // console.log(val)
  488. // this.unDeposit = !val
  489. },
  490. /**
  491. * 生成工作周期
  492. */
  493. async createPeriod() {
  494. let res = await this.$post("/api/admin/job/create_period");
  495. if (res) {
  496. this.$message({
  497. message: "生成成功",
  498. type: "success"
  499. });
  500. }
  501. },
  502. /**
  503. * 更新工作周期
  504. */
  505. async finishPeriod() {
  506. let res = await this.$post("/api/admin/job/create_period");
  507. if (res) {
  508. this.$message({
  509. message: "更新成功",
  510. type: "success"
  511. });
  512. }
  513. },
  514. /**
  515. * 结算管理
  516. */
  517. doManager() {
  518. window.open("/main/cloud_balance");
  519. },
  520. clickRow(row) {
  521. let id = row.id;
  522. // 前往老的后台
  523. window.open(
  524. this.$store.state.domainConfig.siteUrl + `/rooter/cloudjobitem/${id}`
  525. );
  526. },
  527. /**
  528. * 点击导出
  529. */
  530. doExport() {
  531. window.open("/api/admin/job/exportJobData");
  532. }
  533. }
  534. };
  535. </script>
  536. <style scoped>
  537. #cloud-job {
  538. width: calc(100% - 144px);
  539. }
  540. .table {
  541. height: calc(100% - 150px);
  542. }
  543. .top {
  544. display: flex;
  545. flex-direction: column;
  546. justify-content: center;
  547. height: 60px;
  548. }
  549. .top-info {
  550. display: flex;
  551. justify-content: space-between;
  552. }
  553. .top-info-right {
  554. color: var(--mainColor);
  555. }
  556. .top-info-right span {
  557. cursor: pointer;
  558. }
  559. .form {
  560. display: flex;
  561. justify-content: space-between;
  562. align-items: center;
  563. margin-bottom: 10px;
  564. }
  565. .form .el-input,
  566. .form .el-select {
  567. width: 120px;
  568. }
  569. .num {
  570. padding: 4px 8px;
  571. }
  572. </style>