2022-07-22 17:32:45 +08:00
|
|
|
|
<template>
|
|
|
|
|
|
<div class="app-container">
|
|
|
|
|
|
<el-form
|
2023-06-19 17:25:29 +08:00
|
|
|
|
v-show="showSearch"
|
|
|
|
|
|
ref="queryFormRef"
|
|
|
|
|
|
:inline="true"
|
|
|
|
|
|
:model="queryParams"
|
|
|
|
|
|
label-width="68px"
|
2022-07-22 17:32:45 +08:00
|
|
|
|
>
|
|
|
|
|
|
<el-form-item label="企业名称" prop="name">
|
|
|
|
|
|
<el-input
|
2023-06-19 17:25:29 +08:00
|
|
|
|
v-model="queryParams.name"
|
|
|
|
|
|
clearable
|
|
|
|
|
|
placeholder="请输入企业名称"
|
|
|
|
|
|
size="default"
|
|
|
|
|
|
style="width: 240px"
|
|
|
|
|
|
@keyup.enter.native="handleQuery"
|
2022-07-22 17:32:45 +08:00
|
|
|
|
/>
|
|
|
|
|
|
</el-form-item>
|
2022-11-25 17:30:10 +08:00
|
|
|
|
<!-- <el-form-item label="所属站点" prop="tenantId">
|
2022-08-30 12:23:19 +08:00
|
|
|
|
<SiteOptions v-model="queryParams.tenantId" :site-list="siteList" />
|
2022-11-25 17:30:10 +08:00
|
|
|
|
</el-form-item> -->
|
2022-07-22 17:32:45 +08:00
|
|
|
|
|
|
|
|
|
|
<el-form-item>
|
|
|
|
|
|
<el-button
|
2023-06-19 17:25:29 +08:00
|
|
|
|
icon="search"
|
|
|
|
|
|
size="default"
|
|
|
|
|
|
type="primary"
|
|
|
|
|
|
@click="handleQuery"
|
|
|
|
|
|
>搜索
|
|
|
|
|
|
</el-button>
|
2022-07-22 17:32:45 +08:00
|
|
|
|
<el-button icon="refresh" size="default" @click="resetQuery"
|
2023-06-19 17:25:29 +08:00
|
|
|
|
>重置
|
|
|
|
|
|
</el-button>
|
2022-07-22 17:32:45 +08:00
|
|
|
|
</el-form-item>
|
|
|
|
|
|
</el-form>
|
|
|
|
|
|
|
|
|
|
|
|
<el-row :gutter="10" class="mb8">
|
|
|
|
|
|
<el-col :span="1.5">
|
|
|
|
|
|
<el-button
|
2023-06-19 17:25:29 +08:00
|
|
|
|
icon="plus"
|
|
|
|
|
|
plain
|
|
|
|
|
|
size="default"
|
|
|
|
|
|
type="primary"
|
|
|
|
|
|
@click="handleAdd"
|
|
|
|
|
|
>新增
|
|
|
|
|
|
</el-button>
|
2022-07-22 17:32:45 +08:00
|
|
|
|
</el-col>
|
|
|
|
|
|
<el-col :span="1.5">
|
2022-07-28 11:18:53 +08:00
|
|
|
|
<el-button
|
2023-06-19 17:25:29 +08:00
|
|
|
|
icon="upload"
|
|
|
|
|
|
plain
|
|
|
|
|
|
size="default"
|
|
|
|
|
|
type="info"
|
|
|
|
|
|
@click="handleImport"
|
|
|
|
|
|
>导入
|
|
|
|
|
|
</el-button>
|
2022-07-22 17:32:45 +08:00
|
|
|
|
</el-col>
|
|
|
|
|
|
<el-col :span="1.5">
|
|
|
|
|
|
<el-button
|
2023-06-19 17:25:29 +08:00
|
|
|
|
icon="download"
|
|
|
|
|
|
plain
|
|
|
|
|
|
size="default"
|
|
|
|
|
|
type="warning"
|
|
|
|
|
|
@click="handleExport"
|
|
|
|
|
|
>导出
|
|
|
|
|
|
</el-button>
|
2022-07-22 17:32:45 +08:00
|
|
|
|
</el-col>
|
2022-12-05 15:58:30 +08:00
|
|
|
|
<el-col :span="1.5">
|
|
|
|
|
|
<el-button
|
2023-06-19 17:25:29 +08:00
|
|
|
|
:disabled="!ids.length"
|
|
|
|
|
|
icon="delete"
|
|
|
|
|
|
type="danger"
|
|
|
|
|
|
@click="handleDelete()"
|
|
|
|
|
|
>批量删除
|
|
|
|
|
|
</el-button>
|
2022-12-05 15:58:30 +08:00
|
|
|
|
</el-col>
|
2022-07-22 17:32:45 +08:00
|
|
|
|
<right-toolbar
|
2023-06-19 17:25:29 +08:00
|
|
|
|
:showSearch.sync="showSearch"
|
|
|
|
|
|
@queryTable="getList"
|
2022-07-22 17:32:45 +08:00
|
|
|
|
></right-toolbar>
|
|
|
|
|
|
</el-row>
|
|
|
|
|
|
|
2022-12-05 15:58:30 +08:00
|
|
|
|
<el-table
|
2023-06-19 17:25:29 +08:00
|
|
|
|
v-loading="loading"
|
|
|
|
|
|
:data="dataList"
|
|
|
|
|
|
@selection-change="handleSelectionChange"
|
2022-12-05 15:58:30 +08:00
|
|
|
|
>
|
2023-06-19 17:25:29 +08:00
|
|
|
|
<el-table-column type="selection" width="55" />
|
|
|
|
|
|
<el-table-column align="center" label="数据编号" prop="id" />
|
|
|
|
|
|
<el-table-column align="center" label="企业名称" prop="name" />
|
2022-11-17 17:30:20 +08:00
|
|
|
|
<!-- <el-table-column label="统一社会信用代码" align="center" prop="code" /> -->
|
2023-06-09 17:30:58 +08:00
|
|
|
|
<el-table-column align="center" label="所属领域" show-overflow-tooltip>
|
2022-07-22 17:32:45 +08:00
|
|
|
|
<template #default="{ row }">
|
|
|
|
|
|
<div>{{ row.industrys[row.industrys.length - 1] }}</div>
|
|
|
|
|
|
</template>
|
2022-07-27 16:56:23 +08:00
|
|
|
|
</el-table-column>
|
2022-11-25 17:30:10 +08:00
|
|
|
|
<!-- <el-table-column label="站点" align="center">
|
2022-07-22 17:32:45 +08:00
|
|
|
|
<template #default="{ row }">
|
2022-08-30 12:23:19 +08:00
|
|
|
|
{{ siteList.find((el) => el.id === row.tenantId)?.name ?? "无" }}
|
2022-07-22 17:32:45 +08:00
|
|
|
|
</template>
|
2022-11-25 17:30:10 +08:00
|
|
|
|
</el-table-column> -->
|
2023-06-19 17:25:29 +08:00
|
|
|
|
<el-table-column align="center" label="所在地" prop="address" />
|
2023-06-09 17:30:58 +08:00
|
|
|
|
<el-table-column align="center" label="企业类型" prop="kind">
|
2022-07-22 17:32:45 +08:00
|
|
|
|
<template #default="{ row }">
|
|
|
|
|
|
<div>
|
|
|
|
|
|
{{ enterpriseOptions.find((e) => row.kind == e.key).value }}
|
|
|
|
|
|
</div>
|
|
|
|
|
|
</template>
|
|
|
|
|
|
</el-table-column>
|
2023-06-09 17:30:58 +08:00
|
|
|
|
<el-table-column align="center" label="申请时间">
|
2022-07-22 17:32:45 +08:00
|
|
|
|
<template #default="{ row }">
|
|
|
|
|
|
<span>{{ row.createdAt }}</span>
|
|
|
|
|
|
</template>
|
|
|
|
|
|
</el-table-column>
|
2023-06-09 17:30:58 +08:00
|
|
|
|
<el-table-column align="center" label="操作">
|
2022-07-22 17:32:45 +08:00
|
|
|
|
<template #default="{ row }">
|
|
|
|
|
|
<el-button
|
2023-06-19 17:25:29 +08:00
|
|
|
|
icon="edit"
|
|
|
|
|
|
size="small"
|
|
|
|
|
|
type="text"
|
|
|
|
|
|
@click="handleDetail(row.id)"
|
|
|
|
|
|
>修改
|
|
|
|
|
|
</el-button>
|
2022-07-27 16:56:23 +08:00
|
|
|
|
<el-button
|
2023-06-19 17:25:29 +08:00
|
|
|
|
icon="delete"
|
|
|
|
|
|
size="small"
|
|
|
|
|
|
type="text"
|
|
|
|
|
|
@click="handleDelete(row.id)"
|
|
|
|
|
|
>删除
|
|
|
|
|
|
</el-button>
|
2022-10-31 17:45:39 +08:00
|
|
|
|
<el-button
|
2023-06-19 17:25:29 +08:00
|
|
|
|
icon="edit"
|
|
|
|
|
|
size="small"
|
|
|
|
|
|
type="text"
|
|
|
|
|
|
@click="openAssignAccount(row.id)"
|
|
|
|
|
|
>分配账号
|
|
|
|
|
|
</el-button>
|
2022-10-31 17:45:39 +08:00
|
|
|
|
<el-button
|
2023-06-19 17:25:29 +08:00
|
|
|
|
icon="edit"
|
|
|
|
|
|
size="small"
|
|
|
|
|
|
type="text"
|
|
|
|
|
|
@click="openResetPassword(row.id)"
|
|
|
|
|
|
>重置密码
|
|
|
|
|
|
</el-button>
|
2022-10-31 17:45:39 +08:00
|
|
|
|
<el-button
|
2023-06-19 17:25:29 +08:00
|
|
|
|
icon="edit"
|
|
|
|
|
|
size="small"
|
|
|
|
|
|
type="text"
|
|
|
|
|
|
@click="handleOpenVip(row.id)"
|
|
|
|
|
|
>开通会员
|
|
|
|
|
|
</el-button>
|
2022-07-22 17:32:45 +08:00
|
|
|
|
</template>
|
|
|
|
|
|
</el-table-column>
|
|
|
|
|
|
</el-table>
|
|
|
|
|
|
|
|
|
|
|
|
<pagination
|
2023-06-19 17:25:29 +08:00
|
|
|
|
v-show="total > 0"
|
|
|
|
|
|
v-model:limit="queryParams.pageSize"
|
|
|
|
|
|
v-model:page="queryParams.pageNum"
|
|
|
|
|
|
:total="total"
|
|
|
|
|
|
@pagination="getList"
|
2022-07-22 17:32:45 +08:00
|
|
|
|
/>
|
2022-07-28 11:18:53 +08:00
|
|
|
|
|
|
|
|
|
|
<!-- 用户导入对话框 -->
|
|
|
|
|
|
<el-dialog
|
2023-06-19 17:25:29 +08:00
|
|
|
|
v-model="upload.open"
|
|
|
|
|
|
:title="upload.title"
|
|
|
|
|
|
append-to-body
|
|
|
|
|
|
width="400px"
|
2022-07-28 11:18:53 +08:00
|
|
|
|
>
|
|
|
|
|
|
<el-upload
|
2023-06-19 17:25:29 +08:00
|
|
|
|
ref="uploadRef"
|
|
|
|
|
|
:action="upload.url"
|
|
|
|
|
|
:auto-upload="false"
|
|
|
|
|
|
:disabled="upload.isUploading"
|
|
|
|
|
|
:headers="upload.headers"
|
|
|
|
|
|
:limit="1"
|
|
|
|
|
|
:on-progress="handleFileUploadProgress"
|
|
|
|
|
|
:on-success="handleFileSuccess"
|
|
|
|
|
|
accept=".xlsx, .xls"
|
|
|
|
|
|
drag
|
2022-07-28 11:18:53 +08:00
|
|
|
|
>
|
2023-06-09 17:30:58 +08:00
|
|
|
|
<el-icon class="el-icon--upload">
|
2023-06-19 17:25:29 +08:00
|
|
|
|
<upload-filled />
|
2023-06-09 17:30:58 +08:00
|
|
|
|
</el-icon>
|
2022-07-28 11:18:53 +08:00
|
|
|
|
<div class="el-upload__text">将文件拖到此处,或<em>点击上传</em></div>
|
|
|
|
|
|
<template #tip>
|
|
|
|
|
|
<div class="el-upload__tip text-center">
|
|
|
|
|
|
<!-- <div class="el-upload__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>
|
|
|
|
|
|
</template>
|
|
|
|
|
|
</el-upload>
|
|
|
|
|
|
<template #footer>
|
|
|
|
|
|
<div class="dialog-footer">
|
|
|
|
|
|
<el-button type="primary" @click="submitFileForm">确 定</el-button>
|
|
|
|
|
|
<el-button @click="upload.open = false">取 消</el-button>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
</template>
|
|
|
|
|
|
</el-dialog>
|
2022-10-31 17:45:39 +08:00
|
|
|
|
|
|
|
|
|
|
<el-dialog
|
2023-06-19 17:25:29 +08:00
|
|
|
|
v-model="showAssignAccount"
|
|
|
|
|
|
append-to-body
|
|
|
|
|
|
title="分配账号"
|
|
|
|
|
|
width="400px"
|
2022-10-31 17:45:39 +08:00
|
|
|
|
>
|
|
|
|
|
|
<el-form
|
2023-06-19 17:25:29 +08:00
|
|
|
|
ref="assignAccountFormRef"
|
|
|
|
|
|
:model="assignAccountForm"
|
|
|
|
|
|
:rules="assignAccoutRules"
|
|
|
|
|
|
label-width="80px"
|
2022-10-31 17:45:39 +08:00
|
|
|
|
>
|
2023-07-20 14:31:13 +08:00
|
|
|
|
<el-form-item label="手机号" prop="username">
|
|
|
|
|
|
<el-input
|
|
|
|
|
|
v-model="assignAccountForm.username"
|
|
|
|
|
|
:maxlength="11"
|
|
|
|
|
|
></el-input>
|
2022-10-31 17:45:39 +08:00
|
|
|
|
</el-form-item>
|
|
|
|
|
|
<el-form-item label="密码" prop="password">
|
|
|
|
|
|
<el-input
|
2023-06-19 17:25:29 +08:00
|
|
|
|
v-model="assignAccountForm.password"
|
|
|
|
|
|
show-password
|
2022-10-31 17:45:39 +08:00
|
|
|
|
></el-input>
|
|
|
|
|
|
</el-form-item>
|
|
|
|
|
|
</el-form>
|
|
|
|
|
|
<template #footer>
|
|
|
|
|
|
<div class="dialog-footer">
|
|
|
|
|
|
<el-button type="primary" @click="submitAssignAccount"
|
2023-06-19 17:25:29 +08:00
|
|
|
|
>确 定
|
|
|
|
|
|
</el-button>
|
2022-10-31 17:45:39 +08:00
|
|
|
|
<el-button @click="closeAssignAccount">取 消</el-button>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
</template>
|
|
|
|
|
|
</el-dialog>
|
|
|
|
|
|
|
|
|
|
|
|
<el-dialog
|
2023-06-19 17:25:29 +08:00
|
|
|
|
v-model="showResetPassword"
|
|
|
|
|
|
append-to-body
|
|
|
|
|
|
title="重置密码"
|
|
|
|
|
|
width="400px"
|
2022-10-31 17:45:39 +08:00
|
|
|
|
>
|
|
|
|
|
|
<el-form
|
2023-06-19 17:25:29 +08:00
|
|
|
|
ref="resetPasswordFormRef"
|
|
|
|
|
|
:model="resetPasswordForm"
|
|
|
|
|
|
:rules="assignAccoutRules"
|
|
|
|
|
|
label-width="80px"
|
2022-10-31 17:45:39 +08:00
|
|
|
|
>
|
|
|
|
|
|
<el-form-item label="密码" prop="password">
|
|
|
|
|
|
<el-input
|
2023-06-19 17:25:29 +08:00
|
|
|
|
v-model="resetPasswordForm.password"
|
|
|
|
|
|
show-password
|
2022-10-31 17:45:39 +08:00
|
|
|
|
></el-input>
|
|
|
|
|
|
</el-form-item>
|
|
|
|
|
|
</el-form>
|
|
|
|
|
|
<template #footer>
|
|
|
|
|
|
<div class="dialog-footer">
|
|
|
|
|
|
<el-button type="primary" @click="submitResetPassword"
|
2023-06-19 17:25:29 +08:00
|
|
|
|
>确 定
|
|
|
|
|
|
</el-button>
|
2022-10-31 17:45:39 +08:00
|
|
|
|
<el-button @click="closeResetPassword">取 消</el-button>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
</template>
|
|
|
|
|
|
</el-dialog>
|
|
|
|
|
|
|
|
|
|
|
|
<el-dialog
|
2023-06-19 17:25:29 +08:00
|
|
|
|
v-model="showOpenVip"
|
|
|
|
|
|
:title="vipForm.id ? `修改会员` : `开通会员`"
|
|
|
|
|
|
append-to-body
|
|
|
|
|
|
width="400px"
|
2022-10-31 17:45:39 +08:00
|
|
|
|
>
|
|
|
|
|
|
<el-form
|
2023-06-19 17:25:29 +08:00
|
|
|
|
ref="vipFormRef"
|
|
|
|
|
|
:model="vipForm"
|
|
|
|
|
|
:rules="assignAccoutRules"
|
|
|
|
|
|
label-width="80px"
|
2022-10-31 17:45:39 +08:00
|
|
|
|
>
|
|
|
|
|
|
<el-form-item label="会员类型" prop="vipType">
|
|
|
|
|
|
<el-radio-group v-model="vipForm.vipType">
|
2022-11-17 17:30:20 +08:00
|
|
|
|
<el-radio label="0">普通会员</el-radio>
|
2022-10-31 17:45:39 +08:00
|
|
|
|
<el-radio label="1">VIP</el-radio>
|
|
|
|
|
|
<el-radio label="2">SVIP</el-radio>
|
|
|
|
|
|
</el-radio-group>
|
|
|
|
|
|
</el-form-item>
|
2022-11-22 17:31:33 +08:00
|
|
|
|
<el-form-item
|
2023-06-19 17:25:29 +08:00
|
|
|
|
v-if="vipForm.vipType != '0'"
|
|
|
|
|
|
label="到期时间"
|
|
|
|
|
|
prop="expireTime"
|
2022-11-22 17:31:33 +08:00
|
|
|
|
>
|
2022-10-31 17:45:39 +08:00
|
|
|
|
<el-date-picker
|
2023-06-19 17:25:29 +08:00
|
|
|
|
v-model="vipForm.expireTime"
|
|
|
|
|
|
placeholder="选择到期时间"
|
|
|
|
|
|
type="datetime"
|
|
|
|
|
|
value-format="YYYY-MM-DD HH:mm:ss"
|
2022-10-31 17:45:39 +08:00
|
|
|
|
/>
|
|
|
|
|
|
</el-form-item>
|
|
|
|
|
|
</el-form>
|
|
|
|
|
|
<template #footer>
|
|
|
|
|
|
<div class="dialog-footer">
|
2022-11-22 17:31:33 +08:00
|
|
|
|
<el-button
|
2023-06-19 17:25:29 +08:00
|
|
|
|
:disabled="vipForm.vipType == 0"
|
|
|
|
|
|
type="primary"
|
|
|
|
|
|
@click="submitVip"
|
|
|
|
|
|
>确 定
|
|
|
|
|
|
</el-button>
|
2022-10-31 17:45:39 +08:00
|
|
|
|
<el-button @click="closeVip">取 消</el-button>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
</template>
|
|
|
|
|
|
</el-dialog>
|
2022-07-22 17:32:45 +08:00
|
|
|
|
</div>
|
|
|
|
|
|
</template>
|
|
|
|
|
|
|
2023-06-09 17:30:58 +08:00
|
|
|
|
<script name="Enterprise" setup>
|
2022-07-27 16:56:23 +08:00
|
|
|
|
import {
|
2022-10-31 17:45:39 +08:00
|
|
|
|
allocateAccount,
|
2023-06-09 17:30:58 +08:00
|
|
|
|
companyDelete,
|
|
|
|
|
|
companyList,
|
2022-10-31 17:45:39 +08:00
|
|
|
|
getAccount,
|
|
|
|
|
|
getCasVip,
|
2023-06-09 17:30:58 +08:00
|
|
|
|
openCasVip,
|
|
|
|
|
|
restPassword,
|
2022-10-31 17:45:39 +08:00
|
|
|
|
updateCasVip,
|
2022-07-27 16:56:23 +08:00
|
|
|
|
} from "@/api/dataList/enterprise";
|
2022-10-31 17:45:39 +08:00
|
|
|
|
import md5 from "js-md5";
|
2023-06-19 17:25:29 +08:00
|
|
|
|
import { getToken } from "@/utils/auth";
|
2022-11-25 17:30:10 +08:00
|
|
|
|
// import SiteOptions from "@/views/components/SiteOptions";
|
2022-08-30 12:23:19 +08:00
|
|
|
|
// import axios from "axios";
|
2022-07-28 11:18:53 +08:00
|
|
|
|
// import { download } from "@/utils/request";
|
|
|
|
|
|
// import dayjs from "dayjs";
|
2023-06-19 17:25:29 +08:00
|
|
|
|
import { blobValidate } from "@/utils/ruoyi";
|
|
|
|
|
|
import { saveAs } from "file-saver";
|
|
|
|
|
|
import { reactive, ref, toRefs } from "vue";
|
|
|
|
|
|
import { useRouter } from "vue-router";
|
|
|
|
|
|
import { enterpriseOptions } from "@/utils/parameter";
|
|
|
|
|
|
import { ElLoading, ElMessage, ElMessageBox } from "element-plus";
|
2022-07-28 11:18:53 +08:00
|
|
|
|
import request from "@/utils/request";
|
|
|
|
|
|
import dayjs from "dayjs";
|
|
|
|
|
|
|
2022-07-22 17:32:45 +08:00
|
|
|
|
const router = useRouter();
|
|
|
|
|
|
const data = reactive({
|
|
|
|
|
|
queryParams: {
|
|
|
|
|
|
pageNum: 1,
|
2022-10-31 17:45:39 +08:00
|
|
|
|
pageSize: 10,
|
2023-06-09 17:30:58 +08:00
|
|
|
|
// examine_status: 2,
|
2022-07-22 17:32:45 +08:00
|
|
|
|
name: undefined,
|
2023-06-09 17:30:58 +08:00
|
|
|
|
// tenantId: undefined,
|
2022-07-22 17:32:45 +08:00
|
|
|
|
},
|
|
|
|
|
|
});
|
2022-07-28 11:18:53 +08:00
|
|
|
|
|
|
|
|
|
|
/*** 用户导入参数 */
|
|
|
|
|
|
const upload = reactive({
|
|
|
|
|
|
// 是否显示弹出层(用户导入)
|
|
|
|
|
|
open: false,
|
|
|
|
|
|
// 弹出层标题(用户导入)
|
|
|
|
|
|
title: "",
|
|
|
|
|
|
// 是否禁用上传
|
|
|
|
|
|
isUploading: false,
|
|
|
|
|
|
// 是否更新已经存在的用户数据
|
|
|
|
|
|
// updateSupport: 0,
|
|
|
|
|
|
// 设置上传的请求头部
|
2023-06-19 17:25:29 +08:00
|
|
|
|
headers: { Authorization: "Bearer " + getToken() },
|
2022-07-28 11:18:53 +08:00
|
|
|
|
// 上传的地址
|
|
|
|
|
|
url: import.meta.env.VITE_APP_BASE_API + "/business/enterprise/importData",
|
|
|
|
|
|
});
|
|
|
|
|
|
|
2023-06-19 17:25:29 +08:00
|
|
|
|
const { queryParams } = toRefs(data);
|
2022-07-22 17:32:45 +08:00
|
|
|
|
const showSearch = ref(true);
|
2022-11-25 17:30:10 +08:00
|
|
|
|
// const siteList = ref([]);
|
2022-07-22 17:32:45 +08:00
|
|
|
|
const loading = ref(true);
|
|
|
|
|
|
const total = ref(0);
|
|
|
|
|
|
const dataList = ref([]);
|
|
|
|
|
|
|
2022-12-05 15:58:30 +08:00
|
|
|
|
const ids = ref([]);
|
|
|
|
|
|
const handleSelectionChange = (selection) => {
|
|
|
|
|
|
ids.value = selection.map((el) => el.id);
|
|
|
|
|
|
};
|
|
|
|
|
|
|
2022-07-22 17:32:45 +08:00
|
|
|
|
/** 查询企业列表 */
|
|
|
|
|
|
const getList = async () => {
|
|
|
|
|
|
loading.value = true;
|
|
|
|
|
|
const resp = await companyList(queryParams.value);
|
|
|
|
|
|
dataList.value = resp.rows;
|
|
|
|
|
|
total.value = resp.total;
|
|
|
|
|
|
loading.value = false;
|
|
|
|
|
|
};
|
|
|
|
|
|
// 获取站点列表
|
2022-11-25 17:30:10 +08:00
|
|
|
|
// const getSiteList = async () => {
|
|
|
|
|
|
// const resp = await tenantSelect();
|
|
|
|
|
|
// siteList.value = resp.rows;
|
|
|
|
|
|
// };
|
2022-07-22 17:32:45 +08:00
|
|
|
|
/** 搜索按钮操作 */
|
|
|
|
|
|
const handleQuery = () => {
|
|
|
|
|
|
queryParams.value.pageNum = 1;
|
|
|
|
|
|
getList();
|
|
|
|
|
|
};
|
2022-10-31 17:45:39 +08:00
|
|
|
|
|
|
|
|
|
|
const assignAccoutRules = {
|
2023-07-20 14:31:13 +08:00
|
|
|
|
username: [
|
|
|
|
|
|
{ required: true, message: "请输入手机号", trigger: "blur" },
|
|
|
|
|
|
{
|
|
|
|
|
|
pattern: /^1[3-9]\d{9}$/,
|
|
|
|
|
|
message: "请输入正确的手机号码",
|
|
|
|
|
|
trigger: "blur",
|
|
|
|
|
|
},
|
|
|
|
|
|
],
|
2023-06-19 17:25:29 +08:00
|
|
|
|
password: [{ required: true, message: "请输入密码", trigger: "blur" }],
|
|
|
|
|
|
vipType: [{ required: true, message: "请选择会员类型", trigger: "change" }],
|
2022-10-31 17:45:39 +08:00
|
|
|
|
expireTime: [
|
2023-06-19 17:25:29 +08:00
|
|
|
|
{ required: true, message: "请选择到期时间", trigger: "change" },
|
2022-10-31 17:45:39 +08:00
|
|
|
|
],
|
|
|
|
|
|
};
|
|
|
|
|
|
const showAssignAccount = ref(false);
|
|
|
|
|
|
const assignAccountForm = reactive({
|
|
|
|
|
|
username: undefined,
|
|
|
|
|
|
password: undefined,
|
|
|
|
|
|
});
|
|
|
|
|
|
const assignAccountFormRef = ref();
|
|
|
|
|
|
const resetPasswordForm = reactive({
|
|
|
|
|
|
password: undefined,
|
|
|
|
|
|
});
|
|
|
|
|
|
const resetPasswordFormRef = ref();
|
|
|
|
|
|
const showResetPassword = ref(false);
|
|
|
|
|
|
|
|
|
|
|
|
const openAssignAccount = async (id) => {
|
|
|
|
|
|
resetForm();
|
2023-06-19 17:25:29 +08:00
|
|
|
|
const { have, data } = await getAccount(id);
|
2022-10-31 17:45:39 +08:00
|
|
|
|
if (have) {
|
|
|
|
|
|
ElMessageBox.alert(`已经存在账号:${data}`, "账号已经存在");
|
|
|
|
|
|
} else {
|
|
|
|
|
|
assignAccountForm.id = id;
|
|
|
|
|
|
showAssignAccount.value = true;
|
|
|
|
|
|
}
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
const openResetPassword = async (id) => {
|
|
|
|
|
|
resetForm();
|
2023-06-19 17:25:29 +08:00
|
|
|
|
const { have, userId } = await getAccount(id);
|
2022-10-31 17:45:39 +08:00
|
|
|
|
if (have) {
|
2023-06-09 17:30:58 +08:00
|
|
|
|
resetPasswordForm.id = userId;
|
2022-10-31 17:45:39 +08:00
|
|
|
|
showResetPassword.value = true;
|
|
|
|
|
|
} else {
|
|
|
|
|
|
ElMessageBox.alert(`尚未分配账号,请先分配账号`, "尚未分配账号");
|
|
|
|
|
|
}
|
|
|
|
|
|
};
|
|
|
|
|
|
const resetForm = () => {
|
|
|
|
|
|
if (resetPasswordFormRef.value) {
|
|
|
|
|
|
resetPasswordFormRef.value.resetFields();
|
|
|
|
|
|
}
|
|
|
|
|
|
if (assignAccountFormRef.value) {
|
|
|
|
|
|
assignAccountFormRef.value.resetFields();
|
|
|
|
|
|
}
|
|
|
|
|
|
resetPasswordForm.password = undefined;
|
|
|
|
|
|
assignAccountForm.username = undefined;
|
|
|
|
|
|
assignAccountForm.password = undefined;
|
|
|
|
|
|
};
|
|
|
|
|
|
const closeResetPassword = () => {
|
|
|
|
|
|
resetForm();
|
|
|
|
|
|
showResetPassword.value = false;
|
|
|
|
|
|
};
|
|
|
|
|
|
const closeAssignAccount = () => {
|
|
|
|
|
|
resetForm();
|
|
|
|
|
|
showAssignAccount.value = false;
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
const submitAssignAccount = async () => {
|
|
|
|
|
|
await assignAccountFormRef.value.validate();
|
|
|
|
|
|
await allocateAccount({
|
|
|
|
|
|
...assignAccountForm,
|
|
|
|
|
|
password: md5(assignAccountForm.password),
|
|
|
|
|
|
});
|
|
|
|
|
|
ElMessage.success("账号分配成功");
|
|
|
|
|
|
showAssignAccount.value = false;
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
const submitResetPassword = async () => {
|
|
|
|
|
|
await resetPasswordFormRef.value.validate();
|
|
|
|
|
|
await restPassword(resetPasswordForm.id, md5(resetPasswordForm.password));
|
|
|
|
|
|
ElMessage.success("密码重置成功");
|
|
|
|
|
|
showResetPassword.value = false;
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
//TODO:
|
|
|
|
|
|
/** 开通vip操作 */
|
|
|
|
|
|
const vipData = reactive({
|
2023-06-19 17:25:29 +08:00
|
|
|
|
vipForm: { userType: "1" },
|
2022-10-31 17:45:39 +08:00
|
|
|
|
});
|
2023-06-19 17:25:29 +08:00
|
|
|
|
const { vipForm } = toRefs(vipData);
|
2022-10-31 17:45:39 +08:00
|
|
|
|
const showOpenVip = ref(false);
|
|
|
|
|
|
const vipFormRef = ref();
|
|
|
|
|
|
|
|
|
|
|
|
const handleOpenVip = async (id) => {
|
|
|
|
|
|
resetVipForm();
|
2023-06-19 17:25:29 +08:00
|
|
|
|
const { have, userId } = await getAccount(id);
|
2022-10-31 17:45:39 +08:00
|
|
|
|
if (have) {
|
|
|
|
|
|
const resp = await getCasVip(userId);
|
|
|
|
|
|
if (resp.have) {
|
|
|
|
|
|
vipForm.value = resp.data;
|
|
|
|
|
|
showOpenVip.value = true;
|
|
|
|
|
|
} else {
|
|
|
|
|
|
vipForm.value.userId = userId;
|
2022-11-22 17:31:33 +08:00
|
|
|
|
vipForm.value.vipType = "0";
|
2022-10-31 17:45:39 +08:00
|
|
|
|
showOpenVip.value = true;
|
|
|
|
|
|
}
|
|
|
|
|
|
} else {
|
|
|
|
|
|
ElMessageBox.alert(`尚未分配账号,请先分配账号`, "尚未分配账号");
|
|
|
|
|
|
}
|
|
|
|
|
|
};
|
2022-11-22 17:31:33 +08:00
|
|
|
|
|
2022-10-31 17:45:39 +08:00
|
|
|
|
const submitVip = async () => {
|
|
|
|
|
|
await vipFormRef.value.validate();
|
|
|
|
|
|
if (vipForm.value.id) {
|
|
|
|
|
|
await updateCasVip(vipForm.value);
|
|
|
|
|
|
ElMessage.success("会员修改成功");
|
|
|
|
|
|
} else {
|
|
|
|
|
|
await openCasVip(vipForm.value);
|
|
|
|
|
|
ElMessage.success("会员开通成功");
|
|
|
|
|
|
}
|
|
|
|
|
|
showOpenVip.value = false;
|
|
|
|
|
|
};
|
2022-11-22 17:31:33 +08:00
|
|
|
|
|
2022-10-31 17:45:39 +08:00
|
|
|
|
const resetVipForm = () => {
|
2023-06-19 17:25:29 +08:00
|
|
|
|
vipForm.value = { userType: "1" };
|
2022-10-31 17:45:39 +08:00
|
|
|
|
if (vipFormRef.value) {
|
|
|
|
|
|
vipFormRef.value.resetFields();
|
|
|
|
|
|
}
|
|
|
|
|
|
};
|
2022-11-22 17:31:33 +08:00
|
|
|
|
|
2022-10-31 17:45:39 +08:00
|
|
|
|
const closeVip = () => {
|
|
|
|
|
|
resetVipForm();
|
|
|
|
|
|
showOpenVip.value = false;
|
|
|
|
|
|
};
|
2022-07-22 17:32:45 +08:00
|
|
|
|
/** 重置按钮操作 */
|
|
|
|
|
|
const resetQuery = () => {
|
|
|
|
|
|
dateRange.value = [];
|
|
|
|
|
|
if (queryFormRef.value) {
|
|
|
|
|
|
queryFormRef.value.resetFields();
|
|
|
|
|
|
}
|
|
|
|
|
|
handleQuery();
|
|
|
|
|
|
};
|
|
|
|
|
|
const handleAdd = () => {
|
|
|
|
|
|
router.push({
|
|
|
|
|
|
path: "/dataList/enterprise/add",
|
|
|
|
|
|
});
|
|
|
|
|
|
};
|
|
|
|
|
|
const handleDetail = (id) => {
|
|
|
|
|
|
router.push({
|
2022-07-26 14:35:21 +08:00
|
|
|
|
path: "/dataList/enterprise/add",
|
2023-06-19 17:25:29 +08:00
|
|
|
|
query: { id },
|
2022-07-22 17:32:45 +08:00
|
|
|
|
});
|
|
|
|
|
|
};
|
2022-07-28 11:18:53 +08:00
|
|
|
|
const uploadRef = ref(null);
|
2023-06-09 17:30:58 +08:00
|
|
|
|
|
2022-07-28 11:18:53 +08:00
|
|
|
|
/** 导入按钮操作 */
|
|
|
|
|
|
function handleImport() {
|
|
|
|
|
|
upload.title = "用户导入";
|
|
|
|
|
|
upload.open = true;
|
|
|
|
|
|
}
|
2023-06-09 17:30:58 +08:00
|
|
|
|
|
2022-07-28 11:18:53 +08:00
|
|
|
|
/** 下载模板操作 */
|
|
|
|
|
|
function importTemplate() {
|
|
|
|
|
|
proxy.download(
|
2023-06-19 17:25:29 +08:00
|
|
|
|
"system/user/importTemplate",
|
|
|
|
|
|
{},
|
|
|
|
|
|
`user_template_${new Date().getTime()}.xlsx`
|
2022-07-28 11:18:53 +08:00
|
|
|
|
);
|
|
|
|
|
|
}
|
2023-06-09 17:30:58 +08:00
|
|
|
|
|
2022-07-28 11:18:53 +08:00
|
|
|
|
/**文件上传中处理 */
|
|
|
|
|
|
const handleFileUploadProgress = (event, file, fileList) => {
|
|
|
|
|
|
upload.isUploading = true;
|
|
|
|
|
|
};
|
|
|
|
|
|
/** 文件上传成功处理 */
|
|
|
|
|
|
const handleFileSuccess = (response, file, fileList) => {
|
|
|
|
|
|
upload.open = false;
|
|
|
|
|
|
upload.isUploading = false;
|
|
|
|
|
|
uploadRef.value.handleRemove(file);
|
|
|
|
|
|
ElMessageBox.alert(
|
2023-06-19 17:25:29 +08:00
|
|
|
|
"<div style='overflow: auto;overflow-x: hidden;max-height: 70vh;padding: 10px 20px 0;'>" +
|
2022-07-28 11:18:53 +08:00
|
|
|
|
response.msg +
|
|
|
|
|
|
"</div>",
|
2023-06-19 17:25:29 +08:00
|
|
|
|
"导入结果",
|
|
|
|
|
|
{ dangerouslyUseHTMLString: true }
|
2022-07-28 11:18:53 +08:00
|
|
|
|
);
|
|
|
|
|
|
getList();
|
|
|
|
|
|
};
|
2022-10-31 17:45:39 +08:00
|
|
|
|
|
2022-07-28 11:18:53 +08:00
|
|
|
|
/** 提交上传文件 */
|
|
|
|
|
|
function submitFileForm() {
|
|
|
|
|
|
uploadRef.value.submit();
|
|
|
|
|
|
}
|
2023-06-09 17:30:58 +08:00
|
|
|
|
|
2022-07-27 16:56:23 +08:00
|
|
|
|
const handleDelete = async (id) => {
|
2022-12-05 15:58:30 +08:00
|
|
|
|
const delIds = id || ids.value.join(",");
|
|
|
|
|
|
ElMessageBox.confirm(`是否确认删除编号为${delIds}的数据项?`)
|
2023-06-19 17:25:29 +08:00
|
|
|
|
.then(async () => {
|
|
|
|
|
|
await companyDelete(delIds);
|
|
|
|
|
|
getList();
|
|
|
|
|
|
ElMessage.success("删除成功");
|
|
|
|
|
|
})
|
|
|
|
|
|
.catch(() => {});
|
2022-07-27 16:56:23 +08:00
|
|
|
|
};
|
2022-07-28 11:18:53 +08:00
|
|
|
|
|
|
|
|
|
|
let downloadLoadingInstance;
|
|
|
|
|
|
const download = (url, filename) => {
|
|
|
|
|
|
downloadLoadingInstance = ElLoading.service({
|
|
|
|
|
|
text: "正在下载数据,请稍候",
|
|
|
|
|
|
background: "rgba(0, 0, 0, 0.7)",
|
|
|
|
|
|
});
|
|
|
|
|
|
return request
|
2023-06-19 17:25:29 +08:00
|
|
|
|
.get(url, {
|
|
|
|
|
|
// transformRequest: [
|
|
|
|
|
|
// (params) => {
|
|
|
|
|
|
// return tansParams(params);
|
|
|
|
|
|
// },
|
|
|
|
|
|
// ],
|
|
|
|
|
|
headers: { "Content-Type": "application/x-www-form-urlencoded" },
|
|
|
|
|
|
responseType: "blob",
|
|
|
|
|
|
})
|
|
|
|
|
|
.then(async (data) => {
|
|
|
|
|
|
const isLogin = await blobValidate(data);
|
|
|
|
|
|
if (isLogin) {
|
|
|
|
|
|
const blob = new Blob([data]);
|
|
|
|
|
|
saveAs(blob, filename);
|
|
|
|
|
|
} else {
|
|
|
|
|
|
const resText = await data.text();
|
|
|
|
|
|
const rspObj = JSON.parse(resText);
|
|
|
|
|
|
const errMsg =
|
|
|
|
|
|
errorCode[rspObj.code] || rspObj.msg || errorCode["default"];
|
|
|
|
|
|
ElMessage.error(errMsg);
|
|
|
|
|
|
}
|
|
|
|
|
|
downloadLoadingInstance.close();
|
|
|
|
|
|
})
|
|
|
|
|
|
.catch((r) => {
|
|
|
|
|
|
console.error(r);
|
|
|
|
|
|
ElMessage.error("下载文件出现错误,请联系管理员!");
|
|
|
|
|
|
downloadLoadingInstance.close();
|
|
|
|
|
|
});
|
2022-07-28 11:18:53 +08:00
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
const handleExport = () => {
|
|
|
|
|
|
ElMessageBox.confirm(`是否确认企业列表?`).then(() => {
|
|
|
|
|
|
download(
|
2023-06-19 17:25:29 +08:00
|
|
|
|
`/business/enterprise/export`,
|
|
|
|
|
|
`企业信息(${dayjs().format("YYYYMMDDHHmmss")}).xlsx`
|
2022-07-28 11:18:53 +08:00
|
|
|
|
);
|
|
|
|
|
|
});
|
2022-07-22 17:32:45 +08:00
|
|
|
|
};
|
|
|
|
|
|
getList();
|
2022-11-25 17:30:10 +08:00
|
|
|
|
// getSiteList();
|
2022-07-22 17:32:45 +08:00
|
|
|
|
</script>
|