优化
This commit is contained in:
@@ -307,6 +307,20 @@
|
|||||||
<el-button type="primary" @click="addLineFun" :disabled="idEdit != 0">添加</el-button>
|
<el-button type="primary" @click="addLineFun" :disabled="idEdit != 0">添加</el-button>
|
||||||
</el-col>
|
</el-col>
|
||||||
</el-row>
|
</el-row>
|
||||||
|
<div class="addBox">
|
||||||
|
<div style="display: flex;align-items: center;">
|
||||||
|
<div class="addData" @click="addData">
|
||||||
|
<el-icon style="margin-right: 10px;" size="20"><FolderAdd /></el-icon>
|
||||||
|
添加至入库
|
||||||
|
</div>
|
||||||
|
<div @click="viewData" style="color: #000;text-decoration: underline;margin-left: 5px;">[已添加{{ outTempData.length }}条库存]</div>
|
||||||
|
<!-- <div @click="viewData" style="color: red;text-decoration: underline;font-weight: bold;">[凭证重复入库或项目已关闭,请点击查看!]</div> -->
|
||||||
|
</div>
|
||||||
|
<div v-show="outTempData.length > 0 && planList.length === outTempData.length" @click="deleteData" style="display: flex;align-items: center;color: var(--el-color-primary);">
|
||||||
|
<el-icon><delete /></el-icon>
|
||||||
|
<span>删除</span>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
<el-table :data="planList" height="400" style="width: 100%" show-overflow-tooltip
|
<el-table :data="planList" height="400" style="width: 100%" show-overflow-tooltip
|
||||||
:row-class-name="tableRowClassName" @selection-change="handleSelectionChange">
|
:row-class-name="tableRowClassName" @selection-change="handleSelectionChange">
|
||||||
<el-table-column type="selection" width="30" align="center" />
|
<el-table-column type="selection" width="30" align="center" />
|
||||||
@@ -666,7 +680,7 @@ const printNumList = ref([
|
|||||||
{ id: 3, statusName: "3" },
|
{ id: 3, statusName: "3" },
|
||||||
{ id: 4, statusName: "4" },
|
{ id: 4, statusName: "4" },
|
||||||
]);
|
]);
|
||||||
const printNum = ref(0); //打印机编号
|
const printNum = ref(1); //打印机编号
|
||||||
const moveReason = ref(""); //移库原因
|
const moveReason = ref(""); //移库原因
|
||||||
const operationTime = ref([]);
|
const operationTime = ref([]);
|
||||||
const actionUrl =
|
const actionUrl =
|
||||||
@@ -860,6 +874,7 @@ function handleAdd(single) {
|
|||||||
isSingle.value = single;
|
isSingle.value = single;
|
||||||
reset();
|
reset();
|
||||||
open.value = true;
|
open.value = true;
|
||||||
|
outTempData.value = []
|
||||||
title.value = "添加库存单据";
|
title.value = "添加库存单据";
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -880,6 +895,56 @@ const statusList = ref([
|
|||||||
{ value: 2, label: "部分入库" },
|
{ value: 2, label: "部分入库" },
|
||||||
]);
|
]);
|
||||||
const checkPlanList = ref([]); //已选中的要入库的数据
|
const checkPlanList = ref([]); //已选中的要入库的数据
|
||||||
|
|
||||||
|
// 点击添加至出库
|
||||||
|
const outTempData = ref([]);
|
||||||
|
function addData() {
|
||||||
|
if (checkPlanList.value.length == 0) {
|
||||||
|
proxy.$modal.msgError("请勾选数据");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
let data = outTempData.value.concat(checkPlanList.value);
|
||||||
|
let arr = []
|
||||||
|
let spaNoTotal = ''
|
||||||
|
const idList = []; // 用于统计每个id出现的次数
|
||||||
|
// 第一步:遍历数组,统计id出现次数
|
||||||
|
data.forEach(item => {
|
||||||
|
if (idList.includes(item.id)) {
|
||||||
|
spaNoTotal += item.sapNo + ','
|
||||||
|
} else {
|
||||||
|
arr.push(item)
|
||||||
|
idList.push(item.id);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
if (spaNoTotal) {
|
||||||
|
proxy.$modal.msgError("存在重复数据:" + spaNoTotal);
|
||||||
|
}
|
||||||
|
outTempData.value = arr
|
||||||
|
}
|
||||||
|
|
||||||
|
// 查看所有的出库数据
|
||||||
|
const viewData = () => {
|
||||||
|
planList.value = JSON.parse(JSON.stringify(outTempData.value));
|
||||||
|
}
|
||||||
|
|
||||||
|
// 删除选中的出库数据
|
||||||
|
const deleteData = () => {
|
||||||
|
if (checkPlanList.value.length == 0) {
|
||||||
|
proxy.$modal.msgError("请勾选数据");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
proxy.$modal.confirm("确认删除选中的出库数据吗?").then(() => {
|
||||||
|
const ids = checkPlanList.value.map(item => item.id);
|
||||||
|
console.log(ids)
|
||||||
|
planList.value = planList.value.filter(item => {
|
||||||
|
// 无id的元素默认保留(如果想删除无id的,可改为 item?.id && !arr2Ids.has(item.id))
|
||||||
|
return !ids.includes(item?.id);
|
||||||
|
});
|
||||||
|
outTempData.value = planList.value
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
//新增入库 多选框选中数据
|
//新增入库 多选框选中数据
|
||||||
function handleSelectionChange(selection) {
|
function handleSelectionChange(selection) {
|
||||||
checkPlanList.value = selection;
|
checkPlanList.value = selection;
|
||||||
@@ -972,6 +1037,10 @@ function addNum(row) {
|
|||||||
|
|
||||||
/** 确定入库按钮 */
|
/** 确定入库按钮 */
|
||||||
function submitForm() {
|
function submitForm() {
|
||||||
|
if (outTempData.value.length !== planList.value.length) {
|
||||||
|
proxy.$modal.msgError("请查看勾选数据");
|
||||||
|
return;
|
||||||
|
}
|
||||||
proxy.$refs["stockRef"].validate((valid) => {
|
proxy.$refs["stockRef"].validate((valid) => {
|
||||||
if (valid) {
|
if (valid) {
|
||||||
if (checkPlanList.value.length == 0) {
|
if (checkPlanList.value.length == 0) {
|
||||||
@@ -1790,4 +1859,20 @@ isAudit();
|
|||||||
display: flex;
|
display: flex;
|
||||||
justify-content: flex-end;
|
justify-content: flex-end;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
.addBox{
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: space-between;
|
||||||
|
margin-bottom: 10px;
|
||||||
|
cursor: pointer;
|
||||||
|
.addData {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
color: var(--el-text-color-regular);
|
||||||
|
font-weight: bold;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|||||||
@@ -65,11 +65,16 @@
|
|||||||
<el-input v-model="queryParams.gysMc" placeholder="请输入供应商名称" clearable @keyup.enter="handleQuery" />
|
<el-input v-model="queryParams.gysMc" placeholder="请输入供应商名称" clearable @keyup.enter="handleQuery" />
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
</el-col>
|
</el-col>
|
||||||
<el-col :span="12">
|
<el-col :span="16">
|
||||||
<el-form-item label="物料描述" prop="wlMs">
|
<el-form-item label="物料描述" prop="wlMs">
|
||||||
<el-input v-model="queryParams.wlMs" placeholder="请输入物料描述" clearable @keyup.enter="handleQuery" />
|
<el-input v-model="queryParams.wlMs" placeholder="请输入物料描述" clearable @keyup.enter="handleQuery" />
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
</el-col>
|
</el-col>
|
||||||
|
<el-col :span="16">
|
||||||
|
<el-form-item label="备注" prop="remark">
|
||||||
|
<el-input v-model="queryParams.remark" placeholder="请输入备注" clearable @keyup.enter="handleQuery" />
|
||||||
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
</el-row>
|
</el-row>
|
||||||
<el-row>
|
<el-row>
|
||||||
<el-col :span="12">
|
<el-col :span="12">
|
||||||
@@ -377,6 +382,7 @@ const data = reactive({
|
|||||||
cangku: "",
|
cangku: "",
|
||||||
wlMs: "",
|
wlMs: "",
|
||||||
ids: [],
|
ids: [],
|
||||||
|
remark: "",
|
||||||
},
|
},
|
||||||
rules: {
|
rules: {
|
||||||
wlType: [{ required: true, message: "物资类型不能为空", trigger: "change" }],
|
wlType: [{ required: true, message: "物资类型不能为空", trigger: "change" }],
|
||||||
|
|||||||
Reference in New Issue
Block a user