优化
This commit is contained in:
@ -90,14 +90,7 @@
|
|||||||
<el-button link type="primary" icon="Edit" @click="handleUpdate(scope.row)" v-hasPermi="['formalities:formalitiesAreConsolidated:edit']"
|
<el-button link type="primary" icon="Edit" @click="handleUpdate(scope.row)" v-hasPermi="['formalities:formalitiesAreConsolidated:edit']"
|
||||||
>修改</el-button
|
>修改</el-button
|
||||||
>
|
>
|
||||||
<el-button
|
<el-button link type="primary" icon="Upload" @click="handleUpload(scope.row)">上传</el-button>
|
||||||
link
|
|
||||||
type="primary"
|
|
||||||
icon="Upload"
|
|
||||||
@click="handleUpload(scope.row)"
|
|
||||||
v-hasPermi="['formalities:formalitiesAreConsolidated:edit']"
|
|
||||||
>上传</el-button
|
|
||||||
>
|
|
||||||
<el-button
|
<el-button
|
||||||
link
|
link
|
||||||
type="primary"
|
type="primary"
|
||||||
|
@ -6,7 +6,14 @@
|
|||||||
<h2 class="text-2xl font-bold flex items-center"><i class="el-icon-user-circle mr-3"></i>人员配置</h2>
|
<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>
|
<p class="text-blue-100 mt-2 opacity-90">请配置采购专员信息</p>
|
||||||
<!-- ,带 <span class="text-red-300">*</span> 为必填项 -->
|
<!-- ,带 <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>
|
</div>
|
||||||
|
|
||||||
<!-- 表单内容区域 -->
|
<!-- 表单内容区域 -->
|
||||||
@ -31,6 +38,7 @@
|
|||||||
@click="submitForm"
|
@click="submitForm"
|
||||||
icon="Check"
|
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"
|
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>
|
</el-button>
|
||||||
|
@ -7,10 +7,26 @@
|
|||||||
<template #header>
|
<template #header>
|
||||||
<el-row :gutter="10" class="mb8">
|
<el-row :gutter="10" class="mb8">
|
||||||
<el-col :span="1.5" :offset="0"
|
<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-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>
|
</el-row>
|
||||||
</template>
|
</template>
|
||||||
@ -159,17 +175,7 @@
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script setup name="Cailiaoshebei" lang="ts">
|
<script setup name="Cailiaoshebei" lang="ts">
|
||||||
import {
|
import { getCailiaoshebei, updateCailiaoshebei, listBatch, getBatch, delBatch, listSelectCailiaoshebei } from '@/api/materials/batchPlan';
|
||||||
listCailiaoshebei,
|
|
||||||
getCailiaoshebei,
|
|
||||||
delCailiaoshebei,
|
|
||||||
addCailiaoshebei,
|
|
||||||
updateCailiaoshebei,
|
|
||||||
listBatch,
|
|
||||||
getBatch,
|
|
||||||
delBatch,
|
|
||||||
listSelectCailiaoshebei
|
|
||||||
} from '@/api/materials/batchPlan';
|
|
||||||
import { CailiaoshebeiVO, CailiaoshebeiQuery, CailiaoshebeiForm } from '@/api/materials/batchPlan/types';
|
import { CailiaoshebeiVO, CailiaoshebeiQuery, CailiaoshebeiForm } from '@/api/materials/batchPlan/types';
|
||||||
import { useUserStoreHook } from '@/store/modules/user';
|
import { useUserStoreHook } from '@/store/modules/user';
|
||||||
|
|
||||||
@ -374,23 +380,6 @@ const handleUpdata = () => {
|
|||||||
dialog.title = '修改物资-需求';
|
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 submitTransferForm = async () => {
|
||||||
const result = validateAndClean(form.value.planList);
|
const result = validateAndClean(form.value.planList);
|
||||||
|
@ -1,20 +1,19 @@
|
|||||||
<template>
|
<template>
|
||||||
<div class="p-5">
|
<div class="p-5">
|
||||||
<el-card class="mb-5">
|
<el-card class="mb-5">
|
||||||
<el-button type="primary" icon="Plus" @click="handleAdd"
|
<el-button type="primary" icon="Plus" @click="handleAdd" class="transition-all duration-200 hover:shadow-md"> 新增 </el-button>
|
||||||
class="transition-all duration-200 hover:shadow-md">
|
<el-button icon="Refresh" @click="refreshData" class="transition-all duration-200 hover:shadow-md"> 刷新 </el-button>
|
||||||
新增
|
|
||||||
</el-button>
|
|
||||||
<el-button icon="Refresh" @click="refreshData" class="transition-all duration-200 hover:shadow-md">
|
|
||||||
刷新
|
|
||||||
</el-button>
|
|
||||||
</el-card>
|
</el-card>
|
||||||
<div class="bg-white rounded-lg shadow-sm overflow-hidden transition-all duration-300 hover:shadow-md">
|
<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' }"
|
:header-cell-style="{ 'background-color': '#f5f7fa', 'font-weight': 'bold' }"
|
||||||
style="width: 100%; margin-bottom: 20px; height: calc(100vh - 305px)"
|
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="id" label="ID" width="180" align="center"></el-table-column>
|
||||||
<el-table-column prop="batch" label="批次" 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="actualAcceptance" label="实际验收数量" min-width="120" align="right"></el-table-column>
|
||||||
<el-table-column prop="differenceQuantity" label="差异量" min-width="100" align="right">
|
<el-table-column prop="differenceQuantity" label="差异量" min-width="100" align="right">
|
||||||
<template #default="scope">
|
<template #default="scope">
|
||||||
<span
|
<span :class="scope.row.differenceQuantity && parseFloat(scope.row.differenceQuantity) !== 0 ? 'text-red-500' : ''">
|
||||||
:class="scope.row.differenceQuantity && parseFloat(scope.row.differenceQuantity) !== 0 ? 'text-red-500' : ''">
|
|
||||||
{{ scope.row.differenceQuantity || '-' }}
|
{{ scope.row.differenceQuantity || '-' }}
|
||||||
</span>
|
</span>
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
<el-table-column prop="dhDifferenceQuantity" label="到货差异量" min-width="120"
|
<el-table-column prop="dhDifferenceQuantity" label="到货差异量" min-width="120" align="right"></el-table-column>
|
||||||
align="right"></el-table-column>
|
|
||||||
|
|
||||||
<!-- 金额相关列 -->
|
<!-- 金额相关列 -->
|
||||||
<el-table-column prop="cargoAmount" label="货物金额" min-width="120" align="right">
|
<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">
|
<el-table-column label="操作" min-width="120" align="center" fixed="right">
|
||||||
<template #default="scope">
|
<template #default="scope">
|
||||||
<el-button size="small" icon="Edit" @click="handleEdit2(scope.row)"
|
<el-button
|
||||||
class="text-blue-600 hover:text-blue-800 transition-colors"></el-button>
|
size="small"
|
||||||
<el-button size="small" icon="Delete" @click="handleDelete2(scope.row)"
|
icon="Edit"
|
||||||
class="text-red-600 hover:text-red-800 transition-colors"></el-button>
|
@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>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
</el-table>
|
</el-table>
|
||||||
<!-- 分页 -->
|
<!-- 分页 -->
|
||||||
<div class="flex flex-wrap items-center justify-between p-4 border-t gap-4">
|
<div class="flex flex-wrap items-center justify-between p-4 border-t gap-4">
|
||||||
<div class="text-gray-500 text-sm">
|
<div class="text-gray-500 text-sm">
|
||||||
共 {{ total }} 条记录,当前显示第 {{ (currentPage - 1) * pageSize + 1 }} 至 {{
|
共 {{ total }} 条记录,当前显示第 {{ (currentPage - 1) * pageSize + 1 }} 至 {{ Math.min(currentPage * pageSize, total) }} 条
|
||||||
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>
|
|
||||||
</div>
|
</div>
|
||||||
<el-dialog v-model="dialogVisible2" :title="dialogType2 === 'addSon' ? '新增采购信息' : '编辑采购信息'" :width="dialogWidth"
|
<el-dialog v-model="dialogVisible2" :title="dialogType2 === 'addSon' ? '新增采购信息' : '编辑采购信息'" :width="dialogWidth"
|
||||||
:fullscreen="isFullscreen" :close-on-click-modal="false" :before-close="handleClose" destroy-on-close>
|
:fullscreen="isFullscreen" :close-on-click-modal="false" :before-close="handleClose" destroy-on-close>
|
||||||
@ -373,7 +371,7 @@
|
|||||||
</template>
|
</template>
|
||||||
<script setup>
|
<script setup>
|
||||||
import { ref, reactive, onMounted, toRaw, getCurrentInstance } from 'vue';
|
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';
|
import { routerRename } from '@/api/air';
|
||||||
const { proxy } = getCurrentInstance();
|
const { proxy } = getCurrentInstance();
|
||||||
const dialogVisible2 = ref(false);
|
const dialogVisible2 = ref(false);
|
||||||
@ -383,7 +381,7 @@ const currentRow2 = ref(null);
|
|||||||
const tableData = ref([]);
|
const tableData = ref([]);
|
||||||
const loading = ref(false);
|
const loading = ref(false);
|
||||||
const submitLoading = ref(false);
|
const submitLoading = ref(false);
|
||||||
const routeParams = ref({})
|
const routeParams = ref({});
|
||||||
const currentPage = ref(1);
|
const currentPage = ref(1);
|
||||||
const total = ref(0);
|
const total = ref(0);
|
||||||
const pageSize = ref(10);
|
const pageSize = ref(10);
|
||||||
@ -429,14 +427,14 @@ const handleAdd = () => {
|
|||||||
dialogVisible2.value = true;
|
dialogVisible2.value = true;
|
||||||
dialogType2.value = 'addSon';
|
dialogType2.value = 'addSon';
|
||||||
resetForm();
|
resetForm();
|
||||||
}
|
};
|
||||||
const resetForm = () => {
|
const resetForm = () => {
|
||||||
if (formRef.value) {
|
if (formRef.value) {
|
||||||
formRef.value.resetFields();
|
formRef.value.resetFields();
|
||||||
}
|
}
|
||||||
|
|
||||||
// 重置表单数据
|
// 重置表单数据
|
||||||
Object.keys(form).forEach(key => {
|
Object.keys(form).forEach((key) => {
|
||||||
form[key] = '';
|
form[key] = '';
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -451,7 +449,7 @@ const handleEdit2 = (row) => {
|
|||||||
resetForm();
|
resetForm();
|
||||||
|
|
||||||
// 填充表单数据
|
// 填充表单数据
|
||||||
Object.keys(form).forEach(key => {
|
Object.keys(form).forEach((key) => {
|
||||||
if (row.hasOwnProperty(key)) {
|
if (row.hasOwnProperty(key)) {
|
||||||
form[key] = row[key];
|
form[key] = row[key];
|
||||||
}
|
}
|
||||||
@ -461,22 +459,20 @@ const handleEdit2 = (row) => {
|
|||||||
};
|
};
|
||||||
const handleDelete2 = (row) => {
|
const handleDelete2 = (row) => {
|
||||||
currentRow2.value = row;
|
currentRow2.value = row;
|
||||||
ElMessageBox.confirm(
|
ElMessageBox.confirm('确定要删除这条记录吗?此操作不可撤销,请谨慎操作', '提示', {
|
||||||
'确定要删除这条记录吗?此操作不可撤销,请谨慎操作',
|
|
||||||
'提示',
|
|
||||||
{
|
|
||||||
confirmButtonText: '确认',
|
confirmButtonText: '确认',
|
||||||
cancelButtonText: '取消',
|
cancelButtonText: '取消',
|
||||||
type: 'warning',
|
type: 'warning'
|
||||||
}
|
})
|
||||||
).then(() => {
|
.then(() => {
|
||||||
confirmDelete();
|
confirmDelete();
|
||||||
}).catch(() => {
|
})
|
||||||
|
.catch(() => {
|
||||||
ElMessage({
|
ElMessage({
|
||||||
type: 'info',
|
type: 'info',
|
||||||
message: '已取消删除',
|
message: '已取消删除'
|
||||||
})
|
});
|
||||||
})
|
});
|
||||||
};
|
};
|
||||||
const confirmDelete = async () => {
|
const confirmDelete = async () => {
|
||||||
if (!currentRow2.value) return;
|
if (!currentRow2.value) return;
|
||||||
@ -484,7 +480,7 @@ const confirmDelete = async () => {
|
|||||||
deleteLoading.value = true;
|
deleteLoading.value = true;
|
||||||
try {
|
try {
|
||||||
// 模拟API请求
|
// 模拟API请求
|
||||||
const res = await materialsSonDel(currentRow2.value.id)
|
const res = await materialsSonDel(currentRow2.value.id);
|
||||||
const { code } = res;
|
const { code } = res;
|
||||||
if (code === 200) {
|
if (code === 200) {
|
||||||
ElMessage.success('删除成功');
|
ElMessage.success('删除成功');
|
||||||
@ -514,15 +510,15 @@ const handleSubmit = async () => {
|
|||||||
|
|
||||||
// 如果是新增,清除id
|
// 如果是新增,清除id
|
||||||
if (dialogType2.value === 'addSon') {
|
if (dialogType2.value === 'addSon') {
|
||||||
submitData.physicalsupplyId = routeParams.value.id
|
submitData.physicalsupplyId = routeParams.value.id;
|
||||||
const res = await materialsSonAdd(submitData)
|
const res = await materialsSonAdd(submitData);
|
||||||
const { code } = res;
|
const { code } = res;
|
||||||
if (code === 200) {
|
if (code === 200) {
|
||||||
ElMessage.success('新增成功');
|
ElMessage.success('新增成功');
|
||||||
materialsUsageDetails1();
|
materialsUsageDetails1();
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
const res = await materialsSonEdit(submitData)
|
const res = await materialsSonEdit(submitData);
|
||||||
const { code } = res;
|
const { code } = res;
|
||||||
if (code === 200) {
|
if (code === 200) {
|
||||||
ElMessage.success('保存成功');
|
ElMessage.success('保存成功');
|
||||||
@ -539,6 +535,20 @@ const handleSubmit = async () => {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
const materialsUsageDetails1 = () => {
|
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;
|
loading.value = true;
|
||||||
materialsUsageDetails({ physicalsupplyId: routeParams.value.id }).then(res => {
|
materialsUsageDetails({ physicalsupplyId: routeParams.value.id }).then(res => {
|
||||||
tableData.value = res.rows
|
tableData.value = res.rows
|
||||||
@ -548,18 +558,21 @@ const materialsUsageDetails1 = () => {
|
|||||||
loading.value = false;
|
loading.value = false;
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
>>>>>>> 8f9972343a005ce4424fbf2e3b2388060c854b5f
|
||||||
// 格式化日期
|
// 格式化日期
|
||||||
const formatDate = (dateString) => {
|
const formatDate = (dateString) => {
|
||||||
if (!dateString) return '-';
|
if (!dateString) return '-';
|
||||||
const date = new Date(dateString);
|
const date = new Date(dateString);
|
||||||
return date.toLocaleString('zh-CN', {
|
return date
|
||||||
|
.toLocaleString('zh-CN', {
|
||||||
year: 'numeric',
|
year: 'numeric',
|
||||||
month: '2-digit',
|
month: '2-digit',
|
||||||
day: '2-digit',
|
day: '2-digit',
|
||||||
hour: '2-digit',
|
hour: '2-digit',
|
||||||
minute: '2-digit',
|
minute: '2-digit',
|
||||||
second: '2-digit'
|
second: '2-digit'
|
||||||
}).replace(',', ' ');
|
})
|
||||||
|
.replace(',', ' ');
|
||||||
};
|
};
|
||||||
function handleCancel() {
|
function handleCancel() {
|
||||||
dialogVisible2.value = false;
|
dialogVisible2.value = false;
|
||||||
@ -574,6 +587,5 @@ onMounted(() => {
|
|||||||
routeParams.value = proxy.$route.query;
|
routeParams.value = proxy.$route.query;
|
||||||
console.log('routeParams.value', routeParams.value);
|
console.log('routeParams.value', routeParams.value);
|
||||||
materialsUsageDetails1();
|
materialsUsageDetails1();
|
||||||
})
|
});
|
||||||
|
|
||||||
</script>
|
</script>
|
Reference in New Issue
Block a user