4 Commits 86bb6b0712 ... 4b0f2d7ec8

Author SHA1 Message Date
  yz 4b0f2d7ec8 refactor(lead): 使用常量替换状态选项并更新状态注释 3 weeks ago
  yz 0842b35169 fix(lead): 修正优先级数值与标签的对应关系 3 weeks ago
  yz dbc7ae652f refactor(lead): 移除detailRefreshChange方法中不必要的page参数 3 weeks ago
  yz 37d1059b46 fix(lead): 修复表单错误提示样式问题 3 weeks ago
3 changed files with 72 additions and 45 deletions
  1. 64 28
      src/views/lead/index.vue
  2. 4 13
      src/views/lead/mixins/leadIndex.js
  3. 4 4
      src/views/lead/types.d.ts

+ 64 - 28
src/views/lead/index.vue

@@ -1,7 +1,7 @@
 <template>
     <basic-container>
         <avue-crud :option="option" :data="data" ref="crud" v-model="form" :page.sync="page"
-            :permission="permissionList" :before-open="beforeOpen" :table-loading="loading" 
+            :permission="permissionList" :before-open="beforeOpen" :table-loading="loading"
             @row-update="rowUpdate" @row-save="rowSave" @search-change="searchChange" @search-reset="searchReset"
             @selection-change="selectionChange" @current-change="currentChange" @size-change="sizeChange"
             @refresh-change="refreshChange" @on-load="onLoad">
@@ -82,26 +82,26 @@
                     </div>
                 </div>
             </div>
-            
-            <avue-crud 
-                :option="detailOption" 
-                :data="detailData" 
-                ref="detailCrud" 
-                v-model="detailForm" 
+
+            <avue-crud
+                :option="detailOption"
+                :data="detailData"
+                ref="detailCrud"
+                v-model="detailForm"
                 :page.sync="detailPage"
-                :permission="detailPermissionList" 
-                :before-open="detailBeforeOpen" 
-                :table-loading="detailLoading" 
+                :permission="detailPermissionList"
+                :before-open="detailBeforeOpen"
+                :table-loading="detailLoading"
                 @row-del="detailRowDel"
-                @row-update="detailRowUpdate" 
-                @row-save="detailRowSave" 
-                @selection-change="detailSelectionChange" 
-                @current-change="detailCurrentChange" 
+                @row-update="detailRowUpdate"
+                @row-save="detailRowSave"
+                @selection-change="detailSelectionChange"
+                @current-change="detailCurrentChange"
                 @size-change="detailSizeChange"
-                @refresh-change="detailRefreshChange" 
+                @refresh-change="detailRefreshChange"
                 @on-load="detailOnLoad">
                 <template slot="menuLeft">
-                    <el-button type="danger" size="small" plain icon="el-icon-delete" 
+                    <el-button type="danger" size="small" plain icon="el-icon-delete"
                         @click="handleDetailDelete" :disabled="detailSelectionList.length === 0">
                         删除
                     </el-button>
@@ -116,7 +116,42 @@ import leadIndexMixin from './mixins/leadIndex'
 
 export default {
     name: 'Lead',
-    mixins: [leadIndexMixin]
+    mixins: [leadIndexMixin],
+    watch: {
+      detailDialogVisible(visible) {
+        if (visible) {
+          this.injectErrorStyle();
+        } else {
+          this.removeErrorStyle();
+        }
+      }
+    },
+    methods: {
+      injectErrorStyle() {
+        const styleId = 'lead-error-style';
+        if (document.getElementById(styleId)) return;
+
+        const style = document.createElement('style');
+        style.id = styleId;
+        style.textContent = `
+          .el-form-item__error {
+            display: block !important;
+            position: static !important;
+            margin-top: 4px !important;
+            white-space: normal !important;
+            color: #f56c6c !important;
+          }
+        `;
+        document.head.appendChild(style);
+      },
+      removeErrorStyle() {
+        const styleId = 'lead-error-style';
+        const style = document.getElementById(styleId);
+        if (style) {
+          style.remove();
+        }
+      }
+    }
 }
 </script>
 
