From a8e77f3b05d6d96c9bc64f550651b153d8238e88 Mon Sep 17 00:00:00 2001
From: xiangpei <xiangpei@timesnew.cn>
Date: 星期日, 01 九月 2024 21:54:07 +0800
Subject: [PATCH] 报备功能优化

---
 src/views/system/platform/index.vue |  308 +++++++++++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 308 insertions(+), 0 deletions(-)

diff --git a/src/views/system/platform/index.vue b/src/views/system/platform/index.vue
new file mode 100644
index 0000000..340e6a2
--- /dev/null
+++ b/src/views/system/platform/index.vue
@@ -0,0 +1,308 @@
+<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.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 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-row>
+
+    <div>
+      <el-table
+        :data="tableData"
+        :span-method="spanMethod"
+        border
+        style="width: 100%; margin-top: 20px">
+        <el-table-column
+          prop="platformName"
+          label="骞冲彴鍚嶇О">
+        </el-table-column>
+        <el-table-column
+          prop="platformIP"
+          label="骞冲彴IP">
+        </el-table-column>
+        <el-table-column
+          prop="area"
+          label="琛屾斂鍖哄煙">
+        </el-table-column>
+        <el-table-column
+          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>
+
+      <pagination
+        v-show="total>0"
+        :total="total"
+        :page.sync="queryParams.pageNum"
+        :limit.sync="queryParams.pageSize"
+        @pagination="handleQuery"
+      />
+    </div>
+
+    <el-dialog
+      :title="opTitle"
+      :visible.sync="addShow"
+      width="500px"
+      :close-on-click-modal="false"
+      :before-close="addClose">
+      <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.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>
+      </span>
+    </el-dialog>
+
+  </div>
+</template>
+
+<script>
+import { getPlatforms, addPlatform, editPlatform, deletePlatformById} from '@/api/platform/platform'
+export default {
+  name: 'index',
+  dicts: ['area_code'],
+  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' }
+        ],
+        areaList: [
+          { required: true, message: '璇烽�夋嫨鍖哄煙', trigger: 'change' }
+        ]
+      },
+      addForm: {
+        id: null,
+        platformName: '',
+        remark: '',
+        platformIp: '',
+        areaList: [],
+        area: '',
+        deployList: [
+          {
+            subPlatformName: '',
+            platformIp: '',
+            remark: '',
+            area: ''
+          }
+        ]  // 閮ㄧ讲鍦ㄤ簡鍝簺鍦版柟
+      },
+      addShow: false,
+      timeRange: [],
+      queryParams: {
+        keyword: ''
+      },
+      tableData: [],
+      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: '',
+        platformIp: '',
+        remark: '',
+        area: ''
+      })
+    },
+    handleAdd() {
+      this.addShow = true
+      this.addForm = {
+        id: null,
+        platformName: '',
+        remark: '',
+        platformIp: '',
+        areaList: [],
+      }
+    },
+    checkDeployList() {
+      if (this.addForm.deployList) {
+        this.addForm.deployList = this.addForm.deployList.filter(item => {
+          return item.platformName || item.platformIp || item.remark || item.area;
+        })
+      }
+    },
+    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 鍥炶皟
+          //   }
+          // }
+          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()
+            })
+          }
+        }
+      })
+    },
+    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.resetForm('queryForm')
+      this.handleQuery()
+    },
+    handleQuery() {
+      this.queryParams.pageNum = 1
+      this.getList()
+    },
+    spanMethod({ row, column, rowIndex, columnIndex }) {
+      if (columnIndex === 0) {
+        if (row.parentId === 0) {
+          return {
+            rowspan: row.childNum + 1,
+            colspan: 1  // 鍙悎骞剁涓�鍒�
+          };
+        } else {
+          return {
+            rowspan: 0,
+            colspan: 0
+          };
+        }
+      }
+
+    }
+  }
+}
+</script>
+
+<style scoped>
+
+</style>

--
Gitblit v1.8.0