Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
weiqiao-vue
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
1
Merge Requests
1
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
金民
weiqiao-vue
Commits
a7b11106
Commit
a7b11106
authored
Mar 18, 2026
by
董晓奇
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
分解方式不能为必填(产品分类字典)
parent
0b0273d7
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
244 additions
and
235 deletions
+244
-235
xjrsoft-vue3/src/views/jcsj/cplx/components/Form.vue
+115
-42
xjrsoft-vue3/src/views/jcsj/cplx/components/config.ts
+1
-1
xjrsoft-vue3/src/views/jcsj/cplx/index.vue
+128
-192
No files found.
xjrsoft-vue3/src/views/jcsj/cplx/components/Form.vue
View file @
a7b11106
<
template
>
<
template
>
<div
class=
"pt-4"
>
<div
class=
"pt-4"
>
<SimpleForm
<SimpleForm
ref=
"systemFormRef"
ref=
"systemFormRef"
:formProps=
"data.formDataProps"
:formProps=
"data.formDataProps"
:formModel=
"state.formModel"
:formModel=
"state.formModel"
:isWorkFlow=
"props.fromPage
!=
FromPageType.MENU"
:isWorkFlow=
"props.fromPage
!=
FromPageType.MENU"
:isCamelCase=
"true"
:isCamelCase=
"true"
@
model-change=
"handleChange"
@
model-change=
"handleChange"
/>
/>
</div>
</div>
...
@@ -16,20 +15,24 @@
...
@@ -16,20 +15,24 @@
import
{
formProps
,
formEventConfigs
}
from
'./config'
;
import
{
formProps
,
formEventConfigs
}
from
'./config'
;
import
SimpleForm
from
'/@/components/SimpleForm/src/SimpleForm.vue'
;
import
SimpleForm
from
'/@/components/SimpleForm/src/SimpleForm.vue'
;
import
{
addMesBaseCplx
,
getMesBaseCplx
,
updateMesBaseCplx
}
from
'/@/api/jcsj/cplx'
;
import
{
addMesBaseCplx
,
getMesBaseCplx
,
updateMesBaseCplx
}
from
'/@/api/jcsj/cplx'
;
import
{
cloneDeep
,
isString
}
from
'lodash-es'
;
import
{
cloneDeep
,
isString
}
from
'lodash-es'
;
import
{
FormDataProps
}
from
'/@/components/Designer/src/types'
;
import
{
FormDataProps
}
from
'/@/components/Designer/src/types'
;
import
{
usePermission
}
from
'/@/hooks/web/usePermission'
;
import
{
usePermission
}
from
'/@/hooks/web/usePermission'
;
import
CustomButtonModal
from
'/@/components/Form/src/components/CustomButtonModal.vue'
;
import
CustomButtonModal
from
'/@/components/Form/src/components/CustomButtonModal.vue'
;
import
{
FromPageType
}
from
'/@/enums/workflowEnum'
;
import
{
FromPageType
}
from
'/@/enums/workflowEnum'
;
import
{
createFormEvent
,
getFormDataEvent
,
loadFormEvent
,
submitFormEvent
,}
from
'/@/hooks/web/useFormEvent'
;
import
{
createFormEvent
,
getFormDataEvent
,
loadFormEvent
,
submitFormEvent
,
}
from
'/@/hooks/web/useFormEvent'
;
import
{
changeWorkFlowForm
,
changeSchemaDisabled
}
from
'/@/hooks/web/useWorkFlowForm'
;
import
{
changeWorkFlowForm
,
changeSchemaDisabled
}
from
'/@/hooks/web/useWorkFlowForm'
;
import
{
WorkFlowFormParams
}
from
'/@/model/workflow/bpmnConfig'
;
import
{
WorkFlowFormParams
}
from
'/@/model/workflow/bpmnConfig'
;
import
{
useRouter
}
from
'vue-router'
;
import
{
useRouter
}
from
'vue-router'
;
const
{
filterFormSchemaAuth
}
=
usePermission
();
const
{
filterFormSchemaAuth
}
=
usePermission
();
const
RowKey
=
'id'
;
const
RowKey
=
'id'
;
const
emits
=
defineEmits
([
'changeUploadComponentIds'
,
'loadingCompleted'
,
'update:value'
]);
const
emits
=
defineEmits
([
'changeUploadComponentIds'
,
'loadingCompleted'
,
'update:value'
]);
const
props
=
defineProps
({
const
props
=
defineProps
({
fromPage
:
{
fromPage
:
{
type
:
Number
,
type
:
Number
,
...
@@ -42,34 +45,52 @@
...
@@ -42,34 +45,52 @@
});
});
const
state
=
reactive
({
const
state
=
reactive
({
formModel
:
{},
formModel
:
{},
formInfo
:
{
formId
:
''
,
formName
:
''
}
formInfo
:
{
formId
:
''
,
formName
:
''
},
});
});
const
{
currentRoute
}
=
useRouter
();
const
{
currentRoute
}
=
useRouter
();
watch
(
watch
(
()
=>
state
.
formModel
,
()
=>
state
.
formModel
,
(
val
)
=>
{
(
val
)
=>
{
emits
(
'update:value'
,
val
);
emits
(
'update:value'
,
val
);
},
},
{
{
deep
:
true
,
deep
:
true
,
},
},
);
);
onMounted
(
async
()
=>
{
onMounted
(
async
()
=>
{
try
{
try
{
if
(
props
.
fromPage
==
FromPageType
.
MENU
)
{
if
(
props
.
fromPage
==
FromPageType
.
MENU
)
{
setMenuPermission
();
setMenuPermission
();
if
(
currentRoute
.
value
.
meta
){
if
(
currentRoute
.
value
.
meta
)
{
state
.
formInfo
.
formName
=
currentRoute
.
value
.
meta
.
title
&&
isString
(
currentRoute
.
value
.
meta
.
title
)?
currentRoute
.
value
.
meta
.
title
:
''
;
state
.
formInfo
.
formName
=
state
.
formInfo
.
formId
=
currentRoute
.
value
.
meta
.
formId
&&
isString
(
currentRoute
.
value
.
meta
.
formId
)?
currentRoute
.
value
.
meta
.
formId
:
''
;
currentRoute
.
value
.
meta
.
title
&&
isString
(
currentRoute
.
value
.
meta
.
title
)
?
currentRoute
.
value
.
meta
.
title
:
''
;
state
.
formInfo
.
formId
=
currentRoute
.
value
.
meta
.
formId
&&
isString
(
currentRoute
.
value
.
meta
.
formId
)
?
currentRoute
.
value
.
meta
.
formId
:
''
;
}
}
await
createFormEvent
(
formEventConfigs
,
state
.
formModel
,
await
createFormEvent
(
formEventConfigs
,
state
.
formModel
,
systemFormRef
.
value
,
systemFormRef
.
value
,
formProps
.
schemas
,
true
,
state
.
formInfo
.
formName
,
state
.
formInfo
.
formId
);
//表单事件:初始化表单
formProps
.
schemas
,
true
,
state
.
formInfo
.
formName
,
state
.
formInfo
.
formId
,
);
//表单事件:初始化表单
await
nextTick
();
await
nextTick
();
await
loadFormEvent
(
formEventConfigs
,
state
.
formModel
,
await
loadFormEvent
(
formEventConfigs
,
state
.
formModel
,
systemFormRef
.
value
,
systemFormRef
.
value
,
formProps
.
schemas
,
true
,
state
.
formInfo
.
formName
,
state
.
formInfo
.
formId
);
//表单事件:加载表单
formProps
.
schemas
,
true
,
state
.
formInfo
.
formName
,
state
.
formInfo
.
formId
,
);
//表单事件:加载表单
}
else
if
(
props
.
fromPage
==
FromPageType
.
FLOW
)
{
}
else
if
(
props
.
fromPage
==
FromPageType
.
FLOW
)
{
emits
(
'loadingCompleted'
);
//告诉系统表单已经加载完毕
emits
(
'loadingCompleted'
);
//告诉系统表单已经加载完毕
// loadingCompleted后 工作流页面直接利用Ref调用setWorkFlowForm方法
// loadingCompleted后 工作流页面直接利用Ref调用setWorkFlowForm方法
...
@@ -78,15 +99,28 @@
...
@@ -78,15 +99,28 @@
}
else
if
(
props
.
fromPage
==
FromPageType
.
DESKTOP
)
{
}
else
if
(
props
.
fromPage
==
FromPageType
.
DESKTOP
)
{
// 桌面设计 表单事件需要执行
// 桌面设计 表单事件需要执行
emits
(
'loadingCompleted'
);
//告诉系统表单已经加载完毕
emits
(
'loadingCompleted'
);
//告诉系统表单已经加载完毕
await
createFormEvent
(
formEventConfigs
,
state
.
formModel
,
await
createFormEvent
(
formEventConfigs
,
state
.
formModel
,
systemFormRef
.
value
,
systemFormRef
.
value
,
formProps
.
schemas
,
true
,
state
.
formInfo
.
formName
,
state
.
formInfo
.
formId
);
//表单事件:初始化表单
formProps
.
schemas
,
await
loadFormEvent
(
formEventConfigs
,
state
.
formModel
,
true
,
state
.
formInfo
.
formName
,
state
.
formInfo
.
formId
,
);
//表单事件:初始化表单
await
loadFormEvent
(
formEventConfigs
,
state
.
formModel
,
systemFormRef
.
value
,
systemFormRef
.
value
,
formProps
.
schemas
,
true
,
state
.
formInfo
.
formName
,
state
.
formInfo
.
formId
);
//表单事件:加载表单
formProps
.
schemas
,
true
,
state
.
formInfo
.
formName
,
state
.
formInfo
.
formId
,
);
//表单事件:加载表单
}
}
}
catch
(
error
)
{}
}
catch
(
error
)
{}
});
});
// 根据菜单页面权限,设置表单属性(必填,禁用,显示)
// 根据菜单页面权限,设置表单属性(必填,禁用,显示)
function
setMenuPermission
()
{
function
setMenuPermission
()
{
data
.
formDataProps
.
schemas
=
filterFormSchemaAuth
(
data
.
formDataProps
.
schemas
!
);
data
.
formDataProps
.
schemas
=
filterFormSchemaAuth
(
data
.
formDataProps
.
schemas
!
);
...
@@ -106,20 +140,26 @@
...
@@ -106,20 +140,26 @@
}
finally
{
}
finally
{
}
}
return
values
;
return
values
;
}
}
// 根据行唯一ID查询行数据,并设置表单数据 【编辑】
// 根据行唯一ID查询行数据,并设置表单数据 【编辑】
async
function
setFormDataFromId
(
rowId
)
{
async
function
setFormDataFromId
(
rowId
)
{
try
{
try
{
const
record
=
await
getMesBaseCplx
(
rowId
);
const
record
=
await
getMesBaseCplx
(
rowId
);
setFieldsValue
(
record
);
setFieldsValue
(
record
);
state
.
formModel
=
record
;
state
.
formModel
=
record
;
await
getFormDataEvent
(
formEventConfigs
,
state
.
formModel
,
await
getFormDataEvent
(
formEventConfigs
,
state
.
formModel
,
systemFormRef
.
value
,
systemFormRef
.
value
,
formProps
.
schemas
,
true
,
state
.
formInfo
.
formName
,
state
.
formInfo
.
formId
);
//表单事件:获取表单数据
formProps
.
schemas
,
}
catch
(
error
)
{
true
,
state
.
formInfo
.
formName
,
}
state
.
formInfo
.
formId
,
);
//表单事件:获取表单数据
}
catch
(
error
)
{}
}
}
// 辅助返回表单数据
// 辅助返回表单数据
async
function
getFieldsValue
()
{
async
function
getFieldsValue
()
{
let
values
=
[];
let
values
=
[];
...
@@ -135,47 +175,66 @@
...
@@ -135,47 +175,66 @@
}
}
return
values
;
return
values
;
}
}
// 辅助设置表单数据
// 辅助设置表单数据
function
setFieldsValue
(
record
)
{
function
setFieldsValue
(
record
)
{
systemFormRef
.
value
.
setFieldsValue
(
record
);
systemFormRef
.
value
.
setFieldsValue
(
record
);
}
}
// 重置表单数据
// 重置表单数据
async
function
resetFields
()
{
async
function
resetFields
()
{
await
systemFormRef
.
value
.
resetFields
();
await
systemFormRef
.
value
.
resetFields
();
}
}
// 设置表单数据全部为Disabled 【查看】
// 设置表单数据全部为Disabled 【查看】
async
function
setDisabledForm
(
)
{
async
function
setDisabledForm
()
{
data
.
formDataProps
.
schemas
=
changeSchemaDisabled
(
cloneDeep
(
data
.
formDataProps
.
schemas
));
data
.
formDataProps
.
schemas
=
changeSchemaDisabled
(
cloneDeep
(
data
.
formDataProps
.
schemas
));
}
}
// 获取行键值
// 获取行键值
function
getRowKey
()
{
function
getRowKey
()
{
return
RowKey
;
return
RowKey
;
}
}
// 更新api表单数据
// 更新api表单数据
async
function
update
({
values
,
rowId
})
{
async
function
update
({
values
,
rowId
})
{
try
{
try
{
values
[
RowKey
]
=
rowId
;
values
[
RowKey
]
=
rowId
;
state
.
formModel
=
values
;
state
.
formModel
=
values
;
let
saveVal
=
await
updateMesBaseCplx
(
values
);
let
saveVal
=
await
updateMesBaseCplx
(
values
);
await
submitFormEvent
(
formEventConfigs
,
state
.
formModel
,
await
submitFormEvent
(
formEventConfigs
,
state
.
formModel
,
systemFormRef
.
value
,
systemFormRef
.
value
,
formProps
.
schemas
,
true
,
state
.
formInfo
.
formName
,
state
.
formInfo
.
formId
);
//表单事件:提交表单
formProps
.
schemas
,
true
,
state
.
formInfo
.
formName
,
state
.
formInfo
.
formId
,
);
//表单事件:提交表单
return
saveVal
;
return
saveVal
;
}
catch
(
error
)
{}
}
catch
(
error
)
{}
}
}
// 新增api表单数据
// 新增api表单数据
async
function
add
(
values
)
{
async
function
add
(
values
)
{
try
{
try
{
state
.
formModel
=
values
;
state
.
formModel
=
values
;
let
saveVal
=
await
addMesBaseCplx
(
values
);
let
saveVal
=
await
addMesBaseCplx
(
values
);
await
submitFormEvent
(
formEventConfigs
,
state
.
formModel
,
await
submitFormEvent
(
formEventConfigs
,
state
.
formModel
,
systemFormRef
.
value
,
systemFormRef
.
value
,
formProps
.
schemas
,
true
,
state
.
formInfo
.
formName
,
state
.
formInfo
.
formId
);
//表单事件:提交表单
formProps
.
schemas
,
true
,
state
.
formInfo
.
formName
,
state
.
formInfo
.
formId
,
);
//表单事件:提交表单
return
saveVal
;
return
saveVal
;
}
catch
(
error
)
{}
}
catch
(
error
)
{}
}
}
// 根据工作流页面权限,设置表单属性(必填,禁用,显示)
// 根据工作流页面权限,设置表单属性(必填,禁用,显示)
async
function
setWorkFlowForm
(
obj
:
WorkFlowFormParams
)
{
async
function
setWorkFlowForm
(
obj
:
WorkFlowFormParams
)
{
try
{
try
{
if
(
obj
.
formId
)
state
.
formInfo
.
formId
=
obj
.
formId
;
if
(
obj
.
formId
)
state
.
formInfo
.
formId
=
obj
.
formId
;
if
(
obj
.
formName
)
state
.
formInfo
.
formName
=
obj
.
formName
;
if
(
obj
.
formName
)
state
.
formInfo
.
formName
=
obj
.
formName
;
...
@@ -189,23 +248,38 @@
...
@@ -189,23 +248,38 @@
state
.
formModel
=
formModels
;
state
.
formModel
=
formModels
;
setFieldsValue
(
formModels
);
setFieldsValue
(
formModels
);
}
catch
(
error
)
{}
}
catch
(
error
)
{}
await
createFormEvent
(
formEventConfigs
,
state
.
formModel
,
await
createFormEvent
(
formEventConfigs
,
state
.
formModel
,
systemFormRef
.
value
,
systemFormRef
.
value
,
formProps
.
schemas
,
true
,
state
.
formInfo
.
formName
,
state
.
formInfo
.
formId
);
//表单事件:初始化表单
formProps
.
schemas
,
await
loadFormEvent
(
formEventConfigs
,
state
.
formModel
,
true
,
state
.
formInfo
.
formName
,
state
.
formInfo
.
formId
,
);
//表单事件:初始化表单
await
loadFormEvent
(
formEventConfigs
,
state
.
formModel
,
systemFormRef
.
value
,
systemFormRef
.
value
,
formProps
.
schemas
,
true
,
state
.
formInfo
.
formName
,
state
.
formInfo
.
formId
);
//表单事件:加载表单
formProps
.
schemas
,
true
,
state
.
formInfo
.
formName
,
state
.
formInfo
.
formId
,
);
//表单事件:加载表单
}
}
function
handleChange
(
val
)
{
function
handleChange
(
val
)
{
emits
(
'update:value'
,
val
);
emits
(
'update:value'
,
val
);
}
}
async
function
sendMessageForAllIframe
()
{
async
function
sendMessageForAllIframe
()
{
try
{
try
{
if
(
systemFormRef
.
value
&&
systemFormRef
.
value
.
sendMessageForAllIframe
)
{
if
(
systemFormRef
.
value
&&
systemFormRef
.
value
.
sendMessageForAllIframe
)
{
systemFormRef
.
value
.
sendMessageForAllIframe
();
systemFormRef
.
value
.
sendMessageForAllIframe
();
}
}
}
catch
(
error
)
{}
}
catch
(
error
)
{}
}
}
defineExpose
({
defineExpose
({
setFieldsValue
,
setFieldsValue
,
resetFields
,
resetFields
,
...
@@ -218,7 +292,6 @@
...
@@ -218,7 +292,6 @@
setWorkFlowForm
,
setWorkFlowForm
,
getRowKey
,
getRowKey
,
getFieldsValue
,
getFieldsValue
,
sendMessageForAllIframe
sendMessageForAllIframe
,
});
});
</
script
>
</
script
>
xjrsoft-vue3/src/views/jcsj/cplx/components/config.ts
View file @
a7b11106
...
@@ -349,7 +349,7 @@ export const formProps: FormProps = {
...
@@ -349,7 +349,7 @@ export const formProps: FormProps = {
apiId
:
'93d735dcb7364a0f8102188ec4d77ac7'
,
apiId
:
'93d735dcb7364a0f8102188ec4d77ac7'
,
},
},
dicOptions
:
[],
dicOptions
:
[],
required
:
tru
e
,
required
:
fals
e
,
rules
:
[],
rules
:
[],
events
:
{},
events
:
{},
isShow
:
true
,
isShow
:
true
,
...
...
xjrsoft-vue3/src/views/jcsj/cplx/index.vue
View file @
a7b11106
<
template
>
<
template
>
<ResizePageWrapper
:hasLeft=
"false"
>
<template
#
resizeRight
>
<ResizePageWrapper
:hasLeft=
"false"
>
<BasicTable
@
register=
"registerTable"
isMenuTable
ref=
"tableRef"
>
<template
#
resizeRight
>
<BasicTable
@
register=
"registerTable"
isMenuTable
ref=
"tableRef"
>
<template
#
toolbar
>
<template
#
toolbar
>
<template
v-for=
"button in tableButtonConfig"
:key=
"button.code"
>
<template
v-for=
"button in tableButtonConfig"
:key=
"button.code"
>
<a-button
v-if=
"button.isDefault"
type=
"primary"
@
click=
"buttonClick(button.code)"
>
<a-button
v-if=
"button.isDefault"
type=
"primary"
@
click=
"buttonClick(button.code)"
>
<template
#
icon
><Icon
:icon=
"button.icon"
/></
template
>
<template
#
icon
>
<Icon
:icon=
"button.icon"
/>
</
template
>
{{ button.name }}
{{ button.name }}
</a-button>
</a-button>
<CustomButtonModal
v-else-if=
"button.buttonType == 'modal'"
:info=
"button"
/>
<CustomButtonModal
v-else-if=
"button.buttonType == 'modal'"
:info=
"button"
/>
<a-button
v-else
:type=
"button.buttonType === 'danger' ? 'default' : button.buttonType || 'primary'"
:danger=
"button.buttonType === 'danger'"
>
<a-button
<
template
#
icon
><Icon
:icon=
"button.icon"
/></
template
>
v-else
:type=
"button.buttonType === 'danger' ? 'default' : button.buttonType || 'primary'"
:danger=
"button.buttonType === 'danger'"
>
<
template
#
icon
>
<Icon
:icon=
"button.icon"
/>
</
template
>
{{ button.name }}
{{ button.name }}
</a-button>
</a-button>
</template>
</template>
</template>
</template>
<
template
#
bodyCell=
"{ column, record }"
>
<
template
#
bodyCell=
"{ column, record }"
>
<template
v-if=
"column.dataIndex === 'action'"
>
<template
v-if=
"column.dataIndex === 'action'"
>
<TableAction
<TableAction
:actions=
"getLessActions(record)"
:actions=
"getLessActions(record)"
:dropDownActions=
"getMoreActions(record)"
:dropDownActions=
"getMoreActions(record)"
/>
/>
</
template
>
</
template
>
<
template
v-else-if=
"column.dataIndex && column?.listStyle"
>
<
template
v-else-if=
"column.dataIndex && column?.listStyle"
>
<span
:style=
"executeListStyle(getValue(record, column, 'style'), column?.listStyle)"
>
{{
<span
:style=
"executeListStyle(getValue(record, column, 'style'), column?.listStyle)"
>
{{
getValue
(
record
,
column
,
'value'
)
getValue
(
record
,
column
,
'value'
)
}}
</span>
}}
</span>
</
template
>
</
template
>
</template>
</template>
</BasicTable>
</BasicTable>
</template>
</template>
<CplxModal
@
register=
"registerModal"
@
success=
"handleFormSuccess"
@
cancel=
"handleFormCancel"
/>
</ResizePageWrapper>
<CplxModal
@
register=
"registerModal"
@
success=
"handleFormSuccess"
@
cancel=
"handleFormCancel"
/>
</ResizePageWrapper>
</template>
</template>
<
script
lang=
"ts"
setup
>
<
script
lang=
"ts"
setup
>
import
{
ref
,
computed
,
provide
,
Ref
,
createVNode
,
import
{
ref
,
computed
,
provide
,
Ref
,
createVNode
}
from
'vue'
;
}
from
'vue'
;
import
{
Modal
}
from
'ant-design-vue'
;
import
{
Modal
}
from
'ant-design-vue'
;
import
{
ExclamationCircleOutlined
}
from
'@ant-design/icons-vue'
;
import
{
ExclamationCircleOutlined
}
from
'@ant-design/icons-vue'
;
import
{
BasicTable
,
useTable
,
TableAction
,
ActionItem
}
from
'/@/components/Table'
;
import
{
BasicTable
,
useTable
,
TableAction
,
ActionItem
}
from
'/@/components/Table'
;
import
{
getMesBaseCplxPage
,
deleteMesBaseCplx
}
from
'/@/api/jcsj/cplx'
;
import
{
getMesBaseCplxPage
,
deleteMesBaseCplx
}
from
'/@/api/jcsj/cplx'
;
import
{
ResizePageWrapper
}
from
'/@/components/Page'
;
import
{
ResizePageWrapper
}
from
'/@/components/Page'
;
import
{
useMessage
}
from
'/@/hooks/web/useMessage'
;
import
{
useMessage
}
from
'/@/hooks/web/useMessage'
;
import
{
useI18n
}
from
'/@/hooks/web/useI18n'
;
import
{
useI18n
}
from
'/@/hooks/web/useI18n'
;
import
{
usePermission
}
from
'/@/hooks/web/usePermission'
;
import
{
usePermission
}
from
'/@/hooks/web/usePermission'
;
import
CustomButtonModal
from
'/@/components/Form/src/components/CustomButtonModal.vue'
;
import
CustomButtonModal
from
'/@/components/Form/src/components/CustomButtonModal.vue'
;
import
{
executeListStyle
,
getValue
}
from
'/@/hooks/web/useListStyle'
;
//列表样式配置
import
{
executeListStyle
,
getValue
}
from
'/@/hooks/web/useListStyle'
;
//列表样式配置
import
{
useRouter
}
from
'vue-router'
;
import
{
useRouter
}
from
'vue-router'
;
import
{
useModal
}
from
'/@/components/Modal'
;
import
{
useModal
}
from
'/@/components/Modal'
;
import
CplxModal
from
'./components/CplxModal.vue'
;
import
CplxModal
from
'./components/CplxModal.vue'
;
import
{
searchFormSchema
,
columns
}
from
'./components/config'
;
import
{
searchFormSchema
,
columns
}
from
'./components/config'
;
import
Icon
from
'/@/components/Icon/index'
;
import
Icon
from
'/@/components/Icon/index'
;
const
listSpliceNum
=
ref
(
3
);
//操作列最先展示几个
const
listSpliceNum
=
ref
(
3
);
//操作列最先展示几个
import
{
useConcurrentLock
}
from
'/@/hooks/web/useConcurrentLock'
;
import
{
useConcurrentLock
}
from
'/@/hooks/web/useConcurrentLock'
;
const
pageParamsInfo
=
ref
<
any
>
({});
const
pageParamsInfo
=
ref
<
any
>
({});
const
{
enableLockeData
,
handleOpenFormEnableLockeData
,
handleCloseFormEnableLocke
,
handleHasEnableLocke
}
=
const
{
useConcurrentLock
();
enableLockeData
,
handleOpenFormEnableLockeData
,
handleCloseFormEnableLocke
,
handleHasEnableLocke
,
}
=
useConcurrentLock
();
const
{
notification
}
=
useMessage
();
const
{
notification
}
=
useMessage
();
const
{
t
}
=
useI18n
();
const
{
t
}
=
useI18n
();
...
@@ -124,18 +85,47 @@
...
@@ -124,18 +85,47 @@
const
filterColumns
=
filterColumnAuth
(
columns
);
const
filterColumns
=
filterColumnAuth
(
columns
);
const
tableRef
=
ref
();
const
tableRef
=
ref
();
//展示在列表内的按钮
//展示在列表内的按钮
const
actionButtons
=
ref
<
string
[]
>
([
"view"
,
"edit"
,
"delete"
]);
const
actionButtons
=
ref
<
string
[]
>
([
'view'
,
'edit'
,
'delete'
]);
const
buttonConfigs
=
computed
(()
=>
{
const
buttonConfigs
=
computed
(()
=>
{
const
list
=
[{
"buttonId"
:
"2019334653844258816"
,
"name"
:
"查看"
,
"code"
:
"view"
,
"icon"
:
"ant-design:eye-outlined"
,
"isDefault"
:
true
,
"isUse"
:
true
},{
"buttonId"
:
"2019334653844258817"
,
"name"
:
"新增"
,
"code"
:
"add"
,
"icon"
:
"ant-design:plus-outlined"
,
"isDefault"
:
true
,
"isUse"
:
true
},{
"buttonId"
:
"2019334653844258818"
,
"name"
:
"编辑"
,
"code"
:
"edit"
,
"icon"
:
"ant-design:form-outlined"
,
"isDefault"
:
true
,
"isUse"
:
true
,
"isEnableLock"
:
true
},{
"buttonId"
:
"2019334653844258819"
,
"name"
:
"删除"
,
"code"
:
"delete"
,
"icon"
:
"ant-design:delete-outlined"
,
"isDefault"
:
true
,
"isUse"
:
true
}]
const
list
=
[
{
buttonId
:
'2019334653844258816'
,
name
:
'查看'
,
code
:
'view'
,
icon
:
'ant-design:eye-outlined'
,
isDefault
:
true
,
isUse
:
true
,
},
{
buttonId
:
'2019334653844258817'
,
name
:
'新增'
,
code
:
'add'
,
icon
:
'ant-design:plus-outlined'
,
isDefault
:
true
,
isUse
:
true
,
},
{
buttonId
:
'2019334653844258818'
,
name
:
'编辑'
,
code
:
'edit'
,
icon
:
'ant-design:form-outlined'
,
isDefault
:
true
,
isUse
:
true
,
isEnableLock
:
true
,
},
{
buttonId
:
'2019334653844258819'
,
name
:
'删除'
,
code
:
'delete'
,
icon
:
'ant-design:delete-outlined'
,
isDefault
:
true
,
isUse
:
true
,
},
];
return
filterButtonAuth
(
list
);
return
filterButtonAuth
(
list
);
})
})
;
const
tableButtonConfig
=
computed
(()
=>
{
const
tableButtonConfig
=
computed
(()
=>
{
return
buttonConfigs
.
value
?.
filter
((
x
)
=>
!
actionButtons
.
value
.
includes
(
x
.
code
));
return
buttonConfigs
.
value
?.
filter
((
x
)
=>
!
actionButtons
.
value
.
includes
(
x
.
code
));
...
@@ -145,27 +135,16 @@
...
@@ -145,27 +135,16 @@
return
buttonConfigs
.
value
?.
filter
((
x
)
=>
actionButtons
.
value
.
includes
(
x
.
code
));
return
buttonConfigs
.
value
?.
filter
((
x
)
=>
actionButtons
.
value
.
includes
(
x
.
code
));
});
});
const
btnEvent
=
{
view
:
handleView
,
add
:
handleAdd
,
edit
:
handleEdit
,
delete
:
handleDelete
,}
const
btnEvent
=
{
view
:
handleView
,
add
:
handleAdd
,
edit
:
handleEdit
,
delete
:
handleDelete
};
const
{
currentRoute
}
=
useRouter
();
const
{
currentRoute
}
=
useRouter
();
const
formIdComputedRef
=
computed
(()
=>
currentRoute
.
value
.
meta
.
formId
as
string
);
const
formIdComputedRef
=
computed
(()
=>
currentRoute
.
value
.
meta
.
formId
as
string
);
provide
<
Ref
<
string
>>
(
'currentFormId'
,
formIdComputedRef
);
provide
<
Ref
<
string
>>
(
'currentFormId'
,
formIdComputedRef
);
const
[
registerModal
,
{
openModal
}]
=
useModal
();
const
[
registerModal
,
{
openModal
}]
=
useModal
();
const
[
registerTable
,
{
reload
}]
=
useTable
({
const
[
registerTable
,
{
reload
,
}]
=
useTable
({
title
:
'Cplx列表'
,
title
:
'Cplx列表'
,
api
:
getMesBaseCplxPage
,
api
:
getMesBaseCplxPage
,
rowKey
:
'id'
,
rowKey
:
'id'
,
...
@@ -179,23 +158,15 @@
...
@@ -179,23 +158,15 @@
fieldMapToTime
:
[],
fieldMapToTime
:
[],
showResetButton
:
false
,
showResetButton
:
false
,
},
},
bordered
:
false
,
bordered
:
false
,
beforeFetch
:
(
params
)
=>
{
beforeFetch
:
(
params
)
=>
{
pageParamsInfo
.
value
=
{
...
params
,
FormId
:
formIdComputedRef
.
value
,
PK
:
'id'
}
pageParamsInfo
.
value
=
{
...
params
,
FormId
:
formIdComputedRef
.
value
,
PK
:
'id'
};
return
pageParamsInfo
.
value
;
return
pageParamsInfo
.
value
;
},
},
afterFetch
:
(
res
)
=>
{
afterFetch
:
(
res
)
=>
{},
},
useSearchForm
:
true
,
useSearchForm
:
true
,
showTableSetting
:
true
,
showTableSetting
:
true
,
striped
:
false
,
striped
:
false
,
actionColumn
:
{
actionColumn
:
{
width
:
195
,
width
:
195
,
...
@@ -207,60 +178,44 @@
...
@@ -207,60 +178,44 @@
size
:
false
,
size
:
false
,
},
},
customRow
,
customRow
,
isAdvancedQuery
:
false
,
isAdvancedQuery
:
false
,
querySelectOption
:
JSON
.
stringify
(
searchFormSchema
),
querySelectOption
:
JSON
.
stringify
(
searchFormSchema
),
objectId
:
formIdComputedRef
.
value
,
////系统表单formId,自定义表单releaseId的id值
objectId
:
formIdComputedRef
.
value
,
////系统表单formId,自定义表单releaseId的id值
});
});
function
buttonClick
(
code
)
{
function
buttonClick
(
code
)
{
btnEvent
[
code
]();
btnEvent
[
code
]();
}
}
function
handleAdd
()
{
function
handleAdd
()
{
openModal
(
true
,
{
isUpdate
:
false
});
}
openModal
(
true
,
{
isUpdate
:
false
,
});
}
async
function
handleEdit
(
record
:
Recordable
)
{
async
function
handleEdit
(
record
:
Recordable
)
{
let
field
=
'id'
;
let
field
=
'id'
;
try
{
try
{
let
hasIn
=
handleHasEnableLocke
(
buttonConfigs
.
value
,
'edit'
);
let
hasIn
=
handleHasEnableLocke
(
buttonConfigs
.
value
,
'edit'
);
if
(
hasIn
)
{
if
(
hasIn
)
{
let
res
=
await
handleOpenFormEnableLockeData
(
let
res
=
await
handleOpenFormEnableLockeData
(
record
[
field
],
formIdComputedRef
.
value
);
record
[
field
],
formIdComputedRef
.
value
,
);
if
(
res
!==
null
)
{
if
(
res
!==
null
)
{
return
;
return
;
}
}
}
}
let
info
=
{
let
info
=
{
id
:
record
[
field
],
id
:
record
[
field
],
isUpdate
:
true
,
isUpdate
:
true
,
};
};
openModal
(
true
,
info
);
openModal
(
true
,
info
);
}
catch
(
error
)
{}
}
catch
(
error
)
{}
}
}
function
handleDelete
(
record
:
Recordable
)
{
function
handleDelete
(
record
:
Recordable
)
{
deleteList
([
record
.
id
]);
deleteList
([
record
.
id
]);
}
}
function
deleteList
(
ids
)
{
function
deleteList
(
ids
)
{
Modal
.
confirm
({
Modal
.
confirm
({
title
:
'提示信息'
,
title
:
'提示信息'
,
...
@@ -280,70 +235,59 @@
...
@@ -280,70 +235,59 @@
onCancel
()
{},
onCancel
()
{},
});
});
}
}
function
customRow
(
record
:
Recordable
)
{
function
customRow
(
record
:
Recordable
)
{
return
{
return
{
ondblclick
:
()
=>
{
ondblclick
:
()
=>
{
if
(
record
.
isCanEdit
&&
hasPermission
(
"cplx:edit"
))
{
if
(
record
.
isCanEdit
&&
hasPermission
(
'cplx:edit'
))
{
handleEdit
(
record
);
handleEdit
(
record
);
}
}
},
},
};
};
}
}
function
handleSuccess
()
{
function
handleSuccess
()
{
reload
();
reload
();
}
}
function
handleFormSuccess
()
{
function
handleFormSuccess
()
{
handleSuccess
();
handleSuccess
();
handleCloseFormEnableLocke
(
buttonConfigs
.
value
,
'edit'
);
handleCloseFormEnableLocke
(
buttonConfigs
.
value
,
'edit'
);
}
}
function
handleFormCancel
()
{
function
handleFormCancel
()
{
handleCloseFormEnableLocke
(
buttonConfigs
.
value
,
'edit'
);
handleCloseFormEnableLocke
(
buttonConfigs
.
value
,
'edit'
);
}
}
function
handleView
(
record
:
Recordable
)
{
function
handleView
(
record
:
Recordable
)
{
let
info
=
{
let
info
=
{
isView
:
true
,
isView
:
true
,
id
:
record
.
id
,
id
:
record
.
id
,
}
}
;
openModal
(
true
,
info
);
openModal
(
true
,
info
);
}
}
function
getLessActions
(
record
:
Recordable
)
{
function
getLessActions
(
record
:
Recordable
)
{
let
list
=
getActions
(
record
);
let
list
=
getActions
(
record
);
return
list
.
slice
(
0
,
listSpliceNum
.
value
);
return
list
.
slice
(
0
,
listSpliceNum
.
value
);
}
}
function
getMoreActions
(
record
:
Recordable
)
{
function
getMoreActions
(
record
:
Recordable
)
{
let
list
=
getActions
(
record
);
let
list
=
getActions
(
record
);
return
list
.
slice
(
listSpliceNum
.
value
);
return
list
.
slice
(
listSpliceNum
.
value
);
}
}
function
getActions
(
record
:
Recordable
):
ActionItem
[]
{
function
getActions
(
record
:
Recordable
):
ActionItem
[]
{
record
.
isCanEdit
=
false
;
record
.
isCanEdit
=
false
;
let
actionsList
:
ActionItem
[]
=
[];
let
actionsList
:
ActionItem
[]
=
[];
actionButtonConfig
.
value
?.
map
((
button
)
=>
{
actionButtonConfig
.
value
?.
map
((
button
)
=>
{
if
(
!
record
?.
workflowData
?.
processId
)
{
if
(
!
record
?.
workflowData
?.
processId
)
{
record
.
isCanEdit
=
true
;
record
.
isCanEdit
=
true
;
actionsList
.
push
({
actionsList
.
push
({
...
button
,
...
button
,
auth
:
`cplx:
${
button
.
code
}
`
,
auth
:
`cplx:
${
button
.
code
}
`
,
label
:
button
?.
name
,
label
:
button
?.
name
,
color
:
button
.
code
===
'delete'
?
'error'
:
undefined
,
color
:
button
.
code
===
'delete'
?
'error'
:
undefined
,
...
@@ -352,34 +296,26 @@
...
@@ -352,34 +296,26 @@
}
else
{
}
else
{
if
(
!
[
'edit'
,
'delete'
].
includes
(
button
.
code
))
{
if
(
!
[
'edit'
,
'delete'
].
includes
(
button
.
code
))
{
actionsList
.
push
({
actionsList
.
push
({
auth
:
`cplx:
${
button
.
code
}
`
,
auth
:
`cplx:
${
button
.
code
}
`
,
label
:
button
?.
name
,
label
:
button
?.
name
,
onClick
:
btnEvent
[
button
.
code
]?.
bind
(
null
,
record
),
onClick
:
btnEvent
[
button
.
code
]?.
bind
(
null
,
record
),
});
});
}
}
}
}
});
});
return
actionsList
;
return
actionsList
;
}
}
</
script
>
</
script
>
<
style
lang=
"less"
scoped
>
<
style
lang=
"less"
scoped
>
:deep
(
.ant-table-selection-col
)
{
:deep
(
.ant-table-selection-col
)
{
width
:
50px
;
width
:
50px
;
}
}
.show
{
.show
{
display
:
flex
;
display
:
flex
;
}
}
.hide
{
.hide
{
display
:
none
!important
;
display
:
none
!important
;
}
}
</
style
>
</
style
>
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