diff --git a/.husky/commit-msg b/.husky/commit-msg index 270ebb8c..86a85c29 100644 --- a/.husky/commit-msg +++ b/.husky/commit-msg @@ -1,6 +1,6 @@ echo Start running commit-msg hook... # Check whether the git commit information is standardized -pnpm exec commitlint --edit "$1" +# pnpm exec commitlint --edit "$1" echo Run commit-msg hook done. diff --git a/apps/web-office/src/views/contract/business/edit/curd.tsx b/apps/web-office/src/views/contract/business/edit/curd.tsx index 45e5c731..badb4607 100644 --- a/apps/web-office/src/views/contract/business/edit/curd.tsx +++ b/apps/web-office/src/views/contract/business/edit/curd.tsx @@ -1,27 +1,12 @@ import { DICT_TYPE, 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 } = params +export function getFormSchema(_params: any = {}) { return { - contractName: { - title: "合同名称", - key: "contractName", + projectNum: { + title: "项目", + key: "projectNum", col: { span: 24 }, component: { name: "a-input", @@ -30,72 +15,57 @@ export function getFormSchema(params: any = {}) { }, rules: [{ required: true }], }, - ctrType: { - title: "合同类别", - key: "ctrType", + projectProp: { + title: "项目类别", + key: "projectProp", col: { span: 12 }, component: { name: "fs-dict-select", vModel: "value", class: 'min-w-[200px]', dict: dict({ - async getData({ form = {} }) { - return filterContractTypes(contractTypeData, "-1"); - }, + data: getDictOptions(DICT_TYPE.contractProjectType) }), }, - valueChange({ form, value, getComponentRef }) { - form.ctrTwoType = undefined; - if (value) { - getComponentRef("ctrTwoType").reloadDict(); // 执行city的select组件的reloadDict()方法,触发“city”重新加载字典 - } - }, rules: [{ required: true }], }, - ctrTwoType: { - title: "二级类别", - key: "ctrTwoType", + projectName: { + title: "项目名称", + key: "projectName", col: { span: 12 }, component: { name: "fs-dict-select", vModel: "value", class: 'min-w-[200px]', dict: dict({ - async getData({ form = {} }) { - return filterContractTypes(contractTypeData, form.ctrType); - }, + data: getDictOptions(DICT_TYPE.comprehensiveProjectName) }), }, rules: [{ required: true }], }, - frameProtocol: { - title: "框架协议", - key: "frameProtocol", + priceStyleId: { + title: "商务计价方式", + key: "priceStyleId", col: { span: 8 }, component: { name: "fs-dict-radio", vModel: "value", + class: 'min-w-[200px]', dict: dict({ - data: [ - { label: "是", value: 1, }, - { label: "否", value: 0 }, - ] + data: getDictOptions(DICT_TYPE.contractPriceStyle) }), }, }, - frameProtocolCtr: { - title: "框架协议下的合同", - key: "frameProtocolCtr", + choiceType: { + title: "选商方式", + key: "choiceType", col: { span: 12 }, labelCol: { style: { width: "200px" } }, component: { name: "fs-dict-radio", vModel: "value", dict: dict({ - data: [ - { label: "是", value: 1, }, - { label: "否", value: 0 }, - ] + data: getDictOptions(DICT_TYPE.contractSelectionMethod) }), }, }, diff --git a/apps/web-office/src/views/contract/business/edit/index.vue b/apps/web-office/src/views/contract/business/edit/index.vue index 20c450c4..eff051b4 100644 --- a/apps/web-office/src/views/contract/business/edit/index.vue +++ b/apps/web-office/src/views/contract/business/edit/index.vue @@ -3,7 +3,6 @@ import { ref, computed, reactive, onMounted, nextTick, onUnmounted } from "vue"; import { MdiAdd } from '@vben/icons'; import { Page, useVbenModal } from "@vben/common-ui"; -import { dict, type FormScopeContext } from "@fast-crud/fast-crud"; import { MdiUpload } from "@vben/icons"; import { useRouter } from 'vue-router' import dayjs, { Dayjs } from "dayjs"; @@ -23,12 +22,13 @@ const fileUploader = new FileUploader({}) const router = useRouter(); const route = useRoute(); const id = route.params.id; +const pageRef = ref(); let showHelpTip = ref(false); const containerRef = ref(); const formRef = ref(); -const form2Ref = ref(); +const formRefByBaseInfo = ref(); let isLoading = ref(false) @@ -219,6 +219,8 @@ async function handleSubmit() { } } +let contractData = ref({}) +let businessData = ref({}) const currData = ref({}) @@ -226,39 +228,42 @@ onMounted(async () => { isLoading.value = true console.log(id) - // let formSchema = getFormSchema() - - // formBinding.value = formSchema - try { - - let contractReferTypeData = await Apis.contractReferType.get_list({ params: {} }) - contractTypeData.value = contractReferTypeData.rows || []; - - formBindingByBaseInfo.value.columns = getFormSchemaByBaseInfo({ - contractTypeData: contractTypeData.value - }) - if (id) { - let data = await Apis.contractBaseInfo.get_getOne({ params: { guid: id } }) - console.log(data) - currData.value = data; - nextTick(() => { - formRef.value.setFormData(data) + let contractReferTypeData = await Apis.contractReferType.get_list({ params: {} }) + contractTypeData.value = contractReferTypeData.rows || []; + + formBindingByBaseInfo.value.columns = getFormSchemaByBaseInfo({ + contractTypeData: contractTypeData.value }) - if (data.fileUuid) { - let files = await fileUploader.select(data.fileUuid) - console.log(files) + // 先查合同基本信息 + let contract: any = await Apis.contractBaseInfo.get_getOne({ params: { guid: id } }) + if (contract && contract.contractId) { + contractData.value = contract + + let business: any = await Apis.selectMerchantsBasicInfo.get_getOne({ params: { contractId: contract.contractId } }) + console.log(business) + if (business.fileUuid) { + let files = await fileUploader.select(business.fileUuid) + business.fileList = files + } + businessData.value = business + + nextTick(() => { - formRef.value.setFormData({ - fileList: files - }) + formRefByBaseInfo.value.setFormData(contract) + formRef.value.setFormData(business) }) + + } else { + throw new Error("当前合同信息不存在") } loadDataByContractTypeData() + } else { + throw new Error("当前合同信息不存在") } } catch (error) { console.log(error); @@ -281,22 +286,27 @@ onMounted(async () => {