jiangping
2025-04-08 f5ec875275b0a783186a147e780bc03d96a91f57
代码初始化
已添加8个文件
已修改11个文件
1649 ■■■■■ 文件已修改
admin/src/api/business/category.js 6 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
admin/src/components/base/BaseTable.vue 15 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
admin/src/components/business/OperaCategoryDcaProblemWindow.vue 149 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
admin/src/components/business/OperaCategoryWindow.vue 144 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
admin/src/components/common/Tree.vue 55 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
admin/src/views/business/categoryDbhLocaltion.vue 158 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
admin/src/views/business/categoryDbhType.vue 158 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
admin/src/views/business/categoryDcaLocaltion.vue 158 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
admin/src/views/business/categoryDcaProblem.vue 194 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
admin/src/views/business/categorySheLocaltion.vue 158 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
admin/src/views/business/categorySheType.vue 158 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
admin/src/views/business/companyMember.vue 1 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
server/src/main/java/com/doumee/api/business/CategoryController.java 10 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
server/src/main/java/com/doumee/dao/business/CategoryMapper.java 3 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
server/src/main/java/com/doumee/dao/business/model/Category.java 22 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
server/src/main/java/com/doumee/dao/business/vo/CategoryTree.java 89 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
server/src/main/java/com/doumee/service/business/CategoryService.java 2 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
server/src/main/java/com/doumee/service/business/impl/CategoryServiceImpl.java 167 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
server/src/main/java/com/doumee/service/business/impl/CompanyServiceImpl.java 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
admin/src/api/business/category.js
@@ -6,7 +6,11 @@
    trim: true
  })
}
export function treeList (data) {
  return request.post('/business/category/tree', data, {
    trim: true
  })
}
// å¯¼å‡ºExcel
export function exportExcel (data) {
  return request.post('/business/category/exportExcel', data, {
admin/src/components/base/BaseTable.vue
@@ -1,6 +1,6 @@
<script>
import BasePage from './BasePage'
import {mapState} from "vuex";
import { isFunction } from 'element-ui'
export default {
  name: 'BaseTable',
@@ -102,6 +102,9 @@
      this.$refs.searchForm.resetFields()
      this.search()
    },
    refresh () {
     window.location.reload()
    },
    /**
     * é¡µå®¹é‡å˜æ›´å¤„理(切换页容量时触发)
     *
@@ -166,7 +169,7 @@
     * @param row è¡Œå¯¹è±¡
     * @param childConfirm åˆ é™¤å­èŠ‚ç‚¹æ—¶æ˜¯å¦è¿›è¡ŒäºŒæ¬¡ç¡®è®¤
     */
    deleteById (row, childConfirm = true) {
    deleteById (row, childConfirm = true, call) {
      this.__checkApi()
      let message = `确认删除${this.module}吗?`
      if (childConfirm && row.children != null && row.children.length > 0) {
@@ -178,6 +181,9 @@
          this.api.deleteById(row[this.configData['field.id']])
            .then(() => {
              this.__afterDelete()
              if (call) {
                call()
              }
            })
            .catch(e => {
              this.$tip.apiFailed(e)
@@ -193,7 +199,7 @@
     *
     * @param childConfirm åˆ é™¤å­èŠ‚ç‚¹æ—¶æ˜¯å¦è¿›è¡ŒäºŒæ¬¡ç¡®è®¤
     */
    deleteByIdInBatch (childConfirm = true) {
    deleteByIdInBatch (childConfirm = true, call) {
      this.__checkApi()
      if (this.tableData.selectedRows.length === 0) {
        this.$tip.warning('请至少选择一条数据')
@@ -217,6 +223,9 @@
          this.api.deleteByIdInBatch(this.tableData.selectedRows.map(row => row[this.configData['field.id']]).join(','))
            .then(() => {
              this.__afterDelete(this.tableData.selectedRows.length)
              if (call) {
                call()
              }
            })
            .catch(e => {
              this.$tip.apiFailed(e)
admin/src/components/business/OperaCategoryDcaProblemWindow.vue
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,149 @@
<template>
  <GlobalWindow
    :title="title"
    :visible.sync="visible"
    :confirm-working="isWorking"
    @confirm="confirm"
  >
    <el-form :model="form" ref="form" :rules="rules">
      <el-form-item label="名称" prop="name">
        <el-input v-model="form.name" placeholder="请输入名称" v-trim/>
      </el-form-item>
      <el-form-item label="选择父级" prop="parentId">
        <el-cascader  v-model="form.categoryList" :options="categorys" @change="handleChangeCategory" :show-all-levels="false"
                      clearable filterable :props="categoryprops"  >
          <template slot-scope="{ node, data }">
            <span>{{ data.name }}</span> <!-- è‡ªå®šä¹‰æ˜¾ç¤ºå†…容 -->
          </template>
        </el-cascader>
      </el-form-item>
      <el-form-item label="排序码" prop="sortnum">
        <el-input v-model="form.sortnum" placeholder="请输入排序码(升序)" v-trim/>
      </el-form-item>
      <el-form-item label="备注" prop="remark">
        <el-input v-model="form.remark" type="textarea" placeholder="请输入备注" v-trim/>
      </el-form-item>
    </el-form>
  </GlobalWindow>
</template>
<script>
import BaseOpera from '@/components/base/BaseOpera'
import GlobalWindow from '@/components/common/GlobalWindow'
export default {
  name: 'OperaCategoryWindow',
  extends: BaseOpera,
  components: { GlobalWindow },
  data () {
    return {
      // è¡¨å•数据
      form: {
        id: null,
        name: '',
        type: '',
        remark: '',
        categoryList: [],
        sortnum: null,
        parentId: null
      },
      categoryprops: {
        label: 'name',
        value: 'id',
        checkStrictly: true,
        lazyLoad: this.lazyLoad
      },
      categorys: [],
      // éªŒè¯è§„则
      rules: {
        name: [{ required: true, message: '请输入名称', trigger: 'blur' }]
      }
    }
  },
  created () {
    this.config({
      api: '/business/category',
      'field.id': 'id'
    })
  },
  methods: {
    handleChangeCategory (value) {
      if (this.form.categoryList && this.form.categoryList.length >= 1) {
        this.form.parentId = this.form.categoryList[this.form.categoryList.length - 1]
      }
      if (!this.form.categoryList || this.form.categoryList.length == 0 || this.form.categoryList.length == 1) {
        this.form.type = 4
      } else {
        this.form.type = 6
      }
    },
    getTreeData (data) {
      if (!data) {
        return data
      }
      for (let i = 0; i < data.length; i++) {
        console.log(data)
        if (data[i].childList) {
          if (data[i].childList.length < 1) {
            data[i].childList = [] // children若为空数组,则将children设为undefined
            data[i].childern = [] // children若为空数组,则将children设为undefined
          } else {
            this.getTreeData(data[i].childList) // children若不为空数组,则继续 é€’归调用 æœ¬æ–¹æ³•
          }
        }
      }
      return data
    },
    open (title, target, categorys, categoryType, parentIdPath) {
      this.title = title
      this.categorys = categorys || []
      this.categorys = this.getTreeData(this.categorys)
      console.log(this.categorys)
      this.visible = true
      this.form = {
        id: null,
        name: '',
        type: '',
        categoryList: [],
        sortnum: null,
        remark: '',
        parentId: null
      }
      this.form.type = categoryType
      // æ–°å»º
      var that = this
      if (target == null) {
        this.$nextTick(() => {
          this.$refs.form.resetFields()
          this.form[this.configData['field.id']] = null
          this.form.categoryList = []
          if (parentIdPath && parentIdPath != null) {
            var array = parentIdPath.split('/')
            array.forEach(item => {
              if (item && item != null && item !== '') {
                that.form.categoryList.push(parseInt(item))
              }
            })
            that.handleChangeCategory()
          }
        })
        return
      }
      // ç¼–辑
      this.$nextTick(() => {
        for (const key in this.form) {
          this.form[key] = target[key]
        }
        this.form.categoryList = []
        if (target.parentId && target.idParentPath) {
          var array = target.idParentPath.split('/')
          array.forEach(item => {
            if (item && item != null && item !== '') {
              that.form.categoryList.push(parseInt(item))
            }
          })
        }
      })
    }
  }
}
</script>
admin/src/components/business/OperaCategoryWindow.vue
@@ -6,47 +6,22 @@
    @confirm="confirm"
  >
    <el-form :model="form" ref="form" :rules="rules">
      <el-form-item label="创建人编码" prop="creator">
        <el-input v-model="form.creator" placeholder="请输入创建人编码" v-trim/>
      </el-form-item>
      <el-form-item label="创建时间" prop="createDate">
        <el-date-picker v-model="form.createDate" value-format="yyyy-MM-dd" placeholder="请输入创建时间"></el-date-picker>
      </el-form-item>
      <el-form-item label="更新人编码" prop="editor">
        <el-input v-model="form.editor" placeholder="请输入更新人编码" v-trim/>
      </el-form-item>
      <el-form-item label="更新时间" prop="editDate">
        <el-date-picker v-model="form.editDate" value-format="yyyy-MM-dd" placeholder="请输入更新时间"></el-date-picker>
      </el-form-item>
      <el-form-item label="是否删除0否 1是" prop="isdeleted">
        <el-input v-model="form.isdeleted" placeholder="请输入是否删除0否 1是" v-trim/>
      </el-form-item>
      <el-form-item label="名称" prop="name">
        <el-input v-model="form.name" placeholder="请输入名称" v-trim/>
      </el-form-item>
      <el-form-item label="备注" prop="remark">
        <el-input v-model="form.remark" placeholder="请输入备注" v-trim/>
      </el-form-item>
      <el-form-item label="状态 0启用 1禁用" prop="status">
        <el-input v-model="form.status" placeholder="请输入状态 0启用 1禁用" v-trim/>
      <el-form-item label="选择父级" prop="parentId">
        <el-cascader  v-model="form.categoryList" :options="categorys" @change="handleChangeCategory" :show-all-levels="false"
                      clearable filterable :props="categoryprops"  >
          <template slot-scope="{ node, data }">
            <span>{{ data.name }}</span> <!-- è‡ªå®šä¹‰æ˜¾ç¤ºå†…容 -->
          </template>
        </el-cascader>
      </el-form-item>
      <el-form-item label="排序码" prop="sortnum">
        <el-input v-model="form.sortnum" placeholder="请输入排序码" v-trim/>
        <el-input v-model="form.sortnum" placeholder="请输入排序码(升序)" v-trim/>
      </el-form-item>
      <el-form-item label="图标" prop="imgurl">
        <el-input v-model="form.imgurl" placeholder="请输入图标" v-trim/>
      </el-form-item>
      <el-form-item label="类型 0SHE伤害类型 1安全风险伤害类型 2安全风险发生地点 3DCA位置 4DCA问题 5SHE风险地点" prop="type">
        <el-input v-model="form.type" placeholder="请输入类型 0SHE伤害类型 1安全风险伤害类型 2安全风险发生地点 3DCA位置 4DCA问题 5SHE风险地点" v-trim/>
      </el-form-item>
      <el-form-item label="父级编码(自关联)" prop="parentId">
        <el-input v-model="form.parentId" placeholder="请输入父级编码(自关联)" v-trim/>
      </el-form-item>
      <el-form-item label="名称路径" prop="namePath">
        <el-input v-model="form.namePath" placeholder="请输入名称路径" v-trim/>
      </el-form-item>
      <el-form-item label="编码路径" prop="idPath">
        <el-input v-model="form.idPath" placeholder="请输入编码路径" v-trim/>
      <el-form-item label="备注" prop="remark">
        <el-input v-model="form.remark" type="textarea" placeholder="请输入备注" v-trim/>
      </el-form-item>
    </el-form>
  </GlobalWindow>
@@ -64,23 +39,23 @@
      // è¡¨å•数据
      form: {
        id: null,
        creator: '',
        createDate: '',
        editor: '',
        editDate: '',
        isdeleted: '',
        name: '',
        remark: '',
        status: '',
        sortnum: '',
        imgurl: '',
        type: '',
        parentId: '',
        namePath: '',
        idPath: ''
        remark: '',
        categoryList: [],
        sortnum: null,
        parentId: null
      },
      categoryprops: {
        label: 'name',
        value: 'id',
        checkStrictly: true,
        lazyLoad: this.lazyLoad
      },
      categorys: [],
      // éªŒè¯è§„则
      rules: {
        name: [{ required: true, message: '请输入名称', trigger: 'blur' }]
      }
    }
  },
@@ -89,6 +64,81 @@
      api: '/business/category',
      'field.id': 'id'
    })
  },
  methods: {
    handleChangeCategory (value) {
      if (this.form.categoryList && this.form.categoryList.length >= 1) {
        this.form.parentId = this.form.categoryList[this.form.categoryList.length - 1]
      }
    },
    getTreeData (data) {
      if (!data) {
        return data
      }
      for (let i = 0; i < data.length; i++) {
        console.log(data)
        if (data[i].childList) {
          if (data[i].childList.length < 1) {
            data[i].childList = [] // children若为空数组,则将children设为undefined
            data[i].childern = [] // children若为空数组,则将children设为undefined
          } else {
            this.getTreeData(data[i].childList) // children若不为空数组,则继续 é€’归调用 æœ¬æ–¹æ³•
          }
        }
      }
      return data
    },
    open (title, target, categorys, categoryType, parentIdPath) {
      this.title = title
      this.categorys = categorys || []
      this.categorys = this.getTreeData(this.categorys)
      console.log(this.categorys)
      this.visible = true
      this.form = {
        id: null,
        name: '',
        type: '',
        remark: '',
        categoryList: [],
        sortnum: null,
        parentId: null
      }
      this.form.type = categoryType
      // æ–°å»º
      var that = this
      if (target == null) {
        this.$nextTick(() => {
          this.$refs.form.resetFields()
          this.form[this.configData['field.id']] = null
          this.form.categoryList = []
          if (parentIdPath && parentIdPath != null) {
            var array = parentIdPath.split('/')
            array.forEach(item => {
              if (item && item != null && item !== '') {
                that.form.categoryList.push(parseInt(item))
              }
            })
            that.handleChangeCategory()
          }
        })
        return
      }
      // ç¼–辑
      this.$nextTick(() => {
        for (const key in this.form) {
          this.form[key] = target[key]
        }
        this.form.categoryList = []
        if (target.parentId && target.idParentPath) {
          var array = target.idParentPath.split('/')
          array.forEach(item => {
            if (item && item != null && item !== '') {
              that.form.categoryList.push(parseInt(item))
            }
          })
        }
      })
    }
  }
}
</script>
admin/src/components/common/Tree.vue
@@ -2,16 +2,14 @@
    <div class="tree">
        <div v-for="(item, index) of list" :key="index" @click.stop="clickIten(item)">
            <div class="tree_item">
                <i class="el-icon-caret-bottom" :class="{ 'activeColor': item.fsStatus === 1 }" v-show="item.fsStatus === 1 && item.childList.length > 0"></i>
                <i class="el-icon-caret-bottom" :class="{ 'activeColor': item.actived === 1 }" v-show="item.fsStatus === 1 && item.childList.length > 0"></i>
                <i class="el-icon-caret-right color" v-show="item.childList.length > 0 && (item.fsStatus === 0 || !item.fsStatus)"></i>
                <div class="tree_item_label long-title-style" :title="item.name" :class="{ 'activeColor': item.fsDate === 1 && item.childList.length === 0 }">{{ item.name }}</div>
                <!--                <i class="el-icon-caret-bottom" :class="{ 'activeColor': item[defaultProps.status] }" v-show="item[defaultProps.status] && item[defaultProps.children]"></i>-->
<!--                <i class="el-icon-caret-right color" v-show="item[defaultProps.children] && !item[defaultProps.status]"></i>-->
<!--                <div class="tree_item_label long-title-style" :title="item[defaultProps.name]" :class="{ 'activeColor': item[defaultProps.status] && !item[defaultProps.children] }">{{ item[defaultProps.name] }}</div>-->
                <div class="tree_item_label long-title-style" :title="item.name" :class="{ 'activeColor':  item.actived === 1 }">{{ item.name }}</div>
            </div>
            <div class="tree_childern" v-show="item.fsStatus === 1">
                <tree
                  :list="item.childList"
                  :alllist="alllist"
                  :defaultProps="defaultProps"
                  @callback="callback"
                />
@@ -27,6 +25,11 @@
  name: 'tree',
  props: {
    list: {
      type: Array,
      required: false,
      default: () => []
    },
    alllist: {
      type: Array,
      required: false,
      default: () => []
@@ -55,45 +58,33 @@
    }
  },
  methods: {
    listForList(){
      // console.log('===============================',this.alllist)
    },
    // ç‚¹å‡»å½“前项
    clickIten (item) {
      // item[this.defaultProps.status] = !item[this.defaultProps.status]
      // this.list.forEach(subItem => {
      //   if ((subItem[this.defaultProps.id] !== item[this.defaultProps.id] && subItem[this.defaultProps.status]) || (this.list.length === 1 && subItem[this.defaultProps.status] === false)) {
      //     subItem[this.defaultProps.status] = false
      //     if (subItem[this.defaultProps.children]) {
      //       this.recursion(subItem[this.defaultProps.children])
      //     }
      //   }
      // })
      // if (this.tempItem['id'] === item[this.defaultProps.id]) {
      //   this.tempItem = {
      //     id: null,
      //     name: null,
      //     erpId: null
      //   }
      // } else {
      //   this.tempItem.id = item[this.defaultProps.id]
      //   this.tempItem.name = item[this.defaultProps.name]
      //   this.tempItem.erpId = item['erpId']
      // }
      // item.fsDate === 0 || !item.fsDate ? item.fsDate = 1 : item.fsDate = 0
      // this.listForList()
      const fsDate = item.fsDate === 0 || !item.fsDate ? 1 : 0
      this.list.forEach(i => {
      this.alllist.forEach(i => {
        i.fsDate = 0
        i.actived = 0
        this.recursion1(i.childList)
      })
      item.fsDate = fsDate
      item.actived = 1
      if (item.childList.length > 0) {
        item.fsStatus === 0 || !item.fsStatus ? item.fsStatus = 1 : item.fsStatus = 0
      }
      this.$emit('callback', item, item)
    },
    // é€’归方法
    recursion (children) {
    recursion1 (children) {
      if (!children || children.length === 0){
        return
      }
      children.forEach(item => {
        item.fsDate = 0
        if (item.childList.length > 0) {
          this.recursion(item.childList)
        item.actived = 0
        if (item.childList && item.childList.length > 0) {
          this.recursion1(item.childList)
        }
        // item[this.defaultProps.status] = false
        // if (item[this.defaultProps.children]) {
admin/src/views/business/categoryDbhLocaltion.vue
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,158 @@
<template>
  <TableLayout1 :permissions="['business:category:query']">
    <!-- æœç´¢è¡¨å• -->
    <div ref="QueryFormRef" slot="search-form">
      <el-form ref="searchForm" :model="searchForm"  inline>
        <el-form-item label="名称" prop="name">
          <el-input v-model="searchForm.name" placeholder="请输入名称" @keypress.enter.native="search"></el-input>
        </el-form-item>
        <section>
          <el-button type="primary" @click="search">搜索</el-button>
          <el-button type="primary" @click="refresh">显示顶层</el-button>
          <el-button @click="reset">重置</el-button>
        </section>
      </el-form>
    </div>
    <template v-slot:menu>
      <div
        style="width: 100%; height: 50px; background: rgba(242, 242, 242, 1); line-height: 50px; text-align: center; font-size: 14px;">
        è·Œç»Šæ»‘风险发生地点</div>
      <div style="width: 100%; height: calc(100vh - 170px); overflow-y: scroll;">
        <Tree :list="treeList" :alllist="treeList"  :defaultProps="{ name: 'name', status: 'fsStatus', children: 'childList', id: 'id' }"
          @callback="callback" />
      </div>
    </template>
    <!-- è¡¨æ ¼å’Œåˆ†é¡µ -->
    <template v-slot:table-wrap>
      <ul class="toolbar"  v-if="containPermissions(['business:category:create', 'business:category:delete' ])" >
        <li><el-button type="primary"
                       @click="$refs.operaCategoryWindow.open('新建DCA事件位置信息', null,categoryList ,searchForm.type,searchForm.parentIdPath)" icon="el-icon-plus"
                       v-permissions="['business:category:create']">新建</el-button></li>
        <li><el-button type="danger" @click="deleteByIdInBatch(true,getfindTreePage)" icon="el-icon-delete" v-permissions="['business:category:delete']">批量删除</el-button></li>
      </ul>
      <el-table   v-loading="isWorking.search" :data="tableData.list" stripe @selection-change="handleSelectionChange">
        <el-table-column type="selection" width="55"></el-table-column>
        <el-table-column prop="name" label="名称" min-width="100px"></el-table-column>
        <el-table-column prop="parentName" label="父级" min-width="150px"></el-table-column>
        <el-table-column prop="editorName" label="操作人" min-width="100px"></el-table-column>
        <el-table-column prop="editDate" label="最后操作时间" min-width="150px"></el-table-column>
        <el-table-column v-if="containPermissions(['business:category:update', 'business:category:delete' ])" label="操作" min-width="280">
          <template slot-scope="{row}">
            <el-button type="text" icon="el-icon-edit" @click="$refs.operaCategoryWindow.open('编辑DCA事件位置信息', row, categoryList,searchForm.type)"  v-permissions="['business:category:update']">编辑</el-button>
            <el-button type="text" icon="el-icon-delete" @click="deleteById(row,true, getfindTreePage)" style="color: red"  v-permissions="['business:category:delete']">删除</el-button>
          </template>
        </el-table-column>
      </el-table>
      <pagination @size-change="handleSizeChange" @current-change="handlePageChange" :pagination="tableData.pagination">
      </pagination>
      <OperaCategoryWindow ref="operaCategoryWindow" @success="handlePageChangeDo"/>
    </template>
  </TableLayout1>
</template>
<script>
import BaseTable from '@/components/base/BaseTable'
import TableLayout1 from '@/layouts/TableLayout1'
import OperaCategoryWindow from '@/components/business/OperaCategoryWindow'
import Pagination from '@/components/common/Pagination'
import Tree from '@/components/common/Tree'
import { treeList } from '@/api/business/category'
export default {
  name: 'categorySheType',
  extends: BaseTable,
  components: { TableLayout1, Pagination, Tree, OperaCategoryWindow },
  data () {
    return {
      TreeList: [],
      // æœç´¢
      searchForm: {
        name: '',
        keyword: '',
        type: 2,
        isRoot: 1,
        parentId: '',
        parentIdPath: null
      },
      loading: false,
      heading: false,
      working: false,
      treeList: [],
      categoryList: []
    }
  },
  created () {
    this.config({
      module: '跌绊滑风险发生地点',
      api: '/business/category',
      'field.id': 'id',
      'field.main': 'id'
    })
    // this.search()
    this.getfindTreePage()
  },
  methods: {
    handlePageChangeDo () {
      this.searchForm.isRoot = 1
      this.searchForm.parentId = null
      this.getfindTreePage()
      this.handlePageChange()
    },
    // èŽ·å–ç»„ç»‡æ ‘
    getfindTreePage () {
      treeList({ type: this.searchForm.type })
        .then(res => {
          if (res && res.length > 0) {
            res[0].fsStatus = 1
            // var tree= [{id:null, name:'顶级', childList:res,fsStatus:1}]
            this.treeList = res
            this.search()
            this.categoryList = this.getCategoryTree(res)
          }
        })
    },
    getCategoryTree (tree) {
      if (tree == null) {
        return []
      }
      return tree.map(item => {
        const newItem = { ...item }
        if (newItem) {
          newItem.children = newItem.childList
        }
        if (item.children && item.children.length === 0) {
          this.$delete(newItem, 'children')
        } else {
          newItem.children = this.getCategoryTree(newItem.children)
        }
        // newItem.disabled = false
        return newItem
      })
    },
    callback (row) {
      console.log(row)
      this.searchForm.isRoot = null
      this.searchForm.parentId = row.id
      this.searchForm.parentIdPath = row.idPath
      this.search()
    }
  }
}
</script>
<style lang="scss" scoped>
.box {
  width: 100%;
  display: flex;
  align-items: center;
  .box_menu {
    width: 100px;
    height: 100%;
    flex-shrink: 0;
  }
  .box_tab {
    flex: 1;
    height: 100%;
  }
}
</style>
admin/src/views/business/categoryDbhType.vue
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,158 @@
<template>
  <TableLayout1 :permissions="['business:category:query']">
    <!-- æœç´¢è¡¨å• -->
    <div ref="QueryFormRef" slot="search-form">
      <el-form ref="searchForm" :model="searchForm"  inline>
        <el-form-item label="名称" prop="name">
          <el-input v-model="searchForm.name" placeholder="请输入名称" @keypress.enter.native="search"></el-input>
        </el-form-item>
        <section>
          <el-button type="primary" @click="search">搜索</el-button>
          <el-button type="primary" @click="refresh">显示顶层</el-button>
          <el-button @click="reset">重置</el-button>
        </section>
      </el-form>
    </div>
    <template v-slot:menu>
      <div
        style="width: 100%; height: 50px; background: rgba(242, 242, 242, 1); line-height: 50px; text-align: center; font-size: 14px;">
        è·Œç»Šæ»‘风险类型</div>
      <div style="width: 100%; height: calc(100vh - 170px); overflow-y: scroll;">
        <Tree :list="treeList" :alllist="treeList"  :defaultProps="{ name: 'name', status: 'fsStatus', children: 'childList', id: 'id' }"
          @callback="callback" />
      </div>
    </template>
    <!-- è¡¨æ ¼å’Œåˆ†é¡µ -->
    <template v-slot:table-wrap>
      <ul class="toolbar"  v-if="containPermissions(['business:category:create', 'business:category:delete' ])" >
        <li><el-button type="primary"
                       @click="$refs.operaCategoryWindow.open('新建跌绊滑风险类型', null,categoryList ,searchForm.type,searchForm.parentIdPath)" icon="el-icon-plus"
                       v-permissions="['business:category:create']">新建</el-button></li>
        <li><el-button type="danger" @click="deleteByIdInBatch(true,getfindTreePage)" icon="el-icon-delete" v-permissions="['business:category:delete']">批量删除</el-button></li>
      </ul>
      <el-table   v-loading="isWorking.search" :data="tableData.list" stripe @selection-change="handleSelectionChange">
        <el-table-column type="selection" width="55"></el-table-column>
        <el-table-column prop="name" label="名称" min-width="100px"></el-table-column>
        <el-table-column prop="parentName" label="父级" min-width="150px"></el-table-column>
        <el-table-column prop="editorName" label="操作人" min-width="100px"></el-table-column>
        <el-table-column prop="editDate" label="最后操作时间" min-width="150px"></el-table-column>
        <el-table-column v-if="containPermissions(['business:category:update', 'business:category:delete' ])" label="操作" min-width="280">
          <template slot-scope="{row}">
            <el-button type="text" icon="el-icon-edit" @click="$refs.operaCategoryWindow.open('编辑跌绊滑风险类型', row, categoryList,searchForm.type)"  v-permissions="['business:category:update']">编辑</el-button>
            <el-button type="text" icon="el-icon-delete" @click="deleteById(row,true, getfindTreePage)" style="color: red"  v-permissions="['business:category:delete']">删除</el-button>
          </template>
        </el-table-column>
      </el-table>
      <pagination @size-change="handleSizeChange" @current-change="handlePageChange" :pagination="tableData.pagination">
      </pagination>
      <OperaCategoryWindow ref="operaCategoryWindow" @success="handlePageChangeDo"/>
    </template>
  </TableLayout1>
</template>
<script>
import BaseTable from '@/components/base/BaseTable'
import TableLayout1 from '@/layouts/TableLayout1'
import OperaCategoryWindow from '@/components/business/OperaCategoryWindow'
import Pagination from '@/components/common/Pagination'
import Tree from '@/components/common/Tree'
import { treeList } from '@/api/business/category'
export default {
  name: 'categorySheType',
  extends: BaseTable,
  components: { TableLayout1, Pagination, Tree, OperaCategoryWindow },
  data () {
    return {
      TreeList: [],
      // æœç´¢
      searchForm: {
        name: '',
        keyword: '',
        type: 1,
        parentId: '',
        isRoot: 1,
        parentIdPath: null
      },
      loading: false,
      heading: false,
      working: false,
      treeList: [],
      categoryList: []
    }
  },
  created () {
    this.config({
      module: '跌绊滑风险类型配置',
      api: '/business/category',
      'field.id': 'id',
      'field.main': 'id'
    })
    // this.search()
    this.getfindTreePage()
  },
  methods: {
    handlePageChangeDo () {
      this.searchForm.parentId = null
      this.searchForm.isRoot = 1
      this.getfindTreePage()
      this.handlePageChange()
    },
    // èŽ·å–ç»„ç»‡æ ‘
    getfindTreePage () {
      treeList({ type: this.searchForm.type })
        .then(res => {
          if (res && res.length > 0) {
            res[0].fsStatus = 1
            // var tree= [{id:null, name:'顶级', childList:res,fsStatus:1}]
            this.treeList = res
            this.search()
            this.categoryList = this.getCategoryTree(res)
          }
        })
    },
    getCategoryTree (tree) {
      if (tree == null) {
        return []
      }
      return tree.map(item => {
        const newItem = { ...item }
        if (newItem) {
          newItem.children = newItem.childList
        }
        if (item.children && item.children.length === 0) {
          this.$delete(newItem, 'children')
        } else {
          newItem.children = this.getCategoryTree(newItem.children)
        }
        // newItem.disabled = false
        return newItem
      })
    },
    callback (row) {
      console.log(row)
      this.searchForm.isRoot = null
      this.searchForm.parentId = row.id
      this.searchForm.parentIdPath = row.idPath
      this.search()
    }
  }
}
</script>
<style lang="scss" scoped>
.box {
  width: 100%;
  display: flex;
  align-items: center;
  .box_menu {
    width: 100px;
    height: 100%;
    flex-shrink: 0;
  }
  .box_tab {
    flex: 1;
    height: 100%;
  }
}
</style>
admin/src/views/business/categoryDcaLocaltion.vue
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,158 @@
<template>
  <TableLayout1 :permissions="['business:category:query']">
    <!-- æœç´¢è¡¨å• -->
    <div ref="QueryFormRef" slot="search-form">
      <el-form ref="searchForm" :model="searchForm"  inline>
        <el-form-item label="名称" prop="name">
          <el-input v-model="searchForm.name" placeholder="请输入名称" @keypress.enter.native="search"></el-input>
        </el-form-item>
        <section>
          <el-button type="primary" @click="search">搜索</el-button>
          <el-button type="primary" @click="refresh">显示顶层</el-button>
          <el-button @click="reset">重置</el-button>
        </section>
      </el-form>
    </div>
    <template v-slot:menu>
      <div
        style="width: 100%; height: 50px; background: rgba(242, 242, 242, 1); line-height: 50px; text-align: center; font-size: 14px;">
        DCA事件位置</div>
      <div style="width: 100%; height: calc(100vh - 170px); overflow-y: scroll;">
        <Tree :list="treeList" :alllist="treeList"  :defaultProps="{ name: 'name', status: 'fsStatus', children: 'childList', id: 'id' }"
          @callback="callback" />
      </div>
    </template>
    <!-- è¡¨æ ¼å’Œåˆ†é¡µ -->
    <template v-slot:table-wrap>
      <ul class="toolbar"  v-if="containPermissions(['business:category:create', 'business:category:delete' ])" >
        <li><el-button type="primary"
                       @click="$refs.operaCategoryWindow.open('新建DCA事件位置信息', null,categoryList ,searchForm.type,searchForm.parentIdPath)" icon="el-icon-plus"
                       v-permissions="['business:category:create']">新建</el-button></li>
        <li><el-button type="danger" @click="deleteByIdInBatch(true,getfindTreePage)" icon="el-icon-delete" v-permissions="['business:category:delete']">批量删除</el-button></li>
      </ul>
      <el-table   v-loading="isWorking.search" :data="tableData.list" stripe @selection-change="handleSelectionChange">
        <el-table-column type="selection" width="55"></el-table-column>
        <el-table-column prop="name" label="名称" min-width="100px"></el-table-column>
        <el-table-column prop="parentName" label="父级" min-width="150px"></el-table-column>
        <el-table-column prop="editorName" label="操作人" min-width="100px"></el-table-column>
        <el-table-column prop="editDate" label="最后操作时间" min-width="150px"></el-table-column>
        <el-table-column v-if="containPermissions(['business:category:update', 'business:category:delete' ])" label="操作" min-width="280">
          <template slot-scope="{row}">
            <el-button type="text" icon="el-icon-edit" @click="$refs.operaCategoryWindow.open('编辑DCA事件位置信息', row, categoryList,searchForm.type)"  v-permissions="['business:category:update']">编辑</el-button>
            <el-button type="text" icon="el-icon-delete" @click="deleteById(row,true, getfindTreePage)" style="color: red"  v-permissions="['business:category:delete']">删除</el-button>
          </template>
        </el-table-column>
      </el-table>
      <pagination @size-change="handleSizeChange" @current-change="handlePageChange" :pagination="tableData.pagination">
      </pagination>
      <OperaCategoryWindow ref="operaCategoryWindow" @success="handlePageChangeDo"/>
    </template>
  </TableLayout1>
</template>
<script>
import BaseTable from '@/components/base/BaseTable'
import TableLayout1 from '@/layouts/TableLayout1'
import OperaCategoryWindow from '@/components/business/OperaCategoryWindow'
import Pagination from '@/components/common/Pagination'
import Tree from '@/components/common/Tree'
import { treeList } from '@/api/business/category'
export default {
  name: 'categorySheType',
  extends: BaseTable,
  components: { TableLayout1, Pagination, Tree, OperaCategoryWindow },
  data () {
    return {
      TreeList: [],
      // æœç´¢
      searchForm: {
        name: '',
        keyword: '',
        type: 3,
        isRoot: 1,
        parentId: '',
        parentIdPath: null
      },
      loading: false,
      heading: false,
      working: false,
      treeList: [],
      categoryList: []
    }
  },
  created () {
    this.config({
      module: 'DCA事件位置信息',
      api: '/business/category',
      'field.id': 'id',
      'field.main': 'id'
    })
    // this.search()
    this.getfindTreePage()
  },
  methods: {
    handlePageChangeDo () {
      this.searchForm.isRoot = 1
      this.searchForm.parentId = null
      this.getfindTreePage()
      this.handlePageChange()
    },
    // èŽ·å–ç»„ç»‡æ ‘
    getfindTreePage () {
      treeList({ type: this.searchForm.type })
        .then(res => {
          if (res && res.length > 0) {
            res[0].fsStatus = 1
            // var tree= [{id:null, name:'顶级', childList:res,fsStatus:1}]
            this.treeList = res
            this.search()
            this.categoryList = this.getCategoryTree(res)
          }
        })
    },
    getCategoryTree (tree) {
      if (tree == null) {
        return []
      }
      return tree.map(item => {
        const newItem = { ...item }
        if (newItem) {
          newItem.children = newItem.childList
        }
        if (item.children && item.children.length === 0) {
          this.$delete(newItem, 'children')
        } else {
          newItem.children = this.getCategoryTree(newItem.children)
        }
        // newItem.disabled = false
        return newItem
      })
    },
    callback (row) {
      console.log(row)
      this.searchForm.isRoot = null
      this.searchForm.parentId = row.id
      this.searchForm.parentIdPath = row.idPath
      this.search()
    }
  }
}
</script>
<style lang="scss" scoped>
.box {
  width: 100%;
  display: flex;
  align-items: center;
  .box_menu {
    width: 100px;
    height: 100%;
    flex-shrink: 0;
  }
  .box_tab {
    flex: 1;
    height: 100%;
  }
}
</style>
admin/src/views/business/categoryDcaProblem.vue
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,194 @@
<template>
  <TableLayout1 :permissions="['business:category:query']">
    <!-- æœç´¢è¡¨å• -->
    <div ref="QueryFormRef" slot="search-form">
      <el-form ref="searchForm" :model="searchForm"  inline>
        <el-form-item label="名称" prop="name">
          <el-input v-model="searchForm.name" placeholder="请输入名称" @keypress.enter.native="search"></el-input>
        </el-form-item>
        <section>
          <el-button type="primary" @click="search">搜索</el-button>
          <el-button type="primary" @click="refresh">显示顶层</el-button>
          <el-button @click="reset">重置</el-button>
        </section>
      </el-form>
    </div>
    <template v-slot:menu>
      <div
        style="width: 100%; height: 50px; background: rgba(242, 242, 242, 1); line-height: 50px; text-align: center; font-size: 14px;">
        DCA主题</div>
      <div style="width: 100%; height: calc(100vh - 170px); overflow-y: scroll;">
        <Tree :list="treeList" :alllist="treeList"  :defaultProps="{ name: 'name', status: 'fsStatus', children: 'childList', id: 'id' }"
          @callback="callback" />
      </div>
    </template>
    <!-- è¡¨æ ¼å’Œåˆ†é¡µ -->
    <template v-slot:table-wrap>
      <ul class="toolbar"  v-if="containPermissions(['business:category:create', 'business:category:delete' ])" >
        <li><el-button type="primary"
                       @click="$refs.operaCategoryWindow.open('新建DCA主题和观察项', null,categoryList ,4,searchForm.parentIdPath)" icon="el-icon-plus"
                       v-permissions="['business:category:create']">新建</el-button></li>
        <li><el-button type="danger" @click="deleteByIdInBatch(true,getfindTreePage)" icon="el-icon-delete" v-permissions="['business:category:delete']">批量删除</el-button></li>
      </ul>
      <el-table   v-loading="isWorking.search" :data="tableData.list" stripe @selection-change="handleSelectionChange">
        <el-table-column type="selection" width="55"></el-table-column>
        <el-table-column prop="name" label="名称" min-width="100px"></el-table-column>
        <el-table-column prop="parentName" label="所属父级" min-width="150px"></el-table-column>
        <el-table-column prop="parentName" label="配置类型" min-width="150px">
          <template slot-scope="{row}">
            <span v-if="row.type == 6" >观察项</span>
            <span v-else-if="level == 0" >一级主题</span>
            <span v-else-if="level == 1" >二级主题</span>
          </template>
        </el-table-column>
        <el-table-column prop="editorName" label="操作人" min-width="100px"></el-table-column>
        <el-table-column prop="editDate" label="最后操作时间" min-width="150px"></el-table-column>
        <el-table-column prop="remark" label="备注" min-width="100px"></el-table-column>
        <el-table-column v-if="containPermissions(['business:category:update', 'business:category:delete' ])" label="操作" min-width="280">
          <template slot-scope="{row}">
            <el-button type="text" icon="el-icon-edit" @click="$refs.operaCategoryWindow.open('编辑DCA主题和观察项', row, categoryList,row.type)"  v-permissions="['business:category:update']">编辑</el-button>
            <el-button type="text" icon="el-icon-delete" @click="deleteById(row,true, getfindTreePage)" style="color: red"  v-permissions="['business:category:delete']">删除</el-button>
          </template>
        </el-table-column>
      </el-table>
      <pagination @size-change="handleSizeChange" @current-change="handlePageChange" :pagination="tableData.pagination">
      </pagination>
      <OperaCategoryDcaProblemWindow ref="operaCategoryWindow" @success="handlePageChangeDo"/>
    </template>
  </TableLayout1>
</template>
<script>
import BaseTable from '@/components/base/BaseTable'
import TableLayout1 from '@/layouts/TableLayout1'
import OperaCategoryDcaProblemWindow from '@/components/business/OperaCategoryDcaProblemWindow'
import Pagination from '@/components/common/Pagination'
import Tree from '@/components/common/Tree'
import { treeList } from '@/api/business/category'
export default {
  name: 'categorySheType',
  extends: BaseTable,
  components: { TableLayout1, Pagination, Tree, OperaCategoryDcaProblemWindow },
  data () {
    return {
      TreeList: [],
      level: 1,
      // æœç´¢
      searchForm: {
        name: '',
        keyword: '',
        type: 4,
        parentId: '',
        isRoot: 1,
        parentIdPath: null
      },
      loading: false,
      heading: false,
      working: false,
      treeList: [],
      categoryList: []
    }
  },
  created () {
    this.config({
      module: 'DCA主题和观察项',
      api: '/business/category',
      'field.id': 'id',
      'field.main': 'id'
    })
    // this.search()
    this.getfindTreePage()
  },
  methods: {
    handlePageChangeDo () {
      this.searchForm.isRoot = 1
      this.searchForm.level = 1
      this.searchForm.type = 4
      this.searchForm.parentId = null
      this.getfindTreePage()
      this.handlePageChange()
    },
    initTwoLevelList (res) {
      return res.map(item => {
        if (item && item.childList && item.childList.length > 0) {
          item.childList.forEach(item1 => {
            item1.childList = []
            item1.level = 2
          })
        }
        const newItem = { ...item, level: 1 }
        if (newItem) {
          newItem.children = newItem.childList
        }
        if (item.childList && item.childList.length === 0) {
          this.$delete(newItem, 'children')
        }
        return newItem
      })
    },
    // èŽ·å–ç»„ç»‡æ ‘
    getfindTreePage () {
      treeList({ type: 4 })
        .then(res => {
          if (res && res.length > 0) {
            res[0].fsStatus = 1
            // var tree= [{id:null, name:'顶级', childList:res,fsStatus:1}]
            this.treeList = this.initTwoLevelList(res)
            this.search()
            this.categoryList = this.getCategoryTree(this.treeList)
          }
        })
    },
    getCategoryTree (tree) {
      if (tree == null) {
        return []
      }
      return tree.map(item => {
        const newItem = { ...item }
        if (newItem) {
          newItem.children = newItem.childList
        }
        if (item.children && item.children.length === 0) {
          this.$delete(newItem, 'children')
        } else {
          newItem.children = this.getCategoryTree(newItem.children)
        }
        // newItem.disabled = false
        return newItem
      })
    },
    callback (row) {
      console.log(row)
      this.searchForm.parentId = row.id
      this.searchForm.isRoot = null
      this.searchForm.parentIdPath = row.idPath
      this.level= row.level
      if (row.level === 2) {
        this.searchForm.type = 6
      } else {
        this.searchForm.type = 4
      }
      this.search()
    }
  }
}
</script>
<style lang="scss" scoped>
.box {
  width: 100%;
  display: flex;
  align-items: center;
  .box_menu {
    width: 100px;
    height: 100%;
    flex-shrink: 0;
  }
  .box_tab {
    flex: 1;
    height: 100%;
  }
}
</style>
admin/src/views/business/categorySheLocaltion.vue
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,158 @@
<template>
  <TableLayout1 :permissions="['business:category:query']">
    <!-- æœç´¢è¡¨å• -->
    <div ref="QueryFormRef" slot="search-form">
      <el-form ref="searchForm" :model="searchForm"  inline>
        <el-form-item label="名称" prop="name">
          <el-input v-model="searchForm.name" placeholder="请输入名称" @keypress.enter.native="search"></el-input>
        </el-form-item>
        <section>
          <el-button type="primary" @click="search">搜索</el-button>
          <el-button type="primary" @click="refresh">显示顶层</el-button>
          <el-button @click="reset">重置</el-button>
        </section>
      </el-form>
    </div>
    <template v-slot:menu>
      <div
        style="width: 100%; height: 50px; background: rgba(242, 242, 242, 1); line-height: 50px; text-align: center; font-size: 14px;">
        SHE事件发生地点</div>
      <div style="width: 100%; height: calc(100vh - 170px); overflow-y: scroll;">
        <Tree :list="treeList" :alllist="treeList"  :defaultProps="{ name: 'name', status: 'fsStatus', children: 'childList', id: 'id' }"
          @callback="callback" />
      </div>
    </template>
    <!-- è¡¨æ ¼å’Œåˆ†é¡µ -->
    <template v-slot:table-wrap>
      <ul class="toolbar"  v-if="containPermissions(['business:category:create', 'business:category:delete' ])" >
        <li><el-button type="primary"
                       @click="$refs.operaCategoryWindow.open('新建SHE事件发生地点', null,categoryList ,searchForm.type,searchForm.parentIdPath)" icon="el-icon-plus"
                       v-permissions="['business:category:create']">新建</el-button></li>
        <li><el-button type="danger" @click="deleteByIdInBatch(true,getfindTreePage)" icon="el-icon-delete" v-permissions="['business:category:delete']">批量删除</el-button></li>
      </ul>
      <el-table   v-loading="isWorking.search" :data="tableData.list" stripe @selection-change="handleSelectionChange">
        <el-table-column type="selection" width="55"></el-table-column>
        <el-table-column prop="name" label="名称" min-width="100px"></el-table-column>
        <el-table-column prop="parentName" label="父级" min-width="150px"></el-table-column>
        <el-table-column prop="editorName" label="操作人" min-width="100px"></el-table-column>
        <el-table-column prop="editDate" label="最后操作时间" min-width="150px"></el-table-column>
        <el-table-column v-if="containPermissions(['business:category:update', 'business:category:delete' ])" label="操作" min-width="280">
          <template slot-scope="{row}">
            <el-button type="text" icon="el-icon-edit" @click="$refs.operaCategoryWindow.open('编辑SHE事件发生地点', row, categoryList,searchForm.type)"  v-permissions="['business:category:update']">编辑</el-button>
            <el-button type="text" icon="el-icon-delete" @click="deleteById(row,true, getfindTreePage)" style="color: red"  v-permissions="['business:category:delete']">删除</el-button>
          </template>
        </el-table-column>
      </el-table>
      <pagination @size-change="handleSizeChange" @current-change="handlePageChange" :pagination="tableData.pagination">
      </pagination>
      <OperaCategoryWindow ref="operaCategoryWindow" @success="handlePageChangeDo"/>
    </template>
  </TableLayout1>
</template>
<script>
import BaseTable from '@/components/base/BaseTable'
import TableLayout1 from '@/layouts/TableLayout1'
import OperaCategoryWindow from '@/components/business/OperaCategoryWindow'
import Pagination from '@/components/common/Pagination'
import Tree from '@/components/common/Tree'
import { treeList } from '@/api/business/category'
export default {
  name: 'categorySheType',
  extends: BaseTable,
  components: { TableLayout1, Pagination, Tree, OperaCategoryWindow },
  data () {
    return {
      TreeList: [],
      // æœç´¢
      searchForm: {
        name: '',
        keyword: '',
        type: 5,
        parentId: '',
        isRoot: 1,
        parentIdPath: null
      },
      loading: false,
      heading: false,
      working: false,
      treeList: [],
      categoryList: []
    }
  },
  created () {
    this.config({
      module: 'SHE事件发生地点',
      api: '/business/category',
      'field.id': 'id',
      'field.main': 'id'
    })
    // this.search()
    this.getfindTreePage()
  },
  methods: {
    handlePageChangeDo () {
      this.searchForm.isRoot = 1
      this.searchForm.parentId = null
      this.getfindTreePage()
      this.handlePageChange()
    },
    // èŽ·å–ç»„ç»‡æ ‘
    getfindTreePage () {
      treeList({ type: this.searchForm.type })
        .then(res => {
          if (res && res.length > 0) {
            res[0].fsStatus = 1
            // var tree= [{id:null, name:'顶级', childList:res,fsStatus:1}]
            this.treeList = res
            this.search()
            this.categoryList = this.getCategoryTree(res)
          }
        })
    },
    getCategoryTree (tree) {
      if (tree == null) {
        return []
      }
      return tree.map(item => {
        const newItem = { ...item }
        if (newItem) {
          newItem.children = newItem.childList
        }
        if (item.children && item.children.length === 0) {
          this.$delete(newItem, 'children')
        } else {
          newItem.children = this.getCategoryTree(newItem.children)
        }
        // newItem.disabled = false
        return newItem
      })
    },
    callback (row) {
      console.log(row)
      this.searchForm.isRoot = null
      this.searchForm.parentId = row.id
      this.searchForm.parentIdPath = row.idPath
      this.search()
    }
  }
}
</script>
<style lang="scss" scoped>
.box {
  width: 100%;
  display: flex;
  align-items: center;
  .box_menu {
    width: 100px;
    height: 100%;
    flex-shrink: 0;
  }
  .box_tab {
    flex: 1;
    height: 100%;
  }
}
</style>
admin/src/views/business/categorySheType.vue
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,158 @@
<template>
  <TableLayout1 :permissions="['business:category:query']">
    <!-- æœç´¢è¡¨å• -->
    <div ref="QueryFormRef" slot="search-form">
      <el-form ref="searchForm" :model="searchForm"  inline>
        <el-form-item label="名称" prop="name">
          <el-input v-model="searchForm.name" placeholder="请输入名称" @keypress.enter.native="search"></el-input>
        </el-form-item>
        <section>
          <el-button type="primary" @click="search">搜索</el-button>
          <el-button type="primary" @click="refresh">显示顶层</el-button>
          <el-button @click="reset">重置</el-button>
        </section>
      </el-form>
    </div>
    <template v-slot:menu>
      <div
        style="width: 100%; height: 50px; background: rgba(242, 242, 242, 1); line-height: 50px; text-align: center; font-size: 14px;">
        ä¼¤å®³ç±»åž‹</div>
      <div style="width: 100%; height: calc(100vh - 170px); overflow-y: scroll;">
        <Tree :list="treeList" :alllist="treeList"  :defaultProps="{ name: 'name', status: 'fsStatus', children: 'childList', id: 'id' }"
          @callback="callback" />
      </div>
    </template>
    <!-- è¡¨æ ¼å’Œåˆ†é¡µ -->
    <template v-slot:table-wrap>
      <ul class="toolbar"  v-if="containPermissions(['business:category:create', 'business:category:delete' ])" >
        <li><el-button type="primary"
                       @click="$refs.operaCategoryWindow.open('新建伤害类型', null,categoryList ,searchForm.type,searchForm.parentIdPath)" icon="el-icon-plus"
                       v-permissions="['business:category:create']">新建</el-button></li>
        <li><el-button type="danger" @click="deleteByIdInBatch(true,getfindTreePage)" icon="el-icon-delete" v-permissions="['business:category:delete']">批量删除</el-button></li>
      </ul>
      <el-table   v-loading="isWorking.search" :data="tableData.list" stripe @selection-change="handleSelectionChange">
        <el-table-column type="selection" width="55"></el-table-column>
        <el-table-column prop="name" label="名称" min-width="100px"></el-table-column>
        <el-table-column prop="parentName" label="父级" min-width="150px"></el-table-column>
        <el-table-column prop="editorName" label="操作人" min-width="100px"></el-table-column>
        <el-table-column prop="editDate" label="最后操作时间" min-width="150px"></el-table-column>
        <el-table-column v-if="containPermissions(['business:category:update', 'business:category:delete' ])" label="操作" min-width="280">
          <template slot-scope="{row}">
            <el-button type="text" icon="el-icon-edit" @click="$refs.operaCategoryWindow.open('编辑伤害风险信息', row, categoryList,searchForm.type)"  v-permissions="['business:category:update']">编辑</el-button>
            <el-button type="text" icon="el-icon-delete" @click="deleteById(row,true, getfindTreePage)" style="color: red"  v-permissions="['business:category:delete']">删除</el-button>
          </template>
        </el-table-column>
      </el-table>
      <pagination @size-change="handleSizeChange" @current-change="handlePageChange" :pagination="tableData.pagination">
      </pagination>
      <OperaCategoryWindow ref="operaCategoryWindow" @success="handlePageChangeDo"/>
    </template>
  </TableLayout1>
</template>
<script>
import BaseTable from '@/components/base/BaseTable'
import TableLayout1 from '@/layouts/TableLayout1'
import OperaCategoryWindow from '@/components/business/OperaCategoryWindow'
import Pagination from '@/components/common/Pagination'
import Tree from '@/components/common/Tree'
import { treeList } from '@/api/business/category'
export default {
  name: 'categorySheType',
  extends: BaseTable,
  components: { TableLayout1, Pagination, Tree, OperaCategoryWindow },
  data () {
    return {
      TreeList: [],
      // æœç´¢
      searchForm: {
        name: '',
        keyword: '',
        type: 0,
        parentId: '',
        isRoot: 1,
        parentIdPath: null
      },
      loading: false,
      heading: false,
      working: false,
      treeList: [],
      categoryList: []
    }
  },
  created () {
    this.config({
      module: '伤害分类配置',
      api: '/business/category',
      'field.id': 'id',
      'field.main': 'id'
    })
    // this.search()
    this.getfindTreePage()
  },
  methods: {
    handlePageChangeDo () {
      this.searchForm.parentId = null
      this.searchForm.isRoot = 1
      this.getfindTreePage()
      this.handlePageChange()
    },
    // èŽ·å–ç»„ç»‡æ ‘
    getfindTreePage () {
      treeList({ type: this.searchForm.type })
        .then(res => {
          if (res && res.length > 0) {
            res[0].fsStatus = 1
            // var tree= [{id:null, name:'顶级', childList:res,fsStatus:1}]
            this.treeList = res
            this.search()
            this.categoryList = this.getCategoryTree(res)
          }
        })
    },
    getCategoryTree (tree) {
      if (tree == null) {
        return []
      }
      return tree.map(item => {
        const newItem = { ...item }
        if (newItem) {
          newItem.children = newItem.childList
        }
        if (item.children && item.children.length === 0) {
          this.$delete(newItem, 'children')
        } else {
          newItem.children = this.getCategoryTree(newItem.children)
        }
        // newItem.disabled = false
        return newItem
      })
    },
    callback (row) {
      console.log(row)
      this.searchForm.isRoot = null
      this.searchForm.parentId = row.id
      this.searchForm.parentIdPath = row.idPath
      this.search()
    }
  }
}
</script>
<style lang="scss" scoped>
.box {
  width: 100%;
  display: flex;
  align-items: center;
  .box_menu {
    width: 100px;
    height: 100%;
    flex-shrink: 0;
  }
  .box_tab {
    flex: 1;
    height: 100%;
  }
}
</style>
admin/src/views/business/companyMember.vue
@@ -93,7 +93,6 @@
    })
    // this.search()
    this.getfindCompanyTreePage()
    this.getPositionList()
  },
  methods: {
    // èŽ·å–ç»„ç»‡æ ‘
server/src/main/java/com/doumee/api/business/CategoryController.java
@@ -7,6 +7,7 @@
import com.doumee.core.model.PageWrap;
import com.doumee.core.model.PageData;
import com.doumee.dao.business.model.Category;
import com.doumee.dao.business.model.Company;
import com.doumee.service.business.CategoryService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
@@ -82,4 +83,13 @@
    public ApiResponse findById(@PathVariable Integer id) {
        return ApiResponse.success(categoryService.findById(id));
    }
    @ApiOperation("分类树查询")
    @PostMapping("/tree")
    @RequiresPermissions("business:category:query")
    public ApiResponse<List<Category>> tree (@RequestBody Category param){
        return ApiResponse.success(categoryService.treeList(param));
    }
}
server/src/main/java/com/doumee/dao/business/CategoryMapper.java
@@ -2,11 +2,12 @@
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.doumee.dao.business.model.Category;
import com.github.yulichang.base.MPJBaseMapper;
/**
 * @author æ±Ÿè¹„蹄
 * @since 2025/04/02 17:49
 */
public interface CategoryMapper extends BaseMapper<Category> {
public interface CategoryMapper extends MPJBaseMapper<Category> {
}
server/src/main/java/com/doumee/dao/business/model/Category.java
@@ -1,5 +1,6 @@
package com.doumee.dao.business.model;
import com.baomidou.mybatisplus.annotation.TableField;
import com.doumee.core.annotation.excel.ExcelExportColumn;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
@@ -9,6 +10,7 @@
import lombok.Data;
import com.fasterxml.jackson.annotation.JsonFormat;
import java.util.Date;
import java.util.List;
/**
 * åˆ†ç±»ä¿¡æ¯è¡¨
@@ -67,8 +69,8 @@
    @ExcelExportColumn(name="图标")
    private String imgurl;
    @ApiModelProperty(value = "类型 0SHE伤害类型 1安全风险伤害类型 2安全风险发生地点 3DCA位置 4DCA问题 5SHE风险地点", example = "1")
    @ExcelExportColumn(name="类型 0SHE伤害类型 1安全风险伤害类型 2安全风险发生地点 3DCA位置 4DCA问题 5SHE风险地点")
    @ApiModelProperty(value = "类型 0SHE伤害类型 1跌绊滑伤害类型 2跌绊滑发生地点 3DCA位置 4DCA主题 5SHE风险地点 6DCA观察项", example = "1")
    @ExcelExportColumn(name="类型 0SHE伤害类型 1跌绊滑伤害类型 2跌绊滑发生地点 3DCA位置 4DCA主题 5SHE风险地点 6DCA观察项")
    private Integer type;
    @ApiModelProperty(value = "父级编码(自关联)", example = "1")
@@ -82,5 +84,19 @@
    @ApiModelProperty(value = "编码路径")
    @ExcelExportColumn(name="编码路径")
    private String idPath;
    @ApiModelProperty(value = "上级名称")
    @TableField(exist = false)
    private String parentName;
    @ApiModelProperty(value = "操作人名字")
    @TableField(exist = false)
    private String editorName;
    @ApiModelProperty(value = "操作人名字")
    @TableField(exist = false)
    private String idParentPath;
    @ApiModelProperty(value = "是否根节点 0否 1是")
    @TableField(exist = false)
    private Integer isRoot;
    @ApiModelProperty(value = "操作人名字")
    @TableField(exist = false)
    private List<Category> childList;
}
server/src/main/java/com/doumee/dao/business/vo/CategoryTree.java
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,89 @@
package com.doumee.dao.business.vo;
import com.doumee.dao.business.model.Category;
import com.doumee.dao.business.model.Company;
import org.apache.commons.lang3.StringUtils;
import java.util.ArrayList;
import java.util.List;
import java.util.Objects;
/**
 * Created by IntelliJ IDEA.
 *
 * @Author : Rk
 * @create 2023/7/13 10:40
 */
public class CategoryTree {
    // ä¿å­˜å‚与构建树形的所有数据(通常数据库查询结果)
    public List<Category> nodeList = new ArrayList<>();
    /**
     *  æž„造方法
     *  @param nodeList å°†æ•°æ®é›†åˆèµ‹å€¼ç»™nodeList,即所有数据作为所有节点。
     */
    public CategoryTree(List<Category> nodeList){
        this.nodeList = nodeList;
    }
    /**
     *   èŽ·å–éœ€æž„å»ºçš„æ‰€æœ‰æ ¹èŠ‚ç‚¹ï¼ˆé¡¶çº§èŠ‚ç‚¹ï¼‰ "0"
     *   @return æ‰€æœ‰æ ¹èŠ‚ç‚¹List集合
     */
    public List<Category> getRootNode(){
        // ä¿å­˜æ‰€æœ‰æ ¹èŠ‚ç‚¹ï¼ˆæ‰€æœ‰æ ¹èŠ‚ç‚¹çš„æ•°æ®ï¼‰
        List<Category> rootNodeList = new ArrayList<>();
        // treeNode:查询出的每一条数据(节点)
        for (Category treeNode : nodeList){
            // åˆ¤æ–­å½“前节点是否为根节点,此处注意:若parentId类型是String,则要采用equals()方法判断。
                if (Objects.isNull(treeNode.getParentId())) {
                    // æ˜¯ï¼Œæ·»åŠ 
                    rootNodeList.add(treeNode);
            }
        }
        return rootNodeList;
    }
    /**
     *  æ ¹æ®æ¯ä¸€ä¸ªé¡¶çº§èŠ‚ç‚¹ï¼ˆæ ¹èŠ‚ç‚¹ï¼‰è¿›è¡Œæž„å»ºæ ‘å½¢ç»“æž„
     *  @return  æž„建整棵树
     */
    public List<Category> buildTree(){
        // treeNodes:保存一个顶级节点所构建出来的完整树形
        List<Category> treeNodes = new ArrayList<Category>();
        // getRootNode():获取所有的根节点
        for (Category treeRootNode : getRootNode()) {
            // å°†é¡¶çº§èŠ‚ç‚¹è¿›è¡Œæž„å»ºå­æ ‘
            treeRootNode = buildChildTree(treeRootNode);
            // å®Œæˆä¸€ä¸ªé¡¶çº§èŠ‚ç‚¹æ‰€æž„å»ºçš„æ ‘å½¢ï¼Œå¢žåŠ è¿›æ¥
            treeNodes.add(treeRootNode);
        }
        return treeNodes;
    }
    /**
     *  é€’å½’-----构建子树形结构
     *  @param  pNode æ ¹èŠ‚ç‚¹ï¼ˆé¡¶çº§èŠ‚ç‚¹ï¼‰
     *  @return æ•´æ£µæ ‘
     */
    public Category buildChildTree(Category pNode){
        List<Category> childTree = new ArrayList<>();
        // nodeList:所有节点集合(所有数据)
        for (Category treeNode : nodeList) {
            // åˆ¤æ–­å½“前节点的父节点ID是否等于根节点的ID,即当前节点为其下的子节点
            if (!Objects.isNull(treeNode.getParentId())&&treeNode.getParentId().equals(pNode.getId())) {
                // å†é€’归进行判断当前节点的情况,调用自身方法
                childTree.add(buildChildTree(treeNode));
            }
        }
        // for循环结束,即节点下没有任何节点,树形构建结束,设置树结果
        pNode.setChildList(childTree);
        return pNode;
    }
}
server/src/main/java/com/doumee/service/business/CategoryService.java
@@ -94,4 +94,6 @@
     * @return long
     */
    long count(Category category);
    List<Category> treeList(Category param );
}
server/src/main/java/com/doumee/service/business/impl/CategoryServiceImpl.java
@@ -1,20 +1,34 @@
package com.doumee.service.business.impl;
import com.doumee.core.constants.Constants;
import com.doumee.core.constants.ResponseStatus;
import com.doumee.core.exception.BusinessException;
import com.doumee.core.model.LoginUserInfo;
import com.doumee.core.model.PageData;
import com.doumee.core.model.PageWrap;
import com.doumee.core.utils.Utils;
import com.doumee.dao.business.CategoryMapper;
import com.doumee.dao.business.model.Category;
import com.doumee.dao.business.model.Company;
import com.doumee.dao.business.model.Managers;
import com.doumee.dao.business.vo.CategoryTree;
import com.doumee.dao.business.vo.CompanyTree;
import com.doumee.dao.system.model.SystemUser;
import com.doumee.service.business.CategoryService;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.github.yulichang.wrapper.MPJLambdaWrapper;
import org.apache.commons.lang3.StringUtils;
import org.apache.shiro.SecurityUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.util.CollectionUtils;
import java.util.Date;
import java.util.List;
import java.util.UUID;
/**
 * åˆ†ç±»ä¿¡æ¯è¡¨Service实现
@@ -29,13 +43,57 @@
    @Override
    public Integer create(Category category) {
        if(StringUtils.isBlank(category.getName())){
            throw  new BusinessException(ResponseStatus.BAD_REQUEST);
        }
        if(category.getType()==null){
            throw new BusinessException(ResponseStatus.DATA_EXISTS.getCode(), "对不起,组织类型不正确,请按要求填写~");
        }
  /*      //查询名称不能重复
        if(categoryMapper.selectCount(new QueryWrapper<Category>().lambda()
                .eq(Category::getName,category.getName())
                .eq(Category::getIsdeleted,Constants.ZERO)) >0){
            throw new BusinessException(ResponseStatus.DATA_EXISTS.getCode(), "对不起,名称不能重复~");
        }*/
        LoginUserInfo user = (LoginUserInfo) SecurityUtils.getSubject().getPrincipal();
        category.setIdPath(category.getId()+"/");//名称路径
        category.setNamePath(category.getName());//名称路径
        String idPath = "";
        if(category.getParentId() !=null){
            Category parent = findById(category.getParentId());
            if(parent == null || Constants.equalsInteger(parent.getIsdeleted(),Constants.ONE)){
                throw new BusinessException(ResponseStatus.DATA_EXISTS.getCode(), "对不起,父级信息不存在~");
            }
            idPath = parent.getIdPath();
            category.setIdPath(parent.getIdPath()+category.getId()+"/");
            category.setNamePath(parent.getNamePath()+"/"+category.getName());
        }
        category.setCreateDate(new Date());
        category.setCreator(user.getId());
        category.setIsdeleted(Constants.ZERO);
        category.setStatus(Constants.ZERO);
        category.setEditDate(category.getCreateDate());
        category.setEditor(category.getCreator());
        categoryMapper.insert(category);
        Category com = new Category();
        com.setId(category.getId());
        com.setIdPath(idPath+category.getId()+"/");
        categoryMapper.updateById(com);
        return category.getId();
    }
    @Override
    public void deleteById(Integer id) {
        categoryMapper.deleteById(id);
        Category model = new Category();
        model.setId(id);
        LoginUserInfo user = (LoginUserInfo) SecurityUtils.getSubject().getPrincipal();
        model.setEditor(user.getId());
        model.setEditDate(new Date());
        model.setIsdeleted(Constants.ONE);
        categoryMapper.updateById(model);
    }
    @Override
@@ -49,11 +107,43 @@
        if (CollectionUtils.isEmpty(ids)) {
            return;
        }
        categoryMapper.deleteBatchIds(ids);
        for(Integer id :ids){
            deleteById(id);
        }
    }
    @Override
    public void updateById(Category category) {
        if( category.getId() == null){
            throw  new BusinessException(ResponseStatus.BAD_REQUEST);
        }
        category.setType(null);//类型不支持修改
        Category model = categoryMapper.selectById(category.getId());
        if(model ==null || Constants.equalsInteger(model.getIsdeleted(),Constants.ONE)) {
            throw new BusinessException(ResponseStatus.DATA_EMPTY);
        }
      /*  //查询名称不能重复
        if(categoryMapper.selectCount(new QueryWrapper<Category>().lambda()
                .eq(Category::getName,category.getName())
                .eq(Category::getType,model.getType())
                .ne(Category::getId,category.getId())
                .eq(Category::getIsdeleted,Constants.ZERO)) >0){
            throw new BusinessException(ResponseStatus.DATA_EXISTS.getCode(), "对不起,名称不能重复~");
        }*/
        LoginUserInfo user = (LoginUserInfo) SecurityUtils.getSubject().getPrincipal();
        category.setIdPath(category.getId()+"/");//名称路径
        category.setNamePath(category.getName());//名称路径
        if(category.getParentId() !=null ){
            //如果父级发生改变
            Category parent = findById(category.getParentId());
            if(parent == null || Constants.equalsInteger(parent.getIsdeleted(),Constants.ONE)){
                throw new BusinessException(ResponseStatus.DATA_EXISTS.getCode(), "对不起,父级信息不存在~");
            }
            category.setIdPath(parent.getIdPath()+category.getId()+"/");
            category.setNamePath(parent.getNamePath()+"/"+category.getName());
        }
        category.setEditDate(new Date());
        category.setEditor(user.getId());
        categoryMapper.updateById(category);
    }
@@ -80,17 +170,47 @@
    @Override
    public List<Category> findList(Category category) {
        QueryWrapper<Category> wrapper = new QueryWrapper<>(category);
        return categoryMapper.selectList(wrapper);
        MPJLambdaWrapper<Category> queryWrapper = new MPJLambdaWrapper<>();
        queryWrapper.selectAll(Category.class);
        queryWrapper.selectAs(SystemUser::getUsername,Category::getEditorName);
        queryWrapper.select("t1.name",Category::getParentName);
        queryWrapper.select("t1.id_path",Category::getIdParentPath);
        queryWrapper.leftJoin(Category.class,Category::getId,Category::getParentId);
        queryWrapper.leftJoin(SystemUser.class,SystemUser::getId,Category::getEditor);
        queryWrapper.eq(category.getId() != null, Category::getId, category.getId())
                .eq(category.getCreator() != null, Category::getCreator, category.getCreator())
                .ge(category.getCreateDate() != null, Category::getCreateDate, Utils.Date.getStart(category.getCreateDate()))
                .le(category.getCreateDate() != null, Category::getCreateDate, Utils.Date.getEnd(category.getCreateDate()))
                .eq(category.getEditor() != null, Category::getEditor, category.getEditor())
                .ge(category.getEditDate() != null, Category::getEditDate, Utils.Date.getStart(category.getEditDate()))
                .le(category.getEditDate() != null, Category::getEditDate, Utils.Date.getEnd(category.getEditDate()))
                .eq(category.getIsdeleted() != null, Category::getIsdeleted, category.getIsdeleted())
                .like(category.getName() != null, Category::getName, category.getName())
                .eq(category.getRemark() != null, Category::getRemark, category.getRemark())
                .eq(category.getStatus() != null, Category::getStatus, category.getStatus())
                .eq(category.getSortnum() != null, Category::getSortnum, category.getSortnum())
                .eq(category.getImgurl() != null, Category::getImgurl, category.getImgurl())
                .eq(category.getType() != null, Category::getType, category.getType())
                .eq(category.getParentId() != null, Category::getParentId, category.getParentId())
                .eq(category.getNamePath() != null, Category::getNamePath, category.getNamePath())
                .eq(category.getIdPath() != null, Category::getIdPath, category.getIdPath())
                .orderByAsc( Category::getSortnum);
        return categoryMapper.selectJoinList(Category.class,queryWrapper);
    }
  
    @Override
    public PageData<Category> findPage(PageWrap<Category> pageWrap) {
        IPage<Category> page = new Page<>(pageWrap.getPage(), pageWrap.getCapacity());
        QueryWrapper<Category> queryWrapper = new QueryWrapper<>();
        Utils.MP.blankToNull(pageWrap.getModel());
        queryWrapper.lambda()
                .eq(pageWrap.getModel().getId() != null, Category::getId, pageWrap.getModel().getId())
        pageWrap.getModel().setIsdeleted(Constants.ZERO);
        MPJLambdaWrapper<Category> queryWrapper = new MPJLambdaWrapper<>();
        queryWrapper.selectAll(Category.class);
        queryWrapper.selectAs(SystemUser::getUsername,Category::getEditorName);
        queryWrapper.select("t1.name",Category::getParentName);
        queryWrapper.select("t1.id_path",Category::getIdParentPath);
        queryWrapper.leftJoin(Category.class,Category::getId,Category::getParentId);
        queryWrapper.leftJoin(SystemUser.class,SystemUser::getId,Category::getEditor);
        queryWrapper.eq(pageWrap.getModel().getId() != null, Category::getId, pageWrap.getModel().getId())
                .eq(pageWrap.getModel().getCreator() != null, Category::getCreator, pageWrap.getModel().getCreator())
                .ge(pageWrap.getModel().getCreateDate() != null, Category::getCreateDate, Utils.Date.getStart(pageWrap.getModel().getCreateDate()))
                .le(pageWrap.getModel().getCreateDate() != null, Category::getCreateDate, Utils.Date.getEnd(pageWrap.getModel().getCreateDate()))
@@ -98,24 +218,18 @@
                .ge(pageWrap.getModel().getEditDate() != null, Category::getEditDate, Utils.Date.getStart(pageWrap.getModel().getEditDate()))
                .le(pageWrap.getModel().getEditDate() != null, Category::getEditDate, Utils.Date.getEnd(pageWrap.getModel().getEditDate()))
                .eq(pageWrap.getModel().getIsdeleted() != null, Category::getIsdeleted, pageWrap.getModel().getIsdeleted())
                .eq(pageWrap.getModel().getName() != null, Category::getName, pageWrap.getModel().getName())
                .like(pageWrap.getModel().getName() != null, Category::getName, pageWrap.getModel().getName())
                .eq(pageWrap.getModel().getRemark() != null, Category::getRemark, pageWrap.getModel().getRemark())
                .eq(pageWrap.getModel().getStatus() != null, Category::getStatus, pageWrap.getModel().getStatus())
                .eq(pageWrap.getModel().getSortnum() != null, Category::getSortnum, pageWrap.getModel().getSortnum())
                .eq(pageWrap.getModel().getImgurl() != null, Category::getImgurl, pageWrap.getModel().getImgurl())
                .eq(pageWrap.getModel().getType() != null, Category::getType, pageWrap.getModel().getType())
                .eq(pageWrap.getModel().getParentId() != null, Category::getParentId, pageWrap.getModel().getParentId())
                .isNull(pageWrap.getModel().getIsRoot() != null && pageWrap.getModel().getIsRoot().equals(Constants.ONE), Category::getParentId)
                .eq(pageWrap.getModel().getNamePath() != null, Category::getNamePath, pageWrap.getModel().getNamePath())
                .eq(pageWrap.getModel().getIdPath() != null, Category::getIdPath, pageWrap.getModel().getIdPath())
        ;
        for(PageWrap.SortData sortData: pageWrap.getSorts()) {
            if (sortData.getDirection().equalsIgnoreCase(PageWrap.DESC)) {
                queryWrapper.orderByDesc(sortData.getProperty());
            } else {
                queryWrapper.orderByAsc(sortData.getProperty());
            }
        }
        return PageData.from(categoryMapper.selectPage(page, queryWrapper));
                .orderByAsc( Category::getSortnum);
        return PageData.from(categoryMapper.selectJoinPage(page,Category.class, queryWrapper));
    }
    @Override
@@ -123,4 +237,23 @@
        QueryWrapper<Category> wrapper = new QueryWrapper<>(category);
        return categoryMapper.selectCount(wrapper);
    }
    @Override
    public List<Category> treeList(Category param ) {
        MPJLambdaWrapper<Category> queryWrapper = new MPJLambdaWrapper<>();
        queryWrapper.selectAll(Category.class);
        queryWrapper.selectAs(SystemUser::getUsername,Category::getEditorName);
        queryWrapper.select("t1.name",Category::getParentName);
        queryWrapper.select("t1.id_path",Category::getIdParentPath);
        queryWrapper.leftJoin(Category.class,Category::getId,Category::getParentId);
        queryWrapper.leftJoin(SystemUser.class,SystemUser::getId,Category::getEditor);
        queryWrapper.eq(Category::getIsdeleted, Constants.ZERO);
        queryWrapper.eq(Category::getType, param.getType());
        queryWrapper.orderByAsc( Category::getSortnum);
        List<Category> companyList = categoryMapper.selectJoinList(Category.class,queryWrapper);
        CategoryTree treeBuild = new CategoryTree(companyList);
        companyList = treeBuild.buildTree();
        return companyList;
    }
}
server/src/main/java/com/doumee/service/business/impl/CompanyServiceImpl.java
@@ -148,7 +148,7 @@
    public List<Company> companyTree( ) {
        MPJLambdaWrapper<Company> queryWrapper = new MPJLambdaWrapper<>();
        queryWrapper.selectAll(Company.class);
        queryWrapper.selectAs(SystemUser::getRealname,Company::getEditorName);
        queryWrapper.selectAs(SystemUser::getUsername,Company::getEditorName);
        queryWrapper.select("t1.name",Company::getParentName);
        queryWrapper.select("t1.name_path",Company::getParentCompanyPath);
        queryWrapper.leftJoin(Company.class,Company::getId,Company::getParentId);