fix: 解决、改进管理后台-管理端-订单记录 相关功能
This commit is contained in:
parent
fb38439543
commit
abbd589b82
|
|
@ -1,10 +1,10 @@
|
|||
<template>
|
||||
<div class="top-right-btn" :style="style">
|
||||
<div class="top-right-btn" :style="style" v-if="search || showRefresh || columns">
|
||||
<el-row>
|
||||
<el-tooltip class="item" effect="dark" :content="showSearch ? '隐藏搜索' : '显示搜索'" placement="top" v-if="search">
|
||||
<el-button size="mini" circle icon="el-icon-search" @click="toggleSearch()" />
|
||||
</el-tooltip>
|
||||
<el-tooltip class="item" effect="dark" content="刷新" placement="top">
|
||||
<el-tooltip class="item" effect="dark" content="刷新" placement="top" v-if="showRefresh">
|
||||
<el-button size="mini" circle icon="el-icon-refresh" @click="refresh()" />
|
||||
</el-tooltip>
|
||||
<el-tooltip class="item" effect="dark" content="显隐列" placement="top" v-if="columns">
|
||||
|
|
@ -59,10 +59,15 @@ export default {
|
|||
columns: {
|
||||
type: Array
|
||||
},
|
||||
/* 是否显示检索图标 */
|
||||
/* 是否显示检索图标(隐藏搜索 / 显示搜索) */
|
||||
search: {
|
||||
type: Boolean,
|
||||
default: true
|
||||
default: false
|
||||
},
|
||||
/* 是否显示刷新 */
|
||||
showRefresh: {
|
||||
type: Boolean,
|
||||
default: false
|
||||
},
|
||||
/* 显隐列类型(transfer穿梭框、checkbox复选框) */
|
||||
showColumnsType: {
|
||||
|
|
|
|||
|
|
@ -69,12 +69,12 @@
|
|||
<span>{{ statusLabel(scope.row.status) }}</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="备注" align="center" prop="remark" show-overflow-tooltip />
|
||||
<el-table-column label="创建时间" align="center" prop="createTime" width="150">
|
||||
<template slot-scope="scope">
|
||||
<span>{{ parseTime(scope.row.createTime) }}</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="备注" align="center" prop="remark" show-overflow-tooltip />
|
||||
</el-table>
|
||||
|
||||
<pagination
|
||||
|
|
|
|||
|
|
@ -9,10 +9,10 @@
|
|||
@keyup.enter.native="handleQuery"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="用户ID" prop="userId">
|
||||
<el-form-item label="三方订单号" prop="thirdPartyOrderNum">
|
||||
<el-input
|
||||
v-model="queryParams.userId"
|
||||
placeholder="请输入用户ID"
|
||||
v-model="queryParams.thirdPartyOrderNum"
|
||||
placeholder="支持模糊搜索"
|
||||
clearable
|
||||
@keyup.enter.native="handleQuery"
|
||||
/>
|
||||
|
|
@ -25,6 +25,14 @@
|
|||
@keyup.enter.native="handleQuery"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="用户名称" prop="userName">
|
||||
<el-input
|
||||
v-model="queryParams.userName"
|
||||
placeholder="支持模糊搜索"
|
||||
clearable
|
||||
@keyup.enter.native="handleQuery"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="状态" prop="status">
|
||||
<el-select v-model="queryParams.status" placeholder="全部" clearable style="width: 140px">
|
||||
<el-option v-for="item in statusOptions" :key="item.value" :label="item.label" :value="item.value" />
|
||||
|
|
@ -62,17 +70,22 @@
|
|||
</el-row>
|
||||
|
||||
<el-table v-loading="loading" :data="orderList">
|
||||
<el-table-column label="ID" align="center" prop="id" width="72" />
|
||||
<el-table-column label="团队名称" align="center" prop="deptName" min-width="140" show-overflow-tooltip />
|
||||
<el-table-column label="用户ID" align="center" prop="userId" width="100" />
|
||||
<el-table-column label="订单号" align="center" prop="orderNum" width="100" />
|
||||
<el-table-column label="团队名称" align="center" prop="deptName" width="140" show-overflow-tooltip />
|
||||
<el-table-column label="用户名称" align="center" prop="userName" width="120" show-overflow-tooltip />
|
||||
<el-table-column label="订单号" align="center" prop="orderNum" width="200" show-overflow-tooltip />
|
||||
<el-table-column label="三方订单号" align="center" prop="thirdPartyOrderNum" width="200" show-overflow-tooltip />
|
||||
<el-table-column label="积分" align="center" prop="amount" width="100" />
|
||||
<el-table-column label="tokens" align="center" prop="totalUsage" width="100">
|
||||
<template slot-scope="scope">
|
||||
<span>{{ scope.row.totalUsage != null && scope.row.totalUsage !== '' ? scope.row.totalUsage : '—' }}</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="状态" align="center" width="100">
|
||||
<template slot-scope="scope">
|
||||
<span>{{ statusLabel(scope.row.status) }}</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="结果预览" min-width="220">
|
||||
<el-table-column label="结果预览" min-width="200">
|
||||
<template slot-scope="scope">
|
||||
<div v-if="extractVideoUrl(scope.row.result)">
|
||||
<video
|
||||
|
|
@ -85,12 +98,11 @@
|
|||
<span v-else>-</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="时间" align="center" prop="createTime" width="160">
|
||||
<el-table-column label="创建时间" align="center" prop="createTime" width="150">
|
||||
<template slot-scope="scope">
|
||||
<span>{{ parseTime(scope.row.createTime) }}</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="备注" align="center" prop="remark" min-width="140" show-overflow-tooltip />
|
||||
<el-table-column label="操作" width="90" fixed="right">
|
||||
<template slot-scope="scope">
|
||||
<el-button type="text" size="mini" @click="handleDetail(scope.row)">详情</el-button>
|
||||
|
|
@ -147,7 +159,8 @@ export default {
|
|||
pageNum: 1,
|
||||
pageSize: 10,
|
||||
orderNum: null,
|
||||
userId: null,
|
||||
thirdPartyOrderNum: null,
|
||||
userName: null,
|
||||
deptName: null,
|
||||
orderType: null,
|
||||
status: null
|
||||
|
|
@ -155,9 +168,25 @@ export default {
|
|||
}
|
||||
},
|
||||
created() {
|
||||
this.initDefaultDateRange()
|
||||
this.getList()
|
||||
},
|
||||
methods: {
|
||||
initDefaultDateRange() {
|
||||
this.dateRange = this.buildLastMonthDateRange()
|
||||
},
|
||||
buildLastMonthDateRange() {
|
||||
const end = new Date()
|
||||
const start = new Date(end.getTime())
|
||||
start.setMonth(start.getMonth() - 1)
|
||||
return [this.formatYmd(start), this.formatYmd(end)]
|
||||
},
|
||||
formatYmd(d) {
|
||||
const y = d.getFullYear()
|
||||
const m = String(d.getMonth() + 1).padStart(2, "0")
|
||||
const day = String(d.getDate()).padStart(2, "0")
|
||||
return `${y}-${m}-${day}`
|
||||
},
|
||||
orderTypeLabel(orderType) {
|
||||
const n = orderType !== undefined && orderType !== null ? Number(orderType) : null
|
||||
const hit = this.orderTypeOptions.find(o => o.value === n)
|
||||
|
|
@ -227,12 +256,17 @@ export default {
|
|||
this.getList()
|
||||
},
|
||||
resetQuery() {
|
||||
this.dateRange = []
|
||||
this.initDefaultDateRange()
|
||||
this.resetForm("queryForm")
|
||||
this.handleQuery()
|
||||
},
|
||||
handleExport() {
|
||||
this.download("ai/video/order/export", { ...this.queryParams }, `team_orders_${new Date().getTime()}.xlsx`)
|
||||
const q = { ...this.queryParams }
|
||||
this.download(
|
||||
"ai/video/order/export",
|
||||
this.addDateRange(q, this.dateRange, "CreateTime"),
|
||||
`team_orders_${new Date().getTime()}.xlsx`
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,5 +1,10 @@
|
|||
<template>
|
||||
<div class="app-container">
|
||||
<div class="overview-toolbar">
|
||||
<el-tooltip content="刷新" placement="top">
|
||||
<el-button type="default" size="mini" circle icon="el-icon-refresh" @click="load" />
|
||||
</el-tooltip>
|
||||
</div>
|
||||
<el-row :gutter="16" v-loading="loading">
|
||||
<el-col :span="8">
|
||||
<el-card shadow="hover"><div class="metric-title">团队 ID</div><div class="metric-val">{{ info.deptId }}</div></el-card>
|
||||
|
|
@ -42,8 +47,11 @@ export default {
|
|||
methods: {
|
||||
load() {
|
||||
this.loading = true
|
||||
getSubteamOverview().then(res => {
|
||||
getSubteamOverview()
|
||||
.then(res => {
|
||||
this.info = res.data || {}
|
||||
})
|
||||
.finally(() => {
|
||||
this.loading = false
|
||||
})
|
||||
}
|
||||
|
|
@ -52,6 +60,9 @@ export default {
|
|||
</script>
|
||||
|
||||
<style scoped>
|
||||
.overview-toolbar {
|
||||
margin-bottom: 12px;
|
||||
}
|
||||
.metric-title { color: #909399; font-size: 13px; }
|
||||
.metric-val { font-size: 22px; margin-top: 8px; font-weight: 600; }
|
||||
.hint { font-size: 12px; color: #909399; }
|
||||
|
|
|
|||
|
|
@ -1,18 +1,14 @@
|
|||
package com.ruoyi.ai.domain;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.Date;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import lombok.Data;
|
||||
import org.apache.commons.lang3.builder.ToStringBuilder;
|
||||
import org.apache.commons.lang3.builder.ToStringStyle;
|
||||
import com.ruoyi.common.annotation.Excel;
|
||||
import com.ruoyi.common.core.domain.BaseEntity;
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import com.ruoyi.common.annotation.Excel;
|
||||
import com.ruoyi.common.core.domain.BaseEntity;
|
||||
import lombok.Data;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
/**
|
||||
* 订单管理对象 ai_order
|
||||
*
|
||||
|
|
@ -134,5 +130,10 @@ public class AiOrder extends BaseEntity {
|
|||
@TableField(exist = false)
|
||||
private String deptName;
|
||||
|
||||
/**
|
||||
* 用户名称展示(昵称优先,否则账号),列表/模糊查询用
|
||||
*/
|
||||
@TableField(exist = false)
|
||||
private String userName;
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -36,10 +36,13 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
<result property="isBackfilled" column="is_backfilled" />
|
||||
<result property="videoGenRequestId" column="video_gen_request_id" />
|
||||
<result property="deptName" column="dept_name" />
|
||||
<result property="userName" column="user_name" />
|
||||
</resultMap>
|
||||
|
||||
<sql id="selectAiOrderVo">
|
||||
select ao.id, ao.del_flag, ao.create_by, ao.create_time, ao.update_by, ao.update_time, ao.remark, ao.order_num, ao.third_party_order_num, ao.user_id, ao.dept_id, ao.type, ao.pre_deduct_amount, ao.amount, ao.total_usage, ao.result, ao.status, ao.source, ao.text, ao.is_top, ao.img1, ao.img2, ao.mode, ao.duration, ao.resolution, ao.ratio, ao.model, ao.video_params, au.user_id uuid, ao.ext_status, ao.is_backfilled, ao.video_gen_request_id, sd.dept_name from ai_order ao
|
||||
select ao.id, ao.del_flag, ao.create_by, ao.create_time, ao.update_by, ao.update_time, ao.remark, ao.order_num, ao.third_party_order_num, ao.user_id, ao.dept_id, ao.type, ao.pre_deduct_amount, ao.amount, ao.total_usage, ao.result, ao.status, ao.source, ao.text, ao.is_top, ao.img1, ao.img2, ao.mode, ao.duration, ao.resolution, ao.ratio, ao.model, ao.video_params, au.user_id uuid, ao.ext_status, ao.is_backfilled, ao.video_gen_request_id, sd.dept_name,
|
||||
case when (au.nickname is not null and trim(au.nickname) != '') then au.nickname else au.username end as user_name
|
||||
from ai_order ao
|
||||
left join ai_user au on au.id = ao.user_id
|
||||
left join sys_dept sd on sd.dept_id = ao.dept_id
|
||||
</sql>
|
||||
|
|
@ -48,8 +51,10 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
<include refid="selectAiOrderVo"/>
|
||||
<where>
|
||||
<if test="orderNum != null and orderNum != ''"> and ao.order_num like concat('%', #{orderNum}, '%')</if>
|
||||
<if test="thirdPartyOrderNum != null and thirdPartyOrderNum != ''"> and ao.third_party_order_num like concat('%', #{thirdPartyOrderNum}, '%')</if>
|
||||
<if test="text != null and text != ''"> and ao.text like concat('%', #{text}, '%')</if>
|
||||
<if test="userId != null "> and ao.user_id = #{userId}</if>
|
||||
<if test="userName != null and userName != ''"> and (au.username like concat('%', #{userName}, '%') or au.nickname like concat('%', #{userName}, '%'))</if>
|
||||
<if test="deptId != null "> and ao.dept_id = #{deptId}</if>
|
||||
<if test="deptName != null and deptName != ''"> and sd.dept_name like concat('%', #{deptName}, '%')</if>
|
||||
<if test="uuid != null "> and au.user_id = #{uuid}</if>
|
||||
|
|
|
|||
Loading…
Reference in New Issue