| | |
| | | <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-input v-model="queryParams.keyword" placeholder="关键词搜索" @clear="handleQuery" clearable @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> |
| | | </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> |
| | |
| | | label="平台名称"> |
| | | </el-table-column> |
| | | <el-table-column |
| | | prop="area" |
| | | label="行政区域"> |
| | | </el-table-column> |
| | | <el-table-column |
| | | prop="platformIP" |
| | | label="平台IP"> |
| | | </el-table-column> |
| | | <el-table-column |
| | | prop="status" |
| | | label="是否在线"> |
| | | prop="area" |
| | | label="行政区域"> |
| | | </el-table-column> |
| | | <el-table-column |
| | | prop="monthOutLine" |
| | | label="本月离线时长"> |
| | | prop="remark" |
| | | label="备注"> |
| | | </el-table-column> |
| | | <!-- <el-table-column--> |
| | | <!-- prop="monthOutLine"--> |
| | | <!-- label="本月离线时长">--> |
| | | <!-- </el-table-column>--> |
| | | <el-table-column |
| | | label="操作" |
| | | width="100"> |
| | | <template slot-scope="scope"> |
| | | <el-button @click="handleEdit(scope.row)" type="text" size="small" style="margin-right: 5px">编辑</el-button> |
| | | <el-popconfirm |
| | | @confirm="delPlatForm(scope.row.id)" |
| | | title="确定要删除该平台吗?" |
| | | > |
| | | <el-button slot="reference" type="text" size="small">删除</el-button> |
| | | </el-popconfirm> |
| | | </template> |
| | | </el-table-column> |
| | | </el-table> |
| | | |
| | |
| | | </div> |
| | | |
| | | <el-dialog |
| | | title="新增平台" |
| | | :title="opTitle" |
| | | :visible.sync="addShow" |
| | | width="1000px" |
| | | width="500px" |
| | | :close-on-click-modal="false" |
| | | :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"> |
| | | <div> |
| | | <el-form :model="addForm" label-position="top" :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="areaList"> |
| | | <el-select v-model="addForm.areaList" multiple clearable placeholder="请选择行政区域"> |
| | | <el-option |
| | | v-for="dict in dict.type.area_code" |
| | | :key="dict.value" |
| | | :label="dict.label" |
| | | :value="dict.value" |
| | | ></el-option> |
| | | </el-select> |
| | | </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> |
| | | |
| | | <!-- <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.subPlatformName"></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>--> |
| | | <span slot="footer" class="dialog-footer"> |
| | | <el-button @click="addClose">取 消</el-button> |
| | | <el-button type="primary" @click="addPlatform">保存</el-button> |
| | |
| | | </template> |
| | | |
| | | <script> |
| | | import { getPlatforms, addPlatform} from '@/api/platform/platform' |
| | | import { getPlatforms, addPlatform, editPlatform, deletePlatformById} from '@/api/platform/platform' |
| | | export default { |
| | | name: 'index', |
| | | dicts: ['area_code'], |
| | | data() { |
| | | return { |
| | | deployRules: { |
| | |
| | | ], |
| | | platformIP: [ |
| | | { required: true, message: '平台IP不能为空', trigger: 'blur' } |
| | | ], |
| | | areaList: [ |
| | | { required: true, message: '请选择区域', trigger: 'change' } |
| | | ] |
| | | }, |
| | | addForm: { |
| | | id: null, |
| | | platformName: '', |
| | | remark: '', |
| | | platformIp: '', |
| | | areaList: [], |
| | | area: '', |
| | | deployList: [ |
| | | { |
| | | platformName: '', |
| | | subPlatformName: '', |
| | | platformIp: '', |
| | | remark: '', |
| | | area: '' |
| | |
| | | addShow: false, |
| | | timeRange: [], |
| | | queryParams: { |
| | | platformName: '' |
| | | keyword: '' |
| | | }, |
| | | tableData: [], |
| | | total: 0 |
| | | total: 0, |
| | | currentRowNum: 0, |
| | | opTitle: '新增平台' |
| | | } |
| | | }, |
| | | mounted() { |
| | | this.getList(); |
| | | }, |
| | | methods: { |
| | | delPlatForm(id) { |
| | | deletePlatformById(id).then(res => { |
| | | this.$message.success("删除成功") |
| | | this.getList() |
| | | }) |
| | | }, |
| | | handleEdit(row) { |
| | | this.addForm = row; |
| | | this.opTitle = "修改平台" |
| | | this.addShow = true; |
| | | }, |
| | | next() { |
| | | this.addForm.deployList.push({ |
| | | platformName: '', |
| | |
| | | }, |
| | | handleAdd() { |
| | | this.addShow = true |
| | | this.addForm = { |
| | | id: null, |
| | | platformName: '', |
| | | remark: '', |
| | | platformIp: '', |
| | | areaList: [], |
| | | } |
| | | }, |
| | | checkDeployList() { |
| | | if (this.addForm.deployList) { |
| | |
| | | addPlatform() { |
| | | this.$refs['addForm'].validate((valid) => { |
| | | if (valid) { |
| | | this.checkDeployList() |
| | | if (this.addForm.deployList) { |
| | | console.log(this.addForm.deployList) |
| | | if (this.addForm.deployList.some(item => !item.platformName || !item.platformIP || !item.area)) { |
| | | this.$message.error("请检查平台部署信息是否填写完整"); |
| | | return; // 退出 validate 回调 |
| | | } |
| | | // this.checkDeployList() |
| | | // if (this.addForm.deployList) { |
| | | // console.log(this.addForm.deployList) |
| | | // if (this.addForm.deployList.some(item => !item.platformName || !item.platformIP || !item.area)) { |
| | | // this.$message.error("请检查平台部署信息是否填写完整"); |
| | | // return; // 退出 validate 回调 |
| | | // } |
| | | // } |
| | | if (this.addForm.id) { |
| | | editPlatform(this.addForm).then(res => { |
| | | this.$message.success("修改成功") |
| | | this.addShow = false |
| | | this.getList() |
| | | }) |
| | | } else { |
| | | addPlatform(this.addForm).then(res => { |
| | | this.$message.success("添加成功") |
| | | this.addShow = false |
| | | this.getList() |
| | | }) |
| | | } |
| | | addPlatform(this.addForm).then(res => { |
| | | this.$message.success("添加成功") |
| | | this.addShow = false |
| | | this.getList() |
| | | }) |
| | | } |
| | | }) |
| | | }, |
| | |
| | | }) |
| | | }, |
| | | resetQuery() { |
| | | this.daterangeYwHandleTime = [] |
| | | this.resetForm('queryForm') |
| | | this.handleQuery() |
| | | }, |
| | |
| | | }, |
| | | spanMethod({ row, column, rowIndex, columnIndex }) { |
| | | if (columnIndex === 0) { |
| | | if (rowIndex % 2 === 0) { |
| | | if (row.parentId === 0) { |
| | | return { |
| | | rowspan: 2, |
| | | colspan: 1 |
| | | rowspan: row.childNum + 1, |
| | | colspan: 1 // 只合并第一列 |
| | | }; |
| | | } else { |
| | | return { |
| | |
| | | }; |
| | | } |
| | | } |
| | | |
| | | } |
| | | } |
| | | } |