Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in / Register
Toggle navigation
D
dsk-operate-sys-cscec
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
fulixin
dsk-operate-sys-cscec
Commits
6e52e49b
Commit
6e52e49b
authored
Jan 18, 2024
by
tianhongyang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
自定义表单完结
parent
a8c90093
Changes
9
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
117 additions
and
43 deletions
+117
-43
index.vue
dsk-operate-ui/src/components/DskCustomItemRender/index.vue
+12
-3
index.vue
dsk-operate-ui/src/components/DskEmailInput/index.vue
+0
-8
index.vue
dsk-operate-ui/src/components/DskFileInput/index.vue
+1
-1
index.vue
dsk-operate-ui/src/components/DskPhotoInput/index.vue
+1
-9
custom-design-options.js
dsk-operate-ui/src/utils/generator/custom-design-options.js
+5
-3
CustomFormDesign.vue
...ent/components/CustomForm/components/CustomFormDesign.vue
+5
-2
SubfieldItem.vue
...agement/components/CustomForm/components/SubfieldItem.vue
+1
-1
consultingAgency.vue
...ent/components/EnterpriseList/detail/consultingAgency.vue
+79
-11
projectDetail.vue
...gement/components/EnterpriseList/detail/projectDetail.vue
+13
-5
No files found.
dsk-operate-ui/src/components/DskCustomItemRender/index.vue
View file @
6e52e49b
<
template
>
<
template
>
<div
class=
"dsk-custom-item-render"
:class=
"classCreate(comCustomItem.comType)"
>
<div
class=
"dsk-custom-item-render"
:class=
"classCreate(comCustomItem.comType)"
>
<!-- 编辑模式 -->
<!-- 编辑模式 -->
<el-form-item
class=
"dsk-custom-form-render-item"
:prop=
"validatorTarget"
:rules=
"validatorRules(comCustomItem)"
>
<el-form-item
class=
"dsk-custom-form-render-item"
:prop=
"validatorTarget"
:rules=
"validatorRules(comCustomItem)"
:show-message=
"false"
>
<template
v-if=
"isModify"
>
<template
v-if=
"isModify"
>
<!-- 单行文本类型 -->
<!-- 单行文本类型 -->
<el-input
v-model=
"comCustomItem.componentAttribute.value"
:placeholder=
"comCustomItem.componentAttribute.placeholder"
clearable
<el-input
v-model=
"comCustomItem.componentAttribute.value"
:placeholder=
"comCustomItem.componentAttribute.placeholder"
clearable
...
@@ -123,8 +123,17 @@ export default {
...
@@ -123,8 +123,17 @@ export default {
methods
:
{
methods
:
{
// 验证规则
// 验证规则
validatorRules
(
item
)
{
validatorRules
(
item
)
{
if
(
!
item
.
formAttribute
)
return
{};
let
type
=
Object
.
prototype
.
toString
.
call
(
item
.
componentAttribute
.
value
).
split
(
" "
)[
1
].
replace
(
"]"
,
""
).
toLowerCase
();
return
item
.
formAttribute
.
required
?
item
.
formAttribute
.
requiredRules
?
item
.
formAttribute
.
requiredRules
:
{
required
:
true
,
message
:
`
${
item
.
formAttribute
.
label
}
不能为空`
}
:
item
.
formAttribute
.
rules
;
if
(
!
item
.
formAttribute
)
return
{
required
:
false
,
type
};
if
(
item
.
formAttribute
.
required
)
{
if
(
item
.
formAttribute
.
requiredRules
)
return
item
.
formAttribute
.
requiredRules
;
return
{
required
:
true
,
type
,
message
:
`
${
item
.
formAttribute
.
label
}
不能为空`
};
}
if
(
Object
.
keys
(
item
.
formAttribute
.
rules
).
length
)
{
return
item
.
formAttribute
.
rules
;
}
else
{
return
{
required
:
false
,
type
};
};
},
},
classCreate
(
comType
)
{
classCreate
(
comType
)
{
const
classParams
=
{
const
classParams
=
{
...
...
dsk-operate-ui/src/components/DskEmailInput/index.vue
View file @
6e52e49b
...
@@ -88,14 +88,6 @@ export default {
...
@@ -88,14 +88,6 @@ export default {
prop
:
"emailValue"
,
prop
:
"emailValue"
,
event
:
"update:emailValue"
event
:
"update:emailValue"
},
},
watch
:
{
emailValue
:
{
handler
(
newValue
)
{
this
.
comEmailValue
=
newValue
;
},
immediate
:
true
}
},
data
()
{
data
()
{
return
{
return
{
comEmailValue
:
this
.
emailValue
,
comEmailValue
:
this
.
emailValue
,
...
...
dsk-operate-ui/src/components/DskFileInput/index.vue
View file @
6e52e49b
...
@@ -59,7 +59,7 @@ export default {
...
@@ -59,7 +59,7 @@ export default {
data
()
{
data
()
{
return
{
return
{
allowTypes
:
[
".docx"
,
".pdf"
,
".doc"
,
".xlsx"
,
".xls"
,
".xlt"
,
".xlsm"
,
".txt"
,
".xltm"
],
allowTypes
:
[
".docx"
,
".pdf"
,
".doc"
,
".xlsx"
,
".xls"
,
".xlt"
,
".xlsm"
,
".txt"
,
".xltm"
],
comFileList
:
[]
,
comFileList
:
JSON
.
parse
(
JSON
.
stringify
(
this
.
fileList
))
,
fileListDialog
:
false
,
fileListDialog
:
false
,
pageInfo
:
{
pageInfo
:
{
pageSize
:
10
,
pageSize
:
10
,
...
...
dsk-operate-ui/src/components/DskPhotoInput/index.vue
View file @
6e52e49b
...
@@ -58,14 +58,6 @@ export default {
...
@@ -58,14 +58,6 @@ export default {
default
:
()
=>
[]
default
:
()
=>
[]
}
}
},
},
// watch: {
// fileList: {
// handler(newValue) {
// this.comFileList = newValue;
// },
// deep: true
// }
// },
model
:
{
model
:
{
prop
:
"fileList"
,
prop
:
"fileList"
,
event
:
"update:fileList"
event
:
"update:fileList"
...
@@ -73,7 +65,7 @@ export default {
...
@@ -73,7 +65,7 @@ export default {
data
()
{
data
()
{
return
{
return
{
allowTypes
:
[
".jpg"
,
".png"
,
".svg"
,
".gif"
,
".jpeg"
],
allowTypes
:
[
".jpg"
,
".png"
,
".svg"
,
".gif"
,
".jpeg"
],
comFileList
:
[]
,
comFileList
:
JSON
.
parse
(
JSON
.
stringify
(
this
.
fileList
))
,
fileListDialog
:
false
,
fileListDialog
:
false
,
photoViewDialog
:
false
,
photoViewDialog
:
false
,
viewTemp
:
{},
viewTemp
:
{},
...
...
dsk-operate-ui/src/utils/generator/custom-design-options.js
View file @
6e52e49b
// 默认自定义表单组件
// 默认自定义表单组件
import
{
validEmail
}
from
"@/utils/validate"
;
/**
/**
* 模块模板
* 模块模板
...
@@ -225,7 +225,8 @@ export const defaultComOptions = [
...
@@ -225,7 +225,8 @@ export const defaultComOptions = [
trigger
:
[
"blur"
],
trigger
:
[
"blur"
],
validator
:
(
rule
,
value
,
callback
)
=>
{
validator
:
(
rule
,
value
,
callback
)
=>
{
// console.log("value", value);
// console.log("value", value);
if
(
value
&&
!
validEmail
(
value
))
{
const
reg
=
/^
(([^
<>()
\[\]\\
.,;:
\s
@"
]
+
(\.[^
<>()
\[\]\\
.,;:
\s
@"
]
+
)
*
)
|
(
".+"
))
@
((\[[
0-9
]{1,3}\.[
0-9
]{1,3}\.[
0-9
]{1,3}\.[
0-9
]{1,3}\])
|
(([
a-zA-Z
\-
0-9
]
+
\.)
+
[
a-zA-Z
]{2,}))
$/
;
if
(
value
&&
!
reg
.
test
(
value
))
{
return
callback
(
new
Error
(
`请输入正确的电子邮箱`
));
return
callback
(
new
Error
(
`请输入正确的电子邮箱`
));
}
}
return
callback
();
return
callback
();
...
@@ -234,10 +235,11 @@ export const defaultComOptions = [
...
@@ -234,10 +235,11 @@ export const defaultComOptions = [
requiredRules
:
{
requiredRules
:
{
trigger
:
[
"blur"
],
trigger
:
[
"blur"
],
validator
:
(
rule
,
value
,
callback
)
=>
{
validator
:
(
rule
,
value
,
callback
)
=>
{
const
reg
=
/^
(([^
<>()
\[\]\\
.,;:
\s
@"
]
+
(\.[^
<>()
\[\]\\
.,;:
\s
@"
]
+
)
*
)
|
(
".+"
))
@
((\[[
0-9
]{1,3}\.[
0-9
]{1,3}\.[
0-9
]{1,3}\.[
0-9
]{1,3}\])
|
(([
a-zA-Z
\-
0-9
]
+
\.)
+
[
a-zA-Z
]{2,}))
$/
;
if
(
!
value
&&
!
value
?.
toString
()?.
trim
())
{
if
(
!
value
&&
!
value
?.
toString
()?.
trim
())
{
return
callback
(
new
Error
(
`请输入电子邮箱`
));
return
callback
(
new
Error
(
`请输入电子邮箱`
));
}
}
if
(
!
validEmail
(
value
))
{
if
(
!
reg
.
test
(
value
))
{
return
callback
(
new
Error
(
`请输入正确的电子邮箱`
));
return
callback
(
new
Error
(
`请输入正确的电子邮箱`
));
}
}
return
callback
();
return
callback
();
...
...
dsk-operate-ui/src/views/consultingOrgManagement/components/CustomForm/components/CustomFormDesign.vue
View file @
6e52e49b
...
@@ -209,6 +209,7 @@ export default {
...
@@ -209,6 +209,7 @@ export default {
}
}
}
}
}
}
console
.
log
(
_tempData
);
await
this
.
submitCustomForm
({
await
this
.
submitCustomForm
({
subfieldModuleList
:
_tempData
subfieldModuleList
:
_tempData
}
);
}
);
...
@@ -285,9 +286,11 @@ export default {
...
@@ -285,9 +286,11 @@ export default {
try
{
try
{
const
result
=
await
this
.
getCustomFormDetail
();
const
result
=
await
this
.
getCustomFormDetail
();
if
(
result
)
{
if
(
result
)
{
this
.
formTemplate
=
cloneDeep
(
result
);
}
if
(
result
?.
jsonData
)
{
// 有模板数据 进行回显
// 有模板数据 进行回显
this
.
formTemplate
=
result
;
this
.
parseTemplate
(
result
?.
jsonData
);
this
.
parseTemplate
(
result
.
jsonData
);
this
.
olduSbfieldModuleList
=
cloneDeep
(
this
.
subfieldModuleForm
.
subfieldModuleList
);
this
.
olduSbfieldModuleList
=
cloneDeep
(
this
.
subfieldModuleForm
.
subfieldModuleList
);
return
;
return
;
}
}
...
...
dsk-operate-ui/src/views/consultingOrgManagement/components/CustomForm/components/SubfieldItem.vue
View file @
6e52e49b
...
@@ -145,7 +145,7 @@ export default {
...
@@ -145,7 +145,7 @@ export default {
}
}
}
catch
(
error
)
{
}
catch
(
error
)
{
const
{
errors
,
fields
}
=
error
;
const
{
errors
,
fields
}
=
error
;
console
.
log
(
errors
,
fields
);
//
console.log(errors, fields);
this
.
$set
(
this
.
comChildModuleInfo
.
formAttribute
,
"isError"
,
true
);
this
.
$set
(
this
.
comChildModuleInfo
.
formAttribute
,
"isError"
,
true
);
}
}
},
},
...
...
dsk-operate-ui/src/views/consultingOrgManagement/components/EnterpriseList/detail/consultingAgency.vue
View file @
6e52e49b
...
@@ -271,34 +271,64 @@ export default {
...
@@ -271,34 +271,64 @@ export default {
},
},
async
formTemplateInit
()
{
async
formTemplateInit
()
{
try
{
try
{
this
.
loading
=
true
;
this
.
$emit
(
"searchLoadingChange"
,
this
.
loading
);
const
_formTemplate
=
await
this
.
getCustomFormDetail
();
const
_formTemplate
=
await
this
.
getCustomFormDetail
();
this
.
formTemplate
=
cloneDeep
(
_formTemplate
);
const
_formTemplateData
=
await
this
.
getCustomFormDataByProjectKey
(
this
.
projectKey
);
const
_formTemplateData
=
await
this
.
getCustomFormDataByProjectKey
(
this
.
projectKey
);
this
.
formTemplateData
=
cloneDeep
(
_formTemplateData
);
await
this
.
customFormRender
(
_formTemplate
,
_formTemplateData
);
await
this
.
customFormRender
(
_formTemplate
,
_formTemplateData
);
}
catch
(
error
)
{
}
catch
(
error
)
{
}
finally
{
this
.
loading
=
false
;
this
.
$emit
(
"searchLoadingChange"
,
this
.
loading
);
}
}
},
},
async
customFormRender
(
formTemplate
,
formData
)
{
async
customFormRender
(
formTemplate
,
formData
)
{
try
{
try
{
// 缺失模板不渲染
// 缺失模板不渲染
if
(
!
formTemplate
||
!
formTemplate
.
jsonData
)
return
;
if
(
!
formTemplate
||
!
formTemplate
.
jsonData
)
return
;
// 有表单数据的情况
if
(
formData
)
{
return
;
}
// 无表单数据只渲染模板
const
template
=
jsonStrToObject
(
formTemplate
.
jsonData
);
const
template
=
jsonStrToObject
(
formTemplate
.
jsonData
);
const
templateFormData
=
JSON
.
parse
(
formData
.
jsonData
);
if
(
template
)
{
if
(
template
)
{
console
.
log
(
template
);
// 模板
const
table
=
this
.
createTemplateTable
(
template
.
subfieldModuleList
);
let
subfieldModuleListTemplate
=
template
.
subfieldModuleList
;
this
.
oldSubfieldModuleList
=
cloneDeep
(
table
);
// 有表单数据先处理数据
this
.
$set
(
this
.
form
,
"subfieldModuleList"
,
table
);
if
(
templateFormData
)
{
subfieldModuleListTemplate
=
this
.
hasCustomFormDataHandle
(
subfieldModuleListTemplate
,
templateFormData
);
}
// 渲染模板
this
.
renderTemplate
(
subfieldModuleListTemplate
);
}
}
}
catch
(
error
)
{
}
catch
(
error
)
{
this
.
$message
.
error
(
`解析模板失败,
${
error
.
message
}
`
);
this
.
$message
.
error
(
`解析模板失败,
${
error
.
message
}
`
);
console
.
log
(
error
);
console
.
log
(
error
);
}
}
},
},
hasCustomFormDataHandle
(
formTemplate
,
formData
)
{
// console.log(formTemplate);
// console.log(formData);
formData
.
forEach
(
item
=>
{
this
.
interComTemplateParent
(
formTemplate
,
item
);
});
return
cloneDeep
(
formTemplate
);
},
interComTemplateParent
(
formTemplate
,
comItem
)
{
const
module
=
formTemplate
.
find
(
item
=>
item
.
uid
===
comItem
.
pid
);
if
(
module
)
{
const
index
=
module
.
children
.
findIndex
(
child
=>
child
.
uid
===
comItem
.
uid
);
// 找到模板 插入数据
if
(
index
>
-
1
)
{
module
.
children
[
index
].
componentAttribute
.
value
=
comItem
.
componentAttribute
.
value
;
}
}
},
renderTemplate
(
template
)
{
const
table
=
this
.
createTemplateTable
(
template
);
this
.
oldSubfieldModuleList
=
cloneDeep
(
table
);
this
.
$set
(
this
.
form
,
"subfieldModuleList"
,
table
);
},
// 创建渲染table展示格式
// 创建渲染table展示格式
createTemplateTable
(
list
)
{
createTemplateTable
(
list
)
{
/**
/**
...
@@ -442,7 +472,8 @@ export default {
...
@@ -442,7 +472,8 @@ export default {
async
updateConsultingDetail
()
{
async
updateConsultingDetail
()
{
try
{
try
{
const
flag
=
await
this
.
$refs
[
"comProjectDetailForm"
].
validate
();
const
flag
=
await
this
.
$refs
[
"comProjectDetailForm"
].
validate
();
if
(
flag
)
{
const
customFormFlag
=
await
this
.
$refs
[
"customDesignFormTemplate"
].
validate
();
if
(
flag
&&
customFormFlag
)
{
// 通过验证校验咨询机构是否存在
// 通过验证校验咨询机构是否存在
const
result
=
await
this
.
searchConsultingHandle
(
this
.
comProjectDetailInfo
.
advisoryBody
.
advisoryBodyName
);
const
result
=
await
this
.
searchConsultingHandle
(
this
.
comProjectDetailInfo
.
advisoryBody
.
advisoryBodyName
);
if
(
result
.
advisoryBodyCid
)
{
if
(
result
.
advisoryBodyCid
)
{
...
@@ -461,7 +492,14 @@ export default {
...
@@ -461,7 +492,14 @@ export default {
settleFinishTime
:
_temp
.
advisoryBodyProject
.
settleFinishTime
??
""
,
settleFinishTime
:
_temp
.
advisoryBodyProject
.
settleFinishTime
??
""
,
isFinalJudgeUnit
:
_temp
.
advisoryBodyProject
.
isFinalJudgeUnit
??
""
,
isFinalJudgeUnit
:
_temp
.
advisoryBodyProject
.
isFinalJudgeUnit
??
""
,
};
};
this
.
$emit
(
"editComProjectDetailSuccess"
,
paramsData
);
const
customFormData
=
this
.
saveCutomFormData
();
const
customFormParamsData
=
{
projectKey
:
this
.
projectKey
,
templateId
:
this
.
formTemplate
.
templateId
,
jsonData
:
JSON
.
stringify
(
customFormData
)
};
// 处理自定义表单数据
this
.
$emit
(
"editComProjectDetailSuccess"
,
paramsData
,
customFormParamsData
);
}
}
}
}
}
catch
(
error
)
{
}
catch
(
error
)
{
...
@@ -473,6 +511,36 @@ export default {
...
@@ -473,6 +511,36 @@ export default {
}
}
}
}
}
}
},
saveCutomFormData
()
{
/**
* @type {Array<any>}
*/
let
_array
=
cloneDeep
(
this
.
form
.
subfieldModuleList
);
function
flatCustomForm
(
arr
)
{
const
_temp
=
[];
function
flagArray
(
array
)
{
array
.
forEach
(
item
=>
{
if
(
item
?.
length
)
{
flagArray
(
item
);
}
else
{
_temp
.
push
(
item
);
}
});
}
arr
.
forEach
(
item
=>
{
flagArray
(
item
.
childrentGroup
);
});
return
_temp
;
}
const
_result
=
flatCustomForm
(
_array
);
return
_result
;
}
}
},
},
}
}
...
...
dsk-operate-ui/src/views/consultingOrgManagement/components/EnterpriseList/detail/projectDetail.vue
View file @
6e52e49b
...
@@ -22,7 +22,7 @@
...
@@ -22,7 +22,7 @@
<!-- 编辑按钮 展示咨询机构结算信息显示 -->
<!-- 编辑按钮 展示咨询机构结算信息显示 -->
<transition
name=
"fade"
appear
mode=
"out-in"
>
<transition
name=
"fade"
appear
mode=
"out-in"
>
<div
class=
"edit-project-detail-container"
v-if=
"currentList === 'consultingAgency' && !isModify"
:key=
"'edit-project'"
>
<div
class=
"edit-project-detail-container"
v-if=
"currentList === 'consultingAgency' && !isModify"
:key=
"'edit-project'"
>
<el-button
type=
"primary"
@
click=
"editProjectDetail"
>
编辑信息
</el-button>
<el-button
type=
"primary"
@
click=
"editProjectDetail"
:disabled=
"loading"
>
编辑信息
</el-button>
</div>
</div>
<div
class=
"save-project-detail-container"
v-if=
"currentList === 'consultingAgency' && isModify"
:key=
"'save-project'"
>
<div
class=
"save-project-detail-container"
v-if=
"currentList === 'consultingAgency' && isModify"
:key=
"'save-project'"
>
<el-button
type=
"primary"
@
click=
"saveProjectDetail"
:disabled=
"loading"
>
保存
</el-button>
<el-button
type=
"primary"
@
click=
"saveProjectDetail"
:disabled=
"loading"
>
保存
</el-button>
...
@@ -48,7 +48,7 @@
...
@@ -48,7 +48,7 @@
</
template
>
</
template
>
<
script
>
<
script
>
import
DskTabToggle
from
"@/components/DskTabToggle"
;
import
DskTabToggle
from
"@/components/DskTabToggle"
;
import
{
getConsultingOrgProjectDetailApi
,
updateConsultingDetailApi
}
from
"@/api/consultingOrgManagement"
;
import
{
getConsultingOrgProjectDetailApi
,
updateConsultingDetailApi
,
updateCustomFormData
}
from
"@/api/consultingOrgManagement"
;
import
{
v4
}
from
'uuid'
;
import
{
v4
}
from
'uuid'
;
import
BasicEngineeringInformation
from
"@/views/consultingOrgManagement/components/EnterpriseList/detail/basicEngineeringInformation"
;
import
BasicEngineeringInformation
from
"@/views/consultingOrgManagement/components/EnterpriseList/detail/basicEngineeringInformation"
;
import
consultingAgency
from
"@/views/consultingOrgManagement/components/EnterpriseList/detail/consultingAgency"
;
import
consultingAgency
from
"@/views/consultingOrgManagement/components/EnterpriseList/detail/consultingAgency"
;
...
@@ -120,10 +120,11 @@ export default {
...
@@ -120,10 +120,11 @@ export default {
this
.
$refs
[
"consultingAgency"
].
updateConsultingDetail
();
this
.
$refs
[
"consultingAgency"
].
updateConsultingDetail
();
},
},
// 编辑成功提交信息
// 编辑成功提交信息
async
editComProjectDetailSuccess
(
data
)
{
async
editComProjectDetailSuccess
(
data
,
customFormData
)
{
try
{
try
{
const
result
=
await
updateConsultingDetailApi
(
data
);
const
result
=
await
updateConsultingDetailApi
(
data
);
if
(
result
.
code
)
{
const
customFormResult
=
await
updateCustomFormData
(
customFormData
);
if
(
result
.
code
==
200
&&
customFormResult
.
code
==
200
)
{
this
.
$message
.
success
(
"更新咨询机构结算信息成功"
);
this
.
$message
.
success
(
"更新咨询机构结算信息成功"
);
this
.
isModify
=
false
;
this
.
isModify
=
false
;
this
.
$tab
.
closeOpenPage
({
this
.
$tab
.
closeOpenPage
({
...
@@ -136,7 +137,7 @@ export default {
...
@@ -136,7 +137,7 @@ export default {
});
});
}
}
}
catch
(
error
)
{
}
catch
(
error
)
{
console
.
log
(
error
);
}
}
},
},
cancelSave
()
{
cancelSave
()
{
...
@@ -227,6 +228,13 @@ export default {
...
@@ -227,6 +228,13 @@ export default {
box-sizing
:
border-box
;
box-sizing
:
border-box
;
background-color
:
#0081ff
;
background-color
:
#0081ff
;
border-color
:
#0081ff
;
border-color
:
#0081ff
;
&
.is-disabled
{
color
:
#c0c4cc
;
background-image
:
none
;
background-color
:
#ffffff
;
border-color
:
#e6ebf5
;
}
}
}
}
}
...
...
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