From 3dfaa1d1e550c1df1bb0ec4ff3b53a5356de6d8f Mon Sep 17 00:00:00 2001 From: wanggang <76527413@qq.com> Date: Sat, 19 Aug 2023 10:47:55 +0800 Subject: [PATCH] =?UTF-8?q?fe=20=E5=8F=91=E7=A5=A8=E9=87=8D=E5=BC=803?= =?UTF-8?q?=E3=80=814=E6=AD=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../wwwroot/views/settle/_check.js | 188 ++++++++++++------ .../wwwroot/views/settle/commerce.js | 5 +- 2 files changed, 135 insertions(+), 58 deletions(-) diff --git a/code/src/Modules/SettleAccount/host/SettleAccount.HttpApi.Host/wwwroot/views/settle/_check.js b/code/src/Modules/SettleAccount/host/SettleAccount.HttpApi.Host/wwwroot/views/settle/_check.js index 5e51a00f..f69831f5 100644 --- a/code/src/Modules/SettleAccount/host/SettleAccount.HttpApi.Host/wwwroot/views/settle/_check.js +++ b/code/src/Modules/SettleAccount/host/SettleAccount.HttpApi.Host/wwwroot/views/settle/_check.js @@ -5,10 +5,12 @@ import request from "../../request/index.js"; import AppForm from "../../components/form/index.js"; import AppTable from "../../components/table/index.js"; import extraProperties from "../../models/_extraProperties.js"; +import { getUrl } from "../../request/index.js"; +import { ElMessage } from "element-plus"; export default { components: { AppForm, AppTable }, - template: html` + template: html` @@ -70,12 +72,30 @@ export default { - + - + + + + + +
+ + + +

发票预览

+
+
+
+
+
+ + + +

完成

@@ -86,7 +106,6 @@ export default { 下一步 - 确定 @@ -137,13 +156,11 @@ export default { .el-dialog__body { height: calc(100% - 120px); } - /* - .re-open .el-scrollbar, - .re-open .el-scrollbar__view { - height: calc(100% - 120px); - } */ + .cell.diff { + background: yellow; + } `, - props: ["modelValue", "data", "isBusiness"], + props: ["modelValue", "data", "isBusiness", "businessType"], emit: ["update:modelValue"], setup(props, context) { const show = ref(props.modelValue); @@ -156,6 +173,7 @@ export default { adJ_DETAIL: [], }); // + const refreshRef = ref(true); const columns1 = { type: "object", title: "发票和结算分组对应关系", @@ -281,21 +299,23 @@ export default { }, }; const setup2columns = { - lu: { - type: "string", - title: "零件号", - }, - price: { - type: "number", - title: "单价", - }, - qty: { - type: "number", - title: "数量", - }, - amt: { - type: "number", - title: "金额", + properties: { + lu: { + type: "string", + title: "零件号", + }, + price: { + type: "number", + title: "单价", + }, + qty: { + type: "number", + title: "数量", + }, + amt: { + type: "number", + title: "金额", + }, }, }; delete columns5.properties["oldInvBillNum"]; @@ -439,47 +459,103 @@ export default { loading.value = false; } }; + const addDiff = (o, list2, nodeClass, diffClass = "diff") => { + const key = o.querySelector(".lu")?.innerText; + var node = o.querySelector(nodeClass); + var nodeValue = node?.innerText; + var node2 = Array.from(list2) + .find((o) => o.querySelector(".lu").innerText === key) + ?.querySelector(nodeClass); + var nodeValue2 = node2?.innerText; + if (nodeValue !== nodeValue2) { + node?.classList.add(diffClass); + node2?.classList.add(diffClass); + } else { + node?.classList.remove(diffClass); + node2?.classList.remove(diffClass); + } + }; const next = async () => { if (setupRef.value === 1) { try { - setupRef.value += 1; - //处理高亮 - nextTick(() => { - console.log(setup2table1Ref.value); - console.log(setup2table2Ref.value); - const list1 = setup2table1Ref.value.tableRef.querySelectorAll(".row.data"); - const list2 = setup2table2Ref.value.tableRef.querySelectorAll(".row.data"); - list1.forEach((o) => { - const key = o.querySelector(".lu").innerText; - var qty = o.querySelector(".qty"); - var qtyValue = qty.innerText; - var qty2 = Array.from(list2).find((o) => o.querySelector(".lu").innerText === key); - var qtyValue2 = qty2?.innerText; - if (qtyValue !== qty2) { - qty.classList.addClass("diff"); - qty2?.addClass("diff"); - } - }); - }); + // setupRef.value += 1; + // return; //临时 + //发到服务的校验 + const result = await request(`settleaccount/adj_service/check-import`, adjList.value, { method: "POST" }); + if (!result.errors) { + if (result.data?.code === 200) { + adjList.value = result.data.data; + setupRef.value += 1; + //处理高亮 + nextTick(() => { + const list1 = setup2table1Ref.value.tableRef.querySelectorAll(".row.data"); + const list2 = setup2table2Ref.value.tableRef.querySelectorAll(".row.data"); + list1.forEach((o) => { + addDiff(o, list2, ".qty"); + addDiff(o, list2, ".amt"); + }); + list2.forEach((o) => { + addDiff(o, list1, ".qty"); + addDiff(o, list1, ".amt"); + }); + }); + } else if (result.data?.code === 400) { + ElMessage({ + type: "error", + message: "校验失败", + }); + window.open(getUrl(`settleaccount/getblobfile/download/${result.data.fileName}`)); + } + } } catch (e) { console.log(e); } } else if (setupRef.value === 2) { - // const url = "settleaccount/adj_service/check-import"; - // const result = await request(url, adjList.value, { method: "POST" }); - // if (!result.errors) { - // if (result.data?.code === 200) { - // setupRef.value += 1; - // } else if (result.data?.code === 400 && result.data.fileName) { - // window.open(getUrl(`settleaccount/getblobfile/download/${result.data.fileName}`)); - // } - // } - setupRef.value += 1; + let service = null; + if (props.businessType === "JisBBAC") { + service = "bbac_ba_service"; + } else if (bprops.usinessType === "JisHBPO") { + service = "hbpo_ba_service"; + } else { + service = "pub_ba_service"; + } + const url = `settleaccount/${service}}/reissue-invoice-list`; + const result = await request(url, adjList.value, { method: "POST" }); + if (!result.errors) { + if (result.data?.code === 200) { + //setup3的数据来源 + setup3Model.value = result.data.data; + setupRef.value += 1; + } else if (result.data?.code === 400 && result.data.fileName) { + ElMessage({ + type: "error", + message: "提交失败", + }); + window.open(getUrl(`settleaccount/getblobfile/download/${result.data.fileName}`)); + } + } + } else if (setupRef.value === 3) { + const url = `settleaccount/${service}}/reissue-invoice-extend`; + const result = await request(url, adjList.value, { method: "POST" }); + if (!result.errors) { + if (result.data?.code === 200) { + setupRef.value += 1; + } else if (result.data?.code === 400 && result.data.fileName) { + ElMessage({ + type: "error", + message: "提交失败", + }); + window.open(getUrl(`settleaccount/getblobfile/download/${result.data.fileName}`)); + } + } } else { - setupRef.value += 1; + setupDialogVisable.value = false; + refreshRef.value = false; + nextTick(() => { + refreshRef.value = true; + }); } }; - const submitReOpen = async () => {}; // onMounted(async () => { loading.value = true; diff --git a/code/src/Modules/SettleAccount/host/SettleAccount.HttpApi.Host/wwwroot/views/settle/commerce.js b/code/src/Modules/SettleAccount/host/SettleAccount.HttpApi.Host/wwwroot/views/settle/commerce.js index 48af9dd5..4b2e75bf 100644 --- a/code/src/Modules/SettleAccount/host/SettleAccount.HttpApi.Host/wwwroot/views/settle/commerce.js +++ b/code/src/Modules/SettleAccount/host/SettleAccount.HttpApi.Host/wwwroot/views/settle/commerce.js @@ -9,7 +9,8 @@ import AppCheck from "./_check.js"; export default { components: { AppList, AppCheck }, - template: html` `, + template: html` + `, setup() { const appListRef = ref(null); const visable = ref(false); @@ -69,6 +70,6 @@ export default { } console.log(item.path, item, rows); }; - return { appListRef, config, onCommand, visable, data }; + return { appListRef, config, onCommand, visable, data, businessType }; }, };