mirror of
https://gitee.com/XiaoLFeng/JSL_OrganizeInternalOA_Web.git
synced 2025-06-08 11:43:04 +08:00
管理界面完善4.
This commit is contained in:
parent
7fca3dc49d
commit
edac900c0b
@ -105,18 +105,29 @@
|
|||||||
<p>请问是否要删除xxx数据</p>
|
<p>请问是否要删除xxx数据</p>
|
||||||
</Modal>
|
</Modal>
|
||||||
|
|
||||||
<Modal v-model="addDialog" title="新增用户信息" @on-ok="addOk" @on-cancel="addCancel" >
|
<Modal v-model="addDialog" title="新增轮播图信息" @on-ok="addOk" @on-cancel="addCancel" >
|
||||||
<div>
|
<div>
|
||||||
<div>用户名:<Input v-model="addData.username" placeholder="Enter something..." style="width: 250px; margin-bottom: 10px" /></div>
|
|
||||||
<div style="margin-left: 15px">密码:<Input v-model="addData.password" placeholder="Enter something..." style="width: 250px; margin-bottom: 10px" type="password"/></div>
|
<div style="margin-left: 15px">描述:<Input v-model="addData.password" placeholder="Enter something..." style="width: 350px; margin-bottom: 10px" type="password"/></div>
|
||||||
<div style="margin-left: 15px">地址:<Input v-model="addData.address" placeholder="Enter something..." style="width: 250px; margin-bottom: 10px" /></div>
|
<div style="margin-left: 15px">标题:<Input v-model="addData.address" placeholder="Enter something..." style="width: 350px; margin-bottom: 10px" /></div>
|
||||||
<div style="margin-left: 15px">电话:<Input v-model="addData.phone" placeholder="Enter something..." style="width: 250px; margin-bottom: 10px" /></div>
|
<div style="margin-left: 15px">图片:
|
||||||
<div style="margin-left: 15px">邮箱:<Input v-model="addData.email" placeholder="Enter something..." style="width: 250px; margin-bottom: 10px" /></div>
|
<Upload action="//jsonplaceholder.typicode.com/posts/" style="margin-left: 40px">
|
||||||
<div style="margin-left: 15px">性别: <RadioGroup v-model="sex" style="margin-bottom: 10px">
|
<Button icon="ios-cloud-upload-outline" >上传图片</Button>
|
||||||
<Radio label='男'></Radio>
|
<span style="font-size: 10px ;margin-left: 20px">图片大小参考:轮播图750*450</span>
|
||||||
<Radio label='女'></Radio>
|
|
||||||
|
</Upload>
|
||||||
|
</div>
|
||||||
|
<div style="margin-left: 15px">排序:<Input v-model="addData.age" placeholder="Enter something..." style="width: 350px" type="number" />
|
||||||
|
<br>
|
||||||
|
<span style="font-size: 10px">从大到小</span>
|
||||||
|
</div>
|
||||||
|
<div style="margin-left: 15px">有效时间:<Input v-model="addData.email" placeholder="Enter something..." style="width: 350px; margin-bottom: 10px" /></div>
|
||||||
|
<div style="margin-left: 15px">状态:
|
||||||
|
<RadioGroup v-model="sex" style="margin-bottom: 10px;margin-top: 10px">
|
||||||
|
<Radio label='展示'></Radio>
|
||||||
|
<Radio label='未展示'></Radio>
|
||||||
</RadioGroup></div>
|
</RadioGroup></div>
|
||||||
<div style="margin-left: 15px">年龄:<Input v-model="addData.age" placeholder="Enter something..." style="width: 250px" type="number" /></div>
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@ -164,6 +175,12 @@ const columns = reactive( [
|
|||||||
width: 150,
|
width: 150,
|
||||||
align: "center"
|
align: "center"
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
title: "有效时间",
|
||||||
|
key: "imageAddress",
|
||||||
|
width: 150,
|
||||||
|
align: "center"
|
||||||
|
},
|
||||||
{
|
{
|
||||||
title: "图片地址",
|
title: "图片地址",
|
||||||
key: "imageAddress",
|
key: "imageAddress",
|
||||||
@ -174,6 +191,10 @@ const columns = reactive( [
|
|||||||
title: "描述",
|
title: "描述",
|
||||||
key: "description",
|
key: "description",
|
||||||
align: "center"
|
align: "center"
|
||||||
|
}, {
|
||||||
|
title: "排序",
|
||||||
|
key: "description",
|
||||||
|
align: "center"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
title: "状态",
|
title: "状态",
|
||||||
|
@ -1,3 +1,429 @@
|
|||||||
|
<style scoped>
|
||||||
|
.addinput{
|
||||||
|
//display: flex;
|
||||||
|
//flex-direction: column;
|
||||||
|
//justify-content: center;
|
||||||
|
//align-content: center;
|
||||||
|
}
|
||||||
|
|
||||||
|
.addinput>div>input{
|
||||||
|
/*width:300px ;*/
|
||||||
|
/*height: 30px;*/
|
||||||
|
/*border-radius: 5px;*/
|
||||||
|
//margin: 0 auto;
|
||||||
|
//outline-color: #94beae;
|
||||||
|
|
||||||
|
}
|
||||||
|
</style>
|
||||||
<template>
|
<template>
|
||||||
this is 日报消息管理
|
<div style="width: 87vw;height:90vh;position: relative;margin: 0;padding: 0">
|
||||||
|
<div style="padding:20px 10px;">
|
||||||
|
<Space>
|
||||||
|
<span>模块名:</span>
|
||||||
|
<Input v-model="searchData.username" prefix="ios-contact" placeholder="modalNmae" clearable style="width: 200px" />
|
||||||
|
<span>报告时间:</span>
|
||||||
|
<TimePicker type="timerange" placement="bottom-end" placeholder="Select time" style="width: 168px" />
|
||||||
|
<Button @click="searchUser" type="primary" shape="circle" icon="ios-search">查询</Button>
|
||||||
|
<Button type="primary" ghost @click="showAddDialog">新增</Button>
|
||||||
|
|
||||||
|
</Space>
|
||||||
|
</div>
|
||||||
|
<!-- 表格内容-->
|
||||||
|
<div style="width: 87vw; height: 78vh; margin: 0; padding: 0">
|
||||||
|
<Table border :loading="loadingTable" ref="selection" :columns="columns" :data="states.data" style="height: 72vh ;text-align: center;" :row-class-name="setRowClassName" >
|
||||||
|
|
||||||
|
|
||||||
|
<template #status="{ row, index }">
|
||||||
|
<Switch size="large" v-model="states.data[index].accountNoLocked" :before-change="handleBeforeSwitchChange">
|
||||||
|
<template #open>
|
||||||
|
<span>开启</span>
|
||||||
|
</template>
|
||||||
|
<template #close>
|
||||||
|
<span>关闭</span>
|
||||||
|
</template>
|
||||||
|
</Switch>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<template #action="{ row, index }">
|
||||||
|
<Button type="primary" size="small" style="margin-right: 5px" @click="showEditDialog(index, row)">详情</Button>
|
||||||
|
<Button type="error" size="small" @click="showDeleteDialog(index, row)">删除</Button>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
|
||||||
|
</Table>
|
||||||
|
<div style="height: 6vh ;text-align: left;padding-top: 20px">
|
||||||
|
<Page :total="states.data.length" size="small" show-elevator show-sizer />
|
||||||
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<!-- 对话框-->
|
||||||
|
<div>
|
||||||
|
<Modal
|
||||||
|
v-model="editDialog"
|
||||||
|
title="编辑"
|
||||||
|
@on-ok="editOk"
|
||||||
|
@on-cancel="editCancel">
|
||||||
|
<div style="">
|
||||||
|
<div style="margin-bottom: 10px">
|
||||||
|
<span>
|
||||||
|
模块名称:<Input v-model="updateData.modalName" placeholder="Enter something..." style="width: 200px" />
|
||||||
|
</span>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
<div style="margin-bottom: 10px">
|
||||||
|
<span style="margin-left: 0">
|
||||||
|
所属角色:
|
||||||
|
<Select v-model="roleSingle" style="width:200px">
|
||||||
|
<Option v-for="item in cityList" :value="item.value" :key="item.value">{{ item.label }}</Option>
|
||||||
|
</Select>
|
||||||
|
</span>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div style="margin-bottom: 10px">工作进度: <Progress :percent="percent" />
|
||||||
|
<ButtonGroup size="large">
|
||||||
|
<Button icon="ios-add" @click="add"></Button>
|
||||||
|
<Button icon="ios-remove" @click="minus"></Button>
|
||||||
|
</ButtonGroup></div>
|
||||||
|
|
||||||
|
<div style="margin-bottom: 10px">报告时间:<Input v-model="updateData.address" placeholder="Enter something..." style="width: 435px" /></div>
|
||||||
|
|
||||||
|
<div style="margin-bottom: 10px">工作内容:<Input v-model="updateData.description" type="textarea" placeholder="Enter something..." style="width: 435px" /></div>
|
||||||
|
</div>
|
||||||
|
</Modal>
|
||||||
|
|
||||||
|
|
||||||
|
<Modal
|
||||||
|
v-model="deleteDialog"
|
||||||
|
title="删除"
|
||||||
|
@on-ok="deleteOk"
|
||||||
|
@on-cancel="deleteCancel">
|
||||||
|
<p>请问是否要删除xxx数据</p>
|
||||||
|
</Modal>
|
||||||
|
|
||||||
|
<Modal v-model="addDialog" title="新增日报信息" @on-ok="addOk" @on-cancel="addCancel" >
|
||||||
|
<div>
|
||||||
|
<div style="margin-left: 15px">模块名称:<Input v-model="addData.username" placeholder="Enter something..." style="width: 250px; margin-bottom: 10px" /></div>
|
||||||
|
|
||||||
|
<div style="margin-left: 15px">工作进度:
|
||||||
|
<Progress :percent="percent" />
|
||||||
|
<ButtonGroup size="large">
|
||||||
|
<Button icon="ios-add" @click="add"></Button>
|
||||||
|
<Button icon="ios-remove" @click="minus"></Button>
|
||||||
|
</ButtonGroup>
|
||||||
|
</div>
|
||||||
|
<div style="margin-left: 15px;margin-bottom: 10px">快捷选进度:
|
||||||
|
<RadioGroup v-model="buttonSize" type="button">
|
||||||
|
<Radio label="large">20%</Radio>
|
||||||
|
<Radio label="default">60%</Radio>
|
||||||
|
<Radio label="small">100%</Radio>
|
||||||
|
</RadioGroup>
|
||||||
|
</div>
|
||||||
|
<div style="margin-left: 15px">工作内容:<Input v-model="addData.password" placeholder="Enter something..." style="width: 400px; margin-bottom: 10px;" type="textarea"/></div>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</Modal>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
|
<script setup>
|
||||||
|
import {ButtonGroup, Page, Radio, RadioGroup, Space, Switch, TimePicker} from "view-ui-plus";
|
||||||
|
import requests from "../../public/request.js"
|
||||||
|
import {reactive, ref} from "vue";
|
||||||
|
import message from "view-ui-plus/src/components/message/index.js";
|
||||||
|
import {onMounted, onBeforeUpdate} from "vue";
|
||||||
|
import modal from "view-ui-plus/src/components/modal/index.js";
|
||||||
|
|
||||||
|
const currentPage = ref(1) // 当前页码
|
||||||
|
const pageSize = ref(10) // 每页显示的数据条数
|
||||||
|
const addDialog = ref(false)
|
||||||
|
const deleteDialog = ref(false)
|
||||||
|
const editDialog = ref(false)
|
||||||
|
const percent =ref(0)
|
||||||
|
const token = window.localStorage.getItem('token')
|
||||||
|
const AllUser = reactive({
|
||||||
|
page:1,
|
||||||
|
limit: 10,
|
||||||
|
search: null,
|
||||||
|
role: null
|
||||||
|
})
|
||||||
|
const columns = reactive( [
|
||||||
|
{
|
||||||
|
type: "selection",
|
||||||
|
width: 60,
|
||||||
|
align: "center"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: "模块名称",
|
||||||
|
key: "username",
|
||||||
|
align: "center"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: "工作内容",
|
||||||
|
key: "jobId",
|
||||||
|
width: 150,
|
||||||
|
align: "center"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: "工作进度",
|
||||||
|
key: "phone",
|
||||||
|
width: 150,
|
||||||
|
align: "center"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: "报告时间",
|
||||||
|
key: "email",
|
||||||
|
align: "center"
|
||||||
|
},
|
||||||
|
// {
|
||||||
|
// title: "状态",
|
||||||
|
// slot: "status",
|
||||||
|
// width: 100,
|
||||||
|
// align: "center",
|
||||||
|
// },
|
||||||
|
{
|
||||||
|
title: "操作",
|
||||||
|
slot: "action",
|
||||||
|
width: 150,
|
||||||
|
align: "center"
|
||||||
|
}
|
||||||
|
])
|
||||||
|
const states = reactive({
|
||||||
|
data:[]
|
||||||
|
})
|
||||||
|
const loadingTable = ref(true)
|
||||||
|
const sex = ref('男')
|
||||||
|
const roleSingle = ref(1)
|
||||||
|
const updateData = reactive({
|
||||||
|
id: 0,
|
||||||
|
username: '',
|
||||||
|
address: '',
|
||||||
|
phone: '',
|
||||||
|
email: '',
|
||||||
|
age: '',
|
||||||
|
signature: '',
|
||||||
|
sex: '',
|
||||||
|
avatar: '',
|
||||||
|
nickname: '',
|
||||||
|
description: '',
|
||||||
|
enabled: true,
|
||||||
|
isExpired: false,
|
||||||
|
passwordExpired: false,
|
||||||
|
recommend: false,
|
||||||
|
isLocked: false
|
||||||
|
})
|
||||||
|
const cityList= reactive([
|
||||||
|
{
|
||||||
|
value: 1,
|
||||||
|
label: '管理员'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
value: 2,
|
||||||
|
label: '老师'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
value: 3,
|
||||||
|
label: '学生'
|
||||||
|
}
|
||||||
|
])
|
||||||
|
const userLock = reactive({
|
||||||
|
id: -1,
|
||||||
|
isLock: 1
|
||||||
|
})
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 配置代码
|
||||||
|
*/
|
||||||
|
message.config({
|
||||||
|
background: true
|
||||||
|
})
|
||||||
|
function setRowClassName(row, index) {
|
||||||
|
return 'custom-row';
|
||||||
|
}
|
||||||
|
|
||||||
|
onMounted(() => {
|
||||||
|
getAll()
|
||||||
|
})
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 方法函数
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
function add () {
|
||||||
|
if (percent.value >= 100) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
percent.value += 10;
|
||||||
|
}
|
||||||
|
function minus () {
|
||||||
|
if (percent.value <= 0) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
percent.value -= 10;
|
||||||
|
}
|
||||||
|
function getAll() {
|
||||||
|
|
||||||
|
requests.userAllCurrent(AllUser,token).then((res)=>{
|
||||||
|
console.log(res)
|
||||||
|
// states.data = res.data.data
|
||||||
|
// console.log(res.data.data)
|
||||||
|
loadingTable.value = false
|
||||||
|
for (let i = 0; i < res.data.data.length; i++) {
|
||||||
|
states.data[i] = res.data.data[i].user
|
||||||
|
}
|
||||||
|
console.log("getAll:",states.data)
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
function handleBeforeSwitchChange(index, row) {
|
||||||
|
return new Promise((resolve) => {
|
||||||
|
this.$Modal.confirm({
|
||||||
|
title: '切换确认',
|
||||||
|
content: '您确认要切换开关状态吗?',
|
||||||
|
onOk: () => {
|
||||||
|
resolve();
|
||||||
|
message.success('切换成功')
|
||||||
|
}
|
||||||
|
})
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
function handlePageChange(newPage) {
|
||||||
|
this.currentPage = newPage; // 更新当前页码
|
||||||
|
}
|
||||||
|
|
||||||
|
const addData = reactive({
|
||||||
|
username: '',
|
||||||
|
password: '',
|
||||||
|
address: '',
|
||||||
|
phone: '',
|
||||||
|
email: '',
|
||||||
|
sex: 1,
|
||||||
|
age: ''
|
||||||
|
})
|
||||||
|
function showAddDialog(){
|
||||||
|
addDialog.value = true
|
||||||
|
|
||||||
|
}
|
||||||
|
function addOk () {
|
||||||
|
if (sex.value === '男') {
|
||||||
|
addData.sex = 1
|
||||||
|
}else {
|
||||||
|
addData.sex = 0
|
||||||
|
}
|
||||||
|
requests.userAdd(addData, token).then((res)=>{
|
||||||
|
if (res.data.code===200) {
|
||||||
|
message.success('新增成功')
|
||||||
|
getAll()
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
message.error('新增失败')
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
function addCancel () {
|
||||||
|
message.info('取消新增')
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
const deleteId = ref(0)
|
||||||
|
function showDeleteDialog(index, row){
|
||||||
|
deleteDialog.value = true
|
||||||
|
deleteId.value = row.id
|
||||||
|
}
|
||||||
|
function deleteOk(){
|
||||||
|
deleteDialog.value = false;
|
||||||
|
console.log(deleteId.value)
|
||||||
|
requests.userDelete(deleteId.value, token).then((res)=>{
|
||||||
|
console.log("deleteResult:",res)
|
||||||
|
if (res.data.code === 200) {
|
||||||
|
message.success('删除成功')
|
||||||
|
}else {
|
||||||
|
message.error('删除失败')
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
}
|
||||||
|
function deleteCancel(){
|
||||||
|
deleteDialog.value = false;
|
||||||
|
message.info('取消删除')
|
||||||
|
}
|
||||||
|
|
||||||
|
function showEditDialog(index, row){
|
||||||
|
editDialog.value = true
|
||||||
|
updateData.id = row.id
|
||||||
|
updateData.username = row.username
|
||||||
|
updateData.address = row.address
|
||||||
|
updateData.phone = row.phone
|
||||||
|
updateData.email = row.email
|
||||||
|
updateData.age = row.age
|
||||||
|
updateData.signature = row.signature
|
||||||
|
updateData.sex = row.sex
|
||||||
|
updateData.avatar = row.avatar
|
||||||
|
updateData.nickname = row.nickname
|
||||||
|
updateData.description = row.description
|
||||||
|
if (row.sex === 1) {
|
||||||
|
sex.value = '男'
|
||||||
|
}else {
|
||||||
|
sex.value = '女'
|
||||||
|
}
|
||||||
|
}
|
||||||
|
function editOk(){
|
||||||
|
loadingTable.value = true
|
||||||
|
editDialog.value = false;
|
||||||
|
requests.userEdit(updateData,token).then((res)=>{
|
||||||
|
console.log("editResult:",res)
|
||||||
|
console.log("updateData:",updateData)
|
||||||
|
if (res.data.code === 200) {
|
||||||
|
getAll()
|
||||||
|
message.success('修改成功')
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
loadingTable.value = false
|
||||||
|
message.error('修改失败')
|
||||||
|
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
}
|
||||||
|
function editCancel(){
|
||||||
|
editDialog.value = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
const searchData = reactive({
|
||||||
|
username: '',
|
||||||
|
phone: ''
|
||||||
|
})
|
||||||
|
function searchUser(){
|
||||||
|
loadingTable.value = true
|
||||||
|
if (searchData.username === '' && searchData.phone === '') {
|
||||||
|
getAll()
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
requests.userCurrent(searchData,token).then((res)=>{
|
||||||
|
loadingTable.value = false
|
||||||
|
console.log("searchResult:",res)
|
||||||
|
if (res.data.code === 200) {
|
||||||
|
states.data = []
|
||||||
|
states.data[0] = res.data.data.user
|
||||||
|
message.success('查询成功')
|
||||||
|
console.log(loadingTable.value)
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
message.error(res.data.message)
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
</script>
|
@ -1,3 +1,427 @@
|
|||||||
|
<style scoped>
|
||||||
|
.addinput{
|
||||||
|
//display: flex;
|
||||||
|
//flex-direction: column;
|
||||||
|
//justify-content: center;
|
||||||
|
//align-content: center;
|
||||||
|
}
|
||||||
|
|
||||||
|
.addinput>div>input{
|
||||||
|
/*width:300px ;*/
|
||||||
|
/*height: 30px;*/
|
||||||
|
/*border-radius: 5px;*/
|
||||||
|
//margin: 0 auto;
|
||||||
|
//outline-color: #94beae;
|
||||||
|
|
||||||
|
}
|
||||||
|
</style>
|
||||||
<template>
|
<template>
|
||||||
this is 日志消息
|
<div style="width: 87vw;height:90vh;position: relative;margin: 0;padding: 0">
|
||||||
|
<div style="padding:20px 10px;">
|
||||||
|
<Space>
|
||||||
|
<span>项目名称:</span>
|
||||||
|
<Input v-model="searchData.username" prefix="ios-contact" placeholder="projectName" clearable style="width: 200px" />
|
||||||
|
<span>接口地址:</span>
|
||||||
|
<Input v-model="searchData.phone" placeholder="Enter address" style="width: auto" />
|
||||||
|
<Button @click="searchUser" type="primary" shape="circle" icon="ios-search">查询</Button>
|
||||||
|
<Button type="primary" ghost @click="showAddDialog">新增</Button>
|
||||||
|
|
||||||
|
</Space>
|
||||||
|
</div>
|
||||||
|
<!-- 表格内容-->
|
||||||
|
<div style="width: 87vw; height: 78vh; margin: 0; padding: 0">
|
||||||
|
<Table border :loading="loadingTable" ref="selection" :columns="columns" :data="states.data" style="height: 72vh ;text-align: center;" :row-class-name="setRowClassName" >
|
||||||
|
|
||||||
|
|
||||||
|
<template #status="{ row, index }">
|
||||||
|
<Switch size="large" v-model="states.data[index].accountNoLocked" :before-change="handleBeforeSwitchChange">
|
||||||
|
<template #open>
|
||||||
|
<span>开启</span>
|
||||||
|
</template>
|
||||||
|
<template #close>
|
||||||
|
<span>关闭</span>
|
||||||
|
</template>
|
||||||
|
</Switch>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<template #action="{ row, index }">
|
||||||
|
<Button type="primary" size="small" style="margin-right: 5px" @click="showEditDialog(index, row)">详情</Button>
|
||||||
|
<Button type="error" size="small" @click="showDeleteDialog(index, row)">删除</Button>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
|
||||||
|
</Table>
|
||||||
|
<div style="height: 6vh ;text-align: left;padding-top: 20px">
|
||||||
|
<Page :total="states.data.length" size="small" show-elevator show-sizer />
|
||||||
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<!-- 对话框-->
|
||||||
|
<div>
|
||||||
|
<Modal
|
||||||
|
v-model="editDialog"
|
||||||
|
title="编辑"
|
||||||
|
@on-ok="editOk"
|
||||||
|
@on-cancel="editCancel">
|
||||||
|
<div style="">
|
||||||
|
<div style="margin-bottom: 10px">
|
||||||
|
<span>
|
||||||
|
项目名:<Input v-model="updateData.username" placeholder="Enter something..." style="width: 180px" />
|
||||||
|
</span>
|
||||||
|
<span>
|
||||||
|
状态:
|
||||||
|
<RadioGroup v-model="sex">
|
||||||
|
<Radio label="正常"></Radio>
|
||||||
|
<Radio label="停用"></Radio>
|
||||||
|
</RadioGroup>
|
||||||
|
</span>
|
||||||
|
<span style="margin-left: 20px;">
|
||||||
|
<div style="margin-bottom: 10px">接口地址:<Input v-model="updateData.email" placeholder="Enter something..." style="width: 435px" /></div>
|
||||||
|
|
||||||
|
</span>
|
||||||
|
</div>
|
||||||
|
<div style="margin-bottom: 10px">
|
||||||
|
|
||||||
|
<!-- <span style="margin-left: 98px">-->
|
||||||
|
<!-- 角色:-->
|
||||||
|
<!-- <Select v-model="roleSingle" style="width:200px">-->
|
||||||
|
<!-- <Option v-for="item in cityList" :value="item.value" :key="item.value">{{ item.label }}</Option>-->
|
||||||
|
<!-- </Select>-->
|
||||||
|
<!-- </span>-->
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div style="margin-bottom: 10px">响应状态:<Input v-model="updateData.email" placeholder="Enter something..." style="width: 435px" /></div>
|
||||||
|
|
||||||
|
<div style="margin-bottom: 10px">响应耗时:<Input v-model="updateData.address" placeholder="Enter something..." style="width: 435px" /></div>
|
||||||
|
<div style="margin-bottom: 10px">发起时间:<Input v-model="updateData.address" placeholder="Enter something..." style="width: 435px" /></div>
|
||||||
|
<div style="margin-bottom: 10px">响应时间:<Input v-model="updateData.address" placeholder="Enter something..." style="width: 435px" /></div>
|
||||||
|
|
||||||
|
<div style="margin-bottom: 10px">日志详情:<Input v-model="updateData.description" type="textarea" placeholder="Enter something..." style="width: 435px" /></div>
|
||||||
|
</div>
|
||||||
|
</Modal>
|
||||||
|
|
||||||
|
|
||||||
|
<Modal
|
||||||
|
v-model="deleteDialog"
|
||||||
|
title="删除"
|
||||||
|
@on-ok="deleteOk"
|
||||||
|
@on-cancel="deleteCancel">
|
||||||
|
<p>请问是否要删除xxx数据</p>
|
||||||
|
</Modal>
|
||||||
|
|
||||||
|
<Modal v-model="addDialog" title="新增日志信息" @on-ok="addOk" @on-cancel="addCancel" >
|
||||||
|
<div>
|
||||||
|
<div style="margin-left: 15px">接口地址:<Input v-model="addData.address" placeholder="Enter something..." style="width: 250px; margin-bottom: 10px" /></div>
|
||||||
|
<div style="margin-left: 15px">响应状态:<Input v-model="addData.password" placeholder="Enter something..." style="width: 250px; margin-bottom: 10px" type="password"/></div>
|
||||||
|
<div style="margin-left: 15px">响应耗时:<Input v-model="addData.address" placeholder="Enter something..." style="width: 250px; margin-bottom: 10px" /></div>
|
||||||
|
<div style="margin-left: 15px">发起时间:<Input v-model="addData.phone" placeholder="Enter something..." style="width: 250px; margin-bottom: 10px" /></div>
|
||||||
|
<div style="margin-left: 15px">响应时间:<Input v-model="addData.email" placeholder="Enter something..." style="width: 250px; margin-bottom: 10px" /></div>
|
||||||
|
<!-- <div style="margin-left: 15px">: <RadioGroup v-model="sex" style="margin-bottom: 10px">-->
|
||||||
|
<!-- <Radio label='男'></Radio>-->
|
||||||
|
<!-- <Radio label='女'></Radio>-->
|
||||||
|
<!-- </RadioGroup></div>-->
|
||||||
|
<div style="margin-left: 15px">项目名称:<Input v-model="addData.age" placeholder="Enter something..." style="width: 250px" type="number" /></div>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</Modal>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
|
<script setup>
|
||||||
|
import {Page, Radio, RadioGroup, Space, Switch} from "view-ui-plus";
|
||||||
|
import requests from "../../public/request.js"
|
||||||
|
import {reactive, ref} from "vue";
|
||||||
|
import message from "view-ui-plus/src/components/message/index.js";
|
||||||
|
import {onMounted, onBeforeUpdate} from "vue";
|
||||||
|
import modal from "view-ui-plus/src/components/modal/index.js";
|
||||||
|
|
||||||
|
const currentPage = ref(1) // 当前页码
|
||||||
|
const pageSize = ref(10) // 每页显示的数据条数
|
||||||
|
const addDialog = ref(false)
|
||||||
|
const deleteDialog = ref(false)
|
||||||
|
const editDialog = ref(false)
|
||||||
|
const token = window.localStorage.getItem('token')
|
||||||
|
const AllUser = reactive({
|
||||||
|
page:1,
|
||||||
|
limit: 10,
|
||||||
|
search: null,
|
||||||
|
role: null
|
||||||
|
})
|
||||||
|
const columns = reactive( [
|
||||||
|
{
|
||||||
|
type: "selection",
|
||||||
|
width: 60,
|
||||||
|
align: "center"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: "接口地址",
|
||||||
|
key: "username",
|
||||||
|
align: "center"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: "响应状态",
|
||||||
|
key: "jobId",
|
||||||
|
width: 150,
|
||||||
|
align: "center"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: "响应耗时",
|
||||||
|
key: "phone",
|
||||||
|
width: 150,
|
||||||
|
align: "center"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: "发起时间",
|
||||||
|
key: "email",
|
||||||
|
align: "center"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: "响应时间",
|
||||||
|
key: "email",
|
||||||
|
align: "center"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: "项目名称",
|
||||||
|
key: "",
|
||||||
|
align: "center"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: "状态",
|
||||||
|
slot: "status",
|
||||||
|
width: 100,
|
||||||
|
align: "center",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: "操作",
|
||||||
|
slot: "action",
|
||||||
|
width: 150,
|
||||||
|
align: "center"
|
||||||
|
}
|
||||||
|
])
|
||||||
|
const states = reactive({
|
||||||
|
data:[]
|
||||||
|
})
|
||||||
|
const loadingTable = ref(true)
|
||||||
|
const sex = ref('男')
|
||||||
|
const roleSingle = ref(1)
|
||||||
|
const updateData = reactive({
|
||||||
|
id: 0,
|
||||||
|
username: '',
|
||||||
|
address: '',
|
||||||
|
phone: '',
|
||||||
|
email: '',
|
||||||
|
age: '',
|
||||||
|
signature: '',
|
||||||
|
sex: '',
|
||||||
|
avatar: '',
|
||||||
|
nickname: '',
|
||||||
|
description: '',
|
||||||
|
enabled: true,
|
||||||
|
isExpired: false,
|
||||||
|
passwordExpired: false,
|
||||||
|
recommend: false,
|
||||||
|
isLocked: false
|
||||||
|
})
|
||||||
|
const cityList= reactive([
|
||||||
|
{
|
||||||
|
value: 1,
|
||||||
|
label: '管理员'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
value: 2,
|
||||||
|
label: '老师'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
value: 3,
|
||||||
|
label: '学生'
|
||||||
|
}
|
||||||
|
])
|
||||||
|
const userLock = reactive({
|
||||||
|
id: -1,
|
||||||
|
isLock: 1
|
||||||
|
})
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 配置代码
|
||||||
|
*/
|
||||||
|
message.config({
|
||||||
|
background: true
|
||||||
|
})
|
||||||
|
function setRowClassName(row, index) {
|
||||||
|
return 'custom-row';
|
||||||
|
}
|
||||||
|
|
||||||
|
onMounted(() => {
|
||||||
|
getAll()
|
||||||
|
})
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 方法函数
|
||||||
|
*/
|
||||||
|
|
||||||
|
function getAll() {
|
||||||
|
|
||||||
|
requests.userAllCurrent(AllUser,token).then((res)=>{
|
||||||
|
console.log(res)
|
||||||
|
// states.data = res.data.data
|
||||||
|
// console.log(res.data.data)
|
||||||
|
loadingTable.value = false
|
||||||
|
for (let i = 0; i < res.data.data.length; i++) {
|
||||||
|
states.data[i] = res.data.data[i].user
|
||||||
|
}
|
||||||
|
console.log("getAll:",states.data)
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
function handleBeforeSwitchChange(index, row) {
|
||||||
|
return new Promise((resolve) => {
|
||||||
|
this.$Modal.confirm({
|
||||||
|
title: '切换确认',
|
||||||
|
content: '您确认要切换开关状态吗?',
|
||||||
|
onOk: () => {
|
||||||
|
resolve();
|
||||||
|
message.success('切换成功')
|
||||||
|
}
|
||||||
|
})
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
function handlePageChange(newPage) {
|
||||||
|
this.currentPage = newPage; // 更新当前页码
|
||||||
|
}
|
||||||
|
|
||||||
|
const addData = reactive({
|
||||||
|
username: '',
|
||||||
|
password: '',
|
||||||
|
address: '',
|
||||||
|
phone: '',
|
||||||
|
email: '',
|
||||||
|
sex: 1,
|
||||||
|
age: ''
|
||||||
|
})
|
||||||
|
function showAddDialog(){
|
||||||
|
addDialog.value = true
|
||||||
|
|
||||||
|
}
|
||||||
|
function addOk () {
|
||||||
|
if (sex.value === '男') {
|
||||||
|
addData.sex = 1
|
||||||
|
}else {
|
||||||
|
addData.sex = 0
|
||||||
|
}
|
||||||
|
requests.userAdd(addData, token).then((res)=>{
|
||||||
|
if (res.data.code===200) {
|
||||||
|
message.success('新增成功')
|
||||||
|
getAll()
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
message.error('新增失败')
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
function addCancel () {
|
||||||
|
message.info('取消新增')
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
const deleteId = ref(0)
|
||||||
|
function showDeleteDialog(index, row){
|
||||||
|
deleteDialog.value = true
|
||||||
|
deleteId.value = row.id
|
||||||
|
}
|
||||||
|
function deleteOk(){
|
||||||
|
deleteDialog.value = false;
|
||||||
|
console.log(deleteId.value)
|
||||||
|
requests.userDelete(deleteId.value, token).then((res)=>{
|
||||||
|
console.log("deleteResult:",res)
|
||||||
|
if (res.data.code === 200) {
|
||||||
|
message.success('删除成功')
|
||||||
|
}else {
|
||||||
|
message.error('删除失败')
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
}
|
||||||
|
function deleteCancel(){
|
||||||
|
deleteDialog.value = false;
|
||||||
|
message.info('取消删除')
|
||||||
|
}
|
||||||
|
|
||||||
|
function showEditDialog(index, row){
|
||||||
|
editDialog.value = true
|
||||||
|
updateData.id = row.id
|
||||||
|
updateData.username = row.username
|
||||||
|
updateData.address = row.address
|
||||||
|
updateData.phone = row.phone
|
||||||
|
updateData.email = row.email
|
||||||
|
updateData.age = row.age
|
||||||
|
updateData.signature = row.signature
|
||||||
|
updateData.sex = row.sex
|
||||||
|
updateData.avatar = row.avatar
|
||||||
|
updateData.nickname = row.nickname
|
||||||
|
updateData.description = row.description
|
||||||
|
if (row.sex === 1) {
|
||||||
|
sex.value = '男'
|
||||||
|
}else {
|
||||||
|
sex.value = '女'
|
||||||
|
}
|
||||||
|
}
|
||||||
|
function editOk(){
|
||||||
|
loadingTable.value = true
|
||||||
|
editDialog.value = false;
|
||||||
|
requests.userEdit(updateData,token).then((res)=>{
|
||||||
|
console.log("editResult:",res)
|
||||||
|
console.log("updateData:",updateData)
|
||||||
|
if (res.data.code === 200) {
|
||||||
|
getAll()
|
||||||
|
message.success('修改成功')
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
loadingTable.value = false
|
||||||
|
message.error('修改失败')
|
||||||
|
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
}
|
||||||
|
function editCancel(){
|
||||||
|
editDialog.value = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
const searchData = reactive({
|
||||||
|
username: '',
|
||||||
|
phone: ''
|
||||||
|
})
|
||||||
|
function searchUser(){
|
||||||
|
loadingTable.value = true
|
||||||
|
if (searchData.username === '' && searchData.phone === '') {
|
||||||
|
getAll()
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
requests.userCurrent(searchData,token).then((res)=>{
|
||||||
|
loadingTable.value = false
|
||||||
|
console.log("searchResult:",res)
|
||||||
|
if (res.data.code === 200) {
|
||||||
|
states.data = []
|
||||||
|
states.data[0] = res.data.data.user
|
||||||
|
message.success('查询成功')
|
||||||
|
console.log(loadingTable.value)
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
message.error(res.data.message)
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
</script>
|
@ -1,3 +1,419 @@
|
|||||||
|
<style scoped>
|
||||||
|
.addinput{
|
||||||
|
//display: flex;
|
||||||
|
//flex-direction: column;
|
||||||
|
//justify-content: center;
|
||||||
|
//align-content: center;
|
||||||
|
}
|
||||||
|
|
||||||
|
.addinput>div>input{
|
||||||
|
/*width:300px ;*/
|
||||||
|
/*height: 30px;*/
|
||||||
|
/*border-radius: 5px;*/
|
||||||
|
//margin: 0 auto;
|
||||||
|
//outline-color: #94beae;
|
||||||
|
|
||||||
|
}
|
||||||
|
</style>
|
||||||
<template>
|
<template>
|
||||||
这是消息管理页
|
<div style="width: 87vw;height:90vh;position: relative;margin: 0;padding: 0">
|
||||||
|
<div style="padding:20px 10px;">
|
||||||
|
<Space>
|
||||||
|
<span>用户Id:</span>
|
||||||
|
<Input v-model="searchData.username" placeholder="userId" clearable style="width: 200px" />
|
||||||
|
<span>标题:</span>
|
||||||
|
<Input v-model="searchData.phone" placeholder="Enter title" style="width: auto" />
|
||||||
|
<Button @click="searchUser" type="primary" shape="circle" icon="ios-search">查询</Button>
|
||||||
|
<Button type="primary" ghost @click="showAddDialog">新增</Button>
|
||||||
|
|
||||||
|
</Space>
|
||||||
|
</div>
|
||||||
|
<!-- 表格内容-->
|
||||||
|
<div style="width: 87vw; height: 78vh; margin: 0; padding: 0">
|
||||||
|
<Table border :loading="loadingTable" ref="selection" :columns="columns" :data="states.data" style="height: 72vh ;text-align: center;" :row-class-name="setRowClassName" >
|
||||||
|
|
||||||
|
|
||||||
|
<template #status="{ row, index }">
|
||||||
|
<Switch size="large" v-model="states.data[index].accountNoLocked" :before-change="handleBeforeSwitchChange">
|
||||||
|
<template #open>
|
||||||
|
<span>开启</span>
|
||||||
|
</template>
|
||||||
|
<template #close>
|
||||||
|
<span>关闭</span>
|
||||||
|
</template>
|
||||||
|
</Switch>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<template #action="{ row, index }">
|
||||||
|
<Button type="primary" size="small" style="margin-right: 5px" @click="showEditDialog(index, row)">详情</Button>
|
||||||
|
<Button type="error" size="small" @click="showDeleteDialog(index, row)">删除</Button>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
|
||||||
|
</Table>
|
||||||
|
<div style="height: 6vh ;text-align: left;padding-top: 20px">
|
||||||
|
<Page :total="states.data.length" size="small" show-elevator show-sizer />
|
||||||
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<!-- 对话框-->
|
||||||
|
<div>
|
||||||
|
<Modal
|
||||||
|
v-model="editDialog"
|
||||||
|
title="编辑"
|
||||||
|
@on-ok="editOk"
|
||||||
|
@on-cancel="editCancel">
|
||||||
|
<div style="">
|
||||||
|
<div style="margin-bottom: 10px">
|
||||||
|
<span>
|
||||||
|
标题:<Input v-model="updateData.username" placeholder="Enter something..." style="width: 180px" />
|
||||||
|
</span>
|
||||||
|
<span style="margin-left: 20px">
|
||||||
|
<label>Id:</label><Input v-model="updateData.phone" placeholder="Enter something..." readonly style="width: 180px;" />
|
||||||
|
</span>
|
||||||
|
</div>
|
||||||
|
<div style="margin-bottom: 10px">
|
||||||
|
<span>
|
||||||
|
状态:
|
||||||
|
<RadioGroup v-model="sex">
|
||||||
|
<Radio label="展示"></Radio>
|
||||||
|
<Radio label="停用"></Radio>
|
||||||
|
</RadioGroup>
|
||||||
|
</span>
|
||||||
|
<span style="margin-left: 60px">
|
||||||
|
角色:
|
||||||
|
<Select v-model="roleSingle" style="width:180px">
|
||||||
|
<Option v-for="item in cityList" :value="item.value" :key="item.value">{{ item.label }}</Option>
|
||||||
|
</Select>
|
||||||
|
</span>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div style="margin-bottom: 10px">阅读次数:<Input v-model="updateData.email" placeholder="Enter something..." style="width: 200px" /></div>
|
||||||
|
|
||||||
|
<div style="margin-bottom: 10px">创建时间:<Input v-model="updateData.address" placeholder="Enter something..." style="width: 400px" /></div>
|
||||||
|
|
||||||
|
<div style="margin-bottom: 10px">内容:<Input v-model="updateData.description" type="textarea" placeholder="Enter something..." style="width: 435px" /></div>
|
||||||
|
</div>
|
||||||
|
</Modal>
|
||||||
|
|
||||||
|
|
||||||
|
<Modal
|
||||||
|
v-model="deleteDialog"
|
||||||
|
title="删除"
|
||||||
|
@on-ok="deleteOk"
|
||||||
|
@on-cancel="deleteCancel">
|
||||||
|
<p>请问是否要删除xxx数据</p>
|
||||||
|
</Modal>
|
||||||
|
|
||||||
|
<Modal v-model="addDialog" title="新增消息" @on-ok="addOk" @on-cancel="addCancel" >
|
||||||
|
<div>
|
||||||
|
|
||||||
|
<!-- <div style="margin-left: 15px">用户Id:<Input v-model="addData.password" placeholder="Enter something..." style="width: 250px; margin-bottom: 10px" type="password"/></div>-->
|
||||||
|
<div style="margin-left: 15px">标题:<Input v-model="addData.address" placeholder="Enter something..." style="width: 250px; margin-bottom: 10px" /></div>
|
||||||
|
<div style="margin-left: 15px">内容:<Input v-model="addData.phone" placeholder="Enter something..." style="width: 250px; margin-bottom: 10px" /></div>
|
||||||
|
<div style="margin-left: 15px">阅读次数:<Input v-model="addData.email" placeholder="Enter something..." style="width: 250px; margin-bottom: 10px" /></div>
|
||||||
|
<div style="margin-left: 15px">创建时间:<Input v-model="addData.age" placeholder="Enter something..." style="width: 250px" type="number" /></div>
|
||||||
|
<div style="margin-left: 15px">状态: <RadioGroup v-model="sex" style="margin-bottom: 10px">
|
||||||
|
<Radio label='停用'></Radio>
|
||||||
|
<Radio label='展示'></Radio>
|
||||||
|
</RadioGroup></div>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</Modal>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
|
<script setup>
|
||||||
|
import {Page, Radio, RadioGroup, Space, Switch} from "view-ui-plus";
|
||||||
|
import requests from "../../public/request.js"
|
||||||
|
import {reactive, ref} from "vue";
|
||||||
|
import message from "view-ui-plus/src/components/message/index.js";
|
||||||
|
import {onMounted, onBeforeUpdate} from "vue";
|
||||||
|
import modal from "view-ui-plus/src/components/modal/index.js";
|
||||||
|
|
||||||
|
const currentPage = ref(1) // 当前页码
|
||||||
|
const pageSize = ref(10) // 每页显示的数据条数
|
||||||
|
const addDialog = ref(false)
|
||||||
|
const deleteDialog = ref(false)
|
||||||
|
const editDialog = ref(false)
|
||||||
|
const token = window.localStorage.getItem('token')
|
||||||
|
const AllUser = reactive({
|
||||||
|
page:1,
|
||||||
|
limit: 10,
|
||||||
|
search: null,
|
||||||
|
role: null
|
||||||
|
})
|
||||||
|
const columns = reactive( [
|
||||||
|
{
|
||||||
|
type: "selection",
|
||||||
|
width: 60,
|
||||||
|
align: "center"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: "用户Id",
|
||||||
|
key: "username",
|
||||||
|
align: "center"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: "标题",
|
||||||
|
key: "jobId",
|
||||||
|
width: 150,
|
||||||
|
align: "center"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: "内容",
|
||||||
|
key: "phone",
|
||||||
|
width: 150,
|
||||||
|
align: "center"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: "阅读次数",
|
||||||
|
key: "email",
|
||||||
|
align: "center"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: "创建时间",
|
||||||
|
key: "email",
|
||||||
|
align: "center"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: "状态",
|
||||||
|
slot: "status",
|
||||||
|
width: 100,
|
||||||
|
align: "center",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: "操作",
|
||||||
|
slot: "action",
|
||||||
|
width: 150,
|
||||||
|
align: "center"
|
||||||
|
}
|
||||||
|
])
|
||||||
|
const states = reactive({
|
||||||
|
data:[]
|
||||||
|
})
|
||||||
|
const loadingTable = ref(true)
|
||||||
|
const sex = ref('男')
|
||||||
|
const roleSingle = ref(1)
|
||||||
|
const updateData = reactive({
|
||||||
|
id: 0,
|
||||||
|
username: '',
|
||||||
|
address: '',
|
||||||
|
phone: '',
|
||||||
|
email: '',
|
||||||
|
age: '',
|
||||||
|
signature: '',
|
||||||
|
sex: '',
|
||||||
|
avatar: '',
|
||||||
|
nickname: '',
|
||||||
|
description: '',
|
||||||
|
enabled: true,
|
||||||
|
isExpired: false,
|
||||||
|
passwordExpired: false,
|
||||||
|
recommend: false,
|
||||||
|
isLocked: false
|
||||||
|
})
|
||||||
|
const cityList= reactive([
|
||||||
|
{
|
||||||
|
value: 1,
|
||||||
|
label: '管理员'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
value: 2,
|
||||||
|
label: '老师'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
value: 3,
|
||||||
|
label: '学生'
|
||||||
|
}
|
||||||
|
])
|
||||||
|
const userLock = reactive({
|
||||||
|
id: -1,
|
||||||
|
isLock: 1
|
||||||
|
})
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 配置代码
|
||||||
|
*/
|
||||||
|
message.config({
|
||||||
|
background: true
|
||||||
|
})
|
||||||
|
function setRowClassName(row, index) {
|
||||||
|
return 'custom-row';
|
||||||
|
}
|
||||||
|
|
||||||
|
onMounted(() => {
|
||||||
|
getAll()
|
||||||
|
})
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 方法函数
|
||||||
|
*/
|
||||||
|
|
||||||
|
function getAll() {
|
||||||
|
|
||||||
|
requests.userAllCurrent(AllUser,token).then((res)=>{
|
||||||
|
console.log(res)
|
||||||
|
// states.data = res.data.data
|
||||||
|
// console.log(res.data.data)
|
||||||
|
loadingTable.value = false
|
||||||
|
for (let i = 0; i < res.data.data.length; i++) {
|
||||||
|
states.data[i] = res.data.data[i].user
|
||||||
|
}
|
||||||
|
console.log("getAll:",states.data)
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
function handleBeforeSwitchChange(index, row) {
|
||||||
|
return new Promise((resolve) => {
|
||||||
|
this.$Modal.confirm({
|
||||||
|
title: '切换确认',
|
||||||
|
content: '您确认要切换开关状态吗?',
|
||||||
|
onOk: () => {
|
||||||
|
resolve();
|
||||||
|
message.success('切换成功')
|
||||||
|
}
|
||||||
|
})
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
function handlePageChange(newPage) {
|
||||||
|
this.currentPage = newPage; // 更新当前页码
|
||||||
|
}
|
||||||
|
|
||||||
|
const addData = reactive({
|
||||||
|
username: '',
|
||||||
|
password: '',
|
||||||
|
address: '',
|
||||||
|
phone: '',
|
||||||
|
email: '',
|
||||||
|
sex: 1,
|
||||||
|
age: ''
|
||||||
|
})
|
||||||
|
function showAddDialog(){
|
||||||
|
addDialog.value = true
|
||||||
|
|
||||||
|
}
|
||||||
|
function addOk () {
|
||||||
|
if (sex.value === '男') {
|
||||||
|
addData.sex = 1
|
||||||
|
}else {
|
||||||
|
addData.sex = 0
|
||||||
|
}
|
||||||
|
requests.userAdd(addData, token).then((res)=>{
|
||||||
|
if (res.data.code===200) {
|
||||||
|
message.success('新增成功')
|
||||||
|
getAll()
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
message.error('新增失败')
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
function addCancel () {
|
||||||
|
message.info('取消新增')
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
const deleteId = ref(0)
|
||||||
|
function showDeleteDialog(index, row){
|
||||||
|
deleteDialog.value = true
|
||||||
|
deleteId.value = row.id
|
||||||
|
}
|
||||||
|
function deleteOk(){
|
||||||
|
deleteDialog.value = false;
|
||||||
|
console.log(deleteId.value)
|
||||||
|
requests.userDelete(deleteId.value, token).then((res)=>{
|
||||||
|
console.log("deleteResult:",res)
|
||||||
|
if (res.data.code === 200) {
|
||||||
|
message.success('删除成功')
|
||||||
|
}else {
|
||||||
|
message.error('删除失败')
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
}
|
||||||
|
function deleteCancel(){
|
||||||
|
deleteDialog.value = false;
|
||||||
|
message.info('取消删除')
|
||||||
|
}
|
||||||
|
|
||||||
|
function showEditDialog(index, row){
|
||||||
|
editDialog.value = true
|
||||||
|
updateData.id = row.id
|
||||||
|
updateData.username = row.username
|
||||||
|
updateData.address = row.address
|
||||||
|
updateData.phone = row.phone
|
||||||
|
updateData.email = row.email
|
||||||
|
updateData.age = row.age
|
||||||
|
updateData.signature = row.signature
|
||||||
|
updateData.sex = row.sex
|
||||||
|
updateData.avatar = row.avatar
|
||||||
|
updateData.nickname = row.nickname
|
||||||
|
updateData.description = row.description
|
||||||
|
if (row.sex === 1) {
|
||||||
|
sex.value = '男'
|
||||||
|
}else {
|
||||||
|
sex.value = '女'
|
||||||
|
}
|
||||||
|
}
|
||||||
|
function editOk(){
|
||||||
|
loadingTable.value = true
|
||||||
|
editDialog.value = false;
|
||||||
|
requests.userEdit(updateData,token).then((res)=>{
|
||||||
|
console.log("editResult:",res)
|
||||||
|
console.log("updateData:",updateData)
|
||||||
|
if (res.data.code === 200) {
|
||||||
|
getAll()
|
||||||
|
message.success('修改成功')
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
loadingTable.value = false
|
||||||
|
message.error('修改失败')
|
||||||
|
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
}
|
||||||
|
function editCancel(){
|
||||||
|
editDialog.value = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
const searchData = reactive({
|
||||||
|
username: '',
|
||||||
|
phone: ''
|
||||||
|
})
|
||||||
|
function searchUser(){
|
||||||
|
loadingTable.value = true
|
||||||
|
if (searchData.username === '' && searchData.phone === '') {
|
||||||
|
getAll()
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
requests.userCurrent(searchData,token).then((res)=>{
|
||||||
|
loadingTable.value = false
|
||||||
|
console.log("searchResult:",res)
|
||||||
|
if (res.data.code === 200) {
|
||||||
|
states.data = []
|
||||||
|
states.data[0] = res.data.data.user
|
||||||
|
message.success('查询成功')
|
||||||
|
console.log(loadingTable.value)
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
message.error(res.data.message)
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
</script>
|
@ -1,3 +1,421 @@
|
|||||||
|
<style scoped>
|
||||||
|
.addinput{
|
||||||
|
//display: flex;
|
||||||
|
//flex-direction: column;
|
||||||
|
//justify-content: center;
|
||||||
|
//align-content: center;
|
||||||
|
}
|
||||||
|
|
||||||
|
.addinput>div>input{
|
||||||
|
/*width:300px ;*/
|
||||||
|
/*height: 30px;*/
|
||||||
|
/*border-radius: 5px;*/
|
||||||
|
//margin: 0 auto;
|
||||||
|
//outline-color: #94beae;
|
||||||
|
|
||||||
|
}
|
||||||
|
</style>
|
||||||
<template>
|
<template>
|
||||||
this is 消息展示
|
<div style="width: 87vw;height:90vh;position: relative;margin: 0;padding: 0">
|
||||||
|
<div style="padding:20px 10px;">
|
||||||
|
<Space>
|
||||||
|
<span>新闻标题:</span>
|
||||||
|
<Input v-model="searchData.username" placeholder="username" clearable style="width: 200px" />
|
||||||
|
<span>发布人:</span>
|
||||||
|
<Input v-model="searchData.username" prefix="ios-contact" placeholder="username" clearable style="width: 200px" />
|
||||||
|
<span>新闻栏目:</span>
|
||||||
|
<Input v-model="searchData.phone" placeholder="Enter phone" style="width: auto" />
|
||||||
|
<Button @click="searchUser" type="primary" shape="circle" icon="ios-search">查询</Button>
|
||||||
|
<Button type="primary" ghost @click="showAddDialog">新增</Button>
|
||||||
|
|
||||||
|
</Space>
|
||||||
|
</div>
|
||||||
|
<!-- 表格内容-->
|
||||||
|
<div style="width: 87vw; height: 78vh; margin: 0; padding: 0">
|
||||||
|
<Table border :loading="loadingTable" ref="selection" :columns="columns" :data="states.data" style="height: 72vh ;text-align: center;" :row-class-name="setRowClassName" >
|
||||||
|
|
||||||
|
|
||||||
|
<template #status="{ row, index }">
|
||||||
|
<Switch size="large" v-model="states.data[index].accountNoLocked" :before-change="handleBeforeSwitchChange">
|
||||||
|
<template #open>
|
||||||
|
<span>开启</span>
|
||||||
|
</template>
|
||||||
|
<template #close>
|
||||||
|
<span>关闭</span>
|
||||||
|
</template>
|
||||||
|
</Switch>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<template #action="{ row, index }">
|
||||||
|
<Button type="primary" size="small" style="margin-right: 5px" @click="showEditDialog(index, row)">详情</Button>
|
||||||
|
<Button type="error" size="small" @click="showDeleteDialog(index, row)">删除</Button>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
|
||||||
|
</Table>
|
||||||
|
<div style="height: 6vh ;text-align: left;padding-top: 20px">
|
||||||
|
<Page :total="states.data.length" size="small" show-elevator show-sizer />
|
||||||
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<!-- 对话框-->
|
||||||
|
<div>
|
||||||
|
<Modal
|
||||||
|
v-model="editDialog"
|
||||||
|
title="编辑"
|
||||||
|
@on-ok="editOk"
|
||||||
|
@on-cancel="editCancel">
|
||||||
|
<div style="">
|
||||||
|
<div style="margin-bottom: 10px">
|
||||||
|
<div style="margin-left: 15px">新闻标题:<Input v-model="addData.username" placeholder="Enter something..." style="width: 250px; margin-bottom: 10px" /></div>
|
||||||
|
<div style="margin-left: 15px;margin-bottom: 10px">新闻栏目:
|
||||||
|
<span>
|
||||||
|
<Select v-model="roleSingle" style="width:130px;margin-right: 80px">
|
||||||
|
<Option v-for="item in cityList" :value="item.value" :key="item.value">{{ item.label }}</Option>
|
||||||
|
</Select>
|
||||||
|
</span>
|
||||||
|
状态:<RadioGroup v-model="sex" style="margin-bottom: 10px;">
|
||||||
|
<Radio label='展示'></Radio>
|
||||||
|
<Radio label='未展示'></Radio>
|
||||||
|
</RadioGroup>
|
||||||
|
</div>
|
||||||
|
<div style="margin-left: 15px">关键字:<Input v-model="addData.address" placeholder="Enter something..." style="width: 250px; margin-bottom: 10px;margin-left: 10px" /></div>
|
||||||
|
|
||||||
|
<div style="margin-left: 15px">发布人:<Input v-model="addData.email" placeholder="Enter something..." style="width: 250px; margin-bottom: 10px;margin-left: 10px" /></div>
|
||||||
|
<div style="margin-left: 15px"></div>
|
||||||
|
<div style="margin-left: 15px">点击率:<Input v-model="addData.age" placeholder="Enter something..." style="width: 250px;margin-left: 10px;margin-bottom: 10px" type="text" /></div>
|
||||||
|
<div style="margin-left: 15px">发布时间:<Input v-model="addData.phone" placeholder="Enter something..." style="width: 250px; margin-bottom: 10px" /></div>
|
||||||
|
<div style="margin-left: 15px">新闻内容:<Input v-model="addData.age" placeholder="Enter something..." style="width: 400px" type="textarea" :rows="4" /></div>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</Modal>
|
||||||
|
|
||||||
|
|
||||||
|
<Modal
|
||||||
|
v-model="deleteDialog"
|
||||||
|
title="删除"
|
||||||
|
@on-ok="deleteOk"
|
||||||
|
@on-cancel="deleteCancel">
|
||||||
|
<p>请问是否要删除xxx数据</p>
|
||||||
|
</Modal>
|
||||||
|
|
||||||
|
<Modal v-model="addDialog" title="新增新闻信息" @on-ok="addOk" @on-cancel="addCancel" >
|
||||||
|
<div>
|
||||||
|
<div style="margin-left: 15px">新闻标题:<Input v-model="addData.username" placeholder="Enter something..." style="width: 250px; margin-bottom: 10px" /></div>
|
||||||
|
<div style="margin-left: 15px;margin-bottom: 10px">新闻栏目:
|
||||||
|
<span>
|
||||||
|
<Select v-model="roleSingle" style="width:130px;margin-right: 80px">
|
||||||
|
<Option v-for="item in cityList" :value="item.value" :key="item.value">{{ item.label }}</Option>
|
||||||
|
</Select>
|
||||||
|
</span>
|
||||||
|
状态:<RadioGroup v-model="sex" style="margin-bottom: 10px;">
|
||||||
|
<Radio label='展示'></Radio>
|
||||||
|
<Radio label='未展示'></Radio>
|
||||||
|
</RadioGroup>
|
||||||
|
</div>
|
||||||
|
<div style="margin-left: 15px">关键字:<Input v-model="addData.address" placeholder="Enter something..." style="width: 250px; margin-bottom: 10px;margin-left: 10px" /></div>
|
||||||
|
|
||||||
|
<div style="margin-left: 15px">发布人:<Input v-model="addData.email" placeholder="Enter something..." style="width: 250px; margin-bottom: 10px;margin-left: 10px" /></div>
|
||||||
|
<div style="margin-left: 15px"></div>
|
||||||
|
<div style="margin-left: 15px">点击率:<Input v-model="addData.age" placeholder="Enter something..." style="width: 250px;margin-left: 10px;margin-bottom: 10px" type="text" /></div>
|
||||||
|
<div style="margin-left: 15px">发布时间:<Input v-model="addData.phone" placeholder="Enter something..." style="width: 250px; margin-bottom: 10px" /></div>
|
||||||
|
<div style="margin-left: 15px">新闻内容:<Input v-model="addData.age" placeholder="Enter something..." style="width: 400px" type="textarea" :rows="4" /></div>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</Modal>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
|
<script setup>
|
||||||
|
import {Page, Radio, RadioGroup, Space, Switch} from "view-ui-plus";
|
||||||
|
import requests from "../../public/request.js"
|
||||||
|
import {reactive, ref} from "vue";
|
||||||
|
import message from "view-ui-plus/src/components/message/index.js";
|
||||||
|
import {onMounted, onBeforeUpdate} from "vue";
|
||||||
|
import modal from "view-ui-plus/src/components/modal/index.js";
|
||||||
|
|
||||||
|
const currentPage = ref(1) // 当前页码
|
||||||
|
const pageSize = ref(10) // 每页显示的数据条数
|
||||||
|
const addDialog = ref(false)
|
||||||
|
const deleteDialog = ref(false)
|
||||||
|
const editDialog = ref(false)
|
||||||
|
const token = window.localStorage.getItem('token')
|
||||||
|
const AllUser = reactive({
|
||||||
|
page:1,
|
||||||
|
limit: 10,
|
||||||
|
search: null,
|
||||||
|
role: null
|
||||||
|
})
|
||||||
|
const columns = reactive( [
|
||||||
|
{
|
||||||
|
type: "selection",
|
||||||
|
width: 60,
|
||||||
|
align: "center"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: "新闻标题",
|
||||||
|
key: "username",
|
||||||
|
align: "center"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: "新闻栏目",
|
||||||
|
key: "jobId",
|
||||||
|
|
||||||
|
align: "center"
|
||||||
|
},{
|
||||||
|
title: "新闻内容",
|
||||||
|
key: "jobId",
|
||||||
|
align: "center"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: "关键字",
|
||||||
|
key: "phone",
|
||||||
|
width: 150,
|
||||||
|
align: "center"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: "状态",
|
||||||
|
slot: "status",
|
||||||
|
width: 100,
|
||||||
|
align: "center",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: "操作",
|
||||||
|
slot: "action",
|
||||||
|
width: 150,
|
||||||
|
align: "center"
|
||||||
|
}
|
||||||
|
])
|
||||||
|
const states = reactive({
|
||||||
|
data:[]
|
||||||
|
})
|
||||||
|
const loadingTable = ref(true)
|
||||||
|
const sex = ref('男')
|
||||||
|
const roleSingle = ref(1)
|
||||||
|
const updateData = reactive({
|
||||||
|
id: 0,
|
||||||
|
username: '',
|
||||||
|
address: '',
|
||||||
|
phone: '',
|
||||||
|
email: '',
|
||||||
|
age: '',
|
||||||
|
signature: '',
|
||||||
|
sex: '',
|
||||||
|
avatar: '',
|
||||||
|
nickname: '',
|
||||||
|
description: '',
|
||||||
|
enabled: true,
|
||||||
|
isExpired: false,
|
||||||
|
passwordExpired: false,
|
||||||
|
recommend: false,
|
||||||
|
isLocked: false
|
||||||
|
})
|
||||||
|
const cityList= reactive([
|
||||||
|
{
|
||||||
|
value: 1,
|
||||||
|
label: '项目成就'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
value: 2,
|
||||||
|
label: '任务发布'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
value: 3,
|
||||||
|
label: '前端要求'
|
||||||
|
}, {
|
||||||
|
value: 4,
|
||||||
|
label: '后端要求'
|
||||||
|
}
|
||||||
|
])
|
||||||
|
const userLock = reactive({
|
||||||
|
id: -1,
|
||||||
|
isLock: 1
|
||||||
|
})
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 配置代码
|
||||||
|
*/
|
||||||
|
message.config({
|
||||||
|
background: true
|
||||||
|
})
|
||||||
|
function setRowClassName(row, index) {
|
||||||
|
return 'custom-row';
|
||||||
|
}
|
||||||
|
|
||||||
|
onMounted(() => {
|
||||||
|
getAll()
|
||||||
|
})
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 方法函数
|
||||||
|
*/
|
||||||
|
|
||||||
|
function getAll() {
|
||||||
|
|
||||||
|
requests.userAllCurrent(AllUser,token).then((res)=>{
|
||||||
|
console.log(res)
|
||||||
|
// states.data = res.data.data
|
||||||
|
// console.log(res.data.data)
|
||||||
|
loadingTable.value = false
|
||||||
|
for (let i = 0; i < res.data.data.length; i++) {
|
||||||
|
states.data[i] = res.data.data[i].user
|
||||||
|
}
|
||||||
|
console.log("getAll:",states.data)
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
function handleBeforeSwitchChange(index, row) {
|
||||||
|
return new Promise((resolve) => {
|
||||||
|
this.$Modal.confirm({
|
||||||
|
title: '切换确认',
|
||||||
|
content: '您确认要切换开关状态吗?',
|
||||||
|
onOk: () => {
|
||||||
|
resolve();
|
||||||
|
message.success('切换成功')
|
||||||
|
}
|
||||||
|
})
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
function handlePageChange(newPage) {
|
||||||
|
this.currentPage = newPage; // 更新当前页码
|
||||||
|
}
|
||||||
|
|
||||||
|
const addData = reactive({
|
||||||
|
username: '',
|
||||||
|
password: '',
|
||||||
|
address: '',
|
||||||
|
phone: '',
|
||||||
|
email: '',
|
||||||
|
sex: 1,
|
||||||
|
age: ''
|
||||||
|
})
|
||||||
|
function showAddDialog(){
|
||||||
|
addDialog.value = true
|
||||||
|
|
||||||
|
}
|
||||||
|
function addOk () {
|
||||||
|
if (sex.value === '男') {
|
||||||
|
addData.sex = 1
|
||||||
|
}else {
|
||||||
|
addData.sex = 0
|
||||||
|
}
|
||||||
|
requests.userAdd(addData, token).then((res)=>{
|
||||||
|
if (res.data.code===200) {
|
||||||
|
message.success('新增成功')
|
||||||
|
getAll()
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
message.error('新增失败')
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
function addCancel () {
|
||||||
|
message.info('取消新增')
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
const deleteId = ref(0)
|
||||||
|
function showDeleteDialog(index, row){
|
||||||
|
deleteDialog.value = true
|
||||||
|
deleteId.value = row.id
|
||||||
|
}
|
||||||
|
function deleteOk(){
|
||||||
|
deleteDialog.value = false;
|
||||||
|
console.log(deleteId.value)
|
||||||
|
requests.userDelete(deleteId.value, token).then((res)=>{
|
||||||
|
console.log("deleteResult:",res)
|
||||||
|
if (res.data.code === 200) {
|
||||||
|
message.success('删除成功')
|
||||||
|
}else {
|
||||||
|
message.error('删除失败')
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
}
|
||||||
|
function deleteCancel(){
|
||||||
|
deleteDialog.value = false;
|
||||||
|
message.info('取消删除')
|
||||||
|
}
|
||||||
|
|
||||||
|
function showEditDialog(index, row){
|
||||||
|
editDialog.value = true
|
||||||
|
updateData.id = row.id
|
||||||
|
updateData.username = row.username
|
||||||
|
updateData.address = row.address
|
||||||
|
updateData.phone = row.phone
|
||||||
|
updateData.email = row.email
|
||||||
|
updateData.age = row.age
|
||||||
|
updateData.signature = row.signature
|
||||||
|
updateData.sex = row.sex
|
||||||
|
updateData.avatar = row.avatar
|
||||||
|
updateData.nickname = row.nickname
|
||||||
|
updateData.description = row.description
|
||||||
|
if (row.sex === 1) {
|
||||||
|
sex.value = '男'
|
||||||
|
}else {
|
||||||
|
sex.value = '女'
|
||||||
|
}
|
||||||
|
}
|
||||||
|
function editOk(){
|
||||||
|
loadingTable.value = true
|
||||||
|
editDialog.value = false;
|
||||||
|
requests.userEdit(updateData,token).then((res)=>{
|
||||||
|
console.log("editResult:",res)
|
||||||
|
console.log("updateData:",updateData)
|
||||||
|
if (res.data.code === 200) {
|
||||||
|
getAll()
|
||||||
|
message.success('修改成功')
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
loadingTable.value = false
|
||||||
|
message.error('修改失败')
|
||||||
|
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
}
|
||||||
|
function editCancel(){
|
||||||
|
editDialog.value = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
const searchData = reactive({
|
||||||
|
username: '',
|
||||||
|
phone: ''
|
||||||
|
})
|
||||||
|
function searchUser(){
|
||||||
|
loadingTable.value = true
|
||||||
|
if (searchData.username === '' && searchData.phone === '') {
|
||||||
|
getAll()
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
requests.userCurrent(searchData,token).then((res)=>{
|
||||||
|
loadingTable.value = false
|
||||||
|
console.log("searchResult:",res)
|
||||||
|
if (res.data.code === 200) {
|
||||||
|
states.data = []
|
||||||
|
states.data[0] = res.data.data.user
|
||||||
|
message.success('查询成功')
|
||||||
|
console.log(loadingTable.value)
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
message.error(res.data.message)
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
</script>
|
@ -1,3 +1,436 @@
|
|||||||
|
<style scoped>
|
||||||
|
.addinput{
|
||||||
|
//display: flex;
|
||||||
|
//flex-direction: column;
|
||||||
|
//justify-content: center;
|
||||||
|
//align-content: center;
|
||||||
|
}
|
||||||
|
|
||||||
|
.addinput>div>input{
|
||||||
|
/*width:300px ;*/
|
||||||
|
/*height: 30px;*/
|
||||||
|
/*border-radius: 5px;*/
|
||||||
|
//margin: 0 auto;
|
||||||
|
//outline-color: #94beae;
|
||||||
|
|
||||||
|
}
|
||||||
|
</style>
|
||||||
<template>
|
<template>
|
||||||
this is 新闻信息管理
|
<div style="width: 87vw;height:90vh;position: relative;margin: 0;padding: 0">
|
||||||
|
<div style="padding:20px 10px;">
|
||||||
|
<Space>
|
||||||
|
<span>新闻标题:</span>
|
||||||
|
<Input v-model="searchData.username" placeholder="username" clearable style="width: 200px" />
|
||||||
|
<span>发布人:</span>
|
||||||
|
<Input v-model="searchData.username" prefix="ios-contact" placeholder="username" clearable style="width: 200px" />
|
||||||
|
<span>新闻栏目:</span>
|
||||||
|
<Input v-model="searchData.phone" placeholder="Enter phone" style="width: auto" />
|
||||||
|
<Button @click="searchUser" type="primary" shape="circle" icon="ios-search">查询</Button>
|
||||||
|
<Button type="primary" ghost @click="showAddDialog">新增</Button>
|
||||||
|
|
||||||
|
</Space>
|
||||||
|
</div>
|
||||||
|
<!-- 表格内容-->
|
||||||
|
<div style="width: 87vw; height: 78vh; margin: 0; padding: 0">
|
||||||
|
<Table border :loading="loadingTable" ref="selection" :columns="columns" :data="states.data" style="height: 72vh ;text-align: center;" :row-class-name="setRowClassName" >
|
||||||
|
|
||||||
|
|
||||||
|
<template #status="{ row, index }">
|
||||||
|
<Switch size="large" v-model="states.data[index].accountNoLocked" :before-change="handleBeforeSwitchChange">
|
||||||
|
<template #open>
|
||||||
|
<span>开启</span>
|
||||||
|
</template>
|
||||||
|
<template #close>
|
||||||
|
<span>关闭</span>
|
||||||
|
</template>
|
||||||
|
</Switch>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<template #action="{ row, index }">
|
||||||
|
<Button type="primary" size="small" style="margin-right: 5px" @click="showEditDialog(index, row)">详情</Button>
|
||||||
|
<Button type="error" size="small" @click="showDeleteDialog(index, row)">删除</Button>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
|
||||||
|
</Table>
|
||||||
|
<div style="height: 6vh ;text-align: left;padding-top: 20px">
|
||||||
|
<Page :total="states.data.length" size="small" show-elevator show-sizer />
|
||||||
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<!-- 对话框-->
|
||||||
|
<div>
|
||||||
|
<Modal
|
||||||
|
v-model="editDialog"
|
||||||
|
title="编辑"
|
||||||
|
@on-ok="editOk"
|
||||||
|
@on-cancel="editCancel">
|
||||||
|
<div style="">
|
||||||
|
<div style="margin-bottom: 10px">
|
||||||
|
<div style="margin-left: 15px">新闻标题:<Input v-model="addData.username" placeholder="Enter something..." style="width: 250px; margin-bottom: 10px" /></div>
|
||||||
|
<div style="margin-left: 15px;margin-bottom: 10px">新闻栏目:
|
||||||
|
<span>
|
||||||
|
<Select v-model="roleSingle" style="width:130px;margin-right: 80px">
|
||||||
|
<Option v-for="item in cityList" :value="item.value" :key="item.value">{{ item.label }}</Option>
|
||||||
|
</Select>
|
||||||
|
</span>
|
||||||
|
状态:<RadioGroup v-model="sex" style="margin-bottom: 10px;">
|
||||||
|
<Radio label='展示'></Radio>
|
||||||
|
<Radio label='未展示'></Radio>
|
||||||
|
</RadioGroup>
|
||||||
|
</div>
|
||||||
|
<div style="margin-left: 15px">关键字:<Input v-model="addData.address" placeholder="Enter something..." style="width: 250px; margin-bottom: 10px;margin-left: 10px" /></div>
|
||||||
|
|
||||||
|
<div style="margin-left: 15px">发布人:<Input v-model="addData.email" placeholder="Enter something..." style="width: 250px; margin-bottom: 10px;margin-left: 10px" /></div>
|
||||||
|
<div style="margin-left: 15px"></div>
|
||||||
|
<div style="margin-left: 15px">点击率:<Input v-model="addData.age" placeholder="Enter something..." style="width: 250px;margin-left: 10px;margin-bottom: 10px" type="text" /></div>
|
||||||
|
<div style="margin-left: 15px">发布时间:<Input v-model="addData.phone" placeholder="Enter something..." style="width: 250px; margin-bottom: 10px" /></div>
|
||||||
|
<div style="margin-left: 15px">新闻内容:<Input v-model="addData.age" placeholder="Enter something..." style="width: 400px" type="textarea" :rows="4" /></div>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</Modal>
|
||||||
|
|
||||||
|
|
||||||
|
<Modal
|
||||||
|
v-model="deleteDialog"
|
||||||
|
title="删除"
|
||||||
|
@on-ok="deleteOk"
|
||||||
|
@on-cancel="deleteCancel">
|
||||||
|
<p>请问是否要删除xxx数据</p>
|
||||||
|
</Modal>
|
||||||
|
|
||||||
|
<Modal v-model="addDialog" title="新增新闻信息" @on-ok="addOk" @on-cancel="addCancel" >
|
||||||
|
<div>
|
||||||
|
<div style="margin-left: 15px">新闻标题:<Input v-model="addData.username" placeholder="Enter something..." style="width: 250px; margin-bottom: 10px" /></div>
|
||||||
|
<div style="margin-left: 15px;margin-bottom: 10px">新闻栏目:
|
||||||
|
<span>
|
||||||
|
<Select v-model="roleSingle" style="width:130px;margin-right: 80px">
|
||||||
|
<Option v-for="item in cityList" :value="item.value" :key="item.value">{{ item.label }}</Option>
|
||||||
|
</Select>
|
||||||
|
</span>
|
||||||
|
状态:<RadioGroup v-model="sex" style="margin-bottom: 10px;">
|
||||||
|
<Radio label='展示'></Radio>
|
||||||
|
<Radio label='未展示'></Radio>
|
||||||
|
</RadioGroup>
|
||||||
|
</div>
|
||||||
|
<div style="margin-left: 15px">关键字:<Input v-model="addData.address" placeholder="Enter something..." style="width: 250px; margin-bottom: 10px;margin-left: 10px" /></div>
|
||||||
|
|
||||||
|
<div style="margin-left: 15px">发布人:<Input v-model="addData.email" placeholder="Enter something..." style="width: 250px; margin-bottom: 10px;margin-left: 10px" /></div>
|
||||||
|
<div style="margin-left: 15px"></div>
|
||||||
|
<div style="margin-left: 15px">点击率:<Input v-model="addData.age" placeholder="Enter something..." style="width: 250px;margin-left: 10px;margin-bottom: 10px" type="text" /></div>
|
||||||
|
<div style="margin-left: 15px">发布时间:<Input v-model="addData.phone" placeholder="Enter something..." style="width: 250px; margin-bottom: 10px" /></div>
|
||||||
|
<div style="margin-left: 15px">新闻内容:<Input v-model="addData.age" placeholder="Enter something..." style="width: 400px" type="textarea" :rows="4" /></div>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</Modal>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
|
<script setup>
|
||||||
|
import {Page, Radio, RadioGroup, Space, Switch} from "view-ui-plus";
|
||||||
|
import requests from "../../public/request.js"
|
||||||
|
import {reactive, ref} from "vue";
|
||||||
|
import message from "view-ui-plus/src/components/message/index.js";
|
||||||
|
import {onMounted, onBeforeUpdate} from "vue";
|
||||||
|
import modal from "view-ui-plus/src/components/modal/index.js";
|
||||||
|
|
||||||
|
const currentPage = ref(1) // 当前页码
|
||||||
|
const pageSize = ref(10) // 每页显示的数据条数
|
||||||
|
const addDialog = ref(false)
|
||||||
|
const deleteDialog = ref(false)
|
||||||
|
const editDialog = ref(false)
|
||||||
|
const token = window.localStorage.getItem('token')
|
||||||
|
const AllUser = reactive({
|
||||||
|
page:1,
|
||||||
|
limit: 10,
|
||||||
|
search: null,
|
||||||
|
role: null
|
||||||
|
})
|
||||||
|
const columns = reactive( [
|
||||||
|
{
|
||||||
|
type: "selection",
|
||||||
|
width: 60,
|
||||||
|
align: "center"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: "新闻标题",
|
||||||
|
key: "username",
|
||||||
|
align: "center"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: "新闻栏目",
|
||||||
|
key: "jobId",
|
||||||
|
width: 150,
|
||||||
|
align: "center"
|
||||||
|
},{
|
||||||
|
title: "新闻内容",
|
||||||
|
key: "jobId",
|
||||||
|
width: 150,
|
||||||
|
align: "center"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: "关键字",
|
||||||
|
key: "phone",
|
||||||
|
width: 150,
|
||||||
|
align: "center"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: "发布时间",
|
||||||
|
key: "email",
|
||||||
|
align: "center"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: "发布人",
|
||||||
|
key: "email",
|
||||||
|
align: "center"
|
||||||
|
}, {
|
||||||
|
title: "点击率",
|
||||||
|
key: "email",
|
||||||
|
align: "center"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: "状态",
|
||||||
|
slot: "status",
|
||||||
|
width: 100,
|
||||||
|
align: "center",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: "操作",
|
||||||
|
slot: "action",
|
||||||
|
width: 150,
|
||||||
|
align: "center"
|
||||||
|
}
|
||||||
|
])
|
||||||
|
const states = reactive({
|
||||||
|
data:[]
|
||||||
|
})
|
||||||
|
const loadingTable = ref(true)
|
||||||
|
const sex = ref('男')
|
||||||
|
const roleSingle = ref(1)
|
||||||
|
const updateData = reactive({
|
||||||
|
id: 0,
|
||||||
|
username: '',
|
||||||
|
address: '',
|
||||||
|
phone: '',
|
||||||
|
email: '',
|
||||||
|
age: '',
|
||||||
|
signature: '',
|
||||||
|
sex: '',
|
||||||
|
avatar: '',
|
||||||
|
nickname: '',
|
||||||
|
description: '',
|
||||||
|
enabled: true,
|
||||||
|
isExpired: false,
|
||||||
|
passwordExpired: false,
|
||||||
|
recommend: false,
|
||||||
|
isLocked: false
|
||||||
|
})
|
||||||
|
const cityList= reactive([
|
||||||
|
{
|
||||||
|
value: 1,
|
||||||
|
label: '项目成就'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
value: 2,
|
||||||
|
label: '任务发布'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
value: 3,
|
||||||
|
label: '前端要求'
|
||||||
|
}, {
|
||||||
|
value: 4,
|
||||||
|
label: '后端要求'
|
||||||
|
}
|
||||||
|
])
|
||||||
|
const userLock = reactive({
|
||||||
|
id: -1,
|
||||||
|
isLock: 1
|
||||||
|
})
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 配置代码
|
||||||
|
*/
|
||||||
|
message.config({
|
||||||
|
background: true
|
||||||
|
})
|
||||||
|
function setRowClassName(row, index) {
|
||||||
|
return 'custom-row';
|
||||||
|
}
|
||||||
|
|
||||||
|
onMounted(() => {
|
||||||
|
getAll()
|
||||||
|
})
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 方法函数
|
||||||
|
*/
|
||||||
|
|
||||||
|
function getAll() {
|
||||||
|
|
||||||
|
requests.userAllCurrent(AllUser,token).then((res)=>{
|
||||||
|
console.log(res)
|
||||||
|
// states.data = res.data.data
|
||||||
|
// console.log(res.data.data)
|
||||||
|
loadingTable.value = false
|
||||||
|
for (let i = 0; i < res.data.data.length; i++) {
|
||||||
|
states.data[i] = res.data.data[i].user
|
||||||
|
}
|
||||||
|
console.log("getAll:",states.data)
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
function handleBeforeSwitchChange(index, row) {
|
||||||
|
return new Promise((resolve) => {
|
||||||
|
this.$Modal.confirm({
|
||||||
|
title: '切换确认',
|
||||||
|
content: '您确认要切换开关状态吗?',
|
||||||
|
onOk: () => {
|
||||||
|
resolve();
|
||||||
|
message.success('切换成功')
|
||||||
|
}
|
||||||
|
})
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
function handlePageChange(newPage) {
|
||||||
|
this.currentPage = newPage; // 更新当前页码
|
||||||
|
}
|
||||||
|
|
||||||
|
const addData = reactive({
|
||||||
|
username: '',
|
||||||
|
password: '',
|
||||||
|
address: '',
|
||||||
|
phone: '',
|
||||||
|
email: '',
|
||||||
|
sex: 1,
|
||||||
|
age: ''
|
||||||
|
})
|
||||||
|
function showAddDialog(){
|
||||||
|
addDialog.value = true
|
||||||
|
|
||||||
|
}
|
||||||
|
function addOk () {
|
||||||
|
if (sex.value === '男') {
|
||||||
|
addData.sex = 1
|
||||||
|
}else {
|
||||||
|
addData.sex = 0
|
||||||
|
}
|
||||||
|
requests.userAdd(addData, token).then((res)=>{
|
||||||
|
if (res.data.code===200) {
|
||||||
|
message.success('新增成功')
|
||||||
|
getAll()
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
message.error('新增失败')
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
function addCancel () {
|
||||||
|
message.info('取消新增')
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
const deleteId = ref(0)
|
||||||
|
function showDeleteDialog(index, row){
|
||||||
|
deleteDialog.value = true
|
||||||
|
deleteId.value = row.id
|
||||||
|
}
|
||||||
|
function deleteOk(){
|
||||||
|
deleteDialog.value = false;
|
||||||
|
console.log(deleteId.value)
|
||||||
|
requests.userDelete(deleteId.value, token).then((res)=>{
|
||||||
|
console.log("deleteResult:",res)
|
||||||
|
if (res.data.code === 200) {
|
||||||
|
message.success('删除成功')
|
||||||
|
}else {
|
||||||
|
message.error('删除失败')
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
}
|
||||||
|
function deleteCancel(){
|
||||||
|
deleteDialog.value = false;
|
||||||
|
message.info('取消删除')
|
||||||
|
}
|
||||||
|
|
||||||
|
function showEditDialog(index, row){
|
||||||
|
editDialog.value = true
|
||||||
|
updateData.id = row.id
|
||||||
|
updateData.username = row.username
|
||||||
|
updateData.address = row.address
|
||||||
|
updateData.phone = row.phone
|
||||||
|
updateData.email = row.email
|
||||||
|
updateData.age = row.age
|
||||||
|
updateData.signature = row.signature
|
||||||
|
updateData.sex = row.sex
|
||||||
|
updateData.avatar = row.avatar
|
||||||
|
updateData.nickname = row.nickname
|
||||||
|
updateData.description = row.description
|
||||||
|
if (row.sex === 1) {
|
||||||
|
sex.value = '男'
|
||||||
|
}else {
|
||||||
|
sex.value = '女'
|
||||||
|
}
|
||||||
|
}
|
||||||
|
function editOk(){
|
||||||
|
loadingTable.value = true
|
||||||
|
editDialog.value = false;
|
||||||
|
requests.userEdit(updateData,token).then((res)=>{
|
||||||
|
console.log("editResult:",res)
|
||||||
|
console.log("updateData:",updateData)
|
||||||
|
if (res.data.code === 200) {
|
||||||
|
getAll()
|
||||||
|
message.success('修改成功')
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
loadingTable.value = false
|
||||||
|
message.error('修改失败')
|
||||||
|
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
}
|
||||||
|
function editCancel(){
|
||||||
|
editDialog.value = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
const searchData = reactive({
|
||||||
|
username: '',
|
||||||
|
phone: ''
|
||||||
|
})
|
||||||
|
function searchUser(){
|
||||||
|
loadingTable.value = true
|
||||||
|
if (searchData.username === '' && searchData.phone === '') {
|
||||||
|
getAll()
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
requests.userCurrent(searchData,token).then((res)=>{
|
||||||
|
loadingTable.value = false
|
||||||
|
console.log("searchResult:",res)
|
||||||
|
if (res.data.code === 200) {
|
||||||
|
states.data = []
|
||||||
|
states.data[0] = res.data.data.user
|
||||||
|
message.success('查询成功')
|
||||||
|
console.log(loadingTable.value)
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
message.error(res.data.message)
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
</script>
|
@ -1,3 +1,413 @@
|
|||||||
|
<style scoped>
|
||||||
|
.addinput{
|
||||||
|
//display: flex;
|
||||||
|
//flex-direction: column;
|
||||||
|
//justify-content: center;
|
||||||
|
//align-content: center;
|
||||||
|
}
|
||||||
|
|
||||||
|
.addinput>div>input{
|
||||||
|
/*width:300px ;*/
|
||||||
|
/*height: 30px;*/
|
||||||
|
/*border-radius: 5px;*/
|
||||||
|
//margin: 0 auto;
|
||||||
|
//outline-color: #94beae;
|
||||||
|
|
||||||
|
}
|
||||||
|
</style>
|
||||||
<template>
|
<template>
|
||||||
this is permission
|
<div style="width: 87vw;height:90vh;position: relative;margin: 0;padding: 0">
|
||||||
|
<div style="padding:20px 10px;">
|
||||||
|
<Space>
|
||||||
|
<span>权限名称:</span>
|
||||||
|
<Input v-model="searchData.username" prefix="ios-contact" placeholder="name" clearable style="width: 200px" />
|
||||||
|
<span>权限Id:</span>
|
||||||
|
<Input v-model="searchData.phone" placeholder="Enter id" style="width: auto" />
|
||||||
|
<Button @click="searchUser" type="primary" shape="circle" icon="ios-search">查询</Button>
|
||||||
|
<Button type="primary" ghost @click="showAddDialog">新增</Button>
|
||||||
|
|
||||||
|
</Space>
|
||||||
|
</div>
|
||||||
|
<!-- 表格内容-->
|
||||||
|
<div style="width: 87vw; height: 78vh; margin: 0; padding: 0">
|
||||||
|
<Table border :loading="loadingTable" ref="selection" :columns="columns" :data="states.data" style="height: 72vh ;text-align: center;" :row-class-name="setRowClassName" >
|
||||||
|
|
||||||
|
|
||||||
|
<template #status="{ row, index }">
|
||||||
|
<Switch size="large" v-model="states.data[index].accountNoLocked" :before-change="handleBeforeSwitchChange">
|
||||||
|
<template #open>
|
||||||
|
<span>开启</span>
|
||||||
|
</template>
|
||||||
|
<template #close>
|
||||||
|
<span>关闭</span>
|
||||||
|
</template>
|
||||||
|
</Switch>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<template #action="{ row, index }">
|
||||||
|
<Button type="primary" size="small" style="margin-right: 5px" @click="showEditDialog(index, row)">详情</Button>
|
||||||
|
<Button type="error" size="small" @click="showDeleteDialog(index, row)">删除</Button>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
|
||||||
|
</Table>
|
||||||
|
<div style="height: 6vh ;text-align: left;padding-top: 20px">
|
||||||
|
<Page :total="states.data.length" size="small" show-elevator show-sizer />
|
||||||
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<!-- 对话框-->
|
||||||
|
<div>
|
||||||
|
<Modal
|
||||||
|
v-model="editDialog"
|
||||||
|
title="编辑"
|
||||||
|
@on-ok="editOk"
|
||||||
|
@on-cancel="editCancel">
|
||||||
|
<div style="">
|
||||||
|
<div style="margin-bottom: 10px">
|
||||||
|
<span>
|
||||||
|
权限名称:<Input v-model="updateData.username" placeholder="Enter something..." style="width: 180px" />
|
||||||
|
</span>
|
||||||
|
<span style="margin-left: 20px">
|
||||||
|
<label>权限父Id:</label><Input v-model="updateData.phone" placeholder="Enter something..." style="width: 180px" />
|
||||||
|
</span>
|
||||||
|
</div>
|
||||||
|
<div style="margin-bottom: 10px">
|
||||||
|
<span>
|
||||||
|
状态:
|
||||||
|
<RadioGroup v-model="sex">
|
||||||
|
<Radio label="正常"></Radio>
|
||||||
|
<Radio label="停用"></Radio>
|
||||||
|
</RadioGroup>
|
||||||
|
</span>
|
||||||
|
<span style="margin-left: 98px">
|
||||||
|
权限编码:
|
||||||
|
<Select v-model="roleSingle" style="width:200px">
|
||||||
|
<Option v-for="item in cityList" :value="item.value" :key="item.value">{{ item.label }}</Option>
|
||||||
|
</Select>
|
||||||
|
</span>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div style="margin-bottom: 10px">权限类型:<Input v-model="updateData.email" placeholder="Enter something..." style="width: 435px" /></div>
|
||||||
|
|
||||||
|
<div style="margin-bottom: 10px">权限分配:<Input v-model="updateData.address" placeholder="Enter something..." style="width: 435px" /></div>
|
||||||
|
|
||||||
|
<!-- <div style="margin-bottom: 10px">简介:<Input v-model="updateData.description" type="textarea" placeholder="Enter something..." style="width: 435px" /></div>-->
|
||||||
|
</div>
|
||||||
|
</Modal>
|
||||||
|
|
||||||
|
|
||||||
|
<Modal
|
||||||
|
v-model="deleteDialog"
|
||||||
|
title="删除"
|
||||||
|
@on-ok="deleteOk"
|
||||||
|
@on-cancel="deleteCancel">
|
||||||
|
<p>请问是否要删除xxx数据</p>
|
||||||
|
</Modal>
|
||||||
|
|
||||||
|
<Modal v-model="addDialog" title="新增权限信息" @on-ok="addOk" @on-cancel="addCancel" >
|
||||||
|
<div>
|
||||||
|
<div style="margin-left: 15px">权限名称:<Input v-model="addData.username" placeholder="Enter something..." style="width: 250px; margin-bottom: 10px" /></div>
|
||||||
|
<div style="margin-left: 15px">权限编码:<Input v-model="addData.password" placeholder="Enter something..." style="width: 250px; margin-bottom: 10px" type="password"/></div>
|
||||||
|
<div style="margin-left: 15px">权限类型:<Input v-model="addData.address" placeholder="Enter something..." style="width: 250px; margin-bottom: 10px" /></div>
|
||||||
|
<div style="margin-left: 15px">权限分配:<Input v-model="addData.phone" placeholder="Enter something..." style="width: 250px; margin-bottom: 10px" /></div>
|
||||||
|
<!-- <div style="margin-left: 15px">邮箱:<Input v-model="addData.email" placeholder="Enter something..." style="width: 250px; margin-bottom: 10px" /></div>-->
|
||||||
|
<div style="margin-left: 15px">状态: <RadioGroup v-model="sex" style="margin-bottom: 10px">
|
||||||
|
<Radio label='正常'></Radio>
|
||||||
|
<Radio label='停用'></Radio>
|
||||||
|
</RadioGroup></div>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</Modal>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
|
<script setup>
|
||||||
|
import {Page, Radio, RadioGroup, Space, Switch} from "view-ui-plus";
|
||||||
|
import requests from "../../public/request.js"
|
||||||
|
import {reactive, ref} from "vue";
|
||||||
|
import message from "view-ui-plus/src/components/message/index.js";
|
||||||
|
import {onMounted, onBeforeUpdate} from "vue";
|
||||||
|
import modal from "view-ui-plus/src/components/modal/index.js";
|
||||||
|
|
||||||
|
const currentPage = ref(1) // 当前页码
|
||||||
|
const pageSize = ref(10) // 每页显示的数据条数
|
||||||
|
const addDialog = ref(false)
|
||||||
|
const deleteDialog = ref(false)
|
||||||
|
const editDialog = ref(false)
|
||||||
|
const token = window.localStorage.getItem('token')
|
||||||
|
const AllUser = reactive({
|
||||||
|
page:1,
|
||||||
|
limit: 10,
|
||||||
|
search: null,
|
||||||
|
role: null
|
||||||
|
})
|
||||||
|
const columns = reactive( [
|
||||||
|
{
|
||||||
|
type: "selection",
|
||||||
|
width: 60,
|
||||||
|
align: "center"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: "名称",
|
||||||
|
key: "name",
|
||||||
|
align: "center"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: "返回值",
|
||||||
|
key: "code",
|
||||||
|
width: 150,
|
||||||
|
align: "center"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: "权限类型",
|
||||||
|
key: "type",
|
||||||
|
width: 150,
|
||||||
|
align: "center"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: "权限分配",
|
||||||
|
key: "email",
|
||||||
|
align: "center"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: "状态",
|
||||||
|
slot: "status",
|
||||||
|
width: 100,
|
||||||
|
align: "center",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: "操作",
|
||||||
|
slot: "action",
|
||||||
|
width: 150,
|
||||||
|
align: "center"
|
||||||
|
}
|
||||||
|
])
|
||||||
|
const states = reactive({
|
||||||
|
data:[]
|
||||||
|
})
|
||||||
|
const loadingTable = ref(true)
|
||||||
|
const sex = ref('男')
|
||||||
|
const roleSingle = ref(1)
|
||||||
|
const updateData = reactive({
|
||||||
|
id: 0,
|
||||||
|
username: '',
|
||||||
|
address: '',
|
||||||
|
phone: '',
|
||||||
|
email: '',
|
||||||
|
age: '',
|
||||||
|
signature: '',
|
||||||
|
sex: '',
|
||||||
|
avatar: '',
|
||||||
|
nickname: '',
|
||||||
|
description: '',
|
||||||
|
enabled: true,
|
||||||
|
isExpired: false,
|
||||||
|
passwordExpired: false,
|
||||||
|
recommend: false,
|
||||||
|
isLocked: false
|
||||||
|
})
|
||||||
|
const cityList= reactive([
|
||||||
|
{
|
||||||
|
value: 1,
|
||||||
|
label: '管理员'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
value: 2,
|
||||||
|
label: '老师'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
value: 3,
|
||||||
|
label: '学生'
|
||||||
|
}
|
||||||
|
])
|
||||||
|
const userLock = reactive({
|
||||||
|
id: -1,
|
||||||
|
isLock: 1
|
||||||
|
})
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 配置代码
|
||||||
|
*/
|
||||||
|
message.config({
|
||||||
|
background: true
|
||||||
|
})
|
||||||
|
function setRowClassName(row, index) {
|
||||||
|
return 'custom-row';
|
||||||
|
}
|
||||||
|
|
||||||
|
onMounted(() => {
|
||||||
|
getAll()
|
||||||
|
})
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 方法函数
|
||||||
|
*/
|
||||||
|
|
||||||
|
function getAll() {
|
||||||
|
|
||||||
|
requests.userAllCurrent(AllUser,token).then((res)=>{
|
||||||
|
console.log(res)
|
||||||
|
// states.data = res.data.data
|
||||||
|
// console.log(res.data.data)
|
||||||
|
loadingTable.value = false
|
||||||
|
for (let i = 0; i < res.data.data.length; i++) {
|
||||||
|
states.data[i] = res.data.data[i].user
|
||||||
|
}
|
||||||
|
console.log("getAll:",states.data)
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
function handleBeforeSwitchChange(index, row) {
|
||||||
|
return new Promise((resolve) => {
|
||||||
|
this.$Modal.confirm({
|
||||||
|
title: '切换确认',
|
||||||
|
content: '您确认要切换开关状态吗?',
|
||||||
|
onOk: () => {
|
||||||
|
resolve();
|
||||||
|
message.success('切换成功')
|
||||||
|
}
|
||||||
|
})
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
function handlePageChange(newPage) {
|
||||||
|
this.currentPage = newPage; // 更新当前页码
|
||||||
|
}
|
||||||
|
|
||||||
|
const addData = reactive({
|
||||||
|
username: '',
|
||||||
|
password: '',
|
||||||
|
address: '',
|
||||||
|
phone: '',
|
||||||
|
email: '',
|
||||||
|
sex: 1,
|
||||||
|
age: ''
|
||||||
|
})
|
||||||
|
function showAddDialog(){
|
||||||
|
addDialog.value = true
|
||||||
|
|
||||||
|
}
|
||||||
|
function addOk () {
|
||||||
|
if (sex.value === '男') {
|
||||||
|
addData.sex = 1
|
||||||
|
}else {
|
||||||
|
addData.sex = 0
|
||||||
|
}
|
||||||
|
requests.userAdd(addData, token).then((res)=>{
|
||||||
|
if (res.data.code===200) {
|
||||||
|
message.success('新增成功')
|
||||||
|
getAll()
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
message.error('新增失败')
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
function addCancel () {
|
||||||
|
message.info('取消新增')
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
const deleteId = ref(0)
|
||||||
|
function showDeleteDialog(index, row){
|
||||||
|
deleteDialog.value = true
|
||||||
|
deleteId.value = row.id
|
||||||
|
}
|
||||||
|
function deleteOk(){
|
||||||
|
deleteDialog.value = false;
|
||||||
|
console.log(deleteId.value)
|
||||||
|
requests.userDelete(deleteId.value, token).then((res)=>{
|
||||||
|
console.log("deleteResult:",res)
|
||||||
|
if (res.data.code === 200) {
|
||||||
|
message.success('删除成功')
|
||||||
|
}else {
|
||||||
|
message.error('删除失败')
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
}
|
||||||
|
function deleteCancel(){
|
||||||
|
deleteDialog.value = false;
|
||||||
|
message.info('取消删除')
|
||||||
|
}
|
||||||
|
|
||||||
|
function showEditDialog(index, row){
|
||||||
|
editDialog.value = true
|
||||||
|
updateData.id = row.id
|
||||||
|
updateData.username = row.username
|
||||||
|
updateData.address = row.address
|
||||||
|
updateData.phone = row.phone
|
||||||
|
updateData.email = row.email
|
||||||
|
updateData.age = row.age
|
||||||
|
updateData.signature = row.signature
|
||||||
|
updateData.sex = row.sex
|
||||||
|
updateData.avatar = row.avatar
|
||||||
|
updateData.nickname = row.nickname
|
||||||
|
updateData.description = row.description
|
||||||
|
if (row.sex === 1) {
|
||||||
|
sex.value = '男'
|
||||||
|
}else {
|
||||||
|
sex.value = '女'
|
||||||
|
}
|
||||||
|
}
|
||||||
|
function editOk(){
|
||||||
|
loadingTable.value = true
|
||||||
|
editDialog.value = false;
|
||||||
|
requests.userEdit(updateData,token).then((res)=>{
|
||||||
|
console.log("editResult:",res)
|
||||||
|
console.log("updateData:",updateData)
|
||||||
|
if (res.data.code === 200) {
|
||||||
|
getAll()
|
||||||
|
message.success('修改成功')
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
loadingTable.value = false
|
||||||
|
message.error('修改失败')
|
||||||
|
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
}
|
||||||
|
function editCancel(){
|
||||||
|
editDialog.value = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
const searchData = reactive({
|
||||||
|
username: '',
|
||||||
|
phone: ''
|
||||||
|
})
|
||||||
|
function searchUser(){
|
||||||
|
loadingTable.value = true
|
||||||
|
if (searchData.username === '' && searchData.phone === '') {
|
||||||
|
getAll()
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
requests.userCurrent(searchData,token).then((res)=>{
|
||||||
|
loadingTable.value = false
|
||||||
|
console.log("searchResult:",res)
|
||||||
|
if (res.data.code === 200) {
|
||||||
|
states.data = []
|
||||||
|
states.data[0] = res.data.data.user
|
||||||
|
message.success('查询成功')
|
||||||
|
console.log(loadingTable.value)
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
message.error(res.data.message)
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
</script>
|
@ -1,3 +1,429 @@
|
|||||||
|
<style scoped>
|
||||||
|
.addinput{
|
||||||
|
//display: flex;
|
||||||
|
//flex-direction: column;
|
||||||
|
//justify-content: center;
|
||||||
|
//align-content: center;
|
||||||
|
}
|
||||||
|
|
||||||
|
.addinput>div>input{
|
||||||
|
/*width:300px ;*/
|
||||||
|
/*height: 30px;*/
|
||||||
|
/*border-radius: 5px;*/
|
||||||
|
//margin: 0 auto;
|
||||||
|
//outline-color: #94beae;
|
||||||
|
|
||||||
|
}
|
||||||
|
</style>
|
||||||
<template>
|
<template>
|
||||||
this is 项目信息管理
|
<div style="width: 87vw;height:90vh;position: relative;margin: 0;padding: 0">
|
||||||
|
<div style="padding:20px 10px;">
|
||||||
|
<Space>
|
||||||
|
<span>项目名:</span>
|
||||||
|
<Input v-model="searchData.username" placeholder="projectName" clearable style="width: 200px" />
|
||||||
|
<span >
|
||||||
|
项目类型:
|
||||||
|
<Select v-model="roleSingle" style="width:200px">
|
||||||
|
<Option v-for="item in cityList" :value="item.value" :key="item.value">{{ item.label }}</Option>
|
||||||
|
</Select>
|
||||||
|
</span>
|
||||||
|
<Button @click="searchUser" type="primary" shape="circle" icon="ios-search">查询</Button>
|
||||||
|
<Button type="primary" ghost @click="showAddDialog">新增</Button>
|
||||||
|
|
||||||
|
</Space>
|
||||||
|
</div>
|
||||||
|
<!-- 表格内容-->
|
||||||
|
<div style="width: 87vw; height: 78vh; margin: 0; padding: 0">
|
||||||
|
<Table border :loading="loadingTable" ref="selection" :columns="columns" :data="states.data" style="height: 72vh ;text-align: center;" :row-class-name="setRowClassName" >
|
||||||
|
|
||||||
|
|
||||||
|
<template #status="{ row, index }">
|
||||||
|
<Switch size="large" v-model="states.data[index].accountNoLocked" :before-change="handleBeforeSwitchChange">
|
||||||
|
<template #open>
|
||||||
|
<span>开启</span>
|
||||||
|
</template>
|
||||||
|
<template #close>
|
||||||
|
<span>关闭</span>
|
||||||
|
</template>
|
||||||
|
</Switch>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<template #action="{ row, index }">
|
||||||
|
<Button type="primary" size="small" style="margin-right: 5px" @click="showEditDialog(index, row)">详情</Button>
|
||||||
|
<Button type="error" size="small" @click="showDeleteDialog(index, row)">删除</Button>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
|
||||||
|
</Table>
|
||||||
|
<div style="height: 6vh ;text-align: left;padding-top: 20px">
|
||||||
|
<Page :total="states.data.length" size="small" show-elevator show-sizer />
|
||||||
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<!-- 对话框-->
|
||||||
|
<div>
|
||||||
|
<Modal
|
||||||
|
v-model="editDialog"
|
||||||
|
title="编辑"
|
||||||
|
@on-ok="editOk"
|
||||||
|
@on-cancel="editCancel">
|
||||||
|
<div style="">
|
||||||
|
<div style="margin-bottom: 10px">
|
||||||
|
<span>
|
||||||
|
项目名称:<Input v-model="updateData.username" placeholder="Enter something..." style="width: 150px" />
|
||||||
|
</span>
|
||||||
|
<span style="margin-left: 20px">
|
||||||
|
<label>代码仓库:</label><Input v-model="updateData.phone" placeholder="Enter something..." style="width: 150px" />
|
||||||
|
</span>
|
||||||
|
</div>
|
||||||
|
<div style="margin-bottom: 10px">
|
||||||
|
|
||||||
|
<span >
|
||||||
|
项目类型:
|
||||||
|
<Select v-model="roleSingle" style="width:200px">
|
||||||
|
<Option v-for="item in cityList" :value="item.value" :key="item.value">{{ item.label }}</Option>
|
||||||
|
</Select>
|
||||||
|
</span>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div style="margin-bottom: 10px">报酬:<Input v-model="updateData.email" placeholder="Enter something..." style="width: 435px" /></div>
|
||||||
|
|
||||||
|
<div style="margin-bottom: 10px">简介:<Input v-model="updateData.address" placeholder="Enter something..." type="textarea" style="width: 435px" /></div>
|
||||||
|
<div style="margin-bottom: 10px">详细介绍:<Input v-model="updateData.description" type="textarea" placeholder="Enter something..." style="width: 400px" /></div>
|
||||||
|
<div style="margin-bottom: 10px">核心代码:<Input v-model="updateData.description" type="textarea" placeholder="Enter something..." style="width: 400px" /></div>
|
||||||
|
</div>
|
||||||
|
</Modal>
|
||||||
|
|
||||||
|
|
||||||
|
<Modal
|
||||||
|
v-model="deleteDialog"
|
||||||
|
title="删除"
|
||||||
|
@on-ok="deleteOk"
|
||||||
|
@on-cancel="deleteCancel">
|
||||||
|
<p>请问是否要删除xxx数据</p>
|
||||||
|
</Modal>
|
||||||
|
|
||||||
|
<Modal v-model="addDialog" title="新增项目信息" @on-ok="addOk" @on-cancel="addCancel" >
|
||||||
|
<div>
|
||||||
|
<div>项目名称:<Input v-model="addData.username" placeholder="Enter something..." style="width: 250px; margin-bottom: 10px" /></div>
|
||||||
|
<div >代码仓库:<Input v-model="addData.address" placeholder="Enter something..." style="width: 250px; margin-bottom: 10px" /></div>
|
||||||
|
<div style="margin-left: 15px;margin-bottom: 12px">
|
||||||
|
<span style="margin-left: 10px">
|
||||||
|
类型:
|
||||||
|
<Select v-model="roleSingle" style="width:200px">
|
||||||
|
<Option v-for="item in cityList" :value="item.value" :key="item.value">{{ item.label }}</Option>
|
||||||
|
</Select>
|
||||||
|
</span></div>
|
||||||
|
|
||||||
|
<div style="margin-left: 20px">报酬:<Input v-model="addData.phone" placeholder="Enter something..." style="width: 250px; margin-bottom: 10px;margin-left: 10px" /></div>
|
||||||
|
<div style="margin-left: 20px">简介:<Input v-model="addData.email" placeholder="Enter something..." type="textarea" style="width: 400px; margin-bottom: 10px;margin-left: 10px" /></div>
|
||||||
|
<div >详细介绍:<Input v-model="addData.email" placeholder="Enter something..." type="textarea" style="width: 400px; margin-bottom: 10px" /></div>
|
||||||
|
<div >核心代码:<Input v-model="addData.email" placeholder="Enter something..." type="textarea" style="width: 400px; margin-bottom: 10px" /></div>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</Modal>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
|
<script setup>
|
||||||
|
import {Page, Radio, RadioGroup, Space, Switch} from "view-ui-plus";
|
||||||
|
import requests from "../../public/request.js"
|
||||||
|
import {reactive, ref} from "vue";
|
||||||
|
import message from "view-ui-plus/src/components/message/index.js";
|
||||||
|
import {onMounted, onBeforeUpdate} from "vue";
|
||||||
|
import modal from "view-ui-plus/src/components/modal/index.js";
|
||||||
|
|
||||||
|
const currentPage = ref(1) // 当前页码
|
||||||
|
const pageSize = ref(10) // 每页显示的数据条数
|
||||||
|
const addDialog = ref(false)
|
||||||
|
const deleteDialog = ref(false)
|
||||||
|
const editDialog = ref(false)
|
||||||
|
const token = window.localStorage.getItem('token')
|
||||||
|
const AllUser = reactive({
|
||||||
|
page:1,
|
||||||
|
limit: 10,
|
||||||
|
search: null,
|
||||||
|
role: null
|
||||||
|
})
|
||||||
|
const columns = reactive( [
|
||||||
|
{
|
||||||
|
type: "selection",
|
||||||
|
width: 60,
|
||||||
|
align: "center"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: "项目名",
|
||||||
|
key: "username",
|
||||||
|
align: "center"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: "简介",
|
||||||
|
key: "jobId",
|
||||||
|
width: 150,
|
||||||
|
align: "center"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: "类型",
|
||||||
|
key: "phone",
|
||||||
|
width: 150,
|
||||||
|
align: "center"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: "代码仓库",
|
||||||
|
key: "email",
|
||||||
|
align: "center"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: "报酬",
|
||||||
|
key: "email",
|
||||||
|
align: "center"
|
||||||
|
},
|
||||||
|
// {
|
||||||
|
// title: "状态",
|
||||||
|
// slot: "status",
|
||||||
|
// width: 100,
|
||||||
|
// align: "center",
|
||||||
|
// },
|
||||||
|
{
|
||||||
|
title: "操作",
|
||||||
|
slot: "action",
|
||||||
|
width: 150,
|
||||||
|
align: "center"
|
||||||
|
}
|
||||||
|
])
|
||||||
|
const states = reactive({
|
||||||
|
data:[]
|
||||||
|
})
|
||||||
|
const loadingTable = ref(true)
|
||||||
|
const sex = ref('男')
|
||||||
|
const roleSingle = ref(1)
|
||||||
|
const updateData = reactive({
|
||||||
|
id: 0,
|
||||||
|
username: '',
|
||||||
|
address: '',
|
||||||
|
phone: '',
|
||||||
|
email: '',
|
||||||
|
age: '',
|
||||||
|
signature: '',
|
||||||
|
sex: '',
|
||||||
|
avatar: '',
|
||||||
|
nickname: '',
|
||||||
|
description: '',
|
||||||
|
enabled: true,
|
||||||
|
isExpired: false,
|
||||||
|
passwordExpired: false,
|
||||||
|
recommend: false,
|
||||||
|
isLocked: false
|
||||||
|
})
|
||||||
|
const cityList= reactive([
|
||||||
|
{
|
||||||
|
value: 1,
|
||||||
|
label: 'IT/软件开发项目'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
value: 2,
|
||||||
|
label: '建筑/工程项目'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
value: 3,
|
||||||
|
label: '市场营销项目'
|
||||||
|
}, {
|
||||||
|
value: 4,
|
||||||
|
label: '活动/会议项目'
|
||||||
|
}, {
|
||||||
|
value: 5,
|
||||||
|
label: '咨询/研发项目'
|
||||||
|
}, {
|
||||||
|
value: 6,
|
||||||
|
label: '社会公益项目'
|
||||||
|
}
|
||||||
|
])
|
||||||
|
const userLock = reactive({
|
||||||
|
id: -1,
|
||||||
|
isLock: 1
|
||||||
|
})
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 配置代码
|
||||||
|
*/
|
||||||
|
message.config({
|
||||||
|
background: true
|
||||||
|
})
|
||||||
|
function setRowClassName(row, index) {
|
||||||
|
return 'custom-row';
|
||||||
|
}
|
||||||
|
|
||||||
|
onMounted(() => {
|
||||||
|
getAll()
|
||||||
|
})
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 方法函数
|
||||||
|
*/
|
||||||
|
|
||||||
|
function getAll() {
|
||||||
|
|
||||||
|
requests.userAllCurrent(AllUser,token).then((res)=>{
|
||||||
|
console.log(res)
|
||||||
|
// states.data = res.data.data
|
||||||
|
// console.log(res.data.data)
|
||||||
|
loadingTable.value = false
|
||||||
|
for (let i = 0; i < res.data.data.length; i++) {
|
||||||
|
states.data[i] = res.data.data[i].user
|
||||||
|
}
|
||||||
|
console.log("getAll:",states.data)
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
function handleBeforeSwitchChange(index, row) {
|
||||||
|
return new Promise((resolve) => {
|
||||||
|
this.$Modal.confirm({
|
||||||
|
title: '切换确认',
|
||||||
|
content: '您确认要切换开关状态吗?',
|
||||||
|
onOk: () => {
|
||||||
|
resolve();
|
||||||
|
message.success('切换成功')
|
||||||
|
}
|
||||||
|
})
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
function handlePageChange(newPage) {
|
||||||
|
this.currentPage = newPage; // 更新当前页码
|
||||||
|
}
|
||||||
|
|
||||||
|
const addData = reactive({
|
||||||
|
username: '',
|
||||||
|
password: '',
|
||||||
|
address: '',
|
||||||
|
phone: '',
|
||||||
|
email: '',
|
||||||
|
sex: 1,
|
||||||
|
age: ''
|
||||||
|
})
|
||||||
|
function showAddDialog(){
|
||||||
|
addDialog.value = true
|
||||||
|
|
||||||
|
}
|
||||||
|
function addOk () {
|
||||||
|
if (sex.value === '男') {
|
||||||
|
addData.sex = 1
|
||||||
|
}else {
|
||||||
|
addData.sex = 0
|
||||||
|
}
|
||||||
|
requests.userAdd(addData, token).then((res)=>{
|
||||||
|
if (res.data.code===200) {
|
||||||
|
message.success('新增成功')
|
||||||
|
getAll()
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
message.error('新增失败')
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
function addCancel () {
|
||||||
|
message.info('取消新增')
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
const deleteId = ref(0)
|
||||||
|
function showDeleteDialog(index, row){
|
||||||
|
deleteDialog.value = true
|
||||||
|
deleteId.value = row.id
|
||||||
|
}
|
||||||
|
function deleteOk(){
|
||||||
|
deleteDialog.value = false;
|
||||||
|
console.log(deleteId.value)
|
||||||
|
requests.userDelete(deleteId.value, token).then((res)=>{
|
||||||
|
console.log("deleteResult:",res)
|
||||||
|
if (res.data.code === 200) {
|
||||||
|
message.success('删除成功')
|
||||||
|
}else {
|
||||||
|
message.error('删除失败')
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
}
|
||||||
|
function deleteCancel(){
|
||||||
|
deleteDialog.value = false;
|
||||||
|
message.info('取消删除')
|
||||||
|
}
|
||||||
|
|
||||||
|
function showEditDialog(index, row){
|
||||||
|
editDialog.value = true
|
||||||
|
updateData.id = row.id
|
||||||
|
updateData.username = row.username
|
||||||
|
updateData.address = row.address
|
||||||
|
updateData.phone = row.phone
|
||||||
|
updateData.email = row.email
|
||||||
|
updateData.age = row.age
|
||||||
|
updateData.signature = row.signature
|
||||||
|
updateData.sex = row.sex
|
||||||
|
updateData.avatar = row.avatar
|
||||||
|
updateData.nickname = row.nickname
|
||||||
|
updateData.description = row.description
|
||||||
|
if (row.sex === 1) {
|
||||||
|
sex.value = '男'
|
||||||
|
}else {
|
||||||
|
sex.value = '女'
|
||||||
|
}
|
||||||
|
}
|
||||||
|
function editOk(){
|
||||||
|
loadingTable.value = true
|
||||||
|
editDialog.value = false;
|
||||||
|
requests.userEdit(updateData,token).then((res)=>{
|
||||||
|
console.log("editResult:",res)
|
||||||
|
console.log("updateData:",updateData)
|
||||||
|
if (res.data.code === 200) {
|
||||||
|
getAll()
|
||||||
|
message.success('修改成功')
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
loadingTable.value = false
|
||||||
|
message.error('修改失败')
|
||||||
|
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
}
|
||||||
|
function editCancel(){
|
||||||
|
editDialog.value = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
const searchData = reactive({
|
||||||
|
username: '',
|
||||||
|
phone: ''
|
||||||
|
})
|
||||||
|
function searchUser(){
|
||||||
|
loadingTable.value = true
|
||||||
|
if (searchData.username === '' && searchData.phone === '') {
|
||||||
|
getAll()
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
requests.userCurrent(searchData,token).then((res)=>{
|
||||||
|
loadingTable.value = false
|
||||||
|
console.log("searchResult:",res)
|
||||||
|
if (res.data.code === 200) {
|
||||||
|
states.data = []
|
||||||
|
states.data[0] = res.data.data.user
|
||||||
|
message.success('查询成功')
|
||||||
|
console.log(loadingTable.value)
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
message.error(res.data.message)
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
</script>
|
@ -1,3 +1,429 @@
|
|||||||
|
<style scoped>
|
||||||
|
.addinput{
|
||||||
|
//display: flex;
|
||||||
|
//flex-direction: column;
|
||||||
|
//justify-content: center;
|
||||||
|
//align-content: center;
|
||||||
|
}
|
||||||
|
|
||||||
|
.addinput>div>input{
|
||||||
|
/*width:300px ;*/
|
||||||
|
/*height: 30px;*/
|
||||||
|
/*border-radius: 5px;*/
|
||||||
|
//margin: 0 auto;
|
||||||
|
//outline-color: #94beae;
|
||||||
|
|
||||||
|
}
|
||||||
|
</style>
|
||||||
<template>
|
<template>
|
||||||
this is 项目推荐
|
<div style="width: 87vw;height:90vh;position: relative;margin: 0;padding: 0">
|
||||||
|
<div style="padding:20px 10px;">
|
||||||
|
<Space>
|
||||||
|
<span>项目名:</span>
|
||||||
|
<Input v-model="searchData.username" placeholder="projectName" clearable style="width: 200px" />
|
||||||
|
<span >
|
||||||
|
项目类型:
|
||||||
|
<Select v-model="roleSingle" style="width:200px">
|
||||||
|
<Option v-for="item in cityList" :value="item.value" :key="item.value">{{ item.label }}</Option>
|
||||||
|
</Select>
|
||||||
|
</span>
|
||||||
|
<Button @click="searchUser" type="primary" shape="circle" icon="ios-search">查询</Button>
|
||||||
|
<Button type="primary" ghost @click="showAddDialog">新增</Button>
|
||||||
|
|
||||||
|
</Space>
|
||||||
|
</div>
|
||||||
|
<!-- 表格内容-->
|
||||||
|
<div style="width: 87vw; height: 78vh; margin: 0; padding: 0">
|
||||||
|
<Table border :loading="loadingTable" ref="selection" :columns="columns" :data="states.data" style="height: 72vh ;text-align: center;" :row-class-name="setRowClassName" >
|
||||||
|
|
||||||
|
|
||||||
|
<template #status="{ row, index }">
|
||||||
|
<Switch size="large" v-model="states.data[index].accountNoLocked" :before-change="handleBeforeSwitchChange">
|
||||||
|
<template #open>
|
||||||
|
<span>开启</span>
|
||||||
|
</template>
|
||||||
|
<template #close>
|
||||||
|
<span>关闭</span>
|
||||||
|
</template>
|
||||||
|
</Switch>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<template #action="{ row, index }">
|
||||||
|
<Button type="primary" size="small" style="margin-right: 5px" @click="showEditDialog(index, row)">详情</Button>
|
||||||
|
<Button type="error" size="small" @click="showDeleteDialog(index, row)">删除</Button>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
|
||||||
|
</Table>
|
||||||
|
<div style="height: 6vh ;text-align: left;padding-top: 20px">
|
||||||
|
<Page :total="states.data.length" size="small" show-elevator show-sizer />
|
||||||
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<!-- 对话框-->
|
||||||
|
<div>
|
||||||
|
<Modal
|
||||||
|
v-model="editDialog"
|
||||||
|
title="编辑"
|
||||||
|
@on-ok="editOk"
|
||||||
|
@on-cancel="editCancel">
|
||||||
|
<div style="">
|
||||||
|
<div style="margin-bottom: 10px">
|
||||||
|
<span>
|
||||||
|
项目名称:<Input v-model="updateData.username" placeholder="Enter something..." style="width: 150px" />
|
||||||
|
</span>
|
||||||
|
<span style="margin-left: 20px">
|
||||||
|
<label>代码仓库:</label><Input v-model="updateData.phone" placeholder="Enter something..." style="width: 150px" />
|
||||||
|
</span>
|
||||||
|
</div>
|
||||||
|
<div style="margin-bottom: 10px">
|
||||||
|
|
||||||
|
<span >
|
||||||
|
项目类型:
|
||||||
|
<Select v-model="roleSingle" style="width:200px">
|
||||||
|
<Option v-for="item in cityList" :value="item.value" :key="item.value">{{ item.label }}</Option>
|
||||||
|
</Select>
|
||||||
|
</span>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div style="margin-bottom: 10px">报酬:<Input v-model="updateData.email" placeholder="Enter something..." style="width: 435px" /></div>
|
||||||
|
|
||||||
|
<div style="margin-bottom: 10px">简介:<Input v-model="updateData.address" placeholder="Enter something..." type="textarea" style="width: 435px" /></div>
|
||||||
|
<div style="margin-bottom: 10px">详细介绍:<Input v-model="updateData.description" type="textarea" placeholder="Enter something..." style="width: 400px" /></div>
|
||||||
|
<div style="margin-bottom: 10px">核心代码:<Input v-model="updateData.description" type="textarea" placeholder="Enter something..." style="width: 400px" /></div>
|
||||||
|
</div>
|
||||||
|
</Modal>
|
||||||
|
|
||||||
|
|
||||||
|
<Modal
|
||||||
|
v-model="deleteDialog"
|
||||||
|
title="删除"
|
||||||
|
@on-ok="deleteOk"
|
||||||
|
@on-cancel="deleteCancel">
|
||||||
|
<p>请问是否要删除xxx数据</p>
|
||||||
|
</Modal>
|
||||||
|
|
||||||
|
<Modal v-model="addDialog" title="新增项目信息" @on-ok="addOk" @on-cancel="addCancel" >
|
||||||
|
<div>
|
||||||
|
<div>项目名称:<Input v-model="addData.username" placeholder="Enter something..." style="width: 250px; margin-bottom: 10px" /></div>
|
||||||
|
<div >代码仓库:<Input v-model="addData.address" placeholder="Enter something..." style="width: 250px; margin-bottom: 10px" /></div>
|
||||||
|
<div style="margin-left: 15px;margin-bottom: 12px">
|
||||||
|
<span style="margin-left: 10px">
|
||||||
|
类型:
|
||||||
|
<Select v-model="roleSingle" style="width:200px">
|
||||||
|
<Option v-for="item in cityList" :value="item.value" :key="item.value">{{ item.label }}</Option>
|
||||||
|
</Select>
|
||||||
|
</span></div>
|
||||||
|
|
||||||
|
<div style="margin-left: 20px">报酬:<Input v-model="addData.phone" placeholder="Enter something..." style="width: 250px; margin-bottom: 10px;margin-left: 10px" /></div>
|
||||||
|
<div style="margin-left: 20px">简介:<Input v-model="addData.email" placeholder="Enter something..." type="textarea" style="width: 400px; margin-bottom: 10px;margin-left: 10px" /></div>
|
||||||
|
<div >详细介绍:<Input v-model="addData.email" placeholder="Enter something..." type="textarea" style="width: 400px; margin-bottom: 10px" /></div>
|
||||||
|
<div >核心代码:<Input v-model="addData.email" placeholder="Enter something..." type="textarea" style="width: 400px; margin-bottom: 10px" /></div>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</Modal>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
|
<script setup>
|
||||||
|
import {Page, Radio, RadioGroup, Space, Switch} from "view-ui-plus";
|
||||||
|
import requests from "../../public/request.js"
|
||||||
|
import {reactive, ref} from "vue";
|
||||||
|
import message from "view-ui-plus/src/components/message/index.js";
|
||||||
|
import {onMounted, onBeforeUpdate} from "vue";
|
||||||
|
import modal from "view-ui-plus/src/components/modal/index.js";
|
||||||
|
|
||||||
|
const currentPage = ref(1) // 当前页码
|
||||||
|
const pageSize = ref(10) // 每页显示的数据条数
|
||||||
|
const addDialog = ref(false)
|
||||||
|
const deleteDialog = ref(false)
|
||||||
|
const editDialog = ref(false)
|
||||||
|
const token = window.localStorage.getItem('token')
|
||||||
|
const AllUser = reactive({
|
||||||
|
page:1,
|
||||||
|
limit: 10,
|
||||||
|
search: null,
|
||||||
|
role: null
|
||||||
|
})
|
||||||
|
const columns = reactive( [
|
||||||
|
{
|
||||||
|
type: "selection",
|
||||||
|
width: 60,
|
||||||
|
align: "center"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: "项目名",
|
||||||
|
key: "username",
|
||||||
|
align: "center"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: "简介",
|
||||||
|
key: "jobId",
|
||||||
|
width: 150,
|
||||||
|
align: "center"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: "类型",
|
||||||
|
key: "phone",
|
||||||
|
width: 150,
|
||||||
|
align: "center"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: "代码仓库",
|
||||||
|
key: "email",
|
||||||
|
align: "center"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: "项目负责人",
|
||||||
|
key: "email",
|
||||||
|
align: "center"
|
||||||
|
},
|
||||||
|
// {
|
||||||
|
// title: "状态",
|
||||||
|
// slot: "status",
|
||||||
|
// width: 100,
|
||||||
|
// align: "center",
|
||||||
|
// },
|
||||||
|
{
|
||||||
|
title: "操作",
|
||||||
|
slot: "action",
|
||||||
|
width: 150,
|
||||||
|
align: "center"
|
||||||
|
}
|
||||||
|
])
|
||||||
|
const states = reactive({
|
||||||
|
data:[]
|
||||||
|
})
|
||||||
|
const loadingTable = ref(true)
|
||||||
|
const sex = ref('男')
|
||||||
|
const roleSingle = ref(1)
|
||||||
|
const updateData = reactive({
|
||||||
|
id: 0,
|
||||||
|
username: '',
|
||||||
|
address: '',
|
||||||
|
phone: '',
|
||||||
|
email: '',
|
||||||
|
age: '',
|
||||||
|
signature: '',
|
||||||
|
sex: '',
|
||||||
|
avatar: '',
|
||||||
|
nickname: '',
|
||||||
|
description: '',
|
||||||
|
enabled: true,
|
||||||
|
isExpired: false,
|
||||||
|
passwordExpired: false,
|
||||||
|
recommend: false,
|
||||||
|
isLocked: false
|
||||||
|
})
|
||||||
|
const cityList= reactive([
|
||||||
|
{
|
||||||
|
value: 1,
|
||||||
|
label: 'IT/软件开发项目'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
value: 2,
|
||||||
|
label: '建筑/工程项目'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
value: 3,
|
||||||
|
label: '市场营销项目'
|
||||||
|
}, {
|
||||||
|
value: 4,
|
||||||
|
label: '活动/会议项目'
|
||||||
|
}, {
|
||||||
|
value: 5,
|
||||||
|
label: '咨询/研发项目'
|
||||||
|
}, {
|
||||||
|
value: 6,
|
||||||
|
label: '社会公益项目'
|
||||||
|
}
|
||||||
|
])
|
||||||
|
const userLock = reactive({
|
||||||
|
id: -1,
|
||||||
|
isLock: 1
|
||||||
|
})
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 配置代码
|
||||||
|
*/
|
||||||
|
message.config({
|
||||||
|
background: true
|
||||||
|
})
|
||||||
|
function setRowClassName(row, index) {
|
||||||
|
return 'custom-row';
|
||||||
|
}
|
||||||
|
|
||||||
|
onMounted(() => {
|
||||||
|
getAll()
|
||||||
|
})
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 方法函数
|
||||||
|
*/
|
||||||
|
|
||||||
|
function getAll() {
|
||||||
|
|
||||||
|
requests.userAllCurrent(AllUser,token).then((res)=>{
|
||||||
|
console.log(res)
|
||||||
|
// states.data = res.data.data
|
||||||
|
// console.log(res.data.data)
|
||||||
|
loadingTable.value = false
|
||||||
|
for (let i = 0; i < res.data.data.length; i++) {
|
||||||
|
states.data[i] = res.data.data[i].user
|
||||||
|
}
|
||||||
|
console.log("getAll:",states.data)
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
function handleBeforeSwitchChange(index, row) {
|
||||||
|
return new Promise((resolve) => {
|
||||||
|
this.$Modal.confirm({
|
||||||
|
title: '切换确认',
|
||||||
|
content: '您确认要切换开关状态吗?',
|
||||||
|
onOk: () => {
|
||||||
|
resolve();
|
||||||
|
message.success('切换成功')
|
||||||
|
}
|
||||||
|
})
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
function handlePageChange(newPage) {
|
||||||
|
this.currentPage = newPage; // 更新当前页码
|
||||||
|
}
|
||||||
|
|
||||||
|
const addData = reactive({
|
||||||
|
username: '',
|
||||||
|
password: '',
|
||||||
|
address: '',
|
||||||
|
phone: '',
|
||||||
|
email: '',
|
||||||
|
sex: 1,
|
||||||
|
age: ''
|
||||||
|
})
|
||||||
|
function showAddDialog(){
|
||||||
|
addDialog.value = true
|
||||||
|
|
||||||
|
}
|
||||||
|
function addOk () {
|
||||||
|
if (sex.value === '男') {
|
||||||
|
addData.sex = 1
|
||||||
|
}else {
|
||||||
|
addData.sex = 0
|
||||||
|
}
|
||||||
|
requests.userAdd(addData, token).then((res)=>{
|
||||||
|
if (res.data.code===200) {
|
||||||
|
message.success('新增成功')
|
||||||
|
getAll()
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
message.error('新增失败')
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
function addCancel () {
|
||||||
|
message.info('取消新增')
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
const deleteId = ref(0)
|
||||||
|
function showDeleteDialog(index, row){
|
||||||
|
deleteDialog.value = true
|
||||||
|
deleteId.value = row.id
|
||||||
|
}
|
||||||
|
function deleteOk(){
|
||||||
|
deleteDialog.value = false;
|
||||||
|
console.log(deleteId.value)
|
||||||
|
requests.userDelete(deleteId.value, token).then((res)=>{
|
||||||
|
console.log("deleteResult:",res)
|
||||||
|
if (res.data.code === 200) {
|
||||||
|
message.success('删除成功')
|
||||||
|
}else {
|
||||||
|
message.error('删除失败')
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
}
|
||||||
|
function deleteCancel(){
|
||||||
|
deleteDialog.value = false;
|
||||||
|
message.info('取消删除')
|
||||||
|
}
|
||||||
|
|
||||||
|
function showEditDialog(index, row){
|
||||||
|
editDialog.value = true
|
||||||
|
updateData.id = row.id
|
||||||
|
updateData.username = row.username
|
||||||
|
updateData.address = row.address
|
||||||
|
updateData.phone = row.phone
|
||||||
|
updateData.email = row.email
|
||||||
|
updateData.age = row.age
|
||||||
|
updateData.signature = row.signature
|
||||||
|
updateData.sex = row.sex
|
||||||
|
updateData.avatar = row.avatar
|
||||||
|
updateData.nickname = row.nickname
|
||||||
|
updateData.description = row.description
|
||||||
|
if (row.sex === 1) {
|
||||||
|
sex.value = '男'
|
||||||
|
}else {
|
||||||
|
sex.value = '女'
|
||||||
|
}
|
||||||
|
}
|
||||||
|
function editOk(){
|
||||||
|
loadingTable.value = true
|
||||||
|
editDialog.value = false;
|
||||||
|
requests.userEdit(updateData,token).then((res)=>{
|
||||||
|
console.log("editResult:",res)
|
||||||
|
console.log("updateData:",updateData)
|
||||||
|
if (res.data.code === 200) {
|
||||||
|
getAll()
|
||||||
|
message.success('修改成功')
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
loadingTable.value = false
|
||||||
|
message.error('修改失败')
|
||||||
|
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
}
|
||||||
|
function editCancel(){
|
||||||
|
editDialog.value = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
const searchData = reactive({
|
||||||
|
username: '',
|
||||||
|
phone: ''
|
||||||
|
})
|
||||||
|
function searchUser(){
|
||||||
|
loadingTable.value = true
|
||||||
|
if (searchData.username === '' && searchData.phone === '') {
|
||||||
|
getAll()
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
requests.userCurrent(searchData,token).then((res)=>{
|
||||||
|
loadingTable.value = false
|
||||||
|
console.log("searchResult:",res)
|
||||||
|
if (res.data.code === 200) {
|
||||||
|
states.data = []
|
||||||
|
states.data[0] = res.data.data.user
|
||||||
|
message.success('查询成功')
|
||||||
|
console.log(loadingTable.value)
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
message.error(res.data.message)
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
</script>
|
@ -1,3 +1,407 @@
|
|||||||
|
<style scoped>
|
||||||
|
.addinput{
|
||||||
|
//display: flex;
|
||||||
|
//flex-direction: column;
|
||||||
|
//justify-content: center;
|
||||||
|
//align-content: center;
|
||||||
|
}
|
||||||
|
|
||||||
|
.addinput>div>input{
|
||||||
|
/*width:300px ;*/
|
||||||
|
/*height: 30px;*/
|
||||||
|
/*border-radius: 5px;*/
|
||||||
|
//margin: 0 auto;
|
||||||
|
//outline-color: #94beae;
|
||||||
|
|
||||||
|
}
|
||||||
|
</style>
|
||||||
<template>
|
<template>
|
||||||
this is 团队信息管理
|
<div style="width: 87vw;height:90vh;position: relative;margin: 0;padding: 0">
|
||||||
|
<div style="padding:20px 10px;">
|
||||||
|
<Space>
|
||||||
|
<span>创建者:</span>
|
||||||
|
<Input v-model="searchData.username" placeholder="username" clearable style="width: 200px" />
|
||||||
|
<span>团队名称:</span>
|
||||||
|
<Input v-model="searchData.phone" placeholder="Enter phone" style="width: auto" />
|
||||||
|
<Button @click="searchUser" type="primary" shape="circle" icon="ios-search">查询</Button>
|
||||||
|
<Button type="primary" ghost @click="showAddDialog">新增</Button>
|
||||||
|
|
||||||
|
</Space>
|
||||||
|
</div>
|
||||||
|
<!-- 表格内容-->
|
||||||
|
<div style="width: 87vw; height: 78vh; margin: 0; padding: 0">
|
||||||
|
<Table border :loading="loadingTable" ref="selection" :columns="columns" :data="states.data" style="height: 72vh ;text-align: center;" :row-class-name="setRowClassName" >
|
||||||
|
|
||||||
|
|
||||||
|
<template #status="{ row, index }">
|
||||||
|
<Switch size="large" v-model="states.data[index].accountNoLocked" :before-change="handleBeforeSwitchChange">
|
||||||
|
<template #open>
|
||||||
|
<span>开启</span>
|
||||||
|
</template>
|
||||||
|
<template #close>
|
||||||
|
<span>关闭</span>
|
||||||
|
</template>
|
||||||
|
</Switch>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<template #action="{ row, index }">
|
||||||
|
<Button type="primary" size="small" style="margin-right: 5px" @click="showEditDialog(index, row)">编辑</Button>
|
||||||
|
<Button type="error" size="small" @click="showDeleteDialog(index, row)">删除</Button>
|
||||||
|
</template>
|
||||||
|
<template #number="{ row, index }">
|
||||||
|
<Button type="success" ghost size="small" style="margin-right: 10px;padding-left: -100px">成就</Button>
|
||||||
|
<Button type="success" size="small">成员</Button>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
</Table>
|
||||||
|
<div style="height: 6vh ;text-align: left;padding-top: 20px">
|
||||||
|
<Page :total="states.data.length" size="small" show-elevator show-sizer />
|
||||||
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<!-- 对话框-->
|
||||||
|
<div>
|
||||||
|
<Modal
|
||||||
|
v-model="editDialog"
|
||||||
|
title="编辑"
|
||||||
|
@on-ok="editOk"
|
||||||
|
@on-cancel="editCancel">
|
||||||
|
<div style="">
|
||||||
|
<div style="margin-bottom: 10px">
|
||||||
|
<span>
|
||||||
|
团队名称:<Input v-model="updateData.username" placeholder="Enter something..." style="width: 200px;margin-bottom: 10px" />
|
||||||
|
</span>
|
||||||
|
<br>
|
||||||
|
<span>
|
||||||
|
<label>成就数:</label><Input placeholder="" style="width:80px" readonly/>
|
||||||
|
<label style="margin-left: 50px">团队总人数:</label><Input placeholder="" readonly style="width: 80px" />
|
||||||
|
</span>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div style="margin-bottom: 10px">团队标志:
|
||||||
|
<Upload action="//jsonplaceholder.typicode.com/posts/">
|
||||||
|
<Button icon="ios-cloud-upload-outline">点击上传头像</Button>
|
||||||
|
</Upload></div>
|
||||||
|
|
||||||
|
|
||||||
|
<div style="margin-bottom: 10px">团队描述:<Input v-model="updateData.description" type="textarea" :rows="4" placeholder="Enter something..." style="width: 435px" /></div>
|
||||||
|
</div>
|
||||||
|
</Modal>
|
||||||
|
|
||||||
|
|
||||||
|
<Modal
|
||||||
|
v-model="deleteDialog"
|
||||||
|
title="删除"
|
||||||
|
@on-ok="deleteOk"
|
||||||
|
@on-cancel="deleteCancel">
|
||||||
|
<p>请问是否要删除xxx数据</p>
|
||||||
|
</Modal>
|
||||||
|
|
||||||
|
<Modal v-model="addDialog" title="新增团队信息" @on-ok="addOk" @on-cancel="addCancel" >
|
||||||
|
<div>
|
||||||
|
|
||||||
|
<div style="margin-left: 15px">团队名称:<Input v-model="addData.password" placeholder="Enter something..." style="width: 250px; margin-bottom: 10px" type="password"/></div>
|
||||||
|
<div style="margin-left: 15px">创建者:<Input v-model="addData.address" placeholder="Enter something..." style="width: 250px; margin-bottom: 10px" /></div>
|
||||||
|
<div style="margin-left: 15px">项目数:<Input v-model="addData.phone" placeholder="Enter something..." style="width: 250px; margin-bottom: 10px" /></div>
|
||||||
|
<div style="margin-left: 15px">成就数:<Input v-model="addData.email" placeholder="Enter something..." style="width: 250px; margin-bottom: 10px" /></div>
|
||||||
|
<div style="margin-left: 15px">团队总人数:<Input v-model="addData.age" placeholder="Enter something..." style="width: 250px" type="number" /></div>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</Modal>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
|
<script setup>
|
||||||
|
import {Page, Radio, RadioGroup, Space, Switch, Upload} from "view-ui-plus";
|
||||||
|
import requests from "../../public/request.js"
|
||||||
|
import {reactive, ref} from "vue";
|
||||||
|
import message from "view-ui-plus/src/components/message/index.js";
|
||||||
|
import {onMounted, onBeforeUpdate} from "vue";
|
||||||
|
import modal from "view-ui-plus/src/components/modal/index.js";
|
||||||
|
|
||||||
|
const currentPage = ref(1) // 当前页码
|
||||||
|
const pageSize = ref(10) // 每页显示的数据条数
|
||||||
|
const addDialog = ref(false)
|
||||||
|
const deleteDialog = ref(false)
|
||||||
|
const editDialog = ref(false)
|
||||||
|
const token = window.localStorage.getItem('token')
|
||||||
|
const AllUser = reactive({
|
||||||
|
page:1,
|
||||||
|
limit: 10,
|
||||||
|
search: null,
|
||||||
|
role: null
|
||||||
|
})
|
||||||
|
const columns = reactive( [
|
||||||
|
{
|
||||||
|
type: "selection",
|
||||||
|
width: 60,
|
||||||
|
align: "center"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: "团队名称",
|
||||||
|
key: "username",
|
||||||
|
align: "center"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: "创建者",
|
||||||
|
key: "jobId",
|
||||||
|
width: 150,
|
||||||
|
align: "center"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: "项目数",
|
||||||
|
key: "phone",
|
||||||
|
width: 150,
|
||||||
|
align: "center"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: "成就数",
|
||||||
|
key: "email",
|
||||||
|
align: "center"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: "团队总人数",
|
||||||
|
key: "email",
|
||||||
|
align: "center"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: "详情",
|
||||||
|
slot: "number",
|
||||||
|
align: "center"
|
||||||
|
},
|
||||||
|
|
||||||
|
{
|
||||||
|
title: "操作",
|
||||||
|
slot: "action",
|
||||||
|
width: 150,
|
||||||
|
align: "center"
|
||||||
|
}
|
||||||
|
])
|
||||||
|
const states = reactive({
|
||||||
|
data:[]
|
||||||
|
})
|
||||||
|
const loadingTable = ref(true)
|
||||||
|
const sex = ref('男')
|
||||||
|
const roleSingle = ref(1)
|
||||||
|
const updateData = reactive({
|
||||||
|
id: 0,
|
||||||
|
username: '',
|
||||||
|
address: '',
|
||||||
|
phone: '',
|
||||||
|
email: '',
|
||||||
|
age: '',
|
||||||
|
signature: '',
|
||||||
|
sex: '',
|
||||||
|
avatar: '',
|
||||||
|
nickname: '',
|
||||||
|
description: '',
|
||||||
|
enabled: true,
|
||||||
|
isExpired: false,
|
||||||
|
passwordExpired: false,
|
||||||
|
recommend: false,
|
||||||
|
isLocked: false
|
||||||
|
})
|
||||||
|
const cityList= reactive([
|
||||||
|
{
|
||||||
|
value: 1,
|
||||||
|
label: '管理员'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
value: 2,
|
||||||
|
label: '老师'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
value: 3,
|
||||||
|
label: '学生'
|
||||||
|
}
|
||||||
|
])
|
||||||
|
const userLock = reactive({
|
||||||
|
id: -1,
|
||||||
|
isLock: 1
|
||||||
|
})
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 配置代码
|
||||||
|
*/
|
||||||
|
message.config({
|
||||||
|
background: true
|
||||||
|
})
|
||||||
|
function setRowClassName(row, index) {
|
||||||
|
return 'custom-row';
|
||||||
|
}
|
||||||
|
|
||||||
|
onMounted(() => {
|
||||||
|
getAll()
|
||||||
|
})
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 方法函数
|
||||||
|
*/
|
||||||
|
|
||||||
|
function getAll() {
|
||||||
|
|
||||||
|
requests.userAllCurrent(AllUser,token).then((res)=>{
|
||||||
|
console.log(res)
|
||||||
|
// states.data = res.data.data
|
||||||
|
// console.log(res.data.data)
|
||||||
|
loadingTable.value = false
|
||||||
|
for (let i = 0; i < res.data.data.length; i++) {
|
||||||
|
states.data[i] = res.data.data[i].user
|
||||||
|
}
|
||||||
|
console.log("getAll:",states.data)
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
function handleBeforeSwitchChange(index, row) {
|
||||||
|
return new Promise((resolve) => {
|
||||||
|
this.$Modal.confirm({
|
||||||
|
title: '切换确认',
|
||||||
|
content: '您确认要切换开关状态吗?',
|
||||||
|
onOk: () => {
|
||||||
|
resolve();
|
||||||
|
message.success('切换成功')
|
||||||
|
}
|
||||||
|
})
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
function handlePageChange(newPage) {
|
||||||
|
this.currentPage = newPage; // 更新当前页码
|
||||||
|
}
|
||||||
|
|
||||||
|
const addData = reactive({
|
||||||
|
username: '',
|
||||||
|
password: '',
|
||||||
|
address: '',
|
||||||
|
phone: '',
|
||||||
|
email: '',
|
||||||
|
sex: 1,
|
||||||
|
age: ''
|
||||||
|
})
|
||||||
|
function showAddDialog(){
|
||||||
|
addDialog.value = true
|
||||||
|
|
||||||
|
}
|
||||||
|
function addOk () {
|
||||||
|
if (sex.value === '男') {
|
||||||
|
addData.sex = 1
|
||||||
|
}else {
|
||||||
|
addData.sex = 0
|
||||||
|
}
|
||||||
|
requests.userAdd(addData, token).then((res)=>{
|
||||||
|
if (res.data.code===200) {
|
||||||
|
message.success('新增成功')
|
||||||
|
getAll()
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
message.error('新增失败')
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
function addCancel () {
|
||||||
|
message.info('取消新增')
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
const deleteId = ref(0)
|
||||||
|
function showDeleteDialog(index, row){
|
||||||
|
deleteDialog.value = true
|
||||||
|
deleteId.value = row.id
|
||||||
|
}
|
||||||
|
function deleteOk(){
|
||||||
|
deleteDialog.value = false;
|
||||||
|
console.log(deleteId.value)
|
||||||
|
requests.userDelete(deleteId.value, token).then((res)=>{
|
||||||
|
console.log("deleteResult:",res)
|
||||||
|
if (res.data.code === 200) {
|
||||||
|
message.success('删除成功')
|
||||||
|
}else {
|
||||||
|
message.error('删除失败')
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
}
|
||||||
|
function deleteCancel(){
|
||||||
|
deleteDialog.value = false;
|
||||||
|
message.info('取消删除')
|
||||||
|
}
|
||||||
|
|
||||||
|
function showEditDialog(index, row){
|
||||||
|
editDialog.value = true
|
||||||
|
updateData.id = row.id
|
||||||
|
updateData.username = row.username
|
||||||
|
updateData.address = row.address
|
||||||
|
updateData.phone = row.phone
|
||||||
|
updateData.email = row.email
|
||||||
|
updateData.age = row.age
|
||||||
|
updateData.signature = row.signature
|
||||||
|
updateData.sex = row.sex
|
||||||
|
updateData.avatar = row.avatar
|
||||||
|
updateData.nickname = row.nickname
|
||||||
|
updateData.description = row.description
|
||||||
|
if (row.sex === 1) {
|
||||||
|
sex.value = '男'
|
||||||
|
}else {
|
||||||
|
sex.value = '女'
|
||||||
|
}
|
||||||
|
}
|
||||||
|
function editOk(){
|
||||||
|
loadingTable.value = true
|
||||||
|
editDialog.value = false;
|
||||||
|
requests.userEdit(updateData,token).then((res)=>{
|
||||||
|
console.log("editResult:",res)
|
||||||
|
console.log("updateData:",updateData)
|
||||||
|
if (res.data.code === 200) {
|
||||||
|
getAll()
|
||||||
|
message.success('修改成功')
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
loadingTable.value = false
|
||||||
|
message.error('修改失败')
|
||||||
|
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
}
|
||||||
|
function editCancel(){
|
||||||
|
editDialog.value = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
const searchData = reactive({
|
||||||
|
username: '',
|
||||||
|
phone: ''
|
||||||
|
})
|
||||||
|
function searchUser(){
|
||||||
|
loadingTable.value = true
|
||||||
|
if (searchData.username === '' && searchData.phone === '') {
|
||||||
|
getAll()
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
requests.userCurrent(searchData,token).then((res)=>{
|
||||||
|
loadingTable.value = false
|
||||||
|
console.log("searchResult:",res)
|
||||||
|
if (res.data.code === 200) {
|
||||||
|
states.data = []
|
||||||
|
states.data[0] = res.data.data.user
|
||||||
|
message.success('查询成功')
|
||||||
|
console.log(loadingTable.value)
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
message.error(res.data.message)
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
</script>
|
@ -1,3 +1,407 @@
|
|||||||
|
<style scoped>
|
||||||
|
.addinput{
|
||||||
|
//display: flex;
|
||||||
|
//flex-direction: column;
|
||||||
|
//justify-content: center;
|
||||||
|
//align-content: center;
|
||||||
|
}
|
||||||
|
|
||||||
|
.addinput>div>input{
|
||||||
|
/*width:300px ;*/
|
||||||
|
/*height: 30px;*/
|
||||||
|
/*border-radius: 5px;*/
|
||||||
|
//margin: 0 auto;
|
||||||
|
//outline-color: #94beae;
|
||||||
|
|
||||||
|
}
|
||||||
|
</style>
|
||||||
<template>
|
<template>
|
||||||
this is 团队简介
|
<div style="width: 87vw;height:90vh;position: relative;margin: 0;padding: 0">
|
||||||
|
<div style="padding:20px 10px;">
|
||||||
|
<Space>
|
||||||
|
<span>创建者:</span>
|
||||||
|
<Input v-model="searchData.username" placeholder="username" clearable style="width: 200px" />
|
||||||
|
<span>团队名称:</span>
|
||||||
|
<Input v-model="searchData.phone" placeholder="Enter phone" style="width: auto" />
|
||||||
|
<Button @click="searchUser" type="primary" shape="circle" icon="ios-search">查询</Button>
|
||||||
|
<Button type="primary" ghost @click="showAddDialog">新增</Button>
|
||||||
|
|
||||||
|
</Space>
|
||||||
|
</div>
|
||||||
|
<!-- 表格内容-->
|
||||||
|
<div style="width: 87vw; height: 78vh; margin: 0; padding: 0">
|
||||||
|
<Table border :loading="loadingTable" ref="selection" :columns="columns" :data="states.data" style="height: 72vh ;text-align: center;" :row-class-name="setRowClassName" >
|
||||||
|
|
||||||
|
|
||||||
|
<template #status="{ row, index }">
|
||||||
|
<Switch size="large" v-model="states.data[index].accountNoLocked" :before-change="handleBeforeSwitchChange">
|
||||||
|
<template #open>
|
||||||
|
<span>开启</span>
|
||||||
|
</template>
|
||||||
|
<template #close>
|
||||||
|
<span>关闭</span>
|
||||||
|
</template>
|
||||||
|
</Switch>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<template #action="{ row, index }">
|
||||||
|
<Button type="primary" size="small" style="margin-right: 5px" @click="showEditDialog(index, row)">编辑</Button>
|
||||||
|
<Button type="error" size="small" @click="showDeleteDialog(index, row)">删除</Button>
|
||||||
|
</template>
|
||||||
|
<template #number="{ row, index }">
|
||||||
|
<Button type="success" ghost size="small" style="margin-right: 10px;padding-left: -100px">成就</Button>
|
||||||
|
<Button type="success" size="small">成员</Button>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
</Table>
|
||||||
|
<div style="height: 6vh ;text-align: left;padding-top: 20px">
|
||||||
|
<Page :total="states.data.length" size="small" show-elevator show-sizer />
|
||||||
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<!-- 对话框-->
|
||||||
|
<div>
|
||||||
|
<Modal
|
||||||
|
v-model="editDialog"
|
||||||
|
title="编辑"
|
||||||
|
@on-ok="editOk"
|
||||||
|
@on-cancel="editCancel">
|
||||||
|
<div style="">
|
||||||
|
<div style="margin-bottom: 10px">
|
||||||
|
<span>
|
||||||
|
团队名称:<Input v-model="updateData.username" placeholder="Enter something..." style="width: 200px;margin-bottom: 10px" />
|
||||||
|
</span>
|
||||||
|
<br>
|
||||||
|
<span>
|
||||||
|
<label>成就数:</label><Input placeholder="" style="width:80px" readonly/>
|
||||||
|
<label style="margin-left: 50px">团队总人数:</label><Input placeholder="" readonly style="width: 80px" />
|
||||||
|
</span>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div style="margin-bottom: 10px">团队标志:
|
||||||
|
<Upload action="//jsonplaceholder.typicode.com/posts/">
|
||||||
|
<Button icon="ios-cloud-upload-outline">点击上传头像</Button>
|
||||||
|
</Upload></div>
|
||||||
|
|
||||||
|
|
||||||
|
<div style="margin-bottom: 10px">团队描述:<Input v-model="updateData.description" type="textarea" :rows="4" placeholder="Enter something..." style="width: 435px" /></div>
|
||||||
|
</div>
|
||||||
|
</Modal>
|
||||||
|
|
||||||
|
|
||||||
|
<Modal
|
||||||
|
v-model="deleteDialog"
|
||||||
|
title="删除"
|
||||||
|
@on-ok="deleteOk"
|
||||||
|
@on-cancel="deleteCancel">
|
||||||
|
<p>请问是否要删除xxx数据</p>
|
||||||
|
</Modal>
|
||||||
|
|
||||||
|
<Modal v-model="addDialog" title="新增团队信息" @on-ok="addOk" @on-cancel="addCancel" >
|
||||||
|
<div>
|
||||||
|
|
||||||
|
<div style="margin-left: 15px">团队名称:<Input v-model="addData.password" placeholder="Enter something..." style="width: 250px; margin-bottom: 10px" type="password"/></div>
|
||||||
|
<div style="margin-left: 15px">创建者:<Input v-model="addData.address" placeholder="Enter something..." style="width: 250px; margin-bottom: 10px" /></div>
|
||||||
|
<div style="margin-left: 15px">项目数:<Input v-model="addData.phone" placeholder="Enter something..." style="width: 250px; margin-bottom: 10px" /></div>
|
||||||
|
<div style="margin-left: 15px">成就数:<Input v-model="addData.email" placeholder="Enter something..." style="width: 250px; margin-bottom: 10px" /></div>
|
||||||
|
<div style="margin-left: 15px">团队总人数:<Input v-model="addData.age" placeholder="Enter something..." style="width: 250px" type="number" /></div>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</Modal>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
|
<script setup>
|
||||||
|
import {Page, Radio, RadioGroup, Space, Switch, Upload} from "view-ui-plus";
|
||||||
|
import requests from "../../public/request.js"
|
||||||
|
import {reactive, ref} from "vue";
|
||||||
|
import message from "view-ui-plus/src/components/message/index.js";
|
||||||
|
import {onMounted, onBeforeUpdate} from "vue";
|
||||||
|
import modal from "view-ui-plus/src/components/modal/index.js";
|
||||||
|
|
||||||
|
const currentPage = ref(1) // 当前页码
|
||||||
|
const pageSize = ref(10) // 每页显示的数据条数
|
||||||
|
const addDialog = ref(false)
|
||||||
|
const deleteDialog = ref(false)
|
||||||
|
const editDialog = ref(false)
|
||||||
|
const token = window.localStorage.getItem('token')
|
||||||
|
const AllUser = reactive({
|
||||||
|
page:1,
|
||||||
|
limit: 10,
|
||||||
|
search: null,
|
||||||
|
role: null
|
||||||
|
})
|
||||||
|
const columns = reactive( [
|
||||||
|
{
|
||||||
|
type: "selection",
|
||||||
|
width: 60,
|
||||||
|
align: "center"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: "团队名称",
|
||||||
|
key: "username",
|
||||||
|
align: "center"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: "创建者",
|
||||||
|
key: "jobId",
|
||||||
|
width: 150,
|
||||||
|
align: "center"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: "项目数",
|
||||||
|
key: "phone",
|
||||||
|
width: 150,
|
||||||
|
align: "center"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: "成就数",
|
||||||
|
key: "email",
|
||||||
|
align: "center"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: "团队总人数",
|
||||||
|
key: "email",
|
||||||
|
align: "center"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: "团队优势",
|
||||||
|
slot: "",
|
||||||
|
align: "center"
|
||||||
|
},
|
||||||
|
|
||||||
|
{
|
||||||
|
title: "操作",
|
||||||
|
slot: "action",
|
||||||
|
width: 150,
|
||||||
|
align: "center"
|
||||||
|
}
|
||||||
|
])
|
||||||
|
const states = reactive({
|
||||||
|
data:[]
|
||||||
|
})
|
||||||
|
const loadingTable = ref(true)
|
||||||
|
const sex = ref('男')
|
||||||
|
const roleSingle = ref(1)
|
||||||
|
const updateData = reactive({
|
||||||
|
id: 0,
|
||||||
|
username: '',
|
||||||
|
address: '',
|
||||||
|
phone: '',
|
||||||
|
email: '',
|
||||||
|
age: '',
|
||||||
|
signature: '',
|
||||||
|
sex: '',
|
||||||
|
avatar: '',
|
||||||
|
nickname: '',
|
||||||
|
description: '',
|
||||||
|
enabled: true,
|
||||||
|
isExpired: false,
|
||||||
|
passwordExpired: false,
|
||||||
|
recommend: false,
|
||||||
|
isLocked: false
|
||||||
|
})
|
||||||
|
const cityList= reactive([
|
||||||
|
{
|
||||||
|
value: 1,
|
||||||
|
label: '管理员'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
value: 2,
|
||||||
|
label: '老师'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
value: 3,
|
||||||
|
label: '学生'
|
||||||
|
}
|
||||||
|
])
|
||||||
|
const userLock = reactive({
|
||||||
|
id: -1,
|
||||||
|
isLock: 1
|
||||||
|
})
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 配置代码
|
||||||
|
*/
|
||||||
|
message.config({
|
||||||
|
background: true
|
||||||
|
})
|
||||||
|
function setRowClassName(row, index) {
|
||||||
|
return 'custom-row';
|
||||||
|
}
|
||||||
|
|
||||||
|
onMounted(() => {
|
||||||
|
getAll()
|
||||||
|
})
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 方法函数
|
||||||
|
*/
|
||||||
|
|
||||||
|
function getAll() {
|
||||||
|
|
||||||
|
requests.userAllCurrent(AllUser,token).then((res)=>{
|
||||||
|
console.log(res)
|
||||||
|
// states.data = res.data.data
|
||||||
|
// console.log(res.data.data)
|
||||||
|
loadingTable.value = false
|
||||||
|
for (let i = 0; i < res.data.data.length; i++) {
|
||||||
|
states.data[i] = res.data.data[i].user
|
||||||
|
}
|
||||||
|
console.log("getAll:",states.data)
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
function handleBeforeSwitchChange(index, row) {
|
||||||
|
return new Promise((resolve) => {
|
||||||
|
this.$Modal.confirm({
|
||||||
|
title: '切换确认',
|
||||||
|
content: '您确认要切换开关状态吗?',
|
||||||
|
onOk: () => {
|
||||||
|
resolve();
|
||||||
|
message.success('切换成功')
|
||||||
|
}
|
||||||
|
})
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
function handlePageChange(newPage) {
|
||||||
|
this.currentPage = newPage; // 更新当前页码
|
||||||
|
}
|
||||||
|
|
||||||
|
const addData = reactive({
|
||||||
|
username: '',
|
||||||
|
password: '',
|
||||||
|
address: '',
|
||||||
|
phone: '',
|
||||||
|
email: '',
|
||||||
|
sex: 1,
|
||||||
|
age: ''
|
||||||
|
})
|
||||||
|
function showAddDialog(){
|
||||||
|
addDialog.value = true
|
||||||
|
|
||||||
|
}
|
||||||
|
function addOk () {
|
||||||
|
if (sex.value === '男') {
|
||||||
|
addData.sex = 1
|
||||||
|
}else {
|
||||||
|
addData.sex = 0
|
||||||
|
}
|
||||||
|
requests.userAdd(addData, token).then((res)=>{
|
||||||
|
if (res.data.code===200) {
|
||||||
|
message.success('新增成功')
|
||||||
|
getAll()
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
message.error('新增失败')
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
function addCancel () {
|
||||||
|
message.info('取消新增')
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
const deleteId = ref(0)
|
||||||
|
function showDeleteDialog(index, row){
|
||||||
|
deleteDialog.value = true
|
||||||
|
deleteId.value = row.id
|
||||||
|
}
|
||||||
|
function deleteOk(){
|
||||||
|
deleteDialog.value = false;
|
||||||
|
console.log(deleteId.value)
|
||||||
|
requests.userDelete(deleteId.value, token).then((res)=>{
|
||||||
|
console.log("deleteResult:",res)
|
||||||
|
if (res.data.code === 200) {
|
||||||
|
message.success('删除成功')
|
||||||
|
}else {
|
||||||
|
message.error('删除失败')
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
}
|
||||||
|
function deleteCancel(){
|
||||||
|
deleteDialog.value = false;
|
||||||
|
message.info('取消删除')
|
||||||
|
}
|
||||||
|
|
||||||
|
function showEditDialog(index, row){
|
||||||
|
editDialog.value = true
|
||||||
|
updateData.id = row.id
|
||||||
|
updateData.username = row.username
|
||||||
|
updateData.address = row.address
|
||||||
|
updateData.phone = row.phone
|
||||||
|
updateData.email = row.email
|
||||||
|
updateData.age = row.age
|
||||||
|
updateData.signature = row.signature
|
||||||
|
updateData.sex = row.sex
|
||||||
|
updateData.avatar = row.avatar
|
||||||
|
updateData.nickname = row.nickname
|
||||||
|
updateData.description = row.description
|
||||||
|
if (row.sex === 1) {
|
||||||
|
sex.value = '男'
|
||||||
|
}else {
|
||||||
|
sex.value = '女'
|
||||||
|
}
|
||||||
|
}
|
||||||
|
function editOk(){
|
||||||
|
loadingTable.value = true
|
||||||
|
editDialog.value = false;
|
||||||
|
requests.userEdit(updateData,token).then((res)=>{
|
||||||
|
console.log("editResult:",res)
|
||||||
|
console.log("updateData:",updateData)
|
||||||
|
if (res.data.code === 200) {
|
||||||
|
getAll()
|
||||||
|
message.success('修改成功')
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
loadingTable.value = false
|
||||||
|
message.error('修改失败')
|
||||||
|
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
}
|
||||||
|
function editCancel(){
|
||||||
|
editDialog.value = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
const searchData = reactive({
|
||||||
|
username: '',
|
||||||
|
phone: ''
|
||||||
|
})
|
||||||
|
function searchUser(){
|
||||||
|
loadingTable.value = true
|
||||||
|
if (searchData.username === '' && searchData.phone === '') {
|
||||||
|
getAll()
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
requests.userCurrent(searchData,token).then((res)=>{
|
||||||
|
loadingTable.value = false
|
||||||
|
console.log("searchResult:",res)
|
||||||
|
if (res.data.code === 200) {
|
||||||
|
states.data = []
|
||||||
|
states.data[0] = res.data.data.user
|
||||||
|
message.success('查询成功')
|
||||||
|
console.log(loadingTable.value)
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
message.error(res.data.message)
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
</script>
|
Loading…
x
Reference in New Issue
Block a user