物资管理整体框架

This commit is contained in:
jjLv 2024-10-25 12:54:20 +08:00
parent ff383c5754
commit 7f53d4a40d
4 changed files with 1421 additions and 0 deletions

57
src/api/ma/partType.js Normal file
View File

@ -0,0 +1,57 @@
import request from '@/utils/request'
//机具类型管理列表信息
export function getListAccessory(query) {
return request({
url: '/material/ma_part_type/list',
method: 'get',
params: query,
})
}
//机具类型管理列表信息
export function getListTree(query) {
return request({
url: '/material/ma_part_type/getPartTree',
method: 'get',
params: query,
})
}
//查看机具类型管理列表详细信息
export function getAccessoryDetail(id) {
return request({
url: '/material/ma_part_type/'+ id,
method: 'get',
})
}
// 仓库管理--删除
export function delAccessory(id) {
return request({
url: '/material/ma_part_type/' + id,
method: 'delete',
})
}
// 仓库管理--修改
export function editAccessory(data) {
return request({
url: '/material/ma_part_type',
method: 'put',
data: data,
})
}
// 仓库管理--新增
export function addAccessory(data) {
return request({
url: '/material/ma_part_type',
method: 'post',
data: data,
})
}

28
src/api/ma/typeConfig.js Normal file
View File

@ -0,0 +1,28 @@
import request from '@/utils/request'
//组织人员树类型管理
export function getMatConfigList(query) {
return request({
url: '/material/ma_type_config/getDeptUserTree',
method: 'get',
params: query,
})
}
//组织人员树类型管理列表
export function getListByMatConfig(query) {
return request({
url: '/material/ma_type_config/getMaTypeConfigList',
method: 'get',
params: query,
})
}
// 物资类型管理--新增
export function bindRepair(data) {
return request({
url: '/material/ma_type_config/updateMaTypeBindInfo',
method: 'post',
data: data,
})
}

View File

