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

---
 src/views/overview/OverviewListView.vue |  248 ++++++++++++++++++++++++++++++++++++-------------
 1 files changed, 182 insertions(+), 66 deletions(-)

diff --git a/src/views/overview/OverviewListView.vue b/src/views/overview/OverviewListView.vue
index b8044ad..974ba53 100644
--- a/src/views/overview/OverviewListView.vue
+++ b/src/views/overview/OverviewListView.vue
@@ -1,35 +1,56 @@
 <template>
   <div class="rightContent">
+    <!-- <div class="label-fixed-element">
+      <span>{{ params.name }}</span>
+    </div> -->
     <div class="top">
       <SearchCommonView
         :add-title="'鏂板缓'"
-        :placeholder="'璇疯緭鍏ュ崟鍙�'"
+        :placeholder="'璇疯緭鍏ュ崟鍙�/鏉ユ簮鍗曟嵁'"
         :amount-view="false"
+        :search-task-map="searchTaskMap"
         @addCommonClick="addBtnClick"
         @searchClick="getList"
+        @delSelectClick="delSelectClick"
       />
     </div>
     <div class="list-view">
       <div class="table">
-        <TableCommonView
-          ref="tableListRef"
-          :table-list="tableList"
-          @selTableCol="selTableCol"
-          @tableRowClick="tableRowClick"
-        ></TableCommonView>
+        <TableCommonView ref="tableListRef" :table-list="tableList" @selTableCol="selTableCol">
+          <template slot="tableButton">
+            <el-table-column label="鎿嶄綔" width="100">
+              <template slot-scope="scope">
+                <el-button @click="tableRowClick(scope.row, '鏌ョ湅')" type="text" size="small">鏌ョ湅</el-button>
+                <el-button
+                  v-if="scope.row.status !== 4 && scope.row.status !== 5"
+                  @click="tableRowClick(scope.row, '缂栬緫')"
+                  type="text"
+                  size="small"
+                  >缂栬緫</el-button
+                >
+              </template>
+            </el-table-column>
+          </template>
+        </TableCommonView>
       </div>
       <div class="btn-pager">
         <PagerView class="page" :pager-options="pagerOptions" v-on="pagerEvents" />
       </div>
     </div>
     <!-- 鏂板缓/缂栬緫 -->
-    <AddOverviewDialog v-if="editConfig.visible" :edit-common-config="editConfig" />
+    <AddOverviewDialog
+      v-if="editConfig.visible"
+      :workType="workType"
+      :edit-common-config="editConfig"
+      :add-name="addName"
+      :display-edit="displayEdit"
+    />
   </div>
 </template>
 
 <script>
 import pageMixin from "@/components/makepager/pager/mixin/pageMixin"
-import { getProductList } from "@/api/product/product"
+import { getOperation } from "@/api/overview/overview"
 // import DetailProduct from "@/views/productManage/product/DetailProduct"
 import AddOverviewDialog from "@/views/overview/AddOverviewDialog"
 
