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..54c5b71a 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,31 @@ export default { - + - + + + + + +
+ + + +

发票预览

+
{{setup3Model}}
+
+
+
+
+
+ + + +

完成

@@ -86,7 +107,6 @@ export default { 下一步 - 确定 @@ -137,13 +157,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 +174,7 @@ export default { adJ_DETAIL: [], }); // + const refreshRef = ref(true); const columns1 = { type: "object", title: "发票和结算分组对应关系", @@ -281,21 +300,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"]; @@ -310,6 +331,7 @@ export default { const importDialogVisible = ref(false); const setup2table1Ref = ref(null); const setup2table2Ref = ref(null); + const setup3Model = ref(null); const showSetupDialog = () => { //重开发票号 //invBillNum= @@ -439,47 +461,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; @@ -528,6 +606,8 @@ export default { next, setup2table1Ref, setup2table2Ref, + refreshRef, + setup3Model, }; }, }; 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 }; }, };