1 line
9.6 KiB
JavaScript
1 line
9.6 KiB
JavaScript
(window["webpackJsonp"]=window["webpackJsonp"]||[]).push([["chunk-214e9a45"],{"51ac":function(e,t,a){"use strict";a.r(t);var r=function(){var e=this,t=e.$createElement,a=e._self._c||t;return a("div",{staticClass:"application"},[a("page-header",[a("div",{staticClass:"page-header-content-view"},[a("div",{staticClass:"content"},[a("p",{staticClass:"description"},[e._v("\n "+e._s(e.$t("General.applicationIsCalled"))+"\n ")]),a("div",{staticClass:"page-header-top-start"},[a("a",{staticClass:"link-item",attrs:{rel:"noopener",href:e.docs.restAPI,target:"_blank"}},[a("i",{staticClass:"icon el-icon-document"}),e._v("\n "+e._s(e.$t("General.productDocumentation"))+"\n ")])])])])]),a("div",{staticClass:"app-wrapper"},[a("a-card",{staticClass:"emq-list-card"},[a("div",{staticClass:"emq-table-header"},[a("el-button",{attrs:{type:"primary",size:"small",icon:"el-icon-plus"},on:{click:function(t){return e.showDialog("create")}}},[e._v("\n "+e._s(e.$t("Base.create"))+"\n ")])],1),a("el-table",{staticClass:"data-list",attrs:{data:e.tableData}},[a("el-table-column",{attrs:{prop:"app_id",label:"AppID"},scopedSlots:e._u([{key:"default",fn:function(t){var r=t.row;return[a("span",{staticClass:"btn",on:{click:function(t){return e.showDialog("view",r)}}},[e._v("\n "+e._s(r.app_id)+"\n ")])]}}])}),a("el-table-column",{attrs:{prop:"name",label:e.$t("General.appName")}}),a("el-table-column",{attrs:{prop:"expired",formatter:e.formatterExpired,label:e.$t("General.expireAt")}}),a("el-table-column",{attrs:{prop:"desc",label:e.$t("General.remark")}}),a("el-table-column",{attrs:{label:e.$t("General.isEnabled")},scopedSlots:e._u([{key:"default",fn:function(t){var r=t.row;return[a("el-switch",{attrs:{"active-color":"#13ce66","inactive-color":"#d0d3e0"},on:{change:function(t){return e.updateApplication(r)}},model:{value:r.status,callback:function(t){e.$set(r,"status",t)},expression:"row.status"}})]}}])}),a("el-table-column",{scopedSlots:e._u([{key:"default",fn:function(t){var r=t.row;return[a("el-button",{attrs:{type:"dashed",size:"mini"},on:{click:function(t){return e.showDialog("edit",r)}}},[e._v("\n "+e._s(e.$t("General.edit"))+"\n ")]),a("el-button",{attrs:{type:"dashed danger",size:"mini"},on:{click:function(t){return e.deleteConfirm(r)}}},[e._v("\n "+e._s(e.$t("General.delete"))+"\n ")])]}}])})],1)],1)],1),a("el-dialog",{attrs:{width:"600px",title:"edit"===e.accessType?e.$t("General.editApp"):e.$t("General.createApp"),visible:e.dialogVisible},on:{"update:visible":function(t){e.dialogVisible=t},close:e.clearInput}},[a("el-form",{ref:"recordForm",attrs:{size:"small",model:e.record,rules:"view"===e.accessType?{}:e.rules}},[a("el-row",{attrs:{gutter:20}},[a("el-col",{attrs:{span:12}},[a("el-form-item",{attrs:{prop:"app_id",label:"AppID"}},[a("el-input",{attrs:{readonly:"create"!==e.accessType,disabled:"edit"===e.accessType},model:{value:e.record.app_id,callback:function(t){e.$set(e.record,"app_id",t)},expression:"record.app_id"}})],1)],1),"view"===e.accessType?a("el-col",{attrs:{span:12}},[a("el-form-item",{attrs:{prop:"secret",label:e.$t("General.secret")}},[a("el-input",{attrs:{disabled:"edit"===e.accessType,readonly:"create"!==e.accessType},model:{value:e.record.secret,callback:function(t){e.$set(e.record,"secret",t)},expression:"record.secret"}})],1)],1):e._e(),a("el-col",{attrs:{span:12}},[a("el-form-item",{attrs:{prop:"name",label:e.$t("General.appName")}},[a("el-input",{attrs:{disabled:"edit"===e.accessType,readonly:"view"===e.accessType},model:{value:e.record.name,callback:function(t){e.$set(e.record,"name",t)},expression:"record.name"}})],1)],1),a("el-col",{attrs:{span:12}},[a("el-form-item",{attrs:{prop:"status",label:e.$t("General.isEnabled")}},[a("emq-select",{attrs:{field:{options:e.enableOption},disabled:"view"===e.accessType},model:{value:e.record.status,callback:function(t){e.$set(e.record,"status",t)},expression:"record.status"}})],1)],1),a("el-col",{attrs:{span:12}},[a("el-form-item",{attrs:{prop:"expired",label:e.$t("General.expireAt")}},[a("el-date-picker",{attrs:{type:"date",format:"yyyy-MM-dd","value-format":"yyyy-MM-dd",readonly:"view"===e.accessType},model:{value:e.record.expired,callback:function(t){e.$set(e.record,"expired",t)},expression:"record.expired"}})],1)],1),a("el-col",{attrs:{span:12}},[a("el-form-item",{attrs:{prop:"desc",label:e.$t("General.remark")}},[a("el-input",{attrs:{readonly:"view"===e.accessType},model:{value:e.record.desc,callback:function(t){e.$set(e.record,"desc",t)},expression:"record.desc"}})],1)],1)],1)],1),"view"!==e.accessType?a("div",{staticClass:"dialog-align-footer",attrs:{slot:"footer"},slot:"footer"},[a("el-button",{attrs:{plain:"",size:"small"},on:{click:function(t){e.dialogVisible=!1}}},[e._v(e._s(e.$t("Base.cancel")))]),a("el-button",{attrs:{type:"primary",size:"small"},on:{click:e.save}},[e._v(e._s(e.$t("Base.confirm")))])],1):e._e()],1)],1)},n=[],s=(a("6b54"),a("cebc")),i=(a("96cf"),a("3b8d")),c=a("c1df"),o=a.n(c),l=a("72db"),d=a("90b9"),p={name:"Application",components:{},props:{},data:function(){return{docs:{restAPI:Object(d["g"])("restAPI")},dialogVisible:!1,tableData:[],accessType:"",enableOption:[{label:this.$t("General.enabled"),value:!0},{label:this.$t("General.disabled"),value:!1}],record:{status:!0,desc:""},rules:{name:[{required:!0,message:this.$t("General.pleaseEnterAppName")}],app_id:[{required:!0,message:this.$t("General.pleaseEnterTheAppId")}],status:[{required:!0,message:this.$t("General.pleaseChoose")}]}}},created:function(){this.loadData()},methods:{formatterExpired:function(e){var t=e.expired;return t&&"number"===typeof t?o()(1e3*t).format("YYYY-MM-DD"):this.$t("General.neverExpire")},clearInput:function(){this.$refs.recordForm&&this.$refs.recordForm.resetFields()},loadData:function(){var e=Object(i["a"])(regeneratorRuntime.mark(function e(){return regeneratorRuntime.wrap(function(e){while(1)switch(e.prev=e.next){case 0:return e.next=2,Object(l["h"])();case 2:this.tableData=e.sent;case 3:case"end":return e.stop()}},e,this)}));function t(){return e.apply(this,arguments)}return t}(),loadAppData:function(){var e=Object(i["a"])(regeneratorRuntime.mark(function e(t){var a;return regeneratorRuntime.wrap(function(e){while(1)switch(e.prev=e.next){case 0:return e.next=2,Object(l["k"])(t);case 2:a=e.sent,a.expired&&"number"===typeof a.expired&&(a.expired=o()(1e3*a.expired).format("YYYY-MM-DD")),this.record=a;case 5:case"end":return e.stop()}},e,this)}));function t(t){return e.apply(this,arguments)}return t}(),showDialog:function(e,t){if(this.accessType=e,"edit"===e){var a=Object(s["a"])({},t);a.expired&&"number"===typeof a.expired?a.expired=o()(1e3*a.expired).format("YYYY-MM-DD"):a.expired=void 0,this.record=a}else"view"===e?this.loadAppData(t.app_id):this.record={app_id:Math.random().toString(16).slice(3),status:!0,desc:""};this.dialogVisible=!0},updateApplication:function(e){var t=this;Object(l["l"])(e.app_id,e).then(function(){t.$message.success(t.$t("General.editorialSuccess"))})},save:function(){var e=this,t=this;this.$refs.recordForm.validate(function(a){if(a){var r=Object(s["a"])({},e.record);if(r.expired&&"string"===typeof r.expired)try{r.expired=Math.floor(new Date(r.expired).getTime()/1e3)}catch(i){r.expired=null}if("edit"===t.accessType){var n=t.record.app_id;Object(l["l"])(n,r).then(function(){t.$message.success(e.$t("General.editorialSuccess")),t.dialogVisible=!1,t.accessType="",t.loadData()})}else Object(l["b"])(r).then(function(){t.$message.success(e.$t("General.successfulAppCreation")),t.dialogVisible=!1,t.accessType="",t.loadData()})}})},deleteConfirm:function(e){var t=this,a=this;this.$msgbox.confirm(this.$t("General.confirmDelete"),{confirmButtonText:this.$t("Base.confirm"),cancelButtonText:this.$t("Base.cancel"),type:"warning"}).then(Object(i["a"])(regeneratorRuntime.mark(function r(){return regeneratorRuntime.wrap(function(r){while(1)switch(r.prev=r.next){case 0:Object(l["f"])(e.app_id).then(function(){a.$message.success(t.$t("General.successfulDeletion")),a.loadData()});case 1:case"end":return r.stop()}},r)}))).catch(function(){})}}},u=p,f=(a("bc65"),a("2877")),m=Object(f["a"])(u,r,n,!1,null,null,null);t["default"]=m.exports},"72db":function(e,t,a){"use strict";a.d(t,"h",function(){return n}),a.d(t,"k",function(){return s}),a.d(t,"b",function(){return i}),a.d(t,"l",function(){return c}),a.d(t,"f",function(){return o}),a.d(t,"j",function(){return l}),a.d(t,"d",function(){return d}),a.d(t,"m",function(){return p}),a.d(t,"a",function(){return u}),a.d(t,"g",function(){return f}),a.d(t,"i",function(){return m}),a.d(t,"c",function(){return b}),a.d(t,"e",function(){return v});var r=a("1f75");function n(){return r["a"].get("/apps")}function s(e){return r["a"].get("/apps/".concat(e))}function i(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return r["a"].post("/apps",e)}function c(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return r["a"].put("/apps/".concat(e),t)}function o(e){return r["a"].delete("/apps/".concat(e))}function l(){return r["a"].get("/users")}function d(e){return r["a"].post("/users",e)}function p(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return r["a"].put("/users/".concat(e),t)}function u(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return r["a"].put("/change_pwd/".concat(e),t)}function f(e){return r["a"].delete("/users/".concat(e))}function m(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return r["a"].get("/banned",{params:e})}function b(e){return r["a"].post("/banned",e)}function v(e){var t=e.who,a=e.as;return r["a"].delete("/banned/".concat(a,"/").concat(encodeURIComponent(t)))}},bc65:function(e,t,a){"use strict";var r=a("d240"),n=a.n(r);n.a},d240:function(e,t,a){}}]); |