lizhenhao 2 anni fa
parent
commit
41c91bde11

+ 39 - 0
src/api/help/HelpService.js

@@ -0,0 +1,39 @@
+import request from '@/utils/httpRequest'
+
+export default class HelpService {
+  list (params) {
+    return request({
+      url: '/help/list',
+      method: 'get',
+      params: params
+    })
+  }
+  queryById (id) {
+    return request({
+      url: '/help/queryById',
+      method: 'get',
+      params: {id: id}
+    })
+  }
+  save (inputForm) {
+    return request({
+      url: `/help/save`,
+      method: 'post',
+      data: inputForm
+    })
+  }
+  delete (ids) {
+    return request({
+      url: '/help/delete',
+      method: 'delete',
+      params: {ids: ids}
+    })
+  }
+  updateStatus (id) {
+    return request({
+      url: `/help/updateStatus`,
+      method: 'post',
+      data: {id: id}
+    })
+  }
+}

+ 39 - 0
src/api/help/HelpTreeService.js

@@ -0,0 +1,39 @@
+import request from '@/utils/httpRequest'
+
+export default class HelpTreeService {
+  list (params) {
+    return request({
+      url: '/help_tree/list',
+      method: 'get',
+      params: params
+    })
+  }
+  queryById (id) {
+    return request({
+      url: '/help_tree/queryById',
+      method: 'get',
+      params: {id: id}
+    })
+  }
+  getList () {
+    return request({
+      url: '/help_tree/getList',
+      method: 'get',
+      params: {}
+    })
+  }
+  save (inputForm) {
+    return request({
+      url: `/help_tree/save`,
+      method: 'post',
+      data: inputForm
+    })
+  }
+  delete (ids) {
+    return request({
+      url: '/help_tree/delete',
+      method: 'delete',
+      params: {ids: ids}
+    })
+  }
+}

+ 170 - 0
src/views/modules/help/HelpForm.vue

