|
@@ -17,9 +17,18 @@
|
|
|
<span>{{ $index + 1 }}</span>
|
|
|
</template>
|
|
|
</el-table-column>
|
|
|
+ <el-table-column label="仓库" prop="material_type" align="center">
|
|
|
+ <template #default="scope">
|
|
|
+ <el-form-item :prop="'detail.' + scope.$index + '.warehouse_id'" :rules="rules.warehouse_id" disabled>
|
|
|
+ <el-select v-model="scope.row.warehouse_id" @change="handleWarehouseChange">
|
|
|
+ <el-option v-for="item in warehouseList" :key="item.warehouse_id" :label="item.warehouse_name" :value="item.warehouse_id" />
|
|
|
+ </el-select>
|
|
|
+ </el-form-item>
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
<el-table-column label="物资类型" prop="material_type" align="center">
|
|
|
<template #default="scope">
|
|
|
- <el-form-item :prop="'detail.' + scope.$index + '.material_type'" :rules="rules.material_type">
|
|
|
+ <el-form-item :prop="'detail.' + scope.$index + '.material_type'" :rules="rules.material_type" disabled>
|
|
|
<el-select v-model="scope.row.material_type">
|
|
|
<el-option v-for="(item, index) in material_type" :key="index" :label="item.label" :value="item.value" />
|
|
|
</el-select>
|
|
@@ -85,6 +94,7 @@ import {
|
|
|
} from '@/api/comprehensiveGuarantee/materialReserveManagement/materialsDeclaration';
|
|
|
import BigNumber from 'bignumber.js';
|
|
|
import { formatToTwoDecimalPlaces, isNumericString } from '@/utils';
|
|
|
+import { getMaterialWarehouseList } from '@/api/comprehensiveGuarantee/materialReserveManagement/godownManagement';
|
|
|
|
|
|
const props = defineProps({
|
|
|
id: String
|
|
@@ -100,16 +110,20 @@ let detailData = reactive({
|
|
|
detail: []
|
|
|
});
|
|
|
const rules = reactive({
|
|
|
+ warehouse_id: [{ required: true, message: '请选择仓库', trigger: 'change' }],
|
|
|
material_type: [{ required: true, message: '请选择物资类型', trigger: 'change' }],
|
|
|
material_code: [{ required: true, message: '请选择物资名称', trigger: 'change' }],
|
|
|
material_quantity: [{ required: true, message: '请输入物资数量', trigger: 'blur' }],
|
|
|
material_unit_price: [{ required: true, message: '请输入物资单价', trigger: 'blur' }],
|
|
|
material_purpose: [{ required: true, message: '请输入物资用途', trigger: 'blur' }]
|
|
|
});
|
|
|
+let buttonLoading = ref(false);
|
|
|
+let warehouseList = ref([]);
|
|
|
let materialList = ref([]);
|
|
|
// 新增一列
|
|
|
const addDefaultRow = () => {
|
|
|
const newRow = {
|
|
|
+ warehouse_id: '',
|
|
|
material_type: '',
|
|
|
material_code: '',
|
|
|
material_quantity: '',
|
|
@@ -118,7 +132,10 @@ const addDefaultRow = () => {
|
|
|
};
|
|
|
detailData.detail.push(newRow);
|
|
|
};
|
|
|
+// 选择仓库
|
|
|
+const handleWarehouseChange = () => {
|
|
|
|
|
|
+}
|
|
|
// 计算总额
|
|
|
const calcTotalAmount = () => {
|
|
|
let total = new BigNumber('0');
|
|
@@ -169,11 +186,11 @@ const submitForm = async (formEl) => {
|
|
|
});
|
|
|
};
|
|
|
|
|
|
-let height = ref(400);
|
|
|
+let height = ref(300);
|
|
|
// 计算表格高度
|
|
|
const calcHeight = () => {
|
|
|
const el = document.getElementsByClassName('common-dialog-content')[0];
|
|
|
- height.value = el ? el.clientHeight - 173 : 400;
|
|
|
+ height.value = el && el.clientHeight - 173 > 400 ? el.clientHeight - 173 : 300;
|
|
|
};
|
|
|
onMounted(() => {
|
|
|
if (props.id) {
|
|
@@ -184,9 +201,12 @@ onMounted(() => {
|
|
|
} else {
|
|
|
addDefaultRow();
|
|
|
}
|
|
|
- getMaterialList().then((res) => {
|
|
|
- materialList.value = res.data;
|
|
|
+ getMaterialWarehouseList().then((res) => {
|
|
|
+ warehouseList.value = res.data;
|
|
|
});
|
|
|
+ // getMaterialList().then((res) => {
|
|
|
+ // materialList.value = res.data;
|
|
|
+ // });
|
|
|
calcHeight();
|
|
|
window.addEventListener('resize', calcHeight);
|
|
|
});
|