@@ -42,7 +63,7 @@
   data() {
     return {
       tableList: {},
-      showcol: ["浠�", "鑷�", "鑱旂郴浜�", "鏃ユ湡", "鏉ユ簮鍗曟嵁", "鐘舵��"],
+      showcol: ["浠撳簱浣嶇疆", "璋冨嚭浣嶇疆", "璋冨叆浣嶇疆", "鑱旂郴浜�", "鏃ユ湡", "鏉ユ簮鍗曟嵁", "鐘舵��"],
       searchOptions: [],
       commonDetail: {
         visible: false,
@@ -53,18 +74,60 @@
         visible: false,
         title: "鏂板缓",
         infomation: {}
-      }
+      },
+      workType: this.$route.params.workType,
+      keyword: "",
+      params: {},
+      displayEdit: false,
+      formLabel: "",
+      toLabel: "",
+      addName: "",
+      searchTaskMap: [],
+      numberLabel: "鍗曞彿"
     }
   },
   created() {
+    this.setFormToLabel()
     this.setTable()
+    var paramsData = sessionStorage.getItem("paramsData")
+    let params = {}
+    if (paramsData) {
+      params = JSON.parse(sessionStorage.getItem("paramsData"))
+    } else {
+      params = this.$route.params
+      sessionStorage.setItem("paramsData", JSON.stringify(params))
+    }
+    this.params = params
+    this.searchTaskMap =
+      this.params.status > 0 ? [{ id: this.params.id, title: this.getStatus(this.params.status) }] : []
     this.getData()
+    // console.log(this.$route.params.workType)
+  },
+  // 椤甸潰閿�姣佷箣鍓�
+  beforeDestroy() {
+    sessionStorage.removeItem("paramsData")
   },
   methods: {
+    setFormToLabel() {
+      if (this.workType === 1) {
+        this.formLabel = "渚涘簲鍟嗕綅缃�"
+        this.toLabel = "浠撳簱浣嶇疆"
+        this.numberLabel = "鍏ュ簱鍗曞彿"
+      } else if (this.workType === 2) {
+        this.formLabel = "浠撳簱浣嶇疆"
+        this.toLabel = "瀹㈡埛浣嶇疆"
+        this.numberLabel = "鍑哄簱鍗曞彿"
+      } else {
+        this.formLabel = "璋冨嚭浣嶇疆"
+        this.toLabel = "璋冨叆浣嶇疆"
+        this.numberLabel = "璋冩嫧鍗曞彿"
+      }
+    },
     setTable() {
       this.tableList = {
         tableInfomation: [],
-        selectBox: true,
+        selectBox: false,
+        selectIndex: true,
         showcol: this.showcol,
         allcol: [],
         tableColumn: this.setTableColumn(this.showcol)
@@ -81,75 +144,75 @@
     setTableColumn(showcol) {
       let tableColumn = [
         {
-          label: "鍗曞彿",
-          prop: "id",
+          label: this.numberLabel,
+          prop: "number",
           isShowColumn: true,
           default: true
         },
         {
-          label: "浠�",
-          prop: "deviceName",
-          isShowColumn: showcol.includes("浠�"),
+          label: this.formLabel,
+          prop: "from",
+          isShowColumn: showcol.includes(this.formLabel),
           default: false
         },
         {
-          label: "鑷�",
-          prop: "id",
-          isShowColumn: showcol.includes("鑷�"),
+          label: this.toLabel,
+          prop: "to",
+          isShowColumn: showcol.includes(this.toLabel),
           default: false
         },
         {
           label: "鑱旂郴浜�",
-          prop: "deviceId",
+          prop: "companyName",
           isShowColumn: showcol.includes("鑱旂郴浜�"),
           default: false
         },
         {
           label: "璐熻矗浜�",
-          prop: "shopName",
+          prop: "contacterName",
           isShowColumn: showcol.includes("璐熻矗浜�"),
           default: false
         },
         {
           label: "鏃ユ湡",
-          prop: "preTime",
+          prop: "operationDate",
           isShowColumn: showcol.includes("鏃ユ湡"),
           default: false,
           date: true
         },
-        {
-          label: "浜у搧鍙敤鎬�",
-          prop: "status",
-          isShowColumn: showcol.includes("浜у搧鍙敤鎬�"),
-          default: false
-        },
-        {
-          label: "鎴鏃ユ湡",
-          prop: "faultTime",
-          isShowColumn: showcol.includes("鎴鏃ユ湡"),
-          default: false
-        },
-        {
-          label: "瀹為檯鏃ユ湡",
-          prop: "shopName",
-          isShowColumn: showcol.includes("瀹為檯鏃ユ湡"),
-          default: false
-        },
+        // {
+        //   label: "浜у搧鍙敤鎬�",
+        //   prop: "status",
+        //   isShowColumn: showcol.includes("浜у搧鍙敤鎬�"),
+        //   default: false
+        // },
+        // {
+        //   label: "鎴鏃ユ湡",
+        //   prop: "faultTime",
+        //   isShowColumn: showcol.includes("鎴鏃ユ湡"),
+        //   default: false
+        // },
+        // {
+        //   label: "瀹為檯鏃ユ湡",
+        //   prop: "shopName",
+        //   isShowColumn: showcol.includes("瀹為檯鏃ユ湡"),
+        //   default: false
+        // },
         {
           label: "鏉ユ簮鍗曟嵁",
-          prop: "faultLevel",
+          prop: "sourceNumber",
           isShowColumn: showcol.includes("鏉ユ簮鍗曟嵁"),
           default: false
         },
-        {
-          label: "娆犲崟",
-          prop: "status",
-          isShowColumn: showcol.includes("娆犲崟"),
-          default: false
-        },
+        // {
+        //   label: "娆犲崟",
+        //   prop: "status",
+        //   isShowColumn: showcol.includes("娆犲崟"),
+        //   default: false
+        // },
         {
           label: "鍏ュ簱绫诲瀷",
-          prop: "faultTime",
+          prop: "operationTypeName",
           isShowColumn: showcol.includes("鍏ュ簱绫诲瀷"),
           default: false
         },
@@ -159,7 +222,9 @@
           width: 120,
           isShowColumn: showcol.includes("鐘舵��"),
           default: false,
-          status: true
+          status: true,
+          isCallMethod: true,
+          getCallMethod: this.getStatus
         }
       ]
       return tableColumn
@@ -169,45 +234,96 @@
       this.tableList.tableColumn = this.setTableColumn(val)
     },
     // 璇锋眰鏁版嵁
-    async getData(val, content) {
-      await getProductList({
-        [val]: content,
+    async getData() {
+      await getOperation({
+        number: this.keyword,
+        operationTypeId: this.$route.params.id ? this.$route.params.id : this.params.id,
         page: this.pagerOptions.currPage,
-        pageSize: this.pagerOptions.pageSize
+        pageSize: this.pagerOptions.pageSize,
+        status: this.params.status
       }).then((res) => {
-        if (res.data.code === 200) {
-          const list = res.data.data.list.map((item) => {
+        console.log(res.data)
+        if (res.code === 200) {
+          const list = res.data.map((item) => {
             return {
               ...item,
-              supplierNumber: item.supplier.number,
-              status: "灏辩华",
-              preTime: "2023-09-04 11:20:00"
+              from: item.location.jointName,
+              to: item.location.jointName
             }
           })
           this.tableList.tableInfomation = list || []
-          this.pagerOptions.totalCount = res.data.data.total
+          this.pagerOptions.totalCount = res.total
         }
       })
     },
     // 鎼滅储
     getList(val) {
       console.log(val)
+      this.keyword = val
+      this.pagerOptions.currPage = 1
+      this.getData()
     },
-    // 琛岀偣鍑�
-    tableRowClick(row) {
-      console.log(row)
+    // 鏌ョ湅 缂栬緫
+    tableRowClick(row, val) {
       this.editConfig.visible = true
-      this.editConfig.title = "缂栬緫"
+      this.editConfig.title = val
+      this.editConfig.operationTypeId = this.params.id
+      this.editConfig.code = this.params.code
+      row.details.map((item)=>{
+        item.fromLocationId=item.fromLocation.jointName
+        item.toLocationId=item.toLocation.jointName
+      })
+      row.location={
+        value:row.location.id||row.location.value,
+        label:row.location.jointName||row.location.label
+      }
+      row.toLocation={
+        value:row.toLocation.id||row.toLocation.value,
+        label:row.toLocation.jointName||row.toLocation.label
+      }
+      row.locationID=row.location.jointName
+      row.locationId=row.location.value
+      
+      // row.tolocationId=row.tolocation.value
       this.editConfig.infomation = { ...row }
     },
     // 鏂板缓
     addBtnClick() {
-      this.editConfig.visible = true
       this.editConfig.title = "鏂板缓"
+      this.addName = this.params.name
+      this.editConfig.operationTypeId = this.params.id
+      this.editConfig.code = this.params.code
+      this.editConfig.infomation = {
+        // location:{jointName:""}
+      }
+      this.editConfig.visible = true
+    },
+    // 鐘舵��
+    getStatus(val) {
+      return val === 1 ? "鑽夌" : val === 3 ? "灏辩华" : val === 4 ? "瀹屾垚" : val === 5 ? "鍙栨秷" : ""
+    },
+    // 鍒犻櫎鎼滅储鐘舵��
+    delSelectClick() {
+      this.params.status = 0
+      this.getData()
     }
   }
 }
 </script>
 
 <!-- Add "scoped" attribute to limit CSS to this component only -->
-<style lang="scss" scoped></style>
+<style lang="scss" scoped>
+.label-fixed-element {
+  background: #e6ecf2;
+  position: fixed;
+  font-size: 14px;
+  width: calc(100% - 530px);
+  height: 45px;
+  line-height: 45px;
+  font-size: 18px;
+  font-weight: 700;
+  color: #171718;
+  margin-top: -60px;
+  margin-left: -5px;
+}
+</style>

--
Gitblit v1.8.0