You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
404 lines
13 KiB
404 lines
13 KiB
|
|
<template>
|
|
<div class="app-container-Update">
|
|
<div v-show="viewState == 1">
|
|
<button-bar view-title="挂车管理" :btndisabled="btndisabled" @btnhandle="btnHandle"/>
|
|
<el-tabs v-model="activeName" @tab-click="handleClick" type="card">
|
|
<el-tab-pane label="挂车列表" name="first"></el-tab-pane>
|
|
<el-tab-pane label="待报价列表" name="second"></el-tab-pane>
|
|
</el-tabs>
|
|
<div class="searchcon">
|
|
<el-button size="small" class="searchbtn" @click="isSearchShow = !isSearchShow" >{{ isSearchShow ? "隐藏查询条件" : "显示查询条件" }}</el-button>
|
|
<div v-show="isSearchShow" class="search">
|
|
<el-form :inline="true" class="tab-header">
|
|
<el-row>
|
|
<el-form-item label="车型名称">
|
|
<el-select v-model="queryParams.params.modelName" @change="changeModelName" filterable placeholder="请选择" style="width:200px">
|
|
<el-option v-for="item in modelName_list" :key="item.sid" :label="item.modelName" :value="item.sid">
|
|
</el-option>
|
|
</el-select>
|
|
</el-form-item>
|
|
<el-form-item label="车辆品牌">
|
|
<el-select v-model="queryParams.params.carBrand" @change="changeCarBrand" filterable placeholder="请选择" style="width:200px">
|
|
<el-option v-for="item in carBrand_list" :key="item.sid" :label="item.brandName" :value="item.sid">
|
|
</el-option>
|
|
</el-select>
|
|
</el-form-item>
|
|
<el-form-item label="车辆型号">
|
|
<el-input v-model="queryParams.params.model" class="addinputw" clearable/>
|
|
</el-form-item>
|
|
<el-form-item label="厂商名称">
|
|
<el-select v-model="queryParams.params.settlementSid" filterable placeholder="请选择" style="width:200px">
|
|
<el-option v-for="item in settlement_list" :key="item.sid" :label="item.manufacturerName" :value="item.sid">
|
|
</el-option>
|
|
</el-select>
|
|
</el-form-item>
|
|
</el-row>
|
|
<el-divider />
|
|
<div class="btn" style="text-align: center">
|
|
<el-button type="primary" icon="el-icon-search" size="small" @click="dosearch">查询</el-button>
|
|
<el-button type="primary" icon="el-icon-refresh" size="small" @click="resetQuery">重置</el-button>
|
|
</div>
|
|
</el-form>
|
|
</div>
|
|
</div>
|
|
<!--Start 项目列表头部-->
|
|
<div class="listtop">
|
|
<div class="tit">挂车列表</div>
|
|
<pageye v-show="dataList.length > 0" :total="queryParams.total" :page.sync="queryParams.current" :limit.sync="queryParams.size" class="pagination" @pagination="loadList"/>
|
|
</div>
|
|
<!--End 项目列表头部-->
|
|
<!--Start 项目列表-->
|
|
<div class="listcon">
|
|
<el-table v-loading="tableLoading" :data="dataList" border style="width: 100%" @selection-change="handleSelectionChange">
|
|
<el-table-column width="50px" type="selection" align="center" />
|
|
<el-table-column width="80px" label="序号" type="index" :index="indexMethod" align="center"/>
|
|
<el-table-column label="操作" align="center">
|
|
<template slot-scope="scope">
|
|
<span class="tablerow-click" @click="toInfo(scope.row)">查看</span>
|
|
</template>
|
|
</el-table-column>
|
|
<el-table-column prop="modelName" label="车型名称" align="center" />
|
|
<el-table-column prop="brandName" label="车辆品牌" align="center" />
|
|
<el-table-column prop="model" label="车型型号" align="center" />
|
|
<el-table-column prop="settlement" label="厂商名称" align="center" />
|
|
<el-table-column prop="settlementPrice" label="车辆入库价" align="center"/>
|
|
<el-table-column prop="guidePrice" label="销售指导价" align="center"/>
|
|
<el-table-column prop="otherConfig" label="更多配置" align="center" />
|
|
</el-table>
|
|
</div>
|
|
<!--End 项目列表-->
|
|
<div class="pages">
|
|
<div class="tit" />
|
|
<!-- 翻页 -->
|
|
<pagination v-show="dataList.length > 0" :total="queryParams.total" :page.sync="queryParams.current" :limit.sync="queryParams.size" class="pagination" @pagination="loadList"/>
|
|
</div>
|
|
</div>
|
|
<!--End 查询和其列表部分-->
|
|
<!--新增修改部分组件-->
|
|
<guacheAdd v-show="viewState == 2 || viewState == 3" ref="divAdd" @doback="resetState" @reloadlist="loadList"/>
|
|
<!--详情部分组件-->
|
|
<guacheInfo v-show="viewState == 4" ref="divinfo" @doback="resetState" />
|
|
|
|
<!-- <guachedaibaojia v-show="viewState == 5" ref="divdaibaojia" @doback="resetState"/> -->
|
|
</div>
|
|
</template>
|
|
|
|
<script>
|
|
import req from "@/api/guache/guache";
|
|
import ButtonBar from "@/components/ButtonBar";
|
|
import Pagination from "@/components/pagination";
|
|
import pageye from "@/components/pagination/pageye";
|
|
import guacheAdd from "./guacheAdd";
|
|
import guacheInfo from "./guacheInfo";
|
|
// import guachedaibaojia from './guachedaibaojia/guachedaibaojia'
|
|
|
|
export default {
|
|
name: "GuaCheJianSuoGuanLi",
|
|
components: {
|
|
ButtonBar,
|
|
Pagination,
|
|
pageye,
|
|
guacheAdd,
|
|
guacheInfo,
|
|
// guachedaibaojia
|
|
},
|
|
data() {
|
|
return {
|
|
btndisabled: false,
|
|
viewState: 1, // 1、列表 2、添加 3、修改 4、查看
|
|
isSearchShow: false,
|
|
tableLoading: false,
|
|
activeName: "first",
|
|
dataList: [],
|
|
modelName_list:[],
|
|
carBrand_list:[],
|
|
settlement_list:[],
|
|
queryParams: {
|
|
current: 1,
|
|
size: 10,
|
|
total: 10,
|
|
params: {
|
|
modelName: "",
|
|
carBrand: "",
|
|
model: "",
|
|
settlementSid: "",
|
|
},
|
|
},
|
|
multipleSelection: [],
|
|
};
|
|
},
|
|
created() {
|
|
this.loadList();
|
|
this.DataDictionary();
|
|
},
|
|
methods: {
|
|
DataDictionary() {
|
|
//车型名称
|
|
req.pullDown().then((res) => {
|
|
if (res.code === "200") {
|
|
this.modelName_list = res.data;
|
|
}
|
|
});
|
|
req.namesDown().then((res)=>{
|
|
if (res.code === "200") {
|
|
this.carBrand_list = res.data;
|
|
}
|
|
});
|
|
req.Down().then((res)=>{
|
|
if (res.code === "200") {
|
|
this.settlement_list = res.data;
|
|
}
|
|
})
|
|
},
|
|
changeModelName(value) {
|
|
let bb = null;
|
|
this.modelName_list.forEach((e) => {
|
|
if (e.sid == value) {
|
|
bb = {
|
|
sid: e.sid,
|
|
manufacturer: e.manufacturer,
|
|
brandName:e.brandName,
|
|
modelName:e.modelName,
|
|
};
|
|
}
|
|
});
|
|
this.queryParams.params.modelName=bb.modelName
|
|
},
|
|
changeCarBrand(value){
|
|
let bb = null;
|
|
this.carBrand_list.forEach((e) => {
|
|
if (e.sid == value) {
|
|
bb = {
|
|
sid: e.sid,
|
|
brandName:e.brandName
|
|
};
|
|
}
|
|
});
|
|
this.queryParams.params.carBrand=bb.sid
|
|
},
|
|
resetState() {
|
|
this.viewState = 1;
|
|
this.activeName = "first";
|
|
this.queryParams = {
|
|
current: 1,
|
|
size: 10,
|
|
total: 0,
|
|
params: {
|
|
modelName: "",
|
|
carBrand: "",
|
|
model: "",
|
|
settlementSid: "",
|
|
},
|
|
};
|
|
this.loadList();
|
|
},
|
|
btnHandle(btnKey) {
|
|
console.log("XXXXXXXXXXXXXXX " + btnKey);
|
|
switch (btnKey) {
|
|
case "toAdd":
|
|
this.toAdd();
|
|
break;
|
|
case "toEdit":
|
|
this.toEdit();
|
|
break;
|
|
case "doSubmit":
|
|
this.doSubmit();
|
|
break;
|
|
case "doDel":
|
|
this.doDel();
|
|
break;
|
|
case "doImport":
|
|
this.doImport();
|
|
break;
|
|
case "doExport":
|
|
this.doExport();
|
|
break;
|
|
default:
|
|
break;
|
|
}
|
|
},
|
|
handleClick(tab, event) {
|
|
if (tab.name == "second") {
|
|
this.viewState = 5;
|
|
this.$refs["divdaibaojia"].loadList();
|
|
}
|
|
},
|
|
toAdd(row) {
|
|
this.viewState = 2;
|
|
this.$refs["divAdd"].showAdd();
|
|
},
|
|
toEdit() {
|
|
if (this.multipleSelection.length === 0) {
|
|
this.$message({
|
|
showClose: true,
|
|
type: "error",
|
|
message: "请选择一条记录进行编辑",
|
|
});
|
|
return;
|
|
}
|
|
if (this.multipleSelection.length > 1) {
|
|
this.$message({
|
|
showClose: true,
|
|
type: "error",
|
|
message: "只能选择一条记录进行编辑",
|
|
});
|
|
return;
|
|
}
|
|
this.viewState = 3;
|
|
const row = this.multipleSelection[0];
|
|
this.$refs["divAdd"].showEdit(row);
|
|
},
|
|
doSubmit(row) {
|
|
// 提交的代码
|
|
this.btndisabled = true;
|
|
req.doSubmit(this.queryParams.params).then((resp) => {
|
|
this.btndisabled = false;
|
|
}).catch(() => {
|
|
this.btndisabled = false;
|
|
});
|
|
},
|
|
doDel(row) {
|
|
if (this.multipleSelection.length === 0) {
|
|
this.$message({
|
|
showClose: true,
|
|
type: "error",
|
|
message: "请选择至少一条记录进行删除操作",
|
|
});
|
|
return;
|
|
}
|
|
const _this = this;
|
|
const sids = [];
|
|
this.multipleSelection.forEach((row) => {
|
|
sids.push(row.sid);
|
|
});
|
|
const tip = "请确认是否删除所选 " + this.multipleSelection.length + " 条记录?";
|
|
this.$confirm(tip, "提示", {
|
|
confirmButtonText: "确定",
|
|
cancelButtonText: "取消",
|
|
type: "warning",
|
|
}).then(() => {
|
|
const loading = this.$loading({
|
|
lock: true,
|
|
text: "Loading",
|
|
spinner: "el-icon-loading",
|
|
background: "rgba(0, 0, 0, 0.7)",
|
|
});
|
|
req.delBySids(sids).then((resp) => {
|
|
loading.close();
|
|
_this.$message({
|
|
type: "success",
|
|
message: resp.msg,
|
|
showClose: true,
|
|
});
|
|
_this.loadList();
|
|
}).catch((e) => {
|
|
loading.close();
|
|
});
|
|
}).catch(() => {});
|
|
},
|
|
doImport(row) {
|
|
// 导入的代码
|
|
req.importExcel(this.queryParams.params).then((resp) => {
|
|
console.log(resp);
|
|
}).catch(() => {});
|
|
},
|
|
doExport(row) {
|
|
// 导出的代码
|
|
const sids = [];
|
|
this.multipleSelection.forEach((row) => {
|
|
sids.push(row.sid);
|
|
});
|
|
this.queryParams.params.sids = sids;
|
|
req.exportExcel(this.queryParams.params).then((resp) => {
|
|
var map = resp.data;
|
|
const fileName = map.filename; // 导出文件名
|
|
// // 对于<a>标签,只有 Firefox 和 Chrome(内核) 支持 download 属性
|
|
// // IE10以上支持blob但是依然不支持download
|
|
const link = document.createElement("a"); // 创建a标签
|
|
link.download = fileName; // a标签添加属性
|
|
link.style.display = "none";
|
|
link.href = map.downurl;
|
|
document.body.appendChild(link);
|
|
link.click(); // 执行下载
|
|
URL.revokeObjectURL(link.href); // 释放url
|
|
document.body.removeChild(link); // 释放标签
|
|
}).catch(() => {});
|
|
},
|
|
dosearch() {
|
|
this.queryParams.current = 1;
|
|
this.loadList();
|
|
},
|
|
resetQuery() {
|
|
this.queryParams = {
|
|
current: 1,
|
|
size: 10,
|
|
total: 0,
|
|
params: {
|
|
modelName: "",
|
|
carBrand: "",
|
|
model: "",
|
|
settlementSid: "",
|
|
},
|
|
};
|
|
this.loadList();
|
|
},
|
|
loadList() {
|
|
const _this = this;
|
|
this.tableLoading = true;
|
|
req.listPage(this.queryParams).then((resp) => {
|
|
_this.tableLoading = false;
|
|
const data = resp.data;
|
|
_this.queryParams.total = data.total;
|
|
_this.dataList = data.records;
|
|
}).catch(() => {
|
|
_this.tableLoading = false;
|
|
});
|
|
},
|
|
handleSelectionChange(val) {
|
|
console.log(val);
|
|
this.multipleSelection = val;
|
|
},
|
|
// 序号
|
|
indexMethod(index) {
|
|
var pagestart = (this.queryParams.current - 1) * this.queryParams.size;
|
|
var pageindex = index + 1 + pagestart;
|
|
return pageindex;
|
|
},
|
|
toInfo(row) {
|
|
this.$refs["divinfo"].showInfo(row);
|
|
this.viewState = 4;
|
|
},
|
|
},
|
|
};
|
|
</script>
|
|
<style lang="scss" scoped>
|
|
.app-container-Update {
|
|
margin: 5px -9px;
|
|
background-color: #fff;
|
|
.searchcon {
|
|
margin: 0px 9px;
|
|
}
|
|
.searchbtn {
|
|
border: #2cab69 1px solid;
|
|
color: #2cab69;
|
|
}
|
|
.listcon {
|
|
margin: 0px 9px;
|
|
}
|
|
.listtop {
|
|
margin: 0px 9px;
|
|
display: flex;
|
|
justify-content: space-between;
|
|
align-items: center;
|
|
border: 1px solid #dfe4ed;
|
|
height: 40px;
|
|
.tit {
|
|
margin-bottom: -10px;
|
|
}
|
|
.pagination {
|
|
margin-bottom: -10px;
|
|
}
|
|
}
|
|
}
|
|
</style>
|
|
|