|
@@ -2,28 +2,45 @@
|
|
|
<div class="app-container">
|
|
|
<!-- 筛选条件 -->
|
|
|
<div>
|
|
|
- <el-form label-width="100px" size="small" label-position="left">
|
|
|
+ <el-form
|
|
|
+ ref="searchForm"
|
|
|
+ :model="searchForm"
|
|
|
+ label-width="100px"
|
|
|
+ size="small"
|
|
|
+ label-position="left"
|
|
|
+ >
|
|
|
<el-row :gutter="20">
|
|
|
<el-col :xs="24" :sm="12" :lg="6">
|
|
|
- <el-form-item label="经销商名称" prop="account">
|
|
|
- <el-input placeholder="请输入经销商名称"></el-input>
|
|
|
+ <el-form-item label="经销商名称" prop="customerName">
|
|
|
+ <el-input
|
|
|
+ v-model="searchForm.customerName"
|
|
|
+ placeholder="请输入经销商名称"
|
|
|
+ ></el-input>
|
|
|
</el-form-item>
|
|
|
</el-col>
|
|
|
<el-col :xs="24" :sm="12" :lg="6">
|
|
|
- <el-form-item label="存货分类编码" prop="account">
|
|
|
- <el-input placeholder="请输入"></el-input>
|
|
|
+ <el-form-item label="存货分类编码" prop="bianMa">
|
|
|
+ <el-input
|
|
|
+ v-model="searchForm.mainId"
|
|
|
+ placeholder="请输入"
|
|
|
+ ></el-input>
|
|
|
</el-form-item>
|
|
|
</el-col>
|
|
|
<el-col :xs="24" :sm="12" :lg="6">
|
|
|
- <el-form-item label="存货分类" prop="account">
|
|
|
- <el-input placeholder="请输入"></el-input>
|
|
|
+ <el-form-item label="存货分类" prop="mainName">
|
|
|
+ <el-input
|
|
|
+ v-model="searchForm.mainName"
|
|
|
+ placeholder="请输入"
|
|
|
+ ></el-input>
|
|
|
</el-form-item>
|
|
|
</el-col>
|
|
|
|
|
|
<el-col :xs="24" :sm="12" :lg="6">
|
|
|
<el-form-item label="" class="fr">
|
|
|
- <el-button size="small">清空</el-button>
|
|
|
- <el-button size="small" type="primary">搜索</el-button>
|
|
|
+ <el-button size="small" @click="clearFn">清空</el-button>
|
|
|
+ <el-button size="small" type="primary" @click="searchFn"
|
|
|
+ >搜索</el-button
|
|
|
+ >
|
|
|
</el-form-item>
|
|
|
</el-col>
|
|
|
</el-row>
|
|
@@ -32,9 +49,17 @@
|
|
|
|
|
|
<div class="btn-group clearfix">
|
|
|
<div class="fl">
|
|
|
- <el-button type="primary" size="small">新增</el-button>
|
|
|
+ <el-button type="primary" size="small" @click="addFn">新增</el-button>
|
|
|
<el-button type="primary" size="small">编辑</el-button>
|
|
|
- <el-button type="primary" size="small">删除</el-button>
|
|
|
+ <el-popconfirm @onConfirm="deleFn" title="这是一段内容确定删除吗?">
|
|
|
+ <el-button
|
|
|
+ type="primary"
|
|
|
+ size="small"
|
|
|
+ class="textColor"
|
|
|
+ slot="reference"
|
|
|
+ >删除</el-button
|
|
|
+ >
|
|
|
+ </el-popconfirm>
|
|
|
</div>
|
|
|
<div class="fr">
|
|
|
<el-button type="primary" size="small">导入</el-button>
|
|
@@ -49,6 +74,8 @@
|
|
|
<el-table
|
|
|
v-loading="listLoading"
|
|
|
:data="dataList"
|
|
|
+ @select="hanleSelect"
|
|
|
+ @select-all="hanleSelect"
|
|
|
element-loading-text="Loading"
|
|
|
border
|
|
|
fit
|
|
@@ -63,49 +90,49 @@
|
|
|
<el-table-column
|
|
|
align="center"
|
|
|
label="经销商名称"
|
|
|
- prop="nname"
|
|
|
+ prop="customerName"
|
|
|
min-width="160"
|
|
|
show-overflow-tooltip
|
|
|
></el-table-column>
|
|
|
<el-table-column
|
|
|
align="center"
|
|
|
label="存货分类编码"
|
|
|
- prop="bianma"
|
|
|
+ prop="mainId"
|
|
|
min-width="160"
|
|
|
show-overflow-tooltip
|
|
|
></el-table-column>
|
|
|
<el-table-column
|
|
|
align="center"
|
|
|
label="存货分类名称"
|
|
|
- prop="selectname"
|
|
|
+ prop="mainName"
|
|
|
min-width="160"
|
|
|
show-overflow-tooltip
|
|
|
></el-table-column>
|
|
|
<el-table-column
|
|
|
align="center"
|
|
|
label="创建人"
|
|
|
- prop="person"
|
|
|
+ prop="createBy"
|
|
|
min-width="160"
|
|
|
show-overflow-tooltip
|
|
|
></el-table-column>
|
|
|
<el-table-column
|
|
|
align="center"
|
|
|
label="创建时间"
|
|
|
- prop="createdata"
|
|
|
+ prop="createTime"
|
|
|
min-width="160"
|
|
|
show-overflow-tooltip
|
|
|
></el-table-column>
|
|
|
<el-table-column
|
|
|
align="center"
|
|
|
label="更新人"
|
|
|
- prop="updateperson"
|
|
|
+ prop="updateBy"
|
|
|
min-width="160"
|
|
|
show-overflow-tooltip
|
|
|
></el-table-column>
|
|
|
<el-table-column
|
|
|
align="center"
|
|
|
label="更新时间"
|
|
|
- prop="update"
|
|
|
+ prop="updateTime"
|
|
|
min-width="160"
|
|
|
show-overflow-tooltip
|
|
|
></el-table-column>
|
|
@@ -116,16 +143,25 @@
|
|
|
min-width="160"
|
|
|
show-overflow-tooltip
|
|
|
>
|
|
|
- <el-button type="text" class="textColor" @click="editFn"
|
|
|
- >编辑</el-button
|
|
|
- >
|
|
|
- <el-button type="text" class="textColor">删除</el-button>
|
|
|
+ <template slot-scope="scope">
|
|
|
+ <el-button type="text" class="textColor">编辑</el-button>
|
|
|
+ <el-popconfirm
|
|
|
+ @onConfirm="deleFn(scope.row.id)"
|
|
|
+ title="这是一段内容确定删除吗?"
|
|
|
+ >
|
|
|
+ <el-button type="text" class="textColor" slot="reference"
|
|
|
+ >删除</el-button
|
|
|
+ ></el-popconfirm
|
|
|
+ >
|
|
|
+ </template>
|
|
|
</el-table-column>
|
|
|
</el-table>
|
|
|
</div>
|
|
|
<!-- 分页 -->
|
|
|
<div class="fr">
|
|
|
<el-pagination
|
|
|
+ @size-change="handleSizeChange"
|
|
|
+ @current-change="handleCurrentChange"
|
|
|
:current-page="currentPage"
|
|
|
:page-sizes="[10, 20, 30, 50]"
|
|
|
:page-size="10"
|
|
@@ -144,123 +180,197 @@
|
|
|
:show-close="false"
|
|
|
:close-on-click-modal="false"
|
|
|
>
|
|
|
- <el-form :model="form" label-width="100px" label-position="right">
|
|
|
+ <el-form
|
|
|
+ ref="addForm"
|
|
|
+ :model="addForm"
|
|
|
+ label-width="100px"
|
|
|
+ label-position="right"
|
|
|
+ >
|
|
|
<el-form-item label="经销商名称">
|
|
|
- <el-select v-model="form.name" placeholder="请选择活动区域">
|
|
|
- <el-option label="区域一" value="shanghai"></el-option>
|
|
|
- <el-option label="区域二" value="beijing"></el-option>
|
|
|
+ <el-select
|
|
|
+ class="selectStyle"
|
|
|
+ v-model="addForm.customerId"
|
|
|
+ placeholder="名称"
|
|
|
+ >
|
|
|
+ <el-option
|
|
|
+ v-for="item in dealerList"
|
|
|
+ :key="item.id"
|
|
|
+ :label="item.name"
|
|
|
+ :value="item.id"
|
|
|
+ >
|
|
|
+ </el-option>
|
|
|
</el-select>
|
|
|
</el-form-item>
|
|
|
- <el-form-item label="活动分类">
|
|
|
- <el-select v-model="form.select" placeholder="请选择活动区域">
|
|
|
- <el-option label="区域一" value="shanghai"></el-option>
|
|
|
- <el-option label="区域二" value="beijing"></el-option>
|
|
|
+ <el-form-item label="存货分类">
|
|
|
+ <el-select
|
|
|
+ class="selectStyle"
|
|
|
+ v-model="addForm.mainId"
|
|
|
+ placeholder="请选择"
|
|
|
+ >
|
|
|
+ <el-option
|
|
|
+ v-for="item in selectList"
|
|
|
+ :key="item.value"
|
|
|
+ :label="item.dictValue"
|
|
|
+ :value="item.sysDictId"
|
|
|
+ >
|
|
|
+ </el-option>
|
|
|
</el-select>
|
|
|
</el-form-item>
|
|
|
</el-form>
|
|
|
<div slot="footer" class="dialog-footer">
|
|
|
<el-button @click="dialogForm = false">取 消</el-button>
|
|
|
- <el-button type="primary" @click="dialogForm = false">确 定</el-button>
|
|
|
+ <el-button type="primary" @click="addDataListFn">确 定</el-button>
|
|
|
</div>
|
|
|
</el-dialog>
|
|
|
</div>
|
|
|
</template>
|
|
|
|
|
|
<script>
|
|
|
+import {
|
|
|
+ getDealerStockList,
|
|
|
+ getDealerStockAdd,
|
|
|
+ deleDealerStockList,
|
|
|
+ getDictionaries,
|
|
|
+} from "@/api/basic_data/dealer";
|
|
|
+import { getDealerList } from "@/api/basic_data/dealer";
|
|
|
+import { findElem } from "@/utils/util";
|
|
|
export default {
|
|
|
data() {
|
|
|
return {
|
|
|
dialogForm: false,
|
|
|
- form: {
|
|
|
- name: "",
|
|
|
- select: "",
|
|
|
+ addForm: {
|
|
|
+ customerName: "",
|
|
|
+ customerId: "",
|
|
|
+ customerNumber: "",
|
|
|
+ mainId: "",
|
|
|
+ mainName: "",
|
|
|
},
|
|
|
currentPage: 1, // 当前页码
|
|
|
pageSize: 10, // 每页数量
|
|
|
listTotal: 0, // 列表总数
|
|
|
- dealerForm: {
|
|
|
- name: "",
|
|
|
- coding: "",
|
|
|
- select: "",
|
|
|
+
|
|
|
+ searchForm: {
|
|
|
+ customerName: "",
|
|
|
+ mainId: "",
|
|
|
+ mainName: "",
|
|
|
},
|
|
|
- dataList: [
|
|
|
- {
|
|
|
- nname: "佛山市禅城区梁云冷气经营部",
|
|
|
- bianma: "01",
|
|
|
- selectname: "家用空调",
|
|
|
- person: "LID",
|
|
|
- createdata: "2022-05-18 12:00",
|
|
|
- updateperson: "LID",
|
|
|
- update: "2022-05-24 12:00",
|
|
|
- },
|
|
|
- {
|
|
|
- nname: "佛山市禅城区梁云冷气经营部",
|
|
|
- bianma: "01",
|
|
|
- selectname: "家用空调",
|
|
|
- person: "LID",
|
|
|
- createdata: "2022-05-18 12:00",
|
|
|
- updateperson: "LID",
|
|
|
- update: "2022-05-24 12:00",
|
|
|
- },
|
|
|
- {
|
|
|
- nname: "佛山市禅城区梁云冷气经营部",
|
|
|
- bianma: "01",
|
|
|
- selectname: "家用空调",
|
|
|
- person: "LID",
|
|
|
- createdata: "2022-05-18 12:00",
|
|
|
- updateperson: "LID",
|
|
|
- update: "2022-05-24 12:00",
|
|
|
- },
|
|
|
- {
|
|
|
- nname: "佛山市禅城区梁云冷气技术部",
|
|
|
- bianma: "02",
|
|
|
- selectname: "家用电视",
|
|
|
- person: "CCC",
|
|
|
- createdata: "2022-05-18 12:00",
|
|
|
- updateperson: "CCC",
|
|
|
- update: "2022-05-24 12:00",
|
|
|
- },
|
|
|
- ], // 列表数据
|
|
|
+ dataList: [], // 列表数据
|
|
|
listLoading: false, // 列表加载loading
|
|
|
+ dealerList: [],
|
|
|
+ selectList: [],
|
|
|
+ ids: [],
|
|
|
};
|
|
|
},
|
|
|
- created() {},
|
|
|
+ async created() {
|
|
|
+ this.getList({ pageNum: 1, pageSize: 10 });
|
|
|
+ this.getDealerDataList({ pageNum: 1, pageSize: 10 });
|
|
|
+ this.getSelectList({ sysDictEnum: "PRODUCT_TYPE" });
|
|
|
+ },
|
|
|
computed: {},
|
|
|
methods: {
|
|
|
- editFn() {
|
|
|
+ // 筛选部分数据或者单个
|
|
|
+ hanleSelect(selection) {
|
|
|
+ // this.ids = selection.map((k) => {
|
|
|
+ // return k.id;
|
|
|
+ // });
|
|
|
+ console.log(selection);
|
|
|
+ this.ids = selection.map((v) => v.id);
|
|
|
+ },
|
|
|
+ //存货分类
|
|
|
+ async getSelectList(data) {
|
|
|
+ const res = await getDictionaries(data);
|
|
|
+ console.log(res);
|
|
|
+ this.selectList = res.data;
|
|
|
+ },
|
|
|
+ //删除
|
|
|
+ async deleFn(id) {
|
|
|
+ this.ids.push(id);
|
|
|
+ let res = this.ids.toString();
|
|
|
+
|
|
|
+ await deleDealerStockList({ ids: res });
|
|
|
+ this.getList({ pageNum: 1, pageSize: 10 });
|
|
|
+ this.$message.success("删除成功");
|
|
|
+ },
|
|
|
+ addFn() {
|
|
|
this.dialogForm = true;
|
|
|
},
|
|
|
- queryFn() {
|
|
|
- if (
|
|
|
- this.dealerForm.name === "" &&
|
|
|
- this.dealerForm.coding === "" &&
|
|
|
- this.dealerForm.select === ""
|
|
|
- ) {
|
|
|
- return;
|
|
|
- }
|
|
|
+ async addDataListFn() {
|
|
|
+ console.log(this.dealerList);
|
|
|
+ console.log(this.addForm.customerId);
|
|
|
+ // let id = this.dealerList.filter((i) => {
|
|
|
+ // return i.id === this.addForm.customerId;
|
|
|
+ // })[0];
|
|
|
+ // console.log(id, "id");
|
|
|
+ // let res = findElem(this.dealerList, "id", this.addForm.customerId);
|
|
|
+ // console.log(11111, res);
|
|
|
+ let res = this.dealerList.filter(
|
|
|
+ (v) => v.id === this.addForm.customerId
|
|
|
+ )[0];
|
|
|
+ console.log(res);
|
|
|
+ this.addForm.customerName = res.name;
|
|
|
+ this.addForm.customerNumber = res.number;
|
|
|
+ let res2 = this.selectList.filter(
|
|
|
+ (v) => v.sysDictId === this.addForm.mainId
|
|
|
+ )[0];
|
|
|
+ console.log(res2);
|
|
|
+ this.addForm.mainName = res2.dictValue;
|
|
|
+ console.log(this.addForm);
|
|
|
|
|
|
- let res = this.dataList.filter(
|
|
|
- (v) =>
|
|
|
- v.nname === this.dealerForm.name &&
|
|
|
- v.coding === this.dealerForm.bianma &&
|
|
|
- v.select === this.dealerForm.selectname
|
|
|
- );
|
|
|
- this.dataList = res;
|
|
|
+ await getDealerStockAdd({ ...this.addForm });
|
|
|
+ this.$message.success("添加成功");
|
|
|
+ await this.getList({ pageNum: 1, pageSize: 10 });
|
|
|
+ this.dialogForm = false;
|
|
|
+ },
|
|
|
+ //获取经销商数据
|
|
|
+ async getDealerDataList(data) {
|
|
|
+ const res = await getDealerList(data);
|
|
|
+ this.dealerList = res.data.records;
|
|
|
+ },
|
|
|
+
|
|
|
+ // 更改每页数量
|
|
|
+ handleSizeChange(val) {
|
|
|
+ this.pageSize = val;
|
|
|
+ this.currentPage = 1;
|
|
|
+ this.getList({ pageNum: 1, pageSize: this.pageSize });
|
|
|
+ },
|
|
|
+ // 更改当前页
|
|
|
+ handleCurrentChange(val) {
|
|
|
+ this.currentPage = val;
|
|
|
+ this.getList({ pageNum: val, pageSize: 10 });
|
|
|
},
|
|
|
- resetFn() {
|
|
|
- this.dealerForm.name = "";
|
|
|
- this.dealerForm.coding = "";
|
|
|
- this.dealerForm.select = "";
|
|
|
- console.log(this.dealerForm);
|
|
|
+ //搜索功能
|
|
|
+ async searchFn() {
|
|
|
+ console.log(this.searchForm);
|
|
|
+ await this.getList({
|
|
|
+ cusotmerName: this.searchForm.customerName,
|
|
|
+ pageNum: 1,
|
|
|
+ pageSize: 10,
|
|
|
+ });
|
|
|
+ },
|
|
|
+ //重置
|
|
|
+ clearFn() {
|
|
|
+ console.log(this.$refs.searchForm);
|
|
|
+ this.$refs.searchForm.resetFields();
|
|
|
+ },
|
|
|
+ //获取列表数据
|
|
|
+ async getList(data) {
|
|
|
+ const res = await getDealerStockList(data);
|
|
|
+ console.log(res);
|
|
|
+ this.dataList = res.data.records;
|
|
|
+ this.listTotal = res.data.total;
|
|
|
},
|
|
|
},
|
|
|
};
|
|
|
</script>
|
|
|
|
|
|
<style lang="scss" scoped>
|
|
|
-.aaa {
|
|
|
- padding: 10px 0;
|
|
|
+::v-deep .el-popover__reference {
|
|
|
+ margin-left: 10px;
|
|
|
+}
|
|
|
+::v-deep .selectStyle .el-input--suffix {
|
|
|
+ width: 200%;
|
|
|
}
|
|
|
+
|
|
|
::v-deep .el-input--suffix {
|
|
|
width: 300px;
|
|
|
}
|
|
@@ -276,7 +386,4 @@ export default {
|
|
|
width: 70%;
|
|
|
margin-right: 20px;
|
|
|
}
|
|
|
-.right {
|
|
|
- float: right;
|
|
|
-}
|
|
|
</style>
|