How to use the @ams-team/ams.resources function in @ams-team/ams

To help you get started, we’ve selected a few @ams-team/ams examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github vipshop / ams / packages / block-ams-config / src / field.vue View on Github external
updatePreview(data) {
            ams.resources.previewRes.fields.edit = this.copy(data);
            ams.resources.previewRes.fields.edit.ctx = 'edit';
            ams.resources.previewRes.fields.value = {
                type: 'text',
                label: '字段值',
                ctx: 'view'
            };
            const viewData = this.copy(data);
            let defaultData = viewData.default;
            // 三个特殊字段的需要特殊处理
            if (viewData.type === 'object' && viewData.fields) {
                let newDefaultData = {};
                Object.keys(viewData.fields).forEach(item => {
                    viewData.fields[item].ctx = 'view';
                    newDefaultData[item] = viewData.fields[item].default;
                });
                if (!defaultData) {
github vipshop / ams / packages / block-ams-config / src / field.vue View on Github external
updatePreview(data) {
            ams.resources.previewRes.fields.edit = this.copy(data);
            ams.resources.previewRes.fields.edit.ctx = 'edit';
            ams.resources.previewRes.fields.value = {
                type: 'text',
                label: '字段值',
                ctx: 'view'
            };
            const viewData = this.copy(data);
            let defaultData = viewData.default;
            // 三个特殊字段的需要特殊处理
            if (viewData.type === 'object' && viewData.fields) {
                let newDefaultData = {};
                Object.keys(viewData.fields).forEach(item => {
                    viewData.fields[item].ctx = 'view';
                    newDefaultData[item] = viewData.fields[item].default;
                });
                if (!defaultData) {
                    defaultData = newDefaultData;
                }
github vipshop / ams / packages / field-tag / src / edit.vue View on Github external
params.data[this.field.props['idKey']] = item;
                    params.data[this.field.props['nameKey']] = item;
                    params.data[this.field.props['subNameKey']] = item;
                }
            } else {
                params.params = {
                    // page: 1,
                    // pageSize: 20
                };
                if (item) {
                    params.params[this.field.props['idKey']] = item;
                    params.params[this.field.props['nameKey']] = item;
                    params.params[this.field.props['subNameKey']] = item;
                }
            }
            const resource = ams.resources[ams.blocks[this.name].resource];
            if (typeof props.withCredentials !== 'undefined') {
                params.withCredentials = props.withCredentials;
            } else if (typeof resource.api.withCredentials !== 'undefined') {
                params.withCredentials = resource.api.withCredentials;
            }
            const res = await ams.request(params);
            const successCode = typeof props.successCode === 'number' ? props.successCode : resource.api.successCode;
            // 默认successCode
            if (
                res.data &&
                res.data.code === successCode &&
                res.data.data &&
                res.data.data.list
            ) {
                return res.data.data.list;
            }