src/views/scgl/scdd.vue
@@ -31,15 +31,6 @@
            <el-form-item label="产品编码" style=" display: flex;">
              <el-input v-model="form.partcode" style="width: 200px" placeholder="请输入" />
              <!--              <el-select v-model="form.partcode" :popper-append-to-body="false" style="width: 200px" placeholder="请选择">-->
              <!--                <el-option-->
              <!--                  v-for="item in partArr"-->
              <!--                  :key="item.code"-->
              <!--                  :label="item.name"-->
              <!--                  :value="item.code"-->
              <!--                />-->
              <!--              </el-select>-->
            </el-form-item>
            <el-form-item label="产品名称" style=" display: flex;">
              <el-input v-model="form.partname" style="width: 200px" placeholder="请输入" />
@@ -51,6 +42,7 @@
              <el-date-picker
                v-model="form.paydate"
                type="date"
                value-format="yyyy-MM-dd HH:mm:ss"
                style="width: 200px"
                placeholder="选择日期"
              />
@@ -62,6 +54,7 @@
              <el-date-picker
                v-model="form.createdate"
                type="date"
                value-format="yyyy-MM-dd HH:mm:ss"
                style="width: 200px"
                placeholder="选择日期"
              />
@@ -78,7 +71,7 @@
        <el-button
          type="primary"
          icon="el-icon-refresh-right"
          @click="reset"
          @click="reset('update')"
        >同步ERP
        </el-button>
        <el-button
@@ -212,8 +205,9 @@
    <el-dialog
      :title="operation==='add'?'新增':'下达'"
      :visible.sync="dialogVisible"
      width="50%"
      width="60%"
      top="15vh"
      :close-on-click-modal="false"
      @closed="handleClose"
      @close="handleClose"
    >
@@ -300,10 +294,8 @@
<script>
import Pagination from '@/components/Pagination'
import { AddUpdateOrganization, DeleteOrganization, OrganizationSearch, PrentOrganization } from '@/api/jcsz'
import { getCookie } from '@/utils/auth'
import { ClosedErpOrder, ErpOrderSearch, MarkSaveErpOrder } from '@/api/scgl'
import { PartSelect } from '@/api/zzmx'
import { handleDatatime } from '@/utils/global'
const SER_HZ = /^[\u4e00-\u9fa5]+$/
export default {
@@ -340,7 +332,6 @@
        page: 1, // 第几页
        rows: 20 // 每页多少条
      },
      // partArr: [],
      erporderstusArr: [
        { code: 'NEW', name: '新订单' },
        { code: 'CREATING', name: '创建中' },
@@ -348,7 +339,6 @@
        { code: 'CLOSED', name: '已关闭' }
      ],
      total: 10,
      // radioSelected: {},
      radioSelected: '',
      tableData: [],
      dialogVisible: false,
@@ -403,13 +393,6 @@
      this.tableData = res.data
      this.total = res.count
    },
    // syncGetErpOrderSearch() {
    //   this.getErpOrderSearch()
    // },
    // async getPartSelect() {
    //   const { data: res } = await PartSelect()
    //   this.partArr = res
    // },
    // 排序改变时
    sortChange({ column, prop, order }) {
      if (order === 'descending') {
@@ -428,7 +411,7 @@
      this.getErpOrderSearch()
    },
    // 重置
    reset() {
    reset(val) {
      this.form.erporderstus = ''
      this.form.erpordercode = ''
      this.form.partcode = ''
@@ -438,6 +421,9 @@
      this.form.creatuser = ''
      this.form.createdate = ''
      this.getErpOrderSearch()
      if (val.length > 0) {
        this.$message.success('ERP已同步!')
      }
    },
    // 单选框选中获取当前行信息
    getCurrentRow(wo) {
@@ -445,29 +431,31 @@
    },
    // 订单关闭
    async  orderClose() {
      console.log(this.radioSelected, 1)
      this.$confirm('是否确认关闭订单?', '提示', {
        confirmButtonText: '确定',
        cancelButtonText: '取消',
        type: 'warning'
      }).then(() => {
        this.tableData.forEach((item, index) => {
          if (this.radioSelected === item.wo) {
            if (item.status !== 'NEW') {
              return this.$message.info('此订单非新订单,无法关闭!')
            }
      if (this.radioSelected.length < 1) {
        return this.$message.info('请先选择订单!')
      }
      this.tableData.find(item => {
        if (item.wo === this.radioSelected) {
          if (item.status !== 'NEW') {
            return this.$message.info('此订单非新订单,无法关闭!')
          } else {
            this.$confirm('是否确认关闭订单?', '提示', {
              confirmButtonText: '确定',
              cancelButtonText: '取消',
              type: 'warning'
            }).then(() => {
              ClosedErpOrder({ erpordercode: this.radioSelected }).then(res => {
                if (res.code === '200') {
                  this.$message.success('订单关闭成功!')
                  this.getErpOrderSearch()
                  // this.radioSelected = ''
                }
              })
            }).catch(() => {
              this.$message.info('已取消关闭!')
            })
          }
        })
        ClosedErpOrder({ erpordercode: this.radioSelected }).then(res => {
          if (res.code === '200') {
            this.$message.success('删除成功!')
            this.getErpOrderSearch()
          }
        })
      }).catch(() => {
        this.$message.info('已取消删除')
        }
      })
    },
    // 新增按钮
@@ -521,6 +509,13 @@
    },
    // 对话框确认
    dialogVisibleConfirm() {
      if (this.dialogForm.markqty < 1 || this.dialogForm.markqty > this.dialogForm.erpqty - this.dialogForm.relse_qty) {
        return this.$message.info('下单数量超出可下单数的范围!')
      }
      if (this.dialogForm.ordernum < 1 || this.dialogForm.ordernum > this.dialogForm.markqty) {
        return this.$message.info('下单单数超出可下单单数的范围!')
      }
      this.$refs.dialogForm.validate(valid => {
        if (valid) {
          const data = {