zouyu
2023-10-12 4d051089b33582019716598e7d700f20cdca16d2
src/views/plan/customerorder/index.vue
@@ -12,7 +12,7 @@
        ref="customerOrderTable"
      >
        <template #toolbar>
          <el-dropdown
          <!-- <el-dropdown
            v-if="permissions.customerorder_state_change"
            @command="handleCommand"
          >
@@ -23,11 +23,11 @@
              <el-dropdown-item
                :command="item.command"
                v-for="item in stateTagArr"
                :disabled="item.disabled"
                >{{ item.label }}</el-dropdown-item
              >
                :disabled="item.disabled">
                {{ item.label }}
              </el-dropdown-item>
            </el-dropdown-menu>
          </el-dropdown>
          </el-dropdown> -->
          <el-dropdown
            v-if="permissions.customerorder_doc_relate"
            @command="documentHandle"
@@ -64,19 +64,19 @@
              >
            </el-dropdown-menu>
          </el-dropdown>
          <el-button
          <!-- <el-button
            v-if="permissions.customerorder_push_otc"
            style="margin-left:10px;"
            type="primary"
            @click="pushOtc"
            >推送ERP</el-button
          >
          <el-button
          > -->
          <!-- <el-button
            style="margin-left:10px;"
            type="primary"
            @click="importOutPutBatch"
            >导入产出批次</el-button
          >
          > -->
          <el-button
            style="margin-left:10px;"
            type="primary"
@@ -240,18 +240,18 @@
      </el-dialog>
    </basic-container>
    <el-dialog title="选择同步日期" :visible.sync="syncDateVisible" width="30%">
    <el-dialog title="选择同步日期" :visible.sync="syncDateVisible" width="20%">
      <div style="display: flex;justify-content: center">
        <el-date-picker
          v-model="syncDate"
          type="daterange"
          value-format="yyyy-MM-dd"
          range-separator="至"
          start-placeholder="开始日期"
          end-placeholder="结束日期"
          :picker-options="pickerOptions"
        >
        </el-date-picker>
        <el-form :model="dataForm" :inline="true" :rules="dataRule" ref="dataForm" class="l-mes">
          <el-form-item label="日期">
            <el-date-picker
              v-model="dataForm.selectTime"
              type="datetime"
              placeholder="选择日期时间"
              value-format="yyyy-MM-dd HH:mm:ss">
            </el-date-picker>
          </el-form-item>
        </el-form>
      </div>
      <span slot="footer" class="dialog-footer">
        <el-button @click="syncDateVisible = false">取 消</el-button>
