From d918bb68dbc468c567a38c7a4ea3581f64763456 Mon Sep 17 00:00:00 2001
From: shilixia <2309368887@qq.com>
Date: Mon, 13 Sep 2021 09:45:52 +0800
Subject: [PATCH] kehu
---
hb_client/.env.development | 4 +-
hb_client/src/api/sam.js | 59 ++++++
hb_client/src/router/index.js | 21 +++
hb_client/src/views/sam/contract.vue | 261 +++++++++++++++++++++++++++
hb_client/src/views/sam/customer.vue | 261 +++++++++++++++++++++++++++
hb_server/apps/sam/models.py | 4 +-
hb_server/apps/sam/serializers.py | 6 +-
hb_server/apps/sam/urls.py | 14 ++
hb_server/apps/system/views.py | 21 ++-
hb_server/server/urls.py | 1 +
10 files changed, 635 insertions(+), 17 deletions(-)
create mode 100644 hb_client/src/api/sam.js
create mode 100644 hb_client/src/views/sam/contract.vue
create mode 100644 hb_client/src/views/sam/customer.vue
create mode 100644 hb_server/apps/sam/urls.py
diff --git a/hb_client/.env.development b/hb_client/.env.development
index db8f2e7..ef83e12 100644
--- a/hb_client/.env.development
+++ b/hb_client/.env.development
@@ -2,8 +2,8 @@
ENV = 'development'
# base api
-#VUE_APP_BASE_API = 'http://localhost:8000/api'
-VUE_APP_BASE_API = 'http://47.95.0.242:2222/api'
+VUE_APP_BASE_API = 'http://127.0.0.1:8000/api'
+#VUE_APP_BASE_API = 'http://47.95.0.242:2222/api'
# vue-cli uses the VUE_CLI_BABEL_TRANSPILE_MODULES environment variable,
diff --git a/hb_client/src/api/sam.js b/hb_client/src/api/sam.js
new file mode 100644
index 0000000..67998a3
--- /dev/null
+++ b/hb_client/src/api/sam.js
@@ -0,0 +1,59 @@
+import request from '@/utils/request'
+//客户
+export function getCustomerList(query) {
+ return request({
+ url: '/sam/customer/',
+ method: 'get',
+ params: query
+ })
+}
+export function createCustomer(data) {
+ return request({
+ url: '/sam/customer/',
+ method: 'post',
+ data
+ })
+}
+export function updateCustomer(id, data) {
+ return request({
+ url: `/sam/customer/${id}/`,
+ method: 'put',
+ data
+ })
+}
+export function deleteCustomer(id, data) {
+ return request({
+ url: `/sam/customer/${id}/`,
+ method: 'delete',
+ data
+ })
+}
+//合同
+export function getContractList(query) {
+ return request({
+ url: '/sam/contract/',
+ method: 'get',
+ params: query
+ })
+}
+export function createContract(data) {
+ return request({
+ url: '/sam/contract/',
+ method: 'post',
+ data
+ })
+}
+export function updateContract(id, data) {
+ return request({
+ url: `/sam/contract/${id}/`,
+ method: 'put',
+ data
+ })
+}
+export function deleteContract(id, data) {
+ return request({
+ url: `/sam/contract/${id}/`,
+ method: 'delete',
+ data
+ })
+}
diff --git a/hb_client/src/router/index.js b/hb_client/src/router/index.js
index 5a7774c..d612662 100644
--- a/hb_client/src/router/index.js
+++ b/hb_client/src/router/index.js
@@ -101,6 +101,27 @@ export const asyncRoutes = [
}
]
},
+ {
+ path: '/sam',
+ component: Layout,
+ redirect: '/sam/index',
+ name: 'sam',
+ meta: { title: '合同管理', icon: 'example', perms: ['equipment_set'] },
+ children: [
+ {
+ path: 'customer',
+ name: 'customer',
+ component: () => import('@/views/sam/customer'),
+ meta: { title: '客户信息', icon: 'example', perms: ['index_manage'] }
+ },
+ {
+ path: 'contract',
+ name: 'contract',
+ component: () => import('@/views/sam/contract'),
+ meta: { title: '合同信息', icon: 'example', perms: ['index_manage'] }
+ }
+ ]
+ },
{
path: '/inm',
component: Layout,
diff --git a/hb_client/src/views/sam/contract.vue b/hb_client/src/views/sam/contract.vue
new file mode 100644
index 0000000..ad5f502
--- /dev/null
+++ b/hb_client/src/views/sam/contract.vue
@@ -0,0 +1,261 @@
+
+
+
+
+
+ 搜索
+ 重置
+
+
+ 新增仓库
+
+
+
+
+
+
+ {{ scope.row.name }}
+
+
+
+ {{ scope.row.address }}
+
+
+ {{ scope.row.contact }}
+
+
+ {{ scope.row.contact_phone }}
+
+
+ {{ scope.row.description }}
+
+
+ {{ scope.row.create_time }}
+
+
+
+
+ 编辑
+ 删除
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 取消
+ 确认
+
+
+
+
+
diff --git a/hb_client/src/views/sam/customer.vue b/hb_client/src/views/sam/customer.vue
new file mode 100644
index 0000000..54312db
--- /dev/null
+++ b/hb_client/src/views/sam/customer.vue
@@ -0,0 +1,261 @@
+
+
+
+
+
+ 搜索
+ 重置
+
+
+ 新增客户
+
+
+
+
+
+
+ {{ scope.row.name }}
+
+
+
+ {{ scope.row.address }}
+
+
+ {{ scope.row.contact }}
+
+
+ {{ scope.row.contact_phone }}
+
+
+ {{ scope.row.description }}
+
+
+ {{ scope.row.create_time }}
+
+
+
+
+ 编辑
+ 删除
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 取消
+ 确认
+
+
+
+
+
diff --git a/hb_server/apps/sam/models.py b/hb_server/apps/sam/models.py
index 977621f..ef9d1d8 100644
--- a/hb_server/apps/sam/models.py
+++ b/hb_server/apps/sam/models.py
@@ -1,4 +1,4 @@
-from numpy import product
+
from apps.system.models import CommonAModel
from django.db import models
from django.contrib.auth.models import AbstractUser
@@ -19,7 +19,7 @@ class Customer(CommonAModel):
name = models.CharField('客户名称', max_length=50, unique=True)
address = models.CharField('详细地址', max_length=20, blank=True, null=True)
contact = models.CharField('联系人', max_length=20)
- contact_phone = models.CharField('联系电话', max_length=11, unique=True)
+ contact_phone = models.CharField('联系电话', max_length=11, unique=True,null=True)
description = models.CharField('描述', max_length=200, blank=True, null=True)
class Meta:
diff --git a/hb_server/apps/sam/serializers.py b/hb_server/apps/sam/serializers.py
index 5e9bb74..900d5f0 100644
--- a/hb_server/apps/sam/serializers.py
+++ b/hb_server/apps/sam/serializers.py
@@ -1,6 +1,6 @@
from rest_framework import serializers
-from .models import Contact, Customer
+from .models import Contract, Customer
class CustomerSerializer(serializers.ModelSerializer):
@@ -20,10 +20,10 @@ class CustomerSimpleSerializer(serializers.ModelSerializer):
class ContractSerializer(serializers.ModelSerializer):
class Meta:
- model = Contact
+ model = Contract
fields = '__all__'
class ContractCreateUpdateSerializer(serializers.ModelSerializer):
class Meta:
- model = Contact
+ model = Contract
fields = ['name', 'number', 'amount', 'customer', 'sign_date', 'description']
\ No newline at end of file
diff --git a/hb_server/apps/sam/urls.py b/hb_server/apps/sam/urls.py
new file mode 100644
index 0000000..fda60b5
--- /dev/null
+++ b/hb_server/apps/sam/urls.py
@@ -0,0 +1,14 @@
+from django.db.models import base
+from rest_framework import urlpatterns
+from apps.sam.views import CustomerViewSet,ContractViewSet
+from django.urls import path, include
+from rest_framework.routers import DefaultRouter
+
+router = DefaultRouter()
+router.register('customer', CustomerViewSet, basename='customer')
+router.register('contract', ContractViewSet, basename='contract')
+
+urlpatterns = [
+ path('', include(router.urls)),
+]
+
diff --git a/hb_server/apps/system/views.py b/hb_server/apps/system/views.py
index cc9842d..7234ca7 100644
--- a/hb_server/apps/system/views.py
+++ b/hb_server/apps/system/views.py
@@ -353,7 +353,7 @@ class FileViewSet(CreateModelMixin, DestroyModelMixin, RetrieveModelMixin, ListM
-import face_recognition
+#import face_recognition
import uuid
import base64
import os
@@ -382,13 +382,14 @@ class FaceLogin(CreateAPIView):
data = tran64(request.data.get('base64').replace(' ', '+'))
# data = request.data.get('base64')
f.write(base64.urlsafe_b64decode(data))
- picture_of_me = face_recognition.load_image_file(settings.BASE_DIR +'/temp/me.png')
- my_face_encoding = face_recognition.face_encodings(picture_of_me)[0]
- unknown_picture = face_recognition.load_image_file(filepath)
- unknown_face_encoding = face_recognition.face_encodings(unknown_picture)[0]
- results = face_recognition.compare_faces([my_face_encoding], unknown_face_encoding, tolerance=0.2)
+ # picture_of_me = face_recognition.load_image_file(settings.BASE_DIR +'/temp/me.png')
+ # my_face_encoding = face_recognition.face_encodings(picture_of_me)[0]
+ # unknown_picture = face_recognition.load_image_file(filepath)
+ # unknown_face_encoding = face_recognition.face_encodings(unknown_picture)[0]
+ #results = face_recognition.compare_faces([my_face_encoding], unknown_face_encoding, tolerance=0.2)
os.remove(filepath)
- if results[0] == True:
- return Response('这是曹前明')
- else:
- return Response('这不是曹前明')
\ No newline at end of file
+ # if results[0] == True:
+ # return Response('这是曹前明')
+ # else:
+ # return Response('这不是曹前明')
+
diff --git a/hb_server/server/urls.py b/hb_server/server/urls.py
index 8fe9aa2..607412d 100644
--- a/hb_server/server/urls.py
+++ b/hb_server/server/urls.py
@@ -65,6 +65,7 @@ urlpatterns = [
path('api/wf/', include('apps.wf.urls')),
path('api/mtm/', include('apps.mtm.urls')),
path('api/inm/', include('apps.inm.urls')),
+ path('api/sam/', include('apps.sam.urls')),
# 工具
path('api/utils/signature/', GenSignature.as_view()),