// 创建出入库任务
<template>
  <div class="container">
    <el-row>
      <el-col :span="12">
        <h2 class="bg-left title">创建出入库任务</h2>
      </el-col>
      <el-col :span="12" class="bg-right">
        <el-button
          class="bg-bottom"
          type="primary"
          size="small"
          @click="returnsales()"
          ><img
            width="6"
            height="10"
            style="vertical-align: bottom; margin-right: 3px"
            src="../../../public/img/lujing.png"
            alt=""
          />返回</el-button
        >
      </el-col>
    </el-row>
      <div class="basicInformation">
          <el-radio v-model="radio" label="1">出库</el-radio>
  <el-radio v-model="radio" label="2">入库</el-radio>
    <el-radio v-model="radio" label="3">移库</el-radio>
  <el-radio v-model="radio" label="4">退库并出库</el-radio>
       <div class="center1">

    <!--出库=-->      
    <div class="small-title"><h3>出库任务( )</h3></div>
            <el-form ref="form" :model="form" label-width="140px">
          <!-- 仓库名 -->
          <el-form-item label="仓库名">
             <el-select
              v-model="dataList.warehouseName"
              placeholder="请选择仓库名"
              class="typeselect"
              @change="selectwarehouseName"
            >
              <el-option
                v-for="item in warehouseNameList"
                :key="item.constKey"
                :label="item.constValue"
                :value="item.constValue"
              />
            </el-select>
          </el-form-item>
          <!-- 出库类型 -->
            <el-form-item label="出库类型">
                <el-select
              v-model="dataList.deliveryType"
              placeholder="请选择出库类型"
              class="typeselect"
              @change="selectstorageType"
            >
              <el-option
                v-for="item in storageType"
                :key="item.constKey"
                :label="item.constValue"
                :value="item.constValue"
              />
            </el-select>
             </el-form-item>
            <!-- 合同编号 -->
              <el-form-item label="合同编号">
                    <el-select
                        v-model="dataList.contractNo"
                        placeholder="请选择合同编号"
                        class="typeselect"
            >
              <el-option
                v-for="item in outContractNo"
                :key="item.constKey"
                :label="item.contractNo"
                :value="item.contractNo"
              />
            </el-select>
                </el-form-item>
            <!-- 货名 -->
              <el-form-item label="货名">
                  {{}}
            </el-select>
                </el-form-item>
          <!--重量（吨）-->
            <el-form-item label="重量（吨）">
                <el-input
              @input="weightchange"
              v-model="dataList.weight"
              placeholder="请输入重量"
              maxlength="120"
              size="small"
            />
            </el-form-item>
          <!-- 品级 -->
            <el-form-item label="品级">
                <el-select
              v-model="dataList.grade"
              placeholder=""
              class="typeselect"
              @change="selectpackingMethod"
            >
              <el-option
                v-for="item in gradeList"
                :key="item.constKey"
                :label="item.constValue"
                :value="item.constValue"
              />
            </el-select>
            </el-form-item>
          <!--容重（克/升）>=-->
            <el-form-item label="容重（克/升）>=">
                    <el-input
              @input="bulkDensitychange"
              v-model="dataList.bulkDensity"
              placeholder="请输入容重"
              maxlength="120"
              size="small"
            />
            </el-form-item>  
        <!--水分（%）<=--> 
            <el-form-item label="水分（%）<=">
                <el-input
              @input="waterContentchange"
              v-model="dataList.waterContent"
              placeholder="请输入水分占比"
              maxlength="120"
              size="small"
            />
            </el-form-item>  
          <!--单价(元/吨)-->  
            <el-form-item label="单价(元/吨)">
               <el-input
              @input="unitPricechange"
              v-model="dataList.unitPrice"
              placeholder="请输入单价"
              maxlength="120"
              size="small"
            />
            </el-form-item>
          <!--预计出库日期-->
          <el-form-item
            label="预计出库日期"
            span="1"
            prop="deliveryDate"
            class="deliverydate"
          >
            <el-date-picker
              v-model="dataList.deliveryDate"
              type="date"
              placeholder="请选择预计出库日期"
              value-format="yyyy-MM-dd"
            />
          </el-form-item>   
          <!--经办人-->
         <el-form-item label="出库经办人">
              <el-select
              v-model="dataList.agent"
              placeholder="请选择经办人"
              filterable
              :filter-method="dataFilter"
              @change="selectstaff"
            >
              <el-option
                v-for="item in options"
                :key="item.value"
                :label="item.staffName"
                :value="item.staffName"
              />
            </el-select>
          </el-form-item>
        <!--业务描述=-->
          <el-form-item label="业务描述" >
            <el-input
              @input="businessDescriptionchange"
              v-model="dataList.businessDescription"
              placeholder="请输入业务描述，不超过150字"
              maxlength="150"
              size="small"
            />
          </el-form-item>           
