优化
This commit is contained in:
@ -5,7 +5,7 @@ VITE_APP_TITLE = 新能源项目管理平台
|
|||||||
VITE_APP_ENV = 'development'
|
VITE_APP_ENV = 'development'
|
||||||
|
|
||||||
# 开发环境
|
# 开发环境
|
||||||
VITE_APP_BASE_API = 'http://192.168.110.159:8898'
|
VITE_APP_BASE_API = 'http://192.168.110.180:8898'
|
||||||
|
|
||||||
# 无人机接口地址
|
# 无人机接口地址
|
||||||
|
|
||||||
|
@ -2,6 +2,8 @@
|
|||||||
<div class="overall-plan-material-supply">
|
<div class="overall-plan-material-supply">
|
||||||
<!-- tabPosition="left" -->
|
<!-- tabPosition="left" -->
|
||||||
<el-card shadow="always">
|
<el-card shadow="always">
|
||||||
|
<template #header>
|
||||||
|
<el-row :gutter="10" class="mb8">
|
||||||
<el-form :inline="true">
|
<el-form :inline="true">
|
||||||
<el-form-item v-if="state.masterData.status == 'draft'">
|
<el-form-item v-if="state.masterData.status == 'draft'">
|
||||||
<el-button type="primary" icon="edit" @click="clickApprovalSheet1()">审批</el-button>
|
<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-button icon="view" @click="lookApprovalFlow()" type="warning">查看流程</el-button>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
</el-form>
|
</el-form>
|
||||||
|
<right-toolbar @queryTable="getMasterDataList"></right-toolbar>
|
||||||
|
</el-row>
|
||||||
|
</template>
|
||||||
</el-card>
|
</el-card>
|
||||||
<el-table :data="state.tableData" v-loading="state.loading.list" stripe
|
<el-table
|
||||||
style="width: 100%; margin-bottom: 20px; height: calc(100vh - 230px)" row-key="id" border>
|
: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="num" label="编号" />
|
||||||
<el-table-column prop="name" label="工程或费用名称" />
|
<el-table-column prop="name" label="工程或费用名称" />
|
||||||
<el-table-column prop="unit" 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 prop="remark" label="备注" />
|
||||||
<el-table-column label="操作">
|
<el-table-column label="操作">
|
||||||
<template #default="{ row }">
|
<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>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
</el-table>
|
</el-table>
|
||||||
@ -69,8 +96,7 @@
|
|||||||
<el-row :gutter="20">
|
<el-row :gutter="20">
|
||||||
<el-col :span="12">
|
<el-col :span="12">
|
||||||
<el-form-item label="预计使用日期" prop="dateService">
|
<el-form-item label="预计使用日期" prop="dateService">
|
||||||
<el-date-picker v-model="formData.dateService" type="date" placeholder="选择预计使用日期"
|
<el-date-picker v-model="formData.dateService" type="date" placeholder="选择预计使用日期" format="YYYY-MM-DD" />
|
||||||
format="YYYY-MM-DD" />
|
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
</el-col>
|
</el-col>
|
||||||
</el-row>
|
</el-row>
|
||||||
@ -92,7 +118,12 @@
|
|||||||
|
|
||||||
<script setup name="billofQuantities">
|
<script setup name="billofQuantities">
|
||||||
import { ref, reactive, onMounted, computed, getCurrentInstance } from 'vue';
|
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';
|
import { useUserStoreHook } from '@/store/modules/user';
|
||||||
const userStore = useUserStoreHook();
|
const userStore = useUserStoreHook();
|
||||||
const currentProject = computed(() => userStore.selectedProject);
|
const currentProject = computed(() => userStore.selectedProject);
|
||||||
@ -115,7 +146,6 @@ const state = reactive({
|
|||||||
},
|
},
|
||||||
// 主id
|
// 主id
|
||||||
masterData: {}
|
masterData: {}
|
||||||
|
|
||||||
});
|
});
|
||||||
// 表单数据
|
// 表单数据
|
||||||
const formData = reactive({
|
const formData = reactive({
|
||||||
@ -152,9 +182,7 @@ const formRules = reactive({
|
|||||||
{ required: true, message: '请输入数量', trigger: 'blur' },
|
{ required: true, message: '请输入数量', trigger: 'blur' },
|
||||||
{ type: 'number', min: 0, message: '数量不能为负数', trigger: 'blur' }
|
{ type: 'number', min: 0, message: '数量不能为负数', trigger: 'blur' }
|
||||||
],
|
],
|
||||||
compileDate: [
|
compileDate: [{ required: true, message: '请选择编制日期', trigger: 'change' }]
|
||||||
{ required: true, message: '请选择编制日期', trigger: 'change' }
|
|
||||||
]
|
|
||||||
});
|
});
|
||||||
// 获取主表数据
|
// 获取主表数据
|
||||||
async function getMasterDataList() {
|
async function getMasterDataList() {
|
||||||
@ -186,7 +214,6 @@ async function getMasterDataList() {
|
|||||||
// 根据实际业务逻辑处理有list的情况
|
// 根据实际业务逻辑处理有list的情况
|
||||||
state.tableData = [];
|
state.tableData = [];
|
||||||
}
|
}
|
||||||
|
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error('获取主数据列表失败:', error);
|
console.error('获取主数据列表失败:', error);
|
||||||
// 错误情况下给默认值,避免页面出错
|
// 错误情况下给默认值,避免页面出错
|
||||||
@ -203,7 +230,7 @@ async function totalSupplyplanDetail(id) {
|
|||||||
if (result?.code === 200) {
|
if (result?.code === 200) {
|
||||||
const detailData = result.data || {};
|
const detailData = result.data || {};
|
||||||
// 1. 清空原有表单数据
|
// 1. 清空原有表单数据
|
||||||
Object.keys(formData).forEach(key => {
|
Object.keys(formData).forEach((key) => {
|
||||||
formData[key] = undefined;
|
formData[key] = undefined;
|
||||||
});
|
});
|
||||||
// 2. 处理日期格式(假设接口返回的是Date对象或ISO字符串)
|
// 2. 处理日期格式(假设接口返回的是Date对象或ISO字符串)
|
||||||
@ -234,7 +261,7 @@ async function totalSupplyplanDetail(id) {
|
|||||||
// 修改
|
// 修改
|
||||||
function editApprovalSheet(row) {
|
function editApprovalSheet(row) {
|
||||||
console.log(row);
|
console.log(row);
|
||||||
totalSupplyplanDetail(row.id)
|
totalSupplyplanDetail(row.id);
|
||||||
visible.value = true;
|
visible.value = true;
|
||||||
}
|
}
|
||||||
// 提交表单
|
// 提交表单
|
||||||
@ -243,7 +270,6 @@ const handleSubmit = async () => {
|
|||||||
// 表单验证
|
// 表单验证
|
||||||
await formRef.value.validate();
|
await formRef.value.validate();
|
||||||
// 触发提交事件
|
// 触发提交事件
|
||||||
console.log('submitData:', formData);
|
|
||||||
editMaterialSupply(formData);
|
editMaterialSupply(formData);
|
||||||
handleClose();
|
handleClose();
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
@ -254,9 +280,10 @@ const handleSubmit = async () => {
|
|||||||
};
|
};
|
||||||
// 修改物资
|
// 修改物资
|
||||||
function editMaterialSupply(formData) {
|
function editMaterialSupply(formData) {
|
||||||
materialChangeSupplyplan(formData).then(res => {
|
materialChangeSupplyplan(formData).then((res) => {
|
||||||
if (res.code === 200) {
|
if (res.code === 200) {
|
||||||
ElMessage.success('修改成功');
|
ElMessage.success('修改成功');
|
||||||
|
getMasterDataList();
|
||||||
} else {
|
} else {
|
||||||
ElMessage.error('修改失败');
|
ElMessage.error('修改失败');
|
||||||
}
|
}
|
||||||
@ -267,7 +294,7 @@ function editMaterialSupply(formData) {
|
|||||||
const handleClose = () => {
|
const handleClose = () => {
|
||||||
visible.value = false;
|
visible.value = false;
|
||||||
// 清空表单数据
|
// 清空表单数据
|
||||||
Object.keys(formData).forEach(key => {
|
Object.keys(formData).forEach((key) => {
|
||||||
formData[key] = undefined;
|
formData[key] = undefined;
|
||||||
});
|
});
|
||||||
// 重置表单验证状态
|
// 重置表单验证状态
|
||||||
@ -297,18 +324,18 @@ function lookApprovalFlow() {
|
|||||||
}
|
}
|
||||||
onMounted(() => {
|
onMounted(() => {
|
||||||
getMasterDataList();
|
getMasterDataList();
|
||||||
})
|
});
|
||||||
</script>
|
</script>
|
||||||
<style>
|
<style>
|
||||||
.overall-plan-material-supply {
|
.overall-plan-material-supply {
|
||||||
padding: 20px;
|
padding: 20px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.space-y-4>.el-row {
|
.space-y-4 > .el-row {
|
||||||
margin-bottom: 16px;
|
margin-bottom: 16px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.space-y-4>.el-row:last-child {
|
.space-y-4 > .el-row:last-child {
|
||||||
margin-bottom: 0;
|
margin-bottom: 0;
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
|
Reference in New Issue
Block a user