Skip to content

Commit

Permalink
add
Browse files Browse the repository at this point in the history
  • Loading branch information
itimor committed May 9, 2021
1 parent 82a581c commit 80426f6
Show file tree
Hide file tree
Showing 10 changed files with 53 additions and 113 deletions.
2 changes: 1 addition & 1 deletion backend/notices/migrations/0001_initial.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Generated by Django 3.0.3 on 2021-02-07 15:36
# Generated by Django 3.0.3 on 2021-05-09 08:31

from django.db import migrations, models

Expand Down
2 changes: 1 addition & 1 deletion backend/systems/migrations/0001_initial.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Generated by Django 3.0.3 on 2021-02-07 15:36
# Generated by Django 3.0.3 on 2021-05-09 08:31

import django.contrib.auth.models
from django.db import migrations, models
Expand Down
2 changes: 1 addition & 1 deletion backend/tickets/migrations/0001_initial.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Generated by Django 3.0.3 on 2021-02-07 15:36
# Generated by Django 3.0.3 on 2021-05-09 08:31

from django.conf import settings
from django.db import migrations, models
Expand Down
2 changes: 1 addition & 1 deletion backend/tools/migrations/0001_initial.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Generated by Django 3.0.3 on 2021-02-07 15:36
# Generated by Django 3.0.3 on 2021-05-09 08:31

from django.db import migrations, models
import tools.storage
Expand Down
47 changes: 34 additions & 13 deletions backend/workflows/migrations/0001_initial.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Generated by Django 3.0.3 on 2021-02-07 15:36
# Generated by Django 3.0.3 on 2021-05-09 08:31

