Browse Source

打开组件没有默认查询数据

zhulu 1 year ago
parent
commit
5a00d9c504
1 changed files with 304 additions and 269 deletions
  1. 304 269
      src/components/orgSelect/zl.orgSelect.vue

+ 304 - 269
src/components/orgSelect/zl.orgSelect.vue

@@ -1,13 +1,32 @@
 <!--编写穿梭框的插件,左右都有很多搜索条件-->
 <!--编写穿梭框的插件,左右都有很多搜索条件-->
 <template>
 <template>
   <div class="zlOrgselect">
   <div class="zlOrgselect">
-    <div style="height:32px">
-      <div class="tags-box" :class="{'tags-box-disabled':disabled,'tags-box-mini':size === 'mini'}"  @click="showDialog">
-          <el-tag type="success" :size="size" v-for="v in currentTempList" :key="v.id">{{ v.shortName }}</el-tag>
+    <div style="height: 32px">
+      <div
+        class="tags-box"
+        :class="{
+          'tags-box-disabled': disabled,
+          'tags-box-mini': size === 'mini',
+        }"
+        @click="showDialog"
+      >
+        <el-tag
+          type="success"
+          :size="size"
+          v-for="v in currentTempList"
+          :key="v.id"
+          >{{ v.shortName }}</el-tag
+        >
       </div>
       </div>
-      <div class="tags_last" :class="{'tags-box-disabled':disabled}">
-        <span v-show="currentTempList.length > 0" class="tags-num">{{ currentTempList.length }}</span>
-        <i v-if="currentTempList.length > 0 && !disabled" class="el-icon-circle-close close-icon" @click.stop="clear"></i>
+      <div class="tags_last" :class="{ 'tags-box-disabled': disabled }">
+        <span v-show="currentTempList.length > 0" class="tags-num">{{
+          currentTempList.length
+        }}</span>
+        <i
+          v-if="currentTempList.length > 0 && !disabled"
+          class="el-icon-circle-close close-icon"
+          @click.stop="clear"
+        ></i>
       </div>
       </div>
     </div>
     </div>
     <DialogCom
     <DialogCom
@@ -22,7 +41,7 @@
       @closed="closed"
       @closed="closed"
     >
     >
       <el-row class="el-row-top">
       <el-row class="el-row-top">
-        <el-col :span="11">          
+        <el-col :span="11">
           <el-card class="box-card" :body-style="{ height: '100%' }">
           <el-card class="box-card" :body-style="{ height: '100%' }">
             <el-row class="result_row">
             <el-row class="result_row">
               <el-col :span="12">搜索条件</el-col>
               <el-col :span="12">搜索条件</el-col>
@@ -32,109 +51,123 @@
               v-model="left.condition"
               v-model="left.condition"
               label-width="120px"
               label-width="120px"
               size="mini"
               size="mini"
-              style="width:95%"
+              style="width: 95%"
             >
             >
-            <el-row>
-            <el-col :span="12">
-              <el-form-item label="组织机构:">
-                <tree-select
-                  v-model="left.condition.orgId"
-                  :searchable="searchable"
-                  :default-expand-level="level"
-                  :normalizer="tenantIdnormalizer"
-                  :options="treeList"
-                  :show-count="true"
-                  :props="{ checkStrictly: true, label: 'name' }"
-                  placeholder="请选择机构"
-                  clearValueText="清除"
-                  :noChildrenText="''"
-                  @select="leftTreeSelect"
-                  noOptionsText="没有数据"
-                  noResultsText="没有搜索结果"
-                />
-              </el-form-item>
-              <!--            <el-form-item >
+              <el-row>
+                <el-col :span="12">
+                  <el-form-item label="组织机构:">
+                    <tree-select
+                      v-model="left.condition.orgId"
+                      :searchable="searchable"
+                      :default-expand-level="level"
+                      :normalizer="tenantIdnormalizer"
+                      :options="treeList"
+                      :show-count="true"
+                      :props="{ checkStrictly: true, label: 'name' }"
+                      placeholder="请选择机构"
+                      clearValueText="清除"
+                      :noChildrenText="''"
+                      @select="leftTreeSelect"
+                      noOptionsText="没有数据"
+                      noResultsText="没有搜索结果"
+                    />
+                  </el-form-item>
+                  <!--            <el-form-item >
                             <el-checkbox v-model="left.condition.searchChild" @change="leftSearch">是否包含下级</el-checkbox>
                             <el-checkbox v-model="left.condition.searchChild" @change="leftSearch">是否包含下级</el-checkbox>
                           </el-form-item>-->
                           </el-form-item>-->
