This commit is contained in:
2025-08-18 09:31:19 +08:00
4 changed files with 319 additions and 317 deletions

View File

@ -90,14 +90,7 @@
<el-button link type="primary" icon="Edit" @click="handleUpdate(scope.row)" v-hasPermi="['formalities:formalitiesAreConsolidated:edit']"
>修改</el-button
>
<el-button
link
type="primary"
icon="Upload"
@click="handleUpload(scope.row)"
v-hasPermi="['formalities:formalitiesAreConsolidated:edit']"
>上传</el-button
>
<el-button link type="primary" icon="Upload" @click="handleUpload(scope.row)">上传</el-button>
<el-button
link
type="primary"

View File

@ -6,7 +6,14 @@
<h2 class="text-2xl font-bold flex items-center"><i class="el-icon-user-circle mr-3"></i>人员配置</h2>
<p class="text-blue-100 mt-2 opacity-90">请配置采购专员信息</p>
<!-- <span class="text-red-300">*</span> 为必填项 -->
<el-button @click="isDisabled = false" class="px-8 py-2.5 transition-all duration-300 font-medium" v-if="isDisabled"> 点击编辑 </el-button>
<el-button
@click="isDisabled = false"
class="px-8 py-2.5 transition-all duration-300 font-medium"
v-if="isDisabled"
v-hasPermi="['cailiaoshebei:purchaseUser:addOrUpdate']"
>
点击编辑
</el-button>
</div>
<!-- 表单内容区域 -->
@ -31,6 +38,7 @@
@click="submitForm"
icon="Check"
class="px-8 py-2.5 transition-all duration-300 transform hover:scale-105 bg-blue-500 hover:bg-blue-600 text-white font-medium"
v-hasPermi="['cailiaoshebei:purchaseUser:addOrUpdate']"
>
确认提交
</el-button>

View File

