厂务订单里改个工单接口
This commit is contained in:
		@@ -5,13 +5,10 @@
 | 
			
		||||
        <el-form-item label="工单名称" prop="name" v-if='!isBind'>
 | 
			
		||||
          <el-input v-model="form.name"></el-input>
 | 
			
		||||
        </el-form-item>
 | 
			
		||||
        <el-form-item label="工单名称" prop="workOrderId"  v-if='isBind'>
 | 
			
		||||
          <el-select v-model="form.workOrderId" placeholder="请选择" style="width: 100%;" filterable @change="getWorkOrderMsg">
 | 
			
		||||
            <el-option
 | 
			
		||||
              v-for="item in workOrderList"
 | 
			
		||||
              :key="item.id"
 | 
			
		||||
              :label="item.name"
 | 
			
		||||
              :value="item.id">
 | 
			
		||||
        <el-form-item label="工单名称" prop="workOrderId" v-if='isBind'>
 | 
			
		||||
          <el-select v-model="form.workOrderId" placeholder="请选择" style="width: 100%;" filterable
 | 
			
		||||
            @change="getWorkOrderMsg">
 | 
			
		||||
            <el-option v-for="item in workOrderList" :key="item.id" :label="item.name" :value="item.id">
 | 
			
		||||
            </el-option>
 | 
			
		||||
          </el-select>
 | 
			
		||||
        </el-form-item>
 | 
			
		||||
@@ -23,12 +20,8 @@
 | 
			
		||||
      </el-col>
 | 
			
		||||
      <el-col :span='6'>
 | 
			
		||||
        <el-form-item label="产品名称" prop="planProductId">
 | 
			
		||||
          <el-select v-model="form.planProductId" placeholder="请选择" disabled  style="width: 100%;">
 | 
			
		||||
            <el-option
 | 
			
		||||
              v-for="item in productList"
 | 
			
		||||
              :key="item.id"
 | 
			
		||||
              :label="item.name"
 | 
			
		||||
              :value="item.id">
 | 
			
		||||
          <el-select v-model="form.planProductId" placeholder="请选择" disabled style="width: 100%;">
 | 
			
		||||
            <el-option v-for="item in productList" :key="item.id" :label="item.name" :value="item.id">
 | 
			
		||||
            </el-option>
 | 
			
		||||
          </el-select>
 | 
			
		||||
        </el-form-item>
 | 
			
		||||
@@ -42,36 +35,28 @@
 | 
			
		||||
    <el-row :gutter="20">
 | 
			
		||||
      <el-col :span='6'>
 | 
			
		||||
        <el-form-item label="计划开始时间">
 | 
			
		||||
          <el-date-picker
 | 
			
		||||
            v-model="planStartTime"
 | 
			
		||||
            type="datetime"
 | 
			
		||||
            value-format="yyyy-MM-dd HH:mm:ss"
 | 
			
		||||
            style="width: 100%;"
 | 
			
		||||
            placeholder="选择日期"
 | 
			
		||||
            :disabled="isBind">
 | 
			
		||||
          <el-date-picker v-model="planStartTime" type="datetime" value-format="yyyy-MM-dd HH:mm:ss"
 | 
			
		||||
            style="width: 100%;" placeholder="选择日期" :disabled="isBind">
 | 
			
		||||
          </el-date-picker>
 | 
			
		||||
        </el-form-item>
 | 
			
		||||
      </el-col>
 | 
			
		||||
      <el-col :span='6'>
 | 
			
		||||
        <el-form-item label="计划完成时间">
 | 
			
		||||
          <el-date-picker
 | 
			
		||||
            v-model="planFinishTime"
 | 
			
		||||
            type="datetime"
 | 
			
		||||
            value-format="yyyy-MM-dd HH:mm:ss"
 | 
			
		||||
            style="width: 100%;"
 | 
			
		||||
            placeholder="选择日期"
 | 
			
		||||
            :disabled="isBind">
 | 
			
		||||
          <el-date-picker v-model="planFinishTime" type="datetime" value-format="yyyy-MM-dd HH:mm:ss"
 | 
			
		||||
            style="width: 100%;" placeholder="选择日期" :disabled="isBind">
 | 
			
		||||
          </el-date-picker>
 | 
			
		||||
        </el-form-item>
 | 
			
		||||
      </el-col>
 | 
			
		||||
      <el-col :span='6'>
 | 
			
		||||
        <el-form-item label="计划投入数量" prop="planAssignQuantity">
 | 
			
		||||
          <el-input-number v-model="form.planAssignQuantity" :min="0" :max="9999999999999" :disabled="isBind" style="width: 100%;"></el-input-number>
 | 
			
		||||
          <el-input-number v-model="form.planAssignQuantity" :min="0" :max="9999999999999" :disabled="isBind"
 | 
			
		||||
            style="width: 100%;"></el-input-number>
 | 
			
		||||
        </el-form-item>
 | 
			
		||||
      </el-col>
 | 
			
		||||
      <el-col :span='6'>
 | 
			
		||||
        <el-form-item label="计划生产数量" prop="planQuantity">
 | 
			
		||||
          <el-input-number v-model="form.planQuantity" :min="0" :max="9999999999999" :disabled="isBind" style="width: 100%;"></el-input-number>
 | 
			
		||||
          <el-input-number v-model="form.planQuantity" :min="0" :max="9999999999999" :disabled="isBind"
 | 
			
		||||
            style="width: 100%;"></el-input-number>
 | 
			
		||||
        </el-form-item>
 | 
			
		||||
      </el-col>
 | 
			
		||||
    </el-row>
 | 
			
		||||
