From 4fbfea82f21abf407008e9a64ce644efb4c5e9b5 Mon Sep 17 00:00:00 2001 From: ZhangAo Date: Sat, 8 Aug 2026 17:28:38 +0800 Subject: [PATCH] 20260808172837 --- ERP费用核销并发控制方案.md | 11 - code/fms/fms-vue/package.json | 2 +- code/fms/fms-vue/pnpm-lock.yaml | 13 +- .../src/components/fms-table/FmsTable.vue | 35 +- .../src/layouts/components/AppTabs.vue | 38 +- .../src/views/module-management/index.vue | 284 ++--- code/fms/module-management-demo.html | 375 ------ code/fms/module-management-layout-demo.html | 347 +++++ code/fms/ui-redesign-prototype-v3.html | 485 ------- code/fms/ui-redesign-prototype.html | 596 --------- .../cw/assistance/daily-expenses/detail.vue | 238 ---- .../cw/assistance/daily-expenses/list.vue | 490 ------- .../cw/assistance/payment-account/detail.vue | 220 ---- .../cw/assistance/payment-account/list.vue | 485 ------- code/新建文件夹/cw/components/hldlg.vue | 204 --- code/新建文件夹/cw/components/index.js | 999 --------------- code/新建文件夹/cw/components/link.vue | 234 ---- code/新建文件夹/cw/yf/detailbill.vue | 1082 ---------------- code/新建文件夹/cw/yf/detailfkd.vue | 1128 ----------------- code/新建文件夹/cw/yf/detailinvoice.vue | 975 -------------- code/新建文件夹/cw/yf/list.vue | 829 ------------ code/新建文件夹/cw/yf/listbill.vue | 664 ---------- code/新建文件夹/cw/yf/listfkd.vue | 576 --------- code/新建文件夹/cw/yf/listinvoice.vue | 571 --------- code/新建文件夹/cw/ys/detailbill.vue | 979 -------------- code/新建文件夹/cw/ys/detailinvoice.vue | 1002 --------------- code/新建文件夹/cw/ys/detailskd.vue | 1126 ---------------- code/新建文件夹/cw/ys/list.vue | 826 ------------ code/新建文件夹/cw/ys/listbill.vue | 542 -------- code/新建文件夹/cw/ys/listinvoice.vue | 568 --------- code/新建文件夹/cw/ys/listskd.vue | 576 --------- 新建文本文档.txt | 36 - 32 files changed, 517 insertions(+), 16019 deletions(-) delete mode 100644 ERP费用核销并发控制方案.md delete mode 100644 code/fms/module-management-demo.html create mode 100644 code/fms/module-management-layout-demo.html delete mode 100644 code/fms/ui-redesign-prototype-v3.html delete mode 100644 code/fms/ui-redesign-prototype.html delete mode 100644 code/新建文件夹/cw/assistance/daily-expenses/detail.vue delete mode 100644 code/新建文件夹/cw/assistance/daily-expenses/list.vue delete mode 100644 code/新建文件夹/cw/assistance/payment-account/detail.vue delete mode 100644 code/新建文件夹/cw/assistance/payment-account/list.vue delete mode 100644 code/新建文件夹/cw/components/hldlg.vue delete mode 100644 code/新建文件夹/cw/components/index.js delete mode 100644 code/新建文件夹/cw/components/link.vue delete mode 100644 code/新建文件夹/cw/yf/detailbill.vue delete mode 100644 code/新建文件夹/cw/yf/detailfkd.vue delete mode 100644 code/新建文件夹/cw/yf/detailinvoice.vue delete mode 100644 code/新建文件夹/cw/yf/list.vue delete mode 100644 code/新建文件夹/cw/yf/listbill.vue delete mode 100644 code/新建文件夹/cw/yf/listfkd.vue delete mode 100644 code/新建文件夹/cw/yf/listinvoice.vue delete mode 100644 code/新建文件夹/cw/ys/detailbill.vue delete mode 100644 code/新建文件夹/cw/ys/detailinvoice.vue delete mode 100644 code/新建文件夹/cw/ys/detailskd.vue delete mode 100644 code/新建文件夹/cw/ys/list.vue delete mode 100644 code/新建文件夹/cw/ys/listbill.vue delete mode 100644 code/新建文件夹/cw/ys/listinvoice.vue delete mode 100644 code/新建文件夹/cw/ys/listskd.vue delete mode 100644 新建文本文档.txt diff --git a/ERP费用核销并发控制方案.md b/ERP费用核销并发控制方案.md deleted file mode 100644 index a7d6d7a6..00000000 --- a/ERP费用核销并发控制方案.md +++ /dev/null @@ -1,11 +0,0 @@ -| 方案 | 存在问题 | -| ------------------------------- | ------------------------------------------------------------ | -| 存储过程核销和反核销 + 保存分开 | A和B打开了同一个收款单。A修改了核销金额点击了保存,B却点击了核销 | -| | | -| | | - -| 问题 | 发生位置 | 类型 | -| -------------------------- | -------------------------- | -------------- | -| A改20,B改30 | cw_sfdsub | 丢失更新 | -| 修改后核销金额和费用不一致 | cw_sfdsub + bs_business_cw | 数据一致性问题 | -| 多人同时核销同一费用 | bs_business_cw | 余额并发问题 | diff --git a/code/fms/fms-vue/package.json b/code/fms/fms-vue/package.json index a0612b6b..07577200 100644 --- a/code/fms/fms-vue/package.json +++ b/code/fms/fms-vue/package.json @@ -19,7 +19,7 @@ "nprogress": "^0.2.0", "pinia": "^4.0.2", "pinia-plugin-persistedstate": "^4.7.1", - "stk-table-vue": "^1.0.0", + "stk-table-vue": "^1.1.0", "vue": "^3.5.39", "vue-router": "^5.2.0" }, diff --git a/code/fms/fms-vue/pnpm-lock.yaml b/code/fms/fms-vue/pnpm-lock.yaml index 3daddae2..759e3a78 100644 --- a/code/fms/fms-vue/pnpm-lock.yaml +++ b/code/fms/fms-vue/pnpm-lock.yaml @@ -8,6 +8,9 @@ importers: .: dependencies: + '@antdv-next/icons': + specifier: ^1.1.1 + version: 1.1.1(vue@3.5.39) '@lucide/vue': specifier: ^1.24.0 version: 1.24.0(vue@3.5.39) @@ -30,8 +33,8 @@ importers: specifier: ^4.7.1 version: 4.7.1(pinia@4.0.2(@vue/devtools-api@8.1.5)(vue@3.5.39)) stk-table-vue: - specifier: ^1.0.0 - version: 1.0.0 + specifier: ^1.1.0 + version: 1.1.0 vue: specifier: ^3.5.39 version: 3.5.39 @@ -1412,8 +1415,8 @@ packages: resolution: {integrity: sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g==} engines: {node: '>=0.10.0'} - stk-table-vue@1.0.0: - resolution: {integrity: sha512-K6YvwicGfQPeKImIc4MBMD3Hw2E45vrxmKX103fPCdgeT8PEq1Da643IeMWW9dFz1VD9XV/hMUJXow/EZYW1sw==} + stk-table-vue@1.1.0: + resolution: {integrity: sha512-lPVBGZNuVGxSWq0k+XBGY00xStjplm4ckRIm/Zl83SAnxfMYUKQB0v/dEovAl/oARf9gq3/QvgZnTj93Bze66g==} stream-parser@0.3.1: resolution: {integrity: sha512-bJ/HgKq41nlKvlhccD5kaCr/P+Hu0wPNKPJOH7en+YrJu/9EgqUF+88w5Jb6KNcjOFMhfX4B2asfeAtIGuHObQ==} @@ -2845,7 +2848,7 @@ snapshots: source-map@0.6.1: optional: true - stk-table-vue@1.0.0: {} + stk-table-vue@1.1.0: {} stream-parser@0.3.1: dependencies: diff --git a/code/fms/fms-vue/src/components/fms-table/FmsTable.vue b/code/fms/fms-vue/src/components/fms-table/FmsTable.vue index 5a520d54..25ab2de0 100644 --- a/code/fms/fms-vue/src/components/fms-table/FmsTable.vue +++ b/code/fms/fms-vue/src/components/fms-table/FmsTable.vue @@ -503,7 +503,7 @@ defineExpose({ :no-data-full="noDataFull" :show-overflow="showOverflow" :area-selection="editable" - :bordered="'h'" + :bordered="false" @area-selection-change="handleAreaSelectionChange" @row-order-change="handleRowOrderChange" > @@ -521,7 +521,14 @@ defineExpose({ - - -
-
-
-
F
-
模块管理统一维护目录、页面和数据模块
-
-
- -
管系统管理员可维护
-
-
- -
- - -
-
- -
-
-

客户联系人

-
数据模块contact_person已启用
-
-
- - - -
-
- -
- -
-
✓当前使用方式:默认。显示名称支持多语言,未翻译时自动回退到中文名称。
-
-

模块基本信息

保存后立即对运行页面生效
-
-
-
-
-
-
-
-
-
允许页面使用
-
-
-
-

字段概览

- - - - - - - -
字段名称类型列表表单状态
b_name姓名varchar显示编辑启用
b_mobile手机varchar显示编辑启用
b_remark备注nvarchar隐藏编辑启用
-
-
权限范围:当前账号可以编辑模块配置、同步字段和管理操作权限。
-
-
-
-
-
- - - diff --git a/code/fms/module-management-layout-demo.html b/code/fms/module-management-layout-demo.html new file mode 100644 index 00000000..9ad41571 --- /dev/null +++ b/code/fms/module-management-layout-demo.html @@ -0,0 +1,347 @@ + + + + + + + FMS 模块管理布局 Demo + + + +
+
+ + +
+
+
系统管理/模块管理
+
+
+

合作伙伴

+
数据模块·v_b_othercompany已启用
+
+
+ +
+ +
+
+ +
+ +
+
+
+

身份信息

定义模块在系统中的基本身份
+
+
+
+
+
+
+
+
启用
+
在菜单中显示
+
+
+
+

数据源

数据模块从查询视图读取数据
+
+
+
+
+
+
+
+
+ +
+

字段设计

从查询视图同步字段,并调整字段语义
+
+ + + + +
字段名称显示名称类型启用
b_id编号数字启用
b_name名称文本启用
b_shortname简称文本启用
b_type合作伙伴类型选择启用
+
+
+ +
+ +

列表布局

设置列表显示哪些字段以及字段顺序
顺序字段标题宽度可见
1b_name名称180是
2b_shortname简称140是
3b_type合作伙伴类型120是
+ + +
+ +
+

高级设置

低频配置集中放置,日常使用无需关注
ⓘ
建议先完成基本信息和字段设计。
自动编码、多语言和权限配置只影响特定业务场景,可在需要时再设置。
+

自动编码

目标字段前缀日期格式流水位数状态
未配置---未启用
+

权限与多语言

+
+
+
+
+
+ + + + diff --git a/code/fms/ui-redesign-prototype-v3.html b/code/fms/ui-redesign-prototype-v3.html deleted file mode 100644 index 38edfb28..00000000 --- a/code/fms/ui-redesign-prototype-v3.html +++ /dev/null @@ -1,485 +0,0 @@ - - -FMS 海运业务管理台 · 概念原型 v3 - -
- -
-
-
-
-
- - - diff --git a/code/fms/ui-redesign-prototype.html b/code/fms/ui-redesign-prototype.html deleted file mode 100644 index 0f40426d..00000000 --- a/code/fms/ui-redesign-prototype.html +++ /dev/null @@ -1,596 +0,0 @@ - - - - - -FMS 界面原型 · 工具感精修版 - - - -
- - - - -
-
- -
- - -
林
-
-
- -
- - - 2 个标签页 -
- -
- -
- -
-
- - - - -
-
- - - -
- - -
- 已选 0 条 -
- -
- -
- - -
- - - - - - - - - - - - - - - - - - -
订舱单号状态提单号委托客户起运 → 目的船名 / 航次ETDETA箱型箱量TEU运费
-
- -
- 共 0 条 - 合计 TEU 0 - 合计毛重 0.0 吨 - 数据同步于 08-05 09:20 -
-
- - - -
-
-
- - -
-
-
- - -
-
-
-
- - - - - diff --git a/code/新建文件夹/cw/assistance/daily-expenses/detail.vue b/code/新建文件夹/cw/assistance/daily-expenses/detail.vue deleted file mode 100644 index 946707e8..00000000 --- a/code/新建文件夹/cw/assistance/daily-expenses/detail.vue +++ /dev/null @@ -1,238 +0,0 @@ - - - - - diff --git a/code/新建文件夹/cw/assistance/daily-expenses/list.vue b/code/新建文件夹/cw/assistance/daily-expenses/list.vue deleted file mode 100644 index 50733155..00000000 --- a/code/新建文件夹/cw/assistance/daily-expenses/list.vue +++ /dev/null @@ -1,490 +0,0 @@ - - - - diff --git a/code/新建文件夹/cw/assistance/payment-account/detail.vue b/code/新建文件夹/cw/assistance/payment-account/detail.vue deleted file mode 100644 index 769ffab5..00000000 --- a/code/新建文件夹/cw/assistance/payment-account/detail.vue +++ /dev/null @@ -1,220 +0,0 @@ - - - - - diff --git a/code/新建文件夹/cw/assistance/payment-account/list.vue b/code/新建文件夹/cw/assistance/payment-account/list.vue deleted file mode 100644 index 0f4ab32d..00000000 --- a/code/新建文件夹/cw/assistance/payment-account/list.vue +++ /dev/null @@ -1,485 +0,0 @@ - - - - diff --git a/code/新建文件夹/cw/components/hldlg.vue b/code/新建文件夹/cw/components/hldlg.vue deleted file mode 100644 index ca6a9648..00000000 --- a/code/新建文件夹/cw/components/hldlg.vue +++ /dev/null @@ -1,204 +0,0 @@ - - - - diff --git a/code/新建文件夹/cw/components/index.js b/code/新建文件夹/cw/components/index.js deleted file mode 100644 index f43dd05f..00000000 --- a/code/新建文件夹/cw/components/index.js +++ /dev/null @@ -1,999 +0,0 @@ -import { app } from "@/main"; -import { createVNode, render, ref } from "vue"; -import { ElMessage } from "element-plus"; -import { handleMappingConfig } from "@/utils/dodata.js"; -import { getDefaultValue, getFieldString, getMoneyExRate } from "@/utils/g3Funlib.js"; -import { useUserStore } from "@/store/user.js"; -import { getDate, getDateAfter, getDateTime } from "@/utils/time.js"; -import { getSFId } from "@/utils/common.js"; -import { diffData } from "@/utils/dataDiffUtils.js"; -import { - getobjectApi, - saveobjtlockApi, - loaddatabysqlApi, - saveobjtApi, - saveobjtV5Api, - loaddataApi, -} from "@/utils/doSql.js"; -import math from "@/utils/math.js"; -import router from "@/router/index.js"; -import axios from "@/utils/axios"; -import Link from "./link.vue"; - -export function openFeeLink(subid, type) { - const container = document.createElement("div"); - document.body.appendChild(container); - - let visible = true; - - const vnode = createVNode(Link, { - subid, - type, - - modelValue: visible, - "onUpdate:modelValue": (val) => { - visible = val; - }, - - onClose() { - render(null, container); - container.remove(); - }, - }); - - vnode.appContext = app._context; - - render(vnode, container); -} - -/** - * 生成账单 - * @export - * @param {*} rows 选中行 - * @param {*} type 类型 - */ -export async function generateBill_old(subids, type) { - if (!Array.isArray(subids) || subids.length === 0) { - throw new Error("请选择操作行"); - } - - const userStore = useUserStore(); - - const sqlcondition = `AND subid IN (${subids.map((id) => `'${id}'`).join(",")})`; - - const mappingid = type === "应收" ? "cwtoysbill" : "cwtoyfbill"; - const viewname_main = type === "应收" ? "v_cw_ysbill" : "v_cw_yfbill"; - const viewname_sub = type === "应收" ? "v_cw_ysbillsub" : "v_cw_yfbillsub"; - - const maindata = ref({}); - const maindataorg = ref({}); - const subdata = ref([]); - const subdataorg = ref([]); - const subdatacw = ref([]); - - await handleMappingConfig(mappingid, sqlcondition, subdata); - - if (subdata.value.length === 0) { - throw new Error("无有效数据"); - } - - // // 数据库再次校验,防止并发重复生成账单 - // const subdatas = await loaddataApi( - // viewname_sub, - // `mx_fee_id IN (${subdata.value.map((x) => `'${x.mx_fee_id}'`).join(",")})`, - // ); - - // if (subdatas.length > 0) { - // throw new Error("选中数据已制单,请检查!"); - // } - - // 结算单位一致性校验 - const tmpdwid = subdata.value[0].mx_dw_id || ""; - - for (const row of subdata.value) { - if ((row.mx_dw_id || "") !== tmpdwid) { - throw new Error("结算单位不一致,请检查!"); - } - } - - await getDefaultValue(maindata, viewname_main); - - const mainid = await getSFId(); - - maindata.value = { - ...maindata.value, - b_id: mainid, - b_state: "草拟", - b_module_id: type, - }; - - // const userid = userStore.getUserId(); - // const updatetime = getDateTime(); - - for (const [index, item] of subdata.value.entries()) { - item.mx_xh = index; - item.father = mainid; - - // subdatacw.value.push({ - // subid: item.mx_fee_id, - // mx_bill_id: mainid, - // mx_bill_updatedatetime: updatetime, - // mx_bill_updateuser_id: userid, - // }); - } - - const first = subdata.value[0]; - - // maindata.value.v_dw_name = first.mx_dw_name; - let today = getDate(); - maindata.value.b_dw_id = first.mx_dw_id; - maindata.value.b_amount = math - .add( - ...subdata.value.map((row) => { - const amount = Number(row.mx_amount_rmb || 0); - if (type === "应收") { - return row.mx_type_id === "应收" ? amount : -amount; - } - return row.mx_type_id === "应付" ? amount : -amount; - }), - ) - .toFixed(3); - maindata.value.b_date = today; - - // 币种 desc - const amountData = subdata.value.reduce( - (result, row) => { - const moneytype = row.mx_fee_money_id || ""; - - const sign = type === row.mx_type_id ? 1 : -1; - - const billAmount = math.multiply(row.mx_fee_amount || 0, sign); - - const rmbAmount = math.multiply(row.mx_amount_rmb || 0, sign); - - result.moneyMap[moneytype] = math.add(result.moneyMap[moneytype] || 0, billAmount); - - result.rmbTotal = math.add(result.rmbTotal, rmbAmount); - - return result; - }, - { - moneyMap: {}, - rmbTotal: 0, - }, - ); - - maindata.value.b_amount_desc = [ - ...Object.entries(amountData.moneyMap).map(([type, amount]) => `${type}:${amount.toFixed(2)}`), - `本币种合计:${amountData.rmbTotal.toFixed(2)}`, - ].join(";"); - - // 获取该合作伙伴的账龄、合同收款日、开票信息 - const companydata = await getobjectApi("v_b_othercompany_all", "b_id", maindata.value.b_dw_id); - let zl = companydata.b_zl || 0; - maindata.value.b_zl = zl; - maindata.value.b_plandate = getDateAfter(today, zl); - maindata.value.b_dw_invaccount = companydata.b_invaccount; - maindata.value.b_dw_bankacount = companydata.b_bankacount; - - const maindataChanges = diffData(maindata.value, maindataorg.value, "b_id", { - isSingle: true, - }); - - const subdataChanges = diffData(subdata.value, subdataorg.value, "subid"); - - if (!maindataChanges.hasChanges && !subdataChanges.hasChanges) { - return; - } - - const requestData = [ - { - tableName: "cw_bill", - keyField: "b_id", - inserts: maindataChanges.insertdata, - updates: [], - deletes: [], - }, - { - tableName: "cw_billsub", - keyField: "subid", - inserts: subdataChanges.insertdata, - updates: [], - deletes: [], - }, - ]; - - await saveobjtV5Api(requestData); - - const params = { - b_id: maindata.value.b_id, - }; - - try { - const response = await axios.post("fee/billconfirm", params); - - if (response.data.success === true) { - ElMessage.success(response.data.message || "核销成功"); - } else { - ElMessage.warning(response.data.message || "核销失败"); - } - } catch (error) { - ElMessage.error("请求失败:" + error.message); - } - - router.push({ - name: type === "应收" ? "ysdetailbill" : "yfdetailbill", - query: { - id: mainid, - op: "mod", - }, - }); -} - -/** - * 生成账单 - * @export - * @param {*} rows 选中行 - * @param {*} type 类型 - */ -export async function generateBill(subids, configid) { - if (!Array.isArray(subids) || subids.length === 0) { - throw new Error("请选择操作行"); - } - - if (!configid) { - throw new Error("请传入有效数据"); - } - - const configs = await loaddataApi("s_module_config", `b_id = '${configid}'`); - if (configs.length === 0) { - throw new Error("配置无效,请检查配置!"); - } - - const moduleConfig = configs[0]; - - const sqlcondition = `AND subid IN (${subids.map((id) => `'${id}'`).join(",")})`; - - const mappingid = moduleConfig.b_mapid; - const viewname_main = moduleConfig.b_viewtable; - - const maindata = ref({}); - const maindataorg = ref({}); - const subdata = ref([]); - const subdataorg = ref([]); - - await handleMappingConfig(mappingid, sqlcondition, subdata); - - if (subdata.value.length === 0) { - throw new Error("无有效数据"); - } - - // 结算单位一致性校验 - const tmpdwid = subdata.value[0].mx_dw_id || ""; - - for (const row of subdata.value) { - if ((row.mx_dw_id || "") !== tmpdwid) { - throw new Error("结算单位不一致,请检查!"); - } - } - - await getDefaultValue(maindata, viewname_main); - - const mainid = await getSFId(); - const type = moduleConfig.b_cwtype; - - maindata.value = { - ...maindata.value, - b_id: mainid, - b_state: "草拟", - b_cwtype: type, - b_module_id: moduleConfig.b_moduleid, - }; - - for (const [index, item] of subdata.value.entries()) { - item.mx_xh = index; - item.father = mainid; - } - - const first = subdata.value[0]; - - // maindata.value.v_dw_name = first.mx_dw_name; - let today = getDate(); - maindata.value.b_dw_id = first.mx_dw_id; - maindata.value.b_amount = math - .add( - ...subdata.value.map((row) => { - const amount = Number(row.mx_amount_rmb || 0); - if (type === "应收") { - return row.mx_type_id === "应收" ? amount : -amount; - } - return row.mx_type_id === "应付" ? amount : -amount; - }), - ) - .toFixed(3); - maindata.value.b_date = today; - - // 币种 desc - const amountData = subdata.value.reduce( - (result, row) => { - const moneytype = row.mx_fee_money_id || ""; - - const sign = type === row.mx_type_id ? 1 : -1; - - const billAmount = math.multiply(row.mx_fee_amount || 0, sign); - - const rmbAmount = math.multiply(row.mx_amount_rmb || 0, sign); - - result.moneyMap[moneytype] = math.add(result.moneyMap[moneytype] || 0, billAmount); - - result.rmbTotal = math.add(result.rmbTotal, rmbAmount); - - return result; - }, - { - moneyMap: {}, - rmbTotal: 0, - }, - ); - - maindata.value.b_amount_desc = [ - ...Object.entries(amountData.moneyMap).map(([type, amount]) => `${type}:${amount.toFixed(2)}`), - `本币种合计:${amountData.rmbTotal.toFixed(2)}`, - ].join(";"); - - // 获取该合作伙伴的账龄、合同收款日、开票信息 - const companydata = await getobjectApi("v_b_othercompany_all", "b_id", maindata.value.b_dw_id); - let zl = companydata.b_zl || 0; - maindata.value.b_zl = zl; - maindata.value.b_plandate = getDateAfter(today, zl); - maindata.value.b_dw_invaccount = companydata.b_invaccount; - maindata.value.b_dw_bankacount = companydata.b_bankacount; - - const maindataChanges = diffData(maindata.value, maindataorg.value, "b_id", { - isSingle: true, - }); - - const subdataChanges = diffData(subdata.value, subdataorg.value, "subid"); - - if (!maindataChanges.hasChanges && !subdataChanges.hasChanges) { - return; - } - - const requestData = [ - { - tableName: "cw_bill", - keyField: "b_id", - inserts: maindataChanges.insertdata, - updates: [], - deletes: [], - }, - { - tableName: "cw_billsub", - keyField: "subid", - inserts: subdataChanges.insertdata, - updates: [], - deletes: [], - }, - ]; - - await saveobjtV5Api(requestData); - - // 保存成功,开始核销,异常交给外部自己处理 - const feeids = subdata.value - .map((item) => item.mx_fee_id) - .filter(Boolean) - .join(","); - - const params = { - b_id: maindata.value.b_id, - fee_ids: feeids, - }; - - try { - const response = await axios.post("fee/billconfirm", params); - - if (response.data.success === true) { - ElMessage.success(response.data.message || "核销成功"); - } else { - ElMessage.warning(response.data.message || "核销失败"); - } - } catch (error) { - ElMessage.error("请求失败:" + error.message); - } - - router.push({ - name: type === "应收" ? "ysdetailbill" : "yfdetailbill", - query: { - id: mainid, - op: "mod", - }, - }); -} - -// 发票 -export async function generateInvoice_old(subids, type) { - if (!Array.isArray(subids) || subids.length === 0) { - throw new Error("请选择操作行"); - } - - const userStore = useUserStore(); - - const sqlcondition = `AND subid IN (${subids.map((id) => `'${id}'`).join(",")})`; - - const mappingid = type === "应收" ? "cwtoysinvoice" : "cwtoyfinvoice"; - const viewname_main = type === "应收" ? "v_cw_ysinvoice" : "v_cw_yfinvoice"; - const viewname_sub = type === "应收" ? "v_cw_ysinvoicesub" : "v_cw_yfinvoicesub"; - - const maindata = ref({}); - const maindataorg = ref({}); - const subdata = ref([]); - const subdataorg = ref([]); - const subdatacw = ref([]); - - await handleMappingConfig(mappingid, sqlcondition, subdata); - - if (subdata.value.length === 0) { - throw new Error("无有效数据"); - } - - // 数据库再次校验,防止并发重复生成发票 - // const subdatas = await loaddataApi( - // viewname_sub, - // `mx_fee_id IN (${subdata.value.map((x) => `'${x.mx_fee_id}'`).join(",")})`, - // ); - - // if (subdatas.length > 0) { - // throw new Error("选中数据已开发票,请检查!"); - // } - - // 不同币种 不同结算单位 - const tmpdwid = subdata.value[0].mx_dw_id || ""; - const moneyid = subdata.value[0].mx_fee_money_id || ""; - - for (const row of subdata.value) { - if ((row.mx_dw_id || "") !== tmpdwid) { - throw new Error("结算单位不一致,请检查!"); - } - if ((row.mx_fee_money_id || "") !== moneyid) { - throw new Error("币种不一致,请检查!"); - } - } - - await getDefaultValue(maindata, viewname_main); - - const mainid = await getSFId(); - - maindata.value = { - ...maindata.value, - b_id: mainid, - b_state: "草拟", - b_module_id: type, - }; - - const userid = userStore.getUserId(); - const updatetime = getDateTime(); - - for (const [index, item] of subdata.value.entries()) { - const subid = await getSFId(); - - item.subid = subid; - item.mx_xh = index; - item.father = maindata.value.b_id; - - // subdatacw.value.push({ - // subid: item.mx_fee_id, - // mx_version: item.mx_version, - // mx_invoice_id: mainid, - // mx_invoice_updatedatetime: updatetime, - // mx_invoice_updateuser_id: userid, - // }); - } - - const first = subdata.value[0]; - maindata.value.v_dw_name = first.mx_dw_name; - maindata.value.b_dw_id = first.mx_dw_id; - maindata.value.b_money_id = first.mx_fee_money_id; - maindata.value.b_amount = math - .add(...subdata.value.map((row) => row.mx_invoice_amount || 0)) - .toFixed(2); - maindata.value.b_yw_ids = getFieldString(subdata.value, "b_ywno"); - maindata.value.b_date = getDate(); - - const maindataChanges = diffData(maindata.value, maindataorg.value, "b_id", { isSingle: true }); - const subdataChanges = diffData(subdata.value, subdataorg.value, "subid"); - if (!maindataChanges.hasChanges && !subdataChanges.hasChanges) { - return; - } - - const requestData = [ - { - tableName: "cw_invoice", - keyField: "b_id", - inserts: maindataChanges.insertdata, - updates: [], - deletes: [], - }, - { - tableName: "cw_invoicesub", - keyField: "subid", - inserts: subdataChanges.insertdata, - updates: [], - deletes: [], - }, - ]; - - await saveobjtV5Api(requestData); - - const params = { - b_id: maindata.value.b_id, - }; - - try { - const response = await axios.post("fee/invoiceconfirm", params); - - if (response.data.success === true) { - ElMessage.success(response.data.message || "核销成功"); - } else { - ElMessage.warning(response.data.message || "核销失败"); - } - } catch (error) { - ElMessage.error("请求失败:" + error.message); - } - - router.push({ - name: type === "应收" ? "ysdetailinvoice" : "yfdetailinvoice", - query: { - id: mainid, - op: "mod", - }, - }); -} - -export async function generateInvoice(subids, configid) { - if (!Array.isArray(subids) || subids.length === 0) { - throw new Error("请选择操作行"); - } - - if (!configid) { - throw new Error("请传入有效数据"); - } - - const configs = await loaddataApi("s_module_config", `b_id = '${configid}'`); - if (configs.length === 0) { - throw new Error("配置无效,请检查配置!"); - } - - const moduleConfig = configs[0]; - - const sqlcondition = `AND subid IN (${subids.map((id) => `'${id}'`).join(",")})`; - - const mappingid = moduleConfig.b_mapid; - const viewname_main = moduleConfig.b_viewtable; - - const maindata = ref({}); - const maindataorg = ref({}); - const subdata = ref([]); - const subdataorg = ref([]); - - await handleMappingConfig(mappingid, sqlcondition, subdata); - - if (subdata.value.length === 0) { - throw new Error("无有效数据"); - } - - // 不同币种 不同结算单位 - const tmpdwid = subdata.value[0].mx_dw_id || ""; - const moneyid = subdata.value[0].mx_fee_money_id || ""; - - for (const row of subdata.value) { - if ((row.mx_dw_id || "") !== tmpdwid) { - throw new Error("结算单位不一致,请检查!"); - } - if ((row.mx_fee_money_id || "") !== moneyid) { - throw new Error("币种不一致,请检查!"); - } - } - - await getDefaultValue(maindata, viewname_main); - - const mainid = await getSFId(); - const type = moduleConfig.b_cwtype; - - maindata.value = { - ...maindata.value, - b_id: mainid, - b_state: "草拟", - b_cwtype: type, - b_module_id: moduleConfig.b_moduleid, - }; - - for (const [index, item] of subdata.value.entries()) { - const subid = await getSFId(); - - item.subid = subid; - item.mx_xh = index; - item.father = maindata.value.b_id; - } - - const first = subdata.value[0]; - maindata.value.v_dw_name = first.mx_dw_name; - maindata.value.b_dw_id = first.mx_dw_id; - maindata.value.b_money_id = first.mx_fee_money_id; - maindata.value.b_amount = math - .add(...subdata.value.map((row) => row.mx_invoice_amount || 0)) - .toFixed(2); - maindata.value.b_yw_ids = getFieldString(subdata.value, "b_ywno"); - maindata.value.b_date = getDate(); - - const maindataChanges = diffData(maindata.value, maindataorg.value, "b_id", { isSingle: true }); - const subdataChanges = diffData(subdata.value, subdataorg.value, "subid"); - if (!maindataChanges.hasChanges && !subdataChanges.hasChanges) { - return; - } - - const requestData = [ - { - tableName: "cw_invoice", - keyField: "b_id", - inserts: maindataChanges.insertdata, - updates: [], - deletes: [], - }, - { - tableName: "cw_invoicesub", - keyField: "subid", - inserts: subdataChanges.insertdata, - updates: [], - deletes: [], - }, - ]; - - await saveobjtV5Api(requestData); - - // 保存成功,开始核销,异常交给外部自己处理 - const feeids = subdata.value - .map((item) => item.mx_fee_id) - .filter(Boolean) - .join(","); - - const params = { - b_id: maindata.value.b_id, - fee_ids: feeids, - }; - - try { - const response = await axios.post("fee/invoiceconfirm", params); - - if (response.data.success === true) { - ElMessage.success(response.data.message || "核销成功"); - } else { - ElMessage.warning(response.data.message || "核销失败"); - } - } catch (error) { - ElMessage.error("请求失败:" + error.message); - } - - router.push({ - name: type === "应收" ? "ysdetailinvoice" : "yfdetailinvoice", - query: { - id: mainid, - op: "mod", - }, - }); -} - -// 收付单 -export async function generateSfd_old(subids, type) { - if (!Array.isArray(subids) || subids.length === 0) { - throw new Error("请选择操作行"); - } - - const userStore = useUserStore(); - - const sqlcondition = `AND subid IN (${subids.map((id) => `'${id}'`).join(",")})`; - - const mappingid = type === "应收" ? "cwtoskd" : "cwtofkd"; - const viewname_main = type === "应收" ? "v_cw_skd" : "v_cw_fkd"; - const viewname_sub = type === "应收" ? "v_cw_skdsub" : "v_cw_fkdsub"; - - const maindata = ref({}); - const maindataorg = ref({}); - const subdata = ref([]); - const subdataorg = ref([]); - - await handleMappingConfig(mappingid, sqlcondition, subdata); - - if (subdata.value.length === 0) { - throw new Error("无有效数据"); - } - - // 不同币种 不同结算单位 - const tmpdwid = subdata.value[0].mx_dw_id || ""; - const moneyid = subdata.value[0].mx_moneytype_id || ""; - - for (const row of subdata.value) { - if ((row.mx_dw_id || "") !== tmpdwid) { - throw new Error("结算单位不一致,请检查!"); - } - // if ((row.mx_moneytype_id || "") !== moneyid) { - // throw new Error("币种不一致,请检查!"); - // } - } - - await getDefaultValue(maindata, viewname_main); - - const mainid = await getSFId(); - - maindata.value = { - ...maindata.value, - b_id: mainid, - b_state: "草拟", - b_module_id: type === "应收" ? "实收" : "实付", - }; - - for (const [index, item] of subdata.value.entries()) { - const subid = await getSFId(); - - item.subid = subid; - item.mx_xh = index; - item.father = maindata.value.b_id; - } - - const first = subdata.value[0]; - maindata.value.v_dw_name = first.mx_dw_name; - maindata.value.b_dw_id = first.mx_dw_id; - maindata.value.b_money_id = first.mx_fee_money_id; - maindata.value.b_exrate = await getMoneyExRate({ - rows: subdata.value, - }); - - // let amount = math.add(...subdata.value.map((row) => row.mx_sfd_totalamount_not || 0)).toFixed(3); - - // maindata.value.b_amount_sj = amount; - // maindata.value.b_amount_hx = amount; - // maindata.value.b_amount = amount; - - maindata.value.b_amount_sj = 0; - maindata.value.b_amount_hx = 0; - maindata.value.b_amount = 0; - maindata.value.b_amount_nothx = 0; - - maindata.value.b_date = getDate(); - - maindata.value.b_yw_ids = getFieldString(subdata.value, "b_ywno"); - maindata.value.b_bill_ids = getFieldString(subdata.value, "mx_bill_ywno"); - maindata.value.b_inv_ids = getFieldString(subdata.value, "mx_invoice_ywno"); - - const maindataChanges = diffData(maindata.value, maindataorg.value, "b_id", { isSingle: true }); - const subdataChanges = diffData(subdata.value, subdataorg.value, "subid"); - if (!maindataChanges.hasChanges && !subdataChanges.hasChanges) { - return; - } - - const requestData = [ - { - tableName: "cw_sfd", - keyField: "b_id", - inserts: maindataChanges.insertdata, - updates: [], - deletes: [], - }, - { - tableName: "cw_sfdsub", - keyField: "subid", - inserts: subdataChanges.insertdata, - updates: [], - deletes: [], - }, - ]; - - await saveobjtV5Api(requestData); - - // 保存成功,开始核销,异常交给外部自己处理 - const feeids = subdata.value - .map((item) => item.mx_fee_id) - .filter(Boolean) - .join(","); - - const params = { - b_id: maindata.value.b_id, - fee_ids: feeids, - }; - - try { - const response = await axios.post("fee/feewriteoffbatch", params); - - if (response.data.success === true) { - ElMessage.success(response.data.message || "核销成功"); - } else { - ElMessage.warning(response.data.message || "核销失败"); - } - } catch (error) { - ElMessage.error("请求失败:" + error.message); - } - - router.push({ - name: type === "应收" ? "ysdetailskd" : "yfdetailfkd", - query: { - id: mainid, - op: "mod", - }, - }); -} - -export async function generateSfd(subids, configid) { - if (!Array.isArray(subids) || subids.length === 0) { - throw new Error("请选择操作行"); - } - - if (!configid) { - throw new Error("请传入有效数据"); - } - - const configs = await loaddataApi("s_module_config", `b_id = '${configid}'`); - if (configs.length === 0) { - throw new Error("配置无效,请检查配置!"); - } - - const moduleConfig = configs[0]; - - const sqlcondition = `AND subid IN (${subids.map((id) => `'${id}'`).join(",")})`; - - const mappingid = moduleConfig.b_mapid; - const viewname_main = moduleConfig.b_viewtable; - - const maindata = ref({}); - const maindataorg = ref({}); - const subdata = ref([]); - const subdataorg = ref([]); - - await handleMappingConfig(mappingid, sqlcondition, subdata); - - if (subdata.value.length === 0) { - throw new Error("无有效数据"); - } - - // 不同币种 不同结算单位 - const tmpdwid = subdata.value[0].mx_dw_id || ""; - - for (const row of subdata.value) { - if ((row.mx_dw_id || "") !== tmpdwid) { - throw new Error("结算单位不一致,请检查!"); - } - } - - await getDefaultValue(maindata, viewname_main); - - const mainid = await getSFId(); - const type = moduleConfig.b_cwtype; - - maindata.value = { - ...maindata.value, - b_id: mainid, - b_state: "草拟", - b_cwtype: type, - b_module_id: moduleConfig.b_moduleid, - }; - - for (const [index, item] of subdata.value.entries()) { - const subid = await getSFId(); - - item.subid = subid; - item.mx_xh = index; - item.father = maindata.value.b_id; - } - - const first = subdata.value[0]; - maindata.value.v_dw_name = first.mx_dw_name; - maindata.value.b_dw_id = first.mx_dw_id; - maindata.value.b_money_id = first.mx_fee_money_id; - maindata.value.b_exrate = await getMoneyExRate({ - rows: subdata.value, - }); - - // let amount = math.add(...subdata.value.map((row) => row.mx_sfd_totalamount_not || 0)).toFixed(3); - - // maindata.value.b_amount_sj = amount; - // maindata.value.b_amount_hx = amount; - // maindata.value.b_amount = amount; - - maindata.value.b_amount_sj = 0; - maindata.value.b_amount_hx = 0; - maindata.value.b_amount = 0; - maindata.value.b_amount_nothx = 0; - - maindata.value.b_date = getDate(); - - maindata.value.b_yw_ids = getFieldString(subdata.value, "b_ywno"); - maindata.value.b_bill_ids = getFieldString(subdata.value, "mx_bill_ywno"); - maindata.value.b_inv_ids = getFieldString(subdata.value, "mx_invoice_ywno"); - - const maindataChanges = diffData(maindata.value, maindataorg.value, "b_id", { isSingle: true }); - const subdataChanges = diffData(subdata.value, subdataorg.value, "subid"); - if (!maindataChanges.hasChanges && !subdataChanges.hasChanges) { - return; - } - - const requestData = [ - { - tableName: "cw_sfd", - keyField: "b_id", - inserts: maindataChanges.insertdata, - updates: [], - deletes: [], - }, - { - tableName: "cw_sfdsub", - keyField: "subid", - inserts: subdataChanges.insertdata, - updates: [], - deletes: [], - }, - ]; - - await saveobjtV5Api(requestData); - - // 保存成功,开始核销,异常交给外部自己处理 - const feeids = subdata.value - .map((item) => item.mx_fee_id) - .filter(Boolean) - .join(","); - - const params = { - b_id: maindata.value.b_id, - fee_ids: feeids, - }; - - try { - const response = await axios.post("fee/feewriteoffbatch", params); - - if (response.data.success === true) { - ElMessage.success(response.data.message || "核销成功"); - } else { - ElMessage.warning(response.data.message || "核销失败"); - } - } catch (error) { - ElMessage.error("请求失败:" + error.message); - } - - router.push({ - name: type === "应收" ? "ysdetailskd" : "yfdetailfkd", - query: { - id: mainid, - op: "mod", - }, - }); -} - -function showSaveResultMessage(response) { - const data = response.data?.data || {}; - const { insert, update, delete: del, insertBlocked, updateBlocked, deleteBlocked } = data; - - const totalSuccess = (insert || 0) + (update || 0) + (del || 0); - const totalBlocked = (insertBlocked || 0) + (updateBlocked || 0) + (deleteBlocked || 0); - - // 完全没有成功,也没有拦截(一般不会走到) - if (totalSuccess === 0 && totalBlocked === 0) { - ElMessage.info("没有数据发生变化"); - return; - } - - // ✅ 完全成功 - if (totalBlocked === 0) { - ElMessage.success(`保存成功(新增 ${insert || 0},更新 ${update || 0},删除 ${del || 0})`); - return; - } - - // ⚠️ 有拦截(重点) - let msg = "保存成功,但部分数据被业务规则拦截"; - - const parts = []; - if (insertBlocked > 0) parts.push(`新增 ${insertBlocked} 条`); - if (updateBlocked > 0) parts.push(`更新 ${updateBlocked} 条`); - if (deleteBlocked > 0) parts.push(`删除 ${deleteBlocked} 条`); - - msg += `(${parts.join(",")})`; - - // ✅ 用 warning 而不是 error - ElMessage.warning(msg); -} \ No newline at end of file diff --git a/code/新建文件夹/cw/components/link.vue b/code/新建文件夹/cw/components/link.vue deleted file mode 100644 index d087403b..00000000 --- a/code/新建文件夹/cw/components/link.vue +++ /dev/null @@ -1,234 +0,0 @@ - - - - - diff --git a/code/新建文件夹/cw/yf/detailbill.vue b/code/新建文件夹/cw/yf/detailbill.vue deleted file mode 100644 index 70ead130..00000000 --- a/code/新建文件夹/cw/yf/detailbill.vue +++ /dev/null @@ -1,1082 +0,0 @@ - - - - diff --git a/code/新建文件夹/cw/yf/detailfkd.vue b/code/新建文件夹/cw/yf/detailfkd.vue deleted file mode 100644 index a1b6542a..00000000 --- a/code/新建文件夹/cw/yf/detailfkd.vue +++ /dev/null @@ -1,1128 +0,0 @@ - - - - - diff --git a/code/新建文件夹/cw/yf/detailinvoice.vue b/code/新建文件夹/cw/yf/detailinvoice.vue deleted file mode 100644 index 425ca6a2..00000000 --- a/code/新建文件夹/cw/yf/detailinvoice.vue +++ /dev/null @@ -1,975 +0,0 @@ - - - - - \ No newline at end of file diff --git a/code/新建文件夹/cw/yf/list.vue b/code/新建文件夹/cw/yf/list.vue deleted file mode 100644 index 8d2c5758..00000000 --- a/code/新建文件夹/cw/yf/list.vue +++ /dev/null @@ -1,829 +0,0 @@ - - - - - \ No newline at end of file diff --git a/code/新建文件夹/cw/yf/listbill.vue b/code/新建文件夹/cw/yf/listbill.vue deleted file mode 100644 index 45b50634..00000000 --- a/code/新建文件夹/cw/yf/listbill.vue +++ /dev/null @@ -1,664 +0,0 @@ - - - - diff --git a/code/新建文件夹/cw/yf/listfkd.vue b/code/新建文件夹/cw/yf/listfkd.vue deleted file mode 100644 index 72527cc7..00000000 --- a/code/新建文件夹/cw/yf/listfkd.vue +++ /dev/null @@ -1,576 +0,0 @@ - - - - - \ No newline at end of file diff --git a/code/新建文件夹/cw/yf/listinvoice.vue b/code/新建文件夹/cw/yf/listinvoice.vue deleted file mode 100644 index 2386b498..00000000 --- a/code/新建文件夹/cw/yf/listinvoice.vue +++ /dev/null @@ -1,571 +0,0 @@ - - - - - diff --git a/code/新建文件夹/cw/ys/detailbill.vue b/code/新建文件夹/cw/ys/detailbill.vue deleted file mode 100644 index 38f02739..00000000 --- a/code/新建文件夹/cw/ys/detailbill.vue +++ /dev/null @@ -1,979 +0,0 @@ - - - - - \ No newline at end of file diff --git a/code/新建文件夹/cw/ys/detailinvoice.vue b/code/新建文件夹/cw/ys/detailinvoice.vue deleted file mode 100644 index bab14528..00000000 --- a/code/新建文件夹/cw/ys/detailinvoice.vue +++ /dev/null @@ -1,1002 +0,0 @@ - - - - \ No newline at end of file diff --git a/code/新建文件夹/cw/ys/detailskd.vue b/code/新建文件夹/cw/ys/detailskd.vue deleted file mode 100644 index fb5debd1..00000000 --- a/code/新建文件夹/cw/ys/detailskd.vue +++ /dev/null @@ -1,1126 +0,0 @@ - - - - \ No newline at end of file diff --git a/code/新建文件夹/cw/ys/list.vue b/code/新建文件夹/cw/ys/list.vue deleted file mode 100644 index cd989b5e..00000000 --- a/code/新建文件夹/cw/ys/list.vue +++ /dev/null @@ -1,826 +0,0 @@ - - - - - diff --git a/code/新建文件夹/cw/ys/listbill.vue b/code/新建文件夹/cw/ys/listbill.vue deleted file mode 100644 index 27b5f767..00000000 --- a/code/新建文件夹/cw/ys/listbill.vue +++ /dev/null @@ -1,542 +0,0 @@ - - - - diff --git a/code/新建文件夹/cw/ys/listinvoice.vue b/code/新建文件夹/cw/ys/listinvoice.vue deleted file mode 100644 index f590da7d..00000000 --- a/code/新建文件夹/cw/ys/listinvoice.vue +++ /dev/null @@ -1,568 +0,0 @@ - - - - - \ No newline at end of file diff --git a/code/新建文件夹/cw/ys/listskd.vue b/code/新建文件夹/cw/ys/listskd.vue deleted file mode 100644 index a0487e27..00000000 --- a/code/新建文件夹/cw/ys/listskd.vue +++ /dev/null @@ -1,576 +0,0 @@ - - - - - diff --git a/新建文本文档.txt b/新建文本文档.txt deleted file mode 100644 index ffe513dc..00000000 --- a/新建文本文档.txt +++ /dev/null @@ -1,36 +0,0 @@ -这些是我自己攒的 -https://freemodel.dev/invite/FRE-fabc2fbd -这个70 ,gpt5.5 - -https://api.denxio.top/register?invite_code=H746WUB6QZPF -这个送20 ,gpt5.5 贼耐用 - -https://api456.me/register?aff=t2Fk -这个送35 ,deepseek v4 pro claude gpt系列 - -https://api.fuka.win/register?aff=72wN -这个送150 ,gpt5.5 deepseek v4 pro - -https://api.gemai.cc/register?aff=kUn8 -这个送.200 ,gpt5.5 deepseek v4 pro - -https://api.bluesminds.com/register?aff=jqWd -这个送100 ,deepseek v4 pro - -https://api520.pro/register?aff=h5VS -这个注册送200,gpt5.5 - -https://ai-router.dev/register?aff=P6U645HT4RBA -这个注册送20,gpt5.5 - -https://monkeyapi.apimonkey.online/register?aff=xEAB -这个送100 ,gpt5.5 - -https://api.code-relay.com/register?aff=el8a -这个送20 ,gpt5.5 - -https://helpcoder.cc/register?aff=qWV9 -这个送200 ,gpt系列、 - - -sk-95bc4f401d8b499bbe073c828d176157 \ No newline at end of file