Explorar el Código

隐藏分拆单明细中的是否损耗字段

chensibo hace 2 días
padre
commit
dca5e5cc25

+ 96 - 94
src/views/wms/inLibrary/demergeOrder/components/SecondaryMaterials.vue

@@ -1,9 +1,7 @@
 <template>
   <el-card class="cards">
     <div slot="header">
-      <span class="card-title">
-        子卷信息
-      </span>
+      <span class="card-title"> 子卷信息 </span>
     </div>
     <el-row :gutter="10" class="mb5">
       <el-col :span="24" class="text-right">
@@ -15,7 +13,8 @@
           icon="el-icon-delete"
           class="text-danger"
           @click="handleDelete()"
-        >删除</el-button>
+          >删除</el-button
+        >
       </el-col>
     </el-row>
     <!-- 列表 -->
@@ -29,11 +28,7 @@
       :summary-method="getSummaries"
       @selection-change="handleSelectionChange"
     >
-      <el-table-column
-        type="selection"
-        width="55"
-        fixed="left"
-      />
+      <el-table-column type="selection" width="55" fixed="left" />
       <el-table-column
         label="条码号"
         align="center"
@@ -118,7 +113,9 @@
       >
         <template slot-scope="scope">
           <!-- <span v-if="paramsQuery.splitType === '0'">{{ scope.row.length }}</span> -->
-          <el-button type="text" @click="handleAccurate(scope.row)">{{ scope.row.length }}</el-button>
+          <el-button type="text" @click="handleAccurate(scope.row)">{{
+            scope.row.length
+          }}</el-button>
         </template>
       </el-table-column>
       <el-table-column
@@ -150,7 +147,8 @@
             size="mini"
             plain
             @click="handlePutBack({ id: scope.row.id, midbin: 0 })"
-          >放回原仓库</el-button>
+            >放回原仓库</el-button
+          >
           <el-button
             v-else
             v-hasPermi="['wms:split-order-detail:update']"
@@ -158,19 +156,20 @@
             size="mini"
             plain
             @click="handlePutBack({ id: scope.row.id, midbin: 1 })"
-          >放回中间仓</el-button>
+            >放回中间仓</el-button
+          >
         </template>
       </el-table-column>
-      <el-table-column
+      <!-- <el-table-column
         label="是否损耗"
         align="center"
         prop="lossFlag"
         width="80"
         show-overflow-tooltip
       >
-        <template slot-scope="scope">
-          <!-- <dict-tag :type="DICT_TYPE.WMS_SLITTING_MATERIAL_STATUS" :value="scope.row.status" /> -->
-          <el-button
+        <template slot-scope="scope"> -->
+      <!-- <dict-tag :type="DICT_TYPE.WMS_SLITTING_MATERIAL_STATUS" :value="scope.row.status" /> -->
+      <!-- <el-button
             v-if="scope.row.lossFlag === 1"
             v-hasPermi="['wms:split-order-detail:update']"
             type="success"
@@ -180,20 +179,16 @@
           >可用</el-button>
           <el-tag v-else type="danger" style="padding: 0 15px;">损耗</el-tag>
         </template>
-      </el-table-column>
-      <el-table-column
-        label="操作"
-        align="center"
-        fixed="right"
-        width="100"
-      >
+      </el-table-column> -->
+      <el-table-column label="操作" align="center" fixed="right" width="100">
         <template slot-scope="scope">
           <el-button
             size="mini"
             type="text"
             icon="el-icon-view"
             @click="handleViewLogs(scope.row)"
-          >操作日志</el-button>
+            >操作日志</el-button
+          >
         </template>
       </el-table-column>
       <!-- <el-table-column
@@ -215,12 +210,12 @@
 
       </el-table-column> -->
     </el-table>
-    <el-dialog
-      title="提示"
-      :visible.sync="dialogVisible"
-      width="25%"
-    >
-      <DictSelect v-model="currentRow.lossType" placeholder="请选择损耗状态" dict-type="SPLIT_LOSS_TYPE" />
+    <el-dialog title="提示" :visible.sync="dialogVisible" width="25%">
+      <DictSelect
+        v-model="currentRow.lossType"
+        placeholder="请选择损耗状态"
+        dict-type="SPLIT_LOSS_TYPE"
+      />
       <span slot="footer" class="dialog-footer">
         <el-button @click="dialogVisible = false">取 消</el-button>
         <el-button type="primary" @click="handleToLoss">确 定</el-button>
@@ -229,20 +224,23 @@
     <!-- 操作日志 -->
     <ViewLogs ref="viewLogs" />
     <AccurateDemergeVue ref="accurateDemergeVue" @saveAccurate="getList" />
-
   </el-card>
 </template>
 
 <script>
