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

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

/* (ignored) */

/***/ }),

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

!function(t,e){ true?module.exports=e():undefined}(this,(function(){"use strict";var t=1e3,e=6e4,n=36e5,r="millisecond",i="second",s="minute",u="hour",a="day",o="week",c="month",f="quarter",h="year",d="date",l="Invalid Date",$=/^(\d{4})[-/]?(\d{1,2})?[-/]?(\d{0,2})[Tt\s]*(\d{1,2})?:?(\d{1,2})?:?(\d{1,2})?[.:]?(\d+)?$/,y=/\[([^\]]+)]|Y{1,4}|M{1,4}|D{1,2}|d{1,4}|H{1,2}|h{1,2}|a|A|m{1,2}|s{1,2}|Z{1,2}|SSS/g,M={name:"en",weekdays:"Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday".split("_"),months:"January_February_March_April_May_June_July_August_September_October_November_December".split("_"),ordinal:function(t){var e=["th","st","nd","rd"],n=t%100;return"["+t+(e[(n-20)%10]||e[n]||e[0])+"]"}},m=function(t,e,n){var r=String(t);return!r||r.length>=e?t:""+Array(e+1-r.length).join(n)+t},v={s:m,z:function(t){var e=-t.utcOffset(),n=Math.abs(e),r=Math.floor(n/60),i=n%60;return(e<=0?"+":"-")+m(r,2,"0")+":"+m(i,2,"0")},m:function t(e,n){if(e.date()<n.date())return-t(n,e);var r=12*(n.year()-e.year())+(n.month()-e.month()),i=e.clone().add(r,c),s=n-i<0,u=e.clone().add(r+(s?-1:1),c);return+(-(r+(n-i)/(s?i-u:u-i))||0)},a:function(t){return t<0?Math.ceil(t)||0:Math.floor(t)},p:function(t){return{M:c,y:h,w:o,d:a,D:d,h:u,m:s,s:i,ms:r,Q:f}[t]||String(t||"").toLowerCase().replace(/s$/,"")},u:function(t){return void 0===t}},g="en",D={};D[g]=M;var p="$isDayjsObject",S=function(t){return t instanceof _||!(!t||!t[p])},w=function t(e,n,r){var i;if(!e)return g;if("string"==typeof e){var s=e.toLowerCase();D[s]&&(i=s),n&&(D[s]=n,i=s);var u=e.split("-");if(!i&&u.length>1)return t(u[0])}else{var a=e.name;D[a]=e,i=a}return!r&&i&&(g=i),i||!r&&g},O=function(t,e){if(S(t))return t.clone();var n="object"==typeof e?e:{};return n.date=t,n.args=arguments,new _(n)},b=v;b.l=w,b.i=S,b.w=function(t,e){return O(t,{locale:e.$L,utc:e.$u,x:e.$x,$offset:e.$offset})};var _=function(){function M(t){this.$L=w(t.locale,null,!0),this.parse(t),this.$x=this.$x||t.x||{},this[p]=!0}var m=M.prototype;return m.parse=function(t){this.$d=function(t){var e=t.date,n=t.utc;if(null===e)return new Date(NaN);if(b.u(e))return new Date;if(e instanceof Date)return new Date(e);if("string"==typeof e&&!/Z$/i.test(e)){var r=e.match($);if(r){var i=r[2]-1||0,s=(r[7]||"0").substring(0,3);return n?new Date(Date.UTC(r[1],i,r[3]||1,r[4]||0,r[5]||0,r[6]||0,s)):new Date(r[1],i,r[3]||1,r[4]||0,r[5]||0,r[6]||0,s)}}return new Date(e)}(t),this.init()},m.init=function(){var t=this.$d;this.$y=t.getFullYear(),this.$M=t.getMonth(),this.$D=t.getDate(),this.$W=t.getDay(),this.$H=t.getHours(),this.$m=t.getMinutes(),this.$s=t.getSeconds(),this.$ms=t.getMilliseconds()},m.$utils=function(){return b},m.isValid=function(){return!(this.$d.toString()===l)},m.isSame=function(t,e){var n=O(t);return this.startOf(e)<=n&&n<=this.endOf(e)},m.isAfter=function(t,e){return O(t)<this.startOf(e)},m.isBefore=function(t,e){return this.endOf(e)<O(t)},m.$g=function(t,e,n){return b.u(t)?this[e]:this.set(n,t)},m.unix=function(){return Math.floor(this.valueOf()/1e3)},m.valueOf=function(){return this.$d.getTime()},m.startOf=function(t,e){var n=this,r=!!b.u(e)||e,f=b.p(t),l=function(t,e){var i=b.w(n.$u?Date.UTC(n.$y,e,t):new Date(n.$y,e,t),n);return r?i:i.endOf(a)},$=function(t,e){return b.w(n.toDate()[t].apply(n.toDate("s"),(r?[0,0,0,0]:[23,59,59,999]).slice(e)),n)},y=this.$W,M=this.$M,m=this.$D,v="set"+(this.$u?"UTC":"");switch(f){case h:return r?l(1,0):l(31,11);case c:return r?l(1,M):l(0,M+1);case o:var g=this.$locale().weekStart||0,D=(y<g?y+7:y)-g;return l(r?m-D:m+(6-D),M);case a:case d:return $(v+"Hours",0);case u:return $(v+"Minutes",1);case s:return $(v+"Seconds",2);case i:return $(v+"Milliseconds",3);default:return this.clone()}},m.endOf=function(t){return this.startOf(t,!1)},m.$set=function(t,e){var n,o=b.p(t),f="set"+(this.$u?"UTC":""),l=(n={},n[a]=f+"Date",n[d]=f+"Date",n[c]=f+"Month",n[h]=f+"FullYear",n[u]=f+"Hours",n[s]=f+"Minutes",n[i]=f+"Seconds",n[r]=f+"Milliseconds",n)[o],$=o===a?this.$D+(e-this.$W):e;if(o===c||o===h){var y=this.clone().set(d,1);y.$d[l]($),y.init(),this.$d=y.set(d,Math.min(this.$D,y.daysInMonth())).$d}else l&&this.$d[l]($);return this.init(),this},m.set=function(t,e){return this.clone().$set(t,e)},m.get=function(t){return this[b.p(t)]()},m.add=function(r,f){var d,l=this;r=Number(r);var $=b.p(f),y=function(t){var e=O(l);return b.w(e.date(e.date()+Math.round(t*r)),l)};if($===c)return this.set(c,this.$M+r);if($===h)return this.set(h,this.$y+r);if($===a)return y(1);if($===o)return y(7);var M=(d={},d[s]=e,d[u]=n,d[i]=t,d)[$]||1,m=this.$d.getTime()+r*M;return b.w(m,this)},m.subtract=function(t,e){return this.add(-1*t,e)},m.format=function(t){var e=this,n=this.$locale();if(!this.isValid())return n.invalidDate||l;var r=t||"YYYY-MM-DDTHH:mm:ssZ",i=b.z(this),s=this.$H,u=this.$m,a=this.$M,o=n.weekdays,c=n.months,f=n.meridiem,h=function(t,n,i,s){return t&&(t[n]||t(e,r))||i[n].slice(0,s)},d=function(t){return b.s(s%12||12,t,"0")},$=f||function(t,e,n){var r=t<12?"AM":"PM";return n?r.toLowerCase():r};return r.replace(y,(function(t,r){return r||function(t){switch(t){case"YY":return String(e.$y).slice(-2);case"YYYY":return b.s(e.$y,4,"0");case"M":return a+1;case"MM":return b.s(a+1,2,"0");case"MMM":return h(n.monthsShort,a,c,3);case"MMMM":return h(c,a);case"D":return e.$D;case"DD":return b.s(e.$D,2,"0");case"d":return String(e.$W);case"dd":return h(n.weekdaysMin,e.$W,o,2);case"ddd":return h(n.weekdaysShort,e.$W,o,3);case"dddd":return o[e.$W];case"H":return String(s);case"HH":return b.s(s,2,"0");case"h":return d(1);case"hh":return d(2);case"a":return $(s,u,!0);case"A":return $(s,u,!1);case"m":return String(u);case"mm":return b.s(u,2,"0");case"s":return String(e.$s);case"ss":return b.s(e.$s,2,"0");case"SSS":return b.s(e.$ms,3,"0");case"Z":return i}return null}(t)||i.replace(":","")}))},m.utcOffset=function(){return 15*-Math.round(this.$d.getTimezoneOffset()/15)},m.diff=function(r,d,l){var $,y=this,M=b.p(d),m=O(r),v=(m.utcOffset()-this.utcOffset())*e,g=this-m,D=function(){return b.m(y,m)};switch(M){case h:$=D()/12;break;case c:$=D();break;case f:$=D()/3;break;case o:$=(g-v)/6048e5;break;case a:$=(g-v)/864e5;break;case u:$=g/n;break;case s:$=g/e;break;case i:$=g/t;break;default:$=g}return l?$:b.a($)},m.daysInMonth=function(){return this.endOf(c).$D},m.$locale=function(){return D[this.$L]},m.locale=function(t,e){if(!t)return this.$L;var n=this.clone(),r=w(t,e,!0);return r&&(n.$L=r),n},m.clone=function(){return b.w(this.$d,this)},m.toDate=function(){return new Date(this.valueOf())},m.toJSON=function(){return this.isValid()?this.toISOString():null},m.toISOString=function(){return this.$d.toISOString()},m.toString=function(){return this.$d.toUTCString()},M}(),k=_.prototype;return O.prototype=k,[["$ms",r],["$s",i],["$m",s],["$H",u],["$W",a],["$M",c],["$y",h],["$D",d]].forEach((function(t){k[t[1]]=function(e){return this.$g(e,t[0],t[1])}})),O.extend=function(t,e){return t.$i||(t(e,_,O),t.$i=!0),O},O.locale=w,O.isDayjs=S,O.unix=function(t){return O(1e3*t)},O.en=D[g],O.Ls=D,O.p={},O}));

