客户自定义表单流程

This commit is contained in:
‘huanghaiixia’
2025-11-27 17:23:14 +08:00
parent 57472a55c0
commit 105da87b88
12 changed files with 382 additions and 133 deletions

View File

@ -1,6 +1,7 @@
<template> <template>
<div class="bankListTb"> <div class="bankListTb">
<BasicModal v-bind="$attrs" @register="registerModal" width="60%" :title="getTitle" @ok="handleSubmit" > <BasicModal v-bind="$attrs" :zIndex="2000" @register="registerModal" width="60%" :title="getTitle" @ok="handleSubmit"
@visible-change="handleVisibleChange" >
<BasicTable @register="registerTable" class="bankListModal"> <BasicTable @register="registerTable" class="bankListModal">
</BasicTable> </BasicTable>
@ -9,7 +10,7 @@
</div> </div>
</template> </template>
<script lang="ts" setup> <script lang="ts" setup>
import { ref, computed, unref } from 'vue'; import { ref, computed, unref, nextTick } from 'vue';
import { BasicModal, useModalInner, useModal } from '/@/components/Modal'; import { BasicModal, useModalInner, useModal } from '/@/components/Modal';
import { BasicForm, useForm } from '/@/components/Form/index'; import { BasicForm, useForm } from '/@/components/Form/index';
import { BasicTable, useTable, FormSchema, BasicColumn, TableAction } from '/@/components/Table'; import { BasicTable, useTable, FormSchema, BasicColumn, TableAction } from '/@/components/Table';
@ -111,7 +112,7 @@
} }
}); });
const [registerTable, { getDataSource, setTableData, updateTableDataRecord }] = useTable({ const [registerTable, { getDataSource, setTableData, updateTableDataRecord, reload }] = useTable({
title: t('银行列表'), title: t('银行列表'),
api: getLngBBankPage, api: getLngBBankPage,
columns, columns,
@ -124,6 +125,7 @@
schemas: codeFormSchema, schemas: codeFormSchema,
showResetButton: true, showResetButton: true,
}, },
immediate: false, // 设置为不立即调用
beforeFetch: (params) => { beforeFetch: (params) => {
return { ...params, valid: 'Y'}; return { ...params, valid: 'Y'};
}, },
@ -132,6 +134,13 @@
onChange: onSelectChange onChange: onSelectChange
}, },
}); });
const handleVisibleChange = (visible: boolean) => {
if (visible) {
nextTick(() => {
reload();
});
}
};
function onSelectChange(rowKeys: string[], e) { function onSelectChange(rowKeys: string[], e) {
selectedKeys.value = rowKeys; selectedKeys.value = rowKeys;
selectedValues.value = e selectedValues.value = e

View File

@ -75,7 +75,7 @@ const [registerModal, { setModalProps, closeModal }] = useModalInner(async (data
console.log(isUpdate, 8,!unref(isUpdate),data?.isUpdate ) console.log(isUpdate, 8,!unref(isUpdate),data?.isUpdate )
disable.value = data?.btnType == 'view' ? true : false disable.value = data?.btnType == 'view' ? true : false
if (unref(isUpdate)) { if (unref(isUpdate)) {
formState=data.record || {} Object.assign(formState, data.record || {})
} }
}); });

View File