@@ -0,0 +1,170 @@
+<template>
+  <div>
+    <el-dialog
+      :title="title"
+      :close-on-click-modal="false"
+      v-dialogDrag
+      width="900px"
+      @close="close"
+      append-to-body
+      @keyup.enter.native="doSubmit"
+      :visible.sync="visible">
+      <el-form size="middle" :model="inputForm" ref="inputForm" v-loading="loading" :class="method==='view'?'readonly':''"  :disabled="method==='view'"
+               label-width="90px" @submit.native.prevent>
+        <el-row  :gutter="15">
+          <el-col :span="12">
+            <el-form-item label="关联项" prop="treeName"
+                          :rules="[
+                          {required: true, message:'关联项不能为空', trigger:'change'}
+                 ]">
+              <el-input v-model="inputForm.treeName" @focus="chooseTree" :readonly="true" placeholder="请选择关联项">
+                <el-button slot="append" icon="el-icon-search" @click="chooseTree"></el-button>
+              </el-input>
+            </el-form-item>
+          </el-col>
+          <el-col :span="12">
+            <el-form-item label="编号" prop="number"
+                          :rules="[
+                 ]">
+              <el-input :disabled="true" v-model="inputForm.number" placeholder="编号自动生成"></el-input>
+            </el-form-item>
+          </el-col>
+          <el-col :span="12">
+            <el-form-item label="功能" prop="features"
+                          :rules="[
+                          {required: true, message:'功能不能为空', trigger:'blur'}
+                 ]">
+              <el-input v-model="inputForm.features" placeholder="请填写功能"></el-input>
+            </el-form-item>
+          </el-col>
+          <el-col :span="12">
+            <el-form-item label="是否启用" prop="useFlag"
+                          :rules="[
+                          {required: true, message:'请选择是否启用', trigger:'change'}
+                 ]">
+              <el-radio-group v-model="inputForm.useFlag">
+                <el-radio v-for="item in $dictUtils.getDictList('yes_no')" :label="item.value" >{{item.label}}</el-radio>
+              </el-radio-group>
+            </el-form-item>
+          </el-col>
+          <el-col :span="24">
+            <el-form-item label="描述" prop="description"
+                          :rules="[
+                 ]">
+              <el-input type="textarea" :rows="4" maxlength="500" v-model="inputForm.description" placeholder="请填写描述"  show-word-limit   ></el-input>
+            </el-form-item>
+          </el-col>
+        </el-row>
+      </el-form>
+      <span slot="footer" class="dialog-footer">
+      <el-button size="small" @click="close()" icon="el-icon-circle-close">关闭</el-button>
+      <el-button size="small" type="primary" v-if="method != 'view'" @click="doSubmit()" icon="el-icon-circle-check" v-noMoreClick>确定</el-button>
+    </span>
+      <HelpTreeListForm ref="helpTreeListForm" @getData="getData"></HelpTreeListForm>
+    </el-dialog>
+  </div>
+</template>
+
+<script>
+  import HelpService from '@/api/help/HelpService'
+  import HelpTreeListForm from './helpTree/HelpTreeListForm'
+
+  export default {
+    data () {
+      return {
+        title: '',
+        method: '',
+        visible: false,
+        loading: false,
+        inputForm: {
+          id: '',
+          treeName: '',
+          treeId: '',
+          number: '',
+          features: '',
+          useFlag: '',
+          description: ''
+        }
+      }
+    },
+    helpService: null,
+    created () {
+      this.helpService = new HelpService()
+    },
+    components: {
+      HelpTreeListForm
+    },
+    methods: {
+      init (method, id) {
+        this.method = method
+        this.inputForm = {
+          id: '',
+          treeName: '',
+          treeId: '',
+          number: '',
+          features: '',
+          useFlag: '',
+          description: ''
+        }
+        if (method === 'add') {
+          this.title = `新建帮助`
+        } else if (method === 'edit') {
+          this.title = '修改帮助'
+        } else if (method === 'view') {
+          this.title = '帮助详情'
+        }
+        this.inputForm.id = id
+        this.visible = true
+        this.loading = false
+        this.$nextTick(() => {
+          this.$refs.inputForm.resetFields()
+          if (method === 'edit' || method === 'view') { // 修改或者查看
+            this.loading = true
+            this.helpService.queryById(this.inputForm.id).then(({data}) => {
+              this.inputForm = this.recover(this.inputForm, data)
+              this.inputForm = JSON.parse(JSON.stringify(this.inputForm))
+              this.loading = false
+            })
+          }
+        })
+      },
+      // 表单提交
+      doSubmit () {
+        this.$refs['inputForm'].validate((valid) => {
+          if (valid) {
+            this.loading = true
+            this.helpService.save(this.inputForm).then(({data}) => {
+              this.close()
+              this.$message.success(data)
+              this.$emit('refreshDataList')
+              this.loading = false
+            }).catch(() => {
+              this.loading = false
+            })
+          }
+        })
+      },
+      close () {
+        this.inputForm = {
+          id: '',
+          treeName: '',
+          treeId: '',
+          number: '',
+          features: '',
+          useFlag: '',
+          description: ''
+        }
+        this.$refs.inputForm.resetFields()
+        this.visible = false
+      },
+      // 打开选择组件
+      chooseTree () {
+        this.$refs.helpTreeListForm.init()
+      },
+      getData (row) {
+        this.inputForm.treeName = this.commonJS.isNotEmpty(row.name) ? row.name : ''
+        this.inputForm.treeId = this.commonJS.isNotEmpty(row.id) ? row.id : ''
+      }
+    }
+  }
+</script>

+ 283 - 0
src/views/modules/help/HelpList.vue

