|
|
|
|
@ -7,8 +7,8 @@
|
|
|
|
|
<div slot="content"></div>
|
|
|
|
|
<slot>
|
|
|
|
|
<div>
|
|
|
|
|
<Input style="width: 200px; margin-right: 10px" v-model.number="searchFields.Name" placeholder="关键字搜索" />
|
|
|
|
|
<Button type="primary" @click="load" style="margin-left: 10px">查询</Button>
|
|
|
|
|
<Input style="width: 200px; margin-right: 10px" v-model="searchFields.keyword" placeholder="关键字搜索" />
|
|
|
|
|
<Button type="primary" @click="search" style="margin-left: 10px">查询</Button>
|
|
|
|
|
<Button type="primary" @click="edit()" style="margin-left: 10px">新增用户</Button>
|
|
|
|
|
</div>
|
|
|
|
|
</slot>
|
|
|
|
|
@ -52,6 +52,17 @@
|
|
|
|
|
</template>
|
|
|
|
|
</el-table-column>
|
|
|
|
|
</el-table>
|
|
|
|
|
|
|
|
|
|
<div class="pagination">
|
|
|
|
|
<el-pagination
|
|
|
|
|
@current-change="handleCurrentChange"
|
|
|
|
|
:current-page="paginations.page"
|
|
|
|
|
:page-size="paginations.page_size"
|
|
|
|
|
background
|
|
|
|
|
layout="prev, pager, next"
|
|
|
|
|
:total="paginations.total">
|
|
|
|
|
</el-pagination>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
<el-dialog title="用户编辑" :visible.sync="dialogFormVisible" width="30%">
|
|
|
|
|
<el-form :model="form" :rules="rules" ref="form" label-position="right" :label-width="formLabelWidth">
|
|
|
|
|
@ -79,9 +90,13 @@
|
|
|
|
|
|
|
|
|
|
<el-form-item label="授权目录" prop="catalogs_ids">
|
|
|
|
|
<div style="height:150px;overflow: scroll;">
|
|
|
|
|
<el-tree :default-checked-keys="checkArr" @check="getSelectedNodes"
|
|
|
|
|
:data="catalogList" node-key="id" ref="tree" highlight-current
|
|
|
|
|
:check-strictly="true"
|
|
|
|
|
<el-tree
|
|
|
|
|
v-if="dialogFormVisible"
|
|
|
|
|
@check="getSelectedNodes"
|
|
|
|
|
:data="catalogList"
|
|
|
|
|
node-key="id"
|
|
|
|
|
ref="tree"
|
|
|
|
|
highlight-current
|
|
|
|
|
:show-checkbox="true"
|
|
|
|
|
:props="defaultProps">
|
|
|
|
|
</el-tree>
|
|
|
|
|
@ -137,7 +152,11 @@
|
|
|
|
|
departmentList: [],
|
|
|
|
|
originzeList:[],
|
|
|
|
|
catalogList: [],
|
|
|
|
|
checkArr: [],
|
|
|
|
|
paginations: {
|
|
|
|
|
page: 1,
|
|
|
|
|
page_size: 15,
|
|
|
|
|
total: 0
|
|
|
|
|
},
|
|
|
|
|
defaultProps: {
|
|
|
|
|
children: 'children',
|
|
|
|
|
label: 'name'
|
|
|
|
|
@ -174,6 +193,15 @@
|
|
|
|
|
required: true,
|
|
|
|
|
message: '请输入密码',
|
|
|
|
|
trigger: 'blur',
|
|
|
|
|
validator: (rule, value, callback) => {
|
|
|
|
|
if (!this.form.id && !value) {
|
|
|
|
|
callback(new Error('请输入密码'))
|
|
|
|
|
} else if (value && value.length < 6) {
|
|
|
|
|
callback(new Error('密码不能少于6位'))
|
|
|
|
|
} else {
|
|
|
|
|
callback()
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}],
|
|
|
|
|
originze_id:[{
|
|
|
|
|
required: true,
|
|
|
|
|
@ -184,7 +212,7 @@
|
|
|
|
|
tableHeight: 0,
|
|
|
|
|
//查询条件字段
|
|
|
|
|
searchFields: {
|
|
|
|
|
KeyWord: ""
|
|
|
|
|
keyword: ""
|
|
|
|
|
},
|
|
|
|
|
tableData: []
|
|
|
|
|
}
|
|
|
|
|
@ -207,15 +235,25 @@
|
|
|
|
|
this.catalogList = this.base.buildTree(res.data)
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
getSelectedNodes(data, node) {
|
|
|
|
|
console.log("data", data,node)
|
|
|
|
|
// this.$refs.tree.setCheckedKeys([]); // 删除所有选中节点
|
|
|
|
|
// this.$refs.tree.setCheckedNodes([data]); // 选中已选中节点
|
|
|
|
|
// this.form.pName = data.name
|
|
|
|
|
// this.form.pid = data.id
|
|
|
|
|
this.form.catalogs_ids = node.checkedKeys
|
|
|
|
|
console.log("this.form.catalogs_ids",this.form.catalogs_ids)
|
|
|
|
|
this.$forceUpdate()
|
|
|
|
|
getSelectedNodes() {
|
|
|
|
|
if (this.$refs.tree) {
|
|
|
|
|
this.form.catalogs_ids = this.$refs.tree.getCheckedKeys()
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
setCatalogCheckedKeys(catalogIds = []) {
|
|
|
|
|
this.$nextTick(() => {
|
|
|
|
|
if (this.$refs.tree) {
|
|
|
|
|
this.$refs.tree.setCheckedKeys(catalogIds, false)
|
|
|
|
|
}
|
|
|
|
|
})
|
|
|
|
|
},
|
|
|
|
|
handleCurrentChange(page) {
|
|
|
|
|
this.paginations.page = page
|
|
|
|
|
this.load()
|
|
|
|
|
},
|
|
|
|
|
search() {
|
|
|
|
|
this.paginations.page = 1
|
|
|
|
|
this.load()
|
|
|
|
|
},
|
|
|
|
|
initLoad() {
|
|
|
|
|
var that = this;
|
|
|
|
|
@ -236,8 +274,13 @@
|
|
|
|
|
},
|
|
|
|
|
load() {
|
|
|
|
|
var that = this;
|
|
|
|
|
listuser().then(response => {
|
|
|
|
|
listuser({
|
|
|
|
|
page: this.paginations.page,
|
|
|
|
|
page_size: this.paginations.page_size,
|
|
|
|
|
keyword: this.searchFields.keyword
|
|
|
|
|
}).then(response => {
|
|
|
|
|
var data = response.data;
|
|
|
|
|
this.paginations.total = response.total;
|
|
|
|
|
var _rolelist = [];
|
|
|
|
|
for (var m of data) {
|
|
|
|
|
_rolelist = that.roleList;
|
|
|
|
|
@ -253,8 +296,6 @@
|
|
|
|
|
mod.checked = false;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
console.log(_u_rolelist)
|
|
|
|
|
//break;
|
|
|
|
|
m.rolelist = _u_rolelist;
|
|
|
|
|
}
|
|
|
|
|
that.tableData = data;
|
|
|
|
|
@ -321,19 +362,26 @@
|
|
|
|
|
var result = Object.assign(this.form, obj);
|
|
|
|
|
this.userNameStatus = false;
|
|
|
|
|
this.form = result;
|
|
|
|
|
this.form.catalogs_ids = Array.isArray(obj.catalogs_ids) ? obj.catalogs_ids : []
|
|
|
|
|
this.form.password = ''
|
|
|
|
|
} else {
|
|
|
|
|
this.userNameStatus = true;
|
|
|
|
|
this.form.catalogs_ids = []
|
|
|
|
|
}
|
|
|
|
|
this.dialogFormVisible = true;
|
|
|
|
|
this.setCatalogCheckedKeys(this.form.catalogs_ids)
|
|
|
|
|
},
|
|
|
|
|
submitForm(formName) {
|
|
|
|
|
var that = this;
|
|
|
|
|
if(that.form.password.length<6){
|
|
|
|
|
if (that.form.password && that.form.password.length < 6) {
|
|
|
|
|
this.$Message.warning('密码不能少于6位')
|
|
|
|
|
return
|
|
|
|
|
}
|
|
|
|
|
if (!that.form.id && (!that.form.password || that.form.password.length < 6)) {
|
|
|
|
|
this.$Message.warning('密码不能少于6位')
|
|
|
|
|
return
|
|
|
|
|
}
|
|
|
|
|
console.log("that.form.catalogs_ids",that.form.catalogs_ids)
|
|
|
|
|
// return
|
|
|
|
|
this.getSelectedNodes()
|
|
|
|
|
this.$refs[formName].validate((valid) => {
|
|
|
|
|
if (valid) {
|
|
|
|
|
save({
|
|
|
|
|
@ -357,6 +405,7 @@
|
|
|
|
|
resetForm(formName) {
|
|
|
|
|
var that = this;
|
|
|
|
|
this.$refs[formName].resetFields();
|
|
|
|
|
this.form.catalogs_ids = []
|
|
|
|
|
that.dialogFormVisible = false;
|
|
|
|
|
},
|
|
|
|
|
setrole(obj) {
|
|
|
|
|
|