</el-form>

      <!--入库=-->
      <div class="small-title"><h3>入库任务( )</h3></div>
            <el-form ref="form" :model="form" label-width="140px">

          <!-- 仓库名 -->
          <el-form-item label="仓库名">
             <el-select
              v-model="dataList.warehouseName"
              placeholder="请选择仓库名"
              class="typeselect"
              @change="selectwarehouseName"
            >
              <el-option
                v-for="item in warehouseNameList"
                :key="item.constKey"
                :label="item.constValue"
                :value="item.constValue"
              />
            </el-select>
          </el-form-item>
          <!-- 入库类型 -->
            <el-form-item label="入库类型">
                <el-select
              v-model="dataList.inOutType"
              placeholder="请选择入库类型"
              class="typeselect"
              @change="selectstorageType"
            >
              <el-option
                v-for="item in storageType"
                :key="item.constKey"
                :label="item.constValue"
                :value="item.constValue"
              />
            </el-select>
             </el-form-item>
            <!-- 合同编号 -->
              <el-form-item label="合同编号">
                    <el-select
                        v-model="dataList.contractNo"
                        placeholder="请选择合同编号"
                        class="typeselect"
            >
              <el-option
                v-for="item in outContractNo"
                :key="item.constKey"
                :label="item.contractNo"
                :value="item.contractNo"
              />
            </el-select>
                </el-form-item>
            <!-- 货名 -->
              <el-form-item label="货名">
                  {{}}
                </el-form-item>
          <!--重量（吨）-->
            <el-form-item label="重量（吨）">
                <el-input
              @input="weightchange"
              v-model="dataList.weight"
              placeholder="请输入重量"
              maxlength="120"
              size="small"
            />
            </el-form-item>
          <!-- 品级 -->
            <el-form-item label="品级">
                <el-select
              v-model="dataList.grade"
              placeholder="一等品"
              class="typeselect"
              @change="selectpackingMethod"
            >
              <el-option
                v-for="item in gradeList"
                :key="item.constKey"
                :label="item.constValue"
                :value="item.constValue"
              />
            </el-select>
            </el-form-item>
          <!--容重（克/升）>=-->
            <el-form-item label="容重（克/升）>=">
                    <el-input
              @input="bulkDensitychange"
              v-model="dataList.bulkDensity"
              placeholder="请输入容重"
              maxlength="120"
              size="small"
            />
            </el-form-item>  
        <!--水分（%）<=--> 
            <el-form-item label="水分（%）<=">
                <el-input
              @input="waterContentchange"
              v-model="dataList.waterContent"
              placeholder="请输入水分占比"
              maxlength="120"
              size="small"
            />
            </el-form-item>  
          <!--单价(元/吨)-->  
            <el-form-item label="单价(元/吨)">
               <el-input
              @input="unitPricechange"
              v-model="dataList.unitPrice"
              placeholder="请输入单价"
              maxlength="120"
              size="small"
            />
            </el-form-item>
          <!--预计入库日期-->
          <el-form-item
            label="预计入库日期"
            span="1"
            prop="inOutDate"
            class="deliverydate"
          >
            <el-date-picker
              v-model="dataList.inOutDate"
              type="date"
              placeholder="请选择预计入库日期"
              value-format="yyyy-MM-dd"
            />
          </el-form-item>   
          <!--经办人-->
         <el-form-item label="入库经办人">
              <el-select
              v-model="dataList.agent"
              placeholder="请选择经办人"
              filterable
              :filter-method="dataFilter"
              @change="selectstaff"
            >
              <el-option
                v-for="item in options"
                :key="item.value"
                :label="item.staffName"
                :value="item.staffName"
              />
            </el-select>
          </el-form-item>
        <!--业务描述=-->
          <el-form-item label="业务描述" >
            <el-input
              @input="businessDescriptionchange"
              v-model="dataList.businessDescription"
              placeholder="请输入业务描述，不超过150字"
              maxlength="150"
              size="small"
            />
          </el-form-item>   
</el-form>

