Example #1
0
module.exports = CommonCrud.extend({
    template: __inline('main.html'),
    data: {
        id: undefined,
        codingId: undefined,
        fieldName: undefined,
        cnName: undefined,
        dbName: undefined,
        state: undefined,
    },
    methods: {
        beforeShowModal: function(data) {
            if (!data) {
                return;
            }

            // 初始化数据
            this.id = data.id;
            this.codingId = data.codingId;
            this.fieldName =data.fieldName;
            this.cnName =data.cnName;
            this.dbName =data.dbName;
            this.state = data.state;
        },
        getRulesOptions: function() {
            var config = {
                fieldName: {
                    required: true
                },
                cnName: {
                    required: true
                },
                dbName: {
                    required: true
                },
                state: {
                    required: true
                }
            };

            return config;
        }
    }
});
Example #2
0
module.exports = CommonCrud.extend({
    template: __inline('main.html'),
    data: {
        id: undefined,
        items: []
    },
    methods: {
        beforeShowModal: function(data) {
            if (!data || !data.id) {
                return;
            }

            // 设置要删除的记录的id
            this.id = data.id;

            // 设置要展示的信息条目
            this.items = [{
                key: 'id',
                value: data.id,
                title: 'ID'
            }, {
                key: 'codingId',
                value: data.codingId,
                title: '代码生成器'
            }, {
                key: 'fieldName',
                value: data.fieldName,
                title: '字段名称'
            }, {
                key: 'stateShow',
                value: data.stateShow,
                title: '状态'
            }];
        },
        triggerSubmit: function() {
            var self = this;

            $.post('/admin/codingitem/delete', {
                id: this.id
            }, function(responseText, statusText) {
                self.dealSuccessRes(responseText, statusText);
            });
        }
    }
});