From 73a92318e604724359ea65c5c232a0c818632e77 Mon Sep 17 00:00:00 2001
From: 小小儁爺 <1694218219@qq.com>
Date: 星期四, 31 十月 2024 16:56:47 +0800
Subject: [PATCH] 1.入库记录  新增删除功能

---
 src/views/statistic/storageRecord.vue |  137 ++++++++++++++++++++++++++++++++-------------
 1 files changed, 96 insertions(+), 41 deletions(-)

diff --git a/src/views/statistic/storageRecord.vue b/src/views/statistic/storageRecord.vue
index df33a98..8fa59d1 100644
--- a/src/views/statistic/storageRecord.vue
+++ b/src/views/statistic/storageRecord.vue
@@ -1,7 +1,8 @@
 <template>
   <div>
     <div class="body" :style="{height:mainHeight+'px'}">
-      <div class="bodyTopButtonGroup">
+      <div class="bodyTopButtonGroup" style="justify-content: space-between">
+        <el-button v-waves :disabled="multipleSelection.length===0" type="danger" icon="el-icon-delete" @click="del">鍒犻櫎</el-button>
         <el-button v-waves type="primary" icon="el-icon-download" @click="download">瀵煎嚭</el-button>
       </div>
 
@@ -17,22 +18,6 @@
             <el-form-item label="鍏ュ簱鍗曞彿" style="display: flex;">
               <el-input v-model="form.hbillno" placeholder="璇疯緭鍏�" style="width: 200px" />
             </el-form-item>
-            <!--            <el-form-item label="杞﹂棿鍚嶇О" style=" display: flex;">-->
-            <!--              <el-select-->
-            <!--                v-model="form.hbillno"-->
-            <!--                filterable-->
-            <!--                :popper-append-to-body="false"-->
-            <!--                style="width: 200px"-->
-            <!--                placeholder="璇烽�夋嫨"-->
-            <!--              >-->
-            <!--                <el-option-->
-            <!--                  v-for="item in xxxx1"-->
-            <!--                  :key="item.torg_code"-->
-            <!--                  :label="item.torg_name"-->
-            <!--                  :value="item.torg_code"-->
-            <!--                />-->
-            <!--              </el-select>-->
-            <!--            </el-form-item>-->
             <el-form-item label="閿�鍞崟鍙�" style=" display: flex;">
               <el-input v-model="form.sono" placeholder="璇疯緭鍏�" style="width: 200px" />
             </el-form-item>
@@ -63,7 +48,6 @@
                   :value="item.code"
                 />
               </el-select>
-              <!--              <el-input v-model="form.stockcode" style="width: 200px" placeholder="璇疯緭鍏�" />-->
             </el-form-item>
             <el-form-item v-show="isExpandForm" label="鍗曟嵁鏃ユ湡" style="display: flex;align-items: center">
               <el-date-picker
@@ -77,9 +61,6 @@
                 start-placeholder="寮�濮嬫棩鏈�"
                 end-placeholder="缁撴潫鏃ユ湡"
               />
-              <!--              font-size: 14px!important;-->
-              <!--              :picker-options="expireTimeOption"-->
-
             </el-form-item>
           </div>
           <div
@@ -122,7 +103,13 @@
           :header-cell-style="this.$headerCellStyle"
           :cell-style="this.$cellStyle"
           @sort-change="sortChange"
+          @selection-change="handleSelectionChange"
         >
+          <el-table-column
+            type="selection"
+            width="50"
+            fixed
+          />
           <el-table-column
             prop="rowNum"
             width="50"
@@ -246,7 +233,31 @@
             width="160"
             sortable="custom"
           />
-
+          <el-table-column
+            label="鎿嶄綔"
+            width="120"
+            fixed="right"
+          >
+            <template slot-scope="{row}">
+              <div class="operationClass">
+                <!--                <el-tooltip class="item" effect="dark" content="缂栬緫" placement="top">-->
+                <!--                  <i-->
+                <!--                    v-if="row.leve!==0"-->
+                <!--                    class="el-icon-edit-outline"-->
+                <!--                    :style="{color:$store.state.settings.theme}"-->
+                <!--                    @click="edit('edit',row)"-->
+                <!--                  />-->
+                <!--                </el-tooltip>-->
+                <el-tooltip v-del-tab-index class="item" effect="dark" content="鍒犻櫎" placement="top">
+                  <i
+                    class="el-icon-delete"
+                    :style="{color:$store.state.settings.theme}"
+                    @click="del(row)"
+                  />
+                </el-tooltip>
+              </div>
+            </template>
+          </el-table-column>
         </el-table>
       </div>
       <!--鍒嗛〉-->
