loulijun2021
2022-08-05 d33eacc1f85ac3a736b33ba4713a19aae466d711
src/views/scgl/scdd.vue
@@ -13,6 +13,7 @@
            <el-form-item label="订单状态" style=" display: flex;">
              <el-select
                v-model="form.erporderstus"
                filterable
                :popper-append-to-body="false"
                style="width: 200px"
                placeholder="请选择"
@@ -28,7 +29,6 @@
            <el-form-item label="订单编号" style=" display: flex;">
              <el-input v-model="form.erpordercode" placeholder="请输入" style="width: 200px" />
            </el-form-item>
            <el-form-item label="产品编码" style=" display: flex;">
              <el-input v-model="form.partcode" style="width: 200px" placeholder="请输入" />
            </el-form-item>
@@ -38,34 +38,45 @@
            <el-form-item label="产品规格" style=" display: flex;">
              <el-input v-model="form.partspec" style="width: 200px" placeholder="请输入" />
            </el-form-item>
            <el-form-item label="交付时间" style=" display: flex;">
              <el-date-picker
                v-model="form.paydate"
                type="daterange"
                range-separator="~"
                size="mini"
                :clearable="false"
                start-placeholder="开始日期"
                end-placeholder="结束日期"
              />
              <!--              :picker-options="expireTimeOption"-->
            </el-form-item>
            <el-form-item label="创建人员" style=" display: flex;">
              <el-input v-model="form.creatuser" style="width: 200px" placeholder="请输入" />
            </el-form-item>
            <el-form-item label="创建时间" style=" display: flex;">
            <el-form-item label="预计开工时间" label-width="100px" style=" display: flex;">
              <el-date-picker
                v-model="form.createdate"
                v-model="form.paystartdate"
                type="daterange"
                range-separator="~"
                size="mini"
                style="width: 240px"
                :clearable="false"
                start-placeholder="开始日期"
                end-placeholder="结束日期"
              />
              <!--              :picker-options="expireTimeOption"-->
            </el-form-item>
            <el-form-item label="预计完工时间" label-width="100px" style=" display: flex;">
              <el-date-picker
                v-model="form.payenddate"
                type="daterange"
                :clearable="false"
                range-separator="~"
                start-placeholder="开始日期"
                style="width: 240px"
                end-placeholder="结束日期"
                size="mini"
              />
              <!--              :picker-options="expireTimeOption"-->
              <!--              <el-date-picker-->
              <!--                v-model="form.createdate"-->
              <!--                type="date"-->
              <!--                size="mini"-->
              <!--                :clearable="false"-->
              <!--                style="width: 200px;"-->
              <!--                format="yyyy-MM-dd"-->
              <!--                placeholder="选择日期"-->
              <!--              />-->
            </el-form-item>
          </div>
          <div style="min-height: 100px">
@@ -73,7 +84,7 @@
              <el-button type="primary" icon="el-icon-search" @click="search">查询</el-button>
              <el-button type="info" icon="el-icon-refresh" @click="reset">重置</el-button>
            </div>
            <!--                      <div v-if="!isFullscreen" style="display: flex;align-items: start; margin-top: 15px;z-index: 2">-->
            <!--                      <div v-if="!isIpad" style="display: flex;align-items: start; margin-top: 15px;z-index: 2">-->
            <!--                        <el-button-->
            <!--                          type="primary"-->
            <!--                          icon="el-icon-refresh-right"-->
@@ -87,7 +98,7 @@
            <!--                        >关闭订单-->
            <!--                        </el-button>-->
            <!--                      </div>-->
            <!--                      <div v-if="isFullscreen" style="display: flex;flex-direction: column;align-items: end">-->
            <!--                      <div v-if="isIpad" style="display: flex;flex-direction: column;align-items: end">-->
            <!--                        <el-button-->
            <!--                          type="primary"-->
            <!--                          icon="el-icon-refresh-right"-->
@@ -110,7 +121,7 @@
        <el-button
          type="primary"
          icon="el-icon-refresh-right"
          @click="reset('update')"
          @click="syncERP"
        >同步ERP
        </el-button>
        <el-button
