Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
L
loan-manager-customer
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
zhanhai
loan-manager-customer
Commits
22b45f42
Commit
22b45f42
authored
Aug 27, 2024
by
caimeng
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
把盈点通的代码移动一些过来;做了法诉材料下载的需求
parent
79d7d5e9
Changes
15
Hide whitespace changes
Inline
Side-by-side
Showing
15 changed files
with
998 additions
and
53 deletions
+998
-53
index.vue
src/components/McDialog/index.vue
+57
-0
form-item.vue
src/components/McForm/form-item.vue
+117
-0
index.vue
src/components/McForm/index.vue
+192
-11
pagination.vue
src/components/McTable/pagination.vue
+3
-3
ListItem.vue
src/components/McUpload/ListItem.vue
+71
-0
index.vue
src/components/McUpload/index.vue
+261
-0
BaseForm.js
src/mixins/BaseForm.js
+33
-0
components.js
src/mixins/components.js
+5
-1
form-table.js
src/mixins/form-table.js
+6
-5
index.js
src/router/index.js
+1
-1
api.js
src/server/api.js
+9
-3
LoadingManager.js
src/utils/LoadingManager.js
+39
-0
useOSS.js
src/utils/useOSS.js
+78
-0
create.vue
src/views/collection/components/create.vue
+89
-0
download.vue
src/views/collection/download.vue
+37
-29
No files found.
src/components/McDialog/index.vue
0 → 100644
View file @
22b45f42
<
template
>
<el-dialog
:close-on-click-modal=
"false"
:close-on-press-escape=
"false"
:title=
"title"
:width=
"width"
:visible
.
sync=
"visible"
:before-close=
"handleCancel"
>
<slot></slot>
<component
:is=
"componentTag"
></component>
<div
slot=
"footer"
v-if=
"footer"
class=
"dialog-footer"
>
<el-button
size=
"small"
@
click=
"handleCancel"
>
取 消
</el-button>
<el-button
size=
"small"
type=
"primary"
@
click=
"handleSubmit"
>
提 交
</el-button>
</div>
</el-dialog>
</
template
>
<
script
>
const
defaultOption
=
{
title
:
"弹框"
,
width
:
'35%'
,
center
:
false
}
export
default
{
name
:
"McDialog"
,
props
:
{
componentTag
:
{
type
:
Object
,
default
:
()
=>
null
},
footer
:
false
,
title
:
{
type
:
String
,
default
:
'弹框'
},
visible
:
false
,
width
:
{
type
:
String
,
default
:
"350px"
},
component
:
null
,
onSubmit
:
Function
,
onCancel
:
Function
},
methods
:
{
handleCancel
()
{
this
.
$emit
(
'update:visible'
,
false
)
this
.
onCancel
&&
this
.
onCancel
()
},
handleSubmit
()
{
this
.
$emit
(
'update:visible'
,
false
)
this
.
onSubmit
&&
this
.
onSubmit
()
},
}
}
</
script
>
<
style
lang=
"less"
scoped
></
style
>
\ No newline at end of file
src/components/McForm/form-item.vue
0 → 100644
View file @
22b45f42
<
template
>
<el-form-item
v-show=
"show"
:label=
"label"
:prop=
"prop"
:rules=
"rules"
>
<template
v-if=
"component === 'MUpload'"
>
<m-upload
:value
.
sync=
"currentValue"
v-bind=
"options"
v-on=
"$attrs.on"
/>
</
template
>
<
template
v-else
>
<component
:is=
"`el-$
{component}`" size="small" v-model="currentValue" v-bind="options" style="width: 100%;" v-on="$attrs.on">
<template
v-if=
"component === 'select'"
>
<el-option
v-for=
"(item, index) in $attrs.options"
:key=
"index"
:label=
"item.label"
:value=
"item.value"
></el-option>
</
template
>
<
template
v-if=
"component === 'input'"
>
<template
v-if=
"$attrs.appendText"
slot=
"append"
>
{{
$attrs
.
appendText
}}
</
template
>
<
template
v-if=
"$attrs.prependText"
slot=
"prepend"
>
{{
$attrs
.
prependText
}}
</
template
>
</template>
</component>
</template>
<div
v-if=
"$attrs.helpMessage"
class=
"el-help-message"
>
{{ $attrs.helpMessage }}
</div>
</el-form-item>
</template>
<
script
>
import
MUpload
from
'@/components/McUpload'
const
defaultOptionMap
=
{
input
:
{
placeholder
:
label
=>
`请输入
${
label
}
`
,
},
select
:
{
placeholder
:
label
=>
`请选择
${
label
}
`
,
},
'date-picker'
:
{
placeholder
:
label
=>
`请选择
${
label
}
`
,
valueFormat
:
'yyyy-MM-dd'
,
},
'date-picker-daterange'
:
{
valueFormat
:
'yyyy-MM-dd'
,
rangeSeparator
:
'至'
,
startPlaceholder
:
'开始日期'
,
endPlaceholder
:
'结束日期'
,
},
}
export
default
{
name
:
'BaseFormItem'
,
components
:
{
MUpload
},
inheritAttrs
:
false
,
props
:
{
value
:
{
type
:
[
String
,
Number
,
Object
,
Array
],
default
:
()
=>
''
,
},
label
:
String
,
prop
:
{
type
:
String
,
required
:
true
,
},
component
:
{
type
:
String
,
required
:
true
,
},
rules
:
{
type
:
[
Object
,
Array
],
default
:
()
=>
[],
},
show
:
{
type
:
Boolean
,
default
:
true
,
}
},
computed
:
{
currentValue
:
{
get
()
{
return
this
.
value
},
set
(
val
)
{
this
.
$emit
(
'input'
,
val
)
},
},
options
()
{
const
options
=
{
...
this
.
$attrs
}
const
defaultOption
=
this
.
getDefaultOption
()
return
{
...
defaultOption
,
clearable
:
true
,
...
options
,
}
},
},
methods
:
{
getDefaultOption
()
{
const
{
type
}
=
this
.
$attrs
const
key
=
type
?
`
${
this
.
component
}
-
${
type
}
`
:
this
.
component
const
defaultOption
=
defaultOptionMap
[
key
]
||
defaultOptionMap
[
this
.
component
]
||
{}
let
placeholder
=
defaultOption
.
placeholder
if
(
placeholder
)
{
placeholder
=
typeof
placeholder
===
'function'
?
placeholder
(
this
.
label
)
:
placeholder
}
return
{
...
defaultOption
,
placeholder
}
},
},
}
</
script
>
<
style
lang=
"less"
scoped
>
.el-help-message {
color: #999;
font-size: 12px;
}
</
style
>
src/components/McForm/index.vue
View file @
22b45f42
<
template
>
<
template
>
<div>
<div
class=
"common-form"
>
<el-form
ref=
"formRef"
:model=
"values"
label-suffix=
":"
v-bind=
"$attrs"
@
submit
.
native
.
prevent
>
<template
v-if=
"grouping"
>
<block
v-for=
"child in formatSchemas"
:key=
"child.label"
>
<block-header
:title=
"child.label"
/>
<el-row>
<el-col
v-for=
"item in child.options"
:key=
"item.prop"
:span=
"item.span || 24"
>
<BaseFormItem
v-model=
"values[item.prop]"
class=
"base-form-item"
v-bind=
"item"
/>
</el-col>
</el-row>
</block>
</
template
>
<el-row
v-else
>
<el-col
v-for=
"item in formatSchemas"
:key=
"item.prop"
:span=
"item.span || 24"
>
<BaseFormItem
v-model=
"values[item.prop]"
class=
"base-form-item"
v-bind=
"item"
/>
</el-col>
</el-row>
<slot
name=
"footer"
>
<el-form-item>
<el-button
type=
"primary"
size=
"small"
@
click=
"submit"
>
提交
</el-button>
<el-button
size=
"small"
@
click=
"cancel"
>
取消
</el-button>
</el-form-item>
</slot>
</el-form>
</div>
</div>
</
template
>
</template>
<
script
>
import
BaseFormItem
from
'./form-item.vue'
export
default
{
name
:
'BaseForm'
,
components
:
{
BaseFormItem
,
},
inheritAttrs
:
false
,
props
:
{
grouping
:
false
,
value
:
{
type
:
Object
,
default
:
()
=>
{
},
},
schemas
:
{
type
:
Array
,
required
:
true
,
default
:
()
=>
[],
},
onSubmit
:
Function
,
onInput
:
Function
,
},
computed
:
{
values
:
{
get
()
{
return
this
.
value
||
{}
},
set
(
val
)
{
if
(
this
.
onInput
)
{
this
.
onInput
(
val
)
}
this
.
$emit
(
'input'
,
val
)
},
},
/**
* @description 获取格式化的schema
* @description 格式化schema
*/
formatSchemas
()
{
if
(
this
.
grouping
)
{
return
this
.
schemas
.
forEach
(
child
=>
{
child
.
options
=
item
.
options
.
map
(
item
=>
({
...
item
,
rules
:
(
item
.
required
&&
!
item
.
rules
)
?
[
{
required
:
true
,
message
:
this
.
rulesMessage
(
item
.
component
,
item
.
placeholder
,
item
.
label
),
trigger
:
this
.
rulesTrigger
(
item
.
component
),
},
]
:
item
.
rules
,
})
)
})
}
else
{
return
this
.
schemas
.
map
(
item
=>
({
...
item
,
rules
:
(
item
.
required
&&
!
item
.
rules
)
?
[
{
required
:
true
,
message
:
this
.
rulesMessage
(
item
.
component
,
item
.
placeholder
,
item
.
label
),
trigger
:
this
.
rulesTrigger
(
item
.
component
),
},
]
:
item
.
rules
,
}))
}
},
},
watch
:
{
schemas
:
{
handler
:
'initValues'
,
immediate
:
true
,
deep
:
true
,
},
},
methods
:
{
/**
* @description 根据组件类型获取placeholder
* @param component
* @param placeholder
* @param label
*/
rulesMessage
(
component
,
placeholder
,
label
)
{
switch
(
component
)
{
case
'input'
:
return
placeholder
||
`请输入
${
label
}
`
case
'upload'
:
case
'MUpload'
:
return
placeholder
||
`请上传
${
label
}
`
default
:
return
placeholder
||
`请选择
${
label
}
`
}
},
/**
* @description 获取触发验证的方式
* @param trigger 'input' | 'upload' | 'select' | 'cascader' | 'date-picker' | 'time-picker' | 'datetime-picker' | 'switch' | 'slider' | 'rate' | 'radio' | 'checkbox' | 'input-number' | 'color-picker'
*/
rulesTrigger
(
trigger
)
{
switch
(
trigger
)
{
case
'input'
:
return
'blur'
case
'MUpload'
:
case
'upload'
:
case
'select'
:
case
'cascader'
:
case
'date-picker'
:
case
'time-picker'
:
case
'datetime-picker'
:
case
'switch'
:
case
'slider'
:
case
'rate'
:
case
'radio'
:
case
'checkbox'
:
case
'input-number'
:
case
'color-picker'
:
return
'change'
default
:
return
'blur'
}
},
initValues
()
{
this
.
values
=
this
.
schemas
.
reduce
((
values
,
item
)
=>
{
values
[
item
.
prop
]
=
item
.
value
return
values
},
{})
},
submit
()
{
const
values
=
{
...
this
.
values
}
this
.
$refs
.
formRef
.
validate
((
valid
)
=>
{
if
(
valid
)
{
this
.
$emit
(
'submit'
,
values
)
}
})
},
cancel
()
{
this
.
$refs
[
'formRef'
].
clearValidate
();
this
.
$emit
(
'cancel'
)
},
reset
()
{
this
.
$emit
(
'reset'
)
this
.
$refs
.
formRef
.
resetFields
()
this
.
initValues
()
},
},
}
</
script
>
<
style
lang=
"less"
scoped
>
.common-form {
background: #FFF;
margin-bottom: 24px;
}
::v-deep {
.base-form-item {
<
script
>
export
default
{
}
}
</
script
>
.el-input {
<
style
lang=
"scss"
scoped
>
width: 100%;
}
</
style
>
}
\ No newline at end of file
</
style
>
\ No newline at end of file
src/components/McTable/pagination.vue
View file @
22b45f42
...
@@ -28,13 +28,13 @@ export default {
...
@@ -28,13 +28,13 @@ export default {
},
},
computed
:
{
computed
:
{
position
()
{
position
()
{
return
this
.
pagination
.
position
||
'
right
'
return
this
.
pagination
.
position
||
'
center
'
},
},
options
()
{
options
()
{
return
{
return
{
...
defaultOption
,
...
defaultOption
,
...
this
.
pagination
,
...
this
.
pagination
,
currentPage
:
this
.
pagination
.
pageNo
||
this
.
pagination
.
currentPage
,
currentPage
:
this
.
pagination
.
current
||
this
.
pagination
.
currentPage
,
}
}
},
},
},
},
...
@@ -51,7 +51,7 @@ export default {
...
@@ -51,7 +51,7 @@ export default {
pageSize
=
val
pageSize
=
val
}
}
this
.
$emit
(
'change'
,
{
pageNo
,
pageSize
})
this
.
$emit
(
'change'
,
{
current
:
pageNo
,
size
:
pageSize
})
},
},
},
},
}
}
...
...
src/components/McUpload/ListItem.vue
0 → 100644
View file @
22b45f42
<
template
>
<div
class=
"file-list-item"
>
<ul>
<li
v-for=
"item in fileList"
:key=
"item.url"
>
<a
:href=
"item.url"
target=
"_blank"
>
<i
class=
"el-icon-paperclip"
/>
{{
item
.
name
}}
</a>
<div
class=
"action"
>
<span
@
click=
"$emit('preview', item)"
>
查看
</span>
<span
v-if=
"!disabled"
@
click=
"$emit('download', item)"
>
下载
</span>
<span
v-if=
"!disabled"
@
click=
"$emit('delete', item)"
>
删除
</span>
</div>
</li>
</ul>
</div>
</
template
>
<
script
>
export
default
{
name
:
'FileListItem'
,
props
:
{
fileList
:
{
type
:
Array
,
default
:
()
=>
[]
},
disabled
:
{
type
:
Boolean
,
default
:
false
}
},
data
()
{
return
{
}
},
}
</
script
>
<
style
lang=
'less'
scoped
>
.file-list-item {
ul {
list-style: none;
padding: 0;
margin: 0;
li {
display: flex;
justify-content: space-between;
align-items: center;
a {
flex: 1;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
color: #606266;
&:hover {
color: #409EFF;
}
}
.action {
span {
font-size: 12px;
margin-right: 10px;
color: #409EFF;
cursor: pointer;
}
}
}
}
}
</
style
>
src/components/McUpload/index.vue
0 → 100644
View file @
22b45f42
<!-- 预授信申述 -->
<
template
>
<div>
<el-upload
:class=
"
{ hidden: limitHidden }"
:file-list="fileList"
:list-type="listType"
:multiple="multiple"
:limit="limit"
:show-file-list="showFileList"
action="#"
:accept='accept'
:before-upload="handleBeforeUpload"
:http-request='(params) => handleUpload(params)'
:on-success="handleSuccess"
:on-exceed="handleExceed"
>
<i
v-if=
"listType === 'picture-card'"
slot=
"default"
class=
"el-icon-plus"
></i>
<el-button
v-else
size=
"small"
icon=
"el-icon-upload"
type=
"primary"
>
点击上传
</el-button>
<div
slot=
"file"
slot-scope=
"
{ file }">
<img
class=
"el-upload-list__item-thumbnail"
:src=
"file.url"
:alt=
"file.name"
>
<span
class=
"el-upload-list__item-actions"
>
<span
class=
"el-upload-list__item-preview"
@
click=
"handlePreview(file)"
>
<i
class=
"el-icon-zoom-in"
></i>
</span>
<span
v-if=
"!disabled"
class=
"el-upload-list__item-delete"
@
click=
"handleDownload(file)"
>
<i
class=
"el-icon-download"
></i>
</span>
<span
v-if=
"!disabled"
class=
"el-upload-list__item-delete"
@
click=
"handleRemove(file)"
>
<i
class=
"el-icon-delete"
></i>
</span>
</span>
</div>
<div
slot=
"tip"
class=
"el-upload__tip"
>
{{
tip
}}
</div>
</el-upload>
<file-list-item
v-if=
"!showFileList"
:file-list=
"fileList"
:disabled=
"disabled"
@
preview=
"handlePreview"
@
download=
"handleDownload"
@
delete=
"handleRemove"
></file-list-item>
<el-image-viewer
v-if=
"imgViewerVisible"
:url-list=
"urlList"
:on-close=
"handleClose"
></el-image-viewer>
</div>
</
template
>
<
script
>
import
_
from
'lodash'
import
ListItem
from
'./ListItem'
import
useOSS
from
'@/utils/useOSS'
const
{
uploadFile
}
=
useOSS
()
export
default
{
name
:
'MUpload'
,
components
:
{
'el-image-viewer'
:
()
=>
import
(
'element-ui/packages/image/src/image-viewer'
),
'file-list-item'
:
ListItem
,
},
props
:
{
/**
* 上传文件列表 value.sync 绑定
* @type {Array}
*/
value
:
{
type
:
[
String
,
Array
],
require
:
true
,
default
:
()
=>
[]
},
/**
* 上传文件列表类型
* @type {String} text/picture-card
*/
listType
:
{
type
:
String
,
require
:
false
,
default
:
'text'
},
multiple
:
{
type
:
Boolean
,
require
:
false
,
default
:
false
},
/**
* 是否显示文件列表 - TODO listType 为 picture-card 时显示 showFileList 需设置为 true
* @type {Boolean}
* @default false
*/
showFileList
:
{
type
:
Boolean
,
require
:
false
,
default
:
false
},
/**
* 上传文件类型
* @type {String}
*/
accept
:
{
type
:
String
,
require
:
false
,
default
:
'.jpeg, .jpg, .png, .bmp, .gif'
},
limit
:
{
type
:
Number
,
require
:
false
},
/**
* 上传文件路径
* @type {String} YDT-CRM-FRONT
*/
path
:
{
type
:
String
,
require
:
false
},
/**
* 上传提示
* @type {String}
*/
tip
:
{
type
:
String
,
require
:
false
},
/**
* 是否禁用
* @type {Boolean}
* @default false
*/
disabled
:
{
type
:
Boolean
,
require
:
false
,
default
:
false
},
},
data
()
{
return
{
// 上传文件列表
fileList
:
[],
imgViewerVisible
:
false
,
urlList
:
[],
}
},
computed
:
{
limitHidden
()
{
return
this
.
limit
&&
this
.
fileList
.
length
>=
this
.
limit
}
},
watch
:
{
value
(
newVal
)
{
if
(
newVal
)
{
const
newList
=
_
.
compact
(
newVal
)
this
.
fileList
=
Array
.
isArray
(
newList
)
?
newList
.
map
(
item
=>
({
name
:
item
.
name
,
url
:
item
.
url
}))
:
[]
}
else
{
this
.
fileList
=
[]
}
}
},
methods
:
{
handlePreview
(
file
)
{
if
(
this
.
listType
===
'picture-card'
)
{
this
.
urlList
=
[
file
.
url
]
this
.
imgViewerVisible
=
true
}
else
{
window
.
open
(
file
.
url
)
}
},
handleDownload
(
file
)
{
window
.
open
(
file
.
url
)
},
handleClose
()
{
this
.
imgViewerVisible
=
false
this
.
urlList
=
[]
},
// 上传前
handleBeforeUpload
(
file
)
{
const
type
=
file
.
type
return
true
},
// 上传
async
handleUpload
(
file
)
{
try
{
const
res
=
await
uploadFile
(
file
.
file
,
this
.
path
)
this
.
$notify
({
title
:
'成功'
,
message
:
`
${
file
.
file
.
name
}
上传成功`
,
type
:
'success'
,
duration
:
2000
});
if
(
this
.
limit
===
1
)
{
this
.
fileList
=
[...
res
]
}
else
{
this
.
fileList
.
push
(...
res
)
}
this
.
updateValue
(
this
.
fileList
)
}
catch
(
err
)
{
console
.
log
(
err
)
}
},
updateValue
(
fileList
)
{
this
.
$emit
(
'update:value'
,
fileList
);
this
.
$emit
(
'change'
,
fileList
)
},
// 上传成功
handleSuccess
(
res
,
file
)
{
this
.
$notify
({
title
:
'成功'
,
message
:
file
.
name
+
",上传成功"
,
type
:
'success'
});
},
// 删除
handleRemove
(
file
)
{
this
.
$confirm
(
`是否删除 <a target="_blank">
${
file
.
name
}
</a> ?`
,
'提示'
,
{
confirmButtonText
:
'确定'
,
cancelButtonText
:
'取消'
,
type
:
'warning'
,
dangerouslyUseHTMLString
:
true
,
}).
then
(()
=>
{
const
cacheFileList
=
_
.
cloneDeep
(
this
.
fileList
)
this
.
fileList
=
cacheFileList
.
filter
(
item
=>
{
if
(
item
.
url
!==
file
.
url
)
{
return
item
}
})
this
.
updateValue
(
this
.
fileList
)
})
},
// 超出限制
handleExceed
()
{
this
.
$notify
({
title
:
'提示'
,
message
:
`当前限制上传最多
${
this
.
limit
}
个文件`
,
type
:
'warning'
,
duration
:
2000
});
},
}
}
</
script
>
<
style
lang=
'less'
scoped
>
.hidden {
::v-deep {
.el-upload--picture-card {
display: none;
}
.el-upload__tip {
line-height: normal;
margin-top: 0;
}
}
}
</
style
>
src/mixins/BaseForm.js
0 → 100644
View file @
22b45f42
export
function
BaseFormMixin
()
{
return
{
data
()
{
return
{
form
:
{
value
:
null
,
// onSubmit: (values) => {
// console.log('表单提交', values);
// },
onInput
:
val
=>
{
this
.
form
.
value
=
val
},
},
}
},
methods
:
{
/**
* @description: 设置表单字段值
* @param {*} formSchemas 表单字段
* @param {*} formData 表单数据
*/
setFieldsValue
(
formSchemas
,
formData
)
{
this
[
formSchemas
]
=
this
[
formSchemas
].
map
((
item
)
=>
({
...
item
,
value
:
typeof
formData
===
'object'
?
formData
[
item
.
prop
]
||
item
.
value
:
this
[
formData
]?.[
item
.
prop
]
||
item
.
value
,
}))
},
},
}
}
src/mixins/components.js
View file @
22b45f42
import
BlockHeader
from
"@/components/byh/componments/blockHeader"
;
import
BlockHeader
from
"@/components/byh/componments/blockHeader"
;
import
ProductSelect
from
"@/components/common/ProductSelect"
;
import
ProductSelect
from
"@/components/common/ProductSelect"
;
import
BaseDialog
from
"@/components/McDialog/index"
;
import
AppSelect
from
"@/components/common/AppSelect"
;
import
AppSelect
from
"@/components/common/AppSelect"
;
import
McUpload
from
"@/components/McUpload/index.vue"
;
export
default
{
export
default
{
components
:
{
components
:
{
BlockHeader
,
BlockHeader
,
ProductSelect
,
ProductSelect
,
AppSelect
AppSelect
,
BaseDialog
,
McUpload
}
}
}
}
src/mixins/form-table.js
View file @
22b45f42
...
@@ -4,8 +4,8 @@ import BaseTable from '@/components/McTable/index.vue'
...
@@ -4,8 +4,8 @@ import BaseTable from '@/components/McTable/index.vue'
export
function
FormTableMixin
(
service
,
defaultProps
=
{})
{
export
function
FormTableMixin
(
service
,
defaultProps
=
{})
{
const
pagination
=
defaultProps
&&
{
const
pagination
=
defaultProps
&&
{
pageNo
:
1
,
current
:
1
,
pageS
ize
:
10
,
s
ize
:
10
,
total
:
0
,
total
:
0
,
...
defaultProps
,
...
defaultProps
,
}
}
...
@@ -49,7 +49,7 @@ export function FormTableMixin(service, defaultProps = {}) {
...
@@ -49,7 +49,7 @@ export function FormTableMixin(service, defaultProps = {}) {
// this.getList()
// this.getList()
// }
// }
//
this.getList()
this
.
getList
()
},
},
activated
()
{
activated
()
{
...
@@ -62,8 +62,8 @@ export function FormTableMixin(service, defaultProps = {}) {
...
@@ -62,8 +62,8 @@ export function FormTableMixin(service, defaultProps = {}) {
const
{
pagination
}
=
this
.
table
const
{
pagination
}
=
this
.
table
return
{
return
{
...
this
.
form
.
value
,
...
this
.
form
.
value
,
pageNum
:
pagination
.
pageNo
,
current
:
pagination
.
current
,
pageSize
:
pagination
.
pageS
ize
,
size
:
pagination
.
s
ize
,
}
}
},
},
},
},
...
@@ -71,6 +71,7 @@ export function FormTableMixin(service, defaultProps = {}) {
...
@@ -71,6 +71,7 @@ export function FormTableMixin(service, defaultProps = {}) {
async
getList
()
{
async
getList
()
{
this
.
table
.
loading
=
true
this
.
table
.
loading
=
true
try
{
try
{
console
.
log
(
this
.
params
,
'请求参数'
)
const
{
data
=
[],
total
=
0
}
=
(
await
service
?.
call
(
this
,
this
.
params
,
this
))
||
{}
const
{
data
=
[],
total
=
0
}
=
(
await
service
?.
call
(
this
,
this
.
params
,
this
))
||
{}
this
.
table
.
loading
=
false
this
.
table
.
loading
=
false
this
.
table
.
data
=
data
this
.
table
.
data
=
data
...
...
src/router/index.js
View file @
22b45f42
...
@@ -208,7 +208,7 @@ export default new Router({
...
@@ -208,7 +208,7 @@ export default new Router({
},
},
{
{
path
:
'/collection/download'
,
path
:
'/collection/download'
,
name
:
'
CollectionSearch
'
,
name
:
'
LitigationParam
'
,
component
:
resolve
=>
require
([
'../views/collection/download.vue'
],
resolve
),
component
:
resolve
=>
require
([
'../views/collection/download.vue'
],
resolve
),
meta
:
{
meta
:
{
title
:
'法诉材料'
,
title
:
'法诉材料'
,
...
...
src/server/api.js
View file @
22b45f42
import
{
GET
,
POST
}
from
"@/utils/ajax"
;
import
{
GET
,
POST
}
from
"@/utils/ajax"
;
// 初始化下载列表
// 法诉资料下载列表页面
export
default
{
export
default
{
GetCollectionDownLoad
(
data
)
{
GetCollectionDownLoad
(
data
)
{
return
GET
(
'/protocol/selectProtocolEnumList'
,
data
);
return
POST
(
'/proceeding/searchList'
,
data
);
},
CreateCollectionDownLoad
(
data
)
{
return
POST
(
'/proceeding/createTask'
,
data
);
},
},
ossToken
(
data
){
return
GET
(
'/oss/ossToken'
,
data
)
}
};
};
src/utils/LoadingManager.js
0 → 100644
View file @
22b45f42
import
Vue
from
'vue'
let
loadingCount
=
0
let
loading
const
LoadingManager
=
{
startLoading
:
function
()
{
loading
=
Vue
.
prototype
.
$loading
({
lock
:
true
,
text
:
'正在加载'
,
spinner
:
'el-icon-loading'
,
background
:
'rgba(0, 0, 0, 0.7)'
,
})
},
closeLoading
:
function
()
{
loading
.
close
()
},
showFullScreenLoading
:
function
()
{
if
(
loadingCount
===
0
)
{
LoadingManager
.
startLoading
()
}
loadingCount
++
},
hideFullScreenLoading
:
function
()
{
// 添加延时,防止多次间隔很短的请求造成的页面闪烁
setTimeout
(()
=>
{
if
(
loadingCount
<=
0
)
return
loadingCount
--
if
(
loadingCount
===
0
)
{
LoadingManager
.
closeLoading
()
}
},
100
)
},
}
export
default
LoadingManager
src/utils/useOSS.js
0 → 100644
View file @
22b45f42
import
OSS
from
"ali-oss"
;
import
API
from
"@/server/api"
;
import
dayjs
from
"dayjs"
;
import
LoadingManager
from
"@/utils/LoadingManager"
;
let
ossCredentials
=
null
;
/**
* 判断临时凭证是否到期。
**/
function
isCredentialsExpired
(
credentials
)
{
if
(
!
credentials
)
{
return
true
;
}
const
expireDate
=
dayjs
(
credentials
.
expiration
).
valueOf
();
const
now
=
dayjs
().
valueOf
();
// 如果有效期不足一分钟,视为过期。
return
expireDate
-
now
<=
60000
;
}
const
progress
=
(
p
)
=>
{
// Object的上传进度。
console
.
log
(
p
);
};
export
default
function
useOSS
()
{
const
uploadFile
=
async
(
file
,
path
=
"LOAN-CUSTOMER"
)
=>
{
const
EXT
=
file
.
name
.
split
(
"."
);
const
PATH_FILE_SUFFIX
=
`
${
path
}
/
${
dayjs
().
format
(
"YYYYMMDD"
)}
/
${
EXT
[
0
]
}
-
${
dayjs
().
valueOf
()}
.
${
EXT
[
EXT
.
length
-
1
]}
`
;
console
.
log
(
EXT
,
PATH_FILE_SUFFIX
,
"那是"
);
if
(
isCredentialsExpired
(
ossCredentials
))
{
const
params
=
{
filePath
:
PATH_FILE_SUFFIX
};
const
{
data
}
=
await
API
.
ossToken
({
...
params
});
ossCredentials
=
Object
.
assign
({},
data
.
result
);
}
console
.
log
(
ossCredentials
,
"xx "
);
const
client
=
new
OSS
({
bucket
:
ossCredentials
.
bucket
,
region
:
"oss-cn-hangzhou"
||
ossCredentials
.
region
,
accessKeyId
:
ossCredentials
.
accessKeyId
,
accessKeySecret
:
ossCredentials
.
accessKeySecret
,
stsToken
:
ossCredentials
.
securityToken
,
refreshSTSTokenInterval
:
300000
,
// refresh token every 30 minutes
});
try
{
LoadingManager
.
showFullScreenLoading
();
const
result
=
await
client
.
multipartUpload
(
PATH_FILE_SUFFIX
,
file
,
{
progress
,
});
LoadingManager
.
hideFullScreenLoading
();
const
FILE_HOST
=
ossCredentials
.
hostUrl
;
// 资源地址
const
originalUrl
=
result
.
res
.
requestUrls
[
0
].
split
(
"?"
)[
0
];
const
url
=
originalUrl
.
replace
(
/^https
?
:
\/\/[^\/]
+/
,
FILE_HOST
);
// 拼接完整资源地址
if
(
url
)
{
return
[
{
url
:
url
,
name
:
file
.
name
,
},
];
}
else
{
throw
new
Error
(
"上传失败"
);
}
}
catch
(
error
)
{
LoadingManager
.
hideFullScreenLoading
();
// eslint-disable-next-line no-console
console
.
log
(
error
);
throw
new
Error
(
error
);
}
};
return
{
uploadFile
};
}
src/views/collection/components/create.vue
0 → 100644
View file @
22b45f42
<
template
>
<div
class=
"box-dialog"
>
<BaseForm
v-bind=
"form"
:schemas=
"formConfig"
label-width=
"110px"
@
cancel=
"onCancel"
@
submit=
"onSubmit"
/>
</div>
</
template
>
<
script
>
import
BaseForm
from
'@/components/McForm/index.vue'
import
{
BaseFormMixin
}
from
'@/mixins/BaseForm'
import
API
from
'@/server/api'
export
default
{
name
:
"CreateDownload"
,
components
:
{
BaseForm
},
props
:
{
callback
:
Function
},
mixins
:
[
BaseFormMixin
()],
data
()
{
return
{
formConfig
:
[
{
component
:
'MUpload'
,
label
:
'文件'
,
prop
:
'excelUrl'
,
limit
:
3
,
showFileList
:
false
,
accept
:
'.xltx,.xltm,.xlsx,.xlsm,.xls'
,
value
:
''
,
rules
:
[
{
required
:
true
,
message
:
'请上传文件'
,
trigger
:
'change'
},
],
helpMessage
:
'请上传借款编号:loan_no'
},
{
component
:
'input'
,
label
:
'案件批次'
,
prop
:
'batchName'
,
value
:
''
,
rules
:
[
{
required
:
true
,
message
:
'请填写案件批次'
,
trigger
:
'blur'
},
],
},
{
component
:
'input'
,
type
:
"textarea"
,
label
:
'备注'
,
prop
:
'memo'
,
value
:
''
,
rules
:
[
{
required
:
true
,
message
:
'请填写备注'
,
trigger
:
'blur'
},
],
}
]
}
},
methods
:
{
async
onSubmit
(
val
)
{
try
{
const
params
=
Object
.
assign
({},
val
)
params
.
excelUrl
=
params
.
excelUrl
[
0
][
'url'
]
params
.
creator
=
window
.
localStorage
.
getItem
(
'userName'
)
const
{
data
:
{
success
,
message
}
}
=
await
API
.
CreateCollectionDownLoad
(
params
)
if
(
success
)
{
this
.
$message
.
success
(
message
)
this
.
$emit
(
'callback'
)
}
else
{
this
.
$message
.
error
(
message
)
}
setTimeout
(()
=>
{
this
.
onCancel
();
},
500
)
}
catch
(
err
)
{
this
.
$message
({
message
:
'操作失败'
})
}
},
onCancel
()
{
this
.
$children
[
0
].
reset
()
this
.
$parent
.
$parent
.
handleCancel
();
}
}
}
</
script
>
<
style
lang=
"less"
scoped
></
style
>
\ No newline at end of file
src/views/collection/download.vue
View file @
22b45f42
...
@@ -2,87 +2,92 @@
...
@@ -2,87 +2,92 @@
<div
class=
"page-download"
>
<div
class=
"page-download"
>
<block-header
title=
"搜索"
/>
<block-header
title=
"搜索"
/>
<BaseSearch
v-bind=
"form"
ref=
"search"
:config=
"searchConfig"
></BaseSearch>
<BaseSearch
v-bind=
"form"
ref=
"search"
:config=
"searchConfig"
></BaseSearch>
<block-header
title=
"法诉材料列表"
>
<el-button
size=
"small"
@
click=
"visible = true"
type=
"primary"
>
上传生成材料
</el-button>
</block-header>
<BaseTable
v-bind=
"table"
ref=
"table"
:columns=
"columns"
></BaseTable>
<BaseTable
v-bind=
"table"
ref=
"table"
:columns=
"columns"
></BaseTable>
<!-- 上传并生成材料 弹框 -->
<BaseDialog
:visible
.
sync=
"visible"
title=
"上传并生成材料"
width=
"35%"
>
<component
is=
"CreateDownload"
@
callback=
"reload"
></component>
</BaseDialog>
</div>
</div>
</
template
>
</
template
>
<
script
>
<
script
>
import
_
from
'lodash'
import
_
from
'lodash'
import
{
FormTableMixin
}
from
'@/mixins/form-table'
import
{
FormTableMixin
}
from
'@/mixins/form-table'
import
dayjs
from
'dayjs
'
import
CreateDownload
from
'./components/create.vue
'
import
API
from
'@/server/api'
import
API
from
'@/server/api'
// 获取列表
// 获取列表
const
service
=
async
(
params
)
=>
{
const
service
=
async
(
params
)
=>
{
try
{
try
{
const
res
=
await
API
.
GetCollectionDownLoad
({...
params
})
const
{
data
=
{}
}
=
await
API
.
GetCollectionDownLoad
({
...
params
})
console
.
log
(
res
,
'哈哈'
)
return
{
return
{
data
:
data
.
result
?.
data
,
data
:
''
,
total
:
data
.
result
?.
total
total
:
''
}
}
catch
{
console
.
log
(
'初始化法诉下载列表报错'
)
}
}
}
catch
{
console
.
log
(
'报错了'
)
}
}
}
export
default
{
export
default
{
name
:
"CollectionDownload"
,
name
:
"CollectionDownload"
,
mixins
:
[
FormTableMixin
(
service
())],
mixins
:
[
FormTableMixin
(
service
)],
components
:
{
CreateDownload
},
data
()
{
data
()
{
return
{
return
{
visible
:
false
,
searchConfig
:
[
searchConfig
:
[
{
{
component
:
'input'
,
component
:
'input'
,
prop
:
'
company
Name'
,
prop
:
'
batch
Name'
,
label
:
'案件批次'
,
label
:
'案件批次'
,
placeholder
:
'请输入案件批次'
placeholder
:
'请输入案件批次'
},
},
{
{
component
:
'select'
,
component
:
'select'
,
prop
:
'
b
'
,
prop
:
'
riskType
'
,
label
:
'状态'
,
label
:
'状态'
,
placeholder
:
'请选择'
,
placeholder
:
'请选择'
,
options
:
[]
options
:
[
{
label
:
'已创建'
,
value
:
'CREATED'
},
{
label
:
'生成中'
,
value
:
'NEEDZIP'
},
{
label
:
'已完成'
,
value
:
'FINISHED'
}
]
}
}
],
],
columns
:
[
columns
:
[
{
{
label
:
'案件批次'
,
label
:
'案件批次'
,
prop
:
'
company
Name'
,
prop
:
'
batch
Name'
,
},
},
{
{
label
:
'案件数'
,
label
:
'案件数'
,
prop
:
'
a
'
,
prop
:
'
caseNumber
'
,
},
},
{
{
label
:
'状态'
,
label
:
'状态'
,
prop
:
'
b
'
,
prop
:
'
caseStatusStr
'
,
},
},
{
{
label
:
'创建时间'
,
label
:
'创建时间'
,
prop
:
'
c
'
,
prop
:
'
gmtCreatedStr
'
,
},
},
{
{
label
:
'更新时间'
,
label
:
'更新时间'
,
prop
:
'
d
'
,
prop
:
'
gmtModifiedStr
'
,
},
},
{
{
label
:
'备注'
,
label
:
'备注'
,
prop
:
'
e
'
,
prop
:
'
memo
'
,
},
},
{
{
label
:
'操作人'
,
label
:
'操作人'
,
prop
:
'f'
,
prop
:
'creator'
},
{
label
:
'创建时间'
,
prop
:
'createdTime'
,
render
:
(
_
,
text
)
=>
{
return
<
span
>
{
text
&&
dayjs
(
text
).
format
(
'YYYY-MM-DD HH:mm:ss'
)}
<
/span
>
}
}
}
],
],
}
}
...
@@ -102,6 +107,9 @@ export default {
...
@@ -102,6 +107,9 @@ export default {
}
catch
(
err
)
{
}
catch
(
err
)
{
this
.
$message
.
error
(
res
||
'初始化协议枚举列表报错'
);
this
.
$message
.
error
(
res
||
'初始化协议枚举列表报错'
);
}
}
},
async
reload
()
{
this
.
getList
()
}
}
},
},
}
}
...
...
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