-            </el-col>
-            <el-col :span="12">
-              <el-form-item label="机构类型:">
-                <el-select
-                  prop="type"
-                  label="机构类型"
-                  v-model="left.condition.orgType"
-                  style="width: 100%"
-                  placeholder="请选择机构类型"
-                  @change="leftOrgTypeChanged"
-                  :disabled="left.condition.isleftOrgTypeDisabled"
-                  clearable
-                >
-                  <el-option
-                    v-for="dict in dict.type.sys_org_type"
-                    :key="dict.value"
-                    :label="dict.label"
-                    :value="dict.value"
-                  />
-                </el-select>
-              </el-form-item>
-            </el-col>   
-            </el-row>
-            <el-row>               
-            <el-col :span="12">
-              <el-form-item label="机构名称:">
-                <el-input
-                  v-model="left.condition.orgName"
-                  clearable
-                  @input="leftSearch"
-                ></el-input>
-              </el-form-item>
-            </el-col>
-            <el-col :span="12" v-if="left.condition.orgType==4">
-              <el-form-item label="网点层级:" >
-                <el-select
-                  prop="type"
-                  label="网点层级"
-                  v-model="left.condition.yewdLevel"
-                  style="width: 100%"
-                  placeholder="请选择网点层级"
-                  @change="leftSearch"
-                  clearable
-                >
-                  <el-option
-                    v-for="dict in dict.type.sys_org_yewd_level"
-                    :key="dict.value"
-                    :label="dict.label"
-                    :value="dict.value"
-                  />
-                </el-select>
-              </el-form-item>
-            </el-col>
-            </el-row>
+                </el-col>
+                <el-col :span="12">
+                  <el-form-item label="机构类型:">
+                    <el-select
+                      prop="type"
+                      label="机构类型"
+                      v-model="left.condition.orgType"
+                      style="width: 100%"
+                      placeholder="请选择机构类型"
+                      @change="leftOrgTypeChanged"
+                      :disabled="left.condition.isleftOrgTypeDisabled"
+                      clearable
+                    >
+                      <el-option
+                        v-for="dict in dict.type.sys_org_type"
+                        :key="dict.value"
+                        :label="dict.label"
+                        :value="dict.value"
+                      />
+                    </el-select>
+                  </el-form-item>
+                </el-col>
+              </el-row>
+              <el-row>
+                <el-col :span="12">
+                  <el-form-item label="机构名称:">
+                    <el-input
+                      v-model="left.condition.orgName"
+                      clearable
+                      @input="leftSearch"
+                    ></el-input>
+                  </el-form-item>
+                </el-col>
+                <el-col :span="12" v-if="left.condition.orgType == 4">
+                  <el-form-item label="网点层级:">
+                    <el-select
+                      prop="type"
+                      label="网点层级"
+                      v-model="left.condition.yewdLevel"
+                      style="width: 100%"
+                      placeholder="请选择网点层级"
+                      @change="leftSearch"
+                      clearable
+                    >
+                      <el-option
+                        v-for="dict in dict.type.sys_org_yewd_level"
+                        :key="dict.value"
+                        :label="dict.label"
+                        :value="dict.value"
+                      />
+                    </el-select>
+                  </el-form-item>
+                </el-col>
+              </el-row>
             </el-form>
             </el-form>
             <el-row class="result_row">
             <el-row class="result_row">
               <el-col :span="12">搜索结果</el-col>
               <el-col :span="12">搜索结果</el-col>
               <el-col :span="12" style="text-align: right"
               <el-col :span="12" style="text-align: right"
-              >{{ left.selectedRows.length }}/{{ left.data.length }}
-              </el-col
-              >
+                >{{ left.selectedRows.length }}/{{ left.data.length }}
+              </el-col>
             </el-row>
             </el-row>
+
             <el-table
             <el-table
-              style="width: 99%;margin:auto;"
+              style="width: 99%; margin: auto"
               height="calc(100% - 154px)"
               height="calc(100% - 154px)"
               :data="left.data"
               :data="left.data"
               @selection-change="handleLeftSelectionChange"
               @selection-change="handleLeftSelectionChange"
             >
             >
               <el-table-column type="selection" width="55"></el-table-column>
               <el-table-column type="selection" width="55"></el-table-column>
