Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
杨树贤
/
liexin_supplier
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Snippets
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
6845f7b3
authored
Aug 24, 2023
by
杨树贤
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
备忘录页面和接口
parent
86ed2947
Show whitespace changes
Inline
Side-by-side
Showing
15 changed files
with
513 additions
and
3 deletions
app/Http/Controllers/Api/SupplierMemoApiController.php
app/Http/Controllers/Api/SupplierShareApplyApiController.php
app/Http/Controllers/Api/SupplierTagApiController.php
app/Http/Controllers/Filter/SupplierMemoFilter.php
app/Http/Controllers/SupplierMemoController.php
app/Http/Services/SupplierMemoService.php
app/Http/Transformers/SupplierMemoTransformer.php
app/Http/routes.php
app/Model/SupplierMemoModel.php
resources/views/script/SaveSupplierMemoScript.blade.php
resources/views/script/supplier/SupplierMemoScript.blade.php
resources/views/web/SaveSupplierMemo.blade.php
resources/views/web/UpdateSupplier.blade.php
resources/views/web/supplier/SupplierMemo.blade.php
resources/views/web/supplier/SupplierRuler.blade.php
app/Http/Controllers/Api/SupplierMemoApiController.php
0 → 100644
View file @
6845f7b3
<?php
namespace
App\Http\Controllers\Api
;
use
App\Http\Controllers\Controller
;
use
App\Http\Services\SupplierService
;
use
App\Http\Services\SupplierMemoService
;
use
App\Http\Transformers\SupplierLogTransformer
;
use
App\Model\LogModel
;
use
App\Model\SupplierLogModel
;
use
App\Model\SupplierMemoModel
;
use
GuzzleHttp\Client
;
use
Illuminate\Http\Request
;
//获取供应商备忘录
class
SupplierMemoApiController
extends
Controller
{
public
function
Entrance
(
Request
$request
,
$id
)
{
$this
->
$id
(
$request
,
$id
);
}
//获取备忘录列表
public
function
GetSupplierMemoList
(
$request
)
{
$supplierMemoService
=
new
SupplierMemoService
();
$data
=
$supplierMemoService
->
getSupplierMemoList
(
$request
);
$this
->
response
(
0
,
'ok'
,
$data
[
'data'
],
$data
[
'total'
]);
}
//新增备忘录
public
function
SaveSupplierMemo
(
$request
)
{
$data
=
$request
->
only
([
'id'
,
'supplier_id'
,
'title'
,
'content'
,
'attachment'
]);
if
(
empty
(
$data
[
'title'
]))
{
$this
->
response
(
-
1
,
'标题不能为空'
);
}
if
(
empty
(
$data
[
'content'
]))
{
$this
->
response
(
-
1
,
'内容不能为空'
);
}
$result
=
(
new
SupplierMemoService
())
->
saveSupplierMemo
(
$data
);
if
(
!
$result
)
{
$this
->
response
(
-
1
,
'新增失败,请练习管理员'
);
}
$this
->
response
(
0
,
'新增成功'
);
}
//删除备忘录
public
function
deleteSupplierMemo
(
$request
)
{
$id
=
$request
->
input
(
'id'
);
$result
=
SupplierMemoModel
::
where
(
'id'
,
$id
)
->
delete
();
if
(
!
$result
)
{
$this
->
response
(
-
1
,
'删除失败,请练习管理员'
);
}
$this
->
response
(
0
,
'删除成功'
);
}
}
app/Http/Controllers/Api/SupplierShareApplyApiController.php
View file @
6845f7b3
...
...
@@ -117,7 +117,7 @@ class SupplierShareApplyApiController extends Controller
if
(
!
$result
)
{
$this
->
response
(
-
1
,
'申请失败,系统错误'
);
}
return
$this
->
response
(
0
,
'申请成功'
);
$this
->
response
(
0
,
'申请成功'
);
}
//获取共用审核列表
...
...
app/Http/Controllers/Api/SupplierTagApiController.php
View file @
6845f7b3
...
...
@@ -11,7 +11,7 @@ use App\Model\SupplierLogModel;
use
GuzzleHttp\Client
;
use
Illuminate\Http\Request
;
//
通用API,比如获取品牌列表,分类列表等
//
供应商标签
class
SupplierTagApiController
extends
Controller
{
public
function
Entrance
(
Request
$request
,
$id
)
...
...
app/Http/Controllers/Filter/SupplierMemoFilter.php
0 → 100644
View file @
6845f7b3
<?php
namespace
App\Http\Controllers\Filter
;
use
App\Http\Services\AdminUserService
;
use
App\Http\Services\DepartmentService
;
use
App\Model\SupplierMemoModel
;
use
App\Model\SupplierSyncModel
;
use
Illuminate\Support\Facades\DB
;
class
SupplierMemoFilter
{
//查询条件
public
function
listFilter
(
$request
)
{
$map
=
$request
->
all
();
$model
=
new
SupplierMemoModel
();
$query
=
$model
->
where
(
'create_uid'
,
$request
->
user
->
userId
)
->
orderBy
(
'id'
,
'desc'
);
return
$query
;
}
}
app/Http/Controllers/SupplierMemoController.php
0 → 100644
View file @
6845f7b3
<?php
namespace
App\Http\Controllers
;
use
App\Http\Services\RoleService
;
use
App\Http\Services\SupplierMemoService
;
use
App\Http\Services\SupplierService
;
use
App\Http\Services\SupplierStatisticsService
;
use
App\Http\Services\ViewCheckService
;
use
App\Model\IntracodeModel
;
use
App\Model\SupplierChannelModel
;
use
App\Model\SupplierMemoModel
;
use
Illuminate\Http\Request
;
use
Illuminate\Support\Facades\DB
;
class
SupplierMemoController
extends
Controller
{
public
function
info
(
Request
$request
,
$id
=
''
)
{
{
if
(
$request
->
path
()
==
'/'
)
{
$path
=
'web/index'
;
}
else
{
$path
=
$request
->
path
();
}
$this
->
data
=
[
'menus'
=>
$request
->
menus
,
'header'
=>
$request
->
user
->
header
,
'username'
=>
$request
->
user
->
email
,
'user_email'
=>
$request
->
user
->
email
,
'uri'
=>
'/'
.
$path
,
'id'
=>
$id
];
$userId
=
$request
->
user
->
userId
;
$canAudit
=
perm
(
$userId
,
'AuditSupplier'
);
$this
->
data
[
'canAudit'
]
=
$canAudit
;
//把是否是领导查看放到模板,用来区分部门老大能干的权限
$leaderView
=
perm
(
$userId
,
'LeaderView'
);
$this
->
data
[
'leaderView'
]
=
$leaderView
;
return
$this
->
$id
(
$request
);
}
}
public
function
__call
(
$name
,
$arr
)
{
$data
[
'errinfo'
]
=
'访问路径错误'
;
return
view
(
'errors.error'
,
$data
);
}
public
function
SaveSupplierMemo
(
$request
)
{
$id
=
$request
->
get
(
'id'
);
if
(
!
empty
(
$id
))
{
$model
=
new
SupplierMemoModel
();
$this
->
data
[
'memo'
]
=
$model
->
where
(
'id'
,
$id
)
->
first
()
->
toArray
();
}
return
$this
->
view
(
'保存备忘'
);
}
}
app/Http/Services/SupplierMemoService.php
0 → 100644
View file @
6845f7b3
<?php
namespace
App\Http\Services
;
use
App\Http\Controllers\Filter\SupplierMemoFilter
;
use
App\Http\Transformers\SupplierMemoTransformer
;
use
App\Model\SupplierExtendModel
;
use
App\Model\SupplierMemoModel
;
class
SupplierMemoService
{
public
function
getSupplierMemoList
(
$request
)
{
$limit
=
$request
->
get
(
'limit'
,
10
);
$filter
=
new
SupplierMemoFilter
();
$query
=
$filter
->
listFilter
(
$request
);
$list
=
$query
->
paginate
(
$limit
)
->
toArray
();
$transformer
=
new
SupplierMemoTransformer
();
$list
[
'data'
]
=
$transformer
->
transformList
(
$list
[
'data'
]);
return
$list
;
}
//保存备忘录
public
function
saveSupplierMemo
(
$data
)
{
if
(
empty
(
$data
[
'id'
]))
{
$data
[
'create_time'
]
=
time
();
$data
[
'create_uid'
]
=
request
()
->
user
->
userId
;
$data
[
'create_name'
]
=
request
()
->
user
->
name
;
return
SupplierMemoModel
::
insert
(
$data
);
}
else
{
$data
[
'update_time'
]
=
time
();
return
SupplierMemoModel
::
where
(
'id'
,
$data
[
'id'
])
->
update
(
$data
);
}
}
}
app/Http/Transformers/SupplierMemoTransformer.php
0 → 100644
View file @
6845f7b3
<?php
namespace
App\Http\Transformers
;
class
SupplierMemoTransformer
{
public
function
transformList
(
$list
)
{
foreach
(
$list
as
&
$memo
)
{
if
(
!
$memo
)
{
continue
;
}
$memo
[
'create_time'
]
=
$memo
[
'create_time'
]
?
date
(
'Y-m-d H:i:s'
,
$memo
[
'create_time'
])
:
''
;
}
unset
(
$memo
);
return
$list
;
}
}
app/Http/routes.php
View file @
6845f7b3
...
...
@@ -33,6 +33,7 @@ Route::group(['middleware' => ['web', 'menu']], function () {
Route
::
match
([
'get'
,
'post'
],
'/purchase_remark/{key}'
,
'PurchaseRemarkController@info'
);
Route
::
match
([
'get'
,
'post'
],
'/shipping_cost_ruler/{key}'
,
'ShippingCostRulerController@info'
);
Route
::
match
([
'get'
,
'post'
],
'/chain/{key}'
,
'ChainController@info'
);
Route
::
match
([
'get'
,
'post'
],
'/supplier_memo/{key}'
,
'SupplierMemoController@info'
);
});
Route
::
group
([
'middleware'
=>
[
'web'
],
'namespace'
=>
'Api'
],
function
()
{
...
...
@@ -56,6 +57,7 @@ Route::group(['middleware' => ['web'], 'namespace' => 'Api'], function () {
Route
::
match
([
'get'
,
'post'
],
'/api/purchase_remark/{key}'
,
'PurchaseRemarkApiController@Entrance'
);
Route
::
match
([
'get'
,
'post'
],
'/api/shipping_cost_ruler/{key}'
,
'ShippingCostRulerApiController@Entrance'
);
Route
::
match
([
'get'
,
'post'
],
'/api/chain/{key}'
,
'ChainApiController@Entrance'
);
Route
::
match
([
'get'
,
'post'
],
'/api/supplier_memo/{key}'
,
'SupplierMemoApiController@Entrance'
);
//单独的统计接口
Route
::
match
([
'get'
,
'post'
],
'/statisticsSkuNumber'
,
function
()
{
(
new
\App\Http\Services\DataService
())
->
statisticsSkuNumberFromSKu
();
...
...
app/Model/SupplierMemoModel.php
0 → 100644
View file @
6845f7b3
<?php
namespace
App\Model
;
use
Illuminate\Database\Eloquent\Model
;
class
SupplierMemoModel
extends
Model
{
protected
$connection
=
'web'
;
protected
$table
=
'supplier_memo'
;
protected
$primaryKey
=
'id'
;
public
$timestamps
=
false
;
}
resources/views/script/SaveSupplierMemoScript.blade.php
0 → 100644
View file @
6845f7b3
{
!!
Autograph
()
!!
}
<
script
>
layui
.
use
([
'form'
,
'upload'
,
'admin'
],
function
()
{
const
form
=
layui
.
form
const
upload
=
layui
.
upload
;
const
admin
=
layui
.
admin
;
const
{
createEditor
,
createToolbar
}
=
window
.
wangEditor
const
editorConfig
=
{
placeholder
:
'...'
,
onChange
(
editor
)
{
const
html
=
editor
.
getHtml
()
console
.
log
(
'editor content'
,
html
)
// 也可以同步到 <textarea>
}
}
const
editor
=
createEditor
({
selector
:
'#editor-container'
,
html
:
'{!! $memo['
content
'] or '' !!}'
,
config
:
editorConfig
,
mode
:
'simple'
,
// or 'simple'
})
const
toolbarConfig
=
{}
toolbarConfig
.
excludeKeys
=
[
"group-image"
]
const
toolbar
=
createToolbar
({
editor
,
selector
:
'#toolbar-container'
,
config
:
toolbarConfig
,
mode
:
'simple'
,
// or 'simple'
})
//图片上传
upload
.
render
({
elem
:
'.upload-img'
,
url
:
UploadImgUrl
,
field
:
'upload'
,
data
:
{
k1
:
k1
,
k2
:
k2
,
source
:
1
,
cancel_time_verify
:
1
,
}
,
accept
:
'file'
,
exts
:
'jpg|png|bmp|jpeg|zip|pdf'
,
size
:
10000
,
before
:
function
(
obj
)
{
layer
.
msg
(
'加载中'
,
{
icon
:
16
,
shade
:
0.01
});
let
item
=
this
.
item
;
//预读本地文件示例,不支持ie8
obj
.
preview
(
function
(
index
,
file
,
result
)
{
// if (file.type.indexOf('image') !== -1){
// $('#' + item.attr('preview')).attr('src', result); //图片链接(base64)
// }else{
// $('#' + item.attr('preview')).attr('src', '/images/file.png');
// }
});
}
,
done
:
function
(
res
)
{
if
(
res
.
code
===
200
)
{
layer
.
msg
(
'上传成功'
,
{
icon
:
6
});
let
item
=
this
.
item
;
$
(
'#'
+
item
.
attr
(
'data-obj'
))
.
val
(
res
.
data
[
0
]);
$
(
'#attachment_url'
)
.
text
(
res
.
data
[
0
]);
return
false
;
}
else
{
layer
.
msg
(
'上传失败,'
+
res
.
message
,
{
icon
:
5
});
return
false
;
}
}
,
error
:
function
(
res
)
{
layer
.
msg
(
'上传失败:'
+
res
.
message
,
{
icon
:
5
});
return
false
;
}
});
//提交数据
form
.
on
(
'submit(saveSupplierMemo)'
,
function
(
data
)
{
data
.
field
.
content
=
editor
.
getHtml
();
data
.
field
.
supplier_id
=
getQueryVariable
(
'supplier_id'
);
let
res
=
ajax
(
'/api/supplier_memo/SaveSupplierMemo'
,
data
.
field
);
if
(
!
res
)
{
layer
.
msg
(
'网络错误,请重试'
,
{
icon
:
6
});
}
else
{
if
(
res
.
err_code
===
0
)
{
admin
.
closeThisDialog
();
parent
.
layer
.
msg
(
res
.
err_msg
,
{
icon
:
6
});
}
else
{
parent
.
layer
.
msg
(
res
.
err_msg
,
{
icon
:
5
});
}
}
return
false
;
})
form
.
on
(
'submit(cancelSupplierMemo)'
,
function
(
data
)
{
admin
.
closeThisDialog
();
});
});
</
script
>
resources/views/script/supplier/SupplierMemoScript.blade.php
0 → 100644
View file @
6845f7b3
<script>
layui
.
use
([
'table'
,
'form'
,
'element'
,
'layer'
,
'admin'
,
'upload'
],
function
()
{
let
table
=
layui
.
table
;
let
form
=
layui
.
form
;
let
admin
=
layui
.
admin
;
let
element
=
layui
.
element
;
let
upload
=
layui
.
upload
;
let
supplierId
=
getQueryVariable
(
'supplier_id'
)
table
.
render
({
elem
:
'#memoList'
,
url
:
'/api/supplier_memo/getSupplierMemoList'
,
method
:
'post'
,
size
:
'sm'
,
cellMinWidth
:
80
,
//全局定义常规单元格的最小宽度
where
:
{
supplier_id
:
supplierId
},
width
:
'70%'
,
loading
:
true
,
first
:
true
,
//不显示首页
last
:
false
,
//不显示尾页
cols
:
[[
{
field
:
'operate'
,
title
:
'操作'
,
align
:
'left'
,
width
:
150
,
templet
:
'#memoOperate'
},
{
field
:
'title'
,
title
:
'标题'
,
align
:
'left'
,
width
:
200
},
{
field
:
'content'
,
title
:
'内容'
,
align
:
'left'
,
width
:
300
},
{
field
:
'attachment'
,
title
:
'附件'
,
width
:
300
,
align
:
'left'
,
templet
:
function
(
data
)
{
return
"
<
a
style
=
'color: blue'
href
=
'" + data.attachment + "'
target
=
'_blank'
>
" + data.attachment + "
<
/a>"
;
}
},
]],
id
:
'memoList'
,
page
:
{},
});
//新增备忘弹窗
$
(
"#add_memo"
).
click
(
function
()
{
layer
.
open
({
type
:
2
,
content
:
'/supplier_memo/SaveSupplierMemo?view=iframe&supplier_id='
+
supplierId
,
area
:
[
'80%'
,
'80%'
],
title
:
'保存备忘录'
,
end
:
function
()
{
table
.
reload
(
'memoList'
);
}
});
})
table
.
on
(
'tool(memoList)'
,
function
(
obj
)
{
let
data
=
obj
.
data
;
let
layEvent
=
obj
.
event
;
if
(
layEvent
===
'update'
)
{
let
id
=
data
.
id
;
layer
.
open
({
type
:
2
,
content
:
'/supplier_memo/SaveSupplierMemo?view=iframe&id='
+
id
,
area
:
[
'80%'
,
'80%'
],
title
:
'修改备忘'
,
end
:
function
()
{
table
.
reload
(
'memoList'
);
}
});
}
if
(
layEvent
===
'delete'
)
{
layer
.
confirm
(
'确定要删除该备忘信息?'
,
function
(
index
)
{
let
id
=
data
.
id
;
let
res
=
ajax
(
'/api/supplier_memo/DeleteSupplierMemo'
,
{
id
:
id
})
if
(
res
.
err_code
===
0
)
{
table
.
reload
(
'memoList'
)
layer
.
msg
(
res
.
err_msg
,
{
icon
:
6
})
}
else
{
layer
.
msg
(
res
.
err_msg
,
{
icon
:
5
})
}
});
}
});
});
</script>
resources/views/web/SaveSupplierMemo.blade.php
0 → 100644
View file @
6845f7b3
<link
href=
"https://unpkg.com/@wangeditor/editor@latest/dist/css/style.css"
rel=
"stylesheet"
>
<style>
#editor
—
wrapper
{
border
:
1px
solid
#ccc
;
z-index
:
100
;
/* 按需定义 */
}
#toolbar-container
{
border-bottom
:
1px
solid
#ccc
;
}
#editor-container
{
height
:
200px
;
}
</style>
<div
class=
"layui-card"
>
<div
class=
"layui-card-body"
>
<form
class=
"layui-form"
action=
""
>
<div
class=
"layui-form-item"
>
<label
class=
"layui-form-label"
><span
class=
"require"
>
*
</span>
标题 :
</label>
<div
class=
"layui-input-block block-42"
>
<input
type=
"text"
name=
"title"
id=
"title"
placeholder=
""
class=
"layui-input"
value=
"{{$memo['title'] or ''}}"
>
</div>
</div>
<div
class=
"layui-form-item"
>
<label
class=
"layui-form-label"
><span
class=
"require"
>
*
</span>
内容 :
</label>
<div
class=
"layui-input-block block-42"
>
<div
id=
"editor—wrapper"
>
<div
id=
"toolbar-container"
>
<!-- 工具栏 -->
</div>
<div
id=
"editor-container"
>
<!-- 编辑器 -->
</div>
</div>
</div>
</div>
<div
class=
"layui-form-item"
>
<label
class=
"layui-form-label"
>
附件:
</label>
<div
class=
"layui-input-block"
>
<input
type=
"hidden"
name=
"attachment"
id=
"attachment"
value=
"{{$memo['attachment'] or ''}}"
>
<button
type=
"button"
class=
"layui-btn upload-img"
preview=
"preview"
data-obj=
"attachment"
>
<i
class=
"layui-icon"
>

</i>
上传附件
</button>
<a
target=
"_blank"
id=
"attachment_url"
href=
"{{$memo['attachment'] or ''}}"
>
{{$memo['attachment'] or ''}}
</a>
{{--
<img
@
if
(!
empty
($
memo
['
attachment
']))
src=
"{{$memo['attachment'] or ''}}"
--
}}
{{
--
@
endif
class=
"layui-upload-img"
width=
"50px"
height=
"50px"
id=
"preview"
>
--}}
</div>
<p
style=
"padding-left: 110px"
>
附件上传支持小于10M的PDF/JPG/PNG/BMP格式,每个备注只允许上传1份
</p>
</div>
<div
class=
"layui-form-item"
>
<div
align=
"center"
style=
"margin-top: 20px"
>
<button
type=
"button"
id=
"saveSupplierMemo"
class=
"layui-btn layui-btn-info submit-loading"
lay-submit
lay-filter=
"saveSupplierMemo"
>
确认
</button>
<button
type=
"button"
id=
"cancel"
class=
"layui-btn layui-btn-primary"
lay-submit
lay-filter=
"cancelSupplierMemo"
>
取消
</button>
</div>
</div>
</form>
</div>
</div>
<script
src=
"https://unpkg.com/@wangeditor/editor@latest/dist/index.js"
></script>
resources/views/web/UpdateSupplier.blade.php
View file @
6845f7b3
...
...
@@ -241,6 +241,7 @@
@
if
(!
checkPerm
('
ViewRuler
')
||
!
checkPerm
('
UpdateRuler
'))
style=
"display: none"
@
endif
>
@include('web.supplier.SupplierMemo')
@include('web.supplier.SupplierRuler')
</div>
</div>
...
...
resources/views/web/supplier/SupplierMemo.blade.php
0 → 100644
View file @
6845f7b3
<div
class=
"layui-row"
>
@if($operate == 'update')
<div
class=
"layui-btn-group demoTable"
style=
"margin-top: 5px"
>
<button
type=
"button"
class=
"layui-btn layui-btn-sm"
id=
"add_memo"
>
添加备忘录
</button>
</div>
@endif
<table
class=
"layui-table"
lay-filter=
"memoList"
id=
"memoList"
></table>
</div>
<script
type=
"text/html"
id=
"memoOperate"
>
<
button
class
=
"layui-btn layui-btn-xs"
type
=
"button"
lay
-
event
=
"update"
>
编辑
<
/button
>
<
button
class
=
"layui-btn layui-btn-xs layui-btn-danger"
type
=
"button"
lay
-
event
=
"delete"
>
删除
<
/button
>
</script>
@include('script.supplier.SupplierMemoScript')
resources/views/web/supplier/SupplierRuler.blade.php
View file @
6845f7b3
...
...
@@ -20,7 +20,7 @@
{{--采购备注--}}
<div
class=
"layui-form-item"
>
@if($operate==='update')
<button
class=
"layui-btn layui-btn-sm"
type=
"button"
id=
"savePurchaserRemark"
>
添加备注
</button>
\
<button
class=
"layui-btn layui-btn-sm"
type=
"button"
id=
"savePurchaserRemark"
>
添加备注
</button>
@endif
<table
class=
"layui-table"
lay-filter=
"purchaseRemarkList"
id=
"purchaseRemarkList"
></table>
</div>
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment