makerfundDetails.vue 19 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639
  1. <template>
  2. <!-- 创客资金申请表单 -->
  3. <div v-loading="loading">
  4. <div class="vfpHeader">
  5. <div class="titleOne">活动资金详细</div>
  6. <el-button @click="$router.push('/makerfund')" type="primary" size="mini"
  7. >返回</el-button
  8. >
  9. </div>
  10. <hr />
  11. <!-- 项目名称、类型开始 -->
  12. <div class="Apply1">
  13. <div class="inpInterval">项目名称</div>
  14. <el-select
  15. disabled
  16. v-model="projectName"
  17. style="width: 30%"
  18. placeholder="请选择"
  19. >
  20. <el-option
  21. v-for="item in projectFilter"
  22. :key="item.id"
  23. :label="item.title"
  24. :value="item.id"
  25. >
  26. </el-option>
  27. </el-select>
  28. </div>
  29. <div class="tabTit">
  30. <div>
  31. <p>经费支出类别(单位:元)</p>
  32. </div>
  33. </div>
  34. <hr />
  35. <table border="1" cellspacing="0" class="table">
  36. <tr>
  37. <th colspan="2">经济支出类别</th>
  38. <th>预算</th>
  39. <th>已支付</th>
  40. <th style="position: relative">
  41. 本次申请<br />
  42. <div
  43. style="
  44. width: 100px;
  45. position: absolute;
  46. left: 50%;
  47. transform: translate(-50%);
  48. bottom: 1px;
  49. "
  50. >
  51. {{ create_at }}
  52. </div>
  53. </th>
  54. <th style="position: relative">
  55. 实际使用<br />
  56. <div
  57. style="
  58. width: 100px;
  59. position: absolute;
  60. left: 50%;
  61. transform: translate(-50%);
  62. bottom: 1px;
  63. "
  64. >
  65. {{ endTime }}
  66. </div>
  67. </th>
  68. <th>余额</th>
  69. <th colspan="3">备注</th>
  70. </tr>
  71. <tr v-for="(item, index) in fundList" :key="index">
  72. <td colspan="2">{{ item.fundName }}</td>
  73. <td>
  74. {{ item.budget }}
  75. </td>
  76. <td>
  77. {{ item.havePaid }}
  78. </td>
  79. <td>
  80. {{ item.thisApply }}
  81. </td>
  82. <td v-if="!state" style="background-color: rgb(234, 252, 186)">
  83. <el-input
  84. type="number"
  85. autosize
  86. style="width: 100%"
  87. resize="none"
  88. onkeypress="return (/[\d]/.test(String.fromCharCode(event.keyCode)))"
  89. placeholder="请输入金额"
  90. @change="isMoreApply(index)"
  91. v-model="item.actualuse"
  92. >
  93. </el-input>
  94. </td>
  95. <td v-if="state > 0">
  96. {{ item.actualuse }}
  97. </td>
  98. <td>
  99. <!-- 预算 -->
  100. {{
  101. state > 0
  102. ? item.budget - item.havePaid
  103. : item.budget - item.havePaid - item.actualuse
  104. }}
  105. <!-- {{ item.budget-item.havePaid-item.actualuse }} -->
  106. </td>
  107. <td colspan="3" style="box-sizing: border-box; padding: 0 10px">
  108. {{ item.remark }}
  109. </td>
  110. </tr>
  111. <tr>
  112. <td>事由</td>
  113. <td colspan="10" class="textLeft">
  114. <el-input
  115. type="textarea"
  116. :autosize="{ minRows: 6, maxRows: 20 }"
  117. style="width: 100%"
  118. resize="none"
  119. placeholder=""
  120. v-model="intro"
  121. >
  122. </el-input>
  123. </td>
  124. </tr>
  125. <tr>
  126. <td v-for="(i, k) in 9" :key="k" style="border: none"></td>
  127. </tr>
  128. </table>
  129. <div class="baseBtn">
  130. <div class="blockWidth">
  131. <el-button type="primary" @click="download">生成表单</el-button>
  132. <el-button type="primary" v-if="!state" @click="submitData"
  133. >提交</el-button
  134. >
  135. <el-button type="primary" v-if="state > 0" class="disa">提交</el-button>
  136. </div>
  137. </div>
  138. <!-- 下载文档开始 -->
  139. <el-dialog
  140. title="生成Excel"
  141. :visible.sync="downLoadExcelDig"
  142. width="600px"
  143. class="pageSubmitData"
  144. >
  145. <span class="deleteContent">确定生成Excel?</span>
  146. <span slot="footer" class="dialog-footer">
  147. <el-button type="primary" @click="downLoadExcel" class="AllDialogBtn"
  148. >确认</el-button
  149. >
  150. <el-button @click="downLoadExcelDig = false" class="AllDialogBtn"
  151. >取消</el-button
  152. >
  153. </span>
  154. </el-dialog>
  155. <!-- 下载文档结束-->
  156. <!-- 提交文档开始 -->
  157. <el-dialog
  158. title="提交"
  159. :visible.sync="submitDataDig"
  160. width="600px"
  161. class="pageSubmitData"
  162. >
  163. <span class="deleteContent">确定提交?</span>
  164. <span slot="footer" class="dialog-footer">
  165. <el-button type="primary" @click="submitAll" class="AllDialogBtn"
  166. >确认</el-button
  167. >
  168. <el-button @click="submitDataDig = false" class="AllDialogBtn"
  169. >取消</el-button
  170. >
  171. </span>
  172. </el-dialog>
  173. <!-- 提交文档结束-->
  174. </div>
  175. </template>
  176. <script>
  177. import getFundNo from "@/components/tool/getProjectNo";
  178. import BeUpload from "../../components/tool/beUpload.vue";
  179. // import getExcel from "@/components/tool/getExcel";
  180. import { getExcel2 } from "@/components/tool/downloadExcel";
  181. export default {
  182. components: {
  183. BeUpload,
  184. },
  185. data() {
  186. return {
  187. loading:false,
  188. projectFilter: [], //项目名称列表
  189. projectName: "", //所选名称
  190. downLoadExcelDig: false, //下载Excel对话框
  191. submitDataDig: false, //提交对话框
  192. allFund: 0, //总经费
  193. fundList: [
  194. //table遍历数据
  195. {
  196. fundName: "小型仪器设备费",
  197. budget: "",
  198. havePaid: 0,
  199. thisApply: "",
  200. actualuse: "",
  201. remark: "项目开展所需的小型专用仪器设备、工具、配件购置或租赁费用。",
  202. },
  203. {
  204. fundName: "材料费",
  205. budget: "",
  206. havePaid: 0,
  207. thisApply: "",
  208. actualuse: "",
  209. remark:
  210. "项目开展需消耗的各种原材料、辅助材料等低值易耗品的采购费用。",
  211. },
  212. {
  213. fundName: "测试化验加工费",
  214. budget: "",
  215. havePaid: 0,
  216. thisApply: "",
  217. actualuse: "",
  218. remark:
  219. "项目开展过程中支付给外单位的检验、测试、化验、计算、分析及加工费等费用。",
  220. },
  221. {
  222. fundName: "项目协作费",
  223. budget: "",
  224. havePaid: 0,
  225. thisApply: "",
  226. actualuse: "",
  227. remark: "按合同规定支付给协作单位的费用",
  228. },
  229. {
  230. fundName: "项目成功鉴定费",
  231. budget: "",
  232. havePaid: 0,
  233. thisApply: "",
  234. actualuse: "",
  235. remark: "学术会务费、评审费、鉴定费、成果集制作费等费用。",
  236. },
  237. {
  238. fundName: "参展参赛费",
  239. budget: "",
  240. havePaid: 0,
  241. thisApply: "",
  242. actualuse: "",
  243. remark:
  244. "参加创客展会、竞赛等所需的报名费、展位费、布展费、宣传推广费及差旅费等费用。",
  245. },
  246. {
  247. fundName: "创客交流活动费",
  248. budget: "",
  249. havePaid: 0,
  250. thisApply: "",
  251. actualuse: "",
  252. remark:
  253. "创客交流活动中支付给校外专家的指导费、咨询费、授课费等费用。",
  254. },
  255. {
  256. fundName: "知识产权事务费",
  257. budget: "",
  258. havePaid: 0,
  259. thisApply: "",
  260. actualuse: "",
  261. remark: "论文版面费、专利及其他知识产权事务等费用。",
  262. },
  263. ],
  264. haveFund: "", //已支付经费
  265. intro: "", //事由
  266. tit: "", //活动名称
  267. ty: "", //活动类型
  268. state: 0,
  269. endTime: "",
  270. create_at: "",
  271. };
  272. },
  273. methods: {
  274. // console.log(this.projectName);
  275. //total:总经费
  276. //小型仪器设备费:device
  277. //材料费:Material
  278. //测试化验加工费:processing
  279. //项目协作费:Collaboration
  280. //项目成果鉴定费:APPRAISAL
  281. //参展参赛费:entery
  282. //创客交流活动费:activities
  283. //知识产权事务费:Transaction
  284. getData() {
  285. if(this.loading)return;
  286. this.loading = true;
  287. //获取活动经费的数据
  288. let param = {
  289. uid: this.$store.state.userInfo.userid,
  290. fid: this.$route.query["Id"],
  291. aid: this.$route.query["paid"],
  292. };
  293. // console.log(param);
  294. this.ajax
  295. .get(this.$store.state.api + "/selectActivityFundDetail", param)
  296. .then(
  297. (res) => {
  298. // console.log(res.data);
  299. let data = res.data;
  300. console.log(data);
  301. let applyfund = JSON.parse(data[0][0]["applyfund"]);
  302. let fund = "";
  303. // console.log(data[0][0]['applyfund']);
  304. if (data[0][0]["af"] != null) {
  305. fund = JSON.parse(data[0][0]["af"]);
  306. } else {
  307. fund = JSON.parse(data[0][0]["pf"]);
  308. }
  309. // return console.log(111);
  310. // let usedFund=JSON.parse(data['usedFund'])
  311. let actualuse = JSON.parse(data[0][0]["actualuse"]);
  312. // this.tit=data.title;
  313. // this.ty=data.type;
  314. let arr = res["data"][1].filter((e) => {
  315. return e.actualuse != null;
  316. });
  317. // console.log(arr);
  318. // let isUse = arr;
  319. if (arr) {
  320. // console.log(111);
  321. arr.forEach((item) => {
  322. let JP = JSON.parse(item["actualuse"]);
  323. this.fundList[0]["havePaid"] += Number(JP["device"]);
  324. this.fundList[1]["havePaid"] += Number(JP["Material"]);
  325. this.fundList[2]["havePaid"] += Number(JP["processing"]);
  326. this.fundList[3]["havePaid"] += Number(JP["Collaboration"]);
  327. this.fundList[4]["havePaid"] += Number(JP["APPRAISAL"]);
  328. this.fundList[5]["havePaid"] += Number(JP["entery"]);
  329. this.fundList[6]["havePaid"] += Number(JP["activities"]);
  330. this.fundList[7]["havePaid"] += Number(JP["Transaction"]);
  331. });
  332. }
  333. // 本次申请
  334. this.fundList[0].thisApply = applyfund.device;
  335. this.fundList[1].thisApply = applyfund.Material;
  336. this.fundList[2].thisApply = applyfund.processing;
  337. this.fundList[3].thisApply = applyfund.Collaboration;
  338. this.fundList[4].thisApply = applyfund.APPRAISAL;
  339. this.fundList[5].thisApply = applyfund.entery;
  340. this.fundList[6].thisApply = applyfund.activities;
  341. this.fundList[7].thisApply = applyfund.Transaction;
  342. // console.log(applyfund);
  343. // 预算
  344. this.fundList[0].budget = fund.device;
  345. this.fundList[1].budget = fund.Material;
  346. this.fundList[2].budget = fund.processing;
  347. this.fundList[3].budget = fund.Collaboration;
  348. this.fundList[4].budget = fund.APPRAISAL;
  349. this.fundList[5].budget = fund.entery;
  350. this.fundList[6].budget = fund.activities;
  351. this.fundList[7].budget = fund.Transaction;
  352. // if (data['usedFund']!=null) { //已使用
  353. // this.fundList[0].havePaid=usedFund.device
  354. // this.fundList[1].havePaid=usedFund.Material
  355. // this.fundList[2].havePaid=usedFund.processing
  356. // this.fundList[3].havePaid=usedFund.Collaboration
  357. // this.fundList[4].havePaid=usedFund.APPRAISAL
  358. // this.fundList[5].havePaid=usedFund.entery
  359. // this.fundList[6].havePaid=usedFund.activities
  360. // this.fundList[7].havePaid=usedFund.Transaction
  361. // }
  362. // 实际使用
  363. if (data[1][0]["actualuse"] != null) {
  364. this.fundList[0].actualuse = actualuse.device;
  365. this.fundList[1].actualuse = actualuse.Material;
  366. this.fundList[2].actualuse = actualuse.processing;
  367. this.fundList[3].actualuse = actualuse.Collaboration;
  368. this.fundList[4].actualuse = actualuse.APPRAISAL;
  369. this.fundList[5].actualuse = actualuse.entery;
  370. this.fundList[6].actualuse = actualuse.activities;
  371. this.fundList[7].actualuse = actualuse.Transaction;
  372. }
  373. // console.log(data.state);
  374. // if (data.state>0) {
  375. // this.fundList.forEach(e=>{
  376. // e.remark=e.budget*1-e.havePaid*1
  377. // })
  378. // }
  379. // return
  380. this.intro = data[0][0].intro;
  381. this.state = data[0][0].state;
  382. this.create_at = data[0][0].createTime;
  383. console.log(this.create_at);
  384. this.endTime = data[0][0].endTime;
  385. this.loading = false;
  386. },
  387. (err) => {
  388. console.log(err);
  389. }
  390. );
  391. },
  392. download() {
  393. // if(!this.projectName) return this.$message.error('请选择项目名称')
  394. this.downLoadExcelDig = true;
  395. },
  396. downLoadExcel() {
  397. //生成表单
  398. getExcel2(this.fundList, this.intro, this.tit, this.ty);
  399. this.downLoadExcelDig = false;
  400. },
  401. submitData() {
  402. if (!this.projectName) return this.$message.error("请选择项目名称");
  403. this.allFund = 0;
  404. this.fundList.forEach((e) => {
  405. this.allFund += e.budget * 1;
  406. });
  407. console.log(this.allFund);
  408. let arr = [
  409. this.fundList[0].actualuse,
  410. this.fundList[1].actualuse,
  411. this.fundList[2].actualuse,
  412. this.fundList[3].actualuse,
  413. this.fundList[4].actualuse,
  414. this.fundList[5].actualuse,
  415. this.fundList[6].actualuse,
  416. this.fundList[7].actualuse,
  417. ];
  418. let arr2 = [
  419. this.fundList[0].havePaid,
  420. this.fundList[1].havePaid,
  421. this.fundList[2].havePaid,
  422. this.fundList[3].havePaid,
  423. this.fundList[4].havePaid,
  424. this.fundList[5].havePaid,
  425. this.fundList[6].havePaid,
  426. this.fundList[7].havePaid,
  427. ];
  428. // console.log(arr);
  429. let fund = arr.reduce((prev, cur, index, arr) => {
  430. return prev + cur * 1;
  431. }, 0);
  432. let fund2 = arr2.reduce((prev, cur, index, arr) => {
  433. return prev + cur * 1;
  434. }, 0);
  435. // console.log(fund,fund2);
  436. if (fund == 0) return this.$message.error("请输入实际使用金额");
  437. if (fund + fund2 > this.allFund)
  438. return this.$message.error("申请金额已大于预算");
  439. this.submitDataDig = true;
  440. },
  441. submitAll() {
  442. //提交创客资金申请
  443. // getFundNo("ZJ").then((result)=>{
  444. // let arr={
  445. // device:(this.fundList[0].actualuse+this.haveFund.device*1),
  446. // Material:this.fundList[1].actualuse+this.haveFund.Material*1,
  447. // processing:this.fundList[2].actualuse+this.haveFund.processing*1,
  448. // Collaboration:this.fundList[3].actualuse+this.haveFund.Collaboration*1,
  449. // APPRAISAL:this.fundList[4].actualuse+this.haveFund.APPRAISAL*1,
  450. // entery:this.fundList[5].actualuse+this.haveFund.entery*1,
  451. // activities:this.fundList[6].actualuse+this.haveFund.activities*1,
  452. // Transaction:this.fundList[7].actualuse+this.haveFund.Transaction*1,
  453. // }
  454. // console.log(arr);
  455. let param = {
  456. uid: this.$store.state.userInfo.userid,
  457. // fNo:result, //项目编号
  458. fid: this.$route.query["Id"],
  459. intro: this.intro,
  460. f: JSON.stringify({
  461. device: this.fundList[0].actualuse,
  462. Material: this.fundList[1].actualuse,
  463. processing: this.fundList[2].actualuse,
  464. Collaboration: this.fundList[3].actualuse,
  465. APPRAISAL: this.fundList[4].actualuse,
  466. entery: this.fundList[5].actualuse,
  467. activities: this.fundList[6].actualuse,
  468. Transaction: this.fundList[7].actualuse,
  469. }),
  470. };
  471. // return console.log(param);
  472. this.ajax
  473. .post(this.$store.state.api + "/updateActivityFundDetail", param)
  474. .then(
  475. (res) => {
  476. console.log(res);
  477. if (res.data == 1) {
  478. this.$message.success("提交成功");
  479. this.submitDataDig = false;
  480. this.$router.push("/makerfund");
  481. } else {
  482. this.$message.error("提交失败");
  483. }
  484. },
  485. (err) => {
  486. console.log(err);
  487. }
  488. );
  489. // })
  490. },
  491. isMoreApply(i) {
  492. if (
  493. this.fundList[i].budget - this.fundList[i].actualuse <
  494. 0
  495. ) {
  496. this.$message({
  497. message: "实际使用不能超过余额!",
  498. type: "warning",
  499. });
  500. this.fundList[i].actualuse = 0;
  501. return;
  502. }
  503. },
  504. },
  505. mounted() {
  506. this.getData();
  507. this.projectName = this.$route.query["tit"];
  508. console.log(this.$route.query["Id"]);
  509. console.log(this.$route.query["tit"]);
  510. console.log(this.$route.query["paid"]);
  511. },
  512. };
  513. </script>
  514. <style lang="less" scoped>
  515. .Apply1 {
  516. //顶部下拉框
  517. height: 45px;
  518. width: 50%;
  519. display: flex;
  520. justify-content: flex-start;
  521. margin-top: 20px;
  522. }
  523. .inpInterval {
  524. //label
  525. min-width: 80px;
  526. display: inline-block;
  527. text-align: justify;
  528. text-justify: distribute-all-lines;
  529. text-align-last: justify;
  530. transform: translate(0, 22%);
  531. padding-right: 15px;
  532. font-size: 16px;
  533. }
  534. .table {
  535. border: none;
  536. border-top: solid 1px black;
  537. // border-right: solid 1px black;
  538. width: 90%;
  539. margin: auto;
  540. margin-top: 30px;
  541. .textLeft {
  542. :deep(.el-textarea__inner) {
  543. border: none;
  544. border-radius: 0px;
  545. text-align: left !important;
  546. font-size: 16px;
  547. }
  548. }
  549. tr th {
  550. height: 70px;
  551. border: none;
  552. border-bottom: solid 1px black;
  553. border-right: solid 1px black;
  554. &:nth-child(1) {
  555. border-left: solid 1px black;
  556. }
  557. }
  558. tr td {
  559. border: none;
  560. border-bottom: solid 1px black;
  561. border-right: solid 1px black;
  562. height: 50px;
  563. text-align: center;
  564. line-height: 30px;
  565. width: 80px;
  566. &:nth-child(1) {
  567. border-left: solid 1px black;
  568. }
  569. p {
  570. font-weight: 600;
  571. }
  572. :deep(.el-select .el-input .el-select__caret) {
  573. display: none;
  574. }
  575. :deep(.el-textarea__inner) {
  576. // padding: 0;
  577. border: none;
  578. border-radius: 0px;
  579. text-align: center;
  580. font-size: 16px;
  581. }
  582. :deep(.el-input__inner) {
  583. border: none;
  584. background: rgb(234, 252, 186);
  585. border-radius: 0px;
  586. text-align: center;
  587. font-size: 16px;
  588. //去除input number样式
  589. &::-webkit-outer-spin-button,
  590. &::-webkit-inner-spin-button {
  591. -webkit-appearance: none;
  592. }
  593. &[type="number"] {
  594. -moz-appearance: textfield;
  595. }
  596. }
  597. }
  598. }
  599. .textLeft {
  600. :deep(.el-textarea__inner) {
  601. border: none;
  602. border-radius: 0px;
  603. text-align: left !important;
  604. font-size: 16px;
  605. }
  606. }
  607. :depp(.el-input.is-disabled) {
  608. color: black !important;
  609. }
  610. :deep(.el-select .el-input.is-disabled .el-input__inner) {
  611. //项目名称字体颜色
  612. color: #000;
  613. }
  614. </style>