-              <el-table-column prop="affiliatedArea" align="center" label="地区"></el-table-column>
-              <el-table-column prop="affiliatedBank" label="行社" align="center"></el-table-column>
-              <el-table-column prop="shortName" label="机构名称" align="center"></el-table-column>
+              <el-table-column
+                prop="affiliatedArea"
+                align="center"
+                label="地区"
+              ></el-table-column>
+              <el-table-column
+                prop="affiliatedBank"
+                label="行社"
+                align="center"
+              ></el-table-column>
+              <el-table-column
+                prop="shortName"
+                label="机构名称"
+                align="center"
+              ></el-table-column>
             </el-table>
             </el-table>
           </el-card>
           </el-card>
         </el-col>
         </el-col>
         <el-col :span="2">
         <el-col :span="2">
           <div class="controller">
           <div class="controller">
             <el-button type="primary" @click="handleAdd">添加 >></el-button>
             <el-button type="primary" @click="handleAdd">添加 >></el-button>
-            <el-button class="remove" type="primary" @click="handleRemove">移除 <<</el-button>
+            <el-button class="remove" type="primary" @click="handleRemove"
+              >移除 <<</el-button
+            >
           </div>
           </div>
         </el-col>
         </el-col>
         <el-col :span="11">
         <el-col :span="11">
@@ -149,114 +182,120 @@
               size="mini"
               size="mini"
               style="width: 95%"
               style="width: 95%"
             >
             >
-            <el-row>
-              <el-col :span="12">
-           
-              <el-form-item label="组织机构:">
-                <tree-select
-                  v-model="right.condition.orgId"
-                  :searchable="searchable"
-                  :options="treeList"
-                  :default-expand-level="level"
-                  :normalizer="tenantIdnormalizer"
-                  :show-count="true"
-                  :props="{ checkStrictly: true, label: 'name' }"
-                  placeholder="请选择归属机构"
-                  clearValueText="清除"
-                  :noChildrenText="''"
-                  @select="rightTreeSelect"
-                  noOptionsText="没有数据"
-                  noResultsText="没有搜索结果"
-                />
-
-              </el-form-item>
-            </el-col>
-            <el-col :span="12">
-              <!--            <el-form-item >
+              <el-row>
+                <el-col :span="12">
+                  <el-form-item label="组织机构:">
+                    <tree-select
+                      v-model="right.condition.orgId"
+                      :searchable="searchable"
+                      :options="treeList"
+                      :default-expand-level="level"
+                      :normalizer="tenantIdnormalizer"
+                      :show-count="true"
+                      :props="{ checkStrictly: true, label: 'name' }"
+                      placeholder="请选择归属机构"
+                      clearValueText="清除"
+                      :noChildrenText="''"
+                      @select="rightTreeSelect"
+                      noOptionsText="没有数据"
+                      noResultsText="没有搜索结果"
+                    />
+                  </el-form-item>
+                </el-col>
+                <el-col :span="12">
+                  <!--            <el-form-item >
                             <el-checkbox v-model="right.condition.searchChild" @change="rightSearch">是否包含下级</el-checkbox>
                             <el-checkbox v-model="right.condition.searchChild" @change="rightSearch">是否包含下级</el-checkbox>
                           </el-form-item>-->
                           </el-form-item>-->