<!--移库-->      
    <div class="small-title"><h3>出库任务( )</h3></div>
            <el-form ref="form" :model="form" label-width="140px">
          <!-- 仓库名 -->
          <el-form-item label="仓库名">
             <el-select
              v-model="dataList.warehouseName"
              placeholder="请选择仓库"
              class="typeselect"
              @change="selectwarehouseName"
            >
              <el-option
                v-for="item in warehouseNameList"
                :key="item.constKey"
                :label="item.constValue"
                :value="item.constValue"
              />
            </el-select>
          </el-form-item>
          <!-- 出库类型 -->
            <el-form-item label="出库类型">
                {{}}
             </el-form-item>
            <!--移库任务编号-->
            <el-form-item label="移库任务编号">
                <el-input
              @input="mobileTaskNochange"
              v-model="dataList.mobileTaskNo"
              placeholder="请输入移库任务编号"
              maxlength="120"
              size="small"
            />
            </el-form-item>
            <!-- 货名 -->
              <el-form-item label="货名">
                  {{}}
            </el-select>
                </el-form-item>
          <!--重量（吨）-->
            <el-form-item label="重量（吨）">
                <el-input
              @input="weightchange"
              v-model="dataList.weight"
              placeholder="请输入重量"
              maxlength="120"
              size="small"
            />
            </el-form-item>
          <!-- 品级 -->
            <el-form-item label="品级">
                <el-select
              v-model="dataList.grade"
              placeholder="一等品"
              class="typeselect"
              @change="selectpackingMethod"
            >
              <el-option
                v-for="item in gradeList"
                :key="item.constKey"
                :label="item.constValue"
                :value="item.constValue"
              />
            </el-select>
            </el-form-item>
          <!--容重（克/升）>=-->
            <el-form-item label="容重（克/升）>=">
                    <el-input
              @input="bulkDensitychange"
              v-model="dataList.bulkDensity"
              placeholder="请输入容重"
              maxlength="120"
              size="small"
            />
            </el-form-item>  
        <!--水分（%）<=--> 
            <el-form-item label="水分（%）<=">
                <el-input
              @input="waterContentchange"
              v-model="dataList.waterContent"
              placeholder="请输入水分占比"
              maxlength="120"
              size="small"
            />
            </el-form-item>  
          <!--单价(元/吨)-->  
            <el-form-item label="单价(元/吨)">
               <el-input
              @input="unitPricechange"
              v-model="dataList.unitPrice"
              placeholder="请输入单价"
              maxlength="120"
              size="small"
            />
            </el-form-item>
          <!--预计出库日期-->
          <el-form-item
            label="预计出库日期"
            span="1"
            prop="deliveryDate"
            class="deliverydate"
          >
            <el-date-picker
              v-model="dataList.deliveryDate"
              type="date"
              placeholder="请选择预计出库日期"
              value-format="yyyy-MM-dd"
            />
          </el-form-item>   
          <!--经办人-->
         <el-form-item label="出库经办人">
              <el-select
              v-model="dataList.agent"
              placeholder="请选择经办人"
              filterable
              :filter-method="dataFilter"
              @change="selectstaff"
            >
              <el-option
                v-for="item in options"
                :key="item.value"
                :label="item.staffName"
                :value="item.staffName"
              />
            </el-select>
          </el-form-item>           
</el-form>
<div class="small-title"><h3>入库任务( )</h3></div>
            <el-form ref="form" :model="form" label-width="140px">
          <!-- 仓库名 -->
          <el-form-item label="仓库名">
             <el-select
              v-model="dataList.warehouseName"
              placeholder="请选择仓库"
              class="typeselect"
              @change="selectwarehouseName"
            >
              <el-option
                v-for="item in warehouseNameList"
                :key="item.constKey"
                :label="item.constValue"
                :value="item.constValue"
              />
            </el-select>
          </el-form-item>
          <!-- 入库类型 -->
            <el-form-item label="入库类型">
                {{}}
             </el-form-item>
            <!--移库任务编号-->
            <el-form-item label="移库任务编号">
              {{}}
            </el-form-item>
            <!-- 货名 -->
              <el-form-item label="货名">
                  {{}}
            </el-select>
                </el-form-item>
          <!--重量（吨）-->
            <el-form-item label="重量（吨）">
                <el-input
              @input="weightchange"
              v-model="dataList.weight"
              placeholder="请输入重量"
              maxlength="120"
              size="small"
            />
            </el-form-item>
          <!-- 品级 -->
            <el-form-item label="品级">
             {{}}
            </el-form-item>
          <!--容重（克/升）>=-->
            <el-form-item label="容重（克/升）>=">
              {{}}
            </el-form-item>  
        <!--水分（%）<=--> 
            <el-form-item label="水分（%）<=">
           {{}} 
            </el-form-item>  
          <!--单价(元/吨)-->  
            <el-form-item label="单价(元/吨)">
           {{}}
            </el-form-item>
          <!--预计入库日期-->
          <el-form-item
            label="预计入库日期"
            span="1"
            prop="inOutDate"
            class="deliverydate"
          >
            <el-date-picker
              v-model="dataList.inOutDate"
              type="date"
              placeholder="请选择预计入库日期"
              value-format="yyyy-MM-dd"
            />
          </el-form-item>   
          <!--经办人-->
         <el-form-item label="入库经办人">
              <el-select
              v-model="dataList.agent"
              placeholder="请选择经办人"
              filterable
              :filter-method="dataFilter"
              @change="selectstaff"
            >
              <el-option
                v-for="item in options"
                :key="item.value"
                :label="item.staffName"
                :value="item.staffName"
              />
            </el-select>
          </el-form-item>
        <!--业务描述=-->
          <el-form-item label="业务描述" >
            <el-input
              @input="businessDescriptionchange"
              v-model="dataList.businessDescription"
              placeholder="请输入业务描述，不超过150字"
              maxlength="150"
              size="small"
            />
          </el-form-item>           
