/******/ (function() { // webpackBootstrap
/******/ 	"use strict";
/******/ 	// The require scope
/******/ 	var __webpack_require__ = {};
/******/ 	
/************************************************************************/
/******/ 	/* webpack/runtime/compat get default export */
/******/ 	!function() {
/******/ 		// getDefaultExport function for compatibility with non-harmony modules
/******/ 		__webpack_require__.n = function(module) {
/******/ 			var getter = module && module.__esModule ?
/******/ 				function() { return module['default']; } :
/******/ 				function() { return module; };
/******/ 			__webpack_require__.d(getter, { a: getter });
/******/ 			return getter;
/******/ 		};
/******/ 	}();
/******/ 	
/******/ 	/* webpack/runtime/define property getters */
/******/ 	!function() {
/******/ 		// define getter functions for harmony exports
/******/ 		__webpack_require__.d = function(exports, definition) {
/******/ 			for(var key in definition) {
/******/ 				if(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {
/******/ 					Object.defineProperty(exports, key, { enumerable: true, get: definition[key] });
/******/ 				}
/******/ 			}
/******/ 		};
/******/ 	}();
/******/ 	
/******/ 	/* webpack/runtime/hasOwnProperty shorthand */
/******/ 	!function() {
/******/ 		__webpack_require__.o = function(obj, prop) { return Object.prototype.hasOwnProperty.call(obj, prop); }
/******/ 	}();
/******/ 	
/******/ 	/* webpack/runtime/make namespace object */
/******/ 	!function() {
/******/ 		// define __esModule on exports
/******/ 		__webpack_require__.r = function(exports) {
/******/ 			if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
/******/ 				Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
/******/ 			}
/******/ 			Object.defineProperty(exports, '__esModule', { value: true });
/******/ 		};
/******/ 	}();
/******/ 	
/************************************************************************/
var __webpack_exports__ = {};
// ESM COMPAT FLAG
__webpack_require__.r(__webpack_exports__);

// EXPORTS
__webpack_require__.d(__webpack_exports__, {
  "default": function() { return /* binding */ upload_file; }
});

;// CONCATENATED MODULE: ./node_modules/babel-loader/lib/index.js!./node_modules/vue-loader/lib/loaders/templateLoader.js??ruleSet[1].rules[2]!./node_modules/vue-loader/lib/index.js??vue-loader-options!./packages/upload-file/src/main.vue?vue&type=template&id=d22ec1b4&
var render = function render() {
  var _vm = this,
    _c = _vm._self._c;
  return _c("div", {
    staticClass: "jdf-upload-file"
  }, [_vm.remark ? _c("div", {
    staticClass: "html-text"
  }, [_vm._v(_vm._s(_vm.remark))]) : _vm._e(), _c("el-upload", {
    directives: [{
      name: "show",
      rawName: "v-show",
      value: _vm.isEdit,
      expression: "isEdit"
    }],
    staticClass: "upload-btn",
    attrs: {
      action: _vm.uploadAction,
      headers: _vm.headers,
      data: _vm.params,
      name: _vm.name,
      accept: _vm.accept,
      multiple: _vm.multiple,
      "file-type": _vm.fileType,
      "max-size": _vm.maxSize,
      "show-file-list": false,
      "before-upload": _vm.beforeUpload,
      limit: _vm.limit,
      disabled: _vm.disabled,
      "on-exceed": _vm.onExceed,
      "on-success": _vm.onSuccess,
      "on-error": _vm.onError,
      "on-progress": _vm.onProgress
    }
  }, [_c("el-button", {
    attrs: {
      slot: "trigger",
      type: "primary",
      icon: "el-icon-upload2",
      size: "small",
      loading: _vm.loading,
      disabled: _vm.disabled
    },
    slot: "trigger"
  }, [_vm._v("\n      " + _vm._s(_vm.btnName) + "\n    ")])], 1), _vm.tempFileList.length ? _c("ul", {
    staticClass: "file-list"
  }, _vm._l(_vm.tempFileList, function (item, index) {
    return _c("li", {
      key: item.id,
      staticClass: "file-item"
    }, [_c("div", {
      staticClass: "file-name"
    }, [_c("el-link", {
      attrs: {
        type: "primary",
        underline: false,
        title: item.fileName
      },
      on: {
        click: function click($event) {
          return _vm.downloadFile(item.fileId, item.fileName);
        }
      }
    }, [_vm._v(_vm._s(item.fileName))])], 1), _vm.infoFields ? _c("div", {
      staticClass: "infos"
    }, [_vm.infoFields.includes("createUser") ? _c("el-button", {
      attrs: {
        type: "text",
        icon: "el-icon-user"
      }
    }, [_vm._v(_vm._s(item.createUser))]) : _vm._e(), _vm.infoFields.includes("createTime") ? _c("el-button", {
      attrs: {
        type: "text",
        icon: "el-icon-alarm-clock"
      }
    }, [_vm._v(_vm._s(_vm.formatMillisecondToString(item.createTime)))]) : _vm._e(), _vm.infoFields.includes("fileSize") ? _c("el-button", {
      attrs: {
        type: "text",
        icon: "el-icon-files"
      }
    }, [_vm._v(_vm._s(_vm.bytesToSize(item.fileSize)))]) : _vm._e()], 1) : _vm._e(), _c("div", {
      directives: [{
        name: "show",
        rawName: "v-show",
        value: _vm.isEdit,
        expression: "isEdit"
      }],
      staticClass: "operates"
    }, [item.isDelete !== false ? _c("el-link", {
      staticClass: "file-delete",
      attrs: {
        disabled: _vm.disabled,
        type: "primary",
        underline: false,
        icon: "el-icon-close"
      },
      on: {
        click: function click($event) {
          return _vm.onDelete(item, index);
        }
      }
    }) : _vm._e()], 1)]);
  }), 0) : _vm._e(), _vm._t("default")], 2);
};
var staticRenderFns = [];
render._withStripped = true;

;// CONCATENATED MODULE: ./packages/upload-file/src/main.vue?vue&type=template&id=d22ec1b4&

;// CONCATENATED MODULE: external "@babel/runtime/helpers/defineProperty"
var defineProperty_namespaceObject = require("@babel/runtime/helpers/defineProperty");
var defineProperty_default = /*#__PURE__*/__webpack_require__.n(defineProperty_namespaceObject);
;// CONCATENATED MODULE: external "@babel/runtime/helpers/asyncToGenerator"
var asyncToGenerator_namespaceObject = require("@babel/runtime/helpers/asyncToGenerator");
var asyncToGenerator_default = /*#__PURE__*/__webpack_require__.n(asyncToGenerator_namespaceObject);
;// CONCATENATED MODULE: external "@babel/runtime/regenerator"
var regenerator_namespaceObject = require("@babel/runtime/regenerator");
var regenerator_default = /*#__PURE__*/__webpack_require__.n(regenerator_namespaceObject);
;// CONCATENATED MODULE: external "jdf-jssdk"
var external_jdf_jssdk_namespaceObject = require("jdf-jssdk");
;// CONCATENATED MODULE: external "lodash/cloneDeep"
var cloneDeep_namespaceObject = require("lodash/cloneDeep");
var cloneDeep_default = /*#__PURE__*/__webpack_require__.n(cloneDeep_namespaceObject);
;// CONCATENATED MODULE: external "lodash/isEmpty"
var isEmpty_namespaceObject = require("lodash/isEmpty");
var isEmpty_default = /*#__PURE__*/__webpack_require__.n(isEmpty_namespaceObject);
;// CONCATENATED MODULE: external "globalthis/implementation"
var implementation_namespaceObject = require("globalthis/implementation");
;// CONCATENATED MODULE: external "@babel/runtime/helpers/toConsumableArray"
var toConsumableArray_namespaceObject = require("@babel/runtime/helpers/toConsumableArray");
var toConsumableArray_default = /*#__PURE__*/__webpack_require__.n(toConsumableArray_namespaceObject);
;// CONCATENATED MODULE: external "lodash/isFunction"
var isFunction_namespaceObject = require("lodash/isFunction");
var isFunction_default = /*#__PURE__*/__webpack_require__.n(isFunction_namespaceObject);
;// CONCATENATED MODULE: ./src/utils/tools/isEmptyStr.js
/*
 * @Author: lirl
 * @Date: 2023-02-26 20:29:26
 * @Description: 判断是否为空字符串
 */
function isEmptyStr_isEmptyStr(str) {
  return str === '' || str === null || str === undefined;
}
;// CONCATENATED MODULE: external "lodash/head"
var head_namespaceObject = require("lodash/head");
var head_default = /*#__PURE__*/__webpack_require__.n(head_namespaceObject);
;// CONCATENATED MODULE: external "lodash/last"
var last_namespaceObject = require("lodash/last");
var last_default = /*#__PURE__*/__webpack_require__.n(last_namespaceObject);
;// CONCATENATED MODULE: ./src/utils/tools/getFileNameAndExtension.js
/*
 * @Author: lirl
 * @Date: 2023-02-26 20:56:02
 * @Description: 获取文件名称及扩展名
 */


function getFileNameAndExtension(fileName) {
  if (fileName) {
    var array = fileName.split('.');
    return {
      name: head_default()(array),
      extension: last_default()(array)
    };
  }
  return {};
}
;// CONCATENATED MODULE: ./src/utils/tools/bytesToSize.js
/*
 * @Author: lirl
 * @Date: 2023-02-26 20:57:16
 * @Description: 计算文件大小
 */
function bytesToSize(bytes) {
  if (bytes === 0) {
    return '0 B';
  }
  var k = 1024;
  var sizes = ['B', 'KB', 'MB', 'GB', 'TB'];
  var i = Math.floor(Math.log(bytes) / Math.log(k));
  return "".concat((bytes / Math.pow(k, i)).toPrecision(3), " ").concat(sizes[i]);
}
;// CONCATENATED MODULE: ./src/utils/file.js
/*
 * @Author: lirl
 * @Date: 2022-04-21 09:32:16
 * @Description: 文件工具方法
 */

var file = {
  downloadFileByBlob: function downloadFileByBlob(blob, fileName) {
    (function (w, d) {
      // 没有此判断的话，ie11下的导出没有效果
      if (w.navigator.msSaveOrOpenBlob) {
        w.navigator.msSaveOrOpenBlob(blob, fileName);
      } else {
        var downloadElement = d.createElement('a');
        // 创建下载的链接
        var href = w.URL.createObjectURL(blob);
        downloadElement.href = href;
        // 下载后文件名
        downloadElement.download = fileName;
        d.body.appendChild(downloadElement);
        // 点击下载
        downloadElement.click();
        // 下载完成移除元素
        d.body.removeChild(downloadElement);
        // 释放掉blob对象
        w.URL.revokeObjectURL(href);
      }
    })(implementation_namespaceObject.window, implementation_namespaceObject.document);
  }
};
/* harmony default export */ var utils_file = (file);
;// CONCATENATED MODULE: external "dayjs"
var external_dayjs_namespaceObject = require("dayjs");
var external_dayjs_default = /*#__PURE__*/__webpack_require__.n(external_dayjs_namespaceObject);
;// CONCATENATED MODULE: ./src/utils/day-util.js
/*
 * @Author: lirl
 * @Date: 2020-04-21 10:08:54
 * @LastEditTime: 2022-04-21 09:40:22
 * @Description: 日期转换工具方法
 */


/**
 * 将毫秒值的时间格式化为format格式.
 * @param {Number} millisecond 毫秒
 * @param {String} format 要转换的格式
 */
var formatMillisecondToString = function formatMillisecondToString(millisecond) {
  var format = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'YYYY-MM-DD HH:mm:ss';
  return millisecond ? external_dayjs_default()(millisecond).format(format) : '';
};

/**
 * 获取当前时间的毫秒值
 */
var getCurrentMillisecond = function getCurrentMillisecond() {
  return dayjs().valueOf();
};

;// CONCATENATED MODULE: external "element-ui"
var external_element_ui_namespaceObject = require("element-ui");
;// CONCATENATED MODULE: external "lodash/isString"
var isString_namespaceObject = require("lodash/isString");
;// CONCATENATED MODULE: ./src/utils/message.js


/*
 * @Author: lirl
 * @Date: 2020-06-03 15:09:21
 * @LastEditTime: 2023-03-02 14:10:57
 * @Description: 消息提示
 */
// 信息提示框




var TOKEN_CODES = (/* unused pure expression or super */ null && (['B004-000-10', 'B004-000-11', 'B004-000-09']));

/**
 * 消息提示框.
 * @param {String} text 消息提示文字
 * @param {String} type success/warning/info/error,默认为success
 */
var message = function message(text) {
  var type = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'success';
  var duration = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 2000;
  var showClose = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : false;
  var className = type === 'success' ? 'pj-common-message' : 'pj-ui-validate';
  return (0,external_element_ui_namespaceObject.Message)({
    message: text,
    type: type,
    offset: 300,
    dangerouslyUseHTMLString: false,
    duration: duration,
    showClose: showClose,
    customClass: className
  });
};

/**
 * 弹出提示框.
 * @param {String} content 提示内容
 * @param {String} type 提示类型 success / info / warning / error
 * @param {Boolean} center 是否居中显示
 */
var messageAlert = function messageAlert(content) {
  var type = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'success';
  var center = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
  return MessageBox.alert(content, '提示', {
    confirmButtonText: '确定',
    type: type,
    dangerouslyUseHTMLString: false,
    center: center
  });
};

/**
 * 弹出确认框.
 * @param {String} content 提示内容
 * @param {Function} yes 点击确定按钮的回调
 * @param {Function} cancel 点击取消按钮的回调
 * @returns Promise 调用方式： mmessageConfirm("提示信息", () => {
 *  alert('确定');
 * }, () => {
 *  alert('取消');
 * })
 */
var messageConfirm = /*#__PURE__*/function () {
  var _ref = asyncToGenerator_default()( /*#__PURE__*/regenerator_default().mark(function _callee(content, yes, cancel) {
    var title,
      _args = arguments;
    return regenerator_default().wrap(function _callee$(_context) {
      while (1) switch (_context.prev = _context.next) {
        case 0:
          title = _args.length > 3 && _args[3] !== undefined ? _args[3] : '温馨提示';
          _context.prev = 1;
          _context.next = 4;
          return external_element_ui_namespaceObject.MessageBox.confirm(content, title, {
            confirmButtonText: '确定',
            cancelButtonText: '取消',
            cancelButtonClass: 'fr ml10',
            confirmButtonClass: 'fr',
            type: 'warning',
            lockScroll: false,
            dangerouslyUseHTMLString: false,
            iconClass: 'el-icon-question orange'
          });
        case 4:
          return _context.abrupt("return", yes === null || yes === void 0 ? void 0 : yes());
        case 7:
          _context.prev = 7;
          _context.t0 = _context["catch"](1);
          cancel === null || cancel === void 0 ? void 0 : cancel();
          return _context.abrupt("return", false);
        case 11:
        case "end":
          return _context.stop();
      }
    }, _callee, null, [[1, 7]]);
  }));
  return function messageConfirm(_x, _x2, _x3) {
    return _ref.apply(this, arguments);
  };
}();
var showErrorMsg = function showErrorMsg(error, customClass) {
  var msg = isString(error) ? error : error === null || error === void 0 ? void 0 : error.message;
  msg && Message({
    message: msg,
    type: 'warning',
    offset: 300,
    dangerouslyUseHTMLString: false,
    duration: 3000,
    showClose: true,
    customClass: customClass
  });
};

/**
 * 弹出接口错误信息
 */
var alertErrorMsg = function alertErrorMsg(error) {
  if (!error) {
    return;
  }
  if (isString(error)) {
    messageAlert(error, 'warning');
    return;
  }
  var ssoPage = sessionStorage.getItem('ssoPage');
  if (TOKEN_CODES.includes(error.code) && ssoPage) {
    window.open(decodeURIComponent(ssoPage), '_self');
  } else {
    var msg = error === null || error === void 0 ? void 0 : error.message;
    msg && messageAlert(msg, 'warning');
  }
};
var showSubmitPrompt = /*#__PURE__*/(/* unused pure expression or super */ null && (function () {
  var _ref2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee2(msg, wordLimit, isRequired, yesCallback, cancelCallback) {
    var inputWordLimit, _yield$MessageBox$pro, value;
    return _regeneratorRuntime.wrap(function _callee2$(_context2) {
      while (1) switch (_context2.prev = _context2.next) {
        case 0:
          _context2.prev = 0;
          inputWordLimit = wordLimit !== null && wordLimit !== void 0 ? wordLimit : 200;
          _context2.next = 4;
          return MessageBox.prompt(msg, '流程提交', {
            confirmButtonText: '确定',
            cancelButtonText: '取消',
            cancelButtonClass: 'fr ml10',
            confirmButtonClass: 'fr',
            inputValidator: function inputValidator(v) {
              if (isRequired && isEmptyStr(v)) {
                return '请填写意见';
              }
              if ((v === null || v === void 0 ? void 0 : v.length) > inputWordLimit) {
                return "\u8BF7\u6700\u591A\u8F93\u5165".concat(inputWordLimit, "\u5B57");
              }
              return true;
            },
            inputErrorMessage: '请填写意见',
            closeOnClickModal: false,
            inputType: 'textarea',
            inputPlaceholder: "\u8BF7\u586B\u5199\u610F\u89C1\uFF0C\u6700\u591A".concat(inputWordLimit, "\u5B57")
          });
        case 4:
          _yield$MessageBox$pro = _context2.sent;
          value = _yield$MessageBox$pro.value;
          yesCallback === null || yesCallback === void 0 ? void 0 : yesCallback(value);
          _context2.next = 12;
          break;
        case 9:
          _context2.prev = 9;
          _context2.t0 = _context2["catch"](0);
          cancelCallback === null || cancelCallback === void 0 ? void 0 : cancelCallback();
        case 12:
        case "end":
          return _context2.stop();
      }
    }, _callee2, null, [[0, 9]]);
  }));
  return function showSubmitPrompt(_x4, _x5, _x6, _x7, _x8) {
    return _ref2.apply(this, arguments);
  };
}()));
;// CONCATENATED MODULE: ./src/mixins/uploadMixin.js



