维修员页面
This commit is contained in:
parent
30b727a6b5
commit
add756b320
|
|
@ -12,17 +12,26 @@ export function getMatConfigList(query) {
|
|||
//组织人员树类型管理列表
|
||||
export function getListByMatConfig(query) {
|
||||
return request({
|
||||
url: '/material/ma_type/getMaTypeConfigList',
|
||||
url: '/material/ma_type/listNoPage',
|
||||
method: 'get',
|
||||
params: query,
|
||||
})
|
||||
}
|
||||
|
||||
// 物资类型管理--新增
|
||||
export function bindRepair(data) {
|
||||
// 库管员管理--绑定
|
||||
export function bindKeeper(data) {
|
||||
return request({
|
||||
url: '/material/ma_type_config/updateMaTypeBindInfo',
|
||||
url: '/material/ma_type_repair',
|
||||
method: 'post',
|
||||
data: data,
|
||||
})
|
||||
}
|
||||
|
||||
// 库管员管理--绑定
|
||||
export function noBindKeeper(data) {
|
||||
return request({
|
||||
url: '/material/ma_type_repair',
|
||||
method: 'delete',
|
||||
data: data,
|
||||
})
|
||||
}
|
||||
|
|
@ -510,7 +510,7 @@ export default {
|
|||
renderConent(h, { node }) {
|
||||
let iconClass = '';
|
||||
// 根据 node 的类型判断图标
|
||||
if (node.data.level == 3) {
|
||||
if (node.data.level == 99) {
|
||||
iconClass = 'el-icon-user-solid';
|
||||
}
|
||||
// else if (node.type === 'file') {
|
||||
|
|
@ -619,7 +619,7 @@ export default {
|
|||
handleSave() {
|
||||
console.log(this.chosenUserId, 'chosenUserId')
|
||||
console.log(this.ids, 'ids')
|
||||
if(this.levelTemp!=3) {
|
||||
if(this.levelTemp!=99) {
|
||||
this.$modal.msgError("请先选择配置人员!")
|
||||
return
|
||||
}
|
||||
|
|
|
|||
|
|
@ -75,12 +75,6 @@
|
|||
<span>{{ (queryParams.pageNum - 1) * queryParams.pageSize + scope.$index + 1 }}</span>
|
||||
</template>
|
||||
</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="dictValue" sortable/>
|
||||
<el-table-column label="字典排序" align="center" prop="dictSort" sortable/>
|
||||
|
|
@ -138,8 +132,8 @@
|
|||
<el-form-item label="字典类型">
|
||||
<el-input v-model="form.dictType" :disabled="true" />
|
||||
</el-form-item>
|
||||
<el-form-item label="数据标签" prop="dictLabel">
|
||||
<el-input v-model="form.dictLabel" placeholder="请输入数据标签" />
|
||||
<el-form-item label="单位类型" prop="dictLabel">
|
||||
<el-input v-model="form.dictLabel" placeholder="请输入单位类型" />
|
||||
</el-form-item>
|
||||
<el-form-item label="数据键值" prop="dictValue">
|
||||
<el-input v-model="form.dictValue" placeholder="请输入数据键值" />
|
||||
|
|
|
|||
|
|
@ -56,7 +56,7 @@
|
|||
:filter-node-method="filterNodeTwo"
|
||||
ref="treeTwo"
|
||||
node-key="id"
|
||||
default-expand-all
|
||||
:default-expand-all="false"
|
||||
highlight-current
|
||||
@node-click="handleNodeClickTwo"
|
||||
>
|
||||
|
|
@ -326,11 +326,12 @@ export default {
|
|||
maxLength:100,//已选列表上限,防止数据过多请求报错
|
||||
// 查询参数
|
||||
queryParams: {
|
||||
typeName: undefined,
|
||||
typeName: "",
|
||||
level: 0,
|
||||
pageNum: 1,
|
||||
pageSize: 10,
|
||||
displayBindRelationship:true,
|
||||
houseId:"",
|
||||
// phonenumber: undefined,
|
||||
// status: undefined,
|
||||
// typeId: undefined
|
||||
|
|
@ -346,6 +347,9 @@ export default {
|
|||
selectionRows:[],
|
||||
};
|
||||
},
|
||||
// mounted(){
|
||||
// this.selectFirstNode();
|
||||
// },
|
||||
watch: {
|
||||
// 根据名称筛选部门树
|
||||
typeName(val) {
|
||||
|
|
@ -358,10 +362,13 @@ export default {
|
|||
},
|
||||
created() {
|
||||
// this.getInfo()
|
||||
this.getList();
|
||||
this.getTreeData();
|
||||
this.getTreeDataTwo();
|
||||
this.getKeeperDataList();
|
||||
this.getTreeData();
|
||||
this.getTreeDataTwo();
|
||||
// this.getKeeperDataList();
|
||||
// setTimeout(()=>{
|
||||
// this.getList();
|
||||
// },200)
|
||||
|
||||
// this.getUserList()
|
||||
// this.getPropData()
|
||||
},
|
||||
|
|
@ -372,6 +379,16 @@ export default {
|
|||
// 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 }) {
|
||||
let iconClass = '';
|
||||
// 根据 node 的类型判断图标
|
||||
|
|
@ -429,7 +446,7 @@ export default {
|
|||
this.form.keeperDataPro = this.keeperProRange.value;
|
||||
},
|
||||
/** 查询新增页面-上级类型下拉树结构 */
|
||||
getTreeData() {
|
||||
async getTreeData() {
|
||||
// getMatConfigList().then((response) => {
|
||||
// this.treeOptions = response.data;
|
||||
// });
|
||||
|
|
@ -439,16 +456,25 @@ export default {
|
|||
});
|
||||
},
|
||||
/** 查询新增页面-上级类型下拉树结构 */
|
||||
getTreeDataTwo() {
|
||||
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.queryParams.displayBindRelationship=true;
|
||||
getListByMaType(this.queryParams).then((response) => {
|
||||
this.queryParams.displayBindRelationship="true";
|
||||
console.log('queryParams1',this.queryParams)
|
||||
await getListByMaType(this.queryParams).then((response) => {
|
||||
this.typeList = response.data.rows
|
||||
this.total = response.data.total
|
||||
this.loading = false
|
||||
|
|
@ -473,10 +499,18 @@ export default {
|
|||
},
|
||||
// 节点单击事件 - 左侧树
|
||||
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() {
|
||||
this.open = false;
|
||||
|
|
@ -494,7 +528,7 @@ export default {
|
|||
this.resetForm("form");
|
||||
},
|
||||
/** 搜索按钮操作 */
|
||||
handleQuery() {
|
||||
async handleQuery() {
|
||||
// this.queryParams.pageNum = 1;
|
||||
this.$refs.multipleTable.clearSelection();
|
||||
this.queryParams.pageNum = 1;
|
||||
|
|
|
|||
|
|
@ -3,11 +3,11 @@
|
|||
<div class="app-container" id="toolsType">
|
||||
<el-row :gutter="20">
|
||||
<!--树数据-->
|
||||
<el-col :span="5" :xs="24">
|
||||
<el-col :span="4" :xs="24">
|
||||
<div class="head-container">
|
||||
<el-input
|
||||
v-model="typeName"
|
||||
placeholder="请输入类型名称"
|
||||
v-model="peopleName"
|
||||
placeholder="请输入人员名称"
|
||||
clearable
|
||||
maxlength="50"
|
||||
size="small"
|
||||
|
|
@ -16,6 +16,7 @@
|
|||
/>
|
||||
</div>
|
||||
<div class="head-container" style>
|
||||
<div class="grid-content bg-purple-dark" align="left">组织人员树</div>
|
||||
<el-tree
|
||||
style="height: 700px; overflow: scroll"
|
||||
:data="treeOptions"
|
||||
|
|
@ -32,8 +33,38 @@
|
|||
</el-tree>
|
||||
</div>
|
||||
</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
|
||||
:model="queryParams"
|
||||
ref="queryForm"
|
||||
|
|
@ -42,9 +73,9 @@
|
|||
v-show="showSearch"
|
||||
label-width="68px"
|
||||
>
|
||||
<el-form-item label="关键字" prop="typeName">
|
||||
<el-form-item label="关键字" prop="keyword">
|
||||
<el-input
|
||||
v-model="queryParams.typeName"
|
||||
v-model="queryParams.keyword"
|
||||
placeholder="请输入关键字"
|
||||
clearable
|
||||
style="width: 240px"
|
||||
|
|
@ -111,11 +142,10 @@
|
|||
ref="multipleTable"
|
||||
row-key="typeId"
|
||||
default-expand-all
|
||||
:tree-props="{ children: 'children' }"
|
||||
border
|
||||
@select="selectTr"
|
||||
@select-all="handleSelectAll"
|
||||
:tree-props="{children: 'children', hasChildren: 'hasChildren'}"
|
||||
@selection-change="handleSelectionChange"
|
||||
@select="handlerSelect"
|
||||
@select-all="handlerSelectAll"
|
||||
>
|
||||
<el-table-column
|
||||
type="selection"
|
||||
|
|
@ -124,45 +154,43 @@
|
|||
:reserve-selection="true"
|
||||
/>
|
||||
<el-table-column label="序号" align="center" width="80" type="index">
|
||||
<template slot-scope="scope">
|
||||
<!-- <template slot-scope="scope">
|
||||
<span>{{
|
||||
(queryParams.pageNum - 1) * queryParams.pageSize +
|
||||
scope.$index +
|
||||
1
|
||||
}}</span>
|
||||
</template>
|
||||
</template> -->
|
||||
</el-table-column>
|
||||
<el-table-column
|
||||
label="仓库信息"
|
||||
align="center"
|
||||
prop="parentOneLevelName"
|
||||
show-overflow-tooltip
|
||||
/>
|
||||
<el-table-column
|
||||
label="施工类型"
|
||||
align="center"
|
||||
prop="parentFourLevelName"
|
||||
show-overflow-tooltip
|
||||
/>
|
||||
prop="itemType"
|
||||
>
|
||||
</el-table-column>
|
||||
<el-table-column
|
||||
label="物资类型"
|
||||
align="center"
|
||||
prop="parentThreeLevelName"
|
||||
show-overflow-tooltip
|
||||
width="100"
|
||||
/>
|
||||
prop="materialType"
|
||||
>
|
||||
</el-table-column>
|
||||
<el-table-column
|
||||
label="物资名称"
|
||||
align="center"
|
||||
prop="parentTwoLevelName"
|
||||
show-overflow-tooltip
|
||||
/>
|
||||
prop="materialName"
|
||||
>
|
||||
</el-table-column>
|
||||
<el-table-column
|
||||
label="规格型号"
|
||||
align="center"
|
||||
prop="parentOneLevelName"
|
||||
show-overflow-tooltip
|
||||
/>
|
||||
prop="typeName"
|
||||
>
|
||||
</el-table-column>
|
||||
<el-table-column
|
||||
label="维修员"
|
||||
align="center"
|
||||
|
|
@ -185,8 +213,7 @@
|
|||
size="mini"
|
||||
type="warning"
|
||||
icon="el-icon-user-solid"
|
||||
@click="handleUpdate(scope.row)"
|
||||
v-hasPermi="['machinery:type:edit']"
|
||||
@click="handleUpdateKeep(scope.row)"
|
||||
v-if="scope.row.repairUserName != null"
|
||||
>
|
||||
维修解绑
|
||||
|
|
@ -194,6 +221,14 @@
|
|||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
|
||||
<pagination
|
||||
v-show="total>0"
|
||||
:total="total"
|
||||
:page.sync="queryParams.pageNum"
|
||||
:limit.sync="queryParams.pageSize"
|
||||
@pagination="getList"
|
||||
/>
|
||||
</el-col>
|
||||
</el-row>
|
||||
</div>
|
||||
|
|
@ -202,26 +237,23 @@
|
|||
<script>
|
||||
import Treeselect from "@riophae/vue-treeselect";
|
||||
import "@riophae/vue-treeselect/dist/vue-treeselect.css";
|
||||
|
||||
import { getUserByRoleList, getMaUserList } from "@/api/system/user";
|
||||
import {
|
||||
getProLists,
|
||||
getMaTypeList,
|
||||
getListByMaType,
|
||||
getMaType,
|
||||
queryKeeperDataApi,
|
||||
queryKeeperProApi,
|
||||
queryKeeperMatApi,
|
||||
queryKeeperNameApi,
|
||||
delMaType,
|
||||
addMaType,
|
||||
updateMaType,
|
||||
getListByMaType,
|
||||
} from "@/api/ma/base";
|
||||
import {
|
||||
getMatConfigList,
|
||||
getListByMatConfig,
|
||||
bindRepair,
|
||||
bindKeeper,
|
||||
noBindKeeper
|
||||
} from "@/api/ma/typeConfigRepair";
|
||||
import { getUserList } from "@/api/basic/basic";
|
||||
import { getInfo } from "@/api/login";
|
||||
import { downloadFile } from "@/utils/download";
|
||||
export default {
|
||||
name: "typeConfig",
|
||||
components: { Treeselect },
|
||||
|
|
@ -254,8 +286,12 @@ export default {
|
|||
propList: null,
|
||||
// 类型名称
|
||||
typeName: undefined,
|
||||
// 人员名称
|
||||
peopleName: undefined,
|
||||
// 树选项
|
||||
treeOptions: undefined,
|
||||
// 树选项
|
||||
treeOptionsTwo: undefined,
|
||||
//列表数据
|
||||
typeList: undefined,
|
||||
// 是否显示弹出层
|
||||
|
|
@ -274,21 +310,29 @@ export default {
|
|||
leasePrice: "",
|
||||
|
||||
fileList: [],
|
||||
|
||||
defaultProps: {
|
||||
children: "children",
|
||||
label: "label",
|
||||
},
|
||||
defaultPropsTwo: {
|
||||
children: "children",
|
||||
label: "label",
|
||||
},
|
||||
userList:[],
|
||||
userNoList:[],
|
||||
userIdTemp: -1,
|
||||
typeIdTemp: -1,
|
||||
maxLength:100,//已选列表上限,防止数据过多请求报错
|
||||
// 查询参数
|
||||
queryParams: {
|
||||
typeName: "",
|
||||
level: 0,
|
||||
pageNum: 1,
|
||||
pageSize: 10,
|
||||
typeName: undefined,
|
||||
level: 0,
|
||||
// phonenumber: undefined,
|
||||
// status: undefined,
|
||||
// typeId: undefined
|
||||
displayBindRelationship:true,
|
||||
houseId:"",
|
||||
|
||||
},
|
||||
|
||||
configOpen: false,
|
||||
|
|
@ -301,31 +345,44 @@ export default {
|
|||
selectionRows:[],
|
||||
};
|
||||
},
|
||||
// mounted(){
|
||||
// this.selectFirstNode();
|
||||
// },
|
||||
watch: {
|
||||
// 根据名称筛选部门树
|
||||
typeName(val) {
|
||||
this.$refs.treeTwo.filter(val);
|
||||
},
|
||||
// 根据名称筛选人员树
|
||||
peopleName(val) {
|
||||
this.$refs.tree.filter(val);
|
||||
},
|
||||
},
|
||||
created() {
|
||||
// this.getInfo()
|
||||
this.getList();
|
||||
this.getTreeData();
|
||||
this.getKeeperDataList();
|
||||
// this.getUserList()
|
||||
// this.getPropData()
|
||||
this.getTreeData();
|
||||
this.getTreeDataTwo();
|
||||
// this.getKeeperDataList();
|
||||
// setTimeout(()=>{
|
||||
// this.getList();
|
||||
// },200)
|
||||
|
||||
},
|
||||
methods: {
|
||||
// getInfo() {
|
||||
// getInfo().then((res) => {
|
||||
// console.log(res, '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 }) {
|
||||
let iconClass = '';
|
||||
// 根据 node 的类型判断图标
|
||||
if (node.level == 4) {
|
||||
if (node.data.level == 99) {
|
||||
iconClass = 'el-icon-user-solid';
|
||||
}
|
||||
// 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) => {
|
||||
// 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
|
||||
});
|
||||
},
|
||||
/** 查询新增页面-上级类型下拉树结构 */
|
||||
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() {
|
||||
this.loading = true;
|
||||
getListByMatConfig(this.queryParams).then((response) => {
|
||||
this.typeList = response.data;
|
||||
this.loading = false;
|
||||
});
|
||||
async getList() {
|
||||
this.loading = true
|
||||
this.queryParams.displayBindRelationship="true";
|
||||
console.log('queryParams1',this.queryParams)
|
||||
await getListByMaType(this.queryParams).then((response) => {
|
||||
this.typeList = response.data.rows
|
||||
this.total = response.data.total
|
||||
this.loading = false
|
||||
})
|
||||
},
|
||||
// 筛选节点 - 左侧树
|
||||
filterNode(value, data) {
|
||||
|
|
@ -402,10 +440,29 @@ export default {
|
|||
// 节点单击事件 - 左侧树
|
||||
handleNodeClick(data, node) {
|
||||
// this.queryParams.level = data.level
|
||||
this.handleQuery();
|
||||
// this.handleQuery();
|
||||
this.$refs.multipleTable.clearSelection();
|
||||
(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() {
|
||||
this.open = false;
|
||||
|
|
@ -423,9 +480,10 @@ export default {
|
|||
this.resetForm("form");
|
||||
},
|
||||
/** 搜索按钮操作 */
|
||||
handleQuery() {
|
||||
async handleQuery() {
|
||||
// this.queryParams.pageNum = 1;
|
||||
this.$refs.multipleTable.clearSelection();
|
||||
this.$refs.multipleTable.clearSelection();
|
||||
this.queryParams.pageNum = 1;
|
||||
this.getList();
|
||||
},
|
||||
/** 重置按钮操作 */
|
||||
|
|
@ -443,70 +501,108 @@ export default {
|
|||
|
||||
// 多选框选中数据
|
||||
handleSelectionChange(selection) {
|
||||
this.userList=[];
|
||||
this.userNoList=[];
|
||||
this.selectionRows = selection,
|
||||
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.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){
|
||||
this.$set(row,'isChecked',!row.isChecked);
|
||||
this.$nextTick(()=>{
|
||||
this.isAllSelect = row.isChecked;
|
||||
this.toggleSelect(row,row.isChecked,'tr');
|
||||
});
|
||||
},
|
||||
//单选操作-跨页
|
||||
handlerSelect(val, row) {
|
||||
const index = this.userList.findIndex(item=>item.typeId===row.typeId);
|
||||
if(this.ids.indexOf(row.typeId) === -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);
|
||||
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){
|
||||
if(type === 'all'){
|
||||
if(data.length > 0){
|
||||
data.forEach(item=>{
|
||||
this.toggleSelection(item, flag);
|
||||
if(item.children && item.children.length > 0){
|
||||
this.toggleSelect(item.children,flag,type)
|
||||
}
|
||||
})
|
||||
}
|
||||
}else {
|
||||
if(data.children && data.children.length > 0){
|
||||
data.children.forEach(item =>{
|
||||
item.isChecked = !item.isChecked;
|
||||
this.$refs.multipleTable.toggleRowSelection(item, flag);
|
||||
this.toggleSelect(item,flag,type);
|
||||
})
|
||||
}
|
||||
//全选操作-跨页
|
||||
handlerSelectAll(val) {
|
||||
if (val.length) {
|
||||
// 进来此处说明:
|
||||
// 1 当前页的全选 2 其他页有数据然后当前页的取消全选
|
||||
// 比较全选或者取消全选与当前页的数据,得到差集
|
||||
// 如果tableData中的数据在val中不存在,则说明是取消全选,需要从currentSelection中移除
|
||||
// 如果tableData中所有的数据都在val中存在,则说明是全选,需要将差集添加到currentSelection中
|
||||
const isAllSelect = this.tableData.every(item =>
|
||||
val.some(valItem => valItem.typeId === item.typeId)
|
||||
)
|
||||
if (isAllSelect) {
|
||||
// 全选中新增的差集
|
||||
const diff = val.filter(
|
||||
item => !this.userList.some(user => user.typeId === item.typeId)
|
||||
)
|
||||
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() {
|
||||
console.log('ids----',this.ids)
|
||||
if (this.userIdTemp == -1) {
|
||||
this.$alert("未勾选绑定人,无法绑定", "提示", {
|
||||
type: "warning",
|
||||
|
|
@ -523,14 +619,11 @@ export default {
|
|||
} else {
|
||||
const ids = this.ids.join(",");
|
||||
}
|
||||
bindRepair({
|
||||
typeId: 3,
|
||||
userId: this.userIdTemp,
|
||||
bindFlag: 1,
|
||||
bindRoleType: 1,
|
||||
}).then((response) => {
|
||||
bindKeeper(this.userList).then((response) => {
|
||||
this.$modal.msgSuccess("绑定成功");
|
||||
this.ids = null;
|
||||
this.userList = null;
|
||||
this.userIdTemp = -1
|
||||
this.getTreeData();
|
||||
this.getList();
|
||||
this.$refs.multipleTable.clearSelection();
|
||||
|
|
@ -539,19 +632,22 @@ export default {
|
|||
|
||||
/** 解绑按钮操作 */
|
||||
handleNoBind() {
|
||||
if (this.userIdTemp == -1) {
|
||||
this.$alert("未勾选绑定人,无法绑定", "提示", {
|
||||
type: "warning",
|
||||
confirmButtonText: "确定",
|
||||
});
|
||||
return;
|
||||
}
|
||||
if (this.ids.length == 0) {
|
||||
this.$alert("未进行勾选,无法解绑", "提示", {
|
||||
type: "warning",
|
||||
confirmButtonText: "确定",
|
||||
});
|
||||
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({
|
||||
typeId: typeId,
|
||||
userId: userId,
|
||||
bindFlag: 2,
|
||||
bindRoleType: 2,
|
||||
}).then((response) => {
|
||||
this.$modal.msgSuccess("解绑成功");
|
||||
this.getList();
|
||||
|
|
@ -571,60 +665,18 @@ export default {
|
|||
|
||||
handleUpdateKeep(row) {
|
||||
const typeId = row.typeId;
|
||||
const userId = row.keeperUserId;
|
||||
console.log("typeId", typeId);
|
||||
console.log("userId", userId);
|
||||
bindRepair({
|
||||
const userId = row.repairUserId;
|
||||
const userTwo = [];
|
||||
userTwo.push({
|
||||
typeId: typeId,
|
||||
userId: userId,
|
||||
bindFlag: 2,
|
||||
bindRoleType: 1,
|
||||
}).then((response) => {
|
||||
})
|
||||
noBindKeeper(userTwo).then((response) => {
|
||||
this.$modal.msgSuccess("解绑成功");
|
||||
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() {
|
||||
this.download(
|
||||
|
|
@ -635,8 +687,7 @@ export default {
|
|||
`物资类型信息_${new Date().getTime()}.xlsx`
|
||||
);
|
||||
},
|
||||
|
||||
|
||||
|
||||
},
|
||||
};
|
||||
</script>
|
||||
|
|
@ -657,6 +708,13 @@ export default {
|
|||
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 {
|
||||
-webkit-transform: rotate(0deg);
|
||||
|
|
|
|||
Loading…
Reference in New Issue