</el-form>

<!--退库并出库-->      
    <div class="small-title"><h3>入库任务( )</h3></div>
            <el-form ref="form" :model="form" label-width="140px">
          <!-- 仓库名 -->
          <el-form-item label="仓库名">
             <el-select
              v-model="dataList.warehouseName"
              placeholder="请选择仓库"
              class="typeselect"
              @change="selectwarehouseName"
            >
              <el-option
                v-for="item in warehouseNameList"
                :key="item.constKey"
                :label="item.constValue"
                :value="item.constValue"
              />
            </el-select>
          </el-form-item>
          <!-- 入库类型 -->
            <el-form-item label="入库类型">
                {{}}
             </el-form-item>
            <!-- 合同编号 -->
              <el-form-item label="合同编号">
                    <el-select
                        v-model="dataList.contractNo"
                        placeholder="请选择合同编号"
                        class="typeselect"
            >
              <el-option
                v-for="item in outContractNo"
                :key="item.constKey"
                :label="item.contractNo"
                :value="item.contractNo"
              />
            </el-select>
                </el-form-item>
            <!-- 货名 -->
              <el-form-item label="货名">
                  {{}}
            </el-select>
                </el-form-item>
          <!--重量（吨）-->
            <el-form-item label="重量（吨）">
                <el-input
              @input="weightchange"
              v-model="dataList.weight"
              placeholder="请输入重量"
              maxlength="120"
              size="small"
            />
            </el-form-item>
          <!-- 品级 -->
            <el-form-item label="品级">
                <el-select
              v-model="dataList.grade"
              placeholder="一等品"
              class="typeselect"
              @change="selectpackingMethod"
            >
              <el-option
                v-for="item in gradeList"
                :key="item.constKey"
                :label="item.constValue"
                :value="item.constValue"
              />
            </el-select>
            </el-form-item>
          <!--容重（克/升）>=-->
            <el-form-item label="容重（克/升）>=">
                    <el-input
              @input="bulkDensitychange"
              v-model="dataList.bulkDensity"
              placeholder="请输入容重"
              maxlength="120"
              size="small"
            />
            </el-form-item>  
        <!--水分（%）<=--> 
            <el-form-item label="水分（%）<=">
                <el-input
              @input="waterContentchange"
              v-model="dataList.waterContent"
              placeholder="请输入水分占比"
              maxlength="120"
              size="small"
            />
            </el-form-item>  
          <!--单价(元/吨)-->  
            <el-form-item label="单价(元/吨)">
               <el-input
              @input="unitPricechange"
              v-model="dataList.unitPrice"
              placeholder="请输入单价"
              maxlength="120"
              size="small"
            />
            </el-form-item>
          <!--预计入库日期-->
          <el-form-item
            label="预计入库日期"
            span="1"
            prop="inOutDate"
            class="deliverydate"
          >
            <el-date-picker
              v-model="dataList.inOutDate"
              type="date"
              placeholder="请选择预计入库日期"
              value-format="yyyy-MM-dd"
            />
          </el-form-item>   
          <!--经办人-->
         <el-form-item label="入库经办人">
              <el-select
              v-model="dataList.agent"
              placeholder="请选择经办人"
              filterable
              :filter-method="dataFilter"
              @change="selectstaff"
            >
              <el-option
                v-for="item in options"
                :key="item.value"
                :label="item.staffName"
                :value="item.staffName"
              />
            </el-select>
          </el-form-item>           
