Browse Source

Merge branch 'ch/dongwu1.3' of eta_mini/eta_mini_crm_front into debug_dw

leichen 7 months ago
parent
commit
7f5270a4dd

+ 9 - 2
src/api/customer/modules/user.js

@@ -46,6 +46,13 @@ export default {
   // 客户全局搜索
   userGlobalSearch:params=>{
     return get('/user/global/list',params)
-  }
-  
+  },
+  // 营业部门列表
+  sellerDepartmentList:params=>{
+    return get('/seller/department/list',params)
+  },
+  // 导出营业部门列表
+  potentialExportExcel:params=>{
+    return get('/user/potential/export/excel',params)
+  },
 };

+ 5 - 0
src/api/index.js

@@ -25,6 +25,11 @@ _axios.interceptors.request.use(
       config.headers.Authorization = auth;
     }
     // config.headers.Authorization=localStorage.getItem('token')||''
+    
+    // 检查请求路径并设置responseType
+    if (config.url.endsWith('/user/potential/export/excel')) {
+      config.responseType = 'blob'; // 如果是导出excel的请求,则设置responseType为blob
+    }
     return config;
   },
   function (error) {

+ 117 - 8
src/views/customer/PotentialUserList.vue

@@ -2,7 +2,7 @@
 import { Search } from '@element-plus/icons-vue'
 import { apiCustomerUser } from '@/api/customer'
 import { useRouter } from 'vue-router'
-import { ElMessage, ElMessageBox } from 'element-plus'
+import { dayjs, ElMessage, ElMessageBox } from 'element-plus'
 import EnableUser from './components/EnableUser.vue'
 import UserStatisticDetail from './reportStatistic/components/UserStatisticDetail.vue'
 
@@ -21,6 +21,14 @@ const tableColOpt = [
     label: '手机号',
     key: 'Phone'
   },
+  {
+    label: '手机号',
+    key: 'RealName'
+  },
+  {
+    label: '营业部',
+    key: 'SellerDepartmentName'
+  },
   {
     label: '邮箱',
     key: 'Email'
@@ -30,6 +38,10 @@ const tableColOpt = [
     key: 'RegisterTime',
     sort: true
   },
+  {
+    label: '申请时间',
+    key: 'ApplyTime'
+  },
   {
     label: '最近一次阅读时间',
     key: 'LastUpdateTime',
@@ -40,8 +52,14 @@ const tableColOpt = [
     key: 'ReadCnt',
     sort: true,
   },
+  {
+    label: '申请状态',
+    key: 'ApplyStatus'
+  },
 ]
 const userList = ref([])
+const departmentList = ref([])
+const btnload = ref(false)
 const page = ref(1)
 const pageSize = ref(10)
 const tableLoading = ref(false)
@@ -54,10 +72,14 @@ async function getUserList() {
     KeyWord: filterState.keyword,
     RegisterStartDate: filterState.regsiterTime ? filterState.regsiterTime[0] : '',
     RegisterEndDate: filterState.regsiterTime ? filterState.regsiterTime[1] : '',
-    LastUpdateStartDate:filterState.readTime ? filterState.readTime[0] : '',
-    LastUpdateEndDate:filterState.readTime ? filterState.readTime[1] : '',
-    SortParam:filterState.sortType,
-    SortType:filterState.sortVal
+    LastUpdateStartDate: filterState.readTime ? filterState.readTime[0] : '',
+    LastUpdateEndDate: filterState.readTime ? filterState.readTime[1] : '',
+    ApplyStartDate: filterState.appliTime ? filterState.appliTime[0] : '',
+    ApplyEndDate: filterState.appliTime ? filterState.appliTime[1] : '',
+    ApplyStatus: filterState.ApplyStatus,
+    SellerDepartmentId: filterState.SellerDepartmentId,
+    SortParam: filterState.sortType,
+    SortType: filterState.sortVal
   })
   tableLoading.value = false
   if (res.Ret === 200) {
@@ -65,7 +87,53 @@ async function getUserList() {
     totals.value = res.Data.Paging.Totals
   }
 }
+
+async function getSellerDepartment() {
+  tableLoading.value = true
+  const res = await apiCustomerUser.sellerDepartmentList()
+  tableLoading.value = false
+  if (res.Ret === 200) {
+    departmentList.value = res.Data || []
+  }
+}
+
+getSellerDepartment()
 getUserList()
+
+async function exportClick() {
+  btnload.value = true
+  const res = await apiCustomerUser.potentialExportExcel(
+    {
+    KeyWord: filterState.keyword,
+    RegisterStartDate: filterState.regsiterTime ? filterState.regsiterTime[0] : '',
+    RegisterEndDate: filterState.regsiterTime ? filterState.regsiterTime[1] : '',
+    LastUpdateStartDate: filterState.readTime ? filterState.readTime[0] : '',
+    LastUpdateEndDate: filterState.readTime ? filterState.readTime[1] : '',
+    ApplyStartDate: filterState.appliTime ? filterState.appliTime[0] : '',
+    ApplyEndDate: filterState.appliTime ? filterState.appliTime[1] : '',
+    ApplyStatus: filterState.ApplyStatus,
+    SellerDepartmentId: filterState.SellerDepartmentId,
+    }
+  )
+  btnload.value = false
+  console.log(res);
+  
+  const blob = new Blob([res], {
+    type: "application/vnd.ms-excel;charset=utf-8",
+  });
+  let fileName = '潜在用户列表' + dayjs(new Date()).format('YYYY-MM-DD') + ".xlsx";
+
+  const elink = document.createElement("a");
+  elink.download = fileName; //命名下载名称
+  elink.style.display = "none";
+  elink.href = URL.createObjectURL(blob);
+  document.body.appendChild(elink);
+  elink.click(); // 点击下载
+  URL.revokeObjectURL(elink.href); // 释放URL 对象
+  document.body.removeChild(elink); // 释放标
+  
+}
+
 function handlePageChange(e) {
   page.value = e
   getUserList()
@@ -113,6 +181,22 @@ function handleShowDetail(e){
 <template>
   <div class="potential-user-list-page">
     <div class="flex filter-wrap">
+      <div>
+        <el-button type="primary" @click="exportClick" :loading="btnload"
+          >导出</el-button
+        >
+      </div>
+      <div class="flex filter-wrap">
+        <el-select
+          placeholder="请选择营业部"
+          v-model="filterState.SellerDepartmentId"
+          style="width: 165px"
+          clearable
+          @change="handleFilterList"
+        >
+          <el-option v-for="(item, index) in departmentList" :key="index" :label="item.SysDepartmentName" :value="item.SysDepartmentId"></el-option>
+        </el-select>
+      </div>
       <div style="width: 235px">
         <el-date-picker
           style="width: 235px"
@@ -125,6 +209,18 @@ function handleShowDetail(e){
           @change="handleFilterList"
         />
       </div>
+      <div style="width: 235px">
+        <el-date-picker
+          style="width: 235px"
+          v-model="filterState.appliTime"
+          type="daterange"
+          range-separator="至"
+          start-placeholder="申请时间"
+          end-placeholder="申请时间"
+          value-format="YYYY-MM-DD"
+          @change="handleFilterList"
+        />
+      </div>
       <div style="width: 235px">
         <el-date-picker
           style="width: 235px"
@@ -137,6 +233,18 @@ function handleShowDetail(e){
           @change="handleFilterList"
         />
       </div>
+      <div class="flex filter-wrap">
+        <el-select
+          placeholder="请选择申请状态"
+          v-model="filterState.ApplyStatus"
+          style="width: 165px"
+          clearable
+          @change="handleFilterList"
+        >
+          <el-option label="已申请" :value="1"></el-option>
+          <el-option label="未申请" :value="0"></el-option>
+        </el-select>
+      </div>
       <el-input
         placeholder="手机号/邮箱"
         v-model="filterState.keyword"
@@ -178,10 +286,11 @@ function handleShowDetail(e){
           </template>
           <template #default="{ row }">
             <span
-              v-if="column.key === 'Status'"
-              :style="{ color: !row.Status ? '#f00' : '' }"
-              >{{ row.Status ? "启用" : "禁用" }}</span
+              v-if="column.key === 'ApplyStatus'"
+              :style="{ color: row.ApplyStatus ? 'rgba(0, 136, 88, 1)' : '#f00' }"
             >
+              {{ row.ApplyStatus ? "已申请" : "未申请" }}
+            </span>
             <el-button v-else-if="column.key === 'ReadCnt'&&row.ReadCnt>0" link type="primary" @click="handleShowDetail(row)">{{row.ReadCnt}}</el-button>
             <span v-else>{{ row[column.key] }}</span>
           </template>

+ 23 - 6
src/views/customer/UserEdit.vue

@@ -96,7 +96,7 @@ function getUserInfo() {
       formState.areaCode = Detail.AreaCode
       formState.phone = Detail.Phone
       formState.email = Detail.Email
-      formState.sellerId = Detail.SellerId||''
+      formState.sellerId = Detail.SellerDepartmentId||''
       formState.validTime = Detail.ValidStartTime?[dayjs(Detail.ValidStartTime).format('YYYY-MM-DD'), dayjs(Detail.ValidEndTime).format('YYYY-MM-DD')]:''
       formState.company = Detail.Company
       formState.isEnabled = Detail.Status ? true : false
@@ -107,6 +107,15 @@ function getUserInfo() {
   })
 }
 getUserInfo()
+getSellerDepartment()
+
+const departmentList = ref([])
+async function getSellerDepartment() {
+  const res = await apiCustomerUser.sellerDepartmentList()
+  if (res.Ret === 200) {
+    departmentList.value = res.Data || []
+  }
+}
 
 
 function handleToEdit() {
@@ -140,7 +149,7 @@ async function handleSave(type) {
     AreaCode: formState.areaCode,
     Phone: formState.phone,
     Email: formState.email,
-    SellerId: formState.sellerId,
+    SellerDepartmentId: formState.sellerId,
     ValidStartTime: formState.validTime?.[0],
     ValidEndTime: formState.validTime?.[1],
     Company: formState.company,
@@ -221,16 +230,24 @@ async function handleSave(type) {
           <el-form-item label="邮箱" prop="email">
             <el-input v-model="formState.email" placeholder="请输入邮箱" />
           </el-form-item>
-          <el-form-item label="营业部/销售" prop="sellerId">
-            <all-user-for-depart
+          <el-form-item label="营业部" prop="sellerId">
+            <!-- <all-user-for-depart
               style="width: 100%"
               :props="{
                 emitPath: false,
               }"
               onlySelectUser
               v-model="formState.sellerId"
-              placeholder="请选择营业部/销售"
-            />
+              placeholder="请选择营业部"
+            /> -->
+            <!-- handleFilterList -->
+            <el-select
+              placeholder="请选择营业部"
+              v-model="formState.sellerId"
+              clearable
+            >
+              <el-option v-for="(item, index) in departmentList" :key="index" :label="item.SysDepartmentName" :value="item.SysDepartmentId"></el-option>
+            </el-select>
           </el-form-item>
         </div>
         <div class="flex form-tr-box">

+ 27 - 7
src/views/customer/UserList.vue

@@ -9,7 +9,7 @@ const router = useRouter()
 
 const filterState = reactive({
   keyword: '',
-  seller: '',
+  SellerDepartmentId: '',
   status: '',
   register: '',
   subscribe: '',
@@ -34,8 +34,8 @@ const tableColOpt = [
     key: 'Email'
   },
   {
-    label: '营业部/销售',
-    key: 'SellerName'
+    label: '营业部',
+    key: 'SellerDepartmentName'
   },
   {
     label: '用户状态',
@@ -76,6 +76,7 @@ const tableColOpt = [
   },
 ]
 const userList = ref([])
+const departmentList = ref([]) // 营业部列表
 const page = ref(1)
 const pageSize = ref(10)
 const tableLoading = ref(false)
@@ -85,7 +86,7 @@ async function getUserList() {
   const res = await apiCustomerUser.userList({
     PageSize: pageSize.value,
     CurrentIndex: page.value,
-    SellerId: filterState.seller ? filterState.seller.join(',') : '',
+    SellerDepartmentId: filterState.SellerDepartmentId,
     Status: filterState.status,
     KeyWord: filterState.keyword,
     IsRegistered: filterState.register,
@@ -104,10 +105,20 @@ async function getUserList() {
   }
 }
 getUserList()
+getSellerDepartment()
 function handlePageChange(e) {
   page.value = e
   getUserList()
 }
+async function getSellerDepartment() {
+  tableLoading.value = true
+  const res = await apiCustomerUser.sellerDepartmentList()
+  tableLoading.value = false
+  if (res.Ret === 200) {
+    departmentList.value = res.Data || []
+  }
+}
+
 function handleTableSort(e) {
   // console.log(e);
   const { order, prop } = e//order:"descending",prop: "RegisterTime"
@@ -210,9 +221,9 @@ function handleGoDetail(e){
       />
     </div>
     <div class="flex filter-wrap">
-      <all-user-for-depart
+      <!-- <all-user-for-depart
         style="width: 165px"
-        v-model="filterState.seller"
+        v-model="filterState.SellerDepartmentId"
         :props="{
           emitPath: false,
           multiple: true,
@@ -220,7 +231,16 @@ function handleGoDetail(e){
         clearable
         filterable
         @change="handleFilterList"
-      />
+      /> -->
+      <el-select
+        placeholder="请选择营业部"
+        v-model="filterState.SellerDepartmentId"
+        style="width: 165px"
+        clearable
+        @change="handleFilterList"
+      >
+        <el-option v-for="(item, index) in departmentList" :key="index" :label="item.SysDepartmentName" :value="item.SysDepartmentId"></el-option>
+      </el-select>
       <el-select
         placeholder="用户状态"
         v-model="filterState.status"

+ 22 - 12
src/views/customer/reportStatistic/List.vue

@@ -3,6 +3,7 @@ import { Search,Switch } from '@element-plus/icons-vue'
 import { apiCustomerStatistic } from '@/api/customer'
 import UserStatisticDetail from './components/UserStatisticDetail.vue'
 import { useRouter } from 'vue-router'
+import { apiCustomerUser } from '@/api/customer'
 
 const router=useRouter()
 
@@ -10,7 +11,7 @@ const emits=defineEmits(['change'])
 
 const filterState=reactive({
   keyword: '',
-  seller: '',
+  SellerDepartmentId: '',
   status: '',
   register: '',
   subscribe: '',
@@ -32,8 +33,8 @@ const tableColOpt = [
     key: 'Email'
   },
   {
-    label: '营业部/销售',
-    key: 'SellerName'
+    label: '营业部',
+    key: 'SellerDepartmentName'
   },
   {
     label: '用户状态',
@@ -51,6 +52,7 @@ const tableColOpt = [
   }
 ]
 const userList = ref([])
+const departmentList = ref([]) // 营业部列表
 const page = ref(1)
 const pageSize = ref(10)
 const tableLoading = ref(false)
@@ -61,7 +63,7 @@ async function getUserList() {
     PageSize: pageSize.value,
     CurrentIndex: page.value,
     KeyWord: filterState.keyword,
-    SellerId:filterState.seller?filterState.seller.join(','):'',
+    SellerDepartmentId: filterState.SellerDepartmentId,
     Status: filterState.status,
     IsRegistered: filterState.register,
     IsSubscribed: filterState.subscribe,
@@ -79,10 +81,20 @@ async function getUserList() {
   }
 }
 getUserList()
+getSellerDepartment()
 function handlePageChange(e) {
   page.value = e
   getUserList()
 }
+async function getSellerDepartment() {
+  tableLoading.value = true
+  const res = await apiCustomerUser.sellerDepartmentList()
+  tableLoading.value = false
+  if (res.Ret === 200) {
+    departmentList.value = res.Data || []
+  }
+}
+
 function handleTableSort(e) {
   // console.log(e);
   const { order, prop } = e//order:"descending",prop: "RegisterTime"
@@ -126,17 +138,15 @@ function handleGoDetail(e){
   <div class="user-report-statistic-page">
     <div class="flex filter-wrap">
       <el-button type="primary" :icon="Switch" link @click="emits('change','list')">统计图</el-button>
-      <all-user-for-depart
+      <el-select
+        placeholder="请选择营业部"
+        v-model="filterState.SellerDepartmentId"
         style="width: 165px"
-        v-model="filterState.seller"
-        :props="{
-          emitPath: false,
-          multiple: true,
-        }"
         clearable
-        filterable
         @change="handleFilterList"
-      />
+      >
+        <el-option v-for="(item, index) in departmentList" :key="index" :label="item.SysDepartmentName" :value="item.SysDepartmentId"></el-option>
+      </el-select>
       <el-select
         placeholder="用户状态"
         v-model="filterState.status"

+ 19 - 1
src/views/system/userList/components/DepartWrap.vue

@@ -270,7 +270,25 @@ function getFormTitle(e) {
         <template #default="{ node, data }">
           <div class="depart-item-box">
             <div class="label">{{ node.label }}</div>
-            <div class="opt-box" v-show="showClassifyOpt(node, data)">
+            <div class="opt-box" v-show="showClassifyOpt(node, data)" v-if="node.label === '营业部'">
+              <el-dropdown>
+                <svg-icon
+                  name="menu"
+                  size="16px"
+                  style="margin-right: 10px"
+                ></svg-icon>
+                <template #dropdown>
+                  <el-dropdown-menu>
+                    <el-dropdown-item
+                      v-if="node.level < 3&&hasPermission('department:add')"
+                      @click.stop="handleDepartOpt(node, data, 'add')"
+                      >添加部门分组</el-dropdown-item
+                    >
+                  </el-dropdown-menu>
+                </template>
+              </el-dropdown>
+            </div>
+            <div class="opt-box" v-show="showClassifyOpt(node, data)" v-else>
               <svg-icon
                 name="edit2"
                 size="16px"