From 2b1f7a47394363e95deb4dfa0f1c67d41e747f7f Mon Sep 17 00:00:00 2001
From: 648540858 <648540858@qq.com>
Date: 星期三, 01 二月 2023 10:56:40 +0800
Subject: [PATCH] Merge branch 'wvp-28181-2.0' into fix-269

---
 web_src/src/components/dialog/importChannel.vue |  125 +++++++++++++++++++++++++++++++++++++++++
 1 files changed, 125 insertions(+), 0 deletions(-)

diff --git a/web_src/src/components/dialog/importChannel.vue b/web_src/src/components/dialog/importChannel.vue
new file mode 100644
index 0000000..91611e8
--- /dev/null
+++ b/web_src/src/components/dialog/importChannel.vue
@@ -0,0 +1,125 @@
+<template>
+  <div id="importChannel" v-loading="isLoging">
+    <el-dialog
+      title="瀵煎叆閫氶亾鏁版嵁"
+      width="30rem"
+      top="2rem"
+      :append-to-body="true"
+      :close-on-click-modal="false"
+      :visible.sync="showDialog"
+      :destroy-on-close="true"
+      @close="close()"
+    >
+      <div>
+        <el-upload
+          class="upload-box"
+          drag
+          :action="uploadUrl"
+          name="file"
+          :on-success="successHook"
+          :on-error="errorHook"
+          >
+          <i class="el-icon-upload"></i>
+          <div class="el-upload__text">灏嗘枃浠舵嫋鍒版澶勶紝鎴�<em>鐐瑰嚮涓婁紶</em></div>
+          <div class="el-upload__tip" slot="tip">鍙兘涓婁紶 csv / xls / xlsx 鏂囦欢</div>
+        </el-upload>
+      </div>
+    </el-dialog>
+    <ShowErrorData ref="showErrorData" :gbIds="errorGBIds" :streams="errorStreams" ></ShowErrorData>
+  </div>
+</template>
+
+<script>
+
+import ShowErrorData from './importChannelShowErrorData.vue'
+
+export default {
+  name: "importChannel",
+  components: {
+    ShowErrorData,
+  },
+  created() {},
+  data() {
+    return {
+      submitCallback: null,
+      showDialog: false,
+      isLoging: false,
+      isEdit: false,
+      errorStreams: [],
+      errorGBIds: [],
+      uploadUrl: process.env.NODE_ENV === 'development'?`debug/api/push/upload`:`api/push/upload`,
+    };
+  },
+  methods: {
+    openDialog: function (callback) {
+      this.showDialog = true;
+      this.submitCallback = callback;
+    },
+    onSubmit: function () {
+      console.log("onSubmit");
+      console.log(this.form);
+      this.$axios({
+        method:"post",
+        url:`/api/platform/catalog/${!this.isEdit? "add":"edit"}`,
+        data: this.form
+      })
+        .then((res)=> {
+          if (res.data.code === 0) {
+            console.log("娣诲姞/淇敼鎴愬姛")
+            if (this.submitCallback)this.submitCallback()
+          }else {
+            this.$message({
+              showClose: true,
+              message: res.data.msg,
+              type: "error",
+            });
+          }
+          this.close();
+        })
+        .catch((error)=> {
+          console.log(error);
+        });
+    },
+    close: function () {
+      this.showDialog = false;
+    },
+    successHook: function(response, file, fileList){
+      if (response.code === 0) {
+        this.$message({
+          showClose: true,
+          message: response.msg,
+          type: "success",
+        });
+      }else if (response.code === 1) {
+        this.errorGBIds = response.data.gbId
+        this.errorStreams = response.data.stream
+        console.log(this.$refs)
+        console.log(this.$refs.showErrorData)
+        this.$refs.showErrorData.openDialog()
+      }else {
+        this.$message({
+          showClose: true,
+          message: response.msg,
+          type: "error",
+        });
+      }
+    },
+    errorHook: function (err, file, fileList) {
+      this.$message({
+        showClose: true,
+        message: err,
+        type: "error",
+      });
+    }
+  },
+};
+</script>
+<style>
+.upload-box{
+  text-align: center;
+}
+.errDataBox{
+  max-height: 15rem;
+  overflow: auto;
+}
+</style>

--
Gitblit v1.8.0