Commit 259197d5 by 吴娟华

'1.2.1'

1 parent eb307a59
......@@ -1730,16 +1730,6 @@
"integrity": "sha1-/q7SVZc9LndVW4PbwIhRpsY1IPo=",
"dev": true
},
"ansi-styles": {
"version": "4.3.0",
"resolved": "https://registry.nlark.com/ansi-styles/download/ansi-styles-4.3.0.tgz",
"integrity": "sha1-7dgDYornHATIWuegkG7a00tkiTc=",
"dev": true,
"optional": true,
"requires": {
"color-convert": "^2.0.1"
}
},
"cacache": {
"version": "13.0.1",
"resolved": "https://registry.npm.taobao.org/cacache/download/cacache-13.0.1.tgz?cache=0&sync_timestamp=1594429684526&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Fcacache%2Fdownload%2Fcacache-13.0.1.tgz",
......@@ -1766,34 +1756,6 @@
"unique-filename": "^1.1.1"
}
},
"chalk": {
"version": "4.1.1",
"resolved": "https://registry.nlark.com/chalk/download/chalk-4.1.1.tgz?cache=0&sync_timestamp=1618995367379&other_urls=https%3A%2F%2Fregistry.nlark.com%2Fchalk%2Fdownload%2Fchalk-4.1.1.tgz",
"integrity": "sha1-yAs/qyi/Y3HmhjMl7uZ+YYt35q0=",
"dev": true,
"optional": true,
"requires": {
"ansi-styles": "^4.1.0",
"supports-color": "^7.1.0"
}
},
"color-convert": {
"version": "2.0.1",
"resolved": "https://registry.npm.taobao.org/color-convert/download/color-convert-2.0.1.tgz",
"integrity": "sha1-ctOmjVmMm9s68q0ehPIdiWq9TeM=",
"dev": true,
"optional": true,
"requires": {
"color-name": "~1.1.4"
}
},
"color-name": {
"version": "1.1.4",
"resolved": "https://registry.nlark.com/color-name/download/color-name-1.1.4.tgz",
"integrity": "sha1-wqCah6y95pVD3m9j+jmVyCbFNqI=",
"dev": true,
"optional": true
},
"find-cache-dir": {
"version": "3.3.1",
"resolved": "https://registry.npm.taobao.org/find-cache-dir/download/find-cache-dir-3.3.1.tgz",
......@@ -1815,25 +1777,6 @@
"path-exists": "^4.0.0"
}
},
"has-flag": {
"version": "4.0.0",
"resolved": "https://registry.npm.taobao.org/has-flag/download/has-flag-4.0.0.tgz",
"integrity": "sha1-lEdx/ZyByBJlxNaUGGDaBrtZR5s=",
"dev": true,
"optional": true
},
"loader-utils": {
"version": "2.0.0",
"resolved": "https://registry.nlark.com/loader-utils/download/loader-utils-2.0.0.tgz?cache=0&sync_timestamp=1618846812625&other_urls=https%3A%2F%2Fregistry.nlark.com%2Floader-utils%2Fdownload%2Floader-utils-2.0.0.tgz",
"integrity": "sha1-5MrOW4FtQloWa18JfhDNErNgZLA=",
"dev": true,
"optional": true,
"requires": {
"big.js": "^5.2.2",
"emojis-list": "^3.0.0",
"json5": "^2.1.2"
}
},
"locate-path": {
"version": "5.0.0",
"resolved": "https://registry.npm.taobao.org/locate-path/download/locate-path-5.0.0.tgz",
......@@ -1898,16 +1841,6 @@
"minipass": "^3.1.1"
}
},
"supports-color": {
"version": "7.2.0",
"resolved": "https://registry.npm.taobao.org/supports-color/download/supports-color-7.2.0.tgz?cache=0&sync_timestamp=1618560983872&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Fsupports-color%2Fdownload%2Fsupports-color-7.2.0.tgz",
"integrity": "sha1-G33NyzK4E4gBs+R4umpRyqiWSNo=",
"dev": true,
"optional": true,
"requires": {
"has-flag": "^4.0.0"
}
},
"terser-webpack-plugin": {
"version": "2.3.8",
"resolved": "https://registry.npm.taobao.org/terser-webpack-plugin/download/terser-webpack-plugin-2.3.8.tgz?cache=0&sync_timestamp=1602701885709&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Fterser-webpack-plugin%2Fdownload%2Fterser-webpack-plugin-2.3.8.tgz",
......@@ -1924,18 +1857,6 @@
"terser": "^4.6.12",
"webpack-sources": "^1.4.3"
}
},
"vue-loader-v16": {
"version": "npm:vue-loader@16.2.0",
"resolved": "https://registry.nlark.com/vue-loader/download/vue-loader-16.2.0.tgz",
"integrity": "sha1-BGpTMI3Ufljv4g3ewe3sAnzjtG4=",
"dev": true,
"optional": true,
"requires": {
"chalk": "^4.1.0",
"hash-sum": "^2.0.0",
"loader-utils": "^2.0.0"
}
}
}
},
......@@ -7781,6 +7702,11 @@
"minimist": "^1.2.5"
}
},
"moment": {
"version": "2.29.1",
"resolved": "https://registry.npm.taobao.org/moment/download/moment-2.29.1.tgz",
"integrity": "sha1-sr52n6MZQL6e7qZGnAdeNQBvo9M="
},
"move-concurrently": {
"version": "1.0.1",
"resolved": "https://registry.npm.taobao.org/move-concurrently/download/move-concurrently-1.0.1.tgz",
......@@ -11938,6 +11864,11 @@
"integrity": "sha1-UylVzB6yCKPZkLOp+acFdGV+CPI=",
"dev": true
},
"vue-infinite-loading": {
"version": "2.4.5",
"resolved": "https://registry.nlark.com/vue-infinite-loading/download/vue-infinite-loading-2.4.5.tgz?cache=0&sync_timestamp=1625030403493&other_urls=https%3A%2F%2Fregistry.nlark.com%2Fvue-infinite-loading%2Fdownload%2Fvue-infinite-loading-2.4.5.tgz",
"integrity": "sha1-zCD9QK9/IBiABkQ8mbYEcM8d4bM="
},
"vue-loader": {
"version": "15.9.3",
"resolved": "https://registry.npm.taobao.org/vue-loader/download/vue-loader-15.9.3.tgz?cache=0&sync_timestamp=1600850354305&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Fvue-loader%2Fdownload%2Fvue-loader-15.9.3.tgz",
......@@ -11959,6 +11890,87 @@
}
}
},
"vue-loader-v16": {
"version": "npm:vue-loader@16.5.0",
"resolved": "https://registry.nlark.com/vue-loader/download/vue-loader-16.5.0.tgz?cache=0&sync_timestamp=1628666753201&other_urls=https%3A%2F%2Fregistry.nlark.com%2Fvue-loader%2Fdownload%2Fvue-loader-16.5.0.tgz",
"integrity": "sha1-CcTgcSRmiZ40uZpoZSTxkWX7KJI=",
"dev": true,
"optional": true,
"requires": {
"chalk": "^4.1.0",
"hash-sum": "^2.0.0",
"loader-utils": "^2.0.0"
},
"dependencies": {
"ansi-styles": {
"version": "4.3.0",
"resolved": "https://registry.nlark.com/ansi-styles/download/ansi-styles-4.3.0.tgz",
"integrity": "sha1-7dgDYornHATIWuegkG7a00tkiTc=",
"dev": true,
"optional": true,
"requires": {
"color-convert": "^2.0.1"
}
},
"chalk": {
"version": "4.1.2",
"resolved": "https://registry.nlark.com/chalk/download/chalk-4.1.2.tgz?cache=0&sync_timestamp=1627646697260&other_urls=https%3A%2F%2Fregistry.nlark.com%2Fchalk%2Fdownload%2Fchalk-4.1.2.tgz",
"integrity": "sha1-qsTit3NKdAhnrrFr8CqtVWoeegE=",
"dev": true,
"optional": true,
"requires": {
"ansi-styles": "^4.1.0",
"supports-color": "^7.1.0"
}
},
"color-convert": {
"version": "2.0.1",
"resolved": "https://registry.npm.taobao.org/color-convert/download/color-convert-2.0.1.tgz",
"integrity": "sha1-ctOmjVmMm9s68q0ehPIdiWq9TeM=",
"dev": true,
"optional": true,
"requires": {
"color-name": "~1.1.4"
}
},
"color-name": {
"version": "1.1.4",
"resolved": "https://registry.nlark.com/color-name/download/color-name-1.1.4.tgz",
"integrity": "sha1-wqCah6y95pVD3m9j+jmVyCbFNqI=",
"dev": true,
"optional": true
},
"has-flag": {
"version": "4.0.0",
"resolved": "https://registry.nlark.com/has-flag/download/has-flag-4.0.0.tgz",
"integrity": "sha1-lEdx/ZyByBJlxNaUGGDaBrtZR5s=",
"dev": true,
"optional": true
},
"loader-utils": {
"version": "2.0.0",
"resolved": "https://registry.nlark.com/loader-utils/download/loader-utils-2.0.0.tgz?cache=0&sync_timestamp=1618846812625&other_urls=https%3A%2F%2Fregistry.nlark.com%2Floader-utils%2Fdownload%2Floader-utils-2.0.0.tgz",
"integrity": "sha1-5MrOW4FtQloWa18JfhDNErNgZLA=",
"dev": true,
"optional": true,
"requires": {
"big.js": "^5.2.2",
"emojis-list": "^3.0.0",
"json5": "^2.1.2"
}
},
"supports-color": {
"version": "7.2.0",
"resolved": "https://registry.nlark.com/supports-color/download/supports-color-7.2.0.tgz?cache=0&sync_timestamp=1626703414084&other_urls=https%3A%2F%2Fregistry.nlark.com%2Fsupports-color%2Fdownload%2Fsupports-color-7.2.0.tgz",
"integrity": "sha1-G33NyzK4E4gBs+R4umpRyqiWSNo=",
"dev": true,
"optional": true,
"requires": {
"has-flag": "^4.0.0"
}
}
}
},
"vue-router": {
"version": "3.4.6",
"resolved": "https://registry.npmjs.org/vue-router/-/vue-router-3.4.6.tgz",
......
......@@ -13,12 +13,14 @@
"clipboard": "^2.0.4",
"core-js": "^3.6.5",
"element-ui": "^2.13.2",
"js-md5": "^0.7.3",
"lodash": "^4.17.10",
"moment": "^2.29.1",
"qs": "^6.10.0",
"vue": "^2.6.11",
"vue-infinite-loading": "^2.4.5",
"vue-router": "^3.4.6",
"vuex": "^3.5.1",
"lodash": "^4.17.10",
"js-md5": "^0.7.3",
"qs": "^6.10.0"
"vuex": "^3.5.1"
},
"devDependencies": {
"@vue/cli-plugin-babel": "~4.5.0",
......
......@@ -7,6 +7,8 @@
:close-on-click-modal="false"
:width="width"
class="app-dialog"
:append-to-body="true"
:tabindex="1"
>
<div class="container">
<slot></slot>
......
......@@ -41,7 +41,7 @@
</template>
<template v-else-if="item.type === 'daterange'">
<el-date-picker
style="width: 100%;"
:style="item.selectStyle || 'width: 100%;'"
v-model="formModel[item.prop]"
type="daterange"
range-separator="至"
......
......@@ -11,6 +11,9 @@ import './core/public-path';
import { Common } from '@/utils/common.js'
import Constants from '@/utils/constants.js'
import actions from '@/core/actions';
import moment from 'moment'
window.moment = moment
// import axios from 'axios'
Vue.prototype.btn_size = 'mini'
Vue.prototype.$Common = Common
......
......@@ -42,6 +42,15 @@ const routes = [
}
},
{
path: '/vehicleManage/vehicleList',
name: 'vehicleManage',
component: () => import('../views/vehicleManage/vehicleList.vue'),
meta: {
title: '列表',
keepAlive: true
}
},
{
path: '/vehicleSubmit',
name: 'vehicleSubmit',
component: () => import('../views/vehicleSubmit/index.vue'),
......@@ -79,6 +88,15 @@ const routes = [
}
},
{
path: '/reportManage/outStore',
name: 'outStore',
component: () => import('../views/reportManage/outStore.vue'),
meta: {
title: '无在店统计',
keepAlive: true
}
},
{
path: '/specialShop',
name: 'specialShop',
component: () => import('../views/specialShop/index.vue'),
......
......@@ -25,4 +25,8 @@ function getSimpleList (params) {
return request(params, url)
}
export { getProvinceList, dictInfo, getSimpleRoot, getSimpleList }
function getOrgTree(params) {
return request(params, '/usercenter/organization/orgtree')
}
export { getProvinceList, dictInfo, getSimpleRoot, getSimpleList, getOrgTree }
......@@ -13,4 +13,8 @@ function getYears (params) {
return request(params, url)
}
export { getList, getYears }
function getOutStoreList (params) {
return request(params, '/trialdrive/notinstorereport/search')
}
export { getList, getYears, getOutStoreList }
import { VEHICLE_API } from '@/config/config'
import request from '@/services/request'
import { VEHICLE_API } from "@/config/config";
import request from "@/services/request";
// 获取车辆列表
function getList (params) {
const url = VEHICLE_API.VEHICLE_SEARCH
return request(params, url)
function getList(params) {
const url = VEHICLE_API.VEHICLE_SEARCH;
return request(params, url);
}
/*特约店列表*/
function getSpecialShopList (params) {
const url = VEHICLE_API.SPECIAL_SHOP_LIST
return request(params, url)
function getSpecialShopList(params) {
const url = VEHICLE_API.SPECIAL_SHOP_LIST;
return request(params, url);
}
// 新增车辆
function addVehicle (params) {
const url = VEHICLE_API.VEHICLE_ADD
return request(params, url, 'post')
function addVehicle(params) {
const url = VEHICLE_API.VEHICLE_ADD;
return request(params, url, "post");
}
// 编辑车辆
function editVehicle (params) {
const url = VEHICLE_API.VEHICLE_EDIT
return request(params, url, 'post')
function editVehicle(params) {
const url = VEHICLE_API.VEHICLE_EDIT;
return request(params, url, "post");
}
// 解绑车辆
function infoVehicle (params) {
const url = VEHICLE_API.VEHICLE_INFO
return request(params, url)
function infoVehicle(params) {
const url = VEHICLE_API.VEHICLE_INFO;
return request(params, url);
}
// 批量删除车辆
function deleteVehicle (params) {
const url = VEHICLE_API.VEHICLE_DELETE
return request(params, url)
function deleteVehicle(params) {
const url = VEHICLE_API.VEHICLE_DELETE;
return request(params, url);
}
// 解绑车辆
function unbindVehicle (params) {
const url = VEHICLE_API.VEHICLE_UNBIND
return request(params, url)
function unbindVehicle(params) {
const url = VEHICLE_API.VEHICLE_UNBIND;
return request(params, url);
}
// 下载模板
function downloadtemplate (params) {
const url = VEHICLE_API.DOWNLOAD_TEMPLATE
return request(params, url)
function downloadtemplate(params) {
const url = VEHICLE_API.DOWNLOAD_TEMPLATE;
return request(params, url);
}
// 导入车辆
function importVehicle (params) {
const url = VEHICLE_API.VEHICLE_IMPORT
return request(params, url, 'post')
function importVehicle(params) {
const url = VEHICLE_API.VEHICLE_IMPORT;
return request(params, url, "post");
}
// 导出车辆
function exportVehicle (params) {
const url = VEHICLE_API.VEHICLE_EXPORT
return request(params, url)
function exportVehicle(params) {
const url = VEHICLE_API.VEHICLE_EXPORT;
return request(params, url);
}
// 获取车型数据
function GETVEHICLETREE (params) {
const url = VEHICLE_API.VEHICLE_TREE
return request(params, url)
function GETVEHICLETREE(params) {
const url = VEHICLE_API.VEHICLE_TREE;
return request(params, url);
}
export { getList, getSpecialShopList, addVehicle, downloadtemplate, editVehicle, deleteVehicle, unbindVehicle, importVehicle, exportVehicle, infoVehicle,GETVEHICLETREE }
function getVehicleList(params) {
return request(params, '/trialdrive/vehicle/vehicleinfo/search');
}
function checkSn(params) {
return request(params, '/trialdrive/vehicle/vehicleinfo/getclassifynamebysn');
}
function verifydevice(params) {
return request(params, '/trialdrive/vehicle/vehicleinfo/verifydevice');
}
function addNewVehicle(params) {
return request(params, '/trialdrive/vehicle/vehicleinfo/save', "post");
}
function updateNewVehicle(params) {
return request(params, '/trialdrive/vehicle/vehicleinfo/update', "post");
}
function getVehicleInfo(params) {
return request(params, '/trialdrive/vehicle/vehicleinfo/findone');
}
function deleteNewVehicle(params) {
return request(params, '/trialdrive/vehicle/vehicleinfo/delete');
}
function adjFreq(params) {
return request(params, '/trialdrive/vehicle/adjFreq', "post");
}
function listtestdrive(params) {
return request(params, '/trialdrive/vehicle/drivevehicle/listtestdrive');
}
function addtestdrive(params) {
return request(params, '/trialdrive/vehicle/drivevehicle/addtestdrive', "post");
}
export {
getList,
getSpecialShopList,
addVehicle,
downloadtemplate,
editVehicle,
deleteVehicle,
unbindVehicle,
importVehicle,
exportVehicle,
infoVehicle,
GETVEHICLETREE,
getVehicleList,
checkSn,
verifydevice,
addNewVehicle,
getVehicleInfo,
adjFreq,
listtestdrive,
addtestdrive,
deleteNewVehicle,
updateNewVehicle,
};
<template>
<div class="system-container">
<div class="container">
<h1>无在店统计</h1>
<div class="m-b-md">统计车辆在店情况,以自然日为时间单位判断车辆在店情况,统计报表中有数值代表车辆不在店</div>
<search-form
class="searchTop border-shadow"
:formModel="searchForm"
:formList="reportFormList"
>
<span
class="inline-b"
slot="form-slot"
>
<el-button
type="primary"
:size="btn_size"
icon="el-icon-search"
:id="reportTableParams.btnId"
>搜索</el-button>
<el-button
type="primary"
:size="btn_size"
icon="el-icon-refresh"
@click="refresh"
>重置</el-button>
</span>
</search-form>
<h3>
无在店信息
<el-button
class="pull-right"
type="primary"
:size="btn_size"
@click="btnClick('export')"
>导出Excel</el-button>
</h3>
<basic-table
ref="reportTable"
:tableParams="reportTableParams"
:beforeSearchFn="beforeSearchFn"
:searchForm="searchDataForm"
:getListApi="getListApi"
:hasNum="false"
>
</basic-table>
</div>
</div>
</template>
<script>
import { REPORT_API } from '@/config/config'
import store from '@/store'
import { getOutStoreList, getYears } from 'services/report'
export default {
data() {
const _this = this
return {
searchDataForm: {},
searchForm: {},
reportFormList: [
{
type: 'input',
inputType: 'text',
prop: 'keywords',
placeholder: '特约店编码|店名称|车架号|车型',
},
{
type: 'singleDate',
dateType: 'month',
prop: 'date',
placeholder: '请选择年月',
pickerOptions: {
disabledDate(time) {
return time.getTime() < new Date(_this.date).getTime()
}
}
}
],
reportTableParams: {
btnId: new Date().getTime() + parseInt(Math.random() * 1000),
listName: 'list',
tableOption: false,
tableColumns: [
{
label: '特约店编码',
prop: 'shopCode'
}, {
label: '特约店名称',
prop: 'shopName'
}, {
label: '车型',
prop: 'modelName'
}, {
label: '车架号VIN码',
prop: 'vin',
width: 120
}, {
label: '时间',
prop: 'statDate'
}
]
},
getListApi: getOutStoreList,
date: ''
}
},
mounted() {
getYears({}).then(res => {
console.log(res.data[0])
this.date = `${res.data[0]}-01-01`
})
for (let i = 1; i <= 31; i++) {
this.reportTableParams.tableColumns.push({
label: `${i}日`,
prop: `dayNum${i}`
})
if (i == 31) {
this.reportTableParams.tableColumns.push({
label: '总计',
prop: 'summation'
})
}
}
},
methods: {
refresh() {
this.searchForm = {}
this.searchDataForm = {}
this.$refs.reportTable.refreshTable()
},
beforeSearchFn() {
return new Promise((resolve, reject) => {
console.log(this.searchForm.date)
if (this.searchForm.date) {
this.searchDataForm.year = this.searchForm.date.split('-')[0]
this.searchDataForm.month = this.searchForm.date.split('-')[1]
} else {
this.searchDataForm.year = ''
this.searchDataForm.month = ''
}
this.searchDataForm.keywords = this.searchForm.keywords
resolve()
})
},
btnClick(type, scope) {
this.$Common.exportExcel({
url: `${store.state.baseURL}${REPORT_API.REPORT_EXPORT}`,
method: 'GET',
data: this.searchDataForm,
fileName: '导出报表Excel'
})
}
},
}
</script>
<style>
</style>
\ No newline at end of file
<template>
<!-- 一键调频弹框 -->
<el-dialog
title="一键调频"
:visible="freqVisible"
@open="openDialog"
@close="closeDialog"
append-to-body
width="640px"
:close-on-click-modal="false"
>
<el-form
:model="freqForm"
ref="form"
:rules="rules"
:show-message="true"
:inline="true"
size="mini"
label-width="80px"
>
<el-row>
<el-radio v-model="freqForm.fqType" label="0">追车模式</el-radio>
<span class="freq-des"
>(适用于收车场景,指定设备每隔几分钟更新定位信息)</span
>
</el-row>
<el-row class="row-ct">
<el-form-item label="" prop="catchingTimer">
<el-input
v-model="freqForm.catchingTimer"
:placeholder="`1~${maxNumber}`"
:maxlength="String(maxNumber).length"
></el-input> </el-form-item
>分钟
</el-row>
<el-row>
<el-radio v-model="freqForm.fqType" label="1">闹钟模式</el-radio>
<span class="freq-des"
>(适用于催款环节,增加设备每天的上点频率,防止人车失联)</span
>
</el-row>
<el-row class="row-ct">
<el-col :span="12">
<el-checkbox v-model="freqForm.fqClock1">第一组</el-checkbox>
<el-form-item>
<el-time-select
v-model="freqForm.timer1"
:editable="false"
:clearable="false"
style="width:100px"
:picker-options="{
start: '00:00',
step: '00:15',
end: '23:45',
format: 'HH:mm',
}"
>
</el-time-select>
</el-form-item>
</el-col>
<el-col :span="12">
<el-checkbox v-model="freqForm.fqClock2">第二组</el-checkbox>
<el-form-item>
<el-time-select
v-model="freqForm.timer2"
:editable="false"
:clearable="false"
style="width:100px"
:picker-options="{
start: '00:00',
step: '00:15',
end: '23:45',
format: 'HH:mm',
}"
>
</el-time-select>
</el-form-item>
</el-col>
<el-col :span="12">
<el-checkbox v-model="freqForm.fqClock3">第三组</el-checkbox>
<el-form-item>
<el-time-select
v-model="freqForm.timer3"
:editable="false"
:clearable="false"
style="width:100px"
:picker-options="{
start: '00:00',
step: '00:15',
end: '23:45',
format: 'HH:mm',
}"
>
</el-time-select>
</el-form-item>
</el-col>
<el-col :span="12">
<el-checkbox v-model="freqForm.fqClock4">第四组</el-checkbox>
<el-form-item>
<el-time-select
v-model="freqForm.timer4"
:editable="false"
:clearable="false"
style="width:100px"
:picker-options="{
start: '00:00',
step: '00:15',
end: '23:45',
format: 'HH:mm',
}"
>
</el-time-select>
</el-form-item>
</el-col>
</el-row>
<el-row class="row-ct el-form-item__error" v-show="freqForm.clockError"
>请选择至少一组闹钟模式</el-row
>
<el-row>
<el-radio v-model="freqForm.fqType" label="2">星期模式</el-radio>
<span class="freq-des"
>(适用于日常场景,可按需设置每周的设备回传次数。)</span
>
</el-row>
<el-row class="row-ct">
<el-form-item label="上点时间">
<el-time-select
v-model="freqForm.weekTimer"
:editable="false"
:clearable="false"
:picker-options="{
start: '00:00',
step: '00:15',
end: '23:45',
format: 'HH:mm',
}"
>
</el-time-select>
</el-form-item>
</el-row>
<el-row class="row-ct">
<el-form-item label="">
<el-checkbox v-model="freqForm.fqWeekday1">周一</el-checkbox>
<el-checkbox v-model="freqForm.fqWeekday2">周二</el-checkbox>
<el-checkbox v-model="freqForm.fqWeekday3">周三</el-checkbox>
<el-checkbox v-model="freqForm.fqWeekday4">周四</el-checkbox>
<el-checkbox v-model="freqForm.fqWeekday5">周五</el-checkbox>
<el-checkbox v-model="freqForm.fqWeekday6">周六</el-checkbox>
<el-checkbox v-model="freqForm.fqWeekday7">周日</el-checkbox>
</el-form-item>
</el-row>
<el-row class="row-ct el-form-item__error" v-show="freqForm.weekError"
>请选择至少一组星期模式</el-row
>
</el-form>
<div slot="footer" class="dialog-footer">
<el-button type="primary" @click="submitForm" size="small"
>确认</el-button
>
<el-button @click="$emit('onFreqModalChange', false)" size="small"
>取消</el-button
>
</div>
</el-dialog>
<!-- 查看详情弹框 /-->
</template>
<script>
import { adjFreq } from "services/vehicle";
export default {
props: ["freqVisible", "sn", "enableFreq"],
data() {
let checkCatchingTimer = (rule, vaule, cb) => {
if (this.freqForm.fqType == "0") {
if (!/^[^0]\d{0,3}$/.test(this.freqForm.catchingTimer)) {
cb(new Error(`请输入分钟数,1~${this.maxNumber}`));
} else if (this.freqForm.catchingTimer > this.maxNumber) {
cb(new Error(`请输入分钟数,1~${this.maxNumber}`));
}
}
cb();
};
const timePattern = /^(([0-1]\d|2[0-3])\:[0-5]\d)$|^24\:00$/;
/*let checkTimer1 = (rule, vaule, cb)=>{console.log(this.freqForm.timer1)
if(this.freqForm.fqType == '1' && this.freqForm.fqClock1 && !timePattern.test(this.freqForm.timer1)){
cb(new Error('请输入正确的时间格式'))
}
}*/
return {
freqForm: {
fqType: "0",
catchingTimer: "",
fqClock1: true,
fqClock2: false,
fqClock3: false,
fqClock4: false,
timer1: "01:00",
timer2: "10:00",
timer3: "14:00",
timer4: "23:00",
weekTimer: "10:00",
fqWeekday1: true,
fqWeekday2: false,
fqWeekday3: false,
fqWeekday4: false,
fqWeekday5: false,
fqWeekday6: false,
fqWeekday7: false,
clockError: false,
weekError: false,
},
rules: {
catchingTimer: [{ validator: checkCatchingTimer, trigger: "blur" }],
},
};
},
computed: {
maxNumber() {
return this.enableFreq ? 5555 : 999;
},
},
methods: {
openDialog() {
this.$emit("onFreqModalChange", true);
},
closeDialog() {
this.$refs.form.resetFields();
this.$emit("onFreqModalChange", false);
},
getParams() {
const form = this.freqForm;
const params = {};
params.sn = this.sn;
params.type = form.fqType;
switch (form.fqType) {
case "0":
params.catchingTimer = form.catchingTimer;
break;
case "1":
let _timer = [];
if (form.fqClock1) {
_timer.push(form.timer1);
}
if (form.fqClock2) {
_timer.push(form.timer2);
}
if (form.fqClock3) {
_timer.push(form.timer3);
}
if (form.fqClock4) {
_timer.push(form.timer4);
}
params.timer = _timer.join(",");
break;
case "2":
let _week = [];
if (form.fqWeekday1) {
_week.push(1);
}
if (form.fqWeekday2) {
_week.push(2);
}
if (form.fqWeekday3) {
_week.push(3);
}
if (form.fqWeekday4) {
_week.push(4);
}
if (form.fqWeekday5) {
_week.push(5);
}
if (form.fqWeekday6) {
_week.push(6);
}
if (form.fqWeekday7) {
_week.push(7);
}
params.week = _week.join("");
params.weekTimer = form.weekTimer;
break;
}
console.log(params);
return params;
},
submitForm() {
if (!this.validateClock() || !this.validateWeak()) {
return false;
}
const params = this.getParams();
this.$refs.form.validate((valid, field) => {
if (valid) {
adjFreq(params).then((res) => {
if (res.code == 200) {
this.$message({
type: "success",
message: res.message,
});
this.closeDialog();
}
});
} else {
return false;
}
});
},
validateClock() {
if (this.freqForm.fqType == "1") {
if (
this.freqForm.fqClock1 ||
this.freqForm.fqClock2 ||
this.freqForm.fqClock3 ||
this.freqForm.fqClock4
) {
this.freqForm.clockError = false;
return true;
} else {
this.freqForm.clockError = true;
return false;
}
} else {
this.freqForm.clockError = false;
return true;
}
},
validateWeak() {
if (this.freqForm.fqType == "2") {
if (
this.freqForm.fqWeekday1 ||
this.freqForm.fqWeekday2 ||
this.freqForm.fqWeekday3 ||
this.freqForm.fqWeekday4 ||
this.freqForm.fqWeekday5 ||
this.freqForm.fqWeekday6 ||
this.freqForm.fqWeekday7
) {
this.freqForm.weekError = false;
return true;
} else {
this.freqForm.weekError = true;
return false;
}
} else {
this.freqForm.weekError = false;
return true;
}
},
validateForm() {},
},
components: {},
};
</script>
<style scoped>
.freq-des {
color: #999;
}
.row-ct {
padding-left: 20px;
margin-bottom: 10px;
}
</style>
......@@ -17,7 +17,7 @@
<basic-table ref="vehicleForm" :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.sns" type="text" size="mini" @click="btnClick('unbind', scope.scope)">解绑</el-button> -->
</span>
</basic-table>
<basic-dialog :title="vehicleTitle" :isVisible="vehicleVisible" :hasOk="vehicleHasOk" @confirmDialog="handleConfirm('create')" @closeDialog="handleClose('create')">
......@@ -58,6 +58,14 @@
</div>
</slot>
</basic-dialog>
<user-list
:userData="userArr"
@onUpdateUserData="updateUserData"
:userListModalVisible="userListModalVisible"
@onUserListModalChange="userListModalChange"
ref="userList">
</user-list>
</div>
</div>
</template>
......@@ -68,6 +76,7 @@ import axios from "axios";
import { dictInfo } from "services/common";
import { VEHICLE_API } from "@/config/config";
import store from "@/store";
import userList from './userList'
import {
getList,
getSpecialShopList,
......@@ -80,6 +89,8 @@ import {
exportVehicle,
infoVehicle,
GETVEHICLETREE,
listtestdrive,
addtestdrive,
} from "services/vehicle";
export default {
data() {
......@@ -97,7 +108,7 @@ export default {
type: "input",
inputType: "text",
prop: "searchKey",
placeholder: "特约店编码|店名称|车架号|设备号|车系",
placeholder: "特约店编码|店名称|车架号|设备号|车型",
},
],
vehicleTableParams: {
......@@ -192,22 +203,23 @@ export default {
authList: [
{
id: 1,
name: "新增车辆",
name: "选择试驾车辆",
type: "primary",
pType: "create",
pType: "chooseVehicle",
},
{
/* {
id: 2,
name: "车辆导入",
type: "default",
pType: "import",
},
}, */
{
id: 3,
name: "导出Excel",
type: "default",
pType: "export",
},
],
// 弹窗
vehicleHasOk: true,
......@@ -388,6 +400,9 @@ export default {
// 新增车辆-车型数据
vehicleList: [],
loading: false,
userArr:[],
userData:[],
userListModalVisible: false,
};
},
watch: {
......@@ -409,9 +424,28 @@ export default {
// this.vehicleDefalutData.find((item) => item.prop == "configId").options =
// res.data;
});
listtestdrive().then((res)=>{})
},
methods: {
updateUserData(data){
//this.userArr = data;
//this.tableData = data;
console.log(data)
addtestdrive({testDriveData: data.map((item)=>{
return {
id: item.id,
sn: item.sns.join(',')
}
})}).then((res)=>{
})
},
userListModalChange(isOpen){
this.userListModalVisible = isOpen;
},
tableDataFinished() {
this.$nextTick(() => {
this.$root.parentCommon.setAuthBtn();
......@@ -561,6 +595,10 @@ export default {
data: this.searchForm,
});
break;
case "chooseVehicle":
this.userListModalVisible = true
break;
}
},
handleConfirm(type) {
......@@ -869,5 +907,8 @@ export default {
}
},
components: {
userList
}
};
</script>
\ No newline at end of file
<template>
<!-- 关联用户弹框 -->
<el-dialog
id="userListModal"
:visible="userListModalVisible"
@open="openDialog"
@close="closeDialog"
append-to-body
width="1040px"
top="8vh"
>
<div class="dialog-header" slot="title">
<h2 class="header-title" style="margin:0">关联用户</h2>
</div>
<el-form
:model="form"
:inline="false"
size="mini"
class="main-form"
label-width="80px"
>
<el-row>
<el-form-item label="用户查询" class="pull-left">
<el-input
placeholder="请输入对应条件值"
v-model="form.queryTerm"
size="small"
class="input-with-select"
style="width:340px"
maxlength="50"
clearable
>
<el-select
v-model="form.queryType"
slot="prepend"
style="width:100px;"
placeholder="请选择"
size="small"
>
<el-option label="设备号" value="1"></el-option>
<el-option label="车架号" value="2"></el-option>
<el-option label="姓名" value="3"></el-option>
</el-select>
</el-input>
<el-button style="margin-left: 10px" type="primary" plain size="small" v-popover:popover
>更多条件
<i
class=" el-icon--right"
:class="
highSearchVisible ? 'el-icon-arrow-up' : 'el-icon-arrow-down'
"
></i>
</el-button>
<el-button type="primary" size="small" @click="search"
>查询</el-button
>
</el-form-item>
<!-- 高级搜索弹框 -->
<el-popover
ref="popover"
placement="bottom"
width="640"
v-model="highSearchVisible"
trigger="click"
@hide="popoverHide"
:tabindex="0"
>
<el-form
:inline="false"
size="mini"
label-width="120px"
class="detail-search-form"
>
<el-form-item label="激活时间">
<el-date-picker
v-model="dateRange"
size="small"
type="datetimerange"
range-separator="至"
start-placeholder="开始日期"
end-placeholder="结束日期"
>
</el-date-picker>
</el-form-item>
<el-form-item label="特约店">
<el-popover
v-model="filterVisible"
placement="bottom-start"
width="400"
@show="selectStore"
trigger="click">
<div v-loading="loading">
<el-input placeholder="输入关键字进行过滤" v-model="filterText" size="small">
</el-input>
<el-tree style="max-height:50vh;overflow:auto" class="filter-tree" :data="filterTextData" :filter-node-method="filterNode" highlight-current ref="tree" node-key="id" check-on-click-node>
</el-tree>
<p style="text-align: right; margin-top: 10px">
<el-button @click="filterConfirm" type="primary">确定</el-button>
<el-button @click="closeFilter">取消</el-button>
</p>
</div>
<el-input
v-model="organizationName"
slot="reference"
>
</el-input>
</el-popover>
</el-form-item>
</el-form>
<div class="popover-footer">
<el-button
size="small"
class="pull-right"
@click="highSearchVisible = false"
>取消</el-button
>
<el-button
type="primary"
size="small"
class="pull-right"
@click="highSearchSure"
>确认</el-button
>
</div>
</el-popover>
<!-- 高级搜索弹框 /-->
</el-row>
<el-row >
<el-form-item label="已选条件">
<div class="tag-list">
<el-tag
v-for="tag in tags"
:key="tag.key"
closable
@close="handleClose(tag)"
:type="tag.type"
>
{{ tag.name }}
</el-tag>
</div>
</el-form-item>
</el-row>
<el-row>
<!-- <el-button
type="primary" plain size="small" class="pull-right ibox-ctrl" @click="groupImport"
>批量导入
</el-button> -->
</el-row>
<el-row>
<el-col :span="12" class="choose-list-wrap">
<p>结果列表</p>
<ul class="choose-list">
<li v-for="item in resultList" :key="item.vin">
<el-checkbox
v-model="item.checked"
@change="checkedChange(item)"
class="choose-list-checkbox"
>
<div class="choose-list-content">
<p>{{ item.ownerName }}/{{ item.vin }}</p>
<p class="choose-list-group">
<el-tag
type="info"
size="small"
v-for="snItem in item.sns"
:key="snItem"
>{{ snItem }}</el-tag
>
</p>
</div>
</el-checkbox>
</li>
<infinite-loading
v-if="needInfinite"
@infinite="infiniteHandler"
ref="infiniteLoading"
>
<span slot="no-more">没有更多数据了</span>
<span slot="no-results">无结果</span>
</infinite-loading>
</ul>
<el-checkbox v-model="checkedAll">全选</el-checkbox>
<span class="pull-right">列表记录总数 {{ total }} 条</span>
</el-col>
<el-col :span="12" class="choose-list-wrap">
<p>已选列表</p>
<ul class="choose-list">
<li v-for="item in chosenList" :key="item.vin">
<el-checkbox
v-model="item.checked"
@change="checkedChange(item)"
class="choose-list-checkbox"
>
<div class="choose-list-content">
<p>{{ item.name }}/{{ item.vin }}</p>
<p class="choose-list-group">
<el-tag
type="info"
size="small"
v-for="snItem in item.sns"
:key="snItem"
>{{ snItem }}</el-tag
>
</p>
</div>
</el-checkbox>
</li>
</ul>
<el-checkbox v-model="checkedCancel">取消</el-checkbox>
<span class="pull-right"
>列表记录总数 {{ chosenList.length }} 条</span
>
</el-col>
</el-row>
</el-form>
<div slot="footer" class="dialog-footer">
<el-button type="primary" @click="sure" size="small">确认</el-button>
<el-button @click="$emit('onUserListModalChange', false)" size="small"
>取消</el-button
>
</div>
<!-- 批量导入弹框 -->
<!-- <user-list-import @exportDate="exportDate" :userImportModalVisible="userImportModalVisible" @onUserImportModalChange="userImportModalChange" @onRefreshList="getData"></user-list-import> -->
<!-- 批量导入弹框 /-->
<!-- <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> -->
</el-dialog>
<!-- 关联用户弹框 /-->
</template>
<script>
import InfiniteLoading from "vue-infinite-loading";
const BUSINESS_SERVICE = null;
import {
listtestdrive,
getSpecialShopList,
} from "services/vehicle";
export default {
props: ["userListModalVisible", "userData", "init"],
data() {
return {
form: {
queryTerm: "",
queryType: "1",
sTime: "",
eTime: "",
},
dateType: "1",
dateRange: [],
organizationName: '',
orderStatus: "",
orderStatusOpts: [
{
name: "已提交",
value: 2,
},
{
name: "已派单",
value: 3,
},
{
name: "已激活",
value: 4,
},
{
name: "已退单",
value: 5,
},
{
name: "已拆除",
value: 6,
},
{
name: "已删除",
value: 7,
},
],
resultcheck: false,
gender: "",
resultItem: "",
highSearchVisible: false,
userImportModalVisible: false,
currentPage: 1,
pageSize: 10,
total: 0,
maxPage: 1,
resultList: [],
chosenTotal: 0,
chosenList: [],
needInfinite: false,
groupId: "",
classIdList: "",
className: "",
tags: [],
checkedAll: false,
checkedCancel: false,
params: {},
loading: true,
filterDialogTitle: "选择所属组织",
filterVisible: false,
filterText: "",
filterTextData: [],
isOpen: true,
shopNameId: '',
};
},
mounted() {
this.search();
},
watch: {
dateRange(newVal) {
if (newVal && newVal.length) {
this.form.sTime = moment(newVal[0]).format("YYYY-MM-DD HH:mm:ss");
this.form.eTime = moment(newVal[1]).format("YYYY-MM-DD HH:mm:ss");
} else {
this.form.sTime = "";
this.form.eTime = "";
}
},
checkedCancel(newVal) {
if (newVal) {
this.chosenList.forEach((item) => {
item.checked = false;
});
this.chosenList = [];
this.checkedAll = false;
}
},
init(newVal) {
if (newVal) {
this.reset();
this.$emit("onUserListInit", false);
}
},
checkedAll(newVal) {
if (newVal) {
this.resultList.forEach((item) => {
item.checked = true;
const findItem = this.chosenList.find(
(o) => o.vin === item.vin
);
if (!findItem) {
this.chosenList.push(item);
}
});
this.checkedCancel = false;
} else {
this.resultList.forEach((item) => {
item.checked = false;
const findItem = this.chosenList.find(
(o) => o.vin === item.vin
);
if (findItem) {
this.chosenList.splice(this.chosenList.indexOf(findItem), 1);
}
});
}
},
filterText(val) {
this.$refs.tree.filter(val);
},
},
methods: {
reset(date) {
this.userData = date;
this.checkedAll = false;
let arr = [];
this.userData.forEach((o) => {
o.checked = true;
arr.push(o);
});
this.chosenList = arr;
},
sure() {
const userdata = [];
this.chosenList.forEach((obj) => {
userdata.push(obj);
console.log(obj)
});
this.$emit("onUpdateUserData", userdata);
this.$emit("onUserListModalChange", false);
},
search() {
this.resultList = [];
//this.chosenList = [];
this.currentPage = 1;
this.needInfinite = false;
this.$nextTick(() => {
this.$refs.infiniteLoading &&
this.$refs.infiniteLoading.$emit("$InfiniteLoading:reset");
});
const params = this.params;
delete params.sn;
delete params.vin;
delete params.name;
delete params.workOrderNo;
const queryTerm = this.form.queryTerm.trim();
if (queryTerm) {
switch (this.form.queryType) {
case "1":
params.sn = queryTerm;
break;
case "2":
params.vin = queryTerm;
break;
case "3":
params.ownerName = queryTerm;
break;
case "4":
params.workOrderNo = queryTerm;
break;
}
}
this.needInfinite = true;
},
highSearchSure() {
this.highSearchVisible = false;
this.tags = [];
this.params = this.getParams();
//this.needInfinite = true;
},
createTag(key, label, value) {
this.tags.push({
key: key,
name: label + ":" + value,
type: "",
});
},
checkedChange(item) {
if (item.checked) {
this.resultcheck = item.checked;
this.resultItem = item;
const findItem = this.chosenList.find(
(o) => o.vin === item.vin
);
if (findItem) return;
this.chosenList.push(item);
this.checkedCancel = false;
} else {
this.chosenList.splice(this.chosenList.indexOf(item), 1);
}
},
exportDate(returnDate) {
var obj = {};
returnDate.map((obj) => {
if (obj.userTel) {
obj.sns = obj.sn.split(",");
} else {
obj.sns = [];
}
obj.checked = true;
});
console.log(returnDate);
for (var key in returnDate) {
returnDate;
obj = returnDate[key];
this.chosenList.push(obj);
this.resultcheck = true;
}
console.log(this.chosenList);
console.log(obj);
},
handleClose(tag) {
this.tags.splice(this.tags.indexOf(tag), 1);
switch (tag.key) {
case "activation":
delete this.params.buyDateStart;
delete this.params.buyDateEnd;
break;
case "expiration":
delete this.params.expirationSTime;
delete this.params.expirationETime;
break;
case "status":
delete this.params.businessStatus;
break;
case "sex":
delete this.params.sex;
break;
case "classIdList":
delete this.params.classIdList;
break;
case "shopId":
delete this.params.shopId;
break;
}
},
getParams() {
const form = this.form;
const params = {};
if (form.sTime && form.eTime) {
if (this.dateType == "1") {
params.buyDateStart = form.sTime;
params.buyDateEnd = form.eTime;
this.createTag(
"activation",
"激活时间",
params.buyDateStart + "至" + params.buyDateEnd
);
} else if (this.dateType == "2") {
params.expirationSTime = form.sTime;
params.expirationETime = form.eTime;
this.createTag(
"expiration",
"到期时间",
params.expirationSTime + "至" + params.expirationETime
);
}
}
if (this.shopNameId) {
params.shopId = this.shopNameId;
this.createTag("shopId", "特约店", this.organizationName);
}
/* if (this.orderStatus) {
params.businessStatus = this.orderStatus;
const findItem = this.orderStatusOpts.find(
(obj) => obj.value == this.orderStatus
);
if (findItem) {
this.createTag("status", "业务工单状态", findItem.name);
}
}
if (this.gender) {
params.sex = this.gender;
this.createTag("sex", "性别", params.sex == "1" ? "男" : "女");
}
if (this.classIdList) {
params.classIdList = this.classIdList;
this.createTag("classIdList", "客户归属", this.className);
} */
return params;
},
infiniteHandler($state) {
if (this.currentPage > this.maxPage) {
$state.complete();
return;
}
this.params.pageNumber = this.currentPage;
this.params.pageSize = this.pageSize;
listtestdrive(this.params).then((res) => {
if (res.code === 200) {
const data = res.data;
if (data.list && data.list.length) {
data.list.map((obj) => {
if (obj.sns) {
obj.sns = obj.sns.split(",");
} else {
obj.sns = [];
}
});
this.resultList = this.resultList.concat(data.list);
this.total = data.totalElements;
this.maxPage = Math.ceil(this.total / this.pageSize);
this.currentPage++;
$state.loaded();
} else {
$state.complete();
}
}
});
},
getData(curr = this.currentPage, size = this.pageSize) {
this.loading = true;
let params = this.getParams();
params.currentPage = curr;
params.pageSize = size;
BUSINESS_SERVICE.getWorkOrderList(params)
.then((response) => {
if (Array.isArray(response.data)) {
this.tableData = response.data;
this.total = response.recordsTotal;
} else {
this.tableData = [];
this.total = 0;
}
this.loading = false;
})
.catch((error) => console.log(error));
},
userImportModalChange(isOpen) {
this.userImportModalVisible = isOpen;
},
groupImport() {
this.userImportModalVisible = true; //
},
openDialog() {},
closeDialog() {
this.$emit("onUserListModalChange", false);
},
vechicleChange(groupId, classId, className) {
this.groupId = groupId;
this.classIdList = classId;
this.className = className;
},
// 所属组织弹窗
selectStore() {
if (this.isReadonly) return;
this.filterText = "";
this.filterDialogTitle = "选择所属组织";
if(!this.filterTextData.length) {
this.getStoreList();
}
//this.closeFilter();
},
closeFilter() {
this.filterVisible = !this.filterVisible;
},
// 获取特约门店数据
getStoreList() {
let _this = this;
_this.loading = true;
getSpecialShopList().then((res) => {
const { code, data } = res;
_this.loading = false;
if (code == 200) {
this.filterTextData = data;
}
});
},
filterConfirm() {
const { label, id, children } = this.$refs.tree.getCurrentNode();
if (children) {
this.$message({
message: "请选择下级所属组织",
type: "error",
});
return;
}
this.$set(this, "organizationName", label);
this.shopNameId = id;
this.closeFilter();
},
filterNode(value, data) {
console.log(value, data);
if (!value) return true;
return data.label.indexOf(value) !== -1;
},
popoverHide() {
if(this.filterVisible) {
this.highSearchVisible = true
}
},
},
components: {
InfiniteLoading,
},
};
</script>
<style scoped>
h3 {
margin: 10px 0px;
}
p {
margin: 0px;
}
form.main-form {
height: 540px;
overflow: auto;
margin: -30px -20px;
padding: 20px;
}
form.detail-search-form {
padding: 20px 0px;
}
.popover-footer {
border-top: 1px solid #eee;
overflow: auto;
margin: -12px;
padding: 10px;
}
.popover-footer .el-button.pull-right {
margin-left: 10px;
}
.tab-content {
margin-top: 20px;
}
.tag-list {
/* width: 100%; */
max-height: 90px;
overflow: auto;
margin: -10px 0px 0px -10px;
}
.tag-list .el-tag {
margin-left: 10px;
/* margin-top: 10px; */
}
.choose-list-wrap {
padding: 10px;
}
ul.choose-list {
height: 340px;
overflow: auto;
margin-bottom: 5px;
border: 1px solid #eee;
padding: 10px;
}
.choose-list-checkbox {
line-height: 30px;
margin: 0 5px;
}
.choose-list-content {
display: inline-block;
vertical-align: middle;
}
.choose-list-content p {
line-height: 30px;
}
.choose-list-group {
font-size: 0px;
}
.choose-list-content .el-tag {
font-size: 12px;
margin-right: 4px;
}
</style>
<style>
#userListModal .el-button.is-plain:focus,
#userListModal .el-button.is-plain:hover {
background: #409eff;
border: #409eff;
}
</style>
<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" :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="680px" :title="vehicleTitle" :isVisible="vehicleVisible" :hasOk="vehicleHasOk" @confirmDialog="handleConfirm('create')" @closeDialog="handleClose('create')">
<slot>
<el-form ref="snForm" :model="snForm" :rules="snRules" :inline="false" size="mini" label-width="120px" >
<el-row>
<el-col :span="20">
<el-row v-for="(item, index) in snForm.deviceArr" :key="index">
<el-col :span="12">
<el-form-item
label="设备SN号"
:class="index===0?'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 @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="'120px'" ref='vehicleRuleForm'></rule-form>
</slot>
</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,
} 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 (i==0 && 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",
placeholder: "车主姓名|车架号|设备号|车型",
},
{
label: "设备类型",
type: 'select',
prop: 'deviceType',
placeholder: '请选择',
width: '200px',
options: [{
label: '全部',
value: ''
}, {
label: '有线',
value: '1'
}, {
label: '无线',
value: '0'
}]
},
{
label: "设备状态",
type: 'select',
prop: 'deviceState',
placeholder: '请选择',
width: '200px',
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:350px',
pickerOptions: {
disabledDate(time) {
return time.getTime() < new Date(_this.date).getTime()
}
}
},
{
label: "车辆标签",
type: 'select',
prop: 'vehicleType',
placeholder: '请选择',
width: '200px',
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: "workorderId",
},
{
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",
},
],
},
},
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: "userTel",
type: "input",
maxlength: "50",
clearable: true,
},
{
label: "所属组织名称:",
prop: "organizationName",
type: "input",
readonly: true,
clickFunc: this.selectStore,
},
{
label: "车架号:",
prop: "vin",
type: "input",
maxlength: "17",
clearable: true,
},
{
label: "车型:",
prop: "modelId",
type: "select",
options: [],
key: "dictLabel",
value: "id",
clearable: true,
},
{
label: "配置:",
prop: "configId",
type: "select",
options: [],
key: "dictLabel",
value: "id",
clearable: true,
},
{
label: "车牌:",
prop: "licensePlate",
type: "input",
clearable: true,
maxlength: "9",
},
{ label: "外色:", prop: "color", type: "input", clearable: true },
{ label: "内色:", prop: "innerColor", type: "input", clearable: true },
{
label: "服役类型:",
prop: "serveType",
type: "select",
options: [
{ label: "未上牌", value: "0" },
{ label: "已上牌", value: "1" },
],
clearable: true,
},
{
label: "设备号:",
prop: "sn",
type: "input",
maxlength: 15,
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,
},
// {
// 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: {
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,
};
},
watch: {
filterText(val) {
this.$refs.tree.filter(val);
},
},
mounted() {
this.getModels();
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: {
tableDataFinished() {
this.$nextTick(() => {
this.$root.parentCommon.setAuthBtn();
});
},
refresh() {
this.searchForm = {};
this.$refs.vehicleForm.refreshTable();
},
btnClick(pType, scope) {
switch (pType) {
case "create":
this.vehicleVisible = !this.vehicleVisible;
this.isReadonly = false;
if (this.vehicleVisible) {
let _list = _.cloneDeep(this.vehicleDefalutData);
let _arr = [];
_list.map((k) => {
this.$set(k, "disabled", 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();
break;
case "edit":
this.vehicleVisible = !this.vehicleVisible;
this.isReadonly = false;
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{
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]);
});
this.vehicleForm.tempId = data.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,
}
})
}
});
}
break;
case "view":
console.log("view");
this.vehicleVisible = !this.vehicleVisible;
this.isReadonly = true;
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);
});
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]);
});
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.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)
// })
}
break;
case "delete":
this.$confirm("是否要删除?", "提示", {
confirmButtonText: "确定",
cancelButtonText: "取消",
type: "warning",
}).then(() => {
deleteNewVehicle({
vehicleId: scope.id,
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({ tempId: scope.tempId }).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,
});
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.tempId) 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.shopNameId
params.modelId = params.typeId
delete params.brandId;
delete params.seriesId;
delete params.shopNameId;
delete params.organizationName;
delete params.typeId;
console.log(params)
return;
let api = addVehicle;
if (params.tempId) 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);
var data = new FormData();
data.append("file", this.importForm.file);
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);
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.organizationId = params.shopNameId
params.modelId = params.typeId
delete params.brandId;
delete params.seriesId;
delete params.shopNameId;
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.isReadonly) 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.shopNameId = id;
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() {
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;
_this.vehicleList = _list;
});
},
// 监听车型选择
changeCarBrand(e) {
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);
}
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);
}
this.$set(this, "vehicleDefalutData", list);
this.vehicleData = _.cloneDeep(list);
delete this.vehicleForm.typeId;
},
// 动态创建选择框
creatSelect(data) {
let nList = this.vehicleList;
let _list = 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);
}
}
return _list;
},
addDevice(){
this.snForm.deviceArr.push({
sn: '',
deviceType: ''
})
this.snRules['device'+(this.snForm.deviceArr.length-1)] = this.snRules.device0
},
// 监听输入
onInput(e){
console.log(this.searchForm);
this.$refs.serchButton.$el.click();
},
FreqModalChange(isOpen){
this.freqVisible = isOpen;
},
},
components: {
freqModal
}
};
</script>
<style>
.searchTop.inline .el-form-item{
width: auto;
}
.searchTop.inline .search-form .el-form-item__content {
width: auto;
}
.searchTop.inline .el-input__inner{
width: 200px;
}
</style>
\ No newline at end of file
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!