From 8b5bfdeb201b2653fb648f742b6d4ff5ff05ff6c Mon Sep 17 00:00:00 2001
From: lixiangyu <lixiangyu@xalxzn.com>
Date: 星期三, 27 八月 2025 17:59:29 +0800
Subject: [PATCH] refactor(刀具管理): 重构刀具管理相关组件结构

---
 src/views/cms/CuttingPropertiesList.vue    |  378 ++++++++++++++----
 src/views/cms/RatedLifeList.vue            |  428 ++++++++++++++-------
 src/views/cms/modules/CuttingToolModal.vue |  152 +++---
 src/views/cms/CuttingToolList.vue          |  155 +++++++
 src/views/cms/CuttingList.vue              |   78 +-
 5 files changed, 833 insertions(+), 358 deletions(-)

diff --git a/src/views/cms/CuttingList.vue b/src/views/cms/CuttingList.vue
index d042b3b..fe759dc 100644
--- a/src/views/cms/CuttingList.vue
+++ b/src/views/cms/CuttingList.vue
@@ -1,43 +1,43 @@
-<template >
-  <a-card :bordered="false" :body-style="{ padding: '0 24px 24px 24px' }">
-    <a-tabs default-active-key="1">
-      <a-tab-pane key="1" tab="鍒�鍏蜂俊鎭�">
-        <cutting-tool-list ref="cuttingToolList"></cutting-tool-list>
-      </a-tab-pane>
-      <a-tab-pane key="2" tab="鍒�鍏峰簱瀛�">
-        <cutting-inventory-list ref="cuttingInventoryList"></cutting-inventory-list>
-      </a-tab-pane>
-      <a-tab-pane key="3" tab="鍒�鍏烽瀹氬鍛�">
-        <rated-life-list ref="RatedLifeList"></rated-life-list>
-      </a-tab-pane>
-    </a-tabs>
-  </a-card>
-</template>
+<!--<template >-->
+<!--  <a-card :bordered="false" :body-style="{ padding: '0 24px 24px 24px' }">-->
+<!--    <a-tabs default-active-key="1">-->
+<!--      <a-tab-pane key="1" tab="鍒�鍏蜂俊鎭�">-->
+<!--        <cutting-tool-list ref="cuttingToolList"></cutting-tool-list>-->
+<!--      </a-tab-pane>-->
+<!--      <a-tab-pane key="2" tab="鍒�鍏峰簱瀛�">-->
+<!--        <cutting-inventory-list ref="cuttingInventoryList"></cutting-inventory-list>-->
+<!--      </a-tab-pane>-->
+<!--      <a-tab-pane key="3" tab="鍒�鍏烽瀹氬鍛�">-->
+<!--        <rated-life-list ref="RatedLifeList"></rated-life-list>-->
+<!--      </a-tab-pane>-->
+<!--    </a-tabs>-->
+<!--  </a-card>-->
+<!--</template>-->
 
-<script>
-import CuttingToolList from './CuttingToolList'
-import CuttingInventoryList from './CuttingInventoryList'
-import RatedLifeList from './RatedLifeList.vue'
+<!--<script>-->
+<!--import CuttingToolList from './CuttingToolList'-->
+<!--import CuttingInventoryList from './CuttingInventoryList'-->
+<!--import RatedLifeList from './RatedLifeList.vue'-->
 
-export default {
-  name: '鍒�鍏峰彴璐�',
-  components: {
-    CuttingToolList,
-    CuttingInventoryList,
-    RatedLifeList,
-  },
-  data() {
-    return {}
-  },
-  methods: {
-    callback(key) {
-      console.log('鍒囨崲鍒伴〉绛�:', key)
-    }
-  }
-}
-</script>
+<!--export default {-->
+<!--  name: '鍒�鍏峰彴璐�',-->
+<!--  components: {-->
+<!--    CuttingToolList,-->
+<!--    CuttingInventoryList,-->
+<!--    RatedLifeList,-->
+<!--  },-->
+<!--  data() {-->
+<!--    return {}-->
+<!--  },-->
+<!--  methods: {-->
+<!--    callback(key) {-->
+<!--      console.log('鍒囨崲鍒伴〉绛�:', key)-->
+<!--    }-->
+<!--  }-->
+<!--}-->
+<!--</script>-->
 
-<style scoped>
-@import '~@assets/less/common.less';
+<!--<style scoped>-->
+<!--@import '~@assets/less/common.less';-->
 
-</style>
+<!--</style>-->
diff --git a/src/views/cms/CuttingPropertiesList.vue b/src/views/cms/CuttingPropertiesList.vue
index 8d710c5..694e6d3 100644
--- a/src/views/cms/CuttingPropertiesList.vue
+++ b/src/views/cms/CuttingPropertiesList.vue
@@ -1,5 +1,17 @@
 <template>
   <a-card :bordered="false">
+    <!-- 鏂板鎸夐挳 -->
+    <div class="table-operator" style="margin-bottom: 10px;">
+      <a-button
+        @click="handleAdd"
+        type="primary"
+        icon="plus"
+        :disabled="queryParam.cuttingId === '-1' || !queryParam.cuttingId"
+      >
+        鏂板
+      </a-button>
+    </div>
+
     <!-- table鍖哄煙-begin -->
     <div>
       <a-table
@@ -35,23 +47,49 @@
           </a-button>
         </template>
 
-        <span slot="action" slot-scope="text, record">
-          <a @click="handleEdit(record)">缂栬緫</a>
+        <!-- 鍙紪杈戝崟鍏冩牸 -->
+        <template
+          v-for="col in ['propertyCode', 'propertyName', 'propertyUnit', 'propertyValue']"
+          :slot="col"
+          slot-scope="text, record"
+        >
+          <div :key="col">
+            <a-input
+              v-if="record.editable"
+              style="margin: -5px 0"
+              :value="text"
+              @change="e => handleChange(e.target.value, record.id, col)"
+            />
+            <template v-else>
+              {{ text }}
+            </template>
+          </div>
+        </template>
 
