style: 招标管理
This commit is contained in:
@@ -1,9 +1,535 @@
|
||||
<script setup lang="ts">
|
||||
import dayjs from "dayjs";
|
||||
import { ref, onMounted } from "vue";
|
||||
import { ElMessage, ElMessageBox } from "element-plus";
|
||||
import { request, authApi, bizApi } from "@/api/utils";
|
||||
|
||||
defineOptions({
|
||||
name: "issuanceBid"
|
||||
});
|
||||
|
||||
withDefaults(
|
||||
defineProps<{
|
||||
height?: string;
|
||||
}>(),
|
||||
{
|
||||
height: null
|
||||
}
|
||||
);
|
||||
|
||||
// 定义查询参数
|
||||
const queryParams = ref({
|
||||
pageNum: 1,
|
||||
pageSize: 20,
|
||||
userId: "",
|
||||
isCompany: "",
|
||||
companyId: "",
|
||||
bidType: "",
|
||||
bidField: "",
|
||||
category: "",
|
||||
bidStatus: ""
|
||||
});
|
||||
|
||||
// 定义表格数据
|
||||
const tableData = ref([]);
|
||||
const loading = ref(false);
|
||||
const total = ref(0);
|
||||
|
||||
// 前端用户列表数据
|
||||
const frontendUserOptions = ref([]);
|
||||
// 获取前端用户列表
|
||||
const getFrontendUserList = async () => {
|
||||
try {
|
||||
const res = await request(bizApi("getFrontendUserPrimaryInfo"), {
|
||||
method: "POST"
|
||||
});
|
||||
if (res.status === 200) {
|
||||
frontendUserOptions.value = res.data.map(item => ({
|
||||
value: item.id,
|
||||
label: item.name
|
||||
}));
|
||||
}
|
||||
} catch (error) {
|
||||
console.error("获取用户列表失败:", error);
|
||||
}
|
||||
};
|
||||
|
||||
// 公司列表数据
|
||||
const companyOptions = ref([]);
|
||||
// 获取公司列表
|
||||
const getCompanyList = async () => {
|
||||
try {
|
||||
const res = await request(bizApi("getCompanyPrimaryInfo"), {
|
||||
method: "POST"
|
||||
});
|
||||
if (res.status === 200) {
|
||||
companyOptions.value = res.data.map(item => ({
|
||||
value: item.id,
|
||||
label: item.companyName
|
||||
}));
|
||||
}
|
||||
} catch (error) {
|
||||
console.error("获取公司列表失败:", error);
|
||||
}
|
||||
};
|
||||
|
||||
// 获取发标列表
|
||||
const getBidList = async () => {
|
||||
try {
|
||||
loading.value = true;
|
||||
const params = { ...queryParams.value };
|
||||
const data = await request(bizApi("issuanceBidPage"), {
|
||||
method: "POST",
|
||||
body: JSON.stringify(params)
|
||||
});
|
||||
|
||||
if (data.status === 200) {
|
||||
tableData.value = data.data.rows;
|
||||
total.value = data.data.records;
|
||||
} else {
|
||||
ElMessage.error(data.msg || "获取数据失败");
|
||||
}
|
||||
} catch (error) {
|
||||
console.error("获取发标列表失败:", error);
|
||||
ElMessage.error(error.message || "获取数据失败");
|
||||
} finally {
|
||||
loading.value = false;
|
||||
}
|
||||
};
|
||||
|
||||
// 搜索方法
|
||||
const handleSearch = () => {
|
||||
queryParams.value.pageNum = 1;
|
||||
getBidList();
|
||||
};
|
||||
|
||||
// 重置方法
|
||||
const handleReset = () => {
|
||||
queryParams.value = {
|
||||
pageNum: 1,
|
||||
pageSize: 20,
|
||||
userId: "",
|
||||
isCompany: "",
|
||||
companyId: "",
|
||||
bidType: "",
|
||||
bidField: "",
|
||||
category: "",
|
||||
bidStatus: ""
|
||||
};
|
||||
getBidList();
|
||||
};
|
||||
|
||||
// 分页改变
|
||||
const handleSizeChange = (val: number) => {
|
||||
queryParams.value.pageSize = val;
|
||||
getBidList();
|
||||
};
|
||||
|
||||
const handleCurrentChange = (val: number) => {
|
||||
queryParams.value.pageNum = val;
|
||||
getBidList();
|
||||
};
|
||||
|
||||
// 添加状态选项
|
||||
const bidStatusOptions = [
|
||||
{ value: 1, label: "完成" },
|
||||
{ value: 2, label: "未完成" },
|
||||
{ value: 3, label: "超时" }
|
||||
];
|
||||
|
||||
// 添加中标状态选项
|
||||
const existsWinnerOptions = [
|
||||
{ value: 1, label: "存在" },
|
||||
{ value: 0, label: "不存在" }
|
||||
];
|
||||
|
||||
// 添加道具使用状态选项
|
||||
const usePurchaseOptions = [
|
||||
{ value: 1, label: "使用" },
|
||||
{ value: 0, label: "未使用" }
|
||||
];
|
||||
|
||||
// 添加发标类型选项
|
||||
const bidTypeOptions = [
|
||||
{ value: 1, label: "求购" },
|
||||
{ value: 2, label: "租赁" }
|
||||
];
|
||||
|
||||
// 添加发标领域选项
|
||||
const bidFieldOptions = [
|
||||
{ value: 1, label: "民航" },
|
||||
{ value: 2, label: "通航" }
|
||||
];
|
||||
|
||||
// 添加发标分类选项
|
||||
const categoryOptions = [
|
||||
{ value: 1, label: "航材" },
|
||||
{ value: 2, label: "飞机" }
|
||||
];
|
||||
|
||||
const columns: TableColumnList = [
|
||||
{
|
||||
label: "用户名称",
|
||||
prop: "userId",
|
||||
width: "120",
|
||||
formatter: row => {
|
||||
const user = frontendUserOptions.value.find(
|
||||
item => item.value === row.userId
|
||||
);
|
||||
return user ? user.label : "";
|
||||
}
|
||||
},
|
||||
{
|
||||
label: "是否公司",
|
||||
prop: "isCompany",
|
||||
width: "90",
|
||||
formatter: row => {
|
||||
return row.isCompany ? "是" : "否";
|
||||
}
|
||||
},
|
||||
{
|
||||
label: "公司名称",
|
||||
prop: "companyId",
|
||||
width: "150",
|
||||
formatter: row => {
|
||||
const company = companyOptions.value.find(
|
||||
item => item.value === row.companyId
|
||||
);
|
||||
return company ? company.label : "";
|
||||
}
|
||||
},
|
||||
{
|
||||
label: "发标类型",
|
||||
prop: "bidType",
|
||||
width: "100",
|
||||
formatter: row => {
|
||||
const type = bidTypeOptions.find(item => item.value === row.bidType);
|
||||
return type ? type.label : "";
|
||||
}
|
||||
},
|
||||
{
|
||||
label: "发标领域",
|
||||
prop: "bidField",
|
||||
width: "100",
|
||||
formatter: row => {
|
||||
const field = bidFieldOptions.find(item => item.value === row.bidField);
|
||||
return field ? field.label : "";
|
||||
}
|
||||
},
|
||||
{
|
||||
label: "需求数量",
|
||||
prop: "needNum",
|
||||
width: "90"
|
||||
},
|
||||
{
|
||||
label: "发标分类",
|
||||
prop: "category",
|
||||
width: "100",
|
||||
formatter: row => {
|
||||
const cat = categoryOptions.find(item => item.value === row.category);
|
||||
return cat ? cat.label : "";
|
||||
}
|
||||
},
|
||||
{
|
||||
label: "型号/件号",
|
||||
prop: "pnNum",
|
||||
width: "120"
|
||||
},
|
||||
{
|
||||
label: "状态",
|
||||
prop: "bidStatus",
|
||||
width: "90",
|
||||
formatter: row => {
|
||||
const status = bidStatusOptions.find(
|
||||
item => item.value === row.bidStatus
|
||||
);
|
||||
return status ? status.label : "";
|
||||
}
|
||||
},
|
||||
{
|
||||
label: "中标者",
|
||||
prop: "existsWinner",
|
||||
width: "100",
|
||||
formatter: row => {
|
||||
const winner = existsWinnerOptions.find(
|
||||
item => item.value === row.existsWinner
|
||||
);
|
||||
return winner ? winner.label : "";
|
||||
}
|
||||
},
|
||||
{
|
||||
label: "使用道具",
|
||||
prop: "usePurchase",
|
||||
width: "90",
|
||||
formatter: row => {
|
||||
const purchase = usePurchaseOptions.find(
|
||||
item => item.value === row.usePurchase
|
||||
);
|
||||
return purchase ? purchase.label : "";
|
||||
}
|
||||
},
|
||||
{
|
||||
label: "置顶卡",
|
||||
prop: "useTopCardFlag",
|
||||
width: "90",
|
||||
formatter: row => {
|
||||
return row.useTopCardFlag === 0 ? "未使用" : "使用";
|
||||
}
|
||||
},
|
||||
{
|
||||
label: "加量卡",
|
||||
prop: "useRaiseCardFlag",
|
||||
width: "90",
|
||||
formatter: row => {
|
||||
return row.useRaiseCardFlag === 0 ? "未使用" : "使用";
|
||||
}
|
||||
},
|
||||
{
|
||||
label: "有效天数",
|
||||
prop: "validDays",
|
||||
width: "90"
|
||||
},
|
||||
{
|
||||
label: "截止日期",
|
||||
prop: "expiryDate",
|
||||
width: "160",
|
||||
formatter: row => {
|
||||
return row.expiryDate
|
||||
? dayjs(row.expiryDate).format("YYYY-MM-DD HH:mm:ss")
|
||||
: "";
|
||||
}
|
||||
},
|
||||
{
|
||||
label: "操作",
|
||||
fixed: "right",
|
||||
width: 160,
|
||||
slot: "operation",
|
||||
align: "center"
|
||||
}
|
||||
];
|
||||
|
||||
// 添加删除方法
|
||||
const handleDelete = async (row: any) => {
|
||||
try {
|
||||
await ElMessageBox.confirm("确认要删除该发标记录吗?", "提示", {
|
||||
type: "warning"
|
||||
});
|
||||
|
||||
const res = await request(bizApi("deleteIssuanceBid"), {
|
||||
method: "POST",
|
||||
body: JSON.stringify({ id: row.id })
|
||||
});
|
||||
|
||||
if (res.status === 200) {
|
||||
ElMessage.success("删除成功");
|
||||
getBidList();
|
||||
} else {
|
||||
ElMessage.error(res.msg || "删除失败");
|
||||
}
|
||||
} catch (error) {
|
||||
console.error("删除失败:", error);
|
||||
}
|
||||
};
|
||||
|
||||
// 添加编辑方法
|
||||
const handleEdit = (row: any) => {
|
||||
// TODO: 实现编辑功能
|
||||
console.log("编辑行:", row);
|
||||
};
|
||||
|
||||
// 页面加载时获取数据
|
||||
onMounted(() => {
|
||||
getBidList();
|
||||
getFrontendUserList();
|
||||
getCompanyList();
|
||||
});
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<h1>招标管理</h1>
|
||||
<div class="issuanceBid-container">
|
||||
<div class="search-box">
|
||||
<el-form ref="queryForm" :model="queryParams" :inline="true">
|
||||
<el-form-item label="用户" prop="userId">
|
||||
<el-select
|
||||
v-model="queryParams.userId"
|
||||
placeholder="请选择用户"
|
||||
clearable
|
||||
class="user-select"
|
||||
>
|
||||
<el-option
|
||||
v-for="item in frontendUserOptions"
|
||||
:key="item.value"
|
||||
:label="item.label"
|
||||
:value="item.value"
|
||||
/>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
|
||||
<!-- <el-form-item label="是否公司" prop="isCompany">
|
||||
<el-select
|
||||
v-model="queryParams.isCompany"
|
||||
placeholder="请选择"
|
||||
clearable
|
||||
class="company-type-select"
|
||||
>
|
||||
<el-option label="是" :value="true" />
|
||||
<el-option label="否" :value="false" />
|
||||
</el-select>
|
||||
</el-form-item> -->
|
||||
|
||||
<el-form-item label="公司名称" prop="companyId">
|
||||
<el-select
|
||||
v-model="queryParams.companyId"
|
||||
placeholder="请选择公司"
|
||||
clearable
|
||||
class="company-select"
|
||||
>
|
||||
<el-option
|
||||
v-for="item in companyOptions"
|
||||
:key="item.value"
|
||||
:label="item.label"
|
||||
:value="item.value"
|
||||
/>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
|
||||
<el-form-item label="发标类型" prop="bidType">
|
||||
<el-select
|
||||
v-model="queryParams.bidType"
|
||||
placeholder="请选择发标类型"
|
||||
clearable
|
||||
class="type-select"
|
||||
>
|
||||
<el-option
|
||||
v-for="item in bidTypeOptions"
|
||||
:key="item.value"
|
||||
:label="item.label"
|
||||
:value="item.value"
|
||||
/>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
|
||||
<el-form-item label="发标领域" prop="bidField">
|
||||
<el-select
|
||||
v-model="queryParams.bidField"
|
||||
placeholder="请选择发标领域"
|
||||
clearable
|
||||
class="type-select"
|
||||
>
|
||||
<el-option
|
||||
v-for="item in bidFieldOptions"
|
||||
:key="item.value"
|
||||
:label="item.label"
|
||||
:value="item.value"
|
||||
/>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
|
||||
<el-form-item label="发标分类" prop="category">
|
||||
<el-select
|
||||
v-model="queryParams.category"
|
||||
placeholder="请选择发标分类"
|
||||
clearable
|
||||
class="type-select"
|
||||
>
|
||||
<el-option
|
||||
v-for="item in categoryOptions"
|
||||
:key="item.value"
|
||||
:label="item.label"
|
||||
:value="item.value"
|
||||
/>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
|
||||
<el-form-item label="状态" prop="bidStatus">
|
||||
<el-select
|
||||
v-model="queryParams.bidStatus"
|
||||
placeholder="请选择状态"
|
||||
clearable
|
||||
class="type-select"
|
||||
>
|
||||
<el-option
|
||||
v-for="item in bidStatusOptions"
|
||||
:key="item.value"
|
||||
:label="item.label"
|
||||
:value="item.value"
|
||||
/>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
|
||||
<el-form-item>
|
||||
<el-button type="primary" @click="handleSearch">搜索</el-button>
|
||||
<el-button @click="handleReset">重置</el-button>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
</div>
|
||||
|
||||
<pure-table
|
||||
v-loading="loading"
|
||||
:data="tableData"
|
||||
:columns="columns"
|
||||
:height="height"
|
||||
row-key="id"
|
||||
>
|
||||
<template #operation="{ row }">
|
||||
<el-button type="primary" link @click="handleEdit(row)">
|
||||
编辑
|
||||
</el-button>
|
||||
<el-button type="danger" link @click="handleDelete(row)">
|
||||
删除
|
||||
</el-button>
|
||||
</template>
|
||||
</pure-table>
|
||||
|
||||
<div class="pagination-container">
|
||||
<el-pagination
|
||||
v-model:current-page="queryParams.pageNum"
|
||||
v-model:page-size="queryParams.pageSize"
|
||||
:page-sizes="[10, 20, 30, 50]"
|
||||
:total="total"
|
||||
layout="total, sizes, prev, pager, next, jumper"
|
||||
@size-change="handleSizeChange"
|
||||
@current-change="handleCurrentChange"
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.issuanceBid-container {
|
||||
padding: 20px;
|
||||
|
||||
.search-box {
|
||||
padding: 20px;
|
||||
margin-bottom: 20px;
|
||||
background: #fff;
|
||||
border-radius: 4px;
|
||||
|
||||
:deep(.el-form-item) {
|
||||
margin-bottom: 0;
|
||||
}
|
||||
}
|
||||
|
||||
.user-select {
|
||||
width: 180px;
|
||||
}
|
||||
|
||||
.company-select {
|
||||
width: 180px;
|
||||
}
|
||||
|
||||
.company-type-select {
|
||||
width: 90px;
|
||||
}
|
||||
|
||||
.pagination-container {
|
||||
display: flex;
|
||||
justify-content: flex-end;
|
||||
margin-top: 20px;
|
||||
}
|
||||
}
|
||||
|
||||
.type-select {
|
||||
width: 120px;
|
||||
}
|
||||
</style>
|
||||
|
||||
Reference in New Issue
Block a user