合同完善

This commit is contained in:
z9130 2024-09-29 17:31:40 +08:00
parent 29f2ff3e32
commit bedd30704e
9 changed files with 210 additions and 56 deletions

View File

@ -50,34 +50,39 @@ export function getDictOpts(dictType: string) {
export async function getDictDatasAsync(dictTypes: string[]) { export async function getDictDatasAsync(dictTypes: string[]) {
const dictDataMap: Record<string, DictDataType[]> = {}; const dictDataMap: Record<string, DictDataType[]> = {};
const foundTypes = new Set<string>(); const foundTypes = new Set<string>();
console.log(dictTypes);
// debugger;
// Process static dictionary data // Process static dictionary data
for (const dictType of Object.keys(dataModule)) { for (const dictType of Object.keys(dataModule)) {
if (dictTypes.includes(dictType)) { if (dictTypes.includes(dictType)) {
const dictEntries = dataModule[dictType]; const dictEntries = dataModule[dictType];
dictEntries.data.forEach((dictData) => { if (dictEntries && dictEntries.data && dictEntries.data.length > 0) {
dictData.type = dictType; dictEntries.data.forEach((dictData) => {
dictData.type = dictType;
if (!dictDataMap[dictType]) {
dictDataMap[dictType] = [];
}
dictDataMap[dictType].push({
...dictData,
value: dictData.value,
label: dictData.label,
colorType: dictData.colorType,
cssClass: dictData.cssClass,
} as DictDataType);
});
foundTypes.add(dictType);
if (!dictDataMap[dictType]) {
dictDataMap[dictType] = [];
}
dictDataMap[dictType].push({
...dictData,
value: dictData.value,
label: dictData.label,
colorType: dictData.colorType,
cssClass: dictData.cssClass,
} as DictDataType);
});
foundTypes.add(dictType);
}
// If all types are found, return early // If all types are found, return early
console.log(foundTypes.size, dictTypes.length);
if (foundTypes.size === dictTypes.length) { if (foundTypes.size === dictTypes.length) {
return dictDataMap; return dictDataMap;
} }
} }
} }
console.log(dictDataMap);
// Fetch remote dictionary data in parallel // Fetch remote dictionary data in parallel
const promises = dictTypes.map(async (type) => { const promises = dictTypes.map(async (type) => {
if (!foundTypes.has(type)) { if (!foundTypes.has(type)) {

View File

@ -311,7 +311,7 @@ async function handleSubmit() {
async function handleAudit( async function handleAudit(
type: 'accessConfirm' | 'reject' | 'rejectConfirm', type: 'accessConfirm' | 'reject' | 'rejectConfirm',
data: any, data?: any,
) { ) {
console.log(type); console.log(type);

View File

@ -5,7 +5,7 @@ import { useVbenModal } from '@vben/common-ui';
import { dict } from '@fast-crud/fast-crud'; import { dict } from '@fast-crud/fast-crud';
import { VxeGrid } from 'vxe-table'; import { VxeGrid } from 'vxe-table';
import { DICT_TYPE, getDictOptions } from '#/utils/dict'; import { DICT_TYPE } from '#/utils/dict';
import chooseCompanyModal from '../../company/list/choose-company-modal.vue'; import chooseCompanyModal from '../../company/list/choose-company-modal.vue';
import { getBidColumns, getProviderColumns } from './bid-columns'; import { getBidColumns, getProviderColumns } from './bid-columns';
@ -14,7 +14,9 @@ const [ChooseCompanyModal, chooseCompanyModalApi] = useVbenModal({
connectedComponent: chooseCompanyModal, connectedComponent: chooseCompanyModal,
}); });
export function getFormSchema(_params: any = {}) { export function getFormSchema(params: any = {}) {
const { formRef, dictMap = {} } = params;
const xGridRef = ref(); const xGridRef = ref();
/** Hooks - 表格 */ /** Hooks - 表格 */
@ -85,7 +87,7 @@ export function getFormSchema(_params: any = {}) {
vModel: 'value', vModel: 'value',
class: 'min-w-[200px]', class: 'min-w-[200px]',
dict: dict({ dict: dict({
data: getDictOptions(DICT_TYPE.contract_project_type), data: dictMap[DICT_TYPE.contract_project_type],
}), }),
}, },
rules: [{ required: true, message: '请选择项目类别' }], rules: [{ required: true, message: '请选择项目类别' }],
@ -99,7 +101,7 @@ export function getFormSchema(_params: any = {}) {
vModel: 'value', vModel: 'value',
class: 'min-w-[200px]', class: 'min-w-[200px]',
dict: dict({ dict: dict({
data: getDictOptions(DICT_TYPE.comprehensive_project_name), data: dictMap[DICT_TYPE.comprehensive_project_name],
}), }),
}, },
rules: [{ required: true, message: '请输入项目名称' }], rules: [{ required: true, message: '请输入项目名称' }],
@ -113,7 +115,7 @@ export function getFormSchema(_params: any = {}) {
vModel: 'value', vModel: 'value',
class: 'min-w-[200px]', class: 'min-w-[200px]',
dict: dict({ dict: dict({
data: getDictOptions(DICT_TYPE.contract_price_style), data: dictMap[DICT_TYPE.contract_price_style],
}), }),
}, },
}, },
@ -135,7 +137,7 @@ export function getFormSchema(_params: any = {}) {
name: 'fs-dict-radio', name: 'fs-dict-radio',
vModel: 'value', vModel: 'value',
dict: dict({ dict: dict({
data: getDictOptions(DICT_TYPE.contract_selection_method), data: dictMap[DICT_TYPE.contract_selection_method],
}), }),
}, },
rules: [{ required: true, message: '请选择选商方式' }], rules: [{ required: true, message: '请选择选商方式' }],
@ -174,8 +176,8 @@ export function getFormSchema(_params: any = {}) {
// }, // },
render({ form }) { render({ form }) {
// 注意此处的v-model写法 // 注意此处的v-model写法
const options1 = getDictOptions(DICT_TYPE.section_type, 'string'); const options1 = dictMap[DICT_TYPE.section_type];
const options2 = getDictOptions(DICT_TYPE.section_num, 'string'); const options2 = dictMap[DICT_TYPE.section_num];
let id = ''; let id = '';
return ( return (
<div class="flex flex-col"> <div class="flex flex-col">

View File

@ -14,8 +14,9 @@ import {
} from 'ant-design-vue'; } from 'ant-design-vue';
import Apis from '#/api'; import Apis from '#/api';
import temporaryFormModal from '#/components/temporary-form-modal/temporary-form-modal.vue';
import { useVxeTable } from '#/hooks/vxeTable'; import { useVxeTable } from '#/hooks/vxeTable';
import { DICT_TYPE, getDictObj } from '#/utils/dict'; import { DICT_TYPE, getDictDatasAsync, getDictObj } from '#/utils/dict';
import { FileUploader } from '#/utils/file'; import { FileUploader } from '#/utils/file';
import { logger } from '#/utils/logger'; import { logger } from '#/utils/logger';
import chooseUserModal from '#/views/system/user/choose-user-modal.vue'; import chooseUserModal from '#/views/system/user/choose-user-modal.vue';
@ -28,6 +29,10 @@ const [ChooseUserModal, chooseUserModalApi] = useVbenModal({
connectedComponent: chooseUserModal, connectedComponent: chooseUserModal,
}); });
const [TemporaryFormModal, temporaryFormModalApi] = useVbenModal({
connectedComponent: temporaryFormModal,
});
const { xGridRef, gridProps } = useVxeTable({ ref: 'xGridRef' }); const { xGridRef, gridProps } = useVxeTable({ ref: 'xGridRef' });
const fileUploader = new FileUploader({}); const fileUploader = new FileUploader({});
@ -54,7 +59,7 @@ const formBindingByBaseInfo = ref({
columns: {}, columns: {},
}); });
const formBinding = ref({ ...getFormSchema() }); const formBinding = ref(null);
/** Hooks - 表格 */ /** Hooks - 表格 */
const gridOptions = reactive( const gridOptions = reactive(
@ -138,6 +143,93 @@ async function handleChooseUserConfirm(e) {
handleSubmit('submit'); handleSubmit('submit');
} }
async function handleAudit(
type: 'accessConfirm' | 'reject' | 'rejectConfirm',
data?: any,
) {
console.log(type);
if (type === 'accessConfirm') {
Modal.confirm({
title: '提示',
content: '是否确认审核通过?',
onOk: async () => {
try {
await Apis.selectMerchantsBasicInfo.post_submit({
params: {
guid: selectMerchantsBasicInfoId.value,
},
data: {
appId: id.value,
taskId: currData.value.taskId,
nodeId: '',
comment: '通过',
},
});
message.success('审核通过');
back();
} catch (error) {
logger.error('审核通过失败', error);
message.error('审核通过失败,请稍候再试');
}
},
});
}
if (type === 'reject') {
Modal.confirm({
title: '提示',
content: '是否确认退回?',
onOk: () => {
temporaryFormModalApi.setData({
title: '退回原因',
schema: {
columns: {
comment: {
title: '',
key: 'comment',
col: { span: 24 },
colon: false,
component: {
name: 'a-textarea',
vModel: 'value',
autoSize: { minRows: 4, maxRows: 6 },
placeholder: '请输入',
},
rules: [{ required: true, message: '请输入退回原因' }],
},
},
},
});
temporaryFormModalApi.open();
},
});
}
if (type === 'rejectConfirm') {
const comment = data.comment;
try {
await Apis.selectMerchantsBasicInfo.post_rollback({
params: {
guid: selectMerchantsBasicInfoId.value,
},
data: {
appId: selectMerchantsBasicInfoId.value,
taskId: currData.value.taskId,
nodeId: '',
comment,
},
});
temporaryFormModalApi.close();
message.success('退回成功');
back();
} catch (error) {
logger.error('合同立项退回失败', error);
message.error('退回失败,请稍候再试');
}
}
}
async function handleSave() { async function handleSave() {
isLoading.value = true; isLoading.value = true;
@ -323,16 +415,31 @@ async function handleSubmit(type: 'openModal' | 'submit') {
const contractData = ref<any>({}); const contractData = ref<any>({});
const businessData = ref<any>({}); const businessData = ref<any>({});
const auditId = ref();
onMounted(async () => { onMounted(async () => {
isLoading.value = true; isLoading.value = true;
try { try {
if (id.value) { if (id.value) {
const dictMap = await getDictDatasAsync([
DICT_TYPE.contract_authorization_period,
DICT_TYPE.comprehensive_project_name,
DICT_TYPE.contract_price_style,
DICT_TYPE.contract_selection_method,
DICT_TYPE.section_type,
DICT_TYPE.contract_project_type,
DICT_TYPE.section_num,
DICT_TYPE.contract_price_style,
]);
console.log(dictMap);
const contractReferTypeData: any = await Apis.contractReferType.get_list({ const contractReferTypeData: any = await Apis.contractReferType.get_list({
params: {}, params: {},
}); });
contractTypeData.value = contractReferTypeData.rows || []; contractTypeData.value = contractReferTypeData.rows || [];
formBinding.value = getFormSchema({ formRef, dictMap });
formBindingByBaseInfo.value.columns = getFormSchemaByBaseInfo({ formBindingByBaseInfo.value.columns = getFormSchemaByBaseInfo({
contractTypeData: contractTypeData.value, contractTypeData: contractTypeData.value,
}); });
@ -358,6 +465,7 @@ onMounted(async () => {
const business: any = await Apis.selectMerchantsBasicInfo.get_getOne({ const business: any = await Apis.selectMerchantsBasicInfo.get_getOne({
params: { contractId: contract.contractId }, params: { contractId: contract.contractId },
}); });
selectMerchantsBasicInfoId.value = business.guid;
if (business.fileUuid) { if (business.fileUuid) {
const files = await fileUploader.select(business.fileUuid); const files = await fileUploader.select(business.fileUuid);
business.fileList = files; business.fileList = files;
@ -400,6 +508,11 @@ onMounted(async () => {
@confirm="handleChooseUserConfirm" @confirm="handleChooseUserConfirm"
/> />
<TemporaryFormModal
class="w-[950px]"
@confirm="handleAudit('rejectConfirm', $event)"
/>
<a-affix <a-affix
:offset-top="0" :offset-top="0"
:style="{ zIndex: 50 }" :style="{ zIndex: 50 }"
@ -410,12 +523,30 @@ onMounted(async () => {
<vben-button variant="primary" @click="handleSave()"> <vben-button variant="primary" @click="handleSave()">
保存 保存
</vben-button> </vben-button>
<vben-button variant="primary" @click="handleSubmit()"> <vben-button
:disabled="!selectMerchantsBasicInfoId"
variant="primary"
@click="handleSubmit('openModal')"
>
提交 提交
</vben-button> </vben-button>
<vben-button variant="destructive" @click="handleDelete()"> <vben-button variant="destructive" @click="handleDelete()">
废除 废除
</vben-button> </vben-button>
<vben-button
v-if="selectMerchantsBasicInfoId"
variant="primary"
@click="handleAudit('accessConfirm')"
>
通过
</vben-button>
<vben-button
v-if="selectMerchantsBasicInfoId"
variant="destructive"
@click="handleAudit('reject')"
>
退回
</vben-button>
<vben-button variant="secondary" @click="handleBack()"> <vben-button variant="secondary" @click="handleBack()">
返回 返回
</vben-button> </vben-button>

View File

@ -1,6 +1,8 @@
import type { VxeGridPropTypes } from 'vxe-table'; import type { VxeGridPropTypes } from 'vxe-table';
export const PrimaryKey = 'guid'; import { DICT_TYPE, getDictObj } from '#/utils/dict';
export const PrimaryKey = 'consignId';
export function getColumns(_params?: any): VxeGridPropTypes.Columns { export function getColumns(_params?: any): VxeGridPropTypes.Columns {
return [ return [
@ -15,40 +17,43 @@ export function getColumns(_params?: any): VxeGridPropTypes.Columns {
title: '签约授权编号', title: '签约授权编号',
field: 'consignId', field: 'consignId',
width: 200, width: 200,
align: 'center',
}, },
{ {
title: '受托人', title: '受托人',
field: 'trustee', field: 'userPerson',
width: 200, width: 200,
align: 'center',
}, },
{ {
title: '授权类型', title: '授权类型',
field: 'authorizationType', field: 'consignType',
width: 120, width: 120,
align: 'center', slots: {
default: ({ row }) => {
return (
getDictObj(DICT_TYPE.contract_authorization_type2, row.consignType)
?.label || ''
);
},
},
}, },
{ {
title: '授权期限(起)', title: '授权期限(起)',
field: 'authorizationStartDate', field: 'authorizationStartDate',
width: 150, width: 150,
align: 'center',
}, },
{ {
title: '授权期限(止)', title: '授权期限(止)',
field: 'authorizationEndDate', field: 'authorizationEndDate',
width: 150, width: 150,
align: 'center',
},
{
field: 'operate',
title: '操作',
width: 60,
align: 'center',
fixed: 'right',
slots: { default: 'operate' },
}, },
// {
// field: 'operate',
// title: '操作',
// width: 60,
// align: 'center',
// fixed: 'right',
// slots: { default: 'operate' },
// },
]; ];
} }

View File

@ -267,12 +267,18 @@ async function handleSave() {
} }
} }
async function handleSubmit() { async function handleSubmit(type: 'openModal' | 'submit') {
// isLoading.value = true // isLoading.value = true
chooseUserModalApi.setData({ if (type === 'openModal') {
title: '选择审批人', chooseUserModalApi.setData({
}); title: '选择审批人',
chooseUserModalApi.open(); });
chooseUserModalApi.open();
}
if (type === 'submit') {
// handleSubmit();
}
} }
onMounted(async () => { onMounted(async () => {
@ -286,7 +292,7 @@ onMounted(async () => {
if (id.value) { if (id.value) {
const data: any = await Apis.contractBaseInfo.get_getOne({ const data: any = await Apis.contractBaseInfo.get_getOne({
params: { guid: id.value }, params: { contractId: id.value },
}); });
currData.value = data; currData.value = data;
@ -369,7 +375,7 @@ onMounted(async () => {
<vben-button <vben-button
v-if="!id || currData.step === 'edit' || !currData.taskId" v-if="!id || currData.step === 'edit' || !currData.taskId"
variant="primary" variant="primary"
@click="handleSubmit()" @click="handleSubmit('openModal')"
> >
提交 提交
</vben-button> </vben-button>

View File

@ -5,7 +5,7 @@ import { dict } from '@fast-crud/fast-crud';
import { useRender } from '#/hooks/useRender'; import { useRender } from '#/hooks/useRender';
import { DICT_TYPE, getDictOptions } from '#/utils/dict'; import { DICT_TYPE, getDictOptions } from '#/utils/dict';
export const PrimaryKey = 'guid'; export const PrimaryKey = 'contractId';
export function getColumns(_params?: any): VxeGridPropTypes.Columns { export function getColumns(_params?: any): VxeGridPropTypes.Columns {
return [ return [

View File

@ -3,7 +3,12 @@ import { computed, onMounted, reactive, ref } from 'vue';
import { useRouter } from 'vue-router'; import { useRouter } from 'vue-router';
import { Page } from '@vben/common-ui'; import { Page } from '@vben/common-ui';
import { MdiExport, MdiRadioChecked, MdiRadioUnchecked } from '@vben/icons'; import {
MdiExport,
MdiRadioChecked,
MdiRadioUnchecked,
MdiUpdate,
} from '@vben/icons';
import { message } from 'ant-design-vue'; import { message } from 'ant-design-vue';

View File

@ -371,13 +371,13 @@ function downloadFile(fileUrl) {
:class="[bgColor]" :class="[bgColor]"
class="content-area mb-4 flex h-[50vh] items-center overflow-y-auto rounded-lg p-4" class="content-area mb-4 flex h-[50vh] items-center overflow-y-auto rounded-lg p-4"
> >
<p <div
:class="[textColor, textSize, { 'font-bold': isBold }]" :class="[textColor, textSize, { 'font-bold': isBold }]"
class="text-left" class="h-full text-left"
style="white-space: pre-line" style="white-space: pre-line"
> >
{{ currentSpeaker.abstracts }} {{ currentSpeaker.abstracts }}
</p> </div>
</div> </div>
<div class="attachments"> <div class="attachments">