Merge branch 'material-ui' of http://192.168.0.56:3000/bonus/bonus-ui into material-ui

This commit is contained in:
zzyuan 2024-11-08 17:41:26 +08:00
commit f12ac8ad1f
6 changed files with 1475 additions and 1355 deletions

View File

@ -30,9 +30,9 @@ export function bindKeeper(data) {
// 库管员管理--绑定
export function noBindKeeper(data) {
return request({
url: '/material/ma_type_keeper',
method: 'delete',
data: data,
url: '/material/ma_type_keeper',
method: 'delete',
data: data,
})
}
@ -41,6 +41,15 @@ export function getKeeperIds(itemName) {
return request({
url: '/material/bm_config/list/',
method: 'get',
params:{"itemName":itemName},
params: { "itemName": itemName },
})
}
//修改库管员树的角色数组
export function updateBmConfig(data) {
return request({
url: '/material/bm_config',
method: 'post',
data: data,
})
}

View File

@ -1,53 +1,65 @@
<template>
<el-tabs v-model="activeName" @tab-click="handleClick" class="app-container">
<el-tabs v-model="activeName" @tab-click="handleClick" class="app-container">
<el-tab-pane label="物资配置" name="first">
<div>
<div class="section">
<el-header>库管员配置</el-header>
<el-main>
<el-checkbox-group v-model="selectedValues" class="checkbox-group">
<el-checkbox
v-for="item in options"
:key="item.roleId"
:label="item.roleId"
:value="item.roleId"
:checked="item.check"
class="checkbox-item">
{{ item.roleKey }}
</el-checkbox>
</el-checkbox-group>
<el-button
type="success"
icon="el-icon-plus"
size="mini"
@click="handleQuery"
>保存库管员配置</el-button>
</el-main>
</div>
<!-- <div class="section">
<el-header>维修员配置</el-header>
<div class="section">
<el-header>库管员配置</el-header>
<el-main>
<el-checkbox-group v-model="selectedValues" class="checkbox-group">
<el-row>
<el-checkbox-group v-model="selectedValues" class="checkbox-group">
<el-checkbox
v-for="item in options"
:key="item.id"
:label="item.id"
:value="item.id"
:key="item.roleId"
:label="item.roleId"
:value="item.roleId"
:checked="item.check"
class="checkbox-item">
{{ item.name }}
class="checkbox-item"
>
{{ item.roleName }}
</el-checkbox>
</el-checkbox-group>
<el-button
</el-checkbox-group>
</el-row>
<div style="display: flex; justify-content: left">
<el-button
type="success"
icon="el-icon-plus"
size="mini"
@click="handleQuery"
>保存维修员配置</el-button
>
size="small"
@click="handleSaveKeeper"
>保存库管员配置</el-button
>
</div>
</el-main>
</div> -->
</div>
</div>
<div class="section">
<el-header>维修员配置</el-header>
<el-main>
<el-row>
<el-checkbox-group
v-model="selectedValuesRepair"
class="checkbox-group"
>
<el-checkbox
v-for="item in optionsRepair"
:key="item.roleId"
:label="item.roleId"
:value="item.roleId"
:checked="item.check"
class="checkbox-item"
>
{{ item.roleName }}
</el-checkbox>
</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>
</div>
</el-tab-pane>
<!-- <el-tab-pane label="新购配置" name="second" >
<div>
@ -98,73 +110,107 @@
</template>
<script>
import { listRole, } from "@/api/system/role";
import {
getKeeperIds
} from "@/api/ma/typeConfigKeeper";
import { listRole } from "@/api/system/role";
import { getKeeperIds, updateBmConfig } from "@/api/ma/typeConfigKeeper";
export default {
name: 'siteConfig',
name: "siteConfig",
data() {
return {
activeName: 'first',
roleIdsKeeper:[],
roleIdsRepair:[],
activeName: "first",
roleIdsKeeper: [],
roleIdsRepair: [],
roleIdsRepair: [],
queryParams: {
pageNum: 1,
pageSize: 1000,
},
//
options: [],
optionsRepair: [],
// id
selectedValues: []
selectedValues: [],
selectedValuesRepair: [],
};
},
created() {
this.getList();
this.getListRepair();
},
watch: {
//
selectedValues(newValues) {
// newValues
console.log('选中的ID:', newValues);
}
},
mounted() {
//
// this.selectedValues = this.options
// .filter(item => item.check) // check true
// .map(item => (item.id));
// console.log('this.selectedValues',this.selectedValues) // id
},
// watch: {
// //
// selectedValues(newValues) {
// // newValues
// console.log("ID:", newValues);
// },
// },
methods: {
async getList(){
const itemName = 'ku_guan_role_ids'
await getKeeperIds(itemName).then((response) =>{
const roleIds = response.rows[0].itemValue.split(',').map(item => Number(item))
this.roleIdsKeeper = roleIds
})
await listRole(this.queryParams).then(response=>{
const list = response.rows
console.log('this.roleIdsKeeper',this.roleIdsKeeper)
console.log('this.list',list)
this.options=list
this.selectedValues = this.roleIdsKeeper
console.log('this.options',this.options)
})
},
handleQuery(){
console.log(this.selectedValues)
},
handleClick(tab, event) {
if(tab.name == 'first'){
// this.resetForm("queryFormOne");
// this.getList();
}else if(tab.name == 'second'){
// this.resetForm("queryForm");
// this.getboxList();
}
},
}
//
async getList() {
const itemName = "ku_guan_role_ids";
//
await getKeeperIds(itemName).then((response) => {
const roleIds = response.rows[response.rows.length - 1].itemValue
.split(",")
.map((item) => Number(item));
this.roleIdsKeeper = roleIds;
});
//
await listRole(this.queryParams).then((response) => {
const list = response.rows;
this.options = list;
this.selectedValues = this.roleIdsKeeper;
});
},
//
async getListRepair() {
const itemName = "wei_xiu_role_ids";
//
await getKeeperIds(itemName).then((response) => {
const roleIds = response.rows[response.rows.length - 1].itemValue
.split(",")
.map((item) => Number(item));
this.roleIdsRepair = roleIds;
});
//
await listRole(this.queryParams).then((response) => {
const list = response.rows;
this.optionsRepair = list;
this.selectedValuesRepair = this.roleIdsRepair;
});
},
handleSaveKeeper() {
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() {
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) {
if (tab.name == "first") {
this.getList();
this.getListRepair();
} else if (tab.name == "second") {
// this.resetForm("queryForm");
// this.getboxList();
}
},
},
};
</script>
@ -173,11 +219,12 @@ export default {
margin-bottom: 20px;
}
.el-header, .el-footer {
.el-header,
.el-footer {
background-color: #f8f8f9;
color: #333;
text-align: left;
width: 80%;
width: 100%;
line-height: 60px;
border: 1px solid #dfe6ec;
}
@ -186,7 +233,7 @@ export default {
background-color: white;
color: black;
text-align: left;
width: 80%;
width: 100%;
height: 300px;
border-radius: 2px;
border: 1px solid #dfe6ec;
@ -197,38 +244,38 @@ export default {
}
::v-deep .el-checkbox {
color: #606266;
font-weight: 200;
font-size: 2px;
position: relative;
cursor: pointer;
display: inline-block;
white-space: nowrap;
-webkit-user-select: none;
-moz-user-select: none;
-ms-user-select: none;
user-select: none;
margin-right: 30px;
margin-bottom: 2px;
margin-top: 2px;
color: #606266;
font-weight: 200;
font-size: 2px;
position: relative;
cursor: pointer;
display: inline-block;
white-space: nowrap;
-webkit-user-select: none;
-moz-user-select: none;
-ms-user-select: none;
user-select: none;
margin-right: 30px;
margin-bottom: 2px;
margin-top: 2px;
}
/* 调整checkbox的样式 */
::v-deep .checkbox-group {
display: flex;
width: 80%;
width: 100%;
flex-wrap: wrap; /* 使复选框换行 */
gap: 1px; /* 间距 */
gap: 5px; /* 间距 */
margin-top: 0px;
margin-bottom: 0px;
margin-bottom: 80px;
}
::v-deep .checkbox-item {
display: inline-block;
width: calc(10% - 1px); /* 每个复选框的宽度,去除间距 */
height: 15px;
width: calc(16% - 5px); /* 每个复选框的宽度,去除间距 */
vertical-align: top; /* 顶部对齐 */
margin-bottom: 2px;
margin-top: 2px;
margin-bottom: 0px;
margin-top: 0px;
}
</style>

View File

@ -7,7 +7,7 @@
:inline="true"
v-show="showSearch"
>
<el-form-item prop="dictLabel">
<el-form-item prop="dictLabel">
<el-input
v-model="queryParams.dictLabel"
placeholder="请输入单位类型名称"
@ -21,17 +21,14 @@
icon="el-icon-search"
size="mini"
@click="handleQuery"
>查询</el-button
>查询</el-button
>
<el-button
icon="el-icon-refresh"
size="mini"
@click="resetQuery"
>重置</el-button
<el-button icon="el-icon-refresh" size="mini" @click="resetQuery"
>重置</el-button
>
</el-form-item>
</el-form>
<el-row :gutter="10" class="mb8">
<el-row :gutter="10" class="mb8">
<el-col :span="1.5">
<el-button
type="primary"
@ -40,7 +37,7 @@
size="mini"
@click="handleAdd"
v-hasPermi="['system:role:add']"
>新增</el-button
>新增</el-button
>
</el-col>
<el-col :span="1.5">
@ -50,14 +47,14 @@
size="mini"
@click="handleExport"
v-hasPermi="['system:role:export']"
>导出数据</el-button
>导出数据</el-button
>
</el-col>
<right-toolbar
:showSearch.sync="showSearch"
@queryTable="getList"
></right-toolbar>
</el-row>
</el-row>
<el-table
v-loading="loading"
@ -65,28 +62,46 @@
border
@selection-change="handleSelectionChange"
>
<el-table-column
label="序号"
type="index"
width="100"
align="center"
>
<template slot-scope="scope">
<span>{{ (queryParams.pageNum - 1) * queryParams.pageSize + scope.$index + 1 }}</span>
</template>
</el-table-column>
<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/>
<el-table-column label="状态" align="center" prop="status" sortable>
<template slot-scope="scope">
<dict-tag :options="dict.type.sys_normal_disable" :value="scope.row.status"/>
<el-table-column label="序号" type="index" width="100" align="center">
<template slot-scope="scope">
<span>{{
(queryParams.pageNum - 1) * queryParams.pageSize + scope.$index + 1
}}</span>
</template>
</el-table-column>
<el-table-column label="备注" align="center" prop="remark" sortable/>
<el-table-column label="创建时间" align="center" prop="createTime" sortable/>
</el-table-column>
<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
/>
<el-table-column label="状态" align="center" prop="status" sortable>
<template slot-scope="scope">
<dict-tag
:options="dict.type.sys_normal_disable"
:value="scope.row.status"
/>
</template>
</el-table-column>
<el-table-column label="备注" align="center" prop="remark" sortable />
<el-table-column
label="创建时间"
align="center"
prop="createTime"
sortable
/>
<el-table-column label="操作" align="center">
<template slot-scope="scope">
@ -96,7 +111,7 @@
icon="el-icon-edit"
@click="handleUpdate(scope.row)"
v-hasPermi="['system:role:edit']"
>修改</el-button
>修改</el-button
>
<el-button
size="mini"
@ -104,13 +119,11 @@
icon="el-icon-delete"
@click="handleDelete(scope.row)"
v-hasPermi="['system:role:remove']"
>删除</el-button
>删除</el-button
>
<el-dropdown
size="mini"
@command="
(command) => handleCommand(command, scope.row)
"
@command="(command) => handleCommand(command, scope.row)"
v-hasPermi="['system:role:edit']"
>
</el-dropdown>
@ -118,15 +131,15 @@
</el-table-column>
</el-table>
<pagination
<!-- <pagination
v-show="total > 0"
:total="total"
:page.sync="queryParams.pageNum"
:limit.sync="queryParams.pageSize"
@pagination="getList"
/>
/> -->
<!-- 添加或修改参数配置对话框 -->
<!-- 添加或修改参数配置对话框 -->
<el-dialog :title="title" :visible.sync="open" width="500px" append-to-body>
<el-form ref="form" :model="form" :rules="rules" label-width="80px">
<el-form-item label="字典类型">
@ -142,7 +155,11 @@
<el-input v-model="form.cssClass" placeholder="请输入样式属性" />
</el-form-item>
<el-form-item label="显示排序" prop="dictSort">
<el-input-number v-model="form.dictSort" controls-position="right" :min="0" />
<el-input-number
v-model="form.dictSort"
controls-position="right"
:min="0"
/>
</el-form-item>
<el-form-item label="回显样式" prop="listClass">
<el-select v-model="form.listClass">
@ -160,11 +177,16 @@
v-for="dict in dict.type.sys_normal_disable"
:key="dict.value"
:label="dict.value"
>{{dict.label}}</el-radio>
>{{ dict.label }}</el-radio
>
</el-radio-group>
</el-form-item>
<el-form-item label="备注" prop="remark">
<el-input v-model="form.remark" type="textarea" placeholder="请输入内容"></el-input>
<el-input
v-model="form.remark"
type="textarea"
placeholder="请输入内容"
></el-input>
</el-form-item>
</el-form>
<div slot="footer" class="dialog-footer">
@ -173,7 +195,6 @@
</div>
</el-dialog>
<!-- 分配角色数据权限对话框 -->
<el-dialog
:title="title"
@ -190,9 +211,7 @@
<el-input v-model="form.roleKey" :disabled="true" />
</el-form-item>
<el-form-item label="权限范围">
<el-select
v-model="form.dataScope"
>
<el-select v-model="form.dataScope">
<el-option
v-for="item in dataScopeOptions"
:key="item.value"
@ -205,17 +224,17 @@
<el-checkbox
v-model="deptExpand"
@change="handleCheckedTreeExpand($event, 'dept')"
>展开/折叠</el-checkbox
>展开/折叠</el-checkbox
>
<el-checkbox
v-model="deptNodeAll"
@change="handleCheckedTreeNodeAll($event, 'dept')"
>全选/全不选</el-checkbox
>全选/全不选</el-checkbox
>
<el-checkbox
v-model="form.deptCheckStrictly"
@change="handleCheckedTreeConnect($event, 'dept')"
>父子联动</el-checkbox
>父子联动</el-checkbox
>
<el-tree
class="tree-border"
@ -231,9 +250,7 @@
</el-form-item>
</el-form>
<div slot="footer" class="dialog-footer">
<el-button type="primary" @click="submitDataScope"
> </el-button
>
<el-button type="primary" @click="submitDataScope"> </el-button>
<el-button @click="cancelDataScope"> </el-button>
</div>
</el-dialog>
@ -241,20 +258,23 @@
</template>
<script>
import { unitTypeList, statusUnitType } from "@/api/basic/basic";
import {
unitTypeList,
statusUnitType,
} from '@/api/basic/basic'
import { listData, getData, delData, addData, updateData } from "@/api/system/dict/data";
listData,
getData,
delData,
addData,
updateData,
} from "@/api/system/dict/data";
export default {
name: 'unitType',
dicts: ['sys_normal_disable'],
name: "unitType",
dicts: ["sys_normal_disable"],
data() {
return {
deptExpand:undefined,
deptNodeAll:undefined,
deptOptions:[],
defaultProps:undefined,
deptExpand: undefined,
deptNodeAll: undefined,
deptOptions: [],
defaultProps: undefined,
isLoading: false,
//
loading: true,
@ -271,153 +291,154 @@ export default {
//
typeList: [],
//
title: '',
typeId:'',
title: "",
typeId: "",
//
openDataScope:false,
dataScopeOptions:[],
openDataScope: false,
dataScopeOptions: [],
open: false,
//
dateRange: [],
//
queryParams: {
pageNum: 1,
pageSize: 10,
dictType: 'bm_unit_type',
dictLabel:undefined,
pageSize: 1000,
dictType: "bm_unit_type",
dictLabel: undefined,
},
//
form: {
pId: '1',
pId: "1",
typeName: undefined,
typeId:undefined
typeId: undefined,
},
//
//
rules: {
dictLabel: [
{ required: true, message: "数据标签不能为空", trigger: "blur" }
{ required: true, message: "数据标签不能为空", trigger: "blur" },
],
dictValue: [
{ required: true, message: "数据键值不能为空", trigger: "blur" }
{ required: true, message: "数据键值不能为空", trigger: "blur" },
],
dictSort: [
{ required: true, message: "数据顺序不能为空", trigger: "blur" }
]
{ required: true, message: "数据顺序不能为空", trigger: "blur" },
],
},
roleList:[],
//
roleList: [],
//
listClassOptions: [
{
value: "default",
label: "默认"
label: "默认",
},
{
value: "primary",
label: "主要"
label: "主要",
},
{
value: "success",
label: "成功"
label: "成功",
},
{
value: "info",
label: "信息"
label: "信息",
},
{
value: "warning",
label: "警告"
label: "警告",
},
{
value: "danger",
label: "危险"
}
label: "危险",
},
],
}
};
},
created() {
this.getList()
this.getList();
},
methods: {
/** 查询字典类型列表 */
getList() {
this.loading = true
this.loading = true;
unitTypeList(this.queryParams).then((response) => {
this.roleList = response.rows
this.total = response.total
this.loading = false
})
},
submitDataScope(){
},
cancelDataScope(){
this.roleList = response.rows;
this.total = response.total;
this.loading = false;
});
},
submitDataScope() {},
cancelDataScope() {},
//
cancel() {
this.open = false
this.reset()
this.open = false;
this.reset();
},
//
reset() {
this.form = {
// pId: '1',
status: '0',
status: "0",
// name: undefined,
}
this.resetForm('form')
};
this.resetForm("form");
},
/** 搜索按钮操作 */
handleQuery() {
this.queryParams.pageNum = 1
this.getList()
this.queryParams.pageNum = 1;
this.getList();
},
/** 重置按钮操作 */
resetQuery() {
this.dateRange = []
this.resetForm('queryForm')
this.handleQuery()
this.dateRange = [];
this.resetForm("queryForm");
this.handleQuery();
},
/** 新增按钮操作 */
handleAdd() {
this.reset();
this.open = true;
this.title = "添加单位类型";
this.form.dictType = 'bm_unit_type';
this.form.dictType = "bm_unit_type";
},
//
handleSelectionChange(selection) {
this.ids = selection.map((item) => item.id)
this.single = selection.length != 1
this.multiple = !selection.length
this.ids = selection.map((item) => item.id);
this.single = selection.length != 1;
this.multiple = !selection.length;
},
/** 修改按钮操作 */
handleUpdate(row) {
this.reset();
const dictCode = row.dictCode || this.ids
getData(dictCode).then(response => {
const dictCode = row.dictCode || this.ids;
getData(dictCode).then((response) => {
this.form = response.data;
this.open = true;
this.title = "修改单位类型";
});
},
/** 提交按钮 */
submitForm: function() {
this.$refs["form"].validate(valid => {
/** 提交按钮 */
submitForm: function () {
this.$refs["form"].validate((valid) => {
if (valid) {
if (this.form.dictCode != undefined) {
updateData(this.form).then(response => {
this.$store.dispatch('dict/removeDict', this.queryParams.dictType);
updateData(this.form).then((response) => {
this.$store.dispatch(
"dict/removeDict",
this.queryParams.dictType
);
this.$modal.msgSuccess("修改成功");
this.open = false;
this.getList();
});
} else {
addData(this.form).then(response => {
this.$store.dispatch('dict/removeDict', this.queryParams.dictType);
addData(this.form).then((response) => {
this.$store.dispatch(
"dict/removeDict",
this.queryParams.dictType
);
this.$modal.msgSuccess("新增成功");
this.open = false;
this.getList();
@ -430,34 +451,38 @@ export default {
let param = {
id: row.id,
status: row.status,
}
};
statusUnitType(param).then((response) => {
this.getList()
})
this.getList();
});
},
/** 删除按钮操作 */
handleDelete(row) {
const dictCodes = row.dictCode || this.ids;
this.$modal.confirm('是否确认删除字典编码为"' + dictCodes + '"的数据项?').then(function() {
return delData(dictCodes);
}).then(() => {
this.getList();
this.$modal.msgSuccess("删除成功");
this.$store.dispatch('dict/removeDict', this.queryParams.dictType);
}).catch(() => {});
this.$modal
.confirm('是否确认删除字典编码为"' + dictCodes + '"的数据项?')
.then(function () {
return delData(dictCodes);
})
.then(() => {
this.getList();
this.$modal.msgSuccess("删除成功");
this.$store.dispatch("dict/removeDict", this.queryParams.dictType);
})
.catch(() => {});
},
/** 导出按钮操作 */
handleExport() {
this.download(
'/material/base/dic/export',
"/material/base/dic/export",
{
...this.queryParams,
dataCondition: this.ids,
},
`单位类型_${new Date().getTime()}.xlsx`,
)
`单位类型_${new Date().getTime()}.xlsx`
);
},
},
}
};
</script>

File diff suppressed because it is too large Load Diff

View File

@ -16,7 +16,7 @@
/>
</div>
<div class="head-container" style>
<div class="grid-content bg-purple-dark" align="left">组织人员树</div>
<div class="grid-content bg-purple-dark" align="left">组织人员树</div>
<el-tree
style="height: 700px; overflow: scroll"
:data="treeOptions"
@ -47,7 +47,7 @@
/>
</div>
<div class="head-container" style>
<div class="grid-content bg-purple-dark" align="left">物资类型树</div>
<div class="grid-content bg-purple-dark" align="left">物资类型树</div>
<el-tree
style="height: 700px; overflow: scroll"
:data="treeOptionsTwo"
@ -142,9 +142,9 @@
ref="multipleTable"
row-key="typeId"
default-expand-all
:tree-props="{children: 'children', hasChildren: 'hasChildren'}"
:tree-props="{ children: 'children', hasChildren: 'hasChildren' }"
@selection-change="handleSelectionChange"
@select="handlerSelect"
@select="handlerSelect"
@select-all="handlerSelectAll"
>
<el-table-column
@ -167,30 +167,30 @@
align="center"
show-overflow-tooltip
prop="itemType"
>
</el-table-column>
>
</el-table-column>
<el-table-column
label="物资类型"
align="center"
show-overflow-tooltip
width="100"
prop="materialType"
>
</el-table-column>
>
</el-table-column>
<el-table-column
label="物资名称"
align="center"
show-overflow-tooltip
prop="materialName"
>
</el-table-column>
>
</el-table-column>
<el-table-column
label="规格型号"
align="center"
show-overflow-tooltip
prop="typeName"
>
</el-table-column>
>
</el-table-column>
<el-table-column
label="库管员"
align="center"
@ -222,13 +222,13 @@
</el-table-column>
</el-table>
<pagination
v-show="total>0"
:total="total"
:page.sync="queryParams.pageNum"
:limit.sync="queryParams.pageSize"
@pagination="getList"
/>
<pagination
v-show="total > 0"
:total="total"
:page.sync="queryParams.pageNum"
:limit.sync="queryParams.pageSize"
@pagination="getList"
/>
</el-col>
</el-row>
</div>
@ -248,7 +248,7 @@ import {
import {
bindKeeper,
noBindKeeper,
getKeeperIds
getKeeperIds,
} from "@/api/ma/typeConfigKeeper";
import { getUserList } from "@/api/basic/basic";
import { getInfo } from "@/api/login";
@ -270,9 +270,9 @@ export default {
showSearch: true,
//
total: 0,
totalTemp:0,
totalTemp: 0,
countTemp: 1,
totalAll:0,
totalAll: 0,
//
keeperList: null,
keeperDataRange: [],
@ -318,20 +318,20 @@ export default {
children: "children",
label: "label",
},
roleIdsTemp:[],
userList:[],
userNoList:[],
roleIdsTemp: [],
userList: [],
userNoList: [],
userIdTemp: -1,
typeIdTemp: -1,
maxLength:100,//
maxLength: 100, //
//
queryParams: {
typeName: "",
level: 0,
pageNum: 1,
pageSize: 10,
displayBindRelationship:true,
houseId:"",
displayBindRelationship: true,
houseId: "",
// phonenumber: undefined,
// status: undefined,
// typeId: undefined
@ -343,8 +343,8 @@ export default {
afterPrice: "",
useDate: "",
},
isAllSelect:false,
selectionRows:[],
isAllSelect: false,
selectionRows: [],
};
},
// mounted(){
@ -362,13 +362,12 @@ export default {
},
created() {
// this.getInfo()
this.getTreeData();
this.getTreeDataTwo();
this.getTreeData();
this.getTreeDataTwo();
// this.getKeeperDataList();
// setTimeout(()=>{
// this.getList();
// },200)
},
methods: {
// getInfo() {
@ -377,22 +376,22 @@ 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);
}
},
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 = '';
renderConent(h, { node }) {
let iconClass = "";
// node
if (node.data.level == 99) {
iconClass = 'el-icon-user-solid';
}
iconClass = "el-icon-user-solid";
}
// else if (node.type === 'file') {
// iconClass = 'el-icon-document';
// }
@ -402,10 +401,8 @@ export default {
<i class={iconClass}></i> {node.label}
</span>
);
},
/** 查询物资类型 */
async getKeeperDataList(data) {
let keepdataRes = await queryKeeperDataApi({
@ -444,40 +441,44 @@ export default {
this.form.keeperDataPro = this.keeperProRange.value;
},
/** 查询新增页面-上级类型下拉树结构 */
async getTreeData() {;
const itemName = 'ku_guan_role_ids'
await getKeeperIds(itemName).then((response) =>{
const roleIds = response.rows[0].itemValue.split(',').map(item => Number(item))
this.roleIdsTemp = roleIds
})
await getUserList({ roleIds: this.roleIdsTemp}).then(response => {
this.treeOptions = response.data
async getTreeData() {
const itemName = "ku_guan_role_ids";
await getKeeperIds(itemName).then((response) => {
const roleIds = response.rows[response.rows.length - 1].itemValue
.split(",")
.map((item) => Number(item));
this.roleIdsTemp = roleIds;
});
await getUserList({ roleIds: this.roleIdsTemp }).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();
}
})
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();
}
});
},
/** 查询列表 */
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
})
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) {
@ -493,22 +494,22 @@ export default {
},
// -
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()
},
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() {
@ -545,108 +546,131 @@ export default {
this.handleQuery();
},
//
handleSelectionChange(selection) {
this.userList=[];
this.userNoList=[];
this.selectionRows = selection,
this.ids = selection.map((item) =>item.typeId);
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.keeperUserId!=null){
this.userNoList.push({'typeId':item.typeId,'userId':item.keeperUserId})
selection.forEach((item) => {
this.userList.push({ typeId: item.typeId, userId: this.userIdTemp });
});
selection.forEach((item) => {
if (item.keeperUserId != null) {
this.userNoList.push({
typeId: item.typeId,
userId: item.keeperUserId,
});
}
})
});
this.single = selection.length != 1;
this.multiple = !selection.length;
},
//-
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.keeperUserId})
}else if(indexNo!== -1){
this.userNoList.splice(indexNo,1);
}
},
//-
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.keeperUserId });
} else if (indexNo !== -1) {
this.userNoList.splice(indexNo, 1);
}
},
//-
handlerSelectAll(val) {
if (val.length) {
// :
// 1 2
//
// tableDatavalcurrentSelection
// tableDatavalcurrentSelection
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)
)
}
//-
handlerSelectAll(val) {
if (val.length) {
// :
// 1 2
//
// tableDatavalcurrentSelection
// tableDatavalcurrentSelection
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.userNoList = []
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 = [];
}
},
// handleSelect(selection, row) {
// this.toggleSelection(selection, row);
// },
@ -654,57 +678,55 @@ export default {
// 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');
// });
// },
// //
// selectTr(selection,row){
// this.$set(row,'isChecked',!row.isChecked);
// this.$nextTick(()=>{
// this.isAllSelect = row.isChecked;
// this.toggleSelect(row,row.isChecked,'tr');
// });
// },
// //
// 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);
// })
// }
// }
// },
// //
// toggleSelection(row, flag) {
// this.$set(row,'isChecked',flag);
// this.$nextTick(()=>{
// if (flag) {
// this.$refs.multipleTable.toggleRowSelection(row, flag);
// } else {
// this.$refs.multipleTable.clearSelection();
// }
// });
// },
// //
// 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);
// })
// }
// }
// },
// //
// 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)
console.log("ids----", this.ids);
if (this.userIdTemp == -1) {
this.$alert("未勾选绑定人,无法绑定", "提示", {
type: "warning",
@ -712,21 +734,21 @@ export default {
});
return;
}
if (this.ids.length == 0) {
this.$alert("未进行勾选相关物资,无法绑定", "提示", {
type: "warning",
confirmButtonText: "确定",
});
return;
} else {
const ids = this.ids.join(",");
}
console.log('userList',this.userList)
if (this.ids.length == 0) {
this.$alert("未进行勾选相关物资,无法绑定", "提示", {
type: "warning",
confirmButtonText: "确定",
});
return;
} else {
const ids = this.ids.join(",");
}
console.log("userList", this.userList);
bindKeeper(this.userList).then((response) => {
this.$modal.msgSuccess("绑定成功");
this.ids = null;
this.userList = null;
this.userIdTemp = -1
this.userIdTemp = -1;
this.getTreeData();
this.getList();
this.$refs.multipleTable.clearSelection();
@ -741,16 +763,16 @@ export default {
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();
});
} 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();
});
}
},
/** 修改按钮操作 */
@ -773,7 +795,7 @@ export default {
userTwo.push({
typeId: typeId,
userId: userId,
})
});
noBindKeeper(userTwo).then((response) => {
this.$modal.msgSuccess("解绑成功");
this.getList();
@ -822,8 +844,8 @@ export default {
/** 导出按钮操作 */
handleExport() {
let queryTemp = this.queryParams;
queryTemp.level = 0;
let queryTemp = this.queryParams;
queryTemp.level = 0;
this.download(
"/material/ma_type/export4Keeper",
{
@ -832,7 +854,6 @@ export default {
`物资类型信息_${new Date().getTime()}.xlsx`
);
},
},
};
</script>
@ -854,11 +875,11 @@ export default {
}
}
.grid-content {
border-radius: 4px;
min-height: 24px;
border-radius: 4px;
min-height: 24px;
}
.bg-purple-dark {
background: #e5e9f2;
background: #e5e9f2;
}
::v-deep .el-tree .el-tree-node__expand-icon.expanded {

View File

@ -16,7 +16,7 @@
/>
</div>
<div class="head-container" style>
<div class="grid-content bg-purple-dark" align="left">组织人员树</div>
<div class="grid-content bg-purple-dark" align="left">组织人员树</div>
<el-tree
style="height: 700px; overflow: scroll"
:data="treeOptions"
@ -47,7 +47,7 @@
/>
</div>
<div class="head-container" style>
<div class="grid-content bg-purple-dark" align="left">物资类型树</div>
<div class="grid-content bg-purple-dark" align="left">物资类型树</div>
<el-tree
style="height: 700px; overflow: scroll"
:data="treeOptionsTwo"
@ -142,9 +142,9 @@
ref="multipleTable"
row-key="typeId"
default-expand-all
:tree-props="{children: 'children', hasChildren: 'hasChildren'}"
:tree-props="{ children: 'children', hasChildren: 'hasChildren' }"
@selection-change="handleSelectionChange"
@select="handlerSelect"
@select="handlerSelect"
@select-all="handlerSelectAll"
>
<el-table-column
@ -167,30 +167,30 @@
align="center"
show-overflow-tooltip
prop="itemType"
>
</el-table-column>
>
</el-table-column>
<el-table-column
label="物资类型"
align="center"
show-overflow-tooltip
width="100"
prop="materialType"
>
</el-table-column>
>
</el-table-column>
<el-table-column
label="物资名称"
align="center"
show-overflow-tooltip
prop="materialName"
>
</el-table-column>
>
</el-table-column>
<el-table-column
label="规格型号"
align="center"
show-overflow-tooltip
prop="typeName"
>
</el-table-column>
>
</el-table-column>
<el-table-column
label="维修员"
align="center"
@ -222,13 +222,13 @@
</el-table-column>
</el-table>
<pagination
v-show="total>0"
:total="total"
:page.sync="queryParams.pageNum"
:limit.sync="queryParams.pageSize"
@pagination="getList"
/>
<pagination
v-show="total > 0"
:total="total"
:page.sync="queryParams.pageNum"
:limit.sync="queryParams.pageSize"
@pagination="getList"
/>
</el-col>
</el-row>
</div>
@ -248,7 +248,7 @@ import {
import {
bindKeeper,
noBindKeeper,
getRepairIds
getRepairIds,
} from "@/api/ma/typeConfigRepair";
import { getUserList } from "@/api/basic/basic";
import { getInfo } from "@/api/login";
@ -270,16 +270,16 @@ export default {
showSearch: true,
//
total: 0,
totalTemp:0,
totalTemp: 0,
countTemp: 1,
totalAll:0,
totalAll: 0,
//
keeperList: null,
keeperDataRange: [],
keeperProRange: [],
keeperMatRange: [],
keeperNameRange: [],
roleIdsTemp:[],
roleIdsTemp: [],
//
repairUserList: null,
//
@ -319,20 +319,19 @@ export default {
children: "children",
label: "label",
},
userList:[],
userNoList:[],
userList: [],
userNoList: [],
userIdTemp: -1,
typeIdTemp: -1,
maxLength:100,//
maxLength: 100, //
//
queryParams: {
typeName: "",
level: 0,
pageNum: 1,
pageSize: 10,
displayBindRelationship:true,
houseId:"",
displayBindRelationship: true,
houseId: "",
},
configOpen: false,
@ -341,8 +340,8 @@ export default {
afterPrice: "",
useDate: "",
},
isAllSelect:false,
selectionRows:[],
isAllSelect: false,
selectionRows: [],
};
},
// mounted(){
@ -359,32 +358,30 @@ export default {
},
},
created() {
this.getTreeData();
this.getTreeDataTwo();
this.getTreeData();
this.getTreeDataTwo();
// this.getKeeperDataList();
// setTimeout(()=>{
// this.getList();
// },200)
},
methods: {
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);
}
},
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 = '';
renderConent(h, { node }) {
let iconClass = "";
// node
if (node.data.level == 99) {
iconClass = 'el-icon-user-solid';
}
iconClass = "el-icon-user-solid";
}
// else if (node.type === 'file') {
// iconClass = 'el-icon-document';
// }
@ -394,43 +391,46 @@ export default {
<i class={iconClass}></i> {node.label}
</span>
);
},
/** 查询新增页面-上级类型下拉树结构 */
async getTreeData() {
const itemName = 'wei_xiu_role_ids'
await getRepairIds(itemName).then((response) =>{
const roleIds = response.rows[0].itemValue.split(',').map(item => Number(item))
this.roleIdsTemp = roleIds
})
await getUserList({ roleIds: this.roleIdsTemp}).then(response => {
this.treeOptions = response.data
async getTreeData() {
const itemName = "wei_xiu_role_ids";
await getRepairIds(itemName).then((response) => {
const roleIds = response.rows[response.rows.length - 1].itemValue
.split(",")
.map((item) => Number(item));
this.roleIdsTemp = roleIds;
});
await getUserList({ roleIds: this.roleIdsTemp }).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();
}
})
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();
}
});
},
/** 查询列表 */
async getList() {
this.loading = true
this.queryParams.displayBindRelationship="true";
await getListByMaType(this.queryParams).then((response) => {
this.typeList = response.data.rows
this.total = response.data.total
this.loading = false
})
async getList() {
this.loading = true;
this.queryParams.displayBindRelationship = "true";
await getListByMaType(this.queryParams).then((response) => {
this.typeList = response.data.rows;
this.total = response.data.total;
this.loading = false;
});
},
// -
filterNode(value, data) {
@ -446,22 +446,22 @@ export default {
},
// -
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()
},
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() {
@ -498,108 +498,131 @@ export default {
this.handleQuery();
},
//
handleSelectionChange(selection) {
this.userList=[];
this.userNoList=[];
this.selectionRows = selection,
this.ids = selection.map((item) =>item.typeId);
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})
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;
},
//-
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);
}
},
//-
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);
}
},
//-
handlerSelectAll(val) {
if (val.length) {
// :
// 1 2
//
// tableDatavalcurrentSelection
// tableDatavalcurrentSelection
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)
)
}
//-
handlerSelectAll(val) {
if (val.length) {
// :
// 1 2
//
// tableDatavalcurrentSelection
// tableDatavalcurrentSelection
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.userNoList = []
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 = [];
}
},
/** 绑定按钮操作 */
handleBind() {
@ -610,20 +633,20 @@ export default {
});
return;
}
if (this.ids.length == 0) {
this.$alert("未进行勾选相关物资,无法绑定", "提示", {
type: "warning",
confirmButtonText: "确定",
});
return;
} else {
const ids = this.ids.join(",");
}
if (this.ids.length == 0) {
this.$alert("未进行勾选相关物资,无法绑定", "提示", {
type: "warning",
confirmButtonText: "确定",
});
return;
} else {
const ids = this.ids.join(",");
}
bindKeeper(this.userList).then((response) => {
this.$modal.msgSuccess("绑定成功");
this.ids = null;
this.userList = null;
this.userIdTemp = -1
this.userIdTemp = -1;
this.getTreeData();
this.getList();
this.$refs.multipleTable.clearSelection();
@ -638,16 +661,16 @@ export default {
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();
});
} 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();
});
}
},
/** 修改按钮操作 */
@ -670,7 +693,7 @@ export default {
userTwo.push({
typeId: typeId,
userId: userId,
})
});
noBindKeeper(userTwo).then((response) => {
this.$modal.msgSuccess("解绑成功");
this.getList();
@ -680,7 +703,7 @@ export default {
/** 导出按钮操作 */
handleExport() {
let queryTemp = this.queryParams;
queryTemp.level = 0;
queryTemp.level = 0;
this.download(
"/material/ma_type/export4Repair",
{
@ -689,7 +712,6 @@ export default {
`物资类型信息_${new Date().getTime()}.xlsx`
);
},
},
};
</script>
@ -711,11 +733,11 @@ export default {
}
}
.grid-content {
border-radius: 4px;
min-height: 24px;
border-radius: 4px;
min-height: 24px;
}
.bg-purple-dark {
background: #e5e9f2;
background: #e5e9f2;
}
::v-deep .el-tree .el-tree-node__expand-icon.expanded {