wangchao 1 gadu atpakaļ
vecāks
revīzija
205f1e7188
2 mainītis faili ar 635 papildinājumiem un 519 dzēšanām
  1. 310 260
      src/views/boundManagement/outbound.vue
  2. 325 259
      src/views/warehousing/index.vue

+ 310 - 260
src/views/boundManagement/outbound.vue

@@ -5,9 +5,10 @@
          
       </el-col>
       <el-col style="padding-right:1%;" :span="13" class="bg-right">
-        <el-button class="bg-bottom add" size="small" type="text"  @click="add()">新增</el-button>
-        <el-button style="border:1px solid #409eff;" class="bg-bottom" type="primary" size="small" @click="save()">保存</el-button>
-        
+        <el-button class="bg-bottom add" size="small" type="text" @click="add()">新增</el-button>
+        <el-button style="border:1px solid #409eff;" class="bg-bottom" type="primary" size="small"
+          @click="save()">保存</el-button>
+
       </el-col>
       <el-col :span="1">
         &nbsp;
@@ -17,9 +18,9 @@
     <div class="enterTextWrap">
       <div class="flex-1">
         <div class="weign">
-          <BalanceAlert ref="weightChild" :deptBudgetList="form" :information="information"
-          v-on:balanceListen="setVal" class="zujian">
-        </BalanceAlert>
+          <BalanceAlert ref="weightChild" :deptBudgetList="form" :information="information" v-on:balanceListen="setVal"
+            class="zujian">
+          </BalanceAlert>
           <!-- <div>{{weigntext?'':''}}</div>
           <div></div>
           <div></div> -->
@@ -28,44 +29,52 @@
       <div class="flex-2 flex-justify-space-between">
         <div class="form">
           <el-form ref="form" :model="form" label-position="right" label-width="120px">
-            <el-form-item style="position:absolute;top:28px;" v-if="this.form.businessNo" class="form-title businessNo" label="业务编号:">
-              {{this.form.businessNo}}
+            <el-form-item v-if="this.form.businessNo" class="form-title businessNo"
+              label="业务编号:">
+              {{ this.form.businessNo }}
             </el-form-item>
-            <el-form-item  class="form-title" label="称重信息">
-                <el-checkbox v-hasPermission="`speedEdition.inWarehouseJsb.edit` " @change="checkedchange" v-model="checked">允许手动编辑重量</el-checkbox>
+            <el-form-item class="form-title" label="称重信息">
+              <el-checkbox v-hasPermission="`speedEdition.inWarehouseJsb.edit`" @change="checkedchange"
+                v-model="checked">允许手动编辑重量</el-checkbox>
             </el-form-item>
             <el-form-item class="handEdit" label="皮重(公斤)">
-              <el-input @mousewheel.native.prevent type="number" @input="tareInput" :disabled="!checked" placeholder="输入皮重" v-model="form.tare"></el-input>
+              <el-input @mousewheel.native.prevent type="number" @input="tareInput" :disabled="!checked"
+                placeholder="输入皮重" v-model="form.tare"></el-input>
               <el-button @click="gain(1)" type="text">获取</el-button>
             </el-form-item>
             <el-form-item class="handEdit" label="毛重(公斤)">
-              <el-input @mousewheel.native.prevent type="number" @input="grossWeightInput" :disabled="!checked" placeholder="输入毛重" v-model="form.grossWeight"></el-input>
+              <el-input @mousewheel.native.prevent type="number" @input="grossWeightInput" :disabled="!checked"
+                placeholder="输入毛重" v-model="form.grossWeight"></el-input>
               <el-button @click="gain(0)" type="text">获取</el-button>
             </el-form-item>
             <el-form-item label="净重(公斤)">
               <el-input disabled placeholder="自动计算" v-model="form.netWeight"></el-input>
             </el-form-item>
-            <el-form-item   class="form-title" label="基本信息">
+            <el-form-item class="form-title" label="基本信息">
             </el-form-item>
             <el-form-item class="handEdit kehu" label="客户姓名">
-              <el-select v-if="text=='手输'" ref="select" @change="customerChange" filterable clearable placeholder="输入客户姓名" v-model="form.customerName" >
-                <el-option v-for="item in customerOptions" :key="item.id" :label="item.customerName+'('+item.customerPhone+')'" :value="item.customerName"></el-option>
+              <el-select v-if="text == '手输'" ref="select" @change="customerChange" filterable clearable placeholder="输入客户姓名"
+                v-model="form.customerName">
+                <el-option v-for="item in customerOptions" :key="item.id"
+                  :label="item.customerName + '(' + item.customerPhone + ')'" :value="item.customerName"></el-option>
               </el-select>
               <el-input v-else placeholder="输入客户姓名" v-model="form.customerName"></el-input>
-              <el-button class="bg-bottom" type="primary" size="small" @click="textchange()">{{text}}</el-button>
+              <el-button class="bg-bottom" type="primary" size="small" @click="textchange()">{{ text }}</el-button>
             </el-form-item>
             <el-form-item label="车牌号">
               <el-input maxlength="8" placeholder="输入毛重车牌号" v-model="form.carNumber"></el-input>
             </el-form-item>
             <el-form-item label="仓位号">
-              <el-select filterable clearable @change="positionNoChange" placeholder="输入仓位号" v-model="form.positionId" >
-                <el-option v-for="item in positionOptions" :key="item.id" :label="item.positionNo" :value="item.id"></el-option>
+              <el-select filterable clearable @change="positionNoChange" placeholder="输入仓位号" v-model="form.positionId">
+                <el-option v-for="item in positionOptions" :key="item.id" :label="item.positionNo"
+                  :value="item.id"></el-option>
               </el-select>
             </el-form-item>
-            <el-form-item   class="form-title" label="定价信息">
+            <el-form-item class="form-title" label="定价信息">
             </el-form-item>
             <el-form-item label="单价(元/吨)">
-              <el-input @mousewheel.native.prevent type="number" @input="unitPriceInput" placeholder="输入单价" v-model="form.unitPrice"></el-input>
+              <el-input @mousewheel.native.prevent type="number" @input="unitPriceInput" placeholder="输入单价"
+                v-model="form.unitPrice"></el-input>
             </el-form-item>
             <el-form-item label="粮款(元)">
               <el-input @mousewheel.native.prevent type="number" placeholder="自动计算" v-model="form.grainFund"></el-input>
@@ -73,19 +82,21 @@
           </el-form>
         </div>
         <div class="form">
-          <el-form  ref="form" :model="form" label-position="right" label-width="120px">
-            <el-form-item   class="form-title" label="质检信息">
+          <el-form ref="form" :model="form" label-position="right" label-width="120px">
+            <el-form-item class="form-title" label="质检信息">
             </el-form-item>
             <el-form-item label="货名">
-              <el-select filterable clearable placeholder="选择货名" v-model="form.goodsName" >
-                <el-option v-for="item in goodOptions" :key="item.id" :label="item.goodsName" :value="item.goodsName"></el-option>
+              <el-select filterable clearable placeholder="选择货名" v-model="form.goodsName">
+                <el-option v-for="item in goodOptions" :key="item.id" :label="item.goodsName"
+                  :value="item.goodsName"></el-option>
               </el-select>
             </el-form-item>
             <el-form-item label="容重(克/升)">
               <el-input @mousewheel.native.prevent type="number" placeholder="输入容重" v-model="form.bulkDensity"></el-input>
             </el-form-item>
             <el-form-item label="水分(%)">
-              <el-input @mousewheel.native.prevent type="number" placeholder="输入水分占比" v-model="form.waterContent"></el-input>
+              <el-input @mousewheel.native.prevent type="number" placeholder="输入水分占比"
+                v-model="form.waterContent"></el-input>
             </el-form-item>
             <el-form-item label="蛋白(%)">
               <el-input @mousewheel.native.prevent type="number" placeholder="输入蛋白占比" v-model="form.protein"></el-input>
@@ -94,13 +105,16 @@
               <el-input @mousewheel.native.prevent type="number" placeholder="输入杂质占比" v-model="form.impurity"></el-input>
             </el-form-item>
             <el-form-item label="霉变粒(%)">
-              <el-input @mousewheel.native.prevent type="number" placeholder="输入霉变粒占比" v-model="form.mildewGrain"></el-input>
+              <el-input @mousewheel.native.prevent type="number" placeholder="输入霉变粒占比"
+                v-model="form.mildewGrain"></el-input>
             </el-form-item>
             <el-form-item label="热损伤(%)">
-              <el-input @mousewheel.native.prevent type="number" placeholder="输入热损伤占比" v-model="form.jiaorenli"></el-input>
+              <el-input @mousewheel.native.prevent type="number" placeholder="输入热损伤占比"
+                v-model="form.jiaorenli"></el-input>
             </el-form-item>
             <el-form-item label="不完善粒(%)">
