瀏覽代碼

林长增加部门搜索

hanfucheng 1 年之前
父節點
當前提交
19be41d7f2

+ 215 - 143
data-ui/src/views/data/digitalforest/linleader/index.vue

@@ -1,152 +1,178 @@
 <template>
 <template>
   <div class="app-container">
   <div class="app-container">
-    <el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="68px" @submit.native.prevent>
-      <el-form-item label="姓名" prop="linName" label-width="100px">
-        <el-input
-          v-model="queryParams.linName"
-          placeholder="请输入姓名"
-          clearable
-          @keyup.enter.native="handleQuery"
-        />
-      </el-form-item>
-      <el-form-item label="电话" prop="linPhone" label-width="100px">
-        <el-input
-          v-model="queryParams.linPhone"
-          placeholder="请输入电话"
-          clearable
-          @keyup.enter.native="handleQuery"
-        />
-      </el-form-item>
-      <el-form-item label="负责网格" prop="linGridName" label-width="100px">
-        <el-input
-          v-model="queryParams.linGridName"
-          placeholder="请输入负责网格"
-          clearable
-          @keyup.enter.native="handleQuery"
-        />
-      </el-form-item>
-      <!-- <el-form-item label="关联用户ID" prop="linUserId">
-         <el-input
-           v-model="queryParams.linUserId"
-           placeholder="请输入关联用户ID"
-           clearable
-           @keyup.enter.native="handleQuery"
-         />
-       </el-form-item>-->
-      <el-form-item>
-        <el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
-        <el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
-      </el-form-item>
-    </el-form>
-
-    <el-row :gutter="10" class="mb8">
-      <el-col :span="1.5">
-        <el-button
-          type="primary"
-          plain
-          icon="el-icon-plus"
-          size="mini"
-          @click="handleAdd"
-          v-hasPermi="['forest:linleader:add']"
-        >新增
-        </el-button>
+    <el-row :gutter="20">
+      <!--部门数据-->
+      <el-col :span="4" :xs="24">
+        <div class="head-container">
+          <el-input
+            v-model="deptName"
+            placeholder="请输入部门名称"
+            clearable
+            size="small"
+            prefix-icon="el-icon-search"
+            style="margin-bottom: 20px"
+          >
+            <el-button slot="append" @click="changeQueryType" v-if="!queryThisLevel">本级及下级</el-button>
+            <el-button slot="append" @click="changeQueryType" v-if="queryThisLevel">只查询本级</el-button>
+          </el-input>
+        </div>
+        <div class="head-container tree-scrollbar" style="height: 700px;overflow-y:auto;">
+          <el-tree
+            :data="deptOptions"
+            :props="defaultProps"
+            :expand-on-click-node="false"
+            :filter-node-method="filterNode"
+            ref="tree"
+            node-key="id"
+            :default-expanded-keys="[100]"
+            @node-click="handleNodeClick"
+          />
+        </div>
       </el-col>
       </el-col>
