|
|
@@ -447,9 +447,44 @@
|
|
|
<div>
|
|
|
贷方金额: CNY {{ fixedAmt(subjectRow.amountCr, 16) }} {{ subjectRow.isForeign === 1 ? "USD " + fixedAmt(subjectRow.amountCrUsd, 16) : "" }}
|
|
|
</div>
|
|
|
+ <div style="margin-top: 10px; margin-bottom: 10px">
|
|
|
+ <el-form :model="subjectRowOff" ref="subjectRowOff" label-width="70px" class="demo-ruleForm">
|
|
|
+ <el-row :gutter="40">
|
|
|
+ <el-col :span="12" v-if="subjectRowOff.isCorp">
|
|
|
+ <!--<div>客户核算:</div>-->
|
|
|
+ <el-form-item label="客户名称:" prop="corpCnName">
|
|
|
+ <search-query
|
|
|
+ style="width: 100%"
|
|
|
+ ref="searchQueryRef"
|
|
|
+ :datalist="corpCnNameData"
|
|
|
+ :selectValue="subjectRowOff.corpCnName"
|
|
|
+ :filterable="true"
|
|
|
+ :clearable="true"
|
|
|
+ :remote="true"
|
|
|
+ :buttonIf="true"
|
|
|
+ placeholder="请选择客户名称"
|
|
|
+ :forParameter="{ key: 'id', label: 'cnName', value: 'cnName' }"
|
|
|
+ @corpFocus="getBcorpsListfun"
|
|
|
+ @remoteMethod="getBcorpsListfun"
|
|
|
+ @corpChange="corpChangeOff($event, 'corpCnName')"
|
|
|
+ @eldialogConfirm="eldialogConfirmOff('bcorps')"
|
|
|
+ @bottonSearchfun="bottonSearchfun('bcorps')"
|
|
|
+ >
|
|
|
+ <bcorps ref="bcorps" :eldialog="true" @selectionChange="eldialogMultipleChoice($event, 'bcorps')"></bcorps>
|
|
|
+ </search-query>
|
|
|
+ </el-form-item>
|
|
|
+ </el-col>
|
|
|
+ <el-col :span="12" v-if="subjectRowOff.isCorp">
|
|
|
+ <el-form-item label="" prop="">
|
|
|
+ <el-button type="primary" @click="regetOffVoucherItems">查询</el-button>
|
|
|
+ </el-form-item>
|
|
|
+ </el-col>
|
|
|
+ </el-row>
|
|
|
+ </el-form>
|
|
|
+ </div>
|
|
|
<div style="margin-top: 10px">
|
|
|
<!-- show-summary-->
|
|
|
- <!-- :summary-method="summaryMethod"-->
|
|
|
+ <!-- :summary-method="summaryMethodOff"-->
|
|
|
<el-table
|
|
|
ref="tableOffRecords"
|
|
|
:cell-style="{ padding: '0px', fontSize: '12px' }"
|
|
|
@@ -458,11 +493,18 @@
|
|
|
:data="offRecordsData"
|
|
|
:border="true"
|
|
|
style="width: 100%"
|
|
|
+ show-summary
|
|
|
+ :summary-method="summaryMethodOff"
|
|
|
@selection-change="handleOffRecordsSelectionChange"
|
|
|
:row-class-name="rowClassName"
|
|
|
>
|
|
|
<el-table-column fixed="left" type="selection" width="50"> </el-table-column>
|
|
|
<el-table-column type="index" width="40" style="text-align: center"> </el-table-column>
|
|
|
+ <el-table-column prop="voucherDate" label="凭证日期" width="120" style="padding: 0">
|
|
|
+ <template slot-scope="{ row }">
|
|
|
+ <span>{{ row.voucherDate }}</span>
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
<el-table-column prop="descr" label="摘要" width="200" style="padding: 0">
|
|
|
<template slot-scope="{ row }">
|
|
|
<span>{{ row.descr }}</span>
|
|
|
@@ -495,7 +537,7 @@
|
|
|
<span>{{ displayAmt(row.amountDr) }}</span>
|
|
|
</template>
|
|
|
</el-table-column>
|
|
|
- <el-table-column prop="amountDrOff" label="本次可核销" width="120px" style="text-align: right">
|
|
|
+ <el-table-column prop="amountDrOffCurrent" label="本次可核销" width="120px" style="text-align: right">
|
|
|
<template slot-scope="{ row }">
|
|
|
<el-input-number
|
|
|
v-if="subjectRow.dc === 'C' && row.amountDrBlc !== '0.00'"
|
|
|
@@ -525,7 +567,7 @@
|
|
|
<span>{{ displayAmt(row.amountCr) }}</span>
|
|
|
</template>
|
|
|
</el-table-column>
|
|
|
- <el-table-column prop="amountCrOff" label="本次可核销" width="120px" style="text-align: right">
|
|
|
+ <el-table-column prop="amountCrOffCurrent" label="本次可核销" width="120px" style="text-align: right">
|
|
|
<template slot-scope="{ row }">
|
|
|
<el-input-number
|
|
|
v-if="subjectRow.dc !== 'C' && row.amountCrBlc !== '0.00'"
|
|
|
@@ -563,7 +605,7 @@
|
|
|
<span>{{ displayAmt(row.amountDrUsd) }}</span>
|
|
|
</template>
|
|
|
</el-table-column>
|
|
|
- <el-table-column prop="amountDrUsdOff" label="本次可核销" width="120px" style="text-align: right">
|
|
|
+ <el-table-column prop="amountDrUsdOffCurrent" label="本次可核销" width="120px" style="text-align: right">
|
|
|
<template slot-scope="{ row }">
|
|
|
<el-input-number
|
|
|
v-if="subjectRow.dc === 'C' && row.amountDrUsdBlc !== '0.00'"
|
|
|
@@ -594,7 +636,7 @@
|
|
|
<span>{{ displayAmt(row.amountCrUsd) }}</span>
|
|
|
</template>
|
|
|
</el-table-column>
|
|
|
- <el-table-column prop="amountCrUsdOff" label="金额" width="120px" style="text-align: right">
|
|
|
+ <el-table-column prop="amountCrUsdOffCurrent" label="金额" width="120px" style="text-align: right">
|
|
|
<template slot-scope="{ row }">
|
|
|
<el-input-number
|
|
|
v-if="subjectRow.dc !== 'C' && row.amountCrUsdBlc !== '0.00'"
|
|
|
@@ -634,13 +676,12 @@
|
|
|
import SearchQuery from "@/components/iosbasic-data/searchquery.vue";
|
|
|
import { getWorkDicts } from "@/api/system/dictbiz";
|
|
|
import { finvouchersDetail, finvouchersitemsRemove, finvouchersSubmit, getOffVoucherItems } from "@/api/iosBasicData/finvouchers";
|
|
|
-import { getCurrentDate, getYearDate } from "@/util/date";
|
|
|
+import { getCurrentDate } from "@/util/date";
|
|
|
import fromtableDetails from "@/views/iosBasicData/finvouchers/assembly/fromtableDetails.vue";
|
|
|
import { accountsDetail } from "@/api/iosBasicData/accounts";
|
|
|
import { getBcorpsList } from "@/api/iosBasicData/bcorps";
|
|
|
import TreeSelect from "@/components/iosbasic-data/TreeSelect.vue";
|
|
|
-import { getDeptLazyTree, getDeptTree } from "@/api/system/dept";
|
|
|
-import { getList as userGetList } from "@/api/system/user";
|
|
|
+import { getDeptLazyTree } from "@/api/system/dept";
|
|
|
import { baccitemstypeList } from "@/api/iosBasicData/baccitemstype";
|
|
|
import bcorps from "@/views/iosBasicData/bcorps/index.vue";
|
|
|
import { selectEmpls } from "@/api/approval/processConfig";
|
|
|
@@ -670,6 +711,7 @@ export default {
|
|
|
offRecordsData: [], // 预收预付核销数据
|
|
|
offRecordsSelectionData: [],
|
|
|
handleSelectionData: [], // 分录多选的数据
|
|
|
+ subjectRowOff:{}, // 核销科目弹窗的显示数据
|
|
|
subjectRow: {}, // 科目弹窗的显示数据
|
|
|
subjectAccount: {}, // 当前选择科目的数据
|
|
|
corpCnNameData: [], // 客户核算 下拉数据
|
|
|
@@ -711,7 +753,37 @@ export default {
|
|
|
tableHeaderCellStyle({ row, column, rowIndex, columnIndex }) {
|
|
|
return "padding:4px 0px;fontSize:12px;color:#000;background:#ecf5ff;text-align:center";
|
|
|
},
|
|
|
- summaryMethod(param) {},
|
|
|
+ summaryMethodOff(param) {
|
|
|
+ const { columns, data } = param;
|
|
|
+ const sums = [];
|
|
|
+ columns.forEach((column, index) => {
|
|
|
+ if (index === 2) {
|
|
|
+ sums[index] = "合计";
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ const values = data.map((item) => Number(item[column.property]));
|
|
|
+ // 显示列的统计 金额
|
|
|
+ let arr = ["amountDrOffCurrent", "amountCrOffCurrent", "amountDrUsdOffCurrent", "amountCrUsdOffCurrent"];
|
|
|
+ // 判断是否有这个数据
|
|
|
+ if (arr.indexOf(column.property) != -1) {
|
|
|
+ if (!values.every((value) => isNaN(value))) {
|
|
|
+ sums[index] = values.reduce((prev, curr) => {
|
|
|
+ const value = Number(curr);
|
|
|
+ if (!isNaN(value)) {
|
|
|
+ return prev + curr;
|
|
|
+ } else {
|
|
|
+ return prev;
|
|
|
+ }
|
|
|
+ }, 0);
|
|
|
+ sums[index] = this.displayAmt(sums[index]); // 把合计的参数保留两位小数
|
|
|
+ // sums[index] += " 元";
|
|
|
+ } else {
|
|
|
+ sums[index] = " ";
|
|
|
+ }
|
|
|
+ }
|
|
|
+ });
|
|
|
+ return sums;
|
|
|
+ },
|
|
|
rowClassName({ row, rowIndex }) {
|
|
|
let rowName = "",
|
|
|
findRow = this.handleSelectionData.find((c) => c.rowIndex === row.rowIndex);
|
|
|
@@ -774,20 +846,70 @@ export default {
|
|
|
console.log("其他的组件");
|
|
|
}
|
|
|
},
|
|
|
+ // 下拉多选弹窗的确认
|
|
|
+ eldialogConfirmOff(name) {
|
|
|
+ if (name == "bcorps") {
|
|
|
+ if (this.$refs.bcorps.isShow) {
|
|
|
+ console.log("列表确认");
|
|
|
+ this.$set(this.subjectRowOff, "corpCnName", this.$refs.bcorps.selectionList[0].cnName);
|
|
|
+ this.$set(this.subjectRowOff, "corpEnName", this.$refs.bcorps.selectionList[0].enName);
|
|
|
+ this.$set(this.subjectRowOff, "corpId", this.$refs.bcorps.selectionList[0].id);
|
|
|
+ } else {
|
|
|
+ console.log("详情确认");
|
|
|
+ this.$refs.bcorps.$refs.detail.submitForm();
|
|
|
+ this.$set(this.subjectRowOff, "corpCnName", this.$refs.bcorps.$refs.detail.formData.cnName);
|
|
|
+ this.$set(this.subjectRowOff, "corpEnName", this.$refs.bcorps.$refs.detail.formData.enName);
|
|
|
+ this.$set(this.subjectRowOff, "corpId", this.$refs.bcorps.$refs.detail.formData.id);
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ console.log("其他的组件");
|
|
|
+ }
|
|
|
+ this.$refs.searchQueryRef.corpVisible = false;
|
|
|
+ },
|
|
|
// 详情接口
|
|
|
finvouchersDetailfun(id) {
|
|
|
this.pageLoading = true;
|
|
|
finvouchersDetail(id)
|
|
|
.then((res) => {
|
|
|
- this.form = res.data.data;
|
|
|
+ let data = res.data.data;
|
|
|
+ data.finVouchersItemsList = Array.isArray(data.finVouchersItemsList) ? data.finVouchersItemsList : [];
|
|
|
+ data.finVouchersItemsList.forEach((item) => {
|
|
|
+ item.dynUID = item.id + "";
|
|
|
+ });
|
|
|
+ data.finVouchersItemsList
|
|
|
+ .filter((j) => j.isOff === 1)
|
|
|
+ .forEach((item) => {
|
|
|
+ let row = data.finVouchersItemsList.find((j) => j.id === item.offVouItemId);
|
|
|
+ if (row) {
|
|
|
+ if (!Array.isArray(row.offVouItems)) row.offVouItems = [];
|
|
|
+ row.offVouItems.push(item);
|
|
|
+ }
|
|
|
+ });
|
|
|
+
|
|
|
+ console.log(data.finVouchersItemsList);
|
|
|
+
|
|
|
+ this.form = data;
|
|
|
})
|
|
|
.finally(() => {
|
|
|
this.pageLoading = false;
|
|
|
});
|
|
|
},
|
|
|
+ newGuid() {
|
|
|
+ let vd = "0123456789abcdefghijklmnopqrstuvwxyz".split("");
|
|
|
+ var i = vd,
|
|
|
+ o = [],
|
|
|
+ s = Math.random,
|
|
|
+ n;
|
|
|
+ (o[8] = o[13] = o[18] = o[23] = "-"), (o[14] = "4");
|
|
|
+ for (var r = 0; r < 36; r++) o[r] || ((n = 0 | (16 * s())), (o[r] = i[19 == r ? (3 & n) | 8 : 15 & n]));
|
|
|
+ return o.join("");
|
|
|
+ },
|
|
|
// 添加分录
|
|
|
addEntryfun() {
|
|
|
- let obj = {};
|
|
|
+ let obj = {
|
|
|
+ dynUID: this.newGuid().replace(/-/g, ""),
|
|
|
+ };
|
|
|
+ console.log(obj);
|
|
|
if (this.form.finVouchersItemsList.length > 0) {
|
|
|
obj.descr = this.form.finVouchersItemsList[this.form.finVouchersItemsList.length - 1].descr;
|
|
|
}
|
|
|
@@ -796,9 +918,10 @@ export default {
|
|
|
// 行添加
|
|
|
addRowsfun(row, index) {
|
|
|
//第二个参数为0的时候,是可以添加参数的,1的时候是删除
|
|
|
- this.form.finVouchersItemsList.splice(index, 0, {
|
|
|
- descr: row.descr,
|
|
|
- });
|
|
|
+ let obj = {
|
|
|
+ dynUID: this.newGuid().replace(/-/g, ""),
|
|
|
+ };
|
|
|
+ this.form.finVouchersItemsList.splice(index, 0, obj);
|
|
|
},
|
|
|
// 行删除
|
|
|
deletefun(row, index) {
|
|
|
@@ -993,26 +1116,41 @@ export default {
|
|
|
// 获取核销记录
|
|
|
showOffRecordsfun(row) {
|
|
|
// 获取状态
|
|
|
- getOffVoucherItems(row).then((res) => {
|
|
|
+ this.subjectRowOff = JSON.parse(JSON.stringify(row));
|
|
|
+ getOffVoucherItems(this.subjectRowOff).then((res) => {
|
|
|
this.offRecordsSelectionData = [];
|
|
|
- let data = Array.isArray(res.data.data) ? res.data.data : [];
|
|
|
- this.offRecordsData = data;
|
|
|
+ this.offRecordsData = Array.isArray(res.data.data) ? res.data.data : [];
|
|
|
this.subjectRow = row;
|
|
|
this.offRecordsVisible = true;
|
|
|
});
|
|
|
},
|
|
|
+ regetOffVoucherItems(){
|
|
|
+ getOffVoucherItems(this.subjectRowOff).then((res) => {
|
|
|
+ let list = Array.isArray(res.data.data) ? res.data.data : [];
|
|
|
+ list.forEach(item => {
|
|
|
+ if(this.offRecordsData.findIndex((i) => i.id === item.id) === -1) {
|
|
|
+ this.offRecordsData.push(item);
|
|
|
+ }
|
|
|
+ })
|
|
|
+ });
|
|
|
+ },
|
|
|
offRecordsDeterminefun() {
|
|
|
if (!Array.isArray(this.offRecordsData)) {
|
|
|
this.offRecordsVisible = false;
|
|
|
return;
|
|
|
}
|
|
|
+
|
|
|
+ if(this.offRecordsSelectionData.length===0){
|
|
|
+ return this.$message.warning("请选择至少一条数据");
|
|
|
+ }
|
|
|
+
|
|
|
let row = this.subjectRow;
|
|
|
let amt = row.dc === "D" ? Number(row.amountCr) : Number(row.amountDr);
|
|
|
let usd = row.dc === "D" ? Number(row.amountCrUsd) : Number(row.amountDrUsd);
|
|
|
let amtOff = 0.0,
|
|
|
usdOff = 0;
|
|
|
let rows = [];
|
|
|
- this.offRecordsData.forEach((item) => {
|
|
|
+ this.offRecordsSelectionData.forEach((item) => {
|
|
|
let currAmt = 0;
|
|
|
if (row.dc === "D") {
|
|
|
currAmt = Number(item.amountCrOffCurrent);
|
|
|
@@ -1042,7 +1180,9 @@ export default {
|
|
|
}
|
|
|
|
|
|
rows.forEach((item) => {
|
|
|
- let obj = {};
|
|
|
+ let obj = {
|
|
|
+ dynUID: this.newGuid().replace(/-/g, ""),
|
|
|
+ };
|
|
|
let flds = "accountId,accountCode,accountCnName,accountEnName,accountFullName,accountLevel,accountProperty,dc,";
|
|
|
flds += "isArAp,isCorp,isDc,isDept,isEmpl,isForeign,curCode,isQuantity,unitNo,isItem,itemClassify,itemClassifyId,itemId,itemName,";
|
|
|
flds += "corpId,corpShortName,corpCnName,corpEnName,deptId,deptName,emplId,emplName,exrate";
|
|
|
@@ -1068,8 +1208,6 @@ export default {
|
|
|
obj.isOff = 1;
|
|
|
obj.offSrcItemId = item.id;
|
|
|
obj.offVouItemId = row.id;
|
|
|
- obj.offVouItemIndex = this.form.finVouchersItemsList.indexOf(row);
|
|
|
- obj.offVouItem = row;
|
|
|
if (!Array.isArray(row.offVouItems)) row.offVouItems = [];
|
|
|
row.offVouItems.push(obj);
|
|
|
|
|
|
@@ -1155,6 +1293,82 @@ export default {
|
|
|
this.$set(this.form, name, value);
|
|
|
}
|
|
|
},
|
|
|
+ corpChangeOff(value, name) {
|
|
|
+ let found = false;
|
|
|
+ // 客户名称
|
|
|
+ if (name == "corpCnName") {
|
|
|
+ for (let item of this.corpCnNameData) {
|
|
|
+ if (item.cnName == value) {
|
|
|
+ found = true;
|
|
|
+ this.$set(this.subjectRowOff, "corpEnName", item.enName);
|
|
|
+ this.$set(this.subjectRowOff, "corpCnName", item.cnName);
|
|
|
+ this.$set(this.subjectRowOff, "corpShortName", item.shortName);
|
|
|
+ this.$set(this.subjectRowOff, "corpId", item.id);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if (!found) {
|
|
|
+ this.$set(this.subjectRowOff, "corpEnName", "");
|
|
|
+ this.$set(this.subjectRowOff, "corpCnName", "");
|
|
|
+ this.$set(this.subjectRowOff, "corpShortName", "");
|
|
|
+ this.$set(this.subjectRowOff, "corpId", 0);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ // 核算
|
|
|
+ else if (name == "deptName") {
|
|
|
+ for (let item of this.deptData) {
|
|
|
+ if (item.title == value) {
|
|
|
+ found = true;
|
|
|
+ this.$set(this.subjectRowOff, "deptName", item.title);
|
|
|
+ this.$set(this.subjectRowOff, "deptId", item.id);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if (!found) {
|
|
|
+ this.$set(this.subjectRowOff, "deptName", "");
|
|
|
+ this.$set(this.subjectRowOff, "deptId", 0);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ // 职员
|
|
|
+ else if (name == "emplName") {
|
|
|
+ for (let item of this.emplData) {
|
|
|
+ if (item.name == value) {
|
|
|
+ found = true;
|
|
|
+ this.$set(this.subjectRowOff, "emplName", item.name);
|
|
|
+ this.$set(this.subjectRowOff, "emplId", item.id);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if (!found) {
|
|
|
+ this.$set(this.subjectRowOff, "emplName", "");
|
|
|
+ this.$set(this.subjectRowOff, "emplId", 0);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ // 项目核算
|
|
|
+ else if (name == "itemName") {
|
|
|
+ for (let item of this.itemData) {
|
|
|
+ if (item.cnName == value) {
|
|
|
+ found = true;
|
|
|
+ this.$set(this.subjectRowOff, "itemName", item.cnName);
|
|
|
+ this.$set(this.subjectRowOff, "itemId", item.id);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if (!found) {
|
|
|
+ this.$set(this.subjectRowOff, "itemName", "");
|
|
|
+ this.$set(this.subjectRowOff, "itemId", 0);
|
|
|
+ }
|
|
|
+ } else if (name == "voucherType") {
|
|
|
+ this.$set(this.form, name, value);
|
|
|
+ for (let item of this.voucherTypeData) {
|
|
|
+ if (item.dictKey == value) {
|
|
|
+ found = true;
|
|
|
+ this.$set(this.form, "voucherTypeName", item.dictValue + "凭证");
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if (!found) {
|
|
|
+ this.$set(this.subjectRowOff, "voucherTypeName", "");
|
|
|
+ }
|
|
|
+ } else if (name == "voucherSource") {
|
|
|
+ this.$set(this.form, name, value);
|
|
|
+ }
|
|
|
+ },
|
|
|
// 借方/贷方 本币的计算
|
|
|
offAmountBlur(row, name) {
|
|
|
if (name === "D") {
|