-              <el-input @mousewheel.native.prevent type="number" placeholder="输入不完善粒占比" v-model="form.imperfectGrain"></el-input>
+              <el-input @mousewheel.native.prevent type="number" placeholder="输入不完善粒占比"
+                v-model="form.imperfectGrain"></el-input>
             </el-form-item>
             <el-form-item label="备注">
               <el-input :rows="4" placeholder="输入备注,0-150个字" type="textarea" v-model="form.remark"></el-input>
@@ -113,7 +127,7 @@
       <el-row class="row_top">
         <el-col :span="12">
           <el-date-picker value-format='yyyy-MM-dd' v-model="value" type="daterange" unlink-panels range-separator="至"
-              start-placeholder="开始日期" end-placeholder="结束日期" class="data_css" @change="changeDate" ></el-date-picker>
+            start-placeholder="开始日期" end-placeholder="结束日期" class="data_css" @change="changeDate"></el-date-picker>
           <el-button class="bg-bottom" type="primary" size="small" @click="allinout()">全部</el-button>
         </el-col>
         <el-col :span="12" class="bg-right">
@@ -121,18 +135,20 @@
           <el-button class="find" type="primary" @click="find()">查找</el-button>
         </el-col>
       </el-row>
-      <el-table :data="tableData" stripe style="width: 100%">
-        <el-table-column  width="40">
+      <el-table :data="tableData" stripe style="width: 100%" @row-click="handleTableRow">
+        <el-table-column width="40">
           <template scope="scope">
-            <img v-if="!scope.row.select" style='width:15px;vertical-align: text-top;' @click='radiochange1(scope.row)' src="../../../public/img/wxz.png" alt="">
-            <img v-if="scope.row.select" style='width:15px;vertical-align: text-top;' @click='radiochange(scope.row)' src="../../../public/img/xz.png" alt="">
+            <img v-if="!scope.row.select" style='width:15px;vertical-align: text-top;' @click='radiochange1(scope.row)'
+              src="../../../public/img/wxz.png" alt="">
+            <img v-if="scope.row.select" style='width:15px;vertical-align: text-top;' @click='radiochange(scope.row)'
+              src="../../../public/img/xz.png" alt="">
           </template>
         </el-table-column>
         <el-table-column type="index" label="序号">
-            <template scope="scope">
-              <span v-if="scope.$index < 9">0{{ scope.$index + 1 }}</span>
-              <span v-else>{{ scope.$index + 1 }}</span>
-            </template>
+          <template scope="scope">
+            <span v-if="scope.$index < 9">0{{ scope.$index + 1 }}</span>
+            <span v-else>{{ scope.$index + 1 }}</span>
+          </template>
         </el-table-column>
         <el-table-column width="120" prop="businessNo" label="业务编号"></el-table-column>
         <el-table-column prop="positionNo" label="仓位"></el-table-column>
@@ -158,20 +174,17 @@
         <el-table-column width="120" prop="status" label="付款状态"></el-table-column>
         <el-table-column prop="address" label="操作" width="200">
           <template slot-scope="scope">
-            <el-button v-hasPermission="`speedEdition.inWarehouseJsb.delete` " @click="del(scope.row)" type="text">删除</el-button>
+            <el-button v-hasPermission="`speedEdition.inWarehouseJsb.delete`" @click="del(scope.row)"
+              type="text">删除</el-button>
           </template>
         </el-table-column>
       </el-table>
       <el-pagination @size-change="handleSizeChange" @current-change="handleCurrentChange" :current-page="currentPage"
-        style="text-align:center" :page-size="pageSize"
-        layout="total, sizes, prev, pager, next, jumper" :total="deptBudgetTotal">
+        style="text-align:center" :page-size="pageSize" layout="total, sizes, prev, pager, next, jumper"
+        :total="deptBudgetTotal">
       </el-pagination>
     </div>
-    <el-dialog
-      title="客户信息"
-      :visible.sync="dialogVisible"
-      width="30%"
-      :close-on-click-modal="false"
+    <el-dialog title="客户信息" :visible.sync="dialogVisible" width="30%" :close-on-click-modal="false"
       :before-close="handleClose">
       <el-form ref="form" label-width="80px">
         <el-form-item label="姓名">
