|
@@ -0,0 +1,114 @@
|
|
|
+<template>
|
|
|
+ <div class="app-container">
|
|
|
+ <search-form
|
|
|
+ :list-loading="listLoading"
|
|
|
+ @change="searchHandle"
|
|
|
+ />
|
|
|
+ <table-list
|
|
|
+ :list-loading="listLoading"
|
|
|
+ :data="tableData2"
|
|
|
+ :columns="listConfig"
|
|
|
+ :current-page="currentPage"
|
|
|
+ :page-size="pageSize"
|
|
|
+ :total-records="totalRecords"
|
|
|
+ @currentChange="pageHandle"
|
|
|
+ :isAdd="true"
|
|
|
+ @add="openPopup"
|
|
|
+ />
|
|
|
+ <popup-edit
|
|
|
+ :isShow="isDtlShow"
|
|
|
+ :curObj="curObj"
|
|
|
+ @close="closePopup"
|
|
|
+ />
|
|
|
+ </div>
|
|
|
+</template>
|
|
|
+<script>
|
|
|
+import { arrToObj } from '@/utils'
|
|
|
+import SearchForm from './components/searchForm/Index'
|
|
|
+import PopupEdit from './components/popup/IndexEdit'
|
|
|
+import baseTable from '_m/baseTable.js'
|
|
|
+import xData from './mixin'
|
|
|
+export default {
|
|
|
+ name: 'index',
|
|
|
+ components: {
|
|
|
+ SearchForm,
|
|
|
+ PopupEdit,
|
|
|
+ },
|
|
|
+ provide() {
|
|
|
+ return {
|
|
|
+ parentData: this
|
|
|
+ }
|
|
|
+ },
|
|
|
+ mixins: [baseTable],
|
|
|
+ data() {
|
|
|
+ return {
|
|
|
+ apiStr: 'user.admwechatuserlist',
|
|
|
+ searchForm: null,
|
|
|
+ isDtlShow: false,
|
|
|
+ curObj: {},
|
|
|
+ ...xData
|
|
|
+ }
|
|
|
+ },
|
|
|
+ computed: {
|
|
|
+ tableData2() {
|
|
|
+ const arr = [...this.tableData]
|
|
|
+ arr.map(item => {
|
|
|
+ })
|
|
|
+ return arr
|
|
|
+ }
|
|
|
+ },
|
|
|
+ created() {},
|
|
|
+ mounted() {
|
|
|
+ this.listConfig = {
|
|
|
+ rows: [
|
|
|
+ { label: '头像', prop: 'avatar', type: 'img' },
|
|
|
+ { label: '昵称', prop: 'nickname' },
|
|
|
+ { label: '手机号', prop: 'email' },
|
|
|
+ { label: '注册时间', prop: 'create_at' },
|
|
|
+ // { label: '操作', width: 200, type: 'handle2', operations:
|
|
|
+ // [
|
|
|
+ // { label: '编辑', func: this.openPopup, btnType: 'primary' },
|
|
|
+ // { label: '删除', func: this.delHandle, btnType: 'danger' },
|
|
|
+ // ]
|
|
|
+ // }
|
|
|
+ ]
|
|
|
+ }
|
|
|
+ },
|
|
|
+ methods: {
|
|
|
+ delHandle(row) {
|
|
|
+ this.$msg(`您确定要删除该用户吗?`, 'confirm', () => {
|
|
|
+ this.$api.user.admadmindel({
|
|
|
+ id: row.id
|
|
|
+ }).then(data => {
|
|
|
+ this.$msgs(`已删除!`)
|
|
|
+ this.fetchData()
|
|
|
+ })
|
|
|
+ }, null, true)
|
|
|
+ },
|
|
|
+ openPopup(row) {
|
|
|
+ if (row && row.id) {
|
|
|
+ this.curObj = row
|
|
|
+ } else {
|
|
|
+ this.curObj = {}
|
|
|
+ }
|
|
|
+ this.isDtlShow = true
|
|
|
+ },
|
|
|
+ closePopup(obj) {
|
|
|
+ if (obj) {
|
|
|
+ const params = obj
|
|
|
+ let apiStr = 'admadminadd'
|
|
|
+ if (obj.id) apiStr = 'admadminedit'
|
|
|
+ this.$api.user[apiStr]({
|
|
|
+ ...params
|
|
|
+ }).then(data => {
|
|
|
+ this.$msgs(obj.id ? '编辑成功' : '新增成功')
|
|
|
+ this.fetchData()
|
|
|
+ this.isDtlShow = false
|
|
|
+ })
|
|
|
+ } else {
|
|
|
+ this.isDtlShow = false
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+}
|
|
|
+</script>
|