bug
jiangping
2023-12-06 1f4e7d0f73a73e7350cf5a1df279d5f30904c5d5
web_standard/src/components/ext/OperaWInboundExtWindow.vue
@@ -1,11 +1,5 @@
<template>
  <GlobalWindow
    :title="title"
    width="80%"
    :visible.sync="visible"
    :confirm-working="isWorking"
    @confirm="confirm"
  >
  <GlobalWindow :title="title" width="80%" :visible.sync="visible" :confirm-working="isWorking" @confirm="confirm">
    <div style="margin-bottom: 10px">
      <span class="title-add-style" style="vertical-align:middle">入库信息</span>
      <!-- <el-button type="primary" style="margin-left: 10px;vertical-align:middle">选择来源单据</el-button> -->
@@ -19,36 +13,24 @@
          <el-input v-model="form.originCode" disabled placeholder="选择来源单据后默认带出" v-trim/>
        </el-form-item> -->
        <el-form-item label="计划入库日期" prop="planDate">
          <el-date-picker
            v-model="form.planDate"
            value-format="yyyy-MM-dd"
            placeholder="选择日期"
            :picker-options="pickerOptions"
          ></el-date-picker>
          <el-date-picker v-model="form.planDate" value-format="yyyy-MM-dd" placeholder="选择日期"
            :picker-options="pickerOptions"></el-date-picker>
        </el-form-item>
        <el-form-item label="入库类型" prop="type">
          <el-select v-model="form.type" :disabled="disabled" placeholder="请选择入库类型">
            <el-option
              v-for="(item, index) in type"
              :key="index"
              :label="item.name"
              :value="item.id">
            <el-option v-for="(item, index) in type" :key="index" :label="item.name" :value="item.id">
            </el-option>
          </el-select>
        </el-form-item>
        <el-form-item label="入库仓库" prop="warehouseId">
          <el-select v-model="form.warehouseId" filterable clearable placeholder="请选择入库仓库" @change="selectWare">
            <el-option
              v-for="(item, index) in tempWarehouses"
              :key="index"
              :label="item.name"
              :value="item.id">
            <el-option v-for="(item, index) in tempWarehouses" :key="index" :label="item.name" :value="item.id">
            </el-option>
          </el-select>
        </el-form-item>
        <div class="mark">
          <el-form-item label="单据摘要" prop="abstracts">
            <el-input v-model="form.abstracts" placeholder="请输入单据摘要" v-trim/>
            <el-input v-model="form.abstracts" placeholder="请输入单据摘要" v-trim />
          </el-form-item>
        </div>
      </el-form>
@@ -61,11 +43,7 @@
      <li><el-button type="primary" @click="addMaterial">选择物料</el-button></li>
    </ul>
    <el-table
      :data="form.woutboundInBodyBeanList"
      border
      stripe
    >
    <el-table :data="form.woutboundInBodyBeanList" border stripe>
      <el-table-column align="center" label="序号" type="index" />
      <el-table-column prop="code" label="物料编码" show-overflow-tooltip min-width="160px">
        <template slot-scope="{row}">
