唐耀东
2022-05-10 3a02d6a0f7c5d2dfb2df2e1635315304b85695eb
提交代码
4个文件已修改
11个文件已添加
1554 ■■■■■ 已修改文件
src/api/common/common.js 5 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/api/oa/building.js 44 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/api/oa/constructionBatch.js 44 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/api/oa/reserveIp.js 44 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/assets/styles/custom.scss 补丁 | 查看 | 原始文档 | blame | 历史
src/main.js 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/basics/building/index.vue 297 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/basics/school/index.vue 28 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/components/building/buildList.vue 129 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/components/building/form.vue 82 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/components/building/index.vue 54 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/components/school/index.vue 120 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/construction/constructionBatch/index.vue 323 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/construction/constructionList/index.vue 77 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/construction/reserveIp/index.vue 305 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/api/common/common.js
@@ -17,10 +17,11 @@
}
// 高校下拉列表
export function listSchool() {
export function listSchool(query) {
  return request({
    url: '/oa/school/select',
    method: 'get'
    method: 'get',
    params: query
  })
}
src/api/oa/building.js
New file
@@ -0,0 +1,44 @@
import request from '@/utils/request'
// 查询建筑单元列表
export function listBuilding(query) {
  return request({
    url: '/oa/building/list',
    method: 'get',
    params: query
  })
}
// 查询建筑单元详细
export function getBuilding(id) {
  return request({
    url: '/oa/building/' + id,
    method: 'get'
  })
}
// 新增建筑单元
export function addBuilding(data) {
  return request({
    url: '/oa/building',
    method: 'post',
    data: data
  })
}
// 修改建筑单元
export function updateBuilding(data) {
  return request({
    url: '/oa/building',
    method: 'put',
    data: data
  })
}
// 删除建筑单元
export function delBuilding(id) {
  return request({
    url: '/oa/building/' + id,
    method: 'delete'
  })
}
src/api/oa/constructionBatch.js
New file
@@ -0,0 +1,44 @@
import request from '@/utils/request'
// 查询施工批次列表
export function listConstructionBatch(query) {
  return request({
    url: '/oa/constructionBatch/list',
    method: 'get',
    params: query
  })
}
// 查询施工批次详细
export function getConstructionBatch(id) {
  return request({
    url: '/oa/constructionBatch/' + id,
    method: 'get'
  })
}
// 新增施工批次
export function addConstructionBatch(data) {
  return request({
    url: '/oa/constructionBatch',
    method: 'post',
    data: data
  })
}
// 修改施工批次
export function updateConstructionBatch(data) {
  return request({
    url: '/oa/constructionBatch',
    method: 'put',
    data: data
  })
}
// 删除施工批次
export function delConstructionBatch(id) {
  return request({
    url: '/oa/constructionBatch/' + id,
    method: 'delete'
  })
}
src/api/oa/reserveIp.js
New file
@@ -0,0 +1,44 @@
import request from '@/utils/request'
// 查询预留IP列表
export function listReserveIp(query) {
  return request({
    url: '/oa/reserveIp/list',
    method: 'get',
    params: query
  })
}
// 查询预留IP详细
export function getReserveIp(id) {
  return request({
    url: '/oa/reserveIp/' + id,
    method: 'get'
  })
}
// 新增预留IP
export function addReserveIp(data) {
  return request({
    url: '/oa/reserveIp',
    method: 'post',
    data: data
  })
}
// 修改预留IP
export function updateReserveIp(data) {
  return request({
    url: '/oa/reserveIp',
    method: 'put',
    data: data
  })
}
// 删除预留IP
export function delReserveIp(id) {
  return request({
    url: '/oa/reserveIp/' + id,
    method: 'delete'
  })
}
src/assets/styles/custom.scss
src/main.js
@@ -4,7 +4,7 @@
import Element from 'element-ui'
import './assets/styles/element-variables.scss'
import '@/assets/styles/custom.scss' // 自定义样式
import '@/assets/styles/index.scss' // global css
import '@/assets/styles/ruoyi.scss' // ruoyi css
import App from './App'
src/views/basics/building/index.vue
New file
@@ -0,0 +1,297 @@
<template>
  <div class="app-container">
    <el-form :model="queryParams" ref="queryForm" :inline="true" v-show="showSearch" label-width="68px">
      <!--      <el-form-item label="单元编号" prop="code">-->
      <!--        <el-input-->
      <!--          v-model="queryParams.code"-->
      <!--          placeholder="请输入单元编号"-->
      <!--          clearable-->
      <!--          size="small"-->
      <!--          @keyup.enter.native="handleQuery"-->
      <!--        />-->
      <!--      </el-form-item>-->
      <el-form-item label="单元名称" prop="name">
        <el-input
            v-model="queryParams.name"
            placeholder="请输入单元名称"
            clearable
            size="small"
            @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item>
        <el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
        <el-button icon="el-icon-refresh" size="mini" @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
            icon="el-icon-plus"
            size="mini"
            @click="handleAdd"
            v-hasPermi="['oa:building:add']"
        >新增
        </el-button>
      </el-col>
    </el-row>
    <el-table
        v-loading="loading"
        :data="buildingList"
        row-key="id"
        default-expand-all
        :tree-props="{children: 'children', hasChildren: 'hasChildren'}"
    >
      <el-table-column label="单元名称" align="center" prop="name"/>
      <el-table-column label="单元编号" prop="code"/>
      <el-table-column label="显示顺序" align="center" prop="orderNum"/>
      <el-table-column label="操作" align="center" class-name="small-padding fixed-width">
        <template slot-scope="scope">
          <el-button
              size="mini"
              type="text"
              icon="el-icon-edit"
              @click="handleUpdate(scope.row)"
              v-hasPermi="['oa:building:edit']"
          >修改
          </el-button>
          <el-button
              size="mini"
              type="text"
              icon="el-icon-plus"
              @click="handleAdd(scope.row)"
              v-hasPermi="['oa:building:add']"
          >新增
          </el-button>
          <el-button
              size="mini"
              type="text"
              class="del-btn"
              icon="el-icon-delete"
              @click="handleDelete(scope.row)"
              v-hasPermi="['oa:building:remove']"
          >删除
          </el-button>
        </template>
      </el-table-column>
    </el-table>
    <!-- 添加或修改建筑单元对话框 -->
    <el-dialog :title="title" :visible.sync="open" width="500px" append-to-body>
      <el-form ref="form" :model="form" :rules="rules" label-width="80px">
        <el-form-item label="上级单元" prop="parentId">
          <treeselect v-model="form.parentId" :options="buildingOptions" :normalizer="normalizer"
                      placeholder="请选择上级单元"/>
        </el-form-item>
        <el-form-item label="单元名称" prop="name">
          <el-input v-model="form.name" placeholder="请输入单元名称"/>
        </el-form-item>
        <el-form-item label="单元编号" prop="code">
          <el-input v-model="form.code" placeholder="请输入单元编号"/>
        </el-form-item>
        <el-form-item label="显示顺序" prop="orderNum">
          <el-input-number v-model="form.orderNum" controls-position="right" :min="0"/>
        </el-form-item>
      </el-form>
      <div slot="footer" class="dialog-footer">
        <el-button :loading="buttonLoading" type="primary" @click="submitForm">确 定</el-button>
        <el-button @click="cancel">取 消</el-button>
      </div>
    </el-dialog>
  </div>
</template>
<script>
import {listBuilding, getBuilding, delBuilding, addBuilding, updateBuilding} from "@/api/oa/building";
import Treeselect from "@riophae/vue-treeselect";
import "@riophae/vue-treeselect/dist/vue-treeselect.css";
export default {
  name: "Building",
  props: {
    schoolId: {
      type: Number,
      default: undefined
    }
  },
  components: {
    Treeselect
  },
  data() {
    return {
      // 按钮loading
      buttonLoading: false,
      // 遮罩层
      loading: true,
      // 显示搜索条件
      showSearch: true,
      // 建筑单元表格数据
      buildingList: [],
      // 建筑单元树选项
      buildingOptions: [],
      // 弹出层标题
      title: "",
      // 是否显示弹出层
      open: false,
      // 查询参数
      queryParams: {
        code: null,
        name: null,
        schoolId: this.schoolId
      },
      // 表单参数
      form: {},
      // 表单校验
      rules: {
        code: [
          {required: true, message: "单元编号不能为空", trigger: "blur"}
        ],
        name: [
          {required: true, message: "单元名称不能为空", trigger: "blur"}
        ],
        orderNum: [
          {required: true, message: "显示顺序不能为空", trigger: "change"}
        ],
        parentId: [
          {required: true, message: "上级单元不能为空", trigger: "blur"}
        ],
      }
    };
  },
  created() {
    this.getList();
  },
  methods: {
    /** 查询建筑单元列表 */
    getList() {
      this.loading = true;
      listBuilding(this.queryParams).then(response => {
        this.buildingList = this.handleTree(response.data, "id", "parentId");
        this.loading = false;
      });
    },
    /** 转换建筑单元数据结构 */
    normalizer(node) {
      if (node.children && !node.children.length) {
        delete node.children;
      }
      return {
        id: node.id,
        label: node.name,
        children: node.children
      };
    },
    /** 查询建筑单元下拉树结构 */
    getTreeselect() {
      listBuilding({schoolId: this.schoolId}).then(response => {
        this.buildingOptions = [];
        const data = {id: 0, name: '顶级节点', children: []};
        data.children = this.handleTree(response.data, "id", "parentId");
        this.buildingOptions.push(data);
      });
    },
    // 取消按钮
    cancel() {
      this.open = false;
      this.reset();
    },
    // 表单重置
    reset() {
      this.form = {
        id: null,
        code: null,
        name: null,
        schoolId: null,
        parentId: null,
        ancestors: null,
        orderNum: null,
        createBy: null,
        createTime: null,
        updateBy: null,
        updateTime: null,
        delFlag: null
      };
      this.resetForm("form");
    },
    /** 搜索按钮操作 */
    handleQuery() {
      this.getList();
    },
    /** 重置按钮操作 */
    resetQuery() {
      this.resetForm("queryForm");
      this.handleQuery();
    },
    /** 新增按钮操作 */
    handleAdd(row) {
      this.reset();
      this.getTreeselect();
      if (row != null && row.id) {
        this.form.parentId = row.id;
      } else {
        this.form.parentId = 0;
      }
      this.open = true;
      this.title = "添加建筑单元";
    },
    /** 修改按钮操作 */
    handleUpdate(row) {
      this.loading = true;
      this.reset();
      this.getTreeselect();
      if (row != null) {
        this.form.parentId = row.id;
      }
      getBuilding(row.id).then(response => {
        this.loading = false;
        this.form = response.data;
        this.open = true;
        this.title = "修改建筑单元";
      });
    },
    /** 提交按钮 */
    submitForm() {
      this.$refs["form"].validate(valid => {
        this.form.schoolId = this.schoolId;
        if (valid) {
          this.buttonLoading = true;
          if (this.form.id != null) {
            updateBuilding(this.form).then(response => {
              this.$modal.msgSuccess("修改成功");
              this.open = false;
              this.getList();
            }).finally(() => {
              this.buttonLoading = false;
            });
          } else {
            addBuilding(this.form).then(response => {
              this.$modal.msgSuccess("新增成功");
              this.open = false;
              this.getList();
            }).finally(() => {
              this.buttonLoading = false;
            });
          }
        }
      });
    },
    /** 删除按钮操作 */
    handleDelete(row) {
      this.$modal.confirm('是否确认删除"' + row.detailedName + '"?').then(() => {
        this.loading = true;
        return delBuilding(row.id);
      }).then(() => {
        this.loading = false;
        this.getList();
        this.$modal.msgSuccess("删除成功");
      }).finally(() => {
        this.loading = false;
      });
    }
  }
};
</script>
src/views/basics/school/index.vue
@@ -137,9 +137,16 @@
          <dict-tag :options="dict.type.DICT106" :value="scope.row.disciplineScope"/>
        </template>
      </el-table-column>
      <el-table-column label="备注" align="center" prop="remarks"/>
      <el-table-column label="操作" fixed="right" width="120" align="center" class-name="small-padding fixed-width">
<!--      <el-table-column label="备注" align="center" prop="remarks"/>-->
      <el-table-column label="操作" fixed="right" width="220" align="center" class-name="small-padding fixed-width">
        <template slot-scope="scope">
          <el-button
              size="mini"
              type="text"
              icon="el-icon-office-building"
              @click="handleBuild(scope.row)"
          >建筑
          </el-button>
          <el-button
            size="mini"
            type="text"
@@ -228,16 +235,24 @@
        <el-button @click="cancel">取 消</el-button>
      </div>
    </Dialog>
    <!-- 建筑 -->
    <el-drawer title="建筑单元" :visible.sync="buildOpen" size="50%" :append-to-body="true" :destroy-on-close="true">
      <building :schoolId="id"></building>
    </el-drawer>
  </div>
</template>
<script>
import {listSchool, getSchool, delSchool, addSchool, updateSchool} from "@/api/oa/school";
import {listProvince, listCity} from "@/api/common/common";
import building from '../building'
export default {
  name: "School",
  dicts: ['DICT105', 'DICT106'],
  components: {
    building
  },
  data() {
    return {
      // 按钮loading
@@ -307,7 +322,9 @@
      // 省份
      provinceFormList: [],
      // 城市
      cityFormList: []
      cityFormList: [],
      buildOpen: false,
      id: undefined
    };
  },
  created() {
@@ -467,6 +484,11 @@
      this.getCity(v).then(res => {
        this.cityFormList = res
      })
    },
    // 建筑
    handleBuild(r) {
      this.id = r.id;
      this.buildOpen = true;
    }
  }
};
src/views/components/building/buildList.vue
New file
@@ -0,0 +1,129 @@
<template>
  <div class="app-container">
    <el-form :model="queryParams" ref="queryForm" :inline="true" v-show="showSearch" label-width="68px">
      <el-form-item label="单元名称" prop="name">
        <el-input
            v-model="queryParams.name"
            placeholder="请输入单元名称"
            clearable
            size="small"
            @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item>
        <el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
        <el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
      </el-form-item>
    </el-form>
    <el-table
        ref="singleTable"
        v-loading="loading"
        :data="buildingList"
        row-key="id"
        default-expand-all
        :tree-props="{children: 'children', hasChildren: 'hasChildren'}"
        highlight-current-row
        @current-change="handleCurrentChange"
    >
      <el-table-column label="单元名称" align="center" prop="name"/>
      <el-table-column label="单元编号" prop="code"/>
      <el-table-column label="显示顺序" align="center" prop="orderNum"/>
    </el-table>
  </div>