-      <el-col :span="1.5">
-        <el-button
-          type="success"
-          plain
-          icon="el-icon-edit"
-          size="mini"
-          :disabled="single"
-          @click="handleUpdate"
-          v-hasPermi="['forest:linleader:edit']"
-        >修改
-        </el-button>
-      </el-col>
-      <el-col :span="1.5">
-        <el-button
-          type="danger"
-          plain
-          icon="el-icon-delete"
-          size="mini"
-          :disabled="multiple"
-          @click="handleDelete"
-          v-hasPermi="['forest:linleader:remove']"
-        >删除
-        </el-button>
-      </el-col>
-      <el-col :span="1.5">
-        <el-button
-          type="warning"
-          plain
-          icon="el-icon-download"
-          size="mini"
-          @click="handleExport"
-          v-hasPermi="['forest:linleader:export']"
-        >导出
-        </el-button>
+      <!--林长数据-->
+      <el-col :span="20" :xs="24">
+        <el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="68px" @submit.native.prevent>
+          <el-form-item label="姓名" prop="linName" label-width="100px">
+            <el-input
+              v-model="queryParams.linName"
+              placeholder="请输入姓名"
+              clearable
+              @keyup.enter.native="handleQuery"
+            />
+          </el-form-item>
+          <el-form-item label="电话" prop="linPhone" label-width="100px">
+            <el-input
+              v-model="queryParams.linPhone"
+              placeholder="请输入电话"
+              clearable
+              @keyup.enter.native="handleQuery"
+            />
+          </el-form-item>
+          <el-form-item label="负责网格" prop="linGridName" label-width="100px">
+            <el-input
+              v-model="queryParams.linGridName"
+              placeholder="请输入负责网格"
+              clearable
+              @keyup.enter.native="handleQuery"
+            />
+          </el-form-item>
+          <el-form-item>
+            <el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
+            <el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
+          </el-form-item>
+        </el-form>
+
+        <el-row :gutter="10" class="mb8">
+          <el-col :span="1.5">
+            <el-button
+              type="primary"
+              plain
+              icon="el-icon-plus"
+              size="mini"
+              @click="handleAdd"
+              v-hasPermi="['forest:linleader:add']"
+            >新增
+            </el-button>
+          </el-col>
+          <el-col :span="1.5">
+            <el-button
+              type="success"
+              plain
+              icon="el-icon-edit"
+              size="mini"
+              :disabled="single"
+              @click="handleUpdate"
+              v-hasPermi="['forest:linleader:edit']"
+            >修改
+            </el-button>
+          </el-col>
+          <el-col :span="1.5">
+            <el-button
+              type="danger"
+              plain
+              icon="el-icon-delete"
+              size="mini"
+              :disabled="multiple"
+              @click="handleDelete"
+              v-hasPermi="['forest:linleader:remove']"
+            >删除
+            </el-button>
+          </el-col>
+          <el-col :span="1.5">
+            <el-button
+              type="warning"
+              plain
+              icon="el-icon-download"
+              size="mini"
+              @click="handleExport"
+              v-hasPermi="['forest:linleader:export']"
+            >导出
+            </el-button>
+          </el-col>
+          <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
+        </el-row>
+
+        <el-table v-loading="loading" :data="linleaderList" @selection-change="handleSelectionChange">
+          <el-table-column type="selection" width="55" align="center"/>
+          <!--<el-table-column label="主键id" align="center" prop="id"/>-->
+          <el-table-column label="姓名" align="center" prop="linName"/>
+          <el-table-column label="性别" align="center" prop="linSex">
+            <template slot-scope="scope">
+              <dict-tag :options="dict.type.sys_user_sex" :value="scope.row.linSex"/>
+            </template>
+          </el-table-column>
+          <el-table-column label="林长级别" align="center" prop="linLevel">
+            <template slot-scope="scope">
+              <dict-tag :options="dict.type.forest_lin_level" :value="scope.row.linLevel"/>
+            </template>
+          </el-table-column>
+          <el-table-column label="手机号" align="center" prop="linPhone"/>
+          <el-table-column label="负责网格" align="center" prop="linGridName"/>
+          <el-table-column label="编号" align="center" prop="linNumber"/>
+          <el-table-column label="职务" align="center" prop="linJob">
+            <template slot-scope="scope">
+              <dict-tag :options="dict.type.forest_lin_job" :value="scope.row.linJob"/>
+            </template>
+          </el-table-column>
+          <el-table-column label="职责" align="center" prop="linDuty"/>
+          <el-table-column label="责任区" align="center" prop="linResponsibility"/>
+          <el-table-column label="所属部门" align="center" prop="deptName"/>
+          <el-table-column label="创建人" align="center" prop="createName" />
+          <el-table-column label="创建时间" align="center" prop="createTime" />
+          <el-table-column label="修改人" align="center" prop="updateName" />
+          <el-table-column label="修改时间" align="center" prop="updateTime" />
+          <el-table-column label="操作" align="center" class-name="small-padding fixed-width">
+            <template slot-scope="scope">
+              <el-button
+                size="mini"
+                type="text"
+                icon="el-icon-edit"
+                @click="handleUpdate(scope.row)"
+                v-hasPermi="['forest:linleader:edit']"
+              >修改
+              </el-button>
+              <el-button
+                size="mini"
+                type="text"
+                icon="el-icon-delete"
+                @click="handleDelete(scope.row)"
+                v-hasPermi="['forest:linleader:remove']"
+              >删除
+              </el-button>
+            </template>
+          </el-table-column>
+        </el-table>
+
+        <pagination
+          v-show="total>0"
+          :total="total"
+          :page.sync="queryParams.pageNum"
+          :limit.sync="queryParams.pageSize"
+          @pagination="pageList"
+        />
       </el-col>
       </el-col>