@@ -119,14 +130,12 @@
          @click="orderClose"
        >关闭订单
        </el-button>
        <!--        <el-button type="primary" icon="el-icon-circle-plus-outline" @click="add('add')">新增</el-button>-->
        <!--        <el-button type="primary" icon="el-icon-upload2" @click="upload">导入</el-button>-->
      </div>
      <el-divider />
      <div class="elTableDiv">
        <el-table
          :data="tableData"
          :height="tableHeight"
          :height="tableHeight+'px'"
          border
          stripe
          :style="{width: 100+'%',height:tableHeight+'px',}"
@@ -141,6 +150,7 @@
          <!--          />-->
          <el-table-column
            width="50"
            fixed
          >
            <template slot-scope="{row}">
              <el-radio
@@ -154,6 +164,7 @@
          <el-table-column
            prop="RowNum"
            width="50"
            fixed
            label="序号"
          />
          <el-table-column
@@ -164,8 +175,8 @@
          >
            <template slot-scope="{row}">
              <div v-if="row.status==='NEW'">新订单</div>
              <div v-if="row.status==='CREATING'">创建中</div>
              <div v-if="row.status==='CREATED'">已创建</div>
              <div v-if="row.status==='CREATING'">部分下达</div>
              <div v-if="row.status==='CREATED'">全部下达</div>
              <div v-if="row.status==='CLOSED'">已关闭</div>
            </template>
          </el-table-column>
@@ -173,29 +184,35 @@
            prop="wo"
            label="订单编号"
            sortable="custom"
            width="150"
            min-width="150"
          />
          <el-table-column
            prop="partcode"
            label="产品编码"
            sortable="custom"
            width="150"
            min-width="150"
          />
          <el-table-column
            prop="partname"
            label="产品名称"
            sortable="custom"
            width="150"
            min-width="150"
          />
          <el-table-column
            prop="partspec"
            label="产品规格"
            sortable="custom"
            width="110"
            min-width="110"
          />
          <el-table-column
            prop="qty"
            label="订单数量"
            width="150"
            sortable="custom"
          />
          <el-table-column
            prop="relse_qty"
            label="已下单数量"
            width="150"
            sortable="custom"
          />
@@ -206,8 +223,14 @@
            width="150"
          />
          <el-table-column
            prop="paydate"
            label="要求交付时间"
            prop="planstartdate"
            label="预计开工时间"
            sortable="custom"
            width="160"
          />
          <el-table-column
            prop="planenddate"
            label="预计完工时间"
            sortable="custom"
            width="160"
          />
@@ -226,6 +249,7 @@
          <el-table-column
            label="操作"
            fixed="right"
            width="80"
          >
            <template slot-scope="{row}">
              <div class="operationClass">
@@ -343,11 +367,12 @@
<script>
import Pagination from '@/components/Pagination'
import { ClosedErpOrder, ErpOrderSearch, MarkSaveErpOrder } from '@/api/scgl'
import { handleDatatime, handleDatetime } from '@/utils/global'
import { handleDatetime } from '@/utils/global'
import { SeaveSearchErpOrder } from '@/api/ErpSyncMes'
const SER_HZ = /^[\u4e00-\u9fa5]+$/
export default {
  name: 'Zzjg',
  name: 'SCDD',
  components: {
    Pagination
  },
@@ -364,7 +389,7 @@
      }
    }
    return {
      isFullscreen: false,
      isIpad: false,
      mainHeight: 0,
      tableHeight: 0,
      form: {
@@ -373,8 +398,10 @@
        partcode: '', // 产品编码
        partname: '', // 产品名称
        partspec: '', // 产品规格
        paydate: '', // 交付时间
        creatuser: '', // 创建人员
        // paystartdate: '', // 交付时间
        paystartdate: '', // 预计开工时间
        payenddate: '', // 预计完工时间
        createdate: '', // 创建时间
        prop: 'createdate', // 排序字段
        order: 'desc', // 排序字段
@@ -383,8 +410,8 @@
      },
      erporderstusArr: [
        { code: 'NEW', name: '新订单' },
        { code: 'CREATING', name: '创建中' },
        { code: 'CREATED', name: '已创建' },
        { code: 'CREATING', name: '部分下达' },
        { code: 'CREATED', name: '全部下达' },
        { code: 'CLOSED', name: '已关闭' }
      ],
      total: 10,
@@ -394,7 +421,7 @@
      dialogForm: {
        partname: '', // 产品名称
        partspec: '', // 产品规格
        paydate: '', // 交付时间
        // paystartdate: '', // 预计开工时间
        wkshopname: '', // 车间名称
        warehousename: '', // 仓库名称
@@ -444,12 +471,12 @@
  methods: {
    async getErpOrderSearch() {
      console.log(this.form, 1)
      let tempDate2 = this.form.paydate
      let tempDate2 = this.form.paystartdate
      if (tempDate2.length > 0) {
        tempDate2 = handleDatetime(tempDate2[0]) + '~' + handleDatetime(tempDate2[1])
      }
      let tempDate = this.form.createdate
      let tempDate = this.form.payenddate
      if (tempDate.length > 0) {
        tempDate = handleDatetime(tempDate[0]) + '~' + handleDatetime(tempDate[1])
      }
@@ -460,9 +487,11 @@
        partcode: this.form.partcode, // 产品编码
        partname: this.form.partname, // 产品名称
        partspec: this.form.partspec, // 产品规格
        paydate: tempDate2, // 交付时间
        paystartdate: tempDate2, // 交付时间
        payenddate: tempDate, // 交付时间
        creatuser: this.form.creatuser, // 创建人员
        createdate: tempDate, // 创建时间
        // createdate: this.form.createdate.toString().length > 0 ? handleDatetime(this.form.createdate) : '', // 创建时间
        prop: this.form.prop, // 排序字段
        order: this.form.order, // 排序字段
        page: this.form.page, // 第几页
@@ -487,24 +516,49 @@
      this.form.prop = prop
      this.getErpOrderSearch()
    },
    // 同步ERP
    syncERP() {
      const loading = this.$loading({
        lock: true,
        text: '正在同步ERP,请稍等...',
        spinner: 'el-icon-loading',
        customClass: 'osloading',
        background: 'rgba(0, 0, 0, 0.7)'
      })
      SeaveSearchErpOrder().then(res => {
        console.log(res, 11)
        if (res.code === '200') {
          setTimeout(() => {
            this.getErpOrderSearch()
            loading.close()
            this.$message.success('同步成功!')
          }, 2000)
        }
        // else if (res.code === '300') {
        //   setTimeout(() => {
        //     loading.close()
        //     this.$message.error('同步失败!')
        //   }, 10000)
        // }
      })
    },
    // 查询
    search() {
      this.getErpOrderSearch()
    },
    // 重置
    reset(val) {
    reset() {
      this.form.erporderstus = ''
      this.form.erpordercode = ''
      this.form.partcode = ''
      this.form.partname = ''
      this.form.partspec = ''
      this.form.paydate = ''
      this.form.paystartdate = ''
      this.form.payenddate = ''
      this.form.creatuser = ''
      this.form.createdate = ''
      this.getErpOrderSearch()
      if (val.length > 0) {
        this.$message.success('ERP已同步!')
      }
    },
    // 单选框选中获取当前行信息
    getCurrentRow(wo) {
@@ -627,10 +681,10 @@
    getHeight() {
      this.$nextTick(() => {
        this.mainHeight = window.innerHeight - 250
        this.tableHeight = this.mainHeight - 100
        this.isFullscreen = window.innerHeight < 800
        if (this.isFullscreen) {
          this.tableHeight = this.tableHeight - 50
        this.tableHeight = this.mainHeight - 110
        this.isIpad = window.innerHeight < 769
        if (this.isIpad) {
          this.tableHeight = this.tableHeight - 30
        }
      })
    }
@@ -809,3 +863,8 @@
}
</style>
<style>
.osloading{
  font-size: 40px;
}
</style>