浏览代码

issuerList

hhyq 2 年之前
父节点
当前提交
fc0f41bb52

+ 15 - 0
src/api/issuer/list/index.js

@@ -0,0 +1,15 @@
+import request from '@/utils/request'
+import axios from 'axios'
+
+// 获取发行方列表
+export function getIssuerList(data) {
+  return axios.post('/issuer/list',data);
+}
+// 删除发行方
+export function deleteIssuer(id) {
+  return axios.post('/issuer/delete',id);
+}
+// 修改发行方
+export function updateIssuer(data) {
+  return axios.post('/issuer/update',data);
+}

+ 0 - 1
src/api/user/index.js

@@ -1,4 +1,3 @@
-import axios from "axios"
 import request from '@/utils/request'
 
 // 获取用户列表

+ 69 - 5
src/mock/index.js

@@ -83,9 +83,6 @@ let usersList = Mock.mock({
     }
     ]
 })
-
-
-
 // 分页获取
 Mock.mock('/user/list', 'post', (params) => {
     let body = JSON.parse(params.body);
@@ -269,8 +266,6 @@ Mock.mock('/order/list', 'post', (params) => {
         }
     }
 })
-
-
 // 订单删除
 Mock.mock('/order/delete', 'post', (params) => {
     let body = JSON.parse(params.body);
@@ -284,3 +279,72 @@ Mock.mock('/order/delete', 'post', (params) => {
     }
 })
 
+// 发行方管理
+let issuerList = Mock.mock({
+    "data|100": [{
+        "issuerID|+1": 1,//编号
+        "issuerName": "@ctitle",//发行方名称
+        "contact":"@cname", //联系人
+        "phone":/^1(5|3|7|8)[0-9]{9}$/, //电话号码
+        "email":"@email", //电子邮件
+        "address":"@csentence", //详细地址
+        "remarks":"@cparagraph(10)", //备注
+        avatar() {
+            return Mock.Random.image('50×50',Mock.Random.color(),'#757575','png',this.issuerName)
+        }
+    }]
+})
+// 分页获取
+Mock.mock('/issuer/list', 'post', (params)=>{
+    let body = JSON.parse(params.body);
+    let { pageIndex, pageSize, queryParams } = body
+    let newList = issuerList.data;
+    if (newList.length > 0 && queryParams.issuerID) {
+        newList = newList.filter((res) => {
+            return res.issuerID == queryParams.issuerID;
+        });
+    }
+    if (newList.length > 0 && queryParams.issuerName) {
+        newList = newList.filter((res) => {
+            return res.issuerName == queryParams.issuerName;
+        });
+    }
+    let total = newList.length;
+    let len = total / pageSize;
+    let totalPages = len - parseInt(len) > 0 ? parseInt(len) + 1 : len;
+    let newDataList = newList.slice((pageIndex - 1) * pageSize, pageIndex * pageSize);
+    return {
+        code: 200,
+        message: 'success',
+        data: {
+            pageIndex,
+            pageSize,
+            issuerList: newDataList,
+            total,
+            totalPages: totalPages,
+        }
+    }
+})
+// 删除
+Mock.mock('/issuer/delete', 'post', (params)=>{
+    let body = JSON.parse(params.body);
+    let { id } = body;
+    issuerList.data = issuerList.data.filter((res) => {
+        return res.issuerID != id;
+    });
+    return {
+        code: 200,
+        message: 'success',
+    }
+});
+// 修改
+Mock.mock('/issuer/update', 'post', (params)=>{
+    let body = JSON.parse(params.body);
+    let { issuerID,avatar,issuerName } = body;
+    
+    return {
+        code: 200,
+        message: 'success',
+    }
+});
+

+ 4 - 4
src/router/index.js

@@ -144,14 +144,14 @@ export const constantRoutes = [
       {
         path: '/issuer1',
         component: () => import('@/views/issuer/issuer1/index'),
-        name: 'issuer1',
-        meta: { title: '发行方管理', icon: 'issuer1' }
+        name: 'issuerList',
+        meta: { title: '发行方列表', icon: 'issuer1' }
       },
       {
         path: '/issuer2',
         component: () => import('@/views/issuer/issuer2/index'),
-        name: 'issuer2',
-        meta: { title: '发行方管理', icon: 'issuer1' }
+        name: 'createIssuer',
+        meta: { title: '创建发行方', icon: 'createseries' }
       },
     ]
   },

+ 1 - 1
src/views/announcement/detail/index.vue

@@ -34,7 +34,7 @@ export default{
   methods:{
     getNotice(){
       this.notice=this.$route.params.row;
-      console.log("公告",this.notice);
+      //console.log("公告",this.notice);
     }
   }
 }

+ 220 - 2
src/views/issuer/issuer1/index.vue

@@ -1,3 +1,221 @@
 <template>
