招标
This commit is contained in:
@ -73,7 +73,16 @@
|
||||
<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" />
|
||||
<el-table-column label="中标通知书" align="center" prop="bidFile">
|
||||
<template #default="scope">
|
||||
<el-link @click="handleView(scope.row, 'bidFile')" type="primary" v-if="scope.row.bidFile">查看</el-link>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="招标通知书" align="center" prop="tenderFile">
|
||||
<template #default="scope">
|
||||
<el-link @click="handleView(scope.row, 'tenderFile')" type="primary" v-if="scope.row.tenderFile">查看</el-link>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="操作" align="center" class-name="small-padding fixed-width">
|
||||
<template #default="scope">
|
||||
<el-tooltip content="修改" placement="top">
|
||||
@ -135,16 +144,21 @@
|
||||
<el-date-picker clearable v-model="form.plannedBiddingTime" type="date" value-format="YYYY-MM-DD" placeholder="请选择计划招标时间" />
|
||||
</el-form-item>
|
||||
|
||||
<el-form-item label="招标方式(公招,邀标)" prop="plannedBiddingMethod">
|
||||
<el-input v-model="form.plannedBiddingMethod" placeholder="请输入招标方式(公招,邀标)" />
|
||||
<!-- 核心修改:招标方式改为下拉框,根据限价自动赋值 -->
|
||||
<el-form-item label="招标方式" prop="plannedBiddingMethod">
|
||||
<el-select v-model="form.plannedBiddingMethod" placeholder="自动生成/选择" :disabled="!!form.limitPrice">
|
||||
<el-option label="公招" value="公招"></el-option>
|
||||
<el-option label="邀标" value="邀标"></el-option>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
|
||||
<el-form-item label="总价" prop="price" v-if="false">
|
||||
<el-input v-model="form.price" placeholder="请输入总价" />
|
||||
</el-form-item>
|
||||
|
||||
<!-- 限价输入:添加@input事件,实时触发招标方式判断 -->
|
||||
<el-form-item label="限价" prop="limitPrice">
|
||||
<el-input v-model="form.limitPrice" placeholder="请输入限价" />
|
||||
<el-input v-model.number="form.limitPrice" placeholder="请输入限价" type="number" @input="autoSetBiddingMethod" />
|
||||
</el-form-item>
|
||||
|
||||
<el-form-item label="合同额" prop="contractPrice">
|
||||
@ -156,7 +170,10 @@
|
||||
</el-form-item>
|
||||
|
||||
<el-form-item label="中标通知书" prop="bidFile">
|
||||
<file-upload v-model="form.bidFile" />
|
||||
<file-upload v-model="form.bidFile" :limit="1" />
|
||||
</el-form-item>
|
||||
<el-form-item label="招标通知书" prop="files">
|
||||
<file-upload v-model="form.tenderFile" :limit="100" />
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
<template #footer>
|
||||
@ -166,25 +183,40 @@
|
||||
</div>
|
||||
</template>
|
||||
</el-dialog>
|
||||
<el-dialog title="文件列表" v-model="viewVisible" width="45%">
|
||||
<el-table :data="viewFileList" style="width: 100%" border>
|
||||
<el-table-column prop="fileName" label="文件" align="center">
|
||||
<template #default="scope">
|
||||
<el-link :key="scope.row.ossId" :href="scope.row.url" target="_blank" type="primary" :underline="false">
|
||||
{{ scope.row.originalName || '查看文件' }}
|
||||
</el-link>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
<template #footer>
|
||||
<span>
|
||||
<el-button type="primary" @click="viewVisible = false">关闭</el-button>
|
||||
</span>
|
||||
</template>
|
||||
</el-dialog>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup name="Plan" lang="ts">
|
||||
import { listPlan, getPlan, delPlan, addPlan, updatePlan } from '@/api/plan/plan';
|
||||
import { listPlan, getPlan, addPlan, updatePlan, getSegmentedIndicatorPlanning } from '@/api/plan/plan/index';
|
||||
import { PlanVO, PlanQuery, PlanForm } from '@/api/plan/plan/types';
|
||||
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';
|
||||
import { listByIds } from '@/api/system/oss';
|
||||
|
||||
// 从用户Store获取当前选中项目及ID
|
||||
const userStore = useUserStoreHook();
|
||||
const currentProject = computed(() => userStore.selectedProject);
|
||||
const currentProjectId = computed(() => currentProject.value?.id);
|
||||
|
||||
const viewVisible = ref(false);
|
||||
// 类型定义
|
||||
interface DialogOption {
|
||||
visible: boolean;
|
||||
@ -222,6 +254,7 @@ const fileUploadDialog = reactive({
|
||||
title: '上传文件'
|
||||
});
|
||||
const fileList = ref<UploadFile[]>([]);
|
||||
const viewFileList = ref([]);
|
||||
const uploadLoading = ref(false);
|
||||
const selectedPlanId = ref<string | number>('');
|
||||
|
||||
@ -229,7 +262,9 @@ const selectedPlanId = ref<string | number>('');
|
||||
const initFormData: PlanForm & { dictName?: string; content?: string } = {
|
||||
id: '1958116259107012609',
|
||||
projectId: currentProjectId.value,
|
||||
file: [],
|
||||
plannedBiddingMethod: undefined,
|
||||
files: undefined,
|
||||
price: undefined,
|
||||
limitPrice: undefined,
|
||||
contractPrice: undefined,
|
||||
@ -260,7 +295,7 @@ const data = reactive<PageData<typeof initFormData, PlanQuery & { dictName?: str
|
||||
rules: {
|
||||
projectId: [{ required: true, message: '请输入项目ID', trigger: 'blur' }],
|
||||
name: [{ required: true, message: '请输入名称', trigger: 'blur' }],
|
||||
plannedBiddingMethod: [{ 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' }]
|
||||
@ -293,6 +328,27 @@ const getList = async () => {
|
||||
}
|
||||
};
|
||||
|
||||
// const handleSuccess = (list, res, fileType) => {
|
||||
// console.log(list);
|
||||
// const arr = list.map((item) => {
|
||||
// return { fileId: item.ossId, fileUrl: item.url, fileType };
|
||||
// });
|
||||
// console.log(arr);
|
||||
// if (!form.value.file) form.value.file = [];
|
||||
// form.value.file = [...form.value.file, ...arr];
|
||||
// console.log(form.value.file);
|
||||
// };
|
||||
|
||||
const handleView = async (row, type) => {
|
||||
const res = await listByIds(row[type]);
|
||||
if (type == 'tenderFile') {
|
||||
viewVisible.value = true;
|
||||
viewFileList.value = res.data;
|
||||
} else {
|
||||
window.open(res.data[0].url);
|
||||
}
|
||||
};
|
||||
|
||||
/** 取消按钮 */
|
||||
const cancel = () => {
|
||||
reset();
|
||||
@ -334,13 +390,19 @@ const handleUpdate = async (row?: PlanVO) => {
|
||||
return;
|
||||
}
|
||||
try {
|
||||
const res = await getPlan(_id);
|
||||
// const res = await getPlan(_id);
|
||||
const res = await getSegmentedIndicatorPlanning(_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
|
||||
});
|
||||
console.log(form.value);
|
||||
|
||||
// 回显时根据限价同步招标方式(避免数据不一致)
|
||||
autoSetBiddingMethod();
|
||||
dialog.visible = true;
|
||||
dialog.title = '修改招标计划';
|
||||
} catch (error) {
|
||||
@ -349,6 +411,13 @@ const handleUpdate = async (row?: PlanVO) => {
|
||||
}
|
||||
};
|
||||
|
||||
/** 核心:根据限价自动设置招标方式 */
|
||||
const autoSetBiddingMethod = () => {
|
||||
const limit = form.value.limitPrice;
|
||||
// 逻辑:限价>1000万→公招,否则→邀标,为空则清空
|
||||
form.value.plannedBiddingMethod = limit ? (limit > 1000 ? '公招' : '邀标') : '';
|
||||
};
|
||||
|
||||
/** 提交按钮 */
|
||||
const submitForm = () => {
|
||||
planFormRef.value?.validate(async (valid: boolean) => {
|
||||
@ -376,7 +445,7 @@ const submitForm = () => {
|
||||
});
|
||||
};
|
||||
|
||||
/** 删除按钮操作 */
|
||||
/** 删除按钮操作(原代码存在但模板未引用,保留逻辑) */
|
||||
const handleDelete = async (row?: PlanVO) => {
|
||||
const _ids = row?.id || ids.value;
|
||||
if (!_ids || (_ids instanceof Array && _ids.length === 0)) {
|
||||
@ -450,7 +519,6 @@ const submitFileUpload = async () => {
|
||||
|
||||
proxy?.$modal.msgSuccess('文件上传成功');
|
||||
fileUploadDialog.visible = false;
|
||||
// 可以在这里刷新文件列表或页面数据
|
||||
} catch (error) {
|
||||
proxy?.$modal.msgError('文件上传失败');
|
||||
} finally {
|
||||
@ -467,10 +535,8 @@ const cancelFileUpload = () => {
|
||||
/** 文件预览 */
|
||||
const handleFilePreview = (file: UploadFile) => {
|
||||
console.log('预览文件:', file);
|
||||
// 实现文件预览逻辑,例如:
|
||||
// if (file.url) {
|
||||
// window.open(file.url);
|
||||
// }
|
||||
// 可扩展:通过文件URL打开预览
|
||||
// if (file.url) window.open(file.url);
|
||||
};
|
||||
|
||||
/** 移除文件 */
|
||||
|
||||
Reference in New Issue
Block a user