newStudentProjectApply.vue 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289
  1. <template>
  2. <!-- 测试上传组件 -->
  3. <div v-loading="loading">
  4. <div class="pAHeader">
  5. <div class="pAHeader1">创客项目申请</div>
  6. </div>
  7. <hr>
  8. <!-- 学生项目立项 -->
  9. <studentProjectWord :wordData="wordData" :reversedMessage="reversedMessage"/>
  10. <div style="width: 300px;margin: 20px auto;display: flex;justify-content: space-between;">
  11. <el-button style="width: 120px;margin: 20px auto;" @click="test" type="primary">提交项目</el-button>
  12. </div>
  13. <el-dialog
  14. title="提示"
  15. :visible.sync="submitHint"
  16. width="600px"
  17. class="pageSubmitData">
  18. <div class="addDialogLogo">LOGO</div>
  19. <div class="deleteContent">确定提交“{{wordData['projectName']}}”项目立项?</div>
  20. <span slot="footer" class="dialog-footer">
  21. <el-button type="primary" @click="submitWord" class="AllDialogBtn">确认提交</el-button>
  22. <el-button @click="submitHint=false" class="AllDialogBtn">取消</el-button>
  23. </span>
  24. </el-dialog>
  25. </div>
  26. </template>
  27. <script>
  28. // import MakerSpaceWord from '../components/MakerSpaceWord.vue'
  29. import getProjectNo from '@/components/tool/getProjectNo';
  30. import {getNowDate} from '@/components/tool/Date.js'
  31. import studentProjectWord from './components/studentProjectWord.vue'
  32. // import markerFundWord from '@/components/markerFundWord.vue';
  33. // import markeractivityWord from '@/components/markeractivityWord.vue';
  34. export default {
  35. components: {
  36. studentProjectWord,
  37. // markerFundWord,
  38. // markeractivityWord
  39. },
  40. data() {
  41. return {
  42. accept: "*",
  43. loading:false,
  44. submitHint:false,
  45. wordData:{
  46. applicationDate:getNowDate(1),//申请日期
  47. projectName:'',
  48. radio: '',
  49. checkList:[],
  50. schoolRadio:'',
  51. applyParsonRadio:'',
  52. applyParsonName:'',
  53. college:'',
  54. tel:'',
  55. beginTime:'',
  56. endTime:'',
  57. studentS:[
  58. {name:'',collage:'',work:''},
  59. {name:'',collage:'',work:''},
  60. {name:'',collage:'',work:''},
  61. {name:'',collage:'',work:''},
  62. {name:'',collage:'',work:''},
  63. {name:'',collage:'',work:''},
  64. ],
  65. teacherS:[
  66. {name:'',collage:'',work:''},
  67. {name:'',collage:'',work:''},
  68. ],
  69. brief:'',
  70. introduce:{
  71. back:'',
  72. innovate:'',
  73. path:'',
  74. scene:'',
  75. worth:'',
  76. team:'',
  77. cost:'',
  78. expectResults:'',
  79. expectResultsTeacher:'',
  80. expectConversion:'',
  81. plan:''
  82. },
  83. total:'',
  84. fund:{
  85. facility:'',
  86. materials:'',
  87. process:'',
  88. assist:'',
  89. authenticate:'',
  90. match:'',
  91. activity:'',
  92. affair:''
  93. }
  94. }
  95. };
  96. },
  97. computed:{
  98. reversedMessage: function () {
  99. return (this.wordData.fund.facility*1 + this.wordData.fund.materials*1+this.wordData.fund.process*1+ this.wordData.fund.assist*1+this.wordData.fund.authenticate*1+ this.wordData.fund.match*1+this.wordData.fund.activity*1+this.wordData.fund.affair*1)
  100. }
  101. },
  102. methods:{
  103. test(){ //验证
  104. const cEmpty = /^\s*$/g;
  105. for (let i in this.wordData){
  106. // console.log(this.wordData[i],i);
  107. switch(i){
  108. case 'projectName':
  109. if (cEmpty.test(this.wordData[i])) {
  110. this.$message.error('请输入项目名称')
  111. // this.$refs.projectName.style.background='rgb(236, 141, 141)'
  112. // setTimeout(() => {
  113. // this.$refs.projectName.style.background='#ffffff'
  114. // }, 2000);
  115. document.querySelector('#projectName').scrollIntoView({ behavior: "smooth" });
  116. return false
  117. }
  118. break;
  119. case 'radio':
  120. if (cEmpty.test(this.wordData[i])) {
  121. this.$message.error('请选择项目分组')
  122. document.querySelector('#radio').scrollIntoView({ behavior: "smooth" });
  123. return false
  124. }
  125. break;
  126. case 'checkList':
  127. if (this.wordData[i].length==0) {
  128. this.$message.error('优先支持项目')
  129. document.querySelector('#checkList').scrollIntoView({ behavior: "smooth" });
  130. return false
  131. }
  132. break;
  133. case 'schoolRadio':
  134. if (cEmpty.test(this.wordData[i])) {
  135. this.$message.error('请选择美丽校园改造项目')
  136. document.querySelector('#schoolRadio').scrollIntoView({ behavior: "smooth" });
  137. return false
  138. }
  139. break;
  140. case 'applyParsonRadio':
  141. if (cEmpty.test(this.wordData[i])) {
  142. this.$message.error('请选择项目申请人')
  143. document.querySelector('#applyParsonRadio').scrollIntoView({ behavior: "smooth" });
  144. return false
  145. }
  146. break;
  147. case 'applyParsonName':
  148. if (cEmpty.test(this.wordData[i])) {
  149. this.$message.error('请填写申请人姓名')
  150. document.querySelector('#applyParsonName').scrollIntoView({ behavior: "smooth" });
  151. return false
  152. }
  153. break;
  154. case 'college':
  155. if (cEmpty.test(this.wordData[i])) {
  156. this.$message.error('请选择所在学院')
  157. document.querySelector('#applyParsonName').scrollIntoView({ behavior: "smooth" });
  158. return false
  159. }
  160. break;
  161. case 'tel':
  162. if (cEmpty.test(this.wordData[i])) {
  163. this.$message.error('请填写联系方式')
  164. document.querySelector('#applyParsonName').scrollIntoView({ behavior: "smooth" });
  165. return false
  166. }
  167. break;
  168. case 'beginTime':
  169. if (cEmpty.test(this.wordData[i])) {
  170. this.$message.error('请选择项目起始时间')
  171. document.querySelector('#beginTime').scrollIntoView({ behavior: "smooth" });
  172. return false
  173. }
  174. break;
  175. case 'endTime':
  176. if (cEmpty.test(this.wordData[i])) {
  177. this.$message.error('请选择计划完成时间')
  178. document.querySelector('#beginTime').scrollIntoView({ behavior: "smooth" });
  179. return false
  180. }
  181. break;
  182. case 'studentS':
  183. let snum = 0;
  184. this.wordData[i].forEach(item=>{
  185. for(let j in item){
  186. if(cEmpty.test(item[j])){
  187. snum++;
  188. }
  189. }
  190. })
  191. if(snum>0){
  192. this.$message.error("请填完学生信息");
  193. document.querySelector('#studentS').scrollIntoView({ behavior: "smooth" });
  194. return false;
  195. }
  196. // }
  197. break;
  198. case 'teacherS':
  199. let num = 0;
  200. this.wordData[i].forEach(item=>{
  201. for(let j in item){
  202. if(cEmpty.test(item[j])){
  203. num++;
  204. }
  205. }
  206. })
  207. if(num>0){
  208. this.$message.error("请填完老师信息");
  209. document.querySelector('#teacherS').scrollIntoView({ behavior: "smooth" });
  210. return false;
  211. }
  212. break;
  213. case 'brief':
  214. if (cEmpty.test(this.wordData[i])) {
  215. this.$message.error('请填写项目简介')
  216. // this.$refs.brief.style.background='rgb(236, 141, 141)'
  217. // setTimeout(() => {
  218. // this.$refs.brief.style.background='#ffffff'
  219. // }, 2000);
  220. document.querySelector('#brief').scrollIntoView({ behavior: "smooth" });
  221. return false
  222. }
  223. break;
  224. case 'fund':
  225. let mon=this.wordData.fund.facility*1 + this.wordData.fund.materials*1+this.wordData.fund.process*1+ this.wordData.fund.assist*1+this.wordData.fund.authenticate*1+ this.wordData.fund.match*1+this.wordData.fund.activity*1+this.wordData.fund.affair*1
  226. if(mon==0){
  227. document.querySelector('#fund').scrollIntoView({ behavior: "smooth" });
  228. return this.$message.error('请输入经费')
  229. }
  230. break;
  231. }
  232. }
  233. this.wordData['total']=this.wordData.fund.facility*1 + this.wordData.fund.materials*1+this.wordData.fund.process*1+ this.wordData.fund.assist*1+this.wordData.fund.authenticate*1+ this.wordData.fund.match*1+this.wordData.fund.activity*1+this.wordData.fund.affair*1
  234. this.submitHint=true;
  235. },
  236. submitWord(){ //提交
  237. getProjectNo("XM").then((result)=>{
  238. let pram = {
  239. uid:this.$store.state.userInfo.userid,//用户ID
  240. pNo:result,//项目编号
  241. tid:"5e21b204-c206-11ed-a4cd-509a4c5b67cf",//特色创客空间建设项目分类ID
  242. tit:this.wordData['projectName'],//项目名称
  243. radio:this.wordData['radio'],//项目分组
  244. checkList:JSON.stringify(this.wordData['checkList']),//优先支持项目
  245. schoolRadio:this.wordData['schoolRadio'],//美丽校园改造项目
  246. applyParsonRadio:this.wordData['applyParsonRadio'],//项 目 申 请 人
  247. applyParsonName:this.wordData['applyParsonName'],//申请人姓名
  248. cid:this.wordData['college'],//学院ID,
  249. tel:this.wordData['tel'],//联系电话
  250. beh:this.wordData['beginTime'],//项目开始时间,
  251. planEnd:this.wordData['endTime'],//计划完成时间,
  252. cs:JSON.stringify(this.wordData['studentS']),//学生组,
  253. ct:JSON.stringify(this.wordData['teacherS']),//教师组,
  254. bf:this.wordData['brief'],//项目简介
  255. introduce:JSON.stringify(this.wordData['introduce']),//项目详细
  256. mon:JSON.stringify(this.wordData['fund']),//预算经费
  257. f:this.wordData['total'],//总经费
  258. apply:this.wordData['applicationDate'],//申请日期
  259. }
  260. this.ajax
  261. .post(this.$store.state.api+'/studentProjectWordApply',pram)
  262. .then(result=>{
  263. console.log(result);
  264. if(result['data']==1){
  265. this.$message.success("项目提交成功");
  266. this.$router.push('/projectApplication')
  267. }else{
  268. this.$message.error("项目提交失败");
  269. }
  270. },err=>{
  271. console.log(err);
  272. }).catch(err=>{
  273. console.log(err);
  274. })
  275. })
  276. }
  277. }
  278. };
  279. </script>
  280. <style lang="less" scoped>
  281. </style>