@@ -0,0 +1,283 @@
+<template>
+  <div class="jp-common-layout page">
+    <div class="jp-common-layout-left">
+      <div class="jp-common-title">
+        <el-input
+          placeholder="请输入关键字过滤"
+          size="small"
+          clearable
+          v-model="filterText">
+        </el-input>
+      </div>
+      <div class="jp-common-el-tree-scrollbar el-scrollbar">
+        <div class="el-scrollbar__wrap">
+          <div class="el-scrollbar__view">
+            <el-tree
+              class="filter-tree jp-common-el-tree"
+              :render-content="renderContent"
+              :data="helpTreeData"
+              :props="{
+                    value: 'id',             // ID字段名
+                    label: 'name',         // 显示名称
+                    children: 'childrenList'    // 子级字段名
+                  }"
+              node-key="id"
+              default-expand-all
+              :filter-node-method="filterNode"
+              :expand-on-click-node="false"
+              highlight-current
+              @node-click="handleNodeClick"
+              ref="helpTree">
+            </el-tree>
+          </div>
+        </div>
+      </div>
+    </div>
+    <div class="jp-common-layout-center jp-flex-main">
+      <el-form size="small" :inline="true" class="query-form" ref="searchForm" :model="searchForm" @keyup.enter.native="refreshList()" @submit.native.prevent>
+        <el-form-item prop="number" label="编号">
+          <el-input size="small" v-model="searchForm.number" placeholder="请输入编号" clearable></el-input>
+        </el-form-item>
+        <el-form-item prop="features" label="功能">
+          <el-input size="small" v-model="searchForm.features" placeholder="请输入功能" clearable></el-input>
+        </el-form-item>
+        <el-form-item prop="description" label="描述">
+          <el-input size="small" v-model="searchForm.description" placeholder="请输入描述" clearable></el-input>
+        </el-form-item>
+        <el-form-item>
+          <el-button  type="primary" @click="refreshList()" size="small" icon="el-icon-search">查询</el-button>
+          <el-button @click="resetSearch()" size="small" icon="el-icon-refresh-right">重置</el-button>
+        </el-form-item>
+      </el-form>
+      <div class="bg-white top">
+        <vxe-toolbar  :refresh="{query: refreshList}" resizable custom>
+          <template #buttons>
+            <el-button v-if="hasPermission('help:add')" type="primary" size="small" icon="el-icon-plus" @click="add()">新建</el-button>
+            <el-button v-if="hasPermission('help:del')" type="danger"   size="small" icon="el-icon-delete" @click="del()" :disabled="$refs.helpTable && $refs.helpTable.getCheckboxRecords().length === 0" plain>删除</el-button>
+          </template>
+        </vxe-toolbar>
+        <div style="height: calc(100% - 80px);">
+          <vxe-table
+            border="inner"
+            auto-resize
+            resizable
+            height="auto"
+            :loading="loading"
+            size="small"
+            ref="helpTable"
+            show-header-overflow
+            show-overflow
+            highlight-hover-row
+            :data="dataList"
+          >
+            <vxe-column type="seq" width="60" title="序号"></vxe-column>
+            <vxe-column type="checkbox"  width="40px"></vxe-column>
+            <vxe-column min-width="100px" align="center" title="关联项" field="treeName"></vxe-column>
+            <vxe-column min-width="100px" align="center" title="编号" field="number">
+              <template slot-scope="scope">
+                <el-link type="primary" :underline="false" v-if="hasPermission('help:view')" @click="view(scope.row.id)">{{scope.row.number}}</el-link>
+                <span v-else>{{scope.row.number}}</span>
+              </template>
+            </vxe-column>
+            <vxe-column min-width="100px" align="center" title="功能" field="features"></vxe-column>
+            <vxe-column min-width="100px" align="center" title="描述" field="description"></vxe-column>
+            <vxe-column min-width="80px" align="center" title="停用/启用" fixed="right" field="useFlag">
+              <template slot-scope="scope">
+<!--                <el-tag v-if="scope.row.useFlag === '1'" size="small" type="success">正常</el-tag>-->
+<!--                <el-tag v-else-if="scope.row.useFlag === '0'" size="small" type="danger">禁用</el-tag>-->
+                <el-switch
+                  v-model="scope.row.useFlag === '1'"
+                  active-color="#13ce66"
+                  inactive-color="#ff4949"
+                  @change="updateStatus(scope.row.id)"
+                >
+                </el-switch>
+              </template>
+            </vxe-column>
+            <vxe-column title="操作" width="100px" fixed="right" align="center">
+              <template slot-scope="scope">
+                <el-button v-if="hasPermission('help:edit')" type="text" size="small"  @click="edit(scope.row.id)">修改</el-button>
+                <el-button v-if="hasPermission('help:del')" type="text" size="small"  @click="del(scope.row.id)">删除</el-button>
+              </template>
+            </vxe-column>
+          </vxe-table>
+          <vxe-pager
+            background
+            size="small"
+            :current-page="tablePage.currentPage"
+            :page-size="tablePage.pageSize"
+            :total="tablePage.total"
+            :page-sizes="[10, 20, 100, 1000, {label: '全量数据', value: 1000000}]"
+            :layouts="['PrevPage', 'JumpNumber', 'NextPage', 'FullJump', 'Sizes', 'Total']"
+            @page-change="currentChangeHandle">
+          </vxe-pager>
+        </div>
+        <!-- 弹窗, 新增 / 修改 -->
+        <HelpForm  ref="helpForm" @refreshDataList="refreshList"></HelpForm>
+      </div>
+    </div>
+  </div>
+</template>
+
+<script>
+  import HelpForm from '@/views/modules/help/HelpForm'
+  import HelpService from '@/api/help/HelpService'
+  import HelpTreeService from '@/api/help/HelpTreeService'
+
+  export default {
+    data () {
+      return {
+        searchForm: {
+          treeId: '',
+          number: '',
+          features: '',
+          description: ''
+        },
+        filterText: '',
+        dataList: [],
+        helpTreeData: [],
+        tablePage: {
+          total: 0,
+          currentPage: 1,
+          pageSize: 10,
+          orders: []
+        },
+        loading: false
+      }
+    },
+    components: {
+      HelpForm
+    },
+    helpTreeService: null,
+    helpService: null,
+    created () {
+      this.helpTreeService = new HelpTreeService()
+      this.helpService = new HelpService()
+    },
+    activated () {
+      this.refreshTree()
+      this.refreshList()
+    },
+    watch: {
+      filterText (val) {
+        this.$refs.helpTree.filter(val)
+      }
+    },
+    methods: {
+      filterNode (value, data) {
+        if (!value) return true
+        return data.name.indexOf(value) !== -1
+      },
+      renderContent (h, { node, data, store }) {
+        return (
+          <span class="custom-tree-node">
+                {
+                  data.parentId === '0' ? <i class="fa fa-sitemap"></i> : <i class="el-icon-share"></i>
+                }
+            <span class="text">{node.label}</span>
+              </span>
+        )
+      },
+      // 获取数据列表
+      refreshList () {
+        this.loading = true
+        this.helpService.list({
+          'current': this.tablePage.currentPage,
+          'size': this.tablePage.pageSize,
+          'orders': this.tablePage.orders,
+          ...this.searchForm
+        }).then(({data}) => {
+          this.dataList = data.records
+          this.tablePage.total = data.total
+          this.loading = false
+        })
+      },
+      refreshTree () {
+        this.loading = true
+        this.helpTreeService.getList().then(({data}) => {
+          this.helpTreeData = data
+          this.loading = false
+        }).catch(() => {
+          this.loading = false
+        })
+      },
+      // 当前页
+      currentChangeHandle ({ currentPage, pageSize }) {
+        this.tablePage.currentPage = currentPage
+        this.tablePage.pageSize = pageSize
+        this.refreshList()
+      },
+      // 新增
+      add () {
+        this.$refs.helpForm.init('add', '')
+      },
+      // 修改
+      edit (id) {
+        id = id || this.$refs.helpTable.getCheckboxRecords().map(item => {
+          return item.id
+        })[0]
+        this.$refs.helpForm.init('edit', id)
+      },
+      // 查看
+      view (id) {
+        this.$refs.helpForm.init('view', id)
+      },
+      // 删除
+      del (id) {
+        let ids = id || this.$refs.helpTable.getCheckboxRecords().map(item => {
+          return item.id
+        }).join(',')
+        this.$confirm(`确定删除所选项吗?`, '提示', {
+          confirmButtonText: '确定',
+          cancelButtonText: '取消',
+          type: 'warning'
+        }).then(() => {
+          this.loading = true
+          this.helpService.delete(ids).then(() => {
+            this.loading = false
+            this.refreshList()
+          }).catch(() => {
+            this.loading = false
+          })
+        })
+      },
+      handleNodeClick (data) {
+        if (data.parentId === '0') {
+          this.searchForm.treeId = ''
+        } else {
+          this.searchForm.treeId = data.id
+        }
+        this.refreshList()
+      },
+      resetSearch () {
+        this.filterText = ''
+        this.$refs.helpTree.setCurrentKey(null)
+        this.$refs.searchForm.resetFields()
+        this.searchForm = {
+          treeId: '',
+          number: '',
+          features: '',
+          description: ''
+        }
+        this.refreshTree()
+        this.refreshList()
+      },
+      // 修改帮助状态 启用/停用
+      updateStatus (id) {
+        this.loading = true
+        this.helpService.updateStatus(id).then(({data}) => {
+          this.$message.success(data)
+          this.loading = false
+          this.refreshList()
+        }).catch(() => {
+          this.loading = false
+        })
+      }
+    }
+  }
+</script>
+<style lang="scss">
+  .el-card__body {
+    overflow: auto;
+  }
+</style>

