diff --git a/client/src/views/standard/standard.vue b/client/src/views/standard/standard.vue index 9d5bf28..87a3b51 100644 --- a/client/src/views/standard/standard.vue +++ b/client/src/views/standard/standard.vue @@ -38,7 +38,7 @@ >刷新重置
- 新增 + 新增
+ + + - - + - 点击上传 + 点击上传 + + +
取消 确认 @@ -137,9 +162,10 @@
diff --git a/client/src/views/system/dict.vue b/client/src/views/system/dict.vue index e0a8edd..dfeb466 100644 --- a/client/src/views/system/dict.vue +++ b/client/src/views/system/dict.vue @@ -319,7 +319,6 @@ export default { const isEdit = this.dgT1 === 'edit' if (isEdit) { updateDictType(this.dicttype.id, this.dicttype).then(res => { - if (res.code >= 200) { this.getDictTypeList() this.dgV1 = false this.$notify({ @@ -328,11 +327,9 @@ export default { type: 'success', duration: 2000 }) - } - }) + }).catch(error=>{}) } else { createDictType(this.dicttype).then(res => { - if (res.code >= 200) { this.getDictTypeList() this.dgV1 = false this.$notify({ @@ -341,8 +338,7 @@ export default { type: 'success', duration: 2000 }) - } - }) + }).catch(error=>{}) } } else { return false @@ -355,7 +351,6 @@ export default { const isEdit = this.dgT2 === 'edit' if (isEdit) { updateDict(this.dict.id, this.dict).then(res => { - if (res.code >= 200) { this.getList() this.dgV2 = false this.$notify({ @@ -364,11 +359,9 @@ export default { type: 'success', duration: 2000 }) - } - }) + }).catch(error=>{}) } else { createDict(this.dict).then(res => { - if (res.code >= 200) { this.getList() this.dgV2 = false this.$notify({ @@ -377,8 +370,7 @@ export default { type: 'success', duration: 2000 }) - } - }) + }).catch(error=>{}) } } else { return false diff --git a/client/src/views/system/user.vue b/client/src/views/system/user.vue index c690684..510a041 100644 --- a/client/src/views/system/user.vue +++ b/client/src/views/system/user.vue @@ -250,11 +250,7 @@ export default { methods: { checkPermission, handleAvatarSuccess(res, file) { - if (res.code >= 200) { this.user.avatar = res.data.path - } else { - this.$message.error("头像上传失败!") - } }, beforeAvatarUpload(file) { const isLt2M = file.size / 1024 / 1024 < 2; @@ -344,7 +340,6 @@ export default { const isEdit = this.dialogType === "edit"; if (isEdit) { updateUser(this.user.id, this.user).then(res => { - if (res.code >= 200) { this.getList(); this.dialogVisible = false; this.$notify({ @@ -353,11 +348,9 @@ export default { type: "success", duration: 2000 }); - } }); } else { createUser(this.user).then(res => { - if (res.code >= 200) { this.getList(); this.dialogVisible = false; this.$notify({ @@ -366,7 +359,6 @@ export default { type: "success", duration: 2000 }); - } }); } } else { diff --git a/server/apps/certset/migrations/0004_unittype_description.py b/server/apps/certset/migrations/0004_unittype_description.py new file mode 100644 index 0000000..5848f95 --- /dev/null +++ b/server/apps/certset/migrations/0004_unittype_description.py @@ -0,0 +1,18 @@ +# Generated by Django 3.0.7 on 2020-06-16 09:20 + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('certset', '0003_auto_20200616_1158'), + ] + + operations = [ + migrations.AddField( + model_name='unittype', + name='description', + field=models.TextField(blank=True, null=True, verbose_name='描述'), + ), + ] diff --git a/server/apps/system/migrations/0020_auto_20200616_1720.py b/server/apps/system/migrations/0020_auto_20200616_1720.py new file mode 100644 index 0000000..0bc0f12 --- /dev/null +++ b/server/apps/system/migrations/0020_auto_20200616_1720.py @@ -0,0 +1,18 @@ +# Generated by Django 3.0.7 on 2020-06-16 09:20 + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('system', '0019_auto_20200612_1448'), + ] + + operations = [ + migrations.AlterField( + model_name='file', + name='name', + field=models.CharField(blank=True, max_length=300, null=True, verbose_name='名称'), + ), + ] diff --git a/server/apps/system/migrations/0021_auto_20200616_1722.py b/server/apps/system/migrations/0021_auto_20200616_1722.py new file mode 100644 index 0000000..96cb8f5 --- /dev/null +++ b/server/apps/system/migrations/0021_auto_20200616_1722.py @@ -0,0 +1,18 @@ +# Generated by Django 3.0.7 on 2020-06-16 09:22 + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('system', '0020_auto_20200616_1720'), + ] + + operations = [ + migrations.AlterField( + model_name='file', + name='mime', + field=models.CharField(blank=True, max_length=300, null=True, verbose_name='文件格式'), + ), + ] diff --git a/server/apps/system/mixins.py b/server/apps/system/mixins.py index 0ecbac7..acf89cd 100644 --- a/server/apps/system/mixins.py +++ b/server/apps/system/mixins.py @@ -2,30 +2,24 @@ from rest_framework import status from rest_framework.response import Response from rest_framework.settings import api_settings -class CreateModelAMixin: +class CreateUpdateModelAMixin: """ 业务用基本表A用 """ def perform_create(self, serializer): serializer.save(create_by = self.request.user) - -class UpdateModelAMixin: - """ - 业务用基本表A用 - """ + def perform_update(self, serializer): serializer.save(update_by = self.request.user) -class CreateModelBMixin: +class CreateUpdateModelBMixin: """ 业务用基本表B用 """ def perform_create(self, serializer): serializer.save(create_by = self.request.user, belong_dept=self.request.user.dept) - -class UpdateModelBMixin: - """ - 业务用基本表B用 - """ + def perform_update(self, serializer): - serializer.save(update_by = self.request.user) \ No newline at end of file + serializer.save(update_by = self.request.user) + + \ No newline at end of file diff --git a/server/apps/system/models.py b/server/apps/system/models.py index fbabf8f..00c286e 100644 --- a/server/apps/system/models.py +++ b/server/apps/system/models.py @@ -198,7 +198,7 @@ class File(CommonAModel): """ 文件存储表,业务表根据具体情况选择是否外键关联 """ - name = models.CharField('名称', max_length=30, null=True, blank=True) + name = models.CharField('名称', max_length=300, null=True, blank=True) size = models.IntegerField('文件大小', default=1, null=True, blank=True) file = models.FileField('文件', upload_to='%Y/%m/%d/') type_choices = ( @@ -208,7 +208,7 @@ class File(CommonAModel): ('图片', '图片'), ('其它', '其它') ) - mime = models.CharField('文件格式', max_length=50, null=True, blank=True) + mime = models.CharField('文件格式', max_length=300, null=True, blank=True) type = models.CharField('文件类型', max_length=50, choices=type_choices, default='文档') path = models.CharField('地址', max_length=1000, null=True, blank=True) diff --git a/server/apps/system/views.py b/server/apps/system/views.py index 627a97e..bd08371 100644 --- a/server/apps/system/views.py +++ b/server/apps/system/views.py @@ -23,7 +23,7 @@ from rest_framework_simplejwt.tokens import RefreshToken from utils.queryset import get_child_queryset2 from .filters import UserFilter -from .mixins import CreateModelAMixin +from .mixins import CreateUpdateModelAMixin from .models import (Dict, DictType, File, Organization, Permission, Position, Role, User) from .permission import RbacPermission, get_permission_list @@ -233,7 +233,7 @@ class UserViewSet(ModelViewSet): } return Response(data) -class FileViewSet(ModelViewSet): +class FileViewSet(CreateUpdateModelAMixin, ModelViewSet): """ 文件:增删改查 """