/*
 * @Author: lirl
 * @Date: 2022-12-09 10:23:50
 * @Description: 文件上传混入
 */










/* harmony default export */ var uploadMixin = ({
  props: {
    // 是否禁用
    disabled: {
      type: Boolean,
      default: false
    },
    // 附件关联id
    bizId: {
      type: [String, Function],
      required: true
    },
    // 必选参数，上传的地址
    action: {
      type: String,
      default: '/resource/v1/upload'
    },
    // 设置上传的请求头部
    headers: {
      type: Object,
      default: function _default() {}
    },
    // 附件目标存储空间
    spaceCode: {
      type: String,
      required: true,
      default: 'default'
    },
    // 上传的文件字段名
    name: {
      type: String,
      default: 'file'
    },
    // 是否支持多选文件
    multiple: {
      type: Boolean,
      default: false
    },
    // 显示的附件数据
    fileList: {
      type: Array,
      default: function _default() {
        return [];
      }
    },
    // 接受上传的文件类型
    accept: {
      type: String,
      default: '.doc,.docx,.pdf,.jpeg,.jpg,.png,.bmp,.xls,.xlsx,.gif,.ppt,.pptx,.zip,.rar,.txt,.log,.mht,.wps,.ofd'
    },
    // 最大允许上传个数
    limit: Number,
    // 上传个数超出时的提示信息
    exceedMsg: String,
    // 附件自定义文件类型
    fileType: String,
    // 附件最大大小，单位为MB
    maxSize: {
      type: Number,
      default: 10
    },
    // 上传文件之前的钩子
    beforeUploadFile: Function,
    // 删除文件之前的钩子
    beforeFileDelete: Function
  },
  data: function data() {
    return {
      bytesToSize: bytesToSize,
      formatMillisecondToString: formatMillisecondToString,
      isEmpty: (isEmpty_default()),
      // 要上传的文件对象
      fileRaw: null,
      loading: false
    };
  },
  computed: {
    tempFileList: {
      get: function get() {
        return cloneDeep_default()(this.fileList);
      },
      set: function set(val) {
        this.$emit('update:fileList', val);
      }
    },
    // 附件上传关联的业务id
    relatedBizId: function relatedBizId() {
      var bizId = this.bizId;
      return isFunction_default()(bizId) ? bizId() : bizId;
    },
    // 上传时附带的额外参数
    params: function params() {
      return {
        owner: this.relatedBizId,
        spaceCode: this.spaceCode,
        fileType: this.fileType
      };
    },
    // 上传地址
    uploadAction: function uploadAction() {
      return "".concat(this.$JDF.baseUrl).concat(this.action);
    }
  },
  methods: {
    /**
     * 下载附件
     * @param {String} id 附件id
     */
    downloadFile: function downloadFile(id, fileName) {
      var _this = this;
      return asyncToGenerator_default()( /*#__PURE__*/regenerator_default().mark(function _callee() {
        var res, blob;
        return regenerator_default().wrap(function _callee$(_context) {
          while (1) switch (_context.prev = _context.next) {
            case 0:
              _context.prev = 0;
              _context.next = 3;
              return new external_jdf_jssdk_namespaceObject.FileService(_this.$JDF.baseUrl).downloadFile(id);
            case 3:
              res = _context.sent;
              // 新建blob对象
              blob = new Blob([res.data]); // 使用工具方法下载文件
              utils_file.downloadFileByBlob(blob, fileName);
              _context.next = 11;
              break;
            case 8:
              _context.prev = 8;
              _context.t0 = _context["catch"](0);
              message('附件下载失败', 'error');
            case 11:
            case "end":
              return _context.stop();
          }
        }, _callee, null, [[0, 8]]);
      }))();
    },
    /**
     * 上传文件之前的钩子，参数为上传的文件，若返回 false 或者返回 Promise 且被 reject，则停止上传
     * @param {File} file 上传文件对象
     */
    beforeUpload: function beforeUpload(file) {
      // 如果beforeUploadFun为Function并且方法返回false，则停止上传
      if (isFunction_default()(this.beforeUploadFile) && !this.beforeUploadFile(file)) {
        return false;
      }
      // 获取文件扩展名
      var _getFileNameAndExtens = getFileNameAndExtension(file.name),
        extension = _getFileNameAndExtens.extension;
      // 如果接收附件类型不为空，则校验附件类型
      if (!(isEmptyStr_isEmptyStr(this.accept) || this.accept.includes(extension))) {
        message("\u4E0A\u4F20\u6587\u4EF6\u53EA\u80FD\u662F".concat(this.accept, "\u683C\u5F0F!"), 'warning', 3000);
        return false;
      }
      if (file.size === 0) {
        message('不能上传大小为0MB的文件', 'warning', 3000);
        return false;
      }
      var isGtMaxsize = file.size / 1024 / 1024 > this.maxSize;
      // 判断附件大小是否超过限制大小
      if (isGtMaxsize) {
        message("\u4E0A\u4F20\u6587\u4EF6\u5927\u5C0F\u4E0D\u80FD\u8D85\u8FC7".concat(this.maxSize, "MB!"), 'warning', 3000);
        return false;
      }
      return true;
    },
    /**
     * 文件超出个数限制时的钩子
     */
    onExceed: function onExceed() {
      if (this.limit) {
        message(this.exceedMsg || "\u6700\u591A\u53EA\u80FD\u4E0A\u4F20".concat(this.limit, "\u4E2A\u6587\u4EF6"), 'warning', 3000);
      }
    },
    /**
     * 文件上传成功时的钩子
     */
    onSuccess: function onSuccess(response, file, fileList) {
      var _this2 = this;
      this.loading = false;
      if (response.success === false) {
        message(response.message, 'warning', 3000);
      } else {
        var _this$afterSuccess;
        var data = response.data;
        this.tempFileList = [].concat(toConsumableArray_default()(this.tempFileList), [data]);
        (_this$afterSuccess = this.afterSuccess) === null || _this$afterSuccess === void 0 ? void 0 : _this$afterSuccess.call(this, file, data);
      }
      // 获取有响应的fileList的数量
      var responseNumber = fileList.filter(function (t) {
        return t.response;
      }).length;
      this.$nextTick(function () {
        if (responseNumber === fileList.length) {
          _this2.$emit('done', _this2.tempFileList);
        }
      });
    },
    /**
     * 文件上传失败时的钩子
     */
    onError: function onError() {
      this.loading = false;
    },
    /**
     * 上传中
     */
    onProgress: function onProgress() {
      this.loading = true;
    },
    /**
     * 删除附件
     */
    onDelete: function onDelete(_ref, index) {
      var _this3 = this;
      return asyncToGenerator_default()( /*#__PURE__*/regenerator_default().mark(function _callee3() {
        var id, fileName;
        return regenerator_default().wrap(function _callee3$(_context3) {
          while (1) switch (_context3.prev = _context3.next) {
            case 0:
              id = _ref.id, fileName = _ref.fileName;
              if (!(isFunction_default()(_this3.beforeFileDelete) && !_this3.beforeFileDelete(id))) {
                _context3.next = 3;
                break;
              }
              return _context3.abrupt("return");
            case 3:
              messageConfirm("\u786E\u8BA4\u5220\u9664\u9644\u4EF6".concat(fileName, "\uFF1F"), /*#__PURE__*/asyncToGenerator_default()( /*#__PURE__*/regenerator_default().mark(function _callee2() {
                var _this3$afterDelete;
                return regenerator_default().wrap(function _callee2$(_context2) {
                  while (1) switch (_context2.prev = _context2.next) {
                    case 0:
                      _context2.prev = 0;
                      _context2.next = 3;
                      return new external_jdf_jssdk_namespaceObject.FileService(_this3.$JDF.baseUrl).deleteById(id);
                    case 3:
                      _this3.tempFileList = _this3.tempFileList.filter(function (v) {
                        return v.id !== id;
                      });
                      (_this3$afterDelete = _this3.afterDelete) === null || _this3$afterDelete === void 0 ? void 0 : _this3$afterDelete.call(_this3, id, index);
                      _this3.$emit('deleteFile', id, index);
                      message('附件删除成功');
                      _context2.next = 12;
                      break;
                    case 9:
                      _context2.prev = 9;
                      _context2.t0 = _context2["catch"](0);
                      message('附件删除失败', 'error');
                    case 12:
                    case "end":
                      return _context2.stop();
                  }
                }, _callee2, null, [[0, 9]]);
              })), null, '删除附件');
            case 4:
            case "end":
              return _context3.stop();
          }
        }, _callee3);
      }))();
    },
    /**
     * 组件内部刷新数据
     */
    refreshDataInner: function refreshDataInner() {
      var _this4 = this;
      return asyncToGenerator_default()( /*#__PURE__*/regenerator_default().mark(function _callee4() {
        var _list$find;
        var spaceCode, list, attachments;
        return regenerator_default().wrap(function _callee4$(_context4) {
          while (1) switch (_context4.prev = _context4.next) {
            case 0:
              spaceCode = _this4.spaceCode;
              _context4.next = 3;
              return new external_jdf_jssdk_namespaceObject.ResourceSpaceService(_this4.$JDF.bizUrl).getResourceSpaceFileList(spaceCode, _this4.relatedBizId);
            case 3:
              list = _context4.sent;
              attachments = list === null || list === void 0 ? void 0 : (_list$find = list.find(function (t) {
                return t.spaceCode === spaceCode;
              })) === null || _list$find === void 0 ? void 0 : _list$find.resourceVoList;
              if (!isEmpty_default()(attachments)) {
                _this4.tempFileList = attachments;
              }
            case 6:
            case "end":
              return _context4.stop();
          }
        }, _callee4);
      }))();
    }
  }
});
;// CONCATENATED MODULE: ./node_modules/babel-loader/lib/index.js!./node_modules/vue-loader/lib/index.js??vue-loader-options!./packages/upload-file/src/main.vue?vue&type=script&lang=js&



