文件加密,维修员页面增加

This commit is contained in:
jjLv 2024-10-31 10:27:56 +08:00
parent dbac0b4493
commit acc96ac903
3 changed files with 757 additions and 160 deletions

View File

@ -635,7 +635,8 @@
if(this.delBusinessFileIdList.length>0){
this.delBusinessFileIdList.forEach(async item=>{
const urlcode = Base64.encode(item)
await deleteFile(urlcode);
const urlen = encodeURIComponent(urlcode)
await deleteFile(urlen);
})
}
},

View File

@ -179,22 +179,6 @@
<!-- <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
@ -206,24 +190,6 @@
>
库管解绑
</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>
@ -235,14 +201,7 @@
<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,
@ -317,11 +276,7 @@ export default {
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",
@ -372,7 +327,6 @@ export default {
// },
renderConent(h, { node }) {
let iconClass = '';
console.log('node',node)
// node
if (node.level == 4) {
iconClass = 'el-icon-user-solid';
@ -741,15 +695,6 @@ export default {
.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(
@ -760,108 +705,7 @@ export default {
`物资类型信息_${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>

View File

@ -0,0 +1,752 @@
<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"
:render-content="renderConent"
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
@select="selectTr"
@select-all="handleSelectAll"
@selection-change="handleSelectionChange"
>
<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="parentOneLevelName"
show-overflow-tooltip
/>
<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="handleUpdate(scope.row)"
v-hasPermi="['machinery:type:edit']"
>
维修解绑
</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 { 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 { getUserList } from "@/api/basic/basic";
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: [],
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: "",
},
isAllSelect:false,
selectionRows:[],
};
},
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
// })
// },
renderConent(h, { node }) {
let iconClass = '';
// node
if (node.level == 4) {
iconClass = 'el-icon-user-solid';
}
// else if (node.type === 'file') {
// iconClass = 'el-icon-document';
// }
return (
<span>
<i class={iconClass}></i> {node.label}
</span>
);
},
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;
// });
getUserList({ userName: this.userName ,deptId:0}).then(response => {
this.treeOptions = response.data
});
},
/** 查询列表 */
getList() {
this.loading = true;
getListByMatConfig(this.queryParams).then((response) => {
this.typeList = response.data;
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.$refs.multipleTable.clearSelection();
(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.$refs.multipleTable.clearSelection();
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.selectionRows = selection,
this.ids = selection.map((item) =>item.typeId);
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');
});
},
//
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)
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(",");
}
bindRepair({
typeId: 3,
userId: this.userIdTemp,
bindFlag: 1,
bindRoleType: 1,
}).then((response) => {
this.$modal.msgSuccess("绑定成功");
this.ids = null;
this.getTreeData();
this.getList();
this.$refs.multipleTable.clearSelection();
});
},
/** 解绑按钮操作 */
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(
"/material/ma_type/export",
{
...this.queryParams,
},
`物资类型信息_${new Date().getTime()}.xlsx`
);
},
},
};
</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>