建立新分支准备

This commit is contained in:
2025-08-15 15:21:07 +08:00
parent ff2f36e88c
commit a7b148bc96
5 changed files with 591 additions and 651 deletions

View File

@ -1,73 +1,66 @@
<template>
<div class="min-h-screen bg-gray-50 flex flex-col">
<div class="p-5">
<!-- 主要内容区 -->
<main class="flex-1 p-6">
<!-- 操作栏 -->
<div class="bg-white rounded-lg shadow-sm p-4 mb-6 transition-all duration-300 hover:shadow-md">
<div class="flex flex-wrap items-center justify-between gap-4">
<!-- 操作按钮 -->
<div class="flex gap-2">
<el-button icon="Refresh" @click="refreshData" class="transition-all duration-200 hover:shadow-md">
刷新
</el-button>
</div>
</div>
</div>
<el-card class="mb-5">
<el-button icon="Refresh" @click="refreshData" class="transition-all duration-200 hover:shadow-md">
刷新
</el-button>
</el-card>
<!-- 数据表格 -->
<div class="bg-white rounded-lg shadow-sm overflow-hidden transition-all duration-300 hover:shadow-md">
<el-table v-loading="loading" :data="tableData" border stripe
:header-cell-style="{ 'background-color': '#f5f7fa', 'font-weight': 'bold' }"
:row-class-name="tableRowClassName">
<el-table-column prop="id" label="ID" width="80" align="center"></el-table-column>
<el-table-column prop="name" label="材料名称" min-width="150"></el-table-column>
<el-table-column prop="specification" label="规格" min-width="120"></el-table-column>
<el-table-column prop="supplier" label="供应商" min-width="150"></el-table-column>
<el-table-column prop="findType" label="类型" width="100" align="center">
<template #default="scope">
<el-tag :type="scope.row.findType === '1' ? 'success' : 'info'">
{{ scope.row.findType === '1' ? '采购' : '材料' }}
</el-tag>
</template>
</el-table-column>
<el-table-column prop="installationQuantity" label="安装量" width="100" align="center"></el-table-column>
<el-table-column prop="contractSigning" label="合同签订时间" width="180" align="center">
<template #default="scope">
{{ formatDate(scope.row.contractSigning) }}
</template>
</el-table-column>
<el-table-column prop="createTime" label="创建时间" width="180" align="center">
<template #default="scope">
{{ formatDate(scope.row.createTime) }}
</template>
</el-table-column>
<el-table-column label="操作" width="180" align="center" fixed="right">
<template #default="scope">
<!-- <el-button size="small" icon="Plus" @click="handleAddSon(scope.row)"
<!-- 数据表格 -->
<div class="bg-white rounded-lg shadow-sm overflow-hidden transition-all duration-300 hover:shadow-md">
<el-table v-loading="loading" :data="tableData" border stripe
:header-cell-style="{ 'background-color': '#f5f7fa', 'font-weight': 'bold' }"
style="width: 100%; margin-bottom: 20px; height: calc(100vh - 305px)"
:row-class-name="tableRowClassName">
<el-table-column prop="id" label="ID" width="80" align="center"></el-table-column>
<el-table-column prop="name" label="材料名称" min-width="150"></el-table-column>
<el-table-column prop="specification" label="规格" min-width="120"></el-table-column>
<el-table-column prop="supplier" label="供应商" min-width="150"></el-table-column>
<el-table-column prop="findType" label="类型" width="100" align="center">
<template #default="scope">
<el-tag :type="scope.row.findType === '1' ? 'success' : 'info'">
{{ scope.row.findType === '1' ? '采购' : '材料' }}
</el-tag>
</template>
</el-table-column>
<el-table-column prop="installationQuantity" label="安装量" width="100" align="center"></el-table-column>
<el-table-column prop="contractSigning" label="合同签订时间" width="180" align="center">
<template #default="scope">
{{ formatDate(scope.row.contractSigning) }}
</template>
</el-table-column>
<el-table-column prop="createTime" label="创建时间" width="180" align="center">
<template #default="scope">
{{ formatDate(scope.row.createTime) }}
</template>
</el-table-column>
<el-table-column label="操作" width="180" align="center" fixed="right">
<template #default="scope">
<!-- <el-button size="small" icon="Plus" @click="handleAddSon(scope.row)"
class="text-blue-600 hover:text-blue-800 transition-colors"></el-button> -->
<el-button size="small" icon="Edit" @click="handleEdit(scope.row)"
class="text-blue-600 hover:text-blue-800 transition-colors"></el-button>
<el-button size="small" icon="View" @click="jumpRouter(scope.row)"
class="text-blue-600 hover:text-blue-800 transition-colors"></el-button>
<el-button size="small" icon="Delete" @click="handleDelete(scope.row)"
class="text-red-600 hover:text-red-800 transition-colors"></el-button>
</template>
</el-table-column>
</el-table>
<el-button size="small" icon="Edit" @click="handleEdit(scope.row)"
class="text-blue-600 hover:text-blue-800 transition-colors"></el-button>
<el-button size="small" icon="View" @click="jumpRouter(scope.row)"
class="text-blue-600 hover:text-blue-800 transition-colors"></el-button>
<el-button size="small" icon="Delete" @click="handleDelete(scope.row)"
class="text-red-600 hover:text-red-800 transition-colors"></el-button>
</template>
</el-table-column>
</el-table>
<!-- 分页 -->
<div class="flex items-center justify-between p-4 border-t">
<div class="text-gray-500 text-sm">
{{ total }} 条记录当前显示第 {{ (currentPage - 1) * pageSize + 1 }} {{ Math.min(currentPage *
pageSize, total)
}}
</div>
<el-pagination v-model:current-page="currentPage" v-model:page-size="pageSize" :page-sizes="[10, 20, 50, 100]"
:total="total" layout="prev, pager, next, jumper, sizes" @size-change="handleSizeChange"
@current-change="handleCurrentChange"></el-pagination>
<!-- 分页 -->
<div class="flex items-center justify-between p-4 border-t">
<div class="text-gray-500 text-sm">
{{ total }} 条记录当前显示第 {{ (currentPage - 1) * pageSize + 1 }} {{ Math.min(currentPage *
pageSize, total)
}}
</div>
<el-pagination v-model:current-page="currentPage" v-model:page-size="pageSize" :page-sizes="[10, 20, 50, 100]"
:total="total" layout="prev, pager, next, jumper, sizes" @size-change="handleSizeChange"
@current-change="handleCurrentChange"></el-pagination>
</div>
</main>
</div>
<!-- 新增/编辑对话框 -->
<el-dialog v-model="dialogVisible" :title="dialogType === 'add' ? '新增记录' : '编辑记录'" :width="dialogWidth"
:fullscreen="isFullscreen" :before-close="handleDialogClose">
@ -150,24 +143,6 @@
</div>
</template>
</el-dialog>
<!-- 删除确认对话框 -->
<el-dialog v-model="deleteDialogVisible" title="确认删除" width="300px" :show-close="false">
<div class="text-center py-4">
<el-icon class="text-orange-500 text-4xl mb-3">
<WarningFilled />
</el-icon>
<p>确定要删除这条记录吗</p>
<p class="text-gray-500 text-sm mt-2">此操作不可撤销请谨慎操作</p>
</div>
<template #footer>
<div class="flex justify-center gap-2">
<el-button @click="deleteDialogVisible = false">取消</el-button>
<el-button type="danger" @click="confirmDelete" :loading="deleteLoading">
确认删除
</el-button>
</div>
</template>
</el-dialog>
</div>
</template>
@ -180,7 +155,6 @@ import { useRouter } from 'vue-router';
const userStore = useUserStoreHook();
const router = useRouter();
const currentProject = computed(() => userStore.selectedProject);
const { proxy } = getCurrentInstance();
import { useMaterialsQueryList, newMaterialsAdd, materialsEdit, materialsDel, queryMaterialsInfo } from "@/api/materials/usageMaterials/index";
// 表格数据相关
const tableData = ref([]);
@ -195,7 +169,6 @@ const dialogType = ref('add'); // add 或 edit
const dialogWidth = ref('70%');
const isFullscreen = ref(false);
const deleteDialogVisible = ref(false);
const deleteDialogVisible2 = ref(false);
const formRef = ref(null);
const formRef2 = ref(null);
const saveLoading = ref(false);
@ -339,7 +312,7 @@ const handleAddSon = (row) => {
type: 'warning',
}
).then(() => {
materialsEdit(formData).then(res=>{
materialsEdit(formData).then(res => {
let { code } = res
if (code === 200) {
ElMessage({
@ -360,7 +333,22 @@ const handleAddSon = (row) => {
// 删除
const handleDelete = (row) => {
currentRow.value = row;
deleteDialogVisible.value = true;
ElMessageBox.confirm(
'确定要删除这条记录吗?此操作不可撤销,请谨慎操作',
'提示',
{
confirmButtonText: '确认',
cancelButtonText: '取消',
type: 'warning',
}
).then(() => {
confirmDelete();
}).catch(() => {
ElMessage({
type: 'info',
message: '已取消删除',
})
})
};