jwyu 9 months ago
parent
commit
8db5c7d4a5

+ 4 - 0
src/api/customer/modules/user.js

@@ -8,6 +8,10 @@ export default {
   userInfo: params => {
     return get("/user/detail", params);
   },
+  // 新增用户进行校验
+  userAddCheck:params=>{
+    return post("/user/check", params);
+  },
   // 新增用户
   userAdd:params=>{
     return post("/user/add", params);

+ 5 - 1
src/layout/components/HeaderWrap.vue

@@ -27,7 +27,11 @@ function handleClickBreadcrumb(e){
 
 // 阅读消息
 function handleReadNotice(){
-  apiSystemMessage.msgRead()
+  apiSystemMessage.msgRead().then(res=>{
+    if(res.Ret===200){
+      hasUnRead.value=false
+    }
+  })
 }
 const hasUnRead=ref(false)//是否有未读
 

+ 60 - 18
src/views/customer/UserEdit.vue

@@ -4,7 +4,7 @@ import { apiCustomerUser } from '@/api/customer'
 import { isMobileNo, patternEmail } from '@/utils/common'
 import { useRoute, useRouter } from 'vue-router'
 import PermissionTable from './components/PermissionTable.vue'
-import { dayjs } from 'element-plus'
+import { dayjs, ElMessageBox } from 'element-plus'
 import OperationRecord from './components/OperationRecord.vue'
 
 const route = useRoute()
@@ -12,8 +12,8 @@ const router = useRouter()
 
 const userId = ref(route.query.id || 0)
 
-const isView=computed(()=>{
-  return route.path==='/customer/userDetail'
+const isView = computed(() => {
+  return route.path === '/customer/userDetail'
 })
 
 const areaCodeOpts = ref([])
@@ -96,7 +96,31 @@ function getUserInfo() {
 getUserInfo()
 
 
-async function handleSave() {
+function handleToEdit() {
+  // 关闭提示
+  formState.isEnabled=true
+  ElMessageBox.close()
+  router.replace({
+    path: '/customer/userEdit',
+    query: {
+      id: userId.value
+    }
+  })
+}
+function checkAddContent(msg) {
+  return h('p', [
+    msg,
+    h(ElButton, {
+      type: 'primary',
+      link: true,
+      onClick: handleToEdit
+    }, '跳转查看')
+  ]);
+}
+
+
+
+async function handleSave(type) {
   await formRef.value.validate()
   let params = {
     RealName: formState.realName,
@@ -111,9 +135,27 @@ async function handleSave() {
   }
   if (userId.value) {
     params.UserId = Number(userId.value)
-    params.IsEnabled = true
+    params.IsEnabled = formState.isEnabled
+  } else {
+    // 新增用户时进行校验
+    const checkRes = await apiCustomerUser.userAddCheck({
+      AreaCode: formState.areaCode,
+      Phone: formState.phone,
+      Email: formState.email,
+    })
+    if (checkRes.Ret !== 200) return
+    if (checkRes.Data) {
+      userId.value = checkRes.Data.UserId
+      ElMessageBox.confirm(checkAddContent(checkRes.Msg),'操作提示',{
+        autofocus:false,
+      }).then(()=>{
+        // 确认则自动调用编辑保存一次用户信息
+        formState.isEnabled=true
+        handleSave()
+      }).catch(()=>{})
+      return
+    }
   }
-  console.log(params);
   const res = userId.value ? await apiCustomerUser.userEdit(params) : await apiCustomerUser.userAdd(params)
   if (res.Ret !== 200) return
   ElMessage.success(userId.value ? '编辑成功' : '新增成功')
@@ -162,10 +204,10 @@ async function handleSave() {
             <el-input v-model="formState.email" placeholder="请输入邮箱" />
           </el-form-item>
           <el-form-item label="营业部/销售" prop="sellerId">
-            <all-user-for-depart 
-              style="width:100%" 
+            <all-user-for-depart
+              style="width: 100%"
               :props="{
-                emitPath:false
+                emitPath: false,
               }"
               v-model="formState.sellerId"
             />
@@ -193,10 +235,13 @@ async function handleSave() {
         <div class="form-tr-box auth-box">
           <div class="auth-box-label">
             <span class="text">权限</span>
-            <span v-if="$route.path!=='/customer/userAdd'">
-              <span style="color: var(--el-color-danger);">*</span>
+            <span v-if="$route.path !== '/customer/userAdd'">
+              <span style="color: var(--el-color-danger)">*</span>
               <span>用户状态</span>
-              <el-switch v-model="formState.isEnabled" style="margin-left:5px"/>
+              <el-switch
+                v-model="formState.isEnabled"
+                style="margin-left: 5px"
+              />
             </span>
           </div>
 
@@ -209,10 +254,7 @@ async function handleSave() {
     </div>
     <div class="right-box">
       <div style="text-align: right" v-if="!isView">
-        <el-button
-          type="primary"
-          style="width: 120px"
-          @click="handleSave"
+        <el-button type="primary" style="width: 120px" @click="handleSave"
           >保存</el-button
         >
         <el-button
@@ -224,13 +266,13 @@ async function handleSave() {
         >
       </div>
       <!-- 操作记录 -->
-      <OperationRecord v-if="userId!==0&&$route.path!=='/customer/userTransform'"/>
+      <OperationRecord />
     </div>
   </div>
 </template>
 
 <style lang="scss" scoped>
-.customer-user-edit-page{
+.customer-user-edit-page {
   padding: 20px;
 }
 .content-box {

+ 2 - 1
src/views/customer/components/EnableUser.vue

@@ -109,7 +109,7 @@ function goEdit(){
         :key="key"
       >
         <span class="label">{{ key }}</span>
-        <div style="flex: 1; gap: 5px" class="flex">
+        <div style="flex: 1; gap: 5px;flex-wrap:wrap" class="flex">
           <el-tag type="primary" v-for="v in value" :key="v">{{ v }}</el-tag>
         </div>
       </div>
@@ -130,6 +130,7 @@ function goEdit(){
   .item-box {
     display: flex;
     align-items: center;
+    overflow: hidden;
     margin-bottom: 20px;
     .label {
       flex-shrink: 0;

+ 1 - 0
src/views/customer/components/OperationRecord.vue

@@ -7,6 +7,7 @@ const route = useRoute()
 
 const list = ref([])
 function getRecord() {
+  if(!route.query.id&&['/customer/userTransform','/customer/userAdd'].includes(route.path)) return
   apiCustomerUser.userOperationRecord({
     UserId: route.query.id
   }).then(res => {

+ 2 - 2
src/views/customer/reportStatistic/List.vue

@@ -37,8 +37,8 @@ const tableColOpt = [
     key: 'Status'
   },
   {
-    label: '最近一次登录时间',
-    key: 'RegisterTime',
+    label: '最近一次阅读时间',
+    key: 'LastUpdateTime',
     sort: true
   },
   {

+ 1 - 1
src/views/customer/reportStatistic/components/UserStatisticDetail.vue

@@ -47,7 +47,7 @@ async function getList() {
     PageSize: pageSize.value,
     CurrentIndex: page.value,
     ChartPermissionIds: permissionIds.value ? permissionIds.value.join(',') : '',
-    classify_id2: classifyIds.value ? classifyIds.value.join(',') : '',
+    ClassifyIds: classifyIds.value ? classifyIds.value.join(',') : '',
   })
   tableLoading.value = false
   if (res.Ret === 200) {

+ 1 - 1
zipBuildPlugin.js

@@ -3,7 +3,7 @@ import { resolve } from 'path';
 import { createWriteStream } from 'fs';
 import archiver from 'archiver';
 
-export default function zipPlugin() {
+export default function zipBuildPlugin() {
   let outDir = 'dist'; // 默认值
 
   return {