Explorar el Código

修改机构树无子节点无查询结果提示

coys hace 2 años
padre
commit
55aa0c6df3
Se han modificado 2 ficheros con 395 adiciones y 197 borrados
  1. 392 197
      src/views/system/device/index.vue
  2. 3 0
      src/views/system/user/index.vue

+ 392 - 197
src/views/system/device/index.vue

@@ -3,98 +3,207 @@
     <el-row :gutter="20">
       <!--机构数据-->
       <el-col :span="4" :xs="24">
-                  <org-tree v-model="queryParams.orgId" @defaultKey="getDefaultKey" @defaultOrg="getDefaultOrg" @checkChange="checkChange"
-                    @click="clickTreeNode"></org-tree>
+        <org-tree
+          v-model="queryParams.orgId"
+          @defaultKey="getDefaultKey"
+          @defaultOrg="getDefaultOrg"
+          @checkChange="checkChange"
+          @click="clickTreeNode"
+        ></org-tree>
       </el-col>
-        <el-col :span="20" :xs="24">
-          <el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch"
-            label-width="68px">
-            <el-form-item label="设备名称" prop="deviceName">
-              <el-input v-model="queryParams.deviceName" placeholder="请输入设备名称" 
-                @keyup.enter.native="handleQuery" />
-            </el-form-item>
-            <el-form-item label="资产类别" prop="assetType">
-
-              <el-select style="width: 100%;"  v-model="queryParams.assetType" placeholder="请选择"
-                @change="changeSelectDevice">
-                <el-option v-for="dict in dict.type.sys_asset_type" :key="dict.value" :label="dict.label"
-                  :value="`${dict.value}`"></el-option>
-              </el-select>
-            </el-form-item>
-
-            <el-form-item label="设备分类" prop="deviceType">
-
-              <el-select style="width: 100%;"  v-model="queryParams.deviceType" placeholder="请选择">
-                <el-option v-for="item in devices" :key="item.dictValue" :label="item.dictLabel"
-                  :value="item.dictValue"></el-option>
-              </el-select>
-            </el-form-item>
-
-            <el-form-item>
-              <el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
-              <el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
-            </el-form-item>
-          </el-form>
-
-          <el-row :gutter="10" class="mb8">
-           <!-- <el-col :span="1.5">
+      <el-col :span="20" :xs="24">
+        <el-form
+          :model="queryParams"
+          ref="queryForm"
+          size="small"
+          :inline="true"
+          v-show="showSearch"
+          label-width="68px"
+        >
+          <el-form-item label="设备名称" prop="deviceName">
+            <el-input
+              v-model="queryParams.deviceName"
+              placeholder="请输入设备名称"
+              @keyup.enter.native="handleQuery"
+            />
+          </el-form-item>
+          <el-form-item label="资产类别" prop="assetType">
+            <el-select
+              style="width: 100%"
+              v-model="queryParams.assetType"
+              placeholder="请选择"
+              @change="changeSelectDevice"
+            >
+              <el-option
+                v-for="dict in dict.type.sys_asset_type"
+                :key="dict.value"
+                :label="dict.label"
+                :value="`${dict.value}`"
+              ></el-option>
+            </el-select>
+          </el-form-item>
+
+          <el-form-item label="设备分类" prop="deviceType">
+            <el-select
+              style="width: 100%"
+              v-model="queryParams.deviceType"
+              placeholder="请选择"
+            >
+              <el-option
+                v-for="item in devices"
+                :key="item.dictValue"
+                :label="item.dictLabel"
+                :value="item.dictValue"
+              ></el-option>
+            </el-select>
+          </el-form-item>
+
+          <el-form-item>
+            <el-button
+              type="primary"
+              icon="el-icon-search"
+              size="mini"
+              @click="handleQuery"
+              >搜索</el-button
+            >
+            <el-button icon="el-icon-refresh" size="mini" @click="resetQuery"
+              >重置</el-button
+            >
+          </el-form-item>
+        </el-form>
+
+        <el-row :gutter="10" class="mb8">
+          <!-- <el-col :span="1.5">
               <el-button type="info" plain icon="el-icon-upload2" size="mini" @click="handleImport"
                 v-hasPermi="['system:device:import']">导入</el-button>
             </el-col>  -->