+ 142 - 0
src/views/modules/help/helpTree/HelpTreeAddForm.vue

@@ -0,0 +1,142 @@
+<template>
+  <div>
+    <el-dialog
+      :title="title"
+      :close-on-click-modal="false"
+      v-dialogDrag
+      width="500px"
+      @close="close"
+      append-to-body
+      @keyup.enter.native="doSubmit"
+      :visible.sync="visible">
+      <el-form size="middle" :model="inputForm" ref="inputForm" v-loading="loading" :class="method==='view'?'readonly':''"  :disabled="method==='view'"
+               label-width="100px" @submit.native.prevent>
+        <el-row  :gutter="15">
+          <el-col :span="21">
+            <el-form-item label="上级" prop="parentName"
+                          :rules="[
+                 ]">
+              <SelectTree
+                ref="areaTree"
+                :props="{
+                    value: 'id',             // ID字段名
+                    label: 'name',         // 显示名称
+                    children: 'childrenList'    // 子级字段名
+                  }"
+                size="medium"
+                url="/help_tree/getList"
+                :value="inputForm.parentId"
+                :clearable="true"
+                :accordion="true"
+                @getValue="(value, label) => {inputForm.parentId=value;inputForm.parentName=label}"/>
+            </el-form-item>
+          </el-col>
+          <el-col :span="21">
+            <el-form-item label="名称" prop="name"
+                          :rules="[
+                          {required: true, message:'名称不能为空', trigger:'blur'}
+                 ]">
+              <el-input v-model="inputForm.name" placeholder="请填写名称"></el-input>
+            </el-form-item>
+          </el-col>
+          <el-col :span="21">
+            <el-form-item label="排序" prop="sort"
+                          :rules="[
+                          {required: true, message:'排序不能为空', trigger:'blur'}
+                 ]">
+              <el-input v-model="inputForm.sort" placeholder="请填写排序"></el-input>
+            </el-form-item>
+          </el-col>
+          <el-col :span="21">
+            <el-form-item label="备注" prop="remarks"
+                          :rules="[
+                 ]">
+              <el-input type="textarea" maxlength="200" v-model="inputForm.remarks" placeholder="请填写备注"  show-word-limit   ></el-input>
+            </el-form-item>
+          </el-col>
+        </el-row>
+      </el-form>
+      <span slot="footer" class="dialog-footer">
+      <el-button size="small" @click="close()" icon="el-icon-circle-close">关闭</el-button>
+      <el-button size="small" type="primary" v-if="method != 'view'" @click="doSubmit()" icon="el-icon-circle-check" v-noMoreClick>确定</el-button>
+    </span>
+    </el-dialog>
+  </div>
+</template>
+
+<script>
+  import HelpTreeService from '@/api/help/HelpTreeService'
+  import SelectTree from '@/components/treeSelect/treeSelect.vue'
+  export default {
+    data () {
+      return {
+        title: '',
+        method: '',
+        visible: false,
+        loading: false,
+        inputForm: {
+          type: '',
+          sort: '',
+          remarks: '',
+          parentId: '',
+          parentName: ''
+        },
+        parentData: []
+      }
+    },
+    helpTreeService: null,
+    created () {
+      this.helpTreeService = new HelpTreeService()
+    },
+    components: {
+      SelectTree
+    },
+    methods: {
+      init () {
+        this.inputForm = {
+          name: '',
+          sort: '',
+          remarks: '',
+          parentId: '',
+          parentName: ''
+        }
+        this.title = '新建'
+        this.visible = true
+        this.loading = false
+        this.$nextTick(() => {
+          this.$refs.inputForm.resetFields()
+          // this.helpTreeService.list().then(({data}) => {
+          //   this.parentData = data
+          // })
+        })
+      },
+      // 表单提交
+      doSubmit () {
+        this.$refs['inputForm'].validate((valid) => {
+          if (valid) {
+            this.loading = true
+            let numReg = /^[0-9]*$/
+            let numRe = new RegExp(numReg)
+            if (!numRe.test(this.inputForm.sort)) {
+              this.loading = false
+              this.$message.error('排序请输入数字')
+              return
+            }
+            this.helpTreeService.save(this.inputForm).then(({data}) => {
+              this.close()
+              this.$message.success(data)
+              this.$emit('refreshDataList')
+              this.loading = false
+            }).catch(() => {
+              this.loading = false
+            })
+          }
+        })
+      },
+      close () {
+        this.$refs.inputForm.resetFields()
+        this.visible = false
+      }
+    }
+  }
+</script>

