Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
A
admin
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
华润手术跟台
admin
Commits
e5e9ca39
提交
e5e9ca39
authored
11月 02, 2022
作者:
leon
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
add 临时收货人
上级
71e907c9
隐藏空白字符变更
内嵌
并排
正在显示
6 个修改的文件
包含
923 行增加
和
0 行删除
+923
-0
receiverTmp.ts
src/api/model/receiverTmp.ts
+168
-0
receiverTmpApi.ts
src/api/system/receiverTmpApi.ts
+70
-0
detail.vue
src/views/system/receiver-tmp/detail.vue
+64
-0
drawer.vue
src/views/system/receiver-tmp/drawer.vue
+101
-0
index.vue
src/views/system/receiver-tmp/index.vue
+186
-0
schema.ts
src/views/system/receiver-tmp/schema.ts
+334
-0
没有找到文件。
src/api/model/receiverTmp.ts
0 → 100644
浏览文件 @
e5e9ca39
/**
* 项目:-
* @Author: xiongwei
* @Date: 2022-06-28 11:50:00
*/
import
{
BasePageParams
,
PageResult
,
ApiResponse
}
from
'./baseModel'
;
import
{
Distributor
}
from
'./distributor'
;
export
interface
ReceiverTmpParams
extends
BasePageParams
{
/**
* ID
*/
id
?:
number
;
/**
* ID IN值List
*/
idList
?:
Array
<
number
>
;
/**
* 经销商
*/
distributorId
?:
number
;
/**
* 物流方式
*/
logisticsMode
?:
string
;
/**
* 接收人姓名
*/
receiveName
?:
string
;
/**
* 接收人电话
*/
receivePhone
?:
string
;
/**
* 收货地址
*/
address
?:
string
;
/**
* 是否默认
*/
isDefault
?:
String
;
/**
* 是否默认 IN值List
*/
isDefaultList
?:
Array
<
string
>
;
/**
* 状态
*/
status
?:
String
;
/**
* 状态 IN值List
*/
statusList
?:
Array
<
string
>
;
/**
* 附件
*/
attachment
?:
string
;
/**
* 备注
*/
remark
?:
string
;
/**
* 操作人Id
*/
editorId
?:
number
;
/**
* 操作人
*/
editorName
?:
string
;
/**
* 创建时间
*/
createTime
?:
Date
;
/**
* 创建时间 下限值(大于等于)
*/
createTimeFrom
?:
Date
;
/**
* 创建时间 上限值(小于)
*/
createTimeTo
?:
Date
;
/**
* 修改时间
*/
updateTime
?:
Date
;
/**
* 修改时间 下限值(大于等于)
*/
updateTimeFrom
?:
Date
;
/**
* 修改时间 上限值(小于)
*/
updateTimeTo
?:
Date
;
/**
* 其他参数
*/
[
key
:
string
]:
any
;
}
export
interface
ReceiverTmp
{
/**
* ID
*/
id
?:
number
;
/**
* 经销商
*/
distributorId
?:
number
;
/**
* 经销商
*/
distributor
?:
Distributor
;
/**
* 物流方式
*/
logisticsMode
?:
string
;
/**
* 接收人姓名
*/
receiveName
?:
string
;
/**
* 接收人电话
*/
receivePhone
?:
string
;
/**
* 收货地址
*/
address
?:
string
;
/**
* 是否默认
*/
isDefault
?:
String
;
/**
* 状态
*/
status
?:
String
;
/**
* 附件
*/
attachment
?:
string
;
/**
* 备注
*/
remark
?:
string
;
/**
* 操作人Id
*/
editorId
?:
number
;
/**
* 操作人
*/
editorName
?:
string
;
/**
* 创建时间
*/
createTime
?:
Date
;
/**
* 修改时间
*/
updateTime
?:
Date
;
}
export
type
ReceiverTmpPageResult
=
PageResult
<
ReceiverTmp
>
;
export
type
ReceiverTmpPageResponse
=
ApiResponse
<
ReceiverTmpPageResult
>
;
export
type
ReceiverTmpResponse
=
ApiResponse
<
ReceiverTmp
>
;
src/api/system/receiverTmpApi.ts
0 → 100644
浏览文件 @
e5e9ca39
/**
* 项目:-
* @Author: xiongwei
* @Date: 2022-06-28 11:50:00
*/
import
{
defHttp
}
from
'/@/utils/http/axios'
;
import
{
ReceiverTmp
,
ReceiverTmpParams
,
ReceiverTmpPageResult
,
}
from
'../model/receiverTmp'
;
const
baseApi
=
'/v1/system/receiver-tmp'
;
/**
* 新增
*/
export
const
add
=
(
entity
:
ReceiverTmp
)
=>
defHttp
.
post
<
ReceiverTmp
>
({
url
:
`
${
baseApi
}
/`
,
data
:
entity
});
/**
* 更新
*/
export
const
update
=
(
entity
:
ReceiverTmp
)
=>
defHttp
.
put
<
ReceiverTmp
>
({
url
:
`
${
baseApi
}
/`
,
data
:
entity
});
/**
* 删除
*/
export
const
remove
=
(
id
:
any
)
=>
defHttp
.
delete
<
Number
>
({
url
:
`
${
baseApi
}
/
${
id
}
`
});
/**
* 分页查询
*/
export
const
search
=
(
params
?:
ReceiverTmpParams
)
=>
defHttp
.
get
<
ReceiverTmpPageResult
>
({
url
:
`
${
baseApi
}
/search`
,
params
});
/**
* 列表查询
*/
export
const
all
=
(
params
?:
ReceiverTmpParams
)
=>
defHttp
.
get
<
ReceiverTmpPageResult
>
({
url
:
`
${
baseApi
}
/all`
,
params
});
/**
* 通过主键查询
*/
export
const
getById
=
(
id
:
any
)
=>
defHttp
.
get
<
ReceiverTmp
>
({
url
:
`
${
baseApi
}
/
${
id
}
`
});
/**
* 单个查询
*/
export
const
getOne
=
(
params
?:
ReceiverTmpParams
)
=>
defHttp
.
get
<
ReceiverTmp
>
({
url
:
`
${
baseApi
}
/one`
,
params
});
/**
* 批量删除
*/
export
const
batchRemove
=
(
idList
:
Array
<
any
>
)
=>
defHttp
.
post
<
boolean
>
({
url
:
`
${
baseApi
}
/batch-delete`
,
data
:
idList
});
/**
* 批量新增
*/
export
const
batchAdd
=
(
entityList
:
Array
<
ReceiverTmp
>
)
=>
defHttp
.
post
<
boolean
>
({
url
:
`
${
baseApi
}
/batch-save`
,
data
:
entityList
});
/**
* 批量更新
*/
export
const
batchUpdate
=
(
entityList
:
Array
<
ReceiverTmp
>
)
=>
defHttp
.
post
<
boolean
>
({
url
:
`
${
baseApi
}
/batch-update`
,
data
:
entityList
});
/**
* 查询数量
*/
export
const
count
=
(
params
?:
ReceiverTmpParams
)
=>
defHttp
.
get
<
Number
>
({
url
:
`
${
baseApi
}
/count`
,
params
});
src/views/system/receiver-tmp/detail.vue
0 → 100644
浏览文件 @
e5e9ca39
<
template
>
<Card
:bordered=
"false"
:loading=
"isLoading"
>
<Descriptions
bordered
:column=
"3"
>
<Descriptions
.
Item
v-for=
"p in displayProps"
:key=
"p.title"
:label=
"p.title"
:span=
"['avatar'].includes(p.name) ? 3 : 1"
>
<span
v-if=
"p.key === 'avatar'"
>
<img
:src=
"p.value"
style=
"width: 120px; height: 120px"
/>
</span>
<template
v-else
>
{{
p
.
value
}}
</
template
>
</Descriptions
.Item
>
</Descriptions>
</Card>
</template>
<
script
lang=
"ts"
setup
name=
"DeviceDetail"
>
import
{
onMounted
,
computed
,
ref
}
from
'vue'
;
import
{
useRoute
}
from
'vue-router'
;
import
{
useAsyncState
}
from
'@vueuse/core'
;
import
{
ComputedRef
}
from
'@vue/reactivity'
;
import
{
Descriptions
,
Card
}
from
'ant-design-vue'
;
import
{
descriptionColumns
}
from
'./schema'
;
import
*
as
ReceiverTmpApi
from
'/@/api/system/receiverTmpApi'
;
import
{
ReceiverTmp
}
from
'/@/api/model/receiverTmp'
;
const
route
=
useRoute
();
const
id
=
ref
(
route
.
params
?.
id
);
// id 查询
const
{
state
:
detail
,
isReady
:
isDetailReady
,
isLoading
,
execute
,
}
=
useAsyncState
(
()
=>
{
return
ReceiverTmpApi
.
getById
(
id
.
value
).
then
((
res
:
ReceiverTmp
)
=>
res
);
},
null
,
{
immediate
:
false
,
},
);
onMounted
(()
=>
{
execute
();
});
const
displayProps
:
ComputedRef
<
Array
<
any
>>
=
computed
(()
=>
{
if
(
!
isDetailReady
.
value
)
return
{};
const
display
:
any
=
descriptionColumns
.
map
(({
title
,
dataIndex
=
''
,
customRender
})
=>
({
key
:
dataIndex
,
title
,
value
:
customRender
?
customRender
({
text
:
detail
.
value
[
dataIndex
],
record
:
detail
.
value
})
:
detail
.
value
[
dataIndex
],
}));
return
display
;
});
</
script
>
<
style
scoped
></
style
>
src/views/system/receiver-tmp/drawer.vue
0 → 100644
浏览文件 @
e5e9ca39
<
template
>
<BasicDrawer
v-bind=
"$attrs"
@
register=
"registerDrawer"
showFooter
:confirmDisabled=
"getConfirmDisabled"
:title=
"getTitle"
width=
"600px"
@
ok=
"handleSubmit"
>
<a-spin
:spinning=
"isLoading"
>
<BasicForm
@
register=
"registerForm"
/>
</a-spin>
</BasicDrawer>
</
template
>
<
script
lang=
"ts"
setup
name=
"ReceiverTmpDrawer"
>
import
{
defineEmits
,
ref
,
computed
,
unref
}
from
'vue'
;
import
{
BasicForm
,
useForm
}
from
'/@/components/Form/index'
;
import
{
formSchema
}
from
'./schema'
;
import
{
BasicDrawer
,
useDrawerInner
}
from
'/@/components/Drawer'
;
import
{
useAsyncState
}
from
'@vueuse/core'
;
import
*
as
ReceiverTmpApi
from
'/@/api/system/receiverTmpApi'
;
import
{
ReceiverTmp
}
from
'/@/api/model/receiverTmp'
;
const
emit
=
defineEmits
([
'success'
,
'register'
]);
const
isUpdate
=
ref
(
true
);
const
entityId
=
ref
(
0
);
const
[
registerForm
,
{
resetFields
,
setFieldsValue
,
validate
}]
=
useForm
({
labelWidth
:
120
,
schemas
:
formSchema
,
showActionButtonGroup
:
false
,
});
// id 查询
const
{
state
:
detail
,
isReady
:
isDetailReady
,
isLoading
,
execute
,
}
=
useAsyncState
(
()
=>
{
return
ReceiverTmpApi
.
getById
(
entityId
.
value
).
then
((
res
:
ReceiverTmp
)
=>
res
);
},
null
,
{
immediate
:
false
,
},
);
const
[
registerDrawer
,
{
setDrawerProps
,
closeDrawer
}]
=
useDrawerInner
(
async
(
data
)
=>
{
await
resetFields
();
setDrawerProps
({
confirmLoading
:
false
});
isUpdate
.
value
=
!!
data
?.
isUpdate
;
entityId
.
value
=
data
?.
record
?.
id
;
if
(
unref
(
isUpdate
))
{
await
execute
();
if
(
detail
.
value
)
{
const
formData
:
any
=
{
...
detail
.
value
,
distributorId
:
{
label
:
detail
.
value
.
distributor
?.
name
||
'(已删除/不存在)'
,
value
:
detail
.
value
.
distributorId
},
};
await
setFieldsValue
(
formData
);
}
}
});
const
getConfirmDisabled
=
computed
(()
=>
{
if
(
unref
(
isUpdate
))
{
return
!
unref
(
isDetailReady
);
}
else
{
return
false
;
}
});
const
getTitle
=
computed
(()
=>
(
!
unref
(
isUpdate
)
?
'新增'
:
'编辑'
));
async
function
handleSubmit
()
{
try
{
const
values
=
await
validate
();
setDrawerProps
({
confirmLoading
:
true
});
const
{
distributorId
,
...
rest
}
=
values
;
const
action
=
!
unref
(
isUpdate
)
?
ReceiverTmpApi
.
add
:
ReceiverTmpApi
.
update
;
const
data
=
!
unref
(
isUpdate
)
?
{
...
rest
,
distributorId
:
distributorId
.
value
,
distributorName
:
distributorId
.
label
,
}
:
Object
.
assign
({},
{
...
rest
,
id
:
unref
(
entityId
),
distributorId
:
distributorId
.
value
,
distributorName
:
distributorId
.
label
,
},
);
await
action
(
data
);
closeDrawer
();
emit
(
'success'
);
}
finally
{
setDrawerProps
({
confirmLoading
:
false
});
}
}
</
script
>
src/views/system/receiver-tmp/index.vue
0 → 100644
浏览文件 @
e5e9ca39
<
template
>
<div>
<BasicTable
@
register=
"registerTable"
>
<template
#
headerTop
>
<a-alert
type=
"info"
show-icon
>
<template
#
message
>
<template
v-if=
"checkedKeys.length > 0"
>
<span>
已选中
{{
checkedKeys
.
length
}}
条记录
</span>
<a-button
type=
"link"
@
click=
"checkedKeys = []"
size=
"small"
>
清空
</a-button>
<a-popconfirm
v-auth=
"'AUTH_SYSTEM_RECEIVER_TMP'"
class=
"ml-4"
title=
"确定要全部删除吗?"
ok-text=
"是"
cancel-text=
"否"
@
confirm=
"handleBatchDelete"
>
<a
href=
"#"
class=
"text-red-500"
>
删除
</a>
</a-popconfirm>
</
template
>
<
template
v-else
>
<span>
未选中任何项目
</span>
</
template
>
</template>
</a-alert>
</template>
<
template
#
toolbar
>
<a-button
v-auth=
"'AUTH_SYSTEM_RECEIVER_TMP:ADD'"
type=
"primary"
@
click=
"handleCreate"
>
新增
</a-button>
</
template
>
<
template
#
bodyCell=
"{ column, record, text }"
>
<template
v-if=
"[].includes(column.dataIndex)"
>
<img
:src=
"text"
class=
"photo"
alt=
"图片"
v-if=
"!!text"
/>
</
template
>
<
template
v-if=
"column.dataIndex === 'action'"
>
<TableAction
:actions=
"[
{
tooltip: '编辑',
icon: 'clarity:note-edit-line',
onClick: handleEdit.bind(null, record),
ifShow: hasPermission('AUTH_SYSTEM_RECEIVER_TMP:EDIT'),
},
{
tooltip: '详情',
icon: 'ant-design:eye-outlined',
onClick: handleView.bind(null, record),
ifShow: hasPermission('AUTH_SYSTEM_RECEIVER_TMP:QUERY'),
},
{
tooltip: '删除',
icon: 'ant-design:delete-outlined',
color: 'error',
popConfirm: {
title: '是否确认删除',
confirm: handleDelete.bind(null, record),
},
ifShow: hasPermission('AUTH_SYSTEM_RECEIVER_TMP:DELETE'),
},
]"
/>
</
template
>
</template>
</BasicTable>
<ReceiverTmpDrawer
@
register=
"registerDrawer"
@
success=
"handleSuccess"
/>
</div>
</template>
<
script
lang=
"ts"
setup
name=
"AUTH_SYSTEM_RECEIVER_TMP"
>
import
{
ref
}
from
'vue'
;
import
{
useGo
}
from
'/@/hooks/web/usePage'
;
import
{
usePermission
}
from
'/@/hooks/web/usePermission'
;
import
{
BasicTable
,
useTable
,
TableAction
}
from
'/@/components/Table'
;
import
{
isObject
}
from
'/@/utils/is'
;
import
moment
from
'moment'
;
import
*
as
ReceiverTmpApi
from
'/@/api/system/receiverTmpApi'
;
import
{
useDrawer
}
from
'/@/components/Drawer'
;
import
componentSetting
from
'/@/settings/componentSetting'
;
import
ReceiverTmpDrawer
from
'./drawer.vue'
;
import
{
columns
,
searchFormSchema
}
from
'./schema'
;
const
{
hasPermission
}
=
usePermission
();
const
go
=
useGo
();
const
{
formConfig
,
showTableSetting
,
bordered
,
showIndexColumn
,
}
=
componentSetting
.
table
;
const
checkedKeys
=
ref
<
Array
<
string
|
number
>>
([]);
const
onSelectChange
=
(
selectedRowKeys
:
(
string
|
number
)[])
=>
{
checkedKeys
.
value
=
selectedRowKeys
;
}
const
[
registerDrawer
,
{
openDrawer
}]
=
useDrawer
();
const
[
registerTable
,
{
reload
,
setLoading
}]
=
useTable
({
title
:
'临时收货人管理'
,
api
:
(
params
)
=>
ReceiverTmpApi
.
search
(
handleParams
(
params
)),
columns
,
formConfig
:
{
labelWidth
:
formConfig
.
labelWidth
,
schemas
:
searchFormSchema
,
showAdvancedButton
:
false
,
},
rowSelection
:
{
type
:
'checkbox'
,
// @ts-ignore
selectedRowKeys
:
checkedKeys
,
onChange
:
onSelectChange
,
},
useSearchForm
:
true
,
showTableSetting
,
bordered
,
showIndexColumn
,
canResize
:
false
,
rowKey
:
(
record
:
any
)
=>
record
.
id
,
actionColumn
:
{
width
:
120
,
title
:
'操作'
,
dataIndex
:
'action'
,
fixed
:
'right'
,
},
});
const
handleParams
=
(
params
)
=>
{
const
{
pageNum
,
pageSize
}
=
params
;
const
handledParams
:
any
=
{
pageNum
,
pageSize
};
Object
.
keys
(
params
).
forEach
((
key
)
=>
{
const
schema
=
searchFormSchema
.
find
((
item
)
=>
item
.
field
===
key
);
const
value
=
params
[
key
];
if
(
schema
&&
value
!==
undefined
&&
value
!==
''
)
{
if
(
schema
.
component
===
'Input'
)
{
handledParams
[
key
]
=
`%
${
value
.
trim
()}
%`
;
}
else
if
([
'Select'
,
'ApiSelect'
].
includes
(
schema
.
component
))
{
handledParams
[
key
]
=
isObject
(
value
)
?
value
.
value
:
value
;
}
else
if
(
schema
.
component
===
'RangePicker'
)
{
handledParams
[
`
${
key
}
From`
]
=
moment
(
value
[
0
]).
startOf
(
'd'
).
format
(
'YYYY-MM-DD HH:mm:ss'
);
handledParams
[
`
${
key
}
To`
]
=
moment
(
value
[
1
]).
endOf
(
'd'
).
format
(
'YYYY-MM-DD HH:mm:ss'
);
}
else
if
(
schema
.
component
===
'DatePicker'
)
{
handledParams
[
key
]
=
moment
(
value
).
format
((
schema
.
componentProps
as
any
).
format
||
'YYYY-MM-DD'
);
}
else
{
handledParams
[
key
]
=
value
;
}
}
});
return
handledParams
;
};
const
handleCreate
=
()
=>
{
openDrawer
(
true
,
{
isUpdate
:
false
,
});
};
const
handleEdit
=
(
record
:
Recordable
)
=>
{
openDrawer
(
true
,
{
record
,
isUpdate
:
true
,
});
};
const
handleDelete
=
(
record
:
Recordable
)
=>
{
setLoading
(
true
);
ReceiverTmpApi
.
remove
(
record
.
id
).
then
((
_
)
=>
{
reload
();
}).
catch
(()
=>
{
setLoading
(
false
);
});
};
const
handleBatchDelete
=
()
=>
{
setLoading
(
true
);
ReceiverTmpApi
.
batchRemove
(
checkedKeys
.
value
).
then
((
_
)
=>
{
reload
();
}).
catch
(()
=>
{
setLoading
(
false
);
});
};
const
handleSuccess
=
()
=>
{
reload
();
};
const
handleView
=
(
record
)
=>
{
go
(
'/main/system/receiver-tmp/'
+
record
.
id
);
};
</
script
>
src/views/system/receiver-tmp/schema.ts
0 → 100644
浏览文件 @
e5e9ca39
/**
* 项目:-
* 模型分组:系统管理
* 模型名称:临时收货人管理
* @Author: xiongwei
* @Date: 2022-06-28 11:50:00
*/
import
{
BasicColumn
}
from
'/@/components/Table'
;
import
{
FormSchema
}
from
'/@/components/Table'
;
import
get
from
'lodash.get'
;
import
*
as
DistributorApi
from
'/@/api/system/distributorApi'
;
export
enum
YesNoEnum
{
YES
=
'是'
,
NO
=
'否'
,
}
export
const
YesNoEnumOptions
:
any
[]
=
[];
for
(
const
key
in
YesNoEnum
)
{
YesNoEnumOptions
.
push
({
value
:
key
,
label
:
YesNoEnum
[
key
],
});
}
export
enum
StatusEnum
{
PENDING_REVIEW
=
'待审核'
,
PASSED
=
'已通过'
,
REJECT
=
'拒绝'
,
FORBIDDEN
=
'禁用'
,
}
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
};
export
const
schema
=
{
model
:
'ReceiverTmp'
,
viewInPage
:
true
,
properties
:
[
{
field
:
'id'
,
label
:
'ID'
,
defaultValue
:
undefined
,
form
:
{
componentProps
:
{
allowClear
:
false
,
placeholder
:
'ID'
,
},
colProps
,
component
:
'InputNumber'
,
rules
:
[{
required
:
true
,
message
:
'请输入ID!'
}],
},
table
:
{
},
},
{
field
:
'distributorId'
,
label
:
'经销商'
,
defaultValue
:
undefined
,
form
:
{
componentProps
:
{
labelInValue
:
true
,
api
:
DistributorApi
.
all
,
params
:
{},
resultField
:
'records'
,
labelField
:
'id'
,
valueField
:
'id'
,
allowClear
:
false
,
placeholder
:
'经销商'
,
},
colProps
,
component
:
'ApiSelect'
,
rules
:
[{
required
:
true
,
type
:
'object'
,
message
:
'请输入经销商!'
}],
},
table
:
{
customRender
:
({
text
,
record
})
=>
get
(
record
,
'distributor.name'
)
||
text
,
},
},
{
field
:
'logisticsMode'
,
label
:
'物流方式'
,
defaultValue
:
undefined
,
form
:
{
componentProps
:
{
allowClear
:
true
,
placeholder
:
'物流方式'
,
},
colProps
,
component
:
'Input'
,
},
table
:
{
},
},
{
field
:
'receiveName'
,
label
:
'接收人姓名'
,
defaultValue
:
undefined
,
form
:
{
componentProps
:
{
allowClear
:
true
,
placeholder
:
'接收人姓名'
,
},
colProps
,
component
:
'Input'
,
},
table
:
{
},
},
{
field
:
'receivePhone'
,
label
:
'接收人电话'
,
defaultValue
:
undefined
,
form
:
{
componentProps
:
{
allowClear
:
true
,
placeholder
:
'接收人电话'
,
},
colProps
,
component
:
'Input'
,
},
table
:
{
},
},
{
field
:
'address'
,
label
:
'收货地址'
,
defaultValue
:
undefined
,
form
:
{
componentProps
:
{
allowClear
:
true
,
placeholder
:
'收货地址'
,
},
component
:
'InputTextArea'
,
colProps
:
{
span
:
24
},
},
table
:
{
},
},
{
field
:
'isDefault'
,
label
:
'是否默认'
,
defaultValue
:
'NO'
,
form
:
{
componentProps
:
{
allowClear
:
true
,
placeholder
:
'是否默认'
,
options
:
YesNoEnumOptions
,
},
colProps
,
component
:
'Select'
,
},
table
:
{
customRender
:
({
text
})
=>
{
const
option
=
YesNoEnumOptions
.
find
((
item
)
=>
item
.
value
===
text
)
return
option
?
option
.
label
:
text
;
},
},
},
{
field
:
'status'
,
label
:
'状态'
,
defaultValue
:
'PENDING_REVIEW'
,
form
:
{
componentProps
:
{
allowClear
:
false
,
placeholder
:
'状态'
,
options
:
StatusEnumOptions
,
},
colProps
,
component
:
'Select'
,
rules
:
[{
required
:
true
,
message
:
'请输入状态!'
}],
},
table
:
{
customRender
:
({
text
})
=>
{
const
option
=
StatusEnumOptions
.
find
((
item
)
=>
item
.
value
===
text
)
return
option
?
option
.
label
:
text
;
},
},
},
{
field
:
'attachment'
,
label
:
'附件'
,
defaultValue
:
undefined
,
form
:
{
componentProps
:
{
allowClear
:
true
,
placeholder
:
'附件'
,
},
colProps
,
component
:
'Upload'
,
},
table
:
{
},
},
{
field
:
'remark'
,
label
:
'备注'
,
defaultValue
:
undefined
,
form
:
{
componentProps
:
{
allowClear
:
true
,
placeholder
:
'备注'
,
},
colProps
,
component
:
'Input'
,
},
table
:
{
},
},
{
field
:
'editorId'
,
label
:
'操作人Id'
,
defaultValue
:
1
,
form
:
{
componentProps
:
{
allowClear
:
false
,
placeholder
:
'操作人Id'
,
},
colProps
,
component
:
'InputNumber'
,
rules
:
[{
required
:
true
,
message
:
'请输入操作人Id!'
}],
},
table
:
{
},
},
{
field
:
'editorName'
,
label
:
'操作人'
,
defaultValue
:
'admin'
,
form
:
{
componentProps
:
{
allowClear
:
false
,
placeholder
:
'操作人'
,
},
colProps
,
component
:
'Input'
,
rules
:
[{
required
:
true
,
message
:
'请输入操作人!'
}],
},
table
:
{
},
},
{
field
:
'createTime'
,
label
:
'创建时间'
,
defaultValue
:
undefined
,
form
:
{
colProps
,
componentProps
:
{
allowClear
:
false
,
placeholder
:
[
'开始时间'
,
'结束时间'
],
format
:
'YYYY-MM-DD'
,
showTime
:
false
,
},
component
:
'RangePicker'
,
rules
:
[{
required
:
true
,
message
:
'请输入创建时间!'
}],
},
table
:
{
},
},
{
field
:
'updateTime'
,
label
:
'修改时间'
,
defaultValue
:
undefined
,
form
:
{
colProps
,
componentProps
:
{
allowClear
:
false
,
placeholder
:
[
'开始时间'
,
'结束时间'
],
format
:
'YYYY-MM-DD'
,
showTime
:
false
,
},
component
:
'RangePicker'
,
rules
:
[{
required
:
true
,
message
:
'请输入修改时间!'
}],
},
table
:
{
},
},
],
};
const
queryFields
=
[
'id'
,
'distributorId'
,
'logisticsMode'
,
'receiveName'
,
'receivePhone'
,
'isDefault'
,
'status'
,
'attachment'
,
'remark'
,
'editorId'
,
'editorName'
,
'createTime'
,
'updateTime'
];
const
editFields
=
[
'distributorId'
,
'logisticsMode'
,
'receiveName'
,
'receivePhone'
,
'address'
,
'isDefault'
,
'status'
,
'attachment'
,
'remark'
];
const
tableFields
=
[
'id'
,
'distributorId'
,
'logisticsMode'
,
'receiveName'
,
'receivePhone'
,
'address'
,
'isDefault'
,
'status'
,
'attachment'
,
'remark'
,
'editorId'
,
'editorName'
,
'createTime'
,
'updateTime'
];
const
descriptionFields
=
[
'id'
,
'distributorId'
,
'logisticsMode'
,
'receiveName'
,
'receivePhone'
,
'address'
,
'isDefault'
,
'status'
,
'attachment'
,
'remark'
,
'editorId'
,
'editorName'
,
'createTime'
,
'updateTime'
];
export
const
searchFormSchema
:
FormSchema
[]
=
schema
.
properties
.
filter
(
item
=>
queryFields
.
includes
(
item
.
field
))
.
map
(
({
field
,
label
,
form
:
{
rules
=
[],
...
formProps
}
})
=>
({
field
,
label
,
defaultValue
:
undefined
,
rules
:
rules
.
filter
((
r
)
=>
!
r
.
required
),
...
formProps
,
}
as
FormSchema
),
);
export
const
formSchema
:
FormSchema
[]
=
schema
.
properties
.
filter
(
item
=>
editFields
.
includes
(
item
.
field
))
.
map
(
({
field
,
label
,
defaultValue
,
form
})
=>
({
field
,
label
,
defaultValue
,
...
form
,
colProps
:
colPropsInDrawer
,
}
as
FormSchema
),
);
export
const
columns
:
BasicColumn
[]
=
schema
.
properties
.
filter
(
item
=>
tableFields
.
includes
(
item
.
field
))
.
map
(
({
field
,
label
,
table
})
=>
({
dataIndex
:
field
,
title
:
label
,
...
table
,
}
as
BasicColumn
)
);
export
const
descriptionColumns
:
BasicColumn
[]
=
schema
.
properties
.
filter
(
item
=>
descriptionFields
.
includes
(
item
.
field
))
.
map
(
({
field
,
label
,
table
})
=>
({
dataIndex
:
field
,
title
:
label
,
...
table
,
}
as
BasicColumn
),
);
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论