wangchao 2 lat temu
rodzic
commit
aa6fa4ccbd

BIN
public/img/change.png


+ 25 - 6
src/api/V2/speedGoods.js

@@ -1,7 +1,3 @@
-
-const baseUrl = process.env.VUE_APP_API_NEWS
-
-
 // 货名
 export const api_speedGoodsList = `/speedGoodsInfo/selectInfo`
 export const api_speedGoodsAdd = `/speedGoodsInfo/api/addInfo`
@@ -10,8 +6,31 @@ export const api_speedGoodsDel = `/speedGoodsInfo/api/deleteInfo`
 
 //仓位
 export const api_speedPositionInfoList = `/speedPositionInfo/selectInfo`
-export const api_speedPositionInfoAdd = `/speedPositionInfo/api/addInfo `
+export const api_speedPositionInfoAdd = `/speedPositionInfo/api/addInfo`
+export const api_speedPositionInfoEdit = `/speedPositionInfo/api/editInfo`
+export const api_speedPositionInfoDel = `/speedPositionInfo/api/deleteInfo`
 
 //客户
 export const api_speedCustomerInfoList = `/speedCustomerInfo/selectInfo`
-export const api_speedCustomerInfoAdd = `/speedCustomerInfo/api/addInfo `
+export const api_speedCustomerInfoAdd = `/speedCustomerInfo/api/addInfo`
+export const api_speedCustomerInfoEdit = `/speedCustomerInfo/api/editInfo`
+export const api_speedCustomerInfoDel = `/speedCustomerInfo/api/deleteInfo`
+
+//费用
+export const api_speedExpenseInfoList = `/speedExpenseInfo/selectInfo`
+export const api_speedExpenseInfoAdd = `/speedExpenseInfo/api/addInfo`
+export const api_speedExpenseInfoEdit = `/speedExpenseInfo/api/editInfo`
+export const api_speedExpenseInfoDel = `/speedExpenseInfo/api/deleteInfo`
+
+// 记录
+export const api_speedWarehouseInOutInfoList = `/speedWarehouseInOutInfo/selectInfo`
+export const api_speedWarehouseInOutInfoDel = `/speedWarehouseInOutInfo/api/deleteInfo`
+export const api_speedWarehouseInOutInfoEdit = `/speedWarehouseInOutInfo/api/editInfo`
+export const api_speedWarehouseInOutInfoAdd = `/speedExpenseInfo/api/addInfo`
+export const api_makeZero = `/speedGoodsInfo/api/makeZero`
+export const api_selectInOutCount = `/speedWarehouseInOutInfo/selectInOutCount`
+export const api_speedCustomerInfo = `/speedCustomerInfo/getInfo`
+export const api_exportOrder = `/speedWarehouseInOutInfo/export`
+
+
+

+ 21 - 1
src/model/speedGoods.js

@@ -1,5 +1,5 @@
 
-import { api_speedGoodsList,api_speedGoodsAdd,api_speedPositionInfoList,api_speedPositionInfoAdd,api_speedCustomerInfoList ,api_speedCustomerInfoAdd,api_speedGoodsEdit,api_speedGoodsDel} from '@/api/V2/speedGoods'
+import { api_speedGoodsList,api_speedGoodsAdd,api_speedPositionInfoList,api_speedPositionInfoAdd,api_speedCustomerInfoList ,api_speedCustomerInfoAdd,api_speedGoodsEdit,api_speedGoodsDel,api_speedPositionInfoEdit,api_speedPositionInfoDel,api_speedCustomerInfoEdit,api_speedCustomerInfoDel,api_speedExpenseInfoList,api_speedExpenseInfoAdd,api_speedExpenseInfoEdit,api_speedExpenseInfoDel,api_speedWarehouseInOutInfoList,api_speedWarehouseInOutInfoAdd,api_speedWarehouseInOutInfoEdit,api_speedWarehouseInOutInfoDel,api_makeZero,api_exportOrder,api_speedCustomerInfo,api_selectInOutCount} from '@/api/V2/speedGoods'
 import { errorCatcher, errorHandle, filter } from 'base-core-lib'
 import { appRx } from './defalutConfig/indexRx'
 