</template>
<script>
import {listBuilding} from "@/api/oa/building";
import Treeselect from "@riophae/vue-treeselect";
import "@riophae/vue-treeselect/dist/vue-treeselect.css";
export default {
  name: "BuildingList",
  props: {
    schoolId: {
      type: Number,
      default: undefined
    }
  },
  components: {
    Treeselect
  },
  data() {
    return {
      // 按钮loading
      buttonLoading: false,
      // 遮罩层
      loading: true,
      // 显示搜索条件
      showSearch: true,
      // 建筑单元表格数据
      buildingList: [],
      // 建筑单元树选项
      buildingOptions: [],
      // 弹出层标题
      title: "",
      // 是否显示弹出层
      open: false,
      // 查询参数
      queryParams: {
        name: undefined,
        schoolId: this.schoolId
      },
      currentRow: undefined
    };
  },
  watch: {
    'schoolId': function (v) {
      this.getList()
    }
  },
  methods: {
    /** 查询建筑单元列表 */
    getList() {
      this.loading = true;
      // 清空选中状态和数据
      if (this.currentRow) {
        this.$refs.singleTable.setCurrentRow();
        this.currentRow = undefined;
      }
      listBuilding(Object.assign({}, this.queryParams, {schoolId: this.schoolId})).then(response => {
        this.buildingList = this.handleTree(response.data, "id", "parentId");
        this.loading = false;
      });
    },
    /** 转换建筑单元数据结构 */
    normalizer(node) {
      if (node.children && !node.children.length) {
        delete node.children;
      }
      return {
        id: node.id,
        label: node.name,
        children: node.children
      };
    },
    /** 查询建筑单元下拉树结构 */
    getTreeselect() {
      listBuilding({schoolId: this.schoolId}).then(response => {
        this.buildingOptions = [];
        const data = {id: 0, name: '顶级节点', children: []};
        data.children = this.handleTree(response.data, "id", "parentId");
        this.buildingOptions.push(data);
      });
    },
    /** 搜索按钮操作 */
    handleQuery() {
      this.getList();
    },
    /** 重置按钮操作 */
    resetQuery() {
      this.resetForm("queryForm");
      this.handleQuery();
    },
    handleCurrentChange(v) {
      this.currentRow = v;
    }
  }
};
</script>
src/views/components/building/form.vue
New file
@@ -0,0 +1,82 @@
<template>
  <div>
    <div class="app-container">
      <div class="tree-view">
        <div class="tree-list">
          <school ref="schoolRef" @schoolChange="schoolChange"></school>
        </div>
        <div class="right-view">
          <build-list ref="buildRef" :schoolId="schoolId"></build-list>
        </div>
      </div>
    </div>
    <div slot="footer" class="dialog-footer">
      <el-button :loading="buttonLoading" type="primary" @click="submitForm">确 定</el-button>