@@ -79,18 +64,15 @@
 | 
			
		||||
      <el-col :span='6'>
 | 
			
		||||
        <el-form-item label="关联工艺" prop="processFlowId">
 | 
			
		||||
          <el-select v-model="form.processFlowId" placeholder="请选择" :disabled="isBind" style="width: 100%;">
 | 
			
		||||
            <el-option
 | 
			
		||||
              v-for="item in processFlowList"
 | 
			
		||||
              :key="item.id"
 | 
			
		||||
              :label="item.name"
 | 
			
		||||
              :value="item.id">
 | 
			
		||||
            <el-option v-for="item in processFlowList" :key="item.id" :label="item.name" :value="item.id">
 | 
			
		||||
            </el-option>
 | 
			
		||||
          </el-select>
 | 
			
		||||
        </el-form-item>
 | 
			
		||||
      </el-col>
 | 
			
		||||
      <el-col :span='6'>
 | 
			
		||||
        <el-form-item label="物料计算方式" prop="materialMethod">
 | 
			
		||||
          <el-select v-model="form.materialMethod" placeholder="请选择" style="width: 100%;" :disabled="isBind" @change='selectMethod'>
 | 
			
		||||
          <el-select v-model="form.materialMethod" placeholder="请选择" style="width: 100%;" :disabled="isBind"
 | 
			
		||||
            @change='selectMethod'>
 | 
			
		||||
            <el-option label="产品基础BOM" :value="1"></el-option>
 | 
			
		||||
            <el-option label="工艺扩展BOM" :value="2"></el-option>
 | 
			
		||||
          </el-select>
 | 
			
		||||
@@ -99,10 +81,7 @@
 | 
			
		||||
      <el-col :span='6'>
 | 
			
		||||
        <el-form-item label="优先级" prop="priority">
 | 
			
		||||
          <el-select v-model="form.priority" placeholder="请选择" style="width: 100%;" :disabled="isBind">
 | 
			
		||||
            <el-option
 | 
			
		||||
              v-for="item in getDictDatas(DICT_TYPE.ORDER_PRIORITY)"
 | 
			
		||||
              :key="item.value"
 | 
			
		||||
              :label="item.label"
 | 
			
		||||
            <el-option v-for="item in getDictDatas(DICT_TYPE.ORDER_PRIORITY)" :key="item.value" :label="item.label"
 | 
			
		||||
              :value="item.value">
 | 
			
		||||
            </el-option>
 | 
			
		||||
          </el-select>
 | 
			
		||||
