فهرست منبع

外协订单、加工订单,打印送货单添加累计欠款、客户管理添加累计欠款、零售单添加付款方式

xuezizhuo 1 سال پیش
والد
کامیت
276ff8f8a8
25فایلهای تغییر یافته به همراه5612 افزوده شده و 113 حذف شده
  1. 76 0
      zkqy-custom-business/src/main/java/com/zkqy/business/controller/SaleOrderController.java
  2. 12 1
      zkqy-custom-business/src/main/java/com/zkqy/business/domain/Customer.java
  3. 90 34
      zkqy-custom-business/src/main/java/com/zkqy/business/domain/SaleOrder.java
  4. 11 0
      zkqy-custom-business/src/main/java/com/zkqy/business/domain/vo/ProductInvoiceVO.java
  5. 95 0
      zkqy-custom-business/src/main/java/com/zkqy/business/domain/vo/SaleOrderVO.java
  6. 8 0
      zkqy-custom-business/src/main/java/com/zkqy/business/mapper/SaleCraftMapper.java
  7. 15 0
      zkqy-custom-business/src/main/java/com/zkqy/business/mapper/SaleOrderMapper.java
  8. 7 0
      zkqy-custom-business/src/main/java/com/zkqy/business/mapper/SaleProductsMapper.java
  9. 47 0
      zkqy-custom-business/src/main/java/com/zkqy/business/service/ISaleOrderService.java
  10. 2 0
      zkqy-custom-business/src/main/java/com/zkqy/business/service/impl/CustomerServiceImpl.java
  11. 11 0
      zkqy-custom-business/src/main/java/com/zkqy/business/service/impl/ProductInvoiceServiceImpl.java
  12. 105 0
      zkqy-custom-business/src/main/java/com/zkqy/business/service/impl/SaleOrderServiceImpl.java
  13. 52 9
      zkqy-custom-business/src/main/resources/mapper/business/CustomerMapper.xml
  14. 11 11
      zkqy-custom-business/src/main/resources/mapper/business/SaleCraftMapper.xml
  15. 73 19
      zkqy-custom-business/src/main/resources/mapper/business/SaleOrderMapper.xml
  16. 10 0
      zkqy-custom-business/src/main/resources/mapper/business/SaleProductsMapper.xml
  17. 53 0
      zkqy-ui/src/api/system/outsourceOrder.js
  18. 7 3
      zkqy-ui/src/utils/print/sendOrderPrint.js
  19. 8 22
      zkqy-ui/src/views/orderMange/customerMange/index.vue
  20. 1 0
      zkqy-ui/src/views/orderMange/index.vue
  21. 1279 0
      zkqy-ui/src/views/orderMange/order/outsourceOrder.vue
  22. 3583 0
      zkqy-ui/src/views/orderMange/order/processingOrder.vue
  23. 51 12
      zkqy-ui/src/views/orderMange/retailMange/index.vue
  24. 3 0
      zkqy-ui/src/views/orderMange/statisticalAnalysis/customerStatistics.vue
  25. 2 2
      zkqy-ui/src/views/orderMange/statisticalAnalysis/fastSellingProduct.vue

+ 76 - 0
zkqy-custom-business/src/main/java/com/zkqy/business/controller/SaleOrderController.java

@@ -142,6 +142,7 @@ public class SaleOrderController extends BaseController {
     public TableDataInfo saleOrderList(SaleOrder saleOrder){
         startPage();
         List<SaleOrderVO> list = saleOrderService.saleOrderList(saleOrder);
+        System.err.println(saleOrder);
         return getDataTable(list);
     }
 
@@ -213,6 +214,77 @@ public class SaleOrderController extends BaseController {
         return toAjax(saleOrderService.updateOrder(saleOrder));
     }
 
+    /**
+     * 外协订单列表
+     */
+    @GetMapping("/outsourceOrderList")
+    public TableDataInfo outsourceOrderList(SaleOrder saleOrder){
+        startPage();
+        List<SaleOrderVO> list = saleOrderService.outsourceOrderList(saleOrder);
+        return getDataTable(list);
+    }
+
+    /**
+     * 新增外协订单
+     */
+    @PostMapping("/addOutsourceOrder")
+    public AjaxResult addOutsourceOrder(@RequestBody SaleOrderVO vo) {
+        return toAjax(saleOrderService.addOutsourceOrder(vo));
+    }
+
+    /**
+     * 外协订单详情
+     */
+    @GetMapping("/getOutsourceOrderInfo/{saleNo}")
+    public AjaxResult getOutsourceOrderInfo(@PathVariable String saleNo) {
+        return success(saleOrderService.getOutsourceOrderInfo(saleNo));
+    }
+
+
+    /**
+     * 修改外协订单
+     */
+    @PutMapping("/editOutsourceOrder")
+    public AjaxResult editOutsourceOrder(@RequestBody SaleOrderVO vo) {
+        return toAjax(saleOrderService.editOutsourceOrder(vo));
+    }
+
+    /**
+     * 删除外协订单
+     */
+    @DeleteMapping("/deleteOutsourceOrder/{saleNos}")
+    public AjaxResult deleteOutsourceOrder(@PathVariable List<String> saleNos) {
+        System.err.println(saleNos);
+        return toAjax(saleOrderService.deleteOutsourceOrder(saleNos));
+    }
+
+    /**
+     * 提交订单
+     */
+    @GetMapping("/submitOutsourceOrder/{id}")
+    public AjaxResult submitOutsourceOrder(@PathVariable Long id) {
+        return toAjax(saleOrderService.submitOutsourceOrder(id));
+    }
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
     /**
      * 查询销售单下单前10名客户信息单据数量货品总量
      */
@@ -277,4 +349,8 @@ public class SaleOrderController extends BaseController {
         return AjaxResult.success(saleOrderService.fastSellingProduct(map));
     }
 
+
+
+
+
 }

+ 12 - 1
zkqy-custom-business/src/main/java/com/zkqy/business/domain/Customer.java

@@ -83,7 +83,18 @@ public class Customer extends BaseEntity
 
     private String queryParam;
 
-    public void setId(Long id) 
+    /** 累计欠款 */
+    private Double amounts;
+
+    public Double getAmounts() {
+        return amounts;
+    }
+
+    public void setAmounts(Double amounts) {
+        this.amounts = amounts;
+    }
+
+    public void setId(Long id)
     {
         this.id = id;
     }

+ 90 - 34
zkqy-custom-business/src/main/java/com/zkqy/business/domain/SaleOrder.java

@@ -130,9 +130,40 @@ public class SaleOrder extends BaseEntity
     /** 完成时间 */
     private Date completionTime;
 
+    /** 加工单位 */
+    private String processingUnit;
+
+    /** 联系人 */
+    private String contactPerson;
+
+    /** 地址 */
+    private String address;
+
+    /** 领料类型 */
+    private String materialType;
+
+    /** 外协订单付款方式 */
+    private String outsourceSalePayType;
+
     //超级查询
     private String queryParam;
 
+    public String getOutsourceSalePayType() {
+        return outsourceSalePayType;
+    }
+
+    public void setOutsourceSalePayType(String outsourceSalePayType) {
+        this.outsourceSalePayType = outsourceSalePayType;
+    }
+
+    public String getMaterialType() {
+        return materialType;
+    }
+
+    public void setMaterialType(String materialType) {
+        this.materialType = materialType;
+    }
+
     public String getLotNumber() {
         return lotNumber;
     }
@@ -400,41 +431,66 @@ public class SaleOrder extends BaseEntity
         this.completionTime = completionTime;
     }
 
+    public String getProcessingUnit() {
+        return processingUnit;
+    }
+
+    public void setProcessingUnit(String processingUnit) {
+        this.processingUnit = processingUnit;
+    }
+
+    public String getContactPerson() {
+        return contactPerson;
+    }
+
+    public void setContactPerson(String contactPerson) {
+        this.contactPerson = contactPerson;
+    }
+
+    public String getAddress() {
+        return address;
+    }
+
+    public void setAddress(String address) {
+        this.address = address;
+    }
+
     @Override
     public String toString() {
-        return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
-            .append("id", getId())
-            .append("saleNo", getSaleNo())
-            .append("saleCustomNo", getSaleCustomNo())
-            .append("saleDate", getSaleDate())
-            .append("saleEstimatedTime", getSaleEstimatedTime())
-            .append("saleLeadTime", getSaleLeadTime())
-            .append("saleProductsNo", getSaleProductsNo())
-            .append("saleAmounts", getSaleAmounts())
-            .append("saleAmountInWords", getSaleAmountInWords())
-            .append("salePayType", getSalePayType())
-            .append("saleOrderEstimatedTime", getSaleOrderEstimatedTime())
-            .append("saleOrderTechnologyNo", getSaleOrderTechnologyNo())
-            .append("salesman", getSalesman())
-            .append("saleLeader", getSaleLeader())
-            .append("finance", getFinance())
-            .append("production", getProduction())
-            .append("saleApprover", getSaleApprover())
-            .append("status", getStatus())
-            .append("orderType", getOrderType())
-            .append("remark", getRemark())
-            .append("createById", getCreateById())
-            .append("createBy", getCreateBy())
-            .append("createTime", getCreateTime())
-            .append("updateById", getUpdateById())
-            .append("updateBy", getUpdateBy())
-            .append("updateTime", getUpdateTime())
-            .append("delFlag", getDelFlag())
-            .append("taskProcessKey", getTaskProcessKey())
-            .append("taskNodeKey", getTaskNodeKey())
-            .append("processKey", getProcessKey())
-            .append("earnestMoney", getEarnestMoney())
-            .append("deliveryDate", getDeliveryDate())
-            .toString();
+        return "SaleOrder{" +
+                "id=" + id +
+                ", saleNo='" + saleNo + '\'' +
+                ", saleCustomNo='" + saleCustomNo + '\'' +
+                ", saleDate='" + saleDate + '\'' +
+                ", saleEstimatedTime=" + saleEstimatedTime +
+                ", saleLeadTime='" + saleLeadTime + '\'' +
+                ", saleProductsNo='" + saleProductsNo + '\'' +
+                ", saleAmounts=" + saleAmounts +
+                ", saleAmountInWords='" + saleAmountInWords + '\'' +
+                ", salePayType='" + salePayType + '\'' +
+                ", saleOrderEstimatedTime='" + saleOrderEstimatedTime + '\'' +
+                ", saleOrderTechnologyNo='" + saleOrderTechnologyNo + '\'' +
+                ", salesman='" + salesman + '\'' +
+                ", saleLeader='" + saleLeader + '\'' +
+                ", finance='" + finance + '\'' +
+                ", production='" + production + '\'' +
+                ", saleApprover='" + saleApprover + '\'' +
+                ", status='" + status + '\'' +
+                ", orderType='" + orderType + '\'' +
+                ", createById=" + createById +
+                ", updateById=" + updateById +
+                ", delFlag='" + delFlag + '\'' +
+                ", taskProcessKey='" + taskProcessKey + '\'' +
+                ", taskNodeKey='" + taskNodeKey + '\'' +
+                ", processKey='" + processKey + '\'' +
+                ", earnestMoney='" + earnestMoney + '\'' +
+                ", deliveryDate='" + deliveryDate + '\'' +
+                ", lotNumber='" + lotNumber + '\'' +
+                ", completionTime=" + completionTime +
+                ", processingUnit='" + processingUnit + '\'' +
+                ", contactPerson='" + contactPerson + '\'' +
+                ", address='" + address + '\'' +
+                ", queryParam='" + queryParam + '\'' +
+                '}';
     }
 }

+ 11 - 0
zkqy-custom-business/src/main/java/com/zkqy/business/domain/vo/ProductInvoiceVO.java

@@ -110,6 +110,17 @@ public class ProductInvoiceVO extends BaseEntity
 
     private List<ProductCodeListVO> productCodeListVOList;
 