<!--      <el-button @click="cancel">取 消</el-button>-->
    </div>
  </div>
</template>
<script>
/**
 * 选择建筑单元
 */
import school from '../../components/school'
import buildList from "./buildList";
export default {
  name: "BuildingForm",
  components: {
    school,
    buildList
  },
  data() {
    return {
      buttonLoading: false,
      activeName: 'second',
      batchOpen: false,
      ipOpen: false,
      schoolId: undefined
    }
  },
  methods: {
    // 选择高校
    schoolChange(v) {
      this.schoolId = v;
      // this.$refs.buildRef.getList();
    },
    submitForm() {
      this.buttonLoading = true;
      if (!this.$refs.buildRef.currentRow) {
        this.$message.warning("请选择一条数据")
        this.buttonLoading = false;
        return;
      }
      this.$emit('choice', this.$refs.buildRef.currentRow);
    }
  }
}
</script>
<style scoped>
.tree-view {
  display: flex;
  flex-direction: row;
  flex: 1;
}
.tree-list {
  margin-right: 10px;
}
.right-view {
  display: flex;
  flex-direction: row;
  justify-content: space-between;
  flex: 1;
}
.right-view-title-icon {
  display: flex;
  flex-direction: row;
  height: 40px;
  align-items: center;
}
</style>
src/views/components/building/index.vue
New file
@@ -0,0 +1,54 @@
<template>
  <div>
    <el-input placeholder="请选择适用地点" :value="buildingName" disabled>
      <el-button slot="append" icon="el-icon-thumb" @click="handleBuilding"></el-button>
    </el-input>
    <el-dialog title="建筑单元" :visible.sync="open" width="800px" :append-to-body="true" :destroy-on-close="true">
      <building-form @choice="choice"></building-form>
    </el-dialog>
  </div>
