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
29349b94
Commit
29349b94
authored
Oct 19, 2020
by
renjintao
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
test
parent
17a01eb8
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
233 additions
and
102 deletions
+233
-102
henq.js
libs/henq.js
+44
-9
add.vue
pages/mesPlan/add.vue
+1
-1
index.vue
pages/mesPlan/index.vue
+0
-6
test.vue
pages/test.vue
+35
-27
test1.vue
pages/test/test1.vue
+91
-0
index.vue
pages/test/view/index.vue
+62
-59
No files found.
libs/henq.js
View file @
29349b94
import
XLSX
from
'xlsx'
;
import
Api
from
'@/plugins/request'
let
henq
=
{};
let
pdfInfo
=
''
henq
.
clone
=
(
obj
)
=>
{
...
...
@@ -416,7 +417,7 @@ henq.makeRules = (list, apiUrl) => {
link
:
0
,
defaultValue
:
""
,
control
:
0
,
uniqueness
:
0
,
uniqueness
:
0
,
ruleType
:
"email"
,
},
{
//唯一性api接口校验
...
...
@@ -434,18 +435,44 @@ henq.makeRules = (list, apiUrl) => {
link
:
0
,
defaultValue
:
""
,
control
:
0
,
uniqueness
:
1
,
//表内唯一验证
uniqueness
:
1
,
//表内唯一验证
ruleType
:
""
,
},
{
//日期校验
columnDescription
:
"测试列6"
,
dbColumnName
:
"colums6"
,
dataType
:
"datetime"
,
propertyName
:
"colums6"
,
propertyType
:
"String"
,
code
:
""
,
isNullable
:
false
,
isKey
:
false
,
unit
:
""
,
length
:
50
,
decimalDigits
:
0
,
link
:
0
,
defaultValue
:
""
,
control
:
0
,
uniqueness
:
0
,
//表内唯一验证
ruleType
:
"datetime"
,
}
]
apiUrl
=
`
${
resourceUrl
}
/mesparttaskplansimulate/ge
t`
apiUrl
=
`
${
systemUrl
}
/user/lis
t`
//测试数据end
//唯一性校验
const
validateCol
=
(
rule
,
value
,
callback
)
=>
{
if
(
!
value
)
{
return
callback
(
new
Error
(
"输入不能为空"
));
}
this
.
$api
.
post
(
apiUrl
,
value
).
then
((
r
)
=>
{
var
params1
=
{
"conditions"
:
[{
"fieldName"
:
"cardNo"
,
"fieldValue"
:
value
,
"conditionalType"
:
"Equal"
}],
"pageSize"
:
3
}
Api
.
post
(
apiUrl
,
params1
).
then
((
r
)
=>
{
if
(
r
.
result
.
length
>
0
)
{
return
callback
(
new
Error
(
"输入数据已经存在"
));
}
else
{
...
...
@@ -467,7 +494,6 @@ henq.makeRules = (list, apiUrl) => {
}
}
let
rules
=
{}
list
.
forEach
(
el
=>
{
if
(
!
el
.
isNullable
)
{
let
objInfo
=
{}
...
...
@@ -479,13 +505,11 @@ henq.makeRules = (list, apiUrl) => {
message
:
"必填"
,
trigger
:
"blur"
}
if
(
el
.
uniqueness
!=
0
)
{
let
objUniqueness
=
{
if
(
el
.
uniqueness
!=
0
)
{
var
objUniqueness
=
{
validator
:
validateCol
,
trigger
:
"blur"
}
rules
[
el
.
propertyName
].
push
(
objUniqueness
)
}
}
else
if
(
el
.
ruleType
==
'email'
)
{
objInfo
=
{
...
...
@@ -501,6 +525,14 @@ henq.makeRules = (list, apiUrl) => {
trigger
:
"blur"
}
}
else
if
(
el
.
ruleType
==
'datetime'
)
{
objInfo
=
{
required
:
true
,
message
:
"请选择时间"
,
trigger
:
"change"
}
}
}
else
{
//数据字典
objInfo
=
{
...
...
@@ -511,6 +543,9 @@ henq.makeRules = (list, apiUrl) => {
}
}
rules
[
el
.
propertyName
].
push
(
objInfo
)
if
(
el
.
uniqueness
!=
0
)
{
rules
[
el
.
propertyName
].
push
(
objUniqueness
)
}
}
})
...
...
pages/mesPlan/add.vue
View file @
29349b94
...
...
@@ -79,7 +79,6 @@
</div>
</
template
>
<
script
>
var
myDate
=
new
Date
();
var
dayTomorrow
=
new
Date
();
...
...
@@ -138,6 +137,7 @@ export default {
trigger
:
"change"
,
},
],
},
wfstatu
:
1
,
};
},
...
...
pages/mesPlan/index.vue
View file @
29349b94
...
...
@@ -32,7 +32,6 @@
</FormItem>
<FormItem>
<Button
type=
"primary"
@
click=
"search"
>
查询
</Button>
<Button
type=
"primary"
@
click=
"getRules"
>
getRules
</Button>
</FormItem>
</Form>
</
template
>
...
...
@@ -550,11 +549,6 @@ export default {
}
},
methods
:
{
getRules
()
{
let
ruleInfos
=
this
.
$u
.
makeRules
()
// console.log(ruleInfos)
//alert(JSON.stringify(ruleInfos))
},
addOk
()
{
this
.
$refs
.
grid
.
load
();
this
.
addModal
=
false
;
...
...
pages/test.vue
View file @
29349b94
<
style
lang=
"less"
>
.test_layout {
height: 100%;
.bg1 {
background: #fefefe;
}
// &.fg {
// // overflow: auto;
// }
height: 100%;
.bg1 {
background: #fefefe;
}
// &.fg {
// // overflow: auto;
// }
}
.layout-copy {
text-align: center;
padding: 10px 0 20px;
color: #9ea7b4;
text-align: center;
padding: 10px 0 20px;
color: #9ea7b4;
}
</
style
>
<
template
>
<div
class=
"flex fd test_layout"
>
<div
class=
"flex fd test_layout"
>
<div>
<Menu
mode=
"horizontal"
theme=
"light"
active-name=
"0"
>
<div
class=
"layout-assistant"
>
<MenuItem
name=
"0"
to=
"/test/example"
>
基础组件
</MenuItem>
<MenuItem
name=
"1"
to=
"/test/user"
>
人员选择
</MenuItem>
<MenuItem
name=
"2"
to=
"/test/com"
>
异步组件
</MenuItem>
<MenuItem
name=
"4"
to=
"/test/resource"
>
资源选择
</MenuItem>
<MenuItem
name=
"3"
to=
"/test/view"
>
详情拖拽排版
</MenuItem>
</div>
</Menu>
<Menu
mode=
"horizontal"
theme=
"light"
active-name=
"0"
>
<div
class=
"layout-assistant"
>
<MenuItem
name=
"0"
to=
"/test/example"
>
基础组件
</MenuItem>
<MenuItem
name=
"1"
to=
"/test/user"
>
人员选择
</MenuItem>
<MenuItem
name=
"2"
to=
"/test/com"
>
异步组件
</MenuItem>
<MenuItem
name=
"4"
to=
"/test/resource"
>
资源选择
</MenuItem>
<MenuItem
name=
"3"
to=
"/test/view"
>
详情拖拽排版
</MenuItem>
<MenuItem
name=
"5"
to=
"/test/test1"
>
colum验证
</MenuItem>
</div>
</Menu>
</div>
<div
class=
"fg"
>
<nuxt-child></nuxt-child>
<nuxt-child></nuxt-child>
</div>
</div>
</div>
</
template
>
<
script
>
export
default
{
layout
:
"empty"
,
async
fetch
({
store
,
params
})
{
await
store
.
dispatch
(
"loadDictionary"
);
// 加载数据字典
}
layout
:
"empty"
,
async
fetch
({
store
,
params
})
{
await
store
.
dispatch
(
"loadDictionary"
);
// 加载数据字典
}
};
</
script
>
\ No newline at end of file
</
script
>
pages/test/test1.vue
0 → 100644
View file @
29349b94
<
template
>
<div
style=
"width:100%;"
>
<Form
:model=
"orderSearchForm"
:label-width=
"120"
:rules=
"ruleValidate"
ref=
"formValidate"
>
<Row>
<Col
span=
"8"
>
<FormItem
label=
"输入校验"
style=
"width:100%"
prop=
"colums1"
>
<Input
v-model=
"orderSearchForm.colums1"
style=
"width:240px"
/>
</FormItem>
</Col>
<Col
span=
"8"
>
<FormItem
label=
"数据字典"
style=
"width:100%"
prop=
"colums2"
>
<dictionary
code=
"plan.order.taskType"
v-model=
"orderSearchForm.colums2"
style=
"width:240px"
></dictionary>
</FormItem>
</Col>
<Col
span=
"8"
>
<FormItem
label=
"电话校验"
style=
"width:100%"
prop=
"colums3"
>
<Input
v-model=
"orderSearchForm.colums3"
style=
"width:240px"
/>
</FormItem>
</Col>
<Col
span=
"8"
>
<FormItem
label=
"email校验"
style=
"width:100%"
prop=
"colums4"
>
<Input
v-model=
"orderSearchForm.colums4"
style=
"width:240px"
/>
</FormItem>
</Col>
<Col
span=
"8"
>
<FormItem
label=
"唯一性校验(用户编号)"
style=
"width:100%"
prop=
"colums5"
>
<Input
v-model=
"orderSearchForm.colums5"
style=
"width:240px"
/>
</FormItem>
</Col>
<Col
span=
"8"
>
<FormItem
label=
"时间校验"
style=
"width:100%"
prop=
"colums6"
>
<DatePicker
v-model=
"orderSearchForm.colums6"
type=
"date"
placeholder=
"请选择日期"
@
on-change=
"getTime"
></DatePicker>
</FormItem>
</Col>
</Row>
<Row>
<Col
span=
"24"
>
<FormItem>
<Button
type=
"primary"
@
click=
"handleSubmit"
v-noClick
>
保存
</Button>
</FormItem>
</Col>
</Row>
</Form>
</div>
</
template
>
<
script
>
export
default
{
layout
:
'empty'
,
name
:
"Test1"
,
data
()
{
return
{
orderSearchForm
:
{
colums6
:
""
},
ruleValidate
:
this
.
$u
.
makeRules
(),
};
},
mounted
()
{
},
methods
:
{
handleSubmit
()
{
this
.
$refs
.
formValidate
.
validate
((
v
)
=>
{
if
(
v
)
{
this
.
$Message
.
success
(
'验证通过'
)
}
});
},
getTime
(
value
)
{
if
(
value
!=
''
)
{
this
.
orderSearchForm
.
colums6
=
this
.
getFormatDateEnd
(
value
);
}
},
getFormatDateEnd
(
dates
)
{
const
d
=
new
Date
(
dates
);
const
resDate
=
d
.
getFullYear
()
+
"-"
+
this
.
p
(
d
.
getMonth
()
+
1
)
+
"-"
+
this
.
p
(
d
.
getDate
())
+
" 23:59:59"
;
return
resDate
;
},
p
(
s
)
{
return
s
<
10
?
"0"
+
s
:
s
;
},
},
};
</
script
>
pages/test/view/index.vue
View file @
29349b94
<
template
>
<div
class=
"flex"
>
<div
class=
"flex"
>
<div
class=
"fg1"
>
<Form
ref=
"form"
:model=
"entity"
:rules=
"rules"
:label-width=
"110"
>
<Row
class=
"view"
>
<Col
:span=
"12"
class=
"item"
v-for=
"(li,i) in items"
:key=
"i"
v-dragging=
"
{ item: li, list: items}">
<FormItem
:label=
"li.key"
:prop=
"li.key"
>
<component
:is=
"li.control"
:value=
"entity[li.key]"
/>
</FormItem>
</Col>
</Row>
<div>
{{
<Form
ref=
"form"
:model=
"entity"
:rules=
"rules"
:label-width=
"110"
>
<Row
class=
"view"
>
<Col
:span=
"12"
class=
"item"
v-for=
"(li,i) in items"
:key=
"i"
v-dragging=
"
{ item: li, list: items}">
<FormItem
:label=
"li.key"
:prop=
"li.key"
>
<component
:is=
"li.control"
:value=
"entity[li.key]"
/>
</FormItem>
</Col>
</Row>
<div>
{{
entity
}}
<Button
type=
"primary"
@
click=
"con"
>
conso
</Button>
</div>
</Form>
<Button
type=
"primary"
@
click=
"con"
>
conso
</Button>
</div>
</Form>
</div>
<div
v-width=
"25"
>
<ul>
...
...
@@ -27,60 +27,63 @@
</li>
</ul>
</div>
</div>
</div>
</
template
>
<
script
>
export
default
{
name
:
""
,
data
()
{
return
{
items
:
[],
entity
:
{},
rules
:
null
};
},
created
()
{
this
.
init
();
},
methods
:
{
con
()
{
console
.
warn
(
"entity"
,
this
.
entity
);
name
:
""
,
data
()
{
return
{
items
:
[],
entity
:
{},
rules
:
null
};
},
created
()
{
this
.
init
();
},
init
()
{
let
items
=
[];
let
controls
=
[
"Input"
,
"InputNumber"
,
"Dictionary"
,
"DatePicker"
];
for
(
let
i
=
0
;
i
<
5
;
i
++
)
{
this
.
entity
[
"I"
+
i
]
=
i
;
items
.
push
({
key
:
"I"
+
i
,
name
:
"Item"
+
i
,
width
:
4
,
control
:
controls
[
i
%
4
],
height
:
1
});
}
this
.
items
=
items
;
methods
:
{
con
()
{
console
.
warn
(
"entity"
,
this
.
entity
);
},
init
()
{
let
items
=
[];
let
controls
=
[
"Input"
,
"InputNumber"
,
"Dictionary"
,
"DatePicker"
];
for
(
let
i
=
0
;
i
<
5
;
i
++
)
{
this
.
entity
[
"I"
+
i
]
=
i
;
items
.
push
({
key
:
"I"
+
i
,
name
:
"Item"
+
i
,
width
:
4
,
control
:
controls
[
i
%
4
],
height
:
1
});
}
this
.
items
=
items
;
}
}
}
};
</
script
>
<
style
lang=
"less"
>
<
style
lang=
"less"
>
@line-height: 40px;
@item-width: 12.5%;
.view {
margin: 30px;
border: 1px solid #ddd;
line-height: @line-height;
background-color: white;
.item {
border-right: 1px solid #ddd;
border-top: 1px solid #ddd;
margin-right: -1px;
margin-top: -1px;
border-bottom: 1px solid #ddd;
text-align: center;
box-sizing: border-box;
}
margin: 30px;
border: 1px solid #ddd;
line-height: @line-height;
background-color: white;
.item {
border-right: 1px solid #ddd;
border-top: 1px solid #ddd;
margin-right: -1px;
margin-top: -1px;
border-bottom: 1px solid #ddd;
text-align: center;
box-sizing: border-box;
}
}
</
style
>
\ No newline at end of file
</
style
>
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