makerfundApply.vue 20 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677
  1. <template>
  2. <!-- 创客资金申请表单 -->
  3. <div class="makerfundApply">
  4. <div class="vfpHeader">
  5. <div class="titleOne">创客资金申请</div>
  6. <el-button type="primary" @click="$router.back()">返回</el-button>
  7. </div>
  8. <hr>
  9. <!-- 项目名称、类型开始 -->
  10. <div class="Apply1">
  11. <div class="inpInterval">项目名称</div>
  12. <el-select v-model="selects.projectName" style="width: 30%;" placeholder="请选择">
  13. <el-option
  14. v-for="item in projectFilter"
  15. :key="item.id"
  16. :label="item.title"
  17. :value="item.id">
  18. </el-option>
  19. </el-select>
  20. </div>
  21. <div class="Apply1">
  22. <div class="inpInterval">项目类型</div>
  23. <el-select v-model="selects.projectType" placeholder="请选择">
  24. <el-option
  25. v-for="item in projectType"
  26. :key="item.id"
  27. :label="item.name"
  28. :value="item.name">
  29. </el-option>
  30. </el-select>
  31. </div>
  32. <!-- 项目名称、类型结束 -->
  33. <div class="tabTit">
  34. <div>
  35. <p>经费支出类别(单位:元)</p>
  36. </div>
  37. </div>
  38. <hr>
  39. <div class="moneyBlock" v-for="(item,index) in directFundBlock" :key="index"> <!-- 直接经费 -->
  40. <div class="howMoneyFlex">
  41. <div class="howMoney">
  42. <div class="inpInterval">直接经费</div>
  43. <el-select v-model="item.directFundData" placeholder="请选择">
  44. <el-option
  45. v-for="item in item.directFundSelects"
  46. :key="item.value"
  47. :label="item.label"
  48. :value="item.value">
  49. </el-option>
  50. </el-select>
  51. </div>
  52. <div class="howMoney">
  53. <div class="inpInterval twoStyle">预算</div>
  54. <el-input v-model="item.budget" class="howMoneyInp" placeholder="金额"></el-input>
  55. </div>
  56. <div class="howMoney">
  57. <div class="inpInterval twoStyle">已支付</div>
  58. <el-input v-model="item.usedFund" class="howMoneyInp" placeholder="金额"></el-input>
  59. </div>
  60. <div class="howMoney">
  61. <div class="inpInterval twoStyle">余额</div>
  62. <el-input v-model="item.remainFund" class="howMoneyInp" placeholder="金额"></el-input>
  63. </div>
  64. </div>
  65. <div class="howMoney" style="margin-top:20px">
  66. <div class="inpInterval" style="position: relative;top:-20px">事由</div>
  67. <el-input
  68. type="textarea"
  69. :rows="3"
  70. class="textArea"
  71. resize="none"
  72. style="width:800px"
  73. placeholder="请输入内容"
  74. v-model="item.reason">
  75. </el-input>
  76. </div>
  77. </div>
  78. <div>
  79. <div class="addMoneyBtn" @click="addDirectFund">
  80. <div class="jia">+</div>添加
  81. </div>
  82. </div>
  83. <div> <!-- 间接经费 -->
  84. <div class="moneyBlock" v-for="(item,i) in indirectFundBlock" :key="i">
  85. <div class="howMoneyFlex">
  86. <div class="howMoney">
  87. <div class="inpInterval">间接经费</div>
  88. <el-select v-model="item.indirectFundData" placeholder="请选择">
  89. <el-option
  90. v-for="item in item.indirectFundSelects"
  91. :key="item.value"
  92. :label="item.label"
  93. :value="item.value">
  94. </el-option>
  95. </el-select>
  96. </div>
  97. <div class="howMoney">
  98. <div class="inpInterval twoStyle">预算</div>
  99. <el-input v-model="item.budget" class="howMoneyInp" placeholder="金额"></el-input>
  100. </div>
  101. <div class="howMoney">
  102. <div class="inpInterval twoStyle">已支付</div>
  103. <el-input v-model="item.usedFund" class="howMoneyInp" placeholder="金额"></el-input>
  104. </div>
  105. <div class="howMoney">
  106. <div class="inpInterval twoStyle">余额</div>
  107. <el-input v-model="item.remainFund" class="howMoneyInp" placeholder="金额"></el-input>
  108. </div>
  109. </div>
  110. <div class="howMoney" style="margin-top:20px">
  111. <div class="inpInterval" style="position: relative;top:-20px">事由</div>
  112. <el-input
  113. type="textarea"
  114. :rows="3"
  115. class="textArea"
  116. resize="none"
  117. style="width:800px"
  118. placeholder="请输入内容"
  119. v-model="item.reason">
  120. </el-input>
  121. </div>
  122. </div>
  123. </div>
  124. <div>
  125. <div class="addMoneyBtn" @click="addIndirectFund">
  126. <div class="jia">+</div>添加
  127. </div>
  128. </div>
  129. <div class="moneyBlock"> <!-- 其他经费 -->
  130. <div class="howMoneyFlex">
  131. <div class="howMoney">
  132. <div class="inpInterval" >其他</div>
  133. <el-input v-model="residue.elseReason" placeholder="请输入内容"></el-input>
  134. </div>
  135. <div class="howMoney">
  136. <div class="inpInterval twoStyle">预算</div>
  137. <el-input v-model="residue.budget" class="howMoneyInp" placeholder="金额"></el-input>
  138. </div>
  139. <div class="howMoney">
  140. <div class="inpInterval twoStyle">已支付</div>
  141. <el-input v-model="residue.usedFund" class="howMoneyInp" placeholder="金额"></el-input>
  142. </div>
  143. <div class="howMoney">
  144. <div class="inpInterval twoStyle">余额</div>
  145. <el-input v-model="residue.remainFund" class="howMoneyInp" placeholder="金额"></el-input>
  146. </div>
  147. </div>
  148. <div class="howMoney" style="margin-top:20px">
  149. <div class="inpInterval" style="position: relative;top:-20px">备注</div>
  150. <el-input
  151. type="textarea"
  152. :rows="3"
  153. resize="none"
  154. class="textArea"
  155. style="width:800px"
  156. placeholder="请输入内容"
  157. v-model="residue.reason">
  158. </el-input>
  159. </div>
  160. </div>
  161. <div> <!-- 附件上传 -->
  162. <div class="tabTit">
  163. <div><p>附件上传</p></div>
  164. </div>
  165. <hr>
  166. <div style="display: flex;justify-content: flex-start;">
  167. <el-upload
  168. class="avatar-uploader"
  169. action="#"
  170. disabled
  171. :show-file-list="false"
  172. v-for="(item,index) in this.file" :key="index"
  173. >
  174. <img v-if="imageUrl" :src="imageUrl" class="avatar">
  175. <i v-else class="el-icon-plus avatar-uploader-icon"></i>
  176. </el-upload>
  177. </div>
  178. <div>
  179. <div class="addMoneyBtn" style="position: relative;">
  180. <div class="jia">+</div>添加
  181. <BeUpload @getFile="getFile" style="position: absolute;left: 0;width: 120px;height: 40px;opacity: 0;" class="uploadPic" :navName="'上传封面'" :accept="accept"></BeUpload>
  182. </div>
  183. </div>
  184. </div>
  185. <div class="baseBtn">
  186. <div class="blockWidth">
  187. <el-button type="primary">生成表单</el-button>
  188. <el-button type="primary" @click="uploadData">提交</el-button>
  189. </div>
  190. </div>
  191. <!-- 提交对话框开始 -->
  192. <el-dialog
  193. title="提示"
  194. :visible.sync="submitHint"
  195. width="600px"
  196. class="projectApplicationfundAddDialog"
  197. :before-close="init">
  198. <div class="addDialogLogo">LOGO</div>
  199. <div class="deleteContent">确定提交?</div>
  200. <span slot="footer" class="dialog-footer">
  201. <el-button type="primary" @click="submitAll" class="btn5">确认提交</el-button>
  202. <el-button @click="init" class="btn5" style="background:#cccccc" size="small">取消</el-button>
  203. </span>
  204. </el-dialog>
  205. <!-- 提交对话框结束 -->
  206. </div>
  207. </template>
  208. <script>
  209. import BeUpload from "../../components/tool/beUpload.vue";
  210. export default {
  211. components: {
  212. BeUpload,
  213. },
  214. data() {
  215. return {
  216. accept:"*",
  217. submitHint:false, //提交按钮
  218. imageUrl: require('../../assets/img/cocoClass.png'),
  219. file:[],
  220. selects:{
  221. projectName:'',
  222. projectType:''
  223. },
  224. projectFilter:[], //项目名称
  225. projectType:[ //项目类型
  226. {
  227. id:1,
  228. name:'个人创客'
  229. },
  230. {
  231. id:2,
  232. name:'创客活动'
  233. }
  234. ],
  235. directFundBlock:[ //直接经费
  236. {
  237. directFundData:'',
  238. directFundSelects:[
  239. {
  240. value:1,
  241. label:'小型仪器设备费'
  242. },
  243. {
  244. value:2,
  245. label:'材料费'
  246. },
  247. {
  248. value:3,
  249. label:'测试化验加工费'
  250. },
  251. {
  252. value:4,
  253. label:'项目协作费'
  254. },
  255. {
  256. value:5,
  257. label:'其他支出'
  258. },
  259. ],
  260. budget:'', //预算
  261. usedFund:'', //已使用
  262. remainFund:'',
  263. reason:'' //理由
  264. }
  265. ],
  266. newDirectFundBlock:{ //添加直接经费
  267. directFundData:'',
  268. directFundSelects:[
  269. {
  270. value:1,
  271. label:'小型仪器设备费'
  272. },
  273. {
  274. value:2,
  275. label:'材料费'
  276. },
  277. {
  278. value:3,
  279. label:'测试化验加工费'
  280. },
  281. {
  282. value:4,
  283. label:'项目协作费'
  284. },
  285. {
  286. value:5,
  287. label:'其他支出'
  288. },
  289. ],
  290. budget:'', //预算
  291. usedFund:'', //已使用
  292. remainFund:'',
  293. reason:'' //理由
  294. },
  295. indirectFundBlock:[ //间接经费
  296. {
  297. indirectFundData:'',
  298. indirectFundSelects:[
  299. {
  300. value:1,
  301. label:'项目成功鉴定费'
  302. },
  303. {
  304. value:2,
  305. label:'参展参赛费'
  306. },
  307. {
  308. value:3,
  309. label:'创客交流活动费'
  310. },
  311. {
  312. value:4,
  313. label:'知识产权事务费'
  314. },
  315. {
  316. value:5,
  317. label:'其他支出'
  318. },
  319. ],
  320. budget:'', //预算
  321. usedFund:'', //已使用
  322. remainFund:'',
  323. reason:'' //理由
  324. }
  325. ],
  326. newIndirectFundBlock:{ //添加间接经费
  327. indirectFundData:'',
  328. indirectFundSelects:[
  329. {
  330. value:1,
  331. label:'项目成功鉴定费'
  332. },
  333. {
  334. value:2,
  335. label:'参展参赛费'
  336. },
  337. {
  338. value:3,
  339. label:'创客交流活动费'
  340. },
  341. {
  342. value:4,
  343. label:'知识产权事务费'
  344. },
  345. {
  346. value:5,
  347. label:'其他支出'
  348. },
  349. ],
  350. budget:'', //预算
  351. usedFund:'', //已使用
  352. remainFund:'',
  353. reason:'' //理由
  354. },
  355. residue:{ //其他
  356. elseReason:'',
  357. budget:'',
  358. usedFund:'',
  359. remainFund:'',
  360. reason:'',
  361. }
  362. ,
  363. }
  364. },
  365. computed :{
  366. // sum(){
  367. // // return 1+1
  368. // let addsum=[]
  369. // this.directFundBlock.forEach((e,i)=>{
  370. // // console.log( e.budget-e.usedFund);
  371. // addsum.push(e.budget-e.usedFund)
  372. // })
  373. // return addsum
  374. // },
  375. },
  376. methods:{
  377. uploadData(){
  378. this.submitHint=true;
  379. },
  380. submitAll(){
  381. if(this.selects.projectName=='') return this.$message.error('请选择项目名称')
  382. if(this.selects.projectType=='') return this.$message.error('请选择项目类型')
  383. let num=0;
  384. let sum = this.directFundBlock.reduce((per,cur)=>{
  385. return per+cur[budget]
  386. })
  387. console.log(sum);
  388. // return
  389. let param={
  390. uid:this.$store.state.userInfo.userid,
  391. cid:this.selects.projectName,
  392. type:this.selects.projectType,
  393. dir:JSON.stringify(this.directFundBlock),
  394. indir:JSON.stringify(this.indirectFundBlock),
  395. elseFund:JSON.stringify(this.residue),
  396. file:JSON.stringify(this.file)
  397. }
  398. this.ajax
  399. .post(this.$store.state.api+'/insertMakerFund',param)
  400. .then(res=>{
  401. console.log(res);
  402. if (res.data==1) {
  403. this.$router.push('/makerfund')
  404. return this.$message.success('创建成功')
  405. }else{
  406. this.$message.error('创建失败')
  407. }
  408. },err=>{
  409. console.log(err);
  410. })
  411. },
  412. getFile(val) { //上传封面
  413. console.log(val);
  414. this.file.push(val)
  415. this.imageUrl=require("../../assets/img/cocoClass.png")
  416. },
  417. getData(){
  418. this.ajax
  419. .get(this.$store.state.api+'/SelectMakerFundSelects',{uid:this.$store.state.userInfo.userid})
  420. .then(res=>{
  421. console.log(res.data);
  422. this.projectFilter=res.data[0]
  423. },err=>{
  424. console.log(err);
  425. })
  426. },
  427. addDirectFund(){
  428. let oldArr={};
  429. Object.assign(oldArr,this.newDirectFundBlock)
  430. this.directFundBlock.push(oldArr)
  431. for(let k in this.newDirectFundBlock) return this.newDirectFundBlock[k]=''
  432. },
  433. addIndirectFund(){
  434. this.indirectFundBlock.push(this.newIndirectFundBlock)
  435. },
  436. init(){
  437. //重置
  438. // this.projectApplicationApply1.addMemberDialog=false
  439. this.submitHint=false;
  440. },
  441. },
  442. mounted(){
  443. this.getData()
  444. }
  445. }
  446. </script>
  447. <style lang="less">
  448. .makerfundApply{
  449. //提交对话框开始
  450. .projectApplicationfundAddDialog{
  451. .el-dialog__header{
  452. display: flex;
  453. justify-content: center;
  454. }
  455. .el-dialog{
  456. border-radius: 5px;
  457. overflow: hidden;
  458. top: 10%;
  459. }
  460. .deleteContent{
  461. width: 100%;
  462. text-align: center;
  463. font-size: 22px;
  464. color: #000;
  465. }
  466. .addDialogLogo{
  467. width: 60px;
  468. height: 30px;
  469. border-radius: 5px;
  470. display: flex;
  471. justify-content: center;
  472. line-height: 30px;
  473. background: #f2f2f2;
  474. position: absolute;
  475. left: 20px; top: 15px;
  476. }
  477. .el-dialog__header{
  478. background: #32455b;
  479. }
  480. .el-dialog__title{
  481. font-size: 18px;
  482. color:rgb(246, 247, 246);
  483. }
  484. .addDialogMid{
  485. box-sizing: border-box;
  486. padding:0 60px 0 10px;
  487. .addDialogTit{
  488. display: flex;
  489. span{
  490. width: 80px;
  491. line-height: 40px;
  492. text-align: left;
  493. }
  494. }
  495. .addDialogTit1{
  496. display: flex;
  497. justify-content: space-between;
  498. margin-bottom: 15px;
  499. }
  500. .addDialogTit2{
  501. margin-top: 10px;
  502. font-size: 18px;
  503. color: #000;
  504. text-indent: 2em;
  505. }
  506. .addDialogCon{
  507. margin-top: 20px;
  508. }
  509. }
  510. .dialog-footer{
  511. display: flex;
  512. justify-content: center;
  513. .btn5{
  514. height: 40px;
  515. font-size: 16px;
  516. background: #0e72e6;
  517. width: 200px;
  518. }
  519. }
  520. }
  521. //提交对话框结束
  522. .avatar-uploader .el-upload {
  523. border: 1px dashed #d9d9d9;
  524. border-radius: 6px;
  525. cursor: pointer;
  526. position: relative;
  527. overflow: hidden;
  528. }
  529. // .avatar-uploader .el-upload:hover {
  530. // border-color: #409EFF;
  531. // }
  532. .avatar-uploader-icon {
  533. font-size: 28px;
  534. color: #8c939d;
  535. width: 178px;
  536. height: 178px;
  537. line-height: 178px;
  538. text-align: center;
  539. }
  540. .avatar {
  541. width: 178px;
  542. height: 178px;
  543. display: block;
  544. }
  545. .Apply1{
  546. height: 45px;
  547. width: 100%;
  548. display: flex;
  549. justify-content: flex-start;
  550. margin-top: 20px;
  551. .inpName{
  552. height: 40px;
  553. outline:none ;
  554. width: 600px;
  555. border: #ccc 1px solid;
  556. border-radius: 5px;
  557. box-sizing: border-box;
  558. padding: 1px 15px;
  559. }
  560. }
  561. .inpInterval{
  562. min-width: 70px;
  563. display: inline-block;
  564. text-align: justify;
  565. text-justify:distribute-all-lines;
  566. text-align-last: justify;
  567. transform: translate(0,22%);
  568. padding-right: 15px;
  569. font-size: 16px;
  570. }
  571. .moneyBlock{
  572. max-width: 100%;
  573. margin-bottom: 20px;
  574. .howMoney{
  575. display: flex;
  576. margin-right: 10px;
  577. }
  578. }
  579. .howMoneyFlex{
  580. display: flex;
  581. }
  582. .howMoneyInp{
  583. .el-input__inner{
  584. width: 170px;
  585. }
  586. }
  587. .addMoneyBtn{ //添加样式
  588. width: 120px;
  589. height: 40px;
  590. border: #000 1px dashed;
  591. border-radius: 5px;
  592. margin: 15px 85px 30px;
  593. display: flex;
  594. justify-content: center;
  595. line-height: 40px;
  596. .jia{
  597. border-radius: 50%;
  598. border: 1.5px #ccc solid;
  599. font-size: 25px;
  600. line-height: 26px;
  601. font-weight: 10;
  602. margin-top: 6px;
  603. margin-right: 5px;
  604. height: 27px;
  605. width: 27px;
  606. color: #ccc;
  607. }
  608. }
  609. .makerfundDetailsaddMoneyBtn{ // 附件添加按钮样式开始
  610. width: 120px;
  611. height: 40px;
  612. border: #000 1px dashed;
  613. border-radius: 5px;
  614. margin: 35px auto 30px;
  615. display: flex;
  616. justify-content: center;
  617. line-height: 40px;
  618. cursor: pointer;
  619. .jia{
  620. border-radius: 50%;
  621. border: 1.5px #ccc solid;
  622. font-size: 25px;
  623. line-height: 26px;
  624. font-weight: 10;
  625. margin-top: 6px;
  626. margin-right: 5px;
  627. height: 27px;
  628. width: 27px;
  629. color: #ccc;
  630. }
  631. }
  632. }
  633. </style>