-        <el-col :span="1.5">
-                <el-button type="primary" icon="el-icon-plus" size="mini" @click="handleImport" v-hasPermi="['system:device:importData']">导入</el-button>
-            </el-col> 
-
-            <el-col :span="1.5">
-                <el-button type="primary" icon="el-icon-plus" size="mini" @click="handleAdd" v-hasPermi="['system:device:add']">新增</el-button>
-            </el-col>
-
-            <el-col :span="1.5">
-<el-button type="primary" icon="el-icon-plus" size="mini" @click="handleOut" v-hasPermi="['system:user:export']">导出模版</el-button>
-</el-col>
-            <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
-          </el-row>
-
-          <el-table border height="600" size="small" v-loading="loading" :data="deviceList"
-            @selection-change="handleSelectionChange">
-            <!--<el-table-column type="selection" width="55" align="center" />-->
-            <el-table-column label="序号" align="center" min-width="50">
-              <template v-slot:default="scope">
-                <span v-text="getPageIndex(scope.$index)"> </span>
-              </template>
-            </el-table-column>
-            <el-table-column label="所属机构" align="left" prop="orgName" />
-
-            <el-table-column label="资产类别" align="center" key="assetType" prop="assetType" width="80">
-              <template slot-scope="scope">
-                <dict-tag :options="dict.type.sys_asset_type" :value="scope.row.assetType" />
-              </template>
-            </el-table-column>
+          <el-col :span="1.5">
+            <el-button
+              type="primary"
+              icon="el-icon-plus"
+              size="mini"
+              @click="handleImport"
+              v-hasPermi="['system:device:importData']"
+              >导入</el-button
+            >
+          </el-col>
 
-            <el-table-column label="设备分类" align="center" key="deviceType" prop="deviceType" width="80">
-              <template slot-scope="scope">
-                <dict-tag :options="dict.type.sys_device_type" :value="scope.row.deviceType" />
-              </template>
-            </el-table-column>
-            <el-table-column label="设备名称" align="center" prop="deviceName" />
-            <el-table-column label="设备品牌" align="center" prop="deviceBrand" />
-            <el-table-column label="有效期至" align="center" prop="checkTime" width="160">
-            </el-table-column>
-            <!--    <el-table-column label="保修期限" align="center" prop="maintenanceTerm" /> -->
-            <el-table-column label="操作" align="center" class-name="small-padding fixed-width">
-              <template slot-scope="scope">
-                <el-button size="mini" type="text" icon="el-icon-edit-outline" @click="handleUpdate(scope.row)"
-                  v-hasPermi="['system:device:edit']">编辑</el-button>
-                <el-button size="mini" type="text" icon="el-icon-delete" @click="handleDelete(scope.row)"
-                  v-hasPermi="['system:device:remove']">删除</el-button>
-              </template>
-            </el-table-column>
-          </el-table>
+          <el-col :span="1.5">
+            <el-button
+              type="primary"
+              icon="el-icon-plus"
+              size="mini"
+              @click="handleAdd"
+              v-hasPermi="['system:device:add']"
+              >新增</el-button
+            >
+          </el-col>
 
-          <pagination v-show="total > 0" :total="total" :page.sync="queryParams.pageNum"
-            :limit.sync="queryParams.pageSize" @pagination="getList" />
-        </el-col>
+          <el-col :span="1.5">
+            <el-button
+              type="primary"
+              icon="el-icon-plus"
+              size="mini"
+              @click="handleOut"
+              v-hasPermi="['system:user:export']"
+              >导出模版</el-button
+            >
+          </el-col>
+          <right-toolbar
+            :showSearch.sync="showSearch"
+            @queryTable="getList"
+          ></right-toolbar>
+        </el-row>
 
