合并
This commit is contained in:
@ -5,16 +5,8 @@ VITE_APP_TITLE = 煤科建管平台
|
|||||||
VITE_APP_ENV = 'development'
|
VITE_APP_ENV = 'development'
|
||||||
|
|
||||||
# 开发环境
|
# 开发环境
|
||||||
# 李陈杰 209
|
|
||||||
VITE_APP_BASE_API = 'http://192.168.110.209:8899'
|
VITE_APP_BASE_API = 'http://192.168.110.209:8899'
|
||||||
# 曾涛
|
|
||||||
# VITE_APP_BASE_API = 'http://192.168.110.180:8899'
|
|
||||||
# 罗成
|
|
||||||
# VITE_APP_BASE_API = 'http://192.168.110.213:8899'
|
|
||||||
# 朱银
|
|
||||||
# VITE_APP_BASE_API = 'http://192.168.110.149:8899'
|
|
||||||
# VITE_APP_BASE_API = 'http://192.168.110.209:8899'
|
|
||||||
# VITE_APP_BASE_API = 'http://192.168.110.209:8899'
|
|
||||||
# 无人机接口地址
|
# 无人机接口地址
|
||||||
|
|
||||||
VITE_APP_BASE_DRONE_API = 'http://58.17.134.85:9512'
|
VITE_APP_BASE_DRONE_API = 'http://58.17.134.85:9512'
|
||||||
|
70
src/api/materials/materialsUseRecord/index.ts
Normal file
70
src/api/materials/materialsUseRecord/index.ts
Normal file
@ -0,0 +1,70 @@
|
|||||||
|
import request from '@/utils/request';
|
||||||
|
import { AxiosPromise } from 'axios';
|
||||||
|
import { MaterialsUseRecordVO, MaterialsUseRecordForm, MaterialsUseRecordQuery } from '@/api/materials/materialsUseRecord/types';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询材料使用登记列表
|
||||||
|
* @param query
|
||||||
|
* @returns {*}
|
||||||
|
*/
|
||||||
|
|
||||||
|
export const listMaterialsUseInventory = (query?: MaterialsUseRecordQuery): AxiosPromise<MaterialsUseRecordVO[]> => {
|
||||||
|
return request({
|
||||||
|
url: '/materials/materialsInventory/list',
|
||||||
|
method: 'get',
|
||||||
|
params: query
|
||||||
|
});
|
||||||
|
};
|
||||||
|
export const listMaterialsUseRecord = (query?: MaterialsUseRecordQuery): AxiosPromise<MaterialsUseRecordVO[]> => {
|
||||||
|
return request({
|
||||||
|
url: '/materials/materialsUseRecord/list',
|
||||||
|
method: 'get',
|
||||||
|
params: query
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询材料使用登记详细
|
||||||
|
* @param id
|
||||||
|
*/
|
||||||
|
export const getMaterialsUseRecord = (id: string | number): AxiosPromise<MaterialsUseRecordVO> => {
|
||||||
|
return request({
|
||||||
|
url: '/materials/materialsUseRecord/' + id,
|
||||||
|
method: 'get'
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 新增材料使用登记
|
||||||
|
* @param data
|
||||||
|
*/
|
||||||
|
export const addMaterialsUseRecord = (data: MaterialsUseRecordForm) => {
|
||||||
|
return request({
|
||||||
|
url: '/materials/materialsUseRecord',
|
||||||
|
method: 'post',
|
||||||
|
data: data
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改材料使用登记
|
||||||
|
* @param data
|
||||||
|
*/
|
||||||
|
export const updateMaterialsUseRecord = (data: MaterialsUseRecordForm) => {
|
||||||
|
return request({
|
||||||
|
url: '/materials/materialsUseRecord',
|
||||||
|
method: 'put',
|
||||||
|
data: data
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除材料使用登记
|
||||||
|
* @param id
|
||||||
|
*/
|
||||||
|
export const delMaterialsUseRecord = (id: string | number | Array<string | number>) => {
|
||||||
|
return request({
|
||||||
|
url: '/materials/materialsUseRecord/' + id,
|
||||||
|
method: 'delete'
|
||||||
|
});
|
||||||
|
};
|
111
src/api/materials/materialsUseRecord/types.ts
Normal file
111
src/api/materials/materialsUseRecord/types.ts
Normal file
@ -0,0 +1,111 @@
|
|||||||
|
export interface MaterialsUseRecordVO {
|
||||||
|
/**
|
||||||
|
* 主键ID
|
||||||
|
*/
|
||||||
|
id: string | number;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 项目ID
|
||||||
|
*/
|
||||||
|
projectId: string | number;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 库存ID
|
||||||
|
*/
|
||||||
|
inventoryId: string | number;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 使用部位
|
||||||
|
*/
|
||||||
|
usePart: string;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 使用数量
|
||||||
|
*/
|
||||||
|
useNumber: number;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 剩余量
|
||||||
|
*/
|
||||||
|
residueNumber: string | number;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 备注
|
||||||
|
*/
|
||||||
|
remark: string;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface MaterialsUseRecordForm extends BaseEntity {
|
||||||
|
/**
|
||||||
|
* 主键ID
|
||||||
|
*/
|
||||||
|
id?: string | number;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 项目ID
|
||||||
|
*/
|
||||||
|
projectId?: string | number;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 库存ID
|
||||||
|
*/
|
||||||
|
inventoryId?: string | number;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 使用部位
|
||||||
|
*/
|
||||||
|
usePart?: string;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 使用数量
|
||||||
|
*/
|
||||||
|
useNumber?: number;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 剩余量
|
||||||
|
*/
|
||||||
|
residueNumber?: string | number;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 备注
|
||||||
|
*/
|
||||||
|
remark?: string;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface MaterialsUseRecordQuery extends PageQuery {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 项目ID
|
||||||
|
*/
|
||||||
|
projectId?: string | number;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 库存ID
|
||||||
|
*/
|
||||||
|
inventoryId?: string | number;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 使用部位
|
||||||
|
*/
|
||||||
|
usePart?: string;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 使用数量
|
||||||
|
*/
|
||||||
|
useNumber?: number;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 剩余量
|
||||||
|
*/
|
||||||
|
residueNumber?: string | number;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 日期范围参数
|
||||||
|
*/
|
||||||
|
params?: any;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -288,3 +288,14 @@ h6 {
|
|||||||
.top-right-btn {
|
.top-right-btn {
|
||||||
margin-left: auto;
|
margin-left: auto;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.text-two-lines {
|
||||||
|
display: -webkit-box; /* 触发弹性盒模型 */
|
||||||
|
-webkit-box-orient: vertical; /* 垂直排列文本行 */
|
||||||
|
-webkit-line-clamp: 2; /* 限制显示2行 */
|
||||||
|
/* 3. 超出部分处理 */
|
||||||
|
overflow: hidden; /* 隐藏超出容器的内容 */
|
||||||
|
text-overflow: ellipsis; /* 超出部分显示省略号 */
|
||||||
|
/* 可选:优化文本间距 */
|
||||||
|
line-height: 1.5; /* 行高,控制两行的垂直间距 */
|
||||||
|
}
|
||||||
|
@ -58,7 +58,7 @@ import type { ComponentInternalInstance } from 'vue';
|
|||||||
import { useUserStoreHook } from '@/store/modules/user';
|
import { useUserStoreHook } from '@/store/modules/user';
|
||||||
import { ElMessage, ElLoading } from 'element-plus';
|
import { ElMessage, ElLoading } from 'element-plus';
|
||||||
import { biddingGetUser, AddbiddingUser, biddingUserList } from '@/api/bidding/appointment';
|
import { biddingGetUser, AddbiddingUser, biddingUserList } from '@/api/bidding/appointment';
|
||||||
|
import { getProject } from '@/api/project/project';
|
||||||
// 获取当前实例
|
// 获取当前实例
|
||||||
const { proxy } = getCurrentInstance() as ComponentInternalInstance;
|
const { proxy } = getCurrentInstance() as ComponentInternalInstance;
|
||||||
// 获取用户 store
|
// 获取用户 store
|
||||||
@ -68,7 +68,7 @@ const currentProject = computed(() => userStore.selectedProject);
|
|||||||
// 专业字典数据
|
// 专业字典数据
|
||||||
const { des_user_major } = toRefs<any>(proxy?.useDict('des_user_major'));
|
const { des_user_major } = toRefs<any>(proxy?.useDict('des_user_major'));
|
||||||
const isDisabled = ref(false);
|
const isDisabled = ref(false);
|
||||||
|
const projectInfo = ref({}); //项目信息
|
||||||
// 表单数据
|
// 表单数据
|
||||||
const form = reactive({
|
const form = reactive({
|
||||||
id: null,
|
id: null,
|
||||||
|
@ -16,7 +16,7 @@
|
|||||||
<el-form-item>
|
<el-form-item>
|
||||||
<el-button type="primary" @click="toggleExpandAll">{{ isExpandAll ? '一键收起' : '一键展开' }}</el-button>
|
<el-button type="primary" @click="toggleExpandAll">{{ isExpandAll ? '一键收起' : '一键展开' }}</el-button>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item>
|
<!-- <el-form-item>
|
||||||
<el-upload
|
<el-upload
|
||||||
ref="uploadRef"
|
ref="uploadRef"
|
||||||
class="upload-demo"
|
class="upload-demo"
|
||||||
@ -28,7 +28,7 @@
|
|||||||
<el-button type="primary">导入excel</el-button>
|
<el-button type="primary">导入excel</el-button>
|
||||||
</template>
|
</template>
|
||||||
</el-upload>
|
</el-upload>
|
||||||
</el-form-item>
|
</el-form-item> -->
|
||||||
<el-form-item>
|
<el-form-item>
|
||||||
<el-button type="primary" @click="handleExport()" v-hasPermi="['bidding:biddingLimitList:export']">导出excel</el-button>
|
<el-button type="primary" @click="handleExport()" v-hasPermi="['bidding:biddingLimitList:export']">导出excel</el-button>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
@ -78,7 +78,7 @@
|
|||||||
{{ scope.row.price }}
|
{{ scope.row.price }}
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
<el-table-column prop="price" label="操作" align="center">
|
<!-- <el-table-column prop="price" label="操作" align="center">
|
||||||
<template #default="scope">
|
<template #default="scope">
|
||||||
<el-button
|
<el-button
|
||||||
type="primary"
|
type="primary"
|
||||||
@ -89,7 +89,7 @@
|
|||||||
>修改</el-button
|
>修改</el-button
|
||||||
>
|
>
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column> -->
|
||||||
</el-table>
|
</el-table>
|
||||||
</el-card>
|
</el-card>
|
||||||
</div>
|
</div>
|
||||||
|
524
src/views/biddingManagemen/listOfWinningBids/index copy 2.vue
Normal file
524
src/views/biddingManagemen/listOfWinningBids/index copy 2.vue
Normal file
@ -0,0 +1,524 @@
|
|||||||
|
<template>
|
||||||
|
<div class="p-4 bg-gray-50 min-h-screen">
|
||||||
|
<!-- 卡片容器:控制最大宽度+居中+圆角阴影 -->
|
||||||
|
<el-card shadow="hover" class="max-w-6xl mx-auto rounded-xl overflow-hidden border-0" style="background-color: #ffffff">
|
||||||
|
<!-- 卡片头部:项目信息展示区(非表单布局) -->
|
||||||
|
<template #header>
|
||||||
|
<div class="bg-blue-50 px-6 rounded-t-xl" style="padding: 10px 20px">
|
||||||
|
<h3 class="el-card__header-title text-lg font-semibold text-blue-800">投标项目信息</h3>
|
||||||
|
<h4>{{ currentProject.name }}</h4>
|
||||||
|
<!-- 项目信息部分 -->
|
||||||
|
<div class="grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-6">
|
||||||
|
<div class="project-info-item">
|
||||||
|
<span>负责人:</span>
|
||||||
|
<span> {{ projectInfo.principal || '-' }}</span>
|
||||||
|
</div>
|
||||||
|
<div class="project-info-item">
|
||||||
|
<span>负责人电话:</span>
|
||||||
|
<span> {{ projectInfo.principalPhone || '-' }}</span>
|
||||||
|
</div>
|
||||||
|
<div class="project-info-item">
|
||||||
|
<span>项目类型:</span>
|
||||||
|
<span> {{ getDictLabel(project_type, projectInfo.projectType) || '-' }}</span>
|
||||||
|
</div>
|
||||||
|
<div class="project-info-item">
|
||||||
|
<span>项目阶段:</span>
|
||||||
|
<span> {{ getDictLabel(project_stage, projectInfo.projectStage) || '-' }}</span>
|
||||||
|
</div>
|
||||||
|
<div class="project-info-item">
|
||||||
|
<span>开工时间:</span>
|
||||||
|
<span> {{ projectInfo.onStreamTime || '-' }}</span>
|
||||||
|
</div>
|
||||||
|
<div class="project-info-item">
|
||||||
|
<span>经纬度:</span>
|
||||||
|
<span> {{ projectInfo.lng || '-' }},{{ projectInfo.lat || '-' }}</span>
|
||||||
|
</div>
|
||||||
|
<div class="project-info-item md:col-span-2 lg:col-span-3">
|
||||||
|
<span>项目地址:</span>
|
||||||
|
<span> {{ projectInfo.projectSite || '-' }}</span>
|
||||||
|
</div>
|
||||||
|
<div class="project-info-item">
|
||||||
|
<span>计划容量(M):</span>
|
||||||
|
<span> {{ projectInfo.plan || '-' }}</span>
|
||||||
|
</div>
|
||||||
|
<div class="project-info-item">
|
||||||
|
<span>实际容量(M):</span>
|
||||||
|
<span> {{ projectInfo.actual || '-' }}</span>
|
||||||
|
</div>
|
||||||
|
<div class="project-info-item">
|
||||||
|
<span>设计总量(M):</span>
|
||||||
|
<span> {{ projectInfo.designTotal || '-' }}</span>
|
||||||
|
</div>
|
||||||
|
<div class="project-info-item md:col-span-2 lg:col-span-3">
|
||||||
|
<span>备注:</span>
|
||||||
|
<span> {{ projectInfo.remark || '-' }}</span>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="mt-4 mb-6">
|
||||||
|
<el-button @click="isDisabled = false" type="primary" class="px-8 py-2.5 transition-all duration-300 font-medium" v-if="isDisabled">
|
||||||
|
点击编辑
|
||||||
|
</el-button>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
<!-- 中标信息表单区域(保持原有逻辑) -->
|
||||||
|
<el-form
|
||||||
|
:disabled="isDisabled"
|
||||||
|
ref="listOfWinningBidsFormRef"
|
||||||
|
:model="form"
|
||||||
|
:rules="rules"
|
||||||
|
label-width="150px"
|
||||||
|
class="p-6 pt-4"
|
||||||
|
style="background-color: #ffffff"
|
||||||
|
>
|
||||||
|
<el-row :gutter="32">
|
||||||
|
<el-col :span="12">
|
||||||
|
<el-form-item label="中标价(美元)" prop="winningBidOriginal" class="rounded-lg border border-gray-100 p-1 mb-5">
|
||||||
|
<el-input v-model.number="form.winningBidOriginal" type="number" placeholder="请输入中标价" @input="calculateWinningBid" />
|
||||||
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
|
<el-col :span="12">
|
||||||
|
<el-form-item label="汇率" prop="exchangeRate" class="rounded-lg border border-gray-100 p-1 mb-5">
|
||||||
|
<el-input v-model.number="form.exchangeRate" type="number" placeholder="请输入汇率" step="0.0001" @input="calculateWinningBid" />
|
||||||
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
|
<el-col :span="12">
|
||||||
|
<el-form-item label="币种" prop="currency" class="rounded-lg border border-gray-100 p-1 mb-5">
|
||||||
|
<el-input v-model="form.currency" placeholder="请输入币种" />
|
||||||
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
|
<el-col :span="12">
|
||||||
|
<el-form-item label="中标价(人民币)" prop="winningBid" class="rounded-lg border border-gray-100 p-1 mb-5">
|
||||||
|
<el-input v-model="form.winningBid" type="number" placeholder="根据美元中标价和汇率自动计算" readonly />
|
||||||
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
|
<el-col :span="12">
|
||||||
|
<el-form-item label="中标日期" prop="bidWinningDate" class="rounded-lg border border-gray-100 p-1 mb-5">
|
||||||
|
<el-date-picker
|
||||||
|
clearable
|
||||||
|
v-model="form.bidWinningDate"
|
||||||
|
type="date"
|
||||||
|
format="YYYY-MM-DD"
|
||||||
|
value-format="YYYY-MM-DD"
|
||||||
|
placeholder="请选择中标日期"
|
||||||
|
/>
|
||||||
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
|
<el-col :span="12">
|
||||||
|
<el-form-item label="投标保证金(人民币)" prop="bidDeposit" class="rounded-lg border border-gray-100 p-1 mb-5">
|
||||||
|
<el-input v-model="form.bidDeposit" type="number" placeholder="请输入投标保证金" />
|
||||||
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
|
<el-col :span="12">
|
||||||
|
<el-form-item label="是否退还" prop="whetherSendBack" class="rounded-lg border border-gray-100 p-1 mb-5">
|
||||||
|
<el-radio-group v-model="form.whetherSendBack">
|
||||||
|
<el-radio label="是" border>是</el-radio>
|
||||||
|
<el-radio label="否" border>否</el-radio>
|
||||||
|
</el-radio-group>
|
||||||
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
|
<el-col :span="12">
|
||||||
|
<el-form-item label="所属主体" prop="subject" class="rounded-lg border border-gray-100 p-1 mb-5">
|
||||||
|
<el-input v-model="form.subject" placeholder="请输入所属主体" />
|
||||||
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
|
<el-col :span="12">
|
||||||
|
<el-form-item label="建设单位" prop="construction" class="rounded-lg border border-gray-100 p-1 mb-5">
|
||||||
|
<el-input v-model="form.construction" placeholder="请输入建设单位" />
|
||||||
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
|
<el-col :span="12">
|
||||||
|
<el-form-item label="总造价" prop="totalCost" class="rounded-lg border border-gray-100 p-1 mb-5">
|
||||||
|
<el-input v-model="form.totalCost" placeholder="请输入总造价" />
|
||||||
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
|
<el-col :span="12">
|
||||||
|
<el-form-item label="立项申请人" prop="projectApplicant" class="rounded-lg border border-gray-100 p-1 mb-5">
|
||||||
|
<el-input v-model="form.projectApplicant" placeholder="请输入立项申请人" />
|
||||||
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
|
<el-col :span="12">
|
||||||
|
<el-form-item label="立项部门" prop="projectApplicantDept" class="rounded-lg border border-gray-100 p-1 mb-5">
|
||||||
|
<el-input v-model="form.projectApplicantDept" placeholder="请输入立项部门" />
|
||||||
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
|
<el-col :span="12">
|
||||||
|
<el-form-item label="立项申请日期" prop="projectApplicantTime" class="rounded-lg border border-gray-100 p-1 mb-5">
|
||||||
|
<el-date-picker
|
||||||
|
clearable
|
||||||
|
v-model="form.projectApplicantTime"
|
||||||
|
type="date"
|
||||||
|
format="YYYY-MM-DD"
|
||||||
|
value-format="YYYY-MM-DD"
|
||||||
|
placeholder="请选择立项申请日期"
|
||||||
|
/>
|
||||||
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
|
<!-- <el-col :span="12">
|
||||||
|
<el-form-item label="项目编号" prop="projectNumbering" class="rounded-lg border border-gray-100 p-1 mb-5">
|
||||||
|
<el-input v-model="form.projectNumbering" placeholder="请输入项目编号" />
|
||||||
|
</el-form-item>
|
||||||
|
</el-col> -->
|
||||||
|
<el-col :span="12">
|
||||||
|
<el-form-item label="中标通知书" prop="projectNumbering" class="rounded-lg border border-gray-100 p-1 mb-5">
|
||||||
|
<file-upload v-model="form.bidFile" :limit="10" :file-type="['pdf']" :file-size="50" />
|
||||||
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
|
</el-row>
|
||||||
|
<!-- 操作按钮区域 -->
|
||||||
|
<el-row v-if="!isDisabled" class="mt-8">
|
||||||
|
<el-col :span="24" class="text-center">
|
||||||
|
<el-button
|
||||||
|
:loading="buttonLoading"
|
||||||
|
type="primary"
|
||||||
|
@click="submitForm"
|
||||||
|
v-hasPermi="['bidding:listOfWinningBids:add', 'bidding:listOfWinningBids:edit']"
|
||||||
|
class="rounded-full px-8"
|
||||||
|
size="large"
|
||||||
|
>
|
||||||
|
确认提交
|
||||||
|
</el-button>
|
||||||
|
<el-button type="default" @click="resetForm" class="ml-6 rounded-full px-8" size="large"> 重置 </el-button>
|
||||||
|
</el-col>
|
||||||
|
</el-row>
|
||||||
|
</el-form>
|
||||||
|
</el-card>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script setup name="ListOfWinningBidsForm" lang="ts">
|
||||||
|
import { ref, reactive, toRefs, watch, onMounted, onUnmounted, getCurrentInstance, ComponentInternalInstance, computed } from 'vue';
|
||||||
|
import { addListOfWinningBids, updateListOfWinningBids, listListOfWinningBids, getListOfWinningBids } from '@/api/bidding/listOfWinningBids';
|
||||||
|
import { ListOfWinningBidsVO, ListOfWinningBidsForm } from '@/api/bidding/listOfWinningBids/types';
|
||||||
|
import { useUserStoreHook } from '@/store/modules/user';
|
||||||
|
import { ElFormInstance, ElMessage } from 'element-plus';
|
||||||
|
import { getProject, updateProject } from '@/api/project/project'; // 补充项目信息更新接口
|
||||||
|
const { proxy } = getCurrentInstance() as ComponentInternalInstance;
|
||||||
|
const { project_type, project_stage } = toRefs<any>(proxy?.useDict('project_type', 'project_stage'));
|
||||||
|
|
||||||
|
// 用户状态管理
|
||||||
|
const userStore = useUserStoreHook();
|
||||||
|
// 当前选中项目(从store获取)
|
||||||
|
const currentProject = computed(() => userStore.selectedProject);
|
||||||
|
|
||||||
|
// 项目信息(非表单绑定,直接响应式数据)
|
||||||
|
const projectInfo = reactive({
|
||||||
|
projectName: undefined,
|
||||||
|
shortName: undefined,
|
||||||
|
pId: undefined,
|
||||||
|
status: undefined,
|
||||||
|
picUrl: undefined,
|
||||||
|
remark: undefined,
|
||||||
|
projectType: undefined,
|
||||||
|
projectCategory: undefined,
|
||||||
|
deletedAt: undefined,
|
||||||
|
projectSite: undefined,
|
||||||
|
principal: undefined,
|
||||||
|
principalPhone: undefined,
|
||||||
|
actual: undefined,
|
||||||
|
lng: undefined,
|
||||||
|
lat: undefined,
|
||||||
|
plan: undefined,
|
||||||
|
onStreamTime: undefined,
|
||||||
|
playCardStart: undefined,
|
||||||
|
playCardEnd: undefined,
|
||||||
|
designTotal: undefined,
|
||||||
|
securityAgreement: undefined,
|
||||||
|
sort: 0,
|
||||||
|
showHidden: undefined,
|
||||||
|
isDelete: undefined
|
||||||
|
});
|
||||||
|
|
||||||
|
// 表单相关引用
|
||||||
|
const listOfWinningBidsFormRef = ref<ElFormInstance>();
|
||||||
|
// 加载状态
|
||||||
|
const buttonLoading = ref(false);
|
||||||
|
// 编辑/查看状态控制
|
||||||
|
const isDisabled = ref(false);
|
||||||
|
|
||||||
|
// 表单初始数据
|
||||||
|
const initFormData: ListOfWinningBidsForm = {
|
||||||
|
id: undefined,
|
||||||
|
projectId: currentProject.value?.id,
|
||||||
|
projectStatus: undefined,
|
||||||
|
projectName: undefined,
|
||||||
|
winningBidOriginal: undefined,
|
||||||
|
exchangeRate: undefined,
|
||||||
|
currency: undefined,
|
||||||
|
subject: undefined,
|
||||||
|
winningBid: undefined,
|
||||||
|
bidWinningDate: undefined,
|
||||||
|
bidDeposit: undefined,
|
||||||
|
whetherSendBack: undefined,
|
||||||
|
construction: undefined,
|
||||||
|
totalCost: undefined,
|
||||||
|
projectApplicant: undefined,
|
||||||
|
projectApplicantDept: undefined,
|
||||||
|
projectApplicantTime: undefined,
|
||||||
|
processStatus: undefined,
|
||||||
|
projectNumbering: undefined
|
||||||
|
};
|
||||||
|
|
||||||
|
// 表单数据与验证规则
|
||||||
|
const data = reactive({
|
||||||
|
form: { ...initFormData } as ListOfWinningBidsForm,
|
||||||
|
rules: {
|
||||||
|
projectId: [{ required: true, message: '项目ID不能为空', trigger: 'blur' }],
|
||||||
|
projectName: [{ required: true, message: '请输入项目名称', trigger: 'blur' }],
|
||||||
|
winningBidOriginal: [{ required: true, message: '请输入原始中标价', trigger: 'blur' }],
|
||||||
|
exchangeRate: [
|
||||||
|
{ required: true, message: '请输入汇率', trigger: 'blur' },
|
||||||
|
{ type: 'number', min: 0.001, message: '汇率需大于0', trigger: 'blur' }
|
||||||
|
],
|
||||||
|
currency: [{ required: true, message: '请输入币种', trigger: 'blur' }],
|
||||||
|
subject: [{ required: true, message: '请输入所属主体', trigger: 'blur' }],
|
||||||
|
winningBid: [{ required: true, message: '请输入中标价', trigger: 'blur' }],
|
||||||
|
bidWinningDate: [{ required: true, message: '请选择中标日期', trigger: 'blur' }],
|
||||||
|
projectNumbering: [{ required: true, message: '请输入项目编号', trigger: 'blur' }]
|
||||||
|
} as Record<string, any>
|
||||||
|
});
|
||||||
|
|
||||||
|
// 解构响应式数据
|
||||||
|
const { form, rules } = toRefs(data);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据字典值获取字典标签(用于项目类型/阶段的文本展示)
|
||||||
|
*/
|
||||||
|
const getDictLabel = (dictList: any[], value: any) => {
|
||||||
|
if (!dictList || !value) return '';
|
||||||
|
const dictItem = dictList.find((item) => item.value === value);
|
||||||
|
return dictItem ? dictItem.label : '';
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 计算人民币中标价
|
||||||
|
*/
|
||||||
|
const calculateWinningBid = () => {
|
||||||
|
const dollarAmount = Number(form.value.winningBidOriginal);
|
||||||
|
const rate = Number(form.value.exchangeRate);
|
||||||
|
|
||||||
|
if (isNaN(dollarAmount) || isNaN(rate) || dollarAmount <= 0 || rate <= 0) {
|
||||||
|
form.value.winningBid = undefined;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
const result = dollarAmount * rate;
|
||||||
|
form.value.winningBid = Number(result.toFixed(2));
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 页面初始化 - 获取已有数据(如存在)
|
||||||
|
*/
|
||||||
|
const initData = async () => {
|
||||||
|
try {
|
||||||
|
if (currentProject.value?.id) {
|
||||||
|
const res = await listListOfWinningBids({ projectId: currentProject.value.id });
|
||||||
|
if (res.code === 200) {
|
||||||
|
resetForm();
|
||||||
|
if (!res.data) {
|
||||||
|
isDisabled.value = false;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
Object.assign(form.value, res.data);
|
||||||
|
isDisabled.value = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} catch (error) {
|
||||||
|
console.error('初始化中标数据失败:', error);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 提交表单(含项目信息+中标信息同步提交)
|
||||||
|
*/
|
||||||
|
const submitForm = () => {
|
||||||
|
listOfWinningBidsFormRef.value?.validate(async (valid: boolean) => {
|
||||||
|
if (valid) {
|
||||||
|
buttonLoading.value = true;
|
||||||
|
try {
|
||||||
|
// 1. 计算人民币中标价
|
||||||
|
calculateWinningBid();
|
||||||
|
// 2. 绑定项目ID和项目名称(从项目信息同步)
|
||||||
|
form.value.projectId = currentProject.value?.id;
|
||||||
|
form.value.projectName = projectInfo.projectName;
|
||||||
|
|
||||||
|
// 3. 先更新项目信息(若项目信息有修改)
|
||||||
|
if (currentProject.value?.id) {
|
||||||
|
await updateProject({ id: currentProject.value.id, ...projectInfo });
|
||||||
|
}
|
||||||
|
|
||||||
|
// 4. 再提交中标信息(新增/编辑逻辑)
|
||||||
|
const isEdit = !!form.value.id;
|
||||||
|
if (isEdit) {
|
||||||
|
await updateListOfWinningBids(form.value);
|
||||||
|
} else {
|
||||||
|
await addListOfWinningBids(form.value);
|
||||||
|
}
|
||||||
|
|
||||||
|
// 5. 提交成功后切换为查看状态
|
||||||
|
isDisabled.value = true;
|
||||||
|
ElMessage.success(isEdit ? '编辑成功' : '提交成功');
|
||||||
|
} catch (error) {
|
||||||
|
ElMessage.error('提交失败,请重试');
|
||||||
|
console.error('提交表单失败:', error);
|
||||||
|
} finally {
|
||||||
|
buttonLoading.value = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取项目详细信息
|
||||||
|
*/
|
||||||
|
const getProjectDetail = async () => {
|
||||||
|
try {
|
||||||
|
if (currentProject.value?.id) {
|
||||||
|
const res = await getProject(currentProject.value.id);
|
||||||
|
Object.assign(projectInfo, res.data);
|
||||||
|
}
|
||||||
|
} catch (error) {
|
||||||
|
console.error('获取项目详情失败:', error);
|
||||||
|
ElMessage.error('获取项目信息失败');
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 重置表单(含项目信息重置)
|
||||||
|
*/
|
||||||
|
const resetForm = () => {
|
||||||
|
// 重置中标表单
|
||||||
|
form.value = { ...initFormData, projectId: currentProject.value?.id };
|
||||||
|
listOfWinningBidsFormRef.value?.resetFields();
|
||||||
|
|
||||||
|
// 重置项目信息(恢复为当前项目的原始数据)
|
||||||
|
getProjectDetail();
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 监听项目ID变化 - 重新初始化数据
|
||||||
|
*/
|
||||||
|
const projectIdWatcher = watch(
|
||||||
|
() => currentProject.value?.id,
|
||||||
|
(newId) => {
|
||||||
|
if (newId) {
|
||||||
|
form.value.projectId = newId;
|
||||||
|
getProjectDetail();
|
||||||
|
initData();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
);
|
||||||
|
|
||||||
|
// 页面挂载时初始化
|
||||||
|
onMounted(() => {
|
||||||
|
getProjectDetail();
|
||||||
|
initData();
|
||||||
|
});
|
||||||
|
|
||||||
|
// 页面卸载时清除监听
|
||||||
|
onUnmounted(() => {
|
||||||
|
projectIdWatcher();
|
||||||
|
});
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style scoped>
|
||||||
|
/* 全局背景色 */
|
||||||
|
.bg-gray-50 {
|
||||||
|
background-color: #f9fafb;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* 项目信息项布局样式 */
|
||||||
|
.project-info-item {
|
||||||
|
transition: all 0.2s ease;
|
||||||
|
padding: 4px 0;
|
||||||
|
color: #696969;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* 输入框/选择器统一样式 */
|
||||||
|
.el-input__wrapper,
|
||||||
|
.el-date-editor .el-input__wrapper,
|
||||||
|
.el-select__wrapper {
|
||||||
|
border-radius: 6px !important;
|
||||||
|
transition: all 0.2s ease;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* 输入框hover效果 */
|
||||||
|
.el-input__wrapper:hover,
|
||||||
|
.el-date-editor .el-input__wrapper:hover,
|
||||||
|
.el-select__wrapper:hover {
|
||||||
|
border-color: #409eff;
|
||||||
|
box-shadow: 0 0 0 2px rgba(64, 158, 255, 0.1);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* 卡片头部文字样式 */
|
||||||
|
.el-card__header-title {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
height: 100%;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* 按钮样式优化 */
|
||||||
|
.el-button {
|
||||||
|
transition: all 0.2s ease;
|
||||||
|
}
|
||||||
|
.el-button:hover {
|
||||||
|
transform: translateY(-1px);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* 表单项样式优化 */
|
||||||
|
.el-form-item {
|
||||||
|
transition: all 0.2s ease;
|
||||||
|
}
|
||||||
|
.el-form-item:hover {
|
||||||
|
border-color: #e6f7ff;
|
||||||
|
box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* 响应式网格布局适配 */
|
||||||
|
@media (max-width: 767px) {
|
||||||
|
.grid {
|
||||||
|
display: grid;
|
||||||
|
}
|
||||||
|
.grid-cols-1 {
|
||||||
|
grid-template-columns: repeat(1, minmax(0, 1fr));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@media (min-width: 768px) and (max-width: 1023px) {
|
||||||
|
.md\:grid-cols-2 {
|
||||||
|
grid-template-columns: repeat(2, minmax(0, 1fr));
|
||||||
|
}
|
||||||
|
.md\:col-span-2 {
|
||||||
|
grid-column: span 2 / span 2;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@media (min-width: 1024px) {
|
||||||
|
.lg\:grid-cols-3 {
|
||||||
|
grid-template-columns: repeat(3, minmax(0, 1fr));
|
||||||
|
}
|
||||||
|
.lg\:col-span-3 {
|
||||||
|
grid-column: span 3 / span 3;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* 间距样式 */
|
||||||
|
.gap-6 {
|
||||||
|
gap: 1.5rem;
|
||||||
|
}
|
||||||
|
.mb-1 {
|
||||||
|
margin-bottom: 0.25rem;
|
||||||
|
}
|
||||||
|
.mb-6 {
|
||||||
|
margin-bottom: 1.5rem;
|
||||||
|
}
|
||||||
|
.mt-4 {
|
||||||
|
margin-top: 1rem;
|
||||||
|
}
|
||||||
|
.mt-6 {
|
||||||
|
margin-top: 1.5rem;
|
||||||
|
}
|
||||||
|
.mt-8 {
|
||||||
|
margin-top: 2rem;
|
||||||
|
}
|
||||||
|
</style>
|
@ -1,344 +0,0 @@
|
|||||||
<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" label-width="110px">
|
|
||||||
<el-form-item label="项目名称" prop="projectName">
|
|
||||||
<el-input v-model="queryParams.projectName" placeholder="请输入项目名称" clearable @keyup.enter="handleQuery" />
|
|
||||||
</el-form-item>
|
|
||||||
<el-form-item label="建设单位" prop="construction">
|
|
||||||
<el-input v-model="queryParams.construction" placeholder="请输入建设单位" clearable @keyup.enter="handleQuery" />
|
|
||||||
</el-form-item>
|
|
||||||
<el-form-item label="立项申请人" prop="projectApplicant">
|
|
||||||
<el-input v-model="queryParams.projectApplicant" placeholder="请输入立项申请人" clearable @keyup.enter="handleQuery" />
|
|
||||||
</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="primary" plain icon="Plus" @click="handleAdd" v-hasPermi="['bidding:listOfWinningBids:add']">新增</el-button>
|
|
||||||
</el-col>
|
|
||||||
<right-toolbar v-model:showSearch="showSearch" @queryTable="getList"></right-toolbar>
|
|
||||||
</el-row>
|
|
||||||
</template>
|
|
||||||
|
|
||||||
<el-table v-loading="loading" :data="listOfWinningBidsList" @selection-change="handleSelectionChange">
|
|
||||||
<!-- <el-table-column type="selection" width="55" align="center" /> -->
|
|
||||||
<el-table-column label="序号" align="center" type="index" width="60" />
|
|
||||||
<el-table-column label="项目状态" align="center" prop="projectStatus" />
|
|
||||||
<el-table-column label="项目名称" align="center" prop="projectName" />
|
|
||||||
<el-table-column label="中标价" align="center" prop="winningBidOriginal" />
|
|
||||||
<el-table-column label="汇率" align="center" prop="exchangeRate" />
|
|
||||||
<el-table-column label="币种" align="center" prop="currency" />
|
|
||||||
<el-table-column label="所属主体" align="center" prop="subject" />
|
|
||||||
<el-table-column label="中标价" align="center" prop="winningBid" />
|
|
||||||
<el-table-column label="中标日期" align="center" prop="bidWinningDate" width="120"> </el-table-column>
|
|
||||||
<el-table-column label="投标保证金" align="center" prop="bidDeposit" width="120" />
|
|
||||||
<el-table-column label="是否退还" align="center" prop="whetherSendBack" />
|
|
||||||
<el-table-column label="建设单位" align="center" prop="construction" />
|
|
||||||
<el-table-column label="总造价" align="center" prop="totalCost" />
|
|
||||||
<el-table-column label="立项申请人" align="center" prop="projectApplicant" width="120" />
|
|
||||||
<el-table-column label="立项部门" align="center" prop="projectApplicantDept" />
|
|
||||||
<el-table-column label="立项申请日期" align="center" prop="projectApplicantTime" width="120"> </el-table-column>
|
|
||||||
<el-table-column label="流程状态" align="center" prop="processStatus" />
|
|
||||||
<el-table-column label="项目编号" align="center" prop="projectNumbering" />
|
|
||||||
<el-table-column label="操作" align="center" class-name="small-padding fixed-width" fixed="right" width="200">
|
|
||||||
<template #default="scope">
|
|
||||||
<el-button link type="primary" icon="Edit" @click="handleUpdate(scope.row)" v-hasPermi="['bidding:listOfWinningBids:edit']"
|
|
||||||
>修改</el-button
|
|
||||||
>
|
|
||||||
<el-button link type="primary" icon="Delete" @click="handleDelete(scope.row)" v-hasPermi="['bidding:listOfWinningBids:remove']">
|
|
||||||
删除</el-button
|
|
||||||
>
|
|
||||||
</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>
|
|
||||||
<!-- 添加或修改中标项目一览对话框 -->
|
|
||||||
<el-dialog :title="dialog.title" v-model="dialog.visible" width="800px" append-to-body>
|
|
||||||
<el-form ref="listOfWinningBidsFormRef" :model="form" :rules="rules" label-width="110px">
|
|
||||||
<el-row :gutter="24">
|
|
||||||
<el-col :span="12">
|
|
||||||
<el-form-item label="项目名称" prop="projectName"> <el-input v-model="form.projectName" placeholder="请输入项目名称" /> </el-form-item
|
|
||||||
></el-col>
|
|
||||||
<el-col :span="12">
|
|
||||||
<el-form-item label="中标价" prop="winningBidOriginal">
|
|
||||||
<el-input v-model="form.winningBidOriginal" placeholder="请输入中标价" /> </el-form-item
|
|
||||||
></el-col>
|
|
||||||
<el-col :span="12">
|
|
||||||
<el-form-item label="汇率" prop="exchangeRate"> <el-input v-model="form.exchangeRate" placeholder="请输入汇率" /> </el-form-item
|
|
||||||
></el-col>
|
|
||||||
<el-col :span="12">
|
|
||||||
<el-form-item label="币种" prop="currency"> <el-input v-model="form.currency" placeholder="请输入币种" /> </el-form-item
|
|
||||||
></el-col>
|
|
||||||
<el-col :span="12">
|
|
||||||
<el-form-item label="所属主体" prop="subject"> <el-input v-model="form.subject" placeholder="请输入所属主体" /> </el-form-item
|
|
||||||
></el-col>
|
|
||||||
<el-col :span="12"
|
|
||||||
><el-form-item label="中标价" prop="winningBid"> <el-input v-model="form.winningBid" placeholder="请输入中标价" /> </el-form-item
|
|
||||||
></el-col>
|
|
||||||
<el-col :span="12"
|
|
||||||
><el-form-item label="中标日期" prop="bidWinningDate">
|
|
||||||
<el-date-picker
|
|
||||||
clearable
|
|
||||||
v-model="form.bidWinningDate"
|
|
||||||
type="date"
|
|
||||||
format="YYYY-MM-DD"
|
|
||||||
value-format="YYYY-MM-DD"
|
|
||||||
placeholder="请选择中标日期"
|
|
||||||
>
|
|
||||||
</el-date-picker> </el-form-item
|
|
||||||
></el-col>
|
|
||||||
<el-col :span="12">
|
|
||||||
<el-form-item label="投标保证金" prop="bidDeposit"> <el-input v-model="form.bidDeposit" placeholder="请输入投标保证金" /> </el-form-item
|
|
||||||
></el-col>
|
|
||||||
<el-col :span="12">
|
|
||||||
<el-form-item label="是否退还" prop="whetherSendBack">
|
|
||||||
<el-input v-model="form.whetherSendBack" placeholder="请输入是否退还" /> </el-form-item
|
|
||||||
></el-col>
|
|
||||||
<el-col :span="12"
|
|
||||||
><el-form-item label="建设单位" prop="construction"> <el-input v-model="form.construction" placeholder="请输入建设单位" /> </el-form-item
|
|
||||||
></el-col>
|
|
||||||
<el-col :span="12">
|
|
||||||
<el-form-item label="总造价" prop="totalCost"> <el-input v-model="form.totalCost" placeholder="请输入总造价" /> </el-form-item
|
|
||||||
></el-col>
|
|
||||||
<el-col :span="12">
|
|
||||||
<el-form-item label="立项申请人" prop="projectApplicant">
|
|
||||||
<el-input v-model="form.projectApplicant" placeholder="请输入立项申请人" /> </el-form-item
|
|
||||||
></el-col>
|
|
||||||
<el-col :span="12"
|
|
||||||
><el-form-item label="立项部门" prop="projectApplicantDept">
|
|
||||||
<el-input v-model="form.projectApplicantDept" placeholder="请输入立项部门" /> </el-form-item
|
|
||||||
></el-col>
|
|
||||||
<el-col :span="12"
|
|
||||||
><el-form-item label="立项申请日期" prop="projectApplicantTime">
|
|
||||||
<el-date-picker
|
|
||||||
clearable
|
|
||||||
v-model="form.projectApplicantTime"
|
|
||||||
type="date"
|
|
||||||
format="YYYY-MM-DD"
|
|
||||||
value-format="YYYY-MM-DD"
|
|
||||||
placeholder="请选择立项申请日期"
|
|
||||||
>
|
|
||||||
</el-date-picker> </el-form-item
|
|
||||||
></el-col>
|
|
||||||
<el-col :span="12"
|
|
||||||
><el-form-item label="项目编号" prop="projectNumbering">
|
|
||||||
<el-input v-model="form.projectNumbering" placeholder="请输入项目编号" /> </el-form-item
|
|
||||||
></el-col>
|
|
||||||
</el-row>
|
|
||||||
</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="ListOfWinningBids" lang="ts">
|
|
||||||
import {
|
|
||||||
listListOfWinningBids,
|
|
||||||
getListOfWinningBids,
|
|
||||||
delListOfWinningBids,
|
|
||||||
addListOfWinningBids,
|
|
||||||
updateListOfWinningBids
|
|
||||||
} from '@/api/bidding/listOfWinningBids';
|
|
||||||
import { ListOfWinningBidsVO, ListOfWinningBidsQuery, ListOfWinningBidsForm } from '@/api/bidding/listOfWinningBids/types';
|
|
||||||
import { useUserStoreHook } from '@/store/modules/user';
|
|
||||||
const { proxy } = getCurrentInstance() as ComponentInternalInstance;
|
|
||||||
// 获取用户 store
|
|
||||||
const userStore = useUserStoreHook();
|
|
||||||
// 从 store 中获取当前选中的项目
|
|
||||||
const currentProject = computed(() => userStore.selectedProject);
|
|
||||||
const listOfWinningBidsList = ref<ListOfWinningBidsVO[]>([]);
|
|
||||||
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 listOfWinningBidsFormRef = ref<ElFormInstance>();
|
|
||||||
|
|
||||||
const dialog = reactive<DialogOption>({
|
|
||||||
visible: false,
|
|
||||||
title: ''
|
|
||||||
});
|
|
||||||
|
|
||||||
const initFormData: ListOfWinningBidsForm = {
|
|
||||||
id: undefined,
|
|
||||||
projectId: currentProject.value?.id,
|
|
||||||
projectStatus: undefined,
|
|
||||||
projectName: undefined,
|
|
||||||
winningBidOriginal: undefined,
|
|
||||||
exchangeRate: undefined,
|
|
||||||
currency: undefined,
|
|
||||||
subject: undefined,
|
|
||||||
winningBid: undefined,
|
|
||||||
bidWinningDate: undefined,
|
|
||||||
bidDeposit: undefined,
|
|
||||||
whetherSendBack: undefined,
|
|
||||||
construction: undefined,
|
|
||||||
totalCost: undefined,
|
|
||||||
projectApplicant: undefined,
|
|
||||||
projectApplicantDept: undefined,
|
|
||||||
projectApplicantTime: undefined,
|
|
||||||
processStatus: undefined,
|
|
||||||
projectNumbering: undefined
|
|
||||||
};
|
|
||||||
const data = reactive<PageData<ListOfWinningBidsForm, ListOfWinningBidsQuery>>({
|
|
||||||
form: { ...initFormData },
|
|
||||||
queryParams: {
|
|
||||||
pageNum: 1,
|
|
||||||
pageSize: 10,
|
|
||||||
projectId: currentProject.value?.id,
|
|
||||||
projectStatus: undefined,
|
|
||||||
projectName: undefined,
|
|
||||||
winningBidOriginal: undefined,
|
|
||||||
exchangeRate: undefined,
|
|
||||||
currency: undefined,
|
|
||||||
subject: undefined,
|
|
||||||
winningBid: undefined,
|
|
||||||
bidWinningDate: undefined,
|
|
||||||
bidDeposit: undefined,
|
|
||||||
whetherSendBack: undefined,
|
|
||||||
construction: undefined,
|
|
||||||
totalCost: undefined,
|
|
||||||
projectApplicant: undefined,
|
|
||||||
projectApplicantDept: undefined,
|
|
||||||
projectApplicantTime: undefined,
|
|
||||||
processStatus: undefined,
|
|
||||||
projectNumbering: undefined,
|
|
||||||
params: {}
|
|
||||||
},
|
|
||||||
rules: {
|
|
||||||
id: [{ required: true, message: '不能为空', trigger: 'blur' }],
|
|
||||||
projectId: [{ required: true, message: '项目id不能为空', trigger: 'blur' }]
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
const { queryParams, form, rules } = toRefs(data);
|
|
||||||
|
|
||||||
/** 查询中标项目一览列表 */
|
|
||||||
const getList = async () => {
|
|
||||||
loading.value = true;
|
|
||||||
const res = await listListOfWinningBids(queryParams.value);
|
|
||||||
listOfWinningBidsList.value = res.rows;
|
|
||||||
total.value = res.total;
|
|
||||||
loading.value = false;
|
|
||||||
};
|
|
||||||
|
|
||||||
/** 取消按钮 */
|
|
||||||
const cancel = () => {
|
|
||||||
reset();
|
|
||||||
dialog.visible = false;
|
|
||||||
};
|
|
||||||
|
|
||||||
/** 表单重置 */
|
|
||||||
const reset = () => {
|
|
||||||
form.value = { ...initFormData };
|
|
||||||
listOfWinningBidsFormRef.value?.resetFields();
|
|
||||||
};
|
|
||||||
|
|
||||||
/** 搜索按钮操作 */
|
|
||||||
const handleQuery = () => {
|
|
||||||
queryParams.value.pageNum = 1;
|
|
||||||
getList();
|
|
||||||
};
|
|
||||||
|
|
||||||
/** 重置按钮操作 */
|
|
||||||
const resetQuery = () => {
|
|
||||||
queryFormRef.value?.resetFields();
|
|
||||||
handleQuery();
|
|
||||||
};
|
|
||||||
|
|
||||||
/** 多选框选中数据 */
|
|
||||||
const handleSelectionChange = (selection: ListOfWinningBidsVO[]) => {
|
|
||||||
ids.value = selection.map((item) => item.id);
|
|
||||||
single.value = selection.length != 1;
|
|
||||||
multiple.value = !selection.length;
|
|
||||||
};
|
|
||||||
|
|
||||||
/** 新增按钮操作 */
|
|
||||||
const handleAdd = () => {
|
|
||||||
reset();
|
|
||||||
dialog.visible = true;
|
|
||||||
dialog.title = '添加中标项目一览';
|
|
||||||
};
|
|
||||||
|
|
||||||
/** 修改按钮操作 */
|
|
||||||
const handleUpdate = async (row?: ListOfWinningBidsVO) => {
|
|
||||||
reset();
|
|
||||||
const _id = row?.id || ids.value[0];
|
|
||||||
const res = await getListOfWinningBids(_id);
|
|
||||||
Object.assign(form.value, res.data);
|
|
||||||
dialog.visible = true;
|
|
||||||
dialog.title = '修改中标项目一览';
|
|
||||||
};
|
|
||||||
|
|
||||||
/** 提交按钮 */
|
|
||||||
const submitForm = () => {
|
|
||||||
listOfWinningBidsFormRef.value?.validate(async (valid: boolean) => {
|
|
||||||
if (valid) {
|
|
||||||
buttonLoading.value = true;
|
|
||||||
if (form.value.id) {
|
|
||||||
await updateListOfWinningBids(form.value).finally(() => (buttonLoading.value = false));
|
|
||||||
} else {
|
|
||||||
await addListOfWinningBids(form.value).finally(() => (buttonLoading.value = false));
|
|
||||||
}
|
|
||||||
proxy?.$modal.msgSuccess('操作成功');
|
|
||||||
dialog.visible = false;
|
|
||||||
await getList();
|
|
||||||
}
|
|
||||||
});
|
|
||||||
};
|
|
||||||
|
|
||||||
/** 删除按钮操作 */
|
|
||||||
const handleDelete = async (row?: ListOfWinningBidsVO) => {
|
|
||||||
const _ids = row?.id || ids.value;
|
|
||||||
await proxy?.$modal.confirm('是否确认删除中标项目一览编号为"' + _ids + '"的数据项?').finally(() => (loading.value = false));
|
|
||||||
await delListOfWinningBids(_ids);
|
|
||||||
proxy?.$modal.msgSuccess('删除成功');
|
|
||||||
await getList();
|
|
||||||
};
|
|
||||||
|
|
||||||
/** 导出按钮操作 */
|
|
||||||
const handleExport = () => {
|
|
||||||
proxy?.download(
|
|
||||||
'bidding/listOfWinningBids/export',
|
|
||||||
{
|
|
||||||
...queryParams.value
|
|
||||||
},
|
|
||||||
`listOfWinningBids_${new Date().getTime()}.xlsx`
|
|
||||||
);
|
|
||||||
};
|
|
||||||
//监听项目id刷新数据
|
|
||||||
const listeningProject = watch(
|
|
||||||
() => currentProject.value?.id,
|
|
||||||
(nid, oid) => {
|
|
||||||
getList();
|
|
||||||
}
|
|
||||||
);
|
|
||||||
|
|
||||||
onUnmounted(() => {
|
|
||||||
listeningProject();
|
|
||||||
});
|
|
||||||
onMounted(() => {
|
|
||||||
getList();
|
|
||||||
});
|
|
||||||
</script>
|
|
@ -2,18 +2,66 @@
|
|||||||
<div class="p-4 bg-gray-50 min-h-screen">
|
<div class="p-4 bg-gray-50 min-h-screen">
|
||||||
<!-- 卡片容器:控制最大宽度+居中+圆角阴影 -->
|
<!-- 卡片容器:控制最大宽度+居中+圆角阴影 -->
|
||||||
<el-card shadow="hover" class="max-w-6xl mx-auto rounded-xl overflow-hidden border-0" style="background-color: #ffffff">
|
<el-card shadow="hover" class="max-w-6xl mx-auto rounded-xl overflow-hidden border-0" style="background-color: #ffffff">
|
||||||
<!-- 卡片头部:独立背景色+内边距+圆角 -->
|
<!-- 卡片头部:项目信息展示区 -->
|
||||||
<template #header>
|
<template #header>
|
||||||
<div class="bg-blue-50 px-6 py-4 rounded-t-xl mb-0">
|
<div class="bg-blue-50 px-6 rounded-t-xl" style="padding: 10px 20px">
|
||||||
<h3 class="el-card__header-title text-lg font-semibold text-blue-800">投标项目信息填写</h3>
|
<h3 class="el-card__header-title text-lg font-semibold text-blue-800">投标项目信息</h3>
|
||||||
<span>{{ currentProject.name }}</span>
|
<h4>{{ currentProject.name }}</h4>
|
||||||
<div style="margin-top: 10px">
|
<!-- 项目信息部分 -->
|
||||||
<el-button @click="isDisabled = false" type="primary" class="px-8 py-2.5 transition-all duration-300 font-medium" v-if="isDisabled">
|
<div class="grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-6">
|
||||||
点击编辑
|
<div class="project-info-item">
|
||||||
</el-button>
|
<span>负责人:</span>
|
||||||
|
<span> {{ projectInfo.principal || '-' }}</span>
|
||||||
|
</div>
|
||||||
|
<div class="project-info-item">
|
||||||
|
<span>负责人电话:</span>
|
||||||
|
<span> {{ projectInfo.principalPhone || '-' }}</span>
|
||||||
|
</div>
|
||||||
|
<div class="project-info-item">
|
||||||
|
<span>项目类型:</span>
|
||||||
|
<span> {{ getDictLabel(project_type, projectInfo.projectType) || '-' }}</span>
|
||||||
|
</div>
|
||||||
|
<div class="project-info-item">
|
||||||
|
<span>项目阶段:</span>
|
||||||
|
<span> {{ getDictLabel(project_stage, projectInfo.projectStage) || '-' }}</span>
|
||||||
|
</div>
|
||||||
|
<div class="project-info-item">
|
||||||
|
<span>开工时间:</span>
|
||||||
|
<span> {{ projectInfo.onStreamTime || '-' }}</span>
|
||||||
|
</div>
|
||||||
|
<div class="project-info-item">
|
||||||
|
<span>经纬度:</span>
|
||||||
|
<span> {{ projectInfo.lng || '-' }},{{ projectInfo.lat || '-' }}</span>
|
||||||
|
</div>
|
||||||
|
<div class="project-info-item md:col-span-2 lg:col-span-3">
|
||||||
|
<span>项目地址:</span>
|
||||||
|
<span> {{ projectInfo.projectSite || '-' }}</span>
|
||||||
|
</div>
|
||||||
|
<div class="project-info-item">
|
||||||
|
<span>计划容量(M):</span>
|
||||||
|
<span> {{ projectInfo.plan || '-' }}</span>
|
||||||
|
</div>
|
||||||
|
<div class="project-info-item">
|
||||||
|
<span>实际容量(M):</span>
|
||||||
|
<span> {{ projectInfo.actual || '-' }}</span>
|
||||||
|
</div>
|
||||||
|
<div class="project-info-item">
|
||||||
|
<span>设计总量(M):</span>
|
||||||
|
<span> {{ projectInfo.designTotal || '-' }}</span>
|
||||||
|
</div>
|
||||||
|
<div class="project-info-item md:col-span-2 lg:col-span-3">
|
||||||
|
<span>备注:</span>
|
||||||
|
<span> {{ projectInfo.remark || '-' }}</span>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
<div class="mt-4 mb-6">
|
||||||
|
<el-button @click="isDisabled = false" type="primary" class="px-8 py-2.5 transition-all duration-300 font-medium" v-if="isDisabled">
|
||||||
|
点击编辑
|
||||||
|
</el-button>
|
||||||
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
<!-- 中标信息表单区域 -->
|
||||||
<el-form
|
<el-form
|
||||||
:disabled="isDisabled"
|
:disabled="isDisabled"
|
||||||
ref="listOfWinningBidsFormRef"
|
ref="listOfWinningBidsFormRef"
|
||||||
@ -24,100 +72,27 @@
|
|||||||
style="background-color: #ffffff"
|
style="background-color: #ffffff"
|
||||||
>
|
>
|
||||||
<el-row :gutter="32">
|
<el-row :gutter="32">
|
||||||
|
<!-- 是否中标(必填) -->
|
||||||
<el-col :span="12">
|
<el-col :span="12">
|
||||||
<el-form-item label="中标价(美元)" prop="winningBidOriginal" class="rounded-lg border border-gray-100 p-1 mb-5">
|
<el-form-item label="是否中标" prop="whetherBid" class="rounded-lg border border-gray-100 p-1 mb-5">
|
||||||
<el-input v-model.number="form.winningBidOriginal" type="number" placeholder="请输入中标价" @input="calculateWinningBid" />
|
<el-radio-group v-model="form.whetherBid">
|
||||||
</el-form-item>
|
<el-radio label="0" border>中标</el-radio>
|
||||||
</el-col>
|
<el-radio label="1" border>未中标</el-radio>
|
||||||
<el-col :span="12">
|
|
||||||
<el-form-item label="汇率" prop="exchangeRate" class="rounded-lg border border-gray-100 p-1 mb-5">
|
|
||||||
<el-input v-model.number="form.exchangeRate" type="number" placeholder="请输入汇率" step="0.0001" @input="calculateWinningBid" />
|
|
||||||
</el-form-item>
|
|
||||||
</el-col>
|
|
||||||
<el-col :span="12">
|
|
||||||
<el-form-item label="币种" prop="currency" class="rounded-lg border border-gray-100 p-1 mb-5">
|
|
||||||
<el-input v-model="form.currency" placeholder="请输入币种" />
|
|
||||||
</el-form-item>
|
|
||||||
</el-col>
|
|
||||||
<el-col :span="12">
|
|
||||||
<el-form-item label="中标价(人民币)" prop="winningBid" class="rounded-lg border border-gray-100 p-1 mb-5">
|
|
||||||
<!-- 人民币输入框:添加readonly禁止手动修改 -->
|
|
||||||
<el-input v-model="form.winningBid" type="number" placeholder="根据美元中标价和汇率自动计算" readonly />
|
|
||||||
</el-form-item>
|
|
||||||
</el-col>
|
|
||||||
<!-- 其他表单项保持不变 -->
|
|
||||||
<el-col :span="12">
|
|
||||||
<el-form-item label="中标日期" prop="bidWinningDate" class="rounded-lg border border-gray-100 p-1 mb-5">
|
|
||||||
<el-date-picker
|
|
||||||
clearable
|
|
||||||
v-model="form.bidWinningDate"
|
|
||||||
type="date"
|
|
||||||
format="YYYY-MM-DD"
|
|
||||||
value-format="YYYY-MM-DD"
|
|
||||||
placeholder="请选择中标日期"
|
|
||||||
/>
|
|
||||||
</el-form-item>
|
|
||||||
</el-col>
|
|
||||||
<el-col :span="12">
|
|
||||||
<el-form-item label="投标保证金(人民币)" prop="bidDeposit" class="rounded-lg border border-gray-100 p-1 mb-5">
|
|
||||||
<el-input v-model="form.bidDeposit" type="number" placeholder="请输入投标保证金" />
|
|
||||||
</el-form-item>
|
|
||||||
</el-col>
|
|
||||||
<el-col :span="12">
|
|
||||||
<el-form-item label="是否退还" prop="whetherSendBack" class="rounded-lg border border-gray-100 p-1 mb-5">
|
|
||||||
<el-radio-group v-model="form.whetherSendBack">
|
|
||||||
<el-radio label="是" border>是</el-radio>
|
|
||||||
<el-radio label="否" border>否</el-radio>
|
|
||||||
</el-radio-group>
|
</el-radio-group>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
</el-col>
|
</el-col>
|
||||||
<el-col :span="12">
|
<!-- 中标价(必填,仅中标时显示) -->
|
||||||
<el-form-item label="所属主体" prop="subject" class="rounded-lg border border-gray-100 p-1 mb-5">
|
<el-col :span="12" v-if="form.whetherBid == '0'">
|
||||||
<el-input v-model="form.subject" placeholder="请输入所属主体" />
|
<el-form-item label="中标价(人民币)" prop="bidPrice" class="rounded-lg border border-gray-100 p-1 mb-5">
|
||||||
|
<el-input v-model="form.bidPrice" type="number" placeholder="请输入中标价" />
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
</el-col>
|
</el-col>
|
||||||
<el-col :span="12">
|
<!-- 中标通知书(必填,仅中标时显示) -->
|
||||||
<el-form-item label="建设单位" prop="construction" class="rounded-lg border border-gray-100 p-1 mb-5">
|
<el-col :span="12" v-if="form.whetherBid == '0'">
|
||||||
<el-input v-model="form.construction" placeholder="请输入建设单位" />
|
<el-form-item label="中标通知书" prop="bidFile" class="rounded-lg border border-gray-100 p-1 mb-5">
|
||||||
|
<file-upload v-model="form.bidFile" :limit="10" :file-type="['pdf']" :file-size="50" />
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
</el-col>
|
</el-col>
|
||||||
<el-col :span="12">
|
|
||||||
<el-form-item label="总造价" prop="totalCost" class="rounded-lg border border-gray-100 p-1 mb-5">
|
|
||||||
<el-input v-model="form.totalCost" placeholder="请输入总造价" />
|
|
||||||
</el-form-item>
|
|
||||||
</el-col>
|
|
||||||
<el-col :span="12">
|
|
||||||
<el-form-item label="立项申请人" prop="projectApplicant" class="rounded-lg border border-gray-100 p-1 mb-5">
|
|
||||||
<el-input v-model="form.projectApplicant" placeholder="请输入立项申请人" />
|
|
||||||
</el-form-item>
|
|
||||||
</el-col>
|
|
||||||
<el-col :span="12">
|
|
||||||
<el-form-item label="立项部门" prop="projectApplicantDept" class="rounded-lg border border-gray-100 p-1 mb-5">
|
|
||||||
<el-input v-model="form.projectApplicantDept" placeholder="请输入立项部门" />
|
|
||||||
</el-form-item>
|
|
||||||
</el-col>
|
|
||||||
<el-col :span="12">
|
|
||||||
<el-form-item label="立项申请日期" prop="projectApplicantTime" class="rounded-lg border border-gray-100 p-1 mb-5">
|
|
||||||
<el-date-picker
|
|
||||||
clearable
|
|
||||||
v-model="form.projectApplicantTime"
|
|
||||||
type="date"
|
|
||||||
format="YYYY-MM-DD"
|
|
||||||
value-format="YYYY-MM-DD"
|
|
||||||
placeholder="请选择立项申请日期"
|
|
||||||
/>
|
|
||||||
</el-form-item>
|
|
||||||
</el-col>
|
|
||||||
<el-col :span="12">
|
|
||||||
<el-form-item label="项目编号" prop="projectNumbering" class="rounded-lg border border-gray-100 p-1 mb-5">
|
|
||||||
<el-input v-model="form.projectNumbering" placeholder="请输入项目编号" />
|
|
||||||
</el-form-item>
|
|
||||||
</el-col>
|
|
||||||
<!-- <el-col :span="12">
|
|
||||||
<el-form-item label="项目状态" prop="projectStatus" class="rounded-lg border border-gray-100 p-1 mb-5">
|
|
||||||
<el-input v-model="form.projectStatus" placeholder="请输入项目状态(如:进行中/已完成)" />
|
|
||||||
</el-form-item>
|
|
||||||
</el-col> -->
|
|
||||||
</el-row>
|
</el-row>
|
||||||
<!-- 操作按钮区域 -->
|
<!-- 操作按钮区域 -->
|
||||||
<el-row v-if="!isDisabled" class="mt-8">
|
<el-row v-if="!isDisabled" class="mt-8">
|
||||||
@ -142,125 +117,154 @@
|
|||||||
|
|
||||||
<script setup name="ListOfWinningBidsForm" lang="ts">
|
<script setup name="ListOfWinningBidsForm" lang="ts">
|
||||||
import { ref, reactive, toRefs, watch, onMounted, onUnmounted, getCurrentInstance, ComponentInternalInstance, computed } from 'vue';
|
import { ref, reactive, toRefs, watch, onMounted, onUnmounted, getCurrentInstance, ComponentInternalInstance, computed } from 'vue';
|
||||||
import { addListOfWinningBids, updateListOfWinningBids, listListOfWinningBids, getListOfWinningBids } from '@/api/bidding/listOfWinningBids';
|
import { addListOfWinningBids, updateListOfWinningBids, listListOfWinningBids } from '@/api/bidding/listOfWinningBids';
|
||||||
import { ListOfWinningBidsVO, ListOfWinningBidsForm } from '@/api/bidding/listOfWinningBids/types';
|
import { ListOfWinningBidsForm } from '@/api/bidding/listOfWinningBids/types';
|
||||||
import { useUserStoreHook } from '@/store/modules/user';
|
import { useUserStoreHook } from '@/store/modules/user';
|
||||||
import { ElFormInstance, ElMessage } from 'element-plus';
|
import { ElFormInstance, ElMessage } from 'element-plus';
|
||||||
|
import { getProject, updateProject } from '@/api/project/project';
|
||||||
|
|
||||||
// 获取组件实例
|
|
||||||
const { proxy } = getCurrentInstance() as ComponentInternalInstance;
|
const { proxy } = getCurrentInstance() as ComponentInternalInstance;
|
||||||
// 用户状态管理
|
const { project_type, project_stage } = toRefs<any>(proxy?.useDict('project_type', 'project_stage'));
|
||||||
|
|
||||||
|
// 用户状态管理与当前项目
|
||||||
const userStore = useUserStoreHook();
|
const userStore = useUserStoreHook();
|
||||||
// 当前选中项目(从store获取)
|
|
||||||
const currentProject = computed(() => userStore.selectedProject);
|
const currentProject = computed(() => userStore.selectedProject);
|
||||||
|
|
||||||
// 表单相关引用
|
// 项目信息(仅展示,非表单编辑)
|
||||||
|
const projectInfo = reactive({
|
||||||
|
principal: undefined,
|
||||||
|
principalPhone: undefined,
|
||||||
|
projectType: undefined,
|
||||||
|
projectStage: undefined,
|
||||||
|
onStreamTime: undefined,
|
||||||
|
lng: undefined,
|
||||||
|
lat: undefined,
|
||||||
|
projectSite: undefined,
|
||||||
|
plan: undefined,
|
||||||
|
actual: undefined,
|
||||||
|
designTotal: undefined,
|
||||||
|
remark: undefined,
|
||||||
|
projectName: undefined
|
||||||
|
});
|
||||||
|
|
||||||
|
// 表单核心变量
|
||||||
const listOfWinningBidsFormRef = ref<ElFormInstance>();
|
const listOfWinningBidsFormRef = ref<ElFormInstance>();
|
||||||
// 加载状态
|
|
||||||
const buttonLoading = ref(false);
|
const buttonLoading = ref(false);
|
||||||
const isDisabled = ref(false);
|
const isDisabled = ref(false);
|
||||||
|
|
||||||
// 表单初始数据
|
// 表单初始数据
|
||||||
const initFormData: ListOfWinningBidsForm = {
|
const initFormData = {
|
||||||
id: undefined,
|
id: undefined,
|
||||||
projectId: currentProject.value?.id,
|
projectId: currentProject.value?.id,
|
||||||
projectStatus: undefined,
|
whetherBid: '1', // 是否中标:0=中标,1=未中标
|
||||||
projectName: undefined,
|
bidPrice: undefined, // 中标价(人民币)
|
||||||
winningBidOriginal: undefined,
|
bidFile: undefined // 中标通知书
|
||||||
exchangeRate: undefined,
|
|
||||||
currency: undefined,
|
|
||||||
subject: undefined,
|
|
||||||
winningBid: undefined,
|
|
||||||
bidWinningDate: undefined,
|
|
||||||
bidDeposit: undefined,
|
|
||||||
whetherSendBack: undefined,
|
|
||||||
construction: undefined,
|
|
||||||
totalCost: undefined,
|
|
||||||
projectApplicant: undefined,
|
|
||||||
projectApplicantDept: undefined,
|
|
||||||
projectApplicantTime: undefined,
|
|
||||||
processStatus: undefined,
|
|
||||||
projectNumbering: undefined
|
|
||||||
};
|
};
|
||||||
|
|
||||||
// 表单数据与验证规则
|
// 表单数据与验证规则(核心:是否中标/中标价/中标通知书均设为必填)
|
||||||
const data = reactive({
|
const data = reactive({
|
||||||
form: { ...initFormData } as ListOfWinningBidsForm,
|
form: { ...initFormData } as ListOfWinningBidsForm,
|
||||||
rules: {
|
rules: {
|
||||||
projectId: [{ required: true, message: '项目ID不能为空', trigger: 'blur' }],
|
// 是否中标:必填
|
||||||
projectName: [{ required: true, message: '请输入项目名称', trigger: 'blur' }],
|
whetherBid: [{ required: true, message: '请选择是否中标', trigger: 'change' }],
|
||||||
winningBidOriginal: [{ required: true, message: '请输入原始中标价', trigger: 'blur' }],
|
// 中标价:仅中标时必填,且为正数
|
||||||
exchangeRate: [
|
bidPrice: [
|
||||||
{ required: true, message: '请输入汇率', trigger: 'blur' },
|
{
|
||||||
{ type: 'number', min: 0.001, message: '汇率需大于0', trigger: 'blur' }
|
required: true,
|
||||||
|
message: '请输入中标价',
|
||||||
|
trigger: 'blur',
|
||||||
|
validator: (rule: any, value: any, callback: any) => {
|
||||||
|
if (form.value.whetherBid === '0') {
|
||||||
|
if (!value && value !== 0) {
|
||||||
|
return callback(new Error('请输入中标价'));
|
||||||
|
}
|
||||||
|
if (Number(value) <= 0) {
|
||||||
|
return callback(new Error('中标价需大于0'));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
callback();
|
||||||
|
}
|
||||||
|
}
|
||||||
],
|
],
|
||||||
currency: [{ required: true, message: '请输入币种', trigger: 'blur' }],
|
// 中标通知书:仅中标时必填
|
||||||
subject: [{ required: true, message: '请输入所属主体', trigger: 'blur' }],
|
bidFile: [
|
||||||
winningBid: [{ required: true, message: '请输入中标价', trigger: 'blur' }],
|
{
|
||||||
bidWinningDate: [{ required: true, message: '请选择中标日期', trigger: 'blur' }],
|
required: true,
|
||||||
projectNumbering: [{ required: true, message: '请输入项目编号', trigger: 'blur' }]
|
message: '请上传中标通知书',
|
||||||
|
trigger: 'change',
|
||||||
|
validator: (rule: any, value: any, callback: any) => {
|
||||||
|
if (form.value.whetherBid === '0' && !value) {
|
||||||
|
return callback(new Error('请上传中标通知书'));
|
||||||
|
}
|
||||||
|
callback();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
} as Record<string, any>
|
} as Record<string, any>
|
||||||
});
|
});
|
||||||
|
|
||||||
// 解构响应式数据
|
|
||||||
const { form, rules } = toRefs(data);
|
const { form, rules } = toRefs(data);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 计算人民币中标价
|
* 字典标签转换(项目类型/阶段)
|
||||||
* 显式触发的计算函数,确保执行时机可靠
|
|
||||||
*/
|
*/
|
||||||
const calculateWinningBid = () => {
|
const getDictLabel = (dictList: any[], value: any) => {
|
||||||
// 确保数据类型正确
|
if (!dictList || !value) return '';
|
||||||
const dollarAmount = Number(form.value.winningBidOriginal);
|
const dictItem = dictList.find((item) => item.value === value);
|
||||||
const rate = Number(form.value.exchangeRate);
|
return dictItem ? dictItem.label : '';
|
||||||
|
|
||||||
// 验证输入有效性
|
|
||||||
if (isNaN(dollarAmount) || isNaN(rate) || dollarAmount <= 0 || rate <= 0) {
|
|
||||||
form.value.winningBid = undefined;
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
// 计算并保留2位小数
|
|
||||||
const result = dollarAmount * rate;
|
|
||||||
form.value.winningBid = Number(result.toFixed(2));
|
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 页面初始化 - 获取已有数据(如存在)
|
* 初始化中标数据(根据项目ID查询已有记录)
|
||||||
*/
|
*/
|
||||||
const initData = async () => {
|
const initData = async () => {
|
||||||
try {
|
try {
|
||||||
if (currentProject.value?.id) {
|
if (currentProject.value?.id) {
|
||||||
const res = await listListOfWinningBids({ projectId: currentProject.value.id });
|
const res = await listListOfWinningBids({ projectId: currentProject.value.id });
|
||||||
if (res.code == 200) {
|
if (res.code === 200) {
|
||||||
console.log(res.data);
|
|
||||||
resetForm();
|
resetForm();
|
||||||
if (!res.data) {
|
if (res.data) {
|
||||||
isDisabled.value = false;
|
|
||||||
return;
|
|
||||||
} else {
|
|
||||||
Object.assign(form.value, res.data);
|
Object.assign(form.value, res.data);
|
||||||
|
isDisabled.value = true;
|
||||||
|
} else {
|
||||||
|
isDisabled.value = false;
|
||||||
}
|
}
|
||||||
isDisabled.value = true;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
// ElMessage.error('初始化数据失败');
|
console.error('初始化中标数据失败:', error);
|
||||||
|
ElMessage.error('初始化数据失败');
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 提交表单
|
* 提交表单(含项目信息更新+中标信息提交)
|
||||||
*/
|
*/
|
||||||
const submitForm = () => {
|
const submitForm = () => {
|
||||||
listOfWinningBidsFormRef.value?.validate(async (valid: boolean) => {
|
listOfWinningBidsFormRef.value?.validate(async (valid: boolean) => {
|
||||||
if (valid) {
|
if (valid) {
|
||||||
buttonLoading.value = true;
|
buttonLoading.value = true;
|
||||||
try {
|
try {
|
||||||
// 提交前确保计算正确
|
// 1. 同步项目ID和名称
|
||||||
calculateWinningBid();
|
|
||||||
form.value.projectId = currentProject.value?.id;
|
form.value.projectId = currentProject.value?.id;
|
||||||
await addListOfWinningBids(form.value);
|
form.value.projectName = projectInfo.projectName;
|
||||||
|
|
||||||
|
// 2. 更新项目基础信息(若有变更)
|
||||||
|
if (currentProject.value?.id) {
|
||||||
|
await updateProject({ id: currentProject.value.id, ...projectInfo });
|
||||||
|
}
|
||||||
|
|
||||||
|
// 3. 提交中标信息(新增/编辑)
|
||||||
|
const isEdit = !!form.value.id;
|
||||||
|
if (isEdit) {
|
||||||
|
await updateListOfWinningBids(form.value);
|
||||||
|
} else {
|
||||||
|
await addListOfWinningBids(form.value);
|
||||||
|
}
|
||||||
|
|
||||||
|
// 4. 提交成功后切换为查看状态
|
||||||
isDisabled.value = true;
|
isDisabled.value = true;
|
||||||
ElMessage.success('提交成功');
|
ElMessage.success(isEdit ? '编辑成功' : '提交成功');
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
ElMessage.error('提交失败,请重试');
|
ElMessage.error('提交失败,请重试');
|
||||||
console.error('提交表单失败:', error);
|
console.error('提交表单失败:', error);
|
||||||
@ -270,44 +274,101 @@ const submitForm = () => {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 重置表单
|
* 获取项目详细信息(用于展示)
|
||||||
|
*/
|
||||||
|
const getProjectDetail = async () => {
|
||||||
|
try {
|
||||||
|
if (currentProject.value?.id) {
|
||||||
|
const res = await getProject(currentProject.value.id);
|
||||||
|
Object.assign(projectInfo, res.data);
|
||||||
|
}
|
||||||
|
} catch (error) {
|
||||||
|
console.error('获取项目详情失败:', error);
|
||||||
|
ElMessage.error('获取项目信息失败');
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 重置表单(恢复初始状态+重新拉取项目信息)
|
||||||
*/
|
*/
|
||||||
const resetForm = () => {
|
const resetForm = () => {
|
||||||
form.value = { ...initFormData, projectId: currentProject.value?.id };
|
form.value = { ...initFormData, projectId: currentProject.value?.id };
|
||||||
listOfWinningBidsFormRef.value?.resetFields();
|
listOfWinningBidsFormRef.value?.resetFields();
|
||||||
|
getProjectDetail();
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 监听项目ID变化 - 重新初始化数据
|
* 监听项目ID变化,重新初始化数据
|
||||||
*/
|
*/
|
||||||
const projectIdWatcher = watch(
|
const projectIdWatcher = watch(
|
||||||
() => currentProject.value?.id,
|
() => currentProject.value?.id,
|
||||||
(newId) => {
|
(newId) => {
|
||||||
if (newId) {
|
if (newId) {
|
||||||
form.value.projectId = newId;
|
form.value.projectId = newId;
|
||||||
|
getProjectDetail();
|
||||||
initData();
|
initData();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
||||||
// 页面挂载时初始化
|
// 生命周期钩子
|
||||||
onMounted(() => {
|
onMounted(() => {
|
||||||
|
getProjectDetail();
|
||||||
initData();
|
initData();
|
||||||
});
|
});
|
||||||
|
|
||||||
// 页面卸载时清除监听
|
|
||||||
onUnmounted(() => {
|
onUnmounted(() => {
|
||||||
projectIdWatcher();
|
projectIdWatcher();
|
||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style scoped>
|
<style scoped>
|
||||||
/* 全局背景色:柔和灰色,区分页面与卡片 */
|
/* 全局背景色 */
|
||||||
.bg-gray-50 {
|
.bg-gray-50 {
|
||||||
background-color: #f9fafb;
|
background-color: #f9fafb;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* 表单项优化:hover效果+边框过渡,提升交互感 */
|
/* 项目信息项样式 */
|
||||||
|
.project-info-item {
|
||||||
|
transition: all 0.2s ease;
|
||||||
|
padding: 4px 0;
|
||||||
|
color: #696969;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* 输入框/选择器统一样式 */
|
||||||
|
.el-input__wrapper,
|
||||||
|
.el-date-editor .el-input__wrapper,
|
||||||
|
.el-select__wrapper {
|
||||||
|
border-radius: 6px !important;
|
||||||
|
transition: all 0.2s ease;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* 输入框hover效果 */
|
||||||
|
.el-input__wrapper:hover,
|
||||||
|
.el-date-editor .el-input__wrapper:hover,
|
||||||
|
.el-select__wrapper:hover {
|
||||||
|
border-color: #409eff;
|
||||||
|
box-shadow: 0 0 0 2px rgba(64, 158, 255, 0.1);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* 卡片头部文字样式 */
|
||||||
|
.el-card__header-title {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
height: 100%;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* 按钮样式优化 */
|
||||||
|
.el-button {
|
||||||
|
transition: all 0.2s ease;
|
||||||
|
}
|
||||||
|
.el-button:hover {
|
||||||
|
transform: translateY(-1px);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* 表单项样式优化 */
|
||||||
.el-form-item {
|
.el-form-item {
|
||||||
transition: all 0.2s ease;
|
transition: all 0.2s ease;
|
||||||
}
|
}
|
||||||
@ -316,30 +377,51 @@ onUnmounted(() => {
|
|||||||
box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
|
box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* 输入框/选择器统一圆角 */
|
/* 响应式网格布局适配 */
|
||||||
.el-input__wrapper,
|
@media (max-width: 767px) {
|
||||||
.el-date-editor .el-input__wrapper {
|
.grid {
|
||||||
border-radius: 6px !important;
|
display: grid;
|
||||||
|
}
|
||||||
|
.grid-cols-1 {
|
||||||
|
grid-template-columns: repeat(1, minmax(0, 1fr));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* 卡片头部文字对齐优化 */
|
@media (min-width: 768px) and (max-width: 1023px) {
|
||||||
.el-card__header-title {
|
.md\:grid-cols-2 {
|
||||||
display: flex;
|
grid-template-columns: repeat(2, minmax(0, 1fr));
|
||||||
align-items: center;
|
}
|
||||||
height: 100%;
|
.md\:col-span-2 {
|
||||||
|
grid-column: span 2 / span 2;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* 按钮间距与过渡效果 */
|
@media (min-width: 1024px) {
|
||||||
.el-button {
|
.lg\:grid-cols-3 {
|
||||||
transition: all 0.2s ease;
|
grid-template-columns: repeat(3, minmax(0, 1fr));
|
||||||
}
|
}
|
||||||
.el-button:hover {
|
.lg\:col-span-3 {
|
||||||
transform: translateY(-1px);
|
grid-column: span 3 / span 3;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* 只读输入框样式优化(区分可编辑状态) */
|
/* 间距样式 */
|
||||||
.el-input--readonly .el-input__wrapper {
|
.gap-6 {
|
||||||
background-color: #f9fafb;
|
gap: 1.5rem;
|
||||||
cursor: not-allowed;
|
}
|
||||||
|
.mb-5 {
|
||||||
|
margin-bottom: 1.25rem;
|
||||||
|
}
|
||||||
|
.mb-6 {
|
||||||
|
margin-bottom: 1.5rem;
|
||||||
|
}
|
||||||
|
.mt-4 {
|
||||||
|
margin-top: 1rem;
|
||||||
|
}
|
||||||
|
.mt-6 {
|
||||||
|
margin-top: 1.5rem;
|
||||||
|
}
|
||||||
|
.mt-8 {
|
||||||
|
margin-top: 2rem;
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
|
@ -140,7 +140,7 @@
|
|||||||
<el-row>
|
<el-row>
|
||||||
<el-col :span="12">
|
<el-col :span="12">
|
||||||
<el-form-item
|
<el-form-item
|
||||||
:label="index === 0 ? '名称' : ''"
|
label="名称"
|
||||||
:prop="`itemList.${index}.name`"
|
:prop="`itemList.${index}.name`"
|
||||||
:rules="[{ required: true, message: '名称不能为空', trigger: 'blur' }]"
|
:rules="[{ required: true, message: '名称不能为空', trigger: 'blur' }]"
|
||||||
>
|
>
|
||||||
@ -149,7 +149,7 @@
|
|||||||
</el-col>
|
</el-col>
|
||||||
<el-col :span="12">
|
<el-col :span="12">
|
||||||
<el-form-item
|
<el-form-item
|
||||||
:label="index === 0 ? '规格' : ''"
|
label="规格"
|
||||||
:prop="`itemList.${index}.specification`"
|
:prop="`itemList.${index}.specification`"
|
||||||
:rules="[{ required: true, message: '规格不能为空', trigger: 'blur' }]"
|
:rules="[{ required: true, message: '规格不能为空', trigger: 'blur' }]"
|
||||||
>
|
>
|
||||||
@ -158,7 +158,7 @@
|
|||||||
</el-col>
|
</el-col>
|
||||||
<el-col :span="12">
|
<el-col :span="12">
|
||||||
<el-form-item
|
<el-form-item
|
||||||
:label="index === 0 ? '单位' : ''"
|
label="单位"
|
||||||
:prop="`itemList.${index}.unit`"
|
:prop="`itemList.${index}.unit`"
|
||||||
:rules="[{ required: true, message: '单位不能为空', trigger: 'blur' }]"
|
:rules="[{ required: true, message: '单位不能为空', trigger: 'blur' }]"
|
||||||
>
|
>
|
||||||
@ -167,7 +167,7 @@
|
|||||||
</el-col>
|
</el-col>
|
||||||
<el-col :span="12">
|
<el-col :span="12">
|
||||||
<el-form-item
|
<el-form-item
|
||||||
:label="index === 0 ? '库存' : ''"
|
label="库存"
|
||||||
:prop="`itemList.${index}.stockQuantity`"
|
:prop="`itemList.${index}.stockQuantity`"
|
||||||
:rules="[{ required: true, message: '库存不能为空', trigger: 'blur' }]"
|
:rules="[{ required: true, message: '库存不能为空', trigger: 'blur' }]"
|
||||||
>
|
>
|
||||||
@ -176,7 +176,7 @@
|
|||||||
</el-col>
|
</el-col>
|
||||||
<el-col :span="12">
|
<el-col :span="12">
|
||||||
<el-form-item
|
<el-form-item
|
||||||
:label="index === 0 ? '领取' : ''"
|
label="领取"
|
||||||
:prop="`itemList.${index}.issuedQuantity`"
|
:prop="`itemList.${index}.issuedQuantity`"
|
||||||
:rules="[{ required: true, message: '领取数量不能为空', trigger: 'blur' }]"
|
:rules="[{ required: true, message: '领取数量不能为空', trigger: 'blur' }]"
|
||||||
>
|
>
|
||||||
@ -185,7 +185,7 @@
|
|||||||
</el-col>
|
</el-col>
|
||||||
<el-col :span="12">
|
<el-col :span="12">
|
||||||
<el-form-item
|
<el-form-item
|
||||||
:label="index === 0 ? '剩余' : ''"
|
label="剩余"
|
||||||
:prop="`itemList.${index}.remainingQuantity`"
|
:prop="`itemList.${index}.remainingQuantity`"
|
||||||
:rules="[{ required: true, message: '剩余数量不能为空', trigger: 'blur' }]"
|
:rules="[{ required: true, message: '剩余数量不能为空', trigger: 'blur' }]"
|
||||||
>
|
>
|
||||||
@ -193,7 +193,7 @@
|
|||||||
</el-form-item>
|
</el-form-item>
|
||||||
</el-col>
|
</el-col>
|
||||||
<el-col :span="12">
|
<el-col :span="12">
|
||||||
<el-form-item :label="index === 0 ? '备注' : ''" prop="remark">
|
<el-form-item label="备注" prop="remark">
|
||||||
<el-input v-model="item.remark" placeholder="请输入内容" />
|
<el-input v-model="item.remark" placeholder="请输入内容" />
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
</el-col>
|
</el-col>
|
||||||
|
@ -54,31 +54,32 @@
|
|||||||
</tbody>
|
</tbody>
|
||||||
<thead>
|
<thead>
|
||||||
<tr>
|
<tr>
|
||||||
<th width="150">序号</th>
|
<!-- 去掉重复的 width 属性,统一用 CSS 控制 -->
|
||||||
<th width="150">名称</th>
|
<th style="width: 80px; word-wrap: break-word">序号</th>
|
||||||
<th width="150">规格</th>
|
<th style="width: 120px; word-wrap: break-word">名称</th>
|
||||||
<th width="150">单位</th>
|
<th style="width: 120px; word-wrap: break-word">规格</th>
|
||||||
<th width="150">库存</th>
|
<th style="width: 80px; word-wrap: break-word">单位</th>
|
||||||
<th width="150">领取</th>
|
<th style="width: 80px; word-wrap: break-word">库存</th>
|
||||||
<th width="150">剩余</th>
|
<th style="width: 80px; word-wrap: break-word">领取</th>
|
||||||
<th width="150">备注</th>
|
<th style="width: 80px; word-wrap: break-word">剩余</th>
|
||||||
|
<th style="width: 120px; word-wrap: break-word">备注</th>
|
||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
<tbody>
|
<tbody>
|
||||||
<tr v-for="(item, i) of formData.itemList" :key="i">
|
<tr v-for="(item, i) of formData.itemList" :key="i">
|
||||||
<th width="150">{{ i + 1 }}</th>
|
<td width="150">{{ i + 1 }}</td>
|
||||||
<th width="150">{{ item.name }}</th>
|
<td width="150">{{ item.name }}</td>
|
||||||
<th width="150">{{ item.specification }}</th>
|
<td width="150">{{ item.specification }}</td>
|
||||||
<th width="150">{{ item.unit }}</th>
|
<td width="150">{{ item.unit }}</td>
|
||||||
<th width="150">{{ item.stockQuantity }}</th>
|
<td width="150">{{ item.stockQuantity }}</td>
|
||||||
<th width="150">{{ item.issuedQuantity }}</th>
|
<td width="150">{{ item.issuedQuantity }}</td>
|
||||||
<th width="150">{{ item.remainingQuantity }}</th>
|
<td width="150">{{ item.remainingQuantity }}</td>
|
||||||
<th width="150">{{ item.remark }}</th>
|
<td width="150">{{ item.remark }}</td>
|
||||||
</tr>
|
</tr>
|
||||||
</tbody>
|
</tbody>
|
||||||
<tbody>
|
<tbody>
|
||||||
<tr>
|
<tr>
|
||||||
<td colspan="7">
|
<td colspan="7" style="word-wrap: break-word">
|
||||||
<div style="margin-bottom: 10px">缺陷情况:</div>
|
<div style="margin-bottom: 10px">缺陷情况:</div>
|
||||||
{{ formData.defectDescription }}
|
{{ formData.defectDescription }}
|
||||||
</td>
|
</td>
|
||||||
@ -296,5 +297,6 @@ tbody {
|
|||||||
box-shadow: 0px 0px 10px #ddd;
|
box-shadow: 0px 0px 10px #ddd;
|
||||||
padding: 20px;
|
padding: 20px;
|
||||||
position: relative;
|
position: relative;
|
||||||
|
/* overflow: auto; */
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
|
327
src/views/materials/materialsUseRecord/index.vue
Normal file
327
src/views/materials/materialsUseRecord/index.vue
Normal file
@ -0,0 +1,327 @@
|
|||||||
|
<template>
|
||||||
|
<div class="p-2">
|
||||||
|
<transition :enter-active-class="proxy?.animate.searchAnimate.enter" :leave-active-class="proxy?.animate.searchAnimate.leave"> </transition>
|
||||||
|
<el-card shadow="never">
|
||||||
|
<template #header>
|
||||||
|
<el-row :gutter="10" class="mb8">
|
||||||
|
<el-form ref="queryFormRef" :model="queryParams" :inline="true">
|
||||||
|
<el-form-item label="使用部位" prop="usePart">
|
||||||
|
<el-input v-model="queryParams.usePart" placeholder="请输入使用部位" clearable @keyup.enter="handleQuery" />
|
||||||
|
</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>
|
||||||
|
<right-toolbar v-model:showSearch="showSearch" @queryTable="getList"></right-toolbar>
|
||||||
|
</el-row>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<!-- 外层表格:添加ref用于控制展开状态 -->
|
||||||
|
<el-table ref="outerTableRef" v-loading="loading" :data="materialsUseInventoryList" @expand-change="handleExpandChange" border>
|
||||||
|
<el-table-column type="expand">
|
||||||
|
<template #default="props">
|
||||||
|
<div style="margin-left: 60px">
|
||||||
|
<el-table :data="materialsUseRecordList" border v-loading="loadingChild">
|
||||||
|
<el-table-column label="序号" align="center" type="index" width="60" />
|
||||||
|
<el-table-column label="使用数量" align="center" prop="useNumber" />
|
||||||
|
<el-table-column label="剩余量" align="center" prop="residueNumber" />
|
||||||
|
<el-table-column label="使用部位" align="center" prop="usePart" />
|
||||||
|
<el-table-column label="备注" align="center" prop="remark" />
|
||||||
|
<el-table-column label="操作" align="center" class-name="small-padding fixed-width">
|
||||||
|
<template #default="scope">
|
||||||
|
<el-button
|
||||||
|
link
|
||||||
|
type="primary"
|
||||||
|
icon="delete"
|
||||||
|
v-if="scope.row.ishow"
|
||||||
|
@click="handleDelete(scope.row)"
|
||||||
|
v-hasPermi="['materials:materialsUseRecord:remove']"
|
||||||
|
>删除</el-button
|
||||||
|
>
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
</el-table>
|
||||||
|
<pagination
|
||||||
|
v-show="totalChild > 0"
|
||||||
|
:total="totalChild"
|
||||||
|
v-model:page="queryParamsChild.pageNum"
|
||||||
|
v-model:limit="queryParamsChild.pageSize"
|
||||||
|
@pagination="getListChild"
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
<el-table-column label="序号" align="center" type="index" width="60" />
|
||||||
|
<el-table-column label="物资名称" align="center" prop="materialsName" />
|
||||||
|
<el-table-column label="交接单位" align="center" prop="recipient" />
|
||||||
|
<el-table-column label="计划数量" align="center" prop="quantityCount" />
|
||||||
|
<el-table-column label="数量" align="center" prop="number" />
|
||||||
|
<el-table-column label="出库人" align="center" prop="operator" />
|
||||||
|
<el-table-column label="领用人" align="center" prop="shipper" />
|
||||||
|
<el-table-column label="剩余量" align="center" prop="residue" />
|
||||||
|
<el-table-column label="备注" align="center" prop="remark" />
|
||||||
|
<el-table-column label="操作" align="center" class-name="small-padding fixed-width">
|
||||||
|
<template #default="scope">
|
||||||
|
<el-button link type="primary" icon="Plus" @click="handleAdd(scope.row)" v-hasPermi="['materials:materialsUseRecord:add']"
|
||||||
|
>添加登记</el-button
|
||||||
|
>
|
||||||
|
</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>
|
||||||
|
<!-- 添加或修改材料使用登记对话框 -->
|
||||||
|
<el-dialog :title="dialog.title" v-model="dialog.visible" width="500px" append-to-body>
|
||||||
|
<el-form ref="materialsUseRecordFormRef" :model="form" :rules="rules" label-width="80px">
|
||||||
|
<el-form-item label="使用数量" prop="useNumber">
|
||||||
|
<el-input v-model="form.useNumber" type="number" placeholder="请输入使用数量" />
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="使用部位" prop="usePart">
|
||||||
|
<el-input v-model="form.usePart" type="textarea" placeholder="请输入内容" />
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="备注" prop="remark">
|
||||||
|
<el-input v-model="form.remark" placeholder="请输入备注" />
|
||||||
|
</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="MaterialsUseRecord" lang="ts">
|
||||||
|
import {
|
||||||
|
listMaterialsUseRecord,
|
||||||
|
listMaterialsUseInventory,
|
||||||
|
getMaterialsUseRecord,
|
||||||
|
delMaterialsUseRecord,
|
||||||
|
addMaterialsUseRecord,
|
||||||
|
updateMaterialsUseRecord
|
||||||
|
} from '@/api/materials/materialsUseRecord';
|
||||||
|
import { MaterialsUseRecordVO, MaterialsUseRecordQuery, MaterialsUseRecordForm } from '@/api/materials/materialsUseRecord/types';
|
||||||
|
import { getCurrentInstance, ComponentInternalInstance, onMounted, ref, reactive, toRefs, computed } from 'vue';
|
||||||
|
import { ElFormInstance, ElTable } from 'element-plus';
|
||||||
|
import useUserStore from '@/store/modules/user';
|
||||||
|
import { get } from 'lodash';
|
||||||
|
|
||||||
|
// 类型定义补充(若项目中无全局DialogOption类型需添加)
|
||||||
|
interface DialogOption {
|
||||||
|
visible: boolean;
|
||||||
|
title: string;
|
||||||
|
}
|
||||||
|
|
||||||
|
const { proxy } = getCurrentInstance() as ComponentInternalInstance;
|
||||||
|
const userStore = useUserStore();
|
||||||
|
const currentProject = computed(() => userStore.selectedProject);
|
||||||
|
|
||||||
|
// 核心数据响应式定义
|
||||||
|
const materialsUseRecordList = ref<MaterialsUseRecordVO[]>([]);
|
||||||
|
const materialsUseInventoryList = ref<any[]>([]); // 外层列表数据类型可根据实际接口返回调整
|
||||||
|
const buttonLoading = ref(false);
|
||||||
|
const loading = ref(true);
|
||||||
|
const loadingChild = 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 totalChild = ref(0);
|
||||||
|
|
||||||
|
// 组件Ref定义
|
||||||
|
const queryFormRef = ref<ElFormInstance>();
|
||||||
|
const materialsUseRecordFormRef = ref<ElFormInstance>();
|
||||||
|
const outerTableRef = ref<InstanceType<typeof ElTable> | undefined>(undefined); // 外层表格Ref(控制展开)
|
||||||
|
const currentExpandInventoryId = ref<number | undefined>(undefined); // 存储当前展开行的inventoryId
|
||||||
|
|
||||||
|
// 对话框与表单数据
|
||||||
|
const dialog = reactive<DialogOption>({
|
||||||
|
visible: false,
|
||||||
|
title: ''
|
||||||
|
});
|
||||||
|
|
||||||
|
const initFormData = {
|
||||||
|
id: undefined,
|
||||||
|
projectId: currentProject.value?.id,
|
||||||
|
inventoryId: undefined,
|
||||||
|
usePart: undefined,
|
||||||
|
useNumber: undefined,
|
||||||
|
residueNumber: undefined,
|
||||||
|
remark: undefined
|
||||||
|
};
|
||||||
|
const data = reactive({
|
||||||
|
form: { ...initFormData } as MaterialsUseRecordForm,
|
||||||
|
queryParams: {
|
||||||
|
pageNum: 1,
|
||||||
|
pageSize: 10,
|
||||||
|
projectId: currentProject.value?.id,
|
||||||
|
outPut: 1,
|
||||||
|
usePart: undefined // 补充usePart字段(与表单prop对应)
|
||||||
|
} as MaterialsUseRecordQuery & { outPut?: number; usePart?: string },
|
||||||
|
queryParamsChild: {
|
||||||
|
pageNum: 1,
|
||||||
|
pageSize: 10,
|
||||||
|
inventoryId: undefined,
|
||||||
|
usePart: undefined,
|
||||||
|
useNumber: undefined,
|
||||||
|
residueNumber: undefined
|
||||||
|
} as MaterialsUseRecordQuery,
|
||||||
|
rules: {
|
||||||
|
id: [{ required: true, message: '主键ID不能为空', trigger: 'blur' }],
|
||||||
|
projectId: [{ required: true, message: '项目ID不能为空', trigger: 'blur' }],
|
||||||
|
inventoryId: [{ required: true, message: '库存ID不能为空', trigger: 'blur' }],
|
||||||
|
usePart: [{ required: true, message: '使用部位不能为空', trigger: 'blur' }],
|
||||||
|
useNumber: [{ required: true, message: '使用数量不能为空', trigger: 'blur' }],
|
||||||
|
residueNumber: [{ required: true, message: '剩余量不能为空', trigger: 'blur' }]
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
const { queryParams, form, rules, queryParamsChild } = toRefs(data);
|
||||||
|
|
||||||
|
/** 查询材料使用登记列表(外层列表) */
|
||||||
|
const getList = async () => {
|
||||||
|
loading.value = true;
|
||||||
|
try {
|
||||||
|
const res = await listMaterialsUseInventory(queryParams.value);
|
||||||
|
materialsUseInventoryList.value = res.rows;
|
||||||
|
total.value = res.total;
|
||||||
|
} finally {
|
||||||
|
loading.value = false;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
/** 处理外层表格展开/折叠:记录当前展开行的inventoryId */
|
||||||
|
const handleExpandChange = (row: any) => {
|
||||||
|
currentExpandInventoryId.value = row.id; // 记录展开行ID
|
||||||
|
queryParamsChild.value.inventoryId = row.id;
|
||||||
|
getListChild();
|
||||||
|
};
|
||||||
|
|
||||||
|
/** 查询材料子级登记列表(内层列表) */
|
||||||
|
const getListChild = async () => {
|
||||||
|
loadingChild.value = true;
|
||||||
|
try {
|
||||||
|
const res = await listMaterialsUseRecord(queryParamsChild.value);
|
||||||
|
materialsUseRecordList.value = res.rows;
|
||||||
|
// 控制首行删除按钮显示
|
||||||
|
if (res.rows.length > 0) {
|
||||||
|
materialsUseRecordList.value[0].ishow = true;
|
||||||
|
}
|
||||||
|
totalChild.value = res.total;
|
||||||
|
} finally {
|
||||||
|
loadingChild.value = false;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
/** 取消按钮 */
|
||||||
|
const cancel = () => {
|
||||||
|
reset();
|
||||||
|
dialog.visible = false;
|
||||||
|
};
|
||||||
|
|
||||||
|
/** 表单重置 */
|
||||||
|
const reset = () => {
|
||||||
|
form.value = { ...initFormData };
|
||||||
|
materialsUseRecordFormRef.value?.resetFields();
|
||||||
|
};
|
||||||
|
|
||||||
|
/** 搜索按钮操作 */
|
||||||
|
const handleQuery = () => {
|
||||||
|
queryParams.value.pageNum = 1;
|
||||||
|
getList();
|
||||||
|
};
|
||||||
|
|
||||||
|
/** 重置按钮操作 */
|
||||||
|
const resetQuery = () => {
|
||||||
|
queryFormRef.value?.resetFields();
|
||||||
|
handleQuery();
|
||||||
|
};
|
||||||
|
|
||||||
|
/** 多选框选中数据(当前模板未使用,保留原逻辑) */
|
||||||
|
const handleSelectionChange = (selection: MaterialsUseRecordVO[]) => {
|
||||||
|
ids.value = selection.map((item) => item.id);
|
||||||
|
single.value = selection.length !== 1;
|
||||||
|
multiple.value = !selection.length;
|
||||||
|
};
|
||||||
|
|
||||||
|
/** 新增按钮操作 */
|
||||||
|
const handleAdd = async (row: any) => {
|
||||||
|
reset();
|
||||||
|
form.value.inventoryId = row.id;
|
||||||
|
dialog.visible = true;
|
||||||
|
dialog.title = '添加材料使用登记';
|
||||||
|
};
|
||||||
|
|
||||||
|
/** 修改按钮操作(当前模板未使用,保留原逻辑) */
|
||||||
|
const handleUpdate = async (row?: MaterialsUseRecordVO) => {
|
||||||
|
reset();
|
||||||
|
const _id = row?.id || ids.value[0];
|
||||||
|
const res = await getMaterialsUseRecord(_id);
|
||||||
|
Object.assign(form.value, res.data);
|
||||||
|
dialog.visible = true;
|
||||||
|
dialog.title = '修改材料使用登记';
|
||||||
|
};
|
||||||
|
|
||||||
|
/** 提交按钮:核心优化逻辑(刷新外层列表+保留展开状态) */
|
||||||
|
const submitForm = () => {
|
||||||
|
materialsUseRecordFormRef.value?.validate(async (valid: boolean) => {
|
||||||
|
if (valid) {
|
||||||
|
buttonLoading.value = true;
|
||||||
|
try {
|
||||||
|
// 1. 执行添加/修改接口请求
|
||||||
|
await addMaterialsUseRecord(form.value);
|
||||||
|
// 2. 刷新外层列表(确保外层数据同步,如剩余量)
|
||||||
|
await getList();
|
||||||
|
// 3. 刷新当前展开行的子列表
|
||||||
|
await getListChild();
|
||||||
|
// 4. 恢复展开状态:根据记录的inventoryId重新展开行
|
||||||
|
if (currentExpandInventoryId.value && outerTableRef.value) {
|
||||||
|
const targetRow = materialsUseInventoryList.value.find((item) => item.id === currentExpandInventoryId.value);
|
||||||
|
if (targetRow) {
|
||||||
|
outerTableRef.value.toggleRowExpansion(targetRow, true);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
proxy?.$modal.msgSuccess('操作成功');
|
||||||
|
dialog.visible = false;
|
||||||
|
} finally {
|
||||||
|
buttonLoading.value = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
/** 删除按钮操作 */
|
||||||
|
const handleDelete = async (row?: MaterialsUseRecordVO) => {
|
||||||
|
const _ids = row?.id || ids.value;
|
||||||
|
try {
|
||||||
|
await proxy?.$modal.confirm(`是否确认删除材料使用登记编号为"${_ids}"的数据项?`);
|
||||||
|
await delMaterialsUseRecord(_ids);
|
||||||
|
await getList();
|
||||||
|
await getListChild();
|
||||||
|
if (currentExpandInventoryId.value && outerTableRef.value) {
|
||||||
|
const targetRow = materialsUseInventoryList.value.find((item) => item.id === currentExpandInventoryId.value);
|
||||||
|
if (targetRow) {
|
||||||
|
outerTableRef.value.toggleRowExpansion(targetRow, true);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
proxy?.$modal.msgSuccess('删除成功');
|
||||||
|
await getListChild();
|
||||||
|
} finally {
|
||||||
|
loading.value = false;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
/** 导出按钮操作(保留原逻辑) */
|
||||||
|
const handleExport = () => {
|
||||||
|
proxy?.download('materials/materialsUseRecord/export', { ...queryParams.value }, `materialsUseRecord_${new Date().getTime()}.xlsx`);
|
||||||
|
};
|
||||||
|
|
||||||
|
/** 页面挂载时加载外层列表 */
|
||||||
|
onMounted(() => {
|
||||||
|
getList();
|
||||||
|
});
|
||||||
|
</script>
|
@ -288,7 +288,7 @@ const getList = async () => {
|
|||||||
matrixOptions.value = matrixList;
|
matrixOptions.value = matrixList;
|
||||||
queryParams.value.matrixId = matrixList[0].children[0].matrixId;
|
queryParams.value.matrixId = matrixList[0].children[0].matrixId;
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
proxy?.$modal.msgError('获取方阵失败');
|
// proxy?.$modal.msgError('获取方阵失败');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user