</template>
<script>
import buildingForm from './form'
export default {
  name: "BuildInput",
  components: {
    buildingForm
  },
  model: {
    prop: 'value',
    event: 'change'
  },
  props: {
    value: {
      type: [Number],
      default: undefined
    },
  },
  data() {
    return {
      message: undefined,
      open: false,
      buildingName: ''
    }
  },
  methods: {
    // 选择建筑单元
    handleBuilding() {
      this.open = true;
    },
    // 选中建筑单元
    choice(r) {
      this.buildingName = r.name;
      this.open = false;
      this.$emit("change", r.id);
    }
  }
}
</script>
<style scoped>
</style>
src/views/components/school/index.vue
New file
@@ -0,0 +1,120 @@
<template>
  <div class="tree-list-main">
    <div class="tree-search">
      <div class="main-search" style="margin-bottom: 0;">
        <input class="search-input" v-model="queryParams.name" @keyup.enter.prevent="getList" placeholder="请输入名称"/>
      </div>
    </div>
    <div class="main-tree">
      <div class="question-list" v-for="item in list" :key="item.id">
        <div class="question-item text-ellipsis" :class="item.id === id ? 'question-current' : ''">
          <div class="question-item-text text-ellipsis" @click="handleClick(item.id)">{{item.name}}</div>
        </div>
      </div>
    </div>
  </div>