+    /** 累计欠款 */
+    private Double amounts;
+
+    public Double getAmounts() {
+        return amounts;
+    }
+
+    public void setAmounts(Double amounts) {
+        this.amounts = amounts;
+    }
+
 
     public void setId(Long id) 
     {

+ 95 - 0
zkqy-custom-business/src/main/java/com/zkqy/business/domain/vo/SaleOrderVO.java

@@ -87,6 +87,21 @@ public class SaleOrderVO {
     /** 交货日期 */
     private String deliveryDate;
 
+    /** 批号 */
+    private String lotNumber;
+
+    /** 完成时间 */
+    private Date completionTime;
+
+    /** 加工单位 */
+    private String processingUnit;
+
+    /** 联系人 */
+    private String contactPerson;
+
+    /** 地址 */
+    private String address;
+
     /** 销售货品明细 */
     private List<SaleProducts> saleProductsList;
 
@@ -105,6 +120,40 @@ public class SaleOrderVO {
     //货车登记
     private String truckRegistration;
 
+    /** 领料类型 */
+    private String materialType;
+
+    /** 外协订单付款方式 */
+    private String outsourceSalePayType;
+
+    /** 查询参数 */
+    private String queryParam;
+
+    public String getQueryParam() {
+        return queryParam;
+    }
+
+    public void setQueryParam(String queryParam) {
+        this.queryParam = queryParam;
+    }
+
+    public String getOutsourceSalePayType() {
+        return outsourceSalePayType;
+    }
+
+    public void setOutsourceSalePayType(String outsourceSalePayType) {
+        this.outsourceSalePayType = outsourceSalePayType;
+    }
+
+    public String getMaterialType() {
+        return materialType;
+    }
+
+    public void setMaterialType(String materialType) {
+        this.materialType = materialType;
+    }
+
+
     public String getTruckRegistration() {
         return truckRegistration;
     }
@@ -361,7 +410,45 @@ public class SaleOrderVO {
         this.remark = remark;
     }
 
+    public String getLotNumber() {
+        return lotNumber;
+    }
+
+    public void setLotNumber(String lotNumber) {
+        this.lotNumber = lotNumber;
+    }
+
+    public Date getCompletionTime() {
+        return completionTime;
+    }
+
+    public void setCompletionTime(Date completionTime) {
+        this.completionTime = completionTime;
+    }
+
+    public String getProcessingUnit() {
+        return processingUnit;
+    }
 
+    public void setProcessingUnit(String processingUnit) {
+        this.processingUnit = processingUnit;
+    }
+
+    public String getContactPerson() {
+        return contactPerson;
+    }
+
+    public void setContactPerson(String contactPerson) {
+        this.contactPerson = contactPerson;
+    }
+
+    public String getAddress() {
+        return address;
+    }
+
+    public void setAddress(String address) {
+        this.address = address;
+    }
 
     @Override
     public String toString() {
@@ -392,9 +479,17 @@ public class SaleOrderVO {
                 ", processKey='" + processKey + '\'' +
                 ", earnestMoney='" + earnestMoney + '\'' +
                 ", deliveryDate='" + deliveryDate + '\'' +
+                ", lotNumber='" + lotNumber + '\'' +
+                ", completionTime=" + completionTime +
+                ", processingUnit='" + processingUnit + '\'' +
+                ", contactPerson='" + contactPerson + '\'' +
+                ", address='" + address + '\'' +
                 ", saleProductsList=" + saleProductsList +
                 ", saleCraft=" + saleCraft +
                 ", idList=" + idList +
+                ", customName='" + customName + '\'' +
+                ", remark='" + remark + '\'' +
+                ", truckRegistration='" + truckRegistration + '\'' +
                 '}';
     }
 }

+ 8 - 0
zkqy-custom-business/src/main/java/com/zkqy/business/mapper/SaleCraftMapper.java

@@ -66,4 +66,12 @@ public interface SaleCraftMapper
      * @return 结果
      */
     int deleteSaleCraftBysaleOrderNos(List<String> saleOrderNos);
+
+    /**
+     * 查询销售工艺要求
+     *
+     * @param saleNo 销售工艺要求主键
+     * @return 销售工艺要求
+     */
+    SaleCraft selectSaleCraftBySaleNo(String saleNo);
 }

+ 15 - 0
zkqy-custom-business/src/main/java/com/zkqy/business/mapper/SaleOrderMapper.java

@@ -117,6 +117,21 @@ public interface SaleOrderMapper {
      */
     List<SaleOrderVO> saleOrderList(SaleOrder saleOrder);
 
+    /**
+     * 查询外协订单列表
+     */
+    List<SaleOrderVO> selectOutsourceOrderList(SaleOrder saleOrder);
+
+    /**
+     * 批量删除销售订单
+     *
+     * @param saleNos 需要删除的数据主键集合
+     * @return 结果
+     */
+    int deleteSaleOrderBySaleNo(List<String> saleNos);
+
+
+
     /**
      * 查询销售单下单前10名客户信息、单据总量和货品总量信息
      */

+ 7 - 0
zkqy-custom-business/src/main/java/com/zkqy/business/mapper/SaleProductsMapper.java

@@ -154,5 +154,12 @@ public interface SaleProductsMapper
      */
     Set<Long> selectSaleProductsIdsBySaleNo(String saleNo);
 
+    /**
+     * 批量删除销售产品
+     *
+     * @param saleNos 需要删除的数据主键集合
+     * @return 结果
+     */
+    int deleteSaleProductsBySaleNos(List<String> saleNos);
 
 }

+ 47 - 0
zkqy-custom-business/src/main/java/com/zkqy/business/service/ISaleOrderService.java

@@ -124,6 +124,53 @@ public interface ISaleOrderService {
      */
     int updateOrder(SaleOrder saleOrder);
 
+    /**
+     * 外协订单列表
+     */
+    List<SaleOrderVO> outsourceOrderList(SaleOrder saleOrder);
+
+    /**
+     * 新增外协订单
+     */
+    int addOutsourceOrder(SaleOrderVO vo);
+
+    /**
+     * 外协订单详情
+     */
+    SaleOrderVO getOutsourceOrderInfo(String saleNo);
+
+    /**
+     * 修改外协订单
+     */
+    int editOutsourceOrder(SaleOrderVO vo);
+
+    /**
+     * 删除外协订单
+     */
+    int deleteOutsourceOrder(List<String> saleNos);
+
+    /**
+     * 提交订单
+     */
+    int submitOutsourceOrder(Long id);
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
     /**
      * 查询销售单下单前10名客户信息单据数量货品总量
      */

+ 2 - 0
zkqy-custom-business/src/main/java/com/zkqy/business/service/impl/CustomerServiceImpl.java

@@ -119,6 +119,8 @@ public class CustomerServiceImpl implements ICustomerService
         }else {
             customerList = customerMapper.customerList(customer);
         }
+
+
         return customerList;
     }
 

+ 11 - 0
zkqy-custom-business/src/main/java/com/zkqy/business/service/impl/ProductInvoiceServiceImpl.java

@@ -45,6 +45,9 @@ public class ProductInvoiceServiceImpl implements IProductInvoiceService {
     @Autowired
     private ProductHandsetOutboundRecordMapper productHandsetOutboundRecordMapper;
 
+    @Autowired
+    private CustomerMapper customerMapper;
+
     /**
      * 查询产品发货单
      *
@@ -244,6 +247,14 @@ public class ProductInvoiceServiceImpl implements IProductInvoiceService {
         //查询发货货品详情
         List<ProductCodeListVO> productCodeListVOS = productOutboundRecordMapper.selectOutboundProduct(productInvoice.getNoticeNumber());
         vo.setProductCodeListVOList(productCodeListVOS);
+        //查询累计欠款
+        List<Customer> customerList = customerMapper.customerList(new Customer());
+        for (Customer customer : customerList){
+            if(customer.getId() == productInvoice.getCustomerId()){
+                vo.setAmounts(customer.getAmounts());
+                break;
+            }
+        }
         return vo;
     }
 

+ 105 - 0
zkqy-custom-business/src/main/java/com/zkqy/business/service/impl/SaleOrderServiceImpl.java

@@ -4,6 +4,7 @@ import java.text.DecimalFormat;
 import java.util.*;
 
 import com.zkqy.business.domain.ProductInvoice;
+import com.zkqy.business.domain.SaleCraft;
 import com.zkqy.business.domain.SaleProducts;
 import com.zkqy.business.domain.vo.SaleOrderVO;
 import com.zkqy.business.mapper.ProductInvoiceMapper;
@@ -329,6 +330,110 @@ public class SaleOrderServiceImpl implements ISaleOrderService {
         return saleOrderMapper.updateSaleOrder(saleOrder);
     }
 
+    @Override
+    public List<SaleOrderVO> outsourceOrderList(SaleOrder saleOrder) {
+        return saleOrderMapper.selectOutsourceOrderList(saleOrder);
+    }
+
+    @Override
+    @Transactional
+    public int addOutsourceOrder(SaleOrderVO vo) {
+        //新增外协订单
+        SaleOrder saleOrder = new SaleOrder();
+        BeanUtils.copyBeanProp(saleOrder, vo);
+        saleOrder.setCreateBy(SecurityUtils.getUsername());
+        saleOrder.setCreateTime(DateUtils.getNowDate());
+        saleOrderMapper.insertSaleOrder(saleOrder);
+        //新增外协单货品
+        vo.getSaleProductsList().forEach(saleProducts -> {
+            saleProducts.setSaleOrderNo(saleOrder.getSaleNo());
+            saleProducts.setCreateBy(SecurityUtils.getUsername());
+            saleProducts.setCreateTime(DateUtils.getNowDate());
+        });
+        saleProductsMapper.batchInsertSaleProducts(vo.getSaleProductsList());
+        //新增外协工艺要求
+        return saleCraftMapper.insertSaleCraft(vo.getSaleCraft());
+    }
+
+    @Override
+    public SaleOrderVO getOutsourceOrderInfo(String saleNo) {
+        //销售单详情
+        SaleOrderVO saleOrderVO = new SaleOrderVO();
+        SaleOrder saleOrder = saleOrderMapper.selectSaleOrderBySaleNo(saleNo);
+        BeanUtils.copyBeanProp(saleOrderVO, saleOrder);
+        //销售单货品详情
+        SaleProducts saleProducts = new SaleProducts();
+        saleProducts.setSaleOrderNo(saleNo);
+        List<SaleProducts> saleProductsList = saleProductsMapper.selectSaleProductsList(saleProducts);
+        saleOrderVO.setSaleProductsList(saleProductsList);
+        //工艺要求详情
+        SaleCraft saleCraft = saleCraftMapper.selectSaleCraftBySaleNo(saleNo);
+        saleOrderVO.setSaleCraft(saleCraft);
+        return saleOrderVO;
+    }
+
+    @Override
+    @Transactional
+    public int editOutsourceOrder(SaleOrderVO vo) {
+        SaleOrder saleOrder = new SaleOrder();
+        BeanUtils.copyBeanProp(saleOrder, vo);
+        if(vo.getSaleProductsList().size() > 0){
+            //修改销售单货品
+            LinkedList<SaleProducts> addSaleProductsList = new LinkedList<>();
+            LinkedList<SaleProducts> editSaleProductsList = new LinkedList<>();
+            Set<Long> ids = new HashSet<>();
+            for (SaleProducts saleProducts : vo.getSaleProductsList()){
+                if(saleProducts.getId() != null){
+                    editSaleProductsList.add(saleProducts);
+                    ids.add(saleProducts.getId());
+                    saleProducts.setUpdateBy(SecurityUtils.getUsername());
+                    saleProducts.setUpdateById(SecurityUtils.getUserId());
+                    saleProducts.setUpdateTime(DateUtils.getNowDate());
+                }else {
+                    saleProducts.setCreateBy(SecurityUtils.getUsername());
+                    saleProducts.setCreateById(SecurityUtils.getUserId());
+                    saleProducts.setCreateTime(DateUtils.getNowDate());
+                    addSaleProductsList.add(saleProducts);
+                }
+                Set<Long> allId = saleProductsMapper.selectSaleProductsIdsBySaleNo(vo.getSaleNo());
+                allId.removeAll(ids);
+                if(allId.size() > 0){
+                    saleProductsMapper.deleteSaleProductsByIds(new ArrayList<>(allId));
+                }
+                if(addSaleProductsList.size() > 0){
+                    saleProductsMapper.batchInsertSaleProducts(addSaleProductsList);
+                }
+                if (editSaleProductsList.size() > 0){
+                    editSaleProductsList.forEach(s -> {
+                        saleProductsMapper.updateSaleProducts(s);
+                    });
+                }
+
+            }
+        }
+        //修改工艺要求
+        saleCraftMapper.updateSaleCraft(vo.getSaleCraft());
+        //修改销售订单
+        return saleOrderMapper.updateSaleOrder(saleOrder);
+    }
+
+    @Override
+    @Transactional
+    public int deleteOutsourceOrder(List<String> saleNos) {
+        saleProductsMapper.deleteSaleProductsBySaleNos(saleNos);
+        saleCraftMapper.deleteSaleCraftBysaleOrderNos(saleNos);
+        return saleOrderMapper.deleteSaleOrderBySaleNo(saleNos);
+    }
+
+    @Override
+    public int submitOutsourceOrder(Long id) {
+        SaleOrder saleOrder = new SaleOrder();
+        saleOrder.setStatus("2");
+        saleOrder.setId(id);
+        return saleOrderMapper.updateSaleOrder(saleOrder);
+    }
+
+
     @Override
     public List<Map<String, Object>> saleOrderTop10List() {
         List<Map<String, Object>> list = new ArrayList<>();

+ 52 - 9
zkqy-custom-business/src/main/resources/mapper/business/CustomerMapper.xml

@@ -28,6 +28,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         <result property="delFlag"    column="del_flag"    />
         <result property="taskProcessKey"    column="task_process_key"    />
         <result property="taskNodeKey"    column="task_node_key"    />
+        <result property="amounts" column="amounts"/>
     </resultMap>
 
     <sql id="selectCustomerVo">
@@ -139,20 +140,62 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
     </delete>
 
     <select id="customerList" parameterType="com.zkqy.business.domain.Customer" resultMap="CustomerResult">
-        <include refid="selectCustomerVo"/>
+        SELECT
+        IFNULL(o.amounts,0) as amounts,
+        c.*
+        FROM
+        {DBNAME}.customer c
+        left join (
+        select b.sale_no,b.sale_custom_no,TRUNCATE(sum(b.amounts),2) as amounts from
+        (
+        select a.sale_no,a.sale_custom_no,TRUNCATE(sum(a.amounts),2) as amounts from
+        (
+        SELECT
+        so.sale_no,
+        so.sale_custom_no,
+        TRUNCATE(sum(sp.product_amounts),2) as amounts
+        FROM
+        {DBNAME}.sale_order so
+        left join {DBNAME}.sale_products sp on so.sale_no = sp.sale_order_no and sp.del_flag = '0'
+        WHERE
+        so.del_flag = '0' and so.sale_pay_type = '2'
+        AND so.sale_order_technology_no NOT IN ( 'retailOrder', 'outsourceOrder', 'processingOrder' )
+        group by so.sale_no
+        ) as a
+        group by  sale_custom_no
+        union all
+        select a.sale_no,a.sale_custom_no,TRUNCATE(sum(a.amounts),2) as amounts from
+        (
+        SELECT
+        so.sale_no,
+        so.sale_custom_no,
+        TRUNCATE(sum(sp.product_amounts),2) as amounts
+        FROM
+        {DBNAME}.sale_order so
+        left join {DBNAME}.sale_products sp on so.sale_no = sp.sale_order_no and sp.del_flag = '0'
+        WHERE
+        so.del_flag = '0' and so.sale_pay_type = '2'
+        AND so.sale_order_technology_no = 'retailOrder'
+        group by so.sale_no
+        ) as a
+        group by  sale_custom_no
+        ) as b
+        group by b.sale_custom_no
+
+        ) as o on o.sale_custom_no = c.custom_no
         WHERE
-            del_flag = '0'
+        c.del_flag = '0'
         <if test="queryParam != null and queryParam != ''">
             AND CONCAT(
-            IFNULL(custom_no, '' ),
-            IFNULL(custom_name, '' ),
-            IFNULL(custom_phone_number, '' ),
-            IFNULL(salesman, '' ),
-            IFNULL(contact_person, '' )) LIKE concat('%', #{queryParam}, '%')
+            IFNULL(c.custom_no, '' ),
+            IFNULL(c.custom_name, '' ),
+            IFNULL(c.custom_phone_number, '' ),
+            IFNULL(c.salesman, '' ),
+            IFNULL(c.contact_person, '' )) LIKE concat('%', #{queryParam}, '%')
         </if>
-        <if test="createById != null "> and create_by_id = #{createById}</if>
+        <if test="createById != null "> and c.create_by_id = #{createById}</if>
         ORDER BY
-            id DESC
+        c.id DESC
     </select>
 
     <select id="selectCustomerByCustomerNo" parameterType="string" resultMap="CustomerResult">

+ 11 - 11
zkqy-custom-business/src/main/resources/mapper/business/SaleCraftMapper.xml

@@ -29,7 +29,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
     </resultMap>
 
     <sql id="selectSaleCraftVo">
-        select id, sale_order_no, sale_craft_no, craft_grid, craft_oil, craft_package, craft_color_fastness, craft_other, craft_mark, shipping_method, remark, create_by_id, create_by, create_time, update_by_id, update_by, update_time, del_flag, task_process_key, task_node_key, direction_of_twist from sale_craft
+        select id, sale_order_no, sale_craft_no, craft_grid, craft_oil, craft_package, craft_color_fastness, craft_other, craft_mark, shipping_method, remark, create_by_id, create_by, create_time, update_by_id, update_by, update_time, del_flag, task_process_key, task_node_key, direction_of_twist from {DBNAME}.sale_craft
     </sql>
 
     <select id="selectSaleCraftList" parameterType="com.zkqy.business.domain.SaleCraft" resultMap="SaleCraftResult">
@@ -58,7 +58,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
     </select>
         
     <insert id="insertSaleCraft" parameterType="com.zkqy.business.domain.SaleCraft" useGeneratedKeys="true" keyProperty="id">
-        insert into sale_craft
+        insert into {DBNAME}.sale_craft
         <trim prefix="(" suffix=")" suffixOverrides=",">
             <if test="saleOrderNo != null">sale_order_no,</if>
             <if test="saleCraftNo != null">sale_craft_no,</if>
@@ -73,13 +73,10 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             <if test="createById != null">create_by_id,</if>
             <if test="createBy != null">create_by,</if>
             <if test="createTime != null">create_time,</if>
-            <if test="updateById != null">update_by_id,</if>
-            <if test="updateBy != null">update_by,</if>
-            <if test="updateTime != null">update_time,</if>
-            <if test="delFlag != null">del_flag,</if>
             <if test="taskProcessKey != null">task_process_key,</if>
             <if test="taskNodeKey != null">task_node_key,</if>
             <if test="directionOfTwist != null">direction_of_twist,</if>
+            del_flag
          </trim>
         <trim prefix="values (" suffix=")" suffixOverrides=",">
             <if test="saleOrderNo != null">#{saleOrderNo},</if>
@@ -95,18 +92,15 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             <if test="createById != null">#{createById},</if>
             <if test="createBy != null">#{createBy},</if>
             <if test="createTime != null">#{createTime},</if>
-            <if test="updateById != null">#{updateById},</if>
-            <if test="updateBy != null">#{updateBy},</if>
-            <if test="updateTime != null">#{updateTime},</if>
-            <if test="delFlag != null">#{delFlag},</if>
             <if test="taskProcessKey != null">#{taskProcessKey},</if>
             <if test="taskNodeKey != null">#{taskNodeKey},</if>
             <if test="directionOfTwist != null">#{directionOfTwist},</if>
+            '0'
          </trim>
     </insert>
 
     <update id="updateSaleCraft" parameterType="com.zkqy.business.domain.SaleCraft">
-        update sale_craft
+        update {DBNAME}.sale_craft
         <trim prefix="SET" suffixOverrides=",">
             <if test="saleOrderNo != null">sale_order_no = #{saleOrderNo},</if>
             <if test="saleCraftNo != null">sale_craft_no = #{saleCraftNo},</if>
@@ -149,4 +143,10 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             #{saleOrderNo}
         </foreach>
     </update>
+
+    <select id="selectSaleCraftBySaleNo" parameterType="string" resultMap="SaleCraftResult">
+        <include refid="selectSaleCraftVo"/>
+        where sale_order_no = #{saleNo} and del_flag = '0'
+    </select>
+
 </mapper>

+ 73 - 19
zkqy-custom-business/src/main/resources/mapper/business/SaleOrderMapper.xml

@@ -38,7 +38,12 @@
         <result property="earnestMoney" column="earnest_money"/>
         <result property="deliveryDate" column="delivery_date"/>
         <result property="lotNumber" column="lot_number"/>
-
+        <result property="completionTime" column="completion_time"/>
+        <result property="processingUnit" column="processing_unit"/>
+        <result property="contactPerson" column="contact_person"/>
+        <result property="address" column="address"/>
+        <result property="materialType" column="material_type"/>
+        <result property="outsourceSalePayType" column="outsource_sale_pay_type"/>
     </resultMap>
 
     <sql id="selectSaleOrderVo">
@@ -74,7 +79,13 @@
                process_key,
                earnest_money,
                delivery_date,
-               lot_number
+               lot_number,
+               completion_time,
+               processing_unit,
+               contact_person,
+               address,
+               material_type,
+               outsource_sale_pay_type
         from {DBNAME}.sale_order
     </sql>
 
@@ -162,6 +173,12 @@
             <if test="earnestMoney != null">earnest_money,</if>
             <if test="deliveryDate != null">delivery_date,</if>
             <if test="lotNumber != null">lot_number,</if>
+            <if test="completionTime != null">completion_time,</if>
+            <if test="processingUnit != null">processing_unit,</if>
+            <if test="contactPerson != null">contact_person,</if>
+            <if test="address != null">address,</if>
+            <if test="materialType != null">material_type,</if>
+            <if test="outsourceSalePayType != null">outsource_sale_pay_type,</if>
             del_flag
         </trim>
         <trim prefix="values (" suffix=")" suffixOverrides=",">
@@ -193,6 +210,12 @@
             <if test="earnestMoney != null">#{earnestMoney},</if>
             <if test="deliveryDate != null">#{deliveryDate},</if>
             <if test="lotNumber != null">#{lotNumber},</if>
+            <if test="completionTime != null">#{completionTime},</if>
+            <if test="processingUnit != null">#{processingUnit},</if>
+            <if test="contactPerson != null">#{contactPerson},</if>
+            <if test="address != null">#{address},</if>
+            <if test="materialType != null">#{materialType},</if>
+            <if test="outsourceSalePayType != null">#{outsourceSalePayType},</if>
             '0'
         </trim>
     </insert>
@@ -230,6 +253,11 @@
             <if test="deliveryDate != null">delivery_date = #{deliveryDate},</if>
             <if test="lotNumber != null">lot_number = #{lotNumber},</if>
             <if test="completionTime != null">completion_time = #{completionTime},</if>
+            <if test="processingUnit != null">processing_unit = #{processingUnit},</if>
+            <if test="contactPerson != null">contact_person = #{contactPerson},</if>
+            <if test="address != null">address = #{address},</if>
+            <if test="materialType != null">material_type = #{materialType},</if>
+            <if test="outsourceSalePayType != null">outsource_sale_pay_type = #{outsourceSalePayType},</if>
         </trim>
         where id = #{id}
     </update>
@@ -321,9 +349,9 @@
         where so.del_flag = '0' and c.del_flag = '0'
         <if test="queryParam != null and queryParam != ''">
             AND CONCAT(
-            IFNULL( sale_order.sale_no, '' ),
-            IFNULL( customer.custom_name, '' ),
-            IFNULL( sale_order.sale_lead_time, '' ))
+            IFNULL( so.sale_no, '' ),
+            IFNULL( c.custom_name, '' ),
+            IFNULL( so.sale_lead_time, '' ))
             LIKE concat('%', #{queryParam}, '%')
         </if>
         <if test="createById != null ">and so.create_by_id = #{createById}</if>
@@ -332,8 +360,11 @@
             <when test="saleOrderTechnologyNo =='retailOrder'">
                 and so.sale_order_technology_no = 'retailOrder'
             </when>
+            <when test="saleOrderTechnologyNo =='processingOrder'">
+                and so.sale_order_technology_no = 'processingOrder'
+            </when>
             <otherwise>
-                and so.sale_order_technology_no != 'retailOrder'
+                and so.sale_order_technology_no NOT IN ( 'retailOrder', 'outsourceOrder', 'processingOrder' )
             </otherwise>
         </choose>
         <if test="status!=null and status!='' and status=='100'">
@@ -345,6 +376,29 @@
         order by so.id desc
     </select>
 
+    <select id="selectOutsourceOrderList" resultType="com.zkqy.business.domain.vo.SaleOrderVO">
+        <include refid="selectSaleOrderVo"/>
+        where del_flag = '0' and sale_order_technology_no = 'outsourceOrder'
+        <if test="saleNo != null  and saleNo != ''">and sale_no = #{saleNo}</if>
+        <if test="salesman != null  and salesman != ''">and salesman = #{salesman}</if>
+        <if test="processingUnit != null and processingUnit != ''">and processing_unit = #{processingUnit}</if>
+        <if test="contactPerson != null and contactPerson != ''">and contact_person = #{contactPerson}</if>
+        <if test="address != null and address != ''">and address = #{address}</if>
+        <if test="createById != null ">and create_by_id = #{createById}</if>
+        <if test="orderType != null">and order_type = #{orderType}</if>
+        order by id desc
+    </select>
+
+
+    <update id="deleteSaleOrderBySaleNo">
+        update {DBNAME}.sale_order set del_flag = '2' where sale_no in
+        <foreach collection="list" item="saleNo" open="(" close=")" separator=",">
+            #{saleNo}
+        </foreach>
+    </update>
+
+
+
 <!--    <select id="aa">-->
 <!--        SELECT-->
 <!--            so.sale_custom_no,-->
@@ -366,7 +420,7 @@
 <!--                            FROM-->
 <!--                                sale_order-->
 <!--                            WHERE-->
-<!--                                sale_order_technology_no != 'retailOrder'-->
+<!--                                sale_order_technology_no NOT IN ( 'retailOrder', 'outsourceOrder', 'processingOrder' )-->
 <!--                    AND sale_custom_no IN ( 16, 15, 14 ))-->
 <!--        WHERE-->
 <!--            sp.del_flag = '0'-->
@@ -393,7 +447,7 @@
                 LEFT JOIN
             (
                 SELECT TRUNCATE( sum( sp.product_number ), 2 ) AS weight,so.sale_custom_no FROM {DBNAME}.sale_products sp LEFT JOIN {DBNAME}.sale_order so ON sp.sale_order_no = so.sale_no AND so.del_flag ='0'
-                    AND sale_no IN (SELECT sale_no FROM {DBNAME}.sale_order WHERE sale_order_technology_no != 'retailOrder' and del_flag = '0' AND sale_custom_no IN
+                    AND sale_no IN (SELECT sale_no FROM {DBNAME}.sale_order WHERE sale_order_technology_no NOT IN ( 'retailOrder', 'outsourceOrder', 'processingOrder' ) and del_flag = '0' AND sale_custom_no IN
                     <foreach collection="list" item="customerNo" open="(" separator="," close=")">
                         #{customerNo}
                     </foreach>
@@ -402,7 +456,7 @@
             ) s1 ON so.sale_custom_no = s1.sale_custom_no
             left join {DBNAME}.customer c on so.sale_custom_no = c.custom_no and c.del_flag = '0'
         WHERE
-            so.del_flag = '0' and so.sale_order_technology_no != 'retailOrder'
+            so.del_flag = '0' and so.sale_order_technology_no NOT IN ( 'retailOrder', 'outsourceOrder', 'processingOrder' )
         GROUP BY
             so.sale_custom_no
         ORDER BY
@@ -481,7 +535,7 @@
         {DBNAME}.sale_order so left join {DBNAME}.customer c on so.sale_custom_no = c.custom_no and c.del_flag = '0'
         WHERE
         so.del_flag = '0'
-          AND so.sale_order_technology_no != 'retailOrder' and so.sale_custom_no = #{customerNo}
+          AND so.sale_order_technology_no NOT IN ( 'retailOrder', 'outsourceOrder', 'processingOrder' ) and so.sale_custom_no = #{customerNo}
         <if test="timeType == 'days'">
             and DATE( so.sale_date ) = #{timeParam}
         </if>
@@ -506,7 +560,7 @@
         {DBNAME}.sale_order so left join {DBNAME}.customer c on so.sale_custom_no = c.custom_no and c.del_flag = '0'
         WHERE
         so.del_flag = '0'
-        AND so.sale_order_technology_no != 'retailOrder'
+        AND so.sale_order_technology_no NOT IN ( 'retailOrder', 'outsourceOrder', 'processingOrder' )
         and so.`status` = '6'
         and so.sale_custom_no = #{customerNo}
         <if test="timeType == 'days'">
@@ -537,7 +591,7 @@
         left join {DBNAME}.production p on sp.product_no = p.product_no and p.del_flag = '0'
         left join {DBNAME}.materiel m on m.materiel_code = sp.colour_number and m.del_flag = '0'
 
-        where  so.sale_order_technology_no != 'retailOrder' and so.del_flag = '0' and so.sale_custom_no = #{customerNo}
+        where  so.sale_order_technology_no NOT IN ( 'retailOrder', 'outsourceOrder', 'processingOrder' ) and so.del_flag = '0' and so.sale_custom_no = #{customerNo}
         <if test="timeType == 'days'">
             and DATE( so.sale_date ) = #{timeParam}
         </if>
@@ -624,7 +678,7 @@
             left join {DBNAME}.production p on sp.product_no = p.product_no and p.del_flag = '0'
             left join {DBNAME}.materiel m on m.materiel_code = sp.colour_number and m.del_flag = '0'
         WHERE
-            so.sale_order_technology_no != 'retailOrder'
+            so.sale_order_technology_no NOT IN ( 'retailOrder', 'outsourceOrder', 'processingOrder' )
           AND so.del_flag = '0'
           AND so.`status` = '6' and p.product_type = #{productType}
             ) as productIno
@@ -653,7 +707,7 @@
             so.create_by_id as saleId
         FROM {DBNAME}.sale_products sp LEFT JOIN {DBNAME}.sale_order so ON sp.sale_order_no = so.sale_no AND so.del_flag ='0'
         WHERE sp.del_flag = '0'  AND so.sale_no
-            IN (SELECT sale_no FROM {DBNAME}.sale_order WHERE sale_order_technology_no != 'retailOrder' and del_flag = '0' )
+            IN (SELECT sale_no FROM {DBNAME}.sale_order WHERE sale_order_technology_no NOT IN ( 'retailOrder', 'outsourceOrder', 'processingOrder' ) and del_flag = '0' )
 
             <if test="timeType == 'days'">
                 and DATE( so.sale_date ) = #{timeParam}
@@ -705,7 +759,7 @@
             {DBNAME}.sale_order
         WHERE
             del_flag = '0'
-          AND sale_order_technology_no != 'retailOrder'
+          AND sale_order_technology_no NOT IN ( 'retailOrder', 'outsourceOrder', 'processingOrder' )
         <if test="timeType == 'days'">
             and DATE( sale_date ) = #{timeParam}
         </if>
@@ -756,7 +810,7 @@
             {DBNAME}.sale_order so left join {DBNAME}.sale_products sp on so.sale_no = sp.sale_order_no and sp.del_flag = '0'
                           left join {DBNAME}.production p on p.product_no = sp.product_no and p.del_flag = '0'
         WHERE
-            so.sale_order_technology_no != 'retailOrder'
+            so.sale_order_technology_no NOT IN ( 'retailOrder', 'outsourceOrder', 'processingOrder' )
 	AND so.del_flag = '0'
 	AND so.`status` = '6'
         group by p.product_type
@@ -782,7 +836,7 @@
             {DBNAME}.sale_order so left join {DBNAME}.sale_products sp on so.sale_no = sp.sale_order_no and sp.del_flag = '0'
                           left join {DBNAME}.production p on p.product_no = sp.product_no and p.del_flag = '0'
         WHERE
-            so.sale_order_technology_no != 'retailOrder'
+            so.sale_order_technology_no NOT IN ( 'retailOrder', 'outsourceOrder', 'processingOrder' )
 	AND so.del_flag = '0'
 	AND so.`status` = '6'
 
@@ -884,7 +938,7 @@
             left join {DBNAME}.production p on sp.product_no = p.product_no and p.del_flag = '0'
             left join {DBNAME}.materiel m on m.materiel_code = sp.colour_number and m.del_flag = '0'
         WHERE
-            so.sale_order_technology_no != 'retailOrder'
+            so.sale_order_technology_no NOT IN ( 'retailOrder', 'outsourceOrder', 'processingOrder' )
           AND so.del_flag = '0'
         group by so.sale_no
 
@@ -950,7 +1004,7 @@
                 left join {DBNAME}.materiel m on sp.colour_number = m.materiel_code and m.del_flag = '0'
         WHERE
             so.del_flag = '0'
-          AND so.sale_order_technology_no != 'retailOrder'
+          AND so.sale_order_technology_no NOT IN ( 'retailOrder', 'outsourceOrder', 'processingOrder' )
         <if test="timeType == 'days'">
             and DATE( so.sale_date ) = #{timeParam}
         </if>

+ 10 - 0
zkqy-custom-business/src/main/resources/mapper/business/SaleProductsMapper.xml

@@ -632,4 +632,14 @@
         from {DBNAME}.sale_products
         where sale_order_no = #{saleOrderNo} and del_flag = '0'
     </select>
+
+    <update id="deleteSaleProductsBySaleNos" parameterType="string">
+        update {DBNAME}.sale_products
+        set del_flag = '2'
+        where sale_order_no in
+        <foreach collection="list" item="saleNo" open="(" separator="," close=")">
+            #{saleNo}
+        </foreach>
+    </update>
+
 </mapper>

+ 53 - 0
zkqy-ui/src/api/system/outsourceOrder.js

@@ -0,0 +1,53 @@
+import request from '@/utils/request'
+
+
+// 外协订单列表
+export function outsourceOrderList(params) {
+  return request({
+    url: '/system/order/outsourceOrderList',
+    method: 'get',
+    params: params
+  })
+}
+
+// 新增外协订单
+export function addOutsourceOrder(data) {
+  return request({
+    url: '/system/order/addOutsourceOrder',
+    method: 'post',
+    data: data
+  })
+}
+
+// 删除外协订单
+export function deleteOutsourceOrder(saleNos) {
+  return request({
+    url: '/system/order/deleteOutsourceOrder/' + saleNos,
+    method: 'delete'
+  })
+}
+
+// 外协订单详情
+export function getOutsourceOrderInfo(saleNo) {
+  return request({
+    url: '/system/order/getOutsourceOrderInfo/' + saleNo,
+    method: 'get'
+  })
+}
+
+// 修改外协订单
+export function editOutsourceOrder(data) {
+  return request({
+    url: '/system/order/editOutsourceOrder',
+    method: 'put',
+    data: data
+  })
+}
+
+// 提交外协订单
+export function submitOutsourceOrder(id) {
+  return request({
+    url: '/system/order/submitOutsourceOrder/' + id,
+    method: 'get'
+  })
+}

+ 7 - 3
zkqy-ui/src/utils/print/sendOrderPrint.js

@@ -17,7 +17,8 @@ function receiptDocuments(data, domId) {
   if (dd < 10) {
     dd = "0" + dd;
   }
-  let { customerName, customName, productCodeListVOList, noticeNumber, printUser, drawer, salesman } = data;
+  console.log("dataaaaaaaaaaaaaaaaaaaaaaaa", data);
+  let { customerName, customName, productCodeListVOList, noticeNumber, printUser, drawer, salesman,amounts } = data;
 
   let printContent = `<div class="table" style="display: flex;flex-direction: column;align-items: center;width: 1000px;">
     <div class="tableName" style="margin: 0 auto;font-size: 30px;font-weight: bold;">
@@ -96,12 +97,15 @@ function receiptDocuments(data, domId) {
 
   printContent += `</tbody>
         </table>
+        <div style="margin-top: 20px">
+            <p>累计订单欠款:&nbsp;${amounts}</p>
+        </div>
       </div>
       <div class="tableBottom" style='width: 100%;
       padding: 0 10px;
         margin: 0 auto;
         position: relative;
-        top: 200px;
+        top: 180px;
         display: flex;
         flex-direction: row;
         flex-wrap: wrap;
@@ -121,4 +125,4 @@ function receiptDocuments(data, domId) {
   return false;
 
 }
-export default receiptDocuments
+export default receiptDocuments

+ 8 - 22
zkqy-ui/src/views/orderMange/customerMange/index.vue

@@ -173,6 +173,13 @@
       <el-table-column label="销售员" align="center" prop="salesman" />
       <el-table-column label="联系人" align="center" prop="contactPerson" />
       <el-table-column label="备注" align="center" prop="remark" />
+      <el-table-column label="累计欠款" align="center" prop="amounts">
+        <template slot-scope="scope">
+          <span :style="{color: scope.row.amounts > 0 ? 'red' : 'black'}">
+            {{ scope.row.amounts }}
+          </span>
+        </template>
+      </el-table-column>
       <el-table-column
         label="操作"
         align="center"
@@ -346,28 +353,7 @@
               <el-input v-model="form.remark" placeholder="请输入备注" />
             </el-form-item>
           </el-col>
-          <!--
-          <el-form-item label="创建者id" prop="createById">
-            <el-input v-model="form.createById" placeholder="请输入创建者id" />
-          </el-form-item>
-          <el-form-item label="更新者id" prop="updateById">
-            <el-input v-model="form.updateById" placeholder="请输入更新者id" />
-          </el-form-item>
-          <el-form-item label="删除标志" prop="delFlag">
-            <el-input v-model="form.delFlag" placeholder="请输入删除标志" />
-          </el-form-item>
-          <el-form-item label="任务编码" prop="taskProcessKey">
-            <el-input
-              v-model="form.taskProcessKey"
-              placeholder="请输入任务编码"
-            />
-          </el-form-item>
-          <el-form-item label="任务节点编码" prop="taskNodeKey">
-            <el-input
-              v-model="form.taskNodeKey"
-              placeholder="请输入任务节点编码"
-            />
-          </el-form-item> -->
+
         </el-form>
       </el-row>
       <div slot="footer" class="dialog-footer">

+ 1 - 0
zkqy-ui/src/views/orderMange/index.vue

@@ -1713,6 +1713,7 @@ export default {
           this.queryParams.queryMap.queryParam =
             this.queryParams.queryMap.queryCriteriaValue;
           // this.queryParams.orderType = "";
+          this.queryParams.queryParam = this.queryParams.queryMap.queryCriteriaValue;
           saleOrderList(this.queryParams).then(async (res) => {
             this.tableList = [];
             // res.rows.forEach((item) => {

+ 1279 - 0
zkqy-ui/src/views/orderMange/order/outsourceOrder.vue

@@ -0,0 +1,1279 @@
+<template>
+  <div class="app-container">
+    <el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="68px">
+      <el-form-item label="合同号" prop="saleNo">
+        <el-input
+          v-model="queryParams.saleNo"
+          placeholder="请输入合同号"
+          clearable
+          @keyup.enter.native="handleQuery"
+        />
+      </el-form-item>
+
+      <el-form-item label="业务员" prop="salesman">
+        <el-input
+          v-model="queryParams.salesman"
+          placeholder="请输入业务员"
+          clearable
+          @keyup.enter.native="handleQuery"
+        />
+      </el-form-item>
+      <el-form-item label="加工单位" prop="processingUnit">
+        <el-input
+          v-model="queryParams.processingUnit"
+          placeholder="请输入加工单位"
+          clearable
+          @keyup.enter.native="handleQuery"
+        />
+      </el-form-item>
+      <el-form-item label="联系人" prop="contactPerson">
+        <el-input
+          v-model="queryParams.contactPerson"
+          placeholder="请输入联系人"
+          clearable
+          @keyup.enter.native="handleQuery"
+        />
+      </el-form-item>
+      <el-form-item label="地址" prop="address">
+        <el-input
+          v-model="queryParams.address"
+          placeholder="请输入地址"
+          clearable
+          @keyup.enter.native="handleQuery"
+        />
+      </el-form-item>
+      <el-form-item>
+        <el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
+        <el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
+      </el-form-item>
+    </el-form>
+
+    <el-row :gutter="10" class="mb8">
+      <el-col :span="1.5">
+        <el-button
+          type="primary"
+          plain
+          icon="el-icon-plus"
+          size="mini"
+          @click="addHandler"
+          v-hasPermi="['system:order:add']"
+        >新增
+        </el-button>
+      </el-col>
+      <el-col :span="1.5">
+        <el-button
+          type="danger"
+          plain
+          icon="el-icon-delete"
+          size="mini"
+          :disabled="multiple"
+          @click="handleDelete"
+          v-hasPermi="['system:order:remove']"
+        >删除
+        </el-button>
+      </el-col>
+      <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
+    </el-row>
+
+    <el-table v-loading="loading" :data="orderList" @selection-change="handleSelectionChange1">
+      <el-table-column type="selection" width="55" align="center"/>
+      <el-table-column label="合同号" align="center" prop="saleNo"/>
+      <el-table-column label="日期" align="center" prop="saleDate"/>
+      <el-table-column label="交货周期" align="center" prop="saleLeadTime"/>
+      <el-table-column label="合计金额" align="center" prop="saleAmountInWords"/>
+      <el-table-column label="付款方式" align="center" prop="outsourceSalePayType">
+        <template slot-scope="scope">
+          {{
+              getDictLabel(scope.row.outsourceSalePayType, "outsource_order_payment_method")
+            }}
+        </template>
+      </el-table-column>
+      <el-table-column label="下单时间" align="center" prop="saleOrderEstimatedTime"/>
+      <el-table-column label="加工单位" align="center" prop="processingUnit"/>
+      <el-table-column label="联系人" align="center" prop="contactPerson"/>
+      <el-table-column label="地址" align="center" prop="address"/>
+      <el-table-column label="业务员" align="center" prop="salesman"/>
+      <el-table-column label="业务主管" align="center" prop="saleLeader"/>
+      <el-table-column label="财务部" align="center" prop="finance"/>
+      <el-table-column label="状态" align="center" prop="status">
+        <template slot-scope="scope">
+          <el-tag :type="scope.row.listClass">{{
+              getDictLabel(scope.row.status, "sales_order_status")
+            }}</el-tag>
+        </template>
+      </el-table-column>
+      <el-table-column label="操作" align="center" class-name="small-padding fixed-width">
+
+        <template slot-scope="scope">
+          <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
+                  size="mini"
+                  type="text"
+                  icon="el-icon-edit"
+                  @click="handleUpdate(scope.row)"
+                  v-hasPermi="['system:order:edit']"
+                >修改</el-button
+                >
+              </el-dropdown-item>
+              <el-dropdown-item>
+                <el-button
+                  size="mini"
+                  type="text"
+                  icon="el-icon-delete"
+                  @click="handleDelete(scope.row)"
+                  v-hasPermi="['system:order:remove']"
+                >删除</el-button
+                >
+              </el-dropdown-item>
+                <el-dropdown-item>
+                  <el-button
+                    size="mini"
+                    type="text"
+                    icon="el-icon-edit"
+                    @click="submitOrder(scope.row)"
+                  >提交</el-button
+                  >
+                </el-dropdown-item>
+<!--              <el-dropdown-item>-->
+<!--                <el-button-->
+<!--                  size="mini"-->
+<!--                  type="text"-->
+<!--                  icon="el-icon-edit"-->
+<!--                  @click="handleDetail(scope.row)"-->
+<!--                >详情</el-button-->
+<!--                >-->
+<!--              </el-dropdown-item>-->
+            </el-dropdown-menu>
+          </el-dropdown>
+        </template>
+
+<!--        <template slot-scope="scope">-->
+<!--          <el-button-->
+<!--            size="mini"-->
+<!--            type="text"-->
+<!--            icon="el-icon-edit"-->
+<!--            @click="handleUpdate(scope.row)"-->
+<!--            v-hasPermi="['system:order:edit']"-->
+<!--          >修改-->
+<!--          </el-button>-->
+<!--          <el-button-->
+<!--            size="mini"-->
+<!--            type="text"-->
+<!--            icon="el-icon-delete"-->
+<!--            @click="handleDelete(scope.row)"-->
+<!--            v-hasPermi="['system:order:remove']"-->
+<!--          >删除-->
+<!--          </el-button>-->
+<!--        </template>-->
+      </el-table-column>
+    </el-table>
+
+    <pagination
+      v-show="total>0"
+      :total="total"
+      :page.sync="queryParams.pageNum"
+      :limit.sync="queryParams.pageSize"
+      @pagination="getList"
+    />
+
+    <!-- 添加或修改销售订单对话框 -->
+    <el-dialog
+      :title="title"
+      width="1300px"
+      :visible.sync="open"
+      append-to-body
+    >
+      <el-row :gutter="20">
+        <el-form
+          :model="formData"
+          ref="formDataRef"
+          :rules="rules"
+          label-width="100px"
+          :inline="true"
+          size="normal"
+        >
+          <el-col :span="24">
+            <el-form-item prop="saleNo" label="合同号:">
+              <el-input size="small" v-model="formData.saleNo"></el-input>
+            </el-form-item>
+          </el-col>
+          <el-col :span="12">
+            <el-form-item label="加工单位:" size="normal" prop="processingUnit">
+              <el-input
+                size="small"
+                v-model="formData.processingUnit"
+              ></el-input>
+            </el-form-item>
+          </el-col>
+          <el-col :span="12">
+            <el-form-item label="联系人:" size="normal" prop="contactPerson">
+              <el-input
+                size="small"
+                v-model="formData.contactPerson"
+              ></el-input>
+            </el-form-item>
+          </el-col>
+          <el-col :span="12">
+            <el-form-item label="地址:" size="normal" prop="address">
+              <el-input
+                size="small"
+                v-model="formData.address"
+              ></el-input>
+            </el-form-item>
+          </el-col>
+          <el-col :span="12">
+            <el-form-item label="运输方式:" prop="shippingMethod">
+              <el-input
+                v-model="formData.shippingMethod"
+                size="small"
+                @input="iptChange()"
+                clearable
+              ></el-input>
+            </el-form-item>
+          </el-col>
+          <el-col :span="12">
+            <el-form-item
+              label-width="120px"
+              prop="saleOrderEstimatedTime"
+              label="下单时间:"
+            >
+              <el-date-picker
+                size="small"
+                v-model="formData.saleOrderEstimatedTime"
+                value-format="yyyy-MM-dd"
+                format="yyyy-MM-dd"
+                type="date"
+                placeholder="选择日期"
+              >
+              </el-date-picker>
+            </el-form-item>
+          </el-col>
+          <el-col :span="12">
+            <el-form-item label="交货周期:" size="normal" prop="saleLeadTime">
+              <el-input
+                size="small"
+                v-model="formData.saleLeadTime"
+              ></el-input>
+            </el-form-item>
+          </el-col>
+          <el-col :span="24">
+            <el-divider>货品明细</el-divider>
+          </el-col>
+          <el-table
+            :data="productionTableData"
+            border
+            show-summary
+            :summary-method="getSummaries"
+            sum-text="小计"
+            style="width: 100%"
+          >
+            <el-table-column prop="productName" label="品名">
+              <template slot-scope="scope">
+                <el-input
+                  v-model="scope.row.productName"
+                  size="small"
+                  clearable
+                ></el-input>
+              </template>
+            </el-table-column>
+            <el-table-column prop="productNumber" label="数量/kg">
+              <template slot-scope="scope">
+                <el-form-item
+                  :prop="'productNumber-' + scope.$index"
+                  :name="'productNumber-' + scope.$index"
+                  style="margin: 0px; padding: 0px"
+                >
+                  <el-input
+                    v-model="scope.row.productNumber"
+                    oninput="value=value.replace(/[^0-9.]/g,'')"
+                    size="small"
+                    clearable
+                    @change="computedPrice(scope.row)"
+                  ></el-input>
+                </el-form-item>
+              </template>
+            </el-table-column>
+            <el-table-column prop="productUnitPrice" label="加工单价(元)">
+              <template slot-scope="scope">
+                <el-form-item
+                  :prop="'productUnitPrice-' + scope.$index"
+                  :name="'productUnitPrice-' + scope.$index"
+                  style="margin: 0px; padding: 0px"
+                >
+                  <el-input
+                    v-model="scope.row.productUnitPrice"
+                    size="small"
+                    oninput="value=value.replace(/[^0-9.]/g,'')"
+                    @change="computedPrice(scope.row)"
+                    clearable
+                  ></el-input>
+                </el-form-item>
+              </template>
+            </el-table-column>
+            <el-table-column prop="productAmounts" label="金额">
+              <template slot-scope="scope">
+                {{ scope.row.productAmounts }}
+              </template>
+            </el-table-column>
+
+            <el-table-column prop="remark" label="备注">
+              <template slot-scope="scope">
+                <el-input
+                  v-model="scope.row.remark"
+                  size="small"
+                  clearable
+                ></el-input>
+              </template>
+            </el-table-column>
+            <el-table-column label="操作">
+              <template slot-scope="scope">
+                <el-button
+                  type="danger"
+                  size="small"
+                  @click="deleteProduct(scope.$index)"
+                >删除
+                </el-button>
+              </template>
+            </el-table-column>
+          </el-table>
+          <el-button
+            class="mt5"
+            type="primary"
+            style="width: 100%"
+            size="small"
+            @click="addProduct"
+          >添加货品
+          </el-button>
+          <el-col :span="12">
+            <el-form-item label-width="120px" label="合计金额(大写)">
+              {{ formData.saleAmountInWords }}
+            </el-form-item>
+          </el-col>
+          <el-col :span="12">
+            <el-form-item prop="outsourceSalePayType" label="付款方式">
+              <!-- <el-input
+              v-model="formData.salePayType"
+              size="small"
+              clearable
+            ></el-input> -->
+              <el-select
+                v-model="formData.outsourceSalePayType"
+                size="small"
+                clearable
+                filterable
+              >
+                <el-option
+                  v-for="item in dict.type.outsource_order_payment_method"
+                  :key="item.value"
+                  :label="item.label"
+                  :value="item.value"
+                ></el-option>
+              </el-select>
+            </el-form-item>
+          </el-col>
+<!--          <el-col :span="12" v-show="formData.salePayType == '1'">-->
+<!--            <el-form-item prop="earnestMoney" label="定金">-->
+<!--              <el-input-->
+<!--                v-model="formData.earnestMoney"-->
+<!--                clearable-->
+<!--                size="small"-->
+<!--              />-->
+<!--            </el-form-item>-->
+<!--          </el-col>-->
+          <el-col :span="24">
+            <el-divider>工艺要求</el-divider>
+          </el-col>
+          <el-col :span="12">
+            <el-form-item label="网络:">
+              <el-input
+                v-model="formData.craftGrid"
+                size="small"
+                @input="iptChange()"
+                clearable
+              ></el-input>
+            </el-form-item>
+          </el-col>
+          <el-col :span="12">
+            <el-form-item label="油剂:">
+              <el-input
+                v-model="formData.craftOil"
+                size="small"
+                clearable
+                @input="iptChange()"
+              ></el-input>
+            </el-form-item>
+          </el-col>
+          <el-col :span="12">
+            <el-form-item label="卷装:">
+              <el-input
+                v-model="formData.craftPackage"
+                size="small"
+                clearable
+                @input="iptChange()"
+              ></el-input>
+            </el-form-item>
+          </el-col>
+          <el-col :span="12">
+            <el-form-item label="色牢度:">
+              <el-input
+                v-model="formData.craftColorFastness"
+                size="small"
+                clearable
+                @input="iptChange()"
+              ></el-input>
+            </el-form-item>
+          </el-col>
+
+          <el-col :span="12">
+            <el-form-item label="其它:">
+              <el-input
+                v-model="formData.craftOther"
+                size="small"
+                clearable
+                @input="iptChange()"
+              ></el-input>
+            </el-form-item>
+          </el-col>
+          <el-col :span="12">
+            <el-form-item label="包装/贴唛:">
+              <el-input
+                v-model="formData.craftMark"
+                size="small"
+                clearable
+                @input="iptChange()"
+              ></el-input>
+            </el-form-item>
+          </el-col>
+          <el-col :span="12">
+            <el-form-item label="领料类型:">
+              <el-input
+                v-model="formData.materialType"
+                size="small"
+                clearable
+                @input="iptChange()"
+              ></el-input>
+            </el-form-item>
+          </el-col>
+          <el-col :span="24">
+            <el-divider>审计人员数据</el-divider>
+          </el-col>
+          <el-col :span="12">
+            <el-form-item label="业务员:">
+              <!-- <el-input
+          v-model="formData.salesman"
+          size="small"
+          clearable
+        ></el-input> -->
+              {{ nickName }}
+            </el-form-item>
+          </el-col>
+        </el-form>
+      </el-row>
+      <div slot="footer" class="dialog-footer">
+        <el-button type="primary" @click="editConfirm">确 定</el-button>
+        <el-button @click="cancel">取 消</el-button>
+      </div>
+    </el-dialog>
+  </div>
+</template>
+
+<script>
+import {outsourceOrderList,addOutsourceOrder,deleteOutsourceOrder,getOutsourceOrderInfo,editOutsourceOrder,submitOutsourceOrder} from "@/api/system/outsourceOrder";
+import {v4 as uuidv4} from "uuid";
+import {mapState} from "vuex";
+import moment from "moment";
+import {numToCapital} from "@/utils/other";
+import {addTableData, batchEdit, checkOrderNo, delTableData} from "@/api/tablelist/commonTable";
+import {queryDropDownBoxData} from "@/api/dragform/form";
+
+export default {
+  name: "outsourceOrder",
+  dicts: ["outsource_order_payment_method","sales_order_status"],
+  data() {
+    return {
+      totalMoney: "", //总金额 小写
+      // 遮罩层
+      loading: true,
+      // 选中数组
+      ids: [],
+      //选中合同号
+      saleNos: [],
+      // 非单个禁用
+      single: true,
+      // 非多个禁用
+      multiple: true,
+      // 显示搜索条件
+      showSearch: true,
+      // 总条数
+      total: 0,
+      // 销售订单表格数据
+      orderList: [],
+      // 弹出层标题
+      title: "",
+      // 是否显示弹出层
+      open: false,
+      isEdit: false,
+      // 查询参数
+      queryParams: {
+        pageNum: 1,
+        pageSize: 10,
+        saleNo: null,
+        salesman: null,
+        processingUnit: null,
+        contactPerson: null,
+        address: null
+      },
+      formData: {
+        //订单表数据
+        saleId:"",
+        saleNo: "", //合同号
+        saleCustomNo: "", //客户编号
+        saleDate: "", //销售单日期
+        saleOrderEstimatedTime: "", //预计下单时间
+        saleLeadTime: "", //交货周期
+        deliveryDate: "", //交货日期
+        saleAmounts: "", //合计金额 小写
+        saleAmountInWords: "", //合计金额 大写
+        salePayType: "", //支付方式
+        earnestMoney: "", //定金
+        salesman: "", //业务员
+        saleLeader: "", //业务主管
+        finance: "", //财务部
+        production: "", //生产部
+        saleApprover: "", //批准人
+        customAddress: "", //客户地址
+        customCountryType: "", //国家类型
+        contactPerson: "", //联系人
+        processingUnit: "", //加工单位
+        address: "", //地址
+        materialType:"",//领料类型
+        outsourceSalePayType:"",//外协订单付款方式
+        // 货品明细表数据
+        lotNumber: "", //批号
+        productNo: "", //货品号
+        productName: "", //货品名称
+        productNumber: "", //销售数量
+        productWeight: "", //销售重量kg
+        productUnitPrice: "", //单价
+        productAmounts: "", //金额
+        sliceType: "", //切片类型
+        sliceTypeLabel: "",
+        colourNumberLabel: "",
+        colourNumber: "", //色号
+        remark: "", //备注
+        // 工艺表
+        craftId:"",
+        craftGrid: "", //网络
+        craftOil: "", //油剂
+        craftPackage: "", //卷装
+        craftColorFastness: "", //色牢度
+        directionOfTwist: "", //捻向
+        craftOther: "", //其它工艺要求
+        craftMark: "", //包装/贴唛
+        shippingMethod: "", //运输方式
+      },
+      productionTableData:[],//货品明细表数据
+      // 表单参数
+      form: {},
+      // 表单校验
+      rules: {
+        saleNo: [
+          {
+            required: true,
+            message: "请输入合同号",
+            trigger: "blur",
+          },
+          {
+            validator: this.validateOrderNo,
+            trigger: "blur",
+          },
+        ],
+      }
+    };
+  },
+  created() {
+    this.getList();
+  },
+  watch: {
+    totalMoney: {
+      handler(newVal, oldVal) {
+        if (isNaN(Number(newVal))) {
+          this.formData.saleAmountInWords = "零";
+        } else {
+          const ntc = new numToCapital();
+          this.formData.saleAmountInWords = ntc.uppercase(newVal);
+        }
+      },
+      deep: true,
+      immediate: true,
+    },
+  },
+  computed: {
+    // isShowExcuteCol() {
+    //   return !this.excuteBtnArr?.every((arr) => arr.children.length == 0);
+    // },
+    ...mapState({
+      nickName: (state) => state.user.nickName,
+    }),
+  },
+  methods: {
+
+    submitOrder(row){
+      this.$confirm('是否确认执行该操作?', '系统提示', {
+        confirmButtonText: '确定',
+        cancelButtonText: '取消',
+        type: 'warning'
+      }).then(() => {
+        submitOutsourceOrder(row.id).then((res) => {
+          if (res.code == 200) {
+            this.$message.success("提交成功");
+            this.getList();
+          } else {
+            this.$message.error("提交失败");
+          }
+        })
+      }).catch(() => {
+        this.$message({
+          type: 'info',
+          message: '已取消提交'
+        });
+      });
+    },
+    // 校验订单号是否有效
+    async validateOrderNo(rule, value, callback) {
+      console.log(value);
+      // let saleNo = this.formData.orderNo;
+      // 检验订单号合法
+      let checkNoPayload = {
+        saleNo: value,
+      };
+      if (this.isEdit) {
+        console.log("id",this.formData.saleId);
+        checkNoPayload.id = this.formData.saleId;
+      }
+      let result = await checkOrderNo(checkNoPayload);
+      if (result.code == 200) {
+        if (result.data) {
+          callback();
+        } else {
+          callback(new Error("合同号已存在"));
+        }
+      } else {
+        callback(new Error("校验失败,请稍后再试"));
+      }
+    },
+    // 重置审计表单数据
+    resetFormData() {
+      Object.assign(this.formData, {
+        //订单表数据
+        saleId:"",
+        saleNo: this.getSaleNo(), //合同号
+        saleCustomNo: "", //客户编号
+        saleDate: moment(new Date()).format("YYYY-MM-DD"), //销售单日期
+        saleOrderEstimatedTime: moment(new Date()).format("YYYY-MM-DD"), //预计下单时间
+        saleLeadTime: "", //交货周期
+        deliveryDate: "",
+        saleAmounts: "", //合计金额 小写
+        saleAmountInWords: "", //合计金额 大写
+        salePayType: "", //支付方式
+        earnestMoney: "",
+        salesman: "", //业务员
+        saleLeader: "", //业务主管
+        finance: "", //财务部
+        production: "", //生产部
+        saleApprover: "", //批准人
+        customAddress: "", //客户地址
+        customCountryType: "", //国家类型
+        contactPerson: "", //联系人
+        processingUnit: "", //加工单位
+        address: "", //地址
+        materialType:"",//领料类型
+        outsourceSalePayType:"",//外协订单付款方式
+        // 货品明细表数据
+        lotNumber: "", //批号
+        productNo: "", //货品号
+        productName: "", //货品名称
+        productNumber: "", //销售数量
+        productWeight: "", //销售重量kg
+        productUnitPrice: "", //单价
+        productAmounts: "", //金额
+        sliceType: "", //切片类型
+        sliceTypeLabel: "",
+        colourNumberLabel: "",
+        colourNumber: "", //色号
+        remark: "", //备注
+        // 工艺表
+        craftId:"",
+        craftGrid: "", //网络
+        craftOil: "", //油剂
+        craftPackage: "", //卷装
+        craftColorFastness: "", //色牢度
+        directionOfTwist: "",
+        craftOther: "", //其它工艺要求
+        craftMark: "", //包装/贴唛
+        shippingMethod: "", //运输方式
+      });
+      this.productionTableData = [];
+    },
+    // 生成合同号
+    getSaleNo() {
+      let timeStr = moment().format("YYYYMMDD");
+      for (var i = 0; i < 5; i++) {
+        timeStr += parseInt(Math.random() * 10);
+      }
+      return timeStr;
+    },
+    // 初始化校验规则
+    initTableValidate() {
+      let length = this.productionTableData.length;
+      for (let i = 0; i < length; i++) {
+        this.rules["productNo-" + i] = [
+          {
+            // required: true,
+            message: "请选择货品",
+            trigger: "change",
+            validator: this.validateTableField,
+          },
+        ];
+        this.rules["productNumber-" + i] = [
+          {
+            // required: true,
+            message: "请输入数量",
+            trigger: "blur",
+            validator: this.validateTableField,
+          },
+        ];
+        this.rules["productUnitPrice-" + i] = [
+          {
+            // required: true,
+            message: "请输入单价",
+            trigger: "blur",
+            validator: this.validateTableField,
+          },
+        ];
+        this.rules["sliceType-" + i] = [
+          {
+            // required: true,
+            message: "请选择切片类型",
+            trigger: "change",
+            validator: this.validateTableField,
+          },
+        ];
+        this.rules["colourNumber-" + i] = [
+          {
+            // required: true,
+            message: "请选择色号",
+            trigger: "change",
+            validator: this.validateTableField,
+          },
+        ];
+      }
+      console.log(this.rules);
+    },
+    // 货品表格数据删除回调
+    deleteProduct(index) {
+      this.productionTableData.splice(index, 1);
+      // this.initTableValidate();
+    },
+    // 货品表格数据新增回调
+    addProduct() {
+      this.productionTableData.push({
+        saleProductNo: uuidv4(),
+        productNo: "", //货品编号
+        productType: "", //类型
+        productName: "", //货品名称
+        productNumber: 0, //销售数量
+        productWeight: 0, //销售重量kg
+        productUnitPrice: 0, //单价
+        productAmounts: "", //金额
+        sliceType: "", //切片类型
+        sliceTypeLabel: "",
+        colourNumberLabel: "",
+        colourNumber: "", //色号
+        remark: "", //备注
+        specificationsList: [],
+        productSpecifications: "", //型号
+      });
+      // 添加校验规则
+      // this.initTableValidate();
+    },
+    // 自定义的小计计算方法
+    getSummaries(param) {
+      const { columns, data } = param;
+      console.log(columns, data);
+      const sums = [];
+      columns.forEach((column, index) => {
+        if (index === 0) {
+          sums[index] = "小计";
+          return;
+        }
+        const values = data.map((item) => Number(item[column.property]));
+        if (
+          index === 5 ||
+          index === 4
+        ) {
+          sums[index] = "";
+        } else if (!values.every((value) => isNaN(value))) {
+          sums[index] = values
+            .reduce((prev, curr) => {
+              const value = Number(curr);
+              if (!isNaN(value)) {
+                return prev + curr;
+              } else {
+                return prev;
+              }
+            }, 0)
+            ?.toFixed(2);
+          if (index == 3) {
+            this.totalMoney = sums[index];
+          }
+        } else {
+          sums[index] = "N/A";
+        }
+      });
+
+      return sums;
+    },
+    // 计算金额
+    computedPrice(row) {
+      let { productNumber, productUnitPrice } = row;
+      console.log(
+        "productNumber, productUnitPrice",
+        productNumber,
+        productUnitPrice
+      );
+      row.productAmounts = (
+        Number(productNumber) * Number(productUnitPrice)
+      ).toFixed(2);
+    },
+    //审计新增
+    async addHandler() {
+      this.isEdit = false;
+      // await this.getDropDownData();
+      this.resetFormData();
+
+      this.title = "新增销售单";
+      this.open = true;
+      this.$nextTick(() => {
+        this.$refs["formDataRef"].clearValidate();
+      });
+    },
+    /** 查询销售订单列表 */
+    getList() {
+      this.loading = true;
+      outsourceOrderList(this.queryParams).then(response => {
+        this.orderList = response.rows;
+        this.total = response.total;
+        this.loading = false;
+      });
+    },
+    // 根据字典value获取字典label
+    getDictLabel(value, dict) {
+      return (
+        this.dict.type[dict].find((item) => {
+          return item.value === value;
+        })?.label || ""
+      );
+    },
+    // 取消按钮
+    cancel() {
+      this.open = false;
+      this.reset();
+    },
+    // 表单重置
+    reset() {
+      this.form = {
+        id: null,
+        saleNo: null,
+        saleCustomNo: null,
+        saleDate: null,
+        saleEstimatedTime: null,
+        saleLeadTime: null,
+        saleProductsNo: null,
+        saleAmounts: null,
+        saleAmountInWords: null,
+        salePayType: null,
+        saleOrderEstimatedTime: null,
+        saleOrderTechnologyNo: null,
+        salesman: null,
+        saleLeader: null,
+        finance: null,
+        production: null,
+        saleApprover: null,
+        status: null,
+        orderType: null,
+        remark: null,
+        createById: null,
+        createBy: null,
+        createTime: null,
+        updateById: null,
+        updateBy: null,
+        updateTime: null,
+        delFlag: null,
+        taskProcessKey: null,
+        taskNodeKey: null,
+        processKey: null,
+        earnestMoney: null,
+        deliveryDate: null,
+        lotNumber: null,
+        completionTime: null,
+        processingUnit: null,
+        contactPerson: null,
+        address: null
+      };
+      this.resetForm("form");
+    },
+    /** 搜索按钮操作 */
+    handleQuery() {
+      this.queryParams.pageNum = 1;
+      this.getList();
+    },
+    /** 重置按钮操作 */
+    resetQuery() {
+      this.resetForm("queryForm");
+      this.handleQuery();
+    },
+    // 多选框选中数据
+    handleSelectionChange(selection) {
+      this.ids = selection.map(item => item.id)
+      this.single = selection.length !== 1
+      this.multiple = !selection.length
+    },
+    // 多选框选中数据
+    handleSelectionChange1(selection) {
+      this.saleNos = selection.map(item => item.saleNo)
+      this.single = selection.length !== 1
+      this.multiple = !selection.length
+    },
+    /** 新增按钮操作 */
+    handleAdd() {
+      this.resetFormData();
+      this.open = true;
+      this.title = "添加销售订单";
+    },
+    /** 修改按钮操作 */
+    handleUpdate(row) {
+      this.resetFormData();
+      console.log("row111111111111111111",row)
+      let { saleNo } = row;
+      getOutsourceOrderInfo(saleNo).then(response => {
+        this.isEdit = true;
+        this.formData = response.data;
+        this.formData.saleId = response.data.id;
+        if (response.data.saleCraft) {
+          Object.assign(this.formData, response.data.saleCraft);
+          this.formData.craftId = response.data.saleCraft.id;
+        }
+        if(response.data.saleProductsList){
+          this.productionTableData = response.data.saleProductsList;
+        }
+
+        this.open = true;
+        this.title = "修改销售订单";
+      });
+    },
+    iptChange() {
+      this.$forceUpdate(); //强制刷新
+    },
+    /** 删除按钮操作 */
+    handleDelete(row) {
+      const saleNos = row.saleNo || this.saleNos;
+      this.$modal.confirm('是否确认删除销售订单编号为"' + saleNos + '"的数据项?').then(function () {
+        return deleteOutsourceOrder(saleNos);
+      }).then(() => {
+        this.getList();
+        this.$modal.msgSuccess("删除成功");
+      }).catch(() => {
+      });
+    },
+    /** 导出按钮操作 */
+    handleExport() {
+      this.download('system/order/export', {
+        ...this.queryParams
+      }, `order_${new Date().getTime()}.xlsx`)
+    },
+    // 审计   提交编辑结果按钮回调
+    async editConfirm() {
+      this.$refs.formDataRef.validate(async (valid) => {
+        if (valid) {
+          let {
+            // id,
+            //订单表数据
+            saleNo,
+            saleCustomNo,
+            saleDate,
+            saleOrderEstimatedTime,
+            saleLeadTime,
+            deliveryDate,
+            saleAmounts,
+            saleAmountInWords,
+            salePayType,
+            earnestMoney,
+            salesman,
+            saleLeader,
+            finance,
+            production,
+            saleApprover,
+            processingUnit,
+            contactPerson,
+            address,
+            materialType,
+            outsourceSalePayType,
+            saleId,
+
+            // 工艺表数据
+            craftId,
+            craftGrid,
+            craftOil,
+            craftPackage,
+            craftColorFastness,
+            directionOfTwist,
+            craftOther,
+            craftMark,
+            shippingMethod,
+
+            // 产品表
+            lotNumber,
+          } = this.formData;
+
+          let saleCraftNo = this.isEdit ? this.formData.saleCraftNo : uuidv4();
+          // saleNo = this.isEdit ? this.formData.saleNo : uuidv4();
+          let saleProductsNo = this.productionTableData
+            .map((item) => item.saleProductNo)
+            .join(","); //销售单表sale_products_no字段存货品表的sale_product_no,逗号分割
+          let saleValue = {
+            id:saleId,
+            status: 1, //新增销售单时  默认为1
+            saleNo,
+            lotNumber, //批号
+            saleProductsNo,
+            saleOrderTechnologyNo: 'outsourceOrder',
+            saleCustomNo,
+            saleDate: moment(new Date(saleDate)).format("YYYY-MM-DD"),
+            saleOrderEstimatedTime: moment(
+              new Date(saleOrderEstimatedTime)
+            ).format("YYYY-MM-DD"),
+            deliveryDate: moment(new Date(deliveryDate)).format("YYYY-MM-DD"),
+            saleLeadTime,
+            // saleAmounts, //合计金额  小写
+            saleAmountInWords,
+            salePayType:"2",
+            earnestMoney,
+            salesman: this.nickName,
+            saleLeader,
+            finance,
+            production,
+            saleApprover,
+            processingUnit,
+            contactPerson,
+            address,
+            materialType,
+            outsourceSalePayType
+          };
+          let craftValue = {
+            id:craftId,
+            saleOrderNo: saleNo,
+            saleCraftNo,
+            craftGrid,
+            craftOil,
+            craftPackage,
+            craftColorFastness,
+            directionOfTwist,
+            craftOther,
+            craftMark,
+            shippingMethod,
+          };
+          let saleData = {
+            //订单表新增数据
+            basicMap: {
+              tableName: "sale_order",
+            },
+            // addListMap: [saleValue],
+            conditionMap: {},
+            commMap: {},
+            btnParametersMap: {},
+          };
+          let craftData = {
+            //工艺表新增数据
+            basicMap: {
+              tableName: "sale_craft",
+            },
+            // addListMap: [craftValue],
+            conditionMap: {},
+            commMap: {},
+            btnParametersMap: {},
+          };
+          this.productionTableData.forEach((item) => {
+            item.saleOrderNo = saleNo;
+            item.lotNumber = lotNumber;
+            // delete item.id;
+            delete item.productNotes;
+            delete item.updateBy;
+            delete item.updateById;
+            delete item.updateTime;
+            delete item.createBy;
+            delete item.createTime;
+            delete item.createById;
+            delete item.delFlag;
+            delete item.sliceTypeLabel;
+            delete item.colourNumberLabel;
+            delete item.productType; //删除类型
+            delete item.taskProcessKey;
+            delete item.processKey;
+            delete item.onBoardState;
+            delete item.taskNodeKey;
+            delete item.productionLineNo;
+            delete item.status;
+            delete item.specificationsList;
+            delete item.productSpecifications;
+            // const matchedOption = this.colourNumberOptions.find(
+            //   (option) => option.materielCode === item.colourNumber
+            // );
+            // let taskName =
+            //   item.productName +
+            //   "-" +
+            //   matchedOption.materieColorNumber +
+            //   "-" +
+            //   matchedOption.materieEncoding;
+            // item.taskName = taskName;
+          });
+          this.productionTableData.forEach((item) => {
+            delete item.productType; //删除产品类型
+          });
+          console.log(this.productionTableData);
+          // return;
+          let productData = {
+            //货品表新增数据
+            basicMap: {
+              tableName: "sale_products",
+            },
+            addListMap: [...this.productionTableData],
+            conditionMap: {},
+            commMap: {},
+            btnParametersMap: {},
+          };
+          if (this.isEdit) {
+            // //修改
+            // Object.keys(saleValue).map((k) => {
+            //   saleData.commMap[k] = saleValue[k];
+            // });
+            // Object.keys(craftValue).map((k) => {
+            //   craftData.commMap[k] = craftValue[k];
+            // });
+            // saleData.conditionMap.id = this.formData.id;
+            // craftData.conditionMap.saleCraftNo = craftValue.saleCraftNo;
+
+            // let deletPayload = {
+            //   //删除货品数据的接口
+            //   basicMap: {
+            //     tableName: "sale_products",
+            //   },
+            //   conditionMap: {
+            //     saleProductNo: this.productIds,
+            //   },
+            // };
+            // let delRes = { code: 200 };
+            // if (this.productIds.length) {
+            //   delRes = await delTableData(deletPayload); //删除旧数据
+            // }
+
+            console.log("1111111111111333333333333333333333333333333333")
+            console.log("saleOrder",saleValue)
+            console.log("1111111111111333333333333333333333333333333333")
+            console.log("craf",craftValue)
+            console.log("1111111111111333333333333333333333333333333333")
+            console.log("product",productData.addListMap)
+            let payLoad = {
+              ...saleValue,
+              saleCraft:craftValue,
+              saleProductsList:productData.addListMap,
+            }
+            let saleRes = await editOutsourceOrder(payLoad);
+            if (saleRes.code === 200) {
+              this.$message.success("修改成功");
+              this.open = false;
+              this.getList();
+            } else {
+              this.$message.error("修改失败");
+            }
+            // return ;
+
+
+            // let addProductRes = { code: 200 };
+            // if (productData.addListMap.length) {
+            //   addProductRes = await addTableData(productData);
+            // }
+            // console.log(delRes, updateSaleRes, updateCraftRes, addProductRes);
+            // if (
+            //   delRes?.code === 200 &&
+            //   updateSaleRes?.code === 200 &&
+            //   updateCraftRes?.code === 200 &&
+            //   addProductRes?.code === 200
+            // ) {
+            //   this.$message.success("修改成功");
+            //   this.open = false;
+            //   this.getList();
+            // } else {
+            //   this.$message.error("修改失败");
+            // }
+          } else {
+            //新增
+            // saleData.addListMap = [saleValue];
+            // craftData.addListMap = [craftValue];
+            console.log("1111111111111333333333333333333333333333333333")
+            console.log("saleOrder",saleValue)
+            console.log("1111111111111333333333333333333333333333333333")
+            console.log("craf",craftValue)
+            console.log("1111111111111333333333333333333333333333333333")
+            console.log("product",productData.addListMap)
+
+            let payLoad = {
+              ...saleValue,
+              saleCraft:craftValue,
+              saleProductsList:productData.addListMap,
+            }
+            let saleRes = await addOutsourceOrder(payLoad);
+            if (saleRes.code === 200) {
+              this.$message.success("添加成功");
+              this.open = false;
+              this.getList();
+            } else {
+              this.$message.error("添加失败");
+            }
+            return
+
+            // let saleRes = await addTableData(saleData);
+            // let craftRes = await addTableData(craftData);
+            // let productRes = { code: 200 };
+            // if (productData.addListMap.length) {
+            //   productRes = await addTableData(productData);
+            // }
+
+            // if (
+            //   saleRes.code === 200 &&
+            //   craftRes.code === 200 &&
+            //   productRes.code === 200
+            // ) {
+            //   this.$message.success("添加成功");
+            //   this.open = false;
+            //   this.getList();
+            // } else {
+            //   this.$message.error("添加失败");
+            // }
+          }
+          // Object.keys(saleValue).map((k) => {
+          //   saleData.commMap[k] = saleValue[k];
+          // });
+        } else {
+          this.$message.error("请完善表单数据");
+        }
+      });
+    },
+  }
+};
+</script>

