2025-08-19 20:05:28 +08:00
|
|
|
|
<template>
|
|
|
|
|
<div class="p-2">
|
|
|
|
|
<transition :enter-active-class="proxy?.animate.searchAnimate.enter" :leave-active-class="proxy?.animate.searchAnimate.leave">
|
|
|
|
|
<div v-show="showSearch" class="mb-[10px]">
|
|
|
|
|
<el-card shadow="hover">
|
|
|
|
|
<el-form ref="queryFormRef" :model="queryParams" :inline="true">
|
2025-08-20 21:22:56 +08:00
|
|
|
|
<el-form-item label="分包类型名称" prop="dictName">
|
|
|
|
|
<el-input v-model="queryParams.dictName" placeholder="请输入分包类型名称" clearable @keyup.enter="handleQuery" />
|
2025-08-19 20:05:28 +08:00
|
|
|
|
</el-form-item>
|
2025-08-20 21:22:56 +08:00
|
|
|
|
<el-form-item label="名称" prop="name">
|
|
|
|
|
<el-input v-model="queryParams.name" placeholder="请输入名称" clearable @keyup.enter="handleQuery" />
|
2025-08-19 20:05:28 +08:00
|
|
|
|
</el-form-item>
|
2025-08-20 21:22:56 +08:00
|
|
|
|
<el-form-item label="计划招标时间" prop="plannedBiddingTime">
|
|
|
|
|
<el-date-picker
|
|
|
|
|
clearable
|
|
|
|
|
v-model="queryParams.plannedBiddingTime"
|
2025-08-19 20:05:28 +08:00
|
|
|
|
type="date"
|
|
|
|
|
value-format="YYYY-MM-DD"
|
|
|
|
|
placeholder="请选择计划招标时间"
|
|
|
|
|
/>
|
|
|
|
|
</el-form-item>
|
2025-08-20 21:22:56 +08:00
|
|
|
|
<el-form-item label="招标方式(公招,邀标)" prop="plannedBiddingMethod">
|
|
|
|
|
<el-input v-model="queryParams.plannedBiddingMethod" placeholder="请输入招标方式(公招,邀标)" clearable @keyup.enter="handleQuery" />
|
2025-08-19 20:05:28 +08:00
|
|
|
|
</el-form-item>
|
2025-08-20 21:22:56 +08:00
|
|
|
|
<el-form-item label="总价" prop="price">
|
|
|
|
|
<el-input v-model="queryParams.price" placeholder="请输入总价" clearable @keyup.enter="handleQuery" />
|
|
|
|
|
</el-form-item>
|
|
|
|
|
<el-form-item label="限价" prop="limitPrice">
|
|
|
|
|
<el-input v-model="queryParams.limitPrice" placeholder="请输入限价" clearable @keyup.enter="handleQuery" />
|
|
|
|
|
</el-form-item>
|
|
|
|
|
<el-form-item label="合同额" prop="contractPrice">
|
|
|
|
|
<el-input v-model="queryParams.contractPrice" placeholder="请输入合同额" clearable @keyup.enter="handleQuery" />
|
2025-08-19 20:05:28 +08:00
|
|
|
|
</el-form-item>
|
|
|
|
|
<el-form-item>
|
|
|
|
|
<el-button type="primary" icon="Search" @click="handleQuery">搜索</el-button>
|
|
|
|
|
<el-button icon="Refresh" @click="resetQuery">重置</el-button>
|
|
|
|
|
</el-form-item>
|
|
|
|
|
</el-form>
|
|
|
|
|
</el-card>
|
|
|
|
|
</div>
|
|
|
|
|
</transition>
|
|
|
|
|
|
|
|
|
|
<el-card shadow="never">
|
|
|
|
|
<template #header>
|
|
|
|
|
<el-row :gutter="10" class="mb8">
|
|
|
|
|
<el-col :span="1.5">
|
|
|
|
|
<el-button type="success" plain icon="Edit" :disabled="single" @click="handleUpdate()" v-hasPermi="['plan:plan:edit']">修改</el-button>
|
|
|
|
|
</el-col>
|
2025-08-20 21:22:56 +08:00
|
|
|
|
<!-- 多文件上传按钮 -->
|
|
|
|
|
<el-col :span="2">
|
|
|
|
|
<el-button type="primary" plain icon="Upload" @click="openFileUploadDialog()" v-hasPermi="['plan:plan:upload']"> 上传文件 </el-button>
|
2025-08-19 20:05:28 +08:00
|
|
|
|
</el-col>
|
|
|
|
|
<el-col :span="1.5">
|
|
|
|
|
<el-button type="warning" plain icon="Download" @click="handleExport" v-hasPermi="['plan:plan:export']">导出</el-button>
|
|
|
|
|
</el-col>
|
|
|
|
|
<right-toolbar v-model:showSearch="showSearch" @queryTable="getList"></right-toolbar>
|
|
|
|
|
</el-row>
|
|
|
|
|
</template>
|
|
|
|
|
|
|
|
|
|
<el-table v-loading="loading" :data="planList" @selection-change="handleSelectionChange">
|
|
|
|
|
<el-table-column type="selection" width="55" align="center" />
|
2025-08-20 21:22:56 +08:00
|
|
|
|
<el-table-column label="主键ID" align="center" prop="id" v-if="false" />
|
|
|
|
|
<el-table-column label="项目Id" align="center" prop="projectId" v-if="false" />
|
|
|
|
|
<el-table-column label="分包类型名称" align="center" prop="dictName" />
|
|
|
|
|
<el-table-column label="名称" align="center" prop="name" />
|
|
|
|
|
<el-table-column label="计划招标时间" align="center" prop="plannedBiddingTime" width="180" v-if="false">
|
2025-08-19 20:05:28 +08:00
|
|
|
|
<template #default="scope">
|
2025-08-20 21:22:56 +08:00
|
|
|
|
<span>{{ parseTime(scope.row.plannedBiddingTime, '{y}-{m}-{d}') }}</span>
|
2025-08-19 20:05:28 +08:00
|
|
|
|
</template>
|
|
|
|
|
</el-table-column>
|
2025-08-20 21:22:56 +08:00
|
|
|
|
<el-table-column label="招标方式(公招,邀标)" align="center" prop="plannedBiddingMethod" />
|
|
|
|
|
<el-table-column label="总价" align="center" prop="price" v-if="false" />
|
|
|
|
|
<el-table-column label="限价" align="center" prop="limitPrice" />
|
|
|
|
|
<el-table-column label="合同额" align="center" prop="contractPrice" />
|
|
|
|
|
<el-table-column label="分包内容" align="center" prop="content" />
|
|
|
|
|
<el-table-column label="中标通知书" align="center" prop="bidFile" />
|
2025-08-19 20:05:28 +08:00
|
|
|
|
<el-table-column label="操作" align="center" class-name="small-padding fixed-width">
|
|
|
|
|
<template #default="scope">
|
|
|
|
|
<el-tooltip content="修改" placement="top">
|
|
|
|
|
<el-button link type="primary" icon="Edit" @click="handleUpdate(scope.row)" v-hasPermi="['plan:plan:edit']"></el-button>
|
|
|
|
|
</el-tooltip>
|
|
|
|
|
</template>
|
|
|
|
|
</el-table-column>
|
|
|
|
|
</el-table>
|
|
|
|
|
|
|
|
|
|
<pagination v-show="total > 0" :total="total" v-model:page="queryParams.pageNum" v-model:limit="queryParams.pageSize" @pagination="getList" />
|
|
|
|
|
</el-card>
|
2025-08-20 21:22:56 +08:00
|
|
|
|
|
|
|
|
|
<!-- 多文件上传对话框 -->
|
|
|
|
|
<el-dialog :title="fileUploadDialog.title" v-model="fileUploadDialog.visible" width="600px" append-to-body>
|
|
|
|
|
<div class="upload-container">
|
|
|
|
|
<el-upload
|
|
|
|
|
class="upload-demo"
|
|
|
|
|
drag
|
|
|
|
|
action=""
|
|
|
|
|
:http-request="handleFileUpload"
|
|
|
|
|
:multiple="true"
|
|
|
|
|
:on-preview="handleFilePreview"
|
|
|
|
|
:on-remove="handleFileRemove"
|
|
|
|
|
:file-list="fileList"
|
|
|
|
|
:auto-upload="false"
|
|
|
|
|
>
|
|
|
|
|
<el-icon class="el-icon--upload"><upload-filled /></el-icon>
|
|
|
|
|
<div class="el-upload__text">点击或拖拽文件到此处上传</div>
|
|
|
|
|
<template #tip>
|
|
|
|
|
<div class="el-upload__tip text-sm text-gray-500">支持上传多个文件,格式不限,单个文件大小不超过10MB</div>
|
|
|
|
|
</template>
|
|
|
|
|
</el-upload>
|
|
|
|
|
|
|
|
|
|
<div class="mt-4 flex justify-end">
|
|
|
|
|
<el-button @click="cancelFileUpload">取消</el-button>
|
|
|
|
|
<el-button type="primary" @click="submitFileUpload" class="ml-2"> 确认上传 </el-button>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
</el-dialog>
|
|
|
|
|
|
2025-08-19 20:05:28 +08:00
|
|
|
|
<!-- 添加或修改招标计划对话框 -->
|
|
|
|
|
<el-dialog :title="dialog.title" v-model="dialog.visible" width="500px" append-to-body>
|
2025-08-20 21:22:56 +08:00
|
|
|
|
<el-form ref="planFormRef" :model="form" :rules="rules" label-width="120px">
|
|
|
|
|
<!-- 调整项目ID表单项:与目标代码一致,自动关联当前项目并显示提示 -->
|
|
|
|
|
<el-input v-model="form.projectId" placeholder="请输入项目ID" :readonly="!!currentProjectId" :disabled="!!currentProjectId" v-if="false" />
|
|
|
|
|
<template #help>
|
|
|
|
|
<span v-if="currentProjectId" class="text-success">已自动关联当前选中项目</span>
|
|
|
|
|
</template>
|
|
|
|
|
<el-input v-model="form.id" placeholder="ID" readonly v-if="false" />
|
|
|
|
|
<el-form-item label="分包类型名称" prop="dictName" v-if="false">
|
|
|
|
|
<el-input v-model="form.dictName" placeholder="请输入分包类型名称" />
|
2025-08-19 20:05:28 +08:00
|
|
|
|
</el-form-item>
|
2025-08-20 21:22:56 +08:00
|
|
|
|
|
|
|
|
|
<el-form-item label="名称" prop="name">
|
|
|
|
|
<el-input v-model="form.name" placeholder="请输入名称" />
|
2025-08-19 20:05:28 +08:00
|
|
|
|
</el-form-item>
|
2025-08-20 21:22:56 +08:00
|
|
|
|
|
|
|
|
|
<el-form-item label="计划招标时间" prop="plannedBiddingTime" v-if="false">
|
|
|
|
|
<el-date-picker clearable v-model="form.plannedBiddingTime" type="date" value-format="YYYY-MM-DD" placeholder="请选择计划招标时间" />
|
2025-08-19 20:05:28 +08:00
|
|
|
|
</el-form-item>
|
2025-08-20 21:22:56 +08:00
|
|
|
|
|
|
|
|
|
<el-form-item label="招标方式(公招,邀标)" prop="plannedBiddingMethod">
|
|
|
|
|
<el-input v-model="form.plannedBiddingMethod" placeholder="请输入招标方式(公招,邀标)" />
|
2025-08-19 20:05:28 +08:00
|
|
|
|
</el-form-item>
|
2025-08-20 21:22:56 +08:00
|
|
|
|
|
|
|
|
|
<el-form-item label="总价" prop="price" v-if="false">
|
|
|
|
|
<el-input v-model="form.price" placeholder="请输入总价" />
|
2025-08-19 20:05:28 +08:00
|
|
|
|
</el-form-item>
|
2025-08-20 21:22:56 +08:00
|
|
|
|
|
|
|
|
|
<el-form-item label="限价" prop="limitPrice">
|
|
|
|
|
<el-input v-model="form.limitPrice" placeholder="请输入限价" />
|
2025-08-19 20:05:28 +08:00
|
|
|
|
</el-form-item>
|
2025-08-20 21:22:56 +08:00
|
|
|
|
|
|
|
|
|
<el-form-item label="合同额" prop="contractPrice">
|
|
|
|
|
<el-input v-model="form.contractPrice" placeholder="请输入合同额" />
|
2025-08-19 20:05:28 +08:00
|
|
|
|
</el-form-item>
|
2025-08-20 21:22:56 +08:00
|
|
|
|
|
|
|
|
|
<el-form-item label="分包内容" prop="content">
|
|
|
|
|
<el-input v-model="form.content" type="textarea" placeholder="请输入分包内容" rows="3" />
|
|
|
|
|
</el-form-item>
|
|
|
|
|
|
|
|
|
|
<el-form-item label="中标通知书" prop="bidFile">
|
|
|
|
|
<file-upload v-model="form.bidFile" />
|
2025-08-19 20:05:28 +08:00
|
|
|
|
</el-form-item>
|
|
|
|
|
</el-form>
|
|
|
|
|
<template #footer>
|
|
|
|
|
<div class="dialog-footer">
|
|
|
|
|
<el-button :loading="buttonLoading" type="primary" @click="submitForm">确 定</el-button>
|
|
|
|
|
<el-button @click="cancel">取 消</el-button>
|
|
|
|
|
</div>
|
|
|
|
|
</template>
|
|
|
|
|
</el-dialog>
|
|
|
|
|
</div>
|
|
|
|
|
</template>
|
|
|
|
|
|
|
|
|
|
<script setup name="Plan" lang="ts">
|
|
|
|
|
import { listPlan, getPlan, delPlan, addPlan, updatePlan } from '@/api/plan/plan';
|
|
|
|
|
import { PlanVO, PlanQuery, PlanForm } from '@/api/plan/plan/types';
|
2025-08-20 21:22:56 +08:00
|
|
|
|
import { getCurrentInstance, onMounted, ref, reactive, toRefs, computed, watch } from 'vue';
|
|
|
|
|
import type { ElFormInstance } from 'element-plus';
|
|
|
|
|
import { useUserStoreHook } from '@/store/modules/user';
|
|
|
|
|
import { UploadFilled } from '@element-plus/icons-vue';
|
|
|
|
|
import type { UploadFile, UploadRawFile } from 'element-plus';
|
|
|
|
|
// 导入文件上传接口(根据实际项目路径调整)
|
|
|
|
|
import { uploadFile } from '@/api/plan/file';
|
|
|
|
|
|
|
|
|
|
// 从用户Store获取当前选中项目及ID
|
|
|
|
|
const userStore = useUserStoreHook();
|
|
|
|
|
const currentProject = computed(() => userStore.selectedProject);
|
|
|
|
|
const currentProjectId = computed(() => currentProject.value?.id);
|
|
|
|
|
|
|
|
|
|
// 类型定义
|
|
|
|
|
interface DialogOption {
|
|
|
|
|
visible: boolean;
|
|
|
|
|
title: string;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
interface PageData<F, Q> {
|
|
|
|
|
form: F;
|
|
|
|
|
queryParams: Q;
|
|
|
|
|
rules: Record<string, any[]>;
|
|
|
|
|
}
|
2025-08-19 20:05:28 +08:00
|
|
|
|
|
|
|
|
|
const { proxy } = getCurrentInstance() as ComponentInternalInstance;
|
|
|
|
|
|
|
|
|
|
const planList = ref<PlanVO[]>([]);
|
|
|
|
|
const buttonLoading = ref(false);
|
|
|
|
|
const loading = ref(true);
|
|
|
|
|
const showSearch = ref(true);
|
|
|
|
|
const ids = ref<Array<string | number>>([]);
|
|
|
|
|
const single = ref(true);
|
|
|
|
|
const multiple = ref(true);
|
|
|
|
|
const total = ref(0);
|
|
|
|
|
|
|
|
|
|
const queryFormRef = ref<ElFormInstance>();
|
|
|
|
|
const planFormRef = ref<ElFormInstance>();
|
|
|
|
|
|
|
|
|
|
const dialog = reactive<DialogOption>({
|
|
|
|
|
visible: false,
|
|
|
|
|
title: ''
|
|
|
|
|
});
|
|
|
|
|
|
2025-08-20 21:22:56 +08:00
|
|
|
|
// 文件上传相关状态
|
|
|
|
|
const fileUploadDialog = reactive({
|
|
|
|
|
visible: false,
|
|
|
|
|
title: '上传文件'
|
|
|
|
|
});
|
|
|
|
|
const fileList = ref<UploadFile[]>([]);
|
|
|
|
|
const uploadLoading = ref(false);
|
|
|
|
|
const selectedPlanId = ref<string | number>('');
|
|
|
|
|
|
|
|
|
|
// 初始化表单数据
|
|
|
|
|
const initFormData: PlanForm & { dictName?: string; content?: string } = {
|
|
|
|
|
id: '1958116259107012609',
|
|
|
|
|
projectId: currentProjectId.value,
|
|
|
|
|
plannedBiddingMethod: undefined,
|
|
|
|
|
price: undefined,
|
2025-08-19 20:05:28 +08:00
|
|
|
|
limitPrice: undefined,
|
2025-08-20 21:22:56 +08:00
|
|
|
|
contractPrice: undefined,
|
2025-08-19 20:05:28 +08:00
|
|
|
|
bidFile: undefined,
|
2025-08-20 21:22:56 +08:00
|
|
|
|
dictName: '1',
|
|
|
|
|
name: 'test1',
|
|
|
|
|
content: 'trhbhbt'
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
// 页面数据
|
|
|
|
|
const data = reactive<PageData<typeof initFormData, PlanQuery & { dictName?: string; content?: string }>>({
|
|
|
|
|
form: { ...initFormData },
|
2025-08-19 20:05:28 +08:00
|
|
|
|
queryParams: {
|
|
|
|
|
pageNum: 1,
|
|
|
|
|
pageSize: 10,
|
2025-08-20 21:22:56 +08:00
|
|
|
|
projectId: currentProjectId.value,
|
|
|
|
|
dictName: undefined,
|
|
|
|
|
name: undefined,
|
|
|
|
|
plannedBiddingTime: undefined,
|
|
|
|
|
plannedBiddingMethod: undefined,
|
|
|
|
|
price: undefined,
|
2025-08-19 20:05:28 +08:00
|
|
|
|
limitPrice: undefined,
|
2025-08-20 21:22:56 +08:00
|
|
|
|
contractPrice: undefined,
|
|
|
|
|
content: undefined,
|
2025-08-19 20:05:28 +08:00
|
|
|
|
bidFile: undefined,
|
2025-08-20 21:22:56 +08:00
|
|
|
|
params: {}
|
2025-08-19 20:05:28 +08:00
|
|
|
|
},
|
|
|
|
|
rules: {
|
2025-08-20 21:22:56 +08:00
|
|
|
|
projectId: [{ required: true, message: '请输入项目ID', trigger: 'blur' }],
|
|
|
|
|
name: [{ required: true, message: '请输入名称', trigger: 'blur' }],
|
|
|
|
|
plannedBiddingMethod: [{ required: true, message: '请输入招标方式', trigger: 'blur' }],
|
|
|
|
|
limitPrice: [{ required: true, message: '请输入限价', trigger: 'blur' }],
|
|
|
|
|
contractPrice: [{ required: true, message: '请输入合同额', trigger: 'blur' }],
|
|
|
|
|
content: [{ required: true, message: '请输入分包内容', trigger: 'blur' }]
|
2025-08-19 20:05:28 +08:00
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
const { queryParams, form, rules } = toRefs(data);
|
|
|
|
|
|
2025-08-20 21:22:56 +08:00
|
|
|
|
// 监听当前项目ID变化
|
|
|
|
|
watch(currentProjectId, (newVal) => {
|
|
|
|
|
queryParams.value.projectId = newVal;
|
|
|
|
|
if (!form.value.id) {
|
|
|
|
|
form.value.projectId = newVal;
|
|
|
|
|
}
|
|
|
|
|
getList();
|
|
|
|
|
});
|
|
|
|
|
|
2025-08-19 20:05:28 +08:00
|
|
|
|
/** 查询招标计划列表 */
|
|
|
|
|
const getList = async () => {
|
|
|
|
|
loading.value = true;
|
2025-08-20 21:22:56 +08:00
|
|
|
|
try {
|
|
|
|
|
const res = await listPlan(queryParams.value);
|
|
|
|
|
planList.value = res.rows || [];
|
|
|
|
|
total.value = res.total || 0;
|
|
|
|
|
} catch (error) {
|
|
|
|
|
console.error('获取招标计划列表失败', error);
|
|
|
|
|
proxy?.$modal.msgError('获取招标计划列表失败');
|
|
|
|
|
} finally {
|
|
|
|
|
loading.value = false;
|
|
|
|
|
}
|
|
|
|
|
};
|
2025-08-19 20:05:28 +08:00
|
|
|
|
|
|
|
|
|
/** 取消按钮 */
|
|
|
|
|
const cancel = () => {
|
|
|
|
|
reset();
|
|
|
|
|
dialog.visible = false;
|
2025-08-20 21:22:56 +08:00
|
|
|
|
};
|
2025-08-19 20:05:28 +08:00
|
|
|
|
|
|
|
|
|
/** 表单重置 */
|
|
|
|
|
const reset = () => {
|
2025-08-20 21:22:56 +08:00
|
|
|
|
form.value = { ...initFormData, projectId: currentProjectId.value };
|
2025-08-19 20:05:28 +08:00
|
|
|
|
planFormRef.value?.resetFields();
|
2025-08-20 21:22:56 +08:00
|
|
|
|
};
|
2025-08-19 20:05:28 +08:00
|
|
|
|
|
|
|
|
|
/** 搜索按钮操作 */
|
|
|
|
|
const handleQuery = () => {
|
|
|
|
|
queryParams.value.pageNum = 1;
|
|
|
|
|
getList();
|
2025-08-20 21:22:56 +08:00
|
|
|
|
};
|
2025-08-19 20:05:28 +08:00
|
|
|
|
|
|
|
|
|
/** 重置按钮操作 */
|
|
|
|
|
const resetQuery = () => {
|
|
|
|
|
queryFormRef.value?.resetFields();
|
2025-08-20 21:22:56 +08:00
|
|
|
|
queryParams.value.projectId = currentProjectId.value;
|
2025-08-19 20:05:28 +08:00
|
|
|
|
handleQuery();
|
2025-08-20 21:22:56 +08:00
|
|
|
|
};
|
2025-08-19 20:05:28 +08:00
|
|
|
|
|
|
|
|
|
/** 多选框选中数据 */
|
|
|
|
|
const handleSelectionChange = (selection: PlanVO[]) => {
|
2025-08-20 21:22:56 +08:00
|
|
|
|
ids.value = selection.map((item) => item.id);
|
|
|
|
|
single.value = selection.length !== 1;
|
2025-08-19 20:05:28 +08:00
|
|
|
|
multiple.value = !selection.length;
|
2025-08-20 21:22:56 +08:00
|
|
|
|
};
|
2025-08-19 20:05:28 +08:00
|
|
|
|
|
|
|
|
|
/** 修改按钮操作 */
|
|
|
|
|
const handleUpdate = async (row?: PlanVO) => {
|
|
|
|
|
reset();
|
2025-08-20 21:22:56 +08:00
|
|
|
|
const _id = row?.id || ids.value[0];
|
|
|
|
|
if (!_id) {
|
|
|
|
|
proxy?.$modal.msgWarning('请选择需要修改的招标计划');
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
try {
|
|
|
|
|
const res = await getPlan(_id);
|
|
|
|
|
Object.assign(form.value, res.data, {
|
|
|
|
|
id: res.data.id || initFormData.id,
|
|
|
|
|
dictName: res.data.dictName || initFormData.dictName,
|
|
|
|
|
content: res.data.content || initFormData.content,
|
|
|
|
|
projectId: res.data.projectId || currentProjectId.value
|
|
|
|
|
});
|
|
|
|
|
dialog.visible = true;
|
|
|
|
|
dialog.title = '修改招标计划';
|
|
|
|
|
} catch (error) {
|
|
|
|
|
console.error('获取招标计划详情失败', error);
|
|
|
|
|
proxy?.$modal.msgError('获取招标计划详情失败');
|
|
|
|
|
}
|
|
|
|
|
};
|
2025-08-19 20:05:28 +08:00
|
|
|
|
|
|
|
|
|
/** 提交按钮 */
|
|
|
|
|
const submitForm = () => {
|
|
|
|
|
planFormRef.value?.validate(async (valid: boolean) => {
|
|
|
|
|
if (valid) {
|
|
|
|
|
buttonLoading.value = true;
|
2025-08-20 21:22:56 +08:00
|
|
|
|
try {
|
|
|
|
|
if (!form.value.id && currentProjectId.value) {
|
|
|
|
|
form.value.projectId = currentProjectId.value;
|
|
|
|
|
}
|
|
|
|
|
if (form.value.id) {
|
|
|
|
|
await updatePlan(form.value);
|
|
|
|
|
} else {
|
|
|
|
|
await addPlan(form.value);
|
|
|
|
|
}
|
|
|
|
|
proxy?.$modal.msgSuccess('操作成功');
|
|
|
|
|
dialog.visible = false;
|
|
|
|
|
await getList();
|
|
|
|
|
} catch (error) {
|
|
|
|
|
console.error('操作失败', error);
|
|
|
|
|
proxy?.$modal.msgError('操作失败,请重试');
|
|
|
|
|
} finally {
|
|
|
|
|
buttonLoading.value = false;
|
2025-08-19 20:05:28 +08:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
});
|
2025-08-20 21:22:56 +08:00
|
|
|
|
};
|
2025-08-19 20:05:28 +08:00
|
|
|
|
|
|
|
|
|
/** 删除按钮操作 */
|
|
|
|
|
const handleDelete = async (row?: PlanVO) => {
|
|
|
|
|
const _ids = row?.id || ids.value;
|
2025-08-20 21:22:56 +08:00
|
|
|
|
if (!_ids || (_ids instanceof Array && _ids.length === 0)) {
|
|
|
|
|
proxy?.$modal.msgWarning('请选择需要删除的招标计划');
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
try {
|
|
|
|
|
await proxy?.$modal.confirm('是否确认删除选中的招标计划?');
|
|
|
|
|
await delPlan(_ids);
|
|
|
|
|
proxy?.$modal.msgSuccess('删除成功');
|
|
|
|
|
await getList();
|
|
|
|
|
} catch (error) {
|
|
|
|
|
console.error('删除失败', error);
|
|
|
|
|
if (error !== 'cancel') {
|
|
|
|
|
proxy?.$modal.msgError('删除失败,请重试');
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
};
|
2025-08-19 20:05:28 +08:00
|
|
|
|
|
|
|
|
|
/** 导出按钮操作 */
|
|
|
|
|
const handleExport = () => {
|
2025-08-20 21:22:56 +08:00
|
|
|
|
proxy?.download(
|
|
|
|
|
'plan/plan/export',
|
|
|
|
|
{
|
|
|
|
|
...queryParams.value
|
|
|
|
|
},
|
|
|
|
|
`plan_${new Date().getTime()}.xlsx`
|
|
|
|
|
);
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
/** 打开文件上传对话框 */
|
|
|
|
|
const openFileUploadDialog = () => {
|
|
|
|
|
if (ids.value.length !== 1) {
|
|
|
|
|
proxy?.$modal.msgWarning('请选择单个招标计划进行文件上传');
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
selectedPlanId.value = ids.value[0];
|
|
|
|
|
fileList.value = [];
|
|
|
|
|
fileUploadDialog.visible = true;
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
/** 处理文件上传 */
|
|
|
|
|
const handleFileUpload = async (params: { file: UploadRawFile }) => {
|
|
|
|
|
const formData = new FormData();
|
|
|
|
|
formData.append('file', params.file);
|
|
|
|
|
formData.append('planId', selectedPlanId.value as string);
|
|
|
|
|
|
|
|
|
|
try {
|
|
|
|
|
const response = await uploadFile(formData);
|
|
|
|
|
return response;
|
|
|
|
|
} catch (error) {
|
|
|
|
|
console.error('文件上传失败', error);
|
|
|
|
|
throw error;
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
/** 提交文件上传 */
|
|
|
|
|
const submitFileUpload = async () => {
|
|
|
|
|
if (fileList.value.length === 0) {
|
|
|
|
|
proxy?.$modal.msgWarning('请选择需要上传的文件');
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
uploadLoading.value = true;
|
|
|
|
|
try {
|
|
|
|
|
for (const file of fileList.value) {
|
|
|
|
|
if (file.raw) {
|
|
|
|
|
await handleFileUpload({ file: file.raw });
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
proxy?.$modal.msgSuccess('文件上传成功');
|
|
|
|
|
fileUploadDialog.visible = false;
|
|
|
|
|
// 可以在这里刷新文件列表或页面数据
|
|
|
|
|
} catch (error) {
|
|
|
|
|
proxy?.$modal.msgError('文件上传失败');
|
|
|
|
|
} finally {
|
|
|
|
|
uploadLoading.value = false;
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
/** 取消文件上传 */
|
|
|
|
|
const cancelFileUpload = () => {
|
|
|
|
|
fileList.value = [];
|
|
|
|
|
fileUploadDialog.visible = false;
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
/** 文件预览 */
|
|
|
|
|
const handleFilePreview = (file: UploadFile) => {
|
|
|
|
|
console.log('预览文件:', file);
|
|
|
|
|
// 实现文件预览逻辑,例如:
|
|
|
|
|
// if (file.url) {
|
|
|
|
|
// window.open(file.url);
|
|
|
|
|
// }
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
/** 移除文件 */
|
|
|
|
|
const handleFileRemove = (file: UploadFile) => {
|
|
|
|
|
console.log('移除文件:', file);
|
|
|
|
|
};
|
2025-08-19 20:05:28 +08:00
|
|
|
|
|
|
|
|
|
onMounted(() => {
|
|
|
|
|
getList();
|
|
|
|
|
});
|
|
|
|
|
</script>
|
2025-08-20 21:22:56 +08:00
|
|
|
|
|
|
|
|
|
<style scoped lang="scss">
|
|
|
|
|
.mb-4 {
|
|
|
|
|
margin-bottom: 16px;
|
|
|
|
|
}
|
|
|
|
|
.el-table .small-padding .cell {
|
|
|
|
|
padding: 0 5px;
|
|
|
|
|
}
|
|
|
|
|
.el-table .fixed-width {
|
|
|
|
|
width: 120px !important;
|
|
|
|
|
}
|
|
|
|
|
.el-table-column .el-button--text + .el-button--text {
|
|
|
|
|
margin-left: 10px;
|
|
|
|
|
}
|
|
|
|
|
.upload-container {
|
|
|
|
|
padding: 10px 0;
|
|
|
|
|
}
|
|
|
|
|
</style>
|