loulijun2021
2022-11-10 239fe20af73c1c9a4c86acd947d77c8836f03f9e
src/views/scgl/scdd.vue
@@ -2,7 +2,7 @@
  <div>
    <div class="body" :style="{height:mainHeight+'px'}">
      <div class="bodyTopButtonGroup">
      <div class="bodyTopButtonGroup" style="justify-content: space-between">
        <el-button
          icon="el-icon-refresh-right"
          @click="syncERP"
@@ -24,7 +24,7 @@
          style="display: flex;justify-content: space-between"
        >
          <div class="elForm">
            <el-form-item label="订单状态" style=" display: flex;">
            <el-form-item label-width="70px" label="订单状态" style=" display: flex;">
              <el-select
                v-model="form.erporderstus"
                filterable
@@ -49,29 +49,29 @@
            <el-form-item label="产品名称" style=" display: flex;">
              <el-input v-model="form.partname" style="width: 200px" placeholder="请输入" />
            </el-form-item>
            <el-form-item label="产品规格" style=" display: flex;">
            <el-form-item v-show="isExpandForm" label-width="70px" 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-form-item v-show="isExpandForm" label="创建人员" style=" display: flex;">
              <el-input v-model="form.creatuser" style="width: 200px" placeholder="请输入" />
            </el-form-item>
            <el-form-item label="预计开工时间" label-width="100px" style=" display: flex;font-size: 14px">
            <el-form-item v-show="isExpandForm" label="预计开工时间" label-width="100px" style="display: flex;font-size: 14px;align-items: center">
              <el-date-picker
                v-model="form.paystartdate"
                type="daterange"
                range-separator="~"
                class="timeMini"
                size="mini"
                style="width: 225px;display: flex"
                style="width: 200px;display: flex;line-height: 34px;height: 34px;"
                :clearable="false"
                start-placeholder="开始日期"
                end-placeholder="结束日期"
              />
              <!--              font-size: 14px!important;-->
              <!--              :picker-options="expireTimeOption"-->
            </el-form-item>
            <el-form-item label="预计完工时间" label-width="100px" style=" display: flex;font-size: 14px">
            <el-form-item v-show="isExpandForm" label="预计完工时间" label-width="100px" style=" display: flex;font-size: 14px;align-items: center">
              <el-date-picker
                v-model="form.payenddate"
                type="daterange"
@@ -79,7 +79,7 @@
                class="timeMini"
                range-separator="~"
                start-placeholder="开始日期"
                style="width: 225px;display: flex"
                style="width: 200px;display: flex;line-height: 34px ;height: 34px ;"
                end-placeholder="结束日期"
                size="mini"
              />
