Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
A
admin
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
华润手术跟台
admin
Commits
c2eb20d8
提交
c2eb20d8
authored
10月 26, 2022
作者:
leon
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
文件上传修改。医院新增
上级
491924b2
显示空白字符变更
内嵌
并排
正在显示
7 个修改的文件
包含
76 行增加
和
77 行删除
+76
-77
.env.development
.env.development
+1
-1
upload.ts
src/api/system/upload.ts
+10
-0
UploadModal.vue
src/components/Upload/src/UploadModal.vue
+14
-31
props.ts
src/components/Upload/src/props.ts
+1
-1
drawer.vue
src/views/system/hospital/drawer.vue
+4
-4
index.vue
src/views/system/hospital/index.vue
+5
-1
schema.ts
src/views/system/hospital/schema.ts
+41
-39
没有找到文件。
.env.development
浏览文件 @
c2eb20d8
...
...
@@ -16,7 +16,7 @@ VITE_DROP_CONSOLE=false
VITE_GLOB_API_URL=http://192.168.101.69:8087
# File upload address, optional
VITE_GLOB_UPLOAD_URL=/upload
VITE_GLOB_UPLOAD_URL=
http://192.168.101.69:8087/v1/sys
/upload
# Interface prefix
VITE_GLOB_API_URL_PREFIX=
src/api/system/upload.ts
0 → 100644
浏览文件 @
c2eb20d8
import
{
defHttp
}
from
'/@/utils/http/axios'
;
import
{
UploadFileParams
}
from
'/#/axios'
;
import
{
getAppEnvConfig
}
from
'/@/utils/env'
;
const
{
VITE_GLOB_UPLOAD_URL
}
=
getAppEnvConfig
();
/**
* 上传
*/
export
const
upload
=
(
params
:
UploadFileParams
)
=>
defHttp
.
uploadFile
({
url
:
VITE_GLOB_UPLOAD_URL
},
params
);
src/components/Upload/src/UploadModal.vue
浏览文件 @
c2eb20d8
...
...
@@ -14,12 +14,7 @@
:cancelButtonProps=
"
{ disabled: isUploadingRef }"
>
<template
#
centerFooter
>
<a-button
@
click=
"handleStartUpload"
color=
"success"
:disabled=
"!getIsSelectFile"
:loading=
"isUploadingRef"
>
<a-button
@
click=
"handleStartUpload"
color=
"success"
:disabled=
"!getIsSelectFile"
:loading=
"isUploadingRef"
>
{{
getUploadBtnText
}}
</a-button>
</
template
>
...
...
@@ -57,10 +52,9 @@
// utils
import
{
checkImgType
,
getBase64WithFile
}
from
'./helper'
;
import
{
buildUUID
}
from
'/@/utils/uuid'
;
import
{
isFunction
}
from
'/@/utils/is'
;
import
{
warn
}
from
'/@/utils/log'
;
import
FileList
from
'./FileList.vue'
;
import
{
useI18n
}
from
'/@/hooks/web/useI18n'
;
import
{
upload
}
from
'/@/api/system/upload'
;
export
default
defineComponent
({
components
:
{
BasicModal
,
Upload
,
Alert
,
FileList
},
...
...
@@ -96,24 +90,19 @@
const
getIsSelectFile
=
computed
(()
=>
{
return
(
fileListRef
.
value
.
length
>
0
&&
!
fileListRef
.
value
.
every
((
item
)
=>
item
.
status
===
UploadResultStatus
.
SUCCESS
)
fileListRef
.
value
.
length
>
0
&&
!
fileListRef
.
value
.
every
((
item
)
=>
item
.
status
===
UploadResultStatus
.
SUCCESS
)
);
});
const
getOkButtonProps
=
computed
(()
=>
{
const
someSuccess
=
fileListRef
.
value
.
some
(
(
item
)
=>
item
.
status
===
UploadResultStatus
.
SUCCESS
,
);
const
someSuccess
=
fileListRef
.
value
.
some
((
item
)
=>
item
.
status
===
UploadResultStatus
.
SUCCESS
);
return
{
disabled
:
isUploadingRef
.
value
||
fileListRef
.
value
.
length
===
0
||
!
someSuccess
,
};
});
const
getUploadBtnText
=
computed
(()
=>
{
const
someError
=
fileListRef
.
value
.
some
(
(
item
)
=>
item
.
status
===
UploadResultStatus
.
ERROR
,
);
const
someError
=
fileListRef
.
value
.
some
((
item
)
=>
item
.
status
===
UploadResultStatus
.
ERROR
);
return
isUploadingRef
.
value
?
t
(
'component.upload.uploading'
)
:
someError
...
...
@@ -174,26 +163,21 @@
// }
async
function
uploadApiByItem
(
item
:
FileItem
)
{
const
{
api
}
=
props
;
if
(
!
api
||
!
isFunction
(
api
))
{
return
warn
(
'upload api must exist and be a function'
);
}
try
{
const
uploadApi
=
props
.
api
||
upload
;
item
.
status
=
UploadResultStatus
.
UPLOADING
;
const
{
data
}
=
await
props
.
api
?.(
{
const
{
data
}
=
await
uploadApi
({
data
:
{
...(
props
.
uploadParams
||
{}),
},
file
:
item
.
file
,
name
:
props
.
name
,
filename
:
props
.
filename
,
},
function
onUploadProgress
(
progressEvent
:
ProgressEvent
)
{
const
complete
=
((
progressEvent
.
loaded
/
progressEvent
.
total
)
*
100
)
|
0
;
item
.
percent
=
complete
;
},
);
});
if
(
!
data
||
data
.
code
!==
0
)
{
throw
new
Error
(
'上传失败'
+
data
?.
message
);
}
item
.
percent
=
100
;
item
.
status
=
UploadResultStatus
.
SUCCESS
;
item
.
responseData
=
data
;
return
{
...
...
@@ -219,8 +203,7 @@
try
{
isUploadingRef
.
value
=
true
;
// 只上传不是成功状态的
const
uploadFileList
=
fileListRef
.
value
.
filter
((
item
)
=>
item
.
status
!==
UploadResultStatus
.
SUCCESS
)
||
[];
const
uploadFileList
=
fileListRef
.
value
.
filter
((
item
)
=>
item
.
status
!==
UploadResultStatus
.
SUCCESS
)
||
[];
const
data
=
await
Promise
.
all
(
uploadFileList
.
map
((
item
)
=>
{
return
uploadApiByItem
(
item
);
...
...
@@ -251,7 +234,7 @@
for
(
const
item
of
fileListRef
.
value
)
{
const
{
status
,
responseData
}
=
item
;
if
(
status
===
UploadResultStatus
.
SUCCESS
&&
responseData
)
{
fileList
.
push
(
responseData
.
url
);
fileList
.
push
(
responseData
.
result
);
}
}
// 存在一个上传成功的即可保存
...
...
src/components/Upload/src/props.ts
浏览文件 @
c2eb20d8
...
...
@@ -32,7 +32,7 @@ export const basicProps = {
api
:
{
type
:
Function
as
PropType
<
PromiseFn
>
,
default
:
null
,
required
:
tru
e
,
required
:
fals
e
,
},
name
:
{
type
:
String
as
PropType
<
string
>
,
...
...
src/views/system/hospital/drawer.vue
浏览文件 @
c2eb20d8
...
...
@@ -39,15 +39,15 @@
try
{
const
values
=
await
validate
();
setDrawerProps
({
confirmLoading
:
true
});
const
{
...
rest
}
=
values
;
const
{
...
rest
}
=
values
;
rest
.
licensePic
=
rest
.
licensePic
?.
join
(
','
);
const
action
=
!
unref
(
isUpdate
)
?
HospitalApi
.
add
:
HospitalApi
.
update
;
const
data
=
!
unref
(
isUpdate
)
?
{
...
rest
,
}
:
Object
.
assign
({},
:
Object
.
assign
(
{},
{
...
rest
,
id
:
unref
(
entityId
),
...
...
src/views/system/hospital/index.vue
浏览文件 @
c2eb20d8
...
...
@@ -24,7 +24,8 @@
</a-alert>
</template>
<
template
#
toolbar
>
<a-button
v-auth=
"'AUTH_SYSTEM_HOSPITAL:ADD'"
type=
"primary"
@
click=
"handleCreate"
>
新增
</a-button>
<a-button
v-auth=
"'AUTH_SYSTEM_HOSPITAL:ADD'"
type=
"primary"
@
click=
"handleCreate"
>
新增医院
</a-button>
<a-button
v-auth=
"'AUTH_SYSTEM_HOSPITAL:IMPORT'"
type=
"primary"
@
click=
"handleImport"
>
批量导入医院
</a-button>
</
template
>
<
template
#
bodyCell=
"{ column, record, text }"
>
<template
v-if=
"column.dataIndex === 'id'"
>
...
...
@@ -136,6 +137,9 @@
return
handledParams
}
//todo 批量导入医院
const
handleImport
=
()
=>
{}
const
handleCreate
=
()
=>
{
openDrawer
(
true
,
{
isUpdate
:
false
,
...
...
src/views/system/hospital/schema.ts
浏览文件 @
c2eb20d8
...
...
@@ -6,25 +6,23 @@
* @Date: 2022-06-28 11:50:00
*/
import
{
BasicColumn
}
from
'/@/components/Table'
import
{
FormSchema
}
from
'/@/components/Table'
import
{
BasicColumn
}
from
'/@/components/Table'
;
import
{
FormSchema
}
from
'/@/components/Table'
;
export
enum
StatusEnum
{
PENDING_REVIEW
=
'待审核'
,
PASSED
=
'已通过'
,
REJECT
=
'拒绝'
,
FORBIDDEN
=
'禁用'
,
YES
=
'启用'
,
NO
=
'禁用'
,
}
export
const
StatusEnumOptions
:
any
[]
=
[]
export
const
StatusEnumOptions
:
any
[]
=
[]
;
for
(
const
key
in
StatusEnum
)
{
StatusEnumOptions
.
push
({
value
:
key
,
label
:
StatusEnum
[
key
],
})
})
;
}
const
colProps
=
{
xs
:
{
span
:
24
},
sm
:
{
span
:
24
},
lg
:
{
span
:
8
}
}
const
colPropsInDrawer
=
{
span
:
24
}
const
colProps
=
{
xs
:
{
span
:
24
},
sm
:
{
span
:
24
},
lg
:
{
span
:
8
}
}
;
const
colPropsInDrawer
=
{
span
:
24
}
;
export
const
schema
=
{
model
:
'Hospital'
,
...
...
@@ -86,7 +84,7 @@ export const schema = {
},
colProps
,
component
:
'Input'
,
rules
:
[{
required
:
tru
e
,
message
:
'请输入医院简称!'
}],
rules
:
[{
required
:
fals
e
,
message
:
'请输入医院简称!'
}],
},
table
:
{},
},
...
...
@@ -116,7 +114,7 @@ export const schema = {
},
colProps
,
component
:
'Input'
,
rules
:
[{
required
:
tru
e
,
message
:
'请输入税率!'
}],
rules
:
[{
required
:
fals
e
,
message
:
'请输入税率!'
}],
},
table
:
{},
},
...
...
@@ -137,16 +135,16 @@ export const schema = {
},
{
field
:
'mobile'
,
label
:
'
手机号
'
,
label
:
'
电话
'
,
defaultValue
:
undefined
,
form
:
{
componentProps
:
{
allowClear
:
false
,
placeholder
:
'
手机号
'
,
placeholder
:
'
电话
'
,
},
colProps
,
component
:
'Input'
,
rules
:
[{
required
:
true
,
message
:
'请输入手机号
!'
}],
rules
:
[{
required
:
false
,
message
:
'请输入电话
!'
}],
},
table
:
{},
},
...
...
@@ -166,7 +164,7 @@ export const schema = {
},
{
field
:
'level'
,
label
:
'等级'
,
label
:
'
医院
等级'
,
defaultValue
:
1
,
form
:
{
componentProps
:
{
...
...
@@ -175,59 +173,64 @@ export const schema = {
},
colProps
,
component
:
'InputNumber'
,
rules
:
[{
required
:
tru
e
,
message
:
'请输入等级!'
}],
rules
:
[{
required
:
fals
e
,
message
:
'请输入等级!'
}],
},
table
:
{},
},
{
field
:
'licenseNumber'
,
label
:
'
工商
营业执照代码'
,
label
:
'营业执照代码'
,
defaultValue
:
undefined
,
form
:
{
componentProps
:
{
allowClear
:
true
,
placeholder
:
'
工商
营业执照代码'
,
placeholder
:
'营业执照代码'
,
},
colProps
,
component
:
'Input'
,
rules
:
[{
required
:
true
,
message
:
'请输入代码!'
}],
},
table
:
{},
},
{
field
:
'licensePic'
,
label
:
'
工商
营业执照图片'
,
label
:
'营业执照图片'
,
defaultValue
:
undefined
,
form
:
{
componentProps
:
{
allowClear
:
true
,
placeholder
:
'工商营业执照图片'
,
placeholder
:
'营业执照图片'
,
maxNumber
:
1
,
multiple
:
false
,
},
colProps
,
component
:
'Upload'
,
rules
:
[{
required
:
true
,
message
:
'请上传'
}],
},
table
:
{},
},
{
field
:
'licenseExpireTime'
,
label
:
'有效期'
,
label
:
'
执照
有效期'
,
defaultValue
:
undefined
,
form
:
{
colProps
,
component
:
'DatePicker'
,
componentProps
:
{
allowClear
:
false
,
placeholder
:
'有效期'
,
format
:
'YYYY-MM-DD HH:mm:ss'
,
showTime
:
true
,
placeholder
:
'执照有效期'
,
format
:
'YYYY-MM-DD'
,
valueFormat
:
'YYYY-MM-DD HH:mm:ss'
,
showTime
:
false
,
},
rules
:
[{
required
:
true
,
message
:
'请输入有效期!'
}],
rules
:
[{
required
:
true
,
message
:
'请输入
执照
有效期!'
}],
},
table
:
{},
},
{
field
:
'status'
,
label
:
'状态'
,
defaultValue
:
'
PENDING_REVIEW
'
,
defaultValue
:
'
YES
'
,
form
:
{
componentProps
:
{
allowClear
:
false
,
...
...
@@ -240,8 +243,8 @@ export const schema = {
},
table
:
{
customRender
:
({
text
})
=>
{
const
option
=
StatusEnumOptions
.
find
((
item
)
=>
item
.
value
===
text
)
return
option
?
option
.
label
:
text
const
option
=
StatusEnumOptions
.
find
((
item
)
=>
item
.
value
===
text
)
;
return
option
?
option
.
label
:
text
;
},
},
},
...
...
@@ -310,7 +313,7 @@ export const schema = {
table
:
{},
},
],
}
}
;
const
queryFields
=
[
'distributorId'
,
...
...
@@ -329,9 +332,8 @@ const queryFields = [
'editorName'
,
'createTime'
,
'updateTime'
,
]
]
;
const
editFields
=
[
'distributorId'
,
'name'
,
'abbreviationName'
,
'code'
,
...
...
@@ -344,7 +346,7 @@ const editFields = [
'licensePic'
,
'licenseExpireTime'
,
'status'
,
]
]
;
const
tableFields
=
[
'distributorId'
,
'name'
,
...
...
@@ -363,7 +365,7 @@ const tableFields = [
'editorName'
,
'createTime'
,
'updateTime'
,
]
]
;
const
descriptionFields
=
[
'id'
,
'distributorId'
,
...
...
@@ -383,7 +385,7 @@ const descriptionFields = [
'editorName'
,
'createTime'
,
'updateTime'
,
]
]
;
export
const
searchFormSchema
:
FormSchema
[]
=
schema
.
properties
.
filter
((
item
)
=>
queryFields
.
includes
(
item
.
field
))
...
...
@@ -396,7 +398,7 @@ export const searchFormSchema: FormSchema[] = schema.properties
rules
:
rules
.
filter
((
r
)
=>
!
r
.
required
),
...
formProps
,
}
as
FormSchema
),
)
)
;
export
const
formSchema
:
FormSchema
[]
=
schema
.
properties
.
filter
((
item
)
=>
editFields
.
includes
(
item
.
field
))
...
...
@@ -409,7 +411,7 @@ export const formSchema: FormSchema[] = schema.properties
...
form
,
colProps
:
colPropsInDrawer
,
}
as
FormSchema
),
)
)
;
export
const
columns
:
BasicColumn
[]
=
schema
.
properties
.
filter
((
item
)
=>
tableFields
.
includes
(
item
.
field
))
...
...
@@ -420,7 +422,7 @@ export const columns: BasicColumn[] = schema.properties
title
:
label
,
...
table
,
}
as
BasicColumn
),
)
)
;
export
const
descriptionColumns
:
BasicColumn
[]
=
schema
.
properties
.
filter
((
item
)
=>
descriptionFields
.
includes
(
item
.
field
))
...
...
@@ -431,4 +433,4 @@ export const descriptionColumns: BasicColumn[] = schema.properties
title
:
label
,
...
table
,
}
as
BasicColumn
),
)
)
;
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论