module.exports =
/******/ (function(modules) { // webpackBootstrap
/******/ 	// The module cache
/******/ 	var installedModules = {};
/******/
/******/ 	// The require function
/******/ 	function __webpack_require__(moduleId) {
/******/
/******/ 		// Check if module is in cache
/******/ 		if(installedModules[moduleId]) {
/******/ 			return installedModules[moduleId].exports;
/******/ 		}
/******/ 		// Create a new module (and put it into the cache)
/******/ 		var module = installedModules[moduleId] = {
/******/ 			i: moduleId,
/******/ 			l: false,
/******/ 			exports: {}
/******/ 		};
/******/
/******/ 		// Execute the module function
/******/ 		modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
/******/
/******/ 		// Flag the module as loaded
/******/ 		module.l = true;
/******/
/******/ 		// Return the exports of the module
/******/ 		return module.exports;
/******/ 	}
/******/
/******/
/******/ 	// expose the modules object (__webpack_modules__)
/******/ 	__webpack_require__.m = modules;
/******/
/******/ 	// expose the module cache
/******/ 	__webpack_require__.c = installedModules;
/******/
/******/ 	// define getter function for harmony exports
/******/ 	__webpack_require__.d = function(exports, name, getter) {
/******/ 		if(!__webpack_require__.o(exports, name)) {
/******/ 			Object.defineProperty(exports, name, { enumerable: true, get: getter });
/******/ 		}
/******/ 	};
/******/
/******/ 	// 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 });
/******/ 	};
/******/
/******/ 	// create a fake namespace object
/******/ 	// mode & 1: value is a module id, require it
/******/ 	// mode & 2: merge all properties of value into the ns
/******/ 	// mode & 4: return value when already ns object
/******/ 	// mode & 8|1: behave like require
/******/ 	__webpack_require__.t = function(value, mode) {
/******/ 		if(mode & 1) value = __webpack_require__(value);
/******/ 		if(mode & 8) return value;
/******/ 		if((mode & 4) && typeof value === 'object' && value && value.__esModule) return value;
/******/ 		var ns = Object.create(null);
/******/ 		__webpack_require__.r(ns);
/******/ 		Object.defineProperty(ns, 'default', { enumerable: true, value: value });
/******/ 		if(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key));
/******/ 		return ns;
/******/ 	};
/******/
/******/ 	// getDefaultExport function for compatibility with non-harmony modules
/******/ 	__webpack_require__.n = function(module) {
/******/ 		var getter = module && module.__esModule ?
/******/ 			function getDefault() { return module['default']; } :
/******/ 			function getModuleExports() { return module; };
/******/ 		__webpack_require__.d(getter, 'a', getter);
/******/ 		return getter;
/******/ 	};
/******/
/******/ 	// Object.prototype.hasOwnProperty.call
/******/ 	__webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };
/******/
/******/ 	// __webpack_public_path__
/******/ 	__webpack_require__.p = "/dist/";
/******/
/******/
/******/ 	// Load entry module and return exports
/******/ 	return __webpack_require__(__webpack_require__.s = 157);
/******/ })
/************************************************************************/
/******/ ({

/***/ 0:
/***/ (function(module, __webpack_exports__, __webpack_require__) {

"use strict";
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return normalizeComponent; });
/* 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
  }
}


/***/ }),