+        <el-table
+          border
+          height="600"
+          size="small"
+          v-loading="loading"
+          :data="deviceList"
+          @selection-change="handleSelectionChange"
+        >
+          <!--<el-table-column type="selection" width="55" align="center" />-->
+          <el-table-column label="序号" align="center" min-width="50">
+            <template v-slot:default="scope">
+              <span v-text="getPageIndex(scope.$index)"> </span>
+            </template>
+          </el-table-column>
+          <el-table-column label="所属机构" align="left" prop="orgName" />
+
+          <el-table-column
+            label="资产类别"
+            align="center"
+            key="assetType"
+            prop="assetType"
+            width="80"
+          >
+            <template slot-scope="scope">
+              <dict-tag
+                :options="dict.type.sys_asset_type"
+                :value="scope.row.assetType"
+              />
+            </template>
+          </el-table-column>
+
+          <el-table-column
+            label="设备分类"
+            align="center"
+            key="deviceType"
+            prop="deviceType"
+            width="80"
+          >
+            <template slot-scope="scope">
+              <dict-tag
+                :options="dict.type.sys_device_type"
+                :value="scope.row.deviceType"
+              />
+            </template>
+          </el-table-column>
+          <el-table-column label="设备名称" align="center" prop="deviceName" />
+          <el-table-column label="设备品牌" align="center" prop="deviceBrand" />
+          <el-table-column
+            label="有效期至"
+            align="center"
+            prop="checkTime"
+            width="160"
+          >
+          </el-table-column>
+          <!--    <el-table-column label="保修期限" align="center" prop="maintenanceTerm" /> -->
+          <el-table-column
+            label="操作"
+            align="center"
+            class-name="small-padding fixed-width"
+          >
+            <template slot-scope="scope">
+              <el-button
+                size="mini"
+                type="text"
+                icon="el-icon-edit-outline"
+                @click="handleUpdate(scope.row)"
+                v-hasPermi="['system:device:edit']"
+                >编辑</el-button
+              >
+              <el-button
+                size="mini"
+                type="text"
+                icon="el-icon-delete"
+                @click="handleDelete(scope.row)"
+                v-hasPermi="['system:device:remove']"
+                >删除</el-button
+              >
+            </template>
+          </el-table-column>
+        </el-table>
+
+        <pagination
+          v-show="total > 0"
+          :total="total"
+          :page.sync="queryParams.pageNum"
+          :limit.sync="queryParams.pageSize"
+          @pagination="getList"
+        />
+      </el-col>
     </el-row>
 
     <!-- 添加或修改【请填写功能名称】对话框 -->
@@ -105,7 +214,7 @@
       @close="closeHandler"
       append-to-body
     >
-    <el-form ref="form" :model="form" :rules="rules" label-width="80px">
+      <el-form ref="form" :model="form" :rules="rules" label-width="80px">
         <el-row>
           <el-col :span="20">
             <el-form-item label="所属机构" prop="orgId">
@@ -117,7 +226,10 @@
                 :props="{ checkStrictly: true, label: 'name' }"
                 placeholder="请选择归属机构"
                 @select="changeSelect"
-                 clearValueText="清除"
+                clearValueText="清除"
+                :noChildrenText="''"
+                noOptionsText="没有数据"
+                noResultsText="没有搜索结果"
               />
             </el-form-item>
           </el-col>
@@ -125,17 +237,34 @@
         <el-row>
           <el-col :span="12">
             <el-form-item label="资产类别" prop="assetType">
-              <el-select style="width: 100%;" v-model="form.assetType" placeholder="请选择" @change="changeSelectDevice">
-                <el-option v-for="dict in dict.type.sys_asset_type" :key="dict.value" :label="dict.label"
-                  :value="`${dict.value}`"></el-option>
+              <el-select
+                style="width: 100%"
+                v-model="form.assetType"
+                placeholder="请选择"
+                @change="changeSelectDevice"
+              >
+                <el-option
+                  v-for="dict in dict.type.sys_asset_type"
+                  :key="dict.value"
+                  :label="dict.label"
+                  :value="`${dict.value}`"
+                ></el-option>
               </el-select>
             </el-form-item>
           </el-col>
           <el-col :span="12">
             <el-form-item label="设备分类" prop="deviceType">
