yangfeng
2024-03-25 a70881cad8fe749f41b06f221d10bb7491259256
src/views/orderManageModule/orderManage/index.vue
@@ -10,7 +10,7 @@
          :otherOptions="otherOptions"
          :show-action-btn="false"
          :placeholder="'请输入订单编号'"
          @searchClick="onFilterSearch"
          @searchClick="searchClick"
        />
      </div>
    </div>
@@ -29,7 +29,14 @@
            <template slot="tableButton">
              <el-table-column label="操作" width="160" fixed="right">
                <template slot-scope="scope">
                  <el-button v-if="scope.row.status == 0" type="text" size="small">待确认</el-button>
                  <template v-if="scope.row.status == 1">
                    <el-button type="text" size="small" @click.stop="changeStatusClick(scope.row, '确认')"
                      >确认</el-button
                    >
                    <el-button type="text" size="small" @click.stop="changeStatusClick(scope.row, '取消')"
                      >取消</el-button
                    >
                  </template>
                  <el-button
                    v-else-if="scope.row.status == 2 || scope.row.status == 4"
                    type="text"
@@ -38,12 +45,16 @@
                    >申请物料</el-button
                  >
                  <template v-else-if="scope.row.status == 5">
                    <el-button type="text" size="small">生产完成</el-button>
                    <el-button type="text" size="small" @click.stop="changeStatusClick(scope.row, '生产完成')"
                      >生产完成</el-button
                    >
                    <el-button type="text" size="small" @click.stop="deliveryClick(scope.row)">发货</el-button>
                  </template>
                  <template v-else-if="scope.row.status == 6">
                    <el-button type="text" size="small" @click.stop="deliveryClick(scope.row)">发货</el-button>
                    <el-button type="text" size="small">关闭</el-button>
                    <el-button type="text" size="small" @click.stop="changeStatusClick(scope.row, '发货完成')"
                      >发货完成</el-button
                    >
                  </template>
                  <span v-else>--</span>
                </template>
@@ -125,6 +136,14 @@
</template>
<script>
import {
  outsourceOrderList,
  outsourceOrderOverview,
  outsourceOrderProductList,
  getMaterialApplyList,
  getDeliveryList,
  changeOutsourceOrderStatus
} from "@/api/orderManageModule/orderManage"
import pageMixin from "@/components/makepager/pager/mixin/pageMixin"
import ApplyMaterialsDialog from "@/views/orderManageModule/orderManage/components/ApplyMaterialsDialog"
import DeliveryDialog from "@/views/orderManageModule/orderManage/components/DeliveryDialog"
@@ -155,10 +174,10 @@
      tableList: {},
      tableColumn: [
        { label: "订单编号", prop: "number", min: 90, default: true },
        { label: "产品数量", prop: "quotationName", min: 120 },
        { label: "签约日期", prop: "validity_date", min: 100 },
        { label: "交付日期", prop: "client_name", min: 120 },
        { label: "状态", prop: "quotationStatus", isCallMethod: true, getCallMethod: this.getStatus }
        { label: "产品数量", prop: "productQuantity", min: 120 },
        { label: "签约日期", prop: "signTime", min: 100 },
        { label: "交付日期", prop: "deliveryDate", min: 120 },
        { label: "状态", prop: "status", isCallMethod: true, getCallMethod: this.getStatus }
      ],
      showCol: ["订单编号", "产品数量", "签约日期", "交付日期", "状态"],
      selectRow: {},
