chenrui  %!s(int64=3) %!d(string=hai) anos
pai
achega
b0975bc117
Modificáronse 2 ficheiros con 104 adicións e 2 borrados
  1. 28 0
      src/api/request.js
  2. 76 2
      src/pages/SystemSet/User/index.vue

+ 28 - 0
src/api/request.js

@@ -417,6 +417,34 @@ export function AlarmSon(data) {//告警声音
   })
 }
 
+export function ImportAlarm(data) {//导入告警配置
+  return Service({
+    url: '/Framework/ImortExcel/ImportAlarm',
+    method: 'post',
+    data: data
+  })
+}
+export function Importnetwork(data) {//导入网络配置
+  return Service({
+    url: '/Framework/ImortExcel/ImportAmrPlcnetWork',
+    method: 'post',
+    data: data
+  })
+}
+export function Importorder(data) {//导入订单配置
+  return Service({
+    url: '/Framework/ImortExcel/ImportOrderConfig',
+    method: 'post',
+    data: data
+  })
+}
+export function Importlabel(data) {//导入标签配置
+  return Service({
+    url: '/Framework/ImortExcel/ImportTagPlc',
+    method: 'post',
+    data: data
+  })
+}
 // export function AlarmD(data) {
 //   return Service({
 //     url: '/Framework/ExportExcel/ExportAlarmPlc?filename=' + data.filename,

+ 76 - 2
src/pages/SystemSet/User/index.vue

@@ -24,9 +24,23 @@
       </ul>
     </div>
     <!-- <el-button type="primary" class="addUser" v-if="isAdmin" @click="addUser">新增用户</el-button> -->
-    <div class="downlodTables" @click="downlodTable" v-if="actives != 2">
+    <div class="downlodTables" @click="downlodTables" v-if="actives != 4">
       导入
     </div>
+    <!-- <el-upload
+      v-if="actives != 2"
+      class="upload-demo"
+      :action="url"
+      :on-preview="handlePreview"
+      :on-remove="handleRemove"
+      :before-remove="beforeRemove"
+      multiple
+      :limit="3"
+      :on-exceed="handleExceed"
+      :file-list="fileList"
+    >
+      <div class="downlodTables" v-if="actives != 2">导入</div>
+    </el-upload> -->
     <div class="downlodTable" @click="downlodTable" v-if="actives != 2">
       导出
     </div>
@@ -280,6 +294,10 @@ import {
   labelConfiguration,
   alarmConfiguration,
   alarmConfigurationele,
+  ImportAlarm,
+  Importnetwork,
+  Importorder,
+  Importlabel,
 } from "@/api/request.js";
 import FileSaver from "file-saver";
 import XLSX from "xlsx";
@@ -313,6 +331,16 @@ export default {
       }
     };
     return {
+      fileList: [
+        {
+          name: "food.jpeg",
+          url: "https://fuss10.elemecdn.com/3/63/4e7f3a15429bfda99bce42a18cdd1jpeg.jpeg?imageMogr2/thumbnail/360x360/format/webp/quality/100",
+        },
+        {
+          name: "food2.jpeg",
+          url: "https://fuss10.elemecdn.com/3/63/4e7f3a15429bfda99bce42a18cdd1jpeg.jpeg?imageMogr2/thumbnail/360x360/format/webp/quality/100",
+        },
+      ],
       currentPage3: 1,
       totalPages: 0,
       dialogVisiblenetwork: false, //新增网络配置
@@ -321,6 +349,7 @@ export default {
       dialogVisibledlabe: false, //新增标签
       listdata: {},
       alarList: {},
+      url: "",
       pageSize: 1,
       deleContent: {
         name: "删除告警信息",
@@ -468,6 +497,45 @@ export default {
     },
   },
   methods: {
+    downlodTables() {
+      this.$confirm("是否需要导入xlsx文档, 是否继续?", "提示", {
+        confirmButtonText: "确定",
+        cancelButtonText: "取消",
+        type: "warning",
+      })
+        .then(() => {
+          this.ImportUp();
+          this.$message({
+            type: "success",
+            message: "导入成功!",
+          });
+        })
+        .catch(() => {
+          this.$message({
+            type: "info",
+            message: "已取消导入",
+          });
+        });
+    },
+    ImportUp() {
+      if (this.actives == 0) {
+        Importnetwork().then((res) => {
+          this.network();
+        });
+      } else if (this.actives == 1) {
+        Importorder().then((res) => {
+          this.orderConfig();
+        });
+      } else if (this.actives == 2) {
+        Importlabel().then((res) => {
+          this.labelConfig();
+        });
+      } else if (this.actives == 3) {
+        ImportAlarm().then((res) => {
+          this.giveAn();
+        });
+      }
+    },
     downlodTable() {
       this.$confirm("是否需要导出xlsx文档, 是否继续?", "提示", {
         confirmButtonText: "确定",
@@ -831,6 +899,12 @@ export default {
   line-height: 30px;
   cursor: pointer;
 }
+/deep/ .upload-demo {
+  height: 0;
+}
+/deep/ .el-upload-list {
+  display: none;
+}
 .downlodTables {
   width: 50px;
   height: 30px;
@@ -840,7 +914,7 @@ export default {
   float: right;
   position: absolute;
   top: 30px;
-  right: 220px;
+  right: 211px;
   color: #ddd;
   text-align: center;
   line-height: 30px;