小小儁爺
2024-08-08 d20654ba067e5c0621d4d7d95915cbe47a10fe87
src/views/produceManager/produceOrder.vue
@@ -12,16 +12,23 @@
        <div style="display: flex">
          <el-button
            v-waves
            icon="el-icon-switch-button"
            @click="orderClose"
          >关闭订单
            type="primary"
            icon="el-icon-bottom"
            @click="batchHandle"
          >批量下达
          </el-button>
          <el-button
            v-waves
            icon="el-icon-delete"
            @click="orderDel"
          >删除订单
          </el-button>
          <!--                  <el-button-->
          <!--                    v-waves-->
          <!--                    icon="el-icon-switch-button"-->
          <!--                    @click="orderClose"-->
          <!--                  >关闭订单-->
          <!--                  </el-button>-->
          <!--                  <el-button-->
          <!--                    v-waves-->
          <!--                    icon="el-icon-delete"-->
          <!--                    @click="orderDel"-->
          <!--                  >删除订单-->
          <!--                  </el-button>-->
        </div>
      </div>
@@ -165,25 +172,27 @@
          :header-cell-style="this.$headerCellStyle"
          :cell-style="this.$cellStyle"
          @sort-change="sortChange"
          @row-click="rowClick"
          @selection-change="handleSelectionChange"
        >
          <!--          <el-table-column-->
          <!--            type="selection"-->
          <!--            width="50"-->
          <!--          />-->
          <!--          @row-click="rowClick"-->
          <el-table-column
            type="selection"
            width="50"
            fixed
          >
            <template slot-scope="{row}">
              <el-radio
                v-model="radioSelectedId"
                :label="row.id"
                style="color: transparent;padding-left: 10px;"
              />
              <!--              @change.native="getCurrentRow(row.id)"-->
            </template>
          </el-table-column>
            :selectable="selected"
          />
          <!--          <el-table-column-->
          <!--            width="50"-->
          <!--            fixed-->
          <!--          >-->
          <!--            <template slot-scope="{row}">-->
          <!--              <el-radio-->
          <!--                v-model="radioSelectedId"-->
          <!--                :label="row.id"-->
          <!--                style="color: transparent;padding-left: 10px;"-->
          <!--              />-->
          <!--              &lt;!&ndash;              @change.native="getCurrentRow(row.id)"&ndash;&gt;-->
          <!--            </template>-->
          <!--          </el-table-column>-->
          <el-table-column
            prop="RowNum"
            width="50"
@@ -338,17 +347,35 @@
          <el-table-column
            label="操作"
            fixed="right"
            width="80"
            width="120"
          >
            <template slot-scope="{row}">
              <div class="operationClass">
                <el-tooltip class="item" effect="dark" content="下达" placement="top">
                <el-tooltip v-del-tab-index class="item" effect="dark" content="订单下达" placement="top">
                  <!--                <el-button v-waves type="text" @click="edit('edit',row)">下达</el-button>-->
                  <i
                    class="el-icon-bottom"
                    :style="{color:$store.state.settings.theme}"
                    style="cursor: pointer;margin-left: 5px"
                    @click="edit('edit',row)"
                  />
                </el-tooltip>
                <el-tooltip v-del-tab-index class="item" effect="dark" content="订单关闭" placement="top">
                  <i
                    class="el-icon-switch-button"
                    :style="{color:$store.state.settings.theme}"
                    style="cursor: pointer;margin-left: 15px"
                    @click="orderClose(row.id)"
                  />
                </el-tooltip>
                <el-tooltip v-del-tab-index class="item" effect="dark" content="订单删除" placement="top">
                  <i
                    class="el-icon-delete"
                    :style="{color:$store.state.settings.theme}"
                    style="cursor: pointer;margin-left: 15px"
                    @click="orderDel(row.id)"
                  />
                </el-tooltip>
              </div>
