Commit da553829 by 李君

搜索条件记录缓存

1 parent 3655c8db
...@@ -15,7 +15,7 @@ const axiosInstance = axios.create( ...@@ -15,7 +15,7 @@ const axiosInstance = axios.create(
axiosInstance.interceptors.request.use( axiosInstance.interceptors.request.use(
config => { config => {
// Cookies.set('atoken','c36c9a2e-67bf-450c-ad31-2e334fe2f76f') // Cookies.set('atoken','718de41a-617b-4cc8-a6ae-ca3acce9b62e')
if(!Cookies.get('atoken')){ if(!Cookies.get('atoken')){
ElMessage({ ElMessage({
message: `登录过期,请重新登录`, message: `登录过期,请重新登录`,
......
...@@ -202,6 +202,20 @@ ...@@ -202,6 +202,20 @@
minPic:'', minPic:'',
maxPic:'', maxPic:'',
}) })
const searchCondition = ref({})
if(window.localStorage.getItem('searchCondition')){
searchCondition.value = JSON.parse(window.localStorage.getItem('searchCondition'));
queryForm.type = searchCondition.value.type;
queryForm.zone_id = searchCondition.value.zone_id;
queryForm.gate_id = searchCondition.value.gate_id;
queryForm.direction = searchCondition.value.direction;
queryForm.picType = searchCondition.value.picType;
queryForm.date = searchCondition.value.date;
queryForm.startTime = searchCondition.value.startTime;
queryForm.endTime = searchCondition.value.endTime;
queryForm.minPic = searchCondition.value.minPic||0;
queryForm.maxPic = searchCondition.value.maxPic||100;
}
// function // function
const onPageNumChange = function(num) { const onPageNumChange = function(num) {
pageNum.value = num pageNum.value = num
...@@ -215,7 +229,7 @@ ...@@ -215,7 +229,7 @@
} }
const onAccountChange = function() { const onAccountChange = function() {
getPlazaList() getPlazaList(1)
// getZoneList() // getZoneList()
// getGateList() // getGateList()
} }
...@@ -229,7 +243,7 @@ ...@@ -229,7 +243,7 @@
getGateList() getGateList()
} }
const getPlazaList = function() { const getPlazaList = function(val) {
queryForm.plaza_id = [] queryForm.plaza_id = []
plazaList.value = [] plazaList.value = []
snapshotRecordApi.getPlazaList({ snapshotRecordApi.getPlazaList({
...@@ -244,9 +258,13 @@ ...@@ -244,9 +258,13 @@
}) })
} }
if(plazaList.value.length>0){ if(plazaList.value.length>0){
if(!val&&searchCondition.value.plaza_id && searchCondition.value.plaza_id.length>0){
queryForm.plaza_id = searchCondition.value.plaza_id
}else{
queryForm.plaza_id.push(plazaList.value[0].value) queryForm.plaza_id.push(plazaList.value[0].value)
getZoneList() }
getGateList() getZoneList(1)
getGateList(1)
confirmSearch() confirmSearch()
} }
} }
...@@ -254,8 +272,7 @@ ...@@ -254,8 +272,7 @@
) )
} }
const getZoneList = function() { const getZoneList = function(val) {
queryForm.zone_id = []
zoneList.value = [] zoneList.value = []
snapshotRecordApi.getZoneList({ snapshotRecordApi.getZoneList({
account_id: queryForm.account_id.toString(), account_id: queryForm.account_id.toString(),
...@@ -269,12 +286,21 @@ ...@@ -269,12 +286,21 @@
label: item.name, label: item.name,
}) })
} }
if(zoneList.value.length){
if(val&&searchCondition.value.zone_id && searchCondition.value.zone_id.length>0){
queryForm.zone_id = searchCondition.value.zone_id
}else{
queryForm.zone_id = []
}
}else{
queryForm.zone_id = []
}
} }
} }
) )
} }
const getGateList = function() { const getGateList = function(val) {
queryForm.gate_id = [] queryForm.gate_id = []
gateList.value = [] gateList.value = []
snapshotRecordApi.getGateList({ snapshotRecordApi.getGateList({
...@@ -291,6 +317,15 @@ ...@@ -291,6 +317,15 @@
label: item.name, label: item.name,
}) })
} }
if(gateList.value.length){
if(val&&searchCondition.value.gate_id && searchCondition.value.gate_id.length>0){
queryForm.gate_id = searchCondition.value.gate_id
}else{
queryForm.gate_id = []
}
}else{
queryForm.gate_id = []
}
} }
} }
) )
...@@ -309,8 +344,12 @@ ...@@ -309,8 +344,12 @@
}) })
} }
if(accountList.value.length){ if(accountList.value.length){
if(searchCondition.value.account_id && searchCondition.value.account_id.length>0){
queryForm.account_id = searchCondition.value.account_id
}else{
queryForm.account_id.push(accountList.value[0].value) queryForm.account_id.push(accountList.value[0].value)
getPlazaList(1) }
getPlazaList()
} }
} }
} }
...@@ -345,7 +384,24 @@ ...@@ -345,7 +384,24 @@
page: pageNum.value - 1, page: pageNum.value - 1,
pageSize: pageSize.value, pageSize: pageSize.value,
}) })
const storageData = filterEmptyValueInObject(
{
account_id: rawData.account_id,
type: rawData.type,
plaza_id: rawData.plaza_id,
zone_id: rawData.zone_id,
gate_id: rawData.gate_id,
direction: rawData.direction,
picType: rawData.picType,
personType: rawData.personType,
date: rawData.date,
minPic: rawData.minPic,
maxPic: rawData.maxPic,
startTime: formatDate(rawData.date) + ' ' + formatTime(rawData.startTime),
endTime: formatDate(rawData.date) + ' ' + formatTime(rawData.endTime),
}
)
window.localStorage.setItem('searchCondition',JSON.stringify(storageData))
comparsionResultApi.getPersonGroupList(data).then( comparsionResultApi.getPersonGroupList(data).then(
(r) => { (r) => {
isLoading.value = false isLoading.value = false
......
...@@ -199,6 +199,18 @@ ...@@ -199,6 +199,18 @@
startTime: moment('00:00:00', 'HH:mm:ss'), startTime: moment('00:00:00', 'HH:mm:ss'),
endTime: moment('23:59:59', 'HH:mm:ss'), endTime: moment('23:59:59', 'HH:mm:ss'),
}) })
const searchCondition = ref({})
if(window.localStorage.getItem('searchCondition')){
searchCondition.value = JSON.parse(window.localStorage.getItem('searchCondition'));
queryForm.type = searchCondition.value.type;
queryForm.zone_id = searchCondition.value.zone_id;
queryForm.gate_id = searchCondition.value.gate_id;
queryForm.direction = searchCondition.value.direction;
queryForm.picType = searchCondition.value.picType;
queryForm.date = searchCondition.value.date;
queryForm.startTime = searchCondition.value.startTime;
queryForm.endTime = searchCondition.value.endTime;
}
// function // function
const onPageNumChange = function(num) { const onPageNumChange = function(num) {
pageNum.value = num pageNum.value = num
...@@ -212,21 +224,21 @@ ...@@ -212,21 +224,21 @@
} }
const onAccountChange = function() { const onAccountChange = function() {
getPlazaList() getPlazaList(1)
// getZoneList() // getZoneList()
// getGateList() // getGateList()
} }
const onPlazaChange = function() { const onPlazaChange = function() {
getZoneList() getZoneList(1)
getGateList() getGateList(1)
} }
const onZoneChange = function() { const onZoneChange = function() {
getGateList() getGateList()
} }
const getPlazaList = function() { const getPlazaList = function(val) {
queryForm.plaza_id = [] queryForm.plaza_id = []
plazaList.value = [] plazaList.value = []
snapshotRecordApi.getPlazaList({ snapshotRecordApi.getPlazaList({
...@@ -241,9 +253,13 @@ ...@@ -241,9 +253,13 @@
}) })
} }
if(plazaList.value.length>0){ if(plazaList.value.length>0){
if(!val&&searchCondition.value.plaza_id && searchCondition.value.plaza_id.length>0){
queryForm.plaza_id = searchCondition.value.plaza_id
}else{
queryForm.plaza_id.push(plazaList.value[0].value) queryForm.plaza_id.push(plazaList.value[0].value)
getZoneList() }
getGateList() getZoneList(1)
getGateList(1)
confirmSearch() confirmSearch()
} }
} }
...@@ -251,7 +267,7 @@ ...@@ -251,7 +267,7 @@
) )
} }
const getZoneList = function() { const getZoneList = function(val) {
queryForm.zone_id = [] queryForm.zone_id = []
zoneList.value = [] zoneList.value = []
snapshotRecordApi.getZoneList({ snapshotRecordApi.getZoneList({
...@@ -266,12 +282,21 @@ ...@@ -266,12 +282,21 @@
label: item.name, label: item.name,
}) })
} }
if(zoneList.value.length){
if(val&&searchCondition.value.zone_id && searchCondition.value.zone_id.length>0){
queryForm.zone_id = searchCondition.value.zone_id
}else{
queryForm.zone_id = []
}
}else{
queryForm.zone_id = []
}
} }
} }
) )
} }
const getGateList = function() { const getGateList = function(val) {
queryForm.gate_id = [] queryForm.gate_id = []
gateList.value = [] gateList.value = []
snapshotRecordApi.getGateList({ snapshotRecordApi.getGateList({
...@@ -288,6 +313,15 @@ ...@@ -288,6 +313,15 @@
label: item.name, label: item.name,
}) })
} }
if(gateList.value.length){
if(val&&searchCondition.value.gate_id && searchCondition.value.gate_id.length>0){
queryForm.gate_id = searchCondition.value.gate_id
}else{
queryForm.gate_id = []
}
}else{
queryForm.gate_id = []
}
} }
} }
) )
...@@ -306,8 +340,12 @@ ...@@ -306,8 +340,12 @@
}) })
} }
if(accountList.value.length){ if(accountList.value.length){
if(searchCondition.value.account_id && searchCondition.value.account_id.length>0){
queryForm.account_id = searchCondition.value.account_id
}else{
queryForm.account_id.push(accountList.value[0].value) queryForm.account_id.push(accountList.value[0].value)
getPlazaList(1) }
getPlazaList()
} }
} }
} }
...@@ -317,6 +355,7 @@ ...@@ -317,6 +355,7 @@
const confirmSearch = function() { const confirmSearch = function() {
isLoading.value = true isLoading.value = true
const rawData = toRaw(queryForm) const rawData = toRaw(queryForm)
console.log(rawData)
const data = filterEmptyValueInObject({ const data = filterEmptyValueInObject({
account_id: rawData.account_id.toString(), account_id: rawData.account_id.toString(),
type: rawData.type, type: rawData.type,
...@@ -326,13 +365,27 @@ ...@@ -326,13 +365,27 @@
direction: rawData.direction.toString(), direction: rawData.direction.toString(),
picType: rawData.picType, picType: rawData.picType,
personType: rawData.personType.toString(), personType: rawData.personType.toString(),
startTime: formatDate(rawData.date) + ' ' + formatTime(rawData.startTime), startTime: formatDate(rawData.date) + ' ' + formatTime(rawData.startTime),
endTime: formatDate(rawData.date) + ' ' + formatTime(rawData.endTime), endTime: formatDate(rawData.date) + ' ' + formatTime(rawData.endTime),
page: pageNum.value - 1, page: pageNum.value - 1,
pageSize: pageSize.value, pageSize: pageSize.value,
}) })
const storageData = filterEmptyValueInObject(
{
account_id: rawData.account_id,
type: rawData.type,
plaza_id: rawData.plaza_id,
zone_id: rawData.zone_id,
gate_id: rawData.gate_id,
direction: rawData.direction,
picType: rawData.picType,
personType: rawData.personType,
date: rawData.date,
startTime: formatDate(rawData.date) + ' ' + formatTime(rawData.startTime),
endTime: formatDate(rawData.date) + ' ' + formatTime(rawData.endTime),
}
)
window.localStorage.setItem('searchCondition',JSON.stringify(storageData))
snapshotRecordApi.getSnapshotRecordList(data).then( snapshotRecordApi.getSnapshotRecordList(data).then(
(r) => { (r) => {
isLoading.value = false isLoading.value = false
......
...@@ -222,6 +222,20 @@ export default { ...@@ -222,6 +222,20 @@ export default {
maxPic: 100, maxPic: 100,
} }
) )
const searchCondition = ref({})
if(window.localStorage.getItem('searchCondition')){
searchCondition.value = JSON.parse(window.localStorage.getItem('searchCondition'));
queryForm.type = searchCondition.value.type;
queryForm.zone_id = searchCondition.value.zone_id;
queryForm.gate_id = searchCondition.value.gate_id;
queryForm.direction = searchCondition.value.direction;
queryForm.picType = searchCondition.value.picType;
queryForm.date = searchCondition.value.date;
queryForm.startTime = searchCondition.value.startTime;
queryForm.endTime = searchCondition.value.endTime;
queryForm.minPic = searchCondition.value.minPic||0;
queryForm.maxPic = searchCondition.value.maxPic||100;
}
// function // function
const onPageNumChange = function(num) { const onPageNumChange = function(num) {
pageNum.value = num pageNum.value = num
...@@ -235,7 +249,7 @@ export default { ...@@ -235,7 +249,7 @@ export default {
} }
const onAccountChange = function() { const onAccountChange = function() {
getPlazaList() getPlazaList(1)
// getZoneList() // getZoneList()
// getGateList() // getGateList()
} }
...@@ -249,7 +263,7 @@ export default { ...@@ -249,7 +263,7 @@ export default {
getGateList() getGateList()
} }
const getPlazaList = function() { const getPlazaList = function(val) {
queryForm.plaza_id = [] queryForm.plaza_id = []
plazaList.value = [] plazaList.value = []
clusterResultApi.getPlazaList( clusterResultApi.getPlazaList(
...@@ -270,9 +284,13 @@ export default { ...@@ -270,9 +284,13 @@ export default {
) )
} }
if(plazaList.value.length>0){ if(plazaList.value.length>0){
if(!val&&searchCondition.value.plaza_id && searchCondition.value.plaza_id.length>0){
queryForm.plaza_id = searchCondition.value.plaza_id
}else{
queryForm.plaza_id.push(plazaList.value[0].value) queryForm.plaza_id.push(plazaList.value[0].value)
getZoneList() }
getGateList() getZoneList(1)
getGateList(1)
confirmSearch() confirmSearch()
} }
} }
...@@ -280,8 +298,7 @@ export default { ...@@ -280,8 +298,7 @@ export default {
) )
} }
const getZoneList = function() { const getZoneList = function(val) {
queryForm.zone_id = []
zoneList.value = [] zoneList.value = []
clusterResultApi.getZoneList( clusterResultApi.getZoneList(
{ {
...@@ -301,13 +318,21 @@ export default { ...@@ -301,13 +318,21 @@ export default {
} }
) )
} }
if(zoneList.value.length){
if(val&&searchCondition.value.zone_id && searchCondition.value.zone_id.length>0){
queryForm.zone_id = searchCondition.value.zone_id
}else{
queryForm.zone_id = []
}
}else{
queryForm.zone_id = []
}
} }
} }
) )
} }
const getGateList = function() { const getGateList = function(val) {
queryForm.gate_id = []
gateList.value = [] gateList.value = []
clusterResultApi.getGateList( clusterResultApi.getGateList(
{ {
...@@ -329,6 +354,15 @@ export default { ...@@ -329,6 +354,15 @@ export default {
} }
) )
} }
if(gateList.value.length){
if(val&&searchCondition.value.gate_id && searchCondition.value.gate_id.length>0){
queryForm.gate_id = searchCondition.value.gate_id
}else{
queryForm.gate_id = []
}
}else{
queryForm.gate_id = []
}
} }
} }
) )
...@@ -351,8 +385,12 @@ export default { ...@@ -351,8 +385,12 @@ export default {
) )
} }
if(accountList.value.length){ if(accountList.value.length){
if(searchCondition.value.account_id && searchCondition.value.account_id.length>0){
queryForm.account_id = searchCondition.value.account_id
}else{
queryForm.account_id.push(accountList.value[0].value) queryForm.account_id.push(accountList.value[0].value)
getPlazaList(1) }
getPlazaList()
} }
} }
} }
...@@ -380,7 +418,24 @@ export default { ...@@ -380,7 +418,24 @@ export default {
pageSize: pageSize.value, pageSize: pageSize.value,
} }
) )
const storageData = filterEmptyValueInObject(
{
account_id: rawData.account_id,
type: rawData.type,
plaza_id: rawData.plaza_id,
zone_id: rawData.zone_id,
gate_id: rawData.gate_id,
direction: rawData.direction,
picType: rawData.picType,
personType: rawData.personType,
date: rawData.date,
minPic: rawData.minPic,
maxPic: rawData.maxPic,
startTime: formatDate(rawData.date) + ' ' + formatTime(rawData.startTime),
endTime: formatDate(rawData.date) + ' ' + formatTime(rawData.endTime),
}
)
window.localStorage.setItem('searchCondition',JSON.stringify(storageData))
clusterResultApi.getClusterResultList(data).then( clusterResultApi.getClusterResultList(data).then(
(r) => { (r) => {
isLoading.value = false isLoading.value = false
......
...@@ -193,6 +193,18 @@ export default { ...@@ -193,6 +193,18 @@ export default {
endTime: moment('23:59:59', 'HH:mm:ss'), endTime: moment('23:59:59', 'HH:mm:ss'),
} }
) )
const searchCondition = ref({})
if(window.localStorage.getItem('searchCondition')){
searchCondition.value = JSON.parse(window.localStorage.getItem('searchCondition'));
queryForm.type = searchCondition.value.type;
queryForm.zone_id = searchCondition.value.zone_id;
queryForm.gate_id = searchCondition.value.gate_id;
queryForm.direction = searchCondition.value.direction;
queryForm.picType = searchCondition.value.picType;
queryForm.date = searchCondition.value.date;
queryForm.startTime = searchCondition.value.startTime;
queryForm.endTime = searchCondition.value.endTime;
}
// function // function
const onPageNumChange = function(num) { const onPageNumChange = function(num) {
pageNum.value = num pageNum.value = num
...@@ -206,7 +218,7 @@ export default { ...@@ -206,7 +218,7 @@ export default {
} }
const onAccountChange = function() { const onAccountChange = function() {
getPlazaList() getPlazaList(1)
// getZoneList() // getZoneList()
// getGateList() // getGateList()
} }
...@@ -220,7 +232,7 @@ export default { ...@@ -220,7 +232,7 @@ export default {
getGateList() getGateList()
} }
const getPlazaList = function() { const getPlazaList = function(val) {
queryForm.plaza_id = [] queryForm.plaza_id = []
plazaList.value = [] plazaList.value = []
snapshotRecordApi.getPlazaList( snapshotRecordApi.getPlazaList(
...@@ -229,10 +241,8 @@ export default { ...@@ -229,10 +241,8 @@ export default {
} }
).then( ).then(
(r) => { (r) => {
if (isArray(r)) if (isArray(r)){
{ for (const item of r){
for (const item of r)
{
plazaList.value.push( plazaList.value.push(
{ {
value: item.id, value: item.id,
...@@ -241,9 +251,13 @@ export default { ...@@ -241,9 +251,13 @@ export default {
) )
} }
if(plazaList.value.length){ if(plazaList.value.length){
if(!val&&searchCondition.value.plaza_id && searchCondition.value.plaza_id.length>0){
queryForm.plaza_id = searchCondition.value.plaza_id
}else{
queryForm.plaza_id.push(plazaList.value[0].value) queryForm.plaza_id.push(plazaList.value[0].value)
getZoneList() }
getGateList() getZoneList(1)
getGateList(1)
confirmSearch() confirmSearch()
} }
} }
...@@ -251,7 +265,7 @@ export default { ...@@ -251,7 +265,7 @@ export default {
) )
} }
const getZoneList = function() { const getZoneList = function(val) {
queryForm.zone_id = [] queryForm.zone_id = []
zoneList.value = [] zoneList.value = []
snapshotRecordApi.getZoneList( snapshotRecordApi.getZoneList(
...@@ -272,13 +286,21 @@ export default { ...@@ -272,13 +286,21 @@ export default {
} }
) )
} }
if(zoneList.value.length){
if(val&&searchCondition.value.zone_id && searchCondition.value.zone_id.length>0){
queryForm.zone_id = searchCondition.value.zone_id
}else{
queryForm.zone_id = []
}
}else{
queryForm.zone_id = []
}
} }
} }
) )
} }
const getGateList = function() { const getGateList = function(val) {
queryForm.gate_id = []
gateList.value = [] gateList.value = []
snapshotRecordApi.getGateList( snapshotRecordApi.getGateList(
{ {
...@@ -300,6 +322,15 @@ export default { ...@@ -300,6 +322,15 @@ export default {
} }
) )
} }
if(gateList.value.length){
if(val&&searchCondition.value.gate_id && searchCondition.value.gate_id.length>0){
queryForm.gate_id = searchCondition.value.gate_id
}else{
queryForm.gate_id = []
}
}else{
queryForm.gate_id = []
}
} }
} }
) )
...@@ -322,8 +353,12 @@ export default { ...@@ -322,8 +353,12 @@ export default {
) )
} }
if(accountList.value.length){ if(accountList.value.length){
if(searchCondition.value.account_id && searchCondition.value.account_id.length>0){
queryForm.account_id = searchCondition.value.account_id
}else{
queryForm.account_id.push(accountList.value[0].value) queryForm.account_id.push(accountList.value[0].value)
getPlazaList(1) }
getPlazaList()
} }
} }
} }
...@@ -343,14 +378,28 @@ export default { ...@@ -343,14 +378,28 @@ export default {
direction: rawData.direction.toString(), direction: rawData.direction.toString(),
picType: rawData.picType, picType: rawData.picType,
personType: rawData.personType.toString(), personType: rawData.personType.toString(),
startTime: formatDate(rawData.date) + ' ' + formatTime(rawData.startTime), startTime: formatDate(rawData.date) + ' ' + formatTime(rawData.startTime),
endTime: formatDate(rawData.date) + ' ' + formatTime(rawData.endTime), endTime: formatDate(rawData.date) + ' ' + formatTime(rawData.endTime),
page: pageNum.value - 1, page: pageNum.value - 1,
pageSize: pageSize.value, pageSize: pageSize.value,
} }
) )
const storageData = filterEmptyValueInObject(
{
account_id: rawData.account_id,
type: rawData.type,
plaza_id: rawData.plaza_id,
zone_id: rawData.zone_id,
gate_id: rawData.gate_id,
direction: rawData.direction,
picType: rawData.picType,
personType: rawData.personType,
date: rawData.date,
startTime: formatDate(rawData.date) + ' ' + formatTime(rawData.startTime),
endTime: formatDate(rawData.date) + ' ' + formatTime(rawData.endTime),
}
)
window.localStorage.setItem('searchCondition',JSON.stringify(storageData))
snapshotRecordApi.getSnapshotRecordList(data).then( snapshotRecordApi.getSnapshotRecordList(data).then(
(r) => { (r) => {
isLoading.value = false isLoading.value = false
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!