</el-form>
<div class="small-title"><h3>出库任务( )</h3></div>
            <el-form ref="form" :model="form" label-width="140px">
          <!-- 仓库名 -->
          <el-form-item label="仓库名">
            {{}}
          </el-form-item>
          <!-- 出库类型 -->
            <el-form-item label="入库类型">
                {{}}
             </el-form-item>
            <!-- 合同编号 -->
              <el-form-item label="合同编号">
                    <el-select
                        v-model="dataList.contractNo"
                        placeholder="请选择合同编号"
                        class="typeselect"
            >
              <el-option
                v-for="item in outContractNo"
                :key="item.constKey"
                :label="item.contractNo"
                :value="item.contractNo"
              />
            </el-select>
                </el-form-item>
            <!-- 货名 -->
              <el-form-item label="货名">
                  {{}}
            </el-select>
                </el-form-item>
          <!--重量（吨）-->
            <el-form-item label="重量（吨）">
               {{}}
            </el-form-item>
          <!-- 品级 -->
            <el-form-item label="品级">
             {{}}
            </el-form-item>
          <!--容重（克/升）>=-->
            <el-form-item label="容重（克/升）>=">
              {{}}
            </el-form-item>  
        <!--水分（%）<=--> 
            <el-form-item label="水分（%）<=">
           {{}} 
            </el-form-item>  
          <!--单价(元/吨)-->  
            <el-form-item label="单价(元/吨)">
           {{}}
            </el-form-item>
          <!--预计出库日期-->
          <el-form-item
            label="预计出库日期"
            span="1"
            prop="deliveryDate"
            class="deliverydate"
          >
            <el-date-picker
              v-model="dataList.deliveryDate"
              type="date"
              placeholder="请选择预计出库日期"
              value-format="yyyy-MM-dd"
            />
          </el-form-item>   
          <!--经办人-->
         <el-form-item label="出库经办人">
              <el-select
              v-model="dataList.agent"
              placeholder="请选择经办人"
              filterable
              :filter-method="dataFilter"
              @change="selectstaff"
            >
              <el-option
                v-for="item in options"
                :key="item.value"
                :label="item.staffName"
                :value="item.staffName"
              />
            </el-select>
          </el-form-item>
        <!--业务描述=-->
          <el-form-item label="业务描述" >
            <el-input
              @input="businessDescriptionchange"
              v-model="dataList.businessDescription"
              placeholder="请输入业务描述，不超过150字"
              maxlength="150"
              size="small"
            />
          </el-form-item>           
</el-form>

</div>
      </div>      
            <!-- 提交 -->
    <div style="text-align: right; padding: 10px" class="center">
      <el-button
        class="bg-bottom"
        type="primary"
        size="small"
        @click="submit(deptBudgetList)"
        >提交</el-button
      >
    </div>
  </div>
