From d68b036a3b3c67273b8effa3c9925ef3869a91ba Mon Sep 17 00:00:00 2001
From: haoxuan <haoxuan>
Date: 星期三, 07 二月 2024 13:56:50 +0800
Subject: [PATCH] wms项目 wms系统参数设置的页面开发+路由+是否显示表头配置

---
 src/components/makepager/TableCommonView.vue                     |    9 +
 src/views/systemSet/commonSet/compontents/SystemParameterSet.vue |  180 ++++++++++++++++++++++++++++++
 src/views/systemSet/commonSet/index.vue                          |  141 +++++++++++++++++++++++
 src/router/index.js                                              |   10 +
 src/api/systemSet/commonSet.js                                   |   18 +++
 5 files changed, 355 insertions(+), 3 deletions(-)

diff --git a/src/api/systemSet/commonSet.js b/src/api/systemSet/commonSet.js
new file mode 100644
index 0000000..45797ae
--- /dev/null
+++ b/src/api/systemSet/commonSet.js
@@ -0,0 +1,18 @@
+import request from "@/common/untils/request.js"
+
+// 鑾峰彇绯荤粺璁剧疆
+export function getSystemSet(data) {
+  return request({
+    url: "/api-wms/v1/system/getSystemSet",
+    method: "get",
+    data,
+  });
+}
+// 淇濆瓨绯荤粺璁剧疆
+export function saveSystemSet(data) {
+  return request({
+    url: "/api-wms/v1/system/saveSystemSet",
+    method: "post",
+    data,
+  });
+}
\ No newline at end of file
diff --git a/src/components/makepager/TableCommonView.vue b/src/components/makepager/TableCommonView.vue
index 56dc900..d49367e 100644
--- a/src/components/makepager/TableCommonView.vue
+++ b/src/components/makepager/TableCommonView.vue
@@ -89,7 +89,7 @@
     </el-table>
     <div class="overSpread1" v-show="iscolopen" @click="onMaskClick"></div>
     <div v-if="showCheckcol" class="styleBtn">
-      <i @click="checkcol()" class="label">...</i>
+      <i @click="checkcol()" class="label" v-if="colOpenShow">...</i>
       <el-checkbox-group v-model="showcolList" v-show="iscolopen" class="checkbox-group" @change="selCeckBoxList">
         <el-checkbox v-for="item in tableList.allcol" :label="item" :key="item">{{ item }} </el-checkbox>
       </el-checkbox-group>