@ -1,10 +1,10 @@
<template> <template>
<BasicModal v-bind="$attrs" destroyOnClose @register="registerModal" showFooter :title="getTitle" width="40%" @ok="handleSubmit" @cancel="handleCancel"> <BasicModal v-bind="$attrs" destroyOnClose @register="registerModal" showFooter :title="getTitle" width="40%" @ok="handleSubmit" @cancel="handleCancel" :showOkBtn="!isDisable">
<a-form ref="formRef" :model="formState" :rules="rules" v-bind="{labelCol: { span: 8 },wrapperCol: { span: 16 },}"> <a-form ref="formRef" :model="formState" :rules="rules" v-bind="{labelCol: { span: 8 },wrapperCol: { span: 16 },}">
<a-row> <a-row>
<a-col :span="24"> <a-col :span="24">
<a-form-item label="证书名称" name="docTypeCode" :label-col="{ span: 4 }" :wrapper-col="{ span: 24 }"> <a-form-item label="证书名称" name="docTypeCode" :label-col="{ span: 4 }" :wrapper-col="{ span: 24 }">
<a-select v-model:value="formState.docTypeCode" placeholder="请选择证书名称" style="width: 100%" allow-clear> <a-select v-model:value="formState.docTypeCode" placeholder="请选择证书名称" :disabled="isDisable" style="width: 100%" allow-clear>
<a-select-option v-for="item in optionList" :key="item.code" :value="item.code"> <a-select-option v-for="item in optionList" :key="item.code" :value="item.code">
{{ item.fullName }} {{ item.fullName }}
</a-select-option> </a-select-option>
@ -13,22 +13,22 @@
</a-col> </a-col>
<a-col :span="12"> <a-col :span="12">
<a-form-item label="有效期开始" name="dateFrom" :label-col="{ span: 8 }" :wrapper-col="{ span: 24 }"> <a-form-item label="有效期开始" name="dateFrom" :label-col="{ span: 8 }" :wrapper-col="{ span: 24 }">
<a-date-picker v-model:value="formState.dateFrom" format="YYYY-MM-DD" :disabled-date="disabledDateStart" style="width: 100%" placeholder="请选择有效期开始" /> <a-date-picker v-model:value="formState.dateFrom" format="YYYY-MM-DD" :disabled="isDisable" :disabled-date="disabledDateStart" style="width: 100%" placeholder="请选择有效期开始" />
</a-form-item> </a-form-item>
</a-col> </a-col>
<a-col :span="12"> <a-col :span="12">
<a-form-item label="有效期结束" name="dateTo" :label-col="{ span: 8 }" :wrapper-col="{ span: 24 }"> <a-form-item label="有效期结束" name="dateTo" :label-col="{ span: 8 }" :wrapper-col="{ span: 24 }">
<a-date-picker v-model:value="formState.dateTo" format="YYYY-MM-DD" :disabled-date="disabledDateEnd" style="width: 100%" placeholder="请选择有效期结束" /> <a-date-picker v-model:value="formState.dateTo" format="YYYY-MM-DD" :disabled="isDisable" :disabled-date="disabledDateEnd" style="width: 100%" placeholder="请选择有效期结束" />
</a-form-item> </a-form-item>
</a-col> </a-col>
<a-col :span="24"> <a-col :span="24">
<a-form-item label="备注" name="note" :label-col="{ span: 4 }" :wrapper-col="{ span: 24 }"> <a-form-item label="备注" name="note" :label-col="{ span: 4 }" :wrapper-col="{ span: 24 }">
<a-textarea v-model:value="formState.note" placeholder="请输入备注最多50字" :maxlength="50" :auto-size="{ minRows: 2, maxRows: 5 }"/> <a-textarea v-model:value="formState.note" placeholder="请输入备注最多50字" :disabled="isDisable" :maxlength="50" :auto-size="{ minRows: 2, maxRows: 5 }"/>
</a-form-item> </a-form-item>
</a-col> </a-col>
<a-col :span="24"> <a-col :span="24">
<a-form-item label="上传附件" name="parentNname" :label-col="{ span: 4 }" :wrapper-col="{ span: 24 }"> <a-form-item label="上传附件" name="fileList" :label-col="{ span: 4 }" :wrapper-col="{ span: 24 }">
<Upload :fileList="formState.fileList" :maxSize="200" :accept="accept"></Upload> <Upload v-model:value="formState.filePath" @change="changeUplod" :multiple="true" :maxSize="200" :accept="accept"></Upload>
<div style="color: #ccc; font-size: 12px">{{ fileTip }}</div> <div style="color: #ccc; font-size: 12px">{{ fileTip }}</div>
</a-form-item> </a-form-item>
@ -49,10 +49,11 @@ import Upload from '/@/components/Form/src/components/Upload.vue';
import { getDocCpList } from '/@/api/sales/Customer'; import { getDocCpList } from '/@/api/sales/Customer';
import type { FormInstance } from 'ant-design-vue'; import type { FormInstance } from 'ant-design-vue';
import dayjs from 'dayjs'; import dayjs from 'dayjs';
import { object } from 'vue-types';
const { t } = useI18n(); const { t } = useI18n();
const isUpdate = ref(true); const isUpdate = ref(true);
const disable = ref(false); const isDisable = ref(false);
let optionList = reactive([]) let optionList = reactive([])
const fileTip = '支持格式.rar .zip .doc .docx .pdf 单个文件不能超过20MB'; const fileTip = '支持格式.rar .zip .doc .docx .pdf 单个文件不能超过20MB';
const accept ='.rar,.zip, .doc, .docx, .pdf, .RAR, .ZIP, .DOC, .DOCX, .PDF' const accept ='.rar,.zip, .doc, .docx, .pdf, .RAR, .ZIP, .DOC, .DOCX, .PDF'
@ -62,6 +63,7 @@ const emit = defineEmits(['success','register']);
const getTitle = computed(() => (!unref(isUpdate) ? t('新增证书') : t('编辑证书'))); const getTitle = computed(() => (!unref(isUpdate) ? t('新增证书') : t('编辑证书')));
let formState = reactive({ let formState = reactive({
docTypeCode: '', docTypeCode: '',
fileList: []
}); });
const rules = { const rules = {
docTypeCode: [{ required: true, message: "该项为必填项", trigger: 'change' }], docTypeCode: [{ required: true, message: "该项为必填项", trigger: 'change' }],
@ -71,9 +73,11 @@ const [registerModal, { setModalProps, closeModal }] = useModalInner(async (data
getOption() getOption()
setModalProps({ confirmLoading: false }); setModalProps({ confirmLoading: false });
isUpdate.value = !!data?.isUpdate; isUpdate.value = !!data?.isUpdate;
disable.value = data?.btnType == 'view' ? true : false isDisable.value = data?.btnType == 'view' ? true : false
if (unref(isUpdate)) { if (unref(isUpdate)) {
formState=data.record || {} let dateFrom = data.record?.dateFrom ? dayjs(data.record?.dateFrom) : null
let dateTo = data.record?.dateTo ? dayjs(data.record?.dateTo) : null
Object.assign(formState, {...data.record,dateFrom, dateTo})
} }
}); });
@ -97,6 +101,9 @@ const [registerModal, { setModalProps, closeModal }] = useModalInner(async (data
const handleChangeFile = (val) => { const handleChangeFile = (val) => {
}
function changeUplod (val) {
console.log(val, 532)
} }
async function getOption() { async function getOption() {
optionList = await getDocCpList({'valid': 'Y'}) optionList = await getDocCpList({'valid': 'Y'})
@ -108,13 +115,13 @@ const [registerModal, { setModalProps, closeModal }] = useModalInner(async (data
try { try {
await formRef.value.validate(); await formRef.value.validate();
// 验证通过,提交表单 // 验证通过,提交表单
let docNo = (optionList.find(v=>v.code === formState.docTypeCode) || {}).fullName
let obj = { let obj = {
...formState, ...formState,
docNo: docNo, dateFrom: formState.dateFrom ? dayjs(formState.dateFrom).format('YYYY-MM-DD') : '',
dateFrom: formState.dateFrom ? dayjs(formState.dateFrom).format('YYYY-MM-DD') : null, dateTo: formState.dateTo ? dayjs(formState.dateTo).format('YYYY-MM-DD') : '',
dateTo: formState.dateTo ? dayjs(formState.dateTo).format('YYYY-MM-DD') : null,
} }
console.log(obj,543)
emit('success', obj); emit('success', obj);
notification.success({ notification.success({
message: t('操作'), message: t('操作'),

View File

@ -1,8 +1,8 @@
<template> <template>
<a-spin :spinning="spinning" tip="请稍后..."> <a-spin :spinning="spinning" tip="请稍后...">
<div class="page-bg-wrap"> <div class="page-bg-wrap">
<div class="top-toolbar" id="formViewPage"> <!-- <div class="top-toolbar" id="formViewPage"> -->
<a-space :size="10" wrap style="gap: 0"> <!-- <a-space :size="10" wrap style="gap: 0">
<a-button style="margin-right: 10px" @click="close"> <a-button style="margin-right: 10px" @click="close">
<slot name="icon"><close-outlined /></slot>取消 <slot name="icon"><close-outlined /></slot>取消
</a-button> </a-button>
@ -19,7 +19,7 @@
<slot name="icon"><upload-outlined /></slot>导入 <slot name="icon"><upload-outlined /></slot>导入
</a-button> </a-button>
</a-space> </a-space>
</div> </div> -->
<a-form ref="formRef" :model="formState" :rules="rules" v-bind="layout"> <a-form ref="formRef" :model="formState" :rules="rules" v-bind="layout">
<a-card title="客户基本信息" :bordered="false" > <a-card title="客户基本信息" :bordered="false" >
<div> <div>
@ -32,12 +32,12 @@
</a-col> </a-col>
<a-col :span="8"> <a-col :span="8">
<a-form-item label="集团编码" name="cuName"> <a-form-item label="集团编码" name="cuName">
<a-input v-model:value="formState.cuName" placeholder="请输入集团编码" /> <a-input v-model:value="formState.cuName" :disabled="isDisable" placeholder="请输入集团编码" />
</a-form-item> </a-form-item>
</a-col> </a-col>
<a-col :span="8"> <a-col :span="8">
<a-form-item label="企业性质" name="cuMcode"> <a-form-item label="企业性质" name="cuMcode">
<a-select v-model:value="formState.cuMcode" placeholder="请选择企业性质" style="width: 100%" allow-clear> <a-select v-model:value="formState.cuMcode" :disabled="isDisable" placeholder="请选择企业性质" style="width: 100%" allow-clear>
<a-select-option v-for="item in optionSelect.cuMcodeList" :key="item.code" :value="item.code"> <a-select-option v-for="item in optionSelect.cuMcodeList" :key="item.code" :value="item.code">
{{ item.name }} {{ item.name }}
</a-select-option> </a-select-option>
@ -46,17 +46,17 @@
</a-col> </a-col>
<a-col :span="24"> <a-col :span="24">
<a-form-item label="客户名称" name="cuSname" :label-col="{ span: 3 }" :wrapper-col="{ span: 24 }"> <a-form-item label="客户名称" name="cuSname" :label-col="{ span: 3 }" :wrapper-col="{ span: 24 }">
<a-textarea v-model:value="formState.cuSname" placeholder="请输入客户名称" :auto-size="{ minRows: 1, maxRows: 5 }"/> <a-textarea v-model:value="formState.cuSname" :disabled="isDisable" placeholder="请输入客户名称" :auto-size="{ minRows: 1, maxRows: 5 }"/>
</a-form-item> </a-form-item>
</a-col> </a-col>
<a-col :span="8"> <a-col :span="8">
<a-form-item label="客户简称" name="di"> <a-form-item label="客户简称" name="di">
<a-input v-model:value="formState.di" placeholder="请输入客户简称" /> <a-input v-model:value="formState.di" :disabled="isDisable" placeholder="请输入客户简称" />
</a-form-item> </a-form-item>
</a-col> </a-col>
<a-col :span="8"> <a-col :span="8">
<a-form-item label="国内/国际" name="natureCode"> <a-form-item label="国内/国际" name="natureCode">
<a-select v-model:value="formState.natureCode" placeholder="请选择国内/国际" style="width: 100%" allow-clear> <a-select v-model:value="formState.natureCode" :disabled="isDisable" placeholder="请选择国内/国际" style="width: 100%" allow-clear>
<a-select-option v-for="item in optionSelect.natureCodeList" :key="item.code" :value="item.code"> <a-select-option v-for="item in optionSelect.natureCodeList" :key="item.code" :value="item.code">
{{ item.name }} {{ item.name }}
</a-select-option> </a-select-option>
@ -65,47 +65,47 @@
</a-col> </a-col>
<a-col :span="8"> <a-col :span="8">
<a-form-item label="母公司名称" name="parentNname"> <a-form-item label="母公司名称" name="parentNname">
<a-input v-model:value="formState.parentNname" placeholder="请输入母公司名称" /> <a-input v-model:value="formState.parentNname" :disabled="isDisable" placeholder="请输入母公司名称" />
</a-form-item> </a-form-item>
</a-col> </a-col>
<a-col :span="8"> <a-col :span="8">
<a-form-item label="统一社会信用代码" name="creditNo"> <a-form-item label="统一社会信用代码" name="creditNo">
<a-input v-model:value="formState.creditNo" placeholder="请输入统一社会信用代码" /> <a-input v-model:value="formState.creditNo" :disabled="isDisable" placeholder="请输入统一社会信用代码" />
</a-form-item> </a-form-item>
</a-col> </a-col>
<a-col :span="8"> <a-col :span="8">
<a-form-item label="纳税人识别号" name="tiNo"> <a-form-item label="纳税人识别号" name="tiNo">
<a-input v-model:value="formState.tiNo" placeholder="请输入纳税人识别号" /> <a-input v-model:value="formState.tiNo" :disabled="isDisable" placeholder="请输入纳税人识别号" />
</a-form-item> </a-form-item>
</a-col> </a-col>
<a-col :span="8"> <a-col :span="8">
<a-form-item label="法定代表人" name="representative"> <a-form-item label="法定代表人" name="representative">
<a-input v-model:value="formState.representative" placeholder="请输入法定代表人" /> <a-input v-model:value="formState.representative" :disabled="isDisable" placeholder="请输入法定代表人" />
</a-form-item> </a-form-item>
</a-col> </a-col>
<a-col :span="8"> <a-col :span="8">
<a-form-item label="成立日期" name="dateEstab"> <a-form-item label="成立日期" name="dateEstab">
<a-date-picker v-model:value="formState.dateEstab" style="width: 100%" placeholder="请选择成立日期" /> <a-date-picker v-model:value="formState.dateEstab" :disabled="isDisable" style="width: 100%" placeholder="请选择成立日期" />
</a-form-item> </a-form-item>
</a-col> </a-col>
<a-col :span="8"> <a-col :span="8">
<a-form-item label="准入时间" name="dateEntry"> <a-form-item label="准入时间" name="dateEntry">
<a-date-picker v-model:value="formState.dateEntry" style="width: 100%" placeholder="请选择准入时间" /> <a-date-picker v-model:value="formState.dateEntry" :disabled="isDisable" style="width: 100%" placeholder="请选择准入时间" />
</a-form-item> </a-form-item>
</a-col> </a-col>
<a-col :span="8"> <a-col :span="8">
<a-form-item label="注册资本(万元)" name="amtReg"> <a-form-item label="注册资本(万元)" name="amtReg">
<a-input-number v-model:value="formState.amtReg" :min="0" style="width: 100%" placeholder="请输入注册资本"/> <a-input-number v-model:value="formState.amtReg" :disabled="isDisable" :min="0" style="width: 100%" placeholder="请输入注册资本"/>
</a-form-item> </a-form-item>
</a-col> </a-col>
<a-col :span="24"> <a-col :span="24">
<a-form-item label="注册地址" name="addrReg" :label-col="{ span: 3 }" :wrapper-col="{ span: 24 }"> <a-form-item label="注册地址" name="addrReg" :label-col="{ span: 3 }" :wrapper-col="{ span: 24 }">
<a-textarea v-model:value="formState.addrReg" placeholder="请输入注册地址" :auto-size="{ minRows: 1, maxRows: 5 }"/> <a-textarea v-model:value="formState.addrReg" :disabled="isDisable" placeholder="请输入注册地址" :auto-size="{ minRows: 1, maxRows: 5 }"/>
</a-form-item> </a-form-item>
</a-col> </a-col>
<a-col :span="24"> <a-col :span="24">
<a-form-item label="通讯地址" name="addrMail" :label-col="{ span: 3 }" :wrapper-col="{ span: 24 }"> <a-form-item label="通讯地址" name="addrMail" :label-col="{ span: 3 }" :wrapper-col="{ span: 24 }">
<a-textarea v-model:value="formState.addrMail" placeholder="请输入通讯地址" :auto-size="{ minRows: 1, maxRows: 5 }"/> <a-textarea v-model:value="formState.addrMail" :disabled="isDisable" placeholder="请输入通讯地址" :auto-size="{ minRows: 1, maxRows: 5 }"/>
</a-form-item> </a-form-item>
</a-col> </a-col>
<a-col :span="8"> <a-col :span="8">
@ -128,7 +128,7 @@
</a-col> </a-col>
<a-col :span="24"> <a-col :span="24">
<a-form-item label="备注" name="note" :label-col="{ span: 3 }" :wrapper-col="{ span: 24 }"> <a-form-item label="备注" name="note" :label-col="{ span: 3 }" :wrapper-col="{ span: 24 }">
<a-textarea v-model:value="formState.note" placeholder="请输入备注最多200字" :maxlength="200" :auto-size="{ minRows: 2, maxRows: 5 }"/> <a-textarea v-model:value="formState.note" :disabled="isDisable" placeholder="请输入备注最多200字" :maxlength="200" :auto-size="{ minRows: 2, maxRows: 5 }"/>
</a-form-item> </a-form-item>
</a-col> </a-col>
</a-row> </a-row>
@ -138,7 +138,7 @@
<a-row> <a-row>
<a-col :span="8"> <a-col :span="8">
<a-form-item label="客户分类" name="classCode"> <a-form-item label="客户分类" name="classCode">
<a-select v-model:value="formState.classCode" placeholder="请选择客户分类" style="width: 100%" allow-clear> <a-select v-model:value="formState.classCode" :disabled="isDisable" placeholder="请选择客户分类" style="width: 100%" allow-clear>
<a-select-option v-for="item in optionSelect.classCodeList" :key="item.code" :value="item.code"> <a-select-option v-for="item in optionSelect.classCodeList" :key="item.code" :value="item.code">
{{ item.name }} {{ item.name }}
</a-select-option> </a-select-option>
@ -147,7 +147,7 @@
</a-col> </a-col>
<a-col :span="8"> <a-col :span="8">
<a-form-item label="客户类别" name="typeCode"> <a-form-item label="客户类别" name="typeCode">
<a-select v-model:value="formState.typeCode" placeholder="请选择客户类别" @change="typeCodeChange" style="width: 100%" allow-clear> <a-select v-model:value="formState.typeCode" :disabled="isDisable" placeholder="请选择客户类别" @change="typeCodeChange" style="width: 100%" allow-clear>
<a-select-option v-for="item in optionSelect.typeCodeList" :key="item.code" :value="item.code"> <a-select-option v-for="item in optionSelect.typeCodeList" :key="item.code" :value="item.code">
{{ item.name }} {{ item.name }}
</a-select-option> </a-select-option>
@ -156,7 +156,7 @@
</a-col> </a-col>
<a-col :span="8"> <a-col :span="8">
<a-form-item label="统计分类" name="propCode"> <a-form-item label="统计分类" name="propCode">
<a-select v-model:value="formState.propCode" placeholder="请选择统计分类" style="width: 100%" allow-clear> <a-select v-model:value="formState.propCode" :disabled="isDisable" placeholder="请选择统计分类" style="width: 100%" allow-clear>
<a-select-option v-for="item in optionSelect.propCodeList" :key="item.code" :value="item.code"> <a-select-option v-for="item in optionSelect.propCodeList" :key="item.code" :value="item.code">
{{ item.name }} {{ item.name }}
</a-select-option> </a-select-option>
@ -166,11 +166,11 @@
<a-col :span="8"> <a-col :span="8">
<a-form-item label="国有企业持股" name="stateSign" :offset="8"> <a-form-item label="国有企业持股" name="stateSign" :offset="8">
<div style="display: flex;"> <div style="display: flex;">
<a-radio-group v-model:value="formState.stateSign" style="display: flex;" @change="stateSignChange"> <a-radio-group v-model:value="formState.stateSign" :disabled="isDisable" style="display: flex;" @change="stateSignChange">
<a-radio v-for="item in optionSelect.signList" :value="item.code">{{ item.name }}</a-radio> <a-radio v-for="item in optionSelect.signList" :value="item.code">{{ item.name }}</a-radio>
</a-radio-group> </a-radio-group>
<a-form-item label="持股比例" name="rateShare" style="position: relative;"> <a-form-item label="持股比例" name="rateShare" style="position: relative;">
<a-input-number v-model:value="formState.rateShare" :disabled="formState.stateSign!='Y'" :min="0" :max="100"></a-input-number> <a-input-number v-model:value="formState.rateShare" style="width: 80px" :disabled="formState.stateSign!='Y' || isDisable" :min="0" :max="100"></a-input-number>
<span class="rateStyle">%</span> <span class="rateStyle">%</span>
</a-form-item> </a-form-item>
</div> </div>
@ -178,31 +178,31 @@
</a-col> </a-col>
<a-col :span="8"> <a-col :span="8">
<a-form-item label="第一大股东名称" name="shareName"> <a-form-item label="第一大股东名称" name="shareName">
<a-input v-model:value="formState.shareName" placeholder="请输入第一大股东名称" /> <a-input v-model:value="formState.shareName" :disabled="isDisable" placeholder="请输入第一大股东名称" />
</a-form-item> </a-form-item>
</a-col> </a-col>
<a-col :span="8"> <a-col :span="8">
<a-form-item label="集团持股比例" name="rateShareGn"> <a-form-item label="集团持股比例" name="rateShareGn">
<a-input-number v-model:value="formState.rateShareGn" style="width: 100%" :min="0" :max="100"></a-input-number> <a-input-number v-model:value="formState.rateShareGn" :disabled="isDisable" style="width: 100%" :min="0" :max="100"></a-input-number>
</a-form-item> </a-form-item>
</a-col> </a-col>
<a-col :span="8"> <a-col :span="8">
<a-form-item label="预付款校验" name="prepaySign"> <a-form-item label="预付款校验" name="prepaySign">
<a-radio-group v-model:value="formState.prepaySign"> <a-radio-group v-model:value="formState.prepaySign" :disabled="isDisable">
<a-radio v-for="item in optionSelect.signList" :value="item.code">{{ item.name }}</a-radio> <a-radio v-for="item in optionSelect.signList" :value="item.code">{{ item.name }}</a-radio>
</a-radio-group> </a-radio-group>
</a-form-item> </a-form-item>
</a-col> </a-col>
<a-col :span="8"> <a-col :span="8">
<a-form-item label="竞拍" name="onlineSign"> <a-form-item label="竞拍" name="onlineSign">
<a-radio-group v-model:value="formState.onlineSign"> <a-radio-group v-model:value="formState.onlineSign" :disabled="isDisable">
<a-radio v-for="item in optionSelect.signList" :value="item.code">{{ item.code == 'Y'?'': '' }}</a-radio> <a-radio v-for="item in optionSelect.signList" :value="item.code">{{ item.code == 'Y'?'': '' }}</a-radio>
</a-radio-group> </a-radio-group>
</a-form-item> </a-form-item>
</a-col> </a-col>
<a-col :span="8"> <a-col :span="8">
<a-form-item label="自有终端" name="tSign"> <a-form-item label="自有终端" name="tSign">
<a-radio-group v-model:value="formState.tSign"> <a-radio-group v-model:value="formState.tSign" :disabled="isDisable">
<a-radio v-for="item in optionSelect.signList" :value="item.code">{{ item.name }}</a-radio> <a-radio v-for="item in optionSelect.signList" :value="item.code">{{ item.name }}</a-radio>
</a-radio-group> </a-radio-group>
</a-form-item> </a-form-item>
@ -215,12 +215,12 @@
<a-row> <a-row>
<a-col :span="8"> <a-col :span="8">
<a-form-item label="装机量(万KW)" name="capacity"> <a-form-item label="装机量(万KW)" name="capacity">
<a-input-number v-model:value="formState.lngCustomerAttrPowerList[0].capacity" :disabled="formState.typeCode!='DC'" style="width: 100%" :min="0" placeholder="请输入机量"></a-input-number> <a-input-number v-model:value="formState.lngCustomerAttrPowerList[0].capacity" :disabled="formState.typeCode!='DC' || isDisable" style="width: 100%" :min="0" placeholder="请输入机量"></a-input-number>
</a-form-item> </a-form-item>
</a-col> </a-col>
<a-col :span="24"> <a-col :span="24">
<a-form-item label="备注" name="note" :label-col="{ span: 3 }" :wrapper-col="{ span: 24 }"> <a-form-item label="备注" name="note" :label-col="{ span: 3 }" :wrapper-col="{ span: 24 }">
<a-textarea v-model:value="formState.lngCustomerAttrPowerList[0].note" :disabled="formState.typeCode!='DC'" placeholder="请输入备注" :auto-size="{ minRows: 2, maxRows: 5 }"/> <a-textarea v-model:value="formState.lngCustomerAttrPowerList[0].note" :disabled="formState.typeCode!='DC' || isDisable" placeholder="请输入备注" :auto-size="{ minRows: 2, maxRows: 5 }"/>
</a-form-item> </a-form-item>
</a-col> </a-col>
</a-row> </a-row>
@ -235,11 +235,14 @@
<span style="font-size: 12px;font-weight: normal;">需上传证书营业执照危险化学品许可证/燃气经营许可证/危险化学品道路运输许可证等证书</span> <span style="font-size: 12px;font-weight: normal;">需上传证书营业执照危险化学品许可证/燃气经营许可证/危险化学品道路运输许可证等证书</span>
</div> </div>
</template> </template>
<a-button v-if="mode != 'view'" type="primary" style="margin-bottom: 10px;" @click="handleAdd('certificate')">新增证书</a-button> <a-button v-if="!isDisable" type="primary" style="margin-bottom: 10px;" @click="handleAdd('certificate')">新增证书</a-button>
<a-table :columns="columnsCertificate" :data-source="dataCertificate" > <a-table :columns="columnsCertificate" :data-source="dataCertificate" >
<template #bodyCell="{ column, record, index }"> <template #bodyCell="{ column, record, index }">
<template v-if="column.dataIndex === 'docTypeCode'">
{{ (optionSelect.docCpList.find(v=>v.code == record.docTypeCode) || {}).fullName }}
</template>
<template v-if="column.dataIndex === 'operation'"> <template v-if="column.dataIndex === 'operation'">
<a style="margin-right: 10px" @click="btnCheck('certificate', 'edit', record)">编辑</a> <a style="margin-right: 10px" @click="btnCheck('certificate', 'edit', record, index)">编辑</a>
<a style="margin-right: 10px" @click="btnCheck('certificate', 'delete', record, index)">删除</a> <a style="margin-right: 10px" @click="btnCheck('certificate', 'delete', record, index)">删除</a>
<a style="margin-right: 10px" @click="btnCheck('certificate', 'view', record)">查看</a> <a style="margin-right: 10px" @click="btnCheck('certificate', 'view', record)">查看</a>
<ArrowUpOutlined style="margin-right: 10px;" class="btn" @click="btnCheck('certificate', 'up', record, index)" /> <ArrowUpOutlined style="margin-right: 10px;" class="btn" @click="btnCheck('certificate', 'up', record, index)" />
@ -256,11 +259,14 @@
<span style="font-size: 12px;font-weight: normal;">至少填写一条银行信息</span> <span style="font-size: 12px;font-weight: normal;">至少填写一条银行信息</span>
</div> </div>
</template> </template>
<a-button v-if="mode != 'view'" type="primary" style="margin-bottom: 10px;" @click="handleAdd('bank')">新增银行账户</a-button> <a-button v-if="!isDisable" type="primary" style="margin-bottom: 10px;" @click="handleAdd('bank')">新增银行账户</a-button>
<a-table :columns="columnsBank" :data-source="dataBank" > <a-table :columns="columnsBank" :data-source="dataBank" >
<template #bodyCell="{ column, record, index }"> <template #bodyCell="{ column, record, index }">
<template v-if="column.dataIndex === 'defaultSign'">
{{ (optionSelect.signList.find(v=>v.code == record.defaultSign) || {}).name }}
</template>
<template v-if="column.dataIndex === 'operation'"> <template v-if="column.dataIndex === 'operation'">
<a style="margin-right: 10px" @click="btnCheck('bank', 'edit', record)">编辑</a> <a style="margin-right: 10px" @click="btnCheck('bank', 'edit', record, index)">编辑</a>
<a style="margin-right: 10px" @click="btnCheck('bank', 'delete', record, index)">删除</a> <a style="margin-right: 10px" @click="btnCheck('bank', 'delete', record, index)">删除</a>
</template> </template>
</template> </template>
@ -274,11 +280,11 @@
<span style="font-size: 12px;font-weight: normal;">至少填写一条联系人信息</span> <span style="font-size: 12px;font-weight: normal;">至少填写一条联系人信息</span>
</div> </div>
</template> </template>
<a-button v-if="mode != 'view'" type="primary" style="margin-bottom: 10px;" @click="handleAdd('contact')">新增联系人</a-button> <a-button v-if="!isDisable" type="primary" style="margin-bottom: 10px;" @click="handleAdd('contact')">新增联系人</a-button>
<a-table :columns="columnsContact" :data-source="dataContact" > <a-table :columns="columnsContact" :data-source="dataContact" >
<template #bodyCell="{ column, record, index }"> <template #bodyCell="{ column, record, index }">
<template v-if="column.dataIndex === 'operation'"> <template v-if="column.dataIndex === 'operation'">
<a style="margin-right: 10px" @click="btnCheck('contact', 'edit', record)">编辑</a> <a style="margin-right: 10px" @click="btnCheck('contact', 'edit', record, index)">编辑</a>
<a style="margin-right: 10px" @click="btnCheck('contact', 'delete', record, index)">删除</a> <a style="margin-right: 10px" @click="btnCheck('contact', 'delete', record, index)">删除</a>
</template> </template>
</template> </template>
@ -292,6 +298,7 @@
</div> </div>
</template> </template>
<a-upload <a-upload
v-if="!isDisable"
:multiple="true" :multiple="true"
:showUploadList="false" :showUploadList="false"
name="file" name="file"
@ -310,7 +317,7 @@
<a :href="record.filePath" :download="record.fileOrg" target="_blank">{{record.fileOrg}}</a> <a :href="record.filePath" :download="record.fileOrg" target="_blank">{{record.fileOrg}}</a>
</template> </template>
<template v-if="column.dataIndex === 'docDesc'"> <template v-if="column.dataIndex === 'docDesc'">
<a-input :placeholder="t('请输入附件说明')" v-model:value="record.docDesc" /> <a-input :placeholder="t('请输入附件说明')" :disabled="isDisable" v-model:value="record.docDesc" />
</template> </template>
<template v-if="column.dataIndex === 'operation'"> <template v-if="column.dataIndex === 'operation'">
<a style="margin-right: 10px" @click="btnCheck('file', 'delete', record, index)">删除</a> <a style="margin-right: 10px" @click="btnCheck('file', 'delete', record, index)">删除</a>
@ -331,17 +338,17 @@
<script lang="ts" setup> <script lang="ts" setup>
import { useRouter } from 'vue-router'; import { useRouter } from 'vue-router';
import { FromPageType } from '/@/enums/workflowEnum'; import { FromPageType } from '/@/enums/workflowEnum';
import { ref, computed, onMounted, onBeforeMount, nextTick, defineAsyncComponent, reactive, defineComponent} from 'vue'; import { ref, computed, onMounted, onBeforeMount, nextTick, defineAsyncComponent, reactive, defineComponent, watch} from 'vue';
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 { CheckCircleOutlined, StopOutlined, CloseOutlined, UploadOutlined, SaveOutlined, DownloadOutlined,ArrowUpOutlined, ArrowDownOutlined } from '@ant-design/icons-vue'; import { CheckCircleOutlined, StopOutlined, CloseOutlined, UploadOutlined, SaveOutlined, DownloadOutlined,ArrowUpOutlined, ArrowDownOutlined } from '@ant-design/icons-vue';
import { useMultipleTabStore } from '/@/store/modules/multipleTab'; import { useMultipleTabStore } from '/@/store/modules/multipleTab';
import useEventBus from '/@/hooks/event/useEventBus'; import useEventBus from '/@/hooks/event/useEventBus';
import type { Rule } from 'ant-design-vue/es/form'; import type { Rule } from 'ant-design-vue/es/form';
import { getDictionary } from '/@/api/sales/Customer'; import { getDocCpList, getDictionary } from '/@/api/sales/Customer';
import certificateModal from './components/certificateModal.vue'; import certificateModal from './certificateModal.vue';
import contactModal from './components/contactModal.vue'; import contactModal from './contactModal.vue';
import bankModal from './components/bankModal.vue'; import bankModal from './bankModal.vue';
import { useModal } from '/@/components/Modal'; import { useModal } from '/@/components/Modal';
import { addLngCustomer,updateLngCustomer,getLngCustomer } from '/@/api/sales/Customer'; import { addLngCustomer,updateLngCustomer,getLngCustomer } from '/@/api/sales/Customer';
import dayjs from 'dayjs'; import dayjs from 'dayjs';
@ -350,25 +357,30 @@
import { uploadSrc, uploadBlobApi } from '/@/api/sys/upload'; import { uploadSrc, uploadBlobApi } from '/@/api/sys/upload';
import { message } from 'ant-design-vue'; import { message } from 'ant-design-vue';
const dynamicComponent = ref(null);
const formType = ref('2'); // 0 1 2 const formType = ref('2'); // 0 1 2
const formRef = ref(); const formRef = ref();
const props = defineProps({}); const props = defineProps({
disabled: false,
id: ''
});
const { bus, FORM_LIST_MODIFIED } = useEventBus(); const { bus, FORM_LIST_MODIFIED } = useEventBus();
const router = useRouter(); const router = useRouter();
const { currentRoute } = router; const { currentRoute } = router;
const isDisable = ref(false);
const { formPath } = currentRoute.value.query; const { formPath } = currentRoute.value.query;
const pathArr = formPath.split('/'); const pathArr = [];
const tabStore = useMultipleTabStore(); const tabStore = useMultipleTabStore();
const formProps = ref(null); const formProps = ref(null);
const formId = ref(currentRoute.value?.params?.id); const formId = ref(currentRoute.value?.params?.id);
const pageType = ref(currentRoute.value?.params?.type); const pageType = ref(currentRoute.value.query?.type);
const pageId = ref(currentRoute.value?.params?.id || ''); const pageId = ref(currentRoute.value.query?.id)
const spinning = ref(false);
const spinning = ref(false);
const curIdx = ref(null)
const { notification } = useMessage(); const { notification } = useMessage();
const { t } = useI18n(); const { t } = useI18n();
const data = reactive({ const data = reactive({
@ -393,7 +405,7 @@
const [registerContact, { openModal:openModalContact }] = useModal(); const [registerContact, { openModal:openModalContact }] = useModal();
const [registerBank, { openModal:openModalBank}] = useModal(); const [registerBank, { openModal:openModalBank}] = useModal();
const fileList = reactive([])
const rules: Record<string, Rule[]> = { const rules: Record<string, Rule[]> = {
cuMcode: [{ required: true, message: "该项为必填项", trigger: 'change' }], cuMcode: [{ required: true, message: "该项为必填项", trigger: 'change' }],
di: [{ required: true, message: "该项为必填项", trigger: 'change' }], di: [{ required: true, message: "该项为必填项", trigger: 'change' }],
@ -413,7 +425,7 @@
const columnsCertificate = ref([ const columnsCertificate = ref([
{ title: t('序号'), dataIndex: 'index', key: 'index', sorter: true, customRender: (column) => `${column.index + 1}` ,width: 100}, { title: t('序号'), dataIndex: 'index', key: 'index', sorter: true, customRender: (column) => `${column.index + 1}` ,width: 100},
{ title: t('资质证书名称'), dataIndex: 'docNo', sorter: true, width:200}, { title: t('资质证书名称'), dataIndex: 'docTypeCode', sorter: true, width:200},
{ title: t('有效期开始'), dataIndex: 'dateFrom', sorter: true, width: 140}, { title: t('有效期开始'), dataIndex: 'dateFrom', sorter: true, width: 140},
{ title: t('有效期结束'), dataIndex: 'dateTo', sorter: true, width: 140}, { title: t('有效期结束'), dataIndex: 'dateTo', sorter: true, width: 140},
{ title: t('备注'), dataIndex: 'note', sorter: true}, { title: t('备注'), dataIndex: 'note', sorter: true},
@ -456,10 +468,24 @@
classCodeList: [], classCodeList: [],
typeCodeList: [], typeCodeList: [],
propCodeList: [], propCodeList: [],
signList: [] signList: [],
docCpList: []
}); });
watch(
() => props.id,
(val) => {
if (val) {
if (val) {
getList(val)
}
}
},
{
immediate: true
}
);
onMounted(() => { onMounted(() => {
isDisable.value = props.disabled || false
getOption() getOption()
if (pageId.value) { if (pageId.value) {
getList(pageId.value) getList(pageId.value)
@ -487,7 +513,7 @@
optionSelect.validList = await getDictionary('LNG_VALID') optionSelect.validList = await getDictionary('LNG_VALID')
optionSelect.approCodeList = await getDictionary('LNG_APPRO') optionSelect.approCodeList = await getDictionary('LNG_APPRO')
optionSelect.docCpList = await getDocCpList({'valid': 'Y'})
} }
function stateSignChange(val) { function stateSignChange(val) {
if (val!='Y'){ if (val!='Y'){
@ -501,6 +527,7 @@
} }
} }
const handleAdd = (val)=> { const handleAdd = (val)=> {
curIdx.value = null
if (val ==='certificate') { if (val ==='certificate') {
openModalCertificate(true,{isUpdate: false}); openModalCertificate(true,{isUpdate: false});
} }
@ -514,6 +541,8 @@
} }
const btnCheck = (type, btn, record, index) => { const btnCheck = (type, btn, record, index) => {
console.log(index, 555, type, ) console.log(index, 555, type, )
curIdx.value = null
btn=='edit' && (curIdx.value = index)
// //
if (type == 'certificate') { if (type == 'certificate') {
if (btn == 'edit' || btn == 'view') { if (btn == 'edit' || btn == 'view') {
@ -575,20 +604,29 @@
} }
} }
} }
const swapItems = (arr, index1, index2,direction) =>{
arr[index1] = arr.splice(index2, 1, arr[index1])[0];
return arr;
};
const handleSuccessCertificate = (val) => { const handleSuccessCertificate = (val) => {
//
if (curIdx.value != null) {
dataCertificate[curIdx.value] = {...val}
return
}
let idx =dataCertificate.findIndex(v => v.docTypeCode == val.docTypeCode) let idx =dataCertificate.findIndex(v => v.docTypeCode == val.docTypeCode)
if (idx <0) { if (idx <0) {
dataCertificate.push(val) dataCertificate.push(val)
} }
} }
const handleSuccessContact = (val)=> { const handleSuccessContact = (val)=> {
if (curIdx.value != null) {
dataContact[curIdx.value] = {...val}
return
}
dataContact.push(val) dataContact.push(val)
} }
const handleSuccessBank = (val) => { const handleSuccessBank = (val) => {
if (curIdx.value != null) {
dataBank[curIdx.value] = {...val}
return
}
dataBank.push(val) dataBank.push(val)
} }
function handleChangeFile(info) { function handleChangeFile(info) {
@ -621,28 +659,6 @@
} }
dynamicComponent.value = defineAsyncComponent({
loader: () => import(`./../../views/${pathArr[0]}/${pathArr[1]}/components/Form.vue`)
});
function onFormMounted(_formProps) {
formProps.value = _formProps;
setFormType();
}
async function setFormType() {
const _mode = mode.value;
if (_mode === 'create') {
return;
}
await nextTick();
if (_mode === 'view') {
await formRef.value.setDisabledForm();
}
await formRef.value.setFormDataFromId(formId.value);
}
function close() { function close() {
tabStore.closeTab(currentRoute.value, router); tabStore.closeTab(currentRoute.value, router);
} }
@ -676,37 +692,43 @@
lngCustomerBankList: dataBank, lngCustomerBankList: dataBank,
lngCustomerDocList: dataCertificate, lngCustomerDocList: dataCertificate,
lngCustomerContactList: dataContact, lngCustomerContactList: dataContact,
lngFileUploadList: dataFile
} }
spinning.value = true; spinning.value = true;
let request = pageType.value === 'add' ? addLngCustomer :updateLngCustomer let request = pageType.value === 'add' ? addLngCustomer :updateLngCustomer
try { try {
obj.lngCustomerDocList.forEach(v => { obj.lngCustomerDocList.forEach(v => {
v.dateFrom = dayjs(v.dateFrom ).valueOf() v.dateFrom = dayjs(v.dateFrom ).valueOf()
v.dateTo = dayjs(v.dateTo ).valueOf() v.dateTo = dayjs(v.dateTo ).valueOf()
}) })
await request(obj); const data = await addLngCustomer(obj);
notification.success({ obj.id = data
message: 'Tip', // notification.success({
description: pageType.value === 'add' ? t('新增成功!') : t('修改成功!') // message: 'Tip',
}); // // description: pageType.value === 'add' ? t('') : t('')
formRef.value.resetFields(); // }); //
setTimeout(() => { // formRef.value.resetFields();
bus.emit(FORM_LIST_MODIFIED, { path: formPath }); return obj
close(); // setTimeout(() => {
}, 1000); // bus.emit(FORM_LIST_MODIFIED, { path: formPath });
// close();
// }, 1000);
} finally { } finally {
spinning.value = false; spinning.value = false;
} }
} catch (errorInfo) { } catch (errorInfo) {
notification.warning({ spinning.value = false;
console.log(errorInfo, 'errorInfo')
errorInfo?.value && notification.warning({
message: 'Tip', message: 'Tip',
description: '请完善信息' description: '请完善信息'
}); });
return false
} }
} }
@ -736,6 +758,11 @@
console.error('saveModal Error: ', error); console.error('saveModal Error: ', error);
} }
} }
defineExpose({
handleSubmit,
});
</script> </script>
<style lang="less" scoped> <style lang="less" scoped>

View File

@ -159,7 +159,8 @@
query: { query: {
taskId: taskIds[0], taskId: taskIds[0],
formName: formName, formName: formName,
formId:currentRoute.value.meta.formId formId:currentRoute.value.meta.formId,
id: record.id
} }
}); });
} else if (schemaId && !taskIds && processId) { } else if (schemaId && !taskIds && processId) {
@ -169,7 +170,8 @@
readonly: 1, readonly: 1,
taskId: '', taskId: '',
formName: formName, formName: formName,
formId:currentRoute.value.meta.formId formId:currentRoute.value.meta.formId,
id: record.id
} }
}); });
} else { } else {
@ -212,7 +214,18 @@
} }
function handleEdit(record: Recordable) { function handleEdit(record: Recordable) {
if (schemaIdComputedRef.value) {
router.push({
path: '/flow/' + schemaIdComputedRef.value + '/0/createFlow',
query: {
formPath: 'sales/Customer',
formName: formName,
formId:currentRoute.value.meta.formId,
type:'edit',
id: record.id
}
});
} else {
router.push({ router.push({
path: '/form/Customer/' + record.id + '/createFormCustomer', path: '/form/Customer/' + record.id + '/createFormCustomer',
query: { query: {
@ -224,6 +237,8 @@
} }
}); });
} }
}
function handleDelete(record: Recordable) { function handleDelete(record: Recordable) {
deleteList([record.id]); deleteList([record.id]);
} }
@ -381,7 +396,8 @@
query: { query: {
readonly: 1, readonly: 1,
taskId: '', taskId: '',
formName: formName formName: formName,
id: record.id
} }
}); });
} }

