Procházet zdrojové kódy

修改订单管理删除接口

lph před 1 rokem
rodič
revize
ffab1d0d4d

+ 17 - 3
zkqy-ui/src/views/orderMange/approve.vue

@@ -175,13 +175,27 @@
         class-name="small-padding fixed-width"
       >
         <template slot-scope="scope">
-          <el-button
+          <!-- <el-button
             type="info"
             size="default"
             @click="handleEdit(scope.$index, scope.row)"
             >审批</el-button
-          >
-
+          > -->
+          <el-dropdown>
+            <el-button type="warning" plain size="small">
+              处理<i class="el-icon-arrow-down el-icon--right"></i>
+            </el-button>
+            <el-dropdown-menu slot="dropdown">
+              <el-dropdown-item>
+                <el-button
+                  type="text"
+                  size="mini"
+                  @click="handleEdit(scope.$index, scope.row)"
+                  >审批</el-button
+                >
+              </el-dropdown-item>
+            </el-dropdown-menu>
+          </el-dropdown>
           <Menu
             :row="scope.row"
             v-for="btnObj in excuteBtnArr"

+ 48 - 12
zkqy-ui/src/views/orderMange/index.vue

@@ -87,7 +87,7 @@
           icon="el-icon-delete"
           size="mini"
           :disabled="multiple"
-          @click="batchDelete"
+          @click="myDeleteHandler"
           >删除
         </el-button>
       </el-col>
@@ -136,7 +136,7 @@
       ref="tableRef"
       :cell-style="cellStyle"
       :reserve-selection="true"
-      :row-key="getRowKey"
+      row-key="saleOrderId"
     >
       <el-table-column
         type="selection"
@@ -440,11 +440,6 @@
             </el-table-column>
             <el-table-column prop="productAmounts" label="金额">
               <template slot-scope="scope">
-                <!-- <el-input
-                  v-model="scope.row.productAmounts"
-                  size="small"
-                  clearable
-                ></el-input> -->
                 {{ scope.row.productAmounts }}
               </template>
             </el-table-column>
@@ -725,6 +720,7 @@ import {
   getStatisticList,
   getTableList1,
   checkOrderNo,
+  delOrder,
 } from "@/api/tablelist/commonTable";
 import { listData } from "@/api/system/tenant/data";
 import { getToken } from "@/utils/auth";
@@ -745,6 +741,7 @@ export default {
   components: { Queryfrom, Menu, DialogTemplate },
   data() {
     return {
+      myDelIds: [], //新增接口 删除的id
       // 详情弹窗数据
       detailShow: false,
       printDomData: "",
@@ -1212,7 +1209,8 @@ export default {
               btnName: "编辑",
               btnType: "myEdit",
               btnIcon: "",
-              btnShowCondition: "",
+              btnShowCondition:
+                '[{"fieldName":"sale_order.status","mark":"6","refValue":"1"}]',
               children: [],
             },
             {
@@ -1221,6 +1219,14 @@ export default {
               btnIcon: "",
               btnShowCondition: "",
               children: [],
+            },
+            {
+              btnName: "删除",
+              btnType: "myDelete",
+              btnIcon: "",
+              btnShowCondition:
+                '[{"fieldName":"sale_order.status","mark":"6","refValue":"1"}]',
+              children: [],
             }
           );
           // }
@@ -1273,9 +1279,9 @@ export default {
             // });
             this.tableList = await this.setFieldStyleData(tempTableList);
             this.total = res.total;
-            // this.$nextTick(() => {
-            //   this.$refs.tableRef?.clearSelection();
-            // });
+            this.$nextTick(() => {
+              this.$refs.tableRef?.clearSelection();
+            });
             this.loading = false;
           });
 
@@ -1331,6 +1337,7 @@ export default {
         if (valid) {
           console.log(valid);
           let {
+            id,
             //订单表数据
             saleNo,
             saleCustomNo,
@@ -1451,7 +1458,8 @@ export default {
             Object.keys(craftValue).map((k) => {
               craftData.commMap[k] = craftValue[k];
             });
-            saleData.conditionMap.saleNo = saleValue.saleNo;
+            // saleData.conditionMap.saleNo = saleValue.saleNo;
+            saleData.conditionMap.id = this.formData.id;
             craftData.conditionMap.saleCraftNo = craftValue.saleCraftNo;
             // for(let i = 0;i<this.)
             let deletPayload = {
@@ -1720,6 +1728,8 @@ export default {
       //       )
       //     ]
       // );
+      this.myDelIds = selection.map((item) => item.saleOrderId);
+      console.log(this.myDelIds);
       this.ids = selection.map((item) => item.saleOrderSaleNo);
       this.single = selection.length != 1;
       this.multiple = !selection.length;
@@ -2743,6 +2753,30 @@ export default {
         //         </tr>
       }
     },
+    // 自定义删除按钮
+    async myDeleteHandler(row) {
+      console.log(row);
+      await this.$confirm("是否确认删除选中的数据?", "警告", {
+        confirmButtonText: "确定",
+        cancelButtonText: "取消",
+        type: "warning",
+      });
+      let payLoad = row.saleOrderId ? [row.saleOrderId] : this.myDelIds;
+      console.log(payLoad);
+      try {
+        let res = await delOrder(payLoad);
+        if (res.code === 200) {
+          this.$message.success("删除成功");
+          this.getList();
+          this.myDelIds = [];
+          // this.$nextTick(() => {
+          //   this.$refs.tableRef?.clearSelection();
+          // });
+        } else {
+          this.$message.error(res.msg);
+        }
+      } catch (error) {}
+    },
 
     // 操作列回调
     excuteHandler(btnData, row) {
@@ -2780,6 +2814,8 @@ export default {
         case "myDetail":
           this.handleDetail(row);
           break;
+        case "myDelete":
+          this.myDeleteHandler(row, btnData);
         default:
           break;
       }