<template> 
 | 
  <GlobalWindow 
 | 
    :title="title" 
 | 
    :visible.sync="visible" 
 | 
    width="80%" 
 | 
    :confirm-working="isWorking" 
 | 
    @confirm="confirm" 
 | 
  > 
 | 
    <div class="form-data form-wrap"> 
 | 
      <el-form :model="form" ref="form" inline :rules="rules" label-width="130px" label-suffix=":"> 
 | 
        <div style="display: inline-block; width:40%"> 
 | 
          <el-form-item label="计划转出日期" prop="outPlandate"> 
 | 
            <el-date-picker 
 | 
              v-model="form.outPlandate" 
 | 
              value-format="yyyy-MM-dd" 
 | 
              placeholder="请选择计划转出日期" 
 | 
              :picker-options="pickerOptions" 
 | 
            ></el-date-picker> 
 | 
          </el-form-item> 
 | 
        </div> 
 | 
        <div style="display: inline-block; width:40%"> 
 | 
          <el-form-item label="计划转入日期" prop="inPlandate"> 
 | 
            <el-date-picker 
 | 
              v-model="form.inPlandate" 
 | 
              value-format="yyyy-MM-dd" 
 | 
              placeholder="请选择计划转入日期" 
 | 
              :picker-options="pickerOptions" 
 | 
            ></el-date-picker> 
 | 
          </el-form-item> 
 | 
        </div> 
 | 
        <div class="input"> 
 | 
          <el-form-item label="单据摘要" prop="abstracts" class="input"> 
 | 
            <el-input v-model="form.abstracts"  placeholder="请输入" v-trim/> 
 | 
          </el-form-item> 
 | 
        </div> 
 | 
        <el-form-item label="转库类型" prop="type"> 
 | 
          <el-select v-model="form.type" filterable clearable placeholder="请选择转库类型" @change="selectInWarehouse"> 
 | 
            <el-option 
 | 
              v-for="item in transTypes" 
 | 
              :key="item.id" 
 | 
              :label="item.name" 
 | 
              :value="item.id" 
 | 
            ></el-option> 
 | 
          </el-select> 
 | 
        </el-form-item> 
 | 
        <!-- <el-form-item label="是否跨组织转库"  prop="isMutlOrg" > 
 | 
          <el-switch v-model="form.isMutlOrg" :active-value="true" :inactive-value="false" @change="orgChange"></el-switch> 
 | 
        </el-form-item> --> 
 | 
        <div v-if="form.isMutlOrg" style="display: inline-block; width:40%"> 
 | 
          <el-form-item label="转出组织" prop="outDepartId"> 
 | 
            <el-select v-model="form.outDepartId" filterable clearable placeholder="请选择转出组织" @change="selectOutD"> 
 | 
              <el-option 
 | 
                v-for="item in departments" 
 | 
                :key="item.id" 
 | 
                :label="item.name" 
 | 
                :value="item.id"> 
 | 
              </el-option> 
 | 
            </el-select> 
 | 
          </el-form-item> 
 | 
          <el-form-item label="转入组织" prop="inDepartId"> 
 | 
            <el-select v-model="form.inDepartId" filterable clearable placeholder="请选择转入组织" @change="selectInD"> 
 | 
              <el-option 
 | 
                v-for="item in departments" 
 | 
                :key="item.id" 
 | 
                :label="item.name" 
 | 
                :value="item.id"> 
 | 
              </el-option> 
 | 
            </el-select> 
 | 
          </el-form-item> 
 | 
        </div> 
 | 
        <div style="display: inline-block; width:40%"> 
 | 
          <el-form-item label="转出仓库" prop="outWarehouseId"> 
 | 
            <el-select v-model="form.outWarehouseId" filterable clearable placeholder="请选择转出仓库" @change="selectOutWarehouse"> 
 | 
              <el-option 
 | 
                v-for="item in outWarehouses" 
 | 
                :key="item.id" 
 | 
                :label="item.name" 
 | 
                :value="item.id"> 
 | 
              </el-option> 
 | 
            </el-select> 
 | 
          </el-form-item> 
 | 
          <el-form-item label="转入仓库" prop="inWarehouseId"> 
 | 
            <el-select v-model="form.inWarehouseId" filterable clearable placeholder="请选择转入仓库" @change="selectInWarehouse"> 
 | 
              <el-option 
 | 
                v-for="item in inWarehouses" 
 | 
                :key="item.id" 
 | 
                :label="item.name" 
 | 
                :value="item.id" 
 | 
              > 
 | 
              <!-- :disabled="item.id==form.outWarehouseId" --> 
 | 
              </el-option> 
 | 
            </el-select> 
 | 
          </el-form-item> 
 | 
        </div> 
 | 
      </el-form> 
 | 
    </div> 
 | 
    <!-- 列表 --> 
 | 
    <el-tabs> 
 | 
      <el-tab-pane label="" name="first"></el-tab-pane> 
 | 
    </el-tabs> 
 | 
      <div style="display:flex"> 
 | 
        <span style="margin: 5px 10px;font-size:14px;font-weight:500">转库明细</span> 
 | 
        <ul class="toolbar"> 
 | 
          <li><el-button type="primary" @click="addMaterial">选择物料</el-button></li> 
 | 
        </ul> 
 | 
      </div> 
 | 
    <el-table 
 | 
      :data="form.wtransferDetailBeanList" 
 | 
      border 
 | 
      stripe 
 | 
    > 
 | 
      <el-table-column align="center" label="序号" type="index" /> 
 | 
      <el-table-column prop="code" label="物料编码" min-width="160px"></el-table-column> 
 | 
      <el-table-column prop="name" label="物料名称" min-width="100px"></el-table-column> 
 | 
      <el-table-column prop="attr" label="规格" min-width="100px"></el-table-column> 
 | 
      <el-table-column prop="unitName" label="单位" min-width="100px"></el-table-column> 
 | 
      <el-table-column prop="batch" label="批次号" min-width="100px"></el-table-column> 
 | 
      <el-table-column align="center" prop="procedureName" label="工序" min-width="100px"> 
 | 
        <template slot-scope="{row}"> 
 | 
          <span >{{ row.procedureName || '-' }}</span> 
 | 
        </template> 
 | 
      </el-table-column> 
 | 
      <el-table-column align="center" label="质量属性" min-width="100px"> 
 | 
        <template slot-scope="{row}"> 
 | 
          <span v-if="row.qualityType==0" class="valid-style">合格</span> 
 | 
          <span v-else-if="row.qualityType==1" class="unvalid-style">不良</span> 
 | 
          <span v-else-if="row.qualityType==2" class="scrap-style">报废</span> 
 | 
          <span v-else>-</span> 
 | 
        </template> 
 | 
      </el-table-column> 
 | 
      <el-table-column prop="locationName" label="转出货位" min-width="130px"></el-table-column> 
 | 
      <el-table-column prop="stockNum" label="库存数量" min-width="130px"></el-table-column> 
 | 
      <el-table-column label="计划转出数量" min-width="100px"> 
 | 
        <template slot-scope="{row}"> 
 | 
          <el-input v-model="row.outPlanNum"  placeholder="请输入" v-trim/> 
 | 
        </template> 
 | 
      </el-table-column> 
 | 
      <el-table-column 
 | 
        label="操作" 
 | 
        min-width="120" 
 | 
        align="center" 
 | 
        fixed="right" 
 | 
      > 
 | 
        <template slot-scope="{row}"> 
 | 
          <span style="margin-left:8px"> 
 | 
            <el-button type="text" @click="deleteMaterail(row)">删除</el-button> 
 | 
          </span> 
 | 
          <!-- <span class="unvalid-style" @click="deleteMaterail(row)" style="color:red">删除</span> --> 
 | 
        </template> 
 | 
      </el-table-column> 
 | 
    </el-table> 
 | 
    <!-- 新增物料 --> 
 | 
    <SelectMaterail 
 | 
      ref="selectMaterail" 
 | 
      @selectData="selectData" 
 | 
    > 
 | 
      <div slot="tree" style="height: calc(100% - 20px);"> 
 | 
        <Tree 
 | 
          style="height:98%;overflow-y: scroll;" 
 | 
          :list="materialTypes" 
 | 
          :defaultProps="defaultProps" 
 | 
          @callback="callback" 
 | 
        ></Tree> 
 | 
      </div> 
 | 
      <div slot="main"> 
 | 
        <el-form ref="materialSearchForm" :model="materialSearchForm" inline> 
 | 
          <el-form-item label="物料信息" prop="materialName"> 
 | 
            <el-input v-model="materialSearchForm.materialName" placeholder="请输入物料编码/名称" v-trim/> 
 | 
          </el-form-item> 
 | 
          <el-form-item label="批次号" prop="batch"> 
 | 
            <el-input v-model="materialSearchForm.batch" placeholder="请输入批次号" v-trim/> 
 | 
          </el-form-item> 
 | 
          <section > 
 | 
            <el-button type="primary" @click="searchMaterail">搜索</el-button> 
 | 
            <el-button @click="reset">重置</el-button> 
 | 
          </section> 
 | 
        </el-form> 
 | 
        <el-table 
 | 
          style="margin-top:10px" 
 | 
          v-loading="isSearch" 
 | 
          :data="tempMaterials" 
 | 
          ref="materials" 
 | 
          border 
 | 
          @selection-change="handleSelectionChange" 
 | 
        > 
 | 
          <el-table-column type="selection" fixed="left" width="55"></el-table-column> 
 | 
          <el-table-column label="物料编码" min-width="100px"> 
 | 
            <template slot-scope="{row}"> 
 | 
              <el-button type="text"> 
 | 
                {{ row.materialCode }} 
 | 
              </el-button> 
 | 
            </template> 
 | 
          </el-table-column> 
 | 
          <el-table-column prop="materialName" label="物料名称" min-width="100px"></el-table-column> 
 | 
          <el-table-column prop="attr" label="规格" min-width="60px"></el-table-column> 
 | 
          <el-table-column prop="categoryName" label="物料类型" min-width="180px"> 
 | 
            <template slot-scope="{row}"> 
 | 
              <span class="long-title-style">{{ row.categoryName }}</span> 
 | 
            </template> 
 | 
          </el-table-column> 
 | 
          <el-table-column prop="unitName" label="单位" min-width="50px"></el-table-column> 
 | 
          <el-table-column prop="batch" label="批次号" min-width="100px"></el-table-column> 
 | 
          <el-table-column align="center" prop="procedureName" label="工序" min-width="100px"> 
 | 
            <template slot-scope="{row}"> 
 | 
              <span >{{ row.procedureName || '-' }}</span> 
 | 
            </template> 
 | 
          </el-table-column> 
 | 
          <el-table-column align="center" label="质量属性" min-width="100px"> 
 | 
            <template slot-scope="{row}"> 
 | 
              <span v-if="row.qualityType==0" class="valid-style">合格</span> 
 | 
              <span v-else-if="row.qualityType==1" class="unvalid-style">不良</span> 
 | 
              <span v-else-if="row.qualityType==2" class="scrap-style">报废</span> 
 | 
              <span v-else>-</span> 
 | 
            </template> 
 | 
          </el-table-column> 
 | 
          <el-table-column prop="locationName" label="货位" min-width="100px"></el-table-column> 
 | 
          <el-table-column prop="num" fixed="right" label="可用库存" min-width="100px"></el-table-column> 
 | 
            <!-- <template slot-scope="{row}"> 
 | 
              <el-input 
 | 
                v-if="isSelectRow(row)" 
 | 
                v-model="row.num" 
 | 
                placeholder="请输入数量" 
 | 
                v-trim 
 | 
                onkeyup="value=value.replace(/[^\d.]/g, '').replace(/\.{2,}/g, '.').replace('.', '$#$').replace(/\./g, '').replace('$#$', '.').replace(/^(\-)*(\d+)\.(\d\d\d\d).*$/, '$1$2.$3').replace(/^\./g, '')" 
 | 
                oninput="if(value<0) { value = ''} else {value=value.replace(/[^\d.]/g, '').replace(/\.{2,}/g, '.').replace('.', '$#$').replace(/\./g, '').replace('$#$', '.').replace(/^(\-)*(\d+)\.(\d\d\d\d).*$/, '$1$2.$3').replace(/^\./g, '')}" 
 | 
              /> 
 | 
            </template> --> 
 | 
        </el-table> 
 | 
        <el-pagination 
 | 
          style="margin-top:10px" 
 | 
          :current-page="pagination.pageIndex" 
 | 
          :page-size="pagination.pageSize" 
 | 
          layout="total, prev, pager, next, jumper" 
 | 
          :total="pagination.total" 
 | 
          @current-change="handlePageChange" 
 | 
          background> 
 | 
        </el-pagination> 
 | 
      </div> 
 | 
    </SelectMaterail> 
 | 
  </GlobalWindow> 
 | 
</template> 
 | 
  
 | 
<script> 
 | 
import BaseOpera from '@/components/base/BaseOpera' 
 | 
import GlobalWindow from '@/components/common/GlobalWindow' 
 | 
import Tree from '@/components/common/Tree' 
 | 
import { getDepartmentListByConditon } from '@/api/ext/departmentExt' 
 | 
import { queryWarehouseAllData } from '@/api/ext/warehouseExt' 
 | 
import { treeCategoryList } from '@/api/ext/categoryExt' 
 | 
import { choiceStockListPage } from '@/api/ext/wOutboundExt' 
 | 
export default { 
 | 
  name: 'OperaWrollOutStore', 
 | 
  extends: BaseOpera, 
 | 
  components: { 
 | 
    GlobalWindow, 
 | 
    Tree, 
 | 
    SelectMaterail: () => import('@/components/ext/SelectMaterail') 
 | 
  }, 
 | 
  data () { 
 | 
    return { 
 | 
      // 表单数据 
 | 
      form: { 
 | 
        isMutlOrg: false, 
 | 
        abstracts: null, 
 | 
        inPlandate: null, 
 | 
        outPlandate: null, 
 | 
        inDepartId: null, 
 | 
        inWarehouseId: null, 
 | 
        inUserId: null, 
 | 
        outDepartId: null, 
 | 
        outWarehouseId: null, 
 | 
        outUserId: null, 
 | 
        origin: 0, 
 | 
        type: null, 
 | 
        wtransferDetailBeanList: [] 
 | 
      }, 
 | 
      materialSearchForm: { 
 | 
        materialName: null, 
 | 
        batch: null 
 | 
      }, 
 | 
      pickerOptions: {}, 
 | 
      // 验证规则 
 | 
      rules: { 
 | 
        inPlandate: [{ required: true, message: '请选择入库日期', trigger: 'change' }], 
 | 
        outPlandate: [{ required: true, message: '请选择出库日期', trigger: 'change' }], 
 | 
        inDepartId: [{ required: true, message: '请选择转入组织', trigger: 'blur' }], 
 | 
        outDepartId: [{ required: true, message: '请选择转出组织', trigger: 'blur' }], 
 | 
        outWarehouseId: [{ required: true, message: '请选择转出仓库', trigger: 'blur' }], 
 | 
        type: [{ required: true, message: '请选择转库类型', trigger: 'blur' }], 
 | 
        abstracts: [{ max: 200, message: '输入字数不超过200', trigger: 'change' }], 
 | 
        inWarehouseId: [{ required: true, message: '请选择转入仓库', trigger: 'blur' }] 
 | 
      }, 
 | 
      departments: [], 
 | 
      outWarehouses: [], 
 | 
      inWarehouses: [], 
 | 
      label: '', 
 | 
      // 选择物料 
 | 
      isSelectMaterial: false, 
 | 
      isSearch: false, 
 | 
      materialTypes: [], 
 | 
      defaultProps: { 
 | 
        children: 'childrenList', 
 | 
        name: 'name', 
 | 
        status: 'status', 
 | 
        id: 'id' 
 | 
      }, 
 | 
      tempMaterials: [ 
 | 
      ], 
 | 
      transTypes: [ 
 | 
        { name: '车间领料', id: 1 }, 
 | 
        { name: '车间转库', id: 5 }, 
 | 
        { name: '外协领料转库', id: 6 }, 
 | 
        { name: '外协完工转库', id: 7 }, 
 | 
        { name: '产品入库', id: 8 }, 
 | 
        { name: '产品转库', id: 9 }, 
 | 
        { name: '让步放行入库', id: 10 }, 
 | 
        { name: '让步放行转库', id: 11 }, 
 | 
        { name: '客返返修领料', id: 12 }, 
 | 
        { name: '客返返修入库', id: 13 }, 
 | 
        { name: '跨组织转库', id: 14 }, 
 | 
        { name: '客退返修领料', id: 16 }, 
 | 
        { name: '客退返修入库', id: 17 }, 
 | 
        { name: '废品入库', id: 30 }, 
 | 
      ], 
 | 
      pagination: { 
 | 
        pageIndex: 1, 
 | 
        pageSize: 10, 
 | 
        total: 0 
 | 
      }, 
 | 
      selectedTree: { 
 | 
        bigId: null, 
 | 
        meddileId: null, 
 | 
        smallId: null 
 | 
      }, 
 | 
      selectedAllMaterails: {}, 
 | 
      selectedMaterails: [] 
 | 
    } 
 | 
  }, 
 | 
  created () { 
 | 
    this.config({ 
 | 
      api: '/ext/wTransferExt', 
 | 
      'field.id': 'id' 
 | 
    }) 
 | 
    this.pickerOptions.disabledDate = (time) => { 
 | 
        // 一天 
 | 
      let tempTime = 3600 * 1000 * 24  
 | 
      return time.getTime() < new Date()-tempTime 
 | 
    } 
 | 
    this.getWhouseByRootDepartment(2, this.$store.state.userInfo.curComDepartment.id) 
 | 
  }, 
 | 
  watch: { 
 | 
    visible:{ 
 | 
      handler(newVal, oldVal) { 
 | 
        if (newVal) { 
 | 
          this.form.wtransferDetailBeanList = [] 
 | 
        } 
 | 
      }, 
 | 
      deep: true 
 | 
    } 
 | 
  }, 
 | 
  methods: { 
 | 
    open (title, target) { 
 | 
      this.title = title 
 | 
      this.visible = true 
 | 
      // 新建 
 | 
      if (target == null) { 
 | 
        this.$nextTick(() => { 
 | 
          this.$refs.form.resetFields() 
 | 
          this.form[this.configData['field.id']] = null 
 | 
          this.form.outPlandate = new Date() 
 | 
          this.form.inPlandate = new Date() 
 | 
        }) 
 | 
        return 
 | 
      } 
 | 
      // 编辑 
 | 
      this.$nextTick(() => { 
 | 
        for (const key in this.form) { 
 | 
          this.form[key] = target[key] 
 | 
        } 
 | 
      }) 
 | 
    }, 
 | 
    orgChange (v) { 
 | 
      this.form.inWarehouseId = null 
 | 
      this.form.inDepartId = null 
 | 
      this.form.outWarehouseId = null 
 | 
      this.form.outDepartId = null 
 | 
      this.departments = [] 
 | 
      this.inWarehouses = [] 
 | 
      this.outWarehouses = [] 
 | 
      if (v) { 
 | 
        getDepartmentListByConditon({ type: 0 }) 
 | 
          .then(res => { 
 | 
            // console.log(res) 
 | 
            this.departments = res 
 | 
          }) 
 | 
          .catch(err => { 
 | 
            console.log(err) 
 | 
          }) 
 | 
      } else { 
 | 
        this.getWhouseByRootDepartment(2, this.$store.state.userInfo.curComDepartment.id) 
 | 
      } 
 | 
    }, 
 | 
    selectOutD (v) { 
 | 
      this.outWarehouses = [] 
 | 
      this.getWhouseByRootDepartment(0, v) 
 | 
    }, 
 | 
    selectInD (v) { 
 | 
      this.inWarehouses = [] 
 | 
      this.getWhouseByRootDepartment(1, v) 
 | 
    }, 
 | 
    getWhouseByRootDepartment (type, id) { 
 | 
      queryWarehouseAllData({  
 | 
        status: 1,  
 | 
        rootDepartId: id  
 | 
      }) 
 | 
      .then(res => { 
 | 
        if (type === 0) { 
 | 
          this.outWarehouses = res 
 | 
        } else if (type === 1) { 
 | 
          this.inWarehouses = res 
 | 
        } else { 
 | 
          this.outWarehouses = res 
 | 
          this.inWarehouses = res 
 | 
        } 
 | 
      }) 
 | 
      .catch(err => { 
 | 
        console.log(err) 
 | 
      }) 
 | 
    }, 
 | 
    selectOutWarehouse (v) { 
 | 
      for (const item of this.outWarehouses) { 
 | 
        if (item.id === v) { 
 | 
          this.form.outUserId = item.managerId 
 | 
          return 
 | 
        } 
 | 
      } 
 | 
    }, 
 | 
    selectInWarehouse (v) { 
 | 
      for (const item of this.inWarehouses) { 
 | 
        if (item.id === v) { 
 | 
          this.form.inUserId = item.managerId 
 | 
          this.label = item.tmodel.label 
 | 
          console.log(item) 
 | 
          return 
 | 
        } 
 | 
      } 
 | 
    }, 
 | 
    addMaterial () { 
 | 
      if (!this.form.outWarehouseId) { 
 | 
        this.$tip.error('请先选择转出仓库') 
 | 
        return 
 | 
      } 
 | 
      if (!this.form.inWarehouseId) { 
 | 
        this.$tip.error('请先选择转入仓库') 
 | 
        return 
 | 
      } 
 | 
      // 获取分类树 
 | 
      treeCategoryList({ cateType: 0 }) 
 | 
        .then(res => { 
 | 
          // console.log('获取分类树', res) 
 | 
          this.materialTypes = this.tree(res) 
 | 
        }) 
 | 
        .catch(err => { 
 | 
          console.log(err) 
 | 
        }) 
 | 
      const ids = [] 
 | 
      if (this.form.wtransferDetailBeanList) { 
 | 
        for (const item of this.form.wtransferDetailBeanList) { 
 | 
          ids.push(item.id) 
 | 
          // ids.push(item.materialId) 
 | 
        } 
 | 
      } 
 | 
      // console.log(ids) 
 | 
      choiceStockListPage({ 
 | 
        page: 1, 
 | 
        capacity: 10, 
 | 
        model: { 
 | 
          ids: ids.join(','), 
 | 
          warehouseQualityType: this.label, 
 | 
          warehouseId: this.form.outWarehouseId, 
 | 
          rootDepartId: this.form.outDepartId 
 | 
        }, 
 | 
        sorts: null 
 | 
      }).then(res => { 
 | 
        // console.log('res', res) 
 | 
        this.pagination.total = res.total 
 | 
        this.pagination.pageSize = res.capacity 
 | 
        this.pagination.pageIndex = res.page 
 | 
        this.tempMaterials = res.records 
 | 
        this.$refs.selectMaterail.open('选择物料') 
 | 
      }).catch(err => { 
 | 
        this.$tip.error(err) 
 | 
      }) 
 | 
    }, 
 | 
    deleteMaterail (row) { 
 | 
      // console.log('删除物料') 
 | 
      this.form.wtransferDetailBeanList.splice(this.form.wtransferDetailBeanList.indexOf(row), 1) 
 | 
    }, 
 | 
    reset () { 
 | 
      this.$refs.materialSearchForm.resetFields() 
 | 
      this.selectedTree.bigId = null 
 | 
      this.selectedTree.meddileId = null 
 | 
      this.selectedTree.smallId = null 
 | 
      this.pageSearch() 
 | 
    }, 
 | 
    callback (data, item) { 
 | 
      // console.log(data, item) 
 | 
      if (item.pmodel) { 
 | 
        const fpmodel = item.pmodel 
 | 
        if (fpmodel.parentId) { 
 | 
          // console.log('点击的是小类') 
 | 
          // 点击的是小类 
 | 
          if (this.selectedTree.smallId === fpmodel.id) { 
 | 
            // 关 
 | 
            this.selectedTree.smallId = null 
 | 
          } else { 
 | 
            // 开 
 | 
            this.selectedTree.smallId = item.id 
 | 
          } 
 | 
        } else { 
 | 
          // console.log('点击的是中类') 
 | 
          // 点击的是中类 
 | 
          if (this.selectedTree.meddileId === fpmodel.id) { 
 | 
            // 关 
 | 
            this.selectedTree.meddileId = null 
 | 
            this.selectedTree.smallId = null 
 | 
          } else { 
 | 
            // 开 
 | 
            this.selectedTree.meddileId = item.id 
 | 
            this.selectedTree.smallId = null 
 | 
          } 
 | 
        } 
 | 
      } else { 
 | 
        // 点击的是大类 
 | 
        if (this.selectedTree.bigId === item.id) { 
 | 
          // 关 
 | 
          this.selectedTree.bigId = null 
 | 
          this.selectedTree.meddileId = null 
 | 
          this.selectedTree.smallId = null 
 | 
        } else { 
 | 
          // 开 
 | 
          this.selectedTree.bigId = item.id 
 | 
          this.selectedTree.meddileId = null 
 | 
          this.selectedTree.smallId = null 
 | 
        } 
 | 
      } 
 | 
      this.pageSearch() 
 | 
    }, 
 | 
    searchMaterail () { 
 | 
      this.pageSearch() 
 | 
    }, 
 | 
    pageSearch () { 
 | 
      this.pagination.pageIndex = 1 
 | 
      this.getTempMaterails() 
 | 
    }, 
 | 
    getTempMaterails () { 
 | 
      const ids = [] 
 | 
      if (this.form.wtransferDetailBeanList) { 
 | 
        for (const item of this.form.wtransferDetailBeanList) { 
 | 
          ids.push(item.id) 
 | 
        } 
 | 
      } 
 | 
      choiceStockListPage({ 
 | 
        page: this.pagination.pageIndex === undefined ? 1 : this.pagination.pageIndex, 
 | 
        capacity: 10, 
 | 
        model: { 
 | 
          materialName: this.materialSearchForm.materialName, 
 | 
          warehouseQualityType: this.label, 
 | 
          batch: this.materialSearchForm.batch, 
 | 
          cateBigId: this.selectedTree.bigId, 
 | 
          cateMiddleId: this.selectedTree.meddileId, 
 | 
          cateSmallId: this.selectedTree.smallId, 
 | 
          warehouseId: this.form.outWarehouseId, 
 | 
          ids: ids.join(',') 
 | 
        }, 
 | 
        sorts: null 
 | 
      }).then(res => { 
 | 
        // console.log('res', res) 
 | 
        this.pagination.total = res.total 
 | 
        this.pagination.pageSize = res.capacity 
 | 
        this.pagination.pageIndex = res.page 
 | 
        this.tempMaterials = res.records 
 | 
        this.isSelectMaterial = true 
 | 
      }).catch(err => { 
 | 
        this.$tip.error(err) 
 | 
      }) 
 | 
    }, 
 | 
    handlePageChange (page) { 
 | 
      this.pagination.pageIndex = page 
 | 
      this.getTempMaterails() 
 | 
    }, 
 | 
    handleSelectionChange (selectedRows) { 
 | 
      // console.log(selectedRows) 
 | 
      this.selectedAllMaterails[this.pagination.pageIndex] = selectedRows 
 | 
    }, 
 | 
    selectData () { 
 | 
      console.log(this.selectedAllMaterails) 
 | 
      for (const key in this.selectedAllMaterails) { 
 | 
        for (const item of this.selectedAllMaterails[key]) { 
 | 
          this.form.wtransferDetailBeanList.push({ 
 | 
            code: item.materialCode, 
 | 
            name: item.materialName, 
 | 
            attr: item.attr, 
 | 
            stockNum: item.num, 
 | 
            unitName: item.unitName, 
 | 
            locationName: item.locationName, 
 | 
            procedureName: item.procedureName, 
 | 
            id: item.id, 
 | 
            // 需传参数 
 | 
            procedureId: item.procedureId, 
 | 
            qualityType: item.qualityType, 
 | 
            batch: item.batch, 
 | 
            inLocationId: null, 
 | 
            materialId: item.materialId, 
 | 
            outLocationId: item.locationId, 
 | 
            outPlanNum: item.num, 
 | 
            unitId: item.unitId 
 | 
          }) 
 | 
        } 
 | 
      } 
 | 
      // console.log('确定', this.form.woutBoundDetailBeans) 
 | 
      this.isSelectMaterial = false 
 | 
      this.pagination.pageIndex = 1 
 | 
    }, 
 | 
    // 树数据处理 
 | 
    tree (treeArray) { 
 | 
      const array = [] 
 | 
      for (const item of treeArray) { 
 | 
        // console.log('item', item) 
 | 
        item.status = false 
 | 
        if (item.childrenList) { 
 | 
          item.children = this.tree(item.childrenList) 
 | 
        } 
 | 
        array.push(item) 
 | 
      } 
 | 
      return array 
 | 
    }, 
 | 
    __confirmCreate () { 
 | 
      this.$refs.form.validate((valid) => { 
 | 
        if (!this.form.wtransferDetailBeanList.length) { 
 | 
          this.$tip.error('至少选择一条物料') 
 | 
          return 
 | 
        } 
 | 
        for (const item of this.form.wtransferDetailBeanList) { 
 | 
          if (item.outPlanNum<=0) { 
 | 
            this.$tip.error('转库的物料数量必须大于0!') 
 | 
            return 
 | 
          } else if (item.outPlanNum > item.stockNum) { 
 | 
            this.$tip.error('转库的物料数量必须小于库存量!') 
 | 
            return 
 | 
          } 
 | 
        } 
 | 
        if (!this.compare(this.form.outPlandate, this.form.inPlandate)) { 
 | 
            this.$tip.error('出库时间不能大于入库时间!') 
 | 
            return 
 | 
        } 
 | 
        if (!valid) { 
 | 
          return 
 | 
        } 
 | 
        // 调用新建接口 
 | 
        this.isWorking = true 
 | 
        this.api.create(this.form) 
 | 
          .then(() => { 
 | 
            this.visible = false 
 | 
            this.form.wtransferDetailBeanList = [] 
 | 
            this.$tip.apiSuccess('新建成功') 
 | 
            this.$emit('success') 
 | 
          }) 
 | 
          .catch(e => { 
 | 
            this.$tip.apiFailed(e) 
 | 
          }) 
 | 
          .finally(() => { 
 | 
            this.isWorking = false 
 | 
          }) 
 | 
      }) 
 | 
    }, 
 | 
    compare (date1, date2){ 
 | 
      var oDate1 = new Date(date1); 
 | 
      var oDate2 = new Date(date2); 
 | 
      if(oDate1.getTime() > oDate2.getTime()){ 
 | 
        return false 
 | 
      } else { 
 | 
        return true 
 | 
      }   
 | 
    } 
 | 
  }   
 | 
} 
 | 