+ 3583 - 0
zkqy-ui/src/views/orderMange/order/processingOrder.vue

@@ -0,0 +1,3583 @@
+<template>
+  <el-card shadow="always" :body-style="{ padding: '10px' }">
+    <div class="app-container">
+      <el-dialog
+        :title="upload.title"
+        :visible.sync="upload.open"
+        width="400px"
+        append-to-body
+      >
+        <el-upload
+          ref="upload"
+          :limit="1"
+          accept=".xlsx, .xls"
+          :headers="upload.headers"
+          :action="
+            upload.url +
+            '?updateSupport=' +
+            upload.updateSupport +
+            '&tableName=' +
+            tableName +
+            '&sqlKey=' +
+            tableKey
+          "
+          v-loading="upload.isUploading"
+          :disabled="upload.isUploading"
+          :on-progress="handleFileUploadProgress"
+          :on-success="handleFileSuccess"
+          :auto-upload="false"
+          :onChange="handleChange"
+          drag
+        >
+          <i class="el-icon-upload"></i>
+          <div class="el-upload__text">将文件拖到此处,或<em>点击上传</em></div>
+          <div class="el-upload__tip text-center" slot="tip">
+            <!--          <div class="el-upload__tip" slot="tip">-->
+            <!--            <el-checkbox v-model="upload.updateSupport"/>-->
+            <!--            是否更新已经存在的用户数据-->
+            <!--          </div>-->
+            <span>仅允许导入xls、xlsx格式文件。</span>
+            <el-link
+              type="primary"
+              :underline="false"
+              style="font-size: 12px; vertical-align: baseline"
+              @click="importTemplate"
+              >下载模板
+            </el-link>
+          </div>
+        </el-upload>
+        <div slot="footer" class="dialog-footer">
+          <el-button type="primary" @click="submitFileForm">确 定</el-button>
+          <el-button @click="upload.open = false">取 消</el-button>
+        </div>
+      </el-dialog>
+      <Queryfrom
+        :form-vals="templateInfo.where"
+        :statisticList="statisticList"
+        :showCount="showCount"
+        :showSearch="showSearch"
+        @getList="getList"
+        ref="mychild"
+      />
+      <el-row :gutter="10" class="mb8">
+        <el-col :span="1.5">
+          <el-button
+            type="primary"
+            plain
+            icon="el-icon-plus"
+            size="mini"
+            @click="addHandler"
+            >新增
+          </el-button>
+        </el-col>
+        <!-- <el-col :span="1.5" v-if="false">
+        <el-button
+          type="success"
+          plain
+          icon="el-icon-edit"
+          size="mini"
+          :disabled="single"
+          @click="handleUpdate"
+          >修改
+        </el-button>
+      </el-col> -->
+        <el-col :span="1.5">
+          <el-button
+            type="danger"
+            plain
+            icon="el-icon-delete"
+            size="mini"
+            :disabled="multiple"
+            @click="myDeleteHandler"
+            >删除
+          </el-button>
+        </el-col>
+        <!-- <el-col :span="1.5">
+          <el-button
+            plain
+            icon="el-icon-upload2"
+            size="mini"
+            @click="upload.open = true"
+          >导入
+          </el-button>
+        </el-col>
+        <el-col :span="1.5">
+          <el-button
+            type="warning"
+            plain
+            icon="el-icon-download"
+            size="mini"
+            @click="handleExport"
+          >导出
+          </el-button>
+        </el-col> -->
+
+        <right-toolbar
+          style="float: right"
+          :showCount.sync="showCount"
+          :showSearch.sync="showSearch"
+          :counts="true"
+          @queryTable="pageList"
+        ></right-toolbar>
+        <el-radio-group
+          style="float: right; margin-right: 100px"
+          v-model="queryParams.orderType"
+          size="mini"
+          @change="orderTypeChange"
+        >
+          <el-radio-button :label="null">全部</el-radio-button>
+          <el-radio-button :label="1">库存</el-radio-button>
+          <el-radio-button :label="2">生产</el-radio-button>
+        </el-radio-group>
+      </el-row>
+      <el-table
+        v-loading="loading"
+        :data="tableList"
+        @selection-change="handleSelectionChange"
+        ref="tableRef"
+        :cell-style="cellStyle"
+        :reserve-selection="true"
+        row-key="saleOrderId"
+      >
+        <el-table-column
+          type="selection"
+          width="55"
+          reserve-selection
+          align="center"
+        >
+        </el-table-column>
+        <el-table-column
+          v-for="item in columns"
+          :key="item.key"
+          :label="item.value"
+          align="center"
+          :prop="item.key"
+        >
+          <template slot-scope="scope">
+            <!-- 存在字段样式或字典样式 -->
+            <template
+              v-if="
+                scope.row.styleFieldObj != undefined &&
+                scope.row.styleFieldObj[item.key]
+              "
+            >
+              <!-- 字段样式 -->
+              <template v-if="scope.row.styleFieldObj[item.key].styleType == 1">
+                <!-- 一般字体样式 -->
+                <template
+                  v-if="scope.row.styleFieldObj[item.key].fieldStyleType == 0"
+                >
+                  <span
+                    :style="`color:${
+                      scope.row.styleFieldObj[item.key].fontColor
+                    }`"
+                    >{{ scope.row[item.key] }}</span
+                  >
+                </template>
+                <!-- 标签字体样式 -->
+                <template
+                  v-else-if="
+                    scope.row.styleFieldObj[item.key].fieldStyleType == 1
+                  "
+                >
+                  <el-tag
+                    :type="scope.row.styleFieldObj[item.key].tagType"
+                    :effect="
+                      scope.row.styleFieldObj[item.key].isTagFullBg
+                        ? 'dark'
+                        : 'light'
+                    "
+                  >
+                    {{ scope.row[item.key] }}
+                  </el-tag>
+                </template>
+              </template>
+              <!-- 字典样式 -->
+              <template
+                v-else-if="scope.row.styleFieldObj[item.key].styleType == 2"
+              >
+                <span
+                  v-if="
+                    scope.row.styleFieldObj[item.key].listClass == '' ||
+                    scope.row.styleFieldObj[item.key].listClass == 'default'
+                  "
+                  >{{ scope.row.styleFieldObj[item.key].dictLabel }}</span
+                >
+                <el-tag
+                  v-else
+                  :type="
+                    scope.row.styleFieldObj[item.key].listClass == 'primary'
+                      ? ''
+                      : scope.row.styleFieldObj[item.key].listClass
+                  "
+                  >{{ scope.row.styleFieldObj[item.key].dictLabel }}
+                </el-tag>
+              </template>
+            </template>
+            <!-- 显示默认值 -->
+            <template v-else>
+              {{ scope.row[item.key] }}
+            </template>
+          </template>
+        </el-table-column>
+        <el-table-column
+          v-if="isShowExcuteCol"
+          label="操作"
+          align="center"
+          class-name="small-padding fixed-width"
+        >
+          <template slot-scope="scope">
+            <!-- <el-button
+            type="info"
+            size="default"
+            @click="handleEdit(scope.$index, scope.row)"
+            >编辑</el-button
+          > -->
+
+            <Menu
+              :row="scope.row"
+              v-for="btnObj in excuteBtnArr"
+              :key="btnObj.id"
+              :listAll="btnObj"
+              @excuteHandler="excuteHandler"
+            ></Menu>
+          </template>
+        </el-table-column>
+      </el-table>
+      <pagination
+        v-show="total > 0"
+        :total="total"
+        :page.sync="queryParams.pageNum"
+        :limit.sync="queryParams.pageSize"
+        @pagination="pageList"
+      />
+      <!-- k-form-build 组件渲染弹窗-->
+      <el-dialog :title="title" :visible.sync="kOpen" append-to-body>
+        <k-form-build
+          v-if="jsonData"
+          class="formBuild"
+          ref="addFromRef"
+          :dynamicData="dynamicData"
+          :defaultValue="defaultValue"
+          @submit="tempSubBtn"
+          @change="formChangeHandler"
+          :value="jsonData"
+        />
+        <div slot="footer" class="dialog-footer">
+          <el-button type="primary" @click="editConfirmHandler"
+            >确 定
+          </el-button>
+          <el-button @click="kCancel">取 消</el-button>
+        </div>
+      </el-dialog>
+      <!-- 添加或修改销售出库单:- 过磅记录生成数据对话框 -->
+      <el-dialog
+        :title="title"
+        width="1300px"
+        :visible.sync="open"
+        append-to-body
+      >
+        <el-row :gutter="20">
+          <el-form
+            :model="formData"
+            ref="formDataRef"
+            :rules="rules"
+            label-width="100px"
+            :inline="true"
+            size="normal"
+          >
+            <el-col :span="12">
+              <el-form-item prop="saleNo" label="合同号:">
+                <el-input size="small" v-model="formData.saleNo"></el-input>
+              </el-form-item>
+            </el-col>
+            <!-- <el-col :span="12">
+              <el-form-item prop="lotNumber" label="批号:">
+                <el-input size="small" v-model="formData.lotNumber"></el-input>
+              </el-form-item>
+            </el-col> -->
+            <!-- <el-col :span="12">
+              <el-form-item prop="saleDate" label="日期:">
+                <el-date-picker
+                  size="small"
+                  v-model="formData.saleDate"
+                  value-format="yyyy-MM-dd"
+                  format="yyyy-MM-dd"
+                  type="date"
+                  placeholder="选择日期"
+                >
+                </el-date-picker>
+              </el-form-item>
+            </el-col> -->
+            <el-col :span="12">
+              <el-form-item prop="saleCustomNo" label="客户名称:">
+                <el-select
+                  size="small"
+                  v-model="formData.saleCustomNo"
+                  placeholder="请选择客户"
+                  clearable
+                  filterable
+                  @change="customChangeHandler"
+                >
+                  <el-option
+                    v-for="item in customerOptions"
+                    :key="item.customNo"
+                    :label="item.customName"
+                    :value="item.customNo"
+                  >
+                  </el-option>
+                </el-select>
+              </el-form-item>
+            </el-col>
+            <el-col :span="12">
+              <el-form-item label="联系人:" size="normal">
+                {{ formData.contactPerson }}
+              </el-form-item>
+              <el-form-item label="客户地址:" size="normal">
+                {{ formData.customAddress }}
+              </el-form-item>
+              <el-form-item label="客户国别:" size="normal">
+                {{ formData.customCountryType }}
+              </el-form-item>
+            </el-col>
+            <el-col :span="12">
+              <el-form-item
+                label-width="120px"
+                prop="saleOrderEstimatedTime"
+                label="预计下单时间:"
+              >
+                <el-date-picker
+                  size="small"
+                  v-model="formData.saleOrderEstimatedTime"
+                  value-format="yyyy-MM-dd"
+                  format="yyyy-MM-dd"
+                  type="date"
+                  placeholder="选择日期"
+                >
+                </el-date-picker>
+              </el-form-item>
+            </el-col>
+            <el-col :span="12">
+              <el-form-item label="交货天数:" size="normal" prop="saleLeadTime">
+                <el-input
+                  size="small"
+                  v-model="formData.saleLeadTime"
+                ></el-input>
+              </el-form-item>
+            </el-col>
+            <el-col :span="12">
+              <el-form-item label="交货日期:" size="normal" prop="deliveryDate">
+                <el-date-picker
+                  size="small"
+                  v-model="formData.deliveryDate"
+                  value-format="yyyy-MM-dd"
+                  format="yyyy-MM-dd"
+                  type="date"
+                  placeholder="选择日期"
+                >
+                </el-date-picker>
+              </el-form-item>
+            </el-col>
+            <el-col :span="24">
+              <el-divider>货品明细</el-divider>
+            </el-col>
+            <el-table
+              :data="productionTableData"
+              border
+              show-summary
+              :summary-method="getSummaries"
+              sum-text="小计"
+              style="width: 100%"
+            >
+              <el-table-column prop="productName" label="品名" width="180">
+                <template slot-scope="scope">
+                  <!-- <el-input
+                v-model="scope.row.productName"
+                size="small"
+                clearable
+              ></el-input> -->
+                  <el-form-item
+                    :prop="'productName-' + scope.$index"
+                    :name="'productName-' + scope.$index"
+                    style="margin: 0px; padding: 0px"
+                  >
+                    <!-- @change="
+                        handleProductChange(scope.row.productNo, scope.row)
+                        :filter-method="(val) => mySelectFilter(val, scope.row)"
+                      " -->
+                    <el-select
+                      v-model="scope.row.productName"
+                      placeholder=""
+                      filterable
+                      @change="
+                        newProductChange(scope.row.productName, scope.row)
+                      "
+                    >
+                      <el-option
+                        v-for="item in productionOptions"
+                        :key="item.productNo"
+                        :label="item.productName"
+                        :value="item.productName"
+                      >
+                        <span class="discribe" style="float: left">{{
+                          item.productName
+                        }}</span>
+                        <!-- <span
+                          style="float: right; color: #8492a6; font-size: 13px"
+                          >{{ item.productSpecifications }}</span
+                        > -->
+                      </el-option>
+                    </el-select>
+                  </el-form-item>
+                </template>
+              </el-table-column>
+              <el-table-column
+                prop="productSpecifications"
+                width="180"
+                label="规格"
+              >
+                <template slot-scope="scope">
+                  <el-select
+                    v-model="scope.row.productSpecifications"
+                    @change="handleSpecificationsChange(scope.row)"
+                    placeholder=""
+                    filterable
+                  >
+                    <el-option
+                      v-for="item in scope.row.specificationsList"
+                      :key="item.productSpecifications"
+                      :label="item.productSpecifications"
+                      :value="item.productSpecifications"
+                    >
+                      <span class="discribe" style="float: left">{{
+                        item.productSpecifications
+                      }}</span>
+                      <span
+                        style="float: right; color: #8492a6; font-size: 13px"
+                        >{{ item.productType }}</span
+                      >
+                    </el-option>
+                  </el-select>
+                </template>
+              </el-table-column>
+              <el-table-column prop="productType" label="类型">
+              </el-table-column>
+              <el-table-column prop="colourNumber" width="130" label="色号">
+                <template slot-scope="scope">
+                  <el-form-item
+                    :prop="'colourNumber-' + scope.$index"
+                    :name="'colourNumber-' + scope.$index"
+                    style="margin: 0px; padding: 0px"
+                  >
+                    <el-select
+                      v-model="scope.row.colourNumber"
+                      placeholder=""
+                      filterable
+                      @change="colourNumberChangeHandler(scope.row)"
+                    >
+                      <el-option
+                        v-for="item in colourNumberOptions"
+                        :key="item.materielCode"
+                        :label="item.materieEncoding + item.materieColorNumber"
+                        :value="item.materielCode"
+                      >
+                        <span class="discribe" style="float: left">{{
+                          item.materieEncoding + item.materieColorNumber
+                        }}</span>
+                        <!-- <span
+                        style="float: right; color: #8492a6; font-size: 13px"
+                        >{{ item.materielCode }}</span
+                      > -->
+                      </el-option>
+                    </el-select>
+                  </el-form-item>
+                </template>
+              </el-table-column>
+              <el-table-column prop="productNumber" label="数量/kg">
+                <template slot-scope="scope">
+                  <el-form-item
+                    :prop="'productNumber-' + scope.$index"
+                    :name="'productNumber-' + scope.$index"
+                    style="margin: 0px; padding: 0px"
+                  >
+                    <el-input
+                      v-model="scope.row.productNumber"
+                      oninput="value=value.replace(/[^0-9.]/g,'')"
+                      size="small"
+                      clearable
+                      @change="computedPrice(scope.row)"
+                    ></el-input>
+                  </el-form-item>
+                </template>
+              </el-table-column>
+              <el-table-column prop="productUnitPrice" label="单价">
+                <template slot-scope="scope">
+                  <el-form-item
+                    :prop="'productUnitPrice-' + scope.$index"
+                    :name="'productUnitPrice-' + scope.$index"
+                    style="margin: 0px; padding: 0px"
+                  >
+                    <el-input
+                      v-model="scope.row.productUnitPrice"
+                      size="small"
+                      oninput="value=value.replace(/[^0-9.]/g,'')"
+                      @change="computedPrice(scope.row)"
+                      clearable
+                    ></el-input>
+                  </el-form-item>
+                </template>
+              </el-table-column>
+              <el-table-column prop="productAmounts" label="金额">
+                <template slot-scope="scope">
+                  {{ scope.row.productAmounts }}
+                </template>
+              </el-table-column>
+              <el-table-column prop="sliceType" label="切片型号">
+                <template slot-scope="scope">
+                  <el-form-item
+                    :prop="'sliceType-' + scope.$index"
+                    :name="'sliceType-' + scope.$index"
+                    style="margin: 0px; padding: 0px"
+                  >
+                    <el-select
+                      v-model="scope.row.sliceType"
+                      placeholder=""
+                      clearable
+                      filterable
+                      @change="sliceTypeChangeHandler(scope.row)"
+                    >
+                      <el-option
+                        v-for="item in sliceTypeOptions"
+                        :key="item.materielCode"
+                        :label="item.materielName"
+                        :value="item.materielCode"
+                      >
+                      </el-option>
+                    </el-select>
+                  </el-form-item>
+                </template>
+              </el-table-column>
+
+              <el-table-column prop="remark" label="备注">
+                <template slot-scope="scope">
+                  <el-input
+                    v-model="scope.row.remark"
+                    size="small"
+                    clearable
+                  ></el-input>
+                </template>
+              </el-table-column>
+              <el-table-column label="操作">
+                <template slot-scope="scope">
+                  <el-button
+                    type="danger"
+                    size="small"
+                    @click="deleteProduct(scope.$index)"
+                    >删除
+                  </el-button>
+                </template>
+              </el-table-column>
+            </el-table>
+            <el-button
+              class="mt5"
+              type="primary"
+              style="width: 100%"
+              size="small"
+              @click="addProduct"
+              >添加货品
+            </el-button>
+            <el-col :span="12">
+              <el-form-item label-width="120px" label="合计金额(大写)">
+                <!-- <el-input
+                  v-model="formData.saleAmountInWords"
+                  size="small"
+                  clearable
+                ></el-input> -->
+                {{ formData.saleAmountInWords }}
+              </el-form-item>
+            </el-col>
+            <el-col :span="12">
+              <el-form-item prop="salePayType" label="付款方式">
+                <!-- <el-input
+                v-model="formData.salePayType"
+                size="small"
+                clearable
+              ></el-input> -->
+                <el-select
+                  v-model="formData.salePayType"
+                  size="small"
+                  clearable
+                  filterable
+                >
+                  <el-option
+                    v-for="item in dict.type.payment_method"
+                    :key="item.value"
+                    :label="item.label"
+                    :value="item.value"
+                  ></el-option>
+                </el-select>
+              </el-form-item>
+            </el-col>
+            <el-col :span="12" v-show="formData.salePayType == '1'">
+              <el-form-item prop="earnestMoney" label="定金">
+                <el-input
+                  v-model="formData.earnestMoney"
+                  clearable
+                  size="small"
+                />
+              </el-form-item>
+            </el-col>
+            <el-col :span="24">
+              <el-divider>工艺要求</el-divider>
+            </el-col>
+            <el-col :span="12">
+              <el-form-item label="网络:">
+                <el-input
+                  v-model="formData.craftGrid"
+                  size="small"
+                  clearable
+                ></el-input>
+              </el-form-item>
+            </el-col>
+            <el-col :span="12">
+              <el-form-item label="油剂:">
+                <el-input
+                  v-model="formData.craftOil"
+                  size="small"
+                  clearable
+                ></el-input>
+              </el-form-item>
+            </el-col>
+            <el-col :span="12">
+              <el-form-item label="卷装:">
+                <el-input
+                  v-model="formData.craftPackage"
+                  size="small"
+                  clearable
+                ></el-input>
+              </el-form-item>
+            </el-col>
+            <el-col :span="12">
+              <el-form-item label="色牢度:">
+                <el-input
+                  v-model="formData.craftColorFastness"
+                  size="small"
+                  clearable
+                ></el-input>
+              </el-form-item>
+            </el-col>
+            <el-col :span="12">
+              <el-form-item label="捻向:">
+                <el-select
+                  v-model="formData.directionOfTwist"
+                  clearable
+                  filterable
+                >
+                  <el-option
+                    v-for="item in dict.type.direction_of_twist"
+                    :key="item.value"
+                    :label="item.label"
+                    :value="item.value"
+                  >
+                  </el-option>
+                </el-select>
+              </el-form-item>
+            </el-col>
+            <el-col :span="12">
+              <el-form-item label="其它:">
+                <el-input
+                  v-model="formData.craftOther"
+                  size="small"
+                  clearable
+                ></el-input>
+              </el-form-item>
+            </el-col>
+            <el-col :span="12">
+              <el-form-item label="包装/贴唛:">
+                <el-input
+                  v-model="formData.craftMark"
+                  size="small"
+                  clearable
+                ></el-input>
+              </el-form-item>
+            </el-col>
+            <el-col :span="12">
+              <el-form-item label="运输方式:">
+                <el-input
+                  v-model="formData.shippingMethod"
+                  size="small"
+                  clearable
+                ></el-input>
+              </el-form-item>
+            </el-col>
+            <el-col :span="24">
+              <el-divider>审计人员数据</el-divider>
+            </el-col>
+            <el-col :span="12">
+              <el-form-item label="业务员:">
+                <!-- <el-input
+            v-model="formData.salesman"
+            size="small"
+            clearable
+          ></el-input> -->
+                {{ nickName }}
+              </el-form-item>
+            </el-col>
+          </el-form>
+        </el-row>
+        <div slot="footer" class="dialog-footer">
+          <el-button type="primary" @click="editConfirm">确 定</el-button>
+          <el-button @click="cancel">取 消</el-button>
+        </div>
+      </el-dialog>
+
+      <!-- 绑定按钮dialog -->
+      <el-dialog
+        title="提示"
+        :visible.sync="btnDialogVisible"
+        :before-close="handleClose"
+      >
+        <DialogTemplate
+          ref="dialogRef"
+          :groupKey="groupKey"
+          :rowobj="rowobj"
+          :subCount="subCount"
+          :tableCount="tableCount"
+          :subTableName="subTableName"
+          @addList="addListHandler"
+        >
+        </DialogTemplate>
+        <span slot="footer" class="dialog-footer">
+          <el-button @click="btnDialogVisible = false">取 消</el-button>
+          <el-button type="primary" @click="btnComfirm">确 定</el-button>
+        </span>
+      </el-dialog>
+
+      <!-- 自定义弹窗 -->
+      <el-dialog title="提示" :visible.sync="deliverShow" width="1200px">
+        <!-- <DialogTemplate
+        ref="dialogRef"
+        :groupKey="groupKey"
+        :rowobj="rowobj"
+        :subCount="subCount"
+        :tableCount="tableCount"
+        :subTableName="subTableName"
+        @addList="addListHandler"
+      >
+      </DialogTemplate> -->
+        <Deliver ref="deliverRef" :currentRow="currentRow"></Deliver>
+        <span slot="footer" class="dialog-footer">
+          <el-button @click="deliverShow = false">取 消</el-button>
+          <el-button type="primary" @click="btnComfirm">确 定</el-button>
+        </span>
+      </el-dialog>
+      <!-- 详情弹窗 -->
+      <el-dialog title="详情" :visible.sync="detailShow" width="1250px">
+        <div ref="detailTable" id="detail"></div>
+        <span slot="footer" class="dialog-footer">
+          <el-button @click="detailShow = false">取 消</el-button>
+          <el-button type="primary" @click="detailPrintHandler"
+            >打 印</el-button
+          >
+        </span>
+      </el-dialog>
+      <!-- 销售出库弹窗 -->
+      <el-dialog
+        title="打印-销售出库单"
+        :visible.sync="outBoundShow"
+        width="1000px"
+      >
+        <OutBound ref="outBoundRef" :currentRow="currentRow"></OutBound>
+        <span slot="footer" class="dialog-footer">
+          <el-button @click="outBoundShow = false">取 消</el-button>
+          <el-button type="primary" @click="outBoundPrintHandler">
+            打印</el-button
+          >
+        </span>
+      </el-dialog>
+      <!-- 出库明细 -->
+      <el-dialog title="出库明细" :visible.sync="outStockShow" width="1200px">
+        <OutStock ref="outStockRef"></OutStock>
+        <span slot="footer" class="dialog-footer">
+          <el-button @click="outStockShow = false">关 闭</el-button>
+          <!-- <el-button type="primary" @click="btnComfirm">确 定</el-button> -->
+        </span>
+      </el-dialog>
+      <div id="printDom"></div>
+    </div>
+  </el-card>
+</template>
+<script>
+import {
+  delTableData,
+  dragTableInfo,
+  listTable,
+  unionListTableData,
+  getInfoBySqlKey,
+  btnCommonApi,
+  addTableData,
+  batchEdit,
+  getStatisticList,
+  getTableList1,
+  checkOrderNo,
+  delOrder,
+  productInvoiceInfo,
+  addProductInvoice,
+  updateProductInvoice,
+  saleOrderList,
+  queryMaterielList,
+  getSaleOrderProductionListDistinct,
+  getProductSpecificationsByProductName,
+} from "@/api/tablelist/commonTable";
+import { updateOrder } from "@/api/system/retailMange.js";
+import { listData } from "@/api/system/tenant/data";
+import { getToken } from "@/utils/auth";
+import Queryfrom from "@/views/tablelist/commonTable/queryfrom.vue";
+import { camelCase, toUnderline } from "@/utils";
+import { inputDisableComplete } from "@/utils/other";
+import Menu from "@/views/tablelist/commonTable/BtnMenu.vue";
+import { checkRole } from "@/utils/permission";
+import DialogTemplate from "@/views/dialogTemplate/components/index.vue";
+import {
+  queryDropDownBoxData,
+  getSaleOrderProductionList,
+} from "@/api/dragform/form";
+import { v4 as uuidv4 } from "uuid";
+import { mapState } from "vuex";
+import moment from "moment";
+import Deliver from "@/views/orderMange/components/dialogForm/Deliver.vue";
+import OutBound from "@/views/orderMange/components/dialogForm/OutBound.vue";
+import outBoundPrint from "@/utils/print/outBoundPrint";
+import { listCustomer } from "@/api/system/customer";
+import OutStock from "@/views/orderMange/components/dialogForm/OutStock.vue";
+import { numToCapital } from "@/utils/other";
+
+export default {
+  name: "processingOrder",
+  dicts: ["payment_method", "direction_of_twist"],
+  components: { Queryfrom, Menu, DialogTemplate, Deliver, OutBound, OutStock },
+  data() {
+    return {
+      totalMoney: "", //总金额 小写
+      outStockShow: false, //出库详情
+      selection: [], //勾选的数据
+      // 出库单 start
+      outBoundShow: false,
+      // 出库单 end
+      // 发货 start
+      deliverShow: false,
+      // 发货 end
+
+      // 出库单  start
+
+      // 出库单  end
+      myDelIds: [], //新增接口 删除的id
+      // 详情弹窗数据
+      detailShow: false,
+      printDomData: "",
+      // k-form-build组件渲染弹窗
+      kOpen: false,
+      // 新的自定义数据 start
+      orderType: 0, //新的条件查询参数
+      productIds: [], //货品Ids
+      isEdit: false,
+      formData: {
+        //订单表数据
+        saleNo: "", //合同号
+        saleCustomNo: "", //客户编号
+        saleDate: "", //销售单日期
+        saleOrderEstimatedTime: "", //预计下单时间
+        saleLeadTime: "", //交货周期
+        deliveryDate: "", //交货日期
+        saleAmounts: "", //合计金额 小写
+        saleAmountInWords: "", //合计金额 大写
+        salePayType: "", //支付方式
+        earnestMoney: "", //定金
+        salesman: "", //业务员
+        saleLeader: "", //业务主管
+        finance: "", //财务部
+        production: "", //生产部
+        saleApprover: "", //批准人
+        customAddress: "", //客户地址
+        customCountryType: "", //国家类型
+        contactPerson: "", //联系人
+        // 货品明细表数据
+        lotNumber: "", //批号
+        productNo: "", //货品号
+        productName: "", //货品名称
+        productNumber: "", //销售数量
+        productWeight: "", //销售重量kg
+        productUnitPrice: "", //单价
+        productAmounts: "", //金额
+        sliceType: "", //切片类型
+        sliceTypeLabel: "",
+        colourNumberLabel: "",
+        colourNumber: "", //色号
+        remark: "", //备注
+        // 工艺表
+        craftGrid: "", //网络
+        craftOil: "", //油剂
+        craftPackage: "", //卷装
+        craftColorFastness: "", //色牢度
+        directionOfTwist: "", //捻向
+        craftOther: "", //其它工艺要求
+        craftMark: "", //包装/贴唛
+        shippingMethod: "", //运输方式
+      },
+      sliceTypeOptions: [], //切片型号选项
+      colourNumberOptions: [], //色号选项
+      allProductionOptions: [], //所有产品选项
+      productionOptions: [],
+      customerOptions: [],
+      productionTableData: [
+        // {
+        //   productNo: "", //货品名称
+        //   productNumber: 2, //销售数量
+        //   productWeight: 1, //销售重量kg
+        //   productUnitPrice: 20, //单价
+        //   productAmounts: 20, //金额
+        //   remark: "", //备注
+        // },
+      ],
+      rules: {
+        // deliveryDate: [
+        //   {
+        //     required: true,
+        //     message: "请选择交货日期",
+        //     trigger: "change",
+        //   },
+        // ],
+        salePayType: [
+          {
+            required: true,
+            message: "请选择付款方式",
+            trigger: "change",
+          },
+        ],
+        saleNo: [
+          {
+            required: true,
+            message: "请输入合同号",
+            trigger: "blur",
+          },
+          {
+            validator: this.validateOrderNo,
+            trigger: "blur",
+          },
+        ],
+        saleDate: [
+          {
+            required: true,
+            message: "请选择日期",
+            trigger: "change",
+          },
+        ],
+        // lotNumber: [
+        //   {
+        //     required: true,
+        //     message: "请输入批号",
+        //     trigger: "blur",
+        //   },
+        // ],
+        saleCustomNo: [
+          {
+            required: true,
+            message: "请选择客户",
+            trigger: "change",
+          },
+        ],
+        // saleOrderEstimatedTime: [
+        //   {
+        //     required: true,
+        //     message: "请选择预计下单时间",
+        //     trigger: "change",
+        //   },
+        // ],
+        // saleLeadTime: [
+        //   {
+        //     required: true,
+        //     message: "请输入交货天数",
+        //     trigger: "blur",
+        //   },
+        // ],
+        earnestMoney: [
+          {
+            validator: this.validateEarnestMoney,
+            trigger: "blur",
+          },
+        ],
+      },
+
+      // end
+      // 绑定按钮dialog
+      btnDialogVisible: false,
+      // 绑定修改dialog
+      groupKey: "",
+      // 遮罩层
+      loading: true,
+      // 选中数组
+      ids: [],
+      // 非单个禁用
+      single: true,
+      // 非多个禁用
+      multiple: true,
+      // 显示统计
+      showCount: true,
+      // 显示搜索条件
+      showSearch: true,
+      // 总条数
+      total: 0,
+      // 用户表格数据
+      tableList: [],
+      // 弹出层标题
+      title: "",
+      // 日期范围
+      dateRange: [],
+      // 表单参数
+      form: {},
+      // cru 弹窗
+      open: false,
+      // excel共通导入数据
+      upload: {
+        // 是否显示弹出层
+        open: false,
+        // 弹出层标题(
+        title: "",
+        // 是否禁用上传
+        isUploading: false,
+        // 是否更新已经存在的数据
+        updateSupport: 0,
+        // 设置上传的请求头部
+        headers: { Authorization: "Bearer " + getToken() },
+        // 上传的地址
+        url: process.env.VUE_APP_BASE_API1 + "common/uploadData",
+      },
+      // 排序方式 默认降序
+      sortOrder: true,
+      // 共通查询参数接受子组件的参数
+      queryParams: {
+        orderType: null,
+        pageNum: 1, // 第几页
+        pageSize: 10, // 每页大小
+        orderByColumn: "", // 根据某列排序
+        isAsc: "", // desc(降序)或 asc(升序)
+        saleOrderOrderType: "",
+        saleOrderTechnologyNo:"processingOrder",
+        // 基本查询参数
+        basicMap: {
+          tableName: "drag_form",
+        },
+        // 当前表字段筛选参数
+        queryMap: {
+          // 当前查询基本参数
+          // ... key : value         当前页面的筛选条件
+          // 超级查询的唯一值
+          queryCriteriaValue: "",
+        },
+      },
+      // 列信息
+      columns: {},
+      // 当前模版信息
+      templateInfo: {},
+      // 查询条件
+      queryFromWhere: {},
+      // 当前table唯一标识
+      tableKey: null,
+      // 当前表名称
+      tableName: null,
+      //存放html代码块
+      iframeUrl: "",
+      //存放表单渲染数据
+      jsonData: {},
+      // 回显表格数据,
+      defaultValue: {},
+      // 统计card
+      statisticList: [],
+      // 样式表
+      styleList: [],
+      // 字典样式对象
+      dictStyleObj: {},
+      // 操作列 按钮数据
+      excuteBtnArr: [],
+      // 下拉框动态数据
+      dynamicData: {},
+      // 当前点击按钮的数据
+      currentBtnData: {},
+      // 修改选中行
+      rowobj: {},
+      // 该行的统计信息
+      subCount: [],
+      tableCount: [],
+      // 弹窗新增数据
+      addLists: [],
+      subTableName: "",
+      // 当前点击行的数据
+      currentRow: {},
+    };
+  },
+
+  created() {
+    // 得到当前展示的table的唯一标识
+    this.tableKey = this.$route.query.tableKey;
+  },
+  watch: {
+    totalMoney: {
+      handler(newVal, oldVal) {
+        if (isNaN(Number(newVal))) {
+          this.formData.saleAmountInWords = "零";
+        } else {
+          const ntc = new numToCapital();
+          this.formData.saleAmountInWords = ntc.uppercase(newVal);
+        }
+      },
+      deep: true,
+      immediate: true,
+    },
+  },
+  async mounted() {
+    await this.getDropDownData();
+  },
+  computed: {
+    isShowExcuteCol() {
+      return !this.excuteBtnArr?.every((arr) => arr.children.length == 0);
+    },
+    ...mapState({
+      nickName: (state) => state.user.nickName,
+    }),
+  },
+  methods: {
+    // 规格变化回调
+    handleSpecificationsChange(row) {
+      let { productSpecifications, specificationsList } = row;
+      if (productSpecifications) {
+        let targetItem = specificationsList.find(
+          (item) => item.productSpecifications == productSpecifications
+        );
+        console.log(targetItem);
+        row.productNo = targetItem?.productNo;
+        row.productType = targetItem?.productType;
+      } else {
+        row.productNo = "";
+        row.productType = "";
+      }
+    },
+    // 新的产品改变回调
+    async newProductChange(productName, row) {
+      // 发请求获取对应的规格数据
+      if (!productName) {
+        row.specificationsList = [];
+        (row.productNo = ""), (row.productType = "");
+        row.productSpecifications = "";
+        return;
+      }
+      // let targetItem = this.productionOptions.find(
+      //   (item) => item.productNo == productNo
+      // );
+      // row.productName = targetItem?.productName;
+      // row.productType = targetItem?.productType;
+      // 获取规格数据
+      let res = await getProductSpecificationsByProductName({
+        productName: productName,
+      });
+      if (res.code == 200) {
+        row.specificationsList = res.data;
+        console.log(row.specificationsList);
+        let defaultItem = row.specificationsList.find(
+          (item) => item.isDefaultSpecifications
+        );
+        if (defaultItem) {
+          row.productSpecifications = defaultItem.productSpecifications;
+          row.productNo = defaultItem.productNo;
+          row.productType = defaultItem.productType;
+        } else {
+          row.productSpecifications =
+            row.specificationsList[0]?.productSpecifications || "";
+          row.productNo = row.specificationsList[0]?.productNo || "";
+          row.productType = row.specificationsList[0]?.productType || "";
+        }
+      } else {
+        row.specificationsList = [];
+      }
+    },
+    // 自定义筛选方法
+    mySelectFilter(value, row) {
+      console.log(value);
+      // row.productNo = value;
+      if (value) {
+        let target = [];
+        // 在全部列表中查找
+        target = this.allProductionOptions.filter((item) =>
+          item.productName.includes(value)
+        );
+        console.log(target);
+        this.productionOptions = target;
+        // if (target.length) {
+        //   this.productionOptions = target;
+        //   return true;
+        // } else {
+        //   return false;
+        // }
+      } else {
+        this.productionOptions = this.allProductionOptions.slice(0, 500);
+      }
+    },
+    // 出库单回调
+    async myPrintOutBoundHandler(row, data) {
+      console.log("row", row);
+      this.currentRow = row;
+      this.outBoundShow = true;
+      this.$nextTick(() => {
+        this.$refs.outBoundRef.getTableData(row, false);
+      });
+    },
+    // 出库单打印回调
+    async outBoundPrintHandler() {
+      let res = await this.$refs.outBoundRef.getPrintData();
+      console.log(res);
+      if (res.flag) {
+        res.data.form.printUser = this.nickName;
+        outBoundPrint(res.data, "printDom", false);
+      }
+    },
+    // 产品名失焦
+    handleProductBlur(productNo, row) {
+      console.log("blur", productNo);
+      // if (!productNo) {
+      //   this.productionOptions = this.allProductionOptions.slice(0, 500);
+      //   row.productType = "";
+      // }
+    },
+    // 产品名称改变
+    handleProductChange(productNo, row) {
+      console.log(productNo);
+      if (!productNo) {
+        this.productionOptions = this.allProductionOptions.slice(0, 500);
+        row.productType = "";
+        return;
+      }
+      let targetItem = this.allProductionOptions.find(
+        (item) => item.productNo == productNo
+      );
+      row.productName = targetItem?.productName;
+      row.productType = targetItem?.productType;
+      if (targetItem) {
+        targetItem = JSON.parse(JSON.stringify(targetItem));
+      }
+
+      this.productionOptions = this.allProductionOptions.slice(0, 500);
+      if (!this.productionOptions.find((item) => item.productNo == productNo)) {
+        this.productionOptions.unshift(targetItem);
+      }
+    },
+    // 订单类型改变回调
+    orderTypeChange(type) {
+      this.getList(false, type);
+    },
+    // 生成合同号
+    getSaleNo() {
+      let timeStr = moment().format("YYYYMMDD");
+      for (var i = 0; i < 5; i++) {
+        timeStr += parseInt(Math.random() * 10);
+      }
+      return timeStr;
+    },
+    // 重置审计表单数据
+    resetFormData() {
+      Object.assign(this.formData, {
+        //订单表数据
+        saleNo: this.getSaleNo(), //合同号
+        saleCustomNo: "", //客户编号
+        saleDate: moment(new Date()).format("YYYY-MM-DD"), //销售单日期
+        saleOrderEstimatedTime: moment(new Date()).format("YYYY-MM-DD"), //预计下单时间
+        saleLeadTime: "", //交货周期
+        deliveryDate: "",
+        saleAmounts: "", //合计金额 小写
+        saleAmountInWords: "", //合计金额 大写
+        salePayType: "", //支付方式
+        earnestMoney: "",
+        salesman: "", //业务员
+        saleLeader: "", //业务主管
+        finance: "", //财务部
+        production: "", //生产部
+        saleApprover: "", //批准人
+        customAddress: "", //客户地址
+        customCountryType: "", //国家类型
+        contactPerson: "", //联系人
+        // 货品明细表数据
+        lotNumber: "", //批号
+        productNo: "", //货品号
+        productName: "", //货品名称
+        productNumber: "", //销售数量
+        productWeight: "", //销售重量kg
+        productUnitPrice: "", //单价
+        productAmounts: "", //金额
+        sliceType: "", //切片类型
+        sliceTypeLabel: "",
+        colourNumberLabel: "",
+        colourNumber: "", //色号
+        remark: "", //备注
+        // 工艺表
+        craftGrid: "", //网络
+        craftOil: "", //油剂
+        craftPackage: "", //卷装
+        craftColorFastness: "", //色牢度
+        directionOfTwist: "",
+        craftOther: "", //其它工艺要求
+        craftMark: "", //包装/贴唛
+        shippingMethod: "", //运输方式
+      });
+      this.productionTableData = [];
+    },
+    // 自定义的小计计算方法
+    getSummaries(param) {
+      const { columns, data } = param;
+      console.log(columns, data);
+      const sums = [];
+      columns.forEach((column, index) => {
+        if (index === 0) {
+          sums[index] = "小计";
+          return;
+        }
+        const values = data.map((item) => Number(item[column.property]));
+        if (
+          index === 1 ||
+          index === 2 ||
+          index === 3 ||
+          index === 7 ||
+          index === 8 ||
+          index === 9
+        ) {
+          sums[index] = "";
+        } else if (!values.every((value) => isNaN(value))) {
+          sums[index] = values
+            .reduce((prev, curr) => {
+              const value = Number(curr);
+              if (!isNaN(value)) {
+                return prev + curr;
+              } else {
+                return prev;
+              }
+            }, 0)
+            ?.toFixed(2);
+          if (index == 4) {
+            this.totalMoney = sums[index];
+          }
+        } else {
+          sums[index] = "N/A";
+        }
+      });
+
+      return sums;
+    },
+    // 货品表格数据删除回调
+    deleteProduct(index) {
+      this.productionTableData.splice(index, 1);
+      this.initTableValidate();
+    },
+    // 货品表格数据新增回调
+    addProduct() {
+      this.productionTableData.push({
+        saleProductNo: uuidv4(),
+        productNo: "", //货品编号
+        productType: "", //类型
+        productName: "", //货品名称
+        productNumber: 0, //销售数量
+        productWeight: 0, //销售重量kg
+        productUnitPrice: 0, //单价
+        productAmounts: "", //金额
+        sliceType: "", //切片类型
+        sliceTypeLabel: "",
+        colourNumberLabel: "",
+        colourNumber: "", //色号
+        remark: "", //备注
+        specificationsList: [],
+        productSpecifications: "", //型号
+      });
+      // 添加校验规则
+      this.initTableValidate();
+    },
+    // 自定义校验规则
+    validateTableField(rule, value, callback) {
+      console.log("校验规则", rule, value);
+      let { message, field } = rule;
+      let index = field.split("-")[1],
+        fieldName = field.split("-")[0];
+      console.log(
+        index,
+        fieldName,
+        this.productionTableData[Number(index)][fieldName]
+      );
+      if (
+        !this.productionTableData[Number(index)][fieldName] &&
+        this.productionTableData[Number(index)][fieldName] !== 0 &&
+        this.productionTableData[Number(index)][fieldName] !== "0"
+      ) {
+        callback(new Error(message));
+      } else {
+        callback();
+      }
+    },
+    // 初始化校验规则
+    initTableValidate() {
+      let length = this.productionTableData.length;
+      for (let i = 0; i < length; i++) {
+        this.rules["productNo-" + i] = [
+          {
+            // required: true,
+            message: "请选择货品",
+            trigger: "change",
+            validator: this.validateTableField,
+          },
+        ];
+        this.rules["productNumber-" + i] = [
+          {
+            // required: true,
+            message: "请输入数量",
+            trigger: "blur",
+            validator: this.validateTableField,
+          },
+        ];
+        this.rules["productUnitPrice-" + i] = [
+          {
+            // required: true,
+            message: "请输入单价",
+            trigger: "blur",
+            validator: this.validateTableField,
+          },
+        ];
+        this.rules["sliceType-" + i] = [
+          {
+            // required: true,
+            message: "请选择切片类型",
+            trigger: "change",
+            validator: this.validateTableField,
+          },
+        ];
+        this.rules["colourNumber-" + i] = [
+          {
+            // required: true,
+            message: "请选择色号",
+            trigger: "change",
+            validator: this.validateTableField,
+          },
+        ];
+      }
+      console.log(this.rules);
+    },
+    // 客户名称改变回调
+    customChangeHandler(val) {
+      // if (!val) return;
+      let customData = this.customerOptions.find(
+        (item) => item.customNo == val
+      );
+      this.formData.customAddress = customData?.customAddress || "无";
+      this.formData.customCountryType = customData?.customCountryType || "无";
+      this.formData.contactPerson = customData?.contactPerson || "无";
+    },
+    //审计新增
+    async addHandler() {
+      this.isEdit = false;
+      // await this.getDropDownData();
+      this.resetFormData();
+
+      this.title = "新增加工订单";
+      this.open = true;
+      this.$nextTick(() => {
+        this.$refs["formDataRef"].clearValidate();
+      });
+    },
+    // 获取下拉框数据
+    async getDropDownData() {
+      try {
+        // let payLoad = [
+        //   {
+        //     basicMap: {
+        //       tableName: "production",
+        //     },
+        //   },
+        //   {
+        //     basicMap: {
+        //       tableName: "customer",
+        //     },
+        //   },
+        // ];
+        // let res = await queryDropDownBoxData(payLoad);
+
+        // 新的获取客户选项数据的接口
+        let res = await listCustomer({ isEnablePaging: false });
+        if (res.code == 200) {
+          // let { customer } = res.data.resultMap;
+          // this.allProductionOptions = production || [];
+          // this.productionOptions =
+          //   this.allProductionOptions.slice(0, 100) || [];
+          this.customerOptions = res.rows || [];
+        } else {
+          throw Error("获取下拉框数据失败");
+        }
+        let proRes = await getSaleOrderProductionListDistinct();
+        console.log("proRes", proRes);
+        if (proRes.code == 200) {
+          console.log(proRes.data);
+          // let { production, customer } = proRes.data.resultMap;
+          // this.allProductionOptions = proRes.data || [];
+          // this.productionOptions =
+          //   this.allProductionOptions.slice(0, 500) || [];
+          this.productionOptions = proRes.data;
+        } else {
+          throw Error("获取下拉框数据失败");
+        }
+        let allProRes = await getSaleOrderProductionList();
+        if (allProRes.code == 200) {
+          this.allProductionOptions = allProRes.data || [];
+        } else {
+          console.log(allProRes);
+        }
+      } catch (error) {
+        console.log(error);
+      }
+      // 色号数据
+      try {
+        let payLoad = [
+          {
+            basicMap: {
+              tableName: "materiel",
+            },
+            conditionMap: {
+              materiel_species: ["1"],
+            },
+          },
+        ];
+        // let res = await queryDropDownBoxData(payLoad);
+        let res = await queryMaterielList();
+        if (res.code == 200) {
+          console.log(res.data);
+          // let { materiel } = res.data;
+          this.colourNumberOptions = res.data || [];
+        } else {
+          throw Error("获取下拉框数据失败");
+        }
+      } catch (error) {
+        console.log(error);
+      }
+      // 切片型号
+      try {
+        let payLoad = [
+          {
+            basicMap: {
+              tableName: "materiel",
+            },
+            conditionMap: {
+              materiel_species: ["6"],
+            },
+          },
+        ];
+        let res = await queryDropDownBoxData(payLoad);
+        if (res.code == 200) {
+          console.log(res.data.resultMap);
+          let { materiel } = res.data.resultMap;
+          this.sliceTypeOptions = materiel || [];
+        } else {
+          throw Error("获取下拉框数据失败");
+        }
+      } catch (error) {
+        console.log(error);
+      }
+    },
+    //
+    // 获取row-key
+    getRowKey(row) {
+      return row[
+        camelCase(this.tableName + "_" + this.templateInfo.template?.primaryKey)
+      ];
+    },
+    /** 查询列表 */
+    getList(queryParams, orderType = 0) {
+      this.loading = true;
+      // 序列化当前查询参数列表
+      queryParams && (this.queryParams.queryMap = queryParams.queryMap);
+      // 获取当前表单结构信息
+      dragTableInfo({ queryMap: { tableKey: this.tableKey } })
+        .then((res) => {
+          // 得到当前模版信息 --- sql columns queryWhere
+          this.templateInfo = res.data.resultMap;
+          this.styleList = res.data.resultMap.style?.map((item) => {
+            item.styleField = camelCase(
+              item.styleField.replace(".", "_") || ""
+            );
+            return item;
+          });
+          // 获取操作列的按钮数据
+          this.excuteBtnArr = res.data.resultMap.button;
+          console.log(this.excuteBtnArr, "excuteBtnArr");
+          // if (this.excuteBtnArr.length) {
+          this.excuteBtnArr[0].children.push(
+            {
+              btnName: "编辑",
+              btnType: "myEdit",
+              btnIcon: "",
+              btnShowCondition:
+                '[{"fieldName":"sale_order.status","mark":"3","refValue":"2"},{"fieldName":"sale_order.status","mark":"3","refValue":"3"},{"fieldName":"sale_order.status","mark":"3","refValue":"4"},{"fieldName":"sale_order.status","mark":"3","refValue":"5"},{"fieldName":"sale_order.status","mark":"3","refValue":"6"},{"fieldName":"sale_order.status","mark":"3","refValue":"8"},{"fieldName":"sale_order.status","mark":"3","refValue":"9"},{"fieldName":"sale_order.status","mark":"3","refValue":"100"},{"fieldName":"sale_order.status","mark":"3","refValue":"101"}]',
+              btnHasPermi: "huaxian:xsglddgl:INSERT",
+              children: [],
+            },
+            {
+              btnName: "出库明细",
+              btnType: "OutDetail",
+              btnIcon: "",
+              // btnShowCondition: "[]",
+              btnShowCondition:
+                '[{"fieldName":"sale_order.status","mark":"3","refValue":"1"},{"fieldName":"sale_order.status","mark":"3","refValue":"7"},{"fieldName":"sale_order.status","mark":"3","refValue":"8"}]',
+              btnHasPermi: "huaxian:xsglddgl:INSERT",
+              children: [],
+            },
+            {
+              btnName: "打印出库单",
+              btnType: "printOutBound",
+              btnIcon: "",
+              // btnShowCondition: "[]",
+              btnShowCondition:
+                '[{"fieldName":"sale_order.status","mark":"3","refValue":"1"},{"fieldName":"sale_order.status","mark":"3","refValue":"2"},{"fieldName":"sale_order.status","mark":"3","refValue":"8"},{"fieldName":"sale_order.status","mark":"3","refValue":"7"}]',
+              btnHasPermi: "huaxian:xsglddgl:INSERT",
+              children: [],
+            },
+            {
+              btnName: "出库发货",
+              btnType: "deliver",
+              btnIcon: "",
+              // btnShowCondition: "[]",
+              btnShowCondition:
+                '[{"fieldName":"sale_order.status","mark":"3","refValue":"1"},{"fieldName":"sale_order.status","mark":"3","refValue":"2"},{"fieldName":"sale_order.status","mark":"3","refValue":"8"},{"fieldName":"sale_order.status","mark":"3","refValue":"7"}]',
+              // ,{"fieldName":"sale_order.status","mark":"3","refValue":"3"}  3待生产
+              btnHasPermi: "huaxian:xsglddgl:INSERT",
+              children: [],
+            },
+            {
+              btnName: "详情",
+              btnType: "myDetail",
+              btnIcon: "",
+              btnShowCondition: "",
+              btnHasPermi: "huaxian:xsglddgl:INSERT",
+              children: [],
+            },
+            {
+              btnName: "删除",
+              btnType: "myDelete",
+              btnIcon: "",
+              btnShowCondition:
+                '[{"fieldName":"sale_order.status","mark":"3","refValue":"2"},{"fieldName":"sale_order.status","mark":"3","refValue":"3"},{"fieldName":"sale_order.status","mark":"3","refValue":"4"},{"fieldName":"sale_order.status","mark":"3","refValue":"5"},{"fieldName":"sale_order.status","mark":"3","refValue":"6"},{"fieldName":"sale_order.status","mark":"3","refValue":"8"},{"fieldName":"sale_order.status","mark":"3","refValue":"9"}]',
+              children: [],
+              btnHasPermi: "huaxian:xsglddgl:INSERT",
+            },
+            {
+              btnName: "完成",
+              btnType: "myComplate",
+              btnIcon: "",
+              btnShowCondition:
+                '[{"fieldName":"sale_order.status","mark":"6","refValue":"9"}]',
+              children: [],
+              btnHasPermi: "huaxian:xsglddgl:INSERT",
+            }
+          );
+          // }
+
+          this.queryParams.orderByColumn =
+            res.data.resultMap.querySql.orderByColumn;
+          this.sortOrder = JSON.parse(res.data.resultMap.querySql.sortOrder);
+          // 根据拖拽时设置当前列表排列顺序
+          this.queryParams.isAsc = this.sortOrder ? "DESC" : "ASC";
+          this.tableName = this.templateInfo.template.dtTableName;
+          // 得到查询条件
+          this.queryFromWhere = res.data.resultMap.where;
+          //  得到当前列表信息
+          this.columns = this.columnsHandler(
+            JSON.parse(this.templateInfo.template.dtColumnName)
+          );
+          console.log(this.columns, "000");
+        })
+        .finally((fes) => {
+          if (this.templateInfo == {}) return;
+          // 调用查询需要携带当前table的唯一标识
+          this.queryParams.queryMap.sqlkey = this.templateInfo.template.sqlKey;
+          // 排序
+          // this.queryParams.orderByColumn = camelCase(
+          //   this.queryParams.orderByColumn || ""
+          // );
+          // 根据sql语句查询当前表数据
+          // let getListFun = orderType == 0 ? unionListTableData : getTableList1;
+          // if (orderType != 0) {
+          //   this.queryParams.conditionMap = {
+          //     columnName: "order_type",
+          //     columnValue: orderType,
+          //   };
+          // }
+          delete this.queryParams.orderByColumn;
+          this.queryParams.queryMap.queryParam =
+            this.queryParams.queryMap.queryCriteriaValue;
+          // this.queryParams.orderType = "";
+
+          this.queryParams.queryParam = this.queryParams.queryMap.queryCriteriaValue;
+          saleOrderList(this.queryParams).then(async (res) => {
+            this.tableList = [];
+            // res.rows.forEach((item) => {
+            //   this.tableList.push(item.resultMap);
+            // });
+            this.tableList = res.rows;
+
+            // 订单表字段添加表名
+            this.tableList.forEach((item) => {
+              let keys = Object.keys(item);
+              for (const key of keys) {
+                if (key == "customName") {
+                  item["customer_" + key] = item[key];
+                } else {
+                  item["sale_order_" + key] = item[key];
+                }
+              }
+            });
+            // 驼峰转换
+            let tempTableList = [];
+            tempTableList = this.tableList.map((item) => {
+              let kv = {};
+              for (let itemKey in item) {
+                kv[camelCase(itemKey)] = item[itemKey];
+              }
+              return kv;
+            });
+
+            // this.setDictStyleData().then(() => {
+            //   this.tableList = this.setFieldStyleData(this.tableList);
+            // });
+            this.tableList = await this.setFieldStyleData(tempTableList);
+            console.log(this.tableList);
+            this.total = res.total;
+            this.$nextTick(() => {
+              this.$refs.tableRef?.clearSelection();
+            });
+            this.loading = false;
+          });
+
+          // 查询统计信息
+          getStatisticList({
+            queryMap: {
+              tableKey: this.templateInfo.template.tableKey,
+              queryCriteriaValue: this.queryParams.queryMap.queryCriteriaValue,
+            },
+          }).then((res) => {
+            this.statisticList = res.data;
+          });
+        });
+    },
+    // 校验定金
+    validateEarnestMoney(rule, value, callback) {
+      console.log(value);
+      if (this.formData.salePayType == "1") {
+        if (value == "" || value == null || value == undefined) {
+          callback(new Error("请输入定金金额"));
+        } else {
+          callback();
+        }
+      } else {
+        callback();
+      }
+    },
+    // 校验订单号是否有效
+    async validateOrderNo(rule, value, callback) {
+      console.log(value);
+      // let saleNo = this.formData.orderNo;
+      // 检验订单号合法
+      let checkNoPayload = {
+        saleNo: value,
+      };
+      if (this.isEdit) {
+        checkNoPayload.id = this.formData.id;
+      }
+      let result = await checkOrderNo(checkNoPayload);
+      if (result.code == 200) {
+        if (result.data) {
+          callback();
+        } else {
+          callback(new Error("合同号已存在"));
+        }
+      } else {
+        callback(new Error("校验失败,请稍后再试"));
+      }
+    },
+    // 校验表格数据
+    validateTableData() {
+      if (this.productionTableData.length == 0) {
+        return {
+          res: false,
+          msg: "请添加货品明细",
+        };
+      }
+      let res = this.productionTableData.every((item) => {
+        return (
+          item.productNo &&
+          item.productNumber &&
+          item.productUnitPrice &&
+          item.productAmounts &&
+          item.sliceType &&
+          item.colourNumber
+        );
+      });
+      if (!res) {
+        return {
+          res: false,
+          msg: "请填写完整货品明细",
+        };
+      }
+      return {
+        res: true,
+        msg: "",
+      };
+    },
+    // 审计   提交编辑结果按钮回调
+    async editConfirm() {
+      // let tableValidate = this.validateTableData();
+      // if (!tableValidate.res) {
+      //   this.$message.warning(tableValidate.msg);
+      //   // return;
+      // }
+      this.$refs.formDataRef.validate(async (valid) => {
+        if (valid) {
+          let {
+            id,
+            //订单表数据
+            saleNo,
+            saleCustomNo,
+            saleDate,
+            saleOrderEstimatedTime,
+            saleLeadTime,
+            deliveryDate,
+            saleAmounts,
+            saleAmountInWords,
+            salePayType,
+            earnestMoney,
+            salesman,
+            saleLeader,
+            finance,
+            production,
+            saleApprover,
+
+            // 工艺表数据
+            craftGrid,
+            craftOil,
+            craftPackage,
+            craftColorFastness,
+            directionOfTwist,
+            craftOther,
+            craftMark,
+            shippingMethod,
+
+            // 产品表
+            lotNumber,
+          } = this.formData;
+
+          let saleCraftNo = this.isEdit ? this.formData.saleCraftNo : uuidv4();
+          // saleNo = this.isEdit ? this.formData.saleNo : uuidv4();
+          let saleProductsNo = this.productionTableData
+            .map((item) => item.saleProductNo)
+            .join(","); //销售单表sale_products_no字段存货品表的sale_product_no,逗号分割
+          let saleValue = {
+            status: 1, //新增销售单时  默认为1
+            saleNo,
+            lotNumber, //批号
+            saleProductsNo,
+            saleOrderTechnologyNo: 'processingOrder',
+            saleCustomNo,
+            saleDate: moment(new Date(saleDate)).format("YYYY-MM-DD"),
+            saleOrderEstimatedTime: moment(
+              new Date(saleOrderEstimatedTime)
+            ).format("YYYY-MM-DD"),
+            deliveryDate: moment(new Date(deliveryDate)).format("YYYY-MM-DD"),
+            saleLeadTime,
+            // saleAmounts, //合计金额  小写
+            saleAmountInWords,
+            salePayType,
+            earnestMoney,
+            salesman: this.nickName,
+            saleLeader,
+            finance,
+            production,
+            saleApprover,
+          };
+          let craftValue = {
+            saleOrderNo: saleNo,
+            saleCraftNo,
+            craftGrid,
+            craftOil,
+            craftPackage,
+            craftColorFastness,
+            directionOfTwist,
+            craftOther,
+            craftMark,
+            shippingMethod,
+          };
+
+          let saleData = {
+            //订单表新增数据
+            basicMap: {
+              tableName: "sale_order",
+            },
+            // addListMap: [saleValue],
+            conditionMap: {},
+            commMap: {},
+            btnParametersMap: {},
+          };
+          let craftData = {
+            //工艺表新增数据
+            basicMap: {
+              tableName: "sale_craft",
+            },
+            // addListMap: [craftValue],
+            conditionMap: {},
+            commMap: {},
+            btnParametersMap: {},
+          };
+          this.productionTableData.forEach((item) => {
+            item.saleOrderNo = saleNo;
+            item.lotNumber = lotNumber;
+            delete item.id;
+            delete item.productNotes;
+            delete item.updateBy;
+            delete item.updateById;
+            delete item.updateTime;
+            delete item.createBy;
+            delete item.createTime;
+            delete item.createById;
+            delete item.delFlag;
+            delete item.sliceTypeLabel;
+            delete item.colourNumberLabel;
+            delete item.productType; //删除类型
+            delete item.taskProcessKey;
+            delete item.processKey;
+            delete item.onBoardState;
+            delete item.taskNodeKey;
+            delete item.productionLineNo;
+            delete item.status;
+            delete item.specificationsList;
+            delete item.productSpecifications;
+            const matchedOption = this.colourNumberOptions.find(
+              (option) => option.materielCode === item.colourNumber
+            );
+            let taskName =
+              item.productName +
+              "-" +
+              matchedOption.materieColorNumber +
+              "-" +
+              matchedOption.materieEncoding;
+            item.taskName = taskName;
+          });
+          this.productionTableData.forEach((item) => {
+            delete item.productType; //删除产品类型
+          });
+          console.log(this.productionTableData);
+          // return;
+          let productData = {
+            //货品表新增数据
+            basicMap: {
+              tableName: "sale_products",
+            },
+            addListMap: [...this.productionTableData],
+            conditionMap: {},
+            commMap: {},
+            btnParametersMap: {},
+          };
+          if (this.isEdit) {
+            //修改
+            Object.keys(saleValue).map((k) => {
+              saleData.commMap[k] = saleValue[k];
+            });
+            Object.keys(craftValue).map((k) => {
+              craftData.commMap[k] = craftValue[k];
+            });
+            // saleData.conditionMap.saleNo = saleValue.saleNo;
+            saleData.conditionMap.id = this.formData.id;
+            craftData.conditionMap.saleCraftNo = craftValue.saleCraftNo;
+            // for(let i = 0;i<this.)
+            let deletPayload = {
+              //删除货品数据的接口
+              basicMap: {
+                tableName: "sale_products",
+              },
+              conditionMap: {
+                saleProductNo: this.productIds,
+              },
+            };
+            let delRes = { code: 200 };
+            if (this.productIds.length) {
+              delRes = await delTableData(deletPayload); //删除旧数据
+            }
+
+            let updateSaleRes = await batchEdit(saleData);
+            let updateCraftRes = await batchEdit(craftData);
+            let addProductRes = { code: 200 };
+            if (productData.addListMap.length) {
+              addProductRes = await addTableData(productData);
+            }
+            console.log(delRes, updateSaleRes, updateCraftRes, addProductRes);
+            if (
+              delRes?.code === 200 &&
+              updateSaleRes?.code === 200 &&
+              updateCraftRes?.code === 200 &&
+              addProductRes?.code === 200
+            ) {
+              this.$message.success("修改成功");
+              this.open = false;
+              this.getList();
+            } else {
+              this.$message.error("修改失败");
+            }
+          } else {
+            //新增
+            saleData.addListMap = [saleValue];
+            craftData.addListMap = [craftValue];
+            let saleRes = await addTableData(saleData);
+            let craftRes = await addTableData(craftData);
+            let productRes = { code: 200 };
+            if (productData.addListMap.length) {
+              productRes = await addTableData(productData);
+            }
+
+            if (
+              saleRes.code === 200 &&
+              craftRes.code === 200 &&
+              productRes.code === 200
+            ) {
+              this.$message.success("添加成功");
+              this.open = false;
+              this.getList();
+            } else {
+              this.$message.error("添加失败");
+            }
+          }
+          // Object.keys(saleValue).map((k) => {
+          //   saleData.commMap[k] = saleValue[k];
+          // });
+        } else {
+          this.$message.error("请完善表单数据");
+        }
+      });
+    },
+    // 审计   编辑回调
+    async handleEdit(index, row) {
+      console.log(row);
+      let { saleOrderSaleNo } = row;
+      try {
+        let payLoad = [
+          {
+            basicMap: {
+              tableName: "sale_order",
+            },
+            conditionMap: {
+              sale_no: [saleOrderSaleNo],
+            },
+          },
+          {
+            basicMap: {
+              tableName: "sale_products",
+            },
+            conditionMap: {
+              sale_order_no: [saleOrderSaleNo],
+            },
+          },
+          {
+            basicMap: {
+              tableName: "sale_craft",
+            },
+            conditionMap: {
+              sale_order_no: [saleOrderSaleNo],
+            },
+          },
+        ];
+        let res = await queryDropDownBoxData(payLoad);
+        if (res.code == 200) {
+          this.isEdit = true;
+          let { sale_craft, sale_order, sale_products } = res.data.resultMap;
+
+          Object.assign(this.formData, {
+            ...sale_craft[0],
+            ...sale_order[0],
+          });
+          let { saleDate, saleOrderEstimatedTime, deliveryDate } =
+            sale_order[0];
+          saleDate && (this.formData.saleDate = new Date(saleDate));
+          saleOrderEstimatedTime &&
+            (this.formData.saleOrderEstimatedTime = saleOrderEstimatedTime);
+          deliveryDate && (this.formData.deliveryDate = new Date(deliveryDate));
+
+          this.productIds = sale_products.map((item) => item.saleProductNo);
+
+          // await this.getDropDownData();
+          let promiseArr = [];
+          this.productionTableData = sale_products.map((item, index) => {
+            let targetItem = this.allProductionOptions.find(
+              (i) => item.productNo == i.productNo
+            );
+            item.productSpecifications = targetItem?.productSpecifications;
+            item.productType = targetItem?.productType;
+            promiseArr[index] = getProductSpecificationsByProductName({
+              productName: item.productName,
+            });
+            return item;
+          });
+
+          let promiseRes = await Promise.all(promiseArr);
+          promiseRes.forEach((item, index) => {
+            this.productionTableData[index].specificationsList = item.data;
+          });
+
+          if (this.formData.saleCustomNo) {
+            this.customChangeHandler(this.formData.saleCustomNo);
+          }
+          this.title = "编辑加工订单";
+          this.initTableValidate();
+          this.open = true;
+        }
+      } catch (error) {
+        console.log(error);
+      }
+    },
+    // 审计   批量删除回调
+    async batchDelete() {
+      if (!this.ids.length) return;
+      try {
+        await this.$confirm("是否确认删除选中的数据?", "警告", {
+          confirmButtonText: "确定",
+          cancelButtonText: "取消",
+          type: "warning",
+        });
+        let orderPayload = {
+          basicMap: {
+            tableName: "sale_order",
+          },
+          conditionMap: {
+            saleNo: this.ids,
+          },
+        };
+        let productsPayload = {
+          basicMap: {
+            tableName: "sale_products",
+          },
+          conditionMap: {
+            saleOrderNo: this.ids,
+          },
+        };
+        let craftPayload = {
+          basicMap: {
+            tableName: "sale_craft",
+          },
+          conditionMap: {
+            saleOrderNo: this.ids,
+          },
+        };
+        let orderRes = await delTableData(orderPayload);
+        // let productRes = await delTableData(productsPayload);
+        // let craftRes = await delTableData(craftPayload);
+        if (orderRes.code == 200) {
+          this.$message.success("删除成功");
+          this.getList();
+        } else {
+          this.$message.error("删除失败");
+          throw Error("删除失败");
+        }
+        this.ids = [];
+        this.$refs.tableRef.clearSelection();
+      } catch (error) {
+        console.log(error);
+      }
+    },
+    // 计算金额
+    computedPrice(row) {
+      let { productNumber, productUnitPrice } = row;
+      console.log(
+        "productNumber, productUnitPrice",
+        productNumber,
+        productUnitPrice
+      );
+      row.productAmounts = (
+        Number(productNumber) * Number(productUnitPrice)
+      ).toFixed(2);
+    },
+    isUpperCase(char) {
+      return char === char.toUpperCase();
+    },
+    // 下划线命名转驼峰命名
+    toUnderScoreCase(str) {
+      if (str === null) {
+        return null;
+      }
+      let sb = "";
+      // 前置字符是否大写
+      let preCharIsUpperCase = true;
+      // 当前字符是否大写
+      let curreCharIsUpperCase = true;
+      // 下一字符是否大写
+      let nexteCharIsUpperCase = true;
+      for (let i = 0; i < str.length; i++) {
+        let c = str.charAt(i);
+        if (i > 0) {
+          preCharIsUpperCase = isUpperCase(str.charAt(i - 1));
+        } else {
+          preCharIsUpperCase = false;
+        }
+
+        curreCharIsUpperCase = isUpperCase(c);
+
+        if (i < str.length - 1) {
+          nexteCharIsUpperCase = isUpperCase(str.charAt(i + 1));
+        }
+
+        if (
+          preCharIsUpperCase &&
+          curreCharIsUpperCase &&
+          !nexteCharIsUpperCase
+        ) {
+          sb += SEPARATOR;
+        } else if (i !== 0 && !preCharIsUpperCase && curreCharIsUpperCase) {
+          sb += SEPARATOR;
+        }
+        sb += c.toLowerCase();
+      }
+
+      return sb;
+    },
+    // 处理列表信息
+    columnsHandler(columns) {
+      let resArr = [];
+      console.log(columns, 111);
+      columns.forEach((item) => {
+        for (const key in item) {
+          let tempObj = {};
+          tempObj.key = camelCase(key);
+          tempObj.value = item[key];
+          resArr.push(tempObj);
+        }
+      });
+      console.log(resArr, 222);
+      return resArr;
+    },
+    // 取消按钮
+    cancel() {
+      this.open = false;
+      // this.reset();
+    },
+    // k-form-build 取消按钮
+    kCancel() {
+      this.kOpen = false;
+      // this.reset();
+    },
+    // 分页查询
+    pageList(row) {
+      // 调用子组件-》携带子组件参数请求后台
+      this.$refs.mychild.pageList(
+        row == undefined
+          ? {
+              limit: this.queryParams.pageSize,
+              page: this.queryParams.pageNum,
+            }
+          : row
+      );
+    },
+    // 多选框选中数据
+    handleSelectionChange(selection) {
+      // this.ids = selection.map(
+      //   (item) =>
+      //     item[
+      //       camelCase(
+      //         this.tableName + "_" + this.templateInfo.template?.primaryKey
+      //       )
+      //     ]
+      // );
+      this.selection = selection;
+      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;
+    },
+
+    // 更多操作触发
+    handleCommand(command, row) {
+      switch (command) {
+        case "handleResetPwd":
+          this.handleResetPwd(row);
+          break;
+        case "handleAuthRole":
+          this.handleAuthRole(row);
+          break;
+        default:
+          break;
+      }
+    },
+    /** 新增按钮操作 */
+    handleAdd(row) {
+      // this.reset();
+      this.defaultValue = {};
+      getInfoBySqlKey(this.templateInfo.template.sqlKey).then(({ data }) => {
+        if (!data || !data.dfVueTemplate) {
+          this.jsonData = false;
+          this.$message.error("当前表格未绑定表单!");
+          return;
+        }
+        if (data.dfFormSql) {
+          let dynamicData = JSON.parse(data.dfFormSql);
+          Object.assign(this.dynamicData, dynamicData);
+        }
+        this.jsonData = JSON.parse(data.dfVueTemplate);
+        this.open = true;
+        this.title = "添加信息";
+        this.form.password = this.initPassword;
+        this.$nextTick(() => {
+          this.$refs.addFromRef.reset();
+          inputDisableComplete();
+        });
+      });
+    },
+    longestCommonSubstring(strs) {
+      if (!strs || strs.includes("")) return "";
+      let str1_Length = strs[0].length;
+      let str_Nums = strs.length;
+      let flag = 0;
+      for (let i = 0; i < str1_Length && flag == 0; i++) {
+        let char = strs[0][i];
+        for (var j = 1; j < str_Nums; j++) {
+          if (char !== strs[j][i] || i == strs[j].length) {
+            return strs[1].substring(0, i);
+          }
+        }
+      }
+      return strs[0];
+    },
+    // 绑定dialog对话框关闭
+    handleClose() {
+      this.btnDialogVisible = false;
+    },
+    getLastUppercaseWord(text) {
+      const pattern = /\b[A-Z][a-z]*\b/g;
+      const matches = [...text.matchAll(pattern)];
+      if (matches.length > 0) {
+        const lastMatch = matches[matches.length - 1][0];
+        return lastMatch;
+      } else {
+        return null;
+      }
+    },
+    /** 修改按钮操作 */
+    async handleUpdate(row, btnData) {
+      let nameTable = this.templateInfo.template.dtTableName;
+      this.rowobj = {};
+      let obj = {};
+      for (let key in row) {
+        let modifiedTable = key
+          .replace(/[A-Z]/g, (match) => `_${match}`)
+          .toLowerCase();
+
+        this.rowobj[modifiedTable] = row[key];
+
+        let str = modifiedTable.substring(nameTable.length + 1);
+        obj[str] = row[key];
+      }
+      // getInfoBySqlKey(this.templateInfo.template.sqlKey).then(({ data }) => {
+      //   if (!data || !data.dfVueTemplate) {
+      //     this.$message.error("当前表格未绑定表单!");
+      //     return;
+      //   }});
+
+      // 新的修改请求
+      try {
+        let payLoad = {
+          basicMap: {
+            btnType: this.currentBtnData.btnType,
+            btnKey: this.currentBtnData.btnKey,
+            visible: "false",
+            sqlKey: this.templateInfo.template.sqlKey,
+            tableName: this.tableName,
+          },
+          conditionMap: {},
+        };
+        let primary = camelCase(
+          this.tableName + "_" + this.templateInfo.template?.primaryKey
+        );
+        payLoad.conditionMap[this.templateInfo.template?.primaryKey] =
+          row[primary];
+        let res = await btnCommonApi(payLoad);
+        // 判断是否绑定dialog弹窗
+        if (!this.currentBtnData.btnTableFormGroupKey) {
+          if (!res.data || !res.data.template) {
+            this.$message.error("当前按钮未绑定表单!");
+            return;
+          }
+
+          res.data.template.dfFormSql &&
+            (this.dynamicData = JSON.parse(res.data.template.dfFormSql));
+          this.addRealFieldName(res.data.result.resultMap);
+          let resultMap = res.data.result.resultMap;
+
+          Object.assign(this.defaultValue, resultMap);
+          this.jsonData = JSON.parse(res.data.template.dfVueTemplate);
+          this.kOpen = true;
+          this.title = "修改信息";
+          this.form.password = this.initPassword;
+          this.$nextTick(() => {
+            this.$refs.addFromRef.setData(res.data.result.resultMap);
+          });
+        } else {
+          this.subTableName = res.data.result.dragTables[1].dtTableName;
+          this.btnDialogVisible = true;
+          this.groupKey = this.currentBtnData.btnTableFormGroupKey;
+          this.$nextTick(() => {
+            let refChild = this.$refs.dialogRef;
+            refChild.getLists(this.groupKey);
+          });
+
+          let tablesubKey = res.data.result.dragTables[1].tableKey;
+
+          // 查询统计信息
+          getStatisticList({
+            queryMap: {
+              tableKey: tablesubKey,
+            },
+          }).then((res) => {
+            this.subCount = res.data;
+          });
+
+          let prmKey = this.templateInfo.template.primaryKey;
+          let pkey = prmKey.replace(/_([a-z])/g, (match, p1) =>
+            p1.toUpperCase()
+          );
+
+          let data = {
+            queryMap: {
+              tableKey: res.data.result.dragTables[2].tableKey,
+            },
+          };
+
+          let key =
+            "#{" +
+            this.templateInfo.template.dtTableName +
+            "." +
+            this.templateInfo.template.primaryKey;
+
+          data.queryMap[key] =
+            "'" + obj[this.templateInfo.template.primaryKey] + "'";
+
+          getStatisticList(data).then((res) => {
+            this.tableCount = res.data;
+          });
+        }
+
+        // let fieldList = Object.keys(resultMap);
+        // let tableName = this.longestCommonSubstring(fieldList);
+        // fieldList.forEach((field) => {
+        //   let realField = field.replace(tableName, "");
+        //   realField = realField[0].toLocaleLowerCase() + realField.substring(1);
+        //   resultMap[realField] = resultMap[field];
+        // });
+      } catch (error) {
+        this.$message.error("网络异常,请稍后再试");
+        console.log(error);
+      }
+      return;
+      // getInfoBySqlKey(this.templateInfo.template.sqlKey).then(({ data }) => {
+      //   if (!data || !data.dfVueTemplate) {
+      //     this.$message.error("当前表格未绑定表单!");
+      //     return;
+      //   }
+      //   // let fieldList = Object.keys(row);
+      //   // let tableName = this.longestCommonSubstring(fieldList);
+      //   // fieldList.forEach((field) => {
+      //   //   let realField = field.replace(tableName, "");
+      //   //   realField = realField[0].toLocaleLowerCase() + realField.substring(1);
+      //   //   row[realField] = row[field];
+      //   // });
+      //   this.addRealFieldName(row);
+      //   Object.assign(this.defaultValue, row);
+      //   this.jsonData = JSON.parse(data.dfVueTemplate);
+      //   this.open = true;
+      //   this.title = "修改信息";
+      //   this.form.password = this.initPassword;
+      //   this.$nextTick(() => {
+      //     this.$refs.addFromRef.setData(row);
+      //   });
+      // });
+      // return;
+      this.reset();
+      const userId = row.userId || this.ids;
+      getUser(userId).then((response) => {
+        this.form = response.data;
+        this.postOptions = response.posts;
+        this.roleOptions = response.roles;
+        this.$set(this.form, "postIds", response.postIds);
+        this.$set(this.form, "roleIds", response.roleIds);
+        this.open = true;
+        this.title = "修改当前信息";
+        this.form.password = "";
+      });
+    },
+    // 添加真正的字段名
+    addRealFieldName(row) {
+      let fieldList = Object.keys(row);
+      // let tableName = this.longestCommonSubstring(fieldList);
+      let tableName = camelCase(this.tableName);
+      fieldList.forEach((field) => {
+        let realField = field.replace(tableName, "");
+        realField = realField[0].toLocaleLowerCase() + realField.substring(1);
+        row[realField] = row[field];
+      });
+    },
+
+    /** 提交按钮 */
+    submitForm: function () {
+      this.$refs["form"].validate((valid) => {
+        if (valid) {
+          if (this.form.userId != undefined) {
+            updateUser(this.form).then((response) => {
+              this.$modal.msgSuccess("修改成功");
+              this.open = false;
+              this.getList();
+            });
+          } else {
+            addUser(this.form).then((response) => {
+              this.$modal.msgSuccess("新增成功");
+              this.open = false;
+              this.getList();
+            });
+          }
+        }
+      });
+    },
+    /** 删除按钮操作
+     *
+     * 删除提示信息语句(标识)
+     * */
+    handleDelete(row, btnData) {
+      let delIds = this.ids;
+      let primary = camelCase(this.templateInfo.template?.primaryKey);
+      // let realyKey=
+      this.addRealFieldName(row);
+      if (row[primary] != undefined && row[primary] != null) {
+        delIds = [];
+        delIds.push(row[primary]);
+      }
+      let data = {
+        basicMap: {
+          btnType: btnData.btnType,
+          btnKey: btnData.btnKey,
+          tableName: this.tableName,
+        },
+        conditionMap: {
+          // id: delIds,
+        },
+        btnParametersMap: {},
+      };
+      if (this.currentBtnData.btnParams) {
+        let btnParams =
+          JSON.parse(this.currentBtnData.btnParams)?.commonFieldData || [];
+        let conditionData =
+          JSON.parse(this.currentBtnData.btnParams).conditionData || [];
+        conditionData.forEach((item) => {
+          data.conditionMap[item.fieldName.split(".")[1]] = item.fieldValue
+            ? item.fieldValue
+            : this.currentRow[camelCase(item.fieldName.replace(".", "_"))];
+        });
+        btnParams.forEach((item) => {
+          data.btnParametersMap[item.fieldName.split(".")[1]] = item.fieldValue
+            ? item.fieldValue
+            : this.currentRow[camelCase(item.fieldName.replace(".", "_"))];
+        });
+      }
+      // data.conditionMap[this.templateInfo.template?.primaryKey] = delIds;
+      this.$modal
+        .confirm('是否确认删除"' + delIds + '"的数据项?')
+        .then(function () {
+          // return delTableData(data);
+          return btnCommonApi(data);
+        })
+        .then(() => {
+          // 调用子组件查询方法 目的是携带上子组件中的查询参数
+          this.$refs.mychild.pageList();
+          this.$modal.msgSuccess("删除成功");
+        })
+        .catch(() => {});
+    },
+    // 批量删除接口
+    handleBatchDelete() {
+      let delIds = this.ids;
+      let primary = camelCase(this.templateInfo.template?.primaryKey);
+      // if (row && row[primary] != undefined && row[primary] != null) {
+      //   delIds = [];
+      //   delIds.push(row[primary]);
+      // }
+      let data = {
+        basicMap: {
+          tableName: this.tableName,
+        },
+        conditionMap: {
+          // id: delIds,
+        },
+      };
+      // if (this.currentBtnData.btnParams) {
+      //   let btnParams = JSON.parse(this.currentBtnData.btnParams);
+      //   btnParams.forEach((item) => {
+      //     data.btnParametersMap[
+      //       this.formatField(item.fieldName, camelCase(this.tableName))
+      //     ] = item.fieldValue
+      //       ? item.fieldValue
+      //       : this.currentRow[item.fieldName];
+      //   });
+      // }
+      data.conditionMap[this.templateInfo.template?.primaryKey] = delIds;
+      this.$modal
+        .confirm('是否确认删除"' + delIds + '"的数据项?')
+        .then(function () {
+          return delTableData(data);
+          // return btnCommonApi(data);
+        })
+        .then(() => {
+          // 调用子组件查询方法 目的是携带上子组件中的查询参数
+          this.$refs.mychild.pageList();
+          this.$modal.msgSuccess("删除成功");
+        })
+        .catch(() => {});
+    },
+    /** 导出按钮操作 */
+    handleExport() {
+      let primary = "saleOrderId";
+      let realyKey = "saleOrderId";
+      if (this.myDelIds.length > 0) {
+        this.queryParams["execlMap"] = [];
+        this.myDelIds.forEach((item) => {
+          this.queryParams.execlMap.push(
+            this.tableList.find((ttem) => {
+              return ttem[realyKey] === item;
+            })
+          );
+        });
+      } else {
+        this.$message.warning("请至少勾选一条导出数据");
+        return;
+      }
+      this.queryParams.execlMap = JSON.stringify(this.queryParams.execlMap);
+      this.download(
+        process.env.VUE_APP_BASE_API1 + "common/export",
+        {
+          ...this.queryParams,
+        },
+        `文件名称_${new Date().getTime()}.xlsx`
+      );
+    },
+    /** 导入按钮操作 */
+    handleImport() {
+      this.upload.title = "当前导入";
+      this.upload.open = true;
+    },
+    /** 下载模板操作 */
+    importTemplate() {
+      this.download(
+        process.env.VUE_APP_BASE_API1 +
+          `common/exportTemplate?tableName=${this.tableName}&sqlkey=${this.templateInfo.template.sqlKey}`,
+        {},
+        `下载模版名称${new Date().getTime()}.xlsx`
+      );
+    },
+    // 文件上传中处理
+    handleFileUploadProgress(event, file, fileList) {
+      this.upload.isUploading = true;
+    },
+    // 文件上传成功处理
+    handleFileSuccess(response, file, fileList) {
+      this.upload.open = false;
+      this.upload.isUploading = false;
+      this.$refs.upload.clearFiles();
+      this.$alert(
+        "<div style='overflow: auto;overflow-x: hidden;max-height: 70vh;padding: 10px 20px 0;'>" +
+          response.msg +
+          "</div>",
+        "导入结果",
+        { dangerouslyUseHTMLString: true }
+      );
+      this.$refs.mychild.pageList({
+        limit: this.queryParams.pageSize,
+        page: this.queryParams.pageNum,
+      });
+    },
+    //重点在这里
+    handleChange(file, fileList) {
+      file.name = this.tableName + "." + file.name.split(".")[1];
+      fileList.forEach((item) => {
+        item.name = this.tableName + "." + file.name.split(".")[1];
+      });
+      let newFile = new File(
+        [file],
+        this.tableName + "." + file.name.split(".")[1]
+      ); //创建出来也是不可编辑的file对象
+    },
+    // 提交上传文件
+    submitFileForm() {
+      this.$refs.upload.submit();
+    },
+    // 弹窗新增的数
+    addListHandler(val) {
+      this.addLists.push(...val);
+    },
+    // 绑定弹窗Dialog确定按钮
+    async btnComfirm() {
+      let res = await this.$refs.deliverRef.getAllData();
+      let { flag, isEdit, data } = res;
+      if (flag) {
+        if (isEdit) {
+          //编辑
+          let payLoad = {
+            ...data.formData,
+            saleProductInfoList: data.tableData,
+          };
+          let res = await updateProductInvoice(payLoad);
+          if (res.code == 200) {
+            this.$message.success("修改成功");
+            this.deliverShow = false;
+            this.getList();
+          } else {
+            this.$message.error("网络异常");
+          }
+        } else {
+          //新增
+          let payLoad = {
+            ...data.formData,
+            saleProductInfoList: data.tableData,
+          };
+          let res = await addProductInvoice(payLoad);
+          if (res.code == 200) {
+            this.$message.success("保存成功");
+            this.deliverShow = false;
+            this.getList();
+          } else {
+            this.$message.error("网络异常");
+          }
+        }
+      }
+    },
+    // 去掉表名 开头字母小写
+    formatField(field = "", tableName) {
+      let temp = field.replace(tableName, "");
+      return toUnderline(temp[0].toLowerCase() + temp.slice(1));
+    },
+    //提交编辑结果按钮回调
+    async editConfirmHandler() {
+      if (this.$refs.addFromRef) {
+        this.$refs.addFromRef
+          .getData()
+          .then(async (values) => {
+            let data = {
+              basicMap: {
+                tableName: this.tableName,
+                // btnKey: btnData.btnKey,
+                btnKey: this.currentBtnData.btnKey,
+              },
+              addListMap: [values],
+              conditionMap: {},
+              commMap: {},
+              btnParametersMap: {},
+            };
+            if (this.currentBtnData.btnParams) {
+              let btnParams =
+                JSON.parse(this.currentBtnData.btnParams)?.commonFieldData ||
+                [];
+              let conditionData =
+                JSON.parse(this.currentBtnData.btnParams).conditionData || [];
+              // let
+              btnParams.forEach((item) => {
+                data.btnParametersMap[item.fieldName.split(".")[1]] =
+                  item.fieldValue
+                    ? item.fieldValue
+                    : this.currentRow[
+                        camelCase(item.fieldName.replace(".", "_"))
+                      ];
+              });
+              conditionData.forEach((item) => {
+                data.conditionMap[item.fieldName.split(".")[1]] =
+                  item.fieldValue
+                    ? item.fieldValue
+                    : this.currentRow[
+                        camelCase(item.fieldName.replace(".", "_"))
+                      ];
+              });
+            }
+            if (Object.keys(this.defaultValue).length) {
+              // data.conditionMap[this.templateInfo.template?.primaryKey] =
+              //   this.defaultValue[this.templateInfo.template?.primaryKey];
+              Object.keys(values).map((k) => {
+                data.commMap[k] = values[k];
+              });
+              data.basicMap.btnType = this.currentBtnData.btnType;
+              data.basicMap.visible = true;
+            } else {
+              data.basicMap.btnType = "INSERT";
+              data.basicMap.visible = true;
+            }
+            try {
+              let res = await btnCommonApi(data);
+              if (res.code == 200) {
+                this.$message.success("操作成功");
+              } else {
+                this.$message.error("网络异常,请稍后再试");
+              }
+            } catch (error) {
+              console.log(error);
+              this.$message.error("网络异常,请稍后再试");
+            }
+            this.getList();
+            this.defaultValue = {};
+            this.kOpen = false;
+          })
+          .catch((res) => {
+            console.log(res);
+            this.$modal.msgError("表单校验失败,请规范填写数据");
+          });
+      } else {
+        // 没有绑定表单
+        let data = {
+          basicMap: {
+            tableName: this.tableName,
+            // btnKey: btnData.btnKey,
+            btnKey: this.currentBtnData.btnKey,
+            btnType: this.currentBtnData.btnType,
+            visible: true,
+          },
+          addListMap: [],
+          conditionMap: {},
+          commMap: {},
+          btnParametersMap: {},
+        };
+        if (this.currentBtnData.btnParams) {
+          let btnParams =
+            JSON.parse(this.currentBtnData.btnParams)?.commonFieldData || [];
+          let conditionData =
+            JSON.parse(this.currentBtnData.btnParams).conditionData || [];
+          conditionData.forEach((item) => {
+            data.conditionMap[item.fieldName.split(".")[1]] = item.fieldValue
+              ? item.fieldValue
+              : this.currentRow[camelCase(item.fieldName.replace(".", "_"))];
+          });
+          btnParams.forEach((item) => {
+            data.btnParametersMap[item.fieldName.split(".")[1]] =
+              item.fieldValue
+                ? item.fieldValue
+                : this.currentRow[camelCase(item.fieldName.replace(".", "_"))];
+          });
+        }
+        // data.basicMap.btnType = this.currentBtnData.btnType;
+        // data.basicMap.visible = true;
+        try {
+          let res = await btnCommonApi(data);
+          if (res.code == 200) {
+            this.$message.success("操作成功");
+          } else {
+            this.$message.error("网络异常,请稍后再试");
+          }
+        } catch (error) {
+          console.log(error);
+          this.$message.error("网络异常,请稍后再试");
+        }
+        this.getList();
+        this.defaultValue = {};
+        this.kOpen = false;
+      }
+    },
+    // 使用提交数据类型的按钮获取数据
+    tempSubBtn(getData) {
+      getData()
+        .then((values) => {
+          console.log("验证通过", values);
+        })
+        .catch(() => {
+          console.log("验证未通过,获取失败");
+        });
+    },
+    // 判断是否生效行样式
+    cellStyle({ row, column, rowIndex, columnIndex }) {
+      let rowStyleList = this.styleList.filter((item) => item.styleType == 0);
+      if (!rowStyleList.length) return "";
+      let mainTableName = this.templateInfo.querySql.tableAlias; //主表名
+      for (let i = 0; i < rowStyleList.length; i++) {
+        let item = rowStyleList[i];
+        let judgeRes = this.determineCondition(item.styleCondtion, row);
+        if (judgeRes) {
+          let styleCode = JSON.parse(item.styleCode);
+          return `background-color:${styleCode.rowBgColor};`;
+        }
+      }
+    },
+
+    // 获取生效条件组结果
+    determineCondition(conditionStr, row) {
+      let conditionList = JSON.parse(conditionStr);
+      if (!conditionList.length) return false;
+      return conditionList.every((item) => this.judgeOneCondition(item, row));
+    },
+
+    // 获取单个判断条件结果
+    judgeOneCondition(item, row) {
+      let fullField = camelCase(item.tableName + "_" + item.fieldName);
+      switch (item.condition) {
+        case 1:
+          return row[fullField] > item.flagValue;
+        case 2:
+          return row[fullField] < item.flagValue;
+        case 3:
+          return row[fullField] == item.flagValue;
+        case 4:
+          return row[fullField] >= item.flagValue;
+        case 5:
+          return row[fullField] <= item.flagValue;
+        default:
+          return true; //默认为true
+      }
+    },
+
+    // 设置表格字段样式
+    async setFieldStyleData(tableList) {
+      console.log(JSON.parse(JSON.stringify(tableList)));
+      let fieldConditionList = this.styleList.filter(
+        (item) => item.styleType == 1 || item.styleType == 2
+      );
+      if (!fieldConditionList.length) return tableList;
+      let res = await this.setDictStyleData();
+
+      this.dictStyleObj = res.reduce((pre, item) => {
+        return {
+          ...pre,
+          ...item,
+        };
+      }, {});
+      // console.log("this.dictStyleObj", this.dictStyleObj);
+      tableList.forEach((row) => {
+        // if (!row.styleFieldObj) row.styleFieldObj = {};
+        for (let i = 0; i < fieldConditionList.length; i++) {
+          let item = fieldConditionList[i];
+          if (item.styleType == 1) {
+            //字段样式
+            let judgeRes = this.determineCondition(item.styleCondtion, row);
+            if (judgeRes) {
+              let styleCode = JSON.parse(item.styleCode);
+              if (!row.styleFieldObj) row.styleFieldObj = {};
+              row.styleFieldObj[item.styleField] = {
+                styleType: item.styleType,
+                fieldStyleType: styleCode.fieldStyleType,
+                fontColor: styleCode.fontColor,
+                isTagFullBg: styleCode.isTagFullBg,
+                tagType: styleCode.tagType,
+              };
+              // row.styleField = item.styleField; //样式生效字段
+              // row.styleType = item.styleType; //0:行样式 1:字段样式 2:字典样式
+              // row.fieldStyleType = styleCode.fieldStyleType; //0:文本  1:标签
+              // row.fontColor = styleCode.fontColor;
+              // row.isTagFullBg = styleCode.isTagFullBg; //true/false
+              // row.tagType = styleCode.tagType; //string
+            }
+          } else {
+            //字典样式
+            let dicStyle = this.dictStyleObj[item.styleField]?.find((dict) => {
+              return dict.dictValue == row[item.styleField];
+            });
+            if (dicStyle) {
+              if (!row.styleFieldObj) row.styleFieldObj = {};
+              row.styleFieldObj[item.styleField] = dicStyle; //设置该字段应该显示的字典样式
+              row.styleFieldObj[item.styleField].styleType = 2;
+            }
+          }
+        }
+      });
+      return tableList;
+    },
+
+    //设置表格字典相关数据
+    setDictStyleData() {
+      let fieldConditionList = this.styleList.filter(
+        (item) => item.styleType == 2
+      );
+      if (!fieldConditionList.length) return;
+      let PromiseList = fieldConditionList.map((item) => {
+        return new Promise((resolve, reject) => {
+          let temp = {};
+          try {
+            listData({
+              isEnablePaging: false,
+              dictType: item.styleCondtion,
+            }).then((res) => {
+              temp[item.styleField] = res.rows;
+              resolve(temp);
+            });
+          } catch (error) {
+            reject(error);
+          }
+        });
+      });
+      return Promise.all(PromiseList);
+    },
+
+    // 内链页面跳转
+    routerHandler(btnData, type) {
+      let { url, commonFieldData } = JSON.parse(btnData.btnParams);
+      let tempArr = [];
+      if (commonFieldData) {
+        let queryArr = JSON.parse(commonFieldData);
+
+        tempArr = queryArr.map((item) => {
+          let key = this.formatField(item.fieldName, camelCase(this.tableName));
+          let value = item.fieldValue
+            ? item.fieldValue
+            : this.currentRow[item.fieldName];
+          return key + "=" + value;
+        });
+      }
+      if (tempArr.length) {
+        url += "?" + tempArr.join("&");
+      }
+      // let link = btnData.btnParams;
+      if (type == "INNERLINK") {
+        this.$router.push(url);
+      } else {
+        window.open("http://" + url, "_blank");
+      }
+    },
+    async handleDetail(row) {
+      this.printDomData = await this.getDetailTableString(row);
+      this.detailShow = true;
+      this.$nextTick(() => {
+        this.$refs.detailTable.innerHTML = this.printDomData;
+      });
+    },
+    // 切片类型改变回调
+    sliceTypeChangeHandler(row) {
+      let { sliceType } = row;
+      if (sliceType) {
+        row.sliceTypeLabel = this.sliceTypeOptions.find(
+          (item) => item.materielCode == sliceType
+        )?.materielName;
+      }
+    },
+    // 色号改变回调
+    colourNumberChangeHandler(row) {
+      let { colourNumber } = row;
+      if (colourNumber) {
+        let target = this.colourNumberOptions.find(
+          (item) => item.materielCode == colourNumber
+        );
+        if (target) {
+          row.colourNumberLabel =
+            target.materieEncoding + target.materieColorNumber;
+        }
+        // row.colourNumberLabel = this.colourNumberOptions.find(
+        //   (item) => item.materielCode == colourNumber
+        // )?.materieColorNumber;
+      }
+    },
+    // 打印回调
+    detailPrintHandler() {
+      document.body.innerHTML = document.getElementById("printDom").innerHTML =
+        this.printDomData;
+      window.print(); //打印
+      window.location.reload();
+      return false;
+    },
+    // 根据字典value获取字典label
+    getDictLabel(value, dict) {
+      return (
+        this.dict.type[dict].find((item) => {
+          return item.value === value;
+        })?.label || ""
+      );
+    },
+    // 获取详情html字符串
+    async getDetailTableString(row) {
+      let { saleOrderSaleNo } = row;
+      let payLoad = [
+        {
+          basicMap: {
+            tableName: "sale_order",
+          },
+          conditionMap: {
+            sale_no: [saleOrderSaleNo],
+          },
+        },
+        {
+          basicMap: {
+            tableName: "sale_products",
+          },
+          conditionMap: {
+            sale_order_no: [saleOrderSaleNo],
+          },
+        },
+        {
+          basicMap: {
+            tableName: "sale_craft",
+          },
+          conditionMap: {
+            sale_order_no: [saleOrderSaleNo],
+          },
+        },
+      ];
+      let res = await queryDropDownBoxData(payLoad);
+      if (res.code == 200) {
+        console.log(res);
+        let { sale_craft, sale_order, sale_products } = res.data.resultMap;
+        let {
+          //订单表数据
+          saleNo, //合同号
+          lotNumber, //批号
+          saleCustomNo, //客户编号
+          saleDate, //销售单日期
+          saleOrderEstimatedTime, //预计下单时间
+          saleLeadTime, //交货周期
+          deliveryDate,
+          saleAmounts, //合计金额 小写
+          saleAmountInWords, //合计金额 大写
+          salePayType, //支付方式
+          earnestMoney,
+          salesman, //业务员
+          saleLeader, //业务主管
+          finance, //财务部
+          production, //生产部
+          saleApprover, //批准人
+          // customAddress, //客户地址
+          // customCountryType, //国家类型
+          // contactPerson, //联系人
+          // 货品明细表数据
+          // productNo, //货品号
+          // productName, //货品名称
+          // productNumber: "", //销售数量
+          // productWeight: "", //销售重量kg
+          // productUnitPrice: "", //单价
+          // productAmounts: "", //金额
+          // remark: "", //备注
+          // 工艺表
+          craftGrid, //网络
+          craftOil, //油剂
+          craftPackage, //卷装
+          craftColorFastness, //色牢度
+          directionOfTwist,
+          craftOther, //其它工艺要求
+          craftMark, //包装/贴唛
+          shippingMethod, //运输方式
+        } = { ...sale_craft[0], ...sale_order[0] };
+        let customData = this.customerOptions.find(
+          (item) => item.customNo == saleCustomNo
+        );
+        let payType = this.getDictLabel(salePayType, "payment_method"); //付款方式
+        let customerName = customData ? customData.customName : "";
+        let customAddress = customData?.customAddress || "无";
+        let customCountryType = customData?.customCountryType || "";
+        let contactPerson = customData?.contactPerson || "无";
+        let directionOfTwistDescription = directionOfTwist
+          ? this.getDictLabel(directionOfTwist, "direction_of_twist")
+          : "";
+        let printStr = `
+        <table style="width:1200px; border-collapse:collapse;" border="1" cellpadding="10" align="center">
+            <div style="text-align:center;font-size: 20px;">诸暨市新丝维纤维有限公司</div>
+            <div style="text-align:center;">销售合同审计单</div>
+            <tbody>
+                <tr>
+                    <td width="600px" colspan="4">合同号:${saleNo}</td>
+                    <td width="600px" colspan="5">日期:${saleDate.replace(
+                      "T",
+                      " "
+                    )}</td>
+                </tr>
+                <tr align="center">
+                    <td width="300px" colspan="2">客户名称:</td>
+                    <td width="300px" colspan="2">${customerName}</td>
+                    <td width="300px" colspan="2">联系人:</td>
+                    <td width="150px" colspan="3">${contactPerson}</td>
+                </tr>
+                <tr align="center">
+                    <td width="300px" colspan="2">客户地址:</td>
+                    <td width="300px" colspan="3">${customAddress}</td>
+                    <td width="300px" colspan="2">客户国别:</td>
+                    <td width="300px" colspan="2">${customCountryType}</td>
+                </tr>
+                <tr align="center">
+                    <td width="300px" colspan="2">预计下单时间:</td>
+                    <td  colspan="1">${saleOrderEstimatedTime.replace(
+                      "T",
+                      " "
+                    )}</td>
+                    <td  colspan="2">交货周期:</td>
+                    <td >${saleLeadTime}</td>
+                    <td  colspan="2">交货日期:</td>
+                    <td >${deliveryDate.replace("T", " ")}</td>
+                </tr>
+                <tr align="center">
+                    <td colspan="9">货品明细</td>
+                </tr>
+                <tr align="center">
+                    <td width="150px">品名</td>
+                    <td width="100px">规格</td>
+                    <td width="100px">类型</td>
+                    <td width="100px">色号</td>
+                    <td width="150px">数量/kg</td>
+                    <td width="150px">单价</td>
+                    <td width="150px">金额</td>
+                    <td width="150px">切片型号</td>
+                    <td width="150px">备注</td>
+                </tr>`;
+        let amountTotal = 0,
+          singlTotal = 0,
+          moneyTotal = 0;
+        for (let i = 0; i < sale_products.length; i++) {
+          let item = sale_products[i];
+          amountTotal += Number(item.productNumber);
+          singlTotal += Number(item.productUnitPrice);
+          moneyTotal += Number(item.productAmounts);
+          let productData = this.allProductionOptions.find(
+            (pro) => pro.productNo == item.productNo
+          );
+          console.log(item.productNo, productData, this.allProductionOptions);
+          item.sliceTypeLabel =
+            this.sliceTypeOptions.find((k) => k.materielCode == item.sliceType)
+              ?.materielName || "";
+          item.colourNumberLabel = this.colourNumberOptions.find(
+            (k) => k.materielCode == item.colourNumber
+          )?.materieColorNumber;
+          // item.materieEncoding + item.materieColorNumber
+          let materieEncoding = this.colourNumberOptions.find(
+            (k) => k.materielCode == item.colourNumber
+          )?.materieEncoding;
+          let productName = productData ? productData.productName : "";
+          let productType = productData ? productData.productType : "";
+          let productSpecifications = productData
+            ? productData.productSpecifications
+            : ""; //规格
+          printStr += `<tr align="center">
+                    <td>${productName}</td>
+                    <td>${productSpecifications}</td>
+                    <td>${productType}</td>
+                    <td>${materieEncoding + item.colourNumberLabel}</td>
+                    <td>${item.productNumber}</td>
+                    <td>${item.productUnitPrice}</td>
+                    <td>${item.productAmounts}</td>
+                    <td>${item.sliceTypeLabel}</td>
+                    <td>${item.remark}</td>
+                </tr>`;
+        }
+        // 计算小计
+        printStr += `
+        <tr align="center">
+          <td>小计:</td>
+           <td></td>
+           <td></td>
+          <td></td>
+          <td>${amountTotal.toFixed(2)}</td>
+          <td>${singlTotal.toFixed(2)}</td>
+          <td>${moneyTotal.toFixed(2)}</td>
+          <td></td>
+          <td></td>
+        </tr>
+                <tr>
+                    <td colspan="9">合计金额(大写):${saleAmountInWords}</td>
+                </tr>
+                `;
+
+        if (salePayType == "1") {
+          //定金
+          printStr += `
+          <tr>
+            <td colspan="4">付款方式:${payType}</td>
+            <td colspan="5">定金:${earnestMoney}</td>
+          </tr>`;
+        } else {
+          printStr += `
+         <tr>
+              <td colspan="9">付款方式:${payType}</td>
+          </tr>`;
+        }
+        printStr += `<tr align="center">
+                    <td colspan="9">工艺要求</td>
+                </tr>
+                <tr align="center">
+                    <td width="150px">网络</td>
+                    <td width="150px">油剂</td>
+                    <td width="150px">卷装</td>
+                    <td width="150px">色牢度</td>
+                    <td width="150px">捻向</td>
+                    <td width="150px">其他</td>
+                    <td width="150px"></td>
+                    <td width="150px"></td>
+                    <td width="150px"></td>
+                </tr>
+                <tr align="center">
+                    <td >${craftGrid}</td>
+                    <td>${craftOil}</td>
+                    <td>${craftPackage}</td>
+                    <td>${craftColorFastness}</td>
+                    <td>${directionOfTwistDescription}</td>
+                    <td>${craftOther}</td>
+                    <td width="150px"></td>
+                    <td width="150px"></td>
+                    <td width="150px"></td>
+                </tr>
+                <tr>
+                    <td colspan="9">包装/贴唛:${craftMark}</td>
+                </tr>
+                <tr>
+                    <td colspan="9">装运方式:${shippingMethod}</td>
+                </tr>
+                <tr align="center">
+                    <td colspan="2">业务员:</td>
+                    <td colspan="2">${salesman}</td>
+                    <td colspan="2">财务部:</td>
+                    <td colspan="3">${finance}</td>
+
+                </tr>
+
+                <tr align="center">
+                    <td colspan="2">业务主管:</td>
+                    <td colspan="2">${saleApprover}</td>
+                    <td></td>
+                    <td></td>
+                    <td></td>
+                    <td></td>
+                    <td></td>
+                </tr>
+            </tbody>
+        </table>
+        `;
+        return printStr;
+        // <td colspan="2">业务主管:</td>
+        // <td colspan="2">${saleLeader}</td>
+        // <tr align="center">
+
+        //     // <td colspan="2">生产部:</td>
+        //     // <td colspan="2">${production}</td>
+        // </tr>
+        //         <tr align="center">
+        //             <td colspan="2"> 2</td>
+        //             <td> </td>
+        //             <td> </td>
+        //             <td> </td>
+        //             <td> </td>
+        //         </tr>
+        //         <tr>
+        //             <td colspan="2">小计:</td>
+        //             <td></td>
+        //             <td></td>
+        //             <td></td>
+        //             <td></td>
+        //         </tr>
+      }
+    },
+    // 自定义删除按钮
+    async myDeleteHandler(row) {
+      console.log(row);
+      let stateArr = ["2", "3", "4", "5", "6", "8", "9"];
+      let isDeleteValidate = this.selection.some((item) => {
+        return stateArr.includes(item.status);
+      });
+      console.log(this.selection);
+      console.log(isDeleteValidate);
+      if (isDeleteValidate) {
+        this.$message.error("仅允许删除订单状态为'未提交'或'未通过'的订单");
+        return;
+      }
+      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) {}
+    },
+    // 发货回调
+    myDeliverHandler(row) {
+      this.currentRow = row;
+      this.deliverShow = true;
+      this.$nextTick(() => {
+        this.$refs.deliverRef.productInvoiceInfo(row);
+      });
+    },
+    // 出库详情回调
+    handleOutDetail(row) {
+      this.outStockShow = true;
+      this.$nextTick(() => {
+        this.$refs.outStockRef.getOutStockDetail(row, false);
+      });
+    },
+    // 操作列回调
+    excuteHandler(btnData, row) {
+      let { btnType, btnParams, btnFormType } = btnData;
+      this.currentBtnData = btnData;
+      this.currentRow = JSON.parse(JSON.stringify(row));
+      console.log("btnData", btnType, btnData, row);
+      // 无表单
+      if (btnFormType == "noNeed") {
+        this.noNeedHandler(btnData, row);
+        return;
+      }
+      switch (btnType) {
+        case "INNERLINK":
+          this.routerHandler(btnData, btnType);
+          break;
+        case "OUTLINK":
+          this.routerHandler(btnData, btnType);
+          break;
+        case "UPDATE":
+          this.handleUpdate(row, btnData);
+          break;
+        case "EXECUTE":
+          this.handleUpdate(row, btnData);
+          break;
+        case "INITIATED":
+          this.handleUpdate(row, btnData);
+          break;
+        case "DELETE":
+          this.handleDelete(row, btnData);
+          break;
+        case "myEdit":
+          this.handleEdit("1", row);
+          break;
+        case "OutDetail":
+          this.handleOutDetail(row);
+          break;
+
+        case "myDetail":
+          this.handleDetail(row);
+          break;
+        case "myDelete":
+          this.myDeleteHandler(row, btnData);
+          break;
+        case "myComplate":
+          this.myComplateHandler(row, btnData);
+          break;
+        case "printOutBound":
+          this.myPrintOutBoundHandler(row, btnData);
+          break;
+        case "deliver": //发货
+          this.myDeliverHandler(row, btnData);
+          break;
+        default:
+          break;
+      }
+    },
+    // 完成回调
+    async myComplateHandler(row) {
+      this.$confirm("即将确认完成, 是否继续?", "提示", {
+        confirmButtonText: "确定",
+        cancelButtonText: "取消",
+        type: "warning",
+      })
+        .then(async () => {
+          let payload = {
+            id: row.id,
+            status: 6,
+            saleNo: row.saleNo,
+            completionTime: new Date(),
+          };
+          let res = await updateOrder(payload);
+          if (res.code == 200) {
+            this.$message({
+              type: "success",
+              message: "订单已完成",
+            });
+            this.getList();
+          } else {
+            this.$message({
+              type: "error",
+              message: "订单已完成失败,请稍后再试",
+            });
+            console.log(res);
+          }
+        })
+        .catch(() => {
+          this.$message({
+            type: "info",
+            message: "已取消完成",
+          });
+        });
+
+      console.log(row);
+    },
+    noNeedHandler(btnData, row) {
+      this.$modal
+        .confirm("是否确认执行该操作?")
+        .then(async () => {
+          // 获取默认参数
+          let data = {
+            basicMap: {
+              tableName: this.tableName,
+              // btnKey: btnData.btnKey,
+              btnKey: this.currentBtnData.btnKey,
+            },
+            conditionMap: {},
+            commMap: {},
+            btnParametersMap: {},
+          };
+          console.log(this.currentBtnData, this.currentRow);
+          if (this.currentBtnData.btnParams) {
+            let conditionData =
+              JSON.parse(this.currentBtnData.btnParams).conditionData || [];
+            // let
+            let commonData =
+              JSON.parse(this.currentBtnData.btnParams).commonFieldData || [];
+
+            conditionData.forEach((item) => {
+              data.conditionMap[item.fieldName.split(".")[1]] = item.fieldValue
+                ? item.fieldValue
+                : this.currentRow[camelCase(item.fieldName.replace(".", "_"))];
+            });
+            commonData.forEach((item) => {
+              data.btnParametersMap[item.fieldName.split(".")[1]] =
+                item.fieldValue
+                  ? item.fieldValue
+                  : this.currentRow[
+                      camelCase(item.fieldName.replace(".", "_"))
+                    ];
+            });
+          }
+          data.basicMap.btnType = this.currentBtnData.btnType;
+          data.basicMap.visible = true;
+          try {
+            let res = await btnCommonApi(data);
+            if (res.code == 200) {
+              this.$message.success(res.msg);
+            } else {
+              this.$message.error("网络异常,请稍后再试");
+            }
+          } catch (error) {
+            console.log(error);
+            this.$message.error("网络异常,请稍后再试");
+          }
+        })
+        .then(() => {
+          // 调用子组件查询方法 目的是携带上子组件中的查询参数
+          this.$refs.mychild.pageList();
+          // this.$modal.msgSuccess("操作成功");
+        })
+        .catch(() => {});
+    },
+
+    // k-form-build表单变化回调
+    formChangeHandler(value, label) {
+      // console.log(value, label);
+    },
+  },
+};
+</script>
+
+<style scoped lang="scss">
+::v-deep .el-dialog:not(.is-fullscreen) {
+  min-width: 610px !important;
+}
+</style>

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

@@ -148,13 +148,20 @@
         >
         </el-table-column>
         <!-- <el-table-column type="selection" width="55" /> -->
-        <el-table-column prop="saleNo" label="合同号" />
-        <el-table-column prop="saleDate" label="日期" />
-        <el-table-column prop="customName" label="客户名称" />
-        <el-table-column prop="deliveryDate" label="交货日期" />
-        <el-table-column prop="saleLeadTime" label="交货天数" />
-        <el-table-column prop="saleAmountInWords" label="合计金额(大写)" />
-        <el-table-column prop="status" label="状态">
+        <el-table-column prop="saleNo" align="center" label="合同号" />
+        <el-table-column prop="saleDate" align="center" label="日期" />
+        <el-table-column prop="customName" align="center" label="客户名称" />
+        <el-table-column prop="deliveryDate" align="center" label="交货日期" />
+        <el-table-column prop="saleLeadTime" align="center" label="交货天数" />
+        <el-table-column prop="saleAmountInWords" align="center" label="合计金额(大写)" />
+        <el-table-column label="付款方式" align="center" prop="salePayType">
+          <template slot-scope="scope">
+            {{
+              getDictLabel(scope.row.salePayType, "payment_method")
+            }}
+          </template>
+        </el-table-column>
+        <el-table-column prop="status" align="center" label="状态">
           <template slot-scope="scope">
             <el-tag :type="scope.row.listClass">{{
               getDictLabel(scope.row.status, "sales_order_status")
@@ -162,9 +169,9 @@
           </template>
         </el-table-column>
 
-        <el-table-column prop="salesman" label="销售员" />
-        <el-table-column prop="remark" label="备注" />
-        <el-table-column label="操作">
+        <el-table-column prop="salesman" align="center" label="销售员" />
+        <el-table-column prop="remark" align="center" label="备注" />
+        <el-table-column label="操作" align="center">
           <template slot-scope="scope">
             <el-dropdown>
               <el-button type="warning" plain size="small">
@@ -383,6 +390,31 @@
                 <!-- {{ formData.saleAmountInWords }} -->
               </el-form-item>
             </el-col>
+
+            <el-col :span="12">
+              <el-form-item prop="salePayType" label="付款方式">
+                <!-- <el-input
+                v-model="formData.salePayType"
+                size="small"
+                clearable
+              ></el-input> -->
+                <el-select
+                  v-model="formData.salePayType"
+                  size="small"
+                  clearable
+                  filterable
+                >
+                  <el-option
+                    v-for="item in dict.type.payment_method"
+                    :key="item.value"
+                    :label="item.label"
+                    :value="item.value"
+                  ></el-option>
+                </el-select>
+              </el-form-item>
+            </el-col>
+
+
             <!-- <el-col :span="12">
               <el-form-item label="付款方式:">
                 <el-select
@@ -874,7 +906,7 @@ export default {
         deliveryDate: "", //交货日期
         saleAmounts: "", //合计金额 小写
         saleAmountInWords: "", //合计金额 大写
-        salePayType: "1", //支付方式
+        salePayType: "2", //支付方式
         earnestMoney: "", //定金
         salesman: "", //业务员
         saleLeader: "", //业务主管
@@ -948,6 +980,13 @@ export default {
             trigger: "change",
           },
         ],
+        salePayType: [
+          {
+            required: true,
+            message: "请选择付款方式",
+            trigger: "change",
+          },
+        ],
         saleOrderEstimatedTime: [
           {
             required: true,
@@ -1349,7 +1388,7 @@ export default {
         deliveryDate: moment(new Date()).format("YYYY-MM-DD"),
         saleAmounts: "", //合计金额 小写
         saleAmountInWords: "", //合计金额 大写
-        salePayType: "1", //支付方式
+        salePayType: "2", //支付方式
         earnestMoney: "",
         salesman: "", //业务员
         saleLeader: "", //业务主管

+ 3 - 0
zkqy-ui/src/views/orderMange/statisticalAnalysis/customerStatistics.vue

@@ -210,6 +210,9 @@ export default {
           //坐标值标注
           axisLabel: {
             show: true,
+            fontSize: 10,
+            interval: 0, // 强制显示所有标签
+            rotate: 45, // 旋转角度
             textStyle: {
               color: "#000000",
             },

+ 2 - 2
zkqy-ui/src/views/orderMange/statisticalAnalysis/fastSellingProduct.vue

@@ -159,9 +159,9 @@ export default {
           }
         },
         grid: {
-          left: 15,
+          left: 1,
           top: 10,
-          right: 15,
+          right: '50',
           bottom: 0,
           containLabel: true
         },