企业🤖AI智能体构建引擎,智能编排和调试,一键部署,支持知识库和私有化部署方案 广告
~~~ //Expend.views.stockManage.index 需要和 routes 里面配置的控制器名字一致 angular.module('app').controller('Expend.views.stockManage.index', [ //'$scope', '$uibModal', 固定写法 //abp.services.expend.palletCartonPack 后端服务 // 注意后台服务名 PalletCartonPackAppService 就改成palletCartonPack     '$scope', '$uibModal', 'abp.services.expend.palletCartonPack', //palletCartonPackService 自己取的变量名     function ($scope, $uibModal, palletCartonPackService) { // 固定写法         var vm = this;         $scope.$on('$viewContentLoaded', function () {             App.initAjax();         }); // 定义的一些变量         vm.loading = false;         vm.dataList = [];         //权限         vm.permissions = {             //check: abp.auth.hasPermission('Pages.Expend.MOManage')         };         //请求后台传入参数         vm.requestParams = {             PalletNo: '',             CsoCode:''         }; // 请求列表数据         vm.getData = function (e){ //调用服务端的接口             palletCartonPackService.getShortageInfo(vm.requestParams).then(function (result) {                 vm.dataList = result.data; // 请求回来的数据封装成 kendoGrid 可读格式                 var dataSource = new kendo.data.DataSource({                     data: result.data                 }); // 将封装好的数据放入kendoGrid 的数据源中                 $("#produceTable").data('kendoGrid').setDataSource(dataSource);             });         } // 声明一个kendoGrid对象         vm.kendoGrid = new $.CPS.kendo.DataGrid(); // 初始化 kendoGrid 对象         vm.initForm = function () {             vm.produceGridOptions = vm.kendoGrid.init({                 height: 440,                 id: 'produceTable',                 dataSource: vm.dataList,                 columns: [                      {                         title: "名称",                         field: 'sales.itemName',                         width: 120,                         filterable: true,                         sortable: true,                         headerAttributes: { style: "text-align: center;" },                         attributes: { style: 'text-align: center;' },                     }, {                         title: "品牌",                         field: 'sales.brand',                         width: 120,                         filterable: true,                         sortable: true,                         headerAttributes: { style: "text-align: center;" },                         attributes: { style: 'text-align: center;' }                     }, {                         title: "缺货数量",                         field: 'sales.qty',                         width: 120,                         filterable: true,                         sortable: true,                         headerAttributes: { style: "text-align: center;" },                         attributes: { style: 'text-align: center;' },                     }, {                         title: "图号",                         field: 'addCode',                         width: 180,                         filterable: true,                         sortable: true,                         headerAttributes: { style: "text-align: center;" },                         attributes: { style: 'text-align: center;' },                     }, {                         title: "物料编码",                         field: 'sales.materialCode',                         width: 180,                         filterable: true,                         sortable: true,                         headerAttributes: { style: "text-align: center;" },                         attributes: { style: 'text-align: center;' },                     }                 ]             });         }         vm.reload = function () {             vm.kendoGrid.clearFilters();             $("#produceTable").data('kendoGrid').dataSource.read();         }         //重置         //vm.resetConditions = function () {         //    vm.requestParams.PalletNo = "";         //    vm.requestParams.CsoCode = "";         //    vm.kendoGrid.resetConditions();         //    vm.refreshGrid();         //};         //查找点击事件         vm.refreshGrid = function () {             vm.getData();         }; // 键盘回车事件         vm.selectOnEnter = function (e) {             var keycode = window.event ? e.keyCode : e.which;             if (keycode == 13) {                 vm.refreshGrid();             }         };         //导出Excel         vm.exportToExcel = function () { //调用服务端的导出函数             palletCartonPackService.getShortageInfoToExcel(vm.requestParams).then(function (result) { //导出回调的固定写法                 app.downloadTempFile(result.data);                 app.notify.success(abp.localization.localize('ExportSuccessfully', 'CPSSystem'), result.config.executeDuration);             });         }; // 初始化事件         vm.init = function () {             vm.initForm();         }     }]); ~~~