Skip to content
Toggle navigation
Projects
Groups
Snippets
Help
micro-customization-system
/
micro-trialrun
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit e7ccbdef
authored
Feb 21, 2022
by
张杰
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
1.4版本需求
1 parent
b11aaeb6
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
2166 additions
and
512 deletions
src/utils/validator.js
src/views/vehicleManage/vehicleList copy.vue
src/views/vehicleManage/vehicleList.vue
src/utils/validator.js
0 → 100644
View file @
e7ccbde
export
const
Validator
=
{
/*手机号码格式校验正则*/
PHONEREG
:
/^
(
13
[
0-9
]
|15
[
0-9
]
|16
[
0-9
]
|17
[
0-9
]
|18
[
0-9
]
|19
[
0-9
]
|14
[
0-9
])[
0-9
]{8}
$/
,
/*同时包含字母和数字*/
ISNUMANDLETTERS
:
/^
[
a-zA-Z0-9
]
+$/
,
/*特殊字符正则*/
SPECIALLETTER
:
new
RegExp
(
"[`~!@#$^&*=|{}':;',\\[\\]<>?~!@#¥……&*——|{}【】‘;:”“'。,、? ]"
),
/*邮箱地址格式正则*/
//EMAILREG:/^\w+((-\w+)|(\.\w+))*\@[A-Za-z0-9]+((\.|-)[A-Za-z0-9]+)*\.[A-Za-z0-9]+$/,
EMAILREG
:
/^
\w
+
([
-+.
]\w
+
)
*@
\w
+
([
-.
]\w
+
)
*
\.\w
+
([
-.
]\w
+
)
*$/
,
/*判断是否为中文*/
ISCHINESE
:
/^
[\u
0391-
\u
FFE5
]
+$/
,
/*判断是否为英文字母*/
ISENGLISH
:
/^
[
a-zA-Z
]
+$/
,
/*是否包含空格*/
ISHAVENULL
:
/^
[^\s]
*$/
,
/*保留两位小数*/
TWODECIMAL
:
/^
(([
1-9
][
0-9
]
*
)
|
(([
0
]\.\d{1,2}
|
[
1-9
][
0-9
]
*
\.\d{1,2})))
$/
,
/*判断是否为正整数*/
ISDECIMAL
:
/^
[
0-9
]
*$/
,
// 只能输入负数
ISNEGATIVENUMBER
:
/^-
[
0-9
]
+.
?[
0-9
]
*/
,
/**
* 账号管理-手机号码校验
*/
checkPhoneNumber
:
function
(
str
){
return
Validator
.
PHONEREG
.
test
(
str
);
}
};
src/views/vehicleManage/vehicleList copy.vue
0 → 100644
View file @
e7ccbde
<
template
>
<div
class=
"system-container"
>
<div
class=
"container"
>
<search-form
class=
"searchTop border-shadow vehicle inline"
:formModel=
"searchForm"
:formList=
"vehicleFormList"
@
input=
"onInput"
>
<span
class=
"sinline-b"
slot=
"form-slot"
>
<el-button
type=
"primary"
:size=
"btn_size"
icon=
"el-icon-search"
ref=
"serchButton"
:id=
"vehicleTableParams.btnId"
>
搜索
</el-button>
<el-button
type=
"primary"
:size=
"btn_size"
icon=
"el-icon-refresh"
@
click=
"refresh"
>
重置
</el-button>
</span>
</search-form>
<h3>
车辆列表
<div
class=
"pull-right"
>
<template>
<el-button
v-for=
"item in authList"
:key=
"item.id"
:type=
"item.type"
:size=
"btn_size"
@
click=
"btnClick(item.pType)"
>
{{
item
.
name
}}
</el-button>
</
template
>
</div>
</h3>
<basic-table
ref=
"vehicleForm"
:beforeSearchFn=
"beforeSearchFn"
:tableParams=
"vehicleTableParams"
:getListApi=
"getListApi"
:searchForm=
"searchForm"
@
dataFinished=
"tableDataFinished"
:hasNum=
"false"
>
<span
slot=
"table-button"
slot-scope=
"scope"
>
<el-button
v-for=
"(j, idx) in vehicleTableParams.tableOption.btnList"
:key=
"idx"
:type=
"j.type || 'text'"
size=
"mini"
plain
@
click=
"btnClick(j.pType, scope.scope)"
>
{{j.name}}
</el-button>
<el-button
v-if=
"scope.scope.sns"
type=
"text"
size=
"mini"
@
click=
"btnClick('unbind', scope.scope)"
>
解绑
</el-button>
<!-- <el-button v-if="scope.scope.adjFreq === 1" type="text" size="mini" @click="btnClick('freq', scope.scope)">一键调频</el-button> -->
<el-dropdown
v-if=
"scope.scope.adjFreq"
@
command=
"handleCommand"
style=
"margin-left:5px"
>
<el-button
size=
"mini"
>
<i
class=
"el-icon-arrow-down"
></i>
</el-button>
<el-dropdown-menu
slot=
"dropdown"
>
<el-dropdown-item
v-if=
"scope.scope.adjFreq===1"
:command=
"getCommand('freq', scope.scope.sn, scope.scope.enableFre)"
>
一键调频
</el-dropdown-item>
</el-dropdown-menu>
</el-dropdown>
</span>
</basic-table>
<basic-dialog
width=
"800px"
:title=
"vehicleTitle"
:isVisible=
"vehicleVisible"
:hasOk=
"vehicleHasOk"
@
confirmDialog=
"handleConfirm('create')"
@
closeDialog=
"handleClose('create')"
>
<slot>
<div
v-loading=
"formLoading"
>
<el-form
ref=
"snForm"
:model=
"snForm"
:rules=
"snRules"
:inline=
"false"
size=
"mini"
label-width=
"140px"
>
<el-row>
<el-col
:span=
"20"
>
<el-row
v-for=
"(item, index) in snForm.deviceArr"
:key=
"index"
>
<!-- <i v-show="!isViewMode" @click="removeDevice(index)" class="el-icon-remove-outline" style="position: absolute;font-size: 20px; margin-left:20px; line-height:30px;"></i> -->
<el-col
:span=
"12"
>
<el-form-item
label=
"设备SN号"
class=
"is-required"
:prop=
"'device'+index"
>
<el-input
v-model=
"item.sn"
:disabled=
"item.disabled"
></el-input>
</el-form-item>
</el-col>
<el-col
:span=
"12"
>
<el-form-item
label=
"设备型号:"
>
<el-input
disabled
v-model=
"item.deviceType"
></el-input>
</el-form-item>
</el-col>
</el-row>
</el-col>
<!-- <el-col :span="4">
<i v-show="!isViewMode" @click="addDevice" class="el-icon-circle-plus-outline" style="font-size: 20px; margin-left:20px; line-height:30px;"></i>
</el-col> -->
</el-row>
</el-form>
<rule-form
class=
"test"
:ruleForm=
"vehicleForm"
:rules=
"vehicleRules"
:ruleData=
"vehicleData"
:labelWidth=
"'140px'"
ref=
'vehicleRuleForm'
></rule-form>
<el-row>
<el-col
:span=
"24"
>
<el-form
label-width=
"120px"
>
<el-form-item
label=
"操作日志"
v-show=
"isViewMode"
>
<table
class=
"freq_table"
v-loading=
"freqLoading"
style=
"min-height: 40px"
>
<tr
v-show=
"freqTableData.length"
>
<th
width=
"80"
>
调频时间
</th>
<th
width=
"80"
>
调频模式
</th>
<th
width=
"100"
>
上点频次
</th>
<th>
调频上点个数
</th>
<th>
设备上点总个数
</th>
<th>
剩余电量
</th>
<th>
调频操作人
</th>
</tr>
<tr
v-for=
"(item,index) in freqTableData"
:key=
"index"
>
<td>
{{item.createTime}}
</td>
<td>
{{item.freqTypeStr}}
</td>
<td>
{{item.frequency}}
</td>
<td>
{{item.freTotal}}
</td>
<td>
{{item.devicePointTotal}}
</td>
<td>
{{item.batteryLevel}}%
</td>
<td>
{{item.operation}}
</td>
</tr>
</table>
</el-form-item>
</el-form>
</el-col>
</el-row>
</div>
</slot>
<
template
v-slot:btn-front
>
<el-button
type=
"primary"
@
click=
"gotoMonitor()"
size=
"small"
v-show=
"isViewMode"
>
监控
</el-button>
</
template
>
</basic-dialog>
<!-- 导入 -->
<basic-dialog
:title=
"importTitle"
:isVisible=
"vehicleImport"
@
confirmDialog=
"handleConfirm('import')"
@
closeDialog=
"handleClose('import')"
>
<slot>
<el-form
ref=
"importRuleForm"
:rules=
"importRules"
:model=
"importForm"
label-width=
"140px"
>
<el-form-item
label=
"导入文件:"
prop=
"fileName"
>
<el-col
:span=
"14"
>
<el-input
readonly
:size=
"btn_size"
v-model=
"importForm.fileName"
ref=
"importInput"
></el-input>
</el-col>
<el-col
:span=
"6"
class=
"m-l-md"
>
<el-button
class=
"import-btn"
:size=
"btn_size"
>
导入文件
<input
:size=
"btn_size"
type=
"file"
id=
"importFile"
class=
"import-input"
accept=
".csv, application/vnd.ms-excel, application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"
@
change=
"importFile($event)"
/>
</el-button>
</el-col>
<el-button
type=
"text"
class=
"import-template"
icon=
"el-icon-link"
@
click=
"downloadTemplate"
>
模版下载
</el-button>
</el-form-item>
<el-form-item>
<div
v-show=
"exportData.total"
>
操作数据
<span
class=
"red-text"
>
{{exportData.total}}
</span>
条,成功
<span
class=
"red-text"
>
{{exportData.succNum}}
</span>
条,失败
<span
class=
"red-text"
>
{{exportData.failNum}}
</span>
条。
</div>
<el-button
v-show=
"exportData.failNum"
type=
"primary"
:size=
"btn_size"
@
click=
"downloadFailFile"
>
导出失败记录
</el-button>
</el-form-item>
</el-form>
</slot>
</basic-dialog>
<basic-dialog
:title=
"filterDialogTitle"
:isVisible=
"filterVisible"
@
confirmDialog=
"filterConfirm"
@
closeDialog=
"closeFilter"
>
<slot>
<div
v-loading=
"loading"
>
<el-input
placeholder=
"输入关键字进行过滤"
v-model=
"filterText"
size=
"small"
>
</el-input>
<el-tree
class=
"filter-tree"
:data=
"filterTextData"
:filter-node-method=
"filterNode"
highlight-current
ref=
"tree"
node-key=
"id"
check-on-click-node
>
</el-tree>
</div>
</slot>
</basic-dialog>
<freq-modal
:freqVisible=
"freqVisible"
:frequencyForm=
"frequencyForm"
@
onFreqModalChange=
"FreqModalChange"
:sn=
"freqSn"
:enableFreq=
"enableFreq"
></freq-modal>
</div>
</div>
</template>
<
script
>
import
_
from
"lodash"
;
import
axios
from
"axios"
;
import
{
dictInfo
}
from
"services/common"
;
import
{
VEHICLE_API
}
from
"@/config/config"
;
import
store
from
"@/store"
;
import
freqModal
from
'./freqModal'
import
{
getVehicleList
,
getSpecialShopList
,
addVehicle
,
editVehicle
,
downloadtemplate
,
deleteVehicle
,
unbindVehicle
,
importVehicle
,
exportVehicle
,
infoVehicle
,
GETVEHICLETREE
,
checkSn
,
verifydevice
,
addNewVehicle
,
updateNewVehicle
,
getVehicleInfo
,
deleteNewVehicle
,
getAdjFreqInfo
,
}
from
"services/vehicle"
;
import
{
getOrgTree
,
}
from
"services/common"
;
export
default
{
data
()
{
const
_this
=
this
let
checkShopName
=
(
rule
,
vaule
,
cb
)
=>
{
console
.
log
(
this
.
vehicleForm
)
if
(
this
.
vehicleForm
.
organizationName
==
""
)
{
cb
(
new
Error
(
"请选择所属组织"
));
}
else
{
cb
();
}
};
let
checkDevice
=
(
rule
,
value
,
cb
)
=>
{
if
(
rule
.
field
)
{
let
i
=
rule
.
field
.
split
(
'device'
)[
1
]
let
sn
=
this
.
snForm
.
deviceArr
[
i
].
sn
if
(
this
.
snForm
.
deviceArr
[
i
].
disabled
)
return
cb
()
if
(
sn
==
""
)
{
cb
(
new
Error
(
"请输入设备号"
));
}
if
(
sn
)
{
//this._timeoutId && clearTimeout(this._timeoutId)
//this._timeoutId = setTimeout(()=>{
verifydevice
({
sn
}).
then
((
res
)
=>
{
if
(
res
.
code
==
200
)
{
checkSn
({
sn
}).
then
((
res
)
=>
{
if
(
res
.
data
)
{
this
.
snForm
.
deviceArr
[
i
].
deviceType
=
res
.
data
}
})
cb
()
}
else
{
cb
(
new
Error
(
res
.
message
))
}
})
//}, 500)
}
else
{
cb
()
}
//cb();
}
};
return
{
searchForm
:
{},
vehicleFormList
:
[
{
label
:
"关键字"
,
type
:
"input"
,
inputType
:
"text"
,
prop
:
"keywords"
,
width
:
'360'
,
placeholder
:
"车主姓名|车架号|设备号|车型"
,
},
{
label
:
"设备类型"
,
type
:
'select'
,
prop
:
'deviceType'
,
placeholder
:
'请选择'
,
options
:
[{
label
:
'全部'
,
value
:
''
},
{
label
:
'有线'
,
value
:
'1'
},
{
label
:
'无线'
,
value
:
'0'
}]
},
/* {
label: "设备状态",
type: 'select',
prop: 'deviceState',
placeholder: '请选择',
class: 'unvisible',
options: [{
label: '全部',
value: ''
}, {
label: '行驶中',
value: '0'
}, {
label: '静止',
value: '1'
}, {
label: '离线',
value: '2'
}, {
label: '在线',
value: '3'
}]
}, */
{
label
:
'激活时间'
,
type
:
'daterange'
,
dateType
:
'day'
,
prop
:
'date'
,
placeholder
:
'请选择年月'
,
selectStyle
:
'width:360px'
,
pickerOptions
:
{
disabledDate
(
time
)
{
return
time
.
getTime
()
<
new
Date
(
_this
.
date
).
getTime
()
}
}
},
{
label
:
"车辆标签"
,
type
:
'select'
,
prop
:
'vehicleType'
,
placeholder
:
'请选择'
,
options
:
[{
label
:
'全部'
,
value
:
''
},
{
label
:
'试驶车 '
,
value
:
'1'
},
{
label
:
'服务车'
,
value
:
'3'
},
{
label
:
'代步车'
,
value
:
'4'
},
{
label
:
'救援车'
,
value
:
'5'
},
{
label
:
'办公车'
,
value
:
'6'
},
{
label
:
'其他'
,
value
:
'7'
}]
},
{
label
:
"车辆用途"
,
type
:
'select'
,
prop
:
'vehicleUsages'
,
placeholder
:
'请选择'
,
options
:
[{
label
:
'全部'
,
value
:
''
},
{
label
:
'专属用途'
,
value
:
'1'
},
{
label
:
'非专属用途'
,
value
:
'2'
}]
},
],
vehicleTableParams
:
{
btnId
:
new
Date
().
getTime
()
+
parseInt
(
Math
.
random
()
*
1000
),
listName
:
"list"
,
tableColumns
:
[
{
label
:
"车主姓名"
,
prop
:
"ownerName"
,
},
{
label
:
"车架号"
,
prop
:
"vin"
,
width
:
150
,
},
{
label
:
"设备号"
,
prop
:
"sn"
,
width
:
110
,
},
{
label
:
"设备类型"
,
prop
:
"deviceTypeStr"
,
},
{
label
:
"车型"
,
prop
:
"modelName"
,
width
:
150
,
},
{
label
:
"车辆标签"
,
prop
:
"vehicleTypeStr"
,
width
:
100
,
},
{
label
:
"车辆用途"
,
prop
:
"vehicleUsageStr"
,
width
:
100
,
},
{
label
:
"激活时间"
,
prop
:
"activateTime"
,
},
{
label
:
"设备状态"
,
prop
:
"deviceStateStr"
,
},
{
label
:
"特殊状态"
,
prop
:
"specialState"
,
width
:
110
,
},
],
tableOption
:
{
width
:
170
,
btnList
:
[
{
name
:
"编辑"
,
pType
:
"edit"
,
},
{
name
:
"删除"
,
pType
:
"delete"
,
},
{
name
:
"查看"
,
pType
:
"view"
,
},
],
align
:
'left'
,
},
},
getListApi
:
getVehicleList
,
authList
:
[
{
id
:
1
,
name
:
"新增车辆"
,
type
:
"primary"
,
pType
:
"create"
,
},
{
id
:
2
,
name
:
"车辆导入"
,
type
:
"default"
,
pType
:
"import"
,
},
{
id
:
3
,
name
:
"导出Excel"
,
type
:
"default"
,
pType
:
"export"
,
},
],
// 弹窗
vehicleHasOk
:
true
,
vehicleVisible
:
false
,
vehicleTitle
:
""
,
vehicleForm
:
{},
vehicleArr
:
[
"ownerName"
,
"ownerSex"
,
"ownerTel"
,
"organizationName"
,
"vin"
,
"modelId"
,
"modelName"
,
"configId"
,
"licensePlate"
,
"engine"
,
"organizationId"
,
"displacement"
,
"vehicleType"
,
"vehicleUsages"
,
"brandId"
,
"seriesId"
,
"typeId"
,
"remark"
],
vehicleData
:
[
{
label
:
"姓名:"
,
prop
:
"ownerName"
,
type
:
"input"
,
maxlength
:
"50"
,
clearable
:
true
,
},
{
label
:
"性别:"
,
prop
:
"ownerSex"
,
type
:
"select"
,
options
:
[
{
label
:
"男"
,
value
:
"男"
},
{
label
:
"女"
,
value
:
"女"
},
],
clearable
:
true
,
},
{
label
:
"联系方式:"
,
prop
:
"ownerTel"
,
type
:
"input"
,
maxlength
:
"50"
,
clearable
:
true
,
},
{
label
:
"车牌号:"
,
prop
:
"licensePlate"
,
type
:
"input"
,
maxlength
:
"9"
,
clearable
:
true
,
},
{
label
:
"车架号:"
,
prop
:
"vin"
,
type
:
"input"
,
maxlength
:
"17"
,
clearable
:
true
,
},
{
label
:
"发动机号:"
,
prop
:
"engine"
,
type
:
"input"
,
maxlength
:
"50"
,
clearable
:
true
,
},
{
label
:
"所属组织:"
,
prop
:
"organizationName"
,
type
:
"input"
,
readonly
:
true
,
clickFunc
:
this
.
selectStore
,
},
{
label
:
"车型:"
,
prop
:
"brandId"
,
type
:
"select"
,
options
:
[],
key
:
"name"
,
value
:
"id"
,
clearable
:
true
,
selectChange
:
this
.
changeCarBrand
,
loading
:
true
,
},
// {
// label: "配置:",
// prop: "configId",
// type: "select",
// options: [],
// key: "dictLabel",
// value: "id",
// clearable: true,
// },
{
label
:
"排量:"
,
prop
:
"displacement"
,
type
:
"input"
,
maxlength
:
50
,
clearable
:
true
,
},
{
label
:
"车辆标签:"
,
prop
:
"vehicleType"
,
type
:
"select"
,
options
:
[
{
label
:
"试驶车"
,
value
:
1
},
{
label
:
"服务车"
,
value
:
3
},
{
label
:
"代步车"
,
value
:
4
},
{
label
:
"救援车"
,
value
:
5
},
{
label
:
"办公车"
,
value
:
6
},
{
label
:
"其他"
,
value
:
7
},
],
clearable
:
true
,
},
{
label
:
"车辆用途:"
,
prop
:
"vehicleUsages"
,
type
:
"select"
,
options
:
[
{
label
:
"专属用途"
,
value
:
1
},
{
label
:
"非专属用途"
,
value
:
2
},
],
clearable
:
true
,
},
{
label
:
"备注:"
,
prop
:
"remark"
,
type
:
"input"
,
inputText
:
"textarea"
,
clearable
:
true
,
},
],
vehicleDefalutData
:
[
{
label
:
"姓名:"
,
prop
:
"ownerName"
,
type
:
"input"
,
maxlength
:
"50"
,
clearable
:
true
,
},
{
label
:
"性别:"
,
prop
:
"ownerSex"
,
type
:
"select"
,
options
:
[
{
label
:
"男"
,
value
:
"男"
},
{
label
:
"女"
,
value
:
"女"
},
],
clearable
:
true
,
},
{
label
:
"联系方式:"
,
prop
:
"ownerTel"
,
type
:
"input"
,
maxlength
:
"50"
,
clearable
:
true
,
},
{
label
:
"车牌号:"
,
prop
:
"licensePlate"
,
type
:
"input"
,
maxlength
:
"9"
,
clearable
:
true
,
},
{
label
:
"车架号:"
,
prop
:
"vin"
,
type
:
"input"
,
maxlength
:
"17"
,
clearable
:
true
,
},
{
label
:
"发动机号:"
,
prop
:
"engine"
,
type
:
"input"
,
maxlength
:
"50"
,
clearable
:
true
,
},
{
label
:
"所属组织:"
,
prop
:
"organizationName"
,
type
:
"input"
,
readonly
:
true
,
clickFunc
:
this
.
selectStore
,
},
{
label
:
"车型:"
,
prop
:
"brandId"
,
type
:
"select"
,
options
:
[],
key
:
"name"
,
value
:
"id"
,
clearable
:
true
,
selectChange
:
this
.
changeCarBrand
,
loading
:
true
,
},
// {
// label: "配置:",
// prop: "configId",
// type: "select",
// options: [],
// key: "dictLabel",
// value: "id",
// clearable: true,
// },
{
label
:
"排量:"
,
prop
:
"displacement"
,
type
:
"input"
,
maxlength
:
50
,
clearable
:
true
,
},
{
label
:
"车辆标签:"
,
prop
:
"vehicleType"
,
type
:
"select"
,
options
:
[
{
label
:
"试驶车"
,
value
:
1
},
{
label
:
"服务车"
,
value
:
3
},
{
label
:
"代步车"
,
value
:
4
},
{
label
:
"救援车"
,
value
:
5
},
{
label
:
"办公车"
,
value
:
6
},
{
label
:
"其他"
,
value
:
7
},
],
clearable
:
true
,
},
{
label
:
"车辆用途:"
,
prop
:
"vehicleUsages"
,
type
:
"select"
,
options
:
[
{
label
:
"专属用途"
,
value
:
1
},
{
label
:
"非专属用途"
,
value
:
2
},
],
clearable
:
true
,
},
{
label
:
"备注:"
,
prop
:
"remark"
,
type
:
"input"
,
inputText
:
"textarea"
,
clearable
:
true
,
},
],
vehicleRules
:
{
ownerName
:
[
{
min
:
2
,
max
:
50
,
message
:
'长度在 2 到 50 个字符'
,
trigger
:
'blur'
},
//{validator: this.$Common.checkName, trigger: "blur"}
],
organizationName
:
[
{
required
:
true
,
message
:
"请选择所属组织"
,
trigger
:
"blur"
},
{
validator
:
checkShopName
,
trigger
:
"blur"
},
],
vin
:
[
{
required
:
true
,
message
:
"请输入车架号"
,
trigger
:
"blur"
},
{
validator
:
this
.
$Common
.
checkvin
,
trigger
:
"blur"
},
],
/* brandId: [{ required: true, message: "请选择车型", trigger: "blur" }],
modelId: [{ required: true, message: "请选择车型", trigger: "blur" }], */
/* configId: [{ required: true, message: "请输入配置", trigger: "blur" }],
color: [{ required: true, message: "请输入外色", trigger: "blur" }],
innerColor: [
{ required: true, message: "请输入内色", trigger: "blur" },
],
serveType: [
{ required: true, message: "请选择服役类型", trigger: "blur" },
],
sn: [{ validator: this.$Common.checksn, trigger: "blur" }], */
},
isReadonly
:
false
,
// 所属组织名称弹窗
filterDialogTitle
:
"选择所属组织"
,
filterVisible
:
false
,
filterText
:
""
,
filterTextData
:
[],
isOpen
:
true
,
// 导入
importTitle
:
"批量操作"
,
vehicleImport
:
false
,
importForm
:
{},
importRules
:
{},
deviceList
:
[],
exportData
:
{},
// 新增车辆-车型数据
vehicleList
:
[],
loading
:
false
,
snForm
:
{
deviceArr
:
[{
sn
:
''
,
deviceType
:
''
}],
},
snRules
:
{
device0
:
[
{
validator
:
checkDevice
}
],
},
freqVisible
:
false
,
freqSn
:
''
,
frequencyForm
:
{
},
enableFreq
:
false
,
freqTableData
:
[],
formLoading
:
true
,
vehicleListInit
:
false
,
vehicleListPromise
:
null
,
isCreateMode
:
false
,
freqLoading
:
false
,
isViewMode
:
false
,
importing
:
false
,
};
},
watch
:
{
filterText
(
val
)
{
this
.
_timeout
&&
clearTimeout
(
this
.
_timeout
)
this
.
_timeout
=
setTimeout
(()
=>
{
this
.
$refs
.
tree
.
filter
(
val
)
},
500
)
}
},
created
()
{
this
.
vehicleListPromise
=
new
Promise
((
resolve
,
reject
)
=>
{
this
.
getModels
(
resolve
);
})
},
mounted
()
{
/* dictInfo("trialdrive_vehicle_model").then((res) => {
this.vehicleData.find((item) => item.prop == "modelId").options =
res.data;
// this.vehicleDefalutData.find((item) => item.prop == "modelId").options =
// res.data;
});
dictInfo("trialdrive_vehicle_config").then((res) => {
this.vehicleData.find((item) => item.prop == "configId").options =
res.data;
// this.vehicleDefalutData.find((item) => item.prop == "configId").options =
// res.data;
}); */
},
methods
:
{
beforeSearchFn
()
{
return
new
Promise
((
resolve
,
reject
)
=>
{
console
.
log
(
this
.
searchForm
.
date
)
if
(
this
.
searchForm
.
date
)
{
this
.
searchForm
.
activateTimeStart
=
this
.
searchForm
.
date
[
0
]
this
.
searchForm
.
activateTimeEnd
=
this
.
searchForm
.
date
[
1
]
}
resolve
()
})
},
tableDataFinished
()
{
this
.
$nextTick
(()
=>
{
this
.
$root
.
parentCommon
.
setAuthBtn
();
});
},
refresh
()
{
this
.
searchForm
=
{};
this
.
$refs
.
vehicleForm
.
refreshTable
();
},
btnClick
(
pType
,
scope
)
{
switch
(
pType
)
{
case
"create"
:
this
.
formLoading
=
true
this
.
vehicleVisible
=
!
this
.
vehicleVisible
;
this
.
isReadonly
=
false
;
this
.
isCreateMode
=
true
this
.
freqLoading
=
false
this
.
isViewMode
=
false
this
.
vehicleListPromise
.
then
(()
=>
{
if
(
this
.
vehicleVisible
)
{
let
_list
=
_
.
cloneDeep
(
this
.
vehicleDefalutData
);
let
_arr
=
[];
_list
.
map
((
k
)
=>
{
this
.
$set
(
k
,
"disabled"
,
false
);
if
(
k
.
prop
==
'brandId'
)
{
this
.
$set
(
k
,
"loading"
,
false
);
}
if
(
k
.
prop
!=
"seriesId"
&&
k
.
prop
!=
"typeId"
)
{
_arr
.
push
(
k
);
}
});
this
.
vehicleTitle
=
"新增车辆"
;
this
.
vehicleHasOk
=
true
;
this
.
vehicleForm
=
{};
this
.
vehicleData
=
_arr
;
}
if
(
this
.
$refs
.
vehicleRuleForm
)
this
.
$refs
.
vehicleRuleForm
.
$children
[
0
].
clearValidate
();
this
.
snForm
.
deviceArr
=
[{
sn
:
''
,
deviceType
:
''
}]
this
.
$refs
.
snForm
&&
this
.
$refs
.
snForm
.
clearValidate
();
this
.
freqTableData
=
[]
this
.
formLoading
=
false
})
break
;
case
"edit"
:
this
.
vehicleVisible
=
!
this
.
vehicleVisible
;
this
.
isReadonly
=
false
;
this
.
formLoading
=
true
this
.
isCreateMode
=
false
this
.
freqLoading
=
false
this
.
isViewMode
=
false
this
.
vehicleListPromise
.
then
(()
=>
{
if
(
this
.
vehicleVisible
)
{
//let _list = this.vehicleDefalutData;
this
.
vehicleTitle
=
"编辑车辆"
;
this
.
vehicleHasOk
=
true
;
getVehicleInfo
({
id
:
scope
.
id
}).
then
((
res
)
=>
{
const
{
code
,
data
}
=
res
;
if
(
code
==
200
)
{
//动态创建车系、车型选择框
let
_list
=
this
.
creatSelect
(
data
);
_list
.
map
((
k
)
=>
{
console
.
log
(
k
.
prop
)
if
(
k
.
prop
===
"vin"
||
k
.
prop
==
"organizationName"
)
{
this
.
$set
(
k
,
"disabled"
,
true
);
}
else
{
if
(
k
.
prop
==
'brandId'
)
{
this
.
$set
(
k
,
"loading"
,
false
);
}
this
.
$set
(
k
,
"disabled"
,
false
);
}
});
this
.
vehicleData
=
_
.
cloneDeep
(
_list
);
this
.
vehicleArr
.
forEach
((
item
)
=>
{
if
(
item
==
"serveType"
){
this
.
$set
(
this
.
vehicleForm
,
item
,
data
[
item
]
+
""
);
}
else
{
this
.
$set
(
this
.
vehicleForm
,
item
,
data
[
item
]);
if
(
item
==
'brandId'
)
{
this
.
changeCarBrand
(
data
.
brandId
,
true
)
}
}
});
this
.
vehicleForm
.
id
=
scope
.
id
;
this
.
snForm
.
deviceArr
=
data
.
deviceInfoDtos
.
map
((
item
,
i
)
=>
{
//this.snRules['device'+i] = this.snRules['device0']
return
{
sn
:
item
.
sn
,
deviceType
:
item
.
deviceClassifyName
,
disabled
:
true
,
}
})
this
.
formLoading
=
false
}
});
this
.
freqTableData
=
[]
}
})
break
;
case
"view"
:
console
.
log
(
"view"
);
this
.
formLoading
=
true
this
.
vehicleVisible
=
!
this
.
vehicleVisible
;
this
.
isReadonly
=
true
;
this
.
isCreateMode
=
false
this
.
isViewMode
=
true
this
.
vehicleListPromise
.
then
(()
=>
{
if
(
this
.
vehicleVisible
)
{
getVehicleInfo
({
id
:
scope
.
id
}).
then
((
res
)
=>
{
const
{
code
,
data
}
=
res
;
if
(
code
==
200
)
{
//动态创建车系、车型选择框
let
_list
=
this
.
creatSelect
(
data
);
_list
.
map
((
k
)
=>
{
this
.
$set
(
k
,
"disabled"
,
true
);
if
(
k
.
prop
==
'brandId'
)
{
this
.
$set
(
k
,
"loading"
,
false
);
}
});
this
.
vehicleData
=
_
.
cloneDeep
(
_list
);
this
.
vehicleArr
.
forEach
((
item
)
=>
{
if
(
item
==
"serveType"
){
this
.
$set
(
this
.
vehicleForm
,
item
,
data
[
item
]
+
""
);
}
else
{
this
.
$set
(
this
.
vehicleForm
,
item
,
data
[
item
]);
if
(
item
==
'brandId'
)
{
this
.
changeCarBrand
(
data
.
brandId
,
'view'
)
}
}
});
this
.
snForm
.
deviceArr
=
data
.
deviceInfoDtos
.
map
((
item
,
i
)
=>
{
//this.snRules['device'+i] = this.snRules['device0']
return
{
sn
:
item
.
sn
,
deviceType
:
item
.
deviceClassifyName
,
disabled
:
true
}
})
this
.
formLoading
=
false
}
});
this
.
vehicleTitle
=
"查看车辆"
;
this
.
vehicleHasOk
=
false
;
//this.vehicleData.map((item) => this.$set(item, "disabled", true));
// if (item.type == 'input') this.$set(item, 'readonly', true)
// else this.$set(item, 'disabled', true)
// })
this
.
freqTableData
=
[]
this
.
freqLoading
=
true
getAdjFreqInfo
({
sn
:
scope
.
sn
}).
then
((
res
)
=>
{
this
.
freqTableData
=
res
.
data
this
.
freqLoading
=
false
})
}
})
break
;
case
"delete"
:
this
.
$confirm
(
"是否要删除?"
,
"提示"
,
{
confirmButtonText
:
"确定"
,
cancelButtonText
:
"取消"
,
type
:
"warning"
,
}).
then
(()
=>
{
deleteNewVehicle
({
vdId
:
scope
.
vdId
,
//sn: scope.sn
}).
then
((
res
)
=>
{
const
{
code
,
message
}
=
res
;
if
(
code
==
200
)
{
this
.
$message
({
type
:
"success"
,
message
:
"删除成功!"
,
});
this
.
$refs
.
vehicleForm
.
refreshTable
();
}
else
{
this
.
$message
({
message
,
type
:
"error"
,
});
}
});
});
break
;
case
"unbind"
:
this
.
$confirm
(
"是否要解绑, 是否继续?"
,
"提示"
,
{
confirmButtonText
:
"确定"
,
cancelButtonText
:
"取消"
,
type
:
"warning"
,
}).
then
(()
=>
{
unbindVehicle
({
id
:
scope
.
id
}).
then
((
res
)
=>
{
const
{
code
,
message
}
=
res
;
if
(
code
==
200
)
{
this
.
$message
({
type
:
"success"
,
message
:
"解绑成功!"
,
});
this
.
$refs
.
vehicleForm
.
refreshTable
();
}
else
{
this
.
$message
({
message
,
type
:
"error"
,
});
}
});
});
break
;
case
"import"
:
this
.
vehicleImport
=
!
this
.
vehicleImport
;
if
(
!
this
.
vehicleImport
)
{
this
.
importForm
=
{};
this
.
exportData
=
{};
}
break
;
case
"export"
:
this
.
$Common
.
exportExcel
({
url
:
`
${
store
.
state
.
baseURL
}
/trialdrive/vehicle/vehicleinfo/export`
,
method
:
"GET"
,
data
:
this
.
searchForm
,
fileName
:
'车辆列表'
+
moment
().
format
(
'YYYY.MM.DD'
)
+
'.xls'
});
break
;
case
"freq"
:
this
.
freqSn
=
scope
.
sn
;
this
.
freqVisible
=
true
;
break
;
}
},
handleCommand
(
command
){
if
(
command
.
indexOf
(
'freq'
)
>-
1
){
this
.
freqSn
=
command
.
split
(
'freq'
)[
1
];
this
.
freqVisible
=
true
;
}
},
getCommand
(
type
,
val
,
enable
){
if
(
type
===
'freq'
)
{
this
.
enableFreq
=
enable
===
'true'
?
true
:
false
}
return
type
+
val
},
// 弹框确定按钮方法
handleConfirm
(
type
)
{
switch
(
type
)
{
case
"create"
:
//console.log(this.vehicleForm, this.vehicleData);
Promise
.
all
([
this
.
formPromise
(),
this
.
snPromise
()]).
then
((
arr
)
=>
{
let
params
=
arr
[
0
];
params
.
deviceInfoDtos
=
arr
[
1
]
console
.
log
(
arr
)
let
api
=
addNewVehicle
;
if
(
params
.
id
)
api
=
updateNewVehicle
;
api
(
params
).
then
((
res
)
=>
{
const
{
code
,
message
}
=
res
;
if
(
code
==
200
)
{
this
.
$message
({
message
:
"操作成功"
,
type
:
"success"
,
});
this
.
vehicleVisible
=
!
this
.
vehicleVisible
;
this
.
$refs
.
vehicleForm
.
refreshTable
();
}
else
{
this
.
$message
({
message
:
message
,
type
:
"error"
,
});
}
});
})
return
this
.
$refs
.
vehicleRuleForm
.
$children
[
0
].
validate
((
valid
)
=>
{
//console.log(valid, this.$refs.vehicleRuleForm);
if
(
valid
)
{
let
params
=
_
.
cloneDeep
(
this
.
vehicleForm
);
//const { typeId, configId } = params;
// let _list = this.vehicleData.find(
// (item) => item.prop == "typeId"
// ).options;
// let o = _list.find((j) => j.id == typeId);
// if (o) {
// params.modelName = o.name;
// }
// else params.modelName = modelId
// params.configDesc = this.vehicleData
// .find((item) => item.prop == "configId")
// .options.find((j) => j.id == configId).dictLabel;
params
.
organizationId
=
params
.
organizationId
params
.
modelId
=
params
.
typeId
delete
params
.
brandId
;
delete
params
.
seriesId
;
delete
params
.
organizationId
;
delete
params
.
organizationName
;
delete
params
.
typeId
;
console
.
log
(
params
)
return
;
let
api
=
addVehicle
;
if
(
params
.
id
)
api
=
editVehicle
;
api
(
params
).
then
((
res
)
=>
{
const
{
code
,
message
}
=
res
;
if
(
code
==
200
)
{
this
.
$message
({
message
:
"操作成功"
,
type
:
"success"
,
});
this
.
vehicleVisible
=
!
this
.
vehicleVisible
;
this
.
$refs
.
vehicleForm
.
refreshTable
();
}
else
{
this
.
$message
({
message
:
message
,
type
:
"error"
,
});
}
});
}
});
break
;
case
"import"
:
console
.
log
(
this
.
importForm
.
file
);
if
(
this
.
importing
)
return
var
data
=
new
FormData
();
data
.
append
(
"file"
,
this
.
importForm
.
file
);
this
.
importing
=
true
axios
({
headers
:
{
"Content-Type"
:
"multipart/form-data"
,
Authorization
:
localStorage
.
getItem
(
"token"
)
||
""
,
},
method
:
"post"
,
url
:
`
${
store
.
state
.
baseURL
}
/trialdrive/vehicle/vehicleinfo/import`
,
data
,
}).
then
((
res
)
=>
{
console
.
log
(
res
);
this
.
importing
=
false
if
(
res
.
data
.
code
==
200
)
{
this
.
exportData
=
res
.
data
.
data
;
}
else
{
this
.
$message
({
message
:
res
.
data
.
message
,
type
:
"error"
,
});
}
});
break
;
}
},
formPromise
()
{
return
new
Promise
((
resovle
,
reject
)
=>
{
this
.
$refs
.
vehicleRuleForm
.
$children
[
0
].
validate
((
valid
)
=>
{
//console.log(valid, this.$refs.vehicleRuleForm);
if
(
valid
)
{
let
params
=
_
.
cloneDeep
(
this
.
vehicleForm
);
//const { typeId, configId } = params;
// let _list = this.vehicleData.find(
// (item) => item.prop == "typeId"
// ).options;
// let o = _list.find((j) => j.id == typeId);
// if (o) {
// params.modelName = o.name;
// }
// else params.modelName = modelId
// params.configDesc = this.vehicleData
// .find((item) => item.prop == "configId")
// .options.find((j) => j.id == configId).dictLabel;
params
.
modelId
=
params
.
typeId
/* delete params.brandId;
delete params.seriesId;
delete params.organizationId;
delete params.organizationName;
delete params.typeId; */
resovle
(
params
)
}
})
})
},
snPromise
()
{
return
new
Promise
((
resovle
,
reject
)
=>
{
this
.
$refs
.
snForm
.
validate
((
valid
)
=>
{
if
(
valid
)
{
resovle
(
this
.
snForm
.
deviceArr
.
filter
(
item
=>
item
.
sn
).
map
((
item
)
=>
{
return
{
sn
:
item
.
sn
,
deviceClassifyName
:
item
.
deviceType
}
}))
}
})
})
},
handleClose
(
type
)
{
this
.
btnClick
(
type
);
},
// 所属组织弹窗
selectStore
()
{
if
(
!
this
.
isCreateMode
)
return
;
this
.
filterText
=
""
;
this
.
filterDialogTitle
=
"选择所属组织"
;
!
this
.
filterTextData
.
length
&&
this
.
getStoreList
();
this
.
closeFilter
();
},
closeFilter
()
{
this
.
filterVisible
=
!
this
.
filterVisible
;
},
// 获取特约门店数据
getStoreList
()
{
let
_this
=
this
;
_this
.
loading
=
true
;
getOrgTree
({
hasUserLeaf
:
true
}).
then
((
res
)
=>
{
const
{
code
,
data
}
=
res
;
_this
.
loading
=
false
;
if
(
code
==
200
)
{
this
.
filterTextData
=
data
;
}
});
},
filterConfirm
()
{
const
{
label
,
id
,
origin
}
=
this
.
$refs
.
tree
.
getCurrentNode
();
if
(
origin
.
type
!==
'u'
)
{
this
.
$message
({
message
:
"请选择下级所属组织"
,
type
:
"error"
,
});
return
;
}
this
.
$set
(
this
.
vehicleForm
,
"organizationName"
,
label
);
this
.
vehicleForm
.
organizationId
=
id
;
this
.
$refs
.
vehicleRuleForm
.
$children
[
0
].
validateField
(
'organizationName'
)
this
.
closeFilter
();
},
filterNode
(
value
,
data
)
{
console
.
log
(
value
,
data
);
if
(
!
value
)
return
true
;
return
data
.
label
.
indexOf
(
value
)
!==
-
1
;
},
downloadTemplate
()
{
this
.
$Common
.
exportExcel
({
url
:
`
${
store
.
state
.
baseURL
}
/trialdrive/vehicle/vehicleinfo/downloadtemplate`
,
method
:
"GET"
,
data
:
""
,
fileName
:
"车辆导入模板"
,
});
},
downloadFailFile
()
{
this
.
$Common
.
exportExcel
({
url
:
`
${
store
.
state
.
baseURL
}${
VEHICLE_API
.
VEHICLE_FAILFILE
}
`
,
method
:
"GET"
,
data
:
{
failSeqNoFile
:
this
.
exportData
.
failSeqNoFile
},
fileName
:
"车辆导入失败记录"
,
});
},
importFile
(
e
)
{
console
.
log
(
e
);
this
.
importForm
.
file
=
e
.
target
.
files
[
0
];
this
.
$set
(
this
.
importForm
,
"fileName"
,
e
.
target
.
files
[
0
].
name
);
console
.
log
(
this
.
importForm
);
// const reader = new FileReader()
// reader.readAsDataURL(e.target.files[0])
// reader.onload = event => {
// const imgFile = event.target.result
// const arrBase64 = imgFile.split(',')
// this.importFileInfo = e.target.files[0].name.split('.')[1] + '@' + arrBase64[1]
// }
},
// 获取车辆数据
getModels
(
resolve
)
{
let
_this
=
this
;
GETVEHICLETREE
().
then
((
res
)
=>
{
if
(
res
.
code
!=
200
)
{
return
false
;
}
let
_list
=
res
.
data
||
[];
let
o
=
_this
.
vehicleDefalutData
;
let
m
=
o
.
find
((
k
)
=>
k
.
prop
==
"brandId"
);
m
.
options
=
_list
;
m
.
loading
=
false
_this
.
vehicleList
=
_list
;
this
.
vehicleListInit
=
true
resolve
()
});
},
// 监听车型选择
changeCarBrand
(
e
,
flag
)
{
let
list
=
this
.
vehicleDefalutData
;
let
m
=
this
.
vehicleList
;
let
o
=
m
.
find
((
k
)
=>
k
.
id
==
e
);
let
idx
=
this
.
vehicleDefalutData
.
findIndex
((
k
)
=>
k
.
prop
==
"brandId"
);
let
i
=
list
.
findIndex
((
k
)
=>
k
.
prop
==
"seriesId"
);
let
n
=
{
label
:
""
,
prop
:
"seriesId"
,
type
:
"select"
,
options
:
o
?
o
.
childs
:
[],
key
:
"name"
,
value
:
"id"
,
clearable
:
true
,
group
:
true
,
filterable
:
true
,
selectChange
:
this
.
changeCarModel
,
};
// 判断是否存在车系
if
(
i
>=
0
)
{
this
.
$set
(
this
.
vehicleDefalutData
,
i
,
n
);
}
else
{
list
.
splice
(
idx
+
1
,
0
,
n
);
}
if
(
flag
)
{
let
row
=
list
.
find
((
item
)
=>
item
.
prop
===
'seriesId'
)
setTimeout
(()
=>
{
let
id
=
this
.
vehicleForm
.
typeId
this
.
changeCarModel
(
this
.
vehicleForm
.
seriesId
,
row
)
this
.
vehicleForm
.
typeId
=
id
},
500
)
}
list
.
map
((
k
)
=>
{
if
(
flag
==
'view'
)
{
this
.
$set
(
k
,
"disabled"
,
true
);
}
else
if
(
!
this
.
isCreateMode
){
if
(
k
.
prop
===
"vin"
||
k
.
prop
==
"organizationName"
)
{
this
.
$set
(
k
,
"disabled"
,
true
);
}
else
{
this
.
$set
(
k
,
"disabled"
,
false
);
}
}
else
{
this
.
$set
(
k
,
"disabled"
,
false
);
}
});
this
.
$set
(
this
,
"vehicleDefalutData"
,
list
);
this
.
vehicleData
=
_
.
cloneDeep
(
list
);
delete
this
.
vehicleForm
.
seriesId
;
delete
this
.
vehicleForm
.
typeId
;
},
// 监听切换车系
changeCarModel
(
e
,
row
)
{
console
.
log
(
row
);
let
list
=
this
.
vehicleDefalutData
;
let
m
=
row
.
options
;
let
o
=
{};
// 找第三级
let
nn
=
m
.
find
((
k
)
=>
{
let
_n
=
k
.
childs
.
find
((
j
)
=>
j
.
id
==
e
);
if
(
_n
)
{
o
=
_n
;
}
return
_n
;
});
let
idx
=
this
.
vehicleDefalutData
.
findIndex
((
k
)
=>
k
.
prop
==
"seriesId"
);
let
i
=
list
.
findIndex
((
k
)
=>
k
.
prop
==
"typeId"
);
let
n
=
{
label
:
""
,
prop
:
"typeId"
,
type
:
"select"
,
options
:
o
?
o
.
childs
:
[],
key
:
"name"
,
value
:
"id"
,
clearable
:
true
,
filterable
:
true
,
};
// 判断是否存在车型
if
(
i
>=
0
)
{
this
.
$set
(
this
.
vehicleDefalutData
,
i
,
n
);
}
else
{
list
.
splice
(
idx
+
1
,
0
,
n
);
}
list
.
map
((
k
)
=>
{
if
(
k
.
prop
===
'typeId'
)
{
if
(
this
.
isViewMode
){
this
.
$set
(
k
,
'disabled'
,
true
)
}
else
{
this
.
$set
(
k
,
'disabled'
,
false
)
}
}
});
this
.
$set
(
this
,
"vehicleDefalutData"
,
list
);
this
.
vehicleData
=
_
.
cloneDeep
(
list
);
delete
this
.
vehicleForm
.
typeId
;
},
// 动态创建选择框
creatSelect
(
data
)
{
console
.
log
(
data
)
let
nList
=
this
.
vehicleList
;
let
_list
=
_
.
cloneDeep
(
this
.
vehicleDefalutData
);
//动态创建车系、车型选择框
let
idx
=
_list
.
findIndex
((
k
)
=>
k
.
prop
==
"brandId"
);
if
(
idx
>=
0
)
{
let
n
=
nList
.
find
((
j
)
=>
j
.
id
==
data
.
brandId
);
console
.
log
(
n
);
let
km
=
{};
let
m
=
{};
// 车系
if
(
n
)
{
m
=
(
n
.
childs
||
[]).
find
((
j
)
=>
j
.
id
==
data
.
subBrandId
);
}
console
.
log
(
m
);
if
(
m
)
{
km
=
(
m
.
childs
||
[]).
find
((
j
)
=>
j
.
id
==
data
.
seriesId
);
}
let
_series
=
{
label
:
""
,
prop
:
"seriesId"
,
type
:
"select"
,
options
:
n
?
n
.
childs
:
[],
key
:
"name"
,
value
:
"id"
,
clearable
:
true
,
group
:
true
,
filterable
:
true
,
selectChange
:
this
.
changeCarModel
,
};
let
_models
=
{
label
:
""
,
prop
:
"typeId"
,
type
:
"select"
,
options
:
km
?
km
.
childs
:
[],
key
:
"name"
,
value
:
"id"
,
clearable
:
true
,
filterable
:
true
,
};
let
i
=
_list
.
findIndex
((
k
)
=>
k
.
prop
==
"seriesId"
);
let
ia
=
_list
.
findIndex
((
k
)
=>
k
.
prop
==
"typeId"
);
if
(
i
>=
0
)
{
this
.
$set
(
this
.
vehicleDefalutData
,
i
,
_series
);
}
else
{
_list
.
splice
(
idx
+
1
,
0
,
_series
);
}
if
(
ia
>=
0
)
{
this
.
$set
(
this
.
vehicleDefalutData
,
ia
,
_models
);
}
else
{
_list
.
splice
(
idx
+
2
,
0
,
_models
);
}
//this.changeCarBrand(data.brandId)
//this.changeCarModel(data.seriesId, _series)
}
return
_list
;
},
addDevice
(){
if
(
this
.
snForm
.
deviceArr
.
length
===
9
)
return
this
.
snForm
.
deviceArr
.
push
({
sn
:
''
,
deviceType
:
''
})
this
.
snRules
[
'device'
+
(
this
.
snForm
.
deviceArr
.
length
-
1
)]
=
this
.
snRules
.
device0
},
removeDevice
(
index
)
{
if
(
this
.
snForm
.
deviceArr
.
length
==
1
)
return
this
.
snForm
.
deviceArr
.
splice
(
index
,
1
)
},
// 监听输入
onInput
(
e
){
console
.
log
(
this
.
searchForm
);
this
.
$refs
.
serchButton
.
$el
.
click
();
},
FreqModalChange
(
isOpen
){
this
.
freqVisible
=
isOpen
;
},
gotoMonitor
()
{
console
.
log
(
this
.
vehicleForm
)
/* let snO = {
name: this.vehicleForm.name,
standNo: this.vehicleForm.vin,
sn: this.vehicleForm.trackInfo.sn,
sourceType: this.vehicleForm.trackInfo.source === 0?'无线':'有线',
source: this.vehicleForm.trackInfo.source
} */
//this.$router.push({ name: 'monitor', params: { snArr: [snO], mode: 'monitor' }})
//let routeData = this.$router.resolve({ path: '../oEshield#/monitor/monitor', query: { snArr: JSON.stringify([snO])}});
// window.open(routeData.href, '_blank');
//location.href = '/trialRun#/vehicleSubmit'//'/oEshield#/monitor/monitor?vin='+this.vehicleForm.vin
history
.
pushState
(
null
,
'name'
,
'/oEshield#/monitor/monitor?vin='
+
this
.
vehicleForm
.
vin
)
}
},
components
:
{
freqModal
}
};
</
script
>
<
style
>
.searchTop.inline
.search-form
{
max-width
:
1200px
;
position
:
relative
;
}
.searchTop.inline
.el-form-item
{
width
:
auto
;
max-width
:
430px
;
}
.searchTop.inline
.search-form
.el-form-item__content
{
width
:
auto
;
}
.searchTop.inline
.el-input
.el-input__inner
{
width
:
360px
;
}
.searchTop.inline
.el-select
.el-input__inner
{
width
:
120px
;
}
.searchTop.inline
.el-form-item__label
{
width
:
5em
;
}
.freq_table
{
border-collapse
:
collapse
;
width
:
100%
;
}
.freq_table
th
,
.freq_table
td
{
border
:
1px
solid
#ccc
;
padding
:
2px
;
text-align
:
center
;
}
.unvisible
{
visibility
:
hidden
;
}
</
style
>
\ No newline at end of file
src/views/vehicleManage/vehicleList.vue
View file @
e7ccbde
<
template
>
<div
class=
"system-container"
>
<div
class=
"container"
>
<!-- 搜索区域 开始 -->
<search-form
class=
"searchTop border-shadow vehicle inline"
:formModel=
"searchForm"
:formList=
"vehicleFormList"
@
input=
"onInput"
>
<span
class=
"sinline-b"
slot=
"form-slot"
>
<el-button
type=
"primary"
:size=
"btn_size"
icon=
"el-icon-search"
ref=
"serchButton"
:id=
"vehicleTableParams.btnId"
>
搜索
</el-button>
<el-button
type=
"primary"
:size=
"btn_size"
icon=
"el-icon-refresh"
@
click=
"refresh"
>
重置
</el-button>
</span>
</search-form>
<!-- 搜索区域 end -->
<!-- 操作按钮区域 开始 -->
<h3>
车辆列表
<div
class=
"pull-right"
>
<template>
...
...
@@ -14,12 +19,15 @@
</
template
>
</div>
</h3>
<!-- 操作按钮区域 end -->
<!-- 列表数据 开始 -->
<basic-table
ref=
"vehicleForm"
:beforeSearchFn=
"beforeSearchFn"
:tableParams=
"vehicleTableParams"
:getListApi=
"getListApi"
:searchForm=
"searchForm"
@
dataFinished=
"tableDataFinished"
:hasNum=
"false"
>
<span
slot=
"table-button"
slot-scope=
"scope"
>
<el-button
v-for=
"(j, idx) in vehicleTableParams.tableOption.btnList"
:key=
"idx"
:type=
"j.type || 'text'"
size=
"mini"
plain
@
click=
"btnClick(j.pType, scope.scope)"
>
{{j.name}}
</el-button>
<el-button
v-if=
"scope.scope.sns"
type=
"text"
size=
"mini"
@
click=
"btnClick('unbind', scope.scope)"
>
解绑
</el-button>
<!-- <el-button v-if="scope.scope.adjFreq === 1" type="text" size="mini" @click="btnClick('freq', scope.scope)">一键调频</el-button> -->
<el-dropdown
v-if=
"scope.scope.adjFreq"
@
command=
"handleCommand"
style=
"margin-left:5px"
>
<el-dropdown
v-if=
"scope.scope.adjFreq"
@
command=
"handleCommand"
style=
"margin-left:5px"
>
<el-button
size=
"mini"
>
<i
class=
"el-icon-arrow-down"
></i>
</el-button>
...
...
@@ -29,71 +37,133 @@
</el-dropdown>
</span>
</basic-table>
<!-- 列表数据 end -->
<!-- 新增、编辑、查看弹框 开始 -->
<basic-dialog
width=
"800px"
:title=
"vehicleTitle"
:isVisible=
"vehicleVisible"
:hasOk=
"vehicleHasOk"
@
confirmDialog=
"handleConfirm('create')"
@
closeDialog=
"handleClose('create')"
>
<slot>
<div
v-loading=
"formLoading"
>
<el-form
ref=
"snForm"
:model=
"snForm"
:rules=
"snRules"
:inline=
"false"
size=
"mini"
label-width=
"140px"
>
<el-row>
<el-col
:span=
"20"
>
<el-row
v-for=
"(item, index) in snForm.deviceArr"
:key=
"index"
>
<i
v-show=
"!isViewMode"
@
click=
"removeDevice(index)"
class=
"el-icon-remove-outline"
style=
"position: absolute;font-size: 20px; margin-left:20px; line-height:30px;"
></i>
<el-col
:span=
"12"
>
<el-form-item
label=
"设备SN号"
class=
"is-required"
:prop=
"'device'+index"
>
<el-input
v-model=
"item.sn"
:disabled=
"item.disabled"
></el-input>
</el-form-item>
</el-col>
<el-col
:span=
"12"
>
<el-form-item
label=
"设备型号:"
>
<el-input
disabled
v-model=
"item.deviceType"
></el-input>
</el-form-item>
</el-col>
</el-row>
</el-col>
<el-col
:span=
"4"
>
<i
v-show=
"!isViewMode"
@
click=
"addDevice"
class=
"el-icon-circle-plus-outline"
style=
"font-size: 20px; margin-left:20px; line-height:30px;"
></i>
</el-col>
</el-row>
</el-form>
<rule-form
:ruleForm=
"vehicleForm"
:rules=
"vehicleRules"
:ruleData=
"vehicleData"
:labelWidth=
"'140px'"
ref=
'vehicleRuleForm'
></rule-form>
<el-row>
<el-col
:span=
"24"
>
<el-form
label-width=
"120px"
>
<el-form-item
label=
"操作日志"
v-show=
"isViewMode"
>
<table
class=
"freq_table"
v-loading=
"freqLoading"
style=
"min-height: 40px"
>
<tr
v-show=
"freqTableData.length"
>
<th
width=
"80"
>
调频时间
</th>
<th
width=
"80"
>
调频模式
</th>
<th
width=
"100"
>
上点频次
</th>
<th>
调频上点个数
</th>
<th>
设备上点总个数
</th>
<th>
剩余电量
</th>
<th>
调频操作人
</th>
</tr>
<tr
v-for=
"item in freqTableData"
>
<td>
{{item.createTime}}
</td>
<td>
{{item.freqTypeStr}}
</td>
<td>
{{item.frequency}}
</td>
<td>
{{item.freTotal}}
</td>
<td>
{{item.devicePointTotal}}
</td>
<td>
{{item.batteryLevel}}%
</td>
<td>
{{item.operation}}
</td>
</tr>
</table>
<div
class=
"dialog_content"
v-loading=
"formLoading"
>
<el-form
class=
"el_form"
ref=
"snForm"
:model=
"snForm"
:rules=
"vehicleRules"
:inline=
"false"
:disabled=
"isReadonly"
size=
"mini"
label-width=
"100px"
>
<h2
class=
"h2_title"
>
设备信息
</h2>
<el-form-item
label=
""
class=
"long_form_item"
v-for=
"(item, index) in snForm.deviceInfoDtos"
:key=
"index"
label-width=
"0"
>
<div
class=
"el_item_inner"
>
<el-form-item
label=
"设备SN号"
class=
"is-required"
:prop=
"'device'+index"
>
<el-input
v-model=
"item.sn"
disabled
></el-input>
</el-form-item>
</el-form>
</el-col>
</el-row>
<el-form-item
label=
"设备型号:"
class=
"is-required"
>
<el-input
v-model=
"item.deviceClassifyName"
disabled
></el-input>
</el-form-item>
</div>
</el-form-item>
<h2
class=
"h2_title"
>
车主信息
</h2>
<el-form-item
label=
"姓名:"
prop=
"ownerName"
>
<el-input
v-model=
"snForm.ownerName"
maxlength=
"50"
clearable
></el-input>
</el-form-item>
<el-form-item
label=
"性别:"
prop=
"ownerSex"
>
<el-select
v-model=
"snForm.ownerSex"
>
<el-option
label=
"男"
value=
"男"
></el-option>
<el-option
label=
"女"
value=
"女"
></el-option>
</el-select>
</el-form-item>
<el-form-item
label=
"联系方式:"
prop=
"ownerTel"
class=
"long_form_item"
>
<el-input
v-model=
"snForm.ownerTel"
maxlength=
"11"
clearable
></el-input>
</el-form-item>
<h2
class=
"h2_title"
>
车辆信息
</h2>
<el-form-item
label=
"车牌号:"
prop=
"licensePlate"
class=
"long_form_item"
>
<el-input
v-model=
"snForm.licensePlate"
maxlength=
"9"
clearable
></el-input>
</el-form-item>
<el-form-item
label=
"车架号:"
prop=
"vin"
class=
"long_form_item"
>
<div
class=
"el_item_inner"
>
<el-input
v-model=
"snForm.vin"
class=
"a_input"
maxlength=
"17"
clearable
:disabled=
"vinEdit"
></el-input>
<el-button
type=
"primary"
v-if=
"vinEdit"
@
click=
"vinEdit = !vinEdit"
>
编辑
</el-button>
<el-button
v-else
@
click=
"vinEdit = !vinEdit"
>
取消
</el-button>
</div>
</el-form-item>
<el-form-item
label=
"发动机号:"
prop=
"engine"
class=
"long_form_item"
>
<el-input
v-model=
"snForm.engine"
maxlength=
"50"
clearable
></el-input>
</el-form-item>
<el-form-item
label=
"车辆归属:"
prop=
"organizationName"
class=
"long_form_item"
>
<el-input
v-model=
"snForm.organizationName"
readonly
@
click
.
native=
"selectStore"
></el-input>
</el-form-item>
<el-form-item
label=
"车型/车系:"
prop=
"carIds"
class=
"long_form_item"
>
<el-cascader
v-model=
"snForm.carIds"
:options=
"vehicleList"
:props=
"vehicleProps"
class=
"el_cascader"
></el-cascader>
</el-form-item>
<el-form-item
label=
"排量:"
class=
"long_form_item"
>
<el-input
v-model=
"snForm.displacement"
maxlength=
"50"
clearable
></el-input>
</el-form-item>
<el-form-item
label=
"车辆标签:"
prop=
"vehicleType"
>
<el-select
v-model=
"snForm.vehicleType"
>
<el-option
label=
"试驶车"
:value=
"1"
></el-option>
<el-option
label=
"服务车"
:value=
"3"
></el-option>
<el-option
label=
"代步车"
:value=
"4"
></el-option>
<el-option
label=
"救援车"
:value=
"5"
></el-option>
<el-option
label=
"办公车"
:value=
"6"
></el-option>
<el-option
label=
"其他"
:value=
"7"
></el-option>
</el-select>
</el-form-item>
<el-form-item
label=
"车辆用途:"
prop=
"vehicleUsages"
>
<el-select
v-model=
"snForm.vehicleUsages"
>
<el-option
label=
"专属用途"
:value=
"1"
></el-option>
<el-option
label=
"非专属用途"
:value=
"2"
></el-option>
</el-select>
</el-form-item>
<el-form-item
label=
"备注:"
class=
"long_form_item"
>
<el-input
type=
"textarea"
v-model=
"snForm.remark"
maxlength=
"200"
rows=
"4"
resize=
"none"
></el-input>
</el-form-item>
</el-form>
<
template
v-if=
"dialogType == 'view'"
>
<h2
class=
"h2_title"
>
特殊操作记录
</h2>
<table
class=
"freq_table el_table"
v-loading=
"freqLoading"
>
<tr>
<th
width=
"20%"
>
调频时间
</th>
<th
width=
"16%"
>
调频模式
</th>
<th
width=
"10%"
>
上点频次
</th>
<th
width=
"14%"
>
调频上点个数
</th>
<th
width=
"16%"
>
设备上点总个数
</th>
<th
width=
"10%"
>
剩余电量
</th>
<th
width=
"14%"
>
调频操作人
</th>
</tr>
<tr
v-for=
"(item,index) in freqTableData"
:key=
"index"
>
<td>
{{
item
.
createTime
}}
</td>
<td>
{{
item
.
freqTypeStr
}}
</td>
<td>
{{
item
.
frequency
}}
</td>
<td>
{{
item
.
freTotal
}}
</td>
<td>
{{
item
.
devicePointTotal
}}
</td>
<td>
{{
item
.
batteryLevel
}}
%
</td>
<td>
{{
item
.
operation
}}
</td>
</tr>
<tr
v-if=
"!freqTableData || freqTableData.length
<
=0">
<td
colspan=
"7"
>
暂无特殊操作日志
</td>
</tr>
</table>
<h2
class=
"h2_title"
>
操作日志
</h2>
<table
class=
"freq_table el_table"
v-loading=
"freqLoading"
>
<tr>
<th
width=
"33.3%"
>
操作项
</th>
<th
width=
"33.3%"
>
操作时间
</th>
<th
width=
"33.4%"
>
操作人
</th>
</tr>
<tr
v-for=
"(item,index) in freqTableData"
:key=
"index"
>
<td>
{{
item
.
createTime
}}
</td>
<td>
{{
item
.
freqTypeStr
}}
</td>
<td>
{{
item
.
frequency
}}
</td>
</tr>
<tr
v-if=
"!freqTableData || freqTableData.length
<
=0">
<td
colspan=
"7"
>
暂无特殊操作日志
</td>
</tr>
</table>
</
template
>
</div>
</slot>
<
template
v-slot:btn-front
>
<el-button
type=
"primary"
@
click=
"gotoMonitor()"
size=
"small"
v-show=
"isViewMode"
>
监控
</el-button>
</
template
>
</basic-dialog>
<!-- 导入 -->
<!-- 新增、编辑、查看弹框 开始 -->
<!-- 导入弹框 开始 -->
<basic-dialog
:title=
"importTitle"
:isVisible=
"vehicleImport"
@
confirmDialog=
"handleConfirm('import')"
@
closeDialog=
"handleClose('import')"
>
<slot>
<el-form
ref=
"importRuleForm"
:rules=
"importRules"
:model=
"importForm"
label-width=
"140px"
>
...
...
@@ -115,6 +185,9 @@
</el-form>
</slot>
</basic-dialog>
<!-- 导入弹框 end -->
<!-- 车辆归属弹框 开始 -->
<basic-dialog
:title=
"filterDialogTitle"
:isVisible=
"filterVisible"
@
confirmDialog=
"filterConfirm"
@
closeDialog=
"closeFilter"
>
<slot>
<div
v-loading=
"loading"
>
...
...
@@ -126,7 +199,12 @@
</div>
</slot>
</basic-dialog>
<!-- 车辆归属弹框 end -->
<!-- 一键调频 弹框 开始 -->
<freq-modal
:freqVisible=
"freqVisible"
:frequencyForm=
"frequencyForm"
@
onFreqModalChange=
"FreqModalChange"
:sn=
"freqSn"
:enableFreq=
"enableFreq"
></freq-modal>
<!-- 一键调频 弹框 end -->
</div>
</div>
</template>
...
...
@@ -134,10 +212,11 @@
<
script
>
import
_
from
"lodash"
;
import
axios
from
"axios"
;
import
{
dictInfo
}
from
"services/common"
;
//
import { dictInfo } from "services/common";
import
{
VEHICLE_API
}
from
"@/config/config"
;
import
store
from
"@/store"
;
import
freqModal
from
'./freqModal'
import
freqModal
from
"./freqModal"
;
import
{
Validator
}
from
"@/utils/validator"
;
import
{
getVehicleList
,
getSpecialShopList
,
...
...
@@ -158,14 +237,12 @@ import {
deleteNewVehicle
,
getAdjFreqInfo
,
}
from
"services/vehicle"
;
import
{
getOrgTree
,
}
from
"services/common"
;
import
{
getOrgTree
}
from
"services/common"
;
export
default
{
data
()
{
const
_this
=
this
const
_this
=
this
;
let
checkShopName
=
(
rule
,
vaule
,
cb
)
=>
{
console
.
log
(
this
.
vehicleForm
)
console
.
log
(
this
.
vehicleForm
)
;
if
(
this
.
vehicleForm
.
organizationName
==
""
)
{
cb
(
new
Error
(
"请选择所属组织"
));
}
else
{
...
...
@@ -173,39 +250,35 @@ export default {
}
};
let
checkDevice
=
(
rule
,
value
,
cb
)
=>
{
if
(
rule
.
field
)
{
let
i
=
rule
.
field
.
split
(
'device'
)[
1
]
let
sn
=
this
.
snForm
.
deviceArr
[
i
].
sn
if
(
this
.
snForm
.
deviceArr
[
i
].
disabled
)
return
cb
()
if
(
rule
.
field
)
{
let
i
=
rule
.
field
.
split
(
"device"
)[
1
];
let
sn
=
this
.
snForm
.
deviceArr
[
i
].
sn
;
if
(
this
.
snForm
.
deviceArr
[
i
].
disabled
)
return
cb
();
if
(
sn
==
""
)
{
cb
(
new
Error
(
"请输入设备号"
));
}
if
(
sn
)
{
if
(
sn
)
{
//this._timeoutId && clearTimeout(this._timeoutId)
//this._timeoutId = setTimeout(()=>{
verifydevice
({
sn
}).
then
((
res
)
=>
{
if
(
res
.
code
==
200
)
{
checkSn
({
sn
}).
then
((
res
)
=>
{
if
(
res
.
data
)
{
this
.
snForm
.
deviceArr
[
i
].
deviceType
=
res
.
data
}
})
cb
()
}
else
{
cb
(
new
Error
(
res
.
message
))
}
})
verifydevice
({
sn
}).
then
((
res
)
=>
{
if
(
res
.
code
==
200
)
{
checkSn
({
sn
}).
then
((
res
)
=>
{
if
(
res
.
data
)
{
this
.
snForm
.
deviceArr
[
i
].
deviceType
=
res
.
data
;
}
});
cb
();
}
else
{
cb
(
new
Error
(
res
.
message
));
}
});
//}, 500)
}
else
{
cb
()
cb
()
;
}
//cb();
//cb();
}
};
return
{
searchForm
:
{},
...
...
@@ -215,24 +288,28 @@ export default {
type
:
"input"
,
inputType
:
"text"
,
prop
:
"keywords"
,
width
:
'360'
,
width
:
"360"
,
placeholder
:
"车主姓名|车架号|设备号|车型"
,
},
{
label
:
"设备类型"
,
type
:
'select'
,
prop
:
'deviceType'
,
placeholder
:
'请选择'
,
options
:
[{
label
:
'全部'
,
value
:
''
},
{
label
:
'有线'
,
value
:
'1'
},
{
label
:
'无线'
,
value
:
'0'
}]
type
:
"select"
,
prop
:
"deviceType"
,
placeholder
:
"请选择"
,
options
:
[
{
label
:
"全部"
,
value
:
""
,
},
{
label
:
"有线"
,
value
:
"1"
,
},
{
label
:
"无线"
,
value
:
"0"
,
},
],
},
/* {
label: "设备状态",
...
...
@@ -258,61 +335,73 @@ export default {
}]
}, */
{
label
:
'激活时间'
,
type
:
'daterange'
,
dateType
:
'day'
,
prop
:
'date'
,
placeholder
:
'请选择年月'
,
selectStyle
:
'width:360px'
,
label
:
"激活时间"
,
type
:
"daterange"
,
dateType
:
"day"
,
prop
:
"date"
,
placeholder
:
"请选择年月"
,
selectStyle
:
"width:360px"
,
pickerOptions
:
{
disabledDate
(
time
)
{
return
time
.
getTime
()
<
new
Date
(
_this
.
date
).
getTime
()
}
}
return
time
.
getTime
()
<
new
Date
(
_this
.
date
).
getTime
()
;
}
,
}
,
},
{
label
:
"车辆标签"
,
type
:
'select'
,
prop
:
'vehicleType'
,
placeholder
:
'请选择'
,
options
:
[{
label
:
'全部'
,
value
:
''
},
{
label
:
'试驶车 '
,
value
:
'1'
},
{
label
:
'服务车'
,
value
:
'3'
},
{
label
:
'代步车'
,
value
:
'4'
},
{
label
:
'救援车'
,
value
:
'5'
},
{
label
:
'办公车'
,
value
:
'6'
},
{
label
:
'其他'
,
value
:
'7'
}]
type
:
"select"
,
prop
:
"vehicleType"
,
placeholder
:
"请选择"
,
options
:
[
{
label
:
"全部"
,
value
:
""
,
},
{
label
:
"试驶车 "
,
value
:
"1"
,
},
{
label
:
"服务车"
,
value
:
"3"
,
},
{
label
:
"代步车"
,
value
:
"4"
,
},
{
label
:
"救援车"
,
value
:
"5"
,
},
{
label
:
"办公车"
,
value
:
"6"
,
},
{
label
:
"其他"
,
value
:
"7"
,
},
],
},
{
label
:
"车辆用途"
,
type
:
'select'
,
prop
:
'vehicleUsages'
,
placeholder
:
'请选择'
,
options
:
[{
label
:
'全部'
,
value
:
''
},
{
label
:
'专属用途'
,
value
:
'1'
},
{
label
:
'非专属用途'
,
value
:
'2'
}]
type
:
"select"
,
prop
:
"vehicleUsages"
,
placeholder
:
"请选择"
,
options
:
[
{
label
:
"全部"
,
value
:
""
,
},
{
label
:
"专属用途"
,
value
:
"1"
,
},
{
label
:
"非专属用途"
,
value
:
"2"
,
},
],
},
],
vehicleTableParams
:
{
...
...
@@ -322,7 +411,6 @@ export default {
{
label
:
"车主姓名"
,
prop
:
"ownerName"
,
},
{
label
:
"车架号"
,
...
...
@@ -367,7 +455,6 @@ export default {
prop
:
"specialState"
,
width
:
110
,
},
],
tableOption
:
{
width
:
170
,
...
...
@@ -385,23 +472,23 @@ export default {
pType
:
"view"
,
},
],
align
:
'left'
,
align
:
"left"
,
},
},
getListApi
:
getVehicleList
,
authList
:
[
{
id
:
1
,
name
:
"新增车辆"
,
type
:
"primary"
,
pType
:
"create"
,
},
{
id
:
2
,
name
:
"车辆导入"
,
type
:
"default"
,
pType
:
"import"
,
},
//
{
//
id: 1,
//
name: "新增车辆",
//
type: "primary",
//
pType: "create",
//
},
//
{
//
id: 2,
//
name: "车辆导入",
//
type: "default",
//
pType: "import",
//
},
{
id
:
3
,
name
:
"导出Excel"
,
...
...
@@ -433,7 +520,7 @@ export default {
"brandId"
,
"seriesId"
,
"typeId"
,
"remark"
"remark"
,
],
vehicleData
:
[
{
...
...
@@ -663,7 +750,12 @@ export default {
],
vehicleRules
:
{
ownerName
:
[
{
min
:
2
,
max
:
50
,
message
:
'长度在 2 到 50 个字符'
,
trigger
:
'blur'
},
{
min
:
2
,
max
:
50
,
message
:
"长度在 2 到 50 个字符"
,
trigger
:
"blur"
,
},
//{validator: this.$Common.checkName, trigger: "blur"}
],
organizationName
:
[
...
...
@@ -674,6 +766,13 @@ export default {
{
required
:
true
,
message
:
"请输入车架号"
,
trigger
:
"blur"
},
{
validator
:
this
.
$Common
.
checkvin
,
trigger
:
"blur"
},
],
ownerTel
:
[
{
pattern
:
Validator
.
PHONEREG
,
message
:
"联系方式格式不正确"
,
trigger
:
"blur"
,
},
],
/* brandId: [{ required: true, message: "请选择车型", trigger: "blur" }],
modelId: [{ required: true, message: "请选择车型", trigger: "blur" }], */
/* configId: [{ required: true, message: "请输入配置", trigger: "blur" }],
...
...
@@ -705,21 +804,19 @@ export default {
vehicleList
:
[],
loading
:
false
,
snForm
:
{
deviceArr
:
[{
sn
:
''
,
deviceType
:
''
}],
deviceArr
:
[
{
sn
:
""
,
deviceType
:
""
,
},
],
},
snRules
:
{
device0
:
[
{
validator
:
checkDevice
}
],
device0
:
[{
validator
:
checkDevice
}],
},
freqVisible
:
false
,
freqSn
:
''
,
frequencyForm
:
{
},
freqSn
:
""
,
frequencyForm
:
{},
enableFreq
:
false
,
freqTableData
:
[],
formLoading
:
true
,
...
...
@@ -730,26 +827,31 @@ export default {
isViewMode
:
false
,
importing
:
false
,
vehicleProps
:
{
value
:
"id"
,
label
:
"name"
,
children
:
"childs"
,
},
dialogType
:
""
,
vinEdit
:
true
,
// 编辑车辆是否可以编辑车架号
};
},
watch
:
{
filterText
(
val
)
{
this
.
_timeout
&&
clearTimeout
(
this
.
_timeout
)
this
.
_timeout
=
setTimeout
(()
=>
{
this
.
$refs
.
tree
.
filter
(
val
)
},
500
)
}
this
.
_timeout
&&
clearTimeout
(
this
.
_timeout
);
this
.
_timeout
=
setTimeout
(()
=>
{
this
.
$refs
.
tree
.
filter
(
val
);
},
500
);
},
},
created
()
{
this
.
vehicleListPromise
=
new
Promise
((
resolve
,
reject
)
=>
{
this
.
vehicleListPromise
=
new
Promise
((
resolve
,
reject
)
=>
{
this
.
getModels
(
resolve
);
})
})
;
},
mounted
()
{
/* dictInfo("trialdrive_vehicle_model").then((res) => {
this.vehicleData.find((item) => item.prop == "modelId").options =
res.data;
...
...
@@ -767,14 +869,14 @@ export default {
methods
:
{
beforeSearchFn
()
{
return
new
Promise
((
resolve
,
reject
)
=>
{
console
.
log
(
this
.
searchForm
.
date
)
if
(
this
.
searchForm
.
date
)
{
this
.
searchForm
.
activateTimeStart
=
this
.
searchForm
.
date
[
0
]
this
.
searchForm
.
activateTimeEnd
=
this
.
searchForm
.
date
[
1
]
console
.
log
(
this
.
searchForm
.
date
)
;
if
(
this
.
searchForm
.
date
)
{
this
.
searchForm
.
activateTimeStart
=
this
.
searchForm
.
date
[
0
]
;
this
.
searchForm
.
activateTimeEnd
=
this
.
searchForm
.
date
[
1
]
;
}
resolve
()
})
resolve
()
;
})
;
},
tableDataFinished
()
{
this
.
$nextTick
(()
=>
{
...
...
@@ -785,28 +887,33 @@ export default {
this
.
searchForm
=
{};
this
.
$refs
.
vehicleForm
.
refreshTable
();
},
// 按钮操作事件
btnClick
(
pType
,
scope
)
{
// 弹框类型
this
.
dialogType
=
pType
;
switch
(
pType
)
{
case
"create"
:
this
.
formLoading
=
true
// 新增车辆
this
.
formLoading
=
true
;
this
.
vehicleVisible
=
!
this
.
vehicleVisible
;
this
.
isReadonly
=
false
;
this
.
isCreateMode
=
true
this
.
freqLoading
=
false
this
.
isViewMode
=
false
this
.
vehicleListPromise
.
then
(()
=>
{
this
.
isCreateMode
=
true
;
this
.
freqLoading
=
false
;
this
.
isViewMode
=
false
;
this
.
vehicleListPromise
.
then
(()
=>
{
if
(
this
.
vehicleVisible
)
{
let
_list
=
_
.
cloneDeep
(
this
.
vehicleDefalutData
);
let
_arr
=
[];
_list
.
map
((
k
)
=>
{
this
.
$set
(
k
,
"disabled"
,
false
);
if
(
k
.
prop
==
'brandId'
)
{
if
(
k
.
prop
==
"brandId"
)
{
this
.
$set
(
k
,
"loading"
,
false
);
}
if
(
k
.
prop
!=
"seriesId"
&&
k
.
prop
!=
"typeId"
)
{
_arr
.
push
(
k
);
}
});
this
.
vehicleTitle
=
"新增车辆"
;
this
.
vehicleHasOk
=
true
;
...
...
@@ -816,137 +923,82 @@ export default {
if
(
this
.
$refs
.
vehicleRuleForm
)
this
.
$refs
.
vehicleRuleForm
.
$children
[
0
].
clearValidate
();
this
.
snForm
.
deviceArr
=
[{
sn
:
''
,
deviceType
:
''
}]
this
.
snForm
.
deviceArr
=
[{
sn
:
""
,
deviceType
:
""
}];
this
.
$refs
.
snForm
&&
this
.
$refs
.
snForm
.
clearValidate
();
this
.
freqTableData
=
[]
this
.
formLoading
=
false
})
this
.
freqTableData
=
[]
;
this
.
formLoading
=
false
;
})
;
break
;
case
"edit"
:
// 编辑车辆
this
.
vehicleVisible
=
!
this
.
vehicleVisible
;
this
.
isReadonly
=
false
;
this
.
formLoading
=
true
this
.
isCreateMode
=
false
this
.
freqLoading
=
false
this
.
isViewMode
=
false
this
.
vehicleListPromise
.
then
(()
=>
{
this
.
formLoading
=
true
;
this
.
isCreateMode
=
true
;
this
.
freqLoading
=
false
;
this
.
isViewMode
=
false
;
this
.
vehicleListPromise
.
then
(()
=>
{
if
(
this
.
vehicleVisible
)
{
//let _list = this.vehicleDefalutData;
this
.
vehicleTitle
=
"编辑车辆"
;
this
.
vehicleHasOk
=
true
;
getVehicleInfo
({
id
:
scope
.
id
}).
then
((
res
)
=>
{
const
{
code
,
data
}
=
res
;
if
(
code
==
200
)
{
//动态创建车系、车型选择框
let
_list
=
this
.
creatSelect
(
data
);
_list
.
map
((
k
)
=>
{
console
.
log
(
k
.
prop
)
if
(
k
.
prop
===
"vin"
||
k
.
prop
==
"organizationName"
)
{
this
.
$set
(
k
,
"disabled"
,
true
);
}
else
{
if
(
k
.
prop
==
'brandId'
)
{
this
.
$set
(
k
,
"loading"
,
false
);
}
this
.
$set
(
k
,
"disabled"
,
false
);
}
});
this
.
vehicleData
=
_
.
cloneDeep
(
_list
);
this
.
vehicleArr
.
forEach
((
item
)
=>
{
if
(
item
==
"serveType"
){
this
.
$set
(
this
.
vehicleForm
,
item
,
data
[
item
]
+
""
);
}
else
{
this
.
$set
(
this
.
vehicleForm
,
item
,
data
[
item
]);
if
(
item
==
'brandId'
)
{
this
.
changeCarBrand
(
data
.
brandId
,
true
)
}
}
});
this
.
vehicleForm
.
id
=
scope
.
id
;
this
.
snForm
.
deviceArr
=
data
.
deviceInfoDtos
.
map
((
item
,
i
)
=>
{
//this.snRules['device'+i] = this.snRules['device0']
return
{
sn
:
item
.
sn
,
deviceType
:
item
.
deviceClassifyName
,
disabled
:
true
,
}
})
this
.
formLoading
=
false
data
.
carIds
=
[
data
.
brandId
,
data
.
subBrandId
,
data
.
seriesId
,
data
.
modelId
,
];
this
.
snForm
=
{
...
data
};
console
.
log
(
this
.
snForm
);
this
.
formLoading
=
false
;
}
});
this
.
freqTableData
=
[]
this
.
freqTableData
=
[]
;
}
})
})
;
break
;
case
"view"
:
// 查看车辆
console
.
log
(
"view"
);
this
.
formLoading
=
true
this
.
formLoading
=
true
;
this
.
vehicleVisible
=
!
this
.
vehicleVisible
;
this
.
isReadonly
=
true
;
this
.
isCreateMode
=
false
this
.
isViewMode
=
true
this
.
vehicleListPromise
.
then
(()
=>
{
this
.
isCreateMode
=
false
;
this
.
isViewMode
=
true
;
this
.
vehicleListPromise
.
then
(()
=>
{
if
(
this
.
vehicleVisible
)
{
getVehicleInfo
({
id
:
scope
.
id
}).
then
((
res
)
=>
{
const
{
code
,
data
}
=
res
;
if
(
code
==
200
)
{
//动态创建车系、车型选择框
let
_list
=
this
.
creatSelect
(
data
);
_list
.
map
((
k
)
=>
{
this
.
$set
(
k
,
"disabled"
,
true
);
if
(
k
.
prop
==
'brandId'
)
{
this
.
$set
(
k
,
"loading"
,
false
);
}
});
this
.
vehicleData
=
_
.
cloneDeep
(
_list
);
this
.
vehicleArr
.
forEach
((
item
)
=>
{
if
(
item
==
"serveType"
){
this
.
$set
(
this
.
vehicleForm
,
item
,
data
[
item
]
+
""
);
}
else
{
this
.
$set
(
this
.
vehicleForm
,
item
,
data
[
item
]);
if
(
item
==
'brandId'
)
{
this
.
changeCarBrand
(
data
.
brandId
,
'view'
)
}
}
});
this
.
snForm
.
deviceArr
=
data
.
deviceInfoDtos
.
map
((
item
,
i
)
=>
{
//this.snRules['device'+i] = this.snRules['device0']
return
{
sn
:
item
.
sn
,
deviceType
:
item
.
deviceClassifyName
,
disabled
:
true
}
})
this
.
formLoading
=
false
data
.
carIds
=
[
data
.
brandId
,
data
.
subBrandId
,
data
.
seriesId
,
data
.
modelId
,
];
this
.
snForm
=
{
...
data
};
console
.
log
(
this
.
snForm
);
this
.
formLoading
=
false
;
}
});
this
.
vehicleTitle
=
"查看车辆"
;
this
.
vehicleHasOk
=
false
;
//this.vehicleData.map((item) => this.$set(item, "disabled", true));
// if (item.type == 'input') this.$set(item, 'readonly', true)
// else this.$set(item, 'disabled', true)
// })
this
.
freqTableData
=
[]
this
.
freqLoading
=
true
this
.
freqTableData
=
[];
this
.
freqLoading
=
true
;
getAdjFreqInfo
({
sn
:
scope
.
sn
sn
:
scope
.
sn
,
}).
then
((
res
)
=>
{
this
.
freqTableData
=
res
.
data
this
.
freqLoading
=
false
})
this
.
freqTableData
=
res
.
data
;
this
.
freqLoading
=
false
;
})
;
}
})
})
;
break
;
case
"delete"
:
this
.
$confirm
(
"是否要删除?"
,
"提示"
,
{
...
...
@@ -954,10 +1006,10 @@ export default {
cancelButtonText
:
"取消"
,
type
:
"warning"
,
}).
then
(()
=>
{
deleteNewVehicle
({
deleteNewVehicle
({
vdId
:
scope
.
vdId
,
//sn: scope.sn
}).
then
((
res
)
=>
{
}).
then
((
res
)
=>
{
const
{
code
,
message
}
=
res
;
if
(
code
==
200
)
{
this
.
$message
({
...
...
@@ -1009,114 +1061,64 @@ export default {
url
:
`
${
store
.
state
.
baseURL
}
/trialdrive/vehicle/vehicleinfo/export`
,
method
:
"GET"
,
data
:
this
.
searchForm
,
fileName
:
'车辆列表'
+
moment
().
format
(
'YYYY.MM.DD'
)
+
'.xls'
fileName
:
"车辆列表"
+
moment
().
format
(
"YYYY.MM.DD"
)
+
".xls"
,
});
break
;
case
"freq"
:
this
.
freqSn
=
scope
.
sn
;
this
.
freqVisible
=
true
;
this
.
freqVisible
=
true
;
break
;
}
},
handleCommand
(
command
){
if
(
command
.
indexOf
(
'freq'
)
>-
1
){
this
.
freqSn
=
command
.
split
(
'freq'
)[
1
];
this
.
freqVisible
=
true
;
}
},
getCommand
(
type
,
val
,
enable
){
if
(
type
===
'freq'
)
{
this
.
enableFreq
=
enable
===
'true'
?
true
:
false
}
return
type
+
val
},
handleCommand
(
command
)
{
if
(
command
.
indexOf
(
"freq"
)
>
-
1
)
{
this
.
freqSn
=
command
.
split
(
"freq"
)[
1
];
this
.
freqVisible
=
true
;
}
},
getCommand
(
type
,
val
,
enable
)
{
if
(
type
===
"freq"
)
{
this
.
enableFreq
=
enable
===
"true"
?
true
:
false
;
}
return
type
+
val
;
},
// 新增车辆、编辑车辆
handleConfirm
(
type
)
{
switch
(
type
)
{
case
"create"
:
//console.log(this.vehicleForm, this.vehicleData);
Promise
.
all
([
this
.
formPromise
()
,
this
.
snPromise
()]).
then
((
arr
)
=>
{
Promise
.
all
([
this
.
formPromise
()
]).
then
((
arr
)
=>
{
let
params
=
arr
[
0
];
params
.
deviceInfoDtos
=
arr
[
1
]
console
.
log
(
arr
)
//params.deviceInfoDtos = arr[1];
let
api
=
addNewVehicle
;
if
(
params
.
id
)
api
=
updateNewVehicle
;
api
(
params
).
then
((
res
)
=>
{
const
{
code
,
message
}
=
res
;
if
(
code
==
200
)
{
this
.
$message
({
message
:
"操作成功"
,
type
:
"success"
,
});
this
.
vehicleVisible
=
!
this
.
vehicleVisible
;
this
.
$refs
.
vehicleForm
.
refreshTable
();
}
else
{
this
.
$message
({
message
:
message
,
type
:
"error"
,
});
}
});
})
return
this
.
$refs
.
vehicleRuleForm
.
$children
[
0
].
validate
((
valid
)
=>
{
//console.log(valid, this.$refs.vehicleRuleForm);
if
(
valid
)
{
let
params
=
_
.
cloneDeep
(
this
.
vehicleForm
);
//const { typeId, configId } = params;
// let _list = this.vehicleData.find(
// (item) => item.prop == "typeId"
// ).options;
// let o = _list.find((j) => j.id == typeId);
// if (o) {
// params.modelName = o.name;
// }
// else params.modelName = modelId
// params.configDesc = this.vehicleData
// .find((item) => item.prop == "configId")
// .options.find((j) => j.id == configId).dictLabel;
params
.
organizationId
=
params
.
organizationId
params
.
modelId
=
params
.
typeId
delete
params
.
brandId
;
delete
params
.
seriesId
;
delete
params
.
organizationId
;
delete
params
.
organizationName
;
delete
params
.
typeId
;
console
.
log
(
params
)
return
;
let
api
=
addVehicle
;
if
(
params
.
id
)
api
=
editVehicle
;
api
(
params
).
then
((
res
)
=>
{
const
{
code
,
message
}
=
res
;
if
(
code
==
200
)
{
this
.
$message
({
message
:
"操作成功"
,
type
:
"success"
,
});
this
.
vehicleVisible
=
!
this
.
vehicleVisible
;
this
.
$refs
.
vehicleForm
.
refreshTable
();
}
else
{
this
.
$message
({
message
:
message
,
type
:
"error"
,
});
}
});
}
if
(
params
.
id
)
api
=
updateNewVehicle
;
api
(
params
).
then
((
res
)
=>
{
const
{
code
,
message
}
=
res
;
if
(
code
==
200
)
{
this
.
$message
({
message
:
"操作成功"
,
type
:
"success"
,
});
this
.
vehicleVisible
=
!
this
.
vehicleVisible
;
this
.
$refs
.
vehicleForm
.
refreshTable
();
}
else
{
this
.
$message
({
message
:
message
,
type
:
"error"
,
});
}
});
});
break
;
case
"import"
:
console
.
log
(
this
.
importForm
.
file
);
if
(
this
.
importing
)
return
if
(
this
.
importing
)
return
;
var
data
=
new
FormData
();
data
.
append
(
"file"
,
this
.
importForm
.
file
);
this
.
importing
=
true
this
.
importing
=
true
;
axios
({
headers
:
{
"Content-Type"
:
"multipart/form-data"
,
...
...
@@ -1127,7 +1129,7 @@ export default {
data
,
}).
then
((
res
)
=>
{
console
.
log
(
res
);
this
.
importing
=
false
this
.
importing
=
false
;
if
(
res
.
data
.
code
==
200
)
{
this
.
exportData
=
res
.
data
.
data
;
}
else
{
...
...
@@ -1140,56 +1142,76 @@ export default {
break
;
}
},
// 校验表格
formPromise
()
{
return
new
Promise
((
resovle
,
reject
)
=>
{
this
.
$refs
.
vehicleRuleForm
.
$children
[
0
].
validate
((
valid
)
=>
{
//console.log(valid, this.$refs.vehicleRuleForm);
if
(
valid
)
{
let
params
=
_
.
cloneDeep
(
this
.
vehicleForm
);
//const { typeId, configId } = params;
// let _list = this.vehicleData.find(
// (item) => item.prop == "typeId"
// ).options;
// let o = _list.find((j) => j.id == typeId);
// if (o) {
// params.modelName = o.name;
// }
// else params.modelName = modelId
// params.configDesc = this.vehicleData
// .find((item) => item.prop == "configId")
// .options.find((j) => j.id == configId).dictLabel;
params
.
modelId
=
params
.
typeId
/* delete params.brandId;
delete params.seriesId;
delete params.organizationId;
delete params.organizationName;
delete params.typeId; */
resovle
(
params
)
}
return
new
Promise
((
resovle
,
reject
)
=>
{
this
.
$refs
.
snForm
.
validate
((
valid
)
=>
{
//console.log(valid, this.$refs.vehicleRuleForm);
if
(
!
valid
)
{
return
false
;
}
})
})
let
m
=
this
.
vehicleList
;
let
params
=
_
.
cloneDeep
(
this
.
snForm
);
if
(
params
.
carIds
&&
params
.
carIds
.
length
>
0
)
{
params
.
brandId
=
params
.
carIds
[
0
];
params
.
subBrandId
=
params
.
carIds
[
1
];
params
.
seriesId
=
params
.
carIds
[
2
];
params
.
modelId
=
params
.
carIds
[
3
];
params
.
typeId
=
params
.
carIds
[
3
];
// 品牌
let
b
=
m
.
find
((
k
)
=>
k
.
id
==
params
.
carIds
[
0
]);
params
.
brandName
=
b
.
name
;
// 子品牌
let
s
=
((
b
&&
b
.
childs
)
||
[]).
find
(
(
k
)
=>
k
.
id
==
params
.
carIds
[
1
]
);
params
.
subBrandName
=
s
.
name
;
// 车系
let
se
=
((
s
&&
s
.
childs
)
||
[]).
find
(
(
k
)
=>
k
.
id
==
params
.
carIds
[
2
]
);
params
.
seriesName
=
se
.
name
;
// 车型
let
me
=
((
se
&&
se
.
childs
)
||
[]).
find
(
(
k
)
=>
k
.
id
==
params
.
carIds
[
3
]
);
params
.
modelName
=
me
.
name
;
params
.
typeName
=
me
.
name
;
delete
params
.
carIds
;
}
//params.modelId = params.typeId;
resovle
(
params
);
});
});
},
// 校验设备号
snPromise
()
{
return
new
Promise
((
resovle
,
reject
)
=>
{
return
new
Promise
((
resovle
,
reject
)
=>
{
this
.
$refs
.
snForm
.
validate
((
valid
)
=>
{
if
(
valid
)
{
resovle
(
this
.
snForm
.
deviceArr
.
filter
(
item
=>
item
.
sn
).
map
((
item
)
=>
{
return
{
sn
:
item
.
sn
,
deviceClassifyName
:
item
.
deviceType
}
}))
resovle
(
this
.
snForm
.
deviceArr
.
filter
((
item
)
=>
item
.
sn
)
.
map
((
item
)
=>
{
return
{
sn
:
item
.
sn
,
deviceClassifyName
:
item
.
deviceType
,
};
})
);
}
})
})
})
;
})
;
},
handleClose
(
type
)
{
this
.
btnClick
(
type
);
...
...
@@ -1210,7 +1232,7 @@ export default {
getStoreList
()
{
let
_this
=
this
;
_this
.
loading
=
true
;
getOrgTree
({
hasUserLeaf
:
true
}).
then
((
res
)
=>
{
getOrgTree
({
hasUserLeaf
:
true
}).
then
((
res
)
=>
{
const
{
code
,
data
}
=
res
;
_this
.
loading
=
false
;
if
(
code
==
200
)
{
...
...
@@ -1218,9 +1240,11 @@ export default {
}
});
},
// 选择组织树
filterConfirm
()
{
const
{
label
,
id
,
origin
}
=
this
.
$refs
.
tree
.
getCurrentNode
();
if
(
origin
.
type
!==
'u'
)
{
if
(
origin
.
type
!==
"u"
)
{
this
.
$message
({
message
:
"请选择下级所属组织"
,
type
:
"error"
,
...
...
@@ -1229,7 +1253,9 @@ export default {
}
this
.
$set
(
this
.
vehicleForm
,
"organizationName"
,
label
);
this
.
vehicleForm
.
organizationId
=
id
;
this
.
$refs
.
vehicleRuleForm
.
$children
[
0
].
validateField
(
'organizationName'
)
//this.$refs.vehicleRuleForm.$children[0].validateField("organizationName");
this
.
$set
(
this
.
snForm
,
"organizationName"
,
label
);
this
.
snForm
.
organizationId
=
id
;
this
.
closeFilter
();
},
filterNode
(
value
,
data
)
{
...
...
@@ -1278,10 +1304,10 @@ export default {
let
o
=
_this
.
vehicleDefalutData
;
let
m
=
o
.
find
((
k
)
=>
k
.
prop
==
"brandId"
);
m
.
options
=
_list
;
m
.
loading
=
false
m
.
loading
=
false
;
_this
.
vehicleList
=
_list
;
this
.
vehicleListInit
=
true
resolve
()
this
.
vehicleListInit
=
true
;
resolve
()
;
});
},
...
...
@@ -1311,32 +1337,29 @@ export default {
}
else
{
list
.
splice
(
idx
+
1
,
0
,
n
);
}
if
(
flag
)
{
let
row
=
list
.
find
((
item
)
=>
item
.
prop
===
'seriesId'
)
setTimeout
(()
=>
{
let
id
=
this
.
vehicleForm
.
typeId
this
.
changeCarModel
(
this
.
vehicleForm
.
seriesId
,
row
)
this
.
vehicleForm
.
typeId
=
id
},
500
)
if
(
flag
)
{
let
row
=
list
.
find
((
item
)
=>
item
.
prop
===
"seriesId"
);
setTimeout
(()
=>
{
let
id
=
this
.
vehicleForm
.
typeId
;
this
.
changeCarModel
(
this
.
vehicleForm
.
seriesId
,
row
);
this
.
vehicleForm
.
typeId
=
id
;
},
500
);
}
list
.
map
((
k
)
=>
{
if
(
flag
==
'view'
)
{
if
(
flag
==
"view"
)
{
this
.
$set
(
k
,
"disabled"
,
true
);
}
else
if
(
!
this
.
isCreateMode
)
{
}
else
if
(
!
this
.
isCreateMode
)
{
if
(
k
.
prop
===
"vin"
||
k
.
prop
==
"organizationName"
)
{
this
.
$set
(
k
,
"disabled"
,
true
);
}
else
{
}
else
{
this
.
$set
(
k
,
"disabled"
,
false
);
}
}
else
{
}
else
{
this
.
$set
(
k
,
"disabled"
,
false
);
}
});
this
.
$set
(
this
,
"vehicleDefalutData"
,
list
);
this
.
vehicleData
=
_
.
cloneDeep
(
list
);
...
...
@@ -1381,11 +1404,11 @@ export default {
}
list
.
map
((
k
)
=>
{
if
(
k
.
prop
===
'typeId'
)
{
if
(
this
.
isViewMode
)
{
this
.
$set
(
k
,
'disabled'
,
true
)
}
else
{
this
.
$set
(
k
,
'disabled'
,
false
)
if
(
k
.
prop
===
"typeId"
)
{
if
(
this
.
isViewMode
)
{
this
.
$set
(
k
,
"disabled"
,
true
);
}
else
{
this
.
$set
(
k
,
"disabled"
,
false
);
}
}
});
...
...
@@ -1396,7 +1419,8 @@ export default {
},
// 动态创建选择框
creatSelect
(
data
)
{
console
.
log
(
data
)
creatSelect
(
data
)
{
console
.
log
(
data
);
let
nList
=
this
.
vehicleList
;
let
_list
=
_
.
cloneDeep
(
this
.
vehicleDefalutData
);
//动态创建车系、车型选择框
...
...
@@ -1463,28 +1487,21 @@ export default {
return
_list
;
},
addDevice
(){
if
(
this
.
snForm
.
deviceArr
.
length
===
9
)
return
this
.
snForm
.
deviceArr
.
push
({
sn
:
''
,
deviceType
:
''
})
this
.
snRules
[
'device'
+
(
this
.
snForm
.
deviceArr
.
length
-
1
)]
=
this
.
snRules
.
device0
},
removeDevice
(
index
)
{
if
(
this
.
snForm
.
deviceArr
.
length
==
1
)
return
this
.
snForm
.
deviceArr
.
splice
(
index
,
1
)
},
// 监听输入
onInput
(
e
){
onInput
(
e
)
{
console
.
log
(
this
.
searchForm
);
this
.
$refs
.
serchButton
.
$el
.
click
();
},
FreqModalChange
(
isOpen
){
// 监听一键调频变化
FreqModalChange
(
isOpen
)
{
this
.
freqVisible
=
isOpen
;
},
// 查看监控
gotoMonitor
()
{
console
.
log
(
this
.
vehicleForm
)
console
.
log
(
this
.
vehicleForm
)
;
/* let snO = {
name: this.vehicleForm.name,
standNo: this.vehicleForm.vin,
...
...
@@ -1492,52 +1509,104 @@ export default {
sourceType: this.vehicleForm.trackInfo.source === 0?'无线':'有线',
source: this.vehicleForm.trackInfo.source
} */
//this.$router.push({ name: 'monitor', params: { snArr: [snO], mode: 'monitor' }})
//let routeData = this.$router.resolve({ path: '../oEshield#/monitor/monitor', query: { snArr: JSON.stringify([snO])}});
// window.open(routeData.href, '_blank');
//this.$router.push({ name: 'monitor', params: { snArr: [snO], mode: 'monitor' }})
//location.href = '/trialRun#/vehicleSubmit'//'/oEshield#/monitor/monitor?vin='+this.vehicleForm.vin
history
.
pushState
(
null
,
'name'
,
'/oEshield#/monitor/monitor?vin='
+
this
.
vehicleForm
.
vin
)
}
//let routeData = this.$router.resolve({ path: '../oEshield#/monitor/monitor', query: { snArr: JSON.stringify([snO])}});
// window.open(routeData.href, '_blank');
//location.href = '/trialRun#/vehicleSubmit'//'/oEshield#/monitor/monitor?vin='+this.vehicleForm.vin
history
.
pushState
(
null
,
"name"
,
"/oEshield#/monitor/monitor?vin="
+
this
.
vehicleForm
.
vin
);
},
},
components
:
{
freqModal
}
freqModal
,
}
,
};
</
script
>
<
style
>
.searchTop.inline
.search-form
{
max-width
:
1200px
;
position
:
relative
;
}
.searchTop.inline
.el-form-item
{
width
:
auto
;
max-width
:
430px
;
.searchTop.inline
.search-form
{
max-width
:
1200px
;
position
:
relative
;
}
.searchTop.inline
.el-form-item
{
width
:
auto
;
max-width
:
430px
;
}
.searchTop.inline
.search-form
.el-form-item__content
{
width
:
auto
;
}
.searchTop.inline
.el-input
.el-input__inner
{
width
:
360px
;
}
.searchTop.inline
.el-select
.el-input__inner
{
width
:
120px
;
}
.searchTop.inline
.el-form-item__label
{
width
:
5em
;
}
.freq_table
{
border-collapse
:
collapse
;
width
:
100%
;
}
.freq_table
th
,
.freq_table
td
{
border
:
1px
solid
#ccc
;
padding
:
2px
;
text-align
:
center
;
}
.unvisible
{
visibility
:
hidden
;
}
</
style
>
<
style
lang=
"scss"
scoped
>
.el_form
{
display
:
flex
;
flex-wrap
:
wrap
;
.el-form-item
{
flex
:
0
0
50%
;
}
.searchTop.inline
.search-form
.el-form-item__content
{
width
:
auto
;
.h2_title
,
.long_form_item
{
flex
:
0
0
100%
;
}
.searchTop.inline
.el-input
.el-input__inner
{
width
:
360px
;
//
.h2_title
{
//
font-size
:
14px
;
//
font-weight
:
500
;
//
color
:
#999
;
//
}
.el_cascader
{
width
:
100%
;
}
.searchTop.inline
.el-select
.el-input__inner
{
width
:
120px
;
.el_item_inner
{
display
:
flex
;
align-items
:
center
;
.el-form-item
{
flex
:
0
0
50%
;
}
.a_input
{
margin-right
:
10px
;
}
}
.searchTop.inline
.el-form-item__label
{
width
:
5em
;
}
.dialog_content
{
.h2_title
{
font-size
:
14px
;
font-weight
:
500
;
color
:
#999
;
}
.freq_table
{
border-collapse
:
collapse
;
width
:
100%
;
}
.el_table
{
th
{
font-weight
:
normal
;
background
:
#f2f2f2
;
}
.freq_table
th
,
.freq_table
td
{
border
:
1px
solid
#ccc
;
padding
:
2px
;
text-align
:
center
;
}
.unvisible
{
visibility
:
hidden
;
th
,
td
{
padding
:
8px
0
;
}
}
</
style
>
\ No newline at end of file
Write
Preview
Markdown
is supported
Attach a file
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to post a comment