Kaynağa Gözat

客户管理完成

Huanyi 3 hafta önce
ebeveyn
işleme
0f9a99639d

+ 2 - 1
src/api/erp/client/index.ts

@@ -1,12 +1,13 @@
 import request from '@/utils/request';
 import { AxiosPromise } from 'axios';
+import { ErpClientVO, ErpClientQuery } from './types';
 
 /**
  * 查询ERP客户列表
  * @param query
  * @Author: Antigravity
  */
-export const listErpClient = (query?: any): AxiosPromise<any> => {
+export const listErpClient = (query?: ErpClientQuery): AxiosPromise<ErpClientVO[]> => {
   return request({
     url: '/erp/client/list',
     method: 'get',

+ 143 - 0
src/api/erp/client/types.ts

@@ -0,0 +1,143 @@
+/**
+ * ERP 客户 VO
+ * @Author: Antigravity
+ */
+export interface ErpClientVO {
+  /**
+   * 序号(主键)
+   */
+  frowId: string;
+
+  /**
+   * 代码
+   */
+  fnum: string;
+
+  /**
+   * 名称
+   */
+  fname: string;
+
+  /**
+   * 客户简称
+   */
+  shortName: string;
+
+  /**
+   * 分类(国内,国外)
+   */
+  fclass: string;
+
+  /**
+   * 销售部门
+   */
+  saleDept: string;
+
+  /**
+   * 业务员
+   */
+  saleMan: string;
+
+  /**
+   * 负责人
+   */
+  dutyMan: string;
+
+  /**
+   * 付款方式
+   */
+  payMode: string;
+
+  /**
+   * 信用额度
+   */
+  creditAmt: number;
+
+  /**
+   * 信用等级
+   */
+  creditRating: string;
+
+  /**
+   * 联系人
+   */
+  contactMan: string;
+
+  /**
+   * 地址
+   */
+  contactAddr: string;
+
+  /**
+   * 电话
+   */
+  contactTel: string;
+
+  /**
+   * 手机
+   */
+  contactMobile: string;
+
+  /**
+   * 邮箱
+   */
+  contactEmail: string;
+
+  /**
+   * 公司ID
+   */
+  companyId: number;
+
+  /**
+   * 暂停使用(0正常 1停用)
+   */
+  stopUse: number;
+
+  /**
+   * 修改状态
+   */
+  isModifyFlag: number;
+
+  /**
+   * 打印次数
+   */
+  lastPrintNum: number;
+
+  /**
+   * 打印功能号
+   */
+  lastPrintFormId: string;
+
+  /**
+   * 打印状态
+   */
+  lastPrintDocStatus: number;
+
+  /**
+   * 是否经销商
+   */
+  isDealer: number;
+
+  /**
+   * 首单日期
+   */
+  firstDate: string;
+
+  /**
+   * 创建人
+   */
+  enterName: string;
+
+  /**
+   * 创建时间
+   */
+  enterDate: string;
+}
+
+/**
+ * ERP 客户查询对象
+ */
+export interface ErpClientQuery extends PageQuery {
+  fName?: string;
+  fNum?: string;
+}

+ 3 - 3
src/api/system/customer/index.ts

@@ -40,14 +40,14 @@ export const addCustomer = (data: CustomerForm) => {
 /**
  * 授权客户
  * @param id 客户ID
- * @param authCustomerId ERP客户ID
+ * @param authClientFRowID ERP客户 RowID
  * @Author: Antigravity
  */
-export const authCustomer = (id: string | number, authCustomerId: string) => {
+export const authCustomer = (id: string | number, authClientFRowID: string) => {
   return request({
     url: '/system/customer/auth',
     method: 'put',
-    params: { id, authCustomerId }
+    params: { id, authClientFRowID }
   });
 };
 

+ 4 - 4
src/api/system/customer/types.ts

@@ -25,9 +25,9 @@ export interface CustomerVO {
   wechatUnionid: string;
 
   /**
-   * 授权客户ID
+   * 授权客户 RowID
    */
-  authCustomerId: string;
+  authClientFRowID: string;
 
   /**
    * 头像地址
@@ -67,9 +67,9 @@ export interface CustomerForm extends BaseEntity {
   wechatUnionid?: string;
 
   /**
-   * 授权客户ID
+   * 授权客户 RowID
    */
-  authCustomerId?: string;
+  authClientFRowID?: string;
 
   /**
    * 头像地址

+ 1 - 0
src/api/system/menu/types.ts

@@ -8,6 +8,7 @@ export interface MenuTreeOption {
   label: string;
   parentId: string | number;
   weight: number;
+  visible?: string;
   children?: MenuTreeOption[];
 }
 

+ 29 - 16
src/views/customer/index.vue

@@ -1,3 +1,4 @@
+<!-- @Author: Antigravity -->
 <template>
     <div class="p-2">
         <transition :enter-active-class="proxy?.animate.searchAnimate.enter"
@@ -36,11 +37,10 @@
                 </el-table-column>
                 <el-table-column label="用户名" align="center" prop="userName" />
                 <el-table-column label="手机号" align="center" prop="phone" />
-                <el-table-column label="微信OpenID" align="center" prop="wechatOpenid" :show-overflow-tooltip="true" />
-                <el-table-column label="微信UnionID" align="center" prop="wechatUnionid" :show-overflow-tooltip="true" />
-                <el-table-column label="授权客户ERP编码" align="center" prop="authClientFNum" :show-overflow-tooltip="true" />
+                <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="createTime" width="160" />
+                <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="120">
                     <template #default="scope">
                         <el-tooltip content="授权客户" placement="top">
@@ -56,10 +56,10 @@
         </el-card>
 
         <!-- 授权客户对话框 -->
-        <el-dialog v-model="authDialog.visible" title="授权客户" width="800px" append-to-body>
+        <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="fName">
-                    <el-input v-model="erpQueryParams.fName" placeholder="请输入客户名称" clearable style="width: 200px"
+                    <el-input v-model="erpQueryParams.fName" placeholder="请输入客户名称" clearable style="width: 240px"
                         @keyup.enter="getErpList" />
                 </el-form-item>
                 <el-form-item>
@@ -68,13 +68,14 @@
                 </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="fnum" />
-                <el-table-column label="客户名称" align="center" prop="fname" />
-                <el-table-column label="联系人" align="center" prop="contactMan" />
-                <el-table-column label="联系电话" align="center" prop="contactTel" />
+                <el-table-column label="代码" align="center" prop="fnum" width="100" :formatter="(row: ErpClientVO) => row.fnum || '-'" />
+                <el-table-column label="名称" align="left" prop="fname" min-width="180" :show-overflow-tooltip="true" :formatter="(row: ErpClientVO) => row.fname || '-'" />
+                <el-table-column label="客户类型" align="center" prop="fclass" width="100" :formatter="(row: ErpClientVO) => row.fclass || '-'" />
+                <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" @pagination="getErpList" />
+                :total="erpTotal" layout="total, prev, pager, next" @pagination="getErpList" />
             <template #footer>
                 <div class="dialog-footer">
                     <el-button :loading="buttonLoading" type="primary" @click="confirmAuth">确 定</el-button>
@@ -89,6 +90,7 @@
 import { listCustomer, getCustomer, authCustomer } from '@/api/system/customer';
 import { CustomerVO, CustomerQuery, CustomerForm } from '@/api/system/customer/types';
 import { listErpClient } from '@/api/erp/client';
+import { ErpClientVO, ErpClientQuery } from '@/api/erp/client/types';
 
 const { proxy } = getCurrentInstance() as ComponentInternalInstance;
 
@@ -107,14 +109,14 @@ const authDialog = reactive({
     customerId: undefined as string | number | undefined
 });
 const erpLoading = ref(false);
-const erpList = ref<any[]>([]);
+const erpList = ref<ErpClientVO[]>([]);
 const erpTotal = ref(0);
-const erpQueryParams = reactive({
+const erpQueryParams = reactive<ErpClientQuery>({
     pageNum: 1,
     pageSize: 10,
     fName: undefined
 });
-const selectedErpClient = ref<any>(null);
+const selectedErpClient = ref<ErpClientVO | null>(null);
 const erpQueryFormRef = ref<ElFormInstance>();
 
 const data = reactive<PageData<CustomerForm, CustomerQuery>>({
@@ -182,7 +184,7 @@ const resetErpQuery = () => {
 };
 
 /** ERP客户行选中 */
-const handleErpCurrentChange = (val: any) => {
+const handleErpCurrentChange = (val: ErpClientVO | null) => {
     selectedErpClient.value = val;
 };
 
@@ -194,7 +196,7 @@ const confirmAuth = async () => {
     }
     buttonLoading.value = true;
     try {
-        await authCustomer(authDialog.customerId!, selectedErpClient.value.fnum);
+        await authCustomer(authDialog.customerId!, selectedErpClient.value.frowId);
         proxy?.$modal.msgSuccess('授权成功');
         authDialog.visible = false;
         getList();
@@ -207,3 +209,14 @@ onMounted(() => {
     getList();
 });
 </script>
+
+<style scoped>
+/** @Author: Antigravity - 优化弹窗分页居中 */
+: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;
+}
+</style>

+ 19 - 18
src/views/system/role/index.vue

@@ -7,9 +7,7 @@
             <el-form-item label="角色名称" prop="roleName">
               <el-input v-model="queryParams.roleName" placeholder="请输入角色名称" clearable @keyup.enter="handleQuery" />
             </el-form-item>
-            <el-form-item label="权限字符" prop="roleKey">
-              <el-input v-model="queryParams.roleKey" placeholder="请输入权限字符" clearable @keyup.enter="handleQuery" />
-            </el-form-item>
+
             <el-form-item label="状态" prop="status">
               <el-select v-model="queryParams.status" placeholder="角色状态" clearable>
                 <el-option v-for="dict in sys_normal_disable" :key="dict.value" :label="dict.label" :value="dict.value" />
@@ -59,7 +57,7 @@
         <el-table-column type="selection" width="55" align="center" />
         <el-table-column v-if="false" label="角色编号" prop="roleId" width="120" />
         <el-table-column label="角色名称" prop="roleName" :show-overflow-tooltip="true" width="150" />
-        <el-table-column label="权限字符" prop="roleKey" :show-overflow-tooltip="true" width="200" />
+        <el-table-column label="备注" prop="remark" :show-overflow-tooltip="true" />
         <el-table-column label="显示顺序" prop="roleSort" width="100" />
         <el-table-column label="状态" align="center" width="100">
           <template #default="scope">
@@ -104,17 +102,7 @@
         <el-form-item label="角色名称" prop="roleName">
           <el-input v-model="form.roleName" placeholder="请输入角色名称" />
         </el-form-item>
-        <el-form-item prop="roleKey">
-          <template #label>
-            <span>
-              <el-tooltip content="控制器中定义的权限字符,如:@SaCheckRole('admin')" placement="top">
-                <el-icon><question-filled /></el-icon>
-              </el-tooltip>
-              权限字符
-            </span>
-          </template>
-          <el-input v-model="form.roleKey" placeholder="请输入权限字符" />
-        </el-form-item>
+
         <el-form-item label="角色顺序" prop="roleSort">
           <el-input-number v-model="form.roleSort" controls-position="right" :min="0" />
         </el-form-item>
@@ -258,7 +246,7 @@ const data = reactive<PageData<RoleForm, RoleQuery>>({
   },
   rules: {
     roleName: [{ required: true, message: '角色名称不能为空', trigger: 'blur' }],
-    roleKey: [{ required: true, message: '权限字符不能为空', trigger: 'blur' }],
+
     roleSort: [{ required: true, message: '角色顺序不能为空', trigger: 'blur' }]
   }
 });
@@ -341,7 +329,20 @@ const handleAuthUser = (row: RoleVO) => {
 /** 查询菜单树结构 */
 const getMenuTreeselect = async () => {
   const res = await menuTreeselect();
-  menuOptions.value = res.data;
+  menuOptions.value = filterMenuTree(res.data);
+};
+
+/** 过滤隐藏菜单 */
+const filterMenuTree = (menus: MenuTreeOption[]): MenuTreeOption[] => {
+  return menus.filter((menu) => {
+    if (menu.visible === '1') {
+      return false;
+    }
+    if (menu.children) {
+      menu.children = filterMenuTree(menu.children);
+    }
+    return true;
+  });
 };
 /** 所有部门节点数据 */
 const getDeptAllCheckedKeys = (): any => {
@@ -391,7 +392,7 @@ const handleUpdate = async (row?: RoleVO) => {
 /** 根据角色ID查询菜单树结构 */
 const getRoleMenuTreeselect = (roleId: string | number) => {
   return roleMenuTreeselect(roleId).then((res): RoleMenuTree => {
-    menuOptions.value = res.data.menus;
+    menuOptions.value = filterMenuTree(res.data.menus);
     return res.data;
   });
 };