You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

435 lines
15 KiB

<template>
<div class="app-container">
<el-form :model="queryParams" ref="queryForm" :inline="true" v-show="showSearch" label-width="68px">
<!-- <el-form-item label="申请用户id" prop="userId">-->
<!-- <el-input-->
<!-- v-model="queryParams.userId"-->
<!-- placeholder="请输入申请用户id"-->
<!-- clearable-->
<!-- size="small"-->
<!-- @keyup.enter.native="handleQuery"-->
<!-- maxLength = '20'-->
<!-- oninput="value=value.replace(/[^\d]/g,'')"-->
<!-- />-->
<!-- </el-form-item>-->
<el-form-item label="申请状态" prop="state">
<!-- <el-input v-model="form.state" placeholder="请输入申请状态 " />-->
<el-select v-model="queryParams.state" clearable placeholder="请选择申请是否通过"
size="small"
@keyup.enter.native="handleQuery"
>
<el-option label="已通过" value="1"></el-option>
<el-option label="已拒绝" value="2"></el-option>
<el-option label="未审核" value="3"></el-option>
</el-select>
</el-form-item>
<!-- <el-form-item label="申请状态 " prop="state">-->
<!-- <el-input-->
<!-- v-model="queryParams.state"-->
<!-- placeholder="请输入申请状态 "-->
<!-- clearable-->
<!-- size="small"-->
<!-- @keyup.enter.native="handleQuery"-->
<!-- />-->
<!-- </el-form-item>-->
<el-form-item label="昵称" prop="nickname">
<el-input
v-model="queryParams.nickname"
placeholder="请输入昵称"
clearable
size="small"
@keyup.enter.native="handleQuery"
maxLength = '20'
/>
</el-form-item>
<el-form-item label="手机号" prop="phone">
<el-input
v-model="queryParams.phone"
placeholder="请输入手机号"
clearable
size="small"
@keyup.enter.native="handleQuery"
maxLength = '11'
oninput="value=value.replace(/[^\d]/g,'')"
/>
</el-form-item>
<el-form-item label="申请时间" prop="createdTime">
<el-date-picker clearable size="small"
v-model="queryParams.createdTime"
type="date"
value-format="yyyy-MM-dd"
placeholder="选择申请时间">
</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>
</el-form-item>
</el-form>
<el-row :gutter="10" class="mb8">
<el-col :span="1.5">
<el-button
type="success"
plain
icon="el-icon-edit"
size="mini"
:disabled="single"
@click="handleUpdate"
v-hasPermi="['wjnft:artapplication:edit']"
>审核</el-button>
</el-col>
<el-col :span="1.5">
<el-button
type="danger"
plain
icon="el-icon-delete"
size="mini"
:disabled="multiple"
@click="handleDelete"
v-hasPermi="['wjnft:artapplication:remove']"
>删除</el-button>
</el-col>
<el-col :span="1.5">
<el-button
type="warning"
plain
icon="el-icon-download"
size="mini"
@click="handleExport"
v-hasPermi="['wjnft:artapplication:export']"
>导出</el-button>
</el-col>
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
</el-row>
<el-table v-loading="loading" :data="artapplicationList" @selection-change="handleSelectionChange">
<el-table-column type="selection" width="55" align="center" />
<!-- <el-table-column label="id" align="center" prop="id" />-->
<el-table-column label="序号" type="index" width="50"> </el-table-column>
<!-- <el-table-column label="申请用户id" align="center" prop="userId" />-->
<!-- <el-table-column label="申请状态 " align="center" prop="state" />-->
<el-table-column label="申请人昵称" align="center" prop="nickname" />
<el-table-column label="申请人姓名" align="center" prop="name" />
<el-table-column label="手机号" align="center" prop="phone" />
<!-- <el-table-column label="微信号" align="center" prop="wechatId" />-->
<el-table-column label="邮箱" align="center" prop="email" />
<!-- <el-table-column label="申请原因" align="center" prop="applyReason" />-->
<el-table-column label="申请日期" align="center" prop="applicationDate" width="180">
<template slot-scope="scope">
<span>{{ parseTime(scope.row.applicationDate, '{y}-{m}-{d}') }}</span>
</template>
</el-table-column>
<!-- <el-table-column label="附件" align="center" prop="attachment" />-->
<el-table-column
prop="state"
align="center"
label="申请状态">
<template slot-scope="scope">
{{ scope.row.state === 1 ? '已通过': '' }}
{{ scope.row.state === 2 ? '已拒绝': '' }}
{{ scope.row.state === 3 ? '未审核': '' }}
</template>
</el-table-column>
<!-- <el-table-column label="创建人" align="center" prop="createdBy" />-->
<!-- <el-table-column label="创建时间" align="center" prop="createdTime" width="180">-->
<!-- <template slot-scope="scope">-->
<!-- <span>{{ parseTime(scope.row.createdTime, '{y}-{m}-{d}') }}</span>-->
<!-- </template>-->
<!-- </el-table-column>-->
<!-- <el-table-column label="审核人" align="center" prop="updatedBy" />-->
<!-- <el-table-column label="更新时间" align="center" prop="updatedTime" width="180">-->
<!-- <template slot-scope="scope">-->
<!-- <span>{{ parseTime(scope.row.updatedTime, '{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-button
size="mini"
type="text"
icon="el-icon-edit"
@click="handleUpdate(scope.row)"
v-if="scope.row.state==3"
>审核</el-button>
<el-button
size="mini"
type="text"
icon="el-icon-delete"
@click="handleDelete(scope.row)"
v-hasPermi="['wjnft:artapplication:remove']"
>删除</el-button>
</template>
</el-table-column>
</el-table>
<pagination
v-show="total>0"
:total="total"
:page.sync="queryParams.pageNum"
: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="申请用户" prop="userId">-->
<!-- <el-input v-model="form.userId" placeholder="请输入申请用户id" disabled/>-->
<!-- </el-form-item>-->
<el-form-item label="审核状态" prop="state">
<!-- <el-input v-model="form.state" placeholder="请输入申请状态 " />-->
<el-select v-model="form.state" clearable placeholder="请选择审核是否通过"
size="small"
@keyup.enter.native="handleQuery"
>
<el-option label="通过" value="1"></el-option>
<el-option label="不通过" value="2"></el-option>
<el-option label="待审核" value="3"></el-option>
</el-select>
</el-form-item>
<el-form-item label="昵称" prop="nickname">
<el-input v-model="form.nickname" placeholder="请输入昵称" disabled/>
</el-form-item>
<el-form-item label="姓名" prop="name">
<el-input v-model="form.name" placeholder="请输入姓名" disabled/>
</el-form-item>
<el-form-item label="手机号" prop="phone">
<el-input v-model="form.phone" placeholder="请输入手机号" disabled/>
</el-form-item>
<!-- <el-form-item label="微信号" prop="wechatId">-->
<!-- <el-input v-model="form.wechatId" placeholder="请输入微信号" disabled/>-->
<!-- </el-form-item>-->
<el-form-item label="邮箱" prop="email">
<el-input v-model="form.email" placeholder="请输入邮箱" disabled/>
</el-form-item>
<!-- <el-form-item label="申请原因" prop="applyReason">-->
<!-- <el-input v-model="form.applyReason" type="textarea" placeholder="请输入内容" disabled/>-->
<!-- </el-form-item>-->
<!-- <el-form-item label="附件" prop="attachment">-->
<!-- <el-input v-model="form.attachment" placeholder="请输入附件" disabled/>-->
<!-- </el-form-item>-->
<!-- <el-form-item label="创建人" prop="createdBy">-->
<!-- <el-input v-model="form.createdBy" placeholder="请输入创建人" disabled/>-->
<!-- </el-form-item>-->
<!-- <el-form-item label="审核人" prop="updatedBy">-->
<!-- <el-input v-model="form.updatedBy" placeholder="请输入审核人" maxLength = '10'/>-->
<!-- </el-form-item>-->
</el-form>
<div slot="footer" class="dialog-footer">
<el-button type="primary" @click="submitForm">确 定</el-button>
<el-button @click="cancel"> </el-button>
</div>
</el-dialog>
</div>
</template>
<script>
import { listArtapplication, getArtapplication, delArtapplication, addArtapplication, updateArtapplication } from "@/api/wjnft/artapplication";
export default {
name: "Artapplication",
data() {
return {
// 遮罩层
loading: true,
// 选中数组
ids: [],
// 非单个禁用
single: true,
// 非多个禁用
multiple: true,
// 显示搜索条件
showSearch: true,
// 总条数
total: 0,
// 创作者申请表格数据
artapplicationList: [],
// 弹出层标题
title: "",
// 是否显示弹出层
open: false,
// 查询参数
queryParams: {
pageNum: 1,
pageSize: 10,
userId: null,
state: null,
nickname: null,
name: null,
phone: null,
wechatId: null,
email: null,
applyReason: null,
applicationDate: null,
attachment: null,
deletedTime: null,
createdBy: null,
createdTime: null,
updatedBy: null,
updatedTime: null
},
// 表单参数
form: {},
// 表单校验
rules: {
}
};
},
created() {
this.getList();
},
methods: {
/** 查询创作者申请列表 */
getList() {
this.loading = true;
listArtapplication(this.queryParams).then(response => {
this.artapplicationList = response.rows;
this.total = response.total;
this.loading = false;
});
},
// 取消按钮
cancel() {
this.open = false;
this.reset();
},
// 表单重置
reset() {
this.form = {
id: null,
userId: null,
state: null,
nickname: null,
name: null,
phone: null,
wechatId: null,
email: null,
applyReason: null,
applicationDate: null,
attachment: null,
deletedTime: null,
createdBy: null,
createdTime: null,
updatedBy: null,
updatedTime: null
};
this.resetForm("form");
},
/** 搜索按钮操作 */
handleQuery() {
this.queryParams.pageNum = 1;
this.getList();
},
/** 重置按钮操作 */
resetQuery() {
this.resetForm("queryForm");
this.handleQuery();
},
// 多选框选中数据
handleSelectionChange(selection) {
this.ids = selection.map(item => item.id)
this.single = selection.length!==1
this.multiple = !selection.length
},
/** 新增按钮操作 */
handleAdd() {
this.reset();
this.open = true;
this.title = "添加创作者申请";
},
/** 修改按钮操作 */
handleUpdate(row) {
this.reset();
const id = row.id || this.ids
getArtapplication(id).then(response => {
this.form = response.data;
this.open = true;
if(this.form.state === 1){
this.form.state = "通过"
}
if(this.form.state === 2){
this.form.state = "不通过"
}
if(this.form.state === 3){
this.form.state = "待审核"
}
this.title = "审核创作者申请";
});
},
restore(state){
if(state === "通过"){
this.form.state = 1;
}
if(state === "不通过"){
this.form.state = 2;
}
if(state === "待审核"){
this.form.state = 3;
}
},
/** 提交按钮 */
submitForm() {
this.$refs["form"].validate(valid => {
if (valid) {
if (this.form.id != null) {
this.restore(this.form.state);
const ids = this.form.id;
const phone = this.form.phone;
let Form=this.form;
if (this.form.updatedBy === ""){
this.$message.error("请填写审核人")
return ;
}
this.$modal.confirm('是否审核手机号为"' + phone + '"的申请?').then(function() {
return updateArtapplication(Form);
}).then(() => {
this.$modal.msgSuccess("提交审核修改成功");
this.open = false;
this.getList();
//this.$modal.msgSuccess("审核成功");
}).catch(() => {});
// updateArtapplication(this.form).then(response => {
// this.$modal.msgSuccess("提交审核修改成功");
// this.open = false;
// this.getList();
// });
} else {
addArtapplication(this.form).then(response => {
this.$modal.msgSuccess("新增成功");
this.open = false;
this.getList();
});
}
}
});
},
/** 删除按钮操作 */
handleDelete(row) {
const ids = row.id || this.ids;
const phone =row.phone
this.$modal.confirm('是否确认删除创作者申请,手机为"' + phone + '"的数据项?').then(function() {
return delArtapplication(ids);
}).then(() => {
this.getList();
this.$modal.msgSuccess("删除成功");
}).catch(() => {});
},
/** 导出按钮操作 */
handleExport() {
this.download('wjnft/artapplication/export', {
...this.queryParams
}, `artapplication_${new Date().getTime()}.xlsx`)
}
}
};
</script>