cloud_job.vue 8.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352
  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>{{totalFee}}</b>
  10. </span>
  11. <span>
  12. 对接面试中:
  13. <b>{{totalFee}}</b>
  14. </span>
  15. <span>
  16. 待托管费用:
  17. <b>{{totalFee}}</b>
  18. </span>
  19. <span>
  20. 开发中:
  21. <b>{{totalFee}}</b>
  22. </span>
  23. </div>
  24. <div class="top-info-right">
  25. <span>生成20天内的账单</span>
  26. <span>生成待结薪的账单</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></el-checkbox>本期未托管
  57. <el-button @change="changeSelect">筛选</el-button>
  58. </div>
  59. <div class="right">
  60. <el-button>结算管理</el-button>
  61. <el-button>导出报表</el-button>
  62. </div>
  63. </div>
  64. <div class="table">
  65. <el-table
  66. v-if="tableData.length"
  67. height="100%"
  68. border
  69. style="width: 100%"
  70. :data="tableData"
  71. :row-class-name="tableRowClassName"
  72. >
  73. <el-table-column
  74. v-for="(prop, index) of tableProps"
  75. :key="index"
  76. :prop="prop"
  77. :label="tableHeaders[index]"
  78. >
  79. <template slot-scope="scope">
  80. <el-button
  81. type="text"
  82. v-if="prop === 'ctrl'"
  83. @click="clickDetail(scope.row['id'])"
  84. >{{scope.row[prop]}}</el-button>
  85. <span v-else-if="prop === 'status'">{{scope.row['statusName']}}</span>
  86. <span v-else>{{scope.row[prop]}}</span>
  87. </template>
  88. </el-table-column>
  89. </el-table>
  90. </div>
  91. <el-pagination
  92. @current-change="changePagination"
  93. :current-page.sync="currentPage"
  94. :page-size="10"
  95. layout="total, prev, pager, next"
  96. :total="totalCount"
  97. ></el-pagination>
  98. </div>
  99. </template>
  100. <script>
  101. const tableHeaders = [
  102. "工作ID",
  103. "方向",
  104. "企业方",
  105. "开发者",
  106. "状态",
  107. "基本薪资",
  108. "每周工时",
  109. "用户来源",
  110. "审核人员",
  111. "发布时间",
  112. "本期托管",
  113. "下期托管",
  114. "开始时间",
  115. "结薪时间",
  116. "发薪时间",
  117. "试用期",
  118. "开票",
  119. "纳税",
  120. "企业方费用",
  121. "开发者工资",
  122. ]
  123. const tableProps = [
  124. "id",
  125. "direction",
  126. "nickname",
  127. "devNickname",
  128. "status",
  129. "salary",
  130. "workHours",
  131. "remark_user_from",
  132. "remark_checked_user",
  133. "createTime",
  134. "createTime",
  135. "createTime",
  136. "start_time",
  137. "end_time",
  138. "send_salary_time",
  139. ]
  140. export default {
  141. data() {
  142. return {
  143. totalFee: 11,
  144. // 工作状态
  145. statuses: [],
  146. // 职位方向
  147. directions: [],
  148. selectedDirection: "",
  149. selectedStatus: "",
  150. // 数据总条目
  151. totalCount: 0,
  152. currentPage: 1,
  153. // 列表头显示内容
  154. tableHeaders,
  155. // 列表头字段
  156. tableProps,
  157. // 列表数据
  158. tableData: []
  159. }
  160. },
  161. mounted() {
  162. // this.getNums()
  163. this.getJobStatus()
  164. this.getDirection()
  165. this.getCloudJob()
  166. },
  167. methods: {
  168. /**
  169. * 获取顶部数据
  170. */
  171. async getNums() {
  172. let res = {
  173. "data": {
  174. "userinvite": 0,
  175. "outsourcecoder": 1,
  176. "project_progress": 7,
  177. "suggestion": 3,
  178. "projectmanage": 581,
  179. "hiremanage": "116",
  180. "coderverify": "9",
  181. "companyverify": "0",
  182. "realnameverify": "8",
  183. "experience_audit": "4",
  184. "take_big_coins_audit": 4,
  185. "rooter_notify": 0,
  186. "cloudjob": 523,
  187. "cloudjobArr": {
  188. "all": {
  189. "num": 523
  190. },
  191. "waitCheckNum": {
  192. "status": 2,
  193. "num": 170
  194. },
  195. "selectDeveloperNum": {
  196. "status": 4,
  197. "num": 25
  198. },
  199. "waitInterviewNum": {
  200. "status": 5,
  201. "num": 13
  202. },
  203. "waitSettNum": {
  204. "status": 7,
  205. "num": "315"
  206. }
  207. }
  208. },
  209. "info": "返回统计数据",
  210. "status": "yes"
  211. }// await this.$post('https://dev.test.proginn.com/rooter/ajaxrooternums')
  212. if(res) {
  213. console.log(res.data)
  214. }
  215. },
  216. /**
  217. * 获取主列表数据
  218. */
  219. async getCloudJob() {
  220. let res = await this.$post('/api/admin/job/cloud_job')
  221. // let res = await this.$post('/api/admin/job/cloud_job', {
  222. // uid: '企业方ID',
  223. // developer_id: '开发者ID',
  224. // direction_id: '方向ID',
  225. // status: '状态',
  226. // not_deposit: '本期未托管,选中则为1',
  227. // page: '页数',
  228. // })
  229. if(res) {
  230. this.tableData = []
  231. const p = this.currentPage
  232. const res = await this.$post("/api/admin/job/jobs", { p, status })
  233. // console.log(res)
  234. const data = res.data
  235. const list = data.list
  236. this.tableData = this.formatTableData(list)
  237. this.totalCount = Number(data.total)
  238. this.totalPage = data.totalPage
  239. }
  240. },
  241. /**
  242. * 获取全部工作方向和ID
  243. */
  244. async getDirection() {
  245. let res = await this.$post('/api/admin/job/get_direction')
  246. if(res) {
  247. this.directions = res.data
  248. }
  249. },
  250. /**
  251. * 获取云端工作的全部状态以及对应状态的个数
  252. */
  253. async getJobStatus() {
  254. let res = await this.$post('/api/admin/job/getJobStatus')
  255. if(res) {
  256. let numObj = res.data.status_num
  257. this.statuses = res.data.status_name.map(name => {
  258. let item = { name }
  259. if(name === '全部') item.num = numObj.all.num
  260. else if(name === '对接开发者') {
  261. item.num = numObj.selectDeveloperNum.num
  262. item.color = '#F0F9EB'
  263. }
  264. else if(name === '待审核') {
  265. item.num = numObj.waitCheckNum.num
  266. item.color = '#e1f3d8'
  267. }
  268. else if(name === '面试中') {
  269. item.num = numObj.waitInterviewNum.num
  270. item.color = '#F0F9EB'
  271. }
  272. else if(name === '开发中') {
  273. item.num = numObj.waitSettNum.num
  274. item.color = '#FAECD8'
  275. }
  276. return item
  277. })
  278. console.log(this.statuses)
  279. }
  280. },
  281. // 筛选框变动
  282. changeSelect(index) {
  283. this.currentPage = 1
  284. this.getTableData(index)
  285. },
  286. // 点击详情
  287. clickDetail(id) {
  288. window.open(`/rooter/cloudjobitem/${id}`)
  289. },
  290. // 根据状态显示图表样式
  291. tableRowClassName({ row, rowIndex }) {
  292. // console.log({row, rowIndex})
  293. let className = ""
  294. if(row.status === "1") className = "success-row"
  295. return className
  296. },
  297. // 格式化列表数据
  298. formatTableData(data) {
  299. return data.map(i => ({
  300. ...i,
  301. nickname: i.companyUser.nickname,
  302. devNickname: i.developerUser ? i.developerUser.nickname : '',
  303. direction: i.developerUser ? i.developerUser.direction_name : '',
  304. workHours: i.workHours ? i.workHours.name : ''
  305. }))
  306. },
  307. // 页码变动
  308. changePagination(page) {
  309. this.getTableData()
  310. },
  311. }
  312. }
  313. </script>
  314. <style scoped>
  315. .table {
  316. height: 100%;
  317. height: calc(100% - 80px);
  318. }
  319. .top {
  320. display: flex;
  321. flex-direction: column;
  322. justify-content: center;
  323. height: 60px;
  324. }
  325. .top-info {
  326. display: flex;
  327. justify-content: space-between;
  328. }
  329. .top-info-right {
  330. color: var(--mainColor);
  331. }
  332. .top-info-right span {
  333. cursor: pointer;
  334. }
  335. .form {
  336. display: flex;
  337. justify-content: space-between;
  338. align-items: center;
  339. }
  340. .form .el-input,
  341. .form .el-select {
  342. width: 120px;
  343. }
  344. .num {
  345. padding: 4px 8px;
  346. }
  347. </style>