+ 133 - 0
src/views/modules/help/helpTree/HelpTreeForm.vue

@@ -0,0 +1,133 @@
+<template>
+  <div>
+    <el-dialog
+      :title="title"
+      :close-on-click-modal="false"
+      v-dialogDrag
+      width="500px"
+      @close="close"
+      @keyup.enter.native="doSubmit"
+      :visible.sync="visible">
+      <el-form size="middle" :model="inputForm" ref="inputForm" v-loading="loading" :class="method==='view'?'readonly':''"  :disabled="method==='view'"
+               label-width="120px" @submit.native.prevent>
+        <el-row  :gutter="15">
+          <el-col :span="21">
+            <el-form-item label="名称" prop="name"
+                          :rules="[
+                          {required: true, message:'名称不能为空', trigger:'blur'}
+                 ]">
+              <el-input v-model="inputForm.name" placeholder="请填写名称"></el-input>
+            </el-form-item>
+          </el-col>
+          <el-col :span="21">
+            <el-form-item label="排序" prop="sort"
+                          :rules="[
+                          {required: true, message:'排序不能为空', trigger:'blur'}
+                 ]">
+              <el-input v-model="inputForm.sort" placeholder="请填写排序"></el-input>
+            </el-form-item>
+          </el-col>
+          <el-col :span="21">
+            <el-form-item label="备注" prop="remarks"
+                          :rules="[
+                 ]">
+              <el-input type="textarea" maxlength="200" v-model="inputForm.remarks" placeholder="请填写备注"  show-word-limit   ></el-input>
+            </el-form-item>
+          </el-col>
+        </el-row>
+      </el-form>
+      <span slot="footer" class="dialog-footer">
+      <el-button size="small" @click="close()" icon="el-icon-circle-close">关闭</el-button>
+      <el-button size="small" type="primary" v-if="method != 'view'" @click="doSubmit()" icon="el-icon-circle-check" v-noMoreClick>确定</el-button>
+    </span>
+    </el-dialog>
+  </div>
+</template>
+
+<script>
+  import HelpTreeService from '@/api/help/HelpTreeService'
+  export default {
+    data () {
+      return {
+        title: '',
+        method: '',
+        visible: false,
+        loading: false,
+        inputForm: {
+          type: '',
+          sort: '',
+          remarks: '',
+          parentId: ''
+        }
+      }
+    },
+    helpTreeService: null,
+    created () {
+      this.helpTreeService = new HelpTreeService()
+    },
+    methods: {
+      init (method, id) {
+        this.method = method
+        this.inputForm = {
+          name: '',
+          sort: '',
+          remarks: '',
+          parentId: ''
+        }
+        if (method === 'add') {
+          this.title = `新建`
+          this.inputForm.parentId = '0'
+        } else if (method === 'edit') {
+          this.inputForm.id = id
+          this.title = '修改'
+        } else if (method === 'view') {
+          this.inputForm.id = id
+          this.title = '查看'
+        } else if (method === 'addChild') {
+          this.title = '新建子项'
+          this.inputForm.parentId = id
+        }
+        this.visible = true
+        this.loading = false
+        this.$nextTick(() => {
+          this.$refs.inputForm.resetFields()
+          if (method === 'edit' || method === 'view') { // 修改或者查看
+            this.loading = true
+            this.helpTreeService.queryById(this.inputForm.id).then(({data}) => {
+              this.inputForm = this.recover(this.inputForm, data)
+              this.inputForm = JSON.parse(JSON.stringify(this.inputForm))
+              this.loading = false
+            })
+          }
+        })
+      },
+      // 表单提交
+      doSubmit () {
+        this.$refs['inputForm'].validate((valid) => {
+          if (valid) {
+            this.loading = true
+            let numReg = /^[0-9]*$/
+            let numRe = new RegExp(numReg)
+            if (!numRe.test(this.inputForm.sort)) {
+              this.loading = false
+              this.$message.error('排序请输入数字')
+              return
+            }
+            this.helpTreeService.save(this.inputForm).then(({data}) => {
+              this.close()
+              this.$message.success(data)
+              this.$emit('refreshDataList')
+              this.loading = false
+            }).catch(() => {
+              this.loading = false
+            })
+          }
+        })
+      },
+      close () {
+        this.$refs.inputForm.resetFields()
+        this.visible = false
+      }
+    }
+  }
+</script>

