1. 组织架构
This commit is contained in:
		
							parent
							
								
									367bc5167c
								
							
						
					
					
						commit
						2f83603276
					
				| 
						 | 
				
			
			@ -1,16 +1,16 @@
 | 
			
		|||
<template>
 | 
			
		||||
  <div class="app-container">
 | 
			
		||||
    <el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch">
 | 
			
		||||
      <el-form-item label="部门名称" prop="deptName">
 | 
			
		||||
      <el-form-item label="运营商名称" prop="deptName">
 | 
			
		||||
        <el-input
 | 
			
		||||
          v-model="queryParams.deptName"
 | 
			
		||||
          placeholder="请输入部门名称"
 | 
			
		||||
          placeholder="请输入运营商名称"
 | 
			
		||||
          clearable
 | 
			
		||||
          @keyup.enter.native="handleQuery"
 | 
			
		||||
        />
 | 
			
		||||
      </el-form-item>
 | 
			
		||||
      <el-form-item label="状态" prop="status">
 | 
			
		||||
        <el-select v-model="queryParams.status" placeholder="部门状态" clearable>
 | 
			
		||||
        <el-select v-model="queryParams.status" placeholder="运营商状态" clearable>
 | 
			
		||||
          <el-option
 | 
			
		||||
            v-for="dict in dict.type.sys_normal_disable"
 | 
			
		||||
            :key="dict.value"
 | 
			
		||||
| 
						 | 
				
			
			@ -56,7 +56,7 @@
 | 
			
		|||
      :default-expand-all="isExpandAll"
 | 
			
		||||
      :tree-props="{children: 'children', hasChildren: 'hasChildren'}"
 | 
			
		||||
    >
 | 
			
		||||
      <el-table-column prop="deptName" label="部门名称" width="260"></el-table-column>
 | 
			
		||||
      <el-table-column prop="deptName" label="运营商名称" width="260"></el-table-column>
 | 
			
		||||
      <el-table-column prop="orderNum" label="排序" width="200"></el-table-column>
 | 
			
		||||
      <el-table-column prop="status" label="状态" width="100">
 | 
			
		||||
        <template slot-scope="scope">
 | 
			
		||||
| 
						 | 
				
			
			@ -96,20 +96,20 @@
 | 
			
		|||
      </el-table-column>
 | 
			
		||||
    </el-table>
 | 
			
		||||
 | 
			
		||||
    <!-- 添加或修改部门对话框 -->
 | 
			
		||||
    <!-- 添加或修改运营商对话框 -->
 | 
			
		||||
    <el-dialog :title="title" :visible.sync="open" width="600px" append-to-body>
 | 
			
		||||
      <el-form ref="form" :model="form" :rules="rules" label-width="80px">
 | 
			
		||||
        <el-row>
 | 
			
		||||
          <el-col :span="24" v-if="form.parentId !== 0">
 | 
			
		||||
            <el-form-item label="上级部门" prop="parentId">
 | 
			
		||||
              <treeselect v-model="form.parentId" :options="deptOptions" :normalizer="normalizer" placeholder="选择上级部门" />
 | 
			
		||||
            <el-form-item label="上级运营商" prop="parentId">
 | 
			
		||||
              <treeselect v-model="form.parentId" :options="deptOptions" :normalizer="normalizer" placeholder="选择上级运营商" />
 | 
			
		||||
            </el-form-item>
 | 
			
		||||
          </el-col>
 | 
			
		||||
        </el-row>
 | 
			
		||||
        <el-row>
 | 
			
		||||
          <el-col :span="12">
 | 
			
		||||
            <el-form-item label="部门名称" prop="deptName">
 | 
			
		||||
              <el-input v-model="form.deptName" placeholder="请输入部门名称" />
 | 
			
		||||
            <el-form-item label="运营商名称" label-width="90" prop="deptName">
 | 
			
		||||
              <el-input v-model="form.deptName" style="width: 67%;" placeholder="请输入运营商名称" />
 | 
			
		||||
            </el-form-item>
 | 
			
		||||
          </el-col>
 | 
			
		||||
          <el-col :span="12">
 | 
			
		||||
| 
						 | 
				
			
			@ -137,7 +137,7 @@
 | 
			
		|||
            </el-form-item>
 | 
			
		||||
          </el-col>
 | 
			
		||||
          <el-col :span="12">
 | 
			
		||||
            <el-form-item label="部门状态">
 | 
			
		||||
            <el-form-item label="状态">
 | 
			
		||||
              <el-radio-group v-model="form.status">
 | 
			
		||||
                <el-radio
 | 
			
		||||
                  v-for="dict in dict.type.sys_normal_disable"
 | 
			
		||||
| 
						 | 
				
			
			@ -148,6 +148,20 @@
 | 
			
		|||
            </el-form-item>
 | 
			
		||||
          </el-col>
 | 
			
		||||
        </el-row>
 | 
			
		||||
        <el-row>
 | 
			
		||||
          <el-col :span="24">
 | 
			
		||||
            <el-form-item label="绑定运营区" label-width="90">
 | 
			
		||||
              <el-select style="width: 85%" v-model="form.areaIds" multiple placeholder="请绑定运营区">
 | 
			
		||||
                <el-option
 | 
			
		||||
                  v-for="item in areaOptions"
 | 
			
		||||
                  :key="item.areaId"
 | 
			
		||||
                  :label="item.areaName"
 | 
			
		||||
                  :value="item.areaId"
 | 
			
		||||
                ></el-option>
 | 
			
		||||
              </el-select>
 | 
			
		||||
            </el-form-item>
 | 
			
		||||
          </el-col>
 | 
			
		||||
        </el-row>
 | 
			
		||||
      </el-form>
 | 
			
		||||
      <div slot="footer" class="dialog-footer">
 | 
			
		||||
        <el-button type="primary" @click="submitForm">确 定</el-button>
 | 
			
		||||
| 
						 | 
				
			
			@ -161,6 +175,7 @@
 | 
			
		|||
import { listDept, getDept, delDept, addDept, updateDept, listDeptExcludeChild } from "@/api/system/dept";
 | 
			
		||||
import Treeselect from "@riophae/vue-treeselect";
 | 
			
		||||
import "@riophae/vue-treeselect/dist/vue-treeselect.css";
 | 
			
		||||
import { listArea } from '../../../api/system/area'
 | 
			
		||||
 | 
			
		||||
