Commit f3beea0e by ym

上传

1 parent c22ae062
...@@ -8,11 +8,13 @@ ...@@ -8,11 +8,13 @@
*/ */
import { http_common } from '@/main' import { http_common } from '@/main'
const pictureUpload = params => { const pictureUpload = params => {
params.method = "glsx.accounts.biz.common.pictureUpload"
return http_common({ return http_common({
url: '/router?method=glsx.accounts.biz.common.pictureUpload', url: '/router?method=glsx.accounts.biz.common.pictureUpload',
method: 'POST', method: 'POST',
data: params, data: params,
sign: true sign: true,
noSignAttr: ['file']
}) })
} }
export default { export default {
......
...@@ -64,8 +64,16 @@ const updateMerchant = params => { ...@@ -64,8 +64,16 @@ const updateMerchant = params => {
sign: true sign: true
}) })
} }
const accountTypeSearchRequest = params => {
//功能权限 params.method = 'cn.com.glsx.merchants.merchant.accountTypeSearchRequest'
return http({
url: '/rop-merchants/router',
method: 'POST',
data: params,
sign: true
})
}
//功能权限
const findPermissionsByMerId = params => { const findPermissionsByMerId = params => {
params.method = 'cn.com.glsx.merchants.merchant.findPermissionsByMerId' params.method = 'cn.com.glsx.merchants.merchant.findPermissionsByMerId'
return http({ return http({
...@@ -104,5 +112,6 @@ export default { ...@@ -104,5 +112,6 @@ export default {
updateMerchant, updateMerchant,
findPermissionsByMerId, findPermissionsByMerId,
findMenuFunTreeByMerId, findMenuFunTreeByMerId,
updatePermissions updatePermissions,
accountTypeSearchRequest
} }
\ No newline at end of file \ No newline at end of file
...@@ -89,6 +89,11 @@ export default { ...@@ -89,6 +89,11 @@ export default {
.map-box { .map-box {
position: relative; position: relative;
width: 100%; width: 100%;
/deep/ {
.el-dialog__body {
padding: 20px 10px;
}
}
} }
#container { #container {
position: absolute; position: absolute;
......
...@@ -13,6 +13,7 @@ import './public-path' ...@@ -13,6 +13,7 @@ import './public-path'
// import 'glsx-components/dist/glsx-components.css' // import 'glsx-components/dist/glsx-components.css'
import { start } from '@/setup' import { start } from '@/setup'
import VueAMap from "vue-amap"; import VueAMap from "vue-amap";
import filters from './utils/filters' //新增过滤器
Vue.use(VueAMap); Vue.use(VueAMap);
// 初始化vue-amap // 初始化vue-amap
VueAMap.initAMapApiLoader({ VueAMap.initAMapApiLoader({
...@@ -28,4 +29,7 @@ export { bootstrap, mount, unmount } ...@@ -28,4 +29,7 @@ export { bootstrap, mount, unmount }
from '@/setup' from '@/setup'
export const http = params => Vue.prototype.$http(params) export const http = params => Vue.prototype.$http(params)
export const http_common = params => Vue.prototype.$http_common(params) export const http_common = params => Vue.prototype.$http_common(params)
export const http_config = params => Vue.prototype.$http_config(params)
\ No newline at end of file \ No newline at end of file
export const http_config = params => Vue.prototype.$http_config(params)
Object.keys(filters).forEach(key => {
Vue.filter(key, filters[key]);
});
\ No newline at end of file \ No newline at end of file
...@@ -13,7 +13,7 @@ let routes = [] ...@@ -13,7 +13,7 @@ let routes = []
let router = null let router = null
let instance = null let instance = null
export async function bootstrap({ name, id, history, common, messenger, globalState }) { export async function bootstrap({ name, id, history, common, messenger, globalState }) {
const { response, request, sign, secret, request_common, request_config } = await fetchConfig(globalState.configSwitch) const { response, request, sign, secret, request_common, request_config, sign_common } = await fetchConfig()
console.log(request) console.log(request)
Vue.prototype.$history = history Vue.prototype.$history = history
Vue.prototype.$messenger = messenger Vue.prototype.$messenger = messenger
...@@ -21,7 +21,7 @@ export async function bootstrap({ name, id, history, common, messenger, globalSt ...@@ -21,7 +21,7 @@ export async function bootstrap({ name, id, history, common, messenger, globalSt
console.log(globalState) console.log(globalState)
Vue.prototype.$common = common Vue.prototype.$common = common
Vue.prototype.$http = new common.Http({ response, request, sign, secret, alert: ElementUI.Message.error, headers: { TGT: globalState.session.token } }) Vue.prototype.$http = new common.Http({ response, request, sign, secret, alert: ElementUI.Message.error, headers: { TGT: globalState.session.token } })
Vue.prototype.$http_common = new common.Http({ response, request: request_common, sign, secret, alert: ElementUI.Message.error, headers: { TGT: globalState.session.token } }) Vue.prototype.$http_common = new common.Http({ response, signWay: "md5", request: request_common, sign: sign_common, secret, alert: ElementUI.Message.error, headers: { TGT: globalState.session.token } })
Vue.prototype.$http_config = new common.Http({ response, request: request_config, sign, secret, alert: ElementUI.Message.error, headers: { token: globalState.session.token } }) Vue.prototype.$http_config = new common.Http({ response, request: request_config, sign, secret, alert: ElementUI.Message.error, headers: { token: globalState.session.token } })
// Vue.prototype.$setGlobalState = globalState.actions.setGlobalState // Vue.prototype.$setGlobalState = globalState.actions.setGlobalState
Vue.use(GLButton, { permissions: globalState.permissions || ['1-1-1-1', '2-1-1-1', '3-1-1-1'] }) Vue.use(GLButton, { permissions: globalState.permissions || ['1-1-1-1', '2-1-1-1', '3-1-1-1'] })
......
/**
* 省略多余字符,用...显示
* @param {String} value
* @param {number} len
*/
const ellipsis=(value, len)=> {
if (!value) return ''
if (value.length > len) {
return value.slice(0, len) + '...'
}
return value
}
//过滤器
/* eslint-disable */
const overThousandFilter = (val) => {
if(typeof(val)!='number'){
return false;
}
if (val < 1000) return val;
let a = val + "";
let b = a.split("");
b.splice(-3, 0, ",");
return b.join("");
};
//来源 value值转为对应label(来源)
const toLabel=(value)=> {
if (value!==0 && !value) {
return
}
let sourceList=JSON.parse(window.localStorage.getItem('sourceList'));
let curElement =sourceList.find(item => {
return item.value === value
})
return curElement.label
}
export default {
overThousandFilter,
toLabel,
ellipsis
};
...@@ -5,9 +5,14 @@ ...@@ -5,9 +5,14 @@
<span>创建子商户/门店</span> <span>创建子商户/门店</span>
</div> </div>
<div class="account-body scrm-box-f"> <div class="account-body scrm-box-f">
<div class="form-title">企业基本信息</div> <div class="form-title">企业基本信息</div>
<base-info ref="baseInfoForm" :brandData="brandData" :accountAddForm="accountAddForm" :businessScopeCustomize="businessScopeCustomize" :businessOption="businessOption"></base-info> <base-info
ref="baseInfoForm"
:brandData="brandData"
:accountAddForm="accountAddForm"
:businessScopeCustomize="businessScopeCustomize"
:businessOption="businessOption"
></base-info>
<!-- <el-form <!-- <el-form
ref="baseForm" ref="baseForm"
:model="accountAddForm" :model="accountAddForm"
...@@ -306,7 +311,7 @@ ...@@ -306,7 +311,7 @@
</el-col> </el-col>
</el-row> </el-row>
<el-row> <el-row>
<el-col :span="12"> <el-col :span="16">
<div data-v-995a4ff0="" class="el-form-item is-required"> <div data-v-995a4ff0="" class="el-form-item is-required">
<label <label
for="merchantLoginAccount" for="merchantLoginAccount"
...@@ -338,9 +343,7 @@ ...@@ -338,9 +343,7 @@
<select-product <select-product
v-show="step == 2" v-show="step == 2"
ref="productForm" ref="productForm"
:parentId="parentId" title="功能权限"
:pid="accountAddForm.parentId"
:accountlevel="accountDetail.merchantAccountLevel"
></select-product> ></select-product>
<div <div
class="footer-panel" class="footer-panel"
...@@ -379,7 +382,7 @@ export default { ...@@ -379,7 +382,7 @@ export default {
mapView, mapView,
autoButton, autoButton,
selectProduct, selectProduct,
baseInfo baseInfo,
}, },
data() { data() {
const validatePhone = (rule, value, callback) => { const validatePhone = (rule, value, callback) => {
...@@ -407,6 +410,7 @@ export default { ...@@ -407,6 +410,7 @@ export default {
businessScopeCustomize: [{ name: "" }], businessScopeCustomize: [{ name: "" }],
accountAddForm: { accountAddForm: {
status: 1, status: 1,
merchantFiles: [],
merchantType: 1, merchantType: 1,
businessScope: [], businessScope: [],
parentId: "", parentId: "",
...@@ -549,13 +553,16 @@ export default { ...@@ -549,13 +553,16 @@ export default {
if (params.businessScope) { if (params.businessScope) {
params.businessScope = params.businessScope.join(","); params.businessScope = params.businessScope.join(",");
} }
console.log(this.$refs.baseInfoForm) console.log(this.$refs.baseInfoForm);
params.merchantBrand = this.$refs.baseInfoForm.$refs.brandTree.getCheckedKeys().join(","); params.merchantBrand = this.$refs.baseInfoForm.$refs.brandTree
.getCheckedKeys()
.join(",");
params.isloginName ? (params.isloginName = 1) : (params.isloginName = 0); params.isloginName ? (params.isloginName = 1) : (params.isloginName = 0);
params.merchantAccountLevel = this.accountDetail.merchantAccountLevel; params.merchantAccountLevel = this.accountDetail.merchantAccountLevel;
let businessScopeCustomize = this.businessScopeCustomize.map((item) => item.name); let businessScopeCustomize = this.businessScopeCustomize.map((item) => item.name);
params.businessScopeCustomize = businessScopeCustomize.join(","); params.businessScopeCustomize = businessScopeCustomize.join(",");
params.accounttypeId = this.accounttypeId.join(","); params.accounttypeId = this.accounttypeId.join(",");
params.merchantFiles = JSON.stringify(params.merchantFiles)
let merchant; let merchant;
if (this.nextStatus) { if (this.nextStatus) {
merchant = "updateMerchant"; merchant = "updateMerchant";
...@@ -570,7 +577,12 @@ export default { ...@@ -570,7 +577,12 @@ export default {
this.nextStatus = true; this.nextStatus = true;
if (typeof res == "number") { if (typeof res == "number") {
this.parentId = res; this.parentId = res;
this.$refs.productForm.findMenuFunTreeByMerId(); let para = {
accountlevel: this.accountDetail.merchantAccountLevel,
id: this.parentId,
parentId: this.accountAddForm.parentId,
};
this.$refs.productForm.findMenuFunTreeByMerId(para);
} }
this.twoMerchantDetail(this.parentId); this.twoMerchantDetail(this.parentId);
} }
...@@ -583,9 +595,6 @@ export default { ...@@ -583,9 +595,6 @@ export default {
}; };
this.$apis.store.findAllDictData(params).then((res) => { this.$apis.store.findAllDictData(params).then((res) => {
if (res) { if (res) {
if (dictType == "account_level") {
this.accountLevel = res;
}
if (dictType == "business_scope") { if (dictType == "business_scope") {
this.businessOption = res; this.businessOption = res;
} }
...@@ -602,6 +611,16 @@ export default { ...@@ -602,6 +611,16 @@ export default {
this.accountDetail = await this.$apis.store.findMerchantDetail({ this.accountDetail = await this.$apis.store.findMerchantDetail({
id: this.accountAddForm.parentId, id: this.accountAddForm.parentId,
}); });
this.$apis.store.findAllDictData({ dictType: "account_level" }).then((res) => {
this.accountLevel = res
// if (this.accountDetail.merchantAccountLevel == 1) {
// this.accountLevel = res.filter((item) => {
// item.dictValue != 1 && item.dictValue != 3;
// });
// console.log
// this.accountDetail.merchantAccountLevel = 2;
// }
});
}, },
twoMerchantDetail(pid) { twoMerchantDetail(pid) {
this.$apis.store this.$apis.store
...@@ -625,7 +644,6 @@ export default { ...@@ -625,7 +644,6 @@ export default {
this.accountAddForm.parentId = this.$route.params.id; this.accountAddForm.parentId = this.$route.params.id;
this.findMerchantDetail(); this.findMerchantDetail();
this.getCarbrandTree(); this.getCarbrandTree();
this.findAllDictData("account_level");
this.findAllDictData("business_scope"); this.findAllDictData("business_scope");
}, },
}; };
......
...@@ -275,7 +275,7 @@ export default { ...@@ -275,7 +275,7 @@ export default {
label: "label", label: "label",
}, },
dialogMapVisible: false, dialogMapVisible: false,
mapHeight: 300, mapHeight: 380,
baseRules: { baseRules: {
merchantName: [{ required: true, message: "请输入商户名称", trigger: "blur" }], merchantName: [{ required: true, message: "请输入商户名称", trigger: "blur" }],
merchantLegalPersonPhone: [ merchantLegalPersonPhone: [
...@@ -288,8 +288,15 @@ export default { ...@@ -288,8 +288,15 @@ export default {
methods: { methods: {
getAddress() { getAddress() {
if(!this.$refs.mapForm.address) {
this.$message.error("请选择地址");
return;
}
this.dialogMapVisible = false; this.dialogMapVisible = false;
this.accountAddForm.merchantAddress = this.$refs.mapForm.address; this.accountAddForm.merchantAddress = this.$refs.mapForm.address;
let lnglat = this.$refs.mapForm.lnglat
this.accountAddForm.lat = lnglat.lat
this.accountAddForm.lng = lnglat.lng
}, },
delImg(index) { delImg(index) {
this.accountAddForm.merchantFiles.splice(index, 1); this.accountAddForm.merchantFiles.splice(index, 1);
...@@ -321,7 +328,7 @@ export default { ...@@ -321,7 +328,7 @@ export default {
console.log(file); console.log(file);
let type = fileName.split(".")[1]; let type = fileName.split(".")[1];
let imgUrl = img.target.result.split(",")[1]; let imgUrl = img.target.result.split(",")[1];
self.loadingImg = true; // self.loadingImg = true;
self.$apis.common self.$apis.common
.pictureUpload({ .pictureUpload({
file: `${type}@${imgUrl}`, file: `${type}@${imgUrl}`,
...@@ -330,7 +337,9 @@ export default { ...@@ -330,7 +337,9 @@ export default {
if (res) { if (res) {
self.accountAddForm.merchantFiles.push({ self.accountAddForm.merchantFiles.push({
fileUrl: res, fileUrl: res,
fileName: ''
}); });
console.log(self.accountAddForm.merchantFiles)
} }
}); });
}; };
......
<template> <template>
<div class="account-body scrm-box-f"> <div class="account-body scrm-box-f">
<div class="account-title">功能权限</div> <div class="account-title">{{title}}</div>
<el-tabs v-model="tabName" type="card"> <el-tabs v-model="tabName" type="card">
<el-tab-pane :label="item.accounttypeName" :name="item.accounttypeId" v-for="(item, index) in tabMenu" :key="index"></el-tab-pane> <el-tab-pane
:label="item.accounttypeName"
:name="item.accounttypeId"
v-for="(item, index) in tabMenu"
:key="index"
></el-tab-pane>
</el-tabs> </el-tabs>
<div class="account-select-pro" v-for="(item, index) in tabMenu" :key="index" v-show="tabName == item.accounttypeId"> <div
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">{{ itm.productName }}</el-checkbox> <el-checkbox v-for="(itm, idx) in item.products" :label="itm" :key="idx">{{
itm.productName
}}</el-checkbox>
</el-checkbox-group> </el-checkbox-group>
</div> </div>
<div class="account-select-menu">请选择产品权限</div> <div class="account-select-menu">请选择产品权限</div>
...@@ -15,38 +27,58 @@ ...@@ -15,38 +27,58 @@
<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 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"> <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"
>
{{ itm.productName }} {{ itm.productName }}
</div> </div>
</div> </div>
<div v-show="tabName == item.accounttypeId" class="menu-box-tree" v-if="item.products" :style="{ 'min-height': treeHeight + 'px' }"> <div
<div v-for="(itm, idx) in item.products" :key="idx" > v-show="tabName == item.accounttypeId"
<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> class="menu-box-tree"
v-if="item.products"
:style="{ 'min-height': treeHeight + 'px' }"
>
<div v-for="(itm, idx) in item.products" :key="idx">
<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>
</div> </div>
</div> </div>
<button @click="getSelectInfo">tijiao</button>
</div> </div>
</template> </template>
<script> <script>
export default { export default {
name: 'product', name: "product",
props: { props: {
parentId: { title: {
type: Number type: String,
}, },
pId: { roleType: {
type: Number type: Boolean,
},
accountlevel: {
type: Number
},
roleType:{
type:Boolean
} }
}, },
...@@ -58,113 +90,163 @@ export default { ...@@ -58,113 +90,163 @@ 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: [],
} };
}, },
methods: { methods: {
selectPro(data) { selectPro(data) {
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) console.log(tabName, data);
// 设置全选 // 设置全选
var arr = tabMenu.find(i => i.accounttypeId == tabName).products.find(j => j.productId == productTab).merchantProTreeResponses var arr = tabMenu
this.$refs[`tree_${tabName}_${productTab}`][0].setCheckedKeys(this.getAllId(arr)) .find((i) => i.accounttypeId == tabName)
console.log(tabMenu) .products.find((j) => j.productId == productTab).merchantProTreeResponses;
this.$refs[`tree_${tabName}_${productTab}`][0].setCheckedKeys(this.getAllId(arr));
console.log(tabMenu);
}, },
productClick(productId) { productClick(productId) {
this.productTab = productId this.productTab = productId;
}, },
// 获取当前的所有权限 // 获取当前的所有权限
findMenuFunTreeByMerId() { async findMenuFunTreeByMerId(params) {
let params = { let tabMenu = await this.$apis.store.findMenuFunTreeByMerId(params);
accountlevel: this.accountlevel, this.tabMenu = tabMenu.map((item) => {
parentId: this.parentId, return {
id: this.pId productsArr: [],
products: item.products,
accounttypeName: item.accounttypeName,
accounttypeId: item.accounttypeId,
// merchantProTreeResponses: item.merchantProTreeResponses,
// productId: ''
};
});
this.$nextTick(() => {
this.addStyle();
});
console.log(this.tabMenu);
this.accountTypes = tabMenu.map((item) => {
return {
products: null,
accounttypeId: item.accounttypeId,
};
});
this.tabName = this.tabMenu[0].accounttypeId;
},
// 获取当前的所有权限
async accountTypeSearchRequest(params,status) {
let account = ''
if(status) {
account = 'findMenuFunTreeByMerId'
}else {
account = 'accountTypeSearchRequest'
} }
console.log(params); let tabMenu = await this.$apis.store[account](params);
this.$apis.store.findMenuFunTreeByMerId(params).then(res => { this.tabMenu = tabMenu.map((item) => {
this.tabMenu = res.map(item => { return {
console.log(item) productsArr: [],
return { products: item.products,
productsArr: [], accounttypeName: item.accounttypeName,
products: item.products, accounttypeId: item.accounttypeId,
accounttypeName: item.accounttypeName, // merchantProTreeResponses: item.merchantProTreeResponses,
accounttypeId: item.accounttypeId, // productId: ''
// merchantProTreeResponses: item.merchantProTreeResponses, };
// productId: '' });
} this.$nextTick(() => {
}) this.addStyle();
this.$nextTick(() => { });
this.addStyle() console.log(this.tabMenu);
}) this.accountTypes = tabMenu.map((item) => {
console.log(this.tabMenu) return {
this.accountTypes = res.map(item => { products: null,
return { accounttypeId: item.accounttypeId,
products: null, };
accounttypeId: item.accounttypeId });
} this.tabName = this.tabMenu[0].accounttypeId;
}) this.findPermissionsByMerId(params.merchantId?params.merchantId:params.id);
this.tabName = this.tabMenu[0].accounttypeId
})
}, },
// 获取已选择的权限 // 获取已选择的权限
findPermissionsByMerId() { findPermissionsByMerId(id) {
const params = { const params = {
id: 41588 id,
} };
this.$apis.store.findPermissionsByMerId(params).then(res => { this.$apis.store.findPermissionsByMerId(params).then((res) => {
console.log(res) // this.accountTypes = res.map(item=>{
res.map(i => { // let products = item.products.map(i=>{
console.log(i, this.tabMenu.find(j => j.accounttypeId == i.accounttypeId)) // return {
// i.productsArr = this.tabMenu.find(j => j.accounttypeId == i.accounttypeId).products // menuIds: i.menuIds,
}) // productId: i.productId,
}) // functionIds: i.functionIds
// }
// })
// return {
// accounttypeId: item.accounttypeId,
// products
// }
// })
res.forEach((item) => {
this.tabMenu.forEach((itm) => {
if (item.accounttypeId == itm.accounttypeId) {
item.products.forEach((i) => {
itm.products.forEach((j) => {
if (i.productId == j.productId) {
itm.productsArr.push(j);
this.$refs[
`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) {
// 用于:父子节点严格互不关联时,父节点勾选变化时通知子节点同步变化,实现单向关联。 // 用于:父子节点严格互不关联时,父节点勾选变化时通知子节点同步变化,实现单向关联。
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)//当子节点全为未选中时父节点也变为未选中状态
...@@ -176,140 +258,153 @@ export default { ...@@ -176,140 +258,153 @@ 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.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}`] ? this.$refs[`tree_${item.accounttypeId}_${itm.productId}`][0].getCheckedNodes() : [] const checkedNodes = this.$refs[`tree_${item.accounttypeId}_${itm.productId}`]
console.log(checkedNodes) ? this.$refs[
const menuIdList = checkedNodes.filter(item => item.logo === 'menu').map(i => i.id) // 全选菜单idlist `tree_${item.accounttypeId}_${itm.productId}`
][0].getCheckedNodes()
: [];
console.log(checkedNodes);
const menuIdList = checkedNodes
// .filter((item) => item.logo === "menu")
.filter((item) => 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(item => item.logo === 'functionValue') const functionValueIdLists = checkedNodes.filter(
var list = [] (item) => item.logo === "functionValue"
);
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.findMenuFunTreeByMerId() // this.accountTypeSearchRequest();
// this.findPermissionsByMerId() // this.findPermissionsByMerId()
} },
} };
</script> </script>
<style scoped lang="scss"> <style scoped lang="scss">
.account-body { .account-body {
padding: 20px; padding: 20px;
margin-bottom: 50px; margin-bottom: 50px;
/deep/ {
.el-checkbox:last-of-type {
margin-right: 8px;
}
}
.account-title { .account-title {
font-size: 20px; font-size: 20px;
font-weight: 600; font-weight: 600;
......
...@@ -60,7 +60,7 @@ ...@@ -60,7 +60,7 @@
</div> </div>
</div> </div>
<div class="content"> <div class="content">
<div class="subTitleWrap"> <div class="subTitleWrap" v-if="products.length > 0">
<div class="subTitle" :class="{ acitveSubTitle: subCurrentIndex == sindex }" v-for="(ele, sindex) in products" :key="sindex" @click="powerSubTabClick(sindex)"> <div class="subTitle" :class="{ acitveSubTitle: subCurrentIndex == sindex }" v-for="(ele, sindex) in products" :key="sindex" @click="powerSubTabClick(sindex)">
{{ ele.productName }} {{ ele.productName }}
</div> </div>
...@@ -164,7 +164,14 @@ ...@@ -164,7 +164,14 @@
<el-button type="primary" size="small" @click="filterTreeListFun">查询</el-button> <el-button type="primary" size="small" @click="filterTreeListFun">查询</el-button>
</div> </div>
<div class="secondTreeWrap"> <div class="secondTreeWrap">
<el-tree ref="tree" :default-expanded-keys="expandedIds" :data="secondTreeList" node-key="id" :filter-node-method="filterNode"></el-tree> <el-tree ref="tree" :default-expanded-keys="expandedIds" :data="secondTreeList" node-key="id" :filter-node-method="filterNode">
<!--知识点过长处理,鼠标悬浮文字弹框显示全部内容-->
<span slot-scope="{ node }" class="custom-tree-node">
<el-tooltip class="item" effect="dark" :content="node.label" placement="top-start">
<span>{{ node.label | ellipsis(20) }}</span>
</el-tooltip>
</span>
</el-tree>
</div> </div>
<!-- <form class="layui-form" action=""> <!-- <form class="layui-form" action="">
<div class="layui-inline"> <div class="layui-inline">
...@@ -292,7 +299,7 @@ export default { ...@@ -292,7 +299,7 @@ export default {
pageConf: { pageSize: 'pageSize', pageNum: 'pageNum', totalCount: 'count' }, pageConf: { pageSize: 'pageSize', pageNum: 'pageNum', totalCount: 'count' },
// layout: 'sizes, prev, pager, next, jumper, ->, total', // layout: 'sizes, prev, pager, next, jumper, ->, total',
tableTotal: 0, tableTotal: 0,
merchantId: 58 //this.$route.params.id //需要从外面传进来 merchantId: this.$route.params.id //this.$route.params.id //需要从外面传进来
} }
}, },
computed: { computed: {
...@@ -577,8 +584,10 @@ export default { ...@@ -577,8 +584,10 @@ export default {
} }
.contentTree { .contentTree {
padding: 20px; padding: 20px;
min-height: 250px; max-height: 250px;
position: relative; position: relative;
overflow: auto;
.noDataContent { .noDataContent {
width: 64px; width: 64px;
height: 64px; height: 64px;
......
...@@ -54,7 +54,7 @@ ...@@ -54,7 +54,7 @@
</el-col> </el-col>
</el-row> </el-row>
<el-row> <el-row>
<el-col :span="12"> <el-col :span="16">
<el-form-item label="账户类型"> <el-form-item label="账户类型">
<auto-button <auto-button
v-for="(item, index) in accountTypes" v-for="(item, index) in accountTypes"
...@@ -63,9 +63,7 @@ ...@@ -63,9 +63,7 @@
:btnValue="item.accounttypeId" :btnValue="item.accounttypeId"
stopClick="true" stopClick="true"
:typeStatus=" :typeStatus="
accounttypeId.indexOf(item.accounttypeId) == -1 accounttypeId.indexOf(item.accounttypeId) == -1 ? true : false
? true
: false
" "
></auto-button> ></auto-button>
</el-form-item> </el-form-item>
...@@ -310,7 +308,7 @@ ...@@ -310,7 +308,7 @@
</div> </div>
</div> </div>
<div v-show="step == 'first'"> <div v-show="step == 'first'">
<select-product></select-product> <select-product title="功能权限" ref="productForm"></select-product>
</div> </div>
<div <div
class="footer-panel" class="footer-panel"
...@@ -319,8 +317,12 @@ ...@@ -319,8 +317,12 @@
width: footerWidth + 'px', width: footerWidth + 'px',
}" }"
> >
<el-button type="primary" @click="handleSave" v-show="step == 'first'">确定</el-button> <el-button type="primary" @click="handleSave" v-show="step == 'first'"
<el-button type="primary" @click="handleNext" v-show="step == 'second'">确定</el-button> >确定</el-button
>
<el-button type="primary" @click="handleNext" v-show="step == 'second'"
>确定</el-button
>
<el-button type="primary" @click="handleCancel">取消</el-button> <el-button type="primary" @click="handleCancel">取消</el-button>
</div> </div>
<el-dialog :visible.sync="dialogMapVisible" width="60%"> <el-dialog :visible.sync="dialogMapVisible" width="60%">
...@@ -348,6 +350,7 @@ export default { ...@@ -348,6 +350,7 @@ export default {
}, },
data() { data() {
return { return {
editInfo: {},
pwdStatus: true, pwdStatus: true,
step: "first", step: "first",
filterText: "", filterText: "",
...@@ -466,7 +469,7 @@ export default { ...@@ -466,7 +469,7 @@ export default {
handleCancel() { handleCancel() {
this.$router.push("/account/index"); this.$router.push("/account/index");
}, },
handleSave() { handleSave() {
if (this.$refs.productForm.getSelectInfo().length == 0) { if (this.$refs.productForm.getSelectInfo().length == 0) {
this.$message.error("请选择产品"); this.$message.error("请选择产品");
return; return;
...@@ -475,7 +478,7 @@ export default { ...@@ -475,7 +478,7 @@ export default {
let params = { let params = {
accountTypes, accountTypes,
status: 2, status: 2,
merchantId: this.parentId, merchantId: this.accountAddForm.id,
}; };
this.$apis.store.updatePermissions(params).then((res) => { this.$apis.store.updatePermissions(params).then((res) => {
if (res) { if (res) {
...@@ -509,6 +512,7 @@ export default { ...@@ -509,6 +512,7 @@ export default {
params.isloginName ? (params.isloginName = 1) : (params.isloginName = 0); params.isloginName ? (params.isloginName = 1) : (params.isloginName = 0);
let businessScopeCustomize = this.businessScopeCustomize.map((item) => item.name); let businessScopeCustomize = this.businessScopeCustomize.map((item) => item.name);
params.businessScopeCustomize = businessScopeCustomize.join(","); params.businessScopeCustomize = businessScopeCustomize.join(",");
params.merchantFiles = JSON.stringify(params.merchantFiles)
Promise.all([pm1, pm2]).then(() => { Promise.all([pm1, pm2]).then(() => {
this.$apis.store.updateMerchant(params).then((res) => { this.$apis.store.updateMerchant(params).then((res) => {
if (res) { if (res) {
...@@ -540,6 +544,21 @@ export default { ...@@ -540,6 +544,21 @@ export default {
id: this.accountAddForm.id, id: this.accountAddForm.id,
}) })
.then((res) => { .then((res) => {
let para;
if(res.parentMerchant) {
para = {
id: this.accountAddForm.id,
parentId: res.parentId,
accountLevel: res.merchantAccountLevel,
};
}else {
para = {
ids: res.accountType,
merchantId: res.id,
accountLevel: res.merchantAccountLevel,
};
}
this.$refs.productForm.accountTypeSearchRequest(para,res.parentMerchant);
let { let {
isloginName, isloginName,
bussinessBegintime, bussinessBegintime,
...@@ -564,12 +583,12 @@ export default { ...@@ -564,12 +583,12 @@ export default {
merchantFileResponses, merchantFileResponses,
merchantModel, merchantModel,
accountTypes, accountTypes,
accounttypeId accounttypeId,
} = res; } = res;
this.accountInfoForm.merchantLoginAccount = merchantLoginAccount; this.accountInfoForm.merchantLoginAccount = merchantLoginAccount;
this.accountInfoForm.merchantLoginPassword = merchantLoginPassword; this.accountInfoForm.merchantLoginPassword = merchantLoginPassword;
this.accountTypes = accountTypes; this.accountTypes = accountTypes;
businessScope = businessScope?businessScope.split(','): [] businessScope = businessScope ? businessScope.split(",") : [];
if (businessScope.length > 0) { if (businessScope.length > 0) {
for (let i in this.accountAddForm.businessScope) { for (let i in this.accountAddForm.businessScope) {
this.accountAddForm.businessScope[i] = parseInt( this.accountAddForm.businessScope[i] = parseInt(
...@@ -578,7 +597,9 @@ export default { ...@@ -578,7 +597,9 @@ export default {
} }
} }
this.accountAddForm.bussinessTime = [bussinessBegintime, bussinessEndtime]; this.accountAddForm.bussinessTime = [bussinessBegintime, bussinessEndtime];
businessScopeCustomize = businessScopeCustomize?businessScopeCustomize.split(','): [] businessScopeCustomize = businessScopeCustomize
? businessScopeCustomize.split(",")
: [];
if (businessScopeCustomize.length > 0) { if (businessScopeCustomize.length > 0) {
this.businessScopeCustomize = businessScopeCustomize.map((item) => { this.businessScopeCustomize = businessScopeCustomize.map((item) => {
return { return {
...@@ -586,7 +607,7 @@ export default { ...@@ -586,7 +607,7 @@ export default {
}; };
}); });
} }
accounttypeId = accounttypeId?accounttypeId.split(','): [] accounttypeId = accounttypeId ? accounttypeId.split(",") : [];
if (accounttypeId.length > 0) { if (accounttypeId.length > 0) {
this.accounttypeId = accounttypeId.map((item) => { this.accounttypeId = accounttypeId.map((item) => {
return { return {
...@@ -601,7 +622,7 @@ export default { ...@@ -601,7 +622,7 @@ export default {
}; };
}); });
} }
merchantBrand = merchantBrand?merchantBrand.split(','): [] merchantBrand = merchantBrand ? merchantBrand.split(",") : [];
if (merchantBrand && merchantBrand.length > 0) { if (merchantBrand && merchantBrand.length > 0) {
for (let i in merchantBrand) { for (let i in merchantBrand) {
merchantBrand[i] = parseInt(merchantBrand[i]); merchantBrand[i] = parseInt(merchantBrand[i]);
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!