diff --git a/apps/web-contract/src/views/contract/iframe-info/components/info-archived/curd.tsx b/apps/web-contract/src/views/contract/iframe-info/components/info-archived/curd.tsx new file mode 100644 index 00000000..f7c7264f --- /dev/null +++ b/apps/web-contract/src/views/contract/iframe-info/components/info-archived/curd.tsx @@ -0,0 +1,308 @@ +import { DICT_TYPE, getDictObj, getDictOptions } from '#/utils/dict'; +import { dict } from '@fast-crud/fast-crud'; + +/** + * 筛选合同列表数据 + * + */ +function filterContractTypes(contractTypeData: any = [], parentId: string) { + return contractTypeData + .map((item) => { + item.label = item.contrLevelName; + item.value = item.contrLevelId; + return item; + }) + .filter((item) => item.parentId === parentId); +} + +export function getFormSchema(params: any = {}) { + const { contractTypeData, readOnly = false } = params; + + return { + contractName: { + title: '合同名称', + key: 'contractName', + col: { span: 24 }, + component: { + name: 'a-input', + vModel: 'value', + allowClear: false, + }, + conditionalRender: { + match({ form }) { + return readOnly; + }, + render({ form }) { + return {form.contractName}; + }, + }, + rules: [{ required: true }], + }, + ctrType: { + title: '合同类别', + key: 'ctrType', + col: { span: 12 }, + component: { + name: 'fs-dict-select', + vModel: 'value', + class: 'min-w-[200px]', + dict: dict({ + async getData({ form = {} }) { + return filterContractTypes(contractTypeData, '-1'); + }, + }), + }, + valueChange({ form, value, getComponentRef }) { + form.ctrTwoType = undefined; + if (value) { + getComponentRef('ctrTwoType').reloadDict(); // 执行city的select组件的reloadDict()方法,触发“city”重新加载字典 + } + }, + conditionalRender: { + match({ form }) { + return readOnly; + }, + render({ form }) { + let data = filterContractTypes(contractTypeData, '-1'); + for (const item of data) { + if (item.value === form.ctrType) { + return {item.label}; + } + } + return ; + }, + }, + rules: [{ required: true }], + }, + ctrTwoType: { + title: '二级类别', + key: 'ctrTwoType', + col: { span: 12 }, + component: { + name: 'fs-dict-select', + vModel: 'value', + class: 'min-w-[200px]', + dict: dict({ + async getData({ form = {} }) { + return filterContractTypes(contractTypeData, form.ctrType); + }, + }), + }, + conditionalRender: { + match({ form }) { + return readOnly; + }, + render({ form }) { + let data = filterContractTypes(contractTypeData, form.ctrType); + for (const item of data) { + if (item.value === form.ctrTwoType) { + return {item.label}; + } + } + return ; + }, + }, + rules: [{ required: true }], + }, + frameProtocol: { + title: '框架协议', + key: 'frameProtocol', + col: { span: 8 }, + component: { + name: 'fs-dict-radio', + vModel: 'value', + dict: dict({ + data: getDictOptions(DICT_TYPE.common_whether), + }), + }, + conditionalRender: { + match({ form }) { + return readOnly; + }, + render({ form }) { + return ( + + {getDictObj(DICT_TYPE.common_whether, form.frameProtocol)?.label} + + ); + }, + }, + }, + frameProtocolCtr: { + title: '框架协议下的合同', + key: 'frameProtocolCtr', + col: { span: 12 }, + labelCol: { style: { width: '200px' } }, + component: { + name: 'fs-dict-radio', + vModel: 'value', + dict: dict({ + data: getDictOptions(DICT_TYPE.common_whether), + }), + }, + conditionalRender: { + match({ form }) { + return readOnly; + }, + render({ form }) { + return ( + + { + getDictObj(DICT_TYPE.common_whether, form.frameProtocolCtr) + ?.label + } + + ); + }, + }, + }, + fundAllocation: { + title: '资金流向', + key: 'fundAllocation', + col: { span: 12 }, + component: { + name: 'fs-dict-select', + vModel: 'value', + allowClear: false, + class: 'min-w-[200px]', + dict: dict({ + data: getDictOptions(DICT_TYPE.contract_fund_flow), + }), + }, + valueChange: { + immediate: true, //是否立即执行一次 + handle({ form }) { + console.log(form); + form.fundAllocationName = getDictObj( + DICT_TYPE.contract_fund_flow, + form.fundAllocation, + )?.label; + }, + }, + conditionalRender: { + match({ form }) { + return readOnly; + }, + render({ form }) { + return ( + + { + getDictObj(DICT_TYPE.contract_fund_flow, form.fundAllocation) + ?.label + } + + ); + }, + }, + rules: [{ required: true, message: '请选择资金流向' }], + }, + fundDitch: { + title: '资金渠道', + key: 'fundDitch', + col: { span: 12 }, + component: { + name: 'fs-dict-select', + vModel: 'value', + allowClear: false, + class: 'min-w-[200px]', + dict: dict({ + data: getDictOptions(DICT_TYPE.contract_funding_source), + }), + }, + conditionalRender: { + match({ form }) { + return readOnly; + }, + render({ form }) { + return ( + + { + getDictObj(DICT_TYPE.contract_funding_source, form.fundDitch) + ?.label + } + + ); + }, + }, + rules: [{ required: true, message: '请选择资金渠道' }], + }, + budgetSum: { + title: '预算金额', + key: 'budgetSum', + col: { span: 8 }, + colon: false, + component: { + name: 'a-input-number', + vModel: 'value', + class: 'w-full', + min: 0, + max: 9999, + }, + conditionalRender: { + match({ form }) { + return readOnly; + }, + render({ form }) { + return {form.budgetSum}; + }, + }, + }, + priceType: { + title: '', + key: 'priceType', + col: { span: 6 }, + labelCol: { style: { width: '12px' } }, + colon: false, + component: { + name: 'fs-dict-select', + vModel: 'value', + dict: dict({ + data: getDictOptions(DICT_TYPE.contract_currency_unit), + }), + }, + conditionalRender: { + match({ form }) { + return readOnly; + }, + render({ form }) { + return ( + + {getDictObj(DICT_TYPE.contract_currency_unit, form.priceType)} + + ); + }, + }, + }, + organiza: { + title: '组织形式', + key: 'organiza', + col: { span: 24 }, + component: { + name: 'fs-dict-radio', + vModel: 'value', + allowClear: false, + class: 'min-w-[200px]', + dict: dict({ + data: getDictOptions(DICT_TYPE.contract_organization_form), + }), + }, + conditionalRender: { + match({ form }) { + return readOnly; + }, + render({ form }) { + return ( + + {getDictObj(DICT_TYPE.contract_organization_form, form.organiza)} + + ); + }, + }, + rules: [{ required: true, message: '请选择组织形式' }], + }, + fileList: { + title: '相关附件', + key: 'fileList', + }, + }; +} diff --git a/apps/web-contract/src/views/contract/iframe-info/components/info-archived/info-archived.vue b/apps/web-contract/src/views/contract/iframe-info/components/info-archived/info-archived.vue index 443512f8..ef107937 100644 --- a/apps/web-contract/src/views/contract/iframe-info/components/info-archived/info-archived.vue +++ b/apps/web-contract/src/views/contract/iframe-info/components/info-archived/info-archived.vue @@ -1,13 +1,221 @@ -