-          <a-divider type="vertical" />
-          <a-dropdown>
-            <a class="ant-dropdown-link">鏇村 <a-icon type="down" /></a>
-            <a-menu slot="overlay">
-              <a-menu-item>
-                <a @click="handleDetail(record)">璇︽儏</a>
-              </a-menu-item>
-              <a-menu-item>
-                <a-popconfirm title="纭畾鍒犻櫎鍚�?" @confirm="() => handleDelete(record.id)">
-                  <a>鍒犻櫎</a>
-                </a-popconfirm>
-              </a-menu-item>
-            </a-menu>
-          </a-dropdown>
+        <!-- 鎿嶄綔鍒� -->
+        <span slot="action" slot-scope="text, record">
+          <div class="editable-row-operations">
+            <span v-if="record.editable">
+              <a-popconfirm title="纭畾淇濆瓨?" @confirm="() => save(record.id)">
+                <a>淇濆瓨</a>
+              </a-popconfirm>
+              <a style="margin-left: 8px" @click="() => cancel(record.id)">鍙栨秷</a>
+            </span>
+            <span v-else>
+              <a :disabled="editingKey !== ''" @click="() => edit(record.id)">缂栬緫</a>
+              <a-divider type="vertical" />
+              <a-dropdown>
+                <a class="ant-dropdown-link">鏇村 <a-icon type="down" /></a>
+                <a-menu slot="overlay">
+                  <a-menu-item>
+                    <a-popconfirm title="纭畾鍒犻櫎鍚�?" @confirm="() => handleDelete(record.id)">
+                      <a>鍒犻櫎</a>
+                    </a-popconfirm>
+                  </a-menu-item>
+                </a-menu>
+              </a-dropdown>
+            </span>
+          </div>
         </span>
 
       </a-table>
@@ -60,91 +98,249 @@
 </template>
 
 <script>
+import '@/assets/less/TableExpand.less'
+import { mixinDevice } from '@/utils/mixin'
+import { JeecgListMixin } from '@/mixins/JeecgListMixin'
+import { putAction, getAction, postAction } from '@/api/manage'
 
