搜索字段用null会报错

This commit is contained in:
邓皓元 2019-02-22 17:37:58 +08:00
parent a665c0acb3
commit c5039efba8
17 changed files with 67 additions and 62 deletions

View File

@ -16,7 +16,8 @@ export default {
},
methods: {
handleComplete(array, value = '', key = 'name', indexKey = 'id') {
if (value === '') {
if (value === '' || value === null) {
console.log(array);
return array;
}

View File

@ -103,7 +103,7 @@ export default {
Object.assign(data, this.parseTime(init_options.time));
}
} else {
if (init_options[k] !== '' || init_options[k] !== undefined) {
if (init_options[k] !== '' && init_options[k] !== undefined && init_options[k] !== null) {
data[k] = init_options[k];
}
}

View File

@ -7,8 +7,8 @@ export default {
show: false
},
options: {
name: null,
time: null
name: '',
time: ''
},
data: [],
list: [],
@ -104,7 +104,7 @@ export default {
resetSearch() {
for (let k in this.options) {
this.options[k] = null;
this.options[k] = '';
}
this.index();

View File

@ -17,8 +17,8 @@ export default {
},
types: [],
options: {
company_name: null,
package_name: null,
company_name: '',
package_name: '',
type: [],
month: this.moment().subtract('2', 'months').startOf('month').format('YYYY-MM')
},
@ -227,7 +227,7 @@ export default {
} else if (k === 'type') {
this.options[k] = [];
} else {
this.options[k] = null;
this.options[k] = '';
}
}

View File

@ -16,9 +16,9 @@ export default {
options: {}
},
options: {
company_name: null,
package_name: null,
pay_channel: null,
company_name: '',
package_name: '',
pay_channel: '',
time: [
this.moment().subtract('2', 'months').startOf('month').format('YYYY-MM-DD'),
this.moment().subtract('2', 'months').endOf('month').format('YYYY-MM-DD')
@ -191,7 +191,7 @@ export default {
this.moment().subtract('2', 'months').endOf('month').format('YYYY-MM-DD')
];
} else {
this.options[k] = null;
this.options[k] = '';
}
}

View File

@ -35,7 +35,7 @@ export default{
my_show: false,
params: {
type: 0,
parent_id: null,
parent_id: '',
name: '',
title: '',
description: '',
@ -196,8 +196,6 @@ export default{
this.params[k] = 0;
} else if (k == 'status') {
this.params[k] = 1;
} else if (k == 'parent_id') {
this.params[k] = null;
} else {
this.params[k] = '';
}

View File

@ -1,7 +1,9 @@
import * as API from 'api/base/permissions';
import { isIntNum } from 'validate';
import {
isIntNum
} from 'validate';
export default{
export default {
name: 'Permissions',
components: {
UiEdit: resolve => require(['views/system/permissions/edit'], resolve)
@ -97,9 +99,9 @@ export default{
},
/**
* [openIcon 选择图标]
* @return {[type]} [description]
*/
* [openIcon 选择图标]
* @return {[type]} [description]
*/
openIcon() {
this.iconObj = {
show: true,
@ -115,10 +117,10 @@ export default{
},
/**
* [selectIconSuccess 图标选择成功触发事件]
* @param {[type]} icon [description]
* @return {[type]} [description]
*/
* [selectIconSuccess 图标选择成功触发事件]
* @param {[type]} icon [description]
* @return {[type]} [description]
*/
selectIconSuccess(icon) {
this.params.icon = icon;
},
@ -138,9 +140,9 @@ export default{
},
/**
* [destroy 批量删除]
* @return {[type]} [description]
*/
* [destroy 批量删除]
* @return {[type]} [description]
*/
destroy() {
let ids = [];
if (!this.checked.length) {
@ -155,7 +157,9 @@ export default{
ids.push(item.id);
});
API.destroy({ ids: ids.join(',') }).then(res => {
API.destroy({
ids: ids.join(',')
}).then(res => {
if (res.code == 0) {
// 如果删除的是包含当前编辑项,清空编辑项
if (ids.includes(this.id)) {
@ -242,17 +246,15 @@ export default{
},
/**
* [clear 清空]
* @return {[type]} [description]
*/
* [clear 清空]
* @return {[type]} [description]
*/
clear() {
for (let k in this.params) {
if (['type', 'displayorder', 'open', 'height', 'width'].includes(k)) {
this.params[k] = 0;
} else if (k == 'status') {
this.params[k] = 1;
} else if (k == 'parent_id') {
this.params[k] = null;
} else {
this.params[k] = '';
}

View File

@ -8,12 +8,12 @@ export default {
data() {
return {
params: {
'id': null,
'sim': null,
'company_name': null,
'package_name': null,
'carrier_operator': null,
'time': []
id: '',
sim: '',
company_name: '',
package_name: '',
carrier_operator: '',
time: []
},
list_data: null,
detailObj: {
@ -161,7 +161,7 @@ export default {
if (k === 'time') {
this.params[k] = [];
} else {
this.params[k] = null;
this.params[k] = '';
}
}
this.index(1);

View File

@ -9,9 +9,9 @@ export default {
data() {
return {
options: {
company_name: null,
name: null,
carrier_operator: null,
company_name: '',
name: '',
carrier_operator: '',
month: this.moment().subtract('2', 'months').startOf('month').format('YYYY-MM')
},
list_data: null,
@ -350,7 +350,7 @@ export default {
if (k === 'month') {
this.options[k] = this.moment().subtract('2', 'months').startOf('month').format('YYYY-MM');
} else {
this.options[k] = null;
this.options[k] = '';
}
}

View File

@ -10,11 +10,11 @@ export default {
return {
params: {
type: 0,
sn: null,
company_name: null,
package_name: null,
order_status: null,
carrier_operator: null,
sn: '',
company_name: '',
package_name: '',
order_status: '',
carrier_operator: '',
time: []
},
list_data: null,
@ -550,7 +550,7 @@ export default {
if (k === 'time') {
this.params[k] = [];
} else {
this.params[k] = null;
this.params[k] = '';
}
}
this.index(1);

View File

@ -7,9 +7,9 @@ export default {
data() {
return {
params: {
name: null,
carrier_operator: null,
sn: null
name: '',
carrier_operator: '',
sn: ''
},
type: 0,
trashed: null,
@ -229,7 +229,7 @@ export default {
resetSearch() {
for (let k in this.params) {
this.params[k] = null;
this.params[k] = '';
}
this.trashed = null;
this.index(1);

View File

@ -8,10 +8,10 @@ export default {
data() {
return {
params: {
company_id: null,
carrier_operator: null,
name: null,
package_name: null
company_id: '',
carrier_operator: '',
name: '',
package_name: ''
},
editObj: {
show: false,
@ -213,9 +213,7 @@ export default {
},
resetSearch() {
for (let k in this.params) {
if (k !== 'company_id') {
this.params[k] = null;
}
this.params[k] = '';
}
this.index();
},

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -1 +1 @@
<!DOCTYPE html><html><head><meta charset=utf-8><meta http-equiv=X-UA-Compatible content="IE=edge"><meta name=viewport content="width=device-width,initial-scale=1"><link rel=icon href=\favicon.ico><script src=\config.js></script><title></title><link href=/css/chunk-36cd36e2.6cd40709.css rel=prefetch><link href=/js/chunk-00ae0766.9e6b7bf3.js rel=prefetch><link href=/js/chunk-36cd36e2.26bb8c16.js rel=prefetch><link href=/css/app.ce4b14dc.css rel=preload as=style><link href=/css/chunk-vendors.3c3b2e85.css rel=preload as=style><link href=/js/app.84367b81.js rel=preload as=script><link href=/js/chunk-vendors.02a4e5bc.js rel=preload as=script><link href=/css/chunk-vendors.3c3b2e85.css rel=stylesheet><link href=/css/app.ce4b14dc.css rel=stylesheet></head><body><noscript><strong>很抱歉如果没有启用JavaScript程序不能正常工作若要继续使用请启用它。</strong></noscript><div id=app></div><script src=/js/chunk-vendors.02a4e5bc.js></script><script src=/js/app.84367b81.js></script></body></html>
<!DOCTYPE html><html><head><meta charset=utf-8><meta http-equiv=X-UA-Compatible content="IE=edge"><meta name=viewport content="width=device-width,initial-scale=1"><link rel=icon href=\favicon.ico><script src=\config.js></script><title></title><link href=/css/chunk-36cd36e2.6cd40709.css rel=prefetch><link href=/js/chunk-00ae0766.9e6b7bf3.js rel=prefetch><link href=/js/chunk-36cd36e2.17dd6236.js rel=prefetch><link href=/css/app.ce4b14dc.css rel=preload as=style><link href=/css/chunk-vendors.3c3b2e85.css rel=preload as=style><link href=/js/app.aa00184d.js rel=preload as=script><link href=/js/chunk-vendors.02a4e5bc.js rel=preload as=script><link href=/css/chunk-vendors.3c3b2e85.css rel=stylesheet><link href=/css/app.ce4b14dc.css rel=stylesheet></head><body><noscript><strong>很抱歉如果没有启用JavaScript程序不能正常工作若要继续使用请启用它。</strong></noscript><div id=app></div><script src=/js/chunk-vendors.02a4e5bc.js></script><script src=/js/app.aa00184d.js></script></body></html>