-    
-</template>
+  <div class="app-container">
+    <!-- 筛选 -->
+    <el-row>
+      <div class="select-box">
+          <div class="search-title">
+            <i class="el-icon-search"></i>
+            <span>  筛选搜查</span>
+            <div class="search-button">
+              <el-button  @click="resetQuery" >重置</el-button>
+              <el-button  type="primary"  @click="handleQuery">查询搜索</el-button>
+            </div>
+          </div>
+          <el-form :model="queryParams" ref="queryForm" size="small" :inline="true" label-width="120px" class="search-form">
+            <el-form-item label="发行方ID:" prop="issuerID">
+              <el-input
+                v-model="queryParams.issuerID"
+                placeholder="请输入发行方ID"
+                clearable
+                style="width: 240px"
+                @keyup.enter.native="handleQuery"
+              />
+            </el-form-item>
+            <el-form-item label="发行方名称:" prop="issuerName">
+              <el-input
+                v-model="queryParams.issuerName"
+                placeholder="请输入发行方名称"
+                clearable
+                style="width: 240px"
+                @keyup.enter.native="handleQuery"
+              />
+            </el-form-item>
+          </el-form>
+        </div>
+    </el-row>
+    <!-- 标题 -->
+    <el-row>
+      <div class="list-title">
+        <div class="title">
+          <span class="el-icon-tickets"></span>
+          <span class="title-font">发行方列表</span>
+        </div>
+        <div class="btn-add">
+          <el-button size="small" type="primary" plain @click="handleAdd()">添加</el-button>
+        </div>
+      </div>
+    </el-row>
+
+    <el-row>
+      <!--用户数据-->
+      <el-table v-loading="loading" :data="issuerList"  border >
+        <el-table-column label="ID" align="center"  prop="issuerID" />
+        <el-table-column label="头像" align="center"  prop="avatar"  :show-overflow-tooltip="true" >
+          <template slot-scope="scope">
+            <el-avatar size="medium" :src="scope.row.avatar"></el-avatar>
+          </template>
+        </el-table-column>
+        <el-table-column label="发行方名称" align="center"  prop="issuerName"  :show-overflow-tooltip="true" />
+        <el-table-column label="操作" align="center" class-name="small-padding fixed-width" >
+        <template slot-scope="scope">
+          <el-button
+            size="mini"
+            type="text"
+            @click="handleUpdate(scope.row)"
+          >修改</el-button>
+          <el-button
+            size="mini"
+            type="text"
+            @click="handleDelete(scope.row)"
+          >删除</el-button>
+        </template>
+      </el-table-column>
+      </el-table>
+      <el-pagination
+        background
+        :current-page="pagination.current"
+        :page-size="pagination.pageSize"
+        layout="total, prev, pager, next"
+        :total="pagination.total"
+        @pagination="getList"
+        @current-change="onPageChange"
+        class="paper"
+      >
+      </el-pagination>
+    </el-row>
+  </div>
+</template>
+
+<script>
+import { getIssuerList, deleteIssuer, updateIssuer } from '@/api/issuer/list'
+
+export default {
+  name: "User",
+  data() {
+    return {
+      // 遮罩层
+      loading: true,
+      // 用户表格数据
+      issuerList: null,
+      // 查询参数
+      queryParams: {
+        issuerID: undefined,
+        issuerName: undefined,
+      },
+      // 分页参数
+      pagination:{
+        total: 0,
+        current: 1,
+        pageSize: 10,
+      },
+    };
+  },
+  created() {
+    this.getList()
+  },
+  methods: {
+    /** 查询用户列表 */
+    getList() {
+      this.loading = true;
+      getIssuerList({
+        pageIndex: this.pagination.current,
+        pageSize: this.pagination.pageSize,
+        queryParams:this.queryParams
+      }).then(response => {
+        // console.log("数据",response);
+        let data = response.data.data;
+        this.issuerList = data.issuerList;
+        this.pagination.total = data.total;
+        this.pagination.current = data.pageIndex;
+        this.loading = false;
+      });
+    },
+    /** 搜索按钮操作 */
+    handleQuery() {
+      this.pagination.current = 1;
+      this.getList();
+    },
+    /** 重置按钮操作 */
+    resetQuery() {
+      this.resetForm("queryForm");
+      this.handleQuery();
+    },
+    // 页号发生变化
+    onPageChange(number){
+      this.pagination.current=number;
+      this.getList();
+    },
+    // 添加按钮
+    handleAdd(){
+      this.$router.push({ name:"createIssuer" });
+    },
+    // 修改按钮
+    handleUpdate(row){
+      
+    },
+    // 删除按钮
+    handleDelete(row){
+      this.$confirm('是否确认删除ID为"' + row.issuerID + '"的发行方?','提示').then(function() {
+        return deleteIssuer({id:row.issuerID});
+      }).then(() => {
+        this.$message({
+          type: 'success',
+          message: '删除成功!'
+        });
+        this.getList();
+      }).catch(()=>{});
+    },
+  }
+};
+</script>
+
+<style lang="scss" scoped>
+.select-box{
+  border: 1px solid rgb(0, 0, 0,0.1);
+  border-radius: 5px;
+  padding: 20px;
+}
+.search-form{
+  margin-top: 20px;
+  padding: 0 20px;
+}
+.search-title{
+  overflow: hidden;
+}
+.search-button{
+  float: right;
+}
+.el-row {
+  margin-bottom: 20px;
+}
+.list-title {
+  height: 50px;
+  width: 100%;
+  border: solid 1px #DCDFE6;
+  border-radius: 5px;
+
+  .title {
+    margin: 14px;
+    float: left;
+  }
+
+  .title-font {
+    margin-left: 5px;
+  }
+}
+.paper{
+  float: right;
+  margin-top: 10px;
+}
+.btn-add {
+  margin: 10px;
+  float: right;
+}
+.footer{
+  height: 20px;
+  .footer-button{
+    float: right;
+  }
+}
+
+</style>