From 3f24fbc89959ec4aa9f3308e1af453e43d504ac5 Mon Sep 17 00:00:00 2001
From: charles <981744753@qq.com>
Date: 星期三, 10 七月 2024 20:04:16 +0800
Subject: [PATCH] feat:完成车间管理部分的重构

---
 src/views/systemSetting/workshopManage/index.vue |  190 +++++++++++++++++++++++++++++++++-------------
 1 files changed, 135 insertions(+), 55 deletions(-)

diff --git a/src/views/systemSetting/workshopManage/index.vue b/src/views/systemSetting/workshopManage/index.vue
index 5d500cf..5869863 100644
--- a/src/views/systemSetting/workshopManage/index.vue
+++ b/src/views/systemSetting/workshopManage/index.vue
@@ -12,7 +12,9 @@
     </div>
     <div class="body-card">
       <div class="list-view">
-        <TableCommonView :table-list="tableList" @selTableCol="selTableCol" @handleShow="handleShow"
+        <TableCommonView :table-list="tableList"
+                         :selectClassRow="selectRow"
+                         @selTableCol="selTableCol"
           @tableRowClick="tableRowClick">
           <template slot="tableButton">
             <el-table-column label="鎿嶄綔" width="180">
@@ -20,7 +22,6 @@
                 <el-button @click.stop="handleClick(scope.row, '鏌ョ湅')" type="text" size="small">鏌ョ湅</el-button>
                 <el-button @click.stop="handleClick(scope.row, '淇敼')" type="text" size="small">淇敼</el-button>
                 <el-button @click.stop="handleClick(scope.row, '鍒犻櫎')" type="text" size="small">鍒犻櫎</el-button>
-
               </template>
             </el-table-column>
           </template>
@@ -30,8 +31,40 @@
         <PagerView class="page" :pager-options="pagerOptions" v-on="pagerEvents" />
       </div>
     </div>
-    <AddWorkshop ref="bomTypeDialog" @handleConfirmSave="handleConfirmSave" :workList="workList" title="娣诲姞鑺傜偣绫诲瀷" />
-    <AddDataDictionaries :editDiaConfig="editConfig" />
+    <div class="body-card1">
+      <div class="bottom-tabs">
+        <div
+                class="tab-pane"
+                @click="getTab(0)"
+                :style="{
+              background: TabsIndex == 0 ? '#2a78fb' : '#F1F3F8',
+              color: TabsIndex == 0 ? '#fff' : '#666'
+            }"
+        >
+          缁勫埆鍒楄〃
+        </div>
+        <!--<div
+                class="tab-pane"
+                @click="getTab(1)"
+                :style="{background: TabsIndex == 1 ? '#2a78fb' : '#F1F3F8',color: TabsIndex == 1 ? '#fff' : '#666'}"
+        >
+          鍗曟嵁杩芥函
+        </div>-->
+      </div>
+      <div class="list-view">
+        <TableCommonView :table-list="bottomTableList"
+                         @selTableCol="selTableCol">
+          <template slot="tableButton">
+          </template>
+        </TableCommonView>
+      </div>
+      <div class="btn-pager">
+        <PagerView class="page" :pager-options="pagerOptions" v-on="pagerEvents" />
+      </div>
+    </div>
+    <!--<AddWorkshop ref="bomTypeDialog" @handleConfirmSave="handleConfirmSave" :workList="workList" title="娣诲姞鑺傜偣绫诲瀷" />
+    <AddDataDictionaries :editDiaConfig="editConfig" />-->
+    <WorkshopDialog ref="workshopDialogRef" :edit-config="editConfig" @refresh="refresh"></WorkshopDialog>
   </div>
 </template>
 
@@ -41,23 +74,29 @@
 import TableCommonView from '@/components/makepager/TableCommonView.vue'
 import AddWorkshop from '@/views/systemSetting/workshopManage/components/addWorkshop.vue'
 import pageMixin from "@/components/makepager/pager/mixin/pageMixin"
