فهرست منبع

update src/views/Sys/Deptall.vue.

Signed-off-by: 赵蒙蒙 <1595784580@qq.com>
赵蒙蒙 3 سال پیش
والد
کامیت
61dc98167a
1فایلهای تغییر یافته به همراه1078 افزوده شده و 901 حذف شده
  1. 1078 901
      src/views/Sys/Deptall.vue

+ 1078 - 901
src/views/Sys/Deptall.vue

@@ -1,939 +1,1116 @@
 <template>
-	<div class="container" style="width:99%;margin-top:0px;">
-
-		<!--布局容器-->
-		<el-container style="height: 100%;" direction="vertical">
-			<el-main ref="elMain" style="padding: 0px;">
-				<Split :gutterSize="2" @onDragEnd="onDragEnd" style="height: calc(100vh - 120px);">
-					<SplitArea :size="ztreeLeftWidth" :minSize="240">
-						<!-- 操作按钮 -->
-						<div class="u-f-ac" style="margin-bottom: 20px;margin-top: 10px;">
-							<!-- 新增子公司按钮 -->
-							<kt-button style="background-color: #52C578;border:#52C578;" icon="fa fa-plus" :label="$t('action.addCompany')"
-							 type="primary" perms="sys:dept:add" @click="handleAddCompany" />
-							<!-- 新增部门按钮 -->
-							<kt-button style="background-color: #FFC000;border:#FFC000;" icon="fa fa-plus" :label="$t('action.addDept')"
-							 type="primary" perms="sys:dept:add" @click="handleAddDept" />
-						</div>
-						<!-- 机构树 -->
-						<tree :setting="ztreeSetting" :nodes="ztreeNodes" @onClick="onClick" @onCheck="onCheck" @onCreated="handleCreated"
-						 @onRightClick="onZTreeRightClick" />
-					</SplitArea>
-					<SplitArea :size="ztreeRightWidth">
-						<kt-common-table permsEdit="sys:dept:edit" permsDelete="sys:dept:delete" :data="pageResult" :columns="columns"
-						 editButtonName="编辑" deleteButtonName="删除" :showBatchDelete="false" @findPage="findSubDeptPage" @handleEdit="handleEdit"
-						 @handleDeleteFlag="handleDeleteFlag">
-						</kt-common-table>
-					</SplitArea>
-				</Split>
-			</el-main>
-		</el-container>
-		<!-- 新增修改机构界面 -->
-		<el-dialog :title="dialogTitle" width="1000px" :visible.sync="dialogVisible" :close-on-click-modal="false"
-		 v-dialogDrag @close="closeDialog">
-			<el-form :model="dataForm" :rules="dataRule" ref="dataForm" @keyup.enter.native="submitForm()" label-width="100px"
-			 size="small" style="text-align:left;">
-				<el-row>
-					<el-col :span="8">
-						<el-form-item label="机构编码" prop="id">
-							<el-input style="width: 100%;" v-model="dataForm.id" placeholder="机构编码" :disabled="operType!='ADDC'"></el-input>
-						</el-form-item>
-					</el-col>
-					<el-col :span="8">
-						<el-form-item label="机构名称" prop="name">
-							<el-input style="width: 100%;" v-model="dataForm.name" placeholder="机构名称"></el-input>
-						</el-form-item>
-					</el-col>
-					<el-col :span="8">
-						<el-form-item label="上级机构" prop="parentName">
-							<span style="width: 100%;" v-if="currentTreeNode && (currentTreeNode.id == dataForm.parentId)" class="span-disabled">{{currentTreeNode.name}}</span>
-							<!-- <span v-if="currentTreeNode && (currentTreeNode.id == dataForm.parentId)" class="span-disabled" >{{currentTreeNode.name}}-{{currentTreeNode.id}}</span> -->
-							<span style="width: 100%;" v-else class="span-disabled">{{dataForm.parentId}}</span>
-						</el-form-item>
-					</el-col>
-				</el-row>
-				<el-row v-if="operType !== 'ADDC'">
-					<el-col :span="24">
-						<v-distpicker style="margin-bottom: 20px;" class="select-span" @province="selectProvince" @city="selectCity"
-						 @area="selectArea" :province="selectAddress.province" :city="selectAddress.city" :area="selectAddress.area"
-						 :provinceDisabled="disabledAddress.province" :cityDisabled="disabledAddress.city" :areaDisabled="disabledAddress.area"></v-distpicker>
-					</el-col>
-					<!-- <el-col :span="8" v-show="dataForm.comlevel==5">
+  <div class="container" style="width: 99%; margin-top: 0px">
+    <!--布局容器-->
+    <el-container style="height: 100%" direction="vertical">
+      <el-main ref="elMain" style="padding: 0px">
+        <Split
+          :gutterSize="2"
+          @onDragEnd="onDragEnd"
+          style="height: calc(100vh - 120px)"
+        >
+          <SplitArea :size="ztreeLeftWidth" :minSize="240">
+            <!-- 操作按钮 -->
+            <div class="u-f-ac" style="margin-bottom: 20px; margin-top: 10px">
+              <!-- 新增子公司按钮 -->
+              <kt-button
+                style="background-color: #52c578; border: #52c578"
+                icon="fa fa-plus"
+                :label="$t('action.addCompany')"
+                type="primary"
+                perms="sys:dept:add"
+                @click="handleAddCompany"
+              />
+              <!-- 新增部门按钮 -->
+              <kt-button
+                style="background-color: #ffc000; border: #ffc000"
+                icon="fa fa-plus"
+                :label="$t('action.addDept')"
+                type="primary"
+                perms="sys:dept:add"
+                @click="handleAddDept"
+              />
+            </div>
+            <!-- 机构树 -->
+            <tree
+              :setting="ztreeSetting"
+              :nodes="ztreeNodes"
+              @onClick="onClick"
+              @onCheck="onCheck"
+              @onCreated="handleCreated"
+              @onRightClick="onZTreeRightClick"
+            />
+          </SplitArea>
+          <SplitArea :size="ztreeRightWidth">
+            <kt-common-table
+              permsEdit="sys:dept:edit"
+              permsDelete="sys:dept:delete"
+              :data="pageResult"
+              :columns="columns"
+              editButtonName="编辑"
+              deleteButtonName="删除"
+              :showBatchDelete="false"
+              @findPage="findSubDeptPage"
+              @handleEdit="handleEdit"
+              @handleDeleteFlag="handleDeleteFlag"
+            >
+            </kt-common-table>
+          </SplitArea>
+        </Split>
+      </el-main>
+    </el-container>
+    <!-- 新增修改机构界面 -->
+    <el-dialog
+      :title="dialogTitle"
+      width="1000px"
+      :visible.sync="dialogVisible"
+      :close-on-click-modal="false"
+      v-dialogDrag
+      @close="closeDialog"
+    >
+      <el-form
+        :model="dataForm"
+        :rules="dataRule"
+        ref="dataForm"
+        @keyup.enter.native="submitForm()"
+        label-width="100px"
+        size="small"
+        style="text-align: left"
+      >
+        <el-row>
+          <el-col :span="8">
+            <el-form-item label="机构编码" prop="id">
+              <el-input
+                style="width: 100%"
+                v-model="dataForm.id"
+                placeholder="机构编码"
+                :disabled="operType != 'ADDC'"
+              ></el-input>
+            </el-form-item>
+          </el-col>
+          <el-col :span="8">
+            <el-form-item label="机构名称" prop="name">
+              <el-input
+                style="width: 100%"
+                v-model="dataForm.name"
+                placeholder="机构名称"
+              ></el-input>
+            </el-form-item>
+          </el-col>
+          <el-col :span="8">
+            <el-form-item label="上级机构" prop="parentName">
+              <span
+                style="width: 100%"
+                v-if="
+                  currentTreeNode && currentTreeNode.id == dataForm.parentId
+                "
+                class="span-disabled"
+                >{{ currentTreeNode.name }}</span
+              >
+              <!-- <span v-if="currentTreeNode && (currentTreeNode.id == dataForm.parentId)" class="span-disabled" >{{currentTreeNode.name}}-{{currentTreeNode.id}}</span> -->
+              <span style="width: 100%" v-else class="span-disabled">{{
+                dataForm.parentId
+              }}</span>
+            </el-form-item>
+          </el-col>
+        </el-row>
+        <el-row v-if="operType !== 'ADDC'">
+          <el-col :span="24">
+            <v-distpicker
+              style="margin-bottom: 20px"
+              class="select-span"
+              @province="selectProvince"
+              @city="selectCity"
+              @area="selectArea"
+              :province="selectAddress.province"
+              :city="selectAddress.city"
+              :area="selectAddress.area"
+              :provinceDisabled="disabledAddress.province"
+              :cityDisabled="disabledAddress.city"
+              :areaDisabled="disabledAddress.area"
+            ></v-distpicker>
+          </el-col>
+          <!-- <el-col :span="8" v-show="dataForm.comlevel==5">
             <el-form-item label="门店" prop="house">
               <el-input placeholder="门店" v-model="dataForm.house"></el-input>
             </el-form-item>
           </el-col> -->