@@ -80,54 +58,46 @@
      <el-table-column v-if="whLocation.length" label="货位" min-width="100px">
        <template slot-scope="{row}">
          <el-select v-model="row.locationId" filterable placeholder="请选择" @select="selectLocation">
            <el-option
              v-for="(item, index) in whLocation"
              :key="index"
              :label="item.unionName"
              :value="item.id">
            <el-option v-for="(item, index) in whLocation" :key="index" :label="item.unionName" :value="item.id">
            </el-option>
          </el-select>
        </template>
      </el-table-column>
      <el-table-column label="质量属性" min-width="100px">
        <template slot-scope="scope">
          <el-select v-model="scope.row.qualityType" :disabled='canSelect(scope.$index)' filterable clearable placeholder="请选择">
            <el-option
              v-for="(item, index) in properties"
              :key="index"
              :label="item.name"
              :value="item.id">
          <el-select v-model="scope.row.qualityType" :disabled='canSelect(scope.$index)' filterable clearable
            placeholder="请选择">
            <el-option v-for="(item, index) in properties" :key="index" :label="item.name" :value="item.id">
            </el-option>
          </el-select>
        </template>
      </el-table-column>
      <el-table-column v-if="winType == 2" label="工序" min-width="100px">
        <template slot-scope="{row}">
          <el-select v-model="row.procedureId" :disabled="!row.procedureList" filterable placeholder="请选择">
            <el-option v-for="(item, index) in row.procedureList" :key="index" :label="item.name" :value="item.id">
            </el-option>
          </el-select>
        </template>
      </el-table-column>
      <el-table-column label="批次号" min-width="100px">
        <template slot-scope="{row}">
          <el-input v-model="row.batch" placeholder="请输入批次号" v-trim/>
          <el-input v-model="row.batch" placeholder="请输入批次号" v-trim />
        </template>
      </el-table-column>
      <el-table-column prop="umodelName" label="单位" min-width="60px"></el-table-column>
      <el-table-column label="入库数量" min-width="100px">
        <template slot-scope="{row}">
          <el-input v-model="row.num" type="number" placeholder="入库数量" v-trim/>
          <el-input v-model="row.num" type="number" placeholder="入库数量" v-trim />
        </template>
      </el-table-column>
      <el-table-column
        label="操作"
        min-width="60px"
        align="center"
        fixed="right"
      >
      <el-table-column label="操作" min-width="60px" align="center" fixed="right">
        <template slot-scope="{row}">
          <span class="delete-button-style" @click="deleteMaterail(row)">删除</span>
        </template>
      </el-table-column>
    </el-table>
    <SelectMaterail
      ref="selectMaterail"
      @selectData="selectData"
    >
    </SelectMaterail>
    <SelectMaterail ref="selectMaterail" @selectData="selectData"></SelectMaterail>
  </GlobalWindow>
