chenhj
9 小时以前 cea76991456675d236ad6e42f572f49b00f17c9a
车间订单工艺路线工序新增
已修改2个文件
138 ■■■■ 文件已修改
src/api/plan/manufacturingorder.js 8 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/plan/manufacturingorder/productorder-form.vue 130 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/api/plan/manufacturingorder.js
@@ -293,3 +293,11 @@
    data: ids
  })
}
export function addMoRoutingOperation(data) {
  return request({
    url: '/mes/plan/moRouting/addMoRoutingOperation',
    method: 'post',
    data: data
  })
}
src/views/plan/manufacturingorder/productorder-form.vue
@@ -7,8 +7,11 @@
        <h2 v-if="!editable">查看-车间订单</h2>
      </div>
      <div class="btn-group header-right" v-if="editable">
        <el-button :disabled="isSubmit" v-thinclick="`dataFormSubmit`"
          type="primary">保存</el-button
        <el-button
          :disabled="isSubmit"
          v-thinclick="`dataFormSubmit`"
          type="primary"
          >保存</el-button
        >
      </div>
    </div>
@@ -130,7 +133,11 @@
            </el-col> -->
             <el-col :span="5">
              <el-form-item label="备注" prop="remark">
                <el-tooltip class="item" effect="dark" :content="dataForm.remark">
                <el-tooltip
                  class="item"
                  effect="dark"
                  :content="dataForm.remark"
                >
                <el-input v-model="dataForm.remark" placeholder="">
                </el-input>
                </el-tooltip>
@@ -156,8 +163,15 @@
            </el-col>
            <el-col :span="10">
              <el-form-item label="工艺文件" prop="technologyDocumentName">
                 <el-tooltip class="item" effect="dark" :content="dataForm.technologyDocumentName">
                  <el-input v-model="dataForm.technologyDocumentName" placeholder="">
                <el-tooltip
                  class="item"
                  effect="dark"
                  :content="dataForm.technologyDocumentName"
                >
                  <el-input
                    v-model="dataForm.technologyDocumentName"
                    placeholder=""
                  >
                </el-input>
                </el-tooltip>
              </el-form-item>
@@ -217,7 +231,6 @@
                </el-switch>
              </el-form-item>
            </el-col> -->
        </div>
        <div class="productorder-detail">
          <el-card class="productorder-list">
@@ -268,6 +281,15 @@
                    <el-row>
                      <el-col :span="24" class="productorder-operates-col">
                        <el-card class="productorder-operates" >
                          <div style="display:flex;justify-content:flex-end;">
                            <el-button
                              style="padding: 3px 0;margin-right:10px;"
                              type="text"
                              size="medium"
                              @click="addOrderOperation"
                              >添加
                            </el-button>
                          </div>
                          <!-- <el-row>
                            <el-col :span="2" class="frame1">序号
                            </el-col>
@@ -299,7 +321,9 @@
                            <template slot-scope="scope">
                                <div style="display:flex">
                                    <span style="width:20px;">
                                    <i class="icon aufontAll  h-icon-all-drag"></i
                                    <i
                                      class="icon aufontAll  h-icon-all-drag"
                                    ></i
                                    ></span>
                                    <span>{{ scope.row.operationOrder }}</span>
                                </div>
@@ -338,6 +362,13 @@
                                  size="mini"
                                  @click.stop="openOrderOperation(scope.row)"
                                  >编辑
                                </el-button>
                                <el-button
                                  style="color:#f56c6c;"
                                  type="text"
                                  size="mini"
                                  @click.stop="deleteOrderOperation(scope.row)"
                                  >删除
                                </el-button>
                              </template>
                            </el-table-column>
@@ -1106,7 +1137,6 @@
/deep/ .el-input-number.is-without-controls .el-input__inner {
  text-align: start;
}
</style>
<script>
import {
@@ -1126,6 +1156,7 @@
  delMoBom,
  bomSelectChange,
  changeOrder,
  addMoRoutingOperation
} from '@/api/plan/manufacturingorder'
import { qryMoSamplingRule, delMoSamplingRule } from '@/api/plan/mosamplingrule'
import {
@@ -1233,7 +1264,7 @@
        isReportOperation: false,
        outPutBatchList: [],
        technologyDocumentId: null,
        technologyDocumentName: null,
        technologyDocumentName: null
      },
      currentRow: [],
      currentRouting: {}, // 当前选择的工艺
@@ -1358,8 +1389,7 @@
        }
      }
    },
    components(newVal,oldVal){
    },
    components(newVal, oldVal) {},
    currentRouting(newValue, oldValue) {
      if (newValue && newValue.id) {
        if (this.dataForm.id != null && this.dataForm.id !== 0) {
@@ -1457,7 +1487,11 @@
              .filter((e) => e.operationOrder == oldIndex + 1)
              .forEach((e) => (e.operationOrder = 'x'))
            that.operations
              .filter((e) => e.operationOrder > oldIndex + 1 && e.operationOrder <= newIndex + 1)
              .filter(
                (e) =>
                  e.operationOrder > oldIndex + 1 &&
                  e.operationOrder <= newIndex + 1
              )
              .forEach((e) => (e.operationOrder = e.operationOrder - 1))
            that.operations
              .filter((e) => e.operationOrder == 'x')
@@ -1468,22 +1502,28 @@
              .filter((e) => e.operationOrder == oldIndex + 1)
              .forEach((e) => (e.operationOrder = 'x'))
            that.operations
              .filter((e) => e.operationOrder < oldIndex + 1 && e.operationOrder >= newIndex + 1)
              .filter(
                (e) =>
                  e.operationOrder < oldIndex + 1 &&
                  e.operationOrder >= newIndex + 1
              )
              .forEach((e) => (e.operationOrder = e.operationOrder + 1))
            that.operations
              .filter((e) => e.operationOrder == 'x')
              .forEach((e) => (e.operationOrder = newIndex + 1))
          }
          // 拖拽结束后,保存新的排序
          let data = that.operations.map(el =>{
          const data = that.operations.map((el) => {
            return {
              id:el.id,
              operationOrder:el.operationOrder,
              operationOrder: el.operationOrder
            }
          })
          changeOrder(data).then().catch(error => {
          changeOrder(data)
            .then()
            .catch((error) => {
                console.error(error)
          });
            })
        }
      })
    },
@@ -1492,20 +1532,21 @@
        e.index = i + 1
        e.operationOrder = i+1
      })
      console.log(this.operations,"拖拽结束kk");
      console.log(this.operations, '拖拽结束kk')
      this.dragEndstart()
    },
    dragEndstart(){
        let data = this.operations.map(el =>{
      const data = this.operations.map((el) => {
            return {
              id:el.id,
              operationOrder:el.operationOrder,
          operationOrder: el.operationOrder
            }
        })
        changeOrder(data).then((res) =>{
        }).catch(error => {
      changeOrder(data)
        .then((res) => {})
        .catch((error) => {
            console.error(error)
        });
        })
    },
    getSysParam(paramKey) {
      getSysParam(paramKey).then((response) => {
@@ -1575,7 +1616,7 @@
    },
    // 查询当前车间订单信息
    getOrderInfo() {
      let that=this
      const that = this
      getManufacturingOrder(this.dataForm.id).then((response) => {
        this.dataForm = response.data.data
        // 把工艺挂上去
@@ -1745,7 +1786,7 @@
      this.showRouting = true
    },
    selectRouting(param) {
      console.log(param);
      console.log(param)
      if (param) {
        this.dataForm.partNo = param.partNo
        this.dataForm.partName = param.partName
@@ -1847,7 +1888,7 @@
    // 点击工艺工序行触发校验工艺是否修改,若修改则不可操作,需先保存,若未修改,则可查询出对应的参数集
    operationRowClick(row) {
        //   const row = this.operations[event.oldIndex]
          console.log(row);
      console.log(row)
      if (this.dataForm.id != null && this.dataForm.id !== 0) {
        this.routingOperationId = row.technologyRoutingOperationId
        this.moRoutingOperationId = row.id
@@ -2101,9 +2142,12 @@
    },
    // 保存所有参数的修改
    saveAllParamChange() {
      this.templateParamList.forEach(e=>{
      this.templateParamList.forEach((e) => {
        if(e.paramValue!=null){
          e.paramValue=e.paramValue.replace(',',',').replace('(','(').replace(')',')')
          e.paramValue = e.paramValue
            .replace(',', ',')
            .replace('(', '(')
            .replace(')', ')')
          if (!isNaN(e.paramValue)) {
            e.paramValue='='+e.paramValue
          }
@@ -2217,6 +2261,12 @@
    },
    // 删除当前工序
    deleteOrderOperation(row) {
      this.$confirm('是否确认删除?', '提示', {
        confirmButtonText: '确定',
        cancelButtonText: '取消',
        type: 'warning'
      })
        .then(() => {
      deleteMoRoutingOperation(row.id).then((response) => {
        const resData = response.data
        if (resData.code === 0) {
@@ -2243,7 +2293,6 @@
              // 清空当前工艺工序id、清空routingTemplateId、清空参数集operationTemplateList、清空参数templateParamList
              this.routingOperationId = null
              this.moRoutingOperationId = null
              this.moRoutingOperationName = null
              this.routingTemplateId = null
              this.operationTemplateList = []
              this.templateParamList = []
@@ -2254,6 +2303,8 @@
          this.$message.error('订单工序删除失败')
        }
      })
        })
        .catch(() => {})
    },
    // 弹出基础工序列表
    addOrderOperation() {
@@ -2286,6 +2337,27 @@
    },
    // 新增工序
    addOperation(operation) {
      operation.moId = this.dataForm.id
      operation.moRoutingId = this.dataForm.technologyRoutingId
      operation.operationId = operation.id
      operation.partId = this.dataForm.partId
      operation.loc = null
      operation.operationOrder = this.operations.length + 1
      operation.id = null
      addMoRoutingOperation(operation).then((response) => {
        const data = response.data
        if (data.code === 0) {
          getMoRoutingOption(this.dataForm.id).then((response) => {
            if (response.data.code === 0) {
              this.operations = response.data.data
            } else {
              this.operations = []
            }
          })
        } else {
          this.$message.error('添加失败')
        }
      })
    },
    insertOperation(operation) {},
    structSelectionChange(val) {