wxy 4 år sedan
förälder
incheckning
465be3af9d

+ 87 - 31
src/views/superAdminCenter/user/index.vue

@@ -5,8 +5,21 @@
         <!-- <el-col :span="24" class="add" style="text-align:right;padding: 10px 20px;">
           <el-button size="mini" type="primary" @click="toAdd" icon="el-icon-plus">添加{{ theme }}</el-button>
         </el-col> -->
-        <el-col :span="24" class="main">
+        <!-- <el-col :span="24" class="main">
           <data-table :fields="fields" :opera="opera" @edit="toEdit" :data="list" :total="total" @delete="toDelete" @query="search"></data-table>
+        </el-col> -->
+        <el-col :span="24" class="main">
+          <el-tabs v-model="activeName" type="card">
+            <el-tab-pane label="待审核" name="first">
+              <one :oneList="oneList" :total="onetotal" @handleDelete="handleDelete" @handleEdit="handleEdit1"></one>
+            </el-tab-pane>
+            <el-tab-pane label="审核成功" name="second">
+              <two :oneList="twoList" :total="twototal" @handleDelete="handleDelete" @handleEdit="handleEdit1"></two>
+            </el-tab-pane>
+            <el-tab-pane label="审核失败" name="third">
+              <three :oneList="threeList" :total="threetotal" @handleDelete="handleDelete" @handleEdit="handleEdit1"></three>
+            </el-tab-pane>
+          </el-tabs>
         </el-col>
         <el-dialog :title="theme" width="60%" :visible.sync="dialog" @closed="handleClose" :destroy-on-close="true">
           <el-form ref="form" :model="form" label-width="100px">
@@ -196,6 +209,9 @@
 </template>
 
 <script>
+import one from './parts/one.vue';
+import two from './parts/two.vue';
+import three from './parts/three.vue';
 import upload from '@/components/uploadone.vue';
 import dataTable from '@/components/data-table.vue';
 import { mapState, createNamespacedHelpers } from 'vuex';