@@ -309,6 +320,7 @@
 import ImportPicker from '@/components/ImportPicker'
 import { handleDatetime, validateCode } from '@/utils/global'
 import {
+  DeleteStorageRecord,
   GroupSalaryReportSearchUser, StorageRecordExcelSearch, StorageRecordSearch
 } from '@/api/ReportManager'
 import elDragDialog from '@/directive/el-drag-dialog'
@@ -371,7 +383,9 @@
 
       title_value: '鏁版嵁瀵煎叆 / 鐐规閮ㄤ綅',
       code: '4',
-      shows: false
+      shows: false,
+
+      multipleSelection: []
 
     }
   },
@@ -514,25 +528,62 @@
       //   this.dialogForm.SupUnit = row.parent_id
       // })
     },
+    handleSelectionChange(val) {
+      this.multipleSelection = val
+    },
     // 鍒犻櫎鎸夐挳
-    async del(row) {
-      // this.$confirm('鏄惁纭鍒犻櫎?', '鎻愮ず', {
-      //   confirmButtonText: '纭畾',
-      //   cancelButtonText: '鍙栨秷',
-      //   type: 'warning'
-      // }).then(() => {
-      //   DeleteOrganization({ orgid: row.code }).then(res => {
-      //     if (res.code === '200') {
-      //       this.$message.success('鍒犻櫎鎴愬姛!')
-      //       if (this.form.page > 1 && this.tableData.length === 1) {
-      //         this.form.page--
-      //       }
-      //       this.getStorageRecordSearch()
-      //     }
-      //   })
-      // }).catch(() => {
-      //   this.$message.info('宸插彇娑堝垹闄�')
-      // })
+    del(row) {
+      this.$confirm('鏄惁纭鍒犻櫎?', '鎻愮ず', {
+        confirmButtonText: '纭畾',
+        cancelButtonText: '鍙栨秷',
+        type: 'warning'
+      }).then(() => {
+        let data = []
+        if (row.create_date) { // 璇存槑鐐瑰嚮鐨勬椂 鍗曡鍒犻櫎
+          data = [
+            {
+              'hbillno': row.hbillno,
+              'salecode': row.salecode,
+              'mo_no': row.mo_no,
+              'wocode': row.wocode,
+              'partcode': row.partcode,
+              'qty': row.qty,
+              'wkshop_code': row.wkshp_code,
+              'stockcode': row.stockcode,
+              'inbarcode': row.inbarcode,
+              'step_code': row.step_code,
+              'style': row.style
+            }
+          ]
+        } else { // 璇存槑鏄壒閲忓垹闄�
+          this.multipleSelection.forEach(row => {
+            data.push({
+              'hbillno': row.hbillno,
+              'salecode': row.salecode,
+              'mo_no': row.mo_no,
+              'wocode': row.wocode,
+              'partcode': row.partcode,
+              'qty': row.qty,
+              'wkshop_code': row.wkshp_code,
+              'stockcode': row.stockcode,
+              'inbarcode': row.inbarcode,
+              'step_code': row.step_code,
+              'style': row.style
+            })
+          })
+        }
+        DeleteStorageRecord(data).then(res => {
+          if (res.code === '200') {
+            this.$message.success('鍒犻櫎鎴愬姛!')
+            if (this.form.page > 1 && this.tableData.length === 1) {
+              this.form.page--
+            }
+            this.getStorageRecordSearch()
+          }
+        })
+      }).catch(() => {
+        this.$message.info('宸插彇娑堝垹闄�')
+      })
     },
     // 瀵硅瘽妗嗗叧闂簨浠�
     handleClose() {
@@ -584,6 +635,10 @@
 </script>
 
 <style scoped lang="scss">
+
+::v-deep .el-icon-delete{
+  margin-right: 0 !important;
+}
 ::v-deep .el-select__caret {
   display: flex;
   align-items: center;

--
Gitblit v1.9.3