View File

@ -0,0 +1,7 @@
<template>
<div> 加载中 </div>
</template>
<script setup lang="ts"></script>
<style scoped></style>

View File

@ -38,7 +38,9 @@
</template> </template>
</a-space> </a-space>
</div> </div>
<component v-if="customFormConfig.codeList.includes(curPageCode)" :is="componentName" :disabled="readonly" />
<FormInformation <FormInformation
v-else
:key="renderKey" :key="renderKey"
ref="formInformation" ref="formInformation"
:disabled="readonly" :disabled="readonly"
@ -74,7 +76,7 @@
<script setup> <script setup>
import { useRouter } from 'vue-router'; import { useRouter } from 'vue-router';
import { onMounted, reactive, ref, unref, createVNode, provide } from 'vue'; import { onMounted, reactive, ref, unref, createVNode, provide,computed,defineAsyncComponent } from 'vue';
import FormInformation from '/@/views/secondDev/FormInformation.vue'; import FormInformation from '/@/views/secondDev/FormInformation.vue';
import userTaskItem from '/@/views/workflow/task/hooks/userTaskItem'; import userTaskItem from '/@/views/workflow/task/hooks/userTaskItem';
import { getApprovalProcess, postApproval, postGetNextTaskMaybeArrival, postTransfer, getDrawNode, withdraw } from '/@/api/workflow/task'; import { getApprovalProcess, postApproval, postGetNextTaskMaybeArrival, postTransfer, getDrawNode, withdraw } from '/@/api/workflow/task';
@ -97,6 +99,7 @@
import { TaskTypeUrl } from '/@/enums/workflowEnum'; import { TaskTypeUrl } from '/@/enums/workflowEnum';
import { postSetSign, postSetSignV2 } from '/@/api/workflow/task'; import { postSetSign, postSetSignV2 } from '/@/api/workflow/task';
import FlowRecord from '/@/views/workflow/task/components/flow/FlowRecord.vue'; import FlowRecord from '/@/views/workflow/task/components/flow/FlowRecord.vue';
import {customFormConfig} from './customFormConfig'
const spinning = ref(false); const spinning = ref(false);
const userStore = useUserStore(); const userStore = useUserStore();
@ -175,6 +178,16 @@
}); });
let approvedType = ref(ApproveType.AGREE); let approvedType = ref(ApproveType.AGREE);
const componentName = computed(() => {
if (!data.formInfos.length) {
return defineAsyncComponent({
loader: () => import('/@/views/secondDev/Empty.vue')
});
}
return defineAsyncComponent({
loader: () => import(`/@/views/${data.formInfos[0]?.functionalModule}/${data.formInfos[0]?.functionName}/components/createForm.vue`)
});
});
function showButton(btn) { function showButton(btn) {
// 撤回有drawNode才显示流程图任何情况下都显示 // 撤回有drawNode才显示流程图任何情况下都显示
let show = let show =
@ -570,10 +583,11 @@
return data.taskApproveOpinions || []; return data.taskApproveOpinions || [];
} }
} }
const curPageCode = ref()
onMounted(async () => { onMounted(async () => {
try { try {
let res = await getApprovalProcess(unref(taskId), unref(processId)); let res = await getApprovalProcess(unref(taskId), unref(processId));
curPageCode.value = res?.schemaInfo?.code
initProcessData(res); initProcessData(res);
await getBackNode(); await getBackNode();
processInfo.value = res; processInfo.value = res;

View File

@ -32,7 +32,8 @@
</a-space> </a-space>
</div> </div>
<div class="flow-content"> <div class="flow-content">
<FormInformation :key="randKey" ref="formInformation" :disabled="false" :formAssignmentData="data.formAssignmentData" :formInfos="data.formInfos" :opinions="data.opinions" :opinionsComponents="data.opinionsComponents" /> <component v-if="customFormConfig.codeList.includes(curPageCode)" :is="componentName" ref="formInformation" />
<FormInformation v-else :key="randKey" ref="formInformation" :disabled="false" :formAssignmentData="data.formAssignmentData" :formInfos="data.formInfos" :opinions="data.opinions" :opinionsComponents="data.opinionsComponents" />
</div> </div>
</div> </div>
<a-modal :visible="showFlowChart" centered class="geg" closable title="流程图" width="1200px" @cancel="closeFlowChart"> <a-modal :visible="showFlowChart" centered class="geg" closable title="流程图" width="1200px" @cancel="closeFlowChart">
@ -54,7 +55,7 @@
import { getStartProcessInfo, getReStartProcessInfo, reLaunch, postLaunch, postApproval, postGetNextTaskMaybeArrival } from '/@/api/workflow/task'; import { getStartProcessInfo, getReStartProcessInfo, reLaunch, postLaunch, postApproval, postGetNextTaskMaybeArrival } from '/@/api/workflow/task';
import { useMultipleTabStore } from '/@/store/modules/multipleTab'; import { useMultipleTabStore } from '/@/store/modules/multipleTab';
import { CloseOutlined, SendOutlined, ClockCircleOutlined, PrinterOutlined, ApartmentOutlined } from '@ant-design/icons-vue'; import { CloseOutlined, SendOutlined, ClockCircleOutlined, PrinterOutlined, ApartmentOutlined } from '@ant-design/icons-vue';
import { nextTick, onMounted, ref, toRaw, reactive } from 'vue'; import { nextTick, onMounted, ref, toRaw, reactive, computed, defineAsyncComponent } from 'vue';
import { deleteDraft, postDraft, putDraft } from '/@/api/workflow/process'; import { deleteDraft, postDraft, putDraft } from '/@/api/workflow/process';
import { useI18n } from '/@/hooks/web/useI18n'; import { useI18n } from '/@/hooks/web/useI18n';
import { separator } from '/@bpmn/config/info'; import { separator } from '/@bpmn/config/info';
@ -62,12 +63,13 @@
import OpinionDialog from '/@/components/SecondDev/OpinionDialog.vue'; import OpinionDialog from '/@/components/SecondDev/OpinionDialog.vue';
import { ApproveCode, ApproveType } from '/@/enums/workflowEnum'; import { ApproveCode, ApproveType } from '/@/enums/workflowEnum';
import useEventBus from '/@/hooks/event/useEventBus'; import useEventBus from '/@/hooks/event/useEventBus';
import {customFormConfig} from './customFormConfig'
const { bus, CREATE_FLOW } = useEventBus(); const { bus, CREATE_FLOW } = useEventBus();
const router = useRouter(); const router = useRouter();
const tabStore = useMultipleTabStore(); const tabStore = useMultipleTabStore();
const curPageCode = ref()
const { t } = useI18n(); const { t } = useI18n();
const { data, approveUserData, initProcessData, notificationSuccess, notificationError } = userTaskItem(); const { data, approveUserData, initProcessData, notificationSuccess, notificationError } = userTaskItem();
const currentRoute = router.currentRoute.value; const currentRoute = router.currentRoute.value;
@ -130,6 +132,17 @@
} }
}); });
const componentName = computed(() => {
if (!data.formInfos.length) {
return defineAsyncComponent({
loader: () => import('/@/views/secondDev/Empty.vue')
});
}
return defineAsyncComponent({
loader: () => import(`/@/views/${data.formInfos[0]?.functionalModule}/${data.formInfos[0]?.functionName}/components/createForm.vue`)
});
});
onMounted(async () => { onMounted(async () => {
try { try {
// 发起流程 // 发起流程
@ -139,6 +152,7 @@
const tabPrefix = pageMode === 'new' ? '新建' : '草稿'; const tabPrefix = pageMode === 'new' ? '新建' : '草稿';
tabStore.changeTitle(fullPath, `${tabPrefix}${title}`); tabStore.changeTitle(fullPath, `${tabPrefix}${title}`);
} }
curPageCode.value = res?.schemaInfo?.code
initProcessData(res); initProcessData(res);
} catch (error) {} } catch (error) {}
randKey.value = Math.random() + ''; randKey.value = Math.random() + '';
@ -272,8 +286,18 @@
async function getApproveParams() { async function getApproveParams() {
let formModels = mainFormModels.value; let formModels = mainFormModels.value;
let system = formInformation.value.getSystemType(); let fileFolderIds = []
let fileFolderIds = getUploadFileFolderIds(formModels); let system = {}
if (customFormConfig.codeList.includes(curPageCode.value)) {
let key = data.formInfos[0]?.formConfig?.key
let obj = {}
system[key] = false
fileFolderIds = []
} else {
system = formInformation.value.getSystemType();
fileFolderIds = getUploadFileFolderIds(formModels);
}
return { return {
approvedType: approvalData.approvedType, approvedType: approvalData.approvedType,
approvedResult: approvalData.approvedResult, // approvalData.approvedType 审批结果 如果为 4 就需要传buttonCode approvedResult: approvalData.approvedResult, // approvalData.approvedType 审批结果 如果为 4 就需要传buttonCode
@ -291,7 +315,115 @@
}; };
} }
async function saveLaunchNew() {
if (!taskId.value && rDraftsId.value != '0') {
try {
await new Promise((resolve, reject) => {
Modal.confirm({
title: '提示',
content: '请确认是否提交流程,提交后流程不能删除',
okText: '确定',
cancelText: '取消',
onOk: () => resolve(),
onCancel: () => reject()
});
});
} catch {
return;
}
}
try {
// let validateForms = await formInformation.value.validateForm();
// let system = formInformation.value.getSystemType();
let key = data.formInfos[0]?.formConfig?.key
let system = {}
let obj = {}
system[key] = false
let value = await formInformation.value.handleSubmit(true);
obj[key] = value
mainFormModels.value = obj
console.log(mainFormModels.value, 6666)
if (!value) return
data.submitLoading = true;
loading.value = true;
// if (validateForms.length > 0) {
// let successValidate = validateForms.filter((ele) => {
// return ele.validate;
// });
// console.info('validateForms:' + JSON.stringify(validateForms));
// if (successValidate.length == validateForms.length) {
// mainFormModels.value = await formInformation.value.getFormModels(true);
/*for (let i in mainFormModels.value) {
const item = mainFormModels.value[i];
if (!item['_id']) {
throw new Error('发起失败');
} else {
delete item['_id'];
}
}*/
let relationTasks = [];
if (data.predecessorTasks && data.predecessorTasks.length > 0) {
relationTasks = data.predecessorTasks.map((ele) => {
return { taskId: ele.taskId, schemaId: ele.schemaId };
});
}
// let fileFolderIds = getUploadFileFolderIds(mainFormModels.value);
let fileFolderIds = []
if (taskId.value) {
// 如果在草稿节点取消,重新从草稿开始走
return createFlowSuccess(true);
}
//如果传入了processId 代表是重新发起流程
let res;
res = await postLaunch(rSchemaId, mainFormModels.value, relationTasks, fileFolderIds, system);
// 下一节点审批人
let taskList = [];
if (res && res.length > 0) {
taskId.value = res[0].taskId;
taskList = res
.filter((ele) => {
return ele.isMultiInstance == false && ele.isAppoint == true;
})
.map((ele) => {
return {
taskId: ele.taskId,
taskName: ele.taskName,
provisionalApprover: ele.provisionalApprover,
selectIds: []
};
});
const strictDesign = false;
console.log(taskList, 'taskList')
if (strictDesign && taskList.length > 0) {
notificationError('提交失败', '流程设计错误,开始后的第一个节点必须是审批人为发起人的起草节点。');
data.submitLoading = false;
loading.value = false;
} else {
createFlowSuccess(taskList);
}
} else {
createFlowSuccess();
}
// } else {
// data.submitLoading = false;
// notificationError(t('发起流程'), t('表单校验未通过'));
// loading.value = false;
// }
// }
} catch (error) {
console.log(error, 'error')
data.submitLoading = false;
loading.value = false;
notificationError(t('发起流程'), t('发起流程失败'));
}
}
async function saveLaunch() { async function saveLaunch() {
if (customFormConfig.codeList.includes(curPageCode.value)){
saveLaunchNew()
return
}
if (!taskId.value && rDraftsId.value != '0') { if (!taskId.value && rDraftsId.value != '0') {
try { try {
await new Promise((resolve, reject) => { await new Promise((resolve, reject) => {

View File

@ -0,0 +1,6 @@
export const customFormConfig = {
codeList: ['addCustomer'],
router: [
{code: 'addCustomer', src: ''}
]
};

View File

@ -10,6 +10,8 @@
<template #left> <template #left>
<FlowPanel :xml="data.xml" :taskRecords="data.taskRecords" :predecessorTasks="selectedPredecessorTasks" :processId="props.processId" :schemaId="props.schemaId" position="top"> <FlowPanel :xml="data.xml" :taskRecords="data.taskRecords" :predecessorTasks="selectedPredecessorTasks" :processId="props.processId" :schemaId="props.schemaId" position="top">
<FormInformation <FormInformation
:curPageCode="curPageCode"
:id="id"
:opinionsComponents="data.opinionsComponents" :opinionsComponents="data.opinionsComponents"
:opinions="data.opinions" :opinions="data.opinions"
:disabled="false" :disabled="false"
@ -143,12 +145,14 @@
schemaId: string; schemaId: string;
processId: string; processId: string;
taskId: string; taskId: string;
id: string;
visible?: boolean; visible?: boolean;
}>(), }>(),
{ {
schemaId: '', schemaId: '',
processId: '', processId: '',
taskId: '', taskId: '',
id: '',
visible: false visible: false
} }
); );
@ -210,7 +214,8 @@
return ele.taskId; return ele.taskId;
}); });
}); });
const curPageCode = ref()
const id = ref()
// 审批 // 审批
async function approval() { async function approval() {
showLoading.value = true; showLoading.value = true;
@ -218,6 +223,8 @@
if (props.taskId) { if (props.taskId) {
try { try {
let res = await getApprovalProcess(props.taskId, props.processId); let res = await getApprovalProcess(props.taskId, props.processId);
curPageCode.value = res?.schemaInfo?.code
id.value = res?.formInfos[0]?.formData?.id
initProcessData(res); initProcessData(res);
if (res.buttonConfigs) { if (res.buttonConfigs) {
approvalData.buttonConfigs = res.buttonConfigs; approvalData.buttonConfigs = res.buttonConfigs;

View File

@ -35,6 +35,10 @@
<div id="approveExtendButton"></div> <div id="approveExtendButton"></div>
<div id="approveRightButton"></div> <div id="approveRightButton"></div>
</div> </div>
<div style="height: 500px;" v-if="customFormConfig.codeList.includes(props.curPageCode)">
<component :id="props.id" :is="componentName" :disabled="props.disabled" />
</div>
<div v-else>
<SystemForm class="form-box" v-if="item.formType == FormType.SYSTEM" :systemComponent="item.systemComponent" :isViewProcess="props.disabled" :formModel="item.formModel" :workflowConfig="item" :ref="setItemRef" /> <SystemForm class="form-box" v-if="item.formType == FormType.SYSTEM" :systemComponent="item.systemComponent" :isViewProcess="props.disabled" :formModel="item.formModel" :workflowConfig="item" :ref="setItemRef" />
<SimpleForm v-else-if="item.formType == FormType.CUSTOM" class="form-box testClass" :ref="setItemRef" :formProps="item.formProps" :formModel="item.formModel" :isWorkFlow="true" /> <SimpleForm v-else-if="item.formType == FormType.CUSTOM" class="form-box testClass" :ref="setItemRef" :formProps="item.formProps" :formModel="item.formModel" :isWorkFlow="true" />
</div> </div>
@ -43,6 +47,7 @@
</div> </div>
</div> </div>
</div> </div>
</div>
</template> </template>
<script setup lang="ts"> <script setup lang="ts">
@ -50,7 +55,7 @@
import { FewerLeft, FewerRight } from '/@/components/ModalPanel'; import { FewerLeft, FewerRight } from '/@/components/ModalPanel';
import { NodeHead } from '/@/components/ModalPanel/index'; import { NodeHead } from '/@/components/ModalPanel/index';
import IconFontSymbol from '/@/components/IconFontSymbol/Index.vue'; import IconFontSymbol from '/@/components/IconFontSymbol/Index.vue';
import { onBeforeUpdate, nextTick, onMounted, reactive, computed, ref } from 'vue'; import { onBeforeUpdate, nextTick, onMounted, reactive, computed, ref, defineAsyncComponent } from 'vue';
import { TaskApproveOpinion, ValidateForms } from '/@/model/workflow/bpmnConfig'; import { TaskApproveOpinion, ValidateForms } from '/@/model/workflow/bpmnConfig';
import { cloneDeep } from 'lodash-es'; import { cloneDeep } from 'lodash-es';
import { useI18n } from '/@/hooks/web/useI18n'; import { useI18n } from '/@/hooks/web/useI18n';
@ -62,6 +67,7 @@
import { createFormEvent, loadFormEvent, submitFormEvent } from '/@/hooks/web/useFormEvent'; import { createFormEvent, loadFormEvent, submitFormEvent } from '/@/hooks/web/useFormEvent';
import { message } from 'ant-design-vue'; import { message } from 'ant-design-vue';
import { updateWorkflow } from '/@/api/workflow/adminOperation'; import { updateWorkflow } from '/@/api/workflow/adminOperation';
import {customFormConfig} from '/@/views/secondDev/customFormConfig'
const { t } = useI18n(); const { t } = useI18n();
const props = withDefaults( const props = withDefaults(
defineProps<{ defineProps<{
@ -71,13 +77,17 @@
opinionsComponents?: Array<string> | undefined; opinionsComponents?: Array<string> | undefined;
formAssignmentData?: null | Recordable; formAssignmentData?: null | Recordable;
processId: string; processId: string;
curPageCode: string;
id: string;
}>(), }>(),
{ {
disabled: false, disabled: false,
formInfos: () => { formInfos: () => {
return []; return [];
}, },
processId: '' processId: '',
curPageCode: '',
id: ''
} }
); );
@ -143,6 +153,16 @@
formEventConfigs: [], formEventConfigs: [],
modes: [] modes: []
}); });
const componentName = computed(() => {
if (!props.formInfos.length) {
return defineAsyncComponent({
loader: () => import('/@/views/secondDev/Empty.vue')
});
}
return defineAsyncComponent({
loader: () => import(`/@/views/${props.formInfos[0]?.functionalModule}/${props.formInfos[0]?.functionName}/components/createForm.vue`)
});
});
onMounted(async () => { onMounted(async () => {
for await (let element of props.formInfos) { for await (let element of props.formInfos) {
let formModels = {}; let formModels = {};

View File

@ -14,7 +14,7 @@
:formDataId="data.formInfos[0].formData.id" :formDataId="data.formInfos[0].formData.id"
:formInfos="data.formInfos" :formInfos="data.formInfos"
> >
<FormInformation :opinionsComponents="data.opinionsComponents" :opinions="data.opinions" :formInfos="data.formInfos" :disabled="true" :processId="props.processId" /> <FormInformation :curPageCode="curPageCode" :id="id" :opinionsComponents="data.opinionsComponents" :opinions="data.opinions" :formInfos="data.formInfos" :disabled="true" :processId="props.processId" />
</FlowPanel> </FlowPanel>
</template> </template>
@ -27,11 +27,15 @@
let props = defineProps(['position', 'processId', 'taskId', 'schemaId']); let props = defineProps(['position', 'processId', 'taskId', 'schemaId']);
let visible = ref(false); let visible = ref(false);
const { data, initProcessData } = userTaskItem(); const { data, initProcessData } = userTaskItem();
const curPageCode = ref()
const id = ref()
onMounted(async () => { onMounted(async () => {
try { try {
let res = await getApprovalProcess(props.taskId, props.processId); let res = await getApprovalProcess(props.taskId, props.processId);
initProcessData(res); initProcessData(res);
visible.value = true; visible.value = true;
curPageCode.value = res?.schemaInfo?.code
id.value = res?.formInfos[0]?.formData?.id
console.error('555555', data); console.error('555555', data);
} catch (error) {} } catch (error) {}
}); });