mirror of
https://github.com/lkddi/nexusphp.git
synced 2026-04-23 11:27:24 +08:00
exam support valid multiple
This commit is contained in:
@@ -0,0 +1,198 @@
|
||||
<template>
|
||||
<div>
|
||||
<el-row>
|
||||
<el-col :span="12" v-loading="loading">
|
||||
<el-card class="box-card">
|
||||
<table class="table-base-info">
|
||||
<tr>
|
||||
<td>ID</td>
|
||||
<td>{{formData.id}}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Status</td>
|
||||
<td>{{formData.status_text}}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>UID</td>
|
||||
<td>{{formData.uid}}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Username</td>
|
||||
<td>{{formData.user && formData.user.username}}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Torrent ID</td>
|
||||
<td>{{formData.torrent && formData.torrent.id}}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Torrent name</td>
|
||||
<td>{{formData.torrent && formData.torrent.name}}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Uploaded</td>
|
||||
<td>{{formData.snatch && formData.snatch.upload_text}}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Downloaded</td>
|
||||
<td>{{formData.snatch && formData.snatch.download_text}}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Share ratio</td>
|
||||
<td>{{formData.snatch && formData.snatch.share_ratio}}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Seed time required</td>
|
||||
<td>{{formData.seed_time_required}}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Inspect time left</td>
|
||||
<td>{{formData.inspect_time_left}}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Comment</td>
|
||||
<td v-html="formData.comment"></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Created at</td>
|
||||
<td>{{formData.created_at}}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Updated at</td>
|
||||
<td>{{formData.updated_at}}</td>
|
||||
</tr>
|
||||
</table>
|
||||
<el-divider></el-divider>
|
||||
<div style="text-align: center">
|
||||
<el-popconfirm
|
||||
title="Confirm Remove ?"
|
||||
@confirm="handleDelete(formData.id)"
|
||||
>
|
||||
<template #reference>
|
||||
<el-button type="danger">Remove</el-button>
|
||||
</template>
|
||||
</el-popconfirm>
|
||||
<el-popconfirm
|
||||
title="Confirm Pardon ?"
|
||||
@confirm="handlePardon(formData.id)"
|
||||
v-if="formData.status != 4"
|
||||
>
|
||||
<template #reference>
|
||||
<el-button type="primary">Pardon</el-button>
|
||||
</template>
|
||||
</el-popconfirm>
|
||||
</div>
|
||||
</el-card>
|
||||
</el-col>
|
||||
</el-row>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
|
||||
<script>
|
||||
import { reactive, ref, toRefs, onMounted, onBeforeUnmount, getCurrentInstance } from 'vue'
|
||||
import { ElMessage } from 'element-plus'
|
||||
import { useRoute, useRouter } from 'vue-router'
|
||||
import { localGet } from '../../utils'
|
||||
import api from "../../utils/api";
|
||||
|
||||
export default {
|
||||
name: 'HrDetail',
|
||||
setup() {
|
||||
const { proxy } = getCurrentInstance()
|
||||
console.log('proxy', proxy)
|
||||
const formRef = ref(null)
|
||||
const route = useRoute()
|
||||
const router = useRouter()
|
||||
const { id } = route.query
|
||||
const state = reactive({
|
||||
loading: false,
|
||||
id: id,
|
||||
agentAllows: [],
|
||||
formData: {
|
||||
|
||||
},
|
||||
rules: {
|
||||
family_id: [
|
||||
{ required: 'true', }
|
||||
],
|
||||
name: [
|
||||
{ required: 'true', }
|
||||
],
|
||||
peer_id: [
|
||||
{ required: 'true', }
|
||||
],
|
||||
agent: [
|
||||
{ required: 'true', }
|
||||
],
|
||||
},
|
||||
})
|
||||
onMounted( async () => {
|
||||
if (id) {
|
||||
await fetchPageData()
|
||||
}
|
||||
})
|
||||
onBeforeUnmount(() => {
|
||||
|
||||
})
|
||||
const submitAdd = () => {
|
||||
formRef.value.validate(async (vaild) => {
|
||||
if (vaild) {
|
||||
let params = state.formData;
|
||||
console.log(params)
|
||||
if (id) {
|
||||
await api.updateAgentDeny(id, params)
|
||||
} else {
|
||||
await api.storeAgentDeny(params)
|
||||
}
|
||||
await router.push({name: 'agent-deny'})
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
const fetchPageData = async () => {
|
||||
state.loading = true;
|
||||
let res = await api.getHr(id)
|
||||
state.loading = false
|
||||
state.formData = res.data
|
||||
}
|
||||
|
||||
const getAgentAllow = async (id) => {
|
||||
let res = await api.getAgentAllow(id)
|
||||
console.log(res)
|
||||
}
|
||||
|
||||
const handleDelete = async (id) => {
|
||||
let res = await api.deleteHr(id)
|
||||
ElMessage.success(res.msg)
|
||||
await router.push({name: 'hr'})
|
||||
}
|
||||
|
||||
const handlePardon = async (id) => {
|
||||
let res = await api.pardonHr(id)
|
||||
ElMessage.success(res.msg)
|
||||
await fetchPageData()
|
||||
}
|
||||
|
||||
return {
|
||||
...toRefs(state),
|
||||
formRef,
|
||||
submitAdd,
|
||||
handleDelete,
|
||||
handlePardon
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
|
||||
.table-base-info {
|
||||
width: 100%;
|
||||
text-align: left;
|
||||
tr {
|
||||
td {
|
||||
padding: 4px;
|
||||
}
|
||||
}
|
||||
}
|
||||
</style>
|
||||
@@ -0,0 +1,250 @@
|
||||
<template>
|
||||
<el-card class="">
|
||||
<template #header>
|
||||
<div class="nexus-table-header">
|
||||
<div class="left">
|
||||
<el-form :inline="true" :model="query">
|
||||
<el-form-item label="">
|
||||
<el-select v-model="query.status" filterable placeholder="Status">
|
||||
<el-option
|
||||
v-for="(item) in extraData.status"
|
||||
:key="item.status"
|
||||
:label="item.text"
|
||||
:value="item.status"
|
||||
>
|
||||
</el-option>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="">
|
||||
<el-input placeholder="UID" v-model="query.uid"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="">
|
||||
<el-input placeholder="Username" v-model="query.username"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="">
|
||||
<el-input placeholder="Torrent ID" v-model="query.torrent_id"></el-input>
|
||||
</el-form-item>
|
||||
|
||||
<el-form-item>
|
||||
<el-button type="primary" @click="fetchTableData">Query</el-button>
|
||||
<el-button type="primary" @click="handleReset">Reset</el-button>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
</div>
|
||||
<!-- <div class="right">-->
|
||||
<!-- <el-button type="primary" icon="Plus" @click="handleAdd">Add</el-button>-->
|
||||
<!-- </div>-->
|
||||
</div>
|
||||
</template>
|
||||
<el-table
|
||||
v-loading="loading"
|
||||
ref="multipleTable"
|
||||
:data="tableData"
|
||||
tooltip-effect="dark"
|
||||
@selection-change="handleSelectionChange">
|
||||
<el-table-column
|
||||
type="selection"
|
||||
width="55">
|
||||
</el-table-column>
|
||||
<el-table-column
|
||||
prop="id"
|
||||
label="Id"
|
||||
width="50"
|
||||
>
|
||||
</el-table-column>
|
||||
|
||||
<el-table-column
|
||||
prop=""
|
||||
label="Username"
|
||||
:formatter="formatColumnUsername"
|
||||
>
|
||||
</el-table-column>
|
||||
|
||||
<el-table-column
|
||||
prop=""
|
||||
label="Torrent"
|
||||
width="300"
|
||||
>
|
||||
<template #default="scope">
|
||||
<a class="text-one-line" :title="scope.row.torrent.name" :href="scope.row.torrent.details_url" target="_blank">{{scope.row.torrent.name}}</a>
|
||||
</template>
|
||||
</el-table-column>
|
||||
|
||||
<el-table-column
|
||||
prop=""
|
||||
label="Uploaded"
|
||||
width="160"
|
||||
:formatter="formatColumnUploaded"
|
||||
>
|
||||
</el-table-column>
|
||||
|
||||
<el-table-column
|
||||
prop=""
|
||||
label="Downloaded"
|
||||
width="160"
|
||||
:formatter="formatColumnDownloaded"
|
||||
>
|
||||
</el-table-column>
|
||||
|
||||
<el-table-column
|
||||
prop=""
|
||||
label="Share ratio"
|
||||
width="120"
|
||||
:formatter="formatColumnShareRatio"
|
||||
></el-table-column>
|
||||
|
||||
<el-table-column
|
||||
prop="seed_time_required"
|
||||
label="Seed time required"
|
||||
width="160"
|
||||
></el-table-column>
|
||||
|
||||
<el-table-column
|
||||
prop="inspect_time_left"
|
||||
label="Inspect time left"
|
||||
width="160"
|
||||
></el-table-column>
|
||||
|
||||
<el-table-column
|
||||
prop="status_text"
|
||||
label="Status"
|
||||
width="70"
|
||||
></el-table-column>
|
||||
|
||||
<el-table-column
|
||||
prop="created_at"
|
||||
label="Created at"
|
||||
width="160"
|
||||
></el-table-column>
|
||||
|
||||
<el-table-column
|
||||
label="Action"
|
||||
width="120"
|
||||
>
|
||||
<template #default="scope">
|
||||
<a style="cursor: pointer; margin-right: 10px" @click="handleDetail(scope.row.id)">Detail</a>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
<!--总数超过一页,再展示分页器-->
|
||||
<el-pagination
|
||||
background
|
||||
layout="prev, pager, next"
|
||||
:total="total"
|
||||
:page-size="perPage"
|
||||
:current-page="currentPage"
|
||||
@current-change="changePage"
|
||||
/>
|
||||
</el-card>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { onMounted, reactive, ref, toRefs } from 'vue'
|
||||
import { ElMessage } from 'element-plus'
|
||||
import { useRouter } from 'vue-router'
|
||||
import api from '../../utils/api'
|
||||
import { useTable, renderTableData } from '../../utils/table'
|
||||
|
||||
export default {
|
||||
name: 'HrTable',
|
||||
setup() {
|
||||
const multipleTable = ref(null)
|
||||
const router = useRouter()
|
||||
|
||||
const state = useTable()
|
||||
let extraData = reactive({
|
||||
status: []
|
||||
});
|
||||
|
||||
onMounted(() => {
|
||||
console.log('MedalTable onMounted')
|
||||
fetchTableData()
|
||||
})
|
||||
const fetchTableData = async () => {
|
||||
state.loading = true
|
||||
await listHrStatus()
|
||||
let res = await api.listHr(state.query)
|
||||
renderTableData(res, state)
|
||||
state.loading = false
|
||||
}
|
||||
const handlePardon = () => {
|
||||
router.push({ name: 'agent-deny-form' })
|
||||
}
|
||||
const handleDetail = (id) => {
|
||||
router.push({ path: '/hr-detail', query: { id } })
|
||||
}
|
||||
const handleDelete = async (id) => {
|
||||
let res = await api.deleteHr(id)
|
||||
ElMessage.success(res.msg)
|
||||
state.query.page = 1;
|
||||
await fetchTableData()
|
||||
}
|
||||
const handleSelectionChange = (val) => {
|
||||
state.multipleSelection = val
|
||||
}
|
||||
const changePage = (val) => {
|
||||
state.query.page = val
|
||||
fetchTableData()
|
||||
}
|
||||
|
||||
const listHrStatus = async () => {
|
||||
let res = await api.listHrStatus()
|
||||
extraData.status = res.data
|
||||
}
|
||||
|
||||
const handleReset = () => {
|
||||
state.query.status = '';
|
||||
state.query.uid = '';
|
||||
state.query.username = '';
|
||||
state.query.torrent_id = '';
|
||||
}
|
||||
|
||||
const formatColumnUsername = (row, column) => {
|
||||
return row.user.username
|
||||
}
|
||||
|
||||
const formatColumnTorrent = (row, column) => {
|
||||
return '<a href="" target="_blank">' + row.torrent.name + '</a>'
|
||||
}
|
||||
|
||||
const formatColumnUploaded = (row, column) => {
|
||||
return row.snatch.upload_text
|
||||
}
|
||||
|
||||
const formatColumnDownloaded = (row, column) => {
|
||||
return row.snatch.download_text
|
||||
}
|
||||
|
||||
const formatColumnShareRatio = (row, column) => {
|
||||
return row.snatch.share_ratio
|
||||
}
|
||||
|
||||
return {
|
||||
...toRefs(state),
|
||||
extraData,
|
||||
multipleTable,
|
||||
handleSelectionChange,
|
||||
handlePardon,
|
||||
handleDetail,
|
||||
handleDelete,
|
||||
fetchTableData,
|
||||
changePage,
|
||||
handleReset,
|
||||
formatColumnUsername,
|
||||
formatColumnTorrent,
|
||||
formatColumnUploaded,
|
||||
formatColumnDownloaded,
|
||||
formatColumnShareRatio,
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
.swiper-container {
|
||||
min-height: 100%;
|
||||
}
|
||||
.el-card.is-always-shadow {
|
||||
min-height: 100%!important;
|
||||
}
|
||||
</style>
|
||||
Reference in New Issue
Block a user