物资
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.180:8898'
|
VITE_APP_BASE_API = 'http://192.168.110.159:8898'
|
||||||
|
|
||||||
# 无人机接口地址
|
# 无人机接口地址
|
||||||
|
|
||||||
|
@ -33,8 +33,11 @@ export const getCailiaoshebei = (id: string | number): AxiosPromise<Cailiaoshebe
|
|||||||
*/
|
*/
|
||||||
export const addCailiaoshebei = (data: CailiaoshebeiForm) => {
|
export const addCailiaoshebei = (data: CailiaoshebeiForm) => {
|
||||||
return request({
|
return request({
|
||||||
url: '/cailiaoshebei/cailiaoshebei',
|
url: '/cailiaoshebei/materialsorder/changeTheStatusOfTheMaterials',
|
||||||
method: 'post',
|
method: 'post',
|
||||||
|
headers: {
|
||||||
|
'Content-Type': 'multipart/form-data'
|
||||||
|
},
|
||||||
data: data
|
data: data
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
@ -255,8 +255,9 @@ const getBatchList = async () => {
|
|||||||
/** 节点单击事件 */
|
/** 节点单击事件 */
|
||||||
const handleNodeClick = (data: any) => {
|
const handleNodeClick = (data: any) => {
|
||||||
queryParams.value.batchNumber = data.batchNumber;
|
queryParams.value.batchNumber = data.batchNumber;
|
||||||
form.value.batchNumber = data.batchNumber;
|
form.value = data;
|
||||||
form.value.approvalOrder = data.approvalOrder;
|
// form.value.batchNumber = data.batchNumber;
|
||||||
|
// form.value.approvalOrder = data.approvalOrder;
|
||||||
if (data.batchNumber === '0') {
|
if (data.batchNumber === '0') {
|
||||||
queryParams.value.batchNumber = '';
|
queryParams.value.batchNumber = '';
|
||||||
}
|
}
|
||||||
|
@ -20,12 +20,12 @@
|
|||||||
</el-col> -->
|
</el-col> -->
|
||||||
<el-col :span="8" :offset="0">
|
<el-col :span="8" :offset="0">
|
||||||
<el-form-item label="采购人">
|
<el-form-item label="采购人">
|
||||||
<el-input v-model="form.purchasingAgent" placeholder="请输入采购人" @input="getList" prefix-icon="Search" clearable />
|
<el-input v-model="form.purchasingAgent" disabled placeholder="请输入采购人" @input="getList" prefix-icon="Search" clearable />
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
</el-col>
|
</el-col>
|
||||||
<el-col :span="8" :offset="0">
|
<el-col :span="8" :offset="0">
|
||||||
<el-form-item label="采购时间">
|
<el-form-item label="采购时间">
|
||||||
<el-date-picker v-model="form.purchasingPeriod" type="date" value-format="YYYY-MM-DD" placeholder="选择采购时间" />
|
<el-date-picker v-model="form.purchasingPeriod" disabled type="date" value-format="YYYY-MM-DD" placeholder="选择采购时间" />
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
</el-col>
|
</el-col>
|
||||||
<el-col :span="8" :offset="0">
|
<el-col :span="8" :offset="0">
|
||||||
@ -35,12 +35,12 @@
|
|||||||
</el-col>
|
</el-col>
|
||||||
<el-col :span="8" :offset="0">
|
<el-col :span="8" :offset="0">
|
||||||
<el-form-item label="合同号">
|
<el-form-item label="合同号">
|
||||||
<el-input v-model="form.contractNumber" placeholder="请输入合同号" @input="getList" prefix-icon="Search" clearable />
|
<el-input v-model="form.contractNumber" disabled placeholder="请输入合同号" @input="getList" prefix-icon="Search" clearable />
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
</el-col>
|
</el-col>
|
||||||
<el-col :span="8" :offset="0">
|
<el-col :span="8" :offset="0">
|
||||||
<el-form-item label="备注">
|
<el-form-item label="备注">
|
||||||
<el-input v-model="form.dhRemark" placeholder="请输入备注" @input="getList" prefix-icon="Search" clearable />
|
<el-input v-model="form.dhRemark" placeholder="请输入备注" disabled @input="getList" prefix-icon="Search" clearable />
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
</el-col>
|
</el-col>
|
||||||
</el-row>
|
</el-row>
|
||||||
@ -147,7 +147,7 @@ const getList = async () => {
|
|||||||
getListAll();
|
getListAll();
|
||||||
})
|
})
|
||||||
.catch((error) => {
|
.catch((error) => {
|
||||||
console.error('请求失败:', error);
|
proxy?.$modal.msgError(error);
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
// 获取列表
|
// 获取列表
|
||||||
@ -172,17 +172,18 @@ const getListAll = () => {
|
|||||||
loading.value = false;
|
loading.value = false;
|
||||||
})
|
})
|
||||||
.catch((error) => {
|
.catch((error) => {
|
||||||
console.error('请求失败:', error);
|
proxy?.$modal.msgError(error);
|
||||||
|
|
||||||
loading.value = false;
|
loading.value = false;
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
/** 提交按钮 */
|
/** 提交按钮 */
|
||||||
const submitForm = async () => {
|
const submitForm = async () => {
|
||||||
cailiaoshebeiList.value.forEach((item) => {
|
// cailiaoshebeiList.value.forEach((item) => {
|
||||||
if (item.id) {
|
// if (item.id) {
|
||||||
delete item.id;
|
// delete item.id;
|
||||||
}
|
// }
|
||||||
});
|
// });
|
||||||
axios
|
axios
|
||||||
.put(
|
.put(
|
||||||
'http://192.168.110.159:8898/cailiaoshebei/materialsorder/modifyTheOrderFormGYS',
|
'http://192.168.110.159:8898/cailiaoshebei/materialsorder/modifyTheOrderFormGYS',
|
||||||
@ -198,13 +199,20 @@ const submitForm = async () => {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
.then((response) => {
|
.then((res) => {
|
||||||
proxy?.$modal.msgSuccess('操作成功');
|
console.log(res.data.code);
|
||||||
|
|
||||||
|
if (res.data.code === 200) {
|
||||||
|
proxy?.$modal.msgSuccess('操作成功');
|
||||||
|
} else {
|
||||||
|
proxy?.$modal.msgError(res.data.msg + '');
|
||||||
|
}
|
||||||
|
|
||||||
loading.value = false;
|
loading.value = false;
|
||||||
})
|
})
|
||||||
.catch((error) => {
|
.catch((error) => {
|
||||||
console.error('请求失败:', error);
|
proxy?.$modal.msgError(error);
|
||||||
|
|
||||||
loading.value = false;
|
loading.value = false;
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
@ -27,7 +27,12 @@
|
|||||||
</el-card>
|
</el-card>
|
||||||
</el-col>
|
</el-col>
|
||||||
<el-col :span="19">
|
<el-col :span="19">
|
||||||
<el-card shadow="never">
|
<el-card shadow="never"
|
||||||
|
><template #header>
|
||||||
|
<el-row :gutter="10" class="mb8">
|
||||||
|
<right-toolbar v-model:showSearch="showSearch" @queryTable="getList"></right-toolbar>
|
||||||
|
</el-row>
|
||||||
|
</template>
|
||||||
<el-table v-loading="loading" :data="cailiaoshebeiList" @selection-change="handleSelectionChange">
|
<el-table v-loading="loading" :data="cailiaoshebeiList" @selection-change="handleSelectionChange">
|
||||||
<el-table-column type="selection" width="55" align="center" />
|
<el-table-column type="selection" width="55" align="center" />
|
||||||
<el-table-column label="设备材料名称" align="center" prop="name" width="110" />
|
<el-table-column label="设备材料名称" align="center" prop="name" width="110" />
|
||||||
@ -124,7 +129,7 @@
|
|||||||
:fileType="['doc', 'docx']"
|
:fileType="['doc', 'docx']"
|
||||||
:autoUpload="false"
|
:autoUpload="false"
|
||||||
ref="fileUploadRef"
|
ref="fileUploadRef"
|
||||||
:data="{ ...form.bo }"
|
:data="form.bo"
|
||||||
uploadUrl="/cailiaoshebei/materialsorder/changeTheStatusOfTheMaterials"
|
uploadUrl="/cailiaoshebei/materialsorder/changeTheStatusOfTheMaterials"
|
||||||
:onUploadError="
|
:onUploadError="
|
||||||
(err, file, fileList) => {
|
(err, file, fileList) => {
|
||||||
@ -143,7 +148,7 @@
|
|||||||
|
|
||||||
<template #footer>
|
<template #footer>
|
||||||
<div class="dialog-footer">
|
<div class="dialog-footer">
|
||||||
<el-button :loading="buttonLoading" type="primary" @click="submitForm">确 定</el-button>
|
<el-button type="primary" @click="submitForm">确 定</el-button>
|
||||||
<el-button @click="cancel">取 消</el-button>
|
<el-button @click="cancel">取 消</el-button>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
@ -208,8 +213,8 @@ const initFormData: CailiaoshebeiForm = {
|
|||||||
finishTime: undefined,
|
finishTime: undefined,
|
||||||
unit: undefined,
|
unit: undefined,
|
||||||
plan: undefined,
|
plan: undefined,
|
||||||
|
file: '',
|
||||||
realQuantity: undefined,
|
realQuantity: undefined,
|
||||||
file: undefined,
|
|
||||||
projectId: currentProject.value.id,
|
projectId: currentProject.value.id,
|
||||||
bo: {
|
bo: {
|
||||||
requiredTime: undefined,
|
requiredTime: undefined,
|
||||||
@ -272,6 +277,7 @@ const getBatchList = async () => {
|
|||||||
try {
|
try {
|
||||||
batchTreeRef.value.setCurrentKey(res.rows[0].batchNumber);
|
batchTreeRef.value.setCurrentKey(res.rows[0].batchNumber);
|
||||||
form.value.batchNumber = res.rows[0].batchNumber;
|
form.value.batchNumber = res.rows[0].batchNumber;
|
||||||
|
queryParams.value.batchNumber = res.rows[0].batchNumber;
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
form.value.batchNumber = '';
|
form.value.batchNumber = '';
|
||||||
}
|
}
|
||||||
@ -303,8 +309,14 @@ const cancel = () => {
|
|||||||
|
|
||||||
/** 表单重置 */
|
/** 表单重置 */
|
||||||
const reset = () => {
|
const reset = () => {
|
||||||
const preservedBatchId = form.value.batchNumber; // 先保存当前的 batchNumber
|
const preservedBatchId = form.value.batchNumber;
|
||||||
form.value = { ...initFormData, batchNumber: preservedBatchId }; // 重置但保留
|
|
||||||
|
form.value = {
|
||||||
|
...initFormData,
|
||||||
|
bo: { ...initFormData.bo }, // 新建一个 bo 对象
|
||||||
|
batchNumber: preservedBatchId
|
||||||
|
};
|
||||||
|
|
||||||
cailiaoshebeiFormRef.value?.resetFields();
|
cailiaoshebeiFormRef.value?.resetFields();
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -341,18 +353,30 @@ const handleUpdate = async (row?: CailiaoshebeiVO) => {
|
|||||||
operation_s.value = operation_status.value.slice(0, 2);
|
operation_s.value = operation_status.value.slice(0, 2);
|
||||||
Object.assign(form.value.bo, row);
|
Object.assign(form.value.bo, row);
|
||||||
console.log('🚀 ~ handleUpdate ~ form.value:', form.value);
|
console.log('🚀 ~ handleUpdate ~ form.value:', form.value);
|
||||||
// selectValue.value = (form.value.supplierId as string).split(',');
|
|
||||||
dialog.visible = true;
|
dialog.visible = true;
|
||||||
dialog.title = '修改物资-材料设备';
|
dialog.title = '修改物资-材料设备';
|
||||||
};
|
};
|
||||||
|
|
||||||
/** 提交按钮 */
|
/** 提交按钮 */
|
||||||
const submitForm = () => {
|
const submitForm = () => {
|
||||||
console.log('🚀 ~ submitForm ~ form.value:', form.value);
|
Object.keys(form.value.bo).forEach((key) => {
|
||||||
|
if (form.value.bo[key] == 'null' || form.value.bo[key] == null) {
|
||||||
|
delete form.value.bo[key];
|
||||||
|
}
|
||||||
|
});
|
||||||
|
console.log('🚀 ~ submitForm ~ form.value:', form.value.bo);
|
||||||
|
|
||||||
cailiaoshebeiFormRef.value?.validate(async (valid: boolean) => {
|
cailiaoshebeiFormRef.value?.validate(async (valid: boolean) => {
|
||||||
if (valid) {
|
if (valid) {
|
||||||
buttonLoading.value = true;
|
buttonLoading.value = true;
|
||||||
fileUploadRef.value!.submitUpload();
|
if (fileUploadRef.value) {
|
||||||
|
fileUploadRef.value!.submitUpload();
|
||||||
|
} else {
|
||||||
|
form.value.bo.file = null;
|
||||||
|
await addCailiaoshebei(form.value.bo).finally(() => (buttonLoading.value = false));
|
||||||
|
dialog.visible = false;
|
||||||
|
getList();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
@ -374,7 +398,6 @@ const handleDeleteBatch = async () => {
|
|||||||
await delBatch(_ids);
|
await delBatch(_ids);
|
||||||
proxy?.$modal.msgSuccess('删除成功');
|
proxy?.$modal.msgSuccess('删除成功');
|
||||||
queryParams.value.batchNumber = '';
|
queryParams.value.batchNumber = '';
|
||||||
|
|
||||||
await getBatchList();
|
await getBatchList();
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -415,20 +438,6 @@ const getSupplierList = async () => {
|
|||||||
supplierOptions.value = res.rows;
|
supplierOptions.value = res.rows;
|
||||||
};
|
};
|
||||||
|
|
||||||
// 中间数组变量供 el-select 使用
|
|
||||||
const selectValue = ref<string[]>([]);
|
|
||||||
|
|
||||||
// 监听 selectValue,每次变化时同步更新 form.supplierId 和 form.supplier
|
|
||||||
watch(
|
|
||||||
selectValue,
|
|
||||||
(newVal) => {
|
|
||||||
form.value.supplierId = newVal.join(',');
|
|
||||||
const selectedNames = supplierOptions.value.filter((opt) => newVal.includes(opt.id)).map((opt) => opt.name);
|
|
||||||
form.value.supplier = selectedNames.join(',');
|
|
||||||
},
|
|
||||||
{ immediate: true }
|
|
||||||
);
|
|
||||||
|
|
||||||
onMounted(() => {
|
onMounted(() => {
|
||||||
getBatchList();
|
getBatchList();
|
||||||
getSupplierList();
|
getSupplierList();
|
||||||
|
Reference in New Issue
Block a user