|
|
|
@ -0,0 +1,519 @@
|
|
|
|
|
<template>
|
|
|
|
|
<div class="app-container">
|
|
|
|
|
|
|
|
|
|
<!-- 搜索工作栏 -->
|
|
|
|
|
<el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="110px">
|
|
|
|
|
<el-form-item label="所属组织" prop="deptId">
|
|
|
|
|
<treeselect style="width: 240px;" v-model="queryParams.deptId" :options="deptOptions" :show-count="true"
|
|
|
|
|
:clearable="false"
|
|
|
|
|
placeholder="请选择所属组织" :normalizer="normalizer" />
|
|
|
|
|
</el-form-item>
|
|
|
|
|
<!-- <el-form-item label="启用状态" prop="status">-->
|
|
|
|
|
<!-- <el-select v-model="queryParams.status" placeholder="请选择状态" clearable>-->
|
|
|
|
|
<!-- <el-option v-for="dict in this.getDictDatas(DICT_TYPE.COMMON_STATUS)"-->
|
|
|
|
|
<!-- :key="dict.value" :label="dict.label" :value="dict.value"/>-->
|
|
|
|
|
<!-- </el-select>-->
|
|
|
|
|
<!-- </el-form-item>-->
|
|
|
|
|
<el-form-item label="推广员名称" prop="nickname">
|
|
|
|
|
<el-input v-model="queryParams.nickname" placeholder="请输入" clearable @keyup.enter.native="handleQuery"/>
|
|
|
|
|
</el-form-item>
|
|
|
|
|
<el-form-item label="注册来源" prop="sourceType">
|
|
|
|
|
<el-select v-model="queryParams.sourceType" placeholder="请选择来源" clearable @keyup.enter.native="handleQuery">
|
|
|
|
|
<el-option value="1" label="后台注册"/>
|
|
|
|
|
<el-option value="2" label="扫码注册"/>
|
|
|
|
|
</el-select>
|
|
|
|
|
</el-form-item>
|
|
|
|
|
<el-form-item label="手机号" prop="mobile">
|
|
|
|
|
<el-input v-model="queryParams.mobile" placeholder="请输入" clearable @keyup.enter.native="handleQuery"/>
|
|
|
|
|
</el-form-item>
|
|
|
|
|
<el-form-item>
|
|
|
|
|
<el-button type="primary" icon="el-icon-search" @click="handleQuery" v-hasPermi="['member:promoter:query']">搜索</el-button>
|
|
|
|
|
<el-button icon="el-icon-refresh" @click="resetQuery">重置</el-button>
|
|
|
|
|
</el-form-item>
|
|
|
|
|
</el-form>
|
|
|
|
|
|
|
|
|
|
<!-- 操作工具栏 -->
|
|
|
|
|
<el-row :gutter="10" class="mb8">
|
|
|
|
|
<el-col :span="1.5">
|
|
|
|
|
<el-button type="primary" plain icon="el-icon-plus" size="mini" @click="handleAdd"
|
|
|
|
|
v-hasPermi="['member:promoter:create']">新增
|
|
|
|
|
</el-button>
|
|
|
|
|
</el-col>
|
|
|
|
|
<el-col :span="1.5">
|
|
|
|
|
<el-button type="info" icon="el-icon-upload2" size="mini" @click="handleImport"
|
|
|
|
|
v-hasPermi="['member:promoter:export']">导入
|
|
|
|
|
</el-button>
|
|
|
|
|
</el-col>
|
|
|
|
|
<el-col :span="1.5">
|
|
|
|
|
<el-button type="warning" plain icon="el-icon-download" size="mini" @click="handleExport" :loading="exportLoading"
|
|
|
|
|
v-hasPermi="['member:promoter:export']">导出</el-button>
|
|
|
|
|
</el-col>
|
|
|
|
|
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
|
|
|
|
|
</el-row>
|
|
|
|
|
|
|
|
|
|
<!-- 列表 -->
|
|
|
|
|
<el-table v-loading="loading" :data="list">
|
|
|
|
|
<el-table-column label="编号" align="center" prop="id"/>
|
|
|
|
|
<el-table-column label="推广员名称" align="center" prop="nickname"/>
|
|
|
|
|
<el-table-column label="手机号" align="center" prop="mobile"/>
|
|
|
|
|
<el-table-column label="注册来源" align="center" prop="sourceType">
|
|
|
|
|
<template v-slot="scope">
|
|
|
|
|
<div>{{scope.row.sourceType == "1"?'后台注册':'扫码注册'}}</div>
|
|
|
|
|
</template>
|
|
|
|
|
</el-table-column>
|
|
|
|
|
<el-table-column label="所属组织" align="center" prop="orgName"/>
|
|
|
|
|
<!-- <el-table-column label="启用状态" align="center" prop="status">-->
|
|
|
|
|
<!-- <template v-slot="scope">-->
|
|
|
|
|
<!-- <el-switch v-model="scope.row.status" :active-value="0" :inactive-value="1"-->
|
|
|
|
|
<!-- @change="handleStatusChange(scope.row)"/>-->
|
|
|
|
|
<!-- </template>-->
|
|
|
|
|
<!-- </el-table-column>-->
|
|
|
|
|
<el-table-column label="操作" align="center" class-name="small-padding fixed-width">
|
|
|
|
|
<template v-slot="scope">
|
|
|
|
|
<el-button size="mini" type="text" icon="el-icon-edit" @click="handleUpdate(scope.row)"
|
|
|
|
|
v-hasPermi="['member:promoter:update']">修改
|
|
|
|
|
</el-button>
|
|
|
|
|
<!-- <el-button size="mini" type="text" icon="el-icon-key" @click="handleUpdatePassword(scope.row)"-->
|
|
|
|
|
<!-- v-hasPermi="['member:promoter:delete']">修改密码-->
|
|
|
|
|
<!-- </el-button>-->
|
|
|
|
|
</template>
|
|
|
|
|
</el-table-column>
|
|
|
|
|
</el-table>
|
|
|
|
|
<!-- 分页组件 -->
|
|
|
|
|
<pagination v-show="total > 0" :total="total" :page.sync="queryParams.pageNo" :limit.sync="queryParams.pageSize"
|
|
|
|
|
@pagination="getList"/>
|
|
|
|
|
|
|
|
|
|
<!-- 对话框(添加 / 修改) -->
|
|
|
|
|
<el-dialog :title="title" :visible.sync="open" width="500px" v-dialogDrag append-to-body>
|
|
|
|
|
<el-form ref="form" :model="form" :rules="rules" label-width="120px">
|
|
|
|
|
<el-form-item label="所属组织" prop="deptId">
|
|
|
|
|
<treeselect style="width: 240px;" v-model="form.deptId" :options="deptOptions" :show-count="true"
|
|
|
|
|
:clearable="false"
|
|
|
|
|
placeholder="请选择所属组织" :normalizer="normalizer" @select="handleChange"/>
|
|
|
|
|
</el-form-item>
|
|
|
|
|
<!-- <el-form-item label="启用状态" prop="status">-->
|
|
|
|
|
<!-- <el-radio-group v-model="form.status">-->
|
|
|
|
|
<!-- <el-radio v-for="dict in this.getDictDatas(DICT_TYPE.COMMON_STATUS)"-->
|
|
|
|
|
<!-- :key="dict.value" :label="parseInt(dict.value)">{{ dict.label }}-->
|
|
|
|
|
<!-- </el-radio>-->
|
|
|
|
|
<!-- </el-radio-group>-->
|
|
|
|
|
<!-- </el-form-item>-->
|
|
|
|
|
<el-form-item label="注册来源" prop="sourceType">
|
|
|
|
|
<el-select v-model="form.sourceType" placeholder="请选择来源" clearable disabled>
|
|
|
|
|
<el-option value="1" label="后台注册"/>
|
|
|
|
|
<el-option value="2" label="扫码注册"/>
|
|
|
|
|
</el-select>
|
|
|
|
|
</el-form-item>
|
|
|
|
|
<el-form-item label="推广员姓名" prop="nickname">
|
|
|
|
|
<el-input v-model="form.nickname" maxlength="100" placeholder="请输入"/>
|
|
|
|
|
</el-form-item>
|
|
|
|
|
<el-form-item label="推广员手机号" prop="mobile">
|
|
|
|
|
<el-input v-model="form.mobile" placeholder="请输入"/>
|
|
|
|
|
</el-form-item>
|
|
|
|
|
</el-form>
|
|
|
|
|
<div slot="footer" class="dialog-footer">
|
|
|
|
|
<el-button type="primary" @click="submitForm" :loading="submitLoading" :disabled="submitLoading">确 定</el-button>
|
|
|
|
|
<el-button @click="cancel">取 消</el-button>
|
|
|
|
|
</div>
|
|
|
|
|
</el-dialog>
|
|
|
|
|
<!-- 用户导入对话框 -->
|
|
|
|
|
<el-dialog :title="upload.title" :visible.sync="upload.open" width="400px" append-to-body>
|
|
|
|
|
<el-upload ref="upload" :limit="1" accept=".xlsx, .xls" :headers="upload.headers"
|
|
|
|
|
:action="upload.url + '?updateSupport=' + upload.updateSupport" :disabled="upload.isUploading"
|
|
|
|
|
:on-progress="handleFileUploadProgress" :on-success="handleFileSuccess" :auto-upload="false" drag>
|
|
|
|
|
<i class="el-icon-upload"></i>
|
|
|
|
|
<div class="el-upload__text">将文件拖到此处,或<em>点击上传</em></div>
|
|
|
|
|
<div class="el-upload__tip text-center" slot="tip">
|
|
|
|
|
<!-- <div class="el-upload__tip" slot="tip">-->
|
|
|
|
|
<!-- <el-checkbox v-model="upload.updateSupport" /> 是否更新已经存在的用户数据-->
|
|
|
|
|
<!-- </div>-->
|
|
|
|
|
<span>仅允许导入xls、xlsx格式文件。</span>
|
|
|
|
|
<el-link type="primary" :underline="false" style="font-size:12px;vertical-align: baseline;"
|
|
|
|
|
@click="importTemplate">下载模板
|
|
|
|
|
</el-link>
|
|
|
|
|
</div>
|
|
|
|
|
</el-upload>
|
|
|
|
|
<div slot="footer" class="dialog-footer">
|
|
|
|
|
<el-button type="primary" @click="submitFileForm" :loading="submitLoading" :disabled="submitLoading">确 定</el-button>
|
|
|
|
|
<el-button @click="upload.open = false">取 消</el-button>
|
|
|
|
|
</div>
|
|
|
|
|
</el-dialog>
|
|
|
|
|
<!-- 修改密码 -->
|
|
|
|
|
<el-dialog title="修改密码" :visible.sync="updatePassword.show" width="500px" append-to-body>
|
|
|
|
|
<el-form ref="updatePasswordForm" :model="updatePasswordForm" :rules="passwrodRules" label-width="80px">
|
|
|
|
|
<el-form-item label="密码" prop="password">
|
|
|
|
|
<el-input type="password" v-model="updatePasswordForm.password" placeholder="请输入"/>
|
|
|
|
|
</el-form-item>
|
|
|
|
|
<el-form-item label="确认密码" prop="checkPass">
|
|
|
|
|
<el-input type="password" v-model="updatePasswordForm.checkPass" placeholder="请输入"/>
|
|
|
|
|
</el-form-item>
|
|
|
|
|
</el-form>
|
|
|
|
|
<div slot="footer" class="dialog-footer">
|
|
|
|
|
<el-button type="primary" @click="submitPasswordForm" :loading="submitLoading" :disabled="submitLoading">确 定</el-button>
|
|
|
|
|
<el-button @click="updatePassword.show = false">取 消</el-button>
|
|
|
|
|
</div>
|
|
|
|
|
</el-dialog>
|
|
|
|
|
</div>
|
|
|
|
|
</template>
|
|
|
|
|
|
|
|
|
|
<script>
|
|
|
|
|
import {
|
|
|
|
|
createPromoter,
|
|
|
|
|
tenantIgnoreUpdate,
|
|
|
|
|
deletePromoter,
|
|
|
|
|
getPromoter,
|
|
|
|
|
getallPage,
|
|
|
|
|
importTemplate,
|
|
|
|
|
exportPromoterExcel, updatePassword
|
|
|
|
|
} from '@/api/member/promoter';
|
|
|
|
|
import {
|
|
|
|
|
changeUserStatus
|
|
|
|
|
} from '@/api/member/user';
|
|
|
|
|
import {getDeptListAll} from '@/api/system/dept';
|
|
|
|
|
import {listSimplePosts} from '@/api/system/post';
|
|
|
|
|
import {getBaseHeader} from '@/utils/request';
|
|
|
|
|
import {CommonStatusEnum} from '@/utils/constants';
|
|
|
|
|
import {DICT_TYPE} from '@/utils/dict';
|
|
|
|
|
import Treeselect from '@riophae/vue-treeselect';
|
|
|
|
|
import '@riophae/vue-treeselect/dist/vue-treeselect.css';
|
|
|
|
|
import ImageUpload from '@/components/ImageUpload/index.vue';
|
|
|
|
|
|
|
|
|
|
export default {
|
|
|
|
|
name: 'Promoter',
|
|
|
|
|
computed: {
|
|
|
|
|
DICT_TYPE() {
|
|
|
|
|
return DICT_TYPE
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
components: {
|
|
|
|
|
ImageUpload,
|
|
|
|
|
Treeselect
|
|
|
|
|
},
|
|
|
|
|
data() {
|
|
|
|
|
const validatePass = (rule, value, callback) => {
|
|
|
|
|
if (value === '') {
|
|
|
|
|
callback(new Error('请输入密码'));
|
|
|
|
|
} else {
|
|
|
|
|
if (this.updatePasswordForm.checkPass !== '') {
|
|
|
|
|
this.$refs.updatePasswordForm.validateField('checkPass');
|
|
|
|
|
}
|
|
|
|
|
callback();
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
const validateCheckPass = (rule, value, callback) => {
|
|
|
|
|
if (value === '') {
|
|
|
|
|
callback(new Error('请再次输入密码'));
|
|
|
|
|
} else if (value !== this.updatePasswordForm.password) {
|
|
|
|
|
callback(new Error('两次输入密码不一致!'));
|
|
|
|
|
} else {
|
|
|
|
|
callback();
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
return {
|
|
|
|
|
// 遮罩层
|
|
|
|
|
loading: true,
|
|
|
|
|
submitLoading: false,
|
|
|
|
|
deptOptions: undefined,
|
|
|
|
|
// 导出遮罩层
|
|
|
|
|
exportLoading: false,
|
|
|
|
|
// 显示搜索条件
|
|
|
|
|
showSearch: true,
|
|
|
|
|
// 总条数
|
|
|
|
|
total: 0,
|
|
|
|
|
// 推广员列表
|
|
|
|
|
list: [],
|
|
|
|
|
// 弹出层标题
|
|
|
|
|
title: '',
|
|
|
|
|
// 是否显示弹出层
|
|
|
|
|
open: false,
|
|
|
|
|
// 用户导入参数
|
|
|
|
|
upload: {
|
|
|
|
|
// 是否显示弹出层(用户导入)
|
|
|
|
|
open: false,
|
|
|
|
|
// 弹出层标题(用户导入)
|
|
|
|
|
title: '推广员导入',
|
|
|
|
|
// 是否禁用上传
|
|
|
|
|
isUploading: false,
|
|
|
|
|
// 是否更新已经存在的用户数据
|
|
|
|
|
updateSupport: 0,
|
|
|
|
|
// 设置上传的请求头部
|
|
|
|
|
headers: getBaseHeader(),
|
|
|
|
|
// 上传的地址
|
|
|
|
|
url: process.env.VUE_APP_BASE_API + '/admin-api/member/promoter/import'
|
|
|
|
|
},
|
|
|
|
|
updatePassword: {
|
|
|
|
|
show: false,
|
|
|
|
|
userId: ''
|
|
|
|
|
},
|
|
|
|
|
passwrodRules:{
|
|
|
|
|
password: [
|
|
|
|
|
{ required: true, message: "请输入密码", trigger: "blur" },
|
|
|
|
|
{ validator: validatePass, trigger: 'blur' }
|
|
|
|
|
],
|
|
|
|
|
checkPass: [
|
|
|
|
|
{ required: true, message: "请输入确认密码", trigger: "blur" },
|
|
|
|
|
{ validator: validateCheckPass, trigger: 'blur' }
|
|
|
|
|
],
|
|
|
|
|
},
|
|
|
|
|
updatePasswordForm: {},
|
|
|
|
|
// 查询参数
|
|
|
|
|
queryParams: {
|
|
|
|
|
pageNo: 1,
|
|
|
|
|
pageSize: 10,
|
|
|
|
|
deptId: null,
|
|
|
|
|
userId: null,
|
|
|
|
|
},
|
|
|
|
|
// 表单参数
|
|
|
|
|
form: {
|
|
|
|
|
},
|
|
|
|
|
// 表单校验
|
|
|
|
|
rules: {
|
|
|
|
|
deptId: [{
|
|
|
|
|
required: true,
|
|
|
|
|
message: '请选择所属组织',
|
|
|
|
|
trigger: 'blur'
|
|
|
|
|
}],
|
|
|
|
|
status: [{
|
|
|
|
|
required: true,
|
|
|
|
|
message: '请选择状态',
|
|
|
|
|
trigger: 'blur'
|
|
|
|
|
}],
|
|
|
|
|
nickname: [{
|
|
|
|
|
required: true,
|
|
|
|
|
message: '请输入名称',
|
|
|
|
|
trigger: 'blur'
|
|
|
|
|
}],
|
|
|
|
|
mobile: [
|
|
|
|
|
{
|
|
|
|
|
required: true,
|
|
|
|
|
message: '请输入手机号',
|
|
|
|
|
trigger: 'blur'
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
pattern: /^(?:(?:\+|00)86)?1(?:3[\d]|4[5-79]|5[0-35-9]|6[5-7]|7[0-8]|8[\d]|9[189])\d{8}$/,
|
|
|
|
|
message: '请输入正确的手机号码',
|
|
|
|
|
trigger: 'blur'
|
|
|
|
|
}
|
|
|
|
|
]
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
},
|
|
|
|
|
created() {
|
|
|
|
|
this.getList();
|
|
|
|
|
this.getTreeselect();
|
|
|
|
|
},
|
|
|
|
|
methods: {
|
|
|
|
|
handleChange(value){
|
|
|
|
|
this.form.tenantId = value.tenantId
|
|
|
|
|
},
|
|
|
|
|
// 格式化部门的下拉框
|
|
|
|
|
normalizer(node) {
|
|
|
|
|
return {
|
|
|
|
|
id: node.id,
|
|
|
|
|
label: node.name,
|
|
|
|
|
children: node.children
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
/** 查询部门下拉树结构 + 岗位下拉 */
|
|
|
|
|
getTreeselect() {
|
|
|
|
|
getDeptListAll().then(response => {
|
|
|
|
|
// 处理 deptOptions 参数
|
|
|
|
|
this.deptOptions = [];
|
|
|
|
|
this.deptOptions.push(...this.handleTree(response.data, 'id'));
|
|
|
|
|
});
|
|
|
|
|
},
|
|
|
|
|
// 筛选节点
|
|
|
|
|
filterNode(value, data) {
|
|
|
|
|
if (!value) return true;
|
|
|
|
|
return data.name.indexOf(value) !== -1;
|
|
|
|
|
},
|
|
|
|
|
// 节点单击事件
|
|
|
|
|
handleNodeClick(data) {
|
|
|
|
|
this.queryParams.deptId = data.id;
|
|
|
|
|
},
|
|
|
|
|
/** 查询列表 */
|
|
|
|
|
getList() {
|
|
|
|
|
this.loading = true;
|
|
|
|
|
// 执行查询
|
|
|
|
|
getallPage(this.queryParams).then(response => {
|
|
|
|
|
this.list = response.data.list;
|
|
|
|
|
this.total = response.data.total;
|
|
|
|
|
this.loading = false;
|
|
|
|
|
});
|
|
|
|
|
},
|
|
|
|
|
/** 取消按钮 */
|
|
|
|
|
cancel() {
|
|
|
|
|
this.open = false;
|
|
|
|
|
this.reset();
|
|
|
|
|
},
|
|
|
|
|
handleUpdatePassword(row) {
|
|
|
|
|
this.updatePasswordForm = {}
|
|
|
|
|
this.updatePassword.show = true
|
|
|
|
|
this.updatePassword.userId = row.userId
|
|
|
|
|
},
|
|
|
|
|
/** 表单重置 */
|
|
|
|
|
reset() {
|
|
|
|
|
this.form = {
|
|
|
|
|
id: undefined,
|
|
|
|
|
deptId: undefined,
|
|
|
|
|
userId: undefined,
|
|
|
|
|
};
|
|
|
|
|
this.resetForm('form');
|
|
|
|
|
},
|
|
|
|
|
/** 搜索按钮操作 */
|
|
|
|
|
handleQuery() {
|
|
|
|
|
this.queryParams.pageNo = 1;
|
|
|
|
|
this.getList();
|
|
|
|
|
},
|
|
|
|
|
/** 重置按钮操作 */
|
|
|
|
|
resetQuery() {
|
|
|
|
|
this.resetForm('queryForm');
|
|
|
|
|
this.handleQuery();
|
|
|
|
|
},
|
|
|
|
|
/** 新增按钮操作 */
|
|
|
|
|
handleAdd() {
|
|
|
|
|
this.reset();
|
|
|
|
|
this.form.status = 0
|
|
|
|
|
this.form.sourceType = "1"
|
|
|
|
|
this.open = true;
|
|
|
|
|
this.title = '添加推广员';
|
|
|
|
|
},
|
|
|
|
|
/** 修改按钮操作 */
|
|
|
|
|
handleUpdate(row) {
|
|
|
|
|
this.reset();
|
|
|
|
|
this.form = row
|
|
|
|
|
this.open = true;
|
|
|
|
|
this.title = '修改推广员';
|
|
|
|
|
},
|
|
|
|
|
submitPasswordForm(){
|
|
|
|
|
this.$refs['updatePasswordForm'].validate(valid => {
|
|
|
|
|
if (!valid) {
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
this.submitLoading = true
|
|
|
|
|
// 添加的提交
|
|
|
|
|
updatePassword({
|
|
|
|
|
id: this.updatePassword.userId,
|
|
|
|
|
password: this.updatePasswordForm.password
|
|
|
|
|
}).then(response => {
|
|
|
|
|
this.$modal.msgSuccess('修改成功');
|
|
|
|
|
this.updatePassword.show = false;
|
|
|
|
|
}).finally(()=>{
|
|
|
|
|
this.submitLoading = false
|
|
|
|
|
})
|
|
|
|
|
});
|
|
|
|
|
},
|
|
|
|
|
/** 提交按钮 */
|
|
|
|
|
submitForm() {
|
|
|
|
|
this.$refs['form'].validate(valid => {
|
|
|
|
|
if (!valid) {
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
this.submitLoading = true
|
|
|
|
|
// 修改的提交
|
|
|
|
|
if (this.form.id != null) {
|
|
|
|
|
tenantIgnoreUpdate(this.form).then(response => {
|
|
|
|
|
this.$modal.msgSuccess('修改成功');
|
|
|
|
|
this.open = false;
|
|
|
|
|
this.getList();
|
|
|
|
|
}).finally(()=>{
|
|
|
|
|
this.submitLoading = false
|
|
|
|
|
})
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
// 添加的提交
|
|
|
|
|
createPromoter(this.form).then(response => {
|
|
|
|
|
this.$modal.msgSuccess('新增成功');
|
|
|
|
|
this.open = false;
|
|
|
|
|
this.getList();
|
|
|
|
|
}).finally(()=>{
|
|
|
|
|
this.submitLoading = false
|
|
|
|
|
})
|
|
|
|
|
});
|
|
|
|
|
},
|
|
|
|
|
/** 删除按钮操作 */
|
|
|
|
|
handleDelete(row) {
|
|
|
|
|
const id = row.id;
|
|
|
|
|
this.$modal.confirm('是否确认删除推广员编号为"' + id + '"的数据项?').then(function () {
|
|
|
|
|
return deletePromoter(id);
|
|
|
|
|
}).then(() => {
|
|
|
|
|
this.getList();
|
|
|
|
|
this.$modal.msgSuccess('删除成功');
|
|
|
|
|
}).catch(() => {
|
|
|
|
|
});
|
|
|
|
|
},
|
|
|
|
|
// 用户状态修改
|
|
|
|
|
handleStatusChange(row) {
|
|
|
|
|
console.log('row', row)
|
|
|
|
|
let text = row.status === CommonStatusEnum.ENABLE ? '启用' : '禁用';
|
|
|
|
|
this.$modal.confirm('您确认要"' + text + '""' + row.nickname + '"推广员吗?').then(function () {
|
|
|
|
|
return changeUserStatus({
|
|
|
|
|
id: row.userId,
|
|
|
|
|
status: row.status
|
|
|
|
|
});
|
|
|
|
|
}).then(() => {
|
|
|
|
|
this.$modal.msgSuccess(text + '成功');
|
|
|
|
|
}).catch(function () {
|
|
|
|
|
row.status = row.status === CommonStatusEnum.ENABLE ? CommonStatusEnum.DISABLE
|
|
|
|
|
: CommonStatusEnum.ENABLE;
|
|
|
|
|
});
|
|
|
|
|
},
|
|
|
|
|
/** 导出按钮操作 */
|
|
|
|
|
handleExport() {
|
|
|
|
|
// 处理查询参数
|
|
|
|
|
let params = {...this.queryParams};
|
|
|
|
|
params.pageNo = undefined;
|
|
|
|
|
params.pageSize = undefined;
|
|
|
|
|
this.$modal.confirm('是否确认导出所有推广员数据项?').then(() => {
|
|
|
|
|
this.exportLoading = true;
|
|
|
|
|
return exportPromoterExcel(params);
|
|
|
|
|
}).then(response => {
|
|
|
|
|
this.$download.excel(response, '推广员.xls');
|
|
|
|
|
this.exportLoading = false;
|
|
|
|
|
}).catch(() => {
|
|
|
|
|
});
|
|
|
|
|
},
|
|
|
|
|
/** 导入按钮操作 */
|
|
|
|
|
handleImport() {
|
|
|
|
|
this.upload.title = '推广员导入';
|
|
|
|
|
this.upload.open = true;
|
|
|
|
|
},
|
|
|
|
|
/** 下载模板操作 */
|
|
|
|
|
importTemplate() {
|
|
|
|
|
importTemplate().then(response => {
|
|
|
|
|
this.$download.excel(response, '推广员导入模板.xls');
|
|
|
|
|
});
|
|
|
|
|
},
|
|
|
|
|
// 文件上传中处理
|
|
|
|
|
handleFileUploadProgress(event, file, fileList) {
|
|
|
|
|
this.upload.isUploading = true;
|
|
|
|
|
},
|
|
|
|
|
// 文件上传成功处理
|
|
|
|
|
handleFileSuccess(response, file, fileList) {
|
|
|
|
|
if (response.code !== 0) {
|
|
|
|
|
this.$modal.msgError(response.msg)
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
this.upload.open = false;
|
|
|
|
|
this.upload.isUploading = false;
|
|
|
|
|
this.$refs.upload.clearFiles();
|
|
|
|
|
// 拼接提示语
|
|
|
|
|
let data = response.data;
|
|
|
|
|
let text = '创建成功数量:' + data.createUsernames.length;
|
|
|
|
|
for (const username of data.createUsernames) {
|
|
|
|
|
text += '<br /> ' + username;
|
|
|
|
|
}
|
|
|
|
|
text += '<br />创建失败数量:' + Object.keys(data.failureUsernames).length;
|
|
|
|
|
for (const username in data.failureUsernames) {
|
|
|
|
|
text += '<br /> ' + username + ':' + data.failureUsernames[username];
|
|
|
|
|
}
|
|
|
|
|
this.$alert(text, '导入结果', {dangerouslyUseHTMLString: true});
|
|
|
|
|
this.getList();
|
|
|
|
|
},
|
|
|
|
|
// 提交上传文件
|
|
|
|
|
submitFileForm() {
|
|
|
|
|
this.$refs.upload.submit();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
</script>
|