/***/ }),

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

"use strict";

var $ = __webpack_require__("23e7");
var $find = __webpack_require__("b727").find;
var addToUnscopables = __webpack_require__("44d2");

var FIND = 'find';
var SKIPS_HOLES = true;

// Shouldn't skip holes
// eslint-disable-next-line es/no-array-prototype-find -- testing
if (FIND in []) Array(1)[FIND](function () { SKIPS_HOLES = false; });

// `Array.prototype.find` method
// https://tc39.es/ecma262/#sec-array.prototype.find
$({ target: 'Array', proto: true, forced: SKIPS_HOLES }, {
  find: function find(callbackfn /* , that = undefined */) {
    return $find(this, callbackfn, arguments.length > 1 ? arguments[1] : undefined);
  }
});

// https://tc39.es/ecma262/#sec-array.prototype-@@unscopables
addToUnscopables(FIND);


/***/ }),

/***/ "a6c9":
/***/ (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/views/information-publish/PublishingMaterialManagement/AddEditDialog.vue?vue&type=template&id=7c565d16&scoped=true
var render = function () {var _vm=this;var _h=_vm.$createElement;var _c=_vm._self._c||_h;return _c('el-card',{staticClass:"!border-none",attrs:{"body-style":{ height: '100%' }}},[_c('div',{staticClass:"w-full h-full"},[(_vm.operateType)?_c('el-page-header',{attrs:{"content":_vm.title},on:{"back":_vm.cancel}}):_c('div',{staticClass:"flex items-center h-32px"},[_c('p',{staticClass:"pl-10px border-l-3px text-18px border-color-primary"},[_vm._v(_vm._s(_vm.title))])]),_c('el-form',{ref:"formRef",staticClass:"my-20px h-[calc(100%-128px)] overflow-auto",attrs:{"model":_vm.formData,"rules":_vm.formRules,"label-width":"150px"}},[_c('el-row',[_c('el-col',{attrs:{"span":8}},[_c('el-form-item',{attrs:{"label":"素材名称","prop":"name"}},[_c('el-input',{attrs:{"size":"small","placeholder":"请输入","clearable":"","disabled":_vm.operateType},model:{value:(_vm.formData.name),callback:function ($$v) {_vm.$set(_vm.formData, "name", $$v)},expression:"formData.name"}})],1)],1),(_vm.tabType === '2')?_c('el-col',{attrs:{"span":8}},[_c('el-form-item',{attrs:{"label":"素材图片","prop":"image"}},[_c('el-upload',{ref:"uploadRef",class:_vm.operateType ? 'hidden' : '',attrs:{"disabled":_vm.operateType,"action":"xxx","http-request":_vm.fileUpload,"file-list":_vm.fileImgList,"before-upload":_vm.beforeUpload,"on-success":_vm.uploadSuccess,"on-remove":_vm.onRemove,"on-preview":_vm.onPreview,"on-exceed":_vm.onExceed,"drag":""}},[_c('i',{staticClass:"el-icon-upload"}),_c('div',{staticClass:"el-upload__text"},[_vm._v("将文件拖到此处，或"),_c('em',[_vm._v("点击上传")])]),_c('div',{staticClass:"el-upload__tip",attrs:{"slot":"tip"},slot:"tip"},[_vm._v("只能上传jpg/png文件，且不超过20mb")])]),(_vm.operateType)?_c('div',_vm._l((_vm.successImgList),function(it,index){return _c('el-image',{key:index,staticClass:"w-60px h-60px mr-10px mb-10px",attrs:{"src":("" + _vm.fileUrl + (it.id)),"preview-src-list":[("" + _vm.fileUrl + (it.id))]}})}),1):_vm._e(),_c('el-image',{ref:"uploadImgRef",staticClass:"w-0 h-0",attrs:{"id":"uploadImgId","src":_vm.clickImg,"preview-src-list":[_vm.clickImg]}})],1)],1):_vm._e(),(_vm.tabType === '3')?_c('el-col',{attrs:{"span":8}},[_c('el-form-item',{attrs:{"label":"素材视频","prop":"video"}},[_c('el-upload',{class:_vm.operateType ? 'hidden' : '',attrs:{"disabled":_vm.operateType,"action":"xxx","http-request":_vm.fileUpload,"file-list":_vm.fileList,"before-upload":_vm.beforeUpload,"on-success":_vm.uploadSuccess,"on-remove":_vm.onRemove,"on-preview":_vm.onPreview,"on-exceed":_vm.onExceed,"drag":""}},[_c('i',{staticClass:"el-icon-upload"}),_c('div',{staticClass:"el-upload__text"},[_vm._v("将文件拖到此处，或"),_c('em',[_vm._v("点击上传")])]),_c('div',{staticClass:"el-upload__tip",attrs:{"slot":"tip"},slot:"tip"},[_vm._v("只能上传一个mp4、wav文件，且不超过200mb")])]),(_vm.operateType)?_c('div',_vm._l((_vm.successFileList),function(it,index){return _c('div',{key:index,staticClass:"pl-10px truncate"},[_c('span',{staticClass:"hover:text-hex-$buttonPrimarySelect hover:bg-$alarmInfoGreyBg hover:rounded-2px p-5px cursor-pointer inline-block w-full leading-20px",on:{"click":function($event){return _vm.onPreview({ name: it.fileName })}}},[_vm._v(_vm._s(it.fileName))])])}),0):_vm._e()],1)],1):_vm._e()],1),(_vm.tabType === '1')?_c('el-row',{staticClass:"mt-20px"},[_c('el-col',{attrs:{"span":24}},[(!_vm.operateType)?_c('richtextEditor',{staticClass:"h-480px",attrs:{"content":_vm.formData.content},on:{"change":_vm.handleRichtextEditor}}):_c('div',{staticClass:"ql-container ql-snow"},[_c('div',{staticClass:"ql-editor",domProps:{"innerHTML":_vm._s(_vm.formData.content)}})])],1)],1):_vm._e()],1),(!_vm.operateType)?_c('div',{staticClass:"text-center pt-20px border-t-1px border-color-default"},[_c('el-button',{attrs:{"type":"primary","size":"small","loading":_vm.saveLoading},on:{"click":_vm.save}},[_vm._v("保存")]),_c('el-button',{attrs:{"size":"small"},on:{"click":_vm.cancel}},[_vm._v("取消")])],1):_vm._e()],1)])}
var staticRenderFns = []


// CONCATENATED MODULE: ./src/modules/portal-management/views/information-publish/PublishingMaterialManagement/AddEditDialog.vue?vue&type=template&id=7c565d16&scoped=true

// 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/objectSpread2.js + 1 modules
var objectSpread2 = __webpack_require__("5530");

// 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.find-index.js
var es_array_find_index = __webpack_require__("c740");

// 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.iterator.js
var es_array_iterator = __webpack_require__("e260");

// 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.function.name.js
var es_function_name = __webpack_require__("b0c0");

// EXTERNAL MODULE: ./node_modules/core-js/modules/es.json.stringify.js
var es_json_stringify = __webpack_require__("e9c4");

// EXTERNAL MODULE: ./node_modules/core-js/modules/es.object.keys.js
var es_object_keys = __webpack_require__("b64b");

// 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.promise.js
var es_promise = __webpack_require__("e6cf");

// EXTERNAL MODULE: ./node_modules/core-js/modules/es.string.iterator.js
var es_string_iterator = __webpack_require__("3ca3");

// EXTERNAL MODULE: ./node_modules/core-js/modules/web.dom-collections.iterator.js
var web_dom_collections_iterator = __webpack_require__("ddb0");

// EXTERNAL MODULE: ./node_modules/@wiz-api/file-management/lib/file-management.umd.js
var file_management_umd = __webpack_require__("3c33");

// EXTERNAL MODULE: ./node_modules/@wiz-api/workbench-std/lib/workbench-std.umd.js
var workbench_std_umd = __webpack_require__("78a9");

// EXTERNAL MODULE: ./node_modules/dayjs/dayjs.min.js
var dayjs_min = __webpack_require__("5a0c");
var dayjs_min_default = /*#__PURE__*/__webpack_require__.n(dayjs_min);

// 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/views/information-publish/PublishingMaterialManagement/AddEditDialog.vue?vue&type=script&lang=js



















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




var fileApi = new file_management_umd["FileApi"]();
var materialApi = new workbench_std_umd["MaterialApi"]();
var richtextEditor = function richtextEditor() {
  return Promise.all(/* import() */[__webpack_require__.e(11), __webpack_require__.e(16), __webpack_require__.e(90)]).then(__webpack_require__.bind(null, "606b"));
};
/* harmony default export */ var AddEditDialogvue_type_script_lang_js = ({
  name: 'componentPublishingMaterialManagement',
  components: {
    richtextEditor: richtextEditor
  },
  props: {
    operateType: {
      type: Boolean,
      default: false
    },
    title: {
      type: String,
      default: ''
    },
    tabType: {
      type: String,
      default: '1'
    },
    userInfo: {
      type: Object,
      default: function _default() {}
    },
    detailData: {
      type: Object,
      default: function _default() {}
    }
  },
  data: function data() {
    return {
      formData: {
        name: '',
        content: '',
        image: '',
        video: ''
      },
      formRules: {
        name: [{
          required: true,
          message: '请输入名称',
          trigger: 'change'
        }]
      },
      saveLoading: false,
      fileImgList: [],
      fileList: [],
      successImgList: [],
      successFileList: [],
      clickImg: '',
      getElTimer: null
    };
  },
  computed: {
    fileUrl: function fileUrl() {
      var fileServer = Wiz.GetModuleServer('file-management');
      return "".concat(fileServer, "/api/file-management/files/public/image/");
    }
  },
  methods: {
    save: function save() {
      var _this = this;
      this.$refs.formRef.validate( /*#__PURE__*/function () {
        var _ref = Object(asyncToGenerator["a" /* default */])( /*#__PURE__*/Object(regeneratorRuntime["a" /* default */])().mark(function _callee(valid) {
          var pubUpdate, pubAdd, resAdd, resUpdate, params1, _params, params3, _params2, _params3, _params4;
          return Object(regeneratorRuntime["a" /* default */])().wrap(function _callee$(_context) {
            while (1) switch (_context.prev = _context.next) {
              case 0:
                if (!valid) {
                  _context.next = 47;
                  break;
                }
                pubUpdate = {
                  uploaderId: _this.detailData.uploaderId,
                  deptId: _this.detailData.deptId,
                  uploadTime: dayjs_min_default()(_this.detailData.uploadTime).format('YYYY-MM-DD HH:mm:ss'),
                  status: _this.detailData.status,
                  name: _this.formData.name
                };
                pubAdd = {
                  uploaderId: _this.userInfo.id,
                  deptId: _this.userInfo.organizationUnits[0].orgId,
                  uploadTime: dayjs_min_default()().format('YYYY-MM-DD HH:mm:ss'),
                  status: 0,
                  name: _this.formData.name
                };
                resAdd = null;
                resUpdate = null;
                _context.t0 = _this.tabType;
                _context.next = _context.t0 === '1' ? 8 : _context.t0 === '2' ? 20 : _context.t0 === '3' ? 32 : 44;
                break;
              case 8:
                if (_this.detailData.id) {
                  _context.next = 15;
                  break;
                }
                params1 = {
                  body: Object(objectSpread2["a" /* default */])({
                    content: _this.formData.content
                  }, pubAdd)
                };
                _context.next = 12;
                return materialApi.addTextMaterial(params1);
              case 12:
                resAdd = _context.sent;
                _context.next = 19;
                break;
              case 15:
                _params = {
                  body: Object(objectSpread2["a" /* default */])({
                    id: _this.detailData.id,
                    content: _this.formData.content
                  }, pubUpdate)
                };
                _context.next = 18;
                return materialApi.updateTextMaterial(_params);
              case 18:
                resUpdate = _context.sent;
              case 19:
                return _context.abrupt("break", 45);
              case 20:
                if (_this.detailData.id) {
                  _context.next = 27;
                  break;
                }
                params3 = {
                  body: Object(objectSpread2["a" /* default */])({
                    image: _this.successImgList.length ? JSON.stringify(_this.successImgList) : ''
                  }, pubAdd)
                };
                _context.next = 24;
                return materialApi.addImageMaterial(params3);
              case 24:
                resAdd = _context.sent;
                _context.next = 31;
                break;
              case 27:
                _params2 = {
                  body: Object(objectSpread2["a" /* default */])({
                    id: _this.detailData.id,
                    image: _this.successImgList.length ? JSON.stringify(_this.successImgList) : ''
                  }, pubUpdate)
                };
                _context.next = 30;
                return materialApi.updateImageMaterial(_params2);
              case 30:
                resUpdate = _context.sent;
              case 31:
                return _context.abrupt("break", 45);
              case 32:
                if (_this.detailData.id) {
                  _context.next = 39;
                  break;
                }
                _params3 = {
                  body: Object(objectSpread2["a" /* default */])({
                    video: _this.successFileList.length ? JSON.stringify(_this.successFileList) : ''
                  }, pubAdd)
                };
                _context.next = 36;
                return materialApi.addVideoMaterial(_params3);
              case 36:
                resAdd = _context.sent;
                _context.next = 43;
                break;
              case 39:
                _params4 = {
                  body: Object(objectSpread2["a" /* default */])({
                    id: _this.detailData.id,
                    video: _this.successFileList.length ? JSON.stringify(_this.successFileList) : ''
                  }, pubUpdate)
                };
                _context.next = 42;
                return materialApi.updateVideoMaterial(_params4);
              case 42:
                resUpdate = _context.sent;
              case 43:
                return _context.abrupt("break", 45);
              case 44:
                return _context.abrupt("break", 45);
              case 45:
                if (resAdd && resAdd.length && !resAdd[0]) {
                  _this.$message.success('新增成功');
                  _this.$emit('success');
                  _this.cancel();
                }
                if (resUpdate && resUpdate.length && !resUpdate[0]) {
                  _this.$message.success('编辑成功');
                  _this.$emit('success');
                  _this.cancel();
                }
              case 47:
              case "end":
                return _context.stop();
            }
          }, _callee);
        }));
        return function (_x) {
          return _ref.apply(this, arguments);
        };
      }());
    },
    cancel: function cancel() {
      this.$emit('close');
      this.successFileList = [];
      this.successImgList = [];
      if (this.getElTimer) clearInterval(this.getElTimer);
    },
    // 处理富文本编辑器传递回来的内容
    handleRichtextEditor: function handleRichtextEditor(content) {
      this.formData.content = content;
    },
    fileUpload: function fileUpload(file) {
      var _this2 = this;
      return Object(asyncToGenerator["a" /* default */])( /*#__PURE__*/Object(regeneratorRuntime["a" /* default */])().mark(function _callee2() {
        var _yield$fileApi$upload, _yield$fileApi$upload2, err, res;
        return Object(regeneratorRuntime["a" /* default */])().wrap(function _callee2$(_context2) {
          while (1) switch (_context2.prev = _context2.next) {
            case 0:
              _context2.next = 2;
              return fileApi.upload({
                files: [file.file],
                authLevel: 2
              });
            case 2:
              _yield$fileApi$upload = _context2.sent;
              _yield$fileApi$upload2 = Object(slicedToArray["a" /* default */])(_yield$fileApi$upload, 2);
              err = _yield$fileApi$upload2[0];
              res = _yield$fileApi$upload2[1];
              if (!err) {
                _this2.successImgList.push(res[0]);
                _this2.successFileList.push(res[0]);
              }
            case 7:
            case "end":
              return _context2.stop();
          }
        }, _callee2);
      }))();
    },
    // 文件上传
    beforeUpload: function beforeUpload(file) {
      if (this.tabType === '2') {
        var isLimit = file.size / 1024 <= 20000;
        if (!isLimit) {
          this.$message.warning('文件大小不能大于20M!');
          return false;
        }
        var isImage = ['image/jpg', 'image/jpeg', 'image/png'];
        var pass = isImage.includes(file.type);
        if (!pass) {
          this.$message.warning('请上传jpg/png格式的图片!');
          return false;
        }
        var nameIndex = this.successImgList.findIndex(function (it) {
          return it.fileName === file.name;
        });
        if (nameIndex !== -1) {
          this.$message.warning('文件名称重复!');
          return false;
        }
        return true;
      }
      if (this.tabType === '3') {
        var _isLimit = file.size / 1024 <= 200000;
        if (!_isLimit) {
          this.$message.warning('文件大小不能大于200M!');
          return false;
        }
        var _isImage = ['video/mp4', 'video/wav'];
        var _pass = _isImage.includes(file.type);
        if (!_pass) {
          this.$message.warning('请上传mp4/wav格式的视频!');
          return false;
        }
        var _nameIndex = this.successFileList.findIndex(function (it) {
          return it.fileName === file.name;
        });
        if (_nameIndex !== -1) {
          this.$message.warning('文件名称重复!');
          return false;
        }
        return true;
      }
      return false;
    },
    uploadSuccess: function uploadSuccess(response, file, fileList) {},
    onPreview: function onPreview(file) {
      var _this3 = this;
      if (this.tabType === '2') {
        var currData = this.successImgList.find(function (it) {
          return it.fileName === file.name;
        });
        if (currData) {
          this.clickImg = "".concat(this.fileUrl).concat(currData.id);
          this.$nextTick(function () {
            if (_this3.getElTimer) clearInterval(_this3.getElTimer);
            _this3.getElTimer = setInterval(function () {
              var el = document.getElementById('uploadImgId');
              if (el) {
                el.click();
                clearInterval(_this3.getElTimer);
              }
            }, 50);
          });
        }
      } else if (this.tabType === '3') {
        var _currData = this.successFileList.find(function (it) {
          return it.fileName === file.name;
        });
        if (_currData) {
          var link = document.createElement('a');
          link.href = "".concat(this.fileUrl).concat(_currData.id);
          link.click();
        }
      }
    },
    onExceed: function onExceed() {
      if (tabType === '3') {
        this.$message.warning('只能上传一个文件');
      }
    },
    onRemove: function onRemove(file) {
      this.successImgList = this.successImgList.filter(function (it) {
        return it.fileName !== file.name;
      });
      this.successFileList = this.successFileList.filter(function (it) {
        return it.fileName !== file.name;
      });
    }
  },
  created: function created() {},
  mounted: function mounted() {},
  watch: {
    detailData: {
      handler: function handler(val) {
        if (val) {
          this.formData.name = val.name;
          switch (this.tabType) {
            case '1':
              this.formData.content = val.content;
              break;
            case '2':
              this.successImgList = val.image ? JSON.parse(val.image) : [];
              this.fileImgList = this.successImgList.map(function (it) {
                it.name = it.fileName;
                return it;
              });
              break;
            case '3':
              this.successFileList = val.video ? JSON.parse(val.video) : [];
              this.fileList = this.successFileList.map(function (it) {
                it.name = it.fileName;
                return it;
              });
              break;
            default:
              break;
          }
        }
      },
      deep: true,
      immediate: true
    }
  },
  beforeDestroy: function beforeDestroy() {
    if (this.getElTimer) clearInterval(this.getElTimer);
  },
  deactivated: function deactivated() {
    if (this.getElTimer) clearInterval(this.getElTimer);
  }
});
// CONCATENATED MODULE: ./src/modules/portal-management/views/information-publish/PublishingMaterialManagement/AddEditDialog.vue?vue&type=script&lang=js
 /* harmony default export */ var PublishingMaterialManagement_AddEditDialogvue_type_script_lang_js = (AddEditDialogvue_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/views/information-publish/PublishingMaterialManagement/AddEditDialog.vue





/* normalize component */

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

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

/***/ }),

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

"use strict";

var $ = __webpack_require__("23e7");
var $findIndex = __webpack_require__("b727").findIndex;
var addToUnscopables = __webpack_require__("44d2");

var FIND_INDEX = 'findIndex';
var SKIPS_HOLES = true;

// Shouldn't skip holes
// eslint-disable-next-line es/no-array-prototype-findindex -- testing
if (FIND_INDEX in []) Array(1)[FIND_INDEX](function () { SKIPS_HOLES = false; });

// `Array.prototype.findIndex` method
// https://tc39.es/ecma262/#sec-array.prototype.findindex
$({ target: 'Array', proto: true, forced: SKIPS_HOLES }, {
  findIndex: function findIndex(callbackfn /* , that = undefined */) {
    return $findIndex(this, callbackfn, arguments.length > 1 ? arguments[1] : undefined);
  }
});

// https://tc39.es/ecma262/#sec-array.prototype-@@unscopables
addToUnscopables(FIND_INDEX);


/***/ })

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