维修员页面

This commit is contained in:
jjLv 2024-11-06 13:20:47 +08:00
parent 30b727a6b5
commit add756b320
5 changed files with 340 additions and 245 deletions

View File

@ -12,17 +12,26 @@ export function getMatConfigList(query) {
//组织人员树类型管理列表 //组织人员树类型管理列表
export function getListByMatConfig(query) { export function getListByMatConfig(query) {
return request({ return request({
url: '/material/ma_type/getMaTypeConfigList', url: '/material/ma_type/listNoPage',
method: 'get', method: 'get',
params: query, params: query,
}) })
} }
// 物资类型管理--新增 // 库管员管理--绑定
export function bindRepair(data) { export function bindKeeper(data) {
return request({ return request({
url: '/material/ma_type_config/updateMaTypeBindInfo', url: '/material/ma_type_repair',
method: 'post', method: 'post',
data: data, data: data,
}) })
}
// 库管员管理--绑定
export function noBindKeeper(data) {
return request({
url: '/material/ma_type_repair',
method: 'delete',
data: data,
})
} }

View File

@ -510,7 +510,7 @@ export default {
renderConent(h, { node }) { renderConent(h, { node }) {
let iconClass = ''; let iconClass = '';
// node // node
if (node.data.level == 3) { 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') {
@ -619,7 +619,7 @@ export default {
handleSave() { handleSave() {
console.log(this.chosenUserId, 'chosenUserId') console.log(this.chosenUserId, 'chosenUserId')
console.log(this.ids, 'ids') console.log(this.ids, 'ids')
if(this.levelTemp!=3) { if(this.levelTemp!=99) {
this.$modal.msgError("请先选择配置人员!") this.$modal.msgError("请先选择配置人员!")
return return
} }

View File

@ -75,12 +75,6 @@
<span>{{ (queryParams.pageNum - 1) * queryParams.pageSize + scope.$index + 1 }}</span> <span>{{ (queryParams.pageNum - 1) * queryParams.pageSize + scope.$index + 1 }}</span>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column
align="center"
label="字典编码"
prop="dictCode"
:show-overflow-tooltip="true"
/>
<el-table-column label="单位类型名称" align="center" prop="dictLabel" sortable/> <el-table-column label="单位类型名称" align="center" prop="dictLabel" sortable/>
<el-table-column label="字典键值" align="center" prop="dictValue" sortable/> <el-table-column label="字典键值" align="center" prop="dictValue" sortable/>
<el-table-column label="字典排序" align="center" prop="dictSort" sortable/> <el-table-column label="字典排序" align="center" prop="dictSort" sortable/>
@ -138,8 +132,8 @@
<el-form-item label="字典类型"> <el-form-item label="字典类型">
<el-input v-model="form.dictType" :disabled="true" /> <el-input v-model="form.dictType" :disabled="true" />
</el-form-item> </el-form-item>
<el-form-item label="数据标签" prop="dictLabel"> <el-form-item label="单位类型" prop="dictLabel">
<el-input v-model="form.dictLabel" placeholder="请输入数据标签" /> <el-input v-model="form.dictLabel" placeholder="请输入单位类型" />
</el-form-item> </el-form-item>
<el-form-item label="数据键值" prop="dictValue"> <el-form-item label="数据键值" prop="dictValue">
<el-input v-model="form.dictValue" placeholder="请输入数据键值" /> <el-input v-model="form.dictValue" placeholder="请输入数据键值" />

View File

@ -56,7 +56,7 @@
:filter-node-method="filterNodeTwo" :filter-node-method="filterNodeTwo"
ref="treeTwo" ref="treeTwo"
node-key="id" node-key="id"
default-expand-all :default-expand-all="false"
highlight-current highlight-current
@node-click="handleNodeClickTwo" @node-click="handleNodeClickTwo"
> >
@ -326,11 +326,12 @@ export default {
maxLength:100,// maxLength:100,//
// //
queryParams: { queryParams: {
typeName: undefined, typeName: "",
level: 0, level: 0,
pageNum: 1, pageNum: 1,
pageSize: 10, pageSize: 10,
displayBindRelationship:true, displayBindRelationship:true,
houseId:"",
// phonenumber: undefined, // phonenumber: undefined,
// status: undefined, // status: undefined,
// typeId: undefined // typeId: undefined
@ -346,6 +347,9 @@ export default {
selectionRows:[], selectionRows:[],
}; };
}, },
// mounted(){
// this.selectFirstNode();
// },
watch: { watch: {
// //
typeName(val) { typeName(val) {
@ -358,10 +362,13 @@ export default {
}, },
created() { created() {
// this.getInfo() // this.getInfo()
this.getList(); this.getTreeData();
this.getTreeData(); this.getTreeDataTwo();
this.getTreeDataTwo(); // this.getKeeperDataList();
this.getKeeperDataList(); // setTimeout(()=>{
// this.getList();
// },200)
// this.getUserList() // this.getUserList()
// this.getPropData() // this.getPropData()
}, },
@ -372,6 +379,16 @@ export default {
// this.companyId = res.user.companyId // this.companyId = res.user.companyId
// }) // })
// }, // },
selectFirstNode(){
const firstNode = this.$refs.treeTwo.getNode(1);
if(firstNode){
this.queryParams.typeId = firstNode.id
this.queryParams.level = 0
this.queryParams.houseId = firstNode.id
this.$refs.treeTwo.setChecked(firstNode,true);
}
},
renderConent(h, { node }) { renderConent(h, { node }) {
let iconClass = ''; let iconClass = '';
// node // node
@ -429,7 +446,7 @@ export default {
this.form.keeperDataPro = this.keeperProRange.value; this.form.keeperDataPro = this.keeperProRange.value;
}, },
/** 查询新增页面-上级类型下拉树结构 */ /** 查询新增页面-上级类型下拉树结构 */
getTreeData() { async getTreeData() {
// getMatConfigList().then((response) => { // getMatConfigList().then((response) => {
// this.treeOptions = response.data; // this.treeOptions = response.data;
// }); // });
@ -439,16 +456,25 @@ export default {
}); });
}, },
/** 查询新增页面-上级类型下拉树结构 */ /** 查询新增页面-上级类型下拉树结构 */
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){
const firstNode = this.treeOptionsTwo[0].children[0];
this.queryParams.typeId = firstNode.id
this.queryParams.level = 1
this.queryParams.houseId = firstNode.houseId
this.getList();
}
}) })
}, },
/** 查询列表 */ /** 查询列表 */
getList() { async getList() {
this.loading = true this.loading = true
this.queryParams.displayBindRelationship=true; this.queryParams.displayBindRelationship="true";
getListByMaType(this.queryParams).then((response) => { console.log('queryParams1',this.queryParams)
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
@ -473,10 +499,18 @@ export default {
}, },
// - // -
async handleNodeClickTwo(data,node) { async handleNodeClickTwo(data,node) {
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
}else{
this.queryParams.typeId = data.id
this.queryParams.level = data.level
this.queryParams.houseId = data.houseId
}
this.handleQuery() this.handleQuery()
}, },
// //
cancel() { cancel() {
this.open = false; this.open = false;
@ -494,7 +528,7 @@ export default {
this.resetForm("form"); this.resetForm("form");
}, },
/** 搜索按钮操作 */ /** 搜索按钮操作 */
handleQuery() { async handleQuery() {
// this.queryParams.pageNum = 1; // this.queryParams.pageNum = 1;
this.$refs.multipleTable.clearSelection(); this.$refs.multipleTable.clearSelection();
this.queryParams.pageNum = 1; this.queryParams.pageNum = 1;

View File

@ -3,11 +3,11 @@
<div class="app-container" id="toolsType"> <div class="app-container" id="toolsType">
<el-row :gutter="20"> <el-row :gutter="20">
<!--树数据--> <!--树数据-->
<el-col :span="5" :xs="24"> <el-col :span="4" :xs="24">
<div class="head-container"> <div class="head-container">
<el-input <el-input
v-model="typeName" v-model="peopleName"
placeholder="请输入类型名称" placeholder="请输入人员名称"
clearable clearable
maxlength="50" maxlength="50"
size="small" size="small"
@ -16,6 +16,7 @@
/> />
</div> </div>
<div class="head-container" style> <div class="head-container" style>
<div class="grid-content bg-purple-dark" align="left">组织人员树</div>
<el-tree <el-tree
style="height: 700px; overflow: scroll" style="height: 700px; overflow: scroll"
:data="treeOptions" :data="treeOptions"
@ -32,8 +33,38 @@
</el-tree> </el-tree>
</div> </div>
</el-col> </el-col>
<!--树数据-->
<el-col :span="4" :xs="24">
<div class="head-container">
<el-input
v-model="typeName"
placeholder="请输入类型名称"
clearable
maxlength="50"
size="small"
prefix-icon="el-icon-search"
style="margin-bottom: 20px"
/>
</div>
<div class="head-container" style>
<div class="grid-content bg-purple-dark" align="left">物资类型树</div>
<el-tree
style="height: 700px; overflow: scroll"
:data="treeOptionsTwo"
:props="defaultPropsTwo"
:expand-on-click-node="false"
:filter-node-method="filterNodeTwo"
ref="treeTwo"
node-key="id"
:default-expand-all="false"
highlight-current
@node-click="handleNodeClickTwo"
>
</el-tree>
</div>
</el-col>
<!--用户数据--> <!--用户数据-->
<el-col :span="19" :xs="24"> <el-col :span="16" :xs="24">
<el-form <el-form
:model="queryParams" :model="queryParams"
ref="queryForm" ref="queryForm"
@ -42,9 +73,9 @@
v-show="showSearch" v-show="showSearch"
label-width="68px" label-width="68px"
> >
<el-form-item label="关键字" prop="typeName"> <el-form-item label="关键字" prop="keyword">
<el-input <el-input
v-model="queryParams.typeName" v-model="queryParams.keyword"
placeholder="请输入关键字" placeholder="请输入关键字"
clearable clearable
style="width: 240px" style="width: 240px"
@ -111,11 +142,10 @@
ref="multipleTable" ref="multipleTable"
row-key="typeId" row-key="typeId"
default-expand-all default-expand-all
:tree-props="{ children: 'children' }" :tree-props="{children: 'children', hasChildren: 'hasChildren'}"
border
@select="selectTr"
@select-all="handleSelectAll"
@selection-change="handleSelectionChange" @selection-change="handleSelectionChange"
@select="handlerSelect"
@select-all="handlerSelectAll"
> >
<el-table-column <el-table-column
type="selection" type="selection"
@ -124,45 +154,43 @@
:reserve-selection="true" :reserve-selection="true"
/> />
<el-table-column label="序号" align="center" width="80" type="index"> <el-table-column label="序号" align="center" width="80" type="index">
<template slot-scope="scope"> <!-- <template slot-scope="scope">
<span>{{ <span>{{
(queryParams.pageNum - 1) * queryParams.pageSize + (queryParams.pageNum - 1) * queryParams.pageSize +
scope.$index + scope.$index +
1 1
}}</span> }}</span>
</template> </template> -->
</el-table-column> </el-table-column>
<el-table-column
label="仓库信息"
align="center"
prop="parentOneLevelName"
show-overflow-tooltip
/>
<el-table-column <el-table-column
label="施工类型" label="施工类型"
align="center" align="center"
prop="parentFourLevelName"
show-overflow-tooltip show-overflow-tooltip
/> prop="itemType"
>
</el-table-column>
<el-table-column <el-table-column
label="物资类型" label="物资类型"
align="center" align="center"
prop="parentThreeLevelName"
show-overflow-tooltip show-overflow-tooltip
width="100" width="100"
/> prop="materialType"
>
</el-table-column>
<el-table-column <el-table-column
label="物资名称" label="物资名称"
align="center" align="center"
prop="parentTwoLevelName"
show-overflow-tooltip show-overflow-tooltip
/> prop="materialName"
>
</el-table-column>
<el-table-column <el-table-column
label="规格型号" label="规格型号"
align="center" align="center"
prop="parentOneLevelName"
show-overflow-tooltip show-overflow-tooltip
/> prop="typeName"
>
</el-table-column>
<el-table-column <el-table-column
label="维修员" label="维修员"
align="center" align="center"
@ -185,8 +213,7 @@
size="mini" size="mini"
type="warning" type="warning"
icon="el-icon-user-solid" icon="el-icon-user-solid"
@click="handleUpdate(scope.row)" @click="handleUpdateKeep(scope.row)"
v-hasPermi="['machinery:type:edit']"
v-if="scope.row.repairUserName != null" v-if="scope.row.repairUserName != null"
> >
维修解绑 维修解绑
@ -194,6 +221,14 @@
</template> </template>
</el-table-column> </el-table-column>
</el-table> </el-table>
<pagination
v-show="total>0"
:total="total"
:page.sync="queryParams.pageNum"
:limit.sync="queryParams.pageSize"
@pagination="getList"
/>
</el-col> </el-col>
</el-row> </el-row>
</div> </div>
@ -202,26 +237,23 @@
<script> <script>
import Treeselect from "@riophae/vue-treeselect"; import Treeselect from "@riophae/vue-treeselect";
import "@riophae/vue-treeselect/dist/vue-treeselect.css"; import "@riophae/vue-treeselect/dist/vue-treeselect.css";
import { getUserByRoleList, getMaUserList } from "@/api/system/user"; import { getUserByRoleList, getMaUserList } from "@/api/system/user";
import { import {
getProLists,
getMaTypeList, getMaTypeList,
getListByMaType,
getMaType,
queryKeeperDataApi, queryKeeperDataApi,
queryKeeperProApi, queryKeeperProApi,
queryKeeperMatApi, getListByMaType,
queryKeeperNameApi,
delMaType,
addMaType,
updateMaType,
} from "@/api/ma/base"; } from "@/api/ma/base";
import { import {
getMatConfigList, getMatConfigList,
getListByMatConfig, getListByMatConfig,
bindRepair, bindKeeper,
noBindKeeper
} 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 { downloadFile } from "@/utils/download";
export default { export default {
name: "typeConfig", name: "typeConfig",
components: { Treeselect }, components: { Treeselect },
@ -254,8 +286,12 @@ export default {
propList: null, propList: null,
// //
typeName: undefined, typeName: undefined,
//
peopleName: undefined,
// //
treeOptions: undefined, treeOptions: undefined,
//
treeOptionsTwo: undefined,
// //
typeList: undefined, typeList: undefined,
// //
@ -274,21 +310,29 @@ export default {
leasePrice: "", leasePrice: "",
fileList: [], fileList: [],
defaultProps: { defaultProps: {
children: "children", children: "children",
label: "label", label: "label",
}, },
defaultPropsTwo: {
children: "children",
label: "label",
},
userList:[],
userNoList:[],
userIdTemp: -1, userIdTemp: -1,
typeIdTemp: -1, typeIdTemp: -1,
maxLength:100,//
// //
queryParams: { queryParams: {
typeName: "",
level: 0,
pageNum: 1, pageNum: 1,
pageSize: 10, pageSize: 10,
typeName: undefined, displayBindRelationship:true,
level: 0, houseId:"",
// phonenumber: undefined,
// status: undefined,
// typeId: undefined
}, },
configOpen: false, configOpen: false,
@ -301,31 +345,44 @@ export default {
selectionRows:[], selectionRows:[],
}; };
}, },
// mounted(){
// this.selectFirstNode();
// },
watch: { watch: {
// //
typeName(val) { typeName(val) {
this.$refs.treeTwo.filter(val);
},
//
peopleName(val) {
this.$refs.tree.filter(val); this.$refs.tree.filter(val);
}, },
}, },
created() { created() {
// this.getInfo() this.getTreeData();
this.getList(); this.getTreeDataTwo();
this.getTreeData(); // this.getKeeperDataList();
this.getKeeperDataList(); // setTimeout(()=>{
// this.getUserList() // this.getList();
// this.getPropData() // },200)
}, },
methods: { methods: {
// getInfo() {
// getInfo().then((res) => { selectFirstNode(){
// console.log(res, 'companyId----') const firstNode = this.$refs.treeTwo.getNode(1);
// this.companyId = res.user.companyId if(firstNode){
// }) this.queryParams.typeId = firstNode.id
// }, this.queryParams.level = 0
this.queryParams.houseId = firstNode.id
this.$refs.treeTwo.setChecked(firstNode,true);
}
},
renderConent(h, { node }) { renderConent(h, { node }) {
let iconClass = ''; let iconClass = '';
// node // node
if (node.level == 4) { 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') {
@ -340,59 +397,40 @@ export default {
}, },
/** 查询物资类型 */
async getKeeperDataList(data) {
let keepdataRes = await queryKeeperDataApi({
// typeId:data.keeperData
});
this.keeperDataRange = keepdataRes.data.map((item) => {
return {
label: item.houseName,
value: item.houseId,
};
});
this.form.keeperData = this.keeperDataRange.value;
},
async getKeeperDataListTemp(data) {
let keepdataRes = await queryKeeperDataApi({
// typeId:data.keeperData
});
this.keeperDataRange = keepdataRes.data.map((item) => {
return {
label: item.houseName,
value: item.houseId,
};
});
// this.form.keeperData = this.keeperDataRange.value
let keepproRes = await queryKeeperProApi({
houseId: data.keeperDataPro,
});
this.keeperProRange = keepproRes.data.map((item) => {
return {
label: item.typeName,
value: item.typeId,
};
});
this.form.keeperDataPro = this.keeperProRange.value;
},
/** 查询新增页面-上级类型下拉树结构 */ /** 查询新增页面-上级类型下拉树结构 */
getTreeData() { async getTreeData() {
// getMatConfigList().then((response) => { // getMatConfigList().then((response) => {
// this.treeOptions = response.data; // this.treeOptions = response.data;
// }); // });
getUserList({ userName: this.userName ,deptId:0}).then(response => { const roleIds = [8,9,15,16];
getUserList({ roleIds: roleIds}).then(response => {
this.treeOptions = response.data this.treeOptions = response.data
}); });
}, },
/** 查询新增页面-上级类型下拉树结构 */
async getTreeDataTwo() {
getMaTypeList().then((response) => {
this.treeOptionsTwo = response.data
if(this.treeOptionsTwo.length>0 && this.treeOptionsTwo[0].children.length>0){
const firstNode = this.treeOptionsTwo[0].children[0];
this.queryParams.typeId = firstNode.id
this.queryParams.level = 1
this.queryParams.houseId = firstNode.houseId
this.getList();
}
})
},
/** 查询列表 */ /** 查询列表 */
getList() { async getList() {
this.loading = true; this.loading = true
getListByMatConfig(this.queryParams).then((response) => { this.queryParams.displayBindRelationship="true";
this.typeList = response.data; console.log('queryParams1',this.queryParams)
this.loading = false; await getListByMaType(this.queryParams).then((response) => {
}); this.typeList = response.data.rows
this.total = response.data.total
this.loading = false
})
}, },
// - // -
filterNode(value, data) { filterNode(value, data) {
@ -402,10 +440,29 @@ export default {
// - // -
handleNodeClick(data, node) { handleNodeClick(data, node) {
// this.queryParams.level = data.level // this.queryParams.level = data.level
this.handleQuery(); // this.handleQuery();
this.$refs.multipleTable.clearSelection(); this.$refs.multipleTable.clearSelection();
(this.userIdTemp = data.id), (this.queryParams.userId = data.id); (this.userIdTemp = data.id), (this.queryParams.userId = data.id);
}, },
// -
filterNodeTwo(value, data) {
if (!value) return true
return data.label.indexOf(value) !== -1
},
// -
async handleNodeClickTwo(data,node) {
if(data.level==0){
this.queryParams.typeId = data.id
this.queryParams.level = data.level
this.queryParams.houseId = data.id
}else{
this.queryParams.typeId = data.id
this.queryParams.level = data.level
this.queryParams.houseId = data.houseId
}
this.handleQuery()
},
// //
cancel() { cancel() {
this.open = false; this.open = false;
@ -423,9 +480,10 @@ export default {
this.resetForm("form"); this.resetForm("form");
}, },
/** 搜索按钮操作 */ /** 搜索按钮操作 */
handleQuery() { async handleQuery() {
// this.queryParams.pageNum = 1; // this.queryParams.pageNum = 1;
this.$refs.multipleTable.clearSelection(); this.$refs.multipleTable.clearSelection();
this.queryParams.pageNum = 1;
this.getList(); this.getList();
}, },
/** 重置按钮操作 */ /** 重置按钮操作 */
@ -443,70 +501,108 @@ export default {
// //
handleSelectionChange(selection) { handleSelectionChange(selection) {
this.userList=[];
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=>{
this.userList.push({'typeId':item.typeId,'userId':this.userIdTemp})
})
selection.forEach(item=>{
if(item.repairUserId!=null){
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;
console.log('ids---------',this.ids)
},
handleSelect(selection, row) {
this.toggleSelection(selection, row);
},
handleSelectAll(selection) {
this.isAllSelect = !this.isAllSelect;
let data = this.typeList;
this.toggleSelect(data,this.isAllSelect,'all');
}, },
// //-
selectTr(selection,row){ handlerSelect(val, row) {
this.$set(row,'isChecked',!row.isChecked); const index = this.userList.findIndex(item=>item.typeId===row.typeId);
this.$nextTick(()=>{ if(this.ids.indexOf(row.typeId) === -1){
this.isAllSelect = row.isChecked; this.userList.push({'typeId':row.typeId,'userId':this.userIdTemp})
this.toggleSelect(row,row.isChecked,'tr'); }else if(index!== -1){
}); this.userList.splice(index,1);
}, }
const indexNo = this.userNoList.findIndex(item=>item.typeId===row.typeId);
if(this.ids.indexOf(row.typeId) === -1){
this.userNoList.push({'typeId':row.typeId,'userId':row.repairUserId})
}else if(indexNo!== -1){
this.userNoList.splice(indexNo,1);
}
},
// //-
toggleSelect(data,flag,type){ handlerSelectAll(val) {
if(type === 'all'){ if (val.length) {
if(data.length > 0){ // :
data.forEach(item=>{ // 1 2
this.toggleSelection(item, flag); //
if(item.children && item.children.length > 0){ // tableDatavalcurrentSelection
this.toggleSelect(item.children,flag,type) // tableDatavalcurrentSelection
} const isAllSelect = this.tableData.every(item =>
}) val.some(valItem => valItem.typeId === item.typeId)
} )
}else { if (isAllSelect) {
if(data.children && data.children.length > 0){ //
data.children.forEach(item =>{ const diff = val.filter(
item.isChecked = !item.isChecked; item => !this.userList.some(user => user.typeId === item.typeId)
this.$refs.multipleTable.toggleRowSelection(item, flag); )
this.toggleSelect(item,flag,type); if (this.userList.length + diff.length > this.maxLength) {
}) const spaceLeft = this.maxLength - this.userList.length
} const toAdd = diff.slice(0,spaceLeft)
this.userList = this.userList.concat(toAdd.map(item =>({
typeId:item.typeId,
userId:this.userIdTemp
})));
diff.slice(spaceLeft).forEach(item => this.$refs.multipleTable.toggleRowSelection(item, false))
} else {
this.userList = this.userList.concat(diff.map(item=>({
typeId:item.typeId,
userId:this.userIdTemp
})))
} }
//
const diffNo = val.filter(
item => !this.userNoList.some(user => user.typeId === item.typeId)
)
if (this.userNoList.length + diff.length > this.maxLength) {
const spaceLeft = this.maxLength - this.userNoList.length
const toAdd = diff.slice(0,spaceLeft)
this.userNoList = this.userNoList.concat(toAdd.map(item =>({
typeId:item.typeId,
userId:item.userId
})));
diff.slice(spaceLeft).forEach(item => this.$refs.multipleTable.toggleRowSelection(item, false))
} else {
this.userNoList = this.userNoList.concat(diff.map(item=>({
typeId:item.typeId,
userId:item.userId
})))
}
} else {
this.userList = this.userList.filter(
user => !this.tableData.some(item => item.typeId === user.typeId)
)
this.userNoList = this.userNoList.filter(
user => !this.tableData.some(item => item.typeId === user.typeId)
)
}
} else {
// :
//
this.userList = []
this.userNoList = []
}
}, },
//
toggleSelection(row, flag) {
this.$set(row,'isChecked',flag);
this.$nextTick(()=>{
if (flag) {
this.$refs.multipleTable.toggleRowSelection(row, flag);
} else {
this.$refs.multipleTable.clearSelection();
}
});
},
/** 绑定按钮操作 */ /** 绑定按钮操作 */
handleBind() { handleBind() {
console.log('ids----',this.ids)
if (this.userIdTemp == -1) { if (this.userIdTemp == -1) {
this.$alert("未勾选绑定人,无法绑定", "提示", { this.$alert("未勾选绑定人,无法绑定", "提示", {
type: "warning", type: "warning",
@ -523,14 +619,11 @@ export default {
} else { } else {
const ids = this.ids.join(","); const ids = this.ids.join(",");
} }
bindRepair({ bindKeeper(this.userList).then((response) => {
typeId: 3,
userId: this.userIdTemp,
bindFlag: 1,
bindRoleType: 1,
}).then((response) => {
this.$modal.msgSuccess("绑定成功"); this.$modal.msgSuccess("绑定成功");
this.ids = null; this.ids = null;
this.userList = null;
this.userIdTemp = -1
this.getTreeData(); this.getTreeData();
this.getList(); this.getList();
this.$refs.multipleTable.clearSelection(); this.$refs.multipleTable.clearSelection();
@ -539,19 +632,22 @@ export default {
/** 解绑按钮操作 */ /** 解绑按钮操作 */
handleNoBind() { handleNoBind() {
if (this.userIdTemp == -1) {
this.$alert("未勾选绑定人,无法绑定", "提示", {
type: "warning",
confirmButtonText: "确定",
});
return;
}
if (this.ids.length == 0) { if (this.ids.length == 0) {
this.$alert("未进行勾选,无法解绑", "提示", { this.$alert("未进行勾选,无法解绑", "提示", {
type: "warning", type: "warning",
confirmButtonText: "确定", confirmButtonText: "确定",
}); });
return; return;
}else{
noBindKeeper(this.userNoList).then((response) => {
this.$modal.msgSuccess("解绑成功");
this.ids = null;
this.userList = null;
this.userNoList= null;
this.getTreeData();
this.getList();
this.$refs.multipleTable.clearSelection();
});
} }
}, },
/** 修改按钮操作 */ /** 修改按钮操作 */
@ -561,8 +657,6 @@ export default {
bindRepair({ bindRepair({
typeId: typeId, typeId: typeId,
userId: userId, userId: userId,
bindFlag: 2,
bindRoleType: 2,
}).then((response) => { }).then((response) => {
this.$modal.msgSuccess("解绑成功"); this.$modal.msgSuccess("解绑成功");
this.getList(); this.getList();
@ -571,60 +665,18 @@ export default {
handleUpdateKeep(row) { handleUpdateKeep(row) {
const typeId = row.typeId; const typeId = row.typeId;
const userId = row.keeperUserId; const userId = row.repairUserId;
console.log("typeId", typeId); const userTwo = [];
console.log("userId", userId); userTwo.push({
bindRepair({
typeId: typeId, typeId: typeId,
userId: userId, userId: userId,
bindFlag: 2, })
bindRoleType: 1, noBindKeeper(userTwo).then((response) => {
}).then((response) => {
this.$modal.msgSuccess("解绑成功"); this.$modal.msgSuccess("解绑成功");
this.getList(); this.getList();
}); });
}, },
/** 提交按钮 */
submitForm: function () {
console.log(this.form, "提交参数---");
this.$refs["form"].validate((valid) => {
if (valid) {
if (this.form.typeId != undefined) {
updateMaType(this.form).then((response) => {
this.$modal.msgSuccess("修改成功");
this.open = false;
this.getList();
this.getTreeData();
});
} else {
// this.form.companyId = this.companyId
addMaType(this.form).then((response) => {
this.$modal.msgSuccess("新增成功");
this.open = false;
this.getList();
this.getTreeData();
});
}
}
});
},
/** 删除按钮操作 */
handleDelete(row) {
const typeIds = row.typeId;
this.$modal
.confirm("是否确认删除数据项?")
.then(function () {
return delMaType(typeIds);
})
.then(() => {
this.$modal.msgSuccess("删除成功");
this.getList();
this.getTreeData();
})
.catch(() => {});
},
/** 导出按钮操作 */ /** 导出按钮操作 */
handleExport() { handleExport() {
this.download( this.download(
@ -635,8 +687,7 @@ export default {
`物资类型信息_${new Date().getTime()}.xlsx` `物资类型信息_${new Date().getTime()}.xlsx`
); );
}, },
}, },
}; };
</script> </script>
@ -657,6 +708,13 @@ export default {
font-size: 16px; font-size: 16px;
} }
} }
.grid-content {
border-radius: 4px;
min-height: 24px;
}
.bg-purple-dark {
background: #e5e9f2;
}
::v-deep .el-tree .el-tree-node__expand-icon.expanded { ::v-deep .el-tree .el-tree-node__expand-icon.expanded {
-webkit-transform: rotate(0deg); -webkit-transform: rotate(0deg);