Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in / Register
Toggle navigation
T
TF-MOM-WEB
Project
Project
Details
Activity
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
TFMOM
TF-MOM-WEB
Commits
23b763ba
Commit
23b763ba
authored
Apr 19, 2024
by
jingnan
👀
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
通用联动属性组件配置
parent
3439f9c0
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
232 additions
and
0 deletions
+232
-0
config.js
...ivateComponents/components/GeneralLinkageSelect/config.js
+88
-0
index.vue
...ivateComponents/components/GeneralLinkageSelect/index.vue
+143
-0
http.js
applications/dee-mes/src/utils/http.js
+1
-0
No files found.
applications/dee-mes/src/privateComponents/components/GeneralLinkageSelect/config.js
0 → 100644
View file @
23b763ba
export
default
{
props
:
{},
layoutConfigData
:
[
{
title
:
'高级组件配置'
,
data
:
[
{
key
:
'linkageAttr'
,
title
:
'联动属性'
,
component
:
{
defaultValue
:
''
,
name
:
'el-input'
}
},
{
key
:
'requestMethod'
,
title
:
'请求方式'
,
width
:
1
,
component
:
{
name
:
'el-select'
,
isLabelTop
:
true
,
options
:
[
{
label
:
'get'
,
value
:
'get'
},
{
label
:
'post'
,
value
:
'post'
}
]
}
},
{
key
:
'requestURL'
,
title
:
'请求url'
,
width
:
1
,
component
:
{
isLabelTop
:
true
,
defaultValue
:
'requestURL=""'
,
name
:
'btnCodeEdit'
,
remindText
:
`requestURL为接口地址变量,直接给赋值,该变量必须有值`
}
},
{
key
:
'requestParameters'
,
title
:
'请求参数'
,
width
:
1
,
component
:
{
isLabelTop
:
true
,
defaultValue
:
'requestParameters = {}'
,
name
:
'btnCodeEdit'
,
remindText
:
`requestParameters为请求参数变量,直接给赋值,该变量必须有值`
}
},
{
key
:
'formateResponse'
,
title
:
'接口返回数据格式化'
,
width
:
1
,
component
:
{
isLabelTop
:
true
,
defaultValue
:
`responseData = res.items.content.map(row => {
return {
value: row.id,
label: row.name
}
})`
,
name
:
'btnCodeEdit'
,
remindText
:
`responseData为接口返回数据`
}
}
]
}
],
data
()
{
return
{
}
},
created
()
{
},
computed
:
{
},
methods
:
{
}
}
applications/dee-mes/src/privateComponents/components/GeneralLinkageSelect/index.vue
0 → 100644
View file @
23b763ba
<
template
>
<div
class=
"generalLinkageSelect-select"
>
<el-select
ref=
"selectCom"
v-model=
"selVal"
placeholder=
"请选择"
size=
"mini"
:disabled=
"disabledVal"
@
change=
"changeVal"
>
<el-option
v-for=
"item in options"
:key=
"item.value"
:label=
"item.label"
:value=
"item.value"
/>
</el-select>
</div>
</
template
>
<
script
>
import
http
from
'@/utils/http'
import
config
from
'./config'
import
_get
from
'lodash.get'
export
default
{
componentName
:
'通用联动属性配置'
,
name
:
'GeneralLinkageSelectSelect'
,
// name写在组件的最前方,自定义组件为必填
components
:
{},
mixins
:
[
config
],
props
:
{
item
:
{
type
:
Object
,
default
:
()
=>
{
return
{}
}
},
form
:
{
type
:
Object
,
default
:
()
=>
{}
},
middleForm
:
{
type
:
Object
,
default
:
()
=>
{}
},
value
:
{
type
:
[
Number
,
String
,
Object
],
default
:
()
=>
''
}
},
data
()
{
return
{
options
:
[],
selVal
:
''
,
disabledVal
:
false
,
linkageValue
:
''
}
},
computed
:
{},
watch
:
{
form
:
{
immediate
:
true
,
deep
:
true
,
handler
(
val
)
{
if
(
val
)
{
if
(
!
this
.
item
.
linkageAttr
)
{
return
}
const
_val
=
_get
(
this
.
form
,
this
.
item
.
linkageAttr
)
if
(
_val
!==
this
.
linkageValue
)
{
this
.
options
=
[]
this
.
selVal
=
''
this
.
linkageValue
=
_val
this
.
getData
(
_val
)
}
}
}
},
item
:
{
immediate
:
true
,
deep
:
true
,
handler
(
v
)
{
if
(
v
.
component
.
hasOwnProperty
(
'disabled'
))
{
this
.
disabledVal
=
v
.
component
.
disabled
}
}
},
value
:
{
immediate
:
true
,
deep
:
true
,
handler
(
v
)
{
if
(
v
)
{
this
.
selVal
=
this
.
value
}
}
}
},
created
()
{
console
.
log
(
http
,
'http'
)
// 初始化数据
},
methods
:
{
getData
(
val
)
{
var
requestURL
=
''
var
requestParameters
=
{}
if
(
this
.
item
.
requestURL
)
{
try
{
let
fun
eval
(
`fun = function (obtainedParams, functionParams){
${
this
.
item
.
requestURL
}
}`
)
// eslint-disable-line
fun
.
apply
(
this
)
// eslint-disable-line
}
catch
(
error
)
{
console
.
error
(
error
)
}
}
if
(
this
.
item
.
requestParameters
)
{
try
{
let
fun1
eval
(
`fun1 = function (obtainedParams, functionParams){
${
this
.
item
.
requestParameters
}
}`
)
// eslint-disable-line
fun1
.
apply
(
this
)
// eslint-disable-line
}
catch
(
error
)
{
console
.
error
(
error
)
}
}
http
[
this
.
item
.
requestMethod
](
requestURL
,
requestParameters
).
then
(
res
=>
{
let
responseData
=
[]
if
(
this
.
item
.
formateResponse
)
{
try
{
let
fun2
eval
(
`fun2 = function (obtainedParams, functionParams){
${
this
.
item
.
formateResponse
}
}`
)
// eslint-disable-line
fun2
.
apply
(
this
)
// eslint-disable-line
}
catch
(
error
)
{
console
.
error
(
error
)
}
}
else
{
responseData
=
res
.
items
.
content
.
map
(
row
=>
{
return
{
value
:
row
.
id
,
label
:
row
.
name
}
})
}
this
.
options
=
responseData
})
},
changeVal
()
{
this
.
$emit
(
'input'
,
this
.
selVal
)
}
}
}
</
script
>
<
style
lang=
'scss'
>
</
style
>
applications/dee-mes/src/utils/http.js
View file @
23b763ba
...
@@ -25,5 +25,6 @@ function downloadFile(url, type, params, userAction) {
...
@@ -25,5 +25,6 @@ function downloadFile(url, type, params, userAction) {
function
downloadZip
(
url
,
type
)
{
function
downloadZip
(
url
,
type
)
{
return
http
.
downloadZip
(
url
,
type
)
return
http
.
downloadZip
(
url
,
type
)
}
}
export
default
{
get
,
post
,
put
,
del
,
patch
,
downloadFile
,
downloadZip
}
export
{
get
,
post
,
put
,
del
,
patch
,
downloadFile
,
downloadZip
}
export
{
get
,
post
,
put
,
del
,
patch
,
downloadFile
,
downloadZip
}
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