From 7e6dd59b0c8a8559c677cc7a76c760388b91df51 Mon Sep 17 00:00:00 2001 From: Sea Date: Thu, 26 Dec 2024 15:50:08 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BD=8E=E4=BB=A3=E7=A0=81demo=E5=AD=98?= =?UTF-8?q?=E6=A1=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- babel.config.js | 9 +- src/views/HomeView.vue | 20 +- src/views/ddmDemo/Center.vue | 6 +- src/views/ddmDemo/Footer.vue | 4 +- src/views/ddmDemo/Header.vue | 9 +- src/views/ddmDemo/Index.vue | 353 +++++--------------- src/views/ddmDemo/Layout.vue | 5 +- src/views/ddmDemo/Panel.vue | 83 ++--- src/views/ddmDemo/component/FxForm/FxForm.vue | 29 ++ src/views/ddmDemo/component/FxForm/FxFormCard.vue | 76 +++++ .../ddmDemo/component/FxHeader/FxHeaderCard.vue | 73 +++++ src/views/ddmDemo/component/FxInput/FxInput.vue | 42 +++ src/views/ddmDemo/component/FxTable/FxTable.vue | 45 +++ .../ddmDemo/component/FxTable/FxTableCard.vue | 75 +++++ .../FxTable/FxTableColumn/FxTableColumn.vue | 28 ++ src/views/ddmDemo/component/fxButton/FxButton.vue | 42 +++ .../ddmDemo/component/fxDivider/FxDivider.vue | 38 +++ src/views/ddmDemo/component/fxSelect/FxSelect.vue | 68 ++++ src/views/ddmDemo/component/fxText/FxText.vue | 33 ++ src/views/ddmDemo/component/fxText/FxTextCard.vue | 17 + src/views/ddmDemo/component/fxTitle/FxTitle.css | 3 + src/views/ddmDemo/component/fxTitle/FxTitle.vue | 59 ++++ src/views/ddmDemo/component/toolbar/toobar.vue | 35 ++ src/views/ddmDemo/engine/pageEngine.ts | 0 src/views/ddmDemo/jsonData.js | 342 ++++++++++++++++++++ src/views/ddmDemo/jsonData2.js | 358 +++++++++++++++++++++ src/views/ddmDemo/study/hDemo.vue | 69 ++++ 27 files changed, 1604 insertions(+), 317 deletions(-) create mode 100644 src/views/ddmDemo/component/FxForm/FxForm.vue create mode 100644 src/views/ddmDemo/component/FxForm/FxFormCard.vue create mode 100644 src/views/ddmDemo/component/FxHeader/FxHeaderCard.vue create mode 100644 src/views/ddmDemo/component/FxInput/FxInput.vue create mode 100644 src/views/ddmDemo/component/FxTable/FxTable.vue create mode 100644 src/views/ddmDemo/component/FxTable/FxTableCard.vue create mode 100644 src/views/ddmDemo/component/FxTable/FxTableColumn/FxTableColumn.vue create mode 100644 src/views/ddmDemo/component/fxButton/FxButton.vue create mode 100644 src/views/ddmDemo/component/fxDivider/FxDivider.vue create mode 100644 src/views/ddmDemo/component/fxSelect/FxSelect.vue create mode 100644 src/views/ddmDemo/component/fxText/FxText.vue create mode 100644 src/views/ddmDemo/component/fxText/FxTextCard.vue create mode 100644 src/views/ddmDemo/component/fxTitle/FxTitle.css create mode 100644 src/views/ddmDemo/component/fxTitle/FxTitle.vue create mode 100644 src/views/ddmDemo/component/toolbar/toobar.vue create mode 100644 src/views/ddmDemo/engine/pageEngine.ts create mode 100644 src/views/ddmDemo/jsonData.js create mode 100644 src/views/ddmDemo/jsonData2.js create mode 100644 src/views/ddmDemo/study/hDemo.vue diff --git a/babel.config.js b/babel.config.js index c94e729..2c01bda 100644 --- a/babel.config.js +++ b/babel.config.js @@ -1,5 +1,8 @@ module.exports = { - presets: [ - '@vue/cli-plugin-babel/preset' - ] + presets: [ + '@vue/cli-plugin-babel/preset' + ], + plugins: [ + '@vue/babel-plugin-jsx' + ] } diff --git a/src/views/HomeView.vue b/src/views/HomeView.vue index 5048eb0..9a49984 100644 --- a/src/views/HomeView.vue +++ b/src/views/HomeView.vue @@ -66,6 +66,24 @@ diff --git a/src/views/ddmDemo/Index.vue b/src/views/ddmDemo/Index.vue index e30ddea..6b9b092 100644 --- a/src/views/ddmDemo/Index.vue +++ b/src/views/ddmDemo/Index.vue @@ -1,28 +1,25 @@ + + + + diff --git a/src/views/ddmDemo/component/FxForm/FxFormCard.vue b/src/views/ddmDemo/component/FxForm/FxFormCard.vue new file mode 100644 index 0000000..21d3d4f --- /dev/null +++ b/src/views/ddmDemo/component/FxForm/FxFormCard.vue @@ -0,0 +1,76 @@ + + + + + diff --git a/src/views/ddmDemo/component/FxHeader/FxHeaderCard.vue b/src/views/ddmDemo/component/FxHeader/FxHeaderCard.vue new file mode 100644 index 0000000..5c5d4c2 --- /dev/null +++ b/src/views/ddmDemo/component/FxHeader/FxHeaderCard.vue @@ -0,0 +1,73 @@ + + + + + diff --git a/src/views/ddmDemo/component/FxInput/FxInput.vue b/src/views/ddmDemo/component/FxInput/FxInput.vue new file mode 100644 index 0000000..90a0ff1 --- /dev/null +++ b/src/views/ddmDemo/component/FxInput/FxInput.vue @@ -0,0 +1,42 @@ + + + + + diff --git a/src/views/ddmDemo/component/FxTable/FxTable.vue b/src/views/ddmDemo/component/FxTable/FxTable.vue new file mode 100644 index 0000000..f5e6d7b --- /dev/null +++ b/src/views/ddmDemo/component/FxTable/FxTable.vue @@ -0,0 +1,45 @@ + + + + + diff --git a/src/views/ddmDemo/component/FxTable/FxTableCard.vue b/src/views/ddmDemo/component/FxTable/FxTableCard.vue new file mode 100644 index 0000000..bbda1ea --- /dev/null +++ b/src/views/ddmDemo/component/FxTable/FxTableCard.vue @@ -0,0 +1,75 @@ + + + + + diff --git a/src/views/ddmDemo/component/FxTable/FxTableColumn/FxTableColumn.vue b/src/views/ddmDemo/component/FxTable/FxTableColumn/FxTableColumn.vue new file mode 100644 index 0000000..d9acdd3 --- /dev/null +++ b/src/views/ddmDemo/component/FxTable/FxTableColumn/FxTableColumn.vue @@ -0,0 +1,28 @@ + + + + + diff --git a/src/views/ddmDemo/component/fxButton/FxButton.vue b/src/views/ddmDemo/component/fxButton/FxButton.vue new file mode 100644 index 0000000..ecd80d8 --- /dev/null +++ b/src/views/ddmDemo/component/fxButton/FxButton.vue @@ -0,0 +1,42 @@ + diff --git a/src/views/ddmDemo/component/fxDivider/FxDivider.vue b/src/views/ddmDemo/component/fxDivider/FxDivider.vue new file mode 100644 index 0000000..aa98948 --- /dev/null +++ b/src/views/ddmDemo/component/fxDivider/FxDivider.vue @@ -0,0 +1,38 @@ + + + + + diff --git a/src/views/ddmDemo/component/fxSelect/FxSelect.vue b/src/views/ddmDemo/component/fxSelect/FxSelect.vue new file mode 100644 index 0000000..dc69fcc --- /dev/null +++ b/src/views/ddmDemo/component/fxSelect/FxSelect.vue @@ -0,0 +1,68 @@ + diff --git a/src/views/ddmDemo/component/fxText/FxText.vue b/src/views/ddmDemo/component/fxText/FxText.vue new file mode 100644 index 0000000..1903b13 --- /dev/null +++ b/src/views/ddmDemo/component/fxText/FxText.vue @@ -0,0 +1,33 @@ + + diff --git a/src/views/ddmDemo/component/fxText/FxTextCard.vue b/src/views/ddmDemo/component/fxText/FxTextCard.vue new file mode 100644 index 0000000..6282c35 --- /dev/null +++ b/src/views/ddmDemo/component/fxText/FxTextCard.vue @@ -0,0 +1,17 @@ + + + + + diff --git a/src/views/ddmDemo/component/fxTitle/FxTitle.css b/src/views/ddmDemo/component/fxTitle/FxTitle.css new file mode 100644 index 0000000..0117ffd --- /dev/null +++ b/src/views/ddmDemo/component/fxTitle/FxTitle.css @@ -0,0 +1,3 @@ +h1{ + font-size: 30px; +} diff --git a/src/views/ddmDemo/component/fxTitle/FxTitle.vue b/src/views/ddmDemo/component/fxTitle/FxTitle.vue new file mode 100644 index 0000000..fdfe7e9 --- /dev/null +++ b/src/views/ddmDemo/component/fxTitle/FxTitle.vue @@ -0,0 +1,59 @@ + + + diff --git a/src/views/ddmDemo/component/toolbar/toobar.vue b/src/views/ddmDemo/component/toolbar/toobar.vue new file mode 100644 index 0000000..7a8ac62 --- /dev/null +++ b/src/views/ddmDemo/component/toolbar/toobar.vue @@ -0,0 +1,35 @@ + + + + + diff --git a/src/views/ddmDemo/engine/pageEngine.ts b/src/views/ddmDemo/engine/pageEngine.ts new file mode 100644 index 0000000..e69de29 diff --git a/src/views/ddmDemo/jsonData.js b/src/views/ddmDemo/jsonData.js new file mode 100644 index 0000000..0bc868a --- /dev/null +++ b/src/views/ddmDemo/jsonData.js @@ -0,0 +1,342 @@ +const json = { + form: [ + { + page: { + // 页面整体的属性 + name: '', + type: 'page/dialog', + title: '中文标题', + template: '模板文件,为空则读自定义模板', + class: '指定样式文件' + }, + template: { + type: 'Layout', + name: 'l1', + children: [ + { + type: 'Header', + name: 'Header', + props: { + + + }, + children:[ + { + type:'FxHeaderCard', + name:'FxHeaderCard1' //单据编辑 + } + ] + + }, + { + type: 'FxDivider', + name: '分割线', + props: { + size:'large' + } + + }, + { + type: 'Center', + name: 'c1', + children: [ + { + type: 'FxFormCard', + name: 'FxFormCard1'//表单 + + }, + { + type: 'FxDivider', + name: '分割线', + props: { + + } + + }, + { + type: 'FxTableCard', + name: 'FxTableCard1',//表格 + + + }, + + + + ] + + }, + { + type: 'Footer', + name: 'Footer', + props: { + title: '标题', + subTitle: '副标题', + icon: 'icon' + + } + + } + ] + }, + model: { + FxHeaderCard1:{ + dataset:{ + headerData:{ + name:'headerData', + title:'单据编辑', + button:[ + { + name:'删除', + type:'danger', + }, + { + name:'流程跟踪', + type:'warning', + },{ + name:'返回', + type:'', + } + + ], + selectOption:[ + { + label:'制单1', + value:'zd' + }, + { + label:'制单2', + value:'zd2' + }, + ], + fields:{ + zd:'zd', + djbh:'BC20230158', + zdrq:'2023-10-19', + bzdw:'重庆民政局', + bzbm:'业务部门', + } + } + + }, + fields:[ + { + label: '', + dataSetName:'headerData', + field: 'zd', + type: 'select', + + }, + { + label: '单据编号', + dataSetName:'headerData', + field: 'djbh', + type: 'string', + + }, + { + label: '制单日期', + dataSetName:'headerData', + field: 'zdrq', + type: 'string', + + }, + { + label: '编制单位', + dataSetName:'headerData', + field: 'bzdw', + type: 'string', + + }, + { + label: '编制部门', + dataSetName:'headerData', + field: 'bzbm', + type: 'string', + + }, + + + ] + + }, + + FxFormCard1: { + + + dataset: { + formData: { + name: 'formData', + title: '名册信息', + fields: { + recordNumber: 'BC20230158', // 单据编号 + unit: '重庆市民政局', // 单位 + fundItem: ['高龄津贴'], // 资金科目 + businessType: '艾滋病孤儿', // 业务类型 + businessMonth: '2023-11', // 业务月 + creationDate: '2023-10-19 14:58:41', // 制单日期 + totalItems: 0, // 合计条数 + totalAmount: 0, // 合计金额 + }, + }, + }, + + fields: [ + { + name: 'recordNumber', + field: 'formData.recordNumber', + type: 'text', + label: '单据编号', + readonly: false, + }, + { + name: 'unit', + field: 'formData.unit', + type: 'text', + label: '单位', + readonly: false, + }, + { + name: 'fundItem', + field: 'formData.fundItem', + type: 'multi-select', + label: '资金科目', + required: true, + }, + { + name: 'businessType', + field: 'formData.businessType', + type: 'dropdown', + label: '业务类型', + required: true, + }, + { + name: 'businessMonth', + field: 'formData.businessMonth', + type: 'date', + label: '业务月', + required: true, + }, + { + name: 'creationDate', + field: 'formData.creationDate', + type: 'datetime', + label: '制单日期', + readonly: false, + }, + { + name: 'totalItems', + field: 'formData.totalItems', + type: 'number', + label: '合计条数', + readonly: false, + }, + { + name: 'totalAmount', + field: 'formData.totalAmount', + type: 'number', + label: '合计金额', + readonly: false, + }, + ], + + }, + + FxTableCard1: { + dataset: { + tableData: { + name: 'tableData', + title: '统计信息', + button:[ + { + name:'导入', + type:'warning', + icon:'' + }, + { + name:'新增', + type:'primary', + icon:'' + } + ], + fields: [ + { + + unit: '单位1', + name: '张三', + idCode: '500101111111111111111', + fundSubject:'科目1', + totalAmount:'100', + subsidyAmount:'100' + }, + { + + unit: '单位2', + name: '李斯', + idCode: '5001022222222222', + fundSubject:'科目2', + totalAmount:'200', + subsidyAmount:'200' + + } + ] + + } + }, + fields:[ + { + label: '序号', + type:'index' + }, + + { + label: '单位', + dataSetName:'tableData', + field: 'unit', + type: 'number', + + }, + { + label: '姓名', + dataSetName:'tableData', + field: 'name', + type: 'number', + + }, + { + label: '证件号码', + dataSetName:'tableData', + field: 'idCode', + type: 'idCode', + + }, + { + label: '资金科目', + dataSetName:'tableData', + field: 'fundSubject', + type: 'string', + + }, + { + label: '合计金额', + dataSetName:'tableData', + field: 'totalAmount', + type: 'found', + + }, + { + label: '补发金额', + dataSetName:'tableData', + field: 'subsidyAmount', + type: 'found', + + }, + + ] + + } + + } + } + ] +} +export default json diff --git a/src/views/ddmDemo/jsonData2.js b/src/views/ddmDemo/jsonData2.js new file mode 100644 index 0000000..bb1fb3b --- /dev/null +++ b/src/views/ddmDemo/jsonData2.js @@ -0,0 +1,358 @@ +const formData = { + form: [ + { + page: { + name: "formMain", + type: "page", + title: "测试", + template: "这里为空则" + }, + template: { + type: "panel", + name: "form", + props: { + direction: "col" + }, + children: [ + //单据编辑 + { + type: "panel", + name: "header", //这里的header 无规律,样式不固定,由开发者自己布局,css样式必不可少,开发者写样式不建议写这里的话,该怎么写呢 + props: { + direction: "row", + style:{ + padding:'20px' //修改 增加样式, + } + + }, + children: [ + + { + type: "fxTitle", //修改 增加了title组件 + name: "header_title", + props: { + title: "单据编辑", + } + }, + { + type: "panel", // 这里的下拉框,由panel组件渲染,在这里直接放一个下拉框组件会不会好一点 + name: "tool_left" + }, + { + type: "toolbar", + name: "toolbar", + props: { + align:'right'// 修改,增加向右对齐 + }, + + } + ] + }, + // 单据编号行 + { + type: "panel", + name: "panelHeader", + props: { + direction: "row", + // colnum: 4, //修改 注释 + style:{ + padding:'20px', //修改 增加样式, + gap:"50px" + } + } + }, + // 名册信息表单 + { + type: "fxForm", //修改,把panel 改为 fxForm,表单单独做一个组件, 如果使用panel,model里的title属性,显示的位置,会不明确,想让panel只负责容器布局 + name: "panelMain", + props: { + colnum: 2, + divider:true + } + }, + // 统计信息表格 + { + type: "grid", + name: "gridItem", + props: { + } + } + ] + }, + model: { + header_title:{ + title: "单据编辑" + }, + + //单据编辑下拉框 + tool_left: { + content: [ + { + name: "f1", + field: "d1.f1", + type: "select", //修改 + label: "", + opts: [ + { + label: "制单1", + value: "zd1" + }, + { + label: "制单2", + value: "zd2" + } + ] + } + ] + }, + //单据编辑按钮 + toolbar: { + content: [ + { + name: "btnDel", + label: "删除", + type: "button", + btn_type: "danger" + }, + { + name: "btnFlow", + label: "流程跟踪", + type: "button", + btn_type: "warning" + }, + { + name: "btnList", + label: "返回", + type: "button" + } + ] + }, + //单据编号 + panelHeader: { + content: [ + { + name: "", + type: "label", + label: "单据编号", + field: "masterTable.djbh" + }, + { + name: "", + type: "label", + label: "制单日期", + field: "masterTable.djbh" + }, + { + name: "", + type: "label", + label: "编制单位", + field: "masterTable.djbh" + }, + { + name: "", + type: "label", + label: "编制部门", + field: "masterTable.djbh" + } + ] + }, + // 名册信息 表单 + panelMain: { + title: "名册信息", + content: [ + { + name: "field1", + type: "input", + label: "单据编号", + field: "masterTable.djbh", + readonly: true + }, + { + name: "field2", + type: "input", + label: "单位", + field: "masterTable.djbh", + readonly: true + }, + { + name: "field3", + type: "input", + label: "资金科目", + field: "masterTable.djbh" + }, + { + name: "field4", + type: "input", + label: "业务类型", + field: "masterTable.djbh" + }, + { + name: "field4", + type: "input", + label: "业务月", + field: "masterTable.djbh" + }, + { + name: "field4", + type: "input", + label: "制单日期", + field: "masterTable.djbh" + } + ] + }, + // 统计信息 表格 + gridItem: { + title: "统计信息", + rownumbers: true, //序号,要不要叫index,element是叫index + checkbox: true, //复选框 + toolbar: [ + { + name: "btnImp", + label: "导入", + type: "button", + btn_type: "warning" + }, + { + name: "btnAddItem", + label: "新增", + type: "button", + btn_type: "primary" + } + ], + optCol: [ + { + name: "btnDetail", + label: "详情", + btn_type: "info" + }, + { + name: "btnDelItem", + label: "删除", + btn_type: "danger" + } + ], + filter: { + + }, + fixedLeft: [ + {} + ], + fixedRight: [ + {} + ], + cols: [ + { + name: "field1", + label: "单位", + field: "masterTable.djbh", + width: 120, + align: "left" + }, + { + name: "field1", + label: "姓名", + field: "masterTable.djbh", + width: 80, + align: "left" + } + ] + } + } + } + ], + formCss: { + header:{ + className: "flex_left, div_width", //给组件添加类名,样式名在全局样式定义好,把定义好的样式名写文档给开发者 + style: "width:80%;height:50px;", //开发者自定义样式 + selfClass:[ + { + name:'.div_width',//开发者自定义类名 + content:'width:90%;border:1px;', + } + ] + } + }, + + dataset: [ + { + name: "masterTable", + label: "主表", + type: "表/视图/sql/json", + rows: "单行/多行", + opts: { + 表: { + table: "表id" + }, + 视图: { + table: "视图id" + }, + sql: { + sql: "查询sql" + }, + json: { + type: "field/param/text", + src: "table.field/param_name/XXX" + } + }, + fields: [ + { + name: "pt_id", + field: "table.field", + fieldType: "str/number/float" + } + ], + filter: { + trigger: "click/change,默认为取值类型需要输入的click,其他为实时监控触发", + fields: [ + { + name: "pt_id", + field: "table.field", + fieldType: "str/number/float", + sqlName: "ta.field1", + valueType: "取值类型", + trigger: "click/change,可不用,根据默认规则来" + } + ], + fixed: "固定条件,如:cpi_id=:id", + dyn_动态条件树: { + opt: "逻辑运算符:and/or", + children: [ + { + opt: "or", + children: [ + { + name: "对应filter的name", + opt: "运算符:eq/gt/ge/lt/le/plike..." + } + ] + }, + { + param: "fid182396b0dad", + opt: "=" + } + ] + } + }, + sortFields: [ + { + field: "pt_code", + type: "asc" + }, + { + field: "pt_id", + type: "asc" + } + ] + } + ], + params: [ + { + name: "参数名", + type: "参数类型", + value: "参数值" + } + ] +}; +export default formData; +// 示例:访问 form 数据 +console.log(formData.form[0].page.title); // 输出: 测试 diff --git a/src/views/ddmDemo/study/hDemo.vue b/src/views/ddmDemo/study/hDemo.vue new file mode 100644 index 0000000..7ea3c24 --- /dev/null +++ b/src/views/ddmDemo/study/hDemo.vue @@ -0,0 +1,69 @@ + + + +