-              <el-select style="width: 100%" v-model="form.deviceType" placeholder="请选择">
-                <el-option v-for="item in devices" :key="item.dictValue" :label="item.dictLabel"
-                  :value="item.dictValue"></el-option>
+              <el-select
+                style="width: 100%"
+                v-model="form.deviceType"
+                placeholder="请选择"
+              >
+                <el-option
+                  v-for="item in devices"
+                  :key="item.dictValue"
+                  :label="item.dictLabel"
+                  :value="item.dictValue"
+                ></el-option>
               </el-select>
             </el-form-item>
           </el-col>
@@ -143,68 +272,117 @@
         <el-row>
           <el-col :span="12">
             <el-form-item label="设备名称" prop="deviceName">
-              <el-input v-model="form.deviceName" placeholder="请输入" maxlength="50"/>
+              <el-input
+                v-model="form.deviceName"
+                placeholder="请输入"
+                maxlength="50"
+              />
             </el-form-item>
           </el-col>
           <el-col :span="12">
             <el-form-item label="设备品牌" prop="deviceBrand">
-              <el-input v-model="form.deviceBrand" placeholder="请输入" maxlength="30" />
+              <el-input
+                v-model="form.deviceBrand"
+                placeholder="请输入"
+                maxlength="30"
+              />
             </el-form-item>
           </el-col>
         </el-row>
         <el-row>
           <el-col :span="12">
-            <el-form-item v-if="form.deviceType == 2" label="主机" prop="hostId">
-              <el-select style="width: 100%" v-model="form.hostId" placeholder="请选择">
-                <el-option v-for="item in hostList" :key="item.id" :label="item.deviceName" :value="item.id"></el-option>
+            <el-form-item
+              v-if="form.deviceType == 2"
+              label="主机"
+              prop="hostId"
+            >
+              <el-select
+                style="width: 100%"
+                v-model="form.hostId"
+                placeholder="请选择"
+              >
+                <el-option
+                  v-for="item in hostList"
+                  :key="item.id"
+                  :label="item.deviceName"
+                  :value="item.id"
+                ></el-option>
               </el-select>
             </el-form-item>
           </el-col>
 
           <el-col :span="12">
-            <el-form-item v-if="form.deviceType == 2" label="通道号" prop="channel">
-              <el-input type="number" max="64" min="0"
-                oninput="if(value<=0)value=null;if(value>=64)value=64;value=parseInt(value)" v-model="form.channel"
-                placeholder="请输入" />
+            <el-form-item
+              v-if="form.deviceType == 2"
+              label="通道号"
+              prop="channel"
+            >
+              <el-input
+                type="number"
+                max="64"
+                min="0"
+                oninput="if(value<=0)value=null;if(value>=64)value=64;value=parseInt(value)"
+                v-model="form.channel"
+                placeholder="请输入"
+              />
             </el-form-item>
           </el-col>
-
         </el-row>
 
-
         <el-row>
           <el-col :span="12">
-            <el-form-item v-if="form.assetType == 0" label="有效期至" prop="checkTime">
-              <el-date-picker style="width: 100%" clearable v-model="form.checkTime" type="date"
-                value-format="yyyy-MM-dd HH:mm:ss" placeholder="请选择时间">
+            <el-form-item
+              v-if="form.assetType == 0"
+              label="有效期至"
+              prop="checkTime"
+            >
+              <el-date-picker
+                style="width: 100%"
+                clearable
+                v-model="form.checkTime"
+                type="date"
+                value-format="yyyy-MM-dd HH:mm:ss"
+                placeholder="请选择时间"
+              >
               </el-date-picker>
             </el-form-item>
           </el-col>
         </el-row>
-        <el-row>
-        </el-row>
+        <el-row> </el-row>
       </el-form>
       <div slot="footer" class="dialog-footer">
         <el-button type="primary" @click="submitForm">确 定</el-button>
         <el-button @click="cancel">取 消</el-button>
       </div>
-  </DialogCom>
+    </DialogCom>
 
