Commit 6f1d86da by wangyalan-git

用户管理,系统设置

parent 72271050
......@@ -3,7 +3,14 @@
*/
import request from '@/utils/request'
// 管理员列表查询
export function getAdminList(params) {
return request({
url: 'manage/queryPageList',
method: 'get',
params
})
}
// 万科后台_用户分页操作
export function getMemberList(params) {
......
......@@ -165,16 +165,16 @@ export const asyncRouterMap = [
{
path: '/ums',
component: Layout,
redirect: '/ums/admin',
redirect: '/ums/role',
name: 'ums',
meta: { title: '权限', icon: 'ums' },
children: [
{
path: 'admin',
name: 'admin',
component: () => import('@/views/ums/admin/index'),
meta: { title: '用户列表', icon: 'ums-admin' }
},
// {
// path: 'admin',
// name: 'admin',
// component: () => import('@/views/ums/admin/index'),
// meta: { title: '用户列表', icon: 'ums-admin' }
// },
{
path: 'role',
name: 'role',
......
......@@ -124,54 +124,47 @@ export default {
}
},
methods: {
getDay(num, str) {
getDay(day) {
var today = new Date()
var nowTime = today.getTime()
var ms = 24 * 3600 * 1000 * num
today.setTime(parseInt(nowTime + ms))
var oYear = today.getFullYear()
var oMoth = (today.getMonth() + 1).toString()
if (oMoth.length <= 1) oMoth = '0' + oMoth
var oDay = today.getDate().toString()
if (oDay.length <= 1) oDay = '0' + oDay
return oYear + str + oMoth + str + oDay
},
formatDate(date) {
date = new Date(date)
let myyear = date.getFullYear()
let mymonth = date.getMonth() + 1
let myweekday = date.getDate()
mymonth < 10 ? mymonth = '0' + mymonth : mymonth
myweekday < 10 ? myweekday = '0' + myweekday : myweekday
return `${myyear}-${mymonth}-${myweekday}`
},
mGetDate() {
var date = new Date()
var year = date.getFullYear()
var month = date.getMonth() + 1
var d = new Date(year, month, 0)
return d.getDate()
},
getNowM(e) {
let now = new Date()
let current_month_num = this.mGetDate()
let current_month = []
for (let i = 1; i <= current_month_num; i++) {
let day = now.setDate(i)
let everyDay = this.formatDate(day)
current_month.push(everyDay)
var targetday_milliseconds = today.getTime() + 1000 * 60 * 60 * 24 * day
today.setTime(targetday_milliseconds) //注意,这行是关键代码
var tYear = today.getFullYear()
var tMonth = today.getMonth()
var tDate = today.getDate()
tMonth = this.doHandleMonth(tMonth + 1)
tDate = this.doHandleMonth(tDate)
console.log('tYear + \'-\' + tMonth + \'-\' + tDate',tYear + '-' + tMonth + '-' + tDate)
return tYear + '-' + tMonth + '-' + tDate
},
doHandleMonth(month) {
var m = month
if (month.toString().length == 1) {
m = '0' + month
}
console.log('current_month', current_month)
return current_month
},
getWeekDay() {
let that = this
let dateString = that.formatDate(new Date())//当天的日期,例如2020-2-28
let presentDate = new Date(dateString)
let today = presentDate.getDay() !== 0 ? presentDate.getDay() : 7
return Array.from(new Array(7), function (val, index) {
return that.formatDate(new Date(presentDate.getTime() - (today - index - 1) * 24 * 60 * 60 * 1000))
})
return m
},
formatEveryDay() {
let start1 = this.getDay(-7)
let end1 = this.getDay(0)
console.log('start1','end1',start1,end1)
let dateList = []
var startTime = this.getDate(start1)
var endTime = this.getDate(end1)
while ((endTime.getTime() - startTime.getTime()) >= 0) {
var year = startTime.getFullYear()
var month = startTime.getMonth() + 1 < 10 ? '0' + (startTime.getMonth() + 1) : startTime.getMonth() + 1
var day = startTime.getDate().toString().length == 1 ? '0' + startTime.getDate() : startTime.getDate()
dateList.push(year + '-' + month + '-' + day)
startTime.setDate(startTime.getDate() + 1)
}
console.log('dateList',dateList)
return dateList
},
getDate(datestr) {
var temp = datestr.split('-')
var date = new Date(temp[0], temp[1] - 1, temp[2])
console.log('date', date)
return date
},
handleOpenCate(visible) {
if (visible) {
......@@ -206,11 +199,11 @@ export default {
},
getList() {
if(!this.listQuery.goodsId){
if (!this.listQuery.goodsId) {
this.$message.warning('请选择物品')
return
}
getInventoryList({ dateList: this.getWeekDay(), goodsId: this.listQuery.goodsId }).then(res => {
getInventoryList({ dateList: this.formatEveryDay(), goodsId: this.listQuery.goodsId }).then(res => {
this.chartData.rows = res.data
console.log('res', this.chartData)
})
......
......@@ -124,54 +124,47 @@ export default {
}
},
methods: {
getDay(num, str) {
getDay(day) {
var today = new Date()
var nowTime = today.getTime()
var ms = 24 * 3600 * 1000 * num
today.setTime(parseInt(nowTime + ms))
var oYear = today.getFullYear()
var oMoth = (today.getMonth() + 1).toString()
if (oMoth.length <= 1) oMoth = '0' + oMoth
var oDay = today.getDate().toString()
if (oDay.length <= 1) oDay = '0' + oDay
return oYear + str + oMoth + str + oDay
},
formatDate(date) {
date = new Date(date)
let myyear = date.getFullYear()
let mymonth = date.getMonth() + 1
let myweekday = date.getDate()
mymonth < 10 ? mymonth = '0' + mymonth : mymonth
myweekday < 10 ? myweekday = '0' + myweekday : myweekday
return `${myyear}-${mymonth}-${myweekday}`
},
mGetDate() {
var date = new Date()
var year = date.getFullYear()
var month = date.getMonth() + 1
var d = new Date(year, month, 0)
return d.getDate()
},
getNowM(e) {
let now = new Date()
let current_month_num = this.mGetDate()
let current_month = []
for (let i = 1; i <= current_month_num; i++) {
let day = now.setDate(i)
let everyDay = this.formatDate(day)
current_month.push(everyDay)
var targetday_milliseconds = today.getTime() + 1000 * 60 * 60 * 24 * day
today.setTime(targetday_milliseconds) //注意,这行是关键代码
var tYear = today.getFullYear()
var tMonth = today.getMonth()
var tDate = today.getDate()
tMonth = this.doHandleMonth(tMonth + 1)
tDate = this.doHandleMonth(tDate)
console.log('tYear + \'-\' + tMonth + \'-\' + tDate',tYear + '-' + tMonth + '-' + tDate)
return tYear + '-' + tMonth + '-' + tDate
},
doHandleMonth(month) {
var m = month
if (month.toString().length == 1) {
m = '0' + month
}
console.log('current_month', current_month)
return current_month
},
getWeekDay() {
let that = this
let dateString = that.formatDate(new Date())//当天的日期,例如2020-2-28
let presentDate = new Date(dateString)
let today = presentDate.getDay() !== 0 ? presentDate.getDay() : 7
return Array.from(new Array(7), function (val, index) {
return that.formatDate(new Date(presentDate.getTime() - (today - index - 1) * 24 * 60 * 60 * 1000))
})
return m
},
formatEveryDay() {
let start1 = this.getDay(-7)
let end1 = this.getDay(0)
console.log('start1','end1',start1,end1)
let dateList = []
var startTime = this.getDate(start1)
var endTime = this.getDate(end1)
while ((endTime.getTime() - startTime.getTime()) >= 0) {
var year = startTime.getFullYear()
var month = startTime.getMonth() + 1 < 10 ? '0' + (startTime.getMonth() + 1) : startTime.getMonth() + 1
var day = startTime.getDate().toString().length == 1 ? '0' + startTime.getDate() : startTime.getDate()
dateList.push(year + '-' + month + '-' + day)
startTime.setDate(startTime.getDate() + 1)
}
console.log('dateList',dateList)
return dateList
},
getDate(datestr) {
var temp = datestr.split('-')
var date = new Date(temp[0], temp[1] - 1, temp[2])
console.log('date', date)
return date
},
handleOpenCate(visible) {
if (visible) {
......@@ -210,7 +203,7 @@ export default {
this.$message.warning('请选择物品')
return
}
getRecipientList({ dateList: this.getWeekDay(), goodsId: this.listQuery.goodsId }).then(res => {
getRecipientList({ dateList: this.formatEveryDay(), goodsId: this.listQuery.goodsId }).then(res => {
this.chartData.rows = res.data
})
},
......
......@@ -15,16 +15,18 @@
<el-button type="primary"
@click="handleSearchList"
icon="el-icon-search"
size="small">搜索</el-button>
size="small">搜索
</el-button>
<el-button @click="handleResetSearch"
icon="el-icon-refresh"
size="small">重置</el-button>
size="small">重置
</el-button>
</el-form-item>
<!-- <el-button class="btn-add"-->
<!-- size="small"-->
<!-- type="primary"-->
<!-- @click="handleAdd">添加管理员-->
<!-- </el-button>-->
<!-- <el-button class="btn-add"-->
<!-- size="small"-->
<!-- type="primary"-->
<!-- @click="handleAdd">添加管理员-->
<!-- </el-button>-->
</el-form>
</el-card>
<!-- 表格栏 -->
......@@ -40,34 +42,32 @@
width="50"></el-table-column>
<el-table-column label="姓名"
align="center">
<template slot-scope="scope">{{scope.row.username}}</template>
<template slot-scope="scope">{{scope.row.name}}</template>
</el-table-column>
<el-table-column label="AD用户"
align="center">
<template slot-scope="scope">{{scope.row.phone || '--'}}</template>
<template slot-scope="scope">{{scope.row.departName || '--'}}</template>
</el-table-column>
<el-table-column label="部门"
align="center">
<template slot-scope="scope">{{scope.row.email || '--'}}</template>
<template slot-scope="scope">{{scope.row.departName || '--'}}</template>
</el-table-column>
<el-table-column label="所属库房"
align="center">
<template slot-scope="scope">{{scope.row.createDate | formatTime}}</template>
<template slot-scope="scope">{{scope.row.stockRoomName}}</template>
</el-table-column>
<el-table-column label="联系方式"
align="center">
<template slot-scope="scope">{{scope.row.status | formatStatus}}</template>
<template slot-scope="scope">{{scope.row.phone}}</template>
</el-table-column>
<el-table-column label="操作"
width="220"
align="center">
<template slot-scope="scope">
<!-- <el-button size="mini"-->
<!-- type="success"-->
<!-- @click="addDepot(scope.row)">添加库房</el-button>-->
<el-button size="mini"
type="success"
@click="lookDetail(scope.row)">删除</el-button>
@click="handleDelete(scope.row.id)">解绑
</el-button>
</template>
</el-table-column>
</el-table>
......@@ -85,46 +85,28 @@
</el-pagination>
</div>
</el-card>
<!-- end -->
<!-- 弹窗 -->
<add-depot ref="addDepot"
@ok="getList"></add-depot>
<!-- end -->
</div>
</template>
<script>
import moment from 'moment'
import { getSupplier, getAuditDetail, updateMcht } from '@/api/admin'
import { getAdminList, cancleAdmin } from '@/api/user'
import AddDepot from './modules/AddAdmin'
// 列表查询参数默认值
const defaultListQuery = {
pageNum: 1,
pageSize: 10,
accouuntType: 0,
name: '',
phone: '',
status: ''
condition: 0,
roleId: '',
departId: ''
}
// 账号状态数据
const defaultStatusOptions = [
{
label: '启用',
value: 1
},
{
label: '禁用',
value: 0
}
]
// 管理员入驻账号列表
export default {
name: 'AdminList',
components: {AddDepot},
components: { AddDepot },
data() {
return {
listQuery: Object.assign({}, defaultListQuery),
statusOptions: defaultStatusOptions,
list: [],
total: 0,
listLoading: false,
......@@ -140,18 +122,11 @@ export default {
return '--'
}
return moment(time).format('YYYY-MM-DD HH:mm:ss')
},
formatStatus(status) {
if (status == 0) {
return '禁用'
} else {
return '启用'
}
}
},
methods: {
// 添加管理员
handleAdd () {
handleAdd() {
this.$refs.addSupplier.add()
},
handleResetSearch() {
......@@ -178,7 +153,7 @@ export default {
getList() {
this.listLoading = true
//请求数据
getSupplier(this.listQuery).then(res => {
getAdminList(this.listQuery).then(res => {
this.listLoading = false
this.list = res.data.list
this.total = res.data.total
......@@ -186,13 +161,18 @@ export default {
this.listLoading = false
})
},
// 查看
addDepot(row) {
this.$refs.addDepot.add()
},
//编辑
editDetail(id) {
this.$refs.addSupplier.detail(id)
// 删除
handleDelete(id) {
this.$confirm('是否取消管理员权限?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
cancleAdmin({ id: id, deleteStatus: 1 }).then(res => {
this.getList()
})
}).catch(() => {
})
}
}
}
......
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