Commit b511397c by 李长胜

提交合并

2 parents e51a6da7 5d3db988
...@@ -12,7 +12,6 @@ ...@@ -12,7 +12,6 @@
"core-js": "^3.4.4", "core-js": "^3.4.4",
"el-tree-transfer": "^2.2.6", "el-tree-transfer": "^2.2.6",
"glsx-common": "^1.4.6", "glsx-common": "^1.4.6",
"glsx-components": "^1.0.8",
"glsx-table": "^1.0.9" "glsx-table": "^1.0.9"
}, },
"devDependencies": { "devDependencies": {
...@@ -28,6 +27,7 @@ ...@@ -28,6 +27,7 @@
"eslint": "^5.16.0", "eslint": "^5.16.0",
"eslint-plugin-prettier": "^3.1.1", "eslint-plugin-prettier": "^3.1.1",
"eslint-plugin-vue": "^5.0.0", "eslint-plugin-vue": "^5.0.0",
"glsx-components": "^1.0.8",
"node-sass": "^4.14.1", "node-sass": "^4.14.1",
"prettier": "^1.19.1", "prettier": "^1.19.1",
"sass-loader": "^8.0.0", "sass-loader": "^8.0.0",
......
/**
* 新增参数sign 判断接口是否需要sign签名
*/
/**
* 用法 : this.$apis.demo.GETLISTDEVICEFILEUNSTOCK(...)
* @param {*} params
* @returns
*/
import { http } from '@/main'
const getMerchantTree = params => {
params.method = 'org.ore.api.common.findMerchantTreeByMerchantNo.list'
return http({
url: '/rop-scrm-entmicro/router',
method: 'POST',
data: params,
sign: true
})
}
const getDepartment = params => {
params.method = 'cn.com.glsx.entmicro.department.listDepartmentTree'
return http({
url: '/rop-scrm-entmicro/router',
method: 'POST',
data: params,
sign: true
})
}
const toGL = params => {
params.method = 'org.ore.api.common.relevanceEntmicro.list'
return http({
url: '/rop-scrm-entmicro/router',
method: 'POST',
data: params,
sign: true
})
}
const merchantInfo = params => {
params.method = 'org.ore.api.common.findMerchantInfoByMerchantNo.list'
return http({
url: '/rop-scrm-entmicro/router',
method: 'POST',
data: params,
sign: true
})
}
export default {
getMerchantTree,
getDepartment,
toGL,
merchantInfo
}
\ No newline at end of file \ No newline at end of file
import { http } from '@/main'
var defaultPath = 'cn.com.glsx.merchants.'
const getListApi = params => {
params.method = `${defaultPath}staff.findStaffByPage`
return http({
url: '/rop-merchants/router',
method: 'POST',
data: params,
sign: true
})
}
const getAllMerchantListApi = params => {
params.method = `${defaultPath}menu.findAllMerchant`
return http({
url: '/rop-merchants/router',
method: 'POST',
data: params,
sign: true
})
}
const getRoleListApi = params => {
params.method = 'org.ore.api.role.list'
return http({
url: '/rop-merchants/router',
method: 'POST',
data: params,
sign: true
})
}
const getAllDictApi = params => {
params.method = `${defaultPath}menu.findAllDictData`
return http({
url: '/rop-merchants/router',
method: 'POST',
data: params,
sign: true
})
}
const getMerchantTreeApi = params => {
params.method = `${defaultPath}merchant.findMerchantTree`
return http({
url: '/rop-merchants/router',
method: 'POST',
data: params,
sign: true
})
}
export { getListApi, getAllMerchantListApi, getRoleListApi, getAllDictApi, getMerchantTreeApi }
/**
* 新增参数sign 判断接口是否需要sign签名
*/
/**
* 用法 : this.$apis.demo.GETLISTDEVICEFILEUNSTOCK(...)
* @param {*} params
* @returns
*/
import { http } from '@/main'
const roleDataList = params => {
params.method = 'org.ore.api.role.page'
return http({
url: '/rop-merchants/router',
method: 'POST',
data: params,
sign: true
})
}
const merchantDataList = params => {
params.method = 'cn.com.glsx.merchants.menu.findAllMerchant'
return http({
url: '/rop-merchants/router',
method: 'POST',
data: params,
sign: true
})
}
const roleInfoData = params => {
params.method = 'org.ore.api.role.getById'
return http({
url: '/rop-merchants/router',
method: 'POST',
data: params,
sign: true
})
}
const roleTreeDataById = params => {
params.method = 'cn.com.glsx.merchants.merchant.findMenuFunTreeByRoleId'
return http({
url: '/rop-merchants/router',
method: 'POST',
data: params,
sign: true
})
}
const merchantRootById = params => {
params.method = 'cn.com.glsx.merchants.merchant.findMenuFunTreeByMerId'
return http({
url: '/rop-merchants/router',
method: 'POST',
data: params,
sign: true
})
}
const createRole = params => {
params.method = 'org.ore.api.role.insert'
return http({
url: '/rop-merchants/router',
method: 'POST',
data: params,
sign: true
})
}
const updateRole = params => {
params.method = 'org.ore.api.role.update'
return http({
url: '/rop-merchants/router',
method: 'POST',
data: params,
sign: true
})
}
const deleteRole = params => {
params.method = 'org.ore.api.role.deleteById'
return http({
url: '/rop-merchants/router',
method: 'POST',
data: params,
sign: true
})
}
export default {
roleDataList,
merchantDataList,
roleInfoData,
roleTreeDataById,
merchantRootById,
createRole,
updateRole,
deleteRole
}
\ No newline at end of file \ No newline at end of file
...@@ -24,7 +24,8 @@ const findAllDictData = params => { ...@@ -24,7 +24,8 @@ const findAllDictData = params => {
data: params, data: params,
sign: true sign: true
}) })
} }
//主营品牌
const getCarbrandTree = params => { const getCarbrandTree = params => {
params.method = 'cn.com.glsx.merchants.merchantCommon.getCarbrandTree' params.method = 'cn.com.glsx.merchants.merchantCommon.getCarbrandTree'
return http({ return http({
...@@ -33,7 +34,8 @@ const getCarbrandTree = params => { ...@@ -33,7 +34,8 @@ const getCarbrandTree = params => {
data: params, data: params,
sign: true sign: true
}) })
} }
//详情
const findMerchantDetail = params => { const findMerchantDetail = params => {
params.method = 'cn.com.glsx.merchants.merchant.findMerchantDetail' params.method = 'cn.com.glsx.merchants.merchant.findMerchantDetail'
return http({ return http({
...@@ -42,7 +44,8 @@ const findMerchantDetail = params => { ...@@ -42,7 +44,8 @@ const findMerchantDetail = params => {
data: params, data: params,
sign: true sign: true
}) })
} }
//下一步
const saveMerchant = params => { const saveMerchant = params => {
params.method = 'cn.com.glsx.merchants.merchant.saveMerchant' params.method = 'cn.com.glsx.merchants.merchant.saveMerchant'
return http({ return http({
...@@ -52,6 +55,17 @@ const saveMerchant = params => { ...@@ -52,6 +55,17 @@ const saveMerchant = params => {
sign: true sign: true
}) })
} }
const updateMerchant = params => {
params.method = 'cn.com.glsx.merchants.merchant.updateMerchant'
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({
...@@ -60,7 +74,8 @@ const findPermissionsByMerId = params => { ...@@ -60,7 +74,8 @@ const findPermissionsByMerId = params => {
data: params, data: params,
sign: true sign: true
}) })
} }
//功能权限
const findMenuFunTreeByMerId = params => { const findMenuFunTreeByMerId = params => {
params.method = 'cn.com.glsx.merchants.merchant.findMenuFunTreeByMerId' params.method = 'cn.com.glsx.merchants.merchant.findMenuFunTreeByMerId'
return http({ return http({
...@@ -69,6 +84,16 @@ const findMenuFunTreeByMerId = params => { ...@@ -69,6 +84,16 @@ const findMenuFunTreeByMerId = params => {
data: params, data: params,
sign: true sign: true
}) })
}
//草稿保存
const updatePermissions = params => {
params.method = 'cn.com.glsx.merchants.merchant.updatePermissions'
return http({
url: '/rop-merchants/router',
method: 'POST',
data: params,
sign: true
})
} }
export default { export default {
findMerchantByPage, findMerchantByPage,
...@@ -76,6 +101,8 @@ export default { ...@@ -76,6 +101,8 @@ export default {
getCarbrandTree, getCarbrandTree,
findMerchantDetail, findMerchantDetail,
saveMerchant, saveMerchant,
updateMerchant,
findPermissionsByMerId, findPermissionsByMerId,
findMenuFunTreeByMerId findMenuFunTreeByMerId,
updatePermissions
} }
\ No newline at end of file \ No newline at end of file
import Vue from 'vue' import Vue from 'vue'
import { Message,Autocomplete,Popover,Tag,Tooltip, Table, TableColumn, Steps, Step, Loading, Drawer, Pagination, Button, ButtonGroup, Form, FormItem, Input, Radio, RadioGroup, Checkbox, CheckboxGroup, Switch, Select, Option, TimePicker,Row, Col, DatePicker, Tree } from 'element-ui' import { Message, Autocomplete, Popover, Tag, Tooltip, Table, TableColumn, Steps, Step, Loading, Drawer, Pagination, Button, ButtonGroup, Form, FormItem, Input, Radio, RadioGroup, Checkbox, CheckboxGroup, Switch, Select, Option, TimePicker, Row, Col, DatePicker, Tree } from 'element-ui'
Vue.use(Button) Vue.use(Button)
Vue.use(ButtonGroup) Vue.use(ButtonGroup)
Vue.use(Form) Vue.use(Form)
......
const staticRoutes = Object.freeze([{ const staticRoutes = Object.freeze([
name: 'home', {
path: '/', name: 'account',
path: '/account/index',
meta: {}, meta: {},
component: resolve => require([`@/views/home/index.vue`], resolve) component: resolve => require([`@/views/account/index.vue`], resolve)
}, },
{ {
name: 'addAccount', name: 'addAccount',
path: '/acount/addAccount', path: '/account/addAccount',
meta: {}, meta: {},
component: resolve => require([`@/views/home/addAccount.vue`], resolve) component: resolve => require([`@/views/account/addAccount.vue`], resolve)
}, },
{ {
name: 'editAccount', name: 'editAccount',
path: '/acount/editAccount', path: '/account/editAccount',
meta: {},
component: resolve => require([`@/views/account/editAccount.vue`], resolve)
},
{
name: 'role',
path: '/role/index/index',
component: resolve => require([`@/views/role/index/index.vue`], resolve),
meta: {}
},
{
name: 'role',
path: '/role/create/index',
component: resolve => require([`@/views/role/create/index.vue`], resolve),
meta: {}
},
{
name: 'role',
path: '/role/index/look',
component: resolve => require([`@/views/role/index/look.vue`], resolve),
meta: {}
},
{
name: 'baseInfo',
path: '/baseInfo/index',
component: resolve => require([`@/views/baseInfo/index.vue`], resolve),
meta: {}
},
{
name: 'baseInfo',
path: '/baseInfo/relevance',
component: resolve => require([`@/views/baseInfo/relevance.vue`], resolve),
meta: {}
},
{
name: 'employeeList',
path: '/employee/index',
meta: {},
component: resolve => require([`@/views/employee/index.vue`], resolve)
},
{
name: 'employee',
path: '/employee/editEmployee',
meta: {}, meta: {},
component: resolve => require([`@/views/home/editAccount.vue`], resolve) component: resolve => require([`@/views/employee/editEmployee.vue`], resolve)
}, },
{ {
name: 'detailAccount', name: 'detailAccount',
......
<template> <template>
<div class="scrm-main"> <div class="scrm-main">
<div v-show="!parentId"> <div v-show="step == 1">
<div class="account-header scrm-flex-between scrm-box-f">创建子商户/门店</div> <div class="account-header scrm-flex-between scrm-box-f">
<span>创建子商户/门店</span>
<el-select v-model="status" slot="prepend" placeholder="请选择">
<el-option label="门店" :value="1"></el-option>
<el-option label="商户" :value="2"></el-option>
</el-select>
</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>
<el-form <el-form
...@@ -69,12 +75,14 @@ ...@@ -69,12 +75,14 @@
</el-row> </el-row>
<el-row> <el-row>
<el-col :span="12"> <el-col :span="12">
<el-form-item label="商户地址"> <el-form-item size="small" label="商户地址" class="form-row">
<el-input size="small" v-model="accountAddForm.merchantAddress"> <el-input v-model="accountAddForm.merchantAddress"> </el-input>
<el-button slot="append" @click="dialogMapVisible = true" <el-button
type="primary"
class="form-btn"
@click="dialogMapVisible = true"
>选择地址</el-button >选择地址</el-button
> >
</el-input>
</el-form-item> </el-form-item>
</el-col> </el-col>
</el-row> </el-row>
...@@ -195,6 +203,24 @@ ...@@ -195,6 +203,24 @@
</el-col> </el-col>
<el-col :span="12"> <el-col :span="12">
<el-form-item label="门店照片"> <el-form-item label="门店照片">
<div class="store-upload-list">
<template
v-if="
accountAddForm.merchantFiles &&
accountAddForm.merchantFiles.length > 0
"
>
<div
:key="index"
v-for="(item, index) in accountAddForm.merchantFiles"
class="store-border"
>
<img :src="item.fileUrl" />
<div class="uploader-del-icon">
<i class="el-icon-delete-solid" @click.stop="delImg(index)"></i>
</div>
</div>
</template>
<el-upload <el-upload
action="" action=""
class="image-uploader" class="image-uploader"
...@@ -205,6 +231,8 @@ ...@@ -205,6 +231,8 @@
> >
<i class="el-icon-plus"></i> <i class="el-icon-plus"></i>
</el-upload> </el-upload>
</div>
<div class="tips">图片格式仅支持JPG,PNG格式,大小1M</div> <div class="tips">图片格式仅支持JPG,PNG格式,大小1M</div>
</el-form-item> </el-form-item>
</el-col> </el-col>
...@@ -237,6 +265,7 @@ ...@@ -237,6 +265,7 @@
<el-form-item label="账户等级"> <el-form-item label="账户等级">
<el-select <el-select
size="small" size="small"
:disabled="nextStatus"
v-model="accountDetail.merchantAccountLevel" v-model="accountDetail.merchantAccountLevel"
placeholder="请选择" placeholder="请选择"
> >
...@@ -254,6 +283,7 @@ ...@@ -254,6 +283,7 @@
<el-col :span="12"> <el-col :span="12">
<el-form-item label="登录账户名" prop="merchantLoginAccount"> <el-form-item label="登录账户名" prop="merchantLoginAccount">
<el-input <el-input
:disabled="nextStatus"
size="small" size="small"
v-model="accountInfoForm.merchantLoginAccount" v-model="accountInfoForm.merchantLoginAccount"
placeholder="请输入登录账户名" placeholder="请输入登录账户名"
...@@ -263,6 +293,7 @@ ...@@ -263,6 +293,7 @@
<el-col :span="12"> <el-col :span="12">
<el-form-item label="登录密码" prop="merchantLoginPassword"> <el-form-item label="登录密码" prop="merchantLoginPassword">
<el-input <el-input
:disabled="nextStatus"
size="small" size="small"
type="password" type="password"
v-model="accountInfoForm.merchantLoginPassword" v-model="accountInfoForm.merchantLoginPassword"
...@@ -279,6 +310,7 @@ ...@@ -279,6 +310,7 @@
:key="index" :key="index"
:btnLabel="item.accounttypeName" :btnLabel="item.accounttypeName"
:btnValue="item.accounttypeId" :btnValue="item.accounttypeId"
:stopClick="nextStatus"
@getBtnStatus="getBtnStatus" @getBtnStatus="getBtnStatus"
></auto-button> ></auto-button>
</el-form-item> </el-form-item>
...@@ -288,14 +320,20 @@ ...@@ -288,14 +320,20 @@
</div> </div>
</div> </div>
<select-product <select-product
v-show="parentId" v-show="step == 2"
ref="productForm"
:parentId="parentId" :parentId="parentId"
:pid="accountAddForm.parentId" :pid="accountAddForm.parentId"
:accountlevel="accountDetail.merchantAccountLevel" :accountlevel="accountDetail.merchantAccountLevel"
></select-product> ></select-product>
<div class="footer-panel"> <div class="footer-panel">
<el-button type="primary" @click="handleNext">下一步</el-button> <el-button type="primary" @click="handleNext" v-show="step == 1">下一步</el-button>
<el-button type="primary">取消</el-button> <el-button type="primary" @click="handleSave(1)" v-show="step == 2"
>存草稿</el-button
>
<el-button type="primary" @click="handlePrev" v-show="step == 2">上一步</el-button>
<el-button type="primary" @click="handleSave(2)" v-show="step == 2">确定</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%">
<map-view ref="mapForm" :mapHeight="mapHeight"></map-view> <map-view ref="mapForm" :mapHeight="mapHeight"></map-view>
...@@ -320,20 +358,22 @@ export default { ...@@ -320,20 +358,22 @@ export default {
}, },
data() { data() {
return { return {
nextStatus: false,
filterText: "", filterText: "",
brandData: [], brandData: [],
defaultProps: { defaultProps: {
children: "children", children: "children",
label: "label", label: "label",
}, },
parentId: "1", parentId: "",
step: 1,
mapHeight: 400, mapHeight: 400,
typeLabel: "",
typeStatus: false, typeStatus: false,
loadingImg: false, loadingImg: false,
dialogMapVisible: false, dialogMapVisible: false,
businessScopeCustomize: [{ name: "" }], businessScopeCustomize: [{ name: "" }],
accountAddForm: { accountAddForm: {
status: 1,
merchantType: "1", merchantType: "1",
businessScope: [], businessScope: [],
parentId: "", parentId: "",
...@@ -343,7 +383,6 @@ export default { ...@@ -343,7 +383,6 @@ export default {
accountInfoForm: {}, accountInfoForm: {},
accountDetail: {}, accountDetail: {},
accountLevel: [], accountLevel: [],
accountType: [],
businessOption: [], businessOption: [],
accountValidityPeriod: [], accountValidityPeriod: [],
baseRules: { baseRules: {
...@@ -375,7 +414,6 @@ export default { ...@@ -375,7 +414,6 @@ export default {
getAddress() { getAddress() {
this.dialogMapVisible = false; this.dialogMapVisible = false;
this.accountAddForm.merchantAddress = this.$refs.mapForm.address; this.accountAddForm.merchantAddress = this.$refs.mapForm.address;
console.log(this.accountAddForm.merchantAddress);
}, },
getBtnStatus(status, value) { getBtnStatus(status, value) {
if (status) { if (status) {
...@@ -419,6 +457,24 @@ export default { ...@@ -419,6 +457,24 @@ export default {
}; };
} }
}, },
handleSave(status) {
let accountTypes = this.$refs.productForm.accountTypes;
if (!accountTypes.every((item) => item.products)) {
this.$message.error("请选择产品");
}
let params = {
status,
merchantId: this.parentId,
accountTypes: this.$refs.productForm.accountTypes,
};
this.$apis.store.updatePermissions(params).then((res) => {
console.log(res);
});
},
handleCancel() {},
handlePrev() {
this.step = 1;
},
//下一步 //下一步
handleNext() { handleNext() {
const pm1 = new Promise((resolve, reject) => { const pm1 = new Promise((resolve, reject) => {
...@@ -445,11 +501,23 @@ export default { ...@@ -445,11 +501,23 @@ export default {
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(",");
let merchant;
if (this.nextStatus) {
merchant = "updateMerchant";
params.id = this.parentId;
} else {
merchant = "saveMerchant";
}
Promise.all([pm1, pm2]).then(() => { Promise.all([pm1, pm2]).then(() => {
this.$apis.store.saveMerchant(params).then((res) => { this.$apis.store[merchant](params).then((res) => {
if (res) { if (res) {
this.step = 2;
this.nextStatus = true;
if (typeof res == "number") {
this.parentId = res; this.parentId = res;
} }
this.twoMerchantDetail(this.parentId);
}
}); });
}); });
}, },
...@@ -462,13 +530,6 @@ export default { ...@@ -462,13 +530,6 @@ export default {
if (dictType == "account_level") { if (dictType == "account_level") {
this.accountLevel = res; this.accountLevel = res;
} }
if (dictType == "account_type") {
this.accountType = res;
let idx = this.accountType.findIndex(
(item) => (item.dictValue = this.accountDetail.accountType)
);
this.typeLabel = this.accountType[idx].dictLabel;
}
if (dictType == "business_scope") { if (dictType == "business_scope") {
this.businessOption = res; this.businessOption = res;
} }
...@@ -485,7 +546,15 @@ export default { ...@@ -485,7 +546,15 @@ 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.findAllDictData("account_type"); },
twoMerchantDetail(pid) {
this.$apis.store
.findMerchantDetail({
id: pid,
})
.then((res) => {
console.log(res);
});
}, },
getCarbrandTree() { getCarbrandTree() {
this.$apis.store.getCarbrandTree({}).then((res) => { this.$apis.store.getCarbrandTree({}).then((res) => {
...@@ -543,6 +612,49 @@ export default { ...@@ -543,6 +612,49 @@ export default {
&-form { &-form {
width: 80%; width: 80%;
margin: 20px auto; margin: 20px auto;
.form-row {
/deep/ .el-form-item__content {
display: flex;
}
.form-btn {
margin-left: 10px;
}
}
.store-upload-list {
display: flex;
flex-wrap: wrap;
.store-border {
position: relative;
width: 120px;
height: 80px;
border-radius: 2px;
margin-right: 15px;
margin-bottom: 15px;
}
.uploader-del-icon {
position: absolute;
top: 0px;
right: 0px;
width: 30px;
height: 30px;
line-height: 30px;
background: rgba(0, 0, 0, 0.4);
border-radius: 0px 0px 0px 100px;
cursor: pointer;
}
.el-icon-delete-solid {
color: #c5c5c5;
font-size: 14px;
margin-left: 12px;
}
}
.image-uploader {
/deep/ .el-upload {
width: 120px;
height: 80px;
line-height: 80px;
}
}
.brand-tree { .brand-tree {
height: 300px; height: 300px;
overflow-y: auto; overflow-y: auto;
......
<template>
<div class="account-body scrm-box-f">
<div class="account-title">功能权限</div>
<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-tabs>
<div class="account-select-pro" v-for="(item, index) in tabMenu" :key="index" v-show="tabName == item.accounttypeId">
<label>选择产品</label>
<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-group>
</div>
<div class="account-select-menu">请选择产品权限</div>
<div class="menu-box">
<div class="menu-box-panel">
<div :key="index" v-for="(item, index) in tabMenu">
<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">
{{ itm.productName }}
</div>
</div>
<div 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" >
<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>
<button @click="getSelectInfo">tijiao</button>
</div>
</template>
<script>
export default {
name: 'product',
props: {
parentId: {
type: Number
},
pId: {
type: Number
},
accountlevel: {
type: Number
}
},
data() {
return {
treeHeight: 300,
tabMenu: [],
selectIndex: 0,
productId: 0,
products: [],
productsArr: [],
tabName: '',
productTab: '',
defaultProps: {
children: 'children',
label: 'label'
},
accountTypes: []
}
},
methods: {
selectPro(data) {
this.productTab = data.length != 0 ? data[data.length - 1].productId : ''
const { tabName, tabMenu, productTab } = this
console.log(tabName, data)
// 设置全选
var arr = tabMenu.find(i => i.accounttypeId == tabName).products.find(j => j.productId == productTab).merchantProTreeResponses
this.$refs[`tree_${tabName}_${productTab}`][0].setCheckedKeys(this.getAllId(arr))
console.log(tabMenu)
},
productClick(productId) {
this.productTab = productId
},
// 获取当前的所有权限
findMenuFunTreeByMerId() {
let params = {
accountlevel: 4,
parentId: 41380,
id: 41588
}
this.$apis.store.findMenuFunTreeByMerId(params).then(res => {
this.tabMenu = res.map(item => {
console.log(item)
return {
productsArr: [],
products: item.products,
accounttypeName: item.accounttypeName,
accounttypeId: item.accounttypeId,
// merchantProTreeResponses: item.merchantProTreeResponses,
// productId: ''
}
})
this.$nextTick(() => {
this.addStyle()
})
console.log(this.tabMenu)
this.accountTypes = res.map(item => {
return {
products: null,
accounttypeId: item.accounttypeId
}
})
this.tabName = this.tabMenu[0].accounttypeId
})
},
// 获取已选择的权限
findPermissionsByMerId() {
const params = {
id: 41588
}
this.$apis.store.findPermissionsByMerId(params).then(res => {
console.log(res)
res.map(i => {
console.log(i, this.tabMenu.find(j => j.accounttypeId == i.accounttypeId))
// i.productsArr = this.tabMenu.find(j => j.accounttypeId == i.accounttypeId).products
})
})
},
// 渲染树结构
renderContent(h, v) {
if (v.data.logo == 'functionValue') {
return (
<div class="custom-tree-node fun-tree-node">
<span>{v.node.label}</span>
</div>
)
} else {
return (
<div class="custom-tree-node">
<span>{v.node.label}</span>
</div>
)
}
},
addStyle() {
const nodes = document.getElementsByClassName('fun-tree-node')
for (let i = 0; i < nodes.length; i++) {
const parentNode = nodes[i].parentNode
parentNode.style.float = 'left'
}
},
clickDeal(currentObj, treeStatus) {
// 用于:父子节点严格互不关联时,父节点勾选变化时通知子节点同步变化,实现单向关联。
let selected = treeStatus.checkedKeys.indexOf(currentObj.id) // -1未选中
// 选中
if (selected !== -1) {
// 子节点只要被选中父节点就被选中
this.selectedParent(currentObj)
// 统一处理子节点为相同的勾选状态
this.uniteChildSame(currentObj, true)
} else {
// 未选中 处理子节点全部未选中
console.log(currentObj)
if (currentObj.children !== null) {
if (currentObj.children.length !== 0) {
this.uniteChildSame(currentObj, false)
}
//放开时为当子节点全为未选中时父节点也变为未选中状态 注释后就是父节点不和子节点强制绑定
// this.uniteParentSame(currentObj.id,treeStatus)//当子节点全为未选中时父节点也变为未选中状态
}
// else {
// this.uniteParentSame(currentObj.id,treeStatus)
// }
}
},
uniteParentSame(id, treeStatus) {
//当子节点全为未选中时父节点也变为未选中状态
const tree_ref = `tree_${this.tabName}_${this.productTab}`
let node = this.$refs[tree_ref][0].getNode(id) //获取当前节点的节点树
if (node.parent !== null && node.parent !== undefined) {
let parentNode = node.parent.data //获取当前节点的父节点树
if (parentNode != undefined) {
//判断父节点是否存在
for (let i = 0; i < parentNode.children.length; i++) {
let checkedKeys = this.$refs[tree_ref][0].getCheckedKeys()
let hafCheckedKeys = this.$refs[tree_ref][0].getHalfCheckedKeys()
let selectNodes = checkedKeys.concat(hafCheckedKeys) //获取已选择树节点
let selected = selectNodes.indexOf(parentNode.children[i].id) // -1当前节点的同级节点是否全部未选中
if (selected !== -1) {
return
}
}
} else {
return
}
this.$refs[tree_ref][0].setChecked(parentNode.id, false) //修改节点为未选择
if (node.level > 2) {
//判断是否是最上级节点
this.uniteParentSame(parentNode.id, treeStatus)
}
} else {
return
}
},
// 统一处理子节点为相同的勾选状态
uniteChildSame(treeList, isSelected) {
const tree_ref = `tree_${this.tabName}_${this.productTab}`
this.$refs[tree_ref][0].setChecked(treeList.id, isSelected)
console.log(treeList)
if (treeList.children !== null) {
for (let i = 0; i < treeList.children.length; i++) {
this.uniteChildSame(treeList.children[i], isSelected)
}
}
},
// 统一处理父节点为选中
selectedParent(currentObj) {
const tree_ref = `tree_${this.tabName}_${this.productTab}`
let currentNode = this.$refs[tree_ref][0].getNode(currentObj)
if (currentNode.parent.key !== undefined) {
this.$refs[tree_ref][0].setChecked(currentNode.parent, true)
this.selectedParent(currentNode.parent)
}
},
// 获取所有节点的id
getAllId(data, arr = []) {
if (data) {
data.forEach(item => {
arr.push(item.id)
if (item.children && item.children.length != 0) {
item.children.forEach(i => {
arr.push(i.id)
this.getAllId(i.children, arr)
})
}
})
}
return arr
},
getSelectInfo() {
this.accountTypes = this.tabMenu.map(item => {
let products = []
item.productsArr.forEach(itm => {
const checkedNodes = this.$refs[`tree_${item.accounttypeId}_${itm.productId}`] ? this.$refs[`tree_${item.accounttypeId}_${itm.productId}`][0].getCheckedNodes() : []
console.log(checkedNodes)
const menuIdList = checkedNodes.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 functionValueIdLists = checkedNodes.filter(item => item.logo === 'functionValue')
var list = []
/** { menuId, id, functionValue} */
if (functionValueIdLists.length !== 0) {
functionValueIdLists.forEach((j, index) => {
if (list.map(item => item.id).includes(j.parentId)) {
const obj = list.find(k => k.id === j.parentId)
obj.functionValue += ';' + j.id + ':' + j.label
} else {
list.push({
id: j.parentId,
menuId: j.superParentId,
functionValue: j.id + ':' + j.label
})
}
})
}
console.log(menuIdList, functionIdList, functionValueIdLists, list)
products.push({
productId: itm.productId,
functionIds: functionIdList,
functionValue: list,
menuIds: menuIdList
})
})
return {
accounttypeId: item.accounttypeId,
products
}
})
console.log(this.accountTypes)
}
},
mounted() {
this.findMenuFunTreeByMerId()
this.findPermissionsByMerId()
}
}
</script>
<style scoped lang="scss">
.account-body {
padding: 20px;
margin-bottom: 50px;
.account-title {
font-size: 20px;
font-weight: 600;
color: #333333;
line-height: 20px;
letter-spacing: 1px;
margin-bottom: 30px;
}
.account-select-pro {
padding-left: 30px;
font-size: 14px;
font-weight: 500;
color: #333333;
line-height: 20px;
display: flex;
flex-wrap: wrap;
label {
margin-right: 20px;
}
}
.account-select-menu {
font-size: 14px;
font-weight: 500;
color: #333333;
line-height: 20px;
margin-top: 20px;
}
.menu-box {
margin-top: 10px;
background: #f4f6fc;
border-radius: 4px;
padding: 10px;
.tab-item {
width: 180px;
background: #ffffff;
border-radius: 4px 0px 0px 0px;
border: 1px solid #f4f6fc;
font-size: 14px;
line-height: 14px;
font-weight: 400;
color: #37383a;
text-align: center;
padding: 12px 0px;
cursor: pointer;
&.select-checked {
color: #322ad9;
font-weight: 700;
border-bottom: none;
}
}
.menu-box-tab {
display: flex;
}
.menu-box-tree {
background: #ffffff;
}
}
}
</style>
<template> <template>
<div class="scrm-main"> <div class="scrm-main">
<el-tabs v-model="step" @tab-click="handleClick" class="tab-edit-status">
<el-tab-pane label="修改功能权限" name="first"></el-tab-pane>
<el-tab-pane label="修改基本信息" name="second"></el-tab-pane>
</el-tabs>
<div v-show="step == 'second'">
<div class="account-body scrm-box-f"> <div class="account-body scrm-box-f">
<div class="form-title">修改账户信息</div> <div class="form-title">修改账户信息</div>
<el-form <el-form
...@@ -32,10 +37,19 @@ ...@@ -32,10 +37,19 @@
> >
<el-input <el-input
type="password" type="password"
:readonly="pwdStatus ? 'readonly' : false"
v-model="accountInfoForm.merchantLoginPassword" v-model="accountInfoForm.merchantLoginPassword"
placeholder="请输入登录密码" placeholder="请输入登录密码"
></el-input> ></el-input>
<el-button type="primary" class="form-btn">重置密码</el-button> <el-button
type="primary"
class="form-btn"
@click="
pwdStatus = false;
accountInfoForm.merchantLoginPassword = '';
"
>重置密码</el-button
>
</el-form-item> </el-form-item>
</el-col> </el-col>
</el-row> </el-row>
...@@ -47,7 +61,11 @@ ...@@ -47,7 +61,11 @@
:key="index" :key="index"
:btnLabel="item.accounttypeName" :btnLabel="item.accounttypeName"
:btnValue="item.accounttypeId" :btnValue="item.accounttypeId"
typeStatus="true" :typeStatus="
accountAddForm.accountTypeNames.search(item.accounttypeName) == -1
? false
: true
"
stopClick="true" stopClick="true"
></auto-button> ></auto-button>
</el-form-item> </el-form-item>
...@@ -122,12 +140,11 @@ ...@@ -122,12 +140,11 @@
</el-row> </el-row>
<el-row> <el-row>
<el-col :span="12"> <el-col :span="12">
<el-form-item label="商户地址"> <el-form-item size="small" label="商户地址" class="form-row">
<el-input size="small" v-model="accountAddForm.merchantAddress"> <el-input readonly size="small" v-model="accountAddForm.merchantAddress"> </el-input>
<el-button slot="append" @click="dialogMapVisible = true" <el-button type="primary" class="form-btn" @click="dialogMapVisible = true"
>选择地址</el-button >选择地址</el-button
> >
</el-input>
</el-form-item> </el-form-item>
</el-col> </el-col>
</el-row> </el-row>
...@@ -251,13 +268,13 @@ ...@@ -251,13 +268,13 @@
<div class="store-upload-list"> <div class="store-upload-list">
<template <template
v-if=" v-if="
accountAddForm.merchantFileResponses && accountAddForm.merchantFiles &&
accountAddForm.merchantFileResponses.length > 0 accountAddForm.merchantFiles.length > 0
" "
> >
<div <div
:key="index" :key="index"
v-for="(item, index) in accountAddForm.merchantFileResponses" v-for="(item, index) in accountAddForm.merchantFiles"
class="store-border" class="store-border"
> >
<img :src="item.fileUrl" /> <img :src="item.fileUrl" />
...@@ -284,6 +301,10 @@ ...@@ -284,6 +301,10 @@
</el-row> </el-row>
</el-form> </el-form>
</div> </div>
</div>
<div v-show="step == 'first'">
<select-product></select-product>
</div>
<div class="footer-panel"> <div class="footer-panel">
<el-button type="primary" @click="handleNext">确定</el-button> <el-button type="primary" @click="handleNext">确定</el-button>
<el-button type="primary">取消</el-button> <el-button type="primary">取消</el-button>
...@@ -301,15 +322,18 @@ ...@@ -301,15 +322,18 @@
<script> <script>
import mapView from "@/components/mapView/index"; import mapView from "@/components/mapView/index";
import autoButton from "@/components/auto-button/index"; import autoButton from "@/components/auto-button/index";
import selectProduct from "./components/selectProduct";
export default { export default {
name: "index", name: "index",
components: { components: {
mapView, mapView,
autoButton, autoButton,
selectProduct
}, },
data() { data() {
return { return {
activeName: "first", pwdStatus: true,
step: "first",
filterText: "", filterText: "",
brandData: [], brandData: [],
defaultProps: { defaultProps: {
...@@ -378,7 +402,7 @@ export default { ...@@ -378,7 +402,7 @@ export default {
} }
}, },
delImg(index) { delImg(index) {
this.accountAddForm.merchantFileResponses.splice(index, 1); this.accountAddForm.merchantFiles.splice(index, 1);
}, },
upLoadImg(file) { upLoadImg(file) {
let fileName = file.name; let fileName = file.name;
...@@ -408,7 +432,9 @@ export default { ...@@ -408,7 +432,9 @@ export default {
}) })
.then((res) => { .then((res) => {
if (res) { if (res) {
console.log(res); self.accountAddForm.merchantFiles.push({
fileUrl: res,
});
} }
}); });
}; };
...@@ -436,7 +462,6 @@ export default { ...@@ -436,7 +462,6 @@ export default {
} }
params.merchantBrand = this.$refs.brandTree.getCheckedKeys().join(","); params.merchantBrand = this.$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;
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(",");
...@@ -466,9 +491,12 @@ export default { ...@@ -466,9 +491,12 @@ export default {
this.businessScopeCustomize.splice(index, 1); this.businessScopeCustomize.splice(index, 1);
}, },
async findMerchantDetail() { async findMerchantDetail() {
this.accountAddForm = await this.$apis.store.findMerchantDetail({ this.$apis.store
.findMerchantDetail({
id: this.accountAddForm.parentId, id: this.accountAddForm.parentId,
}); })
.then((res) => {
this.accountAddForm = res;
this.accountInfoForm.merchantLoginAccount = this.accountAddForm.merchantLoginAccount; this.accountInfoForm.merchantLoginAccount = this.accountAddForm.merchantLoginAccount;
this.accountInfoForm.merchantLoginPassword = this.accountAddForm.merchantLoginPassword; this.accountInfoForm.merchantLoginPassword = this.accountAddForm.merchantLoginPassword;
this.accountTypes = this.accountAddForm.accountTypes; this.accountTypes = this.accountAddForm.accountTypes;
...@@ -486,12 +514,28 @@ export default { ...@@ -486,12 +514,28 @@ export default {
]; ];
let businessScopeCustomize = this.accountAddForm.businessScopeCustomize let businessScopeCustomize = this.accountAddForm.businessScopeCustomize
? this.accountAddForm.businessScopeCustomize.split(",") ? this.accountAddForm.businessScopeCustomize.split(",")
: []; : [""];
this.businessScopeCustomize = businessScopeCustomize.map((item) => { this.businessScopeCustomize = businessScopeCustomize.map((item) => {
return { return {
name: item, name: item,
}; };
}); });
this.accountAddForm.merchantFiles = this.accountAddForm.merchantFileResponses.map(
(item) => {
return {
fileUrl: item.fileUrl,
};
}
);
let merchantBrand = this.accountAddForm.merchantBrand
? this.accountAddForm.merchantBrand.split(",")
: [];
for (let i in merchantBrand) {
merchantBrand[i] = parseInt(merchantBrand[i]);
}
this.$refs.brandTree.setCheckedKeys(merchantBrand);
});
}, },
getCarbrandTree() { getCarbrandTree() {
this.$apis.store.getCarbrandTree({}).then((res) => { this.$apis.store.getCarbrandTree({}).then((res) => {
...@@ -509,6 +553,11 @@ export default { ...@@ -509,6 +553,11 @@ export default {
</script> </script>
<style scoped lang="scss"> <style scoped lang="scss">
.tab-edit-status {
/deep/ .el-tabs__nav-wrap::after {
display: none;
}
}
.account-header { .account-header {
height: 78px; height: 78px;
box-sizing: border-box; box-sizing: border-box;
...@@ -531,8 +580,8 @@ export default { ...@@ -531,8 +580,8 @@ export default {
} }
} }
.account-body { .account-body {
&:nth-of-type(3) {
margin-top: 20px; margin-top: 20px;
&:nth-of-type(2) {
margin-bottom: 70px; margin-bottom: 70px;
} }
.form-title { .form-title {
......
...@@ -141,9 +141,11 @@ export default { ...@@ -141,9 +141,11 @@ export default {
}, },
methods: { methods: {
handleLook() {}, handleLook() {},
handleEdit() {}, handleEdit(scope) {
this.$router.push({path:'/account/editAccount',query:{id:scope.id}})
},
handleAdd(scope) { handleAdd(scope) {
this.$router.push({path:'/acount/addAccount',query:{id:scope.id}}) this.$router.push({path:'/account/addAccount',query:{id:scope.id}})
}, },
findAllDictData(dictType) { findAllDictData(dictType) {
var params = { var params = {
......
<template>
<div class="bloc-info-module">
<div class="wrapper">
<div class="wrap_left">
<div class="out_box_wrap">
<div class="fixed_widget">
<div class="label_text">版本:{{ bloc.merchantModelName || '--'}}</div>
<div class="label_text dr_top">
开通门店数:
<span v-if="bloc.numberStores" class="num_text">{{ bloc.numberStores }}家</span>
<span v-else class="num_text">--</span>
</div>
<div class="label_text dr_top">门店详情</div>
</div>
<div :class="isOpen ? 'table_wrapper_open' : 'table_wrapper_close'">
<!-- <GLTable v-if="isOpen" :hasPage="false" :tableParams="tableParams" :tableData="list" :headerStyle="{ background: '#F4F6FC', color: '#333333', fontSize: '14px' }"></GLTable> -->
<template v-if="isOpen">
<div class="line_wrapper wrap_header">
<div class="tittle text_w">序号</div>
<div class="tittle1 text_w">门店名称</div>
<div class="tittle2 text_w">有效期</div>
</div>
<div class="line_body">
<template v-if="list.length">
<div v-for="(item, index) in list" :key="index" class="line_wrapper">
<div class="tittle">{{ index + 1 }}</div>
<div class="tittle1">{{ item.merchantName }}</div>
<div class="tittle2">{{ item.date }}</div>
</div>
</template>
<template v-if="!list.length">
<div class="line_wrapper">暂无数据</div>
</template>
</div>
</template>
</div>
<div class="fixed_footer" @click="changeRightOpenStatus(isOpen)">
<i :class="isOpen ? 'el-icon-caret-top' : 'el-icon-caret-bottom'"></i>
<span class="dr_left">{{ isOpen ? '隐藏门店详情' : '展开门店详情' }}</span>
</div>
</div>
</div>
<!-- <div class="wrap_right">
<div v-for="(item, index) in rightData" :key="index" class="out_box_wrap">
<div class="fixed_widget">
<div class="label_text">版本:{{ item.name }}</div>
<div class="label_text dr_top">
开通门店数:
<span class="num_text">{{ item.num }}家</span>
</div>
<div class="label_text dr_top">门店详情</div>
</div>
<div :class="item.open ? 'table_wrapper_open' : 'table_wrapper_close'">
<glsx-table v-if="item.open" :hasPage="false" :tableParams="tableParams" :tableData="item.list" :headerStyle="{ background: '#F4F6FC', color: '#333333', fontSize: '14px' }"></glsx-table>
</div>
<div class="fixed_footer" @click="changeRightOpenStatus(item, index)">
<i :class="item.open ? 'el-icon-caret-top' : 'el-icon-caret-bottom'"></i>
<span class="dr_left">{{ item.open ? '隐藏门店详情' : '展开门店详情' }}</span>
</div>
</div>
</div> -->
</div>
</div>
</template>
<script>
export default {
name: '',
data() {
return {
curOpenIndex: 0,
dataList: [],
leftData: [],
rightData: [],
tableParams: {
listName: 'list',
tableColumns: [
{
label: '门店名称',
prop: 'merchantName'
},
{
label: '有效期',
prop: 'date'
}
]
},
isOpen: false
}
},
props: {
list: Array,
bloc: null
},
methods: {
// changeLeftOpenStatus(item, index) {
// this.leftData[index].open = !item.open
// },
changeRightOpenStatus(isOpen) {
this.isOpen = !isOpen
},
// handlerData() {
// let arr = this.dataList
// let left = []
// let right = []
// arr.forEach((item, index) => {
// if (index % 2 == 0) {
// left.push(item)
// } else {
// right.push(item)
// }
// })
// this.leftData = left
// this.rightData = right
// console.log(left)
// console.log(right)
// }
},
mounted() {}
}
</script>
<style lang="scss" scoped>
.bloc-info-module {
box-sizing: border-box;
padding: 20px 0 0 40px;
}
.wrapper {
display: flex;
flex-wrap: wrap;
.wrap_left,
.wrap_right {
// min-width: 44.8%;
min-width: 520px;
min-height: 176px;
}
.wrap_left {
margin-right: 40px;
}
}
.out_box_wrap {
width: 100%;
min-height: 176px;
box-shadow: 0px 10px 20px 0px rgba(88, 80, 255, 0.1);
border-radius: 10px;
border: 1px solid #e5e4ff;
margin: 0 40px 40px 0;
.fixed_widget {
width: 100%;
height: 140px;
box-sizing: border-box;
padding: 20px 0 0 20px;
.label_text {
color: #333333;
font-size: 14px;
font-weight: 400;
}
.num_text {
font-size: 14px;
font-weight: 400;
color: #5850ff;
}
.dr_top {
margin-top: 20px;
}
}
.table_wrapper_close {
height: 0;
// transition: height 0.1s ease-in-out;
}
.table_wrapper_open {
height: 378px;
// transition: height 0.1s ease-in-out;
}
.line_wrapper {
width: 100%;
min-height: 54px;
background: #ffffff;
display: flex;
align-items: center;
justify-content: center;
color: #909399;
font-size: 14px;
border-bottom: 1px solid #dcdfe6;
.tittle {
width: 20%;
text-align: center;
color: #333333;
font-size: 14px;
}
.tittle1 {
width: 40%;
text-align: center;
color: #333333;
font-size: 14px;
word-wrap: break-word;
word-break: break-all;
overflow: hidden;
}
.tittle2 {
width: 40%;
text-align: center;
color: #333333;
font-size: 14px;
}
}
.wrap_header {
background: #f4f6fc;
}
.text_w {
font-weight: bold;
}
.line_body {
width: 100%;
height: 324px;
overflow-y: auto;
overflow-x: hidden;
}
.line_body::-webkit-scrollbar {
height: 1px;
width: 8px;
}
.line_body::-webkit-scrollbar-thumb {
background: #e9e8ff;
border-radius: 7px;
}
.fixed_footer {
width: 100%;
height: 36px;
background: #f4f6fc;
display: flex;
align-items: center;
justify-content: center;
font-size: 14px;
font-weight: 400;
color: #b9b8c7;
border-radius: 0px 0px 10px 10px;
cursor: pointer;
.dr_left {
margin-left: 12px;
}
}
}
// .bloc-info-module /deep/ .el-table__body-wrapper {
// height: 352px;
// overflow-y: auto;
// overflow-x: hidden;
// }
// .bloc-info-module /deep/ .el-table__body-wrapper::-webkit-scrollbar {
// height: 1px;
// width: 8px;
// }
// .bloc-info-module /deep/ .el-table__body-wrapper::-webkit-scrollbar-thumb {
// background: #e9e8ff;
// border-radius: 7px;
// }
</style>
\ No newline at end of file \ No newline at end of file
<template>
<div class="out_main">
<!-- <div class="base-info-index"> -->
<div class="top_widget">
<img class="sign_icon" src="../../assets/scrm_base_info_icon_one.png" />
<div class="info_widget">
<div class="title_text">
{{ blocInfo.merchantName }}
<span class="min_text">(商户号:{{ blocInfo.merchantNo }})</span>
</div>
<div class="sec_title_text dr_top_1">
<span>关联企微:{{ blocInfo.entmicroName || '--' }}</span>
<div v-if="blocInfo.entmicroName" class="auth_btn" :class="accountLevel != 4 ? 'auth_btn_cp' : ''">已授权</div>
</div>
<div v-if="accountLevel==1" class="min_text dr_top_1">所属企业:--</div>
<div v-if="accountLevel!=1" class="min_text dr_top_1">所属企业:{{ blocInfo.parentName }}</div>
<div v-if="accountLevel==4" class="min_text">企微员工:{{ blocInfo.entMicroEmployeeCount }}人</div>
</div>
</div>
<blocModule :bloc="blocInfo" :list.sync="storesList" v-if="accountLevel != 4"></blocModule>
<shopModule v-if="accountLevel == 4"></shopModule>
<!-- </div> -->
</div>
</template>
<script>
import shopModule from './shop.vue'
import blocModule from './bloc.vue'
// import { merchantInfo } from '../../api/modules/baseinfoApi'
export default {
name: 'index',
components: {
shopModule,
blocModule
},
data() {
return {
platform: 1, //1 集团 2 门店
accountLevel:1,//1-工厂;2-省代;3-市代;4-门店
blocInfo: {
merchantName: ''
},
storesList: []
}
},
created() {
//this.$globalState.accountLevel
// const { session } = this.$globalState
// this.platform = session.merchantModel
// this.loginInfo = session
// this.accountLevel = session.accountLevel
this.getBlocData()
},
methods: {
getBlocData() {
// let para = {
// merchantId: this.loginInfo.merchantId,
// sessionId: this.loginInfo.sessionId
// }
this.$apis.baseInfo.merchantInfo({}).then(res => {
this.blocInfo = res
this.storesList = res.stores.map(item => {
item.date = `${this.dateFormat(item.starttime, 'YYYY.MM.DD')}--${this.dateFormat(item.endtime, 'YYYY.MM.DD')}`
return item
})
})
},
dateFormat: function (dateTime, format = 'yyyy-MM-dd') {
const date = new Date(dateTime)
const config = {
YYYY: date.getFullYear(),
MM: date.getMonth() + 1, //getMonth() 方法根据本地时间返回指定日期的月份(从 0 到 11)
DD: date.getDate(),
HH: date.getHours(),
mm: date.getMinutes(),
ss: date.getSeconds()
}
for (const key in config) {
format = format.replace(key, config[key])
}
return format
}
}
}
</script>
<style lang="scss" scoped>
.out_main {
box-sizing: border-box;
height: 100%;
// margin: 0 20px 64px 40px;
background: #fff;
// box-shadow: 0px 10px 20px 0px rgba(88, 80, 255, 0.1);
// min-height: calc(100vh - 144px);
}
.base-info-index {
width: 100%;
height: calc(100vh - 144px);
background: #fff;
box-shadow: 0px 10px 20px 0px rgba(88, 80, 255, 0.1);
overflow: hidden;
overflow-y: scroll;
}
.out_main::-webkit-scrollbar {
height: 1px;
width: 8px;
}
.out_main::-webkit-scrollbar-thumb {
background: #e9e8ff;
border-radius: 7px;
}
.top_widget {
width: 100%;
box-sizing: border-box;
padding: 40px 0 0 40px;
display: flex;
.sign_icon {
width: 64px;
height: 64px;
border-radius: 50%;
}
.info_widget {
margin-left: 15px;
.title_text {
color: #333333;
font-size: 16px;
font-weight: 500;
}
.min_text {
color: #999999;
font-size: 12px;
line-height: 20px;
}
.sec_title_text {
color: #333333;
font-size: 14px;
font-weight: 400;
.auth_btn {
width: 48px;
height: 20px;
text-align: center;
line-height: 20px;
border-radius: 1px;
border: 1px solid #ff6d00;
font-size: 12px;
font-weight: 400;
color: #ff6d00;
display: inline-block;
margin-left: 16px;
}
.auth_btn_cp {
border: 1px solid #5850ff;
color: #5850ff;
}
}
.dr_top_1 {
margin-top: 8px;
}
}
}
</style>
\ No newline at end of file \ No newline at end of file
<template>
<div class="gl-page">
<div class="page-title">
<span>门店账户关联企微</span>
<span class="min-title">关联之后不允许修改,请谨慎操作!</span>
</div>
<div class="page-wrapper">
<div class="wrap-title">
<span>选择你要绑定的商户/门店</span>
<span class="wrap-min-title">(只有账户状态正常的门店和商户才允许关联,如未开通,请联系您的专属顾问)</span>
</div>
<div class="sel-wrap">
<div class="sel-lable">商户/门店账户</div>
<el-cascader ref="cascaderRef1" placeholder="请选择商户/门店" @change="getCurMerchant" :show-all-levels="false" v-model="shopName" :props="mypropParam1" :options="shopList" size="small" style="width: 320px" separator=" " filterable></el-cascader>
</div>
<div style="height: 32px"></div>
<div class="wrap-title">
<span>选择你要绑定的企微门店</span>
<span class="wrap-min-title">(企业微信授权成功后,企业微信相关内容才会显示)</span>
</div>
<div class="sel-wrap">
<div class="sel-lable">企业微信</div>
<el-cascader ref="cascaderRef" @change="getCurDepartment" placeholder="请选择企微门店" :show-all-levels="false" v-model="selectedDepartment" :props="mypropsParam" :options="departmentList" size="small" style="width: 320px" separator=" " filterable></el-cascader>
</div>
<div class="btn-wrap">
<el-button type="purple" size="small" icon="el-icon-link" @click="handlerGL">关联</el-button>
</div>
</div>
<div class="tbale-wrapper">
<div class="wrap-title">
<span>绑定的商户/门店</span>
<span class="wrap-min-title">(绑定成功后,门店账户管理列表-关联的企业微信会显示关联的内容)</span>
</div>
<div class="table_widget">
<GLTable :hasPage="false" :tableParams="tableParams" :tableData="dataList" :headerStyle="{ background: '#F4F6FC', color: '#333333', fontSize: '14px', height: '54px' }">
<template slot="auth-button" slot-scope="scope" :data="scope.scope">
<span @click="deleteLine(scope.scope)" class="blue-text">删除</span>
</template>
</GLTable>
</div>
</div>
<div style="height: 64px"></div>
<div class="fixed-footer">
<div :style="{ width: customWidth + 'px' }" class="btn-custom" @click="closeCurRouter">取消</div>
<div style="width: 40px"></div>
<div :style="{ width: customWidth + 'px' }" ref="btnWidth" class="btn-custom pruple" @click="handleMutiGL">确定关联({{ dataList.length }})</div>
</div>
</div>
</template>
<script>
export default {
name: '',
data() {
return {
departmentList: [],
shopList: [],
qwShop: '',
tableParams: {
tableColumns: [
{
label: '商户/门店账户',
prop: 'merchantName'
},
{
label: '企微门店',
prop: 'departmentName'
}
],
tableOption: {}
},
mypropParam1: {
value: 'id',
label: 'label',
children: 'children',
checkStrictly: true,
disabled: 'disabled'
},
mypropsParam: {
label: 'departmentName',
value: 'id',
children: 'children',
checkStrictly: true,
disabled: 'disabled'
},
dataList: [],
customWidth: 113,
shopName: '',
selectedDepartment: ''
}
},
created() {
this.getDepartmentList()
this.getMerchantList()
},
mounted() {},
methods: {
// 设置底部按钮宽度
setBtnWidth() {
let _this = this
this.$nextTick(function () {
_this.customWidth = _this.$refs.btnWidth.clientWidth
})
},
// 获取当前选择的商户
getCurMerchant(val) {
let id = val[val.length - 1]
let labels = this.$refs.cascaderRef1.getCheckedNodes()[0].pathLabels
let curLabel = labels[labels.length - 1]
this.curTempMerchant = {
merchantId: id,
merchantName: curLabel
}
this.$refs.cascaderRef1.dropDownVisible = false
},
// 获取当前选择的部门
getCurDepartment(val) {
let ids = val[val.length - 1]
let labels = this.$refs.cascaderRef.getCheckedNodes()[0].pathLabels
let curLabel = labels[labels.length - 1]
this.tempDepart = {
departmentId: ids,
departmentName: curLabel
}
this.$refs.cascaderRef.dropDownVisible = false
},
getDepartmentList() {
this.$apis.baseInfo.getDepartment({ id: 1 }).then(res => {
this.departmentList = this.traverse(res, 'relevanceMerchant')
})
},
getMerchantList() {
this.$apis.baseInfo.getMerchantTree({}).then(res => {
this.shopList = this.traverse(res, 'entmicroName', 'merchantAccountLevel')
})
},
// 关联当前选择的
handlerGL() {
if (!this.curTempMerchant) {
this.$message({
message: '请选择门店/商户',
type: 'warning'
})
return
}
if (!this.tempDepart) {
this.$message({
message: '请选择企微门店',
type: 'warning'
})
return
}
this.curGLData = {
...this.curTempMerchant,
...this.tempDepart
}
let flag = false
this.dataList.forEach(item => {
if (item.departmentId == this.curGLData.departmentId && item.merchantId == this.curGLData.merchantId) {
flag = true
}
})
if (flag) {
this.$message({
message: '该关联已在列表当中',
type: 'warning'
})
return
}
this.dataList.push(this.curGLData)
this.setBtnWidth()
},
closeCurRouter() {
this.$router.push({ path: '/account/index' })
},
// 批量关联
handleMutiGL() {
if (!this.dataList.length) {
this.$message({
message: '请先选择您要关联的账户',
type: 'warning'
})
return
}
let merchantIds = []
let departmentIds = []
let departNames = []
let arrpara1 = []
let arrpara2 = []
let arrpara3 = []
this.dataList.forEach(item => {
merchantIds.push(item.merchantId)
departmentIds.push(item.departmentId)
departNames.push(item.departmentName)
})
merchantIds.forEach((item, index) => {
let keyval = `list[${index}].merchantId`
let val = item
arrpara1.push({
[keyval]: val
})
})
departmentIds.forEach((item, index) => {
let keyval = `list[${index}].departmentId`
let val = item
arrpara2.push({
[keyval]: val
})
})
departNames.forEach((item, index) => {
let keyval = `list[${index}].departName`
let val = item
arrpara3.push({
[keyval]: val
})
})
let all = [...arrpara1, ...arrpara2, ...arrpara3]
let para = Object.assign({}, ...all)
this.$apis.baseInfo.toGL(para).then(res => {
if (res) {
this.$message({
message: '操作成功',
type: 'success'
})
this.$router.push({ path: '/account/index' })
}
})
},
deleteLine(row) {
let tempindex = 0
this.dataList.forEach((item, index) => {
if (item.departmentId == row.departmentId) {
tempindex = index
}
})
console.log(tempindex)
this.$confirm('此操作将删除该项, 是否继续?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
})
.then(() => {
this.dataList.splice(tempindex, 1)
this.setBtnWidth()
this.$message({
type: 'success',
message: '删除成功!'
})
})
.catch(() => {
this.$message({
type: 'info',
message: '已取消删除'
})
})
},
// 递归:处理层级数组
traverse(arr, string1, string2, arr1 = []) {
arr.map(item => {
if (item[string1] || item[string2] != 4) {
item.disabled = true
} else {
item.disabled = false
}
if (item.children && item.children instanceof Array) {
this.traverse(item.children, string1, string2, (arr1 = []))
}
return arr1.push(item)
})
return arr1
}
}
}
</script>
<style lang="scss" scoped>
.gl-page {
box-sizing: border-box;
// padding: 20px 20px 20px 40px;
}
.page-title {
font-size: 20px;
font-weight: 500;
color: #424242;
.min-title {
font-size: 12px;
font-weight: 500;
color: #5850ff;
letter-spacing: 1px;
margin-left: 10px;
}
}
.page-wrapper {
width: 100%;
height: 320px;
background: #ffffff;
box-shadow: 0px 10px 20px 0px rgba(88, 80, 255, 0.1);
box-sizing: border-box;
padding: 32px 0 0 20px;
margin-top: 20px;
.sel-wrap {
display: flex;
align-items: center;
margin-top: 12px;
.sel-lable {
width: 128px;
box-sizing: border-box;
padding-right: 10px;
font-size: 14px;
font-weight: 400;
color: #333333;
text-align: right;
}
}
.btn-wrap {
padding-left: 20px;
padding-top: 40px;
}
}
.tbale-wrapper {
width: 100%;
height: 590px;
background: #ffffff;
box-shadow: 0px 10px 20px 0px rgba(88, 80, 255, 0.1);
box-sizing: border-box;
padding: 20px;
margin-top: 20px;
.table_widget {
margin-top: 16px;
// height: 439px;
}
.blue-text {
font-size: 14px;
font-weight: 400;
color: #5850ff;
cursor: pointer;
}
}
.fixed-footer {
position: fixed;
left: 0;
right: 0;
bottom: 0;
// width: calc(100% - 177px);
// background: #5850ff;
height: 64px;
z-index: 10;
background: #ffffff;
box-shadow: 0px -1px 1px 0px rgba(88, 80, 255, 0.1);
display: flex;
align-items: center;
justify-content: center;
.btn-custom {
font-size: 14px;
color: #fff;
font-weight: 400;
background: #999999;
border-radius: 4px;
cursor: pointer;
text-align: center;
padding: 8px 0;
}
.pruple {
background: #5850ff;
}
}
.wrap-title {
font-size: 16px;
font-weight: 500;
color: #333333;
.wrap-min-title {
font-size: 12px;
font-weight: 500;
color: #999999;
letter-spacing: 1px;
margin-left: 10px;
}
}
// table{
// max-height: 430px!important;
// }
.el-button--purple {
color: #fff;
background-color: #5850ff;
border-color: #5850ff;
border-radius: 4px;
}
</style>
\ No newline at end of file \ No newline at end of file
<template>
<div class="shop-info-module">
<div class="wrapper">
<div class="out_wrap dr_right">
<div class="elment_widget">
<div class="top_bg_wrap">
<div class="title_text">已购产品信息</div>
<div class="desc_text">
<span>标准版有效期:</span>
<span class="spc_text">2021年1月1日-2022年1月1日</span>
</div>
</div>
<div class="bottom_wrap">
<div class="info_text">已购版本:嘀加智慧门店SCRM标准版</div>
<div class="info_text dr_top">短信总条数:10000条</div>
<div class="info_text dr_top">外呼电话总数:5000个</div>
</div>
</div>
<div class="element_btn dr_top">续费</div>
</div>
<div class="out_wrap dr_right">
<div class="elment_widget dr_right">
<div class="top_bg_wrap">
<div class="title_text">智能语音电话套餐信息</div>
<div class="desc_text">
<span>剩余外呼电话数:</span>
<span class="spc_text max_text">3000</span>
<span class="unit_text">个</span>
</div>
</div>
<div class="bottom_wrap">
<div class="info_text">已呼电话个数:2000个</div>
<div class="info_text dr_top">已购版本:嘀加智慧门店SCRM标准版-智能语音…</div>
<div class="info_text dr_top">外呼电话总数:5000个</div>
</div>
</div>
<div class="element_btn dr_top disableBtn">续费</div>
</div>
<div class="out_wrap">
<div class="elment_widget">
<div class="top_bg_wrap">
<div class="title_text">短信套餐信息</div>
<div class="desc_text">
<span>剩余短信条数:</span>
<span class="spc_text max_text">8000</span>
<span class="unit_text">条</span>
</div>
</div>
<div class="bottom_wrap">
<div class="info_text">剩余短信条数:2000条</div>
<div class="dr_top min_text">
<span>营销短信:1000条</span>
<span class="dr_left">通知:1000条</span>
</div>
<div class="info_text dr_top">已购版本:嘀加智慧门店SCRM标准版-短信套餐</div>
<div class="info_text dr_top">短信总条数:10000条-短信套餐</div>
</div>
</div>
<div class="element_btn dr_top disableBtn">续费</div>
</div>
</div>
</div>
</template>
<script>
export default {
name: '',
data() {
return {}
},
methods: {}
}
</script>
<style lang="scss" scoped>
.shop-info-module {
box-sizing: border-box;
padding: 60px 0 0 40px;
}
.wrapper {
display: flex;
.dr_right {
margin-right: 30px;
}
.out_wrap {
width: 29%;
height: 298px;
.elment_widget {
width: 100%;
height: 250px;
border: 1px solid #e5e4ff;
border-radius: 10px;
.top_bg_wrap {
width: 100%;
height: 108px;
background-image: url('../../assets/scrm_base_info_icon_two.png');
background-size: 100% 108px;
box-sizing: border-box;
padding: 20px 0 0 20px;
.title_text {
color: #333;
font-size: 18px;
font-weight: 600;
}
.desc_text {
font-size: 14px;
font-weight: 400;
color: #333333;
margin-top: 28px;
.spc_text {
font-weight: 600;
color: #5850ff;
}
.max_text {
font-size: 22px;
}
.unit_text {
margin-left: 4px;
}
}
}
.bottom_wrap {
width: 100%;
height: 142px;
box-sizing: border-box;
padding: 20px 0 0 20px;
box-shadow: 0px 10px 20px 0px rgba(88, 80, 255, 0.1);
.info_text {
font-size: 14px;
font-weight: 400;
color: #666666;
}
.min_text {
font-size: 12px;
color: #666666;
}
.dr_left {
margin-left: 30px;
}
}
}
.element_btn {
width: 72px;
height: 36px;
text-align: center;
line-height: 36px;
background: #5850ff;
border-radius: 4px;
color: #fff;
font-size: 16px;
font-weight: 600;
margin: 0 auto;
cursor: pointer;
}
.disableBtn {
background: #CCC;
}
}
}
.dr_top {
margin-top: 10px !important;
}
</style>
\ No newline at end of file \ No newline at end of file
<!-- 选择分页 -->
<template>
<div>
<el-popover popper-class="select-page" ref="popover" placement="bottom-start" trigger="click" v-model="popoverVisible" :disabled="targetItem.isDisabled" @show="onShowPopover" @hide="onHidePopover">
<el-radio-group class="select-tree" v-model="form[targetItem.name]" @change="handleChangeRadio">
<el-radio class="page-radio" :title="item.merchantName" v-for="item in currList" :key="item.id" :label="item.id">{{ item.merchantName }}</el-radio>
</el-radio-group>
<div class="btns">
<el-button :size="size" :disabled="page.pageNum == 1" @click="handlePage(false)">上一页</el-button>
<span>{{ page.pageNum }}/{{ page.totalPage }}</span>
<el-button :size="size" :disabled="page.pageNum == page.totalPage" @click="handlePage(true)">下一页</el-button>
</div>
<!-- <el-tree ref="tree" class="select-tree" highlight-current default-expand-all node-key="id" :expand-on-click-node="isExpand" :style="`min-width: ${treeWidth}`" :data="treeData" :current-node-key="form[targetItem.name]" :props="defaultProps" :filter-node-method="handleFilterNode" @current-change="handleNodeClick"></el-tree> -->
<el-input slot="reference" ref="input" v-model="form[targetItem.nameLabel]" clearable :disabled="targetItem.isDisabled" :style="`width: ${width}px`" :class="{ rotate: popoverVisible }" suffix-icon="el-icon-arrow-down" :placeholder="'请选择' + targetItem.label" @change="handleClear"></el-input>
</el-popover>
</div>
</template>
<script>
import { getAllMerchantListApi } from '@/api/modules/employee'
export default {
name: 'selectPage',
data() {
return {
size: 'small',
isExpand: false,
// 树状菜单显示状态
popoverVisible: false,
treeWidth: 'auto',
currList: [],
allMerchantList: [],
page: {
pageSize: 20,
pageNum: 1,
total: 0,
totalPage: 0
}
}
},
props: {
// 输入框宽度
width: {
type: String,
default: '300px'
},
form: {
type: Object,
default: () => {}
},
targetItem: {
type: Object,
default: () => {}
},
treeData: {
type: Array,
default: () => []
}
// defaultProps: {
// type: Object,
// default: () => ({
// parent: 'parentId',
// value: 'id',
// label: 'menuName',
// children: 'childlist'
// })
// }
},
// watch: {
// form(val) {
// if (this.form[this.targetItem.name]) {
// this.form[this.targetItem.nameLabel] = this.queryTree(this.treeData, this.form[this.targetItem.name])
// this.$nextTick().then(() => {
// this.$refs.tree.setCheckedKeys([this.form[this.targetItem.name]])
// })
// }
// }
// },
created() {
// 获取输入框宽度同步至树状菜单宽度
this.$nextTick(() => {
this.treeWidth = `${(this.width || this.$refs.input.$refs.input.clientWidth) - 24}px`
})
},
mounted() {
this.getAllMerchantList()
// if (this.form[this.targetItem.name]) {
// // console.log(this.treeData)
// // console.log(this.form)
// this.form[this.targetItem.nameLabel] = this.queryTree(this.treeData, this.form[this.targetItem.name])
// this.$nextTick().then(() => {
// this.$refs.tree.setCheckedKeys([this.form[this.targetItem.name]])
// })
// }
},
methods: {
getCurrList() {
this.currList = this.allMerchantList.slice((this.page.pageNum - 1) * this.page.pageSize, this.page.pageNum * this.page.pageSize)
},
getAllMerchantList() {
getAllMerchantListApi({}).then(res => {
this.allMerchantList = res
this.page.total = res.length
this.page.totalPage = Math.ceil(res.length / this.page.pageSize)
this.getCurrList()
// index + (page[this.pageConf.pageNum] - 1) * page[this.pageConf.pageSize] + 1
})
},
handlePage(isNext) {
this.page.pageNum = isNext ? this.page.pageNum + 1 : this.page.pageNum - 1
this.getCurrList()
},
handleChangeRadio(val) {
this.form[this.targetItem.nameLabel] = this.currList.find(item => item.id == val).merchantName
this.$emit('handleChange', val)
this.onHidePopover()
},
// handleClickRadio(item) {
// console.log(item)
// },
// 显示时触发
onShowPopover() {
this.popoverVisible = true
// this.$refs.tree.filter(false)
},
// 隐藏时触发
onHidePopover() {
this.popoverVisible = false
},
// 树节点过滤方法
// handleFilterNode(query, data) {
// if (!query) return true
// return data[this.defaultProps.label].indexOf(query) !== -1
// },
// handleNodeClick(val) {
// this.$emit('selected', { val: val, targetItem: this.targetItem, formName: this.targetItem.formName })
// this.onHidePopover()
// },
handleClear(val) {
this.form[this.targetItem.name] = ''
this.form[this.targetItem.nameLabel] = ''
this.$emit('handleChange')
// this.$emit('selected', { val: val, targetItem: this.targetItem, formName: this.targetItem.formName })
// window.event.stopPropagation()
}
// 搜索树状数据中的 ID
// queryTree(tree, id) {
// let stark = []
// stark = stark.concat(tree)
// while (stark.length) {
// const temp = stark.shift()
// if (temp[this.defaultProps.children]) {
// stark = stark.concat(temp[this.defaultProps.children])
// }
// if (temp[this.defaultProps.value] === id) {
// return temp[this.defaultProps.label]
// }
// }
// return
// }
}
}
</script>
<style>
.el-input.el-input--suffix.rotate .el-input__suffix .el-icon-arrow-down {
transform: rotate(-180deg);
}
.select-tree {
max-height: 400px;
overflow-y: scroll;
}
.page-radio {
display: block;
width: 320px;
height: 36px;
line-height: 36px;
overflow: hidden;
white-space: nowrap;
text-overflow: ellipsis;
}
.select-page {
padding-bottom: 6px;
}
.select-page .btns {
display: flex;
justify-content: space-between;
align-items: center;
}
</style>
<!-- 编辑员工 -->
<template>
<div class="config-employee">
<div class="container">
<p class="edit-title">{{ title }}</p>
</div>
<div class="container">
<p class="edit-sub-title p-rl-20">员工基本信息</p>
<glsx-combi-form class="p-rl-20" ref="editFormRef" labelWidth="160px" :isBlock="isBlock" :formRef="editChildRef" :formObj="editForm" :formData="editFormData" :formRules="editRule">
<template slot="merchantId" slot-scope="item">
<select-page :form="editForm" width="300px" :targetItem="item.scope"></select-page>
<!-- <el-select v-model="editForm.merchantId" placeholder="请选择所属商户" @change="handleChangeMerchant($event, item)">
<el-option v-for="subItem in baseData.allMerchantList" :key="subItem.id" :label="subItem.merchantName" :value="subItem.id" :disabled="subItem.isDisabled || false"></el-option>
</el-select> -->
</template>
</glsx-combi-form>
</div>
<!-- <template
slot="menuTree"
slot-scope="scope"
>
<select-tree
:form="searchForm"
:targetItem="scope.scope"
:treeData="baseData.searchMenuTreeList"
:defaultProps="treeDefaultProps"
@selected="handleTreeSelect"
></select-tree>
</template> -->
<div class="footer">
<el-button type="primary" @click="handleConfirm">确定</el-button>
<el-button type="default" @click="handleCancel">取消</el-button>
</div>
</div>
</template>
<script>
import { utils } from 'glsx-common'
import selectPage from './components/selectPage'
import glsxCombiForm from './glsx-combi-form'
import { getAllMerchantListApi, getRoleListApi, getMerchantTreeApi } from '@/api/modules/employee'
export default {
name: 'editEmployee',
data() {
return {
title: '新增员工',
titleObj: {
1: '新增员工',
2: '编辑员工'
},
editChildRef: 'editChildRef',
routeInfo: {
// 1-新增;2-编辑
addOrEdit: 1,
id: ''
},
editForm: {
merchantId: '',
merchantName: '',
staffName: '',
staffPhone: '',
password: '',
searchMerchant: '',
roleId: '',
merhcnatImg: ''
},
editRule: {
merchantId: [{ required: true, message: '请选择所属商户', trigger: 'change' }],
staffName: [{ required: true, message: '请输入员工姓名', trigger: 'change' }],
staffPhone: [{ required: true, message: '请输入登录手机号', trigger: 'change' }],
password: [{ required: true, message: '请输入登录密码', trigger: 'change' }],
searchMerchant: [{ required: true, message: '请选择可见商户', trigger: 'change' }],
roleId: [{ required: true, message: '请选择角色权限', trigger: 'change' }]
},
isBlock: true,
editFormData: [
{
label: '所属商户',
name: 'merchantId',
nameLabel: 'merchantName',
optionList: [],
optionId: 'id',
optionLabel: 'merchantName',
optionsName: 'allMerchantList',
addHtml: 'merchantId'
},
{
label: '员工姓名',
name: 'staffName',
width: '360px',
type: 'input',
maxlength: 15
},
{
label: '登录手机号',
name: 'staffPhone',
width: '360px',
type: 'input',
placeholder: '请输入您有效的手机号作为登录账户',
maxlength: 11
},
{
label: '登录密码',
name: 'password',
width: '360px',
type: 'input',
maxlength: 15
},
{
label: '可见商户',
name: 'searchMerchant',
addHtml: 'searchMerchant'
},
{
label: '角色权限',
name: 'roleId',
type: 'select',
optionList: [],
optionId: 'id',
optionLabel: 'roleName',
optionsName: 'roleList'
},
{
label: '头像',
name: 'merhcnatImg',
type: 'upload',
maxPhotoNum: 1,
wdithLt: 800,
heightLt: 640,
handleUpload: (e, file, targetItem) => {
const imgFile = e.target.result
const base64 = file.name.split('.')[1] + '@' + imgFile.split(',')[1]
// uploadImg({ file: base64, fileType: 'image' }).then(res => {
// this.editForm[targetItem.name] = res
// this.$refs.editFormRef.$refs[this.editChildRef].validateField(targetItem.name)
// })
}
},
{
label: '邮箱',
name: 'staffEmail',
width: '360px',
type: 'input',
maxlength: 30
},
{
label: '主要职务',
name: 'staffJob',
width: '360px',
type: 'input',
maxlength: 10
}
],
baseData: {
allMerchantList: [],
merchantTree: [],
roleList: []
}
}
},
components: {
glsxCombiForm,
selectPage
},
computed: {},
mounted() {
this.routeInfo = this.$route.params
this.getAllMerchantList()
},
methods: {
getAllMerchantList() {
getAllMerchantListApi({}).then(res => {
this.baseData.allMerchantList = res
})
},
handleChangeMerchant(e, item) {
console.log(e)
console.log(item)
this.editForm.roleId = ''
// this.editForm.roleId = ''
this.getRoleList(e)
this.getMerchantTree(e)
},
getMerchantTree(value) {
getMerchantTreeApi({ id: value }).then(res => {
this.baseData.merchantTree = res
})
},
getRoleList(value) {
getRoleListApi({ id: value }).then(res => {
this.baseData.roleList = res
this.getOptionsList('editFormData', false, 'roleId')
})
},
getOptionsList(formName, hasAll = true, refreshSigle) {
if (refreshSigle) {
var item = this[formName].find(k => k.name == refreshSigle)
var index = this[formName].findIndex(k => k.name == refreshSigle)
this.$set(this[formName][index], 'optionList', utils.deepClone(this.baseData[item.optionsName]))
if (hasAll && this.baseData[item.optionsName].length && this.baseData[item.optionsName][0][this[formName][index].optionLabel] !== '全部') {
const temp = {}
temp[this[formName][index].optionId] = ''
temp[this[formName][index].optionLabel] = '全部'
this[formName][index].optionList.unshift(temp)
}
} else {
this[formName].forEach((item, index) => {
if (item.type === 'select' && this.baseData[item.optionsName].length) {
// this.$set(this[formName][index], 'optionList', _.cloneDeep(this.baseData[item.optionsName]))
this.$set(this[formName][index], 'optionList', utils.deepClone(this.baseData[item.optionsName]))
if (hasAll && this.baseData[item.optionsName].length && this.baseData[item.optionsName][0][this[formName][index].optionLabel] !== '全部') {
const temp = {}
temp[this[formName][index].optionId] = ''
temp[this[formName][index].optionLabel] = '全部'
this[formName][index].optionList.unshift(temp)
}
}
})
}
}
}
}
</script>
<style scoped>
.config-employee {
margin-bottom: 64px;
}
.config-employee .container {
margin-top: 20px;
background: #ffffff;
box-shadow: 0 10px 20px 0 rgba(88, 80, 255, 0.1);
padding: 20px;
}
.config-employee .p-rl-20 {
padding: 0 20px;
}
.config-employee .flex {
display: flex;
justify-content: space-between;
}
.config-employee .edit-container {
margin-bottom: 84px;
}
.config-employee .footer {
position: fixed;
bottom: 0;
width: 100%;
height: 64px;
text-align: center;
line-height: 64px;
background: #ffffff;
z-index: 999;
}
.config-employee .flex {
display: flex;
justify-content: space-between;
}
.config-employee .edit-title {
font-size: 20px;
font-weight: bold;
color: #333333;
line-height: 38px;
height: 38px;
margin: 0 0;
}
/* .config-employee .edit-sub-title::before {
position: absolute;
display: inline-block;
content: '';
height: 18px;
width: 4px;
top: 2px;
left: 0;
background-color: #0947C6;
} */
.config-employee .edit-sub-title {
height: 48px;
line-height: 48px;
font-size: 16px;
color: #333333;
font-weight: 600;
border-bottom: 1px solid #e7eaec;
margin: 0 0;
}
</style>
/**
* 时间控件-限制月份
*/
export const beforeRangePickerOptions = {
disabledDate(date) {
if (date > new Date()) {
return true
}
return false
}
}
export const afterRangePickerOptions = {
disabledDate(date) {
const yesterday = new Date(new Date().setDate(new Date().getDate() - 1))
if (date < yesterday) {
return true
}
return false
}
}
<!-- 搜索 -->
<template>
<div class="glsx-combi-form">
<el-form :ref="formRef" :inline="true" :model="formObj" :label-width="labelWidth" :rules="formRules" size="small" class="glsx-combi-form-block">
<template v-for="(item, index) in formData">
<el-form-item v-if="!item.isHide" :key="index" :class="{ 'no-label': !item.label, isBlock: isBlock }" :label="item.label ? item.label + ':' : ''" :prop="item.name">
<span v-if="!item.isHide && item.tips" class="tips-block" slot="label">
<span class="tips-label">{{ item.label }}</span>
<el-tooltip popper-class="tooltip-class" effect="dark" :content="item.tips" :placement="item.placement || 'top'">
<span class="tips-icon"></span>
</el-tooltip>
{{ item.label ? ':' : '' }}
</span>
<slot v-if="item.addHtml" :name="item.addHtml" :scope="item"></slot>
<el-input v-else-if="item.type === 'input'" :placeholder="item.placeholder || '请输入' + item.label" v-model.trim="formObj[item.name]" :disabled="item.isDisabled" :maxlength="item.maxlength" :clearable="item.isClear || false" :type="item.inputType || 'text'" :style="{ width: item.width || 'auto' }" :show-word-limit="item.showLimit || false" @keydown.native="e => handleInputDown(e, item)"></el-input>
<!-- 选择-输入框 -->
<el-input v-else-if="item.type === 'selectInput'" :placeholder="'请输入' + item.selectOption.find(k => k.name === searchSelectObj[item.selectName].attr).label" v-model.trim="searchSelectObj[item.selectName].value" :clearable="item.isClear || false" class="input-with-select">
<el-select v-model="searchSelectObj[item.selectName].attr" style="width: 130px" slot="prepend" placeholder="请选择" @change="item.handleSelectChange">
<el-option v-for="(subItem, subIndex) in item.selectOption" :key="subIndex" :label="subItem.label" :value="subItem.name"></el-option>
</el-select>
</el-input>
<!-- 选择-时间选择框 -->
<template v-else-if="item.type === 'selectDatePicker'">
<el-select v-model="searchSelectObj[item.selectName].attr" style="width: 130px" placeholder="请选择" @change="item.handleSelectChange">
<el-option v-for="(subItem, subIndex) in item.selectOption" :key="subIndex" :label="subItem.label" :value="subItem.name"></el-option>
</el-select>
<el-date-picker v-model="searchSelectObj[item.selectName].value" style="width: calc(100% - 130px)" :type="item.dateType || 'daterange'" :clearable="item.isClear || false" range-separator="至" start-placeholder="开始日期" end-placeholder="结束日期" :picker-options="pickerOption[item.pickerOptions]"></el-date-picker>
</template>
<!-- 双选择框 -->
<template v-else-if="item.type === 'selectDouble'">
<el-select v-model="searchSelectObj[item.selectName].attr" style="width: 130px" placeholder="请选择" @change="item.handleSelectChange">
<el-option v-for="(subItem, subIndex) in item.selectOption" :key="subIndex" :label="subItem.label" :value="subItem.name"></el-option>
</el-select>
<el-select v-model="searchSelectObj[item.selectName].value" style="width: calc(100% - 130px)" :placeholder="'请选择' + item.selectOption.find(k => k.name === searchSelectObj[item.selectName].attr).label">
<el-option label="全部" value=""></el-option>
<el-option v-for="subItem in item.selectOption.find(k => k.name === searchSelectObj[item.selectName].attr).optionList" :key="subItem[item.optionId]" :label="subItem[item.optionLabel]" :value="subItem[item.optionId]"></el-option>
</el-select>
</template>
<!-- 选择框 -->
<el-select v-else-if="item.type === 'select'" :style="{ width: item.width || '100%' }" v-model="formObj[item.name]" :clearable="item.isClear || false" :placeholder="'请选择' + item.label" :filterable="!item.noFilter" :disabled="item.isDisabled" :no-data-text="item.noDataText || '无数据'" :multiple="item.multiple || false" :collapse-tags="item.collapseTags || true" @change="selectAddAttr($event, item)">
<el-option v-for="subItem in item.optionList" :key="subItem[item.optionId]" :label="subItem[item.optionLabel]" :value="subItem[item.optionId]" :disabled="subItem.isDisabled || false"></el-option>
</el-select>
<!-- radio -->
<el-radio-group v-else-if="item.type === 'radio'" v-model="formObj[item.name]" :disabled="item.isDisabled" @change="item.handleRadioChange">
<el-radio v-for="subItem in item.optionList" :key="subItem[item.optionId]" :label="subItem[item.optionId]">{{ subItem[item.optionLabel] }}</el-radio>
</el-radio-group>
<el-date-picker v-else-if="item.type === 'datePicker'" v-model="formObj[item.name]" :type="item.dateType || 'daterange'" :clearable="item.isClear || false" range-separator="至" start-placeholder="开始日期" end-placeholder="结束日期" :picker-options="pickerOption[item.pickerOptions]"></el-date-picker>
<template v-else-if="item.type === 'upload'">
<p class="photo-top-tips">{{ item.topTips }}</p>
<div v-if="!item.isDisabled">
<div v-if="Array.isArray(formObj[item.name]) ? formObj[item.name].length < item.maxPhotoNum : !formObj[item.name]" class="activity-img img-w-h">
<div class="add">+</div>
<span class="number">{{ formObj[item.name].length }} / {{ item.maxPhotoNum }}</span>
<input type="file" style="opacity: 0;" :id="item.name + 'file'" ref="file" class="activity-img img-w-h" accept="image/png, image/jpeg, image/gif, image/jpg" @change="e => handleImgChange(e, item)" />
</div>
</div>
<template>
<div v-if="Array.isArray(formObj[item.name]) ? formObj[item.name].length : formObj[item.name]">
<span v-if="Array.isArray(formObj[item.name])">
<span v-for="(subItem, subIndex) in formObj[item.name]" :key="subIndex" class="muti-imgs img-w-h">
<img class="img-w-h" :src="subItem.content" />
<span class="img-btns">
<span class="btn-item">
<i v-show="!item.isDisabled" class="el-icon-delete" @click="handleImgDelete(item, subIndex)"></i>
<i class="el-icon-zoom-in" @click="handleImgLook(subItem.content)"></i>
</span>
</span>
</span>
</span>
<span v-else class="muti-imgs">
<img class="img-w-h" :src="formObj[item.name]" />
<span class="img-btns">
<span class="btn-item">
<i v-show="!item.isDisabled" class="el-icon-delete" @click="handleImgDelete(item)"></i>
<i class="el-icon-zoom-in" @click="handleImgLook(formObj[item.name])"></i>
</span>
</span>
</span>
</div>
</template>
</template>
</el-form-item>
</template>
<slot name="footer"></slot>
</el-form>
<el-dialog :visible.sync="isImgVisible">
<img class="dialog-img" width="100%" :src="dialogImageUrl" alt="" />
</el-dialog>
</div>
</template>
<script>
import { beforeRangePickerOptions, afterRangePickerOptions } from './common'
export default {
name: 'glsx-combi-form',
data() {
return {
pickerOption: {
beforeRangePickerOptions: beforeRangePickerOptions,
afterRangePickerOptions: afterRangePickerOptions
},
isImgVisible: false,
dialogImageUrl: ''
}
},
props: {
isBlock: {
type: Boolean,
default: false
},
formRef: {
type: String,
default: 'formRef'
},
labelWidth: {
type: String,
default: '85px'
},
formData: {
type: Array,
default: () => []
},
formObj: {
type: Object,
default: () => {}
},
hasTitle: {
type: Boolean,
default: true
},
formRules: {
type: Object,
default: () => {}
},
// 搜索+输入框/搜索组合组件,搜索栏绑值
searchSelectObj: {
type: Object,
default: () => {}
}
},
mounted() {},
methods: {
// 选择框-添加其他属性
selectAddAttr(value, targetItem) {
targetItem.changeAttr && targetItem.changeAttr(value, targetItem)
},
handleInputDown(e, item) {
if (e.keyCode === 13 && item.hasOwnProperty('keyFn')) {
item.keyFn()
}
},
// 图片
handleImgChange(e, targetItem) {
var reader = new FileReader()
var file = e.srcElement.files[0]
// console.log(file)
// 默认1MB
const limitSize = targetItem.limitSize || 1
const isLt = file.size / 1024 / 1024 < limitSize
const isType = ['image/jpeg', 'image/png', 'image/jpg'].includes(file.type)
const maxPhotoNum = targetItem.maxPhotoNum || 1
const wdithLt = targetItem.wdithLt || 300
const heightLt = targetItem.heightLt || 300
if (maxPhotoNum == this.formObj[targetItem.name].length) {
this.$message.error('只能上传' + maxPhotoNum + '张图片')
return true
}
if (!isType) {
this.$message.error('上传图片不是jpg、jpeg或png的格式!')
return true
}
if (!isLt) {
this.$message.error('上传图片大小不能超过' + limitSize + 'MB!')
return true
}
reader.readAsDataURL(file)
reader.onload = e => {
var image = new Image()
image.src = e.target.result
image.onload = () => {
var imgWidth = image.width
var imgHeight = image.height
if (imgWidth > wdithLt || imgHeight > heightLt) {
this.$message.error('图片尺寸最大为' + wdithLt + '像素*' + heightLt + '像素')
} else {
targetItem.handleUpload(e, file, targetItem)
}
}
}
},
// 图片删除
handleImgDelete(targetItem, subIndex = -1) {
Array.isArray(this.formObj[targetItem.name]) ? this.formObj[targetItem.name].splice(subIndex, 1) : (this.formObj[targetItem.name] = '')
},
// 图片查看
handleImgLook(src) {
this.isImgVisible = true
this.dialogImageUrl = src
}
}
}
</script>
<style>
/* .glsx-combi-form {
min-width: 922px;
} */
.glsx-combi-form .glsx-combi-form-block {
padding: 16px 40px 0;
}
.glsx-combi-form .isBlock {
display: block;
}
/* .glsx-combi-form .el-form-item {
width: 65%;
} */
.glsx-combi-form .no-label.el-form-item--small .el-form-item__content,
.el-form-item--small .el-form-item__label {
width: 100%;
}
/* .glsx-combi-form .el-form-item--small .el-form-item__content {
width: calc(100% - 85px);
} */
.glsx-combi-form .el-col {
margin-bottom: 10px;
}
.glsx-combi-form .el-select {
width: 100%;
}
.glsx-combi-form .item-height {
height: 37px;
}
.glsx-combi-form input::-webkit-outer-spin-button,
.glsx-combi-form input::-webkit-inner-spin-button {
-webkit-appearance: none !important;
}
.glsx-combi-form input[type='number'] {
-moz-appearance: textfield !important;
}
.glsx-combi-form .input-with-select .el-input-group__prepend {
background-color: #fff;
}
/* 提示图标 */
.glsx-combi-form .tips-block {
position: relative;
}
.glsx-combi-form .tips-label {
margin-right: 20px;
}
.glsx-combi-form .tips-icon {
position: absolute;
display: inline-block;
width: 12px;
height: 12px;
top: 3px;
right: 14px;
margin-right: 4px;
cursor: pointer;
border: 1px solid #7f7f7f;
border-radius: 50%;
}
.glsx-combi-form .tips-icon::before {
content: '?';
position: absolute;
width: 8px;
height: 8px;
top: -8px;
left: 1px;
font-size: 10px;
}
/* .glsx-combi-form .tips {
margin: 0;
} */
/* 图片上传 */
.glsx-combi-form .photo-top-tips {
/* height: 36px; */
margin: 0 0;
color: #999999;
}
.glsx-combi-form .img-w-h {
width: 88px;
height: 74px;
}
.glsx-combi-form .activity-img {
position: relative;
color: #999999;
border: 1px dashed #d9d9d9;
cursor: pointer;
}
.glsx-combi-form .activity-Input {
position: absolute;
top: 0;
left: 0;
}
.glsx-combi-form .muti-imgs {
display: inline-block;
position: relative;
}
.activity-img .add {
position: absolute;
top: 40%;
font-size: 40px;
left: 50%;
transform: translate3d(-50%, -50%, 0);
}
.activity-img .number {
position: absolute;
bottom: 0;
left: 50%;
transform: translateX(-50%);
}
.muti-imgs .img-btns {
display: none;
height: 100%;
position: absolute;
width: 88px;
height: 74px;
left: 0;
top: 0;
z-index: 2;
color: #fff;
background: rgba(0, 0, 0, 0.5);
}
.glsx-combi-form .el-icon-delete,
.glsx-combi-form .el-icon-zoom-in {
cursor: pointer;
}
.muti-imgs .img-btns .btn-item {
position: absolute;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
}
.muti-imgs .img-btns .btn-item {
display: flex;
width: 70%;
justify-content: space-around;
}
.muti-imgs:hover .img-btns {
display: block;
}
.glsx-combi-form .dialog-img {
width: 100%;
height: 100%;
}
/* 图片上传 */
</style>
<!-- 员工管理 -->
<template>
<div class="config-employee">
<div class="container">
<div class="flex">
<div style="margin-top: 16px;">
<el-button :size="size" type="primary" @click="handleEdit(1)">创建员工</el-button>
</div>
<glsx-combi-form ref="showSearch" labelWidth="100px" :formObj="searchForm" :searchSelectObj="searchSelectObj" :formData="searchFormData">
<template slot="merchantId" slot-scope="item">
<select-page :form="searchForm" width="300px" :targetItem="item.scope" @handleChange="handleChangeMerchant"></select-page>
</template>
<template slot="footer">
<el-button :size="size" type="primary" @click="handleSearch">查询</el-button>
<el-button :size="size" type="primary">导出</el-button>
</template>
</glsx-combi-form>
</div>
<!-- 表格区域 开始 -->
<GLTable ref="employeeRef" :getListApi="getListApi" :searchForm="tableSearchForm" :tableParams="tableParams" :pageConf="pageConf" :beforeSearchFn="beforeSearchFn">
<template slot="auth-button" slot-scope="scope">
<el-button type="text" @click="handleDetail(scope.scope)">查看</el-button>
<el-button type="text" @click="handleEdit(2, scope.scope)">修改</el-button>
<el-button type="text" @click="handleDelete(scope.scope)">删除</el-button>
</template>
</GLTable>
<!-- 表格区域 end -->
</div>
</div>
</template>
<script>
import { utils } from 'glsx-common'
import { getListApi, getAllMerchantListApi, getRoleListApi, getAllDictApi } from '@/api/modules/employee'
import glsxCombiForm from './glsx-combi-form'
import selectPage from './components/selectPage'
export default {
name: 'index',
data() {
return {
size: 'small',
searchForm: {
merchantId: '',
merchantName: '',
roleId: '',
status: ''
},
tableSearchForm: {},
searchSelectObj: {
staffNameOrPhone: {
attr: 'staffName',
value: ''
}
},
// 搜索
searchFormData: [
{
label: '商户名称',
name: 'merchantId',
nameLabel: 'merchantName',
optionList: [],
optionId: 'id',
optionLabel: 'merchantName',
optionsName: 'allMerchantList',
addHtml: 'merchantId'
},
{
label: '角色',
name: 'roleId',
type: 'select',
width: '192px',
optionList: [],
optionId: 'id',
optionLabel: 'roleName',
optionsName: 'roleList'
},
{
label: '状态',
name: 'status',
type: 'select',
width: '192px',
optionList: [],
optionId: 'dictValue',
optionLabel: 'dictLabel',
optionsName: 'staffStatusList'
},
{
type: 'selectInput',
selectName: 'staffNameOrPhone',
isClear: true,
selectOption: [
{
label: '员工姓名',
name: 'staffName'
},
{
label: '手机号',
name: 'staffPhone'
}
],
handleSelectChange: value => {
this.searchSelectObj.staffNameOrPhone.value = ''
}
}
],
// 表格
getListApi: getListApi,
tableParams: {
listName: 'data',
tableOption: true,
tableColumns: [
{
label: '员工姓名',
prop: 'staffName'
},
{
label: '员工企微号',
prop: 'entmicroName',
line: 2
},
{
label: '角色',
prop: 'roleName',
line: 2
},
{
label: '登录手机号',
prop: 'staffPhone',
line: 2
},
{
label: '所属门店',
prop: 'merchantName',
line: 2
},
{
label: '所属企微',
prop: 'belongingEntmicroName',
line: 2
},
{
label: '状态',
prop: 'statusName',
width: '80px'
},
{
label: '更新时间',
prop: 'updatedTime',
line: 2
}
]
},
pageConf: { pageSize: 'pageSize', pageNum: 'pageNum', totalCount: 'count' },
baseData: {
allMerchantList: [],
roleList: [],
staffStatusList: []
}
}
},
components: {
glsxCombiForm,
selectPage
},
mounted() {
this.getBaseData().then(res => {
this.getOptionsList('searchFormData')
})
},
methods: {
getAllMerchantList() {
getAllMerchantListApi({}).then(res => {
this.baseData.allMerchantList = res
})
},
getBaseData() {
// 1.product(产品) 2.account_type(账户类型) 3.(functional_attributes) 功能属性 4.(owned_customer_group)所属客户群 5.channel渠道 6.account_level(商户层级)
return new Promise(resolve => {
Promise.all([getAllMerchantListApi({}), getAllDictApi({ dictType: 'staff_status' })]).then(([allMerchant, staffStatus]) => {
this.baseData.allMerchantList = allMerchant
this.baseData.staffStatusList = staffStatus
resolve()
})
})
},
getOptionsList(formName, hasAll = true, refreshSigle) {
if (refreshSigle) {
var item = this[formName].find(k => k.name == refreshSigle)
var index = this[formName].findIndex(k => k.name == refreshSigle)
this.$set(this[formName][index], 'optionList', utils.deepClone(this.baseData[item.optionsName]))
if (hasAll && this.baseData[item.optionsName].length && this.baseData[item.optionsName][0][this[formName][index].optionLabel] !== '全部') {
const temp = {}
temp[this[formName][index].optionId] = ''
temp[this[formName][index].optionLabel] = '全部'
this[formName][index].optionList.unshift(temp)
}
} else {
this[formName].forEach((item, index) => {
if (item.type === 'select' && this.baseData[item.optionsName].length) {
// this.$set(this[formName][index], 'optionList', _.cloneDeep(this.baseData[item.optionsName]))
this.$set(this[formName][index], 'optionList', utils.deepClone(this.baseData[item.optionsName]))
if (hasAll && this.baseData[item.optionsName].length && this.baseData[item.optionsName][0][this[formName][index].optionLabel] !== '全部') {
const temp = {}
temp[this[formName][index].optionId] = ''
temp[this[formName][index].optionLabel] = '全部'
this[formName][index].optionList.unshift(temp)
}
}
})
}
},
handleChangeMerchant(value) {
this.searchForm.roleId = ''
this.baseData.roleList = []
this.getOptionsList('searchFormData', true, 'roleId')
value &&
getRoleListApi({ id: value }).then(res => {
this.baseData.roleList = res
this.getOptionsList('searchFormData', true, 'roleId')
})
},
getSelectInputParams() {
const list = Object.keys(this.searchSelectObj)
var params = {}
list.forEach(i => {
const item = this.searchSelectObj[i]
item.value && (params[item.attr] = item.value)
})
return params
},
getParams() {
var params = utils.deepClone(this.searchForm)
// params.productId.includes('') && (params.productId = [])
const tempParams = this.getSelectInputParams()
params = {
...params,
...tempParams
}
return params
},
beforeSearchFn() {
return new Promise(resolve => {
this.tableSearchForm = this.getParams()
resolve()
})
},
// 1-新增;2-编辑
handleEdit(addOrEdit, row) {
console.log(addOrEdit)
this.$router.push({
name: 'employee',
// name: 'ConfigEmployeeIndex',
params: {
addOrEdit: addOrEdit,
id: row ? row.id : '-1'
}
})
},
// handleReset() {
// this.searchForm = {
// name: ''
// }
// this.handleSearch()
// },
handleSearch() {
this.$refs.employeeRef.refreshTable()
}
}
}
</script>
<style lang="scss">
.config-employee .container {
margin-top: 20px;
background: #ffffff;
box-shadow: 0 10px 20px 0 rgba(88, 80, 255, 0.1);
padding: 10px;
}
.config-employee .flex {
display: flex;
justify-content: space-between;
}
</style>
<template>
<div class="account-body scrm-box-f">
<div class="account-title">功能权限</div>
<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-tabs>
<div
class="account-select-pro"
v-for="(item, index) in tabMenu"
:key="index"
v-show="tabName == item.accounttypeId"
>
<label>选择产品</label>
<el-checkbox-group v-model="item.productsArr" @change="selectPro(index)">
<el-checkbox
v-for="(itm, idx) in item.products"
:label="itm.productName"
:key="idx"
></el-checkbox>
</el-checkbox-group>
</div>
<div class="account-select-menu">请选择产品权限</div>
<div class="menu-box">
<div :key="index" v-for="(item, index) in tabMenu">
<div
class="menu-box-tab"
v-show="tabName == item.accounttypeId"
>
<div class="tab-item text-hide" v-for="(itm, idx) in item.productsArr" :key="idx">
{{ itm }}
</div>
</div>
<div v-if="item.products[0]" class="menu-box-tree" v-show="tabName == item.accounttypeId && item.productsArr.indexOf(item.accounttypeName) != -1">
<el-tree
:data="item.products[0].merchantProTreeResponses"
show-checkbox
default-expand-all
node-key="id"
ref="brandTree"
highlight-current
:props="defaultProps"
>
</el-tree>
</div>
</div>
</div>
</div>
</template>
<script>
export default {
name: "product",
props: {
parentId: {
type: Number,
},
pId: {
type: Number,
},
accountlevel: {
type: Number,
},
},
data() {
return {
tabMenu: [],
selectIndex: 0,
products: [],
productsArr: [],
tabName: "",
defaultProps: {
children: "children",
label: "label",
},
};
},
methods: {
selectPro() {},
findPermissionsByMerId() {
let params = {
accountlevel: 2,
parentId: 41513,
id: 41555,
};
this.$apis.store.findMenuFunTreeByMerId(params).then((res) => {
this.tabMenu = res.map((item) => {
return {
productsArr: [],
products: item.products,
accounttypeName: item.accounttypeName,
accounttypeId: item.accounttypeId,
};
});
this.tabName = this.tabMenu[0].accounttypeId;
});
},
},
mounted() {
this.findPermissionsByMerId();
},
};
</script>
<style scoped lang="scss">
.account-body {
padding: 20px;
.account-title {
font-size: 20px;
font-weight: 600;
color: #333333;
line-height: 20px;
letter-spacing: 1px;
margin-bottom: 30px;
}
.account-select-pro {
padding-left: 30px;
font-size: 14px;
font-weight: 500;
color: #333333;
line-height: 20px;
display: flex;
flex-wrap: wrap;
label {
margin-right: 20px;
}
}
.account-select-menu {
font-size: 14px;
font-weight: 500;
color: #333333;
line-height: 20px;
margin-top: 20px;
}
.menu-box {
margin-top: 10px;
background: #f4f6fc;
border-radius: 4px;
padding: 10px;
.tab-item {
width: 180px;
background: #ffffff;
border-radius: 4px 0px 0px 0px;
border: 1px solid #f4f6fc;
font-size: 14px;
line-height: 14px;
font-weight: 400;
color: #322ad9;
text-align: center;
padding: 12px 0px;
}
}
}
</style>
\ No newline at end of file \ No newline at end of file
<template>
<div class="role-create-page">
<div class="top_title_widget">
<span class="title">{{ pageName }}</span>
</div>
<div class="main_widget">
<el-form :model="ruleForm" :rules="rules" ref="ruleForm" label-width="100px" class="demo-ruleForm">
<el-form-item v-if="pageType == 'create'" label="所属商户" prop="merchantId">
<el-select size="small" style="width: 40%" v-model="ruleForm.merchantId" :filter-method="filterList" clearable filterable placeholder="请选择" @change="selectMerchant">
<el-option v-for="item in list" :key="item.id" :label="item.merchantName" :value="item.id"></el-option>
</el-select>
</el-form-item>
<el-form-item label="所属商户" prop="merchantName" v-if="pageType == 'edit'">
<el-input disabled style="width: 40%" v-model="ruleForm.merchantName"></el-input>
</el-form-item>
<el-form-item label="角色名称" prop="roleName">
<el-input style="width: 40%" v-model="ruleForm.roleName"></el-input>
</el-form-item>
<el-form-item label="角色说明" prop="roleDesc">
<el-input style="width: 40%" v-model="ruleForm.roleDesc"></el-input>
</el-form-item>
<el-form-item label="角色权限" prop="roleRoot">
<div class="custom_element">
<template v-for="(item, index) in accountList">
<div :key="index" class="wrap">
<AutoButton @getBtnStatus="selectCurAccount(item, index)" :typeStatus="item.select" :btnLabel="item.accounttypeName"></AutoButton>
</div>
</template>
</div>
</el-form-item>
</el-form>
<div class="new_wrap">
<div class="root_menu_line">
<div v-for="(item, index) in rootList" :key="index" class="menu_item" :class="curRootIndex == index ? 'menu_item_active' : ''" @click="selectRootItem(index)">
{{ item.accounttypeName }}
</div>
</div>
</div>
<div class="product_line_wrap">
<div class="label_title">选择产品</div>
<div class="product_con">
<el-checkbox v-for="(item, index) in productList" :key="index" :false-label="item.productId" :true-label="item" @change="selectProductItem">
<div class="check_text">{{ item.productName }}</div>
</el-checkbox>
</div>
</div>
<div class="product_root_wrap">
<div class="label_title">请选择产品权限</div>
</div>
<div class="product_root_content_wrap">
<div class="content_menu_line">
<div v-for="(item, index) in storeList" :key="index" class="menu_line_item" :class="curMenuIndex == index ? 'menu_line_item_active' : ''" @click="selectMenuItem(index)">{{ item.productName }}</div>
</div>
<div class="content_menu_con">
<el-tree v-if="treeDataList.length" :data="treeDataList" :props="defaultProps"></el-tree>
<div v-if="treeDataList.length == 0" class="no_data_icon">
<div class="nodata_wrap">
<img class="icon" src="../../../assets/img/empty.png" />
<span class="text">暂无数据</span>
</div>
</div>
</div>
</div>
</div>
<div style="height: 84px"></div>
<div class="fixed_bottom">
<el-button v-if="pageType == 'create'" type="primary">草稿</el-button>
<div class="wrap_driver">
<el-button type="primary" @click="toCreateRole">确定</el-button>
</div>
<el-button type="primary" @click="toBack">取消</el-button>
</div>
</div>
</template>
<script>
import AutoButton from '../../../components/auto-button/index.vue'
export default {
name: '',
components: {
AutoButton
},
data() {
return {
ruleForm: {
merchantId: '',
roleName: '',
roleDesc: ''
},
rules: {
roleName: [{ required: true, message: '请输入角色名称', trigger: 'blur' }],
merchantId: [{ required: true, message: '请选择所属商户', trigger: 'change' }],
roleRoot: [{ required: true, message: '请选择角色权限', trigger: 'change' }]
},
rootList: [],
curRootIndex: 0,
productList: [],
storeList: [],
curMenuIndex: 0,
pageName: '新增角色',
roleInfo: null,
pageType: 'create',
accountList: [],
//商户
list: [],
// tree数据
treeDataList: []
}
},
created() {
let query = this.$route.query
this.pageType = query.page
if (query.page == 'create') {
this.pageName = '新增角色'
this.getMerchantName()
} else {
this.pageName = '修改角色'
let role = query.row
this.getRoleData(role.id)
}
},
methods: {
// 获取角色信息
getRoleData(id) {
this.$apis.role.roleInfoData({ id }).then(res => {
this.roleInfo = res
this.ruleForm = {
merchantName: res.merchantName,
roleName: res.roleName,
roleDesc: res.roleDescription
}
this.getMerchantTree(id, res.responseList)
})
},
// 获取商户树
getMerchantTree(id, list) {
this.$apis.role.roleTreeDataById({ id }).then(res => {
for (let i = 0; i < list.length; i++) {
for (let j = 0; j < res.length; j++) {
if (res[j].accounttypeId == list[i].accounttypeId) {
res[j].select = true
}
}
}
this.accountList = res
})
},
getMerchantName() {
this.$apis.role.merchantDataList({ source: 'glsx' }).then(res => {
this.merchantList = res
this.filterList()
})
},
// 过滤数据
filterList(query = '') {
let arr = this.merchantList.filter(item => {
return item.merchantName.includes(query)
})
if (arr.length > 100) {
this.list = arr.slice(0, 100)
} else {
this.list = arr
}
},
// 选择商户----获取权限
selectMerchant(id) {
this.$apis.role.merchantRootById({ id }).then(res => {
this.accountList = res.map(item => {
item.select = false
return item
})
})
this.rootList = []
this.productList = []
},
// 选择商户权限
selectCurAccount(item, index) {
this.accountList[index].select = !item.select
this.curRootIndex = 0
if (this.accountList[index].select) {
this.rootList.push(item)
} else {
let arr = this.rootList.filter(el => {
return item.accounttypeId != el.accounttypeId
})
this.rootList = arr
}
this.productList = this.rootList[0].products || []
},
// 选择产品的值
selectProductItem(val) {
console.log(val)
this.curMenuIndex = 0
if (typeof val === 'number') {
let arr = this.storeList.filter(el => {
return val != el.productId
})
this.storeList = arr
} else {
this.storeList.push(val)
}
},
selectRootItem(index) {
this.curRootIndex = index
this.productList = []
this.storeList = []
this.productList = this.rootList[index].products || []
},
// 产品筛选显示-隐藏
selectMenuItem(index) {
this.curMenuIndex = index
this.treeDataList = this.storeList[index].merchantProTreeResponses
},
// 确定按钮---处理参数---提交数据
toCreateRole() {
let { merchantId, roleDesc, roleName } = this.ruleForm
let para = {
merchantId: merchantId,
roleName: roleName,
roleDescription: roleDesc,
accounttypeId: 0,
'check[29]': 44,
delFlag: 0,
requestList: []
}
console.log(this.ruleForm)
console.log(para)
// if(this.pageType=='edit'){
// this.updateRole(para)
// }else{
// this.insertRole(para)
// }
},
insertRole(para) {
this.$apis.role.roleInfoData(para).then(res => {
if (res) {
history.go(-1)
}
})
},
updateRole(para) {
this.$apis.role.updateRole(para).then(res => {
if (res) {
history.go(-1)
}
})
},
toBack() {
history.go(-1)
}
}
}
</script>
<style lang="scss" scoped>
.role-create-page {
height: 100%;
width: 100%;
background: #ffffff;
}
.top_title_widget {
width: 100%;
height: 58px;
box-sizing: border-box;
padding: 0 20px;
border-bottom: 1px solid #d8d8d8;
display: flex;
align-items: center;
.title {
font-size: 16px;
font-weight: 500;
color: #424242;
}
}
.main_widget {
box-sizing: border-box;
padding: 32px 0;
background: #ffffff;
}
.new_wrap {
box-sizing: border-box;
width: 100%;
padding: 0 22px;
}
.root_menu_line {
height: 36px;
background: #f4f6fc;
border-radius: 4px;
display: flex;
align-items: center;
.menu_item {
width: 180px;
height: 32px;
text-align: center;
line-height: 32px;
color: #333333;
font-size: 14px;
margin-right: 2px;
background: #f4f6fc;
cursor: pointer;
border-radius: 2px;
}
.menu_item_active {
color: #5850ff;
background: #ffffff;
}
}
.product_line_wrap {
margin-top: 25px;
display: flex;
align-items: center;
.label_title {
box-sizing: border-box;
width: 100px;
font-size: 14px;
font-weight: 500;
color: #333333;
text-align: right;
padding: 0 12px 0 0;
}
.product_con {
display: flex;
align-items: center;
/deep/ .el-checkbox {
display: flex;
align-items: center;
}
.check_text {
max-width: 140px;
overflow: hidden;
white-space: nowrap;
text-overflow: ellipsis;
}
}
}
.product_root_wrap {
margin-top: 30px;
.label_title {
font-size: 14px;
font-weight: 500;
color: #333333;
padding-left: 30px;
}
}
.product_root_content_wrap {
// width: 100%;
box-sizing: border-box;
background: #f4f6fc;
border-radius: 4px;
margin: 0 20px;
margin-top: 10px;
padding: 0 10px;
.content_menu_line {
height: 50px;
width: 100%;
box-sizing: border-box;
padding-top: 10px;
display: flex;
.menu_line_item {
// width: 112px;
padding: 0 38px;
height: 40px;
text-align: center;
line-height: 40px;
color: #666666;
font-size: 14px;
border-radius: 4px 4px 0px 0px;
cursor: pointer;
}
.menu_line_item_active {
color: #322ad9;
background: #ffffff;
}
}
.content_menu_con {
// height: 100%;
min-height: 380px;
background: #ffffff;
border-radius: 0px 4px 4px 4px;
}
.no_data_icon {
height: 150px;
display: flex;
align-items: center;
justify-content: center;
.nodata_wrap {
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
.icon {
width: 64px;
height: 41px;
}
.text {
font-size: 14px;
font-weight: 400;
color: #262626;
margin-top: 10px;
}
}
}
}
.fixed_bottom {
position: fixed;
left: 0;
right: 0;
bottom: 0;
// width: calc(100% - 60px);
width: 100%;
height: 64px;
background: #ffffff;
display: flex;
align-items: center;
justify-content: center;
.wrap_driver {
margin: 0 40px;
}
}
// 角色权限按钮样式
.custom_element {
display: flex;
align-items: center;
.wrap {
margin-right: 15px;
}
// height: 40px;
}
// .root_wrap {
// display: flex;
// min-width: 80px;
// .root_name {
// padding: 0 16px;
// height: 30px;
// border-radius: 4px 0 0 4px;
// font-size: 14px;
// font-weight: 400;
// color: #ffffff;
// line-height: 30px;
// background: #d2d2d2;
// cursor: pointer;
// border: 1px solid #d2d2d2;
// }
// .root_icon {
// width: 30px;
// height: 30px;
// border: 1px solid #d2d2d2;
// border-left: none;
// border-radius: 0 4px 4px 0;
// cursor: pointer;
// }
// .show-icon {
// display: none;
// }
// }
// .root_wrap:hover > .root_name {
// background: #999999;
// border: 1px solid #999999;
// }
// .root_wrap:hover > .root_icon > .show-icon {
// display: block;
// text-align: center;
// line-height: 30px;
// font-size: 20px;
// color: #d2d2d2;
// }
</style>
<template>
<div class="role-home-page">
<div class="top_widget">
<el-button size="small" icon="el-icon-plus" type="primary" @click="toCreatePage">创建角色</el-button>
<div v-if="accountLevel != 4" class="top_select">
<span class="select_label">商户名称</span>
<el-select :filter-method="filterList" size="small" clearable filterable v-model="searchForm.merchantId" placeholder="请选择">
<el-option v-for="item in list" :key="item.id" :label="item.merchantName" :value="item.id"></el-option>
</el-select>
</div>
</div>
<div class="driver_line"></div>
<div class="table_widget">
<el-form :inline="true" :model="searchForm" class="follow-form-item">
<el-form-item label="状态">
<el-select size="small" v-model="searchForm.delFlag" placeholder="请选择">
<el-option v-for="item in optionData" :key="item.value" :label="item.label" :value="item.value"></el-option>
</el-select>
</el-form-item>
<el-form-item label="角色名称">
<el-input size="small" v-model="searchForm.roleName" clearable placeholder="请输入"></el-input>
</el-form-item>
<el-form-item>
<el-button type="primary" size="small" @click="toFindData">查询</el-button>
</el-form-item>
</el-form>
<GLTable ref="table" :layout="layout" :tableData="tableData" :tableTotal="tableTotal" :pageConf="pageConf" :tableParams="tableParams" @refreshTable="getTableData">
<template slot="auth-button" slot-scope="scope" :data="scope.scope">
<el-button type="text" @click="toLookPage(scope.scope)">查看</el-button>
<el-button type="text" @click="toEditPage(scope.scope)">修改</el-button>
<el-button v-if="scope.scope.delFlag" type="text" @click="todelete(scope.scope)">删除</el-button>
</template>
</GLTable>
</div>
</div>
</template>
<script>
export default {
name: '',
data() {
return {
searchForm: {
delFlag: 2,
roleName: '',
merchantId: ''
},
optionData: [
{
value: 2,
label: '全部'
},
{
value: 1,
label: '草稿'
},
{
value: 0,
label: '启用'
}
],
//表格配置
layout: 'sizes, prev, pager, next, jumper, ->, total',
pageConf: { pageSize: 'pageSize', pageNum: 'pageNum', totalCount: 'total' },
tableParams: {
tableOption: true,
btnId: new Date().getTime() + parseInt(Math.random() * 1000),
tableColumns: [
{
label: '角色名称',
prop: 'roleName'
},
{
label: '角色号',
prop: 'roleCode'
},
{
label: '状态',
prop: 'statusName',
width: '100px'
},
{
label: '创建时间',
prop: 'createdTime'
},
{
label: '更新时间',
prop: 'updatedTime',
formatter: val => {
if (!val.updatedTime) {
return '--'
} else {
return val.updatedTime
}
}
}
]
},
tableData: [],
merchantList: [],
tableTotal: 0,
accountLevel: 1,
list:[]
}
},
created() {
// const { session } = this.$globalState
// let accountLevel = session.accountLevel
let accountLevel = 1
if (accountLevel != 4) {
this.tableParams.tableColumns.splice(2, 0, { label: '所属商户名', prop: 'merchantName' })
this.getMerchantName()
}
this.accountLevel = accountLevel
},
mounted() {
this.getTableData()
},
methods: {
// 获取表格数据
getTableData() {
let { delFlag, roleName, merchantId } = this.searchForm
console.log(merchantId)
let para = {
pageNum: this.$refs.table.page.pageNum,
pageSize: this.$refs.table.page.pageSize
}
if (delFlag < 2) {
para.delFlag = delFlag
}
if (roleName) {
para.roleName = roleName
}
if (merchantId) {
para.merchantId = merchantId
}
this.$apis.role.roleDataList(para).then(res => {
this.tableData = res.data
this.tableTotal = res.count
this.$nextTick(() => {
this.$refs.table.setTableHeightFun()
})
})
},
getMerchantName() {
this.$apis.role.merchantDataList({ source: 'glsx' }).then(res => {
this.merchantList = res
this.filterList()
})
},
// 过滤数据
filterList(query = '') {
let arr = this.merchantList.filter(item => {
return item.merchantName.includes(query)
})
if (arr.length > 100) {
this.list = arr.slice(0, 100)
} else {
this.list = arr
}
},
// 查询
toFindData() {
this.getTableData()
},
// 去创建角色页面
toCreatePage() {
this.$router.push({ path: '/role/create/index', query: { page: 'create' } })
},
// 去查看角色页面
toLookPage(row) {
this.$router.push({ path: '/role/index/look', query: { row } })
},
// 去修改角色页面
toEditPage(row) {
this.$router.push({ path: '/role/create/index', query: { page: 'edit', row } })
},
// 去删除草稿
todelete(row){
console.log(row);
},
}
}
</script>
<style lang="scss" scoped>
.role-home-page {
box-sizing: border-box;
display: flex;
flex-direction: column;
height: 100%;
}
.top_widget {
width: 100%;
height: 78px;
display: flex;
align-items: center;
justify-content: space-between;
background: #ffffff;
box-sizing: border-box;
padding: 0 20px;
.top_select {
display: flex;
align-items: center;
.select_label {
font-size: 14px;
font-weight: 400;
color: #333333;
margin-right: 10px;
}
}
}
.driver_line {
width: 100%;
height: 20px;
}
.table_widget {
width: 100%;
// height: calc(100% - 138px);
background: #ffffff;
box-shadow: 0px 10px 20px 0px rgba(88, 80, 255, 0.1);
box-sizing: border-box;
padding: 20px;
}
</style>
<template>
<div class="role-create-page">
<div class="top_title_widget">
<span class="title">角色基本信息</span>
<span class="store_title">{{ roleInfo.merchantName }}</span>
</div>
<div class="info_widget">
<div class="info_line_wrap">
<div class="info_line_label">角色名称:</div>
<div class="infl_line_con">{{ roleInfo.roleName }}</div>
</div>
<div class="info_line_wrap">
<div class="info_line_label">角色号:</div>
<div class="infl_line_con">{{ roleInfo.roleCode }}</div>
</div>
<div class="info_line_wrap">
<div class="info_line_label">角色说明:</div>
<div class="infl_line_con">{{ roleInfo.roleDescription || '无' }}</div>
</div>
</div>
<div class="main_widget">
<div class="main_title">角色权限</div>
<div class="wrapper">
<div class="menu_line_one">
<div v-for="(item, index) in rootList" :key="index" class="line_element" :class="curRootIndex == index ? 'line_element_active' : ''" @click="selectRootItem(index)">{{ item.accounttypeName }}</div>
</div>
</div>
<div class="wrapper">
<div class="main_body">
<div class="menu_line_two">
<div v-for="(item, index) in productList" :key="index" class="line_element_two" :class="curProductIndex == index ? 'line_element_two_active' : ''" @click="selectProductItem(index)">{{ item.productName }}</div>
</div>
<div class="tree_widget">
<el-tree v-if="productList.length" :data="productList[curProductIndex].merchantProTreeResponses" :props="defaultProps"></el-tree>
<div v-if="productList.length == 0" class="no_data_icon">
<div class="nodata_wrap">
<img class="icon" src="../../../assets/img/empty.png" />
<span class="text">暂无数据</span>
</div>
</div>
</div>
</div>
</div>
</div>
<div style="height: 84px"></div>
<div class="fixed_bottom">
<el-button type="primary" @click="toBack">关闭</el-button>
</div>
</div>
</template>
<script>
export default {
name: '',
data() {
return {
rootList: [],
curRootIndex: 0,
productList: [],
curProductIndex: 0,
roleInfo: {
roleName: ''
},
defaultProps: {
children: 'children',
label: 'label'
}
}
},
created() {
let query = this.$route.query
let id = query.row.id
this.getRoleData(id)
this.getMerchantTree(id)
},
methods: {
// 获取角色信息
getRoleData(id) {
this.$apis.role.roleInfoData({ id }).then(res => {
this.roleInfo = res
})
},
// 获取商户树
getMerchantTree(id) {
this.$apis.role.roleTreeDataById({ id }).then(res => {
this.rootList = res
this.productList = this.rootList[0].products || []
})
},
selectRootItem(index) {
this.curRootIndex = index
this.productList = this.rootList[index].products || []
},
selectProductItem(index) {
this.curProductIndex = index
},
toBack() {
history.go(-1)
}
}
}
</script>
<style lang="scss" scoped>
.role-create-page {
height: 100%;
width: 100%;
}
.top_title_widget {
width: 100%;
height: 58px;
box-sizing: border-box;
padding: 0 20px;
border-bottom: 1px solid #d8d8d8;
display: flex;
align-items: center;
justify-content: space-between;
background: #ffffff;
.title {
font-size: 16px;
font-weight: 500;
color: #424242;
}
.store_title {
font-size: 14px;
font-weight: 500;
color: #333333;
}
}
.info_widget {
background: #ffffff;
height: 158px;
box-sizing: border-box;
padding: 20px 0 0 52px;
box-shadow: 0px 10px 20px 0px rgba(88, 80, 255, 0.1);
.info_line_wrap {
display: flex;
align-items: center;
margin-bottom: 24px;
.info_line_label {
width: 78px;
font-size: 14px;
font-weight: 400;
color: #333333;
text-align: right;
}
.infl_line_con {
font-size: 14px;
font-weight: 400;
color: #666666;
}
}
}
.main_widget {
margin-top: 20px;
width: 100%;
min-height: calc(100% - 300px);
background: #ffffff;
box-shadow: 0px 10px 20px 0px rgba(88, 80, 255, 0.1);
.main_title {
width: 100%;
box-sizing: border-box;
padding: 20px;
font-size: 16px;
font-weight: 500;
color: #333333;
}
.wrapper {
box-sizing: border-box;
padding: 0 20px;
.menu_line_one {
width: 100%;
height: 36px;
background: #f4f6fc;
border-radius: 4px;
display: flex;
align-items: center;
.line_element {
// width: 180px;
padding: 0 55px;
height: 32px;
text-align: center;
line-height: 32px;
font-size: 14px;
font-weight: 400;
color: #333333;
cursor: pointer;
}
.line_element_active {
background: #ffffff;
border-radius: 2px;
color: #5850ff;
}
}
.main_body {
width: 100%;
// height: calc(100% - 36px);
background: #f4f6fc;
border-radius: 4px;
box-sizing: border-box;
padding: 10px;
.menu_line_two {
display: flex;
align-items: center;
.line_element_two {
// width: 111px;
padding: 0 38px;
height: 40px;
text-align: center;
line-height: 40px;
background: #ffffff;
border-radius: 4px 0px 0px 0px;
border: 1px solid #f4f6fc;
color: #37383a;
font-size: 14px;
font-weight: 400;
cursor: pointer;
}
.line_element_two_active {
color: #322ad9;
}
}
.tree_widget {
width: 100%;
// height: calc(100% - 40px);
background: #ffffff;
border-radius: 0px 4px 4px 4px;
}
.tree_widget /deep/ .el-tree-node__expand-icon {
// content: "\e6d9";
color: #5850ff;
}
.tree_widget /deep/ .el-tree-node__expand-icon.is-leaf {
color: transparent;
}
.no_data_icon {
height: 150px;
display: flex;
align-items: center;
justify-content: center;
.nodata_wrap {
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
.icon {
width: 64px;
height: 41px;
}
.text {
font-size: 14px;
font-weight: 400;
color: #262626;
margin-top: 10px;
}
}
}
}
}
}
.fixed_bottom {
position: fixed;
left: 0;
right: 0;
bottom: 0;
// width: calc(100% - 60px);
width: 100%;
height: 64px;
background: #ffffff;
display: flex;
align-items: center;
justify-content: center;
.wrap_driver {
margin: 0 40px;
}
}
</style>
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!