MakerSpaceApply.vue 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347
  1. <template>
  2. <!-- 项目立项申请 -->
  3. <div id="MakerSpaceApply" v-loading="loading">
  4. <div class="pAHeader">
  5. <div class="pAHeader1">创客空间申请</div>
  6. </div>
  7. <hr>
  8. <MakerSpaceWord :wordData="wordData"/>
  9. <div style="position: fixed;bottom: 5%;right: 2%;">
  10. <el-button @click="test" type="primary">提交项目</el-button>
  11. </div>
  12. <el-dialog
  13. title="提示"
  14. :visible.sync="submitHint"
  15. width="600px"
  16. class="pageSubmitData">
  17. <div class="deleteContent">确定提交“{{wordData['projectName']}}”项目立项?</div>
  18. <span slot="footer" class="dialog-footer">
  19. <el-button type="primary" @click="applyProject" class="AllDialogBtn">确认提交</el-button>
  20. <el-button @click="submitHint=false" class="AllDialogBtn">取消</el-button>
  21. </span>
  22. </el-dialog>
  23. </div>
  24. </template>
  25. <script>
  26. import {getNowDate} from '@/components/tool/Date.js'
  27. import getProjectNo from '@/components/tool/getProjectNo';
  28. import MakerSpaceWord from './components/MakerSpaceWord.vue';
  29. export default {
  30. components:{MakerSpaceWord},
  31. data() {
  32. return {
  33. wordData:{
  34. applicationDate:getNowDate(1),//申请日期
  35. projectName:"",//项目名称
  36. college:"",//所在学院
  37. begin_at:"",//项目开始时间
  38. state:"",//项目状态
  39. plannedEnd_at:"",//计划完成时间
  40. pro_leader:"",//项目负责人
  41. lead_leader:"",//学院牵头领导
  42. teacher:[
  43. {name:"",speciality:"",title:"",education:"",section:"",work:""},
  44. {name:"",speciality:"",title:"",education:"",section:"",work:""},
  45. {name:"",speciality:"",title:"",education:"",section:"",work:""},
  46. ], //教师组//name:姓名 speciality:专业 title:职称 education:学历 section:所在教研室 work:项目组角色分工
  47. student:[
  48. {name:"",class:"",age:"",work:""},
  49. {name:"",class:"",age:"",work:""},
  50. {name:"",class:"",age:"",work:""},
  51. {name:"",class:"",age:"",work:""},
  52. {name:"",class:"",age:"",work:""},
  53. ], //学生组//name:姓名 class:班级 age:年龄 work:项目组任务分工
  54. brief:"",//项目简介
  55. Construction:"",//建设内容
  56. ProjectBasis:"",//立项依据
  57. development:"",//创客空间物理环境、制度建设及软件设施建设情况
  58. studio:"",//学生创客工作室建设情况
  59. studentTeam:"",//学生创客团队(人才)培养预期成果、数量
  60. studentActivities:"",//学生创客活动组织实施情况
  61. Transforming:"",//学生创客团队孵化、转化创业项目情况
  62. condition:"",//立 项基 础及条 件
  63. fund:{
  64. total:"",
  65. device:"",
  66. Material:"",
  67. processing:"",
  68. Collaboration:"",
  69. APPRAISAL:"",
  70. entery:"",
  71. activities:"",
  72. Transaction:"",
  73. },//预算经费
  74. //total:总经费
  75. //小型仪器设备费:device deviceRemarks
  76. //材料费:Material MaterialRemarks
  77. //测试化验加工费:processing processingRemarks
  78. //项目协作费:Collaboration CollaborationRemarks
  79. //项目成果鉴定费:APPRAISAL APPRAISALRemarks
  80. //参展参赛费:entery enteryRemarks
  81. //创客交流活动费:activities activitiesRemarks
  82. //知识产权事务费:Transaction TransactionRemarks
  83. },
  84. loading:false,
  85. submitHint:false,
  86. }
  87. },
  88. methods:{
  89. test(){//项目提交
  90. //检查各个字段
  91. const cEmpty = /^\s*$/g;
  92. for(let i in this.wordData){
  93. switch (i) {
  94. case "projectName":
  95. if(cEmpty.test(this.wordData[i])){
  96. this.$message.error("请输入项目名称");
  97. document.querySelector('#one').scrollIntoView({ behavior: "smooth" });
  98. return false;
  99. }
  100. break;
  101. case "college":
  102. if(cEmpty.test(this.wordData[i])){
  103. this.$message.error("请选择所在学院");
  104. document.querySelector('#one').scrollIntoView({ behavior: "smooth" });
  105. return false;
  106. }
  107. break;
  108. case "state":
  109. if(cEmpty.test(this.wordData[i])){
  110. this.$message.error("请选择项目状态");
  111. document.querySelector('#two').scrollIntoView({ behavior: "smooth" });
  112. return false;
  113. }
  114. break;
  115. case "begin_at":
  116. if(cEmpty.test(this.wordData[i])){
  117. this.$message.error("请选择项目开始时间");
  118. document.querySelector('#three').scrollIntoView({ behavior: "smooth" });
  119. return false;
  120. }
  121. break;
  122. case "plannedEnd_at":
  123. if(cEmpty.test(this.wordData[i])){
  124. this.$message.error("请选择计划完成时间");
  125. document.querySelector('#three').scrollIntoView({ behavior: "smooth" });
  126. return false;
  127. }
  128. break;
  129. case "pro_leader":
  130. if(cEmpty.test(this.wordData[i])){
  131. this.$message.error("请输入项目负责人");
  132. document.querySelector('#four').scrollIntoView({ behavior: "smooth" });
  133. return false;
  134. }
  135. break;
  136. case "lead_leader":
  137. if(cEmpty.test(this.wordData[i])){
  138. this.$message.error("请输入学院牵头领导");
  139. document.querySelector('#four').scrollIntoView({ behavior: "smooth" });
  140. return false;
  141. }
  142. break;
  143. case "teacher":
  144. if(this.wordData[i].length<3){
  145. this.$message.error('教师团队应3人以上')
  146. document.querySelector('#five').scrollIntoView({ behavior: "smooth" });
  147. return false;
  148. }else{
  149. let num = 0;
  150. this.wordData[i].forEach(item=>{
  151. if(cEmpty.test(item['name']))num++;
  152. // for(let j in item){
  153. // if(cEmpty.test(item[j])){
  154. // num++;
  155. // }
  156. // }
  157. })
  158. if(num>0){
  159. this.$message.error("教师姓名请不要留空");
  160. document.querySelector('#five').scrollIntoView({ behavior: "smooth" });
  161. return false;
  162. }
  163. }
  164. break;
  165. case "student":
  166. if(this.wordData[i].length<5){
  167. this.$message.error('学生团队应5人以上')
  168. document.querySelector('#six').scrollIntoView({ behavior: "smooth" });
  169. return false;
  170. }else{
  171. let num = 0;
  172. this.wordData[i].forEach(item=>{
  173. if(cEmpty.test(item['name']))num++;
  174. // for(let j in item){
  175. // if(cEmpty.test(item[j])){
  176. // num++;
  177. // }
  178. // }
  179. })
  180. if(num>0){
  181. this.$message.error("学生姓名请不要留空");
  182. document.querySelector('#six').scrollIntoView({ behavior: "smooth" });
  183. return false;
  184. }
  185. }
  186. break;
  187. case 'fund':
  188. if(this.wordData['fund']['total']==0){
  189. // console.log(document.querySelector('#fund'))
  190. document.querySelector('#fund').scrollIntoView({ behavior: "smooth" });
  191. return this.$message.error('请输入预算经费');
  192. }
  193. break;
  194. case 'brief':
  195. if ( this.wordData[i].length>300 || this.wordData[i].length==0) {
  196. this.$message.error('请填写项目简介,字数在300字以内')
  197. document.querySelector('#brief').scrollIntoView({ behavior: "smooth" });
  198. return false
  199. }
  200. break;
  201. // case "brief":
  202. // if(cEmpty.test(this.wordData[i])){
  203. // this.$message.error("请填写项目简介");
  204. // document.querySelector('#seven').scrollIntoView({ behavior: "smooth" });
  205. // return false;
  206. // }else{
  207. // if(this.wordData[i].length<200||this.wordData>300){
  208. // this.$message.error("项目简介需要200-300字")
  209. // document.querySelector('#seven').scrollIntoView({ behavior: "smooth" });
  210. // return false;
  211. // }
  212. // }
  213. // break;
  214. // case "Construction":
  215. // if(cEmpty.test(this.wordData[i])){
  216. // this.$message.error("请填写建设内容");
  217. // document.querySelector('#eight').scrollIntoView({ behavior: "smooth" });
  218. // return false;
  219. // }
  220. // break;
  221. // case "ProjectBasis":
  222. // if(cEmpty.test(this.wordData[i])){
  223. // this.$message.error("请填写立项依据");
  224. // document.querySelector('#nine').scrollIntoView({ behavior: "smooth" });
  225. // return false;
  226. // }
  227. // break;
  228. // case "development":
  229. // if(cEmpty.test(this.wordData[i])){
  230. // this.$message.error("请填写创客空间物理环境、制度建设及软件设施建设情况");
  231. // document.querySelector('#ten').scrollIntoView({ behavior: "smooth" });
  232. // return false;
  233. // }
  234. // break;
  235. // case "studio":
  236. // if(cEmpty.test(this.wordData[i])){
  237. // this.$message.error("请填写学生创客工作室建设情况");
  238. // document.querySelector('#eleven').scrollIntoView({ behavior: "smooth" });
  239. // return false;
  240. // }
  241. // break;
  242. // case "studentTeam":
  243. // if(cEmpty.test(this.wordData[i])){
  244. // this.$message.error("请填写学生创客团队(人才)培养预期成果、数量");
  245. // document.querySelector('#twelve').scrollIntoView({ behavior: "smooth" });
  246. // return false;
  247. // }
  248. // break;
  249. // case "studentActivities":
  250. // if(cEmpty.test(this.wordData[i])){
  251. // this.$message.error("请填写学生创客活动组织实施情况");
  252. // document.querySelector('#thirteen').scrollIntoView({ behavior: "smooth" });
  253. // return false;
  254. // }
  255. // break;
  256. // case "Transforming":
  257. // if(cEmpty.test(this.wordData[i])){
  258. // this.$message.error("请填写学生创客团队孵化、转化创业项目情况");
  259. // document.querySelector('#fourteen').scrollIntoView({ behavior: "smooth" });
  260. // return false;
  261. // }
  262. // break;
  263. // case "condition":
  264. // if(cEmpty.test(this.wordData[i])){
  265. // this.$message.error("请填写基础条件");
  266. // document.querySelector('#fifteen').scrollIntoView({ behavior: "smooth" });
  267. // return false;
  268. // }
  269. // break
  270. }
  271. }
  272. this.submitHint = true;
  273. },
  274. applyProject(){
  275. //先获取编号
  276. getProjectNo("XM").then((result)=>{
  277. let pram = {
  278. uid:this.$store.state.userInfo.userid,//用户ID
  279. pNo:result,//项目编号
  280. tit:this.wordData['projectName'],//项目名称
  281. bf:this.wordData['brief'],//项目简介
  282. pLeader:this.wordData['pro_leader'],//项目负责人
  283. lLeader:this.wordData['lead_leader'],//学院牵头领导,
  284. cid:this.wordData['college'],//学院ID,
  285. ct:JSON.stringify(this.wordData['teacher']),//教师组,
  286. cs:JSON.stringify(this.wordData['student']),//学生组,
  287. f:this.wordData['fund']['total'],//总经费
  288. chp:JSON.stringify({
  289. Construction:this.wordData['Construction'],//建设内容
  290. ProjectBasis:this.wordData['ProjectBasis'],//立项依据
  291. development:this.wordData['development'],//创客空间物理环境、制度建设及软件设施建设情况
  292. studio:this.wordData['studio'],//学生创客工作室建设情况
  293. studentTeam:this.wordData['studentTeam'],//学生创客团队(人才)培养预期成果、数量
  294. studentActivities:this.wordData['studentActivities'],//学生创客活动组织实施情况
  295. Transforming:this.wordData['Transforming'],//学生创客团队孵化、转化创业项目情况
  296. condition:this.wordData['condition'],//立 项基 础及条 件
  297. }),//项目详细
  298. tid:"5f7a66d5-c206-11ed-a4cd-509a4c5b67cf",//特色创客空间建设项目分类ID
  299. tName:this.wordData['state'],//项目状态
  300. mon:JSON.stringify(this.wordData['fund']),//预算经费
  301. planEnd:this.wordData['plannedEnd_at'],//计划完成时间,
  302. beh:this.wordData['begin_at'],//项目开始时间,
  303. apply:this.wordData['applicationDate'],//申请日期
  304. members:this.wordData['student'].length+this.wordData['teacher'].length
  305. }
  306. this.ajax.post(this.$store.state.api+'/MakerSpaceWordApply',pram).then(result=>{
  307. console.log(result)
  308. if(result['data']==1){
  309. this.$message.success("项目提交成功");
  310. //提交项目成功,查看sessionStore是否有数据,有则删
  311. if(sessionStorage.getItem("MakerSpaceApplyData"))sessionStorage.removeItem('MakerSpaceApplyData');
  312. this.$router.push('/projectApplication')
  313. }else{
  314. this.$message.error("项目提交失败");
  315. }
  316. }).catch(err=>{
  317. console.log(err);
  318. })
  319. })
  320. }
  321. },
  322. mounted(){ //跳转到此页面立刻获取数据
  323. // this.getData(); //获取表格数据
  324. // this.applyProject();
  325. //判断,如果sessionStore里有MakerSpaceApplyData这个字段,则存到this.wordData里
  326. if(sessionStorage.getItem('MakerSpaceApplyData'))this.wordData = JSON.parse(sessionStorage.getItem('MakerSpaceApplyData'))
  327. },
  328. beforeRouteLeave (to, from, next) {
  329. //判断,如果还没提交然后切换页面了,则把数据存到sessionStore里;
  330. if(!this.submitHint)sessionStorage.setItem('MakerSpaceApplyData',JSON.stringify(this.wordData));
  331. next();
  332. }
  333. }
  334. </script>
  335. <style lang="less">
  336. #MakerSpaceApply{
  337. display: flex;
  338. flex-direction: column;
  339. // align-items: flex-end;
  340. // justify-content: flex-end;
  341. position: relative;
  342. }
  343. </style>