|
@@ -32,18 +32,10 @@
|
|
|
</el-form-item>
|
|
|
</save-form>
|
|
|
<div class="btnList">
|
|
|
- <el-button
|
|
|
- type="primary"
|
|
|
- style="margin-bottom: 20px"
|
|
|
- @click="addAgent"
|
|
|
- >
|
|
|
+ <el-button type="primary" style="margin-bottom: 20px" @click="addAgent">
|
|
|
新建代理商
|
|
|
</el-button>
|
|
|
- <el-button
|
|
|
- type="primary"
|
|
|
- style="margin-bottom: 20px"
|
|
|
- @click="lookH5"
|
|
|
- >
|
|
|
+ <el-button type="primary" style="margin-bottom: 20px" @click="lookH5">
|
|
|
代理商H5
|
|
|
</el-button>
|
|
|
</div>
|
|
@@ -54,10 +46,13 @@
|
|
|
:data="tableList"
|
|
|
row-key="userId"
|
|
|
ref="table1"
|
|
|
+ type="expand"
|
|
|
lazy
|
|
|
:load="getStaffList"
|
|
|
+ @expand-change="hasExpandChange"
|
|
|
:tree-props="{ children: 'children', hasChildren: 'hasChildren' }"
|
|
|
>
|
|
|
+ <!-- -->
|
|
|
<el-table-column
|
|
|
align="center"
|
|
|
prop="userId"
|
|
@@ -170,7 +165,11 @@ import {
|
|
|
import eidtAgentMager from "./modals/eidtAgentMager";
|
|
|
import eidthStaff from "./modals/eidthStaff";
|
|
|
import qrCode from "@/components/QrCode/index";
|
|
|
-import { isvalidPhone, vaildStudentUrl,vaildTeachingUrl } from "@/utils/validate";
|
|
|
+import {
|
|
|
+ isvalidPhone,
|
|
|
+ vaildStudentUrl,
|
|
|
+ vaildTeachingUrl,
|
|
|
+} from "@/utils/validate";
|
|
|
export default {
|
|
|
components: { pagination, eidtAgentMager, qrCode, eidthStaff },
|
|
|
data() {
|
|
@@ -191,7 +190,11 @@ export default {
|
|
|
},
|
|
|
codeStatus: false,
|
|
|
qrCodeUrl: null,
|
|
|
- title:'入驻二维码'
|
|
|
+ title: "入驻二维码",
|
|
|
+ hasLoad: false,
|
|
|
+ currentLoadTreeData: null,
|
|
|
+ resolveObj: null,
|
|
|
+ treeIds: [],
|
|
|
};
|
|
|
},
|
|
|
//生命周期 - 创建完成(可以访问当前this实例)
|
|
@@ -213,18 +216,22 @@ export default {
|
|
|
page: this.rules.page,
|
|
|
rows: this.rules.limit,
|
|
|
});
|
|
|
- this.tableList = res.data.rows.map((item) => {
|
|
|
+ this.tableList = res.data.rows.map((item, index) => {
|
|
|
+ // console.log(this.$refs.table1["store"].states.treeData)
|
|
|
return {
|
|
|
...item,
|
|
|
hasChildren: true,
|
|
|
};
|
|
|
});
|
|
|
+
|
|
|
+ this.refreshRow();
|
|
|
this.rules.total = res.data.total;
|
|
|
} catch (e) {}
|
|
|
},
|
|
|
search() {
|
|
|
this.rules.page = 1;
|
|
|
this.getList();
|
|
|
+ // this.$set(this.$refs.table1.store.states.lazyTreeNodeMap,parentId,this.childrenData)
|
|
|
},
|
|
|
onReSet() {
|
|
|
this.$nextTick(() => {
|
|
@@ -245,15 +252,12 @@ export default {
|
|
|
vaildStudentUrl() +
|
|
|
"/project/questionAsk/index.html?recommender=" +
|
|
|
row.userId;
|
|
|
- this.title='入驻二维码'
|
|
|
+ this.title = "入驻二维码";
|
|
|
this.codeStatus = true;
|
|
|
-
|
|
|
},
|
|
|
- lookH5(){
|
|
|
- this.qrCodeUrl =
|
|
|
- vaildTeachingUrl() +
|
|
|
- "/#/saas-home";
|
|
|
- this.title='代理商H5'
|
|
|
+ lookH5() {
|
|
|
+ this.qrCodeUrl = vaildTeachingUrl() + "/#/saas-home";
|
|
|
+ this.title = "代理商H5";
|
|
|
this.codeStatus = true;
|
|
|
},
|
|
|
async freezeProxy(row) {
|
|
@@ -276,28 +280,53 @@ export default {
|
|
|
} catch (e) {}
|
|
|
},
|
|
|
async getStaffList(tree, treeNode, resolve) {
|
|
|
+ this.hasLoad = true;
|
|
|
+ this.currentLoadTreeData = tree;
|
|
|
+ this.resolveObj = resolve;
|
|
|
+ if (!this.treeIds.includes(tree.userId)) {
|
|
|
+ this.treeIds.push(tree.userId);
|
|
|
+ }
|
|
|
try {
|
|
|
const res = await getProxyUserStaffList({ id: tree.userId });
|
|
|
console.log(res.data);
|
|
|
- resolve(res.data);
|
|
|
+ resolve(res.data || []);
|
|
|
} catch (e) {
|
|
|
// resolve([])
|
|
|
}
|
|
|
},
|
|
|
- async resetTreedata(parentId) {
|
|
|
- console.log("parentId", parentId);
|
|
|
- try {
|
|
|
+ hasExpandChange(row, expanded) {
|
|
|
+ if (expanded) {
|
|
|
+ // 当前是展开状态
|
|
|
+ if (this.hasLoad) {
|
|
|
+ // 已执行过load,则去掉执行过的标记
|
|
|
+ this.hasLoad = false;
|
|
|
+ } else {
|
|
|
+ // 不然,则执行load。因为load只会执行一次,所以需要在expand事件触发再次执行
|
|
|
+ this.getStaffList(this.currentLoadTreeData, "", this.resolveObj);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ },
|
|
|
+ refreshRow() {
|
|
|
+ for (let i in this.treeIds) {
|
|
|
+ this.$refs.table1["store"].states.treeData[
|
|
|
+ this.treeIds[i]
|
|
|
+ ].loaded = false;
|
|
|
+ this.$refs.table1["store"].states.treeData[
|
|
|
+ this.treeIds[i]
|
|
|
+ ].expanded = false;
|
|
|
+ }
|
|
|
+ },
|
|
|
+ async resetTreedata(parentId) {
|
|
|
+ try {
|
|
|
const res = await getProxyUserStaffList({ id: parentId });
|
|
|
- console.log(res.data);
|
|
|
- this.$set(
|
|
|
- this.$refs.table1.store.states.lazyTreeNodeMap,
|
|
|
- parentId,
|
|
|
- res.data
|
|
|
- );
|
|
|
+ this.$set(
|
|
|
+ this.$refs.table1.store.states.lazyTreeNodeMap,
|
|
|
+ parentId,
|
|
|
+ res.data
|
|
|
+ );
|
|
|
} catch (e) {
|
|
|
// resolve([])
|
|
|
}
|
|
|
-
|
|
|
},
|
|
|
},
|
|
|
};
|