-  import '@/assets/less/TableExpand.less'
-  import { mixinDevice } from '@/utils/mixin'
-  import { JeecgListMixin } from '@/mixins/JeecgListMixin'
-
-  export default {
-    name: 'CuttingPropertiesList',
-    mixins:[JeecgListMixin, mixinDevice],
-    components: {
-    },
-    data () {
-      return {
-        description: '鍒�鍏锋墿灞曞睘鎬х鐞嗛〉闈�',
-        // 琛ㄥご
-        columns: [
-          {
-            title: '#',
-            dataIndex: '',
-            key:'rowIndex',
-            width:60,
-            align:"center",
-            customRender:function (t,r,index) {
-              return parseInt(index)+1;
-            }
-          },
-          {
-            title:'灞炴�х紪鐮�',
-            align:"center",
-            dataIndex: 'propertyCode'
-          },
-          {
-            title:'灞炴�у悕绉�',
-            align:"center",
-            dataIndex: 'propertyName'
-          },
-          {
-            title:'璁¢噺鍗曚綅',
-            align:"center",
-            dataIndex: 'propertyUnit'
-          },
-          {
-            title:'灞炴�у��',
-            align:"center",
-            dataIndex: 'propertyValue'
+export default {
+  name: 'CuttingPropertiesList',
+  mixins:[JeecgListMixin, mixinDevice],
+  components: {
+  },
+  data () {
+    return {
+      description: '鍒�鍏锋墿灞曞睘鎬х鐞嗛〉闈�',
+      editingKey: '',
+      // 琛ㄥご
+      columns: [
+        {
+          title: '#',
+          dataIndex: '',
+          key:'rowIndex',
+          width:60,
+          align:"center",
+          customRender:function (t,r,index) {
+            return parseInt(index)+1;
           }
-        ],
-        url: {
-          list: "/cms/cuttingProperties/list",
-          delete: "/cms/cuttingProperties/delete",
-          deleteBatch: "/cms/cuttingProperties/deleteBatch",
-          exportXlsUrl: "/cms/cuttingProperties/exportXls",
-          importExcelUrl: "cms/cuttingProperties/importExcel",
-          
         },
-        dictOptions:{},
-        superFieldList:[],
-      }
-    },
-    created() {
+        {
+          title:'灞炴�х紪鐮�',
+          align:"center",
+          dataIndex: 'propertyCode',
+          scopedSlots: { customRender: 'propertyCode' }
+        },
+        {
+          title:'灞炴�у悕绉�',
+          align:"center",
+          dataIndex: 'propertyName',
+          scopedSlots: { customRender: 'propertyName' }
+        },
+        {
+          title:'璁¢噺鍗曚綅',
+          align:"center",
+          dataIndex: 'propertyUnit',
+          scopedSlots: { customRender: 'propertyUnit' }
+        },
+        {
+          title:'灞炴�у��',
+          align:"center",
+          dataIndex: 'propertyValue',
+          scopedSlots: { customRender: 'propertyValue' }
+        },
+        {
+          title: '鎿嶄綔',
+          dataIndex: 'action',
+          align:"center",
+          scopedSlots: { customRender: 'action' },
+          width: 200,
+        }
+      ],
+      url: {
+        list: "/cms/cuttingProperties/list",
+        delete: "/cms/cuttingProperties/delete",
+        deleteBatch: "/cms/cuttingProperties/deleteBatch",
+        exportXlsUrl: "/cms/cuttingProperties/exportXls",
+        importExcelUrl: "cms/cuttingProperties/importExcel",
+        edit: "/cms/cuttingProperties/edit",
+        add: "/cms/cuttingProperties/add" // 娣诲姞鏂板鎺ュ彛
+      },
+      dictOptions:{},
+      superFieldList:[],
+    }
+  },
+  created() {
     this.getSuperFieldList();
+  },
+  computed: {
+    importExcelUrl: function(){
+      return `${window._CONFIG['domianURL']}/${this.url.importExcelUrl}`;
     },
-    computed: {
-      importExcelUrl: function(){
-        return `${window._CONFIG['domianURL']}/${this.url.importExcelUrl}`;
-      },
+  },
+  methods: {
+    initDictConfig(){
     },
-    methods: {
-      initDictConfig(){
-      },
-      getSuperFieldList(){
-        let fieldList=[];
-        fieldList.push({type:'string',value:'cuttingId',text:'鍒�鍏稩D'})
-        fieldList.push({type:'string',value:'propertyCode',text:'灞炴�х紪鐮�'})
-        fieldList.push({type:'string',value:'propertyName',text:'灞炴�у悕绉�'})
-        fieldList.push({type:'string',value:'propertyUnit',text:'璁¢噺鍗曚綅'})
-        fieldList.push({type:'string',value:'propertyValue',text:'灞炴�у��'})
-        this.superFieldList = fieldList
-      },
-      getCuttingProperties(cuttingId) {
+    getSuperFieldList(){
+      let fieldList=[];
+      fieldList.push({type:'string',value:'cuttingId',text:'鍒�鍏稩D'})
+      fieldList.push({type:'string',value:'propertyCode',text:'灞炴�х紪鐮�'})
+      fieldList.push({type:'string',value:'propertyName',text:'灞炴�у悕绉�'})
+      fieldList.push({type:'string',value:'propertyUnit',text:'璁¢噺鍗曚綅'})
+      fieldList.push({type:'string',value:'propertyValue',text:'灞炴�у��'})
+      this.superFieldList = fieldList
+    },
+    getCuttingProperties(cuttingId) {
       this.queryParam.cuttingId = cuttingId;
       this.loadData(1);
     },
+
+    // 鏂板琛�
+    handleAdd() {
+      // 濡傛灉宸茬粡鍦ㄧ紪杈戠姸鎬侊紝涓嶅厑璁告柊澧�
+      if (this.editingKey !== '') {
+        // 鏌ユ壘姝e湪缂栬緫鐨勮褰曞苟鍙栨秷缂栬緫
+        const editingRecord = this.dataSource.find(item => item.id === this.editingKey);
+        if (editingRecord) {
+          this.cancel(this.editingKey);
+        }
+      }
+
+      // 鍒涘缓鏂扮殑绌烘暟鎹」
+      const newRow = {
+        id: 'new_' + new Date().getTime(), // 涓存椂ID
+        cuttingId: this.queryParam.cuttingId,
+        propertyCode: '',
+        propertyName: '',
+        propertyUnit: '',
+        propertyValue: '',
+        editable: true,
+        isNew: true // 鏍囪涓烘柊娣诲姞鐨勮
+      };
+
+      // 灏嗘柊琛屾彃鍏ュ埌鏁版嵁婧愬紑澶�
+      this.dataSource = [newRow, ...this.dataSource];
+      this.editingKey = newRow.id;
+    },
+
+    // 缂栬緫琛屾暟鎹�
+    edit(key) {
+      // 鍏堜繚瀛樺綋鍓嶆暟鎹殑鍓湰
+      const newData = [...this.dataSource];
+      const target = newData.find(item => key === item.id);
+      this.editingKey = key;
+
+      if (target) {
+        target.editable = true;
+        this.dataSource = newData;
+      }
+    },
+
+    // 淇濆瓨缂栬緫鐨勬暟鎹�
+    save(key) {
+      const newData = [...this.dataSource];
+      const target = newData.find(item => key === item.id);
+
+      if (target) {
+        delete target.editable;
+        this.dataSource = newData;
+
+        // 鍒ゆ柇鏄柊澧炶繕鏄紪杈�
+        if (target.isNew) {
+          // 鏂板鎿嶄綔
+          const params = { ...target };
+          delete params.id;
+          delete params.isNew;
+          // 鍒犻櫎鍒涘缓鏃堕棿瀛楁锛岃鍚庣鑷姩鐢熸垚
+          delete params.createTime;
+          delete params.updateTime;
+
+          postAction(this.url.add, params).then(res => {
+            if (res.success) {
+              this.$message.success('鏂板鎴愬姛');
+              this.editingKey = '';
+              this.loadData(); // 閲嶆柊鍔犺浇鏁版嵁
+            } else {
+              this.$message.error(res.message);
+            }
+          }).catch(err => {
+            this.$message.error('鏂板澶辫触');
+            console.log(err);
+          });
+        } else {
+          // 缂栬緫鎿嶄綔 - 鍙彂閫侀渶瑕佹洿鏂扮殑瀛楁
+          const params = {
+            id: target.id,
+            propertyCode: target.propertyCode,
+            propertyName: target.propertyName,
+            propertyUnit: target.propertyUnit,
+            propertyValue: target.propertyValue,
+            // 涓嶅寘鍚� createTime 瀛楁
+          };
+
+          putAction(this.url.edit, params).then(res => {
+            if (res.success) {
+              this.$message.success('淇濆瓨鎴愬姛');
+              this.editingKey = '';
+              this.loadData(); // 閲嶆柊鍔犺浇鏁版嵁
+            } else {
+              this.$message.error(res.message);
+            }
+          }).catch(err => {
+            this.$message.error('淇濆瓨澶辫触');
+            console.log(err);
+          });
+        }
+      }
+    },
+
+    // 鍙栨秷缂栬緫
+    cancel(key) {
+      const newData = [...this.dataSource];
+      const targetIndex = newData.findIndex(item => key === item.id);
+      this.editingKey = '';
+
+      if (targetIndex >= 0) {
+        // 濡傛灉鏄柊澧炵殑琛岋紝鐩存帴鍒犻櫎
+        if (newData[targetIndex].isNew) {
+          newData.splice(targetIndex, 1);
+          this.dataSource = newData;
+        } else {
+          // 濡傛灉鏄紪杈戠殑琛岋紝浠庡悗绔噸鏂拌幏鍙栨暟鎹互鎭㈠鍘熷鍊�
+          const target = newData[targetIndex];
+          getAction(this.url.list, { id: key }).then(res => {
+            if(res.success && res.result.records.length > 0) {
+              const originalData = res.result.records[0];
+              Object.keys(target).forEach(key => {
+                if(key !== 'editable') {
+                  target[key] = originalData[key];
+                }
+              });
+              delete target.editable;
+              this.dataSource = newData;
+            }
+          });
+        }
+      }
+    },
+
+    // 澶勭悊鍗曞厓鏍煎�煎彉鍖�
+    handleChange(value, key, column) {
+      const newData = [...this.dataSource];
+      const target = newData.find(item => key === item.id);
+
+      if (target) {
+        target[column] = value;
+        this.dataSource = newData;
+      }
     }
   }
+}
 </script>
+
 <style scoped>
-  @import '~@assets/less/common.less';
-</style>
\ No newline at end of file
+@import '~@assets/less/common.less';
+
+.editable-row-operations a {
+  margin-right: 8px;
+}
+</style>
diff --git a/src/views/cms/CuttingToolList.vue b/src/views/cms/CuttingToolList.vue
index 7094f06..aa83b79 100644
--- a/src/views/cms/CuttingToolList.vue
+++ b/src/views/cms/CuttingToolList.vue
@@ -121,9 +121,18 @@
       </a-table>
     </div>
 
-    <a-tabs defaultActiveKey="1">
+    <a-tabs defaultActiveKey="1" @change="onTabChange">
       <a-tab-pane tab="鎵╁睍灞炴��" key="1">
         <cutting-properties-list ref="cuttingPropertiesList"></cutting-properties-list>
+      </a-tab-pane>
+      <a-tab-pane key="2" tab="鍒�鍏峰簱瀛�">
+        <cutting-inventory-list ref="cuttingInventoryList"></cutting-inventory-list>
+      </a-tab-pane>
+      <a-tab-pane key="3" tab="鍒�鍏烽瀹氬鍛�">
+        <rated-life-list
+          ref="RatedLifeList"
+          :selected-cutting-id="selectedRowKeys.length > 0 ? selectedRowKeys[0] : ''">
+        </rated-life-list>
       </a-tab-pane>
     </a-tabs>
     <!-- table鍖哄煙-end -->
@@ -140,15 +149,20 @@
 import CuttingPropertiesList from './CuttingPropertiesList'
 import JDictSelectTag from '@/components/dict/JDictSelectTag'
 import JSearchSelectTag from '@/components/dict/JSearchSelectTag'
+import CuttingInventoryList from '@views/cms/CuttingInventoryList.vue'
+import RatedLifeList from '@views/cms/RatedLifeList.vue'
+import { getAction } from '@api/manage'
 
 export default {
   name: 'CuttingToolList',
   mixins: [JeecgListMixin, mixinDevice],
   components: {
+    RatedLifeList,
+    CuttingInventoryList,
     CuttingToolModal,
     CuttingPropertiesList,
     JDictSelectTag,
-    JSearchSelectTag
+    JSearchSelectTag,
   },
   data() {
     return {
@@ -255,12 +269,32 @@
         }
       };
     },
+
     onSelectChange(selectedRowKeys) {
+      console.log('Selected row keys:', selectedRowKeys);
       this.selectedRowKeys = selectedRowKeys;
       if (selectedRowKeys.length > 0) {
-        this.$refs.cuttingPropertiesList.getCuttingProperties(selectedRowKeys[0]);
+        console.log('Loading details for:', selectedRowKeys[0]);
+        const selectedId = selectedRowKeys[0];
+
+        // 浣跨敤 $nextTick 纭繚 DOM 鏇存柊瀹屾垚
+        this.$nextTick(() => {
+          // 妫�鏌ュ苟璋冪敤鍚勪釜瀛愮粍浠剁殑鏂规硶锛屾棤璁哄綋鍓嶅湪鍝釜椤电
+          if (this.$refs.cuttingPropertiesList) {
+            this.$refs.cuttingPropertiesList.getCuttingProperties(selectedId);
+          }
+
+          if (this.$refs.RatedLifeList) {
+            this.$refs.RatedLifeList.getRatedLife(selectedId);
+          }
+
+          if (this.$refs.cuttingInventoryList) {
+            this.$refs.cuttingInventoryList.getCuttingInventory(selectedId);
+          }
+        });
       }
     },
+
     handleEdit(record) {
       this.$refs.modalForm.edit(record);
       this.$refs.modalForm.title = '缂栬緫';
@@ -278,20 +312,127 @@
     },
     searchQuery() {
       this.selectedRowKeys = [];
-      this.$refs.cuttingPropertiesList.getCuttingProperties("-1");
-      this.$refs.cuttingPropertiesList.loadData();
-      this.$refs.cuttingPropertiesList.selectedRowKeys = [];
       this.loadData();
+
+      // 娓呯悊鎵�鏈夊瓙缁勪欢鐨勬暟鎹�
+      this.$nextTick(() => {
+        if (this.$refs.cuttingPropertiesList) {
+          this.$refs.cuttingPropertiesList.getCuttingProperties("-1");
+          this.$refs.cuttingPropertiesList.loadData();
+          this.$refs.cuttingPropertiesList.selectedRowKeys = [];
+        }
+
+        if (this.$refs.cuttingInventoryList) {
+          this.$refs.cuttingInventoryList.getCuttingInventory("-1");
+          this.$refs.cuttingInventoryList.selectedRowKeys = [];
+        }
+
+        if (this.$refs.RatedLifeList) {
+          this.$refs.RatedLifeList.getRatedLife("-1");
+          this.$refs.RatedLifeList.selectedRowKeys = [];
+        }
+      });
     },
+
     searchReset() {
       this.queryParam = {
         cuttingCode: '',
         cuttingName: '',
         cuttingCategory: ''
       };
-      this.$refs.cuttingPropertiesList.getCuttingProperties("-1");
+      this.selectedRowKeys = [];
       this.loadData();
+
+      // 娓呯悊鎵�鏈夊瓙缁勪欢鐨勬暟鎹�
+      this.$nextTick(() => {
+        if (this.$refs.cuttingPropertiesList) {
+          this.$refs.cuttingPropertiesList.getCuttingProperties("-1");
+          this.$refs.cuttingPropertiesList.selectedRowKeys = [];
+        }
+
+        if (this.$refs.cuttingInventoryList) {
+          this.$refs.cuttingInventoryList.getCuttingInventory("-1");
+          this.$refs.cuttingInventoryList.selectedRowKeys = [];
+        }
+
+        if (this.$refs.RatedLifeList) {
+          this.$refs.RatedLifeList.getRatedLife("-1");
+          this.$refs.RatedLifeList.selectedRowKeys = [];
+        }
+      });
     },
+
+    onClearSelected() {
+      this.selectedRowKeys = [];
+      this.selectionRows = [];
+      // 娓呯┖ CuttingPropertiesList 鍒楄〃鏁版嵁
+      this.$refs.cuttingPropertiesList.dataSource = [];
+      this.$refs.cuttingPropertiesList.selectedRowKeys = [];
+      this.$refs.cuttingPropertiesList.selectionRows = [];
+      this.$refs.cuttingPropertiesList.queryParam.cuttingId = "-1";
+    },
+
+    loadData(arg) {
+      if(!this.url.list){
+        this.$message.error("璇疯缃畊rl.list灞炴��!")
+        return
+      }
+      //鍔犺浇鏁版嵁 鑻ヤ紶鍏ュ弬鏁�1鍒欏姞杞界涓�椤电殑鍐呭
+      if (arg === 1) {
+        this.ipagination.current = 1;
+      }
+      var params = this.getQueryParams();//鏌ヨ鏉′欢
+      console.log('params',params)
+      if(!params){
+        return false;
+      }
+      this.loading = true;
+      getAction(this.url.list, params).then((res) => {
+        if (res.success) {
+          // console.log(res)
+          //update-begin---author:zhangyafei    Date:20201118  for锛氶�傞厤涓嶅垎椤电殑鏁版嵁鍒楄〃------------
+          this.dataSource = res.result.records||res.result;
+          if(res.result.total)
+          {
+            this.ipagination.total = res.result.total;
+          }else{
+            this.ipagination.total = 0;
+          }
+          //update-end---author:zhangyafei    Date:20201118  for锛氶�傞厤涓嶅垎椤电殑鏁版嵁鍒楄〃------------
+        }else{
+          this.$message.warning(res.message)
+        }
+      }).finally(() => {
+        this.loading = false
+      })
+    },
+
+    onTabChange(activeKey) {
+      // 褰撻〉绛惧垏鎹㈡椂锛屽鏋滃凡鏈夐�変腑鐨勫垁鍏凤紝绔嬪嵆鍔犺浇瀵瑰簲鐨勬暟鎹�
+      if (this.selectedRowKeys.length > 0) {
+        const selectedId = this.selectedRowKeys[0];
+        this.$nextTick(() => {
+          switch(activeKey) {
+            case '1':
+              if (this.$refs.cuttingPropertiesList) {
+                this.$refs.cuttingPropertiesList.getCuttingProperties(selectedId);
+              }
+              break;
+            case '2':
+              if (this.$refs.cuttingInventoryList) {
+                this.$refs.cuttingInventoryList.getCuttingInventory(selectedId);
+              }
+              break;
+            case '3':
+              if (this.$refs.RatedLifeList) {
+                this.$refs.RatedLifeList.getRatedLife(selectedId);
+              }
+              break;
+          }
+        });
+      }
+    },
+
     handleOk() {
       // 鏂板/淇敼 鎴愬姛鏃讹紝閲嶈浇鍒楄〃
       this.loadData();
diff --git a/src/views/cms/RatedLifeList.vue b/src/views/cms/RatedLifeList.vue
index dc721ec..0a7b55f 100644
--- a/src/views/cms/RatedLifeList.vue
+++ b/src/views/cms/RatedLifeList.vue
@@ -1,61 +1,19 @@
 <template>
   <a-card :bordered="false">
-    <!-- 鏌ヨ鍖哄煙 -->
-    <div class="table-page-search-wrapper">
-      <a-form layout="inline" @keyup.enter.native="searchQuery">
-        <a-row :gutter="24">
-          <a-col :md="6" :sm="8">
-            <a-form-item label="鍒�鍏风紪鐮�">
-              <a-input placeholder="璇疯緭鍏ュ垁鍏风紪鐮�" v-model="queryParam.cuttingId" />
-            </a-form-item>
-          </a-col>
-          <a-col :md="6" :sm="8">
-              <a-form-item label="宸ヤ欢鏉愯川">
-                <a-input placeholder="璇疯緭鍏ュ伐浠舵潗璐�" v-model="queryParam.workpieceMaterial" />
-              </a-form-item>
-            </a-col>
-            <a-col
-            :md="6"
-            :sm="8"
-          >
-            <span
-              style="float: left;overflow: hidden;"
-              class="table-page-search-submitButtons"
-            >
-              <a-button
-                type="primary"
-                @click="searchQuery"
-                icon="search"
-              >鏌ヨ</a-button>
-              <a-button
-                type="primary"
-                @click="searchReset"
-                icon="reload"
-                style="margin-left: 8px"
-              >閲嶇疆</a-button>
-            </span>
-          </a-col>
-        </a-row>
-      </a-form>
-    </div>
-    <!-- 鏌ヨ鍖哄煙-END -->
-
-    <!-- 鎿嶄綔鎸夐挳鍖哄煙 -->
-    <div class="table-operator">
-      <a-button @click="handleAdd" type="primary" icon="plus">鏂板</a-button>
-      <a-button type="primary" icon="download" @click="handleExportXls('棰濆畾瀵垮懡')">瀵煎嚭</a-button>
-      <a-upload name="file" :showUploadList="false" :multiple="false" :headers="tokenHeader" :action="importExcelUrl" @change="handleImportExcel">
-        <a-button type="primary" icon="import">瀵煎叆</a-button>
-      </a-upload>
+    <!-- 鏂板鎸夐挳 -->
+    <div class="table-operator" style="margin-bottom: 10px;">
+      <a-button
+        @click="handleAdd"
+        type="primary"
+        icon="plus"
+        :disabled="!selectedCuttingId || selectedCuttingId === '' || selectedCuttingId === '-1'"
+      >
+        鏂板
+      </a-button>
     </div>
 
     <!-- table鍖哄煙-begin -->
     <div>
-      <div class="ant-alert ant-alert-info" style="margin-bottom: 16px;">
-        <i class="anticon anticon-info-circle ant-alert-icon"></i> 宸查�夋嫨 <a style="font-weight: 600">{{ selectedRowKeys.length }}</a>椤�
-        <a style="margin-left: 24px" @click="onClearSelected">娓呯┖</a>
-      </div>
-
       <a-table
         ref="table"
         size="middle"
@@ -66,7 +24,6 @@
         :dataSource="dataSource"
         :pagination="ipagination"
         :loading="loading"
-        :rowSelection="{selectedRowKeys: selectedRowKeys, onChange: onSelectChange}"
         class="j-table-force-nowrap"
         @change="handleTableChange">
 
@@ -90,23 +47,49 @@
           </a-button>
         </template>
 
-        <span slot="action" slot-scope="text, record">
-          <a @click="handleEdit(record)">缂栬緫</a>
+        <!-- 鍙紪杈戝崟鍏冩牸 -->
+        <template
+          v-for="col in ['workpieceMaterial', 'ratedLife']"
+          :slot="col"
+          slot-scope="text, record"
+        >
+          <div :key="col">
+            <a-input
+              v-if="record.editable"
+              style="margin: -5px 0"
+              :value="text"
+              @change="e => handleChange(e.target.value, record.id, col)"
+            />
+            <template v-else>
+              {{ text }}
+            </template>
+          </div>
+        </template>
 
-          <a-divider type="vertical" />
-          <a-dropdown>
-            <a class="ant-dropdown-link">鏇村 <a-icon type="down" /></a>
-            <a-menu slot="overlay">
-              <a-menu-item>
-                <a @click="handleDetail(record)">璇︽儏</a>
-              </a-menu-item>
-              <a-menu-item>
-                <a-popconfirm title="纭畾鍒犻櫎鍚�?" @confirm="() => handleDelete(record.id)">
-                  <a>鍒犻櫎</a>
-                </a-popconfirm>
-              </a-menu-item>
-            </a-menu>
-          </a-dropdown>
+        <!-- 鎿嶄綔鍒� -->
+        <span slot="action" slot-scope="text, record">
+          <div class="editable-row-operations">
+            <span v-if="record.editable">
+              <a-popconfirm title="纭畾淇濆瓨?" @confirm="() => save(record.id)">
+                <a>淇濆瓨</a>
+              </a-popconfirm>
+              <a style="margin-left: 8px" @click="() => cancel(record.id)">鍙栨秷</a>
+            </span>
+            <span v-else>
+              <a :disabled="editingKey !== ''" @click="() => edit(record.id)">缂栬緫</a>
+              <a-divider type="vertical" />
+              <a-dropdown>
+                <a class="ant-dropdown-link">鏇村 <a-icon type="down" /></a>
+                <a-menu slot="overlay">
+                  <a-menu-item>
+                    <a-popconfirm title="纭畾鍒犻櫎鍚�?" @confirm="() => handleDelete(record.id)">
+                      <a>鍒犻櫎</a>
+                    </a-popconfirm>
+                  </a-menu-item>
+                </a-menu>
+              </a-dropdown>
+            </span>
+          </div>
         </span>
 
       </a-table>
@@ -117,91 +100,246 @@
 </template>
 
 <script>
+import '@/assets/less/TableExpand.less'
+import { mixinDevice } from '@/utils/mixin'
+import { JeecgListMixin } from '@/mixins/JeecgListMixin'
+import { putAction, getAction, postAction } from '@/api/manage'
+import RatedLifeModal from './modules/RatedLifeModal'
 
-  import '@/assets/less/TableExpand.less'
-  import { mixinDevice } from '@/utils/mixin'
-  import { JeecgListMixin } from '@/mixins/JeecgListMixin'
-  import RatedLifeModal from './modules/RatedLifeModal'
-
-  export default {
-    name: 'RatedLifeList',
-    mixins:[JeecgListMixin, mixinDevice],
-    components: {
-      RatedLifeModal
-    },
-    data () {
-      return {
-        description: '棰濆畾瀵垮懡绠$悊椤甸潰',
-        // 琛ㄥご
-        columns: [
-          {
-            title: '#',
-            dataIndex: '',
-            key:'rowIndex',
-            width:60,
-            align:"center",
-            customRender:function (t,r,index) {
-              return parseInt(index)+1;
-            }
-          },
-          {
-            title:'鍒�鍏风紪鐮�',
-            align:"center",
-            dataIndex: 'cuttingId',
-            sorter: true
-          },
-          {
-            title:'宸ヤ欢鏉愯川',
-            align:"center",
-            dataIndex: 'workpieceMaterial'
-          },
-          {
-            title:'棰濆畾瀵垮懡',
-            align:"center",
-            dataIndex: 'ratedLife'
-          },
-          {
-            title: '鎿嶄綔',
-            dataIndex: 'action',
-            align:"center",
-            fixed:"right",
-            width:147,
-            scopedSlots: { customRender: 'action' }
+export default {
+  name: 'RatedLifeList',
+  mixins:[JeecgListMixin, mixinDevice],
+  components: {
+    RatedLifeModal
+  },
+  props: {
+    selectedCuttingId: {
+      type: String,
+      default: ''
+    }
+  },
+  data () {
+    return {
+      description: '棰濆畾瀵垮懡绠$悊椤甸潰',
+      editingKey: '',
+      // 琛ㄥご
+      columns: [
+        {
+          title: '#',
+          dataIndex: '',
+          key:'rowIndex',
+          width:60,
+          align:"center",
+          customRender:function (t,r,index) {
+            return parseInt(index)+1;
           }
-        ],
-        url: {
-          list: "/cms/ratedLife/list",
-          delete: "/cms/ratedLife/delete",
-          deleteBatch: "/cms/ratedLife/deleteBatch",
-          exportXlsUrl: "/cms/ratedLife/exportXls",
-          importExcelUrl: "cms/ratedLife/importExcel",
-
         },
-        dictOptions:{},
-        superFieldList:[],
+        {
+          title:'鍒�鍏风紪鐮�',
+          align:"center",
+          dataIndex: 'cuttingId_dictText',
+          sorter: true
+        },
+        {
+          title:'宸ヤ欢鏉愯川',
+          align:"center",
+          dataIndex: 'workpieceMaterial',
+          scopedSlots: { customRender: 'workpieceMaterial' }
+        },
+        {
+          title:'棰濆畾瀵垮懡',
+          align:"center",
+          dataIndex: 'ratedLife',
+          scopedSlots: { customRender: 'ratedLife' }
+        },
+        {
+          title: '鎿嶄綔',
+          dataIndex: 'action',
+          align:"center",
+          scopedSlots: { customRender: 'action' },
+          width: 200,
+        }
+      ],
+      url: {
+        list: "/cms/ratedLife/list",
+        delete: "/cms/ratedLife/delete",
+        deleteBatch: "/cms/ratedLife/deleteBatch",
+        exportXlsUrl: "/cms/ratedLife/exportXls",
+        importExcelUrl: "cms/ratedLife/importExcel",
+        edit: "/cms/ratedLife/edit",
+        add: "/cms/ratedLife/add"
+      },
+      dictOptions:{},
+      superFieldList:[],
+    }
+  },
+  created() {
+    this.getSuperFieldList();
+  },
+  computed: {
+    importExcelUrl: function(){
+      return `${window._CONFIG['domianURL']}/${this.url.importExcelUrl}`;
+    },
+  },
+  methods: {
+    initDictConfig(){
+    },
+    getRatedLife(cuttingId) {
+      this.queryParam.cuttingId = cuttingId;
+      // this.ipagination.current = 1;
+      this.loadData(1);
+    },
+    getSuperFieldList(){
+      let fieldList=[];
+      fieldList.push({type:'string',value:'cuttingId',text:'鍒�鍏稩D'})
+      fieldList.push({type:'string',value:'workpieceMaterial',text:'宸ヤ欢鏉愯川'})
+      fieldList.push({type:'number',value:'ratedLife',text:'棰濆畾瀵垮懡'})
+      this.superFieldList = fieldList
+    },
+
+    // 鏂板琛�
+    handleAdd() {
+      // 濡傛灉宸茬粡鍦ㄧ紪杈戠姸鎬侊紝鑷姩鍙栨秷褰撳墠缂栬緫椤�
+      if (this.editingKey !== '') {
+        // 鏌ユ壘姝e湪缂栬緫鐨勮褰曞苟鍙栨秷缂栬緫
+        const editingRecord = this.dataSource.find(item => item.id === this.editingKey);
+        if (editingRecord) {
+          this.cancel(this.editingKey);
+        }
+      }
+
+      // 鍒涘缓鏂扮殑绌烘暟鎹」
+      const newRow = {
+        id: 'new_' + new Date().getTime(), // 涓存椂ID
+        cuttingId: this.queryParam.cuttingId,
+        workpieceMaterial: '',
+        ratedLife: '',
+        editable: true,
+        isNew: true // 鏍囪涓烘柊娣诲姞鐨勮
+      };
+
+      // 灏嗘柊琛屾彃鍏ュ埌鏁版嵁婧愬紑澶�
+      this.dataSource = [newRow, ...this.dataSource];
+      this.editingKey = newRow.id;
+    },
+
+    // 缂栬緫琛屾暟鎹�
+    edit(key) {
+      // 鍏堜繚瀛樺綋鍓嶆暟鎹殑鍓湰
+      const newData = [...this.dataSource];
+      const target = newData.find(item => key === item.id);
+      this.editingKey = key;
+
+      if (target) {
+        target.editable = true;
+        this.dataSource = newData;
       }
     },
-    created() {
-    this.getSuperFieldList();
+
+    // 淇濆瓨缂栬緫鐨勬暟鎹�
+    save(key) {
+      const newData = [...this.dataSource];
+      const target = newData.find(item => key === item.id);
+
+      if (target) {
+        delete target.editable;
+        this.dataSource = newData;
+
+        // 鍒ゆ柇鏄柊澧炶繕鏄紪杈�
+        if (target.isNew) {
+          // 鏂板鎿嶄綔
+          const params = { ...target };
+          delete params.id;
+          delete params.isNew;
+          // 鍒犻櫎鍒涘缓鏃堕棿瀛楁锛岃鍚庣鑷姩鐢熸垚
+          delete params.createTime;
+          delete params.updateTime;
+
+          postAction(this.url.add, params).then(res => {
+            if (res.success) {
+              this.$message.success('鏂板鎴愬姛');
+              this.editingKey = '';
+              this.loadData(); // 閲嶆柊鍔犺浇鏁版嵁
+            } else {
+              this.$message.error(res.message);
+            }
+          }).catch(err => {
+            this.$message.error('鏂板澶辫触');
+            console.log(err);
+          });
+        } else {
+          // 缂栬緫鎿嶄綔 - 鍙彂閫侀渶瑕佹洿鏂扮殑瀛楁
+          const params = {
+            id: target.id,
+            cuttingId: target.cuttingId,
+            workpieceMaterial: target.workpieceMaterial,
+            ratedLife: target.ratedLife,
+          };
+
+          putAction(this.url.edit, params).then(res => {
+            if (res.success) {
+              this.$message.success('淇濆瓨鎴愬姛');
+              this.editingKey = '';
+              this.loadData(); // 閲嶆柊鍔犺浇鏁版嵁
+            } else {
+              this.$message.error(res.message);
+            }
+          }).catch(err => {
+            this.$message.error('淇濆瓨澶辫触');
+            console.log(err);
+          });
+        }
+      }
     },
-    computed: {
-      importExcelUrl: function(){
-        return `${window._CONFIG['domianURL']}/${this.url.importExcelUrl}`;
-      },
+
+    // 鍙栨秷缂栬緫
+    cancel(key) {
+      const newData = [...this.dataSource];
+      const targetIndex = newData.findIndex(item => key === item.id);
+      this.editingKey = '';
+
+      if (targetIndex >= 0) {
+        // 濡傛灉鏄柊澧炵殑琛岋紝鐩存帴鍒犻櫎
+        if (newData[targetIndex].isNew) {
+          newData.splice(targetIndex, 1);
+          this.dataSource = newData;
+        } else {
+          // 濡傛灉鏄紪杈戠殑琛岋紝浠庡悗绔噸鏂拌幏鍙栨暟鎹互鎭㈠鍘熷鍊�
+          const target = newData[targetIndex];
+          getAction(this.url.list, { id: key }).then(res => {
+            if(res.success && res.result.records.length > 0) {
+              const originalData = res.result.records[0];
+              Object.keys(target).forEach(key => {
+                if(key !== 'editable') {
+                  target[key] = originalData[key];
+                }
+              });
+              delete target.editable;
+              this.dataSource = newData;
+            }
+          });
+        }
+      }
     },
-    methods: {
-      initDictConfig(){
-      },
-      getSuperFieldList(){
-        let fieldList=[];
-        fieldList.push({type:'string',value:'cuttingId',text:'鍒�鍏稩D'})
-        fieldList.push({type:'string',value:'workpieceMaterial',text:'宸ヤ欢鏉愯川'})
-        fieldList.push({type:'number',value:'ratedLife',text:'棰濆畾瀵垮懡'})
-        this.superFieldList = fieldList
+
+    // 澶勭悊鍗曞厓鏍煎�煎彉鍖�
+    handleChange(value, key, column) {
+      const newData = [...this.dataSource];
+      const target = newData.find(item => key === item.id);
+
+      if (target) {
+        target[column] = value;
+        this.dataSource = newData;
       }
     }
   }
+}
 </script>
+
 <style scoped>
-  @import '~@assets/less/common.less';
-</style>
\ No newline at end of file
+@import '~@assets/less/common.less';
+
+.editable-row-operations a {
+  margin-right: 8px;
+}
+</style>
diff --git a/src/views/cms/modules/CuttingToolModal.vue b/src/views/cms/modules/CuttingToolModal.vue
index dcec493..2da4777 100644
--- a/src/views/cms/modules/CuttingToolModal.vue
+++ b/src/views/cms/modules/CuttingToolModal.vue
@@ -76,94 +76,94 @@
           </a-col>
         </a-row>
         <!-- 瀛愯〃鏍间俊鎭�-->
-        <a-tabs defaultActiveKey="1">
-          <a-tab-pane
-            tab="鍒�鍏锋槑缁�"
-            key="1"
-          >
+<!--        <a-tabs defaultActiveKey="1">-->
+<!--          <a-tab-pane-->
+<!--            tab="鍒�鍏锋槑缁�"-->
+<!--            key="1"-->
+<!--          >-->
 
-            <a-table
-              ref="table"
-              bordered
-              size="middle"
-              rowKey="id"
-              :columns="columns"
-              :dataSource="dataSource"
-              :pagination=false
-            >
+<!--            <a-table-->
+<!--              ref="table"-->
+<!--              bordered-->
+<!--              size="middle"-->
+<!--              rowKey="id"-->
+<!--              :columns="columns"-->
+<!--              :dataSource="dataSource"-->
+<!--              :pagination=false-->
+<!--            >-->
 
-              <template
-                v-for="col in columns"
-                :slot="col.dataIndex"
-                slot-scope='text, record, index'
-              >
-                <div :key="col.dataIndex">
+<!--              <template-->
+<!--                v-for="col in columns"-->
+<!--                :slot="col.dataIndex"-->
+<!--                slot-scope='text, record, index'-->
+<!--              >-->
+<!--                <div :key="col.dataIndex">-->
 
 
 
-                  <a-input
-                    :value="text"
-                    :disabled="disableSubmit"
-                    v-if="col.dataIndex == 'propertyCode'"
-                    @change="(e)=>handleChange(e.target.value, record.key, col, index)"
-                  />
+<!--                  <a-input-->
+<!--                    :value="text"-->
+<!--                    :disabled="disableSubmit"-->
+<!--                    v-if="col.dataIndex == 'propertyCode'"-->
+<!--                    @change="(e)=>handleChange(e.target.value, record.key, col, index)"-->
+<!--                  />-->
 
-                  <a-input
-                    :value="text"
-                    :disabled="disableSubmit"
-                    v-else-if="col.dataIndex == 'propertyName'"
-                    @change="(e)=>handleChange(e.target.value, record.key, col, index)"
-                  />
+<!--                  <a-input-->
+<!--                    :value="text"-->
+<!--                    :disabled="disableSubmit"-->
+<!--                    v-else-if="col.dataIndex == 'propertyName'"-->
+<!--                    @change="(e)=>handleChange(e.target.value, record.key, col, index)"-->
+<!--                  />-->
 
-                  <a-input
-                    :value="text"
-                    :disabled="disableSubmit"
-                    v-else-if="col.dataIndex == 'propertyUnit'"
-                    @change="(e)=>handleChange(e.target.value, record.key, col, index)"
-                  />
+<!--                  <a-input-->
+<!--                    :value="text"-->
+<!--                    :disabled="disableSubmit"-->
+<!--                    v-else-if="col.dataIndex == 'propertyUnit'"-->
+<!--                    @change="(e)=>handleChange(e.target.value, record.key, col, index)"-->
+<!--                  />-->
 
-                  <a-input
-                    :value="text"
-                    :disabled="disableSubmit"
-                    v-else-if="col.dataIndex == 'propertyValue'"
-                    @change="(e)=>handleChange(e.target.value, record.key, col, index)"
-                  />
+<!--                  <a-input-->
+<!--                    :value="text"-->
+<!--                    :disabled="disableSubmit"-->
+<!--                    v-else-if="col.dataIndex == 'propertyValue'"-->
+<!--                    @change="(e)=>handleChange(e.target.value, record.key, col, index)"-->
+<!--                  />-->
 
-                </div>
-              </template>
+<!--                </div>-->
+<!--              </template>-->
 
-              <template
-                slot="action"
-                slot-scope="text,record,index"
-              >
-                <a-popconfirm
-                  title="鏄惁瑕佸垹闄ゆ琛岋紵"
-                  @confirm="handleDelete(text,record,index)"
-                >
-                  <Tooltip
-                    placement="top"
-                    title="鍒犻櫎"
-                  >
-                    <!-- shape="circle" -->
-                    <a-button
-                      :disabled="disableSubmit"
-                      icon="delete"
-                    />
-                  </Tooltip>
-                </a-popconfirm>
-              </template>
+<!--              <template-->
+<!--                slot="action"-->
+<!--                slot-scope="text,record,index"-->
+<!--              >-->
+<!--                <a-popconfirm-->
+<!--                  title="鏄惁瑕佸垹闄ゆ琛岋紵"-->
+<!--                  @confirm="handleDelete(text,record,index)"-->
+<!--                >-->
+<!--                  <Tooltip-->
+<!--                    placement="top"-->
+<!--                    title="鍒犻櫎"-->
+<!--                  >-->
+<!--                    &lt;!&ndash; shape="circle" &ndash;&gt;-->
+<!--                    <a-button-->
+<!--                      :disabled="disableSubmit"-->
+<!--                      icon="delete"-->
+<!--                    />-->
+<!--                  </Tooltip>-->
+<!--                </a-popconfirm>-->
+<!--              </template>-->
 
-            </a-table>
+<!--            </a-table>-->
 
-            <a-button
-              :disabled="disableSubmit"
-              style="width: 100%; margin-top: 16px; margin-bottom: 8px"
-              type="dashed"
-              icon="plus"
-              @click="addPropertiesList"
-            >娣诲姞鎵╁睍灞炴��</a-button>
-          </a-tab-pane>
-        </a-tabs>
+<!--            <a-button-->
+<!--              :disabled="disableSubmit"-->
+<!--              style="width: 100%; margin-top: 16px; margin-bottom: 8px"-->
+<!--              type="dashed"-->
+<!--              icon="plus"-->
+<!--              @click="addPropertiesList"-->
+<!--            >娣诲姞鎵╁睍灞炴��</a-button>-->
+<!--          </a-tab-pane>-->
+<!--        </a-tabs>-->
         <!-- 瀛愯〃鏍间俊鎭粨鏉�-->
       </a-form>
     </a-spin>

--
Gitblit v1.9.3