From fbe9459ed908eef6c25c3bcd244d0a7e74dfa792 Mon Sep 17 00:00:00 2001
From: songshankun <songshankun@foxmail.com>
Date: 星期四, 19 十月 2023 13:45:08 +0800
Subject: [PATCH] feat: 产品列表添加查看编辑按钮;弹窗根据情况展示对应标题

---
 src/views/overview/OverviewListView.vue |  130 +++++++++++++++++++++++++++---------------
 1 files changed, 83 insertions(+), 47 deletions(-)

diff --git a/src/views/overview/OverviewListView.vue b/src/views/overview/OverviewListView.vue
index b8044ad..4f5a945 100644
--- a/src/views/overview/OverviewListView.vue
+++ b/src/views/overview/OverviewListView.vue
@@ -3,7 +3,7 @@
     <div class="top">
       <SearchCommonView
         :add-title="'鏂板缓'"
-        :placeholder="'璇疯緭鍏ュ崟鍙�'"
+        :placeholder="'璇疯緭鍏ュ崟鍙�/鏉ユ簮鍗曟嵁'"
         :amount-view="false"
         @addCommonClick="addBtnClick"
         @searchClick="getList"
@@ -23,13 +23,18 @@
       </div>
     </div>
     <!-- 鏂板缓/缂栬緫 -->
-    <AddOverviewDialog v-if="editConfig.visible" :edit-common-config="editConfig" />
+    <AddOverviewDialog
+      v-if="editConfig.visible"
+      :work-type="workType"
+      :edit-common-config="editConfig"
+      :add-name="this.$route.params.name"
+    />
   </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"
 
@@ -53,18 +58,36 @@
         visible: false,
         title: "鏂板缓",
         infomation: {}
-      }
+      },
+      workType: this.$route.params.workType,
+      keyword: "",
+      params: {}
     }
   },
   created() {
     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.getData()
+    // console.log(this.$route.params.workType)
+  },
+  // 椤甸潰閿�姣佷箣鍓�
+  beforeDestroy() {
+    sessionStorage.removeItem("paramsData")
   },
   methods: {
     setTable() {
       this.tableList = {
         tableInfomation: [],
-        selectBox: true,
+        selectBox: false,
+        selectIndex: true,
         showcol: this.showcol,
         allcol: [],
         tableColumn: this.setTableColumn(this.showcol)
@@ -82,74 +105,74 @@
       let tableColumn = [
         {
           label: "鍗曞彿",
-          prop: "id",
+          prop: "number",
           isShowColumn: true,
           default: true
         },
         {
           label: "浠�",
-          prop: "deviceName",
+          prop: "from",
           isShowColumn: showcol.includes("浠�"),
           default: false
         },
         {
           label: "鑷�",
-          prop: "id",
+          prop: "to",
           isShowColumn: showcol.includes("鑷�"),
           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 +182,9 @@
           width: 120,
           isShowColumn: showcol.includes("鐘舵��"),
           default: false,
-          status: true
+          status: true,
+          isCallMethod: true,
+          getCallMethod: this.getStatus
         }
       ]
       return tableColumn
@@ -169,41 +194,52 @@
       this.tableList.tableColumn = this.setTableColumn(val)
     },
     // 璇锋眰鏁版嵁
-    async getData(val, content) {
-      await getProductList({
-        [val]: content,
+    async getData() {
+      await getOperation({
+        number: this.keyword,
+        operationTypeId: this.params.id,
         page: this.pagerOptions.currPage,
         pageSize: this.pagerOptions.pageSize
       }).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.fromLocation.name,
+              to: item.toLocation.name
             }
           })
           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)
       this.editConfig.visible = true
       this.editConfig.title = "缂栬緫"
+      this.editConfig.operationTypeId = this.$route.params.id
       this.editConfig.infomation = { ...row }
     },
     // 鏂板缓
     addBtnClick() {
       this.editConfig.visible = true
       this.editConfig.title = "鏂板缓"
+      this.editConfig.operationTypeId = this.$route.params.id
+      this.editConfig.infomation = {}
+    },
+    // 鐘舵��
+    getStatus(val) {
+      return val === 1 ? "鑽夌" : val === 3 ? "灏辩华" : "瀹屾垚"
     }
   }
 }

--
Gitblit v1.8.0