"use strict";

var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
exports.__esModule = true;
exports.getChildList = void 0;
exports.getUniFormList = getUniFormList;
exports.saveStoreAdd = saveStoreAdd;
var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"));
var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
var _request = _interopRequireDefault(require("./request"));
/*
 * @Author: saiyi_lch 982492702@qq.com
 * @Date: 2023-06-30 11:37:52
 * @LastEditors: saiyi_lch 982492702@qq.com
 * @LastEditTime: 2023-07-04 10:57:20
 * @FilePath: /lowcode-material/src/utils/api.ts
 * @Description: 这是接口api
 */

//统一页面查询接口

function getUniFormList(obj, current, size) {
  var url = '/api/gzmpc-lowcode/uniForm/getList';
  if (current) {
    url += "?current=" + current + "&size=" + size;
  }
  return new Promise(function (resolve, reject) {
    (0, _request["default"])({
      url: url,
      method: 'post',
      data: obj
    }).then(function (res) {
      resolve(res.data);
    })["catch"](function (err) {
      reject();
    });
  });
}

// 统一保存接口

// 统一保存接口
function saveStoreAdd(obj) {
  var url = '/api/gzmpc-lowcode/uniForm/save';
  return new Promise(function (resolve, reject) {
    (0, _request["default"])({
      url: url,
      method: 'post',
      data: obj
    }).then(function (res) {
      resolve(res.data);
    })["catch"](function (err) {
      reject();
    });
  });
}

// 获取枚举值列表-子
var getChildList = /*#__PURE__*/function () {
  var _ref = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee(parentId) {
    return _regenerator["default"].wrap(function _callee$(_context) {
      while (1) switch (_context.prev = _context.next) {
        case 0:
          return _context.abrupt("return", new Promise(function (resolve, reject) {
            (0, _request["default"])({
              url: "/api/gzmpc-lowcode/enum/child-list?parentId=" + parentId,
              method: "GET"
            }).then(function (res) {
              resolve(res.data);
            });
          }));
        case 1:
        case "end":
          return _context.stop();
      }
    }, _callee);
  }));
  return function getChildList(_x) {
    return _ref.apply(this, arguments);
  };
}();
exports.getChildList = getChildList;