From c650990e88803f1202c54d7765a88f360286269c Mon Sep 17 00:00:00 2001 From: chenqf <584883665@139.com> Date: Mon, 28 Feb 2022 21:16:04 +0800 Subject: [PATCH] =?UTF-8?q?=E6=96=B0=E5=A2=9E=E5=B9=B3=E5=8F=B0=E5=88=97?= =?UTF-8?q?=E8=A1=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/api/auth/platform.js | 29 ++++ src/router/index.js | 11 +- src/views/userManage/platform.vue | 265 ++++++++++++++++++++++++++++++ 3 files changed, 304 insertions(+), 1 deletion(-) create mode 100644 src/api/auth/platform.js create mode 100644 src/views/userManage/platform.vue diff --git a/src/api/auth/platform.js b/src/api/auth/platform.js new file mode 100644 index 0000000..0c867fc --- /dev/null +++ b/src/api/auth/platform.js @@ -0,0 +1,29 @@ +import axios from "../../utils/axios"; + +export function getPlatform(query) { + return axios({ + url: "/udims/platform/list", + method: "get", + params: query + }); +} + +export function updatePlatform(data) { + console.log(JSON.stringify(data)); + return axios({ + url: "/udims/platform/update", + method: "post", + data: data + }); +} + +export function deletePlatform(data) { + return axios({ + url: "/udims/platform/remove", + method: "post", + data: data + }); +} + + + diff --git a/src/router/index.js b/src/router/index.js index 9c3b1fb..b987ca1 100644 --- a/src/router/index.js +++ b/src/router/index.js @@ -18,6 +18,7 @@ import registerManage from "../views/userManage/registerManage.vue"; import userAccountManage from "../views/userManage/userAccountManage.vue"; import customerManage from "../views/userManage/customerManage.vue"; import customerInfo from "../views/userManage/customerInfo.vue"; +import platform from "../views/userManage/platform.vue"; //菜单管理 import unit from "../views/warehouse/unit.vue"; @@ -248,7 +249,15 @@ export const asyncRouterMap = [ authRule: ["admin/customerManage"] } }, - + { + path: "platform", + component: platform, + name: "自助平台列表", + icon: "", + meta: { + authRule: ["admin/platform"] + } + }, ] }, diff --git a/src/views/userManage/platform.vue b/src/views/userManage/platform.vue new file mode 100644 index 0000000..8be39aa --- /dev/null +++ b/src/views/userManage/platform.vue @@ -0,0 +1,265 @@ +<template> + <div> + <el-form :inline="true" :model="filterQuery" class="query-form" size="mini"> + <el-row> + <el-form-item class="query-form-item"> + <el-input + v-model="filterQuery.name" + placeholder="自助平台名称" + ></el-input> + </el-form-item> + + <el-form-item> + <el-button-group> + <el-button + type="primary" + icon="el-icon-refresh" + @click="onReset" + ></el-button> + <el-button type="primary" icon="search" @click="onSubmit" + >查询</el-button + > + <el-button type="primary" icon="search" @click="handleAddClick" + >添加自助平台信息</el-button + > + </el-button-group> + </el-form-item> + </el-row> + </el-form> + + <el-table v-loading="loading" :data="list" style="width: 100%"> + <el-table-column label="序号" type="index"></el-table-column> + <el-table-column + label="自助平台名称" + prop="name" + width="260" + ></el-table-column> + <el-table-column + label="自助平台访问地址" + prop="host" + width="260" + ></el-table-column> + + + <el-table-column label="操作" width="120"> + <template slot-scope="scope"> + <el-button + type="text" + size="small" + @click.native.stop="handleModifyClick(scope.row)" + >编辑</el-button + > + + <el-button + type="text" + size="small" + @click.native.stop="deleteDialog(scope.row)" + >删除</el-button + > + </template> + </el-table-column> + </el-table> + <el-dialog title="平台信息编辑" :visible.sync="formVisible" width="40%"> + <el-form :model="formData" :rules="formRules" ref="dataForm"> + <el-row :gutter="20" class="el-row" type="flex"> + <el-col :span="10" class="el-col" type="flex"> + <div class="text item"> + <el-form-item label="平台名称" prop="name"> + <el-input + v-model="formData.name" + style="width: 100%" + size="small" + ></el-input> + + </el-form-item> + </div> + </el-col> + + </el-row> + + <el-row :gutter="20" class="el-row" type="flex"> + <el-col :span="10" class="el-col" type="flex"> + <div class="text item"> + <el-form-item label="平台访问地址" prop="host"> + <el-input + v-model="formData.host" + style="width: 100%" + size="small" + ></el-input> + </el-form-item> + </div> + </el-col> + + </el-row> + + + </el-form> + + <div slot="footer" class="dialog-footer"> + <el-button @click.native="cancelDialog" size="small">取消</el-button> + <el-button type="primary" size="small" @click.native="formSubmit()" + >提交</el-button + > + </div> + </el-dialog> + + + + <el-pagination + :page-size="filterQuery.limit" + @current-change="handleCurrentChange" + layout="prev, pager, next" + :total="total" + ></el-pagination> + </div> +</template> + +<script> +import { checkPass } from "../../api/auth/register"; +import { authAdminRoleList } from "../../api/auth/authAdmin"; +import { + getPlatform, + updatePlatform, + deletePlatform, +} from "../../api/auth/platform"; + +export default { + data() { + return { + filterQuery: { + name: "", + host: "", + page: 1, + limit: 20, + }, + value: "", + total: 0, + list: [], + formVisible: false, + timer: "", + formData: { + id:"", + name: "", + host: "", + + }, + + check: "", + roles: [], + formRules: { + name: [{ required: true, message: "请输入平台名称", trigger: "blur" }], + }, + + }; + }, + filters: { + statusFilterType(status) { + const statusMap = { + 0: "gray", + 1: "success", + 2: "danger", + }; + return statusMap[status]; + }, + + }, + methods: { + onReset() { + this.$router.push({ + path: "", + }); + this.filterQuery = { + name: "", + page: 1, + limit: 20, + }; + this.getList(); + }, + formSubmit() { + this.$refs["dataForm"].validate((valid) => { + if (valid) { + updatePlatform(this.formData) + .then((response) => { + this.loading = false; + this.cancelDialog(); + this.getList(); + }) + .catch(() => { + this.cancelDialog(); + this.loading = false; + }); + } + }); + }, + onSubmit() { + this.getList(); + }, + getList() { + this.loading = true; + getPlatform(this.filterQuery) + .then((response) => { + this.loading = false; + this.list = response.data.list || []; + this.total = response.data.total || 0; + }) + .catch(() => { + this.loading = false; + this.list = []; + this.total = 0; + }); + }, + + cancelDialog() { + this.formVisible = false; + }, + + + handleAddClick() { + this.editType = 0; + this.formVisible = true; + this.formData = { + id: null, + name: null, + host: null, + }; + }, + + handleModifyClick(row) { + (this.formData = { + id: row.id, + name: row.name, + host: row.host, + + }), + + this.formVisible = true; + }, + + + + deleteDialog(row) { + this.$confirm("确认删除该自助平台信息?", "提示", { + confirmButtonText: "确定", + cancelButtonText: "取消", + type: "warning", + }) + .then(() => { + let tQuery = { + id: row.id, + }; + deletePlatform(tQuery).then(() => { + this.getList(); + }); + }) + .catch(() => {}); + }, + + + }, + + mounted() {}, + created() { + this.getList(); + }, +}; +</script> \ No newline at end of file