((typeof self !== 'undefined' ? self : this)["webpackJsonpportal_management_std"] = (typeof self !== 'undefined' ? self : this)["webpackJsonpportal_management_std"] || []).push([[83,89],{

/***/ "07a1":
/***/ (function(module, __webpack_exports__, __webpack_require__) {

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

// CONCATENATED MODULE: ./node_modules/cache-loader/dist/cjs.js?{"cacheDirectory":"node_modules/.cache/vue-loader","cacheIdentifier":"29850416-vue-loader-template"}!./node_modules/vue-loader/lib/loaders/templateLoader.js??vue-loader-options!./node_modules/cache-loader/dist/cjs.js??ref--0-0!./node_modules/vue-loader/lib??vue-loader-options!./node_modules/windicss-webpack-plugin/dist/loaders/windicss-template.cjs!./src/modules/portal-management/components/AddAuthor.vue?vue&type=template&id=fdf8dcf2
var render = function () {var _vm=this;var _h=_vm.$createElement;var _c=_vm._self._c||_h;return _c('el-dialog',{directives:[{name:"dialogDrag",rawName:"v-dialogDrag"}],staticClass:"small-dialog",attrs:{"title":"添加作者","visible":_vm.dialogVisible,"close-on-click-modal":false,"before-close":_vm.closeDialog,"append-to-body":""},on:{"update:visible":function($event){_vm.dialogVisible=$event}}},[_c('div',{staticClass:"mb-20px"},[_c('el-button',{attrs:{"type":"primary","size":"small","disabled":_vm.disabled},on:{"click":_vm.openAddUser}},[_vm._v("添加系统人员")]),_c('el-button',{attrs:{"type":"primary","size":"small","disabled":_vm.disabled},on:{"click":function($event){_vm.authorDialogVisible = true}}},[_vm._v("添加系统外人员")])],1),_c('el-table',{attrs:{"data":_vm.tableData,"height":"385px","border":"","stripe":""}},[_c('el-table-column',{attrs:{"prop":"name","label":"姓名","show-overflow-tooltip":""}}),_c('el-table-column',{attrs:{"prop":"userName","label":"工号","show-overflow-tooltip":""}}),_c('el-table-column',{attrs:{"prop":"deptName","label":"部门","show-overflow-tooltip":""}}),_c('el-table-column',{attrs:{"label":"作者类型"},scopedSlots:_vm._u([{key:"default",fn:function(scope){return [_c('el-select',{staticClass:"w-full",attrs:{"size":"small","disabled":_vm.disabled},model:{value:(scope.row.type),callback:function ($$v) {_vm.$set(scope.row, "type", $$v)},expression:"scope.row.type"}},[(_vm.columnType === _vm.columnTypeEnum.columnVideo)?_c('el-option',{attrs:{"label":"视频作者","value":_vm.columnTypeEnum.columnVideo}}):[_c('el-option',{attrs:{"label":"文字作者","value":_vm.columnTypeEnum.columnText}}),_c('el-option',{attrs:{"label":"图片作者","value":_vm.columnTypeEnum.columnImgText}})]],2)]}}])}),(!_vm.disabled)?_c('el-table-column',{attrs:{"label":"操作","width":"80"},scopedSlots:_vm._u([{key:"default",fn:function(scope){return [_c('el-button',{attrs:{"size":"mini"},on:{"click":function($event){return _vm.deleteRow(scope.$index)}}},[_vm._v("\n          删除\n        ")])]}}],null,false,2241018741)}):_vm._e()],1),_c('div',{staticClass:"text-center",attrs:{"slot":"footer"},slot:"footer"},[(!_vm.disabled)?_c('el-button',{staticClass:"iconfont icon-save",attrs:{"size":"small","type":"primary"},on:{"click":_vm.save}},[_vm._v("保存")]):_vm._e(),_c('el-button',{staticClass:"iconfont icon-close",attrs:{"size":"small"},on:{"click":function($event){return _vm.closeDialog()}}},[_vm._v("取消")])],1),_c('wiz-tree-select',{attrs:{"visible":_vm.userDialogVisible,"treeData":_vm.orgUserTree,"treeCheckField":"isActive","defaultSelectKeys":_vm.defaultSelectKeys,"title":"添加系统人员","treeNodeKey":"key","repeatKey":"id","filterRepeat":true},on:{"update:visible":function($event){_vm.userDialogVisible=$event},"save":_vm.addSystemUser}}),_c('el-dialog',{directives:[{name:"dialogDrag",rawName:"v-dialogDrag"}],staticClass:"mini-dialog",attrs:{"title":"添加系统外人员","visible":_vm.authorDialogVisible,"close-on-click-modal":false,"before-close":_vm.closeAuthorDialog,"append-to-body":""},on:{"update:visible":function($event){_vm.authorDialogVisible=$event}}},[_c('el-form',{ref:"form",attrs:{"model":_vm.form,"label-width":"150px","rules":_vm.rules,"label-position":"right"}},[_c('el-form-item',{attrs:{"label":"作者姓名","prop":"name"}},[_c('el-input',{attrs:{"clearable":"","placeholder":"请输入作者姓名"},model:{value:(_vm.form.name),callback:function ($$v) {_vm.$set(_vm.form, "name", $$v)},expression:"form.name"}})],1)],1),_c('div',{staticClass:"text-center",attrs:{"slot":"footer"},slot:"footer"},[_c('el-button',{staticClass:"iconfont icon-save",attrs:{"size":"small","type":"primary"},on:{"click":_vm.addAuthor}},[_vm._v("保存")]),_c('el-button',{staticClass:"iconfont icon-close",attrs:{"size":"small"},on:{"click":function($event){return _vm.closeAuthorDialog()}}},[_vm._v("取消")])],1)],1)],1)}
var staticRenderFns = []


// CONCATENATED MODULE: ./src/modules/portal-management/components/AddAuthor.vue?vue&type=template&id=fdf8dcf2

// EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/esm/toConsumableArray.js + 3 modules
var toConsumableArray = __webpack_require__("2909");

// EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/esm/objectSpread2.js + 1 modules
var objectSpread2 = __webpack_require__("5530");

// EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/esm/slicedToArray.js + 3 modules
var slicedToArray = __webpack_require__("3835");

// EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/esm/regeneratorRuntime.js
var regeneratorRuntime = __webpack_require__("c7eb");

// EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/esm/asyncToGenerator.js
var asyncToGenerator = __webpack_require__("1da1");

// EXTERNAL MODULE: ./node_modules/core-js/modules/es.array.concat.js
var es_array_concat = __webpack_require__("99af");

// EXTERNAL MODULE: ./node_modules/core-js/modules/es.array.filter.js
var es_array_filter = __webpack_require__("4de4");

// EXTERNAL MODULE: ./node_modules/core-js/modules/es.array.find.js
var es_array_find = __webpack_require__("7db0");

// EXTERNAL MODULE: ./node_modules/core-js/modules/es.array.includes.js
var es_array_includes = __webpack_require__("caad");

// EXTERNAL MODULE: ./node_modules/core-js/modules/es.array.map.js
var es_array_map = __webpack_require__("d81d");

// EXTERNAL MODULE: ./node_modules/core-js/modules/es.array.push.js
var es_array_push = __webpack_require__("14d9");

// EXTERNAL MODULE: ./node_modules/core-js/modules/es.array.splice.js
var es_array_splice = __webpack_require__("a434");

// EXTERNAL MODULE: ./node_modules/core-js/modules/es.function.name.js
var es_function_name = __webpack_require__("b0c0");

// EXTERNAL MODULE: ./node_modules/core-js/modules/es.number.constructor.js
var es_number_constructor = __webpack_require__("a9e3");

// EXTERNAL MODULE: ./node_modules/core-js/modules/es.object.to-string.js
var es_object_to_string = __webpack_require__("d3b7");

// EXTERNAL MODULE: ./node_modules/core-js/modules/es.string.includes.js
var es_string_includes = __webpack_require__("2532");

// EXTERNAL MODULE: ./node_modules/core-js/modules/web.dom-collections.for-each.js
var web_dom_collections_for_each = __webpack_require__("159b");

// EXTERNAL MODULE: ./node_modules/@wiz-api/account/lib/account.umd.js
var account_umd = __webpack_require__("32d0");

// EXTERNAL MODULE: ./src/assets/js/Common.js
var Common = __webpack_require__("2b76");

// EXTERNAL MODULE: ./src/modules/portal-management/js/config.js
var config = __webpack_require__("e2d8");

// CONCATENATED MODULE: ./node_modules/@vue/cli-plugin-babel/node_modules/thread-loader/dist/cjs.js!./node_modules/@vue/cli-plugin-babel/node_modules/babel-loader/lib??ref--12-1!./node_modules/cache-loader/dist/cjs.js??ref--0-0!./node_modules/vue-loader/lib??vue-loader-options!./node_modules/windicss-webpack-plugin/dist/loaders/windicss-template.cjs!./src/modules/portal-management/components/AddAuthor.vue?vue&type=script&lang=js

















//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//




var eafOrganizationUnitUserApi = new account_umd["EafOrganizationUnitUserApi"]();
/* harmony default export */ var AddAuthorvue_type_script_lang_js = ({
  props: {
    visible: {
      type: Boolean,
      default: false
    },
    // 已选作者数据
    authorData: {
      type: Array,
      required: true
    },
    // 已选部门数据
    deptData: {
      type: Array,
      default: function _default() {
        return [];
      }
    },
    // 当前作者类型
    type: {
      type: Number,
      default: 1
    },
    // 栏目类型
    columnType: {
      type: Number,
      default: 1
    },
    disabled: {
      type: Boolean,
      default: false
    }
  },
  data: function data() {
    return {
      tableData: [],
      columnTypeEnum: config["f" /* informationPublishMap */].column,
      userDialogVisible: false,
      authorDialogVisible: false,
      defaultSelectKeys: [],
      orgUserTree: [],
      deptList: [],
      flattenData: [],
      form: {
        name: ''
      },
      rules: {
        name: [{
          required: true,
          message: '请输入作者姓名',
          trigger: 'blur'
        }]
      },
      deleteData: []
    };
  },
  computed: {
    dialogVisible: {
      get: function get() {
        return this.visible;
      },
      set: function set(val) {
        this.$emit('update:visible', val);
      }
    }
  },
  watch: {
    dialogVisible: {
      immediate: true,
      handler: function handler(val) {
        var _this = this;
        return Object(asyncToGenerator["a" /* default */])( /*#__PURE__*/Object(regeneratorRuntime["a" /* default */])().mark(function _callee() {
          return Object(regeneratorRuntime["a" /* default */])().wrap(function _callee$(_context) {
            while (1) switch (_context.prev = _context.next) {
              case 0:
                if (!(_this.orgUserTree.length === 0)) {
                  _context.next = 3;
                  break;
                }
                _context.next = 3;
                return _this.getOrgUserTree();
              case 3:
                if (val) {
                  _this.tableData = [];
                  // 回显作者列表数据
                  _.forEach(_this.authorData, function (item) {
                    // 通过id获取组织机构树中的人员（可能存在多个）
                    var userList = _.filter(_this.flattenData, function (data) {
                      return data.id === item.id;
                    });
                    // 获取对应已选部门的作者
                    var author = _.find(userList, function (user) {
                      return _this.deptData.includes(user.topPid);
                    }) || userList[0];
                    // 存在则为系统人员，不存在则为系统外人员
                    if (author) {
                      var _$find;
                      _this.tableData.push({
                        name: author.name,
                        userName: author.userName,
                        deptId: author.topPid,
                        deptName: ((_$find = _.find(_this.deptList, {
                          organizationUnitId: author.topPid
                        })) === null || _$find === void 0 ? void 0 : _$find.organizationUnitName) || '',
                        type: item.type,
                        id: author.id
                      });
                    } else {
                      _this.tableData.push({
                        name: item.id,
                        type: item.type
                      });
                    }
                  });
                }
              case 4:
              case "end":
                return _context.stop();
            }
          }, _callee);
        }))();
      }
    }
  },
  methods: {
    getOrgUserTree: function getOrgUserTree() {
      var _this2 = this;
      return Object(asyncToGenerator["a" /* default */])( /*#__PURE__*/Object(regeneratorRuntime["a" /* default */])().mark(function _callee2() {
        var _yield$eafOrganizatio, _yield$eafOrganizatio2, err, res;
        return Object(regeneratorRuntime["a" /* default */])().wrap(function _callee2$(_context2) {
          while (1) switch (_context2.prev = _context2.next) {
            case 0:
              _context2.next = 2;
              return eafOrganizationUnitUserApi.getOrganizationUnitUserTree({});
            case 2:
              _yield$eafOrganizatio = _context2.sent;
              _yield$eafOrganizatio2 = Object(slicedToArray["a" /* default */])(_yield$eafOrganizatio, 2);
              err = _yield$eafOrganizatio2[0];
              res = _yield$eafOrganizatio2[1];
              if (!err && res.length) {
                _this2.orgUserTree = _this2.processedTreeData(res[0].childen);
                _this2.flattenData = Object(Common["b" /* treeToOneArray */])(_this2.orgUserTree, 'children');
                _this2.deptList = Object(Common["b" /* treeToOneArray */])(res, 'childen');
              }
            case 7:
            case "end":
              return _context2.stop();
          }
        }, _callee2);
      }))();
    },
    processedTreeData: function processedTreeData(treeData, topItem) {
      var _this3 = this;
      var hanldeData = [];
      treeData.forEach(function (item) {
        var cloneTreeItem = _.cloneDeep(item);
        cloneTreeItem.label = item.organizationUnitName;
        cloneTreeItem.id = item.organizationUnitId;
        cloneTreeItem.key = item.organizationUnitId;
        var hanldeChildren = [];
        if (item.childen && item.childen.length) {
          hanldeChildren = _this3.processedTreeData(item.childen, topItem || item);
        }
        var userList = _.map(item.userList, function (user) {
          return Object(objectSpread2["a" /* default */])(Object(objectSpread2["a" /* default */])({}, user), {}, {
            key: "".concat(item.organizationUnitId, "-").concat(user.id),
            label: user.name,
            topPid: topItem ? topItem.organizationUnitId : item.organizationUnitId
          });
        });
        delete cloneTreeItem.userList;
        delete cloneTreeItem.childen;
        cloneTreeItem.children = [].concat(Object(toConsumableArray["a" /* default */])(hanldeChildren), Object(toConsumableArray["a" /* default */])(userList));
        hanldeData.push(cloneTreeItem);
      });
      return hanldeData;
    },
    openAddUser: function openAddUser() {
      var _this4 = this;
      var curTypeSelect = _.filter(this.tableData, function (item) {
        return item.type === _this4.type;
      });
      this.defaultSelectKeys = _.compact(_.map(curTypeSelect, function (item) {
        return item.id;
      }));
      this.userDialogVisible = true;
    },
    addSystemUser: function addSystemUser(data) {
      var _this5 = this;
      var newData = _.map(data, function (item) {
        var _$find2;
        return {
          name: item.name,
          userName: item.userName,
          deptId: item.topPid,
          deptName: ((_$find2 = _.find(_this5.deptList, {
            organizationUnitId: item.topPid
          })) === null || _$find2 === void 0 ? void 0 : _$find2.organizationUnitName) || '',
          type: _this5.type,
          id: item.id
        };
      });
      this.tableData = _.uniqWith([].concat(Object(toConsumableArray["a" /* default */])(this.tableData), Object(toConsumableArray["a" /* default */])(newData)), function (arrval, othVal) {
        return arrval.id === othVal.id && arrval.type === othVal.type;
      });
    },
    deleteRow: function deleteRow(index) {
      this.deleteData = _.uniqWith([].concat(Object(toConsumableArray["a" /* default */])(this.deleteData), [this.tableData[index]]), _.isEqual);
      this.tableData.splice(index, 1);
    },
    addAuthor: function addAuthor() {
      var _this6 = this;
      this.$refs.form.validate(function (valid) {
        if (valid) {
          var isRepeat = _.find(_this6.tableData, function (item) {
            return !item.id && item.name === _this6.form.name;
          });
          if (isRepeat) {
            _this6.$message.warning("\u5DF2\u5B58\u5728\u7CFB\u7EDF\u5916\u4EBA\u5458\"".concat(_this6.form.name, "\""));
            return;
          }
          _this6.tableData.push({
            name: _this6.form.name,
            type: _this6.type
          });
          _this6.closeAuthorDialog();
        }
      });
    },
    closeAuthorDialog: function closeAuthorDialog(done) {
      this.form = this.$options.data().form;
      this.$refs.form.clearValidate();
      if (done) {
        done();
      } else {
        this.authorDialogVisible = false;
      }
    },
    closeDialog: function closeDialog(done) {
      if (done) {
        done();
      } else {
        this.dialogVisible = false;
      }
    },
    save: function save() {
      this.$emit('save', this.tableData, this.deleteData);
      this.closeDialog();
    }
  }
});
// CONCATENATED MODULE: ./src/modules/portal-management/components/AddAuthor.vue?vue&type=script&lang=js
 /* harmony default export */ var components_AddAuthorvue_type_script_lang_js = (AddAuthorvue_type_script_lang_js); 
// EXTERNAL MODULE: ./node_modules/vue-loader/lib/runtime/componentNormalizer.js
var componentNormalizer = __webpack_require__("2877");

// CONCATENATED MODULE: ./src/modules/portal-management/components/AddAuthor.vue





/* normalize component */

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

/* harmony default export */ var AddAuthor = __webpack_exports__["default"] = (component.exports);

/***/ }),

/***/ "2532":
/***/ (function(module, exports, __webpack_require__) {

"use strict";

var $ = __webpack_require__("23e7");
var uncurryThis = __webpack_require__("e330");
var notARegExp = __webpack_require__("5a34");
var requireObjectCoercible = __webpack_require__("1d80");
var toString = __webpack_require__("577e");
var correctIsRegExpLogic = __webpack_require__("ab13");

var stringIndexOf = uncurryThis(''.indexOf);

// `String.prototype.includes` method
// https://tc39.es/ecma262/#sec-string.prototype.includes
$({ target: 'String', proto: true, forced: !correctIsRegExpLogic('includes') }, {
  includes: function includes(searchString /* , position = 0 */) {
    return !!~stringIndexOf(
      toString(requireObjectCoercible(this)),
      toString(notARegExp(searchString)),
      arguments.length > 1 ? arguments[1] : undefined
    );
  }
});


/***/ }),

/***/ "44e7":
/***/ (function(module, exports, __webpack_require__) {

"use strict";

var isObject = __webpack_require__("861d");
var classof = __webpack_require__("c6b6");
var wellKnownSymbol = __webpack_require__("b622");

var MATCH = wellKnownSymbol('match');

// `IsRegExp` abstract operation
// https://tc39.es/ecma262/#sec-isregexp
module.exports = function (it) {
  var isRegExp;
  return isObject(it) && ((isRegExp = it[MATCH]) !== undefined ? !!isRegExp : classof(it) === 'RegExp');
};


/***/ }),

/***/ "5a34":
/***/ (function(module, exports, __webpack_require__) {

"use strict";

var isRegExp = __webpack_require__("44e7");

var $TypeError = TypeError;

module.exports = function (it) {
  if (isRegExp(it)) {
    throw new $TypeError("The method doesn't accept regular expressions");
  } return it;
};


/***/ }),

/***/ "ab13":
/***/ (function(module, exports, __webpack_require__) {

"use strict";

var wellKnownSymbol = __webpack_require__("b622");

var MATCH = wellKnownSymbol('match');

module.exports = function (METHOD_NAME) {
  var regexp = /./;
  try {
    '/./'[METHOD_NAME](regexp);
  } catch (error1) {
    try {
      regexp[MATCH] = false;
      return '/./'[METHOD_NAME](regexp);
    } catch (error2) { /* empty */ }
  } return false;
};


/***/ })

}]);
//# sourceMappingURL=portal-management-std.umd.83.js.map