|
@@ -2,7 +2,7 @@
|
|
|
<div class="m-container">
|
|
|
<h2>
|
|
|
<div class="squrt"></div>
|
|
|
- 会员设置
|
|
|
+ 学练宝设置
|
|
|
</h2>
|
|
|
<div class="m-core">
|
|
|
<save-form
|
|
@@ -14,16 +14,34 @@
|
|
|
:model.sync="searchForm"
|
|
|
>
|
|
|
<!-- 状态 指导老师 活动方案-->
|
|
|
- <el-form-item>
|
|
|
+ <el-form-item prop="name">
|
|
|
+ <el-input
|
|
|
+ v-model.trim="searchForm.name"
|
|
|
+ clearable
|
|
|
+ placeholder="学练宝名称"
|
|
|
+ ></el-input>
|
|
|
+ </el-form-item>
|
|
|
+ <el-form-item prop="createTimer">
|
|
|
+ <el-date-picker
|
|
|
+ v-model.trim="searchForm.createTimer"
|
|
|
+ type="daterange"
|
|
|
+ value-format="yyyy-MM-dd"
|
|
|
+ range-separator="至"
|
|
|
+ start-placeholder="更新开始时间"
|
|
|
+ end-placeholder="更新结束时间"
|
|
|
+ :picker-options="{ firstDayOfWeek: 1 }"
|
|
|
+ ></el-date-picker>
|
|
|
+ </el-form-item>
|
|
|
+ <el-form-item prop="updateName">
|
|
|
<el-input
|
|
|
- v-model.trim="searchForm.search"
|
|
|
+ v-model.trim="searchForm.updateName"
|
|
|
clearable
|
|
|
- placeholder="会员名称"
|
|
|
+ placeholder="更新人"
|
|
|
></el-input>
|
|
|
</el-form-item>
|
|
|
<el-form-item>
|
|
|
<el-button native-type="submit" type="danger">搜索</el-button>
|
|
|
- <!-- <el-button native-type="reset" type="primary">重置</el-button> -->
|
|
|
+ <el-button native-type="reset" type="primary">重置</el-button>
|
|
|
</el-form-item>
|
|
|
</save-form>
|
|
|
<el-button
|
|
@@ -31,56 +49,44 @@
|
|
|
style="margin-bottom: 20px"
|
|
|
v-permission="'memberRankSetting/add'"
|
|
|
@click="addLeave"
|
|
|
- >新增会员等级</el-button
|
|
|
+ >新增</el-button
|
|
|
>
|
|
|
<el-table
|
|
|
:data="tableList"
|
|
|
:header-cell-style="{ background: '#EDEEF0', color: '#444' }"
|
|
|
+ row-key="id"
|
|
|
+ :tree-props="{ children: 'children', hasChildren: 'hasChildren' }"
|
|
|
>
|
|
|
- <el-table-column
|
|
|
- align="center"
|
|
|
- prop="name"
|
|
|
- label="会员名称"
|
|
|
- ></el-table-column>
|
|
|
- <el-table-column align="center" prop="type" label="会员标识">
|
|
|
- <template slot-scope="scope">
|
|
|
- <el-image
|
|
|
- style="width: 100px; height: 100px"
|
|
|
- :src="scope.row.icon"
|
|
|
- :preview-src-list="[scope.row.icon]"
|
|
|
- >
|
|
|
- </el-image>
|
|
|
- </template>
|
|
|
- </el-table-column>
|
|
|
- <el-table-column align="center" prop="type" label="试用会员标识">
|
|
|
+ <el-table-column prop="name" label="学练宝名称"></el-table-column>
|
|
|
+
|
|
|
+ <el-table-column align="center" prop="intro" label="学练宝介绍">
|
|
|
<template slot-scope="scope">
|
|
|
- <el-image
|
|
|
- style="width: 100px; height: 100px"
|
|
|
- :src="scope.row.experienceIcon"
|
|
|
- :preview-src-list="[scope.row.experienceIcon]"
|
|
|
- >
|
|
|
- </el-image>
|
|
|
+ <tooltip :content="scope.row.intro" />
|
|
|
</template>
|
|
|
</el-table-column>
|
|
|
- <!-- <el-table-column
|
|
|
+ <el-table-column
|
|
|
align="center"
|
|
|
- prop="type"
|
|
|
- label="是否新用户试用"
|
|
|
- ></el-table-column> -->
|
|
|
+ prop="musicCount"
|
|
|
+ label="曲目数量"
|
|
|
+ ></el-table-column>
|
|
|
<el-table-column
|
|
|
align="center"
|
|
|
prop="updateTime"
|
|
|
- width="100px"
|
|
|
- label="修改时间"
|
|
|
+ label="更新时间"
|
|
|
></el-table-column>
|
|
|
<el-table-column
|
|
|
align="center"
|
|
|
prop="operatorName"
|
|
|
- label="修改人"
|
|
|
+ label="更新人"
|
|
|
></el-table-column>
|
|
|
<el-table-column align="center" label="操作">
|
|
|
<template slot-scope="scope">
|
|
|
<div>
|
|
|
+ <auth auths="memberRankSetting/get">
|
|
|
+ <el-button v-if="scope.row.parentId <= 0" type="text" @click="addLeave(scope.row)"
|
|
|
+ >添加子版本</el-button
|
|
|
+ >
|
|
|
+ </auth>
|
|
|
<!-- memberRankSetting/add -->
|
|
|
<auth auths="memberRankSetting/get">
|
|
|
<el-button type="text" @click="resetMember(scope.row)"
|
|
@@ -95,11 +101,15 @@
|
|
|
>修改</el-button
|
|
|
>
|
|
|
</auth>
|
|
|
+
|
|
|
+ <el-button type="text" @click="removeMember(scope.row)"
|
|
|
+ >删除</el-button
|
|
|
+ >
|
|
|
</div>
|
|
|
</template>
|
|
|
</el-table-column>
|
|
|
</el-table>
|
|
|
- <pagination
|
|
|
+ <!-- <pagination
|
|
|
save-key="memberSet"
|
|
|
:total.sync="rules.total"
|
|
|
sync
|
|
@@ -107,7 +117,7 @@
|
|
|
:limit.sync="rules.limit"
|
|
|
:page-sizes="rules.page_size"
|
|
|
@pagination="getList"
|
|
|
- />
|
|
|
+ /> -->
|
|
|
</div>
|
|
|
<el-dialog
|
|
|
:title="title"
|
|
@@ -120,33 +130,45 @@
|
|
|
>
|
|
|
<el-form :model="form" :inline="true" ref="ruleForm">
|
|
|
<el-alert
|
|
|
- title="会员信息"
|
|
|
+ title="学练宝信息"
|
|
|
type="info"
|
|
|
:closable="false"
|
|
|
style="margin-bottom: 20px"
|
|
|
>
|
|
|
</el-alert>
|
|
|
-
|
|
|
<el-form-item
|
|
|
- label="会员名称"
|
|
|
+ label="父级"
|
|
|
+ prop="parentName"
|
|
|
+ v-if="form.parentId"
|
|
|
+ :label-width="formLabelWidth"
|
|
|
+ >
|
|
|
+ <el-input
|
|
|
+ :disabled="true"
|
|
|
+ v-model.trim="form.parentName"
|
|
|
+ style="width: 620px"
|
|
|
+ ></el-input>
|
|
|
+ </el-form-item>
|
|
|
+ <el-form-item
|
|
|
+ label="学练宝名称"
|
|
|
prop="name"
|
|
|
:label-width="formLabelWidth"
|
|
|
- :rules="[{ required: true, message: '请输入会员名称' }]"
|
|
|
+ :rules="[{ required: true, message: '请输入学练宝名称' }]"
|
|
|
>
|
|
|
<el-input
|
|
|
:disabled="addDisabled"
|
|
|
v-model.trim="form.name"
|
|
|
autocomplete="off"
|
|
|
style="width: 620px"
|
|
|
- maxlength="10"
|
|
|
+ maxlength="15"
|
|
|
show-word-limit
|
|
|
+ placeholder="请输入学练宝名称"
|
|
|
></el-input>
|
|
|
</el-form-item>
|
|
|
<el-form-item
|
|
|
- label="会员介绍"
|
|
|
+ label="学练宝介绍"
|
|
|
prop="intro"
|
|
|
:label-width="formLabelWidth"
|
|
|
- :rules="[{ required: true, message: '请输入会员介绍' }]"
|
|
|
+ :rules="[{ required: true, message: '请输入学练宝介绍' }]"
|
|
|
>
|
|
|
<el-input
|
|
|
maxlength="200"
|
|
@@ -157,97 +179,91 @@
|
|
|
type="textarea"
|
|
|
:rows="5"
|
|
|
style="width: 620px"
|
|
|
+ placeholder="请输入学练宝介绍"
|
|
|
></el-input>
|
|
|
</el-form-item>
|
|
|
- <el-form-item
|
|
|
- label="会员标识"
|
|
|
- prop="icon"
|
|
|
- :label-width="formLabelWidth"
|
|
|
- :rules="[{ required: true, message: '请上传会员标识' }]"
|
|
|
- >
|
|
|
- <!-- <upload
|
|
|
- v-if="!addDisabled"
|
|
|
- v-model="form.icon"
|
|
|
- :imageWidthM="200"
|
|
|
- :disabled="addDisabled"
|
|
|
- :imageHeightM="200"
|
|
|
- ></upload>
|
|
|
- <img v-else :src="form.icon" alt="" width="120px" height="120px" /> -->
|
|
|
- <image-cropper :options="cropperOptions" :disabled="addDisabled" :imgSize="2" :imageUrl="form.icon" @crop-upload-success="cropSuccess2" />
|
|
|
- <!-- <p style="color: red" v-if="!addDisabled">
|
|
|
- 请上传200*200像素,大小2M以内,格式为jpg、png、gif图片
|
|
|
- </p> -->
|
|
|
- </el-form-item>
|
|
|
- <br>
|
|
|
- <el-form-item
|
|
|
- label="试用会员标识"
|
|
|
- prop="experienceIcon"
|
|
|
- :label-width="formLabelWidth"
|
|
|
- :rules="[{ required: true, message: '请上传试用会员标识' }]"
|
|
|
- >
|
|
|
- <!-- <upload
|
|
|
- v-if="!addDisabled"
|
|
|
- v-model="form.experienceIcon"
|
|
|
- :imageWidthM="200"
|
|
|
- :disabled="addDisabled"
|
|
|
- :imageHeightM="200"
|
|
|
- ></upload> -->
|
|
|
- <image-cropper :options="cropperOptions" :disabled="addDisabled" :imgSize="2" :imageUrl="form.experienceIcon" @crop-upload-success="cropSuccess" />
|
|
|
- <!-- <img v-else :src="form.experienceIcon" alt="" width="120px" height="120px" /> -->
|
|
|
- <p style="color: red" v-if="!addDisabled">
|
|
|
- 请上传大小2M以内,格式为jpg、png、gif图片
|
|
|
- </p>
|
|
|
- </el-form-item>
|
|
|
- <!-- <br />
|
|
|
- <el-form-item
|
|
|
- label="是否新用户试用"
|
|
|
- prop="name"
|
|
|
- :label-width="formLabelWidth"
|
|
|
- >
|
|
|
- <el-select
|
|
|
- v-model.trim="form.isProbationPeriod"
|
|
|
- clearable
|
|
|
- filterable
|
|
|
- placeholder="请选择是否试用"
|
|
|
- >
|
|
|
- <el-option label="是" :value="true"></el-option>
|
|
|
- <el-option label="否" :value="false"></el-option>
|
|
|
- </el-select>
|
|
|
- </el-form-item>
|
|
|
- <el-form-item
|
|
|
- label="试用期限"
|
|
|
- prop="name"
|
|
|
- :label-width="formLabelWidth"
|
|
|
- >
|
|
|
- <el-input
|
|
|
- style="width: 200px"
|
|
|
- v-model.trim="form.name"
|
|
|
- autocomplete="off"
|
|
|
- >
|
|
|
- <template slot="append">天</template>
|
|
|
- </el-input>
|
|
|
- </el-form-item> -->
|
|
|
+
|
|
|
<el-alert
|
|
|
- title="会员权益"
|
|
|
+ title="学练宝权益"
|
|
|
type="info"
|
|
|
:closable="false"
|
|
|
style="margin-bottom: 20px"
|
|
|
>
|
|
|
</el-alert>
|
|
|
- <el-form-item :label="searchName" :label-width="formLabelWidth">
|
|
|
+ <el-form-item label="搜索:" :label-width="formLabelWidth">
|
|
|
<el-input
|
|
|
style="width: 210px"
|
|
|
- v-model.trim="seachRoleValue"
|
|
|
+ v-model.trim="searchRoleValue"
|
|
|
+ placeholder="请输入搜索内容"
|
|
|
></el-input>
|
|
|
- <el-button style="margin-left: 10px" type="danger" @click="seachRoles"
|
|
|
+ <el-button
|
|
|
+ style="margin-left: 10px"
|
|
|
+ type="danger"
|
|
|
+ @click="searchRoles"
|
|
|
>搜索</el-button
|
|
|
>
|
|
|
<el-button type="primary" @click="onReSetRole">重置</el-button>
|
|
|
</el-form-item>
|
|
|
<br />
|
|
|
- <el-form-item label="会员功能" :label-width="formLabelWidth">
|
|
|
+ <el-form-item label="学练宝内容" :label-width="formLabelWidth">
|
|
|
<el-checkbox
|
|
|
+ :disabled="addDisabled || this.buyFlag && pageType === 'update'"
|
|
|
+ :indeterminate="isMemberIndeterminate"
|
|
|
+ @change="onCheckMemberAll"
|
|
|
+ v-model.trim="memberCheckAll"
|
|
|
+ >全选</el-checkbox
|
|
|
+ >
|
|
|
+ <div>
|
|
|
+ <el-tree
|
|
|
+ class="tree"
|
|
|
+ :data="treeMemberData"
|
|
|
+ show-checkbox
|
|
|
+ node-key="id"
|
|
|
+ @check="onTreeMemberCheck"
|
|
|
+ :filter-node-method="filterNode"
|
|
|
+ ref="memberTrees"
|
|
|
+ highlight-current
|
|
|
+ :default-checked-keys="memberCheckList"
|
|
|
+ :props="defaultProps"
|
|
|
+ >
|
|
|
+ <div slot-scope="{ node, data }">
|
|
|
+ {{ node.label }}
|
|
|
+ </div>
|
|
|
+ </el-tree>
|
|
|
+ </div>
|
|
|
+ </el-form-item>
|
|
|
+
|
|
|
+ <el-form-item label="学练宝内容2" :label-width="formLabelWidth">
|
|
|
+ <!-- <el-checkbox
|
|
|
:disabled="addDisabled"
|
|
|
+ :indeterminate="isMemberIndeterminate"
|
|
|
+ @change="onCheckMemberAll"
|
|
|
+ v-model.trim="memberCheckAll"
|
|
|
+ >全选</el-checkbox
|
|
|
+ > -->
|
|
|
+ <div style="padding-top: 5px;">
|
|
|
+ <el-tree
|
|
|
+ class="tree"
|
|
|
+ :data="treeClassData"
|
|
|
+ show-checkbox
|
|
|
+ node-key="id"
|
|
|
+ @check="onTreeClassCheck"
|
|
|
+ :filter-node-method="filterNode"
|
|
|
+ ref="classTrees"
|
|
|
+ highlight-current
|
|
|
+ :default-checked-keys="classCheckList"
|
|
|
+ :props="defaultProps"
|
|
|
+ >
|
|
|
+ <div slot-scope="{ node, data }">
|
|
|
+ {{ node.label }}
|
|
|
+ </div>
|
|
|
+ </el-tree>
|
|
|
+ </div>
|
|
|
+ </el-form-item>
|
|
|
+
|
|
|
+ <el-form-item label="学练宝功能" :label-width="formLabelWidth">
|
|
|
+ <el-checkbox
|
|
|
+ :disabled="addDisabled || this.buyFlag && pageType === 'update'"
|
|
|
:indeterminate="isIndeterminate"
|
|
|
@change="onCheckAll"
|
|
|
v-model.trim="checkAll"
|
|
@@ -259,9 +275,9 @@
|
|
|
:data="treeData"
|
|
|
show-checkbox
|
|
|
node-key="id"
|
|
|
+ ref="trees"
|
|
|
@check="onTreeCheck"
|
|
|
:filter-node-method="filterNode"
|
|
|
- ref="trees"
|
|
|
highlight-current
|
|
|
:default-checked-keys="checkList"
|
|
|
:props="defaultProps"
|
|
@@ -280,73 +296,84 @@
|
|
|
<el-button @click="onSubmit" type="primary">确 定</el-button>
|
|
|
</span>
|
|
|
</el-dialog>
|
|
|
-
|
|
|
</div>
|
|
|
</template>
|
|
|
<script>
|
|
|
import pagination from "@/components/Pagination/index";
|
|
|
import Upload from "@/components/Upload/index";
|
|
|
-import ImageCropper from '@/components/ImageCropper'
|
|
|
+import ImageCropper from "@/components/ImageCropper";
|
|
|
+import Tooltip from "@/components/Tooltip/index";
|
|
|
import {
|
|
|
addMemberRank,
|
|
|
getmemberRankList,
|
|
|
getmemberRankDetail,
|
|
|
resetMemberRank,
|
|
|
+ api_memberRankCategoryTree,
|
|
|
+ api_memberRankDel
|
|
|
} from "./api";
|
|
|
+import { getTimeFormat } from "@/utils";
|
|
|
import { getMemberPrivilegesItem } from "@/views/dictionaryManager/api";
|
|
|
export default {
|
|
|
- components: { pagination, Upload, ImageCropper },
|
|
|
+ components: { pagination, Upload, ImageCropper, Tooltip },
|
|
|
name: "memberSet",
|
|
|
data() {
|
|
|
return {
|
|
|
formLabelWidth: "120px",
|
|
|
searchForm: {
|
|
|
- search: null,
|
|
|
+ name: null,
|
|
|
+ updateName: null,
|
|
|
+ createTimer: []
|
|
|
},
|
|
|
rules: {
|
|
|
// 分页规则
|
|
|
limit: 10, // 限制显示条数
|
|
|
page: 1, // 当前页
|
|
|
total: 0, // 总条数
|
|
|
- page_size: [10, 20, 40, 50], // 选择限制显示条数
|
|
|
+ page_size: [10, 20, 40, 50] // 选择限制显示条数
|
|
|
},
|
|
|
tableList: [],
|
|
|
title: "新增会员等级",
|
|
|
branchStatus: false,
|
|
|
form: {
|
|
|
- name: "",
|
|
|
- icon: "",
|
|
|
- into: "",
|
|
|
- experienceIcon:'',
|
|
|
+ name: null,
|
|
|
+ intro: null,
|
|
|
+ memberCategoryIdList: [],
|
|
|
+ memberCourseTypeList: [],
|
|
|
+ memberPrivilegesItemIdList: []
|
|
|
},
|
|
|
+ buyFlag: false, // 是否购买
|
|
|
addDisabled: false,
|
|
|
checkAll: false,
|
|
|
isIndeterminate: false,
|
|
|
+ memberCheckAll: false,
|
|
|
+ isMemberIndeterminate: false,
|
|
|
treeData: [],
|
|
|
+ treeMemberData: [],
|
|
|
+ treeClassData: [],
|
|
|
defaultProps: {
|
|
|
children: "children",
|
|
|
label: "label",
|
|
|
- disabled: this.addDisabled,
|
|
|
+ disabled: this.addDisabled
|
|
|
},
|
|
|
result: {
|
|
|
roleName: null,
|
|
|
- roleDesc: null,
|
|
|
+ roleDesc: null
|
|
|
},
|
|
|
- seachRoleValue: "",
|
|
|
+ classList: [],
|
|
|
+ classCount: 0,
|
|
|
+ memberRankList: [],
|
|
|
+ memberRankCount: 0,
|
|
|
+ searchRoleValue: "",
|
|
|
silderList: [],
|
|
|
slideCount: 0,
|
|
|
pageType: "",
|
|
|
allChildIds: [],
|
|
|
+ allMemberChildIds: [],
|
|
|
+ allClassChildIds: [],
|
|
|
checkList: [],
|
|
|
- searchName: "搜索\xa0\xa0\xa0\xa0\xa0\xa0\xa0",
|
|
|
- cropperOptions: {
|
|
|
- autoCrop: true, //是否默认生成截图框
|
|
|
- autoCropWidth: 200, //默认生成截图框宽度
|
|
|
- autoCropHeight: 200, //默认生成截图框高度
|
|
|
- fixedBox: true, //是否固定截图框大小 不允许改变
|
|
|
- previewsCircle: false, //预览图是否是圆形
|
|
|
- title: '会员标识', //模态框上显示的标题
|
|
|
- },
|
|
|
+ memberCheckList: [],
|
|
|
+ classCheckList: [],
|
|
|
+ searchName: ""
|
|
|
};
|
|
|
},
|
|
|
async mounted() {
|
|
@@ -354,12 +381,12 @@ export default {
|
|
|
},
|
|
|
methods: {
|
|
|
onFormClose(ruleForm) {
|
|
|
- (this.form = {
|
|
|
+ this.form = {
|
|
|
name: "",
|
|
|
icon: "",
|
|
|
- into: "",
|
|
|
- }),
|
|
|
- this.$refs.trees.setCheckedNodes([]);
|
|
|
+ into: ""
|
|
|
+ };
|
|
|
+ this.$refs.trees.setCheckedNodes([]);
|
|
|
this.onTreeCheck();
|
|
|
this.$refs[ruleForm].resetFields();
|
|
|
},
|
|
@@ -367,30 +394,67 @@ export default {
|
|
|
this.rules.page = 1;
|
|
|
this.getList();
|
|
|
},
|
|
|
- onReSet() {},
|
|
|
- cropSuccess(data) {
|
|
|
- this.form.experienceIcon = data.data.url;
|
|
|
- },
|
|
|
- cropSuccess2(data) {
|
|
|
- this.form.icon = data.data.url;
|
|
|
+ onReSet() {
|
|
|
+ this.searchForm = {
|
|
|
+ name: null,
|
|
|
+ updateName: null,
|
|
|
+ createTimer: []
|
|
|
+ };
|
|
|
+ this.search();
|
|
|
},
|
|
|
async getList() {
|
|
|
try {
|
|
|
+ // this.tableList = []
|
|
|
+ let { createTimer, ...reset } = this.searchForm;
|
|
|
const res = await getmemberRankList({
|
|
|
- search: this.searchForm.search,
|
|
|
- rows: this.rules.limit,
|
|
|
- page: this.rules.page,
|
|
|
+ ...reset,
|
|
|
+ ...getTimeFormat(
|
|
|
+ createTimer,
|
|
|
+ ["updateStartTime", "updateEndTime"],
|
|
|
+ "YYYY-MM-DD"
|
|
|
+ )
|
|
|
+ // rows: this.rules.limit,
|
|
|
+ // page: this.rules.page,
|
|
|
});
|
|
|
- this.tableList = res.data.rows;
|
|
|
- this.rules.total = res.data.total;
|
|
|
+ this.tableList = res.data;
|
|
|
+ // this.rules.total = res.data.total;
|
|
|
} catch {}
|
|
|
},
|
|
|
- async addLeave() {
|
|
|
+ async addLeave(row) {
|
|
|
this.checkList = [];
|
|
|
- this.title = "新增会员等级";
|
|
|
+ this.memberCheckList = [];
|
|
|
+ this.classCheckList = [];
|
|
|
+ this.isIndeterminate = false;
|
|
|
+ this.checkAll = false;
|
|
|
+ this.isMemberIndeterminate = false;
|
|
|
+ this.memberCheckAll = false;
|
|
|
+
|
|
|
+ this.title = "新增";
|
|
|
+ // 添加新增
|
|
|
+ this.form.name = null;
|
|
|
+ this.form.intro = null;
|
|
|
+ if (row) {
|
|
|
+ this.form.parentId = row.id;
|
|
|
+ this.form.parentName = row.name
|
|
|
+ } else {
|
|
|
+ this.form.parentId = 0
|
|
|
+ }
|
|
|
+
|
|
|
this.addDisabled = false;
|
|
|
this.pageType = "create";
|
|
|
- await this.getNewTree();
|
|
|
+ await this.getMemberRankList(this.form.parentId || null);
|
|
|
+ this.memberRankCount = 0;
|
|
|
+ this.treeMemberData = await this.setMemberTableData(
|
|
|
+ this.memberRankList,
|
|
|
+ this.addDisabled
|
|
|
+ );
|
|
|
+ this.classCount = 0;
|
|
|
+ this.treeClassData = await this.setMemberTableData(
|
|
|
+ this.classList,
|
|
|
+ this.addDisabled,
|
|
|
+ "class"
|
|
|
+ );
|
|
|
+ await this.getNewTree(this.form.parentId || null);
|
|
|
this.slideCount = 0;
|
|
|
this.treeData = await this.setTableData(
|
|
|
this.silderList,
|
|
@@ -399,16 +463,26 @@ export default {
|
|
|
this.branchStatus = true;
|
|
|
},
|
|
|
onSubmit() {
|
|
|
- this.$refs.ruleForm.validate(async (flag) => {
|
|
|
+ this.$refs.ruleForm.validate(async flag => {
|
|
|
if (flag) {
|
|
|
- let tempIds = this.$refs.trees.getCheckedKeys();
|
|
|
- let halfIds = this.$refs.trees.getHalfCheckedKeys();
|
|
|
- let allIds = [...tempIds, ...halfIds];
|
|
|
+ const tempIds = this.$refs.trees.getCheckedKeys();
|
|
|
+ const halfIds = this.$refs.trees.getHalfCheckedKeys();
|
|
|
+ const allIds = [...tempIds, ...halfIds];
|
|
|
+
|
|
|
+ const memberTempIds = this.$refs.memberTrees.getCheckedKeys();
|
|
|
+ const memberHalfIds = this.$refs.memberTrees.getHalfCheckedKeys();
|
|
|
+ const memberAllIds = [...memberTempIds, ...memberHalfIds];
|
|
|
+
|
|
|
+ const classTempIds = this.$refs.classTrees.getCheckedKeys();
|
|
|
+ const classHalfIds = this.$refs.classTrees.getHalfCheckedKeys();
|
|
|
+ const classAllIds = [...classTempIds, ...classHalfIds];
|
|
|
if (this.pageType == "update") {
|
|
|
try {
|
|
|
- const res = await resetMemberRank({
|
|
|
+ await resetMemberRank({
|
|
|
...this.form,
|
|
|
memberPrivilegesItemIdList: allIds,
|
|
|
+ memberCategoryIdList: memberAllIds,
|
|
|
+ memberCourseTypeList: classAllIds
|
|
|
});
|
|
|
this.$message.success("修改成功");
|
|
|
this.branchStatus = false;
|
|
@@ -416,11 +490,13 @@ export default {
|
|
|
} catch {}
|
|
|
} else if (this.pageType == "create") {
|
|
|
try {
|
|
|
- const res = await addMemberRank({
|
|
|
+ await addMemberRank({
|
|
|
...this.form,
|
|
|
memberPrivilegesItemIdList: allIds,
|
|
|
+ memberCategoryIdList: memberAllIds,
|
|
|
+ memberCourseTypeList: classAllIds
|
|
|
});
|
|
|
- this.$message.success("新建会员成功");
|
|
|
+ this.$message.success("新建成功");
|
|
|
this.branchStatus = false;
|
|
|
this.getList();
|
|
|
} catch {}
|
|
@@ -430,6 +506,15 @@ export default {
|
|
|
}
|
|
|
});
|
|
|
},
|
|
|
+ onCheckMemberAll(val) {
|
|
|
+ if (val) {
|
|
|
+ // 先去掉半选
|
|
|
+ this.isMemberIndeterminate = false;
|
|
|
+ this.$refs.memberTrees.setCheckedNodes(this.treeMemberData);
|
|
|
+ } else {
|
|
|
+ this.$refs.memberTrees.setCheckedNodes([]);
|
|
|
+ }
|
|
|
+ },
|
|
|
onCheckAll(val) {
|
|
|
if (val) {
|
|
|
// 先去掉半选
|
|
@@ -439,6 +524,13 @@ export default {
|
|
|
this.$refs.trees.setCheckedNodes([]);
|
|
|
}
|
|
|
},
|
|
|
+ onTreeMemberCheck() {
|
|
|
+ let checkTree = this.$refs.memberTrees.getCheckedKeys();
|
|
|
+ this.memberCheckAll = checkTree.length >= this.memberRankCount;
|
|
|
+ this.isMemberIndeterminate =
|
|
|
+ checkTree.length > 0 && checkTree.length < this.memberRankCount;
|
|
|
+ },
|
|
|
+ onTreeClassCheck() {},
|
|
|
onTreeCheck() {
|
|
|
let checkTree = this.$refs.trees.getCheckedKeys();
|
|
|
this.checkAll = checkTree.length >= this.slideCount;
|
|
@@ -449,25 +541,26 @@ export default {
|
|
|
if (!value) return true;
|
|
|
return data.label.indexOf(value) !== -1;
|
|
|
},
|
|
|
- seachRoles() {
|
|
|
- this.$refs.trees.filter(this.seachRoleValue);
|
|
|
+ searchRoles() {
|
|
|
+ this.$refs.memberTrees.filter(this.searchRoleValue);
|
|
|
+ this.$refs.classTrees.filter(this.searchRoleValue);
|
|
|
+ this.$refs.trees.filter(this.searchRoleValue);
|
|
|
},
|
|
|
onReSetRole() {
|
|
|
- this.seachRoleValue = "";
|
|
|
- // this.data = this.setTableData(this.silderList);
|
|
|
- this.$refs.trees.filter(this.seachRoleValue);
|
|
|
- // console.log(this.data);
|
|
|
+ this.searchRoleValue = "";
|
|
|
+ this.$refs.memberTrees.filter(this.searchRoleValue);
|
|
|
+ this.$refs.classTrees.filter(this.searchRoleValue);
|
|
|
+ this.$refs.trees.filter(this.searchRoleValue);
|
|
|
},
|
|
|
setTableData(result, disabled) {
|
|
|
let list = [];
|
|
|
-
|
|
|
- list = result.map((res) => {
|
|
|
+ list = result.map(res => {
|
|
|
let tempList = {};
|
|
|
tempList = {
|
|
|
id: res.id,
|
|
|
name: res.name,
|
|
|
label: res.name,
|
|
|
- disabled: disabled ? disabled : false,
|
|
|
+ disabled: disabled ? disabled : false
|
|
|
};
|
|
|
this.slideCount++;
|
|
|
if (res.memberPrivilegesItems && res.memberPrivilegesItems.length > 0) {
|
|
@@ -480,90 +573,206 @@ export default {
|
|
|
});
|
|
|
return list;
|
|
|
},
|
|
|
+ setMemberTableData(result, disabled, type = "music") {
|
|
|
+ let list = [];
|
|
|
+ list = result.map(res => {
|
|
|
+ let tempList = {};
|
|
|
+ tempList = {
|
|
|
+ id: res.id,
|
|
|
+ name: res.name,
|
|
|
+ label: res.name,
|
|
|
+ disabled: disabled ? disabled : false
|
|
|
+ };
|
|
|
+ if (type === "music") {
|
|
|
+ this.memberRankCount++;
|
|
|
+ } else {
|
|
|
+ this.classCount++;
|
|
|
+ }
|
|
|
+ if (
|
|
|
+ res.sysMusicScoreCategoriesList &&
|
|
|
+ res.sysMusicScoreCategoriesList.length > 0
|
|
|
+ ) {
|
|
|
+ tempList.children = this.setMemberTableData(
|
|
|
+ res.sysMusicScoreCategoriesList,
|
|
|
+ disabled
|
|
|
+ );
|
|
|
+ }
|
|
|
+ return tempList;
|
|
|
+ });
|
|
|
+ return list;
|
|
|
+ },
|
|
|
+ removeMember(row) {
|
|
|
+ this.$confirm("是否删除该学练宝设置?", "提示", {
|
|
|
+ confirmButtonText: "确定",
|
|
|
+ cancelButtonText: "取消",
|
|
|
+ type: "warning"
|
|
|
+ })
|
|
|
+ .then(async () => {
|
|
|
+ await api_memberRankDel({ id: row.id });
|
|
|
+ this.$message.success("删除成功");
|
|
|
+ this.getList()
|
|
|
+ })
|
|
|
+ .catch(() => {});
|
|
|
+ },
|
|
|
async resetMember(row, type) {
|
|
|
this.branchStatus = true;
|
|
|
await this.resetTree(row);
|
|
|
+ let tempStatus = false
|
|
|
if (type) {
|
|
|
- this.title = "修改会员等级";
|
|
|
+ this.title = "修改";
|
|
|
this.pageType = "update";
|
|
|
this.addDisabled = false;
|
|
|
- this.slideCount = 0;
|
|
|
- this.treeData = await this.setTableData(
|
|
|
- this.silderList,
|
|
|
- this.addDisabled
|
|
|
- );
|
|
|
+ tempStatus = this.buyFlag
|
|
|
} else {
|
|
|
this.addDisabled = true;
|
|
|
- this.title = "查看会员等级";
|
|
|
+ tempStatus = true;
|
|
|
+ this.title = "查看";
|
|
|
this.pageType = "";
|
|
|
- this.slideCount = 0;
|
|
|
- this.treeData = await this.setTableData(
|
|
|
- this.silderList,
|
|
|
- this.addDisabled
|
|
|
- );
|
|
|
}
|
|
|
+ this.slideCount = 0;
|
|
|
+ this.treeData = await this.setTableData(
|
|
|
+ this.silderList,
|
|
|
+ tempStatus
|
|
|
+ );
|
|
|
+
|
|
|
+ this.memberRankCount = 0;
|
|
|
+ this.treeMemberData = await this.setMemberTableData(
|
|
|
+ this.memberRankList,
|
|
|
+ tempStatus
|
|
|
+ );
|
|
|
+
|
|
|
+ this.classCount = 0;
|
|
|
+ this.treeClassData = await this.setMemberTableData(
|
|
|
+ this.classList,
|
|
|
+ tempStatus,
|
|
|
+ "class"
|
|
|
+ );
|
|
|
},
|
|
|
//递归获取到所有的为子级的ID
|
|
|
- getParent(checkIds, data) {
|
|
|
+ getParent(checkIds, data, type = "tree") {
|
|
|
let removeIds = JSON.parse(JSON.stringify(checkIds));
|
|
|
- this.getAllChildIds(data);
|
|
|
- let tempAllChildIds = this.allChildIds;
|
|
|
+ this.getAllChildIds(data, type);
|
|
|
+ let tempAllChildIds = [];
|
|
|
+ if (type === "tree") {
|
|
|
+ tempAllChildIds = this.allChildIds;
|
|
|
+ } else if (type === "member") {
|
|
|
+ tempAllChildIds = this.allMemberChildIds;
|
|
|
+ } else if (type === "class") {
|
|
|
+ tempAllChildIds = this.allClassChildIds;
|
|
|
+ }
|
|
|
+
|
|
|
for (let i = checkIds.length; i > 0; i--) {
|
|
|
- if (!tempAllChildIds.includes(checkIds[i - 1])) {
|
|
|
+ if (!tempAllChildIds.includes(Number(checkIds[i - 1]))) {
|
|
|
removeIds.splice(i - 1, 1);
|
|
|
}
|
|
|
}
|
|
|
return removeIds;
|
|
|
},
|
|
|
- getAllChildIds(data) {
|
|
|
+ getAllChildIds(data, type) {
|
|
|
// 获取所有最子集编号
|
|
|
- let child = this.allChildIds;
|
|
|
- let tempList = [];
|
|
|
- data.forEach((item, index) => {
|
|
|
+ data.forEach(item => {
|
|
|
let temp = [];
|
|
|
if (item.children && item.children.length > 0) {
|
|
|
- temp = this.getAllChildIds(item.children);
|
|
|
+ temp = this.getAllChildIds(item.children, type);
|
|
|
} else {
|
|
|
- child.push(item.id);
|
|
|
+ if (type === "member") {
|
|
|
+ this.allMemberChildIds.push(item.id);
|
|
|
+ } else if (type === "class") {
|
|
|
+ this.allClassChildIds.push(item.id);
|
|
|
+ } else if (type === "tree") {
|
|
|
+ this.allChildIds.push(item.id);
|
|
|
+ }
|
|
|
}
|
|
|
});
|
|
|
},
|
|
|
async resetTree(row) {
|
|
|
try {
|
|
|
- this.treeData = await this.getNewTree();
|
|
|
- const res = await getmemberRankDetail({ memberRankSettingId: row.id });
|
|
|
- this.form = { ...res.data };
|
|
|
-
|
|
|
+ await this.getNewTree(row.parentId || null);
|
|
|
+ await this.getMemberRankList(row.parentId || null);
|
|
|
+ this.treeMemberData = await this.setMemberTableData(
|
|
|
+ this.memberRankList
|
|
|
+ );
|
|
|
+ this.treeClassData = await this.setMemberTableData(
|
|
|
+ this.classList,
|
|
|
+ false,
|
|
|
+ "class"
|
|
|
+ );
|
|
|
+ this.treeData = await this.setTableData(this.silderList);
|
|
|
+ const { data } = await getmemberRankDetail({
|
|
|
+ memberRankSettingId: row.id
|
|
|
+ });
|
|
|
+ this.buyFlag = data.buyFlag || false
|
|
|
+ this.form = { ...data };
|
|
|
+ console.log(row.parentId, 'parentId')
|
|
|
+ if(row.parentId) {
|
|
|
+ this.form.parentId = row.parentId;
|
|
|
+ this.form.parentName = row.parentName
|
|
|
+ }
|
|
|
+
|
|
|
this.checkAll =
|
|
|
- res.data.memberPrivilegesItemIdList?.length >= this.slideCount ||
|
|
|
- false;
|
|
|
+ data.memberPrivilegesItemIdList?.length >= this.slideCount && data.memberPrivilegesItemIdList?.length > 0 || false;
|
|
|
// 反写树的值
|
|
|
this.isIndeterminate =
|
|
|
- res.data.memberPrivilegesItemIdList?.length > 0 &&
|
|
|
- res.data.memberPrivilegesItemIdList?.length < this.slideCount;
|
|
|
+ data.memberPrivilegesItemIdList?.length > 0 &&
|
|
|
+ data.memberPrivilegesItemIdList?.length < this.slideCount;
|
|
|
|
|
|
- this.checkList = res.data.memberPrivilegesItemIdList;
|
|
|
+ this.checkList = data.memberPrivilegesItemIdList;
|
|
|
let tSplice = this.getParent(
|
|
|
- res.data.memberPrivilegesItemIdList || [],
|
|
|
+ data.memberPrivilegesItemIdList || [],
|
|
|
this.treeData
|
|
|
);
|
|
|
this.checkList = tSplice;
|
|
|
this.$nextTick(() => {
|
|
|
this.$refs.trees.setCheckedKeys(this.checkList);
|
|
|
});
|
|
|
+
|
|
|
+ this.memberCheckAll = data.memberCategoryIdList?.length >= this.memberRankCount && data.memberCategoryIdList?.length > 0 || false;
|
|
|
+ this.isMemberIndeterminate = data.memberCategoryIdList?.length > 0 && data.memberCategoryIdList?.length < this.memberRankCount;
|
|
|
+ this.memberCheckList = data.memberCategoryIdList;
|
|
|
+ const mSplice = this.getParent(data.memberCategoryIdList || [], this.treeMemberData, 'member')
|
|
|
+ this.memberCheckList = mSplice;
|
|
|
+ this.$nextTick(() => {
|
|
|
+ this.$refs.memberTrees.setCheckedKeys(this.memberCheckList);
|
|
|
+ });
|
|
|
+
|
|
|
+ // this.classCheckAll =
|
|
|
+ // data.memberCourseTypeList?.length >= this.memberRankCount || false;
|
|
|
+ // this.isClassIndeterminate =
|
|
|
+ // data.memberCourseTypeList?.length > 0 &&
|
|
|
+ // data.memberCourseTypeList?.length < this.memberRankCount;
|
|
|
+
|
|
|
+ this.classCheckList = data.memberCourseTypeList;
|
|
|
+ const cSplice = this.getParent(
|
|
|
+ data.memberCourseTypeList || [],
|
|
|
+ this.treeClassData,
|
|
|
+ "class"
|
|
|
+ );
|
|
|
+ this.classCheckList = cSplice;
|
|
|
+ this.$nextTick(() => {
|
|
|
+ this.$refs.classTrees.setCheckedKeys(this.classCheckList);
|
|
|
+ });
|
|
|
} catch (e) {
|
|
|
console.log(e);
|
|
|
}
|
|
|
},
|
|
|
- async getNewTree() {
|
|
|
+ async getNewTree(parentId) {
|
|
|
try {
|
|
|
- const resTree = await getMemberPrivilegesItem();
|
|
|
+ const resTree = await getMemberPrivilegesItem({ parentMemberId: parentId });
|
|
|
this.silderList = resTree.data;
|
|
|
this.slideCount = 0;
|
|
|
- return this.setTableData(resTree.data);
|
|
|
} catch {}
|
|
|
},
|
|
|
- },
|
|
|
+ async getMemberRankList(parentId) {
|
|
|
+ try {
|
|
|
+ const { data } = await api_memberRankCategoryTree({ parentMemberId: parentId });
|
|
|
+ this.memberRankList = data.musicScoreCategories || [];
|
|
|
+ this.memberRankCount = 0;
|
|
|
+
|
|
|
+ this.classList = data.lessonCategories || [];
|
|
|
+ this.classCount = 0;
|
|
|
+ } catch {}
|
|
|
+ }
|
|
|
+ }
|
|
|
};
|
|
|
</script>
|
|
|
<style lang="scss" scoped>
|