update
This commit is contained in:
		@@ -62,6 +62,15 @@ export const itemList = data => {
 | 
			
		||||
  })
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// 获取设备巡检项目列表
 | 
			
		||||
export const eqItemList = data => {
 | 
			
		||||
  return request({
 | 
			
		||||
    url: '/api/equipment/inspectionItem/list-WithEQ',
 | 
			
		||||
    method: 'POST',
 | 
			
		||||
    data
 | 
			
		||||
  })
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// 获取设备信息
 | 
			
		||||
export const getEqInfo = data => {
 | 
			
		||||
  return request({
 | 
			
		||||
 
 | 
			
		||||
@@ -53,10 +53,10 @@ export const eqList = data => {
 | 
			
		||||
  })
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// 获取批次列表
 | 
			
		||||
export const batchList = data => {
 | 
			
		||||
// 获取物料列表
 | 
			
		||||
export const materialList = data => {
 | 
			
		||||
  return request({
 | 
			
		||||
    url: '/api/material/material-date/list',
 | 
			
		||||
    url: '/api/basic/material/page',
 | 
			
		||||
    method: 'POST',
 | 
			
		||||
    data
 | 
			
		||||
  })
 | 
			
		||||
 
 | 
			
		||||
@@ -180,7 +180,7 @@
 | 
			
		||||
 | 
			
		||||
<script>
 | 
			
		||||
import moment from 'moment'
 | 
			
		||||
import { detail, eqList, itemList, getInsList, updateInsStatus, add, update } from '@/api/eqInspection'
 | 
			
		||||
import { detail, eqList, itemList, eqItemList, getInsList, updateInsStatus, add, update } from '@/api/eqInspection'
 | 
			
		||||
import { uploadFile, downloadFile } from '@/api/file'
 | 
			
		||||
import { blobToBase64 } from '@/util/utils'
 | 
			
		||||
import shortLine from '@/components/shortLine.vue'
 | 
			
		||||
@@ -206,6 +206,7 @@ export default {
 | 
			
		||||
        itemList: []
 | 
			
		||||
      },
 | 
			
		||||
      itemList: [],
 | 
			
		||||
      eqItemList: [],
 | 
			
		||||
      itemObj: {},
 | 
			
		||||
      itemShow: null,
 | 
			
		||||
      insList: [],
 | 
			
		||||
@@ -233,6 +234,7 @@ export default {
 | 
			
		||||
    this.getEqList()
 | 
			
		||||
    if (!(this.$route.query.id)) {
 | 
			
		||||
      this.getItemList()
 | 
			
		||||
      this.getEqItemList()
 | 
			
		||||
    }
 | 
			
		||||
  },
 | 
			
		||||
  methods: {
 | 
			
		||||
@@ -269,6 +271,19 @@ export default {
 | 
			
		||||
        })
 | 
			
		||||
      }
 | 
			
		||||
    },
 | 
			
		||||
    // 获取当前设备维修项目列表
 | 
			
		||||
    async getEqItemList () {
 | 
			
		||||
      const result = await eqItemList({
 | 
			
		||||
        current: 1,
 | 
			
		||||
        size: 999,
 | 
			
		||||
        equipmentId: this.$route.query.equipmentId
 | 
			
		||||
      })
 | 
			
		||||
      if (result.success) {
 | 
			
		||||
        this.eqItemList = result.data.map(item => {
 | 
			
		||||
          return item.itemId
 | 
			
		||||
        })
 | 
			
		||||
      }
 | 
			
		||||
    },
 | 
			
		||||
    // 获取详情
 | 
			
		||||
    async getDetail () {
 | 
			
		||||
      this.eqId = this.$route.query.id
 | 
			
		||||
@@ -377,6 +392,7 @@ export default {
 | 
			
		||||
      if (this.$route.query.id) {
 | 
			
		||||
        result = await update(this.dataForm)
 | 
			
		||||
      } else {
 | 
			
		||||
        this.dataForm.itemList = this.dataForm.itemList.concat(this.eqItemList)
 | 
			
		||||
        result = await add(this.dataForm)
 | 
			
		||||
      }
 | 
			
		||||
      if (result.success) {
 | 
			
		||||
 
 | 
			
		||||
@@ -9,7 +9,7 @@
 | 
			
		||||
<template>
 | 
			
		||||
  <van-popup v-model="show" position="bottom" class="eqPopup">
 | 
			
		||||
    <van-picker
 | 
			
		||||
      title="选择批次"
 | 
			
		||||
      title="选择物料"
 | 
			
		||||
      show-toolbar
 | 
			
		||||
      :columns="showList"
 | 
			
		||||
      @confirm="onConfirm"
 | 
			
		||||
@@ -23,7 +23,7 @@
 | 
			
		||||
export default {
 | 
			
		||||
  name: 'eqPopup',
 | 
			
		||||
  props: {
 | 
			
		||||
    batchList: {
 | 
			
		||||
    materialList: {
 | 
			
		||||
      type: Array,
 | 
			
		||||
      default: () => []
 | 
			
		||||
    }
 | 
			
		||||
@@ -35,7 +35,7 @@ export default {
 | 
			
		||||
  },
 | 
			
		||||
  computed: {
 | 
			
		||||
    showList: function () {
 | 
			
		||||
      return this.batchList.map(item => {
 | 
			
		||||
      return this.materialList.map(item => {
 | 
			
		||||
        return item.name
 | 
			
		||||
      })
 | 
			
		||||
    }
 | 
			
		||||
@@ -45,7 +45,7 @@ export default {
 | 
			
		||||
      this.show = true
 | 
			
		||||
    },
 | 
			
		||||
    onConfirm (val, index) {
 | 
			
		||||
      this.$emit('changeBatch', index)
 | 
			
		||||
      this.$emit('changeMaterial', index)
 | 
			
		||||
      this.show = false
 | 
			
		||||
    },
 | 
			
		||||
    onCancel () {
 | 
			
		||||
@@ -21,7 +21,7 @@
 | 
			
		||||
    </van-sticky>
 | 
			
		||||
    <div class="eq-edit-main">
 | 
			
		||||
      <div class="eq-main-item">
 | 
			
		||||
        <van-row class="eq-field-item">
 | 
			
		||||
        <!-- <van-row class="eq-field-item">
 | 
			
		||||
          <van-col :span="7" class="eq-field-item-lable">
 | 
			
		||||
            <short-line />
 | 
			
		||||
            批次
 | 
			
		||||
@@ -36,23 +36,7 @@
 | 
			
		||||
              right-icon="arrow-down"
 | 
			
		||||
            />
 | 
			
		||||
          </van-col>
 | 
			
		||||
        </van-row>
 | 
			
		||||
        <van-row class="eq-field-item">
 | 
			
		||||
          <van-col :span="7" class="eq-field-item-lable">
 | 
			
		||||
            <short-line />
 | 
			
		||||
            换料时间
 | 
			
		||||
          </van-col>
 | 
			
		||||
          <van-col :span="15" :offset="1" class="eq-field-item-input">
 | 
			
		||||
            <van-field
 | 
			
		||||
              v-model="dataForm.replaceTime"
 | 
			
		||||
              disabled
 | 
			
		||||
              class="canInput"
 | 
			
		||||
              placeholder="请选择换料时间"
 | 
			
		||||
              @click="handleDate"
 | 
			
		||||
              right-icon="arrow-down"
 | 
			
		||||
            />
 | 
			
		||||
          </van-col>
 | 
			
		||||
        </van-row>
 | 
			
		||||
        </van-row> -->
 | 
			
		||||
        <van-row class="eq-field-item">
 | 
			
		||||
          <van-col :span="7" class="eq-field-item-lable">
 | 
			
		||||
            <short-line />
 | 
			
		||||
@@ -61,8 +45,11 @@
 | 
			
		||||
          <van-col :span="15" :offset="1" class="eq-field-item-input">
 | 
			
		||||
            <van-field
 | 
			
		||||
              v-model="dataForm.materialName"
 | 
			
		||||
              class="canInput"
 | 
			
		||||
              disabled
 | 
			
		||||
              placeholder="请选择批次"
 | 
			
		||||
              placeholder="请选择物料"
 | 
			
		||||
              @click="handleSelectMaterial"
 | 
			
		||||
              right-icon="arrow-down"
 | 
			
		||||
            />
 | 
			
		||||
          </van-col>
 | 
			
		||||
        </van-row>
 | 
			
		||||
@@ -75,7 +62,36 @@
 | 
			
		||||
            <van-field
 | 
			
		||||
              v-model="dataForm.materialCode"
 | 
			
		||||
              disabled
 | 
			
		||||
              placeholder="请选择批次"
 | 
			
		||||
              placeholder="请选择物料"
 | 
			
		||||
            />
 | 
			
		||||
          </van-col>
 | 
			
		||||
        </van-row>
 | 
			
		||||
        <van-row class="eq-field-item">
 | 
			
		||||
          <van-col :span="7" class="eq-field-item-lable">
 | 
			
		||||
            <short-line />
 | 
			
		||||
            数量
 | 
			
		||||
          </van-col>
 | 
			
		||||
          <van-col :span="15" :offset="1" class="eq-field-item-input">
 | 
			
		||||
            <van-field
 | 
			
		||||
              v-model="dataForm.num"
 | 
			
		||||
              type="number"
 | 
			
		||||
              placeholder="请输入数量"
 | 
			
		||||
            />
 | 
			
		||||
          </van-col>
 | 
			
		||||
        </van-row>
 | 
			
		||||
        <van-row class="eq-field-item">
 | 
			
		||||
          <van-col :span="7" class="eq-field-item-lable">
 | 
			
		||||
            <short-line />
 | 
			
		||||
            换料时间
 | 
			
		||||
          </van-col>
 | 
			
		||||
          <van-col :span="15" :offset="1" class="eq-field-item-input">
 | 
			
		||||
            <van-field
 | 
			
		||||
              v-model="formatTime"
 | 
			
		||||
              disabled
 | 
			
		||||
              class="canInput"
 | 
			
		||||
              placeholder="请选择换料时间"
 | 
			
		||||
              @click="handleDate"
 | 
			
		||||
              right-icon="arrow-down"
 | 
			
		||||
            />
 | 
			
		||||
          </van-col>
 | 
			
		||||
        </van-row>
 | 
			
		||||
@@ -165,7 +181,7 @@
 | 
			
		||||
      />
 | 
			
		||||
    </van-popup>
 | 
			
		||||
    <material-popup ref="eqPopup" :eq-list="eqList" @changeEq="changeEq" />
 | 
			
		||||
    <material-popup-batch ref="batchPopup" :batch-list="batchList" @changeBatch="changeBatch" />
 | 
			
		||||
    <material-popup-material ref="materialPopup" :material-list="materialList" @changeMaterial="changeMaterial" />
 | 
			
		||||
    <material-popup-worker ref="workerPopup" :worker-list="workerList" @changeWorker="changeWorker" />
 | 
			
		||||
    <material-popup-source ref="sourcePopup" :source-list="sourceList" @changeSource="changeSource" />
 | 
			
		||||
  </div>
 | 
			
		||||
@@ -173,39 +189,41 @@
 | 
			
		||||
 | 
			
		||||
<script>
 | 
			
		||||
import moment from 'moment'
 | 
			
		||||
import { detail, eqList, batchList, workerList, materialInfo, add, update } from '@/api/material'
 | 
			
		||||
import { detail, eqList, materialList, workerList, add, update } from '@/api/material'
 | 
			
		||||
import shortLine from '@/components/shortLine.vue'
 | 
			
		||||
import materialPopup from './components/materialPopup'
 | 
			
		||||
import materialPopupBatch from './components/materialPopup-batch'
 | 
			
		||||
import materialPopupMaterial from './components/materialPopup-material'
 | 
			
		||||
import materialPopupWorker from './components/materialPopup-worker'
 | 
			
		||||
import materialPopupSource from './components/materialPopup-source'
 | 
			
		||||
import { Toast } from 'vant'
 | 
			
		||||
 | 
			
		||||
export default {
 | 
			
		||||
  name: 'materialEdit',
 | 
			
		||||
  components: { shortLine, materialPopup, materialPopupBatch, materialPopupWorker, materialPopupSource },
 | 
			
		||||
  components: { shortLine, materialPopup, materialPopupMaterial, materialPopupWorker, materialPopupSource },
 | 
			
		||||
  data () {
 | 
			
		||||
    return {
 | 
			
		||||
      eqList: [],
 | 
			
		||||
      batchList: [],
 | 
			
		||||
      materialList: [],
 | 
			
		||||
      workerList: [],
 | 
			
		||||
      sourceList: ['手动', 'PDA'],
 | 
			
		||||
      dataForm: {
 | 
			
		||||
        id: null,
 | 
			
		||||
        equipmentId: null,
 | 
			
		||||
        equipmentName: null,
 | 
			
		||||
        materialDateId: null,
 | 
			
		||||
        materialDateName: null,
 | 
			
		||||
        materialDateCode: null,
 | 
			
		||||
        // materialDateId: null,
 | 
			
		||||
        // materialDateName: null,
 | 
			
		||||
        // materialDateCode: null,
 | 
			
		||||
        materialId: null,
 | 
			
		||||
        materialName: null,
 | 
			
		||||
        materialCode: null,
 | 
			
		||||
        replaceTime: null,
 | 
			
		||||
        operator: null,
 | 
			
		||||
        num: null,
 | 
			
		||||
        source: 'PDA',
 | 
			
		||||
        remark: null
 | 
			
		||||
      },
 | 
			
		||||
      minDate: new Date(2020, 0, 1),
 | 
			
		||||
      formatTime: null,
 | 
			
		||||
      showDate: false,
 | 
			
		||||
      currentDate: null
 | 
			
		||||
    }
 | 
			
		||||
@@ -230,9 +248,9 @@ export default {
 | 
			
		||||
      if (resultEq.success) {
 | 
			
		||||
        this.eqList = resultEq.data
 | 
			
		||||
      }
 | 
			
		||||
      const resultBatch = await batchList(listQuery)
 | 
			
		||||
      if (resultBatch.success) {
 | 
			
		||||
        this.batchList = resultBatch.data
 | 
			
		||||
      const resultMaterial = await materialList(listQuery)
 | 
			
		||||
      if (resultMaterial.success) {
 | 
			
		||||
        this.materialList = resultMaterial.data.records
 | 
			
		||||
      }
 | 
			
		||||
      const resultWorker = await workerList(listQuery)
 | 
			
		||||
      if (resultWorker.success) {
 | 
			
		||||
@@ -252,11 +270,13 @@ export default {
 | 
			
		||||
      })
 | 
			
		||||
      if (result.success) {
 | 
			
		||||
        this.dataForm = result.data
 | 
			
		||||
        this.formatTime = moment(result.data.replaceTime).format('YYYY-MM-DD HH:mm:ss')
 | 
			
		||||
      }
 | 
			
		||||
    },
 | 
			
		||||
    // 更新时间
 | 
			
		||||
    setDate (v) {
 | 
			
		||||
      this.dataForm.replaceTime = moment(v).format('YYYY-MM-DDTHH:mm:ss')
 | 
			
		||||
      this.formatTime = moment(v).format('YYYY-MM-DD HH:mm:ss')
 | 
			
		||||
      this.showDate = false
 | 
			
		||||
    },
 | 
			
		||||
    // 弹出日期选择器
 | 
			
		||||
@@ -273,22 +293,26 @@ export default {
 | 
			
		||||
      this.$refs.eqPopup.init(this.dataForm.equipmentName)
 | 
			
		||||
    },
 | 
			
		||||
    // 修改批次
 | 
			
		||||
    async changeBatch (index) {
 | 
			
		||||
      const result = await materialInfo({
 | 
			
		||||
        externalCode: this.batchList[index].code
 | 
			
		||||
      })
 | 
			
		||||
      if (result.success) {
 | 
			
		||||
        this.dataForm.materialDateId = result.data.id
 | 
			
		||||
        this.dataForm.materialDateName = result.data.name
 | 
			
		||||
        this.dataForm.materialDateCode = result.data.code
 | 
			
		||||
        this.dataForm.materialName = result.data.materialName
 | 
			
		||||
        this.dataForm.materialCode = result.data.materialCode
 | 
			
		||||
        this.dataForm.materialId = result.data.materialId
 | 
			
		||||
      }
 | 
			
		||||
    async changeMaterial (index) {
 | 
			
		||||
      console.log()
 | 
			
		||||
      this.dataForm.materialName = this.materialList[index].name
 | 
			
		||||
      this.dataForm.materialCode = this.materialList[index].code
 | 
			
		||||
      this.dataForm.materialId = this.materialList[index].id
 | 
			
		||||
      // const result = await materialInfo({
 | 
			
		||||
      //   externalCode: this.materialList[index].code
 | 
			
		||||
      // })
 | 
			
		||||
      // if (result.success) {
 | 
			
		||||
      //   // this.dataForm.materialDateId = result.data.id
 | 
			
		||||
      //   // this.dataForm.materialDateName = result.data.name
 | 
			
		||||
      //   // this.dataForm.materialDateCode = result.data.code
 | 
			
		||||
      //   this.dataForm.materialName = result.data.materialName
 | 
			
		||||
      //   this.dataForm.materialCode = result.data.materialCode
 | 
			
		||||
      //   this.dataForm.materialId = result.data.materialId
 | 
			
		||||
      // }
 | 
			
		||||
    },
 | 
			
		||||
    // 弹出批次选择框
 | 
			
		||||
    handleSelectBatch () {
 | 
			
		||||
      this.$refs.batchPopup.init(this.dataForm.materialDateName)
 | 
			
		||||
    handleSelectMaterial () {
 | 
			
		||||
      this.$refs.materialPopup.init(this.dataForm.materialName)
 | 
			
		||||
    },
 | 
			
		||||
    // 修改操作员
 | 
			
		||||
    changeWorker (val) {
 | 
			
		||||
@@ -306,7 +330,7 @@ export default {
 | 
			
		||||
    },
 | 
			
		||||
    // 提交表单
 | 
			
		||||
    async handleSubmit () {
 | 
			
		||||
      if (this.dataForm.replaceTime && this.dataForm.materialDateCode && this.dataForm.equipmentId) {
 | 
			
		||||
      if (this.dataForm.replaceTime && this.dataForm.materialId && this.dataForm.equipmentId) {
 | 
			
		||||
        let result = {}
 | 
			
		||||
        if (this.$route.query.id) {
 | 
			
		||||
          result = await update(this.dataForm)
 | 
			
		||||
@@ -324,25 +348,27 @@ export default {
 | 
			
		||||
          })
 | 
			
		||||
        }
 | 
			
		||||
      } else {
 | 
			
		||||
        this.$notify('批次号、设备、换料时间必须选择!')
 | 
			
		||||
        this.$notify('物料、设备、换料时间必须选择!')
 | 
			
		||||
      }
 | 
			
		||||
    },
 | 
			
		||||
    // 重置表单
 | 
			
		||||
    resetForm () {
 | 
			
		||||
      const id = this.dataForm.id
 | 
			
		||||
      this.formatTime = null
 | 
			
		||||
      this.dataForm = {
 | 
			
		||||
        id,
 | 
			
		||||
        equipmentId: null,
 | 
			
		||||
        equipmentName: null,
 | 
			
		||||
        materialDateId: null,
 | 
			
		||||
        materialDateName: null,
 | 
			
		||||
        materialDateCode: null,
 | 
			
		||||
        // materialDateId: null,
 | 
			
		||||
        // materialDateName: null,
 | 
			
		||||
        // materialDateCode: null,
 | 
			
		||||
        materialId: null,
 | 
			
		||||
        materialName: null,
 | 
			
		||||
        materialCode: null,
 | 
			
		||||
        replaceTime: null,
 | 
			
		||||
        operator: null,
 | 
			
		||||
        source: 'PDA',
 | 
			
		||||
        num: null,
 | 
			
		||||
        remark: null
 | 
			
		||||
      }
 | 
			
		||||
    }
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user