</template>
<script>
import {listSchool} from "@/api/common/common";
export default {
  name: "QuestionType",
  watch: {
    'queryParams.name': function (val) {
      this.getList()
    }
  },
  data() {
    return {
      id: undefined,
      // 查询参数
      queryParams: {
        name: undefined
      },
      list: []
    };
  },
  created() {
    this.getList();
  },
  methods: {
    getList() {
      this.loading = true;
      listSchool(this.queryParams).then(r => {
        this.list = r.data;
        if (this.list.length > 0) {
          this.id = this.list[0].id;
          this.$emit('schoolChange', this.id)
        }
      })
    },
    // 选中
    handleClick(id) {
      if (this.id === id) return
      this.$emit('schoolChange', id)
      this.id = id
    }
  }
};
</script>
<style scoped lang="scss">
.tree-search {
  display: flex;
  flex-direction: row;
  align-items: center;
  height: 32px;
  margin-bottom: 10px;
  .search-add {
    width: 60px;
    text-align: center;
    cursor: pointer;
    line-height: 32px;
    font-size: 14px;
    height: 100%;
    background-color: #3CA2E0;
    color: #ffffff;
  }
}
.question-list {
  display: flex;
  flex-direction: column;
  .question-item {
    height: 30px;
    line-height: 30px;
    width: 100%;
    color: #333333;
    font-size: 14px;
    padding: 0 5px;
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    .question-item-text {
      flex: 1;
    }
  }
  .question-current {
    background: #53A3FF;
    color: #ffffff !important;
  }
  .operation-region {
    display: none;
    cursor: pointer;
  }
  .question-item:hover .operation-region {
    display: block;
  }
  .question-item:hover {
    background: #F5F7FA;
    color: #333333!important;
  }
}
</style>
src/views/construction/constructionBatch/index.vue
New file
@@ -0,0 +1,323 @@
<template>
  <div class="app-container">
    <el-form :model="queryParams" ref="queryForm" :inline="true" v-show="showSearch" label-width="68px">
      <el-form-item label="施工批次" prop="batch">
        <el-input
          v-model="queryParams.batch"
          placeholder="请输入施工批次"
          clearable
          size="small"
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item>
        <el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
        <el-button icon="el-icon-refresh" size="mini" @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
          icon="el-icon-plus"
          size="mini"
          @click="handleAdd"
          v-hasPermi="['oa:constructionBatch:add']"
        >新增</el-button>
      </el-col>
      <el-col :span="1.5">
        <el-button
          type="success"
          plain
          icon="el-icon-edit"
          size="mini"
          :disabled="single"
          @click="handleUpdate"
          v-hasPermi="['oa:constructionBatch:edit']"
        >修改</el-button>
      </el-col>
      <el-col :span="1.5">
        <el-button
          type="danger"
          plain
          icon="el-icon-delete"
          size="mini"
          :disabled="multiple"
          @click="handleDelete"
          v-hasPermi="['oa:constructionBatch:remove']"
        >删除</el-button>
      </el-col>
    </el-row>
    <el-table v-loading="loading" :data="constructionBatchList" @selection-change="handleSelectionChange">
      <el-table-column type="selection" width="55" align="center" />
      <el-table-column label="序号" type="index" align="center">
        <template slot-scope="scope">
          <span>{{(queryParams.pageNum - 1) * queryParams.pageSize + scope.$index + 1}}</span>
        </template>
      </el-table-column>
      <el-table-column label="施工批次" align="center" prop="batch" />
      <el-table-column label="施工周期" align="center" width="180">
        <template slot-scope="scope">
          <span>{{ parseTime(scope.row.startDate, '{y}-{m}-{d}') + ' - ' + parseTime(scope.row.endDate, '{y}-{m}-{d}') }}</span>
        </template>
      </el-table-column>
      <el-table-column label="负责人" align="center" prop="userId_dictText" />
      <el-table-column label="团队成员" align="center" prop="teamMembers" />
      <el-table-column label="备注" align="center" prop="remarks" />
      <el-table-column label="操作" align="center" class-name="small-padding fixed-width">
        <template slot-scope="scope">
          <el-button
            size="mini"
            type="text"
            icon="el-icon-edit"
            @click="handleUpdate(scope.row)"
            v-hasPermi="['oa:constructionBatch:edit']"
          >修改</el-button>
          <el-button
            size="mini"
            type="text"
            class="del-btn"
            icon="el-icon-delete"
            @click="handleDelete(scope.row)"
            v-hasPermi="['oa:constructionBatch:remove']"
          >删除</el-button>
        </template>
      </el-table-column>
    </el-table>
    <pagination
      v-show="total>0"
      :total="total"
      :page.sync="queryParams.pageNum"
      :limit.sync="queryParams.pageSize"
      @pagination="getList"
    />
    <!-- 添加或修改施工批次对话框 -->
    <el-dialog :title="title" :visible.sync="open" width="500px" append-to-body :close-on-click-modal="false">
      <el-form ref="form" :model="form" :rules="rules" label-width="80px">
        <el-form-item label="施工批次" prop="batch">
          <el-input v-model="form.batch" maxlength="64" show-word-limit placeholder="请输入施工批次" />
        </el-form-item>
        <el-form-item label="施工周期" prop="date">
          <el-date-picker
              v-model="form.date"
              type="daterange"
              range-separator="至"
              start-placeholder="开始日期"
              end-placeholder="截至日期">
          </el-date-picker>
        </el-form-item>
        <el-form-item label="负责人" prop="userId">
          <el-select v-model="form.userId" filterable placeholder="请选择负责人">
            <el-option
                v-for="item in userList"
                :key="item.userId"
                :label="item.nickName"
                :value="item.userId"
            />
          </el-select>
        </el-form-item>
        <el-form-item label="团队成员" prop="teamMembers">
          <el-input v-model="form.teamMembers" type="textarea" rows="4" maxlength="64" show-word-limit placeholder="请输入团队成员" />
        </el-form-item>
        <el-form-item label="备注" prop="remarks">
          <el-input v-model="form.remarks" type="textarea" rows="6" maxlength="512" show-word-limit placeholder="请输入内容" />
        </el-form-item>
      </el-form>
      <div slot="footer" class="dialog-footer">
        <el-button :loading="buttonLoading" type="primary" @click="submitForm">确 定</el-button>
        <el-button @click="cancel">取 消</el-button>
      </div>
    </el-dialog>
  </div>