-              <el-form-item label="机构类型:">
-                <el-select
-                  prop="type"
-                  label="机构类型"
-                  v-model="right.condition.orgType"
-                  style="width: 100%"
-                  placeholder="请选择机构类型"
-                  @change="rightOrgTypeChanged"
-                  clearable
-                >
-                  <el-option
-                    v-for="dict in dict.type.sys_org_type"
-                    :key="dict.value"
-                    :label="dict.label"
-                    :value="dict.value"
-                  />
-                </el-select>
-              </el-form-item>
-            </el-col>
-            </el-row>
-            <el-row>
-              <el-col :span="12">
-              <el-form-item label="机构名称:">
-                <el-input
-                  v-model="right.condition.orgName"
-                  clearable
-                  @input="rightSearch"
-                ></el-input>
-              </el-form-item>
-            </el-col>
-              <el-col :span="12" v-if="right.condition.orgType==4">
-              <el-form-item label="网点层级:" >
-                <el-select
-                  prop="type"
-                  label="网点层级"
-                  v-model="right.condition.yewdLevel"
-                  style="width: 100%"
-                  placeholder="请选择网点层级"
-                  @change="rightSearch"
-                  clearable
-                >
-                  <el-option
-                    v-for="dict in dict.type.sys_org_yewd_level"
-                    :key="dict.value"
-                    :label="dict.label"
-                    :value="dict.value"
-                  />
-                </el-select>
-              </el-form-item>
-              </el-col>              
-            </el-row>
+                  <el-form-item label="机构类型:">
+                    <el-select
+                      prop="type"
+                      label="机构类型"
+                      v-model="right.condition.orgType"
+                      style="width: 100%"
+                      placeholder="请选择机构类型"
+                      @change="rightOrgTypeChanged"
+                      clearable
+                    >
+                      <el-option
+                        v-for="dict in dict.type.sys_org_type"
+                        :key="dict.value"
+                        :label="dict.label"
+                        :value="dict.value"
+                      />
+                    </el-select>
+                  </el-form-item>
+                </el-col>
+              </el-row>
+              <el-row>
+                <el-col :span="12">
+                  <el-form-item label="机构名称:">
+                    <el-input
+                      v-model="right.condition.orgName"
+                      clearable
+                      @input="rightSearch"
+                    ></el-input>
+                  </el-form-item>
+                </el-col>
+                <el-col :span="12" v-if="right.condition.orgType == 4">
+                  <el-form-item label="网点层级:">
+                    <el-select
+                      prop="type"
+                      label="网点层级"
+                      v-model="right.condition.yewdLevel"
+                      style="width: 100%"
+                      placeholder="请选择网点层级"
+                      @change="rightSearch"
+                      clearable
+                    >
+                      <el-option
+                        v-for="dict in dict.type.sys_org_yewd_level"
+                        :key="dict.value"
+                        :label="dict.label"
+                        :value="dict.value"
+                      />
+                    </el-select>
+                  </el-form-item>
+                </el-col>
+              </el-row>
             </el-form>
             </el-form>
             <el-row class="result_row">
             <el-row class="result_row">
               <el-col :span="12">搜索结果</el-col>
               <el-col :span="12">搜索结果</el-col>
               <el-col :span="12" style="text-align: right"
               <el-col :span="12" style="text-align: right"
-              >{{ right.selectedRows.length }}/{{ right.data.length }}
-              </el-col
-              >
+                >{{ right.selectedRows.length }}/{{ right.data.length }}
+              </el-col>
             </el-row>
             </el-row>
             <el-table
             <el-table
-              style="width: 99%;margin:auto;"
+              style="width: 99%; margin: auto"
               height="calc(100% - 154px)"
               height="calc(100% - 154px)"
               :data="right.data"
               :data="right.data"
               @selection-change="handleRightSelectionChange"
               @selection-change="handleRightSelectionChange"
             >
             >
               <el-table-column type="selection" width="55"></el-table-column>
               <el-table-column type="selection" width="55"></el-table-column>
-              <el-table-column prop="affiliatedArea" label="地区"></el-table-column>
-              <el-table-column prop="affiliatedBank" label="行社"></el-table-column>
-              <el-table-column prop="shortName" label="机构名称"></el-table-column>
+              <el-table-column
+                prop="affiliatedArea"
+                label="地区"
+              ></el-table-column>
+              <el-table-column
+                prop="affiliatedBank"
+                label="行社"
+              ></el-table-column>
+              <el-table-column
+                prop="shortName"
+                label="机构名称"
+              ></el-table-column>
             </el-table>
             </el-table>
           </el-card>
           </el-card>
         </el-col>
         </el-col>
       </el-row>
       </el-row>
       <span slot="footer" class="dialog-footer">
       <span slot="footer" class="dialog-footer">
-      <el-button @click="visible = false">关闭</el-button>
-      <el-button type="primary" @click="onOK">确定</el-button>
-    </span>
+        <el-button @click="visible = false">关闭</el-button>
+        <el-button type="primary" @click="onOK">确定</el-button>
+      </span>
     </DialogCom>
     </DialogCom>
   </div>
   </div>
 </template>
 </template>
 <script>
 <script>
