Commit 871db7b4 by cwq0219

表格组件

1 parent c9f35e13
...@@ -13,7 +13,7 @@ ...@@ -13,7 +13,7 @@
width="60px" width="60px"
label="序号" label="序号"
type='index' type='index'
:index="index=>index+(currentPage - 1) * pageSize + 1" :index="index=>index+(page.pageSize - 1) * page.pageCount + 1"
></el-table-column> ></el-table-column>
<el-table-column <el-table-column
v-for="(item, index) in tableColumns" v-for="(item, index) in tableColumns"
...@@ -46,8 +46,7 @@ ...@@ -46,8 +46,7 @@
fixed="right" fixed="right"
> >
<template slot-scope="scope"> <template slot-scope="scope">
<auth-button v-if="!mapping" :data="scope.row"></auth-button> <slot name="auth-button" :scope="scope.row"></slot>
<auth-button v-else :mapping="mapping" :data="scope.row"></auth-button>
</template> </template>
</el-table-column> </el-table-column>
</el-table> </el-table>
...@@ -56,9 +55,9 @@ ...@@ -56,9 +55,9 @@
background background
@size-change="handleSizeChange" @size-change="handleSizeChange"
@current-change="handleCurrentChange" @current-change="handleCurrentChange"
:current-page="currentPage" :current-page="page.pageSize"
:page-sizes="[10,20,30,40]" :page-sizes="[10,20,30,40]"
:page-size="pageSize" :page-size="page.pageCount"
:total="total" :total="total"
layout="sizes,total,->,prev,pager,next,jumper" layout="sizes,total,->,prev,pager,next,jumper"
> >
...@@ -75,55 +74,73 @@ export default { ...@@ -75,55 +74,73 @@ export default {
searchParams: {}, searchParams: {},
tableData: [], tableData: [],
// 页码 // 页码
currentPage: 1, page: {
pageSize: 10, pageCount: 10,
pageSize: 1
},
// currentPage: 1,
// pageSize: 10,
total: 10 total: 10
} }
}, },
props: { props: {
// 后端返回列表参数名
listName: {
type: String,
default: ''
},
// 标签
tag: { tag: {
type: Array, type: Array,
default: () => [] default: () => []
}, },
mapping: { // 搜索条件
type: Array, searchForm: {
default: null type: Object,
default: () => []
}, },
// 表格栏
tableColumns: { tableColumns: {
type: Array, type: Array,
default: () => [] default: () => []
}, },
// 表格操作,默认没有
tableOption: { tableOption: {
type: Object, type: Object,
default: null default: null
}, },
// 分页,默认有
pagination: { pagination: {
type: Boolean, type: Boolean,
default: true default: true
},
// 获取列表接口
getListApi: {
type: Function,
default: null
}
},
watch: {
searchForm(val) {
this.searchParams = val
} }
}, },
mounted() { mounted() {
this.$emit('handlePage') this.searchParams = this.searchForm
this.getList()
}, },
methods: { methods: {
/** getList() {
* @param params Object 搜索参数 const params = {
* @param listName String 后端返回列表参数名 ...this.page,
* @param getListApi function 获取列表接口 ...this.searchParams
*/
getList(params, listName, getListApi) {
this.searchParams = params
params = {
pageCount: this.pageSize,
pageSize: this.currentPage,
...params
} }
// console.log(params) this.getListApi(params).then(res => {
getListApi(params).then(res => { this.tableData = res[this.listName]
this.tableData = res[listName]
res.pagination && (this.total = res.pagination.totalCount) res.pagination && (this.total = res.pagination.totalCount)
}).catch(() => { }).catch(() => {
notice.errorTips() notice.errorTips()
...@@ -132,33 +149,13 @@ export default { ...@@ -132,33 +149,13 @@ export default {
// 页码 // 页码
handleSizeChange(value) { handleSizeChange(value) {
this.pageSize = value this.page.pageCount = value
this.$emit('handlePage') this.getList()
}, },
handleCurrentChange(value) { handleCurrentChange(value) {
this.currentPage = value this.page.pageSize = value
this.$emit('handlePage') this.getList()
},
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 })
} }
} }
} }
......
...@@ -56,12 +56,18 @@ ...@@ -56,12 +56,18 @@
</d2-table-header> </d2-table-header>
<d2-table <d2-table
ref="table" ref="table"
:searchForm="searchForm"
:tableColumns="tableColumns" :tableColumns="tableColumns"
tableOption=true tableOption=true
@handlePage="getList" listName='deviceList'
@handleEdit="handleEdit" :getListApi="getListApi"
@handleDelete="handleDelete" >
></d2-table> <auth-button
slot="auth-button"
slot-scope="scope"
:data="scope.scope"
></auth-button>
</d2-table>
<edit-dialog <edit-dialog
:isVisible="editVisible" :isVisible="editVisible"
:editForm="editForm" :editForm="editForm"
...@@ -164,7 +170,8 @@ export default { ...@@ -164,7 +170,8 @@ export default {
baseData: { baseData: {
station: [] station: []
}, },
fileInfo: { fileType: '', fileBase: '' } fileInfo: { fileType: '', fileBase: '' },
getListApi: getListApi
} }
}, },
...@@ -182,15 +189,9 @@ export default { ...@@ -182,15 +189,9 @@ export default {
}, },
/* 接口请求-start */ /* 接口请求-start */
getParams() {
return {
...this.searchForm
}
},
getList() { getList() {
const params = this.getParams() this.$refs.table.getList()
this.$refs.table.getList(params, 'deviceList', getListApi)
}, },
delObjMutiAttr(obj, keys) { delObjMutiAttr(obj, keys) {
...@@ -282,8 +283,7 @@ export default { ...@@ -282,8 +283,7 @@ export default {
}, },
exportFile() { exportFile() {
const params = this.getParams() exportApi(this.searchForm)
exportApi(params)
.then(res => { .then(res => {
this.$open(res.url) this.$open(res.url)
notice.okTips() notice.okTips()
......
...@@ -35,7 +35,7 @@ ...@@ -35,7 +35,7 @@
</el-select> </el-select>
<el-date-picker <el-date-picker
v-else-if="item.type == 'datePick'" v-else-if="item.type == 'datePick'"
v-model="searchForm[item.model]" v-model="creatTime"
value-format="yyyy-MM-dd" value-format="yyyy-MM-dd"
type="daterange" type="daterange"
start-placeholder="开始日期" start-placeholder="开始日期"
...@@ -49,13 +49,19 @@ ...@@ -49,13 +49,19 @@
<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>
<d2-table <d2-table
ref="table" ref="table"
:searchForm="searchForm"
:tableColumns="tableColumns" :tableColumns="tableColumns"
:tableOption="tableOption" :tableOption="tableOption"
:tag="tag" :tag="tag"
@handlePage="getList" listName='maintainList'
@handleDetail="handleDetail" :getListApi="getListApi"
@handleDelete="handleDelete" >
></d2-table> <auth-button
slot="auth-button"
slot-scope="scope"
:data="scope.scope"
></auth-button>
</d2-table>
</d2-container> </d2-container>
</template> </template>
...@@ -69,13 +75,15 @@ export default { ...@@ -69,13 +75,15 @@ export default {
name: 'fimsMaintainManagement', name: 'fimsMaintainManagement',
data() { data() {
return { return {
creatTime: '',
// 搜索 // 搜索
searchForm: { searchForm: {
taskCode: '', taskCode: '',
taskType: '', taskType: '',
downDeviceNum: '', downDeviceNum: '',
userName: '', userName: '',
createTime: '', startTime: '',
endTime: '',
trafficCode: '', trafficCode: '',
stationCode: '', stationCode: '',
subsystemCode: '', subsystemCode: '',
...@@ -143,7 +151,8 @@ export default { ...@@ -143,7 +151,8 @@ export default {
}, { }, {
label: '创建时间', label: '创建时间',
type: 'datePick', type: 'datePick',
model: 'createTime' // singleVal: 'creatTime',
model: 'creatTime'
}], }],
// 表格 // 表格
tableOption: { tableOption: {
...@@ -235,18 +244,19 @@ export default { ...@@ -235,18 +244,19 @@ export default {
}, { }, {
label: '处理人', label: '处理人',
prop: 'userName' prop: 'userName'
}] }],
getListApi: getListApi
} }
}, },
watch: { watch: {
'searchForm.createTime'(value) { 'creatTime'(value) {
!value && this.getList() !value && this.getList()
} }
}, },
mounted() { mounted() {
this.getList() // this.getList()
this.loadBaseData() this.loadBaseData()
}, },
...@@ -263,21 +273,15 @@ export default { ...@@ -263,21 +273,15 @@ export default {
/* 接口请求-start */ /* 接口请求-start */
getParams() { getParams() {
return { return Object.assign(this.searchForm, util.formatTime(this.creatTime))
...this.searchForm,
...util.formatTime(this.searchForm.createTime)
}
}, },
getList() { getList() {
const params = this.getParams() this.getParams()
delete params.createTime this.$refs.table.getList()
// console.log(params)
this.$refs.table.getList(params, 'maintainList', getListApi)
}, },
exportOrder() { exportOrder() {
const params = this.getParams() const params = this.getParams()
delete params.createTime
exportApi(params).then(res => { exportApi(params).then(res => {
this.$open(res.url) this.$open(res.url)
notice.okTips() notice.okTips()
......
...@@ -31,7 +31,7 @@ ...@@ -31,7 +31,7 @@
</el-form-item> </el-form-item>
<el-form-item label="创建时间"> <el-form-item label="创建时间">
<el-date-picker <el-date-picker
v-model="searchForm.createTime" v-model="createTime"
type="daterange" type="daterange"
value-format="yyyy-MM-dd" value-format="yyyy-MM-dd"
start-placeholder="开始日期" start-placeholder="开始日期"
...@@ -45,13 +45,19 @@ ...@@ -45,13 +45,19 @@
<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>
<d2-table <d2-table
ref="table" ref="table"
:searchForm="searchForm"
:tableColumns="tableColumns" :tableColumns="tableColumns"
tableOption=true tableOption=true
:tag="tag" :tag="tag"
@handlePage="getList" listName='orderList'
@handleDetail="handleDetail" :getListApi="getListApi"
@handleDelete="handleDelete" >
></d2-table> <auth-button
slot="auth-button"
slot-scope="scope"
:data="scope.scope"
></auth-button>
</d2-table>
<detail-dialog <detail-dialog
:isVisible="detailVisible" :isVisible="detailVisible"
:title="dialogTitle" :title="dialogTitle"
...@@ -77,12 +83,14 @@ export default { ...@@ -77,12 +83,14 @@ export default {
dialogTitle: '', dialogTitle: '',
pdfUrl: '', pdfUrl: '',
// 搜索 // 搜索
createTime: '',
searchForm: { searchForm: {
orderCode: '', orderCode: '',
orderType: '', orderType: '',
status: '', status: '',
userName: '', userName: '',
createTime: '' startTime: '',
endTime: ''
}, },
statusArr: [{ statusArr: [{
value: 1, value: 1,
...@@ -135,12 +143,13 @@ export default { ...@@ -135,12 +143,13 @@ export default {
prop: 'status', prop: 'status',
tagLabel: true, tagLabel: true,
width: '140' width: '140'
}] }],
getListApi: getListApi
} }
}, },
watch: { watch: {
'searchForm.createTime'(value) { 'createTime'(value) {
!value && this.getList() !value && this.getList()
} }
}, },
...@@ -148,28 +157,26 @@ export default { ...@@ -148,28 +157,26 @@ export default {
mounted() {}, mounted() {},
methods: { methods: {
// test() {
// console.log('test---')
// },
// changePage() { // changePage() {
// this.getList() // this.getList()
// }, // },
/* 接口请求-start */ /* 接口请求-start */
getParams() { getParams() {
return { return Object.assign(this.searchForm, util.formatTime(this.createTime))
...this.searchForm,
...util.formatTime(this.searchForm.createTime)
}
}, },
getList() { getList() {
const params = this.getParams() this.getParams()
!params.orderCode && delete params.orderCode this.$refs.table.getList()
delete params.createTime
this.$refs.table.getList(params, 'orderList', getListApi)
}, },
exportFile() { exportFile() {
const params = this.getParams() const params = this.getParams()
!params.orderCode && delete params.orderCode !params.orderCode && delete params.orderCode
delete params.createTime
exportApi(params).then(res => { exportApi(params).then(res => {
this.$open(res.url) this.$open(res.url)
notice.okTips() notice.okTips()
......
...@@ -11,14 +11,16 @@ ...@@ -11,14 +11,16 @@
<el-input v-model="searchForm.keyWord" placeholder="请输入物料代码/编码/名称" @clear="getList" clearable></el-input> <el-input v-model="searchForm.keyWord" placeholder="请输入物料代码/编码/名称" @clear="getList" clearable></el-input>
</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="getList">查询</el-button>
</el-form-item> </el-form-item>
</el-form> </el-form>
<d2-table-header title="物料列表"></d2-table-header> <d2-table-header title="物料列表"></d2-table-header>
<d2-table <d2-table
ref="table" ref="table"
:searchForm="searchForm"
:tableColumns="tableColumns" :tableColumns="tableColumns"
@handlePage="getList" listName='deviceList'
:getListApi="getListApi"
></d2-table> ></d2-table>
</d2-container> </d2-container>
</template> </template>
...@@ -33,6 +35,7 @@ export default { ...@@ -33,6 +35,7 @@ export default {
searchForm: { searchForm: {
keyWord: '' keyWord: ''
}, },
getListApi: getListApi,
// 表格 // 表格
tableData: [], tableData: [],
tableColumns: [{ tableColumns: [{
...@@ -70,20 +73,8 @@ export default { ...@@ -70,20 +73,8 @@ export default {
mounted() {}, mounted() {},
methods: { methods: {
/* 接口请求-start */
getParams() {
return {
...this.searchForm
}
},
getList() { getList() {
const params = this.getParams() this.$refs.table.getList()
this.$refs.table.getList(params, 'deviceList', getListApi)
},
/* 接口请求-end */
// 搜索
handleSearch() {
this.getList()
} }
} }
} }
......
...@@ -9,7 +9,7 @@ ...@@ -9,7 +9,7 @@
> >
<el-form-item label="上报时间"> <el-form-item label="上报时间">
<el-date-picker <el-date-picker
v-model="searchForm.reportTime" v-model="reportTime"
type="daterange" type="daterange"
value-format="yyyy-MM-dd" value-format="yyyy-MM-dd"
range-separator="至" range-separator="至"
...@@ -39,8 +39,10 @@ ...@@ -39,8 +39,10 @@
<d2-table-header title="上报日志列表"></d2-table-header> <d2-table-header title="上报日志列表"></d2-table-header>
<d2-table <d2-table
ref="table" ref="table"
:searchForm="searchForm"
:tableColumns="tableColumns" :tableColumns="tableColumns"
@handlePage="getList" listName='loges'
:getListApi="getListApi"
></d2-table> ></d2-table>
</d2-container> </d2-container>
</template> </template>
...@@ -54,8 +56,11 @@ export default { ...@@ -54,8 +56,11 @@ export default {
name: 'FimsReportingLogs', name: 'FimsReportingLogs',
data() { data() {
return { return {
searchForm: { getListApi: getLogsApi,
reportTime: '', reportTime: '',
searchForm: {
startTime: '',
endTime: '',
trafficCode: '', trafficCode: '',
stationCode: '', stationCode: '',
subSystemCode: '' subSystemCode: ''
...@@ -97,7 +102,7 @@ export default { ...@@ -97,7 +102,7 @@ export default {
}, },
watch: { watch: {
'searchForm.reportTime'(value) { 'reportTime'(value) {
!value && this.getList() !value && this.getList()
} }
}, },
...@@ -112,23 +117,14 @@ export default { ...@@ -112,23 +117,14 @@ export default {
this.baseData.station = data this.baseData.station = data
}, },
getParams() {
return {
...this.searchForm,
...util.formatTime(this.searchForm.reportTime)
}
},
getList() { getList() {
const params = this.getParams() Object.assign(this.searchForm, util.formatTime(this.reportTime))
delete params.reportTime this.$refs.table.getList()
this.$refs.table.getList(params, 'loges', getLogsApi)
}, },
handleExport() { handleExport() {
const params = this.getParams() Object.assign(this.searchForm, util.formatTime(this.reportTime))
delete params.reportTime exportApi(this.searchForm).then(res => {
exportApi(params).then(res => {
// console.log(res) // console.log(res)
// window.location.href = res.url // window.location.href = res.url
this.$open(res.url) this.$open(res.url)
......
...@@ -48,12 +48,18 @@ ...@@ -48,12 +48,18 @@
<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>
<d2-table <d2-table
ref="table" ref="table"
:searchForm="searchForm"
:tableColumns="tableColumns" :tableColumns="tableColumns"
tableOption=true tableOption=true
@handlePage="getList" listName='subsystemList'
@handleEdit="handleEdit" :getListApi="getListApi"
@handleDelete="handleDelete" >
></d2-table> <auth-button
slot="auth-button"
slot-scope="scope"
:data="scope.scope"
></auth-button>
</d2-table>
<edit-dialog <edit-dialog
:isVisible="editVisible" :isVisible="editVisible"
:editForm="editForm" :editForm="editForm"
...@@ -150,7 +156,8 @@ export default { ...@@ -150,7 +156,8 @@ export default {
// 页码 // 页码
baseData: { baseData: {
subsys: [] subsys: []
} },
getListApi: getListApi
} }
}, },
...@@ -175,13 +182,6 @@ export default { ...@@ -175,13 +182,6 @@ export default {
// this.getList() // this.getList()
// }, // },
/* 接口请求-start */
getParams() {
return {
...this.searchForm
}
},
// getRemote (item) { // getRemote (item) {
// let params = {} // let params = {}
// params[item.attr] = item.value // params[item.attr] = item.value
...@@ -192,8 +192,7 @@ export default { ...@@ -192,8 +192,7 @@ export default {
// }, // },
getList() { getList() {
const params = this.getParams() this.$refs.table.getList()
this.$refs.table.getList(params, 'subsystemList', getListApi)
}, },
editSubSystem(value) { editSubSystem(value) {
......
...@@ -48,15 +48,17 @@ ...@@ -48,15 +48,17 @@
</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="getList">查询</el-button>
</el-form-item> </el-form-item>
</el-form> </el-form>
<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>
<d2-table <d2-table
ref="table" ref="table"
:searchForm="searchForm"
:tableColumns="tableColumns" :tableColumns="tableColumns"
:tag="tag" :tag="tag"
@handlePage="getList" listName='subsystemList'
:getListApi="getListApi"
></d2-table> ></d2-table>
</div> </div>
</d2-container> </d2-container>
...@@ -178,7 +180,8 @@ export default { ...@@ -178,7 +180,8 @@ export default {
baseData: { baseData: {
station: [], station: [],
subsys: [] subsys: []
} },
getListApi: getListApi
} }
}, },
...@@ -200,19 +203,8 @@ export default { ...@@ -200,19 +203,8 @@ export default {
this.baseData.subsys.unshift({ confCode: '', confValue: '全部' }) this.baseData.subsys.unshift({ confCode: '', confValue: '全部' })
}, },
// loadingGetList() {
// this.getList()
// },
/* 接口请求-start */
getParams() {
return {
...this.searchForm
}
},
getList() { getList() {
const params = this.getParams() this.$refs.table.getList()
this.$refs.table.getList(params, 'subsystemList', getListApi)
}, },
getPie(label = '') { getPie(label = '') {
const params = { const params = {
...@@ -225,7 +217,10 @@ export default { ...@@ -225,7 +217,10 @@ export default {
}) })
}, },
exportFile() { exportFile() {
const params = this.getParams() const params = {
...this.$refs.table.page,
...this.searchForm
}
exportApi(params).then(res => { exportApi(params).then(res => {
this.$open(res.url) this.$open(res.url)
notice.okTips() notice.okTips()
...@@ -248,12 +243,6 @@ export default { ...@@ -248,12 +243,6 @@ export default {
item.data[1].value = params.normalNum ? params.normalNum : 0 item.data[1].value = params.normalNum ? params.normalNum : 0
this.totalECharts.setOption(this.totalOptions) this.totalECharts.setOption(this.totalOptions)
},
// 搜索
handleSearch() {
// 调接口
this.getList()
} }
} }
} }
......
...@@ -29,12 +29,18 @@ ...@@ -29,12 +29,18 @@
<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>
<d2-table <d2-table
ref="table" ref="table"
:searchForm="searchForm"
:tableColumns="tableColumns" :tableColumns="tableColumns"
tableOption=true tableOption=true
@handlePage="getList" listName='trafficList'
@handleEdit="handleEdit" :getListApi="getListApi"
@handleDelete="handleDelete" >
></d2-table> <auth-button
slot="auth-button"
slot-scope="scope"
:data="scope.scope"
></auth-button>
</d2-table>
<edit-dialog <edit-dialog
:isVisible="editVisible" :isVisible="editVisible"
:editForm="editForm" :editForm="editForm"
...@@ -111,7 +117,8 @@ export default { ...@@ -111,7 +117,8 @@ export default {
}], }],
baseData: { baseData: {
station: [] station: []
} },
getListApi: getListApi
} }
}, },
...@@ -125,17 +132,10 @@ export default { ...@@ -125,17 +132,10 @@ export default {
this.baseData.station = data this.baseData.station = data
}, },
/* 接口请求-start */
getParams() {
return {
...this.searchForm
}
},
getList() { getList() {
const params = this.getParams() this.$refs.table.getList()
this.$refs.table.getList(params, 'trafficList', getListApi)
}, },
editTraffic(value) { editTraffic(value) {
// console.log(value) // console.log(value)
const params = _.cloneDeep(this.editFormReset) const params = _.cloneDeep(this.editFormReset)
...@@ -160,7 +160,6 @@ export default { ...@@ -160,7 +160,6 @@ export default {
handleEditClose() { handleEditClose() {
this.editVisible = !this.editVisible this.editVisible = !this.editVisible
// delete this.editForm.id
}, },
handleEditConfirm() { handleEditConfirm() {
...@@ -170,7 +169,6 @@ export default { ...@@ -170,7 +169,6 @@ export default {
// 表格-编辑 // 表格-编辑
handleEdit(row) { handleEdit(row) {
// console.log(row)
this.editForm = _.cloneDeep(row) this.editForm = _.cloneDeep(row)
this.handleEditClose() this.handleEditClose()
}, },
......
...@@ -18,7 +18,7 @@ ...@@ -18,7 +18,7 @@
</el-form-item> </el-form-item>
<el-form-item label="登录时间"> <el-form-item label="登录时间">
<el-date-picker <el-date-picker
v-model="searchForm.loginTime" v-model="loginTime"
type="daterange" type="daterange"
value-format="yyyy-MM-dd" value-format="yyyy-MM-dd"
range-separator="至" range-separator="至"
...@@ -27,14 +27,16 @@ ...@@ -27,14 +27,16 @@
</el-date-picker> </el-date-picker>
</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="getList">查询</el-button>
</el-form-item> </el-form-item>
</el-form> </el-form>
<d2-table-header title="登录日志列表"></d2-table-header> <d2-table-header title="登录日志列表"></d2-table-header>
<d2-table <d2-table
ref="table" ref="table"
:searchForm="searchForm"
:tableColumns="tableColumns" :tableColumns="tableColumns"
@handlePage="getList" listName='loges'
:getListApi="getListApi"
></d2-table> ></d2-table>
</d2-container> </d2-container>
</template> </template>
...@@ -46,10 +48,11 @@ export default { ...@@ -46,10 +48,11 @@ export default {
name: 'FimsLoginLogs', name: 'FimsLoginLogs',
data() { data() {
return { return {
searchForm: { getListApi: getLoginlogs,
// beginTime: '',
// endTime: '',
loginTime: '', loginTime: '',
searchForm: {
startTime: '',
endTime: '',
userName: '', userName: '',
loginType: '' loginType: ''
}, },
...@@ -80,7 +83,7 @@ export default { ...@@ -80,7 +83,7 @@ export default {
}, },
watch: { watch: {
'searchForm.loginTime'(value) { 'loginTime'(value) {
!value && this.getList() !value && this.getList()
} }
}, },
...@@ -88,20 +91,9 @@ export default { ...@@ -88,20 +91,9 @@ export default {
mounted() {}, mounted() {},
methods: { methods: {
getParams() {
return Object.assign(
this.searchForm,
util.formatTime(this.searchForm.loginTime)
)
},
getList() { getList() {
const params = this.getParams() Object.assign(this.searchForm, util.formatTime(this.loginTime))
delete params.loginTime this.$refs.table.getList()
this.$refs.table.getList(params, 'loges', getLoginlogs)
},
// 搜索
handleSearch() {
this.getList()
} }
} }
} }
......
...@@ -6,10 +6,15 @@ ...@@ -6,10 +6,15 @@
ref="table" ref="table"
:tableColumns="tableColumns" :tableColumns="tableColumns"
tableOption=true tableOption=true
:pagination="pagination" listName='roles'
@handlePage="getList" :getListApi="getListApi"
@handleEdit="handleEdit" >
></d2-table> <auth-button
slot="auth-button"
slot-scope="scope"
:data="scope.scope"
></auth-button>
</d2-table>
<edit-dialog <edit-dialog
:isVisible="editVisible" :isVisible="editVisible"
:editData="editData" :editData="editData"
...@@ -29,6 +34,7 @@ export default { ...@@ -29,6 +34,7 @@ export default {
}, },
data() { data() {
return { return {
getListApi: RoleList,
// 新增/编辑弹窗 // 新增/编辑弹窗
editVisible: false, editVisible: false,
// 表格 // 表格
...@@ -65,7 +71,7 @@ export default { ...@@ -65,7 +71,7 @@ export default {
...mapActions('d2admin/base', ['set']), ...mapActions('d2admin/base', ['set']),
getList() { getList() {
this.$refs.table.getList('', 'roles', RoleList) this.$refs.table.getList()
}, },
async handleEdit(row) { async handleEdit(row) {
this.editData = row && await RoleDetail({ roleId: row.roleId }) this.editData = row && await RoleDetail({ roleId: row.roleId })
......
...@@ -61,15 +61,20 @@ ...@@ -61,15 +61,20 @@
<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>
<d2-table <d2-table
ref="table" ref="table"
:searchForm="searchForm"
:tableColumns="tableColumns" :tableColumns="tableColumns"
tableOption=true tableOption=true
:tag="tag" :tag="tag"
listName='userList'
:getListApi="getListApi"
>
<auth-button
slot="auth-button"
slot-scope="scope"
:data="scope.scope"
:mapping="mapping" :mapping="mapping"
@handlePage="getUserList" ></auth-button>
@handleEdit="handleEdit" </d2-table>
@handleVerify="handleVerify"
@handleOperation="handleOperation"
></d2-table>
<dialog-reg :isVisible="registerDialogVisible" :editData="editData" :key="key"/> <dialog-reg :isVisible="registerDialogVisible" :editData="editData" :key="key"/>
</d2-container> </d2-container>
</template> </template>
...@@ -95,6 +100,7 @@ export default { ...@@ -95,6 +100,7 @@ export default {
}, },
data() { data() {
return { return {
getListApi: UserList,
key: new Date(), key: new Date(),
tag: Object.freeze({ tag: Object.freeze({
effect: 'dark', effect: 'dark',
...@@ -219,15 +225,9 @@ export default { ...@@ -219,15 +225,9 @@ export default {
Object.freeze(this.baseData) Object.freeze(this.baseData)
}, },
/* 接口请求-start */ /* 接口请求-start */
getParams() {
return {
...this.searchForm,
...util.formatTime(this.searchTimes)
}
},
getUserList() { getUserList() {
const params = this.getParams() Object.assign(this.searchForm, util.formatTime(this.searchTimes))
this.$refs.table.getList(params, 'userList', UserList) this.$refs.table.getList()
}, },
filterTag(value, row) { filterTag(value, row) {
return row.status === value return row.status === value
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!