|
|
@@ -0,0 +1,219 @@
|
|
|
+<template>
|
|
|
+ <div class="ele-body">
|
|
|
+ <el-card shadow="never">
|
|
|
+ <!-- 搜索表单 -->
|
|
|
+ <el-form :model="table.where" label-width="90px" class="ele-form-search" @keyup.enter.native="query"
|
|
|
+ @submit.native.prevent>
|
|
|
+ <el-row :gutter="15">
|
|
|
+ <el-col :md="6" :sm="12">
|
|
|
+ <el-form-item label="会员账号:">
|
|
|
+ <el-input v-model="table.where.keyword" placeholder="请输入会员手机号/昵称" clearable />
|
|
|
+ </el-form-item>
|
|
|
+ </el-col>
|
|
|
+ <el-col :md="4" :sm="12">
|
|
|
+ <el-form-item label="状态:">
|
|
|
+ <el-select v-model="table.where.status" placeholder="请选择" class="ele-fluid">
|
|
|
+ <el-option label="全部" :value="0"/>
|
|
|
+ <el-option label="已处理" :value="1"/>
|
|
|
+ <el-option label="待处理" :value="2"/>
|
|
|
+ </el-select>
|
|
|
+ </el-form-item>
|
|
|
+ </el-col>
|
|
|
+ <el-col :md="12" :sm="12">
|
|
|
+ <div class="ele-form-actions">
|
|
|
+ <el-button type="primary" @click="query" icon="el-icon-search" class="ele-btn-icon">查询</el-button>
|
|
|
+ <el-button @click="(table.where={status: 0})&&$refs.table.reload()">重置</el-button>
|
|
|
+ </div>
|
|
|
+ </el-col>
|
|
|
+ </el-row>
|
|
|
+ </el-form>
|
|
|
+ <!-- 操作按钮 -->
|
|
|
+ <div class="ele-table-tool ele-table-tool-default">
|
|
|
+ <el-button type="warning" icon="el-icon-download" @click="handleExport"
|
|
|
+ v-if="permission.includes('sys:consult_records:index')">导出</el-button>
|
|
|
+ <el-button @click="remove()" type="danger" icon="el-icon-delete" class="ele-btn-icon" size="small" v-if="permission.includes('sys:supervisors:dall')">批量删除
|
|
|
+ </el-button>
|
|
|
+ </div>
|
|
|
+
|
|
|
+ <!-- 数据表格 -->
|
|
|
+ <ele-data-table ref="table" :config="table" :choose.sync="choose" height="calc(100vh - 275px)"
|
|
|
+ highlight-current-row>
|
|
|
+ <el-table-column type="selection" width="45" align="center" fixed="left" />
|
|
|
+ <el-table-column label="编号" type="index" width="60" align="center" />
|
|
|
+ <el-table-column prop="supervisor" label="导师" show-overflow-tooltip min-width="120">
|
|
|
+ <template slot-scope="{row}">
|
|
|
+ <span>{{ row.supervisor ? row.supervisor.name:''}}</span>
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
+ <el-table-column prop="member" label="咨询用户" show-overflow-tooltip min-width="150" >
|
|
|
+ <template slot-scope="{row}">
|
|
|
+ <span>{{ row.realname+'('+row.mobile+')'}}</span>
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
+ <el-table-column prop="industry" label="所在行业" show-overflow-tooltip min-width="80"/>
|
|
|
+ <el-table-column prop="position" label="当前角色/职务" show-overflow-tooltip min-width="100"/>
|
|
|
+ <el-table-column prop="work_year" label="工作年限" show-overflow-tooltip min-width="100"/>
|
|
|
+ <el-table-column prop="interest" label="主要关注领域" show-overflow-tooltip min-width="200"/>
|
|
|
+ <el-table-column prop="experiences" label="过往相关经验简述" show-overflow-tooltip min-width="200"/>
|
|
|
+ <el-table-column label="咨询时间" show-overflow-tooltip min-width="160" align="center">
|
|
|
+ <template slot-scope="{row}">{{ row.create_time || '-' }}</template>
|
|
|
+ </el-table-column>
|
|
|
+ <el-table-column prop="status" label="状态" width="100" align="center">
|
|
|
+ <template slot-scope="{row}">
|
|
|
+ <ele-dot :type="['danger', 'success','danger'][row.status]" :ripple="row.status===0"
|
|
|
+ :text="['无效','已处理','待处理'][row.status]"/>
|
|
|
+ <el-switch v-model="row.status" @change="editStatus(row)" :active-value="1" :inactive-value="2"/>
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
+ <el-table-column label="操作" width="200px" align="center" :resizable="false" fixed="right">
|
|
|
+ <template slot-scope="{row}">
|
|
|
+ <el-popconfirm title="确定要删除此咨询记录吗?" @confirm="remove(row)" class="ele-action">
|
|
|
+ <el-link slot="reference" icon="el-icon-delete" type="danger" :underline="false"
|
|
|
+ v-if="permission.includes('sys:consult_records:delete')">删除</el-link>
|
|
|
+ </el-popconfirm>
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
+ </ele-data-table>
|
|
|
+ </el-card>
|
|
|
+ </div>
|
|
|
+</template>
|
|
|
+
|
|
|
+<script>
|
|
|
+import { mapGetters } from "vuex";
|
|
|
+import UploadImage from '@/components/uploadImage';
|
|
|
+
|
|
|
+export default {
|
|
|
+ name: "SysConsultRecords",
|
|
|
+ components: { UploadImage },
|
|
|
+ props: {
|
|
|
+ supervisor: {
|
|
|
+ type: Object,
|
|
|
+ default() {
|
|
|
+ return {id:0, name: ''};
|
|
|
+ }
|
|
|
+ },
|
|
|
+ },
|
|
|
+ data() {
|
|
|
+ return {
|
|
|
+ table: {
|
|
|
+ url: '/supervisors/consultRecord/index',
|
|
|
+ where: {source_id:this.supervisor.id,status: 0}
|
|
|
+ },
|
|
|
+ where: {}, // 搜索条件
|
|
|
+ choose: [], // 选中的数据
|
|
|
+ showEdit: false, // 是否显示表单弹窗
|
|
|
+ form: {}, // 表单数据
|
|
|
+ rules: { // 表单验证规则
|
|
|
+ },
|
|
|
+ }
|
|
|
+ },
|
|
|
+ computed: {
|
|
|
+ ...mapGetters(["permission"]),
|
|
|
+ },
|
|
|
+ methods: {
|
|
|
+ /* 查询 */
|
|
|
+ query() {
|
|
|
+ this.$refs.table.reload();
|
|
|
+ },
|
|
|
+ /* 显示添加 */
|
|
|
+ add() {
|
|
|
+ this.form = {
|
|
|
+ status: 1,
|
|
|
+ };
|
|
|
+ this.showEdit = true;
|
|
|
+ },
|
|
|
+ /* 显示修改 */
|
|
|
+ edit(row) {
|
|
|
+ this.form = row || {};
|
|
|
+ this.showEdit = true;
|
|
|
+ },
|
|
|
+ /* 保存 */
|
|
|
+ save() {
|
|
|
+ this.$refs['editForm'].validate((valid) => {
|
|
|
+ if (valid) {
|
|
|
+ const loading = this.$loading({ lock: true });
|
|
|
+ this.$http.post('/supervisors/consultRecord/edit', this.form).then(res => {
|
|
|
+ loading.close();
|
|
|
+ if (res.data.code === 0) {
|
|
|
+ this.showEdit = false;
|
|
|
+ this.$message({ type: 'success', message: res.data.msg });
|
|
|
+ this.$refs.table.reload();
|
|
|
+ } else {
|
|
|
+ this.$message.error(res.data.msg);
|
|
|
+ }
|
|
|
+ }).catch(e => {
|
|
|
+ loading.close();
|
|
|
+ this.$message.error(e.message);
|
|
|
+ });
|
|
|
+ }
|
|
|
+ });
|
|
|
+ },
|
|
|
+ /* 删除 */
|
|
|
+ remove(row) {
|
|
|
+ const loading = this.$loading({ lock: true });
|
|
|
+ this.$http.post('/supervisors/consultRecord/delete', { id: row.id }).then(res => {
|
|
|
+ loading.close();
|
|
|
+ if (res.data.code === 0) {
|
|
|
+ this.$message({ type: 'success', message: res.data.msg });
|
|
|
+ this.$refs.table.reload();
|
|
|
+ } else {
|
|
|
+ this.$message.error(res.data.msg);
|
|
|
+ }
|
|
|
+ }).catch(e => {
|
|
|
+ loading.close();
|
|
|
+ this.$message.error(e.message);
|
|
|
+ });
|
|
|
+ },
|
|
|
+ /* 更改状态 */
|
|
|
+ editStatus(row) {
|
|
|
+ this.$message.closeAll();
|
|
|
+ const loading = this.$loading({lock: true});
|
|
|
+ let params = Object.assign({}, row);
|
|
|
+ this.$http.post('/supervisors/consultRecord/status', params).then(res => {
|
|
|
+ loading.close();
|
|
|
+ if (res.data.code === 0) {
|
|
|
+ this.$message({type: 'success', message: res.data.msg});
|
|
|
+ } else {
|
|
|
+ row.status = !row.status ? 2 : 1;
|
|
|
+ this.$message.error(res.data.msg);
|
|
|
+ }
|
|
|
+ }).catch(e => {
|
|
|
+ loading.close();
|
|
|
+ this.$message.error(e.message);
|
|
|
+ });
|
|
|
+ },
|
|
|
+ /* 导出数据 */
|
|
|
+ handleExport() {
|
|
|
+ let array = [['导师','姓名','联系方式', '所在行业', '当前角色/职务', '从业年限', '主要关注领域', '过往相关经验简述','咨询时间','状态']];
|
|
|
+ this.$confirm('确定要导出当前筛选条件下导师咨询用户数据吗?', '提示', {
|
|
|
+ type: 'warning',
|
|
|
+ zIndex: 1030,
|
|
|
+ }).then(() => {
|
|
|
+ // 请求查询全部(不分页)的接口
|
|
|
+ const loading = this.$loading({lock: true});
|
|
|
+ this.$http.post('/supervisors/consultRecord/index',this.table.where).then(res => {
|
|
|
+ loading.close();
|
|
|
+ if (res.data.code === 0) {
|
|
|
+ res.data.data.forEach(d => {
|
|
|
+ array.push([
|
|
|
+ d.supervisor.name,d.realname, d.mobile,
|
|
|
+ d.industry, d.position, d.work_year,d.interest,d.experiences,
|
|
|
+ this.$util.toDateString(d.create_time),['','已处理','待处理'][d.status]
|
|
|
+ ]);
|
|
|
+ });
|
|
|
+ let sheet = XLSX.utils.aoa_to_sheet(array);
|
|
|
+ this.$util.exportSheet(XLSX, sheet, `导师咨询记录_${new Date().getTime()}`);
|
|
|
+ } else {
|
|
|
+ this.$message.error(res.data.msg);
|
|
|
+ }
|
|
|
+ }).catch(e => {
|
|
|
+ loading.close();
|
|
|
+ this.$message.error(e.message);
|
|
|
+ });
|
|
|
+ }).catch(() => { });
|
|
|
+ },
|
|
|
+ }
|
|
|
+}
|
|
|
+</script>
|
|
|
+
|
|
|
+<style lang="scss" scoped></style>
|