-      <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
     </el-row>
     </el-row>
 
 
-    <el-table v-loading="loading" :data="linleaderList" @selection-change="handleSelectionChange">
-      <el-table-column type="selection" width="55" align="center"/>
-      <!--<el-table-column label="主键id" align="center" prop="id"/>-->
-      <el-table-column label="姓名" align="center" prop="linName"/>
-      <el-table-column label="性别" align="center" prop="linSex">
-        <template slot-scope="scope">
-          <dict-tag :options="dict.type.sys_user_sex" :value="scope.row.linSex"/>
-        </template>
-      </el-table-column>
-      <el-table-column label="林长级别" align="center" prop="linLevel">
-        <template slot-scope="scope">
-          <dict-tag :options="dict.type.forest_lin_level" :value="scope.row.linLevel"/>
-        </template>
-      </el-table-column>
-      <el-table-column label="手机号" align="center" prop="linPhone"/>
-      <el-table-column label="负责网格" align="center" prop="linGridName"/>
-      <el-table-column label="编号" align="center" prop="linNumber"/>
-      <el-table-column label="职务" align="center" prop="linJob">
-        <template slot-scope="scope">
-          <dict-tag :options="dict.type.forest_lin_job" :value="scope.row.linJob"/>
-        </template>
-      </el-table-column>
-      <el-table-column label="职责" align="center" prop="linDuty"/>
-      <el-table-column label="责任区" align="center" prop="linResponsibility"/>
-      <el-table-column label="所属部门" align="center" prop="deptName"/>
-      <el-table-column label="创建人" align="center" prop="createName" />
-      <el-table-column label="创建时间" align="center" prop="createTime" />
-      <el-table-column label="修改人" align="center" prop="updateName" />
-      <el-table-column label="修改时间" align="center" prop="updateTime" />
-      <el-table-column label="操作" align="center" class-name="small-padding fixed-width">
-        <template slot-scope="scope">
-          <el-button
-            size="mini"
-            type="text"
-            icon="el-icon-edit"
-            @click="handleUpdate(scope.row)"
-            v-hasPermi="['forest:linleader:edit']"
-          >修改
-          </el-button>
-          <el-button
-            size="mini"
-            type="text"
-            icon="el-icon-delete"
-            @click="handleDelete(scope.row)"
-            v-hasPermi="['forest:linleader:remove']"
-          >删除
-          </el-button>
-        </template>
-      </el-table-column>
-    </el-table>
-
-    <pagination
-      v-show="total>0"
-      :total="total"
-      :page.sync="queryParams.pageNum"
-      :limit.sync="queryParams.pageSize"
-      @pagination="getList"
-    />
 
 
     <!-- 添加或修改林长管理对话框 -->
     <!-- 添加或修改林长管理对话框 -->
     <el-dialog :title="title" :visible.sync="open" width="850px" class="form-style">
     <el-dialog :title="title" :visible.sync="open" width="850px" class="form-style">
