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
c8754394
Commit
c8754394
authored
Oct 16, 2020
by
renjintao
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
mesplan
parent
62757512
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
123 additions
and
17 deletions
+123
-17
henq.js
libs/henq.js
+118
-17
index.vue
pages/mesPlan/index.vue
+5
-0
No files found.
libs/henq.js
View file @
c8754394
...
...
@@ -169,38 +169,37 @@ henq.findRoots = (arr1, id) => {
//省市县pacc转为list
henq
.
treeToList1
=
(
tree
)
=>
{
let
list
=
[];
function
treeToList1
(
data
)
{
data
.
map
(
u
=>
{
if
(
u
.
children
&&
u
.
level
!=
1
)
{
if
(
u
.
children
&&
u
.
level
!=
1
)
{
treeToList1
(
u
.
children
,
u
)
}
else
if
(
u
.
children
&&
u
.
level
==
1
)
{
list
=
list
.
concat
(
u
.
children
);
}
else
if
(
u
.
children
&&
u
.
level
==
1
)
{
list
=
list
.
concat
(
u
.
children
);
}
})
}
treeToList1
(
tree
,
null
)
return
list
;
}
//根据departId返出上级所有name
henq
.
getDepartAllName
=
(
list
,
id
)
=>
{
henq
.
getDepartAllName
=
(
list
,
id
)
=>
{
let
names
=
''
;
function
getDepartAllName
(
list
,
id
)
{
function
getDepartAllName
(
list
,
id
)
{
list
.
map
(
u
=>
{
if
(
id
==
u
.
id
)
{
names
=
u
.
name
+
"/"
+
names
if
(
u
.
parent_Id
>
0
)
{
getDepartAllName
(
list
,
u
.
parent_Id
)
if
(
id
==
u
.
id
)
{
names
=
u
.
name
+
"/"
+
names
if
(
u
.
parent_Id
>
0
)
{
getDepartAllName
(
list
,
u
.
parent_Id
)
}
}
}
})
}
getDepartAllName
(
list
,
id
)
return
names
.
slice
(
0
,
names
.
length
-
1
);
getDepartAllName
(
list
,
id
)
return
names
.
slice
(
0
,
names
.
length
-
1
);
}
//导出pdf
henq
.
outPdf
=
(
ele
,
fileName
)
=>
{
...
...
@@ -343,4 +342,106 @@ henq.dirCode = (code, v) => {
}
return
items
}
henq
.
makeRules
=
(
list
,
api
)
=>
{
list
=
[{
columnDescription
:
"测试列1"
,
// 中文名称
dbColumnName
:
"colums1"
,
// 字段名称
dataType
:
"varchar"
,
// 数据库中字段类型
propertyName
:
"colums1"
,
//程序中的字段名称
propertyType
:
"String"
,
// 程序中的字段类型
code
:
""
,
// 数据字典编码
isNullable
:
false
,
// 是否可空
isKey
:
false
,
// 是否主键
unit
:
""
,
// 单位
length
:
50
,
//
decimalDigits
:
0
,
// 精度
link
:
0
,
//外键 表的
defaultValue
:
""
,
// 默认值
control
:
0
,
uniqueness
:
0
,
// 唯一性 0 不限制 1 表内唯一 2 表内某条件下唯一
ruleType
:
""
,
// 邮箱 ,电话,等
},
{
columnDescription
:
"测试列2"
,
// 中文名称
dbColumnName
:
"colums2"
,
// 字段名称
dataType
:
"int32"
,
// 数据库中字段类型
propertyName
:
"colums2"
,
//程序中的字段名称
propertyType
:
"int"
,
// 程序中的字段类型
code
:
"aps.plan.status"
,
// 数据字典编码
isNullable
:
false
,
// 是否可空
isKey
:
false
,
// 是否主键
unit
:
""
,
// 单位
length
:
50
,
//
decimalDigits
:
0
,
// 精度
link
:
0
,
//外键 表的
defaultValue
:
""
,
// 默认值
control
:
0
,
uniqueness
:
0
,
// 唯一性 0 不限制 1 表内唯一 2 表内某条件下唯一
ruleType
:
""
,
// 邮箱 ,电话,等
},
{
columnDescription
:
"测试列3"
,
// 中文名称
dbColumnName
:
"colums3"
,
// 字段名称
dataType
:
"varchar"
,
// 数据库中字段类型
propertyName
:
"colums3"
,
//程序中的字段名称
propertyType
:
"String"
,
// 程序中的字段类型
code
:
""
,
// 数据字典编码
isNullable
:
false
,
// 是否可空
isKey
:
false
,
// 是否主键
unit
:
""
,
// 单位
length
:
50
,
//
decimalDigits
:
0
,
// 精度
link
:
0
,
//外键 表的
defaultValue
:
""
,
// 默认值
control
:
0
,
uniqueness
:
0
,
// 唯一性 0 不限制 1 表内唯一 2 表内某条件下唯一
ruleType
:
"email"
,
// 邮箱 ,电话,等
}
]
let
rules
=
{}
list
.
forEach
(
el
=>
{
if
(
!
el
.
isNullable
)
{
let
objInfo
=
{}
//不能为空,必填文本或数字类型
if
(
el
.
code
==
''
&&
(
el
.
propertyType
==
'String'
||
el
.
propertyType
==
'int'
))
{
objInfo
=
{
required
:
true
,
message
:
el
.
columnDescription
+
"必填"
,
trigger
:
"blur"
}
}
//不能为空,根据数据字典,必选
else
if
(
el
.
code
!=
''
&&
el
.
propertyType
==
'int'
)
{
objInfo
=
{
required
:
true
,
message
:
el
.
columnDescription
+
"必选"
,
trigger
:
"change"
,
type
:
"number"
,
}
}
rules
[
el
.
propertyName
]
=
[]
rules
[
el
.
propertyName
].
push
(
objInfo
)
if
(
el
.
ruleType
==
"email"
)
{
let
valInfoEmail
=
{
validator
:
function
(
rule
,
value
,
callback
)
{
if
(
/^
\w{1,64}
@
[
a-z0-9
\-]{1,256}(\.[
a-z
]{2,6}){1,2}
$/i
.
test
(
value
)
==
false
)
{
callback
(
new
Error
(
"邮箱格式错误"
));
}
else
{
callback
();
}
},
trigger
:
"blur"
}
rules
[
el
.
propertyName
].
push
(
valInfoEmail
)
}
}
})
return
rules
}
export
default
henq
;
pages/mesPlan/index.vue
View file @
c8754394
...
...
@@ -32,6 +32,7 @@
</FormItem>
<FormItem>
<Button
type=
"primary"
@
click=
"search"
>
查询
</Button>
<Button
type=
"primary"
@
click=
"getRules"
v-if=
"false"
>
getRules
</Button>
</FormItem>
</Form>
</
template
>
...
...
@@ -549,6 +550,10 @@ export default {
}
},
methods
:
{
getRules
()
{
let
ruleInfos
=
this
.
$u
.
makeRules
()
alert
(
JSON
.
stringify
(
ruleInfos
))
},
addOk
()
{
this
.
$refs
.
grid
.
load
();
this
.
addModal
=
false
;
...
...
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