Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
M
mes-ui
Project
Project
Details
Activity
Releases
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
周远喜
mes-ui
Commits
d87fcd76
Commit
d87fcd76
authored
Sep 18, 2020
by
renjintao
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
部门导入page
parent
b8520f72
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
753 additions
and
577 deletions
+753
-577
dataGrid.vue
components/page/dataGrid.vue
+702
-561
process.vue
components/page/import/process.vue
+15
-1
zh-CN.js
i18n/locale/zh-CN.js
+1
-0
henq.js
libs/henq.js
+1
-1
index.vue
pages/basicData/department/index.vue
+34
-14
No files found.
components/page/dataGrid.vue
View file @
d87fcd76
<
template
>
<div
class=
"table-content myBug
"
>
<div
class=
"table-content
"
>
<div
class=
"table-tools"
v-if=
"tool"
>
<div
class=
"table-search"
v-if=
"easy"
>
<slot
name=
"easySearch"
>
<Input
search
enter-button
:placeholder=
"placeholder"
@
on-search=
"easySearch"
v-model=
"keys"
/>
</slot>
</div>
<Button
v-if=
"high"
@
click=
"modalSearch=true"
type=
"text"
>
<Icon
type=
"md-search"
/>
高级
</Button>
<div
class=
"searchBack"
>
<slot
name=
"searchBack"
></slot>
</div>
<div
class=
"btns"
>
<slot
name=
"buttons"
></slot>
<Button
v-if=
"set&&type=='table'"
@
click=
"config=!config"
>
<Icon
type=
"md-build"
class=
"table-set"
size=
"14"
title=
"列设置"
/>
</Button>
</div>
<div
class=
"table-search"
>
<slot
name=
"easySearch"
v-if=
"easy"
>
<Form
inline
>
<FormItem>
<Input
search
enter-button
:placeholder=
"placeholder"
@
on-search=
"easySearch"
v-width=
"300"
v-model=
"keys"
/>
</FormItem>
<FormItem>
<Button
v-if=
"high"
@
click=
"modalSearch=true"
type=
"text"
>
<Icon
type=
"md-search"
/>
高级
</Button>
</FormItem>
</Form>
</slot>
</div>
<div
class=
"searchBack"
>
<slot
name=
"searchBack"
></slot>
</div>
<div
class=
"btns"
>
<slot
name=
"buttons"
></slot>
<Button
@
click=
"export2Excel"
v-if=
"exportTitle.length>0"
>
导出
</Button>
<Button
v-if=
"set&&type=='table'"
@
click=
"config=!config"
>
<Icon
type=
"md-build"
title=
"列设置"
/>
</Button>
</div>
</div>
<div
v-if=
"type=='card'"
class=
"table-card"
>
<Row>
<Col
:span=
"span"
v-for=
"(row,i) in list"
:key=
"i"
>
<slot
name=
"card"
:row=
"row"
>
<span>
{{
row
.
id
}}
</span>
</slot>
</Col>
</Row>
<div
class=
"table-main"
ref=
"main"
>
<Row
v-if=
"type=='card'"
:gutter=
"40"
>
<Col
:span=
"span"
v-for=
"(row,i) in list"
:key=
"i"
>
<slot
name=
"card"
:row=
"row"
>
<span>
{{
row
.
id
}}
</span>
</slot>
</Col>
</Row>
<Table
v-else
:border=
"border"
:columns=
"columnsNow"
:data=
"list"
:height=
"tableHeight"
:draggable=
"draggable"
ref=
"table"
class=
"tableCommon"
@
on-expand=
"expand"
@
on-drag-drop=
"onDragDrop"
@
on-selection-change=
"selectionChange"
@
on-select=
"onSelect"
@
on-select-all=
"allChange"
:row-key=
"rowKey"
stripe
></Table>
</div>
<Table
v-else
:border=
"border"
:columns=
"columnsNow"
:data=
"list"
:height=
"tableHeight"
:draggable=
"draggable"
ref=
"table"
class=
"tableCommon"
@
on-expand=
"expand"
@
on-drag-drop=
"onDragDrop"
@
on-selection-change=
"selectionChange"
@
on-select=
"onSelect"
></Table>
<div
class=
"table-footer"
>
<div>
<slot
name=
"footer"
></slot>
</div>
<Page
v-if=
"page"
:total=
"search.total"
:current=
"search.page"
class=
"mr15 mt5 fr"
show-total
size=
"small"
show-elevator
show-sizer
:page-size=
"search.pageSize"
:page-size-opts=
"pageSizeOpts"
@
on-change=
"pageChange"
@
on-page-size-change=
"pageSizeChange"
/>
<Page
v-if=
"page"
:total=
"search.total"
:current=
"search.page"
class=
"fr"
show-total
size=
"small"
show-elevator
show-sizer
:page-size=
"search.pageSize"
:page-size-opts=
"pageSizeOpts"
@
on-change=
"pageChange"
@
on-page-size-change=
"pageSizeChange"
/>
</div>
<Modal
v-if=
"high"
v-model=
"modalSearch"
title=
"高级搜索"
draggable
width=
"800"
ref=
"search"
>
<slot
name=
"searchForm"
></slot>
<div
slot=
"footer"
>
<Button
@
click=
"modalSearch=false"
style=
"margin-left:20px;"
>
取消
</Button>
<Button
@
click=
"complexSearch"
type=
"primary"
style=
"margin-left:10px;"
>
查询
</Button>
</div>
<slot
name=
"searchForm"
></slot>
<div
slot=
"footer"
>
<Button
@
click=
"modalSearch=false"
style=
"margin-left:20px;"
>
取消
</Button>
<Button
@
click=
"complexSearch"
type=
"primary"
style=
"margin-left:10px;"
>
查询
</Button>
</div>
</Modal>
<Drawer
title=
"列设置"
v-if=
"set"
v-model=
"config"
:scrollable=
"true"
placement=
"left"
:mask=
"false"
>
<div
slot=
"header"
>
列设置
<a
@
click=
"undoConfig"
class=
"ml50"
>
<Icon
type=
"md-refresh"
title=
"恢复初始设置"
/>
</a>
</div>
<ul
class=
"table-columns"
>
<li
v-for=
"(li,index) in columnsCur"
:key=
"index"
v-dragging=
"
{ item: li, list: columnsCur, group: 'li' }"
>
<label
@
click=
"columnChange(li,index)"
:class=
"
{dis:li.hide}">
<Icon
:type=
"li.hide?'md-eye-off':'md-eye'"
size=
"16"
class=
"mr10"
/>
<span>
{{
li
.
title
}}
</span>
</label>
<Icon
type=
"ios-move"
class=
"move"
size=
"18"
/>
</li>
</ul>
<Drawer
title=
"列设置"
v-if=
"set"
v-model=
"config"
:scrollable=
"true"
placement=
"left"
:mask=
"false"
>
<div
slot=
"header"
>
列设置
<a
@
click=
"undoConfig"
class=
"ml50"
>
<Icon
type=
"md-refresh"
title=
"恢复初始设置"
/>
</a>
</div>
<ul
class=
"table-columns"
>
<li
v-for=
"(li,index) in columnsCur"
:key=
"index"
v-dragging=
"
{ item: li, list: columnsCur, group: 'li' }">
<label
@
click=
"columnChange(li,index)"
:class=
"
{dis:li.hide}">
<Icon
:type=
"li.hide?'md-eye-off':'md-eye'"
size=
"16"
class=
"mr10"
/>
<span>
{{
li
.
title
}}
</span>
</label>
<Icon
type=
"ios-move"
class=
"move"
size=
"18"
/>
</li>
</ul>
</Drawer>
<FooterToolbar
style=
"height:65px"
v-if=
"batch"
v-show=
"footerToolbar"
>
<div
class=
"tip"
>
已选
{{
selectItems
.
length
}}
项
<slot
name=
"batch"
></slot>
</div>
<Button
@
click=
"footerToolbar=false"
>
取消
</Button>
<FooterToolbar
v-if=
"batch"
v-show=
"footerToolbar"
class=
"ftball"
>
<div
class=
"tip"
>
已选
{{
selectItems
.
length
}}
项
</div>
<slot
name=
"batch"
></slot>
<Button
@
click=
"cancelBatch"
>
取消
</Button>
</FooterToolbar>
</div>
</div>
</
template
>
<
script
>
export
default
{
name
:
"DataGrid"
,
data
()
{
return
{
keys
:
""
,
selectItems
:
[],
footerToolbar
:
false
,
modalSearch
:
false
,
search
:
{
pageIndex
:
1
,
pageSize
:
20
,
conditions
:
[],
},
pageSizeOpts
:
[
20
,
50
,
100
],
tableHeight
:
0
,
firstY
:
0
,
config
:
false
,
list
:
[],
columnsCur
:
[],
configLoad
:
false
,
userConfig
:
null
,
//用户页面配置信息。,
// userId: 1
userId
:
this
.
$store
.
state
.
userInfo
.
userId
,
};
},
props
:
{
border
:
{
//是否显示边框
type
:
Boolean
,
default
:
true
,
},
batch
:
{
//是否批量操作
type
:
Boolean
,
default
:
true
,
},
lazy
:
{
//懒加载设置,设置为真时候,默认不加载数据。
type
:
Boolean
,
default
:
false
,
},
placeholder
:
{
type
:
String
,
default
:
"请输入关键字"
,
},
height
:
{
type
:
Number
,
default
:
0
,
},
tool
:
{
//是否显示工具栏
type
:
Boolean
,
default
:
true
,
},
easy
:
{
//是否显示简单搜索
type
:
Boolean
,
default
:
true
,
},
high
:
{
//是否显示高级搜索
type
:
Boolean
,
default
:
true
,
},
draggable
:
{
//是否可以拖拽
type
:
Boolean
,
default
:
false
,
},
set
:
{
//是否显示列设置
type
:
Boolean
,
default
:
true
,
},
page
:
{
//是否分页
type
:
Boolean
,
default
:
true
,
},
data
:
{
// 当作table使用,直接显示数据
type
:
Array
,
default
:
function
()
{
return
[];
},
},
columns
:
{
//要显示的字段
type
:
Array
,
default
:
[],
},
action
:
{
//接口地址
type
:
String
,
default
:
""
,
},
conditions
:
{
//查询条件
type
:
Object
,
default
:
function
()
{
name
:
"DataGrid"
,
data
()
{
return
{
keys
:
{
op
:
"name"
,
value
:
""
,
default
:
true
},
keys
:
""
,
selectItems
:
[],
footerToolbar
:
false
,
modalSearch
:
false
,
search
:
{
pageIndex
:
1
,
pageSize
:
20
,
conditions
:
[],
},
searchConditions
:
this
.
search
,
pageSizeOpts
:
[
20
,
50
,
100
],
tableHeight
:
0
,
firstY
:
0
,
config
:
false
,
list
:
[],
columnsCur
:
[],
configLoad
:
false
,
userConfig
:
null
,
//用户页面配置信息。,
// userId: 1
userId
:
this
.
$store
.
state
.
userInfo
.
userId
,
treeData
:
[],
//物料数据
codeRuleData
:
[],
//物料编码
routingHeaderData
:
[],
//工艺规程
};
},
},
type
:
{
type
:
String
,
default
:
"table"
,
validator
:
function
(
value
)
{
// 这个值必须匹配下列字符串中的一个
return
[
"table"
,
"card"
,
"list"
].
indexOf
(
value
)
!==
-
1
;
},
},
span
:
{
type
:
Number
,
default
:
24
,
},
},
created
()
{
this
.
columns
.
forEach
((
u
)
=>
{
if
(
!
u
.
hide
)
{
u
.
hide
=
false
;
}
});
this
.
columnsCur
=
this
.
$u
.
clone
(
this
.
columns
);
},
mounted
()
{
if
(
this
.
data
&&
this
.
data
.
length
>
0
)
{
this
.
list
=
this
.
data
;
return
;
}
this
.
keys
=
""
;
this
.
intY
();
if
(
this
.
lazy
==
true
)
{
return
;
}
if
(
this
.
set
==
true
)
{
this
.
loadUserConfig
();
}
// else
// {
// this.columnsCur = this.$u.clone(this.columns);
// }
if
(
this
.
height
===
0
)
{
window
.
onresize
=
()
=>
{
///浏览器窗口大小变化
return
(()
=>
{
window
.
screenHeight
=
window
.
innerHeight
;
this
.
tableHeight
=
window
.
screenHeight
-
this
.
firstY
-
60
;
})();
};
}
else
{
this
.
tableHeight
=
this
.
height
;
}
//注册拖拽事件。
this
.
$dragging
.
$on
(
"dragend"
,
(
e
)
=>
{
// console.log("dragend",e);
this
.
saveUserconfig
();
});
},
methods
:
{
//数据加载
load
()
{
if
(
this
.
height
==
0
)
{
this
.
tableHeight
=
window
.
innerHeight
-
this
.
firstY
-
60
;
}
if
(
this
.
action
)
{
this
.
$api
.
post
(
this
.
action
,
this
.
search
).
then
((
r
)
=>
{
this
.
list
=
r
.
result
.
items
;
this
.
search
.
total
=
r
.
result
.
totalCount
;
props
:
{
border
:
{
//是否显示边框
type
:
Boolean
,
default
:
true
,
},
batch
:
{
//是否批量操作
type
:
Boolean
,
default
:
true
,
},
format
:
{
type
:
Function
,
default
:
null
,
},
initsearch
:
{
type
:
Function
,
default
:
null
,
},
lazy
:
{
//懒加载设置,设置为真时候,默认不加载数据。
type
:
Boolean
,
default
:
false
,
},
placeholder
:
{
type
:
String
,
default
:
"请输入关键字"
,
},
height
:
{
type
:
Number
,
default
:
0
,
},
tool
:
{
//是否显示工具栏
type
:
Boolean
,
default
:
true
,
},
easy
:
{
//是否显示简单搜索
type
:
Boolean
,
default
:
true
,
},
high
:
{
//是否显示高级搜索
type
:
Boolean
,
default
:
true
,
},
draggable
:
{
//是否可以拖拽
type
:
Boolean
,
default
:
false
,
},
set
:
{
//是否显示列设置
type
:
Boolean
,
default
:
true
,
},
page
:
{
//是否分页
type
:
Boolean
,
default
:
true
,
},
data
:
{
// 当作table使用,直接显示数据
type
:
Array
,
default
:
function
()
{
return
[];
},
},
columns
:
{
//要显示的字段
type
:
Array
,
default
:
[],
},
action
:
{
//接口地址
type
:
String
,
default
:
""
,
},
conditions
:
{
//查询条件
type
:
Object
,
default
:
function
()
{
return
{
keys
:
{
op
:
"name"
,
value
:
""
,
default
:
true
,
},
};
},
},
type
:
{
type
:
String
,
default
:
"table"
,
validator
:
function
(
value
)
{
// 这个值必须匹配下列字符串中的一个
return
[
"table"
,
"card"
,
"list"
].
indexOf
(
value
)
!==
-
1
;
},
},
span
:
{
//栅格数
type
:
Number
,
default
:
24
,
},
//table控件children子数据控制功能
rowKey
:
{
type
:
[
String
,
Number
],
},
gutter
:
{
//间距
type
:
Number
,
default
:
40
,
},
exportTitle
:
{
type
:
String
,
default
:
""
,
},
},
created
()
{
this
.
columns
.
forEach
((
u
)
=>
{
if
(
!
u
.
hide
)
{
u
.
hide
=
false
;
}
});
}
this
.
columnsCur
=
this
.
$u
.
clone
(
this
.
columns
);
},
columnInit
()
{
if
(
this
.
userConfig
)
{
var
curColumns
=
[];
var
config
=
JSON
.
parse
(
this
.
userConfig
.
content
);
// console.warn("2:列比对",config)
if
(
config
.
length
==
this
.
columnsCur
.
length
)
{
config
.
map
((
u
)
=>
{
var
item
=
this
.
columnsCur
.
filter
((
c
)
=>
{
return
c
.
key
==
u
.
key
;
});
if
(
item
[
0
])
{
item
[
0
].
hide
=
u
.
hide
;
curColumns
.
push
(
item
[
0
]);
}
});
// console.warn("3:初始化列")
this
.
columnsCur
=
curColumns
;
mounted
()
{
if
(
this
.
data
&&
this
.
data
.
length
>
0
)
{
this
.
list
=
this
.
data
;
return
;
}
}
},
loadUserConfig
()
{
var
query
=
{
conditions
:
[
{
fieldName
:
"creatorUserId"
,
fieldValue
:
this
.
userId
,
conditionalType
:
"Equal"
,
},
{
fieldName
:
"component"
,
fieldValue
:
"Grid"
,
conditionalType
:
"Equal"
,
},
{
fieldName
:
"page"
,
fieldValue
:
window
.
location
.
pathname
,
conditionalType
:
"Equal"
,
},
],
pageSize
:
1
,
};
this
.
$api
.
post
(
`
${
window
.
systemUrl
}
/config/list`
,
query
).
then
((
r
)
=>
{
if
(
r
.
success
)
{
if
(
r
.
result
.
length
==
1
)
{
this
.
userConfig
=
r
.
result
[
0
];
// console.warn("1:加载用户配置")
this
.
columnInit
();
}
if
(
!
this
.
configLoad
)
{
this
.
keys
=
""
;
this
.
intY
();
if
(
this
.
lazy
==
true
)
{
return
;
}
if
(
this
.
userId
>
0
&&
this
.
set
)
{
this
.
loadUserConfig
();
}
else
{
this
.
easySearch
();
}
this
.
configLoad
=
true
;
}
});
},
saveUserconfig
()
{
let
url
=
`
${
window
.
systemUrl
}
/config/update`
;
var
content
=
[];
this
.
columnsCur
.
map
((
u
)
=>
{
content
.
push
({
key
:
u
.
key
,
hide
:
u
.
hide
,
});
});
if
(
!
this
.
userConfig
)
{
url
=
`
${
window
.
systemUrl
}
/config/create`
;
var
data
=
{
page
:
window
.
location
.
pathname
,
component
:
"Grid"
,
key
:
this
.
$u
.
guid
(),
content
:
JSON
.
stringify
(
content
),
};
this
.
$api
.
post
(
url
,
data
).
then
((
r
)
=>
{
this
.
loadUserConfig
();
if
(
this
.
height
===
0
)
{
this
.
$nextTick
(()
=>
{
this
.
tableHeight
=
this
.
$refs
.
main
.
offsetHeight
;
if
(
this
.
tableHeight
<
300
)
{
this
.
tableHeight
=
window
.
screen
.
availHeight
-
this
.
$refs
.
main
.
offsetTop
-
200
;
}
window
.
onresize
=
()
=>
{
///浏览器窗口大小变化
return
(()
=>
{
if
(
this
.
$refs
.
main
&&
this
.
$refs
.
main
.
offsetHeight
)
{
this
.
tableHeight
=
this
.
$refs
.
main
.
offsetHeight
;
if
(
this
.
tableHeight
<
300
)
{
this
.
tableHeight
=
window
.
screen
.
availHeight
-
this
.
$refs
.
main
.
offsetTop
-
150
;
}
}
})();
};
});
}
else
{
this
.
tableHeight
=
this
.
height
;
}
//注册拖拽事件。
this
.
$dragging
.
$on
(
"dragend"
,
(
e
)
=>
{
this
.
saveUserconfig
();
});
}
else
{
this
.
userConfig
.
content
=
JSON
.
stringify
(
content
);
this
.
$api
.
post
(
url
,
this
.
userConfig
);
}
},
//展开
expand
(
row
,
status
)
{
this
.
$emit
(
"on-expand"
,
row
,
status
);
},
//拖拽
onDragDrop
(
a
,
b
)
{
this
.
$emit
(
"on-drag-drop"
,
a
,
b
);
},
easySearch
()
{
if
(
this
.
conditions
&&
this
.
conditions
.
keys
.
default
)
{
//判断没有传入条件的用默认的查询
this
.
conditions
.
keys
.
value
=
this
.
keys
;
}
this
.
reload
(
this
.
conditions
);
},
undoConfig
()
{
//列设置恢复初始化
this
.
columnsCur
=
this
.
$u
.
clone
(
this
.
columns
);
this
.
saveUserconfig
();
},
complexSearch
()
{
var
search
=
this
.
$refs
.
search
.
$children
.
filter
((
u
)
=>
{
return
u
.
condition
;
});
if
(
search
)
{
var
conditions
=
search
[
0
].
condition
;
this
.
reload
(
conditions
);
}
},
reload
(
conditions
)
{
var
where
=
[];
if
(
conditions
)
{
Object
.
keys
(
conditions
).
forEach
((
u
)
=>
{
let
v
=
conditions
[
u
].
value
;
let
op
=
conditions
[
u
].
op
;
if
(
!
this
.
$u
.
isNull
(
v
))
{
if
(
op
==
"Range"
)
{
let
times
=
[];
v
.
map
((
u
)
=>
{
if
(
!
this
.
$u
.
isNull
(
u
))
{
times
.
push
(
this
.
$u
.
toTime
(
u
));
//物料加载类型数据
//this.getTreeData();
//this.getcodeRuleData();
//this.getRoutingHeaderData();
},
methods
:
{
//数据加载
load
()
{
if
(
this
.
action
)
{
//条件初始化处理。
if
(
this
.
initsearch
)
{
this
.
initsearch
(
this
.
search
);
}
});
v
=
times
.
join
(
","
);
}
else
if
(
op
.
indexOf
(
"In"
)
>
-
1
)
{
v
=
v
.
join
(
","
);
}
if
(
!
this
.
$u
.
isNull
(
v
))
{
where
.
push
({
fieldName
:
u
,
fieldValue
:
v
,
conditionalType
:
op
,
});
this
.
$api
.
post
(
this
.
action
,
this
.
search
).
then
((
r
)
=>
{
if
(
this
.
format
)
{
this
.
list
=
this
.
format
(
r
.
result
.
items
);
}
else
{
this
.
list
=
r
.
result
.
items
;
}
this
.
search
.
total
=
r
.
result
.
totalCount
||
r
.
result
.
count
;
});
}
}
});
}
this
.
search
.
pageIndex
=
1
;
this
.
search
.
conditions
=
where
;
this
.
load
();
},
pageChange
(
page
)
{
this
.
search
.
page
=
page
;
this
.
search
.
pageIndex
=
page
;
this
.
load
();
},
pageSizeChange
(
size
)
{
this
.
search
.
pageSize
=
size
;
this
.
search
.
pageIndex
=
1
;
this
.
load
();
},
columnChange
(
item
,
i
)
{
item
.
hide
=
!
item
.
hide
;
this
.
$set
(
this
.
columnsCur
,
item
,
i
);
this
.
saveUserconfig
();
},
selectionChange
(
items
)
{
this
.
$emit
(
"on-selection-change"
,
items
);
this
.
selectItems
=
items
;
this
.
footerToolbar
=
items
.
length
>
0
;
},
onSelect
(
rows
,
row
)
{
this
.
$emit
(
"on-selection-change"
,
rows
,
row
);
},
intY
()
{
if
(
this
.
$refs
.
table
!=
undefined
)
{
this
.
firstY
=
this
.
$refs
.
table
.
$el
.
getBoundingClientRect
().
top
;
}
},
selectAll
(
status
)
{
this
.
$refs
.
table
.
selectAll
(
status
);
},
},
computed
:
{
columnsNow
()
{
var
cols
=
this
.
columnsCur
.
filter
((
u
)
=>
{
if
(
u
.
code
)
{
u
.
render
=
(
h
,
params
)
=>
{
let
values
=
u
.
key
;
let
type
=
"text"
;
if
(
u
.
category
)
{
type
=
u
.
category
;
},
columnInit
()
{
if
(
this
.
userConfig
)
{
var
curColumns
=
[];
var
config
=
JSON
.
parse
(
this
.
userConfig
.
content
);
if
(
config
.
length
==
this
.
columnsCur
.
length
)
{
config
.
map
((
u
)
=>
{
var
item
=
this
.
columnsCur
.
filter
((
c
)
=>
{
return
c
.
key
==
u
.
key
;
});
if
(
item
[
0
])
{
item
[
0
].
hide
=
u
.
hide
;
curColumns
.
push
(
item
[
0
]);
}
});
this
.
columnsCur
=
curColumns
;
}
}
return
h
(
"state"
,
{
props
:
{
code
:
u
.
code
,
type
:
type
,
value
:
params
.
row
[
values
]
+
""
,
},
},
loadUserConfig
()
{
var
query
=
{
conditions
:
[{
fieldName
:
"creatorUserId"
,
fieldValue
:
this
.
userId
,
conditionalType
:
"Equal"
,
},
{
fieldName
:
"component"
,
fieldValue
:
"Grid"
,
conditionalType
:
"Equal"
,
},
{
fieldName
:
"page"
,
fieldValue
:
window
.
location
.
pathname
,
conditionalType
:
"Equal"
,
},
],
pageSize
:
1
,
};
this
.
$api
.
post
(
`
${
window
.
systemUrl
}
/config/list`
,
query
).
then
((
r
)
=>
{
if
(
r
.
success
)
{
if
(
r
.
result
.
length
==
1
)
{
this
.
userConfig
=
r
.
result
[
0
];
this
.
columnInit
();
}
if
(
!
this
.
configLoad
)
{
this
.
easySearch
();
}
this
.
configLoad
=
true
;
}
});
};
}
if
(
u
.
type
==
"user"
)
{
u
.
render
=
(
h
,
params
)
=>
{
let
values
=
u
.
key
;
return
h
(
"User"
,
{
props
:
{
value
:
params
.
row
[
values
]
,
},
},
saveUserconfig
()
{
let
url
=
`
${
window
.
systemUrl
}
/config/update`
;
var
content
=
[];
this
.
columnsCur
.
map
((
u
)
=>
{
content
.
push
(
{
key
:
u
.
key
,
hide
:
u
.
hide
,
});
});
};
}
if
(
u
.
type
==
"date"
||
u
.
type
==
"dateTime"
)
{
u
.
render
=
(
h
,
params
)
=>
{
let
values
=
u
.
key
;
return
h
(
"DTSpan"
,
{
props
:
{
type
:
u
.
type
,
value
:
params
.
row
[
values
],
},
if
(
!
this
.
userConfig
)
{
url
=
`
${
window
.
systemUrl
}
/config/create`
;
var
data
=
{
page
:
window
.
location
.
pathname
,
component
:
"Grid"
,
key
:
this
.
$u
.
guid
(),
content
:
JSON
.
stringify
(
content
),
};
this
.
$api
.
post
(
url
,
data
).
then
((
r
)
=>
{
this
.
loadUserConfig
();
});
}
else
{
this
.
userConfig
.
content
=
JSON
.
stringify
(
content
);
this
.
$api
.
post
(
url
,
this
.
userConfig
);
}
},
//展开
expand
(
row
,
status
)
{
this
.
$emit
(
"on-expand"
,
row
,
status
);
},
//拖拽
onDragDrop
(
a
,
b
)
{
this
.
$emit
(
"on-drag-drop"
,
a
,
b
);
},
easySearch
()
{
if
(
this
.
conditions
&&
this
.
conditions
.
keys
&&
this
.
conditions
.
keys
.
default
)
{
//判断没有传入条件的用默认的查询
this
.
conditions
.
keys
.
value
=
this
.
keys
;
}
this
.
reload
(
this
.
conditions
);
},
undoConfig
()
{
//列设置恢复初始化
this
.
columnsCur
=
this
.
$u
.
clone
(
this
.
columns
);
this
.
saveUserconfig
();
},
complexSearch
()
{
var
search
=
this
.
$refs
.
search
.
$children
.
filter
((
u
)
=>
{
return
u
.
condition
;
});
};
}
return
!
u
.
hide
;
});
return
cols
;
},
},
watch
:
{
"data.length"
()
{
this
.
list
=
this
.
data
;
if
(
search
)
{
var
conditions
=
search
[
0
].
condition
;
this
.
reload
(
conditions
);
}
},
reload
(
conditions
)
{
var
where
=
[];
this
.
searchConditions
=
conditions
;
if
(
conditions
)
{
Object
.
keys
(
conditions
).
forEach
((
u
)
=>
{
let
v
=
conditions
[
u
].
value
;
let
op
=
conditions
[
u
].
op
;
if
(
!
this
.
$u
.
isNull
(
v
))
{
if
(
op
==
"Range"
&&
Array
.
isArray
(
v
))
{
let
times
=
[];
v
.
map
((
u
)
=>
{
if
(
!
this
.
$u
.
isNull
(
u
))
{
times
.
push
(
this
.
$u
.
toTime
(
u
));
}
});
v
=
times
.
join
(
","
);
}
else
if
(
op
.
indexOf
(
"In"
)
>
-
1
&&
Array
.
isArray
(
v
))
{
v
=
v
.
join
(
","
);
}
if
(
!
this
.
$u
.
isNull
(
v
))
{
where
.
push
({
fieldName
:
u
,
fieldValue
:
v
,
conditionalType
:
op
,
});
}
}
});
}
this
.
search
.
pageIndex
=
1
;
this
.
search
.
conditions
=
where
;
this
.
load
();
},
pageChange
(
page
)
{
this
.
search
.
page
=
page
;
this
.
search
.
pageIndex
=
page
;
this
.
load
();
},
pageSizeChange
(
size
)
{
this
.
search
.
pageSize
=
size
;
this
.
search
.
pageIndex
=
1
;
this
.
load
();
},
columnChange
(
item
,
i
)
{
item
.
hide
=
!
item
.
hide
;
this
.
$set
(
this
.
columnsCur
,
item
,
i
);
this
.
saveUserconfig
();
},
selectionChange
(
items
)
{
this
.
$emit
(
"on-selection-change"
,
items
);
this
.
selectItems
=
items
;
this
.
footerToolbar
=
items
.
length
>
0
;
},
onSelect
(
rows
,
row
)
{
this
.
$emit
(
"on-change"
,
rows
,
row
);
},
allChange
(
items
)
{
this
.
$emit
(
"all-change"
,
items
);
},
intY
()
{
if
(
this
.
$refs
.
table
!=
undefined
)
{
this
.
firstY
=
this
.
$refs
.
table
.
$el
.
getBoundingClientRect
().
top
;
}
},
selectAll
(
status
)
{
this
.
$refs
.
table
.
selectAll
(
status
);
},
//批量取消
cancelBatch
()
{
this
.
footerToolbar
=
false
;
this
.
$refs
.
table
.
selectAll
(
false
);
},
//导出excel
export2Excel
()
{
//当前显示数据
var
where
=
[];
var
conditions
=
this
.
searchConditions
;
if
(
conditions
)
{
Object
.
keys
(
conditions
).
forEach
((
u
)
=>
{
let
v
=
conditions
[
u
].
value
;
let
op
=
conditions
[
u
].
op
;
if
(
!
this
.
$u
.
isNull
(
v
))
{
if
(
op
==
"Range"
)
{
let
times
=
[];
v
.
map
((
u
)
=>
{
if
(
!
this
.
$u
.
isNull
(
u
))
{
times
.
push
(
this
.
$u
.
toTime
(
u
));
}
});
v
=
times
.
join
(
","
);
}
else
if
(
op
.
indexOf
(
"In"
)
>
-
1
&&
Array
.
isArray
(
v
))
{
v
=
v
.
join
(
","
);
}
if
(
!
this
.
$u
.
isNull
(
v
))
{
where
.
push
({
fieldName
:
u
,
fieldValue
:
v
,
conditionalType
:
op
,
});
}
}
});
}
let
searchs
=
{
pageIndex
:
1
,
conditions
:
where
,
pageSize
:
1000
,
};
this
.
$api
.
post
(
this
.
action
,
searchs
).
then
((
r
)
=>
{
let
list
=
[];
list
=
r
.
result
.
items
;
const
tHeader
=
[];
// 设置Excel的表格第一行的标题
const
filterVal
=
[];
//list里对象的属性
var
tempCol
=
[];
var
columnsCur
=
this
.
$u
.
clone
(
this
.
columnsCur
);
//导出列标题信息griddata this.$refs.grid.columnsCur
columnsCur
.
forEach
((
el
)
=>
{
if
(
(
el
.
hide
&&
el
.
import
)
||
(
!
el
.
hide
&&
el
.
key
!=
"action"
&&
el
.
type
!=
"selection"
&&
el
.
key
!=
"ico"
)
)
{
if
(
el
.
code
)
{
tempCol
.
push
({
key
:
el
.
key
,
code
:
el
.
code
,
});
//临时存放code数据字典的字段及对应的数据字典code
}
tHeader
.
push
(
el
.
title
);
filterVal
.
push
(
el
.
key
);
}
});
list
.
forEach
((
e
)
=>
{
//给导出数据增加数据字典对应的name
tempCol
.
forEach
((
ele
)
=>
{
e
[
ele
.
key
]
=
this
.
$u
.
dirName
(
this
.
$store
.
getters
.
dictionaryByKey
(
ele
.
code
),
e
[
ele
.
key
]
);
});
});
let
nowDate
=
this
.
$u
.
getNowTime
();
//年月日时分秒yyyyMMddhhmmss
//获取导出数据结束
this
.
$u
.
outExcel
(
this
.
exportTitle
+
"("
+
nowDate
+
")"
,
tHeader
,
filterVal
,
list
);
});
},
},
height
()
{
this
.
tableHeight
=
this
.
height
;
computed
:
{
columnsNow
()
{
var
cols
=
this
.
columnsCur
.
filter
((
u
)
=>
{
if
(
u
.
code
)
{
u
.
render
=
(
h
,
params
)
=>
{
let
values
=
u
.
key
;
let
type
=
"text"
;
if
(
u
.
category
)
{
type
=
u
.
category
;
}
return
h
(
"state"
,
{
props
:
{
code
:
u
.
code
,
type
:
type
,
value
:
params
.
row
[
values
]
+
""
,
},
});
};
}
if
(
u
.
type
==
"user"
)
{
u
.
render
=
(
h
,
params
)
=>
{
let
values
=
u
.
key
;
if
(
params
.
row
[
values
])
{
return
h
(
"User"
,
{
props
:
{
value
:
params
.
row
[
values
],
},
});
}
};
}
if
(
u
.
type
==
"workShopName"
)
{
u
.
render
=
(
h
,
params
)
=>
{
let
values
=
u
.
key
;
if
(
params
.
row
[
values
])
{
return
h
(
"WorkShopName"
,
{
props
:
{
value
:
params
.
row
[
values
],
},
});
}
};
}
if
(
u
.
type
==
"date"
||
u
.
type
==
"dateTime"
)
{
u
.
render
=
(
h
,
params
)
=>
{
let
values
=
u
.
key
;
return
h
(
"DTSpan"
,
{
props
:
{
type
:
u
.
type
,
value
:
params
.
row
[
values
],
},
});
};
}
return
!
u
.
hide
;
});
return
cols
;
},
},
watch
:
{
data
()
{
this
.
list
=
this
.
data
;
},
height
()
{
this
.
tableHeight
=
this
.
height
;
},
columns
()
{
this
.
columns
.
forEach
((
u
)
=>
{
if
(
!
u
.
hide
)
{
u
.
hide
=
false
;
}
});
this
.
columnsCur
=
this
.
$u
.
clone
(
this
.
columns
);
},
},
},
};
</
script
>
<
style
lang=
"less"
scoped
>
<
style
lang=
"less"
>
.table-content {
position: relative;
// height: 100%;
.tableCommon {
width: 100%;
}
.tip {
display: inline;
}
.tableCommon tr th {
line-height: 30px;
font-size: 14px;
background: #f5f6fa;
}
position: relative;
height: 100%;
display: flex;
flex-direction: column;
.tip {
display: inline;
}
.tableCommon tr td {
line-height: 25px;
font-size: 14px;
padding: 0 2px;
}
form {
display: inline-block;
.tableCommon tr td .ivu-table-cell {
padding: 0 5px;
}
.table-card {
width: 100%;
text-align: left;
padding: 0;
display: block;
overflow-y: auto;
}
.table-tools {
.table-search {
float: left;
line-height: 40px;
.ivu-form-item {
margin: 0;
vertical-align: middle;
}
}
.btns {
float: right;
line-height: 40px;
.table-main {
width: 100%;
text-align: left;
padding: 0;
display: block;
overflow-y: auto;
flex-grow: 1;
tr td .ivu-table-cell {
padding: 0 5px;
}
overflow-x: hidden;
}
}
.table-set {
cursor: pointer;
}
.table-set:hover {
color: orange;
}
// .table-footer {
// line-height: 40px;
// }
}
.table-columns {
max-height: calc(100% - 50px);
overflow: auto;
li {
list-style: none;
line-height: 40px;
cursor: move;
border-bottom: 1px dotted #249e91;
color: #249e91;
span {
cursor: pointer;
.table-tools {
display: flex;
line-height: 50px;
//background: @right-header-bg;
.table-search {
flex-grow: 1;
}
.btns {
min-width: 200px;
text-align: right;
}
}
.mr10 {
cursor: pointer;
.table-footer {
line-height: 45px;
}
.move {
float: right;
margin: 10px 10px 0 0;
cursor: move;
.ivu-footer-toolbar {
text-align: left;
background: rgba(0, 0, 0, 0.7);
color: #fff;
}
.dis {
color: #aaa;
}
.table-columns {
max-height: calc(100% - 50px);
overflow: auto;
li {
list-style: none;
line-height: 40px;
cursor: move;
border-bottom: 1px dotted #249e91;
color: #249e91;
span {
cursor: pointer;
}
.mr10 {
cursor: pointer;
}
.move {
float: right;
margin: 10px 10px 0 0;
cursor: move;
}
.dis {
color: #aaa;
}
}
}
}
.searchBack {
display: inline;
margin-left: 20px;
button {
margin-left: 10px;
}
a {
display: inline;
margin-left: 20px;
color: #2680eb;
}
a:hover {
color: #249e91;
}
button {
margin-left: 10px;
}
a {
margin-left: 20px;
color: #2680eb;
}
a:hover {
color: #249e91;
}
}
</
style
>
\ No newline at end of file
</
style
>
components/page/import/process.vue
View file @
d87fcd76
...
...
@@ -152,12 +152,23 @@ export default {
//重新处理colum
loadColum
(
columns
)
{
let
tempCol
=
this
.
$u
.
clone
(
columns
);
let
doCol
=
[]
tempCol
.
forEach
((
ele
,
index
)
=>
{
if
(
ele
.
key
==
"action"
||
ele
.
type
==
"selection"
||
ele
.
key
==
"ico"
)
{
ele
.
hide
=
true
;
}
if
(
ele
.
import
)
{
ele
.
hide
=
false
}
let
temColObj
=
{
key
:
ele
.
key
,
title
:
ele
.
title
,
align
:
ele
.
align
?
ele
.
align
:
'left'
,
hide
:
ele
.
hide
?
ele
.
hide
:
false
,
}
doCol
.
push
(
temColObj
)
});
this
.
colsIm
=
temp
Col
;
this
.
colsIm
=
do
Col
;
this
.
colsIm
.
unshift
({
type
:
'index'
,
width
:
80
,
...
...
@@ -350,6 +361,9 @@ export default {
let
imData
=
[];
let
imDataError
=
[]
this
.
dataIm
.
forEach
(
ele
=>
{
if
(
ele
.
parent_Id
&&
ele
.
parentTitle
)
{
//部门管理导入暂时处置
ele
.
parent_Id
=
null
}
if
(
!
ele
.
ico
)
{
imData
.
push
(
ele
)
}
else
{
...
...
i18n/locale/zh-CN.js
View file @
d87fcd76
...
...
@@ -432,6 +432,7 @@ export default {
location
:
'省市县'
,
parent_Id
:
'上级部门'
,
property
:
'属性'
,
parentTitle
:
'上级部门'
},
instance
:
{
id
:
'主键'
,
...
...
libs/henq.js
View file @
d87fcd76
...
...
@@ -164,7 +164,7 @@ henq.getDepartAllName = (list,id) => {
list
.
map
(
u
=>
{
if
(
id
==
u
.
id
)
{
names
=
u
.
name
+
"
-
"
+
names
names
=
u
.
name
+
"
/
"
+
names
if
(
u
.
parent_Id
>
0
)
{
getDepartAllName
(
list
,
u
.
parent_Id
)
}
...
...
pages/basicData/department/index.vue
View file @
d87fcd76
...
...
@@ -71,6 +71,11 @@ export default {
aId
:
0
,
rowData
:
null
,
columns
:
[{
key
:
"name"
,
title
:
this
.
l
(
"name"
),
align
:
"left"
,
},
{
key
:
"parent_Id"
,
title
:
this
.
l
(
"parent_Id"
),
align
:
"left"
,
...
...
@@ -83,11 +88,6 @@ export default {
)
}
},
{
key
:
"name"
,
title
:
this
.
l
(
"name"
),
align
:
"left"
,
},
{
key
:
"code"
,
title
:
this
.
l
(
"code"
),
...
...
@@ -101,7 +101,7 @@ export default {
import
:
true
,
render
:
(
h
,
params
)
=>
{
return
h
(
"span"
,
{},
this
.
getCity
(
params
.
row
.
location
?
params
.
row
.
location
:
0
))
this
.
getCity
Name
(
params
.
row
.
location
?
params
.
row
.
location
:
0
))
}
},
{
...
...
@@ -277,7 +277,7 @@ export default {
})
},
//根据value获取当前cityname
getCity
(
val
)
{
getCity
Name
(
val
)
{
let
cities
=
this
.
$u
.
clone
(
this
.
cityDatas
)
let
label
=
""
;
cities
.
forEach
(
ele
=>
{
...
...
@@ -287,12 +287,32 @@ export default {
})
return
label
},
//根据Id获取上级到本级的部门名称
getCityValue
(
val
)
{
let
cities
=
this
.
$u
.
clone
(
this
.
cityDatas
)
let
value
=
""
;
cities
.
forEach
(
ele
=>
{
if
(
val
==
ele
.
label
)
{
value
=
ele
.
value
}
})
return
value
},
//根据Id获取上级的部门名称
getParentDepart
(
val
)
{
let
departList
=
this
.
$u
.
clone
(
this
.
treeList
)
return
this
.
$u
.
getDepartAllName
(
departList
,
val
)
},
//根据名称获取上级部门的ID
getParentDepartName
(
val
)
{
let
departList
=
this
.
$u
.
clone
(
this
.
treeList
)
let
value
=
null
departList
.
forEach
(
ele
=>
{
if
(
val
==
ele
.
name
)
{
value
=
ele
.
id
}
})
return
value
},
ok
()
{
this
.
init
();
this
.
modal
=
false
;
...
...
@@ -340,7 +360,7 @@ export default {
);
});
tempCol1
.
forEach
((
ele1
)
=>
{
e
[
ele1
.
key
]
=
this
.
getCity
(
e
[
ele1
.
key
]);
e
[
ele1
.
key
]
=
this
.
getCity
Name
(
e
[
ele1
.
key
]);
});
tempCol2
.
forEach
((
ele2
)
=>
{
e
[
ele2
.
key
]
=
this
.
getParentDepart
(
e
[
ele2
.
key
]);
...
...
@@ -374,12 +394,12 @@ export default {
let
tempList
=
[];
tempData
.
forEach
((
ele
)
=>
{
let
obj
=
{
parentTitle
:
ele
.
parent
Title
?
ele
.
parentTitle
:
''
,
parentTitle
:
ele
.
parent
_Id
?
ele
.
parent_Id
:
''
,
name
:
ele
.
name
?
ele
.
name
:
''
,
//部门名称
parent_Id
:
ele
.
parent_Id
?
ele
.
parent_Id
:
0
,
//上级部门 [id]
parent_Id
:
ele
.
parent_Id
?
ele
.
parent_Id
:
''
,
//上级部门 [id]
code
:
ele
.
code
?
ele
.
code
:
''
,
//部门编号
location
:
ele
.
location
?
ele
.
location
:
''
,
//省市县
isProduction
:
1
,
//是否生产班组:1是,0否
location
:
ele
.
location
?
this
.
getCityValue
(
ele
.
location
)
:
''
,
//省市县
isProduction
:
0
,
//是否生产班组:1是,0否
property
:
ele
.
property
?
ele
.
property
:
''
//属性
};
if
(
ele
.
name
&&
ele
.
name
!=
''
)
{
...
...
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