@@ -295,6 +321,8 @@
     dicts: ['forest_lin_level', 'forest_lin_job', 'forest_lin_position', 'forest_llinchang_lin_type', 'sys_user_sex'],
     dicts: ['forest_lin_level', 'forest_lin_job', 'forest_lin_position', 'forest_llinchang_lin_type', 'sys_user_sex'],
     data() {
     data() {
       return {
       return {
+        //左侧组织机构数查询方式  true查询本级  false查询本级及下级
+        queryThisLevel: false,
         // 部门树选项
         // 部门树选项
         deptOptions: [],
         deptOptions: [],
         // 林业网格层级信息树选项
         // 林业网格层级信息树选项
@@ -314,6 +342,8 @@
         total: 0,
         total: 0,
         // 林长管理表格数据
         // 林长管理表格数据
         linleaderList: [],
         linleaderList: [],
+        // 部门名称
+        deptName: undefined,
         // 弹出层标题
         // 弹出层标题
         title: "",
         title: "",
         // 是否显示弹出层
         // 是否显示弹出层
@@ -335,10 +365,15 @@
           linUserId: null,
           linUserId: null,
           linName: null,
           linName: null,
           linSex: null,
           linSex: null,
+          deptId: undefined,
           linPhone: null
           linPhone: null
         },
         },
         // 表单参数
         // 表单参数
         form: {},
         form: {},
+        defaultProps: {
+          children: 'children',
+          label: 'label'
+        },
         // 表单校验
         // 表单校验
         rules: {
         rules: {
           linName: [
           linName: [
@@ -369,6 +404,12 @@
         gridList: []
         gridList: []
       };
       };
     },
     },
+    watch: {
+      // 根据名称筛选部门树
+      deptName(val) {
+        this.$refs.tree.filter(val)
+      }
+    },
     created() {
     created() {
       this.getList();
       this.getList();
       listAllGrid(this.queryParams).then(response => {
       listAllGrid(this.queryParams).then(response => {
@@ -474,11 +515,13 @@
       },
       },
       /** 搜索按钮操作 */
       /** 搜索按钮操作 */
       handleQuery() {
       handleQuery() {
+        this.queryParams.deptId = null
         this.queryParams.pageNum = 1;
         this.queryParams.pageNum = 1;
         this.getList();
         this.getList();
       },
       },
       /** 重置按钮操作 */
       /** 重置按钮操作 */
       resetQuery() {
       resetQuery() {
+        this.queryParams.deptId = null
         this.resetForm("queryForm");
         this.resetForm("queryForm");
         this.handleQuery();
         this.handleQuery();
       },
       },
@@ -545,6 +588,35 @@
         this.download('sooka-sponest-center-data/linleader/export', {
         this.download('sooka-sponest-center-data/linleader/export', {
           ...this.queryParams
           ...this.queryParams
         }, `林长管理_${new Date().getTime()}.xlsx`)
         }, `林长管理_${new Date().getTime()}.xlsx`)
+      },
+      //点击按钮修改是否只查询本级部门用户
+      changeQueryType(){
+        this.queryThisLevel = !this.queryThisLevel;
+      },
+      /**分页列表方法**/
+      pageList(){
+        if(!this.queryThisLevel){
+          this.queryParams.deptName = 0
+        }else {
+          this.queryParams.deptName = null
+        }
+        this.getList();
+      },
+      // 筛选节点
+      filterNode(value, data) {
+        if (!value) return true
+        return data.label.indexOf(value) !== -1
+      },
+      // 节点单击事件
+      handleNodeClick(data) {
+        this.queryParams.deptId = data.id;
+        this.queryParams.pageNum = 1;
+        if(!this.queryThisLevel){
+          this.queryParams.deptName = 0
+        }else {
+          this.queryParams.deptName = null
+        }
+        this.getList();
       }
       }
     }
     }
   };
   };

+ 10 - 1
src/main/resources/mapper/digitalforest/CenterdataTForestLinleaderMapper.xml

@@ -54,7 +54,16 @@
             <if test="linGridName != null  and linGridName != ''">and a.lin_grid_name like concat('%', #{linGridName},'%')</if>
             <if test="linGridName != null  and linGridName != ''">and a.lin_grid_name like concat('%', #{linGridName},'%')</if>
             <if test="linName != null  and linName != ''">and a.lin_name like concat('%', #{linName},'%')</if>
             <if test="linName != null  and linName != ''">and a.lin_name like concat('%', #{linName},'%')</if>
             <if test="linPhone != null  and linPhone != ''">and a.lin_phone like concat('%', #{linPhone},'%')</if>
             <if test="linPhone != null  and linPhone != ''">and a.lin_phone like concat('%', #{linPhone},'%')</if>
-            <if test="deptId != null ">and dept_id = #{deptId}</if>
+            <if test="deptId != null">
+                <choose>
+                    <when test="deptName != null and deptName == 0">
+                        and FIND_IN_SET( #{deptId}, CONCAT( d.ancestors, ",", d.dept_id) )
+                    </when>
+                    <otherwise>
+                        and d.dept_id = #{deptId}
+                    </otherwise>
+                </choose>
+            </if>
             ${params.dataScope}
             ${params.dataScope}
         </where>
         </where>
         order by a.create_time desc
         order by a.create_time desc