Commit 95526d49 by yangming

method

1 parent 14629b40
...@@ -11,8 +11,9 @@ ...@@ -11,8 +11,9 @@
"axios": "^0.21.1", "axios": "^0.21.1",
"core-js": "^3.4.4", "core-js": "^3.4.4",
"glsx-common": "^1.4.6", "glsx-common": "^1.4.6",
"vue": "^2.6.11", "glsx-components": "^1.1.8",
"glsx-table": "^1.0.9", "glsx-table": "^1.0.9",
"vue": "^2.6.11",
"vue-amap": "^0.5.10" "vue-amap": "^0.5.10"
}, },
"devDependencies": { "devDependencies": {
......
...@@ -8,7 +8,7 @@ ...@@ -8,7 +8,7 @@
*/ */
import { http_config } from '@/main' import { http_config } from '@/main'
const getMerchantTree = params => { const getMerchantTree = params => {
params.method = 'org.ore.api.common.findMerchantTreeByMerchantNo.list' params.method = 'entmicro.api.common.findMerchantTreeByMerchantNo.list'
return http_config({ return http_config({
url: '/rop-scrm-entmicro/router', url: '/rop-scrm-entmicro/router',
method: 'POST', method: 'POST',
...@@ -17,7 +17,7 @@ const getMerchantTree = params => { ...@@ -17,7 +17,7 @@ const getMerchantTree = params => {
}) })
} }
const getDepartment = params => { const getDepartment = params => {
params.method = 'cn.com.glsx.entmicro.department.listDepartmentTree' params.method = 'entmicro.api.department.listDepartmentTree'
return http_config({ return http_config({
url: '/rop-scrm-entmicro/router', url: '/rop-scrm-entmicro/router',
method: 'POST', method: 'POST',
...@@ -26,7 +26,7 @@ const getDepartment = params => { ...@@ -26,7 +26,7 @@ const getDepartment = params => {
}) })
} }
const toGL = params => { const toGL = params => {
params.method = 'org.ore.api.common.relevanceEntmicro.list' params.method = 'entmicro.api.common.relevanceEntmicro.list'
return http_config({ return http_config({
url: '/rop-scrm-entmicro/router', url: '/rop-scrm-entmicro/router',
method: 'POST', method: 'POST',
...@@ -35,7 +35,7 @@ const toGL = params => { ...@@ -35,7 +35,7 @@ const toGL = params => {
}) })
} }
const merchantInfo = params => { const merchantInfo = params => {
params.method = 'org.ore.api.common.findMerchantInfoByMerchantNo.list' params.method = 'entmicro.api.common.findMerchantInfoByMerchantNo.list'
return http_config({ return http_config({
url: '/rop-scrm-entmicro/router', url: '/rop-scrm-entmicro/router',
method: 'POST', method: 'POST',
......
import { http } from '@/main' import { http } from '@/main'
var defaultPath = 'cn.com.glsx.merchants.' var defaultPath = 'merchants.api.'
const getListApi = params => { const getListApi = params => {
params.method = `${defaultPath}staff.findStaffByPage` params.method = `${defaultPath}staff.findStaffByPage`
...@@ -22,7 +22,7 @@ const getAllMerchantListApi = params => { ...@@ -22,7 +22,7 @@ const getAllMerchantListApi = params => {
} }
const getRoleListApi = params => { const getRoleListApi = params => {
params.method = 'org.ore.api.role.list' params.method = 'merchants.api.role.list'
return http({ return http({
url: '/rop-merchants/router', url: '/rop-merchants/router',
method: 'POST', method: 'POST',
......
...@@ -9,7 +9,7 @@ ...@@ -9,7 +9,7 @@
import { http } from '@/main' import { http } from '@/main'
export function getThirdTable(params) { export function getThirdTable(params) {
params.method = 'cn.com.glsx.merchants.menu.findLog' params.method = 'merchants.api.menu.findLog'
return http({ return http({
url: '/rop-merchants/router', url: '/rop-merchants/router',
...@@ -19,7 +19,7 @@ export function getThirdTable(params) { ...@@ -19,7 +19,7 @@ export function getThirdTable(params) {
}) })
} }
// const getThirdTable =(params)=>{ // const getThirdTable =(params)=>{
// params.method = 'cn.com.glsx.merchants.menu.findLog' // params.method = 'merchants.api.menu.findLog'
// return http({ // return http({
// url: '/rop-merchants/router', // url: '/rop-merchants/router',
...@@ -31,7 +31,7 @@ export function getThirdTable(params) { ...@@ -31,7 +31,7 @@ export function getThirdTable(params) {
// } // }
//获取功能权限树 //获取功能权限树
const findMenuFunTreeByMerId = params => { const findMenuFunTreeByMerId = params => {
params.method = 'cn.com.glsx.merchants.merchant.findMenuFunTreeByMerId' params.method = 'merchants.api.merchant.findMenuFunTreeByMerId'
return http({ return http({
url: '/rop-merchants/router', url: '/rop-merchants/router',
...@@ -42,7 +42,7 @@ const findMenuFunTreeByMerId = params => { ...@@ -42,7 +42,7 @@ const findMenuFunTreeByMerId = params => {
} }
//获取商户信息 //获取商户信息
const getFirstInfo = params => { const getFirstInfo = params => {
params.method = 'cn.com.glsx.merchants.merchant.findMerchantDetail' params.method = 'merchants.api.merchant.findMerchantDetail'
return http({ return http({
url: '/rop-merchants/router', url: '/rop-merchants/router',
...@@ -53,7 +53,7 @@ const getFirstInfo = params => { ...@@ -53,7 +53,7 @@ const getFirstInfo = params => {
} }
//获取上下级信息 //获取上下级信息
const getSecondInfo = params => { const getSecondInfo = params => {
params.method = 'cn.com.glsx.merchants.menu.findSubordinateRelationship' params.method = 'merchants.api.menu.findSubordinateRelationship'
return http({ return http({
url: '/rop-merchants/router', url: '/rop-merchants/router',
...@@ -63,7 +63,7 @@ const getSecondInfo = params => { ...@@ -63,7 +63,7 @@ const getSecondInfo = params => {
}) })
} }
const getSecondTree = params => { const getSecondTree = params => {
params.method = 'cn.com.glsx.merchants.merchant.findMerchantTree' params.method = 'merchants.api.merchant.findMerchantTree'
return http({ return http({
url: '/rop-merchants/router', url: '/rop-merchants/router',
...@@ -73,7 +73,7 @@ const getSecondTree = params => { ...@@ -73,7 +73,7 @@ const getSecondTree = params => {
}) })
} }
const getSecondTable = params => { const getSecondTable = params => {
params.method = 'cn.com.glsx.merchants.staff.findMerchantStaffList' params.method = 'merchants.api.staff.findMerchantStaffList'
return http({ return http({
url: '/rop-merchants/router', url: '/rop-merchants/router',
......
...@@ -8,7 +8,7 @@ ...@@ -8,7 +8,7 @@
*/ */
import { http } from '@/main' import { http } from '@/main'
const roleDataList = params => { const roleDataList = params => {
params.method = 'org.ore.api.role.page' params.method = 'merchants.api.role.page'
return http({ return http({
url: '/rop-merchants/router', url: '/rop-merchants/router',
method: 'POST', method: 'POST',
...@@ -17,7 +17,7 @@ const roleDataList = params => { ...@@ -17,7 +17,7 @@ const roleDataList = params => {
}) })
} }
const merchantDataList = params => { const merchantDataList = params => {
params.method = 'cn.com.glsx.merchants.menu.findAllMerchant' params.method = 'merchants.api.menu.findAllMerchant'
return http({ return http({
url: '/rop-merchants/router', url: '/rop-merchants/router',
method: 'POST', method: 'POST',
...@@ -26,7 +26,7 @@ const merchantDataList = params => { ...@@ -26,7 +26,7 @@ const merchantDataList = params => {
}) })
} }
const roleInfoData = params => { const roleInfoData = params => {
params.method = 'org.ore.api.role.getById' params.method = 'merchants.api.role.getById'
return http({ return http({
url: '/rop-merchants/router', url: '/rop-merchants/router',
method: 'POST', method: 'POST',
...@@ -35,7 +35,7 @@ const roleInfoData = params => { ...@@ -35,7 +35,7 @@ const roleInfoData = params => {
}) })
} }
const roleTreeDataById = params => { const roleTreeDataById = params => {
params.method = 'cn.com.glsx.merchants.merchant.findMenuFunTreeByRoleId' params.method = 'merchants.api.merchant.findMenuFunTreeByRoleId'
return http({ return http({
url: '/rop-merchants/router', url: '/rop-merchants/router',
method: 'POST', method: 'POST',
...@@ -44,7 +44,7 @@ const roleTreeDataById = params => { ...@@ -44,7 +44,7 @@ const roleTreeDataById = params => {
}) })
} }
const merchantRootById = params => { const merchantRootById = params => {
params.method = 'cn.com.glsx.merchants.merchant.findMenuFunTreeByMerId' params.method = 'merchants.api.merchant.findMenuFunTreeByMerId'
return http({ return http({
url: '/rop-merchants/router', url: '/rop-merchants/router',
method: 'POST', method: 'POST',
...@@ -53,7 +53,7 @@ const merchantRootById = params => { ...@@ -53,7 +53,7 @@ const merchantRootById = params => {
}) })
} }
const createRole = params => { const createRole = params => {
params.method = 'org.ore.api.role.insert' params.method = 'merchants.api.role.insert'
return http({ return http({
url: '/rop-merchants/router', url: '/rop-merchants/router',
method: 'POST', method: 'POST',
...@@ -62,7 +62,7 @@ const createRole = params => { ...@@ -62,7 +62,7 @@ const createRole = params => {
}) })
} }
const updateRole = params => { const updateRole = params => {
params.method = 'org.ore.api.role.update' params.method = 'merchants.api.role.update'
return http({ return http({
url: '/rop-merchants/router', url: '/rop-merchants/router',
method: 'POST', method: 'POST',
...@@ -71,7 +71,7 @@ const updateRole = params => { ...@@ -71,7 +71,7 @@ const updateRole = params => {
}) })
} }
const deleteRole = params => { const deleteRole = params => {
params.method = 'org.ore.api.role.deleteById' params.method = 'merchants.api.role.deleteById'
return http({ return http({
url: '/rop-merchants/router', url: '/rop-merchants/router',
method: 'POST', method: 'POST',
......
...@@ -8,7 +8,7 @@ ...@@ -8,7 +8,7 @@
*/ */
import { http } from '@/main' import { http } from '@/main'
const findMerchantByPage = params => { const findMerchantByPage = params => {
params.method = 'cn.com.glsx.merchants.menu.findMerchantByPage' params.method = 'merchants.api.menu.findMerchantByPage'
return http({ return http({
url: '/rop-merchants/router', url: '/rop-merchants/router',
method: 'POST', method: 'POST',
...@@ -17,7 +17,7 @@ const findMerchantByPage = params => { ...@@ -17,7 +17,7 @@ const findMerchantByPage = params => {
}) })
} }
const findAllDictData = params => { const findAllDictData = params => {
params.method = 'cn.com.glsx.merchants.menu.findAllDictData' params.method = 'merchants.api.menu.findAllDictData'
return http({ return http({
url: '/rop-merchants/router', url: '/rop-merchants/router',
method: 'POST', method: 'POST',
...@@ -27,7 +27,7 @@ const findAllDictData = params => { ...@@ -27,7 +27,7 @@ const findAllDictData = params => {
} }
//主营品牌 //主营品牌
const getCarbrandTree = params => { const getCarbrandTree = params => {
params.method = 'cn.com.glsx.merchants.merchantCommon.getCarbrandTree' params.method = 'merchants.api.merchantCommon.getCarbrandTree'
return http({ return http({
url: '/rop-merchants/router', url: '/rop-merchants/router',
method: 'POST', method: 'POST',
...@@ -37,7 +37,7 @@ const getCarbrandTree = params => { ...@@ -37,7 +37,7 @@ const getCarbrandTree = params => {
} }
//详情 //详情
const findMerchantDetail = params => { const findMerchantDetail = params => {
params.method = 'cn.com.glsx.merchants.merchant.findMerchantDetail' params.method = 'merchants.api.merchant.findMerchantDetail'
return http({ return http({
url: '/rop-merchants/router', url: '/rop-merchants/router',
method: 'POST', method: 'POST',
...@@ -47,7 +47,7 @@ const findMerchantDetail = params => { ...@@ -47,7 +47,7 @@ const findMerchantDetail = params => {
} }
//下一步 //下一步
const saveMerchant = params => { const saveMerchant = params => {
params.method = 'cn.com.glsx.merchants.merchant.saveMerchant' params.method = 'merchants.api.merchant.saveMerchant'
return http({ return http({
url: '/rop-merchants/router', url: '/rop-merchants/router',
method: 'POST', method: 'POST',
...@@ -56,7 +56,7 @@ const saveMerchant = params => { ...@@ -56,7 +56,7 @@ const saveMerchant = params => {
}) })
} }
const updateMerchant = params => { const updateMerchant = params => {
params.method = 'cn.com.glsx.merchants.merchant.updateMerchant' params.method = 'merchants.api.merchant.updateMerchant'
return http({ return http({
url: '/rop-merchants/router', url: '/rop-merchants/router',
method: 'POST', method: 'POST',
...@@ -65,7 +65,7 @@ const updateMerchant = params => { ...@@ -65,7 +65,7 @@ const updateMerchant = params => {
}) })
} }
const accountTypeSearchRequest = params => { const accountTypeSearchRequest = params => {
params.method = 'cn.com.glsx.merchants.merchant.accountTypeSearchRequest' params.method = 'merchants.api.merchant.accountTypeSearchRequest'
return http({ return http({
url: '/rop-merchants/router', url: '/rop-merchants/router',
method: 'POST', method: 'POST',
...@@ -75,7 +75,7 @@ const accountTypeSearchRequest = params => { ...@@ -75,7 +75,7 @@ const accountTypeSearchRequest = params => {
} }
//功能权限 //功能权限
const findPermissionsByMerId = params => { const findPermissionsByMerId = params => {
params.method = 'cn.com.glsx.merchants.merchant.findPermissionsByMerId' params.method = 'merchants.api.merchant.findPermissionsByMerId'
return http({ return http({
url: '/rop-merchants/router', url: '/rop-merchants/router',
method: 'POST', method: 'POST',
...@@ -85,7 +85,7 @@ const findPermissionsByMerId = params => { ...@@ -85,7 +85,7 @@ const findPermissionsByMerId = params => {
} }
//功能权限 //功能权限
const findMenuFunTreeByMerId = params => { const findMenuFunTreeByMerId = params => {
params.method = 'cn.com.glsx.merchants.merchant.findMenuFunTreeByMerId' params.method = 'merchants.api.merchant.findMenuFunTreeByMerId'
return http({ return http({
url: '/rop-merchants/router', url: '/rop-merchants/router',
method: 'POST', method: 'POST',
...@@ -95,7 +95,7 @@ const findMenuFunTreeByMerId = params => { ...@@ -95,7 +95,7 @@ const findMenuFunTreeByMerId = params => {
} }
//草稿保存 //草稿保存
const updatePermissions = params => { const updatePermissions = params => {
params.method = 'cn.com.glsx.merchants.merchant.updatePermissions' params.method = 'merchants.api.merchant.updatePermissions'
return http({ return http({
url: '/rop-merchants/router', url: '/rop-merchants/router',
method: 'POST', method: 'POST',
......
...@@ -178,31 +178,30 @@ export default { ...@@ -178,31 +178,30 @@ export default {
} else { } else {
account = "accountTypeSearchRequest"; account = "accountTypeSearchRequest";
} }
let tabMenu = await this.$apis.store[account](params); this.$apis.store[account](params).then((res) => {
this.accountList = tabMenu.map((item) => { console.log(res);
return { let tabMenu = res;
productsArr: [], this.accountList = tabMenu.map((item) => {
products: item.products, return {
accounttypeName: item.accounttypeName, productsArr: [],
accounttypeId: item.accounttypeId, products: item.products,
// merchantProTreeResponses: item.merchantProTreeResponses, accounttypeName: item.accounttypeName,
// productId: '' accounttypeId: item.accounttypeId,
}; // merchantProTreeResponses: item.merchantProTreeResponses,
}); // productId: ''
this.$nextTick(() => { };
this.addStyle(); });
});
console.log(this.accountList); console.log(this.accountList);
this.accountTypes = tabMenu.map((item) => { this.accountTypes = tabMenu.map((item) => {
return { return {
products: null, products: null,
accounttypeId: item.accounttypeId, accounttypeId: item.accounttypeId,
}; };
});
this.tabMenu_s = util.deepClone(this.accountList);
this.findPermissionsByMerId(params.merchantId ? params.merchantId : params.id);
}); });
this.tabMenu_s = util.deepClone(this.accountList);
// this.tabName = this.tabMenu[0].accounttypeId
this.findPermissionsByMerId(params.merchantId ? params.merchantId : params.id);
return this.accountList;
}, },
// 获取已选择的权限 // 获取已选择的权限
findPermissionsByMerId(id) { findPermissionsByMerId(id) {
...@@ -226,6 +225,7 @@ export default { ...@@ -226,6 +225,7 @@ export default {
this.$refs[ this.$refs[
`tree_${itm.accounttypeId}_${j.productId}` `tree_${itm.accounttypeId}_${j.productId}`
][0].setCheckedKeys(i.menuIds); ][0].setCheckedKeys(i.menuIds);
this.addStyle();
}); });
} }
}); });
...@@ -285,7 +285,8 @@ export default { ...@@ -285,7 +285,8 @@ export default {
addStyle() { addStyle() {
const nodes = document.getElementsByClassName("fun-tree-node"); const nodes = document.getElementsByClassName("fun-tree-node");
for (let i = 0; i < nodes.length; i++) { for (let i = 0; i < nodes.length; i++) {
const parentNode = nodes[i].parentNode; const parentNode = nodes[i].parentNode.parentNode;
console.log(parentNode);
parentNode.style.float = "left"; parentNode.style.float = "left";
} }
}, },
......
...@@ -150,7 +150,7 @@ ...@@ -150,7 +150,7 @@
<div id="secondmerchantName">{{ secondPageObj.merchantName }}</div> <div id="secondmerchantName">{{ secondPageObj.merchantName }}</div>
</el-tooltip> </el-tooltip>
<div> <div>
商户号: 商户号:
<span id="secondmerchantId">{{ secondPageObj.merchantNo }}</span> <span id="secondmerchantId">{{ secondPageObj.merchantNo }}</span>
</div> </div>
<div> <div>
...@@ -177,15 +177,7 @@ ...@@ -177,15 +177,7 @@
</span> </span>
</el-tree> </el-tree>
</div> </div>
<!-- <form class="layui-form" action="">
<div class="layui-inline">
<div class="layui-input-inline" style="width: 232px">
<input class="layui-input" id="treeInput" placeholder="请输入" name="nameVal" />
</div>
<button type="button" id="merchantBtn" class="layui-btn">查询</button>
</div>
</form>
<ul id="merchantTree" class="ztree wrapper-tree"></ul> -->
</div> </div>
<div class="merchant-right"> <div class="merchant-right">
<div> <div>
...@@ -200,7 +192,8 @@ ...@@ -200,7 +192,8 @@
<el-button type="primary" id="tableSearch" size="small" @click="getSecondTable">查询</el-button> <el-button type="primary" id="tableSearch" size="small" @click="getSecondTable">查询</el-button>
</div> </div>
</div> </div>
<GLTable ref="subMerchantTable" :tableTotal="subMerchantTableTotal" :hasPage="false" :tableData="subMerchantTableList" :hasNum="true" :pageConf="pageConf" :tableParams="secondtableParams" @refreshTable="getSecondTable"></GLTable> <!-- :height="'350px'" -->
<GLTable ref="subMerchantTable" :tableTotal="subMerchantTableTotal" :hasPage="false" :tableData="subMerchantTableList" :hasNum="true" :pageConf="pageConf" :tableParams="secondtableParams" @refreshTable="getSecondTable"></GLTable>
</div> </div>
</div> </div>
</div> </div>
...@@ -432,12 +425,14 @@ export default { ...@@ -432,12 +425,14 @@ export default {
let data = this.formateNullFieldData(res) let data = this.formateNullFieldData(res)
this.subMerchantTableList = data this.subMerchantTableList = data
// this.subMerchantTableList = res
this.subMerchantTableTotal = res.length this.subMerchantTableTotal = res.length
} }
if (res && res.length == 0) { // total > 50?calc(100vh - '199px'): calc(100vh - '152px')
this.$refs.subMerchantTable.setTableHeightFun() this.$refs.subMerchantTable.tableHeightValues=`calc(100vh - 300px)`
} // if (res && res.length == 0) {
// this.$refs.subMerchantTable.setTableHeightFun()
// }
}) })
}, },
getThirdTable() { getThirdTable() {
...@@ -570,6 +565,8 @@ export default { ...@@ -570,6 +565,8 @@ export default {
// line-height: 20px; // line-height: 20px;
display: inline-block; display: inline-block;
width: calc(100% - 200px); width: calc(100% - 200px);
word-wrap:break-word;
line-height:initial;
} }
.account-type-span { .account-type-span {
display: inline-block; display: inline-block;
...@@ -662,7 +659,9 @@ export default { ...@@ -662,7 +659,9 @@ export default {
.merchant-left { .merchant-left {
padding-top: 15px; padding-top: 15px;
padding-left: 20px; padding-left: 20px;
min-height: calc(100vh - 200px); // min-height: calc(100vh - 200px);
// max-height: 100vh;
background-color: #fff; background-color: #fff;
width: 360px; width: 360px;
margin-right: 20px; margin-right: 20px;
...@@ -714,6 +713,8 @@ export default { ...@@ -714,6 +713,8 @@ export default {
} }
.secondTreeWrap { .secondTreeWrap {
margin-top: 20px; margin-top: 20px;
height: calc(100vh - 350px);
overflow-y: auto;
} }
} }
// .ztree .wrapper-tree { // .ztree .wrapper-tree {
......
...@@ -267,13 +267,13 @@ export default { ...@@ -267,13 +267,13 @@ export default {
methods: { methods: {
hanleTab(status) { hanleTab(status) {
if (this.editStatus) { if (this.editStatus) {
this.$confirm("离开将不保存本页修改", "提示", { this.$confirm("是否保存修改信息?", "提示", {
confirmButtonText: "确定", confirmButtonText: "确定",
cancelButtonText: "取消", cancelButtonText: "取消",
type: "warning", type: "warning",
}) })
.then(() => { .then(() => {
this.handleNext(status); status == 1? this.handleNext(status):this.handleSave(status);
}) })
.catch(() => { .catch(() => {
this.tabCancel(status); this.tabCancel(status);
...@@ -306,7 +306,7 @@ export default { ...@@ -306,7 +306,7 @@ export default {
this.$router.push("/account/index"); this.$router.push("/account/index");
}, },
//保存 //保存
handleSave() { handleSave(status) {
let product = this.$refs.productForm.getSelectInfo(); let product = this.$refs.productForm.getSelectInfo();
if (product && product.every((item) => item.products.length == 0)) { if (product && product.every((item) => item.products.length == 0)) {
this.$message.error("请选择产品"); this.$message.error("请选择产品");
...@@ -319,9 +319,9 @@ export default { ...@@ -319,9 +319,9 @@ export default {
merchantId: this.accountAddForm.id, merchantId: this.accountAddForm.id,
}; };
this.$apis.store.updatePermissions(params).then((res) => { this.$apis.store.updatePermissions(params).then((res) => {
if (res) { if (res) {
this.$router.push("/account/index"); status ? this.handleTabs(status) : this.$router.push("/account/index");
} }
}); });
}, },
//下一步 //下一步
...@@ -417,13 +417,13 @@ export default { ...@@ -417,13 +417,13 @@ export default {
para = { para = {
id: this.accountAddForm.id, id: this.accountAddForm.id,
parentId: res.parentId, parentId: res.parentId,
accountLevel: res.merchantAccountLevel, accountlevel: res.merchantAccountLevel,
}; };
} else { } else {
para = { para = {
ids: res.accountType, ids: res.accountType,
merchantId: res.id, merchantId: res.id,
accountLevel: res.merchantAccountLevel, accountlevel: res.merchantAccountLevel,
}; };
} }
this.$refs.productForm.accountTypeSearchRequest(para, res.parentMerchant); this.$refs.productForm.accountTypeSearchRequest(para, res.parentMerchant);
......
<template> <template>
<div class="account-body scrm-box-f" v-loading="loading" v-if="tabMenuStatus"> <div class="account-body scrm-box-f" v-loading="loading" v-if="tabMenuStatus">
<div class="account-title">{{ title }}</div> <div class="account-title">{{ title }}</div>
<el-tabs <el-tabs v-if="tabMenu.length != 0" v-model="tabName" type="card" @tab-click="handleClik">
v-if="tabMenu.length != 0"
v-model="tabName"
type="card"
@tab-click="handleClik"
>
<template v-for="(item, index) in tabMenu"> <template v-for="(item, index) in tabMenu">
<el-tab-pane <el-tab-pane v-show="item && item.accounttypeId" :label="item.accounttypeName" :name="item.accounttypeId" v-if="item" :key="index"></el-tab-pane>
v-show="item && item.accounttypeId"
:label="item.accounttypeName"
:name="item.accounttypeId"
v-if="item"
:key="index"
></el-tab-pane>
</template> </template>
</el-tabs> </el-tabs>
<div <div class="account-select-pro" v-for="(item, index) in tabMenu" :key="index" v-show="tabName == item.accounttypeId">
class="account-select-pro"
v-for="(item, index) in tabMenu"
:key="index"
v-show="tabName == item.accounttypeId"
>
<label>选择产品</label> <label>选择产品</label>
<el-checkbox-group v-model="item.productsArr" @change="selectPro"> <el-checkbox-group v-model="item.productsArr" @change="selectPro">
<el-checkbox v-for="(itm, idx) in item.products" :label="itm" :key="idx">{{ <el-checkbox v-for="(itm, idx) in item.products" :label="itm" :key="idx">{{ itm.productName }}</el-checkbox>
itm.productName
}}</el-checkbox>
</el-checkbox-group> </el-checkbox-group>
</div> </div>
<div class="account-select-menu">请选择产品权限</div> <div class="account-select-menu">请选择产品权限</div>
...@@ -35,52 +17,20 @@ ...@@ -35,52 +17,20 @@
<div class="menu-box-panel"> <div class="menu-box-panel">
<div :key="index" v-for="(item, index) in tabMenu"> <div :key="index" v-for="(item, index) in tabMenu">
<div class="menu-box-tab" v-show="tabName == item.accounttypeId"> <div class="menu-box-tab" v-show="tabName == item.accounttypeId">
<div <div v-show="item.productsArr.indexOf(itm) != -1" class="tab-item text-hide" :class="{ 'select-checked': productTab == itm.productId }" @click="productClick(itm.productId)" v-for="(itm, idx) in item.products" :key="idx">
v-show="item.productsArr.indexOf(itm) != -1"
class="tab-item text-hide"
:class="{ 'select-checked': productTab == itm.productId }"
@click="productClick(itm.productId)"
v-for="(itm, idx) in item.products"
:key="idx"
>
{{ itm.productName }} {{ itm.productName }}
</div> </div>
</div> </div>
<div <div v-show="tabName == item.accounttypeId" class="menu-box-tree" v-if="item.products" :style="{ 'min-height': treeHeight + 'px' }">
v-show="tabName == item.accounttypeId"
class="menu-box-tree"
v-if="item.products"
:style="{ 'min-height': treeHeight + 'px' }"
>
<div v-for="(itm, idx) in item.products" :key="idx"> <div v-for="(itm, idx) in item.products" :key="idx">
<div <div class="nodata" v-if="item.productsArr.length == 0 || itm.merchantProTreeResponses.length == 0">
class="nodata"
v-if="
item.productsArr.length == 0 || itm.merchantProTreeResponses.length == 0
"
>
<img src="../../../assets/img/empty.png" alt="" /> <img src="../../../assets/img/empty.png" alt="" />
<div> <div>
{{ item.productsArr.length == 0 ? "请先选择产品" : "暂无菜单权限" }} {{ item.productsArr.length == 0 ? '请先选择产品' : '暂无菜单权限' }}
</div> </div>
</div> </div>
<div v-else> <div v-else>
<el-tree <el-tree v-show="productTab == itm.productId" :data="itm.merchantProTreeResponses" show-checkbox check-strictly check-on-click-node :expand-on-click-node="false" default-expand-all node-key="id" :class="'tree_' + item.accounttypeId + '_' + itm.productId" :ref="`tree_${item.accounttypeId}_${itm.productId}`" highlight-current :render-content="renderContent" :props="defaultProps" @check="clickDeal"></el-tree>
v-show="productTab == itm.productId"
:data="itm.merchantProTreeResponses"
show-checkbox
check-strictly
check-on-click-node
:expand-on-click-node="false"
default-expand-all
node-key="id"
:class="'tree_' + item.accounttypeId + '_' + itm.productId"
:ref="`tree_${item.accounttypeId}_${itm.productId}`"
highlight-current
:render-content="renderContent"
:props="defaultProps"
@check="clickDeal"
></el-tree>
</div> </div>
</div> </div>
</div> </div>
...@@ -90,16 +40,16 @@ ...@@ -90,16 +40,16 @@
</div> </div>
</template> </template>
<script> <script>
import util from "@/utils/util"; import util from '@/utils/util'
export default { export default {
name: "product", name: 'product',
props: { props: {
title: { title: {
type: String, type: String
}, },
roleType: { roleType: {
type: Boolean, type: Boolean
}, }
}, },
data() { data() {
return { return {
...@@ -115,208 +65,200 @@ export default { ...@@ -115,208 +65,200 @@ export default {
productId: 0, productId: 0,
products: [], products: [],
productsArr: [], productsArr: [],
tabName: "", tabName: '',
productTab: "", productTab: '',
defaultProps: { defaultProps: {
children: "children", children: 'children',
label: "label", label: 'label'
}, },
accountTypes: [], accountTypes: []
}; }
}, },
watch: { watch: {
tabMenu: { tabMenu: {
handler() { handler() {
this.tabMenuStatus = this.tabMenu.every(item=>item) this.tabMenuStatus = this.tabMenu.some(item => item)
}, },
deep: true, deep: true
}, }
}, },
methods: { methods: {
handleClik(tab, event) { handleClik(tab, event) {
console.log(tab, event); console.log(tab, event)
const tabId = tab.name; const tabId = tab.name
const productTab = this.tabMenu.find( const productTab = this.tabMenu.find(i => i.accounttypeId == tabId)
(i) => i.accounttypeId == tabId this.productTab = productTab.productsArr[0] ? productTab.productsArr[0].productId : ''
)
this.productTab = productTab.productsArr[0]?productTab.productsArr[0].productId:'';
}, },
selectPro(data) { selectPro(data) {
this.$parent.roleRootRules = false; this.$parent.roleRootRules = false
this.$parent.editStatus = true; this.$parent.editStatus = true
this.productTab = data.length != 0 ? data[data.length - 1].productId : ""; this.productTab = data.length != 0 ? data[data.length - 1].productId : ''
const { tabName, tabMenu, productTab } = this; const { tabName, tabMenu, productTab } = this
console.log(tabName, data, productTab, "选中"); console.log(tabName, data, productTab, '选中')
// 设置全选 // 设置全选
var arr = tabMenu var arr = tabMenu.find(i => i.accounttypeId == tabName).products.find(j => j.productId == productTab).merchantProTreeResponses
.find((i) => i.accounttypeId == tabName) this.$refs[`tree_${tabName}_${productTab}`] ? this.$refs[`tree_${tabName}_${productTab}`][0].setCheckedKeys(this.getAllId(arr)) : ''
.products.find((j) => j.productId == productTab).merchantProTreeResponses; console.log(tabMenu)
this.$refs[`tree_${tabName}_${productTab}`]?this.$refs[`tree_${tabName}_${productTab}`][0].setCheckedKeys(this.getAllId(arr)):'';
console.log(tabMenu);
}, },
productClick(productId) { productClick(productId) {
this.productTab = productId; this.productTab = productId
}, },
findMenuFunTree(id, status) { findMenuFunTree(id, status) {
console.log(id, status); console.log(id, status)
let tabMenu = util.deepClone(this.tabMenu_r); let tabMenu = util.deepClone(this.tabMenu_r)
let menu = tabMenu.filter((item) => item.accounttypeId == id); let menu = tabMenu.filter(item => item.accounttypeId == id)
let index = tabMenu.findIndex((item) => item.accounttypeId == id); let index = tabMenu.findIndex(item => item.accounttypeId == id)
this.tabMenu_r.forEach((item, index) => { this.tabMenu_r.forEach((item, index) => {
if (!this.tabMenu[index]) { if (!this.tabMenu[index]) {
this.$set(this.tabMenu, index, ""); this.$set(this.tabMenu, index, '')
} }
}); })
if (status) { if (status) {
this.$set(this.tabMenu, index, menu[0]); this.$set(this.tabMenu, index, menu[0])
} else { } else {
this.$set(this.tabMenu, index, ""); this.$set(this.tabMenu, index, '')
} }
}, },
// 获取当前的所有权限 // 获取当前的所有权限
async findMenuFunTreeByMerId(params) { async findMenuFunTreeByMerId(params) {
let tabMenu = await this.$apis.store.findMenuFunTreeByMerId(params); let tabMenu = await this.$apis.store.findMenuFunTreeByMerId(params)
tabMenu = tabMenu.map((item) => { tabMenu = tabMenu.map(item => {
return { return {
productsArr: [], productsArr: [],
products: item.products, products: item.products,
accounttypeName: item.accounttypeName, accounttypeName: item.accounttypeName,
accounttypeId: item.accounttypeId, accounttypeId: item.accounttypeId
}; }
}); })
this.tabMenu_r = util.deepClone(tabMenu); this.tabMenu_r = util.deepClone(tabMenu)
this.$nextTick(() => { this.$nextTick(() => {
this.addStyle(); this.addStyle()
}); })
this.accountTypes = tabMenu.map((item) => { this.accountTypes = tabMenu.map(item => {
return { return {
products: null, products: null,
accounttypeId: item.accounttypeId, accounttypeId: item.accounttypeId
}; }
}); })
this.tabName = this.tabMenu_r[0].accounttypeId; this.tabName = this.tabMenu_r[0].accounttypeId
return this.tabMenu_r; return this.tabMenu_r
}, },
// 获取当前的所有权限 // 获取当前的所有权限
async accountTypeSearchRequest(params, arr) { async accountTypeSearchRequest(params, arr) {
let account = ""; let account = ''
let tabMenu = await this.$apis.store.findMenuFunTreeByMerId(params); let tabMenu = await this.$apis.store.findMenuFunTreeByMerId(params)
this.accountList = tabMenu.map((item) => { this.accountList = tabMenu.map(item => {
return { return {
productsArr: [], productsArr: [],
products: item.products, products: item.products,
accounttypeName: item.accounttypeName, accounttypeName: item.accounttypeName,
accounttypeId: item.accounttypeId, accounttypeId: item.accounttypeId
// merchantProTreeResponses: item.merchantProTreeResponses, // merchantProTreeResponses: item.merchantProTreeResponses,
// productId: '' // productId: ''
}; }
}); })
this.$nextTick(() => { this.$nextTick(() => {
this.addStyle(); this.addStyle()
}); })
console.log(this.accountList); console.log(this.accountList)
this.accountTypes = tabMenu.map((item) => { this.accountTypes = tabMenu.map(item => {
return { return {
products: null, products: null,
accounttypeId: item.accounttypeId, accounttypeId: item.accounttypeId
}; }
}); })
this.tabMenu_s = util.deepClone(this.accountList); this.tabMenu_s = util.deepClone(this.accountList)
// this.tabName = this.tabMenu[0].accounttypeId // this.tabName = this.tabMenu[0].accounttypeId
this.findPermissionsByMerId(arr); this.findPermissionsByMerId(arr)
this.tabMenu_r = util.deepClone(this.accountList); this.tabMenu_r = util.deepClone(this.accountList)
return this.accountList; return this.accountList
}, },
// 获取已选择的权限 // 获取已选择的权限
findPermissionsByMerId(arr) { findPermissionsByMerId(arr) {
arr.forEach((item) => { arr.forEach(item => {
this.accountList.forEach((itm) => { this.accountList.forEach(itm => {
if (item.accounttypeId == itm.accounttypeId) { if (item.accounttypeId == itm.accounttypeId) {
this.tabMenu.push(itm); this.tabMenu.push(itm)
if(!item.productList) { if (!item.productList) {
return return
} }
item.productList.forEach((i) => { item.productList.forEach(i => {
itm.products.forEach((j) => { itm.products.forEach(j => {
if (i.productId == j.productId) { if (i.productId == j.productId) {
itm.productsArr.push(j); itm.productsArr.push(j)
this.$nextTick(() => { this.$nextTick(() => {
this.$refs[ this.$refs[`tree_${itm.accounttypeId}_${j.productId}`][0].setCheckedKeys(i.idList)
`tree_${itm.accounttypeId}_${j.productId}` })
][0].setCheckedKeys(i.idList);
});
} }
}); })
}); })
} }
}); })
}); })
this.tabName = this.tabMenu[0].accounttypeId; this.tabName = this.tabMenu[0].accounttypeId
this.productTab = this.tabMenu[0].productsArr[0].productId; this.productTab = this.tabMenu[0].productsArr[0].productId
}, },
resetView() { resetView() {
this.tabMenu = []; this.tabMenu = []
this.accountList = util.deepClone(this.tabMenu_s); this.accountList = util.deepClone(this.tabMenu_s)
this.tabMenu_x.forEach((item) => { this.tabMenu_x.forEach(item => {
this.accountList.forEach((itm) => { this.accountList.forEach(itm => {
console.log(itm); console.log(itm)
if (item.accounttypeId == itm.accounttypeId) { if (item.accounttypeId == itm.accounttypeId) {
this.tabMenu.push(itm); this.tabMenu.push(itm)
item.products.forEach((i) => { item.products.forEach(i => {
itm.products.forEach((j) => { itm.products.forEach(j => {
if (i.productId == j.productId) { if (i.productId == j.productId) {
itm.productsArr.push(j); itm.productsArr.push(j)
this.$nextTick(() => { this.$nextTick(() => {
this.$refs[ this.$refs[`tree_${itm.accounttypeId}_${j.productId}`] ? this.$refs[`tree_${itm.accounttypeId}_${j.productId}`][0].setCheckedKeys(i.menuIds) : ''
`tree_${itm.accounttypeId}_${j.productId}` })
][0].setCheckedKeys(i.menuIds);
});
} }
}); })
}); })
} }
}); })
}); })
}, },
// 渲染树结构 // 渲染树结构
renderContent(h, v) { renderContent(h, v) {
if (v.data.logo == "functionValue") { if (v.data.logo == 'functionValue') {
return ( return (
<div class="custom-tree-node fun-tree-node"> <div class="custom-tree-node fun-tree-node">
<span>{v.node.label}</span> <span>{v.node.label}</span>
</div> </div>
); )
} else { } else {
return ( return (
<div class="custom-tree-node"> <div class="custom-tree-node">
<span>{v.node.label}</span> <span>{v.node.label}</span>
</div> </div>
); )
} }
}, },
addStyle() { addStyle() {
const nodes = document.getElementsByClassName("fun-tree-node"); const nodes = document.getElementsByClassName('fun-tree-node')
for (let i = 0; i < nodes.length; i++) { for (let i = 0; i < nodes.length; i++) {
const parentNode = nodes[i].parentNode; const parentNode = nodes[i].parentNode
parentNode.style.float = "left"; parentNode.style.float = 'left'
} }
}, },
clickDeal(currentObj, treeStatus) { clickDeal(currentObj, treeStatus) {
this.$parent.editStatus = true; this.$parent.editStatus = true
// 用于:父子节点严格互不关联时,父节点勾选变化时通知子节点同步变化,实现单向关联。 // 用于:父子节点严格互不关联时,父节点勾选变化时通知子节点同步变化,实现单向关联。
let selected = treeStatus.checkedKeys.indexOf(currentObj.id); // -1未选中 let selected = treeStatus.checkedKeys.indexOf(currentObj.id) // -1未选中
// 选中 // 选中
if (selected !== -1) { if (selected !== -1) {
// 子节点只要被选中父节点就被选中 // 子节点只要被选中父节点就被选中
this.selectedParent(currentObj); this.selectedParent(currentObj)
// 统一处理子节点为相同的勾选状态 // 统一处理子节点为相同的勾选状态
this.uniteChildSame(currentObj, true); this.uniteChildSame(currentObj, true)
} else { } else {
// 未选中 处理子节点全部未选中 // 未选中 处理子节点全部未选中
console.log(currentObj); console.log(currentObj)
if (currentObj.children !== null) { if (currentObj.children !== null) {
if (currentObj.children.length !== 0) { if (currentObj.children.length !== 0) {
this.uniteChildSame(currentObj, false); this.uniteChildSame(currentObj, false)
} }
//放开时为当子节点全为未选中时父节点也变为未选中状态 注释后就是父节点不和子节点强制绑定 //放开时为当子节点全为未选中时父节点也变为未选中状态 注释后就是父节点不和子节点强制绑定
// this.uniteParentSame(currentObj.id,treeStatus)//当子节点全为未选中时父节点也变为未选中状态 // this.uniteParentSame(currentObj.id,treeStatus)//当子节点全为未选中时父节点也变为未选中状态
...@@ -328,147 +270,136 @@ export default { ...@@ -328,147 +270,136 @@ export default {
}, },
uniteParentSame(id, treeStatus) { uniteParentSame(id, treeStatus) {
//当子节点全为未选中时父节点也变为未选中状态 //当子节点全为未选中时父节点也变为未选中状态
const tree_ref = `tree_${this.tabName}_${this.productTab}`; const tree_ref = `tree_${this.tabName}_${this.productTab}`
let node = this.$refs[tree_ref][0].getNode(id); //获取当前节点的节点树 let node = this.$refs[tree_ref][0].getNode(id) //获取当前节点的节点树
if (node.parent !== null && node.parent !== undefined) { if (node.parent !== null && node.parent !== undefined) {
let parentNode = node.parent.data; //获取当前节点的父节点树 let parentNode = node.parent.data //获取当前节点的父节点树
if (parentNode != undefined) { if (parentNode != undefined) {
//判断父节点是否存在 //判断父节点是否存在
for (let i = 0; i < parentNode.children.length; i++) { for (let i = 0; i < parentNode.children.length; i++) {
let checkedKeys = this.$refs[tree_ref][0].getCheckedKeys(); let checkedKeys = this.$refs[tree_ref][0].getCheckedKeys()
let hafCheckedKeys = this.$refs[tree_ref][0].getHalfCheckedKeys(); let hafCheckedKeys = this.$refs[tree_ref][0].getHalfCheckedKeys()
let selectNodes = checkedKeys.concat(hafCheckedKeys); //获取已选择树节点 let selectNodes = checkedKeys.concat(hafCheckedKeys) //获取已选择树节点
let selected = selectNodes.indexOf(parentNode.children[i].id); // -1当前节点的同级节点是否全部未选中 let selected = selectNodes.indexOf(parentNode.children[i].id) // -1当前节点的同级节点是否全部未选中
if (selected !== -1) { if (selected !== -1) {
return; return
} }
} }
} else { } else {
return; return
} }
this.$refs[tree_ref][0].setChecked(parentNode.id, false); //修改节点为未选择 this.$refs[tree_ref][0].setChecked(parentNode.id, false) //修改节点为未选择
if (node.level > 2) { if (node.level > 2) {
//判断是否是最上级节点 //判断是否是最上级节点
this.uniteParentSame(parentNode.id, treeStatus); this.uniteParentSame(parentNode.id, treeStatus)
} }
} else { } else {
return; return
} }
}, },
// 统一处理子节点为相同的勾选状态 // 统一处理子节点为相同的勾选状态
uniteChildSame(treeList, isSelected) { uniteChildSame(treeList, isSelected) {
const tree_ref = `tree_${this.tabName}_${this.productTab}`; const tree_ref = `tree_${this.tabName}_${this.productTab}`
this.$refs[tree_ref][0].setChecked(treeList.id, isSelected); this.$refs[tree_ref][0].setChecked(treeList.id, isSelected)
console.log(treeList); console.log(treeList)
if (treeList.children !== null) { if (treeList.children !== null) {
for (let i = 0; i < treeList.children.length; i++) { for (let i = 0; i < treeList.children.length; i++) {
this.uniteChildSame(treeList.children[i], isSelected); this.uniteChildSame(treeList.children[i], isSelected)
} }
} }
}, },
// 统一处理父节点为选中 // 统一处理父节点为选中
selectedParent(currentObj) { selectedParent(currentObj) {
const tree_ref = `tree_${this.tabName}_${this.productTab}`; const tree_ref = `tree_${this.tabName}_${this.productTab}`
let currentNode = this.$refs[tree_ref][0].getNode(currentObj); let currentNode = this.$refs[tree_ref][0].getNode(currentObj)
if (currentNode.parent.key !== undefined) { if (currentNode.parent.key !== undefined) {
this.$refs[tree_ref][0].setChecked(currentNode.parent, true); this.$refs[tree_ref][0].setChecked(currentNode.parent, true)
this.selectedParent(currentNode.parent); this.selectedParent(currentNode.parent)
} }
}, },
// 获取所有节点的id // 获取所有节点的id
getAllId(data, arr = []) { getAllId(data, arr = []) {
if (data) { if (data) {
data.forEach((item) => { data.forEach(item => {
arr.push(item.id); arr.push(item.id)
if (item.children && item.children.length != 0) { if (item.children && item.children.length != 0) {
item.children.forEach((i) => { item.children.forEach(i => {
arr.push(i.id); arr.push(i.id)
this.getAllId(i.children, arr); this.getAllId(i.children, arr)
}); })
} }
}); })
} }
return arr; return arr
}, },
getSelectInfo() { getSelectInfo() {
this.tabMenu = this.tabMenu.filter(item=>item) this.tabMenu = this.tabMenu.filter(item => item)
this.accountTypes = this.tabMenu.map((item) => { this.accountTypes = this.tabMenu.map(item => {
let products = []; let products = []
let productList = []; let productList = []
item.productsArr.forEach((itm) => { item.productsArr.forEach(itm => {
const checkedNodes = this.$refs[`tree_${item.accounttypeId}_${itm.productId}`] const checkedNodes = this.$refs[`tree_${item.accounttypeId}_${itm.productId}`] ? this.$refs[`tree_${item.accounttypeId}_${itm.productId}`][0].getCheckedNodes() : []
? this.$refs[ console.log(checkedNodes)
`tree_${item.accounttypeId}_${itm.productId}`
][0].getCheckedNodes()
: [];
console.log(checkedNodes);
const menuIdList = checkedNodes const menuIdList = checkedNodes
// .filter((item) => item.logo === "menu") // .filter((item) => item.logo === "menu")
.filter( .filter(item => item.logo !== 'function' && item.logo !== 'functionValue' && item.logo !== 'neglect')
(item) => .map(i => i.id) // 全选菜单idlist
item.logo !== "function" &&
item.logo !== "functionValue" &&
item.logo !== "neglect"
)
.map((i) => i.id); // 全选菜单idlist
// const partSelectList = halfCheckedNodes.filter(item => item.logo === 'menu').map(i => i.id) // 半选菜单idlist // const partSelectList = halfCheckedNodes.filter(item => item.logo === 'menu').map(i => i.id) // 半选菜单idlist
const functionIdList = checkedNodes.filter((item) => item.logo === "function"); const functionIdList = checkedNodes.filter(item => item.logo === 'function')
const functionValueIdLists = checkedNodes.filter( const functionValueIdLists = checkedNodes.filter(item => item.logo === 'functionValue')
(item) => item.logo === "functionValue" var list = []
);
var list = [];
/** { menuId, id, functionValue} */ /** { menuId, id, functionValue} */
if (functionValueIdLists.length !== 0) { if (functionValueIdLists.length !== 0) {
functionValueIdLists.forEach((j, index) => { functionValueIdLists.forEach((j, index) => {
if (list.map((item) => item.id).includes(j.parentId)) { if (list.map(item => item.id).includes(j.parentId)) {
const obj = list.find((k) => k.id === j.parentId); const obj = list.find(k => k.id === j.parentId)
obj.functionValue += ";" + j.id + ":" + j.label; obj.functionValue += ';' + j.id + ':' + j.label
} else { } else {
list.push({ list.push({
id: j.parentId, id: j.parentId,
menuId: j.superParentId, menuId: j.superParentId,
functionValue: j.id + ":" + j.label, functionValue: j.id + ':' + j.label
}); })
} }
}); })
} }
console.log(menuIdList, functionIdList, functionValueIdLists, list); console.log(menuIdList, functionIdList, functionValueIdLists, list)
if (this.roleType) { if (this.roleType) {
productList.push({ productList.push({
productId: itm.productId, productId: itm.productId,
functionIdList: functionIdList, functionIdList: functionIdList,
// functionValue: list, // functionValue: list,
menuIdList: menuIdList, menuIdList: menuIdList
}); })
} else { } else {
products.push({ products.push({
productId: itm.productId, productId: itm.productId,
functionIds: functionIdList, functionIds: functionIdList,
functionValue: list, functionValue: list,
menuIds: menuIdList, menuIds: menuIdList
}); })
} }
}); })
if (this.roleType) { if (this.roleType) {
return { return {
accounttypeId: item.accounttypeId, accounttypeId: item.accounttypeId,
productList, productList
}; }
} else { } else {
return { return {
accounttypeId: item.accounttypeId, accounttypeId: item.accounttypeId,
products, products
}; }
} }
}); })
return this.accountTypes; return this.accountTypes
}, }
}, },
mounted() { mounted() {
// this.accountTypeSearchRequest(); // this.accountTypeSearchRequest();
// this.findPermissionsByMerId() // this.findPermissionsByMerId()
}, }
}; }
</script> </script>
<style scoped lang="scss"> <style scoped lang="scss">
......
...@@ -25,7 +25,7 @@ ...@@ -25,7 +25,7 @@
</el-form-item> </el-form-item>
<!-- <el-form-item label="角色权限" prop="roleRoot"> <!-- <el-form-item label="角色权限" prop="roleRoot">
<div class="custom_element"> <div class="custom_element">
<template v-for="(item, index) in accountList"> <template v-for="(item, index) in accountListSelect">
<div :key="index" class="wrap"> <div :key="index" class="wrap">
<AutoButton @getBtnStatus="selectCurAccount(item, index)" :typeStatus="item.select" :btnLabel="item.accounttypeName"></AutoButton> <AutoButton @getBtnStatus="selectCurAccount(item, index)" :typeStatus="item.select" :btnLabel="item.accounttypeName"></AutoButton>
</div> </div>
...@@ -41,7 +41,7 @@ ...@@ -41,7 +41,7 @@
<auto-button v-for="(item, index) in accountDetail.accountTypes" :key="index" :btnLabel="item.accounttypeName" :btnValue="item.accounttypeId" :stopClick="nextStatus" @getBtnStatus="getBtnStatus"></auto-button> <auto-button v-for="(item, index) in accountDetail.accountTypes" :key="index" :btnLabel="item.accounttypeName" :btnValue="item.accounttypeId" :stopClick="nextStatus" @getBtnStatus="getBtnStatus"></auto-button>
</div> --> </div> -->
<div class="custom_element"> <div class="custom_element">
<template v-for="(item, index) in accountList"> <template v-for="(item, index) in accountListSelect">
<div :key="index" class="wrap"> <div :key="index" class="wrap">
<AutoButton @getBtnStatus="selectCurAccount(item, index)" :typeStatus="item.select" :btnLabel="item.accounttypeName"></AutoButton> <AutoButton @getBtnStatus="selectCurAccount(item, index)" :typeStatus="item.select" :btnLabel="item.accounttypeName"></AutoButton>
</div> </div>
...@@ -106,7 +106,7 @@ export default { ...@@ -106,7 +106,7 @@ export default {
pageName: '新增角色', pageName: '新增角色',
roleInfo: null, roleInfo: null,
pageType: 'create', pageType: 'create',
accountList: [], accountListSelect: [],
//商户 //商户
merchantList: [], merchantList: [],
// tree数据 // tree数据
...@@ -145,7 +145,8 @@ export default { ...@@ -145,7 +145,8 @@ export default {
} }
} }
} }
this.accountList = res this.accountListSelect = res
console.log(this.accountListSelect)
}) })
}, },
getMerchantName() { getMerchantName() {
...@@ -168,18 +169,18 @@ export default { ...@@ -168,18 +169,18 @@ export default {
// 选择商户----获取权限 // 选择商户----获取权限
async selectMerchant(id) { async selectMerchant(id) {
let res = await this.$refs.productFrom.findMenuFunTreeByMerId({ id }) let res = await this.$refs.productFrom.findMenuFunTreeByMerId({ id })
this.accountList = res.map(item => { this.accountListSelect = res.map(item => {
item.select = false item.select = false
return item return item
}) })
// this.rootList = this.accountList // this.rootList = this.accountListSelect
}, },
// 选择商户权限 // 选择商户权限
selectCurAccount(item, index) { selectCurAccount(item, index) {
this.roleRootRules = false this.roleRootRules = false
this.accountList[index].select = !item.select this.accountListSelect[index].select = !item.select
this.curRootIndex = 0 this.curRootIndex = 0
if (this.accountList[index].select) { if (this.accountListSelect[index].select) {
this.rootList.push(item) this.rootList.push(item)
} else { } else {
let arr = this.rootList.filter(el => { let arr = this.rootList.filter(el => {
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!