@@ -168,35 +187,35 @@
      bottomTwoTableList2: {},
      bottomTwoTableList3: {},
      productColumn: [
        { label: "产品名称", prop: "number", min: 90, default: true },
        { label: "产品编号", prop: "quotationName", min: 120 },
        { label: "Bom编号", prop: "validity_date", min: 100 },
        { label: "产品规格", prop: "client_name", min: 120 },
        { label: "产品数量", prop: "quotationStatus" },
        { label: "单位", prop: "client_name", min: 120 }
        { label: "产品名称", prop: "productName", min: 90, default: true },
        { label: "产品编号", prop: "productId", min: 120 },
        { label: "Bom编号", prop: "bomID", min: 100 },
        { label: "产品规格", prop: "specs", min: 120 },
        { label: "产品数量", prop: "amount" },
        { label: "单位", prop: "unit", min: 120 }
      ],
      showProductCol: ["产品名称", "产品编号", "Bom编号", "产品规格", "产品数量", "单位"],
      materialRquestColumn: [
        { label: "产品名称", prop: "number", min: 90, default: true },
        { label: "产品编号", prop: "quotationName", min: 120 },
        { label: "产品数量", prop: "validity_date", min: 100 },
        { label: "产品规格", prop: "client_name", min: 120 },
        { label: "产品型号", prop: "quotationStatus" },
        { label: "单位", prop: "client_name", min: 120 }
        { label: "产品名称", prop: "materialName", min: 90, default: true },
        { label: "产品编号", prop: "materialNumber", min: 120 },
        { label: "产品数量", prop: "amount", min: 100 },
        { label: "产品规格", prop: "specs", min: 120 },
        { label: "产品型号", prop: "type" },
        { label: "单位", prop: "unit", min: 120 }
      ],
      showMaterialRquestCol: ["产品名称", "产品编号", "产品数量", "产品规格", "产品型号", "单位"],
      deliveryRquestColumn: [
        { label: "发货单号", prop: "number", default: true },
        { label: "产品名称", prop: "number", default: true },
        { label: "产品编号", prop: "quotationName" },
        { label: "订单数量", prop: "validity_date" },
        { label: "发货数量", prop: "validity_date" },
        { label: "产品规格", prop: "client_name" },
        { label: "产品型号", prop: "quotationStatus" },
        { label: "单位", prop: "client_name" },
        { label: "运单号", prop: "validity_date" },
        { label: "承运商", prop: "validity_date" },
        { label: "创建时间", prop: "client_name", min: 100 }
        { label: "产品名称", prop: "productName", default: true },
        { label: "产品编号", prop: "productId" },
        { label: "订单数量", prop: "amount" },
        { label: "发货数量", prop: "sendAmount" },
        { label: "产品规格", prop: "specs" },
        { label: "产品型号", prop: "type" },
        { label: "单位", prop: "unit" },
        { label: "运单号", prop: "waybillNumber" },
        { label: "承运商", prop: "carrier" },
        { label: "创建时间", prop: "createdAt", min: 100 }
      ],
      showDeliveryRquestCol: [
        "发货单号",
@@ -220,23 +239,167 @@
        visible: false,
        title: "发货",
        infomation: {}
      },
      searchParam: {
        keyword: "",
        page: 1,
        pageSize: 15
      }
    }
  },
  created() {
    this.setTable()
    this.getData()
  },
  methods: {
    reRreshData() {
      this.getData()
    },
    addCommonClick() {
      alert("露西666")
    // 获取top订单列表数据
    async getData() {
      this.searchParam.page = this.pagerOptions.currPage
      this.searchParam.pageSize = this.pagerOptions.pageSize
      let rsp = await outsourceOrderList(this.searchParam)
      let list = rsp
      if (list && list.code == 200) {
        this.tableList.tableInfomation = list.data
        this.pagerOptions.totalCount = list.total
        if (list.total > 0) {
          this.selectRow = list.data[0]
          if (this.activeNameBottom == 1) {
            this.getProductListMethod(this.selectRow.id)
          } else if (this.activeNameBottom == 2) {
            this.getMaterialApplyList(this.selectRow.number)
          } else {
            this.getDeliveryList(this.selectRow.id)
          }
        } else {
          this.selectRow = {}
        }
        this.overview()
      }
    },
    searchClick() {},
    onFilterSearch() {},
    tableRowClick() {},
    // 获取产品信息
    getProductListMethod(id) {
      outsourceOrderProductList({ outsourcingOrderId: id }).then((res) => {
        if (res.code == 200) {
          this.bottomTwoTableList1.tableInfomation = res.data
        }
      })
    },
    // 获取物料申请单
    getMaterialApplyList(number) {
      getMaterialApplyList({ number: number }).then((res) => {
        if (res.code == 200) {
          this.bottomTwoTableList2.tableInfomation = res.data
        }
      })
    },
    // 获取发货列表
    getDeliveryList(id) {
      getDeliveryList({ outsourcingOrderID: id }).then((res) => {
        console.log(res)
        if (res.code == 200) {
          let list = res.data.map((item) => {
            return {
              number: item.outsourcingOrderDelivery.number,
              productName: item.outsourcingOrderProduct.productName,
              productId: item.outsourcingOrderProduct.productId,
              amount: item.outsourcingOrderProduct.amount,
              sendAmount: item.sendAmount,
              type: item.outsourcingOrderProduct.type,
              unit: item.outsourcingOrderProduct.unit,
              waybillNumber: item.outsourcingOrderDelivery.waybillNumber,
              carrier: item.outsourcingOrderDelivery.carrier,
              createdAt: item.createdAt
            }
          })
          this.bottomTwoTableList3.tableInfomation = list
        }
      })
    },
    overview() {
      outsourceOrderOverview().then((reply) => {
        this.totalObject.value = reply.data.total || 0
        this.otherOptions.map((item) => {
          if (item.label === "待分配") {
            item.value = reply.data.waitAssigned
          } else if (item.label === "已分配") {
            item.value = reply.data.hasAssigned
          }
        })
      })
    },
    searchClick(val) {
      this.searchParam.keyword = val
      this.pagerOptions.currPage = 1
      this.bottomTwoTableList1.tableInfomation = []
      this.bottomTwoTableList2.tableInfomation = []
      this.bottomTwoTableList3.tableInfomation = []
      this.getData()
    },
    tableRowClick(row, column, event) {
      console.log(row, column, event)
      this.selectRow = row
      if (this.activeNameBottom == 1) {
        this.getProductListMethod(this.selectRow.id)
      } else if (this.activeNameBottom == 2) {
        this.getMaterialApplyList(this.selectRow.number)
      } else {
        this.getDeliveryList(this.selectRow.id)
      }
    },
    tableRowClassName({ row }) {
      if (row.id == this.selectRow.id) {
        return "onSelect"
      }
    },
    getSelectArray() {},
    // 状态修改
    changeStatusClick(row, val) {
      if (val == "确认") {
        this.changeOutsourceOrderStatus(row.number, 2, "确认成功")
      } else if (val == "取消") {
        this.changeOutsourceOrderStatus(row.number, 0, "取消成功")
      } else if (val == "生产完成") {
        this.$confirm("是否确认生产完成?", "提示", {
          confirmButtonText: "确定",
          cancelButtonText: "取消",
          type: "warning"
        })
          .then(() => {
            this.changeOutsourceOrderStatus(row.number, 6, "生产完成成功")
          })
          .catch(() => {
            this.$message.warning("已取消生产完成")
          })
      } else if (val == "发货完成") {
        this.$confirm("是否确认全部发货完成?", "提示", {
          confirmButtonText: "确定",
          cancelButtonText: "取消",
          type: "warning"
        })
          .then(() => {
            this.changeOutsourceOrderStatus(row.number, 7, "全部发货完成成功")
          })
          .catch(() => {
            this.$message.warning("已取消发货完成")
          })
      }
    },
    changeOutsourceOrderStatus(number, status, str) {
      changeOutsourceOrderStatus({
        outsourcingOrderNumber: number,
        status: status
      })
        .then((reply) => {
          if (reply.code == 200) {
            this.getData()
            this.$message.success(str)
          }
        })
        .catch(() => {})
    },
    // 申请物料
    applyClick(row) {
      this.editApplyConfig.visible = true
@@ -252,27 +415,27 @@
      this.deliveryConfig.visible = true
      this.deliveryConfig.title = "发货"
      this.deliveryConfig.infomation = {
        outsourcingOrderNumber: row.number
        id: row.id,
        number: row.number
      }
    },
    tabClickBottom(activeNameBottom) {
      this.activeNameBottom = activeNameBottom
      // if (activeNameBottom == 1) {
      //   this.getProductListMethod(this.selectRow.id);
      // } else {
      //   this.getMaterialApplyList(this.selectRow.number);
      // }
      if (Object.keys(this.selectRow).length > 0) {
        if (activeNameBottom == 1) {
          this.getProductListMethod(this.selectRow.id)
        } else if (activeNameBottom == 2) {
          this.getMaterialApplyList(this.selectRow.number)
        } else {
          this.getDeliveryList(this.selectRow.id)
        }
      }
    },
    setTable() {
      this.tableList = {
        selectIndex: true,
        selectBox: true,
        tableInfomation: [
          {
            number: "1111",
            status: 4
          }
        ],
        tableInfomation: [],
        allcol: [],
        showcol: this.showCol,
        tableColumn: this.setColumnVisible(this.showCol, this.tableColumn)
@@ -354,10 +517,8 @@
    },
    // 状态
    getStatus(val) {
      return val === 0
        ? "待分配"
        : val === 1
        ? "已分配"
      return val === 1
        ? "待确认"
        : val === 2
        ? "待生产"
        : val === 3
@@ -368,6 +529,8 @@
        ? "生产中"
        : val === 6
        ? "生产完成"
        : val === 7
        ? "发货完成"
        : "--"
    }
  }