cloud_job.vue 13 KB

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