Commit 6f3409ee by 胡悦

提交车辆相关接口

2 parents e77b2b95 2c8e4fb1
...@@ -41,14 +41,21 @@ const VEHICLE_API = { ...@@ -41,14 +41,21 @@ const VEHICLE_API = {
VEHICLE_ADD: '/trialdrive/vehicle/drivevehicle/add', VEHICLE_ADD: '/trialdrive/vehicle/drivevehicle/add',
VEHICLE_EDIT: '/trialdrive/vehicle/drivevehicle/update', VEHICLE_EDIT: '/trialdrive/vehicle/drivevehicle/update',
VEHICLE_DELETE: '/trialdrive/vehicle/drivevehicle/delete', VEHICLE_DELETE: '/trialdrive/vehicle/drivevehicle/delete',
VEHICLE_UNBIND: '/trialdrive/vehicle/drivevehicle/unbindSn', VEHICLE_UNBIND: '/trialdrive/vehicle/unbindSn',
DOWNLOAD_TEMPLATE: '/trialdrice/vehicle/drivevehicle/downloadtemplate', DOWNLOAD_TEMPLATE: '/trialdrive/vehicle/drivevehicle/downloadtemplate',
VEHICLE_IMPORT: '/trialdrice/vehicle/drivevehicle/import', VEHICLE_IMPORT: '/trialdrive/vehicle/drivevehicle/import',
VEHICLE_FAILFILE: '/trialdrive/vehicle/drivevehicle/downloadFailFile',
VEHICLE_EXPORT: '/trialdrive/vehicle/drivevehicle/export', VEHICLE_EXPORT: '/trialdrive/vehicle/drivevehicle/export',
VEHICLE_INFO: '/trialdrive/vehicle/drivevehicle/findbyid' VEHICLE_INFO: '/trialdrive/vehicle/drivevehicle/findbyid',
SPECIAL_SHOP_LIST: '/trialdrive/specialshop/shopusers'
} }
// 审批管理 // 审批管理
const APPROVAL_API = { const APPROVAL_API = {
TODO_SEARCH: '/trialdrive/approval/searchTodoApproval' TODO_SEARCH: '/trialdrive/approval/searchTodoApproval'
} }
export { API, COMMON_API, SPECIALSHOP_API, VEHICLE_API, APPROVAL_API, REPORT_API, VEHICLEDOC_API } // 试驾围栏审批接口
const TEST_DRIVE_API = {
TEST_DRIVE_SEARCH: '/trialdrive/approval/searchFenceApp',
UPDATE_FENCE_APPROVAL: '/trialdrive/approval/updateApproval'
}
export { API, COMMON_API, SPECIALSHOP_API, VEHICLE_API, APPROVAL_API, REPORT_API, VEHICLEDOC_API, TEST_DRIVE_API }
import { VEHICLE_API } from '@/config/config' import { TEST_DRIVE_API } from '@/config/config'
import request from '@/services/request' import request from '@/services/request'
// 获取车辆列表 // 获取试驾围栏审核列表
function getList (params) { function getList (params) {
const url = VEHICLE_API.VEHICLE_SEARCH const url = TEST_DRIVE_API.TEST_DRIVE_SEARCH
return request(params, url) return request(params, url)
} }
// 新增车辆 function updateFenceApproval (params) {
function addVehicle (params) { const url = TEST_DRIVE_API.UPDATE_FENCE_APPROVAL
const url = VEHICLE_API.VEHICLE_ADD
return request(params, url, 'post') return request(params, url, 'post')
} }
// 编辑车辆 export { getList, updateFenceApproval }
function editVehicle (params) {
const url = VEHICLE_API.VEHICLE_EDIT
return request(params, url, 'post')
}
// 批量删除车辆
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 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)
}
// 导出车辆
function exportVehicle (params) {
const url = VEHICLE_API.VEHICLE_EXPORT
return request(params, url)
}
export { getList, addVehicle, downloadtemplate, editVehicle, deleteVehicle, unbindVehicle, importVehicle, exportVehicle }
...@@ -7,6 +7,12 @@ function getList (params) { ...@@ -7,6 +7,12 @@ function getList (params) {
return request(params, url) return request(params, url)
} }
/*特约店列表*/
function getSpecialShopList (params) {
const url = VEHICLE_API.SPECIAL_SHOP_LIST
return request(params, url)
}
// 新增车辆 // 新增车辆
function addVehicle (params) { function addVehicle (params) {
const url = VEHICLE_API.VEHICLE_ADD const url = VEHICLE_API.VEHICLE_ADD
...@@ -46,7 +52,7 @@ function downloadtemplate (params) { ...@@ -46,7 +52,7 @@ function downloadtemplate (params) {
// 导入车辆 // 导入车辆
function importVehicle (params) { function importVehicle (params) {
const url = VEHICLE_API.VEHICLE_IMPORT const url = VEHICLE_API.VEHICLE_IMPORT
return request(params, url) return request(params, url, 'post')
} }
// 导出车辆 // 导出车辆
...@@ -55,4 +61,4 @@ function exportVehicle (params) { ...@@ -55,4 +61,4 @@ function exportVehicle (params) {
return request(params, url) return request(params, url)
} }
export { getList, addVehicle, downloadtemplate, editVehicle, deleteVehicle, unbindVehicle, importVehicle, exportVehicle, infoVehicle } export { getList, getSpecialShopList, addVehicle, downloadtemplate, editVehicle, deleteVehicle, unbindVehicle, importVehicle, exportVehicle, infoVehicle }
...@@ -4,7 +4,7 @@ ...@@ -4,7 +4,7 @@
<search-form <search-form
class="searchTop border-shadow testDrive" class="searchTop border-shadow testDrive"
:formModel="searchForm" :formModel="searchForm"
:formList="todoFormList" :formList="checkFormList"
> >
<slot name="form-slot"> <slot name="form-slot">
<el-button <el-button
...@@ -17,6 +17,7 @@ ...@@ -17,6 +17,7 @@
type="primary" type="primary"
:size="btn_size" :size="btn_size"
icon="el-icon-refresh" icon="el-icon-refresh"
@click="refresh"
>重置</el-button> >重置</el-button>
</slot> </slot>
</search-form> </search-form>
...@@ -34,22 +35,35 @@ ...@@ -34,22 +35,35 @@
> >
<span <span
class="dot" class="dot"
:class="scope.scope.enableStatus ? USERSTATUS[scope.scope.enableStatus].split(',')[1] : ''" :class="scope.scope.approvalStatus ? USERSTATUS[scope.scope.approvalStatus].split(',')[1] : ''"
></span> ></span>
<span class="statusText">{{ scope.scope.enableStatus ? USERSTATUS[scope.scope.enableStatus].split(',')[0] : '--'}}</span> <span class="statusText">{{ scope.scope.approvalStatus ? USERSTATUS[scope.scope.approvalStatus].split(',')[0] : '--'}}</span>
</span> </span>
<span <span
slot="table-button" slot="table-button"
slot-scope="scope" slot-scope="scope"
> >
<template v-for="(j, idx) in testDriveTableParams.tableOption.btnList">
<!-- approvalStatus为1也就是未审核状态才展示通过/驳回 -->
<template v-if="(j.pType == 'pass' || j.pType == 'reject') && scope.scope.approvalStatus == 1">
<el-button <el-button
v-for="(j, idx) in testDriveTableParams.tableOption.btnList"
:key="idx" :key="idx"
:type="j.type || 'text'" :type="j.type || 'text'"
size="mini" size="mini"
plain plain
@click="btnClick(j.pType, scope.scope)" @click="btnClick(j.pType, scope.scope)"
>{{j.name}}</el-button> >{{j.name}}</el-button>
</template>
<template v-if="(j.pType !== 'pass' && j.pType !== 'reject') && scope.scope.approvalStatus != 1">
<el-button
:key="idx"
:type="j.type || 'text'"
size="mini"
plain
@click="btnClick(j.pType, scope.scope)"
>{{j.name}}</el-button>
</template>
</template>
</span> </span>
</basic-table> </basic-table>
</div> </div>
...@@ -57,23 +71,25 @@ ...@@ -57,23 +71,25 @@
</template> </template>
<script> <script>
import { getList } from 'services/testDrive' import { getList, updateFenceApproval } from 'services/testDrive'
export default { export default {
data() { data() {
return { return {
searchForm: {}, searchForm: {
todoFormList: [ keywords: ''
},
checkFormList: [
{ {
label: '关键字:', label: '关键字:',
type: 'input', type: 'input',
inputType: 'text', inputType: 'text',
prop: 'status', prop: 'keywords',
placeholder: '特约店编码|店名称', placeholder: '特约店编码|店名称',
}, },
{ {
label: '审核状态:', label: '审核状态:',
type: 'select', type: 'select',
prop: 'enableStatus', prop: 'approvalStatus',
placeholder: '请选择审核状态', placeholder: '请选择审核状态',
options: [{ options: [{
value: '1', value: '1',
...@@ -115,6 +131,9 @@ export default { ...@@ -115,6 +131,9 @@ export default {
}, { }, {
label: '店级别', label: '店级别',
prop: 'shopLevel' prop: 'shopLevel'
}, {
label: '审核结果',
prop: 'approvalResult'
} }
], ],
tableOption: { tableOption: {
...@@ -122,23 +141,28 @@ export default { ...@@ -122,23 +141,28 @@ export default {
btnList: [ btnList: [
{ {
name: '查看原围栏', name: '查看原围栏',
pType: 'viewOrigin' pType: 'view',
}, },
{ {
name: '查看修改后围栏', name: '查看修改后围栏',
pType: 'viewUpdatedData' pType: 'view',
}, },
{ {
name: '通过', name: '通过',
pType: 'pass' pType: 'pass',
}, },
{ {
name: '驳回', name: '驳回',
pType: 'reject' pType: 'reject',
} }
] ]
} }
}, },
approvalParams: {
id: '',
status: 2,
remark: ''
},
getListApi: getList, getListApi: getList,
// 弹窗 // 弹窗
testDriveVisible: false, testDriveVisible: false,
...@@ -159,57 +183,60 @@ export default { ...@@ -159,57 +183,60 @@ export default {
}, },
methods: { methods: {
btnClick(pType, scope) { btnClick(pType, scope) {
const { approvalId } = scope;
this.approvalParams.id = approvalId;
switch (pType) { switch (pType) {
case 'create': case 'pass':
this.approvalParams.status = 2;
delete this.approvalParams.remark;
this.updateFenceApproval();
break break
case 'edit': case 'reject':
this.approvalParams.status = 3;
this.showRejectRemarks();
break break
case 'view': case 'view':
let query = {
break fenceId: scope.bizId,
case 'delete': readonlyStatus: true
this.$confirm('是否要删除?', '提示', { };
confirmButtonText: '确定', const path = '/oEshield#/monitor/editFence';
cancelButtonText: '取消', history.pushState(query, path, path);
type: 'warning'
}).then(() => {
})
break
case 'unbind':
this.$confirm('是否要解绑, 是否继续?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
})
break
case 'import':
break
case 'export':
break break
} }
}, },
handleConfirm(type) { showRejectRemarks() {
console.log(type) this.$prompt('请输入驳回原因', '提示', {
switch (type) { confirmButtonText: '确定',
case 'create': cancelButtonText: '取消'
}).then(({ value }) => {
break this.approvalParams.remark = value;
case 'edit': this.updateFenceApproval();
}).catch(() => {
break });
case 'import': },
updateFenceApproval() {
break updateFenceApproval(this.approvalParams).then(res => {
const { code, message } = res;
if(code == 200) {
this.$message({
type: 'success',
message: '操作成功!'
});
this.$refs.testDriveForm.refreshTable()
} else {
this.$message({
type: 'error',
message
});
} }
})
}, },
handleClose(type) { refresh() {
this.btnClick(type) this.searchForm = {
keywords: ''
}
this.$refs.testDriveForm.refreshTable()
} }
}, },
} }
......
...@@ -127,6 +127,8 @@ export default { ...@@ -127,6 +127,8 @@ export default {
case 'todo': case 'todo':
// 跳转 // 跳转
console.log(scope) console.log(scope)
if (scope.bizType == 1) this.$router.push({ name: 'testDriveCheckList' })
else if (scope.bizType == 2) this.$router.push({ name: 'vehicleCheck', params: { approvalId: scope.approvalId, url: 'check' } })
break break
} }
} }
......
...@@ -62,6 +62,12 @@ ...@@ -62,6 +62,12 @@
plain plain
@click="btnClick(j.pType, scope.scope)" @click="btnClick(j.pType, scope.scope)"
>{{j.name}}</el-button> >{{j.name}}</el-button>
<el-button
v-if="scope.scope.sns"
type="text"
size="mini"
@click="btnClick('unbind', scope.scope)"
>解绑</el-button>
</span> </span>
</basic-table> </basic-table>
<basic-dialog <basic-dialog
...@@ -101,6 +107,7 @@ ...@@ -101,6 +107,7 @@
<el-col :span="14"> <el-col :span="14">
<el-input <el-input
readonly readonly
:size="btn_size"
v-model="importForm.fileName" v-model="importForm.fileName"
ref="importInput" ref="importInput"
></el-input> ></el-input>
...@@ -109,8 +116,12 @@ ...@@ -109,8 +116,12 @@
:span="6" :span="6"
class="m-l-md" class="m-l-md"
> >
<el-button class="import-btn">导入文件 <el-button
class="import-btn"
:size="btn_size"
>导入文件
<input <input
:size="btn_size"
type="file" type="file"
id="importFile" id="importFile"
class="import-input" class="import-input"
...@@ -123,20 +134,58 @@ ...@@ -123,20 +134,58 @@
type="text" type="text"
class="import-template" class="import-template"
icon="el-icon-link" icon="el-icon-link"
target="_blank"
@click="downloadTemplate" @click="downloadTemplate"
>模版下载</el-button> >模版下载</el-button>
</el-form-item> </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> </el-form>
</slot> </slot>
</basic-dialog> </basic-dialog>
<basic-dialog
:title="filterDialogTitle"
:isVisible="filterVisible"
@confirmDialog="filterConfirm"
@closeDialog="closeFilter"
>
<slot>
<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>
</slot>
</basic-dialog>
</div> </div>
</div> </div>
</template> </template>
<script> <script>
import _ from 'lodash'
import axios from 'axios'
import { dictInfo } from 'services/common' import { dictInfo } from 'services/common'
import { getList, addVehicle, editVehicle, downloadtemplate, deleteVehicle, unbindVehicle, importVehicle, exportVehicle, infoVehicle } from 'services/vehicle' import { VEHICLE_API } from '@/config/config'
import store from '@/store'
import { getList, getSpecialShopList, addVehicle, editVehicle, downloadtemplate, deleteVehicle, unbindVehicle, importVehicle, exportVehicle, infoVehicle } from 'services/vehicle'
export default { export default {
data() { data() {
return { return {
...@@ -196,6 +245,7 @@ export default { ...@@ -196,6 +245,7 @@ export default {
} }
], ],
tableOption: { tableOption: {
width: 160,
btnList: [ btnList: [
{ {
name: '编辑', name: '编辑',
...@@ -208,10 +258,6 @@ export default { ...@@ -208,10 +258,6 @@ export default {
{ {
name: '查看', name: '查看',
pType: 'view' pType: 'view'
},
{
name: '解绑',
pType: 'unbind'
} }
] ]
} }
...@@ -241,96 +287,113 @@ export default { ...@@ -241,96 +287,113 @@ export default {
vehicleVisible: false, vehicleVisible: false,
vehicleTitle: '', vehicleTitle: '',
vehicleForm: {}, vehicleForm: {},
vehicleArr: ['shopName', 'vin', 'modelId', 'configDesc', 'licensePlate', 'color', 'innerColor', 'serveType', 'sn'], vehicleArr: ['shopName', 'vin', 'modelId', 'configId', 'licensePlate', 'color', 'innerColor', 'serveType', 'sn'],
vehicleData: [ vehicleData: [
{ label: '特约店名称:', prop: 'shopName', type: 'select', options: [], clearable: true }, { label: '特约店名称:', prop: 'shopName', type: 'input', readonly: true, clickFunc: this.selectStore },
{ label: '车架号:', prop: 'vin', type: 'input', clearable: true }, { label: '车架号:', prop: 'vin', type: 'input', clearable: true },
{ label: '车型:', prop: 'modelId', type: 'select', options: [], key: 'dictLabel', value: 'dictValue', clearable: true }, { label: '车型:', prop: 'modelId', type: 'select', options: [], key: 'dictLabel', value: 'id', clearable: true },
{ label: '配置:', prop: 'configDesc', type: 'input', clearable: true }, { label: '配置:', prop: 'configId', type: 'select', options: [], key: 'dictLabel', value: 'id', clearable: true },
{ label: '车牌:', prop: 'licensePlate', type: 'input', clearable: true }, { label: '车牌:', prop: 'licensePlate', type: 'input', clearable: true },
{ label: '外色:', prop: 'color', type: 'input', clearable: true }, { label: '外色:', prop: 'color', type: 'input', clearable: true },
{ label: '内色:', prop: 'innerColor', 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: 'serveType', type: 'select', options: [{ label: '未上牌', value: 0 }, { label: '已上牌', value: 1 }], clearable: true },
{ label: '设备号:', prop: 'sn', type: 'input', clearable: true } { label: '设备号:', prop: 'sn', type: 'input', clearable: true }
], ],
vehicleDefaltData: [ vehicleDefalutData: [
{ label: '特约店名称:', prop: 'shopName', type: 'select', options: [], clearable: true }, { label: '特约店名称:', prop: 'shopName', type: 'input', readonly: true, clickFunc: this.selectStore },
{ label: '车架号:', prop: 'vin', type: 'input', clearable: true }, { label: '车架号:', prop: 'vin', type: 'input', clearable: true },
{ label: '车型:', prop: 'modelId', type: 'select', options: [], clearable: true }, { label: '车型:', prop: 'modelId', type: 'select', options: [], key: 'dictLabel', value: 'id', clearable: true },
{ label: '配置:', prop: 'configDesc', type: 'input', clearable: true }, { label: '配置:', prop: 'configId', type: 'select', options: [], key: 'dictLabel', value: 'id', clearable: true },
{ label: '车牌:', prop: 'licensePlate', type: 'input', clearable: true }, { label: '车牌:', prop: 'licensePlate', type: 'input', clearable: true },
{ label: '外色:', prop: 'color', type: 'input', clearable: true }, { label: '外色:', prop: 'color', type: 'input', clearable: true },
{ label: '内色:', prop: 'innerColor', type: 'input', clearable: true }, { label: '内色:', prop: 'innerColor', type: 'input', clearable: true },
{ label: '服役类型:', prop: 'serveType', type: 'select', options: [], clearable: true }, { label: '服役类型:', prop: 'serveType', type: 'select', options: [{ label: '未上牌', value: 0 }, { label: '已上牌', value: 1 }], clearable: true },
{ label: '设备号:', prop: 'sn', type: 'input', clearable: true } { label: '设备号:', prop: 'sn', type: 'input', clearable: true }
], ],
vehicleRules: { vehicleRules: {
shopName: [{ required: true, message: '请选择特约店名称', trigger: 'change' }], shopName: [{ required: true, message: '请选择特约店名称', trigger: 'change' }],
vin: [{ required: true, message: '请输入车架号', trigger: 'blur' }], vin: [{ required: true, message: '请输入车架号', trigger: 'blur' }],
modelId: [{ required: true, message: '请选择车型', trigger: 'change' }], modelId: [{ required: true, message: '请选择车型', trigger: 'change' }],
configDesc: [{ required: true, message: '请输入配置', trigger: 'blur' }], configId: [{ required: true, message: '请输入配置', trigger: 'blur' }],
licensePlate: [{ required: true, message: '请输入车牌', trigger: 'blur' }],
color: [{ required: true, message: '请输入外色', trigger: 'blur' }], color: [{ required: true, message: '请输入外色', trigger: 'blur' }],
innerColor: [{ required: true, message: '请输入内色', trigger: 'blur' }], innerColor: [{ required: true, message: '请输入内色', trigger: 'blur' }],
serveType: [{ required: true, message: '请选择服役类型', trigger: 'blur' }] serveType: [{ required: true, message: '请选择服役类型', trigger: 'blur' }]
}, },
isReadonly: false,
// 特约店名称弹窗
filterDialogTitle: '选择特约店',
filterVisible: false,
filterText: '',
filterTextData: [],
isOpen: true,
// 导入 // 导入
importTitle: '批量操作', importTitle: '批量操作',
vehicleImport: false, vehicleImport: false,
importForm: {}, importForm: {},
importRules: {}, importRules: {},
deviceList: [] deviceList: [],
exportData: {}
} }
}, },
mounted() { mounted() {
dictInfo('trialdrive_vehicle_model').then(res => { dictInfo('trialdrive_vehicle_model').then(res => {
this.vehicleData.find(item => item.prop == 'modelId').options = res.data 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: { methods: {
btnClick(pType, scope) { btnClick(pType, scope) {
switch (pType) { switch (pType) {
case 'create': case 'create':
this.vehicleVisible = !this.vehicleVisible this.vehicleVisible = !this.vehicleVisible
this.isReadonly = false
if (this.vehicleVisible) { if (this.vehicleVisible) {
this.vehicleTitle = '新增车辆' this.vehicleTitle = '新增车辆'
this.vehicleForm = {} this.vehicleForm = {}
this.vehicleData.map(item => { this.vehicleData = _.cloneDeep(this.vehicleDefalutData)
if (item.type == 'input') return item.readonly = false
else return item.disabled = false
})
} }
if (this.$refs.vehicleRuleForm) this.$refs.vehicleRuleForm.$children[0].clearValidate() if (this.$refs.vehicleRuleForm) this.$refs.vehicleRuleForm.$children[0].clearValidate()
break break
case 'edit': case 'edit':
console.log(scope)
this.vehicleVisible = !this.vehicleVisible this.vehicleVisible = !this.vehicleVisible
this.isReadonly = false
if (this.vehicleVisible) { if (this.vehicleVisible) {
this.vehicleTitle = '编辑车辆' this.vehicleTitle = '编辑车辆'
this.vehicleData = _.cloneDeep(this.vehicleDefalutData)
infoVehicle({ tempId: scope.tempId }).then(res => { infoVehicle({ tempId: scope.tempId }).then(res => {
const { code, data } = res
if (code == 200) {
this.vehicleArr.forEach(item => { this.vehicleArr.forEach(item => {
this.$set(this.vehicleForm, item, res.data[item]) this.$set(this.vehicleForm, item, data[item])
}) })
}) this.vehicleForm.tempId = data.id
this.vehicleData.map(item => { }
if (item.type == 'input') return item.readonly = false
else return item.disabled = false
}) })
} }
break break
case 'view': case 'view':
console.log('view') console.log('view')
this.vehicleVisible = !this.vehicleVisible this.vehicleVisible = !this.vehicleVisible
this.isReadonly = true
if (this.vehicleVisible) { if (this.vehicleVisible) {
infoVehicle({ tempId: scope.tempId }).then(res => { infoVehicle({ tempId: scope.tempId }).then(res => {
const { code, data } = res
if (code == 200) {
this.vehicleArr.forEach(item => { this.vehicleArr.forEach(item => {
this.$set(this.vehicleForm, item, res.data[item]) this.$set(this.vehicleForm, item, data[item])
}) })
}
}) })
this.vehicleTitle = '查看车辆' this.vehicleTitle = '查看车辆'
this.vehicleData.map(item => { this.vehicleData.map(item => {
if (item.type == 'input') return item.readonly = true if (item.type == 'input') this.$set(item, 'readonly', true)
else return item.disabled = true else this.$set(item, 'disabled', true)
}) })
} }
break break
...@@ -344,7 +407,8 @@ export default { ...@@ -344,7 +407,8 @@ export default {
this.$message({ this.$message({
type: 'success', type: 'success',
message: '删除成功!' message: '删除成功!'
}); })
this.$refs.vehicleForm.refreshTable()
}) })
}) })
break break
...@@ -358,7 +422,8 @@ export default { ...@@ -358,7 +422,8 @@ export default {
this.$message({ this.$message({
type: 'success', type: 'success',
message: '解绑成功!' message: '解绑成功!'
}); })
this.$refs.vehicleForm.refreshTable()
}) })
}) })
break break
...@@ -366,40 +431,62 @@ export default { ...@@ -366,40 +431,62 @@ export default {
this.vehicleImport = !this.vehicleImport this.vehicleImport = !this.vehicleImport
break break
case 'export': case 'export':
if (this.$refs.vehicleRuleForm.mutiSelectArr[this.vehicleTableParams.mutiSelectName].length) { this.$Common.exportExcel({
console.log(this.$refs.vehicleRuleForm.mutiSelectArr[this.vehicleTableParams.mutiSelectName]) url: `${store.state.baseURL}${VEHICLE_API.VEHICLE_EXPORT}`,
exportVehicle({}).then(res => { method: 'GET',
data: this.searchForm
}) })
}
break break
} }
}, },
handleConfirm(type) { handleConfirm(type) {
console.log(type)
switch (type) { switch (type) {
case 'create': case 'create':
console.log(this.vehicleForm) console.log(this.vehicleForm)
this.$refs.vehicleRuleForm.$children[0].validate((valid) => { this.$refs.vehicleRuleForm.$children[0].validate((valid) => {
if (valid) { if (valid) {
addVehicle({}).then(res => { let params = _.cloneDeep(this.vehicleForm)
console.log(res) const { modelId, configId } = params
params.modelName = this.vehicleData.find(item => item.prop == 'modelId').options.find(j => j.id == modelId).dictLabel
params.configDesc = this.vehicleData.find(item => item.prop == 'configId').options.find(j => j.id == configId).dictLabel
let api = addVehicle
if (params.tempId) api = editVehicle
api(params).then(res => {
const { code } = res
if (code == 200) {
this.$message({
message: '操作成功',
type: 'success'
}) })
} this.vehicleVisible = !this.vehicleVisible
this.$refs.vehicleForm.refreshTable()
} else {
this.$message({
message: '操作失败',
type: 'error'
}) })
break }
case 'edit':
this.$refs.vehicleRuleForm.$children[0].validate((valid) => {
if (valid) {
editVehicle({}).then(res => {
console.log(res)
}) })
} }
}) })
break break
case 'import': case 'import':
importVehicle({}).then(res => { 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}${VEHICLE_API.VEHICLE_IMPORT}`,
data
}).then(res => {
console.log(res)
if (res.data.code == 200) {
this.exportData = res.data.data
}
}) })
break break
} }
...@@ -407,20 +494,63 @@ export default { ...@@ -407,20 +494,63 @@ export default {
handleClose(type) { handleClose(type) {
this.btnClick(type) this.btnClick(type)
}, },
// 特约店弹窗
selectStore() {
if (this.isReadonly) return
this.filterText = ''
this.filterDialogTitle = '选择特约店'
this.getStoreList();
this.closeFilter()
},
closeFilter() {
this.filterVisible = !this.filterVisible
},
getStoreList() {
getSpecialShopList().then(res => {
const { code, data } = res;
if (code == 200) {
this.filterTextData = data;
}
})
},
filterConfirm() {
const { label, id } = this.$refs.tree.getCurrentNode();
this.$set(this.vehicleForm, 'shopName', label);
this.vehicleForm.shopNameId = id
this.closeFilter();
},
filterNode(value, data) {
if (!value) return true
return data.label.indexOf(value) !== -1
},
downloadTemplate() { downloadTemplate() {
downloadtemplate({}).then(res => { this.$Common.exportExcel({
console.log('下载模板') url: `${store.state.baseURL}${VEHICLE_API.DOWNLOAD_TEMPLATE}`,
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) { importFile(e) {
console.log(e)
this.importForm.file = e.target.files[0]
this.$set(this.importForm, 'fileName', e.target.files[0].name) this.$set(this.importForm, 'fileName', e.target.files[0].name)
const reader = new FileReader() console.log(this.importForm)
reader.readAsDataURL(e.target.files[0]) // const reader = new FileReader()
reader.onload = event => { // reader.readAsDataURL(e.target.files[0])
const imgFile = event.target.result // reader.onload = event => {
const arrBase64 = imgFile.split(',') // const imgFile = event.target.result
this.importFileInfo = e.target.files[0].name.split('.')[1] + '@' + arrBase64[1] // const arrBase64 = imgFile.split(',')
} // this.importFileInfo = e.target.files[0].name.split('.')[1] + '@' + arrBase64[1]
// }
}, },
}, },
} }
......
...@@ -58,7 +58,7 @@ ...@@ -58,7 +58,7 @@
>未选择任何文件</span> >未选择任何文件</span>
</div> </div>
</el-form-item> </el-form-item>
</el-form> <div v-if="$route.params.url != 'checkView'">
<el-button <el-button
class="pull-right m-l-md" class="pull-right m-l-md"
type="defalut" type="defalut"
...@@ -69,6 +69,8 @@ ...@@ -69,6 +69,8 @@
type="primary" type="primary"
@click="handleConfirm($route.params.url)" @click="handleConfirm($route.params.url)"
>{{$route.params.url == 'submit' ? '确定' : '通过'}}</el-button> >{{$route.params.url == 'submit' ? '确定' : '通过'}}</el-button>
</div>
</el-form>
</div> </div>
</template> </template>
...@@ -117,7 +119,41 @@ export default { ...@@ -117,7 +119,41 @@ export default {
} }
] ]
}, },
submitData: ['shopName', 'vin', 'modelName'], vehicleDefalutForm: {
list: [
{
docName: '车辆登记证',
docType: 1,
docUrl: ''
},
{
docName: '车辆发票',
docType: 2,
docUrl: ''
},
{
docName: '交强险',
docType: 3,
docUrl: ''
},
{
docName: '商业险',
docType: 4,
docUrl: ''
},
{
docName: '行驶证',
docType: 5,
docUrl: ''
},
{
docName: '车身照',
docType: 6,
docUrl: ''
}
]
},
submitData: ['shopName', 'vin', 'modelName', 'buyType'],
checkData: ['shopName', 'vin', 'modelName', 'licensePlate', 'buyType', 'registrationDate', 'saleManager', 'saleManagerPhone', 'remark'], checkData: ['shopName', 'vin', 'modelName', 'licensePlate', 'buyType', 'registrationDate', 'saleManager', 'saleManagerPhone', 'remark'],
vehicleData: [ vehicleData: [
{ label: '特约店名称:', prop: 'shopName', type: 'input', disabled: true }, { label: '特约店名称:', prop: 'shopName', type: 'input', disabled: true },
...@@ -135,7 +171,7 @@ export default { ...@@ -135,7 +171,7 @@ export default {
{ label: '车架号:', prop: 'vin', type: 'input', disabled: true }, { label: '车架号:', prop: 'vin', type: 'input', disabled: true },
{ label: '车型:', prop: 'modelName', type: 'input', disabled: true }, { label: '车型:', prop: 'modelName', type: 'input', disabled: true },
{ label: '车牌:', prop: 'licensePlate', type: 'input', clearable: true }, { label: '车牌:', prop: 'licensePlate', type: 'input', clearable: true },
{ label: '购置方式:', prop: 'buyType', type: 'select', options: [{ label: '租赁方式购置', value: 1 }], clearable: true }, { label: '购置方式:', prop: 'buyType', type: 'select', options: [{ label: '租赁方式购置', value: '1' }], clearable: true },
{ label: '上牌日期:', prop: 'registrationDate', type: 'input', disabled: true }, { label: '上牌日期:', prop: 'registrationDate', type: 'input', disabled: true },
{ label: '销售经理:', prop: 'saleManager', type: 'input', clearable: true }, { label: '销售经理:', prop: 'saleManager', type: 'input', clearable: true },
{ label: '销售经理电话:', prop: 'saleManagerPhone', type: 'input', clearable: true }, { label: '销售经理电话:', prop: 'saleManagerPhone', type: 'input', clearable: true },
...@@ -219,6 +255,7 @@ export default { ...@@ -219,6 +255,7 @@ export default {
type: 'success' type: 'success'
}) })
this.$router.replace('/vehicleSubmit') this.$router.replace('/vehicleSubmit')
this.vehicleForm = _.cloneDeep(this.vehicleDefalutForm)
} else { } else {
this.$message({ this.$message({
message: '操作失败', message: '操作失败',
...@@ -241,6 +278,7 @@ export default { ...@@ -241,6 +278,7 @@ export default {
type: 'success' type: 'success'
}) })
this.$router.replace('/vehicleCheck') this.$router.replace('/vehicleCheck')
this.vehicleForm = _.cloneDeep(this.vehicleDefalutForm)
} else { } else {
this.$message({ this.$message({
message: '操作失败', message: '操作失败',
...@@ -273,6 +311,7 @@ export default { ...@@ -273,6 +311,7 @@ export default {
type: 'success' type: 'success'
}) })
this.$router.replace('/vehicleCheck') this.$router.replace('/vehicleCheck')
this.vehicleForm = _.cloneDeep(this.vehicleDefalutForm)
} else { } else {
this.$message({ this.$message({
message: '操作失败', message: '操作失败',
...@@ -322,8 +361,6 @@ export default { ...@@ -322,8 +361,6 @@ export default {
this.$set(this.vehicleForm.list[index], 'docUrl', res.data.data) this.$set(this.vehicleForm.list[index], 'docUrl', res.data.data)
targetObj.url = res.data.data targetObj.url = res.data.data
} }
const fileData = new Array(targetObj)
return batchSaveFile(fileData, this.baseURL)
}).then(r => (this.vehicleForm[name] = r[0].id)) }).then(r => (this.vehicleForm[name] = r[0].id))
}, },
} }
......
...@@ -50,6 +50,13 @@ ...@@ -50,6 +50,13 @@
> >
审核 审核
</el-button> </el-button>
<el-button
v-else
type="text"
@click="btnClick('view', scope.scope)"
>
查看
</el-button>
</span> </span>
</basic-table> </basic-table>
</div> </div>
...@@ -179,6 +186,9 @@ export default { ...@@ -179,6 +186,9 @@ export default {
case 'check': case 'check':
this.$router.push({ name: 'addVehicle', params: { vehicleId: scope.vehicleId, approvalId: scope.approvalId, url: 'check' } }) this.$router.push({ name: 'addVehicle', params: { vehicleId: scope.vehicleId, approvalId: scope.approvalId, url: 'check' } })
break break
case 'view':
this.$router.push({ name: 'addVehicle', params: { vehicleId: scope.vehicleId, approvalId: scope.approvalId, url: 'checkView' } })
break
} }
}, },
}, },
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!