| | |
| | | <el-table-column label="操作" width="120"> |
| | | <template slot-scope="scope"> |
| | | <el-button @click="viewClick(scope.row)" type="text" size="small">查看</el-button> |
| | | <el-button @click="approveClick(scope.row)" type="text" size="small">审核</el-button> |
| | | <el-button |
| | | v-if="scope.row.status == 0 || scope.row.status == 3" |
| | | @click="changeStatusClick(scope.row, 1)" |
| | | type="text" |
| | | size="small" |
| | | >启用</el-button |
| | | > |
| | | <el-button |
| | | v-else-if="scope.row.status == 1" |
| | | @click="changeStatusClick(scope.row, 0)" |
| | | type="text" |
| | | size="small" |
| | | >禁用</el-button |
| | | > |
| | | <el-button v-else-if="scope.row.status == 2" @click="approveClick(scope.row)" type="text" size="small" |
| | | >审核</el-button |
| | | > |
| | | <el-button @click="editClick(scope.row)" type="text" size="small">编辑</el-button> |
| | | </template> |
| | | </el-table-column> |
| | |
| | | </div> |
| | | </div> |
| | | </div> |
| | | <!-- 新建/编辑 --> |
| | | <!-- <AddSubOrderDialog v-if="editConfig.visible" :edit-common-config="editConfig" /> --> |
| | | <!-- 查看/编辑 --> |
| | | <EditUserInfo v-if="editConfig.visible" :edit-common-config="editConfig" /> |
| | | <!-- 审核 --> |
| | | <ReviewDialog v-if="reviewConfig.visible" :edit-common-config="reviewConfig" /> |
| | | </div> |
| | | </template> |
| | | |
| | | <script> |
| | | import pageMixin from "@/components/makepager/pager/mixin/pageMixin" |
| | | import EditUserInfo from "@/views/unifiedManage/userManage/components/EditUserInfo" |
| | | import ReviewDialog from "@/views/unifiedManage/userManage/components/ReviewDialog" |
| | | import { listUser, changeStatus } from "@/api/unifiedManage/userManage" |
| | | |
| | | export default { |
| | | name: "UserManage", |
| | | props: {}, |
| | | mixins: [pageMixin], |
| | | components: {}, |
| | | components: { EditUserInfo, ReviewDialog }, |
| | | computed: {}, |
| | | data() { |
| | | return { |
| | | tableList: {}, |
| | | tableColumn: [ |
| | | { label: "用户名", prop: "username" }, |
| | | { label: "用户名", prop: "username", default: true }, |
| | | { label: "手机号", prop: "phone" }, |
| | | { label: "公司名称", prop: "company" }, |
| | | { label: "联系人姓名", prop: "contact" }, |
| | | { label: "邮箱", prop: "mailbox" }, |
| | | { label: "公司名称", prop: "companyName" }, |
| | | { label: "联系人姓名", prop: "nickName" }, |
| | | { label: "邮箱", prop: "companyEmail" }, |
| | | { label: "行业", prop: "industry" }, |
| | | { label: "地区", prop: "region" }, |
| | | { label: "状态", prop: "status" } |
| | | { label: "状态", prop: "status", isCallMethod: true, getCallMethod: this.getStatus } |
| | | ], |
| | | showCol: ["用户名", "手机号", "公司名称", "联系人姓名", "邮箱", "行业", "地区", "状态"] |
| | | showCol: ["用户名", "手机号", "公司名称", "联系人姓名", "邮箱", "行业", "地区", "状态"], |
| | | editConfig: { |
| | | visible: false, |
| | | title: "查看", |
| | | infomation: {} |
| | | }, |
| | | reviewConfig: { |
| | | visible: false, |
| | | infomation: {} |
| | | }, |
| | | obj: { |
| | | page: 1, |
| | | pageSize: 15, |
| | | keyword: "", |
| | | useType: 1 |
| | | } |
| | | } |
| | | }, |
| | | created() { |
| | | this.setTable() |
| | | this.getData() |
| | | }, |
| | | methods: { |
| | | // 获取列表值 |
| | | getData() { |
| | | this.obj.pageSize = this.pagerOptions.pageSize |
| | | this.obj.page = this.pagerOptions.currPage |
| | | listUser(this.obj).then((res) => { |
| | | console.log(res) |
| | | this.tableList.tableInfomation = res.data.list || [] |
| | | this.pagerOptions.totalCount = res.data.total |
| | | }) |
| | | }, |
| | | // 搜索 |
| | | onFilterSearch(val) { |
| | | console.log(val) |
| | | this.obj.keyword = val |
| | | this.pagerOptions.currPage = 1 |
| | | this.getData() |
| | | }, |
| | | // 查看 |
| | | viewClick(row) { |
| | | console.log(row) |
| | | this.editConfig.visible = true |
| | | this.editConfig.title = "查看" |
| | | this.editConfig.form = row |
| | | }, |
| | | // 审核 |
| | | approveClick(row) { |
| | | console.log(row) |
| | | this.reviewConfig.visible = true |
| | | this.reviewConfig.title = "用户审核" |
| | | this.reviewConfig.infomation = { ...row } |
| | | }, |
| | | // 停用 |
| | | changeStatusClick(row, status) { |
| | | if (status === 0) { |
| | | this.$confirm("是否禁用此用户?", "提示", { |
| | | confirmButtonText: "确定", |
| | | cancelButtonText: "取消", |
| | | type: "warning" |
| | | }) |
| | | .then(() => { |
| | | this.changeStatus(row, status) |
| | | }) |
| | | .catch(() => {}) |
| | | } else { |
| | | this.changeStatus(row, status) |
| | | } |
| | | }, |
| | | // 启用/禁用 |
| | | changeStatus(row, status) { |
| | | changeStatus({ |
| | | status: status, |
| | | userId: row.id |
| | | }).then((res) => { |
| | | console.log(res) |
| | | let messageStr = status === 0 ? "禁用成功" : "启用成功" |
| | | this.$message.success(messageStr) |
| | | this.getData() |
| | | }) |
| | | }, |
| | | // 编辑 |
| | | editClick(row) { |
| | | console.log(row) |
| | | this.editConfig.visible = true |
| | | this.editConfig.title = "编辑" |
| | | this.editConfig.form = { ...row } |
| | | }, |
| | | // 列表初始化 |
| | | setTable() { |
| | |
| | | selectIndex: true, |
| | | tableInfomation: [ |
| | | { |
| | | usename: "测试", |
| | | username: "测试", |
| | | status: 1 |
| | | } |
| | | ], |
| | |
| | | tableColumn: this.setColumnVisible(this.showCol) |
| | | } |
| | | this.tableList.allcol = this.tableList.tableColumn.filter((ele) => !ele.default).map((ele) => ele.label) |
| | | this.searchOptions = [] |
| | | for (let i = 0; i < this.tableList.tableColumn.length; i++) { |
| | | const label = this.tableList.tableColumn[i].label |
| | | const value = this.tableList.tableColumn[i].prop |
| | | this.searchOptions.push({ value: value, label: label }) |
| | | } |
| | | }, |
| | | setColumnVisible(showCol) { |
| | | return this.tableColumn.map((ele) => { |
| | |
| | | selTableCol(val) { |
| | | this.showcol = val |
| | | this.tableList.tableColumn = this.setColumnVisible(val) |
| | | }, |
| | | // 状态 |
| | | getStatus(val) { |
| | | return val === 0 |
| | | ? "禁用" |
| | | : val === 1 |
| | | ? "启用中" |
| | | : val === 2 |
| | | ? "待审核" |
| | | : val === 3 |
| | | ? "待启用" |
| | | : val === 4 |
| | | ? "已拒绝" |
| | | : "" |
| | | } |
| | | } |
| | | } |
| | |
| | | .body-card { |
| | | background-color: #fff; |
| | | border-radius: 12px; |
| | | height: 100%; |
| | | height: calc(100% - 10px); |
| | | overflow: hidden; |
| | | } |
| | | .list-view { |