Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
D
dataease
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
zhu
dataease
Commits
9607973f
Unverified
提交
9607973f
authored
6月 07, 2022
作者:
dataeaseShu
提交者:
GitHub
6月 07, 2022
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #2388 from dataease/pr@dev_feat_caculate_id_name
Pr@dev feat caculate id name
上级
98727f00
d2c3ecad
隐藏空白字符变更
内嵌
并排
正在显示
1 个修改的文件
包含
40 行增加
和
8 行删除
+40
-8
CalcFieldEdit.vue
frontend/src/views/dataset/data/CalcFieldEdit.vue
+40
-8
没有找到文件。
frontend/src/views/dataset/data/CalcFieldEdit.vue
浏览文件 @
9607973f
...
@@ -86,7 +86,7 @@
...
@@ -86,7 +86,7 @@
:disabled="true"
:disabled="true"
>
>
<transition-group>
<transition-group>
<span
v-for=
"item in dimensionData"
:key=
"item.id"
class=
"item-dimension"
:title=
"item.name"
@
click=
"insertFieldToCodeMirror('['+item.
id
+']')"
>
<span
v-for=
"item in dimensionData"
:key=
"item.id"
class=
"item-dimension"
:title=
"item.name"
@
click=
"insertFieldToCodeMirror('['+item.
name
+']')"
>
<svg-icon
v-if=
"item.deType === 0"
icon-class=
"field_text"
class=
"field-icon-text"
/>
<svg-icon
v-if=
"item.deType === 0"
icon-class=
"field_text"
class=
"field-icon-text"
/>
<svg-icon
v-if=
"item.deType === 1"
icon-class=
"field_time"
class=
"field-icon-time"
/>
<svg-icon
v-if=
"item.deType === 1"
icon-class=
"field_time"
class=
"field-icon-time"
/>
<svg-icon
v-if=
"item.deType === 2 || item.deType === 3"
icon-class=
"field_value"
class=
"field-icon-value"
/>
<svg-icon
v-if=
"item.deType === 2 || item.deType === 3"
icon-class=
"field_value"
class=
"field-icon-value"
/>
...
@@ -106,7 +106,7 @@
...
@@ -106,7 +106,7 @@
:disabled="true"
:disabled="true"
>
>
<transition-group>
<transition-group>
<span
v-for=
"item in quotaData"
:key=
"item.id"
class=
"item-quota"
:title=
"item.name"
@
click=
"insertFieldToCodeMirror('['+item.
id
+']')"
>
<span
v-for=
"item in quotaData"
:key=
"item.id"
class=
"item-quota"
:title=
"item.name"
@
click=
"insertFieldToCodeMirror('['+item.
name
+']')"
>
<svg-icon
v-if=
"item.deType === 0"
icon-class=
"field_text"
class=
"field-icon-text"
/>
<svg-icon
v-if=
"item.deType === 0"
icon-class=
"field_text"
class=
"field-icon-text"
/>
<svg-icon
v-if=
"item.deType === 1"
icon-class=
"field_time"
class=
"field-icon-time"
/>
<svg-icon
v-if=
"item.deType === 1"
icon-class=
"field_time"
class=
"field-icon-time"
/>
<svg-icon
v-if=
"item.deType === 2 || item.deType === 3"
icon-class=
"field_value"
class=
"field-icon-value"
/>
<svg-icon
v-if=
"item.deType === 2 || item.deType === 3"
icon-class=
"field_value"
class=
"field-icon-value"
/>
...
@@ -248,6 +248,7 @@ export default {
...
@@ -248,6 +248,7 @@ export default {
searchFunction
:
''
,
searchFunction
:
''
,
dimensionData
:
[],
dimensionData
:
[],
quotaData
:
[],
quotaData
:
[],
name2Auto
:
[],
functionData
:
[]
functionData
:
[]
}
}
},
},
...
@@ -292,9 +293,9 @@ export default {
...
@@ -292,9 +293,9 @@ export default {
this
.
$refs
.
myCm
.
codemirror
.
showHint
()
this
.
$refs
.
myCm
.
codemirror
.
showHint
()
})
})
this
.
initFunctions
()
this
.
initFunctions
()
this
.
initField
()
this
.
dimensionData
=
JSON
.
parse
(
JSON
.
stringify
(
this
.
tableFields
.
dimensionList
)).
filter
(
ele
=>
ele
.
extField
===
0
)
this
.
dimensionData
=
JSON
.
parse
(
JSON
.
stringify
(
this
.
tableFields
.
dimensionList
)).
filter
(
ele
=>
ele
.
extField
===
0
)
this
.
quotaData
=
JSON
.
parse
(
JSON
.
stringify
(
this
.
tableFields
.
quotaList
)).
filter
(
ele
=>
ele
.
extField
===
0
)
this
.
quotaData
=
JSON
.
parse
(
JSON
.
stringify
(
this
.
tableFields
.
quotaList
)).
filter
(
ele
=>
ele
.
extField
===
0
)
this
.
initField
()
},
},
methods
:
{
methods
:
{
onCmReady
(
cm
)
{
onCmReady
(
cm
)
{
...
@@ -318,6 +319,7 @@ export default {
...
@@ -318,6 +319,7 @@ export default {
pos2
.
line
=
pos1
.
line
pos2
.
line
=
pos1
.
line
pos2
.
ch
=
pos1
.
ch
pos2
.
ch
=
pos1
.
ch
this
.
$refs
.
myCm
.
codemirror
.
replaceRange
(
param
,
pos2
)
this
.
$refs
.
myCm
.
codemirror
.
replaceRange
(
param
,
pos2
)
this
.
$refs
.
myCm
.
codemirror
.
markText
(
pos2
,
{
line
:
pos2
.
line
,
ch
:
param
.
length
+
pos2
.
ch
},
{
atomic
:
true
,
selectRight
:
true
})
},
},
initFunctions
()
{
initFunctions
()
{
...
@@ -330,27 +332,57 @@ export default {
...
@@ -330,27 +332,57 @@ export default {
initField
()
{
initField
()
{
if
(
this
.
field
.
id
)
{
if
(
this
.
field
.
id
)
{
this
.
fieldForm
=
JSON
.
parse
(
JSON
.
stringify
(
this
.
field
))
this
.
fieldForm
=
JSON
.
parse
(
JSON
.
stringify
(
this
.
field
))
this
.
name2Auto
=
[]
this
.
fieldForm
.
originName
=
this
.
setNameIdTrans
(
'id'
,
'name'
,
this
.
fieldForm
.
originName
,
this
.
name2Auto
)
setTimeout
(()
=>
{
this
.
matchToAuto
()
},
500
)
}
else
{
}
else
{
this
.
fieldForm
=
JSON
.
parse
(
JSON
.
stringify
(
this
.
fieldForm
))
this
.
fieldForm
=
JSON
.
parse
(
JSON
.
stringify
(
this
.
fieldForm
))
}
}
},
},
matchToAuto
()
{
if
(
!
this
.
name2Auto
.
length
)
return
this
.
name2Auto
.
forEach
(
ele
=>
{
const
search
=
this
.
$refs
.
myCm
.
codemirror
.
getSearchCursor
(
ele
,
{
line
:
0
,
ch
:
0
})
if
(
search
.
find
())
{
const
{
from
,
to
}
=
search
.
pos
this
.
$refs
.
myCm
.
codemirror
.
markText
({
line
:
from
.
line
,
ch
:
from
.
ch
-
1
},
{
line
:
to
.
line
,
ch
:
to
.
ch
+
1
},
{
atomic
:
true
,
selectRight
:
true
})
}
})
},
closeCalcField
()
{
closeCalcField
()
{
this
.
resetField
()
this
.
resetField
()
this
.
$emit
(
'onEditClose'
,
{})
this
.
$emit
(
'onEditClose'
,
{})
},
},
setNameIdTrans
(
from
,
to
,
originName
,
name2Auto
)
{
let
name2Id
=
originName
const
nameIdMap
=
[...
this
.
dimensionData
,
...
this
.
quotaData
].
reduce
((
pre
,
next
)
=>
{
pre
[
next
[
from
]]
=
next
[
to
]
return
pre
},
{})
originName
.
match
(
/
(?
<=
\[)
.+
?(?=\])
/g
).
forEach
(
ele
=>
{
if
(
name2Auto
)
{
name2Auto
.
push
(
nameIdMap
[
ele
])
}
name2Id
=
name2Id
.
replace
(
ele
,
nameIdMap
[
ele
])
})
return
name2Id
},
saveCalcField
()
{
saveCalcField
()
{
if
(
this
.
fieldForm
.
name
&&
this
.
fieldForm
.
name
.
length
>
50
)
{
const
{
id
,
name
=
[],
deType
,
originName
}
=
this
.
fieldForm
if
(
name
.
length
>
50
)
{
this
.
$message
.
error
(
this
.
$t
(
'dataset.field_name_less_50'
))
this
.
$message
.
error
(
this
.
$t
(
'dataset.field_name_less_50'
))
return
return
}
}
if
(
!
this
.
fieldForm
.
id
)
{
if
(
!
id
)
{
this
.
fieldForm
.
type
=
this
.
fieldForm
.
deType
this
.
fieldForm
.
type
=
deType
this
.
fieldForm
.
deExtractType
=
this
.
fieldForm
.
deType
this
.
fieldForm
.
deExtractType
=
deType
this
.
fieldForm
.
tableId
=
this
.
param
.
id
this
.
fieldForm
.
tableId
=
this
.
param
.
id
this
.
fieldForm
.
columnIndex
=
this
.
tableFields
.
dimensionList
.
length
+
this
.
tableFields
.
quotaList
.
length
this
.
fieldForm
.
columnIndex
=
this
.
tableFields
.
dimensionList
.
length
+
this
.
tableFields
.
quotaList
.
length
}
}
this
.
fieldForm
.
originName
=
this
.
setNameIdTrans
(
'name'
,
'id'
,
originName
)
post
(
'/dataset/field/save'
,
this
.
fieldForm
).
then
(
response
=>
{
post
(
'/dataset/field/save'
,
this
.
fieldForm
).
then
(
response
=>
{
this
.
closeCalcField
()
this
.
closeCalcField
()
})
})
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论