站点配置
This commit is contained in:
parent
ce21f53e0e
commit
5d2a0e272b
|
|
@ -41,6 +41,15 @@ export function getKeeperIds(itemName) {
|
||||||
return request({
|
return request({
|
||||||
url: '/material/bm_config/list/',
|
url: '/material/bm_config/list/',
|
||||||
method: 'get',
|
method: 'get',
|
||||||
params:{"itemName":itemName},
|
params: { "itemName": itemName },
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
//修改库管员树的角色数组
|
||||||
|
export function updateBmConfig(data) {
|
||||||
|
return request({
|
||||||
|
url: '/material/bm_config',
|
||||||
|
method: 'post',
|
||||||
|
data: data,
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
@ -4,13 +4,7 @@
|
||||||
<div class="section">
|
<div class="section">
|
||||||
<el-header>库管员配置</el-header>
|
<el-header>库管员配置</el-header>
|
||||||
<el-main>
|
<el-main>
|
||||||
<el-button
|
<el-row>
|
||||||
type="success"
|
|
||||||
icon="el-icon-plus"
|
|
||||||
size="small"
|
|
||||||
@click="handleSaveKeeper"
|
|
||||||
>保存库管员配置</el-button
|
|
||||||
>
|
|
||||||
<el-checkbox-group v-model="selectedValues" class="checkbox-group">
|
<el-checkbox-group v-model="selectedValues" class="checkbox-group">
|
||||||
<el-checkbox
|
<el-checkbox
|
||||||
v-for="item in options"
|
v-for="item in options"
|
||||||
|
|
@ -20,21 +14,25 @@
|
||||||
:checked="item.check"
|
:checked="item.check"
|
||||||
class="checkbox-item"
|
class="checkbox-item"
|
||||||
>
|
>
|
||||||
{{ item.roleKey }}
|
{{ item.roleName }}
|
||||||
</el-checkbox>
|
</el-checkbox>
|
||||||
</el-checkbox-group>
|
</el-checkbox-group>
|
||||||
|
</el-row>
|
||||||
|
<div style="display: flex; justify-content: left">
|
||||||
|
<el-button
|
||||||
|
type="success"
|
||||||
|
icon="el-icon-plus"
|
||||||
|
size="small"
|
||||||
|
@click="handleSaveKeeper"
|
||||||
|
>保存库管员配置</el-button
|
||||||
|
>
|
||||||
|
</div>
|
||||||
</el-main>
|
</el-main>
|
||||||
</div>
|
</div>
|
||||||
<div class="section">
|
<div class="section">
|
||||||
<el-header>维修员配置</el-header>
|
<el-header>维修员配置</el-header>
|
||||||
<el-main>
|
<el-main>
|
||||||
<el-button
|
<el-row>
|
||||||
type="success"
|
|
||||||
icon="el-icon-plus"
|
|
||||||
size="small"
|
|
||||||
@click="handleSaveRepair"
|
|
||||||
>保存维修员配置</el-button
|
|
||||||
>
|
|
||||||
<el-checkbox-group
|
<el-checkbox-group
|
||||||
v-model="selectedValuesRepair"
|
v-model="selectedValuesRepair"
|
||||||
class="checkbox-group"
|
class="checkbox-group"
|
||||||
|
|
@ -47,9 +45,19 @@
|
||||||
:checked="item.check"
|
:checked="item.check"
|
||||||
class="checkbox-item"
|
class="checkbox-item"
|
||||||
>
|
>
|
||||||
{{ item.roleKey }}
|
{{ item.roleName }}
|
||||||
</el-checkbox>
|
</el-checkbox>
|
||||||
</el-checkbox-group>
|
</el-checkbox-group>
|
||||||
|
</el-row>
|
||||||
|
<div style="display: flex; justify-content: left">
|
||||||
|
<el-button
|
||||||
|
type="success"
|
||||||
|
icon="el-icon-plus"
|
||||||
|
size="small"
|
||||||
|
@click="handleSaveRepair"
|
||||||
|
>保存维修员配置</el-button
|
||||||
|
>
|
||||||
|
</div>
|
||||||
</el-main>
|
</el-main>
|
||||||
</div>
|
</div>
|
||||||
</el-tab-pane>
|
</el-tab-pane>
|
||||||
|
|
@ -103,7 +111,7 @@
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import { listRole } from "@/api/system/role";
|
import { listRole } from "@/api/system/role";
|
||||||
import { getKeeperIds } from "@/api/ma/typeConfigKeeper";
|
import { getKeeperIds, updateBmConfig } from "@/api/ma/typeConfigKeeper";
|
||||||
export default {
|
export default {
|
||||||
name: "siteConfig",
|
name: "siteConfig",
|
||||||
data() {
|
data() {
|
||||||
|
|
@ -141,7 +149,7 @@ export default {
|
||||||
const itemName = "ku_guan_role_ids";
|
const itemName = "ku_guan_role_ids";
|
||||||
//获取已有绑定的库管员
|
//获取已有绑定的库管员
|
||||||
await getKeeperIds(itemName).then((response) => {
|
await getKeeperIds(itemName).then((response) => {
|
||||||
const roleIds = response.rows[0].itemValue
|
const roleIds = response.rows[response.rows.length - 1].itemValue
|
||||||
.split(",")
|
.split(",")
|
||||||
.map((item) => Number(item));
|
.map((item) => Number(item));
|
||||||
this.roleIdsKeeper = roleIds;
|
this.roleIdsKeeper = roleIds;
|
||||||
|
|
@ -159,7 +167,7 @@ export default {
|
||||||
const itemName = "wei_xiu_role_ids";
|
const itemName = "wei_xiu_role_ids";
|
||||||
//获取已有绑定的维修员
|
//获取已有绑定的维修员
|
||||||
await getKeeperIds(itemName).then((response) => {
|
await getKeeperIds(itemName).then((response) => {
|
||||||
const roleIds = response.rows[0].itemValue
|
const roleIds = response.rows[response.rows.length - 1].itemValue
|
||||||
.split(",")
|
.split(",")
|
||||||
.map((item) => Number(item));
|
.map((item) => Number(item));
|
||||||
this.roleIdsRepair = roleIds;
|
this.roleIdsRepair = roleIds;
|
||||||
|
|
@ -172,10 +180,26 @@ export default {
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
handleSaveKeeper() {
|
handleSaveKeeper() {
|
||||||
console.log(this.selectedValues);
|
const itemValue = this.selectedValues.join(",");
|
||||||
|
const itemName = "ku_guan_role_ids";
|
||||||
|
updateBmConfig({ itemName: itemName, itemValue: itemValue }).then(
|
||||||
|
(response) => {
|
||||||
|
this.$message.success("保存成功!");
|
||||||
|
this.getList();
|
||||||
|
this.getListRepair();
|
||||||
|
}
|
||||||
|
);
|
||||||
},
|
},
|
||||||
handleSaveRepair() {
|
handleSaveRepair() {
|
||||||
console.log(this.selectedValuesRepair);
|
const itemValue = this.selectedValuesRepair.join(",");
|
||||||
|
const itemName = "wei_xiu_role_ids";
|
||||||
|
updateBmConfig({ itemName: itemName, itemValue: itemValue }).then(
|
||||||
|
(response) => {
|
||||||
|
this.$message.success("保存成功!");
|
||||||
|
this.getList();
|
||||||
|
this.getListRepair();
|
||||||
|
}
|
||||||
|
);
|
||||||
},
|
},
|
||||||
handleClick(tab, event) {
|
handleClick(tab, event) {
|
||||||
if (tab.name == "first") {
|
if (tab.name == "first") {
|
||||||
|
|
@ -200,7 +224,7 @@ export default {
|
||||||
background-color: #f8f8f9;
|
background-color: #f8f8f9;
|
||||||
color: #333;
|
color: #333;
|
||||||
text-align: left;
|
text-align: left;
|
||||||
width: 80%;
|
width: 100%;
|
||||||
line-height: 60px;
|
line-height: 60px;
|
||||||
border: 1px solid #dfe6ec;
|
border: 1px solid #dfe6ec;
|
||||||
}
|
}
|
||||||
|
|
@ -209,7 +233,7 @@ export default {
|
||||||
background-color: white;
|
background-color: white;
|
||||||
color: black;
|
color: black;
|
||||||
text-align: left;
|
text-align: left;
|
||||||
width: 80%;
|
width: 100%;
|
||||||
height: 300px;
|
height: 300px;
|
||||||
border-radius: 2px;
|
border-radius: 2px;
|
||||||
border: 1px solid #dfe6ec;
|
border: 1px solid #dfe6ec;
|
||||||
|
|
@ -239,18 +263,19 @@ export default {
|
||||||
/* 调整checkbox的样式 */
|
/* 调整checkbox的样式 */
|
||||||
::v-deep .checkbox-group {
|
::v-deep .checkbox-group {
|
||||||
display: flex;
|
display: flex;
|
||||||
width: 80%;
|
width: 100%;
|
||||||
flex-wrap: wrap; /* 使复选框换行 */
|
flex-wrap: wrap; /* 使复选框换行 */
|
||||||
gap: 1px; /* 间距 */
|
gap: 5px; /* 间距 */
|
||||||
margin-top: 0px;
|
margin-top: 0px;
|
||||||
margin-bottom: 0px;
|
margin-bottom: 80px;
|
||||||
}
|
}
|
||||||
|
|
||||||
::v-deep .checkbox-item {
|
::v-deep .checkbox-item {
|
||||||
display: inline-block;
|
display: inline-block;
|
||||||
width: calc(13% - 1px); /* 每个复选框的宽度,去除间距 */
|
height: 15px;
|
||||||
|
width: calc(16% - 5px); /* 每个复选框的宽度,去除间距 */
|
||||||
vertical-align: top; /* 顶部对齐 */
|
vertical-align: top; /* 顶部对齐 */
|
||||||
margin-bottom: 2px;
|
margin-bottom: 0px;
|
||||||
margin-top: 2px;
|
margin-top: 0px;
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|
@ -216,16 +216,15 @@
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
</el-table>
|
</el-table>
|
||||||
</el-col>
|
<pagination
|
||||||
</el-row>
|
v-show="total > 0"
|
||||||
|
|
||||||
<!-- <pagination
|
|
||||||
v-show="total>0"
|
|
||||||
:total="total"
|
:total="total"
|
||||||
:page.sync="queryParams.pageNum"
|
:page.sync="queryParams.pageNum"
|
||||||
:limit.sync="queryParams.pageSize"
|
:limit.sync="queryParams.pageSize"
|
||||||
@pagination="getList"
|
@pagination="getList"
|
||||||
/> -->
|
/>
|
||||||
|
</el-col>
|
||||||
|
</el-row>
|
||||||
|
|
||||||
<!-- 新增或修改弹窗 -->
|
<!-- 新增或修改弹窗 -->
|
||||||
<el-dialog
|
<el-dialog
|
||||||
|
|
@ -486,7 +485,7 @@ export default {
|
||||||
this.loading = true;
|
this.loading = true;
|
||||||
getListByPartType(this.queryParams).then((response) => {
|
getListByPartType(this.queryParams).then((response) => {
|
||||||
this.typeList = response.data.rows;
|
this.typeList = response.data.rows;
|
||||||
|
this.total = response.data.total;
|
||||||
this.loading = false;
|
this.loading = false;
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
|
||||||
|
|
@ -444,7 +444,7 @@ export default {
|
||||||
async getTreeData() {
|
async getTreeData() {
|
||||||
const itemName = "ku_guan_role_ids";
|
const itemName = "ku_guan_role_ids";
|
||||||
await getKeeperIds(itemName).then((response) => {
|
await getKeeperIds(itemName).then((response) => {
|
||||||
const roleIds = response.rows[0].itemValue
|
const roleIds = response.rows[response.rows.length - 1].itemValue
|
||||||
.split(",")
|
.split(",")
|
||||||
.map((item) => Number(item));
|
.map((item) => Number(item));
|
||||||
this.roleIdsTemp = roleIds;
|
this.roleIdsTemp = roleIds;
|
||||||
|
|
|
||||||
|
|
@ -142,7 +142,7 @@
|
||||||
ref="multipleTable"
|
ref="multipleTable"
|
||||||
row-key="typeId"
|
row-key="typeId"
|
||||||
default-expand-all
|
default-expand-all
|
||||||
:tree-props="{children: 'children', hasChildren: 'hasChildren'}"
|
:tree-props="{ children: 'children', hasChildren: 'hasChildren' }"
|
||||||
@selection-change="handleSelectionChange"
|
@selection-change="handleSelectionChange"
|
||||||
@select="handlerSelect"
|
@select="handlerSelect"
|
||||||
@select-all="handlerSelectAll"
|
@select-all="handlerSelectAll"
|
||||||
|
|
@ -223,7 +223,7 @@
|
||||||
</el-table>
|
</el-table>
|
||||||
|
|
||||||
<pagination
|
<pagination
|
||||||
v-show="total>0"
|
v-show="total > 0"
|
||||||
:total="total"
|
:total="total"
|
||||||
:page.sync="queryParams.pageNum"
|
:page.sync="queryParams.pageNum"
|
||||||
:limit.sync="queryParams.pageSize"
|
:limit.sync="queryParams.pageSize"
|
||||||
|
|
@ -248,7 +248,7 @@ import {
|
||||||
import {
|
import {
|
||||||
bindKeeper,
|
bindKeeper,
|
||||||
noBindKeeper,
|
noBindKeeper,
|
||||||
getRepairIds
|
getRepairIds,
|
||||||
} from "@/api/ma/typeConfigRepair";
|
} from "@/api/ma/typeConfigRepair";
|
||||||
import { getUserList } from "@/api/basic/basic";
|
import { getUserList } from "@/api/basic/basic";
|
||||||
import { getInfo } from "@/api/login";
|
import { getInfo } from "@/api/login";
|
||||||
|
|
@ -270,16 +270,16 @@ export default {
|
||||||
showSearch: true,
|
showSearch: true,
|
||||||
// 总条数
|
// 总条数
|
||||||
total: 0,
|
total: 0,
|
||||||
totalTemp:0,
|
totalTemp: 0,
|
||||||
countTemp: 1,
|
countTemp: 1,
|
||||||
totalAll:0,
|
totalAll: 0,
|
||||||
// 库管员用户数据
|
// 库管员用户数据
|
||||||
keeperList: null,
|
keeperList: null,
|
||||||
keeperDataRange: [],
|
keeperDataRange: [],
|
||||||
keeperProRange: [],
|
keeperProRange: [],
|
||||||
keeperMatRange: [],
|
keeperMatRange: [],
|
||||||
keeperNameRange: [],
|
keeperNameRange: [],
|
||||||
roleIdsTemp:[],
|
roleIdsTemp: [],
|
||||||
//维修员用户数据
|
//维修员用户数据
|
||||||
repairUserList: null,
|
repairUserList: null,
|
||||||
//资产类型数据
|
//资产类型数据
|
||||||
|
|
@ -319,20 +319,19 @@ export default {
|
||||||
children: "children",
|
children: "children",
|
||||||
label: "label",
|
label: "label",
|
||||||
},
|
},
|
||||||
userList:[],
|
userList: [],
|
||||||
userNoList:[],
|
userNoList: [],
|
||||||
userIdTemp: -1,
|
userIdTemp: -1,
|
||||||
typeIdTemp: -1,
|
typeIdTemp: -1,
|
||||||
maxLength:100,//已选列表上限,防止数据过多请求报错
|
maxLength: 100, //已选列表上限,防止数据过多请求报错
|
||||||
// 查询参数
|
// 查询参数
|
||||||
queryParams: {
|
queryParams: {
|
||||||
typeName: "",
|
typeName: "",
|
||||||
level: 0,
|
level: 0,
|
||||||
pageNum: 1,
|
pageNum: 1,
|
||||||
pageSize: 10,
|
pageSize: 10,
|
||||||
displayBindRelationship:true,
|
displayBindRelationship: true,
|
||||||
houseId:"",
|
houseId: "",
|
||||||
|
|
||||||
},
|
},
|
||||||
|
|
||||||
configOpen: false,
|
configOpen: false,
|
||||||
|
|
@ -341,8 +340,8 @@ export default {
|
||||||
afterPrice: "",
|
afterPrice: "",
|
||||||
useDate: "",
|
useDate: "",
|
||||||
},
|
},
|
||||||
isAllSelect:false,
|
isAllSelect: false,
|
||||||
selectionRows:[],
|
selectionRows: [],
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
// mounted(){
|
// mounted(){
|
||||||
|
|
@ -365,25 +364,23 @@ export default {
|
||||||
// setTimeout(()=>{
|
// setTimeout(()=>{
|
||||||
// this.getList();
|
// this.getList();
|
||||||
// },200)
|
// },200)
|
||||||
|
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
|
selectFirstNode() {
|
||||||
selectFirstNode(){
|
|
||||||
const firstNode = this.$refs.treeTwo.getNode(1);
|
const firstNode = this.$refs.treeTwo.getNode(1);
|
||||||
if(firstNode){
|
if (firstNode) {
|
||||||
this.queryParams.typeId = firstNode.id
|
this.queryParams.typeId = firstNode.id;
|
||||||
this.queryParams.level = 0
|
this.queryParams.level = 0;
|
||||||
this.queryParams.houseId = firstNode.id
|
this.queryParams.houseId = firstNode.id;
|
||||||
this.$refs.treeTwo.setChecked(firstNode,true);
|
this.$refs.treeTwo.setChecked(firstNode, true);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
renderConent(h, { node }) {
|
renderConent(h, { node }) {
|
||||||
let iconClass = '';
|
let iconClass = "";
|
||||||
// 根据 node 的类型判断图标
|
// 根据 node 的类型判断图标
|
||||||
if (node.data.level == 99) {
|
if (node.data.level == 99) {
|
||||||
iconClass = 'el-icon-user-solid';
|
iconClass = "el-icon-user-solid";
|
||||||
}
|
}
|
||||||
// else if (node.type === 'file') {
|
// else if (node.type === 'file') {
|
||||||
// iconClass = 'el-icon-document';
|
// iconClass = 'el-icon-document';
|
||||||
|
|
@ -394,43 +391,46 @@ export default {
|
||||||
<i class={iconClass}></i> {node.label}
|
<i class={iconClass}></i> {node.label}
|
||||||
</span>
|
</span>
|
||||||
);
|
);
|
||||||
|
|
||||||
},
|
},
|
||||||
|
|
||||||
/** 查询新增页面-上级类型下拉树结构 */
|
/** 查询新增页面-上级类型下拉树结构 */
|
||||||
async getTreeData() {
|
async getTreeData() {
|
||||||
const itemName = 'wei_xiu_role_ids'
|
const itemName = "wei_xiu_role_ids";
|
||||||
await getRepairIds(itemName).then((response) =>{
|
await getRepairIds(itemName).then((response) => {
|
||||||
const roleIds = response.rows[0].itemValue.split(',').map(item => Number(item))
|
const roleIds = response.rows[response.rows.length - 1].itemValue
|
||||||
this.roleIdsTemp = roleIds
|
.split(",")
|
||||||
})
|
.map((item) => Number(item));
|
||||||
await getUserList({ roleIds: this.roleIdsTemp}).then(response => {
|
this.roleIdsTemp = roleIds;
|
||||||
this.treeOptions = response.data
|
});
|
||||||
|
await getUserList({ roleIds: this.roleIdsTemp }).then((response) => {
|
||||||
|
this.treeOptions = response.data;
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
/** 查询新增页面-上级类型下拉树结构 */
|
/** 查询新增页面-上级类型下拉树结构 */
|
||||||
async getTreeDataTwo() {
|
async getTreeDataTwo() {
|
||||||
getMaTypeList().then((response) => {
|
getMaTypeList().then((response) => {
|
||||||
this.treeOptionsTwo = response.data
|
this.treeOptionsTwo = response.data;
|
||||||
if(this.treeOptionsTwo.length>0 && this.treeOptionsTwo[0].children.length>0){
|
if (
|
||||||
|
this.treeOptionsTwo.length > 0 &&
|
||||||
|
this.treeOptionsTwo[0].children.length > 0
|
||||||
|
) {
|
||||||
const firstNode = this.treeOptionsTwo[0].children[0];
|
const firstNode = this.treeOptionsTwo[0].children[0];
|
||||||
this.queryParams.typeId = firstNode.id
|
this.queryParams.typeId = firstNode.id;
|
||||||
this.queryParams.level = 1
|
this.queryParams.level = 1;
|
||||||
this.queryParams.houseId = firstNode.houseId
|
this.queryParams.houseId = firstNode.houseId;
|
||||||
this.getList();
|
this.getList();
|
||||||
}
|
}
|
||||||
})
|
});
|
||||||
|
|
||||||
},
|
},
|
||||||
/** 查询列表 */
|
/** 查询列表 */
|
||||||
async getList() {
|
async getList() {
|
||||||
this.loading = true
|
this.loading = true;
|
||||||
this.queryParams.displayBindRelationship="true";
|
this.queryParams.displayBindRelationship = "true";
|
||||||
await getListByMaType(this.queryParams).then((response) => {
|
await getListByMaType(this.queryParams).then((response) => {
|
||||||
this.typeList = response.data.rows
|
this.typeList = response.data.rows;
|
||||||
this.total = response.data.total
|
this.total = response.data.total;
|
||||||
this.loading = false
|
this.loading = false;
|
||||||
})
|
});
|
||||||
},
|
},
|
||||||
// 筛选节点 - 左侧树
|
// 筛选节点 - 左侧树
|
||||||
filterNode(value, data) {
|
filterNode(value, data) {
|
||||||
|
|
@ -446,21 +446,21 @@ export default {
|
||||||
},
|
},
|
||||||
// 筛选节点 - 左侧树
|
// 筛选节点 - 左侧树
|
||||||
filterNodeTwo(value, data) {
|
filterNodeTwo(value, data) {
|
||||||
if (!value) return true
|
if (!value) return true;
|
||||||
return data.label.indexOf(value) !== -1
|
return data.label.indexOf(value) !== -1;
|
||||||
},
|
},
|
||||||
// 节点单击事件 - 左侧树
|
// 节点单击事件 - 左侧树
|
||||||
async handleNodeClickTwo(data,node) {
|
async handleNodeClickTwo(data, node) {
|
||||||
if(data.level==0){
|
if (data.level == 0) {
|
||||||
this.queryParams.typeId = data.id
|
this.queryParams.typeId = data.id;
|
||||||
this.queryParams.level = data.level
|
this.queryParams.level = data.level;
|
||||||
this.queryParams.houseId = data.id
|
this.queryParams.houseId = data.id;
|
||||||
}else{
|
} else {
|
||||||
this.queryParams.typeId = data.id
|
this.queryParams.typeId = data.id;
|
||||||
this.queryParams.level = data.level
|
this.queryParams.level = data.level;
|
||||||
this.queryParams.houseId = data.houseId
|
this.queryParams.houseId = data.houseId;
|
||||||
}
|
}
|
||||||
this.handleQuery()
|
this.handleQuery();
|
||||||
},
|
},
|
||||||
|
|
||||||
// 取消按钮
|
// 取消按钮
|
||||||
|
|
@ -498,41 +498,45 @@ export default {
|
||||||
this.handleQuery();
|
this.handleQuery();
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
||||||
// 多选框选中数据
|
// 多选框选中数据
|
||||||
handleSelectionChange(selection) {
|
handleSelectionChange(selection) {
|
||||||
this.userList=[];
|
this.userList = [];
|
||||||
this.userNoList=[];
|
this.userNoList = [];
|
||||||
this.selectionRows = selection,
|
(this.selectionRows = selection),
|
||||||
this.ids = selection.map((item) =>item.typeId);
|
(this.ids = selection.map((item) => item.typeId));
|
||||||
|
|
||||||
selection.forEach(item=>{
|
selection.forEach((item) => {
|
||||||
this.userList.push({'typeId':item.typeId,'userId':this.userIdTemp})
|
this.userList.push({ typeId: item.typeId, userId: this.userIdTemp });
|
||||||
})
|
});
|
||||||
selection.forEach(item=>{
|
selection.forEach((item) => {
|
||||||
if(item.repairUserId!=null){
|
if (item.repairUserId != null) {
|
||||||
this.userNoList.push({'typeId':item.typeId,'userId':item.repairUserId})
|
this.userNoList.push({
|
||||||
|
typeId: item.typeId,
|
||||||
|
userId: item.repairUserId,
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
});
|
||||||
})
|
|
||||||
this.single = selection.length != 1;
|
this.single = selection.length != 1;
|
||||||
this.multiple = !selection.length;
|
this.multiple = !selection.length;
|
||||||
|
|
||||||
},
|
},
|
||||||
|
|
||||||
//单选操作-跨页
|
//单选操作-跨页
|
||||||
handlerSelect(val, row) {
|
handlerSelect(val, row) {
|
||||||
const index = this.userList.findIndex(item=>item.typeId===row.typeId);
|
const index = this.userList.findIndex(
|
||||||
if(this.ids.indexOf(row.typeId) === -1){
|
(item) => item.typeId === row.typeId
|
||||||
this.userList.push({'typeId':row.typeId,'userId':this.userIdTemp})
|
);
|
||||||
}else if(index!== -1){
|
if (this.ids.indexOf(row.typeId) === -1) {
|
||||||
this.userList.splice(index,1);
|
this.userList.push({ typeId: row.typeId, userId: this.userIdTemp });
|
||||||
|
} else if (index !== -1) {
|
||||||
|
this.userList.splice(index, 1);
|
||||||
}
|
}
|
||||||
const indexNo = this.userNoList.findIndex(item=>item.typeId===row.typeId);
|
const indexNo = this.userNoList.findIndex(
|
||||||
if(this.ids.indexOf(row.typeId) === -1){
|
(item) => item.typeId === row.typeId
|
||||||
this.userNoList.push({'typeId':row.typeId,'userId':row.repairUserId})
|
);
|
||||||
}else if(indexNo!== -1){
|
if (this.ids.indexOf(row.typeId) === -1) {
|
||||||
this.userNoList.splice(indexNo,1);
|
this.userNoList.push({ typeId: row.typeId, userId: row.repairUserId });
|
||||||
|
} else if (indexNo !== -1) {
|
||||||
|
this.userNoList.splice(indexNo, 1);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
@ -544,60 +548,79 @@ export default {
|
||||||
// 比较全选或者取消全选与当前页的数据,得到差集
|
// 比较全选或者取消全选与当前页的数据,得到差集
|
||||||
// 如果tableData中的数据在val中不存在,则说明是取消全选,需要从currentSelection中移除
|
// 如果tableData中的数据在val中不存在,则说明是取消全选,需要从currentSelection中移除
|
||||||
// 如果tableData中所有的数据都在val中存在,则说明是全选,需要将差集添加到currentSelection中
|
// 如果tableData中所有的数据都在val中存在,则说明是全选,需要将差集添加到currentSelection中
|
||||||
const isAllSelect = this.tableData.every(item =>
|
const isAllSelect = this.tableData.every((item) =>
|
||||||
val.some(valItem => valItem.typeId === item.typeId)
|
val.some((valItem) => valItem.typeId === item.typeId)
|
||||||
)
|
);
|
||||||
if (isAllSelect) {
|
if (isAllSelect) {
|
||||||
// 全选中新增的差集
|
// 全选中新增的差集
|
||||||
const diff = val.filter(
|
const diff = val.filter(
|
||||||
item => !this.userList.some(user => user.typeId === item.typeId)
|
(item) => !this.userList.some((user) => user.typeId === item.typeId)
|
||||||
)
|
);
|
||||||
if (this.userList.length + diff.length > this.maxLength) {
|
if (this.userList.length + diff.length > this.maxLength) {
|
||||||
const spaceLeft = this.maxLength - this.userList.length
|
const spaceLeft = this.maxLength - this.userList.length;
|
||||||
const toAdd = diff.slice(0,spaceLeft)
|
const toAdd = diff.slice(0, spaceLeft);
|
||||||
this.userList = this.userList.concat(toAdd.map(item =>({
|
this.userList = this.userList.concat(
|
||||||
typeId:item.typeId,
|
toAdd.map((item) => ({
|
||||||
userId:this.userIdTemp
|
typeId: item.typeId,
|
||||||
})));
|
userId: this.userIdTemp,
|
||||||
diff.slice(spaceLeft).forEach(item => this.$refs.multipleTable.toggleRowSelection(item, false))
|
}))
|
||||||
|
);
|
||||||
|
diff
|
||||||
|
.slice(spaceLeft)
|
||||||
|
.forEach((item) =>
|
||||||
|
this.$refs.multipleTable.toggleRowSelection(item, false)
|
||||||
|
);
|
||||||
} else {
|
} else {
|
||||||
this.userList = this.userList.concat(diff.map(item=>({
|
this.userList = this.userList.concat(
|
||||||
typeId:item.typeId,
|
diff.map((item) => ({
|
||||||
userId:this.userIdTemp
|
typeId: item.typeId,
|
||||||
})))
|
userId: this.userIdTemp,
|
||||||
|
}))
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
// 全选中新增的差集
|
// 全选中新增的差集
|
||||||
const diffNo = val.filter(
|
const diffNo = val.filter(
|
||||||
item => !this.userNoList.some(user => user.typeId === item.typeId)
|
(item) =>
|
||||||
)
|
!this.userNoList.some((user) => user.typeId === item.typeId)
|
||||||
|
);
|
||||||
if (this.userNoList.length + diff.length > this.maxLength) {
|
if (this.userNoList.length + diff.length > this.maxLength) {
|
||||||
const spaceLeft = this.maxLength - this.userNoList.length
|
const spaceLeft = this.maxLength - this.userNoList.length;
|
||||||
const toAdd = diff.slice(0,spaceLeft)
|
const toAdd = diff.slice(0, spaceLeft);
|
||||||
this.userNoList = this.userNoList.concat(toAdd.map(item =>({
|
this.userNoList = this.userNoList.concat(
|
||||||
typeId:item.typeId,
|
toAdd.map((item) => ({
|
||||||
userId:item.userId
|
typeId: item.typeId,
|
||||||
})));
|
userId: item.userId,
|
||||||
diff.slice(spaceLeft).forEach(item => this.$refs.multipleTable.toggleRowSelection(item, false))
|
}))
|
||||||
|
);
|
||||||
|
diff
|
||||||
|
.slice(spaceLeft)
|
||||||
|
.forEach((item) =>
|
||||||
|
this.$refs.multipleTable.toggleRowSelection(item, false)
|
||||||
|
);
|
||||||
} else {
|
} else {
|
||||||
this.userNoList = this.userNoList.concat(diff.map(item=>({
|
this.userNoList = this.userNoList.concat(
|
||||||
typeId:item.typeId,
|
diff.map((item) => ({
|
||||||
userId:item.userId
|
typeId: item.typeId,
|
||||||
})))
|
userId: item.userId,
|
||||||
|
}))
|
||||||
|
);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
this.userList = this.userList.filter(
|
this.userList = this.userList.filter(
|
||||||
user => !this.tableData.some(item => item.typeId === user.typeId)
|
(user) =>
|
||||||
)
|
!this.tableData.some((item) => item.typeId === user.typeId)
|
||||||
|
);
|
||||||
this.userNoList = this.userNoList.filter(
|
this.userNoList = this.userNoList.filter(
|
||||||
user => !this.tableData.some(item => item.typeId === user.typeId)
|
(user) =>
|
||||||
)
|
!this.tableData.some((item) => item.typeId === user.typeId)
|
||||||
|
);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
// 进来此处说明:
|
// 进来此处说明:
|
||||||
// 其他页并无勾选数据,且当前页取消勾选
|
// 其他页并无勾选数据,且当前页取消勾选
|
||||||
this.userList = []
|
this.userList = [];
|
||||||
this.userNoList = []
|
this.userNoList = [];
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
@ -623,7 +646,7 @@ export default {
|
||||||
this.$modal.msgSuccess("绑定成功");
|
this.$modal.msgSuccess("绑定成功");
|
||||||
this.ids = null;
|
this.ids = null;
|
||||||
this.userList = null;
|
this.userList = null;
|
||||||
this.userIdTemp = -1
|
this.userIdTemp = -1;
|
||||||
this.getTreeData();
|
this.getTreeData();
|
||||||
this.getList();
|
this.getList();
|
||||||
this.$refs.multipleTable.clearSelection();
|
this.$refs.multipleTable.clearSelection();
|
||||||
|
|
@ -638,12 +661,12 @@ export default {
|
||||||
confirmButtonText: "确定",
|
confirmButtonText: "确定",
|
||||||
});
|
});
|
||||||
return;
|
return;
|
||||||
}else{
|
} else {
|
||||||
noBindKeeper(this.userNoList).then((response) => {
|
noBindKeeper(this.userNoList).then((response) => {
|
||||||
this.$modal.msgSuccess("解绑成功");
|
this.$modal.msgSuccess("解绑成功");
|
||||||
this.ids = null;
|
this.ids = null;
|
||||||
this.userList = null;
|
this.userList = null;
|
||||||
this.userNoList= null;
|
this.userNoList = null;
|
||||||
this.getTreeData();
|
this.getTreeData();
|
||||||
this.getList();
|
this.getList();
|
||||||
this.$refs.multipleTable.clearSelection();
|
this.$refs.multipleTable.clearSelection();
|
||||||
|
|
@ -670,7 +693,7 @@ export default {
|
||||||
userTwo.push({
|
userTwo.push({
|
||||||
typeId: typeId,
|
typeId: typeId,
|
||||||
userId: userId,
|
userId: userId,
|
||||||
})
|
});
|
||||||
noBindKeeper(userTwo).then((response) => {
|
noBindKeeper(userTwo).then((response) => {
|
||||||
this.$modal.msgSuccess("解绑成功");
|
this.$modal.msgSuccess("解绑成功");
|
||||||
this.getList();
|
this.getList();
|
||||||
|
|
@ -689,7 +712,6 @@ export default {
|
||||||
`物资类型信息_${new Date().getTime()}.xlsx`
|
`物资类型信息_${new Date().getTime()}.xlsx`
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
|
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
</script>
|
</script>
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue