import 'antd/es/button/style';
import _Button from 'antd/es/button';
import { f as __rest, d as __assign, b as __awaiter, c as __generator } from './index.js';
import React__default from 'react';
import { APP_CONFIG } from '@lm_fe/components_m';
import { request } from '@lm_fe/utils';
import { MyBaseList } from '@lm_fe/pages';
import '@lm_fe/env';
import 'antd/es/tabs/style';
import 'antd/es/tabs';
import 'lodash/size';
import 'lodash/get';
import 'lodash/orderBy';
import 'lodash/map';
import '@lm_fe/components';
import 'antd/es/collapse/style';
import 'antd/es/collapse';
import 'antd/es/badge/style';
import 'antd/es/badge';
import 'lodash/assign';
import '@ant-design/icons';
import '@lm_fe/service';
var tableColumns = [{
  title: '序号',
  dataIndex: ['index'],
  ellipsis: true,
  width: 36,
  align: 'center',
  isActive: 0,
  render: function render(text, record, index) {
    return index + 1;
  }
}, {
  title: '配置名(key)',
  dataIndex: 'configurationKey',
  inputProps: {
    disabled: true
  },
  align: 'center',
  width: APP_CONFIG.CELL_WIDTH_LARGE
}, {
  title: '配置类型',
  dataIndex: 'configurationType',
  inputProps: {
    disabled: true
  },
  align: 'center',
  width: APP_CONFIG.CELL_WIDTH_SMALL
}, {
  title: '配置状态',
  dataIndex: 'configurationState',
  align: 'center',
  width: 56,
  inputType: 'MySelect',
  inputProps: {
    options: ['未配置', '已配置'].map(function (label, value) {
      return {
        label: label,
        value: value
      };
    }),
    marshal: false,
    disabled: true
  }
}, {
  title: '配置说明',
  dataIndex: 'configurationExplain',
  inputProps: {
    disabled: true
  },
  align: 'center',
  width: APP_CONFIG.CELL_WIDTH_LARGE
}, {
  title: '配置值',
  dataIndex: 'configurationValue',
  editable: true,
  align: 'center',
  width: APP_CONFIG.CELL_WIDTH_LARGE
}, {
  title: '配置补充说明',
  dataIndex: 'configurationReplenishExplain',
  editable: true,
  align: 'center',
  width: APP_CONFIG.CELL_WIDTH_MIDDLE
}];
function handleRefreshConfig() {
  return __awaiter(this, void 0, void 0, function () {
    return __generator(this, function (_a) {
      request.get('/api/flushConfiguration', {
        showMsg: true
      });
      return [2];
    });
  });
}
var index = function index() {
  return /*#__PURE__*/React__default.createElement(MyBaseList, {
    tableColumns: tableColumns,
    name: "/getAllConfiguration",
    showRowDelBtn: true,
    baseTitle: "\u914D\u7F6E",
    showAdd: false,
    fuckPage: true,
    RenderBtns: function RenderBtns(_a) {
      _a.getSearchParams;
      return /*#__PURE__*/React__default.createElement(React__default.Fragment, null, /*#__PURE__*/React__default.createElement(_Button, {
        onClick: handleRefreshConfig
      }, "\u5237\u65B0"));
    },
    beforeSearch: function beforeSearch(v) {
      var others = __rest(v, []);
      console.log('beforeSearch 9999999999', v);
      return __assign({}, others);
    },
    beforeSubmit: function beforeSubmit(v) {
      var configurationValue = v.configurationValue,
        configurationReplenishExplain = v.configurationReplenishExplain;
      var configurationState = v.configurationState;
      if (configurationValue && configurationReplenishExplain) {
        configurationState = 1;
      }
      if (!configurationValue && !configurationReplenishExplain) {
        configurationState = 0;
      }
      v.configurationState = configurationState;
      return v;
    },
    searchSchema: [{
      type: 'Input',
      outerOptions: {
        name: 'configurationExplain',
        label: '配置说明'
      }
    }, {
      type: 'Input',
      outerOptions: {
        name: 'configurationKey',
        label: '配置名'
      }
    }, {
      type: 'Input',
      outerOptions: {
        name: 'configurationType',
        label: '配置类型'
      }
    }, {
      type: 'Input',
      outerOptions: {
        name: 'configurationValue',
        label: '配置值'
      }
    }, {
      type: 'Select',
      outerOptions: {
        name: 'configurationState',
        label: '配置状态'
      },
      innerOptions: {
        options: [{
          label: '未配置',
          value: '0'
        }, {
          label: '已配置',
          value: '1'
        }]
      }
    }],
    searchParams: {
      pageSize: 10
    }
  });
};
export { index as default };
//# sourceMappingURL=pages.system.configuration.js.map
