二次封装 form-create 组件,使用项目重新封装的文件上传组件实现文件上载

This commit is contained in:
puhui999 2024-03-26 10:59:03 +08:00
parent cce1fadc33
commit 3820710c56
12 changed files with 172 additions and 104 deletions

View File

@ -0,0 +1,3 @@
import MyFormCreate from './src/MyFormCreate.vue'
export { MyFormCreate }

View File

@ -0,0 +1,54 @@
<template>
<form-create v-bind="attrs">
<!-- 保障 form-create 的原始插槽 -->
<template v-for="(_, name) in slots" #[name]="slotData">
<slot :name="name" v-bind="slotData || {}"></slot>
</template>
<!-- 使用项目重新封装的文件上传组件实现文件上载 -->
<template #type-upload="scope">
<!-- {{ logC(scope) }}-->
<template v-if="scope.prop.props.uploadType === 'file'">
<!-- TODO puhui999: 考虑是否使用属性透传直接把整个 scope.prop.props 传递给组件 -->
<UploadFile
:disabled="scope.prop.props.disabled"
:limit="scope.prop.props.limit"
:modelValue="scope.model.value || scope.prop.value"
@update:modelValue="(val) => setValue(scope, val)"
/>
</template>
<template v-if="scope.prop.props.uploadType === 'image' && scope.prop.props.limit === 1">
<UploadImg
:disabled="scope.prop.props.disabled"
:modelValue="scope.model.value || scope.prop.value"
@update:modelValue="(val) => setValue(scope, val)"
/>
</template>
<template v-if="scope.prop.props.uploadType === 'image' && scope.prop.props.limit > 1">
<UploadImgs
:disabled="scope.prop.props.disabled"
:limit="scope.prop.props.limit"
:modelValue="scope.model.value || scope.prop.value"
@update:modelValue="(val) => setValue(scope, val)"
/>
</template>
</template>
</form-create>
</template>
<script lang="ts" setup>
defineOptions({ name: 'MyFormCreate' })
const attrs = useAttrs()
const slots = useSlots()
// 使 scope
// const logC = (s) => {
// console.log(s)
// }
//
const setValue = (scope: any, value: any) => {
const obj = {}
obj[scope.prop.field] = value
scope.api.setValue(obj)
}
</script>

View File

@ -6,7 +6,9 @@
:action="uploadUrl" :action="uploadUrl"
:auto-upload="autoUpload" :auto-upload="autoUpload"
:before-upload="beforeUpload" :before-upload="beforeUpload"
:disabled="disabled"
:drag="drag" :drag="drag"
:http-request="httpRequest"
:limit="props.limit" :limit="props.limit"
:multiple="props.limit > 1" :multiple="props.limit > 1"
:on-error="excelUploadError" :on-error="excelUploadError"
@ -15,15 +17,14 @@
:on-remove="handleRemove" :on-remove="handleRemove"
:on-success="handleFileSuccess" :on-success="handleFileSuccess"
:show-file-list="true" :show-file-list="true"
:http-request="httpRequest"
class="upload-file-uploader" class="upload-file-uploader"
name="file" name="file"
> >
<el-button type="primary"> <el-button v-if="!disabled" type="primary">
<Icon icon="ep:upload-filled" /> <Icon icon="ep:upload-filled" />
选取文件 选取文件
</el-button> </el-button>
<template v-if="isShowTip" #tip> <template v-if="isShowTip && !disabled" #tip>
<div style="font-size: 8px"> <div style="font-size: 8px">
大小不超过 <b style="color: #f56c6c">{{ fileSize }}MB</b> 大小不超过 <b style="color: #f56c6c">{{ fileSize }}MB</b>
</div> </div>
@ -54,7 +55,8 @@ const props = defineProps({
limit: propTypes.number.def(5), // limit: propTypes.number.def(5), //
autoUpload: propTypes.bool.def(true), // autoUpload: propTypes.bool.def(true), //
drag: propTypes.bool.def(false), // drag: propTypes.bool.def(false), //
isShowTip: propTypes.bool.def(true) // isShowTip: propTypes.bool.def(true), //
disabled: propTypes.bool.def(false) // ==> false
}) })
// ========== ========== // ========== ==========

