Commit 3a0a06f9 by 无尘

add: 增加登录接口,增加员工字段接口

parent 3cf7e635
......@@ -123,13 +123,18 @@
background-color: rgba(255,255,255,.1);
}
}
.el-input {
.el-textarea {
/deep/ .el-textarea__inner {
font-size: 12px;
color: #606266;
background-color: rgba(255,255,255,.1);
resize: none;
}
}
.el-input {
.is-disabled{
......
......@@ -8,6 +8,10 @@
<el-form-item label="店员可见权限">
<el-radio v-model="ruleForm.radio" label="0">可见所有品牌门店架构和行政架构</el-radio>
</el-form-item>
<div class="permiss-child-cell">
<p>允许指定部门/人员可见:</p>
</div>
<el-form-item label=" ">
<el-radio v-model="ruleForm.radio" label="1">可见所在品牌门店架构和行政架构</el-radio>
</el-form-item>
......@@ -57,6 +61,22 @@ export default {
ruleForm: {
radio: '0',
visibleAll: [
{
id: '1',
type: 'people',
name: '张三',
img: 'http://thirdwx.qlogo.cn/mmopen/j7nX4OeBsXRNyvh6micCywssVEYCaWiaicUZq5Vn2zWktWLAyRvEAH7icQmUhLze8rrQYpM5ptwZ2RL7cX0icyBbiavhYFNTIZhibKu/0'
},
{
id: '1',
type: 'store',
name: '张三',
}
],
storeVisibleAll: [],
storeOwnBrand: [],
storeOwnStore: []
}
}
},
......
......@@ -34,6 +34,10 @@
showCustomDialog: {
type: Boolean,
default: false
},
datailData: {
type: Array,
default: []
}
},
data () {
......@@ -173,31 +177,83 @@
console.log(value)
},
/**
* 获取已经勾选
/**
* 保存已经勾选
*/
getCardList() {
const that = this
var para = {
requestProject: that.repProjectName
saveFields(type) {
const that = this;
const para = {
fields: that.checkList,
type: type,// 类型:1行政架构,2门店架构'
}
that.axios.post(that.baseUrl+'/api-plug/get-coupon-list',qs.stringify(para))
postRequest('/haoban-manage-web/employee-show-field-detail.json',para)
.then((res) => {
console.log(res,res.data,res.data.errorCode)
// console.log(res,res.data,res.data.errorCode)
var resData = res.data
if (resData.errorCode == 0) {
if (resData.errorCode == 1) {
showMsg.showmsg('操作成功','success')
return;
}
errMsg.errorMsg(resData)
})
.catch(function (error) {
console.log(error);
that.$message.error({
duration: 1000,
message: resData.message
message: error.message
})
});
},
/**
* 简单数组-->父子数组对象
*/
treeData(data){
let tree = data.filter((father)=>{ //循环所有项
let branchArr = data.filter((child)=>{
return father.fieldCode == child.parentCode; //返回每一项的子级数组
});
if(branchArr.length>0){
father.children = branchArr; //如果存在子级,则给父级添加一个children属性,并赋值
}
return father.parentCode == 0; //返回第一层
});
// 排序
tree.sort(function(a,b){
return a.sort - b.sort;
})
tree.forEach(function(ele,index){
ele.children.sort(function(a,b){
return a.sort - b.sort;
})
})
return tree;
},
/**
* 获取所有字段
*/
getAllFields() {
const that = this;
postRequest('/haoban-manage-web/record/employee-find-system-template.json',{})
.then((res) => {
// console.log(res.data)
let resData = res.data
if (resData.errorCode == 1) {
that.handleAllFields(resData.result)
return;
}
errMsg.errorMsg(resData)
})
.catch(function (error) {
console.log(error);
// that.toLogin()
// console.log(error);
that.$message.error({
duration: 1000,
message: error.message
......@@ -205,6 +261,34 @@
});
},
/**
* 处理所有系统模板信息
*/
handleAllFields(result) {
const that = this
result.forEach(function(ele,index){
if (!!that.hasOwnProperty(ele.parentCode)) {
ele.fixed = parseInt(ele.fixed) === 1? true : false;
ele.isMust = parseInt(ele.isMust) === 1? true : false;
ele.fieldEdited = parseInt(ele.fieldEdited) === 1? true : false;
ele.systemFlag = true;
ele.fieldOperations = !!ele.fieldOperations? JSON.parse(ele.fieldOperations): {};
ele.staffRecordsIds = !!ele.staffRecordsIds? JSON.parse(ele.staffRecordsIds): [];
that[ele.parentCode].push(ele);
};
// 设置 fieldParent
if (!!that.fieldParent.hasOwnProperty(ele.fieldCode)) {
ele.children = [];
that.fieldParent[ele.fieldCode] = ele;
ele.systemFlag = true;
}
})
},
formatDate(time,flag) {
const that = this
// (0-9)年月数字的显示
......@@ -222,9 +306,12 @@
watch: {
showCustomDialog: function(newData,oldData){
const that = this;
console.log("新数据:",newData,oldData)
that.customDialog = newData
},
datailData: function(newData,oldData){
const that = this;
that.checkList = !!newData && !!newData.length ? newData: [];
},
},
/* 接收数据 */
......
......@@ -10,7 +10,7 @@
<div class="login-wrap-body">
<div class="login-wrap-out">
<div class="login-wrap-inner">
<div class="login-wrap-inner__block" v-if="canSelectFlag">
<div class="login-wrap-inner__block" v-if="!canSelectFlag">
<div class="login-wrap-inner__head">扫码登录</div>
<div class="login-wrap-inner__body">
<!-- 二维码失效 -->
......@@ -23,7 +23,7 @@
</div>
</div>
<!-- 选择企业 -->
<div class="login-wrap-inner__block" v-if="!canSelectFlag">
<div class="login-wrap-inner__block" v-if="canSelectFlag">
<div class="login-wrap-inner__head">选择已有企业</div>
<div class="login-wrap-inner__selectBody">
<!-- <el-carousel :autoplay="false" arrow="always" height="100px">
......@@ -36,9 +36,12 @@
<!-- swiper -->
<swiper :options="swiperOption">
<!-- <div class="login-wrap-inner__swiperWrap"> -->
<swiper-slide v-for="item in enterpriseList" :key="item.id">
<img class="swiper-slide__img" :src="item.src" alt="src" />
<p class="swiper-slide__p">{{item.name}}</p>
<swiper-slide v-for="item in enterpriseList" :key="item.enterpriseId" >
<a :class="['swiper-cell',item.enterpriseId == enterpriseId? 'current-item': '']" @click="selectEnterprise(item.enterpriseId)">
<div class="img-bg"><img class="swiper-slide__img" :src="item.logoUrl" alt="src" /></div>
<p class="swiper-slide__p">{{item.enterpriseName}}</p>
</a>
</swiper-slide>
<!-- </div> -->
<!-- <div class="swiper-pagination" slot="pagination"></div> -->
......@@ -63,35 +66,44 @@ import 'swiper/dist/css/swiper.css'
import { swiper, swiperSlide } from 'vue-awesome-swiper'
import QRCode from 'qrcodejs2'
import showMsg from '@/common/js/showmsg';
import errMsg from '@/common/js/error';
import strLength from '@/common/js/strlen';
import { _debounce,formatDate } from "@/common/js/public";
import { getRequest, postRequest, postJson, postForm } from '@/api/api';
export default {
name: "login",
data() {
return {
qrcodeCase: '', // 二维码实例
qrcodeNum: '',
qrcodeNum: '', // 二维码数据
enterpriseId: '', // 当前选择的 企业 id
expiredFlag: false, // 二维码过期标志
canSelectFlag: true, // 能否选择企业标志
ajaxTime: null,
// 企业列表
enterpriseList:[
{
id: '1231',
src: require("../../assets/logo.png"),
name: '达摩网络'
enterpriseId : '1231',
logoUrl: require("../../assets/logo.png"),
enterpriseName: '达摩网络'
},
{
id: '1232',
src: require("../../assets/logo.png"),
name: '达摩网络2'
enterpriseId : '1232',
logoUrl: require("../../assets/logo.png"),
enterpriseName: '达摩网络2'
},
{
id: '1233',
src: require("../../assets/logo.png"),
name: '达摩网络'
enterpriseId : '1233',
logoUrl: require("../../assets/logo.png"),
enterpriseName: '达摩网络'
},
{
id: '1234',
src: require("../../assets/logo.png"),
name: '达摩网络2'
enterpriseId : '1234',
logoUrl: require("../../assets/logo.png"),
enterpriseName: '达摩网络2'
}
],
// swiper
......@@ -141,6 +153,14 @@ export default {
},
/**
* 选择企业
*/
selectEnterprise(id) {
const that = this;
that.enterpriseId = id;
},
/**
* 生成二维码
*/
qrcode (text) {
......@@ -165,7 +185,7 @@ export default {
const that = this;
document.getElementById("qrcode").innerHTML = '';
that.qrcodeCase.clear(); // 先清除原有的
that.qrcode(5666315956663159)
that.getQrcode()
that.expiredFlag = false; //隐藏过期遮罩层
},
......@@ -174,7 +194,7 @@ export default {
*/
toIndex() {
const that = this;
that.$router.push('/index')
that.toLogin();
},
/**
......@@ -183,7 +203,8 @@ export default {
toLogin() {
const that = this;
let para = {
qrcode: that.qrcodeNum
qrcode: that.qrcodeNum,
enterpriseId: that.enterpriseId
}
postRequest('/haoban-manage-web/login',para)
.then((res) => {
......@@ -191,6 +212,7 @@ export default {
var resData = res.data
if (resData.errorCode == 1) {
// showMsg.showmsg('保存成功','success')
that.$router.push('/index')
return;
}
errMsg.errorMsg(resData)
......@@ -213,12 +235,17 @@ export default {
let para = {
qrcode: that.qrcodeNum
}
postRequest('/haoban-manage-web/login-qrcode',para)
postRequest('/haoban-manage-web/login-check',para)
.then((res) => {
console.log( res.data)
var resData = res.data
if (resData.errorCode == 1) {
// showMsg.showmsg('保存成功','success')
if (!!resData.data && !!resData.data.length) {
that.enterpriseList = resData.data;
that.canSelectFlag = true
}
return;
}
errMsg.errorMsg(resData)
......@@ -233,6 +260,14 @@ export default {
});
},
checkScan() {
const that = this
that.ajaxTime = null;
that.ajaxTime = setInterval(function() {
that.checkLogin()
},5000)
},
/**
* 登录---获取二维码字符串 API
*/
......@@ -245,6 +280,8 @@ export default {
if (resData.errorCode == 1) {
// showMsg.showmsg('保存成功','success')
that.qrcodeNum = resData.qrcode;
that.qrcode(that.qrcodeNum)
that.checkScan()
return;
}
errMsg.errorMsg(resData)
......@@ -262,12 +299,12 @@ export default {
},
mounted() {
const that = this
that.getQrcode()
/**
*生成二维码
*/
that.qrcode(55555566767)
// that.qrcode(55555566767)
},
components: {
swiper,
......@@ -366,6 +403,7 @@ export default {
#qrcode {
width: 210px;
height: 210px;
margin: 0 auto;
}
}
......@@ -410,6 +448,30 @@ export default {
&__swiper {
margin-top: 30px;
.swiper-cell {
display: block;
-webkit-transform: scale(0.8);
-moz-transform: scale(0.8);
transform: scale(0.8);
cursor: pointer;
.img-bg {
padding: 8px 5px;
background: rgba(237,237,238,1);
border-radius: 8px;
text-align: center;
-webkit-box-sizing: border-box;
-moz-box-sizing: border-box;
box-sizing: border-box;
}
&.current-item {
-webkit-transform: scale(1);
-moz-transform: scale(1);
transform: scale(1);
}
}
.swiper-slide {
&__img {
width: 72px;
......@@ -424,7 +486,7 @@ export default {
}
.swiper-button-prev {
height: 97px;
margin-top: -55px;
margin-top: -61px;
left: 0;
padding-top: 55px;
background: #fff;
......@@ -436,7 +498,7 @@ export default {
}
.swiper-button-next {
height: 97px;
margin-top: -55px;
margin-top: -61px;
right: 0;
padding-top: 55px;
background: #fff;
......
......@@ -217,13 +217,13 @@ export default {
// info
applyInfo: {
photo: '',
applyName: '测试的',
sex: 2,
code: '223344545fffffffffffffff4',
phone: '13012343333',
job: '店长',
store: '测试门店'
// photo: '',
// applyName: '测试的',
// sex: 2,
// code: '223344545fffffffffffffff4',
// phone: '13012343333',
// job: '店长',
// store: '测试门店'
},
// store
......@@ -333,7 +333,7 @@ export default {
*/
getTableList(val) {
const that = this
const para = {
let para = {
auditingType: '',
auditingStatus: that.filterValue,
search: that.searchValue || '', // 搜索字段
......
......@@ -333,7 +333,7 @@ export default {
postApprove(ids) {
const that = this;
const para = {
let para = {
enterpriseAuditingId: ids
}
......@@ -363,7 +363,7 @@ export default {
postAllApprove(ids) {
const that = this;
const para = {
let para = {
enterpriseAuditingIds: ids
}
......@@ -407,7 +407,7 @@ export default {
postRefuse() {
const that = this;
const para = {
let para = {
enterpriseAuditingId: that.selectId,
refuseReason: that.ruleForm.refuseReason
}
......@@ -457,7 +457,7 @@ export default {
*/
getTableList(val) {
const that = this;
const para = {
let para = {
auditingType: that.filterValue,
auditingStatus: '0',
search: '', // 搜索字段
......
......@@ -99,6 +99,13 @@ export default {
},
methods: {
/**
* 路由跳转
*/
changeRoute(route) {
this.$router.push(route);
},
/**
* 保存
*/
submitForm: _debounce(function(formName) {
......@@ -118,7 +125,31 @@ export default {
*/
postSave() {
const that = this;
let para = {
}
postRequest('/haoban-manage-web/',para)
.then((res) => {
// console.log(res,res.data,res.data.errorCode)
var resData = res.data
if (resData.errorCode == 1) {
showMsg.showmsg('操作成功','success')
return;
}
errMsg.errorMsg(resData)
})
.catch(function (error) {
console.log(error);
that.$message.error({
duration: 1000,
message: error.message
})
});
},
/**
......
......@@ -8,7 +8,7 @@
<!-- <el-input v-model="ruleForm.name" disabled placeholder="" class="w-380"></el-input> -->
<limitInput
:inputWidth="500"
:inputValue.sync="ruleForm.name"
:inputValue.sync="ruleForm.roleName"
:holder="'请输入角色名称'"
:maxLength="20">
</limitInput>
......@@ -16,7 +16,7 @@
<el-form-item label="角色说明" prop="" class="">
<limitTextarea
:inputWidth="500"
:inputValue.sync="ruleForm.name"
:inputValue.sync="ruleForm.remark"
:holder="'请输入角色说明'"
:maxLength="50">
</limitTextarea>
......@@ -95,7 +95,9 @@ export default {
],
ruleForm: {
name: '企业管理员',
roleId: '',
roleName: '企业管理员',
remark: '角色说明',
leftChecked: [],
left: [
{
......@@ -187,7 +189,69 @@ export default {
*/
postSave() {
const that = this;
const para = {
data: '',
roleId: that.ruleForm.roleId,
roleName: that.ruleForm.roleName,
remark: that.ruleForm.remark
}
postRequest('/haoban-manage-web/save-role',para)
.then((res) => {
// console.log(res,res.data,res.data.errorCode)
var resData = res.data
if (resData.errorCode == 1) {
showMsg.showmsg('操作成功','success')
return;
}
errMsg.errorMsg(resData)
})
.catch(function (error) {
console.log(error);
that.$message.error({
duration: 1000,
message: error.message
})
});
},
/**
* 获取角色详情
*/
getRoleDetail(roleId) {
const that = this;
const para = {
roleId: roleId
}
postRequest('/haoban-manage-web/role-detail',para)
.then((res) => {
// console.log(res,res.data,res.data.errorCode)
var resData = res.data
if (resData.errorCode == 1) {
// showMsg.showmsg('操作成功','success')
that.ruleForm.roleId = resData.data.role.roleId;
that.ruleForm.roleName = resData.data.role.roleName;
that.ruleForm.roleCode = resData.data.role.roleCode;
that.ruleForm.remark = resData.data.role.remark;
return;
}
errMsg.errorMsg(resData)
})
.catch(function (error) {
console.log(error);
that.$message.error({
duration: 1000,
message: error.message
})
});
},
/**
......@@ -219,6 +283,11 @@ export default {
},
},
mounted() {
const that = this
console.log(that.$router.query)
if (that.$router.query.roleId) {
that.ruleForm.roleId = that.$router.query.roleId;
}
},
components: {
......
......@@ -5,7 +5,7 @@
<div class="right-box">
<div class="setChildAdmin-wrap-body flex">
<div class="setChildAdmin-wrap-left w-260" :style="{height: boxHeight}">
<div class="text-center"><el-button>新增管理员角色</el-button></div>
<div class="text-center"><el-button @click="changeRoute('/addAdminrole')">新增管理员角色</el-button></div>
<div class="m-t-20">
<ul>
<li v-for="(item,index) in adminRole" :key="index" :class="['role-cell',item.id == activeId? 'role-active':'']" @click.stop="selectRole(item.id)"><i class="iconfont icon-lizhi p-r-6"></i>{{item.name}}</li>
......@@ -14,7 +14,7 @@
</div>
<div class="setChildAdmin-wrap-right box-sizing">
<div class="role-title flex flex-between">
<span class="font-20 color-303133">{{roleRightObj.name}}</span><span class="font-14 color-1890ff" v-if="roleRightObj.auth==0">查看权限</span><span class="font-14 color-1890ff" v-if="roleRightObj.auth==1">编辑权限</span>
<span class="font-20 color-303133">{{roleRightObj.name}}</span><span class="font-14 color-1890ff pinter" v-if="roleRightObj.auth==0" @click="toRoleDetail">查看权限</span><span class="font-14 color-1890ff pinter" v-if="roleRightObj.auth==1" @click="toRoleDetail">编辑权限</span>
</div>
<div class="role-tip m-t-27 m-b-25">
<el-alert
......@@ -124,6 +124,15 @@ export default {
changeRoute(path) {
this.$router.push(path)
},
/**
* role 详情
*/
toRoleDetail() {
const that = this;
that.changeRoute(`/addAdminrole?roleId=${that.activeId}`)
},
/**
* 选择 role
*/
......@@ -182,6 +191,10 @@ export default {
vertical-align: middle;
}
.pinter {
cursor: pointer;
}
/* flex */
.flex {
display: -webkit-box;
......
......@@ -14,7 +14,7 @@
<template v-for="(item,index) in adminStruct.defineList">
<el-tag class="staffDetails-cell-btn">{{item.name}} <i class="el-icon-circle-close" @click.stop="delField(index,item,adminStruct.defineList)"></i></el-tag>
</template>
<el-button class="el-tag m-l-8 staffDetails-cell-btn" @click.stop="showDialogLayer('admin')"><i class="el-icon-plus"></i>添加字段</el-button>
<el-button class="el-tag m-l-8 staffDetails-cell-btn" @click.stop="showDialogLayer(1)"><i class="el-icon-plus"></i>添加字段</el-button>
</div>
</div>
<div class="staffDetails-cell">
......@@ -28,14 +28,14 @@
<template v-for="(item,index) in storeStruct.defineList">
<el-tag class="staffDetails-cell-btn">{{item.name}} <i class="el-icon-circle-close" @click.stop="delField(index,item,storeStruct.defineList)"></i></el-tag>
</template>
<el-button class="el-tag m-l-8 staffDetails-cell-btn" @click.stop="showDialogLayer('store')"><i class="el-icon-plus"></i>添加字段</el-button>
<el-button class="el-tag m-l-8 staffDetails-cell-btn" @click.stop="showDialogLayer(2)"><i class="el-icon-plus"></i>添加字段</el-button>
</div>
</div>
</div>
</div>
<vue-gic-footer></vue-gic-footer>
<!-- 自定义字段 -->
<staff-detail-field :showCustomDialog="showCustomDialog" @customHandleConfirm="customHandleConfirm"></staff-detail-field>
<staff-detail-field :datailData="datailData" :showCustomDialog="showCustomDialog" @customHandleConfirm="customHandleConfirm"></staff-detail-field>
</div>
</template>
<script>
......@@ -167,6 +167,7 @@ export default {
},
showCustomDialog: false, // 自定义弹框显示标志
datailData: [], // '类型:1行政架构,2门店架构'
}
},
computed: {
......@@ -176,9 +177,10 @@ export default {
/**
* 自定义弹窗显示事件
*/
showDialogLayer() {
showDialogLayer(type) {
const that = this
that.showCustomDialog = true;
that.detailType = type;
console.log(1)
},
......@@ -203,6 +205,38 @@ export default {
}).catch(() => {
});
},
/**
* 获取已经选择的字段
*/
getSaveFields(type) {
const that = this;
const para = {
type: type,// 类型:1行政架构,2门店架构'
}
postRequest('/haoban-manage-web/employee-show-field-detail.json',para)
.then((res) => {
// console.log(res,res.data,res.data.errorCode)
var resData = res.data
if (resData.errorCode == 1) {
showMsg.showmsg('操作成功','success')
return;
}
errMsg.errorMsg(resData)
})
.catch(function (error) {
console.log(error);
that.$message.error({
duration: 1000,
message: error.message
})
});
}
},
mounted() {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment