Merge branch 'xy-ly' of gitee.com:xinyingpower/xy-visual-intelligentfe into xy-ly

master
fanluyan 2 years ago
commit 1e07473d04

@ -114,17 +114,17 @@ export default {
// },
],
},
// {
// icon: "el-icon-monitor",
// index: "system",
// title: "",
// subs: [
// {
// index: "userManagement",
// title: "",
// },
// ],
// },
{
icon: "el-icon-monitor",
index: "/system",
title: "系统管理",
subs: [
{
index: "/userManagement",
title: "用户管理",
},
],
},
],
};
},

@ -0,0 +1,127 @@
<template>
<el-dialog
class="addchannelDialog"
:title="title"
:visible.sync="isShow"
:close-on-click-modal="false"
width="470px"
@close="handleclose"
>
<el-form
label-position="left"
ref="formInfo"
label-width="100px"
:rules="rules"
:model="formdata"
>
<el-form-item label="用户名:" prop="username">
<el-input placeholder="请输入用户名" v-model="formdata.username" autocomplete="off"></el-input>
</el-form-item>
<el-form-item label="角色:" prop="role" >
<el-select v-model="formdata.role" placeholder="请选择">
<el-option v-for="item in roleoptions" :key="item.value" :label="item.label" :value="item.value"></el-option>
</el-select>
</el-form-item>
<el-form-item label="密码:" prop="password">
<el-input placeholder="请输入密码" v-model="formdata.password" show-password></el-input>
</el-form-item>
</el-form>
<div slot="footer" class="dialog-footer">
<el-button @click="isShow = false"> </el-button>
<el-button type="primary" @click="submitForm()"> </el-button>
</div>
</el-dialog>
</template>
<script>
import { addChannelapi, updateChannelapi } from "@/utils/api/index";
export default {
props: {
title: String,
},
data() {
return {
isShow: false,
roleoptions:[{
value: 1,
label: '管理员'
}, {
value: 2,
label: '用户'
}],
formdata: {},
rules: {
username: [{ required: true, message: "请输入用户名", trigger: "blur" }],
role: [{ required: true, message: "请选择角色", trigger: "blur" }],
password: [{ required: true, message: "请输入密码", trigger: "blur" }]
},
};
},
methods: {
//
getdataform(val) {
console.log(val);
if (val == null) {
return (this.formdata = {});
}
this.formdata = val;
},
//
submitForm() {
this.$refs.formInfo.validate((valid) => {
if (valid) {
if (this.title == "新增") {
let formArr = [];
formArr.push(this.formdata);
addChannelapi({ list: formArr })
.then((res) => {
if (res.code == 200) {
this.$message.success("添加成功");
this.$parent.deviceList();
this.isShow = false;
} else {
this.$message.error(res.msg);
}
})
.catch((err) => {});
} else {
updateChannelapi(this.formdata)
.then((res) => {
if (res.code == 200) {
this.$message.success("修改成功");
this.$parent.deviceList();
this.isShow = false;
} else {
this.$message.error(res.msg);
}
})
.catch((err) => {});
}
} else {
console.log("error submit!!");
return false;
}
});
},
display() {
this.isShow = true;
},
hide() {
this.isShow = false;
},
handleclose() {
this.$parent.deviceList();
},
},
mounted() {},
};
</script>
<style lang="less">
.addchannelDialog {
.el-form-item {
.el-input,
.el-input-number {
width: 100%;
}
}
}
</style>

@ -1,13 +1,179 @@
<template>
<div class="userManagement">用户管理</div>
<div class="camerChannel">
<div class="deviceBox">
<div class="deviceBtnGroup">
<el-button
type="primary"
icon="el-icon-plus"
@click.native.stop="handleAdddevice()"
>新增</el-button
>
</div>
<div class="deviceTable">
<el-table
ref="multipleTable"
:data="deviceTableData"
stripe
tooltip-effect="dark"
style="width: 100%"
height="calc(100% - 40px)"
@selection-change="handleSelectionChange"
@row-click="handleRowClick"
>
<!-- <el-table-column type="index" width="55"> </el-table-column>
<el-table-column type="selection" width="55"> </el-table-column> -->
<el-table-column
label="用户名"
show-overflow-tooltip
prop="channelname"
></el-table-column>
<el-table-column
label="角色"
show-overflow-tooltip
prop="maxResolutionHeight"
></el-table-column>
<el-table-column
label="创建时间"
show-overflow-tooltip
prop="maxResolutionWidth"
></el-table-column>
<el-table-column fixed="right" label="操作" width="200">
<template slot-scope="scope">
<el-button
@click.native.stop="handleResive(scope.row)"
type="text"
>修改</el-button
>
<el-button type="text" class="deleteText" @click.native.stop="handleDelete(scope.row)" >删除</el-button>
</template>
</el-table-column>
</el-table>
<div class="pageNation">
<el-pagination
@current-change="handleCurrentChange"
:current-page="page"
:page-size="pageSize"
layout=" prev, pager, next, jumper,total"
:total="total"
background
>
</el-pagination>
</div>
</div>
</div>
<!-- 新增时间表 -->
<addUser :title="title" ref="adduserref"></addUser>
</div>
</template>
<script>
import addUser from "./components/addUser.vue";
import { getChannelListapi, deleteChannelapi } from "@/utils/api/index";
export default {
components: {
addUser
},
data() {
return {
title: "", //
deviceTableData: [],
//multipleSelection: [], //
page: 1, //
pageSize: 10, //
total: 0, //
};
},
created() {
this.deviceList();
},
methods: {
//线
deviceList() {
getChannelListapi({
pageindex: this.page,
pagesize: this.pageSize,
})
.then((res) => {
this.deviceTableData = res.data.list;
this.total = res.data.total;
})
.catch((err) => {});
},
//
handleRowClick(row, column, event) {
this.$refs.multipleTable.toggleRowSelection(row);
},
//
handleSelectionChange(val) {
this.multipleSelection = val;
},
//
handleAdddevice() {
this.title = "新增";
this.$refs.adduserref.display();
this.$refs.adduserref.getdataform(null);
},
<script></script>
//
handleResive(data) {
this.title = "修改";
this.$refs.adduserref.display();
this.$refs.adduserref.getdataform(data);
},
//
handleDelete(data) {
let deleteArr = [];
deleteArr.push({
id: data.id,
});
this.$confirm("确定要删除记录吗,同时删除关联关系?", "提示", {
confirmButtonText: "确定",
cancelButtonText: "取消",
type: "warning",
})
.then(() => {
deleteChannelapi({ list: deleteArr }).then((res) => {
this.deviceList(); //
});
this.$message({ type: "success", message: "删除成功!" });
})
.catch(() => {
this.$message({ type: "info", message: "已取消删除" });
});
},
//
handleCurrentChange(val) {
this.page = val;
this.deviceList();
},
},
};
</script>
<style lang="less">
.userManagement {
width: 100%;
height: 100%;
display: flex;
.camerChannel {
width: calc(100% - 32px);
height: calc(100% - 32px);
padding: 16px 16px;
background: @color-white;
.deviceBox {
border: 1px solid #dddddd;
height: calc(100% - 32px);
padding: 16px;
border-radius: 4px;
}
.deviceBtnGroup {
display: flex;
justify-content: flex-end;
}
.deviceTable {
margin-top: 16px;
height: calc(100% - 48px);
//background: #fcc;
}
}
</style>

Loading…
Cancel
Save