683 lines
19 KiB
Vue
683 lines
19 KiB
Vue
<template>
|
|
<div class="ai-trade-list">
|
|
<!--操作栏-->
|
|
<div class="action-bar">
|
|
<el-input
|
|
placeholder="请输入用户id"
|
|
v-model="params.uid"
|
|
clearable
|
|
size="small"
|
|
class="param-input"
|
|
></el-input>
|
|
<el-input
|
|
placeholder="请输入id"
|
|
v-model="params.id"
|
|
clearable
|
|
size="small"
|
|
class="param-input"
|
|
style="width: 280px"
|
|
></el-input>
|
|
<el-select
|
|
v-model="params.status"
|
|
placeholder="请选择状态"
|
|
clearable
|
|
size="small"
|
|
style="width: 180px"
|
|
>
|
|
<el-option
|
|
v-for="item in statuses"
|
|
:key="item.value"
|
|
:label="item.label"
|
|
:value="item.value"
|
|
>
|
|
</el-option>
|
|
</el-select>
|
|
<el-button
|
|
type="primary"
|
|
size="small"
|
|
icon="el-icon-search"
|
|
@click="getList('status')"
|
|
style="margin-right: 20px"
|
|
>搜索</el-button
|
|
>
|
|
<el-button
|
|
type="danger"
|
|
size="small"
|
|
icon="el-icon-menu"
|
|
:disabled="isBatch"
|
|
plain
|
|
@click="openBatch"
|
|
>批量操作</el-button
|
|
>
|
|
</div>
|
|
<!--数据表格-->
|
|
<el-table
|
|
:data="tableData"
|
|
style="width: 100%"
|
|
border
|
|
v-loading="loading"
|
|
element-loading-text="拼命加载中"
|
|
element-loading-spinner="el-icon-loading"
|
|
ref="multipleTable"
|
|
height="600"
|
|
@selection-change="handleSelectionChange"
|
|
>
|
|
<el-table-column
|
|
type="selection"
|
|
v-if="isBatch"
|
|
width="55"
|
|
fixed="left"
|
|
align="center"
|
|
></el-table-column>
|
|
<el-table-column prop="id" label="ID" align="center" fixed width="240">
|
|
<template slot-scope="scope">
|
|
<span>{{ scope.row.id || "未知" }}</span>
|
|
</template>
|
|
</el-table-column>
|
|
<el-table-column
|
|
prop="createdAt"
|
|
label="创建时间"
|
|
align="center"
|
|
min-width="160"
|
|
>
|
|
<template slot-scope="scope">
|
|
<span>{{ initTime(scope.row.createdAt) }}</span>
|
|
</template>
|
|
</el-table-column>
|
|
<el-table-column prop="uid" label="用户ID" align="center" min-width="120">
|
|
<template slot-scope="scope">
|
|
<span>{{ scope.row.uid || "未知" }}</span>
|
|
</template>
|
|
</el-table-column>
|
|
<el-table-column label="原始图" align="center" min-width="120">
|
|
<template slot-scope="scope">
|
|
<img-load
|
|
:width="'70px'"
|
|
:height="'70px'"
|
|
:src="returnUrl(scope.row)"
|
|
></img-load>
|
|
</template>
|
|
</el-table-column>
|
|
<el-table-column
|
|
label="用户标记图"
|
|
align="center"
|
|
min-width="120"
|
|
prop="maskPics"
|
|
>
|
|
<template slot-scope="scope">
|
|
<template v-if="scope.row.maskPics">
|
|
<img-load
|
|
:width="'70px'"
|
|
:height="'70px'"
|
|
:src="imgUrl + scope.row.maskPics[0]"
|
|
></img-load>
|
|
</template>
|
|
<span v-else>暂无图片</span>
|
|
</template>
|
|
</el-table-column>
|
|
<el-table-column
|
|
prop="newPic"
|
|
label="AI脱衣图"
|
|
align="center"
|
|
width="200"
|
|
>
|
|
<template slot-scope="scope">
|
|
<span v-if="!scope.row.newPic">暂无图片</span>
|
|
<div
|
|
v-else
|
|
class="picturePreview"
|
|
>
|
|
<decrypt-img
|
|
style="width: 50px; height: 50px"
|
|
:src="imgUrl + item"
|
|
fit="fill"
|
|
v-for="(item, i) in scope.row.newPic"
|
|
:key="i"
|
|
></decrypt-img>
|
|
</div>
|
|
</template>
|
|
</el-table-column>
|
|
<el-table-column
|
|
prop="status"
|
|
label="状态"
|
|
align="center"
|
|
min-width="120"
|
|
>
|
|
<template slot-scope="scope">
|
|
<el-tag type="warning" v-if="scope.row.status === 1">进行中</el-tag>
|
|
<el-tag type="success" v-if="scope.row.status === 2">生成成功</el-tag>
|
|
<el-tag type="danger" v-if="scope.row.status === 3">生成失败</el-tag>
|
|
<el-tag type="info" v-if="scope.row.status === 6">已提交</el-tag>
|
|
</template>
|
|
</el-table-column>
|
|
<el-table-column prop="coin" label="金币" align="center" min-width="120">
|
|
<template slot-scope="scope">
|
|
<span>{{ scope.row.coin }}</span>
|
|
</template>
|
|
</el-table-column>
|
|
<el-table-column
|
|
prop="updateAct"
|
|
label="操作者"
|
|
align="center"
|
|
min-width="120"
|
|
>
|
|
<template slot-scope="scope">
|
|
<span>{{ scope.row.updateAct || "-" }}</span>
|
|
</template>
|
|
</el-table-column>
|
|
<el-table-column
|
|
prop="remark"
|
|
label="备注"
|
|
align="center"
|
|
min-width="120"
|
|
>
|
|
<template slot-scope="scope">
|
|
<span>{{ scope.row.remark || "-" }}</span>
|
|
</template>
|
|
</el-table-column>
|
|
<el-table-column
|
|
prop="updatedAt"
|
|
label="修改时间"
|
|
align="center"
|
|
min-width="160"
|
|
>
|
|
<template slot-scope="scope">
|
|
<span>{{ initTime(scope.row.updatedAt) }}</span>
|
|
</template>
|
|
</el-table-column>
|
|
<el-table-column
|
|
label="操作"
|
|
align="center"
|
|
min-width="280"
|
|
fixed="right"
|
|
>
|
|
<template slot-scope="scope">
|
|
<el-button
|
|
size="mini"
|
|
icon="el-icon-edit"
|
|
@click="auto(scope.row)"
|
|
v-if="scope.row.status == 1"
|
|
>自动处理</el-button
|
|
>
|
|
<el-button
|
|
size="mini"
|
|
type="success"
|
|
icon="el-icon-edit"
|
|
@click="openEdit(scope.row, 'pass')"
|
|
v-if="scope.row.status == 1"
|
|
>通过</el-button
|
|
>
|
|
<el-button
|
|
size="mini"
|
|
type="danger"
|
|
icon="el-icon-edit"
|
|
@click="openEdit(scope.row, 'reject')"
|
|
v-if="scope.row.status == 1"
|
|
>拒绝</el-button
|
|
>
|
|
<el-button
|
|
size="mini"
|
|
type="warning"
|
|
icon="el-icon-refresh"
|
|
v-if="scope.row.status == 2 || scope.row.status == 6"
|
|
@click="openReset(scope.row)"
|
|
>状态重置</el-button
|
|
>
|
|
</template>
|
|
</el-table-column>
|
|
</el-table>
|
|
<div style="margin: 10px 0" v-if="isBatch">
|
|
<el-button @click="giveUpBatch" type="danger" size="mini"
|
|
>取消批量操作</el-button
|
|
>
|
|
<el-button @click="openBatchAutoHandle" type="success" size="mini"
|
|
>批量自动处理</el-button
|
|
>
|
|
<el-button @click="openBatchReject" type="primary" size="mini"
|
|
>批量拒绝</el-button
|
|
>
|
|
</div>
|
|
<!--封面图、视频弹窗组件-->
|
|
<preview-video ref="previewVideo"></preview-video>
|
|
<!--分页组件-->
|
|
<el-pagination
|
|
:page-sizes="[10, 30, 50, 100]"
|
|
:current-page="params.pageNumber"
|
|
:page-size="params.pageSize"
|
|
layout="total, sizes, prev, pager, next, jumper"
|
|
:total="total"
|
|
background
|
|
@size-change="changeSize"
|
|
@current-change="changeCurrent"
|
|
></el-pagination>
|
|
<!-- 打开窗口 -->
|
|
<el-dialog
|
|
title="编辑"
|
|
:visible.sync="editVisible"
|
|
width="500px"
|
|
@before-close="handleClose()"
|
|
@close="handleClose()"
|
|
>
|
|
<el-form>
|
|
<div class="form_item">
|
|
<el-form-item label="AI图:" prop="newPic" v-if="optType == 'pass'">
|
|
<base-upload
|
|
:cover="form.newPic"
|
|
:action="action"
|
|
@successCallback="successCallback"
|
|
:hide="true"
|
|
></base-upload>
|
|
</el-form-item>
|
|
<el-form-item label="拒绝原因" prop="remark" v-else>
|
|
<el-input
|
|
type="textarea"
|
|
:autosize="{ minRows: 4, maxRows: 8 }"
|
|
class="inp"
|
|
v-model="form.remark"
|
|
></el-input>
|
|
</el-form-item>
|
|
<el-form-item label="原始图:" prop="background">
|
|
<img-load
|
|
:width="'148px'"
|
|
:height="'148px'"
|
|
:src="imgUrl + originPic"
|
|
></img-load>
|
|
</el-form-item>
|
|
</div>
|
|
</el-form>
|
|
<div slot="footer" class="dialog-footer">
|
|
<el-button @click="handleClose()">取 消</el-button>
|
|
<el-button type="primary" @click="onSubmit()">确 定</el-button>
|
|
</div>
|
|
</el-dialog>
|
|
<!-- 图集预览窗口 -->
|
|
<preview-picture ref="previewPicture"></preview-picture>
|
|
<!-- 打开窗口 -->
|
|
<el-dialog
|
|
title="拒绝原因"
|
|
:visible.sync="rejectVisible"
|
|
width="500px"
|
|
@before-close="handleClose()"
|
|
@close="handleClose()"
|
|
>
|
|
<el-form>
|
|
<div class="form_item">
|
|
<el-form-item label="拒绝原因" prop="remark">
|
|
<el-input
|
|
type="textarea"
|
|
:autosize="{ minRows: 4, maxRows: 8 }"
|
|
class="inp"
|
|
v-model="rejectForm.remark"
|
|
></el-input>
|
|
</el-form-item>
|
|
</div>
|
|
</el-form>
|
|
<div slot="footer" class="dialog-footer">
|
|
<el-button @click="handleClose()">取 消</el-button>
|
|
<el-button type="primary" @click="onRejectSubmit()">确 定</el-button>
|
|
</div>
|
|
</el-dialog>
|
|
</div>
|
|
</template>
|
|
|
|
<script>
|
|
import API from "@/api";
|
|
import { uniteDate } from "@/utils/validator.js";
|
|
import baseConfig from "@/utils/serverUrlConfig";
|
|
import PreviewVideo from "./../../videoManagement/videoExamine/components/preview-video";
|
|
import PreviewPicture from "./components/previewPicture";
|
|
|
|
export default {
|
|
components: {
|
|
PreviewVideo,
|
|
PreviewPicture,
|
|
},
|
|
data() {
|
|
return {
|
|
// 表格数据加载动画
|
|
loading: false,
|
|
imgUrl: baseConfig.imgUrl,
|
|
statuses: [
|
|
{ label: "进行中", value: 1 },
|
|
{ label: "生成成功", value: 2 },
|
|
{ label: "生成失败", value: 3 },
|
|
{ label: "已提交", value: 6 },
|
|
],
|
|
// 列表数据
|
|
tableData: [],
|
|
total: 0,
|
|
params: {
|
|
pageNumber: 1,
|
|
pageSize: 10,
|
|
status: undefined,
|
|
uid: undefined,
|
|
},
|
|
editVisible: false,
|
|
form: {
|
|
id: "",
|
|
newPic: undefined,
|
|
status: undefined,
|
|
remark: undefined,
|
|
},
|
|
rejectVisible: false,
|
|
rejectForm: {
|
|
remark: undefined,
|
|
},
|
|
originPic: undefined,
|
|
optType: "",
|
|
// 用户头像上传地址
|
|
action: baseConfig.baseServerUrl + "/vid/uploadStatic",
|
|
isBatch: false,
|
|
dataIds: [],
|
|
batchUpdateDialog: false,
|
|
batchStatus: 0,
|
|
};
|
|
},
|
|
created() {
|
|
this.getList();
|
|
},
|
|
methods: {
|
|
// 请求列表
|
|
getList(type) {
|
|
this.loading = false;
|
|
if (type === "status") {
|
|
this.params.pageNumber = 1;
|
|
}
|
|
API.getAiTransList(this.params)
|
|
.then((res) => {
|
|
if (res.code === 200 && res.data) {
|
|
this.tableData = res.data.list;
|
|
this.total = res.data.count;
|
|
} else {
|
|
this.tableData = [];
|
|
}
|
|
if (this.isBatch) {
|
|
this.restoreCheckedState();
|
|
}
|
|
this.loading = false;
|
|
})
|
|
.catch(() => {
|
|
this.loading = false;
|
|
});
|
|
},
|
|
// 图集预览
|
|
previewPicture(pictureArr) {
|
|
let Arr = JSON.parse(JSON.stringify(pictureArr));
|
|
this.$refs.previewPicture.open(Arr);
|
|
},
|
|
// 上传成功回掉
|
|
successCallback(res) {
|
|
this.form.newPic = [res.data.coverImg];
|
|
},
|
|
// 打开编辑
|
|
openEdit(param, type) {
|
|
this.optType = type;
|
|
this.form.id = param.id;
|
|
this.originPic = param.originPics && param.originPics[0];
|
|
if (type == "pass") {
|
|
this.form.status = 2;
|
|
} else {
|
|
this.form.status = 3;
|
|
}
|
|
this.editVisible = true;
|
|
},
|
|
// 自动处理
|
|
auto(param) {
|
|
API.aiTransAuto({ id: param.id }).then((res) => {
|
|
if (res.code === 200) {
|
|
this.$message({
|
|
type: "success",
|
|
message: "操作成功",
|
|
});
|
|
} else {
|
|
this.$message({
|
|
type: "error",
|
|
message: res.tip || "操作失败",
|
|
});
|
|
}
|
|
this.getList();
|
|
});
|
|
},
|
|
onSubmit() {
|
|
if (!this.form.newPic && this.optType == "pass")
|
|
return this.$message.warning("请上传AI图片");
|
|
if (!this.form.remark && this.optType == "reject")
|
|
return this.$message.warning("请填写拒绝原因");
|
|
API.aiTransExamine(this.form).then((res) => {
|
|
if (res.code === 200) {
|
|
this.$message({
|
|
type: "success",
|
|
message: this.optType == "pass" ? "通过成功" : "拒绝成功!",
|
|
});
|
|
} else {
|
|
this.$message({
|
|
type: "error",
|
|
message:
|
|
res.tip || this.optType == "pass" ? "通过失败" : "拒绝失败",
|
|
});
|
|
}
|
|
this.handleClose();
|
|
this.getList();
|
|
});
|
|
},
|
|
openReset(row) {
|
|
this.$confirm("确认重置该订单吗", "提示", {
|
|
confirmButtonText: "确定",
|
|
cancelButtonText: "取消",
|
|
type: "warning",
|
|
center: true,
|
|
})
|
|
.then(() => {
|
|
let req = {
|
|
id: row.id,
|
|
status: 1,
|
|
};
|
|
API.aiTransExamine(req).then((res) => {
|
|
if (res.code == 200) {
|
|
this.getList();
|
|
this.$message({
|
|
type: "success",
|
|
message: "重置成功!",
|
|
});
|
|
} else {
|
|
this.$message({
|
|
type: "error",
|
|
message: res.msg || "重置失败!",
|
|
});
|
|
}
|
|
});
|
|
})
|
|
.catch(() => {
|
|
this.$message({
|
|
type: "info",
|
|
message: "已取消重置",
|
|
});
|
|
});
|
|
},
|
|
handleClose() {
|
|
this.editVisible = false;
|
|
this.form.id = "";
|
|
this.form.newPic = undefined;
|
|
this.form.status = undefined;
|
|
this.form.remark = undefined;
|
|
this.originPic = undefined;
|
|
this.rejectVisible = false;
|
|
this.rejectForm.remark = undefined;
|
|
},
|
|
// 分页条数改变回调
|
|
changeSize(size) {
|
|
this.params.pageSize = size;
|
|
this.getList();
|
|
},
|
|
// 分页页码改变回调
|
|
changeCurrent(pageNumber) {
|
|
this.params.pageNumber = pageNumber;
|
|
this.getList();
|
|
},
|
|
// 更换时间格式
|
|
initTime(time) {
|
|
return uniteDate(time);
|
|
},
|
|
returnUrl(row) {
|
|
if (row.originPics) {
|
|
return this.imgUrl + row.originPics[0];
|
|
} else {
|
|
return this.imgUrl + row.originPic;
|
|
}
|
|
},
|
|
// *******************批量操作*********************
|
|
// 翻页时的勾选回显
|
|
restoreCheckedState() {
|
|
/**
|
|
* ①获取到当前数据表格中已经被选中的数据
|
|
*/
|
|
const indexs = this.tableData
|
|
.map((item) => {
|
|
let flag = false;
|
|
this.dataIds.forEach((value) => {
|
|
value.id === item.id ? (flag = true) : "";
|
|
});
|
|
if (flag) {
|
|
return item;
|
|
}
|
|
})
|
|
.filter((item) => item);
|
|
/**
|
|
* ②回显当前数据表格中已经被勾选过的数据
|
|
*/
|
|
this.$nextTick(() => {
|
|
indexs.forEach((rows) => {
|
|
this.$refs.multipleTable.toggleRowSelection(rows);
|
|
});
|
|
});
|
|
},
|
|
// 批量操作窗口
|
|
openBatch() {
|
|
this.isBatch = true;
|
|
this.params.status = 1;
|
|
this.getList();
|
|
},
|
|
// 取消批量操作
|
|
giveUpBatch() {
|
|
this.isBatch = false;
|
|
this.dataIds = [];
|
|
this.$refs.multipleTable.clearSelection();
|
|
this.params.status = undefined;
|
|
this.getList();
|
|
},
|
|
// 打开批量处理窗口
|
|
openBatchAutoHandle() {
|
|
if (this.dataIds.length === 0)
|
|
return this.$message.error("请至少选择一条数据");
|
|
const ids = this.dataIds.map((item) => item.id);
|
|
// 确认处理提示
|
|
this.$confirm("确定自动处理这些数据吗?", "提示", {
|
|
confirmButtonText: "确定",
|
|
cancelButtonText: "取消",
|
|
type: "warning",
|
|
})
|
|
.then(() => {
|
|
const req = {
|
|
ids: ids,
|
|
pass: true,
|
|
};
|
|
API.aiTransBatchAuto(req).then((res) => {
|
|
if (res.code === 200) {
|
|
this.getList();
|
|
this.handleClose();
|
|
this.giveUpBatch();
|
|
this.$message.success("批量自动处理成功");
|
|
} else {
|
|
this.$message.error(res.msg);
|
|
}
|
|
});
|
|
})
|
|
.catch(() => {
|
|
this.$message.success("取消成功");
|
|
});
|
|
},
|
|
// 打开批量拒绝窗口
|
|
openBatchReject() {
|
|
if (this.dataIds.length === 0)
|
|
return this.$message.error("请至少选择一条数据");
|
|
this.rejectVisible = true;
|
|
},
|
|
onRejectSubmit() {
|
|
const ids = this.dataIds.map((item) => item.id);
|
|
const req = {
|
|
ids: ids,
|
|
pass: false,
|
|
remark: this.rejectForm.remark,
|
|
};
|
|
API.aiTransBatchAuto(req).then((res) => {
|
|
if (res.code === 200) {
|
|
this.getList();
|
|
this.handleClose();
|
|
this.giveUpBatch();
|
|
this.$message.success("批量拒绝成功");
|
|
} else {
|
|
this.$message.error(res.msg);
|
|
}
|
|
});
|
|
},
|
|
// 处理勾选时的数据
|
|
handleSelectionChange(objArr) {
|
|
/**
|
|
* 1.取消勾选时,将添加的数据从this.dataIds这个数据表里去除;
|
|
* ① 获取到当前数据列表中未勾选的数据;
|
|
* ② 从this.dataIds这个数据表中移除未勾选的数据;
|
|
*/
|
|
// ①获取到当前数据列表中未勾选的数据;
|
|
const tempTableData = JSON.parse(JSON.stringify(this.tableData));
|
|
objArr.forEach((item) => {
|
|
this.tableData.forEach((value, index) => {
|
|
if (item === value) {
|
|
tempTableData.splice(index, 1);
|
|
}
|
|
});
|
|
});
|
|
// ②从this.dataIds这个数据表中移除未勾选的数据;
|
|
tempTableData.forEach((item) => {
|
|
this.dataIds.forEach((value, index) => {
|
|
if (item.id === value.id) {
|
|
this.dataIds.splice(index, 1);
|
|
}
|
|
});
|
|
});
|
|
// 2.添加数组数据,需要去重
|
|
this.dataIds = this.dataIds.concat(objArr);
|
|
const tempDatas = new Set(this.dataIds);
|
|
this.dataIds = Array.from(tempDatas);
|
|
},
|
|
},
|
|
};
|
|
</script>
|
|
|
|
<style lang="scss" scoped>
|
|
.dialog-footer {
|
|
position: relative;
|
|
left: 50%;
|
|
-webkit-transform: translate(-50%);
|
|
transform: translate(-50%);
|
|
}
|
|
.form_item {
|
|
display: flex;
|
|
}
|
|
.clickNumDialog {
|
|
/deep/ .el-dialog__body {
|
|
padding-top: 10px;
|
|
}
|
|
/deep/ .el-pagination {
|
|
float: none;
|
|
text-align: right;
|
|
margin-top: 30px;
|
|
}
|
|
}
|
|
/deep/ .el-input {
|
|
width: 80%;
|
|
}
|
|
/deep/ .el-form-item {
|
|
width: 100%;
|
|
}
|
|
</style>
|