</template>
@@ -144,7 +114,7 @@
    GlobalWindow,
    SelectMaterail: () => import('@/components/ext/SelectMaterail')
  },
  data () {
  data() {
    return {
      // 表单数据
      form: {
@@ -155,6 +125,7 @@
        origin: 0,
        woutboundInBodyBeanList: []
      },
      winType: 0,
      disabled: false,
      pickerOptions: {},
      tempWarehouses: [],
@@ -167,29 +138,29 @@
      activeName: 'first',
      whLocation: [],
      type: [
        {name:'采购入库', id: 25}
        { name: '采购入库', id: 25 }
      ],
      tempMaterials: [
      ],
      selectedMaterails: [],
      properties: [
        // 0 1不良 2报废
        {name:'合格', id: 0},
        {name:'不良', id: 1},
        {name:'报废', id: 2},
        { name: '合格', id: 0 },
        { name: '不良', id: 1 },
        { name: '报废', id: 2 },
      ]
    }
  },
  inject: ['warehouses'],
  created () {
  created() {
    this.config({
      api: '/ext/wOutboundExt',
      'field.id': 'id'
    })
    this.pickerOptions.disabledDate = (time) => {
       // 一天
      let tempTime = 3600 * 1000 * 24
      return time.getTime() < new Date()-tempTime
      // 一天
      let tempTime = 3600 * 1000 * 24
      return time.getTime() < new Date() - tempTime
    }
    // queryListByCode('?dicCode=SYSTEM_APPLIANCE_TYPE')
    //   .then(res => {
@@ -218,9 +189,10 @@
      }
      this.__confirmEdit()
    },
    open (title, type = 0) {
    open(title, type = 0) {
      this.title = title
      this.visible = true
      this.winType = type
      // 新建
      this.$nextTick(() => {
        this.$refs.form.resetFields()
@@ -229,16 +201,17 @@
        if (title === '其它入库') {
          this.form.planDate = new Date()
          this.form.type = null
          // this.form.woutboundInBodyBeanList = []
          this.disabled = false
          this.type = [
            { name:'客退检验入库', id: 26 },
            { name:'客返检验入库', id: 27 },
            { name:'库存调整', id: 28 }
            { name: '客退检验入库', id: 26 },
            { name: '客返检验入库', id: 27 },
            { name: '库存调整', id: 28 }
          ]
        } else {
          this.disabled = true
          this.type = [
            { name:'采购入库', id: 25 }
            { name: '采购入库', id: 25 }
          ]
        }
@@ -258,15 +231,15 @@
          this.tempWarehouses = this.warehouses()
        }
      })
    },
    selectWare (v) {
    selectWare(v) {
      // console.log(v)
      getListByWarehouseId(v)
        .then(res => {
          console.log(res)
          this.whLocation = res
          if (this.whLocation.length === 0 ) {
          if (this.whLocation.length === 0) {
            let temQualityType = 0
            for (const item of this.tempWarehouses) {
              if (item.id === v) {
@@ -300,9 +273,9 @@
        .catch(err => {
          console.log(err)
        })
    },
    setQuality (type) {
    setQuality(type) {
      for (const item of this.form.woutboundInBodyBeanList) {
        item.qualityType = type
      }
@@ -338,7 +311,7 @@
      }
      return !cans
    },
    selectLocation (v) {
    selectLocation(v) {
      // console.log(index, row);
      // for (const item of this.whLocation) {
      //   if (item.id === v) {
@@ -367,16 +340,16 @@
      //   }
      // }
    },
    addMaterial () {
    addMaterial() {
      // console.log('增加物料')
      // const ids = this.form.woutboundInBodyBeanList.map(e => { return e.materialId }).join(',')
      this.$refs.selectMaterail.open('选择物料', { ids: '', multiple: true, isPurchase:true })
      this.$refs.selectMaterail.open('选择物料', { ids: '', multiple: true, isPurchase: false, queryType: 1 })
    },
    deleteMaterail (row) {
    deleteMaterail(row) {
      // console.log('删除物料')
      this.form.woutboundInBodyBeanList.splice(this.form.woutboundInBodyBeanList.indexOf(row), 1)
    },
    selectData (data) {
    selectData(data) {
      // 选择物料回调
      console.log(data)
      for (const item of data.selectedMaterails) {
@@ -384,7 +357,8 @@
          code: item.mmodelCode,
          name: item.mmodelUnionName,
          umodelName: item.umodelName,
          procedureList: item.procedureList,
          procedureId: item.procedureList ? item.procedureList[0].id : null,
          locationId: this.whLocation.length ? this.whLocation[0].id : null,
          qualityType: this.whLocation.length ? 0 : this.houseProperty,
          materialId: item.id,
@@ -394,14 +368,14 @@
        })
      }
    },
    __confirmCreate () {
    __confirmCreate() {
      this.$refs.form.validate((valid) => {
        if (!this.form.woutboundInBodyBeanList.length) {
          this.$tip.error('至少选择一条物料')
          return
        }
        for (const item of this.form.woutboundInBodyBeanList) {
          if (item.num<=0) {
          if (item.num <= 0) {
            this.$tip.error('入库物料数量必须大于0!')
            return
          }
@@ -435,28 +409,33 @@
.toolbar {
  border-bottom: 1px solid #eee;
  padding-bottom: 10px;
  li {
    display: inline-block;
    margin-right: 6px;
  }
}
.form-data {
  ::v-deep .el-form-item{
  ::v-deep .el-form-item {
    width: 40%;
    margin-right: 1%;
  }
  .mark {
    .el-form-item {
      width: 81%;
      // margin-right: 1%;
    }
  }
  ::v-deep .el-form-item__content {
    width: calc(100% - 134px);
  }
}
.delete-button-style {
    color: red;
    cursor: pointer;
  }
  color: red;
  cursor: pointer;
}
</style>