@@ -12,8 +12,28 @@ export const speedGoodsDel = appRx.post(api_speedGoodsDel, errorCatcher, errorHa
 //仓位
 export const speedPositionInfoList = appRx.get(api_speedPositionInfoList, errorCatcher, errorHandle, filter)
 export const speedPositionInfoAdd = appRx.post(api_speedPositionInfoAdd, errorCatcher, errorHandle, filter)
+export const speedPositionInfoEdit = appRx.post(api_speedPositionInfoEdit, errorCatcher, errorHandle, filter)
+export const speedPositionInfoDel = appRx.post(api_speedPositionInfoDel, errorCatcher, errorHandle, filter)
 
 //客户
 export const speedCustomerInfoList = appRx.get(api_speedCustomerInfoList, errorCatcher, errorHandle, filter)
 export const speedCustomerInfoAdd = appRx.post(api_speedCustomerInfoAdd, errorCatcher, errorHandle, filter)
+export const speedCustomerInfoEdit = appRx.post(api_speedCustomerInfoEdit, errorCatcher, errorHandle, filter)
+export const speedCustomerInfoDel = appRx.post(api_speedCustomerInfoDel, errorCatcher, errorHandle, filter)
+
+//费用
+export const speedExpenseInfoList = appRx.get(api_speedExpenseInfoList, errorCatcher, errorHandle, filter)
+export const speedExpenseInfoAdd = appRx.post(api_speedExpenseInfoAdd, errorCatcher, errorHandle, filter)
+export const speedExpenseInfoEdit = appRx.post(api_speedExpenseInfoEdit, errorCatcher, errorHandle, filter)
+export const speedExpenseInfoDel = appRx.post(api_speedExpenseInfoDel, errorCatcher, errorHandle, filter)
+
+// 记录
+export const speedWarehouseInOutInfoList = appRx.get(api_speedWarehouseInOutInfoList, errorCatcher, errorHandle, filter)
+export const speedWarehouseInOutInfoDel = appRx.post(api_speedWarehouseInOutInfoDel, errorCatcher, errorHandle, filter)
+export const speedWarehouseInOutInfoEdit = appRx.post(api_speedWarehouseInOutInfoEdit, errorCatcher, errorHandle, filter)
+export const speedWarehouseInOutInfoAdd = appRx.post(api_speedWarehouseInOutInfoAdd, errorCatcher, errorHandle, filter)
+export const makeZero = appRx.post(api_makeZero, errorCatcher, errorHandle, filter)
+export const selectInOutCount = appRx.get(api_selectInOutCount, errorCatcher, errorHandle, filter)
+export const exportOrder = appRx.post(api_exportOrder)
+export const speedCustomerInfo = appRx.get(api_speedCustomerInfo, errorCatcher, errorHandle, filter)
 

+ 173 - 42
src/views/cost/cost.vue

@@ -3,9 +3,9 @@
   <div class="bg" id="index">
     <div class="row1">
       <div class="left">
-        <el-date-picker v-model="value2" type="daterange" align="right" unlink-panels range-separator="至"
-          start-placeholder="开始日期" end-placeholder="结束日期">
-        </el-date-picker>
+        <el-date-picker @change="datechange" format="yyyy-MM-dd" v-model="value2" type="daterange" unlink-panels range-separator="至"
+        start-placeholder="开始日期" end-placeholder="结束日期">
+      </el-date-picker>
 
       </div>
       <div class="right">
@@ -27,17 +27,25 @@
       </div>
     </div>
     <el-table ref="singleTable" :data="tableData" highlight-current-row style="width: 100%" class="table">
-      <el-table-column type="index" width="50">
+      <el-table-column type="index" width="50" label="序号">
       </el-table-column>
-      <el-table-column property="date" label="类型" width="120">
+      <el-table-column property="expensesType" label="类型" width="120">
       </el-table-column>
-      <el-table-column property="name" label="费用名称" width="120">
+      <el-table-column property="expenseName" label="费用名称" width="120">
       </el-table-column>
-      <el-table-column property="address" label="金额(元)">
+      <el-table-column property="amountMoney" label="金额(元)">
       </el-table-column>
-      <el-table-column property="address" label="备注">
+      <el-table-column property="remark" label="备注" >
+        <template slot-scope="scope">
+          <el-popover trigger="hover" placement="top">
+            <p>{{ scope.row.remark }}</p>
+            <div slot="reference" class="name-wrapper">
+              {{ scope.row.remark }}
+            </div>
+          </el-popover>
+        </template>
       </el-table-column>
-      <el-table-column prop="address" label="附件" show-overflow-tooltip>
+      <el-table-column prop="addressUrl" label="附件">
         <template slot-scope="scope">
           <img width="18" height="20" style="vertical-align: text-top; position: relative; top: -1px"
             src="../../../public/img/fujian.png" @click="fujian(scope.row)" alt="" />
@@ -71,13 +79,30 @@
         <ws-upload v-else ref="upload" :comp-id="compId" :appendix-ids="appendixIdss" :editable="false"
           accept=".jpg, .jpeg, .png, .pdf, .doc, .zip, .rar" />
       </WinseaContentModal>
-      <WinseaContentModal v-model="show" title="费用" @on-cancel="handleClose3">
+      <!-- 新增编辑弹框 -->
+      <WinseaContentModal v-model="show" :title="title" @on-cancel="handleClose3" style="width:600px;left:0;right:0;margin:auto;">
         <el-form>
-          <el-form-item label-width='100px' label="收款方" span="1" prop="payee">
-            <el-input class='input50 input_css' placeholder="输入收款方"></el-input>
+          <el-form-item label-width='100px' label="类型" span="1" prop="payee">
+            <el-select v-model="dataObj.expensesType" placeholder="请选择"  style="width:100%">
+              <el-option v-for="item in options" :key="item.value" :label="item.label" :value="item.value">
+              </el-option>
+            </el-select>
+          </el-form-item>
+          <el-form-item label-width='100px' label="费用名称" span="1" prop="payee">
+            <el-input placeholder="输入费用名称、不超过10个字" v-model="dataObj.expenseName"></el-input>
+          </el-form-item>
+          <el-form-item label-width='100px' label="金额" span="1" prop="payee" >
+            <el-input placeholder="输入金额" type="'number" v-model="dataObj.amountMoney"></el-input>
+          </el-form-item>
+
+          <el-form-item label-width='100px' label="备注" span="1" prop="payee">
+
+            <el-input type="textarea" placeholder="输入备注,0-150个字" v-model="dataObj.remark">
+            </el-input>
           </el-form-item>
+
           <ws-upload style="margin-left:30px" ref="upload" table-name="maintain_work_order" oss-key="mainPlan"
-            :comp-id="compId" :appendix-ids="appendixIdsAdd" :vesselId="deptBudgetList.addressUrl" :size-limit="size"
+            :comp-id="compId" :appendix-ids="appendixIdsAdd" :vesselId="dataObj.addressUrl" :size-limit="size"
             @uploadSuccess="uploadSuccess" @onChange="onChange" accept=".jpg, .jpeg, .png, .pdf, .doc, .zip, .rar" />
         </el-form>
         <div slot="footer" class="dialog-footer">
@@ -91,17 +116,40 @@
   
 <script>
 import WsUpload from '@/components/WsUpload'
+import {
+  speedExpenseInfoList,
+  speedExpenseInfoAdd,
+  speedExpenseInfoEdit,
+  speedExpenseInfoDel
+} from '@/model/speedGoods'
+import {
+    dayjs,
+    EventBus
+  } from 'base-core-lib'
 export default {
   components: {
     WsUpload
   },
   data() {
     return {
+      expensesType:'',
+      formData:[],
+      dataObj:{
+        expensesType:'支出',
+        compId: localStorage.getItem('ws-pf_compId')
+      },
+      options: [{
+        value: '支出',
+        label: '支出'
+      }, {
+        value: '收入',
+        label: '收入'
+      }],
+      title: '新增',
       fileNum: '',
       size: 10,
       appendixIdsAdd: '',
       show: false,
-      deptBudgetList: {},
       compId: localStorage.getItem('ws-pf_compId'),
       appendixIdss: [],
       applstatus: false,
@@ -111,25 +159,15 @@ export default {
       currentPage: 1,
       pageSize: 10,
       id: '',
-      tableData: [{
-        date: '2016-05-02',
-        name: '王小虎',
-        address: '上海市普陀区金沙江路 1518 弄'
-      }, {
-        date: '2016-05-04',
-        name: '王小虎',
-        address: '上海市普陀区金沙江路 1517 弄'
-      }, {
-        date: '2016-05-01',
-        name: '王小虎',
-        address: '上海市普陀区金沙江路 1519 弄'
-      }, {
-        date: '2016-05-03',
-        name: '王小虎',
-        address: '上海市普陀区金沙江路 1516 弄'
-      }],
+      tableData: [],
       value2: '',
-      searchKeyWord: ''
+      searchKeyWord: '',
+      date: {
+          year: dayjs().format('YYYY'),
+          month: dayjs().format('MM'),
+        },
+        startDate:'',
+        endDate:''
     };
   },
   filters: {
@@ -138,6 +176,7 @@ export default {
     },
   },
   created() {
+    this.getList()
   },
   mounted() {
 
@@ -148,22 +187,94 @@ export default {
 
   },
   methods: {
-    submitdata() { },
+    dateFormat(fmt, date) {
+      let ret
+      const opt = {
+        'Y+': date.getFullYear().toString(), // 年
+        'm+': (date.getMonth() + 1).toString(), // 月
+        'd+': date.getDate().toString(), // 日
+        // 'H+': date.getHours().toString(), // 时
+        // "M+": date.getMinutes().toString(),         // 分
+        // "S+": date.getSeconds().toString()          // 秒
+        // 有其他格式化字符需求可以继续添加,必须转化成字符串
+      }
+      for (let k in opt) {
+        ret = new RegExp('(' + k + ')').exec(fmt)
+        if (ret) {
+          fmt = fmt.replace(
+            ret[1],
+            ret[1].length == 1 ? opt[k] : opt[k].padStart(ret[1].length, '0')
+          )
+        }
+      }
+      return fmt
+    },
+    datechange(e){
+      if (this.value2) {
+          this.startDate = this.dateFormat('YYYY-mm-dd', this.value2[0])
+          this.endDate = this.dateFormat('YYYY-mm-dd', this.value2[1])
+        } else {
+          this.startDate = ''
+          this.endDate = ''
+        }
+        this.getList()
+    },
+    getList(){
+      speedExpenseInfoList({
+        compId: localStorage.getItem('ws-pf_compId'),
+        currentPage: this.currentPage,
+            pageSize: this.pageSize,
+            searchKeyWord: this.searchKeyWord,
+            expensesType:this.expensesType,
+            startDate:this.startDate,
+        endDate:this.endDate,
+      })
+        .toPromise()
+        .then((response) => {
+          console.log(response)
+          if(response.records){
+            for(let i = 0;i<response.records.length;i++){
+              response.records[i].addressUrlArray = []
+              response.records[i].addressUrlArray = response.records[i].addressUrl?response.records[i].addressUrl.split(","):[]
+            }
+          }
+          this.tableData = response.records
+        })
+    },
+    submitdata() { 
+      if(this.title=='新增'){
+        speedExpenseInfoAdd(this.dataObj)
+        .toPromise()
+        .then((response) => {
+          console.log(response)
+          if(response=="ok"){
+            this.$message.success('提交成功!')
+            this.show = false
+            this.getList()
+          }
+        })
+      }else{
+        speedExpenseInfoEdit(this.dataObj)
+        .toPromise()
+        .then((response) => {
+          console.log(response)
+          if(response=="ok"){
+            this.$message.success('提交成功!')
+            this.show = false
+            this.getList()
+          }
+        })
+      }
+    },
     onChange(files) {
       this.fileNum = files
       this.$refs.upload.handleSaveBill().then((res) => {
+        this.dataObj.addressUrl = res
         console.log(files)
       })
     },
     uploadSuccess(data, files, url) {
       console.log(data, files, url)
-
-      // this.deptBudgetList.
-      // this.formData.append('files', files)
-      // this.feedbackObj.uploadNameAttachment = data.appendixName
-      // this.feedbackObj.pathUploadAttachment = data.appendixPath
-      // // this.newAppendixs = files
-      // this.onChangeFlag = true
     },
     handleClose3() {
       this.show = false
@@ -187,18 +298,35 @@ export default {
       console.log(`当前页: ${val}`)
       this.getList()
     },
-    edit() { },
+    edit(val) {
+      this.title = '编辑'
+      this.show = true
+      this.dataObj = val
+      this.appendixIdsAdd = val.addressUrl
+     },
     del(val) {
       this.$confirm('确定删除费用信息?', '提示', {
         confirmButtonText: '确定',
         cancelButtonText: '取消',
         type: 'warning'
       }).then(() => {
+        speedExpenseInfoDel({id:val.id})
+        .toPromise()
+        .then((response) => {
+          console.log(response)
+          if(response=="ok"){
+            this.$message.success('删除成功!')
+            this.show = false
+            this.getList()
+          }
+        })
       }).catch(() => {
         return false
       });
     },
-    lookup() { },
+    lookup() {
+      this.getList()
+     },
     add() {
       this.show = true
     },
@@ -247,5 +375,8 @@ export default {
 .table {
   margin-top: 20px;
 }
+.search_css{
+  width: 240px;
+}
 </style>
   

+ 48 - 5
src/views/customer/customer.vue

@@ -34,7 +34,7 @@
         :page-size="deptCircularPage.pageSize" layout="total, sizes, prev, pager, next, jumper" :total="deptBudgetTotal">
       </el-pagination>
     </div>
-    <el-dialog width="320px" title="客户" :visible.sync="isShowInventory" :append-to-body="true" :close="inventoryClose">
+    <el-dialog width="320px" :title="title" :visible.sync="isShowInventory" :append-to-body="true" :close="inventoryClose">
       <el-form class="customer" label-position="right" label-width="80px">
         <el-form-item class="customer-item" label="姓名">
           <el-input placeholder="请输入姓名" maxlength="100" size="small"  v-model="dataObj.customerName"/>
@@ -63,13 +63,16 @@
 <script>
 import {
   speedCustomerInfoList,
-  speedCustomerInfoAdd
+  speedCustomerInfoAdd,
+  speedCustomerInfoEdit,
+  speedCustomerInfoDel
 } from '@/model/speedGoods'
 export default {
   components: {
   },
   data() {
     return {
+      title:'新增',
       dataObj:{
         compId: localStorage.getItem('ws-pf_compId')
       },
@@ -119,13 +122,26 @@ export default {
       this.getList()
     },
     lookup() { },
-    edit() { },
+    edit(val) {
+      this.title="编辑"
+      this.isShowInventory = true
+      this.dataObj = val
+     },
     del(val) {
       this.$confirm('确定删除客户信息?', '提示', {
         confirmButtonText: '确定',
         cancelButtonText: '取消',
         type: 'warning'
       }).then(() => {
+        speedCustomerInfoDel({ id: val.id })
+        .toPromise()
+        .then((response) => {
+          if (response == "ok") {
+              this.show = false
+              this.$message.success('删除成功!')
+              this.getList()
+            }
+        })
       }).catch(() => {
         return false
       });
@@ -137,16 +153,43 @@ export default {
       this.isShowInventory = true
     },
     customerConfirm() { 
-      speedCustomerInfoAdd(this.dataObj)
+      if(!this.dataObj.customerName){
+        this.$message.error('姓名不能为空!')
+        return
+      }
+      if(!this.dataObj.customerPhone){
+        this.$message.error('手机号不能为空!')
+        return
+      }
+      debugger
+      if(this.dataObj.customerPhone.length!=11){
+        this.$message.error('手机号11位!')
+        return
+      }
+      if(this.title=='新增'){
+        speedCustomerInfoAdd(this.dataObj)
         .toPromise()
         .then((response) => {
           console.log(response)
-          if(response.code=="200"){
+          if(response=="ok"){
             this.$message.success('提交成功!')
             this.isShowInventory = false
             this.getList()
           }
         })
+      }else{
+        speedCustomerInfoEdit(this.dataObj)
+        .toPromise()
+        .then((response) => {
+          console.log(response)
+          if(response=="ok"){
+            this.$message.success('提交成功!')
+            this.isShowInventory = false
+            this.getList()
+          }
+        })
+      }
+
     }
   },
 };

+ 409 - 226
src/views/record/record.vue

@@ -3,14 +3,15 @@
   <div class="bg" id="index">
     <div class="row1">
       <div class="left">
-        <el-date-picker v-model="value2" type="daterange" align="right" unlink-panels range-separator="至"
-          start-placeholder="开始日期" end-placeholder="结束日期">
+        <el-date-picker @change="datechange" format="yyyy-MM-dd" v-model="value2" type="daterange" unlink-panels
+          range-separator="至" start-placeholder="开始日期" end-placeholder="结束日期">
         </el-date-picker>
         <el-input :placeholder="'可按业务编号、车牌号、客户名查找'" clearable v-model="searchKeyWord" class="search_css"></el-input>
         <el-button type="primary" size="small" @click="lookup" class="search">查找</el-button>
       </div>
       <div class="right">
-        <el-button type="primary" size="small" @click="batchPay()">批量付款</el-button>
+        <el-button type="primary" size="small" @click="batchPay(1)">批量收款</el-button>
+        <el-button type="primary" size="small" @click="batchPay(2)">批量付款</el-button>
         <el-button type="primary" size="small" @click="exportExcel()">导出</el-button>
         <el-button type="primary" size="small" @click="handlestatus(1)">盘亏</el-button>
         <el-button type="primary" size="small" @click="handlestatus(2)">盘盈</el-button>
@@ -18,22 +19,22 @@
     </div>
     <div class="row2">
       <div class="left">
-        <el-button type="primary" size="small">全部</el-button>
-        <el-button type="primary" size="small">入库记录</el-button>
-        <el-button type="primary" size="small">出库记录</el-button>
-        <el-button type="primary" size="small">已付</el-button>
-        <el-button type="primary" size="small">未付</el-button>
-        <el-button type="primary" size="small">已收</el-button>
-        <el-button type="primary" size="small">未收</el-button>
+        <el-button type="primary" size="small" @click="search(0)">全部</el-button>
+        <el-button type="primary" size="small" @click="search(1)">入库记录</el-button>
+        <el-button type="primary" size="small" @click="search(2)">出库记录</el-button>
+        <el-button type="primary" size="small" @click="search('已付')">已付</el-button>
+        <el-button type="primary" size="small" @click="search('未付')">未付</el-button>
+        <el-button type="primary" size="small" @click="search('已收')">已收</el-button>
+        <el-button type="primary" size="small" @click="search('未收')">未收</el-button>
       </div>
       <div class="right">
-        <el-select v-model="value" placeholder="请选择">
-          <el-option v-for="item in options" :key="item.value" :label="item.label" :value="item.value">
+        <el-select v-model="value" placeholder="请选择" @change="changeGoodsName">
+          <el-option v-for="item in goodsList" :key="item.id" :label="item.goodsName" :value="item.goodsName">
           </el-option>
         </el-select>
-        <div class="text">库存1000吨</div>
-        <div class="text">加权成本200元/吨</div>
-        <el-button type="primary" size="small" @click="makeZero()">归零</el-button>
+        <div class="text">库存{{ goodsObj.storage }}吨</div>
+        <div class="text">加权成本{{ goodsObj.weightedCost }}元/吨</div>
+        <el-button type="primary" size="small" @click="zero()">归零</el-button>
       </div>
     </div>
     <div>
@@ -41,41 +42,62 @@
         @selection-change="handleSelectionChange" class="table">
         <el-table-column type="selection" width="55">
         </el-table-column>
-        <el-table-column label="业务编号" width="120">
-          <template slot-scope="scope">{{ scope.row.date }}</template>
+        <el-table-column label="业务编号" width="120" prop="businessNo">
         </el-table-column>
-        <el-table-column prop="name" label="仓位"></el-table-column>
+        <el-table-column prop="positionNo" label="仓位"></el-table-column>
         <el-table-column prop="address" label="类型" show-overflow-tooltip>
+          <template slot-scope="scope">
+            <div v-if="scope.row.inOutFlag == 1">出库</div>
+            <div v-else>入库</div>
+          </template>
         </el-table-column>
-        <el-table-column prop="address" label="车牌号" show-overflow-tooltip>
+        <el-table-column prop="carNumber" label="车牌号" show-overflow-tooltip>
         </el-table-column>
-        <el-table-column prop="address" label="客户" show-overflow-tooltip>
-          <template slot-scope="scope"> 
-            <div v-if="true" style="color:cornflowerblue"  @click="customerClick(scope.row)">123</div>
-            <div v-else>456</div>
+        <el-table-column prop="customerName" label="客户" show-overflow-tooltip>
+          <template slot-scope="scope">
+            <div style="color:cornflowerblue" v-if="scope.row.customerId" @click="selectCustomer(scope.row)">
+              {{ scope.row.customerName }}</div>
+            <div v-else>{{ scope.row.customerName }}</div>
           </template>
+
         </el-table-column>
-        <el-table-column prop="address" label="货名" show-overflow-tooltip>
+        <el-table-column prop="goodsName" label="货名" show-overflow-tooltip>
         </el-table-column>
-        <el-table-column prop="address" label="毛重(吨)" show-overflow-tooltip>
+        <el-table-column prop="grossWeight" label="毛重(吨)" show-overflow-tooltip>
         </el-table-column>
-        <el-table-column prop="address" label="皮重(吨)" show-overflow-tooltip>
+        <el-table-column prop="trae" label="皮重(吨)" show-overflow-tooltip>
         </el-table-column>
-        <el-table-column prop="address" label="净重(吨)" show-overflow-tooltip>
+        <el-table-column prop="netWeight" label="净重(吨)" show-overflow-tooltip>
         </el-table-column>
-        <el-table-column prop="address" label="容重(克/升)" show-overflow-tooltip>
+        <el-table-column prop="bulkDensity" label="容重(克/升)" width="100">
         </el-table-column>
-        <el-table-column prop="address" label="水分(%)" show-overflow-tooltip>
+        <el-table-column prop="waterContent" label="水分(%)" show-overflow-tooltip>
         </el-table-column>
         <el-table-column prop="address" label="更多指标" show-overflow-tooltip>
+          <template slot-scope="scope">
+            <div style="color:cornflowerblue">查看</div>
+          </template>
         </el-table-column>
-        <el-table-column prop="address" label="单价(元/吨)" show-overflow-tooltip>
+        <el-table-column prop="unitPrice" label="单价(元/吨)" width="100">
         </el-table-column>
-        <el-table-column prop="address" label="粮款(元)" show-overflow-tooltip>
+        <el-table-column prop="grainFund" label="粮款(元)" show-overflow-tooltip>
         </el-table-column>
         <el-table-column prop="address" label="备注" show-overflow-tooltip>
+          <template slot-scope="scope">
+            <div style="color:cornflowerblue">查看</div>
+          </template>
         </el-table-column>
-        <el-table-column prop="address" label="收款状态" show-overflow-tooltip>
+        <el-table-column prop="createDate" label="日期" width="140">
+        </el-table-column>
+        <el-table-column prop="status" label="收款状态" show-overflow-tooltip>
+          <template slot-scope="scope">
+            <div style="display:flex;align-items: center">
+              <div style="color:cornflowerblue">{{ scope.row.status }}</div>
+              <img src="../../../public/img/change.png" alt="" width="18" height="20"
+                style="vertical-align: text-top; position: relative; top: -1px" @click="changeStatus(scope.row)">
+            </div>
+
+          </template>
         </el-table-column>
         <el-table-column prop="address" label="附件" show-overflow-tooltip>
           <template slot-scope="scope">
@@ -101,76 +123,115 @@
       <el-pagination @size-change="handleSizeChange" @current-change="handleCurrentChange" :current-page="currentPage"
         :page-size="deptCircularPage.pageSize" layout="total, sizes, prev, pager, next, jumper" :total="deptBudgetTotal">
       </el-pagination>
-      <WinseaContentModal v-model="accessoryTFs" :title="$t('system.noticeCircular.information')"
-        @on-cancel="handleClose">
-        <div v-if="applstatus">
+      <WinseaContentModal v-model="accessoryTFs" @on-cancel="handleClose">
+        <div>
           <ws-upload ref="upload" :size-limit="size" @onChange="onChange" :comp-id="compId" :appendix-ids="appendixIdss"
-            accept=".jpg, .jpeg, .png, .pdf, .doc, .docx, .zip, .rar"
-            v-hasPermission="`contractManagement.buyContract.buyContractInfo.appl`" />
+            accept=".jpg, .jpeg, .png, .pdf, .doc, .docx, .zip, .rar" />
         </div>
-        <ws-upload v-else ref="upload" :comp-id="compId" :appendix-ids="appendixIdss" :editable="false"
-          accept=".jpg, .jpeg, .png, .pdf, .doc, .zip, .rar" />
       </WinseaContentModal>
     </div>
     <el-dialog width="320px" title="客户信息" :visible.sync="isShowCustomer" :append-to-body="true" :close="customerclose">
-      <el-form class="customer" label-position="right" label-width="80px">
+      <el-form class="customer" label-position="right" label-width="120px">
         <el-form-item class="customer-item" label="姓名">
-          <el-input  disabled placeholder="请输入身份证号" maxlength="100" size="small" />
+          <el-input disabled maxlength="100" size="small" v-model="customerObj.customerName" />
         </el-form-item>
-        <el-form-item class="customer-item" label="现有库存(吨)">
-          <el-input  disabled placeholder="请输入身份证号" maxlength="100" size="small" />
+        <el-form-item class="customer-item" label="手机号">
+          <el-input disabled size="small" v-model="customerObj.customerPhone" />
         </el-form-item>
-        <el-form-item class="customer-item" label="">
-          <el-input  disabled placeholder="请输入身份证号" maxlength="100" size="small" />
+        <el-form-item class="customer-item" label="银行卡号">
+          <el-input disabled v-model="customerObj.bankCard" size="small" />
         </el-form-item>
         <el-form-item class="customer-item" label="开户行">
-          <el-input  disabled placeholder="请输入身份证号" maxlength="100" size="small" />
+          <el-input disabled v-model="customerObj.bankDeposit" size="small" />
         </el-form-item>
         <el-form-item class="customer-item" label="开户支行">
-          <el-input  disabled placeholder="请输入身份证号" maxlength="100" size="small" />
+          <el-input disabled v-model="customerObj.bankDepositBranch" size="small" />
         </el-form-item>
       </el-form>
-      <!-- <div slot="footer" class="dialog-footer">
-        <el-button @click="customerclose">取 消</el-button>
-        <el-button @click="customerConfirm" type='primary'>确 定</el-button>
-      </div> -->
     </el-dialog>
-    <el-dialog width="320px" :title="inventoryTitle" :visible.sync="isShowInventory" :append-to-body="true" :close="inventoryClose">
-      <el-form class="customer" label-position="right" label-width="80px">
-        <el-form-item class="customer-item" label="姓名">
-          <el-input  disabled placeholder="请输入身份证号" maxlength="100" size="small" />
+    <el-dialog width="320px" :title="inventoryTitle" :visible.sync="isShowInventory" :append-to-body="true"
+      :close="inventoryClose">
+      <el-form class="customer" label-position="right" label-width="120px">
+        <el-form-item class="customer-item" label="货名">
+          <el-select v-model="pSubmitObj.goodsName" placeholder="请选择" @change="changeGoodsName1">
+            <el-option v-for="item in goodsList" :key="item.id" :label="item.goodsName" :value="item.goodsName">
+            </el-option>
+          </el-select>
         </el-form-item>
-        <el-form-item class="customer-item" label="手机号">
-          <el-input  disabled placeholder="请输入身份证号" maxlength="100" size="small" />
+        <el-form-item class="customer-item" label="现有库存">
+          <el-input disabled size="small" v-model="goodsObj1.storage" />
         </el-form-item>
-        <el-form-item class="customer-item" label="银行卡号">
-          <el-input  disabled placeholder="请输入身份证号" maxlength="100" size="small" />
+        <el-form-item class="customer-item" label="盘亏重量(吨)" v-if="inventoryTitle == '盘亏'">
+          <el-input placeholder="输入盘亏重量" maxlength="100" size="small" v-model="pSubmitObj.netWeight" @input="inputVal"
+            type="number" />
         </el-form-item>
-        <el-form-item class="customer-item" label="开户行">
-          <el-input  disabled placeholder="请输入身份证号" maxlength="100" size="small" />
+        <el-form-item class="customer-item" label="单价(元/吨)" v-if="inventoryTitle == '盘亏'">
+          <el-input placeholder="输入盘亏重量单价" size="small" v-model="pSubmitObj.unitPrice" @input="inputVal" type="number" />
         </el-form-item>
-        <el-form-item class="customer-item" label="开户支行">
-          <el-input  disabled placeholder="请输入身份证号" maxlength="100" size="small" />
+        <el-form-item class="customer-item" label="货值(元)" v-if="inventoryTitle == '盘亏'">
+          <el-input disabled placeholder="自动计算盘亏重量的货值" size="small" v-model="pSubmitObj.grainFund" />
+        </el-form-item>
+        <el-form-item class="customer-item" label="盘亏重量(吨)" v-if="inventoryTitle == '盘盈'">
+          <el-input placeholder="输入盘盈重量" maxlength="100" size="small" v-model="pSubmitObj.netWeight" @input="inputVal"
+            type="number" />
+        </el-form-item>
+        <el-form-item class="customer-item" label="单价(元/吨)" v-if="inventoryTitle == '盘盈'">
+          <el-input placeholder="输入盘盈重量单价" size="small" v-model="pSubmitObj.unitPrice" @input="inputVal" type="number" />
+        </el-form-item>
+        <el-form-item class="customer-item" label="货值(元)" v-if="inventoryTitle == '盘盈'">
+          <el-input disabled placeholder="自动计算盘盈重量的货值" size="small" v-model="pSubmitObj.grainFund" />
         </el-form-item>
       </el-form>
-      <!-- <div slot="footer" class="dialog-footer">
-        <el-button @click="customerclose">取 消</el-button>
-        <el-button @click="customerConfirm" type='primary'>确 定</el-button>
-      </div> -->
+      <div slot="footer" class="dialog-footer">
+        <el-button @click="panSubmit" type='primary'>提 交</el-button>
+      </div>
     </el-dialog>
   </div>
 </template>
   
 <script>
-  import WsUpload from '@/components/WsUpload'
+import WsUpload from '@/components/WsUpload'
+import {
+    downloadFile
+  } from '@/utils/batchDown'
+import {
+  dayjs,
+  EventBus
+} from 'base-core-lib'
+import {
+  speedWarehouseInOutInfoList,
+  speedWarehouseInOutInfoAdd,
+  speedWarehouseInOutInfoEdit,
+  speedWarehouseInOutInfoDel,
+  makeZero,
+  // selectInOutCount,
+  exportOrder,
+  speedCustomerInfo,
+  speedGoodsList
+} from '@/model/speedGoods'
 export default {
   components: {
+    WsUpload
   },
   data() {
     return {
-      inventoryTitle:'',
-      isShowInventory:false,
-      isShowCustomer:false,
+      dataObj: {},
+      size: 10,
+      pSubmitObj: {
+        goodsName: ''
+      },
+      goodsObj: {},
+      goodsObj1: {},
+      date: {
+        year: dayjs().format('YYYY'),
+        month: dayjs().format('MM'),
+      },
+      startDate: '',
+      endDate: '',
+      inventoryTitle: '',
+      isShowInventory: false,
+      isShowCustomer: false,
+      customerObj: {},
       compId: localStorage.getItem('ws-pf_compId'),
       appendixIdss: [],
       applstatus: false,
@@ -179,101 +240,20 @@ export default {
       deptBudgetTotal: 0,
       currentPage: 1,
       pageSize: 10,
-      tableData: [{
-        date: '2016-05-03',
-        name: '王小虎',
-        address: '上海市普陀区金沙江路 1518 弄'
-      }, {
-        date: '2016-05-02',
-        name: '王小虎',
-        address: '上海市普陀区金沙江路 1518 弄'
-      }, {
-        date: '2016-05-04',
-        name: '王小虎',
-        address: '上海市普陀区金沙江路 1518 弄'
-      }, {
-        date: '2016-05-01',
-        name: '王小虎',
-        address: '上海市普陀区金沙江路 1518 弄'
-      }, {
-        date: '2016-05-08',
-        name: '王小虎',
-        address: '上海市普陀区金沙江路 1518 弄'
-      }, {
-        date: '2016-05-06',
-        name: '王小虎',
-        address: '上海市普陀区金沙江路 1518 弄'
-      }, {
-        date: '2016-05-07',
-        name: '王小虎',
-        address: '上海市普陀区金沙江路 1518 弄'
-      }],
+      tableData: [],
       multipleSelection: [],
-      options: [{
-        value: '选项1',
-        label: '黄金糕'
-      }, {
-        value: '选项2',
-        label: '双皮奶'
-      }, {
-        value: '选项3',
-        label: '蚵仔煎'
-      }, {
-        value: '选项4',
-        label: '龙须面'
-      }, {
-        value: '选项5',
-        label: '北京烤鸭'
-      }],
+      goodsList: [],
       value: '',
+      value1: '',
       searchKeyWord: '',
-      value2: [],
-      pickerOptions: {
-        shortcuts: [{
-          text: '本周',
-          onClick(picker) {
-            const end = new Date()
-            const start = new Date()
-            var thisDay = start.getDay()
-            var thisDate = start.getDate()
-            if (thisDay != 0) {
-              start.setDate(thisDate - thisDay)
-            }
-            picker.$emit('pick', [start, end])
-          },
-        },
-        {
-          text: '本月',
-          onClick(picker) {
-            const end = new Date()
-            const start = new Date()
-            start.setDate(1)
-            picker.$emit('pick', [start, end])
-          },
-        },
-        {
-          text: '本季度',
-          onClick(picker) {
-            var oDate = new Date()
-
-            var thisYear = oDate.getFullYear()
-            var thisMonth = oDate.getMonth() + 1
-
-            var n = Math.ceil(thisMonth / 3) // 季度
-
-            var Month = n * 3 - 1
-
-            var start = new Date(thisYear, Month - 2, 1)
-            var end = new Date()
-
-            picker.$emit('pick', [start, end])
-          },
-        },
-        ],
-      },
+      value2: '',
+      status: ''
     };
   },
   created() {
+    this.getGoodSName()
+    this.getList()
+
   },
   mounted() {
 
@@ -283,86 +263,291 @@ export default {
 
   },
   methods: {
-    exportExcel(){
-      this.$confirm('确定勾选的条目均已付款?', '提示', {
-          confirmButtonText: '确定',
-          cancelButtonText: '取消',
-          type: 'warning'
-        }).then(() => {
-        }).catch(() => {
-          return false
-        });
+    changeStatus(val) {
+      if (val.status == '已付') {
+        val.status = "未付"
+      } else if (val.status == '未付') {
+        val.status = "已付"
+        val.flag = 1
+      } else if (val.status == '已收') {
+        val.status = "未收"
+      } else if (val.status == '未收') {
+        val.status = "已收"
+        val.flag = 2
+      }
+      speedWarehouseInOutInfoEdit(val).toPromise()
+        .then((res) => {
+          if (res == "ok") {
+            this.$message.success('提交成功!')
+            this.isShowInventory = false
+          }
+        })
     },
-    batchPay(){
-      this.$confirm('确定勾选的条目均已付款?', '提示', {
-          confirmButtonText: '确定',
-          cancelButtonText: '取消',
-          type: 'warning'
-        }).then(() => {
-        }).catch(() => {
-          return false
-        });
+    inputVal() {
+      if (this.pSubmitObj.netWeight && this.pSubmitObj.unitPrice) {
+        this.pSubmitObj.grainFund = this.pSubmitObj.netWeight * this.pSubmitObj.unitPrice
+      }
     },
-    del(val){
-      this.$confirm('确定删除出入库记录?', '提示', {
-          confirmButtonText: '确定',
-          cancelButtonText: '取消',
-          type: 'warning'
-        }).then(() => {
-        }).catch(() => {
-          return false
-        });
+    //盘亏盘盈
+    async panSubmit() {
+      this.pSubmitObj.compId = this.compId
+      if (this.pSubmitObj == '盘亏') {
+        this.pSubmitObj.inOutFlag = 1
+      } else {
+        this.pSubmitObj.inOutFlag = 2
+      }
+      // //查看编号
+      // await selectInOutCount({
+      //   compId: this.compId,
+      //   noFlag: _number,
+      // }).toPromise()
+      //   .then((res) => {
+      //     this.pSubmitObj.noFlag = res
+      //   })
+      // console.log(this.pSubmitObj)
+      await speedWarehouseInOutInfoAdd(this.pSubmitObj).toPromise()
+        .then((res) => {
+          if (res == "ok") {
+            this.$message.success('提交成功!')
+            this.isShowInventory = false
+          }
+        })
+    },
+    selectCustomer(val) {
+      speedCustomerInfo({
+        customerId: val.customerId
+      })
+        .toPromise()
+        .then((response) => {
+          this.isShowCustomer = true
+          this.customerObj = response
+        })
+    },
+    search(type) {
+      switch (type) {
+        case 0:
+          this.searchType = ''
+          this.status = ''
+          break
+        case 1:
+          this.searchType = 1
+          break;
+        case 2:
+          this.searchType = 2
+          break;
+        default:
+          this.status = type
+          break
+      }
+      this.getList()
+    },
+    changeGoodsName(val) {
+      console.log(val)
+      this.goodsObj = this.goodsList.filter((item) => {
+        if (val == item.goodsName) return item
+      })[0]
+      console.log(this.goodsObj)
+    },
+    changeGoodsName1(val) {
+      console.log(val)
+      this.goodsObj1 = this.goodsList.filter((item) => {
+        if (val == item.goodsName) return item
+      })[0]
+      console.log(this.goodsObj)
+    },
+    dateFormat(fmt, date) {
+      let ret
+      const opt = {
+        'Y+': date.getFullYear().toString(), // 年
+        'm+': (date.getMonth() + 1).toString(), // 月
+        'd+': date.getDate().toString(), // 日
+        // 'H+': date.getHours().toString(), // 时
+        // "M+": date.getMinutes().toString(),         // 分
+        // "S+": date.getSeconds().toString()          // 秒
+        // 有其他格式化字符需求可以继续添加,必须转化成字符串
+      }
+      for (let k in opt) {
+        ret = new RegExp('(' + k + ')').exec(fmt)
+        if (ret) {
+          fmt = fmt.replace(
+            ret[1],
+            ret[1].length == 1 ? opt[k] : opt[k].padStart(ret[1].length, '0')
+          )
+        }
+      }
+      return fmt
+    },
+    datechange(e) {
+      if (this.value2) {
+        this.startDate = this.dateFormat('YYYY-mm-dd', this.value2[0])
+        this.endDate = this.dateFormat('YYYY-mm-dd', this.value2[1])
+      } else {
+        this.startDate = ''
+        this.endDate = ''
+      }
+      this.getList()
+    },
+    getGoodSName() {
+      speedGoodsList({
+        compId: localStorage.getItem('ws-pf_compId')
+      })
+        .toPromise()
+        .then((response) => {
+          console.log(response)
+          this.goodsList = response
+          if (this.goodsList.length != 0) {
+            this.value = this.goodsList[0].goodsName
+            this.pSubmitObj.goodsName = this.goodsList[0].goodsName
+            this.goodsObj = this.goodsList[0]
+            this.goodsObj1 = this.goodsList[0]
+          }
+        })
+    },
+    getList() {
+      speedWarehouseInOutInfoList({
+        compId: this.compId,
+        currentPage: this.currentPage,
+        pageSize: this.pageSize,
+        searchKeyWord: this.searchKeyWord,
+        searchType: this.searchType,
+        startDate: this.startDate,
+        endDate: this.endDate,
+        status: this.status
+      })
+        .toPromise()
+        .then((response) => {
+          console.log(response)
+          if (response.records) {
+            for (let i = 0; i < response.records.length; i++) {
+              response.records[i].addressUrlArray = []
+              response.records[i].addressUrlArray = response.records[i].addressUrl ? response.records[i].addressUrl.split(",") : []
+            }
+          }
+          this.tableData = response.records
+          this.deptBudgetTotal = response.total
+
+
+        })
+    },
+    async exportExcel() {
+      if(this.multipleSelection.length==0){
+        this.$message.error("请勾选导出条目!")
+        return
+      }
+      const {
+          data
+        } = await exportOrder({
+          speedWarehouseInOutInfoList:this.multipleSelection
+        }, {}, {
+          responseType: 'blob',
+        }).toPromise()
+        downloadFile({
+          res: data,
+          fileName: `${
+          this.date.year + (this.date.month ? `-${this.date.month}` : '')
+        }_出入库记录`,
+          type: 'xls',
+        })
     },
-    makeZero(){
-      this.$confirm('确定将【我是货名】的库存和成本归零?', '提示', {
-          confirmButtonText: '确定',
-          cancelButtonText: '取消',
-          type: 'warning'
-        }).then(() => {
+    batchPay(val) {
+      let _flag = ''
+      let _text = ""
+      if (val == 1) {
+        _text = '收款'
+        _flag = 4
+        for (let i = 0; i < this.multipleSelection.length; i++) {
+          if (this.multipleSelection[i].status == '已付' || this.multipleSelection[i].status == '未付'||this.multipleSelection[i].status == '已收') {
+            this.$message.error('存在已付或未付或已收项,请重新勾选!')
+            return
+          }
+        }
+      } else {
+        _text = '付款'
+        _flag = 3
+        for (let i = 0; i < this.multipleSelection.length; i++) {
+          if (this.multipleSelection[i].status == '已收' || this.multipleSelection[i].status == '未收'|| this.multipleSelection[i].status == '已付') {
+            this.$message.error('存在已收或未收或已付项,请重新勾选!')
+            return
+          }
+        }
+      }
 
-          // suspendinstance({
-          //     workflowId: row.workflowId,
-          //     id: row.id
-          //   }).toPromise()
-          //   .then((response) => {
-          //     this.$message({
-          //       type: 'success',
-          //       message: '反结算成功!'
-          //     });
-          //     this.getList()
-          //   })
-        }).catch(() => {
-          return false
-        });
+      this.$confirm('确定勾选的条目均已' + _text + '?', '提示', {
+        confirmButtonText: '确定',
+        cancelButtonText: '取消',
+        type: 'warning'
+      }).then(() => {
+
+        speedWarehouseInOutInfoEdit({flag:_flag,speedWarehouseInOutInfoList:this.multipleSelection}).toPromise()
+        .then((res) => {debugger
+          if (res == "OK") {
+            this.$message.success('提交成功!')
+            this.isShowInventory = false
+            this.getList()
+          }
+        })
+
+      }).catch(() => {
+        return false
+      });
+    },
+    del(val) {
+      this.$confirm('确定删除出入库记录?', '提示', {
+        confirmButtonText: '确定',
+        cancelButtonText: '取消',
+        type: 'warning'
+      }).then(() => {
+      }).catch(() => {
+        return false
+      });
     },
-    inventoryClose(){
+    zero() {
+      this.$confirm('确定将【' + this.goodsObj.goodsName + '】的库存和成本归零?', '提示', {
+        confirmButtonText: '确定',
+        cancelButtonText: '取消',
+        type: 'warning'
+      }).then(() => {
+        makeZero({
+          id: this.goodsObj.id
+        }).toPromise()
+          .then((response) => {
+            this.$message({
+              type: 'success',
+              message: '操作成功!'
+            });
+            this.getGoodSName()
+          })
+      }).catch(() => {
+        return false
+      });
+    },
+    inventoryClose() {
       this.isShowInventory = false
     },
     //盘亏盘盈
-    handlestatus(type){
+    handlestatus(type) {
       console.log(type)
-      if(type==1){
+      if (type == 1) {
         this.inventoryTitle = '盘亏'
-      }else{
-      this.inventoryTitle = '盘盈'
+      } else {
+        this.inventoryTitle = '盘盈'
       }
       this.isShowInventory = true
     },
-    customerclose(){
+    customerclose() {
       this.isShowCustomer = false
     },
     // 查看客户
-    customerClick(val){
+    customerClick(val) {
       this.isShowCustomer = true
     },
     onChange() {
       this.$refs.upload
         .handleSaveBill()
         .then(async (response) => {
-          this.deptBudgetList.addressUrl = response
-          this.deptBudgetList.id = this.id
-          this.deptBudgetList.flag = 1
-          editInfo(this.deptBudgetList)
+          this.dataObj.addressUrl = response
+          this.dataObj.flag = 0
+          speedWarehouseInOutInfoEdit(this.dataObj)
             .toPromise()
             .then((response) => {
               this.accessoryTFs = false
@@ -378,13 +563,6 @@ export default {
     // 上传附件
     uploadSuccess(data, files, url) {
       console.log(data, files, url)
-
-      // this.deptBudgetList.
-      // this.formData.append('files', files)
-      // this.feedbackObj.uploadNameAttachment = data.appendixName
-      // this.feedbackObj.pathUploadAttachment = data.appendixPath
-      // // this.newAppendixs = files
-      // this.onChangeFlag = true
     },
     handleClose() {
       this.dialogViewSpareMoney = false
@@ -392,6 +570,7 @@ export default {
     fujian(row) {
       this.id = row.id
       this.accessoryTFs = true
+      this.dataObj = row
       this.appendixIdss = row.addressUrl
       console.log(this.appendixIdss)
     },
@@ -415,9 +594,13 @@ export default {
       }
     },
     handleSelectionChange(val) {
+      debugger
       this.multipleSelection = val;
+      console.log('勾选条目', val)
+    },
+    lookup() {
+      this.getList()
     },
-    lookup() { },
   },
 };
 </script>

+ 68 - 26
src/views/setup/goodsSettings.vue

@@ -15,7 +15,7 @@
       </el-table-column>
       <el-table-column property="setDefault" label="默认货名">
         <template scope="scope">
-          <el-checkbox v-model="scope.row.scope">设为默认</el-checkbox>
+          <el-checkbox v-model="scope.row.checked" @change="change($event,scope.row)">设为默认</el-checkbox>
         </template>
       </el-table-column>
       <el-table-column prop="address" label="操作" show-overflow-tooltip>
@@ -42,17 +42,20 @@
 import {
   speedGoodsList,
   speedGoodsAdd,
-  speedGoodsEdit
+  speedGoodsEdit,
+  speedGoodsDel
+
 } from '@/model/speedGoods'
+import { floralwhite } from 'color-name';
 export default {
   components: {
   },
   data() {
     return {
-      goodsNameTitle:'新增',
+      goodsNameTitle: '新增',
       dataObj: {
         compId: localStorage.getItem('ws-pf_compId'),
-        goodsName:''
+        goodsName: ''
       },
       deptCircularPage: {},
       deptBudgetTotal: 0,
@@ -80,6 +83,26 @@ export default {
 
   },
   methods: {
+    change(val1,val2){
+      console.log(val1,val2)
+      if(val1){
+        val2.setDefault=1
+      }else{
+        val2.setDefault=0
+      }
+      speedGoodsEdit(val2)
+          .toPromise()
+          .then((response) => {
+            debugger
+            if (response == "ok") {
+              this.show = false
+              this.$message.success('操作成功!')
+              this.getList()
+            }
+            console.log(response)
+          })
+
+    },
     getList() {
       speedGoodsList({
         compId: localStorage.getItem('ws-pf_compId')
@@ -87,8 +110,14 @@ export default {
         .toPromise()
         .then((response) => {
           console.log(response)
-          this.deptBudgetTotal = response.total
           this.goodsList = response
+          for(let i = 0;i<this.goodsList.length;i++){
+            if(this.goodsList[i].setDefault==0){
+              this.goodsList[i].checked = false
+            }else{
+              this.goodsList[i].checked = true
+            }
+          }
         })
     },
     inventoryClose() {
@@ -112,41 +141,54 @@ export default {
       this.goodsNameTitle = "编辑"
       this.dataObj = val
       this.show = true
-     },
+    },
     del(val) {
       this.$confirm('确定删除货名?', '提示', {
         confirmButtonText: '确定',
         cancelButtonText: '取消',
         type: 'warning'
       }).then(() => {
+        speedGoodsDel({ id: val.id })
+          .toPromise()
+          .then((response) => {
+            debugger
+            if (response == "200") {
+              this.show = false
+              this.$message.success('删除成功!')
+              this.getList()
+            }
+            console.log(response)
+          })
 
-        
       }).catch(() => {
         return false
       });
     },
     goodsNameConfirm() {
-      if(this.goodsNameTitle=='新增'){
+      if (this.goodsNameTitle == '新增') {
         speedGoodsAdd(this.dataObj)
-        .toPromise()
-        .then((response) => {
-          if(response.code=="200"){
-            this.show = false
-            this.getList()
-          }
-          console.log(response)
-        })
-      }else{
+          .toPromise()
+          .then((response) => {
+            debugger
+            if (response == "ok") {
+              this.$message.success('操作成功!')
+              this.show = false
+              this.getList()
+            }
+            console.log(response)
+          })
+      } else {
         speedGoodsEdit(this.dataObj)
-        .toPromise()
-        .then((response) => {debugger
-          if(response=="ok"){
-            this.show = false
-            this.$message.success('操作成功!')
-            this.getList()
-          }
-          console.log(response)
-        })
+          .toPromise()
+          .then((response) => {
+            debugger
+            if (response == "ok") {
+              this.show = false
+              this.$message.success('操作成功!')
+              this.getList()
+            }
+            console.log(response)
+          })
       }
 
     }

+ 44 - 16
src/views/setup/warehouseSettings.vue

@@ -20,7 +20,7 @@
         </template>
       </el-table-column>
     </el-table>
-    <el-dialog width="320px" title="仓位" :visible.sync="show" :append-to-body="true" :close="inventoryClose">
+    <el-dialog width="320px" :title="title" :visible.sync="show" :append-to-body="true" :close="inventoryClose">
       <el-form class="customer" label-position="right" label-width="80px">
         <el-form-item class="customer-item" label="仓位">
           <el-input  placeholder="输入仓位号,1-10个字符" maxlength="10" size="small" v-model="dataObj.positionNo"/>
@@ -37,13 +37,16 @@
 
 import {
   speedPositionInfoList,
-  speedPositionInfoAdd
+  speedPositionInfoAdd,
+  speedPositionInfoEdit,
+  speedPositionInfoDel
 } from '@/model/speedGoods'
 export default {
   components: {
   },
   data() {
     return {
+      title:'新增',
       dataObj: {
         compId: localStorage.getItem('ws-pf_compId')
       },
@@ -65,16 +68,37 @@ export default {
   },
   methods: {
     confirm(){
-      speedPositionInfoAdd(this.dataObj)
+      if(!this.dataObj.positionNo){
+        this.$message.error('仓位号不能为空!')
+        return
+      }
+      if(this.dataObj.positionNo.length>10){
+        this.$message.error('仓位号长度1-10个字符!')
+        return
+      }
+      if(this.title =='新增'){
+        speedPositionInfoAdd(this.dataObj)
         .toPromise()
-        .then((response) => {
+        .then((response) => {debugger
+          console.log(response)
+          if(response=='ok'){
+            this.$message.success('提交成功!')
+            this.show = false
+            this.getList()
+          }
+        })
+      }else{
+        speedPositionInfoEdit(this.dataObj)
+        .toPromise()
+        .then((response) => {debugger
           console.log(response)
-          if(response.code==200){
+          if(response=='ok'){
             this.$message.success('提交成功!')
             this.show = false
             this.getList()
           }
         })
+      }
     },
     getList(){
       speedPositionInfoList({
@@ -89,26 +113,30 @@ export default {
     inventoryClose(){
       this.show = false
     },
-    handleSizeChange(val) {
-    console.log(`每页 ${val} 条`)
-    this.pageSize = val
-    // this.getList()
-  },
-  handleCurrentChange(val) {
-    this.currentPage = val
-    console.log(`当前页: ${val}`)
-    // this.getList()
-  },
     add(){
       this.show = true
     },
-    eidt(){},
+    edit(val){
+      console.log(val)
+      this.show = true
+      this.title = '编辑'
+      this.dataObj = val
+    },
     del(val) {
     this.$confirm('确定删除货名?', '提示', {
       confirmButtonText: '确定',
       cancelButtonText: '取消',
       type: 'warning'
     }).then(() => {
+      speedPositionInfoDel({ id: val.id })
+        .toPromise()
+        .then((response) => {
+          if (response == "ok") {
+              this.show = false
+              this.$message.success('删除成功!')
+              this.getList()
+            }
+        })
     }).catch(() => {
       return false
     });