Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
A
admin
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
华润手术跟台
admin
Commits
d1075d6d
提交
d1075d6d
authored
11月 03, 2022
作者:
leon
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
add 经销商管理
上级
56b0ddc9
显示空白字符变更
内嵌
并排
正在显示
5 个修改的文件
包含
101 行增加
和
63 行删除
+101
-63
distributorApi.ts
src/api/system/distributorApi.ts
+11
-26
detail.vue
src/views/system/distributor/detail.vue
+27
-19
drawer.vue
src/views/system/distributor/drawer.vue
+35
-3
index.vue
src/views/system/distributor/index.vue
+25
-10
schema.ts
src/views/system/distributor/schema.ts
+3
-5
没有找到文件。
src/api/system/distributorApi.ts
浏览文件 @
d1075d6d
...
@@ -5,81 +5,66 @@
...
@@ -5,81 +5,66 @@
*/
*/
import
{
defHttp
}
from
'/@/utils/http/axios'
;
import
{
defHttp
}
from
'/@/utils/http/axios'
;
import
{
ApiResponse
}
from
'../model/baseModel'
;
import
{
import
{
Distributor
,
Distributor
,
DistributorParams
,
DistributorParams
,
DistributorPageResult
,
DistributorPageResult
,
DistributorPageResponse
,
DistributorResponse
,
}
from
'../model/distributor'
;
}
from
'../model/distributor'
;
const
baseApi
=
'/v1/system/distributor'
;
const
baseApi
=
'/v1/system/distributor'
;
/**
/**
* 新增
* 新增
*/
*/
export
const
add
=
(
entity
:
Distributor
)
=>
export
const
add
=
(
entity
:
Distributor
)
=>
defHttp
.
post
<
Distributor
>
({
url
:
`
${
baseApi
}
/`
,
data
:
entity
});
defHttp
.
post
<
Distributor
>
({
url
:
`
${
baseApi
}
/`
,
data
:
entity
});
/**
/**
* 更新
* 更新
*/
*/
export
const
update
=
(
entity
:
Distributor
)
=>
export
const
update
=
(
entity
:
Distributor
)
=>
defHttp
.
put
<
Distributor
>
({
url
:
`
${
baseApi
}
/`
,
data
:
entity
});
defHttp
.
put
<
Distributor
>
({
url
:
`
${
baseApi
}
/`
,
data
:
entity
});
/**
/**
* 删除
* 删除
*/
*/
export
const
remove
=
(
id
:
any
)
=>
export
const
remove
=
(
id
:
any
)
=>
defHttp
.
delete
<
Number
>
({
url
:
`
${
baseApi
}
/
${
id
}
`
});
defHttp
.
delete
<
Number
>
({
url
:
`
${
baseApi
}
/
${
id
}
`
});
/**
/**
* 分页查询
* 分页查询
*/
*/
export
const
search
=
(
params
?:
DistributorParams
)
=>
export
const
search
=
(
params
?:
DistributorParams
)
=>
defHttp
.
get
<
DistributorPageResult
>
({
url
:
`
${
baseApi
}
/search`
,
params
});
defHttp
.
get
<
DistributorPageResult
>
({
url
:
`
${
baseApi
}
/search`
,
params
});
/**
/**
* 列表查询
* 列表查询
*/
*/
export
const
all
=
(
params
?:
DistributorParams
)
=>
export
const
all
=
(
params
?:
DistributorParams
)
=>
defHttp
.
get
<
DistributorPageResult
>
({
url
:
`
${
baseApi
}
/all`
,
params
});
defHttp
.
get
<
DistributorPageResult
>
({
url
:
`
${
baseApi
}
/all`
,
params
});
/**
/**
* 通过主键查询
* 通过主键查询
*/
*/
export
const
getById
=
(
id
:
any
)
=>
export
const
getById
=
(
id
:
any
)
=>
defHttp
.
get
<
Distributor
>
({
url
:
`
${
baseApi
}
/
${
id
}
`
});
defHttp
.
get
<
Distributor
>
({
url
:
`
${
baseApi
}
/
${
id
}
`
});
/**
/**
* 单个查询
* 单个查询
*/
*/
export
const
getOne
=
(
params
?:
DistributorParams
)
=>
export
const
getOne
=
(
params
?:
DistributorParams
)
=>
defHttp
.
get
<
Distributor
>
({
url
:
`
${
baseApi
}
/one`
,
params
});
defHttp
.
get
<
Distributor
>
({
url
:
`
${
baseApi
}
/one`
,
params
});
/**
/**
* 批量删除
* 批量删除
*/
*/
export
const
batchRemove
=
(
idList
:
Array
<
any
>
)
=>
export
const
batchRemove
=
(
idList
:
Array
<
any
>
)
=>
defHttp
.
post
<
boolean
>
({
url
:
`
${
baseApi
}
/batch-delete`
,
data
:
idList
});
defHttp
.
post
<
boolean
>
({
url
:
`
${
baseApi
}
/batch-delete`
,
data
:
idList
});
/**
/**
* 批量新增
* 批量新增
*/
*/
export
const
batchAdd
=
(
entityList
:
Array
<
Distributor
>
)
=>
export
const
batchAdd
=
(
entityList
:
Array
<
Distributor
>
)
=>
defHttp
.
post
<
boolean
>
({
url
:
`
${
baseApi
}
/batch-save`
,
data
:
entityList
});
defHttp
.
post
<
boolean
>
({
url
:
`
${
baseApi
}
/batch-save`
,
data
:
entityList
});
/**
/**
* 批量更新
* 批量更新
*/
*/
export
const
batchUpdate
=
(
entityList
:
Array
<
Distributor
>
)
=>
export
const
batchUpdate
=
(
entityList
:
Array
<
Distributor
>
)
=>
defHttp
.
post
<
boolean
>
({
url
:
`
${
baseApi
}
/batch-update`
,
data
:
entityList
});
defHttp
.
post
<
boolean
>
({
url
:
`
${
baseApi
}
/batch-update`
,
data
:
entityList
});
/**
/**
* 查询数量
* 查询数量
*/
*/
export
const
count
=
(
params
?:
DistributorParams
)
=>
export
const
count
=
(
params
?:
DistributorParams
)
=>
defHttp
.
get
<
Number
>
({
url
:
`
${
baseApi
}
/count`
,
params
});
defHttp
.
get
<
Number
>
({
url
:
`
${
baseApi
}
/count`
,
params
});
src/views/system/distributor/detail.vue
浏览文件 @
d1075d6d
<
template
>
<
template
>
<Card
:bordered=
"false"
>
<Card
:bordered=
"false"
:loading=
"isLoading"
>
<Descriptions
bordered
:column=
"3"
>
<Descriptions
bordered
:column=
"3"
>
<Descriptions
.
Item
<Descriptions
.
Item
v-for=
"p in displayProps"
v-for=
"p in displayProps"
...
@@ -7,8 +7,8 @@
...
@@ -7,8 +7,8 @@
:label=
"p.title"
:label=
"p.title"
:span=
"['avatar'].includes(p.name) ? 3 : 1"
:span=
"['avatar'].includes(p.name) ? 3 : 1"
>
>
<span
v-if=
"p.key === '
avatar
'"
>
<span
v-if=
"p.key === '
licensePic
'"
>
<
img
:src=
"p.value"
style=
"width: 120px; height
: 120px"
/>
<
ImagePreview
:imageList=
"[p.value]"
style=
"width
: 120px"
/>
</span>
</span>
<template
v-else
>
<template
v-else
>
{{
p
.
value
}}
{{
p
.
value
}}
...
@@ -18,39 +18,47 @@
...
@@ -18,39 +18,47 @@
</Card>
</Card>
</template>
</template>
<
script
lang=
"ts"
setup
name=
"DeviceDetail"
>
<
script
lang=
"ts"
setup
name=
"DeviceDetail"
>
import
{
onMounted
,
computed
,
ref
,
reactive
}
from
'vue'
;
import
{
onMounted
,
computed
,
ref
}
from
'vue'
;
import
{
useRoute
}
from
'vue-router'
;
import
{
useRoute
}
from
'vue-router'
;
import
{
useAsyncState
}
from
'@vueuse/core'
;
import
{
ImagePreview
}
from
'/@/components/Preview/index'
;
import
{
ComputedRef
}
from
'@vue/reactivity'
;
import
{
ComputedRef
}
from
'@vue/reactivity'
;
import
{
Descriptions
,
Card
}
from
'ant-design-vue'
;
import
{
Descriptions
,
Card
}
from
'ant-design-vue'
;
import
{
descriptionColumns
}
from
'./schema'
;
import
{
descriptionColumns
}
from
'./schema'
;
import
*
as
DistributorApi
from
'/@/api/system/distributorApi'
;
import
*
as
DistributorApi
from
'/@/api/system/distributorApi'
;
import
{
D
evice
}
from
'/@/api/model/device
'
;
import
{
D
istributor
}
from
'/@/api/model/distributor
'
;
const
route
=
useRoute
();
const
route
=
useRoute
();
const
id
=
ref
(
route
.
params
?.
id
);
const
id
=
ref
(
route
.
params
?.
id
);
let
data
=
reactive
({
detail
:
{},
// id 查询
isOver
:
false
,
const
{
});
state
:
detail
,
const
getDetail
=
()
=>
{
isReady
:
isDetailReady
,
DistributorApi
.
getById
(
id
.
value
).
then
((
res
:
Device
)
=>
{
isLoading
,
data
.
isOver
=
true
;
execute
,
data
.
detail
=
res
;
}
=
useAsyncState
(
});
()
=>
{
};
return
DistributorApi
.
getById
(
id
.
value
).
then
((
res
:
Distributor
)
=>
res
);
},
null
,
{
immediate
:
false
,
},
);
onMounted
(()
=>
{
onMounted
(()
=>
{
getDetail
();
execute
();
});
});
const
displayProps
:
ComputedRef
<
Array
<
any
>>
=
computed
(()
=>
{
const
displayProps
:
ComputedRef
<
Array
<
any
>>
=
computed
(()
=>
{
if
(
!
data
.
isOver
)
return
{};
if
(
!
isDetailReady
.
value
)
return
{};
const
display
:
any
=
descriptionColumns
.
map
(({
title
,
dataIndex
=
''
,
customRender
})
=>
({
const
display
:
any
=
descriptionColumns
.
map
(({
title
,
dataIndex
=
''
,
customRender
})
=>
({
key
:
dataIndex
,
key
:
dataIndex
,
title
,
title
,
value
:
customRender
value
:
customRender
?
customRender
({
text
:
d
ata
.
detail
[
dataIndex
],
record
:
data
.
detail
})
?
customRender
({
text
:
d
etail
.
value
[
dataIndex
],
record
:
detail
.
value
})
:
d
ata
.
detail
[
dataIndex
],
:
d
etail
.
value
[
dataIndex
],
}));
}));
return
display
;
return
display
;
});
});
...
...
src/views/system/distributor/drawer.vue
浏览文件 @
d1075d6d
<
template
>
<
template
>
<BasicDrawer
v-bind=
"$attrs"
@
register=
"registerDrawer"
showFooter
:title=
"getTitle"
width=
"600px"
@
ok=
"handleSubmit"
>
<BasicDrawer
v-bind=
"$attrs"
@
register=
"registerDrawer"
showFooter
:confirmDisabled=
"getConfirmDisabled"
:title=
"getTitle"
width=
"600px"
@
ok=
"handleSubmit"
>
<a-spin
:spinning=
"isLoading"
>
<BasicForm
@
register=
"registerForm"
/>
<BasicForm
@
register=
"registerForm"
/>
</a-spin>
</BasicDrawer>
</BasicDrawer>
</
template
>
</
template
>
<
script
lang=
"ts"
setup
name=
"DistributorDrawer"
>
<
script
lang=
"ts"
setup
name=
"DistributorDrawer"
>
...
@@ -8,7 +10,9 @@
...
@@ -8,7 +10,9 @@
import
{
BasicForm
,
useForm
}
from
'/@/components/Form/index'
;
import
{
BasicForm
,
useForm
}
from
'/@/components/Form/index'
;
import
{
formSchema
}
from
'./schema'
;
import
{
formSchema
}
from
'./schema'
;
import
{
BasicDrawer
,
useDrawerInner
}
from
'/@/components/Drawer'
;
import
{
BasicDrawer
,
useDrawerInner
}
from
'/@/components/Drawer'
;
import
{
useAsyncState
}
from
'@vueuse/core'
;
import
*
as
DistributorApi
from
'/@/api/system/distributorApi'
;
import
*
as
DistributorApi
from
'/@/api/system/distributorApi'
;
import
{
Distributor
}
from
'/@/api/model/distributor'
;
const
emit
=
defineEmits
([
'success'
,
'register'
]);
const
emit
=
defineEmits
([
'success'
,
'register'
]);
const
isUpdate
=
ref
(
true
);
const
isUpdate
=
ref
(
true
);
...
@@ -20,6 +24,22 @@
...
@@ -20,6 +24,22 @@
showActionButtonGroup
:
false
,
showActionButtonGroup
:
false
,
});
});
// id 查询
const
{
state
:
detail
,
isReady
:
isDetailReady
,
isLoading
,
execute
,
}
=
useAsyncState
(
()
=>
{
return
DistributorApi
.
getById
(
entityId
.
value
).
then
((
res
:
Distributor
)
=>
res
);
},
null
,
{
immediate
:
false
,
},
);
const
[
registerDrawer
,
{
setDrawerProps
,
closeDrawer
}]
=
useDrawerInner
(
async
(
data
)
=>
{
const
[
registerDrawer
,
{
setDrawerProps
,
closeDrawer
}]
=
useDrawerInner
(
async
(
data
)
=>
{
await
resetFields
();
await
resetFields
();
setDrawerProps
({
confirmLoading
:
false
});
setDrawerProps
({
confirmLoading
:
false
});
...
@@ -27,9 +47,21 @@
...
@@ -27,9 +47,21 @@
entityId
.
value
=
data
?.
record
?.
id
;
entityId
.
value
=
data
?.
record
?.
id
;
if
(
unref
(
isUpdate
))
{
if
(
unref
(
isUpdate
))
{
await
setFieldsValue
({
await
execute
();
...
data
.
record
,
if
(
detail
.
value
)
{
const
formData
:
any
=
{
...
detail
.
value
,
};
await
setFieldsValue
(
formData
);
}
}
});
});
const
getConfirmDisabled
=
computed
(()
=>
{
if
(
unref
(
isUpdate
))
{
return
!
unref
(
isDetailReady
);
}
else
{
return
false
;
}
}
});
});
...
...
src/views/system/distributor/index.vue
浏览文件 @
d1075d6d
...
@@ -8,6 +8,7 @@
...
@@ -8,6 +8,7 @@
<span>
已选中
{{
checkedKeys
.
length
}}
条记录
</span>
<span>
已选中
{{
checkedKeys
.
length
}}
条记录
</span>
<a-button
type=
"link"
@
click=
"checkedKeys = []"
size=
"small"
>
清空
</a-button>
<a-button
type=
"link"
@
click=
"checkedKeys = []"
size=
"small"
>
清空
</a-button>
<a-popconfirm
<a-popconfirm
v-auth=
"'AUTH_SYSTEM_DISTRIBUTOR'"
class=
"ml-4"
class=
"ml-4"
title=
"确定要全部删除吗?"
title=
"确定要全部删除吗?"
ok-text=
"是"
ok-text=
"是"
...
@@ -27,9 +28,6 @@
...
@@ -27,9 +28,6 @@
<a-button
v-auth=
"'AUTH_SYSTEM_DISTRIBUTOR:ADD'"
type=
"primary"
@
click=
"handleCreate"
>
新增
</a-button>
<a-button
v-auth=
"'AUTH_SYSTEM_DISTRIBUTOR:ADD'"
type=
"primary"
@
click=
"handleCreate"
>
新增
</a-button>
</
template
>
</
template
>
<
template
#
bodyCell=
"{ column, record, text }"
>
<
template
#
bodyCell=
"{ column, record, text }"
>
<template
v-if=
"column.dataIndex === 'id'"
>
<a
@
click=
"handleView(record)"
>
{{
record
.
id
}}
</a>
</
template
>
<template
v-if=
"['licensePic'].includes(column.dataIndex)"
>
<template
v-if=
"['licensePic'].includes(column.dataIndex)"
>
<img
:src=
"text"
class=
"photo"
alt=
"图片"
v-if=
"!!text"
/>
<img
:src=
"text"
class=
"photo"
alt=
"图片"
v-if=
"!!text"
/>
</
template
>
</
template
>
...
@@ -42,6 +40,12 @@
...
@@ -42,6 +40,12 @@
onClick: handleEdit.bind(null, record),
onClick: handleEdit.bind(null, record),
ifShow: hasPermission('AUTH_SYSTEM_DISTRIBUTOR:EDIT'),
ifShow: hasPermission('AUTH_SYSTEM_DISTRIBUTOR:EDIT'),
},
},
{
tooltip: '详情',
icon: 'ant-design:eye-outlined',
onClick: handleView.bind(null, record),
ifShow: hasPermission('AUTH_SYSTEM_DISTRIBUTOR:QUERY'),
},
{
{
tooltip: '删除',
tooltip: '删除',
icon: 'ant-design:delete-outlined',
icon: 'ant-design:delete-outlined',
...
@@ -60,7 +64,7 @@
...
@@ -60,7 +64,7 @@
<DistributorDrawer
@
register=
"registerDrawer"
@
success=
"handleSuccess"
/>
<DistributorDrawer
@
register=
"registerDrawer"
@
success=
"handleSuccess"
/>
</div>
</div>
</template>
</template>
<
script
lang=
"ts"
setup
name=
"
DeviceIndex
"
>
<
script
lang=
"ts"
setup
name=
"
AUTH_SYSTEM_DISTRIBUTOR
"
>
import
{
ref
}
from
'vue'
;
import
{
ref
}
from
'vue'
;
import
{
useGo
}
from
'/@/hooks/web/usePage'
;
import
{
useGo
}
from
'/@/hooks/web/usePage'
;
import
{
usePermission
}
from
'/@/hooks/web/usePermission'
;
import
{
usePermission
}
from
'/@/hooks/web/usePermission'
;
...
@@ -75,15 +79,20 @@
...
@@ -75,15 +79,20 @@
const
{
hasPermission
}
=
usePermission
();
const
{
hasPermission
}
=
usePermission
();
const
go
=
useGo
();
const
go
=
useGo
();
const
{
formConfig
,
showTableSetting
,
bordered
,
showIndexColumn
}
=
componentSetting
.
table
;
const
{
formConfig
,
showTableSetting
,
bordered
,
showIndexColumn
,
}
=
componentSetting
.
table
;
const
checkedKeys
=
ref
<
Array
<
string
|
number
>>
([]);
const
checkedKeys
=
ref
<
Array
<
string
|
number
>>
([]);
const
onSelectChange
=
(
selectedRowKeys
:
(
string
|
number
)[])
=>
{
const
onSelectChange
=
(
selectedRowKeys
:
(
string
|
number
)[])
=>
{
checkedKeys
.
value
=
selectedRowKeys
;
checkedKeys
.
value
=
selectedRowKeys
;
}
;
}
const
[
registerDrawer
,
{
openDrawer
}]
=
useDrawer
();
const
[
registerDrawer
,
{
openDrawer
}]
=
useDrawer
();
const
[
registerTable
,
{
reload
}]
=
useTable
({
const
[
registerTable
,
{
reload
,
setLoading
}]
=
useTable
({
title
:
'经销商表'
,
title
:
'经销商表'
,
api
:
(
params
)
=>
DistributorApi
.
search
(
handleParams
(
params
)),
api
:
(
params
)
=>
DistributorApi
.
search
(
handleParams
(
params
)),
columns
,
columns
,
...
@@ -94,6 +103,7 @@
...
@@ -94,6 +103,7 @@
},
},
rowSelection
:
{
rowSelection
:
{
type
:
'checkbox'
,
type
:
'checkbox'
,
// @ts-ignore
selectedRowKeys
:
checkedKeys
,
selectedRowKeys
:
checkedKeys
,
onChange
:
onSelectChange
,
onChange
:
onSelectChange
,
},
},
...
@@ -104,10 +114,9 @@
...
@@ -104,10 +114,9 @@
canResize
:
false
,
canResize
:
false
,
rowKey
:
(
record
:
any
)
=>
record
.
id
,
rowKey
:
(
record
:
any
)
=>
record
.
id
,
actionColumn
:
{
actionColumn
:
{
width
:
8
0
,
width
:
12
0
,
title
:
'操作'
,
title
:
'操作'
,
dataIndex
:
'action'
,
dataIndex
:
'action'
,
fixed
:
'right'
,
fixed
:
'right'
,
},
},
});
});
...
@@ -150,14 +159,20 @@
...
@@ -150,14 +159,20 @@
};
};
const
handleDelete
=
(
record
:
Recordable
)
=>
{
const
handleDelete
=
(
record
:
Recordable
)
=>
{
setLoading
(
true
);
DistributorApi
.
remove
(
record
.
id
).
then
((
_
)
=>
{
DistributorApi
.
remove
(
record
.
id
).
then
((
_
)
=>
{
reload
();
reload
();
}).
catch
(()
=>
{
setLoading
(
false
);
});
});
};
};
const
handleBatchDelete
=
()
=>
{
const
handleBatchDelete
=
()
=>
{
setLoading
(
true
);
DistributorApi
.
batchRemove
(
checkedKeys
.
value
).
then
((
_
)
=>
{
DistributorApi
.
batchRemove
(
checkedKeys
.
value
).
then
((
_
)
=>
{
reload
();
reload
();
}).
catch
(()
=>
{
setLoading
(
false
);
});
});
};
};
...
@@ -166,6 +181,6 @@
...
@@ -166,6 +181,6 @@
};
};
const
handleView
=
(
record
)
=>
{
const
handleView
=
(
record
)
=>
{
go
(
'/system/distributor/'
+
record
.
id
);
go
(
'/
main/
system/distributor/'
+
record
.
id
);
};
};
</
script
>
</
script
>
src/views/system/distributor/schema.ts
浏览文件 @
d1075d6d
...
@@ -8,7 +8,6 @@
...
@@ -8,7 +8,6 @@
import
{
BasicColumn
}
from
'/@/components/Table'
;
import
{
BasicColumn
}
from
'/@/components/Table'
;
import
{
FormSchema
}
from
'/@/components/Table'
;
import
{
FormSchema
}
from
'/@/components/Table'
;
import
get
from
'lodash.get'
;
export
enum
StatusEnum
{
export
enum
StatusEnum
{
PENDING_REVIEW
=
'待审核'
,
PENDING_REVIEW
=
'待审核'
,
...
@@ -33,16 +32,16 @@ export const schema = {
...
@@ -33,16 +32,16 @@ export const schema = {
properties
:
[
properties
:
[
{
{
field
:
'id'
,
field
:
'id'
,
label
:
'ID
系统自动生成
'
,
label
:
'ID'
,
defaultValue
:
undefined
,
defaultValue
:
undefined
,
form
:
{
form
:
{
componentProps
:
{
componentProps
:
{
allowClear
:
false
,
allowClear
:
false
,
placeholder
:
'ID
系统自动生成
'
,
placeholder
:
'ID'
,
},
},
colProps
,
colProps
,
component
:
'InputNumber'
,
component
:
'InputNumber'
,
rules
:
[{
required
:
true
,
message
:
'请输入ID
系统自动生成
!'
}],
rules
:
[{
required
:
true
,
message
:
'请输入ID!'
}],
},
},
table
:
{},
table
:
{},
},
},
...
@@ -254,7 +253,6 @@ export const schema = {
...
@@ -254,7 +253,6 @@ export const schema = {
};
};
const
queryFields
=
[
const
queryFields
=
[
'id'
,
'name'
,
'name'
,
'price'
,
'price'
,
'usedPrice'
,
'usedPrice'
,
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论