Commit 6f1d86da by wangyalan-git

用户管理,系统设置

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