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
c2d9aa73
Commit
c2d9aa73
authored
Nov 02, 2020
by
骆瑛
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
修改数据字典编辑新增重复
parent
cd65df1b
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
120 additions
and
98 deletions
+120
-98
api.js
pages/basicData/dic/api.js
+3
-0
addItem.vue
pages/basicData/dic/components/addItem.vue
+15
-54
edit.vue
pages/basicData/dic/components/edit.vue
+68
-31
index.vue
pages/basicData/dic/index.vue
+34
-13
No files found.
pages/basicData/dic/api.js
View file @
c2d9aa73
...
...
@@ -23,4 +23,7 @@ export default {
getallanditems
()
{
return
api
.
get
(
u
(
'getallanditems'
))
},
list
(
paras
)
{
return
api
.
post
(
u
(
'list'
),
paras
)
},
}
\ No newline at end of file
pages/basicData/dic/components/addItem.vue
View file @
c2d9aa73
...
...
@@ -260,10 +260,12 @@ export default {
},
async
loadDictionary
()
{
let
r
=
await
api
.
getallanditems
();
this
.
dictionaryItems
=
r
.
result
.
filter
((
u
)
=>
{
return
u
.
items
&&
u
.
items
.
length
>
0
;
});
this
.
completeList
=
this
.
dictionaryItems
;
if
(
r
.
result
.
length
>
0
)
{
this
.
dictionaryItems
=
r
.
result
.
filter
((
u
)
=>
{
return
u
.
items
&&
u
.
items
.
length
>
0
;
});
this
.
completeList
=
this
.
dictionaryItems
;
}
},
handleSearch
(
v
)
{
if
(
v
==
""
)
{
...
...
@@ -281,30 +283,17 @@ export default {
},
introduceBtn
()
{
if
(
this
.
dictionaryId
!=
""
)
{
// console.log(this.dictionaryId);
let
p
=
this
.
completeList
.
filter
((
v
)
=>
{
return
v
.
code
==
this
.
dictionaryId
;
});
if
(
p
.
items
&&
p
.
items
.
length
>
0
)
{
p
.
items
.
map
((
u
)
=>
{
if
(
p
[
0
].
items
&&
p
[
0
]
.
items
.
length
>
0
)
{
p
[
0
]
.
items
.
map
((
u
)
=>
{
delete
u
.
id
;
delete
u
.
upId
;
this
.
entity
.
items
.
push
(
u
);
});
this
.
completeValue
=
""
;
}
this
.
completeList
.
map
((
item
,
index
)
=>
{
if
(
item
.
code
==
this
.
dictionaryId
)
{
// this.replceList.push(item);
// item.items.map((element) => {
// this.parentList.push(element);
// });
this
.
completeList
.
splice
(
index
,
1
);
}
// this.parentList.forEach((u) => {
// u.parentCode = this.dictionaryId;
// });
});
// console.log(this.parentList);
}
},
changeName
(
row
,
index
)
{
...
...
@@ -325,32 +314,6 @@ export default {
},
remove
(
row
,
index
)
{
this
.
entity
.
items
.
splice
(
index
,
1
);
// console.log(this.replceList);
// if (this.parentList.length > 0) {
// var nameCode = "";
// this.parentList.map((p) => {
// this.entity.items.map((r, index) => {
// if (p.parentCode != r.code) {
// nameCode = r.code;
// }
// console.log(r);
// });
// });
// }
// this.parentList.map((team, index) => {
// if (team.parentCode == nameCode) {
// this.parentList.splice(index, 1);
// }
// });
// debugger;
// this.replceList.map((k) => {
// if (nameCode == k.code) {
// console.log(k);
// this.completeList.push(k);
// }
// });
// }
// console.log(this.completeList);
},
async
setColor
(
col
,
name
,
i
,
row
)
{
if
(
name
==
"color"
)
{
...
...
@@ -374,14 +337,12 @@ export default {
return
(
flag
=
true
);
}
});
if
(
this
.
entity
.
items
.
length
>=
2
)
{
for
(
let
a
=
0
;
a
<
this
.
entity
.
items
.
length
;
a
++
)
{
for
(
let
b
=
1
;
b
<=
this
.
entity
.
items
.
length
;
b
++
)
{
if
(
this
.
entity
.
items
[
a
].
code
==
this
.
entity
.
items
[
b
].
code
)
{
this
.
$Message
.
error
(
"编码不能重复!"
);
flag
=
true
;
return
;
}
for
(
var
i
=
0
;
i
<
this
.
entity
.
items
.
length
-
1
;
i
++
)
{
for
(
var
j
=
i
+
1
;
j
<
this
.
entity
.
items
.
length
;
j
++
)
{
if
(
this
.
entity
.
items
[
i
].
code
===
this
.
entity
.
items
[
j
].
code
)
{
this
.
$Message
.
error
(
"编码不能重复!"
);
flag
=
true
;
return
;
}
}
}
...
...
pages/basicData/dic/components/edit.vue
View file @
c2d9aa73
...
...
@@ -13,7 +13,14 @@
<Row
class=
"rowTitle100"
>
<FormItem
label=
"名称"
prop=
"name"
>
<Input
v-model=
"entity.name"
>
<ColorPicker
v-model=
"entity.color"
slot=
"prepend"
transfer
size=
"small"
transfer
recommend
/>
<ColorPicker
v-model=
"entity.color"
slot=
"prepend"
transfer
size=
"small"
transfer
recommend
/>
</Input>
</FormItem>
</Row>
...
...
@@ -23,8 +30,8 @@
</FormItem>
</Row>
<Row
class=
"rowTitle100"
>
<FormItem
label=
"图标"
prop=
"icon"
>
<InputIcon
v-model=
"entity.icon"
></InputIcon>
<FormItem
label=
"图标"
prop=
"icon"
>
<InputIcon
v-model=
"entity.icon"
></InputIcon>
</FormItem>
</Row>
<FormItem
label=
"状态"
prop=
"number"
>
...
...
@@ -51,55 +58,85 @@
</Form>
</
template
>
<
script
>
import
api
from
"../api.js"
;
export
default
{
name
:
'Edit'
,
name
:
"Edit"
,
data
()
{
const
changeCode
=
(
rule
,
value
,
callback
)
=>
{
if
(
value
===
""
)
{
callback
(
new
Error
(
"请填写编码"
));
}
else
{
if
(
this
.
entity
.
upId
)
{
let
par
=
{
conditions
:
[
{
fieldName
:
"upId"
,
conditionalType
:
"Equal"
,
fieldValue
:
this
.
entity
.
upId
,
},
{
fieldName
:
"code"
,
conditionalType
:
"Equal"
,
fieldValue
:
this
.
entity
.
code
,
},
],
};
let
flag
=
false
;
api
.
list
(
par
).
then
((
r
)
=>
{
if
(
r
.
result
.
length
>=
1
)
{
callback
(
new
Error
(
"编码不可重复"
));
}
else
{
callback
();
}
});
}
}
};
return
{
entity
:
{
color
:
""
color
:
""
,
},
rules
:
{
name
:
[{
required
:
true
,
message
:
'必填'
,
trigger
:
'blur'
}],
code
:
[{
required
:
true
,
message
:
'必填'
,
trigger
:
'blur'
}]
}
}
name
:
[{
required
:
true
,
message
:
"必填"
,
trigger
:
"blur"
}],
code
:
[{
validator
:
changeCode
,
trigger
:
"blur"
}],
}
,
}
;
},
props
:
{
v
:
Object
v
:
Object
,
},
mounted
(){
this
.
entity
=
this
.
v
if
(
!
this
.
entity
.
color
){
this
.
entity
.
color
=
""
;
}
mounted
()
{
this
.
entity
=
this
.
$u
.
clone
(
this
.
v
);
if
(
!
this
.
entity
.
color
)
{
this
.
entity
.
color
=
""
;
}
},
methods
:
{
handleSubmit
()
{
this
.
$refs
.
form
.
validate
((
v
)
=>
{
if
(
v
)
{
var
url2
=
`
${
systemUrl
}
/Dictionary/createorupdate`
var
url2
=
`
${
systemUrl
}
/Dictionary/createorupdate`
;
this
.
$api
.
post
(
url2
,
{
Dictionary
:
this
.
entity
}).
then
((
r
)
=>
{
if
(
r
.
success
)
{
this
.
$Message
.
success
(
'保存成功'
)
this
.
$emit
(
'on-ok'
)
this
.
$Message
.
success
(
"保存成功"
);
this
.
$emit
(
"on-ok"
);
}
})
})
;
}
})
})
;
},
handleClose
()
{
this
.
$emit
(
'on-close'
)
}
this
.
$emit
(
"on-close"
);
}
,
},
watch
:
{
v
(
v
)
{
this
.
entity
=
this
.
v
if
(
!
this
.
entity
.
color
)
{
this
.
entity
.
color
=
""
;
}
console
.
info
(
this
.
entity
)
}
}
}
// this.entity = this.v;
// if (!this.entity.color)
{
// this.entity.color =
"";
//
}
// console.info(this.entity);
}
,
}
,
}
;
</
script
>
pages/basicData/dic/index.vue
View file @
c2d9aa73
...
...
@@ -358,6 +358,7 @@ export default {
// },
//右键点击事件
contextmenu
:
(
e
,
v
,
a
)
=>
{
debugger
;
e
.
preventDefault
();
this
.
$refs
.
contentMenu
.
$refs
.
reference
=
event
.
target
;
this
.
$refs
.
contentMenu
.
currentVisible
=
!
this
.
$refs
...
...
@@ -549,6 +550,7 @@ export default {
this
.
data
.
pop
();
},
save
()
{
console
.
log
(
this
.
node
);
if
(
this
.
cur
.
name
==
""
)
{
this
.
$Message
.
error
(
"名称不能为空"
);
return
;
...
...
@@ -557,21 +559,40 @@ export default {
this
.
$Message
.
error
(
"值不能为空"
);
return
;
}
for
(
let
a
=
0
;
a
<
this
.
data
.
length
;
a
++
)
{
for
(
let
b
=
1
;
b
<
this
.
data
.
length
;
b
++
)
{
if
(
this
.
data
[
a
].
code
==
this
.
data
[
b
].
code
)
{
this
.
$Message
.
error
(
"编码不能重复"
);
return
;
if
(
this
.
node
)
{
let
par
=
{
conditions
:
[
{
fieldName
:
"upId"
,
conditionalType
:
"Equal"
,
fieldValue
:
this
.
node
.
id
,
},
],
};
let
flag
=
false
;
api
.
list
(
par
).
then
((
r
)
=>
{
console
.
log
(
r
.
result
);
if
(
r
.
result
.
length
>
0
)
{
r
.
result
.
map
((
z
)
=>
{
console
.
log
(
z
.
code
,
this
.
cur
.
code
)
if
(
z
.
code
==
this
.
cur
.
code
)
{
this
.
$Message
.
error
(
"编码不能重复!"
);
flag
=
true
return
;
}
});
if
(
flag
==
false
)
{
api
.
save
(
this
.
cur
).
then
((
r
)
=>
{
if
(
r
.
success
)
{
this
.
$Message
.
success
(
"添加成功"
);
this
.
load
();
}
});
}
}
}
});
}
api
.
save
(
this
.
cur
).
then
((
r
)
=>
{
// console.warn(r);
if
(
r
.
success
)
{
this
.
$Message
.
success
(
"添加成功"
);
this
.
load
();
}
});
},
},
};
...
...
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