From 3c75ba788897a524771bfde12feddcc94aaf14c6 Mon Sep 17 00:00:00 2001
From: huanghongfeng <huanghongfeng@hnkhzn.com>
Date: 星期二, 22 四月 2025 11:26:02 +0800
Subject: [PATCH] Merge branch 'master' of http://115.159.85.185:8098/r/MeiXinLaiRui/LunDuiYa

---
 项目代码/WMS/WIDESEA_WMSClient/src/extension/basicinfo/extend/addrouters.vue |  351 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 351 insertions(+), 0 deletions(-)

diff --git "a/\351\241\271\347\233\256\344\273\243\347\240\201/WMS/WIDESEA_WMSClient/src/extension/basicinfo/extend/addrouters.vue" "b/\351\241\271\347\233\256\344\273\243\347\240\201/WMS/WIDESEA_WMSClient/src/extension/basicinfo/extend/addrouters.vue"
new file mode 100644
index 0000000..28ed38f
--- /dev/null
+++ "b/\351\241\271\347\233\256\344\273\243\347\240\201/WMS/WIDESEA_WMSClient/src/extension/basicinfo/extend/addrouters.vue"
@@ -0,0 +1,351 @@
+<template>
+  <div>
+    <vol-box
+      v-model="showDetialBox"
+      :lazy="true"
+      :width="width"
+      :padding="15"
+      title="璺敱閰嶇疆"
+      :footer="true"
+    >
+      <el-row height="50">
+        <el-col :span="24">
+          <div class="grid-content right-text">
+            <!-- <el-link type="primary" @click="deleteNode">绉婚櫎鑺傜偣</el-link> -->
+            <el-link type="primary" @click="addNode">娣诲姞鑺傜偣</el-link>
+          </div>
+          <div class="grid-content right-text"></div>
+        </el-col>
+      </el-row>
+      <el-row>
+        <el-col :span="6">
+          <div
+            class="grid-content"
+            style="font-weight: bold; font-size: 18px; margin-left: 5%"
+          >
+            <el-form :rules="routeTypeRules" :model="routerType">
+              <el-form-item label="璺敱绫诲瀷" label-width="120" prop="type">
+                <el-select
+                  v-model="routerType.type"
+                  filterable
+                  placeholder="璇烽�夋嫨"
+                >
+                  <el-option
+                    v-for="item in routerTypes"
+                    :key="item.key"
+                    :label="item.value"
+                    :value="item.key"
+                  >
+                    <span style="float: left">{{ item.value }}</span>
+                    <span
+                      style="float: right; color: #8492a6; font-size: 13px"
+                      >{{ item.key }}</span
+                    >
+                  </el-option>
+                </el-select>
+              </el-form-item>
+            </el-form>
+          </div>
+        </el-col>
+      </el-row>
+      <div style="overflow-x: auto">
+        <el-row style="margin-top: 3%">
+          <el-col :span="24">
+            <el-steps align-center :active="routers.length">
+              <el-step
+                v-for="(router, index) in routers"
+                :title="getTitle(index)"
+                :key="index"
+                icon=""
+                description="111"
+                style="min-width: 280px"
+              >
+                <template v-slot:description="{}">
+                  <div>
+                    <el-form
+                      :rules="rules"
+                      class="demo-ruleForm"
+                      :model="router"
+                      label-width="110px"
+                      style="margin-top: 1%"
+                      ref="router"
+                    >
+                      <el-form-item
+                        label="浣嶇疆缂栧彿"
+                        placeholder="璇烽�夋嫨浣嶇疆缂栧彿"
+                        prop="positionCode"
+                      >
+                        <el-select
+                          filterable
+                          v-model="router.positionCode"
+                          @change="deviceCodeChange"
+                        >
+                          <el-option
+                            v-for="deviceCode in filterDeviceCodes"
+                            :key="deviceCode.key"
+                            :label="deviceCode.key"
+                            :value="deviceCode.key"
+                          />
+                        </el-select>
+                      </el-form-item>
+                      <el-form-item
+                        v-show="
+                          index == routers.length - 1 &&
+                          !router.positionCode.includes('SC')
+                        "
+                        label="瀛愪綅缃紪鍙�"
+                        prop="childPositionCode"
+                      >
+                        <el-select
+                          filterable
+                          v-model="router.childPositionCode"
+                          @change="childDeviceCodeChange"
+                        >
+                          <el-option
+                            v-for="childDeviceCode in filterChildDeviceCodes"
+                            :key="childDeviceCode.key"
+                            :label="childDeviceCode.key"
+                            :value="childDeviceCode.key"
+                          />
+                        </el-select>
+                      </el-form-item>
+                      <el-form-item
+                        v-show="
+                          router.positionCode.includes('SC') ||
+                          router.childPositionCode.includes('SC')
+                        "
+                        label="鍫嗗灈鏈鸿"
+                        prop="sCRow"
+                      >
+                        <el-input v-model="router.sCRow"></el-input>
+                      </el-form-item>
+                      <el-form-item
+                        v-show="
+                          router.positionCode.includes('SC') ||
+                          router.childPositionCode.includes('SC')
+                        "
+                        label="鍫嗗灈鏈哄垪"
+                        prop="sCColumn"
+                      >
+                        <el-input v-model="router.sCColumn"></el-input>
+                      </el-form-item>
+                      <el-form-item
+                        v-show="
+                          router.positionCode.includes('SC') ||
+                          router.childPositionCode.includes('SC')
+                        "
+                        label="鍫嗗灈鏈哄眰"
+                        prop="sCLayer"
+                      >
+                        <el-input v-model="router.sCLayer"></el-input>
+                      </el-form-item>
+                    </el-form>
+                  </div>
+                </template>
+              </el-step>
+            </el-steps>
+          </el-col>
+        </el-row>
+      </div>
+      <template #footer>
+        <div>
+          <el-button plain type="danger" @click="save"
+            ><i class="el-icon-check"></i>淇� 瀛�</el-button
+          >
+          <el-button type="primary" size="mini" @click="showDetialBox = false"
+            ><i class="el-icon-close"></i>鍏抽棴</el-button
+          >
+        </div>
+      </template>
+    </vol-box>
+  </div>
+</template>
+    
+    <script>
+import VolBox from "@/components/basic/VolBox.vue";
+import { el } from "element-plus/es/locale";
+export default {
+  components: { VolBox },
+  data() {
+    return {
+      width: 1200,
+      active: 0,
+      showDetialBox: false,
+      routerTypes: [],
+      routerType: { type: "" },
+      deviceCodes: [],
+      filterDeviceCodes: [],
+      childDeviceCodes: [],
+      filterChildDeviceCodes: [],
+      routers: [
+        {
+          positionCode: "",
+          childPositionCode: "",
+          sCRow: "",
+          sCColumn: "",
+          sCLayer: "",
+        },
+        {
+          positionCode: "",
+          childPositionCode: "",
+          sCRow: "",
+          sCColumn: "",
+          sCLayer: "",
+        },
+      ],
+      rules: {
+        positionCode: [
+          { required: true, message: "璇烽�夋嫨浣嶇疆缂栧彿", trigger: "change" },
+        ],
+      },
+      routeTypeRules: {
+        type: [
+          { required: true, message: "璇烽�夋嫨璺敱绫诲瀷", trigger: "change" },
+        ],
+      },
+    };
+  },
+  methods: {
+    open() {
+      this.routerTypes = [];
+      this.routerType = { type: "" };
+      this.deviceCode = "";
+      this.deviceCodes = [];
+      this.filterDeviceCodes = [];
+      this.childDeviceCodes = [];
+      this.filterChildDeviceCodes = [];
+      this.routers = [
+        {
+          positionCode: "",
+          childPositionCode: "",
+          sCRow: "",
+          sCColumn: "",
+          sCLayer: "",
+        },
+        {
+          positionCode: "",
+          childPositionCode: "",
+          sCRow: "",
+          sCColumn: "",
+          sCLayer: "",
+        },
+      ];
+      this.showDetialBox = true;
+      this.getData();
+    },
+    getData() {
+      this.http.post("/api/Router/GetBaseRouterInfo", {}, true).then((x) => {
+        if (!x.status) return this.$message.error(x.message);
+        this.routerTypes = x.data.routerTypes;
+        this.deviceCodes = x.data.deviceCodes;
+        x.data.areaInfos.forEach((v) => {
+          this.deviceCodes.push(v);
+        });
+        this.filterDeviceCodes = this.deviceCodes;
+        this.childDeviceCodes = this.deviceCodes;
+        this.filterChildDeviceCodes = this.deviceCodes;
+      });
+    },
+    addNode() {
+      this.routers.push({
+        positionCode: "",
+        childPositionCode: "",
+        childPosiDeviceCode: "",
+        sCRow: "",
+        sCColumn: "",
+        sCLayer: "",
+      });
+    },
+    deleteNode() {
+      this.routers.splice(this.routers.length - 1, 1);
+    },
+    getTitle(index) {
+      if (index === 0) {
+        return "璧风偣";
+      } else if (index === this.routers.length - 1) {
+        return "缁堢偣";
+      } else {
+        return "瀛愯妭鐐�" + index;
+      }
+    },
+    save() {
+      this.$refs.router.forEach((x) => {
+        console.log(x);
+        x.validate((valid) => {
+          if (!valid) {
+            return false;
+          }
+        });
+      });
+      this.http
+        .post(
+          "/api/Router/AddRouters?routerType=" + this.routerType.type,
+          this.routers,
+          true
+        )
+        .then((x) => {
+          if (!x.status) return this.$message.error(x.message);
+          this.$message.success("鎿嶄綔鎴愬姛");
+          this.$emit("parentCall", ($vue) => {
+            $vue.refresh();
+          });
+          this.showDetialBox = false;
+        });
+    },
+    deviceCodeChange(value) {
+      var positionCodes = [];
+      this.routers.forEach((x) => {
+        if (x.positionCode && x.positionCode != "") {
+          positionCodes.push(x.positionCode);
+        }
+      });
+      this.filterDeviceCodes = this.deviceCodes.filter(
+        (x) => !positionCodes.includes(x.key)
+      );
+    },
+    childDeviceCodeChange(value) {
+      var positionCodes = [];
+      this.routers.forEach((x) => {
+        if (x.childPositionCode && x.childPositionCode != "") {
+          positionCodes.push(x.childPositionCode);
+        }
+      });
+      this.filterChildDeviceCodes = this.childDeviceCodes.filter(
+        (x) => !positionCodes.includes(x.key)
+      );
+    },
+  },
+  created() {},
+};
+</script>
+    
+    <style scoped>
+.el-col {
+  border-radius: 4px;
+}
+.grid-content {
+  border-radius: 4px;
+  min-height: 36px;
+}
+.content-text {
+  display: flex;
+  align-items: center;
+  justify-content: center;
+}
+.left-text {
+  display: flex;
+  align-items: center;
+  justify-content: flex-start;
+}
+.right-text {
+  display: flex;
+  align-items: center;
+  justify-content: flex-end;
+}
+</style>
+    <style>
+.el-step.is-center .el-step__description {
+  padding-left: 5%;
+  padding-right: 5%;
+}
+</style>
\ No newline at end of file

--
Gitblit v1.9.3