From 3cbfbac2def7eba8a8a7f07aa0ec4426799e8d2a Mon Sep 17 00:00:00 2001
From: zhangherong <571457620@qq.com>
Date: 星期六, 16 八月 2025 16:24:42 +0800
Subject: [PATCH] art: 物料拉动相关代码修改

---
 src/views/cms/CuttingToolList.vue |  362 ++++++++++++++++++++++++++-------------------------
 1 files changed, 184 insertions(+), 178 deletions(-)

diff --git a/src/views/cms/CuttingToolList.vue b/src/views/cms/CuttingToolList.vue
index f1fdce4..38825cc 100644
--- a/src/views/cms/CuttingToolList.vue
+++ b/src/views/cms/CuttingToolList.vue
@@ -10,38 +10,23 @@
             </a-form-item>
           </a-col>
           <a-col :md="6" :sm="8">
-              <a-form-item label="鍒�鍏峰悕绉�">
-                <a-input placeholder="璇疯緭鍏ュ垁鍏峰悕绉�" v-model="queryParam.cuttingName" />
-              </a-form-item>
-            </a-col>
+            <a-form-item label="鍒�鍏峰悕绉�">
+              <a-input placeholder="璇疯緭鍏ュ垁鍏峰悕绉�" v-model="queryParam.cuttingName" />
+            </a-form-item>
+          </a-col>
           <a-col :md="6" :sm="8">
-              <a-form-item label="鍒�鍏峰垎绫�">
-                <j-search-select-tag
-                  placeholder="璇烽�夋嫨鍒�鍏峰垎绫�"
-                  v-model="queryParam.cuttingCategory"
-                  dict="cutting_category"
-                />
-              </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>
+            <a-form-item label="鍒�鍏峰垎绫�">
+              <j-search-select-tag
+                placeholder="璇烽�夋嫨鍒�鍏峰垎绫�"
+                v-model="queryParam.cuttingCategory"
+                dict="cutting_category"
+              />
+            </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>
@@ -52,16 +37,23 @@
     <!-- 鎿嶄綔鎸夐挳鍖哄煙 -->
     <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="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> -->
+      </a-upload>
     </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>椤�
+        <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>
 
@@ -70,12 +62,12 @@
         size="middle"
         :scroll="{x:true}"
         bordered
-        rowKey="id"
+        :rowKey="record => record.id"
         :columns="columns"
         :dataSource="dataSource"
         :pagination="ipagination"
         :loading="loading"
-        :rowSelection="{selectedRowKeys: selectedRowKeys, onChange: onSelectChange,type:'radio'}"
+        :rowSelection="{selectedRowKeys: selectedRowKeys, onChange: onSelectChange, type:'radio'}"
         class="j-table-force-nowrap"
         :customRow="customRow"
         @change="handleTableChange">
@@ -83,10 +75,19 @@
         <template slot="htmlSlot" slot-scope="text">
           <div v-html="text"></div>
         </template>
+
         <template slot="imgSlot" slot-scope="text,record">
           <span v-if="!text" style="font-size: 12px;font-style: italic;">鏃犲浘鐗�</span>
-          <img v-else :src="getImgView(text)" :preview="record.id" height="25px" alt="" style="max-width:80px;font-size: 12px;font-style: italic;"/>
+          <img
+            v-else
+            :src="getImgView(text)"
+            :preview="record.id"
+            height="25px"
+            alt=""
+            style="max-width:80px;font-size: 12px;font-style: italic;"
+          />
         </template>
+
         <template slot="fileSlot" slot-scope="text">
           <span v-if="!text" style="font-size: 12px;font-style: italic;">鏃犳枃浠�</span>
           <a-button
@@ -102,7 +103,6 @@
 
         <span slot="action" slot-scope="text, record">
           <a @click="handleEdit(record)">缂栬緫</a>
-
           <a-divider type="vertical" />
           <a-dropdown>
             <a class="ant-dropdown-link">鏇村 <a-icon type="down" /></a>
@@ -118,165 +118,162 @@
             </a-menu>
           </a-dropdown>
         </span>
-
       </a-table>
     </div>
+
     <a-tabs defaultActiveKey="1">
       <a-tab-pane tab="鎵╁睍灞炴��" key="1">
         <cutting-properties-list ref="cuttingPropertiesList"></cutting-properties-list>
       </a-tab-pane>
-      <!-- <a-tab-pane tab="棰濆畾瀵垮懡" key="2">
-        <rated-life-list ref="ratedLifeList"></rated-life-list>
-      </a-tab-pane> -->
     </a-tabs>
     <!-- table鍖哄煙-end -->
