New file |
| | |
| | | <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> |