diff --git a/javascript/common/dev.js b/javascript/common/dev.js index 4fc86d7..c414c7a 100644 --- a/javascript/common/dev.js +++ b/javascript/common/dev.js @@ -149,6 +149,21 @@ WfForm.changeFieldValue = function (fieldMark, valueInfo) { WfForm.getBrowserShowName = function (fieldMark, splitChar) { } +/** + * 获取明细行所有行标示 + * @param detailMark + */ +WfForm.getDetailAllRowIndexStr = function (detailMark) { + // 遍历明细行的写法 + // var rowArr = WfForm.getDetailAllRowIndexStr("detail_1").split(","); + // for(var i=0; i { /* ******************* apa(employee)流程明细分数控制end ******************* */ -const workflowInsertValueConfig = [ - { - table: '', - targetTable: '', - filedMapping: [{ - source: '', - target: '' - }] - }, { - table: '', - targetTable: '', - filedMapping: [] - } -] - /* ******************* 流程明细数据整合插入start ******************* */ +$(() => { + const workflowInsertValueConfig = [ + { + table: '', + targetTable: '', + filedMapping: [{ + source: '', + target: '' + }] + }, { + table: '', + targetTable: '', + filedMapping: [] + } + ] + + (function start() { + let mappingResult = [] + workflowInsertValueConfig.forEach(item => { + let valueMapping = getDetailValueMapping(item) + mappingResult = [...mappingResult, ...valueMapping] + }) + })() + + function setValue() { + + } + + function getDetailValueMapping(configItem) { + let detailIdsStr = WfForm.getDetailAllRowIndexStr(configItem.table); + let detailIdArr = detailIdsStr.split(",") + let result = [] + for (let i = 0; i < detailIdArr.length; i++) { + let fieldValueMapping = getValueByConfig(configItem.filedMapping, configItem.table, i) + result.push(fieldValueMapping) + } + return result + } + + function getValueByConfig(fieldMapping, tableName, detailIndex) { + let result = [] + fieldMapping.forEach(item => { + let fieldValue = Utils.getFiledValueByName({ + fieldName: item.source, + TableName: tableName + }, detailIndex) + result.push({ + targetField: item.target, + value: fieldValue + }) + }) + return result + } + + +}) /* ******************* 流程明细数据整合插入end ******************* */ diff --git a/view-mysql.sql b/view-mysql.sql new file mode 100644 index 0000000..a74ea14 --- /dev/null +++ b/view-mysql.sql @@ -0,0 +1,84 @@ +-- 流程类型视图,可用于数据集成或流览按钮 +create + or replace view workflow_type_info_view as +select wb.id, + wb.workflowname, + wt.typename, + wb.workflowdesc, + (IF(wb.version is null, 1, wb.version)) version +from workflow_base wb + RIGHT JOIN workflow_type wt on wb.workflowtype = wt.id; + +-- 流程表单视图,用于流览按钮或数据集成,配置流程类型表可以用字段联动获取流程表表名 +create + or replace view workflow_table_view as +select base.id, + base.workflowname, + base.formid, + bill.tablename, + (IF(base.version is null, 1, base.version)) version +from workflow_bill bill + join workflow_base base on base.formid = bill.id; + +-- 流程明细表信息,可用流程主表查询对应的明细表信息,用于流览框 +create + or replace view workflow_detail_table_view as +select CONCAT(bill.id, '-', base.id) id, + bill.id bill_id, + base.id workflow_id, + base.workflowname, + base.formid main_formid, + bill.tablename +from workflow_billdetailtable bill + join workflow_base base on base.formid = bill.billid; + +-- 流程和建模字段视图,更具流程和建模的billid可以查询流程和建模中的字段信息 +create + or replace view workflow_field_table_view as +select wb.id, + wb.fieldname, + concat(ht.indexdesc, ':', wb.fieldname) indexdesc, + ( + case + when wb.detailtable is null then (select distinct tablename from workflow_bill where id = wb.billid) + when wb.detailtable = '' + then (select distinct tablename from workflow_bill where id = wb.billid) + else wb.detailtable + end + ) tablename, + billid, + ( + case + when wb.detailtable = '' then 'main table' + when wb.detailtable is null then 'main table' + else wb.detailtable end + ) showtablename, + (case + when wb.fieldhtmltype = '1' then '单行文本框' + when wb.FIELDHTMLTYPE = '2' then '多行文本框' + when wb.FIELDHTMLTYPE = '3' then '流览框' + when wb.FIELDHTMLTYPE = '4' then 'check框' + when wb.FIELDHTMLTYPE = '5' then '选择框' + else '附件上传' end) fieldhtmltype +from workflow_billfield wb + left join htmllabelindex ht on wb.fieldlabel = ht.id; + +-- 建模表信息视图 +create + or replace view mode_bill_info_view as +select bill.id, bill.tablename, hti.indexdesc +from workflow_bill bill + left join htmllabelindex hti on hti.id = bill.namelabel +where bill.id < 0 + and bill.tablename like 'uf%'; + +-- 流程节点信息视图 +create + or replace view workflow_node_info_view as +select distinct nb.id, + nb.nodename, + (case when wb.version is null then 1 else wb.version end) version, + fn.workflowid +from workflow_nodebase nb + left join workflow_flownode fn on nb.id = fn.nodeid + left join workflow_base wb on wb.id = fn.workflowid; diff --git a/view-oracle.sql b/view-oracle.sql new file mode 100644 index 0000000..5684967 --- /dev/null +++ b/view-oracle.sql @@ -0,0 +1,90 @@ +-- 流程类型视图,可用于数据集成或流览按钮 +create + or replace view workflow_type_info_view as +select wb.id, + wb.workflowname, + wt.typename, + wb.workflowdesc, + (case when wb.version is null then 1 else wb.version end) version +from workflow_base wb + RIGHT JOIN workflow_type wt on wb.workflowtype = wt.id +/ + +-- 流程表单视图,用于流览按钮或数据集成,配置流程类型表可以用字段联动获取流程表表名 +create + or replace view workflow_table_view as +select base.id, + base.workflowname, + base.formid, + bill.tablename, + (case when base.version is null then 1 else base.version end) version +from workflow_bill bill + join workflow_base base on base.formid = bill.id +/ + +-- 流程明细表信息,可用流程主表查询对应的明细表信息,用于流览框 +create + or replace view workflow_detail_table_view as +select (bill.id || '-' || base.id) id, + bill.id bill_id, + base.id workflow_id, + base.workflowname, + base.formid main_formid, + bill.tablename +from workflow_billdetailtable bill + join workflow_base base on base.formid = bill.billid +/ + +-- 流程和建模字段视图,更具流程和建模的billid可以查询流程和建模中的字段信息 +create + or replace view workflow_field_table_view as +select wb.id, + wb.fieldname, + (ht.indexdesc || ':' || wb.fieldname) indexdesc, + ( + case + when wb.detailtable is null then (select distinct tablename from workflow_bill where id = wb.billid) + when wb.detailtable = '' + then (select distinct tablename from workflow_bill where id = wb.billid) + else wb.detailtable + end + ) tablename, + billid, + ( + case + when wb.detailtable = '' then 'main table' + when wb.detailtable is null then 'main table' + else wb.detailtable end + ) showtablename, + (case + when wb.fieldhtmltype = '1' then '单行文本框' + when wb.FIELDHTMLTYPE = '2' then '多行文本框' + when wb.FIELDHTMLTYPE = '3' then '流览框' + when wb.FIELDHTMLTYPE = '4' then 'check框' + when wb.FIELDHTMLTYPE = '5' then '选择框' + else '附件上传' end) fieldhtmltype +from workflow_billfield wb + left join htmllabelindex ht on wb.fieldlabel = ht.id +/ + +-- 建模表信息视图 +create + or replace view mode_bill_info_view as +select bill.id, bill.tablename, hti.indexdesc +from workflow_bill bill + left join htmllabelindex hti on hti.id = bill.namelabel +where bill.id < 0 + and bill.tablename like 'uf%' +/ + +-- 流程节点信息视图 +create + or replace view workflow_node_info_view as +select distinct nb.id, + nb.nodename, + (case when wb.version is null then 1 else wb.version end) version, + fn.workflowid +from workflow_nodebase nb + left join workflow_flownode fn on nb.id = fn.nodeid + left join workflow_base wb on wb.id = fn.workflowid +/ diff --git a/view-sql-server.sql b/view-sql-server.sql new file mode 100644 index 0000000..8bf2a25 --- /dev/null +++ b/view-sql-server.sql @@ -0,0 +1,103 @@ +-- 流程类型视图,可用于数据集成或流览按钮 +if exists (select * from sysobjects where name = 'workflow_type_info_view') +drop view workflow_type_info_view +go +create view workflow_type_info_view as +select wb.id, + wb.workflowname, + wt.typename, + wb.workflowdesc, + (IIF(wb.version is null, 1, wb.version)) version +from workflow_base wb + RIGHT JOIN workflow_type wt on wb.workflowtype = wt.id +go + + +-- 流程表单视图,用于流览按钮或数据集成,配置流程类型表可以用字段联动获取流程表表名 +if exists (select * from sysobjects where name = 'workflow_table_view') + drop view workflow_table_view +go +create view workflow_table_view as +select base.id, + base.workflowname, + base.formid, + bill.tablename, + (IIF(base.version is null, 1, base.version)) version +from workflow_bill bill + join workflow_base base on base.formid = bill.id +go + +-- 流程明细表信息,可用流程主表查询对应的明细表信息,用于流览框 +if exists (select * from sysobjects where name = 'workflow_detail_table_view') + drop view workflow_detail_table_view +go +create view workflow_detail_table_view as +select (bill.id + '-' + base.id) id, + bill.id bill_id, + base.id workflow_id, + base.workflowname, + base.formid main_formid, + bill.tablename +from workflow_billdetailtable bill + join workflow_base base on base.formid = bill.billid +go + +-- 流程和建模字段视图,更具流程和建模的billid可以查询流程和建模中的字段信息 +if exists (select * from sysobjects where name = 'workflow_field_table_view') + drop view workflow_field_table_view +go +create view workflow_field_table_view as +select wb.id, + wb.fieldname, + (ht.indexdesc + ':' + wb.fieldname) indexdesc, + ( + case + when wb.detailtable is null then (select distinct tablename from workflow_bill where id = wb.billid) + when wb.detailtable = '' + then (select distinct tablename from workflow_bill where id = wb.billid) + else wb.detailtable + end + ) tablename, + billid, + ( + case + when wb.detailtable = '' then 'main table' + when wb.detailtable is null then 'main table' + else wb.detailtable end + ) showtablename, + (case + when wb.fieldhtmltype = '1' then '单行文本框' + when wb.FIELDHTMLTYPE = '2' then '多行文本框' + when wb.FIELDHTMLTYPE = '3' then '流览框' + when wb.FIELDHTMLTYPE = '4' then 'check框' + when wb.FIELDHTMLTYPE = '5' then '选择框' + else '附件上传' end) fieldhtmltype +from workflow_billfield wb + left join htmllabelindex ht on wb.fieldlabel = ht.id +go + +-- 建模表信息视图 +if exists (select * from sysobjects where name = 'mode_bill_info_view') + drop view mode_bill_info_view +go +create view mode_bill_info_view as +select bill.id, bill.tablename, hti.indexdesc +from workflow_bill bill + left join htmllabelindex hti on hti.id = bill.namelabel +where bill.id < 0 + and bill.tablename like 'uf%' +go + +-- 流程节点信息视图 +if exists (select * from sysobjects where name = 'workflow_node_info_view') + drop view workflow_node_info_view +go +create view workflow_node_info_view as +select distinct nb.id, + nb.nodename, + (case when wb.version is null then 1 else wb.version end) version, + fn.workflowid +from workflow_nodebase nb + left join workflow_flownode fn on nb.id = fn.nodeid + left join workflow_base wb on wb.id = fn.workflowid +go