站点配置

This commit is contained in:
jjLv 2024-11-08 16:13:43 +08:00
parent dec4a044b8
commit ce21f53e0e
2 changed files with 291 additions and 270 deletions

View File

@ -4,6 +4,13 @@
<div class="section"> <div class="section">
<el-header>库管员配置</el-header> <el-header>库管员配置</el-header>
<el-main> <el-main>
<el-button
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"
@ -16,18 +23,18 @@
{{ item.roleKey }} {{ item.roleKey }}
</el-checkbox> </el-checkbox>
</el-checkbox-group> </el-checkbox-group>
<el-button
type="success"
icon="el-icon-plus"
size="mini"
@click="handleSaveKeeper"
>保存库管员配置</el-button
>
</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
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"
@ -43,13 +50,6 @@
{{ item.roleKey }} {{ item.roleKey }}
</el-checkbox> </el-checkbox>
</el-checkbox-group> </el-checkbox-group>
<el-button
type="success"
icon="el-icon-plus"
size="mini"
@click="handleSaveRepair"
>保存维修员配置</el-button
>
</el-main> </el-main>
</div> </div>
</el-tab-pane> </el-tab-pane>

View File

@ -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,
getKeeperIds getKeeperIds,
} from "@/api/ma/typeConfigKeeper"; } from "@/api/ma/typeConfigKeeper";
import { getUserList } from "@/api/basic/basic"; import { getUserList } from "@/api/basic/basic";
import { getInfo } from "@/api/login"; import { getInfo } from "@/api/login";
@ -270,9 +270,9 @@ 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: [],
@ -318,20 +318,20 @@ export default {
children: "children", children: "children",
label: "label", label: "label",
}, },
roleIdsTemp:[], roleIdsTemp: [],
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: "",
// phonenumber: undefined, // phonenumber: undefined,
// status: undefined, // status: undefined,
// typeId: undefined // typeId: undefined
@ -343,8 +343,8 @@ export default {
afterPrice: "", afterPrice: "",
useDate: "", useDate: "",
}, },
isAllSelect:false, isAllSelect: false,
selectionRows:[], selectionRows: [],
}; };
}, },
// mounted(){ // mounted(){
@ -368,7 +368,6 @@ export default {
// setTimeout(()=>{ // setTimeout(()=>{
// this.getList(); // this.getList();
// },200) // },200)
}, },
methods: { methods: {
// getInfo() { // getInfo() {
@ -377,21 +376,21 @@ export default {
// this.companyId = res.user.companyId // this.companyId = res.user.companyId
// }) // })
// }, // },
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';
@ -402,10 +401,8 @@ export default {
<i class={iconClass}></i> {node.label} <i class={iconClass}></i> {node.label}
</span> </span>
); );
}, },
/** 查询物资类型 */ /** 查询物资类型 */
async getKeeperDataList(data) { async getKeeperDataList(data) {
let keepdataRes = await queryKeeperDataApi({ let keepdataRes = await queryKeeperDataApi({
@ -444,40 +441,44 @@ export default {
this.form.keeperDataPro = this.keeperProRange.value; this.form.keeperDataPro = this.keeperProRange.value;
}, },
/** 查询新增页面-上级类型下拉树结构 */ /** 查询新增页面-上级类型下拉树结构 */
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.split(',').map(item => Number(item)) const roleIds = response.rows[0].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";
console.log('queryParams1',this.queryParams) console.log("queryParams1", this.queryParams);
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) {
@ -493,21 +494,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();
}, },
// //
@ -545,41 +546,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.keeperUserId!=null){ if (item.keeperUserId != null) {
this.userNoList.push({'typeId':item.typeId,'userId':item.keeperUserId}) this.userNoList.push({
typeId: item.typeId,
userId: item.keeperUserId,
});
} }
});
})
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.keeperUserId}) );
}else if(indexNo!== -1){ if (this.ids.indexOf(row.typeId) === -1) {
this.userNoList.splice(indexNo,1); this.userNoList.push({ typeId: row.typeId, userId: row.keeperUserId });
} else if (indexNo !== -1) {
this.userNoList.splice(indexNo, 1);
} }
}, },
@ -591,60 +596,79 @@ export default {
// //
// tableDatavalcurrentSelection // tableDatavalcurrentSelection
// tableDatavalcurrentSelection // tableDatavalcurrentSelection
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 = [];
} }
}, },
// handleSelect(selection, row) { // handleSelect(selection, row) {
@ -688,7 +712,6 @@ export default {
// } // }
// }, // },
// // // //
// toggleSelection(row, flag) { // toggleSelection(row, flag) {
// this.$set(row,'isChecked',flag); // this.$set(row,'isChecked',flag);
@ -701,10 +724,9 @@ export default {
// }); // });
// }, // },
/** 绑定按钮操作 */ /** 绑定按钮操作 */
handleBind() { handleBind() {
console.log('ids----',this.ids) console.log("ids----", this.ids);
if (this.userIdTemp == -1) { if (this.userIdTemp == -1) {
this.$alert("未勾选绑定人,无法绑定", "提示", { this.$alert("未勾选绑定人,无法绑定", "提示", {
type: "warning", type: "warning",
@ -721,12 +743,12 @@ export default {
} else { } else {
const ids = this.ids.join(","); const ids = this.ids.join(",");
} }
console.log('userList',this.userList) console.log("userList", this.userList);
bindKeeper(this.userList).then((response) => { bindKeeper(this.userList).then((response) => {
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();
@ -741,12 +763,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();
@ -773,7 +795,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();
@ -832,7 +854,6 @@ export default {
`物资类型信息_${new Date().getTime()}.xlsx` `物资类型信息_${new Date().getTime()}.xlsx`
); );
}, },
}, },
}; };
</script> </script>