diff --git a/apps/data/admin.py b/apps/data/admin.py index 4849a08de386e9b76d5db868b83d3d80d81b96ec..a8364b58dabffb90f3e753a33b32cca21019787b 100644 --- a/apps/data/admin.py +++ b/apps/data/admin.py @@ -2,4 +2,70 @@ from django.contrib import admin from apps.data.models import * -admin.site.register([Warehouse, Client, Supplier, Account, ChargeItem]) +# admin.site.register([Warehouse, Client, Supplier, Account, ChargeItem]) + +@admin.register(Warehouse) +class WarehouseAdmin(admin.ModelAdmin): + """ + 仓库展示类 + """ + ordering = ('id',) + list_display = (id, 'number', 'name', 'manager', 'phone', 'address', 'remark', 'is_active', 'team') + search_fields = ('number', 'name', 'manager') + list_filter = ('number',) + list_per_page = 50 + + +@admin.register(Client) +class ClientAdmin(admin.ModelAdmin): + """ + 客户展示类 + """ + ordering = ('id',) + list_display = ( + id, 'number', 'name', 'level', 'contact', 'phone', 'email', 'remark', 'is_active', 'initial_arrears_amount', + 'arrears_amount', 'has_arrears', 'team') + search_fields = ('number', 'name', 'phone') + list_filter = ('number',) + list_per_page = 50 + + +@admin.register(Supplier) +class SupplierAdmin(admin.ModelAdmin): + """ + 供应商展示类 + """ + ordering = ('id',) + list_display = ( + id, 'number', 'name', 'contact', 'phone', 'email', 'address', 'bank_account', 'bank_name', 'remark', + 'is_active', 'initial_arrears_amount', 'arrears_amount', 'has_arrears', 'team') + search_fields = ('number', 'name', 'phone') + list_filter = ('number',) + list_per_page = 50 + + +@admin.register(Account) +class AccountAdmin(admin.ModelAdmin): + """ + 结算账户展示类 + """ + ordering = ('id',) + list_display = ( + id, 'number', 'name', 'type', 'holder', 'card_number', 'remark', 'is_active', 'initial_balance_amount', + 'balance_amount','has_balance', 'team') + search_fields = ('number', 'name', 'holder') + list_filter = ('number',) + list_per_page = 50 + + +@admin.register(ChargeItem) +class ChargeItemAdmin(admin.ModelAdmin): + """ + 收支项目展示类 + """ + ordering = ('id',) + list_display = ( + id, 'name', 'type', 'remark', 'team') + search_fields = ('name', 'type') + list_filter = ('name', 'type') + list_per_page = 50 diff --git a/apps/finance/admin.py b/apps/finance/admin.py index 5067c68719c3817934a71c2047a49108734c9df1..ae633c532a15de459a2b3523cff76fcbe8b18eaf 100644 --- a/apps/finance/admin.py +++ b/apps/finance/admin.py @@ -2,4 +2,85 @@ from django.contrib import admin from apps.finance.models import * -admin.site.register([]) +# admin.site.register([PaymentOrder,PaymentAccount,CollectionOrder,CollectionAccount,ChargeOrder,AccountTransferRecord]) + +@admin.register(PaymentOrder) +class PaymentOrderAdmin(admin.ModelAdmin): + """ + 付款单据展示类 + """ + ordering = ('id',) + list_display = ( + id, 'number', 'supplier', 'handler', 'handle_time', 'remark', 'total_amount', 'discount_amount', 'is_void', + 'creator') + search_fields = ('number', 'namsuppliere', 'handler') + list_filter = ('number', 'handler') + list_per_page = 50 + + +@admin.register(PaymentAccount) +class PaymentAccountAdmin(admin.ModelAdmin): + """ + 付款账户展示类 + """ + ordering = ('id',) + list_display = (id, 'payment_order', 'account', 'payment_amount', 'team',) + search_fields = ('id', 'account') + list_filter = ('id',) + list_per_page = 50 + + +@admin.register(CollectionOrder) +class CollectionOrderAdmin(admin.ModelAdmin): + """ + 收款单据展示类 + """ + ordering = ('id',) + list_display = ( + id, 'number', 'client', 'handler', 'handle_time', 'remark', 'total_amount', 'discount_amount', 'is_void', + 'creator', + 'create_time', 'team') + search_fields = ('number', 'client', 'handler', 'total_amount') + list_filter = ('number',) + list_per_page = 50 + + +@admin.register(CollectionAccount) +class CollectionAccountAdmin(admin.ModelAdmin): + """ + 收款账户展示类 + """ + ordering = ('id',) + list_display = (id, 'collection_order', 'account', 'collection_amount', 'team',) + search_fields = ('collection_amount',) + list_filter = ('collection_amount',) + list_per_page = 50 + + +@admin.register(ChargeOrder) +class ChargeOrderAdmin(admin.ModelAdmin): + """ + 收支单据展示类 + """ + ordering = ('id',) + list_display = ( + id, 'number', 'type', 'supplier', 'client', 'handle_time', 'charge_item', 'charge_item_name', 'account', + 'total_amount', + 'charge_amount', 'remark', 'is_void', 'creator', 'create_time', 'team') + search_fields = ('number',) + list_filter = ('number', 'type') + list_per_page = 50 + + +@admin.register(AccountTransferRecord) +class AccountTransferRecordAdmin(admin.ModelAdmin): + """ + 结算账户转账记录展示类 + """ + ordering = ('id',) + list_display = (id, 'out_account', 'transfer_out_time', 'in_account', 'transfer_in_time', 'transfer_amount', + 'service_charge_amount', 'service_charge_payer', + 'handler', 'handle_time', 'remark', 'is_void', 'creator', 'create_time', 'team') + search_fields = ('transfer_in_time', 'transfer_amount',) + list_filter = ('transfer_in_time',) + list_per_page = 50 diff --git a/apps/system/admin.py b/apps/system/admin.py index 04223606c6b3d780ca2ada56481b1c2b606a4b33..2ad56c7ff88b708558086e11c499a3de8dcc2be3 100644 --- a/apps/system/admin.py +++ b/apps/system/admin.py @@ -1,5 +1,7 @@ from django.contrib import admin from apps.system.models import * +admin.site.site_title = "海鸥云ERP后台管理" +admin.site.site_header = "海鸥云ERP后台管理" admin.site.register([Team, PermissionGroup, Permission, Role, User]) diff --git a/configs/django.py b/configs/django.py index db7fc5ef1df8e732943e1655593ff04ab3e842c3..505dbe6fce80fbd288202fa761ab92818a50689f 100644 --- a/configs/django.py +++ b/configs/django.py @@ -10,9 +10,21 @@ DEBUG = True # https://docs.djangoproject.com/en/3.2/ref/settings/#databases BASE_DIR = Path(__file__).resolve().parent.parent +# DATABASES = { +# 'default': { +# 'ENGINE': 'django.db.backends.sqlite3', +# 'NAME': BASE_DIR / 'db.sqlite3', +# } +# } + DATABASES = { 'default': { - 'ENGINE': 'django.db.backends.sqlite3', - 'NAME': BASE_DIR / 'db.sqlite3', + 'ENGINE': 'django.db.backends.mysql', + 'NAME': 'erp_db', + 'USER': 'root', + 'PASSWORD': 'qar2000!', + 'HOST': '127.0.0.1', + 'PORT': 3306, + 'OPTIONS': {'charset': 'utf8'} } -} +} \ No newline at end of file diff --git a/configs/simpleuis.py b/configs/simpleuis.py new file mode 100644 index 0000000000000000000000000000000000000000..1a690b55aa3766759fdb26967fa17906b78a5ba2 --- /dev/null +++ b/configs/simpleuis.py @@ -0,0 +1,83 @@ +# -*- coding: utf-8 -*- +# SIMPLEUI 后台配置 + + +SIMPLEUI = { + 'system_keep': False, + 'menu_display': ['认证和授权','数据', '财务'], + 'dynamic': True, + 'menus': [ + # auth 认证和授权 + { + 'app': 'auth', + 'name': '认证和授权', + 'icon': 'fas fa-user-shield', + 'models': [{ + 'name': '用户', + 'icon': 'fa fa-users', + 'url': '/admin/auth/user/' + },{ + 'name': '组', + 'icon': 'fa fa-universal-access', + 'url': '/admin/auth/group/' + },]}, + + # data 相关 + { + 'app': 'data', + 'name': '数据', + 'icon': 'fa fa-cube', + 'models': [{ + 'name': '仓库', + 'icon': 'fa fa-cubes', + 'url': '/admin/data/warehouse/' + }, { + 'name': '客户', + 'icon': 'fa fa-users', + 'url': '/admin/data/client/' + }, { + 'name': '供应商', + 'icon': 'fa fa-users', + 'url': '/admin/data/supplier/' + }, { + 'name': '结算账户', + 'icon': 'fa fa-outdent', + 'url': '/admin/data/account/' + }, { + 'name': '收支项目', + 'icon': 'fa fa-fire', + 'url': '/admin/data/chargeitem/' + }, ]}, + + # finance相关 + { + 'app': 'finance', + 'name': '财务', + 'icon': 'fa fa-arrow-circle-up', + 'models': [{ + 'name': '付款单据', + 'icon': 'fa fa-arrow-circle-left', + 'url': '/admin/finance/paymentorder/' + }, { + 'name': '付款账户', + 'icon': 'fa fa-arrow-circle-right', + 'url': '/admin/finance/paymentaccount/' + }, + { + 'name': '收款单据', + 'icon': 'fa fa-arrow-circle-down', + 'url': '/admin/finance/collectionaccount/' + }, + { + 'name': '收支单据', + 'icon': 'fa fa-arrow-circle-up', + 'url': '/admin/finance/chargeorder/' + }, + { + 'name': '结算账户转账记录', + 'icon': 'fa fa-align-left', + 'url': '/admin/finance/accounttransferrecord/' + },]}, + ] + +} diff --git a/project/__init__.py b/project/__init__.py index e69de29bb2d1d6434b8b29ae775ad8c2e48c5391..bc576edca6a5df0fd5f69545a847638476174467 100644 --- a/project/__init__.py +++ b/project/__init__.py @@ -0,0 +1,6 @@ +import pymysql + + +# 连接mysql 排除版本错误 +#pymysql.version_info = (1, 4, 14, "final", 0) +pymysql.install_as_MySQLdb() \ No newline at end of file diff --git a/project/settings.py b/project/settings.py index 458fb53242e8da9f4c173be2f51b5a8a576d3827..c6da4c180b09e0af51f37e835b28fd613341e367 100644 --- a/project/settings.py +++ b/project/settings.py @@ -12,7 +12,7 @@ https://docs.djangoproject.com/en/3.2/ref/settings/ from datetime import timedelta from configs.django import * - +from configs.simpleuis import SIMPLEUI # Quick-start development settings - unsuitable for production # See https://docs.djangoproject.com/en/3.2/howto/deployment/checklist/ @@ -22,10 +22,10 @@ SECRET_KEY = 'django-insecure-v0ujuj#$uwo-cv&4@2=-0g3fi@av13=*g9%+jryd@5m568+93+ ALLOWED_HOSTS = ['*'] - # Application definition INSTALLED_APPS = [ + 'simpleui', 'django.contrib.admin', 'django.contrib.auth', 'django.contrib.contenttypes', @@ -87,7 +87,6 @@ TEMPLATES = [ WSGI_APPLICATION = 'project.wsgi.application' - # Password validation # https://docs.djangoproject.com/en/3.2/ref/settings/#auth-password-validators @@ -106,11 +105,10 @@ AUTH_PASSWORD_VALIDATORS = [ }, ] - # Internationalization # https://docs.djangoproject.com/en/3.2/topics/i18n/ -LANGUAGE_CODE = 'en-us' +LANGUAGE_CODE = 'zh-Hans' TIME_ZONE = 'Asia/Shanghai' @@ -120,7 +118,6 @@ USE_L10N = True USE_TZ = True - # Static files (CSS, JavaScript, Images) # https://docs.djangoproject.com/en/3.2/howto/static-files/ @@ -130,13 +127,11 @@ STATIC_ROOT = BASE_DIR / 'static' MEDIA_URL = '/media/' MEDIA_ROOT = BASE_DIR / 'media' - # Default primary key field type # https://docs.djangoproject.com/en/3.2/ref/settings/#default-auto-field DEFAULT_AUTO_FIELD = 'django.db.models.BigAutoField' - # Django REST framework # https://www.django-rest-framework.org/ @@ -147,7 +142,6 @@ REST_FRAMEWORK = { 'DEFAULT_SCHEMA_CLASS': 'drf_spectacular.openapi.AutoSchema', } - # Simple JWT # https://django-rest-framework-simplejwt.readthedocs.io/en/latest/ @@ -169,7 +163,6 @@ SPECTACULAR_SETTINGS = { INTERNAL_IPS = ['127.0.0.1'] - # Logger # https://docs.djangoproject.com/zh-hans/3.2/topics/logging/ @@ -198,3 +191,8 @@ LOGGING = { }, }, } + +######## SIMPLEUI 管理后台配置 + +SIMPLEUI_LOGO = 'http://114.218.158.78:12222/static/img/logo.ac9c30ec.png' # logo 配置 +SIMPLEUI_CONFIG = SIMPLEUI # 管理后台路径配置 diff --git a/requirements.txt b/requirements.txt index 6636d2b8130ffde5512138156d867a78d6f1ccc0..e9c135fcbccd0207fad62186b283df5c08599fd9 100644 --- a/requirements.txt +++ b/requirements.txt @@ -30,3 +30,4 @@ sqlparse==0.4.2 toml==0.10.2 uritemplate==4.1.1 uvicorn==0.16.0 +django-simpleui