@ -0,0 +1,445 @@
<template>
<div class="app-container">
<el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="68px">
<el-form-item prop="keyWord">
<el-input
v-model="queryParams.keyWord"
placeholder="请输入关键词"
clearable
@keyup.enter.native="handleQuery"
maxlength="20"
/>
</el-form-item>
<el-form-item>
<el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</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-col :span="1.5">
<el-button
type="primary"
plain
icon="el-icon-plus"
size="mini"
@click="handleAdd"
v-hasPermi="['machinery:type:add']"
>新增</el-button
>
</el-col>
<el-col :span="1.5">
<el-button
type="warning"
plain
icon="el-icon-download"
size="mini"
@click="handleExport"
>导出
</el-button>
</el-col>
<right-toolbar
:showSearch.sync="showSearch"
@queryTable="getList"
></right-toolbar>
</el-row>
<el-table
v-loading="loading"
:data="typeList"
ref="multipleTable"
row-key="id"
default-expand-all
:tree-props="{ children: 'children' }"
border
>
<el-table-column label="序号" align="center" width="80" type="index">
<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="label"
show-overflow-tooltip
/>
<el-table-column
label="计量单位"
align="center"
prop="unitName"
show-overflow-tooltip
/>
<el-table-column
label="购置价格(元)"
align="center"
prop="buyPrice"
show-overflow-tooltip
width="100"
/>
<el-table-column
label="数量"
align="center"
prop="storageNum"
show-overflow-tooltip
/>
<el-table-column
label="备注信息"
align="center"
prop="remark"
show-overflow-tooltip
/>
<el-table-column label="操作" align="center" width="300">
<template slot-scope="scope">
<el-button
size="mini"
type="primary"
icon="el-icon-edit"
@click="handleUpdate(scope.row)"
v-hasPermi="['machinery:type:edit']"
v-if="scope.row.level==3 || scope.row.level==2"
>
修改
</el-button>
<el-button
size="mini"
type="warning"
icon="el-icon-delete-solid"
@click="handleDelete(scope.row)"
v-hasPermi="['machinery:type:edit']"
v-if="scope.row.level==3 || scope.row.level==2"
>
删除
</el-button>
<!-- <el-button
size="mini"
type="text"
icon="el-icon-delete"
@click="handleDelete(scope.row)"
v-hasPermi="['machinery:type:del']"
>
删除
</el-button> -->
</template>
</el-table-column>
</el-table>
<!-- <pagination
v-show="total>0"
:total="total"
:page.sync="queryParams.pageNum"
:limit.sync="queryParams.pageSize"
@pagination="getList"
/> -->
<!-- 新增或修改弹窗 -->
<el-dialog :title="title" :visible.sync="showHouse" width="600px" append-to-body>
<el-form ref="form" :model="form" :rules="rules" label-width="120px" >
<el-row :gutter="24">
<el-col :span="20">
<el-form-item label="所属上级" prop="parentId">
<treeselect
v-model="form.parentId"
:options="treeList"
:normalizer="normalizer"
:show-count="true"
:searchable="false"
:disable-branch-nodes="false"
placeholder="选择上级菜单"
@select="onSelect"
/>
</el-form-item>
</el-col>
</el-row>
<el-row :gutter="24">
<el-col :span="20">
<el-form-item label="名称" prop="label">
<el-input v-model="form.paName" placeholder="请输入名称" maxlength="20">
</el-input>
</el-form-item>
</el-col>
</el-row>
<el-row :gutter="24">
<el-col :span="20">
<el-form-item label="计量单位" prop="unitName">
<el-input v-model="form.unitName" placeholder="请输入计量单位" maxlength="20">
</el-input>
</el-form-item>
</el-col>
</el-row>
<el-row :gutter="24">
<el-col :span="20">
<el-form-item label="购置价格(元)" prop="buyPrice">
<el-input v-model="form.buyPrice" placeholder="请输入购置价格" maxlength="20" type="number">
</el-input>
</el-form-item>
</el-col>
</el-row>
<el-row :gutter="24">
<el-col :span="20">
<el-form-item label="备注" prop="remark">
<el-input
type="textarea"
:rows="5"
placeholder="请输入备注"
v-model="form.remark"
maxlength="50"
show-word-limit
>
</el-input>
</el-form-item>
</el-col>
</el-row>
</el-form>
<div slot="footer" class="dialog-footer">
<el-button type="primary" @click="submitForm"> </el-button>
<el-button @click="cancel"> </el-button>
</div>
</el-dialog>
</div>
</template>
<script>
import { getListAccessory,getListTree,getAccessoryDetail,addAccessory,editAccessory,delAccessory, } from "@/api/ma/partType";
import Treeselect from "@riophae/vue-treeselect";
import "@riophae/vue-treeselect/dist/vue-treeselect.css";
import IconSelect from "@/components/IconSelect";
import { downloadFile } from '@/utils/download'
export default {
name: "partType",
components: { Treeselect },
data() {
return {
//
loading: false,
loadingTwo: false,
// Id
showName: false,
//
showWarn: false,
//
single: true,
//
multiple: true,
//
showSearch: true,
showHouse: false,
//
typeList: undefined,
treeList:[],
flagTemp:1,
//
total: 0,
totalTwo : 0,
//
houseList: [],
maxLength:100,//
keeperDataRange:[],
//
teamList: [],
teamTempList: [],
//
title: "",
//
open: false,
//
queryParams: {
pageNum: 1,
pageSize: 10,
keyWord:undefined
},
//
form: {},
//
rules: {
paName: [
{
required: true,
message: '名称不能为空',
trigger: 'blur',
},
],
},
};
},
created() {
this.getList();
},
methods: {
/** 查询岗位列表 */
getList() {
this.loading = true;
getListAccessory(this.queryParams).then(response => {
this.typeList = response.data;
this.loading = false;
});
},
/** 新增按钮操作 */
handleAdd() {
this.flagTemp=1;
this.reset()
this.getTreeselect();
this.form.id = 0;
this.showHouse = true
this.title = '新增'
},
getTreeselect(){
getListTree().then(response=>{
this.treeList = response.data;
const menu = { id: 0, label: '配件类型', children: this.treeList };
this.treeList=[],
this.treeList.push(menu)
});
},
/** 转换菜单数据结构 */
normalizer(node) {
if (node.children && !node.children.length) {
delete node.children;
}
return {
id: node.id,
label: node.label,
children: node.children
};
},
handleUpdate(row){
this.flagTemp=2;
this.reset()
this.getTreeselect();
const id = row.id
getAccessoryDetail(id).then((response) => {
this.form = response.data;
this.showHouse = true
this.title = '修改'
})
},
//
reset() {
this.form = {};
this.resetForm("form");
},
/** 重置按钮操作 */
resetQuery() {
this.resetForm("queryForm");
this.queryParams.keyWord=null;
this.handleQuery();
},
//** */
submitForm() {
this.$refs["form"].validate(valid => {
if (valid) {
console.log(this.form)
if (this.flagTemp==2) {
console.log('修改')
editAccessory(this.form).then(response => {
this.$modal.msgSuccess("修改成功");
this.showHouse = false;
this.getList();
});
} else if(this.flagTemp==1){
console.log('新增')
console.log('this.form')
addAccessory(this.form).then(response => {
this.$modal.msgSuccess("新增成功");
this.showHouse = false;
this.getList();
});
}
}
});
},
//
cancel() {
this.showHouse = false;
this.reset();
},
/** 删除按钮操作 */
handleDelete(row) {
const id = row.id
this.$modal
.confirm('是否确认删除数据项?')
.then(function () {
return delAccessory(id)
})
.then(() => {
this.$modal.msgSuccess('删除成功')
this.getList()
})
.catch(() => {})
},
handleExport() {
this.download('/material/ma_part_type/export', {
...this.queryParams
}, `仓库管理_${new Date().getTime()}.xlsx`)
},
/** 搜索按钮操作 */
handleQuery() {
this.queryParams.pageNum = 1;
this.getList();
},
onSelect(e) {
console.log('eeeee',e)
this.form.id = e.id;
this.form.level = e.level
}
}
};
</script>
<style lang="scss" scoped>
.uploadImg {
padding-top: 20px;
display: flex;
align-items: center;
justify-content: center;
}
.deviceCode {
margin-top: 10px;
padding-bottom: 20px;
font-size: 18px;
}
::v-deep.el-table .fixed-width .el-button--mini {
width: 60px !important;
margin-bottom: 10px;
}
//css
::v-deep.disabled {
.el-upload--picture-card {
display: none;
}
}
</style>

