Commit 521873f2 by liimin

增加全局loading状态 所有table的加载状态和按钮的加载状态都可使用

1 parent fc381015
......@@ -12,12 +12,11 @@ import qs from 'qs'
axios.defaults.withCredentials = true
const expiresMinute = 60 // 过期时间(分钟)
// 创建一个错误
function errorCreate(msg) {
export function errorCreate(msg) {
const error = new Error(msg)
errorLog(error)
throw error
}
// 记录和显示错误
function errorLog(error) {
// 添加到日志
......@@ -59,6 +58,7 @@ service.interceptors.request.use(
url,
params
} = config
await store.commit('d2admin/loading/set', true)
const uuid = util.cookies.get('uuid')
// 如果请求链接不在排除列表 (排除列表: 登录 基础数据) 并且cookie 过期(判断是否长时间未操作)
if (!LogExternals.some(u => u === url || (params && u === params.method)) && !uuid) {
......@@ -75,6 +75,7 @@ service.interceptors.request.use(
})
},
error => {
store.commit('d2admin/loading/set', false)
// 发送失败
console.log(error)
Promise.reject(error)
......@@ -83,6 +84,7 @@ service.interceptors.request.use(
// 响应拦截器
service.interceptors.response.use(
response => {
store.commit('d2admin/loading/set', false)
// dataAxios 是 axios 返回数据中的 data
const dataAxios = response.data
// 这个状态码是和后端约定的
......
......@@ -23,7 +23,7 @@ export default {
// token 代表用户当前登录状态 建议在网络请求中携带 token
// 如有必要 token 需要定时更新,默认保存一天
util.cookies.set('uuid', data.loginName)
const authes = (+data.roleType === +SUPPER_ADMIN)
const authes = (+data.roleType === SUPPER_ADMIN)
? util.permision.flatten(Object.values(localRoutes))
.map(obj => ({ authId: obj.authId, parentId: obj.parentId }))
: _.cloneDeep(data.authes)
......
......@@ -2,7 +2,7 @@
* @Author: limin
* @Date: 2019-08-27 17:25:12
* @Last Modified by: limin
* @Last Modified time: 2019-09-08 12:48:44
* @Last Modified time: 2019-09-14 17:28:39
*/
import util from '@/libs/util.js'
import router from '@/router'
......@@ -20,21 +20,21 @@ export default {
* @description 返回当前登录用户权限资源
* @param {Object} state state
*/
source(state, dispatch) {
source(state) {
return state.source
},
/**
* @description 返回当前页面meta
* @param {Object} state state
*/
meta(state, dispatch) {
meta(state) {
return state.meta
},
/**
* @description 当前角色拥有的所有按钮
* @param {Object} state state
*/
btns(state, dispatch) {
btns(state) {
return state.btns
},
/**
......@@ -70,7 +70,7 @@ export default {
* @description 保存当前角色权限资源
* @param {obj} source 需要保存的权限资源
*/
set({ state, commit, dispatch }, source) {
set({ state, dispatch }, source) {
return new Promise(async resolve => {
// 检查这个主题在主题列表里是否存在
state.source = source
......@@ -84,7 +84,7 @@ export default {
* @description 保存当前角色权限资源
* @param {obj} source 需要保存的权限资源
*/
setCurrentPageMeta({ state, commit, dispatch }, meta) {
setCurrentPageMeta({ state }, meta) {
return new Promise(async resolve => {
state.meta = meta
// end
......@@ -95,7 +95,7 @@ export default {
* @description 从持久化数据加载资源数据
* @param {Object} context
*/
load({ state, commit, dispatch }) {
load({ state, dispatch }) {
return new Promise(async resolve => {
if (!state.source) {
state.source = await dispatch('d2admin/db/get', {
......@@ -112,33 +112,44 @@ export default {
* 过滤并初始化路由与左侧菜单栏
* @param {*} param0
*/
init({ state, commit, dispatch }) {
init({ state, dispatch }) {
return new Promise(async resolve => {
// 获取权限资源点
const __source = await dispatch('load')
await dispatch('_initRoutes', __source)
await dispatch('_initByRole', __source)
// end
resolve(state.source)
})
},
_initRoutes({ state }, source) {
return new Promise(async resolve => {
try {
// 获取权限资源点
const __source = await dispatch('load')
// 过滤资源点 并动态添加到路由
const { route, btn } = util.permision.packRoutesBtns(localRoutes, __source)
const { route, btn } = util.permision.packRoutesBtns(localRoutes, source)
frameInRoutes[0].children = [...route, ...sys]
router.addRoutes(frameInRoutes)
state.btns = btn
await commit('d2admin/page/init', frameInRoutes, { root: true })
const __aMenus = util.permision.packAsideMenus(localRoutes, __source)
// 过滤左侧菜单栏
await commit('d2admin/menu/asideSet', __aMenus, { root: true })
// 初始化页面搜索
await commit('d2admin/search/init', __aMenus, { root: true })
} catch (error) {
if (error.message === '参数错误' && !await dispatch('load')) {
if (error.message === '参数错误' && !source) {
router.replace('/login')
return false
}
}
// end
resolve(state.source)
resolve()
})
},
_initByRole({ commit }, source) {
return new Promise(async resolve => {
const __aMenus = util.permision.packAsideMenus(localRoutes, source)
await commit('d2admin/page/init', frameInRoutes, { root: true })
await commit('d2admin/menu/asideSet', __aMenus, { root: true })
await commit('d2admin/search/init', __aMenus, { root: true })
// end
resolve()
})
}
},
mutations: {
}
}
/*
* @Author: limin
* @Date: 2019-09-15 17:34:41
* @Last Modified by: limin
* @Last Modified time: 2019-09-15 18:00:13
*/
export default {
namespaced: true,
state: {
// 加载中...
value: false
},
getters: {
/**
* 返回当前加载状态
* @param {*} state
*/
loading(state) {
return state.value
}
},
mutations: {
/**
* @description 设置加载中
* @param {Object} state state
* @param {Boolean} loading loading
*/
set(state, loading) {
return new Promise(resolve => {
console.log(loading)
state.value = loading
resolve()
})
}
}
}
......@@ -93,6 +93,7 @@
<el-button
type="primary"
@click="handleConfirm"
:loading="$store.state.d2admin.loading.value"
>保存</el-button>
<el-button
@click="handleClose"
......
......@@ -8,42 +8,54 @@
slot="header"
>
<el-form-item label="物料">
<el-input v-model="searchForm.keyWord" placeholder="请输入物料代码/编码/名称" @clear="loadingGetList" clearable></el-input>
<el-input
v-model="searchForm.keyWord"
placeholder="请输入物料代码/编码/名称"
@clear="loadingGetList"
clearable
></el-input>
</el-form-item>
<el-form-item label="所在地">
<el-select v-model="searchForm.stationCode" placeholder="请选择所在地" @clear="loadingGetList" clearable filterable>
<el-option
<el-select
v-model="searchForm.stationCode"
placeholder="请选择所在地"
@clear="loadingGetList"
clearable
filterable
>
<el-option
v-for="(item, index) in baseData.station"
:key="index"
:value="item.confCode"
:label="item.confValue"
></el-option>
</el-select>
></el-option>
</el-select>
</el-form-item>
<el-form-item>
<el-button type="primary" icon="el-icon-search" @click="handleSearch">查询</el-button>
<el-button
type="primary"
icon="el-icon-search"
@click="handleSearch"
>查询</el-button>
</el-form-item>
</el-form>
<d2-table-header title="物料列表">
<span style="margin-right: 10px;">
<auth-button
label="导出"
></auth-button>
</span>
<auth-button
label="导入"
>
<input
type="file"
id="fileUpload"
class="import-input"
accept=".csv, application/vnd.ms-excel, application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"
@change="importFile($event)" />
</auth-button>
<auth-button label="导出"></auth-button>
</span>
<auth-button label="导入">
<input
type="file"
id="fileUpload"
class="import-input"
accept=".csv, application/vnd.ms-excel, application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"
@change="importFile($event)"
/>
</auth-button>
</d2-table-header>
<el-table
:data="tableData"
v-loading="tableLoading"
v-loading="$store.state.d2admin.loading.value"
border
:highlight-current-row="true"
:stripe="true"
......@@ -100,10 +112,16 @@
import axios from 'axios'
import EditDialog from './editDialog'
import { BaseData } from '@/common/constants'
import { getListApi, editApi, removeApi, exportApi } from '@api/deviceManagement'
import {
getListApi,
editApi,
removeApi,
exportApi
} from '@api/deviceManagement'
import notice from '@/common/notice'
import qs from 'qs'
import sign from '@api/sign'
import { errorCreate } from '@/plugin/axios'
export default {
name: 'fimsDeviceManagement',
components: {
......@@ -132,43 +150,52 @@ export default {
stationCode: ''
},
// 表格
tableLoading: false,
tableData: [],
tableColumns: [{
label: '物料代码',
prop: 'deviceNum'
}, {
label: '物料编码',
prop: 'deviceCode',
width: '140'
}, {
label: 'CRC物料号',
prop: 'crcCode',
width: '140'
}, {
label: '图号',
prop: 'drawNum',
width: '200'
}, {
label: '物料名称',
prop: 'deviceName',
width: '200'
}, {
label: '规格',
prop: 'specifications',
width: '140'
}, {
label: '所在地',
prop: 'stationName',
width: '120'
}, {
label: '库存',
prop: 'stockCount',
width: '100'
}, {
label: '责任人',
prop: 'responsible'
}],
tableColumns: [
{
label: '物料代码',
prop: 'deviceNum'
},
{
label: '物料编码',
prop: 'deviceCode',
width: '140'
},
{
label: 'CRC物料号',
prop: 'crcCode',
width: '140'
},
{
label: '图号',
prop: 'drawNum',
width: '200'
},
{
label: '物料名称',
prop: 'deviceName',
width: '200'
},
{
label: '规格',
prop: 'specifications',
width: '140'
},
{
label: '所在地',
prop: 'stationName',
width: '120'
},
{
label: '库存',
prop: 'stockCount',
width: '100'
},
{
label: '责任人',
prop: 'responsible'
}
],
// 页码
currentPage: 1,
pageSize: 10,
......@@ -187,12 +214,14 @@ export default {
methods: {
async loadBaseData() {
const data = await this.$store.dispatch('d2admin/base/get', BaseData.STATION.KEY)
const data = await this.$store.dispatch(
'd2admin/base/get',
BaseData.STATION.KEY
)
this.baseData.station = data
},
loadingGetList() {
this.tableLoading = true
this.getList()
},
/* 接口请求-start */
......@@ -206,14 +235,14 @@ export default {
getList() {
const params = this.getParams()
getListApi(params).then(res => {
this.tableData = res.deviceList
this.total = res.pagination.totalCount
this.tableLoading = false
}).catch(() => {
notice.errorTips()
this.tableLoading = false
})
getListApi(params)
.then(res => {
this.tableData = res.deviceList
this.total = res.pagination.totalCount
})
.catch(() => {
notice.errorTips()
})
},
delObjMutiAttr(obj, keys) {
......@@ -222,15 +251,25 @@ export default {
},
editDevice(params) {
params = this.delObjMutiAttr(params, ['createTime', 'keyWord', 'pageCount', 'pageSize', 'updateTime', 'stationName', 'stationCode'])
params = this.delObjMutiAttr(params, [
'createTime',
'keyWord',
'pageCount',
'pageSize',
'updateTime',
'stationName',
'stationCode'
])
// console.log(params)
editApi(params).then(res => {
this.handleEditClose()
notice.okTips()
this.loadingGetList()
}).catch(() => {
notice.errorTips()
})
editApi(params)
.then(res => {
this.handleEditClose()
notice.okTips()
this.loadingGetList()
})
.catch(() => {
notice.errorTips()
})
},
// 导入
......@@ -253,39 +292,56 @@ export default {
params.timestamp = new Date().getTime()
params.v = '1.0.0'
params.format = 'json'
params.method = 'fims.device.import'// params.method
params.method = 'fims.device.import' // params.method
// console.log(params)
params = sign(params, noSignAttr)
axios.post(process.env.VUE_APP_API, qs.stringify({
...params
}),
{
headers: {
'Content-Type': 'application/x-www-form-urlencoded'
}
}).then(res => {
const { url } = res.data
if (url) {
this.$open(url)
} else {
notice.okTips()
}
document.getElementById('fileUpload').value = null
}).catch(() => {
notice.errorTips()
document.getElementById('fileUpload').value = null
})
axios
.post(
process.env.VUE_APP_API,
qs.stringify({
...params
}),
{
headers: {
'Content-Type': 'application/x-www-form-urlencoded'
}
}
)
.then(res => {
const _data = res.data
const { code, data, message } = _data
if (+code !== 0) {
errorCreate(`code:${code} ${message}`)
return
}
const { url, failCount, successCount } = data
if (url) {
this.$open(url)
notice.errorTips(
`本次导入结果:成功 ${successCount} 条,失败 ${failCount} 条`
)
} else {
notice.okTips('本次导入结果:全部成功!')
}
document.getElementById('fileUpload').value = null
})
.catch(() => {
notice.errorTips()
document.getElementById('fileUpload').value = null
})
}
},
exportFile() {
const params = this.getParams()
exportApi(params).then(res => {
this.$open(res.url)
notice.okTips()
}).catch(() => {
notice.errorTips()
})
exportApi(params)
.then(res => {
this.$open(res.url)
notice.okTips()
})
.catch(() => {
notice.errorTips()
})
},
/* 接口请求-end */
// 搜索
......@@ -327,21 +383,24 @@ export default {
comfirmButtonText: '确认',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
removeApi({
id: row.id,
usedStatus: 2
}).then(res => {
notice.okTips()
this.loadingGetList()
}).catch(() => {
notice.errorTips()
})
.then(() => {
removeApi({
id: row.id,
usedStatus: 2
})
.then(res => {
notice.okTips()
this.loadingGetList()
})
.catch(() => {
notice.errorTips()
})
})
}).catch(() => {})
.catch(() => {})
}
}
}
</script>
<style scoped>
.import-input {
......@@ -352,6 +411,6 @@ export default {
width: 70px;
height: 36px;
cursor: pointer;
font-size:0
font-size: 0;
}
</style>
......@@ -49,7 +49,7 @@
<d2-table-header title="作业单列表"><auth-button category="Button"></auth-button></d2-table-header>
<el-table
:data="tableData"
v-loading="tableLoading"
v-loading="$store.state.d2admin.loading.value"
border
:highlight-current-row="true"
:stripe="true"
......@@ -190,7 +190,6 @@ export default {
model: 'createTime'
}],
// 表格
tableLoading: false,
tableData: [],
tableColumns: [{
label: '订单编号',
......@@ -320,7 +319,6 @@ export default {
},
loadingGetList() {
this.tableLoading = true
this.getList()
},
/* 接口请求-start */
......@@ -341,10 +339,8 @@ export default {
getListApi(params).then(res => {
this.tableData = res.maintainList
this.total = res.pagination.totalCount
this.tableLoading = false
}).catch(() => {
notice.errorTips()
this.tableLoading = false
})
},
exportOrder() {
......
......@@ -8,7 +8,7 @@
:close-on-click-modal="false"
width="580px"
>
<iframe width="100%" height="680px" scrolling="yes" frameborder="0" :src="pdfUrl"></iframe>
<iframe width="100%" height="800px" scrolling="yes" frameborder="0" :src="pdfUrl"></iframe>
</el-dialog>
</div>
</template>
......
......@@ -45,7 +45,7 @@
<d2-table-header title="订单列表"><auth-button category="Button"></auth-button></d2-table-header>
<el-table
:data="tableData"
v-loading="tableLoading"
v-loading="$store.state.d2admin.loading.value"
border
:highlight-current-row="true"
:stripe="true"
......@@ -153,7 +153,6 @@ export default {
type: ['', '', 'info', 'danger', 'warning', 'success'],
label: ['', '审批中', '审批完成', '已驳回', '待签收', '已完成']
}),
tableLoading: false,
tableData: [],
tableColumns: [{
label: '订单编号',
......@@ -200,7 +199,6 @@ export default {
methods: {
loadingGetList() {
this.tableLoading = true
this.getList()
},
/* 接口请求-start */
......@@ -221,10 +219,8 @@ export default {
getListApi(params).then(res => {
this.tableData = res.orderList
this.total = res.pagination.totalCount
this.tableLoading = false
}).catch(() => {
notice.errorTips()
this.tableLoading = false
})
},
......
......@@ -17,7 +17,7 @@
<d2-table-header title="物料列表"></d2-table-header>
<el-table
:data="tableData"
v-loading="tableLoading"
v-loading="$store.state.d2admin.loading.value"
border
:stripe="true"
>
......@@ -63,7 +63,6 @@ export default {
keyWord: ''
},
// 表格
tableLoading: false,
tableData: [],
tableColumns: [{
label: '物料代码',
......@@ -100,7 +99,6 @@ export default {
methods: {
loadingGetList() {
this.tableLoading = true
this.getList()
},
/* 接口请求-start */
......@@ -116,10 +114,8 @@ export default {
getListApi(params).then(res => {
this.tableData = res.deviceList
this.total = res.pagination.totalCount
this.tableLoading = false
}).catch(() => {
notice.errorTips()
this.tableLoading = false
})
},
/* 接口请求-end */
......
......@@ -39,7 +39,7 @@
<d2-table-header title="上报日志列表"></d2-table-header>
<el-table
:data="tableData"
v-loading="tableLoading"
v-loading="$store.state.d2admin.loading.value"
border
:stripe="true"
:highlight-current-row="true"
......@@ -83,7 +83,6 @@ export default {
name: 'FimsReportingLogs',
data() {
return {
tableLoading: false,
searchForm: {
reportTime: '',
trafficCode: '',
......@@ -141,7 +140,6 @@ export default {
},
loadingGetList() {
this.tableLoading = true
this.getList()
},
......@@ -162,10 +160,8 @@ export default {
// res.pagination && (this.total = res.pagination.totalCount)
this.tableData = res.loges
this.total = res.pagination.totalCount
this.tableLoading = false
})
.catch(() => {
this.tableLoading = false
notice.errorTips()
})
},
......
......@@ -73,6 +73,7 @@
<el-button
type="primary"
@click="handleConfirm"
:loading="$store.state.d2admin.loading.value"
>保存</el-button>
<el-button
@click="handleClose"
......
......@@ -48,7 +48,7 @@
<d2-table-header title="子系统列表"><auth-button category="Button" :data="editFormReset"></auth-button></d2-table-header>
<el-table
:data="tableData"
v-loading="tableLoading"
v-loading="$store.state.d2admin.loading.value"
border
:stripe="true"
:highlight-current-row="true"
......@@ -160,7 +160,6 @@ export default {
trafficCode: '',
merchantName: ''
},
tableLoading: false,
tableData: [],
tableColumns: [{
label: '子系统编号',
......@@ -225,7 +224,6 @@ export default {
// },
loadingGetList() {
this.tableLoading = true
this.getList()
},
/* 接口请求-start */
......@@ -251,10 +249,8 @@ export default {
getListApi(params).then(res => {
this.tableData = res.subsystemList
this.total = res.pagination.totalCount
this.tableLoading = false
}).catch(() => {
notice.errorTips()
this.tableLoading = false
})
},
......
......@@ -32,7 +32,7 @@
</el-col>
<el-col :span="12">
<el-form-item label="联系方式:" prop="mobile">
<el-input v-model="regForm.mobile" placeholder="请输入联系方式" clearable maxlength="11" :show-word-limit="true"></el-input>
<el-input v-model="regForm.mobile" placeholder="请输入联系方式" oninput ="value=value.replace(/[^\d]/g,'')" clearable maxlength="11" :show-word-limit="true"></el-input>
</el-form-item>
</el-col>
</el-row>
......@@ -72,7 +72,7 @@
<el-form-item flex="main:left cross:center"></el-form-item>
</el-form>
<div slot="footer">
<el-button @click="submit" type="primary" class="button-submit">提交</el-button>
<el-button @click="submit" type="primary" :loading="$store.state.d2admin.loading.value" class="button-submit">提交</el-button>
<el-button @click="handleClose" type="plain" class="button-submit">取消</el-button>
</div>
</el-dialog>
......
......@@ -54,7 +54,7 @@
</el-input>
</el-form-item>
<el-form-item class="form-action">
<el-button @click="submit" type="primary" class="button-login">登录</el-button>
<el-button @click="submit" type="primary" :loading="$store.state.d2admin.loading.value" class="button-login">登录</el-button>
<el-button
@click.prevent="registerDialogVisible = true"
plain
......
......@@ -54,7 +54,7 @@
<d2-table-header title="车辆状态列表"><auth-button category="Button"></auth-button></d2-table-header>
<el-table
:data="tableData"
v-loading="tableLoading"
v-loading="$store.state.d2admin.loading.value"
border
:stripe="true"
:highlight-current-row="true"
......@@ -190,7 +190,6 @@ export default {
},
// 表格
tableData: [],
tableLoading: false,
tableColumns: [{
label: '子系统编号',
prop: 'subsystemCode'
......@@ -241,7 +240,6 @@ export default {
},
loadingGetList() {
this.tableLoading = true
this.getList()
},
/* 接口请求-start */
......@@ -258,10 +256,8 @@ export default {
getListApi(params).then(res => {
this.tableData = res.subsystemList
this.total = res.pagination.totalCount
this.tableLoading = false
}).catch(() => {
notice.errorTips()
this.tableLoading = false
})
},
getPie(label = '') {
......
......@@ -49,6 +49,7 @@
<el-button
type="primary"
@click="handleConfirm"
:loading="$store.state.d2admin.loading.value"
>保存</el-button>
<el-button
@click="handleClose"
......
......@@ -29,7 +29,7 @@
<d2-table-header title="车辆列表"><auth-button category="Button" :data="editFormReset"></auth-button></d2-table-header>
<el-table
:data="tableData"
v-loading="tableLoading"
v-loading="$store.state.d2admin.loading.value"
:stripe="true"
border
:highlight-current-row="true"
......@@ -127,7 +127,6 @@ export default {
openType: ''
},
// 表格
tableLoading: false,
tableData: [],
tableColumns: [{
label: '车辆编号',
......@@ -173,7 +172,6 @@ export default {
},
loadingGetList() {
this.tableLoading = true
this.getList()
},
/* 接口请求-start */
......@@ -190,10 +188,8 @@ export default {
getListApi(params).then(res => {
this.tableData = res.trafficList
this.total = res.pagination.totalCount
this.tableLoading = false
}).catch(() => {
notice.errorTips()
this.tableLoading = false
})
},
editTraffic(value) {
......
......@@ -33,7 +33,7 @@
<d2-table-header title="登录日志列表"></d2-table-header>
<el-table
:data="tableData"
v-loading="tableLoading"
v-loading="$store.state.d2admin.loading.value"
border
:stripe="true"
>
......@@ -74,7 +74,6 @@ export default {
name: 'FimsLoginLogs',
data() {
return {
tableLoading: false,
searchForm: {
// beginTime: '',
// endTime: '',
......@@ -123,7 +122,6 @@ export default {
},
methods: {
loadingGetList() {
this.tableLoading = true
this.getList()
},
getParams() {
......@@ -144,10 +142,8 @@ export default {
// res.pagination && (this.total = res.pagination.totalCount)
this.tableData = res.loges
this.total = res.pagination.totalCount
this.tableLoading = false
})
.catch(() => {
this.tableLoading = false
})
},
// 搜索
......
......@@ -33,7 +33,7 @@
<el-divider content-position="left">权限设置</el-divider>
<RoleTree :resources="resources" :authIds="authIds" ref="roleTree" :close="dialogVisible"></RoleTree>
<div slot="footer">
<el-button @click="submit" type="primary" class="button-submit">保存</el-button>
<el-button @click="submit" type="primary" :loading="$store.state.d2admin.loading.value" class="button-submit">保存</el-button>
<el-button @click="handleClose" type="plain" class="button-submit">取消</el-button>
</div>
</el-dialog>
......
......@@ -2,7 +2,7 @@
<template>
<d2-container class="role">
<d2-table-header title="角色列表"><auth-button label="创建角色"></auth-button></d2-table-header>
<el-table :data="tableData" v-loading="tableLoading" border :stripe="true">
<el-table :data="tableData" v-loading="$store.state.d2admin.loading.value" border :stripe="true">
<el-table-column align="center" width="60px" label="序号" type="index"></el-table-column>
<el-table-column
v-for="(item, index) in tableColumns"
......@@ -50,7 +50,6 @@ export default {
// 新增/编辑弹窗
editVisible: false,
// 表格
tableLoading: false,
tableData: [],
tableColumns: Object.freeze([
{
......@@ -93,15 +92,12 @@ export default {
this.loadRoleList()
},
loadRoleList() {
this.tableLoading = true
RoleList()
.then(({ roles }) => {
this.tableData = roles
this.tableLoading = false
})
.catch(() => {
notice.errorTips()
this.tableLoading = false
})
},
// 页码
......
......@@ -46,6 +46,7 @@
v-model="regForm.mobile"
placeholder="请输入联系方式"
maxlength="11"
oninput ="value=value.replace(/[^\d]/g,'')"
:show-word-limit="true"
clearable
></el-input>
......@@ -116,7 +117,7 @@
</el-row>
</el-form>
<div slot="footer">
<el-button @click="submit" type="primary" class="button-submit">提交</el-button>
<el-button @click="submit" type="primary" :loading="$store.state.d2admin.loading.value" class="button-submit">提交</el-button>
<el-button @click="handleClose" type="plain" class="button-submit">取消</el-button>
</div>
</el-dialog>
......
......@@ -59,7 +59,7 @@
</el-form-item>
</el-form>
<d2-table-header title="用户列表"><auth-button category="action" label="创建用户"></auth-button></d2-table-header>
<el-table :data="tableData" v-loading="tableLoading" :highlight-current-row="true" border :stripe="true" >
<el-table :data="tableData" v-loading="$store.state.d2admin.loading.value" :highlight-current-row="true" border :stripe="true" >
<el-table-column align="center" width="60px" label="序号" type="index" :index="index=>index+(page.pageSize - 1) * page.pageCount + 1"></el-table-column>
<el-table-column label="用户名" prop="loginName" width="200" align="center" ></el-table-column>
<el-table-column label="角色" prop="roleName" width="140" align="center" ></el-table-column>
......@@ -148,7 +148,6 @@ export default {
},
searchTimes: [],
// 表格
tableLoading: false,
tableData: [],
page: {
// 页码
......@@ -214,18 +213,15 @@ export default {
}
},
loadUserList() {
this.tableLoading = true
const params = this.getParams()
UserList(params)
.then(res => {
const { pagination, userList } = res
this.tableData = userList
this.page = pagination
this.tableLoading = false
})
.catch(() => {
notice.errorTips()
this.tableLoading = false
})
},
filterTag(value, row) {
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!