You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

140 lines
4.9 KiB

3 years ago
<template>
<div class="main-content">
<div class="area-form">
</div>
<div class="button-tab">
3 years ago
<el-button size="default" type="primary" @click="goAdd"></el-button>
3 years ago
</div>
<div class="area-table">
<el-table :data="tableData.data" size="default" border
:header-cell-style="{background: '#EEE'}">
3 years ago
<el-table-column prop="title" label="规则名" width="360"></el-table-column>
3 years ago
<el-table-column prop="isDefault" :formatter="statusFormatter" label="是否默认"></el-table-column>
3 years ago
<el-table-column prop="creatAt" label="创建时间"></el-table-column>
<el-table-column prop="updateAt" label="更新时间"></el-table-column>
3 years ago
<el-table-column prop="action" label="操作" fixed="right" width="240">
<template #default="scope">
<el-link type="primary" @click="handlerEdit(scope.row.id)"></el-link>
3 years ago
<el-link type="primary" @click="setDefault(scope.row.id)" style="margin-left: 8px" v-if="scope.row.isDefault == null"></el-link>
<el-link type="danger" @click="singleDel(scope.row.id)" style="margin-left: 8px" v-if="scope.row.isDefault == null"></el-link>
3 years ago
</template>
</el-table-column>
</el-table>
<el-pagination
v-model:currentPage="pagination.current"
v-model:page-size="pagination.pageSize"
:page-sizes="[10, 20, 30, 40]"
background
layout="total, sizes, prev, pager, next, jumper"
:total="pagination.total"
/>
</div>
<el-drawer v-model="drawerVisible">
<template #header>
<span style="font-size: 16px;font-weight: bold">{{drawerData.activeType==1?'查看部门':'查看员工'}}</span>
</template>
<template #footer>
<el-button type="primary" @click="drawerVisible = false" size="default">确定</el-button>
</template>
</el-drawer>
</div>
</template>
<script>
3 years ago
import {defineComponent, reactive, ref, watch, getCurrentInstance} from 'vue'
3 years ago
import {statusFormatter} from './config.js'
export default defineComponent({
name: 'v-questList',
setup() {
const form = reactive({
type: undefined,
series: undefined,
tag: ''
});
const tableData = reactive({
data: [],
});
const pagination = reactive({
total: 0,
current: 1,
pageSize: 10
});
const setForm = reactive({
name: ''
});
const drawerVisible = ref(false);
3 years ago
const { proxy } = getCurrentInstance();
3 years ago
const drawerData = reactive({
activeId: undefined, //抽屉数据的当前id
activeType: undefined, //抽屉数据的当前类型 1,部门 2,员工
data: [],
});
return {
3 years ago
form,setForm,proxy,
3 years ago
tableData,
pagination,
statusFormatter,
3 years ago
drawerVisible,drawerData
3 years ago
}
},
mounted() {
this.getData();
watch(() => (this.pagination.pageSize), () => {
this.getData()
});
watch(() => (this.pagination.current), () => {
this.getData()
})
},
methods: {
getData() {
3 years ago
let obj = Object.assign({pageNum: this.pagination.current,pageSize: this.pagination.pageSize})
this.proxy.$post("/rewardRuleTemplate/list", obj).then(res => {
3 years ago
const data = res.data;
3 years ago
this.tableData.data = data;
}).catch(() => {});
3 years ago
},
addSet() {
},
handlerEdit(value) {
3 years ago
},
goAdd() {
this.$router.push({name: 'AddReward'})
},
//设为默认
setDefault(id) {
this.$alert(
'是否设为默认?', //文字
'设为默认', //标题
{type: 'info'}
).then(() => {
this.proxy.$post("/referenceRuleTemplate/setDefault", {id: id}).then(res => {
this.getData();
this.$message.success(res.data)
}).catch(() => {});
}).catch(() => {})
3 years ago
},
//删除
singleDel(id) {
this.$alert(
3 years ago
'是否删除?', //文字
3 years ago
'删除', //标题
{type: 'warning'}
).then(() => {
3 years ago
this.proxy.$post("/referenceRuleTemplate/del", {id: id}).then(res => {
this.getData();
this.$message.success(res.data)
}).catch(() => {});
3 years ago
}).catch(() => {})
}
}
})
</script>
<style lang="less" scoped>
.area-table {
margin-top: 16px
}
</style>