-    <cutting-tool-modal ref="modalForm" @ok="modalFormOk"></cutting-tool-modal>
+
+    <cutting-tool-modal ref="modalForm" @ok="handleOk"></cutting-tool-modal>
   </a-card>
 </template>
 
 <script>
+import '@/assets/less/TableExpand.less'
+import { mixinDevice } from '@/utils/mixin'
+import { JeecgListMixin } from '@/mixins/JeecgListMixin'
+import CuttingToolModal from './modules/CuttingToolModal'
+import CuttingPropertiesList from './CuttingPropertiesList'
+import JDictSelectTag from '@/components/dict/JDictSelectTag'
+import JSearchSelectTag from '@/components/dict/JSearchSelectTag'
 
-  import '@/assets/less/TableExpand.less'
-  import { mixinDevice } from '@/utils/mixin'
-  import { JeecgListMixin } from '@/mixins/JeecgListMixin'
-  import CuttingToolModal from './modules/CuttingToolModal'
-  import CuttingPropertiesList from './CuttingPropertiesList'
-  import JDictSelectTag from '@/components/dict/JDictSelectTag'
-  import JSearchSelectTag from '@/components/dict/JSearchSelectTag'
-
-  export default {
-    name: 'CuttingToolList',
-    mixins:[JeecgListMixin, mixinDevice],
-    components: {
-      CuttingToolModal,CuttingPropertiesList, JDictSelectTag,
+export default {
+  name: 'CuttingToolList',
+  mixins: [JeecgListMixin, mixinDevice],
+  components: {
+    CuttingToolModal,
+    CuttingPropertiesList,
+    JDictSelectTag,
     JSearchSelectTag
-    },
-    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: 'cuttingCode'
-          },
-          {
-            title:'鍒�鍏峰悕绉�',
-            align:"center",
-            dataIndex: 'cuttingName'
-          },
-          {
-            title:'鍒�鍏峰垎绫�',
-            align:"center",
-            dataIndex: 'cuttingCategory'
-          },
-          {
-            title:'瀛樻斁浣嶇疆',
-            align:"center",
-            dataIndex: 'storeLocation'
-          },
-          {
-            title:'渚涘簲鍟�',
-            align:"center",
-            dataIndex: 'supplierId'
-          },
-          {
-            title:'鏈�灏忓寘瑁呭崟浣�',
-            align:"center",
-            dataIndex: 'minimumPackageUnit'
-          },
-          {
-            title:'鍒�鍏锋潗璐�',
-            align:"center",
-            dataIndex: 'cuttingMaterial'
-          },
-          {
-            title:'鍨嬪彿',
-            align:"center",
-            dataIndex: 'cuttingModel'
-          },
-          {
-            title:'鍥惧彿',
-            align:"center",
-            dataIndex: 'drawingNumber'
-          },
-          {
-            title:'搴撳瓨棰勮鍊�',
-            align:"center",
-            dataIndex: 'inventoryWarning'
-          },
-          {
-            title:'澶囨敞',
-            align:"center",
-            dataIndex: 'remark'
-          },
-          {
-            title: '鎿嶄綔',
-            dataIndex: 'action',
-            align:"center",
-            fixed:"right",
-            width:147,
-            scopedSlots: { customRender: 'action' }
-          }
-        ],
-        url: {
-          list: "/cms/cuttingTool/getCuttingToolList",
-          delete: "/cms/cuttingTool/delete",
-          deleteBatch: "/cms/cuttingTool/deleteBatch",
-          exportXlsUrl: "/cms/cuttingTool/exportXls",
-          importExcelUrl: "cms/cuttingTool/importExcel",
-          
+  },
+  data() {
+    return {
+      description: '鍒�鍏蜂俊鎭鐞嗛〉闈�',
+      columns: [
+        {
+          title: '#',
+          dataIndex: '',
+          key: 'rowIndex',
+          width: 60,
+          align: "center",
+          customRender: (t, r, index) => parseInt(index) + 1
         },
-        dictOptions:{},
-        superFieldList:[],
-      }
-    },
-    created() {
-      this.getSuperFieldList();
-    },
-    computed: {
-      importExcelUrl: function(){
-        return `${window._CONFIG['domianURL']}/${this.url.importExcelUrl}`;
+        {
+          title: '鍒�鍏风紪鐮�',
+          align: "center",
+          dataIndex: 'cuttingCode'
+        },
+        {
+          title: '鍒�鍏峰悕绉�',
+          align: "center",
+          dataIndex: 'cuttingName'
+        },
+        {
+          title: '鍒�鍏峰垎绫�',
+          align: "center",
+          dataIndex: 'cuttingCategory'
+        },
+        {
+          title: '瀛樻斁浣嶇疆',
+          align: "center",
+          dataIndex: 'storeLocation'
+        },
+        {
+          title: '渚涘簲鍟�',
+          align: "center",
+          dataIndex: 'supplierId'
+        },
+        {
+          title: '鏈�灏忓寘瑁呭崟浣�',
+          align: "center",
+          dataIndex: 'minimumPackageUnit'
+        },
+        {
+          title: '鍒�鍏锋潗璐�',
+          align: "center",
+          dataIndex: 'cuttingMaterial'
+        },
+        {
+          title: '鍨嬪彿',
+          align: "center",
+          dataIndex: 'cuttingModel'
+        },
+        {
+          title: '鍥惧彿',
+          align: "center",
+          dataIndex: 'drawingNumber'
+        },
+        {
+          title: '搴撳瓨棰勮鍊�',
+          align: "center",
+          dataIndex: 'inventoryWarning'
+        },
+        {
+          title: '澶囨敞',
+          align: "center",
+          dataIndex: 'remark'
+        },
+        {
+          title: '鎿嶄綔',
+          dataIndex: 'action',
+          align: "center",
+          fixed: "right",
+          width: 147,
+          scopedSlots: { customRender: 'action' }
+        }
+      ],
+      url: {
+        list: "/cms/cuttingTool/getCuttingToolList",
+        delete: "/cms/cuttingTool/delete",
+        deleteBatch: "/cms/cuttingTool/deleteBatch",
+        exportXlsUrl: "/cms/cuttingTool/exportXls",
+        importExcelUrl: "cms/cuttingTool/importExcel"
       },
-    },
-    methods: {
-      customRow(record) {
-        return {
+      dictOptions: {},
+      superFieldList: []
+    }
+  },
+  computed: {
+    importExcelUrl() {
+      return `${window._CONFIG['domianURL']}/${this.url.importExcelUrl}`;
+    }
+  },
+  created() {
+    this.getSuperFieldList();
+  },
+  methods: {
+    customRow(record) {
+      return {
         on: {
-          click: e => {
-            this.onSelectChange(record.id.split(","), [record]);
+          click: () => {
+            this.onSelectChange([record.id], [record]);
           }
         }
       };
-      },
-      onSelectChange(selectedRowKeys) {
-      this.selectedRowKeys = selectedRowKeys;
-      this.$refs.cuttingPropertiesList.getCuttingProperties(selectedRowKeys[0]);
     },
-    handleEdit: function (record) {
-        this.$refs.modalForm.edit(record)
-        this.$refs.modalForm.title = '缂栬緫'
-        this.$refs.modalForm.disableSubmit = false
+    onSelectChange(selectedRowKeys) {
+      this.selectedRowKeys = selectedRowKeys;
+      if (selectedRowKeys.length > 0) {
+        this.$refs.cuttingPropertiesList.getCuttingProperties(selectedRowKeys[0]);
+      }
+    },
+    handleEdit(record) {
+      this.$refs.modalForm.edit(record);
+      this.$refs.modalForm.title = '缂栬緫';
+      this.$refs.modalForm.disableSubmit = false;
     },
     handleAdd() {
-      this.$refs.modalForm.add()
-      this.$refs.modalForm.title = '鏂板'
-      this.$refs.modalForm.disableSubmit = false
+      this.$refs.modalForm.add();
+      this.$refs.modalForm.title = '鏂板';
+      this.$refs.modalForm.disableSubmit = false;
     },
-    handleDetail:function(record){
+    handleDetail(record) {
       this.$refs.modalForm.edit(record);
-      this.$refs.modalForm.title="璇︽儏";
+      this.$refs.modalForm.title = "璇︽儏";
       this.$refs.modalForm.disableSubmit = true;
     },
     searchQuery() {
@@ -287,15 +284,24 @@
       this.loadData();
     },
     searchReset() {
-      this.queryParam.cuttingCode = '';
-      this.queryParam.cuttingName = '';
-      this.queryParam.cuttingCategory = '';
+      this.queryParam = {
+        cuttingCode: '',
+        cuttingName: '',
+        cuttingCategory: ''
+      };
       this.$refs.cuttingPropertiesList.getCuttingProperties("-1");
       this.loadData();
     },
-    }
+    handleOk() {
+      // 鏂板/淇敼 鎴愬姛鏃讹紝閲嶈浇鍒楄〃
+      this.loadData();
+      //娓呯┖鍒楄〃閫変腑
+      this.onClearSelected()
+    },
   }
+}
 </script>
+
 <style scoped>
-  @import '~@assets/less/common.less';
+@import '~@assets/less/common.less';
 </style>
\ No newline at end of file

--
Gitblit v1.9.3