|
|
|
|
@ -16,19 +16,19 @@
|
|
|
|
|
<div class="search-section">
|
|
|
|
|
<el-form :model="filters" inline>
|
|
|
|
|
<el-form-item>
|
|
|
|
|
<el-input v-model="filters.keyword" placeholder="搜索标题、内容或用户名"></el-input>
|
|
|
|
|
<el-input v-model="filters.keyword" placeholder="搜索标题" clearable></el-input>
|
|
|
|
|
</el-form-item>
|
|
|
|
|
<el-form-item>
|
|
|
|
|
<el-select v-model="filters.status" placeholder="全部状态" clearable>
|
|
|
|
|
<el-option label="待审核" value="pending"></el-option>
|
|
|
|
|
<el-option label="已通过" value="approved"></el-option>
|
|
|
|
|
<el-option label="已拒绝" value="rejected"></el-option>
|
|
|
|
|
<el-option label="待审核" value="0"></el-option>
|
|
|
|
|
<el-option label="已通过" value="1"></el-option>
|
|
|
|
|
<el-option label="已拒绝" value="2"></el-option>
|
|
|
|
|
</el-select>
|
|
|
|
|
</el-form-item>
|
|
|
|
|
<el-form-item>
|
|
|
|
|
<el-select v-model="filters.type" placeholder="全部类型" clearable>
|
|
|
|
|
<el-option label="供应" value="supply"></el-option>
|
|
|
|
|
<el-option label="需求" value="demand"></el-option>
|
|
|
|
|
<el-option label="供应" value="1"></el-option>
|
|
|
|
|
<el-option label="需求" value="2"></el-option>
|
|
|
|
|
</el-select>
|
|
|
|
|
</el-form-item>
|
|
|
|
|
<el-form-item>
|
|
|
|
|
@ -55,57 +55,57 @@
|
|
|
|
|
<el-table-column label="供需信息" min-width="250">
|
|
|
|
|
<template slot-scope="scope">
|
|
|
|
|
<div class="supply-title">{{ scope.row.title }}</div>
|
|
|
|
|
<div class="supply-desc">{{ scope.row.description }}</div>
|
|
|
|
|
<div class="supply-desc">{{ scope.row.content }}</div>
|
|
|
|
|
</template>
|
|
|
|
|
</el-table-column>
|
|
|
|
|
<el-table-column label="类型" width="100">
|
|
|
|
|
<template slot-scope="scope">
|
|
|
|
|
<el-tag :type="scope.row.type === 'supply' ? 'success' : 'primary'" size="small">{{ scope.row.typeText }}</el-tag>
|
|
|
|
|
<el-tag :type="scope.row.type === 1 ? 'success' : 'primary'" size="small">
|
|
|
|
|
{{ scope.row.type === 1 ? '供应' : '需求' }}
|
|
|
|
|
</el-tag>
|
|
|
|
|
</template>
|
|
|
|
|
</el-table-column>
|
|
|
|
|
<el-table-column label="发布者" width="150">
|
|
|
|
|
<template slot-scope="scope">
|
|
|
|
|
<div class="user-info">
|
|
|
|
|
<div class="user-avatar">{{ scope.row.publisher.name.charAt(0) }}</div>
|
|
|
|
|
<div class="user-avatar">{{ (scope.row.user && scope.row.user.name && scope.row.user.name.charAt(0)) || 'U' }}</div>
|
|
|
|
|
<div>
|
|
|
|
|
<div class="user-name">{{ scope.row.publisher.name }}</div>
|
|
|
|
|
<div class="user-year">{{ scope.row.publisher.year }}届</div>
|
|
|
|
|
<div class="user-name">{{ (scope.row.user && scope.row.user.name) || '-' }}</div>
|
|
|
|
|
<div class="user-year">{{ (scope.row.user && scope.row.user.company_position) || '-' }}</div>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
</template>
|
|
|
|
|
</el-table-column>
|
|
|
|
|
<el-table-column label="状态" width="120">
|
|
|
|
|
<template slot-scope="scope">
|
|
|
|
|
<el-tag :type="getStatusTagType(scope.row.status)" size="small">{{ scope.row.statusText }}</el-tag>
|
|
|
|
|
<el-tag :type="getStatusTagType(scope.row.status)" size="small">
|
|
|
|
|
{{ getStatusText(scope.row.status) }}
|
|
|
|
|
</el-tag>
|
|
|
|
|
</template>
|
|
|
|
|
</el-table-column>
|
|
|
|
|
<el-table-column label="优先级" width="100">
|
|
|
|
|
<el-table-column label="联系方式" width="150">
|
|
|
|
|
<template slot-scope="scope">
|
|
|
|
|
<el-tag :type="getPriorityTagType(scope.row.priority)" size="small">{{ scope.row.priorityText }}</el-tag>
|
|
|
|
|
<div v-if="scope.row.mobile" class="contact-info">
|
|
|
|
|
<div>手机: {{ scope.row.mobile }}</div>
|
|
|
|
|
</div>
|
|
|
|
|
<div v-else-if="scope.row.wechat" class="contact-info">
|
|
|
|
|
<div>微信: {{ scope.row.wechat }}</div>
|
|
|
|
|
</div>
|
|
|
|
|
<span v-else>-</span>
|
|
|
|
|
</template>
|
|
|
|
|
</el-table-column>
|
|
|
|
|
<el-table-column label="发布时间" width="150">
|
|
|
|
|
<template slot-scope="scope">
|
|
|
|
|
<div class="time-display">{{ scope.row.publishDate }}</div>
|
|
|
|
|
<div class="time-display-secondary">{{ scope.row.publishTime }}</div>
|
|
|
|
|
</template>
|
|
|
|
|
</el-table-column>
|
|
|
|
|
<el-table-column label="审核时间" width="150">
|
|
|
|
|
<template slot-scope="scope">
|
|
|
|
|
<div v-if="scope.row.auditDate">
|
|
|
|
|
<div class="time-display">{{ scope.row.auditDate }}</div>
|
|
|
|
|
<div class="time-display-secondary">{{ scope.row.auditTime }}</div>
|
|
|
|
|
</div>
|
|
|
|
|
<span v-else>-</span>
|
|
|
|
|
<div class="time-display">{{ formatDate(scope.row.created_at) }}</div>
|
|
|
|
|
<div class="time-display-secondary">{{ formatTime(scope.row.created_at) }}</div>
|
|
|
|
|
</template>
|
|
|
|
|
</el-table-column>
|
|
|
|
|
<el-table-column label="操作" width="170" fixed="right">
|
|
|
|
|
<template slot-scope="scope">
|
|
|
|
|
<div class="action-buttons">
|
|
|
|
|
<el-button v-if="scope.row.status === 'pending' || scope.row.status === 'rejected'" type="success" size="mini" icon="el-icon-check" @click="handleApprove(scope.row)">通过</el-button>
|
|
|
|
|
<el-button v-if="scope.row.status === 'approved'" type="info" size="mini" icon="el-icon-remove-outline" @click="handleHide(scope.row)">隐藏</el-button>
|
|
|
|
|
<el-button v-if="scope.row.status === 0 || scope.row.status === 2" type="success" size="mini" icon="el-icon-check" @click="handleApprove(scope.row)">通过</el-button>
|
|
|
|
|
<el-button type="primary" size="mini" icon="el-icon-edit" @click="handleEdit(scope.row)">编辑</el-button>
|
|
|
|
|
<el-button v-if="scope.row.status === 'pending'" type="danger" size="mini" icon="el-icon-close" @click="handleReject(scope.row)">拒绝</el-button>
|
|
|
|
|
<el-button v-if="scope.row.status === 0" type="danger" size="mini" icon="el-icon-close" @click="handleReject(scope.row)">拒绝</el-button>
|
|
|
|
|
<el-button type="info" size="mini" icon="el-icon-view" @click="handleView(scope.row)">详情</el-button>
|
|
|
|
|
</div>
|
|
|
|
|
</template>
|
|
|
|
|
@ -125,86 +125,93 @@
|
|
|
|
|
:total="total"
|
|
|
|
|
></el-pagination>
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
<!-- 详情弹窗 -->
|
|
|
|
|
<SupplyDemandDetail
|
|
|
|
|
:visible.sync="showDetailDialog"
|
|
|
|
|
:detail="currentDetail"
|
|
|
|
|
:readonly="true"
|
|
|
|
|
/>
|
|
|
|
|
<SupplyDemandEdit
|
|
|
|
|
:visible.sync="showEditDialog"
|
|
|
|
|
:detail="currentDetail"
|
|
|
|
|
@save="handleEditSave"
|
|
|
|
|
/>
|
|
|
|
|
</div>
|
|
|
|
|
</template>
|
|
|
|
|
|
|
|
|
|
<script>
|
|
|
|
|
import { supplyDemandList, supplyDemandSave } from '@/api/student/index.js'
|
|
|
|
|
// 详情弹窗组件
|
|
|
|
|
import SupplyDemandDetail from './components/SupplyDemandDetail.vue'
|
|
|
|
|
import SupplyDemandEdit from './components/SupplyDemandEdit.vue'
|
|
|
|
|
export default {
|
|
|
|
|
name: 'SupplyDemand',
|
|
|
|
|
components: { SupplyDemandDetail, SupplyDemandEdit },
|
|
|
|
|
data() {
|
|
|
|
|
return {
|
|
|
|
|
pendingCount: 3,
|
|
|
|
|
pendingCount: 0,
|
|
|
|
|
filters: {
|
|
|
|
|
keyword: '',
|
|
|
|
|
status: '',
|
|
|
|
|
type: '',
|
|
|
|
|
date: ''
|
|
|
|
|
},
|
|
|
|
|
list: [
|
|
|
|
|
{
|
|
|
|
|
id: 1,
|
|
|
|
|
title: '提供企业管理咨询服务',
|
|
|
|
|
description: '专业企业管理咨询团队,具有10年以上行业经验...',
|
|
|
|
|
type: 'supply',
|
|
|
|
|
typeText: '供应',
|
|
|
|
|
publisher: { name: '张总', year: '2010' },
|
|
|
|
|
status: 'pending',
|
|
|
|
|
statusText: '待审核',
|
|
|
|
|
priority: 'high',
|
|
|
|
|
priorityText: '高',
|
|
|
|
|
publishDate: '2024-01-15',
|
|
|
|
|
publishTime: '14:30',
|
|
|
|
|
auditDate: null,
|
|
|
|
|
auditTime: null
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
id: 2,
|
|
|
|
|
title: '寻找技术合作伙伴',
|
|
|
|
|
description: '我们是一家初创公司,目前在开发一款AI智能客服产品...',
|
|
|
|
|
type: 'demand',
|
|
|
|
|
typeText: '需求',
|
|
|
|
|
publisher: { name: '李经理', year: '2015' },
|
|
|
|
|
status: 'approved',
|
|
|
|
|
statusText: '已通过',
|
|
|
|
|
priority: 'medium',
|
|
|
|
|
priorityText: '中',
|
|
|
|
|
publishDate: '2024-01-14',
|
|
|
|
|
publishTime: '16:45',
|
|
|
|
|
auditDate: '2024-01-14',
|
|
|
|
|
auditTime: '17:20'
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
id: 3,
|
|
|
|
|
title: '投融资咨询服务',
|
|
|
|
|
description: '专业投融资顾问,为企业提供全方位的融资解决方案...',
|
|
|
|
|
type: 'supply',
|
|
|
|
|
typeText: '供应',
|
|
|
|
|
publisher: { name: '王顾问', year: '2008' },
|
|
|
|
|
status: 'rejected',
|
|
|
|
|
statusText: '已拒绝',
|
|
|
|
|
priority: 'low',
|
|
|
|
|
priorityText: '低',
|
|
|
|
|
publishDate: '2024-01-13',
|
|
|
|
|
publishTime: '09:15',
|
|
|
|
|
auditDate: '2024-01-13',
|
|
|
|
|
auditTime: '10:30'
|
|
|
|
|
}
|
|
|
|
|
],
|
|
|
|
|
total: 156,
|
|
|
|
|
list: [],
|
|
|
|
|
total: 0,
|
|
|
|
|
listQuery: {
|
|
|
|
|
page: 1,
|
|
|
|
|
limit: 10
|
|
|
|
|
},
|
|
|
|
|
multipleSelection: []
|
|
|
|
|
multipleSelection: [],
|
|
|
|
|
showDetailDialog: false,
|
|
|
|
|
currentDetail: null,
|
|
|
|
|
showEditDialog: false
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
created() {
|
|
|
|
|
this.getList()
|
|
|
|
|
},
|
|
|
|
|
methods: {
|
|
|
|
|
async getList() {
|
|
|
|
|
// 构造filter数组
|
|
|
|
|
const filter = []
|
|
|
|
|
if (this.filters.keyword) filter.push({ key: 'title', op: 'like', value: this.filters.keyword })
|
|
|
|
|
if (this.filters.status) filter.push({ key: 'status', op: 'eq', value: this.filters.status })
|
|
|
|
|
if (this.filters.type) filter.push({ key: 'type', op: 'eq', value: this.filters.type })
|
|
|
|
|
if (this.filters.date) {
|
|
|
|
|
let dateStr = this.filters.date
|
|
|
|
|
if (dateStr instanceof Date) {
|
|
|
|
|
const local = new Date(dateStr.getTime() + 8 * 60 * 60 * 1000)
|
|
|
|
|
dateStr = local.toISOString().slice(0, 10)
|
|
|
|
|
} else if (typeof dateStr === 'string' && dateStr.length > 10) {
|
|
|
|
|
dateStr = dateStr.slice(0, 10)
|
|
|
|
|
}
|
|
|
|
|
filter.push({ key: 'created_at', op: 'like', value: dateStr })
|
|
|
|
|
}
|
|
|
|
|
// 构造扁平化参数
|
|
|
|
|
const params = {
|
|
|
|
|
page: this.listQuery.page,
|
|
|
|
|
page_size: this.listQuery.limit
|
|
|
|
|
}
|
|
|
|
|
filter.forEach((item, idx) => {
|
|
|
|
|
params[`filter[${idx}][key]`] = item.key
|
|
|
|
|
params[`filter[${idx}][op]`] = item.op
|
|
|
|
|
params[`filter[${idx}][value]`] = item.value
|
|
|
|
|
})
|
|
|
|
|
const res = await supplyDemandList(params)
|
|
|
|
|
// 根据接口返回结构处理数据
|
|
|
|
|
this.list = res.data || []
|
|
|
|
|
this.total = res.total || 0
|
|
|
|
|
// 计算待审核数量(status为0的项)
|
|
|
|
|
this.pendingCount = this.list.filter(item => item.status === 0).length
|
|
|
|
|
},
|
|
|
|
|
handleSearch() {
|
|
|
|
|
console.log('搜索条件:', this.filters)
|
|
|
|
|
this.$message.success('搜索已触发')
|
|
|
|
|
this.listQuery.page = 1
|
|
|
|
|
this.getList()
|
|
|
|
|
},
|
|
|
|
|
handleExport() {
|
|
|
|
|
console.log('导出数据')
|
|
|
|
|
// 可根据需要实现导出逻辑
|
|
|
|
|
this.$message.info('数据导出中...')
|
|
|
|
|
},
|
|
|
|
|
handleSelectionChange(val) {
|
|
|
|
|
@ -212,72 +219,73 @@ export default {
|
|
|
|
|
},
|
|
|
|
|
getStatusTagType(status) {
|
|
|
|
|
const statusMap = {
|
|
|
|
|
pending: 'warning',
|
|
|
|
|
approved: 'success',
|
|
|
|
|
rejected: 'danger'
|
|
|
|
|
0: 'warning', // 待审核
|
|
|
|
|
1: 'success', // 已通过
|
|
|
|
|
2: 'danger' // 已拒绝
|
|
|
|
|
}
|
|
|
|
|
return statusMap[status]
|
|
|
|
|
return statusMap[status] || 'info'
|
|
|
|
|
},
|
|
|
|
|
getPriorityTagType(priority) {
|
|
|
|
|
const priorityMap = {
|
|
|
|
|
high: 'danger',
|
|
|
|
|
medium: 'warning',
|
|
|
|
|
low: 'success'
|
|
|
|
|
getStatusText(status) {
|
|
|
|
|
const statusText = {
|
|
|
|
|
0: '待审核',
|
|
|
|
|
1: '已通过',
|
|
|
|
|
2: '已拒绝'
|
|
|
|
|
}
|
|
|
|
|
return priorityMap[priority]
|
|
|
|
|
return statusText[status] || '未知'
|
|
|
|
|
},
|
|
|
|
|
handleApprove(row) {
|
|
|
|
|
this.$confirm('确定要通过这条供需信息吗?', '提示', {
|
|
|
|
|
confirmButtonText: '确定',
|
|
|
|
|
cancelButtonText: '取消',
|
|
|
|
|
type: 'success'
|
|
|
|
|
}).then(() => {
|
|
|
|
|
console.log('审核通过:', row.id)
|
|
|
|
|
// API call here
|
|
|
|
|
row.status = 'approved'
|
|
|
|
|
row.statusText = '已通过'
|
|
|
|
|
async handleApprove(row) {
|
|
|
|
|
try {
|
|
|
|
|
await supplyDemandSave({ id: row.id, status: 1 })
|
|
|
|
|
this.$message.success('审核通过成功!')
|
|
|
|
|
})
|
|
|
|
|
this.getList()
|
|
|
|
|
} catch (e) {
|
|
|
|
|
this.$message.error('操作失败')
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
handleEdit(row) {
|
|
|
|
|
console.log('编辑:', row.id)
|
|
|
|
|
this.$message.info('跳转到编辑页面')
|
|
|
|
|
this.currentDetail = row
|
|
|
|
|
this.showEditDialog = true
|
|
|
|
|
this.showDetailDialog = false
|
|
|
|
|
},
|
|
|
|
|
handleReject(row) {
|
|
|
|
|
this.$prompt('请输入拒绝原因:', '提示', {
|
|
|
|
|
confirmButtonText: '确定',
|
|
|
|
|
cancelButtonText: '取消',
|
|
|
|
|
type: 'warning'
|
|
|
|
|
}).then(({ value }) => {
|
|
|
|
|
console.log('拒绝:', row.id, '原因:', value)
|
|
|
|
|
// API call here
|
|
|
|
|
row.status = 'rejected'
|
|
|
|
|
row.statusText = '已拒绝'
|
|
|
|
|
this.$message.success('已拒绝该供需信息!')
|
|
|
|
|
})
|
|
|
|
|
async handleEditSave(form) {
|
|
|
|
|
try {
|
|
|
|
|
await supplyDemandSave(form)
|
|
|
|
|
this.$message.success('保存成功')
|
|
|
|
|
this.getList()
|
|
|
|
|
} catch (e) {
|
|
|
|
|
this.$message.error('保存失败')
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
handleHide(row) {
|
|
|
|
|
this.$confirm('确定要隐藏这条供需信息吗?', '提示', {
|
|
|
|
|
confirmButtonText: '确定',
|
|
|
|
|
cancelButtonText: '取消',
|
|
|
|
|
type: 'info'
|
|
|
|
|
}).then(() => {
|
|
|
|
|
console.log('隐藏:', row.id)
|
|
|
|
|
// API call here
|
|
|
|
|
this.$message.success('供需信息已隐藏!')
|
|
|
|
|
})
|
|
|
|
|
async handleReject(row) {
|
|
|
|
|
try {
|
|
|
|
|
await supplyDemandSave({ id: row.id, status: 2 })
|
|
|
|
|
this.$message.success('已拒绝该供需信息!')
|
|
|
|
|
this.getList()
|
|
|
|
|
} catch (e) {
|
|
|
|
|
this.$message.error('操作失败')
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
handleView(row) {
|
|
|
|
|
console.log('查看详情:', row.id)
|
|
|
|
|
this.$message.info('跳转到详情页面')
|
|
|
|
|
this.currentDetail = row
|
|
|
|
|
this.showDetailDialog = true
|
|
|
|
|
this.showEditDialog = false
|
|
|
|
|
},
|
|
|
|
|
handleSizeChange(val) {
|
|
|
|
|
this.listQuery.limit = val
|
|
|
|
|
// getList()
|
|
|
|
|
this.getList()
|
|
|
|
|
},
|
|
|
|
|
handleCurrentChange(val) {
|
|
|
|
|
this.listQuery.page = val
|
|
|
|
|
// getList()
|
|
|
|
|
this.getList()
|
|
|
|
|
},
|
|
|
|
|
formatDate(date) {
|
|
|
|
|
if (!date) return '-'
|
|
|
|
|
return date.split(' ')[0]
|
|
|
|
|
},
|
|
|
|
|
formatTime(date) {
|
|
|
|
|
if (!date) return '-'
|
|
|
|
|
const timePart = date.split(' ')[1]
|
|
|
|
|
return timePart ? timePart.substring(0, 5) : '-'
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
@ -379,6 +387,11 @@ export default {
|
|
|
|
|
color: #666;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.contact-info {
|
|
|
|
|
font-size: 12px;
|
|
|
|
|
color: #666;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.time-display {
|
|
|
|
|
font-size: 12px;
|
|
|
|
|
}
|
|
|
|
|
|