You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

1032 lines
37 KiB

<template>
<div class="app-container">
<div v-show="viewState == 1">
<div class="tab-header webtop">
<!-- 标题 -->
<div>{{title}}收货单</div>
<!-- start 添加修改按钮 -->
<div>
<el-button type="primary" size="small" :disabled="submitdisabled" @click="saveOrUpdate">保存</el-button>
<el-button type="primary" size="small" :disabled="submitdisabled" @click="submit">确认</el-button>
<el-button type="info" size="small" @click="handleReturn()">关闭</el-button>
</div>
<!-- end 添加修改按钮 -->
<!-- end 详情按钮 -->
</div>
<div class="listconadd">
<el-form ref="form_obj" :model="formobj" :rules="rules" class="formaddcopy02">
<!-- <div class="title">
<div>基础信息</div>
</div> -->
<el-row class="first_row">
<el-col :span="8">
<div class="span-sty">制单人</div>
<el-form-item><span class="addinputInfo">{{ formobj.createByName }}</span></el-form-item>
</el-col>
<el-col :span="8">
<div class="span-sty">制单部门</div>
<el-form-item><span class="addinputInfo">{{ formobj.deptName }}</span></el-form-item>
</el-col>
<!-- <el-col :span="8">
<div class="span-sty">制单人</div>
<el-form-item> <el-input v-model="formobj.createByName" placeholder="" class="addinputw addinputInfo"
clearable /></el-form-item>
</el-col> -->
<el-col :span="8">
<div class="span-sty"><span class="must">*</span> 单据日期</div>
<el-form-item prop="createTime"> <el-date-picker v-model="formobj.createTime" type="date"
class="addinputInfo" value-format="yyyy-MM-dd" placeholder="选择日期">
</el-date-picker></el-form-item>
</el-col>
</el-row>
<el-row>
<el-col :span="8">
<div class="span-sty">预期到货通知单号</div>
<el-form-item><span class="addinputInfo">{{ formobj.sourceBillNo }}</span></el-form-item>
</el-col>
<el-col :span="8">
<div class="span-sty"><span class="must">*</span> 业务类型</div>
<el-form-item prop="busTypeValue"><el-select v-model="formobj.busTypeValue" filterable clearable
placeholder="请选择" class="addinputInfo" @change="busTypeSelect">
<el-option v-for="item in busTypeList" :key="item.sid" :label="item.name" :value="item.sid">
</el-option>
</el-select></el-form-item>
</el-col>
<el-col :span="8">
<div class="span-sty"><span class="must">*</span> 供应商</div>
<el-form-item prop="supplierName"> <el-select v-model="formobj.supplierName" filterable clearable
placeholder="请选择" class="addinputInfo" @change="supplierNameSelect">
<el-option v-for="item in supplierList" :key="item.sid" :label="item.name" :value="item.sid">
</el-option>
</el-select></el-form-item>
</el-col>
</el-row>
<el-row>
<el-col :span="8">
<div class="span-sty"><span class="must">*</span> 到货日期</div>
<el-form-item prop="deliveryDate"><el-date-picker v-model="formobj.deliveryDate" type="date"
class="addinputInfo" value-format="yyyy-MM-dd" placeholder="选择日期">
</el-date-picker></el-form-item>
</el-col>
<el-col :span="16">
<div class="span-sty">单据状态</div>
<el-form-item> <span class="addinputInfo">{{formobj.billState}}</span></el-form-item>
</el-col>
</el-row>
<el-row>
<el-col :span="24">
<div class="span-sty">备注</div>
<el-form-item><el-input v-model="formobj.remarks" placeholder="" class="addinputw addinputInfo"
type="textarea" :rows="4" clearable /></el-form-item>
</el-col>
</el-row>
<div class="title titleOne">
<div>商品列表</div>
<el-button type="primary" size="mini" class="btntopblueline" @click="seleMaintenance()">选择商品</el-button>
<!-- <el-button type="primary" size="mini" class="btntopblueline" @click="batchAddAll()">批次收货</el-button> -->
</div>
<el-table v-loading="listLoading" :data="formobj.list" border style="width: 100%;" ref="dataTable">
<el-table-column fixed width="60" label="序号" type="index" :index="indexMethod" align="center" />
<!-- <el-table-column align="center" width="180">
<template slot="header" slot-scope="scope">
<i v-if="!isUpdata" class="add-btn-icon el-icon-plus" style="color: red;font-size:20px"
@click="commodityAdd(scope.row)"></i>
<span v-else>操作</span>
</template>
<template slot-scope="scope">
<el-button type="primary" size="mini" @click="doGoods(scope.row)">删除</el-button>
<el-button type="primary" size="mini" @click="doAddBatch(scope.row)">批次+</el-button>
<i v-if="!isUpdata" class="el-icon-delete" @click="commodityDelete(scope.$index)"></i>
</template>
</el-table-column> -->
<el-table-column label="操作" align="center" width="120">
<template slot-scope="scope">
<el-button type="primary" size="mini" @click="doGoods(scope.row)">删除</el-button>
</template>
</el-table-column>
<el-table-column label="商品名称" prop="goodsSpuName" align="center" width="200" />
<!-- <el-table-column label="商品名称" align="center" min-width="200" v-if="!isUpdata">
<template slot-scope="scope" v-if="!isUpdata">
<el-popover placement="right" width="900" trigger="click" v-if="!isUpdata">
<div>
<el-table :data="commodityData" v-loading="commodityLoading" highlight-current-row
@current-change="commodityCurrentChange($event, scope.row)">
<el-table-column prop="goodsSpuName" label="商品名称" align="center" />
<el-table-column prop="goodsSkuCode" label="商品编码" align="center" />
<el-table-column prop="goodsSkuOwnSpec" label="型号" align="center" />
<el-table-column prop="unit" label="单位" align="center" />
<el-table-column prop="warehouseName" label="仓库" align="center" />
<el-table-column prop="warehouseRackName" label="库位" align="center" />
</el-table>
<el-pagination :page.sync="commodityQuery.current" :page-size="commodityQuery.size"
layout="total, pager" :total="commodityQuery.total" />
</div>
<el-input slot="reference" v-model="scope.row.goodsSpuName"
@input="commodityInput(scope.row.goodsSpuName)" clearable placeholder="商品名称" />
</el-popover>
</template>
</el-table-column> -->
<el-table-column label="商品编码" prop="goodsSkuCode" align="center" width="150" />
<el-table-column label="规格" prop="goodsSkuOwnSpec" align="center" width="150" />
<el-table-column label="单位" prop="unit" align="center" width="120" />
<!-- <el-table-column label="仓库" align="center" width="180">
<template slot-scope="scope">
<el-select v-model="scope.row.warehouseName" placeholder="请选择" clearable
@change="selectWarehouseName(scope.row,$event)">
<el-option v-for="(item,i) in warehouseList" :key="i" :label="item.warehouseName" :value="item.sid">
</el-option>
</el-select>
</template>
</el-table-column>
<el-table-column label="库位" align="center" width="180">
<template slot-scope="scope">
<el-select v-model="scope.row.warehouseRackName" :disabled="scope.row.warehouseName==''" clearable
@focus="getWarehouseAreaList(scope.row.warehouseSid)" placeholder="请选择"
@change="selectWarehouseAreaCode(scope.row,$event)">
<el-option v-for="(item,i) in warehouseRackList" :key="i" :label="item.areaCode" :value="item.sid">
</el-option>
</el-select>
</template>
</el-table-column> -->
<!-- <el-table-column label="预约数量" prop="orderCount" align="center" width="120" v-if="isUpdata" /> -->
<el-table-column label="实收数量" align="center" width="120">
<template slot-scope="scope">
<el-input ref="focusAssumptionInput" @input="commodityComputeYHAndXSJE(scope.row,$event)"
v-model="scope.row.actualInCount" clearable placeholder=""
oninput="value=value.replace(/^(0+)|[^\d]+/g,'')" />
</template>
</el-table-column>
<el-table-column label="拒收数量" align="center" width="120">
<template slot-scope="scope">
<el-input ref="focusAssumptionInput" v-model="scope.row.rejectCount" clearable placeholder=""
@input="commodityComputeYHAndXSJE2(scope.row,$event)"
oninput="value=value.replace(/^(0+)|[^\d]+/g,'')" />
</template>
</el-table-column>
<el-table-column label="拒收原因" align="center" width="180">
<template slot-scope="scope">
<el-input ref="focusAssumptionInput" v-model="scope.row.rejectReason" clearable placeholder="" />
</template>
</el-table-column>
<el-table-column label="是否质检" align="center" width="180">
<template slot-scope="scope">
<el-radio-group v-model="scope.row.isQuality" size="small">
<el-radio :label="0">是</el-radio>
<el-radio :label="1">否</el-radio>
</el-radio-group>
</template>
</el-table-column>
<el-table-column label="质检状态" align="center" width="180">
<template slot-scope="scope">
<el-radio-group v-model="scope.row.qualityState" size="small">
<el-radio :label="0">合格</el-radio>
<el-radio :label="1">不合格</el-radio>
</el-radio-group>
</template>
</el-table-column>
<el-table-column label="载具说明" align="center" width="180">
<template slot-scope="scope">
<el-input ref="focusAssumptionInput" v-model="scope.row.packageRemark" clearable placeholder="" />
</template>
</el-table-column>
<el-table-column label="入库单价" align="center" width="150">
<template slot-scope="scope">
<el-input ref="focusAssumptionInput" @input="commodityComputeYHAndXSJE3(scope.row,$event)"
v-model="scope.row.cost" clearable placeholder=""
oninput="value=value.replace(/[^\d.]/g, '').replace(/\.{2,}/g, '.').replace('.', '$#$').replace(/\./g, '').replace('$#$', '.').replace(/^(\-)*(\d+)\.(\d\d).*$/, '$1$2.$3').replace(/^\./g, '')" />
</template>
</el-table-column>
<el-table-column label="税率" align="center" width="150">
<template slot-scope="scope">
<el-input ref="focusAssumptionInput" @input="commodityComputeYHAndXSJE4(scope.row,$event)"
v-model="scope.row.taxAmount" clearable placeholder=""
oninput="value=value.replace(/[^\d.]/g, '').replace(/\.{2,}/g, '.').replace('.', '$#$').replace(/\./g, '').replace('$#$', '.').replace(/^(\-)*(\d+)\.(\d\d).*$/, '$1$2.$3').replace(/^\./g, '')" />
</template>
</el-table-column>
<!-- <el-table-column label="含税单价" prop="taxPrice" @input="commodityComputeYHAndXSJE5(scope.row,$event)"
align="center" width="150" /> -->
<el-table-column label="入库金额" prop="amount" align="center" width="150" />
</el-table>
<!-- <div class="title"
style="display: flex;align-items: center;justify-content: space-between;height:40px;margin-top: 10px;">
<div>商品-批次</div>
</div>
<el-table v-loading="listLoading" :data="formobj.pcList" border style="width: 100%;"
:row-style="{height: '40px'}">
<el-table-column fixed width="60" label="序号" type="index" :index="indexMethod" align="center" />
<el-table-column fixed label="操作" wid align="center" width="120">
<template slot-scope="scope">
<el-button type="primary" size="mini" @click="doGoodsBatch(scope.row)">删除</el-button>
</template>
</el-table-column>
<el-table-column label="商品列表序号" prop="xh" align="center" width="120" />
<el-table-column label="商品名称" prop="goodsSkuTitle" align="center" width="200" />
<el-table-column label="商品编码" prop="goodsSkuCode" align="center" width="150" />
<el-table-column label="规格" prop="goodsSkuOwnSpec" align="center" width="150" />
<el-table-column label="单位" prop="unit" align="center" width="120" />
<el-table-column label="仓库" prop="warehouseName" align="center" width="150" />
<el-table-column label="库位" prop="warehouseRackName" align="center" width="150" />
<el-table-column label="批次号" prop="batchNumber" align="center" width="300" />
<el-table-column label="生产日期" align="center" width="180">
<template slot-scope="scope">
<el-date-picker v-model="scope.row.manufactureDate" type="date" style="width:100%"
value-format="yyyy-MM-dd" placeholder="选择日期" @change="manufactureDateChange(scope.row,$event)" />
</template>
</el-table-column>
<el-table-column label="有效期" prop="expirationDate" align="center" width="180" />
<el-table-column label="数量" align="center" width="120">
<template slot-scope="scope">
<el-input ref="focusAssumptionInput" v-model="scope.row.batchCount" clearable placeholder=""
oninput="value=value.replace(/^(0+)|[^\d]+/g,'')" />
</template>
</el-table-column>
</el-table> -->
</el-form>
</div>
</div>
<!-- 选择商品 -->
<chooseproducts v-show="viewState == 2" ref="divSp" @backData="backData" @doback="resetState" />
</div>
</template>
<script>
import req from '@/api/storage/receivingGoods.js'
import req2 from '@/api/storage/allocation.js'
import {
getCurrentDate
} from '@/utils/index.js'
import chooseproducts from './relation/chooseproducts'
import {
choiceSupplierInfo,
getOrgSidByPath
} from '@/api/Common/dictcommons'
export default {
components: {
chooseproducts,
},
data() {
return {
viewState: 1,
title: '【新增】',
listLoading: false,
submitdisabled: false,
formobj: {
"sid": "",
"billNo": "",
"sourceBillSid": "",
"sourceBillNo": "",
"createBySid": window.sessionStorage.getItem('userSid'),
"createByName": window.sessionStorage.getItem('name'),
"deptName": '',
"deptSid": '',
"createTime": getCurrentDate(),
"busTypeKey": "",
"busTypeValue": "",
"supplierSid": "",
"supplierName": "",
"deliveryDate": getCurrentDate(),
"billState": "新建",
"remarks": "",
"useOrgSid": '',
"createOrgSid": '',
"list": [],
"pcList": []
},
hideUploadBtn: false,
busTypeList: [{
name: "业务类型1",
sid: "1"
},
{
name: "业务类型2",
sid: "2"
}
],
supplierList: [],
warehouseList: [],
warehouseRackList: [],
// commodity商品
commodityKey: 1,
commodityLoading: false,
commodityQuery: {
current: 1,
size: 2,
total: 0,
params: {
name: '',
inOrg: "",
outOrg: ""
}
},
commodityData: [],
isUpdata: false,
rules: {
createTime: [{
required: true,
message: '到货日期不能为空',
trigger: 'change'
}],
busTypeValue: [{
required: true,
message: '请选择业务类型',
trigger: 'change'
}],
supplierName: [{
required: true,
message: '请选择供应商',
trigger: 'change'
}],
deliveryDate: [{
required: true,
message: '到货日期不能为空',
trigger: 'change'
}],
}
}
},
created() {
getOrgSidByPath({
orgPath: window.sessionStorage.getItem('defaultOrgPath')
}).then((res) => {
if (res.success) {
this.formobj.createOrgSid = res.data
this.formobj.useOrgSid = res.data
}
})
},
methods: {
// commodityInput(value) {
// this.commodityQuery.params.name = value
// this.commodityLoading = true
// req.getGoodsListPage(this.commodityQuery).then((response) => {
// if (response.success) {
// this.commodityLoading = false
// this.commodityData = response.data.records
// this.commodityQuery.total = response.data.total
// } else {
// this.serviceLoading = false
// this.commodityData = []
// this.commodityQuery.total = 0
// }
// })
// },
// commodityDelete(index) {
// this.formobj.list.splice(index, 1)
// },
// commodityCurrentChange(value, row) {
// console.log("commodityCurrentChange》》》》", value)
// console.log("commodityCurrentChange》》》》", row)
// row.goodsSkuSid = value.goodsSkuSid
// row.goodsSkuTitle = value.goodsSpuName
// row.goodsSpuName = value.goodsSpuName
// row.goodsSkuCode = value.goodsSkuCode
// row.goodsSkuOwnSpec = value.goodsSkuOwnSpec
// row.unit = value.unit
// row.warehouseSid = value.warehouseSid
// row.warehouseName = value.warehouseName
// row.warehouseRackSid = value.warehouseRackSid
// row.warehouseRackName = value.warehouseRackName
// row.actualInCount = 0
// row.rejectCount = 0
// row.rejectReason = ''
// row.isQuality = 1
// row.qualityState = 0
// row.packageRemark = ''
// row.cost = value.cost
// row.taxAmount = value.taxAmount
// row.taxPrice = value.taxPrice
// row.amount = value.amount
// row.shelfLife = value.shelfLife
// document.body.click()
// },
// // 在头部标题上添加“新增”图标
// commodityHeader(h, {
// column
// }) {
// return h(
// 'div',
// [
// h('span', column.label),
// h('i', {
// class: 'add-btn-icon el-icon-plus',
// style: 'color: red;font-size:20px',
// on: {
// click: this.commodityAdd // 点击执行函数
// }
// })
// ]
// )
// },
// commodityAdd() {
// this.formobj.list.push({
// "goodsSkuSid": "",
// "goodsSkuTitle": "",
// "goodsSkuCode": "",
// "goodsSkuOwnSpec": "",
// "unit": "",
// "warehouseSid": "",
// "warehouseName": "",
// "warehouseRackSid": "",
// "warehouseRackName": "",
// "actualInCount": 0,
// "rejectCount": 0,
// "rejectReason": "",
// "isQuality": 1,
// "qualityState": 0,
// "packageRemark": "",
// "state": 0,
// "xh": "",
// "orderCount": 0,
// "cost": 0,
// "taxAmount": 0,
// "taxPrice": 0,
// "amount": 0,
// 'shelfLife': 0
// })
// },
backData(value) {
this.viewState = 1
if (value.length > 0) {
value.forEach((e) => {
this.formobj.list.push({
// goodSpuSid: e.goodsSpuSid,
// goodsSpuName: e.goodsSpuName,
// goodsSkuSid: e.goodsSkuSid,
// goodsSkuTitle: e.goodsSkuTitle,
// goodsSkuCode: e.goodsSkuCode,
// goodsSkuOwnSpec: e.goodsSkuOwnSpec,
// unit: e.unit,
// warehouseSid: e.warehouseSid,
// warehouseName: e.warehouseName,
// warehouseRackSid: e.warehouseRackSid,
// warehouseRackCode: e.warehouseRackCode,
// money: e.money,
// moneyAll: '',
// outCount: '',
// inventorySid: e.inventorySid, // 库存商品sid
"goodsSkuSid": e.goodsSpuSid,
"goodsSpuName": e.goodsSpuName,
"goodsSkuTitle": e.goodsSkuTitle,
"goodsSkuCode": e.goodsSkuCode,
"goodsSkuOwnSpec": e.indexes,
"unit": e.goodsUnitName,
"warehouseSid": e.warehouseSid,
"warehouseName": e.warehouseName,
"warehouseRackSid": e.warehouseRackSid,
"warehouseRackName": e.warehouseRackCode,
"actualInCount": 0,
"rejectCount": 0,
"rejectReason": "",
"isQuality": 1,
"qualityState": 0,
"packageRemark": "",
"state": 0,
"xh": "",
"orderCount": 0,
"cost": 0,
"taxAmount": 0,
"taxPrice": 0,
"amount": 0,
'shelfLife': 0
})
})
}
},
resetState() {
this.viewState = 1
},
seleMaintenance() {
this.viewState = 2
const aa = []
this.$refs['divSp'].showData(aa, this.formobj.createOrgSid)
},
doGoodsDel(sid) {
console.log("doGoodsDel》》》》", sid)
this.$confirm("是否确定删除此商品?", '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
const index = this.formobj.list.findIndex((item) => item === row)
console.log("index》》》》", index)
this.formobj.list.splice(index, 1)
for (var i = this.formobj.pcList.length - 1; i >= 0; i--) {
if (this.formobj.pcList[i].xh === (index + 1)) {
this.formobj.pcList.splice(i, 1);
}
}
})
},
indexMethod(index) {
return index + 1
},
saveOrUpdate() {
console.log('>>>>>>>>>saveOrUpdate', this.formobj)
this.$refs['form_obj'].validate((valid) => {
if (valid) {
this.submitdisabled = true
req.save(this.formobj).then((res) => {
if (res.success) {
this.$message({
showClose: true,
type: 'success',
message: '保存成功'
})
this.handleReturn('true')
} else {
this.submitdisabled = false
}
}).catch(() => {
this.submitdisabled = false
})
}
})
},
submit() {
if (this.formobj.list.length == 0) {
this.$message({
showClose: true,
type: 'error',
message: '请添加商品'
})
return
}
for (var i = 0; i < this.formobj.list.length; i++) {
var item = this.formobj.list[i]
if (item.goodsSkuSid == '') {
this.$message({
showClose: true,
type: 'error',
message: '请添加商品'
})
return
}
if (item.actualInCount == 0) {
this.$message({
showClose: true,
type: 'error',
message: '实收数量不能为空'
})
return
}
}
this.$refs['form_obj'].validate((valid) => {
if (valid) {
this.submitdisabled = true
req.submit(this.formobj).then((res) => {
if (res.success) {
this.$message({
showClose: true,
type: 'success',
message: '保存成功'
})
this.handleReturn('true')
} else {
this.submitdisabled = false
}
}).catch(() => {
this.submitdisabled = false
})
}
})
},
handleReturn(isreload) {
if (isreload === 'true') this.$emit('reloadlist')
this.formobj = {
"sid": "",
"billNo": "",
"sourceBillSid": "",
"sourceBillNo": "",
"createBySid": window.sessionStorage.getItem('userSid'),
"createByName": window.sessionStorage.getItem('name'),
"deptName": '',
"deptSid": '',
"createTime": getCurrentDate(),
"busTypeKey": "",
"busTypeValue": "",
"supplierSid": "",
"supplierName": "",
"deliveryDate": getCurrentDate(),
"billState": "新建",
"remarks": "",
"useOrgSid": '',
"createOrgSid": '',
"list": [],
"pcList": []
}
this.submitdisabled = false
this.isUpdata = false
this.$emit('doback')
},
showAdd() {
this.title = "【新增】"
this.isUpdata = false
console.log("showAdd", this.isUpdata);
this.getsupplierLust()
this.getWarehouseList()
this.$nextTick(() => {
this.$refs['form_obj'].clearValidate()
})
},
showEdit(row) {
this.title = "【修改】"
this.isUpdata = true
this.getsupplierLust()
this.getWarehouseList()
console.log("showEdit", this.isUpdata);
this.$nextTick(() => {
this.$refs['form_obj'].clearValidate()
})
var params = {
sid: row.sid
}
req.init(row.sid)
.then(resp => {
if (resp.success) {
this.formobj = resp.data
this.formobj.deptName = window.sessionStorage.getItem('defaultOrgPathName').substring(window
.sessionStorage.getItem('defaultOrgPathName').lastIndexOf('/') + 1)
this.formobj.deptSid = window.sessionStorage.getItem('defaultOrgPath').substring(window.sessionStorage
.getItem('defaultOrgPath').lastIndexOf('/') + 1)
}
})
.catch(e => {
this.formobj = {}
})
},
busTypeSelect(val) {
const choose = this.busTypeList.filter((item) => item.sid == val)
console.log('>>>>>>>>>busTypeSelect', choose)
this.formobj.busTypeKey = choose[0].sid
this.formobj.busTypeValue = choose[0].name
},
supplierNameSelect(val) {
console.log("supplierNameSelect", val);
const choose = this.supplierList.filter((item) => item.sid == val)
console.log('>>>>>>>>>supplierNameSelect', choose)
this.formobj.supplierName = choose[0].supplierName
this.formobj.supplierSid = choose[0].sid
},
getsupplierLust() {
// var params = {
// depSid: window.sessionStorage.getItem('defaultOrgPath').substring(window.sessionStorage
// .getItem('defaultOrgPath').lastIndexOf('/') + 1),
// }
// var depSid = window.sessionStorage.getItem('defaultOrgPath').substring(window.sessionStorage
// .getItem('defaultOrgPath').lastIndexOf('/') + 1)
// req.choiceSupplier(depSid).then((res) => {
// if (res.success) {
// this.supplierList = res.data
// console.log("aaaaaa", this.supplierList);
// }
// })
choiceSupplierInfo({
deptSid: window.sessionStorage.getItem('defaultOrgPath').substring(window.sessionStorage
.getItem('defaultOrgPath').lastIndexOf('/') + 1)
}).then((resp) => {
if (resp.success) {
this.supplierList = resp.data
console.log("aaaaaa", this.supplierList);
}
})
// getOrgSidByPath({ orgPath: window.sessionStorage.getItem('defaultOrgPath') }).then((res) => {
// if (res.success) {
// this.formobj.createOrgSid = res.data
// this.formobj.useOrgSid = res.data
// choiceSupplierInfo({ deptSid: res.data }).then((resp) => {
// if (resp.success) {
// this.supplierList = resp.data
// console.log("aaaaaa", this.supplierNameList);
// }
// })
// }
// })
},
getWarehouseList() {
var parpams = {
orgPath: window.sessionStorage.getItem('defaultOrgPath'),
}
req2.getWarehouses(parpams).then((res) => {
if (res.success) {
this.warehouseList = res.data
console.log("aaaaaa", this.warehouseList);
}
})
},
getWarehouseAreaList(sid) {
var query = {
ckSid: sid
}
req2.getWarehouseareas(query).then((res) => {
if (res.success) {
this.warehouseRackList = res.data
console.log("aaaaaa", this.warehouseRackList);
}
})
},
selectWarehouseName(row, val) {
console.log("selectWarehouseName", row);
console.log("selectWarehouseName", val);
const choose = this.warehouseList.filter((item) => item.sid == val)
console.log('>>>>>>>>>selectWarehouseName', choose)
row.warehouseName = choose[0].warehouseName
row.warehouseSid = choose[0].sid
},
selectWarehouseAreaCode(row, val) {
console.log("selectWarehouseAreaCode", val);
const choose = this.warehouseRackList.filter((item) => item.sid == val)
console.log('>>>>>>>>>selectWarehouseAreaCode', choose)
row.warehouseRackName = choose[0].areaCode
row.warehouseRackSid = choose[0].sid
},
batchAddAll() {
for (var i = 0; i < this.formobj.list.length; i++) {
var item = this.formobj.list[i]
var info = {
xh: i + 1,
goodsSkuSid: item.goodsSkuSid,
goodsSkuTitle: item.goodsSkuTitle,
goodsSkuCode: item.goodsSkuCode,
goodsSkuOwnSpec: item.goodsSkuOwnSpec,
unit: item.unit,
warehouseSid: item.warehouseSid,
warehouseName: item.warehouseName,
warehouseRackSid: item.warehouseRackSid,
warehouseRackName: item.warehouseRackName,
shelfLife: item.shelfLife,
orderCount: item.orderCount,
batchNumber: '',
manufactureDate: '',
batchCount: 0,
}
this.formobj.pcList.push(info)
}
},
doGoods(row) {
console.log("doGoodsDel》》》》", row)
this.$confirm("是否确定删除此商品?", '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
const index = this.formobj.list.findIndex((item) => item === row)
console.log("index》》》》", index)
this.formobj.list.splice(index, 1)
for (var i = this.formobj.pcList.length - 1; i >= 0; i--) {
if (this.formobj.pcList[i].xh === (index + 1)) {
this.formobj.pcList.splice(i, 1);
}
}
})
},
doGoodsBatch(row) {
console.log("doGoodsDel》》》》", row)
this.$confirm("是否确定删除此商品批次?", '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
const index = this.formobj.pcList.findIndex((item) => item === row)
console.log("index》》》》", index)
this.formobj.pcList.splice(index, 1)
})
},
manufactureDateChange(row, val) {
console.log("manufactureDateChange》》》》", val)
console.log("manufactureDateChange》》》》", row)
row.manufactureDate = val
row.expirationDate = this.addDate(val, row.shelfLife)
let reg = new RegExp('-', 'g') //g代表全部
row.batchNumber = this.formobj.deliveryDate.replace(reg, '') + " - " + row.expirationDate.replace(reg, '')
this.$forceUpdate(); // 强制更新
console.log("manufactureDateChange》》》》", row)
},
addDate(date, days) {
var dates = new Date(date)
dates.setDate(dates.getDate() + days)
var year = dates.getFullYear()
var month = dates.getMonth() + 1
var day = dates.getDate()
if (month < 9) {
month = "0" + month
}
if (day < 9) {
day = "0" + day
}
var time = year + '-' + month + '-' + day
return time
},
doAddBatch(row) {
const index = (this.formobj.list.findIndex((item) => item === row)) + 1
console.log("doAddBatch》》》》", index)
console.log("doAddBatch》》》》", row)
var info = {
xh: index,
goodsSkuSid: row.goodsSkuSid,
goodsSkuTitle: row.goodsSkuTitle,
goodsSkuCode: row.goodsSkuCode,
goodsSkuOwnSpec: row.goodsSkuOwnSpec,
unit: row.unit,
warehouseSid: row.warehouseSid,
warehouseName: row.warehouseName,
warehouseRackSid: row.warehouseRackSid,
warehouseRackName: row.warehouseRackName,
shelfLife: row.shelfLife,
orderCount: row.orderCount,
batchNumber: '',
manufactureDate: '',
batchCount: 0,
}
console.log("aaaaaaaaaaa", info);
this.formobj.pcList.push(info)
},
commodityComputeYHAndXSJE(row, val) {
console.log("aaa", row);
console.log("aaa", val);
// if (this.isUpdata) {
// if (Number(row.actualInCount) > Number(row.orderCount)) {
// row.actualInCount = row.orderCount
// }
// }
// row.amount = (Number(row.actualInCount) * Number(row.taxPrice)).toFixed(2)
row.actualInCount = val
row.amount = (Number(row.actualInCount) * Number(row.cost)).toFixed(2)
},
commodityComputeYHAndXSJE2(row, val) {
console.log("aaa", row);
console.log("aaa", val);
row.rejectCount = val
// if (this.isUpdata) {
// if ((Number(row.rejectCount) + Number(row.actualInCount)) > Number(row.orderCount)) {
// row.rejectCount = Number(row.orderCount) - Number(row.actualInCount)
// }
// }
},
commodityComputeYHAndXSJE3(row, val) {
console.log("aaa", row);
console.log("aaa", val);
// row.taxPrice = (Number(row.cost) * Number(row.taxAmount)).toFixed(2)
// row.amount = (Number(row.actualInCount) * Number(row.taxPrice)).toFixed(2)
row.cost = val
row.amount = (Number(row.actualInCount) * Number(row.cost)).toFixed(2)
},
commodityComputeYHAndXSJE4(row, val) {
console.log("aaa", row);
console.log("aaa", val);
row.taxAmount = val
// row.taxPrice = (Number(row.cost) * Number(row.taxAmount)).toFixed(2)
// row.amount = (Number(row.actualInCount) * Number(row.taxPrice)).toFixed(2)
},
}
}
</script>
<style scoped>
/deep/ .el-form-item__error {
margin-left: 120px !important;
}
.must {
color: #f00;
}
.span-sty {
width: 130px !important;
}
.addinputInfo {
margin-left: 120px !important;
}
.formaddcopy02 .el-row .el-col /deep/ .el-form-item .addinputw {
margin-left: 120px !important;
width: calc(100% - 115px);
}
.first_row {
border-top: 1px solid #E0E3EB;
}
.titleOne {
padding: 7px;
display: flex;
flex-direction: row;
justify-content: space-between;
align-items: center;
}
</style>