Commit 2fbe23d0 by 无尘

add: 增加成员编辑

parent 96e4633f
...@@ -7,16 +7,16 @@ ...@@ -7,16 +7,16 @@
<el-form-item label="管理员角色" prop="roleName" class=""> <el-form-item label="管理员角色" prop="roleName" class="">
<el-input v-model="ruleForm.roleName" disabled placeholder="" class="w-380"></el-input> <el-input v-model="ruleForm.roleName" disabled placeholder="" class="w-380"></el-input>
</el-form-item> </el-form-item>
<el-form-item label="选择人员" prop="name" class=""> <el-form-item :label="ruleForm.userId?'' : '选择人员'" prop="name" class="">
<div class="flex w-380 flex-wrap"> <div class="flex w-380 flex-wrap">
<template v-for="(item,index) in ruleForm.peopleList"> <template v-for="(item,index) in ruleForm.peopleList">
<div class="people-cell"> <div class="people-cell" :key="index + item.name">
<img :src="item.headPic"/> <img :src="item.headPic"/>
<p>{{item.name}}</p> <p>{{item.name}}</p>
<i class="el-icon-circle-close" @click.stop="delField(index,item,ruleForm.peopleList)"></i> <i class="el-icon-circle-close" v-if="!ruleForm.userId" @click.stop="delField(index,item,ruleForm.peopleList)"></i>
</div> </div>
</template> </template>
<div class="people-cell"> <div class="people-cell" v-if="!ruleForm.userId">
<span class="add-icon" @click.stop="showDialogLayer('people',ruleForm.peopleList)"><i class="el-icon-plus"></i></span> <span class="add-icon" @click.stop="showDialogLayer('people',ruleForm.peopleList)"><i class="el-icon-plus"></i></span>
</div> </div>
</div> </div>
...@@ -46,9 +46,9 @@ ...@@ -46,9 +46,9 @@
<el-select v-model="ruleForm.brandValue" multiple placeholder="请选择"> <el-select v-model="ruleForm.brandValue" multiple placeholder="请选择">
<el-option <el-option
v-for="item in ruleForm.brandOptions" v-for="item in ruleForm.brandOptions"
:key="item.brandId" :key="item.groupId"
:label="item.name" :label="item.name"
:value="item.brandId"> :value="item.groupId">
</el-option> </el-option>
</el-select> </el-select>
</div> </div>
...@@ -71,7 +71,7 @@ ...@@ -71,7 +71,7 @@
</div> </div>
</el-form-item> </el-form-item>
<el-form-item class="m-t-24"> <el-form-item class="m-t-24">
<el-button type="primary" v-if="!ruleForm.userId" @click="submitForm('ruleForm')">保存</el-button> <el-button type="primary" @click="submitForm('ruleForm')">保存</el-button>
</el-form-item> </el-form-item>
</el-form> </el-form>
</div> </div>
...@@ -191,7 +191,13 @@ export default { ...@@ -191,7 +191,13 @@ export default {
}); });
that.ruleForm.brandValue.forEach(function(item){ that.ruleForm.brandValue.forEach(function(item){
// 品牌只有 brandId 无 storeId , 如:['57b303dff06c4e758e26951f5e9c5e97'] // 品牌只有 brandId 无 storeId , 如:['57b303dff06c4e758e26951f5e9c5e97']
data.push({storeId: item.storeId?item.storeId : item}); // 如果是企业管理员
if (that.ruleForm.roleCode === 'admin') {
data.push({ groupId: item });
}else {
// 如果是子管理员
item.storeId? data.push({ storeId: item.storeId }) : data.push({ groupId: item.groupId });
}
}); });
let clerks = (that.ruleForm.peopleList.map(item=>item.employeeClerkId)).join(','); let clerks = (that.ruleForm.peopleList.map(item=>item.employeeClerkId)).join(',');
that.postSave(data,clerks); that.postSave(data,clerks);
...@@ -426,7 +432,20 @@ export default { ...@@ -426,7 +432,20 @@ export default {
let resData = res.data; let resData = res.data;
if (resData.errorCode == 1) { if (resData.errorCode == 1) {
if (!!resData.result) { if (!!resData.result) {
that.ruleForm.peopleList = [resData.result.user];
resData.result.admList.forEach(function(ele,index){
ele.id = ele.groupId;
ele.label = ele.name;
})
that.ruleForm.departList = resData.result.admList || [];
resData.result.storeList.forEach(function(ele,index){
ele.id = ele.groupId? ele.groupId : ele.storeId;
ele.label = ele.name;
})
that.ruleForm.brandValue = that.ruleForm.roleCode === 'admin'? resData.result.storeList.map(item=>item.groupId): (resData.result.storeList|| []);
console.log(that.ruleForm)
}else { }else {
that.$message.error({ that.$message.error({
duration: 1000, duration: 1000,
...@@ -473,11 +492,11 @@ export default { ...@@ -473,11 +492,11 @@ export default {
path: '/setChildAdmin' path: '/setChildAdmin'
}, },
{ {
name: '查看成员', name: '编辑成员',
path: '' path: ''
} }
] ]
// that.getUserData() that.getUserData()
} }
}, },
components: { components: {
......
...@@ -49,8 +49,14 @@ ...@@ -49,8 +49,14 @@
<el-table-column <el-table-column
label="操作"> label="操作">
<template slot-scope="scope" v-if="scope.row.canEdit == 1"> <template slot-scope="scope" v-if="scope.row.canEdit == 1">
<el-button @click="handleShow(scope.$index,scope.row,roleRightObj.roleCode)" type="text" size="small">查看</el-button> <el-button
<el-button @click="handleDel(scope.$index,scope.row)" type="text" size="small">删除</el-button> @click="handleShow(scope.$index,scope.row,roleRightObj.roleCode)"
type="text"
size="small">编辑</el-button>
<el-button
@click="handleDel(scope.$index,scope.row)"
type="text"
size="small">删除</el-button>
</template> </template>
</el-table-column> </el-table-column>
</el-table> </el-table>
...@@ -183,7 +189,13 @@ export default { ...@@ -183,7 +189,13 @@ export default {
*/ */
handleDel(index,item) { handleDel(index,item) {
const that = this; const that = this;
that.postDelUser(item.userId,index); that.$alert('确定要删除?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
}).then(({ value }) => {
that.postDelUser(item.userId,index);
}).catch(() => {
});
}, },
postDelUser(userId,index) { postDelUser(userId,index) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment