|
@@ -11,7 +11,7 @@
|
|
|
>
|
|
|
<el-row :gutter="20">
|
|
|
<el-col :xs="24" :sm="12" :lg="6">
|
|
|
- <el-form-item label="经销商名称" prop="">
|
|
|
+ <el-form-item label="经销商名称" prop="customerName">
|
|
|
<el-input
|
|
|
v-model="searchForm.customerName"
|
|
|
placeholder="请输入经销商名称"
|
|
@@ -19,7 +19,7 @@
|
|
|
</el-form-item>
|
|
|
</el-col>
|
|
|
<el-col :xs="24" :sm="12" :lg="6">
|
|
|
- <el-form-item label="车牌" prop="">
|
|
|
+ <el-form-item label="车牌" prop="carBrand">
|
|
|
<el-input
|
|
|
v-model="searchForm.carBrand"
|
|
|
placeholder="请输入车牌"
|
|
@@ -29,7 +29,7 @@
|
|
|
|
|
|
<el-col :xs="24" :sm="12" :lg="12" class="tr">
|
|
|
<el-form-item label="">
|
|
|
- <el-button size="small" @click="resetScreenForm">清空</el-button>
|
|
|
+ <el-button size="small" @click="clearFn">清空</el-button>
|
|
|
<el-button size="small" type="primary" @click="searchFn"
|
|
|
>搜索</el-button
|
|
|
>
|
|
@@ -45,11 +45,21 @@
|
|
|
>新增</el-button
|
|
|
>
|
|
|
<el-button type="primary" size="small">编辑</el-button>
|
|
|
- <el-button type="primary" size="small">删除</el-button>
|
|
|
+ <el-popconfirm @onConfirm="delFn" title="这是一段内容确定删除吗?">
|
|
|
+ <el-button
|
|
|
+ size="small"
|
|
|
+ type="primary"
|
|
|
+ class="textColor"
|
|
|
+ slot="reference"
|
|
|
+ >删除</el-button
|
|
|
+ >
|
|
|
+ </el-popconfirm>
|
|
|
</div>
|
|
|
<div class="fr">
|
|
|
<el-button type="primary" size="small">导入</el-button>
|
|
|
- <el-button type="primary" size="small">导出</el-button>
|
|
|
+ <el-button type="primary" size="small" @click="exportFn"
|
|
|
+ >导出</el-button
|
|
|
+ >
|
|
|
</div>
|
|
|
</div>
|
|
|
<!-- 列表 -->
|
|
@@ -59,6 +69,8 @@
|
|
|
v-loading="listLoading"
|
|
|
:data="dataList"
|
|
|
element-loading-text="Loading"
|
|
|
+ @select="hanleSelect"
|
|
|
+ @select-all="hanleSelect"
|
|
|
border
|
|
|
fit
|
|
|
highlight-current-row
|
|
@@ -118,7 +130,10 @@
|
|
|
show-overflow-tooltip
|
|
|
>
|
|
|
<template slot-scope="scope">
|
|
|
- <el-button type="text" class="textColor" @click="editFn"
|
|
|
+ <el-button
|
|
|
+ type="text"
|
|
|
+ class="textColor"
|
|
|
+ @click="editFn(scope.row)"
|
|
|
>编辑</el-button
|
|
|
>
|
|
|
<el-popconfirm
|
|
@@ -136,6 +151,8 @@
|
|
|
<!-- 分页 -->
|
|
|
<div class="fr">
|
|
|
<el-pagination
|
|
|
+ @size-change="handleSizeChange"
|
|
|
+ @current-change="handleCurrentChange"
|
|
|
:current-page="currentPage"
|
|
|
:page-sizes="[10, 20, 30, 50]"
|
|
|
:page-size="10"
|
|
@@ -188,7 +205,7 @@
|
|
|
</el-row>
|
|
|
</el-form>
|
|
|
<div slot="footer" class="dialog-footer">
|
|
|
- <el-button @click="dialogForm = false">取 消</el-button>
|
|
|
+ <el-button @click="cancelFn">取 消</el-button>
|
|
|
<el-button type="primary" @click="addDataListFn">确 定</el-button>
|
|
|
</div>
|
|
|
</el-dialog>
|
|
@@ -196,8 +213,14 @@
|
|
|
</template>
|
|
|
|
|
|
<script>
|
|
|
-import { getCarList, addDataListApi, delCarFn } from "@/api/basic_data/taker";
|
|
|
+import {
|
|
|
+ getCarList,
|
|
|
+ addDataListApi,
|
|
|
+ delCarFn,
|
|
|
+ editDataListApi,
|
|
|
+} from "@/api/basic_data/taker";
|
|
|
import { getDealerList } from "@/api/basic_data/dealer";
|
|
|
+import { downloadFiles } from "@/utils/util";
|
|
|
|
|
|
export default {
|
|
|
data() {
|
|
@@ -220,6 +243,7 @@ export default {
|
|
|
carBrand: "",
|
|
|
},
|
|
|
dealerList: [],
|
|
|
+ ids: [],
|
|
|
};
|
|
|
},
|
|
|
async created() {
|
|
@@ -227,15 +251,61 @@ export default {
|
|
|
await this.getDealerDataList({ pageNum: 1, pageSize: 10 });
|
|
|
},
|
|
|
methods: {
|
|
|
+ // 筛选部分数据或者单个
|
|
|
+ hanleSelect(selection) {
|
|
|
+ // this.ids = selection.map((k) => {
|
|
|
+ // return k.id;
|
|
|
+ // });
|
|
|
+ console.log(selection);
|
|
|
+ this.ids = selection.map((v) => v.id);
|
|
|
+ console.log(this.ids);
|
|
|
+ },
|
|
|
+ //导出
|
|
|
+ exportFn() {
|
|
|
+ let screenData = {
|
|
|
+ customerName: this.searchForm.customerName,
|
|
|
+ carBrand: this.searchForm.carBrand,
|
|
|
+ };
|
|
|
+ downloadFiles("/take-car-record/export", screenData);
|
|
|
+ },
|
|
|
+ //取消
|
|
|
+ cancelFn() {
|
|
|
+ this.addForm = {
|
|
|
+ customerId: "",
|
|
|
+ mobile: "",
|
|
|
+ carType: "",
|
|
|
+ volume: "",
|
|
|
+ carBrand: "",
|
|
|
+ };
|
|
|
+ this.dialogForm = false;
|
|
|
+ },
|
|
|
+ //编辑
|
|
|
+ editFn(data) {
|
|
|
+ this.dialogForm = true;
|
|
|
+ this.addForm = data;
|
|
|
+ },
|
|
|
+ //重置
|
|
|
+ clearFn() {
|
|
|
+ console.log(this.$refs.searchForm);
|
|
|
+ this.$refs.searchForm.resetFields();
|
|
|
+ },
|
|
|
//搜索
|
|
|
async searchFn() {
|
|
|
console.log(this.searchForm);
|
|
|
- await this.getDataList({ ...this.searchForm, pageNum: 1, pageSize: 10 });
|
|
|
+ await this.getDataList({
|
|
|
+ ...this.searchForm,
|
|
|
+ pageNum: 1,
|
|
|
+ pageSize: this.pageSize,
|
|
|
+ });
|
|
|
},
|
|
|
//删除
|
|
|
async delFn(ids) {
|
|
|
- console.log(ids);
|
|
|
- await delCarFn({ ids });
|
|
|
+ this.ids.push(ids);
|
|
|
+ let res = this.ids.toString();
|
|
|
+ await delCarFn({ ids: res });
|
|
|
+ this.$message.success("删除成功");
|
|
|
+
|
|
|
+ this.getDataList({ pageNum: this.currentPage, pageSize: this.pageSize });
|
|
|
},
|
|
|
//获取经销商数据
|
|
|
async getDealerDataList(data) {
|
|
@@ -247,9 +317,28 @@ export default {
|
|
|
this.dialogForm = true;
|
|
|
},
|
|
|
async addDataListFn() {
|
|
|
- await addDataListApi({ ...this.addForm, orgNumber: "1122" });
|
|
|
- this.$message.success("添加成功");
|
|
|
- await this.getDataList({ pageNum: 1, pageSize: 10 });
|
|
|
+ const res = this.dealerList.filter(
|
|
|
+ (v) => v.id === this.addForm.customerId
|
|
|
+ )[0];
|
|
|
+
|
|
|
+ if (this.addForm.id) {
|
|
|
+ await editDataListApi({ ...this.addForm });
|
|
|
+ this.$message.success("编辑成功");
|
|
|
+ } else {
|
|
|
+ await addDataListApi({ ...this.addForm, orgNumber: res.useOrgNumber });
|
|
|
+ this.$message.success("添加成功");
|
|
|
+ }
|
|
|
+
|
|
|
+ // console.log(res);
|
|
|
+ //
|
|
|
+ // this.addForm = {
|
|
|
+ // customerId: "",
|
|
|
+ // mobile: "",
|
|
|
+ // carType: "",
|
|
|
+ // volume: "",
|
|
|
+ // carBrand: "",
|
|
|
+ // };
|
|
|
+ this.getDataList({ pageNum: this.currentPage, pageSize: this.pageSize });
|
|
|
this.dialogForm = false;
|
|
|
},
|
|
|
//获取列表数据
|
|
@@ -259,34 +348,26 @@ export default {
|
|
|
this.dataList = res.data.records;
|
|
|
this.listTotal = res.data.total;
|
|
|
},
|
|
|
- editFn() {},
|
|
|
- // 提交筛选表单
|
|
|
- submitScreenForm() {
|
|
|
- this.currentPage = 1;
|
|
|
- this.getDataList();
|
|
|
- },
|
|
|
- // 重置筛选表单
|
|
|
- resetScreenForm() {
|
|
|
- this.$refs.screenForm.resetFields();
|
|
|
- this.currentPage = 1;
|
|
|
- this.getDataList();
|
|
|
- },
|
|
|
+
|
|
|
// 更改每页数量
|
|
|
handleSizeChange(val) {
|
|
|
this.pageSize = val;
|
|
|
this.currentPage = 1;
|
|
|
- this.getDataList();
|
|
|
+ this.getDataList({ pageNum: 1, pageSize: this.pageSize });
|
|
|
},
|
|
|
// 更改当前页
|
|
|
handleCurrentChange(val) {
|
|
|
this.currentPage = val;
|
|
|
- this.getDataList();
|
|
|
+ this.getDataList({ pageNum: val, pageSize: this.pageSize });
|
|
|
},
|
|
|
},
|
|
|
};
|
|
|
</script>
|
|
|
|
|
|
<style lang="scss" scoped>
|
|
|
+::v-deep .el-popover__reference {
|
|
|
+ margin-left: 10px;
|
|
|
+}
|
|
|
::v-deep .el-date-editor {
|
|
|
width: 100%;
|
|
|
}
|