合并
This commit is contained in:
@ -337,18 +337,10 @@ const getVersionNums = async () => {
|
||||
getSheetName();
|
||||
} else {
|
||||
treeForm.value.versions = '';
|
||||
ElMessage({
|
||||
message: '获取版本号失败',
|
||||
type: 'warning'
|
||||
});
|
||||
}
|
||||
}
|
||||
} catch (error) {
|
||||
console.log(error);
|
||||
ElMessage({
|
||||
message: '获取版本号失败',
|
||||
type: 'warning'
|
||||
});
|
||||
}
|
||||
};
|
||||
//获取表名
|
||||
|
@ -150,18 +150,10 @@ const getVersionNums = async () => {
|
||||
getSheetName();
|
||||
} else {
|
||||
queryForm.value.versions = '';
|
||||
ElMessage({
|
||||
message: '获取版本号失败',
|
||||
type: 'warning'
|
||||
});
|
||||
}
|
||||
}
|
||||
} catch (error) {
|
||||
console.log(error);
|
||||
ElMessage({
|
||||
message: '获取版本号失败',
|
||||
type: 'warning'
|
||||
});
|
||||
}
|
||||
};
|
||||
//选择版本号
|
||||
|
@ -6,7 +6,7 @@
|
||||
<el-card v-if="index < 3" shadow="always">
|
||||
<el-form :model="state.queryForm" :inline="true">
|
||||
<el-form-item label="版本号" prop="versions">
|
||||
<el-select v-model="state.queryForm.versions" placeholder="选择版本号">
|
||||
<el-select v-model="state.queryForm.versions" placeholder="选择版本号" @change="handleChangeVersion">
|
||||
<el-option v-for="item in state.options" :key="item.versions" :label="item.versions" :value="item.versions" />
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
@ -166,6 +166,7 @@ const handleTabChange = (tab) => {
|
||||
onMounted(async () => {
|
||||
await getVersionNums();
|
||||
});
|
||||
|
||||
// 获取版本号
|
||||
async function getVersionNums(isSheet = true) {
|
||||
try {
|
||||
|
@ -126,11 +126,11 @@
|
||||
<el-col :span="12">
|
||||
<el-form-item
|
||||
label="名称"
|
||||
:prop="`itemList.${index}.name`"
|
||||
:prop="`itemList.${index}.materialsId`"
|
||||
:rules="[{ required: true, message: '名称不能为空', trigger: 'blur' }]"
|
||||
>
|
||||
<el-select v-model="item.inventoryId" placeholder="请选择名称" @change="(value) => getNameChange(value, index, item)">
|
||||
<el-option v-for="opt in optionsName" :key="opt.id" :label="opt.materialsName" :value="opt.id" />
|
||||
<el-select v-model="item.materialsId" placeholder="请选择名称" @change="(value) => getNameChange(value, index, item)">
|
||||
<el-option v-for="opt in optionsName" :key="opt.id" :label="`${opt.materialsName}_${opt.createTime}`" :value="opt.id" />
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
@ -171,13 +171,9 @@
|
||||
</el-col> -->
|
||||
<el-col :span="12">
|
||||
<el-form-item label="领取" :prop="`itemList.${index}.issuedQuantity`">
|
||||
<el-input
|
||||
v-model.number="item.issuedQuantity"
|
||||
disabled
|
||||
placeholder="请输入领取数量"
|
||||
@input="handleIssuedChange(index)"
|
||||
@blur="handleIssuedChange(index)"
|
||||
/>
|
||||
<el-select v-model="item.issuedQuantity" placeholder="请选择数量">
|
||||
<el-option v-for="opt in item.outList" :key="opt.id" :label="opt.number" :value="opt.number" />
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<!-- <el-col :span="12">
|
||||
@ -311,6 +307,7 @@ const getInitFormData = () => {
|
||||
itemList: [
|
||||
{
|
||||
id: undefined,
|
||||
|
||||
specification: undefined,
|
||||
unit: undefined,
|
||||
stockQuantity: undefined,
|
||||
@ -318,7 +315,8 @@ const getInitFormData = () => {
|
||||
remainingQuantity: undefined,
|
||||
name: undefined, // 数量验收的名称
|
||||
remark: undefined,
|
||||
materialsId: undefined
|
||||
materialsId: undefined,
|
||||
outList: []
|
||||
}
|
||||
]
|
||||
};
|
||||
@ -369,7 +367,7 @@ const computeMaterialName = () => {
|
||||
.map((item) => item.name.trim())
|
||||
.filter((name, index, self) => self.indexOf(name) === index); // 去重(如需保留重复则删除这行)
|
||||
|
||||
form.value.materialName = validNames.join(',');
|
||||
// form.value.materialName = validNames.join(',');
|
||||
};
|
||||
|
||||
/** 查询物料领料单列表 */
|
||||
@ -408,6 +406,7 @@ const getNameChange = (value, index, item) => {
|
||||
item.unit = selected.weightId;
|
||||
item.issuedQuantity = selected.number;
|
||||
item.stockQuantity = Number(selected.inventoryNumber) || 0;
|
||||
item.outList = selected.outList || [];
|
||||
// calculateRemaining(index); // 计算剩余数量
|
||||
}
|
||||
};
|
||||
@ -620,6 +619,7 @@ const submitForm = () => {
|
||||
remainingQuantity: Number(item.remainingQuantity)
|
||||
}))
|
||||
};
|
||||
console.log('提交数据:', submitData);
|
||||
|
||||
if (form.value.id) {
|
||||
await updateMaterialIssue(submitData);
|
||||
@ -661,10 +661,13 @@ const addItem = () => {
|
||||
// 删除数量验收条目
|
||||
const removeItem = (index: number) => {
|
||||
if (form.value.itemList.length > 1) {
|
||||
console.log(111111);
|
||||
console.log(itemWatchStopFns.value[index]);
|
||||
|
||||
// 停止该条目的监听
|
||||
if (itemWatchStopFns.value[index]) {
|
||||
itemWatchStopFns.value[index]();
|
||||
}
|
||||
// if (itemWatchStopFns.value[index]) {
|
||||
// itemWatchStopFns.value[index]();
|
||||
// }
|
||||
form.value.itemList.splice(index, 1);
|
||||
itemWatchStopFns.value.splice(index, 1);
|
||||
// 删除后重新计算材料名称
|
||||
|
@ -42,7 +42,7 @@
|
||||
<thead>
|
||||
<tr>
|
||||
<th colspan="2">领料单位</th>
|
||||
<td class="th-bg" colspan="2">{{ formData.placeholder }}</td>
|
||||
<td class="th-bg" colspan="2">{{ formData.issueUnit }}</td>
|
||||
<th colspan="2">保管单位</th>
|
||||
<td class="th-bg" colspan="2">{{ formData.storageUnit }}</td>
|
||||
</tr>
|
||||
|
@ -139,7 +139,7 @@ const sheets = ref([]);
|
||||
const options = ref([]);
|
||||
const tableData = ref([]);
|
||||
const tableRef = ref();
|
||||
const isExpandAll = ref(false);
|
||||
const isExpandAll = ref(true);
|
||||
const loading = ref(false);
|
||||
const versionMap = new Map();
|
||||
|
||||
|
@ -285,8 +285,8 @@
|
||||
:data="form"
|
||||
uploadUrl="/supplierInput/supplierInput"
|
||||
:limit="1"
|
||||
:onUploadSuccess="handleUploadSuccess"
|
||||
@handleChange="change"
|
||||
@handleChange="handleFileChange"
|
||||
@handleRemove="handleFileRemove"
|
||||
showFileList
|
||||
>
|
||||
<div><el-button type="primary">上传文件</el-button><br /></div>
|
||||
@ -309,7 +309,7 @@
|
||||
<script setup name="SupplierInput" lang="ts">
|
||||
import { ComponentInternalInstance, getCurrentInstance, onMounted, ref, reactive, toRefs, computed } from 'vue';
|
||||
import { ElFormInstance } from 'element-plus';
|
||||
import { listSupplierInput, getSupplierInput, delSupplierInput } from '@/api/supplierInput/supplierInput/index';
|
||||
import { listSupplierInput, getSupplierInput, delSupplierInput, updateSupplierInput } from '@/api/supplierInput/supplierInput/index';
|
||||
import { SupplierInputVO, SupplierInputQuery, SupplierInputForm, PageData, DialogOption } from '@/api/supplierInput/supplierInput/types';
|
||||
import Pagination from '@/components/Pagination/index.vue';
|
||||
import RightToolbar from '@/components/RightToolbar/index.vue';
|
||||
@ -576,6 +576,7 @@ const handleAdd = () => {
|
||||
dialog.title = '添加供应商入库';
|
||||
};
|
||||
|
||||
const editFileId = ref('');
|
||||
const handleUpdate = async (row?: SupplierInputVO) => {
|
||||
reset();
|
||||
const _id = row?.id || ids.value[0];
|
||||
@ -583,7 +584,8 @@ const handleUpdate = async (row?: SupplierInputVO) => {
|
||||
|
||||
try {
|
||||
const res = await getSupplierInput(_id);
|
||||
const resData = res.data || {};
|
||||
const resData: any = res.data || {};
|
||||
editFileId.value = resData.fileId;
|
||||
// 1. 基础字段回显
|
||||
form.value = { ...form.value, ...resData, inputFile: '' };
|
||||
// 2. 核心修复:拆分后端拼接字符串到表单单独字段
|
||||
@ -598,6 +600,25 @@ const handleUpdate = async (row?: SupplierInputVO) => {
|
||||
}
|
||||
};
|
||||
|
||||
const fileStatus = ref(false);
|
||||
const updateFileStatus = ref(true);
|
||||
const isUpdateFile = ref(false); //记录是否在修改页面时是否有新上传的文件
|
||||
const handleFileChange = (file, fileList) => {
|
||||
if (form.value.id) {
|
||||
updateFileStatus.value = true;
|
||||
isUpdateFile.value = true; //记录是否在修改页面时是否有新上传的文件
|
||||
}
|
||||
fileStatus.value = true;
|
||||
};
|
||||
|
||||
const handleFileRemove = (file, fileList) => {
|
||||
if (form.value.id) {
|
||||
updateFileStatus.value = false;
|
||||
isUpdateFile.value = false; //记录是否在修改页面时是否有新上传的文件
|
||||
}
|
||||
|
||||
fileStatus.value = false;
|
||||
};
|
||||
/** 提交表单 */
|
||||
const submitForm = () => {
|
||||
supplierInputFormRef.value?.validate(async (valid: boolean) => {
|
||||
@ -619,7 +640,12 @@ const submitForm = () => {
|
||||
buttonLoading.value = true;
|
||||
try {
|
||||
if (fileUploadRef.value) {
|
||||
await fileUploadRef.value.submitUpload().then((res) => {
|
||||
if (form.value.fileId === editFileId.value && !isUpdateFile.value) {
|
||||
console.log(1111111111);
|
||||
|
||||
editFormData();
|
||||
} else {
|
||||
fileUploadRef.value.submitUpload().then((res) => {
|
||||
if (res == 'noFile') {
|
||||
proxy?.$modal.msgError('请上传文件');
|
||||
return;
|
||||
@ -629,6 +655,7 @@ const submitForm = () => {
|
||||
getList();
|
||||
});
|
||||
}
|
||||
}
|
||||
} catch (error) {
|
||||
proxy?.$modal.msgError('提交失败,请重试');
|
||||
} finally {
|
||||
@ -636,7 +663,14 @@ const submitForm = () => {
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
const editFormData = async () => {
|
||||
const res = await updateSupplierInput(form.value);
|
||||
if ((res.code = 200)) {
|
||||
proxy?.$modal.msgSuccess('操作成功');
|
||||
dialog.visible = false;
|
||||
getList();
|
||||
}
|
||||
};
|
||||
/** 删除操作 */
|
||||
const handleDelete = async (row?: SupplierInputVO) => {
|
||||
const _ids = row?.id || ids.value;
|
||||
|
Reference in New Issue
Block a user