|
@@ -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: {
|
|
|
// 监听复选框配置列所有的变化
|