Rap 原分销系统代码Web
Ви не можете вибрати більше 25 тем Теми мають розпочинатися з літери або цифри, можуть містити дефіси (-) і не повинні перевищувати 35 символів.

111 рядки
3.2KB

  1. <template>
  2. <div class="app-container">
  3. <!--工具栏-->
  4. <div class="head-container">
  5. <eHeader :dict="dict" :permission="permission" />
  6. <crudOperation :permission="permission" />
  7. </div>
  8. <!--表格渲染-->
  9. <el-table ref="table" v-loading="crud.loading" :data="crud.data" style="width: 100%;" @selection-change="crud.selectionChangeHandler">
  10. <el-table-column type="selection" width="55" />
  11. <el-table-column prop="name" label="名称" />
  12. <el-table-column prop="jobSort" label="排序">
  13. <template slot-scope="scope">
  14. {{ scope.row.jobSort }}
  15. </template>
  16. </el-table-column>
  17. <el-table-column prop="status" label="状态" align="center">
  18. <template slot-scope="scope">
  19. <el-switch
  20. v-model="scope.row.enabled"
  21. active-color="#409EFF"
  22. inactive-color="#F56C6C"
  23. @change="changeEnabled(scope.row, scope.row.enabled)"
  24. />
  25. </template>
  26. </el-table-column>
  27. <el-table-column prop="createTime" label="创建日期" />
  28. <!-- 编辑与删除 -->
  29. <el-table-column
  30. v-if="checkPer(['admin','job:edit','job:del'])"
  31. label="操作"
  32. width="130px"
  33. align="center"
  34. fixed="right"
  35. >
  36. <template slot-scope="scope">
  37. <udOperation
  38. :data="scope.row"
  39. :permission="permission"
  40. />
  41. </template>
  42. </el-table-column>
  43. </el-table>
  44. <!--分页组件-->
  45. <pagination />
  46. <!--表单渲染-->
  47. <eForm :job-status="dict.job_status" />
  48. </div>
  49. </template>
  50. <script>
  51. import crudJob from '@/api/system/job'
  52. import eHeader from './module/header'
  53. import eForm from './module/form'
  54. import CRUD, { presenter } from '@crud/crud'
  55. import crudOperation from '@crud/CRUD.operation'
  56. import pagination from '@crud/Pagination'
  57. import udOperation from '@crud/UD.operation'
  58. export default {
  59. name: 'Job',
  60. components: { eHeader, eForm, crudOperation, pagination, udOperation },
  61. cruds() {
  62. return CRUD({
  63. title: '岗位',
  64. url: 'api/job',
  65. sort: ['jobSort,asc', 'id,desc'],
  66. crudMethod: { ...crudJob }
  67. })
  68. },
  69. mixins: [presenter()],
  70. // 数据字典
  71. dicts: ['job_status'],
  72. data() {
  73. return {
  74. permission: {
  75. add: ['admin', 'job:add'],
  76. edit: ['admin', 'job:edit'],
  77. del: ['admin', 'job:del']
  78. }
  79. }
  80. },
  81. methods: {
  82. // 改变状态
  83. changeEnabled(data, val) {
  84. this.$confirm('此操作将 "' + this.dict.label.job_status[val] + '" ' + data.name + '岗位, 是否继续?', '提示', {
  85. confirmButtonText: '确定',
  86. cancelButtonText: '取消',
  87. type: 'warning'
  88. }).then(() => {
  89. // eslint-disable-next-line no-undef
  90. crudJob.edit(data).then(() => {
  91. // eslint-disable-next-line no-undef
  92. this.crud.notify(this.dict.label.job_status[val] + '成功', 'success')
  93. }).catch(err => {
  94. data.enabled = !data.enabled
  95. console.log(err.data.message)
  96. })
  97. }).catch(() => {
  98. data.enabled = !data.enabled
  99. })
  100. }
  101. }
  102. }
  103. </script>
  104. <style rel="stylesheet/scss" lang="scss" scoped>
  105. ::v-deep .el-input-number .el-input__inner {
  106. text-align: left;
  107. }
  108. </style>