Fixiaobai
2023-11-14 21d976db1dcdf9ea4b6c300c159a654a7cd62b63
src/views/plan/customerorder/index.vue
@@ -67,20 +67,20 @@
              >
            </el-dropdown-menu>
          </el-dropdown>
          <el-button
          <!-- <el-button
            v-if="permissions.customerorder_ifs_line"
            style="margin-left:10px;"
            type="primary"
            @click="pullIfsLineNo"
            >获取OTC行号</el-button
          >
          <el-button
          > -->
          <!-- <el-button
            v-if="permissions.customerorder_push_otc"
            style="margin-left:10px;"
            type="primary"
            @click="pushOtc"
            >推送OTC</el-button
          >
          > -->
          <!-- <el-button
            style="margin-left:10px;"
            type="primary"
@@ -93,13 +93,13 @@
            @click="exportStandBook"
            >导出台账</el-button
          > -->
          <el-button
          <!-- <el-button
            v-if="permissions.plan_customerorder_return"
            style="margin-left:10px;"
            type="primary"
            @click="returnOrder"
            >订单退回</el-button
          >
          > -->
        </template>
      </ttable>
@@ -250,18 +250,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="日期" prop="selectTime">
            <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>
@@ -283,6 +283,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,
@@ -310,6 +311,14 @@
export default {
  data() {
    return {
      dataForm: {
        selectTime: null,
        exportTime: null
      },
      dataRule: {
        exportTime:[{required:true,message:'导出日期不能为空',trigger:'change'}],
        selectTime:[{required:true,message:'日期不能为空',trigger:'change'}]
      },
      pickerOptions: {
        onPick: ({ maxDate, minDate }) => {
          if (minDate && this.pickerMinDate) {
@@ -333,6 +342,15 @@
      showCustomerorderReturn: false,
      scheduleVisible: false,
      showDocument: false,
      sourceIdList: [{
        label: '外部',
        value: '0',
        type: 'success',
      },{
        label: '内部',
        value: '1',
        type: ''
      }],
      stateTagArr: [
        {
          label: '标记零件待选',
@@ -652,18 +670,18 @@
        ],
        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.openCustomerOrder
          // },
          // {
          //   text: '查看库存',
          //   type: 'text',
          //   size: 'small',
          //   fun: this.stockHandle
          // },
          {
            text: '作废',
            type: 'text',
@@ -683,7 +701,7 @@
        operatorConfig: {
          fixed: 'right',
          label: '操作',
          width: 260,
          width: 100,
          minWidth: 100
        }
      },
@@ -819,7 +837,7 @@
      this.table.toolbar.push({
        text: '获取销售订单',
        type: 'primary',
        fun: this.pullCustomerOrder,
        fun: this.syncERP,
        disabled: false,
        permitArr: []
      })
@@ -851,6 +869,14 @@
    }
  },
  methods: {
    getSourceId(row, column, cellValue) {
      this.sourceIdList.forEach((obj) => {
        if (obj.value === cellValue) {
          cellValue = obj.label
        }
      })
      return cellValue
    },
    getOtcPartSyncOptionList() {
      return this.otcPartSyncOptionList
    },
@@ -1344,10 +1370,10 @@
                  '存在销售订单已关联工艺文件,如需更改,请先解除关联'
                )
              }
              if (item.salesPartNo == null || item.salesPartNo === '') {
                status = true
                this.$message.error('存在销售订单未绑定销售件,请先绑定')
              }
              // if (item.salesPartNo == null || item.salesPartNo === '') {
              //   status = true
              //   this.$message.error('存在销售订单未绑定销售件,请先绑定')
              // }
              if (item.partNo != firstPartNo) {
                status = true
                this.$message.error('订单零件号不一致')
@@ -1534,28 +1560,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,
          orderNo: ''
        })
        .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('请先选择日期')
      }
    }
  }
}