loulijun2021
2023-09-22 bca37111d964040198c5ea1cc52739f9745931a5
1.工单实现70%
已添加1个文件
已修改4个文件
788 ■■■■ 文件已修改
src/api/GeneralBasicData.js 8 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/api/WorkOrder.js 18 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/components/DragSelect/index.vue 65 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/router/index.js 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/workOrder/workOrderList.vue 693 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/api/GeneralBasicData.js
@@ -61,3 +61,11 @@
    params: data
  })
}
// å·¥åºåŸºç¡€èµ„æ–™
export function StepData(data) {
  return request({
    url: 'GeneralBasicData/StepData',
    method: 'get',
    params: data
  })
}
src/api/WorkOrder.js
@@ -63,6 +63,15 @@
  })
}
// MES工单删除
export function DeleteMesOrder(data) {
  return request({
    url: 'WorkOrder/DeleteMesOrder',
    method: 'post',
    params: data
  })
}
// ä¿®æ”¹å‰èŽ·å–
export function UpdateMesOrderStepSearch(data) {
  return request({
@@ -72,6 +81,15 @@
  })
}
// å·¥å•派发
export function MesOrderDistribution(data) {
  return request({
    url: 'WorkOrder/MesOrderDistribution',
    method: 'post',
    data
  })
}
// MES工单新增、编辑提交
export function AddUpdateMesOrder(data, OperType) {
  return request({
src/components/DragSelect/index.vue
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,65 @@
<template>
  <el-select ref="dragSelect" v-model="selectVal" v-bind="$attrs" class="drag-select" multiple v-on="$listeners">
    <slot />
  </el-select>
</template>
<script>
import Sortable from 'sortablejs'
export default {
  name: 'DragSelect',
  props: {
    value: {
      type: Array,
      required: true
    }
  },
  computed: {
    selectVal: {
      get() {
        return [...this.value]
      },
      set(val) {
        this.$emit('input', [...val])
      }
    }
  },
  mounted() {
    this.setSort()
  },
  methods: {
    setSort() {
      const el = this.$refs.dragSelect.$el.querySelectorAll('.el-select__tags > span')[0]
      this.sortable = Sortable.create(el, {
        ghostClass: 'sortable-ghost', // Class name for the drop placeholder,
        setData: function(dataTransfer) {
          dataTransfer.setData('Text', '')
          // to avoid Firefox bug
          // Detail see : https://github.com/RubaXa/Sortable/issues/1012
        },
        onEnd: evt => {
          const targetRow = this.value.splice(evt.oldIndex, 1)[0]
          this.value.splice(evt.newIndex, 0, targetRow)
        }
      })
    }
  }
}
</script>
<style lang="scss" scoped>
.drag-select {
  ::v-deep {
    .sortable-ghost {
      opacity: .8;
      color: #fff !important;
      background: #42b983 !important;
    }
    .el-tag {
      cursor: pointer;
    }
  }
}
</style>
src/router/index.js
@@ -340,7 +340,7 @@
      },
      {
        path: 'workOrderList',
        name: 'workOrderListCancel',
        name: 'WorkOrderListCancel',
        code: '0502',
        component: () => import('@/views/workOrder/workOrderList'),
        meta: { code: '0502', title: 'MES工单', icon: '', keepAlive: true }
@@ -459,7 +459,7 @@
      },
      {
        path: 'dataImport',
        name: 'dataImport',
        name: 'DataImport',
        code: '0803',
        component: () => import('@/views/systemSetting/dataImport'),
        meta: { code: '0803', title: '数据导入', icon: '', keepAlive: true }
src/views/workOrder/workOrderList.vue
@@ -5,7 +5,7 @@
      <div class="bodyTopButtonGroup" style="justify-content: space-between">
        <div style="display: flex">
          <el-button v-waves type="primary" icon="el-icon-circle-plus-outline" @click="add('add')">新增</el-button>
          <el-button v-waves type="success" icon="el-icon-connection" @click="send('send')">派发</el-button>
          <el-button v-waves type="success" icon="el-icon-connection" @click="send">派发</el-button>
        </div>
        <el-button v-waves icon="el-icon-switch-button" @click="orderClose">关闭工单</el-button>
@@ -138,24 +138,13 @@
          :cell-style="this.$cellStyle"
          @sort-change="sortChange"
          @row-click="rowClick"
          @selection-change="handleSelectionChange"
        >
          <!--          <el-table-column-->
          <!--            type="selection"-->
          <!--            width="50"-->
          <!--          />-->
          <el-table-column
            type="selection"
            width="50"
            fixed
          >
            <template slot-scope="{row}">
              <el-radio
                v-model="radioSelected"
                :label="row.wo_code"
                style="color: transparent;padding-left: 10px;"
              />
              <!--              @change.native="getCurrentRow(row.wo_code)"-->
            </template>
          </el-table-column>
            :selectable="selected"
          />
          <el-table-column
            prop="rowNum"
            width="50"
@@ -276,7 +265,7 @@
            width="130"
          >
            <template slot-scope="{row}">
              <div v-if="row.saleOrderDeliveryDate">{{ row.saleOrderDeliveryDate.substring(0,11) }}</div>
              <div v-if="row.saleOrderDeliveryDate">{{ row.saleOrderDeliveryDate.substring(0, 11) }}</div>
              <div v-else>/</div>
            </template>
          </el-table-column>
@@ -303,7 +292,11 @@
            <template slot-scope="{row}">
              <div class="operationClass">
                <el-tooltip class="item" effect="dark" content="修改" placement="top">
                  <i class="el-icon-edit-outline" :style="{color:$store.state.settings.theme}" @click="edit(row)" />
                  <i
                    class="el-icon-edit-outline"
                    :style="{color:$store.state.settings.theme}"
                    @click="edit('edit',row)"
                  />
                </el-tooltip>
                <el-tooltip v-del-tab-index class="item" effect="dark" content="删除" placement="top">
@@ -325,7 +318,12 @@
                </el-tooltip>
                <el-tooltip class="item" effect="dark" content="详情" placement="top">
                  <i class="el-icon-view" style="cursor: pointer;" :style="{color:$store.state.settings.theme}" @click="view(row)" />
                  <i
                    class="el-icon-view"
                    style="cursor: pointer;"
                    :style="{color:$store.state.settings.theme}"
                    @click="edit('view',row)"
                  />
                </el-tooltip>
              </div>
@@ -373,22 +371,22 @@
            width="160"
          />
          <el-table-column
            prop="partcode"
            label="产品编码"
            width="150"
            show-tooltip-when-overflow
          />
          <el-table-column
            prop="partname"
            label="产品名称"
            width="200"
            show-tooltip-when-overflow
          />
          <!--          <el-table-column-->
          <!--            prop="partcode"-->
          <!--            label="产品编码"-->
          <!--            width="150"-->
          <!--            show-tooltip-when-overflow-->
          <!--          />-->
          <!--          <el-table-column-->
          <!--            prop="partname"-->
          <!--            label="产品名称"-->
          <!--            width="200"-->
          <!--            show-tooltip-when-overflow-->
          <!--          />-->
          <el-table-column
            label="工序编码"
            prop="stepcode"
            prop="step_code"
            show-tooltip-when-overflow
            width="150"
          />
@@ -399,9 +397,9 @@
            width="150"
          />
          <el-table-column
            label="任务数量"
            label="已生产数量"
            show-tooltip-when-overflow
            prop="plan_qty"
            prop="produceq_qty"
          />
          <el-table-column
            label="合格数量"
@@ -414,33 +412,48 @@
            prop="ng_qty"
          />
          <el-table-column
            label="操作"
            width="120"
            fixed="right"
          >
            <template slot-scope="{row}">
              <div class="operationClass">
                <el-tooltip class="item" effect="dark" content="打印工序" placement="top">
                  <i
                    v-if="tableDataDetail.length!==row.seq"
                    class="el-icon-printer"
                    :style="{color:$store.state.settings.theme}"
                    style="cursor: pointer;margin-right: 15px"
                    @click="supplementSmallClick(row)"
                  />
                </el-tooltip>
                <el-tooltip class="item" effect="dark" content="补打生产入库条码" placement="top">
                  <i
                    v-if="tableDataDetail.length===row.seq"
                    class="  el-icon-camera"
                    :style="{color:$store.state.settings.theme}"
                    style="cursor: pointer;margin-right: 15px"
                    @click="getProductInHouseLabCode(row.wo_code)"
                  />
                </el-tooltip>
              </div>
            </template>
          </el-table-column>
            label="工废数量"
            show-tooltip-when-overflow
            prop="laborbad_qty"
          />
          <el-table-column
            label="料废数量"
            show-tooltip-when-overflow
            prop="materielbad_qty"
          />
          <el-table-column
            label="待产数量"
            show-tooltip-when-overflow
            prop="delive_qty"
          />
          <!--          <el-table-column-->
          <!--            label="操作"-->
          <!--            width="120"-->
          <!--            fixed="right"-->
          <!--          >-->
          <!--            <template slot-scope="{row}">-->
          <!--              <div class="operationClass">-->
          <!--                <el-tooltip class="item" effect="dark" content="打印工序" placement="top">-->
          <!--                  <i-->
          <!--                    v-if="tableDataDetail.length!==row.seq"-->
          <!--                    class="el-icon-printer"-->
          <!--                    :style="{color:$store.state.settings.theme}"-->
          <!--                    style="cursor: pointer;margin-right: 15px"-->
          <!--                    @click="supplementSmallClick(row)"-->
          <!--                  />-->
          <!--                </el-tooltip>-->
          <!--                <el-tooltip class="item" effect="dark" content="补打生产入库条码" placement="top">-->
          <!--                  <i-->
          <!--                    v-if="tableDataDetail.length===row.seq"-->
          <!--                    class="  el-icon-camera"-->
          <!--                    :style="{color:$store.state.settings.theme}"-->
          <!--                    style="cursor: pointer;margin-right: 15px"-->
          <!--                    @click="getProductInHouseLabCode(row.wo_code)"-->
          <!--                  />-->
          <!--                </el-tooltip>-->
          <!--              </div>-->
          <!--            </template>-->
          <!--          </el-table-column>-->
        </el-table>
      </div>
    </div>
@@ -536,13 +549,12 @@
        <el-form-item label="工单数量" prop="mesqty">
          <el-input
            v-model="dialogForm.mesqty"
            oninput="value=value.replace(/[^0-9.]/g,'')"
            :disabled="operation!=='add'"
            oninput="value=value.replace(/[^\d]/g,'')"
            style="width: 200px"
          />
          <!--          oninput="value=value.replace(/[^0-9*.{1}0-9*]/g,'')"-->
        </el-form-item>
        <el-form-item
          v-if="operation==='add'"
          label="产品名称/编码"
          prop="partcode"
        >
@@ -563,15 +575,16 @@
            />
          </el-select>
        </el-form-item>
        <el-form-item v-if="operation!=='add'" label="产品名称" prop="partname">
          <el-input v-model="dialogForm.partname" disabled style="width: 200px" />
        </el-form-item>
        <el-form-item v-if="operation!=='add'" label="产品编码">
          <el-input v-model="dialogForm.partcode" disabled style="width: 200px" />
        </el-form-item>
        <!--        <el-form-item v-if="operation!=='add'" label="产品名称" prop="partname">-->
        <!--          <el-input v-model="dialogForm.partname" disabled style="width: 200px" />-->
        <!--        </el-form-item>-->
        <!--        <el-form-item v-if="operation!=='add'" label="产品编码">-->
        <!--          <el-input v-model="dialogForm.partcode" disabled style="width: 200px" />-->
        <!--        </el-form-item>-->
        <el-form-item label="产品规格" prop="partspec">
          <el-input v-model="dialogForm.partspec" style="width: 200px" />
          <el-input v-model="dialogForm.partspec" disabled style="width: 200px" />
        </el-form-item>
        <!--        :disabled="dialogForm.partcode===''"-->
        <el-form-item label="所属车间" prop="wkshopcode">
          <el-select
            v-model="dialogForm.wkshopcode"
@@ -579,8 +592,6 @@
            :popper-append-to-body="false"
            style="width: 200px;"
            placeholder="请选择车间"
            :disabled="dialogForm.partcode===''"
            @change="val=>wkshopcodeChange(val,dialogForm.partcode)"
          >
            <el-option
              v-for="item in wkshopArr"
@@ -599,13 +610,31 @@
            class="dateMini"
            :picker-options="pickerOptions"
            format="yyyy-MM-dd"
            value-format="yyyy-MM-dd"
            placeholder="选择日期"
          />
          <!--          :disabled="dialogForm.deliverydate"-->
        </el-form-item>
        <el-divider content-position="left">工序信息</el-divider>
        <el-button v-waves type="primary" icon="el-icon-circle-plus-outline" @click="addStep">新增</el-button>
        <div style="display: flex;align-items: center">
          <div style="font-weight: bolder">工序选择:</div>
          <el-drag-select
            v-model="stepSelectedValue"
            style="width:930px;"
            multiple
            placeholder="请选择相对应工序"
            @change="stepSelectedValueChange"
          >
            <el-option
              v-for="item in stepSelectArr"
              :key="item.stepcode"
              :label="item.stepname"
              :value="item.stepcode"
            />
          </el-drag-select>
        </div>
        <el-table
          ref="stepTableDataRef"
@@ -620,7 +649,7 @@
          row-key="stepcode"
        >
          <el-table-column
            prop="seq"
            type="index"
            label="序号"
            width="50"
          />
@@ -635,10 +664,20 @@
            show-tooltip-when-overflow
          />
          <el-table-column
            prop="stepname"
            prop="stepprice"
            label="生产单价"
            show-tooltip-when-overflow
          />
          >
            <template slot-scope="{row}">
              <el-input
                v-model="row.stepprice"
                placeholder="请输入工序单价"
                oninput="value=value.replace(/[^0-9.]/g,'')"
                style="width: 100%"
                @click.stop=""
              />
            </template>
          </el-table-column>
          <el-table-column
            label="操作"
            width="120"
@@ -653,90 +692,32 @@
                />
                <!--                </el-tooltip>-->
                <!--                @click="edit('edit',row)"-->
                <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="margin-left: 15px;"
                    @click="stepDel(row)"
                  />
                </el-tooltip>
              </div>
            </template>
          </el-table-column>
        </el-table>
      </el-form>
      <div style="display: flex;justify-content: flex-end">
        {{ routeStepArr }}
      </div>
      <!--        å·¥è‰ºè·¯çº¿æ”¾å¤§é•œå¯¹è¯æ¡†-->
      <el-dialog
        title="工艺路线"
        :visible.sync="dialogVisibleSearch"
        width="840px"
        top="20vh"
        class="dialogVisibleSearch"
        append-to-body
        :close-on-click-modal="false"
      >
        <el-table
          :data="searchTableData"
          border
          :row-class-name="tableRowClassName"
          height="300"
          style="width: 100%;"
          highlight-current-row
          :header-cell-style="this.$headerCellStyle"
          :cell-style="this.$cellStyle"
        >
          <el-table-column
            prop="seq"
            label="序号"
            width="50"
            fixed
          />
          <el-table-column
            prop="stepcode"
            show-tooltip-when-overflow
            label="工序编码"
          />
          <el-table-column
            prop="stepname"
            label="工序名称"
            show-tooltip-when-overflow
          />
          <el-table-column
            prop="flwtype"
            label="工序类型"
            show-tooltip-when-overflow
          >
            <template slot-scope="{row}">
              <div v-if="row.flwtype==='W'">外协</div>
              <div v-if="row.flwtype==='Z'">自制</div>
            </template>
          </el-table-column>
          <el-table-column
            prop="descr"
            label="工序描述"
            show-tooltip-when-overflow
            fixed="right"
          />
        </el-table>
      </el-dialog>
      <span slot="footer" class="dialog-footer">
        <div class="footerButton">
          <el-button v-waves @click="dialogVisibleCancel">取 æ¶ˆ</el-button>
          <!--          <el-button v-waves v-if="operation==='add'" type="primary" @click="dialogVisibleConfirmPreview('add')">预览</el-button>-->
          <el-button
            v-if="!submitButtonIsDisabled"
            v-if="operation!=='view'"
            v-waves
            type="primary"
            :loading="$store.state.app.buttonIsDisabled"
            :disabled="$store.state.app.buttonIsDisabled"
            @click="dialogVisibleConfirm"
          >ç¡® å®š</el-button>
          <el-button
            v-if="submitButtonIsDisabled"
            v-waves
            type="primary"
            disabled
            @click="dialogVisibleConfirm"
          >ç¡® å®š</el-button>
        </div>
@@ -1931,15 +1912,22 @@
import $ from 'jquery'
import elDragDialog from '@/directive/el-drag-dialog'
import waves from '@/directive/waves'
import { AddMesOrderCodeSearch, MesBadOrderSearch, MesOrderSearch } from '@/api/WorkOrder'
import {
  AddMesOrderCodeSearch,
  AddUpdateMesOrder, DeleteMesOrder,
  MesBadOrderSearch, MesOrderDistribution,
  MesOrderSearch,
  UpdateMesOrderStepSearch
} from '@/api/WorkOrder'
import { PartSelect } from '@/api/ProductModel'
import { PrentOrganization } from '@/api/GeneralBasicData'
import { PrentOrganization, StepData } from '@/api/GeneralBasicData'
import Sortable from 'sortablejs'
import ElDragSelect from '@/components/DragSelect' // base on element-ui
export default {
  name: 'GD',
  name: 'WorkOrderList',
  components: {
    Pagination
    Pagination, ElDragSelect
  },
  directives: { elDragDialog, waves },
  data() {
@@ -1978,7 +1966,6 @@
        { code: 'SCHED', name: '已排程' }
      ],
      total: 10,
      radioSelected: '',
      tableData: [],
      dialogVisible: false,
      dialogForm: {
@@ -1997,11 +1984,8 @@
        wkshopname: '', // ç”Ÿäº§è½¦é—´åç§°
        deliverydate: '', // äº¤ä»˜æ—¶é—´
        data_sources: '', // æ•°æ®æ¥æº
        OperType: '' // æ“ä½œç±»åž‹
        data_sources: '' // æ•°æ®æ¥æº
      },
      bomIdArr: [], // ç‰©æ–™æ¸…单下拉
      ordertypeArr: [// å·¥å•类型
        { code: 'PO', name: '标准工单' },
        { code: 'FO', name: '报废补单' }
@@ -2125,8 +2109,9 @@
      dialogVisibleSource: false,
      sourceTableData: [],
      sourceForm: {
        mesordercode: '', // è®¢å•状态码
        sourceorder: '', // å·¥å•编号
        mesordercode: '', // å·¥å•编号
        sourceorder: '', // è®¢å•编号
        saleordercode: '', // é”€å”®è®¢å•号
        partcode: '', // äº§å“ç¼–码
        partname: '', // äº§å“åç§°
        partspec: '', // äº§å“è§„æ ¼
@@ -2169,7 +2154,6 @@
          return time.getTime() < Date.now() - 8.64e7
        }
      },
      submitButtonIsDisabled: false,
      isLastPrint: false, // æ˜¯å¦æ˜¯æœ«é“打印
      lastPrintArr: [], // æœ«é“打印的数组(所有)
@@ -2179,15 +2163,33 @@
      routeStepArr: '',
      stepTableData: [
        { stepcode: '001' },
        { stepcode: '002' },
        { stepcode: '003' },
        { stepcode: '004' },
        { stepcode: '005' }
      ],
      sortable: null
      stepTableData: [],
      sortable: null,
      stepSelectArr: [], // å·¥åºä¸‹æ‹‰æ•°æ®
      stepSelectedValue: [], // ä¸‹æ‹‰é€‰ä¸­å€¼
      multipleSelection: []
    }
  },
  watch: {
    'stepSelectedValue': {
      // deep: true,
      handler: function(val) {
        // do something with the new and old value of stepSelectedValue
        console.log(val, 1)
        const arr = JSON.parse(JSON.stringify(this.stepTableData))
        const arrStepcode = arr.map(i => i.stepcode)
        this.stepTableData = []
        val.forEach(i => {
          this.stepTableData.push(
            {
              stepcode: i,
              stepname: this.stepSelectArr.find(j => j.stepcode === i).stepname,
              stepprice: arrStepcode.includes(i) ? arr.find(j => j.stepcode === i).stepprice : 0
            }
          )
        })
      }
    }
  },
  created() {
@@ -2215,6 +2217,7 @@
          const targetRow = this.stepTableData.splice(evt.oldIndex, 1)[0]
          this.stepTableData.splice(evt.newIndex, 0, targetRow)
          this.stepSelectedValue = this.stepTableData.map(i => i.stepcode)
          // for show the changes, you can delete in you code
          // const tempIndex = this.newList.splice(evt.oldIndex, 1)[0]
          // this.newList.splice(evt.newIndex, 0, tempIndex)
@@ -2268,6 +2271,10 @@
      // èŽ·å–ç»„ç»‡
      const { data: res2 } = await PrentOrganization()
      this.wkshopArr = res2
      // èŽ·å–å·¥åº
      const { data: res3 } = await StepData()
      this.stepSelectArr = res3
    },
    // è®¢å•状态改变时
    erporderstusChange(val) {
@@ -2317,117 +2324,17 @@
      this.form.createdate = ''
      this.getMesOrderSearch()
    },
    // å•选框选中获取当前行信息
    getCurrentRow(wo_code) {
      this.radioSelected = wo_code
    },
    // æ–°å¢žæŒ‰é’®
    async add(operation) {
      const { data: res } = await AddMesOrderCodeSearch()
      this.dialogForm.mesordercode = res
      this.operation = operation
      this.dialogVisible = true
      this.dialogForm.planstartdate = handleDatetime(new Date())
      this.dialogForm.planenddate = handleDatetime(new Date())
      this.dialogForm.orderlev = 3
      this.dialogForm.data_sources = 'MES'
      this.$nextTick(() => {
        this.setSort()
      })
    },
    // äº§å“ä¿¡æ¯å€¼æ”¹å˜
    async partcodeChange(val) {
      const { data: res } = await RouteSelectWkshop({ partcode: val })
      this.wkshopArr = res
      // this.dialogForm.wkshopcode=res.length === 1?res[0].org_code:''
      if (res.length === 1) {
        this.dialogForm.wkshopcode = res[0].org_code
        await this.wkshopcodeChange(res[0].org_code, val)
      } else {
        this.dialogForm.wkshopcode = ''
      }
      // this.routeArr = res
      // let flag = false
      // this.routeArr.forEach(item => {
      //   if (item.code === item.default_route) {
      //     this.dialogForm.routecode = item.code
      //     // this.routecodeChange(this.dialogForm.routecode)
      //     this.wkshopcodeChange(this.dialogForm.routecode)
      //     flag = true
      //   }
      // })
      // if (!flag) {
      //   this.dialogForm.routecode = ''
      // }
      //
      // this.dialogForm.wkshopcode = ''
      //
      // this.submitButtonIsDisabled = false
    },
    // å·¥è‰ºè·¯çº¿å€¼æ”¹å˜
    async routecodeChange() {
      const data = {
        partcode: this.dialogForm.partcode,
        routecode: this.dialogForm.routecode,
        wkshopcode: this.dialogForm.wkshopcode
      }
      await SelectRouteOrWkshop(data).then((res) => {
        console.log(res, 1)
        SelectRouteStep({ routecode: this.dialogForm.routecode }).then(res2 => {
          console.log(res2)
          this.routeStepArr = res2.data.map(i => i.stepname).join(',')
        })
        this.submitButtonIsDisabled = false
      }).catch(err => {
        // console.log(err, 2)
        this.submitButtonIsDisabled = true
      })
    },
    // ç”Ÿäº§è½¦é—´å€¼æ”¹å˜æ—¶
    async  wkshopcodeChange(wkshopcode, partcode) {
      const data = {
        partcode,
        wkshopcode
      }
      const { data: res } = await PartSelectRoute(data)
      this.routeArr = res
      if (res.length === 1) {
        this.dialogForm.routecode = res[0].code
        await this.routecodeChange()
      } else {
        this.dialogForm.routecode = ''
      }
      // const data = {
      //   partcode: this.dialogForm.partcode,
      //   routecode: this.dialogForm.routecode,
      //   wkshopcode: val
      // }
      // SelectRouteOrWkshop(data).then((res) => {
      //
      // }).catch(err => {
      //   this.submitButtonIsDisabled = true
      // })
    },
    // æ˜¯å¦æŽ’程值改变时
    changeIsAps(val) {
      if (val === 'N') {
        this.dialogForm.bomId = ''
      }
      if (val === 'Y') {
        JobCreationSonAddVison({ partnumber: this.dialogForm.partcode }).then(res => {
          this.bomIdArr = res.data
          this.dialogForm.bomId = this.bomIdArr[0].id
        })
      }
    },
    // å·¥åºä»»åŠ¡
    async check(row) {
@@ -2443,35 +2350,36 @@
    dialogVisibleBack() {
      this.dialogVisibleTask = false
    },
    handleSelectionChange(val) {
      this.multipleSelection = val.map(i => i.wo_code)
    },
    selected(row, index) {
    // && row.isstep === 'Y'
      if (row.status === 'NEW') {
        return true
      } else {
        return false
      }
    },
    // æ´¾å‘
    send(operation) {
      if (this.radioSelected.length < 1) {
        return this.$message.info('请先选择工单!')
      }
      const row = this.tableData.find(item => item.wo_code === this.radioSelected)
      if (row.status !== 'NEW') {
        return this.$message.info('此工单为非新工单状态,不可派发!')
      }
      this.operation = operation
      this.dialogVisible = true
      this.$nextTick(() => {
        this.dialogForm.mesorderstus = row.status
        this.dialogForm.mesordercode = row.wo_code
        this.dialogForm.partcode = row.partcode
        this.partcodeChange(row.partcode)
        this.dialogForm.partname = row.partname
        this.dialogForm.mesqty = row.plan_qty
        this.dialogForm.partspec = row.partspec
        this.dialogForm.sourceorder = row.m_po
        this.dialogForm.ordertype = row.wotype
        // this.routecodeChange(this.dialogForm.routecode)
        this.dialogForm.planstartdate = row.plan_startdate !== null ? row.plan_startdate : handleDatetime(new Date())
        this.dialogForm.planenddate = row.plan_enddate !== null ? row.plan_enddate : handleDatetime(new Date())
        this.dialogForm.orderlev = row.piroque !== null ? row.piroque : 3 // ç­‰çº§
    send() {
      this.$confirm('是否确认派发?', '提示', {
        confirmButtonText: '确定',
        cancelButtonText: '取消',
        type: 'warning'
      }).then(() => {
        MesOrderDistribution(this.multipleSelection).then(res => {
          if (res.code === '200') {
            this.$notify.success('派发成功!')
            if (this.form.page > 1 && this.tableData.length === 1) {
              this.form.page--
            }
            this.getMesOrderSearch()
          }
        })
      }).catch(() => {
        this.$notify.info('已取消派发')
      })
    },
    // åˆ é™¤æŒ‰é’®
@@ -2484,7 +2392,6 @@
        cancelButtonText: '取消',
        type: 'warning'
      }).then(() => {
        console.log(row, 1)
        const data = {
          souceid: row.sourceid ? row.sourceid : '',
          wocode: row.wo_code,
@@ -2493,7 +2400,7 @@
        }
        DeleteMesOrder(data).then(res => {
          if (res.code === '200') {
            this.$message.success('删除成功!')
            this.$notify.success('删除成功!')
            if (this.form.page > 1 && this.tableData.length === 1) {
              this.form.page--
            }
@@ -2501,49 +2408,50 @@
          }
        })
      }).catch(() => {
        this.$message.info('已取消删除')
        this.$notify.info('已取消删除')
      })
    },
    // ä¿®æ”¹æŒ‰é’®
    edit() {
    async edit(operation, row) {
      this.operation = operation
      this.dialogForm.data_sources = row.data_sources
      this.dialogForm.mesorderstus = row.status
      this.dialogForm.mesordercode = row.wo_code
      this.dialogForm.ordertype = row.wotype
      this.dialogForm.sourceorderid = row.sourceid
      this.dialogForm.sourceorder = row.m_po
      this.dialogForm.partcode = row.partcode
      this.dialogForm.partname = row.partname
      this.dialogForm.partspec = row.partspec
      this.dialogForm.wkshopcode = row.wkshp_code
      this.dialogForm.deliverydate = row.saleOrderDeliveryDate.substring(0, 11)
      const data = {
        sourceid: this.dialogForm.sourceorderid,
        sourcewo: this.dialogForm.sourceorder,
        wocode: this.dialogForm.mesordercode,
        data_sources: this.dialogForm.data_sources
      }
      const { data: res } = await UpdateMesOrderStepSearch(data)
      this.dialogForm.mesqty = res.canupdate_qty
      res.stepdata.forEach(i => {
        this.stepTableData.push(
          {
            stepcode: i.step_code,
            stepname: i.stepname,
            stepprice: i.stepprice
          }
        )
      })
      this.stepSelectedValue = this.stepTableData.map(i => i.stepcode)
      this.dialogVisible = true
    },
    // å·¥å•关闭事件
    orderClose() {
      if (this.radioSelected.length < 1) {
        return this.$message.info('请先选择工单!')
      }
      console.log('工单关闭事件')
      this.tableData.forEach(item => {
        if (item.wo_code === this.radioSelected) {
          if (item.status === 'START') {
            return this.$message.info('当前工单未完工,无法关闭!')
          } else if (item.status === 'CLOSED') {
            return this.$message.info('工单已关闭,无需再关闭!')
          } else {
            this.$confirm('是否确认关闭工单?', '提示', {
              confirmButtonText: '确定',
              cancelButtonText: '取消',
              type: 'warning'
            }).then(() => {
              const data = {
                wocode: item.wo_code,
                m_po: item.m_po
              }
              ClosedMesOrder(data).then(res => {
                if (res.code === '200') {
                  this.$message.success('工单关闭成功!')
                  this.getMesOrderSearch()
                  // this.radioSelected = ''
                }
              })
            }).catch(() => {
              this.$message.info('已取消关闭!')
            })
          }
        }
      })
    },
    // å¯¹è¯æ¡†äº§å“ä¿¡æ¯å€¼æ”¹å˜
    partcodeChangeDialog(val) {
@@ -2551,36 +2459,30 @@
      this.dialogForm.partname = this.partArr.find(item => item.partcode === val).partname
      this.dialogForm.partcode = this.partArr.find(item => item.partcode === val).partcode
      this.dialogForm.partspec = this.partArr.find(item => item.partcode === val).partspec
      // this.partcodeChange(val)
    },
    // å¯¹è¯æ¡†å…³é—­äº‹ä»¶
    handleClose() {
      this.routeStepArr = ''
      this.dialogForm.partname = '' // äº§å“åç§°
      this.dialogForm.partspec = '' // äº§å“è§„æ ¼
      this.dialogForm.wkshopname = '' // ç”Ÿäº§è½¦é—´åç§°
      this.dialogForm.routename = '' // å·¥è‰ºè·¯çº¿åç§°
      this.dialogForm = {
        mesorderstus: 'NEW', // å·¥å•状态码
        mesordercode: '', // å·¥å•编号
        ordertype: 'PO', // å·¥å•类型
        sourceorderid: '', // æºå•id
        sourceorder: '', // æºå•单号
      this.dialogForm.mesorderstus = 'NEW' // å·¥å•状态码
      this.dialogForm.mesordercode = '' // å·¥å•编号
      this.dialogForm.partcode = '' // äº§å“ç¼–码
      this.dialogForm.mesqty = '' // å·¥å•数量
        partcode: '', // äº§å“ç¼–码
        partname: '', // äº§å“åç§°
        partspec: '', // äº§å“è§„æ ¼
      this.dialogForm.ordertype = 'PO' // å·¥å•类型
      this.dialogForm.sourceorder = '' // æºå•单号
        mesqty: '', // å·¥å•数量
        wkshopcode: '', // ç”Ÿäº§è½¦é—´ç¼–码
        wkshopname: '', // ç”Ÿäº§è½¦é—´åç§°
      this.dialogForm.routecode = '' // å·¥è‰ºè·¯çº¿ç¼–码
      this.dialogForm.wkshopcode = '' // ç”Ÿäº§è½¦é—´ç¼–码
      this.dialogForm.planstartdate = '' // è®¡åˆ’开始时间
      this.dialogForm.planenddate = '' // è®¡åˆ’完成时间
      this.dialogForm.orderlev = '' // å·¥å•等级
      this.dialogForm.isAps = 'N' // æ˜¯å¦æŽ’程
      this.dialogForm.bomId = ''
      this.bomIdArr = []
        deliverydate: '', // äº¤ä»˜æ—¶é—´
        data_sources: '' // æ•°æ®æ¥æº
      }
      this.stepSelectedValue = []
      this.stepTableData = []
      this.$refs.dialogForm.clearValidate()
      this.submitButtonIsDisabled = false
    },
    // å¯¹è¯æ¡†å–消
    dialogVisibleCancel() {
@@ -2594,36 +2496,40 @@
            return this.$message.info('源单单号不能为空!')
          }
          const data = {
            // partname: this.dialogForm.partname, // äº§å“åç§°
            // partspec: this.dialogForm.partspec, // äº§å“è§„æ ¼
            // wkshopname: this.dialogForm.wkshopname, // ç”Ÿäº§è½¦é—´åç§°
            // routename: this.dialogForm.routename, // å·¥è‰ºè·¯çº¿åç§°
          const workListSub = []
          this.stepTableData.forEach((i, j) => {
            workListSub.push(
              {
                stepseq: j + 1,
                stepcode: i.stepcode,
                stepprice: i.stepprice,
                isbott: j === 0 ? 'Y' : 'N',
                isend: j === this.stepTableData.length - 1 ? 'Y' : 'N'
              }
            )
          })
            mesorderstus: this.dialogForm.mesorderstus, // å·¥å•状态码
            mesordercode: this.dialogForm.mesordercode, // å·¥å•编号
            partcode: this.dialogForm.partcode, // äº§å“ç¼–码
            mesqty: this.dialogForm.mesqty, // å·¥å•数量
            ordertype: this.dialogForm.ordertype, // å•据类型
            sourceorder: this.dialogForm.sourceorder, // æºå•单号
            routecode: this.dialogForm.routecode, // å·¥è‰ºè·¯çº¿ç¼–码
            wkshopcode: this.dialogForm.wkshopcode, // ç”Ÿäº§è½¦é—´ç¼–码
            planstartdate: this.dialogForm.planstartdate, // è®¡åˆ’开始时间
            planenddate: this.dialogForm.planenddate, // è®¡åˆ’完成时间
            orderlev: this.dialogForm.orderlev, // å·¥å•等级
            is_aps: this.dialogForm.isAps, // æ˜¯å¦æŽ’程
            bom_id: this.dialogForm.bomId, // ç‰©æ–™æ¸…单id
            OperType: this.operation === 'add' ? 'Add' : 'Update'
          const data = {
            wostatus: this.dialogForm.mesorderstus, // å·¥å•状态
            wocode: this.dialogForm.mesordercode, // å·¥å•号
            wotype: this.dialogForm.ordertype, // å·¥å•类型
            sourceid: this.dialogForm.sourceorderid, // æºå•id
            sourcewo: this.dialogForm.sourceorder, // æºå•单号
            partcode: this.dialogForm.partcode, // äº§å“ç¼–号
            wkshopcode: this.dialogForm.wkshopcode,
            woqty: this.dialogForm.mesqty, // å·¥å•数量
            deliverydate: this.dialogForm.deliverydate, // äº¤ä»˜æ—¶é—´
            data_sources: this.dialogForm.data_sources, // æ•°æ®æ¥æº
            isstep: workListSub.length > 0 ? 'Y' : 'N', //
            workListSub
          }
          this.$store.state.app.buttonIsDisabled = true
          AddUpdateMesOrder(data).then(res => {
          AddUpdateMesOrder(data, this.operation === 'add' ? 'Add' : 'Update').then(res => {
            if (res.code === '200') {
              this.dialogVisible = false
              this.handlePrint()
              // this.handlePrint()
              this.$message.success(this.operation === 'add' ? '添加成功!' : '派发成功!')
              // this.dialogVisible = false
              this.getMesOrderSearch()
              this.$store.state.app.buttonIsDisabled = false
            } else {
@@ -2899,8 +2805,9 @@
      }
      const data = {
        mesordercode: this.sourceForm.mesordercode, // è®¢å•状态码
        sourceorder: this.sourceForm.sourceorder, // å·¥å•编号
        mesordercode: this.sourceForm.mesordercode, // å·¥å•编号
        sourceorder: this.sourceForm.sourceorder, // è®¢å•订单号
        saleordercode: this.sourceForm.sourceorder, // è®¢å•订单号
        partcode: this.sourceForm.partcode, // äº§å“ç¼–码
        partname: this.sourceForm.partname, // äº§å“åç§°
        partspec: this.sourceForm.partspec, // äº§å“è§„æ ¼
@@ -2973,7 +2880,6 @@
        }
      })
      this.dialogVisibleSource = false
      this.partcodeChange(this.dialogForm.partcode)
    },
    mesordertypeChange(val) {
      if (val === 'PO') {
@@ -3069,9 +2975,20 @@
    },
    //  è¡Œç‚¹å‡»äº‹ä»¶
    async rowClick(row, event, column) {
      this.radioSelected = row.wo_code ? row.wo_code : this.radioSelected
      const { data: res } = await SearchWorkStep({ wo_code: this.radioSelected, storg_code: this.$store.state.settings.orgType === 'W' ? (this.switchButton ? '' : getCookie('stu_torgcode')) : '' })
      this.tableDataDetail = res
      const data = {
        sourceid: row.sourceid,
        sourcewo: row.m_po,
        wocode: row.wo_code,
        data_sources: row.data_sources
      }
      const { data: res } = await UpdateMesOrderStepSearch(data)
      this.tableDataDetail = res.stepdata
    },
    // å·¥åºåˆ é™¤
    stepDel(row) {
      console.log(row)
      const index = this.stepSelectedValue.findIndex(i => i === row.stepcode)
      this.stepSelectedValue.splice(index, 1)
    },
    // æ‰“印工单
    printOrder() {
@@ -3120,17 +3037,17 @@
        this.$forceUpdate()
      }, 500)
    },
    addStep() {
    stepSelectedValueChange(val) {
      // console.log(val, 123)
    }
  }
}
</script>
<style>
.sortable-ghost{
.sortable-ghost {
  opacity: .8;
  color: #fff!important;
  background: #42b983!important;
  color: #fff !important;
  background: #42b983 !important;
}
</style>
<style lang="scss" scoped>