+import WorkshopDialog from '@/views/systemSetting/workshopManage/components/workshopDialog.vue'
 export default {
   name: "workshopManage",
   props: {},
-  components: { TableCommonView, AddWorkshop, AddDataDictionaries },
+  components: { TableCommonView, AddWorkshop, AddDataDictionaries,WorkshopDialog },
   mixins: [pageMixin],
-  computed: {},
+  computed: {
+
+  },
   data() {
     return {
+      selectRow:{},
+      TabsIndex:0,
+      bottomTableList:{},
       tableList: {},
-      showCol: ["杞﹂棿", "缁勫埆", "寮�濮嬭溅鍙�", "缁撴潫杞﹀彿", "鍗婅溅鏍囧織", "澶囨敞"],
+      showCol: ["杞﹂棿", "缁勫埆", "寮�濮嬭溅鍙�", "缁撴潫杞﹀彿", "鏍囧織绫诲瀷", "澶囨敞"],
       tableColumn: [
         // { label: "杞﹂棿", prop: "workshopNumber",iconRight:"el-icon-setting"},
         { label: "杞﹂棿", prop: "workshopName", },
         { label: "缁勫埆", prop: "groupNumber", },
         { label: "寮�濮嬭溅鍙�", prop: "startCarNumber" },
         { label: "缁撴潫杞﹀彿", prop: "endCarNumber" },
-        { label: "鍗婅溅鏍囧織", prop: "carFlag", isCallMethod: true, getCallMethod: this.getStatusCarFlag },
+        { label: "鏍囧織绫诲瀷", prop: "carFlag", isCallMethod: true, getCallMethod: this.getStatusCarFlag },
         { label: "澶囨敞", prop: "notes", },
       ],
       // 绫诲瀷
@@ -79,16 +118,22 @@
     this.getData()
   },
   methods: {
+      refresh(){
+        this.getData();
+      },
     setTable() {
+        const obj={
+            selectIndex: true,
+            tableInfomation: [],
+            allcol: [],
+            showcol: this.showCol,
+            tableColumn: this.setColumnVisible(this.showCol, this.tableColumn)
+        };
       // top 鏄庣粏鍗曞垪琛�
-      this.tableList = {
-        selectIndex: true,
-        tableInfomation: [],
-        allcol: [],
-        showcol: this.showCol,
-        tableColumn: this.setColumnVisible(this.showCol, this.tableColumn)
-      }
-      this.setTableList(this.tableList)
+      this.tableList = {...obj};
+      this.bottomTableList={...obj};
+      this.setTableList(this.tableList);
+      this.setTableList(this.bottomTableList);
     },
     setColumnVisible(showCol, tableColumn) {
       return tableColumn.map((ele) => {
@@ -100,7 +145,7 @@
     },
     setTableList(tableList) {
       tableList.allcol = tableList.tableColumn.filter((ele) => !ele.default).map((ele) => ele.label)
-      this.searchOptions = []
+      this.searchOptions = [];
       for (let i = 0; i < tableList.tableColumn.length; i++) {
         const label = tableList.tableColumn[i].label
         const value = tableList.tableColumn[i].prop
@@ -113,7 +158,8 @@
     },
     // 琛ㄦ牸琛岀偣鍑�
     tableRowClick(row) {
-      console.log(row, "row")
+        this.selectRow={...row};
+        this.bottomTableList.tableInfomation=row.details||[];
     },
     // 鎼滅储
     onFilterSearch(searchText) {
@@ -123,8 +169,12 @@
     },
     // 鏂板
     addBtnClick() {
-      this.editConfig.infomitton = {}
-      this.editConfig.dialogTitle = "鏂板"
+      this.editConfig.infomitton = {
+          carFlag:1,
+          workshop:{}
+      };
+      this.editConfig.OperationType=1;
+      this.editConfig.title = "鏂板";
       this.editConfig.visible = true
     },
     // 淇濆瓨
@@ -133,10 +183,10 @@
     },
     // 鍒锋柊
     refreshClick() {
-      this.getDataParams.keyWord = ""
-      this.pagerOptions.currPage = 1
-      this.pagerOptions.pageSize = 15
-      this.$refs.searchRef.searchInput = ""
+      this.getDataParams.keyWord = "";
+      this.pagerOptions.currPage = 1;
+      this.pagerOptions.pageSize = 15;
+      this.$refs.searchRef.searchInput = "";
       this.getData()
     },
     // 鎵撳嵃
@@ -144,58 +194,65 @@
     // 鍒犻櫎
     delBtnClick() { },
     // 缁勫埆
-    handleShow() {
+ /*   handleShow() {
       this.$refs.bomTypeDialog.editDialogVisible = true;
-    },
+    },*/
     handleGetBomKindDictList() {
       // postGetBomKindDictList().then((res) => {
       //   this.workList = res.data;
       // });
     },
     handleConfirmSave(data) {
-      console.log(data)
-      // postSaveBomKindDict({ data: data }).then((res) => {
-      //   if (res.code == 200) {
-      //     this.$message({
-      //       message: "鎿嶄綔鎴愬姛锛�",
-      //       type: "success",
-      //     });
-      //     this.$refs.bomTypeDialog.editDialogVisible = false;
-      //     this.handleGetBomKindDictList();
-      //   }
-      // });
+      console.log(data);
     },
     // 杞﹂棿鍒楄〃
     async getData() {
       await getWorkshopManageList({
         keyWord: this.getDataParams.keyWord,
         page: this.pagerOptions.currPage,
-        pageSize: this.pagerOptions.pageSize
+        pageSize: this.pagerOptions.pageSize,
+        type:1
       }).then((res) => {
         this.tableList.tableInfomation = res.data
         this.pagerOptions.totalCount = res.total
-      })
+        if(res.data.length>0){
+            this.bottomTableList.tableInfomation=res.data[0].details||[];
+        }
+      });
     },
     getStatusCarFlag(val) {
-      if (val) {
-        return val == 1 ? '宸﹀崐杞�' : val == 2 ? '鍙冲崐杞�' : val == 3 ? '鍏ㄨ溅缁撴潫' : '--'
-      } else {
-        return "--";
-      }
+     if(val===0){
+         return '鍏ㄨ溅'
+     }else{
+         return '鍗婅溅'
+     }
     },
     handleClick(row, type) {
       if (type !== "鍒犻櫎") {
         this.editConfig.infomitton = {
           ...row,
           workshop:{
-            number:row.workshopNumber,
-            name:row.workshopName
+            workshopNumber:row.workshopNumber,
+            workshopName:row.workshopName
           }
-        }
+        };
         this.editConfig.infomitton.workshopId = row.ID
         this.editConfig.infomitton.workshopNumber = Number(this.editConfig.infomitton.workshopNumber)
-        this.editConfig.dialogTitle = type
-        this.editConfig.visible = true
+        this.editConfig.title = type;
+        if(type==='淇敼'){
+            this.editConfig.OperationType=2
+        }else{
+            this.editConfig.OperationType=3
+        }
+        this.editConfig.visible = true;
+        (row.details||[]).forEach((item,index)=>{
+            if(index<row.details.length-1){
+                item.noEdit=true;
+            }else{
+                item.noEdit=false;
+            }
+        });
+        this.$refs['workshopDialogRef'].initBottomTableList(row.details||[]);
       } else if (type === "鍒犻櫎") {
         this.$confirm(`纭鍒犻櫎鍚�?`, '鎻愮ず', {
           confirmButtonText: '纭畾',
@@ -235,19 +292,15 @@
     border-radius: 4px;
     background-color: #fff;
   }
-
-  .body-card {
+  .body-card,.body-card1 {
     margin: 0 30px;
     background-color: #fff;
     padding: 10px 15px;
-    height: calc(100% - 180px);
     border-radius: 4px;
-
     .edit-save {
       display: flex;
       align-items: center;
       margin-bottom: 10px;
-
       .edit-save-icon {
         font-size: 24px;
         color: #5582f3;
@@ -261,6 +314,34 @@
       }
     }
   }
+  .body-card{
+    height: calc(100% - 440px);
+  }
+  .body-card1{
+    margin-top: -50px;
+      height: calc(100% - 500px);
+      .bottom-tabs {
+        height: 40px;
+        line-height: 40px;
+        background: white;
+        display: flex;
+        .tab-pane {
+          width: 100px;
+          margin-right: 20px;
+          font-size: 14px !important;
+          text-align: center;
+          cursor: pointer;
+          background: #2a78fb;
+          border-top-left-radius: 20px;
+          border-top-right-radius: 20px;
+      }
+    }
+      padding-bottom: 100px;
+    .btn-pager{
+      position: relative;
+      top: -5px;
+    }
+  }
 }
 
 .list-view {
@@ -271,7 +352,6 @@
 .btn-pager {
   display: flex;
   margin-top: 10px;
-
   .page {
     margin-left: auto;
   }

--
Gitblit v1.8.0