@@ -111,11 +90,7 @@
 | 
			
		||||
      <el-col :span='6'>
 | 
			
		||||
        <el-form-item label="工单类型" prop="type">
 | 
			
		||||
          <el-select v-model="form.type" placeholder="请选择" style="width: 100%;" :disabled="isBind">
 | 
			
		||||
            <el-option
 | 
			
		||||
              v-for="item in workOrderTypeList"
 | 
			
		||||
              :key="item.id"
 | 
			
		||||
              :label="item.name"
 | 
			
		||||
              :value="item.id">
 | 
			
		||||
            <el-option v-for="item in workOrderTypeList" :key="item.id" :label="item.name" :value="item.id">
 | 
			
		||||
            </el-option>
 | 
			
		||||
          </el-select>
 | 
			
		||||
        </el-form-item>
 | 
			
		||||
@@ -123,45 +98,39 @@
 | 
			
		||||
    </el-row>
 | 
			
		||||
    <el-row :gutter="20">
 | 
			
		||||
      <el-col :span='6'>
 | 
			
		||||
      <el-form-item label="关联产线" prop="productLineId">
 | 
			
		||||
        <el-select v-model="form.productLineId" placeholder="请选择" multiple style="width: 100%;" :disabled="isBind">
 | 
			
		||||
          <el-option
 | 
			
		||||
            v-for="item in productLineList"
 | 
			
		||||
            :key="item.id"
 | 
			
		||||
            :label="item.name"
 | 
			
		||||
            :value="item.id">
 | 
			
		||||
          </el-option>
 | 
			
		||||
        </el-select>
 | 
			
		||||
      </el-form-item>
 | 
			
		||||
    </el-col>
 | 
			
		||||
  <el-col :span='6'>
 | 
			
		||||
      <el-form-item label="负责车间" prop="roomNameDict">
 | 
			
		||||
        <el-select v-model="form.roomNameDict" placeholder="请选择" style="width: 100%;" :disabled="isBind">
 | 
			
		||||
          <el-option
 | 
			
		||||
            v-for="item in getDictDatas(DICT_TYPE.WORK_SHOP)"
 | 
			
		||||
            :key="item.value"
 | 
			
		||||
            :label="item.label"
 | 
			
		||||
            :value="item.value">
 | 
			
		||||
          </el-option>
 | 
			
		||||
        </el-select>
 | 
			
		||||
      </el-form-item>
 | 
			
		||||
    </el-col>
 | 
			
		||||
    <el-col :span='6'>
 | 
			
		||||
      <el-form-item label="负责人" prop="workers">
 | 
			
		||||
        <el-input v-model="form.workers" :disabled="isBind"></el-input>
 | 
			
		||||
      </el-form-item>
 | 
			
		||||
    </el-col>
 | 
			
		||||
    <el-col :span='6'>
 | 
			
		||||
      <el-form-item label="计划分配订单量" prop="planAssignmentQuantity">
 | 
			
		||||
        <el-input-number v-model="form.planAssignmentQuantity" :min="0" :max="9999999999999" style="width: 100%;"></el-input-number>
 | 
			
		||||
      </el-form-item>
 | 
			
		||||
    </el-col>
 | 
			
		||||
        <el-form-item label="关联产线" prop="productLineId">
 | 
			
		||||
          <el-select v-model="form.productLineId" placeholder="请选择" multiple style="width: 100%;" :disabled="isBind">
 | 
			
		||||
            <el-option v-for="item in productLineList" :key="item.id" :label="item.name" :value="item.id">
 | 
			
		||||
            </el-option>
 | 
			
		||||
          </el-select>
 | 
			
		||||
        </el-form-item>
 | 
			
		||||
      </el-col>
 | 
			
		||||
      <el-col :span='6'>
 | 
			
		||||
        <el-form-item label="负责车间" prop="roomNameDict">
 | 
			
		||||
          <el-select v-model="form.roomNameDict" placeholder="请选择" style="width: 100%;" :disabled="isBind">
 | 
			
		||||
            <el-option v-for="item in getDictDatas(DICT_TYPE.WORK_SHOP)" :key="item.value" :label="item.label"
 | 
			
		||||
              :value="item.value">
 | 
			
		||||
            </el-option>
 | 
			
		||||
          </el-select>
 | 
			
		||||
        </el-form-item>
 | 
			
		||||
      </el-col>
 | 
			
		||||
      <el-col :span='6'>
 | 
			
		||||
        <el-form-item label="负责人" prop="workers">
 | 
			
		||||
          <el-input v-model="form.workers" :disabled="isBind"></el-input>
 | 
			
		||||
        </el-form-item>
 | 
			
		||||
      </el-col>
 | 
			
		||||
      <el-col :span='6'>
 | 
			
		||||
        <el-form-item label="计划分配订单量" prop="planAssignmentQuantity">
 | 
			
		||||
          <el-input-number v-model="form.planAssignmentQuantity" :min="0" :max="9999999999999"
 | 
			
		||||
            style="width: 100%;"></el-input-number>
 | 
			
		||||
        </el-form-item>
 | 
			
		||||
      </el-col>
 | 
			
		||||
    </el-row>
 | 
			
		||||
  </el-form>
 | 
			
		||||
