Commit da553829 by 李君

搜索条件记录缓存

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