add message
This commit is contained in:
parent
3ec3dd1d64
commit
62fcbe61f8
|
@ -9,6 +9,9 @@
|
||||||
<div class="col-xs-12">
|
<div class="col-xs-12">
|
||||||
<div id="chart2" style="width: 100%%;height:400px;margin:10px;"></div>
|
<div id="chart2" style="width: 100%%;height:400px;margin:10px;"></div>
|
||||||
</div>
|
</div>
|
||||||
|
<div class="col-xs-12">
|
||||||
|
<div id="chart3" style="width: 100%%;height:400px;margin:10px;"></div>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
{% endblock%}
|
{% endblock%}
|
||||||
|
@ -55,7 +58,6 @@
|
||||||
var option2 = {
|
var option2 = {
|
||||||
title: {
|
title: {
|
||||||
text: '政务新媒体区域分布',
|
text: '政务新媒体区域分布',
|
||||||
subtext: '省直部门{{total1}},市直部门{{total2}},县区政府{{total3}}',
|
|
||||||
subtextStyle: {
|
subtextStyle: {
|
||||||
fontSize: 16,
|
fontSize: 16,
|
||||||
},
|
},
|
||||||
|
@ -87,5 +89,41 @@
|
||||||
]};
|
]};
|
||||||
|
|
||||||
myChart2.setOption(option2);
|
myChart2.setOption(option2);
|
||||||
|
|
||||||
|
var myChart3 = echarts.init(document.getElementById('chart3'));
|
||||||
|
var option3 = {
|
||||||
|
title: {
|
||||||
|
text: '政务新媒体省址、市州和县区分布',
|
||||||
|
subtextStyle: {
|
||||||
|
fontSize: 16,
|
||||||
|
},
|
||||||
|
left: 'center'
|
||||||
|
},
|
||||||
|
tooltip: {
|
||||||
|
trigger: 'item',
|
||||||
|
formatter: '{a} <br/>{b} : {c} ({d}%)'
|
||||||
|
},
|
||||||
|
legend: {
|
||||||
|
top: '15%',
|
||||||
|
data: ['省直各部门', '市州政府及部门', '县区政府及部门、乡镇']
|
||||||
|
},
|
||||||
|
series: [
|
||||||
|
{
|
||||||
|
name: '总量',
|
||||||
|
type: 'pie',
|
||||||
|
radius: '50%',
|
||||||
|
center: ['50%', '70%'],
|
||||||
|
data: {{chart3_data|safe}},
|
||||||
|
emphasis: {
|
||||||
|
itemStyle: {
|
||||||
|
shadowBlur: 10,
|
||||||
|
shadowOffsetX: 0,
|
||||||
|
shadowColor: 'rgba(0, 0, 0, 0.5)'
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]};
|
||||||
|
|
||||||
|
myChart3.setOption(option3);
|
||||||
</script>
|
</script>
|
||||||
{% endblock %}
|
{% endblock %}
|
|
@ -42,6 +42,8 @@ urlpatterns = [
|
||||||
name='polls_compartments_list'),
|
name='polls_compartments_list'),
|
||||||
path('organizations/list/', views.organizations,
|
path('organizations/list/', views.organizations,
|
||||||
name='polls_organizations_list'),
|
name='polls_organizations_list'),
|
||||||
|
path('organizations/level/', views.organization_level,
|
||||||
|
name='polls_organization_level'),
|
||||||
path('messages/list/last/', views.last_messages,
|
path('messages/list/last/', views.last_messages,
|
||||||
name='polls_messages_list_last'),
|
name='polls_messages_list_last'),
|
||||||
path('messages/send/text/', views.send_text_message,
|
path('messages/send/text/', views.send_text_message,
|
||||||
|
|
|
@ -6,5 +6,5 @@ from .monitor import monitor_statistics, monitor_result
|
||||||
from .task import tasks, create_task, create_test_task
|
from .task import tasks, create_task, create_test_task
|
||||||
from .group import groups, room
|
from .group import groups, room
|
||||||
from .compartment import compartments
|
from .compartment import compartments
|
||||||
from .organizations import organizations
|
from .organizations import organizations, organization_level
|
||||||
from .message import last_messages, send_text_message
|
from .message import last_messages, send_text_message
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
|
@ -102,8 +102,11 @@ def monitor_statistics(request):
|
||||||
total1 = NewMedia.category_one_count()
|
total1 = NewMedia.category_one_count()
|
||||||
total2 = NewMedia.category_two_count()
|
total2 = NewMedia.category_two_count()
|
||||||
total3 = NewMedia.category_three_count()
|
total3 = NewMedia.category_three_count()
|
||||||
|
chart3_data = []
|
||||||
return render(request, 'polls/monitor_statistics.html', {'chart1_data': chart1_data, 'total': total, 'chart2_data': chart2_data, 'total1': total1, 'total2': total2, 'total3': total3})
|
chart3_data.append({'name': '省直各部门', 'value': total1})
|
||||||
|
chart3_data.append({'name': '市州政府及部门', 'value': total2})
|
||||||
|
chart3_data.append({'name': '县区政府及部门、乡镇', 'value': total3})
|
||||||
|
return render(request, 'polls/monitor_statistics.html', {'chart1_data': chart1_data, 'total': total, 'chart2_data': chart2_data, 'chart3_data': chart3_data})
|
||||||
|
|
||||||
|
|
||||||
def monitor_result(request):
|
def monitor_result(request):
|
||||||
|
|
|
@ -8,13 +8,14 @@ from polls.decorators import polls_login_required
|
||||||
from polls.models import Notice
|
from polls.models import Notice
|
||||||
from django.core.exceptions import ObjectDoesNotExist
|
from django.core.exceptions import ObjectDoesNotExist
|
||||||
|
|
||||||
|
|
||||||
@csrf_exempt
|
@csrf_exempt
|
||||||
@polls_login_required
|
@polls_login_required
|
||||||
def notices(request):
|
def notices(request):
|
||||||
if request.method == 'POST':
|
if request.method == 'POST':
|
||||||
return HttpResponse(status=405)
|
return HttpResponse(status=405)
|
||||||
id = request.user.id
|
id = request.user.id
|
||||||
notices = Notice.objects.filter(user__id=id,is_read=False)
|
notices = Notice.objects.filter(user__id=id, is_read=False)
|
||||||
results = []
|
results = []
|
||||||
for o in notices:
|
for o in notices:
|
||||||
result = dict()
|
result = dict()
|
||||||
|
@ -23,7 +24,7 @@ def notices(request):
|
||||||
result['content'] = o.content
|
result['content'] = o.content
|
||||||
result['added'] = o.added.strftime("%Y-%m-%d %H:%M:%S")
|
result['added'] = o.added.strftime("%Y-%m-%d %H:%M:%S")
|
||||||
results.append(result)
|
results.append(result)
|
||||||
return JsonResponse({'status': 'success', 'message':results}, safe=False)
|
return JsonResponse({'status': 'success', 'message': results}, safe=False)
|
||||||
|
|
||||||
|
|
||||||
@csrf_exempt
|
@csrf_exempt
|
||||||
|
@ -32,7 +33,7 @@ def notice_top(request):
|
||||||
if request.method == 'POST':
|
if request.method == 'POST':
|
||||||
return HttpResponse(status=405)
|
return HttpResponse(status=405)
|
||||||
id = request.user.id
|
id = request.user.id
|
||||||
notices = Notice.objects.filter(user__id=id,is_read=False)[:10]
|
notices = Notice.objects.filter(user__id=id, is_read=False)[:10]
|
||||||
results = []
|
results = []
|
||||||
for o in notices:
|
for o in notices:
|
||||||
result = dict()
|
result = dict()
|
||||||
|
@ -41,7 +42,7 @@ def notice_top(request):
|
||||||
result['content'] = o.content
|
result['content'] = o.content
|
||||||
result['added'] = o.added.strftime("%Y-%m-%d %H:%M:%S")
|
result['added'] = o.added.strftime("%Y-%m-%d %H:%M:%S")
|
||||||
results.append(result)
|
results.append(result)
|
||||||
return JsonResponse({'status': 'success', 'message':results}, safe=False)
|
return JsonResponse({'status': 'success', 'message': results}, safe=False)
|
||||||
|
|
||||||
|
|
||||||
@csrf_exempt
|
@csrf_exempt
|
||||||
|
@ -74,8 +75,16 @@ def detail_notice(request, notice_id):
|
||||||
notice = Notice.objects.get(id=notice_id)
|
notice = Notice.objects.get(id=notice_id)
|
||||||
results = dict()
|
results = dict()
|
||||||
results['id'] = notice.id
|
results['id'] = notice.id
|
||||||
|
results['category'] = notice.type
|
||||||
|
results['content'] = notice.content
|
||||||
|
results['app'] = notice.app
|
||||||
|
results['model'] = notice.model
|
||||||
|
results['field'] = notice.field
|
||||||
|
results['record_id'] = notice.record_id
|
||||||
|
results['record_pass_value'] = notice.record_pass_value
|
||||||
|
results['record_reject_value'] = notice.record_reject_value
|
||||||
|
results['added'] = notice.added.strftime("%Y-%m-%d %H:%M:%S")
|
||||||
|
result['updated'] = notice.updated.strftime("%Y-%m-%d %H:%M:%S")
|
||||||
return JsonResponse({'status': 'success', 'message': results})
|
return JsonResponse({'status': 'success', 'message': results})
|
||||||
except ObjectDoesNotExist:
|
except ObjectDoesNotExist:
|
||||||
return JsonResponse({'status': 'error', 'message': '通知ID错误'})
|
return JsonResponse({'status': 'error', 'message': '通知ID错误'})
|
||||||
|
@ -98,4 +107,4 @@ def reply_notice(request):
|
||||||
m.save(update_fields=[notice.field])
|
m.save(update_fields=[notice.field])
|
||||||
return JsonResponse({'status': 'success'})
|
return JsonResponse({'status': 'success'})
|
||||||
except ObjectDoesNotExist:
|
except ObjectDoesNotExist:
|
||||||
return JsonResponse({'status': 'error', 'message': '通知ID错误'})
|
return JsonResponse({'status': 'error', 'message': '通知ID错误'})
|
||||||
|
|
|
@ -42,5 +42,19 @@ def organizations(request):
|
||||||
result['cities'] = o.cities
|
result['cities'] = o.cities
|
||||||
result['district'] = o.district
|
result['district'] = o.district
|
||||||
results.append(result)
|
results.append(result)
|
||||||
|
return JsonResponse({'status': 'success', 'message': results}, safe=False)
|
||||||
return JsonResponse({'status': 'success', 'message': results}, safe=False)
|
|
||||||
|
|
||||||
|
@csrf_exempt
|
||||||
|
@polls_login_required
|
||||||
|
def organization_level(request):
|
||||||
|
profile = request.user.userprofile_set.first()
|
||||||
|
if not profile:
|
||||||
|
return JsonResponse({'status': 'error', 'message': '账户错误'})
|
||||||
|
organization = profile.organization
|
||||||
|
if not organization:
|
||||||
|
return JsonResponse({'status': 'error', 'message': '机构错误'})
|
||||||
|
level = organization.level.level
|
||||||
|
if not level:
|
||||||
|
return JsonResponse({'status': 'error', 'message': '权限错误'})
|
||||||
|
return JsonResponse({'status': 'success', 'message': {'level': level, 'organization_id': organization.id}}, safe=False)
|
||||||
|
|
Loading…
Reference in New Issue