This commit is contained in:
2025-12-02 10:39:31 +08:00
14 changed files with 608 additions and 283 deletions

View File

@ -69,9 +69,9 @@
<upload-outlined />
点击上传
</a-button>
<div v-if="VITE_GLOB_UPLOAD_ALERT_TIP?.trim()" style="color: red; margin-top: 8px">
<!-- <div v-if="VITE_GLOB_UPLOAD_ALERT_TIP?.trim()" style="color: red; margin-top: 8px">
{{ VITE_GLOB_UPLOAD_ALERT_TIP }}
</div>
</div> -->
</div>
<template #itemRender="{ file, actions }">
@ -213,10 +213,11 @@
x.status = 'done'; //没有则不会展示下载按钮
x.url = x.fileUrl;
x.thumbUrl = x.thUrl;
x.fileSize = x.fileSize
});
emit('update:value', folderId.value);
emit('change');
emit('change', fileList.value);
loading.value = false;
} catch (error) {
console.error(error);
@ -379,6 +380,12 @@
downloadByUrl({ url: res.url, fileName: res.name || 'files.zip' });
}
}
function getValue () {
return fileList.value
}
defineExpose({
getValue
});
</script>
<style lang="less" scoped>
.list-upload {

View File

@ -1,6 +1,7 @@
<template>
<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>
@ -9,7 +10,7 @@
</div>
</template>
<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 { BasicForm, useForm } from '/@/components/Form/index';
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('银行列表'),
api: getLngBBankPage,
columns,
@ -124,6 +125,7 @@
schemas: codeFormSchema,
showResetButton: true,
},
immediate: false, // 设置为不立即调用
beforeFetch: (params) => {
return { ...params, valid: 'Y'};
},
@ -132,6 +134,13 @@
onChange: onSelectChange
},
});
const handleVisibleChange = (visible: boolean) => {
if (visible) {
nextTick(() => {
reload();
});
}
};
function onSelectChange(rowKeys: string[], e) {
selectedKeys.value = rowKeys;
selectedValues.value = e

View File

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

View File

@ -1,10 +1,10 @@
<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-row>
<a-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">
{{ item.fullName }}
</a-select-option>
@ -13,22 +13,22 @@
</a-col>
<a-col :span="12">
<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-col>
<a-col :span="12">
<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-col>
<a-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-col>
<a-col :span="24">
<a-form-item label="上传附件" name="parentNname" :label-col="{ span: 4 }" :wrapper-col="{ span: 24 }">
<Upload :fileList="formState.fileList" :maxSize="200" :accept="accept"></Upload>
<a-form-item label="上传附件" name="fileList" :label-col="{ span: 4 }" :wrapper-col="{ span: 24 }">
<Upload v-model:value="formState.filePath" @change="changeUplod" ref="uploadRef" :multiple="true" :maxSize="200" :accept="accept"></Upload>
<div style="color: #ccc; font-size: 12px">{{ fileTip }}</div>
</a-form-item>
@ -52,8 +52,9 @@ import dayjs from 'dayjs';
const { t } = useI18n();
const isUpdate = ref(true);
const disable = ref(false);
const isDisable = ref(false);
let optionList = reactive([])
const uploadRef = ref()
const fileTip = '支持格式.rar .zip .doc .docx .pdf 单个文件不能超过20MB';
const accept ='.rar,.zip, .doc, .docx, .pdf, .RAR, .ZIP, .DOC, .DOCX, .PDF'
const formRef = ref()
@ -62,6 +63,7 @@ const emit = defineEmits(['success','register']);
const getTitle = computed(() => (!unref(isUpdate) ? t('新增证书') : t('编辑证书')));
let formState = reactive({
docTypeCode: '',
fileList: []
});
const rules = {
docTypeCode: [{ required: true, message: "该项为必填项", trigger: 'change' }],
@ -71,9 +73,11 @@ const [registerModal, { setModalProps, closeModal }] = useModalInner(async (data
getOption()
setModalProps({ confirmLoading: false });
isUpdate.value = !!data?.isUpdate;
disable.value = data?.btnType == 'view' ? true : false
isDisable.value = data?.btnType == 'view' ? true : false
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})
}
});
@ -94,9 +98,9 @@ const [registerModal, { setModalProps, closeModal }] = useModalInner(async (data
}
return endValue.valueOf() <= startValue.valueOf();
}
const handleChangeFile = (val) => {
function changeUplod (val) {
formState.fileList = val
console.log(val, 532, formState.filePath)
}
async function getOption() {
optionList = await getDocCpList({'valid': 'Y'})
@ -108,13 +112,21 @@ const [registerModal, { setModalProps, closeModal }] = useModalInner(async (data
try {
await formRef.value.validate();
// 验证通过,提交表单
let docNo = (optionList.find(v=>v.code === formState.docTypeCode) || {}).fullName
let arr = uploadRef.value.getValue() || []
let obj = {
...formState,
docNo: docNo,
dateFrom: formState.dateFrom ? dayjs(formState.dateFrom).format('YYYY-MM-DD') : null,
dateTo: formState.dateTo ? dayjs(formState.dateTo).format('YYYY-MM-DD') : null,
dateFrom: formState.dateFrom ? dayjs(formState.dateFrom).format('YYYY-MM-DD') : '',
dateTo: formState.dateTo ? dayjs(formState.dateTo).format('YYYY-MM-DD') : '',
fileList: arr.map(v => {
return {
fileOrg: v.name,
filePath: v.url,
filesize: v.fileSize
}
})
}
console.log(obj,543, uploadRef.value.getValue())
formState.filePath = ''
emit('success', obj);
notification.success({
message: t('操作'),

View File

@ -15,7 +15,15 @@ export const searchFormSchema: FormSchema[] = [
{
field: 'approCode',
label: '审批状态',
component: 'Input',
component: 'XjrSelect',
componentProps: {
datasourceType: 'dic',
params: { itemId: '1990669393069129729' },
labelField: 'name',
valueField: 'value',
getPopupContainer: () => document.body,
},
},
];

View File

@ -1,25 +1,6 @@
<template>
<a-spin :spinning="spinning" tip="请稍后...">
<a-spin :spinning="spinning" tip="加载中...">
<div class="page-bg-wrap">
<div class="top-toolbar" id="formViewPage">
<a-space :size="10" wrap style="gap: 0">
<a-button style="margin-right: 10px" @click="close">
<slot name="icon"><close-outlined /></slot>取消
</a-button>
<a-button v-if="mode != 'view'" style="margin-right: 10px" type="primary" @click="handleSubmit('save')">
<slot name="icon"><save-outlined /></slot>保存
</a-button>
<a-button v-if="mode != 'view'" style="margin-right: 10px" type="primary" @click="handleSubmit('submit')">
<slot name="icon"><check-circle-outlined /></slot>保存并提交
</a-button>
<a-button v-if="mode != 'view'" style="margin-right: 10px" type="primary" @click="handleSubmit">
<slot name="icon"><download-outlined /></slot>下载模板
</a-button>
<a-button v-if="mode != 'view'" type="primary" @click="handleSubmit">
<slot name="icon"><upload-outlined /></slot>导入
</a-button>
</a-space>
</div>
<a-form ref="formRef" :model="formState" :rules="rules" v-bind="layout">
<a-card title="客户基本信息" :bordered="false" >
<div>
@ -31,33 +12,33 @@
</a-form-item>
</a-col>
<a-col :span="8">
<a-form-item label="集团编码" name="cuName">
<a-input v-model:value="formState.cuName" placeholder="请输入集团编码" />
<a-form-item label="集团编码" name="cuMcode">
<a-input v-model:value="formState.cuMcode" :disabled="isDisable" placeholder="请输入集团编码" />
</a-form-item>
</a-col>
<a-col :span="8">
<a-form-item label="企业性质" name="cuMcode">
<a-select v-model:value="formState.cuMcode" placeholder="请选择企业性质" style="width: 100%" allow-clear>
<a-select-option v-for="item in optionSelect.cuMcodeList" :key="item.code" :value="item.code">
<a-form-item label="企业性质" name="natureCode">
<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">
{{ item.name }}
</a-select-option>
</a-select>
</a-form-item>
</a-col>
<a-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-form-item label="客户名称" name="cuName" :label-col="{ span: 3 }" :wrapper-col="{ span: 24 }">
<a-textarea v-model:value="formState.cuName" :disabled="isDisable" placeholder="请输入客户名称" :auto-size="{ minRows: 1, maxRows: 5 }"/>
</a-form-item>
</a-col>
<a-col :span="8">
<a-form-item label="客户简称" name="di">
<a-input v-model:value="formState.di" placeholder="请输入客户简称" />
<a-form-item label="客户简称" name="cuSname">
<a-input v-model:value="formState.cuSname" :disabled="isDisable" placeholder="请输入客户简称" />
</a-form-item>
</a-col>
<a-col :span="8">
<a-form-item label="国内/国际" name="natureCode">
<a-select v-model:value="formState.natureCode" placeholder="请选择国内/国际" style="width: 100%" allow-clear>
<a-select-option v-for="item in optionSelect.natureCodeList" :key="item.code" :value="item.code">
<a-form-item label="国内/国际" name="dI">
<a-select v-model:value="formState.dI" :disabled="isDisable" placeholder="请选择国内/国际" style="width: 100%" allow-clear>
<a-select-option v-for="item in optionSelect.dIList" :key="item.code" :value="item.code">
{{ item.name }}
</a-select-option>
</a-select>
@ -65,47 +46,47 @@
</a-col>
<a-col :span="8">
<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-col>
<a-col :span="8">
<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-col>
<a-col :span="8">
<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-col>
<a-col :span="8">
<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-col>
<a-col :span="8">
<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-col>
<a-col :span="8">
<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-col>
<a-col :span="8">
<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-col>
<a-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-col>
<a-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-col>
<a-col :span="8">
@ -128,7 +109,7 @@
</a-col>
<a-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-col>
</a-row>
@ -138,7 +119,7 @@
<a-row>
<a-col :span="8">
<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">
{{ item.name }}
</a-select-option>
@ -147,7 +128,7 @@
</a-col>
<a-col :span="8">
<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">
{{ item.name }}
</a-select-option>
@ -156,7 +137,7 @@
</a-col>
<a-col :span="8">
<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">
{{ item.name }}
</a-select-option>
@ -166,11 +147,11 @@
<a-col :span="8">
<a-form-item label="国有企业持股" name="stateSign" :offset="8">
<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-group>
<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>
</a-form-item>
</div>
@ -178,31 +159,31 @@
</a-col>
<a-col :span="8">
<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-col>
<a-col :span="8">
<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-col>
<a-col :span="8">
<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-group>
</a-form-item>
</a-col>
<a-col :span="8">
<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-group>
</a-form-item>
</a-col>
<a-col :span="8">
<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-group>
</a-form-item>
@ -215,12 +196,12 @@
<a-row>
<a-col :span="8">
<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-col>
<a-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-col>
</a-row>
@ -235,12 +216,15 @@
<span style="font-size: 12px;font-weight: normal;">需上传证书营业执照危险化学品许可证/燃气经营许可证/危险化学品道路运输许可证等证书</span>
</div>
</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" >
<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'">
<a style="margin-right: 10px" @click="btnCheck('certificate', 'edit', record)">编辑</a>
<a style="margin-right: 10px" @click="btnCheck('certificate', 'delete', record, index)">删除</a>
<a v-if="!isDisable" style="margin-right: 10px" @click="btnCheck('certificate', 'edit', record, index)">编辑</a>
<a v-if="!isDisable" style="margin-right: 10px" @click="btnCheck('certificate', 'delete', record, index)">删除</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)" />
<ArrowDownOutlined class="btn" @click="btnCheck('certificate', 'down', record, index)" />
@ -256,11 +240,14 @@
<span style="font-size: 12px;font-weight: normal;">至少填写一条银行信息</span>
</div>
</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" >
<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'">
<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>
</template>
</template>
@ -274,11 +261,11 @@
<span style="font-size: 12px;font-weight: normal;">至少填写一条联系人信息</span>
</div>
</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" >
<template #bodyCell="{ column, record, index }">
<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>
</template>
</template>
@ -292,6 +279,7 @@
</div>
</template>
<a-upload
v-if="!isDisable"
:multiple="true"
:showUploadList="false"
name="file"
@ -307,10 +295,10 @@
<a-table :columns="columnsFile" :data-source="dataFile" >
<template #bodyCell="{ column,record,index, text }">
<template v-if="column.dataIndex === 'fileOrg'">
<a :href="record.filePath" :download="record.fileOrg" target="_blank">{{record.fileOrg}}</a>
<a :href="record.presignedUrl||record.filePath" :download="record.fileOrg" target="_blank">{{record.fileOrg}}</a>
</template>
<template v-if="column.dataIndex === 'docDesc'">
<a-input :placeholder="t('请输入附件说明')" v-model:value="record.docDesc" />
<template v-if="column.dataIndex === 'docDesc' && !isDisable">
<a-input :placeholder="t('请输入附件说明')" :disabled="isDisable" v-model:value="record.docDesc" />
</template>
<template v-if="column.dataIndex === 'operation'">
<a style="margin-right: 10px" @click="btnCheck('file', 'delete', record, index)">删除</a>
@ -331,17 +319,17 @@
<script lang="ts" setup>
import { useRouter } from 'vue-router';
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 { useI18n } from '/@/hooks/web/useI18n';
import { CheckCircleOutlined, StopOutlined, CloseOutlined, UploadOutlined, SaveOutlined, DownloadOutlined,ArrowUpOutlined, ArrowDownOutlined } from '@ant-design/icons-vue';
import { useMultipleTabStore } from '/@/store/modules/multipleTab';
import useEventBus from '/@/hooks/event/useEventBus';
import type { Rule } from 'ant-design-vue/es/form';
import { getDictionary } from '/@/api/sales/Customer';
import certificateModal from './components/certificateModal.vue';
import contactModal from './components/contactModal.vue';
import bankModal from './components/bankModal.vue';
import { getDocCpList, getDictionary } from '/@/api/sales/Customer';
import certificateModal from './certificateModal.vue';
import contactModal from './contactModal.vue';
import bankModal from './bankModal.vue';
import { useModal } from '/@/components/Modal';
import { addLngCustomer,updateLngCustomer,getLngCustomer } from '/@/api/sales/Customer';
import dayjs from 'dayjs';
@ -350,25 +338,30 @@
import { uploadSrc, uploadBlobApi } from '/@/api/sys/upload';
import { message } from 'ant-design-vue';
const dynamicComponent = ref(null);
const formType = ref('2'); // 0 1 2
const formRef = ref();
const props = defineProps({});
const props = defineProps({
disabled: false,
id: ''
});
const { bus, FORM_LIST_MODIFIED } = useEventBus();
const router = useRouter();
const { currentRoute } = router;
const isDisable = ref(false);
const { formPath } = currentRoute.value.query;
const pathArr = formPath.split('/');
const pathArr = [];
const tabStore = useMultipleTabStore();
const formProps = ref(null);
const formId = ref(currentRoute.value?.params?.id);
const pageType = ref(currentRoute.value?.params?.type);
const pageId = ref(currentRoute.value?.params?.id || '');
const spinning = ref(false);
const pageType = ref(currentRoute.value.query?.type);
const pageId = ref(currentRoute.value.query?.id)
const spinning = ref(false);
const curIdx = ref(null)
const { notification } = useMessage();
const { t } = useI18n();
const data = reactive({
@ -393,11 +386,12 @@
const [registerContact, { openModal:openModalContact }] = useModal();
const [registerBank, { openModal:openModalBank}] = useModal();
const fileList = reactive([])
const rules: Record<string, Rule[]> = {
cuSname: [{ required: true, message: "该项为必填项", trigger: 'change' }],
cuMcode: [{ required: true, message: "该项为必填项", trigger: 'change' }],
di: [{ required: true, message: "该项为必填项", trigger: 'change' }],
cuSname: [{ required: true, message: "该项为必填项", trigger: 'change'}],
dI: [{ required: true, message: "该项为必填项", trigger: 'change' }],
cuName: [{ required: true, message: "该项为必填项", trigger: 'change'}],
natureCode: [{ required: true, message: "该项为必填项", trigger: 'change'}],
classCode: [{ required: true, message: "该项为必填项", trigger: 'change'}],
typeCode: [{ required: true, message: "该项为必填项", trigger: 'change'}],
@ -413,7 +407,7 @@
const columnsCertificate = ref([
{ 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: 'dateTo', sorter: true, width: 140},
{ title: t('备注'), dataIndex: 'note', sorter: true},
@ -449,16 +443,44 @@
const dataFile = reactive([]);
const dataContact= reactive([]);
let optionSelect= reactive({
cuMcodeList: [],
natureCodeList: [],
dIList: [],
validList: [],
approCodeList: [],
classCodeList: [],
typeCodeList: [],
propCodeList: [],
signList: []
signList: [],
docCpList: []
});
watch(
() => props.id,
(val) => {
if (val) {
getList(val)
}
},
{
immediate: true
}
);
watch(
() => props.disabled,
(val) => {
isDisable.value = val
if (val) {
let idx = columnsBank.value.findIndex(v =>v.dataIndex == 'operation')
idx>-1 && columnsBank.value.splice(idx, 1)
let idx1 = columnsContact.value.findIndex(v =>v.dataIndex == 'operation')
idx1>-1 && columnsContact.value.splice(idx1, 1)
let idx2 = columnsFile.value.findIndex(v =>v.dataIndex == 'operation')
idx2>-1 && columnsFile.value.splice(idx2, 1)
}
},
{
immediate: true
}
);
onMounted(() => {
getOption()
if (pageId.value) {
@ -469,17 +491,19 @@
});
async function getList(id) {
spinning.value = true
let data = await getLngCustomer(id)
spinning.value = false
Object.assign(formState, {...data})
formState.lngCustomerAttrPowerList = formState.lngCustomerAttrPowerList || [{}]
Object.assign(dataBank, formState.lngCustomerBankList || [])
Object.assign(dataCertificate, formState.lngCustomerDocList || [])
Object.assign(dataContact, formState.lngCustomerContactList || [])
Object.assign(dataUpload, formState.lngFileUploadList || [])
Object.assign(dataFile, formState.lngFileUploadList || [])
}
async function getOption() {
optionSelect.cuMcodeList = await getDictionary('LNG_ENT_PR')
optionSelect.natureCodeList = await getDictionary('LNG_NATURE')
optionSelect.natureCodeList = await getDictionary('LNG_ENT_PR')
optionSelect.dIList = await getDictionary('LNG_NATURE')
optionSelect.classCodeList = await getDictionary('LNG_CLASS')
optionSelect.typeCodeList = await getDictionary('LNG_CU_TYP')
optionSelect.propCodeList = await getDictionary('LNG_CU_RPT')
@ -487,7 +511,7 @@
optionSelect.validList = await getDictionary('LNG_VALID')
optionSelect.approCodeList = await getDictionary('LNG_APPRO')
optionSelect.docCpList = await getDocCpList({'valid': 'Y'})
}
function stateSignChange(val) {
if (val!='Y'){
@ -501,6 +525,7 @@
}
}
const handleAdd = (val)=> {
curIdx.value = null
if (val ==='certificate') {
openModalCertificate(true,{isUpdate: false});
}
@ -514,6 +539,8 @@
}
const btnCheck = (type, btn, record, index) => {
console.log(index, 555, type, )
curIdx.value = null
btn=='edit' && (curIdx.value = index)
//
if (type == 'certificate') {
if (btn == 'edit' || btn == 'view') {
@ -575,20 +602,29 @@
}
}
}
const swapItems = (arr, index1, index2,direction) =>{
arr[index1] = arr.splice(index2, 1, arr[index1])[0];
return arr;
};
const handleSuccessCertificate = (val) => {
//
if (curIdx.value != null) {
dataCertificate[curIdx.value] = {...val}
return
}
let idx =dataCertificate.findIndex(v => v.docTypeCode == val.docTypeCode)
if (idx <0) {
dataCertificate.push(val)
}
}
const handleSuccessContact = (val)=> {
if (curIdx.value != null) {
dataContact[curIdx.value] = {...val}
return
}
dataContact.push(val)
}
const handleSuccessBank = (val) => {
if (curIdx.value != null) {
dataBank[curIdx.value] = {...val}
return
}
dataBank.push(val)
}
function handleChangeFile(info) {
@ -598,7 +634,6 @@
if (info.file.status === 'done') {
if (info.file && info.file.response && info.file.response.code == 0) {
message.success(t(`{name}上传成功!`, { name: info.file.name }));
console.log(info, t('上传成功'));
// URLinfo.fileUrl
data.info.fileUrl = info.file.response.data.fileUrl;
data.fileName = info.file.response.data.fileName;
@ -609,6 +644,7 @@
let obj = {
fileOrg: data.fileName,
filePath: data.photoUrl,
filesize: info?.file?.response?.data?.fileSize
}
dataFile.push(obj)
@ -621,32 +657,12 @@
}
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() {
tabStore.closeTab(currentRoute.value, router);
}
async function getFormValue() {
return formState
}
async function handleSubmit(type) {
try {
await formRef.value.validateFields();
@ -674,68 +690,56 @@
let obj = {
...formState,
lngCustomerBankList: dataBank,
lngCustomerDocList: dataCertificate,
lngCustomerDocList: dataCertificate.map(v =>{
return {
...v,
dateFrom: v.dateFrom ? dayjs(v.dateFrom ).format('YYYY-MM-DD HH:mm:ss') : '',
dateTo: v.dateTo ? dayjs(v.dateTo ).format('YYYY-MM-DD HH:mm:ss'): ''
}
}),
lngCustomerContactList: dataContact,
lngFileUploadList: dataFile
}
spinning.value = true;
let request = pageType.value === 'add' ? addLngCustomer :updateLngCustomer
let request = !formState.id ? addLngCustomer :updateLngCustomer
try {
obj.lngCustomerDocList.forEach(v => {
v.dateFrom = dayjs(v.dateFrom ).valueOf()
v.dateTo = dayjs(v.dateTo ).valueOf()
})
await request(obj);
notification.success({
message: 'Tip',
description: pageType.value === 'add' ? t('新增成功!') : t('修改成功!')
}); //
formRef.value.resetFields();
setTimeout(() => {
bus.emit(FORM_LIST_MODIFIED, { path: formPath });
close();
}, 1000);
const data = await request(obj);
if (type) {
data?.id && (formState.id = data.id)
data?.cuCode && (formState.cuCode = data.cuCode)
notification.success({
message: 'Tip',
description: !data?.id ? t('新增成功!') : t('修改成功!')
}); //
}
// formRef.value.resetFields();
return data
// setTimeout(() => {
// bus.emit(FORM_LIST_MODIFIED, { path: formPath });
// close();
// }, 1000);
} finally {
spinning.value = false;
}
} catch (errorInfo) {
notification.warning({
spinning.value = false;
console.log(errorInfo, 'errorInfo')
errorInfo?.value && notification.warning({
message: 'Tip',
description: '请完善信息'
});
return false
}
}
async function saveModal() {
let saveSuccess = false;
const _mode = mode.value;
try {
await formRef.value?.validate();
const values = (formRef.value?.getFormModal && formRef.value.getFormModal()) || (await formRef.value?.validate());
//
if (formProps.hiddenComponent?.length) {
formProps.hiddenComponent.forEach((component) => {
values[component.bindField] = component.value;
});
}
if (values !== false) {
try {
if (_mode === 'create') {
saveSuccess = await formRef.value.add(values);
} else {
saveSuccess = await formRef.value.update({ values, rowId: formId.value });
}
return saveSuccess;
} catch (error) {}
}
} catch (error) {
console.error('saveModal Error: ', error);
}
}
defineExpose({
handleSubmit,
getFormValue
});
</script>
<style lang="less" scoped>

View File

@ -15,6 +15,9 @@
</template>
</template>
<template #bodyCell="{ column, record }">
<template v-if="column.dataIndex === 'approCode'">
{{ record.approName }}
</template>
<template v-if="column.dataIndex === 'action'">
<TableAction :actions="getActions(record)" />
</template>
@ -74,9 +77,9 @@
const tableRef = ref();
//所有按钮
const buttons = ref([{"isUse":true,"name":"新增","code":"add","icon":"ant-design:plus-outlined","isDefault":true,"type":"primary"},{"isUse":true,"name":"编辑","code":"edit","icon":"ant-design:form-outlined","isDefault":true},{"isUse":true,"name":"启用","code":"enable","icon":"ant-design:form-outlined","isDefault":true,"type":"primary"},{"isUse":true,"name":"作废","code":"disable","icon":"ant-design:stop-outlined","isDefault":true,"type":"dashed"},{"isUse":true,"name":"刷新","code":"refresh","icon":"ant-design:reload-outlined","isDefault":true},{"isUse":true,"name":"查看","code":"view","icon":"ant-design:eye-outlined","isDefault":true},{"isUse":true,"name":"发起审批","code":"startwork","icon":"ant-design:form-outlined","isDefault":true},{"isUse":true,"name":"查看流转记录","code":"flowRecord","icon":"ant-design:form-outlined","isDefault":true},{"isUse":true,"name":"删除","code":"delete","icon":"ant-design:delete-outlined","isDefault":true}]);
const buttons = ref([{"isUse":true,"name":"新增","code":"add","icon":"ant-design:plus-outlined","isDefault":true,"type":"primary"},{"isUse":true,"name":"编辑","code":"edit","icon":"ant-design:form-outlined","isDefault":true},{"isUse":true,"name":"启用","code":"enable","icon":"ant-design:form-outlined","isDefault":true,"type":"primary"},{"isUse":true,"name":"作废","code":"disable","icon":"ant-design:stop-outlined","isDefault":true,"type":"dashed"},{"isUse":true,"name":"刷新","code":"refresh","icon":"ant-design:reload-outlined","isDefault":true},{"isUse":true,"name":"查看","code":"view","icon":"ant-design:eye-outlined","isDefault":true},{"isUse":true,"name":"发起审批","code":"startwork","icon":"ant-design:form-outlined","isDefault":true},{"isUse":true,"name":"查看流转记录","code":"flowRecord","icon":"ant-design:form-outlined","isDefault":true}]);
//展示在列表内的按钮
const actionButtons = ref<string[]>(['view', 'edit','datalog', 'copyData', 'delete', 'startwork','flowRecord']);
const actionButtons = ref<string[]>(['view', 'edit','datalog', 'copyData', 'enable', 'disable', 'startwork','flowRecord']);
const buttonConfigs = computed(()=>{
return filterButtonAuth(buttons.value);
})
@ -99,6 +102,7 @@
schemaIdComputedRef.value = currentRoute.value.meta.schemaId
const visibleLookProcessRef = ref(false);
const processIdRef = ref('');
const selectedKeys = ref<string[]>([]);
const visibleLaunchProcessRef = ref(false);
const schemaIdRef = ref('');
@ -159,7 +163,8 @@
query: {
taskId: taskIds[0],
formName: formName,
formId:currentRoute.value.meta.formId
formId:currentRoute.value.meta.formId,
id: record.id
}
});
} else if (schemaId && !taskIds && processId) {
@ -169,7 +174,8 @@
readonly: 1,
taskId: '',
formName: formName,
formId:currentRoute.value.meta.formId
formId:currentRoute.value.meta.formId,
id: record.id
}
});
} else {
@ -212,78 +218,93 @@
}
function handleEdit(record: Recordable) {
router.push({
path: '/form/Customer/' + record.id + '/createFormCustomer',
query: {
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({
path: '/form/Customer/' + record.id + '/createFormCustomer',
query: {
formPath: 'sales/Customer',
formName: formName,
formId:currentRoute.value.meta.formId,
type:'edit',
id: record.id
}
});
}
}
function handleDelete(record: Recordable) {
deleteList([record.id]);
}
function handleEnable() {
if (!selectedKeys.value.length) {
notification.warning({
message: 'Tip',
description: t('请选择需要启用的数据'),
});
return;
}
function handleEnable(record: Recordable) {
// if (!selectedKeys.value.length) {
// notification.warning({
// message: 'Tip',
// description: t('请选择需要启用的数据'),
// });
// return;
// }
let ids = selectedKeys.value;
Modal.confirm({
title: '提示信息',
icon: createVNode(ExclamationCircleOutlined),
content: '是否确认启用?',
okText: '确认',
cancelText: '取消',
onOk() {
enableLngCustomer(ids).then((_) => {
handleSuccess();
notification.success({
message: 'Tip',
description: t('启用成功!'),
});
});
},
onCancel() {},
});
}
function handleDisable() {
if (!selectedKeys.value.length) {
notification.warning({
message: 'Tip',
description: t('请选择需要禁用的数据'),
});
return;
}
let ids = selectedKeys.value;
Modal.confirm({
title: '提示信息',
icon: createVNode(ExclamationCircleOutlined),
content: '是否确认禁用?',
okText: '确认',
cancelText: '取消',
onOk() {
disableLngCustomer(ids).then((_) => {
handleSuccess();
notification.success({
message: 'Tip',
description: t('禁用成功!'),
});
});
},
onCancel() {},
});
}
// let ids = selectedKeys.value;
let ids = [record.id]
Modal.confirm({
title: '提示信息',
icon: createVNode(ExclamationCircleOutlined),
content: '是否确认启用?',
okText: '确认',
cancelText: '取消',
onOk() {
enableLngCustomer(ids).then((_) => {
handleSuccess();
notification.success({
message: 'Tip',
description: t('启用成功!'),
});
});
},
onCancel() {},
});
}
function handleDisable(record: Recordable) {
let ids = [record.id]
// if (!selectedKeys.value.length) {
// notification.warning({
// message: 'Tip',
// description: t('请选择需要禁用的数据'),
// });
// return;
// }
// let ids = selectedKeys.value;
Modal.confirm({
title: '提示信息',
icon: createVNode(ExclamationCircleOutlined),
content: '是否确认禁用?',
okText: '确认',
cancelText: '取消',
onOk() {
disableLngCustomer(ids).then((_) => {
handleSuccess();
notification.success({
message: 'Tip',
description: t('禁用成功!'),
});
});
},
onCancel() {},
});
}
function deleteList(ids) {
Modal.confirm({
title: '提示信息',
@ -342,7 +363,7 @@
let editAndDelBtn: ActionItem[] = [];
let hasFlowRecord = false;
actionButtonConfig.value?.map((button) => {
if (['view', 'copyData'].includes(button.code)) {
if (['view', 'copyData', 'enable', 'disable'].includes(button.code)) {
actionsList.push({
icon: button?.icon,
tooltip: button?.name,
@ -372,6 +393,14 @@
actionsList = actionsList.concat(editAndDelBtn);
}
}
if (record.approCode === 'YSP') {
let idx = actionsList.findIndex(v =>v.tooltip == '作废')
idx>-1 && actionsList.splice(idx, 1)
} else {
let idx = actionsList.findIndex(v =>v.tooltip == '启用')
idx>-1 && actionsList.splice(idx, 1)
}
return actionsList;
}
function handleStartwork(record: Recordable) {
@ -381,7 +410,8 @@
query: {
readonly: 1,
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>
</a-space>
</div>
<component v-if="customFormConfig.codeList.includes(curPageCode)" :is="componentName" ref="formInformation" :disabled="true" />
<FormInformation
v-else
:key="renderKey"
ref="formInformation"
:disabled="readonly"
@ -74,7 +76,7 @@
<script setup>
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 userTaskItem from '/@/views/workflow/task/hooks/userTaskItem';
import { getApprovalProcess, postApproval, postGetNextTaskMaybeArrival, postTransfer, getDrawNode, withdraw } from '/@/api/workflow/task';
@ -97,6 +99,7 @@
import { TaskTypeUrl } from '/@/enums/workflowEnum';
import { postSetSign, postSetSignV2 } from '/@/api/workflow/task';
import FlowRecord from '/@/views/workflow/task/components/flow/FlowRecord.vue';
import {customFormConfig} from './customFormConfig'
const spinning = ref(false);
const userStore = useUserStore();
@ -174,7 +177,17 @@
nextTaskUser: {} // 格式为taskKey: 用户id逗号分隔
});
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) {
// 撤回有drawNode才显示流程图任何情况下都显示
let show =
@ -380,12 +393,16 @@
async function onApproveClick(isAutoAgreeBreak = false) {
try {
openSpinning();
if (!isAutoAgreeBreak) {
await submit();
}
if (!validateSuccess.value) {
closeSpinning();
return;
if (!customFormConfig.codeList.includes(curPageCode.value)) {
if (!isAutoAgreeBreak) {
await submit();
}
if (!validateSuccess.value) {
closeSpinning();
return;
}
} else {
validateSuccess.value = true
}
const params = await getApproveParams();
const nextNodes = await postGetNextTaskMaybeArrival(params);
@ -570,10 +587,11 @@
return data.taskApproveOpinions || [];
}
}
const curPageCode = ref()
onMounted(async () => {
try {
let res = await getApprovalProcess(unref(taskId), unref(processId));
curPageCode.value = res?.schemaInfo?.code
initProcessData(res);
await getBackNode();
processInfo.value = res;
@ -667,9 +685,20 @@
async function getApproveParams() {
try {
let formModels = {}
let system = {}
let fileFolderIds = []
if (!customFormConfig.codeList.includes(curPageCode.value)) {
let formModels = await formInformation.value.getFormModels();
let system = formInformation.value.getSystemType();
let fileFolderIds = getUploadFileFolderIds(formModels);
} else {
let value = await formInformation.value.getFormValue();
let key = data.formInfos[0]?.formConfig?.key
formModels[key] = value
system[key] = false
fileFolderIds = []
}
return {
approvedType: approvalData.approvedType,
approvedResult: approvalData.approvedResult, // approvalData.approvedType 审批结果 如果为 4 就需要传buttonCode
@ -694,13 +723,16 @@
try {
if (validateSuccess.value || values === 'reject' || values === 'finish' || values === 'disagree') {
let params = await getApproveParams();
openSpinning()
let response = await postApproval(params);
closeSpinning()
// 判断返回值是否带有isAutoAgree 来判断中间是否有自动审批的业务如有再执行判断待审人员是否包含自己不包含就直接flowSuccess
if (checkIsAutoAgree(response)) return;
flowSuccess();
data.submitLoading = false;
}
} catch (error) {
closeSpinning()
flowFail();
throw new Error(error);
}

View File

@ -16,7 +16,10 @@
</slot>
提交
</a-button>
<a-button :disabled="data.submitLoading" @click="saveDraft">
<a-button v-if="customFormConfig.codeList.includes(curPageCode)" @click="onSave">
<slot name="icon"><save-outlined /></slot>保存
</a-button>
<a-button v-else :disabled="data.submitLoading" @click="saveDraft">
<slot name="icon">
<clock-circle-outlined />
</slot>
@ -29,10 +32,19 @@
</slot>
流程图
</a-button>
<div v-if="customFormConfig.codeList.includes(curPageCode)">
<a-button>
<slot name="icon"><download-outlined /></slot>下载模板
</a-button>
<a-button>
<slot name="icon"><upload-outlined /></slot>导入
</a-button>
</div>
</a-space>
</div>
<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>
<a-modal :visible="showFlowChart" centered class="geg" closable title="流程图" width="1200px" @cancel="closeFlowChart">
@ -53,8 +65,8 @@
import ProcessInformation from '/@/views/workflow/task/components/flow/ProcessInformation.vue';
import { getStartProcessInfo, getReStartProcessInfo, reLaunch, postLaunch, postApproval, postGetNextTaskMaybeArrival } from '/@/api/workflow/task';
import { useMultipleTabStore } from '/@/store/modules/multipleTab';
import { CloseOutlined, SendOutlined, ClockCircleOutlined, PrinterOutlined, ApartmentOutlined } from '@ant-design/icons-vue';
import { nextTick, onMounted, ref, toRaw, reactive } from 'vue';
import { CloseOutlined, SendOutlined, ClockCircleOutlined, PrinterOutlined, ApartmentOutlined, SaveOutlined, DownloadOutlined, UploadOutlined } from '@ant-design/icons-vue';
import { nextTick, onMounted, ref, toRaw, reactive, computed, defineAsyncComponent } from 'vue';
import { deleteDraft, postDraft, putDraft } from '/@/api/workflow/process';
import { useI18n } from '/@/hooks/web/useI18n';
import { separator } from '/@bpmn/config/info';
@ -62,12 +74,13 @@
import OpinionDialog from '/@/components/SecondDev/OpinionDialog.vue';
import { ApproveCode, ApproveType } from '/@/enums/workflowEnum';
import useEventBus from '/@/hooks/event/useEventBus';
import {customFormConfig} from './customFormConfig'
const { bus, CREATE_FLOW } = useEventBus();
const router = useRouter();
const tabStore = useMultipleTabStore();
const curPageCode = ref()
const { t } = useI18n();
const { data, approveUserData, initProcessData, notificationSuccess, notificationError } = userTaskItem();
const currentRoute = router.currentRoute.value;
@ -130,6 +143,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 () => {
try {
// 发起流程
@ -139,6 +163,7 @@
const tabPrefix = pageMode === 'new' ? '新建' : '草稿';
tabStore.changeTitle(fullPath, `${tabPrefix}${title}`);
}
curPageCode.value = res?.schemaInfo?.code
initProcessData(res);
} catch (error) {}
randKey.value = Math.random() + '';
@ -272,8 +297,18 @@
async function getApproveParams() {
let formModels = mainFormModels.value;
let system = formInformation.value.getSystemType();
let fileFolderIds = getUploadFileFolderIds(formModels);
let fileFolderIds = []
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 {
approvedType: approvalData.approvedType,
approvedResult: approvalData.approvedResult, // approvalData.approvedType 审批结果 如果为 4 就需要传buttonCode
@ -290,8 +325,118 @@
draftId: rDraftsId.value
};
}
async function onSave() {
let value = await formInformation.value.handleSubmit(true);
}
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();
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() {
if (customFormConfig.codeList.includes(curPageCode.value)){
saveLaunchNew()
return
}
if (!taskId.value && rDraftsId.value != '0') {
try {
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>
<FlowPanel :xml="data.xml" :taskRecords="data.taskRecords" :predecessorTasks="selectedPredecessorTasks" :processId="props.processId" :schemaId="props.schemaId" position="top">
<FormInformation
:curPageCode="curPageCode"
:id="id"
:opinionsComponents="data.opinionsComponents"
:opinions="data.opinions"
:disabled="false"
@ -132,6 +134,7 @@
import { useI18n } from '/@/hooks/web/useI18n';
import { notification } from 'ant-design-vue';
import { ColorPicker } from '/@/components/ColorPicker';
import {customFormConfig} from '/@/views/secondDev/customFormConfig'
const { t } = useI18n();
const ApproveUser = defineAsyncComponent(() => import('./flow/ApproveUser.vue'));
const AddOrSubtract = defineAsyncComponent(() => import('./flow/AddOrSubtract.vue'));
@ -143,12 +146,14 @@
schemaId: string;
processId: string;
taskId: string;
id: string;
visible?: boolean;
}>(),
{
schemaId: '',
processId: '',
taskId: '',
id: '',
visible: false
}
);
@ -210,7 +215,8 @@
return ele.taskId;
});
});
const curPageCode = ref()
const id = ref()
// 审批
async function approval() {
showLoading.value = true;
@ -218,9 +224,11 @@
if (props.taskId) {
try {
let res = await getApprovalProcess(props.taskId, props.processId);
curPageCode.value = res?.schemaInfo?.code
id.value = res?.formInfos[0]?.formData?.id
initProcessData(res);
if (res.buttonConfigs) {
approvalData.buttonConfigs = res.buttonConfigs;
approvalData.buttonConfigs = res.buttonConfigs || [];
}
if (res.relationTasks) {
data.predecessorTasks = res.relationTasks;
@ -290,12 +298,27 @@
return fileFolderIds;
}
const onFinish = async (values: any) => {
await submit();
if (!customFormConfig.codeList.includes(curPageCode.value)) {
await submit();
} else {
validateSuccess.value = true
}
try {
if (validateSuccess.value) {
let formModels = await formInformation.value.getFormModels();
let system = formInformation.value.getSystemType();
let fileFolderIds: Array<string> = getUploadFileFolderIds(formModels);
let formModels = {}
let system = {}
let fileFolderIds = []
if (!customFormConfig.codeList.includes(curPageCode.value)) {
let formModels = await formInformation.value.getFormModels();
let system = formInformation.value.getSystemType();
let fileFolderIds: Array<string> = getUploadFileFolderIds(formModels);
} else {
let value = await formInformation.value.getCustomFormValue()
let key = data.formInfos[0]?.formConfig?.key
formModels[key] = value
system[key] = false
fileFolderIds = []
}
let params: PostApprovalData = {
approvedType: approvalData.approvedType,
approvedResult: approvalData.approvedResult, // approvalData.approvedType 审批结果 如果为 4 就需要传buttonCode
@ -363,6 +386,8 @@
data.submitLoading = false;
notificationError(t('审批流程'), t('表单校验未通过'));
}
} else {
data.submitLoading = false;
}
} catch (error) {
data.submitLoading = false;

View File

@ -26,17 +26,22 @@
<div v-show="activeIndex == index">
<div class="page-bg-wrap">
<div class="top-toolbar" style="display: flex; margin-bottom: 10px">
<div id="adminButtons" v-show="activeIndex == index" style="margin-right: 10px">
<!-- <div id="adminButtons" v-show="activeIndex == index" style="margin-right: 10px">
<a-button @click="handleCancel" v-if="forms.modes[index] == 'edit'">取消</a-button>
<a-button @click="handleSave" v-if="forms.modes[index] == 'edit'" type="primary" style="margin-left: 12px">保存</a-button>
<a-button @click="handleEdit" v-if="forms.modes[index] == 'view'">编辑</a-button>
<a-button @click="handleDelete" type="danger" style="margin-left: 12px">删除</a-button>
</div>
</div> -->
<div id="approveExtendButton"></div>
<div id="approveRightButton"></div>
</div>
<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" />
<div style="height: 500px;" v-if="customFormConfig.codeList.includes(props.curPageCode)">
<component :id="props.id" :is="componentName" :disabled="true" ref="customerFormRef"/>
</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" />
<SimpleForm v-else-if="item.formType == FormType.CUSTOM" class="form-box testClass" :ref="setItemRef" :formProps="item.formProps" :formModel="item.formModel" :isWorkFlow="true" />
</div>
</div>
</div>
</div>
@ -50,7 +55,7 @@
import { FewerLeft, FewerRight } from '/@/components/ModalPanel';
import { NodeHead } from '/@/components/ModalPanel/index';
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 { cloneDeep } from 'lodash-es';
import { useI18n } from '/@/hooks/web/useI18n';
@ -62,6 +67,8 @@
import { createFormEvent, loadFormEvent, submitFormEvent } from '/@/hooks/web/useFormEvent';
import { message } from 'ant-design-vue';
import { updateWorkflow } from '/@/api/workflow/adminOperation';
import {customFormConfig} from '/@/views/secondDev/customFormConfig'
const customerFormRef = ref(null)
const { t } = useI18n();
const props = withDefaults(
defineProps<{
@ -71,13 +78,17 @@
opinionsComponents?: Array<string> | undefined;
formAssignmentData?: null | Recordable;
processId: string;
curPageCode: string;
id: string;
}>(),
{
disabled: false,
formInfos: () => {
return [];
},
processId: ''
processId: '',
curPageCode: '',
id: ''
}
);
@ -143,6 +154,16 @@
formEventConfigs: [],
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 () => {
for await (let element of props.formInfos) {
let formModels = {};
@ -389,7 +410,21 @@
itemRefs.value[activeIndex.value].setDisabledForm(false);
forms.modes[activeIndex.value] = 'edit';
}
const getCustomFormValue = async () => {
await nextTick()
if (!customerFormRef.value) {
message.error('表单组件正在加载,请稍后')
return
}
let value = {}
if (Array.isArray(customerFormRef.value)) {
value = customerFormRef.value[0].getFormValue()
} else {
value = customerFormRef.value.getFormValue()
}
return value
}
defineExpose({
validateForm,
getFormModels,
@ -400,7 +435,8 @@
handleEdit,
handleSave,
handleCancel,
handleDelete
handleDelete,
getCustomFormValue
});
</script>
@ -514,7 +550,7 @@
}
.top-toolbar {
min-height: 44px;
// min-height: 44px;
margin-bottom: 12px;
border-bottom: 1px solid #eee;
}

View File

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