</script> 
 | 
  
 | 
<style lang="scss" scoped> 
 | 
.form-data { 
 | 
  ::v-deep .el-form-item{ 
 | 
    width: 95%; 
 | 
    margin-right: 3%; 
 | 
  } 
 | 
} 
 | 
</style> 
 | 
  
 | 
<style lang="scss" scoped> 
 | 
.toolbar { 
 | 
  border-bottom: 1px solid #eee; 
 | 
  padding-bottom: 10px; 
 | 
  li { 
 | 
    display: inline-block; 
 | 
    margin-right: 6px; 
 | 
  } 
 | 
} 
 | 
::v-deep .el-dialog { 
 | 
  // height: calc(100% - 190px); 
 | 
  height: 70%; 
 | 
  min-height: 400px; 
 | 
} 
 | 
::v-deep .el-dialog__footer { 
 | 
  padding: 0px; 
 | 
} 
 | 
::v-deep .el-dialog__body { 
 | 
  height: calc(100% - 114px); 
 | 
} 
 | 
  
 | 
.main-materail { 
 | 
  display: flex; 
 | 
  justify-content: space-between; 
 | 
  height: 100%; 
 | 
  .left { 
 | 
    width: calc(30% - 20px); 
 | 
    height: calc(100% - 20px); 
 | 
    border: #111 solid 1px; 
 | 
    padding: 10px; 
 | 
    font-size: 18px; 
 | 
  } 
 | 
  .right { 
 | 
    width: calc(70% - 20px); 
 | 
    height: calc(100% - 20px); 
 | 
    padding: 0, 20px; 
 | 
    section { 
 | 
      display: inline-block; 
 | 
      margin-left: 16px; 
 | 
      margin-bottom: 18px; 
 | 
    } 
 | 
  } 
 | 
} 
 | 
.input{ 
 | 
  width: 80%; 
 | 
  ::v-deep .el-form-item__content { 
 | 
    width:calc(100% - 130px) !important; 
 | 
    .el-input { 
 | 
      width: calc(50% + 277.5px) !important; 
 | 
      // x/2 - 161 
 | 
    } 
 | 
  } 
 | 
} 
 | 
</style> 
 |