diff --git a/src/api/materials/overallPlanMaterialSupply/index.ts b/src/api/materials/overallPlanMaterialSupply/index.ts
index bf856e1..ae73e0b 100644
--- a/src/api/materials/overallPlanMaterialSupply/index.ts
+++ b/src/api/materials/overallPlanMaterialSupply/index.ts
@@ -31,4 +31,6 @@ export const materialChangeSupplyplan = (data: any): AxiosPromise => {
method: 'put',
data
});
-};
\ No newline at end of file
+};
+
+
diff --git a/src/api/materials/usageMaterials/index.ts b/src/api/materials/usageMaterials/index.ts
index f2a860e..ce4132a 100644
--- a/src/api/materials/usageMaterials/index.ts
+++ b/src/api/materials/usageMaterials/index.ts
@@ -2,40 +2,80 @@ import request from '@/utils/request';
import { AxiosPromise } from 'axios';
// 查询物资-使用情况列表
export const useMaterialsQueryList = (params: any): AxiosPromise => {
- return request({
- url: '/cailiaoshebei/physicalsupply/list',
- method: 'get',
- params
- });
+ return request({
+ url: '/cailiaoshebei/physicalsupply/list',
+ method: 'get',
+ params
+ });
};
// 新增物资
export const newMaterialsAdd = (data: any): AxiosPromise => {
- return request({
- url: '/cailiaoshebei/physicalsupply',
- method: 'post',
- data
- });
+ return request({
+ url: '/cailiaoshebei/physicalsupply',
+ method: 'post',
+ data
+ });
};
// 修改物资
export const materialsEdit = (data: any): AxiosPromise => {
- return request({
- url: '/cailiaoshebei/physicalsupply',
- method: 'put',
- data
- });
+ return request({
+ url: '/cailiaoshebei/physicalsupply',
+ method: 'put',
+ data
+ });
};
// 删除物资
export const materialsDel = (id: any): AxiosPromise => {
- return request({
- url: '/cailiaoshebei/physicalsupply/' + id,
- method: 'delete',
- });
+ return request({
+ url: '/cailiaoshebei/physicalsupply/' + id,
+ method: 'delete',
+ });
};
// 获取物资详情
export const queryMaterialsInfo = (id: any): AxiosPromise => {
- return request({
- url: '/cailiaoshebei/physicalsupply/' + id,
- method: 'get',
- });
+ return request({
+ url: '/cailiaoshebei/physicalsupply/' + id,
+ method: 'get',
+ });
+};
+
+
+// 查询物资子数据列表
+export const materialsUsageDetails = (query: any): AxiosPromise => {
+ return request({
+ url: '/cailiaoshebei/physicalsupplySon/list',
+ method: 'get',
+ params: query
+ });
+};
+// 获取物资-使用情况子数据详细信息
+export const materialsSonDetails = (id: any): AxiosPromise => {
+ return request({
+ url: '/cailiaoshebei/physicalsupplySon/' + id,
+ method: 'get',
+ });
+};
+// 新增物资-使用情况子数据
+export const materialsSonAdd = (data: any): AxiosPromise => {
+ return request({
+ url: '/cailiaoshebei/physicalsupplySon',
+ method: 'post',
+ data
+ });
+};
+//修改物资-使用情况子数据
+export const materialsSonEdit = (data: any): AxiosPromise => {
+ return request({
+ url: '/cailiaoshebei/physicalsupplySon',
+ method: 'put',
+ data
+ });
+};
+// 删除物资-使用情况子数据
+export const materialsSonDel = (id: any): AxiosPromise => {
+ return request({
+ url: '/cailiaoshebei/physicalsupplySon/' + id,
+ method: 'delete',
+ });
};
\ No newline at end of file
diff --git a/src/views/materials/usageMaterials/material/index.vue b/src/views/materials/usageMaterials/material/index.vue
index 8d3ed0a..9128e37 100644
--- a/src/views/materials/usageMaterials/material/index.vue
+++ b/src/views/materials/usageMaterials/material/index.vue
@@ -5,44 +5,9 @@
-
-
- 新增
-
-
+
刷新
@@ -51,25 +16,14 @@
-
+ :row-class-name="tableRowClassName">
-
+
{{ scope.row.findType === '1' ? '采购' : '材料' }}
@@ -77,45 +31,26 @@
-
+
{{ formatDate(scope.row.contractSigning) }}
-
+
{{ formatDate(scope.row.createTime) }}
-
+
-
-
+
+
+
+
@@ -123,41 +58,20 @@
- 共 {{ total }} 条记录,当前显示第 {{ (currentPage - 1) * pageSize + 1 }} 至 {{ Math.min(currentPage * pageSize, total) }} 条
+ 共 {{ total }} 条记录,当前显示第 {{ (currentPage - 1) * pageSize + 1 }} 至 {{ Math.min(currentPage *
+ pageSize, total)
+ }} 条
-
+
-
-
-
-
-
-
+
+
@@ -178,11 +92,8 @@
-
-
- 采购
- 材料
-
+
+
@@ -203,12 +114,8 @@
-
+
@@ -218,109 +125,44 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
-
-
-
-
-
-
-
-
取消
-
+
保存
-
-
+
-
+
+
+
确定要删除这条记录吗?
此操作不可撤销,请谨慎操作
取消
-
+
确认删除
@@ -334,10 +176,12 @@ import { ref, reactive, onMounted, computed, toRaw } from 'vue';
import { ElMessage, ElMessageBox } from 'element-plus';
import { WarningFilled } from '@element-plus/icons-vue';
import { useUserStoreHook } from '@/store/modules/user';
+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";
+import { useMaterialsQueryList, newMaterialsAdd, materialsEdit, materialsDel, queryMaterialsInfo } from "@/api/materials/usageMaterials/index";
// 表格数据相关
const tableData = ref([]);
const total = ref(0);
@@ -345,22 +189,19 @@ const currentPage = ref(1);
const pageSize = ref(10);
const loading = ref(false);
-// 搜索表单
-const searchForm = reactive({
- findType: '3', // 默认查询所有
- keyword: ''
-});
-
// 对话框相关
const dialogVisible = ref(false);
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);
const deleteLoading = ref(false);
const currentRow = ref(null);
+const submitLoading = ref(false);
// 表单数据
const formData = reactive({
@@ -368,16 +209,16 @@ const formData = reactive({
name: '',
specification: '',
supplier: '',
- findType: '1', // 默认采购
+ findType: 2, // 默认采购
installationQuantity: '',
installationRatio: '',
contractSigning: '',
productionPhase: null,
executionCycle: null,
- projectId: null,
+ projectId: currentProject.value?.id,
supplyRequirements: '',
- purchaseSubmission: '',
- submissionMaterials: '',
+ // purchaseSubmission: '',
+ // submissionMaterials: '',
remark: '',
createTime: '',
createBy: null,
@@ -400,10 +241,7 @@ const formRules = reactive({
]
});
-// 初始化页面
-onMounted(() => {
- fetchData();
-});
+
// 格式化日期
const formatDate = (dateString) => {
@@ -430,7 +268,7 @@ const fetchData = async () => {
try {
const res = await useMaterialsQueryList({
projectId: currentProject.value?.id,
- findType:2
+ findType: 2
});
tableData.value = res.rows;
@@ -481,43 +319,67 @@ const handleEdit = (row) => {
dialogType.value = 'edit';
currentRow.value = row;
resetForm();
-
+
// 填充表单数据
Object.keys(formData).forEach(key => {
if (row.hasOwnProperty(key)) {
formData[key] = row[key];
}
});
-
+
dialogVisible.value = true;
};
-
-// 双击行编辑
-const handleRowDblClick = (row) => {
- handleEdit(row);
+const handleAddSon = (row) => {
+ ElMessageBox.confirm(
+ '确认提交',
+ 'Warning',
+ {
+ confirmButtonText: '确认',
+ cancelButtonText: '取消',
+ type: 'warning',
+ }
+ ).then(() => {
+ materialsEdit(formData).then(res=>{
+ let { code } = res
+ if (code === 200) {
+ ElMessage({
+ type: 'success',
+ message: '提交成功',
+ })
+ }
+ })
+ }).catch(() => {
+ ElMessage({
+ type: 'info',
+ message: '已取消提交',
+ })
+ })
};
+
// 删除
const handleDelete = (row) => {
currentRow.value = row;
deleteDialogVisible.value = true;
};
+
// 确认删除
const confirmDelete = async () => {
if (!currentRow.value) return;
-
+
deleteLoading.value = true;
try {
// 模拟API请求
- await new Promise(resolve => setTimeout(resolve, 500));
-
- // 从表格中移除数据
- tableData.value = tableData.value.filter(item => item.id !== currentRow.value.id);
- total.value--;
-
- deleteDialogVisible.value = false;
- ElMessage.success('删除成功');
+ const res = await materialsDel(currentRow.value.id)
+ const { code } = res;
+ if (code === 200) {
+ ElMessage.success('删除成功');
+ deleteDialogVisible.value = false;
+ fetchData();
+ } else {
+ ElMessage.error('删除失败');
+ }
} catch (error) {
ElMessage.error('删除失败:' + error.message);
console.error(error);
@@ -525,6 +387,9 @@ const confirmDelete = async () => {
deleteLoading.value = false;
}
};
+//
+
+
// 保存
const handleSave = async () => {
@@ -532,41 +397,28 @@ const handleSave = async () => {
if (!formRef.value) return;
const valid = await formRef.value.validate();
if (!valid) return;
-
saveLoading.value = true;
try {
// 模拟API请求
- await new Promise(resolve => setTimeout(resolve, 800));
-
- const form = toRaw(formData);
-
if (dialogType.value === 'add') {
// 新增
- const newId = Math.max(...tableData.value.map(item => item.id), 0) + 1;
- const newItem = {
- ...form,
- id: newId,
- createTime: new Date().toISOString().slice(0, 19).replace('T', ' '),
- createBy: 1, // 假设当前用户ID为1
- updateTime: null,
- updateBy: null
- };
- tableData.value.unshift(newItem);
- total.value++;
- ElMessage.success('新增成功');
+ formData.projectId = currentProject.value?.id;
+ const res = await newMaterialsAdd(formData)
+ let { code } = res
+ if (code === 200) {
+ ElMessage.success('新增成功');
+ fetchData();
+ }
} else {
// 编辑
- const index = tableData.value.findIndex(item => item.id === form.id);
- if (index !== -1) {
- tableData.value[index] = {
- ...form,
- updateTime: new Date().toISOString().slice(0, 19).replace('T', ' '),
- updateBy: 1 // 假设当前用户ID为1
- };
- ElMessage.success('更新成功');
+ const res = await materialsEdit(formData)
+ let { code } = res
+ if (code === 200) {
+ ElMessage.success('保存成功');
+ fetchData();
}
}
-
+
dialogVisible.value = false;
} catch (error) {
ElMessage.error('保存失败:' + error.message);
@@ -581,14 +433,14 @@ const resetForm = () => {
if (formRef.value) {
formRef.value.resetFields();
}
-
+
// 重置表单数据
Object.keys(formData).forEach(key => {
formData[key] = '';
});
-
+
// 设置默认值
- formData.findType = '1';
+ formData.findType = 2;
formData.id = '';
};
@@ -597,11 +449,27 @@ const handleDialogClose = () => {
resetForm();
dialogVisible.value = false;
};
+
+// 跳转
+const jumpRouter = (row) => {
+ router.push({
+ path: `/materials/usageMaterials/materialSon`,
+ query: {
+ id: row.id,
+ type: 'update'
+ }
+ });
+};
+// 初始化页面
+onMounted(() => {
+ fetchData();
+});
+
+
\ No newline at end of file
diff --git a/src/views/materials/usageMaterials/material/indexSon.vue b/src/views/materials/usageMaterials/material/indexSon.vue
new file mode 100644
index 0000000..01f63db
--- /dev/null
+++ b/src/views/materials/usageMaterials/material/indexSon.vue
@@ -0,0 +1,575 @@
+
+
+
+
+
+
+ 新增
+
+
+ 刷新
+
+
+
+
+
+
+
+
+
+
+
+
+
+ {{ formatDate(scope.row.issuanceTime) }}
+
+
+
+
+ {{ formatDate(scope.row.requireDelivery) }}
+
+
+
+
+ {{ formatDate(scope.row.scheduledDelivery) }}
+
+
+
+
+ {{ formatDate(scope.row.actualDelivery) }}
+
+
+
+
+ {{ formatDate(scope.row.acceptanceCheck) }}
+
+
+
+
+
+
+
+
+
+
+ {{ scope.row.differenceQuantity || '-' }}
+
+
+
+
+
+
+
+
+ {{ scope.row.cargoAmount }}
+
+
+
+
+ {{ scope.row.advance }}
+
+
+
+
+ {{ scope.row.feed }}
+
+
+
+
+ {{ scope.row.acceptancePayment }}
+
+
+
+
+ {{ scope.row.debugging }}
+
+
+
+
+ {{ scope.row.qualityGuarantee }}
+
+
+
+
+ {{ scope.row.settlementAmount }}
+
+
+
+
+
+
+
+
+ {{ scope.row.expectedState || '-' }}
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 查看详情
+
+
+
采购备注:{{ scope.row.cgRemark || '-' }}
+
+
到货备注:{{ scope.row.dhRemark || '-' }}
+
+
供应商备注:{{ scope.row.gysRemark || '-'
+ }}
+
结算备注:{{ scope.row.jsRemark || '-' }}
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 共 {{ total }} 条记录,当前显示第 {{ (currentPage - 1) * pageSize + 1 }} 至 {{
+ Math.min(currentPage * pageSize, total)
+ }} 条
+
+
+
+
+
+
+
+
+
+
确定要删除这条记录吗?
+
此操作不可撤销,请谨慎操作
+
+
+
+ 取消
+
+ 确认删除
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 取消
+
+
+ {{ dialogType2 === 'addSon' ? '新增' : '保存' }}
+
+
+
+
+
+
\ No newline at end of file
diff --git a/src/views/materials/usageMaterials/purchase/index.vue b/src/views/materials/usageMaterials/purchase/index.vue
index 0d331c4..b4b4e12 100644
--- a/src/views/materials/usageMaterials/purchase/index.vue
+++ b/src/views/materials/usageMaterials/purchase/index.vue
@@ -1,176 +1,533 @@
-
-
-
-
-
- 审批
-
-
- 查看流程
-
-
-
-
-
-
-
-
-
-
-
- 修改
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+ 新增
+
+
+ 刷新
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ {{ scope.row.findType === '1' ? '采购' : '材料' }}
+
+
+
+
+
+
+ {{ formatDate(scope.row.contractSigning) }}
+
+
+
+
+ {{ formatDate(scope.row.createTime) }}
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 共 {{ total }} 条记录,当前显示第 {{ (currentPage - 1) * pageSize + 1 }} 至 {{ Math.min(currentPage *
+ pageSize, total)
+ }} 条
+
+
+
+
+
+
+
-
-
+
+
-
-
+
+
-
+
-
-
+
+
-
-
+
+
-
+
-
-
+
+
-
-
+
+
-
+
-
-
+
+
+
+
+
+
+
-
+
+
+
+
+
+
+
+
+
-
+
+
- 取消
- 确定
+
+ 取消
+
+ 保存
+
+
+
+
+
+
+
+
+
+
+
确定要删除这条记录吗?
+
此操作不可撤销,请谨慎操作
+
+
+
+ 取消
+
+ 确认删除
+
+
-
-
+
+/* 按钮样式优化 */
+::v-deep .el-button--primary {
+ transition: all 0.2s ease;
+}
+
+::v-deep .el-button--primary:hover {
+ transform: translateY(-2px);
+}
+
\ No newline at end of file
diff --git a/src/views/materials/usageMaterials/purchase/indexSon.vue b/src/views/materials/usageMaterials/purchase/indexSon.vue
new file mode 100644
index 0000000..01f63db
--- /dev/null
+++ b/src/views/materials/usageMaterials/purchase/indexSon.vue
@@ -0,0 +1,575 @@
+
+
+
+
+
+
+ 新增
+
+
+ 刷新
+
+
+
+
+
+
+
+
+
+
+
+
+
+ {{ formatDate(scope.row.issuanceTime) }}
+
+
+
+
+ {{ formatDate(scope.row.requireDelivery) }}
+
+
+
+
+ {{ formatDate(scope.row.scheduledDelivery) }}
+
+
+
+
+ {{ formatDate(scope.row.actualDelivery) }}
+
+
+
+
+ {{ formatDate(scope.row.acceptanceCheck) }}
+
+
+
+
+
+
+
+
+
+
+ {{ scope.row.differenceQuantity || '-' }}
+
+
+
+
+
+
+
+
+ {{ scope.row.cargoAmount }}
+
+
+
+
+ {{ scope.row.advance }}
+
+
+
+
+ {{ scope.row.feed }}
+
+
+
+
+ {{ scope.row.acceptancePayment }}
+
+
+
+
+ {{ scope.row.debugging }}
+
+
+
+
+ {{ scope.row.qualityGuarantee }}
+
+
+
+
+ {{ scope.row.settlementAmount }}
+
+
+
+
+
+
+
+
+ {{ scope.row.expectedState || '-' }}
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 查看详情
+
+
+
采购备注:{{ scope.row.cgRemark || '-' }}
+
+
到货备注:{{ scope.row.dhRemark || '-' }}
+
+
供应商备注:{{ scope.row.gysRemark || '-'
+ }}
+
结算备注:{{ scope.row.jsRemark || '-' }}
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 共 {{ total }} 条记录,当前显示第 {{ (currentPage - 1) * pageSize + 1 }} 至 {{
+ Math.min(currentPage * pageSize, total)
+ }} 条
+
+
+
+
+
+
+
+
+
+
确定要删除这条记录吗?
+
此操作不可撤销,请谨慎操作
+
+
+
+ 取消
+
+ 确认删除
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 取消
+
+
+ {{ dialogType2 === 'addSon' ? '新增' : '保存' }}
+
+
+
+
+
+
\ No newline at end of file