|
@@ -1,101 +1,150 @@
|
|
|
<!-- @Author: Antigravity -->
|
|
<!-- @Author: Antigravity -->
|
|
|
<template>
|
|
<template>
|
|
|
- <div class="p-2">
|
|
|
|
|
- <transition :enter-active-class="proxy?.animate.searchAnimate.enter"
|
|
|
|
|
- :leave-active-class="proxy?.animate.searchAnimate.leave">
|
|
|
|
|
- <div v-show="showSearch" class="search">
|
|
|
|
|
- <el-form ref="queryFormRef" :model="queryParams" :inline="true" label-width="85px">
|
|
|
|
|
- <el-form-item label="用户名" prop="userName">
|
|
|
|
|
- <el-input v-model="queryParams.userName" placeholder="请输入用户名" clearable
|
|
|
|
|
- @keyup.enter="handleQuery" />
|
|
|
|
|
- </el-form-item>
|
|
|
|
|
- <el-form-item label="手机号" prop="phone">
|
|
|
|
|
- <el-input v-model="queryParams.phone" placeholder="请输入手机号" clearable
|
|
|
|
|
- @keyup.enter="handleQuery" />
|
|
|
|
|
- </el-form-item>
|
|
|
|
|
- <el-form-item>
|
|
|
|
|
- <el-button type="primary" icon="Search" @click="handleQuery">搜索</el-button>
|
|
|
|
|
- <el-button icon="Refresh" @click="resetQuery">重置</el-button>
|
|
|
|
|
- </el-form-item>
|
|
|
|
|
- </el-form>
|
|
|
|
|
|
|
+ <div class="p-2">
|
|
|
|
|
+ <transition :enter-active-class="proxy?.animate.searchAnimate.enter"
|
|
|
|
|
+ :leave-active-class="proxy?.animate.searchAnimate.leave">
|
|
|
|
|
+ <div v-show="showSearch" class="search">
|
|
|
|
|
+ <el-form ref="queryFormRef" :model="queryParams" :inline="true" label-width="85px">
|
|
|
|
|
+ <el-form-item label="用户名" prop="userName">
|
|
|
|
|
+ <el-input v-model="queryParams.userName" placeholder="请输入用户名" clearable @keyup.enter="handleQuery" />
|
|
|
|
|
+ </el-form-item>
|
|
|
|
|
+ <el-form-item label="手机号" prop="phone">
|
|
|
|
|
+ <el-input v-model="queryParams.phone" placeholder="请输入手机号" clearable @keyup.enter="handleQuery" />
|
|
|
|
|
+ </el-form-item>
|
|
|
|
|
+ <el-form-item>
|
|
|
|
|
+ <el-button type="primary" icon="Search" @click="handleQuery">搜索</el-button>
|
|
|
|
|
+ <el-button icon="Refresh" @click="resetQuery">重置</el-button>
|
|
|
|
|
+ </el-form-item>
|
|
|
|
|
+ </el-form>
|
|
|
|
|
+ </div>
|
|
|
|
|
+ </transition>
|
|
|
|
|
+
|
|
|
|
|
+ <el-card shadow="never">
|
|
|
|
|
+ <template #header>
|
|
|
|
|
+ <el-row :gutter="10" class="mb8">
|
|
|
|
|
+ <right-toolbar v-model:show-search="showSearch" @query-table="getList"></right-toolbar>
|
|
|
|
|
+ </el-row>
|
|
|
|
|
+ </template>
|
|
|
|
|
+
|
|
|
|
|
+ <el-table v-loading="loading" :data="customerList" border @selection-change="handleSelectionChange">
|
|
|
|
|
+ <el-table-column type="selection" width="55" align="center" />
|
|
|
|
|
+ <el-table-column label="序号" align="center" width="70" type="index" />
|
|
|
|
|
+ <el-table-column label="昵称" align="center" prop="userName" min-width="120" />
|
|
|
|
|
+ <el-table-column label="头像" align="center" width="80">
|
|
|
|
|
+ <template #default="scope">
|
|
|
|
|
+ <el-avatar :size="36" :src="scope.row.avatarUrl" icon="UserFilled" />
|
|
|
|
|
+ </template>
|
|
|
|
|
+ </el-table-column>
|
|
|
|
|
+ <el-table-column label="手机" align="center" prop="phone" width="140" />
|
|
|
|
|
+ <el-table-column label="注册时间" align="center" prop="createTime" width="170" />
|
|
|
|
|
+ <el-table-column label="状态" align="center" width="100">
|
|
|
|
|
+ <template #default="scope">
|
|
|
|
|
+ <el-switch v-if="checkPermi(['customer:customer:changeStatus'])" v-model="scope.row._statusActive"
|
|
|
|
|
+ :loading="scope.row._statusLoading" inline-prompt @change="handleStatusChange(scope.row)" />
|
|
|
|
|
+ <el-tag v-else :type="scope.row.status === '0' ? 'danger' : 'success'">
|
|
|
|
|
+ {{ scope.row.status === '0' ? '禁用' : '启用' }}
|
|
|
|
|
+ </el-tag>
|
|
|
|
|
+ </template>
|
|
|
|
|
+ </el-table-column>
|
|
|
|
|
+ <el-table-column label="操作" align="center" class-name="small-padding fixed-width" width="160">
|
|
|
|
|
+ <template #default="scope">
|
|
|
|
|
+ <el-button v-hasPermi="['customer:customer:auth']" link type="success" icon="User"
|
|
|
|
|
+ @click="handleAuth(scope.row)">授权</el-button>
|
|
|
|
|
+ <el-button v-hasPermi="['customer:customer:query']" link type="primary" icon="View"
|
|
|
|
|
+ @click="handleDetail(scope.row)">详情</el-button>
|
|
|
|
|
+ </template>
|
|
|
|
|
+ </el-table-column>
|
|
|
|
|
+ </el-table>
|
|
|
|
|
+
|
|
|
|
|
+ <pagination v-show="total > 0" :total="total" v-model:page="queryParams.pageNum"
|
|
|
|
|
+ v-model:limit="queryParams.pageSize" @pagination="getList" />
|
|
|
|
|
+ </el-card>
|
|
|
|
|
+
|
|
|
|
|
+ <!-- 授权客户对话框(支持多选) -->
|
|
|
|
|
+ <el-dialog v-model="authDialog.visible" title="授权客户" width="900px" append-to-body>
|
|
|
|
|
+ <el-form :model="erpQueryParams" ref="erpQueryFormRef" :inline="true" label-width="68px">
|
|
|
|
|
+ <el-form-item label="客户名称" prop="name">
|
|
|
|
|
+ <el-input v-model="erpQueryParams.name" placeholder="请输入客户名称" clearable style="width: 240px"
|
|
|
|
|
+ @keyup.enter="getErpList" />
|
|
|
|
|
+ </el-form-item>
|
|
|
|
|
+ <el-form-item>
|
|
|
|
|
+ <el-button type="primary" icon="Search" @click="getErpList">搜索</el-button>
|
|
|
|
|
+ <el-button icon="Refresh" @click="resetErpQuery">重置</el-button>
|
|
|
|
|
+ </el-form-item>
|
|
|
|
|
+ </el-form>
|
|
|
|
|
+ <el-table v-loading="erpLoading" :data="erpList" @selection-change="handleErpSelectionChange" ref="erpTableRef">
|
|
|
|
|
+ <el-table-column type="selection" width="50" align="center" />
|
|
|
|
|
+ <el-table-column label="代码" align="center" prop="num" width="100"
|
|
|
|
|
+ :formatter="(row: ErpClientVO) => row.num || '-'" />
|
|
|
|
|
+ <el-table-column label="名称" align="left" prop="name" min-width="180" :show-overflow-tooltip="true"
|
|
|
|
|
+ :formatter="(row: ErpClientVO) => row.name || '-'" />
|
|
|
|
|
+ <el-table-column label="客户类型" align="center" prop="clientClass" width="100"
|
|
|
|
|
+ :formatter="(row: ErpClientVO) => row.clientClass || '-'" />
|
|
|
|
|
+ <el-table-column label="加入名称" align="center" prop="enterName" width="100"
|
|
|
|
|
+ :formatter="(row: ErpClientVO) => row.enterName || '-'" />
|
|
|
|
|
+ <el-table-column label="加入时间" align="center" prop="enterDate" width="170"
|
|
|
|
|
+ :formatter="(row: ErpClientVO) => row.enterDate || '-'" />
|
|
|
|
|
+ </el-table>
|
|
|
|
|
+ <pagination v-show="erpTotal > 0" v-model:page="erpQueryParams.pageNum" v-model:limit="erpQueryParams.pageSize"
|
|
|
|
|
+ :total="erpTotal" layout="total, prev, pager, next" @pagination="getErpList" />
|
|
|
|
|
+ <template #footer>
|
|
|
|
|
+ <div class="dialog-footer">
|
|
|
|
|
+ <el-button :loading="buttonLoading" type="primary" icon="Check" @click="confirmAuth">确 定</el-button>
|
|
|
|
|
+ <el-button icon="Close" @click="authDialog.visible = false">取 消</el-button>
|
|
|
|
|
+ </div>
|
|
|
|
|
+ </template>
|
|
|
|
|
+ </el-dialog>
|
|
|
|
|
+
|
|
|
|
|
+ <!-- 客户详情对话框 -->
|
|
|
|
|
+ <el-dialog v-model="detailDialog.visible" title="客户详情" width="680px" append-to-body>
|
|
|
|
|
+ <template v-if="detailDialog.data">
|
|
|
|
|
+ <div class="detail-header">
|
|
|
|
|
+ <el-avatar :size="72" :src="detailDialog.data.avatarUrl" icon="UserFilled" class="detail-avatar" />
|
|
|
|
|
+ <div class="detail-name-box">
|
|
|
|
|
+ <text class="detail-name">{{ detailDialog.data.userName }}</text>
|
|
|
|
|
+ <el-tag :type="detailDialog.data.status === '0' ? 'danger' : 'success'" size="small"
|
|
|
|
|
+ class="detail-status-tag">
|
|
|
|
|
+ {{ detailDialog.data.status === '0' ? '已禁用' : '已启用' }}
|
|
|
|
|
+ </el-tag>
|
|
|
|
|
+ </div>
|
|
|
|
|
+ </div>
|
|
|
|
|
+ <div class="detail-divider"></div>
|
|
|
|
|
+ <el-descriptions :column="2" border size="small" class="detail-descriptions">
|
|
|
|
|
+ <el-descriptions-item label="客户ID">{{ detailDialog.data.id }}</el-descriptions-item>
|
|
|
|
|
+ <el-descriptions-item label="手机号">{{ detailDialog.data.phone || '-' }}</el-descriptions-item>
|
|
|
|
|
+ <el-descriptions-item label="微信OpenID">{{ detailDialog.data.wechatOpenid || '-' }}</el-descriptions-item>
|
|
|
|
|
+ <el-descriptions-item label="微信UnionID">{{ detailDialog.data.wechatUnionid || '-' }}</el-descriptions-item>
|
|
|
|
|
+ <el-descriptions-item label="注册时间">{{ detailDialog.data.createTime }}</el-descriptions-item>
|
|
|
|
|
+ </el-descriptions>
|
|
|
|
|
+
|
|
|
|
|
+ <div class="section-title">授权客户</div>
|
|
|
|
|
+ <div v-if="detailDialog.data.authClientList && detailDialog.data.authClientList.length > 0">
|
|
|
|
|
+ <div class="auth-client-card" v-for="(client, idx) in detailDialog.data.authClientList" :key="idx">
|
|
|
|
|
+ <span class="client-index">{{ idx + 1 }}</span>
|
|
|
|
|
+ <div class="client-info">
|
|
|
|
|
+ <div class="client-row"><span class="client-label">名称</span><span class="client-value">{{ client.name
|
|
|
|
|
+ }}</span></div>
|
|
|
|
|
+ <div class="client-row"><span class="client-label">类型</span><span class="client-value">{{
|
|
|
|
|
+ client.clientClass || '-' }}</span></div>
|
|
|
|
|
+ <div class="client-row"><span class="client-label">加入时间</span><span class="client-value">{{
|
|
|
|
|
+ client.enterDate || '-' }}</span></div>
|
|
|
</div>
|
|
</div>
|
|
|
- </transition>
|
|
|
|
|
-
|
|
|
|
|
- <el-card shadow="never">
|
|
|
|
|
- <template #header>
|
|
|
|
|
- <el-row :gutter="10" class="mb8">
|
|
|
|
|
- <right-toolbar v-model:show-search="showSearch" @query-table="getList"></right-toolbar>
|
|
|
|
|
- </el-row>
|
|
|
|
|
- </template>
|
|
|
|
|
-
|
|
|
|
|
- <el-table v-loading="loading" :data="customerList" border @selection-change="handleSelectionChange">
|
|
|
|
|
- <el-table-column type="selection" width="55" align="center" />
|
|
|
|
|
- <el-table-column label="头像" align="center" width="80">
|
|
|
|
|
- <template #default="scope">
|
|
|
|
|
- <el-avatar :size="36" :src="scope.row.avatarUrl" icon="UserFilled" />
|
|
|
|
|
- </template>
|
|
|
|
|
- </el-table-column>
|
|
|
|
|
- <el-table-column label="用户名" align="center" prop="userName" />
|
|
|
|
|
- <el-table-column label="手机号" align="center" prop="phone" />
|
|
|
|
|
- <el-table-column label="注册时间" align="center" prop="createTime" width="160" />
|
|
|
|
|
- <el-table-column label="授权客户名称" align="center" prop="authClientName" :show-overflow-tooltip="true" />
|
|
|
|
|
- <el-table-column label="授权客户类型" align="center" prop="authClientClass" width="120" />
|
|
|
|
|
- <el-table-column label="授权加入时间" align="center" prop="authClientEnterDate" width="160" />
|
|
|
|
|
- <el-table-column label="操作" align="center" class-name="small-padding fixed-width" width="100">
|
|
|
|
|
- <template #default="scope">
|
|
|
|
|
- <el-button v-hasPermi="['customer:customer:auth']" link type="success" icon="User"
|
|
|
|
|
- @click="handleAuth(scope.row)">授权</el-button>
|
|
|
|
|
- </template>
|
|
|
|
|
- </el-table-column>
|
|
|
|
|
- </el-table>
|
|
|
|
|
-
|
|
|
|
|
- <pagination v-show="total > 0" v-model:page="queryParams.pageNum" v-model:limit="queryParams.pageSize"
|
|
|
|
|
- :total="total" @pagination="getList" />
|
|
|
|
|
- </el-card>
|
|
|
|
|
-
|
|
|
|
|
- <!-- 授权客户对话框 -->
|
|
|
|
|
- <el-dialog v-model="authDialog.visible" title="授权客户" width="900px" append-to-body>
|
|
|
|
|
- <el-form :model="erpQueryParams" ref="erpQueryFormRef" :inline="true" label-width="68px">
|
|
|
|
|
- <el-form-item label="客户名称" prop="name">
|
|
|
|
|
- <el-input v-model="erpQueryParams.name" placeholder="请输入客户名称" clearable style="width: 240px"
|
|
|
|
|
- @keyup.enter="getErpList" />
|
|
|
|
|
- </el-form-item>
|
|
|
|
|
- <el-form-item>
|
|
|
|
|
- <el-button type="primary" icon="Search" @click="getErpList">搜索</el-button>
|
|
|
|
|
- <el-button icon="Refresh" @click="resetErpQuery">重置</el-button>
|
|
|
|
|
- </el-form-item>
|
|
|
|
|
- </el-form>
|
|
|
|
|
- <el-table v-loading="erpLoading" :data="erpList" highlight-current-row
|
|
|
|
|
- @current-change="handleErpCurrentChange">
|
|
|
|
|
- <el-table-column label="代码" align="center" prop="num" width="100"
|
|
|
|
|
- :formatter="(row: ErpClientVO) => row.num || '-'" />
|
|
|
|
|
- <el-table-column label="名称" align="left" prop="name" min-width="180" :show-overflow-tooltip="true"
|
|
|
|
|
- :formatter="(row: ErpClientVO) => row.name || '-'" />
|
|
|
|
|
- <el-table-column label="客户类型" align="center" prop="clientClass" width="100"
|
|
|
|
|
- :formatter="(row: ErpClientVO) => row.clientClass || '-'" />
|
|
|
|
|
- <el-table-column label="加入名称" align="center" prop="enterName" width="100"
|
|
|
|
|
- :formatter="(row: ErpClientVO) => row.enterName || '-'" />
|
|
|
|
|
- <el-table-column label="加入时间" align="center" prop="enterDate" width="170"
|
|
|
|
|
- :formatter="(row: ErpClientVO) => row.enterDate || '-'" />
|
|
|
|
|
- </el-table>
|
|
|
|
|
- <pagination v-show="erpTotal > 0" v-model:page="erpQueryParams.pageNum"
|
|
|
|
|
- v-model:limit="erpQueryParams.pageSize" :total="erpTotal" layout="total, prev, pager, next"
|
|
|
|
|
- @pagination="getErpList" />
|
|
|
|
|
- <template #footer>
|
|
|
|
|
- <div class="dialog-footer">
|
|
|
|
|
- <el-button :loading="buttonLoading" type="primary" icon="Check" @click="confirmAuth">确 定</el-button>
|
|
|
|
|
- <el-button icon="Close" @click="authDialog.visible = false">取 消</el-button>
|
|
|
|
|
- </div>
|
|
|
|
|
- </template>
|
|
|
|
|
- </el-dialog>
|
|
|
|
|
- </div>
|
|
|
|
|
|
|
+ </div>
|
|
|
|
|
+ </div>
|
|
|
|
|
+ <el-empty v-else description="暂无授权客户" :image-size="60" />
|
|
|
|
|
+ </template>
|
|
|
|
|
+ </el-dialog>
|
|
|
|
|
+ </div>
|
|
|
</template>
|
|
</template>
|
|
|
|
|
|
|
|
<script setup name="Customer" lang="ts">
|
|
<script setup name="Customer" lang="ts">
|
|
|
-import { listCustomer, getCustomer, authCustomer } from '@/api/system/customer';
|
|
|
|
|
-import { CustomerVO, CustomerQuery, CustomerForm } from '@/api/system/customer/types';
|
|
|
|
|
|
|
+import { listCustomer, getCustomerDetail, authCustomer, changeCustomerStatus } from '@/api/system/customer';
|
|
|
|
|
+import { CustomerVO, CustomerQuery, CustomerForm, ErpClientBriefVO } from '@/api/system/customer/types';
|
|
|
import { listErpClient } from '@/api/erp/client';
|
|
import { listErpClient } from '@/api/erp/client';
|
|
|
import { ErpClientVO, ErpClientQuery } from '@/api/erp/client/types';
|
|
import { ErpClientVO, ErpClientQuery } from '@/api/erp/client/types';
|
|
|
|
|
+import { checkPermi } from '@/utils/permission';
|
|
|
|
|
+
|
|
|
|
|
+/** @Author: Antigravity */
|
|
|
|
|
|
|
|
const { proxy } = getCurrentInstance() as ComponentInternalInstance;
|
|
const { proxy } = getCurrentInstance() as ComponentInternalInstance;
|
|
|
|
|
|
|
@@ -110,118 +159,271 @@ const queryFormRef = ref<ElFormInstance>();
|
|
|
|
|
|
|
|
// 授权客户对话框相关
|
|
// 授权客户对话框相关
|
|
|
const authDialog = reactive({
|
|
const authDialog = reactive({
|
|
|
- visible: false,
|
|
|
|
|
- customerId: undefined as string | number | undefined
|
|
|
|
|
|
|
+ visible: false,
|
|
|
|
|
+ customerId: undefined as string | number | undefined
|
|
|
});
|
|
});
|
|
|
const erpLoading = ref(false);
|
|
const erpLoading = ref(false);
|
|
|
const erpList = ref<ErpClientVO[]>([]);
|
|
const erpList = ref<ErpClientVO[]>([]);
|
|
|
const erpTotal = ref(0);
|
|
const erpTotal = ref(0);
|
|
|
const erpQueryParams = reactive<ErpClientQuery>({
|
|
const erpQueryParams = reactive<ErpClientQuery>({
|
|
|
- pageNum: 1,
|
|
|
|
|
- pageSize: 10,
|
|
|
|
|
- name: undefined
|
|
|
|
|
|
|
+ pageNum: 1,
|
|
|
|
|
+ pageSize: 10,
|
|
|
|
|
+ name: undefined
|
|
|
});
|
|
});
|
|
|
-const selectedErpClient = ref<ErpClientVO | null>(null);
|
|
|
|
|
|
|
+const selectedErpClients = ref<ErpClientVO[]>([]);
|
|
|
|
|
+const erpTableRef = ref();
|
|
|
const erpQueryFormRef = ref<ElFormInstance>();
|
|
const erpQueryFormRef = ref<ElFormInstance>();
|
|
|
|
|
|
|
|
|
|
+// 详情对话框
|
|
|
|
|
+const detailDialog = reactive({
|
|
|
|
|
+ visible: false,
|
|
|
|
|
+ data: null as CustomerVO | null
|
|
|
|
|
+});
|
|
|
|
|
+
|
|
|
const data = reactive<PageData<CustomerForm, CustomerQuery>>({
|
|
const data = reactive<PageData<CustomerForm, CustomerQuery>>({
|
|
|
- form: {} as any,
|
|
|
|
|
- queryParams: {
|
|
|
|
|
- pageNum: 1,
|
|
|
|
|
- pageSize: 10,
|
|
|
|
|
- userName: undefined,
|
|
|
|
|
- phone: undefined,
|
|
|
|
|
- wechatOpenid: undefined
|
|
|
|
|
- },
|
|
|
|
|
- rules: {}
|
|
|
|
|
|
|
+ form: {} as any,
|
|
|
|
|
+ queryParams: {
|
|
|
|
|
+ pageNum: 1,
|
|
|
|
|
+ pageSize: 10,
|
|
|
|
|
+ userName: undefined,
|
|
|
|
|
+ phone: undefined,
|
|
|
|
|
+ wechatOpenid: undefined
|
|
|
|
|
+ },
|
|
|
|
|
+ rules: {}
|
|
|
});
|
|
});
|
|
|
|
|
|
|
|
const { queryParams } = toRefs(data);
|
|
const { queryParams } = toRefs(data);
|
|
|
|
|
|
|
|
|
|
+/**
|
|
|
|
|
+ * 处理列表数据,附加状态展示字段
|
|
|
|
|
+ */
|
|
|
|
|
+const processList = (list: CustomerVO[]) => {
|
|
|
|
|
+ list.forEach(item => {
|
|
|
|
|
+ (item as any)._statusActive = item.status !== '0';
|
|
|
|
|
+ (item as any)._statusLoading = false;
|
|
|
|
|
+ });
|
|
|
|
|
+};
|
|
|
|
|
+
|
|
|
/** 查询客户列表 */
|
|
/** 查询客户列表 */
|
|
|
const getList = async () => {
|
|
const getList = async () => {
|
|
|
- loading.value = true;
|
|
|
|
|
- const res = await listCustomer(queryParams.value);
|
|
|
|
|
- customerList.value = res.rows;
|
|
|
|
|
- total.value = res.total;
|
|
|
|
|
- loading.value = false;
|
|
|
|
|
|
|
+ loading.value = true;
|
|
|
|
|
+ const res = await listCustomer(queryParams.value);
|
|
|
|
|
+ const rows = res.rows as CustomerVO[] || [];
|
|
|
|
|
+ processList(rows);
|
|
|
|
|
+ customerList.value = rows;
|
|
|
|
|
+ total.value = res.total;
|
|
|
|
|
+ loading.value = false;
|
|
|
};
|
|
};
|
|
|
|
|
|
|
|
/** 搜索按钮操作 */
|
|
/** 搜索按钮操作 */
|
|
|
const handleQuery = () => {
|
|
const handleQuery = () => {
|
|
|
- queryParams.value.pageNum = 1;
|
|
|
|
|
- getList();
|
|
|
|
|
|
|
+ queryParams.value.pageNum = 1;
|
|
|
|
|
+ getList();
|
|
|
};
|
|
};
|
|
|
|
|
|
|
|
/** 重置按钮操作 */
|
|
/** 重置按钮操作 */
|
|
|
const resetQuery = () => {
|
|
const resetQuery = () => {
|
|
|
- queryFormRef.value?.resetFields();
|
|
|
|
|
- handleQuery();
|
|
|
|
|
|
|
+ queryFormRef.value?.resetFields();
|
|
|
|
|
+ handleQuery();
|
|
|
};
|
|
};
|
|
|
|
|
|
|
|
/** 多选框选中数据 */
|
|
/** 多选框选中数据 */
|
|
|
const handleSelectionChange = (selection: CustomerVO[]) => {
|
|
const handleSelectionChange = (selection: CustomerVO[]) => {
|
|
|
- ids.value = selection.map((item) => item.id);
|
|
|
|
|
|
|
+ ids.value = selection.map((item) => item.id);
|
|
|
|
|
+};
|
|
|
|
|
+
|
|
|
|
|
+/** 状态切换 */
|
|
|
|
|
+const handleStatusChange = async (row: CustomerVO & { _statusActive: boolean; _statusLoading: boolean }) => {
|
|
|
|
|
+ const newStatus = row._statusActive ? '1' : '0';
|
|
|
|
|
+ try {
|
|
|
|
|
+ row._statusLoading = true;
|
|
|
|
|
+ await changeCustomerStatus(row.id, newStatus);
|
|
|
|
|
+ proxy?.$modal.msgSuccess(newStatus === '1' ? '已启用' : '已禁用');
|
|
|
|
|
+ } catch (e: any) {
|
|
|
|
|
+ // 失败回滚状态
|
|
|
|
|
+ row._statusActive = !row._statusActive;
|
|
|
|
|
+ proxy?.$modal.msgError(e?.msg || '操作失败');
|
|
|
|
|
+ } finally {
|
|
|
|
|
+ row._statusLoading = false;
|
|
|
|
|
+ }
|
|
|
};
|
|
};
|
|
|
|
|
|
|
|
/** 授权客户按钮操作 */
|
|
/** 授权客户按钮操作 */
|
|
|
const handleAuth = (row: CustomerVO) => {
|
|
const handleAuth = (row: CustomerVO) => {
|
|
|
- authDialog.customerId = row.id;
|
|
|
|
|
- authDialog.visible = true;
|
|
|
|
|
- selectedErpClient.value = null;
|
|
|
|
|
- resetErpQuery();
|
|
|
|
|
|
|
+ authDialog.customerId = row.id;
|
|
|
|
|
+ authDialog.visible = true;
|
|
|
|
|
+ selectedErpClients.value = [];
|
|
|
|
|
+ resetErpQuery();
|
|
|
};
|
|
};
|
|
|
|
|
|
|
|
/** 获取ERP客户列表 */
|
|
/** 获取ERP客户列表 */
|
|
|
const getErpList = async () => {
|
|
const getErpList = async () => {
|
|
|
- erpLoading.value = true;
|
|
|
|
|
- const res = await listErpClient(erpQueryParams);
|
|
|
|
|
- erpList.value = res.rows;
|
|
|
|
|
- erpTotal.value = res.total;
|
|
|
|
|
- erpLoading.value = false;
|
|
|
|
|
|
|
+ erpLoading.value = true;
|
|
|
|
|
+ const res = await listErpClient(erpQueryParams);
|
|
|
|
|
+ erpList.value = res.rows;
|
|
|
|
|
+ erpTotal.value = res.total;
|
|
|
|
|
+ erpLoading.value = false;
|
|
|
};
|
|
};
|
|
|
|
|
|
|
|
/** 重置ERP查询 */
|
|
/** 重置ERP查询 */
|
|
|
const resetErpQuery = () => {
|
|
const resetErpQuery = () => {
|
|
|
- erpQueryFormRef.value?.resetFields();
|
|
|
|
|
- erpQueryParams.pageNum = 1;
|
|
|
|
|
- getErpList();
|
|
|
|
|
|
|
+ erpQueryFormRef.value?.resetFields();
|
|
|
|
|
+ erpQueryParams.pageNum = 1;
|
|
|
|
|
+ getErpList();
|
|
|
};
|
|
};
|
|
|
|
|
|
|
|
-/** ERP客户行选中 */
|
|
|
|
|
-const handleErpCurrentChange = (val: ErpClientVO | null) => {
|
|
|
|
|
- selectedErpClient.value = val;
|
|
|
|
|
|
|
+/** ERP客户多选选中 */
|
|
|
|
|
+const handleErpSelectionChange = (val: ErpClientVO[]) => {
|
|
|
|
|
+ selectedErpClients.value = val;
|
|
|
};
|
|
};
|
|
|
|
|
|
|
|
/** 确认授权 */
|
|
/** 确认授权 */
|
|
|
const confirmAuth = async () => {
|
|
const confirmAuth = async () => {
|
|
|
- if (!selectedErpClient.value) {
|
|
|
|
|
- proxy?.$modal.msgError('请选择一个ERP客户');
|
|
|
|
|
- return;
|
|
|
|
|
- }
|
|
|
|
|
- buttonLoading.value = true;
|
|
|
|
|
- try {
|
|
|
|
|
- await authCustomer(authDialog.customerId!, selectedErpClient.value.rowId);
|
|
|
|
|
- proxy?.$modal.msgSuccess('授权成功');
|
|
|
|
|
- authDialog.visible = false;
|
|
|
|
|
- getList();
|
|
|
|
|
- } finally {
|
|
|
|
|
- buttonLoading.value = false;
|
|
|
|
|
- }
|
|
|
|
|
|
|
+ if (!selectedErpClients.value || selectedErpClients.value.length === 0) {
|
|
|
|
|
+ proxy?.$modal.msgError('请至少选择一个ERP客户');
|
|
|
|
|
+ return;
|
|
|
|
|
+ }
|
|
|
|
|
+ buttonLoading.value = true;
|
|
|
|
|
+ try {
|
|
|
|
|
+ const authClientFRowIDs = selectedErpClients.value.map(c => c.rowId).join(',');
|
|
|
|
|
+ await authCustomer(authDialog.customerId!, authClientFRowIDs);
|
|
|
|
|
+ proxy?.$modal.msgSuccess('授权成功');
|
|
|
|
|
+ authDialog.visible = false;
|
|
|
|
|
+ getList();
|
|
|
|
|
+ } finally {
|
|
|
|
|
+ buttonLoading.value = false;
|
|
|
|
|
+ }
|
|
|
|
|
+};
|
|
|
|
|
+
|
|
|
|
|
+/** 查看客户详情 */
|
|
|
|
|
+const handleDetail = async (row: CustomerVO) => {
|
|
|
|
|
+ detailDialog.visible = true;
|
|
|
|
|
+ detailDialog.data = null;
|
|
|
|
|
+ try {
|
|
|
|
|
+ const res = await getCustomerDetail(row.id);
|
|
|
|
|
+ detailDialog.data = res.data;
|
|
|
|
|
+ } catch (e) {
|
|
|
|
|
+ proxy?.$modal.msgError('获取客户详情失败');
|
|
|
|
|
+ detailDialog.visible = false;
|
|
|
|
|
+ }
|
|
|
};
|
|
};
|
|
|
|
|
|
|
|
onMounted(() => {
|
|
onMounted(() => {
|
|
|
- getList();
|
|
|
|
|
|
|
+ getList();
|
|
|
});
|
|
});
|
|
|
</script>
|
|
</script>
|
|
|
|
|
|
|
|
<style scoped>
|
|
<style scoped>
|
|
|
-/** @Author: Antigravity - 优化弹窗分页居中 */
|
|
|
|
|
|
|
+.section-title {
|
|
|
|
|
+ font-size: 14px;
|
|
|
|
|
+ font-weight: 600;
|
|
|
|
|
+ color: #303133;
|
|
|
|
|
+ margin: 20px 0 12px 0;
|
|
|
|
|
+ padding-left: 10px;
|
|
|
|
|
+ border-left: 3px solid #C1001C;
|
|
|
|
|
+}
|
|
|
|
|
+
|
|
|
:deep(.el-dialog .pagination-container) {
|
|
:deep(.el-dialog .pagination-container) {
|
|
|
- display: flex !important;
|
|
|
|
|
- justify-content: center !important;
|
|
|
|
|
- background-color: transparent !important;
|
|
|
|
|
- padding: 20px 0 10px 0 !important;
|
|
|
|
|
- margin-top: 0 !important;
|
|
|
|
|
|
|
+ display: flex !important;
|
|
|
|
|
+ justify-content: center !important;
|
|
|
|
|
+ background-color: transparent !important;
|
|
|
|
|
+ padding: 20px 0 10px 0 !important;
|
|
|
|
|
+ margin-top: 0 !important;
|
|
|
|
|
+}
|
|
|
|
|
+
|
|
|
|
|
+/* 详情弹窗样式 */
|
|
|
|
|
+.detail-header {
|
|
|
|
|
+ display: flex;
|
|
|
|
|
+ align-items: center;
|
|
|
|
|
+ gap: 24px;
|
|
|
|
|
+ padding-bottom: 20px;
|
|
|
|
|
+}
|
|
|
|
|
+
|
|
|
|
|
+.detail-avatar {
|
|
|
|
|
+ flex-shrink: 0;
|
|
|
|
|
+ box-shadow: 0 2px 12px rgba(0, 0, 0, 0.1);
|
|
|
|
|
+}
|
|
|
|
|
+
|
|
|
|
|
+.detail-name-box {
|
|
|
|
|
+ display: flex;
|
|
|
|
|
+ align-items: center;
|
|
|
|
|
+ gap: 12px;
|
|
|
|
|
+}
|
|
|
|
|
+
|
|
|
|
|
+.detail-name {
|
|
|
|
|
+ font-size: 22px;
|
|
|
|
|
+ font-weight: 600;
|
|
|
|
|
+ color: #1d1d1f;
|
|
|
|
|
+ letter-spacing: 0.5px;
|
|
|
|
|
+}
|
|
|
|
|
+
|
|
|
|
|
+.detail-status-tag {
|
|
|
|
|
+ flex-shrink: 0;
|
|
|
|
|
+}
|
|
|
|
|
+
|
|
|
|
|
+.detail-divider {
|
|
|
|
|
+ height: 1px;
|
|
|
|
|
+ background: linear-gradient(90deg, #eee 0%, transparent 100%);
|
|
|
|
|
+ margin-bottom: 20px;
|
|
|
|
|
+}
|
|
|
|
|
+
|
|
|
|
|
+.detail-descriptions {
|
|
|
|
|
+ margin-bottom: 8px;
|
|
|
|
|
+}
|
|
|
|
|
+
|
|
|
|
|
+/* 授权客户卡片 */
|
|
|
|
|
+.auth-client-card {
|
|
|
|
|
+ display: flex;
|
|
|
|
|
+ align-items: flex-start;
|
|
|
|
|
+ gap: 16px;
|
|
|
|
|
+ background: #fafafa;
|
|
|
|
|
+ border-radius: 12px;
|
|
|
|
|
+ padding: 16px 20px;
|
|
|
|
|
+ margin-bottom: 12px;
|
|
|
|
|
+ border: 1px solid #f0f0f0;
|
|
|
|
|
+ transition: box-shadow 0.2s;
|
|
|
|
|
+}
|
|
|
|
|
+
|
|
|
|
|
+.auth-client-card:hover {
|
|
|
|
|
+ box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
|
|
|
|
|
+}
|
|
|
|
|
+
|
|
|
|
|
+.client-index {
|
|
|
|
|
+ width: 28px;
|
|
|
|
|
+ height: 28px;
|
|
|
|
|
+ background: #C1001C;
|
|
|
|
|
+ color: #fff;
|
|
|
|
|
+ border-radius: 50%;
|
|
|
|
|
+ display: flex;
|
|
|
|
|
+ align-items: center;
|
|
|
|
|
+ justify-content: center;
|
|
|
|
|
+ font-size: 13px;
|
|
|
|
|
+ font-weight: 600;
|
|
|
|
|
+ flex-shrink: 0;
|
|
|
|
|
+ margin-top: 2px;
|
|
|
|
|
+}
|
|
|
|
|
+
|
|
|
|
|
+.client-info {
|
|
|
|
|
+ flex: 1;
|
|
|
|
|
+ display: flex;
|
|
|
|
|
+ flex-direction: column;
|
|
|
|
|
+ gap: 6px;
|
|
|
|
|
+}
|
|
|
|
|
+
|
|
|
|
|
+.client-row {
|
|
|
|
|
+ display: flex;
|
|
|
|
|
+ gap: 12px;
|
|
|
|
|
+ font-size: 13px;
|
|
|
|
|
+}
|
|
|
|
|
+
|
|
|
|
|
+.client-label {
|
|
|
|
|
+ color: #999;
|
|
|
|
|
+ min-width: 60px;
|
|
|
|
|
+ flex-shrink: 0;
|
|
|
|
|
+}
|
|
|
|
|
+
|
|
|
|
|
+.client-value {
|
|
|
|
|
+ color: #333;
|
|
|
|
|
+ font-weight: 500;
|
|
|
}
|
|
}
|
|
|
</style>
|
|
</style>
|