@@ -273,6 +273,7 @@
import MpsRequirements from './mps-requirements'
import SalesPartBatchDialog from './sales-part-batch.vue'
import CustomerorderReturnDialog from './customerorder-return.vue'
import { otcCustomerOrderSync } from '@/api/plan/customerorder'
import {
  delCustomerOrder,
  fetchListCustomerOrder,
@@ -300,6 +301,10 @@
export default {
  data() {
    return {
      dataForm: {
        selectTime: null
      },
      dataRule: {},
      pickerOptions: {
        onPick: ({ maxDate, minDate }) => {
          if (minDate && this.pickerMinDate) {
@@ -1006,24 +1011,24 @@
        ],
        toolbar: [],
        operator: [
          {
            text: '订单说明',
            type: 'text',
            size: 'small',
            fun: this.openCustomerOrder
          },
          {
            text: '查看库存',
            type: 'text',
            size: 'small',
            fun: this.stockHandle
          },
          {
            text: '箱码信息导出',
            type: 'text',
            size: 'small',
            fun: this.packageExportHandle
          },
          // {
          //   text: '订单说明',
          //   type: 'text',
          //   size: 'small',
          //   fun: this.openCustomerOrder
          // },
          // {
          //   text: '查看库存',
          //   type: 'text',
          //   size: 'small',
          //   fun: this.stockHandle
          // },
          // {
          //   text: '箱码信息导出',
          //   type: 'text',
          //   size: 'small',
          //   fun: this.packageExportHandle
          // },
          {
            text: '作废',
            type: 'text',
@@ -1222,25 +1227,25 @@
        permitArr: []
      })
    }
    if (this.permissions.customerorder_ifs_line) {
      this.table.toolbar.push({
        text: '获取ERP行号',
        type: 'primary',
        fun: this.pullIfsLineNo,
        disabled: false,
        permitArr: [],
        loading: false
      })
    }
    // if (this.permissions.customerorder_ifs_line) {
    //   this.table.toolbar.push({
    //     text: '获取ERP行号',
    //     type: 'primary',
    //     fun: this.pullIfsLineNo,
    //     disabled: false,
    //     permitArr: [],
    //     loading: false
    //   })
    // }
    if (this.permissions.customerorder_submit_oa) {
      this.table.toolbar.push({
        text: '提交审核',
        type: 'primary',
        fun: this.auditCustomerOrder,
        disabled: false,
        permitArr: [],
        loading: false
      })
      // this.table.toolbar.push({
      //   text: '提交审核',
      //   type: 'primary',
      //   fun: this.auditCustomerOrder,
      //   disabled: false,
      //   permitArr: [],
      //   loading: false
      // })
    }
    if (this.permissions.customerorder_set_salesparts) {
      this.table.toolbar.push({
@@ -1269,7 +1274,7 @@
          prop: 'coState',
          searchInfoType: 'select',
          // propVal: '01partUnCheck'
          propVal: '02technologyUnCheck'
          // propVal: '02technologyUnCheck'
        })
      )
      this.$refs.customerOrderTable.setQueryParam(queryParam)
@@ -1288,18 +1293,19 @@
    },
    // 创建主生产计划
    masterPlanHandle() {
      console.log(this.multipleSelection);
      if (this.multipleSelection && this.multipleSelection.length > 0) {
        if (this.judgeCoState(this.multipleSelection)) {
          // 判断一下剩余数量是否大于0
          for (let i = 0, len = this.multipleSelection.length; i < len; i++) {
            if (
              this.multipleSelection[i].buyQtyDue -
                this.multipleSelection[i].requireNumber <=
              0
            ) {
              this.$message.error('请选库存数量大于已下发数量的销售订单')
              return
            }
            // if (
            //   this.multipleSelection[i].buyQtyDue -
            //     this.multipleSelection[i].requireNumber <=
            //   0
            // ) {
            //   this.$message.error('请选库存数量大于已下发数量的销售订单')
            //   return
            // }
            if (
              !(
                this.multipleSelection[i].isAudit != null &&
@@ -1942,28 +1948,37 @@
      this.syncDateVisible = false
      this.table.toolbar.find((e) => e.text === '获取销售订单').loading = true
      syncOrder({
        startTime: this.syncDate[0],
        endTime: this.syncDate[1]
      })
        .then((res) => {
          this.table.toolbar.find(
            (e) => e.text === '获取销售订单'
          ).loading = false
          const resData = res.data
          if (resData.code === 0) {
            this.$message.success(resData.data)
            this.getData()
          } else {
            this.$message.error('同步失败')
          }
      if (this.dataForm.selectTime != null && this.dataForm.selectTime != '') {
        otcCustomerOrderSync({
          selectTime: this.dataForm.selectTime,
          pathCode: '1'
        })
        .catch((e) => {
          this.table.toolbar.find(
            (e) => e.text === '获取销售订单'
          ).loading = false
          this.$forceUpdate()
        })
          .then((response) => {
            this.table.toolbar.find(
              (e) => e.text === '获取销售订单'
            ).loading = false
            const resData = response.data
            if (resData.code === 0) {
              this.$message.success('拉取销售订单成功;' + resData.msg)
              this.dataForm.selectTime = null
              this.$emit('refreshDataList')
              this.getData()
            } else {
              this.$message.success('拉取销售订单失败')
            }
          })
          .catch((e) => {
            this.table.toolbar.find(
              (e) => e.text === '获取销售订单'
            ).loading = false
            this.$forceUpdate()
          })
      } else {
        this.table.toolbar.find(
          (e) => e.text === '获取销售订单'
        ).loading = false
        this.$message.error('请先选择日期')
      }
    }
  }
}