-import {selectOrgList} from "@/api/system/org.js";
+import { selectOrgList } from "@/api/system/org.js";
 
 
 const defaultData = {
 const defaultData = {
   left: {
   left: {
@@ -265,7 +304,7 @@ const defaultData = {
       orgName: "",
       orgName: "",
       orgType: null,
       orgType: null,
       searchChild: false,
       searchChild: false,
-      isleftOrgTypeDisabled:false,
+      isleftOrgTypeDisabled: false,
     },
     },
     total: 0,
     total: 0,
     selectedCount: 0,
     selectedCount: 0,
@@ -284,36 +323,36 @@ const defaultData = {
     selectedRows: [],
     selectedRows: [],
     data: [],
     data: [],
   },
   },
-}
+};
 export default {
 export default {
   name: "orgSelect",
   name: "orgSelect",
-  dicts: ["sys_org_type","sys_org_yewd_level"],
+  dicts: ["sys_org_type", "sys_org_yewd_level"],
   props: {
   props: {
     // orgList : {
     // orgList : {
     //   type: Array,
     //   type: Array,
     //   default: new Array(),
     //   default: new Array(),
     // },
     // },
-    value:{
+    value: {
       type: Array,
       type: Array,
-      default: ()=>{
-        return new Array()
+      default: () => {
+        return new Array();
       },
       },
     },
     },
     // orgIds: {
     // orgIds: {
     //   type: Array,
     //   type: Array,
     //   default: new Array(),
     //   default: new Array(),
     // },
     // },
-    limitOrgType:{
+    limitOrgType: {
       type: String,
       type: String,
       default: null,
       default: null,
     },
     },
     size: {
     size: {
       type: String,
       type: String,
-      default: 'small',
+      default: "small",
     },
     },
     trigger: {
     trigger: {
       type: String,
       type: String,
-      default: 'click',
+      default: "click",
     },
     },
     //组件禁用
     //组件禁用
     disabled: {
     disabled: {
@@ -341,8 +380,8 @@ export default {
     // orgList: function (data) {
     // orgList: function (data) {
     //   this.currentTempList = this.orgList;
     //   this.currentTempList = this.orgList;
     // }
     // }
-    value: function(data){
-      console.log("watch orgIds",data,this.left.condition)
+    value: function (data) {
+      console.log("watch orgIds", data, this.left.condition);
       this.orgTree();
       this.orgTree();
     },
     },
   },
   },
@@ -368,8 +407,8 @@ export default {
           orgId: this.$store.getters.orgId,
           orgId: this.$store.getters.orgId,
           deviceName: "",
           deviceName: "",
           searchChild: false,
           searchChild: false,
-          isleftOrgTypeDisabled:false,
-          yewdLevel:null
+          isleftOrgTypeDisabled: false,
+          yewdLevel: null,
         },
         },
         total: 0,
         total: 0,
         selectedCount: 0,
         selectedCount: 0,
@@ -381,7 +420,7 @@ export default {
           orgId: this.$store.getters.orgId,
           orgId: this.$store.getters.orgId,
           deviceName: "",
           deviceName: "",
           searchChild: false,
           searchChild: false,
-          yewdLevel:null
+          yewdLevel: null,
         },
         },
         total: 0,
         total: 0,
         selectedCount: 0,
         selectedCount: 0,
@@ -391,16 +430,17 @@ export default {
       rightOrgIds: [],
       rightOrgIds: [],
       boundOrgIds: [],
       boundOrgIds: [],
       searchOrgs: [],
       searchOrgs: [],
-
     };
     };
   },
   },
   created() {
   created() {
     this.boundOrgsClone = [];
     this.boundOrgsClone = [];
   },
   },
   mounted() {
   mounted() {
-    console.log("mounted orgIds",this.value,this.limitOrgType,this.currentTempList,(this.currentTempList.length==0 && this.value))
-    if((!this.currentTempList || this.currentTempList.length==0) && this.value)
-    {
+    // console.log("mounted orgIds",this.value,this.limitOrgType,this.currentTempList,(this.currentTempList.length==0 && this.value))
+    if (
+      (!this.currentTempList || this.currentTempList.length == 0) &&
+      this.value
+    ) {
       this.orgTree();
       this.orgTree();
     }
     }
     this.reSetLeftOrgType();
     this.reSetLeftOrgType();
@@ -427,12 +467,14 @@ export default {
       };
       };
     },
     },
     orgTree() {
     orgTree() {
-      console.log("orgTree",22,this.left)
+      console.log("orgTree", new Date());
       //获取所有机构列表
       //获取所有机构列表
-      if(!this.orgs || this.orgs.length==0){
+      if (!this.orgs || this.orgs.length == 0) {
         this.getAllOrgs();
         this.getAllOrgs();
+      } else {
+        this.initHistorySelectOrg();
+        this.leftSearch();
       }
       }
-      this.initHistorySelectOrg();
 
 
       if (this.customRequest) {
       if (this.customRequest) {
         this.customRequest().then((response) => {
         this.customRequest().then((response) => {
@@ -467,62 +509,54 @@ export default {
     open() {
     open() {
       this.right.data = JSON.parse(JSON.stringify(this.currentTempList));
       this.right.data = JSON.parse(JSON.stringify(this.currentTempList));
       this.boundOrgsClone = JSON.parse(JSON.stringify(this.currentTempList));
       this.boundOrgsClone = JSON.parse(JSON.stringify(this.currentTempList));
-      //this.leftSearch();
     },
     },
     showDialog() {
     showDialog() {
-      if(this.disabled)
-      {
+      if (this.disabled) {
         return;
         return;
       }
       }
       this.reSetLeftOrgType();
       this.reSetLeftOrgType();
       this.orgTree();
       this.orgTree();
       this.visible = true;
       this.visible = true;
     },
     },
-    reSetLeftOrgType()
-    {
-      if(this.limitOrgType && this.limitOrgType!="null")
-      {
-        console.log("limitOrgType",this.limitOrgType)
-        this.left.condition.orgType=this.limitOrgType;
-        this.left.condition.isleftOrgTypeDisabled=true;
-        this.leftSearch();
-      }
-      else{
-        this.left.condition.orgType=null;
-        this.left.condition.isleftOrgTypeDisabled=false;
+    reSetLeftOrgType() {
+      if (this.limitOrgType && this.limitOrgType != "null") {
+        // console.log("limitOrgType",this.limitOrgType)
+        this.left.condition.orgType = this.limitOrgType;
+        this.left.condition.isleftOrgTypeDisabled = true;
+      } else {
+        this.left.condition.orgType = null;
+        this.left.condition.isleftOrgTypeDisabled = false;
       }
       }
     },
     },
-    leftOrgTypeChanged()
-    {
-      this.left.condition.yewdLevel=null;
+    leftOrgTypeChanged() {
+      this.left.condition.yewdLevel = null;
       this.leftSearch();
       this.leftSearch();
     },
     },
-    rightOrgTypeChanged()
-    {
-      this.right.condition.yewdLevel=null;
+    rightOrgTypeChanged() {
+      this.right.condition.yewdLevel = null;
       this.rightSearch();
       this.rightSearch();
     },
     },
-    initHistorySelectOrg()
-    {
-      // console.log("initHistorySelectOrg",this.value)
-      if(this.value && this.value.length>0)
-      {
-        let initHistorySelectOrgs= this.orgs.filter(x=> this.value.findIndex(y=>y==x.id)>-1);
-
-        initHistorySelectOrgs.forEach((i, v) => {
-          this.right.data.push(i);
-          this.boundOrgsClone.push(i);
+    initHistorySelectOrg() {
+      if (this.value && this.value.length > 0) {
+        let initHistorySelectOrgs = [];
+        let tempBoundOrgIds = [];
+        this.value.forEach((x) => {
+          let tempOrgIndex = this.orgs.findIndex((y) => y.id == x);
+          if (tempOrgIndex > -1) {
+            this.boundOrgsClone.push(this.orgs[tempOrgIndex]);
+            initHistorySelectOrgs.push(this.orgs[tempOrgIndex]);
+            tempBoundOrgIds.push(this.orgs[tempOrgIndex].deviceId);
+          }
         });
         });
-        this.boundOrgIds = this.boundOrgsClone.map((d) => d.deviceId);
-        this.currentTempList= JSON.parse(JSON.stringify(initHistorySelectOrgs));
-        this.leftSearch();
-        // this.currentTempList
-        // this.left.data = this.searchOrgs.filter((row) => this.boundOrgIds.indexOf(row.id) < 0)
-      }
-      else{
-        // console.log("initHistorySelectOrg",11111)
-        this.currentTempList=[];
-        this.boundOrgIds =[];
+
+        this.boundOrgIds = tempBoundOrgIds; // this.boundOrgsClone.map((d) => d.deviceId);
+        this.currentTempList = JSON.parse(
+          JSON.stringify(initHistorySelectOrgs)
+        );
+        console.log("initHistorySelectOrg", this.currentTempList, new Date());
+      } else {
+        this.currentTempList = [];
+        this.boundOrgIds = [];
       }
       }
     },
     },
     hideDialog() {
     hideDialog() {
@@ -544,7 +578,9 @@ export default {
       this.left.condition.orgId = this.$store.getters.orgId;
       this.left.condition.orgId = this.$store.getters.orgId;
       this.right.condition.orgId = this.$store.getters.orgId;
       this.right.condition.orgId = this.$store.getters.orgId;
       this.left.condition.orgType = this.limitOrgType;
       this.left.condition.orgType = this.limitOrgType;
-      this.left.condition.isleftOrgTypeDisabled = this.limitOrgType? true:false;
+      this.left.condition.isleftOrgTypeDisabled = this.limitOrgType
+        ? true
+        : false;
       this.right.condition.orgType = null;
       this.right.condition.orgType = null;
       this.left.condition.orgName = null;
       this.left.condition.orgName = null;
       this.right.condition.orgName = null;
       this.right.condition.orgName = null;
@@ -581,7 +617,9 @@ export default {
         });
         });
         this.boundOrgIds = this.boundOrgsClone.map((d) => d.deviceId);
         this.boundOrgIds = this.boundOrgsClone.map((d) => d.deviceId);
 
 
-        this.left.data = this.searchOrgs.filter((row) => this.boundOrgIds.indexOf(row.id) < 0)
+        this.left.data = this.searchOrgs.filter(
+          (row) => this.boundOrgIds.indexOf(row.id) < 0
+        );
       }
       }
       this.leftSearch();
       this.leftSearch();
     },
     },
@@ -590,9 +628,7 @@ export default {
        this.right.condition.orgType = null;
        this.right.condition.orgType = null;
        this.right.condition.orgName = null;
        this.right.condition.orgName = null;
        this.right.condition.orgPath = null;*/
        this.right.condition.orgPath = null;*/
-      let rightSelectedIds = this.right.selectedRows.map(
-        (r) => r.id
-      );
+      let rightSelectedIds = this.right.selectedRows.map((r) => r.id);
       if (rightSelectedIds.length > 0) {
       if (rightSelectedIds.length > 0) {
         this.right.data = this.right.data.filter(
         this.right.data = this.right.data.filter(
           (d) => rightSelectedIds.indexOf(d.id) < 0
           (d) => rightSelectedIds.indexOf(d.id) < 0
@@ -602,28 +638,31 @@ export default {
         );
         );
         this.boundOrgIds = this.boundOrgsClone.map((d) => d.id);
         this.boundOrgIds = this.boundOrgsClone.map((d) => d.id);
 
 
-        this.left.data = this.searchOrgs.filter((row) => this.boundOrgIds.indexOf(row.id) < 0)
+        this.left.data = this.searchOrgs.filter(
+          (row) => this.boundOrgIds.indexOf(row.id) < 0
+        );
         if (this.left.condition.orgId) {
         if (this.left.condition.orgId) {
           this.leftSearch();
           this.leftSearch();
         }
         }
       }
       }
-
-
     },
     },
     getAllOrgs() {
     getAllOrgs() {
-      selectOrgList({orgId:this.$store.getters.orgId,checkSub:true,time:new Date()}).then((result) => {
+      selectOrgList({
+        orgId: this.$store.getters.orgId,
+        checkSub: true,
+        time: new Date(),
+      }).then((result) => {
         this.orgs = result;
         this.orgs = result;
         this.initHistorySelectOrg();
         this.initHistorySelectOrg();
+        this.leftSearch();
       });
       });
     },
     },
     leftSearch() {
     leftSearch() {
-      let {condition} = this.left;
-      this.left.prevCondition = {...condition};
+      let { condition } = this.left;
+      this.left.prevCondition = { ...condition };
       this.boundOrgIds = this.boundOrgsClone.map((d) => d.id);
       this.boundOrgIds = this.boundOrgsClone.map((d) => d.id);
       this.left.data = this.orgs
       this.left.data = this.orgs
-        .filter(
-          (d) => this.boundOrgIds.indexOf(d.id) < 0
-        )
+        .filter((d) => this.boundOrgIds.indexOf(d.id) < 0)
         .filter(
         .filter(
           (d) => !condition.orgName || d.shortName.includes(condition.orgName)
           (d) => !condition.orgName || d.shortName.includes(condition.orgName)
         )
         )
@@ -639,16 +678,14 @@ export default {
           // 过滤网点层级
           // 过滤网点层级
           (d) => !condition.yewdLevel || d.yewdLevel == condition.yewdLevel
           (d) => !condition.yewdLevel || d.yewdLevel == condition.yewdLevel
         );
         );
-
     },
     },
     rightSearch() {
     rightSearch() {
-      const {condition} = this.right;
+      const { condition } = this.right;
       if (this.boundOrgsClone.length > 0) {
       if (this.boundOrgsClone.length > 0) {
         this.right.data = this.boundOrgsClone
         this.right.data = this.boundOrgsClone
           .filter(
           .filter(
             // 过滤机构名称
             // 过滤机构名称
-            (d) =>
-              !condition.orgName || d.shortName.includes(condition.orgName)
+            (d) => !condition.orgName || d.shortName.includes(condition.orgName)
           )
           )
           .filter(
           .filter(
             // 过滤机构类型
             // 过滤机构类型
@@ -657,8 +694,9 @@ export default {
           .filter(
           .filter(
             // 过滤父级机构
             // 过滤父级机构
             (d) => !condition.orgPath || d.path.includes(condition.orgPath)
             (d) => !condition.orgPath || d.path.includes(condition.orgPath)
-          ).filter(
-          // 过滤网点层级
+          )
+          .filter(
+            // 过滤网点层级
             (d) => !condition.yewdLevel || d.yewdLevel == condition.yewdLevel
             (d) => !condition.yewdLevel || d.yewdLevel == condition.yewdLevel
           );
           );
       }
       }
@@ -667,7 +705,7 @@ export default {
       this.currentTempList = this.boundOrgsClone;
       this.currentTempList = this.boundOrgsClone;
       this.$emit("selectNodeId", this.boundOrgIds);
       this.$emit("selectNodeId", this.boundOrgIds);
       // console.log("onOK",this.boundOrgIds);
       // console.log("onOK",this.boundOrgIds);
-      this.value=this.boundOrgIds;
+      this.value = this.boundOrgIds;
       this.$emit("input", this.boundOrgIds);
       this.$emit("input", this.boundOrgIds);
       this.hideDialog();
       this.hideDialog();
     },
     },
@@ -679,14 +717,13 @@ export default {
 </script>
 </script>
 <style lang="scss" >
 <style lang="scss" >
 ::v-deep .orgSelectDialog {
 ::v-deep .orgSelectDialog {
-   .el-dialog__body {
+  .el-dialog__body {
     padding-top: 0 !important;
     padding-top: 0 !important;
   }
   }
 }
 }
 </style>
 </style>
 
 
 <style lang="scss" scoped>
 <style lang="scss" scoped>
-
 .result_row {
 .result_row {
   width: 96%;
   width: 96%;
   padding: 6px;
   padding: 6px;
@@ -702,10 +739,9 @@ export default {
 }
 }
 
 
 ::v-deep .el-card__body {
 ::v-deep .el-card__body {
-  padding: 15px 5px;  
+  padding: 15px 5px;
 }
 }
 
 
-
 .controller {
 .controller {
   margin: auto;
   margin: auto;
   width: 80px;
   width: 80px;
@@ -753,7 +789,6 @@ export default {
   text-align: right;
   text-align: right;
 }
 }
 
 
-
 .tags-box {
 .tags-box {
   background-color: #fff;
   background-color: #fff;
   border-radius: 4px;
   border-radius: 4px;
@@ -774,10 +809,10 @@ export default {
   white-space: nowrap;
   white-space: nowrap;
   cursor: pointer;
   cursor: pointer;
 }
 }
-.tags_last{
+.tags_last {
   height: 100%;
   height: 100%;
   right: 0px;
   right: 0px;
-  transition: all .3s;
+  transition: all 0.3s;
   position: absolute;
   position: absolute;
   top: 0;
   top: 0;
   text-align: right;
   text-align: right;
@@ -811,9 +846,9 @@ export default {
 }
 }
 
 
 .tags-box-disabled {
 .tags-box-disabled {
-  background-color: #F5F7FA;
-  border-color: #E4E7ED;
-  color: #C0C4CC;
+  background-color: #f5f7fa;
+  border-color: #e4e7ed;
+  color: #c0c4cc;
   cursor: not-allowed;
   cursor: not-allowed;
 }
 }