|
@@ -19,21 +19,21 @@
|
|
|
<el-col :span="5">
|
|
|
<div class="grid-content ep-bg-purple">
|
|
|
<span>用户名称</span>
|
|
|
- <el-input v-model="yhmc" style="width: 170px" placeholder="请输入用户名称" />
|
|
|
+ <el-input v-model="username" style="width: 170px" placeholder="请输入用户名称" />
|
|
|
</div>
|
|
|
</el-col>
|
|
|
<el-col :span="5">
|
|
|
<div class="grid-content ep-bg-purple">
|
|
|
<span>手机号码</span>
|
|
|
- <el-input v-model="sjhm" style="width: 170px" placeholder="请输入手机号码" />
|
|
|
+ <el-input v-model="dianhua" style="width: 170px" placeholder="请输入手机号码" />
|
|
|
</div>
|
|
|
</el-col>
|
|
|
<el-col :span="5">
|
|
|
<div class="grid-content ep-bg-purple">
|
|
|
<span>状态</span>
|
|
|
- <el-select v-model="zt" placeholder="用户状态" style="width: 170px">
|
|
|
- <el-option> 0</el-option>
|
|
|
- <el-option> 1</el-option>
|
|
|
+ <el-select v-model="zhuangtai" placeholder="用户状态" clearable="true" style="width: 170px">
|
|
|
+ <el-option label="正常" value="1"/>
|
|
|
+ <el-option label="停用" value="0"/>
|
|
|
</el-select>
|
|
|
</div>
|
|
|
</el-col>
|
|
@@ -42,35 +42,32 @@
|
|
|
<span>创建时间</span>
|
|
|
<div class="demo-datetime-picker">
|
|
|
<el-date-picker
|
|
|
- v-model="chuangjianshijian"
|
|
|
+ v-model="chuangjiantime"
|
|
|
type="daterange"
|
|
|
- start-placeholder="开始日期"
|
|
|
- end-placeholder="结束日期"
|
|
|
+ start-placeholder="开始"
|
|
|
+ range-separator="到"
|
|
|
+ end-placeholder="结束"
|
|
|
format="YYYY-MM-DD HH:mm:ss"
|
|
|
date-format="YYYY/MM/DD ddd"
|
|
|
time-format="A hh:mm:ss"
|
|
|
/>
|
|
|
</div>
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
</div>
|
|
|
</el-col>
|
|
|
-
|
|
|
</el-row>
|
|
|
|
|
|
<el-row :gutter="0">
|
|
|
- <el-col :span="3">
|
|
|
+ <el-col :span="12">
|
|
|
<div class="grid-content ep-bg-purple">
|
|
|
- <el-button type="primary" >
|
|
|
+ <el-button type="primary" @click="listyh">
|
|
|
<el-icon><Search /></el-icon>搜索
|
|
|
</el-button>
|
|
|
- <el-button >
|
|
|
+ <el-button @click="clear_input">
|
|
|
<el-icon><Refresh /></el-icon>重置
|
|
|
</el-button>
|
|
|
</div>
|
|
|
</el-col>
|
|
|
- <el-col :span="21">
|
|
|
+ <el-col :span="12">
|
|
|
<div class="grid-content ep-bg-purple">
|
|
|
|
|
|
</div>
|
|
@@ -80,13 +77,13 @@
|
|
|
<el-row :gutter="0">
|
|
|
<el-col :span="12">
|
|
|
<div class="grid-content ep-bg-purple">
|
|
|
- <el-button type="primary" plain @click="dialogFormVisible = true">
|
|
|
+ <el-button type="primary" plain @click="open_button_add">
|
|
|
<el-icon><Plus /></el-icon>新增
|
|
|
</el-button>
|
|
|
<el-button type="success" plain >
|
|
|
<el-icon><EditPen /></el-icon>修改
|
|
|
</el-button>
|
|
|
- <el-button type="danger" plain >
|
|
|
+ <el-button type="danger" plain @click="open_button_delete">
|
|
|
<el-icon><Delete /></el-icon>删除
|
|
|
</el-button>
|
|
|
<el-button type="info" plain >
|
|
@@ -139,9 +136,13 @@
|
|
|
</el-table-column>
|
|
|
<el-table-column label="操作" align="center">
|
|
|
<template v-slot:default="scope">
|
|
|
- <el-button type="text" size="small">修改</el-button>
|
|
|
+ <el-button type="text"
|
|
|
+ size="small"
|
|
|
+ @click="this.table_update_row=scope.row,open_table_update()">
|
|
|
+ 修改
|
|
|
+ </el-button>
|
|
|
<el-button
|
|
|
- @click.prevent="deleteRow(scope.$index, yonghuxinxi)"
|
|
|
+ @click.prevent="deleteyh_table(scope.row)"
|
|
|
type="text"
|
|
|
size="small">
|
|
|
删除
|
|
@@ -178,14 +179,88 @@
|
|
|
|
|
|
|
|
|
<!-- 按钮添加用户弹出框-->
|
|
|
- <el-dialog v-model="dialogFormVisible" title="添加用户" width="500">
|
|
|
+ <el-dialog v-model="dialog_button_add" title="添加用户" width="500">
|
|
|
+ <el-form :model="form">
|
|
|
+ <el-row :gutter="0">
|
|
|
+ <el-col :span="12">
|
|
|
+ <el-form-item label="状态" label-width="100">
|
|
|
+ <el-radio-group v-model="form.zhuangtai">
|
|
|
+ <el-radio label="正常" value="1"/>
|
|
|
+ <el-radio label="停用" value="0"/>
|
|
|
+ </el-radio-group>
|
|
|
+ </el-form-item>
|
|
|
+ </el-col>
|
|
|
+ <el-col :span="12">
|
|
|
+ <el-form-item label="归属部门" label-width="100">
|
|
|
+ <el-select v-model="form.bumen" placeholder="请选择归属部门" clearable="true">
|
|
|
+ <el-option v-for="(item) in guishubumen" :key="item" :value="item" :label="item">
|
|
|
+ </el-option>
|
|
|
+ </el-select>
|
|
|
+ </el-form-item>
|
|
|
+ </el-col>
|
|
|
+ </el-row>
|
|
|
+
|
|
|
+ <el-row :gutter="0">
|
|
|
+ <el-col :span="12">
|
|
|
+ <el-form-item label="用户名称" required label-width="100">
|
|
|
+ <el-input v-model="form.username" type="text" placeholder="请输入用户名称" />
|
|
|
+ </el-form-item>
|
|
|
+ </el-col>
|
|
|
+ <el-col :span="12">
|
|
|
+ <el-form-item label="用户密码" required label-width="100">
|
|
|
+ <el-input v-model="form.password" type="password" placeholder="请输入用户密码" show-password/>
|
|
|
+ </el-form-item>
|
|
|
+ </el-col>
|
|
|
+ </el-row>
|
|
|
+ <el-row :gutter="0">
|
|
|
+ <el-col :span="12">
|
|
|
+ <el-form-item label="角色" label-width="100">
|
|
|
+ <el-select v-model="form.yonghuleixing" placeholder="请选择角色" clearable="true">
|
|
|
+ <el-option v-for="(item) in xaunzejuese" :key="item" :value="item" :label="item">
|
|
|
+ </el-option>
|
|
|
+ </el-select>
|
|
|
+ </el-form-item>
|
|
|
+ </el-col>
|
|
|
+ <el-col :span="12">
|
|
|
+
|
|
|
+ </el-col>
|
|
|
+ </el-row>
|
|
|
+
|
|
|
+ </el-form>
|
|
|
+ <template #footer>
|
|
|
+ <div class="dialog-footer">
|
|
|
+ <el-button type="primary" @click="addyh">确定</el-button>
|
|
|
+ <el-button @click="dialog_button_add = false">取消</el-button>
|
|
|
+
|
|
|
+ </div>
|
|
|
+ </template>
|
|
|
+ </el-dialog>
|
|
|
+
|
|
|
+ <!-- 按钮删除用户弹出框-->
|
|
|
+ <el-dialog v-model="dialog_button_delete" title="修改规则" width="500">
|
|
|
+ <el-form :model="form">
|
|
|
+ <el-form-item label="要删除的用户名称" :label-width="150" label-position="left" required>
|
|
|
+ <el-input v-model="form.username" placeholder="请输入要删除的用户名称" style="width: 200px"/>
|
|
|
+ </el-form-item>
|
|
|
+
|
|
|
+ </el-form>
|
|
|
+ <template #footer>
|
|
|
+ <div class="dialog-footer">
|
|
|
+ <el-button type="primary" @click="deleteyh_button">确定</el-button>
|
|
|
+ <el-button @click="dialog_button_delete = false">取消</el-button>
|
|
|
+ </div>
|
|
|
+ </template>
|
|
|
+ </el-dialog>
|
|
|
+
|
|
|
+ <!-- 列表修改用户弹出框-->
|
|
|
+ <el-dialog v-model="dialog_table_update" title="修改用户" width="500">
|
|
|
<el-form :model="form">
|
|
|
<el-row :gutter="0">
|
|
|
<el-col :span="12">
|
|
|
<el-form-item label="状态" label-width="100">
|
|
|
- <el-radio-group v-model="yhstate">
|
|
|
- <el-radio :value=true>正常</el-radio>
|
|
|
- <el-radio :value=false>停用</el-radio>
|
|
|
+ <el-radio-group v-model="form.zhuangtai">
|
|
|
+ <el-radio label="正常" value="1"/>
|
|
|
+ <el-radio label="停用" value="0"/>
|
|
|
</el-radio-group>
|
|
|
</el-form-item>
|
|
|
</el-col>
|
|
@@ -202,19 +277,19 @@
|
|
|
<el-row :gutter="0">
|
|
|
<el-col :span="12">
|
|
|
<el-form-item label="用户名称" required label-width="100">
|
|
|
- <el-input v-model="form.name" type="text" placeholder="请输入用户名称" />
|
|
|
+ <el-input v-model="form.newusername" type="text" placeholder="请输入用户名称" />
|
|
|
</el-form-item>
|
|
|
</el-col>
|
|
|
<el-col :span="12">
|
|
|
<el-form-item label="用户密码" required label-width="100">
|
|
|
- <el-input v-model="form.pass" type="password" placeholder="请输入用户密码" show-password/>
|
|
|
+ <el-input v-model="form.password" type="password" placeholder="请输入用户密码" show-password/>
|
|
|
</el-form-item>
|
|
|
</el-col>
|
|
|
</el-row>
|
|
|
<el-row :gutter="0">
|
|
|
<el-col :span="12">
|
|
|
<el-form-item label="角色" label-width="100">
|
|
|
- <el-select v-model="form.juese" placeholder="请选择角色" clearable="true">
|
|
|
+ <el-select v-model="form.yonghuleixing" placeholder="请选择角色" clearable="true">
|
|
|
<el-option v-for="(item) in xaunzejuese" :key="item" :value="item" :label="item">
|
|
|
</el-option>
|
|
|
</el-select>
|
|
@@ -228,8 +303,8 @@
|
|
|
</el-form>
|
|
|
<template #footer>
|
|
|
<div class="dialog-footer">
|
|
|
- <el-button type="primary" @click="addYongHuXinXi">确定</el-button>
|
|
|
- <el-button @click="dialogFormVisible = false">取消</el-button>
|
|
|
+ <el-button type="primary" @click="updateyh_table">确定</el-button>
|
|
|
+ <el-button @click="dialog_table_update = false">取消</el-button>
|
|
|
|
|
|
</div>
|
|
|
</template>
|
|
@@ -252,14 +327,14 @@ export default {
|
|
|
},
|
|
|
data() {
|
|
|
return{
|
|
|
- yhstate:true,
|
|
|
- yhmc:"",
|
|
|
- sjhm:"",
|
|
|
- zt:"",
|
|
|
+ table_update_row:'',
|
|
|
+ username:'',
|
|
|
+ dianhua:'',
|
|
|
+ zhuangtai:'',
|
|
|
+ chuangjiantime:'',
|
|
|
// state: "",
|
|
|
- xaunzejuese:['角色1','角色2','角色3','角色4',],
|
|
|
- guishubumen:['部门1','部门2','部门3','部门4',],
|
|
|
- chuangjianshijian:"",
|
|
|
+ xaunzejuese:['供应商','粮库'],
|
|
|
+ guishubumen:['bumen1','bumen2','bumen3','bumen4'],
|
|
|
yonghuxinxi:[],
|
|
|
//树形控件
|
|
|
data:[
|
|
@@ -279,12 +354,19 @@ export default {
|
|
|
},
|
|
|
|
|
|
|
|
|
- form:{},
|
|
|
+ form:{
|
|
|
+ newusername:'',
|
|
|
+ fromdate:'',
|
|
|
+ todate:'',
|
|
|
+ },
|
|
|
yonghulist:[],
|
|
|
- state:false,
|
|
|
+ fromdate:'',
|
|
|
+ todate:'',
|
|
|
|
|
|
dialogTableVisible:false,
|
|
|
- dialogFormVisible:false,//按钮添加用户弹出框
|
|
|
+ dialog_button_add:false, //按钮添加用户弹窗
|
|
|
+ dialog_button_delete:false, //按钮删除用户弹窗
|
|
|
+ dialog_table_update:false, //列表修改用户弹窗
|
|
|
formLabelWidth:'140px',
|
|
|
|
|
|
|
|
@@ -295,51 +377,156 @@ export default {
|
|
|
this.listyh()
|
|
|
},
|
|
|
methods:{
|
|
|
+ //拆分日期
|
|
|
+ apart_date_from(){
|
|
|
+ if(this.chuangjiantime.length==0){
|
|
|
+ return ''
|
|
|
+
|
|
|
+ }else {
|
|
|
+ return this.formatDate(new Date(this.chuangjiantime[0])).toString()
|
|
|
+ }
|
|
|
+
|
|
|
+ },
|
|
|
+ apart_date_to(){
|
|
|
+ if(this.chuangjiantime.length==0){
|
|
|
+ return ''
|
|
|
+
|
|
|
+ }else {
|
|
|
+ return this.formatDate(new Date(this.chuangjiantime[1])).toString()
|
|
|
+ }
|
|
|
+
|
|
|
+ },
|
|
|
//列出用户
|
|
|
listyh(){
|
|
|
- http.lsjbGet("/yonghu/queryYongHu.yonghu", null).then(res=>{
|
|
|
-
|
|
|
+ let obj={
|
|
|
+ username: this.username,
|
|
|
+ dianhua: this.dianhua,//有问题后端接不到
|
|
|
+ zhuangtai: this.zhuangtai,
|
|
|
+ // fromdate: this.apart_date_from(),
|
|
|
+ // todate: this.apart_date_to(),
|
|
|
+ }
|
|
|
+ // 根据日期条件动态添加fromdate和todate
|
|
|
+ if (this.chuangjiantime != '') {
|
|
|
+ obj.fromdate = this.apart_date_from();
|
|
|
+ obj.todate = this.apart_date_to();
|
|
|
+ }
|
|
|
+ http.lsjbGet("/yonghu/queryYongHu.yonghu", obj).then(res=>{
|
|
|
this.yonghulist = res
|
|
|
+
|
|
|
})
|
|
|
},
|
|
|
- //树形控件
|
|
|
- generateNumberNodes(start, end) {
|
|
|
- return Array.from({ length: end - start + 1 }, (_, i) => ({
|
|
|
- label: `${(start + i).toString().padStart(6, '0')}`, // 为每个节点设置标签
|
|
|
- // 这里可以添加其他属性,如果需要的话
|
|
|
- }));
|
|
|
+ //清空输入框
|
|
|
+ clear_input(){
|
|
|
+ this.username=''
|
|
|
+ this.dianhua=''
|
|
|
+ this.zhuangtai=''
|
|
|
+ this.chuangjiantime=''
|
|
|
+ },
|
|
|
+ //清空表单
|
|
|
+ clear_form(){
|
|
|
+ this.form.zhuangtai= '1'//用户状态默认是正常
|
|
|
+ this.form.bumen= ''
|
|
|
+ this.form.username= ''
|
|
|
+ this.form.password= ''
|
|
|
+ this.form.yonghuleixing= ''
|
|
|
+ },
|
|
|
+ //打开按钮添加用户弹窗
|
|
|
+ open_button_add(){
|
|
|
+ this.clear_form()
|
|
|
+ // 打开按钮添加窗口
|
|
|
+ this.dialog_button_add=true
|
|
|
+ },
|
|
|
+ //添加用户
|
|
|
+ addyh(){
|
|
|
+ http.lsjbPost("/yonghu/addYongHu.yonghu",this.form).then(() => {
|
|
|
+ // 更新显示的规则列表
|
|
|
+ return this.listyh(); // 返回 Promise
|
|
|
+ }).then(() => {
|
|
|
+ // 关闭按钮添加窗口
|
|
|
+ this.dialog_button_add = false;
|
|
|
+ }).catch(error => {
|
|
|
+ console.error("添加失败:", error);
|
|
|
+ });
|
|
|
+ },
|
|
|
+ //列表删除用户
|
|
|
+ deleteyh_table(row){
|
|
|
+ this.$confirm("确认删除"+row.username+"吗?").then(()=>{
|
|
|
+ let obj = {
|
|
|
+ username : row.username
|
|
|
+ }
|
|
|
+ http.lsjbPost("/yonghu/deleteYongHu.yonghu",obj).then(()=>{
|
|
|
+ //更新显示的规则列表
|
|
|
+ return this.listyh()
|
|
|
+ }).catch(error => {
|
|
|
+ console.error("删除失败:", error);
|
|
|
+ });
|
|
|
+ }).catch((error)=>{
|
|
|
+ console.error("失败:", error);
|
|
|
+ })
|
|
|
+ },
|
|
|
+
|
|
|
+ //打开按钮删除用户弹窗
|
|
|
+ open_button_delete(){
|
|
|
+ this.clear_form()
|
|
|
+ //打开按钮删除用户弹窗
|
|
|
+ this.dialog_button_delete = true
|
|
|
+ },
|
|
|
+ //按钮删除用户
|
|
|
+ deleteyh_button(){
|
|
|
+ this.$confirm("确认删除"+this.form.username+"吗?").then(()=>{
|
|
|
+ let obj = {
|
|
|
+ username : this.form.username
|
|
|
+ }
|
|
|
+ http.lsjbPost("/yonghu/deleteYongHu.yonghu",obj).then(()=>{
|
|
|
+ //更新显示的规则列表
|
|
|
+ return this.listyh()
|
|
|
+ }).then(()=>{
|
|
|
+ //关闭按钮删除规则弹窗
|
|
|
+ this.dialog_button_delete = false
|
|
|
+ }).catch(error => {
|
|
|
+ console.error("删除失败:", error);
|
|
|
+ });
|
|
|
+
|
|
|
+ }).catch(error=>{
|
|
|
+ console.error("失败:", error);
|
|
|
+ })
|
|
|
},
|
|
|
|
|
|
- addYongHuXinXi() {
|
|
|
- let YH={
|
|
|
- state:this.yhstate,
|
|
|
- name:this.form.name,
|
|
|
- pass:this.form.pass,
|
|
|
- bumen:this.form.bumen,
|
|
|
- juese:this.form.juese,
|
|
|
- date: this.formatDate(new Date()),
|
|
|
+ open_table_update(){
|
|
|
+ this.clear_form()
|
|
|
+ //打开按钮修改用户弹窗
|
|
|
+ this.dialog_table_update = true
|
|
|
+ },
|
|
|
|
|
|
+ //列表修改用户
|
|
|
+ updateyh_table() {
|
|
|
+ let obj={
|
|
|
+ username: this.table_update_row.username, //原名称
|
|
|
+ zhuangtai: this.form.zhuangtai,
|
|
|
+ bumen: this.form.bumen,
|
|
|
+ newusername: this.form.newusername, //新名称
|
|
|
+ password: this.form.password,
|
|
|
+ yonghuleixing: this.form.yonghuleixing,
|
|
|
}
|
|
|
- this.yonghuxinxi.push(YH)
|
|
|
|
|
|
- // 重置表单
|
|
|
- this.clear()
|
|
|
+ http.lsjbPost("/yonghu/updateYongHu.yonghu",obj).then(()=>{
|
|
|
+ //更新显示的规则列表
|
|
|
+ return this.listyh()
|
|
|
|
|
|
- //关闭弹出框
|
|
|
- this.dialogFormVisible = false
|
|
|
-
|
|
|
- },
|
|
|
- clear(){
|
|
|
- this.form.name=''
|
|
|
- this.form.pass=''
|
|
|
- this.form.bmuen=''
|
|
|
- this.form.juese=''
|
|
|
- // 重置用户状态
|
|
|
- this.yhstate=true
|
|
|
+ }).then(() => {
|
|
|
+ // 关闭列表修改窗口
|
|
|
+ this.dialog_table_update = false;
|
|
|
+ }).catch(error => {
|
|
|
+ console.error("修改失败:", error);
|
|
|
+ });
|
|
|
},
|
|
|
- deleteRow(index, rows) {
|
|
|
- rows.splice(index, 1);
|
|
|
- // this.yonghuxinxi.pop(this.yonghuxinxi[index])
|
|
|
+
|
|
|
+ //树形控件
|
|
|
+ generateNumberNodes(start, end) {
|
|
|
+ return Array.from({ length: end - start + 1 }, (_, i) => ({
|
|
|
+ label: `${(start + i).toString().padStart(6, '0')}`, // 为每个节点设置标签
|
|
|
+ // 这里可以添加其他属性,如果需要的话
|
|
|
+ }));
|
|
|
},
|
|
|
// 设置date格式
|
|
|
formatDate(date) {
|
|
@@ -351,6 +538,32 @@ export default {
|
|
|
let seconds = date.getSeconds().toString().padStart(2, '0');
|
|
|
return `${year}-${month}-${day} ${hours}:${minutes}:${seconds}`;
|
|
|
}
|
|
|
+ // addYongHuXinXi() {
|
|
|
+ // let YH={
|
|
|
+ // state:this.yhstate,
|
|
|
+ // name:this.form.name,
|
|
|
+ // pass:this.form.pass,
|
|
|
+ // bumen:this.form.bumen,
|
|
|
+ // juese:this.form.juese,
|
|
|
+ // date: this.formatDate(new Date()),
|
|
|
+ //
|
|
|
+ // }
|
|
|
+ // this.yonghuxinxi.push(YH)
|
|
|
+ //
|
|
|
+ // // 重置表单
|
|
|
+ // this.clear()
|
|
|
+ //
|
|
|
+ // //关闭弹出框
|
|
|
+ // this.dialogFormVisible = false
|
|
|
+ //
|
|
|
+ // },
|
|
|
+
|
|
|
+ // deleteRow(index, rows) {
|
|
|
+ // rows.splice(index, 1);
|
|
|
+ // // this.yonghuxinxi.pop(this.yonghuxinxi[index])
|
|
|
+ // },
|
|
|
+
|
|
|
+
|
|
|
|
|
|
}
|
|
|
|