经营主体账号改造完成

This commit is contained in:
aixianling
2022-02-25 18:13:30 +08:00
parent cb60468d0e
commit 1f17f126d0
4 changed files with 175 additions and 65 deletions

View File

@@ -1,84 +1,29 @@
<template>
<section class="AppPortalAccount">
<ai-list>
<ai-title slot="title" title="用户账号" isShowBottomBorder/>
<template #content>
<ai-search-bar>
<template #left>
<ai-select v-model="search.enterpriseStatus" :selectList="dict.getDict('enterpriseStatus')"
placeholder="认证状态"/>
<ai-select v-model="search.status" :selectList="dict.getDict('portalUserStatus')" placeholder="账号状态"/>
</template>
<template #right>
<el-input size="small" placeholder="搜索姓名、手机号" v-model="search.name" clearable
@change="page.current=1,getTableData()"/>
</template>
</ai-search-bar>
<ai-table :tableData="tableData" :total="page.total" :current.sync="page.current" :size.sync="page.size"
@getList="getTableData" :col-configs="colConfigs" :dict="dict">
<el-table-column slot="options" label="操作" fixed="right" align="center">
<template slot-scope="{row}">
<el-button v-if="row.status==0" type="text" @click="handleEnable(row)">启用</el-button>
<el-button v-else-if="row.status==1" type="text" @click="handleEnable(row)">禁用</el-button>
<el-button type="text">详情</el-button>
</template>
</el-table-column>
</ai-table>
</template>
</ai-list>
<component :is="currentComponent" :instance="instance" :dict="dict" :permissions="permissions"/>
</section>
</template>
<script>
import PaList from "./paList";
import PaDetail from "./paDetail";
export default {
name: "AppPortalAccount",
components: {PaDetail, PaList},
label: "用户账号(经营主体)",
props: {
instance: Function,
dict: Object,
permissions: Function
},
data() {
return {
search: {name: "",},
page: {current: 1, size: 10, total: 0},
tableData: [],
colConfigs: [
{label: "用户账号", prop: "phone"},
{label: "企业注册数量", prop: ""},
{label: "认证状态", prop: ""},
{label: "注册时间", prop: "createTime"},
{label: "账号状态", prop: "status",dict},
{slot: "options"}
]
}
},
methods: {
getTableData() {
this.instance.post("/appportaluser/list", null, {
params: {...this.page, ...this.search}
}).then(res => {
if (res?.data) {
this.tableData = res.data?.records
this.page.total = res.data.total
}
})
},
handleEnable(row) {
let status = (++row.status) % 2
this.$confirm(`是否要${this.dict.getLabel('status', status)}账号?`).then(() => {
this.instance.post("/appportaluser/addOrUpdate", {...row, status}).then(res => {
if (res?.code == 0) {
this.$message.success(this.dict.getLabel('status', status) + "成功!")
this.getTableData()
}
})
}).catch(() => 0)
computed: {
currentComponent() {
return !!this.$route.query.id ? PaDetail : PaList
}
},
created() {
this.dict.load("portalUserStatus", "enterpriseStatus")
this.getTableData()
this.dict.load("portalUserStatus", "enterpriseStatus", "userEnterpriseStatus","enterpriseType")
}
}
</script>

View File

@@ -0,0 +1,74 @@
<template>
<section class="paDetail">
<ai-detail>
<ai-title slot="title" title="用户详情" isShowBottomBorder isShowBack @onBackClick="$router.push({query:{}})"/>
<template #content>
<el-form size="small" label-width="160px">
<ai-card title="基本信息">
<template #content>
<el-form-item label="用户账号">{{ detail.phone }}</el-form-item>
<el-form-item label="注册时间">{{ detail.createTime }}</el-form-item>
</template>
</ai-card>
<ai-card title="企业信息">
<template #content>
<ai-table :tableData="detail.userEnterpriseList" :colConfigs="colConfigs" :dict="dict"
:isShowPagination="false">
<el-table-column slot="options" label="操作" align="center">
<template slot-scope="{row}">
<el-button type="text"
@click="$router.push({name:'973f0339e5904d99bc8afe86b8cf4e9c',query:{id:row.id}})">详情
</el-button>
</template>
</el-table-column>
</ai-table>
</template>
</ai-card>
</el-form>
</template>
</ai-detail>
</section>
</template>
<script>
export default {
name: "paDetail",
props: {
instance: Function,
dict: Object,
permissions: Function
},
data() {
return {
detail: {},
colConfigs: [
{label: "企业名称", prop: "enterpriseName"},
{label: "企业类型", prop: "enterpriseType", dict: "enterpriseType", align: "center"},
{label: "状态", prop: "status", dict: "enterpriseStatus", align: "center"},
{slot: "options"},
]
}
},
methods: {
getDetail() {
let {id} = this.$route.query
this.instance.post("/appportaluser/queryDetailByPortalUserId", null, {
params: {id}
}).then(res => {
if (res?.data) {
this.detail = res.data
}
})
},
},
created() {
this.getDetail()
}
}
</script>
<style lang="scss" scoped>
.paDetail {
height: 100%;
}
</style>

View File

@@ -0,0 +1,92 @@
<template>
<section class="paList">
<ai-list>
<ai-title slot="title" title="用户账号" isShowBottomBorder/>
<template #content>
<ai-search-bar>
<template #left>
<ai-select v-model="search.userEnterpriseStatus" :selectList="dict.getDict('userEnterpriseStatus')"
placeholder="认证状态" @change="page.current=1,getTableData()"/>
<ai-select v-model="search.status" :selectList="dict.getDict('portalUserStatus')" placeholder="账号状态"
@change="page.current=1,getTableData()"/>
</template>
<template #right>
<el-input size="small" placeholder="搜索用户账号" v-model="search.phone" clearable
@change="page.current=1,getTableData()"/>
</template>
</ai-search-bar>
<ai-table :tableData="tableData" :total="page.total" :current.sync="page.current" :size.sync="page.size"
@getList="getTableData" :col-configs="colConfigs" :dict="dict">
<el-table-column slot="options" label="操作" fixed="right" align="center">
<template slot-scope="{row}">
<el-button v-if="row.status==0" type="text" @click="handleEnable(row)">启用</el-button>
<el-button v-else-if="row.status==1" type="text" @click="handleEnable(row)">禁用</el-button>
<el-button type="text" @click="showDetail(row.id)">详情</el-button>
</template>
</el-table-column>
</ai-table>
</template>
</ai-list>
</section>
</template>
<script>
export default {
name: "paList",
props: {
instance: Function,
dict: Object,
permissions: Function
},
data() {
return {
search: {name: "",},
page: {current: 1, size: 10, total: 0},
tableData: [],
colConfigs: [
{label: "用户账号", prop: "phone"},
{label: "企业注册数量", prop: "enterpriseNumber", align: "center"},
{label: "认证状态", prop: "userEnterpriseStatus", dict: "userEnterpriseStatus", align: "center"},
{label: "注册时间", prop: "createTime"},
{label: "账号状态", prop: "status", dict: "portalUserStatus", align: "center"},
{slot: "options"}
]
}
},
methods: {
getTableData() {
this.instance.post("/appportaluser/listPortalUser", null, {
params: {...this.page, ...this.search}
}).then(res => {
if (res?.data) {
this.tableData = res.data?.records
this.page.total = res.data.total
}
})
},
handleEnable(row) {
let status = (Number(row.status) + 1) % 2
this.$confirm(`是否要${this.dict.getLabel('portalUserStatus', status)}账号?`).then(() => {
this.instance.post("/appportaluser/addOrUpdate", {...row, status}).then(res => {
if (res?.code == 0) {
this.$message.success(this.dict.getLabel('portalUserStatus', status) + "成功!")
this.getTableData()
}
})
}).catch(() => 0)
},
showDetail(id) {
this.$router.push({query: {id}})
}
},
created() {
this.getTableData()
}
}
</script>
<style lang="scss" scoped>
.paList {
height: 100%;
}
</style>

View File

@@ -76,7 +76,6 @@ export default {
},
},
created() {
this.dict.load("auditStatus")
this.getDetail()
}
}