makerActivityWordDetail.vue 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328
  1. <template>
  2. <div id="makerActivityWordDetail" v-loading="loading">
  3. <div class="projectApplication1">
  4. <div class="vfpHeader">
  5. <div class="titleOne">活动详细</div>
  6. <el-button @click="back()" type="primary" size="mini">返回</el-button>
  7. </div>
  8. <hr>
  9. </div>
  10. <markeractivityWord v-if="wordData['type']==0 && wordData['state']==0" :wordData="wordData" :total="total" :changeFund="changeFund" :allFund="wordData['allFund']"/>
  11. <NomMarkerWord v-if="wordData['type']==1 && wordData['state']==0" :wordData="wordData" :total="total"/>
  12. <markeractivityWordShow ref="myChild" v-if="wordData['state']!=0 || downloadDig" :wordData="wordData" :total="total"/>
  13. <div>
  14. <el-button type="primary" @click="downloadWordDig=true">下载表单(Word)</el-button>
  15. <el-button type="primary" @click="downloadDig=true">下载表单(PDF)</el-button>
  16. <el-button type="primary" v-if="wordData['state']==0" @click="test">立即修改</el-button>
  17. </div>
  18. <el-dialog
  19. title="提示"
  20. :visible.sync="submitHint"
  21. width="600px"
  22. class="pageSubmitData">
  23. <div class="deleteContent">确定修改“{{wordData['activityName']}}”活动?</div>
  24. <span slot="footer" class="dialog-footer">
  25. <el-button type="primary" @click="changeActivity" class="AllDialogBtn">确认提交</el-button>
  26. <el-button @click="submitHint=false" class="AllDialogBtn">取消</el-button>
  27. </span>
  28. </el-dialog>
  29. <!-- 下载文档开始 -->
  30. <el-dialog
  31. title="下载文档(PDF)"
  32. :visible.sync="downloadDig"
  33. width="600px"
  34. class="pageSubmitData">
  35. <div class="deleteContent">确定下载文档?</div>
  36. <span slot="footer" class="dialog-footer">
  37. <el-button type="primary" @click="downloadWord" class="AllDialogBtn">确认</el-button>
  38. <el-button @click="downloadDig=false" class="AllDialogBtn" >取消</el-button>
  39. </span>
  40. </el-dialog>
  41. <el-dialog
  42. title="下载文档(Word)"
  43. :visible.sync="downloadWordDig"
  44. width="600px"
  45. class="pageSubmitData">
  46. <div class="deleteContent">确定下载文档?</div>
  47. <span slot="footer" class="dialog-footer">
  48. <el-button type="primary" @click="getActivityWord" class="AllDialogBtn">确认</el-button>
  49. <el-button @click="downloadWordDig=false" class="AllDialogBtn" >取消</el-button>
  50. </span>
  51. </el-dialog>
  52. <!-- 下载文档结束-->
  53. </div>
  54. </template>
  55. <script>
  56. import markeractivityWord from './components/markeractivityWord.vue'
  57. import NomMarkerWord from './components/NomMarkerWord.vue'
  58. import markeractivityWordShow from './components/markeractivityWordShow.vue'
  59. import {makerActivityWord} from '@/components/tool/getWord'
  60. import {downloadPDF} from '@/components/tool/pdf'
  61. export default {
  62. components:{markeractivityWord,NomMarkerWord,markeractivityWordShow},
  63. data() {
  64. return {
  65. loading:false,
  66. submitHint:false,
  67. downloadDig:false,
  68. downloadWordDig:false,
  69. wordData:{
  70. allFund:0,
  71. acId:"",//活动ID
  72. applicationDate:'',//申请日期
  73. associatedProjects:"",//关联项目
  74. ProjectName:"",//关联项目名称
  75. activityName:'',//活动名称
  76. pro_leader:"",//活动负责人
  77. college: '',//所在学院ID
  78. collegeName:"",//所在学院名称
  79. tel:'',//联系电话
  80. activityTime:"",//活动时间
  81. student:0,//参与学生人数
  82. member:[
  83. {name:"",collage:"",work:""},
  84. {name:"",collage:"",work:""},
  85. {name:"",collage:"",work:""},
  86. {name:"",collage:"",work:""},
  87. {name:"",collage:"",work:""},
  88. ],
  89. activityPlan:"",//活动计划
  90. expectations:"",//预期目标
  91. eventAudience:"",//活动受众面
  92. fundingPlan:"",//经费支出计划
  93. expenditureMothPlan:['','','','','','','','','','','',''],
  94. fund:{
  95. device:"",
  96. Material:"",
  97. processing:"",
  98. Collaboration:"",
  99. APPRAISAL:"",
  100. entery:"",
  101. activities:"",
  102. Transaction:"",
  103. },//预算经费
  104. type:0,//0 创客活动 1 个人创客
  105. state:1,//项目状态 0未审核 1待报销 2 已审核 3 已报销
  106. }
  107. }
  108. },
  109. methods:{
  110. changeFund(newFund){
  111. this.wordData['allFund'] = newFund;
  112. },
  113. back(){
  114. this.$router.push('/makerActvity')
  115. },
  116. getData(){
  117. this.loading = true;
  118. let pram = {
  119. uid:this.$store.state.userInfo.userid,
  120. acid:this.$route.query['Id']
  121. }
  122. this.ajax.get(this.$store.state.api+"/getActivityWordData",pram).then(result=>{
  123. let data = result['data'][0][0]
  124. this.wordData['applicationDate'] = data['applicationDate'];
  125. this.wordData['associatedProjects'] = data['pid'];
  126. this.wordData['activityName'] = data['title'];
  127. this.wordData['pro_leader'] = data['pro_leader'];
  128. this.wordData['college'] = data['classid'];
  129. this.wordData['tel'] = data['phone']
  130. this.wordData['activityTime'] = JSON.parse(data['begin_at']);
  131. this.wordData['student'] = data['students'];
  132. this.wordData['member'] = JSON.parse(data['course_teacher']);
  133. this.wordData['expenditureMothPlan'] = JSON.parse(data['MothPlan']);
  134. this.wordData['fund'] = JSON.parse(data['fund']);
  135. this.wordData['type'] = data['type'];
  136. this.wordData['ProjectName'] = data['PName'];
  137. this.wordData['collegeName'] = data['CName'];
  138. this.wordData['acId'] = data['acId']
  139. this.wordData['state'] = data['state']
  140. // console.log(this.wordData)
  141. this.wordData = {...this.wordData,...JSON.parse(data['chapters'])}
  142. this.loading = false;
  143. }).catch(err=>{
  144. console.log(err)
  145. })
  146. },
  147. test(){
  148. const cEmpty = /^\s*$/g;
  149. const checkPhone = /^(?:(?:\+|00)86)?1(?:(?:3[\d])|(?:4[5-79])|(?:5[0-35-9])|(?:6[5-7])|(?:7[0-8])|(?:8[\d])|(?:9[189]))\d{8}$/; //获取正则表达式 存放到verify变量中
  150. for(let i in this.wordData){
  151. switch(i){
  152. case "associatedProjects":
  153. if(cEmpty.test(this.wordData[i]) && this.wordData['type']==0){
  154. this.$message.error("请选择关联项目")
  155. document.querySelector('#one').scrollIntoView({ behavior: "smooth" });
  156. return false;
  157. }
  158. break;
  159. case "activityName":
  160. if(cEmpty.test(this.wordData[i])){
  161. this.$message.error("请输入活动名称")
  162. document.querySelector('#two').scrollIntoView({ behavior: "smooth" });
  163. return false;
  164. }
  165. break;
  166. case "pro_leader":
  167. if(cEmpty.test(this.wordData[i])){
  168. this.$message.error("请输入活动负责人")
  169. document.querySelector('#three').scrollIntoView({ behavior: "smooth" });
  170. return false;
  171. }
  172. break;
  173. case "college":
  174. if(cEmpty.test(this.wordData[i])){
  175. this.$message.error("请选择所在学院")
  176. document.querySelector('#three').scrollIntoView({ behavior: "smooth" });
  177. return false;;
  178. }
  179. break;
  180. case "tel":
  181. if(cEmpty.test(this.wordData[i])){
  182. this.$message.error("请输入联系电话")
  183. document.querySelector('#three').scrollIntoView({ behavior: "smooth" });
  184. return false;
  185. }else if(!checkPhone.test(this.wordData[i])){
  186. this.$message.error("请输入正确的手机号");
  187. document.querySelector('#three').scrollIntoView({ behavior: "smooth" });
  188. return false;
  189. }
  190. break;
  191. case "activityTime":
  192. if(this.wordData[i].length<=0){
  193. this.$message.error("请选择活动时间")
  194. document.querySelector('#four').scrollIntoView({ behavior: "smooth" });
  195. return false;;
  196. }
  197. break;
  198. // case "member":
  199. // let num = 0;
  200. // this.wordData[i].forEach(item=>{
  201. // if(cEmpty.test(item['name']))num++;
  202. // // for(let j in item){
  203. // // if(cEmpty.test(item[j])){
  204. // // num++;
  205. // // }
  206. // // }
  207. // })
  208. // if(num>0){
  209. // this.$message.error("请填完指导老师信息");
  210. // document.querySelector('#five').scrollIntoView({ behavior: "smooth" });
  211. // return false;
  212. // }
  213. // break;
  214. // case "activityPlan":
  215. // if(cEmpty.test(this.wordData[i][0])){
  216. // this.$message.error("请输入活动计划");
  217. // document.querySelector('#six').scrollIntoView({ behavior: "smooth" });
  218. // return false;
  219. // }
  220. // break;
  221. // case "expectations":
  222. // if(cEmpty.test(this.wordData[i][0])){
  223. // this.$message.error("预期目标");
  224. // document.querySelector('#seven').scrollIntoView({ behavior: "smooth" });
  225. // return false;
  226. // }
  227. // break;
  228. // case "eventAudience":
  229. // if(cEmpty.test(this.wordData[i][0])){
  230. // this.$message.error("活动受众面")
  231. // document.querySelector('#nine').scrollIntoView({ behavior: "smooth" });
  232. // return false;
  233. // }
  234. // break;
  235. // case "fundingPlan":
  236. // if(cEmpty.test(this.wordData[i][0])){
  237. // this.$message.error("经费支出计划")
  238. // document.querySelector('#ten').scrollIntoView({ behavior: "smooth" });
  239. // return false;
  240. // }
  241. // break;
  242. }
  243. }
  244. this.submitHint = true;
  245. },
  246. changeActivity(){
  247. let pram = {
  248. uid:this.$store.state.userInfo.userid,//用户ID
  249. aid:this.wordData['acId'],
  250. tit:this.wordData['activityName'],//活动名称
  251. courseId:this.wordData['associatedProjects'],//关联项目ID
  252. pLeader:this.wordData['pro_leader'],//活动负责人
  253. mon:this.total,//预算经费
  254. st:this.wordData['student'],//参与学生人数
  255. ct:JSON.stringify(this.wordData['member']),//活动指导老师
  256. chp:JSON.stringify({
  257. activityPlan:this.wordData['activityPlan'],//活动计划
  258. expectations:this.wordData['expectations'],//预期目标
  259. eventAudience:this.wordData['eventAudience'],//活动受众面
  260. fundingPlan:this.wordData['fundingPlan'],//经费支出计划
  261. }),//活动信息
  262. cid:this.wordData['college'],//学院ID,
  263. ph:this.wordData['tel'],//联系电话
  264. beg:JSON.stringify(this.wordData['activityTime']),//活动时间
  265. f:JSON.stringify(this.wordData['fund']),//预算经费明细
  266. appltTime:this.wordData['applicationDate'],//申请日期
  267. mp:JSON.stringify(this.wordData['expenditureMothPlan']),//月支出计划
  268. }
  269. this.ajax.post(this.$store.state.api+"/UpdateActivityWordData",pram).then(result=>{
  270. if(result['data']==1){
  271. this.$message.success("活动修改成功");
  272. this.submitHint = false;
  273. }else{
  274. this.$message.error("活动修改失败")
  275. }
  276. this.getData();
  277. }).catch(err=>{
  278. console.log(err)
  279. })
  280. },
  281. downloadWord(){
  282. downloadPDF(this.$refs.myChild.$refs.pdfShow,this.wordData['type']==0?'附件 2:创客专项资金项目申请表(创客活动)':'附件 2:创客专项资金项目申请表(个人创客)')
  283. this.downloadDig = false;
  284. // 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
  285. // return console.log(this.wordData);
  286. // getWord(this.downWordData)
  287. // this.downloadDig=false;
  288. },
  289. getActivityWord(){
  290. // if(this.wordData['type']==0){
  291. // this.$message.info("正在下载创客活动表单");
  292. makerActivityWord(this.wordData,this.total)
  293. this.downloadWordDig = false;
  294. // }else if(this.wordData['type']==1){
  295. // this.$message.info("正在下载个人创客表单")
  296. // }
  297. }
  298. },
  299. computed:{
  300. total() {
  301. let num = 0;
  302. for(let i in this.wordData['fund'])num += Number(this.wordData['fund'][i]);
  303. return num;
  304. // return (this.wordData.fund.facility*1 + this.wordData.fund.materials*1+this.wordData.fund.process*1+ this.input*1+this.wordData.fund.authenticate*1+ this.wordData.fund.match*1+this.wordData.fund.activity*1+this.wordData.fund.affair*1)/10000
  305. }
  306. },
  307. mounted(){
  308. this.getData();
  309. }
  310. }
  311. </script>
  312. <style lang="less">
  313. #makerActivityWordDetail{
  314. width: 100%;
  315. display: flex;
  316. flex-direction: column;
  317. align-items: center;
  318. .projectApplication1{
  319. width: 100%;
  320. }
  321. }
  322. </style>