diff --git a/json/supplier_resource_price_list.json b/json/supplier_resource_price_list.json new file mode 100644 index 0000000..74460e4 --- /dev/null +++ b/json/supplier_resource_price_list.json @@ -0,0 +1,10 @@ +{ + "supplier_resource_price": { + "params": { + "supplier_org_id": {"type": "str"}, + "resource_type": {"type": "str"}, + "resource_ref_id": {"type": "str"}, + "status": {"type": "str"} + } + } +} diff --git a/models/mysql.ddl.sql b/models/mysql.ddl.sql index 410d8d4..81c7e5c 100644 --- a/models/mysql.ddl.sql +++ b/models/mysql.ddl.sql @@ -529,3 +529,37 @@ CREATE INDEX supply_contracts_idx_sc_reseller ON supply_contracts(resellerid); CREATE INDEX supply_contracts_idx_sc_supplier ON supply_contracts(supplier_id); CREATE UNIQUE INDEX supply_contracts_idx_sc_code ON supply_contracts(resellerid,contract_code); +-- ./supplier_resource_price.json + +drop table if exists supplier_resource_price; +CREATE TABLE supplier_resource_price +( + `id` VARCHAR(32) NOT NULL comment '主键ID', + `supplier_org_id` VARCHAR(32) NOT NULL comment '供应商机构ID', + `resource_type` VARCHAR(32) NOT NULL comment '资源类型', + `resource_ref_id` VARCHAR(32) NOT NULL comment '资源引用ID', + `resource_ref_name` VARCHAR(255) comment '资源名称', + `unit_price` double(15,8) DEFAULT '0' comment '统一单价', + `price_unit` VARCHAR(32) NOT NULL comment '价格单位', + `input_price` double(15,8) comment '输入单价(LLM专用)', + `output_price` double(15,8) comment '输出单价(LLM专用)', + `currency` CHAR(8) DEFAULT 'CNY' comment '货币', + `effective_date` date NOT NULL comment '生效日期', + `expiry_date` date comment '失效日期', + `status` CHAR(1) DEFAULT '1' comment '状态', + `created_at` datetime NOT NULL comment '创建时间', + `updated_at` datetime comment '更新时间' + ,primary key(id) +) +CHARACTER SET utf8mb4 +COLLATE utf8mb4_unicode_ci +engine=innodb +comment '供应商资源定价表' +; + +CREATE INDEX supplier_resource_price_idx_srp_supplier ON supplier_resource_price(supplier_org_id); +CREATE INDEX supplier_resource_price_idx_srp_resource ON supplier_resource_price(resource_type,resource_ref_id); +CREATE INDEX supplier_resource_price_idx_srp_dates ON supplier_resource_price(effective_date,expiry_date); +CREATE INDEX supplier_resource_price_idx_srp_status ON supplier_resource_price(status); +CREATE UNIQUE INDEX supplier_resource_price_idx_srp_unique ON supplier_resource_price(supplier_org_id,resource_type,resource_ref_id,effective_date); + diff --git a/models/supplier_resource_price.json b/models/supplier_resource_price.json new file mode 100644 index 0000000..80d15cf --- /dev/null +++ b/models/supplier_resource_price.json @@ -0,0 +1,63 @@ +{ + "summary": [ + { + "name": "supplier_resource_price", + "title": "供应商资源定价表", + "primary": ["id"], + "catelog": "entity" + } + ], + "fields": [ + {"name": "id", "title": "主键ID", "type": "str", "length": 32, "nullable": "no"}, + {"name": "supplier_org_id", "title": "供应商机构ID", "type": "str", "length": 32, "nullable": "no"}, + {"name": "resource_type", "title": "资源类型", "type": "str", "length": 32, "nullable": "no"}, + {"name": "resource_ref_id", "title": "资源引用ID", "type": "str", "length": 32, "nullable": "no"}, + {"name": "resource_ref_name", "title": "资源名称", "type": "str", "length": 255}, + {"name": "unit_price", "title": "统一单价", "type": "double", "length": 15, "dec": 8, "default": "0"}, + {"name": "price_unit", "title": "价格单位", "type": "str", "length": 32, "nullable": "no"}, + {"name": "input_price", "title": "输入单价(LLM专用)", "type": "double", "length": 15, "dec": 8}, + {"name": "output_price", "title": "输出单价(LLM专用)", "type": "double", "length": 15, "dec": 8}, + {"name": "currency", "title": "货币", "type": "char", "length": 8, "default": "CNY"}, + {"name": "effective_date", "title": "生效日期", "type": "date", "nullable": "no"}, + {"name": "expiry_date", "title": "失效日期", "type": "date"}, + {"name": "status", "title": "状态", "type": "char", "length": 1, "default": "1"}, + {"name": "created_at", "title": "创建时间", "type": "datetime", "nullable": "no"}, + {"name": "updated_at", "title": "更新时间", "type": "datetime"} + ], + "indexes": [ + {"name": "idx_srp_supplier", "idxtype": "index", "idxfields": ["supplier_org_id"]}, + {"name": "idx_srp_resource", "idxtype": "index", "idxfields": ["resource_type", "resource_ref_id"]}, + {"name": "idx_srp_dates", "idxtype": "index", "idxfields": ["effective_date", "expiry_date"]}, + {"name": "idx_srp_status", "idxtype": "index", "idxfields": ["status"]}, + {"name": "idx_srp_unique", "idxtype": "unique", "idxfields": ["supplier_org_id", "resource_type", "resource_ref_id", "effective_date"]} + ], + "codes": [ + { + "field": "supplier_org_id", + "table": "suppliers", + "valuefield": "org_id", + "textfield": "supplier_name" + }, + { + "field": "resource_type", + "table": "product_management.appcodes_kv", + "valuefield": "k", + "textfield": "v", + "cond": "parentid='resource_type'" + }, + { + "field": "price_unit", + "table": "product_management.appcodes_kv", + "valuefield": "k", + "textfield": "v", + "cond": "parentid='price_unit'" + }, + { + "field": "status", + "table": "product_management.appcodes_kv", + "valuefield": "k", + "textfield": "v", + "cond": "parentid='product_status'" + } + ] +} diff --git a/scripts/load_path.py b/scripts/load_path.py index 363605d..6730280 100755 --- a/scripts/load_path.py +++ b/scripts/load_path.py @@ -61,6 +61,7 @@ PATHS_ANY = [ "/supplychain/platform_supply_relations_list", "/supplychain/platform_supply_products_list", "/supplychain/product_supplier_mapping_list", + "/supplychain/supplier_resource_price_list", ] # logined — 需要认证的页面和 API @@ -206,6 +207,13 @@ PATHS_OPERATOR = [ "/supplychain/api/query_platform_suppliers.dspy", "/supplychain/api/query_platform_products.dspy", "/supplychain/api/import_supplier_product.dspy", + # Supplier resource pricing (operator manages) + "/supplychain/supplier_resource_price_list", + "/supplychain/supplier_resource_price_list/index.ui", + "/supplychain/supplier_resource_price_list/get_supplier_resource_price.dspy", + "/supplychain/supplier_resource_price_list/add_supplier_resource_price.dspy", + "/supplychain/supplier_resource_price_list/update_supplier_resource_price.dspy", + "/supplychain/supplier_resource_price_list/delete_supplier_resource_price.dspy", ] PATHS_SALE = [ diff --git a/wwwroot/distribution_agreement_items_list/index.ui b/wwwroot/distribution_agreement_items_list/index.ui index f846c84..b7ee137 100644 --- a/wwwroot/distribution_agreement_items_list/index.ui +++ b/wwwroot/distribution_agreement_items_list/index.ui @@ -7,7 +7,7 @@ "widgettype":"Tabular", "options":{ "width":"100%", - "height":"100%", + "cheight":40, "title":"分销协议产品折扣明细表", diff --git a/wwwroot/distribution_agreements_list/index.ui b/wwwroot/distribution_agreements_list/index.ui index f6ee51e..e57d996 100644 --- a/wwwroot/distribution_agreements_list/index.ui +++ b/wwwroot/distribution_agreements_list/index.ui @@ -7,7 +7,7 @@ "widgettype":"Tabular", "options":{ "width":"100%", - "height":"100%", + "cheight":40, "title":"分销协议表", diff --git a/wwwroot/platform_supply_products_list/index.ui b/wwwroot/platform_supply_products_list/index.ui index af6c286..e420548 100644 --- a/wwwroot/platform_supply_products_list/index.ui +++ b/wwwroot/platform_supply_products_list/index.ui @@ -7,7 +7,7 @@ "widgettype":"Tabular", "options":{ "width":"100%", - "height":"100%", + "cheight":40, "title":"平台供销产品明细表", diff --git a/wwwroot/platform_supply_relations_list/index.ui b/wwwroot/platform_supply_relations_list/index.ui index a8560d2..2799732 100644 --- a/wwwroot/platform_supply_relations_list/index.ui +++ b/wwwroot/platform_supply_relations_list/index.ui @@ -7,7 +7,7 @@ "widgettype":"Tabular", "options":{ "width":"100%", - "height":"100%", + "cheight":40, "title":"平台内供销关系表", diff --git a/wwwroot/product_supplier_mapping_list/index.ui b/wwwroot/product_supplier_mapping_list/index.ui index 9a60ced..fbeb352 100644 --- a/wwwroot/product_supplier_mapping_list/index.ui +++ b/wwwroot/product_supplier_mapping_list/index.ui @@ -7,7 +7,7 @@ "widgettype":"Tabular", "options":{ "width":"100%", - "height":"100%", + "cheight":40, "title":"产品供应映射表", diff --git a/wwwroot/sales_ledger_list/index.ui b/wwwroot/sales_ledger_list/index.ui index 4ebbcfe..3887c8c 100644 --- a/wwwroot/sales_ledger_list/index.ui +++ b/wwwroot/sales_ledger_list/index.ui @@ -7,7 +7,7 @@ "widgettype":"Tabular", "options":{ "width":"100%", - "height":"100%", + "cheight":40, "title":"销售记账表", diff --git a/wwwroot/sub_distributors_list/index.ui b/wwwroot/sub_distributors_list/index.ui index 61ab97f..b069a1a 100644 --- a/wwwroot/sub_distributors_list/index.ui +++ b/wwwroot/sub_distributors_list/index.ui @@ -7,7 +7,7 @@ "widgettype":"Tabular", "options":{ "width":"100%", - "height":"100%", + "cheight":40, "title":"二级分销商表", diff --git a/wwwroot/sub_resellers_list/index.ui b/wwwroot/sub_resellers_list/index.ui index 69f3905..fbcd406 100644 --- a/wwwroot/sub_resellers_list/index.ui +++ b/wwwroot/sub_resellers_list/index.ui @@ -7,7 +7,7 @@ "widgettype":"Tabular", "options":{ "width":"100%", - "height":"100%", + "cheight":40, "title":"二级分销商表", diff --git a/wwwroot/supplier_resource_price_list/index.ui b/wwwroot/supplier_resource_price_list/index.ui new file mode 100644 index 0000000..3a2de69 --- /dev/null +++ b/wwwroot/supplier_resource_price_list/index.ui @@ -0,0 +1,73 @@ +{ + "widgettype": "VBox", + "options": {"width": "100%", "padding": "8px", "gap": "8px"}, + "subwidgets": [ + { + "widgettype": "InlineForm", + "id": "price_filter", + "options": { + "css": "card", "padding": "8px", "submit_label": "查询", + "fields": [ + {"name": "supplier_org_id", "label": "供应商", "uitype": "str", "cwidth": 12}, + {"name": "resource_type", "label": "资源类型", "uitype": "code", "cwidth": 10, + "data": [{"value": "", "text": "全部"}, {"value": "llm_model", "text": "大模型按量"}, {"value": "llm_monthly", "text": "大模型包月"}, {"value": "compute", "text": "算力"}]}, + {"name": "status", "label": "状态", "uitype": "code", "cwidth": 8, + "data": [{"value": "", "text": "全部"}, {"value": "1", "text": "有效"}, {"value": "0", "text": "无效"}]} + ] + }, + "binds": [{ + "wid": "self", "event": "submit", + "actiontype": "script", "target": "price_table", + "script": "var tbl = bricks.getWidgetById('price_table', bricks.app.root); if(tbl) await tbl.render(params);" + }] + }, + { + "widgettype": "Tabular", + "id": "price_table", + "options": { + "width": "100%", "css": "card", + "data_url": "{{entire_url('/supplychain/supplier_resource_price_list/get_supplier_resource_price.dspy')}}", + "data_method": "GET", "page_rows": 20, + "toolbar": { + "tools": [ + {"name": "add_price", "label": "新增定价"} + ] + }, + "row_options": { + "browserfields": { + "exclouded": ["id", "created_at", "updated_at"], + "alters": { + "supplier_org_id": { + "uitype": "code", "valueField": "supplier_org_id", "textField": "supplier_org_id_text", + "params": {"dbname": "supplychain", "table": "suppliers", "tblvalue": "org_id", "tbltext": "supplier_name", "valueField": "supplier_org_id", "textField": "supplier_org_id_text"}, + "dataurl": "{{entire_url('/appbase/get_code.dspy')}}" + }, + "resource_type": {"uitype": "code", "data": [{"value": "llm_model", "text": "大模型按量"}, {"value": "llm_monthly", "text": "大模型包月"}, {"value": "compute", "text": "算力"}]}, + "price_unit": {"uitype": "code", "data": [{"value": "per_1k_tokens", "text": "每千tokens"}, {"value": "per_request", "text": "每次"}, {"value": "per_gpu_hour", "text": "每GPU时"}]}, + "status": {"uitype": "code", "data": [{"value": "1", "text": "有效"}, {"value": "0", "text": "无效"}]} + } + }, + "fields": [ + {"name": "supplier_org_id", "title": "供应商", "type": "str", "length": 32, "cwidth": 14}, + {"name": "resource_type", "title": "资源类型", "type": "str", "length": 32, "cwidth": 10}, + {"name": "resource_ref_id", "title": "资源ID", "type": "str", "length": 32, "cwidth": 12}, + {"name": "resource_ref_name", "title": "资源名称", "type": "str", "length": 255, "cwidth": 12}, + {"name": "unit_price", "title": "统一单价", "type": "double", "length": 15, "dec": 8, "cwidth": 10}, + {"name": "input_price", "title": "输入价", "type": "double", "length": 15, "dec": 8, "cwidth": 10}, + {"name": "output_price", "title": "输出价", "type": "double", "length": 15, "dec": 8, "cwidth": 10}, + {"name": "price_unit", "title": "单位", "type": "str", "length": 32, "cwidth": 8}, + {"name": "effective_date", "title": "生效日", "type": "date", "cwidth": 10}, + {"name": "expiry_date", "title": "失效日", "type": "date", "cwidth": 10}, + {"name": "status", "title": "状态", "type": "char", "length": 1, "cwidth": 6} + ] + } + }, + "binds": [{ + "wid": "self", "event": "add_price", + "actiontype": "urlwidget", "target": "PopupWindow", + "popup_options": {"title": "新增定价", "cwidth": 45, "cheight": 28}, + "options": {"url": "{{entire_url('/supplychain/supplier_resource_price_list/add_supplier_resource_price.dspy')}}"} + }] + } + ] +} diff --git a/wwwroot/suppliers_list/index.ui b/wwwroot/suppliers_list/index.ui index 07eb52d..a128792 100644 --- a/wwwroot/suppliers_list/index.ui +++ b/wwwroot/suppliers_list/index.ui @@ -7,7 +7,7 @@ "widgettype":"Tabular", "options":{ "width":"100%", - "height":"100%", + "cheight":40, "title":"供应商表", diff --git a/wwwroot/supply_contract_items_list/index.ui b/wwwroot/supply_contract_items_list/index.ui index 94998eb..2f94907 100644 --- a/wwwroot/supply_contract_items_list/index.ui +++ b/wwwroot/supply_contract_items_list/index.ui @@ -7,7 +7,7 @@ "widgettype":"Tabular", "options":{ "width":"100%", - "height":"100%", + "cheight":40, "title":"供销合同产品折扣明细表", diff --git a/wwwroot/supply_contracts_list/index.ui b/wwwroot/supply_contracts_list/index.ui index c019a18..c7e32ed 100644 --- a/wwwroot/supply_contracts_list/index.ui +++ b/wwwroot/supply_contracts_list/index.ui @@ -7,7 +7,7 @@ "widgettype":"Tabular", "options":{ "width":"100%", - "height":"100%", + "cheight":40, "title":"供销合同表", diff --git a/wwwroot/supplychain_accounting_list/index.ui b/wwwroot/supplychain_accounting_list/index.ui index 7990640..3791d81 100644 --- a/wwwroot/supplychain_accounting_list/index.ui +++ b/wwwroot/supplychain_accounting_list/index.ui @@ -7,7 +7,7 @@ "widgettype":"Tabular", "options":{ "width":"100%", - "height":"100%", + "cheight":40, "title":"供销记账表",