View File

@ -0,0 +1,891 @@
<template>
<!-- 类型管理 -->
<div class="app-container" id="toolsType">
<el-row :gutter="20">
<!--树数据-->
<el-col :span="5" :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>
<el-tree
style="height: 700px; overflow: scroll"
:data="treeOptions"
:props="defaultProps"
:expand-on-click-node="false"
:filter-node-method="filterNode"
ref="tree"
node-key="id"
default-expand-all
highlight-current
@node-click="handleNodeClick"
>
</el-tree>
</div>
</el-col>
<!--用户数据-->
<el-col :span="19" :xs="24">
<el-form
:model="queryParams"
ref="queryForm"
size="small"
:inline="true"
v-show="showSearch"
label-width="68px"
>
<el-form-item label="关键字" prop="typeName">
<el-input
v-model="queryParams.typeName"
placeholder="请输入关键字"
clearable
style="width: 240px"
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item>
<el-button
type="primary"
icon="el-icon-search"
size="mini"
@click="handleQuery"
>查询</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-col :span="1.5">
<el-button
type="primary"
plain
icon="el-icon-plus"
size="mini"
@click="handleBind"
v-hasPermi="['machinery:type:add']"
>绑定</el-button
>
</el-col>
<el-col :span="1.5">
<el-button
type="warning"
plain
icon="el-icon-minus"
size="mini"
@click="handleNoBind"
v-hasPermi="['machinery:type:add']"
>解绑</el-button
>
</el-col>
<el-col :span="1.5">
<el-button
type="warning"
plain
icon="el-icon-download"
size="mini"
@click="handleExport"
>导出
</el-button>
</el-col>
<right-toolbar
:showSearch.sync="showSearch"
@queryTable="getList"
></right-toolbar>
</el-row>
<el-table
v-loading="loading"
:data="typeList"
ref="multipleTable"
row-key="typeId"
default-expand-all
:tree-props="{ children: 'children' }"
border
@selection-change="handleSelectionChange"
@select="handleSelect"
@select-all="handleSelectAll"
>
<el-table-column
type="selection"
width="55"
align="center"
:reserve-selection="true"
/>
<el-table-column label="序号" align="center" width="80" type="index">
<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="parentOneLevelName"
show-overflow-tooltip
/>
<el-table-column
label="施工类型"
align="center"
prop="parentFourLevelName"
show-overflow-tooltip
/>
<el-table-column
label="物资类型"
align="center"
prop="parentThreeLevelName"
show-overflow-tooltip
width="100"
/>
<el-table-column
label="物资名称"
align="center"
prop="parentTwoLevelName"
show-overflow-tooltip
/>
<el-table-column
label="规格型号"
align="center"
prop="parentThreeLevelName"
show-overflow-tooltip
/>
<el-table-column
label="库管员"
align="center"
prop="keeperUserName"
show-overflow-tooltip
>
<template slot-scope="scope">
<div v-if="scope.row.keeperUserName == null" style="color: red">
{{ "请绑定" }}
</div>
<div v-else>
{{ scope.row.keeperUserName }}
</div>
<!-- <div v-else style="color: red;"></div> -->
</template>
</el-table-column>
<el-table-column
label="维修员"
align="center"
prop="repairUserName"
show-overflow-tooltip
>
<template slot-scope="scope">
<div v-if="scope.row.repairUserName == null" style="color: red">
{{ "请绑定" }}
</div>
<div v-else>
{{ scope.row.repairUserName }}
</div>
<!-- <div v-else style="color: red;"></div> -->
</template>
</el-table-column>
<el-table-column label="操作" align="center" width="300">
<template slot-scope="scope">
<el-button
size="mini"
type="warning"
icon="el-icon-user-solid"
@click="handleUpdateKeep(scope.row)"
v-hasPermi="['machinery:type:config']"
>
库管解绑
</el-button>
<el-button
size="mini"
type="warning"
icon="el-icon-user-solid"
@click="handleUpdate(scope.row)"
v-hasPermi="['machinery:type:edit']"
>
维修解绑
</el-button>
<!-- <el-button
size="mini"
type="text"
icon="el-icon-delete"
@click="handleDelete(scope.row)"
v-hasPermi="['machinery:type:del']"
>
删除
</el-button> -->
</template>
</el-table-column>
</el-table>
</el-col>
</el-row>
</div>
</template>
<script>
import Treeselect from "@riophae/vue-treeselect";
import "@riophae/vue-treeselect/dist/vue-treeselect.css";
// import {
// getListByMaType,
// getMaTypeList,
// getMaType,
// addMaType,
// updateMaType,
// delMaType,
// } from '@/api/store/tools'
import { getUserByRoleList, getMaUserList } from "@/api/system/user";
import {
getProLists,
getMaTypeList,
getListByMaType,
getMaType,
queryKeeperDataApi,
queryKeeperProApi,
queryKeeperMatApi,
queryKeeperNameApi,
delMaType,
addMaType,
updateMaType,
} from "@/api/ma/base";
import {
getMatConfigList,
getListByMatConfig,
bindRepair,
} from "@/api/ma/typeConfig";
import { getInfo } from "@/api/login";
import { downloadFile } from "@/utils/download";
export default {
name: "typeConfig",
components: { Treeselect },
data() {
return {
//
loading: true,
//
ids: [],
//
single: true,
//
multiple: true,
//
showSearch: true,
//
total: 0,
totalTemp:0,
countTemp: 1,
totalAll:0,
//
keeperList: null,
keeperDataRange: [],
keeperProRange: [],
keeperMatRange: [],
keeperNameRange: [],
//
repairUserList: null,
//
propList: null,
//
typeName: undefined,
//
treeOptions: undefined,
//
typeList: undefined,
//
open: false,
//
title: "",
//
dateRange: [],
//
postOptions: [],
//
roleOptions: [],
//
form: {},
chosenTypeId: "",
leasePrice: "",
fileList: [],
//
// uploadUrl:'http://192.168.0.14:21624/system',//线+system
// uploadUrl:'http://112.29.103.165:21624/system',//线+system
// uploadUrl:'http://192.168.5.12:9201',//
uploadUrl: process.env.VUE_APP_BASE_API + "/system", //
defaultProps: {
children: "children",
label: "label",
},
userIdTemp: -1,
typeIdTemp: -1,
//
queryParams: {
pageNum: 1,
pageSize: 10,
typeName: undefined,
level: 0,
// phonenumber: undefined,
// status: undefined,
// typeId: undefined
},
configOpen: false,
cform: {
price: "",
afterPrice: "",
useDate: "",
},
};
},
watch: {
//
typeName(val) {
this.$refs.tree.filter(val);
},
},
created() {
// this.getInfo()
this.getList();
this.getTreeData();
this.getKeeperDataList();
// this.getUserList()
// this.getPropData()
},
methods: {
// getInfo() {
// getInfo().then((res) => {
// console.log(res, 'companyId----')
// this.companyId = res.user.companyId
// })
// },
keeperDataChange(e) {
this.keeperDataRange.forEach((item) => {
if (e === item.value) {
this.form.keeperDataPro = null;
this.form.keeperDataMat = null;
this.form.keeperDataName = null;
//
let keeper = queryKeeperProApi({
houseId: e,
}).then((projRes) => {
this.keeperProRange = projRes.data.map((item) => {
return {
label: item.typeName,
value: item.typeId,
};
});
});
}
});
},
keeperDataProChange(e) {
this.keeperProRange.forEach((item) => {
if (e === item.value) {
this.form.keeperDataMat = null;
this.form.keeperDataName = null;
//
let keeper = queryKeeperMatApi({
typeId: e,
}).then((projRes) => {
this.keeperMatRange = projRes.data.map((item) => {
return {
label: item.typeName,
value: item.typeId,
};
});
});
}
});
},
keeperDataMatChange(e) {
this.keeperMatRange.forEach((item) => {
if (e === item.value) {
this.form.keeperDataName = null;
//
let keeper = queryKeeperNameApi({
typeId: e,
}).then((projRes) => {
this.keeperNameRange = projRes.data.map((item) => {
return {
label: item.typeName,
value: item.typeId,
};
});
});
}
});
},
/** 查询物资类型 */
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() {
getMatConfigList().then((response) => {
this.treeOptions = response.data;
});
},
/** 查询列表 */
getList() {
this.loading = true;
getListByMatConfig(this.queryParams).then((response) => {
this.typeList = response.data;
response.data.forEach(item=>{
if(item.children.length!=0){
this.totalTemp=this.totalTemp+item.children.length
}
})
this.totalTemp = this.totalTemp + response.data.length
this.loading = false;
});
},
// -
filterNode(value, data) {
if (!value) return true;
return data.label.indexOf(value) !== -1;
},
// -
handleNodeClick(data, node) {
// this.queryParams.level = data.level
this.handleQuery();
(this.userIdTemp = data.id), (this.queryParams.userId = data.id);
},
//
cancel() {
this.open = false;
this.reset();
},
//
reset() {
this.form = {
photoUrl: "",
photoName: "",
documentUrl: "",
documentName: "",
parentId: "",
};
this.resetForm("form");
},
/** 搜索按钮操作 */
handleQuery() {
// this.queryParams.pageNum = 1;
this.getList();
},
/** 重置按钮操作 */
resetQuery() {
this.dateRange = [];
this.resetForm("queryForm");
this.queryParams.typeId = undefined;
this.queryParams.pageNum = 1;
this.queryParams.pageSize = 10;
this.queryParams.level = 0;
this.$refs.tree.setCurrentKey(null);
this.handleQuery();
},
//
handleSelectionChange(selection) {
this.ids = selection.map((item) =>item.typeId);
console.log('ids----',this.ids)
this.single = selection.length != 1;
this.multiple = !selection.length;
},
handleSelect(selection, row) {
this.toggleSelection(selection, row);
},
handleSelectAll(selection) {
// this.countTemp++;
console.log('selectionThree',selection)
if (this.countTemp == 1 && selection.length == this.typeList.length) {
this.typeList.forEach((row) => {
this.toggleSelection([row], row);
});
this.countTemp=2
} else if (
this.countTemp == 2 &&
selection.length == this.totalTemp - this.typeList.length
) {
this.typeList.forEach((row) => {
this.toggleSelectionFalse([row], row);
});
this.countTemp=1
}
},
// else if (
// this.countTemp != 1 &&
// this.countTemp != 2 &&
// selection.length == this.totalTemp
// ) {
// this.typeList.forEach((row) => {
// this.toggleSelection([row], row);
// });
// } else if (
// this.countTemp != 1 &&
// this.countTemp != 2 &&
// selection.length == this.totalTemp - this.typeList.length
// ) {
// this.typeList.forEach((row) => {
// this.toggleSelectionFalse([row], row);
// });
// }
// },
toggleSelection(selection, row) {
if (row.children && row.children.length) {
row.children.forEach((child) => {
this.$refs.multipleTable.toggleRowSelection(
child,
selection.includes(row)
);
this.toggleSelection(selection, child);
});
}
},
toggleSelectionFalse(selection, row) {
if (row.children && row.children.length) {
row.children.forEach((child) => {
this.$refs.multipleTable.toggleRowSelection(
child,
!selection.includes(row)
);
this.toggleSelectionFalse(selection, child);
});
}
},
/** 绑定按钮操作 */
handleBind() {
if (this.userIdTemp == -1) {
this.$alert("未勾选绑定人,无法绑定", "提示", {
type: "warning",
confirmButtonText: "确定",
});
return;
}
// if (this.ids.length == 0) {
// this.$alert("", "", {
// type: "warning",
// confirmButtonText: "",
// });
// return;
// } else {
// const ids = this.ids.join(",");
// }
console.log(this.typeIdTemp);
bindRepair({
typeId: this.typeIdTemp,
userId: this.userIdTemp,
bindFlag: 1,
bindRoleType: 1,
}).then((response) => {
this.$modal.msgSuccess("绑定成功");
this.getList();
});
},
/** 解绑按钮操作 */
handleNoBind() {
if (this.userIdTemp == -1) {
this.$alert("未勾选绑定人,无法绑定", "提示", {
type: "warning",
confirmButtonText: "确定",
});
return;
}
if (this.ids.length == 0) {
this.$alert("未进行勾选,无法解绑", "提示", {
type: "warning",
confirmButtonText: "确定",
});
return;
}
},
/** 修改按钮操作 */
handleUpdate(row) {
const typeId = row.typeId;
const userId = row.repairUserId;
bindRepair({
typeId: typeId,
userId: userId,
bindFlag: 2,
bindRoleType: 2,
}).then((response) => {
this.$modal.msgSuccess("解绑成功");
this.getList();
});
},
handleUpdateKeep(row) {
const typeId = row.typeId;
const userId = row.keeperUserId;
console.log("typeId", typeId);
console.log("userId", userId);
bindRepair({
typeId: typeId,
userId: userId,
bindFlag: 2,
bindRoleType: 1,
}).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('system/user/export', {
// // ...this.queryParams
// // }, `user_${new Date().getTime()}.xlsx`)
// exportMaterial(this.queryParams).then(res => {
// downloadFile({ fileName: `_${new Date().getTime()}.xlsx`, fileData: res, fileType: 'application/vnd.ms-excel;charset=utf-8' })
// })
// },
/** 导出按钮操作 */
handleExport() {
this.download(
"/material/ma_type/export",
{
...this.queryParams,
},
`物资类型信息_${new Date().getTime()}.xlsx`
);
},
/* 树节点操作 */
treeChange(val) {
console.log(val, "树节点");
this.form.companyId = val.companyId;
},
/* 树节点增加 */
appendTreeNode(data) {
if (data.level === 3) {
this.reset();
Object.assign(this.form, data);
this.form.parentId = data.id;
this.open = true;
this.title = "新增";
} else {
Object.assign(this.addFormParams, data);
this.addFormParams.typeName = "";
this.addTitle = "新增";
this.addTitleVisible = true;
}
},
/* 树节点删除 */
removeTreeNode(data) {
// this.$message.success('--')
console.log(data, "删除时的数据源--");
this.$modal
.confirm("是否确认删除数据项?")
.then(function () {
return delMaType(data.id);
})
.then(() => {
this.$modal.msgSuccess("删除成功");
this.getTreeData();
})
.catch(() => {});
},
/* 树节点修改 */
editTreeNode(data) {
console.log(data, "修改");
Object.assign(this.addFormParams, data);
this.addTitle = "修改";
this.addFormParams.typeName = data.label;
this.addTitleVisible = true;
},
/* 确定 */
onSubmit() {
const { id, typeName } = this.addFormParams;
const addParams = {
parentId: id,
typeName,
};
const editParams = {
typeId: id,
typeName,
};
this.$refs["addFormParamsRef"].validate(async (valid) => {
if (valid) {
if (this.addTitle === "新增") {
const res = await addMaType(addParams);
if (res.code === 200) {
this.$message.success("新增成功!");
this.addTitleVisible = false;
this.getTreeData();
}
} else {
const res = await updateMaType(editParams);
if (res.code === 200) {
this.$message.success("修改成功!");
this.addTitleVisible = false;
this.getTreeData();
}
}
}
});
},
/* 取消 */
onCancel() {
this.addTitleVisible = false;
},
getParentName(list, id) {
try {
list.forEach((e) => {
if (e.id == id) {
this.form.label = e.label;
throw new Error();
} else {
if (e.children && e.children.length > 0) {
this.getParentName(e.children, id);
}
}
});
} catch (error) {}
},
onMousemove(data) {
this.isMousemoveId = data.id;
},
onMouseleave() {
this.isMousemoveId = null;
},
},
};
</script>
<style lang="scss" scoped>
::v-deep.el-table .fixed-width .el-button--mini {
width: 60px !important;
margin-bottom: 10px;
}
::v-deep .btn-items .el-button + .el-button {
margin-left: 6px;
}
.btn-items {
margin-left: 4px;
.el-button--text {
font-size: 16px;
}
}
::v-deep .el-tree .el-tree-node__expand-icon.expanded {
-webkit-transform: rotate(0deg);
transform: rotate(0deg);
}
::v-deep .el-tree .el-icon-caret-right:before {
content: "\e783";
font-size: 16px;
}
::v-deep
.el-tree
.el-tree-node__expand-icon.expanded.el-icon-caret-right:before {
content: "\e781";
font-size: 16px;
color: #1890ff;
}
::v-deep .el-tree-node__content > .el-tree-node__expand-icon {
color: #1890ff !important;
}
::v-deep .el-tree-node__expand-icon.is-leaf {
color: transparent !important;
}
::v-deep
.el-tree--highlight-current
.el-tree-node.is-current
> .el-tree-node__content {
background-color: #8decf1;
}
</style>