Files
scrq-hd/.svn/pristine/cc/cc302c010bdd05e637246cbb031613f28a49fb0f.svn-base
2025-07-03 10:34:04 +08:00

1248 lines
36 KiB
Plaintext

<template>
<!-- wms到货单订单 -->
<el-container style="margin-top: 10px;" v-loading="loading">
<!-- 添加或修改参数配置对话框 -->
<el-form
ref="form"
:model="form"
label-width="68px"
:rules="rules"
align="left"
style="width: 100%;"
>
<!-- 第一行 -->
<el-row style="margin-bottom:-24px">
<el-col :span="4">
<el-form-item label="采购订单号" label-width="100px" prop="cPoid">
<el-input v-model="form.cPoid" placeholder="" size="small" />
</el-form-item>
</el-col>
<el-col :span="4">
<el-form-item label="供应商" prop="supplierName">
<el-input
v-model="form.supplierName"
class="input_inner"
style="width: 95%"
size="small"
disabled
>
<i
slot="suffix"
v-if="true"
class="el-icon-circle-close "
style="margin-right: 10px"
@click.prevent="produceCleanSupplier"
></i>
<i
slot="suffix"
class="el-icon-search "
@click.prevent="selectSupplier"
></i>
</el-input>
</el-form-item>
</el-col>
<el-col :span="4">
<el-form-item label="部门" prop="departmentName">
<el-input
v-model="form.departmentName"
class="input_inner"
style="width: 95%"
size="small"
disabled
>
<i
slot="suffix"
v-if="true"
class="el-icon-circle-close "
style="margin-right: 10px"
@click.prevent="produceCleanDept"
></i>
<i
slot="suffix"
class="el-icon-search "
@click.prevent="selectDept"
></i>
</el-input>
</el-form-item>
</el-col>
<el-col :span="4">
<el-form-item label="业务员" prop="salesmanName">
<el-input
v-model="form.salesmanName"
style="width: 95%"
class="input_inner"
size="small"
disabled
>
<i
slot="suffix"
v-if="true"
class="el-icon-circle-close "
style="margin-right: 10px"
@click.prevent="produceCleanSalesman"
></i>
<i
slot="suffix"
class="el-icon-search "
@click.prevent="selectSalesman"
></i>
</el-input>
</el-form-item>
</el-col>
<el-col :span="4">
<el-form-item label="物料编码" prop="materialCodeArr">
<el-input
v-model="form.materialCodeArr"
style="width: 95%"
class="input_inner"
size="small"
>
</el-input>
</el-form-item>
</el-col>
<el-col :span="4">
<el-button
type="primary"
size="mini"
style="float: right;margin-right:5px;margin-top: 3px;"
@click="initData"
>查询
</el-button>
<el-button
size="mini"
style="float: right;margin-right:5px;margin-top: 3px;"
@click="cleanQuery"
>重置
</el-button>
<el-button
type="primary"
size="mini"
style="float: right;margin-right:1px;margin-top: 3px;"
@click="handleSynchro"
>同步
</el-button>
</el-col>
</el-row>
<!-- 分割线 -->
<el-divider></el-divider>
<!-- 订单列表 -->
<el-table
style="width: 99%;margin: 0px 0px 0px 5px;"
height="270"
v-loading="orderTableLoading"
border
:data="orderList"
@current-change="currentOrderChange"
highlight-current-row
ref="orderList"
@expand-change="rowExpand"
:expand-row-keys="expands"
:row-key="getRowKeys"
>
<el-table-column
label="序号"
align="center"
width="50px"
:show-overflow-tooltip="true"
>
<template slot-scope="scope">
{{ orderList.indexOf(scope.row) + 1 }}
</template>
</el-table-column>
<el-table-column type="expand">
<template slot-scope="scope">
<el-table
border
:data="childrenList"
@selection-change="handleOrderDetailChange"
style="width: 95%"
class="two-list"
>
<el-table-column type="selection" width="55" />
<el-table-column
label="物料编码"
align="center"
prop="cinvCode"
width="150px"
:show-overflow-tooltip="true"
/>
<el-table-column
label="物料名称"
align="center"
prop="cinvName"
width="150px"
:show-overflow-tooltip="true"
/>
<el-table-column
label="物料规格"
align="center"
prop="cinvStd"
width="150px"
:show-overflow-tooltip="true"
/>
<!-- <el-table-column label="单位代码" align="center" prop="ccomUnitCode" width="150px" :show-overflow-tooltip="true"/> -->
<el-table-column
label="单位名称"
align="center"
prop="ccomUnitName"
width="100px"
:show-overflow-tooltip="true"
/>
<el-table-column
label="物料来源"
align="center"
prop="bpropertyCheck"
width="100px"
:show-overflow-tooltip="true"
>
<template slot-scope="scope">
<!-- {{this.$dictType.getValue(scope.row.bpropertyCheck,this.$dictType.getDict('arrive_bill_isInspect'))}} -->
{{ scope.row.bpropertyCheck == 1 ? "自购" : "客供" }}
</template>
</el-table-column>
<el-table-column
label="数量"
align="center"
prop="iquantity"
width="100px"
:show-overflow-tooltip="true"
/>
<el-table-column
label="到货数量"
align="center"
prop="iarrQty"
width="100px"
:show-overflow-tooltip="true"
/>
<el-table-column
label="剩余数量"
align="center"
prop="qty"
width="100px"
:show-overflow-tooltip="true"
/>
<el-table-column
label="原币含税单价"
align="center"
prop="itaxPrice"
width="100px"
:show-overflow-tooltip="true"
/>
<el-table-column
label="税率"
align="center"
prop="iperTaxRate"
width="50px"
:show-overflow-tooltip="true"
/>
<el-table-column
label="原币价税合计"
align="center"
prop="isum"
width="100px"
:show-overflow-tooltip="true"
/>
<el-table-column
label="原币单价"
align="center"
prop="money1"
width="100px"
:show-overflow-tooltip="true"
/>
<el-table-column
label="原币金额"
align="center"
prop="money2"
width="100px"
:show-overflow-tooltip="true"
/>
<el-table-column
label="原币税额"
align="center"
prop="money3"
width="100px"
:show-overflow-tooltip="true"
/>
<el-table-column
label="本币价税合计"
align="center"
prop="money4"
width="100px"
:show-overflow-tooltip="true"
/>
<!-- <el-table-column
label="剩余数量原币价税合计"
align="center"
prop="isum2"
width="160px"
:show-overflow-tooltip="true"
/>
<el-table-column
label="剩余数量原币单价"
align="center"
prop="money5"
width="150px"
:show-overflow-tooltip="true"
/>
<el-table-column
label="剩余数量原币金额"
align="center"
prop="money6"
width="150px"
:show-overflow-tooltip="true"
/>
<el-table-column
label="剩余数量原币税额"
align="center"
prop="money7"
width="150px"
:show-overflow-tooltip="true"
/>
<el-table-column
label="剩余数量本币价税合计"
align="center"
prop="money8"
width="160px"
:show-overflow-tooltip="true"
/> -->
<el-table-column
label="行备注"
align="center"
prop="cbmemo"
width="150px"
:show-overflow-tooltip="true"
/>
</el-table>
</template>
</el-table-column>
<el-table-column
label="采购订单号"
align="center"
prop="cpoid"
width="150px"
:show-overflow-tooltip="true"
/>
<el-table-column
label="单据日期"
align="center"
prop="dpoDate"
width="100px"
:show-overflow-tooltip="true"
/>
<el-table-column
label="业务类型"
align="center"
prop="cbusType"
width="auto"
:show-overflow-tooltip="true"
/>
<el-table-column
label="供应商"
align="center"
prop="cvenName"
width="auto"
:show-overflow-tooltip="true"
/>
<el-table-column
label="部门"
align="center"
prop="cdepName"
width="auto"
:show-overflow-tooltip="true"
/>
<el-table-column
label="业务员"
align="center"
prop="cpersonName"
width="auto"
:show-overflow-tooltip="true"
/>
<el-table-column
label="采购类型"
align="center"
prop="cptName"
width="auto"
:show-overflow-tooltip="true"
/>
<el-table-column
label="币种"
align="center"
prop="cexch_name"
width="auto"
:show-overflow-tooltip="true"
/>
<el-table-column
label="汇率"
align="center"
prop="nflat"
width="auto"
:show-overflow-tooltip="true"
/>
<el-table-column
label="税率"
align="center"
prop="itaxRate"
width="auto"
:show-overflow-tooltip="true"
/>
<el-table-column
label="创单人"
align="center"
prop="cmaker"
width="auto"
:show-overflow-tooltip="true"
/>
<el-table-column
label="审核人"
align="center"
prop="cverifier"
width="auto"
:show-overflow-tooltip="true"
/>
<el-table-column
label="关闭人"
align="center"
prop="ccloser"
width="auto"
:show-overflow-tooltip="true"
/>
<el-table-column
label="备注"
align="center"
prop="cmemo"
width="auto"
:show-overflow-tooltip="true"
/>
</el-table>
<!-- 列表头部按钮 -->
<el-row
:gutter="10"
style="width:99%;margin-left:0px;margin-bottom:10px;margin-top:10px;"
>
<el-col :span="1.5">
<el-button
type="danger"
icon="el-icon-delete"
size="mini"
@click="deleteData"
>删除</el-button
>
</el-col>
<el-col :span="1.5">
<el-button
type="primary"
size="mini"
@click="submitForm"
v-loading="saveLoading"
>确 定</el-button
>
</el-col>
<el-col :span="1.5">
<el-button type="primary" size="mini" @click="cancel"
>取 消</el-button
>
</el-col>
<el-col :span="1.5">
<el-button type="primary" size="mini" @click="batchSelect"
>批量选择</el-button
>
</el-col>
<el-col :span="18">
<el-pagination
style="float: right;margin-right:10px;height:20px"
@size-change="handleSizeChange"
@current-change="handleCurrentChange"
:current-page="form.pageNo"
:page-sizes="[10, 20, 50, 100, 200, 500, 1000]"
:page-size="form.pageSize"
layout="total, sizes, prev, pager, next, jumper"
:total="total"
></el-pagination>
</el-col>
</el-row>
<!-- 列表 -->
<el-table
style="width: 99%;margin: 0px 0px 0px 5px;"
height="240"
v-loading="tableLoading"
border
:data="dataList"
@current-change="currentChange"
@selection-change="handleDataChange"
highlight-current-row
ref="list"
@expand-change="rowExpand"
>
<el-table-column
label="序号"
align="center"
width="50px"
:show-overflow-tooltip="true"
>
<template slot-scope="scope">
{{ dataList.indexOf(scope.row) + 1 }}
</template>
</el-table-column>
<el-table-column type="selection" width="50" />
<el-table-column
label="ID"
align="center"
prop="id"
width="50px"
:show-overflow-tooltip="true"
/>
<el-table-column
label="物料编码"
align="center"
prop="cinvCode"
width="100px"
:show-overflow-tooltip="true"
/>
<el-table-column
label="物料名称"
align="center"
prop="cinvName"
width="150px"
:show-overflow-tooltip="true"
/>
<el-table-column
label="物料规格"
align="center"
prop="cinvStd"
width="150px"
:show-overflow-tooltip="true"
/>
<el-table-column
label="单位代码"
align="center"
prop="ccomUnitCode"
width="100px"
:show-overflow-tooltip="true"
/>
<el-table-column
label="单位名称"
align="center"
prop="ccomUnitName"
width="100px"
:show-overflow-tooltip="true"
/>
<el-table-column
label="物料来源"
align="center"
prop="bpropertyCheck"
width="100px"
:show-overflow-tooltip="true"
>
<template slot-scope="scope">
{{ scope.row.bpropertyCheck == 1 ? "自购" : "客供" }}
</template>
</el-table-column>
<el-table-column
label="数量"
align="center"
prop="qty"
width="100px"
:show-overflow-tooltip="true"
>
<template slot-scope="scope">
<el-input
v-model="scope.row.qty"
:maxlength="9"
size="mini"
@change="changeQty(scope.row)"
oninput="if(isNaN(value)) { value = null } if(value.indexOf('.')>0){value=value.slice(0,value.indexOf('.')+4)}"
></el-input>
</template>
</el-table-column>
<el-table-column
label="原币含税单价"
align="center"
prop="itaxPrice"
width="100px"
:show-overflow-tooltip="true"
/>
<el-table-column
label="税率"
align="center"
prop="iperTaxRate"
width="50px"
:show-overflow-tooltip="true"
/>
<el-table-column
label="原币价税合计"
align="center"
prop="isum"
width="100px"
:show-overflow-tooltip="true"
/>
<el-table-column
label="原币单价"
align="center"
prop="money1"
width="100px"
:show-overflow-tooltip="true"
/>
<el-table-column
label="原币金额"
align="center"
prop="money2"
width="100px"
:show-overflow-tooltip="true"
/>
<el-table-column
label="原币税额"
align="center"
prop="money3"
width="100px"
:show-overflow-tooltip="true"
/>
<el-table-column
label="本币价税合计"
align="center"
prop="money4"
width="100px"
:show-overflow-tooltip="true"
/>
<!-- <el-table-column
label="剩余数量"
align="center"
prop="qty"
width="100px"
:show-overflow-tooltip="true"
/>
<el-table-column
label="剩余数量原币价税合计"
align="center"
prop="isum2"
width="160px"
:show-overflow-tooltip="true"
/>
<el-table-column
label="剩余数量原币单价"
align="center"
prop="money5"
width="150px"
:show-overflow-tooltip="true"
/>
<el-table-column
label="剩余数量原币金额"
align="center"
prop="money6"
width="150px"
:show-overflow-tooltip="true"
/>
<el-table-column
label="剩余数量原币税额"
align="center"
prop="money7"
width="150px"
:show-overflow-tooltip="true"
/>
<el-table-column
label="剩余数量本币价税合计"
align="center"
prop="money8"
width="160px"
:show-overflow-tooltip="true"
/> -->
<el-table-column
label="行备注"
align="center"
prop="cbmemo"
width="150px"
:show-overflow-tooltip="true"
/>
</el-table>
<!-- 表单按钮 -->
<!-- <el-row style="margin-top:20px">
<el-col :span="24">
<el-form-item style="float: right;margin-right: 20px">
<el-button
type="primary"
@click="submitForm"
v-loading="saveLoading"
>确 定</el-button
>
<el-button @click="cancel">取 消</el-button>
</el-form-item>
</el-col>
</el-row> -->
</el-form>
</el-container>
</template>
<script>
import synchro from './synchro.vue'
import selectSupplier from "@/views/mes/BasicData/supplier/select-supplier.vue";
import "@riophae/vue-treeselect/dist/vue-treeselect.css";
import selectDept from "./select-dept.vue";
import selectSalesman from "./select-salesman.vue";
import batchSelect from "@/views/mes/warehouse/arriveBill/batchSelect.vue";
export default {
name: "arrive-bill-form-order",
components: {},
props: {
layerid: {
type: String,
default: ""
},
row: {
type: Object,
default: undefined
},
formType: {
type: Number,
default: 0
},
parentform: {
type: Object,
default: undefined
}
},
data() {
return {
loading: false,
//表单
form: {
cPoid: "",
supplierId: "",
supplierCode: "",
supplierName: "",
departmentId: "",
departmentCode: "",
departmentName: "",
salesmanCode: "",
salesmanName: "",
materialCodeArr: "",
pageSize: 50,
pageNo: 1
},
rules: {},
orderTableLoading: false,
orderList: [],
orderRows: [],
expands: [],
getRowKeys: row => {
//获取当前行id
// console.log(row)
return row.poid; //这里看这一行中需要根据哪个属性值是id
},
chooseOrder: {},
ervryChoose: {},
isCanChoose: true,
childrenList: [],
tableLoading: false,
dataList: [],
rows: [],
multipleList: [],
saveLoading: false,
total: 0,
// 供应商编码,用于统一物料的供应商
supplierCode: null,
supplierName: null,
};
},
async mounted() {},
created() {
//this.initData()
console.log(this.parentform, "this.parentform", this.form);
this.form.supplierId = this.parentform.supplierId;
this.form.supplierName = this.parentform.supplierName;
this.form.supplierCode = this.parentform.supplierCode;
if (this.g_method.checkData(this.form.supplierCode)) {
this.initData();
}
// 0124应任化松要求改为只带入供应商信息
},
methods: {
handleSynchro()
{
// 同步
this.$layer.iframe({
shadeClose: false,
content: {
content: synchro, //传递的组件对象
parent: this, //当前的vue对象
shadeClose: false,
area: [this.g_const.dialogWidthMiddle, "300px"],
},
title: "同步采购订单"
});
},
//重置条件
cleanQuery() {
this.form.cPoid = "";
this.form.supplierId = "";
this.form.supplierCode = "";
this.form.supplierName = "";
this.form.departmentId = "";
this.form.departmentCode = "";
this.form.departmentName = "";
this.form.salesmanCode = "";
this.form.salesmanName = "";
this.form.materialCodeArr = "";
this.form.pageSize = 50;
this.form.pageNo = 1;
this.form = JSON.parse(JSON.stringify(this.form));
this.initData();
},
//改变pageSize
handleSizeChange(val) {
this.form.pageSize = val;
this.initData();
},
//改变页码
handleCurrentChange(val) {
this.form.pageNo = val;
this.initData();
},
//获取订单
initData() {
this.orderTableLoading = true;
var dto = {
cPoid: this.form.cPoid,
cVenCode: this.form.supplierCode,
cDepName: this.form.departmentName,
cPersonName: this.form.salesmanName,
pageNo: this.form.pageNo,
pageSize: this.form.pageSize
};
if (this.form.materialCodeArr.length > 0) {
//物料编码
dto.materialCodeArr = this.form.materialCodeArr.split(" ");
dto.materialCodeArr = dto.materialCodeArr.filter(o => {
return o.indexOf(" ") == -1;
});
}
this.$arriveBill.getPurchaseBillList(dto).then(res => {
this.orderList = res.data.data.data;
this.total = res.data.data.recordsTotal;
// var list = res.data.data.data
// for(var i=0;i<10;i++){
// this.orderList.push(list[i])
// }
this.orderTableLoading = false;
});
},
//打开选择供应商弹窗
selectSupplier() {
this.$layer.iframe({
shadeClose: false,
content: {
content: selectSupplier, //传递的组件对象
parent: this, //当前的vue对象
shadeClose: false
},
title: "选择供应商(双击选中单条数据)"
});
},
//选择供应商
getSupplier(row) {
this.form.supplierId = row.id;
this.form.supplierCode = row.supplierCode;
this.form.supplierName = row.supplierName;
},
//清空供应商
produceCleanSupplier() {
this.form.supplierId = null;
this.form.supplierCode = null;
this.form.supplierName = null;
},
//打开选择客户弹窗
selectDept() {
this.$layer.iframe({
shadeClose: false,
content: {
content: selectDept, //传递的组件对象
parent: this, //当前的vue对象
shadeClose: false
},
title: "选择部门(双击选中单条数据)"
});
},
//选择客户
getDept(row) {
this.form.departmentId = row.deptId;
this.form.departmentCode = row.deptCode;
this.form.departmentName = row.deptName;
},
//清空客户
produceCleanDept() {
this.form.departmentId = null;
this.form.departmentCode = null;
this.form.departmentName = null;
},
//打开选择业务员弹窗
selectSalesman() {
this.$layer.iframe({
shadeClose: false,
content: {
content: selectSalesman, //传递的组件对象
parent: this, //当前的vue对象
shadeClose: false
},
title: "选择部门(双击选中单条数据)"
});
},
//选择业务员
getSalesman(row) {
this.form.salesmanCode = row.nickName;
this.form.salesmanName = row.userName;
},
//清空业务员
produceCleanSalesman() {
this.form.salesmanCode = null;
this.form.salesmanName = null;
},
//当表格的当前行发生变化的时候会触发该事件
currentOrderChange(selection, lastVal) {
this.orderRows = [];
this.orderRows.push(selection);
},
//展开列表行
rowExpand(row, rowList) {
console.log(row, rowList, "1556");
this.$refs.orderList.setCurrentRow(row);
//判断两个订单关于到货单的信息是否相同
var isSame = true;
this.ervryChoose = row;
if (
row.cexch_name == this.chooseOrder.cexch_name &&
row.itaxRate == this.chooseOrder.itaxRate &&
row.nflat == this.chooseOrder.nflat
) {
isSame = true;
} else {
isSame = false;
}
if (this.dataList.length > 0 && !isSame) {
this.$message.error("不能选择该订单的物料,请先删除添加的物料");
this.isCanChoose = false;
} else {
this.isCanChoose = true;
this.chooseOrder = row;
}
this.childrenList = [];
if (rowList.length) {
this.expands = [];
if (row) {
this.expands.push(row.poid);
}
this.getChildrenList(row.poid);
} else {
this.expands = [];
}
},
//查询订单下的物料
getChildrenList(id) {
console.log(new Date().getTime(), "毫秒1");
this.$arriveBill.getPurchaseBillDetail(id).then(res => {
console.log(res.data.data, "res.data.data1549");
let tableData = res.data.data.map(data => {
if (data.iarrQty == null) {
data.qty = data.iquantity;
data.iarrQty = 0;
} else data.qty = data.iquantity - data.iarrQty;
return data;
});
this.childrenList = tableData;
console.log(new Date().getTime(), "毫秒2");
});
},
//选择订单详情
handleOrderDetailChange(val) {
console.log("选择订单", val);
console.log(this.chooseOrder, this.ervryChoose, "this.chooseOrder");
// 判断是否为同一供应商
if (this.supplierCode) {
if (this.chooseOrder.cvenCode != this.supplierCode) {
this.$message.error("列表数据供应商为:" + this.supplierName + ",选中数据供应商为:" + this.chooseOrder.cvenName + ",供应商不一致");
return;
}
} else{
this.supplierCode = this.chooseOrder.cvenCode
this.supplierName = this.chooseOrder.cvenName
}
if (this.dataList.length == 0) {
this.chooseOrder = this.ervryChoose;
}
var ids = [];
this.dataList.forEach(item => {
ids.push(item.id);
});
if (this.isCanChoose || this.dataList.length == 0) {
val.forEach(item => {
console.log(ids.indexOf(item));
if (ids.indexOf(item.id) == -1) {
item.iperTaxRate = this.chooseOrder.itaxRate;
item.itaxRate = this.chooseOrder.itaxRate;
item.purchaseBillId = this.chooseOrder.poid;
item.purchaseBillNumber = this.chooseOrder.cpoid;
item.isum = parseFloat(
this.floatMul(
parseFloat(item.qty).toFixed(4),
parseFloat(item.itaxPrice).toFixed(4)
)
).toFixed(4);
item.money1 = parseFloat(
this.floatDiv(item.itaxPrice, 1 + item.iperTaxRate / 100)
).toFixed(4);
item.money2 = parseFloat(
this.floatMul(item.qty, item.money1)
).toFixed(4);
item.money3 = item.isum - item.money2;
item.money4 = item.isum;
this.dataList.push(JSON.parse(JSON.stringify(item)));
}
});
}
},
changeQty(row) {
this.dataList.forEach(item => {
if (row == item) {
item.isum = parseFloat(
this.floatMul(
parseFloat(item.qty).toFixed(4),
parseFloat(item.itaxPrice).toFixed(4)
)
).toFixed(4);
item.money1 = parseFloat(
this.floatDiv(item.itaxPrice, 1 + item.iperTaxRate / 100)
).toFixed(4);
item.money2 = parseFloat(
this.floatMul(item.qty, item.money1)
).toFixed(4);
item.money3 = item.isum - item.money2;
item.money4 = item.isum;
}
});
},
//当表格的当前行发生变化的时候会触发该事件
currentChange(selection, lastVal) {
this.rows = [];
this.rows.push(selection);
},
//选中table
handleDataChange(val) {
this.multipleList = val;
},
queryChildrenList() {
//供子页面查询
return this.childrenList;
},
batchSelect() {
//批量选择
console.log("batchSelect", this.orderRows);
if (this.orderRows.length != 1) {
this.$message.warning("请选择唯一一行进行操作!");
return;
}
this.$refs.orderList.toggleRowExpansion(this.orderRows[0], true); //选中这一行
setTimeout(() => {
if (this.isCanChoose == false) {
this.$message.error("不能选择该订单的物料,请先删除添加的物料");
return;
}
this.$layer.iframe({
resize: true,
shadeClose: false,
content: {
content: batchSelect, //传递的组件对象
parent: this, //当前的vue对象
data: {
parentform: this.orderRows[0]
}
},
area: [this.g_const.dialogWidthMiddle, "560px"],
title: "批量选择"
});
}, 100);
},
//删除选中的行
deleteData() {
var deleteList = [];
if (this.multipleList.length > 0) {
deleteList = this.multipleList;
} else {
deleteList = this.rows;
}
deleteList.forEach(row => {
this.dataList.splice(this.dataList.indexOf(row), 1);
});
if (this.dataList.length==0) {
this.supplierCode = null;
this.supplierName = null;
}
},
//保存
submitForm() {
this.$refs["form"].validate(valid => {
if (valid) {
// 判断是否为同一供应商
if (this.$parent.detailList.length > 0) {
if (this.$parent.form.supplierCode != this.supplierCode) {
this.$message.error("与当前已有物料数据的供应商不一致");
return;
}
} else {
this.$parent.form.supplierCode = this.supplierCode;
this.$parent.form.supplierName = this.supplierName;
}
// if(this.rows.length==0){
// this.$message.error("请选择物料")
// return;
// }
this.saveLoading = true;
var dto = this.chooseOrder;
dto.items = this.dataList;
//关闭弹窗,将保存的数据带到父组件
//this.form.purchaseBillDetailId = dto.poid;
this.form.currency = dto.cexch_name;
this.form.exchangeRate = dto.nflat;
this.form.taxRate = dto.itaxRate;
// this.form.supplierId: this.form.supplierId,
// this.form.supplierCode: this.form.supplierCode,
// this.form.supplierName: this.form.supplierName,
// this.form.salesmanName: this.form.salesmanName,
this.form.items = [];
dto.items.forEach(item => {
this.form.items.push({
purchaseBillId: item.purchaseBillId,
purchaseBillNumber: item.purchaseBillNumber,
purchaseBillDetailId: item.id,
materialCode: item.cinvCode,
materialName: item.cinvName,
materialSpec: item.cinvStd,
unitOfMeasure: item.ccomUnitName,
unitOfMeasureCode: item.ccomUnitCode,
planQty: item.qty,
ioriTaxCost: item.itaxPrice,
itaxRate: item.itaxRate,
ioriSum: item.isum,
iunitCost: item.money1,
ioriMoney: item.money2,
ioriTaxPrice: item.money3,
isum: item.money4
});
});
console.log(this.form);
this.$parent.returnDataByOrder(this.form);
this.cancel();
}
});
},
//重置表单
reset() {},
//取消
cancel() {
this.reset();
this.$layer.close(this.layerid);
//this.$parent.initData()
},
//float乘法
floatMul(arg1, arg2) {
var m = 0;
var s1 = arg1.toString();
var s2 = arg2.toString();
try {
m += s1.split(".")[1].length;
} catch (e) {}
try {
m += s2.split(".")[1].length;
} catch (e) {}
return (
(Number(s1.replace(".", "")) * Number(s2.replace(".", ""))) /
Math.pow(10, m)
);
},
//float除法
floatDiv(arg1, arg2) {
var r1 = 0;
var r2 = 0;
var m;
var s1 = arg1.toString();
var s2 = arg2.toString();
try {
if (s1.split(".")[1] != undefined) r1 = s1.split(".")[1].length;
} catch (e) {}
try {
if (s2.split(".")[1] != undefined) r2 = s2.split(".")[1].length;
} catch (e) {}
m = Math.pow(10, Math.max(r1, r2));
return this.floatMul(arg1, m) / this.floatMul(arg2, m);
},
//float减法
floatSub(arg1, arg2) {
var r1 = 0,
r2 = 0,
m,
n,
s1 = arg1.toString(),
s2 = arg2.toString();
try {
if (s1.split(".")[1] != undefined) r1 = s1.split(".")[1].length;
} catch (e) {}
try {
if (s2.split(".")[1] != undefined) r2 = s2.split(".")[1].length;
} catch (e) {}
m = Math.pow(10, Math.max(r1, r2));
//last modify by deeka
//动态控制精度长度
n = r1 >= r2 ? r1 : r2;
return (this.floatMul(arg1, m) - this.floatMul(arg2, m)) / m;
},
//float加法
floatAdd(arg1, arg2) {
var r1 = 0;
var r2 = 0;
var m;
var s1 = arg1.toString();
var s2 = arg2.toString();
try {
if (s1.split(".")[1] != undefined) r1 = s1.split(".")[1].length;
} catch (e) {}
try {
if (s2.split(".")[1] != undefined) r2 = s2.split(".")[1].length;
} catch (e) {}
m = Math.pow(10, Math.max(r1, r2));
return (this.floatMul(arg1, m) + this.floatMul(arg2, m)) / m;
}
}
};
</script>
<style lang="scss" scoped>
.el-form-item {
margin-bottom: 10px;
}
>>> .el-table__body tr.current-row > td {
background-color: #8ac1ff !important;
cursor: pointer;
}
.el-table >>> tbody tr:hover > td {
background-color: #8ac1ff !important;
}
.input_inner /deep/ .el-input__inner {
background-color: white !important;
}
>>> .el-divider--horizontal {
margin: 20px 0 10px 0;
}
</style>