@@ -221,32 +234,32 @@ export default {
   },
   data() {
     return {
-      tableData:[],
-      form:{
-        inOutFlag:1,
-        compId:localStorage.getItem('ws-pf_compId'),
-        goodsName:'玉米',
-        noFlag:'CK',
-        customerName:'',
-        grainFund:''
+      tableData: [],
+      form: {
+        inOutFlag: 1,
+        compId: localStorage.getItem('ws-pf_compId'),
+        goodsName: '玉米',
+        noFlag: 'CK',
+        customerName: '',
+        grainFund: ''
       },
-      information:'',
-      checked:false,
-      searchKeyWord:'',
-      compId:localStorage.getItem('ws-pf_compId'),
-      positionOptions:[],
-      goodOptions:[],
-      customerOptions:[],
-      startDate:'',
-      endDate:'',
-      text:'手输',
-      searchKeyWord:'',
-      currentPage:1,
-      pageSize:10,
-      value:[],
-      deptBudgetTotal:0,
-      dialogVisible:false,
-      customerData:{}
+      information: '',
+      checked: false,
+      searchKeyWord: '',
+      compId: localStorage.getItem('ws-pf_compId'),
+      positionOptions: [],
+      goodOptions: [],
+      customerOptions: [],
+      startDate: '',
+      endDate: '',
+      text: '手输',
+      searchKeyWord: '',
+      currentPage: 1,
+      pageSize: 10,
+      value: [],
+      deptBudgetTotal: 0,
+      dialogVisible: false,
+      customerData: {}
     };
   },
   filters: {
@@ -266,174 +279,197 @@ export default {
     starttime.setTime(starttime.getTime() - 3600 * 1000 * 24 * 30);
     const end = global.default.getDate();
     const start = global.default.getDate(starttime);
-    this.value=[start,end]
-    speedPositionInfoList({compId:this.compId}).toPromise().then((res)=>{
-      this.positionOptions=res
+    this.value = [start, end]
+    speedPositionInfoList({ compId: this.compId }).toPromise().then((res) => {
+      this.positionOptions = res
     })
-    var status=await getweight({compId:this.compId,functionType:4}).toPromise()
-    this.status=status?status:''
-    if(this.status&&this.status.value==1){
-      this.checked=true
+    var status = await getweight({ compId: this.compId, functionType: 4 }).toPromise()
+    this.status = status ? status : ''
+    if (this.status && this.status.value == 1) {
+      this.checked = true
     }
-    speedGoodsList({compId:this.compId}).toPromise().then((res)=>{
-      if(res.length>0){
+    speedGoodsList({ compId: this.compId }).toPromise().then((res) => {
+      if (res.length > 0) {
         for (let i = 0; i < res.length; i++) {
-          if(res[i].setDefault!=0){
-            this.form.goodsName=res[i].goodsName
+          if (res[i].setDefault != 0) {
+            this.form.goodsName = res[i].goodsName
           }
         }
       }
-      this.goodOptions=res
+      this.goodOptions = res
     })
-    
+
     this.getList()
   },
   beforeDestroy() {
- 
-    
+
+
   },
   methods: {
-    checkedchange(e){
-      if(e) var value=1
-      else var value=0
-      if(this.status){
-        setweight({compId:this.compId,functionType:4,value:value,id:this.status.id}).toPromise().then((res)=>{
+    handleTableRow(row, event, column) {
+      if (!row.select) {
+        for (var i = 0; i < this.tableData.length; i++) {
+          this.tableData[i].select = false
+        }
+        row.select = !row.select
+        this.form = JSON.parse(JSON.stringify(row))
+      } else {
+        row.select = !row.select
+        this.form = {
+          inOutFlag: 1,
+          compId: localStorage.getItem('ws-pf_compId'),
+          goodsName: '玉米',
+          noFlag: 'CK',
+          customerName: '',
+          grainFund: ''
+        }
+      }
+      this.form.grossWeight = this.form.grossWeight ? this.form.grossWeight * 1000 : null
+      this.form.tare = this.form.tare ? this.form.tare * 1000 : null
+      this.form.netWeight = this.form.netWeight ? this.form.netWeight * 1000 : null
+    },
+    checkedchange(e) {
+      if (e) var value = 1
+      else var value = 0
+      if (this.status) {
+        setweight({ compId: this.compId, functionType: 4, value: value, id: this.status.id }).toPromise().then((res) => {
           this.$message({
             type: 'success',
             message: '修改成功!'
           });
         })
-      }else{
-        setweight({compId:this.compId,functionType:4,value:value}).toPromise().then((res)=>{
+      } else {
+        setweight({ compId: this.compId, functionType: 4, value: value }).toPromise().then((res) => {
           this.$message({
             type: 'success',
             message: '修改成功!'
           });
         })
       }
-      
+
       console.log(e)
       // setweight
     },
-    allinout(){
-      this.value=[]
+    allinout() {
+      this.value = []
       this.getList()
     },
-    textchange(){
-      if(this.text=='手输'){
-        this.text='选择'
-      }else{
-        this.text='手输'
+    textchange() {
+      if (this.text == '手输') {
+        this.text = '选择'
+      } else {
+        this.text = '手输'
       }
-      localStorage.setItem('outtextstatus',this.text)
+      localStorage.setItem('outtextstatus', this.text)
     },
-    find(){
+    find() {
       this.getList()
     },
     openPort() {
       this.$refs.weightChild.openPort()
     },
-    gain(status){
-      if(status==0){
+    gain(status) {
+      if (status == 0) {
         this.information = '毛重'
-      }else{
+      } else {
         this.information = '皮重'
       }
       this.openPort()
     },
-    handleClose(){
-      this.dialogVisible=false
+    handleClose() {
+      this.dialogVisible = false
     },
-    radiochange1(row){
-      for(var i=0;i<this.tableData.length;i++){
-        this.tableData[i].select=false
+    radiochange1(row) {
+      for (var i = 0; i < this.tableData.length; i++) {
+        this.tableData[i].select = false
       }
-      row.select=!row.select
-      this.form=JSON.parse(JSON.stringify(row))
+      row.select = !row.select
+      this.form = JSON.parse(JSON.stringify(row))
     },
-    radiochange(row){
-      row.select=!row.select
-      this.form={
-        inOutFlag:1,
-        compId:localStorage.getItem('ws-pf_compId'),
-        goodsName:'玉米',
-        noFlag:'CK',
-        customerName:'',
-        grainFund:''
+    radiochange(row) {
+      row.select = !row.select
+      this.form = {
+        inOutFlag: 1,
+        compId: localStorage.getItem('ws-pf_compId'),
+        goodsName: '玉米',
+        noFlag: 'CK',
+        customerName: '',
+        grainFund: ''
       }
     },
-    unitPriceInput(e){
-      if(this.form.netWeight){
-        this.form.grainFund=Number(e*(this.form.netWeight/1000)).toFixed(3)
+    unitPriceInput(e) {
+      if (this.form.netWeight) {
+        this.form.grainFund = Number(e * (this.form.netWeight / 1000)).toFixed(3)
       }
     },
-    async lookCustomerName(row){
-      this.customerData=await getcustomer({customerId:row.customerId}).toPromise()
-      this.dialogVisible=true
+    async lookCustomerName(row) {
+      this.customerData = await getcustomer({ customerId: row.customerId }).toPromise()
+      this.dialogVisible = true
     },
-    positionNoChange(e){
+    positionNoChange(e) {
       for (let i = 0; i < this.positionOptions.length; i++) {
-        if(this.positionOptions[i].id==e){
-          this.form.positionNo=this.positionOptions[i].positionNo
+        if (this.positionOptions[i].id == e) {
+          this.form.positionNo = this.positionOptions[i].positionNo
         }
       }
     },
-    customerChange(e){
+    customerChange(e) {
       for (let i = 0; i < this.customerOptions.length; i++) {
-        if(this.customerOptions[i].customerName==e){
-          this.form.customerId=this.customerOptions[i].id
+        if (this.customerOptions[i].customerName == e) {
+          this.form.customerId = this.customerOptions[i].id
           console.log(this.form.customerId)
         }
       }
     },
-    grossWeightInput(e){
-      if(this.form.tare&&e) this.form.netWeight=e-this.form.tare
-      else this.form.netWeight=''
+    grossWeightInput(e) {
+      if (this.form.tare && e) this.form.netWeight = e - this.form.tare
+      else this.form.netWeight = ''
     },
-    tareInput(e){
-      if(this.form.grossWeight&&e) this.form.netWeight=this.form.grossWeight-e
-      else this.form.netWeight=''
+    tareInput(e) {
+      if (this.form.grossWeight && e) this.form.netWeight = this.form.grossWeight - e
+      else this.form.netWeight = ''
     },
-    changeDate(){
-      if(this.value){
+    changeDate() {
+      if (this.value) {
         this.startDate = this.value[0]
         this.endDate = this.value[1]
-      }else{
+      } else {
         this.startDate = ''
         this.endDate = ''
       }
       this.getList()
     },
-    getList(){
-      if(localStorage.getItem('outtextstatus')){
-        this.text=localStorage.getItem('outtextstatus')
+    getList() {
+      if (localStorage.getItem('outtextstatus')) {
+        this.text = localStorage.getItem('outtextstatus')
       }
-      if(this.value){
-        this.startDate=this.value[0]
-        this.endDate=this.value[1]
+      if (this.value) {
+        this.startDate = this.value[0]
+        this.endDate = this.value[1]
       }
-      speedCustomerInfoList({compId:this.compId,pageSize:9999,currentPage:1}).toPromise().then((res)=>{
-      // if(res.records.length>0){
-      //   this.form.customerId=res.records[0].id
-      //   this.form.customerName=res.records[0].customerName
-      // }
-      this.customerOptions=res.records
-    })
-      getList({compId:this.compId,
-        startDate:this.startDate,
-        endDate:this.endDate,
-        pageSize:this.pageSize,
-        currentPage:this.currentPage,
-        searchType:4,
-        searchKeyWord:this.searchKeyWord
-      }).toPromise().then((res)=>{
-        if(res.records.length>0){
+      speedCustomerInfoList({ compId: this.compId, pageSize: 9999, currentPage: 1 }).toPromise().then((res) => {
+        // if(res.records.length>0){
+        //   this.form.customerId=res.records[0].id
+        //   this.form.customerName=res.records[0].customerName
+        // }
+        this.customerOptions = res.records
+      })
+      getList({
+        compId: this.compId,
+        startDate: this.startDate,
+        endDate: this.endDate,
+        pageSize: this.pageSize,
+        currentPage: this.currentPage,
+        searchType: 4,
+        searchKeyWord: this.searchKeyWord
+      }).toPromise().then((res) => {
+        if (res.records.length > 0) {
           for (let i = 0; i < res.records.length; i++) {
-            res.records[i].select=false
+            res.records[i].select = false
           }
         }
-        this.tableData=res.records
-        this.deptBudgetTotal=res.total
+        this.tableData = res.records
+        this.deptBudgetTotal = res.total
       })
     },
     setVal(data) {
@@ -443,147 +479,150 @@ export default {
         this.form.tare = data
       }
     },
-    add(){
-      this.form={
-        inOutFlag:1,
-        compId:localStorage.getItem('ws-pf_compId'),
-        goodsName:'玉米',
-        noFlag:'CK',
-        customerName:'',
-        grainFund:''
+    add() {
+      this.form = {
+        inOutFlag: 1,
+        compId: localStorage.getItem('ws-pf_compId'),
+        goodsName: '玉米',
+        noFlag: 'CK',
+        customerName: '',
+        grainFund: ''
       }
-      for(var i=0;i<this.tableData.length;i++){
-        this.tableData[i].select=false
+      for (var i = 0; i < this.tableData.length; i++) {
+        this.tableData[i].select = false
       }
     },
-    save(){
-      if(this.form.grossWeight&&this.form.grossWeight<0||typeof Number(this.form.grossWeight) === 'Number'){
+    save() {
+      if (this.form.grossWeight && this.form.grossWeight < 0 || typeof Number(this.form.grossWeight) === 'Number') {
         this.$message({
           type: 'error',
           message: '毛重输入错误!'
         });
         return
       }
-      if(this.form.tare&&this.form.tare<0||typeof Number(this.form.tare) === 'Number'){
+      if (this.form.tare && this.form.tare < 0 || typeof Number(this.form.tare) === 'Number') {
         this.$message({
           type: 'error',
           message: '皮重输入错误!'
         });
         return
       }
-      if(this.form.netWeight&&this.form.netWeight<0||typeof Number(this.form.netWeight) === 'Number'){
+      if (this.form.netWeight && this.form.netWeight < 0 || typeof Number(this.form.netWeight) === 'Number') {
         this.$message({
           type: 'error',
           message: '净重输入错误!'
         });
         return
       }
-      if(this.form.unitPrice&&this.form.unitPrice<0||typeof Number(this.form.unitPrice) === 'Number'){
+      if (this.form.unitPrice && this.form.unitPrice < 0 || typeof Number(this.form.unitPrice) === 'Number') {
         this.$message({
           type: 'error',
           message: '单价输入错误!'
         });
         return
       }
-      if(this.form.grainFund&&this.form.grainFund<0||typeof Number(this.form.grainFund) === 'Number'){
+      if (this.form.grainFund && this.form.grainFund < 0 || typeof Number(this.form.grainFund) === 'Number') {
         this.$message({
           type: 'error',
           message: '粮款输入错误!'
         });
         return
       }
-      if(this.form.bulkDensity&&this.form.bulkDensity<0||typeof Number(this.form.bulkDensity) === 'Number'){
+      if (this.form.bulkDensity && this.form.bulkDensity < 0 || typeof Number(this.form.bulkDensity) === 'Number') {
         this.$message({
           type: 'error',
           message: '容重输入错误!'
         });
         return
       }
-      if(this.form.waterContent&&this.form.waterContent<0||typeof Number(this.form.waterContent) === 'Number'){
+      if (this.form.waterContent && this.form.waterContent < 0 || typeof Number(this.form.waterContent) === 'Number') {
         this.$message({
           type: 'error',
           message: '水分输入错误!'
         });
         return
       }
-      if(this.form.protein&&this.form.protein<0||typeof Number(this.form.protein) === 'Number'){
+      if (this.form.protein && this.form.protein < 0 || typeof Number(this.form.protein) === 'Number') {
         this.$message({
           type: 'error',
           message: '蛋白输入错误!'
         });
         return
       }
-      if(this.form.impurity&&this.form.impurity<0||typeof Number(this.form.impurity) === 'Number'){
+      if (this.form.impurity && this.form.impurity < 0 || typeof Number(this.form.impurity) === 'Number') {
         this.$message({
           type: 'error',
           message: '杂质输入错误!'
         });
         return
       }
-      if(this.form.mildewGrain&&this.form.mildewGrain<0||typeof Number(this.form.mildewGrain) === 'Number'){
+      if (this.form.mildewGrain && this.form.mildewGrain < 0 || typeof Number(this.form.mildewGrain) === 'Number') {
         this.$message({
           type: 'error',
           message: '霉变粒输入错误!'
         });
         return
       }
-      if(this.form.jiaorenli&&this.form.jiaorenli<0||typeof Number(this.form.jiaorenli) === 'Number'){
+      if (this.form.jiaorenli && this.form.jiaorenli < 0 || typeof Number(this.form.jiaorenli) === 'Number') {
         this.$message({
           type: 'error',
           message: '热损伤输入错误!'
         });
         return
       }
-      if(this.form.imperfectGrain&&this.form.imperfectGrain<0||typeof Number(this.form.imperfectGrain) === 'Number'){
+      if (this.form.imperfectGrain && this.form.imperfectGrain < 0 || typeof Number(this.form.imperfectGrain) === 'Number') {
         this.$message({
           type: 'error',
           message: '不完善粒输入错误!'
         });
         return
       }
-      this.form.grossWeight=this.form.grossWeight?this.form.grossWeight/1000:null
-      this.form.tare=this.form.tare?this.form.tare/1000:null
-      this.form.netWeight=this.form.netWeight?this.form.netWeight/1000:null
+      // this.form.grossWeight = this.form.grossWeight ? this.form.grossWeight / 1000 : null
+      // this.form.tare = this.form.tare ? this.form.tare / 1000 : null
+      // this.form.netWeight = this.form.netWeight ? this.form.netWeight / 1000 : null
       this.$confirm('确定提交出库记录?', '提示', {
-          confirmButtonText: '确定',
-          cancelButtonText: '取消',
-          type: 'warning'
-        }).then(() => {
-      addList(this.form).toPromise().then((res)=>{
-        this.$message({
-          type: 'success',
-          message: '保存成功!'
+        confirmButtonText: '确定',
+        cancelButtonText: '取消',
+        type: 'warning'
+      }).then(() => {
+        this.form.grossWeight = this.form.grossWeight ? this.form.grossWeight / 1000 : null
+      this.form.tare = this.form.tare ? this.form.tare / 1000 : null
+      this.form.netWeight = this.form.netWeight ? this.form.netWeight / 1000 : null
+        addList(this.form).toPromise().then((res) => {
+          this.$message({
+            type: 'success',
+            message: '保存成功!'
+          });
+          this.add()
+          this.getList()
+        }).catch((req) => {
+          this.$message({
+            type: 'error',
+            message: req.message
+          });
         });
-        this.add()
-        this.getList()
-      }).catch((req) => {
-        this.$message({
-          type: 'error',
-          message: req.message
-        });          
-      });
       })
     },
-    del(row){
+    del(row) {
       this.$confirm('确定删除出库记录?', '提示', {
-          confirmButtonText: '确定',
-          cancelButtonText: '取消',
-          type: 'warning'
-        }).then(() => {
-          delList({id:row.id}).toPromise().then((res)=>{
-            this.$message({
-              type: 'success',
-              message: '删除成功!'
-            });
-            this.getList()
-          })
-          
-        }).catch(() => {
+        confirmButtonText: '确定',
+        cancelButtonText: '取消',
+        type: 'warning'
+      }).then(() => {
+        delList({ id: row.id }).toPromise().then((res) => {
           this.$message({
-            type: 'info',
-            message: '已取消删除'
-          });          
+            type: 'success',
+            message: '删除成功!'
+          });
+          this.getList()
+        })
+
+      }).catch(() => {
+        this.$message({
+          type: 'info',
+          message: '已取消删除'
         });
+      });
     },
     handleSizeChange(val) {
       console.log(`每页 ${val} 条`)
@@ -608,61 +647,72 @@ export default {
   background-size: cover;
   background-position: center center;
 }
-.enterTextWrap{
+
+.enterTextWrap {
   display: flex;
   justify-content: space-between;
 }
 
 .enterTextWrap .el-form .el-form-item__content .el-input,
 .enterTextWrap .el-form .el-form-item__content .el-select,
-/deep/.enterTextWrap .el-form .el-form-item__content .el-textarea .el-textarea__inner{
- width:80%;
+/deep/.enterTextWrap .el-form .el-form-item__content .el-textarea .el-textarea__inner {
+  width: 80%;
 }
-/deep/.form .el-form .el-form-item .el-form-item__label{
-  color:#8890b1;
+
+/deep/.form .el-form .el-form-item .el-form-item__label {
+  color: #8890b1;
 }
-/deep/.enterTextWrap  .el-form .form-title.el-form-item .el-form-item__label{
-  font-weight:600;
-  color:#000;
+
+/deep/.enterTextWrap .el-form .form-title.el-form-item .el-form-item__label {
+  font-weight: 600;
+  color: #000;
   // margin-bottom:10px;
 }
-/deep/.enterTextWrap  .el-form .form-title.el-form-item.businessNo{
-  font-weight:600;
-  color:#000;
+
+/deep/.enterTextWrap .el-form .form-title.el-form-item.businessNo {
+  font-weight: 600;
+  color: #000;
 }
-.form{
-  flex:50%;
+
+.form {
+  flex: 50%;
 }
 
-.enterTextWrap .el-form .handEdit .el-form-item__content  .el-input{
-  width:68%;
+.enterTextWrap .el-form .handEdit .el-form-item__content .el-input {
+  width: 68%;
 }
-.enterTextWrap .el-form .handEdit .el-form-item__content  .el-select,
-.enterTextWrap .el-form .handEdit.kehu  .el-form-item__content .el-input{
-  width:61.5%;
+
+.enterTextWrap .el-form .handEdit .el-form-item__content .el-select,
+.enterTextWrap .el-form .handEdit.kehu .el-form-item__content .el-input {
+  width: 61.5%;
 }
-.el-button{
-  margin-left:10px;
+
+.el-button {
+  margin-left: 10px;
 }
-.el-button--text{
-  padding:0 10px !important;
-  margin-left:0px;
+
+.el-button--text {
+  padding: 0 10px !important;
+  margin-left: 0px;
 }
-.find{
-  width:66px;
-  padding:0 20px;
+
+.find {
+  width: 66px;
+  padding: 0 20px;
   position: relative;
   // top:2px;
 }
-.el-form-item--small.el-form-item{
-  margin-bottom:10px;
+
+.el-form-item--small.el-form-item {
+  margin-bottom: 10px;
 }
-.el-col.bg-right .add{
+
+.el-col.bg-right .add {
   margin-left: 0 !important;
-  border:1px solid #409eff;
-  padding:9px 20px !important;
+  border: 1px solid #409eff;
+  padding: 9px 20px !important;
 }
-/deep/.el-textarea textarea{
+
+/deep/.el-textarea textarea {
   padding: 2px 10px 0;
-}
-</style>
+}</style>

+ 325 - 259
src/views/warehousing/index.vue

@@ -5,9 +5,10 @@
         &nbsp;
       </el-col>
       <el-col style="padding-right:1%;" :span="13" class="bg-right">
-        <el-button class="bg-bottom add" size="small" type="text"  @click="add()">新增</el-button>
-        <el-button style="border:1px solid #409eff;" class="bg-bottom" type="primary" size="small" @click="save()">保存</el-button>
-        
+        <el-button class="bg-bottom add" size="small" type="text" @click="add()">新增</el-button>
+        <el-button style="border:1px solid #409eff;" class="bg-bottom" type="primary" size="small"
+          @click="save()">保存</el-button>
+
       </el-col>
       <el-col :span="1">
         &nbsp;
@@ -17,9 +18,9 @@
     <div class="enterTextWrap">
       <div class="flex-1">
         <div class="weign">
-          <BalanceAlert ref="weightChild" :deptBudgetList="form" :information="information"
-          v-on:balanceListen="setVal" class="zujian">
-        </BalanceAlert>
+          <BalanceAlert ref="weightChild" :deptBudgetList="form" :information="information" v-on:balanceListen="setVal"
+            class="zujian">
+          </BalanceAlert>
           <!-- <div>{{weigntext?'':''}}</div>
           <div></div>
           <div></div> -->
@@ -28,45 +29,51 @@
       <div class="flex-2 flex-justify-space-between">
         <div class="form">
           <el-form ref="form" :model="form" label-position="right" label-width="120px">
-            <el-form-item style="position:absolute;top:28px;"  v-if="this.form.businessNo" class="form-title businessNo" label="业务编号:">
-              {{this.form.businessNo}}
+            <el-form-item v-if="this.form.businessNo" class="form-title businessNo" label="业务编号:">
+              {{ this.form.businessNo }}
             </el-form-item>
-            <el-form-item  class="form-title" label="称重信息">
-                <!-- <el-checkbox v-hasPermission="`speedEdition.inWarehouseJsb.edit` " @change="checkedchange" v-model="checked">允许手动编辑重量</el-checkbox> -->
-                <el-checkbox  @change="checkedchange" v-model="checked">允许手动编辑重量</el-checkbox>
+            <el-form-item class="form-title" label="称重信息">
+              <!-- <el-checkbox v-hasPermission="`speedEdition.inWarehouseJsb.edit` " @change="checkedchange" v-model="checked">允许手动编辑重量</el-checkbox> -->
+              <el-checkbox @change="checkedchange" v-model="checked">允许手动编辑重量</el-checkbox>
             </el-form-item>
             <el-form-item class="handEdit" label="毛重(公斤)">
-              <el-input @mousewheel.native.prevent type="number" @input="grossWeightInput" :disabled="!checked" placeholder="输入毛重" v-model="form.grossWeight"></el-input>
+              <el-input @mousewheel.native.prevent type="number" @input="grossWeightInput" :disabled="!checked"
+                placeholder="输入毛重" v-model="form.grossWeight"></el-input>
               <el-button @click="gain(0)" type="text">获取</el-button>
             </el-form-item>
             <el-form-item class="handEdit" label="皮重(公斤)">
-              <el-input @mousewheel.native.prevent type="number" @input="tareInput" :disabled="!checked" placeholder="输入皮重" v-model="form.tare"></el-input>
+              <el-input @mousewheel.native.prevent type="number" @input="tareInput" :disabled="!checked"
+                placeholder="输入皮重" v-model="form.tare"></el-input>
               <el-button @click="gain(1)" type="text">获取</el-button>
             </el-form-item>
             <el-form-item label="净重(公斤)">
               <el-input disabled placeholder="自动计算" v-model="form.netWeight"></el-input>
             </el-form-item>
-            <el-form-item   class="form-title" label="基本信息">
+            <el-form-item class="form-title" label="基本信息">
             </el-form-item>
             <el-form-item class="handEdit kehu" label="客户姓名">
-              <el-select v-if="text=='手输'" ref="select" @change="customerChange" filterable clearable placeholder="输入客户姓名" v-model="form.customerName" >
-                <el-option v-for="item in customerOptions" :key="item.id" :label="item.customerName+'('+item.customerPhone+')'" :value="item.customerName"></el-option>
+              <el-select v-if="text == '手输'" ref="select" @change="customerChange" filterable clearable placeholder="输入客户姓名"
+                v-model="form.customerName">
+                <el-option v-for="item in customerOptions" :key="item.id"
+                  :label="item.customerName + '(' + item.customerPhone + ')'" :value="item.customerName"></el-option>
               </el-select>
               <el-input v-else placeholder="输入客户姓名" v-model="form.customerName"></el-input>
-              <el-button class="bg-bottom" type="primary" size="small" @click="textchange()">{{text}}</el-button>
+              <el-button class="bg-bottom" type="primary" size="small" @click="textchange()">{{ text }}</el-button>
             </el-form-item>
             <el-form-item label="车牌号">
               <el-input maxlength="8" placeholder="输入毛重车牌号" v-model="form.carNumber"></el-input>
             </el-form-item>
             <el-form-item label="仓位号">
-              <el-select filterable clearable @change="positionNoChange" placeholder="输入仓位号" v-model="form.positionId" >
-                <el-option v-for="item in positionOptions" :key="item.id" :label="item.positionNo" :value="item.id"></el-option>
+              <el-select filterable clearable @change="positionNoChange" placeholder="输入仓位号" v-model="form.positionId">
+                <el-option v-for="item in positionOptions" :key="item.id" :label="item.positionNo"
+                  :value="item.id"></el-option>
               </el-select>
             </el-form-item>
-            <el-form-item   class="form-title" label="定价信息">
+            <el-form-item class="form-title" label="定价信息">
             </el-form-item>
             <el-form-item label="单价(元/吨)">
-              <el-input @mousewheel.native.prevent type="number" @input="unitPriceInput" placeholder="输入单价" v-model="form.unitPrice"></el-input>
+              <el-input @mousewheel.native.prevent type="number" @input="unitPriceInput" placeholder="输入单价"
+                v-model="form.unitPrice"></el-input>
             </el-form-item>
             <el-form-item label="粮款(元)">
               <el-input @mousewheel.native.prevent type="number" placeholder="自动计算" v-model="form.grainFund"></el-input>
@@ -74,19 +81,21 @@
           </el-form>
         </div>
         <div class="form">
-          <el-form  ref="form" :model="form" label-position="right" label-width="120px">
-            <el-form-item   class="form-title" label="质检信息">
+          <el-form ref="form" :model="form" label-position="right" label-width="120px">
+            <el-form-item class="form-title" label="质检信息">
             </el-form-item>
             <el-form-item label="货名">
-              <el-select filterable clearable placeholder="选择货名" v-model="form.goodsName" >
-                <el-option v-for="item in goodOptions" :key="item.id" :label="item.goodsName" :value="item.goodsName"></el-option>
+              <el-select filterable clearable placeholder="选择货名" v-model="form.goodsName">
+                <el-option v-for="item in goodOptions" :key="item.id" :label="item.goodsName"
+                  :value="item.goodsName"></el-option>
               </el-select>
             </el-form-item>
             <el-form-item label="容重(克/升)">
               <el-input @mousewheel.native.prevent type="number" placeholder="输入容重" v-model="form.bulkDensity"></el-input>
             </el-form-item>
             <el-form-item label="水分(%)">
-              <el-input @mousewheel.native.prevent type="number" placeholder="输入水分占比" v-model="form.waterContent"></el-input>
+              <el-input @mousewheel.native.prevent type="number" placeholder="输入水分占比"
+                v-model="form.waterContent"></el-input>
             </el-form-item>
             <el-form-item label="蛋白(%)">
               <el-input @mousewheel.native.prevent type="number" placeholder="输入蛋白占比" v-model="form.protein"></el-input>
@@ -95,13 +104,16 @@
               <el-input @mousewheel.native.prevent type="number" placeholder="输入杂质占比" v-model="form.impurity"></el-input>
             </el-form-item>
             <el-form-item label="霉变粒(%)">
-              <el-input @mousewheel.native.prevent type="number" placeholder="输入霉变粒占比" v-model="form.mildewGrain"></el-input>
+              <el-input @mousewheel.native.prevent type="number" placeholder="输入霉变粒占比"
+                v-model="form.mildewGrain"></el-input>
             </el-form-item>
             <el-form-item label="热损伤(%)">
-              <el-input @mousewheel.native.prevent type="number" placeholder="输入热损伤占比" v-model="form.jiaorenli"></el-input>
+              <el-input @mousewheel.native.prevent type="number" placeholder="输入热损伤占比"
+                v-model="form.jiaorenli"></el-input>
             </el-form-item>
             <el-form-item label="不完善粒(%)">
-              <el-input @mousewheel.native.prevent type="number" placeholder="输入不完善粒占比" v-model="form.imperfectGrain"></el-input>
+              <el-input @mousewheel.native.prevent type="number" placeholder="输入不完善粒占比"
+                v-model="form.imperfectGrain"></el-input>
             </el-form-item>
             <el-form-item label="备注">
               <el-input :rows="4" placeholder="输入备注,0-150个字" type="textarea" v-model="form.remark"></el-input>
@@ -114,7 +126,7 @@
       <el-row class="row_top">
         <el-col :span="12">
           <el-date-picker value-format='yyyy-MM-dd' v-model="value" type="daterange" unlink-panels range-separator="至"
-              start-placeholder="开始日期" end-placeholder="结束日期" class="data_css" @change="changeDate" ></el-date-picker>
+            start-placeholder="开始日期" end-placeholder="结束日期" class="data_css" @change="changeDate"></el-date-picker>
           <el-button class="bg-bottom" type="primary" size="small" @click="allinout()">全部</el-button>
         </el-col>
         <el-col :span="12" class="bg-right">
@@ -122,18 +134,20 @@
           <el-button class="find" type="primary" @click="find()">查找</el-button>
         </el-col>
       </el-row>
-      <el-table :data="tableData" stripe style="width: 100%">
-        <el-table-column  width="40">
+      <el-table :data="tableData" stripe style="width: 100%" @row-click="handleTableRow">
+        <el-table-column width="40">
           <template scope="scope">
-            <img v-if="!scope.row.select" style='width:15px;vertical-align: text-top;' @click='radiochange1(scope.row)' src="../../../public/img/wxz.png" alt="">
-            <img v-if="scope.row.select" style='width:15px;vertical-align: text-top;' @click='radiochange(scope.row)' src="../../../public/img/xz.png" alt="">
+            <img v-if="!scope.row.select" style='width:15px;vertical-align: text-top;' @click='radiochange1(scope.row)'
+              src="../../../public/img/wxz.png" alt="">
+            <img v-if="scope.row.select" style='width:15px;vertical-align: text-top;' @click='radiochange(scope.row)'
+              src="../../../public/img/xz.png" alt="">
           </template>
         </el-table-column>
         <el-table-column type="index" label="序号">
-            <template scope="scope">
-              <span v-if="scope.$index < 9">0{{ scope.$index + 1 }}</span>
-              <span v-else>{{ scope.$index + 1 }}</span>
-            </template>
+          <template scope="scope">
+            <span v-if="scope.$index < 9">0{{ scope.$index + 1 }}</span>
+            <span v-else>{{ scope.$index + 1 }}</span>
+          </template>
         </el-table-column>
         <el-table-column width="120" prop="businessNo" label="业务编号"></el-table-column>
         <el-table-column prop="positionNo" label="仓位"></el-table-column>
@@ -159,20 +173,17 @@
         <el-table-column width="120" prop="status" label="付款状态"></el-table-column>
         <el-table-column prop="address" label="操作" width="200">
           <template slot-scope="scope">
-            <el-button v-hasPermission="`speedEdition.inWarehouseJsb.delete` " @click="del(scope.row)" type="text">删除</el-button>
+            <el-button v-hasPermission="`speedEdition.inWarehouseJsb.delete`" @click="del(scope.row)"
+              type="text">删除</el-button>
           </template>
         </el-table-column>
       </el-table>
       <el-pagination @size-change="handleSizeChange" @current-change="handleCurrentChange" :current-page="currentPage"
-        style="text-align:center" :page-size="pageSize"
-        layout="total, sizes, prev, pager, next, jumper" :total="deptBudgetTotal">
+        style="text-align:center" :page-size="pageSize" layout="total, sizes, prev, pager, next, jumper"
+        :total="deptBudgetTotal">
       </el-pagination>
     </div>
-    <el-dialog
-      title="客户信息"
-      :visible.sync="dialogVisible"
-      width="30%"
-      :close-on-click-modal="false"
+    <el-dialog title="客户信息" :visible.sync="dialogVisible" width="30%" :close-on-click-modal="false"
       :before-close="handleClose">
       <el-form ref="form" label-width="80px">
         <el-form-item label="姓名">
@@ -222,33 +233,33 @@ export default {
   },
   data() {
     return {
-      tableData:[],
-      form:{
-        inOutFlag:2,
-        compId:localStorage.getItem('ws-pf_compId'),
-        goodsName:'玉米',
-        noFlag:'RK',
-        customerName:'',
-        grainFund:''
+      tableData: [],
+      form: {
+        inOutFlag: 2,
+        compId: localStorage.getItem('ws-pf_compId'),
+        goodsName: '玉米',
+        noFlag: 'RK',
+        customerName: '',
+        grainFund: ''
       },
-      information:'',
-      checked:false,
-      searchKeyWord:'',
-      compId:localStorage.getItem('ws-pf_compId'),
-      positionOptions:[],
-      goodOptions:[],
-      customerOptions:[],
-      startDate:'',
-      endDate:'',
-      searchKeyWord:'',
-      status:'',
-      currentPage:1,
-      pageSize:10,
-      text:'手输',
-      value:[],
-      deptBudgetTotal:0,
-      dialogVisible:false,
-      customerData:{}
+      information: '',
+      checked: false,
+      searchKeyWord: '',
+      compId: localStorage.getItem('ws-pf_compId'),
+      positionOptions: [],
+      goodOptions: [],
+      customerOptions: [],
+      startDate: '',
+      endDate: '',
+      searchKeyWord: '',
+      status: '',
+      currentPage: 1,
+      pageSize: 10,
+      text: '手输',
+      value: [],
+      deptBudgetTotal: 0,
+      dialogVisible: false,
+      customerData: {}
     };
   },
   filters: {
@@ -264,178 +275,221 @@ export default {
     starttime.setTime(starttime.getTime() - 3600 * 1000 * 24 * 30);
     const end = global.default.getDate();
     const start = global.default.getDate(starttime);
-    this.value=[start,end]
+    this.value = [start, end]
     // var num=await global.default.getNum('RK')
     // console.log(num)
     // this.form.businessNo=num
-    speedPositionInfoList({compId:this.compId}).toPromise().then((res)=>{
-      this.positionOptions=res
+    speedPositionInfoList({ compId: this.compId }).toPromise().then((res) => {
+      this.positionOptions = res
     })
-    var status=await getweight({compId:this.compId,functionType:4}).toPromise()
-    this.status=status?status:''
-    if(this.status&&this.status.value==1){
-      this.checked=true
+    var status = await getweight({ compId: this.compId, functionType: 4 }).toPromise()
+    this.status = status ? status : ''
+    if (this.status && this.status.value == 1) {
+      this.checked = true
     }
     console.log(status)
-    speedGoodsList({compId:this.compId}).toPromise().then((res)=>{
-      if(res.length>0){
+    speedGoodsList({ compId: this.compId }).toPromise().then((res) => {
+      if (res.length > 0) {
         for (let i = 0; i < res.length; i++) {
-          if(res[i].setDefault!=0){
-            this.form.goodsName=res[i].goodsName
+          if (res[i].setDefault != 0) {
+            this.form.goodsName = res[i].goodsName
           }
         }
       }
-      this.goodOptions=res
+      this.goodOptions = res
     })
     this.getList()
   },
   beforeDestroy() {
- 
-    
+
+
   },
+  // radiochange1(row){
+  //     for(var i=0;i<this.tableData.length;i++){
+  //       this.tableData[i].select=false
+  //     }
+  //     this.$forceUpdate()
+  //     row.select=!row.select
+  //     this.form=JSON.parse(JSON.stringify(row))
+  //   },
+  //   radiochange(row){
+  //     row.select=!row.select
+  //     this.form={
+  //       inOutFlag:2,
+  //       compId:localStorage.getItem('ws-pf_compId'),
+  //       goodsName:'玉米',
+  //       noFlag:'RK',
+  //       customerName:'',
+  //       grainFund:''
+  //     }
+  //   },
   methods: {
-    checkedchange(e){
-      if(e) var value=1
-      else var value=0
-      if(this.status){
-        setweight({compId:this.compId,functionType:4,value:value,id:this.status.id}).toPromise().then((res)=>{
+    handleTableRow(row, event, column) {
+      if (!row.select) {
+        for (var i = 0; i < this.tableData.length; i++) {
+          this.tableData[i].select = false
+        }
+        this.$forceUpdate()
+        row.select = !row.select
+        this.form = JSON.parse(JSON.stringify(row))
+      } else {
+        row.select = !row.select
+        this.form = {
+          inOutFlag: 2,
+          compId: localStorage.getItem('ws-pf_compId'),
+          goodsName: '玉米',
+          noFlag: 'RK',
+          customerName: '',
+          grainFund: ''
+        }
+      }
+      this.form.grossWeight = this.form.grossWeight ? this.form.grossWeight * 1000 : null
+      this.form.tare = this.form.tare ? this.form.tare * 1000 : null
+      this.form.netWeight = this.form.netWeight ? this.form.netWeight * 1000 : null
+    },
+    checkedchange(e) {
+      if (e) var value = 1
+      else var value = 0
+      if (this.status) {
+        setweight({ compId: this.compId, functionType: 4, value: value, id: this.status.id }).toPromise().then((res) => {
           this.$message({
             type: 'success',
             message: '修改成功!'
           });
         })
-      }else{
-        setweight({compId:this.compId,functionType:4,value:value}).toPromise().then((res)=>{
+      } else {
+        setweight({ compId: this.compId, functionType: 4, value: value }).toPromise().then((res) => {
           this.$message({
             type: 'success',
             message: '修改成功!'
           });
         })
       }
-      
+
       console.log(e)
       // setweight
     },
-    allinout(){
-      this.value=[]
+    allinout() {
+      this.value = []
       this.getList()
     },
-    textchange(){
-      if(this.text=='手输'){
-        this.text='选择'
-      }else{
-        this.text='手输'
+    textchange() {
+      if (this.text == '手输') {
+        this.text = '选择'
+      } else {
+        this.text = '手输'
       }
-      localStorage.setItem('inouttextstatus',this.text)
+      localStorage.setItem('inouttextstatus', this.text)
     },
-    find(){
+    find() {
       this.getList()
     },
     openPort() {
       this.$refs.weightChild.openPort()
     },
-    gain(status){
-      if(status==0){
+    gain(status) {
+      if (status == 0) {
         this.information = '毛重'
-      }else{
+      } else {
         this.information = '皮重'
       }
       this.openPort()
     },
-    handleClose(){
-      this.dialogVisible=false
+    handleClose() {
+      this.dialogVisible = false
     },
-    radiochange1(row){
-      for(var i=0;i<this.tableData.length;i++){
-        this.tableData[i].select=false
+    radiochange1(row) {
+      for (var i = 0; i < this.tableData.length; i++) {
+        this.tableData[i].select = false
       }
       this.$forceUpdate()
-      row.select=!row.select
-      this.form=JSON.parse(JSON.stringify(row))
+      row.select = !row.select
+      this.form = JSON.parse(JSON.stringify(row))
     },
-    radiochange(row){
-      row.select=!row.select
-      this.form={
-        inOutFlag:2,
-        compId:localStorage.getItem('ws-pf_compId'),
-        goodsName:'玉米',
-        noFlag:'RK',
-        customerName:'',
-        grainFund:''
+    radiochange(row) {
+      row.select = !row.select
+      this.form = {
+        inOutFlag: 2,
+        compId: localStorage.getItem('ws-pf_compId'),
+        goodsName: '玉米',
+        noFlag: 'RK',
+        customerName: '',
+        grainFund: ''
       }
     },
-    unitPriceInput(e){
-      if(this.form.netWeight){
-        this.form.grainFund=Number(e*(this.form.netWeight/1000)).toFixed(3)
+    unitPriceInput(e) {
+      if (this.form.netWeight) {
+        this.form.grainFund = Number(e * (this.form.netWeight / 1000)).toFixed(3)
       }
     },
-    async lookCustomerName(row){
-      this.customerData=await getcustomer({customerId:row.customerId}).toPromise()
-      this.dialogVisible=true
+    async lookCustomerName(row) {
+      this.customerData = await getcustomer({ customerId: row.customerId }).toPromise()
+      this.dialogVisible = true
     },
-    positionNoChange(e){
+    positionNoChange(e) {
       for (let i = 0; i < this.positionOptions.length; i++) {
-        if(this.positionOptions[i].id==e){
-          this.form.positionNo=this.positionOptions[i].positionNo
+        if (this.positionOptions[i].id == e) {
+          this.form.positionNo = this.positionOptions[i].positionNo
         }
       }
     },
-    customerChange(e){
+    customerChange(e) {
       for (let i = 0; i < this.customerOptions.length; i++) {
-        if(this.customerOptions[i].customerName==e){
-          this.form.customerId=this.customerOptions[i].id
+        if (this.customerOptions[i].customerName == e) {
+          this.form.customerId = this.customerOptions[i].id
           console.log(this.form.customerId)
         }
       }
     },
-    grossWeightInput(e){
-      if(this.form.tare&&e) this.form.netWeight=e-this.form.tare
-      else this.form.netWeight=''
+    grossWeightInput(e) {
+      if (this.form.tare && e) this.form.netWeight = e - this.form.tare
+      else this.form.netWeight = ''
     },
-    tareInput(e){
-      if(this.form.grossWeight&&e) this.form.netWeight=this.form.grossWeight-e
-      else this.form.netWeight=''
+    tareInput(e) {
+      if (this.form.grossWeight && e) this.form.netWeight = this.form.grossWeight - e
+      else this.form.netWeight = ''
     },
-    changeDate(){
-      if(this.value){
+    changeDate() {
+      if (this.value) {
         this.startDate = this.value[0]
         this.endDate = this.value[1]
-      }else{
+      } else {
         this.startDate = ''
         this.endDate = ''
       }
       this.getList()
     },
-    getList(){
-      if(localStorage.getItem('inouttextstatus')){
-        this.text=localStorage.getItem('inouttextstatus')
+    getList() {
+      if (localStorage.getItem('inouttextstatus')) {
+        this.text = localStorage.getItem('inouttextstatus')
       }
-      if(this.value){
-        this.startDate=this.value[0]
-        this.endDate=this.value[1]
+      if (this.value) {
+        this.startDate = this.value[0]
+        this.endDate = this.value[1]
       }
-      speedCustomerInfoList({compId:this.compId,pageSize:9999,currentPage:1}).toPromise().then((res)=>{
-      // if(res.records.length>0){
-      //   this.form.customerId=res.records[0].id
-      //   this.form.customerName=res.records[0].customerName
-      // }
-      this.customerOptions=res.records
-    })
-      getList({compId:this.compId,
-        startDate:this.startDate,
-        endDate:this.endDate,
-        pageSize:this.pageSize,
-        currentPage:this.currentPage,
-        searchType:3,
-        searchKeyWord:this.searchKeyWord
-      }).toPromise().then((res)=>{
-        if(res.records.length>0){
+      speedCustomerInfoList({ compId: this.compId, pageSize: 9999, currentPage: 1 }).toPromise().then((res) => {
+        // if(res.records.length>0){
+        //   this.form.customerId=res.records[0].id
+        //   this.form.customerName=res.records[0].customerName
+        // }
+        this.customerOptions = res.records
+      })
+      getList({
+        compId: this.compId,
+        startDate: this.startDate,
+        endDate: this.endDate,
+        pageSize: this.pageSize,
+        currentPage: this.currentPage,
+        searchType: 3,
+        searchKeyWord: this.searchKeyWord
+      }).toPromise().then((res) => {
+        if (res.records.length > 0) {
           for (let i = 0; i < res.records.length; i++) {
-            res.records[i].select=false
+            res.records[i].select = false
           }
         }
-        this.tableData=res.records
-        this.deptBudgetTotal=res.total
+        this.tableData = res.records
+        this.deptBudgetTotal = res.total
       })
     },
     setVal(data) {
@@ -445,147 +499,150 @@ export default {
         this.form.tare = data
       }
     },
-    add(){
-      this.form={
-        inOutFlag:2,
-        compId:localStorage.getItem('ws-pf_compId'),
-        goodsName:'玉米',
-        noFlag:'RK',
-        customerName:'',
-        grainFund:''
+    add() {
+      this.form = {
+        inOutFlag: 2,
+        compId: localStorage.getItem('ws-pf_compId'),
+        goodsName: '玉米',
+        noFlag: 'RK',
+        customerName: '',
+        grainFund: ''
       }
-      for(var i=0;i<this.tableData.length;i++){
-        this.tableData[i].select=false
+      for (var i = 0; i < this.tableData.length; i++) {
+        this.tableData[i].select = false
       }
     },
-    save(){
-      if(this.form.grossWeight&&this.form.grossWeight<0||typeof Number(this.form.grossWeight) === 'Number'){
+    save() {
+      if (this.form.grossWeight && this.form.grossWeight < 0 || typeof Number(this.form.grossWeight) === 'Number') {
         this.$message({
           type: 'error',
           message: '毛重输入错误!'
         });
         return
       }
-      if(this.form.tare&&this.form.tare<0||typeof Number(this.form.tare) === 'Number'){
+      if (this.form.tare && this.form.tare < 0 || typeof Number(this.form.tare) === 'Number') {
         this.$message({
           type: 'error',
           message: '皮重输入错误!'
         });
         return
       }
-      if(this.form.netWeight&&this.form.netWeight<0||typeof Number(this.form.netWeight) === 'Number'){
+      if (this.form.netWeight && this.form.netWeight < 0 || typeof Number(this.form.netWeight) === 'Number') {
         this.$message({
           type: 'error',
           message: '净重输入错误!'
         });
         return
       }
-      if(this.form.unitPrice&&this.form.unitPrice<0||typeof Number(this.form.unitPrice) === 'Number'){
+      if (this.form.unitPrice && this.form.unitPrice < 0 || typeof Number(this.form.unitPrice) === 'Number') {
         this.$message({
           type: 'error',
           message: '单价输入错误!'
         });
         return
       }
-      if(this.form.grainFund&&this.form.grainFund<0||typeof Number(this.form.grainFund) === 'Number'){
+      if (this.form.grainFund && this.form.grainFund < 0 || typeof Number(this.form.grainFund) === 'Number') {
         this.$message({
           type: 'error',
           message: '粮款输入错误!'
         });
         return
       }
-      if(this.form.bulkDensity&&this.form.bulkDensity<0||typeof Number(this.form.bulkDensity) === 'Number'){
+      if (this.form.bulkDensity && this.form.bulkDensity < 0 || typeof Number(this.form.bulkDensity) === 'Number') {
         this.$message({
           type: 'error',
           message: '容重输入错误!'
         });
         return
       }
-      if(this.form.waterContent&&this.form.waterContent<0||typeof Number(this.form.waterContent) === 'Number'){
+      if (this.form.waterContent && this.form.waterContent < 0 || typeof Number(this.form.waterContent) === 'Number') {
         this.$message({
           type: 'error',
           message: '水分输入错误!'
         });
         return
       }
-      if(this.form.protein&&this.form.protein<0||typeof Number(this.form.protein) === 'Number'){
+      if (this.form.protein && this.form.protein < 0 || typeof Number(this.form.protein) === 'Number') {
         this.$message({
           type: 'error',
           message: '蛋白输入错误!'
         });
         return
       }
-      if(this.form.impurity&&this.form.impurity<0||typeof Number(this.form.impurity) === 'Number'){
+      if (this.form.impurity && this.form.impurity < 0 || typeof Number(this.form.impurity) === 'Number') {
         this.$message({
           type: 'error',
           message: '杂质输入错误!'
         });
         return
       }
-      if(this.form.mildewGrain&&this.form.mildewGrain<0||typeof Number(this.form.mildewGrain) === 'Number'){
+      if (this.form.mildewGrain && this.form.mildewGrain < 0 || typeof Number(this.form.mildewGrain) === 'Number') {
         this.$message({
           type: 'error',
           message: '霉变粒输入错误!'
         });
         return
       }
-      if(this.form.jiaorenli&&this.form.jiaorenli<0||typeof Number(this.form.jiaorenli) === 'Number'){
+      if (this.form.jiaorenli && this.form.jiaorenli < 0 || typeof Number(this.form.jiaorenli) === 'Number') {
         this.$message({
           type: 'error',
           message: '热损伤输入错误!'
         });
         return
       }
-      if(this.form.imperfectGrain&&this.form.imperfectGrain<0||typeof Number(this.form.imperfectGrain) === 'Number'){
+      if (this.form.imperfectGrain && this.form.imperfectGrain < 0 || typeof Number(this.form.imperfectGrain) === 'Number') {
         this.$message({
           type: 'error',
           message: '不完善粒输入错误!'
         });
         return
       }
-      this.form.grossWeight=this.form.grossWeight?this.form.grossWeight/1000:null
-      this.form.tare=this.form.tare?this.form.tare/1000:null
-      this.form.netWeight=this.form.netWeight?this.form.netWeight/1000:null
+      // this.form.grossWeight=this.form.grossWeight?this.form.grossWeight/1000:null
+      // this.form.tare=this.form.tare?this.form.tare/1000:null
+      // this.form.netWeight=this.form.netWeight?this.form.netWeight/1000:null
       this.$confirm('确定提交入库记录?', '提示', {
-          confirmButtonText: '确定',
-          cancelButtonText: '取消',
-          type: 'warning'
-        }).then(() => {
-      addList(this.form).toPromise().then((res)=>{
-        this.$message({
-          type: 'success',
-          message: '保存成功!'
+        confirmButtonText: '确定',
+        cancelButtonText: '取消',
+        type: 'warning'
+      }).then(() => {
+        this.form.grossWeight = this.form.grossWeight ? this.form.grossWeight / 1000 : null
+        this.form.tare = this.form.tare ? this.form.tare / 1000 : null
+        this.form.netWeight = this.form.netWeight ? this.form.netWeight / 1000 : null
+        addList(this.form).toPromise().then((res) => {
+          this.$message({
+            type: 'success',
+            message: '保存成功!'
+          });
+          this.add()
+          this.getList()
+        }).catch((req) => {
+          this.$message({
+            type: 'error',
+            message: req.message
+          });
         });
-        this.add()
-        this.getList()
-      }).catch((req) => {
-        this.$message({
-          type: 'error',
-          message: req.message
-        });          
-      });
       })
     },
-    del(row){
+    del(row) {
       this.$confirm('确定删除入库记录?', '提示', {
-          confirmButtonText: '确定',
-          cancelButtonText: '取消',
-          type: 'warning'
-        }).then(() => {
-          delList({id:row.id}).toPromise().then((res)=>{
-            this.$message({
-              type: 'success',
-              message: '删除成功!'
-            });
-            this.getList()
-          })
-          
-        }).catch(() => {
+        confirmButtonText: '确定',
+        cancelButtonText: '取消',
+        type: 'warning'
+      }).then(() => {
+        delList({ id: row.id }).toPromise().then((res) => {
           this.$message({
-            type: 'info',
-            message: '已取消删除'
-          });          
+            type: 'success',
+            message: '删除成功!'
+          });
+          this.getList()
+        })
+
+      }).catch(() => {
+        this.$message({
+          type: 'info',
+          message: '已取消删除'
         });
+      });
     },
     handleSizeChange(val) {
       console.log(`每页 ${val} 条`)
@@ -601,7 +658,6 @@ export default {
 };
 </script>
 <style lang="scss" scoped>
-
 .bg {
   width: 100%;
   height: 100%;
@@ -611,57 +667,67 @@ export default {
   background-size: cover;
   background-position: center center;
 }
-.enterTextWrap{
+
+.enterTextWrap {
   display: flex;
   justify-content: space-between;
 }
 
 .enterTextWrap .el-form .el-form-item__content .el-input,
 .enterTextWrap .el-form .el-form-item__content .el-select,
-/deep/.enterTextWrap .el-form .el-form-item__content .el-textarea .el-textarea__inner{
- width:80%;
+/deep/.enterTextWrap .el-form .el-form-item__content .el-textarea .el-textarea__inner {
+  width: 80%;
 }
-/deep/.form .el-form .el-form-item .el-form-item__label{
-  color:#8890b1;
+
+/deep/.form .el-form .el-form-item .el-form-item__label {
+  color: #8890b1;
 }
-/deep/.enterTextWrap  .el-form .form-title.el-form-item .el-form-item__label{
-  font-weight:600;
-  color:#000;
+
+/deep/.enterTextWrap .el-form .form-title.el-form-item .el-form-item__label {
+  font-weight: 600;
+  color: #000;
   // margin-bottom:10px;
 }
-.form{
-  flex:50%;
+
+.form {
+  flex: 50%;
 }
 
-.enterTextWrap .el-form .handEdit .el-form-item__content  .el-input{
-  width:68%;
+.enterTextWrap .el-form .handEdit .el-form-item__content .el-input {
+  width: 68%;
 }
-.enterTextWrap .el-form .handEdit .el-form-item__content  .el-select,
-.enterTextWrap .el-form .handEdit.kehu  .el-form-item__content .el-input{
-  width:61.5%;
+
+.enterTextWrap .el-form .handEdit .el-form-item__content .el-select,
+.enterTextWrap .el-form .handEdit.kehu .el-form-item__content .el-input {
+  width: 61.5%;
 }
-.el-button{
-  margin-left:10px;
+
+.el-button {
+  margin-left: 10px;
 }
-.el-button--text{
-  padding:0 10px !important;
-  margin-left:0px;
+
+.el-button--text {
+  padding: 0 10px !important;
+  margin-left: 0px;
 }
-.find{
-  width:66px;
-  padding:0 20px;
+
+.find {
+  width: 66px;
+  padding: 0 20px;
   position: relative;
   // top:2px;
 }
-.el-form-item--small.el-form-item{
-  margin-bottom:10px;
+
+.el-form-item--small.el-form-item {
+  margin-bottom: 10px;
 }
-.el-col.bg-right .add{
+
+.el-col.bg-right .add {
   margin-left: 0 !important;
-  border:1px solid #409eff;
-  padding:9px 20px !important;
+  border: 1px solid #409eff;
+  padding: 9px 20px !important;
 }
-/deep/.el-textarea textarea{
+
+/deep/.el-textarea textarea {
   padding: 2px 10px 0;
-}
-</style>
+}</style>