Commit 521873f2 by liimin

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

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