Commit f92e42f9 by 无尘

add: 增加首页接口

parent 472d9116
......@@ -6,7 +6,12 @@
</div>
<div class="custom-dialog__checkbox">
<el-checkbox-group v-model="checkList" @change="customChange" :max="8">
<el-checkbox v-for="item in customData" :label="item.id" :key="item.id" name="type">{{item.name}}</el-checkbox>
<template v-if="customType === 'data'">
<el-checkbox v-for="item in customData" :label="item.dataViewId" :key="item.dataViewId" name="type">{{item.fieldTitle}}</el-checkbox>
</template>
<template v-if="customType != 'data'">
<el-checkbox v-for="item in customData" :label="item.settingViewId" :key="item.settingViewId" name="type">{{item.fieldTitle}}</el-checkbox>
</template>
</el-checkbox-group>
</div>
<div slot="footer" class="dialog-footer">
......@@ -20,14 +25,17 @@
import { getRequest, postRequest, postJsonRequest } from '@/api/api';
import showMsg from '@/common/js/showmsg';
import errMsg from '@/common/js/error';
import qs from 'qs';
export default {
name: 'custom-dialog',
props: {
showCustomDialog: {
type: Boolean,
default: false
}
},
customType: {
type: String,
default: ''
},
},
data () {
return {
......@@ -35,120 +43,78 @@
customDialog: false, // 弹框显示
// 复选框数据
customData: [
{
id: 1,
name: "通讯录行政架构",
},
{
id: 2,
name: "通讯录门店架构",
},
{
id: 3,
name: "员工档案",
},
{
id: 4,
name: "共享通讯录",
},
{
id: 5,
name: "企业应用",
},
{
id: 6,
name: "我的企业",
},
{
id: 7,
name: "企业地址",
},
{
id: 8,
name: "企业认证设置",
},
{
id: 9,
name: "员工详情设置",
},
{
id: 10,
name: "门店权限设置",
},
{
id: 11,
name: "设置子管理员",
},
{
id: 12,
name: "更换超级管理员",
},
{
id: 13,
name: "行政架构添加部门",
},
// {
// dataViewId: 1,
// fieldTitle: "通讯录行政架构",
// homeDisplay: true
// }
],
checkList: [], //已选数据
// 获取 location origin
baseUrl: '',
}
},
beforeMount() {
var that = this
var host = window.location.origin;
console.log("当前host:",host)
if (host.indexOf('localhost') != '-1') {
that.baseUrl = 'http://gicdev.demogic.com';
}else {
that.baseUrl = host
}
},
methods:{
// 关闭
/**
* 关闭
*/
handleCardClose() {
var that = this;
const that = this;
that.customCancel();
},
// 取消
/**
* 取消
*/
customCancel() {
var that = this;
const that = this;
that.customDialog = false
that.$emit('customHandleConfirm')
},
// 确定
/**
* 确定
*/
customConfirm() {
var that = this
that.$emit('customHandleConfirm')
const that = this
if (!that.checkList.length) {
that.$message.error({
duration: 1000,
message: '请选择操作'
})
return false;
}
that.setData(that.checkList)
},
// 复选框选择事件
/**
* 复选框选择事件
*/
customChange(value) {
var that = this
const that = this
console.log(value)
},
// 获取已经勾选
getCardList() {
var that = this
var para = {
requestProject: that.repProjectName
/**
* 设置首页数据概览显示项
*/
setData(list) {
const that = this
let para = {
viewIdList: JSON.stringify(list)
}
that.axios.post(that.baseUrl+'/api-plug/get-coupon-list',qs.stringify(para))
let url = that.customType == 'data'? '/haoban-manage-web/home/set-display-enterprise-data':'/haoban-manage-web/home/set-display-quick-entry';
postRequest(url,para)
.then((res) => {
console.log(res,res.data,res.data.errorCode)
var resData = res.data
if (resData.errorCode == 0) {
let resData = res.data
if (resData.errorCode == 1) {
that.$emit('customHandleConfirm')
return;
}
that.$message.error({
duration: 1000,
message: resData.message
})
errMsg.errorMsg(resData)
})
.catch(function (error) {
......@@ -161,32 +127,64 @@
});
},
formatDate(time,flag) {
var that = this
// (0-9)年月数字的显示
function formatDig(num) {
return num > 9 ? '' + num : '0' + num;
/**
* 获取 设置首页数据概览显示项
*/
getCardList() {
const that = this
let para = {
all: true
}
var myDate = new Date(time);
let y = myDate.getFullYear();
let m = myDate.getMonth()+1;
let d = myDate.getDate();
return y + flag + formatDig(m) + flag + formatDig(d) + flag
}
that.customType == 'data'? (para.fetchData = false) : '';
// 判断企业数据概览
let url = that.customType == 'data'? '/haoban-manage-web/home/find-enterprise-data':'/haoban-manage-web/home/find-quick-entry';
that.checkList = [];
postRequest(url,para)
.then((res) => {
console.log(res,res.data,res.data.errorCode)
let resData = res.data
if (resData.errorCode == 1) {
let selList = []
resData.result.forEach(function(ele,index){
if (!!ele.homeDisplay) {
that.customType == 'data'?selList.push(ele.dataViewId):selList.push(ele.settingViewId)
}
})
that.customData = resData.result;
that.checkList = selList;
return;
}
errMsg.errorMsg(resData)
})
.catch(function (error) {
console.log(error);
// that.toLogin()
that.$message.error({
duration: 1000,
message: error.message
})
});
},
},
watch: {
showCustomDialog: function(newData,oldData){
var that = this;
console.log("新数据:",newData,oldData)
const that = this;
that.customDialog = newData
},
customType: function(newData,oldData){
const that = this;
if (!!newData) {
that.getCardList()
}
}
},
/* 接收数据 */
mounted(){
console.log("传递的参数对象:",this.showCustomDialog)
var that = this;
const that = this;
that.customDialog = that.showCustomDialog
},
......
......@@ -64,7 +64,7 @@ export default {
that.baseUrl = host
}
that.upUrl = that.baseUrl + '/api-plug/upload-img?wxFlag=1'
// that.upUrl = that.baseUrl + '/api-plug/upload-img?wxFlag=1'
},
methods: {
/**
......@@ -76,12 +76,12 @@ export default {
let baseUrl;
console.log("当前host:",host)
if (host.indexOf('localhost') != '-1') {
baseUrl = 'http://gicdev.demogic.com';
baseUrl = 'http://www.gicdev.com';
}else {
baseUrl = host
}
that.upUrl = baseUrl + '/api-plug/upload-img?wxFlag=1&requestProject=gic-clique'
that.upUrl = baseUrl + '/haoban-manage-web/upload-img'
console.log(that.upUrl)
return that.upUrl
},
......
......@@ -159,7 +159,7 @@ export default {
countyId: ''
},
upUrl: '',// 上传地址
upUrl: 'upload-img',// 上传地址
baseUrl: '',
}
},
......
......@@ -8,7 +8,7 @@
<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>
<li v-for="(item,index) in adminRole" :key="index" :class="['role-cell',item.roleId == activeId? 'role-active':'']" @click.stop="selectRole(item.roleId)"><i class="iconfont icon-lizhi p-r-6"></i>{{item.roleName}}</li>
</ul>
</div>
</div>
......@@ -46,6 +46,18 @@
label="部门">
</el-table-column>
</el-table>
<div class="block common-wrap__page text-right" v-if="tableData.length!=0">
<el-pagination
background
@size-change="handleSizeChange"
@current-change="handleCurrentChange"
:current-page="currentPage"
:page-sizes="[10, 20, 30, 40]"
:page-size="pageSize"
layout="total, sizes, prev, pager, next, jumper"
:total="total">
</el-pagination>
</div>
</div>
</div>
</div>
......@@ -87,16 +99,22 @@ export default {
boxHeight: window.screen.availHeight + 'px',
activeId: 1,
adminRole: [
{
id: '1',
name: '超级管理员'
},
{
id: '2',
name: '企业管理员'
}
],
// roleListData: [
// {
// roleParentName: '集团',
adminRole: [
// {
// roleId: '1',
// roleName: '超级管理员'
// },
// {
// roleId: '2',
// roleName: '企业管理员'
// }
],
// }
// ],
roleRightObj: {
name: '超级管理员',
......@@ -111,7 +129,11 @@ export default {
phone: '13333333333',
depart: '技术部'
}
]
],
// 分页参数
currentPage: 1,
pageSize: 20,
total: 0,
}
},
computed: {
......@@ -139,27 +161,119 @@ export default {
selectRole(id) {
const that = this;
that.activeId = id
that.getRoleUsers();
},
/**
* 请求角色---api
* 添加成员
*/
postRole() {
toAddRole() {
const that = this;
that.changeRoute(`/addAdmin?roleId=${that.activeId}`);
},
/**
* 分页---页码变化
*/
handleSizeChange(val) {
const that = this;
that.pageSize = val;
that.getRoleUsers();
},
/**
* 添加成员
* 分页---当前页变化
*/
toAddRole() {
handleCurrentChange(val) {
const that = this;
that.changeRoute(`/addAdmin?roleId=${that.activeId}`);
that.currentPage = val;
that.getRoleUsers();
},
/**
* 获取角色用户数据
*/
getRoleUsers() {
const that = this;
let para = {
roleId: that.activeId,
pageSize: that.pageSize,
pageNum: that.currentPage
}
postRequest('/haoban-manage-web/role-user-list',para)
.then((res) => {
// console.log(res,res.data,res.data.errorCode)
var resData = res.data;
if (resData.errorCode == 1) {
// showMsg.showmsg('操作成功','success')
if(!resData.result || !resData.result.result){
that.$message.error({
duration: 1000,
message: '暂无数据'
})
return false;
}
that.tableData = resData.result.result;
that.total = resData.result.totalCount;
return;
}
errMsg.errorMsg(resData)
})
.catch(function (error) {
console.log(error);
that.$message.error({
duration: 1000,
message: error.message
})
});
},
/**
* 获取角色数据
*/
getRoles() {
const that = this;
let para = {
}
postRequest('/haoban-manage-web/role-list',para)
.then((res) => {
// console.log(res,res.data,res.data.errorCode)
var resData = res.data;
if (resData.errorCode == 1) {
// showMsg.showmsg('操作成功','success')
that.adminRole = resData.result;
if (!!resData.result && !!resData.result.length) {
that.activeId = that.adminRole[0].roleId;
that.getRoleUsers()
}
return;
}
errMsg.errorMsg(resData)
})
.catch(function (error) {
console.log(error);
that.$message.error({
duration: 1000,
message: error.message
})
});
}
},
mounted() {
const that = this;
that.boxHeight = (window.screen.availHeight - 430) + 'px'
that.boxHeight = (window.screen.availHeight - 430) + 'px';
that.getRoles();
},
components: {
navCrumb
......@@ -293,6 +407,10 @@ export default {
margin-top: 27px;
}
.common-wrap__page {
margin-top: 24px;
}
.right-content {
/*width: 100%;*/
padding: 24px;
......
......@@ -276,6 +276,18 @@
<div class="fontclass">.icon-yewuduanmorentouxian</div>
</li>
<li>
<i class="icon iconfont icon-qiyerenzheng1"></i>
<div class="name">renzhengzhong</div>
<div class="fontclass">.icon-qiyerenzheng1</div>
</li>
<li>
<i class="icon iconfont icon-qiyerenzheng2"></i>
<div class="name">renzhengshibai</div>
<div class="fontclass">.icon-qiyerenzheng2</div>
</li>
</ul>
<h2 id="font-class-">font-class引用</h2>
......
......@@ -379,6 +379,22 @@
<div class="fontclass">#icon-yewuduanmorentouxian</div>
</li>
<li>
<svg class="icon" aria-hidden="true">
<use xlink:href="#icon-qiyerenzheng1"></use>
</svg>
<div class="name">renzhengzhong</div>
<div class="fontclass">#icon-qiyerenzheng1</div>
</li>
<li>
<svg class="icon" aria-hidden="true">
<use xlink:href="#icon-qiyerenzheng2"></use>
</svg>
<div class="name">renzhengshibai</div>
<div class="fontclass">#icon-qiyerenzheng2</div>
</li>
</ul>
......
......@@ -296,6 +296,18 @@
<div class="code">&amp;#xe7a3;</div>
</li>
<li>
<i class="icon iconfont">&#xe7b0;</i>
<div class="name">renzhengzhong</div>
<div class="code">&amp;#xe7b0;</div>
</li>
<li>
<i class="icon iconfont">&#xe7b1;</i>
<div class="name">renzhengshibai</div>
<div class="code">&amp;#xe7b1;</div>
</li>
</ul>
<h2 id="unicode-">unicode引用</h2>
<hr>
......
No preview for this file type
This source diff could not be displayed because it is too large. You can view the blob instead.
......@@ -152,6 +152,12 @@ Created by iconfont
<glyph glyph-name="yewuduanmorentouxian" unicode="&#59299;" d="M506.368 365.056c146.944 0 266.24 117.76 266.24 262.656s-119.296 262.656-266.24 262.656-266.24-117.76-266.24-262.656 119.296-262.656 266.24-262.656z m105.984-46.592h-199.68c-185.344 0-335.872-148.48-335.872-331.264v-19.968C76.8-128 225.28-128 412.672-128h199.168c180.224 0 335.872 0 335.872 95.232v19.968c0.512 182.272-150.528 331.264-335.36 331.264z" horiz-adv-x="1024" />
<glyph glyph-name="qiyerenzheng1" unicode="&#59312;" d="M860.672 528.896V733.184h-204.288L512 877.568 367.616 733.184h-204.8v-204.8L18.432 384l144.384-144.896v-204.288h204.8l144.384-144.384 144.896 145.408h204.288v204.288l144.384 144.384-144.896 144.384zM384 341.504H298.496V426.496H384v-84.992z m170.496 0H469.504V426.496h85.504v-84.992z m171.008 0H640V426.496h85.504v-84.992z" horiz-adv-x="1024" />
<glyph glyph-name="qiyerenzheng2" unicode="&#59313;" d="M860.672 528.896V733.184h-204.288L512 877.568 367.616 733.184h-204.8v-204.8L18.432 384l144.384-144.896v-204.288h204.8l144.384-144.384 144.896 145.408h204.288v204.288l144.384 144.384-144.896 144.384z m-302.592-373.76H476.16v81.92h81.92v-81.92z m3.072 326.656l-20.992-216.576h-46.08l-21.504 216.576V582.144h88.576v-100.352z" horiz-adv-x="1024" />
</font>
......
No preview for this file type
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