xiangpei
2024-08-30 d327dc5cc832df94a364d468aca74dea8d7624c8
src/views/system/platform/index.vue
@@ -40,15 +40,19 @@
        border
        style="width: 100%; margin-top: 20px">
        <el-table-column
          prop="platform"
          prop="platformName"
          label="平台名称">
        </el-table-column>
        <el-table-column
          prop="amount1"
          prop="subPlatformName"
          label="子级平台名称">
        </el-table-column>
        <el-table-column
          prop="area"
          label="行政区域">
        </el-table-column>
        <el-table-column
          prop="IP"
          prop="platformIP"
          label="平台IP">
        </el-table-column>
        <el-table-column
@@ -99,7 +103,7 @@
          <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-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>
@@ -156,7 +160,7 @@
        platformIp: '',
        deployList: [
          {
            platformName: '',
            subPlatformName: '',
            platformIp: '',
            remark: '',
            area: ''
@@ -169,7 +173,8 @@
        platformName: ''
      },
      tableData: [],
      total: 0
      total: 0,
      currentRowNum: 0
    }
  },
  mounted() {
@@ -189,12 +194,8 @@
    },
    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
          }
          return item.platformName || item.platformIp || item.remark || item.area;
        })
      }
    },
@@ -203,13 +204,11 @@
        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
              }
            })
            console.log(this.addForm.deployList)
            if (this.addForm.deployList.some(item => !item.platformName || !item.platformIP || !item.area)) {
              this.$message.error("请检查平台部署信息是否填写完整");
              return; // 退出 validate 回调
            }
          }
          addPlatform(this.addForm).then(res => {
            this.$message.success("添加成功")
@@ -239,7 +238,6 @@
      })
    },
    resetQuery() {
      this.daterangeYwHandleTime = []
      this.resetForm('queryForm')
      this.handleQuery()
    },
@@ -248,6 +246,19 @@
      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
          };
        }
      }
    }
  }