@@ -95,54 +95,47 @@
              <!--              />-->
            </el-form-item>
          </div>
          <div style="min-height: 100px">
            <div style="display: flex;align-items: start;margin-top: 5px;z-index: 2;justify-content: end">
              <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="!isIpad" style="display: flex;align-items: start; margin-top: 15px;z-index: 2">-->
            <!--                        <el-button-->
            <!--                          type="primary"-->
            <!--                          icon="el-icon-refresh-right"-->
            <!--                          @click="reset('update')"-->
            <!--                        >同步ERP-->
            <!--                        </el-button>-->
            <!--                        <el-button-->
            <!--                          type="primary"-->
            <!--                          icon="el-icon-switch-button"-->
            <!--                          @click="orderClose"-->
            <!--                        >关闭订单-->
            <!--                        </el-button>-->
            <!--                      </div>-->
            <!--                      <div v-if="isIpad" style="display: flex;flex-direction: column;align-items: end">-->
            <!--                        <el-button-->
            <!--                          type="primary"-->
            <!--                          icon="el-icon-refresh-right"-->
            <!--                          style="margin: 10px 0"-->
            <!--                          @click="reset('update')"-->
            <!--                        >同步ERP-->
            <!--                        </el-button>-->
            <!--                        <el-button-->
            <!--                          type="primary"-->
            <!--                          icon="el-icon-switch-button"-->
            <!--                          @click="orderClose"-->
            <!--                        >关闭订单-->
            <!--                        </el-button>-->
            <!--                      </div>-->
          <div class="bodySearchReset" :style="{marginLeft:$store.state.app.sidebar.opened?'5%':'10%'}">
            <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>
        </el-form>
        <div
          class="bodyTopFormExpand"
        >
          <svg-icon
            v-show="mouseHoverType==='mouseout'"
            style="cursor: pointer"
            :icon-class="!isExpandForm?'doubleDown3':'doubleUp3'"
            @mouseenter="mouseHoverType=$event.type"
          />
          <svg-icon
            v-show="mouseHoverType==='mouseenter'"
            style="cursor: pointer"
            :icon-class="!isExpandForm?'doubleDown':'doubleUp'"
            @click="isExpandForm=!isExpandForm"
            @mouseout="mouseHoverType=$event.type"
          />
        </div>
      </div>
      <div class="elTableDiv">
        <el-table
          ref="tableDataRef"
          class="tableFixed"
          :data="tableData"
          :height="tableHeight+'px'"
          :height="isExpandForm?tableHeight:(tableHeight+40)+'px'"
          border
          :row-class-name="tableRowClassName"
          :style="{width: 100+'%',height:tableHeight+'px',}"
          :style="{width: 100+'%',height:isExpandForm?tableHeight:(tableHeight+40)+'px',}"
          highlight-current-row
          :header-cell-style="this.$headerCellStyle"
          :cell-style="this.$cellStyle"
          @sort-change="sortChange"
          @row-click="rowClick"
        >
          <!--          <el-table-column-->
          <!--            type="selection"-->
@@ -154,11 +147,11 @@
          >
            <template slot-scope="{row}">
              <el-radio
                v-model="radioSelected"
                :label="row.wo"
                style="color: #fff;padding-left: 10px; margin-right: -25px;"
                @change.native="getCurrentRow(row.wo)"
                v-model="radioSelectedId"
                :label="row.id"
                style="color: transparent;padding-left: 10px;"
              />
              <!--              @change.native="getCurrentRow(row.id)"-->
            </template>
          </el-table-column>
          <el-table-column
@@ -197,13 +190,20 @@
            label="产品名称"
            sortable="custom"
            min-width="150"
            show-tooltip-when-overflow
          />
          <el-table-column
            prop="partspec"
            label="产品规格"
            sortable="custom"
            show-tooltip-when-overflow
            min-width="110"
          />
          >
            <template slot-scope="{row}">
              <div v-if="row.partspec">{{ row.partspec }}</div>
              <div v-else>/</div>
            </template>
          </el-table-column>
          <el-table-column
            prop="qty"
            label="订单数量"
@@ -221,31 +221,56 @@
            label="生产车间"
            sortable="custom"
            width="150"
          />
          >
            <template slot-scope="{row}">
              <div v-if="row.wkshp_name">{{ row.wkshp_name }}</div>
              <div v-else>/</div>
            </template>
          </el-table-column>
          <el-table-column
            prop="planstartdate"
            label="预计开工时间"
            sortable="custom"
            width="160"
          />
            width="130"
          >
            <template slot-scope="{row}">
              <div v-if="row.planstartdate">{{ row.planstartdate.substring(0,11) }}</div>
              <div v-else>/</div>
            </template>
          </el-table-column>
          <el-table-column
            prop="planenddate"
            label="预计完工时间"
            sortable="custom"
            width="160"
          />
            width="130"
          >
            <template slot-scope="{row}">
              <div v-if="row.planenddate">{{ row.planenddate.substring(0,11) }}</div>
              <div v-else>/</div>
            </template>
          </el-table-column>
          <el-table-column
            prop="createuser"
            label="创建人员"
            sortable="custom"
            width="150"
          />
          >
            <template slot-scope="{row}">
              <div v-if="row.createuser">{{ row.createuser }}</div>
              <div v-else>/</div>
            </template>
          </el-table-column>
          <el-table-column
            prop="createdate"
            label="创建时间"
            width="160"
            width="130"
            sortable="custom"
          />
          >
            <template slot-scope="{row}">
              <div v-if="row.createdate">{{ row.createdate.substring(0,11) }}</div>
              <div v-else>/</div>
            </template>
          </el-table-column>
          <el-table-column
            label="操作"
            fixed="right"
@@ -253,7 +278,10 @@
          >
            <template slot-scope="{row}">
              <div class="operationClass">
                <el-button type="text" @click="edit('edit',row)">下达</el-button>
                <el-tooltip class="item" effect="dark" content="下达" placement="top">
                  <!--                <el-button type="text" @click="edit('edit',row)">下达</el-button>-->
                  <i class="el-icon-bottom" style="color:#42b983;cursor: pointer;margin-left: 5px" @click="edit('edit',row)" />
                </el-tooltip>
              </div>
            </template>
          </el-table-column>
@@ -261,12 +289,11 @@
      </div>
      <!--分页-->
      <pagination
        v-show="total>0"
        :total="total"
        :page.sync="form.page"
        :limit.sync="form.rows"
        align="right"
        layout="prev, pager, next,sizes"
        layout="total,prev, pager, next,sizes"
        popper-class="select_bottom"
        @pagination="getErpOrderSearch"
      />
@@ -342,22 +369,16 @@
            style="width: 200px"
          />
        </el-form-item>
        <!--        <el-form-item label="交付时间" prop="">-->
        <!--          <el-date-picker-->
        <!--            v-model="dialogForm.markqty"-->
        <!--            type="date"-->
        <!--            style="width: 200px"-->
        <!--            placeholder="选择日期"-->
        <!--          />-->
        <!--          <el-input v-model="dialogForm.OrgName" style="width: 200px" />-->
        <!--        </el-form-item>-->
      </el-form>
      <span slot="footer" class="dialog-footer">
        <div class="footerButton">
          <el-button @click="dialogVisibleCancel">取 消</el-button>
          <el-button type="primary" @click="dialogVisibleConfirm">下 达</el-button>
          <el-button
            type="primary"
            :loading="$store.state.app.buttonIsDisabled"
            :disabled="$store.state.app.buttonIsDisabled"
            @click="dialogVisibleConfirm"
          >下 达</el-button>
        </div>
      </span>
    </el-dialog>
@@ -389,7 +410,8 @@
      }
    }
    return {
      isIpad: false,
      mouseHoverType: 'mouseout',
      isExpandForm: false,
      mainHeight: 0,
      tableHeight: 0,
      form: {
@@ -415,10 +437,11 @@
        { code: 'CLOSED', name: '已关闭' }
      ],
      total: 10,
      radioSelected: '',
      radioSelectedId: '',
      tableData: [],
      dialogVisible: false,
      dialogForm: {
        erporderid: '',
        partname: '', // 产品名称
        partspec: '', // 产品规格
        // paystartdate: '', // 预计开工时间
@@ -452,6 +475,7 @@
        ]
      }
      // expireTimeOption: {
      //   disabledDate(time) {
      //     return time.getTime() > Date.now() - 8.64e6 // 如果没有后面的-8.64e6就是不可以选择今天的
@@ -561,16 +585,19 @@
      this.getErpOrderSearch()
    },
    // 单选框选中获取当前行信息
    getCurrentRow(wo) {
      this.radioSelected = wo
    getCurrentRow(id) {
      this.radioSelectedId = id
    },
    rowClick(row) {
      this.radioSelectedId = row.id
    },
    // 订单关闭
    async orderClose() {
      if (this.radioSelected.length < 1) {
      if (this.radioSelectedId.length < 1) {
        return this.$message.info('请先选择订单!')
      }
      this.tableData.forEach(item => {
        if (item.wo === this.radioSelected) {
        if (item.id === this.radioSelectedId) {
          if (item.status !== 'NEW') {
            return this.$message.info('此订单非新订单,无法关闭!')
          } else {
@@ -579,11 +606,10 @@
              cancelButtonText: '取消',
              type: 'warning'
            }).then(() => {
              ClosedErpOrder({ erpordercode: this.radioSelected }).then(res => {
              ClosedErpOrder({ erpordercode: item.wo, erporderid: this.radioSelectedId }).then(res => {
                if (res.code === '200') {
                  this.$message.success('订单关闭成功!')
                  this.getErpOrderSearch()
                  // this.radioSelected = ''
                }
              })
            }).catch(() => {
@@ -604,6 +630,7 @@
      this.dialogVisible = true
      this.$nextTick(() => {
        this.dialogForm.erporderid = row.id
        this.dialogForm.erporderstus = row.status
        this.dialogForm.erpordercode = row.wo
        this.dialogForm.partcode = row.partcode
@@ -636,6 +663,7 @@
      this.dialogForm.markqty = ''
      this.dialogForm.ordernum = ''
      this.dialogForm.relse_qty = ''
      this.$refs.dialogForm.clearValidate()
    },
    // 对话框取消
@@ -644,16 +672,23 @@
    },
    // 对话框确认
    dialogVisibleConfirm() {
      this.dialogForm.markqty = parseFloat(this.dialogForm.markqty)
      this.dialogForm.erpqty = parseFloat(this.dialogForm.erpqty)
      this.dialogForm.relse_qty = parseFloat(this.dialogForm.relse_qty)
      this.dialogForm.ordernum = parseFloat(this.dialogForm.ordernum)
      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) {
          this.$store.state.app.buttonIsDisabled = true
          const data = {
            'erporderid': this.dialogForm.erporderid,
            // 'erporderstus': this.dialogForm.erporderstus,
            'erpordercode': this.dialogForm.erpordercode,
            'partcode': this.dialogForm.partcode,
@@ -664,12 +699,12 @@
            'ordernum': this.dialogForm.ordernum,
            'relse_qty': this.dialogForm.relse_qty
          }
          console.log(data)
          MarkSaveErpOrder(data).then(res => {
            if (res.code === '200') {
              this.$message.success('下达成功!')
              this.dialogVisible = false
              this.$message.success('下达成功!')
              this.getErpOrderSearch()
              this.$store.state.app.buttonIsDisabled = false
            } else {
              this.$message.error('下达失败!')
            }
@@ -681,12 +716,9 @@
    getHeight() {
      this.$nextTick(() => {
        this.mainHeight = window.innerHeight - 85
        this.tableHeight = this.mainHeight - 260
        this.isIpad = window.innerHeight < 769 && window.innerWidth < 1367
        this.tableHeight = this.mainHeight - 250
        if (this.isIpad) {
          this.tableHeight = this.tableHeight - 20
        }
        this.$refs.tableDataRef.doLayout()
      })
    },
    tableRowClassName({ row, rowIndex }) {
@@ -699,8 +731,17 @@
<!--公共页面样式-->
<style lang="scss" scoped>
$main_color: #42b983;
::v-deep  .el-range-input{
  //font-size: 14px !important;
}
::v-deep .el-range__icon{
  line-height: 28px !important;
}
::v-deep .el-range-separator{
  line-height: 28px !important;
}
::v-deep .el-range-input{
  font-size: 14px ;
  font-size: 14px;
}
::v-deep .el-range-separator{
  display: flex;
@@ -794,15 +835,32 @@
  margin-bottom: 0;
}
.elTableDiv {
  ::v-deep .el-radio__label {
    display: none;
  }
}
.tableFixed{
  ::v-deep .el-table__fixed-right{
    height: 100% !important;
  }
  ::v-deep .el-table__fixed{
    height: 100% !important;
  }
}
</style>
<style>
.el-table .custom-row {
  background: #f8f8fa;
}
</style>
<style>
.osloading{
  font-size: 40px;
  font-size: 26px !important;
}
.el-loading-text{
  font-size: 26px !important;
}
</style>