公司级别等
This commit is contained in:
parent
60b84ab310
commit
c8b26e675a
|
@ -28,6 +28,9 @@ const mutations = {
|
|||
},
|
||||
SET_PERMS: (state, perms) => {
|
||||
state.perms = perms
|
||||
},
|
||||
SET_DEPT: (state, dept) => {
|
||||
state.dept = dept
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -100,7 +103,7 @@ const actions = {
|
|||
reject('验证失败,重新登陆.')
|
||||
}
|
||||
|
||||
const { perms, name, avatar } = data
|
||||
const { perms, name, avatar, dept } = data
|
||||
|
||||
// perms must be a non-empty array
|
||||
if (!perms || perms.length <= 0) {
|
||||
|
@ -110,6 +113,7 @@ const actions = {
|
|||
commit('SET_PERMS', perms)
|
||||
commit('SET_NAME', name)
|
||||
commit('SET_AVATAR', avatar)
|
||||
commit('SET_DEPT', dept)
|
||||
resolve(data)
|
||||
}).catch(error => {
|
||||
reject(error)
|
||||
|
|
|
@ -219,7 +219,8 @@
|
|||
<el-link
|
||||
v-if="
|
||||
scope.row.state == '已上报' &&
|
||||
checkPermission(['record_reject'])
|
||||
checkPermission(['record_reject']) &&
|
||||
scope.row.belong_dept != $store.state.user.dept
|
||||
"
|
||||
type="danger"
|
||||
size="small"
|
||||
|
|
|
@ -24,11 +24,12 @@
|
|||
</div>
|
||||
<div class="ma" v-if="record.task_">
|
||||
<span class="term">报送要求/备注</span>
|
||||
<span class="desc" v-if = "data.action != 'update'">{{ record.note }}</span>
|
||||
<el-input
|
||||
v-model="record.note"
|
||||
placeholder=""
|
||||
type="textarea"
|
||||
:readonly="data.action != 'update' && data.action != 'reject'"
|
||||
v-else
|
||||
>
|
||||
</el-input>
|
||||
</div>
|
||||
|
@ -42,11 +43,12 @@
|
|||
</div>
|
||||
<div class="ma">
|
||||
<span class="term">上报说明</span>
|
||||
<span class="desc" v-if = "data.action != 'up'">{{ record.noteb }}</span>
|
||||
<el-input
|
||||
v-model="record.noteb"
|
||||
placeholder=""
|
||||
type="textarea"
|
||||
:readonly="data.action != 'up'"
|
||||
v-else
|
||||
>
|
||||
</el-input>
|
||||
</div>
|
||||
|
@ -57,6 +59,17 @@
|
|||
:disabled="data.action == 'view'"
|
||||
></el-switch>
|
||||
</div>
|
||||
<div class="ma" >
|
||||
<span class="term">修改意见</span>
|
||||
<span class="desc" v-if = "data.action != 'reject'">{{ record.opinion }}</span>
|
||||
<el-input
|
||||
v-model="record.opinion"
|
||||
placeholder=""
|
||||
type="textarea"
|
||||
v-else
|
||||
>
|
||||
</el-input>
|
||||
</div>
|
||||
<div class="ma">
|
||||
<span class="term">已上传文件</span>
|
||||
</div>
|
||||
|
|
|
@ -104,7 +104,9 @@
|
|||
<el-table-column label="公司名称">
|
||||
<template slot-scope="scope" v-if="scope.row.dept_">{{
|
||||
scope.row.dept_.name
|
||||
}}</template>
|
||||
}}
|
||||
<span style="color:darkblue">{{scope.row.dept_.type_name}}</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="上报率">
|
||||
<template slot-scope="scope"> {{ scope.row.up_rate }}% </template>
|
||||
|
|
|
@ -31,11 +31,11 @@
|
|||
:tree-props="{ children: 'children', hasChildren: 'hasChildren' }"
|
||||
>
|
||||
<el-table-column type="index" width="50" />
|
||||
<el-table-column label="组织名称">
|
||||
<el-table-column label="组织名称" width="400">
|
||||
<template slot-scope="scope">{{ scope.row.name }}</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="组织类型">
|
||||
<template slot-scope="scope">{{ scope.row.type }}</template>
|
||||
<template slot-scope="scope">{{ scope.row.type_name }}</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="配置">
|
||||
<template slot-scope="scope">
|
||||
|
@ -95,9 +95,9 @@
|
|||
<el-select v-model="org.type" placeholder="请选择">
|
||||
<el-option
|
||||
v-for="item in DeptTypeoptions"
|
||||
:key="item.value"
|
||||
:label="item.label"
|
||||
:value="item.value">
|
||||
:key="item.id"
|
||||
:label="item.name"
|
||||
:value="item.id">
|
||||
</el-option>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
|
@ -118,6 +118,7 @@
|
|||
|
||||
<script>
|
||||
import { getOrgAll, createOrg, deleteOrg, updateOrg } from "@/api/org";
|
||||
import { getDictList } from "@/api/dict";
|
||||
import { genTree } from "@/utils";
|
||||
import checkPermission from "@/utils/permission";
|
||||
import Treeselect from "@riophae/vue-treeselect";
|
||||
|
@ -148,24 +149,21 @@ export default {
|
|||
name: [{ required: true, message: "请输入名称", trigger: "blur" }],
|
||||
pid: [{ required: true, message: "请选择上级", trigger: "change" }],
|
||||
},
|
||||
DeptTypeoptions: [
|
||||
{
|
||||
value: "公司",
|
||||
label: "公司",
|
||||
},
|
||||
{
|
||||
value: "部门",
|
||||
label: "部门",
|
||||
},
|
||||
],
|
||||
DeptTypeoptions: [],
|
||||
};
|
||||
},
|
||||
computed: {},
|
||||
created() {
|
||||
this.getList();
|
||||
this.getDepttypeOptions();
|
||||
},
|
||||
methods: {
|
||||
checkPermission,
|
||||
getDepttypeOptions() {
|
||||
getDictList({type__code:'org_type', is_used:true}).then(res=>{
|
||||
this.DeptTypeoptions = res.data
|
||||
})
|
||||
},
|
||||
getList() {
|
||||
this.listLoading = true;
|
||||
getOrgAll().then((response) => {
|
||||
|
|
|
@ -0,0 +1,18 @@
|
|||
# Generated by Django 3.0.5 on 2021-03-31 00:31
|
||||
|
||||
from django.db import migrations, models
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('supervision', '0014_auto_20210330_1557'),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.AddField(
|
||||
model_name='record',
|
||||
name='opinion',
|
||||
field=models.TextField(blank=True, null=True, verbose_name='修改意见'),
|
||||
),
|
||||
]
|
|
@ -0,0 +1,18 @@
|
|||
# Generated by Django 3.0.5 on 2021-03-31 00:31
|
||||
|
||||
from django.db import migrations, models
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('system', '0009_organization_can_supervision'),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.AlterField(
|
||||
model_name='organization',
|
||||
name='sort',
|
||||
field=models.CharField(default='', max_length=100, verbose_name='排序'),
|
||||
),
|
||||
]
|
|
@ -0,0 +1,19 @@
|
|||
# Generated by Django 3.0.5 on 2021-03-31 00:42
|
||||
|
||||
from django.db import migrations, models
|
||||
import django.db.models.deletion
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('system', '0010_auto_20210331_0831'),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.AlterField(
|
||||
model_name='organization',
|
||||
name='type',
|
||||
field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, to='system.Dict', verbose_name='公司类型'),
|
||||
),
|
||||
]
|
|
@ -0,0 +1,19 @@
|
|||
# Generated by Django 3.0.5 on 2021-03-31 00:49
|
||||
|
||||
from django.db import migrations, models
|
||||
import django.db.models.deletion
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('system', '0011_auto_20210331_0842'),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.AlterField(
|
||||
model_name='organization',
|
||||
name='type',
|
||||
field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, to='system.Dict', verbose_name='组织类型'),
|
||||
),
|
||||
]
|
|
@ -0,0 +1,17 @@
|
|||
# Generated by Django 3.0.5 on 2021-03-31 00:50
|
||||
|
||||
from django.db import migrations
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('system', '0012_auto_20210331_0849'),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.RemoveField(
|
||||
model_name='organization',
|
||||
name='type',
|
||||
),
|
||||
]
|
|
@ -0,0 +1,19 @@
|
|||
# Generated by Django 3.0.5 on 2021-03-31 00:54
|
||||
|
||||
from django.db import migrations, models
|
||||
import django.db.models.deletion
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('system', '0013_remove_organization_type'),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.AddField(
|
||||
model_name='organization',
|
||||
name='type',
|
||||
field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, to='system.Dict', verbose_name='组织类型'),
|
||||
),
|
||||
]
|
|
@ -0,0 +1,21 @@
|
|||
# Generated by Django 3.0.5 on 2021-03-31 01:06
|
||||
|
||||
from django.db import migrations
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('system', '0014_organization_type'),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.RemoveField(
|
||||
model_name='dict',
|
||||
name='enabled',
|
||||
),
|
||||
migrations.RemoveField(
|
||||
model_name='historicaldict',
|
||||
name='enabled',
|
||||
),
|
||||
]
|
|
@ -55,13 +55,8 @@ class Organization(SoftModel):
|
|||
"""
|
||||
组织架构
|
||||
"""
|
||||
organization_type_choices = (
|
||||
('公司', '公司'),
|
||||
('部门', '部门')
|
||||
)
|
||||
name = models.CharField('名称', max_length=60)
|
||||
type = models.CharField('类型', max_length=20,
|
||||
choices=organization_type_choices, default='部门')
|
||||
type = models.ForeignKey('system.dict', verbose_name='组织类型', null=True, blank=True, on_delete=models.SET_NULL)
|
||||
pid = models.ForeignKey('self', null=True, blank=True,
|
||||
on_delete=models.SET_NULL, verbose_name='父')
|
||||
sort = models.CharField('排序', default="", max_length=100)
|
||||
|
@ -151,7 +146,6 @@ class Dict(SoftModel):
|
|||
name = models.CharField('名称', max_length=30, unique=True)
|
||||
code = models.CharField('代码', max_length=30, null=True, blank=True)
|
||||
desc = models.TextField('描述', blank=True, null=True)
|
||||
enabled = models.BooleanField('是否有效', default=True)
|
||||
type = models.ForeignKey(
|
||||
DictType, on_delete=models.CASCADE, verbose_name='类型')
|
||||
sort = models.IntegerField('排序', default=1)
|
||||
|
|
|
@ -70,8 +70,8 @@ class OrganizationSerializer(serializers.ModelSerializer):
|
|||
"""
|
||||
组织架构序列化
|
||||
"""
|
||||
type = serializers.ChoiceField(choices=Organization.organization_type_choices, default='部门')
|
||||
|
||||
# type = serializers.ChoiceField(choices=Dict.objects.filter(type__code='org_type').values_list('id','name'))
|
||||
type_name = serializers.StringRelatedField(source='type', read_only=True)
|
||||
class Meta:
|
||||
model = Organization
|
||||
fields = '__all__'
|
||||
|
@ -144,9 +144,10 @@ class UserSimpleSerializer(serializers.ModelSerializer):
|
|||
fields = ['id', 'name', 'username']
|
||||
|
||||
class OrganizationSimpleSerializer(serializers.ModelSerializer):
|
||||
type_name = serializers.StringRelatedField(source='type', read_only=True)
|
||||
class Meta:
|
||||
model = Organization
|
||||
fields = ['id', 'name']
|
||||
fields = ['id', 'name', 'type_name']
|
||||
|
||||
class FileSimpleSerializer(serializers.ModelSerializer):
|
||||
class Meta:
|
||||
|
|
|
@ -126,7 +126,7 @@ class DictTypeViewSet(ModelViewSet):
|
|||
queryset = DictType.objects.all()
|
||||
serializer_class = DictTypeSerializer
|
||||
pagination_class = None
|
||||
search_fields = ['^name']
|
||||
search_fields = ['name']
|
||||
ordering_fields = ['id']
|
||||
ordering = 'id'
|
||||
|
||||
|
@ -139,7 +139,8 @@ class DictViewSet(ModelViewSet):
|
|||
'put': 'dict_update', 'delete': 'dict_delete'}
|
||||
queryset = Dict.objects.all()
|
||||
serializer_class = DictSerializer
|
||||
search_fields = ['^name']
|
||||
search_fields = ['name', 'code']
|
||||
filterset_fields = ['type__code', 'type', 'is_used']
|
||||
ordering_fields = ['id']
|
||||
ordering = 'id'
|
||||
def paginate_queryset(self, queryset):
|
||||
|
@ -163,7 +164,7 @@ class PositionViewSet(ModelViewSet):
|
|||
queryset = Position.objects.all()
|
||||
serializer_class = PositionSerializer
|
||||
pagination_class = None
|
||||
search_fields = ['^name']
|
||||
search_fields = ['name']
|
||||
ordering_fields = ['id']
|
||||
ordering = 'id'
|
||||
|
||||
|
@ -291,7 +292,7 @@ class UserViewSet(ModelViewSet):
|
|||
'id': user.id,
|
||||
'username': user.username,
|
||||
'name': user.name,
|
||||
'dept': user.dept,
|
||||
'dept': user.dept.pk,
|
||||
'roles': user.roles.all().values_list('name', flat=True),
|
||||
# 'avatar': request._request._current_scheme_host + '/media/' + str(user.image),
|
||||
'avatar': user.avatar,
|
||||
|
|
Loading…
Reference in New Issue