cloud_job.vue 11 KB

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