Commit dec872c0 authored by “yiyousong”'s avatar “yiyousong”

pref:添加批量窗口关联大厅

parent fbecad24
......@@ -81,7 +81,7 @@
<h3 class="titel">站点窗口</h3>
<div class="control">
<div>
<!-- <a-button type="primary" @click="handleAddAll"> 批量加入 </a-button> -->
<a-button type="primary" @click="handleAddAll"> 批量加入 </a-button>
</div>
<div class="business-control">
<a-space>
......@@ -134,6 +134,7 @@
size="middle"
:row-selection="{
selectedRowKeys: selectedRowKeys,
onChange: onRightSelectChange,
}"
:columns="rightColumns"
:data-source="siteWindowData"
......@@ -147,7 +148,7 @@
<template slot="action" slot-scope="text">
<a-space size="middle">
<a class="jion" @click="handleIn(text)">加入大厅</a>
<a class="jion" @click="handleIn([text])">加入大厅</a>
</a-space>
</template>
</a-table>
......@@ -237,8 +238,9 @@ export default {
rightSearchVal: "",
leftLoading: false,
rightLoading: false,
selectedRowKeys: [],
selectedLeftRowKeys: [],
selectedRowKeys: [],
selectedRows: [],
visible: false,
leftCurrent: 1,
rightCurrent: 1,
......@@ -368,8 +370,25 @@ export default {
this.handleDel(ids);
},
// 获取批量加入id
onRightSelectChange(key) {
this.selectedRowKeys = key;
onRightSelectChange(keys, rows) {
this.selectedRowKeys = keys;
const res = new Map();
this.selectedRows = [...this.selectedRows, ...rows]
.filter((v) => {
return !res.has(v.id) && res.set(v.id, 1);
})
.filter((v) => {
return this.selectedRowKeys.some((val) => v.id == val);
});
},
// 批量加入
handleAddAll() {
if (!this.selectedRows.length) {
this.$message.warning("请先勾选数据");
return;
}
this.handleIn(this.selectedRows);
},
// 左翻页
......@@ -400,12 +419,14 @@ export default {
this.getSubHalllist();
},
// 加入
handleIn(row) {
this.$refs.WindowToHall.onAdd(row);
handleIn(rows) {
this.$refs.WindowToHall.onAdd(rows);
this.visible = true;
},
// 加入成功
addSuccess() {
this.selectedRowKeys = [];
this.selectedRows = [];
this.getWindowHallList();
this.getSubHalllist();
},
......
......@@ -37,7 +37,10 @@
</template>
<script>
import { saveWindowHall } from "@/services/hall";
import {
// saveWindowHall,
batchSaveWindowHall,
} from "@/services/hall";
export default {
props: {
addVisile: {
......@@ -65,6 +68,7 @@ export default {
// sort: "", // 排序
// remark: "", // 备注
},
windowList: [], // 选择窗口列表
rules: {
hallName: [
{ required: true, message: "请选择所属大厅", trigger: "change" },
......@@ -89,9 +93,10 @@ export default {
this.form.hallName = row.label;
},
// 新增
onAdd(row) {
this.form.windowId = row.id;
this.form.windowName = row.name;
onAdd(rows) {
this.windowList = rows;
// this.form.windowId = rows.id;
// this.form.windowName = rows.name;
},
// 关闭弹窗
......@@ -104,7 +109,15 @@ export default {
handleOk() {
this.$refs.form.validate(async (valid) => {
if (valid) {
let res = await saveWindowHall(this.form);
let arr = this.windowList.map((v) => {
return {
windowId: v.id, // 窗口id
windowName: v.name, // 窗口名称
hallId: this.form.hallId, // 大厅id
hallName: this.form.hallName, // 大厅名称
};
});
let res = await batchSaveWindowHall(arr);
let { code, msg } = res.data;
if (code == 1) {
this.$message.success(msg);
......
......@@ -352,6 +352,7 @@ module.exports = {
list: `${BASE_URL}/base/window/hall/list`,
info: `${BASE_URL}/base/window/hall/info`,
save: `${BASE_URL}/base/window/hall/save`,
batchSave: `${BASE_URL}/base/window/hall/batchSave`,
delete: `${BASE_URL}/base/window/hall/delete`,
},
};
......@@ -46,6 +46,11 @@ export const saveWindowHall = (data) => {
return request(windowHall.save, METHOD.POST, data);
};
// 批量保存大厅窗口
export const batchSaveWindowHall = (data) => {
return request(windowHall.batchSave, METHOD.POST, data);
};
// 删除大厅窗口
export const delWindowHall = (data) => {
return request(windowHall.delete, METHOD.get, data);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment