1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677 |
- (function ($app) {
- $app.module('ylmis').controller('editDictionaryCtrl', function ($scope, $http, $filter, $modal, $ocLazyLoad, $alert, $loading, $state, AuthUser, $bsRouterState) {
- $scope.params = $scope.$parent.$parent.editData.params;
- $scope.parentLoad = $scope.$parent.$parent.editData.parentLoad;
- $scope.dicItem = {};
- $scope.readonly = false;
- $scope.selectDictionaryParams = {
- url: '../../api/systemsetting/Dictionary/GetDicListForSelect',
- isMulti: false,
- selectData: { code: '代码', name: '名称' },
- columns: { DictionaryCode: '代码', Name: '名称' },
- selectLabelKey: 'DictionaryCode',
- selectValuekey: 'DictionaryCode',
- selectedValueData: '',
- selectedLabeData: '',
- selectedJData: [],
- selectParams: {
- }
- };
- $scope.$watch('selectDictionaryParams.selectedValueData', function (newVal) {
- if (newVal != '' && newVal != undefined) {
- $scope.dicItem.DictionaryCode = newVal;
- }
- });
- $scope.loadData = function () {
- $loading.show();
- $http({
- method: "post",
- url: "../../api/systemsetting/Dictionary/GetDicItem",
- data: {
- dicItemID: $scope.params.dicItemID
- }
- }).then(function (result) {
- $loading.hide();
- $scope.dicItem = result.data.Data;
- $scope.selectDictionaryParams.selectedLabeData = $scope.dicItem.DictionaryCode;
- });
- }
- $scope.saveData = function (isflag) {
- if (isflag) {
- $loading.show();
- $http({
- method: "post",
- url: "../../api/systemsetting/Dictionary/EditDicItem",
- data: {
- dicItem: $scope.dicItem
- }
- }).then(function (result) {
- $loading.hide();
- if (result.data.IsSuccess) {
- $scope.showMsg('成功', '保存成功。');
- //重新刷新列表
- $scope.parentLoad();
- $scope.$hide();
- } else {
- $scope.showMsg('成功', result.data.Message);
- }
- }, function (resp) {
- $loading.hide();
- $scope.showMsg('错误', '服务器错误');
- });
- }
- }
- if ($scope.params.dicItemID) {
- $scope.loadData();
- $scope.readonly = $scope.dicItem.IsEditable;
- }
- });
- })(angular);
|