Skip to content
项目
群组
代码片段
帮助
正在加载...
帮助
提交反馈
为 GitLab 提交贡献
登录
切换导航
iBiz-Vue-R7-Res
项目
项目
详情
动态
版本
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
计划
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
统计图
创建新议题
作业
提交
议题看板
打开侧边栏
iBiz-R7前端标准模板
iBiz-Vue-R7-Res
提交
0ad47d65
提交
0ad47d65
编写于
6月 12, 2020
作者:
lijinyang
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
穿梭框本地文件更新
上级
42e765ac
变更
2
显示空白字符变更
内嵌
并排
正在显示
2 个修改的文件
包含
273 行增加
和
253 行删除
+273
-253
app-transfer.less
src/components/app-transfer/app-transfer.less
+20
-6
app-transfer.vue
src/components/app-transfer/app-transfer.vue
+253
-247
未找到文件。
src/components/app-transfer/app-transfer.less
浏览文件 @
0ad47d65
.ivu-select-dropdown {
.transfer-select{
.ivu-select-dropdown {
padding: 0px;
padding: 0px;
.hidden {
.hidden {
display: none;
display: none;
}
}
.el-transfer{
min-width: 100% !important;
display: flex;
justify-content: space-between;
.el-transfer-panel{
min-width: 25%;
}
}
.el-transfer__buttons{
align-self: center;
}
}
}
}
src/components/app-transfer/app-transfer.vue
浏览文件 @
0ad47d65
<
template
>
<
template
>
<Select
<Select
class=
"transfer-select"
@
on-open-change=
"transferRefresh"
@
on-open-change=
"transferRefresh"
@
on-change=
"dataChange"
@
on-change=
"dataChange"
v-model=
"dataRight"
v-model=
"dataRight"
:style=
"
{width:width?width:'586px'}"
:style=
"
{width:width}"
multiple
:disabled="disabled"
>
:placeholder="placeholder"
<Option
class=
"hidden"
:value=
"item"
v-for=
"(item,i) in dataRight"
:key=
"i"
>
{{
findLabel
(
item
)
}}
</Option>
multiple>
<el-transfer
v-model=
"dataRight"
:data=
"dataLeft"
@
change=
"dataChange"
:titles=
"['未选择', '已选择']"
></el-transfer>
<Option
class=
"hidden"
:value=
"item"
v-for=
"(item,i) in dataRight"
:key=
"i"
>
{{
findLabel
(
item
)
}}
</Option>
<el-transfer
v-model=
"dataRight"
:data=
"dataLeft"
@
change=
"dataChange"
:titles=
"['未选择', '已选择']"
/>
</Select>
</Select>
</
template
>
</
template
>
<
script
lang=
"ts"
>
<
script
lang=
"ts"
>
import
{
Vue
,
Component
,
Watch
,
Prop
,
Model
}
from
"vue-property-decorator"
;
import
{
Vue
,
Component
,
Watch
,
Prop
,
Model
}
from
"vue-property-decorator"
;
import
CodeListService
from
"@service/app/codelist-service"
;
import
CodeListService
from
"@service/app/codelist-service"
;
...
@@ -17,29 +26,29 @@ import { ElSelect } from "element-ui/types/select";
...
@@ -17,29 +26,29 @@ import { ElSelect } from "element-ui/types/select";
@
Component
({})
@
Component
({})
export
default
class
AppTransfer
extends
Vue
{
export
default
class
AppTransfer
extends
Vue
{
/**
/**
* 穿梭框宽度
* 传入表单数据
*
*
* @type {*}
* @type {*}
* @memberof AppTransfer
* @memberof AppTransfer
*/
*/
@
Prop
()
public
width
:
any
;
@
Prop
()
public
data
:
any
;
/**
/**
* 表单传入字符串值分隔符
* 穿梭框宽度
*
*
* @type {string}
* @type {string}
* @memberof AppTransfer
* @memberof AppTransfer
*/
*/
@
Prop
()
public
valueSeparator
!
:
string
;
@
Prop
()
public
width
?
:
string
;
/**
/**
* 当前选中值
* 表单传入字符串值分隔符
* @type {any}
*
* @type {string}
* @memberof AppTransfer
* @memberof AppTransfer
*/
*/
@
Model
(
"change"
)
public
itemValue
!
:
any
;
@
Prop
()
public
valueSeparator
?:
string
;
/**
/**
* 代码表标识
* 代码表标识
...
@@ -99,18 +108,24 @@ export default class AppTransfer extends Vue {
...
@@ -99,18 +108,24 @@ export default class AppTransfer extends Vue {
@
Prop
()
public
disabled
?:
any
;
@
Prop
()
public
disabled
?:
any
;
/**
/**
* placeholder
* 穿梭框提示内容
*
*
* @type {string}
* @type {string}
* @memberof AppTransfer
* @memberof AppTransfer
*
*/
*/
@
Prop
()
public
placeholder
?:
string
;
@
Prop
()
public
placeholder
?:
string
;
/**
* 当前选中值
*
* @type {any}
* @memberof AppTransfer
*/
@
Model
(
"change"
)
public
itemValue
!
:
any
;
/**
/**
* 左侧框数据
* 左侧框数据
*
*
* @type {any[]}
* @memberof AppTransfer
* @memberof AppTransfer
*/
*/
public
dataLeft
:
any
[]
=
[];
public
dataLeft
:
any
[]
=
[];
...
@@ -118,7 +133,6 @@ export default class AppTransfer extends Vue {
...
@@ -118,7 +133,6 @@ export default class AppTransfer extends Vue {
/**
/**
* 右侧框数据
* 右侧框数据
*
*
* @type {any[]}
* @memberof AppTransfer
* @memberof AppTransfer
*/
*/
public
dataRight
:
any
[]
=
[];
public
dataRight
:
any
[]
=
[];
...
@@ -129,42 +143,18 @@ export default class AppTransfer extends Vue {
...
@@ -129,42 +143,18 @@ export default class AppTransfer extends Vue {
* @type {CodeListService}
* @type {CodeListService}
* @memberof AppTransfer
* @memberof AppTransfer
*/
*/
public
codeListService
:
CodeListService
=
new
CodeListService
({
public
codeListService
:
CodeListService
=
new
CodeListService
({
$store
:
this
.
$store
});
$store
:
this
.
$store
});
/**
/**
* vue 生命周期
* vue 生命周期
*
* @memberof AppTransfer
* @memberof AppTransfer
*/
*/
public
created
()
{
public
created
()
{
this
.
dataHandle
();
this
.
dataHandle
();
}
}
/**
* 组件change事件,右侧框数据变化时
*
* @memberof AppTransfer
*/
dataChange
(
e
:
any
)
{
let
_valueSeparator
:
string
=
this
.
initValueSeparator
();
let
newVal
:
string
=
e
.
join
(
`
${
_valueSeparator
}
`
);
if
(
newVal
)
{
this
.
$emit
(
"change"
,
newVal
);
}
else
{
this
.
$emit
(
"change"
,
null
);
}
}
/**
* 初始化valueSeparator
*
* @memberof AppTransfer
*/
public
initValueSeparator
()
{
return
this
.
valueSeparator
?
this
.
valueSeparator
:
","
;
}
/**
/**
* 数据处理
* 数据处理
*
*
...
@@ -175,8 +165,7 @@ export default class AppTransfer extends Vue {
...
@@ -175,8 +165,7 @@ export default class AppTransfer extends Vue {
const
codelist
=
this
.
$store
.
getters
.
getCodeList
(
this
.
tag
);
const
codelist
=
this
.
$store
.
getters
.
getCodeList
(
this
.
tag
);
if
(
codelist
)
{
if
(
codelist
)
{
this
.
dataLeft
=
[...
JSON
.
parse
(
JSON
.
stringify
(
codelist
.
items
))];
this
.
dataLeft
=
[...
JSON
.
parse
(
JSON
.
stringify
(
codelist
.
items
))];
this
.
initLeft
();
this
.
initData
()
this
.
initRight
();
}
else
{
}
else
{
console
.
log
(
`----
${
this
.
tag
}
----代码表不存在`
);
console
.
log
(
`----
${
this
.
tag
}
----代码表不存在`
);
}
}
...
@@ -187,11 +176,13 @@ export default class AppTransfer extends Vue {
...
@@ -187,11 +176,13 @@ export default class AppTransfer extends Vue {
// 参数处理
// 参数处理
let
_context
=
data
.
context
;
let
_context
=
data
.
context
;
let
_param
=
data
.
param
;
let
_param
=
data
.
param
;
this
.
codeListService
.
getItems
(
this
.
tag
,
_context
,
_param
).
then
((
res
:
any
)
=>
{
this
.
codeListService
.
getItems
(
this
.
tag
,
_context
,
_param
)
.
then
((
res
:
any
)
=>
{
this
.
dataLeft
=
res
;
this
.
dataLeft
=
res
;
this
.
initLeft
();
this
.
initData
()
this
.
initRight
();
})
})
.
catch
((
error
:
any
)
=>
{
.
catch
((
error
:
any
)
=>
{
console
.
log
(
`----
${
this
.
tag
}
----代码表不存在`
);
console
.
log
(
`----
${
this
.
tag
}
----代码表不存在`
);
});
});
}
}
...
@@ -210,21 +201,22 @@ export default class AppTransfer extends Vue {
...
@@ -210,21 +201,22 @@ export default class AppTransfer extends Vue {
arg
.
context
=
this
.
context
?
JSON
.
parse
(
JSON
.
stringify
(
this
.
context
))
:
{};
arg
.
context
=
this
.
context
?
JSON
.
parse
(
JSON
.
stringify
(
this
.
context
))
:
{};
// 附加参数处理
// 附加参数处理
if
(
this
.
localContext
&&
Object
.
keys
(
this
.
localContext
).
length
>
0
)
{
if
(
this
.
localContext
&&
Object
.
keys
(
this
.
localContext
).
length
>
0
)
{
let
_context
=
this
.
$util
.
computedNavData
(
this
.
itemValue
,
arg
.
context
,
arg
.
param
,
this
.
localContext
);
let
_context
=
this
.
$util
.
computedNavData
(
this
.
data
,
arg
.
context
,
arg
.
param
,
this
.
localContext
);
Object
.
assign
(
arg
.
context
,
_context
);
Object
.
assign
(
arg
.
context
,
_context
);
}
}
if
(
this
.
localParam
&&
Object
.
keys
(
this
.
localParam
).
length
>
0
)
{
if
(
this
.
localParam
&&
Object
.
keys
(
this
.
localParam
).
length
>
0
)
{
let
_param
=
this
.
$util
.
computedNavData
(
this
.
itemValue
,
arg
.
context
,
arg
.
param
,
this
.
localParam
);
let
_param
=
this
.
$util
.
computedNavData
(
this
.
data
,
arg
.
context
,
arg
.
param
,
this
.
localParam
);
Object
.
assign
(
arg
.
param
,
_param
);
Object
.
assign
(
arg
.
param
,
_param
);
}
}
}
}
/**
/**
* 初始化左侧框
数据
* 初始化获取到的选项
数据
*
*
* @memberof AppTransfer
* @memberof AppTransfer
*/
*/
public
initLeft
()
{
public
initData
(){
// 初始化左侧框数据
let
left
:
any
[]
=
[];
let
left
:
any
[]
=
[];
Object
.
assign
(
left
,
this
.
dataLeft
);
Object
.
assign
(
left
,
this
.
dataLeft
);
this
.
dataLeft
=
[];
this
.
dataLeft
=
[];
...
@@ -236,14 +228,8 @@ export default class AppTransfer extends Vue {
...
@@ -236,14 +228,8 @@ export default class AppTransfer extends Vue {
disabled
:
elem
.
disabled
disabled
:
elem
.
disabled
});
});
});
});
}
/**
// 初始化右侧框数据
* 初始化右侧框数据
*
* @memberof AppTransfer
*/
public
initRight
()
{
let
_valueSeparator
:
any
;
let
_valueSeparator
:
any
;
_valueSeparator
=
this
.
initValueSeparator
();
_valueSeparator
=
this
.
initValueSeparator
();
let
_data
:
any
=
this
.
itemValue
;
let
_data
:
any
=
this
.
itemValue
;
...
@@ -261,12 +247,34 @@ export default class AppTransfer extends Vue {
...
@@ -261,12 +247,34 @@ export default class AppTransfer extends Vue {
}
}
}
}
/**
* 组件change事件,右侧框数据变化时
* @memberof AppTransfer
*/
public
dataChange
(
e
:
any
)
{
let
_valueSeparator
:
string
;
_valueSeparator
=
this
.
initValueSeparator
();
let
newVal
:
string
=
e
.
join
(
`
${
_valueSeparator
}
`
);
if
(
newVal
)
{
this
.
$emit
(
"change"
,
newVal
);
}
else
{
this
.
$emit
(
"change"
,
null
);
}
}
/**
* 初始化valueSeparator
* @memberof AppTransfer
*/
public
initValueSeparator
()
{
return
this
.
valueSeparator
?
this
.
valueSeparator
:
","
;
}
/**
/**
* 穿梭框打开时刷新数据
* 穿梭框打开时刷新数据
*
* @memberof AppTransfer
* @memberof AppTransfer
*/
*/
public
transferRefresh
(
e
:
any
)
{
public
transferRefresh
(
e
:
boolean
)
{
if
(
e
&&
this
.
codelistType
===
"DYNAMIC"
)
{
if
(
e
&&
this
.
codelistType
===
"DYNAMIC"
)
{
this
.
dataLeft
=
[];
this
.
dataLeft
=
[];
this
.
dataHandle
();
this
.
dataHandle
();
...
@@ -275,7 +283,6 @@ export default class AppTransfer extends Vue {
...
@@ -275,7 +283,6 @@ export default class AppTransfer extends Vue {
/**
/**
* 找到dataLeft中key与dataRight中item相等的元素,返回label
* 找到dataLeft中key与dataRight中item相等的元素,返回label
*
* @memberof AppTransfer
* @memberof AppTransfer
*/
*/
public
findLabel
(
item
:
any
)
{
public
findLabel
(
item
:
any
)
{
...
@@ -283,7 +290,6 @@ export default class AppTransfer extends Vue {
...
@@ -283,7 +290,6 @@ export default class AppTransfer extends Vue {
if
(
elem
.
key
===
item
)
return
elem
.
label
;
if
(
elem
.
key
===
item
)
return
elem
.
label
;
}
}
}
}
}
}
</
script
>
</
script
>
...
...
编辑
预览
Markdown
格式
0%
请重试
or
添加新附件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
先完成此消息的编辑!
取消
想要评论请
注册
或
登录