diff --git a/README.md b/README.md index f31db442..a86a97fc 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ ```shell -generate-api --swagger_url=http://127.0.0.1:4523/export/openapi/2?version=3.0 --template ./resource/apiDefinitions.ejs --output_dir ./resource --type path --prefix_to_filter / +generate-api --swagger_url="http://127.0.0.1:4523/export/openapi?projectId=4582192&specialPurpose=openapi-generator" --template ./resource/apiDefinitions.ejs --output_dir ./resource --type path --prefix_to_filter / ``` diff --git a/apps/web-contract/src/router/routes/modules/contract.ts b/apps/web-contract/src/router/routes/modules/contract.ts index 681464bf..ece413c5 100644 --- a/apps/web-contract/src/router/routes/modules/contract.ts +++ b/apps/web-contract/src/router/routes/modules/contract.ts @@ -92,12 +92,6 @@ const routes: RouteRecordRaw[] = [ { name: 'ContractBusinessEdit', path: '/contract/business/edit/:id?', - beforeEnter: (e) => { - if (e.params.id && e.params.id === ':id') { - e.params.id = ''; - e.fullPath = '/contract/business/edit'; - } - }, component: () => import('#/views/contract/business/edit/index.vue'), meta: { hideInMenu: true, diff --git a/apps/web-contract/src/utils/dict/static.data.js b/apps/web-contract/src/utils/dict/static.data.js index da33261d..f726742c 100644 --- a/apps/web-contract/src/utils/dict/static.data.js +++ b/apps/web-contract/src/utils/dict/static.data.js @@ -99,11 +99,7 @@ export default { // 合同待办类型 contract_todo_type: createEntry('合同待办类型', [ { label: '合同立项', value: 'contractSetup' }, - { label: '合同立项废除', value: 'contractSetupAbolish' }, { label: '合同选商', value: 'selectMerchant' }, - { label: '合同选商废除', value: 'selectMerchantAbolish' }, - { label: '合同选商结果', value: 'selectMerchantResult' }, - { label: '合同选商结果废除', value: 'selectMerchantResultAbolish' }, { label: '合同申报', value: 'contractDeclare' }, { label: '合同签订', value: 'contractSign' }, { label: '合同履行', value: 'contractPerform' }, diff --git a/apps/web-contract/src/views/contract/business/edit/bid-columns.tsx b/apps/web-contract/src/views/contract/business/edit/bid-columns.tsx index e9cb3523..7ff8403d 100644 --- a/apps/web-contract/src/views/contract/business/edit/bid-columns.tsx +++ b/apps/web-contract/src/views/contract/business/edit/bid-columns.tsx @@ -2,6 +2,12 @@ import type { VxeGridPropTypes } from 'vxe-table'; export function getBidColumns(_params?: any): VxeGridPropTypes.Columns { const columns: VxeGridPropTypes.Columns = [ + { + field: 'operate', + title: '操作', + width: 120, + slots: { default: 'operate-slot' }, + }, { type: 'seq', width: 50, @@ -29,13 +35,6 @@ export function getBidColumns(_params?: any): VxeGridPropTypes.Columns { minWidth: 300, slots: { default: 'phasedesc-slot' }, }, - { - field: 'operate', - title: '操作', - width: 120, - slots: { default: 'operate-slot' }, - fixed: 'right', - }, ]; return columns; @@ -43,31 +42,42 @@ export function getBidColumns(_params?: any): VxeGridPropTypes.Columns { export function getProviderColumns(_params?: any): VxeGridPropTypes.Columns { const columns: VxeGridPropTypes.Columns = [ + { + field: 'operate', + title: '操作', + width: 120, + slots: { default: 'operate-slot' }, + }, { field: 'providerName', title: '供应商名称', - width: 200, + width: 250, }, { field: 'qualification', title: '资质情况', width: 200, + slots: { default: 'qualification-slot' }, }, { field: 'contactPerson', title: '联系人', width: 150, + slots: { default: 'contactPerson-slot' }, }, { field: 'contactPhone', title: '联系电话', width: 150, + slots: { default: 'contactPhone-slot' }, }, { field: 'remarks', title: '备注', minWidth: 200, + slots: { default: 'remarks-slot' }, }, + ]; return columns; diff --git a/apps/web-contract/src/views/contract/business/edit/curd.tsx b/apps/web-contract/src/views/contract/business/edit/curd.tsx index 4fdf6954..b7f7f2b8 100644 --- a/apps/web-contract/src/views/contract/business/edit/curd.tsx +++ b/apps/web-contract/src/views/contract/business/edit/curd.tsx @@ -14,13 +14,36 @@ const [ChooseCompanyModal, chooseCompanyModalApi] = useVbenModal({ connectedComponent: chooseCompanyModal, }); -export function getFormSchema(params: any = {}) { - const { formRef, dictMap = {} } = params; +const xGridRefs = ref>(new Map()); - const xGridRef = ref(); +const gridRefs = ref>(new Map()); + +export function getExtraData() { + // let tempBiddingList = xGridRef.value.getTableData().fullData; + // console.log(gridRefs.value); + + for (const [key, value] of xGridRefs.value) { + console.log(`Key: ${key}, Value: ${value}`); + let xRef = value; + console.log(xRef.getTableData().fullData); + } + + for (const [key, value] of gridRefs.value) { + console.log(`Key: ${key}, Value: ${value}`); + let xRef = value; + console.log(xRef.getTableData().fullData); + } + + return { + biddingList: [], + }; +} +export function getFormSchema(params: any = {}) { + let { formRef, dictMap = {}, bidList = [] } = params; /** Hooks - 表格 */ const gridOptions = { + showOverflow: true, columns: getBidColumns({ readOnly: false }), data: [], toolbarConfig: { @@ -55,15 +78,13 @@ export function getFormSchema(params: any = {}) { }, }; - const gridRefs = ref>(new Map()); - return { col: { span: 24 }, initialForm: { contractName: '', priceType: 'CNY', isBid: '0', - budgetSum2: 0, + bidNum: 2, }, labelCol: { style: { width: '120px' } }, columns: { @@ -209,29 +230,30 @@ export function getFormSchema(params: any = {}) { class="min-w-[180px]" onChange={(value) => { // 获取当前表格的全部数据 - const { fullData } = xGridRef.value.getTableData(); + let fullData = bidList; const currentLength = fullData.length; if (value < currentLength) { // 删除多余的行(从 value 开始的行) - const rowsToRemove = fullData.slice(value); - xGridRef.value.remove(rowsToRemove); + fullData = fullData.slice(0, value); } else if (value > currentLength) { // 插入新的行数据 const rowsToAdd = Array.from({ length: value - currentLength, }).map((_, i) => ({ - id: currentLength + i + 1, - bidName: `第${currentLength + i + 1}标段`, + phaseSeq: currentLength + i + 1, + phaseName: `第${currentLength + i + 1}标段`, + phaseMoney: null, + phaseDesc: '', providerList: [], })); - xGridRef.value.insertAt(rowsToAdd, -1); + fullData = [...fullData, ...rowsToAdd]; } - xGridRef.value.setAllRowExpand(true); + bidList = fullData; }} options={options2} - v-model:value={form.budgetSum2} + v-model:value={form.bidNum} /> @@ -242,16 +264,17 @@ export function getFormSchema(params: any = {}) { class="mt-2" style={{ display: - form.isBid === '1' && form.budgetSum2 > 0 - ? 'block' - : 'none', + form.isBid === '1' && form.bidNum > 0 ? 'block' : 'none', }} > - + el && xGridRefs.value.set(row.id, el)} + {...gridOptions} + > {{ 'bidname-slot': ({ row }: any) => ( - + ), 'phasemoney-slot': ({ row }: any) => ( el && gridRefs.value.set(row.id, el)} {...gridOptionsByProvider} - /> + > + {{ + 'qualification-slot': ({ row }: any) => ( + + ), + 'contactPerson-slot': ({ row }: any) => ( + + ), + 'contactPhone-slot': ({ row }: any) => ( + + ), + 'remarks-slot': ({ row }: any) => ( + + ), + 'operate-slot': ({ row }: any) => ( + { + const xGridRef = gridRefs.value.get(id); + xGridRef && xGridRef.remove(row); + }} + > + 移除 + + ), + }} + ), 'operate-slot': ({ row }: any) => ( (null); /** Hooks - 表格 */ const gridOptions = reactive( @@ -118,7 +118,8 @@ function handleDelete() { }); } -const collapses = ['1', '2', '3', '4']; +// const collapses = ['1', '2', '3', '4']; +const collapses = ['3', '4']; const collapseActiveKey = ref(collapses); function areArraysEqualUnordered(arr1, arr2) { if (arr1.length !== arr2.length) return false; @@ -154,24 +155,23 @@ async function handleAudit( 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) { + const [error, _] = await Apis.selectMerchantsBasicInfo.post_submit({ + params: { + guid: selectMerchantsBasicInfoId.value, + }, + data: { + appId: id.value, + taskId: currData.value.taskId, + nodeId: '', + comment: '通过', + }, + }); + if (error) { logger.error('审核通过失败', error); message.error('审核通过失败,请稍候再试'); + return; } + message.success('审核通过'); }, }); } @@ -231,6 +231,12 @@ async function handleAudit( } async function handleSave() { + console.log(formRefByBaseInfo.value.form); + + console.log(formRef.value.form); + + console.log(getExtraData()); + return; isLoading.value = true; try { @@ -416,13 +422,14 @@ const contractData = ref({}); const businessData = ref({}); const auditId = ref(); +const dictMap = ref({}); onMounted(async () => { isLoading.value = true; try { if (id.value) { - const dictMap = await getDictDatasAsync([ + dictMap.value = await getDictDatasAsync([ DICT_TYPE.contract_authorization_period, DICT_TYPE.comprehensive_project_name, DICT_TYPE.contract_price_style, @@ -432,13 +439,12 @@ onMounted(async () => { DICT_TYPE.section_num, DICT_TYPE.contract_price_style, ]); - console.log(dictMap); const contractReferTypeData: any = await Apis.contractReferType.get_list({ params: {}, }); contractTypeData.value = contractReferTypeData.rows || []; - formBinding.value = getFormSchema({ formRef, dictMap }); + formBinding.value = getFormSchema({ formRef, dictMap: dictMap.value }); formBindingByBaseInfo.value.columns = getFormSchemaByBaseInfo({ contractTypeData: contractTypeData.value, @@ -470,6 +476,9 @@ onMounted(async () => { const files = await fileUploader.select(business.fileUuid); business.fileList = files; } + + business.isBid = '1'; + business.bidNum = 2; businessData.value = business; nextTick(() => { @@ -560,7 +569,12 @@ onMounted(async () => {
- + { - + - - + + + + - + {
- + { - + - + - + - + - + { + return useRender.renderDate(row.applyTime, 'YYYY-MM-DD'); + }, + }, + }, + { field: 'inputDepartName', title: '备注', width: 150 }, ]; } return [ diff --git a/apps/web-contract/src/views/contract/components/todo-page/todo-page.vue b/apps/web-contract/src/views/contract/components/todo-page/todo-page.vue index 33127732..af48ab8d 100644 --- a/apps/web-contract/src/views/contract/components/todo-page/todo-page.vue +++ b/apps/web-contract/src/views/contract/components/todo-page/todo-page.vue @@ -7,7 +7,7 @@ import { Page } from '@vben/common-ui'; import Apis from '#/api'; import { useVxeTable } from '#/hooks/vxeTable'; import { getTodoColumns } from '#/views/contract/schema'; -import { toDetail, toDetailPage } from '#/views/contract/utils'; +import { toDetailPage } from '#/views/contract/utils'; const props = withDefaults( defineProps<{ @@ -80,6 +80,22 @@ const grid2Options = reactive( }), ); +function toDetail(type: string, id: string, row?: any) { + switch (type) { + case 'contractSetup': { + router.push(`/contract/approval/edit/${id}`); + break; + } + case 'selectMerchant': { + router.push(`/contract/business/edit/${row.contractId}`); + break; + } + default: { + break; + } + } +} + onMounted(() => {}); // 页面打开后获取列表数据 diff --git a/apps/web-contract/src/views/contract/schema.ts b/apps/web-contract/src/views/contract/schema.ts index 1eb484c7..4c87a402 100644 --- a/apps/web-contract/src/views/contract/schema.ts +++ b/apps/web-contract/src/views/contract/schema.ts @@ -16,13 +16,13 @@ export function getTodoColumns(_params: any = {}): VxeGridPropTypes.Columns { { field: 'contractName', title: '名称', - minWidth: 200, + minWidth: 250, slots: { default: 'title_slot' }, }, { field: 'module', title: '模块', - width: 150, + width: 120, slots: { default: ({ row }) => { return ( @@ -52,11 +52,11 @@ export function getApprovalColumns( ): VxeGridPropTypes.Columns { return [ { type: 'seq', width: 50, align: 'center', fixed: 'left' }, - { field: 'contractId', title: '编号', width: 100 }, + { field: 'contractId', title: '编号', width: 150 }, { field: 'title', title: '任务名称', - minWidth: 200, + minWidth: 250, slots: { default: ({ row }) => { const text = row.title; diff --git a/apps/web-contract/src/views/contract/utils.ts b/apps/web-contract/src/views/contract/utils.ts index ca7f6a13..ec1a9e24 100644 --- a/apps/web-contract/src/views/contract/utils.ts +++ b/apps/web-contract/src/views/contract/utils.ts @@ -1,26 +1,4 @@ import Apis from '#/api'; -import { router } from '#/router'; - -/** - * 前往详情页 - * @param type - * @param id - */ -export function toDetail(type: string, id: string, row?: any) { - switch (type) { - case 'contractSetup': { - router.push(`/contract/approval/edit/${id}`); - break; - } - case 'selectMerchant': { - router.push(`/contract/business/edit/${row.contractId}`); - break; - } - default: { - break; - } - } -} /** * 前往详情页 diff --git a/apps/web-contract/src/views/user-center/todo/index.vue b/apps/web-contract/src/views/user-center/todo/index.vue index 760043c9..ffafd402 100644 --- a/apps/web-contract/src/views/user-center/todo/index.vue +++ b/apps/web-contract/src/views/user-center/todo/index.vue @@ -7,7 +7,10 @@ import Apis from '#/api'; import { useVxeTable } from '#/hooks/vxeTable'; import { DICT_TYPE, getDictOptions } from '#/utils/dict'; import { getTodoColumns } from '#/views/contract/schema'; -import { toDetail, toDetailPage } from '#/views/contract/utils'; +import { toDetailPage } from '#/views/contract/utils'; +import { useRouter } from 'vue-router'; + +const router = useRouter(); const { xGridRef, triggerProxy, gridProps } = useVxeTable({ ref: 'xGridRef' }); const { xGridRef: xGrid2Ref, triggerProxy: triggerProxy2 } = useVxeTable({ @@ -89,6 +92,22 @@ async function loadDataByDictType() { treeData.value = [{ title: '全部', key: 'all', children: data }]; } +function toDetail(type: string, id: string, row?: any) { + switch (type) { + case 'contractSetup': { + router.push(`/contract/approval/edit/${id}`); + break; + } + case 'selectMerchant': { + router.push(`/contract/business/edit/${row.contractId}`); + break; + } + default: { + break; + } + } +} + onMounted(() => { loadDataByDictType(); }); @@ -150,6 +169,11 @@ onMounted(() => { > +