function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { defineProperty_default()(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }





// import FilePreview from '../../components/FilePreview';

/* harmony default export */ var mainvue_type_script_lang_js_ = ({
  name: 'JdfUploadFile',
  mixins: [uploadMixin],
  model: {
    prop: 'value',
    event: 'change-v'
  },
  props: {
    value: {
      type: Array,
      default: function _default() {
        return [];
      }
    },
    isEdit: {
      type: Boolean,
      default: true
    },
    // 展示的信息
    infoFields: Array,
    // 注释
    remark: String,
    // 按钮名称
    btnName: {
      type: String,
      default: '点击上传'
    },
    // 是否为展示图片
    needPreview: {
      type: Boolean,
      default: false
    },
    // 图片的object-fit
    objectFit: {
      type: String,
      default: 'contain'
    }
  },
  watch: {
    value: {
      handler: function handler(val, oldVal) {
        if (this.needPreview && !isEmpty_default()(val) && isEmpty_default()(oldVal) && isEmpty_default()(this.previewList)) {
          this.getImageList(val);
        }
      },
      immediate: true
    }
  },
  data: function data() {
    return {
      previewList: []
    };
  },
  computed: {
    tempFileList: {
      get: function get() {
        return cloneDeep_default()(this.value);
      },
      set: function set(val) {
        this.$emit('change-v', cloneDeep_default()(val));
      }
    }
  },
  methods: {
    /**
     * 获取图片预览地址
     * @param {*} list 图片列表
     */
    getImageList: function getImageList(list) {
      var _this = this;
      return asyncToGenerator_default()( /*#__PURE__*/regenerator_default().mark(function _callee2() {
        var getImgSrc, previewList;
        return regenerator_default().wrap(function _callee2$(_context2) {
          while (1) switch (_context2.prev = _context2.next) {
            case 0:
              _this.previewList = new Array(list.length);
              getImgSrc = _this.getImgSrc, previewList = _this.previewList;
              list.map( /*#__PURE__*/function () {
                var _ref = asyncToGenerator_default()( /*#__PURE__*/regenerator_default().mark(function _callee(t, index) {
                  var src;
                  return regenerator_default().wrap(function _callee$(_context) {
                    while (1) switch (_context.prev = _context.next) {
                      case 0:
                        _context.next = 2;
                        return getImgSrc(t.fileId);
                      case 2:
                        src = _context.sent;
                        if (src) {
                          previewList.splice(index, 1, _objectSpread(_objectSpread({}, t), {}, {
                            src: src
                          }));
                        }
                      case 4:
                      case "end":
                        return _context.stop();
                    }
                  }, _callee);
                }));
                return function (_x, _x2) {
                  return _ref.apply(this, arguments);
                };
              }());
            case 3:
            case "end":
              return _context2.stop();
          }
        }, _callee2);
      }))();
    },
    /**
     * 获取图片地址
     */
    getImgSrc: function getImgSrc(id) {
      var _this2 = this;
      return asyncToGenerator_default()( /*#__PURE__*/regenerator_default().mark(function _callee3() {
        var res, data;
        return regenerator_default().wrap(function _callee3$(_context3) {
          while (1) switch (_context3.prev = _context3.next) {
            case 0:
              _context3.next = 2;
              return new external_jdf_jssdk_namespaceObject.FileService(_this2.$JDF.baseUrl).downloadFile(id);
            case 2:
              res = _context3.sent;
              data = res.data;
              return _context3.abrupt("return", data.size === 0 ? '' : implementation_namespaceObject.window.URL.createObjectURL(res.data));
            case 5:
            case "end":
              return _context3.stop();
          }
        }, _callee3);
      }))();
    },
    /**
     * 上传成功后预览图片
     * @param {*} file 文件对象
     * @param {*} data 文件数据
     */
    afterSuccess: function afterSuccess(file, data) {
      if (this.needPreview) {
        this.previewList.push(_objectSpread(_objectSpread({}, data), {}, {
          src: implementation_namespaceObject.window.URL.createObjectURL(new Blob([file.raw]))
        }));
      }
    },
    /**
     * 删除附件
     * @param {*} id 
     * @param {*} index 
     */
    afterDelete: function afterDelete(id, index) {
      if (this.needPreview) {
        this.previewList.splice(index, 1);
      }
    }
  }
});
;// CONCATENATED MODULE: ./packages/upload-file/src/main.vue?vue&type=script&lang=js&
 /* harmony default export */ var src_mainvue_type_script_lang_js_ = (mainvue_type_script_lang_js_); 
;// CONCATENATED MODULE: ./node_modules/vue-loader/lib/runtime/componentNormalizer.js
/* globals __VUE_SSR_CONTEXT__ */

// IMPORTANT: Do NOT use ES2015 features in this file (except for modules).
// This module is a runtime utility for cleaner component module output and will
// be included in the final webpack user bundle.

function normalizeComponent(
  scriptExports,
  render,
  staticRenderFns,
  functionalTemplate,
  injectStyles,
  scopeId,
  moduleIdentifier /* server only */,
  shadowMode /* vue-cli only */
) {
  // Vue.extend constructor export interop
  var options =
    typeof scriptExports === 'function' ? scriptExports.options : scriptExports

  // render functions
  if (render) {
    options.render = render
    options.staticRenderFns = staticRenderFns
    options._compiled = true
  }

  // functional template
  if (functionalTemplate) {
    options.functional = true
  }

  // scopedId
  if (scopeId) {
    options._scopeId = 'data-v-' + scopeId
  }

  var hook
  if (moduleIdentifier) {
    // server build
    hook = function (context) {
      // 2.3 injection
      context =
        context || // cached call
        (this.$vnode && this.$vnode.ssrContext) || // stateful
        (this.parent && this.parent.$vnode && this.parent.$vnode.ssrContext) // functional
      // 2.2 with runInNewContext: true
      if (!context && typeof __VUE_SSR_CONTEXT__ !== 'undefined') {
        context = __VUE_SSR_CONTEXT__
      }
      // inject component styles
      if (injectStyles) {
        injectStyles.call(this, context)
      }
      // register component module identifier for async chunk inferrence
      if (context && context._registeredComponents) {
        context._registeredComponents.add(moduleIdentifier)
      }
    }
    // used by ssr in case component is cached and beforeCreate
    // never gets called
    options._ssrRegister = hook
  } else if (injectStyles) {
    hook = shadowMode
      ? function () {
          injectStyles.call(
            this,
            (options.functional ? this.parent : this).$root.$options.shadowRoot
          )
        }
      : injectStyles
  }

  if (hook) {
    if (options.functional) {
      // for template-only hot-reload because in that case the render fn doesn't
      // go through the normalizer
      options._injectStyles = hook
      // register for functional component in vue file
      var originalRender = options.render
      options.render = function renderWithStyleInjection(h, context) {
        hook.call(context)
        return originalRender(h, context)
      }
    } else {
      // inject component registration as beforeCreate hook
      var existing = options.beforeCreate
      options.beforeCreate = existing ? [].concat(existing, hook) : [hook]
    }
  }

  return {
    exports: scriptExports,
    options: options
  }
}

;// CONCATENATED MODULE: ./packages/upload-file/src/main.vue





/* normalize component */
;
var component = normalizeComponent(
  src_mainvue_type_script_lang_js_,
  render,
  staticRenderFns,
  false,
  null,
  null,
  null
  
)

/* harmony default export */ var main = (component.exports);
;// CONCATENATED MODULE: ./packages/upload-file/index.js
/*
 * @Author: lirl
 * @Date: 2022-04-21 09:32:16
 * @Description: file content
 */


/* istanbul ignore next */
main.install = function (Vue) {
  Vue.component(main.name, main);
};
/* harmony default export */ var upload_file = (main);
module.exports = __webpack_exports__;
/******/ })()
;