jinhui.wang

密码机页面增加,接口增加,方法名称修改

import request from '@/utils/request'
// 查询密码机数据
/**
* @param cipherMachineNumber 密码机编号
* @param endCreationTime 结束创建时间
* @param startCreationTime 开始创建时间
* @param pageNum *
* @param pageSize *
*/
export function getCipherMachineList(data) {
return request({
url: '/bus-customer/cipherMachine/getCipherMachineList',
method: 'post',
data: data
})
}
// 新增密码机
/**
* @param cipherMachineNumber * 密码机编号
* @param availableUserCount * 密码机可使用用户数量
* @param ipAddress * 密码机IP地址
*/
export function addCipherMachineData(data) {
return request({
url: '/bus-customer/cipherMachine/addCipherMachine',
method: 'post',
data: data
})
}
// 修改密码机
/**
* @param cipherMachineNumber * 密码机编号
* @param availableUserCount * 密码机可使用用户数量
* @param ipAddress * 密码机IP地址
* @param id *
*/
export function updateCipherMachineData(data) {
return request({
url: '/bus-customer/cipherMachine/updateCipherMachine',
method: 'put',
data: data
})
}
\ No newline at end of file
import request from '@/utils/request'
// 获取用户详细信息
/**
* @param dxpid DXPID
* @param portCode 口岸代码
* @param pageNum *
* @param pageSize *
*/
export function getPortList(data) {
return request({
url: '/bus-customer/portInfo/getPortList',
method: 'post',
data: data
})
}
\ No newline at end of file
......@@ -47,7 +47,7 @@ export function updateRoleData(data) {
})
}
// 更新角色
// 更新角色权限
/**
* @param menuId * 权限菜单
* @param roleId * 角色id
......@@ -77,6 +77,18 @@ export function getUserData(data) {
})
}
// 用户信息详情查询
/**
* @param id 用户id *
*/
export function getUserDetailData(data) {
return request({
url: '/bus-customer/user/getUserById',
method: 'get',
params: data
})
}
// 用户更新
/**
* @param employeeNumber 员工编号
......@@ -124,3 +136,27 @@ export function getPortList(data) {
params: data
})
}
// 获取角色字典
/**
* @param
*/
export function getRoleDict(data) {
return request({
url: '/bus-customer/user/getRoleIdsList',
method: 'get',
params: data
})
}
// 获取用户角色分配状态
/**
* @param userId * 用户id
*/
export function getUserRoleType(data) {
return request({
url: '/bus-customer/user/assignedAndUnassignedRoles',
method: 'get',
params: data
})
}
\ No newline at end of file
......
<template>
<el-dialog
class="entryDialog classCUploadDialog"
:title="title"
:visible.sync="outerVisible"
:show-close="false"
width="40%"
:close-on-click-modal="false"
v-loading="loadings.dialogLoading"
@close="close"
>
<div class="modelItem">
<el-form
class="fedexFormStyle"
ref="formData"
:model="formData"
:rules="type == 'roleChange' ? {} : rules"
label-position="top"
:disabled="type == 'roleChange'"
size="small"
>
<el-row :gutter="5">
<!-- 密码机编号 -->
<el-col :span="8">
<Formitem label="密码机编号" prop="cipherMachineNumber" type="edit">
<el-input
type="text"
class="inputShadow"
id="inputInner-edit-cipherMachineNumber"
resize="none"
v-model="formData.cipherMachineNumber"
clearable
placeholder=""
></el-input>
</Formitem>
</el-col>
<!-- 密码机IP地址 -->
<el-col :span="8">
<Formitem label="密码机IP地址" prop="ipAddress" type="edit">
<el-input
type="text"
class="inputShadow"
id="inputInner-edit-ipAddress"
resize="none"
v-model="formData.ipAddress"
clearable
placeholder=""
></el-input>
</Formitem>
</el-col>
<!-- 密码机可使用用户数量 -->
<el-col :span="8">
<Formitem
label="密码机可使用用户数量"
prop="availableUserCount"
type="edit"
>
<el-input
type="text"
class="inputShadow"
id="inputInner-edit-availableUserCount"
resize="none"
v-model="formData.availableUserCount"
clearable
oninput="value=value.replace(/[^0-9]/g,'')"
placeholder=""
></el-input>
</Formitem>
</el-col>
</el-row>
</el-form>
</div>
<div class="dialogOption entrySave">
<el-button
class="entrySaveButton"
:disabled="loadings.submitLoading"
@click="submit"
>确 定</el-button
>
<el-button
class="entrySaveButton"
:disabled="loadings.uploadLoading"
@click="close"
>关 闭</el-button
>
</div>
</el-dialog>
</template>
<script>
import {
addCipherMachineData,
updateCipherMachineData,
} from "@/api/system/cipherMachine-api.js";
export default {
props: {
outerVisible: {
type: Boolean,
default: false,
},
title: {
type: String,
default: "新增密码机",
},
type: {
type: String,
default: "",
},
active: {
type: Object,
default: null,
},
},
data() {
return {
formData: {
availableUserCount: "",
cipherMachineNumber: "",
ipAddress: "",
},
customData: [],
rules: {
ipAddress: [
{
required: true,
trigger: "blur",
message: "密码机IP地址不能为空!",
},
],
cipherMachineNumber: [
{
required: true,
trigger: "blur",
message: "密码机编号不能为空!",
},
],
availableUserCount: [
{
required: true,
trigger: "blur",
message: "密码机可使用用户数量不能为空!",
},
],
},
loadings: {
dialogLoading: false,
uploadLoading: false,
submitLoading: false,
},
loadingText: "",
};
},
watch: {
outerVisible(val) {
if (val) {
this.loadings.dialogLoading = false;
if (this.type == "update") {
this.formData = this.active;
}
}
},
},
methods: {
//查询用户信息详情
searchUserData(id) {
this.loadings.dialogLoading = true;
getUserDetailData({ id: id })
.then((res) => {
if (res.code === "200") {
this.formData = res.data;
} else {
this.alertWarningMsg(res.message);
}
this.loadings.dialogLoading = false;
})
.catch((err) => {
console.log(err);
this.loadings.dialogLoading = false;
});
},
//数据保存
submit() {
this.loadings.dialogLoading = true;
let obj = {};
if (this.type == "add") {
this.$refs.formData.validate((valid) => {
if (valid) {
obj = this.formData;
this.addApi(obj);
} else {
this.loadings.dialogLoading = false;
}
});
} else if (this.type == "update") {
this.$refs.formData.validate((valid) => {
if (valid) {
obj.availableUserCount = this.formData.availableUserCount;
obj.cipherMachineNumber = this.formData.cipherMachineNumber;
obj.ipAddress = this.formData.ipAddress;
obj.id = this.formData.id;
this.updateapi(obj);
} else {
this.loadings.dialogLoading = false;
}
});
}
},
//新增
addApi(val) {
addCipherMachineData(val)
.then((res) => {
if (res.code === "200") {
this.msgSuccess(res.message);
this.close();
} else {
this.alertWarningMsg(res.message);
this.loadings.dialogLoading = false;
}
})
.catch((err) => {
console.log(err);
this.loadings.dialogLoading = false;
});
},
//修改
updateapi(val) {
updateCipherMachineData(val)
.then((res) => {
if (res.code === "200") {
this.msgSuccess(res.message);
this.close();
} else {
this.alertWarningMsg(res.message);
this.loadings.dialogLoading = false;
}
})
.catch((err) => {
console.log(err);
this.loadings.dialogLoading = false;
});
},
close() {
this.formData = {
availableUserCount: "",
cipherMachineNumber: "",
ipAddress: "",
};
this.$emit("close");
},
},
};
</script>
<style lang="scss" scoped>
@import "@/assets/styles/variables.scss";
</style>
<template>
<div class="entrySreach">
<el-form
class="fedexFormStyle fedexformSreach fedexformSreachBottomBorder"
ref="sreachForm"
:model="sreachFormData"
label-position="top"
size="small"
>
<el-row class="row-border">
<!-- 角色名称 -->
<el-col :span="5">
<Formitem label="密码机编号" prop="cipherMachineNumber">
<el-input
type="text"
class="inputShadow"
id="inputInner--cipherMachineNumber"
resize="none"
v-model="sreachFormData.cipherMachineNumber"
clearable
placeholder=""
></el-input>
</Formitem>
</el-col>
<el-col :span="5">
<Formitem label="创建日期" prop="creationTime" :activeType="true">
<el-date-picker
class="inputInner--creationTime"
id="inputInner--creationTime"
v-model="sreachFormData.creationTime"
type="daterange"
format="yyyy-MM-dd"
prefix-icon="none"
value-format="yyyy-MM-dd"
range-separator="至"
@change="dateChange"
/>
</Formitem>
</el-col>
<el-col :span="2">
<el-form-item class="textCenter">
<el-button
class="entrySreachButton"
type="text"
icon="el-icon-search"
:loading="loadings.searchLoading"
@click="search(0)"
></el-button>
</el-form-item>
</el-col>
</el-row>
</el-form>
<div class="optionButton">
<el-button
class="entrySaveButton"
icon="el-icon-plus"
size="small"
@click="addcipherMachine"
>
新 增
</el-button>
</div>
<Table
class="fedexDetialTable fedexSreachTable"
ref="entryTable"
:data="tableData"
:headerData="headerData"
:maxHeight="tableMaxheight"
:border="true"
:pagination="true"
:order="true"
noLabel="序号"
:loading="loadings.searchLoading"
:page="page.pageNum"
:pageSizes="[20, 30, 50, 100]"
:totalCount="page.total"
@sizeChange="sizeChange"
@currentChange="currentChange"
:selection="false"
:selectFixed="false"
:rowSelectDataType="false"
>
<template slot="optionColumn">
<el-table-column align="left" label="操作" width="100">
<template slot-scope="scope">
<el-button type="text" @click="update(scope.row)"> 修改 </el-button>
</template>
</el-table-column>
</template>
</Table>
<DialogVue
:outerVisible="outerVisible"
:title="dialogTitle"
:type="editType"
:active="activeData"
@close="dialogClose"
/>
</div>
</template>
<script>
import { getCipherMachineList } from "@/api/system/cipherMachine-api.js";
import DialogVue from "./dialog.vue";
export default {
name: "RoleConfig",
components: {
DialogVue,
},
data() {
return {
sreachFormData: {
cipherMachineNumber: "",
creationTime: [],
},
page: {
pageNum: 1,
pageSize: 20,
total: 0,
},
activeData: null,
tableData: [],
headerData: [
{
name: "密码机编号",
value: "cipherMachineNumber",
width: "",
align: "left",
},
{
name: "密码机IP地址",
value: "ipAddress",
width: "",
align: "left",
},
{
name: "密码机可使用用户数量",
value: "availableUserCount",
width: "",
align: "left",
},
{
name: "创建时间",
value: "creationTime",
width: "",
align: "left",
},
{
name: "创建人",
value: "creator",
width: "",
align: "left",
},
{
name: "修改时间",
value: "modificationTime",
width: "",
align: "left",
},
{
name: "修改人",
value: "modifier",
width: "",
align: "left",
},
],
loadings: {
searchLoading: false,
},
tableMaxheight: null,
outerVisible: false,
dialogTitle: "",
editType: "",
};
},
created() {
this.search(0);
},
mounted() {
this.tableMaxheight = window.innerHeight - 300;
},
methods: {
//查询
search(val) {
this.loadings.searchLoading = true;
if (val == 0) {
this.page.pageNum = 1;
}
let obj = this.sreachFormData;
obj.pageNum = this.page.pageNum;
obj.pageSize = this.page.pageSize;
obj.endCreationTime = "";
obj.startCreationTime = "";
if (obj.creationTime.length > 0) {
obj.endCreationTime = obj.creationTime[0];
obj.startCreationTime = obj.creationTime[1];
}
getCipherMachineList(obj)
.then((res) => {
if (res.code === "200") {
this.tableData = res.data.value;
this.page.total = res.data.totalItems;
this.tableData.forEach((item, idx) => {
item.index = idx;
});
} else {
this.alertWarningMsg(res.message);
}
this.loadings.searchLoading = false;
})
.catch((err) => {
console.log(err);
this.loadings.searchLoading = false;
});
},
addcipherMachine() {
this.dialogTitle = "新增密码机";
this.editType = "add";
this.outerVisible = true;
},
update(val) {
this.dialogTitle = "修改密码机";
this.editType = "update";
this.outerVisible = true;
this.activeData = val;
},
dialogClose() {
this.outerVisible = false;
this.activeData = null;
this.search(1);
},
//分页
currentChange(val) {
this.page.pageNum = val.page;
this.search(1);
},
sizeChange(val) {
this.page.pageSize = val;
this.search(1);
},
input() {
this.$forceUpdate();
},
dateChange(val) {
if (val == "" || val == null) {
this.$nextTick(() => {
this.sreachFormData.creationTime = [];
});
}
},
},
};
</script>
<style scoped lang="scss">
@import "@/assets/styles/variables.scss";
.entrySreach {
height: 100%;
background-color: $menuLightBg;
.entrySreachButton {
display: inline-block;
font-size: 20px;
color: $fedexButton !important;
}
.optionButton {
padding: 10px;
text-align: left;
.el-button {
color: $fedexButton;
border-color: $fedexButton !important;
svg {
display: inline-block;
margin-right: 5px;
fill: $fedexButton;
}
}
.entrySaveButton:hover,
.entrySaveButton:focus {
color: $menuLightBg !important;
background-color: $fedexButton !important;
}
}
}
.texttareaTip {
position: absolute;
top: 52%;
right: 20px;
transform: translate(0, -50%);
z-index: 10;
}
</style>
......@@ -63,7 +63,7 @@
prefix-icon="none"
value-format="yyyy-MM-dd"
range-separator="至"
@chagne="dateChange"
@change="dateChange"
/>
</Formitem>
</el-col>
......@@ -346,7 +346,13 @@ export default {
this.page.pageSize = val;
this.search(1);
},
dateChange(val) {},
dateChange(val) {
if (val == "" || val == null) {
this.$nextTick(() => {
this.sreachFormData.createTime = [];
});
}
},
input() {
this.$forceUpdate();
},
......
......@@ -112,7 +112,7 @@
prefix-icon="none"
value-format="yyyy-MM-dd"
range-separator="至"
@chagne="dateChange"
@change="dateChange"
/>
</Formitem>
</el-col>
......@@ -174,7 +174,9 @@
<span>{{ scope.row.returnStatus }}</span>
</template>
<template v-slot:logisticsNo="scope">
<el-button type="text" @click="view(scope.row)">{{ scope.row.logisticsNo }}</el-button>
<el-button type="text" @click="view(scope.row)">{{
scope.row.logisticsNo
}}</el-button>
</template>
</Table>
</div>
......@@ -401,7 +403,13 @@ export default {
this.page.pageSize = val;
this.search(1);
},
dateChange(val) {},
dateChange(val) {
if (val == "" || val == null) {
this.$nextTick(() => {
this.sreachFormData.createTime = [];
});
}
},
input() {
this.$forceUpdate();
},
......
......@@ -59,7 +59,7 @@
prefix-icon="none"
value-format="yyyy-MM-dd"
range-separator="至"
@chagne="dateChange"
@change="dateChange"
/>
</Formitem>
</el-col>
......@@ -605,7 +605,13 @@ export default {
input() {
this.$forceUpdate();
},
dateChange(val) {},
dateChange(val) {
if (val == "" || val == null) {
this.$nextTick(() => {
this.sreachFormData.createTime = [];
});
}
},
},
};
</script>
......
......@@ -87,13 +87,13 @@
</el-col>
<!-- 传真 -->
<el-col :span="8">
<Formitem label="传真" prop="fex" type="edit">
<Formitem label="传真" prop="fax" type="edit">
<el-input
type="text"
class="inputShadow"
id="inputInner-edit-fex"
id="inputInner-edit-fax"
resize="none"
v-model="formData.fex"
v-model="formData.fax"
clearable
placeholder=""
></el-input>
......@@ -195,7 +195,12 @@
</template>
<script>
import { updateUserData, updateUserRoleChange } from "@/api/system/user.js";
import {
updateUserData,
updateUserRoleChange,
getUserRoleType,
getUserDetailData,
} from "@/api/system/user.js";
export default {
props: {
outerVisible: {
......@@ -224,12 +229,6 @@ export default {
},
},
},
watch: {
outerVisible(val) {
if (val) {
}
},
},
data() {
return {
formData: {
......@@ -237,7 +236,7 @@ export default {
username: "",
remark: "",
port: "",
fex: "",
fax: "",
phone: "",
employeeNumber: "",
email: "",
......@@ -282,20 +281,44 @@ export default {
outerVisible(val) {
if (val) {
this.loadings.dialogLoading = false;
this.searchUserData(this.active.id);
if (this.type == "update") {
this.formData = this.active;
} else if (this.type == "roleChange") {
this.portDataInfo();
this.formData = this.active;
this.searchTreeData();
this.searchRoleData();
}
}
},
},
methods: {
//查询用户信息详情
searchUserData(id) {
this.loadings.dialogLoading = true;
getUserDetailData({ id: id })
.then((res) => {
if (res.code === "200") {
this.formData = res.data;
} else {
this.alertWarningMsg(res.message);
}
this.loadings.dialogLoading = false;
})
.catch((err) => {
console.log(err);
this.loadings.dialogLoading = false;
});
},
//查询角色
searchTreeData() {
// this.loadings.dialogLoading = true;
searchRoleData() {
getUserRoleType({ userId: this.active.id })
.then((res) => {
if (res.code === "200") {
let unassigned = res.data.unassigned.concat(res.data.assigned);
this.portDataInfo(unassigned, res.data.assigned);
}
})
.catch((err) => {
console.log(err);
});
},
//数据保存
submit() {
......@@ -404,14 +427,15 @@ export default {
});
},
//穿梭框数据初始化
portDataInfo() {
portDataInfo(roleList, valueList) {
let arr = [];
let select = [];
if (this.active.roleName != null && this.active.roleName != "") {
select = this.active.roleName.split(";");
if (valueList != null && valueList != "") {
valueList.forEach((item) => {
select.push(item.roleId);
});
}
let value = [];
this.dict.roleList.forEach((item, idx) => {
roleList.forEach((item, idx) => {
let obj = {
index: idx,
poolCode: item.roleId,
......@@ -419,12 +443,9 @@ export default {
disabled: false,
};
arr.push(obj);
if (select.includes(item.roleName)) {
value.push(item.roleId);
}
});
this.customData = arr;
this.value = value;
this.value = select;
},
close() {
this.formData = {
......@@ -436,6 +457,10 @@ export default {
employeeNumber: "",
email: "",
};
this.customData = [];
this.rightSelect = [];
this.value = [];
this.rightSelectIdx = 0;
this.$emit("close");
},
},
......
......@@ -146,7 +146,7 @@
</template>
<script>
import { getRoleList, getUserData, getPortList } from "@/api/system/user.js";
import { getRoleDict, getUserData, getPortList } from "@/api/system/user.js";
import DialogVue from "../userRoleConfig/dialog.vue";
export default {
name: "UserRoleConfig",
......@@ -267,7 +267,7 @@ export default {
},
//查询角色
searchRole() {
getRoleList({ roleName: "", pageNum: 1, pageSize: 999999 })
getRoleDict()
.then((res) => {
if (res.code === "200") {
this.dict.roleList = res.data.value;
......