-import { toStock, createSplitDetailToloss, deleteSplitOrderDetail } from '@/api/wms/inLibrary/demergeOrder'
-import AccurateDemergeVue from './AccurateDemerge.vue'
-import ViewLogs from './ViewLogs.vue'
+import {
+  toStock,
+  createSplitDetailToloss,
+  deleteSplitOrderDetail,
+} from "@/api/wms/inLibrary/demergeOrder";
+import AccurateDemergeVue from "./AccurateDemerge.vue";
+import ViewLogs from "./ViewLogs.vue";
 
 export default {
-  name: 'SecondaryMaterials',
+  name: "SecondaryMaterials",
   components: {
     ViewLogs,
-    AccurateDemergeVue
+    AccurateDemergeVue,
   },
   data() {
     return {
@@ -259,69 +257,67 @@ export default {
       // 查询参数
       queryParams: {
         pageNo: 1,
-        pageSize: 10
+        pageSize: 10,
       },
       // 表单参数
       form: {},
       // 表单校验
-      rules: {
-      },
+      rules: {},
       // 当前选中当前行数据
       currentRow: {
         id: undefined,
-        lossType: undefined
+        lossType: undefined,
       },
       // 当前选中
-      currentRows: []
-    }
-  },
-  created() {
+      currentRows: [],
+    };
   },
+  created() {},
   methods: {
     getList() {
-      this.$emit('refresh')
+      this.$emit("refresh");
     },
     handleShowLossDialog(data) {
-      this.dialogVisible = true
-      Object.assign(this.currentRow, data)
+      this.dialogVisible = true;
+      Object.assign(this.currentRow, data);
     },
     // 小数点问题处理
     getHandleNumber(val) {
-      return Math.round((parseFloat(val) * 100000000)) / 100000000
+      return Math.round(parseFloat(val) * 100000000) / 100000000;
     },
     // 总计
     getSummaries(param) {
-      const { columns, data } = param
-      const sums = []
+      const { columns, data } = param;
+      const sums = [];
       columns.forEach((column, index) => {
         if (index === 0) {
-          sums[index] = '总计'
-          return
+          sums[index] = "总计";
+          return;
         }
 
-        const values = data.map(item => Number(item[column.property]))
-        if (column.property === 'qty') {
+        const values = data.map((item) => Number(item[column.property]));
+        if (column.property === "qty") {
           sums[index] = values.reduce((acc, cur) => {
-            const value = Number(cur)
+            const value = Number(cur);
             if (!isNaN(value)) {
-              return this.getHandleNumber(acc + cur)
+              return this.getHandleNumber(acc + cur);
             } else {
-              return acc
+              return acc;
             }
-          }, 0)
-          sums[index]
+          }, 0);
+          sums[index];
         }
-      })
-      return sums
+      });
+      return sums;
     },
     // 设为损耗
     handleToLoss() {
-      const { id, lossType } = this.currentRow
+      const { id, lossType } = this.currentRow;
       createSplitDetailToloss({ id, lossType }).then(() => {
-        this.dialogVisible = false
-        this.$modal.msgSuccess('操作成功!')
-        this.$emit('toLossSuccess')
-      })
+        this.dialogVisible = false;
+        this.$modal.msgSuccess("操作成功!");
+        this.$emit("toLossSuccess");
+      });
       // this.$modal.confirm('确认是否要将该物料设为损耗吗?').then(() => {
       //   const { id, lossType } = this.currentRow
       //   createSplitDetailToloss({ id, lossType }).then(() => {
@@ -334,57 +330,63 @@ export default {
       // })
     },
     handlePutBack({ id, midbin }) {
-      this.$modal.confirm(midbin ? '确认是否要将该物料放回中间仓?' : '确认是否要将该物料放回原仓库?').then(() => {
-        toStock({ id, midbin }).then(() => {
-          this.dialogVisible = false
-          this.$modal.msgSuccess('操作成功!')
-          this.$emit('toLossSuccess')
+      this.$modal
+        .confirm(
+          midbin
+            ? "确认是否要将该物料放回中间仓?"
+            : "确认是否要将该物料放回原仓库?"
+        )
+        .then(() => {
+          toStock({ id, midbin }).then(() => {
+            this.dialogVisible = false;
+            this.$modal.msgSuccess("操作成功!");
+            this.$emit("toLossSuccess");
+          });
         })
-      }).catch(() => {
-        this.$modal.msg('您已取消操作')
-      })
+        .catch(() => {
+          this.$modal.msg("您已取消操作");
+        });
     },
     // 二次拆分
     handleAccurate(row) {
-      this.$refs.accurateDemergeVue.queryParams = row
-      this.$refs.accurateDemergeVue.open = true
+      this.$refs.accurateDemergeVue.queryParams = row;
+      this.$refs.accurateDemergeVue.open = true;
     },
     // 选中的数据
     handleSelectionChange(val) {
-      this.currentRows = val
+      this.currentRows = val;
     },
     // 删除
-    async  handleDelete() {
+    async handleDelete() {
       if (this.currentRows.length === 0) {
-        this.$modal.msgWarning('请选择您要删除的数据!')
-        return
+        this.$modal.msgWarning("请选择您要删除的数据!");
+        return;
       }
-      await this.$modal.confirm('是否确认删除当前选中的数据项?')
+      await this.$modal.confirm("是否确认删除当前选中的数据项?");
       try {
-        const ids = this.currentRows.map(item => item.id)
+        const ids = this.currentRows.map((item) => item.id);
         const params = {
-          ids: ids?.join(',')
-        }
-        await deleteSplitOrderDetail(params)
-        await this.getList()
-        this.$modal.msgSuccess('删除成功')
+          ids: ids?.join(","),
+        };
+        await deleteSplitOrderDetail(params);
+        await this.getList();
+        this.$modal.msgSuccess("删除成功");
       } catch {
         //
       }
     },
     // 查看日志
     handleViewLogs(row) {
-      const { id } = row
-      this.$refs.viewLogs.queryParams.businessId = id
-      this.$refs.viewLogs.open = true
-    }
-  }
-}
+      const { id } = row;
+      this.$refs.viewLogs.queryParams.businessId = id;
+      this.$refs.viewLogs.open = true;
+    },
+  },
+};
 </script>
 
 <style scoped>
 .card-title {
   font-size: 14px;
 }
-
 </style>