@@ -151,7 +151,12 @@
     showSummary: {
       type: Boolean,
       default: false
-    }
+    },
+    // 鏄惁鍙互閰嶇疆鍒楄〃 琛ㄥご
+    colOpenShow: {
+      type: Boolean,
+      default: true,
+    },
   },
   data() {
     return {
diff --git a/src/router/index.js b/src/router/index.js
index 9eb031e..f1cf18e 100644
--- a/src/router/index.js
+++ b/src/router/index.js
@@ -17,7 +17,7 @@
 const warehouseManage = (resolve) => require(["@/views/warehouseManage/index"], resolve) // 浠撳簱绠$悊
 const reportForm = (resolve) => require(["@/views/reportForm/index"], resolve) // 鎶ヨ〃
 const noData = (resolve) => require(["@/views/NoData/index"], resolve)
-
+const commonSet = (resolve) => require(["@/views/systemSet/commonSet/index"], resolve) // 绯荤粺璁剧疆
 export const routes = [
   // 鏃犳潈闄愭暟鎹〉闈�
   {
@@ -77,6 +77,14 @@
       title: "鎶ヨ〃",
       isAllways: true
     }
+  },
+  {
+    path: "/systemSet/commonSet",
+    name: "commonSet",
+    component: commonSet,
+    meta: {
+      title: "閫氱敤璁剧疆"
+    }
   }
 ]
 export const constantRoutes = [
diff --git a/src/views/systemSet/commonSet/compontents/SystemParameterSet.vue b/src/views/systemSet/commonSet/compontents/SystemParameterSet.vue
new file mode 100644
index 0000000..85d4016
--- /dev/null
+++ b/src/views/systemSet/commonSet/compontents/SystemParameterSet.vue
@@ -0,0 +1,180 @@
+<template>
+  <div class="system-parameter-set-box">
+    <el-button
+      class="system-button"
+      type="primary"
+      :loading="isBtnloading"
+      size="mini"
+      @click="onSubmit()"
+      >淇濆瓨</el-button
+    >
+    <el-tabs
+      class="system-tabs"
+      v-model="activeName"
+      @tab-click="handleTabClick"
+    >
+      <el-tab-pane label="WMS绯荤粺鍙傛暟" name="wms" style="height: 100%">
+        <TableCommonView
+          ref="tableListRef"
+          :loading="isBtnloading"
+          :table-list="wmsTableList"
+          @selTableCol="selWmsTableCol"
+          :showHeader="false"
+          :colOpenShow="false"
+        >
+          <template slot="tableButton">
+            <el-table-column prop="value" label="鍊�" width="210" fixed="right">
+              <template slot-scope="scope">
+                <el-select
+                  size="small"
+                  v-if="scope.row.type == 'select'"
+                  v-model="scope.row.value"
+                  placeholder="璇烽�夋嫨"
+                >
+                  <el-option
+                    v-for="item in scope.row.select"
+                    :key="item.id"
+                    :label="item.name"
+                    :value="item.id"
+                  ></el-option>
+                </el-select>
+                <el-input
+                  v-else
+                  size="small"
+                  v-model="scope.row.value"
+                  placeholder="璇疯緭鍏�"
+                ></el-input>
+              </template>
+            </el-table-column>
+          </template>
+        </TableCommonView>
+      </el-tab-pane>
+    </el-tabs>
+  </div>
+</template>
+
+<script>
+import { saveSystemSet } from "@/api/systemSet/commonSet";
+export default {
+  components: {},
+  props: {
+    tableConfig: {
+      type: Object,
+      default: () => {
+        return {};
+      },
+    },
+  },
+  data() {
+    return {
+      activeName: "wms",
+      wmsTableList: {},
+      showcolWms: [],
+      isBtnloading: false,
+    };
+  },
+  created() {
+    this.setWmsTable();
+  },
+  watch: {
+    tableConfig: {
+      handler() {
+        this.getInfo();
+      },
+      immediate: true,
+      deep: true,
+    },
+  },
+  methods: {
+    getInfo() {
+      this.activeName = "wms";
+      this.wmsTableList.tableInfomation = this.tableConfig.WMS;
+    },
+    // wms
+    setWmsTable() {
+      this.wmsTableList = {
+        tableInfomation: [],
+        selectIndex: true,
+        maxHeight: "930px",
+        highlight: true,
+        key: "id",
+        showcol: this.showcolWms,
+        allcol: [],
+        tableColumn: this.setWmsTableColumn(this.showcolWms),
+      };
+      let allcol = [];
+      for (let i = 0; i < this.wmsTableList.tableColumn.length; i++) {
+        if (!this.wmsTableList.tableColumn[i].default) {
+          const label = this.wmsTableList.tableColumn[i].label;
+          allcol.push(label);
+        }
+      }
+      this.wmsTableList.allcol = allcol;
+    },
+    setWmsTableColumn() {
+      let tableColumn = [
+        {
+          label: "鍐呭",
+          prop: "name",
+          align: "left",
+          isShowColumn: true,
+          default: true,
+        },
+      ];
+      return tableColumn;
+    },
+
+    selWmsTableCol(val) {
+      this.showcolWms = val;
+      this.wmsTableList.tableColumn = this.setWmsTableColumn(val);
+    },
+    handleTabClick() {},
+    onSubmit() {
+      this.isBtnloading = true;
+      let arr = [];
+      arr = arr.concat(this.wmsTableList.tableInfomation);
+      for (let i in arr) {
+        delete arr[i].id;
+      }
+      saveSystemSet({
+        sets: arr,
+      })
+        .then((res) => {
+          if (res.code == 200) {
+            this.$message.success("淇敼鎴愬姛锛�");
+            this.$emit("refresh");
+          }
+          this.isBtnloading = false;
+        })
+        .catch(() => {
+          setTimeout(() => {
+            this.isBtnloading = false;
+          }, 3000);
+        });
+    },
+  },
+};
+</script>
+
+<style lang="scss" scoped>
+.system-parameter-set-box {
+  width: 100%;
+  height: 100%;
+  overflow: hidden;
+
+  .system-button {
+    float: right;
+    position: relative;
+    right: 20px;
+    top: 5px;
+    z-index: 5;
+  }
+  .system-tabs {
+    width: 100%;
+    height: 100%;
+    ::v-deep .el-tabs__content {
+      height: calc(100% - 55px) !important;
+    }
+  }
+}
+</style>
diff --git a/src/views/systemSet/commonSet/index.vue b/src/views/systemSet/commonSet/index.vue
new file mode 100644
index 0000000..e437122
--- /dev/null
+++ b/src/views/systemSet/commonSet/index.vue
@@ -0,0 +1,141 @@
+<template>
+    <div class="body">
+      <div class="body-card">
+        <el-tabs
+          v-model="activeName"
+          @tab-click="handleTabClick"
+          tab-position="left"
+        >
+          <el-tab-pane label="绯荤粺鍙傛暟璁剧疆" name="systemParameterSet" style="height: 100%">
+            <SystemParameterSet :tableConfig="tableConfig" @refresh="getSystem"/>
+          </el-tab-pane>
+        </el-tabs>
+      </div>
+    </div>
+</template>
+
+<script>
+import SystemParameterSet from './compontents/SystemParameterSet'
+import { getSystemSet } from "@/api/systemSet/commonSet"
+export default {
+  name: "commonSet",
+  components: {
+    SystemParameterSet
+  },
+  data() {
+    return {
+      activeName: "systemParameterSet",
+        // 绯荤粺鍙傛暟璁剧疆
+        tableConfig:{
+          APS:[],
+          WMS:[],
+          CRM:[],
+          SRM:[]
+        },
+    };
+  },
+  mounted() {
+    this.handleTabClick()
+  },
+  computed: {
+  },
+  watch:{
+    
+  },
+  methods: {
+    handleTabClick() {
+      if(this.activeName=='systemParameterSet') this.getSystem();
+    },
+    getSystem(){
+      getSystemSet().then((res) => {
+        if (res.code == 200) {
+          if (res.data) {
+            this.getTableSet('WMS',res.data.WMS)
+          }
+        }
+      });
+    },
+    getTableSet(value,data){
+      let arr=[]
+      if(data&&Object.keys(data).length>0){
+        for(let i in data){
+          let list=[]
+          if(data[i].type=='select'){
+            let select=data[i].select
+            if(select&&Object.keys(select).length>0){
+              for(let j in select){
+                list.push({
+                  name:select[j],
+                  id:select[j]
+                })
+              }
+            }
+          }
+          let item={
+            name:i,
+            id:value+'&'+i,
+            value:data[i].value,
+            type:data[i].type,
+            select:data[i].type=='select'?list:data[i].select,
+            modeType:data[i].modeType
+          }
+          arr.push(item)
+        }
+      }
+      this.tableConfig[value]=arr;
+    },
+  },
+};
+</script>
+<style lang="scss" scoped>
+  .body{
+    box-sizing: border-box;
+    padding: 10px 20px;
+    border-radius: 12px;
+    height: calc(100% - 20px);
+    .body-card {
+      background-color: #fff;
+      border-radius: 12px;
+      height: 100%;
+      overflow: hidden;
+    }
+  ::v-deep .el-tabs__content{
+    height:100%;
+  }
+  .cursor{
+      cursor: pointer;
+    }
+  .rests-form{
+    width:50%;
+    
+    .add-area {
+      width: 60px;
+      height: 60px;
+      border: 2px solid #ddd;
+      border-radius: 3px;
+      text-align: center;
+      line-height: 60px;
+    }
+    .add-area img {
+      width: 100%;
+      height: 100%;
+    }
+  }
+}
+::v-deep .el-tabs.el-tabs--left {
+  height: 100%;
+  .el-tabs__header.is-left {
+    width: 150px;
+    height: 100%;
+    border-right: 1px solid #eee;
+  }
+  .el-tabs__item.is-left {
+    text-align: left;
+  }
+  .el-tabs__item.is-left.is-active {
+    background: rgba(64, 158, 255, 0.1);
+  }
+
+}
+</style>
+

--
Gitblit v1.8.0