Commit 9b0b9c13 by cwq0219

表格

1 parent 5b0e7f0e
<!-- 表格+分页 -->
<template>
<div>
<el-table
:data="tableData"
v-loading="$store.state.d2admin.loading.value"
border
:highlight-current-row="true"
:stripe="true"
>
<el-table-column
align="center"
width="60px"
label="序号"
type='index'
:index="index=>index+(currentPage - 1) * pageSize + 1"
></el-table-column>
<el-table-column
v-for="(item, index) in tableColumns"
:key="index"
:label="item.label"
:prop="item.prop"
:width="item.width"
:min-width="item.minWidth"
:align="item.align||'center'"
>
<template slot-scope="scope">
<template v-if="item.tagLabel">
<el-tag
:type="tag.type[scope.row[item.prop]]"
>{{tag.label[scope.row[item.prop]]}}</el-tag>
</template>
<template v-else-if="item.formatter">
{{item.formatter(scope.row)}}
</template>
<template v-else>
{{tableData[scope.$index][item.prop]}}
</template>
</template>
</el-table-column>
<el-table-column
v-if="tableOption"
label="操作"
:align="tableOption.align||'center'"
:width="tableOption.width||'200'"
fixed="right"
>
<template slot-scope="scope">
<auth-button v-if="!mapping" :data="scope.row"></auth-button>
<auth-button v-else :mapping="mapping" :data="scope.row"></auth-button>
</template>
</el-table-column>
</el-table>
<el-pagination
v-if="pagination"
background
@size-change="handleSizeChange"
@current-change="handleCurrentChange"
:current-page="currentPage"
:page-sizes="[10,20,30,40]"
:page-size="pageSize"
:total="total"
layout="sizes,total,->,prev,pager,next,jumper"
>
</el-pagination>
</div>
</template>
<script>
import notice from '@/common/notice'
export default {
name: 'd2-table',
data() {
return {
searchParams: {},
tableData: [],
// 页码
currentPage: 1,
pageSize: 10,
total: 10
}
},
props: {
tag: {
type: Array,
default: () => []
},
mapping: {
type: Array,
default: null
},
tableColumns: {
type: Array,
default: () => []
},
tableOption: {
type: Object,
default: null
},
pagination: {
type: Boolean,
default: true
}
},
mounted() {
this.$emit('handlePage')
},
methods: {
/**
* @param params Object 搜索参数
* @param listName String 后端返回列表参数名
* @param getListApi function 获取列表接口
*/
getList(params, listName, getListApi) {
this.searchParams = params
params = {
pageCount: this.pageSize,
pageSize: this.currentPage,
...params
}
// console.log(params)
getListApi(params).then(res => {
this.tableData = res[listName]
res.pagination && (this.total = res.pagination.totalCount)
}).catch(() => {
notice.errorTips()
})
},
// 页码
handleSizeChange(value) {
this.pageSize = value
this.$emit('handlePage')
},
handleCurrentChange(value) {
this.currentPage = value
this.$emit('handlePage')
},
handleEdit(row) {
this.$emit('handleEdit', row)
},
handleDetail(row) {
this.$emit('handleDetail', row)
},
handleDelete(row) {
this.$emit('handleDelete', row)
},
handleVerify(row) {
this.$emit('handleVerify', row)
},
handleOperation(row, e) {
this.$emit('handleOperation', { row, e })
}
}
}
</script>
<style>
</style>
......@@ -9,4 +9,5 @@ Vue.component('d2-icon', () => import('./d2-icon'))
Vue.component('d2-el-icon', () => import('./d2-el-icon'))
Vue.component('d2-icon-svg', () => import('./d2-icon-svg/index.vue'))
Vue.component('d2-table-header', () => import('./d2-table-header/index.vue'))
Vue.component('d2-table', () => import('./d2-table/index.vue'))
Vue.component([authButton.name], authButton)
......@@ -120,4 +120,16 @@ util.resetForm = function(formName) {
this.$refs[formName] && this.$refs[formName].resetFields()
})
}
/**
* 格式化时间
* @param {Array} time
*/
util.formatTime = function(time) {
return {
startTime: time ? time[0] + ' ' + '00:00:00' : '',
endTime: time ? time[1] + ' ' + '23:59:59' : ''
}
}
export default util
......@@ -327,6 +327,7 @@ export const resources = {
authId: '1070201',
parentId: '10702',
label: '创建角色',
category: 'action',
handle: 'handleEdit',
type: 'button',
icon: 'plus'
......
......@@ -11,7 +11,7 @@
<el-input
v-model="searchForm.keyWord"
placeholder="请输入物料代码/编码/名称"
@clear="loadingGetList"
@clear="getList"
clearable
></el-input>
</el-form-item>
......@@ -19,7 +19,7 @@
<el-select
v-model="searchForm.stationCode"
placeholder="请选择所在地"
@clear="loadingGetList"
@clear="getList"
clearable
filterable
>
......@@ -54,52 +54,14 @@
/>
</auth-button>
</d2-table-header>
<el-table
:data="tableData"
v-loading="$store.state.d2admin.loading.value"
border
:highlight-current-row="true"
:stripe="true"
>
<el-table-column
align="center"
width="60px"
label="序号"
type='index'
:index="index=>index+(currentPage - 1) * pageSize + 1"
>
</el-table-column>
<el-table-column
v-for="(item, index) in tableColumns"
:key="index"
:label="item.label"
:prop="item.prop"
:width="item.width"
align="center"
>
</el-table-column>
<el-table-column
align="center"
label="操作"
width="200px"
fixed="right"
>
<template slot-scope="scope">
<auth-button :data="scope.row"></auth-button>
</template>
</el-table-column>
</el-table>
<el-pagination
background
@size-change="handleSizeChange"
@current-change="handleCurrentChange"
:current-page="currentPage"
:page-sizes="[10,20,30,40]"
:page-size="pageSize"
:total="total"
layout="sizes,total,->,prev,pager,next,jumper"
>
</el-pagination>
<d2-table
ref="table"
:tableColumns="tableColumns"
tableOption=true
@handlePage="getList"
@handleEdit="handleEdit"
@handleDelete="handleDelete"
></d2-table>
<edit-dialog
:isVisible="editVisible"
:editForm="editForm"
......@@ -176,7 +138,7 @@ export default {
{
label: '物料名称',
prop: 'deviceName',
width: '200'
minWidth: '200'
},
{
label: '规格',
......@@ -195,13 +157,10 @@ export default {
},
{
label: '责任人',
prop: 'responsible'
prop: 'responsible',
width: '120'
}
],
// 页码
currentPage: 1,
pageSize: 10,
total: 30,
baseData: {
station: []
},
......@@ -210,7 +169,6 @@ export default {
},
mounted() {
this.loadingGetList()
this.loadBaseData()
},
......@@ -223,28 +181,16 @@ export default {
this.baseData.station = data
},
loadingGetList() {
this.getList()
},
/* 接口请求-start */
getParams() {
return {
pageCount: this.pageSize,
pageSize: this.currentPage,
...this.searchForm
}
},
getList() {
const params = this.getParams()
getListApi(params)
.then(res => {
this.tableData = res.deviceList
this.total = res.pagination.totalCount
})
.catch(() => {
notice.errorTips()
})
this.$refs.table.getList(params, 'deviceList', getListApi)
},
delObjMutiAttr(obj, keys) {
......@@ -267,7 +213,7 @@ export default {
.then(res => {
this.handleEditClose()
notice.okTips()
this.loadingGetList()
this.getList()
})
.catch(() => {
notice.errorTips()
......@@ -349,24 +295,11 @@ export default {
/* 接口请求-end */
// 搜索
handleSearch() {
this.loadingGetList()
},
// 页码
handleSizeChange(value) {
this.pageSize = value
// 调接口
this.loadingGetList()
},
handleCurrentChange(value) {
this.currentPage = value
// 调接口
this.loadingGetList()
this.getList()
},
handleEditClose() {
this.editVisible = !this.editVisible
this.editVisible = false
},
handleEditConfirm() {
......@@ -378,7 +311,7 @@ export default {
handleEdit(row) {
// console.log(row)
this.editForm = _.cloneDeep(row)
this.editVisible = !this.editVisible
this.editVisible = true
},
handleDelete(row) {
......@@ -394,7 +327,7 @@ export default {
})
.then(res => {
notice.okTips()
this.loadingGetList()
this.getList()
})
.catch(() => {
notice.errorTips()
......
......@@ -16,14 +16,14 @@
v-if="item.type == 'input'"
v-model="searchForm[item.model]"
:placeholder= "'请输入' + item.label"
@clear="loadingGetList"
@clear="getList"
clearable>
</el-input>
<el-select
v-else-if="item.type == 'select'"
v-model="searchForm[item.model]"
:placeholder= "'请选择' + item.label"
@clear="loadingGetList"
@clear="getList"
clearable
filterable>
<el-option
......@@ -47,68 +47,24 @@
</el-form-item>
</el-form>
<d2-table-header title="作业单列表"><auth-button category="Button"></auth-button></d2-table-header>
<el-table
:data="tableData"
v-loading="$store.state.d2admin.loading.value"
border
:highlight-current-row="true"
:stripe="true"
>
<el-table-column
align="center"
width="60px"
label="序号"
type='index'
:index="index=>index+(currentPage - 1) * pageSize + 1"
></el-table-column>
<el-table-column
v-for="(item, index) in tableColumns"
:key="index"
:label="item.label"
:prop="item.prop"
:width="item.width||200"
align="center"
>
<template slot-scope="scope">
<template v-if="item.formatter">
{{item.formatter(scope.row)}}
</template>
<template v-else>
{{tableData[scope.$index][item.prop]}}
</template>
</template>
</el-table-column>
<el-table-column
align="center"
label="操作"
fixed="right"
width="200"
>
<template slot-scope="scope">
<auth-button
:data="scope.row"
></auth-button>
</template>
</el-table-column>
</el-table>
<el-pagination
background
@size-change="handleSizeChange"
@current-change="handleCurrentChange"
:current-page="currentPage"
:page-sizes="[10,20,30,40]"
:page-size="pageSize"
:total="total"
layout="sizes,total,->,prev,pager,next,jumper"
>
</el-pagination>
<d2-table
ref="table"
:tableColumns="tableColumns"
:tableOption="tableOption"
:tag="tag"
@handlePage="getList"
@handleDetail="handleDetail"
@handleDelete="handleDelete"
></d2-table>
</d2-container>
</template>
<script>
import { getListApi, removeApi, exportApi } from '@api/maintainManagement'
import { mapActions } from 'vuex'
// import { BaseData } from '@/common/constants'
import notice from '@/common/notice'
import util from '@/libs/util'
export default {
name: 'fimsMaintainManagement',
data() {
......@@ -190,7 +146,9 @@ export default {
model: 'createTime'
}],
// 表格
tableData: [],
tableOption: {
width: 100
},
tableColumns: [{
label: '订单编号',
prop: 'taskCode'
......@@ -220,14 +178,6 @@ export default {
}, {
label: '子系统类型',
prop: 'subsystemType'
// formatter: (cellValue) => {
// if (cellValue.subsystemType) {
// return {
// 1: '座椅',
// 2: '电池'
// }[cellValue.subsystemType]
// }
// }
}, {
label: '故障类型',
prop: 'downType',
......@@ -285,22 +235,18 @@ export default {
}, {
label: '处理人',
prop: 'userName'
}],
// 页码
currentPage: 1,
pageSize: 10,
total: 30
}]
}
},
watch: {
'searchForm.createTime'(value) {
!value && this.loadingGetList()
!value && this.getList()
}
},
mounted() {
this.loadingGetList()
this.getList()
this.loadBaseData()
},
......@@ -308,27 +254,18 @@ export default {
...mapActions('d2admin/base', ['load']),
async loadBaseData() {
const modelToOptions = { 'stationCode': 'station', 'subsystemTypeCode': 'subsys' }
const data = await this.load()
if (data) {
for (var item in modelToOptions) {
let pos = this.searchFormArr.findIndex(arrItem => arrItem.model === item)
this.searchFormArr[pos].options = data[modelToOptions[item]]
}
}
const { station, subsys } = await this.load()
this.searchFormArr.map(item => {
item.model === 'stationCode' && (item.options = station)
item.model === 'subsystemTypeCode' && (item.options = subsys)
})
},
loadingGetList() {
this.getList()
},
/* 接口请求-start */
getParams() {
this.searchForm.startTime = this.searchForm.createTime ? this.searchForm.createTime[0] + ' ' + '00:00:00' : ''
this.searchForm.endTime = this.searchForm.createTime ? this.searchForm.createTime[1] + ' ' + '23:59:59' : ''
return {
pageCount: this.pageSize,
pageSize: this.currentPage,
...this.searchForm
...this.searchForm,
...util.formatTime(this.searchForm.createTime)
}
},
......@@ -336,12 +273,7 @@ export default {
const params = this.getParams()
delete params.createTime
// console.log(params)
getListApi(params).then(res => {
this.tableData = res.maintainList
this.total = res.pagination.totalCount
}).catch(() => {
notice.errorTips()
})
this.$refs.table.getList(params, 'maintainList', getListApi)
},
exportOrder() {
const params = this.getParams()
......@@ -356,20 +288,7 @@ export default {
/* 接口请求-end */
// 搜索
handleSearch() {
this.loadingGetList()
},
// 页码
handleSizeChange(value) {
this.pageSize = value
// 调接口
this.loadingGetList()
},
handleCurrentChange(value) {
this.currentPage = value
// 调接口
this.loadingGetList()
this.getList()
},
handleDelete(row) {
......@@ -382,7 +301,7 @@ export default {
id: row.id
}).then(res => {
notice.okTips()
this.loadingGetList()
this.getList()
}).catch(() => {
notice.errorTips()
})
......
......@@ -8,19 +8,19 @@
slot="header"
>
<el-form-item label="订单编号">
<el-input v-model="searchForm.orderCode" placeholder="请输入订单编号" @clear="loadingGetList" clearable></el-input>
<el-input v-model="searchForm.orderCode" placeholder="请输入订单编号" @clear="getList" clearable></el-input>
</el-form-item>
<el-form-item label="订单类型">
<el-select v-model="searchForm.orderType" placeholder="请选择订单类型" @clear="loadingGetList" clearable filterable>
<el-select v-model="searchForm.orderType" placeholder="请选择订单类型" @clear="getList" clearable filterable>
<el-option label="物料申请" value="1"></el-option>
<el-option label="物料报废" value="2"></el-option>
</el-select>
</el-form-item>
<el-form-item label="申请人">
<el-input v-model="searchForm.userName" placeholder="请输入申请人" @clear="loadingGetList" clearable></el-input>
<el-input v-model="searchForm.userName" placeholder="请输入申请人" @clear="getList" clearable></el-input>
</el-form-item>
<el-form-item label="订单状态">
<el-select v-model="searchForm.status" placeholder="请选择订单状态" @clear="loadingGetList" clearable filterable>
<el-select v-model="searchForm.status" placeholder="请选择订单状态" @clear="getList" clearable filterable>
<el-option
v-for="(item, index) in statusArr"
:key="index"
......@@ -43,64 +43,15 @@
</el-form-item>
</el-form>
<d2-table-header title="订单列表"><auth-button category="Button"></auth-button></d2-table-header>
<el-table
:data="tableData"
v-loading="$store.state.d2admin.loading.value"
border
:highlight-current-row="true"
:stripe="true"
>
<el-table-column
align="center"
width="60px"
label="序号"
type='index'
:index="index=>index+(currentPage - 1) * pageSize + 1"
></el-table-column>
<el-table-column
v-for="(item, index) in tableColumns"
:key="index"
:label="item.label"
:prop="item.prop"
:width="item.width"
align="center"
>
<template slot-scope="scope">
<template v-if="item.prop === 'status'">
<el-tag
:type="tag.type[scope.row.status]"
>{{tag.label[scope.row.status]}}</el-tag>
</template>
<template v-else-if="item.formatter">
{{item.formatter(scope.row)}}
</template>
<template v-else>
{{tableData[scope.$index][item.prop]}}
</template>
</template>
</el-table-column>
<el-table-column
align="center"
label="操作"
width='200'
fixed="right"
>
<template slot-scope="scope">
<auth-button :data="scope.row"></auth-button>
</template>
</el-table-column>
</el-table>
<el-pagination
background
@size-change="handleSizeChange"
@current-change="handleCurrentChange"
:current-page="currentPage"
:page-sizes="[10,20,30,40]"
:page-size="pageSize"
:total="total"
layout="sizes,total,->,prev,pager,next,jumper"
>
</el-pagination>
<d2-table
ref="table"
:tableColumns="tableColumns"
tableOption=true
:tag="tag"
@handlePage="getList"
@handleDetail="handleDetail"
@handleDelete="handleDelete"
></d2-table>
<detail-dialog
:isVisible="detailVisible"
:title="dialogTitle"
......@@ -114,6 +65,7 @@
import DetailDialog from './detailDialog'
import { getListApi, detailApi, removeApi, exportApi } from '@api/materiaOrderManagement'
import notice from '@/common/notice'
import util from '@/libs/util'
export default {
name: 'fimsMateriaOrderManagement',
components: {
......@@ -153,13 +105,15 @@ export default {
type: ['', '', 'info', 'danger', 'warning', 'success'],
label: ['', '审批中', '审批完成', '已驳回', '待签收', '已完成']
}),
tableData: [],
// tableData: [],
tableColumns: [{
label: '订单编号',
prop: 'orderCode'
prop: 'orderCode',
minWidth: '200'
}, {
label: '创建时间',
prop: 'createTime'
prop: 'createTime',
minWidth: '180'
}, {
label: '类型',
prop: 'orderType',
......@@ -174,55 +128,42 @@ export default {
}
}, {
label: '申请人',
prop: 'userName'
prop: 'userName',
width: '140'
}, {
label: '状态',
prop: 'status',
width: '120'
}],
// 页码
currentPage: 1,
pageSize: 10,
total: 30
tagLabel: true,
width: '140'
}]
}
},
watch: {
'searchForm.createTime'(value) {
!value && this.loadingGetList()
!value && this.getList()
}
},
mounted() {
this.loadingGetList()
},
mounted() {},
methods: {
loadingGetList() {
this.getList()
},
// changePage() {
// this.getList()
// },
/* 接口请求-start */
getParams() {
// console.log(this.searchForm)
this.searchForm.startTime = this.searchForm.createTime ? this.searchForm.createTime[0] + ' ' + '00:00:00' : ''
this.searchForm.endTime = this.searchForm.createTime ? this.searchForm.createTime[1] + ' ' + '23:59:59' : ''
return {
pageCount: this.pageSize,
pageSize: this.currentPage,
...this.searchForm
...this.searchForm,
...util.formatTime(this.searchForm.createTime)
}
},
getList() {
const params = this.getParams()
!params.orderCode && delete params.orderCode
delete params.createTime
// console.log(params)
getListApi(params).then(res => {
this.tableData = res.orderList
this.total = res.pagination.totalCount
}).catch(() => {
notice.errorTips()
})
this.$refs.table.getList(params, 'orderList', getListApi)
},
exportFile() {
......@@ -239,20 +180,7 @@ export default {
/* 接口请求-end */
// 搜索
handleSearch() {
this.loadingGetList()
},
// 页码
handleSizeChange(value) {
this.pageSize = value
// 调接口
this.loadingGetList()
},
handleCurrentChange(value) {
this.currentPage = value
// 调接口
this.loadingGetList()
this.getList()
},
handleDetailClose() {
......@@ -283,7 +211,7 @@ export default {
orderCode: row.orderCode
}).then(() => {
notice.okTips()
this.loadingGetList()
this.getList()
}).catch(() => {
notice.errorTips()
})
......
......@@ -8,53 +8,24 @@
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="getList" clearable></el-input>
</el-form-item>
<el-form-item>
<el-button type="primary" icon="el-icon-search" @click="handleSearch">查询</el-button>
</el-form-item>
</el-form>
<d2-table-header title="物料列表"></d2-table-header>
<el-table
:data="tableData"
v-loading="$store.state.d2admin.loading.value"
border
:stripe="true"
>
<el-table-column
align="center"
width="60px"
label="序号"
type='index'
:index="index=>index+(currentPage - 1) * pageSize + 1"
></el-table-column>
<el-table-column
v-for="(item, index) in tableColumns"
:key="index"
:label="item.label"
:prop="item.prop"
:width="item.width"
align="center"
>
</el-table-column>
</el-table>
<el-pagination
background
@size-change="handleSizeChange"
@current-change="handleCurrentChange"
:current-page="currentPage"
:page-sizes="[10,20,30,40]"
:page-size="pageSize"
:total="total"
layout="sizes,total,->,prev,pager,next,jumper"
>
</el-pagination>
<d2-table
ref="table"
:tableColumns="tableColumns"
@handlePage="getList"
></d2-table>
</d2-container>
</template>
<script>
import { getListApi } from '@api/materialList'
import notice from '@/common/notice'
// import notice from '@/common/notice'
export default {
name: 'fimsMaterialList',
data() {
......@@ -82,63 +53,37 @@ export default {
width: '170'
}, {
label: '物料名称',
prop: 'deviceName'
prop: 'deviceName',
minWidth: '200'
}, {
label: '规格',
prop: 'specifications'
prop: 'specifications',
width: '140'
}, {
label: '责任人',
prop: 'responsible'
}],
// 页码
currentPage: 1,
pageSize: 10,
total: 30
prop: 'responsible',
width: '120'
}]
}
},
mounted() {
this.loadingGetList()
},
mounted() {},
methods: {
loadingGetList() {
this.getList()
},
/* 接口请求-start */
getParams() {
return {
pageCount: this.pageSize,
pageSize: this.currentPage,
...this.searchForm
}
},
getList() {
const params = this.getParams()
getListApi(params).then(res => {
this.tableData = res.deviceList
this.total = res.pagination.totalCount
}).catch(() => {
notice.errorTips()
})
this.$refs.table.getList(params, 'deviceList', getListApi)
},
/* 接口请求-end */
// 搜索
handleSearch() {
this.loadingGetList()
},
// 页码
handleSizeChange(value) {
this.pageSize = value
// 调接口
this.loadingGetList()
},
handleCurrentChange(value) {
this.currentPage = value
// 调接口
this.loadingGetList()
this.getList()
}
}
}
......
......@@ -18,10 +18,10 @@
</el-date-picker>
</el-form-item>
<el-form-item label="车辆编号">
<el-input v-model="searchForm.trafficCode" placeholder="请输入车辆编号" clearable @clear="loadingGetList"></el-input>
<el-input v-model="searchForm.trafficCode" placeholder="请输入车辆编号" clearable @clear="getList"></el-input>
</el-form-item>
<el-form-item label="归属车辆段">
<el-select v-model="searchForm.stationCode" placeholder="请选择" clearable filterable @clear="loadingGetList">
<el-select v-model="searchForm.stationCode" placeholder="请选择" clearable filterable @clear="getList">
<el-option v-for="(item, index) in baseData.station"
:key="index"
:value="item.confCode"
......@@ -30,48 +30,18 @@
</el-select>
</el-form-item>
<el-form-item label="子系统编号">
<el-input v-model="searchForm.subSystemCode" placeholder="请输入子系统编号" clearable @clear="loadingGetList"></el-input>
<el-input v-model="searchForm.subSystemCode" placeholder="请输入子系统编号" clearable @clear="getList"></el-input>
</el-form-item>
<el-form-item>
<el-button type="primary" icon="el-icon-search" @click="handleSearch">查询</el-button>
</el-form-item>
</el-form>
<d2-table-header title="上报日志列表"></d2-table-header>
<el-table
:data="tableData"
v-loading="$store.state.d2admin.loading.value"
border
:stripe="true"
:highlight-current-row="true"
>
<el-table-column
align="center"
width="60px"
label="序号"
type='index'
:index="index=>index+(currentPage - 1) * pageSize + 1"
></el-table-column>
<el-table-column
v-for="(item, index) in tableColumns"
:key="index"
:label="item.label"
:prop="item.prop"
:width="item.width"
align="center"
>
</el-table-column>
</el-table>
<el-pagination
background
@size-change="handleSizeChange"
@current-change="handleCurrentChange"
:current-page="currentPage"
:page-sizes="[10,20,30,40]"
:page-size="pageSize"
:total="total"
layout="sizes,total,->,prev,pager,next,jumper"
>
</el-pagination>
<d2-table
ref="table"
:tableColumns="tableColumns"
@handlePage="getList"
></d2-table>
</d2-container>
</template>
......@@ -79,6 +49,7 @@
import { getLogsApi, exportApi } from '@api/reportingLogs'
import { BaseData } from '@/common/constants'
import notice from '@/common/notice'
import util from '@/libs/util'
export default {
name: 'FimsReportingLogs',
data() {
......@@ -92,30 +63,33 @@ export default {
tableData: [],
tableColumns: [{
label: '上报时间',
prop: 'reportTime'
prop: 'reportTime',
minWidth: '200'
}, {
label: '车辆编号',
prop: 'trafficCode'
prop: 'trafficCode',
width: '120'
}, {
label: '归属车辆段',
prop: 'stationName'
prop: 'stationName',
minWidth: '100'
}, {
label: '子系统编号',
prop: 'subSystemCode'
prop: 'subSystemCode',
width: '160'
}, {
label: '子系统类型',
prop: 'subSystemType'
prop: 'subSystemType',
width: '100'
}, {
label: '子系统厂家',
prop: 'merchantName'
prop: 'merchantName',
minWidth: '200'
}, {
label: '上报内容',
prop: 'reportValue'
prop: 'reportValue',
minWidth: '200'
}],
// 页码
currentPage: 1,
pageSize: 10,
total: 30,
baseData: {
station: []
}
......@@ -124,12 +98,11 @@ export default {
watch: {
'searchForm.reportTime'(value) {
!value && this.loadingGetList()
!value && this.getList()
}
},
mounted() {
this.loadingGetList()
this.loadBaseData()
},
......@@ -139,31 +112,17 @@ export default {
this.baseData.station = data
},
loadingGetList() {
this.getList()
},
getParams() {
var time = [{ attr: 'startTime', addTime: '00:00:00' }, { attr: 'endTime', addTime: '23:59:59' }]
this.searchForm.reportTime && this.searchForm.reportTime.map((value, i) => { this.searchForm[time[i].attr] = value + ' ' + time[i].addTime })
return {
pageCount: this.pageSize,
pageSize: this.currentPage,
...this.searchForm
...this.searchForm,
...util.formatTime(this.searchForm.reportTime)
}
},
getList() {
const params = this.getParams()
delete params.reportTime
getLogsApi(params).then(res => {
// res.pagination && (this.total = res.pagination.totalCount)
this.tableData = res.loges
this.total = res.pagination.totalCount
})
.catch(() => {
notice.errorTips()
})
this.$refs.table.getList(params, 'loges', getLogsApi)
},
handleExport() {
......@@ -181,20 +140,7 @@ export default {
// 搜索
handleSearch() {
this.loadingGetList()
},
// 页码
handleSizeChange(value) {
this.pageSize = value
// 调接口
this.loadingGetList()
},
handleCurrentChange(value) {
this.currentPage = value
// 调接口
this.loadingGetList()
this.getList()
}
}
}
......
......@@ -8,7 +8,7 @@
slot="header"
>
<el-form-item label="子系统编号">
<el-input v-model="searchForm.subsystemCode" placeholder="请输入子系统编号" @clear="loadingGetList" clearable></el-input>
<el-input v-model="searchForm.subsystemCode" placeholder="请输入子系统编号" @clear="getList" clearable></el-input>
<!-- <el-select
v-model="searchForm.subsystemCode"
placeholder="请输入子系统编号"
......@@ -27,7 +27,7 @@
</el-select> -->
</el-form-item>
<el-form-item label="类型">
<el-select v-model="searchForm.subsystemTypeCode" placeholder="请选择类型" @clear="loadingGetList" clearable filterable>
<el-select v-model="searchForm.subsystemTypeCode" placeholder="请选择类型" @clear="getList" clearable filterable>
<el-option v-for="(item, index) in baseData.subsys"
:key="index"
:value="item.confCode"
......@@ -36,71 +36,24 @@
</el-select>
</el-form-item>
<el-form-item label="车辆编号">
<el-input v-model="searchForm.trafficCode" placeholder="请输入车辆编号" @clear="loadingGetList" clearable></el-input>
<el-input v-model="searchForm.trafficCode" placeholder="请输入车辆编号" @clear="getList" clearable></el-input>
</el-form-item>
<el-form-item label="生产厂家">
<el-input v-model="searchForm.merchantName" placeholder="请输入生产厂家" @clear="loadingGetList" clearable></el-input>
<el-input v-model="searchForm.merchantName" placeholder="请输入生产厂家" @clear="getList" clearable></el-input>
</el-form-item>
<el-form-item>
<el-button type="primary" icon="el-icon-search" @click="handleSearch">查询</el-button>
</el-form-item>
</el-form>
<d2-table-header title="子系统列表"><auth-button category="Button" :data="editFormReset"></auth-button></d2-table-header>
<el-table
:data="tableData"
v-loading="$store.state.d2admin.loading.value"
border
:stripe="true"
:highlight-current-row="true"
>
<el-table-column
align="center"
width="60px"
label="序号"
type='index'
:index="index=>index+(currentPage - 1) * pageSize + 1"
></el-table-column>
<el-table-column
v-for="(item, index) in tableColumns"
:key="index"
:label="item.label"
:prop="item.prop"
:width="item.width"
align="center"
>
<template slot-scope="scope">
<template v-if="item.formatter">
{{item.formatter(scope.row)}}
</template>
<template v-else>
{{tableData[scope.$index][item.prop]}}
</template>
</template>
</el-table-column>
<el-table-column
align="center"
label="操作"
width="200"
fixed="right"
>
<template slot-scope="scope">
<auth-button
:data="scope.row"
></auth-button>
</template>
</el-table-column>
</el-table>
<el-pagination
background
@size-change="handleSizeChange"
@current-change="handleCurrentChange"
:current-page="currentPage"
:page-sizes="[10,20,30,40]"
:page-size="pageSize"
:total="total"
layout="sizes,total,->,prev,pager,next,jumper"
>
</el-pagination>
<d2-table
ref="table"
:tableColumns="tableColumns"
tableOption=true
@handlePage="getList"
@handleEdit="handleEdit"
@handleDelete="handleDelete"
></d2-table>
<edit-dialog
:isVisible="editVisible"
:editForm="editForm"
......@@ -176,7 +129,7 @@ export default {
}, {
label: '生产厂家',
prop: 'merchantName',
width: '220'
minWidth: '220'
}, {
label: '发送结点序列',
prop: 'sendSequence',
......@@ -195,9 +148,6 @@ export default {
width: '120'
}],
// 页码
currentPage: 1,
pageSize: 10,
total: 30,
baseData: {
subsys: []
}
......@@ -205,7 +155,6 @@ export default {
},
mounted() {
this.loadingGetList()
this.loadBaseData()
},
......@@ -223,17 +172,12 @@ export default {
// 清空远程搜索列表;表格数据刷新
// remoteAndGetList (attr) {
// this.remoteOptionArr[attr] = []
// this.loadingGetList()
// this.getList()
// },
loadingGetList() {
this.getList()
},
/* 接口请求-start */
getParams() {
return {
pageCount: this.pageSize,
pageSize: this.currentPage,
...this.searchForm
}
},
......@@ -249,12 +193,7 @@ export default {
getList() {
const params = this.getParams()
getListApi(params).then(res => {
this.tableData = res.subsystemList
this.total = res.pagination.totalCount
}).catch(() => {
notice.errorTips()
})
this.$refs.table.getList(params, 'subsystemList', getListApi)
},
editSubSystem(value) {
......@@ -273,7 +212,7 @@ export default {
editApi(params).then(res => {
this.handleEditClose()
notice.okTips()
this.loadingGetList()
this.getList()
}).catch(() => {
notice.errorTips()
})
......@@ -281,20 +220,7 @@ export default {
/* 接口请求-end */
// 搜索
handleSearch() {
this.loadingGetList()
},
// 页码
handleSizeChange(value) {
this.pageSize = value
// 调接口
this.loadingGetList()
},
handleCurrentChange(value) {
this.currentPage = value
// 调接口
this.loadingGetList()
this.getList()
},
handleEditClose() {
......@@ -309,7 +235,7 @@ export default {
// 表格-编辑
handleEdit(row) {
this.editForm = JSON.parse(JSON.stringify(row))
this.editVisible = !this.editVisible
this.handleEditClose()
},
handleDelete(row) {
......@@ -323,7 +249,7 @@ export default {
usedStatus: 2
}).then(() => {
notice.okTips()
this.loadingGetList()
this.getList()
}).catch(() => {
notice.errorTips()
})
......
......@@ -27,10 +27,10 @@
label-width="100px"
>
<el-form-item label="车辆编号">
<el-input v-model="searchForm.trafficCode" placeholder="请输入车辆编号" @clear="loadingGetList" clearable></el-input>
<el-input v-model="searchForm.trafficCode" placeholder="请输入车辆编号" @clear="getList" clearable></el-input>
</el-form-item>
<el-form-item label="归属车辆段">
<el-select v-model="searchForm.stationCode" placeholder="请选择归属车辆段" @clear="loadingGetList" filterable clearable>
<el-select v-model="searchForm.stationCode" placeholder="请选择归属车辆段" @clear="getList" filterable clearable>
<el-option v-for="(item, index) in baseData.station"
:key="index"
:value="item.confCode"
......@@ -39,10 +39,10 @@
</el-select>
</el-form-item>
<el-form-item label="子系统编号">
<el-input v-model="searchForm.subsystemCode" placeholder="请输入子系统编号" @clear="loadingGetList" clearable></el-input>
<el-input v-model="searchForm.subsystemCode" placeholder="请输入子系统编号" @clear="getList" clearable></el-input>
</el-form-item>
<el-form-item label="子系统状态">
<el-select v-model="searchForm.onlineStatus" placeholder="请选择子系统状态" @clear="loadingGetList" filterable clearable>
<el-select v-model="searchForm.onlineStatus" placeholder="请选择子系统状态" @clear="getList" filterable clearable>
<el-option value="1" label="在网"></el-option>
<el-option value="2" label="离网"></el-option>
</el-select>
......@@ -52,51 +52,12 @@
</el-form-item>
</el-form>
<d2-table-header title="子系统状态列表"><auth-button category="Button"></auth-button></d2-table-header>
<el-table
:data="tableData"
v-loading="$store.state.d2admin.loading.value"
border
:stripe="true"
:highlight-current-row="true"
>
<el-table-column
align="center"
width="60px"
label="序号"
type='index'
:index="index=>index+(currentPage - 1) * pageSize + 1"
></el-table-column>
<el-table-column
v-for="(item, index) in tableColumns"
:key="index"
:label="item.label"
:prop="item.prop"
:width="item.width"
align="center"
>
<template v-if="item.prop" slot-scope="scope">
<template v-if="item.prop == 'onlineStatus'">
<el-tag
:type="tag.type[scope.row.onlineStatus]"
>{{tag.label[scope.row.onlineStatus]}}</el-tag>
</template>
<template v-else>
{{tableData[scope.$index][item.prop]}}
</template>
</template>
</el-table-column>
</el-table>
<el-pagination
background
@size-change="handleSizeChange"
@current-change="handleCurrentChange"
:current-page="currentPage"
:page-sizes="[10,20,30,40]"
:page-size="pageSize"
:total="total"
layout="sizes,total,->,prev,pager,next,jumper"
>
</el-pagination>
<d2-table
ref="table"
:tableColumns="tableColumns"
:tag="tag"
@handlePage="getList"
></d2-table>
</div>
</d2-container>
</template>
......@@ -201,7 +162,8 @@ export default {
}, {
label: '子系统状态',
prop: 'onlineStatus',
width: '160'
width: '160',
tagLabel: true
}, {
label: '车辆编号',
prop: 'trafficCode',
......@@ -213,10 +175,6 @@ export default {
label: '故障内容',
prop: 'errorCode'
}],
// 翻页
currentPage: 1,
pageSize: 10,
total: 20,
baseData: {
station: [],
subsys: []
......@@ -226,7 +184,6 @@ export default {
mounted() {
this.$echarts = echarts
this.loadingGetList()
this.loadBaseData()
this.totalECharts = this.$echarts.init(document.getElementById('totalEcharts'))
this.getPie()
......@@ -243,26 +200,19 @@ export default {
this.baseData.subsys.unshift({ confCode: '', confValue: '全部' })
},
loadingGetList() {
this.getList()
},
// loadingGetList() {
// this.getList()
// },
/* 接口请求-start */
getParams() {
return {
pageCount: this.pageSize,
pageSize: this.currentPage,
...this.searchForm
}
},
getList() {
const params = this.getParams()
getListApi(params).then(res => {
this.tableData = res.subsystemList
this.total = res.pagination.totalCount
}).catch(() => {
notice.errorTips()
})
this.$refs.table.getList(params, 'subsystemList', getListApi)
},
getPie(label = '') {
const params = {
......@@ -303,20 +253,7 @@ export default {
// 搜索
handleSearch() {
// 调接口
this.loadingGetList()
},
// 页码
handleSizeChange(value) {
this.pageSize = value
// 调接口
this.loadingGetList()
},
handleCurrentChange(value) {
this.currentPage = value
// 调接口
this.loadingGetList()
this.getList()
}
}
}
......
......@@ -8,10 +8,10 @@
slot="header"
>
<el-form-item label="车辆编号">
<el-input v-model="searchForm.trafficCode" placeholder="请输入车辆编号" @clear="loadingGetList" clearable></el-input>
<el-input v-model="searchForm.trafficCode" placeholder="请输入车辆编号" @clear="getList" clearable></el-input>
</el-form-item>
<el-form-item label="归属车辆段">
<el-select v-model="searchForm.stationCode" placeholder="请选择归属车辆段" @clear="loadingGetList" clearable filterable>
<el-select v-model="searchForm.stationCode" placeholder="请选择归属车辆段" @clear="getList" clearable filterable>
<el-option v-for="(item, index) in baseData.station"
:key="index"
:value="item.confCode"
......@@ -20,65 +20,21 @@
</el-select>
</el-form-item>
<el-form-item label="维修承包商">
<el-input v-model="searchForm.merchantName" placeholder="请输入维修承包商" @clear="loadingGetList" clearable></el-input>
<el-input v-model="searchForm.merchantName" placeholder="请输入维修承包商" @clear="getList" clearable></el-input>
</el-form-item>
<el-form-item>
<el-button type="primary" icon="el-icon-search" @click="handleSearch">查询</el-button>
</el-form-item>
</el-form>
<d2-table-header title="车辆列表"><auth-button category="Button" :data="editFormReset"></auth-button></d2-table-header>
<el-table
:data="tableData"
v-loading="$store.state.d2admin.loading.value"
:stripe="true"
border
:highlight-current-row="true"
>
<el-table-column
align="center"
width="60px"
label="序号"
type='index'
:index="index=>index+(currentPage - 1) * pageSize + 1"
></el-table-column>
<el-table-column
v-for="(item, index) in tableColumns"
:key="index"
:label="item.label"
:prop="item.prop"
:width="item.width"
align="center"
>
<template slot-scope="scope">
<template v-if="item.formatter">
{{item.formatter(scope.row)}}
</template>
<template v-else>
{{tableData[scope.$index][item.prop]}}
</template>
</template>
</el-table-column>
<el-table-column
align="center"
label="操作"
width="200"
>
<template slot-scope="scope">
<auth-button :data="scope.row"></auth-button>
</template>
</el-table-column>
</el-table>
<el-pagination
background
@size-change="handleSizeChange"
@current-change="handleCurrentChange"
:current-page="currentPage"
:page-sizes="[10,20,30,40]"
:page-size="pageSize"
:total="total"
layout="sizes,total,->,prev,pager,next,jumper"
>
</el-pagination>
<d2-table
ref="table"
:tableColumns="tableColumns"
tableOption=true
@handlePage="getList"
@handleEdit="handleEdit"
@handleDelete="handleDelete"
></d2-table>
<edit-dialog
:isVisible="editVisible"
:editForm="editForm"
......@@ -134,10 +90,12 @@ export default {
width: '120'
}, {
label: '归属车辆段',
prop: 'stationName'
prop: 'stationName',
minWidth: '220'
}, {
label: '维修承包商',
prop: 'merchantName'
prop: 'merchantName',
minWidth: '220'
}, {
label: '接口开放',
prop: 'openType',
......@@ -151,10 +109,6 @@ export default {
}
}
}],
// 页码
currentPage: 1,
pageSize: 10,
total: 30,
baseData: {
station: []
}
......@@ -162,7 +116,6 @@ export default {
},
mounted() {
this.loadingGetList()
this.loadBaseData()
},
......@@ -172,26 +125,16 @@ export default {
this.baseData.station = data
},
loadingGetList() {
this.getList()
},
/* 接口请求-start */
getParams() {
return {
pageCount: this.pageSize,
pageSize: this.currentPage,
...this.searchForm
}
},
getList() {
const params = this.getParams()
getListApi(params).then(res => {
this.tableData = res.trafficList
this.total = res.pagination.totalCount
}).catch(() => {
notice.errorTips()
})
this.$refs.table.getList(params, 'trafficList', getListApi)
},
editTraffic(value) {
// console.log(value)
......@@ -204,7 +147,7 @@ export default {
editApi(params).then(res => {
this.handleEditClose()
notice.okTips()
this.loadingGetList()
this.getList()
}).catch(() => {
notice.errorTips()
})
......@@ -212,22 +155,7 @@ export default {
/* 接口请求-end */
// 搜索
handleSearch() {
this.loadingGetList()
},
// 页码
handleSizeChange(value) {
// console.log(value)
this.pageSize = value
// 调接口
this.loadingGetList()
},
handleCurrentChange(value) {
// console.log(value)
this.currentPage = value
// 调接口
this.loadingGetList()
this.getList()
},
handleEditClose() {
......@@ -244,7 +172,7 @@ export default {
handleEdit(row) {
// console.log(row)
this.editForm = _.cloneDeep(row)
this.editVisible = !this.editVisible
this.handleEditClose()
},
handleDelete(row) {
......@@ -258,7 +186,7 @@ export default {
usedStatus: 2
}).then(res => {
notice.okTips()
this.loadingGetList()
this.getList()
}).catch(() => {
notice.errorTips()
})
......
......@@ -8,10 +8,10 @@
slot="header"
>
<el-form-item label="用户">
<el-input v-model="searchForm.userName" placeholder="请输入用户名/姓名/联系电话" @clear="loadingGetList" clearable></el-input>
<el-input v-model="searchForm.userName" placeholder="请输入用户名/姓名/联系电话" @clear="getList" clearable></el-input>
</el-form-item>
<el-form-item label="登录方式">
<el-select v-model="searchForm.loginType" placeholder="请选择" @clear="loadingGetList" clearable filterable>
<el-select v-model="searchForm.loginType" placeholder="请选择" @clear="getList" clearable filterable>
<el-option label="PC" value="1"></el-option>
<el-option label="小程序" value="2"></el-option>
</el-select>
......@@ -31,45 +31,17 @@
</el-form-item>
</el-form>
<d2-table-header title="登录日志列表"></d2-table-header>
<el-table
:data="tableData"
v-loading="$store.state.d2admin.loading.value"
border
:stripe="true"
>
<el-table-column
align="center"
width="60px"
label="序号"
type='index'
:index="index=>index+(currentPage - 1) * pageSize + 1"
></el-table-column>
<el-table-column
v-for="(item, index) in tableColumns"
:key="index"
:label="item.label"
:prop="item.prop"
:width="item.width"
align="center"
>
</el-table-column>
</el-table>
<el-pagination
background
@size-change="handleSizeChange"
@current-change="handleCurrentChange"
:current-page="currentPage"
:page-sizes="[10,20,30,40]"
:page-size="pageSize"
:total="total"
layout="sizes,total,->,prev,pager,next,jumper"
>
</el-pagination>
<d2-table
ref="table"
:tableColumns="tableColumns"
@handlePage="getList"
></d2-table>
</d2-container>
</template>
<script>
import { getLoginlogs } from '@api/sys.account'
import util from '@/libs/util'
export default {
name: 'FimsLoginLogs',
data() {
......@@ -103,67 +75,33 @@ export default {
label: '登录设备',
prop: 'deviceCode',
width: '300px'
}],
// 页码
currentPage: 1,
pageSize: 10,
total: 10
}]
}
},
watch: {
'searchForm.loginTime'(value) {
!value && this.loadingGetList()
!value && this.getList()
}
},
mounted() {
this.loadingGetList()
},
mounted() {},
methods: {
loadingGetList() {
this.getList()
},
getParams() {
return Object.assign(
{
pageCount: this.pageSize,
pageSize: this.currentPage
},
this.searchForm
this.searchForm,
util.formatTime(this.searchForm.loginTime)
)
},
getList() {
const params = this.getParams()
params.startTime = params.loginTime ? params.loginTime[0] + ' ' + '00:00:00 ' : ''
params.endTime = params.loginTime ? params.loginTime[1] + ' ' + '23:59:59' : ''
delete params.loginTime
getLoginlogs(params).then(res => {
// res.pagination && (this.total = res.pagination.totalCount)
this.tableData = res.loges
this.total = res.pagination.totalCount
})
.catch(() => {
})
this.$refs.table.getList(params, 'loges', getLoginlogs)
},
// 搜索
handleSearch() {
this.loadingGetList()
},
// 页码
handleSizeChange(value) {
// console.log(value)
this.pageSize = value
// 调接口
this.loadingGetList()
},
handleCurrentChange(value) {
// console.log(value)
this.currentPage = value
// 调接口
this.loadingGetList()
this.getList()
}
}
}
......
<!-- 权限管理 -->
<template>
<d2-container class="role">
<d2-table-header title="角色列表"><auth-button label="创建角色"></auth-button></d2-table-header>
<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"
:key="index"
:label="item.label"
:prop="item.prop"
:width="item.width"
align="center"
/>
<el-table-column align="center" label="操作">
<template slot-scope="scope">
<auth-button :data="scope.row" label="权限编辑"></auth-button>
</template>
</el-table-column>
</el-table>
<!-- <el-pagination
background
@size-change="handleSizeChange"
@current-change="handleCurrentChange"
:current-page="page.pageCount"
:page-sizes="[10,20,30,40]"
:page-size="page.pageSize"
:total="page.totalCount"
layout="sizes,total,->,prev,pager,next,jumper"
></el-pagination> -->
<d2-table-header title="角色列表"><auth-button category="action" label="创建角色"></auth-button></d2-table-header>
<d2-table
ref="table"
:tableColumns="tableColumns"
tableOption=true
:pagination="pagination"
@handlePage="getList"
@handleEdit="handleEdit"
></d2-table>
<edit-dialog
:isVisible="editVisible"
:editData="editData"
......@@ -37,7 +19,7 @@
<script>
import { RoleList, RoleDetail } from '@/api/sys.account'
import notice from '@/common/notice'
// import notice from '@/common/notice'
import { mapActions } from 'vuex'
import { BaseData } from '@/common/constants'
export default {
......@@ -50,7 +32,7 @@ export default {
// 新增/编辑弹窗
editVisible: false,
// 表格
tableData: [],
pagination: false,
tableColumns: Object.freeze([
{
label: '角色名称',
......@@ -65,19 +47,13 @@ export default {
prop: 'createTime'
}
])
// page: {
// // 页码
// pageCount: 1, // 每页条数
// pageSize: 10, // 页码
// total: 100
// }
}
},
mounted() {
this.fetchData()
// this.fetchData()
this.$event.$on('e-role-dialog-close', async isReload => {
if (isReload) {
this.fetchData()
this.getList()
const { roles } = await RoleList()
this.set({ name: BaseData.ROLE.KEY, value: roles })
}
......@@ -88,29 +64,8 @@ export default {
methods: {
...mapActions('d2admin/base', ['set']),
fetchData() {
this.loadRoleList()
},
loadRoleList() {
RoleList()
.then(({ roles }) => {
this.tableData = roles
})
.catch(() => {
notice.errorTips()
})
},
// 页码
handleSizeChange(value) {
this.page.pageSize = value
// 调接口
this.loadRoleList()
},
handleCurrentChange(value) {
this.page.pageCount = value
// 调接口
this.loadRoleList()
getList() {
this.$refs.table.getList('', 'roles', RoleList)
},
async handleEdit(row) {
this.editData = row && await RoleDetail({ roleId: row.roleId })
......
......@@ -3,13 +3,13 @@
<d2-container class="user">
<el-form :inline="true" :model="searchForm" label-width="85px" slot="header">
<el-form-item label="用户:">
<el-input v-model="searchForm.userName" placeholder="请输入用户名/姓名/联系电话" @clear="loadUserList" clearable></el-input>
<el-input v-model="searchForm.userName" placeholder="请输入用户名/姓名/联系电话" @clear="getUserList" clearable></el-input>
</el-form-item>
<el-form-item label="所属公司:">
<el-input v-model="searchForm.companyName" placeholder="请输入公司名" @clear="loadUserList" clearable></el-input>
<el-input v-model="searchForm.companyName" placeholder="请输入公司名" @clear="getUserList" clearable></el-input>
</el-form-item>
<el-form-item label="角色:">
<el-select v-model="searchForm.roleId" clearable placeholder="请选择" @clear="loadUserList">
<el-select v-model="searchForm.roleId" clearable placeholder="请选择" @clear="getUserList">
<el-option
:label="role.roleName"
:value="role.roleId"
......@@ -19,13 +19,13 @@
</el-select>
</el-form-item>
<el-form-item label="状态:">
<el-select v-model="searchForm.usedStatus" clearable placeholder="请选择状态" @clear="loadUserList">
<el-select v-model="searchForm.usedStatus" clearable placeholder="请选择状态" @clear="getUserList">
<el-option label="可用" value="1"></el-option>
<el-option label="不可用/删除" value="2"></el-option>
</el-select>
</el-form-item>
<el-form-item label="所属站点:">
<el-select v-model="searchForm.stationCode" clearable placeholder="请选择" @clear="loadUserList" >
<el-select v-model="searchForm.stationCode" clearable placeholder="请选择" @clear="getUserList" >
<el-option
:label="station.confValue"
:value="station.confCode"
......@@ -35,7 +35,7 @@
</el-select>
</el-form-item>
<el-form-item label="职务:">
<el-select v-model="searchForm.postCode" clearable placeholder="请选择" @clear="loadUserList">
<el-select v-model="searchForm.postCode" clearable placeholder="请选择" @clear="getUserList">
<el-option
:label="post.confValue"
:value="post.confCode"
......@@ -59,39 +59,17 @@
</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="$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>
<el-table-column label="注册时间" prop="registerTime" width="200" align="center" ></el-table-column>
<el-table-column label="有效期" prop="validTime" width="200" align="center" ></el-table-column>
<el-table-column label="状态" prop="status" width="100" align="center">
<template slot-scope="scope">
<el-tag :type="tag.type[scope.row.status]">{{tag.label[scope.row.status]}}</el-tag>
</template>
</el-table-column>
<el-table-column label="姓名" prop="userName" width="120" align="center" ></el-table-column>
<el-table-column label="联系电话" prop="mobile" width="200" align="center" ></el-table-column>
<el-table-column label="所属公司" prop="companyName" width="200" align="center" ></el-table-column>
<el-table-column label="部门" prop="departName" width="200" align="center" ></el-table-column>
<el-table-column label="职务" prop="postName" width="200" align="center" ></el-table-column>
<el-table-column label="所属站点" prop="stationName" width="200" align="center" ></el-table-column>
<el-table-column align="center" fixed="right" width="230" label="操作">
<template slot-scope="scope">
<auth-button :mapping="mapping" :data="scope.row"></auth-button>
</template>
</el-table-column>
</el-table>
<el-pagination
background
@size-change="handleSizeChange"
@current-change="handleCurrentChange"
:current-page="page.pageSize"
:page-sizes="[10,20,30,40]"
:page-size="page.pageCount"
:total="page.totalCount"
layout="sizes,total,->,prev,pager,next,jumper"
></el-pagination>
<d2-table
ref="table"
:tableColumns="tableColumns"
tableOption=true
:tag="tag"
:mapping="mapping"
@handlePage="getUserList"
@handleEdit="handleEdit"
@handleVerify="handleVerify"
@handleOperation="handleOperation"
></d2-table>
<dialog-reg :isVisible="registerDialogVisible" :editData="editData" :key="key"/>
</d2-container>
</template>
......@@ -149,13 +127,53 @@ export default {
},
searchTimes: [],
// 表格
tableData: [],
page: {
// 页码
pageCount: 10,
pageSize: 1,
totalCount: 0 // 总条数
},
// tableData: [],
tableColumns: [{
label: '用户名',
prop: 'loginName',
width: '200'
}, {
label: '角色',
prop: 'roleName',
width: '140'
}, {
label: '注册时间',
prop: 'registerTime',
width: '200'
}, {
label: '有效期',
prop: 'validTime',
width: '200'
}, {
label: '状态',
prop: 'status',
width: '100',
tagLabel: true
}, {
label: '姓名',
prop: 'userName',
width: '120'
}, {
label: '联系电话',
prop: 'mobile',
width: '200'
}, {
label: '所属公司',
prop: 'companyName',
width: '200'
}, {
label: '部门',
prop: 'departName',
width: '200'
}, {
label: '职务',
prop: 'postName',
width: '200'
}, {
label: '所属站点',
prop: 'stationName',
width: '200'
}],
/* -----------------------基础数据---------------------- */
baseData: {
// 所属站点
......@@ -170,7 +188,7 @@ export default {
watch: {
'searchTimes'(value) {
!value && this.loadUserList()
!value && this.getUserList()
},
'$store.state.d2admin.base.role'(value) {
this.baseData.roles = value
......@@ -182,7 +200,7 @@ export default {
this.fetchData()
this.$event.$on('e-reg-dialog-close', isReload => {
this.registerDialogVisible = false
isReload && this.loadUserList()
isReload && this.getUserList()
})
},
......@@ -191,7 +209,6 @@ export default {
// 加载业务所需所有数据
fetchData() {
this.loadBaseData()
this.loadUserList()
},
async loadBaseData() {
......@@ -203,31 +220,14 @@ export default {
},
/* 接口请求-start */
getParams() {
let startTime = ''
let endTime = ''
if (this.searchTimes && this.searchTimes.length) {
[startTime, endTime] = this.searchTimes
startTime = `${startTime} 00:00:00`
endTime = `${endTime} 23:59:59`
}
return {
...this.page,
...this.searchForm,
startTime,
endTime
...util.formatTime(this.searchTimes)
}
},
loadUserList() {
getUserList() {
const params = this.getParams()
UserList(params)
.then(res => {
const { pagination, userList } = res
this.tableData = userList
this.page = pagination
})
.catch(() => {
notice.errorTips()
})
this.$refs.table.getList(params, 'userList', UserList)
},
filterTag(value, row) {
return row.status === value
......@@ -242,16 +242,7 @@ export default {
this.openDialog(row)
},
async handleSearch() {
this.loadUserList()
},
// 页码
handleSizeChange(value) {
this.page.pageCount = value
this.loadUserList()
},
handleCurrentChange(value) {
this.page.pageSize = value
this.loadUserList()
this.getUserList()
},
handleEdit(row) {
row = util.deepClone(row)
......@@ -275,13 +266,13 @@ export default {
},
// ------------
// 列表各种操作
async handleOperation(row, e) {
async handleOperation({ row, e }) {
const _actionText = e.target.innerText
const res = await this.apiMapping[_actionText]({ userId: row.userId })
const { operateStatus } = res
if (operateStatus) {
notice.okTips(`${_actionText}成功!`)
this.loadUserList()
this.getUserList()
} else {
notice.errorTips(`${_actionText}失败!`)
}
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!