This commit is contained in:
张良(004796)
2024-03-12 17:37:13 +08:00
parent 3b26224ef5
commit 4ff37871f8
7 changed files with 374 additions and 332 deletions

View File

@@ -26,11 +26,19 @@ export function addUserPictures(data) {
})
}
// 修改用户相册管理
export function updateUserPictures(data) {
export function userPicturesAuditSuccess(data) {
return request({
url: '/xq/userPictures',
method: 'put',
url: '/xq/userPictures/audit/success',
method: 'post',
data: data
})
}
export function userPicturesAuditFail(data) {
return request({
url: '/xq/userPictures/audit/fail',
method: 'post',
data: data
})
}

View File

@@ -95,14 +95,17 @@ export default {
async handler(val) {
if (val) {
// 首先将值转为数组
let list;
let list = [];
if (Array.isArray(val)) {
list = val;
} else {
list = [{
url: process.env.VUE_APP_COS_BASE_URL + val,
ossId: val,
path: val }];
let valSplit = val.split(",")
valSplit.forEach(i => {
list.push({
url: i,
ossId: i,
path: i })
})
}
// 然后将数组转为对象数组
this.fileList = list.map(item => {
@@ -110,7 +113,7 @@ export default {
item = { name: item.ossId, url: item.url, ossId: item.ossId, path: item.path };
return item;
});
console.log(this.fileList)
console.log("watch",this.fileList)
} else {
this.fileList = [];
return [];
@@ -210,12 +213,10 @@ export default {
let strs = "";
separator = separator || ",";
for (let i in list) {
if (list[i].path) {
strs += list[i].path + separator;
if (list[i].url) {
strs += list[i].url + separator;
}
}
console.log("list",list)
console.log(strs);
return strs != "" ? strs.substr(0, strs.length - 1) : "";
}
}

View File

@@ -95,13 +95,6 @@ export const onlineStatusList = [
{ value: 1, label: '在线',listClass: listClass.danger},
]
export const auditStatusList = [
{ value: 0, label: '待提交',listClass: listClass.info},
{ value: 1, label: '审核中',listClass: listClass.warning},
{ value: 2, label: '审核通过',listClass: listClass.primary},
{ value: 3, label: '审核不通过',listClass: listClass.danger},
]
/**
* 开启视频接听
*/
@@ -528,3 +521,10 @@ export const booleanList = [
{ value: true, label: '是',listClass: listClass.danger},
{ value: false, label: '否',listClass: listClass.info},
]
export const auditStatusList = [
{ value: 0, label: '待提交',listClass: listClass.info},
{ value: 1, label: '审核中',listClass: listClass.warning},
{ value: 2, label: '审核通过',listClass: listClass.primary},
{ value: 3, label: '审核不通过',listClass: listClass.danger},
]

View File

@@ -0,0 +1,106 @@
<template>
<el-dialog title="新增客户图片" :close-on-click-modal="false" :visible.sync="open" width="700px" append-to-body>
<el-form ref="form" :model="form" :rules="rules" label-width="100px">
<el-form-item :label="'用户编号'" prop="usercode">
<el-autocomplete
class="inline-input"
v-model="form.usercode"
:fetch-suggestions="querySearch"
placeholder="请输入内容"
@select="handleSelect"
></el-autocomplete>
</el-form-item>
<el-form-item label="手机号" v-if="info.mobile">
{{ info.mobile }}
</el-form-item>
<el-form-item label="昵称" v-if="info.nickname">
{{ info.nickname }} {{ info.usercode }}
</el-form-item>
<el-form-item label="头像" v-if="info.avatar">
<image-avatar :src="info.avatar"/>
</el-form-item>
<el-form-item label="图片" prop="picture">
<image-upload2 v-model="form.picture" :limit="3" />
</el-form-item>
</el-form>
<div slot="footer" class="dialog-footer">
<el-button :loading="buttonLoading" type="primary" @click="submitForm"> </el-button>
<el-button @click="open = false"> </el-button>
</div>
</el-dialog>
</template>
<script>
import { getUserByUsercode, listUserByUserCode } from '@/api/xq/user'
import { vipTypeList } from '@/constant/statusMap'
import { addUserPictures } from '@/api/xq/userPictures'
export default {
components: {
},
data () {
return {
vipTypeList,
open: false,
title: '',
form:{
usercode: undefined,
picture: undefined,
},
info:{
},
// 表单校验
rules: {
usercode: [
{ required: true, message: "数据不能为空", trigger: "blur" }
],
picture: [
{ required: true, message: "数据不能为空", trigger: "blur" }
],
},
buttonLoading: false,
}
},
created() {
},
methods: {
init () {
this.open = true;
this.info = {};
this.form.usercode = undefined
this.form.picture = undefined
},
querySearch(querySearch,cb){
listUserByUserCode(querySearch).then(res => {
cb(res.data.map((terminal) => {
return {
value: terminal,
name: terminal,
};
}))
})
},
handleSelect(item){
getUserByUsercode(item.value).then(res => {
this.info = res.data
})
},
// 表单提交
submitForm () {
this.$refs['form'].validate((valid) => {
if (valid) {
this.buttonLoading = true;
addUserPictures(this.form).then(data => {
this.$modal.msgSuccess("新增图片成功");
this.buttonLoading = false;
this.open = false
this.$emit('refreshDataList')
}).finally(() => {
this.buttonLoading = false;
});
}
})
},
}
}
</script>

View File

@@ -0,0 +1,74 @@
<template>
<el-dialog title="审核用户上传图片" :close-on-click-modal="false" :visible.sync="open" width="700px" append-to-body>
<el-form ref="form" :model="form" :rules="rules" label-width="100px">
<el-form-item label="审核状态" prop="auditStatus">
<el-select v-model="form.auditStatus" size="small">
<el-option key="2" label="审核通过" :value="2" />
<el-option key="3" label="审核失败" :value="3" />
</el-select>
</el-form-item>
<el-form-item label="原因" prop="auditRemark" v-if="form.auditStatus === 3">
<el-input v-model="form.auditRemark" placeholder="请输入原因" type="textarea" :rows="2"/>
</el-form-item>
</el-form>
<div slot="footer" class="dialog-footer">
<el-button :loading="buttonLoading" type="primary" @click="submitForm"> </el-button>
<el-button @click="open = false"> </el-button>
</div>
</el-dialog>
</template>
<script>
import { addUserPictures } from '@/api/xq/userPictures'
export default {
components: {
},
data () {
return {
open: false,
form:{
id: undefined,
auditStatus: undefined,
auditRemark: undefined,
},
// 表单校验
rules: {
auditStatus: [
{ required: true, message: "数据不能为空", trigger: "blur" }
],
auditRemark: [
{ required: true, message: "数据不能为空", trigger: "blur" }
],
},
buttonLoading: false,
}
},
created() {
},
methods: {
init (id) {
this.open = true;
this.form.id = id
this.form.auditStatus = undefined
this.form.auditRemark = undefined
},
// 表单提交
submitForm () {
this.$refs['form'].validate((valid) => {
if (valid) {
this.buttonLoading = true;
addUserPictures(this.form).then(data => {
this.$modal.msgSuccess("新增图片成功");
this.buttonLoading = false;
this.open = false
this.$emit('refreshDataList')
}).finally(() => {
this.buttonLoading = false;
});
}
})
},
}
}
</script>

View File

@@ -1,70 +1,30 @@
<template>
<div class="app-container">
<el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="68px">
<el-form-item label="用户ID" prop="userId">
<el-input
v-model="queryParams.userId"
placeholder="请输入用户ID"
clearable
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item label="用户号" prop="usercode">
<el-form-item label="用户编号" prop="usercode">
<el-input
v-model="queryParams.usercode"
placeholder="请输入用户号"
placeholder="请输入用户号"
clearable
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item label="相册" prop="picture">
<el-form-item label="昵称" prop="nickname">
<el-input
v-model="queryParams.picture"
placeholder="请输入相册"
v-model="queryParams.nickname"
placeholder="请输入昵称"
clearable
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item label="审核备注" prop="auditRemark">
<el-form-item label="手机号" prop="mobile">
<el-input
v-model="queryParams.auditRemark"
placeholder="请输入审核备注"
v-model="queryParams.mobile"
placeholder="请输入手机号"
clearable
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item label="审核时间" prop="auditTime">
<el-date-picker clearable
v-model="queryParams.auditTime"
type="date"
value-format="yyyy-MM-dd"
placeholder="请选择审核时间">
</el-date-picker>
</el-form-item>
<el-form-item label="审核人ID" prop="auditOpId">
<el-input
v-model="queryParams.auditOpId"
placeholder="请输入审核人ID"
clearable
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item label="审核人名称" prop="auditOpName">
<el-input
v-model="queryParams.auditOpName"
placeholder="请输入审核人名称"
clearable
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item label="审核人IP" prop="auditIp">
<el-date-picker clearable
v-model="queryParams.auditIp"
type="date"
value-format="yyyy-MM-dd"
placeholder="请选择审核人IP">
</el-date-picker>
</el-form-item>
<el-form-item>
<el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
<el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
@@ -80,18 +40,8 @@
size="mini"
@click="handleAdd"
v-hasPermi="['xq:userPictures:add']"
>新增</el-button>
</el-col>
<el-col :span="1.5">
<el-button
type="success"
plain
icon="el-icon-edit"
size="mini"
:disabled="single"
@click="handleUpdate"
v-hasPermi="['xq:userPictures:edit']"
>修改</el-button>
>新增
</el-button>
</el-col>
<el-col :span="1.5">
<el-button
@@ -102,57 +52,73 @@
:disabled="multiple"
@click="handleDelete"
v-hasPermi="['xq:userPictures:remove']"
>删除</el-button>
>删除
</el-button>
</el-col>
<el-col :span="1.5">
<el-button
type="warning"
type="success"
plain
icon="el-icon-download"
icon="el-icon-edit"
size="mini"
@click="handleExport"
v-hasPermi="['xq:userPictures:export']"
>导出</el-button>
:disabled="multiple"
@click="handleAuditSuccess"
v-hasPermi="['xq:userPictures:edit']"
>批量审核通过
</el-button>
</el-col>
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
</el-row>
<el-table v-loading="loading" :data="userPicturesList" @selection-change="handleSelectionChange">
<el-table-column type="selection" width="55" align="center"/>
<el-table-column label="" align="center" prop="id" v-if="true"/>
<el-table-column label="用户ID" align="center" prop="userId" />
<el-table-column label="用户号" align="center" prop="usercode" />
<el-table-column label="相册" align="center" prop="picture" />
<el-table-column label="1-待审核 2-审核成功 3-审核失败" align="center" prop="auditStatus" />
<el-table-column label="用户编号" align="center" prop="usercode"/>
<el-table-column label="昵称" align="center" prop="nickname" show-overflow-tooltip/>
<el-table-column label="手机号" align="center" prop="mobile" width="100"/>
<el-table-column label="头像" align="center" prop="avatar">
<template v-slot="scope">
<image-avatar :src="scope.row.avatar"/>
</template>
</el-table-column>
<el-table-column label="相册" align="center" prop="picture">
<template v-slot="scope">
<image-preview :src="scope.row.picture"/>
</template>
</el-table-column>
<el-table-column label="状态" align="center" prop="auditStatus">
<template v-slot="scope">
<cai-dict-tag :options="auditStatusList" :value="scope.row.auditStatus"/>
</template>
</el-table-column>
<el-table-column label="审核备注" align="center" prop="auditRemark"/>
<el-table-column label="审核时间" align="center" prop="auditTime" width="180">
<template slot-scope="scope">
<span>{{ parseTime(scope.row.auditTime, '{y}-{m}-{d}') }}</span>
</template>
</el-table-column>
<el-table-column label="审核人ID" align="center" prop="auditOpId" />
<el-table-column label="审核人名称" align="center" prop="auditOpName" />
<el-table-column label="审核人IP" align="center" prop="auditIp" width="180">
<template slot-scope="scope">
<span>{{ parseTime(scope.row.auditIp, '{y}-{m}-{d}') }}</span>
</template>
</el-table-column>
<el-table-column label="操作" align="center" class-name="small-padding fixed-width">
<template slot-scope="scope">
<el-table-column label="审核时间" align="center" prop="auditTime" width="180"/>
<el-table-column label="审核人" align="center" prop="auditOpName"/>
<el-table-column label="操作" align="center" class-name="small-padding fixed-width" width="160">
<template v-slot="scope">
<el-button
size="mini"
type="text"
icon="el-icon-edit"
@click="handleUpdate(scope.row)"
@click="handleAuditSuccess(scope.row)"
v-if="scope.row.auditStatus === 1"
v-hasPermi="['xq:userPictures:edit']"
>修改</el-button>
>通过
</el-button>
<el-button
size="mini"
type="text"
v-if="scope.row.auditStatus === 1"
@click="handleAuditFail(scope.row)"
v-hasPermi="['xq:userPictures:edit']"
>不通过
</el-button>
<el-button
size="mini"
type="text"
icon="el-icon-delete"
@click="handleDelete(scope.row)"
v-hasPermi="['xq:userPictures:remove']"
>删除</el-button>
>删除
</el-button>
</template>
</el-table-column>
</el-table>
@@ -164,62 +130,27 @@
:limit.sync="queryParams.pageSize"
@pagination="getList"
/>
<!-- 添加或修改用户相册管理对话框 -->
<el-dialog :title="title" :visible.sync="open" width="500px" append-to-body>
<el-form ref="form" :model="form" :rules="rules" label-width="80px">
<el-form-item label="用户ID" prop="userId">
<el-input v-model="form.userId" placeholder="请输入用户ID" />
</el-form-item>
<el-form-item label="用户号" prop="usercode">
<el-input v-model="form.usercode" placeholder="请输入用户号" />
</el-form-item>
<el-form-item label="相册" prop="picture">
<el-input v-model="form.picture" placeholder="请输入相册" />
</el-form-item>
<el-form-item label="审核备注" prop="auditRemark">
<el-input v-model="form.auditRemark" placeholder="请输入审核备注" />
</el-form-item>
<el-form-item label="审核时间" prop="auditTime">
<el-date-picker clearable
v-model="form.auditTime"
type="datetime"
value-format="yyyy-MM-dd HH:mm:ss"
placeholder="请选择审核时间">
</el-date-picker>
</el-form-item>
<el-form-item label="审核人ID" prop="auditOpId">
<el-input v-model="form.auditOpId" placeholder="请输入审核人ID" />
</el-form-item>
<el-form-item label="审核人名称" prop="auditOpName">
<el-input v-model="form.auditOpName" placeholder="请输入审核人名称" />
</el-form-item>
<el-form-item label="审核人IP" prop="auditIp">
<el-date-picker clearable
v-model="form.auditIp"
type="datetime"
value-format="yyyy-MM-dd HH:mm:ss"
placeholder="请选择审核人IP">
</el-date-picker>
</el-form-item>
</el-form>
<div slot="footer" class="dialog-footer">
<el-button :loading="buttonLoading" type="primary" @click="submitForm"> </el-button>
<el-button @click="cancel"> </el-button>
</div>
</el-dialog>
<add-user-picture-dialog v-if="addUserPictureDialogVisible" ref="addUserPictureDialog" @refreshDataList="getList"/>
</div>
</template>
<script>
import { listUserPictures, getUserPictures, delUserPictures, addUserPictures, updateUserPictures } from "@/api/xq/userPictures";
import {
delUserPictures,
listUserPictures,
userPicturesAuditFail,
userPicturesAuditSuccess
} from '@/api/xq/userPictures'
import { auditStatusList } from '@/constant/statusMap'
import AddUserPictureDialog from '@/views/xq/userPictures/add-user-picture-dialog.vue'
export default {
name: "UserPictures",
name: 'UserPictures',
components: { AddUserPictureDialog },
data() {
return {
// 按钮loading
buttonLoading: false,
auditStatusList,
addUserPictureDialogVisible : false,
// 遮罩层
loading: true,
// 选中数组
@@ -234,109 +165,39 @@ export default {
total: 0,
// 用户相册管理表格数据
userPicturesList: [],
// 弹出层标题
title: "",
// 是否显示弹出层
open: false,
// 查询参数
queryParams: {
pageNum: 1,
pageSize: 10,
userId: undefined,
usercode: undefined,
picture: undefined,
nickname: undefined,
auditStatus: undefined,
auditRemark: undefined,
auditTime: undefined,
auditOpId: undefined,
auditOpName: undefined,
auditIp: undefined,
},
// 表单参数
form: {},
// 表单校验
rules: {
id: [
{ required: true, message: "不能为空", trigger: "blur" }
],
userId: [
{ required: true, message: "用户ID不能为空", trigger: "blur" }
],
usercode: [
{ required: true, message: "用户号不能为空", trigger: "blur" }
],
picture: [
{ required: true, message: "相册不能为空", trigger: "blur" }
],
auditStatus: [
{ required: true, message: "1-待审核 2-审核成功 3-审核失败不能为空", trigger: "change" }
],
auditRemark: [
{ required: true, message: "审核备注不能为空", trigger: "blur" }
],
auditTime: [
{ required: true, message: "审核时间不能为空", trigger: "blur" }
],
auditOpId: [
{ required: true, message: "审核人ID不能为空", trigger: "blur" }
],
auditOpName: [
{ required: true, message: "审核人名称不能为空", trigger: "blur" }
],
auditIp: [
{ required: true, message: "审核人IP不能为空", trigger: "blur" }
],
createTime: [
{ required: true, message: "创建时间不能为空", trigger: "blur" }
],
mobile: undefined
}
}
};
},
created() {
this.getList();
this.getList()
},
methods: {
/** 查询用户相册管理列表 */
getList() {
this.loading = true;
this.loading = true
listUserPictures(this.queryParams).then(response => {
this.userPicturesList = response.rows;
this.total = response.total;
this.loading = false;
});
},
// 取消按钮
cancel() {
this.open = false;
this.reset();
},
// 表单重置
reset() {
this.form = {
id: undefined,
userId: undefined,
usercode: undefined,
picture: undefined,
auditStatus: undefined,
auditRemark: undefined,
auditTime: undefined,
auditOpId: undefined,
auditOpName: undefined,
auditIp: undefined,
createTime: undefined,
updateTime: undefined
};
this.resetForm("form");
this.userPicturesList = response.rows
this.total = response.total
this.loading = false
})
},
/** 搜索按钮操作 */
handleQuery() {
this.queryParams.pageNum = 1;
this.getList();
this.queryParams.pageNum = 1
this.getList()
},
/** 重置按钮操作 */
resetQuery() {
this.resetForm("queryForm");
this.handleQuery();
this.resetForm('queryForm')
this.handleQuery()
},
// 多选框选中数据
handleSelectionChange(selection) {
@@ -345,69 +206,64 @@ export default {
this.multiple = !selection.length
},
/** 新增按钮操作 */
handleAdd() {
this.reset();
this.open = true;
this.title = "添加用户相册管理";
handleAdd(row) {
this.addUserPictureDialogVisible = true
this.$nextTick(() => {
this.$refs.addUserPictureDialog.init(row?.usercode)
})
},
/** 修改按钮操作 */
handleUpdate(row) {
this.loading = true;
this.reset();
const id = row.id || this.ids
getUserPictures(id).then(response => {
this.loading = false;
this.form = response.data;
this.open = true;
this.title = "修改用户相册管理";
});
handleAuditSuccess(row){
const ids = row.id || this.ids
this.$modal.confirm('是否确认审核通过用户相册管理编号为"' + ids + '"的数据项?').then(() => {
this.loading = true
let idArray = ids.join(',')
return userPicturesAuditSuccess({ 'ids': idArray })
}).then(() => {
this.loading = false
this.getList()
this.$modal.msgSuccess('操作成功')
}).catch(() => {
}).finally(() => {
this.loading = false
})
},
/** 提交按钮 */
submitForm() {
this.$refs["form"].validate(valid => {
if (valid) {
this.buttonLoading = true;
if (this.form.id != null) {
updateUserPictures(this.form).then(response => {
this.$modal.msgSuccess("修改成功");
this.open = false;
this.getList();
handleAuditFail(row){
this.$prompt('请输入失败原因', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
inputPattern: /^.+$/,
inputErrorMessage: '失败原因必填',
inputType: 'textarea'
}).then(({ value }) => {
this.loading = true
return userPicturesAuditFail({
'auditRemark': value,
'id': row.id
})
}).then(() => {
this.loading = false
this.getList()
this.$modal.msgSuccess('审核成功')
}).catch(() => {
}).finally(() => {
this.buttonLoading = false;
});
} else {
addUserPictures(this.form).then(response => {
this.$modal.msgSuccess("新增成功");
this.open = false;
this.getList();
}).finally(() => {
this.buttonLoading = false;
});
}
}
});
this.loading = false
})
},
/** 删除按钮操作 */
handleDelete(row) {
const ids = row.id || this.ids;
const ids = row.id || this.ids
this.$modal.confirm('是否确认删除用户相册管理编号为"' + ids + '"的数据项?').then(() => {
this.loading = true;
return delUserPictures(ids);
this.loading = true
return delUserPictures(ids)
}).then(() => {
this.loading = false;
this.getList();
this.$modal.msgSuccess("删除成功");
this.loading = false
this.getList()
this.$modal.msgSuccess('删除成功')
}).catch(() => {
}).finally(() => {
this.loading = false;
});
},
/** 导出按钮操作 */
handleExport() {
this.download('xq/userPictures/export', {
...this.queryParams
}, `userPictures_${new Date().getTime()}.xlsx`)
this.loading = false
})
}
}
}
};
</script>

View File

@@ -32,9 +32,6 @@
<el-form-item label="头像" v-if="info.avatar">
<image-avatar :src="info.avatar"/>
</el-form-item>
<el-form-item>
注意若用户已是会员再次设置时将会使用最新的会员信息
</el-form-item>
</el-form>
<div slot="footer" class="dialog-footer">
<el-button :loading="buttonLoading" type="primary" @click="submitForm"> </el-button>