12 |
- "use strict";(self["webpackChunkscproject"]=self["webpackChunkscproject"]||[]).push([[487],{28077:function(t,e,a){a.r(e),a.d(e,{default:function(){return u}});var s=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)},r=[function(){var t=this,e=t._self._c;return e("div",{staticClass:"pAHeader"},[e("div",{staticClass:"pAHeader1"},[t._v("创客空间申请")])])}],o=(a(57658),a(24613)),i=a(16079),n=a(82935),d={components:{MakerSpaceWord:n.Z},data(){return{wordData:{applicationDate:(0,o.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:this.wordData["projectName"],bf:this.wordData["brief"],pLeader:this.wordData["pro_leader"],lLeader:this.wordData["lead_leader"],cid:this.wordData["college"],ct:JSON.stringify(this.wordData["teacher"]),cs:JSON.stringify(this.wordData["student"]),f:this.wordData["total"],chp: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"]}).replaceAll(/%/g,"%25"),tid:"5f7a66d5-c206-11ed-a4cd-509a4c5b67cf",tName:this.wordData["state"],mon:JSON.stringify(this.wordData["fund"]),planEnd:this.wordData["plannedEnd_at"],beh:this.wordData["begin_at"],apply:this.wordData["applicationDate"],members:this.wordData["student"].length+this.wordData["teacher"].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")&&localStorage.removeItem("MakerSpaceApplyData"),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",JSON.stringify(this.wordData))},saveDraft(){if(this.loading)return this.$message.info("请稍等...");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.$message.info("请稍等...");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):localStorage.getItem("MakerSpaceApplyData")&&(this.wordData=JSON.parse(localStorage.getItem("MakerSpaceApplyData"))),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()}},l=d,c=a(43736),h=(0,c.Z)(l,s,r,!1,null,null,null),u=h.exports},16079:function(t,e,a){a.d(e,{Z:function(){return i}});var s=a(36890),r=a(26125);const o={XM:"/getProjectNo",HD:"/getActivityNo",ZJ:"/getFundNo"};function i(t="XM"){return new Promise(((e,a)=>{s.Z.get(r.Z.state.api+o[t],{uid:r.Z.state.userInfo.userid}).then((a=>{if(console.log(a["data"]),0==a["data"][0].length||null==a["data"][0][0]["No"])return e(`${t}0000001`);let s=a["data"][0][0]["No"],r=parseInt(s.slice(-7)),o=r+1,i=`${t}${o.toString().padStart(7,"0")}`;e(i)}))}))}}}]);
- //# sourceMappingURL=487.813b11d8.js.map
|