diff --git a/config/dev.env.js b/config/dev.env.js index 6227232..9c9c594 100644 --- a/config/dev.env.js +++ b/config/dev.env.js @@ -6,6 +6,7 @@ // 将两个配置对象合并,最终结果是 NODE_ENV:‘"development"' module.exports = merge(prodEnv, { NODE_ENV: '"development"', - BASE_API: '"http://111.198.10.15:11631"' + // BASE_API: '"http://111.198.10.15:11631"' // BASE_API: '"http://192.168.5.220:20311"' + BASE_API: '"http://111.198.10.15:12405"' }) diff --git a/config/dev.env.js b/config/dev.env.js index 6227232..9c9c594 100644 --- a/config/dev.env.js +++ b/config/dev.env.js @@ -6,6 +6,7 @@ // 将两个配置对象合并,最终结果是 NODE_ENV:‘"development"' module.exports = merge(prodEnv, { NODE_ENV: '"development"', - BASE_API: '"http://111.198.10.15:11631"' + // BASE_API: '"http://111.198.10.15:11631"' // BASE_API: '"http://192.168.5.220:20311"' + BASE_API: '"http://111.198.10.15:12405"' }) diff --git a/config/prod.env.js b/config/prod.env.js index 2c3f8be..f2fa1f8 100644 --- a/config/prod.env.js +++ b/config/prod.env.js @@ -1,6 +1,7 @@ 'use strict' module.exports = { NODE_ENV: '"production"', - BASE_API: '"http://192.168.5.220:20311"' + // BASE_API: '"http://192.168.5.220:20311"' // BASE_API: '"http://111.198.10.15:11631"' + BASE_API: '"http://111.198.10.15:12405"' } diff --git a/config/dev.env.js b/config/dev.env.js index 6227232..9c9c594 100644 --- a/config/dev.env.js +++ b/config/dev.env.js @@ -6,6 +6,7 @@ // 将两个配置对象合并,最终结果是 NODE_ENV:‘"development"' module.exports = merge(prodEnv, { NODE_ENV: '"development"', - BASE_API: '"http://111.198.10.15:11631"' + // BASE_API: '"http://111.198.10.15:11631"' // BASE_API: '"http://192.168.5.220:20311"' + BASE_API: '"http://111.198.10.15:12405"' }) diff --git a/config/prod.env.js b/config/prod.env.js index 2c3f8be..f2fa1f8 100644 --- a/config/prod.env.js +++ b/config/prod.env.js @@ -1,6 +1,7 @@ 'use strict' module.exports = { NODE_ENV: '"production"', - BASE_API: '"http://192.168.5.220:20311"' + // BASE_API: '"http://192.168.5.220:20311"' // BASE_API: '"http://111.198.10.15:11631"' + BASE_API: '"http://111.198.10.15:12405"' } diff --git a/src/api/car.js b/src/api/car.js index fc55938..952a015 100644 --- a/src/api/car.js +++ b/src/api/car.js @@ -21,6 +21,18 @@ }) } + +export function batchImport(fileobj) { + const param = new FormData() + param.append('fs', fileobj) + return request({ + url: '/car/imp', + method: 'post', + headers: { 'Content-Type': 'multipart/form-data' }, + data: param + }) +} + export function deleteCar(id) { return request({ url: '/car/delete', diff --git a/config/dev.env.js b/config/dev.env.js index 6227232..9c9c594 100644 --- a/config/dev.env.js +++ b/config/dev.env.js @@ -6,6 +6,7 @@ // 将两个配置对象合并,最终结果是 NODE_ENV:‘"development"' module.exports = merge(prodEnv, { NODE_ENV: '"development"', - BASE_API: '"http://111.198.10.15:11631"' + // BASE_API: '"http://111.198.10.15:11631"' // BASE_API: '"http://192.168.5.220:20311"' + BASE_API: '"http://111.198.10.15:12405"' }) diff --git a/config/prod.env.js b/config/prod.env.js index 2c3f8be..f2fa1f8 100644 --- a/config/prod.env.js +++ b/config/prod.env.js @@ -1,6 +1,7 @@ 'use strict' module.exports = { NODE_ENV: '"production"', - BASE_API: '"http://192.168.5.220:20311"' + // BASE_API: '"http://192.168.5.220:20311"' // BASE_API: '"http://111.198.10.15:11631"' + BASE_API: '"http://111.198.10.15:12405"' } diff --git a/src/api/car.js b/src/api/car.js index fc55938..952a015 100644 --- a/src/api/car.js +++ b/src/api/car.js @@ -21,6 +21,18 @@ }) } + +export function batchImport(fileobj) { + const param = new FormData() + param.append('fs', fileobj) + return request({ + url: '/car/imp', + method: 'post', + headers: { 'Content-Type': 'multipart/form-data' }, + data: param + }) +} + export function deleteCar(id) { return request({ url: '/car/delete', diff --git a/src/utils/validate.js b/src/utils/validate.js index d651e43..b596d16 100644 --- a/src/utils/validate.js +++ b/src/utils/validate.js @@ -108,12 +108,28 @@ const reg1 = /^((0\d{2,3})-)?(\d{7,8})$/ if (value !== '') { if (reg.test(value) === false && reg1.test(value) === false) { - callback(new Error('请输入正确的联系电话')) + callback(new Error('请输入正确的电话')) } else { callback() } } else { - callback(new Error('联系电话不能为空')) + callback(new Error('电话不能为空')) + } +} +export const phoneValidatorCanNull = (rule, value, callback) => { + const reg = /^1([38][0-9]|4[579]|5[0-3,5-9]|6[6]|7[0135678]|9[89])\d{8}$/ + const reg1 = /^((0\d{2,3})-)?(\d{7,8})$/ + if(value === undefined){ + callback() + } + if (value !== '') { + if (reg.test(value) === false && reg1.test(value) === false) { + callback(new Error('请输入正确的电话')) + } else { + callback() + } + } else { + callback() } } diff --git a/config/dev.env.js b/config/dev.env.js index 6227232..9c9c594 100644 --- a/config/dev.env.js +++ b/config/dev.env.js @@ -6,6 +6,7 @@ // 将两个配置对象合并,最终结果是 NODE_ENV:‘"development"' module.exports = merge(prodEnv, { NODE_ENV: '"development"', - BASE_API: '"http://111.198.10.15:11631"' + // BASE_API: '"http://111.198.10.15:11631"' // BASE_API: '"http://192.168.5.220:20311"' + BASE_API: '"http://111.198.10.15:12405"' }) diff --git a/config/prod.env.js b/config/prod.env.js index 2c3f8be..f2fa1f8 100644 --- a/config/prod.env.js +++ b/config/prod.env.js @@ -1,6 +1,7 @@ 'use strict' module.exports = { NODE_ENV: '"production"', - BASE_API: '"http://192.168.5.220:20311"' + // BASE_API: '"http://192.168.5.220:20311"' // BASE_API: '"http://111.198.10.15:11631"' + BASE_API: '"http://111.198.10.15:12405"' } diff --git a/src/api/car.js b/src/api/car.js index fc55938..952a015 100644 --- a/src/api/car.js +++ b/src/api/car.js @@ -21,6 +21,18 @@ }) } + +export function batchImport(fileobj) { + const param = new FormData() + param.append('fs', fileobj) + return request({ + url: '/car/imp', + method: 'post', + headers: { 'Content-Type': 'multipart/form-data' }, + data: param + }) +} + export function deleteCar(id) { return request({ url: '/car/delete', diff --git a/src/utils/validate.js b/src/utils/validate.js index d651e43..b596d16 100644 --- a/src/utils/validate.js +++ b/src/utils/validate.js @@ -108,12 +108,28 @@ const reg1 = /^((0\d{2,3})-)?(\d{7,8})$/ if (value !== '') { if (reg.test(value) === false && reg1.test(value) === false) { - callback(new Error('请输入正确的联系电话')) + callback(new Error('请输入正确的电话')) } else { callback() } } else { - callback(new Error('联系电话不能为空')) + callback(new Error('电话不能为空')) + } +} +export const phoneValidatorCanNull = (rule, value, callback) => { + const reg = /^1([38][0-9]|4[579]|5[0-3,5-9]|6[6]|7[0135678]|9[89])\d{8}$/ + const reg1 = /^((0\d{2,3})-)?(\d{7,8})$/ + if(value === undefined){ + callback() + } + if (value !== '') { + if (reg.test(value) === false && reg1.test(value) === false) { + callback(new Error('请输入正确的电话')) + } else { + callback() + } + } else { + callback() } } diff --git a/src/views/area/defenceDetail.vue b/src/views/area/defenceDetail.vue index 703ec7d..53cb682 100644 --- a/src/views/area/defenceDetail.vue +++ b/src/views/area/defenceDetail.vue @@ -31,7 +31,7 @@ - + {{ item.deviceTypeName }} - {{ item.devcode }} diff --git a/config/dev.env.js b/config/dev.env.js index 6227232..9c9c594 100644 --- a/config/dev.env.js +++ b/config/dev.env.js @@ -6,6 +6,7 @@ // 将两个配置对象合并,最终结果是 NODE_ENV:‘"development"' module.exports = merge(prodEnv, { NODE_ENV: '"development"', - BASE_API: '"http://111.198.10.15:11631"' + // BASE_API: '"http://111.198.10.15:11631"' // BASE_API: '"http://192.168.5.220:20311"' + BASE_API: '"http://111.198.10.15:12405"' }) diff --git a/config/prod.env.js b/config/prod.env.js index 2c3f8be..f2fa1f8 100644 --- a/config/prod.env.js +++ b/config/prod.env.js @@ -1,6 +1,7 @@ 'use strict' module.exports = { NODE_ENV: '"production"', - BASE_API: '"http://192.168.5.220:20311"' + // BASE_API: '"http://192.168.5.220:20311"' // BASE_API: '"http://111.198.10.15:11631"' + BASE_API: '"http://111.198.10.15:12405"' } diff --git a/src/api/car.js b/src/api/car.js index fc55938..952a015 100644 --- a/src/api/car.js +++ b/src/api/car.js @@ -21,6 +21,18 @@ }) } + +export function batchImport(fileobj) { + const param = new FormData() + param.append('fs', fileobj) + return request({ + url: '/car/imp', + method: 'post', + headers: { 'Content-Type': 'multipart/form-data' }, + data: param + }) +} + export function deleteCar(id) { return request({ url: '/car/delete', diff --git a/src/utils/validate.js b/src/utils/validate.js index d651e43..b596d16 100644 --- a/src/utils/validate.js +++ b/src/utils/validate.js @@ -108,12 +108,28 @@ const reg1 = /^((0\d{2,3})-)?(\d{7,8})$/ if (value !== '') { if (reg.test(value) === false && reg1.test(value) === false) { - callback(new Error('请输入正确的联系电话')) + callback(new Error('请输入正确的电话')) } else { callback() } } else { - callback(new Error('联系电话不能为空')) + callback(new Error('电话不能为空')) + } +} +export const phoneValidatorCanNull = (rule, value, callback) => { + const reg = /^1([38][0-9]|4[579]|5[0-3,5-9]|6[6]|7[0135678]|9[89])\d{8}$/ + const reg1 = /^((0\d{2,3})-)?(\d{7,8})$/ + if(value === undefined){ + callback() + } + if (value !== '') { + if (reg.test(value) === false && reg1.test(value) === false) { + callback(new Error('请输入正确的电话')) + } else { + callback() + } + } else { + callback() } } diff --git a/src/views/area/defenceDetail.vue b/src/views/area/defenceDetail.vue index 703ec7d..53cb682 100644 --- a/src/views/area/defenceDetail.vue +++ b/src/views/area/defenceDetail.vue @@ -31,7 +31,7 @@ - + {{ item.deviceTypeName }} - {{ item.devcode }} diff --git a/src/views/car/carAdd.vue b/src/views/car/carAdd.vue index afdeae8..565a614 100644 --- a/src/views/car/carAdd.vue +++ b/src/views/car/carAdd.vue @@ -8,18 +8,16 @@ - - - - - - - - - + + + {{ item.name }} + + + + {{ item.name }} @@ -54,8 +52,8 @@ - - + + @@ -63,7 +61,7 @@ - + @@ -79,7 +77,7 @@ import DeptSelect from '@/components/DeptSelect' import { getStaffByDept } from '@/api/staff' import { addCar, editCar } from '@/api/car' -import { phoneValidator, plateValidator } from '@/utils/validate' +import { phoneValidator, phoneValidatorCanNull, plateValidator } from '@/utils/validate' import { getDeptTreeList } from '@/api/dept' import { getCarCardTypeList } from '@/api/allDict' export default { @@ -97,7 +95,7 @@ ownerId: '', // 车主 phone: '', // 车主联系电话 phone2: '', - carCardType: '', + carCardType: '1', remark: '', // 备注 deptName: '', // 部门名称 ownerName: ''// 车主名 @@ -108,6 +106,7 @@ detail: '详情' }, // 表头显示标题 rules: { + phone2: [{ required: false, trigger: ['blur'], validator: phoneValidatorCanNull }], phone: [{ required: true, trigger: ['blur', 'change'], validator: phoneValidator }], plateNumber: [{ required: true, trigger: ['blur', 'change'], validator: plateValidator }], ownerId: [{ required: true, trigger: ['blur', 'change'], message: '请选择车主' }] @@ -164,6 +163,7 @@ ownerId: row.ownerId, phone: row.phone, phone2: row.phone2, + carCardType: row.carCardType, remark: row.remark } getStaffByDept({ deptId: this.dataForm.deptid }).then(response => { @@ -181,6 +181,7 @@ ownerId: row.ownerId, phone: row.phone, phone2: row.phone2, + carCardType: row.carCardType, deptid: row.deptid, remark: row.remark, deptName: row.deptName, @@ -202,6 +203,7 @@ ownerId: '', // 车主 phone: '', // 车主联系电话 phone2: '', // 车主联系电话 + carCardType: '1', remark: '', // 备注 deptName: '', // 部门名称 ownerName: ''// 车主名 diff --git a/config/dev.env.js b/config/dev.env.js index 6227232..9c9c594 100644 --- a/config/dev.env.js +++ b/config/dev.env.js @@ -6,6 +6,7 @@ // 将两个配置对象合并,最终结果是 NODE_ENV:‘"development"' module.exports = merge(prodEnv, { NODE_ENV: '"development"', - BASE_API: '"http://111.198.10.15:11631"' + // BASE_API: '"http://111.198.10.15:11631"' // BASE_API: '"http://192.168.5.220:20311"' + BASE_API: '"http://111.198.10.15:12405"' }) diff --git a/config/prod.env.js b/config/prod.env.js index 2c3f8be..f2fa1f8 100644 --- a/config/prod.env.js +++ b/config/prod.env.js @@ -1,6 +1,7 @@ 'use strict' module.exports = { NODE_ENV: '"production"', - BASE_API: '"http://192.168.5.220:20311"' + // BASE_API: '"http://192.168.5.220:20311"' // BASE_API: '"http://111.198.10.15:11631"' + BASE_API: '"http://111.198.10.15:12405"' } diff --git a/src/api/car.js b/src/api/car.js index fc55938..952a015 100644 --- a/src/api/car.js +++ b/src/api/car.js @@ -21,6 +21,18 @@ }) } + +export function batchImport(fileobj) { + const param = new FormData() + param.append('fs', fileobj) + return request({ + url: '/car/imp', + method: 'post', + headers: { 'Content-Type': 'multipart/form-data' }, + data: param + }) +} + export function deleteCar(id) { return request({ url: '/car/delete', diff --git a/src/utils/validate.js b/src/utils/validate.js index d651e43..b596d16 100644 --- a/src/utils/validate.js +++ b/src/utils/validate.js @@ -108,12 +108,28 @@ const reg1 = /^((0\d{2,3})-)?(\d{7,8})$/ if (value !== '') { if (reg.test(value) === false && reg1.test(value) === false) { - callback(new Error('请输入正确的联系电话')) + callback(new Error('请输入正确的电话')) } else { callback() } } else { - callback(new Error('联系电话不能为空')) + callback(new Error('电话不能为空')) + } +} +export const phoneValidatorCanNull = (rule, value, callback) => { + const reg = /^1([38][0-9]|4[579]|5[0-3,5-9]|6[6]|7[0135678]|9[89])\d{8}$/ + const reg1 = /^((0\d{2,3})-)?(\d{7,8})$/ + if(value === undefined){ + callback() + } + if (value !== '') { + if (reg.test(value) === false && reg1.test(value) === false) { + callback(new Error('请输入正确的电话')) + } else { + callback() + } + } else { + callback() } } diff --git a/src/views/area/defenceDetail.vue b/src/views/area/defenceDetail.vue index 703ec7d..53cb682 100644 --- a/src/views/area/defenceDetail.vue +++ b/src/views/area/defenceDetail.vue @@ -31,7 +31,7 @@ - + {{ item.deviceTypeName }} - {{ item.devcode }} diff --git a/src/views/car/carAdd.vue b/src/views/car/carAdd.vue index afdeae8..565a614 100644 --- a/src/views/car/carAdd.vue +++ b/src/views/car/carAdd.vue @@ -8,18 +8,16 @@ - - - - - - - - - + + + {{ item.name }} + + + + {{ item.name }} @@ -54,8 +52,8 @@ - - + + @@ -63,7 +61,7 @@ - + @@ -79,7 +77,7 @@ import DeptSelect from '@/components/DeptSelect' import { getStaffByDept } from '@/api/staff' import { addCar, editCar } from '@/api/car' -import { phoneValidator, plateValidator } from '@/utils/validate' +import { phoneValidator, phoneValidatorCanNull, plateValidator } from '@/utils/validate' import { getDeptTreeList } from '@/api/dept' import { getCarCardTypeList } from '@/api/allDict' export default { @@ -97,7 +95,7 @@ ownerId: '', // 车主 phone: '', // 车主联系电话 phone2: '', - carCardType: '', + carCardType: '1', remark: '', // 备注 deptName: '', // 部门名称 ownerName: ''// 车主名 @@ -108,6 +106,7 @@ detail: '详情' }, // 表头显示标题 rules: { + phone2: [{ required: false, trigger: ['blur'], validator: phoneValidatorCanNull }], phone: [{ required: true, trigger: ['blur', 'change'], validator: phoneValidator }], plateNumber: [{ required: true, trigger: ['blur', 'change'], validator: plateValidator }], ownerId: [{ required: true, trigger: ['blur', 'change'], message: '请选择车主' }] @@ -164,6 +163,7 @@ ownerId: row.ownerId, phone: row.phone, phone2: row.phone2, + carCardType: row.carCardType, remark: row.remark } getStaffByDept({ deptId: this.dataForm.deptid }).then(response => { @@ -181,6 +181,7 @@ ownerId: row.ownerId, phone: row.phone, phone2: row.phone2, + carCardType: row.carCardType, deptid: row.deptid, remark: row.remark, deptName: row.deptName, @@ -202,6 +203,7 @@ ownerId: '', // 车主 phone: '', // 车主联系电话 phone2: '', // 车主联系电话 + carCardType: '1', remark: '', // 备注 deptName: '', // 部门名称 ownerName: ''// 车主名 diff --git a/src/views/car/carList.vue b/src/views/car/carList.vue index e7223de..0371607 100644 --- a/src/views/car/carList.vue +++ b/src/views/car/carList.vue @@ -31,6 +31,18 @@
数据列表
+ + + 批量导入 + 导出 新增 @@ -76,15 +88,16 @@