product.productMaterial.js 1.93 KB
module.exports = function (app) {
    // 首页
    app.get('/goods/material/index', "product.productMaterial.Index", "select_selectAllMaxSort", function(rs) {
        this.$extend = {
            moduleName: "产品管理",
            pageName: "产品材质管理",
            maxSortIds: rs.data
        }

        return rs.data;
    });

    // 查询列表
    app.post('/product/material/list', 'productMaterial_getMaterialList');

    // 编辑
    app.get('/goods/material/edit/:materialId', 'product.productMaterial.Edit', ['productMaterial_getMaterialDetail', 'select_selectAllMaxSort'], 
        function(materialrs, sortrs) {
        this.$extend = {
            moduleName: "产品管理",
            pageName: "产品材质编辑",
            material: materialrs.data,
            maxSortIds: sortrs.data,
            title: '编辑材质信息',
            action: '/product/material/update'
        }
    });

    // 新增
    app.get('/goods/material/add', 'product.productMaterial.Edit', 'select_selectAllMaxSort', function(rs) {
        this.$extend = {
            moduleName: "产品管理",
            pageName: "产品材质创建",
            maxSortIds: rs.data,
            material: {id: 0},
            title: '新增材质信息',
            action: '/product/material/add'
        }
    });

    // 新增
    app.post('/product/material/add', 'productMaterial_addMaterial');

    // 更新
    app.post('/product/material/update', 'productMaterial_updateMaterial');

    // 删除
    app.post('/product/material/delete', 'productMaterial_deleteMaterial');

    app.post('/product/material/getBindProductInfo', 'productMaterial_getBindProductInfo');

    // 查看绑定该材质的商品列表
    app.get('/goods/material/bindinfo/:materialId', 'product.productMaterial.Bind', function(req, res) {
        this.$extend = {
            moduleName: "产品管理",
            pageName: "产品材质绑定信息"
        }
    });
}