-        <!-- 设备导入对话框 -->
-        <DialogCom :title="upload.title" :visible.sync="upload.open" width="400px" append-to-body>
-      <el-upload ref="upload" :limit="1" accept=".xlsx, .xls" :headers="upload.headers"
-        :action="upload.url " :disabled="upload.isUploading"
-        :on-progress="handleFileUploadProgress" :on-success="handleFileSuccess" :auto-upload="false" drag>
+    <!-- 设备导入对话框 -->
+    <DialogCom
+      :title="upload.title"
+      :visible.sync="upload.open"
+      width="400px"
+      append-to-body
+    >
+      <el-upload
+        ref="upload"
+        :limit="1"
+        accept=".xlsx, .xls"
+        :headers="upload.headers"
+        :action="upload.url"
+        :disabled="upload.isUploading"
+        :on-progress="handleFileUploadProgress"
+        :on-success="handleFileSuccess"
+        :auto-upload="false"
+        drag
+      >
         <i class="el-icon-upload"></i>
         <div class="el-upload__text">将文件拖到此处,或<em>点击上传</em></div>
-
       </el-upload>
       <div slot="footer" class="dialog-footer">
         <el-button type="primary" @click="submitFileForm">确 定</el-button>
         <el-button @click="upload.open = false">取 消</el-button>
       </div>
     </DialogCom>
-   
   </div>
 </template>
 
@@ -212,18 +390,26 @@
 import { getToken } from "@/utils/auth";
 import orgDropDown from "../../../components/orgTree/orgDropDown.vue";
 import OrgTree from "@/components/orgTree";
-import tableList from '@/mixins/tableList'
-import treeselect from '@riophae/vue-treeselect'
+import tableList from "@/mixins/tableList";
+import treeselect from "@riophae/vue-treeselect";
 import "@riophae/vue-treeselect/dist/vue-treeselect.css";
 import { deptTreeSelect } from "@/api/system/public";
 import { getDeviceType } from "@/api/system/dict/data";
