固件上传&用户类型+客户
This commit is contained in:
@ -43,3 +43,10 @@ export function del(ids) {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 产品下拉
|
||||||
|
export function select() {
|
||||||
|
return request({
|
||||||
|
url: '/system/product/select',
|
||||||
|
method: 'get',
|
||||||
|
})
|
||||||
|
}
|
@ -125,3 +125,11 @@ export function importTemplate() {
|
|||||||
method: 'get'
|
method: 'get'
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 获取客户下拉
|
||||||
|
export function userSelect() {
|
||||||
|
return request({
|
||||||
|
url: '/system/user/select',
|
||||||
|
method: 'get'
|
||||||
|
})
|
||||||
|
}
|
||||||
|
@ -10,7 +10,7 @@ const service = axios.create({
|
|||||||
// axios中请求配置有baseURL选项,表示请求URL公共部分
|
// axios中请求配置有baseURL选项,表示请求URL公共部分
|
||||||
baseURL: process.env.VUE_APP_BASE_API,
|
baseURL: process.env.VUE_APP_BASE_API,
|
||||||
// 超时
|
// 超时
|
||||||
timeout: 10000
|
// timeout: 10000
|
||||||
})
|
})
|
||||||
// request拦截器
|
// request拦截器
|
||||||
service.interceptors.request.use(config => {
|
service.interceptors.request.use(config => {
|
||||||
|
@ -1,66 +1,90 @@
|
|||||||
<template>
|
<template>
|
||||||
<section class="app-container">
|
<section class="app-container">
|
||||||
<el-row>
|
<el-form :model="queryParams" ref="queryForm" :inline="true" v-show="showSearch" label-width="68px">
|
||||||
<el-col :span="4">左侧区域</el-col>
|
<el-form-item prop="version">
|
||||||
<el-col :span="20">
|
<el-input v-model="queryParams.version" placeholder="请输入版本号" clearable size="small" style="width: 240px"
|
||||||
<el-form :model="queryParams" ref="queryForm" :inline="true" v-show="showSearch" label-width="68px">
|
@keyup.enter.native="handleQuery" />
|
||||||
<el-form-item prop="version">
|
</el-form-item>
|
||||||
<el-input v-model="queryParams.version" placeholder="请输入版本号" clearable size="small" style="width: 240px"
|
<el-form-item>
|
||||||
@keyup.enter.native="handleQuery" />
|
<el-button type="cyan" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
|
||||||
</el-form-item>
|
<el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
|
||||||
<el-form-item>
|
</el-form-item>
|
||||||
<el-button type="cyan" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
|
</el-form>
|
||||||
<el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
|
<el-row :gutter="10" class="mb8">
|
||||||
</el-form-item>
|
<el-col :span="1.5">
|
||||||
</el-form>
|
<el-button size="mini" type="primary" icon="el-icon-plus" @click="handleAdd" v-hasPermi="['system:management:add']">增加
|
||||||
<el-row :gutter="10" class="mb8">
|
</el-button>
|
||||||
<el-col :span="1.5">
|
|
||||||
<el-button size="mini" type="primary" icon="el-icon-plus" @click="handleAdd" v-hasPermi="['system:management:add']">增加
|
|
||||||
</el-button>
|
|
||||||
</el-col>
|
|
||||||
<el-col :span="1.5">
|
|
||||||
<el-button type="danger" icon="el-icon-delete" size="mini" :disabled="multiple" @click="handleDelete"
|
|
||||||
v-hasPermi="['monitor:management:remove']">批量删除</el-button>
|
|
||||||
</el-col>
|
|
||||||
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
|
|
||||||
</el-row>
|
|
||||||
<el-table :data="tableData" style="width: 100%" @selection-change="handleSelectionChange">
|
|
||||||
<el-table-column type="selection" width="55" align="center">
|
|
||||||
</el-table-column>
|
|
||||||
<el-table-column prop="version" align="center" label="固件版本号">
|
|
||||||
</el-table-column>
|
|
||||||
<el-table-column prop="fileName" align="center" label="固件名称">
|
|
||||||
</el-table-column>
|
|
||||||
<el-table-column prop="status" align="center" label="状态">
|
|
||||||
</el-table-column>
|
|
||||||
<el-table-column prop="remark" align="center" label="备注">
|
|
||||||
</el-table-column>
|
|
||||||
<el-table-column label="操作" align="center" class-name="small-padding fixed-width">
|
|
||||||
<template slot-scope="scope">
|
|
||||||
<el-button size="mini" type="text" icon="el-icon-edit" @click="handleUpdate(scope.row)"
|
|
||||||
v-hasPermi="['system:management:edit']">
|
|
||||||
修改
|
|
||||||
</el-button>
|
|
||||||
<el-button class="text-danger" size="mini" type="text" icon="el-icon-delete" @click="handleDelete(scope.row)"
|
|
||||||
v-hasPermi="['system:management:remove']">删除</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-col>
|
</el-col>
|
||||||
|
<el-col :span="1.5">
|
||||||
|
<el-button type="danger" icon="el-icon-delete" size="mini" :disabled="multiple" @click="handleDelete"
|
||||||
|
v-hasPermi="['monitor:management:remove']">批量删除</el-button>
|
||||||
|
</el-col>
|
||||||
|
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
|
||||||
</el-row>
|
</el-row>
|
||||||
|
<el-table :data="tableData" style="width: 100%" @selection-change="handleSelectionChange">
|
||||||
|
<el-table-column type="selection" width="55" align="center">
|
||||||
|
</el-table-column>
|
||||||
|
<el-table-column prop="version" align="center" label="固件版本号">
|
||||||
|
</el-table-column>
|
||||||
|
<el-table-column prop="fileName" align="center" label="固件名称">
|
||||||
|
</el-table-column>
|
||||||
|
<el-table-column prop="status" align="center" label="状态">
|
||||||
|
</el-table-column>
|
||||||
|
<el-table-column prop="remark" align="center" label="备注">
|
||||||
|
</el-table-column>
|
||||||
|
<el-table-column label="操作" align="center" class-name="small-padding fixed-width">
|
||||||
|
<template slot-scope="scope">
|
||||||
|
<el-button size="mini" type="text" icon="el-icon-edit" @click="handleUpdate(scope.row)" v-hasPermi="['system:management:edit']">
|
||||||
|
修改
|
||||||
|
</el-button>
|
||||||
|
<el-button class="text-danger" size="mini" type="text" icon="el-icon-delete" @click="handleDelete(scope.row)"
|
||||||
|
v-hasPermi="['system:management:remove']">删除</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="500px" append-to-body>
|
<el-dialog :title="title" :visible.sync="open" width="500px" append-to-body>
|
||||||
<el-form ref="form" :model="form" :rules="rules" label-width="100px">
|
<el-form ref="form" :model="form" :rules="rules" label-width="100px">
|
||||||
|
<el-form-item label="产品" prop="productId">
|
||||||
|
<el-select v-model="form.productId" clearable placeholder="请选择" @change="productIdChange">
|
||||||
|
<el-option v-for="item in productSelectList" :key="item.id" :label="item.productName" :value="item.productId">
|
||||||
|
</el-option>
|
||||||
|
</el-select>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="节点" prop="nodeId">
|
||||||
|
<el-select v-model="form.nodeId" clearable placeholder="请选择">
|
||||||
|
<el-option v-for="item in nodeSelectList" :key="item.id" :label="item.nodeName" :value="item.nodeId">
|
||||||
|
</el-option>
|
||||||
|
</el-select>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="客户" prop="userId">
|
||||||
|
<el-select v-model="form.userId" clearable placeholder="请选择" @change="userIdChange">
|
||||||
|
<el-option v-for="item in userSelectList" :key="item.id" :label="item.nickName" :value="item.userId" >
|
||||||
|
</el-option>
|
||||||
|
</el-select>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="项目" prop="projectId">
|
||||||
|
<el-select v-model="form.projectId" clearable placeholder="请选择">
|
||||||
|
<el-option v-for="item in projectSelectList" :key="item.id" :label="item.projectName" :value="item.projectId">
|
||||||
|
</el-option>
|
||||||
|
</el-select>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="上传文件" prop="version">
|
||||||
|
<el-upload ref="upload" :limit="1" :show-file-list="false" accept=".bin" :headers="upload.headers" :action="upload.url"
|
||||||
|
:disabled="upload.isUploading" :on-progress="handleFileUploadProgress" :on-success="handleFileSuccess">
|
||||||
|
<el-button size="small" type="primary">点击上传</el-button>
|
||||||
|
<div slot="tip" class="el-upload__tip">
|
||||||
|
<el-input v-model="form.fileName" disabled placeholder="文件名称" />
|
||||||
|
</div>
|
||||||
|
</el-upload>
|
||||||
|
</el-form-item>
|
||||||
<el-form-item label="固件版本号" prop="version">
|
<el-form-item label="固件版本号" prop="version">
|
||||||
<el-input v-model="form.version" placeholder="请输入固件版本号" />
|
<el-input v-model="form.version" placeholder="请输入固件版本号" />
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item label="固件名称" prop="fileName">
|
<el-form-item label="硬件版本号" prop="fwVersion">
|
||||||
<el-input v-model="form.fileName" placeholder="请输入固件名称" />
|
<el-input v-model="form.fwVersion" placeholder="请输入硬件版本号" />
|
||||||
</el-form-item>
|
|
||||||
<el-form-item label="状态">
|
|
||||||
<el-input v-model="form.status" />
|
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item label="备注">
|
<el-form-item label="备注">
|
||||||
<el-input v-model="form.remark" />
|
<el-input v-model="form.remark" />
|
||||||
@ -75,11 +99,30 @@
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
|
import { getToken } from "@/utils/auth";
|
||||||
import { list, get, add, update, del } from "@/api/firmware/management";
|
import { list, get, add, update, del } from "@/api/firmware/management";
|
||||||
|
import { select as productSelect } from "@/api/hardware/product";
|
||||||
|
import { select as nodeSelect } from "@/api/hardware/node";
|
||||||
|
import { select as projectSelect } from "@/api/hardware/project";
|
||||||
|
import { userSelect } from "@/api/system/user";
|
||||||
export default {
|
export default {
|
||||||
name: "FirmwareList",
|
name: "FirmwareList",
|
||||||
data () {
|
data () {
|
||||||
return {
|
return {
|
||||||
|
// 产品下拉列表
|
||||||
|
productSelectList: [],
|
||||||
|
nodeSelectList: [],
|
||||||
|
userSelectList: [],
|
||||||
|
projectSelectList: [],
|
||||||
|
// 固件上传
|
||||||
|
upload: {
|
||||||
|
// 是否禁用上传
|
||||||
|
isUploading: false,
|
||||||
|
// 设置上传的请求头部
|
||||||
|
headers: { Authorization: "Bearer " + getToken() },
|
||||||
|
// 上传的地址
|
||||||
|
url: process.env.VUE_APP_BASE_API + "/minio/uploadFirmwareFile"
|
||||||
|
},
|
||||||
// 选中数组
|
// 选中数组
|
||||||
ids: [],
|
ids: [],
|
||||||
// 非多个禁用
|
// 非多个禁用
|
||||||
@ -105,16 +148,81 @@ export default {
|
|||||||
version: [
|
version: [
|
||||||
{ required: true, message: "固件版本号不能为空", trigger: "blur" },
|
{ required: true, message: "固件版本号不能为空", trigger: "blur" },
|
||||||
],
|
],
|
||||||
|
fwVersion: [
|
||||||
|
{ required: true, message: "硬件版本号不能为空", trigger: "blur" },
|
||||||
|
],
|
||||||
fileName: [
|
fileName: [
|
||||||
{ required: true, message: "固件名称不能为空", trigger: "blur" },
|
{ required: true, message: "必须上传文件", trigger: "blur" },
|
||||||
]
|
],
|
||||||
|
productId: [
|
||||||
|
{ required: true, message: "产品不能为空", trigger: "blur" },
|
||||||
|
],
|
||||||
|
nodeId: [
|
||||||
|
{ required: true, message: "节点不能为空", trigger: "blur" },
|
||||||
|
],
|
||||||
|
userId: [
|
||||||
|
{ required: true, message: "客户不能为空", trigger: "blur" },
|
||||||
|
],
|
||||||
|
projectId: [
|
||||||
|
{ required: true, message: "项目不能为空", trigger: "blur" },
|
||||||
|
],
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
created () {
|
created () {
|
||||||
|
productSelect().then(({ code, msg, select }) => {
|
||||||
|
if (code == 200) {
|
||||||
|
this.productSelectList = select;
|
||||||
|
} else {
|
||||||
|
this.$message.error(msg);
|
||||||
|
}
|
||||||
|
})
|
||||||
|
userSelect().then(({ code, msg, select }) => {
|
||||||
|
if (code == 200) {
|
||||||
|
this.userSelectList = select;
|
||||||
|
} else {
|
||||||
|
this.$message.error(msg);
|
||||||
|
}
|
||||||
|
})
|
||||||
this.getList();
|
this.getList();
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
|
productIdChange (productId) {
|
||||||
|
delete this.form.nodeId;
|
||||||
|
nodeSelect({ productId }).then(({ code, msg, select }) => {
|
||||||
|
if (code == 200) {
|
||||||
|
this.nodeSelectList = select;
|
||||||
|
} else {
|
||||||
|
this.$message.error(msg);
|
||||||
|
}
|
||||||
|
})
|
||||||
|
},
|
||||||
|
userIdChange(userId) {
|
||||||
|
delete this.form.projectId;
|
||||||
|
projectSelect({ userId }).then(({ code, msg, select }) => {
|
||||||
|
if (code == 200) {
|
||||||
|
this.projectSelectList = select;
|
||||||
|
} else {
|
||||||
|
this.$message.error(msg);
|
||||||
|
}
|
||||||
|
})
|
||||||
|
},
|
||||||
|
// 文件上传中处理
|
||||||
|
handleFileUploadProgress (event, file, fileList) {
|
||||||
|
this.upload.isUploading = true;
|
||||||
|
},
|
||||||
|
// 文件上传成功处理
|
||||||
|
handleFileSuccess (res, file, fileList) {
|
||||||
|
if (res.code == 200) {
|
||||||
|
this.$message.success(res.msg);
|
||||||
|
let { fileName, length, url } = res;
|
||||||
|
this.form = Object.assign({}, this.form, { fileName, length, filePath: url });
|
||||||
|
} else {
|
||||||
|
this.$message.error(res.msg);
|
||||||
|
}
|
||||||
|
this.upload.isUploading = false;
|
||||||
|
this.$refs.upload.clearFiles();
|
||||||
|
},
|
||||||
/** 搜索按钮操作 */
|
/** 搜索按钮操作 */
|
||||||
handleQuery () {
|
handleQuery () {
|
||||||
this.queryParams.pageNum = 1;
|
this.queryParams.pageNum = 1;
|
||||||
|
@ -4,77 +4,33 @@
|
|||||||
<!--部门数据-->
|
<!--部门数据-->
|
||||||
<el-col :span="4" :xs="24">
|
<el-col :span="4" :xs="24">
|
||||||
<div class="head-container">
|
<div class="head-container">
|
||||||
<el-input
|
<el-input v-model="deptName" placeholder="请输入部门名称" clearable size="small" prefix-icon="el-icon-search"
|
||||||
v-model="deptName"
|
style="margin-bottom: 20px" />
|
||||||
placeholder="请输入部门名称"
|
|
||||||
clearable
|
|
||||||
size="small"
|
|
||||||
prefix-icon="el-icon-search"
|
|
||||||
style="margin-bottom: 20px"
|
|
||||||
/>
|
|
||||||
</div>
|
</div>
|
||||||
<div class="head-container">
|
<div class="head-container">
|
||||||
<el-tree
|
<el-tree :data="deptOptions" :props="defaultProps" :expand-on-click-node="false" :filter-node-method="filterNode" ref="tree"
|
||||||
:data="deptOptions"
|
default-expand-all @node-click="handleNodeClick" />
|
||||||
:props="defaultProps"
|
|
||||||
:expand-on-click-node="false"
|
|
||||||
:filter-node-method="filterNode"
|
|
||||||
ref="tree"
|
|
||||||
default-expand-all
|
|
||||||
@node-click="handleNodeClick"
|
|
||||||
/>
|
|
||||||
</div>
|
</div>
|
||||||
</el-col>
|
</el-col>
|
||||||
<!--用户数据-->
|
<!--用户数据-->
|
||||||
<el-col :span="20" :xs="24">
|
<el-col :span="20" :xs="24">
|
||||||
<el-form :model="queryParams" ref="queryForm" :inline="true" v-show="showSearch" label-width="68px">
|
<el-form :model="queryParams" ref="queryForm" :inline="true" v-show="showSearch" label-width="68px">
|
||||||
<el-form-item label="用户名称" prop="userName">
|
<el-form-item label="用户名称" prop="userName">
|
||||||
<el-input
|
<el-input v-model="queryParams.userName" placeholder="请输入用户名称" clearable size="small" style="width: 240px"
|
||||||
v-model="queryParams.userName"
|
@keyup.enter.native="handleQuery" />
|
||||||
placeholder="请输入用户名称"
|
|
||||||
clearable
|
|
||||||
size="small"
|
|
||||||
style="width: 240px"
|
|
||||||
@keyup.enter.native="handleQuery"
|
|
||||||
/>
|
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item label="手机号码" prop="phonenumber">
|
<el-form-item label="手机号码" prop="phonenumber">
|
||||||
<el-input
|
<el-input v-model="queryParams.phonenumber" placeholder="请输入手机号码" clearable size="small" style="width: 240px"
|
||||||
v-model="queryParams.phonenumber"
|
@keyup.enter.native="handleQuery" />
|
||||||
placeholder="请输入手机号码"
|
|
||||||
clearable
|
|
||||||
size="small"
|
|
||||||
style="width: 240px"
|
|
||||||
@keyup.enter.native="handleQuery"
|
|
||||||
/>
|
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item label="状态" prop="status">
|
<el-form-item label="状态" prop="status">
|
||||||
<el-select
|
<el-select v-model="queryParams.status" placeholder="用户状态" clearable size="small" style="width: 240px">
|
||||||
v-model="queryParams.status"
|
<el-option v-for="dict in statusOptions" :key="dict.dictValue" :label="dict.dictLabel" :value="dict.dictValue" />
|
||||||
placeholder="用户状态"
|
|
||||||
clearable
|
|
||||||
size="small"
|
|
||||||
style="width: 240px"
|
|
||||||
>
|
|
||||||
<el-option
|
|
||||||
v-for="dict in statusOptions"
|
|
||||||
:key="dict.dictValue"
|
|
||||||
:label="dict.dictLabel"
|
|
||||||
:value="dict.dictValue"
|
|
||||||
/>
|
|
||||||
</el-select>
|
</el-select>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item label="创建时间">
|
<el-form-item label="创建时间">
|
||||||
<el-date-picker
|
<el-date-picker v-model="dateRange" size="small" style="width: 240px" value-format="yyyy-MM-dd" type="daterange"
|
||||||
v-model="dateRange"
|
range-separator="-" start-placeholder="开始日期" end-placeholder="结束日期"></el-date-picker>
|
||||||
size="small"
|
|
||||||
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-form-item>
|
<el-form-item>
|
||||||
<el-button type="cyan" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
|
<el-button type="cyan" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
|
||||||
@ -84,51 +40,23 @@
|
|||||||
|
|
||||||
<el-row :gutter="10" class="mb8">
|
<el-row :gutter="10" class="mb8">
|
||||||
<el-col :span="1.5">
|
<el-col :span="1.5">
|
||||||
<el-button
|
<el-button type="primary" icon="el-icon-plus" size="mini" @click="handleAdd" v-hasPermi="['system:user:add']">新增</el-button>
|
||||||
type="primary"
|
|
||||||
icon="el-icon-plus"
|
|
||||||
size="mini"
|
|
||||||
@click="handleAdd"
|
|
||||||
v-hasPermi="['system:user:add']"
|
|
||||||
>新增</el-button>
|
|
||||||
</el-col>
|
</el-col>
|
||||||
<el-col :span="1.5">
|
<el-col :span="1.5">
|
||||||
<el-button
|
<el-button type="success" icon="el-icon-edit" size="mini" :disabled="single" @click="handleUpdate"
|
||||||
type="success"
|
v-hasPermi="['system:user:edit']">修改</el-button>
|
||||||
icon="el-icon-edit"
|
|
||||||
size="mini"
|
|
||||||
:disabled="single"
|
|
||||||
@click="handleUpdate"
|
|
||||||
v-hasPermi="['system:user:edit']"
|
|
||||||
>修改</el-button>
|
|
||||||
</el-col>
|
</el-col>
|
||||||
<el-col :span="1.5">
|
<el-col :span="1.5">
|
||||||
<el-button
|
<el-button type="danger" icon="el-icon-delete" size="mini" :disabled="multiple" @click="handleDelete"
|
||||||
type="danger"
|
v-hasPermi="['system:user:remove']">删除</el-button>
|
||||||
icon="el-icon-delete"
|
|
||||||
size="mini"
|
|
||||||
:disabled="multiple"
|
|
||||||
@click="handleDelete"
|
|
||||||
v-hasPermi="['system:user:remove']"
|
|
||||||
>删除</el-button>
|
|
||||||
</el-col>
|
</el-col>
|
||||||
<el-col :span="1.5">
|
<el-col :span="1.5">
|
||||||
<el-button
|
<el-button type="info" icon="el-icon-upload2" size="mini" @click="handleImport" v-hasPermi="['system:user:import']">导入
|
||||||
type="info"
|
</el-button>
|
||||||
icon="el-icon-upload2"
|
|
||||||
size="mini"
|
|
||||||
@click="handleImport"
|
|
||||||
v-hasPermi="['system:user:import']"
|
|
||||||
>导入</el-button>
|
|
||||||
</el-col>
|
</el-col>
|
||||||
<el-col :span="1.5">
|
<el-col :span="1.5">
|
||||||
<el-button
|
<el-button type="warning" icon="el-icon-download" size="mini" @click="handleExport" v-hasPermi="['system:user:export']">导出
|
||||||
type="warning"
|
</el-button>
|
||||||
icon="el-icon-download"
|
|
||||||
size="mini"
|
|
||||||
@click="handleExport"
|
|
||||||
v-hasPermi="['system:user:export']"
|
|
||||||
>导出</el-button>
|
|
||||||
</el-col>
|
</el-col>
|
||||||
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
|
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
|
||||||
</el-row>
|
</el-row>
|
||||||
@ -142,12 +70,7 @@
|
|||||||
<el-table-column label="手机号码" align="center" prop="phonenumber" width="120" />
|
<el-table-column label="手机号码" align="center" prop="phonenumber" width="120" />
|
||||||
<el-table-column label="状态" align="center">
|
<el-table-column label="状态" align="center">
|
||||||
<template slot-scope="scope">
|
<template slot-scope="scope">
|
||||||
<el-switch
|
<el-switch v-model="scope.row.status" active-value="0" inactive-value="1" @change="handleStatusChange(scope.row)"></el-switch>
|
||||||
v-model="scope.row.status"
|
|
||||||
active-value="0"
|
|
||||||
inactive-value="1"
|
|
||||||
@change="handleStatusChange(scope.row)"
|
|
||||||
></el-switch>
|
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
<el-table-column label="创建时间" align="center" prop="createTime" width="160">
|
<el-table-column label="创建时间" align="center" prop="createTime" width="160">
|
||||||
@ -155,46 +78,20 @@
|
|||||||
<span>{{ parseTime(scope.row.createTime) }}</span>
|
<span>{{ parseTime(scope.row.createTime) }}</span>
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
<el-table-column
|
<el-table-column label="操作" align="center" width="160" class-name="small-padding fixed-width">
|
||||||
label="操作"
|
|
||||||
align="center"
|
|
||||||
width="160"
|
|
||||||
class-name="small-padding fixed-width"
|
|
||||||
>
|
|
||||||
<template slot-scope="scope">
|
<template slot-scope="scope">
|
||||||
<el-button
|
<el-button size="mini" type="text" icon="el-icon-edit" @click="handleUpdate(scope.row)" v-hasPermi="['system:user:edit']">修改
|
||||||
size="mini"
|
</el-button>
|
||||||
type="text"
|
<el-button v-if="scope.row.userId !== 1" size="mini" type="text" icon="el-icon-delete" @click="handleDelete(scope.row)"
|
||||||
icon="el-icon-edit"
|
v-hasPermi="['system:user:remove']">删除</el-button>
|
||||||
@click="handleUpdate(scope.row)"
|
<el-button size="mini" type="text" icon="el-icon-key" @click="handleResetPwd(scope.row)"
|
||||||
v-hasPermi="['system:user:edit']"
|
v-hasPermi="['system:user:resetPwd']">重置</el-button>
|
||||||
>修改</el-button>
|
|
||||||
<el-button
|
|
||||||
v-if="scope.row.userId !== 1"
|
|
||||||
size="mini"
|
|
||||||
type="text"
|
|
||||||
icon="el-icon-delete"
|
|
||||||
@click="handleDelete(scope.row)"
|
|
||||||
v-hasPermi="['system:user:remove']"
|
|
||||||
>删除</el-button>
|
|
||||||
<el-button
|
|
||||||
size="mini"
|
|
||||||
type="text"
|
|
||||||
icon="el-icon-key"
|
|
||||||
@click="handleResetPwd(scope.row)"
|
|
||||||
v-hasPermi="['system:user:resetPwd']"
|
|
||||||
>重置</el-button>
|
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
</el-table>
|
</el-table>
|
||||||
|
|
||||||
<pagination
|
<pagination v-show="total>0" :total="total" :page.sync="queryParams.pageNum" :limit.sync="queryParams.pageSize"
|
||||||
v-show="total>0"
|
@pagination="getList" />
|
||||||
:total="total"
|
|
||||||
:page.sync="queryParams.pageNum"
|
|
||||||
:limit.sync="queryParams.pageSize"
|
|
||||||
@pagination="getList"
|
|
||||||
/>
|
|
||||||
</el-col>
|
</el-col>
|
||||||
</el-row>
|
</el-row>
|
||||||
|
|
||||||
@ -241,51 +138,40 @@
|
|||||||
<el-col :span="12">
|
<el-col :span="12">
|
||||||
<el-form-item label="用户性别">
|
<el-form-item label="用户性别">
|
||||||
<el-select v-model="form.sex" placeholder="请选择">
|
<el-select v-model="form.sex" placeholder="请选择">
|
||||||
<el-option
|
<el-option v-for="dict in sexOptions" :key="dict.dictValue" :label="dict.dictLabel" :value="dict.dictValue"></el-option>
|
||||||
v-for="dict in sexOptions"
|
|
||||||
:key="dict.dictValue"
|
|
||||||
:label="dict.dictLabel"
|
|
||||||
:value="dict.dictValue"
|
|
||||||
></el-option>
|
|
||||||
</el-select>
|
</el-select>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
</el-col>
|
</el-col>
|
||||||
<el-col :span="12">
|
<el-col :span="12">
|
||||||
<el-form-item label="状态">
|
<el-form-item label="状态">
|
||||||
<el-radio-group v-model="form.status">
|
<el-radio-group v-model="form.status">
|
||||||
<el-radio
|
<el-radio v-for="dict in statusOptions" :key="dict.dictValue" :label="dict.dictValue">{{dict.dictLabel}}</el-radio>
|
||||||
v-for="dict in statusOptions"
|
|
||||||
:key="dict.dictValue"
|
|
||||||
:label="dict.dictValue"
|
|
||||||
>{{dict.dictLabel}}</el-radio>
|
|
||||||
</el-radio-group>
|
</el-radio-group>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
</el-col>
|
</el-col>
|
||||||
</el-row>
|
</el-row>
|
||||||
<el-row>
|
<el-row>
|
||||||
<el-col :span="12">
|
<el-col v-if="form.userId == undefined" :span="12">
|
||||||
|
<el-form-item label="用户类型">
|
||||||
|
<el-select v-model="form.userType" placeholder="请选择">
|
||||||
|
<el-option label="系统用户" value="00"></el-option>
|
||||||
|
<el-option label="客户" value="01"></el-option>
|
||||||
|
</el-select>
|
||||||
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
|
<el-col v-if="form.userType == '00'" :span="12">
|
||||||
<el-form-item label="岗位">
|
<el-form-item label="岗位">
|
||||||
<el-select v-model="form.postIds" multiple placeholder="请选择">
|
<el-select v-model="form.postIds" multiple placeholder="请选择">
|
||||||
<el-option
|
<el-option v-for="item in postOptions" :key="item.postId" :label="item.postName" :value="item.postId"
|
||||||
v-for="item in postOptions"
|
:disabled="item.status == 1"></el-option>
|
||||||
:key="item.postId"
|
|
||||||
:label="item.postName"
|
|
||||||
:value="item.postId"
|
|
||||||
:disabled="item.status == 1"
|
|
||||||
></el-option>
|
|
||||||
</el-select>
|
</el-select>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
</el-col>
|
</el-col>
|
||||||
<el-col :span="12">
|
<el-col :span="12">
|
||||||
<el-form-item label="角色">
|
<el-form-item label="角色">
|
||||||
<el-select v-model="form.roleIds" multiple placeholder="请选择">
|
<el-select v-model="form.roleIds" multiple placeholder="请选择">
|
||||||
<el-option
|
<el-option v-for="item in roleOptions" :key="item.roleId" :label="item.roleName" :value="item.roleId"
|
||||||
v-for="item in roleOptions"
|
:disabled="item.status == 1"></el-option>
|
||||||
:key="item.roleId"
|
|
||||||
:label="item.roleName"
|
|
||||||
:value="item.roleId"
|
|
||||||
:disabled="item.status == 1"
|
|
||||||
></el-option>
|
|
||||||
</el-select>
|
</el-select>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
</el-col>
|
</el-col>
|
||||||
@ -306,18 +192,9 @@
|
|||||||
|
|
||||||
<!-- 用户导入对话框 -->
|
<!-- 用户导入对话框 -->
|
||||||
<el-dialog :title="upload.title" :visible.sync="upload.open" width="400px" append-to-body>
|
<el-dialog :title="upload.title" :visible.sync="upload.open" width="400px" append-to-body>
|
||||||
<el-upload
|
<el-upload ref="upload" :limit="1" accept=".xlsx, .xls" :headers="upload.headers"
|
||||||
ref="upload"
|
:action="upload.url + '?updateSupport=' + upload.updateSupport" :disabled="upload.isUploading"
|
||||||
:limit="1"
|
:on-progress="handleFileUploadProgress" :on-success="handleFileSuccess" :auto-upload="false" drag>
|
||||||
accept=".xlsx, .xls"
|
|
||||||
:headers="upload.headers"
|
|
||||||
:action="upload.url + '?updateSupport=' + upload.updateSupport"
|
|
||||||
:disabled="upload.isUploading"
|
|
||||||
:on-progress="handleFileUploadProgress"
|
|
||||||
:on-success="handleFileSuccess"
|
|
||||||
:auto-upload="false"
|
|
||||||
drag
|
|
||||||
>
|
|
||||||
<i class="el-icon-upload"></i>
|
<i class="el-icon-upload"></i>
|
||||||
<div class="el-upload__text">
|
<div class="el-upload__text">
|
||||||
将文件拖到此处,或
|
将文件拖到此处,或
|
||||||
@ -347,7 +224,7 @@ import "@riophae/vue-treeselect/dist/vue-treeselect.css";
|
|||||||
export default {
|
export default {
|
||||||
name: "User",
|
name: "User",
|
||||||
components: { Treeselect },
|
components: { Treeselect },
|
||||||
data() {
|
data () {
|
||||||
return {
|
return {
|
||||||
// 遮罩层
|
// 遮罩层
|
||||||
loading: true,
|
loading: true,
|
||||||
@ -448,11 +325,11 @@ export default {
|
|||||||
},
|
},
|
||||||
watch: {
|
watch: {
|
||||||
// 根据名称筛选部门树
|
// 根据名称筛选部门树
|
||||||
deptName(val) {
|
deptName (val) {
|
||||||
this.$refs.tree.filter(val);
|
this.$refs.tree.filter(val);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
created() {
|
created () {
|
||||||
this.getList();
|
this.getList();
|
||||||
this.getTreeselect();
|
this.getTreeselect();
|
||||||
this.getDicts("sys_normal_disable").then(response => {
|
this.getDicts("sys_normal_disable").then(response => {
|
||||||
@ -467,53 +344,53 @@ export default {
|
|||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
/** 查询用户列表 */
|
/** 查询用户列表 */
|
||||||
getList() {
|
getList () {
|
||||||
this.loading = true;
|
this.loading = true;
|
||||||
listUser(this.addDateRange(this.queryParams, this.dateRange)).then(response => {
|
listUser(this.addDateRange(this.queryParams, this.dateRange)).then(response => {
|
||||||
this.userList = response.rows;
|
this.userList = response.rows;
|
||||||
this.total = response.total;
|
this.total = response.total;
|
||||||
this.loading = false;
|
this.loading = false;
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
/** 查询部门下拉树结构 */
|
/** 查询部门下拉树结构 */
|
||||||
getTreeselect() {
|
getTreeselect () {
|
||||||
treeselect().then(response => {
|
treeselect().then(response => {
|
||||||
this.deptOptions = response.data;
|
this.deptOptions = response.data;
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
// 筛选节点
|
// 筛选节点
|
||||||
filterNode(value, data) {
|
filterNode (value, data) {
|
||||||
if (!value) return true;
|
if (!value) return true;
|
||||||
return data.label.indexOf(value) !== -1;
|
return data.label.indexOf(value) !== -1;
|
||||||
},
|
},
|
||||||
// 节点单击事件
|
// 节点单击事件
|
||||||
handleNodeClick(data) {
|
handleNodeClick (data) {
|
||||||
this.queryParams.deptId = data.id;
|
this.queryParams.deptId = data.id;
|
||||||
this.getList();
|
this.getList();
|
||||||
},
|
},
|
||||||
// 用户状态修改
|
// 用户状态修改
|
||||||
handleStatusChange(row) {
|
handleStatusChange (row) {
|
||||||
let text = row.status === "0" ? "启用" : "停用";
|
let text = row.status === "0" ? "启用" : "停用";
|
||||||
this.$confirm('确认要"' + text + '""' + row.userName + '"用户吗?', "警告", {
|
this.$confirm('确认要"' + text + '""' + row.userName + '"用户吗?', "警告", {
|
||||||
confirmButtonText: "确定",
|
confirmButtonText: "确定",
|
||||||
cancelButtonText: "取消",
|
cancelButtonText: "取消",
|
||||||
type: "warning"
|
type: "warning"
|
||||||
}).then(function() {
|
}).then(function () {
|
||||||
return changeUserStatus(row.userId, row.status);
|
return changeUserStatus(row.userId, row.status);
|
||||||
}).then(() => {
|
}).then(() => {
|
||||||
this.msgSuccess(text + "成功");
|
this.msgSuccess(text + "成功");
|
||||||
}).catch(function() {
|
}).catch(function () {
|
||||||
row.status = row.status === "0" ? "1" : "0";
|
row.status = row.status === "0" ? "1" : "0";
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
// 取消按钮
|
// 取消按钮
|
||||||
cancel() {
|
cancel () {
|
||||||
this.open = false;
|
this.open = false;
|
||||||
this.reset();
|
this.reset();
|
||||||
},
|
},
|
||||||
// 表单重置
|
// 表单重置
|
||||||
reset() {
|
reset () {
|
||||||
this.form = {
|
this.form = {
|
||||||
userId: undefined,
|
userId: undefined,
|
||||||
deptId: undefined,
|
deptId: undefined,
|
||||||
@ -531,24 +408,24 @@ export default {
|
|||||||
this.resetForm("form");
|
this.resetForm("form");
|
||||||
},
|
},
|
||||||
/** 搜索按钮操作 */
|
/** 搜索按钮操作 */
|
||||||
handleQuery() {
|
handleQuery () {
|
||||||
this.queryParams.page = 1;
|
this.queryParams.page = 1;
|
||||||
this.getList();
|
this.getList();
|
||||||
},
|
},
|
||||||
/** 重置按钮操作 */
|
/** 重置按钮操作 */
|
||||||
resetQuery() {
|
resetQuery () {
|
||||||
this.dateRange = [];
|
this.dateRange = [];
|
||||||
this.resetForm("queryForm");
|
this.resetForm("queryForm");
|
||||||
this.handleQuery();
|
this.handleQuery();
|
||||||
},
|
},
|
||||||
// 多选框选中数据
|
// 多选框选中数据
|
||||||
handleSelectionChange(selection) {
|
handleSelectionChange (selection) {
|
||||||
this.ids = selection.map(item => item.userId);
|
this.ids = selection.map(item => item.userId);
|
||||||
this.single = selection.length != 1;
|
this.single = selection.length != 1;
|
||||||
this.multiple = !selection.length;
|
this.multiple = !selection.length;
|
||||||
},
|
},
|
||||||
/** 新增按钮操作 */
|
/** 新增按钮操作 */
|
||||||
handleAdd() {
|
handleAdd () {
|
||||||
this.reset();
|
this.reset();
|
||||||
this.getTreeselect();
|
this.getTreeselect();
|
||||||
getUser().then(response => {
|
getUser().then(response => {
|
||||||
@ -560,7 +437,7 @@ export default {
|
|||||||
});
|
});
|
||||||
},
|
},
|
||||||
/** 修改按钮操作 */
|
/** 修改按钮操作 */
|
||||||
handleUpdate(row) {
|
handleUpdate (row) {
|
||||||
this.reset();
|
this.reset();
|
||||||
this.getTreeselect();
|
this.getTreeselect();
|
||||||
const userId = row.userId || this.ids;
|
const userId = row.userId || this.ids;
|
||||||
@ -576,18 +453,18 @@ export default {
|
|||||||
});
|
});
|
||||||
},
|
},
|
||||||
/** 重置密码按钮操作 */
|
/** 重置密码按钮操作 */
|
||||||
handleResetPwd(row) {
|
handleResetPwd (row) {
|
||||||
this.$prompt('请输入"' + row.userName + '"的新密码', "提示", {
|
this.$prompt('请输入"' + row.userName + '"的新密码', "提示", {
|
||||||
confirmButtonText: "确定",
|
confirmButtonText: "确定",
|
||||||
cancelButtonText: "取消"
|
cancelButtonText: "取消"
|
||||||
}).then(({ value }) => {
|
}).then(({ value }) => {
|
||||||
resetUserPwd(row.userId, value).then(response => {
|
resetUserPwd(row.userId, value).then(response => {
|
||||||
this.msgSuccess("修改成功,新密码是:" + value);
|
this.msgSuccess("修改成功,新密码是:" + value);
|
||||||
});
|
});
|
||||||
}).catch(() => {});
|
}).catch(() => { });
|
||||||
},
|
},
|
||||||
/** 提交按钮 */
|
/** 提交按钮 */
|
||||||
submitForm: function() {
|
submitForm: function () {
|
||||||
this.$refs["form"].validate(valid => {
|
this.$refs["form"].validate(valid => {
|
||||||
if (valid) {
|
if (valid) {
|
||||||
if (this.form.userId != undefined) {
|
if (this.form.userId != undefined) {
|
||||||
@ -607,49 +484,49 @@ export default {
|
|||||||
});
|
});
|
||||||
},
|
},
|
||||||
/** 删除按钮操作 */
|
/** 删除按钮操作 */
|
||||||
handleDelete(row) {
|
handleDelete (row) {
|
||||||
const userIds = row.userId || this.ids;
|
const userIds = row.userId || this.ids;
|
||||||
this.$confirm('是否确认删除用户编号为"' + userIds + '"的数据项?', "警告", {
|
this.$confirm('是否确认删除用户编号为"' + userIds + '"的数据项?', "警告", {
|
||||||
confirmButtonText: "确定",
|
confirmButtonText: "确定",
|
||||||
cancelButtonText: "取消",
|
cancelButtonText: "取消",
|
||||||
type: "warning"
|
type: "warning"
|
||||||
}).then(function() {
|
}).then(function () {
|
||||||
return delUser(userIds);
|
return delUser(userIds);
|
||||||
}).then(() => {
|
}).then(() => {
|
||||||
this.getList();
|
this.getList();
|
||||||
this.msgSuccess("删除成功");
|
this.msgSuccess("删除成功");
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
/** 导出按钮操作 */
|
/** 导出按钮操作 */
|
||||||
handleExport() {
|
handleExport () {
|
||||||
const queryParams = this.queryParams;
|
const queryParams = this.queryParams;
|
||||||
this.$confirm('是否确认导出所有用户数据项?', "警告", {
|
this.$confirm('是否确认导出所有用户数据项?', "警告", {
|
||||||
confirmButtonText: "确定",
|
confirmButtonText: "确定",
|
||||||
cancelButtonText: "取消",
|
cancelButtonText: "取消",
|
||||||
type: "warning"
|
type: "warning"
|
||||||
}).then(function() {
|
}).then(function () {
|
||||||
return exportUser(queryParams);
|
return exportUser(queryParams);
|
||||||
}).then(response => {
|
}).then(response => {
|
||||||
this.download(response.msg);
|
this.download(response.msg);
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
/** 导入按钮操作 */
|
/** 导入按钮操作 */
|
||||||
handleImport() {
|
handleImport () {
|
||||||
this.upload.title = "用户导入";
|
this.upload.title = "用户导入";
|
||||||
this.upload.open = true;
|
this.upload.open = true;
|
||||||
},
|
},
|
||||||
/** 下载模板操作 */
|
/** 下载模板操作 */
|
||||||
importTemplate() {
|
importTemplate () {
|
||||||
importTemplate().then(response => {
|
importTemplate().then(response => {
|
||||||
this.download(response.msg);
|
this.download(response.msg);
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
// 文件上传中处理
|
// 文件上传中处理
|
||||||
handleFileUploadProgress(event, file, fileList) {
|
handleFileUploadProgress (event, file, fileList) {
|
||||||
this.upload.isUploading = true;
|
this.upload.isUploading = true;
|
||||||
},
|
},
|
||||||
// 文件上传成功处理
|
// 文件上传成功处理
|
||||||
handleFileSuccess(response, file, fileList) {
|
handleFileSuccess (response, file, fileList) {
|
||||||
this.upload.open = false;
|
this.upload.open = false;
|
||||||
this.upload.isUploading = false;
|
this.upload.isUploading = false;
|
||||||
this.$refs.upload.clearFiles();
|
this.$refs.upload.clearFiles();
|
||||||
@ -657,7 +534,7 @@ export default {
|
|||||||
this.getList();
|
this.getList();
|
||||||
},
|
},
|
||||||
// 提交上传文件
|
// 提交上传文件
|
||||||
submitFileForm() {
|
submitFileForm () {
|
||||||
this.$refs.upload.submit();
|
this.$refs.upload.submit();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user