</template>
<script>
import {
  pullDown,
  addstorageputList,
  xialaNo,
  getstaff,
} from '@/model/warehouse/index'
import { downloadFile } from '@/utils/batchDown'
import Pagination from '@/components/Pagination'
import { mapActions, mapGetters, mapState } from 'vuex'
import WsUpload from '@/components/WsUpload'
// import { dayjs, fmoney, EventBus } from 'base-core-lib'
import { dayjs, EventBus } from 'base-core-lib'
export default {
  name: 'viewSpareMoney',
  components: {
    WsUpload,
    Pagination,
  },
  watch: {
    // vesselId(val) {
    //   this.getList()
    // },
    isShow(val) {
      this.showType = val
    },
  },
  computed: {
    ...mapGetters(['deptBudgetList']),
  },
  data() {
    return {
      //弹出框
      dialogViewSpareMoney: false,
      dialogApproveFormVisible: false,
      // 船舶类型
      monetaryKey: null,
      // 表格显示数据
      tableDate: [],
      // 是否显示
      showType: true,
      // 年
      year: '',
      deptBudgetTotal: 0,
      readonly: true,
      currentPage: 1,
      pageSize: 10,
      searchType: 1,
      searchKeyWord: '',
      radio:'1',
      contractType: 2,
      startDate: null,
      endDate: null,
      goodnameList: {},
      checked: true,
      form:{},

      staffList: [],
      options: [],
      storageType: [],
      deliveryType: [],
      outContractNo: [],
      // 提交类型
      submitType: true,
      storageType: [],
      status:[],
      weightchange:[],
      unitPricechange:[],
      selectwarehouseName:[],
      warehouseNameList:[],
      businessDescriptionchange:[],
      bulkDensitychange:[],
      waterContentchange:[],
      appendixIdsAdd: '',
      uploadSuccess: {},
      warehouseInOutDetail: {},
      onChange: {},
      deptBudgetList1: [],
      gradeList: [],
      rules: {
        netWeight: [
          {
            required: true,
            type: 'number',
            message: '请输入活动名称',
            trigger: 'blur',
          },
        ],
      },
      size: 10,
      compId: sessionStorage.getItem('ws-pf_compId'),
      deptCircularPage: {},
      packtypeList: {},
      date: {
        year: dayjs().format('YYYY'),
        month: dayjs().format('MM'),
      },
      contractList: [],
      warehouseList:{
          records:[]

      },
      dataList: {
        id: '',
        grossWeight: '',
        contractNo: '',
        tare: '',
        netWeight: '',
        grade: '',
        agent: '',
        carNo: '',
        inOutDate: '',
        inOutType: '',
        goodsName: '',
        warehouseInOutDetail: {},
      },
      historyList: [],
      pickerBeginDateBefore: {
        disabledDate: (time) => {
          return time.getTime() > Date.now()
        },
      },
      accessoryTFs: false,
    }
  },
  activated() {
    this.deptBudgetList1.warehouseName = this.$route.query.warehouseName
    this.deptBudgetList1.binNumber = this.$route.query.binNumber
    this.getList()
    this.dataList.id = this.$route.query.id
    this.dataList.grossWeight = this.$route.query.grossWeight
    this.dataList.contractNo = this.$route.query.contractNo
    this.dataList.baseId = this.$route.query.baseId
    this.dataList.positionId = this.$route.query.positionId
    this.dataList.warehouseName = this.$route.query.warehouseName
    this.dataList.binNumber = this.$route.query.binNumber
    this.dataList.tare = this.$route.query.tare
    this.dataList.netWeight = this.$route.query.netWeight
    this.dataList.grade = this.$route.query.grade
    this.dataList.agent = this.$route.query.agent
    this.dataList.carNo = this.$route.query.carNo
    this.dataList.inOutDate = this.$route.query.inOutDate
    this.dataList.contractNo = this.$route.query.contractNo
    this.dataList.inOutType = this.$route.query.inOutType
    this.dataList.compId = this.$route.query.compId
    this.dataList.goodsName = this.$route.query.goodsName
    this.dataList.goodsNameKey = Number(this.$route.query.goodsNameKey)
    this.dataList.inOutFlag = this.$route.inOutFlag
    this.dataList.inOutTypeKey = Number(this.$route.query.inOutTypeKey)
    this.dataList.statusFlag = this.$route.statusFlag
    this.dataList.warehouseInOutDetail = this.$route.query.warehouseInOutDetail
    this.deptBudgetList.warehouseType = this.$route.query.warehouseType
  },
  methods: {
    //返回按钮
    revert() {
      this.$router.go(-1)
    },
    dataFilter(val) {
      // console.log(val,"名")
      this.deptBudgetList.staffList = val
      if (val) {
        //val存在
        this.options = this.staffList.filter((item) => {
          if (
            !!~item.staffName.indexOf(val) ||
            !!~item.staffName.toUpperCase().indexOf(val.toUpperCase())
          ) {
            return true
          }
        })
      } else {
        //val为空时，还原数组
        this.options = this.staffList
      }
    },
    selectstaff(e) {
      for (var i = 0; i < this.staffList.length; i++) {
        if (this.staffList[i].staffName == e) {
          this.deptBudgetList.personChargeKey = this.staffList[i].staffId
        }
      }
    },
    //提交按钮
    submit() {
      if (!this.dataList.warehouseName) {
        this.$message({
          message: '仓库名不能为空',
          type: 'warning',
        })
        return
      }
      if (!this.dataList.weight) {
        this.$message({
          message: '重量不能为空',
          type: 'warning',
        })
        return
      }
      if (
        this.dataList.weight <= 0 ||
        this.dataList.weight > 10000 ||
        (String(this.dataList.weight).indexOf('.') != -1 &&
          String(this.dataList.weight).length -
            (String(this.dataList.weight).indexOf('.') + 1) >
            3)
      ) {
        this.$message({
          message: '重量输入错误',
          type: 'warning',
        })
        return
      }
      if (!this.dataList.agent) {
        this.$message({
          message: '经办人不能为空',
          type: 'warning',
        })
        return
      }
      if (this.dataList.agent.length < 2 || this.dataList.agent.length > 10) {
        this.$message({
          message: '经办人输入有误',
          type: 'warning',
        })
        return
      }
      if (!this.dataList.grade) {
        this.$message({
          message: '品级不能为空！',
          type: 'warning',
        })
        return
      }
      if (!this.dataList.inOutDate) {
        this.$message({
          message: '预计出库日期不能为空！',
          type: 'warning',
        })
        return
      }
      if (!this.dataList.inOutType) {
        this.$message({
          message: '出库类型不能为空！',
          type: 'warning',
        })
        return
      }
      if (!this.dataList.contractNo) {
        this.$message({
          message: '合同编号不能为空',
          type: 'warning',
        })
        return
      }
      if (
        this.dataList.contractNo.length < 6 ||
        this.dataList.contractNo.length > 20
      ) {
        this.$message({
          message: '合同编号长度不符合要求,请输入6-20个字符之内',
          type: 'warning',
        })
        return
      }

      if (this.dataList.netWeight > this.$route.query.capacity) {
        this.$message({
          message: '入库量大于该仓库容量！',
          type: 'warning',
        })
        return
      }
      this.$confirm(`确定提交任务信息`, {
        cancelButtonText: '取消',
        confirmButtonText: '确定',
        type: 'warning',
      })
        .then(() => {
          this.$refs.dataList.validate((valid) => {
            if (valid) {
              this.dataList.compId = sessionStorage.getItem('el-pf_compId')
              this.dataList.inOutFlag = 2
              this.dataList.statusFlag = 3
              addstorageputList(this.dataList)
                .toPromise()
                .then((response) => {
                  this.$message.success('添加成功')
                  this.$router.push({ path: 'warehouseManagementList' })
                })
            } else {
              EventBus.$emit('error', this.$t('showMessage.asteriskRequired'))
              return false
            }
          })
        })
        .catch(() => {
          return false
        })
    },
    tarechange(e) {
      if (this.dataList.grossWeight && this.dataList.tare) {
        this.dataList.netWeight = Number(
          this.dataList.grossWeight - this.dataList.tare
        )
      }
    },
    grossWeightchange(e) {
      if (this.dataList.grossWeight && this.dataList.tare) {
        this.dataList.netWeight = Number(
          this.dataList.grossWeight - this.dataList.tare
        )
      }
    },
    selectgoodsName(e) {
      for (var i = 0; i < this.goodnameList.length; i++) {
        if (this.goodnameList[i].constValue == e) {
          this.dataList.goodsNameKey = this.goodnameList[i].constKey
        }
      }
    },
    selectpackingMethod(e) {
      for (var i = 0; i < this.packtypeList.length; i++) {
        if (this.packtypeList[i].constValue == e) {
          this.dataList.packingMethodKey = this.packtypeList[i].constKey
        }
      }
    },
    selectstorageType(e) {
      for (var i = 0; i < this.storageType.length; i++) {
        if (this.storageType[i].constValue == e) {
          this.dataList.inOutTypeKey = this.storageType[i].constKey
        }
      }
    },
    handleClose() {
      this.accessoryTFs = false
    },
    handleSizeChange(val) {
      console.log(`每页 ${val} 条`)
      this.pageSize = val
      this.getList()
    },
    handleCurrentChange(val) {
      this.currentPage = val
      console.log(`当前页: ${val}`)
      this.getList()
    },
    getList() {
      // 货名
      pullDown({ constId: 'CON2' })
        .toPromise()
        .then((response) => {
          this.goodnameList = response
        })
      // 品级
      pullDown({ constId: 'CON3' })
        .toPromise()
        .then((response) => {
          this.gradeList = response
        })
      // 类型
      if (this.$route.query.warehouseType == '1') {
        pullDown({ constId: 'CON5' })
          .toPromise()
          .then((response) => {
            this.storageType = response
          })
      } else if (this.$route.query.warehouseType == '2') {
        //临时仓库入库类型
        pullDown({ constId: 'WARE1' })
          .toPromise()
          .then((response) => {
            this.storageType = respons
          })
        //临时仓库出库类型
        pullDown({ constId: 'WARE2' })
          .toPromise()
          .then((response) => {
            this.deliveryType = response
          })
      }
      //合同编号
      xialaNo({ compId: sessionStorage.getItem('ws-pf_compId') })
        .toPromise()
        .then((response) => {
          this.outContractNo = response
        })
      //经办人
      getstaff({ compId: sessionStorage.getItem('ws-pf_compId') })
        .toPromise()
        .then((response) => {
          this.options = response
          this.staffList = response
          //  this.agent = response
        })
    },
    selecttaskType(e) {
      for (var i = 0; i < this.taskTypeList.length; i++) {
        if (this.taskTypeList[i].value == e) {
          this.searchType = this.taskTypeList[i].type
        }
      }
    },
    fujian(row) {
      if (
        row.receiveAttachmentPath === null ||
        row.receiveAttachmentPath === ''
      ) {
        EventBus.$emit(
          'warning',
          this.$t('system.noticeCircular.NoInformation')
        )
      } else {
        this.accessoryTFs = true
      }
      this.appendixIdss = row.receiveAttachmentPath
    },
    handleExamine(row) {
      this.$router.push({
        name: 'salesContractExamine',
        query: { id: row.id },
      })
    },

    // 关闭 dialog时 处理文件url 初始化upload组件
    handleCloe() {
      this.dialogViewSpareMoney = false
    },
    history(row) {
      console.log(row)
      billoperatehis({ id: row.id })
        .toPromise()
        .then((response) => {
          this.historyList = response
        })
    },

    async exportlist() {
      const { data } = await export1(
        {
          compId: sessionStorage.getItem('ws-pf_compId'),
          contractType: this.contractType,
          currentPage: this.currentPage,
          pageSize: this.pageSize,
          searchType: this.searchType,
          searchKeyWord: this.searchKeyWord,
          startDate: this.startDate,
          endDate: this.endDate,
        },
        {},
        { responseType: 'blob' }
      ).toPromise()
      downloadFile({
        res: data,
        fileName: `${
          this.date.year + (this.date.month ? `-${this.date.month}` : '')
        }_采购合同`,
        type: 'xls',
      })
    },

    // deletecontract(){},
    //删除
    approve() {},
    listQuery() {},
    total() {},
    clearfiltQuery() {},
    selectCrtDuty() {},
  },
}
</script>
<style lang="scss" scoped>
/deep/.basicInformation {
  .el-info-table {
    border: none;
    position: relative;
  }
  .el-form-item {
    width: 33.3333%;
    border: none;
    margin: 0;
  .el-form-item__label {
    text-align: left;
    font-size: 14px;
    font-family: PingFangSC-Regular, PingFang SC;
    font-weight: 400;
    color: #8890b1;
  }
    .el-form-item__content {
   padding-left: 0px;
    padding-right: 10px;
    background: #fff;
    white-space: nowrap;
    height: 40px;
    display: flex;
    -webkit-box-align: center;
    align-items: center;
    text-align: left;
    overflow: hidden;
    }
  }
}
/deep/.el-radio {
    color: #606266;
    font-weight: 500;
    line-height: 1;
    cursor: pointer;
    white-space: nowrap;
    outline: 0;
    margin-right: 30px;
    margin-top: 15px;
}
/deep/.el-radio__inner {
    border: 1px solid #dcdfe6;
    border-radius: 100%;
    width: 14px;
    height: 14px;
    background-color: #fff;
    cursor: pointer;
    -webkit-box-sizing: border-box;
    box-sizing: border-box;
    margin-left: 100px;
}
/deep/.el-radio__input {
     white-space: nowrap;
    cursor: pointer;
    outline: 0;
    line-height: 1;
    vertical-align: middle;
    margin-top: -1px;
}
.title {
  position: relative;
  padding-left: 10px;
}
.title::before {
  content: '';
  display: inline-block;
  width: 5px;
  height: 30px;
  background: #5473e8;
  position: absolute;
  left: 0;
}
.el-form {
    padding: 0 15%;
    display: flex;
    flex-wrap: wrap;
    margin-left: -50px;
    margin-top: 15px;
    width:110%;
}
.el-button--primary {
  background-color: #5878e8;
  border-color: #5878e8;
}
.el-col {
  background: #f6f7fc;
}
.bg-right {
  text-align: right;
  padding: 16px 20px;
}
.center {
  position: relative;
  top: 50px;
  width: 40%;
  height: 2000px;
  margin: 0 auto;
  margin-right: 180px;
}
/deep/.el-form-item__label {
  width: 160px;
}
.inspector {
  width: 50%;
}
/deep/.el-form-item--small .el-form-item__label, .el-form-item--small .el-form-item__content {
    text-align: left;
}
/deep/.el-input--small {
    font-size: 13px;
    position: relative;
    display: inline-block;
}
.center1 .small-title{
  margin-left:150px;
}
.center1{
width: 90%;
margin:0 auto;
margin-left: 10px;
margin-top: 25px;
}
/deep/.el-input--small .el-input__inner {
    height: 32px;
    line-height: 32px;
}
/deep/.el-select {
    display: inline-block;
    position: relative;
    width: 100%;
}
</style>
