← Back
Editing: add-increment-legacy.js
!function(){function t(e){return t="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},t(e)}function e(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),r.push.apply(r,n)}return r}function r(t){for(var r=1;r<arguments.length;r++){var a=null!=arguments[r]?arguments[r]:{};r%2?e(Object(a),!0).forEach((function(e){n(t,e,a[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(a)):e(Object(a)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(a,e))}))}return t}function n(e,r,n){return(r=function(e){var r=function(e,r){if("object"!=t(e)||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var a=n.call(e,r||"default");if("object"!=t(a))return a;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===r?String:Number)(e)}(e,"string");return"symbol"==t(r)?r:r+""}(r))in e?Object.defineProperty(e,r,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[r]=n,e}function a(){"use strict";/*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */a=function(){return r};var e,r={},n=Object.prototype,o=n.hasOwnProperty,i=Object.defineProperty||function(t,e,r){t[e]=r.value},u="function"==typeof Symbol?Symbol:{},l=u.iterator||"@@iterator",c=u.asyncIterator||"@@asyncIterator",s=u.toStringTag||"@@toStringTag";function f(t,e,r){return Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}),t[e]}try{f({},"")}catch(e){f=function(t,e,r){return t[e]=r}}function p(t,e,r,n){var a=e&&e.prototype instanceof g?e:g,o=Object.create(a.prototype),u=new T(n||[]);return i(o,"_invoke",{value:L(t,r,u)}),o}function v(t,e,r){try{return{type:"normal",arg:t.call(e,r)}}catch(t){return{type:"throw",arg:t}}}r.wrap=p;var h="suspendedStart",d="suspendedYield",m="executing",y="completed",b={};function g(){}function w(){}function _(){}var k={};f(k,l,(function(){return this}));var j=Object.getPrototypeOf,x=j&&j(j(B([])));x&&x!==n&&o.call(x,l)&&(k=x);var O=_.prototype=g.prototype=Object.create(k);function E(t){["next","throw","return"].forEach((function(e){f(t,e,(function(t){return this._invoke(e,t)}))}))}function P(e,r){function n(a,i,u,l){var c=v(e[a],e,i);if("throw"!==c.type){var s=c.arg,f=s.value;return f&&"object"==t(f)&&o.call(f,"__await")?r.resolve(f.__await).then((function(t){n("next",t,u,l)}),(function(t){n("throw",t,u,l)})):r.resolve(f).then((function(t){s.value=t,u(s)}),(function(t){return n("throw",t,u,l)}))}l(c.arg)}var a;i(this,"_invoke",{value:function(t,e){function o(){return new r((function(r,a){n(t,e,r,a)}))}return a=a?a.then(o,o):o()}})}function L(t,r,n){var a=h;return function(o,i){if(a===m)throw Error("Generator is already running");if(a===y){if("throw"===o)throw i;return{value:e,done:!0}}for(n.method=o,n.arg=i;;){var u=n.delegate;if(u){var l=N(u,n);if(l){if(l===b)continue;return l}}if("next"===n.method)n.sent=n._sent=n.arg;else if("throw"===n.method){if(a===h)throw a=y,n.arg;n.dispatchException(n.arg)}else"return"===n.method&&n.abrupt("return",n.arg);a=m;var c=v(t,r,n);if("normal"===c.type){if(a=n.done?y:d,c.arg===b)continue;return{value:c.arg,done:n.done}}"throw"===c.type&&(a=y,n.method="throw",n.arg=c.arg)}}}function N(t,r){var n=r.method,a=t.iterator[n];if(a===e)return r.delegate=null,"throw"===n&&t.iterator.return&&(r.method="return",r.arg=e,N(t,r),"throw"===r.method)||"return"!==n&&(r.method="throw",r.arg=new TypeError("The iterator does not provide a '"+n+"' method")),b;var o=v(a,t.iterator,r.arg);if("throw"===o.type)return r.method="throw",r.arg=o.arg,r.delegate=null,b;var i=o.arg;return i?i.done?(r[t.resultName]=i.value,r.next=t.nextLoc,"return"!==r.method&&(r.method="next",r.arg=e),r.delegate=null,b):i:(r.method="throw",r.arg=new TypeError("iterator result is not an object"),r.delegate=null,b)}function S(t){var e={tryLoc:t[0]};1 in t&&(e.catchLoc=t[1]),2 in t&&(e.finallyLoc=t[2],e.afterLoc=t[3]),this.tryEntries.push(e)}function D(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function T(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(S,this),this.reset(!0)}function B(r){if(r||""===r){var n=r[l];if(n)return n.call(r);if("function"==typeof r.next)return r;if(!isNaN(r.length)){var a=-1,i=function t(){for(;++a<r.length;)if(o.call(r,a))return t.value=r[a],t.done=!1,t;return t.value=e,t.done=!0,t};return i.next=i}}throw new TypeError(t(r)+" is not iterable")}return w.prototype=_,i(O,"constructor",{value:_,configurable:!0}),i(_,"constructor",{value:w,configurable:!0}),w.displayName=f(_,s,"GeneratorFunction"),r.isGeneratorFunction=function(t){var e="function"==typeof t&&t.constructor;return!!e&&(e===w||"GeneratorFunction"===(e.displayName||e.name))},r.mark=function(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,_):(t.__proto__=_,f(t,s,"GeneratorFunction")),t.prototype=Object.create(O),t},r.awrap=function(t){return{__await:t}},E(P.prototype),f(P.prototype,c,(function(){return this})),r.AsyncIterator=P,r.async=function(t,e,n,a,o){void 0===o&&(o=Promise);var i=new P(p(t,e,n,a),o);return r.isGeneratorFunction(e)?i:i.next().then((function(t){return t.done?t.value:i.next()}))},E(O),f(O,s,"Generator"),f(O,l,(function(){return this})),f(O,"toString",(function(){return"[object Generator]"})),r.keys=function(t){var e=Object(t),r=[];for(var n in e)r.push(n);return r.reverse(),function t(){for(;r.length;){var n=r.pop();if(n in e)return t.value=n,t.done=!1,t}return t.done=!0,t}},r.values=B,T.prototype={constructor:T,reset:function(t){if(this.prev=0,this.next=0,this.sent=this._sent=e,this.done=!1,this.delegate=null,this.method="next",this.arg=e,this.tryEntries.forEach(D),!t)for(var r in this)"t"===r.charAt(0)&&o.call(this,r)&&!isNaN(+r.slice(1))&&(this[r]=e)},stop:function(){this.done=!0;var t=this.tryEntries[0].completion;if("throw"===t.type)throw t.arg;return this.rval},dispatchException:function(t){if(this.done)throw t;var r=this;function n(n,a){return u.type="throw",u.arg=t,r.next=n,a&&(r.method="next",r.arg=e),!!a}for(var a=this.tryEntries.length-1;a>=0;--a){var i=this.tryEntries[a],u=i.completion;if("root"===i.tryLoc)return n("end");if(i.tryLoc<=this.prev){var l=o.call(i,"catchLoc"),c=o.call(i,"finallyLoc");if(l&&c){if(this.prev<i.catchLoc)return n(i.catchLoc,!0);if(this.prev<i.finallyLoc)return n(i.finallyLoc)}else if(l){if(this.prev<i.catchLoc)return n(i.catchLoc,!0)}else{if(!c)throw Error("try statement without catch or finally");if(this.prev<i.finallyLoc)return n(i.finallyLoc)}}}},abrupt:function(t,e){for(var r=this.tryEntries.length-1;r>=0;--r){var n=this.tryEntries[r];if(n.tryLoc<=this.prev&&o.call(n,"finallyLoc")&&this.prev<n.finallyLoc){var a=n;break}}a&&("break"===t||"continue"===t)&&a.tryLoc<=e&&e<=a.finallyLoc&&(a=null);var i=a?a.completion:{};return i.type=t,i.arg=e,a?(this.method="next",this.next=a.finallyLoc,b):this.complete(i)},complete:function(t,e){if("throw"===t.type)throw t.arg;return"break"===t.type||"continue"===t.type?this.next=t.arg:"return"===t.type?(this.rval=this.arg=t.arg,this.method="return",this.next="end"):"normal"===t.type&&e&&(this.next=e),b},finish:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r.finallyLoc===t)return this.complete(r.completion,r.afterLoc),D(r),b}},catch:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r.tryLoc===t){var n=r.completion;if("throw"===n.type){var a=n.arg;D(r)}return a}}throw Error("illegal catch attempt")},delegateYield:function(t,r,n){return this.delegate={iterator:B(t),resultName:r,nextLoc:n},"next"===this.method&&(this.arg=e),b}},r}function o(t,e,r,n,a,o,i){try{var u=t[o](i),l=u.value}catch(t){return void r(t)}u.done?e(l):Promise.resolve(l).then(n,a)}function i(t){return function(){var e=this,r=arguments;return new Promise((function(n,a){var i=t.apply(e,r);function u(t){o(i,n,a,u,l,"next",t)}function l(t){o(i,n,a,u,l,"throw",t)}u(void 0)}))}}function u(t){return function(t){if(Array.isArray(t))return s(t)}(t)||function(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(t)||c(t)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function l(t,e){return function(t){if(Array.isArray(t))return t}(t)||function(t,e){var r=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null!=r){var n,a,o,i,u=[],l=!0,c=!1;try{if(o=(r=r.call(t)).next,0===e){if(Object(r)!==r)return;l=!1}else for(;!(l=(n=o.call(r)).done)&&(u.push(n.value),u.length!==e);l=!0);}catch(t){c=!0,a=t}finally{try{if(!l&&null!=r.return&&(i=r.return(),Object(i)!==i))return}finally{if(c)throw a}}return u}}(t,e)||c(t,e)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function c(t,e){if(t){if("string"==typeof t)return s(t,e);var r={}.toString.call(t).slice(8,-1);return"Object"===r&&t.constructor&&(r=t.constructor.name),"Map"===r||"Set"===r?Array.from(t):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?s(t,e):void 0}}function s(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=Array(e);r<e;r++)n[r]=t[r];return n}System.register(["./utils-lib-legacy.js?v=VERSION_NUMBER","./base-lib-legacy.js?v=VERSION_NUMBER","./form-item-legacy.js?v=VERSION_NUMBER","./database-legacy.js?v=VERSION_NUMBER","./__commonjsHelpers__-legacy.js?v=VERSION_NUMBER","./index-legacy104.js?v=VERSION_NUMBER"],(function(t,e){"use strict";var n,o,c,s,f,p,v,h,d,m,y,b,g,w,_,k,j,x,O,E,P;return{setters:[function(t){n=t.G,o=t.R,c=t.K,s=t.e},function(t){f=t.c,p=t.ay,v=t.g,h=t.e,d=t.B,m=t.b6,y=t.b$,b=t.p,g=t.q,w=t.v,_=t.x,k=t.y},function(t){j=t.d,x=t.k,O=t.b,E=t.h},function(t){P=t.addIncrementTask},null,null],execute:function(){var e={class:"my-[1.6rem]"},L=f({__name:"add-increment",props:{compData:{default:function(){}}},setup:function(t,s){var f,L=s.expose,N=t,S=[{label:"每天",value:"daily"},{label:"每周",value:"weekly"},{label:"相隔N天",value:"interval"},{label:"相隔N小时",value:"hours"}],D=[{label:"周一",value:"1"},{label:"周二",value:"2"},{label:"周三",value:"3"},{label:"周四",value:"4"},{label:"周五",value:"5"},{label:"周六",value:"6"},{label:"周日",value:"0"}],T=[{label:"小时",value:"hour"},{label:"分钟",value:"minute"}],B=p("popupClose",(function(){})),A=function(t,e,r){!/^\d+$/.test(String(t))||Number(t)<=0?e(new Error(r)):e()},I=n({data:function(){var t,e,r,n,a,o,i,u;return{schedule_time:(null===(t=N.compData)||void 0===t||null===(t=t.backupPlan)||void 0===t||null===(t=t.full_backup_schedule)||void 0===t?void 0:t.type)||"daily",weekday:(null===(e=N.compData)||void 0===e||null===(e=e.backupPlan)||void 0===e||null===(e=e.full_backup_schedule)||void 0===e?void 0:e.weekday)||"1",interval_days:(null===(r=N.compData)||void 0===r||null===(r=r.backupPlan)||void 0===r||null===(r=r.full_backup_schedule)||void 0===r?void 0:r.interval_days)||"1",interval_hours:(null===(n=N.compData)||void 0===n||null===(n=n.backupPlan)||void 0===n||null===(n=n.full_backup_schedule)||void 0===n?void 0:n.interval_hours)||"24",allBackupTime:(u=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"08:00:00",e=new Date;if(!t)return e;var r=l(t.split(":").map(Number),3),n=r[0],a=r[1],o=r[2];return e.setHours(isNaN(n)?0:n,isNaN(a)?0:a,isNaN(o)?0:o,0),e}(null===(i=N.compData)||void 0===i||null===(i=i.backupPlan)||void 0===i||null===(i=i.full_backup_schedule)||void 0===i?void 0:i.time),u),start_date:function(t,e){var r=null!==(t=N.compData)&&void 0!==t&&null!==(t=t.backupPlan)&&void 0!==t&&null!==(t=t.full_backup_schedule)&&void 0!==t&&t.start_date?new Date(null===(e=N.compData)||void 0===e||null===(e=e.backupPlan)||void 0===e||null===(e=e.full_backup_schedule)||void 0===e?void 0:e.start_date):new Date;return r.setHours(8,0,0,0),r}(),incrementBackupNum:(null===(a=N.compData)||void 0===a||null===(a=a.backupPlan)||void 0===a?void 0:a.incremental_backup_interval)||"1",incrementBackupType:null!==(o=N.compData)&&void 0!==o&&null!==(o=o.backupPlan)&&void 0!==o&&o.incremental_backup_interval?"minute":"hour"}},options:function(t){return v((function(){return[j([x("全量备份","schedule_time",S,{attrs:{class:"!w-[10rem]"}})].concat(u("weekly"===t.value.schedule_time?[x("","weekday",D,{attrs:{class:"!w-[8rem] ml-[1rem]"}})]:[]),u("interval"===t.value.schedule_time?[O("","interval_days",{attrs:{class:"!w-[8rem] ml-[1rem]"},slots:{unit:function(){return h("span",null,[d("天")])}},rules:[{validator:function(t,e,r){return A(e,r,"请输入正确的整数")},trigger:"blur"}]}),E("开始日期",(function(){return h(m,{class:"!w-[13rem]",modelValue:t.value.start_date,"onUpdate:modelValue":function(e){return t.value.start_date=e},format:"YYYY-MM-DD","value-format":"x"},null)}),"start_date",{rules:[{required:!0,message:"请选择开始日期",trigger:["blur","change"]}]})]:[]),u("hours"===t.value.schedule_time?[O("","interval_hours",{attrs:{class:"!w-[12rem] ml-[1rem]"},slots:{unit:function(){return h("span",{class:"ml-[1rem] inline-block w-[4rem]"},[d("小时")])}},rules:[{validator:function(t,e,r){return A(e,r,"请输入正确的整数")},trigger:"blur"}]})]:[E("执行时间",(function(){return h(y,{class:"!w-[13rem]",modelValue:t.value.allBackupTime,"onUpdate:modelValue":function(e){return t.value.allBackupTime=e},format:"HH:mm:ss"},null)}),"allBackupTime",{rules:[{required:!0,message:"请选择执行时间",trigger:["blur","change"]}]})]))),j([E("增量备份",(function(){return h("span",null,null)}),"null"),O("每隔","incrementBackupNum",{attrs:{class:"!w-[8rem]"},labelAttrs:{labelWidth:"3.5rem"},rules:[{validator:function(t,e,r){return A(e,r,"请输入正确的整数")},trigger:"blur"}]}),x("","incrementBackupType",T,{attrs:{class:"!w-[8rem] ml-[1rem]"}})])]}))},submit:(f=i(a().mark((function t(e,r,n){return a().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,r();case 2:F(e,B);case 3:case"end":return t.stop()}}),t)}))),function(t,e,r){return f.apply(this,arguments)})}),G=I.BtForm,H=I.submit,F=function(){var t=i(a().mark((function t(e,n){var i;return a().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return i=r(r(r({id:N.compData.id,schedule_type:e.value.schedule_time,incremental_backup_interval:"hour"===e.value.incrementBackupType?60*Number(e.value.incrementBackupNum):Number(e.value.incrementBackupNum)},"hours"!==e.value.schedule_time?{schedule_time:o(e.value.allBackupTime,"HH:mm:ss")}:{interval_hours:e.value.interval_hours}),"weekly"===e.value.schedule_time?{weekday:e.value.weekday}:{}),"interval"===e.value.schedule_time?{interval_days:e.value.interval_days,start_date:o(e.value.start_date,"yyyy-MM-dd")}:{}),t.next=4,c({loading:"正在保存,请稍候...",request:P(i),message:!0});case 4:N.compData.refreshEvent(),n();case 6:case"end":return t.stop()}}),t)})));return function(e,r){return t.apply(this,arguments)}}(),Y=function(){var t=i(a().mark((function t(){return a().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:case"end":return t.stop()}}),t)})));return function(){return t.apply(this,arguments)}}();return b((function(){Y()})),L({onConfirm:H}),function(t,r){return g(),w("div",e,[h(_(G),{labelWidth:"8rem"}),r[0]||(r[0]=k("ul",{class:"mt-8px leading-8 text-[1.2rem] list-disc ml-[4.5rem]"},[k("li",null,"配置保存后,如果备份任务处于启用状态,将按新配置执行。")],-1))])}}});t("default",s(L,[["__scopeId","data-v-e33db939"]]))}}}))}();
Save File
Cancel