Files
nexusphp/admin/dist/assets/form.4eda1d7a.js
T

2 lines
6.0 KiB
JavaScript
Raw Normal View History

2021-05-06 13:01:17 +08:00
var e=Object.defineProperty,a=Object.prototype.hasOwnProperty,l=Object.getOwnPropertySymbols,t=Object.prototype.propertyIsEnumerable,d=(a,l,t)=>l in a?e(a,l,{enumerable:!0,configurable:!0,writable:!0,value:t}):a[l]=t,o=(e,o)=>{for(var r in o||(o={}))a.call(o,r)&&d(e,r,o[r]);if(l)for(var r of l(o))t.call(o,r)&&d(e,r,o[r]);return e};import{r,a as s,A as n,i,b as m,m as u,t as f,n as p,q as c,u as b,v as D,p as g,d as _,e as V,o as y,c as h,f as x,F as v,x as Y,h as U,y as k,z as j,g as w}from"./index.3bcaf0cf.js";const E={name:"ExamForm",setup(){const{proxy:e}=p();console.log("proxy",e);const a=r(null),l=c(),t=b(),{id:d}=l.query,g=s({token:n("token")||"",id:d,allClasses:[],formData:{name:"",description:"",begin:"",end:"",duration:"",indexes:[],filters:{classes:[],register_time_range:[]},status:"",is_discovered:""},rules:{name:[{required:"true"}],indexes:[{required:"true"}],status:[{required:"true"}],is_discovered:[{required:"true"}]}});i((()=>{if(_(),V(),d)m.getExam(d).then((e=>{g.formData.name=e.data.name,g.formData.description=e.data.description,g.formData.begin=e.data.begin,g.formData.end=e.data.end,g.formData.duration=e.data.duration,g.formData.indexes=e.data.indexes,g.formData.filters=e.data.filters,g.formData.status=e.data.status,g.formData.is_discovered=e.data.is_discovered}));else{let e=m.listExamIndex();g.formData.indexes=e.data}})),u((()=>{}));const _=async()=>{let e=await m.listClass();g.allClasses=e.data},V=async()=>{let e=await m.listExamIndex();g.formData.indexes=e.data};return o(o({},f(g)),{formRef:a,submitAdd:()=>{a.value.validate((async e=>{if(e){let e=g.formData;e.begin&&(e.begin=dayjs(e.begin).format("YYYY-MM-DD HH:mm:ss")),e.end&&(e.end=dayjs(e.end).format("YYYY-MM-DD HH:mm:ss")),console.log(e),d?await m.updateExam(d,e):await m.storeExam(e),await t.push({name:"exam"})}}))},handleBeforeUpload:e=>{const a=e.name.split(".")[1]||"";if(!["jpg","jpeg","png"].includes(a))return D.error("请上传 jpg、jpeg、png 格式的图片"),!1},handleUrlSuccess:e=>{g.formData.goodsCoverImg=e.data||""},handleChangeCate:e=>{g.categoryId=e[2]||0}})}},H=w();g("data-v-22d39b60");const M=U("Enabled"),C=U("Disabled"),q=U("No"),I=U("Yes"),O=x("div",{style:{color:"#aaa"}},"Unit: days. When assign to user, begin and end are used if they are specified. Otherwise begin time is the time at assignment, and the end time is the time at assignment plus the duration.",-1),S=U("Submit");_();const T=H(((e,a,l,t,d,o)=>{const r=V("el-input"),s=V("el-form-item"),n=V("el-checkbox"),i=V("el-col"),m=V("el-row"),u=V("el-radio"),f=V("el-radio-group"),p=V("el-date-picker"),c=V("el-checkbox-group"),b=V("el-button"),D=V("el-form");return y(),h("div",null,[x(m,null,{default:H((()=>[x(i,{span:12},{default:H((()=>[x(D,{model:e.formData,rules:e.rules,ref:"formRef","label-width":"200px",class:"formData"},{default:H((()=>[x(s,{label:"Name",prop:"name"},{default:H((()=>[x(r,{modelValue:e.formData.name,"onUpdate:modelValue":a[1]||(a[1]=a=>e.formData.name=a),placeholder:""},null,8,["modelValue"])])),_:1}),x(s,{label:"Index",prop:"indexes"},{default:H((()=>[(y(!0),h(v,null,Y(e.formData.indexes,((e,a)=>(y(),h(m,{key:a},{default:H((()=>[x(i,{span:6},{default:H((()=>[x(n,{modelValue:e.checked,"onUpdate:modelValue":a=>e.checked=a,label:e.checked},{default:H((()=>[U(k(e.name),1)])),_:2},1032,["modelValue","onUpdate:modelValue","label"])])),_:2},1024),x(i,{span:12},{default:H((()=>[x(r,{type:"number",modelValue:e.require_value,"onUpdate:modelValue":a=>e.require_value=a},null,8,["modelValue","onUpdate:modelValue"])])),_:2},1024),x(i,{span:6,style:{padding:"0 20px",color:"#aaa"}},{default:H((()=>[e.unit?(y(),h(v,{key:0},[U(" Unit: "+k(e.unit),1)],64)):j("",!0)])),_:2},1024)])),_:2},1024)))),128))])),_:1}),x(s,{label:"Status",prop:"status"},{default:H((()=>[x(f,{modelValue:e.formData.status,"onUpdate:modelValue":a[2]||(a[2]=a=>e.formData.status=a)},{default:H((()=>[x(u,{label:0},{default:H((()=>[M])),_:1}),x(u,{label:1},{default:H((()=>[C])),_:1})])),_:1},8,["modelValue"])])),_:1}),x(s,{label:"Discovered",prop:"is_discovered"},{default:H((()=>[x(f,{modelValue:e.formDa