View File

@ -6,17 +6,18 @@
:action="uploadUrl" :action="uploadUrl"
:before-upload="beforeUpload" :before-upload="beforeUpload"
:class="['upload', drag ? 'no-border' : '']" :class="['upload', drag ? 'no-border' : '']"
:disabled="disabled"
:drag="drag" :drag="drag"
:http-request="httpRequest"
:multiple="false" :multiple="false"
:on-error="uploadError" :on-error="uploadError"
:on-success="uploadSuccess" :on-success="uploadSuccess"
:show-file-list="false" :show-file-list="false"
:http-request="httpRequest"
> >
<template v-if="modelValue"> <template v-if="modelValue">
<img :src="modelValue" class="upload-image" /> <img :src="modelValue" class="upload-image" />
<div class="upload-handle" @click.stop> <div class="upload-handle" @click.stop>
<div class="handle-icon" @click="editImg" v-if="!disabled"> <div v-if="!disabled" class="handle-icon" @click="editImg">
<Icon icon="ep:edit" /> <Icon icon="ep:edit" />
<span v-if="showBtnText">{{ t('action.edit') }}</span> <span v-if="showBtnText">{{ t('action.edit') }}</span>
</div> </div>
@ -77,10 +78,8 @@ const props = defineProps({
height: propTypes.string.def('150px'), // ==> 150px height: propTypes.string.def('150px'), // ==> 150px
width: propTypes.string.def('150px'), // ==> 150px width: propTypes.string.def('150px'), // ==> 150px
borderradius: propTypes.string.def('8px'), // ==> 8px borderradius: propTypes.string.def('8px'), // ==> 8px
// showDelete: propTypes.bool.def(true), //
showDelete: propTypes.bool.def(true), showBtnText: propTypes.bool.def(true) //
//
showBtnText: propTypes.bool.def(true)
}) })
const { t } = useI18n() // const { t } = useI18n() //
const message = useMessage() // const message = useMessage() //

View File

@ -6,13 +6,14 @@
:action="uploadUrl" :action="uploadUrl"
:before-upload="beforeUpload" :before-upload="beforeUpload"
:class="['upload', drag ? 'no-border' : '']" :class="['upload', drag ? 'no-border' : '']"
:disabled="disabled"
:drag="drag" :drag="drag"
:http-request="httpRequest"
:limit="limit" :limit="limit"
:multiple="true" :multiple="true"
:on-error="uploadError" :on-error="uploadError"
:on-exceed="handleExceed" :on-exceed="handleExceed"
:on-success="uploadSuccess" :on-success="uploadSuccess"
:http-request="httpRequest"
list-type="picture-card" list-type="picture-card"
> >
<div class="upload-empty"> <div class="upload-empty">

View File

