cloud_job.vue 12 KB

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