cloud_job.vue 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423
  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"></el-input>
  54. <el-input placeholder="开发者ID"></el-input>
  55. <el-input placeholder="审核人员ID"></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>导出报表</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="10"
  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. const tableProps = [
  129. "id",
  130. "direction",
  131. "nickname",
  132. "devNickname",
  133. "status",
  134. "salary",
  135. "workHours",
  136. "remark_user_from",
  137. "remark_checked_user",
  138. "createTime",
  139. "current_deposit_num",
  140. "next_deposit_num",
  141. "startTime",
  142. "endTime",
  143. "sendSalaryTime",
  144. ]
  145. export default {
  146. data() {
  147. return {
  148. uid: '',
  149. devID: '',
  150. unDeposit: false,
  151. totalFee: 11,
  152. // 工作状态
  153. statuses: [],
  154. // 职位方向
  155. directions: [],
  156. selectedDirection: "",
  157. selectedStatus: "",
  158. // 数据总条目
  159. totalCount: 0,
  160. currentPage: 1,
  161. // 列表头显示内容
  162. tableHeaders,
  163. // 列表头字段
  164. tableProps,
  165. // 列表数据
  166. tableData: [],
  167. nums: {},
  168. }
  169. },
  170. mounted() {
  171. // this.getNums()
  172. this.getJobStatus()
  173. this.getDirection()
  174. this.getCloudJob()
  175. },
  176. methods: {
  177. /**
  178. * 获取顶部数据
  179. */
  180. async getNums() {
  181. let res = {
  182. "data": {
  183. "userinvite": 0,
  184. "outsourcecoder": 1,
  185. "project_progress": 7,
  186. "suggestion": 3,
  187. "projectmanage": 581,
  188. "hiremanage": "116",
  189. "coderverify": "9",
  190. "companyverify": "0",
  191. "realnameverify": "8",
  192. "experience_audit": "4",
  193. "take_big_coins_audit": 4,
  194. "rooter_notify": 0,
  195. "cloudjob": 523,
  196. "cloudjobArr": {
  197. "all": {
  198. "num": 523
  199. },
  200. "waitCheckNum": {
  201. "status": 2,
  202. "num": 170
  203. },
  204. "selectDeveloperNum": {
  205. "status": 4,
  206. "num": 25
  207. },
  208. "waitInterviewNum": {
  209. "status": 5,
  210. "num": 13
  211. },
  212. "waitSettNum": {
  213. "status": 7,
  214. "num": "315"
  215. }
  216. }
  217. },
  218. "info": "返回统计数据",
  219. "status": "yes"
  220. }// await this.$post('https://dev.test.proginn.com/rooter/ajaxrooternums')
  221. if(res) {
  222. console.log(res.data)
  223. }
  224. },
  225. /**
  226. * 获取主列表数据
  227. */
  228. async getCloudJob() {
  229. let res = await this.$post('/api/admin/job/cloud_job', {
  230. uid: this.uid,
  231. developer_id: this.devID,
  232. direction_id: this.selectedDirection,
  233. status: this.selectedStatus,
  234. not_deposit: this.unDeposit ? '1' : '0',
  235. page: this.currentPage,
  236. })
  237. if(res) {
  238. this.tableData = []
  239. const data = res.data.listData
  240. const list = data.list
  241. this.tableData = this.formatTableData(list)
  242. this.totalCount = Number(data.total)
  243. this.totalPage = data.totalPage
  244. }
  245. },
  246. /**
  247. * 获取全部工作方向和ID
  248. */
  249. async getDirection() {
  250. let res = await this.$post('/api/admin/job/get_direction')
  251. if(res) {
  252. this.directions = res.data
  253. }
  254. },
  255. /**
  256. * 获取云端工作的全部状态以及对应状态的个数
  257. */
  258. async getJobStatus() {
  259. let res = await this.$post('/api/admin/job/getJobStatus')
  260. if(res) {
  261. let numObj = res.data.status_num
  262. this.nums = numObj
  263. this.statuses = res.data.status_name.map(name => {
  264. let item = { name }
  265. if(name === '全部') item.num = numObj.all.num
  266. else if(name === '对接开发者') {
  267. item.num = numObj.selectDeveloperNum.num
  268. item.color = '#F0F9EB'
  269. }
  270. else if(name === '待审核') {
  271. item.num = numObj.waitCheckNum.num
  272. item.color = '#e1f3d8'
  273. }
  274. else if(name === '面试中') {
  275. item.num = numObj.waitInterviewNum.num
  276. item.color = '#F0F9EB'
  277. }
  278. else if(name === '开发中') {
  279. item.num = numObj.waitSettNum.num
  280. item.color = '#FAECD8'
  281. }
  282. return item
  283. })
  284. }
  285. },
  286. // 筛选框变动
  287. changeSelect(index) {
  288. this.currentPage = 1
  289. this.getCloudJob(index)
  290. },
  291. // 点击详情
  292. clickDetail(id) {
  293. window.open(`/rooter/cloudjobitem/${id}`)
  294. },
  295. // 根据状态显示图表样式
  296. tableRowClassName({ row, rowIndex }) {
  297. console.log({row, rowIndex})
  298. // let className = ""
  299. // if(row.status === "1") className = "success-row"
  300. // return className
  301. let className
  302. switch(row.statusName) {
  303. case '审核中':
  304. className = 'background: #E1F3D8;'
  305. break
  306. case '对接开发者':
  307. className = 'background: #F0F9EB;'
  308. break
  309. case '面试中':
  310. className = 'background: #F0F9EB;'
  311. break
  312. case '确认聘用':
  313. className = 'background: #F0F9EB;'
  314. break
  315. case '开发中':
  316. className = 'background: #FAECD8;'
  317. break
  318. case '结束合作':
  319. className = 'background: #F4F4F5;'
  320. break
  321. }
  322. return className
  323. },
  324. // 格式化列表数据
  325. formatTableData(data) {
  326. return data.map(i => ({
  327. ...i,
  328. nickname: i.companyUser.nickname,
  329. devNickname: i.developerUser ? i.developerUser.nickname : '',
  330. direction: i.developerUser ? i.developerUser.direction_name : '',
  331. workHours: i.workHours ? i.workHours.name : '',
  332. endTime: `每月${i.end_time}号`,
  333. sendSalaryTime: `每月${i.send_salary_time}号`,
  334. }))
  335. },
  336. // 页码变动
  337. changePagination(page) {
  338. this.getCloudJob()
  339. },
  340. /**
  341. * 修改未托管
  342. */
  343. changeDeposit(val) {
  344. // console.log(val)
  345. // this.unDeposit = !val
  346. },
  347. /**
  348. * 生成工作周期
  349. */
  350. async createPeriod() {
  351. let res = await this.$post('/api/admin/job/create_period')
  352. if(res) {
  353. this.$message({
  354. message: '生成成功',
  355. type: 'success'
  356. })
  357. }
  358. },
  359. /**
  360. * 更新工作周期
  361. */
  362. async finishPeriod() {
  363. let res = await this.$post('/api/admin/job/create_period')
  364. if(res) {
  365. this.$message({
  366. message: '更新成功',
  367. type: 'success'
  368. })
  369. }
  370. },
  371. /**
  372. * 结算管理
  373. */
  374. doManager() {
  375. window.open('/main/cloud_balance')
  376. },
  377. clickRow(row) {
  378. window.open('htpps://www.proginn.com/rooter/cloudjobitem/1347')
  379. }
  380. }
  381. }
  382. </script>
  383. <style scoped>
  384. #cloud-job {
  385. width: calc(100% - 144px);
  386. }
  387. .table {
  388. height: calc(100% - 150px);
  389. }
  390. .top {
  391. display: flex;
  392. flex-direction: column;
  393. justify-content: center;
  394. height: 60px;
  395. }
  396. .top-info {
  397. display: flex;
  398. justify-content: space-between;
  399. }
  400. .top-info-right {
  401. color: var(--mainColor);
  402. }
  403. .top-info-right span {
  404. cursor: pointer;
  405. }
  406. .form {
  407. display: flex;
  408. justify-content: space-between;
  409. align-items: center;
  410. margin-bottom: 10px;
  411. }
  412. .form .el-input,
  413. .form .el-select {
  414. width: 120px;
  415. }
  416. .num {
  417. padding: 4px 8px;
  418. }
  419. </style>