</template>
<script>
import { listConstructionBatch, getConstructionBatch, delConstructionBatch, addConstructionBatch, updateConstructionBatch } from "@/api/oa/constructionBatch";
import {listUser} from '@/api/common/common'
export default {
  name: "ConstructionBatch",
  data() {
    return {
      // 按钮loading
      buttonLoading: false,
      // 遮罩层
      loading: true,
      // 选中数组
      ids: [],
      // 非单个禁用
      single: true,
      // 非多个禁用
      multiple: true,
      // 显示搜索条件
      showSearch: true,
      // 总条数
      total: 0,
      // 施工批次表格数据
      constructionBatchList: [],
      // 弹出层标题
      title: "",
      // 是否显示弹出层
      open: false,
      // 查询参数
      queryParams: {
        pageNum: 1,
        pageSize: 10,
        batch: undefined,
        startDate: undefined,
        endDate: undefined,
        userId: undefined,
      },
      // 表单参数
      form: {},
      // 表单校验
      rules: {
        id: [
          { required: true, message: "不能为空", trigger: "blur" }
        ],
        batch: [
          { required: true, message: "施工批次不能为空", trigger: "blur" }
        ],
        userId: [
          { required: true, message: "负责人不能为空", trigger: "blur" }
        ],
        date: [
          { required: true, message: "施工周期不能为空", trigger: "blur" }
        ]
      },
      userList: []
    };
  },
  created() {
    this.getList();
  },
  methods: {
    /** 查询施工批次列表 */
    getList() {
      this.loading = true;
      listConstructionBatch(this.queryParams).then(response => {
        this.constructionBatchList = response.rows;
        this.total = response.total;
        this.loading = false;
      });
    },
    getUser() {
      listUser().then(r => {
        this.userList = r.data;
      })
    },
    // 取消按钮
    cancel() {
      this.open = false;
      this.reset();
    },
    // 表单重置
    reset() {
      this.form = {
        id: undefined,
        batch: undefined,
        startDate: undefined,
        endDate: undefined,
        userId: undefined,
        teamMembers: undefined,
        remarks: undefined,
        createTime: undefined,
        createBy: undefined,
        updateBy: undefined,
        updateTime: undefined,
        delFlag: undefined
      };
      this.resetForm("form");
    },
    /** 搜索按钮操作 */
    handleQuery() {
      this.queryParams.pageNum = 1;
      this.getList();
    },
    /** 重置按钮操作 */
    resetQuery() {
      this.resetForm("queryForm");
      this.handleQuery();
    },
    // 多选框选中数据
    handleSelectionChange(selection) {
      this.ids = selection.map(item => item.id)
      this.single = selection.length!==1
      this.multiple = !selection.length
    },
    /** 新增按钮操作 */
    handleAdd() {
      this.reset();
      this.getUser();
      this.open = true;
      this.title = "添加施工批次";
    },
    /** 修改按钮操作 */
    handleUpdate(row) {
      this.loading = true;
      this.reset();
      const id = row.id || this.ids
      getConstructionBatch(id).then(response => {
        this.loading = false;
        this.form = response.data;
        this.form.date = [this.form.startDate, this.form.endDate]
        this.open = true;
        this.title = "修改施工批次";
      });
    },
    /** 提交按钮 */
    submitForm() {
      this.$refs["form"].validate(valid => {
        console.log(this.form.date)
        this.form.startDate = this.form.date[0];
        this.form.endDate = this.form.date[1];
        if (valid) {
          this.buttonLoading = true;
          if (this.form.id != null) {
            updateConstructionBatch(this.form).then(response => {
              this.$modal.msgSuccess("修改成功");
              this.open = false;
              this.getList();
            }).finally(() => {
              this.buttonLoading = false;
            });
          } else {
            addConstructionBatch(this.form).then(response => {
              this.$modal.msgSuccess("新增成功");
              this.open = false;
              this.getList();
            }).finally(() => {
              this.buttonLoading = false;
            });
          }
        }
      });
    },
    /** 删除按钮操作 */
    handleDelete(row) {
      const ids = row.id || this.ids;
      this.$modal.confirm('是否确认删除?').then(() => {
        this.loading = true;
        return delConstructionBatch(ids);
      }).then(() => {
        this.loading = false;
        this.getList();
        this.$modal.msgSuccess("删除成功");
      }).finally(() => {
        this.loading = false;
      });
    },
    /** 导出按钮操作 */
    handleExport() {
      this.download('oa/constructionBatch/export', {
        ...this.queryParams
      }, `constructionBatch_${new Date().getTime()}.xlsx`)
    }
  }
};
</script>
src/views/construction/constructionList/index.vue
@@ -1,15 +1,86 @@
<template>
  <div>
  <div class="app-container">
    <div class="tree-view">
      <div class="tree-list">
        <school ref="schoolRef" @schoolChange="schoolChange"></school>
      </div>
      <div class="right-view">
        <el-tabs v-model="activeName" @tab-click="handleClick">
          <el-tab-pane label="施工概况" name="first">施工概况</el-tab-pane>
          <el-tab-pane label="IPC设备" name="second">IPC设备</el-tab-pane>
          <el-tab-pane label="NVR设备" name="third">NVR设备</el-tab-pane>
          <el-tab-pane label="IoT设备" name="fourth">IoT设备</el-tab-pane>
          <el-tab-pane label="AI设备" name="five">AI设备</el-tab-pane>
          <el-tab-pane label="交换设备" name="six">交换设备</el-tab-pane>
          <el-tab-pane label="服务器" name="seven">服务器</el-tab-pane>
          <el-tab-pane label="软件系统" name="eight">软件系统</el-tab-pane>
        </el-tabs>
        <div class="right-view-title-icon">
          <i class="el-icon-search" @click="batchOpen = true"></i>
          <i class="el-icon-search" @click="ipOpen = true"></i>
        </div>
      </div>
    </div>
    <el-drawer title="施工批次" :visible.sync="batchOpen" size="70%" :append-to-body="true" :destroy-on-close="true">
      <construction-batch></construction-batch>
    </el-drawer>
    <el-drawer title="预留IP" :visible.sync="ipOpen" size="70%" :append-to-body="true" :destroy-on-close="true">
      <reserve-ip></reserve-ip>
    </el-drawer>
  </div>
