增加管理员帐号的店铺属性修改
This commit is contained in:
parent
ffbe761138
commit
365ae46a80
@ -8,7 +8,7 @@
|
|||||||
<el-form-item label="角色">
|
<el-form-item label="角色">
|
||||||
<el-select
|
<el-select
|
||||||
v-model="filterForm.role"
|
v-model="filterForm.role"
|
||||||
placeholder="请选择角色"
|
placeholder="所有"
|
||||||
class="w100"
|
class="w100"
|
||||||
>
|
>
|
||||||
<el-option value="">所有</el-option>
|
<el-option value="">所有</el-option>
|
||||||
@ -20,6 +20,22 @@
|
|||||||
/>
|
/>
|
||||||
</el-select>
|
</el-select>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
|
<el-form-item label="店铺">
|
||||||
|
<el-select
|
||||||
|
v-model="filterForm.department"
|
||||||
|
placeholder="所有"
|
||||||
|
class="w100"
|
||||||
|
>
|
||||||
|
<el-option value="">所有</el-option>
|
||||||
|
<el-option value="未指定">未指定</el-option>
|
||||||
|
<el-option
|
||||||
|
v-for="item in allDepts"
|
||||||
|
:key="item._id"
|
||||||
|
:label="item.name"
|
||||||
|
:value="item._id"
|
||||||
|
/>
|
||||||
|
</el-select>
|
||||||
|
</el-form-item>
|
||||||
<el-form-item>
|
<el-form-item>
|
||||||
<el-button type="primary" @click="search">查询</el-button>
|
<el-button type="primary" @click="search">查询</el-button>
|
||||||
<el-button @click="resetFilterForm">重置</el-button>
|
<el-button @click="resetFilterForm">重置</el-button>
|
||||||
@ -73,6 +89,14 @@
|
|||||||
style="margin-right: 10px;"
|
style="margin-right: 10px;"
|
||||||
>{{ formatRole(item) }}</el-tag>
|
>{{ formatRole(item) }}</el-tag>
|
||||||
</template>
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
<el-table-column
|
||||||
|
prop="department"
|
||||||
|
align="center"
|
||||||
|
label="店铺"
|
||||||
|
:formatter = "formatDept"
|
||||||
|
>
|
||||||
|
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
<el-table-column
|
<el-table-column
|
||||||
align="header-center"
|
align="header-center"
|
||||||
@ -85,6 +109,7 @@
|
|||||||
<el-table-column
|
<el-table-column
|
||||||
align="center"
|
align="center"
|
||||||
label="操作"
|
label="操作"
|
||||||
|
fixed="right"
|
||||||
>
|
>
|
||||||
<template slot-scope="scope">
|
<template slot-scope="scope">
|
||||||
<el-button
|
<el-button
|
||||||
@ -171,6 +196,26 @@
|
|||||||
</el-checkbox>
|
</el-checkbox>
|
||||||
</el-checkbox-group>
|
</el-checkbox-group>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
|
<el-form-item
|
||||||
|
label="店铺"
|
||||||
|
class="postInfo-container-item"
|
||||||
|
>
|
||||||
|
<el-select
|
||||||
|
v-model="record.department"
|
||||||
|
:remote-method="getRemoteDeptList"
|
||||||
|
filterable
|
||||||
|
default-first-option
|
||||||
|
remote
|
||||||
|
placeholder=""
|
||||||
|
>
|
||||||
|
<el-option
|
||||||
|
v-for="(item, index) in deptListOptions"
|
||||||
|
:key="item._id"
|
||||||
|
:label="item.name"
|
||||||
|
:value="item._id"
|
||||||
|
/>
|
||||||
|
</el-select>
|
||||||
|
</el-form-item>
|
||||||
<el-form-item label="锁定">
|
<el-form-item label="锁定">
|
||||||
<el-switch v-model="record.locked"/>
|
<el-switch v-model="record.locked"/>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
@ -208,6 +253,7 @@ import { getRoles } from '@/api/roles'
|
|||||||
import TagInput from '@/components/TagInput/index.vue'
|
import TagInput from '@/components/TagInput/index.vue'
|
||||||
import { deleteAdmin, getUsers, saveAdmin } from '@/api/admins'
|
import { deleteAdmin, getUsers, saveAdmin } from '@/api/admins'
|
||||||
import { IRole } from '@/views/system/role.vue'
|
import { IRole } from '@/views/system/role.vue'
|
||||||
|
import { getShops } from '@/api/shop'
|
||||||
|
|
||||||
interface IAdmin {
|
interface IAdmin {
|
||||||
id: string
|
id: string
|
||||||
@ -219,6 +265,7 @@ interface IAdmin {
|
|||||||
sex: string
|
sex: string
|
||||||
avatar: string
|
avatar: string
|
||||||
password: string
|
password: string
|
||||||
|
department: string
|
||||||
}
|
}
|
||||||
|
|
||||||
const defaultAdmin: IAdmin = {
|
const defaultAdmin: IAdmin = {
|
||||||
@ -230,7 +277,8 @@ const defaultAdmin: IAdmin = {
|
|||||||
roles: [],
|
roles: [],
|
||||||
sex: '0',
|
sex: '0',
|
||||||
password: '',
|
password: '',
|
||||||
avatar: ''
|
avatar: '',
|
||||||
|
department: '',
|
||||||
}
|
}
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
@ -252,6 +300,8 @@ export default class extends Vue {
|
|||||||
private currentPage = 1
|
private currentPage = 1
|
||||||
private pageSize = 5
|
private pageSize = 5
|
||||||
private dataCount = 0
|
private dataCount = 0
|
||||||
|
private deptListOptions = []
|
||||||
|
private allDepts = []
|
||||||
private defaultProps = {
|
private defaultProps = {
|
||||||
children: 'children',
|
children: 'children',
|
||||||
label: 'title'
|
label: 'title'
|
||||||
@ -259,7 +309,8 @@ export default class extends Vue {
|
|||||||
|
|
||||||
private filterForm = {
|
private filterForm = {
|
||||||
key: '',
|
key: '',
|
||||||
role: ''
|
role: '',
|
||||||
|
department: ''
|
||||||
}
|
}
|
||||||
|
|
||||||
$refs!: {
|
$refs!: {
|
||||||
@ -286,7 +337,8 @@ export default class extends Vue {
|
|||||||
}]
|
}]
|
||||||
}
|
}
|
||||||
|
|
||||||
created() {
|
async created() {
|
||||||
|
this.allDepts = await this.getRemoteDeptList('')
|
||||||
this.getRecords()
|
this.getRecords()
|
||||||
this.getAllRole()
|
this.getAllRole()
|
||||||
}
|
}
|
||||||
@ -309,6 +361,18 @@ export default class extends Vue {
|
|||||||
return user.roles.indexOf(this.filterForm.role) >= 0
|
return user.roles.indexOf(this.filterForm.role) >= 0
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
if (this.filterForm.department) {
|
||||||
|
if (this.filterForm.department == '未指定') {
|
||||||
|
result = result.filter(user => {
|
||||||
|
return !user.department
|
||||||
|
})
|
||||||
|
} else {
|
||||||
|
result = result.filter(user => {
|
||||||
|
return user.department == this.filterForm.department
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
this.dataCount = result.length
|
this.dataCount = result.length
|
||||||
return result
|
return result
|
||||||
}
|
}
|
||||||
@ -443,6 +507,24 @@ export default class extends Vue {
|
|||||||
})
|
})
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private async getRemoteDeptList(name: string) {
|
||||||
|
const { data } = await getShops({ key: name })
|
||||||
|
if (!data.records) return
|
||||||
|
this.deptListOptions = data.records
|
||||||
|
return data.records
|
||||||
|
}
|
||||||
|
|
||||||
|
private formatDept(row: number, column: number, cellValue: string, index: number) {
|
||||||
|
let result = '未指定'
|
||||||
|
for (let dep of this.allDepts) {
|
||||||
|
if (dep['_id'] == cellValue) {
|
||||||
|
result = dep['name']
|
||||||
|
break
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return result
|
||||||
|
}
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user