@@ -205,36 +221,25 @@ export default {
   name: 'index',
   props: {},
   components: {
-    dataTable,
+    // dataTable,
     upload,
+    one,
+    two,
+    three,
   },
   data: function() {
     return {
       theme: '用戶',
-      opera: [
-        {
-          label: '审核',
-          icon: 'el-icon-edit',
-          method: 'edit',
-        },
-        {
-          label: '删除',
-          icon: 'el-icon-delete',
-          method: 'delete',
-          confirm: true,
-        },
-      ],
-      fields: [
-        { label: '姓名', prop: 'name', filter: 'input' },
-        { label: '电话', prop: 'phone', filter: 'input' },
-        { label: '用戶类型', prop: 'role', format: i => (i == '4' ? '个人用户' : i == '5' ? '企业用户' : i == '6' ? '专家' : '临时用户') },
-        { label: '状态', prop: 'status', format: i => (i == '0' ? '待审核' : i == '1' ? '审核成功' : i == '2' ? '审核不成功' : '待认证') },
-      ],
-      list: [],
-      total: 0,
+      activeName: 'first',
       dialog: false,
       form: {},
       editData: {},
+      oneList: [],
+      onetotal: 0,
+      twoList: [],
+      twototal: 0,
+      threeList: [],
+      threetotal: 0,
     };
   },
   created() {
@@ -245,16 +250,42 @@ export default {
     ...expertsuser({ exportuserFetch: 'fetch', exportuserCreate: 'create', exportuserUpdate: 'update' }),
     async search({ skip = 0, limit = 10, pid = '', ...info } = {}) {
       if (this.user.code == 'JLCJGLY') {
-        const res = await this.userquery({ skip, limit, ...info });
+        const res = await this.userquery({ skip, ...info });
         if (this.$checkRes(res)) {
-          this.$set(this, `list`, res.data);
-          this.$set(this, `total`, res.total);
+          let one = res.data.filter(i => i.status == '0');
+          if (one) {
+            this.$set(this, `oneList`, one);
+            this.$set(this, `onetotal`, one.length);
+          }
+          let two = res.data.filter(i => i.status == '1');
+          if (two) {
+            this.$set(this, `twototal`, two.length);
+            this.$set(this, `twoList`, two);
+          }
+          let three = res.data.filter(i => i.status == '2');
+          if (three) {
+            this.$set(this, `threeList`, three);
+            this.$set(this, `threetotal`, three.length);
+          }
         }
       } else {
         const res = await this.userquery({ skip, limit, pid, code: this.user.code, ...info });
         if (this.$checkRes(res)) {
-          this.$set(this, `list`, res.data);
-          this.$set(this, `total`, res.total);
+          let one = res.data.filter(i => i.status == '0');
+          if (one) {
+            this.$set(this, `oneList`, one);
+            this.$set(this, `onetotal`, one.length);
+          }
+          let two = res.data.filter(i => i.status == '1');
+          if (two) {
+            this.$set(this, `twototal`, two.length);
+            this.$set(this, `twoList`, two);
+          }
+          let three = res.data.filter(i => i.status == '2');
+          if (three) {
+            this.$set(this, `threeList`, three);
+            this.$set(this, `threetotal`, three.length);
+          }
         }
       }
     },
@@ -262,7 +293,7 @@ export default {
     toAdd() {
       console.log('添加');
     },
-    // 修改
+    // 修改handleEdit
     async toEdit({ data }) {
       if (data.role == '6') {
         const res = await this.exportuserFetch(data.uid);
@@ -280,9 +311,10 @@ export default {
     },
     // 提交
     async handleSave() {
+      // console.log(this.form);
       let data = this.form;
       if (data.role == '4' || data.role == '5') {
-        data.id = this.editData.uid;
+        data.id = data.uid;
         let res = await this.update(data);
         if (this.$checkRes(res)) {
           this.$message({
@@ -292,7 +324,7 @@ export default {
           this.handleClose();
         }
       } else if (data.role == '6') {
-        data.id = this.editData.uid;
+        data.id = data.uid;
         let res = await this.exportuserUpdate(data);
         if (this.$checkRes(res)) {
           this.$message({
@@ -318,6 +350,30 @@ export default {
       data == '2' ? (val = '0') : (val = '1');
       this.$set(this.form, `is_qy`, val);
     },
+    // 审核
+    handleEdit1(data) {
+      // console.log(data);
+      this.$set(this, `form`, data);
+      this.dialog = true;
+    },
+    async handleDelete(id) {
+      this.$confirm('您确定要删除此信息吗?', '提示', {
+        confirmButtonText: '确定',
+        cancelButtonText: '取消',
+        type: 'warning',
+      })
+        .then(async () => {
+          const res = await this.delete(id);
+          if (this.$checkRes(res)) {
+            this.$message({
+              message: '删除信息成功',
+              type: 'success',
+            });
+            this.search();
+          }
+        })
+        .catch(() => {});
+    },
   },
   computed: {
     ...mapState(['user']),

+ 104 - 0
src/views/superAdminCenter/user/parts/one.vue

@@ -0,0 +1,104 @@
+<template>
+  <div id="one">
+    <el-row>
+      <el-col :span="24">
+        <el-table :data="list" style="width: 100%" border>
+          <el-table-column prop="name" label="名字" align="center"> </el-table-column>
+          <el-table-column prop="phone" label="手机号" align="center"> </el-table-column>
+          <el-table-column label="用户类型" align="center">
+            <template v-slot="scoped">
+              {{ `${scoped.row.role}` == `4` ? '个人用户' : `${scoped.row.role}` == `5` ? '机构用户' : `${scoped.row.role}` == `6` ? '专家用户' : '临时用户' }}
+            </template>
+          </el-table-column>
+          <el-table-column label="状态" align="center">
+            <template v-slot="scoped">
+              {{ `${scoped.row.status}` == `0` ? '审核中' : `${scoped.row.status}` == `1` ? '审核通过' : `${scoped.row.status}` == `2` ? '审核拒绝' : '草稿' }}
+            </template>
+          </el-table-column>
+          <el-table-column fixed="right" label="操作" align="center">
+            <template slot-scope="scoped">
+              <el-tooltip content="审核" placement="bottom" effect="light">
+                <el-button type="text" size="small" @click="handleEdit(scoped.row)"><i class="el-icon-view"></i></el-button>
+              </el-tooltip>
+              <el-tooltip content="删除" placement="bottom" effect="light">
+                <el-button type="text" size="small" @click="handleDelete(scoped.row)"><i class="el-icon-delete"></i></el-button>
+              </el-tooltip>
+            </template>
+          </el-table-column>
+        </el-table>
+        <el-col :span="24" class="page">
+          <el-pagination
+            @current-change="handleCurrentChange"
+            :current-page="currentPage"
+            layout="total, prev, pager, next, jumper"
+            :total="total"
+            :page-size="pageSize"
+          >
+          </el-pagination>
+        </el-col>
+      </el-col>
+    </el-row>
+  </div>
+</template>
+
+<script>
+import { mapState, createNamespacedHelpers } from 'vuex';
+export default {
+  name: 'one',
+  props: {
+    oneList: { type: Array, default: () => [] },
+    total: { type: Number, default: 0 },
+  },
+  components: {},
+  data: function() {
+    return {
+      currentPage: 1,
+      pageSize: 10,
+      origin: [],
+      list: [],
+    };
+  },
+  created() {},
+  methods: {
+    search(page = 1) {
+      this.$set(this, `list`, this.origin[page - 1]);
+    },
+    handleCurrentChange(currentPage) {
+      this.search(currentPage);
+    },
+    handleEdit(data) {
+      this.$emit('handleEdit', data);
+      // console.log('hhhh1');
+    },
+    handleDelete(data) {
+      this.$emit('handleDelete', data.id);
+    },
+  },
+  computed: {
+    ...mapState(['user']),
+    pageTitle() {
+      return `${this.$route.meta.title}`;
+    },
+  },
+  metaInfo() {
+    return { title: this.$route.meta.title };
+  },
+  watch: {
+    oneList: {
+      immediate: true,
+      deep: true,
+      handler(val) {
+        if (val && val.length > 0) this.$set(this, `origin`, _.chunk(val, this.pageSize));
+        this.search();
+      },
+    },
+  },
+};
+</script>
+
+<style lang="less" scoped>
+.page {
+  text-align: center;
+  padding: 15px 0;
+}
+</style>

+ 103 - 0
src/views/superAdminCenter/user/parts/three.vue

@@ -0,0 +1,103 @@
+<template>
+  <div id="one">
+    <el-row>
+      <el-col :span="24">
+        <el-table :data="list" style="width: 100%" border>
+          <el-table-column prop="name" label="名字" align="center"> </el-table-column>
+          <el-table-column prop="phone" label="手机号" align="center"> </el-table-column>
+          <el-table-column label="用户类型" align="center">
+            <template v-slot="scoped">
+              {{ `${scoped.row.role}` == `4` ? '个人用户' : `${scoped.row.role}` == `5` ? '机构用户' : `${scoped.row.role}` == `6` ? '专家用户' : '临时用户' }}
+            </template>
+          </el-table-column>
+          <el-table-column label="状态" align="center">
+            <template v-slot="scoped">
+              {{ `${scoped.row.status}` == `0` ? '审核中' : `${scoped.row.status}` == `1` ? '审核通过' : `${scoped.row.status}` == `2` ? '审核拒绝' : '草稿' }}
+            </template>
+          </el-table-column>
+          <el-table-column fixed="right" label="操作" align="center">
+            <template slot-scope="scoped">
+              <el-tooltip content="审核" placement="bottom" effect="light">
+                <el-button type="text" size="small" @click="handleEdit(scoped.row)"><i class="el-icon-view"></i></el-button>
+              </el-tooltip>
+              <el-tooltip content="删除" placement="bottom" effect="light">
+                <el-button type="text" size="small" @click="handleDelete(scoped.row)"><i class="el-icon-delete"></i></el-button>
+              </el-tooltip>
+            </template>
+          </el-table-column>
+        </el-table>
+        <el-col :span="24" class="page">
+          <el-pagination
+            @current-change="handleCurrentChange"
+            :current-page="currentPage"
+            layout="total, prev, pager, next, jumper"
+            :total="total"
+            :page-size="pageSize"
+          >
+          </el-pagination>
+        </el-col>
+      </el-col>
+    </el-row>
+  </div>
+</template>
+
+<script>
+import { mapState, createNamespacedHelpers } from 'vuex';
+export default {
+  name: 'one',
+  props: {
+    oneList: { type: Array, default: () => [] },
+    total: { type: Number, default: 0 },
+  },
+  components: {},
+  data: function() {
+    return {
+      currentPage: 1,
+      pageSize: 10,
+      origin: [],
+      list: [],
+    };
+  },
+  created() {},
+  methods: {
+    search(page = 1) {
+      this.$set(this, `list`, this.origin[page - 1]);
+    },
+    handleCurrentChange(currentPage) {
+      this.search(currentPage);
+    },
+    handleEdit(data) {
+      this.$emit('handleEdit', data);
+    },
+    handleDelete(data) {
+      this.$emit('handleDelete', data.id);
+    },
+  },
+  computed: {
+    ...mapState(['user']),
+    pageTitle() {
+      return `${this.$route.meta.title}`;
+    },
+  },
+  metaInfo() {
+    return { title: this.$route.meta.title };
+  },
+  watch: {
+    oneList: {
+      immediate: true,
+      deep: true,
+      handler(val) {
+        if (val && val.length > 0) this.$set(this, `origin`, _.chunk(val, this.pageSize));
+        this.search();
+      },
+    },
+  },
+};
+</script>
+
+<style lang="less" scoped>
+.page {
+  text-align: center;
+  padding: 15px 0;
+}
+</style>

+ 103 - 0
src/views/superAdminCenter/user/parts/two.vue

@@ -0,0 +1,103 @@
+<template>
+  <div id="one">
+    <el-row>
+      <el-col :span="24">
+        <el-table :data="list" style="width: 100%" border>
+          <el-table-column prop="name" label="名字" align="center"> </el-table-column>
+          <el-table-column prop="phone" label="手机号" align="center"> </el-table-column>
+          <el-table-column label="用户类型" align="center">
+            <template v-slot="scoped">
+              {{ `${scoped.row.role}` == `4` ? '个人用户' : `${scoped.row.role}` == `5` ? '机构用户' : `${scoped.row.role}` == `6` ? '专家用户' : '临时用户' }}
+            </template>
+          </el-table-column>
+          <el-table-column label="状态" align="center">
+            <template v-slot="scoped">
+              {{ `${scoped.row.status}` == `0` ? '审核中' : `${scoped.row.status}` == `1` ? '审核通过' : `${scoped.row.status}` == `2` ? '审核拒绝' : '草稿' }}
+            </template>
+          </el-table-column>
+          <el-table-column fixed="right" label="操作" align="center">
+            <template slot-scope="scoped">
+              <el-tooltip content="审核" placement="bottom" effect="light">
+                <el-button type="text" size="small" @click="handleEdit(scoped.row)"><i class="el-icon-view"></i></el-button>
+              </el-tooltip>
+              <el-tooltip content="删除" placement="bottom" effect="light">
+                <el-button type="text" size="small" @click="handleDelete(scoped.row)"><i class="el-icon-delete"></i></el-button>
+              </el-tooltip>
+            </template>
+          </el-table-column>
+        </el-table>
+        <el-col :span="24" class="page">
+          <el-pagination
+            @current-change="handleCurrentChange"
+            :current-page="currentPage"
+            layout="total, prev, pager, next, jumper"
+            :total="total"
+            :page-size="pageSize"
+          >
+          </el-pagination>
+        </el-col>
+      </el-col>
+    </el-row>
+  </div>
+</template>
+
+<script>
+import { mapState, createNamespacedHelpers } from 'vuex';
+export default {
+  name: 'one',
+  props: {
+    oneList: { type: Array, default: () => [] },
+    total: { type: Number, default: 0 },
+  },
+  components: {},
+  data: function() {
+    return {
+      currentPage: 1,
+      pageSize: 10,
+      origin: [],
+      list: [],
+    };
+  },
+  created() {},
+  methods: {
+    search(page = 1) {
+      this.$set(this, `list`, this.origin[page - 1]);
+    },
+    handleCurrentChange(currentPage) {
+      this.search(currentPage);
+    },
+    handleEdit(data) {
+      this.$emit('handleEdit', data);
+    },
+    handleDelete(data) {
+      this.$emit('handleDelete', data.id);
+    },
+  },
+  computed: {
+    ...mapState(['user']),
+    pageTitle() {
+      return `${this.$route.meta.title}`;
+    },
+  },
+  metaInfo() {
+    return { title: this.$route.meta.title };
+  },
+  watch: {
+    oneList: {
+      immediate: true,
+      deep: true,
+      handler(val) {
+        if (val && val.length > 0) this.$set(this, `origin`, _.chunk(val, this.pageSize));
+        this.search();
+      },
+    },
+  },
+};
+</script>
+
+<style lang="less" scoped>
+.page {
+  text-align: center;
+  padding: 15px 0;
+}
+</style>