update
This commit is contained in:
44
src/api/document/document.js
Normal file
44
src/api/document/document.js
Normal file
@@ -0,0 +1,44 @@
|
||||
import request from '@/utils/request'
|
||||
|
||||
// 查询【请填写功能名称】列表
|
||||
export function listDocument(query) {
|
||||
return request({
|
||||
url: '/document/list',
|
||||
method: 'get',
|
||||
params: query
|
||||
})
|
||||
}
|
||||
|
||||
// 查询【请填写功能名称】详细
|
||||
export function getDocument(id) {
|
||||
return request({
|
||||
url: '/document/' + id,
|
||||
method: 'get'
|
||||
})
|
||||
}
|
||||
|
||||
// 新增【请填写功能名称】
|
||||
export function addDocument(data) {
|
||||
return request({
|
||||
url: '/document',
|
||||
method: 'post',
|
||||
data: data
|
||||
})
|
||||
}
|
||||
|
||||
// 修改【请填写功能名称】
|
||||
export function updateDocument(data) {
|
||||
return request({
|
||||
url: '/document',
|
||||
method: 'put',
|
||||
data: data
|
||||
})
|
||||
}
|
||||
|
||||
// 删除【请填写功能名称】
|
||||
export function delDocument(id) {
|
||||
return request({
|
||||
url: '/document/' + id,
|
||||
method: 'delete'
|
||||
})
|
||||
}
|
||||
@@ -133,3 +133,12 @@ export function deptTreeSelect() {
|
||||
method: 'get'
|
||||
})
|
||||
}
|
||||
|
||||
// 文件上传
|
||||
export function uploadFile(data) {
|
||||
return request({
|
||||
url: '/system/user/upload',
|
||||
method: 'post',
|
||||
data: data
|
||||
})
|
||||
}
|
||||
|
||||
44
src/api/tool/tool.js
Normal file
44
src/api/tool/tool.js
Normal file
@@ -0,0 +1,44 @@
|
||||
import request from '@/utils/request'
|
||||
|
||||
// 查询工具信息列表
|
||||
export function listTool(query) {
|
||||
return request({
|
||||
url: '/tool/list',
|
||||
method: 'get',
|
||||
params: query
|
||||
})
|
||||
}
|
||||
|
||||
// 查询工具信息详细
|
||||
export function getTool(toolId) {
|
||||
return request({
|
||||
url: '/tool/' + toolId,
|
||||
method: 'get'
|
||||
})
|
||||
}
|
||||
|
||||
// 新增工具信息
|
||||
export function addTool(data) {
|
||||
return request({
|
||||
url: '/tool',
|
||||
method: 'post',
|
||||
data: data
|
||||
})
|
||||
}
|
||||
|
||||
// 修改工具信息
|
||||
export function updateTool(data) {
|
||||
return request({
|
||||
url: '/tool',
|
||||
method: 'put',
|
||||
data: data
|
||||
})
|
||||
}
|
||||
|
||||
// 删除工具信息
|
||||
export function delTool(toolId) {
|
||||
return request({
|
||||
url: '/tool/' + toolId,
|
||||
method: 'delete'
|
||||
})
|
||||
}
|
||||
7
src/components/user-selector/index.js
Normal file
7
src/components/user-selector/index.js
Normal file
@@ -0,0 +1,7 @@
|
||||
import UserSelector from './src/user-selector'
|
||||
UserSelector.install = function(Vue) {
|
||||
Vue.component(UserSelector.name, UserSelector)
|
||||
}
|
||||
|
||||
// 默认导出组件
|
||||
export default UserSelector
|
||||
614
src/components/user-selector/src/user-selector.vue
Normal file
614
src/components/user-selector/src/user-selector.vue
Normal file
@@ -0,0 +1,614 @@
|
||||
<template>
|
||||
<div>
|
||||
<el-dialog
|
||||
:title="'人员选择' + (type == 'multiple' ? '(多选)' : '(单选)')"
|
||||
:visible.sync="open"
|
||||
:width="width || '900px'"
|
||||
:height="height || '650px'"
|
||||
:before-close="handleClose"
|
||||
append-to-body
|
||||
>
|
||||
|
||||
<div class="selectBox">
|
||||
<div class="bottomBox" v-show="showSearch">
|
||||
<el-form :model="queryParams" ref="queryForm" size="small" :inline="true" label-width="68px">
|
||||
<el-row>
|
||||
<el-col :span="8">
|
||||
<el-form-item label="用户姓名" prop="nickName">
|
||||
<el-input
|
||||
v-model="queryParams.nickName"
|
||||
placeholder="请输入用户姓名"
|
||||
clearable
|
||||
style="width: 200px"
|
||||
size="mini"
|
||||
@keyup.enter.native="getList"
|
||||
/>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="8">
|
||||
<el-form-item label="手机号码" prop="phonenumber">
|
||||
<el-input
|
||||
v-model="queryParams.phonenumber"
|
||||
placeholder="请输入手机号码"
|
||||
clearable
|
||||
style="width: 200px"
|
||||
size="mini"
|
||||
@keyup.enter.native="getList"
|
||||
/>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="8">
|
||||
<el-form-item>
|
||||
<el-button type="primary" icon="el-icon-search" size="mini" @click="getList">搜索</el-button>
|
||||
<el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
|
||||
|
||||
|
||||
</el-form>
|
||||
</div>
|
||||
<div class="topBox">
|
||||
<div class="leftBox">
|
||||
<div class="contentBox">
|
||||
<div class="leftBox_title">组织架构</div>
|
||||
<div style="padding: 4px;margin-bottom: 4px;">
|
||||
<el-input
|
||||
v-model="deptName"
|
||||
placeholder="请输入部门名称"
|
||||
clearable
|
||||
size="mini"
|
||||
prefix-icon="el-icon-search"
|
||||
>
|
||||
</el-input>
|
||||
</div>
|
||||
<div class="treeBox">
|
||||
<el-tree
|
||||
:data="deptOptions"
|
||||
:props="defaultProps"
|
||||
:expand-on-click-node="false"
|
||||
:filter-node-method="filterNode"
|
||||
ref="tree"
|
||||
node-key="id"
|
||||
default-expand-all
|
||||
highlight-current
|
||||
|
||||
@node-click="handleNodeClick"
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="leftBox">
|
||||
<div class="contentBox">
|
||||
<div class="leftBox_title">
|
||||
人员选择
|
||||
<!-- <el-checkbox class="leftBox_title_do" style="right: 60px" v-model="userNodeAll" @change="handleCheckedNodeAll($event)">全选</el-checkbox>
|
||||
<el-checkbox class="leftBox_title_do" v-model="cancelUserNodeAll" @change="handleCheckedNodeAll($event)">全不选</el-checkbox> -->
|
||||
<el-button v-if="type == 'multiple'" class="leftBox_title_do" style="right: 70px" type="text" size="mini" @click="handleCheckedNodeAll(true)">全选</el-button>
|
||||
<el-button v-if="type == 'multiple'" class="leftBox_title_do" type="text" size="mini" @click="handleCheckedNodeAll(false)">全不选</el-button>
|
||||
</div>
|
||||
|
||||
<div class="peopleBox">
|
||||
<div class="peopleList">
|
||||
<el-checkbox-group ref="peopleCheckBoxes" v-model="checkedUsers" @change="handleCheckedUsersChange" :max="type == 'single' ? 1 : 2147483647">
|
||||
<el-checkbox
|
||||
v-for="item in userList"
|
||||
:label="item.userName"
|
||||
:key="item.userName"
|
||||
class="peopleCard"
|
||||
>
|
||||
<div class="peopleInfoBox">
|
||||
<div class="peopleName">{{ item.nickName }}</div>
|
||||
<div class="peopleDept">{{ item.dept.deptName || '' }}</div>
|
||||
</div>
|
||||
</el-checkbox>
|
||||
</el-checkbox-group>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<!-- this.checkedUsers -->
|
||||
<div class="leftBox">
|
||||
<div class="contentBox">
|
||||
<div class="leftBox_title">已选择人员
|
||||
<el-button v-if="type == 'multiple'" class="leftBox_title_do" type="text" size="mini" @click="clearAll">全部清空</el-button>
|
||||
</div>
|
||||
<div class="peopleBox">
|
||||
<div class="peopleList">
|
||||
<div
|
||||
v-for="item in selectedUserList"
|
||||
class="peopleCard"
|
||||
>
|
||||
<div class="peopleInfoBox">
|
||||
<div class="peopleName" style="margin-top:4px">{{ item.nickName }}</div>
|
||||
<div class="peopleDept">{{ item.dept.deptName || '' }}</div>
|
||||
</div>
|
||||
|
||||
<div class="peopleDeleteBtn" @click="deleteUserByUserName(item.userName)"></div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
<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 { listUser, getUser, deptTreeSelect } from "@/api/system/user";
|
||||
import { getToken } from "@/utils/auth";
|
||||
|
||||
|
||||
import Treeselect from "@riophae/vue-treeselect";
|
||||
|
||||
export default {
|
||||
name: "PeopleSelect",
|
||||
components: { Treeselect },
|
||||
dicts: ['sys_normal_disable', 'sys_user_sex'],
|
||||
props: {
|
||||
width: {
|
||||
type: String,
|
||||
default: "900px",
|
||||
},
|
||||
height: {
|
||||
type: String,
|
||||
default: '650px'
|
||||
},
|
||||
type: {
|
||||
type: String,
|
||||
default: "single" //single or multiple
|
||||
},
|
||||
open: {
|
||||
type: Boolean,
|
||||
default:false,
|
||||
}
|
||||
// value: {
|
||||
// type: Object,
|
||||
// default: {
|
||||
// userName: [],
|
||||
// realName: []
|
||||
// }
|
||||
// }
|
||||
},
|
||||
computed: {
|
||||
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
|
||||
loading: false,
|
||||
|
||||
// open: false,
|
||||
activeName: 'first',
|
||||
defaultProps: {
|
||||
children: "children",
|
||||
label: "label"
|
||||
},
|
||||
// 部门树选项
|
||||
deptOptions: undefined,
|
||||
deptName: '',
|
||||
showSearch: true,
|
||||
|
||||
userList: [],
|
||||
allUserList: [],
|
||||
allUserMap: new Map(),
|
||||
selectedUserList: [],
|
||||
|
||||
// 查询参数
|
||||
queryParams: {
|
||||
pageNum: 1,
|
||||
pageSize: 2147483647,
|
||||
userName: undefined,
|
||||
phonenumber: undefined,
|
||||
status: "0",
|
||||
deptId: undefined
|
||||
},
|
||||
|
||||
//已选择的用户信息
|
||||
checkedUsers: [],
|
||||
|
||||
// userNodeAll: false,
|
||||
// cancelUserNodeAll: false,
|
||||
|
||||
};
|
||||
},
|
||||
created() {
|
||||
this.getDeptTree();
|
||||
this.getAllUserList();
|
||||
},
|
||||
watch: {
|
||||
// 根据名称筛选部门树
|
||||
deptName(val) {
|
||||
this.$refs.tree.filter(val);
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
handleClose(done) {
|
||||
this.$confirm('确认关闭?')
|
||||
.then(_ => {
|
||||
this.cancel();
|
||||
})
|
||||
.catch(_ => {});
|
||||
},
|
||||
handleClick(tab, event) {
|
||||
console.log(tab, event);
|
||||
},
|
||||
|
||||
|
||||
//获取选中的人员昵称列表
|
||||
getNickNameList(uns) {
|
||||
let result = [];
|
||||
uns.forEach(item => {
|
||||
if(this.allUserMap.has(item)) {
|
||||
result.push(this.allUserMap.get(item).nickName || '');
|
||||
}
|
||||
})
|
||||
return result;
|
||||
},
|
||||
getUserIdByUserName(userName){
|
||||
let result = '';
|
||||
if(this.allUserMap.has(userName)) {
|
||||
result = this.allUserMap.get(userName).userId || '';
|
||||
}
|
||||
return result;
|
||||
},
|
||||
getNickNameByUserName(userName){
|
||||
let result = '';
|
||||
if(this.allUserMap.has(userName)) {
|
||||
result = this.allUserMap.get(userName).nickName || '';
|
||||
}
|
||||
return result;
|
||||
},
|
||||
submitForm() {
|
||||
let checkedUserArr = []
|
||||
let checkedUser = {}
|
||||
this.checkedUsers.forEach(userName => {
|
||||
checkedUser['userName'] = userName
|
||||
checkedUser['userId'] = this.getUserIdByUserName(userName)
|
||||
checkedUser['nickName'] = this.getNickNameByUserName(userName)
|
||||
checkedUserArr.push(checkedUser)
|
||||
})
|
||||
this.$emit("submit", checkedUserArr); //返回username和nickname
|
||||
},
|
||||
cancel() {
|
||||
this.$emit('cancel');
|
||||
},
|
||||
// 筛选节点
|
||||
filterNode(value, data) {
|
||||
if (!value) return true;
|
||||
return data.label.indexOf(value) !== -1;
|
||||
},
|
||||
// 节点单击事件
|
||||
handleNodeClick(data) {
|
||||
this.queryParams.deptId = data.id;
|
||||
this.getList();
|
||||
},
|
||||
/** 查询部门下拉树结构 */
|
||||
getDeptTree() {
|
||||
deptTreeSelect().then(response => {
|
||||
this.deptOptions = response.data;
|
||||
});
|
||||
},
|
||||
|
||||
//第一步要做的 checkedUsers 为数组如['admin','ry'] 在父组件调用此方法并传入要回显的数组可进行复选框回显操作
|
||||
getAllUserList(checkedUsers = []) {
|
||||
//查出所有的用户,用于根据不同情况筛选显示
|
||||
listUser({pageNum: 1,pageSize: 2147483647,status: "0"}).then(response => {
|
||||
this.allUserList = response.rows;
|
||||
|
||||
this.allUserMap = new Map();
|
||||
|
||||
this.checkedUsers = checkedUsers;
|
||||
|
||||
this.allUserList.forEach(item => {
|
||||
this.allUserMap.set(item.userName, item);
|
||||
});
|
||||
this.updateCheckedUsers();
|
||||
// console.log(this.allUserList, this.allUserMap);
|
||||
this.getList();
|
||||
}
|
||||
);
|
||||
},
|
||||
|
||||
/** 查询用户列表 */
|
||||
getList() {
|
||||
listUser(this.addDateRange(this.queryParams, this.dateRange)).then(response => {
|
||||
this.userList = response.rows;
|
||||
// console.log(this.userList);
|
||||
}
|
||||
);
|
||||
},
|
||||
|
||||
/** 重置按钮操作 */
|
||||
resetQuery() {
|
||||
this.resetForm("queryForm");
|
||||
this.queryParams.deptId = undefined;
|
||||
this.$refs.tree.setCurrentKey(null);
|
||||
this.getList();
|
||||
},
|
||||
|
||||
handleCheckedUsersChange(val) {
|
||||
// console.log(this.$refs.peopleCheckBoxes.value);
|
||||
this.updateCheckedUsers();
|
||||
},
|
||||
|
||||
updateCheckedUsers() {
|
||||
this.selectedUserList = [];
|
||||
|
||||
this.checkedUsers.forEach(item => {
|
||||
if(this.allUserMap.has(item)) {
|
||||
let u = this.allUserMap.get(item);
|
||||
this.selectedUserList.push(u);
|
||||
}
|
||||
})
|
||||
},
|
||||
|
||||
deleteUserByUserName(username) {
|
||||
for(let i = 0;i < this.checkedUsers.length;i++) {
|
||||
if(this.checkedUsers[i].indexOf(username) != -1) {
|
||||
this.checkedUsers.splice(i, 1);
|
||||
this.updateCheckedUsers();
|
||||
break;
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
handleCheckedNodeAll(val) {
|
||||
if(val) { //全选
|
||||
this.userList.forEach(item => {
|
||||
for(let i = 0;i < this.checkedUsers.length;i++) {
|
||||
if(this.checkedUsers[i] == item.userName) { //已存在,跳过
|
||||
return;
|
||||
}
|
||||
}
|
||||
//不存在,执行添加
|
||||
this.checkedUsers.push(item.userName);
|
||||
});
|
||||
} else { //全不选
|
||||
this.userList.forEach(item => {
|
||||
for(let i = 0;i < this.checkedUsers.length;i++) {
|
||||
if(this.checkedUsers[i] == item.userName) { //已存在,执行删除
|
||||
this.checkedUsers.splice(i, 1);
|
||||
return;
|
||||
}
|
||||
}
|
||||
//不存在,无需操作
|
||||
|
||||
});
|
||||
}
|
||||
this.updateCheckedUsers();
|
||||
},
|
||||
|
||||
|
||||
clearAll() {
|
||||
this.checkedUsers = [];
|
||||
this.updateCheckedUsers();
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
|
||||
.selectBox {
|
||||
width:100%;
|
||||
min-width: 900px;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
|
||||
.topBox {
|
||||
width:100%;
|
||||
display: flex;
|
||||
margin-top:10px;
|
||||
.leftBox {
|
||||
width:280px;
|
||||
height: 400px;
|
||||
margin-right:10px;
|
||||
|
||||
-webkit-box-shadow: 0 2px 4px 0 rgba(0, 0, 0, 0.12), 0 0 6px 0 rgba(0, 0, 0, 0.04);
|
||||
box-shadow: 0 2px 4px 0 rgba(0, 0, 0, 0.12), 0 0 6px 0 rgba(0, 0, 0, 0.04);
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
|
||||
.leftBox_title {
|
||||
width:100%;
|
||||
height:40px;
|
||||
font-size: 16px;
|
||||
line-height: 40px;
|
||||
padding-left: 10px;
|
||||
background-color: #f5f5f5;
|
||||
position: relative;
|
||||
.leftBox_title_do {
|
||||
position: absolute;
|
||||
right: 16px;
|
||||
top: 8px;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
.contentBox {
|
||||
width:100%;
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.bottomBox {
|
||||
margin-top:15px;
|
||||
width:100%;
|
||||
// border: 1px solid #DCDFE6;
|
||||
// -webkit-box-shadow: 0 2px 4px 0 rgba(0, 0, 0, 0.12), 0 0 6px 0 rgba(0, 0, 0, 0.04);
|
||||
// box-shadow: 0 2px 4px 0 rgba(0, 0, 0, 0.12), 0 0 6px 0 rgba(0, 0, 0, 0.04);
|
||||
// overflow-y: auto;
|
||||
|
||||
.selectPeopleList {
|
||||
width:100%;
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
|
||||
.selectPeopleCard {
|
||||
width:50px;
|
||||
height:56px;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
margin: 5px 10px;
|
||||
.user-avatar {
|
||||
width: 40px;
|
||||
height: 40px;
|
||||
border-radius: 50%;
|
||||
color: #fff;
|
||||
background: #FFA502;
|
||||
font-size: 14px;
|
||||
text-align: center;
|
||||
line-height: 40px;
|
||||
}
|
||||
|
||||
.userInfo {
|
||||
width:100%;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
margin-left:5px;
|
||||
margin-right:5px;
|
||||
|
||||
div:nth-child(1) {
|
||||
font-size: 14px;
|
||||
white-space: nowrap;
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
width:100%;
|
||||
text-align: center;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
.treeBox {
|
||||
width:100%;
|
||||
height: 320px;
|
||||
overflow-x: hidden;
|
||||
overflow-y: auto;
|
||||
}
|
||||
|
||||
.peopleBox {
|
||||
width:100%;
|
||||
height: 360px;
|
||||
overflow-x: hidden;
|
||||
overflow-y: auto;
|
||||
|
||||
.peopleList {
|
||||
width:100%;
|
||||
height:auto;
|
||||
|
||||
|
||||
.peopleCard:hover {
|
||||
background-color: #fafafa;
|
||||
transition: .2s;
|
||||
|
||||
.peopleName {
|
||||
color:#eb6100;
|
||||
}
|
||||
}
|
||||
.peopleCard {
|
||||
width:100%;
|
||||
height: 48px;
|
||||
border-top: solid #f5f5f5 1px;
|
||||
border-bottom: solid #f5f5f5 1px;
|
||||
padding-left: 8px;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
cursor: pointer;
|
||||
transition: .2s;
|
||||
::v-deep .el-checkbox__label {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
.avatarBox {
|
||||
width: 40px;
|
||||
height: 40px;
|
||||
|
||||
.user-avatar {
|
||||
width: 40px;
|
||||
height: 40px;
|
||||
border-radius: 50%;
|
||||
color: #fff;
|
||||
font-size: 14px;
|
||||
text-align: center;
|
||||
line-height: 40px;
|
||||
user-select: none;
|
||||
}
|
||||
}
|
||||
|
||||
.peopleInfoBox {
|
||||
width: 190px;
|
||||
height:100%;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
padding-left: 8px;
|
||||
|
||||
.peopleName {
|
||||
width: 100%;
|
||||
height:20px;
|
||||
white-space: nowrap;
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
font-size: 14px;
|
||||
line-height: 20px;
|
||||
|
||||
}
|
||||
|
||||
.peopleDept {
|
||||
width: 100%;
|
||||
height:20px;
|
||||
white-space: nowrap;
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
font-size: 12px;
|
||||
line-height: 20px;
|
||||
color: #999;
|
||||
}
|
||||
}
|
||||
|
||||
.peopleDeleteBtn {
|
||||
width:20px;
|
||||
height:20px;
|
||||
// border-radius: 50%;
|
||||
// background: url(./delete2.png) no-repeat;
|
||||
background-size:100% 100%;
|
||||
transition: .2s;
|
||||
}
|
||||
|
||||
.peopleDeleteBtn:hover {
|
||||
width:20px;
|
||||
height:20px;
|
||||
// border-radius: 50%;
|
||||
//background: url(./delete1.png) no-repeat;
|
||||
background-size:100% 100%;
|
||||
transition: .2s;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
</style>
|
||||
@@ -4,7 +4,7 @@ import Cookies from 'js-cookie'
|
||||
|
||||
import Element from 'element-ui'
|
||||
import './assets/styles/element-variables.scss'
|
||||
|
||||
import '../public/css/poctstyle.css'
|
||||
import '@/assets/styles/index.scss' // global css
|
||||
import '@/assets/styles/ruoyi.scss' // ruoyi css
|
||||
import App from './App'
|
||||
|
||||
@@ -156,7 +156,7 @@ export const dynamicRoutes = [
|
||||
children: [
|
||||
{
|
||||
path: 'index/:tableId(\\d+)',
|
||||
component: () => import('@/views/tool/gen/editTable'),
|
||||
component: () => import('@/views/system/tool/gen/editTable'),
|
||||
name: 'GenEdit',
|
||||
meta: { title: '修改生成配置', activeMenu: '/tool/gen' }
|
||||
}
|
||||
|
||||
@@ -108,7 +108,6 @@ service.interceptors.response.use(res => {
|
||||
}
|
||||
},
|
||||
error => {
|
||||
console.log('err' + error)
|
||||
let { message } = error;
|
||||
if (message == "Network Error") {
|
||||
message = "后端接口连接异常";
|
||||
@@ -117,7 +116,7 @@ service.interceptors.response.use(res => {
|
||||
} else if (message.includes("Request failed with status code")) {
|
||||
message = "系统接口" + message.substr(message.length - 3) + "异常";
|
||||
}
|
||||
Message({ message: message, type: 'error', duration: 5 * 1000 })
|
||||
//Message({ message: message, type: 'error', duration: 5 * 1000 })
|
||||
return Promise.reject(error)
|
||||
}
|
||||
)
|
||||
|
||||
353
src/views/document/index.vue
Normal file
353
src/views/document/index.vue
Normal file
@@ -0,0 +1,353 @@
|
||||
<template>
|
||||
<div class="app-container">
|
||||
<el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch">
|
||||
<el-form-item label="文档名称" prop="roleName">
|
||||
<el-input
|
||||
v-model="queryParams.docName"
|
||||
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-upload2"
|
||||
size="mini"
|
||||
@click="handleAdd"
|
||||
>上传文档</el-button>
|
||||
</el-col>
|
||||
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
|
||||
</el-row>
|
||||
|
||||
<el-table v-loading="loading" :data="docList" @selection-change="handleSelectionChange">
|
||||
<el-table-column type="selection" width="55" align="center" />
|
||||
<el-table-column label="文档编号" prop="docCode" width="120" />
|
||||
<el-table-column label="文档名称" prop="docName" :show-overflow-tooltip="true" />
|
||||
<el-table-column label="类别" prop="docType" :show-overflow-tooltip="true" width="150" />
|
||||
<el-table-column label="负责人" prop="docPrincipals" :show-overflow-tooltip="true" width="150" />
|
||||
<el-table-column label="归属部门" prop="docRespDept" :show-overflow-tooltip="true" width="150" />
|
||||
<el-table-column label="来源" prop="docSource" width="100" />
|
||||
<el-table-column label="上传进度" prop="docUploadProgress" width="200" >
|
||||
<template slot-scope="scope">
|
||||
<el-tag type="success" v-if="scope.row.docStatus == 'ysc'">已上传</el-tag>
|
||||
<el-progress v-else :percentage="progress" status="success"></el-progress>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="关联工具" prop="roleSort" width="100" />
|
||||
<el-table-column label="创建时间" align="center" prop="createTime" width="180">
|
||||
<template slot-scope="scope">
|
||||
<span>{{ parseTime(scope.row.createTime) }}</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="操作" align="center" width="180">
|
||||
<template slot-scope="scope" v-if="scope.row.roleId !== 1">
|
||||
<el-button
|
||||
size="mini"
|
||||
type="text"
|
||||
icon="el-icon-view"
|
||||
@click="handlePriew(scope.row)"
|
||||
>预览</el-button>
|
||||
<el-button
|
||||
size="mini"
|
||||
type="text"
|
||||
icon="el-icon-delete"
|
||||
@click="handleDelete(scope.row)"
|
||||
>删除</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="open" width="800px" append-to-body>
|
||||
<el-form ref="form" :model="form" :rules="rules" label-width="100px">
|
||||
<el-form-item label="类别" prop="docType">
|
||||
<el-input v-model="form.docType" placeholder="请输入类别" />
|
||||
</el-form-item>
|
||||
<el-form-item label="负责人" prop="docPrincipals">
|
||||
<el-input v-model="form.docPrincipals" placeholder="请输入负责人" />
|
||||
</el-form-item>
|
||||
<el-form-item label="归属部门" prop="docRespDept">
|
||||
<el-input v-model="form.docRespDept" placeholder="请输入归属部门" />
|
||||
</el-form-item>
|
||||
<el-form-item label="文档来源" prop="docSource">
|
||||
<el-input v-model="form.docSource" placeholder="请输入文档来源" />
|
||||
</el-form-item>
|
||||
<el-form-item label="文件">
|
||||
<el-upload
|
||||
class="upload-component"
|
||||
ref="upload"
|
||||
:auto-upload="false"
|
||||
:file-list="fileList"
|
||||
:on-change="onChange"
|
||||
:on-remove="onRemove"
|
||||
:limit="1"
|
||||
action=""
|
||||
>
|
||||
<el-button size="small" type="primary">点击上传</el-button>
|
||||
<div slot="tip" class="el-upload__tip">只能上传jpg/png文件,且不超过500kb</div>
|
||||
</el-upload>
|
||||
</el-form-item>
|
||||
<el-form-item label="备注">
|
||||
<el-input v-model="form.remark" type="textarea" placeholder="请输入内容"></el-input>
|
||||
</el-form-item>
|
||||
</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>
|
||||
|
||||
<el-dialog :title="viewDialogTitle" :visible.sync="viewDialogOpen" fullscreen width="500px" append-to-body>
|
||||
<i-frame :src="previewUrl" />
|
||||
</el-dialog>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { listDocument, getDocument, delDocument, addDocument, updateDocument } from "@/api/document/document";
|
||||
import { Base64 } from 'js-base64';
|
||||
import iFrame from "@/components/iFrame/index";
|
||||
import { w3cwebsocket as WebSocket } from 'websocket';
|
||||
import axios from 'axios';
|
||||
import { getToken } from '@/utils/auth'
|
||||
|
||||
export default {
|
||||
name: "Document",
|
||||
components: { iFrame },
|
||||
data() {
|
||||
return {
|
||||
// 遮罩层
|
||||
loading: true,
|
||||
// 选中数组
|
||||
ids: [],
|
||||
// 非单个禁用
|
||||
single: true,
|
||||
// 非多个禁用
|
||||
multiple: true,
|
||||
// 显示搜索条件
|
||||
showSearch: true,
|
||||
// 总条数
|
||||
total: 0,
|
||||
// 表格数据
|
||||
docList: [],
|
||||
// 弹出层标题
|
||||
title: "",
|
||||
viewDialogTitle: "",
|
||||
// 是否显示弹出层
|
||||
open: false,
|
||||
viewDialogOpen: false,
|
||||
// 日期范围
|
||||
dateRange: [],
|
||||
previewUrl: '',
|
||||
progress: 0,
|
||||
fileList: [],
|
||||
websocket: null,
|
||||
// 查询参数
|
||||
queryParams: {
|
||||
pageNum: 1,
|
||||
pageSize: 10,
|
||||
docName: undefined
|
||||
},
|
||||
// 表单参数
|
||||
form: {
|
||||
docName: '',
|
||||
docType: '',
|
||||
docPrincipals: '',
|
||||
docRespDept: '',
|
||||
docSource: ''
|
||||
},
|
||||
// 表单校验
|
||||
rules: {
|
||||
docType: [
|
||||
{ required: true, message: "类别不能为空", trigger: "blur" }
|
||||
],
|
||||
docSource: [
|
||||
{ required: true, message: "文档来源不能为空", trigger: "blur" }
|
||||
]
|
||||
}
|
||||
};
|
||||
},
|
||||
created() {
|
||||
this.getList();
|
||||
this.initWebSocket();
|
||||
},
|
||||
methods: {
|
||||
generateUniqueID() {
|
||||
// 使用时间戳来生成唯一ID
|
||||
const timestamp = new Date().getTime();
|
||||
// 在ID前面添加一个前缀,以防止与其他ID冲突
|
||||
const uniqueID = 'file_' + timestamp;
|
||||
return uniqueID;
|
||||
},
|
||||
initWebSocket() {
|
||||
this.websocket = new WebSocket('ws://localhost:8080/tool-tech-admin/websocket');
|
||||
this.websocket.onmessage = (event) => {
|
||||
const msgStr = event.data;
|
||||
console.log('上传进度=' + msgStr);
|
||||
let progress = msgStr.substring(msgStr.indexOf("/") + 1, msgStr.length);
|
||||
this.progress = parseInt(progress)
|
||||
// if (progress === '100%') {
|
||||
// this.websocket.close();
|
||||
// }
|
||||
};
|
||||
this.websocket.onclose = () => {
|
||||
console.log('WebSocket connection closed');
|
||||
};
|
||||
},
|
||||
onChange(file, fileList) {
|
||||
// valid the suffix of file
|
||||
let validSuffix = ['pdf', 'docx', 'doc', 'txt', 'eml', 'mp4']
|
||||
let splits = file.name.split('.')
|
||||
let suffix = splits[splits.length - 1]
|
||||
if (!validSuffix.includes(suffix)) {
|
||||
this.$message.error(`只能上传 ${validSuffix.join(',')} 类型的文件!`)
|
||||
this.fileList = fileList.filter(item => item.uid !== file.uid)
|
||||
return
|
||||
}
|
||||
this.fileList = fileList
|
||||
},
|
||||
|
||||
onRemove(file, fileList) {
|
||||
this.fileList = fileList.filter(item => item.uid !== file.uid)
|
||||
},
|
||||
confirmSubmit(docId) {
|
||||
// 创建 formData 对象
|
||||
const formData = new FormData()
|
||||
// 将所有 的 upload 组件中的文件对象放入到 FormData 对象中
|
||||
this.fileList.forEach((file) => {
|
||||
formData.append('files', file.raw)
|
||||
})
|
||||
formData.append('docId', docId)
|
||||
formData.append('requestId', this.generateUniqueID())
|
||||
//自定义的接口也可以用ajax或者自己封装的接口
|
||||
axios.post('http://localhost:8080/tool-tech-admin/document/upload', formData, {
|
||||
headers: {
|
||||
'Content-Type': 'multipart/form-data',
|
||||
'Authorization': 'Bearer ' + getToken(),
|
||||
}
|
||||
}).then((response) => {
|
||||
if(response.data.code===200){
|
||||
this.getList()
|
||||
}else{
|
||||
// 弹框报错 response.data.message
|
||||
}
|
||||
this.initWebSocket();
|
||||
}).catch((error) => {
|
||||
console.error('Failed to upload file:', error);
|
||||
});
|
||||
},
|
||||
/** 查询列表 */
|
||||
getList() {
|
||||
this.loading = true;
|
||||
listDocument(this.addDateRange(this.queryParams, this.dateRange)).then(response => {
|
||||
this.docList = response.rows;
|
||||
this.total = response.total;
|
||||
this.loading = false;
|
||||
}
|
||||
);
|
||||
},
|
||||
// 取消按钮
|
||||
cancel() {
|
||||
this.open = false;
|
||||
this.reset();
|
||||
},
|
||||
// 表单重置
|
||||
reset() {
|
||||
this.form = {
|
||||
docName: '',
|
||||
docType: '',
|
||||
docPrincipals: '',
|
||||
docRespDept: '',
|
||||
docSource: ''
|
||||
};
|
||||
this.fileList = []
|
||||
this.resetForm("form");
|
||||
},
|
||||
/** 搜索按钮操作 */
|
||||
handleQuery() {
|
||||
this.queryParams.pageNum = 1;
|
||||
this.getList();
|
||||
},
|
||||
/** 重置按钮操作 */
|
||||
resetQuery() {
|
||||
this.dateRange = [];
|
||||
this.resetForm("queryForm");
|
||||
this.handleQuery();
|
||||
},
|
||||
/** 新增按钮操作 */
|
||||
handleAdd() {
|
||||
this.reset();
|
||||
this.open = true;
|
||||
this.title = "上传文档";
|
||||
},
|
||||
handlePriew(row){
|
||||
console.log('mmmmmmmmmmm',process.env.VUE_APP_BASE_API + row.docUrl)
|
||||
this.previewUrl = process.env.VUE_APP_TOOL_TECH_FILE_VIEW_API + '/onlinePreview?url=' + encodeURIComponent(Base64.encode(process.env.VUE_APP_BASE_API + row.docUrl));
|
||||
this.viewDialogTitle = '文档在线预览'
|
||||
this.viewDialogOpen = true;
|
||||
},
|
||||
// 多选框选中数据
|
||||
handleSelectionChange(selection) {
|
||||
this.ids = selection.map(item => item.fileId)
|
||||
this.single = selection.length!=1
|
||||
this.multiple = !selection.length
|
||||
},
|
||||
/** 提交按钮 */
|
||||
submitForm: function() {
|
||||
//判断是否有文件再上传
|
||||
if (this.fileList.length === 0) {
|
||||
return this.$message.warning('请选取文件后再上传')
|
||||
}
|
||||
this.fileList.map(file =>{
|
||||
this.form.docName = file.name
|
||||
})
|
||||
this.$refs["form"].validate(valid => {
|
||||
if (valid) {
|
||||
if (this.form.id != undefined) {
|
||||
updateDocument(this.form).then(response => {
|
||||
this.$modal.msgSuccess("修改成功");
|
||||
this.open = false;
|
||||
this.getList();
|
||||
});
|
||||
} else {
|
||||
addDocument(this.form).then(response => {
|
||||
this.$modal.msgSuccess("新增成功");
|
||||
this.open = false;
|
||||
this.getList();
|
||||
this.confirmSubmit(response.data);
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
},
|
||||
/** 删除按钮操作 */
|
||||
handleDelete(row) {
|
||||
const docIds = row.docId || this.ids;
|
||||
this.$modal.confirm('是否确认删除?').then(function() {
|
||||
return delDocument(docIds);
|
||||
}).then(() => {
|
||||
this.getList();
|
||||
this.$modal.msgSuccess("删除成功");
|
||||
}).catch(() => {});
|
||||
}
|
||||
}
|
||||
};
|
||||
</script>
|
||||
649
src/views/tool/index.vue
Normal file
649
src/views/tool/index.vue
Normal file
@@ -0,0 +1,649 @@
|
||||
<template>
|
||||
<div class="app-container">
|
||||
<el-row :gutter="20">
|
||||
<!--部门数据-->
|
||||
<el-col :span="4" :xs="24">
|
||||
<div class="head-container">
|
||||
<el-input
|
||||
v-model="deptName"
|
||||
placeholder="请输入部门名称"
|
||||
clearable
|
||||
size="small"
|
||||
prefix-icon="el-icon-search"
|
||||
style="margin-bottom: 20px"
|
||||
/>
|
||||
</div>
|
||||
<div class="head-container">
|
||||
<el-tree
|
||||
:data="deptOptions"
|
||||
:props="defaultProps"
|
||||
:expand-on-click-node="false"
|
||||
:filter-node-method="filterNode"
|
||||
ref="tree"
|
||||
node-key="id"
|
||||
default-expand-all
|
||||
highlight-current
|
||||
@node-click="handleNodeClick"
|
||||
/>
|
||||
</div>
|
||||
</el-col>
|
||||
<!--用户数据-->
|
||||
<el-col :span="20" :xs="24">
|
||||
<el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="68px">
|
||||
<el-form-item label="工具编号" prop="toolCode">
|
||||
<el-input
|
||||
v-model="queryParams.toolCode"
|
||||
placeholder="请输入工具编号"
|
||||
clearable
|
||||
style="width: 240px"
|
||||
@keyup.enter.native="handleQuery"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="工具名称" prop="toolName">
|
||||
<el-input
|
||||
v-model="queryParams.toolName"
|
||||
placeholder="请输入工具名称"
|
||||
clearable
|
||||
style="width: 240px"
|
||||
@keyup.enter.native="handleQuery"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="状态" prop="status">
|
||||
<el-select
|
||||
v-model="queryParams.status"
|
||||
placeholder="状态"
|
||||
clearable
|
||||
style="width: 240px"
|
||||
>
|
||||
<el-option
|
||||
v-for="dict in dict.type.sys_normal_disable"
|
||||
:key="dict.value"
|
||||
:label="dict.label"
|
||||
:value="dict.value"
|
||||
/>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="创建时间">
|
||||
<el-date-picker
|
||||
v-model="dateRange"
|
||||
style="width: 240px"
|
||||
value-format="yyyy-MM-dd"
|
||||
type="daterange"
|
||||
range-separator="-"
|
||||
start-placeholder="开始日期"
|
||||
end-placeholder="结束日期"
|
||||
></el-date-picker>
|
||||
</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="['system:user:add']"
|
||||
>新增</el-button>
|
||||
</el-col>
|
||||
<el-col :span="1.5">
|
||||
<el-button
|
||||
type="success"
|
||||
plain
|
||||
icon="el-icon-edit"
|
||||
size="mini"
|
||||
:disabled="single"
|
||||
@click="handleUpdate"
|
||||
v-hasPermi="['system:user:edit']"
|
||||
>修改</el-button>
|
||||
</el-col>
|
||||
<el-col :span="1.5">
|
||||
<el-button
|
||||
type="danger"
|
||||
plain
|
||||
icon="el-icon-delete"
|
||||
size="mini"
|
||||
:disabled="multiple"
|
||||
@click="handleDelete"
|
||||
v-hasPermi="['system:user:remove']"
|
||||
>删除</el-button>
|
||||
</el-col>
|
||||
<el-col :span="1.5">
|
||||
<el-button
|
||||
type="warning"
|
||||
plain
|
||||
icon="el-icon-download"
|
||||
size="mini"
|
||||
@click="handleExport"
|
||||
v-hasPermi="['system:user:export']"
|
||||
>导出</el-button>
|
||||
</el-col>
|
||||
<el-col :span="1.5">
|
||||
<el-button
|
||||
type="primary"
|
||||
plain
|
||||
icon="el-icon-plus"
|
||||
size="mini"
|
||||
@click="handleUseApply"
|
||||
v-hasPermi="['system:user:export']"
|
||||
>使用申请</el-button>
|
||||
</el-col>
|
||||
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList" :columns="columns"></right-toolbar>
|
||||
</el-row>
|
||||
|
||||
<el-table v-loading="loading" :data="toolList" @selection-change="handleSelectionChange">
|
||||
<el-table-column type="selection" width="50" align="center" />
|
||||
<el-table-column label="工具编号" align="center" key="toolCode" prop="toolCode" v-if="columns[0].visible" />
|
||||
<el-table-column label="工具名称" align="center" key="toolName" prop="toolName" v-if="columns[1].visible" :show-overflow-tooltip="true" />
|
||||
<el-table-column label="工具类别" align="center" key="toolType" prop="toolType" v-if="columns[2].visible" :show-overflow-tooltip="true" >
|
||||
<template slot-scope="scope">
|
||||
<template v-for="dict in dict.type.tool_type">
|
||||
<span v-if="scope.row.toolType == dict.value">{{ dict.label }}</span>
|
||||
</template>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="部门" align="center" key="deptName" prop="dept.deptName" v-if="columns[3].visible" :show-overflow-tooltip="true" />
|
||||
<el-table-column label="负责人" align="center" key="toolPrincipalsName" prop="toolPrincipalsName" v-if="columns[4].visible" width="120" />
|
||||
<el-table-column label="状态" align="center" key="status" v-if="columns[5].visible">
|
||||
<template slot-scope="scope">
|
||||
<el-tag type="success" v-if="scope.row.status == '0'">正常</el-tag>
|
||||
<el-tag type="info" v-if="scope.row.status == '1'">禁用</el-tag>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="创建时间" align="center" prop="createTime" v-if="columns[6].visible" width="160">
|
||||
<template slot-scope="scope">
|
||||
<span>{{ parseTime(scope.row.createTime) }}</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column
|
||||
label="操作"
|
||||
align="center"
|
||||
width="160"
|
||||
class-name="small-padding fixed-width"
|
||||
>
|
||||
<template slot-scope="scope" v-if="scope.row.userId !== 1">
|
||||
<el-button
|
||||
size="mini"
|
||||
type="text"
|
||||
icon="el-icon-edit"
|
||||
@click="handleUpdate(scope.row)"
|
||||
v-hasPermi="['system:user:edit']"
|
||||
>修改</el-button>
|
||||
<el-button
|
||||
size="mini"
|
||||
type="text"
|
||||
icon="el-icon-delete"
|
||||
@click="handleDelete(scope.row)"
|
||||
v-hasPermi="['system:user:remove']"
|
||||
>删除</el-button>
|
||||
<el-dropdown size="mini" @command="(command) => handleCommand(command, scope.row)" v-hasPermi="['system:user:resetPwd', 'system:user:edit']">
|
||||
<el-button size="mini" type="text" icon="el-icon-d-arrow-right">更多</el-button>
|
||||
<el-dropdown-menu slot="dropdown">
|
||||
<el-dropdown-item command="handlePublish" icon="el-icon-key"
|
||||
v-hasPermi="['system:user:resetPwd']">发布</el-dropdown-item>
|
||||
</el-dropdown-menu>
|
||||
</el-dropdown>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
|
||||
<pagination
|
||||
v-show="total>0"
|
||||
:total="total"
|
||||
:page.sync="queryParams.pageNum"
|
||||
:limit.sync="queryParams.pageSize"
|
||||
@pagination="getList"
|
||||
/>
|
||||
</el-col>
|
||||
</el-row>
|
||||
|
||||
<!-- 添加或修改工具信息对话框 -->
|
||||
<el-dialog :title="title" :visible.sync="open" width="60%" :close-on-click-modal="false" append-to-body>
|
||||
<el-form ref="form" :model="form" :rules="rules" label-width="80px">
|
||||
<el-row>
|
||||
<el-col :span="12">
|
||||
<el-form-item label="工具编号" prop="toolCode">
|
||||
<el-input v-model="form.toolCode" placeholder="请输入工具编号"/>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="12">
|
||||
<el-form-item label="工具名称" prop="toolName">
|
||||
<el-input v-model="form.toolName" placeholder="请输入工具名称"/>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
<el-row>
|
||||
<el-col :span="12">
|
||||
<el-form-item label="负责人" prop="toolPrincipals">
|
||||
<el-input v-model="form.toolPrincipalsName" placeholder="请选择负责人" maxlength="11" @focus="toolPrincipalsChoose = true"/>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="12">
|
||||
<el-form-item label="归属部门" prop="toolRespDept">
|
||||
<treeselect v-model="form.toolRespDept" :options="deptOptions" :show-count="true" placeholder="请选择归属部门" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
|
||||
</el-row>
|
||||
<el-row>
|
||||
<el-col :span="12">
|
||||
<el-form-item label="工具来源" prop="toolSource">
|
||||
<el-input v-model="form.toolSource" placeholder="请输入工具来源"/>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="12">
|
||||
<el-form-item label="工具用途" prop="toolUse">
|
||||
<el-input v-model="form.toolUse" placeholder="请输入工具用途" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
<el-row>
|
||||
<el-col :span="12">
|
||||
<el-form-item label="工具类别">
|
||||
<el-select v-model="form.toolType" placeholder="请选择工具类别" style="width: 100%">
|
||||
<el-option
|
||||
v-for="dict in dict.type.tool_type"
|
||||
:key="dict.value"
|
||||
:label="dict.label"
|
||||
:value="dict.value"
|
||||
></el-option>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="12">
|
||||
<el-form-item label="状态">
|
||||
<el-radio-group v-model="form.status">
|
||||
<el-radio
|
||||
v-for="dict in dict.type.sys_normal_disable"
|
||||
:key="dict.value"
|
||||
:label="dict.value"
|
||||
>{{dict.label}}</el-radio>
|
||||
</el-radio-group>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
<el-row>
|
||||
<el-col :span="24">
|
||||
<el-form-item label="测试情况">
|
||||
<el-input v-model="form.testSituation" type="textarea" placeholder="请输入内容" maxlength="500" show-word-limit></el-input>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
<el-row>
|
||||
<el-col :span="24">
|
||||
<el-form-item label="功能描述">
|
||||
<el-input v-model="form.functionDesc" type="textarea" placeholder="请输入内容" maxlength="500" show-word-limit></el-input>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
<el-row>
|
||||
<el-col :span="24">
|
||||
<el-form-item label="适用条件">
|
||||
<el-input v-model="form.applyCondition" type="textarea" placeholder="请输入内容" maxlength="500" show-word-limit></el-input>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
<el-row>
|
||||
<el-col :span="24">
|
||||
<el-form-item label="操作说明">
|
||||
<el-input v-model="form.operateExplain" type="textarea" placeholder="请输入内容" maxlength="500" show-word-limit></el-input>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
<el-row>
|
||||
<el-col :span="24">
|
||||
<el-form-item label="备注">
|
||||
<el-input v-model="form.remark" type="textarea" placeholder="请输入内容" maxlength="500" 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>
|
||||
|
||||
<!-- 转派选人组件 -->
|
||||
<bl-user-selector ref="peopleSelect" :type="'single'" :isCheck="true" :open="toolPrincipalsChoose" @cancel="toolPrincipalsChoose=false" @submit="submitPeople"></bl-user-selector>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { listTool, getTool, delTool, addTool, updateTool } from "@/api/tool/tool";
|
||||
import { deptTreeSelect } from "@/api/system/user";
|
||||
import { getToken } from "@/utils/auth";
|
||||
import { Base64 } from 'js-base64'
|
||||
import Treeselect from "@riophae/vue-treeselect";
|
||||
import blUserSelector from "@/components/user-selector/src/user-selector";
|
||||
import "@riophae/vue-treeselect/dist/vue-treeselect.css";
|
||||
|
||||
export default {
|
||||
name: "User",
|
||||
dicts: ['sys_normal_disable', 'tool_type'],
|
||||
components: { Treeselect, blUserSelector },
|
||||
data() {
|
||||
return {
|
||||
// 遮罩层
|
||||
loading: true,
|
||||
// 选中数组
|
||||
ids: [],
|
||||
// 非单个禁用
|
||||
single: true,
|
||||
// 非多个禁用
|
||||
multiple: true,
|
||||
// 显示搜索条件
|
||||
showSearch: true,
|
||||
toolPrincipalsChoose: false,
|
||||
// 总条数
|
||||
total: 0,
|
||||
// 工具表格数据
|
||||
toolList: null,
|
||||
// 弹出层标题
|
||||
title: "",
|
||||
// 部门树选项
|
||||
deptOptions: undefined,
|
||||
toolPrincipalsData: [],
|
||||
// 是否显示弹出层
|
||||
open: false,
|
||||
// 部门名称
|
||||
deptName: undefined,
|
||||
// 默认密码
|
||||
initPassword: undefined,
|
||||
// 日期范围
|
||||
dateRange: [],
|
||||
// 岗位选项
|
||||
postOptions: [],
|
||||
// 角色选项
|
||||
roleOptions: [],
|
||||
// 表单参数
|
||||
form: {},
|
||||
defaultProps: {
|
||||
children: "children",
|
||||
label: "label"
|
||||
},
|
||||
// 用户导入参数
|
||||
upload: {
|
||||
// 是否显示弹出层(用户导入)
|
||||
open: false,
|
||||
// 弹出层标题(用户导入)
|
||||
title: "",
|
||||
// 是否禁用上传
|
||||
isUploading: false,
|
||||
// 是否更新已经存在的用户数据
|
||||
updateSupport: 0,
|
||||
// 设置上传的请求头部
|
||||
headers: { Authorization: "Bearer " + getToken() },
|
||||
// 上传的地址
|
||||
url: process.env.VUE_APP_BASE_API + "/system/user/importData"
|
||||
},
|
||||
// 查询参数
|
||||
queryParams: {
|
||||
pageNum: 1,
|
||||
pageSize: 10,
|
||||
toolCode: undefined,
|
||||
toolName: undefined,
|
||||
status: undefined
|
||||
},
|
||||
// 列信息
|
||||
columns: [
|
||||
{ key: 0, label: `工具编号`, visible: true },
|
||||
{ key: 1, label: `工具名称`, visible: true },
|
||||
{ key: 2, label: `工具类别`, visible: true },
|
||||
{ key: 3, label: `部门`, visible: true },
|
||||
{ key: 4, label: `负责人`, visible: true },
|
||||
{ key: 5, label: `状态`, visible: true },
|
||||
{ key: 6, label: `创建时间`, visible: true }
|
||||
],
|
||||
// 表单校验
|
||||
rules: {
|
||||
toolCode: [
|
||||
{ required: true, message: "工具编号不能为空", trigger: "blur" },
|
||||
{ min: 2, max: 30, message: '工具编号长度必须介于 2 和 30 之间', trigger: 'blur' }
|
||||
],
|
||||
toolName: [
|
||||
{ required: true, message: "工具名称不能为空", trigger: "blur" },
|
||||
{ max: 50, message: '工具名称不能超过50个字', trigger: 'blur' }
|
||||
],
|
||||
toolPrincipals: [
|
||||
{ required: true, message: "负责人不能为空", trigger: "blur" }
|
||||
],
|
||||
toolSource: [
|
||||
{ max: 50, message: '工具来源不能超过50个字', trigger: 'blur' }
|
||||
],
|
||||
toolUse: [
|
||||
{ max: 50, message: '工具用途不能超过50个字', trigger: 'blur' }
|
||||
]
|
||||
}
|
||||
};
|
||||
},
|
||||
watch: {
|
||||
// 根据名称筛选部门树
|
||||
deptName(val) {
|
||||
this.$refs.tree.filter(val);
|
||||
}
|
||||
},
|
||||
created() {
|
||||
this.getList();
|
||||
this.getDeptTree();
|
||||
this.getConfigKey("sys.user.initPassword").then(response => {
|
||||
this.initPassword = response.msg;
|
||||
});
|
||||
},
|
||||
methods: {
|
||||
submitPeople(peopleList){
|
||||
console.log(peopleList);
|
||||
this.form.toolPrincipals = peopleList[0]['userId']
|
||||
this.form.toolPrincipalsName = peopleList[0]['nickName']
|
||||
this.toolPrincipalsChoose = false;
|
||||
},
|
||||
/** 查询用户列表 */
|
||||
getList() {
|
||||
this.loading = true;
|
||||
listTool(this.addDateRange(this.queryParams, this.dateRange)).then(response => {
|
||||
this.toolList = response.rows;
|
||||
this.total = response.total;
|
||||
this.loading = false;
|
||||
}
|
||||
);
|
||||
},
|
||||
/** 查询部门下拉树结构 */
|
||||
getDeptTree() {
|
||||
deptTreeSelect().then(response => {
|
||||
this.deptOptions = response.data;
|
||||
});
|
||||
},
|
||||
getDeptName(items, id) {
|
||||
let label = ''
|
||||
items.forEach(item => {
|
||||
if(item['id'] == id){
|
||||
label = item['label']
|
||||
return
|
||||
}
|
||||
})
|
||||
if(label == ''){
|
||||
items.forEach(item => {
|
||||
if (item.children) {
|
||||
label = this.getDeptName(item.children, id)
|
||||
}
|
||||
})
|
||||
}
|
||||
return label
|
||||
},
|
||||
// 筛选节点
|
||||
filterNode(value, data) {
|
||||
if (!value) return true;
|
||||
return data.label.indexOf(value) !== -1;
|
||||
},
|
||||
// 节点单击事件
|
||||
handleNodeClick(data) {
|
||||
this.queryParams.toolRespDept = data.id;
|
||||
this.handleQuery();
|
||||
},
|
||||
// 用户状态修改
|
||||
handleStatusChange(row) {
|
||||
let text = row.status === "0" ? "启用" : "停用";
|
||||
this.$modal.confirm('确认要"' + text + '""' + row.userName + '"用户吗?').then(function() {
|
||||
return changeUserStatus(row.userId, row.status);
|
||||
}).then(() => {
|
||||
this.$modal.msgSuccess(text + "成功");
|
||||
}).catch(function() {
|
||||
row.status = row.status === "0" ? "1" : "0";
|
||||
});
|
||||
},
|
||||
// 取消按钮
|
||||
cancel() {
|
||||
this.open = false;
|
||||
this.reset();
|
||||
},
|
||||
// 表单重置
|
||||
reset() {
|
||||
this.form = {
|
||||
userId: undefined,
|
||||
deptId: undefined,
|
||||
userName: undefined,
|
||||
nickName: undefined,
|
||||
password: undefined,
|
||||
phonenumber: undefined,
|
||||
email: undefined,
|
||||
sex: undefined,
|
||||
status: "0",
|
||||
remark: undefined,
|
||||
postIds: [],
|
||||
roleIds: []
|
||||
};
|
||||
this.resetForm("form");
|
||||
},
|
||||
/** 搜索按钮操作 */
|
||||
handleQuery() {
|
||||
this.queryParams.pageNum = 1;
|
||||
this.getList();
|
||||
},
|
||||
/** 重置按钮操作 */
|
||||
resetQuery() {
|
||||
this.dateRange = [];
|
||||
this.resetForm("queryForm");
|
||||
this.queryParams.deptId = undefined;
|
||||
this.$refs.tree.setCurrentKey(null);
|
||||
this.handleQuery();
|
||||
},
|
||||
// 多选框选中数据
|
||||
handleSelectionChange(selection) {
|
||||
this.ids = selection.map(item => item.userId);
|
||||
this.single = selection.length != 1;
|
||||
this.multiple = !selection.length;
|
||||
},
|
||||
// 更多操作触发
|
||||
handleCommand(command, row) {
|
||||
switch (command) {
|
||||
case "handlePublish":
|
||||
this.handlePublish(row);
|
||||
break;
|
||||
case "handleAuthRole":
|
||||
this.handleAuthRole(row);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
},
|
||||
/** 新增按钮操作 */
|
||||
handleAdd() {
|
||||
this.reset();
|
||||
getTool().then(response => {
|
||||
this.postOptions = response.posts;
|
||||
this.roleOptions = response.roles;
|
||||
this.open = true;
|
||||
this.title = "添加工具";
|
||||
this.form.password = this.initPassword;
|
||||
});
|
||||
},
|
||||
/** 修改按钮操作 */
|
||||
handleUpdate(row) {
|
||||
this.reset();
|
||||
const toolId = row.toolId || this.ids;
|
||||
getTool(toolId).then(response => {
|
||||
this.form = response.data;
|
||||
this.postOptions = response.posts;
|
||||
this.roleOptions = response.roles;
|
||||
this.$set(this.form, "postIds", response.postIds);
|
||||
this.$set(this.form, "roleIds", response.roleIds);
|
||||
this.open = true;
|
||||
this.title = "修改工具";
|
||||
this.form.password = "";
|
||||
});
|
||||
},
|
||||
/** 发布按钮操作 */
|
||||
handlePublish(row) {
|
||||
},
|
||||
/** 提交按钮 */
|
||||
submitForm: function() {
|
||||
this.$refs["form"].validate(valid => {
|
||||
if (valid) {
|
||||
if (this.form.userId != undefined) {
|
||||
updateTool(this.form).then(response => {
|
||||
this.$modal.msgSuccess("修改成功");
|
||||
this.open = false;
|
||||
this.getList();
|
||||
});
|
||||
} else {
|
||||
addTool(this.form).then(response => {
|
||||
this.$modal.msgSuccess("新增成功");
|
||||
this.open = false;
|
||||
this.getList();
|
||||
}).catch((e) => {
|
||||
if (e.response.data.code === 400001001) {
|
||||
let deptName = this.getDeptName(this.deptOptions, this.form.toolRespDept)
|
||||
this.$alert('<strong>' + deptName + '</strong> 下已存在编号为 <strong>' + this.form.toolCode + '</strong> 的工具,请勿重复添加!', '提示', {
|
||||
dangerouslyUseHTMLString: true,
|
||||
confirmButtonText: '确定',
|
||||
callback: action => { }
|
||||
})
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
})
|
||||
},
|
||||
/** 删除按钮操作 */
|
||||
handleDelete(row) {
|
||||
const toolIds = row.toolId || this.ids;
|
||||
this.$modal.confirm('是否确认删除?').then(function() {
|
||||
return delTool(toolIds);
|
||||
}).then(() => {
|
||||
this.getList();
|
||||
this.$modal.msgSuccess("删除成功");
|
||||
}).catch(() => {});
|
||||
},
|
||||
/** 导出按钮操作 */
|
||||
handleExport() {
|
||||
this.download('system/user/export', {
|
||||
...this.queryParams
|
||||
}, `user_${new Date().getTime()}.xlsx`)
|
||||
},
|
||||
handleUseApply(){
|
||||
|
||||
},
|
||||
// 文件上传中处理
|
||||
handleFileUploadProgress(event, file, fileList) {
|
||||
this.upload.isUploading = true;
|
||||
},
|
||||
// 文件上传成功处理
|
||||
handleFileSuccess(response, file, fileList) {
|
||||
this.upload.open = false;
|
||||
this.upload.isUploading = false;
|
||||
this.$refs.upload.clearFiles();
|
||||
this.$alert("<div style='overflow: auto;overflow-x: hidden;max-height: 70vh;padding: 10px 20px 0;'>" + response.msg + "</div>", "导入结果", { dangerouslyUseHTMLString: true });
|
||||
this.getList();
|
||||
},
|
||||
// 提交上传文件
|
||||
submitFileForm() {
|
||||
this.$refs.upload.submit();
|
||||
}
|
||||
}
|
||||
};
|
||||
</script>
|
||||
22
src/views/workflow/config/index.vue
Normal file
22
src/views/workflow/config/index.vue
Normal file
@@ -0,0 +1,22 @@
|
||||
<template>
|
||||
<div class="app-container">
|
||||
<i-frame :src="workflowProcDefMgrUrl" />
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import iFrame from "@/components/iFrame/index";
|
||||
export default {
|
||||
name: "WorkflowConifg",
|
||||
components: { iFrame },
|
||||
data() {
|
||||
return {
|
||||
workflowProcDefMgrUrl: process.env.VUE_APP_WORKFLOW_MANAGE_URL + '/procDefMgr/list.do?customSso=1'
|
||||
};
|
||||
},
|
||||
created() {
|
||||
},
|
||||
methods: {
|
||||
}
|
||||
};
|
||||
</script>
|
||||
22
src/views/workflow/task/index.vue
Normal file
22
src/views/workflow/task/index.vue
Normal file
@@ -0,0 +1,22 @@
|
||||
<template>
|
||||
<div class="app-container">
|
||||
<i-frame :src="workflowTaskMgrUrl" />
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import iFrame from "@/components/iFrame/index";
|
||||
export default {
|
||||
name: "WorkflowTask",
|
||||
components: { iFrame },
|
||||
data() {
|
||||
return {
|
||||
workflowTaskMgrUrl: process.env.VUE_APP_WORKFLOW_MANAGE_URL + '/taskMgr/list.do?customSso=1'
|
||||
};
|
||||
},
|
||||
created() {
|
||||
},
|
||||
methods: {
|
||||
}
|
||||
};
|
||||
</script>
|
||||
Reference in New Issue
Block a user