Commit d4314cad by 冒粤蓉
2 parents 5c216463 6f3409ee
......@@ -14,9 +14,13 @@
<div slot="footer">
<slot name="btn-front"></slot>
<el-button @click="handleClose">取消</el-button>
<el-button
@click="handleClose"
:size="btn_size"
>取消</el-button>
<el-button
type="primary"
:size="btn_size"
@click="handleConfirm"
>{{btnOkLabel}}</el-button>
<slot name="btn-behind"></slot>
......
......@@ -44,10 +44,12 @@ const VEHICLE_API = {
VEHICLE_ADD: '/trialdrive/vehicle/drivevehicle/add',
VEHICLE_EDIT: '/trialdrive/vehicle/drivevehicle/update',
VEHICLE_DELETE: '/trialdrive/vehicle/drivevehicle/delete',
VEHICLE_UNBIND: '/trialdrive/vehicle/drivevehicle/unbindSn',
DOWNLOAD_TEMPLATE: '/trialdrice/vehicle/drivevehicle/downloadtemplate',
VEHICLE_IMPORT: '/trialdrice/vehicle/drivevehicle/import',
VEHICLE_UNBIND: '/trialdrive/vehicle/unbindSn',
DOWNLOAD_TEMPLATE: '/trialdrive/vehicle/drivevehicle/downloadtemplate',
VEHICLE_IMPORT: '/trialdrive/vehicle/drivevehicle/import',
VEHICLE_FAILFILE: '/trialdrive/vehicle/drivevehicle/downloadFailFile',
VEHICLE_EXPORT: '/trialdrive/vehicle/drivevehicle/export',
VEHICLE_INFO: '/trialdrive/vehicle/drivevehicle/findbyid',
SPECIAL_SHOP_LIST: '/trialdrive/specialshop/shopusers'
}
// 审批管理
......
......@@ -7,7 +7,6 @@ function getList (params) {
return request(params, url)
}
/*特约店列表*/
function getSpecialShopList (params) {
const url = VEHICLE_API.SPECIAL_SHOP_LIST
......@@ -26,6 +25,12 @@ function editVehicle (params) {
return request(params, url, 'post')
}
// 解绑车辆
function infoVehicle (params) {
const url = VEHICLE_API.VEHICLE_INFO
return request(params, url)
}
// 批量删除车辆
function deleteVehicle (params) {
const url = VEHICLE_API.VEHICLE_DELETE
......@@ -47,7 +52,7 @@ function downloadtemplate (params) {
// 导入车辆
function importVehicle (params) {
const url = VEHICLE_API.VEHICLE_IMPORT
return request(params, url)
return request(params, url, 'post')
}
// 导出车辆
......@@ -56,4 +61,4 @@ function exportVehicle (params) {
return request(params, url)
}
export { getList, getSpecialShopList, addVehicle, downloadtemplate, editVehicle, deleteVehicle, unbindVehicle, importVehicle, exportVehicle }
export { getList, getSpecialShopList, addVehicle, downloadtemplate, editVehicle, deleteVehicle, unbindVehicle, importVehicle, exportVehicle, infoVehicle }
const MAP_KEY = '75116f653f3b2e4568116dad8cd9b899';
const MAP_KEY = '75116f653f3b2e4568116dad8cd9b899'
const Constants = {
AMAP_URL: `https://webapi.amap.com/maps?v=1.4.2&key=${MAP_KEY}&plugin=AMap.PolyEditor,AMap.CircleEditor,AMap.DistrictSearch,AMap.Autocomplete,AMap.MarkerClusterer,AMap.MouseTool,AMap.Text`,
// 处理状态
......
......@@ -127,6 +127,8 @@ export default {
case 'todo':
// 跳转
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
}
}
......
......@@ -62,6 +62,12 @@
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>
</span>
</basic-table>
<basic-dialog
......@@ -101,6 +107,7 @@
<el-col :span="14">
<el-input
readonly
:size="btn_size"
v-model="importForm.fileName"
ref="importInput"
></el-input>
......@@ -109,8 +116,12 @@
:span="6"
class="m-l-md"
>
<el-button class="import-btn">导入文件
<el-button
class="import-btn"
:size="btn_size"
>导入文件
<input
:size="btn_size"
type="file"
id="importFile"
class="import-input"
......@@ -123,14 +134,21 @@
type="text"
class="import-template"
icon="el-icon-link"
target="_blank"
@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"
......@@ -162,7 +180,12 @@
</template>
<script>
import { getList, getSpecialShopList, addVehicle, editVehicle, downloadtemplate, deleteVehicle, unbindVehicle, importVehicle, exportVehicle } from 'services/vehicle'
import _ from 'lodash'
import axios from 'axios'
import { dictInfo } from 'services/common'
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 {
data() {
return {
......@@ -222,6 +245,7 @@ export default {
}
],
tableOption: {
width: 160,
btnList: [
{
name: '编辑',
......@@ -234,10 +258,6 @@ export default {
{
name: '查看',
pType: 'view'
},
{
name: '解绑',
pType: 'unbind'
}
]
}
......@@ -266,32 +286,42 @@ export default {
// 弹窗
vehicleVisible: false,
vehicleTitle: '',
vehicleForm: {
shopName: ''
},
vehicleForm: {},
vehicleArr: ['shopName', 'vin', 'modelId', 'configId', 'licensePlate', 'color', 'innerColor', 'serveType', 'sn'],
vehicleData: [
{ label: '特约店名称:', prop: 'shopName', type: 'input', readonly: true, clickFunc: this.selectStore },
{ label: '车架号:', prop: 'vin', type: 'input', clearable: true },
{ label: '车型:', prop: 'modelId', type: 'select', options: [], clearable: true },
{ label: '配置:', prop: 'configDesc', type: 'input', 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 },
{ 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', clearable: true }
],
vehicleDefalutData: [
{ label: '特约店名称:', prop: 'shopName', type: 'input', readonly: true, clickFunc: this.selectStore },
{ label: '车架号:', prop: 'vin', type: 'input', 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 },
{ label: '外色:', prop: 'color', 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 }
],
vehicleRules: {
shopName: [{ required: true, message: '请选择特约店名称', trigger: 'change' }],
vin: [{ required: true, message: '请输入车架号', trigger: 'blur' }],
modelId: [{ required: true, message: '请选择车型', trigger: 'change' }],
configDesc: [{ required: true, message: '请输入配置', trigger: 'blur' }],
licensePlate: [{ 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' }]
},
isReadonly: false,
// 特约店名称弹窗
filterDialogTitle: '选择组织',
filterDialogTitle: '选择特约店',
filterVisible: false,
filterText: '',
filterTextData: [],
......@@ -301,50 +331,69 @@ export default {
vehicleImport: false,
importForm: {},
importRules: {},
deviceList: []
deviceList: [],
exportData: {}
}
},
watch: {
filterText(val) {
this.$refs.tree.filter(val)
}
mounted() {
dictInfo('trialdrive_vehicle_model').then(res => {
this.vehicleData.find(item => item.prop == 'modelId').options = res.data
this.vehicleDefalutData.find(item => item.prop == 'modelId').options = res.data
})
dictInfo('trialdrive_vehicle_config').then(res => {
this.vehicleData.find(item => item.prop == 'configId').options = res.data
this.vehicleDefalutData.find(item => item.prop == 'configId').options = res.data
})
},
methods: {
btnClick(pType, scope) {
switch (pType) {
case 'create':
this.vehicleVisible = !this.vehicleVisible
this.isReadonly = false
if (this.vehicleVisible) {
this.vehicleTitle = '新增车辆'
this.vehicleForm = {}
this.vehicleData.map(item => {
if (item.type == 'input' && !item.readonly) return item.readonly = false
else return item.disabled = false
})
this.vehicleData = _.cloneDeep(this.vehicleDefalutData)
}
if (this.$refs.vehicleRuleForm) this.$refs.vehicleRuleForm.$children[0].clearValidate()
break
case 'edit':
console.log(scope)
this.vehicleVisible = !this.vehicleVisible
this.isReadonly = false
if (this.vehicleVisible) {
this.vehicleTitle = '编辑车辆'
this.vehicleForm = JSON.parse(JSON.stringify(scope))
this.vehicleData.map(item => {
if (item.type == 'input') return item.readonly = false
else return item.disabled = false
this.vehicleData = _.cloneDeep(this.vehicleDefalutData)
infoVehicle({ tempId: scope.tempId }).then(res => {
const { code, data } = res
if (code == 200) {
this.vehicleArr.forEach(item => {
this.$set(this.vehicleForm, item, data[item])
})
this.vehicleForm.tempId = data.id
}
})
}
break
case 'view':
console.log('view')
this.vehicleVisible = !this.vehicleVisible
this.isReadonly = true
if (this.vehicleVisible) {
this.vehicleForm = JSON.parse(JSON.stringify(scope))
infoVehicle({ tempId: scope.tempId }).then(res => {
const { code, data } = res
if (code == 200) {
this.vehicleArr.forEach(item => {
this.$set(this.vehicleForm, item, data[item])
})
}
})
this.vehicleTitle = '查看车辆'
this.vehicleData.map(item => {
if (item.type == 'input') return item.readonly = true
else return item.disabled = true
if (item.type == 'input') this.$set(item, 'readonly', true)
else this.$set(item, 'disabled', true)
})
}
break
......@@ -358,7 +407,8 @@ export default {
this.$message({
type: 'success',
message: '删除成功!'
});
})
this.$refs.vehicleForm.refreshTable()
})
})
break
......@@ -372,7 +422,8 @@ export default {
this.$message({
type: 'success',
message: '解绑成功!'
});
})
this.$refs.vehicleForm.refreshTable()
})
})
break
......@@ -380,40 +431,62 @@ export default {
this.vehicleImport = !this.vehicleImport
break
case 'export':
if (this.$refs.vehicleRuleForm.mutiSelectArr[this.vehicleTableParams.mutiSelectName].length) {
console.log(this.$refs.vehicleRuleForm.mutiSelectArr[this.vehicleTableParams.mutiSelectName])
exportVehicle({}).then(res => {
})
}
this.$Common.exportExcel({
url: `${store.state.baseURL}${VEHICLE_API.VEHICLE_EXPORT}`,
method: 'GET',
data: this.searchForm
})
break
}
},
handleConfirm(type) {
console.log(type)
switch (type) {
case 'create':
console.log(this.vehicleForm)
this.$refs.vehicleRuleForm.$children[0].validate((valid) => {
if (valid) {
addVehicle({}).then(res => {
console.log(res)
})
}
})
break
case 'edit':
this.$refs.vehicleRuleForm.$children[0].validate((valid) => {
if (valid) {
editVehicle({}).then(res => {
console.log(res)
let params = _.cloneDeep(this.vehicleForm)
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 '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
}
......@@ -423,6 +496,7 @@ export default {
},
// 特约店弹窗
selectStore() {
if (this.isReadonly) return
this.filterText = ''
this.filterDialogTitle = '选择特约店'
this.getStoreList();
......@@ -433,15 +507,16 @@ export default {
},
getStoreList() {
getSpecialShopList().then(res => {
const { code, data } = res;
if(code == 200) {
this.filterTextData = data;
}
})
const { code, data } = res;
if (code == 200) {
this.filterTextData = data;
}
})
},
filterConfirm() {
const { label } = this.$refs.tree.getCurrentNode();
const { label, id } = this.$refs.tree.getCurrentNode();
this.$set(this.vehicleForm, 'shopName', label);
this.vehicleForm.shopNameId = id
this.closeFilter();
},
filterNode(value, data) {
......@@ -449,19 +524,33 @@ export default {
return data.label.indexOf(value) !== -1
},
downloadTemplate() {
downloadtemplate({}).then(res => {
console.log('下载模板')
this.$Common.exportExcel({
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) {
console.log(e)
this.importForm.file = e.target.files[0]
this.$set(this.importForm, 'fileName', e.target.files[0].name)
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]
}
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]
// }
},
},
}
......@@ -469,6 +558,6 @@ export default {
<style scope>
.vehicle .el-form .el-input__inner {
width: 300px;
width: 320px;
}
</style>
\ No newline at end of file
......@@ -58,17 +58,19 @@
>未选择任何文件</span>
</div>
</el-form-item>
<div v-if="$route.params.url != 'checkView'">
<el-button
class="pull-right m-l-md"
type="defalut"
@click="handleClose($route.params.url)"
>{{$route.params.url == 'submit' ? '取消' : '驳回'}}</el-button>
<el-button
class="pull-right"
type="primary"
@click="handleConfirm($route.params.url)"
>{{$route.params.url == 'submit' ? '确定' : '通过'}}</el-button>
</div>
</el-form>
<el-button
class="pull-right m-l-md"
type="defalut"
@click="handleClose($route.params.url)"
>{{$route.params.url == 'submit' ? '取消' : '驳回'}}</el-button>
<el-button
class="pull-right"
type="primary"
@click="handleConfirm($route.params.url)"
>{{$route.params.url == 'submit' ? '确定' : '通过'}}</el-button>
</div>
</template>
......@@ -117,14 +119,48 @@ 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'],
vehicleData: [
{ label: '特约店名称:', prop: 'shopName', type: 'input', disabled: true },
{ label: '车架号:', prop: 'vin', type: 'input', disabled: true },
{ label: '车型:', prop: 'modelName', type: 'input', disabled: 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: 'saleManager', type: 'input', clearable: true },
{ label: '销售经理电话:', prop: 'saleManagerPhone', type: 'input', clearable: true },
......@@ -135,7 +171,7 @@ export default {
{ label: '车架号:', prop: 'vin', type: 'input', disabled: true },
{ label: '车型:', prop: 'modelName', type: 'input', disabled: 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: 'saleManager', type: 'input', clearable: true },
{ label: '销售经理电话:', prop: 'saleManagerPhone', type: 'input', clearable: true },
......@@ -143,7 +179,7 @@ export default {
],
vehicleRules: {
licensePlate: [{ required: true, message: '请输入车牌', trigger: 'blur' }],
serveType: [{ required: true, message: '请选择购置方式', trigger: 'change' }],
buyType: [{ required: true, message: '请选择购置方式', trigger: 'change' }],
saleManager: [{ required: true, message: '请输入销售经理', trigger: 'blur' }],
saleManagerPhone: [{ required: true, message: '请输入销售经理电话', trigger: 'blur' }]
},
......@@ -219,6 +255,7 @@ export default {
type: 'success'
})
this.$router.replace('/vehicleSubmit')
this.vehicleForm = _.cloneDeep(this.vehicleDefalutForm)
} else {
this.$message({
message: '操作失败',
......@@ -241,6 +278,7 @@ export default {
type: 'success'
})
this.$router.replace('/vehicleCheck')
this.vehicleForm = _.cloneDeep(this.vehicleDefalutForm)
} else {
this.$message({
message: '操作失败',
......@@ -273,6 +311,7 @@ export default {
type: 'success'
})
this.$router.replace('/vehicleCheck')
this.vehicleForm = _.cloneDeep(this.vehicleDefalutForm)
} else {
this.$message({
message: '操作失败',
......@@ -322,8 +361,6 @@ export default {
this.$set(this.vehicleForm.list[index], 'docUrl', 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))
},
}
......
......@@ -23,7 +23,7 @@
</search-form>
<h3>上牌资料信息</h3>
<basic-table
ref="vehicleForm"
ref="vehicleSubmitTable"
:tableParams="submitTableParams"
:getListApi="getListApi"
:searchForm="searchForm"
......@@ -147,6 +147,12 @@ export default {
approvalStatusList: []
}
},
watch: {
'$route'(val) {
console.log(val)
if (val.path == '/vehicleSubmit') this.$refs.vehicleSubmitTable.refreshTable()
}
},
mounted() {
dictInfo('submitStatus').then(res => {
this.submitFormList[1].options = res.data
......
......@@ -23,7 +23,7 @@
</search-form>
<h3>上牌资料审核</h3>
<basic-table
ref="vehicleForm"
ref="vehicleCheckTable"
:tableParams="checkTableParams"
:getListApi="getListApi"
:searchForm="searchForm"
......@@ -50,6 +50,13 @@
>
审核
</el-button>
<el-button
v-else
type="text"
@click="btnClick('view', scope.scope)"
>
查看
</el-button>
</span>
</basic-table>
</div>
......@@ -154,8 +161,9 @@ export default {
}
},
watch: {
'$router'(val) {
'$route'(val) {
console.log(val)
if (val.path == '/vehicleCheck') this.$refs.vehicleCheckTable.refreshTable()
}
},
mounted() {
......@@ -178,6 +186,9 @@ export default {
case 'check':
this.$router.push({ name: 'addVehicle', params: { vehicleId: scope.vehicleId, approvalId: scope.approvalId, url: 'check' } })
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!