积分竞拍,市场管理
This commit is contained in:
@@ -3,6 +3,7 @@
|
||||
// 引入依赖
|
||||
import api from '@/api/market'
|
||||
import custom from '@/utils/custom'
|
||||
import capi from '@/api/common'
|
||||
import {formatDate} from '@/utils/format'
|
||||
import {ref,onMounted,provide } from 'vue'
|
||||
import { ElMessage, ElMessageBox } from 'element-plus'
|
||||
@@ -51,14 +52,25 @@ const total = ref(0)
|
||||
// })
|
||||
const question_id = ref(0)
|
||||
const content = ref(null)
|
||||
const teacher_ids = ref([])
|
||||
const manager_ids = ref([])
|
||||
const user_list = ref([])
|
||||
// 生命周期
|
||||
onMounted(() => {
|
||||
getManagerList()
|
||||
getUserList()
|
||||
})
|
||||
// provide('subjectList', subjectList)
|
||||
// provide('current_subject', current_subject)
|
||||
// 方法
|
||||
async function getUserList() {
|
||||
const res = await capi.getUserList({
|
||||
page:1,
|
||||
pageSize:1000
|
||||
})
|
||||
if(res.code === 0) {
|
||||
user_list.value = res.data.records
|
||||
}
|
||||
}
|
||||
async function getManagerList() {
|
||||
const res = await api.getManagerList(queryParams.value)
|
||||
if(res.code === 0) {
|
||||
@@ -85,8 +97,8 @@ const onReset = () => {
|
||||
}
|
||||
}
|
||||
async function onDelete() {
|
||||
const ids = teacher_ids.value
|
||||
const res = await api.delExamination({ teacher_ids:ids })
|
||||
const ids = manager_ids.value
|
||||
const res = await api.delManager({ manager_ids:ids })
|
||||
if (res.code === 0) {
|
||||
ElMessage({
|
||||
type: 'success',
|
||||
@@ -97,8 +109,8 @@ async function onDelete() {
|
||||
}
|
||||
}
|
||||
const handleSelectionChange = (val) => {
|
||||
teacher_ids.value = val.map((item) => {
|
||||
return item.teacher_info_id
|
||||
manager_ids.value = val.map((item) => {
|
||||
return item.user_id
|
||||
})
|
||||
}
|
||||
function handleCurrentChange(val) {
|
||||
@@ -112,7 +124,64 @@ function handleSizeChange(val) {
|
||||
function viewManagerFunc(row) { // 查看详情
|
||||
router.push({name:'managerDetail',params:{id:row.user_id}})
|
||||
}
|
||||
|
||||
async function delFunc(row) {
|
||||
ElMessageBox.confirm('此操作将永久删除该数据, 是否继续?', '提示', {
|
||||
confirmButtonText: '确定',
|
||||
cancelButtonText: '取消',
|
||||
type: 'warning'
|
||||
})
|
||||
.then(async() => {
|
||||
const res = await api.delManager({
|
||||
ids:[row.user_id]
|
||||
})
|
||||
if (res.code === 0) {
|
||||
ElMessage({
|
||||
type: 'success',
|
||||
message: '删除成功!'
|
||||
})
|
||||
getManagerList()
|
||||
}
|
||||
},() => {
|
||||
})
|
||||
}
|
||||
// 新增 & 编辑 相关
|
||||
const dialogVisible = ref(false)
|
||||
const mForm = ref({})
|
||||
const mFormRef = ref(null)
|
||||
const mFormRules = ref({
|
||||
province: [{ required: true, message: '请选择管辖区域', trigger: 'blur' }],
|
||||
user_id: [{ required: true, message: '请选择用户', trigger: 'blur' }]
|
||||
})
|
||||
function openDialog() {
|
||||
mForm.value = {}
|
||||
dialogVisible.value = true
|
||||
}
|
||||
function addOk() { // 添加主管
|
||||
submitForm(mFormRef.value)
|
||||
}
|
||||
async function submitForm(formEl) {
|
||||
if (!formEl) return
|
||||
await formEl.validate((valid, fields) => {
|
||||
if (valid) { // 验证通过
|
||||
// console.log('submit!')
|
||||
saveData()
|
||||
} else {
|
||||
// console.log('请填写完整信息!', fields)
|
||||
}
|
||||
})
|
||||
}
|
||||
async function saveData() {
|
||||
// console.log(mForm.value);return
|
||||
const res = await api.addManager(mForm.value)
|
||||
if(res.code === 0) {
|
||||
ElMessage({
|
||||
type: 'success',
|
||||
message: res.msg
|
||||
})
|
||||
getManagerList()
|
||||
dialogVisible.value = false
|
||||
}
|
||||
}
|
||||
</script>
|
||||
<template>
|
||||
<div>
|
||||
@@ -142,20 +211,26 @@ function viewManagerFunc(row) { // 查看详情
|
||||
<div class="gva-table-box">
|
||||
<!-- 批量操作-->
|
||||
<div class="gva-btn-list">
|
||||
<el-button size="small" type="primary" icon="plus" @click="openDialog('add')">新增</el-button>
|
||||
<el-button size="small" type="primary" icon="plus" @click="openDialog()">新增</el-button>
|
||||
<el-popover v-model="deleteVisible" placement="top" width="160">
|
||||
<p>确定要删除吗?</p>
|
||||
<div style="text-align: right; margin-top: 8px;">
|
||||
<el-button size="small" type="primary" link @click="deleteVisible = false">取消</el-button>
|
||||
<el-button size="small" type="primary" @click="onDelete">确定</el-button>
|
||||
</div>
|
||||
<template #reference>
|
||||
<el-button icon="delete" size="small" type="danger" :disabled="!manager_ids.length" style="margin-left: 10px;" @click="deleteVisible = true">删除</el-button>
|
||||
</template>
|
||||
</el-popover>
|
||||
</div>
|
||||
<!-- 数据列表-->
|
||||
<el-table :data="tableData" @selection-change="handleSelectionChange">
|
||||
<el-table-column
|
||||
type="selection"
|
||||
width="55"
|
||||
/>
|
||||
<el-table-column align="center" label="ID" prop="user_id" sortable="custom" />
|
||||
<el-table-column align="center" min-width="150" label="姓名" prop="nickname" />
|
||||
|
||||
<el-table-column align="center" label="开通时间" min-width="150" >
|
||||
<template #default="scope">
|
||||
{{formatDate(scope.row.CreatedAt)}}
|
||||
@@ -188,7 +263,7 @@ function viewManagerFunc(row) { // 查看详情
|
||||
size="small"
|
||||
type="danger"
|
||||
link
|
||||
@click="processFunc(scope.row,3)"
|
||||
@click="delFunc(scope.row)"
|
||||
>关闭</el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
@@ -205,8 +280,41 @@ function viewManagerFunc(row) { // 查看详情
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
<!-- 新增&编辑 窗口-->git
|
||||
|
||||
<!-- 新增&编辑 窗口-->
|
||||
<el-dialog
|
||||
v-model="dialogVisible"
|
||||
title="添加主管"
|
||||
width="30%"
|
||||
>
|
||||
<el-form ref="mFormRef" class="form-box" :model="mForm" :rules="mFormRules" label-width="80px">
|
||||
<el-form-item label="选择区域" prop="province">
|
||||
<el-select v-model="mForm.province" clearable placeholder="请选择">
|
||||
<el-option
|
||||
v-for="(item,index) in cityList"
|
||||
:key="item.ProID"
|
||||
:label="item.name"
|
||||
:value="index"
|
||||
/>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="用户ID" prop="user_id">
|
||||
<el-select v-model="mForm.user_id" clearable placeholder="请选择">
|
||||
<el-option
|
||||
v-for="(item,index) in user_list"
|
||||
:key="item.user_id"
|
||||
:label="item.nickname"
|
||||
:value="item.user_id"
|
||||
/>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
<template #footer>
|
||||
<span class="dialog-footer">
|
||||
<el-button @click="dialogVisible = false">取消</el-button>
|
||||
<el-button type="primary" @click="addOk">添加</el-button>
|
||||
</span>
|
||||
</template>
|
||||
</el-dialog>
|
||||
</div>
|
||||
</template>
|
||||
<style scoped lang="scss">
|
||||
|
Reference in New Issue
Block a user