This commit is contained in:
2025-08-15 00:22:06 +08:00
parent 802fd82d02
commit b8c9dd5be5
2 changed files with 282 additions and 255 deletions

View File

@ -5,7 +5,7 @@ VITE_APP_TITLE = 新能源项目管理平台
VITE_APP_ENV = 'development'
# 开发环境
VITE_APP_BASE_API = 'http://192.168.110.159:8898'
VITE_APP_BASE_API = 'http://192.168.110.180:8898'
# 无人机接口地址

View File

@ -2,6 +2,8 @@
<div class="overall-plan-material-supply">
<!-- tabPosition="left" -->
<el-card shadow="always">
<template #header>
<el-row :gutter="10" class="mb8">
<el-form :inline="true">
<el-form-item v-if="state.masterData.status == 'draft'">
<el-button type="primary" icon="edit" @click="clickApprovalSheet1()">审批</el-button>
@ -10,17 +12,42 @@
<el-button icon="view" @click="lookApprovalFlow()" type="warning">查看流程</el-button>
</el-form-item>
</el-form>
<right-toolbar @queryTable="getMasterDataList"></right-toolbar>
</el-row>
</template>
</el-card>
<el-table :data="state.tableData" v-loading="state.loading.list" stripe
style="width: 100%; margin-bottom: 20px; height: calc(100vh - 230px)" row-key="id" border>
<el-table
:data="state.tableData"
v-loading="state.loading.list"
stripe
style="width: 100%; margin-bottom: 20px; height: calc(100vh - 230px)"
row-key="id"
border
>
<el-table-column prop="num" label="编号" />
<el-table-column prop="name" label="工程或费用名称" />
<el-table-column prop="unit" label="单位" />
<el-table-column prop="quantity" label="数量" />
<el-table-column prop="quantity" label="数量" width="60" />
<el-table-column prop="batchNumber" label="批次号" width="200" />
<el-table-column prop="brand" label="品牌" />
<el-table-column prop="texture" label="材质" />
<el-table-column prop="qualityStandard" label="质量标准" />
<el-table-column prop="partUsed" label="使用部位" />
<el-table-column prop="deliveryPoints" label="交货地点" />
<el-table-column label="预计使用日期">
<template #default="{ row }">
<span>{{ row.dateService ? row.dateService.split(' ')[0] : '' }}</span>
</template>
</el-table-column>
<el-table-column prop="remark" label="备注" />
<el-table-column label="操作">
<template #default="{ row }">
<el-button :disabled="state.masterData.status == 'waiting' || state.masterData.status == 'finish'" type="primary" @click="editApprovalSheet(row)">修改</el-button>
<el-button
:disabled="state.masterData.status == 'waiting' || state.masterData.status == 'finish'"
type="primary"
@click="editApprovalSheet(row)"
>修改</el-button
>
</template>
</el-table-column>
</el-table>
@ -69,8 +96,7 @@
<el-row :gutter="20">
<el-col :span="12">
<el-form-item label="预计使用日期" prop="dateService">
<el-date-picker v-model="formData.dateService" type="date" placeholder="选择预计使用日期"
format="YYYY-MM-DD" />
<el-date-picker v-model="formData.dateService" type="date" placeholder="选择预计使用日期" format="YYYY-MM-DD" />
</el-form-item>
</el-col>
</el-row>
@ -92,7 +118,12 @@
<script setup name="billofQuantities">
import { ref, reactive, onMounted, computed, getCurrentInstance } from 'vue';
import { obtainMasterDataList, totalsupplyplan, totalSupplyplanDetails, materialChangeSupplyplan } from '@/api/materials/overallPlanMaterialSupply/index';
import {
obtainMasterDataList,
totalsupplyplan,
totalSupplyplanDetails,
materialChangeSupplyplan
} from '@/api/materials/overallPlanMaterialSupply/index';
import { useUserStoreHook } from '@/store/modules/user';
const userStore = useUserStoreHook();
const currentProject = computed(() => userStore.selectedProject);
@ -115,7 +146,6 @@ const state = reactive({
},
// 主id
masterData: {}
});
// 表单数据
const formData = reactive({
@ -152,9 +182,7 @@ const formRules = reactive({
{ required: true, message: '请输入数量', trigger: 'blur' },
{ type: 'number', min: 0, message: '数量不能为负数', trigger: 'blur' }
],
compileDate: [
{ required: true, message: '请选择编制日期', trigger: 'change' }
]
compileDate: [{ required: true, message: '请选择编制日期', trigger: 'change' }]
});
// 获取主表数据
async function getMasterDataList() {
@ -186,7 +214,6 @@ async function getMasterDataList() {
// 根据实际业务逻辑处理有list的情况
state.tableData = [];
}
} catch (error) {
console.error('获取主数据列表失败:', error);
// 错误情况下给默认值,避免页面出错
@ -203,7 +230,7 @@ async function totalSupplyplanDetail(id) {
if (result?.code === 200) {
const detailData = result.data || {};
// 1. 清空原有表单数据
Object.keys(formData).forEach(key => {
Object.keys(formData).forEach((key) => {
formData[key] = undefined;
});
// 2. 处理日期格式假设接口返回的是Date对象或ISO字符串
@ -234,7 +261,7 @@ async function totalSupplyplanDetail(id) {
// 修改
function editApprovalSheet(row) {
console.log(row);
totalSupplyplanDetail(row.id)
totalSupplyplanDetail(row.id);
visible.value = true;
}
// 提交表单
@ -243,7 +270,6 @@ const handleSubmit = async () => {
// 表单验证
await formRef.value.validate();
// 触发提交事件
console.log('submitData:', formData);
editMaterialSupply(formData);
handleClose();
} catch (error) {
@ -254,9 +280,10 @@ const handleSubmit = async () => {
};
// 修改物资
function editMaterialSupply(formData) {
materialChangeSupplyplan(formData).then(res => {
materialChangeSupplyplan(formData).then((res) => {
if (res.code === 200) {
ElMessage.success('修改成功');
getMasterDataList();
} else {
ElMessage.error('修改失败');
}
@ -267,7 +294,7 @@ function editMaterialSupply(formData) {
const handleClose = () => {
visible.value = false;
// 清空表单数据
Object.keys(formData).forEach(key => {
Object.keys(formData).forEach((key) => {
formData[key] = undefined;
});
// 重置表单验证状态
@ -297,7 +324,7 @@ function lookApprovalFlow() {
}
onMounted(() => {
getMasterDataList();
})
});
</script>
<style>
.overall-plan-material-supply {