cloud_job.vue 14 KB

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