tongshanglei vor 3 Jahren
Ursprung
Commit
1c11de1e3b

+ 1 - 0
src/components/Cascader/Regionals.vue

@@ -107,6 +107,7 @@ export default {
     },
     watch: {
         defaultCheckedKeys(val) {
+            console.log('regionals',val)
             // 选中id
             this.checkedKeys = val
             // 选中文本

+ 15 - 5
src/views/device/hydraulic/index.vue

@@ -6,6 +6,7 @@
           <el-cascader
             class="filter-item form-search-input fl"
             v-model="queryParam.department_id"
+            placeholder="请选择所属部门"
             :options="departments"
             clearable
             :props="{
@@ -19,7 +20,7 @@
         <div class="search-item">
           <el-input
             v-model="queryParam.number"
-            placeholder="编号"
+            placeholder="请输入设备编号"
             clearable
             class="filter-item form-search-input fl"
             @keyup.enter.native="handleSearch"
@@ -28,7 +29,7 @@
         <div class="search-item">
           <el-input
             v-model="queryParam.name"
-            placeholder="名称"
+            placeholder="请输入设备名称"
             clearable
             class="filter-item form-search-input fl"
             @keyup.enter.native="handleSearch"
@@ -38,7 +39,7 @@
 
           <el-select
             v-model="queryParam.model"
-            placeholder="设备型号"
+            placeholder="请输入设备型号"
             class="filter-item form-search-input fl"
             clearable
           >
@@ -162,7 +163,7 @@
         align="center"
         v-if="showColumn.number"
         :show-overflow-tooltip="true"
-
+        sortable
       />
       <el-table-column
         prop="imei"
@@ -170,6 +171,7 @@
         align="center"
         v-if="showColumn.imei"
         :show-overflow-tooltip="true"
+        sortable
         width="120"
       />
       <el-table-column
@@ -185,6 +187,7 @@
         label="名称"
         align="center"
         v-if="showColumn.name"
+        sortable
         :show-overflow-tooltip="true"
       />
       <el-table-column
@@ -206,6 +209,7 @@
         prop="model_name"
         label="型号"
         align="center"
+        sortable
         v-if="showColumn.model_name"
         :show-overflow-tooltip="true"
       />
@@ -214,12 +218,16 @@
         label="最大压力"
         align="center"
         v-if="showColumn.max_pressure"
+        sortable
+        width="100"
         :show-overflow-tooltip="true"
       />
       <el-table-column
         prop="min_pressure"
         label="最小压力"
         align="center"
+        sortable
+        width="100"
         v-if="showColumn.min_pressure"
         :show-overflow-tooltip="true"
       />
@@ -229,6 +237,7 @@
         align="center"
         v-if="showColumn.out_date"
         :show-overflow-tooltip="true"
+        sortable
         width="150"
       />
       <el-table-column
@@ -338,6 +347,7 @@
               @click="handleDetail(record.row)"
             ></el-button>
           </el-tooltip>
+          <el-button type="danger" size="mini" icon="el-icon-delete" @click="handleDelete(record.row.id)" />
         </template>
       </el-table-column>
     </el-table>
@@ -470,7 +480,7 @@
       </el-upload>
       <el-link
         type="primary"
-        href="https://rlfd.oss-cn-hangzhou.aliyuncs.com/wxt_school/cards.xls"
+        href="https://rlfd.oss-cn-hangzhou.aliyuncs.com/smart_tool/import_pump.xls"
         style="margin-top: 10px"
         >下载模板</el-link
       >

+ 12 - 4
src/views/device/wrench/index.vue

@@ -6,6 +6,7 @@
           <el-cascader
             class="filter-item form-search-input fl"
             v-model="queryParam.department_id"
+            placeholder="请选择所属部门"
             :options="departments"
             clearable
             :props="{
@@ -19,7 +20,7 @@
         <div class="search-item">
           <el-input
             v-model="queryParam.number"
-            placeholder="编号"
+            placeholder="请输入设备编号"
             clearable
             class="filter-item form-search-input fl"
             @keyup.enter.native="handleSearch"
@@ -28,7 +29,7 @@
         <div class="search-item">
           <el-input
             v-model="queryParam.name"
-            placeholder="名称"
+            placeholder="请输入设备名称"
             clearable
             class="filter-item form-search-input fl"
             @keyup.enter.native="handleSearch"
@@ -37,7 +38,7 @@
         <div class="search-item">
           <el-select
             v-model="queryParam.model"
-            placeholder="设备型号"
+            placeholder="请输入设备型号"
             class="filter-item form-search-input fl"
             clearable
           >
@@ -160,12 +161,14 @@
         label="编号"
         align="center"
         v-if="showColumn.number"
+        sortable
         :show-overflow-tooltip="true"
     
       />
       <el-table-column
         prop="name"
         label="名称"
+        sortable
         align="center"
         v-if="showColumn.name"
         :show-overflow-tooltip="true"
@@ -173,6 +176,7 @@
       <el-table-column
         prop="brand"
         label="品牌"
+        sortable
         align="center"
         v-if="showColumn.brand"
         :show-overflow-tooltip="true"
@@ -181,6 +185,7 @@
         prop="supplier"
         label="供应商"
         align="center"
+        sortable
         v-if="showColumn.supplier"
         :show-overflow-tooltip="true"
       
@@ -188,6 +193,7 @@
       <el-table-column
         prop="model_name"
         label="型号"
+        sortable
         align="center"
         v-if="showColumn.model_name"
         :show-overflow-tooltip="true"
@@ -195,6 +201,7 @@
       <el-table-column
         prop="out_date"
         label="出厂日期"
+        sortable
         align="center"
         v-if="showColumn.out_date"
         :show-overflow-tooltip="true"
@@ -280,7 +287,7 @@
       />
       <el-table-column
         label="操作"
-        width="150"
+        width="180"
         align="center"
         fixed="right"
       >
@@ -309,6 +316,7 @@
               @click="handleDetail(record.row)"
             ></el-button>
           </el-tooltip>
+          <el-button type="danger" size="mini" icon="el-icon-delete" @click="handleDelete(record.row.id)" />
         </template>
       </el-table-column>
     </el-table>

+ 188 - 26
src/views/wind/fan/index.vue

@@ -3,7 +3,34 @@
     <div class="filter-container" style="padding-bottom: 0px">
   
       
-   
+          <el-select
+            v-model="queryParam.wind_id"
+            placeholder="所属风场"
+            class="filter-item form-search-input fl"
+            clearable
+          >
+          <el-option
+                v-for="item in windOptions"
+                :key="item.id"
+                :label="item.name"
+                :value="item.id">
+              </el-option>
+          </el-select>
+
+          <el-select
+            v-model="queryParam.model"
+            placeholder="风机型号"
+            class="filter-item form-search-input fl"
+            clearable
+          >
+          <el-option
+                v-for="item in deviceTypes"
+                :key="item.value"
+                :label="item.text"
+                :value="item.value">
+              </el-option>
+          </el-select>
+     
           <el-input
             v-model="queryParam.number"
             placeholder="编号"
@@ -57,38 +84,35 @@
         prop="wind_name"
         label="风场名称"
         align="center"
-     
         :show-overflow-tooltip="true"
-       
       />
       
       <el-table-column
         prop="number"
         label="机位号"
         align="center"
+        sortable
         :show-overflow-tooltip="true"
       />
        <el-table-column
         prop="model_name"
         label="风机型号"
         align="center"
+        sortable
         :show-overflow-tooltip="true"
-     
       />
        <el-table-column
         prop="info"
         label="备注"
         align="center"
         :show-overflow-tooltip="true"
-     
       />  
       <el-table-column
         prop="created_at"
         label="添加时间"
         align="center"
-
+        sortable
         :show-overflow-tooltip="true"
-     
       />
    
       
@@ -100,18 +124,8 @@
          width="150"
       >
         <template slot-scope="record">
-          <el-tooltip
-            content="修改"
-            placement="top"
-            :enterable="false"
-          >
-            <el-button
-              type="primary"
-              size="mini"
-              icon="el-icon-edit"
-              @click="handleUpdate(record.row)"
-            ></el-button>
-          </el-tooltip>
+            <el-button type="primary" size="mini" icon="el-icon-edit" @click="handleUpdate(record.row)" ></el-button>
+            <el-button type="danger" size="mini" icon="el-icon-delete" @click="handleDelete(record.row.id)" />
         </template>
       </el-table-column>
     </el-table>
@@ -152,6 +166,22 @@
       @click="handleMultiDelete()"
       >删除</el-button
     >
+    <el-button
+      type="warning"
+      icon="el-icon-download"
+      :loading="downloadLoading"
+      style="margin-top: 15px"
+      @click="exportExcel"
+      >导出</el-button
+    >
+    <el-button
+      type="success"
+      icon="el-icon-upload"
+      :loading="downloadLoading"
+      style="margin-top: 15px"
+      @click="importExcel"
+      >导入</el-button
+    >
     <el-pagination
       background
       class="pagination-container"
@@ -180,12 +210,69 @@
        @sendVal="closeDrawer"
        :data="detail"
     />
+    <el-dialog
+      title="导入风机"
+      append-to-body
+      width="400px"
+      :visible.sync="uploadDialogVisible"
+      custom-class="upload-dialog"
+    >
+
+      <el-select
+            v-model="selectedWindId"
+            placeholder="所属风场"
+            class="filter-item form-search-input fl"
+            clearable
+          >
+          <el-option
+                v-for="item in windOptions"
+                :key="item.id"
+                :label="item.name"
+                :value="item.id">
+              </el-option>
+          </el-select>
+      <el-upload
+        class="upload-demo"
+        drag
+        :action="actionUrl"
+        :headers="headers"
+        :before-upload="beforeUpload"
+        :show-file-list="true"
+        :on-change="onchange"
+        :on-remove="onremove"
+        :on-exceed="onexeced"
+        :limit="1"
+        ref="upload"
+      >
+        <i class="el-icon-upload"></i>
+        <div class="el-upload__text">
+          将文件拖到此处,或
+          <em>点击上传</em>
+        </div>
+        <div class="el-upload__tip upload-tips" slot="tip">
+          只能上传xls/xlsx文件
+        </div>
+      </el-upload>
+      <el-link
+        type="primary"
+        href="https://rlfd.oss-cn-hangzhou.aliyuncs.com/smart_tool/import_fan.xlss"
+        style="margin-top: 10px"
+        >下载模板</el-link
+      >
+      <span slot="footer" class="dialog-footer">
+        <el-button @click="uploadDialogVisible = false">取 消</el-button>
+        <el-button type="primary" @click="importDevices" :loading="loadings">{{
+          submitText
+        }}</el-button>
+      </span>
+    </el-dialog>
   </div>
 </template>
 
 <script>
 import rlListOperate from "@/layout/rl-list-operate/rlListOperate";
 import { action } from "@/directive/permission/index.js";
+import { getToken } from "../../../utils/auth";
 import detail from "./detail.vue";
 import formModel from './formModel.vue';
 import updateModel from './updateModel.vue';
@@ -202,6 +289,8 @@ export default {
     return {
       url: "fan",
       options: [],
+      deviceTypes:[],
+      windOptions:[],
       queryParam: {
         number: "",
         wind_id: '',
@@ -233,14 +322,26 @@ export default {
         number: true,
         production_date: true,
         install_date: true,
-      }
+      },
+      //导入请求url
+      actionUrl: process.env.VUE_APP_BASE_API + "/upload/file_excel",
+      headers: { authorization: "Bearer " + getToken() },
+      excel_url: "", //上传学生Excel返回的url
+      uploadDialogVisible: false, //下发配置显示与否
+      selectedWindId: "",
+      loadings: false,
+      submitText: "确 定",
     };
   },
-  // created() {
-  //   // this.$http.get("wind").then((response) => {
-  //   //   this.departments = response.data;
-  //   // });
-  // },
+  created() {
+    this.$http.get("wind").then((response) => {
+      this.windOptions = response.data;
+    });
+    // 4-风机
+    this.$http.get("get_device_mold",{ params: {type:4} }).then(resp => {
+        this.deviceTypes = resp.data
+     });
+  },
   methods: {
     handleAddFan(){
       this.title = '新增'
@@ -291,7 +392,68 @@ export default {
    
     closeDrawer(){
       this.detailVisible = false
-    }
+    },
+    importExcel() {
+      this.uploadDialogVisible = true;
+    },
+    beforeUpload(file) {
+      if (!/\.(xlsx|xls|XLSX|XLS)$/.test(file.name)) {
+        this.$notify.error({
+          title: "错误",
+          message: "上传文件只能为excel文件,且为xlsx,xls格式",
+        });
+        return false;
+      }
+      return true;
+    },
+    onremove() {
+      //移除文件钩子
+      this.excel_url = "";
+    },
+    onexeced(files) {
+      if (files.length == 1) {
+        this.$message.error("只能上传一个文件");
+      }
+    },
+    onchange(file, fileList) {
+      if (file.response) {
+        this.$message.success(file.response.data.msg);
+        this.excel_url = file.response.data.excel_url;
+      } else {
+        // console.log(file);
+      }
+    },
+    importDevices() {
+      // console.log(this.excel_url);
+      var url = this.excel_url
+      var wind_id = this.selectedDepartId;
+      if (depart_id == "") {
+        this.$message.error("请选择风场");
+        return;
+      }
+      if (url == "") {
+        this.$message.error("请上传文件");
+        return;
+      }
+      this.loadings = true;
+      this.submitText = "导入中";
+      this.$http
+        .post("cardDevice/import", { url: url, depart_id: depart_id })
+        .then((response) => {
+          if (response.data.error) {
+            this.$message.error(response.data.msg);
+          } else {
+            this.$message.success(response.data);
+          }
+          this.excel_url = "";
+          this.selectedDepartId = "";
+          this.$refs.upload.clearFiles();
+          this.loadings = false;
+          this.submitText = "确定";
+          this.uploadDialogVisible = false;
+          this.getList();
+        });
+    },
   },
   watch: {
     // 监听复选框配置列所有的变化

+ 12 - 11
src/views/wind/wind/form/AddEditWind.vue

@@ -39,13 +39,13 @@
           </el-option>
         </el-select>
        </el-form-item>
-      <el-form-item label="所属区域" required prop="area_id" placeholder="请选择所属区域">
+      <el-form-item label="所属区域"  prop="area_id" placeholder="请选择所属区域">
           <regionals style="width: 85%"
               ref="regionals"
               class="filter-item fl"
               appendToBody
               @checked="selectArea"
-              :defaultCheckedKeys="form.area_id"
+              :defaultCheckedKeys="defaultCheckedKeys"
             />
       </el-form-item>
       <el-form-item label="详细地址" prop="address">
@@ -109,6 +109,7 @@ export default {
         checkStrictly: true,
       },
       windTypeData: [],
+      defaultCheckedKeys:[],
       EnvTypeData:[],
       HostTypeData:[],
       rules: {
@@ -126,10 +127,7 @@ export default {
           { required: true, message: "请选择所属部门", trigger: "blur" },
           { required: true, message: "请选择所属部门", trigger: "change" },
         ],
-        area_id:[
-          { required: true, message: "请选择所属区域", trigger: "blur" },
-          { required: true, message: "请选择所属区域", trigger: "change" },
-          ],
+
 
         address: [
           { required: true, message: "请输入风场地址", trigger: "blur" },
@@ -158,13 +156,14 @@ export default {
       get() {
         return this.formData;
       },
-      set(val) {},
+      set(val) {
+      },
     },
   },
   watch: {
     formData(val) {
       this.form = val;
-    }
+    },
   },
   methods: {
     // 获取部门数据
@@ -181,6 +180,10 @@ export default {
         if (!valid) {
           return false;
         }
+        if(this.defaultCheckedKeys){
+          this.$message.error("请选择地区");
+          return false;
+        }
         if (this.form.id) {
           // 修改操作
           var saveData = {
@@ -221,9 +224,7 @@ export default {
       this.$parent.handleClose();
     },
     selectArea(val) {
-          console.log('selectArea',val)
-          this.form.area_id = val
-          console.log(this.formFieldsData)
+      this.defaultCheckedKeys = val.fullKeys
     },
   },
 };

+ 3 - 1
src/views/wind/wind/index.vue

@@ -167,7 +167,9 @@ export default {
             showTabs: true, // 显示列表
             toggleIcon: 'right',
             // 风场相关
-            windFormData: {}, // 风场表单信息
+            windFormData: {
+                area_id:[]
+            }, // 风场表单信息
             visibleWindDialog: false, // 显示风场
             
             showSaveWindBtn: false, // 显示保存风场信息按钮

+ 5 - 1
src/views/wind/wind/table/WindTable.vue

@@ -120,6 +120,10 @@ export default {
     data() {
       return {
         url: 'wind',
+        queryParam:{
+            citys:[],
+            number:'',
+        },
         // showAlarmDialog: false,
         // currentFenceId: null,
         tableData: [],
@@ -165,7 +169,7 @@ export default {
             }).catch(() => {});
         },
         selectArea(val) {
-            this.queryParam.citys = val;
+            this.queryParam.citys = val.fullKeys;
         },
         // alarmTable(id){
         //     this.showAlarmDialog = true