@@ -135,38 +170,38 @@ export default {
     border-radius: 4px;
     padding: 15px;
     background-color: #fff;
-    
+
     .info-row {
         display: flex;
         margin-bottom: 10px;
-        
+
         &:last-child {
             margin-bottom: 0;
         }
-        
+
         &.title-row {
             margin-top: 5px;
         }
     }
-    
+
     .info-item {
         flex: 1;
         padding: 0 10px;
-        
+
         &.full-width {
             flex: 3;
             width: 100%;
         }
-        
+
         .label {
             font-weight: bold;
             color: #606266;
             margin-right: 5px;
         }
-        
+
         .value {
             color: #303133;
-            
+
             &.title-value {
                 font-size: 16px;
             }
@@ -182,9 +217,10 @@ export default {
 }
 
 // 仅在本组件的弹层内,修正 Element UI 错误提示的定位与显示,确保可见
-.lead-detail-dialog .el-form-item__error {
+.el-form-item__error {
     display: block !important;
     position: static !important;
-    margin-top: 4px;
+    white-space: normal !important;
+    color: #f56c6c !important;
 }
-</style>
+</style>

+ 4 - 13
src/views/lead/mixins/leadIndex.js

@@ -420,11 +420,7 @@ export default {
                         label: '优先级',
                         prop: 'priority',
                         type: 'select',
-                        dicData: [
-                            { label: '高', value: 1 },
-                            { label: '中', value: 2 },
-                            { label: '低', value: 3 }
-                        ],
+                        dicData: LEAD_PRIORITY_OPTIONS,
                         rules: [{
                             required: true,
                             message: '请选择优先级',
@@ -463,11 +459,7 @@ export default {
                         label: '状态',
                         prop: 'status',
                         type: 'select',
-                        dicData: [
-                            { label: '新建', value: 1 },
-                            { label: '跟进中', value: 2 },
-                            { label: '已关闭', value: 3 }
-                        ],
+                        dicData: LEAD_STATUS_OPTIONS,
                         rules: [{
                             required: true,
                             message: '请选择状态',
@@ -1159,12 +1151,11 @@ export default {
         
         /**
          * 详细信息刷新变更
-         * @param {Object} page - 分页参数
          * @returns {void}
          * @this {LeadComponent & Vue}
          */
-        detailRefreshChange(page) {
-            this.detailOnLoad(page)
+        detailRefreshChange() {
+            this.detailOnLoad(this.detailPage)
         },
         
         /**

+ 4 - 4
src/views/lead/types.d.ts

@@ -9,7 +9,7 @@ export interface LeadRecord {
   createTime: string
   updateUser: string
   updateTime: string
-  status: number // 1-新建 2-跟进中 3-已关闭
+  status: number // 0-待处理 1-跟进中 2-已转化 3-已关闭
   isDeleted: number // 0-未删除 1-已删除
   leadCode: string
   customerId: number
@@ -19,7 +19,7 @@ export interface LeadRecord {
   contactPhone: string
   title: string
   endTime: string
-  priority: number // 1-高 2-中 3-低
+  priority: number // 1-低 2-中 3-高
   source: string
   groupName: string
   closeReason?: string | null
@@ -32,7 +32,7 @@ export interface LeadDetailRecord {
   createTime: string
   updateUser: string
   updateTime: string
-  status: number
+  status: number // 0-待处理 1-跟进中 2-已转化 3-已关闭
   isDeleted: number
   leadId: string
   followTime: string
@@ -48,7 +48,7 @@ export interface LeadQueryParams {
   contactName?: string
   contactPhone?: string
   title?: string
-  status?: number
+  status?: number // 0-待处理 1-跟进中 2-已转化 3-已关闭
   priority?: number
   source?: string
   groupName?: string