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