Преглед изворни кода

Merge remote-tracking branch 'origin/master'

# Conflicts:
#	uis/views/customer/index.html
wushaodong пре 4 година
родитељ
комит
cc797dff39

+ 3 - 2
apps/customer/filters.py

@@ -3,6 +3,7 @@ import django_filters
 
 from .models import ReportCustomer, NewCustomer, Review
 
+
 class ReportCustomerFilter(django_filters.FilterSet):
     name = django_filters.CharFilter(field_name='name', lookup_expr='icontains')
     tel = django_filters.CharFilter(field_name='tel', lookup_expr='icontains')
@@ -13,8 +14,8 @@ class ReportCustomerFilter(django_filters.FilterSet):
 
 
 class NewCustomerFilter(django_filters.FilterSet):
-    name = django_filters.CharFilter(field_name='report_customer__name', lookup_expr='icontains')
-    tel = django_filters.CharFilter(field_name='report_customer__tel', lookup_expr='icontains')
+    name = django_filters.CharFilter(field_name='name', lookup_expr='icontains')
+    tel = django_filters.CharFilter(field_name='tel', lookup_expr='icontains')
 
     class Meta:
         model = NewCustomer

+ 1 - 0
apps/customer/serializers.py

@@ -177,6 +177,7 @@ class ReviewSerializer(serializers.ModelSerializer):
     tel = serializers.CharField(source='customer.tel', read_only=True)
     village = serializers.CharField(source='customer.village', read_only=True)
     address = serializers.CharField(source='customer.address', read_only=True)
+    stage_progress_text = serializers.CharField(source='customer.stage_progress.name', read_only=True)
     project_text = serializers.SerializerMethodField()
 
     def get_project_text(self, obj):

+ 4 - 0
apps/customer/views.py

@@ -19,6 +19,7 @@ from .filters import ReportCustomerFilter,NewCustomerFilter,ReviewFilter
 from django.contrib.auth import get_user_model
 User = get_user_model()
 
+
 class ReportCustomerViewSet(CustomModelViewSet):
     permission_classes = [isLogin]
     queryset = ReportCustomer.objects.filter()
@@ -132,6 +133,7 @@ class ReportCustomerDictView(APIView):
             'level': serializer_level.data,
         })
 
+
 class UserDictView(APIView):
     permission_classes = [isLogin]
 
@@ -216,6 +218,7 @@ class NewCustomerViewSet(CustomModelViewSet):
             return response_error(str(e))
         return response_ok()
 
+
 class StageCountView(APIView):
     permission_classes = [isLogin]
 
@@ -238,6 +241,7 @@ class StageCountView(APIView):
             data.append(stage_count)
         return response_ok(data)
 
+
 class ReviewViewSet(CustomModelViewSet):
     permission_classes = [isLogin]
     queryset = Review.objects.filter()

+ 14 - 7
uis/views/customer/detail.html

@@ -56,6 +56,12 @@
               <td style="background: #f8f8f8; width: 70px">来源:</td>
               <td>{{ d.source_text }}</td>
             </tr>
+            <tr>
+              <td style="background: #f8f8f8; width: 70px">项目:</td>
+              <td>{{ d.project_text }}</td>
+              <td style="background: #f8f8f8; width: 70px">阶段进度:</td>
+              <td>{{ d.stage_progress_text }}</td>
+            </tr>
             <tr>
               <td style="background: #f8f8f8; width: 70px">备注:</td>
               <td colspan="3">{{ d.notes || ""}}</td>
@@ -87,16 +93,17 @@
         laytpl(getTpl).render(data, function(html){
           tableDom.innerHTML = html;
         });
+        var id = layui.view.getParameterByName('customer');
         table.render({
             elem: '#customer_datagrid'
-            , url: '/api/dataTable.json'
+            , url: '/customer/review/?customer=' + id
             , cols: [[
-                {field: 'follow_user', title: '跟踪人', width: 100}
-                , {field: 'follow_time', title: "跟踪时间", width: 110}
-                , {field: 'connect_status', title: '沟通情况', width: 100}
-                , {field: 'rank', title: '客户级别', width: 100}
-                , {field: 'application', title: '申请事项', width: 200}
-                , {field: 'check_status', title: '审核状态', width: 100}
+                {field: 'create_user_text', title: '跟踪人', width: 100}
+                , {field: 'create_time_f', title: "跟踪时间", width: 150}
+                , {field: 'description', title: '回访情况', width: 200}
+                , {field: 'stage_progress_text', title: "客户级别", width: 150}
+                , {field: 'project_text', title: '申请項目', width: 150}
+                , {field: 'check_status_text', title: '审核状态', width: 100}
             ]]
             , page: true
         });

+ 5 - 3
uis/views/customer/index.html

@@ -113,6 +113,8 @@
                         <div class="layui-btn-group">
                             <a class="layui-btn layui-btn-xs" lay-event="customer_search"
                             >查看</a>
+                        </div>
+                        <div class="layui-btn-group">
                             <a class="layui-btn layui-btn-xs layui-btn-normal" lay-event="add_review"
                                data-permission="customer.view_new_customer"
                             >跟踪报告</a>
@@ -161,7 +163,7 @@
                 , {field: 'stage_progress_text', title: '阶段进度', width: 100}
                 , {field: 'potential_level_text', title: '客户级别', width: 100}
                 , {field: 'status_text', title: '状态', width: 60}
-                , {field: 'track_user_text', title: '跟踪人', width: 100}
+                , {field: 'track_user_text', title: '跟踪人', width: 120}
                 , {field: 'end_time_f', title: '最后跟踪时间', width: 150}
                 , {field: 'last_review', title: '最后跟踪情况', width: 200}
                 , {field: 'next_time_f', title: '下次跟踪时间', width: 120}
@@ -171,7 +173,7 @@
                 , {field: 'create_time_f', title: '建档时间', width: 150}
                 , {field: 'create_user_text', title: '建档人', width: 100}
                 , {field: 'notes', title: '备注', width: 200}
-                , {width: 130, align: 'center', fixed: 'right', toolbar: '#customer-operate-bar'}
+                , {width: 170, align: 'center', fixed: 'right', toolbar: '#customer-operate-bar'}
             ]]
             , page: true
             , height: 'full-108'
@@ -222,7 +224,7 @@
                         //取消
                         layer.close(index);//关闭当前按钮
                     },
-                    content: 'detail.html?customer='+data.id
+                    content: 'detail.html?customer=' + data.id
                 });
             } else if (obj.event === 'add_review') {
                 //添加跟踪报告