(window.webpackJsonp=window.webpackJsonp||[]).push([["chunk-59d629fb"],{
/***/5092:
/***/function(e,t,a){"use strict";
// ESM COMPAT FLAG
a.r(t);
// CONCATENATED MODULE: ./node_modules/cache-loader/dist/cjs.js?{"cacheDirectory":"node_modules/.cache/vue-loader","cacheIdentifier":"411544a2-vue-loader-template"}!./node_modules/cache-loader/dist/cjs.js??ref--13-0!./node_modules/thread-loader/dist/cjs.js!./node_modules/babel-loader/lib!./node_modules/vue-loader/lib/loaders/templateLoader.js??ref--6!./node_modules/cache-loader/dist/cjs.js??ref--1-0!./node_modules/vue-loader/lib??vue-loader-options!./src/pages/db/DbManager.vue?vue&type=template&id=02e8ced2&scoped=true
a("14d9"),a("b0c0"),a("d3b7"),a("25f0");var r=a("c7eb"),s=a("1da1"),n=a("7424"),o=a("b775");
// CONCATENATED MODULE: ./src/services/dbbackup.js
function i(e){return c.apply(this,arguments)}function c(){return(c=Object(s.a)(Object(r.a)().mark((function e(t){return Object(r.a)().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",Object(o.g)(n.DBBACKUP,o.b.POST,t,{timeout:6e5}));case 1:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function l(e){return u.apply(this,arguments)}function u(){return(u=Object(s.a)(Object(r.a)().mark((function e(t){return Object(r.a)().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",Object(o.g)(n.GETTABLESLIST,o.b.POST,t,{timeout:6e5}));case 1:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function b(e){return d.apply(this,arguments)}function d(){return(d=Object(s.a)(Object(r.a)().mark((function e(t){return Object(r.a)().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",Object(o.g)(n.GETBACKUPLIST,o.b.POST,t,{timeout:6e5}));case 1:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function p(e){return m.apply(this,arguments)}function m(){return(m=Object(s.a)(Object(r.a)().mark((function e(t){return Object(r.a)().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",Object(o.g)(n.DBRESTORE,o.b.POST,t,{timeout:36e5}));case 1:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function f(e){return g.apply(this,arguments)}function g(){return(g=Object(s.a)(Object(r.a)().mark((function e(t){return Object(r.a)().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",Object(o.g)(n.DBDOWN,o.b.POST,t,{timeout:36e5}));case 1:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function h(e){return D.apply(this,arguments)}function D(){return(D=Object(s.a)(Object(r.a)().mark((function e(t){return Object(r.a)().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",Object(o.g)(n.GETDBCONFIG,o.b.POST,t,{timeout:6e5}));case 1:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function k(e){return y.apply(this,arguments)}function y(){return(y=Object(s.a)(Object(r.a)().mark((function e(t){return Object(r.a)().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",Object(o.g)(n.SETDBCONFIG,o.b.POST,t,{timeout:6e5}));case 1:case"end":return e.stop()}}),e)})))).apply(this,arguments)}
/* harmony default export */var S={i18n:a("89fe"),data:function(){return{checkAll:!0,messageShowLoad:!1,indeterminate:!1,SystemTables:[],DbType:"1",DbConfig:{},localUpgradeUrl:n.SQLUPLOAD,GetTables:[],Configuring:!1,form:this.$form.createForm(this),BackupList:[],pagination:{pageSize:15,showSizeChanger:!0},columns:[{width:"20%",slotName:"DbBack.Name",scopedSlots:{customRender:"FileName",title:"DbBack.Name"},dataIndex:"FileName"},{slotName:"DbBack.BackUpTime",width:"20%",scopedSlots:{customRender:"CreateTime",title:"DbBack.BackUpTime"},dataIndex:"CreateTime"},{slotName:"DbBack.FileSize",width:"20%",scopedSlots:{customRender:"FileSize",title:"DbBack.FileSize"},dataIndex:"FileSize"},{slotName:"configComponent.video.TableVideoOpt",width:"10%",scopedSlots:{customRender:"Opt",title:"configComponent.video.TableVideoOpt"}}]}},components:{},mounted:function(){this.GetDbConfig()},methods:{chargeDb:function(e){this.DbType=e},onCheckAllChange:function(e){Object.assign(this,{GetTables:e.target.checked?this.SystemTables:[],indeterminate:!1,checkAll:e.target.checked})},onChange:function(e){this.indeterminate=!!e.length&&e.length<this.SystemTables.length,this.checkAll=e.length===this.SystemTables.length},BackUp:function(){var e=this;if(0!=this.GetTables.length){var t={tables:this.GetTables};this.messageShowLoad=!0,i(t).then((function(t){0==t.data.code?e.$message.success(e.$t("DbBack.BackupsSuccess")):e.$message.error(e.$t("DbBack.BackupsFailed"))})).finally((function(t){e.messageShowLoad=!1}))}else e.$message.error(e.$t("DbBack.BackupsTips"))},GetDbConfig:function(){var e=this;this.messageShowLoad=!0,h({}).then((function(t){0==t.data.code&&(e.DbConfig=t.data.config,e.DbType=e.DbConfig.DbType,e.form.setFieldsValue({DbType:e.DbConfig.DbType.toString()}),0==e.DbType||3==e.DbType?setTimeout((function(){e.form.setFieldsValue({DbUserName:e.DbConfig.Mysqluser.toString(),DbPassword:e.DbConfig.Mysqlpwd.toString(),DbServer:e.DbConfig.Mysqlhost.toString(),DbServerPort:e.DbConfig.Mysqlport.toString(),DbName:e.DbConfig.Mysqldbname.toString()}),e.messageShowLoad=!1}),1e3):e.messageShowLoad=!1)})).catch((function(t){e.messageShowLoad=!1}))},SetDbConfig:function(){var e=this,t=this;this.form.validateFields((function(a){if(!a){var r={DbType:parseInt(e.form.getFieldValue("DbType"))};0!=r.DbType&&3!=r.DbType||(r.Mysqluser=e.form.getFieldValue("DbUserName"),r.Mysqlpwd=e.form.getFieldValue("DbPassword"),r.Mysqlhost=e.form.getFieldValue("DbServer"),r.Mysqlport=e.form.getFieldValue("DbServerPort"),r.Mysqldbname=e.form.getFieldValue("DbName")),e.Configuring=!0,k(r).then((function(e){0==e.data.code?(t.$message.success(t.$t("DbBack.ConfigureSuccess")),t.$router.push("/login")):-3==e.data.code?t.$message.error(t.$t("DbBack.DbConnectError")):t.$message.error(t.$t("DbBack.ConfigureFailed"))})).finally((function(e){t.Configuring=!1}))}}))},callback:function(e){"2"==e?this.GetBackUpList():"1"==e?this.GetTablesList():"3"==e&&this.GetDbConfig()},GetTablesList:function(){var e=this;this.messageShowLoad=!0,e.SystemTables=[],l().then((function(t){if(null==t.data.code){for(var a=0;a<t.data.list.length;a++)""!=t.data.list[a]&&e.SystemTables.push(t.data.list[a]);e.GetTables=e.SystemTables,e.checkAll=!0}})).finally((function(t){e.messageShowLoad=!1}))},GetBackUpList:function(){var e=this;this.messageShowLoad=!0,e.BackupList=[],b().then((function(t){0==t.data.code&&(e.BackupList=t.data.list)})).finally((function(t){e.messageShowLoad=!1}))},DbRestore:function(e){var t=this;this.messageShowLoad=!0,p({DbFilePath:e}).then((function(e){0==e.data.code?(t.$message.success(t.$t("DbBack.RestoreSuccess")),t.$router.push("/login")):t.$message.error(t.$t("DbBack.RestoreFailed"))})).finally((function(e){t.messageShowLoad=!1}))},beforeUpload:function(){this.$message.loading({content:this.$t("dataModel.opcuaModel.ImportNodeIDLoading"),duration:0})},localUpgradeCharge:function(e){this.dataSource=[];if(this.messageShowLoad=!0,"done"===e.file.status){var t=e.file.response;this.$message.destroy(),0==t.Code?(this.$message.success("".concat(e.file.name," ")+this.$t("SystemUpgrade.AuthUploadLoading")),this.$store.state.setting.IsOEM=t.Oem,
// 刷新页面
window.location.reload()):-2==t.Code?this.$message.error("".concat(e.file.name," ")+this.$t("SystemUpgrade.UpgradeFileError")):this.$message.error("".concat(e.file.name," ")+this.$t("SystemUpgrade.UpgradeFileSaveError"))}else if("uploading"===e.file.status);else if("error"===e.file.status){this.$message.loading(this.$t("SystemUpgrade.BeginUpgradeLoading"),0),setTimeout((function(){location.reload()}),1e4)}this.messageShowLoad=!1},DbDown:function(e){var t=this;f({DbFilePath:e}).then((function(e){if(0==e.data.code){
// 创建一个链接标签，用于下载文件
var a=document.createElement("a");a.href=e.data.path,a.target="_blank",document.body.appendChild(a),a.click(),document.body.removeChild(a)}else t.$message.error(t.$t("DbBack.RestoreFailed"))})).finally((function(e){t.messageShowLoad=!1}))}},watch:{}},v=(a("abe8"),a("2877")),w=Object(v.a)(S,(function(){var e=this,t=e._self._c;return t("div",{staticClass:"page-header-index-wide"},[t("a-card",{style:{height:"100%"},attrs:{bordered:!1,bodyStyle:{padding:"16px",height:"100%"}}},[t("a-tabs",{attrs:{"default-active-key":"3"},on:{change:e.callback}},[t("a-tab-pane",{key:"3",attrs:{tab:e.$t("DbBack.DbConfig")}},[t("a-spin",{attrs:{tip:e.$t("DbBack.Loading"),spinning:e.messageShowLoad}},[t("a-form",{attrs:{form:e.form,"label-col":{span:5},"wrapper-col":{span:12}}},[t("a-form-item",{attrs:{label:e.$t("DbBack.DbType")}},[t("a-select",{directives:[{name:"decorator",rawName:"v-decorator",value:["DbType",{rules:[{required:!0,message:e.$t("DbBack.DbType")}]}],expression:"['DbType', { rules: [{ required: true, message: $t('DbBack.DbType') }] }]"}],on:{select:e.chargeDb}},[t("a-select-option",{attrs:{value:"1"}},[e._v(" Sqlite3 ")]),t("a-select-option",{attrs:{value:"0"}},[e._v(" Mysql ")]),t("a-select-option",{attrs:{value:"3"}},[e._v(" 达梦数据库 ")])],1)],1),0==e.DbType||3==e.DbType?t("div",[t("a-form-item",{attrs:{label:e.$t("DbBack.DbServer")}},[t("a-input",{directives:[{name:"decorator",rawName:"v-decorator",value:["DbServer",{rules:[{required:!0,message:e.$t("DbBack.DbServer")}]}],expression:"['DbServer', { rules: [{ required: true, message: $t('DbBack.DbServer') }] }]"}]})],1),t("a-form-item",{attrs:{label:e.$t("DbBack.DbServerPort")}},[t("a-input",{directives:[{name:"decorator",rawName:"v-decorator",value:["DbServerPort",{rules:[{required:!0,message:e.$t("DbBack.DbServerPort")}]}],expression:"['DbServerPort', { rules: [{ required: true, message: $t('DbBack.DbServerPort') }] }]"}]})],1),0==e.DbType?t("a-form-item",{attrs:{label:e.$t("DbBack.DbName")}},[t("a-input",{directives:[{name:"decorator",rawName:"v-decorator",value:["DbName",{rules:[{required:!0,message:e.$t("DbBack.DbName")}]}],expression:"['DbName', { rules: [{ required: true, message: $t('DbBack.DbName') }] }]"}]})],1):e._e(),t("a-form-item",{attrs:{label:e.$t("DbBack.DbUserName")}},[t("a-input",{directives:[{name:"decorator",rawName:"v-decorator",value:["DbUserName",{rules:[{required:!0,message:e.$t("DbBack.DbUserName")}]}],expression:"['DbUserName', { rules: [{ required: true, message: $t('DbBack.DbUserName') }] }]"}]})],1),t("a-form-item",{attrs:{label:e.$t("DbBack.DbPassword")}},[t("a-input",{directives:[{name:"decorator",rawName:"v-decorator",value:["DbPassword",{rules:[{required:!0,message:e.$t("DbBack.DbPassword")}]}],expression:"['DbPassword', { rules: [{ required: true, message: $t('DbBack.DbPassword') }] }]"}],attrs:{type:"password"}})],1)],1):e._e(),t("a-form-item",{attrs:{"wrapper-col":{span:12,offset:5}}},[t("a-button",{attrs:{type:"primary","html-type":"submit",loading:e.Configuring},on:{click:e.SetDbConfig}},[e._v(" "+e._s(e.$t("DbBack.Sure"))+" ")])],1)],1)],1)],1),3!=e.DbType?t("a-tab-pane",{key:"1",attrs:{tab:e.$t("DbBack.Backups")}},[t("a-spin",{attrs:{tip:e.$t("DbBack.BackingUp"),spinning:e.messageShowLoad}},[t("a-checkbox-group",{staticStyle:{"margin-bottom":"10px"},on:{change:e.onChange},model:{value:e.GetTables,callback:function(t){e.GetTables=t},expression:"GetTables"}},[t("a-row",e._l(e.SystemTables,(function(a,r){return t("a-col",{key:r,attrs:{span:8}},[t("a-checkbox",{attrs:{value:a}},[t("span",{staticStyle:{"font-size":"20px","font-weight":"400"}},[e._v(e._s(a))])])],1)})),1)],1),t("a-button",{attrs:{type:"default",loading:e.messageShowLoad},on:{click:e.BackUp}},[e._v(" "+e._s(e.$t("DbBack.Backups"))+" ")]),t("a-checkbox",{staticStyle:{"margin-left":"20px"},attrs:{indeterminate:e.indeterminate,checked:e.checkAll},on:{change:e.onCheckAllChange}},[e._v(" "+e._s(e.$t("DbBack.CheckAll"))+" ")])],1)],1):e._e(),3!=e.DbType?t("a-tab-pane",{key:"2",attrs:{tab:e.$t("DbBack.Restore")}},[t("a-upload",{attrs:{name:"file",multiple:!1,action:e.localUpgradeUrl,showUploadList:!1,beforeUpload:e.beforeUpload},on:{change:e.localUpgradeCharge}},[t("a-button",{attrs:{type:"default"}},[t("a-icon",{attrs:{type:"upload"}}),e._v(" "+e._s(e.$t("DbBack.BackupUpload"))+" ")],1)],1),t("a-spin",{attrs:{tip:e.$t("DbBack.Restoring"),spinning:e.messageShowLoad}},[t("a-table",{attrs:{rowKey:"FileName",pagination:e.pagination,columns:e.columns,"data-source":e.BackupList},scopedSlots:e._u([{key:"Opt",fn:function(a,r){return t("div",{},[t("a",{staticStyle:{cursor:"pointer",color:"#13C2C2"},attrs:{type:"link"},on:{click:function(t){return e.DbRestore(r.FilePath)}}},[t("a-icon",{attrs:{type:"reload"}}),t("span",{staticStyle:{"margin-left":"2px"}},[e._v(e._s(e.$t("DbBack.Restore")))])],1),t("a-divider",{attrs:{type:"vertical"}}),t("a",{staticStyle:{cursor:"pointer",color:"#13C2C2"},attrs:{type:"link"},on:{click:function(t){return e.DbDown(r.FilePath)}}},[t("a-icon",{attrs:{type:"download"}}),t("span",{staticStyle:{"margin-left":"2px"}},[e._v(e._s(e.$t("DbBack.download")))])],1)],1)}}],null,!1,2549271430)},[e._l(e.columns,(function(a,r){return t("template",{slot:a.slotName},[t("span",{key:r},[e._v(e._s(e.$t(a.slotName)))])])}))],2)],1)],1):e._e()],1)],1)],1)}),[],!1,null,"02e8ced2",null)
/* harmony default export */;
// CONCATENATED MODULE: ./node_modules/cache-loader/dist/cjs.js??ref--13-0!./node_modules/thread-loader/dist/cjs.js!./node_modules/babel-loader/lib!./node_modules/cache-loader/dist/cjs.js??ref--1-0!./node_modules/vue-loader/lib??vue-loader-options!./src/pages/db/DbManager.vue?vue&type=script&lang=js
/* harmony default export */t.default=w.exports},
/***/abe8:
/***/function(e,t,a){"use strict";
/* harmony import */a("b914");
/* harmony import */},
/***/b914:
/***/function(e,t,a){
// extracted by mini-css-extract-plugin
/***/}}]);