Commit 3d0875d4 by 杨北旺

Merge branch 'master' of 192.168.3.233:yangming/scrm-micro-config

2 parents 073412aa 7152a10d
......@@ -71,4 +71,57 @@ const getDetailLogApi = params => {
})
}
export default { getListApi, getAllMerchantListApi, getRoleListApi, getAllDictApi, getMerchantTreeApi, getDetailInfoApi, getDetailLogApi }
const addEmployeeApi = params => {
params.method = `${defaultPath}staff.saveStaff`
return http({
url: 'rop-merchants/router',
method: 'POST',
data: params,
sign: true,
returnAll: true
})
}
const updateEmployeeApi = params => {
params.method = `${defaultPath}staff.updateStaff`
return http({
url: 'rop-merchants/router',
method: 'POST',
data: params,
sign: true,
returnAll: true
})
}
const deleteEmployeeApi = params => {
params.method = `${defaultPath}staff.deleteStaff`
return http({
url: 'rop-merchants/router',
method: 'POST',
data: params,
sign: true,
returnAll: true
})
}
const exportEmployeeApi = params => {
params.method = `${defaultPath}staff.exportData`
return http({
url: 'rop-merchants/router',
method: 'POST',
data: params,
sign: true
})
}
const updateStatusApi = params => {
params.method = `${defaultPath}staff.updateStatus`
return http({
url: 'rop-merchants/router',
method: 'POST',
data: params,
sign: true
})
}
export default { getListApi, getAllMerchantListApi, getRoleListApi, getAllDictApi, getMerchantTreeApi, getDetailInfoApi, getDetailLogApi, addEmployeeApi, updateEmployeeApi, deleteEmployeeApi, exportEmployeeApi, updateStatusApi }
......@@ -124,6 +124,10 @@ img {
justify-content: space-between;
}
.el-checkbox:last-of-type {
margin-right: 8px;
}
::-webkit-scrollbar {
/*滚动条整体样式*/
width: 6px;
......
const staticRoutes = Object.freeze([{
name: 'account',
path: '/account/index',
meta: {},
component: resolve => require([`@/views/account/index.vue`], resolve)
},
{
name: 'addAccount',
path: '/account/addAccount/:id',
meta: {},
component: resolve => require([`@/views/account/addAccount.vue`], resolve)
},
{
name: 'editAccount',
path: '/account/editAccount/:id',
meta: {},
component: resolve => require([`@/views/account/editAccount.vue`], resolve)
},
{
name: 'detailAccount',
path: '/account/detailAccount/:id',
meta: {},
component: resolve => require([`@/views/account/detailAccount.vue`], resolve)
},
{
name: 'role',
path: '/role/index',
component: resolve => require([`@/views/role/index.vue`], resolve),
meta: {}
},
{
name: 'role',
path: '/role/create/:id',
component: resolve => require([`@/views/role/create.vue`], resolve),
meta: {}
},
{
name: 'role',
path: '/role/look:id',
component: resolve => require([`@/views/role/look.vue`], resolve),
meta: {}
},
{
name: 'Account2EmployeeIndex',
path: '/employee/index',
meta: {},
component: resolve => require([`@/views/employee/index.vue`], resolve)
},
{
name: 'Account2EmployeeEditEmployee',
path: '/employee/editEmployee',
meta: {},
component: resolve => require([`@/views/employee/editEmployee.vue`], resolve)
},
{
name: 'Account2EmployeeDetailEmployee',
path: '/employee/detailEmployee',
meta: {},
component: resolve => require([`@/views/employee/detailEmployee.vue`], resolve)
}
name: 'account',
path: '/account/index',
meta: {},
component: resolve => require([`@/views/account/index.vue`], resolve)
},
{
name: 'addAccount',
path: '/account/addAccount/:id',
meta: {},
component: resolve => require([`@/views/account/addAccount.vue`], resolve)
},
{
name: 'editAccount',
path: '/account/editAccount/:id',
meta: {},
component: resolve => require([`@/views/account/editAccount.vue`], resolve)
},
{
name: 'detailAccount',
path: '/account/detailAccount/:id',
meta: {},
component: resolve => require([`@/views/account/detailAccount.vue`], resolve)
},
{
name: 'role',
path: '/role/index',
component: resolve => require([`@/views/role/index.vue`], resolve),
meta: {}
},
{
name: 'role',
path: '/role/create/:id',
component: resolve => require([`@/views/role/create.vue`], resolve),
meta: {}
},
{
name: 'role',
path: '/role/look:id',
component: resolve => require([`@/views/role/look.vue`], resolve),
meta: {}
},
{
name: 'Account2EmployeeIndex',
path: '/employee/index',
meta: {},
component: resolve => require([`@/views/employee/index.vue`], resolve)
},
{
name: 'Account2EmployeeEditEmployee',
path: '/employee/editEmployee/:addOrEdit/:id',
meta: {},
component: resolve => require([`@/views/employee/editEmployee.vue`], resolve)
},
{
name: 'Account2EmployeeDetailEmployee',
path: '/employee/detailEmployee/:id',
meta: {},
component: resolve => require([`@/views/employee/detailEmployee.vue`], resolve)
},
{
name: 'baseInfo',
path: '/baseInfo/index',
meta: {},
component: resolve => require([`@/views/baseInfo/index.vue`], resolve)
},
{
name: 'relevance',
path: '/baseInfo/relevance',
meta: {},
component: resolve => require([`@/views/baseInfo/relevance.vue`], resolve)
}
])
export default staticRoutes
\ No newline at end of file
......@@ -29,4 +29,25 @@ util.checkisCard = function(card) {
let myreg = /^(^\d{15}$)|(^\d{17}([0-9]|X)$)/;
return myreg.test(card);
}
util.deepClone = function(obj) {
// Handle the 3 simple types, and null or undefined or function
if (obj == null || typeof obj !== 'object') return obj
// Handle Date
if (obj instanceof Date) {
const copy = new Date()
copy.setTime(obj.getTime())
return copy
}
// Handle Array or Object
if ((obj instanceof Array) | (obj instanceof Object)) {
const copy = obj instanceof Array ? [] : {}
for (var attr in obj) {
if (obj.hasOwnProperty(attr)) {
copy[attr] = util.deepClone(obj[attr])
}
}
return copy
}
throw new Error("Unable to clone obj! Its type isn't supported.")
}
export default util
\ No newline at end of file
......@@ -13,237 +13,6 @@
:businessScopeCustomize="businessScopeCustomize"
:businessOption="businessOption"
></base-info>
<!-- <el-form
ref="baseForm"
:model="accountAddForm"
class="account-body-form"
label-width="120px"
:rules="baseRules"
>
<el-row>
<el-col :span="12">
<el-form-item label="商户名称" prop="merchantName">
<el-input
size="small"
v-model="accountAddForm.merchantName"
placeholder="请输入商户名称"
></el-input>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="商户简称">
<el-input
size="small"
v-model="accountAddForm.merchantAbbreviation"
placeholder="请输入商户简称"
></el-input>
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col :span="12">
<el-form-item
size="small" label="商户类型" class="merchant-row">
<el-input
v-model="accountAddForm.merchantOrgcode"
placeholder="请输入组织机构号码"
v-if="accountAddForm.merchantType == 2"
>
<el-select
v-model="accountAddForm.merchantType"
slot="prepend"
placeholder="请选择"
>
<el-option label="个人" value="1"></el-option>
<el-option label="企业" value="2"></el-option>
</el-select>
</el-input>
<el-input
size="small"
maxlength="18"
v-model="accountAddForm.merchantOrgcode"
placeholder="请输入正确的身份证号"
v-if="accountAddForm.merchantType == 1"
>
<el-select
v-model="accountAddForm.merchantType"
slot="prepend"
placeholder="请选择"
>
<el-option label="个人" value="1"></el-option>
<el-option label="企业" value="2"></el-option>
</el-select>
</el-input>
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col :span="24">
<el-form-item size="small" label="商户地址" class="form-row">
<el-input v-model="accountAddForm.merchantAddress"> </el-input>
<el-button
readonly
type="primary"
class="form-btn"
@click="dialogMapVisible = true"
>选择地址</el-button
>
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col :span="12">
<el-form-item label="联系电话" prop="merchantLegalPersonPhone">
<el-input
maxlength="11"
size="small"
v-model="accountAddForm.merchantLegalPersonPhone"
placeholder="请输入联系电话"
></el-input>
<el-checkbox v-model="accountAddForm.isloginName"
>联系电话同时作为登录账户名</el-checkbox
>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="联系人">
<el-input
size="small"
v-model="accountAddForm.merchantLegalPerson"
placeholder="请输入联系人"
></el-input>
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col :span="12">
<el-form-item label="驻店联系人">
<el-input
maxlength="11"
size="small"
v-model="accountAddForm.residentContact"
placeholder="请输入驻店联系人"
></el-input>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="驻店电话">
<el-input
maxlength="11"
size="small"
v-model="accountAddForm.residentPhone"
placeholder="请输入驻店电话"
></el-input>
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col :span="12">
<el-form-item label="营业范围">
<el-checkbox-group v-model="accountAddForm.businessScope">
<el-checkbox
v-for="item in businessOption"
:label="item.dictValue"
:key="item"
>{{ item.dictLabel }}</el-checkbox
>
</el-checkbox-group>
<div
class="scrm-flex-center"
v-for="(item, index) in businessScopeCustomize"
:key="index"
>
<el-input
size="small"
v-model="businessScopeCustomize[index].name"
placeholder="请自定义营业范围,建议不超过10个"
></el-input>
<i
class="el-icon-circle-plus el-icon-btn"
@click="addBusinessScope"
v-if="index == businessScopeCustomize.length - 1"
></i>
<i
class="el-icon-remove el-icon-btn"
@click="removeBusinessScope"
v-else
></i>
</div>
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col :span="12">
<el-form-item label="营业时间" class="open-time">
<el-time-picker
size="small"
value-format="HH:mm:ss"
is-range
v-model="accountAddForm.bussinessTime"
range-separator="至"
start-placeholder="开始时间"
end-placeholder="结束时间"
placeholder="选择时间范围"
></el-time-picker>
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col :span="12">
<el-form-item label="主营品牌">
<el-input size="small" v-model="filterText"></el-input>
<div class="brand-tree">
<el-tree
:data="brandData"
show-checkbox
default-expand-all
node-key="id"
ref="brandTree"
highlight-current
:props="defaultProps"
:filter-node-method="filterNode"
>
</el-tree>
</div>
</el-form-item>
</el-col>
<el-col :span="12">
<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
action=""
class="image-uploader"
:show-file-list="false"
list-type="picture-card"
v-loading="loadingImg"
:before-upload="upLoadImg"
>
<i class="el-icon-plus"></i>
</el-upload>
</div>
<div class="tips">图片格式仅支持JPG,PNG格式,大小1M</div>
</el-form-item>
</el-col>
</el-row>
</el-form> -->
</div>
<div class="account-body scrm-box-f">
<div class="form-title">账户信息</div>
......@@ -268,7 +37,7 @@
</el-row>
<el-row>
<el-col :span="12">
<el-form-item label="账户等级">
<el-form-item label="账户等级" class="level-row">
<el-select
size="small"
:disabled="nextStatus"
......@@ -441,16 +210,7 @@ export default {
},
};
},
watch: {
filterText(val) {
this.$refs.brandTree.filter(val);
},
},
methods: {
filterNode(value, data) {
if (!value) return true;
return data.label.indexOf(value) !== -1;
},
getAddress() {
this.dialogMapVisible = false;
this.accountAddForm.merchantAddress = this.$refs.mapForm.address;
......@@ -464,40 +224,6 @@ export default {
this.accounttypeId.splice(idx, 1);
}
},
upLoadImg(file) {
let fileName = file.name;
if (file.name.lastIndexOf(".") === -1) {
this.$message.info("路径不正确");
return false;
}
let AllImgExt = ".jpg|.jpeg|.gif|.bmp|.png|.swf";
let extName = file.name.substring(file.name.lastIndexOf(".")).toLowerCase();
if (AllImgExt.indexOf(extName + "|") === -1) {
this.$message.info("图片格式不正确");
return false;
}
// if (fileSize < 3145728) {
if (window.FileReader) {
let reader = new FileReader();
let self = this;
reader.readAsDataURL(file);
reader.onload = (img) => {
console.log(file);
let type = fileName.split(".")[1];
let imgUrl = img.target.result.split(",")[1];
self.loadingImg = true;
self.$apis.common
.pictureUpload({
file: `${type}@${imgUrl}`,
})
.then((res) => {
if (res) {
console.log(res);
}
});
};
}
},
handleSave(status) {
if (this.$refs.productForm.getSelectInfo().length == 0) {
this.$message.error("请选择产品");
......@@ -563,6 +289,7 @@ export default {
params.businessScopeCustomize = businessScopeCustomize.join(",");
params.accounttypeId = this.accounttypeId.join(",");
params.merchantFiles = JSON.stringify(params.merchantFiles)
params.merchantModel = this.accountDetail.merchantModel;
let merchant;
if (this.nextStatus) {
merchant = "updateMerchant";
......@@ -582,7 +309,7 @@ export default {
id: this.parentId,
parentId: this.accountAddForm.parentId,
};
this.$refs.productForm.findMenuFunTreeByMerId(para);
this.$refs.productForm.findMenuFunTreeByMerId(para,this.accounttypeId);
}
this.twoMerchantDetail(this.parentId);
}
......@@ -612,14 +339,22 @@ export default {
id: this.accountAddForm.parentId,
});
this.$apis.store.findAllDictData({ dictType: "account_level" }).then((res) => {
this.accountLevel = res
// if (this.accountDetail.merchantAccountLevel == 1) {
// this.accountLevel = res.filter((item) => {
// item.dictValue != 1 && item.dictValue != 3;
// });
// console.log
// this.accountDetail.merchantAccountLevel = 2;
// }
if (this.accountDetail.merchantAccountLevel == 1) {
this.accountLevel = res.filter((item) => {
return item.dictValue != 1 && item.dictValue != 3;
});
this.accountDetail.merchantAccountLevel = 2;
}else if (this.accountDetail.merchantAccountLevel == 2) {
this.accountLevel = res.filter((item) => {
return item.dictValue != 1 && item.dictValue != 2;
});
this.accountDetail.merchantAccountLevel = 3;
}else{
this.accountLevel = res.filter((item) => {
return item.dictValue == 4;
});
this.accountDetail.merchantAccountLevel = 4;
}
});
},
twoMerchantDetail(pid) {
......@@ -742,6 +477,11 @@ export default {
}
}
}
.level-row {
/deep/ .el-select {
width: 100%;
}
}
.el-icon-btn {
color: #5850ff;
font-size: 16px;
......
......@@ -40,8 +40,8 @@
slot="prepend"
placeholder="请选择"
>
<el-option label="个人" value="1"></el-option>
<el-option label="企业" value="2"></el-option>
<el-option label="个人" :value="1"></el-option>
<el-option label="企业" :value="2"></el-option>
</el-select>
</el-input>
<el-input
......@@ -67,10 +67,7 @@
<el-col :span="24">
<el-form-item size="small" label="商户地址" class="form-row">
<el-input readonly v-model="accountAddForm.merchantAddress"> </el-input>
<el-button
type="primary"
class="form-btn"
@click="dialogMapVisible = true"
<el-button type="primary" class="form-btn" @click="dialogMapVisible = true"
>选择地址</el-button
>
</el-form-item>
......@@ -187,6 +184,7 @@
highlight-current
:props="defaultProps"
:filter-node-method="filterNode"
@check="clickDeal"
>
</el-tree>
</div>
......@@ -258,7 +256,7 @@ export default {
},
businessScopeCustomize: {
type: Array,
}
},
},
data() {
const validatePhone = (rule, value, callback) => {
......@@ -285,18 +283,29 @@ export default {
},
};
},
watch: {
filterText(val) {
this.$refs.brandTree.filter(val);
},
},
methods: {
clickDeal() {
this.$parent.editStatus = true;
},
filterNode(value, data) {
if (!value) return true;
return data.label.indexOf(value) !== -1;
},
getAddress() {
if(!this.$refs.mapForm.address) {
if (!this.$refs.mapForm.address) {
this.$message.error("请选择地址");
return;
}
this.dialogMapVisible = false;
this.accountAddForm.merchantAddress = this.$refs.mapForm.address;
let lnglat = this.$refs.mapForm.lnglat
this.accountAddForm.lat = lnglat.lat
this.accountAddForm.lng = lnglat.lng
let lnglat = this.$refs.mapForm.lnglat;
this.accountAddForm.lat = lnglat.lat;
this.accountAddForm.lng = lnglat.lng;
},
delImg(index) {
this.accountAddForm.merchantFiles.splice(index, 1);
......@@ -337,9 +346,8 @@ export default {
if (res) {
self.accountAddForm.merchantFiles.push({
fileUrl: res,
fileName: ''
fileName: "",
});
console.log(self.accountAddForm.merchantFiles)
}
});
};
......
<template>
<div class="account-body scrm-box-f">
<div class="account-title">{{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>
<div class="account-body scrm-box-f" v-loading="loading">
<div class="account-title">{{ title }}</div>
<el-tabs v-if="tabMenu.length != 0" v-model="tabName" type="card" @tab-click="handleClik">
<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"
>
<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 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>
......@@ -27,40 +15,19 @@
<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"
>
<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-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 class="nodata" v-if="item.productsArr.length == 0 || itm.merchantProTreeResponses.length == 0">
<img src="../../../assets/img/empty.png" alt="" />
<div>{{ item.productsArr.length == 0 ? '请先选择产品' : '暂无菜单权限' }}</div>
</div>
<div v-else>
<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>
......@@ -68,187 +35,214 @@
</div>
</div>
</template>
<script>
import util from "@/utils/util";
export default {
name: "product",
name: 'product',
props: {
title: {
type: String,
type: String
},
roleType: {
type: Boolean,
type: Boolean
}
},
data() {
return {
treeHeight: 300,
loading: false,
treeHeight: 450,
tabMenu: [],
tabMenu_x: [],
tabMenu_s: [],
accountList: [],
selectIndex: 0,
productId: 0,
products: [],
productsArr: [],
tabName: "",
productTab: "",
tabName: '',
productTab: '',
defaultProps: {
children: "children",
label: "label",
children: 'children',
label: 'label'
},
accountTypes: [],
};
accountTypes: []
}
},
methods: {
handleClik(tab, event) {
console.log(tab, event)
const tabId = tab.name
this.productTab = this.tabMenu.find(i => i.accounttypeId == tabId).productsArr[0].productId
},
selectPro(data) {
this.productTab = data.length != 0 ? data[data.length - 1].productId : "";
const { tabName, tabMenu, productTab } = this;
console.log(tabName, data);
this.$parent.editStatus = true
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);
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;
this.productTab = productId
},
// 获取当前的所有权限
async findMenuFunTreeByMerId(params) {
let tabMenu = await this.$apis.store.findMenuFunTreeByMerId(params);
this.tabMenu = tabMenu.map((item) => {
return {
productsArr: [],
products: item.products,
accounttypeName: item.accounttypeName,
accounttypeId: item.accounttypeId,
// merchantProTreeResponses: item.merchantProTreeResponses,
// productId: ''
};
});
async findMenuFunTreeByMerId(params, arr) {
let tabMenu = await this.$apis.store.findMenuFunTreeByMerId(params)
this.tabMenu = tabMenu
.map(item => {
return {
productsArr: [],
products: item.products,
accounttypeName: item.accounttypeName,
accounttypeId: item.accounttypeId
}
})
.filter(i => arr.includes(i.accounttypeId))
this.$nextTick(() => {
this.addStyle();
});
console.log(this.tabMenu);
this.accountTypes = tabMenu.map((item) => {
this.addStyle()
})
console.log(this.tabMenu)
this.accountTypes = tabMenu.map(item => {
return {
products: null,
accounttypeId: item.accounttypeId,
};
});
this.tabName = this.tabMenu[0].accounttypeId;
accounttypeId: item.accounttypeId
}
})
this.tabName = this.tabMenu[0].accounttypeId
return this.tabMenu
},
// 获取当前的所有权限
async accountTypeSearchRequest(params,status) {
async accountTypeSearchRequest(params, status) {
this.loading = true
let account = ''
if(status) {
if (status) {
account = 'findMenuFunTreeByMerId'
}else {
} else {
account = 'accountTypeSearchRequest'
}
let tabMenu = await this.$apis.store[account](params);
this.tabMenu = tabMenu.map((item) => {
let tabMenu = await this.$apis.store[account](params)
this.accountList = tabMenu.map(item => {
return {
productsArr: [],
products: item.products,
accounttypeName: item.accounttypeName,
accounttypeId: item.accounttypeId,
accounttypeId: item.accounttypeId
// merchantProTreeResponses: item.merchantProTreeResponses,
// productId: ''
};
});
}
})
this.$nextTick(() => {
this.addStyle();
});
console.log(this.tabMenu);
this.accountTypes = tabMenu.map((item) => {
this.addStyle()
})
console.log(this.accountList)
this.accountTypes = tabMenu.map(item => {
return {
products: null,
accounttypeId: item.accounttypeId,
};
});
this.tabName = this.tabMenu[0].accounttypeId;
this.findPermissionsByMerId(params.merchantId?params.merchantId:params.id);
return this.tabMenu
accounttypeId: item.accounttypeId
}
})
this.tabMenu_s = util.deepClone(this.accountList);
// this.tabName = this.tabMenu[0].accounttypeId
this.findPermissionsByMerId(params.merchantId ? params.merchantId : params.id)
return this.accountList
},
// 获取已选择的权限
findPermissionsByMerId(id) {
const params = {
id,
};
this.$apis.store.findPermissionsByMerId(params).then((res) => {
// this.accountTypes = res.map(item=>{
// let products = item.products.map(i=>{
// return {
// menuIds: i.menuIds,
// productId: i.productId,
// functionIds: i.functionIds
// }
// })
// return {
// accounttypeId: item.accounttypeId,
// products
// }
// })
res.forEach((item) => {
this.tabMenu.forEach((itm) => {
id
}
this.$apis.store.findPermissionsByMerId(params).then(res => {
this.loading = false
this.tabMenu_x = util.deepClone(res);
res.forEach(item => {
console.log(item)
this.accountList.forEach(itm => {
console.log(itm)
if (item.accounttypeId == itm.accounttypeId) {
item.products.forEach((i) => {
itm.products.forEach((j) => {
this.tabMenu.push(itm)
item.products.forEach(i => {
itm.products.forEach(j => {
if (i.productId == j.productId) {
itm.productsArr.push(j);
this.$refs[
`tree_${itm.accounttypeId}_${j.productId}`
][0].setCheckedKeys(i.menuIds);
itm.productsArr.push(j)
this.$nextTick(() => {
this.$refs[`tree_${itm.accounttypeId}_${j.productId}`][0].setCheckedKeys(i.menuIds)
})
}
});
});
})
})
}
});
});
});
})
})
this.tabName = this.tabMenu[0].accounttypeId
this.productTab = this.tabMenu[0].productsArr[0].productId
// const arr = res.map(i => i.accounttypeId)
// this.tabMenu.map(i => arr.includes(i.accounttypeId))
// console.log(this.tabMenu, arr)
})
},
resetView() {
this.tabMenu = [];
this.accountList = util.deepClone(this.tabMenu_s);
this.tabMenu_x.forEach(item => {
this.accountList.forEach(itm => {
console.log(itm)
if (item.accounttypeId == itm.accounttypeId) {
this.tabMenu.push(itm)
item.products.forEach(i => {
itm.products.forEach(j => {
if (i.productId == j.productId) {
itm.productsArr.push(j)
this.$nextTick(() => {
this.$refs[`tree_${itm.accounttypeId}_${j.productId}`][0].setCheckedKeys(i.menuIds)
})
}
})
})
}
})
})
},
// 渲染树结构
renderContent(h, v) {
if (v.data.logo == "functionValue") {
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");
const nodes = document.getElementsByClassName('fun-tree-node')
for (let i = 0; i < nodes.length; i++) {
const parentNode = nodes[i].parentNode;
parentNode.style.float = "left";
const parentNode = nodes[i].parentNode
parentNode.style.float = 'left'
}
},
clickDeal(currentObj, treeStatus) {
this.$parent.editStatus = true
// 用于:父子节点严格互不关联时,父节点勾选变化时通知子节点同步变化,实现单向关联。
let selected = treeStatus.checkedKeys.indexOf(currentObj.id); // -1未选中
let selected = treeStatus.checkedKeys.indexOf(currentObj.id) // -1未选中
// 选中
if (selected !== -1) {
// 子节点只要被选中父节点就被选中
this.selectedParent(currentObj);
this.selectedParent(currentObj)
// 统一处理子节点为相同的勾选状态
this.uniteChildSame(currentObj, true);
this.uniteChildSame(currentObj, true)
} else {
// 未选中 处理子节点全部未选中
console.log(currentObj);
console.log(currentObj)
if (currentObj.children !== null) {
if (currentObj.children.length !== 0) {
this.uniteChildSame(currentObj, false);
this.uniteChildSame(currentObj, false)
}
//放开时为当子节点全为未选中时父节点也变为未选中状态 注释后就是父节点不和子节点强制绑定
// this.uniteParentSame(currentObj.id,treeStatus)//当子节点全为未选中时父节点也变为未选中状态
......@@ -260,142 +254,135 @@ export default {
},
uniteParentSame(id, treeStatus) {
//当子节点全为未选中时父节点也变为未选中状态
const tree_ref = `tree_${this.tabName}_${this.productTab}`;
let node = this.$refs[tree_ref][0].getNode(id); //获取当前节点的节点树
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; //获取当前节点的父节点树
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当前节点的同级节点是否全部未选中
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;
return
}
}
} else {
return;
return
}
this.$refs[tree_ref][0].setChecked(parentNode.id, false); //修改节点为未选择
this.$refs[tree_ref][0].setChecked(parentNode.id, false) //修改节点为未选择
if (node.level > 2) {
//判断是否是最上级节点
this.uniteParentSame(parentNode.id, treeStatus);
this.uniteParentSame(parentNode.id, treeStatus)
}
} else {
return;
return
}
},
// 统一处理子节点为相同的勾选状态
uniteChildSame(treeList, isSelected) {
const tree_ref = `tree_${this.tabName}_${this.productTab}`;
this.$refs[tree_ref][0].setChecked(treeList.id, isSelected);
console.log(treeList);
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);
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);
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);
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);
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);
});
item.children.forEach(i => {
arr.push(i.id)
this.getAllId(i.children, arr)
})
}
});
})
}
return arr;
return arr
},
getSelectInfo() {
this.accountTypes = this.tabMenu.map((item) => {
let products = [];
let productList = [];
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);
this.accountTypes = this.tabMenu.map(item => {
let products = []
let productList = []
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")
.filter((item) => item.logo !== "function" && item.logo !== "functionValue" && item.logo !== 'neglect')
.map((i) => i.id); // 全选菜单idlist
.filter(item => item.logo !== 'function' && item.logo !== 'functionValue' && item.logo !== 'neglect')
.map(i => i.id) // 全选菜单idlist
// const partSelectList = halfCheckedNodes.filter(item => item.logo === 'menu').map(i => i.id) // 半选菜单idlist
const functionIdList = checkedNodes.filter((item) => item.logo === "function");
const functionValueIdLists = checkedNodes.filter(
(item) => item.logo === "functionValue"
);
var list = [];
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;
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,
});
functionValue: j.id + ':' + j.label
})
}
});
})
}
console.log(menuIdList, functionIdList, functionValueIdLists, list);
console.log(menuIdList, functionIdList, functionValueIdLists, list)
if (this.roleType) {
productList.push({
productId: itm.productId,
functionIdList: functionIdList,
// functionValue: list,
menuIdList: menuIdList,
});
menuIdList: menuIdList
})
} else {
products.push({
productId: itm.productId,
functionIds: functionIdList,
functionValue: list,
menuIds: menuIdList,
});
menuIds: menuIdList
})
}
});
})
if (this.roleType) {
return {
accounttypeId: item.accounttypeId,
productList,
};
productList
}
} else {
return {
accounttypeId: item.accounttypeId,
products,
};
products
}
}
});
return this.accountTypes;
},
})
return this.accountTypes
}
},
mounted() {
// this.accountTypeSearchRequest();
// this.findPermissionsByMerId()
},
};
}
}
</script>
<style scoped lang="scss">
......@@ -453,7 +440,7 @@ export default {
cursor: pointer;
&.select-checked {
color: #322ad9;
font-weight: 700;
// font-weight: 700;
border-bottom: none;
}
}
......@@ -465,4 +452,16 @@ export default {
}
}
}
.nodata {
position: absolute;
top: 50%;
left: 50%;
text-align: center;
transform: translate(-50%, -50%);
img {
width: 64px;
height: 41px;
margin-bottom: 12px;
}
}
</style>
\ No newline at end of file
......@@ -13,29 +13,29 @@
<el-row>
<el-col :span="14">
<span class="itemName">登录账户名:</span>
<span class="itemValue">{{ firstPageObj.merchantLoginAccount }}</span>
<span class="itemValue">{{ firstPageObj.merchantLoginAccount || '-' }}</span>
</el-col>
<el-col :span="10">
<span class="itemName itemNameCol2">账户等级:</span>
<span class="itemValue">{{ firstPageObj.accountLevelName }}</span>
<span class="itemValue">{{ firstPageObj.accountLevelName || '-' }}</span>
</el-col>
</el-row>
<el-row>
<el-col :span="14">
<span class="itemName">开通模式:</span>
<span class="itemValue">{{ firstPageObj.merchantModelName }}</span>
<span class="itemValue">{{ firstPageObj.merchantModelName || '-' }}</span>
</el-col>
<el-col :span="10">
<span class="itemName itemNameCol2">账户状态:</span>
<span class="itemValue">
{{ firstPageObj.statusName }}
{{ firstPageObj.statusName || '-' }}
</span>
</el-col>
</el-row>
<el-row>
<el-col :span="14">
<span class="itemName">关联企业微信名:</span>
<span class="itemValue">{{ firstPageObj.entmicroName }}</span>
<span class="itemValue">{{ firstPageObj.entmicroName || '-' }}</span>
</el-col>
<el-col :span="10">
<span class="itemName itemNameCol2">账户有效期:</span>
......@@ -86,23 +86,23 @@
<el-row>
<el-col :span="14">
<span class="itemName">商户名称:</span>
<span class="itemValue">{{ firstPageObj.merchantName }}</span>
<span class="itemValue">{{ firstPageObj.merchantName || '-' }}</span>
</el-col>
<el-col :span="10">
<span class="itemName itemNameCol2">简称:</span>
<span class="itemValue">
{{ firstPageObj.merchantAbbreviation }}
{{ firstPageObj.merchantAbbreviation || '-' }}
</span>
</el-col>
</el-row>
<el-row>
<el-col :span="14">
<span class="itemName">商户类型:</span>
<span class="itemValue">{{ firstPageObj.merchantTypeName }}</span>
<span class="itemValue">{{ firstPageObj.merchantTypeName || '-' }}</span>
</el-col>
<el-col :span="10">
<span class="itemName itemNameCol2">身份证:</span>
<span class="itemValue">{{ firstPageObj.merchantOrgcode }}</span>
<span class="itemValue">{{ firstPageObj.merchantOrgcode || '-' }}</span>
</el-col>
</el-row>
<el-row>
......@@ -110,28 +110,28 @@
<span class="itemName">地址:</span>
<span class="itemValue">
{{ firstPageObj.merchantAddress }}
{{ firstPageObj.merchantAddress || '-' }}
</span>
</el-col>
<el-col :span="10">
<span class="itemName itemNameCol2">联系人:</span>
<span class="itemValue">{{ firstPageObj.merchantLegalPerson }}</span>
<span class="itemValue">{{ firstPageObj.merchantLegalPerson || '-' }}</span>
</el-col>
</el-row>
<el-row>
<el-col :span="14">
<span class="itemName">联系电话:</span>
<span class="itemValue">{{ firstPageObj.merchantLegalPersonPhone }}</span>
<span class="itemValue">{{ firstPageObj.merchantLegalPersonPhone || '-' }}</span>
</el-col>
<el-col :span="10">
<span class="itemName itemNameCol2">营业范围:</span>
<span class="itemValue">{{ firstPageObj.businessScopName }}</span>
<span class="itemValue">{{ firstPageObj.businessScopName || '-' }}</span>
</el-col>
</el-row>
<el-row>
<el-col :span="24">
<span class="itemName">主营品牌:</span>
<span class="itemValue">{{ firstPageObj.merchantBrandName }}</span>
<span class="itemValue">{{ firstPageObj.merchantBrandName || '-' }}</span>
</el-col>
</el-row>
</div>
......@@ -206,6 +206,15 @@
<GLTable ref="updateRecord" :tableTotal="tableTotal" :tableData="updateRecordList" :hasNum="true" :pageConf="pageConf" :tableParams="thirdtableParams" @refreshTable="getThirdTable"></GLTable>
</div>
</div>
<div
class="footer-panel"
:style="{
left: footerLeft + 'px',
width: footerWidth + 'px'
}"
>
<el-button type="primary" @click="handleCancel">关闭</el-button>
</div>
</div>
</template>
<script>
......@@ -327,6 +336,9 @@ export default {
// },
methods: {
handleCancel() {
this.$router.push('/account/index')
},
tabClick(index) {
this.curIndex = index
switch (index) {
......@@ -440,6 +452,8 @@ export default {
},
mounted() {
this.footerLeft = document.querySelector('.base-container-right').offsetLeft
this.footerWidth = document.documentElement.clientWidth - this.footerLeft
this.getThirdTable()
this.getSecondTable()
}
......@@ -448,6 +462,7 @@ export default {
<style lang="scss" scoped>
.merchantDetail {
padding-bottom: 60px;
.titles {
display: flex;
margin-bottom: 20px;
......@@ -584,7 +599,7 @@ export default {
}
.contentTree {
padding: 20px;
max-height: 250px;
height: 250px;
position: relative;
overflow: auto;
......@@ -732,5 +747,17 @@ export default {
padding: 20px;
}
}
.footer-panel {
display: flex;
align-items: center;
justify-content: center;
position: fixed;
width: 100%;
bottom: 0px;
height: 64px;
background: #ffffff;
z-index: 999;
box-shadow: 0px -1px 1px 0px rgba(88, 80, 255, 0.1);
}
}
</style>
<template>
<div class="scrm-main">
<el-tabs v-model="step" 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 data-v-db55ad92="" class="tab-edit-status el-tabs el-tabs--top">
<div class="el-tabs__header is-top">
<div class="el-tabs__nav-wrap is-top">
<div class="el-tabs__nav-scroll">
<div
role="tablist"
class="el-tabs__nav is-top"
style="transform: translateX(0px)"
>
<div
class="el-tabs__active-bar is-top"
:style="{ width: '84px', transform: 'translateX(' + tabWidth + 'px)' }"
></div>
<div
@click="hanleTab(1)"
id="tab-first"
aria-controls="pane-first"
role="tab"
aria-selected="true"
tabindex="0"
class="el-tabs__item is-top"
:class="{ 'is-active': step == 'first' }"
>
修改功能权限
</div>
<div
@click="hanleTab(2)"
id="tab-second"
aria-controls="pane-second"
role="tab"
tabindex="-1"
class="el-tabs__item is-top"
:class="{ 'is-active': step == 'second' }"
>
修改基本信息
</div>
</div>
</div>
</div>
</div>
<div class="el-tabs__content">
<div
data-v-db55ad92=""
role="tabpanel"
id="pane-first"
aria-labelledby="tab-first"
class="el-tab-pane"
></div>
<div
data-v-db55ad92=""
role="tabpanel"
aria-hidden="true"
id="pane-second"
aria-labelledby="tab-second"
class="el-tab-pane"
style="display: none"
></div>
</div>
</div>
<div v-show="step == 'second'">
<div class="account-body scrm-box-f">
<div class="form-title">修改账户信息</div>
......@@ -80,231 +135,6 @@
:businessScopeCustomize="businessScopeCustomize"
:businessOption="businessOption"
></base-info>
<!-- <el-form
ref="baseForm"
:model="accountAddForm"
class="account-body-form"
label-width="120px"
:rules="baseRules"
>
<el-row>
<el-col :span="12">
<el-form-item label="商户名称" prop="merchantName">
<el-input
size="small"
v-model="accountAddForm.merchantName"
placeholder="请输入商户名称"
></el-input>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="商户简称">
<el-input
size="small"
v-model="accountAddForm.merchantAbbreviation"
placeholder="请输入商户简称"
></el-input>
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col :span="12">
<el-form-item label="商户类型" class="merchant-row">
<el-input
size="small"
v-model="accountAddForm.merchantOrgcode"
placeholder="请输入组织机构号码"
v-if="accountAddForm.merchantType == 2"
>
<el-select
v-model="accountAddForm.merchantType"
slot="prepend"
placeholder="请选择"
>
<el-option label="个人" :value="1"></el-option>
<el-option label="企业" :value="2"></el-option>
</el-select>
</el-input>
<el-input
size="small"
v-model="accountAddForm.merchantOrgcode"
placeholder="请输入正确的身份证号"
v-if="accountAddForm.merchantType == 1"
>
<el-select
v-model="accountAddForm.merchantType"
slot="prepend"
placeholder="请选择"
>
<el-option label="个人" :value="1"></el-option>
<el-option label="企业" :value="2"></el-option>
</el-select>
</el-input>
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col :span="12">
<el-form-item size="small" label="商户地址" class="form-row">
<el-input readonly size="small" v-model="accountAddForm.merchantAddress"> </el-input>
<el-button type="primary" class="form-btn" @click="dialogMapVisible = true"
>选择地址</el-button
>
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col :span="12">
<el-form-item label="联系电话" prop="merchantLegalPersonPhone">
<el-input
maxlength="11"
size="small"
v-model="accountAddForm.merchantLegalPersonPhone"
placeholder="请输入联系电话"
></el-input>
<el-checkbox v-model="accountAddForm.isloginName"
>联系电话同时作为登录账户名</el-checkbox
>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="联系人">
<el-input
size="small"
v-model="accountAddForm.merchantLegalPerson"
placeholder="请输入联系人"
></el-input>
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col :span="12">
<el-form-item label="驻店联系人">
<el-input
maxlength="11"
size="small"
v-model="accountAddForm.residentContact"
placeholder="请输入驻店联系人"
></el-input>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="驻店电话">
<el-input
size="small"
v-model="accountAddForm.residentPhone"
placeholder="请输入驻店电话"
></el-input>
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col :span="12">
<el-form-item label="营业范围">
<el-checkbox-group v-model="accountAddForm.businessScope">
<el-checkbox
v-for="item in businessOption"
:label="item.dictValue"
:key="item"
>{{ item.dictLabel }}</el-checkbox
>
</el-checkbox-group>
<div
class="scrm-flex-center"
v-for="(item, index) in businessScopeCustomize"
:key="index"
>
<el-input
size="small"
v-model="businessScopeCustomize[index].name"
placeholder="请自定义营业范围,建议不超过10个"
></el-input>
<i
class="el-icon-circle-plus el-icon-btn"
@click="addBusinessScope"
v-if="index == businessScopeCustomize.length - 1"
></i>
<i
class="el-icon-remove el-icon-btn"
@click="removeBusinessScope"
v-else
></i>
</div>
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col :span="12">
<el-form-item label="营业时间">
<el-time-picker
size="small"
value-format="HH:mm:ss"
is-range
v-model="accountAddForm.bussinessTime"
range-separator="至"
start-placeholder="开始时间"
end-placeholder="结束时间"
placeholder="选择时间范围"
></el-time-picker>
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col :span="12">
<el-form-item label="主营品牌">
<el-input size="small" v-model="filterText"></el-input>
<div class="brand-tree">
<el-tree
:data="brandData"
show-checkbox
default-expand-all
node-key="id"
ref="brandTree"
highlight-current
:props="defaultProps"
:filter-node-method="filterNode"
>
</el-tree>
</div>
</el-form-item>
</el-col>
<el-col :span="12">
<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
action=""
class="image-uploader"
:show-file-list="false"
list-type="picture-card"
v-loading="loadingImg"
:before-upload="upLoadImg"
>
<i class="el-icon-plus"></i>
</el-upload>
</div>
<div class="tips">图片格式仅支持JPG,PNG格式,大小1M</div>
</el-form-item>
</el-col>
</el-row>
</el-form> -->
</div>
</div>
<div v-show="step == 'first'">
......@@ -317,10 +147,10 @@
width: footerWidth + 'px',
}"
>
<el-button type="primary" @click="handleSave" v-show="step == 'first'"
<el-button type="primary" @click="handleSave()" v-show="step == 'first'"
>确定</el-button
>
<el-button type="primary" @click="handleNext" v-show="step == 'second'"
<el-button type="primary" @click="handleNext()" v-show="step == 'second'"
>确定</el-button
>
<el-button type="primary" @click="handleCancel">取消</el-button>
......@@ -336,6 +166,7 @@
</template>
<script>
import util from "@/utils/util";
import mapView from "@/components/mapView/index";
import autoButton from "@/components/auto-button/index";
import selectProduct from "./components/selectProduct";
......@@ -350,6 +181,9 @@ export default {
},
data() {
return {
editStatus: false,
detailFirst: {},
tabWidth: 0,
editInfo: {},
pwdStatus: true,
step: "first",
......@@ -416,60 +250,62 @@ export default {
filterText(val) {
this.$refs.brandTree.filter(val);
},
},
methods: {
filterNode(value, data) {
if (!value) return true;
return data.label.indexOf(value) !== -1;
accountAddForm: {
handler() {
this.editStatus = true;
},
deep: true,
},
getAddress() {
this.dialogMapVisible = false;
this.accountAddForm.merchantAddress = this.$refs.mapForm.address;
console.log(this.accountAddForm.merchantAddress);
accountInfoForm: {
handler() {
this.editStatus = true;
},
deep: true,
},
delImg(index) {
this.accountAddForm.merchantFiles.splice(index, 1);
},
methods: {
hanleTab(status) {
if (this.editStatus) {
this.$confirm("离开将不保存本页修改", "提示", {
confirmButtonText: "确定",
cancelButtonText: "取消",
type: "warning",
})
.then(() => {
this.handleNext(status);
})
.catch(() => {
this.tabCancel(status);
});
} else {
this.handleTabs(status);
}
},
upLoadImg(file) {
let fileName = file.name;
if (file.name.lastIndexOf(".") === -1) {
this.$message.info("路径不正确");
return false;
tabCancel(status) {
if (status == 2) {
this.$refs.productForm.resetView();
} else {
this.renderView(this.detailFirst);
this.pwdStatus = true;
}
let AllImgExt = ".jpg|.jpeg|.gif|.bmp|.png|.swf";
let extName = file.name.substring(file.name.lastIndexOf(".")).toLowerCase();
if (AllImgExt.indexOf(extName + "|") === -1) {
this.$message.info("图片格式不正确");
return false;
this.handleTabs(status);
},
handleTabs(status) {
this.editStatus = false;
if (status == 1 && this.step == "second") {
this.tabWidth = 0;
this.step = "first";
}
// if (fileSize < 3145728) {
if (window.FileReader) {
let reader = new FileReader();
let self = this;
reader.readAsDataURL(file);
reader.onload = (img) => {
console.log(file);
let type = fileName.split(".")[1];
let imgUrl = img.target.result.split(",")[1];
self.loadingImg = true;
self.$apis.common
.pictureUpload({
file: `${type}@${imgUrl}`,
})
.then((res) => {
if (res) {
self.accountAddForm.merchantFiles.push({
fileUrl: res,
});
}
});
};
if (status == 2 && this.step == "first") {
this.step = "second";
this.tabWidth = 124;
}
},
handleCancel() {
this.$router.push("/account/index");
},
handleSave() {
//保存
handleSave(status) {
if (this.$refs.productForm.getSelectInfo().length == 0) {
this.$message.error("请选择产品");
return;
......@@ -482,12 +318,12 @@ export default {
};
this.$apis.store.updatePermissions(params).then((res) => {
if (res) {
this.$router.push("/account/index");
status ? this.handleTabs(status) : this.$router.push("/account/index");
}
});
},
//下一步
handleNext() {
handleNext(status) {
const pm1 = new Promise((resolve, reject) => {
this.$refs.baseInfoForm.$refs.baseForm.validate((valid) => {
if (valid) resolve();
......@@ -512,11 +348,11 @@ export default {
params.isloginName ? (params.isloginName = 1) : (params.isloginName = 0);
let businessScopeCustomize = this.businessScopeCustomize.map((item) => item.name);
params.businessScopeCustomize = businessScopeCustomize.join(",");
params.merchantFiles = JSON.stringify(params.merchantFiles)
params.merchantFiles = JSON.stringify(params.merchantFiles);
Promise.all([pm1, pm2]).then(() => {
this.$apis.store.updateMerchant(params).then((res) => {
if (res) {
this.$router.push("/account/index");
status ? this.handleTabs(status) : this.$router.push("/account/index");
}
});
});
......@@ -532,12 +368,6 @@ export default {
});
this.findMerchantDetail();
},
addBusinessScope() {
this.businessScopeCustomize.push({ name: "" });
},
removeBusinessScope(index) {
this.businessScopeCustomize.splice(index, 1);
},
async findMerchantDetail() {
this.$apis.store
.findMerchantDetail({
......@@ -545,115 +375,119 @@ export default {
})
.then((res) => {
let para;
if(res.parentMerchant) {
if (res.parentMerchant) {
para = {
id: this.accountAddForm.id,
parentId: res.parentId,
accountLevel: res.merchantAccountLevel,
};
}else {
id: this.accountAddForm.id,
parentId: res.parentId,
accountLevel: res.merchantAccountLevel,
};
} else {
para = {
ids: res.accountType,
merchantId: res.id,
accountLevel: res.merchantAccountLevel,
};
}
this.$refs.productForm.accountTypeSearchRequest(para,res.parentMerchant);
let {
isloginName,
bussinessBegintime,
bussinessEndtime,
lat,
lng,
merchantAddress,
merchantName,
merchantAbbreviation,
merchantType,
merchantOrgcode,
merchantLegalPerson,
merchantLegalPersonPhone,
residentContact,
residentPhone,
merchantLoginAccount,
merchantLoginPassword,
merchantAccountLevel,
businessScope,
businessScopeCustomize,
merchantBrand,
merchantFileResponses,
merchantModel,
accountTypes,
accounttypeId,
} = res;
this.accountInfoForm.merchantLoginAccount = merchantLoginAccount;
this.accountInfoForm.merchantLoginPassword = merchantLoginPassword;
this.accountTypes = accountTypes;
businessScope = businessScope ? businessScope.split(",") : [];
if (businessScope.length > 0) {
for (let i in this.accountAddForm.businessScope) {
this.accountAddForm.businessScope[i] = parseInt(
this.accountAddForm.businessScope[i]
);
}
}
this.accountAddForm.bussinessTime = [bussinessBegintime, bussinessEndtime];
businessScopeCustomize = businessScopeCustomize
? businessScopeCustomize.split(",")
: [];
if (businessScopeCustomize.length > 0) {
this.businessScopeCustomize = businessScopeCustomize.map((item) => {
return {
name: item,
};
});
}
accounttypeId = accounttypeId ? accounttypeId.split(",") : [];
if (accounttypeId.length > 0) {
this.accounttypeId = accounttypeId.map((item) => {
return {
name: item,
};
});
}
if (merchantFileResponses.length > 0) {
this.accountAddForm.merchantFiles = merchantFileResponses.map((item) => {
return {
fileUrl: item.fileUrl,
};
});
ids: res.accountType,
merchantId: res.id,
accountLevel: res.merchantAccountLevel,
};
}
merchantBrand = merchantBrand ? merchantBrand.split(",") : [];
if (merchantBrand && merchantBrand.length > 0) {
for (let i in merchantBrand) {
merchantBrand[i] = parseInt(merchantBrand[i]);
}
this.$refs.baseInfoForm.$refs.brandTree.setCheckedKeys(merchantBrand);
}
this.accountAddForm = Object.assign(this.accountAddForm, {
isloginName: isloginName ? true : false,
lat,
lng,
merchantAddress,
merchantName,
merchantAbbreviation,
merchantType,
merchantOrgcode,
merchantLegalPerson,
merchantLegalPersonPhone,
residentContact,
residentPhone,
merchantAccountLevel,
merchantModel,
});
this.$refs.productForm.accountTypeSearchRequest(para, res.parentMerchant);
this.detailFirst = util.deepClone(res);
this.renderView(res);
});
},
renderView(res) {
let {
isloginName,
bussinessBegintime,
bussinessEndtime,
lat,
lng,
merchantAddress,
merchantName,
merchantAbbreviation,
merchantType,
merchantOrgcode,
merchantLegalPerson,
merchantLegalPersonPhone,
residentContact,
residentPhone,
merchantLoginAccount,
merchantLoginPassword,
merchantAccountLevel,
businessScope,
businessScopeCustomize,
merchantBrand,
merchantFileResponses,
merchantModel,
accountTypes,
accounttypeId,
} = res;
this.accountInfoForm.merchantLoginAccount = merchantLoginAccount;
this.accountInfoForm.merchantLoginPassword = merchantLoginPassword;
this.accountTypes = accountTypes;
this.accountAddForm.businessScope = businessScope ? businessScope.split(",") : [];
if (this.accountAddForm.businessScope.length > 0) {
for (let i in this.accountAddForm.businessScope) {
this.accountAddForm.businessScope[i] = parseInt(
this.accountAddForm.businessScope[i]
);
}
}
this.accountAddForm.bussinessTime = [bussinessBegintime, bussinessEndtime];
businessScopeCustomize = businessScopeCustomize
? businessScopeCustomize.split(",")
: [];
if (businessScopeCustomize.length > 0) {
this.businessScopeCustomize = businessScopeCustomize.map((item) => {
return {
name: item,
};
});
}
accounttypeId = accounttypeId ? accounttypeId.split(",") : [];
if (accounttypeId.length > 0) {
this.accounttypeId = accounttypeId.map((item) => {
return {
name: item,
};
});
}
if (merchantFileResponses.length > 0) {
this.accountAddForm.merchantFiles = merchantFileResponses.map((item) => {
return {
fileUrl: item.fileUrl,
};
});
}
merchantBrand = merchantBrand ? merchantBrand.split(",") : [];
for (let i in merchantBrand) {
merchantBrand[i] = parseInt(merchantBrand[i]);
}
this.$refs.baseInfoForm.$refs.brandTree.setCheckedKeys(merchantBrand);
this.accountAddForm = Object.assign(this.accountAddForm, {
isloginName: isloginName ? true : false,
lat,
lng,
merchantAddress,
merchantName,
merchantAbbreviation,
merchantType,
merchantOrgcode,
merchantLegalPerson,
merchantLegalPersonPhone,
residentContact,
residentPhone,
merchantAccountLevel,
merchantModel,
});
this.$nextTick(() => {
this.editStatus = false;
});
},
getCarbrandTree() {
this.$apis.store.getCarbrandTree({}).then((res) => {
this.brandData = res;
});
},
},
mounted() {
this.footerLeft = document.querySelector(".base-container-right").offsetLeft;
this.footerWidth = document.documentElement.clientWidth - this.footerLeft;
......
<template>
<div class="scrm-main">
<div class="form-header">
<div class="form-header" v-if="$globalState.session.accountLevel == 1">
<el-button type="primary" @click="handleContact" size="small" icon="el-icon-link"
>门店账户关联企微</el-button
>
......@@ -124,7 +124,7 @@
<el-button
type="text"
@click="handleAdd(scope.scope)"
v-if="scope.scope.status == 2 && $globalState.session.accountLevel != 4"
v-if="scope.scope.status == 2 && scope.scope.merchantAccountLevel != 4"
>创建子商户/门店</el-button
>
</template>
......@@ -219,6 +219,10 @@ export default {
prop: "merchantLegalPersonPhone",
width: "120px",
},
{
label: "更新时间",
prop: "updatedTime"
},
],
},
layout: "sizes, prev, pager, next, jumper, ->, total",
......
......@@ -3,7 +3,7 @@
<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 class="page-radio" :style="`width: ${width - 32}px`" :title="item.merchantName" v-for="item in currList" :key="item.id" :label="item.id">{{ item.merchantName }}</el-radio>
</el-radio-group>
<div class="btns" v-show="page.total > 20">
<el-button :size="size" :disabled="page.pageNum == 1" @click="handlePage(false)">上一页</el-button>
......@@ -127,7 +127,7 @@ export default {
}
.page-radio {
display: block;
width: 320px;
/* width: 320px; */
height: 36px;
line-height: 36px;
overflow: hidden;
......
<!-- 配置管理 -->
<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" @handleChange="handleChangeMerchant"></select-page>
</template>
<template slot="visibleInferiorMer" slot-scope="item">
<el-input :style="{ width: item.width || '360px' }" placeholder="可见商户" v-model="filterText"></el-input>
<el-tree show-checkbox check-on-click-node check-strictly class="filter-tree" :data="baseData.merchantTree" :props="defaultProps" default-expand-all :filter-node-method="filterNode" ref="tree" @check="handleClickNode"></el-tree>
</template>
</glsx-combi-form> -->
<div class="MsgWrap powerlimt">
<span class="content-title">功能权限</span>
<div class="powerTreeWrap">
<div class="mainTitleWrap">
<div class="mainTitle" :class="{ activeMainTitle: currentIndex == index }" v-for="(item, index) in powerDataArray" :key="index" @click="powerTabClick(index)">
{{ item.accounttypeName || 'null' }}
</div>
</div>
<div class="content">
<div class="subTitleWrap" v-if="products.length > 0">
<div class="subTitle" :class="{ acitveSubTitle: subCurrentIndex == sindex }" v-for="(ele, sindex) in products" :key="sindex" @click="powerSubTabClick(sindex)">
{{ ele.productName }}
</div>
</div>
<div class="contentTree">
<template v-if="merchantProTreeResponses.length > 0">
<el-tree default-expand-all :data="merchantProTreeResponses" :props="defaultProps"></el-tree>
</template>
<div v-else class="noDataContent">
<img src="../../../assets/img/empty.png" alt="" />
<div>暂无数据</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</template>
......@@ -23,16 +37,61 @@
export default {
name: 'config',
data() {
return {}
return {
powerDataArray: [],
currentIndex: 0, //功能权限主标题的索引
subCurrentIndex: 0,
defaultProps: {
children: 'children',
label: 'label'
}
}
},
props: {
id: {
type: String,
default: ''
}
},
components: {},
computed: {
products() {
if (!this.powerDataArray.length) {
return []
}
return this.powerDataArray[this.currentIndex].products
},
//功能树的数据
merchantProTreeResponses() {
if (!this.powerDataArray.length) {
return []
} else if (this.powerDataArray.length > 0 && this.powerDataArray[this.currentIndex].products.length == 0) {
return []
}
computed: {},
return this.powerDataArray[this.currentIndex].products[this.subCurrentIndex].merchantProTreeResponses
}
},
mounted() {},
mounted() {
this.getInfo()
},
methods: {
getInfo() {
this.$apis.employee.getDetailInfoApi({ id: this.id }).then(res => {
this.powerDataArray = res.accountTypeTreeResponseList
})
},
powerTabClick(index) {
this.currentIndex = index
//每次切换将subCurrentIndex置为0
this.subCurrentIndex = 0
},
powerSubTabClick(index) {
this.subCurrentIndex = index
},
handleClose() {
this.$router.push({
name: 'Account2EmployeeIndex'
......@@ -41,7 +100,7 @@ export default {
}
}
</script>
<style>
<style lang="scss">
.config-employee {
margin-bottom: 64px;
}
......@@ -50,63 +109,88 @@ export default {
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;
}
.content-title {
display: inline-block;
position: relative;
height: 48px;
background-color: #fff;
font-size: 16px;
font-weight: 600;
color: #333333;
line-height: 48px;
padding-left: 20px;
}
.powerlimt {
padding-bottom: 30px;
.powerTreeWrap {
background-color: #f4f6fc;
margin: 0 20px;
border-radius: 4px;
min-height: 300px;
padding-top: 2px;
padding-left: 2px;
padding-bottom: 10px;
.mainTitleWrap {
height: 32px;
display: flex;
.config-employee .flex {
display: flex;
justify-content: space-between;
}
.mainTitle {
background-color: #f4f6fc;
height: 32px;
width: 180px;
line-height: 32px;
text-align: center;
border-radius: 2px;
cursor: pointer;
}
.activeMainTitle {
background-color: #fff;
color: #5850ff;
}
}
.content {
background-color: #fff;
.config-employee .edit-title {
font-size: 20px;
font-weight: bold;
color: #333333;
line-height: 38px;
height: 38px;
margin: 0 0;
}
margin: 20px 10px 0;
.subTitleWrap {
height: 40px;
display: flex;
background-color: #f4f6fc;
.subTitle {
background-color: #f4f6fc;
height: 40px;
width: 180px;
line-height: 40px;
text-align: center;
border-radius: 2px;
}
.acitveSubTitle {
background-color: #fff !important;
color: #5850ff;
}
}
.contentTree {
padding: 20px;
min-height: 250px;
height: 250px;
position: relative;
overflow: auto;
.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;
}
.config-employee .filter-tree {
width: 360px;
max-height: 200px;
overflow: scroll;
}
.config-employee .el-checkbox:last-of-type {
margin-right: 8px;
}
.config-employee .filter-tree .el-tree-node__label {
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
.noDataContent {
width: 64px;
height: 64px;
position: absolute;
left: 50%;
top: 50%;
margin-top: -32px;
margin-left: -32px;
div {
margin-top: 12px;
}
}
}
}
}
}
}
</style>
......@@ -4,25 +4,27 @@
<div class="container">
<p class="edit-sub-title p-rl-20">员工基本信息</p>
<el-form label-width="140px">
<el-form-item style="margin-bottom: 0;" v-for="(item, index) in detailFormDaata" :key="index" :label="item.label + ':'">
<el-form-item style="margin-bottom: 0;" v-for="(item, index) in detailFormData" :key="index" :label="item.label + ':'">
<span>{{ info[item.name] || '无' }}</span>
</el-form-item>
</el-form>
</div>
<div class="container">
<p class="edit-sub-title p-rl-20">可见下级商户</p>
<div class="config-mer-name">
<p class="mer-txt" v-for="(item, index) in info.visibleInferiorMerName.split(',')" :key="index">{{item}}</p>
</div>
</div>
</div>
</template>
<script>
// import { getDetailInfoApi } from '@/api/modules/employee'
export default {
name: 'info',
data() {
return {
info: {},
detailFormDaata: [{
detailFormData: [{
label: '姓名',
name: 'staffName'
}, {
......@@ -58,7 +60,6 @@ export default {
methods: {
getInfo() {
this.$apis.employee.getDetailInfoApi({ id: this.id }).then(res => {
console.log(res)
this.info = res
})
}
......@@ -133,4 +134,15 @@ export default {
overflow: hidden;
text-overflow: ellipsis;
}
.config-employee .config-mer-name {
font-size: 14px;
line-height: 20px;
margin: 21px 0 0 140px;
min-height: 36px;
}
.config-employee .config-mer-name .mer-txt {
overflow: hidden;
white-space: nowrap;
text-overflow: ellipsis;
}
</style>
......@@ -45,13 +45,12 @@ export default {
this.footerLeft = document.querySelector('.base-container-right').offsetLeft
this.footerWidth = document.documentElement.clientWidth - this.footerLeft
this.id = this.$route.params.id
console.log(this.id)
},
methods: {
handleClose() {
this.$router.push({
name: 'Account2EmployeeIndex'
path: '/employee/index'
})
}
}
......
......@@ -6,9 +6,15 @@
</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">
<glsx-combi-form class="p-tr-20" ref="editFormRef" labelWidth="160px" @handleImgDelete="handleImgDelete" :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" @handleChange="handleChangeMerchant"></select-page>
<select-page :form="editForm" width="360" :targetItem="item.scope" @handleChange="handleChangeMerchant"></select-page>
</template>
<template v-if="routeInfo.addOrEdit == 2" slot="passwordSlot">
<el-button class="m-l-10" type="primary" @click="handleResetPass">重置密码</el-button>
</template>
<template v-if="userInfo.accountLevel == 4 && routeInfo.addOrEdit == 1" slot="roleIdsSlot">
<el-button class="m-l-10" type="primary" @click="handleJumpRole">创建角色</el-button>
</template>
<template slot="visibleInferiorMer" slot-scope="item">
<el-input :style="{ width: item.width || '360px' }" placeholder="可见商户" v-model="filterText"></el-input>
......@@ -18,7 +24,7 @@
</div>
<div class="footer" :style="{ left: footerLeft + 'px', width: footerWidth + 'px' }">
<el-button type="primary" @click="handleConfirm">确定</el-button>
<el-button type="default" @click="handleCancel">取消</el-button>
<el-button type="primary" @click="handleCancel">取消</el-button>
</div>
</div>
</template>
......@@ -27,7 +33,6 @@
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() {
......@@ -35,7 +40,7 @@ export default {
title: '新增员工',
titleObj: {
1: '新增员工',
2: '编辑员工'
2: '修改员工'
},
footerLeft: '0',
footerWidth: '0',
......@@ -59,18 +64,27 @@ export default {
staffPhone: '',
password: '',
visibleInferiorMer: '',
roleId: '',
merhcnatImg: '',
roleIds: '',
merchantImg: '',
fileName: ''
},
editRule: {
merchantId: [{ required: true, message: '请选择所属商户', trigger: 'change' }],
staffName: [{ required: true, message: '请输入员工姓名', trigger: 'change' }],
staffPhone: [{ required: true, message: '请输入登录手机号', trigger: 'change' }],
staffPhone: [{ required: true, message: '请输入登录手机号' },
{ required: true, validator: (rule, value, callback) => {
(/^(13[0-9]|15[0-9]|16[0-9]|17[0-9]|18[0-9]|19[0-9]|14[0-9])[0-9]{8}$/).test(value) ? callback() : callback(new Error('请输入正确的手机号')
)}, trigger: 'change'
}],
// 6-15位
password: [{ required: true, message: '请输入登录密码', trigger: 'change' }],
password: [{ required: true, message: '请输入登录密码', trigger: 'change' },
{ required: true, validator: (rule, value, callback) => {
(/^[\S]{6,15}$/).test(value) ? callback() : callback(new Error('密码必须6-15位'))
}, trigger: 'change'
}],
visibleInferiorMer: [{ required: true, message: '请选择可见商户', trigger: 'change' }],
roleId: [{ required: true, message: '请选择角色权限', trigger: 'change' }]
roleIds: [{ required: true, message: '请选择角色权限', trigger: 'change' }]
// staffEmail: [{ required: false, validator: (rule, value, callback) => {}, trigger: 'change' }]
},
isBlock: true,
editFormData: [
......@@ -103,9 +117,11 @@ export default {
{
label: '登录密码',
name: 'password',
showPass: true,
width: '360px',
type: 'input',
maxlength: 15
maxlength: 15,
suffixSlot: 'passwordSlot'
},
{
label: '可见商户',
......@@ -114,17 +130,18 @@ export default {
},
{
label: '角色权限',
name: 'roleId',
name: 'roleIds',
type: 'select',
width: '360px',
optionList: [],
optionId: 'id',
optionLabel: 'roleName',
optionsName: 'roleList'
optionsName: 'roleList',
suffixSlot: 'roleIdsSlot'
},
{
label: '头像',
name: 'merhcnatImg',
name: 'merchantImg',
type: 'upload',
maxPhotoNum: 1,
// wdithLt: 800,
......@@ -133,16 +150,15 @@ export default {
handleUpload: (e, file, targetItem) => {
const imgFile = e.target.result
const base64 = file.name.split('.')[1] + '@' + imgFile.split(',')[1]
this.$apis.common.pictureUpload({ file: base64}).then((res) => {
this.$apis.common.pictureUpload({ file: base64 }).then(res => {
if (res) {
console.log(res)
// fileName
this.editForm[targetItem.name] = res
this.editForm.fileName = file.name
console.log(this.editForm)
this.$refs.editFormRef.$refs[this.editChildRef].validateField(targetItem.name)
}
})
// uploadImg({ file: base64, fileType: 'image' }).then(res => {
// this.editForm[targetItem.name] = res
// this.$refs.editFormRef.$refs[this.editChildRef].validateField(targetItem.name)
// })
}
},
{
......@@ -180,14 +196,20 @@ export default {
},
mounted() {
this.userInfo = this.$globalState.session
this.footerLeft = document.querySelector('.base-container-right').offsetLeft
this.footerWidth = document.documentElement.clientWidth - this.footerLeft
this.routeInfo = this.$route.params
this.title = this.titleObj[this.routeInfo.addOrEdit]
this.getAllMerchantList()
this.routeInfo.addOrEdit != 1 ? this.getInfo() : ''
},
methods: {
handleImgDelete(targetItem) {
this.$set(this.editForm, 'merchantImg', '')
this.editForm.fileName = ''
},
getAllMerchantList() {
this.$apis.employee.getAllMerchantListApi({}).then(res => {
this.baseData.allMerchantList = res
......@@ -195,38 +217,45 @@ export default {
},
getInfo() {
this.$apis.employee.getDetailInfoApi({ id: this.routeInfo.id }).then(res => {
this.editForm = res
this.editForm.roleId = res.roleIds[0]
if (res.merchantFileResponse) {
this.editForm.merhcnatImg = res.merchantFileResponse.fileUrl
this.editForm.fileName = res.merchantFileResponse.fileName
this.editForm = {
id: res.id,
merchantId: res.merchantId,
merchantName: res.merchantName,
staffName: res.staffName,
staffPhone: res.staffPhone,
password: res.password,
staffEmail: res.staffEmail,
staffJob: res.staffJob,
visibleInferiorMer: res.visibleInferiorMer,
roleIds: res.roleIds[0],
merchantImg: res.merchantFileResponse ? res.merchantFileResponse.fileUrl : '',
fileName: res.merchantFileResponse ? res.merchantFileResponse.fileName : ''
}
console.log(this.editForm)
this.handleChangeMerchant(this.editForm.merchantId, true)
})
},
handleChangeMerchant(e, editRecovery = false) {
// console.log(e)
if (!editRecovery) {
this.editForm.roleId = ''
this.editForm.visibleInferiorMer = ''
this.editForm.roleIds = ''
this.editForm.visibleInferiorMer = String(e)
}
if (!e) {
this.baseData.merchantTree = []
this.baseData.roleList = []
this.getOptionsList('editFormData', false, 'roleId')
this.getOptionsList('editFormData', false, 'roleIds')
}
this.getRoleList(e)
this.getMerchantTree(e, editRecovery)
this.getMerchantTree(e)
},
setCheckedTree() {
var checkedList = this.editForm.visibleInferiorMer.split(',').map(item => +item)
this.$refs.tree.setCheckedKeys(checkedList)
},
getMerchantTree(value, editRecovery) {
getMerchantTree(value) {
this.$apis.employee.getMerchantTreeApi({ id: value }).then(res => {
this.baseData.merchantTree = res
editRecovery && this.setCheckedTree()
this.setCheckedTree()
})
},
filterNode(value, data) {
......@@ -236,7 +265,7 @@ export default {
getRoleList(value) {
this.$apis.employee.getRoleListApi({ id: value }).then(res => {
this.baseData.roleList = res
this.getOptionsList('editFormData', false, 'roleId')
this.getOptionsList('editFormData', false, 'roleIds')
})
},
getOptionsList(formName, hasAll = true, refreshSigle) {
......@@ -267,35 +296,56 @@ export default {
},
handleClickNode(data, node) {
// console.log(node.checkedNodes)
this.editForm.visibleInferiorMer = node.checkedNodes.map(item => item.id)
this.editForm.visibleInferiorMer = node.checkedNodes.map(item => item.id).join(',')
this.$refs.editFormRef.$refs[this.editChildRef].validateField('visibleInferiorMer')
},
handleResetPass() {
this.editForm.password = ''
},
handleJumpRole() {
this.$router.push('/role/create/'+0)
},
handleConfirm() {
// console.log(this.$refs.tree.getCheckedNodes())
console.log(this.editForm)
this.$refs.editFormRef.$refs[this.editChildRef].validate(valid => {
if (valid) {
var params = this.$common.utils.deepClone(this.editForm)
// merchantFileRequest
params.roleIds = [this.editForm.roleId]
params.merchantFileRequest = {
fileName: this.editForm.fileName,
fileUrl: this.editForm.merhcnatImg
if (this.editForm.merchantImg) {
params.merchantFileRequest = JSON.stringify({
fileName: this.editForm.fileName,
fileUrl: this.editForm.merchantImg
})
delete params.merchantImg
delete params.fileName
} else {
params.merchantFileRequest = JSON.stringify({
fileName: '',
fileUrl: ''
})
}
console.log(this.editForm)
this.handleCancel()
console.log(params)
var apiName = this.routeInfo.addOrEdit == 1 ? 'addEmployeeApi' : 'updateEmployeeApi'
this.$apis.employee[apiName](params).then(res => {
this.$message({
message: res.code == '0' ? '操作成功' : res.message,
type: res.code == '0' ? 'success' : 'error'
})
if (res.code == '0') {
this.handleCancel()
}
})
}
})
},
handleCancel() {
this.$router.push({
name: 'Account2EmployeeIndex'
path: '/employee/index'
})
}
}
}
</script>
<style scoped>
<style>
.config-employee {
margin-bottom: 64px;
}
......@@ -306,6 +356,9 @@ export default {
padding: 20px;
}
.config-employee .p-rl-20 {
padding: 0 20px;
}
.config-employee .p-tr-20 {
padding: 20px 20px 0;
}
.config-employee .flex {
......@@ -356,15 +409,13 @@ export default {
max-height: 200px;
overflow: scroll;
}
.config-employee .el-checkbox:last-of-type {
margin-right: 8px;
}
.config-employee .filter-tree .el-tree-node__label {
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
margin-left: 8px;
}
.config-employee .m-l-10 {
margin-left: 10px;
}
/* .config-employee .el-checkbox:last-of-type {
margin-right: 8px !important;
} */
</style>
......@@ -12,7 +12,10 @@
{{ 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>
<div v-else-if="item.type === 'input'">
<el-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" :show-password="item.showPass || false" @keydown.native="e => handleInputDown(e, item)"></el-input>
<slot :name="item.suffixSlot" :scope="item"></slot>
</div>
<!-- 选择-输入框 -->
<el-input v-else-if="item.type === 'selectInput'" :placeholder="'请输入' + item.selectOption.find(k => k.name === searchSelectObj[item.selectName].attr).label" :maxlength="item.maxlength" v-model.trim="searchSelectObj[item.selectName].value" :clearable="item.isClear || false" :style="{ width: item.inputWidth || '130px' }" class="input-with-select">
<el-select v-model="searchSelectObj[item.selectName].attr" :style="{ width: item.selectWidth || '130px' }" slot="prepend" placeholder="请选择" @change="item.handleSelectChange">
......@@ -37,9 +40,12 @@
</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>
<div v-else-if="item.type === 'select'">
<el-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>
<slot :name="item.suffixSlot" :scope="item"></slot>
</div>
<!-- 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>
......@@ -187,6 +193,7 @@ export default {
this.$message.error('图片尺寸最大为' + wdithLt + '像素*' + heightLt + '像素')
} else {
targetItem.handleUpload(e, file, targetItem)
// this.$emit('handleUpload', { e: e, file: file, targetItem: targetItem })
}
}
}
......@@ -194,6 +201,7 @@ export default {
// 图片删除
handleImgDelete(targetItem, subIndex = -1) {
Array.isArray(this.formObj[targetItem.name]) ? this.formObj[targetItem.name].splice(subIndex, 1) : (this.formObj[targetItem.name] = '')
this.$emit('handleImgDelete', targetItem)
},
// 图片查看
handleImgLook(src) {
......
<!-- 员工管理 -->
<template>
<div class="config-employee employee-list">
<!-- <div class="container"> -->
<div style="margin: 16px 0;">
<el-button :size="size" type="primary" class="el-icon-plus" @click="handleEdit(1)">创建员工</el-button>
</div>
<!-- </div> -->
<div class="container">
<div>
<glsx-combi-form ref="showSearch" labelWidth="90px" :formObj="searchForm" :searchSelectObj="searchSelectObj" :formData="searchFormData">
<template slot="merchantId" slot-scope="item">
<select-page :form="searchForm" width="200px" :targetItem="item.scope" @handleChange="handleChangeMerchant"></select-page>
<select-page :form="searchForm" width="200" :targetItem="item.scope" @handleChange="handleChangeMerchant"></select-page>
</template>
<span slot="footer" class="footer-btns">
<el-button :size="size" type="primary" @click="handleSearch">查询</el-button>
<el-button :size="size" type="primary">导出</el-button>
<el-button :size="size" type="primary" @click="handleExport">导出</el-button>
</span>
</glsx-combi-form>
</div>
<!-- 表格区域 开始 -->
<GLTable ref="employeeRef" :getListApi="getListApi" :searchForm="tableSearchForm" :tableParams="tableParams" :pageConf="pageConf" :beforeSearchFn="beforeSearchFn">
<div class="table-btns" slot="auth-button" slot-scope="scope">
<div class="table-btns" slot="optionBtns" 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>
</div>
<template slot="otherOptions" slot-scope="scope">
<el-popover placement="left" width="260" trigger="hover">
<p>启用前,你可先为该员工创建角色,配置其所需的功能权限。如下所示:</p>
<p>1. 角色管理-创建角色;</p>
<p>2. 选择员工账户-修改角色</p>
<el-switch slot="reference" v-model="scope.scope.statusName" active-value="启用" inactive-value="禁用" @change="e => handleSwitchChange(e, scope.scope)"></el-switch>
</el-popover>
</template>
</GLTable>
<!-- 表格区域 end -->
</div>
......@@ -34,8 +40,8 @@
<script>
import { utils } from 'glsx-common'
// import { getListApi, getAllMerchantListApi, getRoleListApi, getAllDictApi } from '@/api/modules/employee'
import glsxCombiForm from './glsx-combi-form'
// import glsxTable from '@/components/glsx-table'
import selectPage from './components/selectPage'
export default {
name: 'index',
......@@ -113,7 +119,10 @@ export default {
getListApi: this.$apis.employee.getListApi,
tableParams: {
listName: 'data',
tableOption: true,
tableOption: false,
otherOptions: {
label: '启用开关'
},
tableColumns: [
{
label: '员工姓名',
......@@ -122,7 +131,8 @@ export default {
{
label: '员工企微号',
prop: 'entmicroName',
line: 2
line: 2,
minWidth: '100px'
},
{
label: '角色',
......@@ -153,6 +163,18 @@ export default {
label: '更新时间',
prop: 'updatedTime',
line: 2
},
{
label: '操作',
prop: 'optionBtns',
width: '200px',
addHtml: 'optionBtns'
},
{
label: '启用开关',
prop: 'otherOptions',
width: '100px',
addHtml: 'otherOptions'
}
]
},
......@@ -168,28 +190,32 @@ export default {
components: {
glsxCombiForm,
selectPage
// glsxTable
},
mounted() {
this.getBaseData().then(res => {
this.getOptionsList('searchFormData')
})
this.userInfo = this.$globalState.session
// 门店
if (this.userInfo.accountLevel == 4) {
this.searchFormData.splice(0, 1)
var idx = this.tableParams.tableColumns.findIndex(item => item.prop == 'merchantName')
this.tableParams.tableColumns.splice(idx, 1)
}
this.getAllMerchantList()
this.getStaffStatusList()
},
methods: {
getAllMerchantList() {
this.$apis.employee.getAllMerchantListApi({}).then(res => {
this.baseData.allMerchantList = res
this.userInfo.accountLevel == 4 ? this.handleChangeMerchant(res[0].id) : this.getOptionsList('searchFormData', true, 'merchantId')
})
},
getBaseData() {
// 1.product(产品) 2.account_type(账户类型) 3.(functional_attributes) 功能属性 4.(owned_customer_group)所属客户群 5.channel渠道 6.account_level(商户层级)
return new Promise(resolve => {
Promise.all([this.$apis.employee.getAllMerchantListApi({}), this.$apis.employee.getAllDictApi({ dictType: 'staff_status' })]).then(([allMerchant, staffStatus]) => {
this.baseData.allMerchantList = allMerchant
this.baseData.staffStatusList = staffStatus
resolve()
})
getStaffStatusList() {
this.$apis.employee.getAllDictApi({ dictType: 'staff_status' }).then(res => {
this.baseData.staffStatusList = res
this.getOptionsList('searchFormData', true, 'status')
})
},
getOptionsList(formName, hasAll = true, refreshSigle) {
......@@ -206,7 +232,6 @@ export default {
} 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 = {}
......@@ -239,7 +264,6 @@ export default {
},
getParams() {
var params = utils.deepClone(this.searchForm)
// params.productId.includes('') && (params.productId = [])
const tempParams = this.getSelectInputParams()
params = {
...params,
......@@ -254,27 +278,58 @@ export default {
})
},
handleDetail(row) {
this.$router.push({
name: 'Account2EmployeeDetailEmployee',
params: {
id: row.id
}
})
this.$router.push('/employee/detailEmployee/' + row.id)
},
// 1-新增;2-编辑
handleEdit(addOrEdit, row) {
console.log(addOrEdit)
this.$router.push({
name: 'Account2EmployeeEditEmployee',
params: {
addOrEdit: addOrEdit,
id: row ? row.id : '-1'
var id = row ? row.id : '-1'
this.$router.push('/employee/editEmployee/' + addOrEdit + '/' + id)
},
handleSwitchChange(val, row) {
if (!row.roleName) {
this.$message({
message: '您还未给该员工设置“角色”!设置角色:员工账户管理-修改-角色权限',
type: 'error'
})
this.handleSearch()
return false
}
this.$apis.employee.updateStatusApi({ id: row.id, status: val == '启用' ? 0 : 2 }).then(res => {
this.handleSearch()
})
},
handleDelete(row) {
this.$confirm('是否确认删除该员工?', '删除', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning',
callback: action => {
if (action == 'confirm') {
this.$apis.employee.deleteEmployeeApi({ id: row.id }).then(res => {
this.$message({
message: res.code == '0' ? '操作成功' : res.message,
type: res.code == '0' ? 'success' : 'error'
})
if (res.code == '0') {
this.handleSearch()
}
})
}
}
})
},
handleSearch() {
this.$refs.employeeRef.refreshTable()
},
handleExport() {
var params = this.getParams()
this.$apis.employee.exportEmployeeApi(params).then(res => {
window.open(res)
})
}
}
}
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!