</template>
<script>
import school from '../../components/school'
import constructionBatch from '../constructionBatch'
import reserveIp from '../reserveIp'
export default {
  name: "constructionList"
  name: "constructionList",
  components: {
    school,
    constructionBatch,
    reserveIp
  },
  data() {
    return {
      activeName: 'second',
      batchOpen: false,
      ipOpen: false
    }
  },
  methods: {
    // 选择高校
    schoolChange(v) {
    },
    handleClick(tab, event) {
      console.log(tab, event);
    }
  }
}
</script>
<style scoped>
.tree-view {
  display: flex;
  flex-direction: row;
  flex: 1;
}
.tree-list {
  margin-right: 10px;
}
.right-view {
  display: flex;
  flex-direction: row;
  justify-content: space-between;
  flex: 1;
}
.right-view-title-icon {
  display: flex;
  flex-direction: row;
  height: 40px;
  align-items: center;
}
</style>
src/views/construction/reserveIp/index.vue
New file
@@ -0,0 +1,305 @@
<template>
  <div class="app-container">
    <el-form :model="queryParams" ref="queryForm" :inline="true" v-show="showSearch" label-width="68px">
      <el-form-item label="IP地址" prop="ip">
        <el-input
          v-model="queryParams.ip"
          placeholder="请输入ip地址"
          clearable
          size="small"
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item>
        <el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
        <el-button icon="el-icon-refresh" size="mini" @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
          icon="el-icon-plus"
          size="mini"
          @click="handleAdd"
          v-hasPermi="['oa:reserveIp:add']"
        >新增</el-button>
      </el-col>
      <el-col :span="1.5">
        <el-button
          type="success"
          plain
          icon="el-icon-edit"
          size="mini"
          :disabled="single"
          @click="handleUpdate"
          v-hasPermi="['oa:reserveIp:edit']"
        >修改</el-button>
      </el-col>
      <el-col :span="1.5">
        <el-button
          type="danger"
          plain
          icon="el-icon-delete"
          size="mini"
          :disabled="multiple"
          @click="handleDelete"
          v-hasPermi="['oa:reserveIp:remove']"
        >删除</el-button>
      </el-col>
    </el-row>
    <el-table v-loading="loading" :data="reserveIpList" @selection-change="handleSelectionChange">
      <el-table-column type="selection" width="55" align="center" />
      <el-table-column label="序号" type="index" align="center">
        <template slot-scope="scope">
          <span>{{(queryParams.pageNum - 1) * queryParams.pageSize + scope.$index + 1}}</span>
        </template>
      </el-table-column>
      <el-table-column label="IP地址" align="center" prop="ip" />
      <el-table-column label="MAC地址" align="center" prop="mac" />
      <el-table-column label="适用地点" align="center" prop="buildingId_dictText" />
      <el-table-column label="申请日期" align="center" prop="applicationDate" width="180">
        <template slot-scope="scope">
          <span>{{ parseTime(scope.row.applicationDate, '{y}-{m}-{d}') }}</span>
        </template>
      </el-table-column>
      <el-table-column label="备注" align="center" prop="remarks" />
      <el-table-column label="操作" align="center" class-name="small-padding fixed-width">
        <template slot-scope="scope">
          <el-button
            size="mini"
            type="text"
            icon="el-icon-edit"
            @click="handleUpdate(scope.row)"
            v-hasPermi="['oa:reserveIp:edit']"
          >修改</el-button>
          <el-button
            size="mini"
            type="text"
            class="del-btn"
            icon="el-icon-delete"
            @click="handleDelete(scope.row)"
            v-hasPermi="['oa:reserveIp:remove']"
          >删除</el-button>
        </template>
      </el-table-column>
    </el-table>
    <pagination
      v-show="total>0"
      :total="total"
      :page.sync="queryParams.pageNum"
      :limit.sync="queryParams.pageSize"
      @pagination="getList"
    />
    <!-- 添加或修改预留IP对话框 -->
    <el-dialog :title="title" :visible.sync="open" width="500px" :append-to-body="true" :destroy-on-close="true" :close-on-click-modal="false">
      <el-form ref="form" :model="form" :rules="rules" label-width="100px">
        <el-form-item label="IP地址" prop="ip">
          <el-input v-model="form.ip" placeholder="请输入ip地址" />
        </el-form-item>
        <el-form-item label="MAC地址" prop="mac">
          <el-input v-model="form.mac" placeholder="请输入MAC地址" />
        </el-form-item>
        <el-form-item label="适用地点" prop="buildingId">
          <building v-model="form.buildingId"></building>
        </el-form-item>
        <el-form-item label="申请日期" prop="applicationDate">
          <el-date-picker clearable size="small"
            v-model="form.applicationDate"
            type="date"
            placeholder="选择申请日期">
          </el-date-picker>
        </el-form-item>
        <el-form-item label="备注" prop="remarks">
          <el-input v-model="form.remarks" type="textarea" :rows="8" placeholder="请输入内容" />
        </el-form-item>
      </el-form>
      <div slot="footer" class="dialog-footer">
        <el-button :loading="buttonLoading" type="primary" @click="submitForm">确 定</el-button>
        <el-button @click="cancel">取 消</el-button>
      </div>
    </el-dialog>
  </div>
