diff --git a/test_client/src/views/crm/consumer.vue b/test_client/src/views/crm/consumer.vue
index ffd0df9..13f2caf 100644
--- a/test_client/src/views/crm/consumer.vue
+++ b/test_client/src/views/crm/consumer.vue
@@ -1,6 +1,22 @@
+
+
+
刷新重置
- 创建时间
新增
@@ -111,8 +121,14 @@
Excel导入
-
导出Excel
-
批量删除
+
导出Excel
+
批量删除
+
创建信息
{{ scope.row.workscope_name }}
-
+
+ {{ scope.row.create_admin_.username }}/
{{ scope.row.create_time }}
@@ -285,6 +302,7 @@ import { getCompanyList } from "@/api/crm";
import { genTree, deepClone } from "@/utils";
import checkPermission from "@/utils/permission";
import { upUrl } from "@/api/file";
+import { getUserList } from "@/api/user"
import { getToken } from "@/utils/auth";
import Pagination from "@/components/Pagination"; // secondary package based on el-pagination
@@ -312,7 +330,7 @@ export default {
data() {
return {
tableKey: 0,
- showCreate: false,
+ showCreate: true,
upUrl: upUrl(),
popovervisible: false,
consumer: defaultConsumer,
@@ -334,11 +352,17 @@ export default {
rule1: {
name: [{ required: true, message: "请输入姓名", trigger: "blur" }],
username: [
- { required: true, message: "请输入手机号", trigger: "change" }
+ { required: true, message: "请输入手机号", trigger: "change", pattern: /^1[34578]\d{9}$/, }
],
role: [
{ required: true, message: "请选择", trigger: "change" }
],
+ workscope: [
+ { required: true, message: "请选择", trigger: "change"}
+ ],
+ subjects: [
+ { required: true, message: "请选择", trigger: "change"}
+ ]
},
filterOrgText: "",
treeLoding: false,
@@ -383,6 +407,7 @@ export default {
}]
},
datevalue: '',
+ adminOptions:[]
};
},
computed: {},
@@ -395,6 +420,7 @@ export default {
this.getSubjectAll()
this.getWorkScopeAll()
this.getConsumerRoleAll()
+ this.getAdminOptions()
},
methods: {
checkPermission,
@@ -627,6 +653,13 @@ export default {
this.listQuery.max_create = this.datevalue[1],
this.getList()
},
+ getAdminOptions(){
+ if(checkPermission(['admin'])){
+ getUserList().then(res=>{
+ this.adminOptions = genTree(res.data.results)
+ })
+ }
+ }
}
};
diff --git a/test_server/crm/filters.py b/test_server/crm/filters.py
index d5a7cde..eb5c305 100644
--- a/test_server/crm/filters.py
+++ b/test_server/crm/filters.py
@@ -8,4 +8,4 @@ class ConsumerFilter(filters.FilterSet):
class Meta:
model = Consumer
- fields = ['company', 'role', 'min_create', 'max_create']
\ No newline at end of file
+ fields = ['company', 'role', 'min_create', 'max_create', 'create_admin']
\ No newline at end of file
diff --git a/test_server/crm/serializers.py b/test_server/crm/serializers.py
index 54a20aa..789806d 100644
--- a/test_server/crm/serializers.py
+++ b/test_server/crm/serializers.py
@@ -2,6 +2,7 @@ from rest_framework import serializers
from .models import Company, Consumer, PaySubject, ConsumerPerm, ConsumerRole
from question.models import Question, Questioncat
from .permission import get_consumerperm_list
+from rbac.serializers.user_serializer import UserListSerializer
class ConsumerPermSerializer(serializers.ModelSerializer):
@@ -35,6 +36,7 @@ class ConsumerSerializer(serializers.ModelSerializer):
subjects_name = serializers.StringRelatedField(source='subjects', many=True, read_only=True)
workscope_name = serializers.StringRelatedField(source='workscope', read_only=True)
role_name = serializers.StringRelatedField(source='role', read_only=True)
+ create_admin_ = UserListSerializer(source='create_admin')
class Meta:
model = Consumer
exclude = ('avatar','collects', 'process')
@@ -42,7 +44,7 @@ class ConsumerSerializer(serializers.ModelSerializer):
@staticmethod
def setup_eager_loading(queryset):
""" Perform necessary eager loading of data. """
- queryset = queryset.select_related('company','workscope', 'role')
+ queryset = queryset.select_related('company','workscope', 'role', 'create_admin')
queryset = queryset.prefetch_related('subjects',)
return queryset