-				</el-row>
-				<el-row v-show="dataForm.comlevel==5">
-					<el-col :span="8">
-						<el-form-item label="门店" prop="house">
-							<el-input style="width: 100%;" placeholder="门店" v-model="dataForm.house"></el-input>
-						</el-form-item>
-					</el-col>
-				</el-row>
-				<el-row>
-					<el-col :span="8">
-						<el-form-item label="机构类型" prop="comtype">
-							<el-select style="width: 100%;" v-model="dataForm.comtype" placeholder="请选择">
-								<el-option v-for="item in comtypeoptions" :key="item.label" :label="item.label" :value="item.value"></el-option>
-							</el-select>
-						</el-form-item>
-					</el-col>
-
-					<el-col :span="8">
-						<el-form-item label="机构级别" prop="comlevel">
-							<el-select style="width: 100%;" disabled v-model="dataForm.comlevel" placeholder="请选择">
-								<el-option v-for="item in comleveloptions" :key="item.label" :label="item.label" :value="item.value"></el-option>
-							</el-select>
-						</el-form-item>
-					</el-col>
-					<el-col :span="8">
-						<el-form-item label="机构性质" prop="comattribute">
-							<el-select style="width: 100%;" v-model="dataForm.comattribute" placeholder="请选择">
-								<el-option v-for="item in comattributeoptions" :key="item.label" :label="item.label" :value="item.value"></el-option>
-							</el-select>
-						</el-form-item>
-					</el-col>
-				</el-row>
-				<el-row>
-					<el-col :span="16">
-						<el-form-item label="机构地址" prop="address">
-							<el-input v-model="dataForm.address" placeholder="机构地址"></el-input>
-						</el-form-item>
-					</el-col>
-					<el-col :span="8">
-						<el-form-item label="排序" prop="orderNum">
-							<el-input-number v-model="dataForm.orderNum" placeholder="排序" controls-position="right" :min="0"></el-input-number>
-						</el-form-item>
-					</el-col>
-				</el-row>
-				<el-row>
+        </el-row>
+        <el-row v-show="dataForm.comlevel == 5">
+          <el-col :span="8">
+            <el-form-item label="门店" prop="house">
+              <el-input
+                style="width: 100%"
+                placeholder="门店"
+                v-model="dataForm.house"
+              ></el-input>
+            </el-form-item>
+          </el-col>
+        </el-row>
+        <el-row>
+          <el-col :span="8">
+            <el-form-item label="机构类型" prop="comtype">
+              <el-select
+                style="width: 100%"
+                v-model="dataForm.comtype"
+                placeholder="请选择"
+              >
+                <el-option
+                  v-for="item in comtypeoptions"
+                  :key="item.label"
+                  :label="item.label"
+                  :value="item.value"
+                ></el-option>
+              </el-select>
+            </el-form-item>
+          </el-col>
 
-				</el-row>
-			</el-form>
-			<span slot="footer" class="dialog-footer">
-				<!-- <el-button :size="size" @click="showmessage">看点信息</el-button> -->
-				<el-button size="small" @click="clearDialog" type="primary" style="background-color: #DE504C;border: 1px solid #DE504C;">重置</el-button>
-				<el-button size="small" type="primary" style="background-color: #FFC000;border: 1px solid #FFC000;" @click="closeDialog">{{$t('action.cancel')}}</el-button>
-				<el-button size="small" type="primary" @click="submitForm()">{{$t('action.comfirm')}}</el-button>
-			</span>
-		</el-dialog>
+          <el-col :span="8">
+            <el-form-item label="机构级别" prop="comlevel">
+              <el-select
+                style="width: 100%"
+                disabled
+                v-model="dataForm.comlevel"
+                placeholder="请选择"
+              >
+                <el-option
+                  v-for="item in comleveloptions"
+                  :key="item.label"
+                  :label="item.label"
+                  :value="item.value"
+                ></el-option>
+              </el-select>
+            </el-form-item>
+          </el-col>
+          <el-col :span="8">
+            <el-form-item label="机构性质" prop="comattribute">
+              <el-select
+                style="width: 100%"
+                v-model="dataForm.comattribute"
+                placeholder="请选择"
+              >
+                <el-option
+                  v-for="item in comattributeoptions"
+                  :key="item.label"
+                  :label="item.label"
+                  :value="item.value"
+                ></el-option>
+              </el-select>
+            </el-form-item>
+          </el-col>
+        </el-row>
+        <el-row>
+          <el-col :span="16">
+            <el-form-item label="机构地址" prop="address">
+              <el-input
+                v-model="dataForm.address"
+                placeholder="机构地址"
+              ></el-input>
+            </el-form-item>
+          </el-col>
+          <el-col :span="8">
+            <el-form-item label="排序" prop="orderNum">
+              <el-input-number
+                v-model="dataForm.orderNum"
+                placeholder="排序"
+                controls-position="right"
+                :min="0"
+              ></el-input-number>
+            </el-form-item>
+          </el-col>
+        </el-row>
+        <el-row> </el-row>
+      </el-form>
+      <span slot="footer" class="dialog-footer">
+        <!-- <el-button :size="size" @click="showmessage">看点信息</el-button> -->
+        <el-button
+          size="small"
+          @click="clearDialog"
+          type="primary"
+          style="background-color: #de504c; border: 1px solid #de504c"
+          >重置</el-button
+        >
+        <el-button
+          size="small"
+          type="primary"
+          style="background-color: #ffc000; border: 1px solid #ffc000"
+          @click="closeDialog"
+          >{{ $t("action.cancel") }}</el-button
+        >
+        <el-button size="small" type="primary" @click="submitForm()">{{
+          $t("action.comfirm")
+        }}</el-button>
+      </span>
+    </el-dialog>
 
-		<!-- 新增修改界面 -->
-		<el-dialog :title="dialogTitle" width="1000px" :visible.sync="deptDialogVisible" :close-on-click-modal="false"
-		 v-dialogDrag @close="closeDeptDialog">
-			<el-form :model="deptDataForm" :rules="deptDataRule" ref="deptDataForm" @keyup.enter.native="deptSubmitForm()"
-			 label-width="100px" size="small" style="text-align:left;">
-				<el-row>
-					<el-col :span="8">
-						<el-form-item label="所属机构" prop="id">
-							<span style="width: 100%;" v-if="currentTreeNode && (currentTreeNode.id == deptDataForm.parentId)" class="span-disabled">{{currentTreeNode.name}}-{{currentTreeNode.id}}</span>
-							<span style="width: 100%;" v-else class="span-disabled">{{deptDataForm.id}}</span>
-						</el-form-item>
-					</el-col>
-					<el-col :span="8">
-						<el-form-item label="部门编号" prop="id">
-							<el-input style="width: 100%;" v-model="deptDataForm.id" placeholder="部门编号" disabled></el-input>
-						</el-form-item>
-					</el-col>
-					<el-col :span="8">
-						<el-form-item label="部门名称" prop="name">
-							<el-input style="width: 100%;" v-model="deptDataForm.name" placeholder="部门名称"></el-input>
-						</el-form-item>
-					</el-col>
-				</el-row>
-				<el-row>
-					<el-col :span="12">
-						<el-form-item label="排序" prop="orderNum">
-							<el-input-number v-model="deptDataForm.orderNum" placeholder="排序" controls-position="right" :min="0"></el-input-number>
-						</el-form-item>
-					</el-col>
-				</el-row>
-			</el-form>
-			<span slot="footer" class="dialog-footer">
-				<el-button size="small" @click="closeDeptDialog">{{$t('action.cancel')}}</el-button>
-				<el-button size="small" type="primary" @click="deptSubmitForm()">{{$t('action.comfirm')}}</el-button>
-			</span>
-		</el-dialog>
-	</div>
+    <!-- 新增修改界面 -->
+    <el-dialog
+      :title="dialogTitle"
+      width="1000px"
+      :visible.sync="deptDialogVisible"
+      :close-on-click-modal="false"
+      v-dialogDrag
+      @close="closeDeptDialog"
+    >
+      <el-form
+        :model="deptDataForm"
+        :rules="deptDataRule"
+        ref="deptDataForm"
+        @keyup.enter.native="deptSubmitForm()"
+        label-width="100px"
+        size="small"
+        style="text-align: left"
+      >
+        <el-row>
+          <el-col :span="8">
+            <el-form-item label="所属机构" prop="id">
+              <span
+                style="width: 100%"
+                v-if="
+                  currentTreeNode && currentTreeNode.id == deptDataForm.parentId
+                "
+                class="span-disabled"
+                >{{ currentTreeNode.name }}-{{ currentTreeNode.id }}</span
+              >
+              <span style="width: 100%" v-else class="span-disabled">{{
+                deptDataForm.id
+              }}</span>
+            </el-form-item>
+          </el-col>
+          <el-col :span="8">
+            <el-form-item label="部门编号" prop="id">
+              <el-input
+                style="width: 100%"
+                v-model="deptDataForm.id"
+                placeholder="部门编号"
+                disabled
+              ></el-input>
+            </el-form-item>
+          </el-col>
+          <el-col :span="8">
+            <el-form-item label="部门名称" prop="name">
+              <el-input
+                style="width: 100%"
+                v-model="deptDataForm.name"
+                placeholder="部门名称"
+              ></el-input>
+            </el-form-item>
+          </el-col>
+        </el-row>
+        <el-row>
+          <el-col :span="12">
+            <el-form-item label="排序" prop="orderNum">
+              <el-input-number
+                v-model="deptDataForm.orderNum"
+                placeholder="排序"
+                controls-position="right"
+                :min="0"
+              ></el-input-number>
+            </el-form-item>
+          </el-col>
+        </el-row>
+      </el-form>
+      <span slot="footer" class="dialog-footer">
+        <el-button size="small" @click="closeDeptDialog">{{
+          $t("action.cancel")
+        }}</el-button>
+        <el-button size="small" type="primary" @click="deptSubmitForm()">{{
+          $t("action.comfirm")
+        }}</el-button>
+      </span>
+    </el-dialog>
+  </div>
 </template>
 <script>
-	import Cookies from "js-cookie"
-	import KtButton from "@/views/Core/KtButton"; //按钮权限组件
-	import tree from "@/components/ztree.vue"; //机构树组件
-	import KtCommonTable from "@/views/Core/KtCommonTable.vue"; //表格组件
-	import VDistpicker from "@/components/VDistpicker"; //区域下拉
-	import CommonUtil from "@/utils/comutil.js"
-	export default {
-		name: "Deptall",
-		components: {
-			KtButton,
-			tree,
-			KtCommonTable,
-			VDistpicker
-		},
-		created() {
-			this.peopleid = Cookies.get('user');
-			if (this.peopleid != 'admin') {
-				this.peopledeptid = Cookies.get('user').split('D')[0];
-				
-			} else {
-				this.peopledeptid = '9';
-			}
-
-			this.findLeftTreeData(); // 获取左边机构树数据
-			//获取所有下拉框数据
-			this.getDictItems("comlevel");
-			this.getDictItems("comattribute");
-			this.getDictItems("comtype");
-		},
-		mounted() {
-			this.changeTreeWidth(); // 初始化树的宽度
-			this.filters.id = '9';
-			this.findSubDeptPage(); //初始化数据
-		},
-		data() {
-			return {
-				peopleid: "",
-				peopledeptid: "",
-
-				filters: {
-					id: ""
-				},
-				columns: [{
-						prop: "id",
-						label: "ID",
-						minWidth: 80
-					},
-					{
-						prop: "name",
-						label: "机构名称",
-						minWidth: 160
-					},
-					{
-						prop: "comlevel",
-						label: "机构级别",
-						minWidth: 100,
-						formatter: this.comlevelFormatter
-					},
-					{
-						prop: "comattribute",
-						label: "机构性质",
-						minWidth: 100,
-						formatter: this.comattributeFormatter
-					},
-					{
-						prop: "comtype",
-						label: "机构类型",
-						minWidth: 100,
-						formatter: this.comtypeFormatter
-					},
-					{
-						prop: "address",
-						label: "机构地址",
-						minWidth: 200
-					}
-				],
-				pageRequest: {
-					pageNum: 1,
-					pageSize: 10
-				},
-				pageResult: {},
-
-				//----ztreeData start---------
-				ztreeLeftWidth: 0, //左边区域的宽度
-				ztreeRightWidth: 0, //右边区域的宽度
-				ztreeObj: null,
-				ztreeSetting: { // 机构树上的数据格式
-					check: {
-						enable: false
-					},
-					data: {
-						simpleData: {
-							enable: true,
-							pIdKey: "parentId"
-						}
-					},
-					view: {
-						showIcon: false,
-						//addHoverDom: this.addHoverDom,
-						//removeHoverDom: this.removeHoverDom
-					}
-				},
-				ztreeNodes: [], // 机构树上的数据
-				currentTreeNode: null,
-				//----ztreeData end---------
+import Cookies from "js-cookie";
+import KtButton from "@/views/Core/KtButton"; //按钮权限组件
+import tree from "@/components/ztree.vue"; //机构树组件
+import KtCommonTable from "@/views/Core/KtCommonTable.vue"; //表格组件
+import VDistpicker from "@/components/VDistpicker"; //区域下拉
+import CommonUtil from "@/utils/comutil.js";
+export default {
+  name: "Deptall",
+  components: {
+    KtButton,
+    tree,
+    KtCommonTable,
+    VDistpicker,
+  },
+  created() {
+    this.peopleid = Cookies.get("user");
+    if (this.peopleid != "admin") {
+      this.peopledeptid = Cookies.get("user").split("D")[0];
+    } else {
+      this.peopledeptid = "9";
+    }
 
-				//------------下拉框数据   begin-----------------
-				comleveloptions: [],
-				comattributeoptions: [],
-				comtypeoptions: [],
-				//------------下拉框数据   end-----------------
+    this.findLeftTreeData(); // 获取左边机构树数据
+    //获取所有下拉框数据
+    this.getDictItems("comlevel");
+    this.getDictItems("comattribute");
+    this.getDictItems("comtype");
+  },
+  mounted() {
+    this.changeTreeWidth(); // 初始化树的宽度
+    this.filters.id = "9";
+    this.findSubDeptPage(); //初始化数据
+  },
+  data() {
+    return {
+      peopleid: "",
+      peopledeptid: "",
 
-				//---dialog begin ----
-				operType: "ADD", //'ADD','EDIT'
-				dialogTitle: "窗口",
-				dialogVisible: false,
-				dataForm: {
-					id: "",
-					name: "",
-					parentId: 0,
-					comlevel: "", //机构级别
-					comtype: "", //机构类型
-					comattribute: "", //机构性质
-					address: "", //机构地址
-					province: "", //省
-					city: "", //市
-					area: "", //区县
-					house: "", //门店
-					deptType: "", //机构类型:用来区分是子公司还是部门啥的,现有:子公司C,门店M,部门D
-					orderNum: 0
-				},
-				dataRule: {
-					name: [{
-						required: true,
-						message: "机构名称不能为空",
-						trigger: "blur"
-					}],
-					comtype: [{
-						required: true,
-						message: "请选择机构类型",
-						trigger: "blur"
-					}],
-					comattribute: [{
-						required: true,
-						message: "请选择机构性质",
-						trigger: "blur"
-					}],
-					address: [{
-						required: true,
-						message: "请填写机构地址",
-						trigger: "blur"
-					}],
-					comlevel: [{
-						required: true,
-						message: "请选择机构级别",
-						trigger: "blur"
-					}]
-				},
-				//-- address begin ---
-				selectAddress: {
-					province: "",
-					city: "",
-					area: ""
-				},
-				disabledAddress: {
-					province: false,
-					city: false,
-					area: false
-				},
-				//-- address end ---
-				//---dialog end ----
+      filters: {
+        id: "",
+      },
+      columns: [
+        {
+          prop: "id",
+          label: "ID",
+          minWidth: 80,
+        },
+        {
+          prop: "name",
+          label: "机构名称",
+          minWidth: 160,
+        },
+        {
+          prop: "comlevel",
+          label: "机构级别",
+          minWidth: 100,
+          formatter: this.comlevelFormatter,
+        },
+        {
+          prop: "comattribute",
+          label: "机构性质",
+          minWidth: 100,
+          formatter: this.comattributeFormatter,
+        },
+        {
+          prop: "comtype",
+          label: "机构类型",
+          minWidth: 100,
+          formatter: this.comtypeFormatter,
+        },
+        {
+          prop: "address",
+          label: "机构地址",
+          minWidth: 200,
+        },
+      ],
+      pageRequest: {
+        pageNum: 1,
+        pageSize: 10,
+      },
+      pageResult: {},
 
-				// 部门DialogStart
-				deptDialogVisible: false,
-				deptDataForm: {
-					id: "",
-					name: "",
-					parentId: "",
-					deptType: "D",
-					orderNum: 0
-				},
-				deptDataRule: {
-					name: [{
-						required: true,
-						message: "部门名称不能为空",
-						trigger: "blur"
-					}]
-				},
-				// 部门DialogEnd
+      //----ztreeData start---------
+      ztreeLeftWidth: 0, //左边区域的宽度
+      ztreeRightWidth: 0, //右边区域的宽度
+      ztreeObj: null,
+      ztreeSetting: {
+        // 机构树上的数据格式
+        check: {
+          enable: false,
+        },
+        data: {
+          simpleData: {
+            enable: true,
+            pIdKey: "parentId",
+          },
+        },
+        view: {
+          showIcon: false,
+          //addHoverDom: this.addHoverDom,
+          //removeHoverDom: this.removeHoverDom
+        },
+      },
+      ztreeNodes: [], // 机构树上的数据
+      currentTreeNode: null,
+      //----ztreeData end---------
 
-			}
-		},
-		methods: {
+      //------------下拉框数据   begin-----------------
+      comleveloptions: [],
+      comattributeoptions: [],
+      comtypeoptions: [],
+      //------------下拉框数据   end-----------------
 
-			//--数据字典 begin --
-			getDictItems(typeName) {
-				this.$api.dict.findByLableName(typeName).then((response) => {
-					this[typeName + "options"] = response.data; // 把获取到的数据赋给this.data
-				}).catch((error) => {
-					this[typeName + "options"] = [];
-				})
-			},
-			// 拖动框架方法Start(拖动结束后)
-			onDragEnd(size) {
-				// console.log("onDragEnd", size);
-			},
-			// 拖动框架方法End
+      //---dialog begin ----
+      operType: "ADD", //'ADD','EDIT'
+      dialogTitle: "窗口",
+      dialogVisible: false,
+      dataForm: {
+        id: "",
+        name: "",
+        parentId: 0,
+        comlevel: "", //机构级别
+        comtype: "", //机构类型
+        comattribute: "", //机构性质
+        address: "", //机构地址
+        province: "", //省
+        city: "", //市
+        area: "", //区县
+        house: "", //门店
+        deptType: "", //机构类型:用来区分是子公司还是部门啥的,现有:子公司C,门店M,部门D
+        orderNum: 0,
+      },
+      dataRule: {
+        name: [
+          {
+            required: true,
+            message: "机构名称不能为空",
+            trigger: "blur",
+          },
+        ],
+        comtype: [
+          {
+            required: true,
+            message: "请选择机构类型",
+            trigger: "blur",
+          },
+        ],
+        comattribute: [
+          {
+            required: true,
+            message: "请选择机构性质",
+            trigger: "blur",
+          },
+        ],
+        address: [
+          {
+            required: true,
+            message: "请填写机构地址",
+            trigger: "blur",
+          },
+        ],
+        comlevel: [
+          {
+            required: true,
+            message: "请选择机构级别",
+            trigger: "blur",
+          },
+        ],
+      },
+      //-- address begin ---
+      selectAddress: {
+        province: "",
+        city: "",
+        area: "",
+      },
+      disabledAddress: {
+        province: false,
+        city: false,
+        area: false,
+      },
+      //-- address end ---
+      //---dialog end ----
 
-			// 右边按钮方法
-			handleAddCompany() {
-				//增加子公司
-				let that = this;
-				if (this.currentTreeNode.id.indexOf('D') >= 0) {
-					return this.$message({
-						message: "请在机构下增设子机构",
-						type: "info"
-					});
-				}
-				this.operType = "ADD";
-				this.dialogTitle = "新增机构";
-				if (!this.currentTreeNode) {
-					return this.$message({
-						message: "请选择上级机构",
-						type: "info"
-					});
-				}
-				this.disabledAddress = {
-					province: false,
-					city: false,
-					area: false
-				};
+      // 部门DialogStart
+      deptDialogVisible: false,
+      deptDataForm: {
+        id: "",
+        name: "",
+        parentId: "",
+        deptType: "D",
+        orderNum: 0,
+      },
+      deptDataRule: {
+        name: [
+          {
+            required: true,
+            message: "部门名称不能为空",
+            trigger: "blur",
+          },
+        ],
+      },
+      // 部门DialogEnd
+    };
+  },
+  methods: {
+    //--数据字典 begin --
+    getDictItems(typeName) {
+      this.$api.dict
+        .findByLableName(typeName)
+        .then((response) => {
+          this[typeName + "options"] = response.data; // 把获取到的数据赋给this.data
+        })
+        .catch((error) => {
+          this[typeName + "options"] = [];
+        });
+    },
+    // 拖动框架方法Start(拖动结束后)
+    onDragEnd(size) {
+      // console.log("onDragEnd", size);
+    },
+    // 拖动框架方法End
 
-				if (this.currentTreeNode.comlevel === 0) {
-					this.disabledAddress.city = true;
-					this.disabledAddress.area = true;
-					this.selectAddress.province = "";
-					this.dataForm.province = "";
-					this.selectAddress.city = "";
-					this.dataForm.city = "";
-					this.selectAddress.area = "";
-					this.dataForm.area = "";
-				} else {
-					if (!!this.currentTreeNode.province) {
-						this.selectAddress.province = this.currentTreeNode.province;
-						this.dataForm.province = this.currentTreeNode.province;
-						this.dataForm.id = "";
-					}
-					if (!!this.currentTreeNode.city) {
-						this.selectAddress.city = this.currentTreeNode.city;
-						this.dataForm.city = this.currentTreeNode.city;
-						this.dataForm.id = "";
-					}
-					if (!!this.currentTreeNode.area) {
-						this.selectAddress.area = this.currentTreeNode.area;
-						this.dataForm.area = this.currentTreeNode.area;
-						this.dataForm.id = "";
-					}
-				}
-				if (this.currentTreeNode.comlevel === 1) {
-					this.disabledAddress.city = true;
-					this.disabledAddress.area = true;
-				}
-				if (this.currentTreeNode.comlevel === 2) {
-					this.disabledAddress.province = true;
-					this.disabledAddress.area = true;
-				}
-				if (this.currentTreeNode.comlevel === 3) {
-					this.disabledAddress.province = true;
-					this.disabledAddress.city = true;
-				}
-				if (this.currentTreeNode.comlevel > 3) {
-					this.disabledAddress.province = true;
-					this.disabledAddress.city = true;
-					this.disabledAddress.area = true;
-				}
-				if (this.currentTreeNode.comlevel >= 5) {
-					return this.$message({
-						message: "门店下不可增设下级子公司",
-						type: "info"
-					});
-				}
+    // 右边按钮方法
+    handleAddCompany() {
+      //增加子公司
+      let that = this;
+      if (this.currentTreeNode.id.indexOf("D") >= 0) {
+        return this.$message({
+          message: "请在机构下增设子机构",
+          type: "info",
+        });
+      }
+      this.operType = "ADD";
+      this.dialogTitle = "新增机构";
+      if (!this.currentTreeNode) {
+        return this.$message({
+          message: "请选择上级机构",
+          type: "info",
+        });
+      }
+      this.disabledAddress = {
+        province: false,
+        city: false,
+        area: false,
+      };
 
-				this.dataForm.deptType = "C"; //类型是机构(C是机构,D是部门)
+      if (this.currentTreeNode.comlevel === 0) {
+        this.disabledAddress.city = true;
+        this.disabledAddress.area = true;
+        this.selectAddress.province = "";
+        this.dataForm.province = "";
+        this.selectAddress.city = "";
+        this.dataForm.city = "";
+        this.selectAddress.area = "";
+        this.dataForm.area = "";
+      } else {
+        if (!!this.currentTreeNode.province) {
+          this.selectAddress.province = this.currentTreeNode.province;
+          this.dataForm.province = this.currentTreeNode.province;
+          this.dataForm.id = "";
+        }
+        if (!!this.currentTreeNode.city) {
+          this.selectAddress.city = this.currentTreeNode.city;
+          this.dataForm.city = this.currentTreeNode.city;
+          this.dataForm.id = "";
+        }
+        if (!!this.currentTreeNode.area) {
+          this.selectAddress.area = this.currentTreeNode.area;
+          this.dataForm.area = this.currentTreeNode.area;
+          this.dataForm.id = "";
+        }
+      }
+      if (this.currentTreeNode.comlevel === 1) {
+        this.disabledAddress.city = true;
+        this.disabledAddress.area = true;
+      }
+      if (this.currentTreeNode.comlevel === 2) {
+        this.disabledAddress.province = true;
+        this.disabledAddress.area = true;
+      }
+      if (this.currentTreeNode.comlevel === 3) {
+        this.disabledAddress.province = true;
+        this.disabledAddress.city = true;
+      }
+      if (this.currentTreeNode.comlevel > 3) {
+        this.disabledAddress.province = true;
+        this.disabledAddress.city = true;
+        this.disabledAddress.area = true;
+      }
+      if (this.currentTreeNode.comlevel >= 5) {
+        return this.$message({
+          message: "门店下不可增设下级子公司",
+          type: "info",
+        });
+      }
 
-				// 初始化数据
-				this.dataForm.parentId = this.currentTreeNode.id;
+      this.dataForm.deptType = "C"; //类型是机构(C是机构,D是部门)
 
-				console.log(this.dataForm.id)
-				console.log(this.dataForm)
+      // 初始化数据
+      this.dataForm.parentId = this.currentTreeNode.id;
 
-				this.dataForm.comlevel = "" + ((this.currentTreeNode.comlevel - 0) + 1);
+      console.log(this.dataForm.id);
+      console.log(this.dataForm);
 
-				if (this.currentTreeNode.id === '9') {
-					this.disabledAddress.province = true;
-					this.disabledAddress.city = true;
-					this.disabledAddress.area = true;
-					this.selectAddress.province = "";
-					this.dataForm.province = "";
-					this.selectAddress.city = "";
-					this.dataForm.city = "";
-					this.selectAddress.area = "";
-					this.dataForm.area = "";
-					this.dataForm.deptType = "C";
-					this.dataForm.comlevel = '1'
-					this.dialogVisible = true;
-					this.operType = "ADDC";
-					this.dataForm.id = this.currentTreeNode.id
-					return;
-				}
+      this.dataForm.comlevel = "" + (this.currentTreeNode.comlevel - 0 + 1);
 
-				if (this.dataForm.comlevel === "5") {
-					//第5级是门店,去服务器获取最大编号
-					this.$api.dept.findMaxHouseId(this.currentTreeNode.id).then(res => {
-						let newId = parseInt(res.data) + 1;
-						if (newId < 10) {
-							newId = "0" + newId;
-						}
-						this.dataForm.id = this.currentTreeNode.id + "M" + newId;
-						this.dialogVisible = true;
-					});
-				} else {
-					this.dialogVisible = true;
-				}
-			},
-			handleAddDept() {
-				//增加部门
-				if (!this.currentTreeNode) {
-					return this.$message({
-						message: "请选择所属机构",
-						type: "info"
-					});
-				}
-				if (this.currentTreeNode.id.indexOf('D') >= 0) {
-					return this.$message({
-						message: "部门下无法增设部门",
-						type: "info"
-					});
-				}
-				console.log("增加部门")
-				this.operType = "ADD";
-				this.dialogTitle = "新增部门";
-				this.deptDataForm.deptType = "D"; //类型是机构(C是机构,D是部门)
-				this.deptDataForm.parentId = this.currentTreeNode.id;
-				this.$api.dept.findMaxDeptId(this.currentTreeNode.id).then(res => {
-					console.log(res.data);
-					let newId = parseInt(res.data) + 1;
-					if (newId < 10) {
-						newId = "0" + newId;
-					}
-					this.deptDataForm.id = this.currentTreeNode.id + "D" + newId;
+      if (this.currentTreeNode.id === "9") {
+        this.disabledAddress.province = true;
+        this.disabledAddress.city = true;
+        this.disabledAddress.area = true;
+        this.selectAddress.province = "";
+        this.dataForm.province = "";
+        this.selectAddress.city = "";
+        this.dataForm.city = "";
+        this.selectAddress.area = "";
+        this.dataForm.area = "";
+        this.dataForm.deptType = "C";
+        this.dataForm.comlevel = "1";
+        this.dialogVisible = true;
+        this.operType = "ADDC";
+        this.dataForm.id = this.currentTreeNode.id;
+        return;
+      }
 
-					this.deptDialogVisible = true;
-				});
-			},
+      if (this.dataForm.comlevel === "5") {
+        //第5级是门店,去服务器获取最大编号
+        this.$api.dept.findMaxHouseId(this.currentTreeNode.id).then((res) => {
+          let newId = parseInt(res.data) + 1;
+          if (newId < 10) {
+            newId = "0" + newId;
+          }
+          this.dataForm.id = this.currentTreeNode.id + "M" + newId;
+          this.dialogVisible = true;
+        });
+      } else {
+        this.dialogVisible = true;
+      }
+    },
+    handleAddDept() {
+      //增加部门
+      if (!this.currentTreeNode) {
+        return this.$message({
+          message: "请选择所属机构",
+          type: "info",
+        });
+      }
+      if (this.currentTreeNode.id.indexOf("D") >= 0) {
+        return this.$message({
+          message: "部门下无法增设部门",
+          type: "info",
+        });
+      }
+      console.log("增加部门");
+      this.operType = "ADD";
+      this.dialogTitle = "新增部门";
+      this.deptDataForm.deptType = "D"; //类型是机构(C是机构,D是部门)
+      this.deptDataForm.parentId = this.currentTreeNode.id;
+      this.$api.dept.findMaxDeptId(this.currentTreeNode.id).then((res) => {
+        console.log(res.data);
+        let newId = parseInt(res.data) + 1;
+        if (newId < 10) {
+          newId = "0" + newId;
+        }
+        this.deptDataForm.id = this.currentTreeNode.id + "D" + newId;
 
-			// ztreeStart
-			changeTreeWidth() {
-				// 初始化树的宽度
-				this.ztreeLeftWidth = Math.ceil(240 / this.$refs.elMain.$el.clientWidth * 100);
-				this.ztreeRightWidth = 100 - (this.ztreeLeftWidth - 0)
-			},
-			findLeftTreeData() {
-				// 获取机构树的数据
-				//this.loading = true;
-				this.$api.dept.findLeftDeptTree(this.peopledeptid).then(res => {
-					console.log(res)
-					this.ztreeNodes = res.data;
-					//this.loading = false;
-				});
-			},
-			onClick(evt, treeId, treeNode) {
-				// 点击事件
-				this.currentTreeNode = treeNode;
-				this.filters.id = this.currentTreeNode.id;
-				this.findSubDeptPage();
-			},
-			onCheck(evt, treeId, treeNode) {
-				// 选中事件
-				// console.log(evt.type, treeNode);
-			},
-			handleCreated(ztreeObj) {
-				this.ztreeObj = ztreeObj;
-				console.log(this.ztreeOb)
-				// onCreated 中操作ztreeObj对象展开第一个节点
-				ztreeObj.expandNode(ztreeObj.getNodes()[0], true);
-				this.currentTreeNode = ztreeObj.getNodes()[0];
-			},
-			onZTreeRightClick: function() {
-				//alert("haha onZTreeRightClick");
-			},
-			// ztreeEnd
+        this.deptDialogVisible = true;
+      });
+    },
 
+    // ztreeStart
+    changeTreeWidth() {
+      // 初始化树的宽度
+      this.ztreeLeftWidth = Math.ceil(
+        (240 / this.$refs.elMain.$el.clientWidth) * 100
+      );
+      this.ztreeRightWidth = 100 - (this.ztreeLeftWidth - 0);
+    },
+    findLeftTreeData() {
+      // 获取机构树的数据
+      //this.loading = true;
+      this.$api.dept.findLeftDeptTree(this.peopledeptid).then((res) => {
+        console.log(res);
+        this.ztreeNodes = res.data;
+        //this.loading = false;
+      });
+    },
+    onClick(evt, treeId, treeNode) {
+      // 点击事件
+      this.currentTreeNode = treeNode;
+      this.filters.id = this.currentTreeNode.id;
+      this.findSubDeptPage();
+    },
+    onCheck(evt, treeId, treeNode) {
+      // 选中事件
+      // console.log(evt.type, treeNode);
+    },
+    handleCreated(ztreeObj) {
+      this.ztreeObj = ztreeObj;
+      console.log(this.ztreeOb);
+      // onCreated 中操作ztreeObj对象展开第一个节点
+      ztreeObj.expandNode(ztreeObj.getNodes()[0], true);
+      this.currentTreeNode = ztreeObj.getNodes()[0];
+    },
+    onZTreeRightClick: function () {
+      //alert("haha onZTreeRightClick");
+    },
+    // ztreeEnd
 
-			// 右边表格Start
-			findSubDeptPage: function(data) {
-				// 获取分页数据
-				if (!!data) {
-					this.pageRequest = data.pageRequest;
-				}
-				this.pageRequest.columnFilters = {
-					id: {
-						name: "id",
-						value: this.filters.id
-					}
-				};
-				this.$api.dept.findSubDeptPage(this.pageRequest).then(res => {
-					this.pageResult = res.data;
-				}).then(data != null ? data.callback : "");
-			},
+    // 右边表格Start
+    findSubDeptPage: function (data) {
+      // 获取分页数据
+      if (!!data) {
+        this.pageRequest = data.pageRequest;
+      }
+      this.pageRequest.columnFilters = {
+        id: {
+          name: "id",
+          value: this.filters.id,
+        },
+      };
+      this.$api.dept
+        .findSubDeptPage(this.pageRequest)
+        .then((res) => {
+          this.pageResult = res.data;
+        })
+        .then(data != null ? data.callback : "");
+    },
 
-			// 编辑机构或部门
-			handleEdit(data) {
-				let that = this;
-				that.operType = 'EDIT';
-				if (data.row.deptType == 'C') { //编辑机构
-					//请求一次数据
-					this.dialogTitle = "修改机构信息";
-					this.disabledAddress = {
-							province: true,
-							city: true,
-							area: true
-						},
-						this.$api.dept.getDeptById(data.row.id).then(res => {
-							console.log(res);
-							// that.dataForm = res.data;
-							Object.assign(that.dataForm, res.data);
-							that.selectAddress.province = that.dataForm.province
-							that.selectAddress.city = that.dataForm.city
-							that.selectAddress.area = that.dataForm.area
-							that.dialogVisible = true;
-						});
-				}
-				if (data.row.deptType == 'D') { //编辑部门
-					//请求一次数据
-					this.dialogTitle = "修改部门信息";
-					this.$api.dept.getDeptById(data.row.id).then(res => {
-						that.deptDataForm = res.data;
-						that.deptDialogVisible = true;
-					});
-				}
-			},
-			handleDeleteFlag(data) {
-				let that = this;
-				this.$api.dept.batchDelete(data.params).then(data => {
-					that.findLeftTreeData();
-					that.filters.id = that.currentTreeNode.id
-					that.findSubDeptPage();
-				});
-			},
-			// 右边表格End
+    // 编辑机构或部门
+    handleEdit(data) {
+      let that = this;
+      that.operType = "EDIT";
+      if (data.row.deptType == "C") {
+        //编辑机构
+        //请求一次数据
+        this.dialogTitle = "修改机构信息";
+        (this.disabledAddress = {
+          province: true,
+          city: true,
+          area: true,
+        }),
+          this.$api.dept.getDeptById(data.row.id).then((res) => {
+            console.log(res);
+            // that.dataForm = res.data;
+            Object.assign(that.dataForm, res.data);
+            that.selectAddress.province = that.dataForm.province;
+            that.selectAddress.city = that.dataForm.city;
+            that.selectAddress.area = that.dataForm.area;
+            that.dialogVisible = true;
+          });
+      }
+      if (data.row.deptType == "D") {
+        //编辑部门
+        //请求一次数据
+        this.dialogTitle = "修改部门信息";
+        this.$api.dept.getDeptById(data.row.id).then((res) => {
+          that.deptDataForm = res.data;
+          that.deptDialogVisible = true;
+        });
+      }
+    },
+    handleDeleteFlag(data) {
+      let that = this;
+      this.$api.dept.batchDelete(data.params).then((data) => {
+        that.findLeftTreeData();
+        that.filters.id = that.currentTreeNode.id;
+        that.findSubDeptPage();
+      });
+    },
+    // 右边表格End
 
-			//-- formatter begin--
-			comlevelFormatter(row, column) {
-				let comlevel = row.comlevel;
-				return CommonUtil.getDataName({
-					dataList: this.comleveloptions,
-					value: 'value',
-					label: 'label',
-					data: comlevel
-				})
-			},
-			comattributeFormatter(row, column) {
-				let comattribute = row.comattribute;
-				return CommonUtil.getDataName({
-					dataList: this.comattributeoptions,
-					value: 'value',
-					label: 'label',
-					data: comattribute
-				})
-			},
-			comtypeFormatter(row, column) {
-				let comtype = row.comtype;
-				return CommonUtil.getDataName({
-					dataList: this.comtypeoptions,
-					value: 'value',
-					label: 'label',
-					data: comtype
-				})
-			},
-			//-- formatter end --
+    //-- formatter begin--
+    comlevelFormatter(row, column) {
+      let comlevel = row.comlevel;
+      return CommonUtil.getDataName({
+        dataList: this.comleveloptions,
+        value: "value",
+        label: "label",
+        data: comlevel,
+      });
+    },
+    comattributeFormatter(row, column) {
+      let comattribute = row.comattribute;
+      return CommonUtil.getDataName({
+        dataList: this.comattributeoptions,
+        value: "value",
+        label: "label",
+        data: comattribute,
+      });
+    },
+    comtypeFormatter(row, column) {
+      let comtype = row.comtype;
+      return CommonUtil.getDataName({
+        dataList: this.comtypeoptions,
+        value: "value",
+        label: "label",
+        data: comtype,
+      });
+    },
+    //-- formatter end --
 
-			// 提交表单
-			submitForm() {
-				if (!this.dataForm.id || (this.dataForm.id == this.dataForm.parentId)) {
-					return this.$message({
-						message: "请选择新增机构",
-						type: "error"
-					});
-				}
-				if (this.operType == 'ADDC') {
-					if (!!this.dataForm.id) {
-						this.dataForm.id = this.dataForm.id.replace(/(^\s*)|(\s*$)/g, "");
-					}
-					let a = this.dataForm.id.substring(0, this.dataForm.parentId.length);
-					if (a !== this.dataForm.parentId) {
-						return this.$message({
-							message: "新增机构编码必须已[" + this.dataForm.parentId + "]开头",
-							type: "error"
-						});
-					}
-				}
-				let that = this;
-				this.$refs["dataForm"].validate(valid => {
-					if (valid) {
-						this.$confirm("确认提交吗?", "提示", {}).then(() => {
-							this.editLoading = true;
-							this.dataForm.orderNum = 1;
-							let params = Object.assign({}, this.dataForm);
-							if ((that.operType === "ADD") || (that.operType === "ADDC")) {
+    // 提交表单
+    submitForm() {
+      if (!this.dataForm.id || this.dataForm.id == this.dataForm.parentId) {
+        return this.$message({
+          message: "请选择新增机构",
+          type: "error",
+        });
+      }
+      if (this.operType == "ADDC") {
+        if (!!this.dataForm.id) {
+          this.dataForm.id = this.dataForm.id.replace(/(^\s*)|(\s*$)/g, "");
+        }
+        let a = this.dataForm.id.substring(0, this.dataForm.parentId.length);
+        if (a !== this.dataForm.parentId) {
+          return this.$message({
+            message: "新增机构编码必须已[" + this.dataForm.parentId + "]开头",
+            type: "error",
+          });
+        }
+      }
+      let that = this;
+      this.$refs["dataForm"].validate((valid) => {
+        if (valid) {
+          this.$confirm("确认提交吗?", "提示", {}).then(() => {
+            this.editLoading = true;
+            this.dataForm.orderNum = 1;
+            let params = Object.assign({}, this.dataForm);
+            if (that.operType === "ADD" || that.operType === "ADDC") {
+              let paramData = {
+                id: params.id,
+                name: params.name,
+                parentId: params.parentId,
+                comlevel: params.comlevel, //机构级别
+                comtype: params.comtype, //机构类型
+                comattribute: params.comattribute, //机构性质
+                address: params.address, //机构地址
+                province: params.province, //省
+                city: params.city, //市
+                area: params.area, //区县
+                house: params.house, //门店
+                deptType: params.deptType, //机构类型:用来区分是子公司还是部门啥的,现有:子公司C,门店M,部门D
+                orderNum: params.orderNum,
+              };
+              this.$api.dept.add(paramData).then((res) => {
+                this.editLoading = false;
+                if (res.code == 200) {
+                  this.$message({
+                    message: "操作成功",
+                    type: "success",
+                  });
+                  this.closeDialog();
+                } else {
+                  this.$message({
+                    // message: "操作失败, " + res.msg,
+                    message: "该机构已录入,请勿重复录入 ",
+                    type: "error",
+                  });
+                }
+                this.findSubDeptPage();
+                this.findLeftTreeData();
+              });
+            } else if (that.operType === "EDIT") {
+              this.$api.dept.edit(params).then((res) => {
+                this.editLoading = false;
+                if (res.code == 200) {
+                  this.$message({
+                    message: "操作成功",
+                    type: "success",
+                  });
+                  this.closeDialog();
+                } else {
+                  this.$message({
+                    message: "操作失败, " + res.msg,
+                    type: "error",
+                  });
+                }
+                this.findSubDeptPage();
+                this.findLeftTreeData();
+              });
+            }
+          });
+        }
+      });
+    },
 
-								let paramData = {
-									id: params.id,
-									name: params.name,
-									parentId: params.parentId,
-									comlevel: params.comlevel, //机构级别
-									comtype: params.comtype, //机构类型
-									comattribute: params.comattribute, //机构性质
-									address: params.address, //机构地址
-									province: params.province, //省
-									city: params.city, //市
-									area: params.area, //区县
-									house: params.house, //门店
-									deptType: params.deptType, //机构类型:用来区分是子公司还是部门啥的,现有:子公司C,门店M,部门D
-									orderNum: params.orderNum
-								}
-								this.$api.dept.add(paramData).then(res => {
-									this.editLoading = false;
-									if (res.code == 200) {
-										this.$message({
-											message: "操作成功",
-											type: "success"
-										});
-										this.closeDialog();
-									} else {
-										this.$message({
-											// message: "操作失败, " + res.msg,
-											message: "该机构已录入,请勿重复录入 ",
-											type: "error"
-										});
-									}
-									this.findSubDeptPage();
-									this.findLeftTreeData();
-								});
-							} else if ((that.operType === "EDIT")) {
-								this.$api.dept.edit(params).then(res => {
-									this.editLoading = false;
-									if (res.code == 200) {
-										this.$message({
-											message: "操作成功",
-											type: "success"
-										});
-										this.closeDialog();
-									} else {
-										this.$message({
-											message: "操作失败, " + res.msg,
-											type: "error"
-										});
-									}
-									this.findSubDeptPage();
-									this.findLeftTreeData();
-								});
-							}
-						});
-					}
-				});
-			},
+    // 部门信息提交
+    deptSubmitForm() {
+      let that = this;
+      this.$refs["deptDataForm"].validate((valid) => {
+        if (valid) {
+          this.$confirm("确认提交吗?", "提示", {}).then(() => {
+            this.editLoading = true;
+            this.dataForm.orderNum = 0;
+            let params = Object.assign({}, this.deptDataForm);
+            if (that.operType === "ADD") {
+              this.$api.dept.add(params).then((res) => {
+                this.editLoading = false;
+                if (res.code == 200) {
+                  this.$message({
+                    message: "操作成功",
+                    type: "success",
+                  });
+                  this.closeDeptDialog();
+                } else {
+                  this.$message({
+                    message: "操作失败, " + res.msg,
+                    type: "error",
+                  });
+                }
+                this.findSubDeptPage();
+                this.findLeftTreeData();
+              });
+            } else if (that.operType === "EDIT") {
+              this.$api.dept.edit(params).then((res) => {
+                this.editLoading = false;
+                if (res.code == 200) {
+                  this.$message({
+                    message: "操作成功",
+                    type: "success",
+                  });
+                  this.closeDeptDialog();
+                } else {
+                  this.$message({
+                    message: "操作失败, " + res.msg,
+                    type: "error",
+                  });
+                }
+                this.findSubDeptPage();
+                this.findLeftTreeData();
+              });
+            }
+          });
+        }
+      });
+    },
 
-			// 部门信息提交
-			deptSubmitForm() {
-				let that = this;
-				this.$refs["deptDataForm"].validate(valid => {
-					if (valid) {
-						this.$confirm("确认提交吗?", "提示", {}).then(() => {
-							this.editLoading = true;
-							this.dataForm.orderNum = 0;
-							let params = Object.assign({}, this.deptDataForm);
-							if ((that.operType === "ADD")) {
-								this.$api.dept.add(params).then(res => {
-									this.editLoading = false;
-									if (res.code == 200) {
-										this.$message({
-											message: "操作成功",
-											type: "success"
-										});
-										this.closeDeptDialog();
-									} else {
-										this.$message({
-											message: "操作失败, " + res.msg,
-											type: "error"
-										});
-									}
-									this.findSubDeptPage();
-									this.findLeftTreeData();
-								});
-							} else if ((that.operType === "EDIT")) {
-								this.$api.dept.edit(params).then(res => {
-									this.editLoading = false;
-									if (res.code == 200) {
-										this.$message({
-											message: "操作成功",
-											type: "success"
-										});
-										this.closeDeptDialog();
-									} else {
-										this.$message({
-											message: "操作失败, " + res.msg,
-											type: "error"
-										});
-									}
-									this.findSubDeptPage();
-									this.findLeftTreeData();
-								});
-							}
-						});
-					}
-				});
-			},
+    //公司区域选择
+    //-- address begin --
+    selectProvince(value) {
+      this.selectAddress.province = value.value;
+      this.dataForm.province = value.value;
+      if (this.dataForm.comlevel == 5) {
+      } else if (value.code) {
+        this.dataForm.id = this.dataForm.parentId + value.code.substr(0, 2);
+        // this.dataForm.id = ("99" + value.code).substr(0, 4);
+      } else {
+        this.dataForm.id = "";
+      }
+    },
+    selectCity(value) {
+      this.selectAddress.city = value.value;
+      this.dataForm.city = value.value;
+      if (this.dataForm.comlevel == 5) {
+      } else if (value.code) {
+        this.dataForm.id = this.dataForm.parentId + value.code.substr(2, 2);
+        // this.dataForm.id = ("99" + value.code).substr(0, 6);
+      } else {
+        this.dataForm.id = "";
+      }
+    },
+    selectArea(value) {
+      this.selectAddress.area = value.value;
+      this.dataForm.area = value.value;
+      if (this.dataForm.comlevel == 5) {
+      } else if (value.code) {
+        this.dataForm.id = this.dataForm.parentId + value.code.substr(4, 2);
+        // this.dataForm.id = ("99" + value.code).substr(0, 8);
+      } else {
+        this.dataForm.id = "";
+      }
+    },
+    //重置
+    clearDialog() {
+      let that = this;
+      var id = this.dataForm.id;
+      this.$refs.dataForm.resetFields();
+      if (this.operType == "ADD") {
+        (this.disabledAddress = {
+          province: false,
+          city: false,
+          area: false,
+        }),
+          (this.dataForm = {});
+        this.selectAddress = {
+          province: "",
+          city: "",
+          area: "",
+        };
+        this.dataForm.parentId = this.currentTreeNode.id;
+        this.dataForm.orderNum = 0;
+        if (this.currentTreeNode.level === 0) {
+          this.disabledAddress.city = true;
+          this.disabledAddress.area = true;
+          this.selectAddress.province = "";
+          this.dataForm.province = "";
+          this.selectAddress.city = "";
+          this.dataForm.city = "";
+          this.selectAddress.area = "";
+          this.dataForm.area = "";
+        } else {
+          if (!!this.currentTreeNode.province) {
+            this.selectAddress.province = this.currentTreeNode.province;
+            this.dataForm.province = this.currentTreeNode.province;
+          }
+          if (!!this.currentTreeNode.city) {
+            this.selectAddress.city = this.currentTreeNode.city;
+            this.dataForm.city = this.currentTreeNode.city;
+          }
+          if (!!this.currentTreeNode.area) {
+            this.selectAddress.area = this.currentTreeNode.area;
+            this.dataForm.area = this.currentTreeNode.area;
+          }
+        }
+        if (this.currentTreeNode.level === 1) {
+          this.disabledAddress.city = true;
+          this.disabledAddress.area = true;
+        }
+        if (this.currentTreeNode.level === 2) {
+          this.disabledAddress.province = true;
+          this.disabledAddress.area = true;
+        }
+        if (this.currentTreeNode.level === 3) {
+          this.disabledAddress.province = true;
+          this.disabledAddress.city = true;
+          this.disabledAddress.area = true;
+        }
 
-			//公司区域选择
-			//-- address begin --
-			selectProvince(value) {
-				this.selectAddress.province = value.value;
-				this.dataForm.province = value.value;
-				if (this.dataForm.comlevel == 5) {
+        this.dataForm.deptType = "C"; //类型是机构(C是机构,D是部门)
 
-				} else if (value.code) {
-					this.dataForm.id = this.dataForm.parentId + value.code.substr(0, 2);
-					// this.dataForm.id = ("99" + value.code).substr(0, 4);
-				} else {
-					this.dataForm.id = "";
-				}
-			},
-			selectCity(value) {
-				this.selectAddress.city = value.value;
-				this.dataForm.city = value.value;
-				if (this.dataForm.comlevel == 5) {
+        this.dataForm.id = "";
+        this.dataForm.comlevel = "" + (this.currentTreeNode.level + 1);
 
-				} else if (value.code) {
-					this.dataForm.id = this.dataForm.parentId + value.code.substr(2, 2);
-					// this.dataForm.id = ("99" + value.code).substr(0, 6);
-				} else {
-					this.dataForm.id = "";
-				}
-			},
-			selectArea(value) {
-				this.selectAddress.area = value.value;
-				this.dataForm.area = value.value;
-				if (this.dataForm.comlevel == 5) {
-
-				} else if (value.code) {
-					this.dataForm.id = this.dataForm.parentId + value.code.substr(4, 2);
-					// this.dataForm.id = ("99" + value.code).substr(0, 8);
-				} else {
-					this.dataForm.id = "";
-				}
-			},
-			//重置
-			clearDialog() {
-				let that = this;
-				var id = this.dataForm.id;
-				this.$refs.dataForm.resetFields();
-				if (this.operType == "ADD") {
-					this.disabledAddress = {
-							province: false,
-							city: false,
-							area: false
-						},
-						this.dataForm = {};
-					this.selectAddress = {
-						province: "",
-						city: "",
-						area: ""
-					};
-					this.dataForm.parentId = this.currentTreeNode.id;
-					this.dataForm.orderNum = 0;
-					if (this.currentTreeNode.level === 0) {
-						this.disabledAddress.city = true;
-						this.disabledAddress.area = true;
-						this.selectAddress.province = "";
-						this.dataForm.province = "";
-						this.selectAddress.city = "";
-						this.dataForm.city = "";
-						this.selectAddress.area = "";
-						this.dataForm.area = "";
-					} else {
-						if (!!this.currentTreeNode.province) {
-							this.selectAddress.province = this.currentTreeNode.province;
-							this.dataForm.province = this.currentTreeNode.province;
-						}
-						if (!!this.currentTreeNode.city) {
-							this.selectAddress.city = this.currentTreeNode.city;
-							this.dataForm.city = this.currentTreeNode.city;
-						}
-						if (!!this.currentTreeNode.area) {
-							this.selectAddress.area = this.currentTreeNode.area;
-							this.dataForm.area = this.currentTreeNode.area;
-						}
-					}
-					if (this.currentTreeNode.level === 1) {
-						this.disabledAddress.city = true;
-						this.disabledAddress.area = true;
-					}
-					if (this.currentTreeNode.level === 2) {
-						this.disabledAddress.province = true;
-						this.disabledAddress.area = true;
-					}
-					if (this.currentTreeNode.level === 3) {
-						this.disabledAddress.province = true;
-						this.disabledAddress.city = true;
-						this.disabledAddress.area = true;
-					}
-
-					this.dataForm.deptType = "C"; //类型是机构(C是机构,D是部门)
-
-					this.dataForm.id = "";
-					this.dataForm.comlevel = "" + (this.currentTreeNode.level + 1);
-
-					if (this.dataForm.comlevel === "5") {
-						//第5级是门店,去服务器获取最大编号
-						this.$api.dept.findMaxHouseId(this.currentTreeNode.id).then(res => {
-							let newId = parseInt(res.data) + 1;
-							if (newId < 10) {
-								newId = "0" + newId;
-							}
-							this.dataForm.id = this.currentTreeNode.id + "M" + newId;
-						});
-					}
-
-				}
-				if (this.operType == "EDIT") {
-					//请求一次数据
-					this.dialogTitle = "修改机构信息";
-					this.disabledAddress = {
-							province: true,
-							city: true,
-							area: true
-						},
-						this.$api.dept.getDeptById(id).then(res => {
-							var cid = res.data.id;
-							Object.assign(that.dataForm, res.data);
-							that.selectAddress.province = that.dataForm.province
-							that.selectAddress.city = that.dataForm.city
-							that.selectAddress.area = that.dataForm.area
-							that.dataForm.id = cid
-							that.dialogVisible = true;
-						})
-				}
-			},
-			//关闭机构弹框
-			closeDialog() {
-				this.$refs.dataForm.resetFields();
-				for (let key in this.dataForm) {
-					this.dataForm[key] = "";
-				}
-				this.selectAddress = {
-					province: "",
-					city: "",
-					area: ""
-				};
-				this.disabledAddress = {
-						province: false,
-						city: false,
-						area: false
-					},
-					this.dialogVisible = false;
-				console.log(this.dataForm)
-			},
-			//关闭部门弹框
-			closeDeptDialog() {
-				this.$refs.deptDataForm.resetFields();
-				this.deptDialogVisible = false;
-			}
-		}
-	};
+        if (this.dataForm.comlevel === "5") {
+          //第5级是门店,去服务器获取最大编号
+          this.$api.dept.findMaxHouseId(this.currentTreeNode.id).then((res) => {
+            let newId = parseInt(res.data) + 1;
+            if (newId < 10) {
+              newId = "0" + newId;
+            }
+            this.dataForm.id = this.currentTreeNode.id + "M" + newId;
+          });
+        }
+      }
+      if (this.operType == "EDIT") {
+        //请求一次数据
+        this.dialogTitle = "修改机构信息";
+        (this.disabledAddress = {
+          province: true,
+          city: true,
+          area: true,
+        }),
+          this.$api.dept.getDeptById(id).then((res) => {
+            var cid = res.data.id;
+            Object.assign(that.dataForm, res.data);
+            that.selectAddress.province = that.dataForm.province;
+            that.selectAddress.city = that.dataForm.city;
+            that.selectAddress.area = that.dataForm.area;
+            that.dataForm.id = cid;
+            that.dialogVisible = true;
+          });
+      }
+    },
+    //关闭机构弹框
+    closeDialog() {
+      this.$refs.dataForm.resetFields();
+      for (let key in this.dataForm) {
+        this.dataForm[key] = "";
+      }
+      this.selectAddress = {
+        province: "",
+        city: "",
+        area: "",
+      };
+      (this.disabledAddress = {
+        province: false,
+        city: false,
+        area: false,
+      }),
+        (this.dialogVisible = false);
+      console.log(this.dataForm);
+    },
+    //关闭部门弹框
+    closeDeptDialog() {
+      this.$refs.deptDataForm.resetFields();
+      this.deptDialogVisible = false;
+    },
+  },
+};
 </script>
 
 <style>
-
 </style>