@@ -472,7 +499,13 @@
<script>
import Pagination from '@/components/Pagination'
import { ClosedErpOrder, DeleteErpOrder, ErpOrderSearch, MarkSaveErpOrder } from '@/api/produceManager'
import {
  ClosedErpOrder,
  DeleteErpOrder,
  ErpOrderSearch,
  MarkBatchSaveErpOrder,
  MarkSaveErpOrder
} from '@/api/produceManager'
import { handleDatetime } from '@/utils/global'
import { SeaveSearchErpOrder } from '@/api/ErpSyncMes'
import elDragDialog from '@/directive/el-drag-dialog'
@@ -480,7 +513,7 @@
const SER_HZ = /^[\u4e00-\u9fa5]+$/
export default {
  name: 'SCDD',
  name: 'ProduceOrder',
  components: {
    Pagination
  },
@@ -576,7 +609,8 @@
        disabledDate(time) {
          return time.getTime() < Date.now() - 8.64e7
        }
      }
      },
      multipleSelection: []
      // expireTimeOption: {
      //   disabledDate(time) {
@@ -691,20 +725,17 @@
      this.getErpOrderSearch()
    },
    // 单选框选中获取当前行信息
    getCurrentRow(id) {
      this.radioSelectedId = id
    },
    rowClick(row) {
      this.radioSelectedId = row.id
    },
    // getCurrentRow(id) {
    //   this.radioSelectedId = id
    // },
    // rowClick(row) {
    //   this.radioSelectedId = row.id
    // },
    // 订单删除
    orderDel() {
      if (this.radioSelectedId.length < 1) {
        return this.$message.info('请先选择订单!')
      }
    orderDel(id) {
      this.tableData.forEach(item => {
        if (item.id === this.radioSelectedId) {
        if (item.id === id) {
          if (item.status === 'CLOSED') {
            return this.$message.info('此订单已关闭,无法删除!')
          } else {
@@ -713,7 +744,7 @@
              cancelButtonText: '取消',
              type: 'warning'
            }).then(() => {
              DeleteErpOrder({ erpordercode: item.wo, erporderid: this.radioSelectedId }).then(res => {
              DeleteErpOrder({ erpordercode: item.wo, erporderid: id }).then(res => {
                if (res.code === '200') {
                  this.$message.success('订单删除成功!')
                  this.getErpOrderSearch()
@@ -727,12 +758,9 @@
      })
    },
    // 订单关闭
    async orderClose() {
      if (this.radioSelectedId.length < 1) {
        return this.$message.info('请先选择订单!')
      }
    async orderClose(id) {
      this.tableData.forEach(item => {
        if (item.id === this.radioSelectedId) {
        if (item.id === id) {
          if (item.status !== 'NEW') {
            return this.$message.info('此订单非新订单,无法关闭!')
          } else {
@@ -741,7 +769,7 @@
              cancelButtonText: '取消',
              type: 'warning'
            }).then(() => {
              ClosedErpOrder({ erpordercode: item.wo, erporderid: this.radioSelectedId }).then(res => {
              ClosedErpOrder({ erpordercode: item.wo, erporderid: id }).then(res => {
                if (res.code === '200') {
                  this.$message.success('订单关闭成功!')
                  this.getErpOrderSearch()
@@ -866,6 +894,53 @@
        }
      })
    },
    handleSelectionChange(val) {
      this.multipleSelection = val
    },
    batchHandle() {
      this.$confirm('是否批量下达?', '提示', {
        confirmButtonText: '确定',
        cancelButtonText: '取消',
        type: 'warning'
      }).then(() => {
        if (this.multipleSelection.length === 0) {
          return this.$message.info('请先选择订单!')
        }
        // console.log(JSON.parse(JSON.stringify(this.multipleSelection)))
        const data = []
        this.multipleSelection.forEach(i => {
          data.push({
            'erporderid': i.id,
            'erpordercode': i.wo,
            'partcode': i.partcode,
            'wkshopcode': i.wkshp_code,
            'warehousecode': i.stck_code,
            'erpqty': i.qty,
            'markqty': i.qty,
            'ordernum': 1,
            'relse_qty': i.qty,
            'saleordercode': i.saleOrderCode,
            // 'saleOrderDeliveryDate': i.saleOrderDeliveryDate
            'saleOrderDeliveryDate': handleDatetime(new Date()) + ' 00:00:00'
          })
        })
        // console.log(data)
        MarkBatchSaveErpOrder(data).then(res => {
          if (res.code === '200') {
            this.multipleSelection = []
            this.$message.success('批量下达成功!')
            this.getErpOrderSearch()
          } else {
            this.$message.error('批量下达失败!')
          }
        })
      }).catch(() => {
        this.$message.info('已取消下达!')
      })
    },
    selected(row, index) {
      return row.status === 'NEW'
    },
    // 获取页面高度
    getHeight() {
      this.$nextTick(() => {