From 9b0fb6cf78f190a863d5f74f351201b8a28f911d Mon Sep 17 00:00:00 2001
From: xiangpei <xiangpei@timesnew.cn>
Date: 星期六, 31 八月 2024 17:44:17 +0800
Subject: [PATCH] 平台管理优化
---
src/views/system/platform/index.vue | 169 ++++++++++++++++++++++++++++++++++----------------------
1 files changed, 103 insertions(+), 66 deletions(-)
diff --git a/src/views/system/platform/index.vue b/src/views/system/platform/index.vue
index 627102f..2a9a6dc 100644
--- a/src/views/system/platform/index.vue
+++ b/src/views/system/platform/index.vue
@@ -21,16 +21,6 @@
>娣诲姞
</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>
@@ -44,24 +34,33 @@
label="骞冲彴鍚嶇О">
</el-table-column>
<el-table-column
- prop="subPlatformName"
- label="瀛愮骇骞冲彴鍚嶇О">
+ prop="platformIP"
+ label="骞冲彴IP">
</el-table-column>
<el-table-column
prop="area"
label="琛屾斂鍖哄煙">
</el-table-column>
<el-table-column
- prop="platformIP"
- label="骞冲彴IP">
+ prop="remark"
+ label="澶囨敞">
</el-table-column>
+<!-- <el-table-column-->
+<!-- prop="monthOutLine"-->
+<!-- label="鏈湀绂荤嚎鏃堕暱">-->
+<!-- </el-table-column>-->
<el-table-column
- prop="status"
- label="鏄惁鍦ㄧ嚎">
- </el-table-column>
- <el-table-column
- prop="monthOutLine"
- label="鏈湀绂荤嚎鏃堕暱">
+ 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>
@@ -75,51 +74,56 @@
</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 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.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>
- </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>
@@ -130,9 +134,10 @@
</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: {
@@ -152,12 +157,17 @@
],
platformIP: [
{ required: true, message: '骞冲彴IP涓嶈兘涓虹┖', trigger: 'blur' }
+ ],
+ areaList: [
+ { required: true, message: '璇烽�夋嫨鍖哄煙', trigger: 'change' }
]
},
addForm: {
+ id: null,
platformName: '',
remark: '',
platformIp: '',
+ areaList: [],
deployList: [
{
subPlatformName: '',
@@ -174,13 +184,25 @@
},
tableData: [],
total: 0,
- currentRowNum: 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: '',
@@ -191,6 +213,13 @@
},
handleAdd() {
this.addShow = true
+ this.addForm = {
+ id: null,
+ platformName: '',
+ remark: '',
+ platformIp: '',
+ areaList: [],
+ }
},
checkDeployList() {
if (this.addForm.deployList) {
@@ -202,19 +231,27 @@
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()
- })
}
})
},
--
Gitblit v1.8.0