|
|
|
@ -270,8 +270,9 @@
|
|
|
|
|
<div class="el_multifunctional"> |
|
|
|
|
<el-input |
|
|
|
|
v-model="multifunctional" |
|
|
|
|
placeholder="请输入要搜索的值" |
|
|
|
|
placeholder="请输入要搜索的值,多条件用英文逗号拼接" |
|
|
|
|
clearable |
|
|
|
|
@clear='soclear' |
|
|
|
|
/> |
|
|
|
|
<el-button type="primary" @click="SearchFu" |
|
|
|
|
><el-icon><Plus /></el-icon>搜索</el-button |
|
|
|
@ -319,14 +320,13 @@
|
|
|
|
|
align="center" |
|
|
|
|
> |
|
|
|
|
<template #default="props"> |
|
|
|
|
<span :class="props.row[item.prop]=='state'?'.static-class':''">{{ props.row[item.prop] ? props.row[item.prop] : '/' }}</span> |
|
|
|
|
<span :id="props.row[item.prop]" :class="props.row[item.prop] == multifunctional && props.row[item.prop]? 'static-class' : ''">{{ |
|
|
|
|
props.row[item.prop] ? props.row[item.prop] : '/' |
|
|
|
|
}}</span> |
|
|
|
|
</template> |
|
|
|
|
</el-table-column> |
|
|
|
|
</template> |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<template v-if="item.type === 2"> |
|
|
|
|
<el-table-column |
|
|
|
|
v-if="item.head" |
|
|
|
@ -871,8 +871,10 @@ const isZeroTable = ref([]); //零担表格
|
|
|
|
|
const comprehensive = ref(false); //司机,零担弹窗 |
|
|
|
|
const QuantityEntryStatus = ref(false); //零担数量录入状态 |
|
|
|
|
const TCzj = ref(); //弹窗组件实例 |
|
|
|
|
const soInpuState = ref(false); //搜索框状态表示当前没有搜索 |
|
|
|
|
const statisticsList = ref([]); //需要统计的字段 |
|
|
|
|
const inputValue = ref('number'); //零担输入的值 |
|
|
|
|
const dataInfoID = ref(); //点击删除保存当前ID |
|
|
|
|
// 司机选择信息 |
|
|
|
|
// 车辆选项 |
|
|
|
|
// 备货人员 |
|
|
|
@ -1746,6 +1748,14 @@ function dataTabInfo() {
|
|
|
|
|
} |
|
|
|
|
// 点击新增获取在库订单信息 |
|
|
|
|
const AddInfo = () => { |
|
|
|
|
if (soInpuState.value) { |
|
|
|
|
ElMessage({ |
|
|
|
|
showClose: true, |
|
|
|
|
message: '请先重置搜索框值', |
|
|
|
|
type: 'warning', |
|
|
|
|
}); |
|
|
|
|
return; |
|
|
|
|
} |
|
|
|
|
dataTmp.value = []; |
|
|
|
|
console.log('提交前的参数', dataInfo.value); |
|
|
|
|
console.log('提交前前临时存储', dataTmp.value); |
|
|
|
@ -1872,9 +1882,134 @@ function removeDuplicates(arr) {
|
|
|
|
|
const ids = arr.map(obj => obj.id); |
|
|
|
|
return arr.filter((item, index) => ids.indexOf(item.id) === index); |
|
|
|
|
} |
|
|
|
|
const soclear=()=>{ |
|
|
|
|
|
|
|
|
|
SearchFu() |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
// function scrollToElementWithPartialId(partialId) { |
|
|
|
|
// // 首先清空之前所有元素的颜色样式 |
|
|
|
|
// document.querySelectorAll('[id]').forEach(function(el) { |
|
|
|
|
// el.style.backgroundColor = ''; // 移除背景颜色 |
|
|
|
|
// el.style.color = ''; // 移除文字颜色 |
|
|
|
|
// }); |
|
|
|
|
|
|
|
|
|
// // 现在开始搜索含有 partialId 的元素 |
|
|
|
|
// const allElements = document.querySelectorAll(`[id*="${partialId}"]`); |
|
|
|
|
// if (allElements.length > 0) { |
|
|
|
|
// // 获取第一个匹配的元素 |
|
|
|
|
// const targetElement = allElements[0]; |
|
|
|
|
// // 添加背景颜色和文字颜色 |
|
|
|
|
// targetElement.style.backgroundColor = '#ff0000'; // 设置背景颜色为红色 |
|
|
|
|
// targetElement.style.color = '#fff'; // 设置文字颜色为白色 |
|
|
|
|
// // 将匹配元素滚动到视野区域 |
|
|
|
|
// targetElement.scrollIntoView(); |
|
|
|
|
// } |
|
|
|
|
// } |
|
|
|
|
function scrollToElementWithinTableRow(partialIdString) { |
|
|
|
|
// 首先清空之前所有元素的颜色样式 |
|
|
|
|
const tableRows = document.querySelectorAll('tr'); |
|
|
|
|
tableRows.forEach(function(row) { |
|
|
|
|
const cells = row.querySelectorAll('[id]'); |
|
|
|
|
cells.forEach(function(cell) { |
|
|
|
|
cell.style.backgroundColor = '#ffffff'; // 移除背景颜色 |
|
|
|
|
cell.style.color = '#000'; // 移除文字颜色 |
|
|
|
|
}); |
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|
// 将输入的逗号分隔的字符串拆分成数组 |
|
|
|
|
const partialIds = partialIdString.split(',').map(id => id.trim()); |
|
|
|
|
// 通过遍历每一行来检查是否每一个partialId都存在 |
|
|
|
|
for (let row of tableRows) { |
|
|
|
|
// 检查这一行是否包含所有的partialIds |
|
|
|
|
if (partialIds.every(partialId => row.querySelector(`[id*="${partialId}"]`))) { |
|
|
|
|
// 如果匹配,设置背景颜色和文字颜色 |
|
|
|
|
const cells = row.querySelectorAll('[id]'); |
|
|
|
|
cells.forEach(function(cell) { |
|
|
|
|
cell.style.backgroundColor = ''; // 设置背景颜色为红色 |
|
|
|
|
cell.style.color = ''; // 设置文字颜色为白色 |
|
|
|
|
}); |
|
|
|
|
// 将这一行滚动到视野区域 |
|
|
|
|
row.scrollIntoView(); |
|
|
|
|
break; // 匹配到了就跳出循环 |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
// 编辑多功能搜索 |
|
|
|
|
const SearchFu = () => { |
|
|
|
|
if(multifunctional.value){ |
|
|
|
|
scrollToElementWithinTableRow(multifunctional.value) |
|
|
|
|
}else{ |
|
|
|
|
document.querySelectorAll('[id]').forEach(function(el) { |
|
|
|
|
el.style.backgroundColor = ''; // 移除背景颜色 |
|
|
|
|
el.style.color =''; // 移除文字颜色 |
|
|
|
|
}); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
return |
|
|
|
|
if(multifunctional.value){ |
|
|
|
|
document.getElementById(multifunctional.value).scrollIntoView() |
|
|
|
|
} |
|
|
|
|
return |
|
|
|
|
console.log(soInpuState.value, '当前搜索状态'); |
|
|
|
|
if (!multifunctional.value && !dataInfoTemp.value.length) { |
|
|
|
|
soInpuState.value = false; //重置搜索状态 |
|
|
|
|
ElMessage({ |
|
|
|
|
showClose: true, |
|
|
|
|
message: '请输入搜索内容', |
|
|
|
|
type: 'warning', |
|
|
|
|
}); |
|
|
|
|
return; |
|
|
|
|
} |
|
|
|
|
if (!multifunctional.value && dataInfoTemp.value.length) { |
|
|
|
|
//这里是回复初始内容 |
|
|
|
|
soInpuState.value = false; //重置搜索状态 |
|
|
|
|
dataInfo.value = JSON.parse(JSON.stringify(dataInfoTemp.value)); |
|
|
|
|
dataInfoTemp.value = []; |
|
|
|
|
} |
|
|
|
|
if (soInpuState.value) { |
|
|
|
|
ElMessage({ |
|
|
|
|
showClose: true, |
|
|
|
|
message: '请先重置数据', |
|
|
|
|
type: 'warning', |
|
|
|
|
}); |
|
|
|
|
return; |
|
|
|
|
} else { |
|
|
|
|
//当前状态默认为假,如果是假可以搜索 |
|
|
|
|
console.log('多功能搜索功能'); |
|
|
|
|
console.log(dataInfo.value, '当前订单'); |
|
|
|
|
dataInfoTemp.value = dataInfo.value; //先存储一个完整的值 |
|
|
|
|
let temp = dataInfo.value.filter(item => { |
|
|
|
|
return Object.values(item).some(val => { |
|
|
|
|
if (typeof val === 'string') { |
|
|
|
|
return val.includes(multifunctional.value); |
|
|
|
|
} |
|
|
|
|
return false; |
|
|
|
|
}); |
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|
console.log(temp, '搜索结果'); |
|
|
|
|
console.log(dataInfoTemp.value,'临时存储的值'); |
|
|
|
|
dataInfo.value = temp; //如果搜索到了值才赋值 |
|
|
|
|
soInpuState.value = false; //表示当前已经搜索过了 |
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
// console.log(dataInfo.value, '搜索结果'); |
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
// 删除触发事件 |
|
|
|
|
const DeleteEvent = val => { |
|
|
|
|
dataInfoID.value = val; //存储一份临时数据 |
|
|
|
|
if (dataInfoTemp.value.length) { |
|
|
|
|
//删除拷贝的数据里面如果执行这个表示当前已经是搜索过了,在执行搜索里面的值 |
|
|
|
|
const index = dataInfoTemp.value.findIndex(item => item.id === val.id); |
|
|
|
|
if (index !== -1) { |
|
|
|
|
dataInfoTemp.value.splice(index, 1); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
console.log(dataInfoID.value, '当前删除的数据'); |
|
|
|
|
// 接收点击删除当前行数据 |
|
|
|
|
const index = dataInfo.value.findIndex(item => item.id === val.id); |
|
|
|
|
if (index !== -1) { |
|
|
|
@ -1995,28 +2130,6 @@ const Entering = val => {
|
|
|
|
|
}); |
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
// 编辑多功能搜索 |
|
|
|
|
const SearchFu = () => { |
|
|
|
|
console.log('多功能搜索功能'); |
|
|
|
|
console.log(dataInfo.value, '当前订单'); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
let st= dataInfo.value.filter(item => { |
|
|
|
|
return Object.values(item).some(val => { |
|
|
|
|
if (typeof val === 'string') { |
|
|
|
|
return val.includes(multifunctional.value); |
|
|
|
|
} |
|
|
|
|
return false; |
|
|
|
|
}); |
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|
st.forEach(item=>{ |
|
|
|
|
item.state=true; |
|
|
|
|
}) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
console.log(st, '搜索结果'); |
|
|
|
|
}; |
|
|
|
|
// 数量录入 |
|
|
|
|
const QuantityEntry = val => { |
|
|
|
|
dataId.value = findIndexById(val.id); //记录当前点击的订单 |
|
|
|
@ -2995,7 +3108,12 @@ const SubmitCommercial = () => {
|
|
|
|
|
width: 100px; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
.static-class { |
|
|
|
|
background-color: seagreen; |
|
|
|
|
padding: 0 4px; |
|
|
|
|
scroll-behavior: smooth; |
|
|
|
|
background-color: #ff0000; |
|
|
|
|
color: #fff; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
</style> |
|
|
|
|