12 |
- "use strict";(self["webpackChunkscproject"]=self["webpackChunkscproject"]||[]).push([[8421],{65146:function(t,e,a){a.r(e),a.d(e,{default:function(){return u}});var o=function(){var t=this,e=t._self._c;return e("div",{directives:[{name:"loading",rawName:"v-loading",value:t.loading,expression:"loading"}],attrs:{id:"MakerSpaceApply"}},[t._m(0),e("hr"),e("MakerSpaceWord",{attrs:{wordData:t.wordData,reversedMessage:t.reversedMessage}}),e("div",{staticStyle:{position:"fixed",bottom:"5%",right:"2%"}},[e("el-button",{attrs:{type:"primary"},on:{click:t.saveDraft}},[t._v("保存草稿")]),e("el-button",{attrs:{type:"primary"},on:{click:t.test}},[t._v("提交项目")])],1),e("el-dialog",{staticClass:"pageSubmitData",attrs:{title:"提示",visible:t.submitHint,width:"600px"},on:{"update:visible":function(e){t.submitHint=e}}},[e("div",{staticClass:"deleteContent"},[t._v(" 确定提交“"+t._s(t.wordData["projectName"])+"”项目吗? ")]),e("span",{staticClass:"dialog-footer",attrs:{slot:"footer"},slot:"footer"},[e("el-button",{staticClass:"AllDialogBtn",attrs:{type:"primary"},on:{click:t.applyProject}},[t._v("确认提交")]),e("el-button",{staticClass:"AllDialogBtn",on:{click:function(e){t.submitHint=!1}}},[t._v("取消")])],1)])],1)},s=[function(){var t=this,e=t._self._c;return e("div",{staticClass:"pAHeader"},[e("div",{staticClass:"pAHeader1"},[t._v("创客空间申请")])])}],r=(a(57658),a(24613)),i=a(16079),n=a(49202),d={components:{MakerSpaceWord:n.Z},data(){return{wordData:{applicationDate:(0,r.YZ)(1),projectName:"",college:"",begin_at:"",state:"",plannedEnd_at:"",pro_leader:"",lead_leader:"",teacher:[{name:"",speciality:"",title:"",education:"",section:"",work:""}],student:[{name:"",class:"",age:"",work:""}],brief:"",Construction:"",ProjectBasis:"",development:"",studio:"",studentTeam:"",studentActivities:"",Transforming:"",condition:"",total:"",fund:{device:"",Material:"",processing:"",Collaboration:"",APPRAISAL:"",entery:"",activities:"",Transaction:""}},loading:!1,submitHint:!1}},methods:{test(){const t=/^\s*$/g;for(let e in this.wordData)switch(e){case"projectName":if(t.test(this.wordData[e]))return this.$message.error("请输入项目名称"),document.querySelector("#one").scrollIntoView({behavior:"smooth"}),!1;break;case"college":if(t.test(this.wordData[e]))return this.$message.error("请选择所在学院"),document.querySelector("#one").scrollIntoView({behavior:"smooth"}),!1;break;case"state":if(t.test(this.wordData[e]))return this.$message.error("请选择项目状态"),document.querySelector("#two").scrollIntoView({behavior:"smooth"}),!1;break;case"begin_at":if(t.test(this.wordData[e]))return this.$message.error("请选择项目开始时间"),document.querySelector("#three").scrollIntoView({behavior:"smooth"}),!1;break;case"plannedEnd_at":if(t.test(this.wordData[e]))return this.$message.error("请选择计划完成时间"),document.querySelector("#three").scrollIntoView({behavior:"smooth"}),!1;break;case"pro_leader":if(t.test(this.wordData[e]))return this.$message.error("请输入项目负责人"),document.querySelector("#four").scrollIntoView({behavior:"smooth"}),!1;break;case"lead_leader":if(t.test(this.wordData[e]))return this.$message.error("请输入学院牵头领导"),document.querySelector("#four").scrollIntoView({behavior:"smooth"}),!1;break;case"fund":let a=0;for(let t in this.wordData["fund"])a+=1*this.wordData["fund"][t];if(a<=0)return document.querySelector("#fund").scrollIntoView({behavior:"smooth"}),this.$message.error("请输入预算经费");break;case"brief":if(this.wordData[e].length>300||0==this.wordData[e].length)return this.$message.error("请填写项目简介,字数在300字以内"),document.querySelector("#brief").scrollIntoView({behavior:"smooth"}),!1;break}this.wordData["total"]=1*this.wordData.fund.device+1*this.wordData.fund.Material+1*this.wordData.fund.processing+1*this.wordData.fund.Collaboration+1*this.wordData.fund.APPRAISAL+1*this.wordData.fund.entery+1*this.wordData.fund.activities+1*this.wordData.fund.Transaction,console.log(this.wordData["total"]),this.submitHint=!0},applyProject(){(0,i.Z)("XM").then((t=>{let e={uid:this.$store.state.userInfo.userid,pNo:t,tit:encodeURIComponent(this.wordData["projectName"]),bf:encodeURIComponent(this.wordData["brief"]),pLeader:encodeURIComponent(this.wordData["pro_leader"]),lLeader:encodeURIComponent(this.wordData["lead_leader"]),cid:this.wordData["college"],ct:encodeURIComponent(JSON.stringify(this.wordData["teacher"])),cs:encodeURIComponent(JSON.stringify(this.wordData["student"])),f:this.wordData["total"],chp:encodeURIComponent(JSON.stringify({Construction:this.wordData["Construction"],ProjectBasis:this.wordData["ProjectBasis"],development:this.wordData["development"],studio:this.wordData["studio"],studentTeam:this.wordData["studentTeam"],studentActivities:this.wordData["studentActivities"],Transforming:this.wordData["Transforming"],condition:this.wordData["condition"]})),tid:"5f7a66d5-c206-11ed-a4cd-509a4c5b67cf",tName:this.wordData["state"],mon:encodeURIComponent(JSON.stringify(this.wordData["fund"])),planEnd:this.wordData["plannedEnd_at"],beh:this.wordData["begin_at"],apply:this.wordData["applicationDate"],members:this.wordData["student"].filter((t=>""!=t.name)).length+this.wordData["teacher"].filter((t=>""!=t.name)).length};this.ajax.post(this.$store.state.api+"/MakerSpaceWordApply",e).then((async t=>{console.log(t),1==t["data"]?(this.$message.success("项目提交成功"),localStorage.getItem(`MakerSpaceApplyData${this.$store.state.userInfo.userid}`)&&localStorage.removeItem(`MakerSpaceApplyData${this.$store.state.userInfo.userid}`),await this.ajax.post(this.$store.state.api+"/delDraft",{userid:this.$store.state.userInfo.userid,type:1}),this.$router.push("/projectApplication")):this.$message.error("项目提交失败")})).catch((t=>{console.log(t)}))}))},saveData(){localStorage.setItem(`MakerSpaceApplyData${this.$store.state.userInfo.userid}`,JSON.stringify(this.wordData))},saveDraft(){if(this.loading)return;this.loading=!0;let t={userid:this.$store.state.userInfo.userid,type:1,jsonData:encodeURIComponent(JSON.stringify(this.wordData))};this.ajax.post(this.$store.state.api+"/saveDraft",t).then((t=>{1==t.data?this.$message.success("保存成功"):this.$message.error("保存失败"),this.loading=!1}))},getDraft(){if(this.loading)return;this.loading=!0;let t={userid:this.$store.state.userInfo.userid,type:1};this.ajax.get(this.$store.state.api+"/getDraft",t).then((t=>{t.data[0].length&&(this.wordData=JSON.parse(t.data[0][0].json)),this.loading=!1}))}},computed:{reversedMessage:function(){return 1*this.wordData.fund.device+1*this.wordData.fund.Material+1*this.wordData.fund.processing+1*this.wordData.fund.Collaboration+1*this.wordData.fund.APPRAISAL+1*this.wordData.fund.entery+1*this.wordData.fund.activities+1*this.wordData.fund.Transaction}},mounted(){this.getDraft(),window.addEventListener("beforeunload",(()=>this.saveData()))},beforeRouteLeave(t,e,a){this.submitHint||this.saveData(),a()}},c=d,l=a(43736),h=(0,l.Z)(c,o,s,!1,null,null,null),u=h.exports},16079:function(t,e,a){a.d(e,{Z:function(){return i}});var o=a(36890),s=a(26125);const r={XM:"/getProjectNo",CX:"/getProjectNo",CY:"/getProjectNo",SJ:"/getProjectNo",HD:"/getActivityNo",ZJ:"/getFundNo"};function i(t="XM"){return new Promise(((e,a)=>{o.Z.get(s.Z.state.api+r[t],{uid:s.Z.state.userInfo.userid,type:t}).then((a=>{if(console.log(a["data"]),0==a["data"][0].length||null==a["data"][0][0]["No"])return e(`${t}0000001`);let o=a["data"][0][0]["No"],s=parseInt(o.slice(-7)),r=s+1,i=`${t}${r.toString().padStart(7,"0")}`;e(i)}))}))}}}]);
- //# sourceMappingURL=8421.0c6cb247.js.map
|