-import { listDevice, getDevice, delDevice, addDevice, updateDevice, getHostByOrgId ,downInCharge} from "@/api/system/device";
+import {
+  listDevice,
+  getDevice,
+  delDevice,
+  addDevice,
+  updateDevice,
+  getHostByOrgId,
+  downInCharge,
+} from "@/api/system/device";
 export default {
   /** 引入基础minxins*/
   mixins: [tableList],
-  dicts: ['sys_asset_type', 'sys_device_type'],
+  dicts: ["sys_asset_type", "sys_device_type"],
   name: "Device",
-  components: { OrgTree, treeselect,orgDropDown },
+  components: { OrgTree, treeselect, orgDropDown },
   data() {
     return {
       checkList: [],
@@ -233,29 +419,26 @@ export default {
       checked: false,
       defaultProps: {
         children: "children",
-        label: "name"
+        label: "name",
       },
       rules: {
         deviceName: [
-          { required: true, message: '请输入设备名称', trigger: 'change' },
-        ],
-        orgId: [
-          { required: true, message: '请选择所属机构', trigger: 'blur' },
+          { required: true, message: "请输入设备名称", trigger: "change" },
         ],
+        orgId: [{ required: true, message: "请选择所属机构", trigger: "blur" }],
         assetType: [
-          { required: true, message: '请选择资产类别', trigger: 'blur' },
+          { required: true, message: "请选择资产类别", trigger: "blur" },
+        ],
+        hostId: [{ required: true, message: "请选择主机", trigger: "blur" }],
+        channel: [
+          { required: true, message: "请输入通道号", trigger: "change" },
         ],
-        hostId: [{ required: true, message: '请选择主机', trigger: 'blur' }],
-        channel: [{ required: true, message: '请输入通道号', trigger: 'change' }],
         deviceType: [
-          { required: true, message: '请选择设备分类', trigger: 'change' },
-
+          { required: true, message: "请选择设备分类", trigger: "change" },
         ],
         checkTime: [
-          { required: true, message: '请选择有效期', trigger: 'blur' },
-        ]
-
-
+          { required: true, message: "请选择有效期", trigger: "blur" },
+        ],
       },
       // 遮罩层
       loading: true,
@@ -284,8 +467,8 @@ export default {
       // 是否显示弹出层
       open: false,
       // 查询参数
-      dept:{
-        id:null
+      dept: {
+        id: null,
       },
       queryParams: {
         pageNum: 1,
@@ -300,10 +483,10 @@ export default {
         maintenanceTerm: null,
         hostId: null,
         channel: null,
-        checkSub: true
+        checkSub: true,
       },
-        // 设备导入参数
-        upload: {
+      // 设备导入参数
+      upload: {
         // 是否显示弹出层(用户导入)
         open: false,
         // 弹出层标题(用户导入)
@@ -314,7 +497,10 @@ export default {
         // 设置上传的请求头部
         headers: { Authorization: "Bearer " + getToken() },
         // 上传的地址
-        url:  process.env.NODE_ENV === "development"?process.env.VUE_APP_BASE_API + "/system/device/importData":window.origin+"/system/device/importData",
+        url:
+          process.env.NODE_ENV === "development"
+            ? process.env.VUE_APP_BASE_API + "/system/device/importData"
+            : window.origin + "/system/device/importData",
       },
       // 表单参数
       form: {
@@ -326,7 +512,7 @@ export default {
         checkTime: null,
         maintenanceTerm: null,
         hostId: null,
-        channel: null
+        channel: null,
       },
       // 表单校验
 
@@ -338,25 +524,23 @@ export default {
   created() {
     this.getDeptTree();
     //this.getList();
-
   },
 
   watch: {
     // 根据名称筛选部门树
     deptName(val) {
-
       this.$refs.tree.filter(val);
-    }
+    },
   },
 
   methods: {
     onOrgSelect(node) {
       this.form.orgPath = node.path;
-      debugger
+      debugger;
       this.form.orgName = node.name;
     },
-        // 文件上传中处理
-        handleFileUploadProgress(event, file, fileList) {
+    // 文件上传中处理
+    handleFileUploadProgress(event, file, fileList) {
       this.upload.isUploading = true;
     },
     handleImport() {
@@ -364,21 +548,21 @@ export default {
       this.upload.open = true;
     },
 
-      // 文件上传成功处理
-      handleFileSuccess(response, file, fileList) {
+    // 文件上传成功处理
+    handleFileSuccess(response, file, fileList) {
       this.upload.open = false;
       this.upload.isUploading = false;
       this.$refs.upload.clearFiles();
       this.$alert(
         "<div style='overflow: auto;overflow-x: hidden;max-height: 70vh;padding: 10px 20px 0;'>" +
-        response.msg +
-        "</div>",
+          response.msg +
+          "</div>",
         "导入结果",
         { dangerouslyUseHTMLString: true }
       );
       this.getList();
     },
-    getDefaultOrg(org){
+    getDefaultOrg(org) {
       this.orgName = org.name;
     },
     getDefaultKey(key) {
@@ -408,31 +592,35 @@ export default {
     },
     /** 查询机构树数据 */
 
-
-
     // 节点单击事件
     handleNodeClick(data) {
       this.queryParams.orgId = data.id;
       this.selectOrgId = data.id;
-   this.changeSelect(data);
+      this.changeSelect(data);
       this.handleQuery();
     },
     changeSelect(val) {
-      getHostByOrgId(val).then(response => {
+      getHostByOrgId(val).then((response) => {
         this.form.hostId = null;
         this.hostList = response.data;
-      })
+      });
     },
-    
-    handleOut(){
-      this.download('system/device/downInChargeOfTemplate', {
-        ...this.queryParams
-      }, `${this.orgName+'-设备导入-'+this.formatTime(new Date(),'YYYYMMhh')}.xlsx`)
+
+    handleOut() {
+      this.download(
+        "system/device/downInChargeOfTemplate",
+        {
+          ...this.queryParams,
+        },
+        `${
+          this.orgName + "-设备导入-" + this.formatTime(new Date(), "YYYYMMhh")
+        }.xlsx`
+      );
     },
     /** 查询【请填写功能名称】列表 */
     getList() {
       this.loading = true;
-      listDevice(this.queryParams).then(response => {
+      listDevice(this.queryParams).then((response) => {
         this.deviceList = response.rows;
         this.total = response.total;
         this.loading = false;
@@ -441,7 +629,7 @@ export default {
 
     /** 查询部门下拉树结构 */
     getDeptTree() {
-      deptTreeSelect().then(response => {
+      deptTreeSelect().then((response) => {
         this.deptOptions = response.data;
         this.defaultKeys.push(response.data[0].id);
         this.queryParams.orgId = response.data[0].id;
@@ -492,7 +680,7 @@ export default {
         updateBy: null,
         delFlag: null,
         hostId: null,
-        channel: null
+        channel: null,
       };
       this.resetForm("form");
     },
@@ -503,60 +691,59 @@ export default {
     },
     /** 重置按钮操作 */
     resetQuery() {
-     this.devices=null;
+      this.devices = null;
       this.resetForm("queryForm");
       this.handleQuery();
     },
     // 多选框选中数据
     handleSelectionChange(selection) {
-      this.ids = selection.map(item => item.id)
-      this.names = selection.map(item => item.deviceName)
-      this.single = selection.length !== 1
-      this.multiple = !selection.length
+      this.ids = selection.map((item) => item.id);
+      this.names = selection.map((item) => item.deviceName);
+      this.single = selection.length !== 1;
+      this.multiple = !selection.length;
     },
     /** 新增按钮操作 */
     handleAdd(val) {
       this.open = true;
       this.title = "新增";
       this.form.orgId = this.selectOrgId;
-      this.dept.id=this.selectOrgId;
+      this.dept.id = this.selectOrgId;
       this.changeSelect(this.dept);
-      this.devices=null;
+      this.devices = null;
     },
     changeSelectDevice(val) {
       if (val) {
-        getDeviceType(val).then(response => {
+        getDeviceType(val).then((response) => {
           this.devices = response.data;
           this.form.deviceType = null;
           this.queryParams.deviceType = null;
-        })
+        });
       }
     },
     /** 修改按钮操作 */
     handleUpdate(row) {
       this.reset();
-      const id = row.id || this.ids
-      getDevice(id).then(response => {
+      const id = row.id || this.ids;
+      getDevice(id).then((response) => {
         this.form = response.data;
-     this.devices=response.devices;
-     this.hostList=response.hostList;
+        this.devices = response.devices;
+        this.hostList = response.hostList;
         this.open = true;
         this.title = "编辑";
       });
-
     },
     /** 提交按钮 */
     submitForm() {
-      this.$refs["form"].validate(valid => {
+      this.$refs["form"].validate((valid) => {
         if (valid) {
           if (this.form.id != null) {
-            updateDevice(this.form).then(response => {
+            updateDevice(this.form).then((response) => {
               this.$modal.msgSuccess("处理成功");
               this.open = false;
               this.getList();
             });
           } else {
-            addDevice(this.form).then(response => {
+            addDevice(this.form).then((response) => {
               this.$modal.msgSuccess("处理成功");
               this.open = false;
               this.getList();
@@ -569,23 +756,31 @@ export default {
     handleDelete(row) {
       const ids = row.id || this.ids;
       const names = row.deviceName || this.names;
-      this.$modal.confirm('是否确认删除名称为"' + names + '"的数据项?').then(function () {
-        return delDevice(ids);
-      }).then(() => {
-        this.getList();
-        this.$modal.msgSuccess("删除成功");
-      }).catch(() => { });
+      this.$modal
+        .confirm('是否确认删除名称为"' + names + '"的数据项?')
+        .then(function () {
+          return delDevice(ids);
+        })
+        .then(() => {
+          this.getList();
+          this.$modal.msgSuccess("删除成功");
+        })
+        .catch(() => {});
     },
-        // 提交上传文件
-        submitFileForm() {
+    // 提交上传文件
+    submitFileForm() {
       this.$refs.upload.submit();
     },
     /** 导出按钮操作 */
     handleExport() {
-      this.download('system/device/export', {
-        ...this.queryParams
-      }, `device_${new Date().getTime()}.xlsx`)
-    }
-  }
+      this.download(
+        "system/device/export",
+        {
+          ...this.queryParams,
+        },
+        `device_${new Date().getTime()}.xlsx`
+      );
+    },
+  },
 };
 </script>

+ 3 - 0
src/views/system/user/index.vue

@@ -379,6 +379,9 @@
                 :props="{ checkStrictly: true, label: 'name' }"
                 placeholder="请选择所属机构"
                 :disabled="form.source == 1"
+                :noChildrenText="''"
+                noOptionsText="没有数据"
+                noResultsText="没有搜索结果"
               />
             </el-form-item>
           </el-col>