from django.conf import settings
from django.db import migrations, models
Expand Down Expand Up @@ -63,6 +63,28 @@ class Migration(migrations.Migration):
'ordering': ['order_id'],
},
),
migrations.CreateModel(
name='Workflow',
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('create_time', models.DateTimeField(auto_now_add=True, verbose_name='创建时间')),
('update_time', models.DateTimeField(auto_now=True, verbose_name='更新时间')),
('memo', models.TextField(blank=True, verbose_name='备注')),
('name', models.CharField(max_length=50, verbose_name='名称')),
('key', models.CharField(blank=True, max_length=168, verbose_name='流程标识key')),
('ticket_sn_prefix', models.CharField(default='xxoo', max_length=20, verbose_name='工单流水号前缀')),
('status', models.BooleanField(default=True)),
('view_permission_check', models.BooleanField(default=True, help_text='开启后,只允许工单的关联人(创建人、曾经的处理人)有权限查看工单', verbose_name='查看权限校验')),
('limit_expression', models.TextField(blank=True, default='{}', help_text='限制周期({"period":24} 24小时), 限制次数({"count":1}在限制周期内只允许提交1次), 限制级别({"level":1} 针对(1单个用户 2全局)限制周期限制次数,默认特定用户);允许特定人员提交({"allow_persons":"zhangsan,lisi"}只允许张三提交工单,{"allow_depts":"1,2"}只允许部门id为1和2的用户提交工单,{"allow_roles":"1,2"}只允许角色id为1和2的用户提交工单)', verbose_name='限制表达式')),
('display_form_str', models.TextField(blank=True, default='[]', help_text='默认"[]",用于用户只有对应工单查看权限时显示哪些字段,field_key的list的json,如["days","sn"],内置特殊字段participant_info.participant_name:当前处理人信息(部门名称、角色名称),state.state_name:当前状态的状态名,workflow.workflow_name:工作流名称', verbose_name='展现表单字段')),
('title_template', models.CharField(blank=True, default='你有一个待办工单:{title}', help_text='工单字段的值可以作为参数写到模板中,格式如:你有一个待办工单:{title}', max_length=50, null=True, verbose_name='标题模板')),
('roles', models.ManyToManyField(blank=True, related_name='workflow_set', related_query_name='workflow', to='systems.Role', verbose_name='关联角色')),
],
options={
'verbose_name': '工作流',
'verbose_name_plural': '工作流',
},
),
migrations.CreateModel(
name='WorkflowType',
fields=[
Expand All @@ -82,27 +104,26 @@ class Migration(migrations.Migration):
},
),
migrations.CreateModel(
name='Workflow',
name='WorkflowBpmn',
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('create_time', models.DateTimeField(auto_now_add=True, verbose_name='创建时间')),
('update_time', models.DateTimeField(auto_now=True, verbose_name='更新时间')),
('memo', models.TextField(blank=True, verbose_name='备注')),
('name', models.CharField(max_length=50, verbose_name='名称')),
('ticket_sn_prefix', models.CharField(default='xxoo', max_length=20, verbose_name='工单流水号前缀')),
('status', models.BooleanField(default=True)),
('view_permission_check', models.BooleanField(default=True, help_text='开启后,只允许工单的关联人(创建人、曾经的处理人)有权限查看工单', verbose_name='查看权限校验')),
('limit_expression', models.TextField(blank=True, default='{}', help_text='限制周期({"period":24} 24小时), 限制次数({"count":1}在限制周期内只允许提交1次), 限制级别({"level":1} 针对(1单个用户 2全局)限制周期限制次数,默认特定用户);允许特定人员提交({"allow_persons":"zhangsan,lisi"}只允许张三提交工单,{"allow_depts":"1,2"}只允许部门id为1和2的用户提交工单,{"allow_roles":"1,2"}只允许角色id为1和2的用户提交工单)', verbose_name='限制表达式')),
('display_form_str', models.TextField(blank=True, default='[]', help_text='默认"[]",用于用户只有对应工单查看权限时显示哪些字段,field_key的list的json,如["days","sn"],内置特殊字段participant_info.participant_name:当前处理人信息(部门名称、角色名称),state.state_name:当前状态的状态名,workflow.workflow_name:工作流名称', verbose_name='展现表单字段')),
('title_template', models.CharField(blank=True, default='你有一个待办工单:{title}', help_text='工单字段的值可以作为参数写到模板中,格式如:你有一个待办工单:{title}', max_length=50, null=True, verbose_name='标题模板')),
('roles', models.ManyToManyField(blank=True, related_name='workflow_set', related_query_name='workflow', to='systems.Role', verbose_name='关联角色')),
('type', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='workflows.WorkflowType', verbose_name='工作流类型')),
('xml', models.TextField(blank=True, verbose_name='xml数据')),
('svg', models.TextField(blank=True, verbose_name='svg数据')),
('workflow', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='workflows.Workflow', verbose_name='工作流')),
],
options={
'verbose_name': '工作流',
'verbose_name_plural': '工作流',
'verbose_name': '工作流bpmn',
'verbose_name_plural': '工作流bpmn',
},
),
migrations.AddField(
model_name='workflow',
name='type',
field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='workflows.WorkflowType', verbose_name='工作流类型'),
),
migrations.CreateModel(
name='Transition',
fields=[
Expand Down
31 changes: 0 additions & 31 deletions backend/workflows/migrations/0002_workflowbpmn.py

This file was deleted.

28 changes: 0 additions & 28 deletions backend/workflows/migrations/0003_auto_20210209_1911.py

This file was deleted.

22 changes: 0 additions & 22 deletions backend/workflows/migrations/0004_auto_20210209_2102.py

This file was deleted.

26 changes: 13 additions & 13 deletions backend/workflows/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,19 +24,19 @@ def get_serializer_class(self):
return WorkflowReadSerializer
return WorkflowSerializer

def get_queryset(self):
try:
user = User.objects.get(username=self.request.user)
if user.is_admin:
return Workflow.objects.all()
else:
user_roles = user.roles.all()
group_roles = user.group.roles.all()
all_roles = sorted(chain(user_roles, group_roles), key=lambda t: t.id, reverse=True)
return Workflow.objects.filter(roles__in=all_roles).distinct()
except Exception as e:
print(e)
return Workflow.objects.all()
# def get_queryset(self):
# try:
# user = User.objects.get(username=self.request.user)
# if user.is_admin:
# return Workflow.objects.all()
# else:
# user_roles = user.roles.all()
# group_roles = user.group.roles.all()
# all_roles = sorted(chain(user_roles, group_roles), key=lambda t: t.id, reverse=True)
# return Workflow.objects.filter(roles__in=all_roles).distinct()
# except Exception as e:
# print(e)
# return Workflow.objects.all()


class StateViewSet(BulkModelMixin):
Expand Down
4 changes: 2 additions & 2 deletions frontend/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -44,11 +44,11 @@
"fibers": "^5.0.0",
"path-to-regexp": "^6.1.0",
"vue": "^2.6.11",
"vue-bpmn-modeler": "^1.2.0",
"vue-i18n": "^8.15.0",
"vue-markdown": "^2.2.4",
"vue-route": "^1.5.1",
"vuex": "^3.1.1",
"workflow-bpmn-modeler": "^0.2.7"
"vuex": "^3.1.1"
},
"devDependencies": {
"@babel/core": "7.0.0",
Expand Down

0 comments on commit 80426f6

Please sign in to comment.