/***/ 157:
/***/ (function(module, __webpack_exports__, __webpack_require__) {

"use strict";
// ESM COMPAT FLAG
__webpack_require__.r(__webpack_exports__);

// CONCATENATED MODULE: ./node_modules/vue-loader/lib/loaders/templateLoader.js??vue-loader-options!./node_modules/vue-loader/lib??vue-loader-options!./packages/aos-files/src/main.vue?vue&type=template&id=367755a8&
var render = function() {
  var _vm = this
  var _h = _vm.$createElement
  var _c = _vm._self._c || _h
  return _c(
    "div",
    { staticClass: "aos-files", attrs: { id: _vm.filesId } },
    [
      _vm._l(_vm.categorys, function(item) {
        return _c(
          "div",
          { key: item.id },
          [
            _c(
              "h2",
              { staticClass: "aos-files-first-name" },
              [
                _vm._v(_vm._s(item.name)),
                _vm.showApprove
                  ? _c(
                      "el-button",
                      {
                        staticClass: "aos-file-approval-all",
                        attrs: { type: "text" },
                        on: { click: _vm.handleApprovalAll }
                      },
                      [_vm._v("批量通过")]
                    )
                  : _vm._e()
              ],
              1
            ),
            _vm._l(item.children, function(children) {
              return _c(
                "div",
                { key: children.id, staticClass: "aos-files-fileItem" },
                [
                  _c(
                    "h3",
                    [
                      children.required
                        ? _c("i", {
                            staticClass: "el-icon-star-on aos-file-required"
                          })
                        : _vm._e(),
                      _vm._v(_vm._s(children.name)),
                      _c("span", { staticClass: "aos-file-count" }, [
                        _vm._v(_vm._s(children.fileCountMessage))
                      ]),
                      _c(
                        "el-popover",
                        {
                          attrs: {
                            placement: "bottom",
                            title: children.name + "示例图片",
                            width: "200",
                            trigger: "click"
                          }
                        },
                        [
                          _c("div", [
                            _c("div", {
                              directives: [
                                {
                                  name: "show",
                                  rawName: "v-show",
                                  value: children.exampleImgUrl,
                                  expression: "children.exampleImgUrl"
                                }
                              ],
                              staticStyle: {
                                cursor: "pointer",
                                "background-size": "200px 200px",
                                height: "200px",
                                width: "200px"
                              },
                              style: {
                                "background-image":
                                  "url(" + children.exampleImgUrl + ")"
                              },
                              attrs: { title: "点击预览大图" },
                              on: {
                                click: function($event) {
                                  _vm.handleViewExample(children.exampleImgUrl)
                                }
                              }
                            }),
                            _c(
                              "span",
                              {
                                directives: [
                                  {
                                    name: "show",
                                    rawName: "v-show",
                                    value: !children.exampleImgUrl,
                                    expression: "!children.exampleImgUrl"
                                  }
                                ]
                              },
                              [_vm._v("暂无示例图片")]
                            )
                          ]),
                          _c(
                            "span",
                            {
                              directives: [
                                {
                                  name: "show",
                                  rawName: "v-show",
                                  value: children.exampleImgUrl,
                                  expression: "children.exampleImgUrl"
                                }
                              ],
                              staticClass: "aos-file-example",
                              attrs: { slot: "reference" },
                              slot: "reference"
                            },
                            [_vm._v("示例图片")]
                          )
                        ]
                      )
                    ],
                    1
                  ),
                  _c(
                    "div",
                    [
                      children.children.length > 0
                        ? _c(
                            "div",
                            {
                              staticClass: "aos-files-container",
                              attrs: { id: "aos-files-img-box-" + children.id }
                            },
                            [
                              _vm._l(children.children, function(fileItem) {
                                return _c(
                                  "div",
                                  {
                                    key: fileItem.id,
                                    staticClass: "aos-files-img"
                                  },
                                  [
                                    fileItem.fileExt !== "pdf"
                                      ? _c(
                                          "div",
                                          {
                                            staticClass: "aos-files-img-box",
                                            on: {
                                              click: function($event) {
                                                _vm.handleViewerImg(children)
                                              }
                                            }
                                          },
                                          [
                                            _c("img", {
                                              staticStyle: {
                                                cursor: "pointer"
                                              },
                                              attrs: {
                                                src: fileItem.thumbFileUrl,
                                                alt: fileItem.fileName,
                                                name: fileItem.fileName,
                                                title: fileItem.fileName
                                              }
                                            })
                                          ]
                                        )
                                      : _vm._e(),
                                    fileItem.fileExt === "pdf"
                                      ? _c(
                                          "div",
                                          {
                                            staticClass: "aos-files-img-box",
                                            on: {
                                              click: function($event) {
                                                _vm.handleViewerPdf(fileItem)
                                              }
                                            }
                                          },
                                          [
                                            _c("i", {
                                              staticClass: "el-icon-pdf",
                                              staticStyle: {
                                                cursor: "pointer",
                                                "font-size": "50px"
                                              },
                                              attrs: {
                                                title: fileItem.fileName,
                                                name: fileItem.fileName
                                              }
                                            })
                                          ]
                                        )
                                      : _vm._e(),
                                    _vm.showOperate
                                      ? _c(
                                          "div",
                                          {
                                            staticClass: "aos-files-img-delete"
                                          },
                                          [
                                            _vm.showApprove
                                              ? _c(
                                                  "span",
                                                  {
                                                    staticClass:
                                                      "aos-files-img-disAgree clearfix",
                                                    on: {
                                                      click: function($event) {
                                                        _vm.handleDisAgree(
                                                          fileItem
                                                        )
                                                      }
                                                    }
                                                  },
                                                  [_vm._v("不通过")]
                                                )
                                              : _vm._e(),
                                            _vm.showDelete &&
                                            fileItem.showItemDelete
                                              ? _c("i", {
                                                  staticClass: "el-icon-delete",
                                                  attrs: { title: "删除" },
                                                  on: {
                                                    click: function($event) {
                                                      _vm.handleDeleteImg(
                                                        fileItem
                                                      )
                                                    }
                                                  }
                                                })
                                              : _vm._e(),
                                            _c(
                                              "a",
                                              {
                                                staticStyle: {
                                                  width: "12px",
                                                  "margin-left": "8px"
                                                },
                                                attrs: {
                                                  title: "下载",
                                                  href: fileItem.realFileUrl,
                                                  download:
                                                    fileItem.fileName +
                                                    "." +
                                                    fileItem.fileExt
                                                },
                                                on: {
                                                  click: function($event) {
                                                    _vm.handleDownload(fileItem)
                                                  }
                                                }
                                              },
                                              [
                                                _c("i", {
                                                  staticClass:
                                                    "el-icon-download"
                                                })
                                              ]
                                            ),
                                            _vm.showApprove
                                              ? _c(
                                                  "span",
                                                  {
                                                    staticClass:
                                                      "aos-files-img-agree clearfix",
                                                    on: {
                                                      click: function($event) {
                                                        _vm.handleAgree(
                                                          fileItem
                                                        )
                                                      }
                                                    }
                                                  },
                                                  [_vm._v("通过")]
                                                )
                                              : _vm._e()
                                          ]
                                        )
                                      : _vm._e(),
                                    _c(
                                      "div",
                                      {
                                        staticClass: "aos-files-img-state",
                                        class: {
                                          "is-agree": fileItem.stateAgree,
                                          "is-disAgree": fileItem.stateDisAgree
                                        }
                                      },
                                      [
                                        _c("span", [
                                          _vm._v(_vm._s(fileItem.stateMessage))
                                        ]),
                                        fileItem.stateDisAgree
                                          ? _c(
                                              "el-tooltip",
                                              {
                                                staticClass:
                                                  "aos-files-img-tooltip",
                                                attrs: {
                                                  effect: "light",
                                                  content: fileItem.auditExplain
                                                    ? fileItem.auditExplain
                                                    : "",
                                                  placement: "right"
                                                }
                                              },
                                              [
                                                _c("i", {
                                                  staticClass: "el-icon-warning"
                                                })
                                              ]
                                            )
                                          : _vm._e()
                                      ],
                                      1
                                    ),
                                    _vm.showApprove && fileItem.remark
                                      ? _c(
                                          "div",
                                          {
                                            staticClass: "aos-files-img-remark",
                                            attrs: { title: fileItem.remark }
                                          },
                                          [
                                            _vm._v(
                                              "\n              " +
                                                _vm._s(fileItem.remark) +
                                                "\n            "
                                            )
                                          ]
                                        )
                                      : _vm._e()
                                  ]
                                )
                              }),
                              children.showItemUpload && _vm.showUpload
                                ? _c(
                                    "el-upload",
                                    {
                                      staticClass: "aos-files-upload",
                                      attrs: {
                                        drag: "",
                                        multiple: "",
                                        "show-file-list": false,
                                        action:
                                          "/fids/upload?ruFileId=" +
                                          children.id,
                                        "on-success": _vm.handleUploadSuccess
                                      }
                                    },
                                    [
                                      _c("i", {
                                        staticClass: "el-icon-upload"
                                      }),
                                      _c(
                                        "div",
                                        { staticClass: "el-upload__text" },
                                        [
                                          _vm._v("将文件拖到此处，或"),
                                          _c(
                                            "span",
                                            {
                                              staticClass:
                                                "aos-files-upload-button"
                                            },
                                            [_vm._v("点击上传")]
                                          )
                                        ]
                                      )
                                    ]
                                  )
                                : _vm._e()
                            ],
                            2
                          )
                        : children.showItemUpload && _vm.showUpload
                        ? _c(
                            "el-upload",
                            {
                              staticClass: "aos-files-upload",
                              attrs: {
                                drag: "",
                                multiple: "",
                                "show-file-list": false,
                                action: "/fids/upload?ruFileId=" + children.id,
                                "on-success": _vm.handleUploadSuccess
                              }
                            },
                            [
                              _c("i", { staticClass: "el-icon-upload" }),
                              _c("div", { staticClass: "el-upload__text" }, [
                                _vm._v("将文件拖到此处，或"),
                                _c(
                                  "span",
                                  { staticClass: "aos-files-upload-button" },
                                  [_vm._v("点击上传")]
                                )
                              ])
                            ]
                          )
                        : _vm._e()
                    ],
                    1
                  )
                ]
              )
            })
          ],
          2
        )
      }),
      _c(
        "el-dialog",
        {
          attrs: {
            title: _vm.messageTitle,
            visible: _vm.showMessage,
            "append-to-body": true,
            width: "30%"
          },
          on: {
            "update:visible": function($event) {
              _vm.showMessage = $event
            }
          }
        },
        [
          _c(
            "div",
            [
              _c(
                "el-form",
                { ref: "message", attrs: { "label-width": "80px" } },
                [
                  _c(
                    "el-form-item",
                    { attrs: { label: "意见" } },
                    [
                      _c("el-input", {
                        model: {
                          value: _vm.message,
                          callback: function($$v) {
                            _vm.message = $$v
                          },
                          expression: "message"
                        }
                      })
                    ],
                    1
                  )
                ],
                1
              )
            ],
            1
          ),
          _c(
            "span",
            { attrs: { slot: "footer" }, slot: "footer" },
            [
              _c("el-button", { on: { click: _vm.handleMeaageCancel } }, [
                _vm._v("取 消")
              ]),
              _c(
                "el-button",
                {
                  attrs: { type: "primary" },
                  on: { click: _vm.handleMeaageConfirm }
                },
                [_vm._v("确 定")]
              )
            ],
            1
          )
        ]
      ),
      _c(
        "el-dialog",
        {
          attrs: {
            visible: _vm.dialogVisible,
            "append-to-body": true,
            title: "示例图片预览"
          },
          on: {
            "update:visible": function($event) {
              _vm.dialogVisible = $event
            }
          }
        },
        [
          _c("img", {
            attrs: { width: "100%", src: _vm.dialogImageUrl, alt: "" }
          })
        ]
      ),
      _c("transition", [
        _vm.showImgViewer
          ? _c("div", { staticClass: "aos-img-viewer" })
          : _vm._e()
      ])
    ],
    2
  )
}
var staticRenderFns = []
render._withStripped = true


// CONCATENATED MODULE: ./packages/aos-files/src/main.vue?vue&type=template&id=367755a8&

// EXTERNAL MODULE: external "viewerjs-optimize/dist/viewer-optimize.css"
var viewer_optimize_css_ = __webpack_require__(57);

// EXTERNAL MODULE: external "viewerjs-optimize"
var external_viewerjs_optimize_ = __webpack_require__(52);
var external_viewerjs_optimize_default = /*#__PURE__*/__webpack_require__.n(external_viewerjs_optimize_);

// CONCATENATED MODULE: ./node_modules/babel-loader/lib!./node_modules/vue-loader/lib??vue-loader-options!./packages/aos-files/src/main.vue?vue&type=script&lang=js&
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//



/* harmony default export */ var mainvue_type_script_lang_js_ = ({
  name: 'AosFiles',
  data: function data() {
    return {
      categorys: '', // 文件大类
      files: '', // 文件大类所属的小类别
      fileItems: '', // 文件小类别对应的详细
      messageTitle: '审批意见', // 对应的意见审批意见框的名称
      agree: false, // 判断当前是同意还是不同意,true为同意
      currentFileItem: '', // 当前点击的图片的信息
      showMessage: false, // 是否显示意见框
      message: '', // 意见字段
      viewer: '',
      showImgViewer: false, // 是否显示可拖拽框
      showThumb: true, // 是否显示缩略图
      dialogVisible: false,
      dialogImageUrl: ''
    };
  },

  props: {
    filesId: {
      type: [String, Number],
      default: 'aos-files'
    },
    // 业务类型
    businessModel: {
      type: String,
      required: true
    },
    // 业务主键
    businessPk: {
      type: String,
      required: true
    },
    // 业务场景
    businessScene: {
      type: String,
      default: ''
    },
    // 是否显示操作按钮,
    showOperate: {
      type: Boolean,
      default: true
    },
    // 是否显示上传
    showUpload: {
      type: Boolean,
      default: true
    },
    // 是否显示审批按钮
    showApprove: {
      type: Boolean,
      default: true
    },
    // 是否显示删除按钮
    showDelete: {
      type: Boolean,
      default: true
    },
    // 审批不通过是否显示上传,默认不显示
    showDisagreeUpload: {
      type: Boolean,
      default: false
    }
  },
  methods: {
    handleViewExample: function handleViewExample(url) {
      this.dialogVisible = true;
      this.dialogImageUrl = url;
    },

    /**
     * 批量审批
     */
    handleApprovalAll: function handleApprovalAll() {
      var _this = this;

      var params = {
        businessKey: this.businessPk,
        businessModel: this.businessModel,
        businessScene: this.businessScene
      };
      this.$http({
        url: '/fids/qualifiedBat',
        method: 'post',
        params: params
      }).then(function () {
        _this.$message({
          type: 'success',
          message: '批量审批成功'
        });
        _this.getFileDetail();
      }).catch(function () {
        _this.$message({
          type: 'error',
          message: '批量审批出错'
        });
      });
    },

    // 获取附件详细
    getFileDetail: function getFileDetail() {
      var _this2 = this;

      if (this.viewer) {
        this.viewer.destroy();
      }
      var params = {
        businessModel: this.businessModel,
        businessKey: this.businessPk,
        businessScene: this.businessScene
      };
      return this.$http({
        url: '/fids/file-detail-by-business',
        method: 'get',
        params: params
      }).then(function (res) {
        //categorys 一级标题,
        // files 二级标题
        // fileItems 文件明细
        _this2.categorys = res.data.categorys;
        _this2.files = res.data.files;
        _this2.fileItems = res.data.fileItems;
        _this2.formatArray();
      }).catch(function (res) {
        _this2.$message({
          type: 'error',
          message: '请求附件详情出错'
        });
      });
    },

    // 获取附件详细
    getFileDetailSync: function getFileDetailSync(callback) {
      var that = this;
      if (typeof callback !== 'function' && window.Promise) {
        window.Promise(function (resolve, reject) {
          callback = function callback(valid) {
            valid ? resolve(valid) : reject(valid);
          };
        });
      }
      if (this.viewer) {
        this.viewer.destroy();
      }
      window.Promise.all([that.getFileDetail()]).then(function () {
        callback(true);
      });
    },

    // 格式化当前模板需要使用到的数据格式
    formatArray: function formatArray() {
      var _this3 = this;

      // 构建对应小类别的文件详细
      this.files.forEach(function (item) {
        // let showDisagreeUpload = false;
        // let realShowDisagreeUpload = false;
        var agree = 0;
        var disAgree = 0;
        item.children = [];
        if (item.sampleId) {
          item.exampleImgUrl = '/fids/sample/' + item.sampleId;
        } else {
          item.exampleImgUrl = null;
        }

        _this3.fileItems.forEach(function (childItem) {
          childItem.thumbFileUrl = '/fids/download-thumb/' + childItem.id;
          childItem.realFileUrl = '/fids/download/' + childItem.id;
          childItem.approveDone = true;
          childItem.approveAgree = false;
          // childItem.showDisagreeUpload = false;
          if (childItem.auditStatus === 'new') {
            childItem.showItemDelete = true;
            childItem.stateMessage = "未审批";
            childItem.stateDisAgree = false;
            childItem.stateAgree = false;
            childItem.approveDone = false;
          } else if (childItem.auditStatus === 'qualified') {
            childItem.showItemDelete = false;
            childItem.stateMessage = "审批通过";
            childItem.stateAgree = true; // 控制是否显示审批通过颜色
            childItem.stateDisAgree = false; // 控制是否显示审批未通过颜色
            childItem.approveAgree = true;
          } else if (childItem.auditStatus === 'unqualified') {
            childItem.showItemDelete = false;
            childItem.stateMessage = "审批未通过";
            childItem.stateDisAgree = true;
            childItem.stateAgree = false;
            // if(this.showDisagreeUpload){
            //   childItem.showDisagreeUpload = true;
            // }
          } else {
            childItem.showItemDelete = true;
            childItem.stateMessage = "未审批";
            childItem.stateDisAgree = false;
            childItem.stateAgree = false;
            childItem.approveDone = false;
          }
          if (childItem.ruFileId === item.id) {

            item.children.push(childItem);
            childItem.filesTypeName = item.name;
            if (childItem.auditStatus === 'unqualified') {
              disAgree++;
            } else {
              agree++;
            }
            // realShowDisagreeUpload = childItem.showDisagreeUpload || showDisagreeUpload;
          }
        });
        item.agree = agree;
        item.disAgree = disAgree;
        // if(agree < item.children.length){
        //   realShowDisagreeUpload = true;
        // } else {
        //   realShowDisagreeUpload = false;
        // }
        // item.showDisagreeUpload = realShowDisagreeUpload;
      });
      // 判断当前已上传的图片是否已超出显示
      this.files.forEach(function (item) {
        var fileItemsLenegth = item.agree;
        if (item.quantity.indexOf('+') > -1) {
          item.fileCountMessage = '需要上传最少' + parseInt(item.quantity, 0) + '份资料';
          item.approveAgreeNumber = parseInt(item.quantity, 0);
          item.showItemUpload = true;
          if (fileItemsLenegth >= parseInt(item.quantity.substring(0, 1), 0)) {
            item.isAready = true;
          } else {
            item.isAready = false;
          }
          if (parseInt(item.quantity.substring(0, 1), 0) !== 0) {
            item.required = true;
          } else {
            item.required = false;
          }
        } else if (item.quantity.indexOf('-') > -1) {
          var maxLength = parseInt(item.quantity.substring(0, 1), 0);
          item.approveAgreeNumber = 0;
          item.fileCountMessage = '需要上传最多' + parseInt(item.quantity, 0) + '份资料';
          if (fileItemsLenegth < maxLength) {
            item.showItemUpload = true;
          } else {
            item.showItemUpload = false;
          }
          item.isAready = true;
          item.required = false;
        } else if (item.quantity.indexOf('~') > -1) {
          var minLength = parseInt(item.quantity.substring(0, 1), 0);
          var _maxLength = parseInt(item.quantity.substring(2), 0);
          item.approveAgreeNumber = minLength;
          item.fileCountMessage = "需要上传最少" + minLength + "份资料" + ",最多" + _maxLength + "份资料";
          if (fileItemsLenegth < _maxLength) {
            item.showItemUpload = true;
          } else {
            item.showItemUpload = false;
          }
          if (fileItemsLenegth >= minLength) {
            item.isAready = true;
          } else {
            item.isAready = false;
          }
          item.required = true;
        } else {
          var length = parseInt(item.quantity, 0);
          item.approveAgreeNumber = length;
          item.fileCountMessage = "需要上传" + length + "份资料";
          if (fileItemsLenegth < length) {
            item.showItemUpload = true;
            item.isAready = false;
          } else {
            item.isAready = true;
            item.showItemUpload = false;
          }
          item.required = true;
        }
      });
      this.categorys.forEach(function (item) {
        item.children = [];
        _this3.files.forEach(function (childItem) {
          if (item.id === childItem.ruCategoryId) {
            item.children.push(childItem);
          }
        });
      });
    },

    // 删除图片
    handleDeleteImg: function handleDeleteImg(fileItems) {
      var _this4 = this;

      if (fileItems.auditStatus !== 'new') {
        this.$message({
          type: 'error',
          message: '当前图片已经审批过,不允许删除'
        });
        return;
      }
      this.$confirm('是否删除此图片?', '删除提示', {
        confirmButtonText: '确定',
        cancelButtonText: '取消',
        type: 'warning'
      }).then(function () {
        _this4.$http({
          url: '/fids/deleteFile/' + fileItems.id,
          method: 'delete'
        }).then(function (res) {
          _this4.getFileDetail();
        }).catch(function () {
          _this4.$message({
            type: 'error',
            message: '删除图片出错'
          });
        });
      });
    },
    handleDownload: function handleDownload(fileItem) {
      var a = document.createElement('a');
      if (typeof a.download === 'undefined') {
        var newUrl = window.location.protocol + "//" + window.location.host + fileItem.realFileUrl;
        window.open(newUrl);
      }
    },

    //审批通过
    handleAgree: function handleAgree(fileItems) {
      this.messageTitle = '通过';
      this.agree = true;
      // this.showMessage = true;
      this.currentFileItem = JSON.parse(JSON.stringify(fileItems));
      this.handleMeaageConfirm();
    },

    // 审批不通过
    handleDisAgree: function handleDisAgree(fileItems) {
      this.messageTitle = '不通过';
      this.agree = false;
      this.showMessage = true;
      this.currentFileItem = JSON.parse(JSON.stringify(fileItems));
    },

    // 审批意见取消
    handleMeaageCancel: function handleMeaageCancel(fileItems) {
      this.showMessage = false;
    },

    // 审批意见提交
    handleMeaageConfirm: function handleMeaageConfirm(fileItems) {
      var _this5 = this;

      var url = void 0;
      var submitData = '';
      if (this.agree) {
        url = '/fids/audit/' + this.currentFileItem.id + '/qualified';
      } else {
        url = '/fids/audit/' + this.currentFileItem.id + '/unqualified';
        submitData = {
          auditExplain: this.message
        };
      }
      this.$http({
        url: url,
        method: 'post',
        params: submitData
      }).then(function (res) {
        if (_this5.agree) {
          _this5.$message({
            type: 'success',
            message: '同意操作成功'
          });
        } else {
          _this5.$message({
            type: 'success',
            message: '不同意操作成功'
          });
          _this5.showMessage = false;
        }
        _this5.getFileDetail();
      }).catch(function (res) {
        if (_this5.agree) {
          _this5.$message({
            type: 'error',
            message: '同意操作出错'
          });
        } else {
          _this5.$message({
            type: 'error',
            message: '不同意操作出错'
          });
        }
      });
    },

    // 图片上传成功之后重新请求数据
    handleUploadSuccess: function handleUploadSuccess(response, file, fileLis) {
      this.getFileDetail();
    },

    // 大图预览
    handleViewerImg: function handleViewerImg(children) {
      this.showImgViewer = true;
      // this.showThumb = false; //启用新的viewerjs
      // this.showThumb = true;
      // let itemId = 'aos-files-img-box-' + children.id;
      if (this.viewer) {
        this.viewer.destroy();
        this.viewer = null;
      }
      // document.getElementById('aos-files').addEventListener('hidden',function(){
      //   this.showThumb = true;
      // });
      this.viewer = new external_viewerjs_optimize_default.a(document.getElementById(this.filesId), {
        // inline: true,
        // viewed() {
        //   viewer.zoomTo(1);
        // },
        // container: '#aos-img-viewer',
        className: 'aos-img-viewer-container ' + this.filesId
      });
    },

    // PDF 预览
    handleViewerPdf: function handleViewerPdf(fileItem) {
      var newUrl = window.location.protocol + "//" + window.location.host + "/trd/pdfViewer/web/viewer.html?file=" + fileItem.realFileUrl;
      window.open(newUrl);
    },

    // 校验必传的图片
    checkAready: function checkAready(callback) {
      if (typeof callback !== 'function' && window.Promise) {
        window.Promise(function (resolve, reject) {
          callback = function callback(valid) {
            valid ? resolve(valid) : reject(valid);
          };
        });
      }
      var valid = true;
      var length = this.files.length;
      for (var i = 0; i < length; i++) {
        if (!this.files[i].isAready) {
          valid = false;
          break;
        }
      }
      callback(valid);
    },

    // 检查是否审批
    checkApproveAll: function checkApproveAll(callback) {
      if (typeof callback !== 'function' && window.Promise) {
        window.Promise(function (res, rej) {
          callback = function callback(valid, message) {
            valid ? res(valid, message) : rej(valid, message);
          };
        });
      }
      var length = this.fileItems.length;
      var valid = true;
      var message = '';
      for (var i = 0; i < length; i++) {
        if (!this.fileItems[i].approveDone) {
          // this.$message({
          //   type:'error',
          //   message: this.fileItems[i].filesTypeName + '资料未审批'
          // });
          valid = false;
          message = message + this.fileItems[i].filesTypeName + ',';
        }
      }
      callback(valid, message);
    },

    // 检查是否所以必填项都审批通过
    checkApproveAgree: function checkApproveAgree(callback) {
      if (typeof callback !== 'function' && window.Promise) {
        window.Promise(function (res, rej) {
          callback = function callback(valid, message) {
            valid ? res(valid, message) : rej(valid, message);
          };
        });
      }
      // let length = this.fileItems.length;
      var valid = true;
      for (var i = 0; i < this.files.length; i++) {
        if (this.files[i].approveAgreeNumber > 0) {
          var doneNumber = 0;
          this.files[i].children.forEach(function (item) {
            if (item.auditStatus === 'qualified') {
              doneNumber += 1;
            }
          });
          if (doneNumber < this.files[i].approveAgreeNumber) {
            valid = false;
            break;
          }
        }
      }
      callback(valid);
    },

    // 校验驳回后是否重新上传了图片
    checkRejectApproveUpload: function checkRejectApproveUpload(callback) {
      // let promise;
      if (typeof callback !== 'function' && window.Promise) {
        window.Promise(function (res, rej) {
          callback = function callback(valid) {
            valid ? res(valid) : rej(valid);
          };
        });
      }
      // let length = this.fileItems.length;P
      var valid = true;
      for (var i = 0; i < this.files.length; i++) {
        if (this.files[i].approveAgreeNumber > 0) {
          var doneNumber = 0;
          this.files[i].children.forEach(function (item) {
            if (item.auditStatus !== 'unqualified') {
              doneNumber += 1;
            }
          });
          if (doneNumber < this.files[i].approveAgreeNumber) {
            valid = false;
            break;
          }
        }
      }
      callback(valid);
    }
  },
  created: function created() {
    this.getFileDetail();
  },
  destroyed: function destroyed() {
    if (this.viewer) {
      this.viewer.destroy();
      this.viewer = null;
      document.getElementById(this.filesId).removeEventListener('hidden');
    }
  },

  watch: {
    showDisagreeUpload: function showDisagreeUpload() {
      this.getFileDetail();
    },
    businessPk: function businessPk(val, oldVal) {
      if (val !== oldVal) {
        this.getFileDetail();
      }
    },
    businessModel: function businessModel(val, oldVal) {
      if (val !== oldVal) {
        this.getFileDetail();
      }
    },
    businessScene: function businessScene(val, oldVal) {
      if (val !== oldVal) {
        this.getFileDetail();
      }
    }
  }
});
// CONCATENATED MODULE: ./packages/aos-files/src/main.vue?vue&type=script&lang=js&
 /* harmony default export */ var src_mainvue_type_script_lang_js_ = (mainvue_type_script_lang_js_); 
// EXTERNAL MODULE: ./node_modules/vue-loader/lib/runtime/componentNormalizer.js
var componentNormalizer = __webpack_require__(0);

// CONCATENATED MODULE: ./packages/aos-files/src/main.vue





/* normalize component */

var component = Object(componentNormalizer["a" /* default */])(
  src_mainvue_type_script_lang_js_,
  render,
  staticRenderFns,
  false,
  null,
  null,
  null
  
)

/* hot reload */
if (false) { var api; }
component.options.__file = "packages/aos-files/src/main.vue"
/* harmony default export */ var main = (component.exports);
// CONCATENATED MODULE: ./packages/aos-files/index.js

main.install = function (Vue) {
  Vue.component(main.name, main);
};
/* harmony default export */ var aos_files = __webpack_exports__["default"] = (main);

/***/ }),

/***/ 52:
/***/ (function(module, exports) {

module.exports = require("viewerjs-optimize");

/***/ }),

/***/ 57:
/***/ (function(module, exports) {

module.exports = require("viewerjs-optimize/dist/viewer-optimize.css");

/***/ })

/******/ });