From a5722a151e11707adb7957e0b6c58376f103acc7 Mon Sep 17 00:00:00 2001
From: haoxuan <haoxuan>
Date: 星期一, 15 四月 2024 18:04:57 +0800
Subject: [PATCH] 纤度登记表模块 根据车间组别庄口获取对应车号的接口联调+新增和编辑操作的时候,

---
 src/views/systemSetting/silkStandardSetting/index.vue |   60 ++++++++++++++++++++++++++++++++++++++++++++++++------------
 1 files changed, 48 insertions(+), 12 deletions(-)

diff --git a/src/views/systemSetting/silkStandardSetting/index.vue b/src/views/systemSetting/silkStandardSetting/index.vue
index f5a7c22..69b9182 100644
--- a/src/views/systemSetting/silkStandardSetting/index.vue
+++ b/src/views/systemSetting/silkStandardSetting/index.vue
@@ -3,15 +3,15 @@
     <div class="filter-card">
       <CommonSearch :show-add="false" :amount-view="false" placeholder="璇疯緭鍏ュ叧閿瘝" @searchClick="onFilterSearch">
         <template slot="leftButton">
-          <el-button size="small" type="primary" @click="addBtnClick" :disabled="!isEdit">鏂板</el-button>
+          <el-button size="small" type="primary" @click="addBtnClick">鏂板</el-button>
           <el-button size="small" type="primary" @click="refreshClick">鍒锋柊</el-button>
           <el-button size="small" type="primary" @click="printClick" disabled>鎵撳嵃</el-button>
         </template>
       </CommonSearch>
     </div>
     <div class="body-card">
-      <div class="edit-save">
-        <div class="edit-save-icon" @click="editSaveClick">
+      <div class="edit-save" @click="editSaveClick">
+        <div class="edit-save-icon">
           <i :class="isEdit ? 'el-icon-unlock' : 'el-icon-lock'"></i>
         </div>
         <div class="edit-sace-label">{{ isEdit ? "閿佸畾淇濆瓨" : "鐣岄潰璁捐" }}</div>
@@ -76,7 +76,7 @@
       projectOptions: getDataByType("projectOptions"),
       rankObj: {},
       columnInputList: [],
-      dynamicsRanks: []
+      dynamicsRanks: [],
     }
   },
   created() {
@@ -137,7 +137,14 @@
       this.silkTableList = {
         tableData: this.tableData,
         isReturn: false,
-        tableColumn: this.tableColumn
+        tableColumn: [
+          { label: "妫�鏌ラ」鐩悕绉�", prop: "projectName", projectName: true },
+          { label: "寮�濮嬬氦搴�", prop: "start", inputFloat: true },
+          { label: "缁撴潫绾ゅ害", prop: "end", inputFloat: true },
+          { label: "閲庣氦", prop: "price1", inputFloat: true },
+          { label: "澶ч噹", prop: "price2", inputFloat: true },
+          { label: "鐗归噹", prop: "price3", inputFloat: true }
+        ]
       }
     },
     // 鎼滅储
@@ -146,7 +153,19 @@
     },
     // 鏂板
     addBtnClick() {
-      this.tableData.push(this.dataObj)
+      if(this.isEdit){
+        this.tableData.push({
+          projectName: "",
+          start: 0,
+          end: 0,
+          price1: 0,
+          price2: 0,
+          price3: 0
+        })
+      }else{
+        this.$message.error('璇峰厛瑙i攣鍐嶆柊澧烇紒')
+      }
+      
     },
     // 鍒锋柊
     refreshClick() {
@@ -185,12 +204,18 @@
     // 淇濆瓨缂栬緫鎸夐挳鍒囨崲
     editSaveClick() {
       this.isEdit = !this.isEdit
+      let tableData=JSON.parse(
+                  JSON.stringify(this.silkTableList.tableData)
+                );
+        if(tableData.length==0&&!this.isEdit){
+          this.$message.error('璇峰厛鏂板鍐嶄繚瀛�!')
+          return true;
+        }
       if (!this.isEdit) {
-        let params = this.saveParam()
+        let params = this.saveParam(tableData)
         saveRankStandard({
           rankStandard: params
         }).then((res) => {
-          console.log(res)
           if (res.code == 200) {
             this.$message.success("淇濆瓨鎴愬姛")
             this.getData()
@@ -198,8 +223,18 @@
         })
       }
     },
-    saveParam() {
-      let saveList = this.tableData.map((item) => {
+    saveParam(tableData) {
+        for(let i in tableData){
+          tableData[i].dynamicsRanks=[]
+          for(let j in this.columnInputList){
+            tableData[i].dynamicsRanks.push({
+              rankName:this.columnInputList[j].rankName,
+              rankProp:this.columnInputList[j].rankProp,
+              rankValue:tableData[i][this.columnInputList[j].rankProp]
+           })
+          }
+        }
+      let saveList = tableData.map((item) => {
         return {
           checkItem: item.checkItem,
           dynamicsRanks: item.dynamicsRanks,
@@ -253,7 +288,6 @@
           item.rankName = val
         }
       })
-      console.log(this.columnInputList, "888")
     },
     getCheckItemName(val) {
       if (val) {
@@ -290,13 +324,15 @@
     height: calc(100% - 180px);
     border-radius: 4px;
     .edit-save {
+      width:100px;
+      padding:0  10px;
       display: flex;
       align-items: center;
       margin-bottom: 10px;
+      cursor: pointer;
       .edit-save-icon {
         font-size: 24px;
         color: #5582f3;
-        cursor: pointer;
       }
       .edit-sace-label {
         margin-left: 10px;

--
Gitblit v1.8.0