170 lines
3.9 KiB
Vue
170 lines
3.9 KiB
Vue
<!--
|
|
* @Author: your name
|
|
* @Date: 2021-07-14 08:58:11
|
|
* @LastEditTime: 2021-07-14 13:37:54
|
|
* @LastEditors: Please set LastEditors
|
|
* @Description: In User Settings Edit
|
|
* @FilePath: \mt-bus-fe\src\views\team-manage\showlog.vue
|
|
-->
|
|
<template>
|
|
<div class="app-container">
|
|
<el-form
|
|
:model="formData"
|
|
:inline="true"
|
|
size="medium"
|
|
label-width="80px"
|
|
>
|
|
<el-form-item>
|
|
<el-button type="primary" @click="addNew()"> {{ 'btn.add' | i18nFilter }} </el-button>
|
|
</el-form-item>
|
|
</el-form>
|
|
<base-table
|
|
:page="listQuery.current"
|
|
:limit="listQuery.size"
|
|
:table-config="tableProps"
|
|
:table-data="list"
|
|
:is-loading="listLoading"
|
|
>
|
|
<method-btn
|
|
slot="handleBtn"
|
|
:width="trueWidth"
|
|
:method-list="tableBtn"
|
|
@clickBtn="handleClick"
|
|
/>
|
|
</base-table>
|
|
<pagination
|
|
v-show="total > 0"
|
|
:total="total"
|
|
:page.sync="formData.current"
|
|
:limit.sync="formData.size"
|
|
@pagination="getList()"
|
|
/>
|
|
<log-add v-if="addOrUpdateVisible" ref="addOrUpdate" @refreshDataList="getList" />
|
|
</div>
|
|
</template>
|
|
|
|
<script>
|
|
const tableBtn = [
|
|
{
|
|
type: 'edit',
|
|
btnName: 'btn.edit'
|
|
},
|
|
{
|
|
type: 'delete',
|
|
btnName: 'btn.delete'
|
|
}
|
|
]
|
|
const tableProps = [
|
|
{
|
|
prop: 'remark',
|
|
label: i18n.t('module.teamManager.showLog.title'),
|
|
align: 'center'
|
|
},
|
|
{
|
|
prop: 'content',
|
|
label: i18n.t('module.teamManager.showLog.content'),
|
|
align: 'center',
|
|
filter: handleLimit
|
|
},
|
|
{
|
|
prop: 'type',
|
|
label: i18n.t('module.teamManager.showLog.type'),
|
|
align: 'center'
|
|
},
|
|
{
|
|
prop: 'happenTime',
|
|
label: i18n.t('module.teamManager.showLog.happenTime'),
|
|
align: 'center',
|
|
filter: timeFormatter
|
|
}
|
|
]
|
|
import i18n from '@/lang'
|
|
import BaseTable from '@/components/BaseTable'
|
|
import Pagination from '@/components/Pagination' // Secondary package based on el-pagination
|
|
import { showLogPage, delData } from '@/api/team-manage/team.js'
|
|
import logAdd from './log-add.vue'
|
|
import MethodBtn from '@/components/BaseTable/subcomponents/MethodBtn'
|
|
import { handleLimit, timeFormatter } from '@/filters'
|
|
export default {
|
|
components: { BaseTable, MethodBtn, Pagination, logAdd },
|
|
data() {
|
|
return {
|
|
value: {},
|
|
tableProps,
|
|
tableData: [],
|
|
listQuery: {
|
|
current: 1,
|
|
size: 10
|
|
},
|
|
formData: {
|
|
current: 1,
|
|
size: 10,
|
|
id: this.$route.query.id
|
|
},
|
|
list: [],
|
|
total: 0,
|
|
tableBtn,
|
|
trueWidth: 200,
|
|
listLoading: true,
|
|
addOrUpdateVisible: false
|
|
}
|
|
},
|
|
mounted() {
|
|
this.getList()
|
|
},
|
|
methods: {
|
|
handleClick(raw) {
|
|
if (raw.type === 'delete') {
|
|
this.$confirm(i18n.t('deleteMsgBox.content'), i18n.t('deleteMsgBox.hint'), {
|
|
confirmButtonText: i18n.t('btn.confirm'),
|
|
cancelButtonText: i18n.t('btn.cancel'),
|
|
type: 'warning'
|
|
}).then(() => {
|
|
// eslint-disable-next-line no-undef
|
|
delData({ id: raw.data.id }).then(response => {
|
|
this.$message({
|
|
message: this.$t('module.basicData.visual.success'),
|
|
type: 'success',
|
|
duration: 1500,
|
|
onClose: () => {
|
|
this.getList()
|
|
}
|
|
})
|
|
})
|
|
}).catch(() => {})
|
|
} else {
|
|
this.addNew(raw.data.id)
|
|
}
|
|
},
|
|
getList() {
|
|
showLogPage(this.formData).then(response => {
|
|
if (response.data.records) {
|
|
this.list = response.data.records
|
|
} else {
|
|
this.list.splice(0, this.list.length)
|
|
}
|
|
this.total = response.data.total
|
|
this.listLoading = false
|
|
})
|
|
},
|
|
addNew(id) {
|
|
this.addOrUpdateVisible = true
|
|
this.$nextTick(() => {
|
|
this.$refs.addOrUpdate.init(id)
|
|
})
|
|
}
|
|
}
|
|
}
|
|
</script>
|
|
|
|
<style scoped>
|
|
.edit-input {
|
|
padding-right: 100px;
|
|
}
|
|
.cancel-btn {
|
|
position: absolute;
|
|
right: 15px;
|
|
top: 10px;
|
|
}
|
|
</style>
|