</template>
 | 
			
		||||
<script>
 | 
			
		||||
import { getProductAll } from '@/api/base/product'
 | 
			
		||||
import { getProcessFlowList, getWorkOrderCode, orderIssue, workOrderList, getWorkOrderById } from '@/api/base/orderManage'
 | 
			
		||||
import { getProcessFlowList, getWorkOrderCode, orderIssue, getFreeWOlist, getWorkOrderById } from '@/api/base/orderManage'
 | 
			
		||||
import { getLineAll } from '@/api/base/productionLine'
 | 
			
		||||
import moment from 'moment'
 | 
			
		||||
export default {
 | 
			
		||||
@@ -202,8 +171,8 @@ export default {
 | 
			
		||||
      processFlowList: [],
 | 
			
		||||
      productLineList: [],
 | 
			
		||||
      workOrderTypeList: [
 | 
			
		||||
        {id: 1,name:'普通'},
 | 
			
		||||
        {id: 2, name:'特殊'}
 | 
			
		||||
        { id: 1, name: '普通' },
 | 
			
		||||
        { id: 2, name: '特殊' }
 | 
			
		||||
      ],
 | 
			
		||||
      planStartTime: '',
 | 
			
		||||
      planFinishTime: '',
 | 
			
		||||
@@ -223,7 +192,7 @@ export default {
 | 
			
		||||
        this.form.planProductId = data.planProductId
 | 
			
		||||
        // this.form.processFlowId = data.processFlowId
 | 
			
		||||
        // this.form.materialMethod = data.materialMethod
 | 
			
		||||
      }else{//绑定
 | 
			
		||||
      } else {//绑定
 | 
			
		||||
        this.isBind = true
 | 
			
		||||
      }
 | 
			
		||||
    },
 | 
			
		||||
@@ -244,7 +213,7 @@ export default {
 | 
			
		||||
        this.processFlowList = res.data || []
 | 
			
		||||
      })
 | 
			
		||||
      // 工单list
 | 
			
		||||
      workOrderList({
 | 
			
		||||
      getFreeWOlist({
 | 
			
		||||
        status: 1
 | 
			
		||||
      }).then(res => {
 | 
			
		||||
        this.workOrderList = res.data || []
 | 
			
		||||
@@ -252,10 +221,10 @@ export default {
 | 
			
		||||
    },
 | 
			
		||||
    // 物料变动
 | 
			
		||||
    selectMethod(val) {
 | 
			
		||||
      if (val === 2 && !this.form.processFlowId ) {
 | 
			
		||||
      if (val === 2 && !this.form.processFlowId) {
 | 
			
		||||
        this.form.materialMethod = 1
 | 
			
		||||
        this.$modal.msgError("请先选择关联工艺");
 | 
			
		||||
      }else if (val === 1) {
 | 
			
		||||
      } else if (val === 1) {
 | 
			
		||||
        this.form.processFlowId = ''
 | 
			
		||||
      }
 | 
			
		||||
    },
 | 
			
		||||
@@ -273,32 +242,32 @@ export default {
 | 
			
		||||
          workOrderId: this.form.workOrderId,
 | 
			
		||||
          orderId: this.form.orderId,
 | 
			
		||||
          planAssignmentQuantity: this.form.planAssignmentQuantity
 | 
			
		||||
          }).then((res) => {
 | 
			
		||||
        }).then((res) => {
 | 
			
		||||
          if (res.code === 0) {
 | 
			
		||||
            this.$modal.msgSuccess("操作成功")
 | 
			
		||||
            this.$emit('addWorkOrderSubmit')
 | 
			
		||||
          }
 | 
			
		||||
        })
 | 
			
		||||
      }else{// 新增工单
 | 
			
		||||
      } else {// 新增工单
 | 
			
		||||
        this.$refs['addWorkOrder'].validate((valid) => {
 | 
			
		||||
          if (valid) {
 | 
			
		||||
              // 新增工单
 | 
			
		||||
              let _this = this
 | 
			
		||||
              _this.form.planStartTime = _this.planStartTime ? new Date(_this.planStartTime).valueOf() : ''
 | 
			
		||||
              _this.form.planFinishTime = _this.planFinishTime ? new Date(_this.planFinishTime).valueOf() : ''
 | 
			
		||||
              orderIssue({ ..._this.form }).then(res => {
 | 
			
		||||
                if (res.code === 0) {
 | 
			
		||||
                  _this.$modal.msgSuccess("操作成功")
 | 
			
		||||
                  let name = this.form.name
 | 
			
		||||
                  _this.$emit('addWorkOrderSubmit')
 | 
			
		||||
                  // // 询问是否添加预使用主原料
 | 
			
		||||
                  // _this.$modal.confirm('是否添加预使用主原料信息?').then(function() {
 | 
			
		||||
                  //     _this.$router.push({
 | 
			
		||||
                  //       path: '/core/core-work-order?workOrderName='+encodeURI(name)
 | 
			
		||||
                  //     })
 | 
			
		||||
                  //   })
 | 
			
		||||
                }
 | 
			
		||||
              })
 | 
			
		||||
            // 新增工单
 | 
			
		||||
            let _this = this
 | 
			
		||||
            _this.form.planStartTime = _this.planStartTime ? new Date(_this.planStartTime).valueOf() : ''
 | 
			
		||||
            _this.form.planFinishTime = _this.planFinishTime ? new Date(_this.planFinishTime).valueOf() : ''
 | 
			
		||||
            orderIssue({ ..._this.form }).then(res => {
 | 
			
		||||
              if (res.code === 0) {
 | 
			
		||||
                _this.$modal.msgSuccess("操作成功")
 | 
			
		||||
                let name = this.form.name
 | 
			
		||||
                _this.$emit('addWorkOrderSubmit')
 | 
			
		||||
                // // 询问是否添加预使用主原料
 | 
			
		||||
                // _this.$modal.confirm('是否添加预使用主原料信息?').then(function() {
 | 
			
		||||
                //     _this.$router.push({
 | 
			
		||||
                //       path: '/core/core-work-order?workOrderName='+encodeURI(name)
 | 
			
		||||
                //     })
 | 
			
		||||
                //   })
 | 
			
		||||
              }
 | 
			
		||||
            })
 | 
			
		||||
          } else {
 | 
			
		||||
            return false
 | 
			
		||||
          }
 | 
			
		||||
@@ -319,7 +288,7 @@ export default {
 | 
			
		||||
    // 绑定工单,选择工单时获取工单信息
 | 
			
		||||
    getWorkOrderMsg() {
 | 
			
		||||
      if (this.form.workOrderId) {
 | 
			
		||||
        getWorkOrderById({id:this.form.workOrderId}).then(res => {
 | 
			
		||||
        getWorkOrderById({ id: this.form.workOrderId }).then(res => {
 | 
			
		||||
          if (res.code === 0) {
 | 
			
		||||
            this.form.code = res.data.code
 | 
			
		||||
            this.form.planProductId = res.data.planProductId
 | 
			
		||||
@@ -345,7 +314,7 @@ export default {
 | 
			
		||||
    getSpecifications(val) {
 | 
			
		||||
      for (let i of this.productList) {
 | 
			
		||||
        if (i.id === val) {
 | 
			
		||||
          this.form.specifications =  i.specifications
 | 
			
		||||
          this.form.specifications = i.specifications
 | 
			
		||||
          return
 | 
			
		||||
        }
 | 
			
		||||
      }
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user