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
87f823a1
Commit
87f823a1
authored
Aug 12, 2020
by
kangzhenfei
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
saas--数据字典
parent
0507bb2a
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
1216 additions
and
8 deletions
+1216
-8
saas.js
menu/saas.js
+25
-1
api.js
pages/basicData/dic/api.js
+37
-0
edit.vue
pages/basicData/dic/components/edit.vue
+93
-0
index.vue
pages/basicData/dic/index.vue
+462
-0
api.js
pages/system/dic/api.js
+37
-0
edit.vue
pages/system/dic/components/edit.vue
+93
-0
index.vue
pages/system/dic/index.vue
+462
-0
api.js
pages/system/host/api.js
+6
-6
config.js
static/config.js
+1
-1
No files found.
menu/saas.js
View file @
87f823a1
...
...
@@ -76,7 +76,7 @@ export default [
"app"
:
"App"
,
"priority"
:
0
,
"id"
:
419
,
"title"
:
"
资源
管理"
,
"title"
:
"
菜单
管理"
,
"expand"
:
true
,
"upId"
:
410
,
"lay"
:
2
,
...
...
@@ -112,6 +112,30 @@ export default [
"closable"
:
true
}
},
{
"name"
:
"system-dic"
,
"type"
:
2
,
"code"
:
""
,
"icon"
:
""
,
"url"
:
"/system/dic"
,
"status"
:
1
,
"description"
:
""
,
"source"
:
0
,
"app"
:
"App"
,
"priority"
:
0
,
"id"
:
412
,
"title"
:
"数据字典"
,
"expand"
:
true
,
"upId"
:
410
,
"lay"
:
2
,
"path"
:
"/system/dic"
,
"header"
:
"home"
,
"meta"
:
{
"auth"
:
false
,
"title"
:
"数据字典"
,
"closable"
:
true
}
},
{
"name"
:
"system-host"
,
"type"
:
2
,
...
...
pages/basicData/dic/api.js
0 → 100644
View file @
87f823a1
import
api
from
'@/plugins/request'
// const u=(path)=>`${systemUrl}/Dictionary/${path}`
const
u
=
(
path
)
=>
`
${
systemNew
}
/dictionary/
${
path
}
`
export
default
{
getChildren
(
id
)
{
return
api
.
get
(
u
(
"getChildren"
),
{
id
})
},
getTree
(){
return
api
.
get
(
u
(
'getTree'
))
},
setColor
(
paras
)
{
return
api
.
post
(
u
(
"setColor"
),
{
Dictionary
:
paras
})
},
setSort
(
paras
)
{
return
api
.
post
(
u
(
"setSort"
),
paras
)
},
save
(
paras
)
{
return
api
.
post
(
u
(
"createOrUpdate"
),
{
Dictionary
:
paras
})
},
// getChildren(id) {
// return api.get(u("GetChildren"), { id })
// },
// getTree(){
// return api.get(u('GetTree'))
// },
// setColor(paras) {
// return api.post(u("SetColor"), {Dictionary:paras})
// },
// setSort(paras) {
// return api.post(u("SetSort"), paras)
// },
// save(paras) {
// return api.post(u("CreateOrUpdate"), {Dictionary:paras})
// },
}
\ No newline at end of file
pages/basicData/dic/components/edit.vue
0 → 100644
View file @
87f823a1
<
template
>
<Form
ref=
"form"
:model=
"entity"
:rules=
"rules"
:label-width=
"100"
>
<Row
class=
"rowTitle100"
>
<FormItem
label=
"类别"
prop=
"typeId"
>
<RadioGroup
v-model=
"entity.typeId"
>
<Radio
:label=
"0"
disabled
>
系统
</Radio>
<Radio
:label=
"1"
disabled
>
分类
</Radio>
<Radio
:label=
"2"
disabled
>
字典
</Radio>
<Radio
:label=
"3"
disabled
>
字典项
</Radio>
</RadioGroup>
</FormItem>
</Row>
<Row
class=
"rowTitle100"
>
<FormItem
label=
"名称"
prop=
"name"
>
<Input
v-model=
"entity.name"
>
<ColorPicker
v-model=
"entity.color"
slot=
"prepend"
transfer
size=
"small"
transfer
recommend
/>
</Input>
</FormItem>
</Row>
<Row
class=
"rowTitle100"
>
<FormItem
label=
"编码"
prop=
"code"
>
<Input
v-model=
"entity.code"
/>
</FormItem>
</Row>
<Row
class=
"rowTitle100"
>
<FormItem
label=
"图标"
prop=
"icon"
>
<InputIcon
v-model=
"entity.icon"
></InputIcon>
</FormItem>
</Row>
<FormItem
label=
"状态"
prop=
"number"
>
<RadioGroup
v-model=
"entity.status"
>
<Radio
:label=
"0"
>
启用
</Radio>
<Radio
:label=
"1"
>
禁用(名称和值可以启用或禁用,但不能删除)
</Radio>
</RadioGroup>
</FormItem>
<FormItem
label=
"锁定"
prop=
"number"
>
<RadioGroup
v-model=
"entity.isStatic"
>
<Radio
:label=
"0"
>
不锁定
</Radio>
<Radio
:label=
"1"
>
锁定(锁定后不可改变名称和值,不能删除)
</Radio>
</RadioGroup>
</FormItem>
<Row
class=
"rowTitle100"
>
<FormItem
label=
"描述"
prop=
"description"
>
<Input
v-model=
"entity.description"
type=
"textarea"
:rows=
"3"
></Input>
</FormItem>
</Row>
<FormItem>
<Button
type=
"primary"
@
click=
"handleSubmit"
>
保存
</Button>
<Button
@
click=
"handleClose"
class=
"ml20"
>
取消
</Button>
</FormItem>
</Form>
</
template
>
<
script
>
export
default
{
name
:
'Edit'
,
data
()
{
return
{
entity
:
this
.
v
,
rules
:
{
name
:
[{
required
:
true
,
message
:
'必填'
,
trigger
:
'blur'
}],
code
:
[{
required
:
true
,
message
:
'必填'
,
trigger
:
'blur'
}]
}
}
},
props
:
{
v
:
Object
},
methods
:
{
handleSubmit
()
{
this
.
$refs
.
form
.
validate
((
v
)
=>
{
if
(
v
)
{
var
url2
=
`
${
systemUrl
}
/Dictionary/createorupdate`
this
.
$api
.
post
(
url2
,
{
Dictionary
:
this
.
entity
}).
then
((
r
)
=>
{
if
(
r
.
success
)
{
this
.
$Message
.
success
(
'保存成功'
)
this
.
$emit
(
'on-ok'
)
}
})
}
})
},
handleClose
()
{
this
.
$emit
(
'on-close'
)
}
},
watch
:
{
v
(
v
)
{
this
.
entity
=
this
.
v
console
.
info
(
this
.
entity
)
}
}
}
</
script
>
pages/basicData/dic/index.vue
0 → 100644
View file @
87f823a1
<
template
>
<Layout
class=
"full"
>
<Sider
hide-trigger
:style=
"
{background: '#fff'}" class="menu" width="240">
<h3
class=
"title"
>
数据字典
<ButtonGroup
class=
"fr"
size=
"small"
>
<Button>
<Icon
:type=
"expand?'md-arrow-dropright':'md-arrow-dropdown'"
size=
"16"
@
click=
"toggle"
title=
"展开/合并"
/>
</Button>
<Button>
<Icon
type=
"md-refresh"
size=
"16"
@
click=
"loadTree"
title=
"刷新"
/>
</Button>
</ButtonGroup>
</h3>
<div>
<Input
v-model
.
trim=
"keys"
search
placeholder=
"请输入客户名称"
clearable
/>
<Tree
:data=
"projectList"
@
on-select-change=
"change"
class=
"tree-i"
:render=
"renderContent"
/>
</div>
</Sider>
<Content
class=
"content"
>
<Tools>
<Breadcrumb
style=
"display:inline-block"
>
<BreadcrumbItem
v-for=
"(li,i) in names"
:key=
"i"
>
{{
li
}}
</BreadcrumbItem>
</Breadcrumb>
<template
slot=
"btns"
>
<span
class=
"mr20"
v-if=
"node.typeId==2"
>
索引:
<a
data-clipboard-action=
"copy"
:data-clipboard-text=
"node.code"
@
click=
"copy"
id=
"code"
class=
"tag-read"
>
{{
node
.
code
}}
</a>
</span>
<Button
type=
"default"
@
click=
"setRoot"
>
返回顶级
</Button>
</
template
>
</Tools>
<div
class=
"auto"
>
<!-- <Dictionary code="system.dictionary.typeId" v-model="code" class="w200"/> {{code}}
<a @click="code='3'">up</a>-->
<Table
border
:columns=
"columns"
:data=
"data"
:draggable=
"edit==-1"
class=
"tableCommon"
@
on-drag-drop=
"onDragDrop"
>
<
template
slot-scope=
"{ row, index }"
slot=
"typeId"
>
<state
code=
"system.dictionary.typeId"
type=
"text"
:value=
"row.typeId"
></state>
</
template
>
<
template
slot-scope=
"{ row, index }"
slot=
"status"
>
<state
code=
"status"
type=
"tag"
:value=
"row.status"
></state>
</
template
>
<
template
slot-scope=
"{ row, index }"
slot=
"isStatic"
>
<state
code=
"isStatic"
type=
"tag"
:value=
"row.isStatic"
></state>
</
template
>
<
template
slot-scope=
"{ row, index }"
slot=
"name"
>
<span
v-if=
"edit!=index"
v-text=
"row.name"
></span>
<Input
v-else
type=
"text"
v-model
.
trim=
"cur.name"
/>
</
template
>
<
template
slot-scope=
"{ row, index }"
slot=
"color"
>
<div
v-if=
"edit!=index"
>
<ColorPicker
:value=
"row.color||''"
transfer
recommend
@
on-change=
"setColor($event,row,index)"
/>
</div>
<div
v-else
>
<ColorPicker
v-model=
"cur.color"
transfer
recommend
/>
</div>
</
template
>
<
template
slot-scope=
"{ row, index }"
slot=
"icon"
>
<div
v-if=
"row.icon"
>
<Icon
:type=
"row.icon"
@
on-change=
"setColor($event,row,index)"
/>
</div>
</
template
>
<
template
slot-scope=
"{ row, index }"
slot=
"code"
>
<span
v-if=
"edit!=index"
v-text=
"row.code"
></span>
<Input
v-else
type=
"text"
v-model
.
trim=
"cur.code"
/>
</
template
>
<
template
slot-scope=
"{ row, index }"
slot=
"action"
>
<div
v-if=
"edit!=index"
class=
"action"
>
<op
class=
"edit"
@
click=
"editRow(row,index)"
>
编辑
</op>
<!--
<op
class=
"remove"
@
click=
"delRow(row,index)"
>
删除
</op>
-->
</div>
<div
class=
"action"
v-else
>
<op
class=
"edit"
@
click=
"save"
>
保存
</op>
<op
class=
"remove"
@
click=
"remove"
>
删除
</op>
</div>
</
template
>
</Table>
<Button
type=
"primary"
:disabled=
"edit!=-1"
long
@
click=
"addNew"
class=
"mt10"
>
添加
</Button>
<Alert
type=
"info"
class=
"mt10"
v-if=
"data.length>1&&edit==-1"
>
提示: 支持拖拽排序,数据未保存时不可拖拽排序。
</Alert>
</div>
<Modal
v-model=
"editModal"
:title=
"editTitle"
footer-hide
>
<Edit
:v=
"editModel"
@
on-close=
"editModal=false"
@
on-ok=
"editOk"
/>
</Modal>
</Content>
</Layout>
</template>
<
script
>
import
Edit
from
"./components/edit"
;
import
api
from
"./api.js"
;
import
Clipboard
from
"clipboard"
;
const
root
=
{
id
:
0
,
typeId
:
-
1
,
title
:
"顶级节点"
,
code
:
""
};
export
default
{
data
()
{
return
{
keys
:
""
,
treeHeight
:
""
,
code
:
"2"
,
expand
:
false
,
editModal
:
false
,
editModel
:
{
color
:
""
},
editTitle
:
"编辑"
,
node
:
root
,
color4
:
""
,
cur
:
null
,
names
:
[
root
.
title
],
types
:
[
"系统"
,
"分类"
,
"字典"
,
"字典项"
],
addName
:
"添加"
,
tree
:
[],
edit
:
-
1
,
data
:
[],
columns
:
[
{
type
:
"index"
,
width
:
60
,
align
:
"center"
},
{
title
:
"类别"
,
key
:
"typeId"
,
width
:
100
,
align
:
"center"
,
slot
:
"typeId"
},
{
title
:
"颜色"
,
key
:
"color"
,
width
:
100
,
align
:
"center"
,
slot
:
"color"
},
{
title
:
"名称"
,
key
:
"name"
,
width
:
150
,
slot
:
"name"
},
{
title
:
"编码"
,
key
:
"code"
,
slot
:
"code"
},
{
title
:
"图标"
,
key
:
"icon"
,
slot
:
"icon"
},
{
title
:
"描述"
,
key
:
"description"
},
{
title
:
"状态"
,
key
:
"status"
,
width
:
100
,
align
:
"center"
,
slot
:
"status"
},
{
title
:
"锁定"
,
key
:
"isStatic"
,
width
:
100
,
align
:
"center"
,
slot
:
"isStatic"
},
{
title
:
"操作"
,
key
:
"action"
,
width
:
160
,
align
:
"center"
,
slot
:
"action"
}
]
};
},
computed
:
{
projectList
()
{
// let items = this.$u.clone(this.tree);
let
result
=
[];
let
items
=
this
.
tree
;
search
(
this
.
keys
,
items
);
function
search
(
keys
,
data
)
{
data
.
map
(
u
=>
{
if
(
keys
.
length
==
u
.
title
)
{
result
.
push
(
u
);
}
else
{
let
code
=
""
;
if
(
u
.
data
&&
u
.
data
.
code
)
{
u
.
data
.
code
.
toLowerCase
();
if
(
keys
)
{
keys
=
keys
.
toLowerCase
();
}
code
=
u
.
data
.
code
+
""
;
}
if
(
u
.
title
.
indexOf
(
keys
)
>
-
1
||
code
.
indexOf
(
keys
)
>
-
1
)
{
result
.
push
(
u
);
}
else
if
(
u
.
children
)
{
search
(
keys
,
u
.
children
);
}
}
});
}
return
result
;
}
},
components
:
{
Edit
},
async
fetch
({
store
,
params
})
{
await
store
.
dispatch
(
"loadDictionary"
);
// 加载数据字典
},
created
()
{
this
.
load
();
this
.
loadTree
();
this
.
treeHeight
=
window
.
innerHeight
-
180
;
},
mounted
()
{
window
.
onresize
=
()
=>
{
///浏览器窗口大小变化
return
(()
=>
{
window
.
screenHeight
=
window
.
innerHeight
;
this
.
treeHeight
=
window
.
screenHeight
-
180
;
})();
};
this
.
load
();
this
.
loadTree
();
},
methods
:
{
renderContent
(
h
,
{
root
,
node
,
data
})
{
return
h
(
"span"
,
[
h
(
"Poptip"
,
{
props
:
{
content
:
data
.
data
.
code
,
trigger
:
"hover"
,
placement
:
"top-start"
},
style
:
{
cursor
:
"pointer"
}
},[
h
(
'span'
,{
},
data
.
title
)
])
],
// data.title
);
},
copy
()
{
var
clipboard
=
new
Clipboard
(
".tag-read"
);
clipboard
.
on
(
"success"
,
e
=>
{
this
.
$Message
.
success
(
"复制成功:"
+
this
.
node
.
code
);
clipboard
.
destroy
();
});
clipboard
.
on
(
"error"
,
e
=>
{
// 不支持复制
console
.
log
(
"该浏览器不支持自动复制"
);
// 释放内存
clipboard
.
destroy
();
});
},
editRow
(
row
,
index
)
{
this
.
editTitle
=
"编辑"
;
this
.
editModal
=
true
;
this
.
editModel
=
row
;
},
toggle
()
{
this
.
expand
=
!
this
.
expand
;
this
.
loadTree
();
},
editOk
()
{
this
.
load
();
this
.
editModal
=
false
;
},
delRow
(
row
,
index
)
{
var
url
=
`
${
systemUrl
}
/Dictionary/Delete?id=
${
row
.
id
}
`
;
this
.
$Modal
.
confirm
({
title
:
"操作确认"
,
content
:
"确定要删除吗?"
,
onOk
:
()
=>
{
this
.
$api
.
delete
(
`
${
url
}
`
)
.
then
(
r
=>
{
if
(
r
.
success
)
{
this
.
$Message
.
success
(
"删除成功"
);
this
.
load
();
}
})
.
catch
(
error
=>
{
this
.
$Message
.
error
(
"删除失败"
);
});
}
});
},
change
(
nodes
,
node
)
{
// console.warn(node,nodes)
this
.
node
=
{
id
:
node
.
id
,
typeId
:
node
.
data
.
typeId
,
title
:
node
.
title
,
code
:
node
.
data
.
code
};
// this.names = [node.title]
let
cur
=
node
;
let
titles
=
[];
while
(
cur
)
{
titles
.
push
(
cur
.
title
);
cur
=
cur
.
parent
;
}
this
.
names
=
titles
.
reverse
();
this
.
load
(
node
.
id
);
},
setRoot
()
{
// this.load(0);
this
.
loadTree
();
this
.
node
=
root
;
},
async
setColor
(
v
,
row
,
i
)
{
let
r
=
await
api
.
setColor
({
id
:
row
.
id
,
color
:
v
});
if
(
r
.
success
)
{
this
.
$Message
.
success
(
"颜色设置成功!"
);
row
.
color
=
v
;
}
else
{
this
.
$Message
.
error
(
"颜色设置失败!"
);
row
.
color
=
""
;
}
},
async
load
()
{
this
.
edit
=
-
1
;
let
r
=
await
api
.
getChildren
(
this
.
node
.
id
);
this
.
data
=
r
.
result
;
},
async
loadTree
()
{
let
r
=
await
api
.
getTree
(
this
.
node
.
id
);
if
(
r
.
success
)
{
let
items
=
r
.
result
;
var
expand
=
this
.
expand
;
setParent
(
null
,
items
);
function
setParent
(
parent
,
items
)
{
items
.
map
(
u
=>
{
u
.
parent
=
parent
;
u
.
expand
=
expand
;
if
(
u
.
children
)
{
setParent
(
u
,
u
.
children
);
}
});
}
this
.
tree
=
items
;
}
},
onDragDrop
(
a
,
b
)
{
this
.
data
.
splice
(
b
,
1
,
...
this
.
data
.
splice
(
a
,
1
,
this
.
data
[
b
]));
let
ids
=
[];
this
.
data
.
map
(
u
=>
{
ids
.
push
(
u
.
id
);
});
if
(
ids
.
length
>
1
)
{
api
.
setSort
({
ids
}).
then
(
r
=>
{
if
(
!
r
.
success
)
{
this
.
$Message
.
error
(
"排序失败"
);
this
.
load
();
}
});
}
},
addNew
()
{
this
.
edit
=
this
.
data
.
length
;
this
.
cur
=
{
upId
:
this
.
node
.
id
,
name
:
""
,
code
:
""
,
color
:
""
,
status
:
0
,
isStatic
:
0
,
typeId
:
this
.
node
.
typeId
+
1
,
priority
:
this
.
edit
};
this
.
data
.
push
(
this
.
cur
);
},
remove
()
{
this
.
edit
=
-
1
;
// this.load(this.node.id)
this
.
data
.
pop
();
},
save
()
{
if
(
this
.
cur
.
name
==
""
)
{
this
.
$Message
.
error
(
"名称不能为空"
);
return
;
}
if
(
this
.
cur
.
code
==
""
)
{
this
.
$Message
.
error
(
"值不能为空"
);
return
;
}
api
.
save
(
this
.
cur
).
then
(
r
=>
{
console
.
warn
(
r
);
if
(
r
.
success
)
{
this
.
$Message
.
success
(
"添加成功"
);
this
.
load
();
}
});
}
}
};
</
script
>
<
style
lang=
"less"
scoped
>
.full {
margin-top: 0;
.tree-i {
height: 78vh;
overflow: auto;
}
}
.ivu-color-picker-confirm {
.ivu-input {
width: 130px;
height: 30px;
float: left;
}
.ivu-btn-small {
height: 30px !important;
}
}
</
style
>
pages/system/dic/api.js
0 → 100644
View file @
87f823a1
import
api
from
'@/plugins/request'
// const u=(path)=>`${systemUrl}/Dictionary/${path}`
const
u
=
(
path
)
=>
`
${
systemNew
}
/api/services/app/dictionary/
${
path
}
`
//49.232.68.61:10130/api/services/app/dictionary/getall
export
default
{
getChildren
(
id
)
{
return
api
.
get
(
u
(
"getchildren"
),
{
id
})
},
getTree
(){
return
api
.
get
(
u
(
'gettree'
))
},
setColor
(
paras
)
{
return
api
.
post
(
u
(
"setcolor"
),
{
Dictionary
:
paras
})
},
setSort
(
paras
)
{
return
api
.
post
(
u
(
"setsort"
),
paras
)
},
save
(
paras
)
{
return
api
.
post
(
u
(
"createorupdate"
),
{
Dictionary
:
paras
})
},
// getChildren(id) {
// return api.get(u("GetChildren"), { id })
// },
// getTree(){
// return api.get(u('GetTree'))
// },
// setColor(paras) {
// return api.post(u("SetColor"), {Dictionary:paras})
// },
// setSort(paras) {
// return api.post(u("SetSort"), paras)
// },
// save(paras) {
// return api.post(u("CreateOrUpdate"), {Dictionary:paras})
// },
}
\ No newline at end of file
pages/system/dic/components/edit.vue
0 → 100644
View file @
87f823a1
<
template
>
<Form
ref=
"form"
:model=
"entity"
:rules=
"rules"
:label-width=
"100"
>
<Row
class=
"rowTitle100"
>
<FormItem
label=
"类别"
prop=
"typeId"
>
<RadioGroup
v-model=
"entity.typeId"
>
<Radio
:label=
"0"
disabled
>
系统
</Radio>
<Radio
:label=
"1"
disabled
>
分类
</Radio>
<Radio
:label=
"2"
disabled
>
字典
</Radio>
<Radio
:label=
"3"
disabled
>
字典项
</Radio>
</RadioGroup>
</FormItem>
</Row>
<Row
class=
"rowTitle100"
>
<FormItem
label=
"名称"
prop=
"name"
>
<Input
v-model=
"entity.name"
>
<ColorPicker
v-model=
"entity.color"
slot=
"prepend"
transfer
size=
"small"
transfer
recommend
/>
</Input>
</FormItem>
</Row>
<Row
class=
"rowTitle100"
>
<FormItem
label=
"编码"
prop=
"code"
>
<Input
v-model=
"entity.code"
/>
</FormItem>
</Row>
<Row
class=
"rowTitle100"
>
<FormItem
label=
"图标"
prop=
"icon"
>
<InputIcon
v-model=
"entity.icon"
></InputIcon>
</FormItem>
</Row>
<FormItem
label=
"状态"
prop=
"number"
>
<RadioGroup
v-model=
"entity.status"
>
<Radio
:label=
"0"
>
启用
</Radio>
<Radio
:label=
"1"
>
禁用(名称和值可以启用或禁用,但不能删除)
</Radio>
</RadioGroup>
</FormItem>
<FormItem
label=
"锁定"
prop=
"number"
>
<RadioGroup
v-model=
"entity.isStatic"
>
<Radio
:label=
"0"
>
不锁定
</Radio>
<Radio
:label=
"1"
>
锁定(锁定后不可改变名称和值,不能删除)
</Radio>
</RadioGroup>
</FormItem>
<Row
class=
"rowTitle100"
>
<FormItem
label=
"描述"
prop=
"description"
>
<Input
v-model=
"entity.description"
type=
"textarea"
:rows=
"3"
></Input>
</FormItem>
</Row>
<FormItem>
<Button
type=
"primary"
@
click=
"handleSubmit"
>
保存
</Button>
<Button
@
click=
"handleClose"
class=
"ml20"
>
取消
</Button>
</FormItem>
</Form>
</
template
>
<
script
>
export
default
{
name
:
'Edit'
,
data
()
{
return
{
entity
:
this
.
v
,
rules
:
{
name
:
[{
required
:
true
,
message
:
'必填'
,
trigger
:
'blur'
}],
code
:
[{
required
:
true
,
message
:
'必填'
,
trigger
:
'blur'
}]
}
}
},
props
:
{
v
:
Object
},
methods
:
{
handleSubmit
()
{
this
.
$refs
.
form
.
validate
((
v
)
=>
{
if
(
v
)
{
var
url2
=
`
${
systemUrl
}
/Dictionary/createorupdate`
this
.
$api
.
post
(
url2
,
{
Dictionary
:
this
.
entity
}).
then
((
r
)
=>
{
if
(
r
.
success
)
{
this
.
$Message
.
success
(
'保存成功'
)
this
.
$emit
(
'on-ok'
)
}
})
}
})
},
handleClose
()
{
this
.
$emit
(
'on-close'
)
}
},
watch
:
{
v
(
v
)
{
this
.
entity
=
this
.
v
console
.
info
(
this
.
entity
)
}
}
}
</
script
>
pages/system/dic/index.vue
0 → 100644
View file @
87f823a1
<
template
>
<Layout
class=
"full"
>
<Sider
hide-trigger
:style=
"
{background: '#fff'}" class="menu" width="240">
<h3
class=
"title"
>
数据字典
<ButtonGroup
class=
"fr"
size=
"small"
>
<Button>
<Icon
:type=
"expand?'md-arrow-dropright':'md-arrow-dropdown'"
size=
"16"
@
click=
"toggle"
title=
"展开/合并"
/>
</Button>
<Button>
<Icon
type=
"md-refresh"
size=
"16"
@
click=
"loadTree"
title=
"刷新"
/>
</Button>
</ButtonGroup>
</h3>
<div>
<Input
v-model
.
trim=
"keys"
search
placeholder=
"请输入客户名称"
clearable
/>
<Tree
:data=
"projectList"
@
on-select-change=
"change"
class=
"tree-i"
:render=
"renderContent"
/>
</div>
</Sider>
<Content
class=
"content"
>
<Tools>
<Breadcrumb
style=
"display:inline-block"
>
<BreadcrumbItem
v-for=
"(li,i) in names"
:key=
"i"
>
{{
li
}}
</BreadcrumbItem>
</Breadcrumb>
<template
slot=
"btns"
>
<span
class=
"mr20"
v-if=
"node.typeId==2"
>
索引:
<a
data-clipboard-action=
"copy"
:data-clipboard-text=
"node.code"
@
click=
"copy"
id=
"code"
class=
"tag-read"
>
{{
node
.
code
}}
</a>
</span>
<Button
type=
"default"
@
click=
"setRoot"
>
返回顶级
</Button>
</
template
>
</Tools>
<div
class=
"auto"
>
<!-- <Dictionary code="system.dictionary.typeId" v-model="code" class="w200"/> {{code}}
<a @click="code='3'">up</a>-->
<Table
border
:columns=
"columns"
:data=
"data"
:draggable=
"edit==-1"
class=
"tableCommon"
@
on-drag-drop=
"onDragDrop"
>
<
template
slot-scope=
"{ row, index }"
slot=
"typeId"
>
<state
code=
"system.dictionary.typeId"
type=
"text"
:value=
"row.typeId"
></state>
</
template
>
<
template
slot-scope=
"{ row, index }"
slot=
"status"
>
<state
code=
"status"
type=
"tag"
:value=
"row.status"
></state>
</
template
>
<
template
slot-scope=
"{ row, index }"
slot=
"isStatic"
>
<state
code=
"isStatic"
type=
"tag"
:value=
"row.isStatic"
></state>
</
template
>
<
template
slot-scope=
"{ row, index }"
slot=
"name"
>
<span
v-if=
"edit!=index"
v-text=
"row.name"
></span>
<Input
v-else
type=
"text"
v-model
.
trim=
"cur.name"
/>
</
template
>
<
template
slot-scope=
"{ row, index }"
slot=
"color"
>
<div
v-if=
"edit!=index"
>
<ColorPicker
:value=
"row.color||''"
transfer
recommend
@
on-change=
"setColor($event,row,index)"
/>
</div>
<div
v-else
>
<ColorPicker
v-model=
"cur.color"
transfer
recommend
/>
</div>
</
template
>
<
template
slot-scope=
"{ row, index }"
slot=
"icon"
>
<div
v-if=
"row.icon"
>
<Icon
:type=
"row.icon"
@
on-change=
"setColor($event,row,index)"
/>
</div>
</
template
>
<
template
slot-scope=
"{ row, index }"
slot=
"code"
>
<span
v-if=
"edit!=index"
v-text=
"row.code"
></span>
<Input
v-else
type=
"text"
v-model
.
trim=
"cur.code"
/>
</
template
>
<
template
slot-scope=
"{ row, index }"
slot=
"action"
>
<div
v-if=
"edit!=index"
class=
"action"
>
<op
class=
"edit"
@
click=
"editRow(row,index)"
>
编辑
</op>
<!--
<op
class=
"remove"
@
click=
"delRow(row,index)"
>
删除
</op>
-->
</div>
<div
class=
"action"
v-else
>
<op
class=
"edit"
@
click=
"save"
>
保存
</op>
<op
class=
"remove"
@
click=
"remove"
>
删除
</op>
</div>
</
template
>
</Table>
<Button
type=
"primary"
:disabled=
"edit!=-1"
long
@
click=
"addNew"
class=
"mt10"
>
添加
</Button>
<Alert
type=
"info"
class=
"mt10"
v-if=
"data.length>1&&edit==-1"
>
提示: 支持拖拽排序,数据未保存时不可拖拽排序。
</Alert>
</div>
<Modal
v-model=
"editModal"
:title=
"editTitle"
footer-hide
>
<Edit
:v=
"editModel"
@
on-close=
"editModal=false"
@
on-ok=
"editOk"
/>
</Modal>
</Content>
</Layout>
</template>
<
script
>
import
Edit
from
"./components/edit"
;
import
api
from
"./api.js"
;
import
Clipboard
from
"clipboard"
;
const
root
=
{
id
:
0
,
typeId
:
-
1
,
title
:
"顶级节点"
,
code
:
""
};
export
default
{
data
()
{
return
{
keys
:
""
,
treeHeight
:
""
,
code
:
"2"
,
expand
:
false
,
editModal
:
false
,
editModel
:
{
color
:
""
},
editTitle
:
"编辑"
,
node
:
root
,
color4
:
""
,
cur
:
null
,
names
:
[
root
.
title
],
types
:
[
"系统"
,
"分类"
,
"字典"
,
"字典项"
],
addName
:
"添加"
,
tree
:
[],
edit
:
-
1
,
data
:
[],
columns
:
[
{
type
:
"index"
,
width
:
60
,
align
:
"center"
},
{
title
:
"类别"
,
key
:
"typeId"
,
width
:
100
,
align
:
"center"
,
slot
:
"typeId"
},
{
title
:
"颜色"
,
key
:
"color"
,
width
:
100
,
align
:
"center"
,
slot
:
"color"
},
{
title
:
"名称"
,
key
:
"name"
,
width
:
150
,
slot
:
"name"
},
{
title
:
"编码"
,
key
:
"code"
,
slot
:
"code"
},
{
title
:
"图标"
,
key
:
"icon"
,
slot
:
"icon"
},
{
title
:
"描述"
,
key
:
"description"
},
{
title
:
"状态"
,
key
:
"status"
,
width
:
100
,
align
:
"center"
,
slot
:
"status"
},
{
title
:
"锁定"
,
key
:
"isStatic"
,
width
:
100
,
align
:
"center"
,
slot
:
"isStatic"
},
{
title
:
"操作"
,
key
:
"action"
,
width
:
160
,
align
:
"center"
,
slot
:
"action"
}
]
};
},
computed
:
{
projectList
()
{
// let items = this.$u.clone(this.tree);
let
result
=
[];
let
items
=
this
.
tree
;
search
(
this
.
keys
,
items
);
function
search
(
keys
,
data
)
{
data
.
map
(
u
=>
{
if
(
keys
.
length
==
u
.
title
)
{
result
.
push
(
u
);
}
else
{
let
code
=
""
;
if
(
u
.
data
&&
u
.
data
.
code
)
{
u
.
data
.
code
.
toLowerCase
();
if
(
keys
)
{
keys
=
keys
.
toLowerCase
();
}
code
=
u
.
data
.
code
+
""
;
}
if
(
u
.
title
.
indexOf
(
keys
)
>
-
1
||
code
.
indexOf
(
keys
)
>
-
1
)
{
result
.
push
(
u
);
}
else
if
(
u
.
children
)
{
search
(
keys
,
u
.
children
);
}
}
});
}
return
result
;
}
},
components
:
{
Edit
},
async
fetch
({
store
,
params
})
{
await
store
.
dispatch
(
"loadDictionary"
);
// 加载数据字典
},
created
()
{
this
.
load
();
this
.
loadTree
();
this
.
treeHeight
=
window
.
innerHeight
-
180
;
},
mounted
()
{
window
.
onresize
=
()
=>
{
///浏览器窗口大小变化
return
(()
=>
{
window
.
screenHeight
=
window
.
innerHeight
;
this
.
treeHeight
=
window
.
screenHeight
-
180
;
})();
};
this
.
load
();
this
.
loadTree
();
},
methods
:
{
renderContent
(
h
,
{
root
,
node
,
data
})
{
return
h
(
"span"
,
[
h
(
"Poptip"
,
{
props
:
{
content
:
data
.
data
.
code
,
trigger
:
"hover"
,
placement
:
"top-start"
},
style
:
{
cursor
:
"pointer"
}
},[
h
(
'span'
,{
},
data
.
title
)
])
],
// data.title
);
},
copy
()
{
var
clipboard
=
new
Clipboard
(
".tag-read"
);
clipboard
.
on
(
"success"
,
e
=>
{
this
.
$Message
.
success
(
"复制成功:"
+
this
.
node
.
code
);
clipboard
.
destroy
();
});
clipboard
.
on
(
"error"
,
e
=>
{
// 不支持复制
console
.
log
(
"该浏览器不支持自动复制"
);
// 释放内存
clipboard
.
destroy
();
});
},
editRow
(
row
,
index
)
{
this
.
editTitle
=
"编辑"
;
this
.
editModal
=
true
;
this
.
editModel
=
row
;
},
toggle
()
{
this
.
expand
=
!
this
.
expand
;
this
.
loadTree
();
},
editOk
()
{
this
.
load
();
this
.
editModal
=
false
;
},
delRow
(
row
,
index
)
{
var
url
=
`
${
systemUrl
}
/Dictionary/Delete?id=
${
row
.
id
}
`
;
this
.
$Modal
.
confirm
({
title
:
"操作确认"
,
content
:
"确定要删除吗?"
,
onOk
:
()
=>
{
this
.
$api
.
delete
(
`
${
url
}
`
)
.
then
(
r
=>
{
if
(
r
.
success
)
{
this
.
$Message
.
success
(
"删除成功"
);
this
.
load
();
}
})
.
catch
(
error
=>
{
this
.
$Message
.
error
(
"删除失败"
);
});
}
});
},
change
(
nodes
,
node
)
{
// console.warn(node,nodes)
this
.
node
=
{
id
:
node
.
id
,
typeId
:
node
.
data
.
typeId
,
title
:
node
.
title
,
code
:
node
.
data
.
code
};
// this.names = [node.title]
let
cur
=
node
;
let
titles
=
[];
while
(
cur
)
{
titles
.
push
(
cur
.
title
);
cur
=
cur
.
parent
;
}
this
.
names
=
titles
.
reverse
();
this
.
load
(
node
.
id
);
},
setRoot
()
{
// this.load(0);
this
.
loadTree
();
this
.
node
=
root
;
},
async
setColor
(
v
,
row
,
i
)
{
let
r
=
await
api
.
setColor
({
id
:
row
.
id
,
color
:
v
});
if
(
r
.
success
)
{
this
.
$Message
.
success
(
"颜色设置成功!"
);
row
.
color
=
v
;
}
else
{
this
.
$Message
.
error
(
"颜色设置失败!"
);
row
.
color
=
""
;
}
},
async
load
()
{
this
.
edit
=
-
1
;
let
r
=
await
api
.
getChildren
(
this
.
node
.
id
);
this
.
data
=
r
.
result
;
},
async
loadTree
()
{
let
r
=
await
api
.
getTree
(
this
.
node
.
id
);
if
(
r
.
success
)
{
let
items
=
r
.
result
;
var
expand
=
this
.
expand
;
setParent
(
null
,
items
);
function
setParent
(
parent
,
items
)
{
items
.
map
(
u
=>
{
u
.
parent
=
parent
;
u
.
expand
=
expand
;
if
(
u
.
children
)
{
setParent
(
u
,
u
.
children
);
}
});
}
this
.
tree
=
items
;
}
},
onDragDrop
(
a
,
b
)
{
this
.
data
.
splice
(
b
,
1
,
...
this
.
data
.
splice
(
a
,
1
,
this
.
data
[
b
]));
let
ids
=
[];
this
.
data
.
map
(
u
=>
{
ids
.
push
(
u
.
id
);
});
if
(
ids
.
length
>
1
)
{
api
.
setSort
({
ids
}).
then
(
r
=>
{
if
(
!
r
.
success
)
{
this
.
$Message
.
error
(
"排序失败"
);
this
.
load
();
}
});
}
},
addNew
()
{
this
.
edit
=
this
.
data
.
length
;
this
.
cur
=
{
upId
:
this
.
node
.
id
,
name
:
""
,
code
:
""
,
color
:
""
,
status
:
0
,
isStatic
:
0
,
typeId
:
this
.
node
.
typeId
+
1
,
priority
:
this
.
edit
};
this
.
data
.
push
(
this
.
cur
);
},
remove
()
{
this
.
edit
=
-
1
;
// this.load(this.node.id)
this
.
data
.
pop
();
},
save
()
{
if
(
this
.
cur
.
name
==
""
)
{
this
.
$Message
.
error
(
"名称不能为空"
);
return
;
}
if
(
this
.
cur
.
code
==
""
)
{
this
.
$Message
.
error
(
"值不能为空"
);
return
;
}
api
.
save
(
this
.
cur
).
then
(
r
=>
{
console
.
warn
(
r
);
if
(
r
.
success
)
{
this
.
$Message
.
success
(
"添加成功"
);
this
.
load
();
}
});
}
}
};
</
script
>
<
style
lang=
"less"
scoped
>
.full {
margin-top: 0;
.tree-i {
height: 78vh;
overflow: auto;
}
}
.ivu-color-picker-confirm {
.ivu-input {
width: 130px;
height: 30px;
float: left;
}
.ivu-btn-small {
height: 30px !important;
}
}
</
style
>
pages/system/host/api.js
View file @
87f823a1
import
Api
from
'@/plugins/request'
export
default
{
// index:`${authUrl}/api/services/app/host/paged`,
index
:
`
${
systemNew
}
api/services/app/host/paged`
,
//new
index
:
`
${
systemNew
}
/
api/services/app/host/paged`
,
//new
paged
(
params
){
// return Api.post(`${authUrl}/api/services/app/host/paged`,params); systemNew
return
Api
.
post
(
`
${
systemNew
}
api/services/app/host/paged`
,
params
);
return
Api
.
post
(
`
${
systemNew
}
/
api/services/app/host/paged`
,
params
);
},
get
(
params
){
return
Api
.
get
(
`
${
systemNew
}
api/services/app/host/get`
,
params
);
return
Api
.
get
(
`
${
systemNew
}
/
api/services/app/host/get`
,
params
);
},
create
(
params
){
return
Api
.
post
(
`
${
systemNew
}
api/services/app/host/create`
,
params
);
return
Api
.
post
(
`
${
systemNew
}
/
api/services/app/host/create`
,
params
);
},
update
(
params
){
return
Api
.
post
(
`
${
systemNew
}
api/services/app/host/update`
,
params
);
return
Api
.
post
(
`
${
systemNew
}
/
api/services/app/host/update`
,
params
);
},
//删除:
delete
(
params
)
{
return
Api
.
delete
(
`
${
systemNew
}
api/services/app/host/delete`
,{
params
:
params
});
return
Api
.
delete
(
`
${
systemNew
}
/
api/services/app/host/delete`
,{
params
:
params
});
},
}
\ No newline at end of file
static/config.js
View file @
87f823a1
...
...
@@ -11,7 +11,7 @@ let address=systemApi.dev;
window
.
systemUrl
=
`http://
${
address
}
:10000/system`
;
//System-api 系统管理(基础数据)
window
.
system
=
`http://
${
address
}
:10000/auth`
;
//多租户后台系统
window
.
systemNew
=
`http://
${
address
}
:10130
/
`
;
//多租户后台系统-new 10130/platform/host/paged
window
.
systemNew
=
`http://
${
address
}
:10130`
;
//多租户后台系统-new 10130/platform/host/paged
window
.
authUrl
=
`http://
${
address
}
:10010`
;
//Authentication-api //统一登陆认证
window
.
designUrl
=
`http://
${
address
}
:10000/process`
;
// 工艺规程
window
.
PlanUrl
=
`http://
${
address
}
:10000/plan`
;
//订单
...
...
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