+ 162 - 0
src/views/modules/help/helpTree/HelpTreeList.vue

@@ -0,0 +1,162 @@
+<template>
+  <div class="page">
+    <el-form size="small" :inline="true" class="query-form" ref="searchForm" :model="searchForm" @keyup.enter.native="refreshList()" @submit.native.prevent>
+      <!-- 搜索框-->
+      <el-form-item prop="name">
+        <el-input size="small" v-model="searchForm.name" placeholder="请输入名称" clearable></el-input>
+      </el-form-item>
+      <el-form-item>
+        <el-button type="primary" @click="refreshList()" size="small" icon="el-icon-search">查询</el-button>
+        <el-button @click="resetSearch()" size="small" icon="el-icon-refresh-right">重置</el-button>
+      </el-form-item>
+    </el-form>
+    <div class="bg-white top" style="">
+      <vxe-toolbar :refresh="{query: refreshList}" custom>
+        <template #buttons>
+          <el-button v-if="hasPermission('help:add')" type="primary" size="small" icon="el-icon-plus" @click="add()">新建</el-button>
+          <el-button v-if="hasPermission('help:del')" type="danger"   size="small" icon="el-icon-delete" @click="del()" :disabled="$refs.helpTreeTable && $refs.helpTreeTable.getCheckboxRecords().length === 0" plain>删除</el-button>
+        </template>
+      </vxe-toolbar>
+      <div style="height: calc(100% - 50px)">
+        <vxe-table
+          border="inner"
+          auto-resize
+          resizable
+          height="auto"
+          :loading="loading"
+          size="small"
+          ref="helpTreeTable"
+          show-header-overflow
+          show-overflow
+          highlight-hover-row
+          :menu-config="{}"
+          @sort-change="sortChangeHandle"
+          :sort-config="{remote:true}"
+          :data="dataList"
+          :tree-config="{transform: true, rowField: 'id', parentField: 'parentId',expandAll: true}"
+          :checkbox-config="{}">
+          <vxe-column type="seq" width="60" title="序号"></vxe-column>
+          <vxe-column type="checkbox" width="40" ></vxe-column>
+          <vxe-column min-width="350" title="名称" field="name" align="left" tree-node></vxe-column>
+          <vxe-column min-width="50" align="center" title="序号" field="sort"></vxe-column>
+          <vxe-column min-width="50" align="center" title="级别" field="level"></vxe-column>
+          <vxe-column min-width="50" align="center" title="备注" field="remarks"></vxe-column>
+          <vxe-column title="操作" width="230px" fixed="right" align="center">
+            <template  slot-scope="scope">
+              <el-button v-if="hasPermission('help:edit')" type="text"  size="small" @click="addChild(scope.row.id)">新建子项</el-button>
+              <el-button v-if="hasPermission('help:edit')" type="text"  size="small" @click="edit(scope.row.id)">修改</el-button>
+              <el-button v-if="hasPermission('help:del')" type="text"   size="small" @click="del(scope.row.id)">删除</el-button>
+            </template>
+          </vxe-column>
+        </vxe-table>
+      </div>
+    </div>
+    <HelpTreeForm  ref="helpTreeForm" @refreshDataList="refreshList"></HelpTreeForm>
+  </div>
+</template>
+
+<script>
+  import HelpTreeService from '@/api/help/HelpTreeService'
+  import HelpTreeForm from './HelpTreeForm'
+  export default {
+    data () {
+      return {
+        searchForm: {
+          name: '',
+          sort: ''
+        },
+        dataList: [],
+        tablePage: {
+          total: 0,
+          currentPage: 1,
+          pageSize: 10,
+          orders: []
+        },
+        loading: false
+      }
+    },
+    helpTreeService: null,
+    created () {
+      this.helpTreeService = new HelpTreeService()
+    },
+    components: {
+      HelpTreeForm
+    },
+    mounted () {
+      this.refreshList()
+    },
+    methods: {
+      // 新增
+      add () {
+        this.$refs.helpTreeForm.init('add', '')
+      },
+      addChild (id) {
+        this.$refs.helpTreeForm.init('addChild', id)
+      },
+      // 修改
+      edit (id) {
+        id = id || this.$refs.helpTreeTable.getCheckboxRecords().map(item => {
+          return item.id
+        })[0]
+        this.$refs.helpTreeForm.init('edit', id)
+      },
+      // 查看
+      view (id) {
+        this.$refs.helpTreeForm.init('view', id)
+      },
+      // 获取数据列表
+      refreshList () {
+        this.loading = true
+        this.helpTreeService.list({
+          'current': this.tablePage.currentPage,
+          'size': this.tablePage.pageSize,
+          'orders': this.tablePage.orders,
+          ...this.searchForm
+        }).then(({data}) => {
+          this.dataList = data.records
+          this.tablePage.total = data.total
+          this.loading = false
+          this.$nextTick(() => {
+            this.$refs.helpTreeTable.setAllTreeExpand(true)
+          })
+        })
+      },
+      // 当前页
+      currentChangeHandle ({ currentPage, pageSize }) {
+        this.tablePage.currentPage = currentPage
+        this.tablePage.pageSize = pageSize
+        this.refreshList()
+      },
+      // 排序
+      sortChangeHandle (column) {
+        this.tablePage.orders = []
+        if (column.order != null) {
+          this.tablePage.orders.push({column: this.$utils.toLine(column.property), asc: column.order === 'asc'})
+        }
+        this.refreshList()
+      },
+      // 删除
+      del (id) {
+        let ids = id || this.$refs.helpTreeTable.getCheckboxRecords().map(item => {
+          return item.id
+        }).join(',')
+        this.$confirm(`确定删除所选项吗?`, '提示', {
+          confirmButtonText: '确定',
+          cancelButtonText: '取消',
+          type: 'warning'
+        }).then(() => {
+          this.loading = true
+          this.helpTreeService.delete(ids).then(({data}) => {
+            this.$message.success(data)
+            this.refreshList()
+            this.loading = false
+          })
+        })
+      },
+      resetSearch () {
+        this.$refs.searchForm.resetFields()
+        this.refreshList()
+      }
+    }
+  }
+</script>

