1.2.6 • Published 1 year ago

yyuap-template v1.2.6

Weekly downloads
88
License
MIT
Repository
-
Last release
1 year ago

New Template

参数说明类型默认值是否必须
templateComponentName模板显示位置的dom的idString
url模板服务地址Stringhttp://workbench.yyuap.com
nexuskey模板的必要参数nexuskeyString
funcnode模板的必要参数funcnodeString
templateType模板的类型String空字符串
hideButton隐藏表单的操作按钮Booleanfalse
onSave点击保存按钮的回调函数Function
onCancel点击取消按钮的回调函数Function
onDelete点击取消按钮的回调函数Function
onHeadFormDataChange当主表发生变化时的回调函数Function
onBodyFormDataChange当子表发生变化时的回调函数Function
handleComponentCallback控件值发生变化时触发的回调函数Function

如何使用

  • npm方式安装
    npm install yyuap-template
    注:如果采用es6的方式引入使用需要配置相应的css-loader等进行css样式的解析。
  • 通过require或者script方式。可参考demo
    cdn地址: https://design.yonyoucloud.com/static/ui-templates/1.0.22/js/uiTemplate.js
    需要引用build文件夹下面的uiTemplate.js
    <script type="text/javascript" src="https://design.yonyoucloud.com/static/ui-templates/1.0.22/js/uiTemplate.js"></script>
    此时会获得uiTempalte方法可直接实例化使用。
编写配置参数
const options = {
    // 模板生成dom的id
    templateComponentName : 'root',
    nexuskey : 'psn', // 实例模板
    funcnode : '001PSN_TEST', // 实例模板
    templateType:"hr",
    afterInit : function () {
        template.updateTemplateData()
    },
    // 保存的回调方法
    onSave : function (params) {
        console.log(params.rowData);
        params.doSave();
    },
    // 取消的回调方法
    onCancel : function (params) {
        params.doCancel();
    },
    // 删除行的回调方法
    onDelete : function (rowData) {
        console.log(rowData);
    },
    onHeadFormDataChange : function (headFormData) {
        console.log(headFormData);
    },
    onBodyFormDataChange : function (bodyFormData) {
        console.log(bodyFormData);
    },
    // 当输入控件的值发生改变时回调此方法来进行一些关联性的赋值操作
    handleComponentCallback : function (params) {
        if (params.itemCode === 'staff.staff_bankacc.bank') {
            params.setValue({itemCode:'staff.staff_bankacc.bankname',value:params.currentRef.id})
        }                                                   
        if (params.itemCode === 'adminorg.orgmgr') { // A控件改变B控件,同时通知改变C控件
            params.setValue({itemCode:'adminorg.branchleader',value:params.id,nextComponent:{itemCode:"adminorg.region",value:params.value}})
        }                                                   
        if (params.itemCode === 'adminorg.branchleader') {// B控件改变C控件
            params.setValue({itemCode:'adminorg.region',value:params.value.id})
        }                                                   
    }
}
// 初始化
var template = new uiTemplate(options);
// 开始创建
template.startCreate();

提供的API能力

在 new uiTempalte()之后会得到一个模板的实例化对象。这个实例带有如下方法:
1、updateTemplateData ---- 更新模板数据
2、setFormEdit ---- 设置表单为编辑状态 *(如果想在模板创建完成后立即设置为编辑状态,请放到afterInit方法中执行)*
3、setFormNotEdit ---- 设置表单为非编辑状态
4、saveForm ---- 获取保存数据(只有表单校验通过后返回json数据,否则页面会做出相应提示)
5、getTemplateInfo ---- 获取模板信息(返回json)
6、getValueByItemCode ---- 需要传入itemCode,根据itemCode返回value
7、setReferenceParamByItemCode ---- 运行时为参照控件追加参数(建议放到afterInit中执行设置)
8、resetForm ---- 将主表清空
9、setValueByItemCode ---- 根据itemCode为控件设置值
1.2.6

1 year ago

1.2.5

1 year ago

1.2.4

1 year ago

1.2.3

1 year ago

1.2.2

1 year ago

1.2.1

2 years ago

1.2.1-npm

2 years ago

1.1.99-caep

2 years ago

1.1.99

2 years ago

1.1.9

2 years ago

1.1.0

2 years ago

1.0.99

2 years ago

1.0.98

2 years ago

1.0.97

2 years ago

1.0.96

2 years ago

1.0.95

2 years ago

1.0.94

2 years ago

1.0.93

2 years ago

1.0.92

2 years ago

1.0.91

2 years ago

1.0.90

2 years ago

1.0.89

2 years ago

1.0.88

2 years ago

1.0.87

2 years ago

1.0.86

2 years ago

1.0.85

2 years ago

1.0.84

2 years ago

1.0.83

2 years ago

1.0.82

2 years ago

1.0.81

2 years ago

1.0.80

2 years ago

1.0.79

2 years ago

1.0.78

2 years ago

1.0.77

2 years ago

1.0.76

2 years ago

1.0.75

2 years ago

1.0.74

2 years ago

1.0.73

2 years ago

1.0.72

2 years ago

1.0.71

2 years ago

1.0.70

2 years ago

1.0.69

2 years ago

1.0.68

2 years ago

1.0.67

2 years ago

1.0.66

2 years ago

1.0.65

2 years ago

1.0.64

2 years ago

1.0.63

2 years ago

1.0.62

2 years ago

1.0.61

2 years ago

1.0.60

2 years ago

1.0.59

2 years ago

1.0.58

2 years ago

1.0.57

2 years ago

1.0.56

2 years ago

1.0.55

2 years ago

1.0.54

2 years ago

1.0.53

2 years ago

1.0.52

2 years ago

1.0.51

2 years ago

1.0.50

2 years ago

1.0.49

2 years ago

1.0.48

2 years ago

1.0.47

2 years ago

1.0.46

2 years ago

1.0.45

2 years ago

1.0.44

3 years ago

1.0.43

3 years ago

1.0.42

3 years ago

1.0.41

3 years ago

1.0.40

3 years ago

1.0.39

3 years ago

1.0.38

3 years ago

1.0.37

3 years ago

1.0.36

3 years ago

1.0.35

3 years ago

1.0.34

3 years ago

1.0.33

3 years ago

1.0.32

3 years ago

1.0.31

3 years ago

1.0.30

3 years ago

1.0.29

3 years ago

1.0.28

3 years ago

1.0.27

3 years ago

1.0.26

3 years ago

1.0.25

3 years ago

1.0.24

3 years ago

1.0.23

3 years ago

1.0.22

3 years ago

1.0.21

3 years ago

1.0.20

3 years ago

1.0.19

3 years ago

1.0.18

3 years ago

1.0.17

3 years ago

1.0.16

3 years ago

1.0.15

3 years ago

1.0.14

3 years ago

1.0.13

3 years ago

1.0.12

3 years ago

1.0.11

3 years ago

1.0.10

3 years ago

1.0.9

3 years ago

1.0.8

3 years ago

1.0.7

3 years ago

1.0.6

3 years ago

1.0.5

3 years ago

1.0.4

3 years ago

1.0.3

3 years ago

1.0.2

3 years ago

1.0.1

3 years ago

1.0.0

3 years ago

0.0.1

3 years ago