From e24b649d64849e87f79303f3f2284291ee3507af Mon Sep 17 00:00:00 2001 From: xiangpei <xiangpei@timesnew.cn> Date: 星期四, 15 八月 2024 17:48:44 +0800 Subject: [PATCH] 平台管理 --- src/api/platform/platform.js | 73 +++++++---- src/views/system/platform/index.vue | 259 +++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 304 insertions(+), 28 deletions(-) diff --git a/src/api/platform/platform.js b/src/api/platform/platform.js index 5fe4eb7..3c1737b 100644 --- a/src/api/platform/platform.js +++ b/src/api/platform/platform.js @@ -1,44 +1,61 @@ -import request from '@/utils/request' +import axios from '@/utils/request' -// 鏌ヨ骞冲彴杩愯鐩戞帶鍒楄〃 -export function listPlatform(query) { - return request({ - url: '/platform/platformMonitor/list', - method: 'get', - params: query +// 鑾峰彇骞冲彴杩愯鐩戞帶鍒嗛〉 +export const getPlatforms = (params) => { + return axios({ + url: "/platform/page", + method: "GET", + params: params }) } -// 鏌ヨ骞冲彴杩愯鐩戞帶璇︾粏 -export function getPlatform(id) { - return request({ - url: '/platform/platformMonitor/' + id, - method: 'get' +// 鑾峰彇骞冲彴杩愯鐩戞帶鍒楄〃 +export const getPlatformList = () => { + return axios({ + url: "/platform/list", + method: "GET" }) } -// 鏂板骞冲彴杩愯鐩戞帶 -export function addPlatform(data) { - return request({ - url: '/platform/platformMonitor', - method: 'post', - data: data +// 閫氳繃id鑾峰彇骞冲彴杩愯鐩戞帶 +export const getPlatformById = (params) => { + return axios({ + url: "/platform/" + params, + method: "GET" + }) +} + +// 閫氳繃id鍒犻櫎骞冲彴杩愯鐩戞帶 +export const deletePlatformById = (params) => { + return axios({ + url: "/platform/" + params, + method: "DELETE" + }) +} + +// 鎵归噺鍒犻櫎骞冲彴杩愯鐩戞帶 +export const deletePlatformByIds = (params) => { + return axios({ + url: "/platform/batch", + method: "DELETE", + data: params }) } // 淇敼骞冲彴杩愯鐩戞帶 -export function updatePlatform(data) { - return request({ - url: '/platform/platformMonitor', - method: 'put', - data: data +export const editPlatform = (params) => { + return axios({ + url: "/platform", + method: "PUT", + data: params }) } -// 鍒犻櫎骞冲彴杩愯鐩戞帶 -export function delPlatform(id) { - return request({ - url: '/platform/platformMonitor/' + id, - method: 'delete' +// 娣诲姞骞冲彴杩愯鐩戞帶 +export const addPlatform = (params) => { + return axios({ + url: "/platform", + method: "POST", + data: params }) } diff --git a/src/views/system/platform/index.vue b/src/views/system/platform/index.vue new file mode 100644 index 0000000..79a3a40 --- /dev/null +++ b/src/views/system/platform/index.vue @@ -0,0 +1,259 @@ +<template> + <div class="app-container"> + <el-form :model="queryParams" ref="queryForm" size="small" :inline="true"> + <el-form-item label="骞冲彴鍚嶇О" prop="workOrderNo"> + <el-input v-model="queryParams.platformName" placeholder="鍏抽敭璇嶆悳绱�" @clear="handleQuery" @keyup.enter.native="handleQuery" size="small"></el-input> + </el-form-item> + <el-form-item> + <el-button type="primary" icon="el-icon-search" size="small" @click="handleQuery">鎼滅储</el-button> + <el-button icon="el-icon-refresh" size="small" @click="resetQuery">閲嶇疆</el-button> + </el-form-item> + </el-form> + + <el-row :gutter="10" class="mb8"> + <el-col :span="1.5"> + <el-button + type="primary" + plain + size="mini" + @click="handleAdd" + v-hasPermi="['platform:add']" + >娣诲姞 + </el-button> + </el-col> + <el-col :span="1.5"> + <el-button + type="danger" + plain + size="mini" + @click="" + v-hasPermi="['platform:del']" + >鍒犻櫎 + </el-button> + </el-col> + </el-row> + + <div> + <el-table + :data="tableData" + :span-method="spanMethod" + border + style="width: 100%; margin-top: 20px"> + <el-table-column + prop="platform" + label="骞冲彴鍚嶇О"> + </el-table-column> + <el-table-column + prop="amount1" + label="琛屾斂鍖哄煙"> + </el-table-column> + <el-table-column + prop="IP" + label="骞冲彴IP"> + </el-table-column> + <el-table-column + prop="status" + label="鏄惁鍦ㄧ嚎"> + </el-table-column> + <el-table-column + prop="monthOutLine" + label="鏈湀绂荤嚎鏃堕暱"> + </el-table-column> + </el-table> + + <pagination + v-show="total>0" + :total="total" + :page.sync="queryParams.pageNum" + :limit.sync="queryParams.pageSize" + @pagination="handleQuery" + /> + </div> + + <el-dialog + title="鏂板骞冲彴" + :visible.sync="addShow" + width="1000px" + :before-close="addClose"> + <div style="display: flex; flex-direction: row"> + <div style="flex: 2; padding-right: 20px;"> + <div> + <h3>骞冲彴淇℃伅锛�</h3> + </div> + <el-form :model="addForm" :rules="addFormRules" ref="addForm" size="small"> + <el-form-item label="骞冲彴鍚嶇О" prop="platformName"> + <el-input v-model="addForm.platformName"></el-input> + </el-form-item> + <el-form-item label="骞冲彴IP" prop="platformIP"> + <el-input v-model="addForm.platformIP"></el-input> + </el-form-item> + <el-form-item label="澶囨敞淇℃伅" prop="mark"> + <el-input v-model="addForm.remark"></el-input> + </el-form-item> + </el-form> + </div> + <div style="flex: 4; padding-left: 20px;border-left: 1px solid #b2b2b2; min-height: 400px"> + <div> + <h3>閮ㄧ讲淇℃伅锛�</h3> + </div> + <div v-for="(deploy, index) in addForm.deployList" :key="index" style="margin-bottom: 20px"> + <el-form size="small" ref="deployForm" :inline="true"> + <el-form-item label="骞冲彴鍚嶇О" prop="platformName"> + <el-input v-model="deploy.platformName"></el-input> + </el-form-item> + <el-form-item label="骞冲彴IP" prop="platformIP"> + <el-input v-model="deploy.platformIP"></el-input> + </el-form-item> + <el-form-item label="琛屾斂鍖哄煙" prop="area"> + <el-input v-model="deploy.area"></el-input> + </el-form-item> + <el-form-item label="澶囨敞淇℃伅" prop="remark"> + <el-input v-model="deploy.remark"></el-input> + </el-form-item> + </el-form> + </div> + <el-button style="float: right" size="small" type="primary" @click="next">缁х画娣诲姞</el-button> + </div> + </div> + + <span slot="footer" class="dialog-footer"> + <el-button @click="addClose">鍙� 娑�</el-button> + <el-button type="primary" @click="addPlatform">淇濆瓨</el-button> + </span> + </el-dialog> + + </div> +</template> + +<script> +import { getPlatforms, addPlatform} from '@/api/platform/platform' +export default { + name: 'index', + data() { + return { + deployRules: { + platformName: [ + { required: true, message: '骞冲彴鍚嶇О涓嶈兘涓虹┖', trigger: 'blur' } + ], + platformIP: [ + { required: true, message: '骞冲彴IP涓嶈兘涓虹┖', trigger: 'blur' } + ], + area: [ + { required: true, message: '琛屾斂鍖哄煙涓嶈兘涓虹┖', trigger: 'blur' } + ] + }, + addFormRules: { + platformName: [ + { required: true, message: '骞冲彴鍚嶇О涓嶈兘涓虹┖', trigger: 'blur' } + ], + platformIP: [ + { required: true, message: '骞冲彴IP涓嶈兘涓虹┖', trigger: 'blur' } + ] + }, + addForm: { + platformName: '', + remark: '', + platformIp: '', + deployList: [ + { + platformName: '', + platformIp: '', + remark: '', + area: '' + } + ] // 閮ㄧ讲鍦ㄤ簡鍝簺鍦版柟 + }, + addShow: false, + timeRange: [], + queryParams: { + platformName: '' + }, + tableData: [], + total: 0 + } + }, + mounted() { + this.getList(); + }, + methods: { + next() { + this.addForm.deployList.push({ + platformName: '', + platformIp: '', + remark: '', + area: '' + }) + }, + handleAdd() { + this.addShow = true + }, + checkDeployList() { + if (this.addForm.deployList) { + return + } else { + this.addForm.deployList = this.addForm.deployList.filter(item => { + if (item.platformName && item.platformIp && item.remark && item.area) { + return true + } + }) + } + }, + addPlatform() { + this.$refs['addForm'].validate((valid) => { + if (valid) { + this.checkDeployList() + if (this.addForm.deployList) { + console.log(this.addForm.deployList[0]) + this.addForm.deployList.forEach(item => { + if (!item.platformName || !item.platformIp || !item.area) { + this.$message.error("璇锋鏌ュ钩鍙伴儴缃蹭俊鎭槸鍚﹀~鍐欏畬鏁�") + return + } + }) + } + addPlatform(this.addForm).then(res => { + this.$message.success("娣诲姞鎴愬姛") + this.addShow = false + this.getList() + }) + } + }) + }, + addClose() { + this.addShow = false + // this.addForm = { + // platformName: '', + // remark: '', + // platformIp: '', + // deployList: [] + // } + }, + getList() { + this.loading = true + this.queryParams['start'] = this.timeRange ? this.timeRange[0] : null + this.queryParams['end'] = this.timeRange ? this.timeRange[1] : null + getPlatforms(this.queryParams).then(res => { + this.tableData = res.data + this.total = res.total + this.loading = false + }) + }, + resetQuery() { + this.daterangeYwHandleTime = [] + this.resetForm('queryForm') + this.handleQuery() + }, + handleQuery() { + this.queryParams.pageNum = 1 + this.getList() + }, + spanMethod({ row, column, rowIndex, columnIndex }) { + + } + } +} +</script> + +<style scoped> + +</style> -- Gitblit v1.8.0