@ -7,10 +7,26 @@
<template #header>
<el-row :gutter="10" class="mb8">
<el-col :span="1.5" :offset="0"
><el-button type="primary" size="default" @click="handleAdd" icon="FolderAdd" plain>新增</el-button></el-col
><el-button
type="primary"
v-hasPermi="['cailiaoshebei:materialbatchdemandplan:add']"
size="default"
@click="handleAdd"
icon="FolderAdd"
plain
>新增</el-button
></el-col
>
<el-col :span="1.5" :offset="0"
><el-button type="danger" size="default" @click="handleDeleteBatch" icon="FolderDelete" plain>删除</el-button></el-col
><el-button
type="danger"
size="default"
v-hasPermi="['cailiaoshebei:batchPlan:remove']"
@click="handleDeleteBatch"
icon="FolderDelete"
plain
>删除</el-button
></el-col
>
</el-row>
</template>
@ -159,17 +175,7 @@
</template>
<script setup name="Cailiaoshebei" lang="ts">
import {
listCailiaoshebei,
getCailiaoshebei,
delCailiaoshebei,
addCailiaoshebei,
updateCailiaoshebei,
listBatch,
getBatch,
delBatch,
listSelectCailiaoshebei
} from '@/api/materials/batchPlan';
import { getCailiaoshebei, updateCailiaoshebei, listBatch, getBatch, delBatch, listSelectCailiaoshebei } from '@/api/materials/batchPlan';
import { CailiaoshebeiVO, CailiaoshebeiQuery, CailiaoshebeiForm } from '@/api/materials/batchPlan/types';
import { useUserStoreHook } from '@/store/modules/user';
@ -374,23 +380,6 @@ const handleUpdata = () => {
dialog.title = '修改物资-需求';
};
/** 提交按钮 */
const submitForm = async () => {
buttonLoading.value = true;
cailiaoshebeiList.value.forEach((item) => {
if (item.id) {
delete item.id;
}
});
await addCailiaoshebei({
addDataList: cailiaoshebeiList.value,
batchNumber: form.value.batchNumber,
projectId: currentProject.value?.id
} as any).finally(() => (buttonLoading.value = false));
proxy?.$modal.msgSuccess('操作成功');
dialog.visible = false;
};
/** 提交数据 */
const submitTransferForm = async () => {
const result = validateAndClean(form.value.planList);

View File

@ -1,20 +1,19 @@
<template>
<div class="p-5">
<el-card class="mb-5">
<el-button type="primary" icon="Plus" @click="handleAdd"
class="transition-all duration-200 hover:shadow-md">
新增
</el-button>
<el-button icon="Refresh" @click="refreshData" class="transition-all duration-200 hover:shadow-md">
刷新
</el-button>
<el-button type="primary" icon="Plus" @click="handleAdd" class="transition-all duration-200 hover:shadow-md"> 新增 </el-button>
<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" stripe
<el-table
v-loading="loading"
:data="tableData"
stripe
:header-cell-style="{ 'background-color': '#f5f7fa', 'font-weight': 'bold' }"
style="width: 100%; margin-bottom: 20px; height: calc(100vh - 305px)"
:row-class-name="tableRowClassName">
:row-class-name="tableRowClassName"
>
<!-- 基础信息列 -->
<el-table-column prop="id" label="ID" width="180" align="center"></el-table-column>
<el-table-column prop="batch" label="批次" align="center"></el-table-column>
@ -52,14 +51,12 @@
<el-table-column prop="actualAcceptance" label="实际验收数量" min-width="120" align="right"></el-table-column>
<el-table-column prop="differenceQuantity" label="差异量" min-width="100" align="right">
<template #default="scope">
<span
:class="scope.row.differenceQuantity && parseFloat(scope.row.differenceQuantity) !== 0 ? 'text-red-500' : ''">
<span :class="scope.row.differenceQuantity && parseFloat(scope.row.differenceQuantity) !== 0 ? 'text-red-500' : ''">
{{ scope.row.differenceQuantity || '-' }}
</span>
</template>
</el-table-column>
<el-table-column prop="dhDifferenceQuantity" label="到货差异量" min-width="120"
align="right"></el-table-column>
<el-table-column prop="dhDifferenceQuantity" label="到货差异量" min-width="120" align="right"></el-table-column>
<!-- 金额相关列 -->
<el-table-column prop="cargoAmount" label="货物金额" min-width="120" align="right">
@ -140,24 +137,25 @@
<!-- 操作列 -->
<el-table-column label="操作" min-width="120" align="center" fixed="right">
<template #default="scope">
<el-button size="small" icon="Edit" @click="handleEdit2(scope.row)"
class="text-blue-600 hover:text-blue-800 transition-colors"></el-button>
<el-button size="small" icon="Delete" @click="handleDelete2(scope.row)"
class="text-red-600 hover:text-red-800 transition-colors"></el-button>
<el-button
size="small"
icon="Edit"
@click="handleEdit2(scope.row)"
class="text-blue-600 hover:text-blue-800 transition-colors"
></el-button>
<el-button
size="small"
icon="Delete"
@click="handleDelete2(scope.row)"
class="text-red-600 hover:text-red-800 transition-colors"
></el-button>
</template>
</el-table-column>
</el-table>
<!-- 分页 -->
<div class="flex flex-wrap items-center justify-between p-4 border-t gap-4">
<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" small></el-pagination>
</div>
{{ total }} 条记录当前显示第 {{ (currentPage - 1) * pageSize + 1 }} {{ Math.min(currentPage * pageSize, total) }}
</div>
<el-dialog v-model="dialogVisible2" :title="dialogType2 === 'addSon' ? '新增采购信息' : '编辑采购信息'" :width="dialogWidth"
:fullscreen="isFullscreen" :close-on-click-modal="false" :before-close="handleClose" destroy-on-close>
@ -373,7 +371,7 @@
</template>
<script setup>
import { ref, reactive, onMounted, toRaw, getCurrentInstance } from 'vue';
import { materialsUsageDetails, materialsSonAdd, materialsSonDel, materialsSonEdit } from "@/api/materials/usageMaterials/index";
import { materialsUsageDetails, materialsSonAdd, materialsSonDel, materialsSonEdit } from '@/api/materials/usageMaterials/index';
import { routerRename } from '@/api/air';
const { proxy } = getCurrentInstance();
const dialogVisible2 = ref(false);
@ -383,7 +381,7 @@ const currentRow2 = ref(null);
const tableData = ref([]);
const loading = ref(false);
const submitLoading = ref(false);
const routeParams = ref({})
const routeParams = ref({});
const currentPage = ref(1);
const total = ref(0);
const pageSize = ref(10);
@ -429,14 +427,14 @@ const handleAdd = () => {
dialogVisible2.value = true;
dialogType2.value = 'addSon';
resetForm();
}
};
const resetForm = () => {
if (formRef.value) {
formRef.value.resetFields();
}
// 重置表单数据
Object.keys(form).forEach(key => {
Object.keys(form).forEach((key) => {
form[key] = '';
});
@ -451,7 +449,7 @@ const handleEdit2 = (row) => {
resetForm();
// 填充表单数据
Object.keys(form).forEach(key => {
Object.keys(form).forEach((key) => {
if (row.hasOwnProperty(key)) {
form[key] = row[key];
}
@ -461,22 +459,20 @@ const handleEdit2 = (row) => {
};
const handleDelete2 = (row) => {
currentRow2.value = row;
ElMessageBox.confirm(
'确定要删除这条记录吗?此操作不可撤销,请谨慎操作',
'提示',
{
ElMessageBox.confirm('确定要删除这条记录吗?此操作不可撤销,请谨慎操作', '提示', {
confirmButtonText: '确认',
cancelButtonText: '取消',
type: 'warning',
}
).then(() => {
type: 'warning'
})
.then(() => {
confirmDelete();
}).catch(() => {
})
.catch(() => {
ElMessage({
type: 'info',
message: '已取消删除',
})
})
message: '已取消删除'
});
});
};
const confirmDelete = async () => {
if (!currentRow2.value) return;
@ -484,7 +480,7 @@ const confirmDelete = async () => {
deleteLoading.value = true;
try {
// 模拟API请求
const res = await materialsSonDel(currentRow2.value.id)
const res = await materialsSonDel(currentRow2.value.id);
const { code } = res;
if (code === 200) {
ElMessage.success('删除成功');
@ -514,15 +510,15 @@ const handleSubmit = async () => {
// 如果是新增清除id
if (dialogType2.value === 'addSon') {
submitData.physicalsupplyId = routeParams.value.id
const res = await materialsSonAdd(submitData)
submitData.physicalsupplyId = routeParams.value.id;
const res = await materialsSonAdd(submitData);
const { code } = res;
if (code === 200) {
ElMessage.success('新增成功');
materialsUsageDetails1();
}
} else {
const res = await materialsSonEdit(submitData)
const res = await materialsSonEdit(submitData);
const { code } = res;
if (code === 200) {
ElMessage.success('保存成功');
@ -539,6 +535,20 @@ const handleSubmit = async () => {
}
};
const materialsUsageDetails1 = () => {
<<<<<<< HEAD
loading.value = true;
materialsUsageDetails({ physicalsupplyId: routeParams.value.id })
.then((res) => {
tableData.value = res.rows;
})
.catch(() => {
loading.value = false;
})
.finally(() => {
loading.value = false;
});
};
=======
loading.value = true;
materialsUsageDetails({ physicalsupplyId: routeParams.value.id }).then(res => {
tableData.value = res.rows
@ -548,18 +558,21 @@ const materialsUsageDetails1 = () => {
loading.value = false;
})
}
>>>>>>> 8f9972343a005ce4424fbf2e3b2388060c854b5f
// 格式化日期
const formatDate = (dateString) => {
if (!dateString) return '-';
const date = new Date(dateString);
return date.toLocaleString('zh-CN', {
return date
.toLocaleString('zh-CN', {
year: 'numeric',
month: '2-digit',
day: '2-digit',
hour: '2-digit',
minute: '2-digit',
second: '2-digit'
}).replace(',', ' ');
})
.replace(',', ' ');
};
function handleCancel() {
dialogVisible2.value = false;
@ -569,11 +582,10 @@ const refreshData = () => {
materialsUsageDetails1();
ElMessage.success('数据已刷新');
};
function handleSizeChange() { }
function handleSizeChange() {}
onMounted(() => {
routeParams.value = proxy.$route.query;
console.log('routeParams.value', routeParams.value);
materialsUsageDetails1();
})
});
</script>