@ -40,7 +40,7 @@ export const setConfAndFields = (designerRef: object, conf: string, fields: stri
export const setConfAndFields2 = ( export const setConfAndFields2 = (
detailPreview: object, detailPreview: object,
conf: string, conf: string,
fields: string, fields: string[],
value?: object value?: object
) => { ) => {
// @ts-ignore // @ts-ignore

View File

@ -3,67 +3,67 @@
<ContentWrap> <ContentWrap>
<el-table v-loading="loading" :data="list"> <el-table v-loading="loading" :data="list">
<el-table-column label="定义编号" align="center" prop="id" width="400" /> <el-table-column align="center" label="定义编号" prop="id" width="400" />
<el-table-column label="流程名称" align="center" prop="name" width="200"> <el-table-column align="center" label="流程名称" prop="name" width="200">
<template #default="scope"> <template #default="scope">
<el-button type="primary" link @click="handleBpmnDetail(scope.row)"> <el-button link type="primary" @click="handleBpmnDetail(scope.row)">
<span>{{ scope.row.name }}</span> <span>{{ scope.row.name }}</span>
</el-button> </el-button>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column label="定义分类" align="center" prop="category" width="100"> <el-table-column align="center" label="定义分类" prop="category" width="100">
<template #default="scope"> <template #default="scope">
<dict-tag :type="DICT_TYPE.BPM_MODEL_CATEGORY" :value="scope.row.category" /> <dict-tag :type="DICT_TYPE.BPM_MODEL_CATEGORY" :value="scope.row.category" />
</template> </template>
</el-table-column> </el-table-column>
<el-table-column label="表单信息" align="center" prop="formType" width="200"> <el-table-column align="center" label="表单信息" prop="formType" width="200">
<template #default="scope"> <template #default="scope">
<el-button <el-button
v-if="scope.row.formType === 10" v-if="scope.row.formType === 10"
type="primary"
link link
type="primary"
@click="handleFormDetail(scope.row)" @click="handleFormDetail(scope.row)"
> >
<span>{{ scope.row.formName }}</span> <span>{{ scope.row.formName }}</span>
</el-button> </el-button>
<el-button v-else type="primary" link @click="handleFormDetail(scope.row)"> <el-button v-else link type="primary" @click="handleFormDetail(scope.row)">
<span>{{ scope.row.formCustomCreatePath }}</span> <span>{{ scope.row.formCustomCreatePath }}</span>
</el-button> </el-button>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column label="流程版本" align="center" prop="processDefinition.version" width="80"> <el-table-column align="center" label="流程版本" prop="processDefinition.version" width="80">
<template #default="scope"> <template #default="scope">
<el-tag v-if="scope.row">v{{ scope.row.version }}</el-tag> <el-tag v-if="scope.row">v{{ scope.row.version }}</el-tag>
<el-tag type="warning" v-else>未部署</el-tag> <el-tag v-else type="warning">未部署</el-tag>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column label="状态" align="center" prop="version" width="80"> <el-table-column align="center" label="状态" prop="version" width="80">
<template #default="scope"> <template #default="scope">
<el-tag type="success" v-if="scope.row.suspensionState === 1">激活</el-tag> <el-tag v-if="scope.row.suspensionState === 1" type="success">激活</el-tag>
<el-tag type="warning" v-if="scope.row.suspensionState === 2">挂起</el-tag> <el-tag v-if="scope.row.suspensionState === 2" type="warning">挂起</el-tag>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column <el-table-column
label="部署时间" :formatter="dateFormatter"
align="center" align="center"
label="部署时间"
prop="deploymentTime" prop="deploymentTime"
width="180" width="180"
:formatter="dateFormatter"
/> />
<el-table-column <el-table-column
label="定义描述"
align="center" align="center"
label="定义描述"
prop="description" prop="description"
width="300"
show-overflow-tooltip show-overflow-tooltip
width="300"
/> />
<el-table-column label="操作" align="center" width="150" fixed="right"> <el-table-column align="center" fixed="right" label="操作" width="150">
<template #default="scope"> <template #default="scope">
<el-button <el-button
v-hasPermi="['bpm:task-assign-rule:query']"
link link
type="primary" type="primary"
@click="handleAssignRule(scope.row)" @click="handleAssignRule(scope.row)"
v-hasPermi="['bpm:task-assign-rule:query']"
> >
分配规则 分配规则
</el-button> </el-button>
@ -72,26 +72,26 @@
</el-table> </el-table>
<!-- 分页 --> <!-- 分页 -->
<Pagination <Pagination
:total="total"
v-model:page="queryParams.pageNo"
v-model:limit="queryParams.pageSize" v-model:limit="queryParams.pageSize"
v-model:page="queryParams.pageNo"
:total="total"
@pagination="getList" @pagination="getList"
/> />
</ContentWrap> </ContentWrap>
<!-- 弹窗表单详情 --> <!-- 弹窗表单详情 -->
<Dialog title="表单详情" v-model="formDetailVisible" width="800"> <Dialog v-model="formDetailVisible" title="表单详情" width="800">
<form-create :rule="formDetailPreview.rule" :option="formDetailPreview.option" /> <my-form-create :option="formDetailPreview.option" :rule="formDetailPreview.rule" />
</Dialog> </Dialog>
<!-- 弹窗流程模型图的预览 --> <!-- 弹窗流程模型图的预览 -->
<Dialog title="流程图" v-model="bpmnDetailVisible" width="800"> <Dialog v-model="bpmnDetailVisible" title="流程图" width="800">
<MyProcessViewer <MyProcessViewer
key="designer" key="designer"
v-model="bpmnXML" v-model="bpmnXML"
:prefix="bpmnControlForm.prefix"
:value="bpmnXML as any" :value="bpmnXML as any"
v-bind="bpmnControlForm" v-bind="bpmnControlForm"
:prefix="bpmnControlForm.prefix"
/> />
</Dialog> </Dialog>
</template> </template>

View File

@ -88,7 +88,7 @@
<!-- 表单详情的弹窗 --> <!-- 表单详情的弹窗 -->
<Dialog v-model="detailVisible" title="表单详情" width="800"> <Dialog v-model="detailVisible" title="表单详情" width="800">
<form-create :option="detailData.option" :rule="detailData.rule" /> <my-form-create :option="detailData.option" :rule="detailData.rule" />
</Dialog> </Dialog>
</template> </template>

View File

@ -4,36 +4,36 @@
<ContentWrap> <ContentWrap>
<!-- 搜索工作栏 --> <!-- 搜索工作栏 -->
<el-form <el-form
class="-mb-15px"
:model="queryParams"
ref="queryFormRef" ref="queryFormRef"
:inline="true" :inline="true"
:model="queryParams"
class="-mb-15px"
label-width="68px" label-width="68px"
> >
<el-form-item label="流程标识" prop="key"> <el-form-item label="流程标识" prop="key">
<el-input <el-input
v-model="queryParams.key" v-model="queryParams.key"
placeholder="请输入流程标识"
clearable
@keyup.enter="handleQuery"
class="!w-240px" class="!w-240px"
clearable
placeholder="请输入流程标识"
@keyup.enter="handleQuery"
/> />
</el-form-item> </el-form-item>
<el-form-item label="流程名称" prop="name"> <el-form-item label="流程名称" prop="name">
<el-input <el-input
v-model="queryParams.name" v-model="queryParams.name"
placeholder="请输入流程名称"
clearable
@keyup.enter="handleQuery"
class="!w-240px" class="!w-240px"
clearable
placeholder="请输入流程名称"
@keyup.enter="handleQuery"
/> />
</el-form-item> </el-form-item>
<el-form-item label="流程分类" prop="category"> <el-form-item label="流程分类" prop="category">
<el-select <el-select
v-model="queryParams.category" v-model="queryParams.category"
placeholder="请选择流程分类"
clearable
class="!w-240px" class="!w-240px"
clearable
placeholder="请选择流程分类"
> >
<el-option <el-option
v-for="dict in getIntDictOptions(DICT_TYPE.BPM_MODEL_CATEGORY)" v-for="dict in getIntDictOptions(DICT_TYPE.BPM_MODEL_CATEGORY)"
@ -44,18 +44,26 @@
</el-select> </el-select>
</el-form-item> </el-form-item>
<el-form-item> <el-form-item>
<el-button @click="handleQuery"><Icon icon="ep:search" class="mr-5px" /> 搜索</el-button> <el-button @click="handleQuery">
<el-button @click="resetQuery"><Icon icon="ep:refresh" class="mr-5px" /> 重置</el-button> <Icon class="mr-5px" icon="ep:search" />
<el-button 搜索
type="primary"
plain
@click="openForm('create')"
v-hasPermi="['bpm:model:create']"
>
<Icon icon="ep:plus" class="mr-5px" /> 新建流程
</el-button> </el-button>
<el-button type="success" plain @click="openImportForm" v-hasPermi="['bpm:model:import']"> <el-button @click="resetQuery">
<Icon icon="ep:upload" class="mr-5px" /> 导入流程 <Icon class="mr-5px" icon="ep:refresh" />
重置
</el-button>
<el-button
v-hasPermi="['bpm:model:create']"
plain
type="primary"
@click="openForm('create')"
>
<Icon class="mr-5px" icon="ep:plus" />
新建流程
</el-button>
<el-button v-hasPermi="['bpm:model:import']" plain type="success" @click="openImportForm">
<Icon class="mr-5px" icon="ep:upload" />
导入流程
</el-button> </el-button>
</el-form-item> </el-form-item>
</el-form> </el-form>
@ -64,33 +72,33 @@
<!-- 列表 --> <!-- 列表 -->
<ContentWrap> <ContentWrap>
<el-table v-loading="loading" :data="list"> <el-table v-loading="loading" :data="list">
<el-table-column label="流程标识" align="center" prop="key" width="200" /> <el-table-column align="center" label="流程标识" prop="key" width="200" />
<el-table-column label="流程名称" align="center" prop="name" width="200"> <el-table-column align="center" label="流程名称" prop="name" width="200">
<template #default="scope"> <template #default="scope">
<el-button type="primary" link @click="handleBpmnDetail(scope.row)"> <el-button link type="primary" @click="handleBpmnDetail(scope.row)">
<span>{{ scope.row.name }}</span> <span>{{ scope.row.name }}</span>
</el-button> </el-button>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column label="流程分类" align="center" prop="category" width="100"> <el-table-column align="center" label="流程分类" prop="category" width="100">
<template #default="scope"> <template #default="scope">
<dict-tag :type="DICT_TYPE.BPM_MODEL_CATEGORY" :value="scope.row.category" /> <dict-tag :type="DICT_TYPE.BPM_MODEL_CATEGORY" :value="scope.row.category" />
</template> </template>
</el-table-column> </el-table-column>
<el-table-column label="表单信息" align="center" prop="formType" width="200"> <el-table-column align="center" label="表单信息" prop="formType" width="200">
<template #default="scope"> <template #default="scope">
<el-button <el-button
v-if="scope.row.formType === 10" v-if="scope.row.formType === 10"
type="primary"
link link
type="primary"
@click="handleFormDetail(scope.row)" @click="handleFormDetail(scope.row)"
> >
<span>{{ scope.row.formName }}</span> <span>{{ scope.row.formName }}</span>
</el-button> </el-button>
<el-button <el-button
v-else-if="scope.row.formType === 20" v-else-if="scope.row.formType === 20"
type="primary"
link link
type="primary"
@click="handleFormDetail(scope.row)" @click="handleFormDetail(scope.row)"
> >
<span>{{ scope.row.formCustomCreatePath }}</span> <span>{{ scope.row.formCustomCreatePath }}</span>
@ -99,16 +107,16 @@
</template> </template>
</el-table-column> </el-table-column>
<el-table-column <el-table-column
label="创建时间" :formatter="dateFormatter"
align="center" align="center"
label="创建时间"
prop="createTime" prop="createTime"
width="180" width="180"
:formatter="dateFormatter"
/> />
<el-table-column label="最新部署的流程定义" align="center"> <el-table-column align="center" label="最新部署的流程定义">
<el-table-column <el-table-column
label="流程版本"
align="center" align="center"
label="流程版本"
prop="processDefinition.version" prop="processDefinition.version"
width="100" width="100"
> >
@ -120,8 +128,8 @@
</template> </template>
</el-table-column> </el-table-column>
<el-table-column <el-table-column
label="激活状态"
align="center" align="center"
label="激活状态"
prop="processDefinition.version" prop="processDefinition.version"
width="85" width="85"
> >
@ -135,7 +143,7 @@
/> />
</template> </template>
</el-table-column> </el-table-column>
<el-table-column label="部署时间" align="center" prop="deploymentTime" width="180"> <el-table-column align="center" label="部署时间" prop="deploymentTime" width="180">
<template #default="scope"> <template #default="scope">
<span v-if="scope.row.processDefinition"> <span v-if="scope.row.processDefinition">
{{ formatDate(scope.row.processDefinition.deploymentTime) }} {{ formatDate(scope.row.processDefinition.deploymentTime) }}
@ -143,53 +151,53 @@
</template> </template>
</el-table-column> </el-table-column>
</el-table-column> </el-table-column>
<el-table-column label="操作" align="center" width="240" fixed="right"> <el-table-column align="center" fixed="right" label="操作" width="240">
<template #default="scope"> <template #default="scope">
<el-button <el-button
v-hasPermi="['bpm:model:update']"
link link
type="primary" type="primary"
@click="openForm('update', scope.row.id)" @click="openForm('update', scope.row.id)"
v-hasPermi="['bpm:model:update']"
> >
修改流程 修改流程
</el-button> </el-button>
<el-button <el-button
v-hasPermi="['bpm:model:update']"
link link
type="primary" type="primary"
@click="handleDesign(scope.row)" @click="handleDesign(scope.row)"
v-hasPermi="['bpm:model:update']"
> >
设计流程 设计流程
</el-button> </el-button>
<el-button <el-button
v-hasPermi="['bpm:task-assign-rule:query']"
link link
type="primary" type="primary"
@click="handleAssignRule(scope.row)" @click="handleAssignRule(scope.row)"
v-hasPermi="['bpm:task-assign-rule:query']"
> >
分配规则 分配规则
</el-button> </el-button>
<el-button <el-button
v-hasPermi="['bpm:model:deploy']"
link link
type="primary" type="primary"
@click="handleDeploy(scope.row)" @click="handleDeploy(scope.row)"
v-hasPermi="['bpm:model:deploy']"
> >
发布流程 发布流程
</el-button> </el-button>
<el-button <el-button
v-hasPermi="['bpm:process-definition:query']"
link link
type="primary" type="primary"
v-hasPermi="['bpm:process-definition:query']"
@click="handleDefinitionList(scope.row)" @click="handleDefinitionList(scope.row)"
> >
流程定义 流程定义
</el-button> </el-button>
<el-button <el-button
v-hasPermi="['bpm:model:delete']"
link link
type="danger" type="danger"
@click="handleDelete(scope.row.id)" @click="handleDelete(scope.row.id)"
v-hasPermi="['bpm:model:delete']"
> >
删除 删除
</el-button> </el-button>
@ -198,9 +206,9 @@
</el-table> </el-table>
<!-- 分页 --> <!-- 分页 -->
<Pagination <Pagination
:total="total"
v-model:page="queryParams.pageNo"
v-model:limit="queryParams.pageSize" v-model:limit="queryParams.pageSize"
v-model:page="queryParams.pageNo"
:total="total"
@pagination="getList" @pagination="getList"
/> />
</ContentWrap> </ContentWrap>
@ -212,18 +220,18 @@
<ModelImportForm ref="importFormRef" @success="getList" /> <ModelImportForm ref="importFormRef" @success="getList" />
<!-- 弹窗表单详情 --> <!-- 弹窗表单详情 -->
<Dialog title="表单详情" v-model="formDetailVisible" width="800"> <Dialog v-model="formDetailVisible" title="表单详情" width="800">
<form-create :rule="formDetailPreview.rule" :option="formDetailPreview.option" /> <my-form-create :option="formDetailPreview.option" :rule="formDetailPreview.rule" />
</Dialog> </Dialog>
<!-- 弹窗流程模型图的预览 --> <!-- 弹窗流程模型图的预览 -->
<Dialog title="流程图" v-model="bpmnDetailVisible" width="800"> <Dialog v-model="bpmnDetailVisible" title="流程图" width="800">
<MyProcessViewer <MyProcessViewer
key="designer" key="designer"
v-model="bpmnXML" v-model="bpmnXML"
:prefix="bpmnControlForm.prefix"
:value="bpmnXML as any" :value="bpmnXML as any"
v-bind="bpmnControlForm" v-bind="bpmnControlForm"
:prefix="bpmnControlForm.prefix"
/> />
</Dialog> </Dialog>
</template> </template>

View File

@ -2,22 +2,23 @@
<!-- 第一步通过流程定义的列表选择对应的流程 --> <!-- 第一步通过流程定义的列表选择对应的流程 -->
<ContentWrap v-if="!selectProcessInstance"> <ContentWrap v-if="!selectProcessInstance">
<el-table v-loading="loading" :data="list"> <el-table v-loading="loading" :data="list">
<el-table-column label="流程名称" align="center" prop="name" /> <el-table-column align="center" label="流程名称" prop="name" />
<el-table-column label="流程分类" align="center" prop="category"> <el-table-column align="center" label="流程分类" prop="category">
<template #default="scope"> <template #default="scope">
<dict-tag :type="DICT_TYPE.BPM_MODEL_CATEGORY" :value="scope.row.category" /> <dict-tag :type="DICT_TYPE.BPM_MODEL_CATEGORY" :value="scope.row.category" />
</template> </template>
</el-table-column> </el-table-column>
<el-table-column label="流程版本" align="center" prop="version"> <el-table-column align="center" label="流程版本" prop="version">
<template #default="scope"> <template #default="scope">
<el-tag>v{{ scope.row.version }}</el-tag> <el-tag>v{{ scope.row.version }}</el-tag>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column label="流程描述" align="center" prop="description" /> <el-table-column align="center" label="流程描述" prop="description" />
<el-table-column label="操作" align="center"> <el-table-column align="center" label="操作">
<template #default="scope"> <template #default="scope">
<el-button link type="primary" @click="handleSelect(scope.row)"> <el-button link type="primary" @click="handleSelect(scope.row)">
<Icon icon="ep:plus" /> 选择 <Icon icon="ep:plus" />
选择
</el-button> </el-button>
</template> </template>
</el-table-column> </el-table-column>
@ -30,14 +31,15 @@
<div class="clearfix"> <div class="clearfix">
<span class="el-icon-document">申请信息{{ selectProcessInstance.name }}</span> <span class="el-icon-document">申请信息{{ selectProcessInstance.name }}</span>
<el-button style="float: right" type="primary" @click="selectProcessInstance = undefined"> <el-button style="float: right" type="primary" @click="selectProcessInstance = undefined">
<Icon icon="ep:delete" /> 选择其它流程 <Icon icon="ep:delete" />
选择其它流程
</el-button> </el-button>
</div> </div>
<el-col :span="16" :offset="6" style="margin-top: 20px"> <el-col :offset="6" :span="16" style="margin-top: 20px">
<form-create <my-form-create
:rule="detailForm.rule"
v-model:api="fApi" v-model:api="fApi"
:option="detailForm.option" :option="detailForm.option"
:rule="detailForm.rule"
@submit="submitForm" @submit="submitForm"
/> />
</el-col> </el-col>

View File

@ -68,9 +68,9 @@
</template> </template>
<!-- 情况一流程表单 --> <!-- 情况一流程表单 -->
<el-col v-if="processInstance?.processDefinition?.formType === 10" :offset="6" :span="16"> <el-col v-if="processInstance?.processDefinition?.formType === 10" :offset="6" :span="16">
<form-create <my-form-create
ref="fApi"
v-model="detailForm.value" v-model="detailForm.value"
v-model:api="fApi"
:option="detailForm.option" :option="detailForm.option"
:rule="detailForm.rule" :rule="detailForm.rule"
/> />
@ -229,9 +229,9 @@ const getProcessInstance = async () => {
data.formVariables data.formVariables
) )
nextTick().then(() => { nextTick().then(() => {
fApi.value?.fapi?.btn.show(false) fApi.value?.btn.show(false)
fApi.value?.fapi?.resetBtn.show(false) fApi.value?.resetBtn.show(false)
fApi.value?.fapi?.disabled(true) fApi.value?.disabled(true)
}) })
} else { } else {
// data.processDefinition.formCustomViewPath /crm/contract/detail/index.vue // data.processDefinition.formCustomViewPath /crm/contract/detail/index.vue

View File

@ -23,7 +23,7 @@
</el-button> </el-button>
<el-scrollbar height="580"> <el-scrollbar height="580">
<div> <div>
<pre><code class="hljs" v-dompurify-html="highlightedCode(formData)"></code></pre> <pre><code v-dompurify-html="highlightedCode(formData)" class="hljs"></code></pre>
</div> </div>
</el-scrollbar> </el-scrollbar>
</div> </div>
@ -81,15 +81,14 @@ const makeTemplate = () => {
const rule = designer.value.getRule() const rule = designer.value.getRule()
const opt = designer.value.getOption() const opt = designer.value.getOption()
return `<template> return `<template>
<form-create <my-form-create
v-model="fapi" v-model:api="fApi"
:rule="rule" :rule="rule"
:option="option" :option="option"
@submit="onSubmit" @submit="onSubmit"
></form-create> ></my-form-create>
</template> </template>
<script setup lang=ts> <script setup lang=ts>
import formCreate from "@form-create/element-ui";
const faps = ref(null) const faps = ref(null)
const rule = ref('') const rule = ref('')
const option = ref('') const option = ref('')