+ 152 - 0
src/views/modules/help/helpTree/HelpTreeListForm.vue

@@ -0,0 +1,152 @@
+<template>
+  <div>
+    <el-dialog
+      :title="title"
+      :close-on-click-modal="false"
+      v-dialogDrag
+      width="410px"
+      height="500px"
+      append-to-body
+      @close="close"
+      @keyup.enter.native="getData"
+      :visible.sync="visible">
+      <div style="height: calc(100% - 50px);">
+        <el-form size="small" :inline="true" class="query-form" ref="searchForm" :model="searchForm"  @submit.native.prevent>
+          <el-form-item prop="name">
+            <el-input size="small" v-model="searchForm.name" placeholder="请输入名称" clearable></el-input>
+          </el-form-item>
+
+          <el-form-item>
+            <el-button type="primary" @click="list()" size="small" >查询</el-button>
+            <el-button @click="resetSearch()" size="small" >重置</el-button>
+          </el-form-item>
+        </el-form>
+        <vxe-toolbar size="medium">
+          <template #tools>
+            <vxe-button content="新建关联项" @click="addMenu"></vxe-button>
+          </template>
+        </vxe-toolbar>
+        <vxe-table
+          border="inner"
+          auto-resize
+          resizable
+          height="360"
+          :loading="loading"
+          size="small"
+          ref="helpTreeTable"
+          show-header-overflow
+          show-overflow
+          :show-header="false"
+          :row-config="{isCurrent: true}"
+          :radio-config="{trigger: 'row'}"
+          :data="dataList"
+          :tree-config="{transform: true, rowField: 'id', parentField: 'parentId'}"
+          :checkbox-config="{}">
+          <vxe-column type="radio" width="40" ></vxe-column>
+          <vxe-column min-width="300" title="名称" field="name" align="left" tree-node></vxe-column>
+        </vxe-table>
+      </div>
+      <span slot="footer" class="dialog-footer">
+      <el-button size="small" @click="close()" icon="el-icon-circle-close">关闭</el-button>
+      <el-button size="small" type="primary" v-if="method != 'view'" @click="getData()" icon="el-icon-circle-check" v-noMoreClick>确定</el-button>
+    </span>
+      <HelpTreeAddForm ref="helpTreeAddForm" @refreshDataList="resetSearch"></HelpTreeAddForm>
+    </el-dialog>
+  </div>
+</template>
+
+<script>
+  import InputNumber from '@/views/modules/sys/workContract/InputNumber.vue'
+  import HelpTreeService from '@/api/help/HelpTreeService'
+  import SelectUserTree from '@/views/modules/utils/treeUserSelect'
+  import HelpTreeAddForm from './HelpTreeAddForm'
+  export default {
+    data () {
+      return {
+        title: '',
+        method: '',
+        visible: false,
+        loading: false,
+        tablePage: {
+          total: 0,
+          currentPage: 1,
+          pageSize: 10,
+          orders: []
+        },
+        dataList: [],
+        searchForm: {
+          name: ''
+        },
+        expandAll: true
+      }
+    },
+    helpTreeService: null,
+    created () {
+      this.helpTreeService = new HelpTreeService()
+    },
+    components: {
+      SelectUserTree,
+      InputNumber,
+      HelpTreeAddForm
+    },
+    methods: {
+      init () {
+        this.title = '关联项选择'
+        this.visible = true
+        this.list()
+      },
+      // 表单提交
+      getData () {
+        let row = this.$refs.helpTreeTable.getRadioRecord()
+        if (this.commonJS.isEmpty(row)) {
+          this.$message.error('请至少选择一条数据')
+        } else {
+          this.close()
+          this.$emit('getData', row)
+        }
+      },
+      list () {
+        this.dataList = []
+        this.loading = true
+        this.helpTreeService.list({
+          'current': this.tablePage.currentPage,
+          'size': this.tablePage.pageSize,
+          'orders': this.tablePage.orders,
+          ...this.searchForm
+        }).then(({data}) => {
+          this.dataList = data.records
+          this.tablePage.total = data.total
+          this.loading = false
+          this.$nextTick(() => {
+            this.$refs.helpTreeTable.setAllTreeExpand(true)
+          })
+        })
+      },
+      // 当前页
+      currentChangeHandle ({currentPage, pageSize}) {
+        this.tablePage.currentPage = currentPage
+        this.tablePage.pageSize = pageSize
+        this.list()
+      },
+      resetSearch () {
+        this.$refs.searchForm.resetFields()
+        this.list()
+      },
+      close () {
+        this.$refs.searchForm.resetFields()
+        this.visible = false
+      },
+      addMenu () {
+        this.$refs.helpTreeAddForm.init()
+      }
+    }
+  }
+</script>
+<style scoped>
+  /deep/ .el-dialog__body {
+    padding-top: 0;
+  }
+  /deep/ .el-form-item--mini.el-form-item, .el-form-item--small.el-form-item {
+    margin-bottom: 0px;
+  }
+</style>