</template>
<script>
import { listReserveIp, getReserveIp, delReserveIp, addReserveIp, updateReserveIp } from "@/api/oa/reserveIp";
import building from '../../components/building'
export default {
  name: "ReserveIp",
  components: {
    building
  },
  data() {
    return {
      // 按钮loading
      buttonLoading: false,
      // 遮罩层
      loading: true,
      // 选中数组
      ids: [],
      // 非单个禁用
      single: true,
      // 非多个禁用
      multiple: true,
      // 显示搜索条件
      showSearch: true,
      // 总条数
      total: 0,
      // 预留IP表格数据
      reserveIpList: [],
      // 弹出层标题
      title: "",
      // 是否显示弹出层
      open: false,
      // 查询参数
      queryParams: {
        pageNum: 1,
        pageSize: 10,
        ip: undefined,
        buildingId: undefined,
      },
      // 表单参数
      form: {},
      // 表单校验
      rules: {
        ip: [
          { required: true, message: "ip地址不能为空", trigger: "blur" },
          { pattern: /^(\d|[1-9]\d|1\d{2}|2[0-5][0-5])\.(\d|[1-9]\d|1\d{2}|2[0-5][0-5])\.(\d|[1-9]\d|1\d{2}|2[0-5][0-5])\.(\d|[1-9]\d|1\d{2}|2[0-5][0-5])$/, message: "请输入正确的ip地址", trigger: "blur" }
        ],
        mac: [
          { required: true, message: "MAC地址不能为空", trigger: "blur" },
          { pattern: /^[A-F0-9]{2}(-[A-F0-9]{2}){5}$|^[A-F0-9]{2}(:[A-F0-9]{2}){5}$|^[A-F0-9]{12}$|^[A-F0-9]{4}(\.[A-F0-9]{4}){2}$/, message: "请输入正确的MAC地址", trigger: "blur" }
        ],
        buildingId: [
          { required: true, message: "建筑单元不能为空", trigger: "change" }
        ],
      },
      buildOpen: false
    };
  },
  created() {
    this.getList();
  },
  methods: {
    /** 查询预留IP列表 */
    getList() {
      this.loading = true;
      listReserveIp(this.queryParams).then(response => {
        this.reserveIpList = response.rows;
        this.total = response.total;
        this.loading = false;
      });
    },
    // 取消按钮
    cancel() {
      this.open = false;
      this.reset();
    },
    // 表单重置
    reset() {
      this.form = {
        id: undefined,
        ip: undefined,
        mac: undefined,
        buildingId: undefined,
        applicationDate: undefined,
        remarks: undefined,
        createTime: undefined,
        createBy: undefined,
        updateBy: undefined,
        updateTime: undefined,
        delFlag: undefined
      };
      this.resetForm("form");
    },
    /** 搜索按钮操作 */
    handleQuery() {
      this.queryParams.pageNum = 1;
      this.getList();
    },
    /** 重置按钮操作 */
    resetQuery() {
      this.resetForm("queryForm");
      this.handleQuery();
    },
    // 多选框选中数据
    handleSelectionChange(selection) {
      this.ids = selection.map(item => item.id)
      this.single = selection.length!==1
      this.multiple = !selection.length
    },
    /** 新增按钮操作 */
    handleAdd() {
      this.reset();
      this.open = true;
      this.title = "添加预留IP";
    },
    /** 修改按钮操作 */
    handleUpdate(row) {
      this.loading = true;
      this.reset();
      const id = row.id || this.ids
      getReserveIp(id).then(response => {
        this.loading = false;
        this.form = response.data;
        this.open = true;
        this.title = "修改预留IP";
      });
    },
    /** 提交按钮 */
    submitForm() {
      this.$refs["form"].validate(valid => {
        if (valid) {
          this.buttonLoading = true;
          if (this.form.id != null) {
            updateReserveIp(this.form).then(response => {
              this.$modal.msgSuccess("修改成功");
              this.open = false;
              this.getList();
            }).finally(() => {
              this.buttonLoading = false;
            });
          } else {
            addReserveIp(this.form).then(response => {
              this.$modal.msgSuccess("新增成功");
              this.open = false;
              this.getList();
            }).finally(() => {
              this.buttonLoading = false;
            });
          }
        }
      });
    },
    /** 删除按钮操作 */
    handleDelete(row) {
      const ids = row.id || this.ids;
      this.$modal.confirm('是否确认删除?').then(() => {
        this.loading = true;
        return delReserveIp(ids);
      }).then(() => {
        this.loading = false;
        this.getList();
        this.$modal.msgSuccess("删除成功");
      }).finally(() => {
        this.loading = false;
      });
    },
    /** 导出按钮操作 */
    handleExport() {
      this.download('oa/reserveIp/export', {
        ...this.queryParams
      }, `reserveIp_${new Date().getTime()}.xlsx`)
    },
  }
};
</script>