service.vue 2.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798
  1. <template>
  2. <div class="app-container">
  3. <!-- 搜索区域 -->
  4. <div class="filter-container">
  5. <div class="filter-control tip">配置订制化服务功能<span>(以下为设置会员特定的订制服务功能)</span></div>
  6. <div class="filter-control" />
  7. </div>
  8. <!-- 表格区域 -->
  9. <el-table :data="serviceList" border fit height="600" header-row-class-name="tableHeader">
  10. <el-table-column label="序号" type="index" width="80" align="center" />
  11. <el-table-column label="订制需求" prop="title" align="center" />
  12. <el-table-column label="是否配置" align="center" width="120">
  13. <template slot-scope="{ row }">
  14. <el-checkbox v-model="row.checkFlag" :true-label="1" :false-label="0" />
  15. </template>
  16. </el-table-column>
  17. </el-table>
  18. <!-- 确认 取消 -->
  19. <div class="control-box">
  20. <el-button type="warning" @click="navigateBack">返回</el-button>
  21. <el-button type="primary" @click="updateUserMenusConfigure">保存</el-button>
  22. </div>
  23. </div>
  24. </template>
  25. <script>
  26. import { updateUserMenusConfigure, fetchUserMenusConfigure } from '@/api/member'
  27. export default {
  28. name: 'Service',
  29. data() {
  30. return {
  31. authUserId: '',
  32. serviceList: [],
  33. roleIds: []
  34. }
  35. },
  36. created() {
  37. this.authUserId = parseInt(this.$route.query.id)
  38. this.fetchUserMenusConfigure()
  39. },
  40. activated() {
  41. this.authUserId = parseInt(this.$route.query.id)
  42. this.fetchUserMenusConfigure()
  43. },
  44. methods: {
  45. // 修改列表
  46. updateUserMenusConfigure() {
  47. this.roleIds = this.serviceList.filter((item) => item.checkFlag === 1).map((item) => item.roleId)
  48. updateUserMenusConfigure({ roleIds: this.roleIds.join(','), authUserId: this.authUserId })
  49. .then((res) => {
  50. this.$message.success('保存成功')
  51. this.$store.dispatch('tagsView/delView', this.$route)
  52. this.$router.back()
  53. })
  54. .catch((error) => {
  55. console.log(error)
  56. })
  57. },
  58. // 获取列表
  59. fetchUserMenusConfigure() {
  60. fetchUserMenusConfigure({
  61. authUserId: this.authUserId
  62. })
  63. .then((res) => {
  64. this.serviceList = res.data
  65. })
  66. .catch((error) => {
  67. console.log(error)
  68. })
  69. }
  70. }
  71. }
  72. </script>
  73. <style scoped lang="scss">
  74. .app-container {
  75. width: 800px;
  76. margin: 0 auto;
  77. .filter-container {
  78. display: flex;
  79. justify-content: space-between;
  80. align-items: center;
  81. margin-bottom: 16px;
  82. .filter-control {
  83. margin: 0;
  84. }
  85. }
  86. .tip {
  87. font-size: 14px;
  88. span {
  89. color: #f56c6c;
  90. }
  91. }
  92. }
  93. </style>