export default {
 | 
			
		||||
  name: "Dept",
 | 
			
		||||
| 
						 | 
				
			
			@ -174,8 +189,10 @@ export default {
 | 
			
		|||
      showSearch: true,
 | 
			
		||||
      // 表格树数据
 | 
			
		||||
      deptList: [],
 | 
			
		||||
      // 部门树选项
 | 
			
		||||
      // 运营商树选项
 | 
			
		||||
      deptOptions: [],
 | 
			
		||||
      // 运营区选项
 | 
			
		||||
      areaOptions: [],
 | 
			
		||||
      // 弹出层标题
 | 
			
		||||
      title: "",
 | 
			
		||||
      // 是否显示弹出层
 | 
			
		||||
| 
						 | 
				
			
			@ -194,10 +211,10 @@ export default {
 | 
			
		|||
      // 表单校验
 | 
			
		||||
      rules: {
 | 
			
		||||
        parentId: [
 | 
			
		||||
          { required: true, message: "上级部门不能为空", trigger: "blur" }
 | 
			
		||||
          { required: true, message: "上级运营商不能为空", trigger: "blur" }
 | 
			
		||||
        ],
 | 
			
		||||
        deptName: [
 | 
			
		||||
          { required: true, message: "部门名称不能为空", trigger: "blur" }
 | 
			
		||||
          { required: true, message: "运营商名称不能为空", trigger: "blur" }
 | 
			
		||||
        ],
 | 
			
		||||
        orderNum: [
 | 
			
		||||
          { required: true, message: "显示排序不能为空", trigger: "blur" }
 | 
			
		||||
| 
						 | 
				
			
			@ -223,7 +240,7 @@ export default {
 | 
			
		|||
    this.getList();
 | 
			
		||||
  },
 | 
			
		||||
  methods: {
 | 
			
		||||
    /** 查询部门列表 */
 | 
			
		||||
    /** 查询运营商列表 */
 | 
			
		||||
    getList() {
 | 
			
		||||
      this.loading = true;
 | 
			
		||||
      listDept(this.queryParams).then(response => {
 | 
			
		||||
| 
						 | 
				
			
			@ -231,7 +248,7 @@ export default {
 | 
			
		|||
        this.loading = false;
 | 
			
		||||
      });
 | 
			
		||||
    },
 | 
			
		||||
    /** 转换部门数据结构 */
 | 
			
		||||
    /** 转换运营商数据结构 */
 | 
			
		||||
    normalizer(node) {
 | 
			
		||||
      if (node.children && !node.children.length) {
 | 
			
		||||
        delete node.children;
 | 
			
		||||
| 
						 | 
				
			
			@ -277,9 +294,12 @@ export default {
 | 
			
		|||
        this.form.parentId = row.deptId;
 | 
			
		||||
      }
 | 
			
		||||
      this.open = true;
 | 
			
		||||
      this.title = "添加部门";
 | 
			
		||||
      this.title = "添加运营商";
 | 
			
		||||
      listDept().then(response => {
 | 
			
		||||
        this.deptOptions = this.handleTree(response.data, "deptId");
 | 
			
		||||
        listArea().then(response => {
 | 
			
		||||
          this.areaOptions = response.rows;
 | 
			
		||||
        });
 | 
			
		||||
      });
 | 
			
		||||
    },
 | 
			
		||||
    /** 展开/折叠操作 */
 | 
			
		||||
| 
						 | 
				
			
			@ -295,8 +315,12 @@ export default {
 | 
			
		|||
      this.reset();
 | 
			
		||||
      getDept(row.deptId).then(response => {
 | 
			
		||||
        this.form = response.data;
 | 
			
		||||
        this.$set(this.form, "areaIds", response.areaIds);
 | 
			
		||||
        this.open = true;
 | 
			
		||||
        this.title = "修改部门";
 | 
			
		||||
        this.title = "修改运营商";
 | 
			
		||||
        listArea().then(response => {
 | 
			
		||||
          this.areaOptions = response.rows;
 | 
			
		||||
        });
 | 
			
		||||
        listDeptExcludeChild(row.deptId).then(response => {
 | 
			
		||||
          this.deptOptions = this.handleTree(response.data, "deptId");
 | 
			
		||||
          if (this.deptOptions.length == 0) {
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -1,12 +1,12 @@
 | 
			
		|||
<template>
 | 
			
		||||
  <div class="app-container">
 | 
			
		||||
    <el-row :gutter="20">
 | 
			
		||||
      <!--部门数据-->
 | 
			
		||||
      <!--运营商数据-->
 | 
			
		||||
      <el-col :span="4" :xs="24">
 | 
			
		||||
        <div class="head-container">
 | 
			
		||||
          <el-input
 | 
			
		||||
            v-model="deptName"
 | 
			
		||||
            placeholder="请输入部门名称"
 | 
			
		||||
            placeholder="请输入运营商名称"
 | 
			
		||||
            clearable
 | 
			
		||||
            size="small"
 | 
			
		||||
            prefix-icon="el-icon-search"
 | 
			
		||||
| 
						 | 
				
			
			@ -141,7 +141,7 @@
 | 
			
		|||
          <el-table-column label="用户编号" align="center" key="userId" prop="userId" v-if="columns[0].visible" />
 | 
			
		||||
          <el-table-column label="用户名称" align="center" key="userName" prop="userName" v-if="columns[1].visible" :show-overflow-tooltip="true" />
 | 
			
		||||
          <el-table-column label="用户昵称" align="center" key="nickName" prop="nickName" v-if="columns[2].visible" :show-overflow-tooltip="true" />
 | 
			
		||||
          <el-table-column label="部门" align="center" key="deptName" prop="dept.deptName" v-if="columns[3].visible" :show-overflow-tooltip="true" />
 | 
			
		||||
          <el-table-column label="运营商" align="center" key="deptName" prop="dept.deptName" v-if="columns[3].visible" :show-overflow-tooltip="true" />
 | 
			
		||||
          <el-table-column label="手机号码" align="center" key="phonenumber" prop="phonenumber" v-if="columns[4].visible" width="120" />
 | 
			
		||||
          <el-table-column label="状态" align="center" key="status" v-if="columns[5].visible">
 | 
			
		||||
            <template slot-scope="scope">
 | 
			
		||||
| 
						 | 
				
			
			@ -212,8 +212,8 @@
 | 
			
		|||
            </el-form-item>
 | 
			
		||||
          </el-col>
 | 
			
		||||
          <el-col :span="12">
 | 
			
		||||
            <el-form-item label="归属部门" prop="deptId">
 | 
			
		||||
              <treeselect v-model="form.deptId" :options="deptOptions" :show-count="true" placeholder="请选择归属部门" />
 | 
			
		||||
            <el-form-item label="归属运营商" prop="deptId">
 | 
			
		||||
              <treeselect v-model="form.deptId" :options="deptOptions" :show-count="true" placeholder="请选择归属运营商" />
 | 
			
		||||
            </el-form-item>
 | 
			
		||||
          </el-col>
 | 
			
		||||
        </el-row>
 | 
			
		||||
| 
						 | 
				
			
			@ -368,11 +368,11 @@ export default {
 | 
			
		|||
      userList: null,
 | 
			
		||||
      // 弹出层标题
 | 
			
		||||
      title: "",
 | 
			
		||||
      // 部门树选项
 | 
			
		||||
      // 运营商树选项
 | 
			
		||||
      deptOptions: undefined,
 | 
			
		||||
      // 是否显示弹出层
 | 
			
		||||
      open: false,
 | 
			
		||||
      // 部门名称
 | 
			
		||||
      // 运营商名称
 | 
			
		||||
      deptName: undefined,
 | 
			
		||||
      // 默认密码
 | 
			
		||||
      initPassword: undefined,
 | 
			
		||||
| 
						 | 
				
			
			@ -418,7 +418,7 @@ export default {
 | 
			
		|||
        { key: 0, label: `用户编号`, visible: true },
 | 
			
		||||
        { key: 1, label: `用户名称`, visible: true },
 | 
			
		||||
        { key: 2, label: `用户昵称`, visible: true },
 | 
			
		||||
        { key: 3, label: `部门`, visible: true },
 | 
			
		||||
        { key: 3, label: `运营商`, visible: true },
 | 
			
		||||
        { key: 4, label: `手机号码`, visible: true },
 | 
			
		||||
        { key: 5, label: `状态`, visible: true },
 | 
			
		||||
        { key: 6, label: `创建时间`, visible: true }
 | 
			
		||||
| 
						 | 
				
			
			@ -455,7 +455,7 @@ export default {
 | 
			
		|||
    };
 | 
			
		||||
  },
 | 
			
		||||
  watch: {
 | 
			
		||||
    // 根据名称筛选部门树
 | 
			
		||||
    // 根据名称筛选运营商树
 | 
			
		||||
    deptName(val) {
 | 
			
		||||
      this.$refs.tree.filter(val);
 | 
			
		||||
    }
 | 
			
		||||
| 
						 | 
				
			
			@ -478,7 +478,7 @@ export default {
 | 
			
		|||
        }
 | 
			
		||||
      );
 | 
			
		||||
    },
 | 
			
		||||
    /** 查询部门下拉树结构 */
 | 
			
		||||
    /** 查询运营商下拉树结构 */
 | 
			
		||||
    getDeptTree() {
 | 
			
		||||
      deptTreeSelect().then(response => {
 | 
			
		||||
        this.deptOptions = response.data;
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
		Reference in New Issue
	
	Block a user