Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in
Toggle navigation
H
hs-sky-ui
Project
Project
Details
Activity
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
何虹
hs-sky-ui
Commits
6ad7f3ce
Commit
6ad7f3ce
authored
Apr 23, 2020
by
何虹
💬
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
测试
parent
7d706d09
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
1332 additions
and
942 deletions
+1332
-942
App.vue
src/App.vue
+1
-1
apiUc.js
src/components/apiUc.js
+27
-18
hsTable.vue
src/components/hsTable.vue
+127
-0
index.vue
src/packages/hs-table/index.vue
+1177
-923
No files found.
src/App.vue
View file @
6ad7f3ce
...
...
@@ -9,7 +9,7 @@
</
template
>
<
script
>
import
HelloWorld
from
"./components/
HelloWorld
.vue"
;
import
HelloWorld
from
"./components/
hsTable
.vue"
;
export
default
{
name
:
"App"
,
...
...
src/components/apiUc.js
View file @
6ad7f3ce
...
...
@@ -28,15 +28,13 @@ export default {
},
methods
:
{
async
requestMethod
(
config
,
value
)
{
const
{
ref
,
proxyTag
,
dyncQueryParms
}
=
config
||
{}
const
{
const_id
,
table_name
,
columns
,
remote_condition
}
=
ref
||
{}
const
url_dynamic
=
`
${
proxyTag
}
/ref/table`
const
url_static
=
`
${
proxyTag
}
/ref/items`
let
real_url
=
''
const
url
=
''
const
{
ref
,
dyncQueryParms
}
=
config
||
{}
const
{
remote_condition
}
=
ref
||
{}
let
real_url
=
this
.
initRealUrl
(
config
)
if
(
!
real_url
)
return
[]
let
remote_condition_
=
remote_condition
.
trim
()
let
parms
=
''
const
dyncQueryParms_
=
_
.
cloneDeep
(
dyncQueryParms
||
{})
const
dyncQueryParms_
=
_
.
cloneDeep
(
dyncQueryParms
||
{})
if
(
value
)
{
dyncQueryParms_
[
remote_condition_
]
=
value
.
trim
()
}
...
...
@@ -47,23 +45,13 @@ export default {
parms
+=
`&
${
key
}
=
${
encodeURIComponent
(
dyncQueryParms_
[
key
])}
`
}
}
if
(
const_id
!==
'0'
&&
Number
(
const_id
))
{
// 常量id
real_url
=
`
${
url_static
}
/
${
const_id
}
/`
}
else
if
(
table_name
)
{
// 表名字段名
// 字段查询
real_url
=
`
${
url_dynamic
}
/
${
table_name
}
/
${
columns
}
/`
}
else
if
(
url
)
{
real_url
=
url
}
if
(
real_url
.
includes
(
'?'
))
{
real_url
+=
parms
}
else
{
real_url
+=
'?'
+
parms
}
if
(
!
real_url
)
return
[]
const
type
=
typeof
value
if
(
type
===
'undefined'
&&
remote_condition
)
{
// 远程搜索的时候
if
(
type
===
'undefined'
&&
remote_condition
_
)
{
// 远程搜索的时候
return
[]
}
else
{
const
res
=
await
axios
.
get
(
real_url
)
...
...
@@ -96,5 +84,26 @@ export default {
return
list
},
initRealUrl
(
config
)
{
const
{
url
,
ref
,
proxyTag
}
=
config
const
{
const_id
,
table_name
,
columns
,
remote_condition
}
=
ref
const
url_dynamic
=
`
${
proxyTag
}
/ref/table`
const
url_static
=
`
${
proxyTag
}
/ref/items`
if
(
remote_condition
)
{
if
(
table_name
)
{
return
`
${
url_dynamic
}
/
${
table_name
}
/
${
columns
}
/`
}
else
{
return
`
${
url
}
`
}
}
else
{
if
(
const_id
&&
Number
(
const_id
)
!==
0
)
{
return
`
${
url_static
}
/
${
const_id
}
/`
}
else
if
(
table_name
)
{
return
`
${
url_dynamic
}
/
${
table_name
}
/
${
columns
}
/`
}
else
{
return
url
}
}
}
},
}
src/components/hsTable.vue
0 → 100644
View file @
6ad7f3ce
<
template
>
<div>
<hsTable
maxHeight=
'500px'
:allSourceData=
'allSourceData'
></hsTable>
</div>
</
template
>
<
script
>
import
apiUc
from
"./apiUc"
;
export
default
{
mixins
:
[
apiUc
],
data
()
{
return
{
allSourceData
:
{
config
:
{},
sourceData
:
[]
}
};
},
mounted
()
{
this
.
init
();
},
methods
:
{
init
()
{
this
.
allSourceData
.
config
=
{
showIndex
:
false
,
// 是否显示 序号
hsConfig
:
{
default_type
:
1
// mes风格
},
showHandle
:
true
,
// 是否显示操作栏
selection
:
true
,
// 是否显示复选框
handleWidth
:
180
,
// 操作栏宽度
isAdaptive
:
true
,
// 宽度自适应
toolItems
:
[
// 工具栏
{
label
:
"测试2"
,
icon
:
""
,
type
:
"text"
,
isHide
:
false
,
// 是否隐藏
disabled
:
false
,
// 是否禁用
click
:
()
=>
{
alert
(
"测试2"
);
}
}
],
handleColumns
:
[
// 操作栏
{
label
:
"测试1"
,
icon
:
""
,
isHide
:
false
,
// 是否隐藏
type
:
"text"
,
disabled
:
false
,
// 是否禁用
click
:
()
=>
{
alert
(
"测试"
);
}
},
{
label
:
"测试2"
,
icon
:
""
,
isHide
:
false
,
// 是否隐藏
type
:
"text"
,
disabled
:
false
,
// 是否禁用
click
:
()
=>
{
this
.
allSourceData
.
sourceData
.
push
({});
}
}
],
columnsConfig
:
[
// 列信息
{
prop
:
"order_size"
,
//对应后端的字段
label
:
"型号"
,
// 列名
showOverflowTooltip
:
true
,
// 超出时 显示省略
showType
:
"hsSelectPlus"
,
// 列类型
allSourceData
:
{
// 参照配置
config
:
{
url
:
""
,
isInnerRequest
:
true
,
// 是否在内部请求
proxyTag
:
"commonUtilAPI"
,
// 代理前缀
ref
:
{
const_id
:
"0"
,
// 常量值
table_name
:
"im_store_group"
,
// 表名
columns
:
"id,name"
,
//列名
remote_condition
:
""
,
// 是否远程搜索
displayfield
:
""
,
// 显示默认值
writebackfield
:
[]
//回写字段
},
dyncQueryParms
:
{},
// 查询参数
multiple
:
false
,
// 是否多选
disabled
:
false
,
size
:
"mini"
,
clearable
:
true
,
title
:
""
,
placeholder
:
"请选择"
,
value
:
"id"
,
// 对应的后端字段
label
:
"name"
,
// 对应的后端字段
is_computed
:
false
// 是否是计算属性
},
sourceData
:
[]
},
requestMethod
:
this
.
requestMethod
// 参照请求方法
},
{
prop
:
"style_code"
,
label
:
"款号"
,
showOverflowTooltip
:
true
,
showType
:
"input"
// 普通输入框
},
{
prop
:
"customer_name"
,
label
:
"客户"
,
showOverflowTooltip
:
true
,
showType
:
"text"
// 文本
}
]
};
this
.
allSourceData
.
sourceData
=
[
{
customer_name
:
1
,
style_code
:
2
,
order_size
:
"0"
}
];
}
}
};
</
script
>
\ No newline at end of file
src/packages/hs-table/index.vue
View file @
6ad7f3ce
This diff is collapsed.
Click to expand it.
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