ExpenseApplyFor.vue 34 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072
  1. <template>
  2. <div>
  3. <!-- 搜索 -->
  4. <el-row class="top">
  5. <el-form
  6. v-model="queryFrom"
  7. size="small"
  8. label-width="95px"
  9. class="query-form"
  10. >
  11. <el-form-item label="转账状态" label-width="95px" prop="transferFlag">
  12. <el-select
  13. v-model="queryFrom.transferFlag"
  14. placeholder="请选择转账状态"
  15. clearable
  16. >
  17. <el-option label="已转账" value="0"></el-option>
  18. <el-option label="未转账" value="1"></el-option>
  19. </el-select>
  20. </el-form-item>
  21. <el-form-item label="账户性质" label-width="95px" prop="accountQuality">
  22. <el-select
  23. v-model="queryFrom.accountQuality"
  24. placeholder="请选择账户性质"
  25. clearable
  26. >
  27. <el-option
  28. v-for="item in account_qualityData"
  29. :key="item.value"
  30. :label="item.label"
  31. :value="item.value"
  32. ></el-option>
  33. </el-select>
  34. </el-form-item>
  35. <el-form-item label="申请人" label-width="95px" prop="applicant">
  36. <el-input
  37. v-model="queryFrom.applicant"
  38. placeholder="请输入申请人"
  39. class="widths"
  40. clearable
  41. ></el-input>
  42. </el-form-item>
  43. <el-form-item label="申请部门" label-width="95px" prop="applySector">
  44. <el-input
  45. v-model="queryFrom.applySector"
  46. placeholder="请输入申请部门"
  47. class="widths"
  48. clearable
  49. ></el-input>
  50. </el-form-item>
  51. <el-form-item label="申请日期" label-width="95px" prop="applyTime">
  52. <el-date-picker
  53. v-model="queryFrom.applyTime"
  54. type="date"
  55. placeholder="选择日期"
  56. >
  57. </el-date-picker>
  58. <!-- <el-input
  59. v-model="queryFrom.applyTime"
  60. placeholder="请输入申请部门"
  61. class="widths"
  62. clearable
  63. ></el-input> -->
  64. </el-form-item>
  65. <el-form-item>
  66. <el-button type="primary" size="small" @click="queryStaffInfo"
  67. >查询</el-button
  68. >
  69. </el-form-item>
  70. </el-form>
  71. </el-row>
  72. <!-- 申请按钮 -->
  73. <el-button
  74. class="operation"
  75. type="primary"
  76. plain
  77. size="medium"
  78. @click="showExpense"
  79. >资金使用申请单</el-button
  80. >
  81. <!-- 表格 -->
  82. <kt-common-table
  83. :operationWidth="operationWidth"
  84. class="ktTable"
  85. permsEdit="sys:agent:view"
  86. ref="dataTable"
  87. :data="pageResult"
  88. :columns="columns"
  89. editButtonName="编辑"
  90. button1Name="删除"
  91. :showBatchDelete="false"
  92. :showOperation="true"
  93. @findPage="findPage"
  94. :isshowpagination="true"
  95. @handleEdit="expendEdit"
  96. @handleButton1="expendDelete"
  97. ></kt-common-table>
  98. <!-- 申请资金弹框 -->
  99. <el-dialog
  100. class="dialog"
  101. :title="expendTitle"
  102. :close-on-click-modal="false"
  103. :before-close="resetForm"
  104. :visible.sync="expenseDialog"
  105. width="60%"
  106. >
  107. <div class="dialog-body">
  108. <el-form
  109. :model="tableForm"
  110. ref="tableForm"
  111. label-width="0px"
  112. class="demo-tableForm"
  113. >
  114. <el-row>
  115. <el-col :span="12">
  116. <el-form-item
  117. label="单位:"
  118. label-width="50px"
  119. prop="accountQuality"
  120. >
  121. <el-select
  122. v-model="tableForm.company"
  123. filterable
  124. placeholder="单位"
  125. >
  126. <el-option
  127. v-for="item in collectionData"
  128. :key="item.accountId"
  129. :label="item.name"
  130. :value="item.accountId"
  131. >
  132. </el-option>
  133. </el-select>
  134. </el-form-item>
  135. </el-col>
  136. <el-col style="display: flex; justify-content: end" :span="12">
  137. <el-button type="primary" @click="addUserFn" size="small"
  138. >新增账户信息</el-button
  139. >
  140. </el-col>
  141. </el-row>
  142. <table
  143. class="expense-table"
  144. width="100%"
  145. height="500"
  146. border="1"
  147. bordercolor="#71787f"
  148. align="center"
  149. cellspacing=""
  150. cellpadding="10"
  151. style="border-collapse: collapse"
  152. >
  153. <tr>
  154. <td class="td-title" colspan="1">申请人</td>
  155. <td class="td-content" colspan="1">
  156. <el-input
  157. type="text"
  158. resize="none"
  159. v-model="tableForm.applicant"
  160. ></el-input>
  161. </td>
  162. <td class="td-title" colspan="1">申请部门</td>
  163. <td class="td-content" colspan="1">
  164. <el-input
  165. type="text"
  166. resize="none"
  167. v-model="tableForm.applySector"
  168. ></el-input>
  169. </td>
  170. <td class="td-title" colspan="1">申请日期</td>
  171. <td class="td-content" colspan="1">
  172. <el-date-picker
  173. v-model="tableForm.applyTime"
  174. align="right"
  175. type="date"
  176. value-format="yyyy-MM-dd"
  177. :picker-options="pickerOptions"
  178. >
  179. </el-date-picker>
  180. </td>
  181. </tr>
  182. <tr>
  183. <td class="td-title" colspan="1">收款单位信息</td>
  184. <td class="td-content" colspan="5">
  185. <el-select
  186. v-model="tableForm.collectionMessage"
  187. filterable
  188. placeholder=""
  189. >
  190. <el-option
  191. v-for="item in collectionData"
  192. :key="item.accountId"
  193. :label="item.name"
  194. :value="item.accountId"
  195. >
  196. </el-option>
  197. </el-select>
  198. </td>
  199. </tr>
  200. <tr>
  201. <td class="td-title" colspan="1">资金流程</td>
  202. <td class="td-content" colspan="5">
  203. <div style="display: flex; align-items: center">
  204. <el-select
  205. v-model="tableForm.company"
  206. filterable
  207. disabled
  208. placeholder=""
  209. >
  210. <el-option
  211. v-for="item in collectionData"
  212. :key="item.accountId"
  213. :label="item.name"
  214. :value="item.accountId"
  215. >
  216. </el-option>
  217. </el-select>
  218. <i class="el-icon-right"></i>
  219. <el-select
  220. v-model="tableForm.collectionMessage"
  221. filterable
  222. disabled
  223. placeholder=""
  224. >
  225. <el-option
  226. v-for="item in collectionData"
  227. :key="item.accountId"
  228. :label="item.name"
  229. :value="item.accountId"
  230. >
  231. </el-option>
  232. </el-select>
  233. </div>
  234. </td>
  235. </tr>
  236. <tr>
  237. <td class="td-title" colspan="1">资金用途</td>
  238. <td class="td-content" colspan="3">
  239. <el-cascader
  240. v-model="tableForm.fundUse"
  241. :show-all-levels="false"
  242. :clearable="true"
  243. :checkStrictly="true"
  244. :emitPath="false"
  245. placeholder=""
  246. :options="fundFlowData"
  247. filterable
  248. :props="{
  249. children: 'child',
  250. label: 'category',
  251. value: 'category',
  252. }"
  253. ></el-cascader>
  254. </td>
  255. <td class="td-title" colspan="1">备注</td>
  256. <td class="td-content" colspan="1">
  257. <el-select v-model="tableForm.remark" placeholder="">
  258. <el-option
  259. v-for="item in use_fundsData"
  260. :key="item.value"
  261. :label="item.label"
  262. :value="item.value"
  263. >
  264. </el-option>
  265. </el-select>
  266. </td>
  267. </tr>
  268. <tr>
  269. <td class="td-title" colspan="1">申请金额(元)</td>
  270. <td class="td-content" colspan="2">
  271. <el-input-number
  272. v-model="tableForm.applyAmount"
  273. :min="0"
  274. :precision="2"
  275. @blur="chageAppl"
  276. :max="99999999999999999"
  277. label=""
  278. ></el-input-number>
  279. </td>
  280. <td class="td-title" colspan="1">大写金额</td>
  281. <td class="td-content idea-box" colspan="2">
  282. <el-input
  283. type="text"
  284. resize="none"
  285. v-model="tableForm.bigApplyAmount"
  286. disabled
  287. ></el-input>
  288. </td>
  289. </tr>
  290. <tr>
  291. <td class="td-title" colspan="1">支付方式</td>
  292. <td class="td-content" colspan="5">
  293. <el-checkbox-group v-model="tableForm.payMethod">
  294. <el-checkbox
  295. v-for="payItem in payment_methodsData"
  296. :key="payItem.value"
  297. :label="payItem.label"
  298. :value="payItem.value"
  299. :disabled="payItem.value == 2"
  300. ></el-checkbox>
  301. </el-checkbox-group>
  302. </td>
  303. </tr>
  304. <tr>
  305. <td class="td-title" rowspan="2" colspan="1">审核意见</td>
  306. <td class="td-title" colspan="2">公司领导</td>
  307. <td class="td-title" colspan="1">财务部</td>
  308. <td class="td-title" colspan="2">部门领导</td>
  309. </tr>
  310. <tr class="idea-box">
  311. <td class="td-content" colspan="2">
  312. <el-input
  313. type="text"
  314. resize="none"
  315. v-model="tableForm.desc"
  316. disabled
  317. ></el-input>
  318. </td>
  319. <td class="td-content" colspan="1">
  320. <el-input
  321. type="text"
  322. resize="none"
  323. v-model="tableForm.desc"
  324. disabled
  325. ></el-input>
  326. </td>
  327. <td class="td-content" colspan="2">
  328. <el-input
  329. type="text"
  330. resize="none"
  331. v-model="tableForm.desc"
  332. disabled
  333. ></el-input>
  334. </td>
  335. </tr>
  336. </table>
  337. </el-form>
  338. </div>
  339. <div slot="footer" class="dialog-footer">
  340. <el-button @click="resetForm" size="small">取 消</el-button>
  341. <el-button
  342. v-if="expendDataId"
  343. @click="expendDataup"
  344. type="primary"
  345. size="small"
  346. >导 出</el-button
  347. >
  348. <el-button type="primary" @click="submitForm" size="small">{{
  349. buttonValue
  350. }}</el-button>
  351. </div>
  352. </el-dialog>
  353. <!-- 新增账户弹框 -->
  354. <expense-component
  355. ref="expenseComponent"
  356. :formData="formData"
  357. :title="title"
  358. :dialogFormVisible="dialogFormVisible"
  359. @resetForm="closeForm"
  360. @submitForm="submitUserForm"
  361. @setDateInterval="setDateInterval"
  362. @outChange="outChange"
  363. class="expense-component"
  364. ></expense-component>
  365. </div>
  366. </template>
  367. <script>
  368. import ExpenseComponent from "./ExpenseComponent.vue"; //新增账户信息弹框
  369. import KtCommonTable from "@/views/Core/KtCommonTable.vue"; //表格组件
  370. import {toChies} from '../../../utils/moneyTransition';
  371. export default {
  372. name: "ExpenseApplyFor",
  373. components: { KtCommonTable, ExpenseComponent },
  374. data() {
  375. return {
  376. expendTitle: "新增资金使用申请单", //弹框标题
  377. operationWidth: 200, //操作单元格宽度
  378. queryFrom: {}, //查询form表单
  379. pageRequest: {
  380. // 列表查询条件
  381. pageNo: 1,
  382. pageSize: 10,
  383. },
  384. dialogFormVisible: false, //账户信息弹出框状态
  385. title: "新增账户信息", //账户信息弹框标题
  386. expenseDialog: false, //申请单显示状态
  387. pageResult: {
  388. pageNo: 1,
  389. pageSize: 10,
  390. content: [],
  391. }, //表格参数
  392. columns: [
  393. // 申请列表表格头部
  394. {
  395. prop: "transferFlagName",
  396. label: "转账状态",
  397. minWidth: 80,
  398. sortable: false,
  399. },
  400. {
  401. prop: "applicant",
  402. label: "申请人",
  403. minWidth: 80,
  404. sortable: false,
  405. },
  406. {
  407. prop: "applySector",
  408. label: "申请部门",
  409. minWidth: 100,
  410. sortable: false,
  411. },
  412. {
  413. prop: "applyTime",
  414. label: "申请日期",
  415. minWidth: 100,
  416. sortable: false,
  417. },
  418. {
  419. prop: "applyAmount",
  420. label: "申请金额(元)",
  421. minWidth: 120,
  422. sortable: false,
  423. },
  424. {
  425. prop: "bigApplyAmount",
  426. label: "大写金额",
  427. minWidth: 150,
  428. sortable: false,
  429. },
  430. {
  431. prop: "company",
  432. label: "单位",
  433. minWidth: 260,
  434. sortable: false,
  435. },
  436. {
  437. prop: "collectionMessage",
  438. label: "收款单位信息",
  439. minWidth: 260,
  440. sortable: false,
  441. },
  442. {
  443. prop: "fundFlow",
  444. label: "资金流程",
  445. minWidth: 460,
  446. sortable: false,
  447. },
  448. {
  449. prop: "fundUse",
  450. label: "资金用途",
  451. minWidth: 100,
  452. sortable: false,
  453. },
  454. {
  455. prop: "remark",
  456. label: "备注",
  457. minWidth: 100,
  458. sortable: false,
  459. },
  460. {
  461. prop: "payMethod",
  462. label: "支付方式",
  463. minWidth: 160,
  464. sortable: false,
  465. },
  466. ],
  467. formData: {
  468. outerFlag: "0", //账户类别
  469. accountName: "", //户名
  470. accountQuality: "", //账户性质
  471. bankCardNum: "", //银行卡号
  472. bank: "", //开户行
  473. bankName: "", //开户行名称
  474. bankNum: "", //开户行号
  475. certExpirationDate: "", //证书有效期
  476. clearingProfit: "", //结算卡
  477. dayStrokeNum: "", //单日转账笔数限制
  478. exteriorProfit: "", //外部过账金额
  479. fiscalProfit: "", //财税公司利润
  480. insuranceProfit: "", //保险公司回款
  481. otherProfit: "", //其他利润
  482. parkProfit: "", //园区利润
  483. priDayLines: "", //对私单日限额
  484. priSingleLines: "", //对私单笔限额
  485. priYearExcess: "", //对私年剩余额度
  486. priYearLines: "", //对私年额度
  487. pubDayLines: "", //对公单日限额
  488. pubSingleLines: "", //对公单笔限额
  489. pubYearExcess: "", //对公年剩余额度
  490. pubYearLines: "", //对公年额度
  491. tianqinProfit: "", //天勤利润
  492. },
  493. pickerOptions: {
  494. //日期快捷键
  495. disabledDate(time) {
  496. return time.getTime() > Date.now();
  497. },
  498. shortcuts: [
  499. {
  500. text: "今天",
  501. onClick(picker) {
  502. picker.$emit("pick", new Date());
  503. },
  504. },
  505. {
  506. text: "昨天",
  507. onClick(picker) {
  508. const date = new Date();
  509. date.setTime(date.getTime() - 3600 * 1000 * 24);
  510. picker.$emit("pick", date);
  511. },
  512. },
  513. {
  514. text: "一周前",
  515. onClick(picker) {
  516. const date = new Date();
  517. date.setTime(date.getTime() - 3600 * 1000 * 24 * 7);
  518. picker.$emit("pick", date);
  519. },
  520. },
  521. ],
  522. },
  523. //新增申请表单form表单
  524. tableForm: {
  525. company: "", //单位
  526. applicant: "", //申请人
  527. applySector: "", //申请部门
  528. applyTime: "", //申请日期
  529. collectionMessage: "", //收款单位信息
  530. fundFlow: "", //资金流程
  531. fundUse: "", //资金用途
  532. remark: "", //备注
  533. applyAmount: "", //申请金额
  534. bigApplyAmount: "", //大写金额
  535. payMethod: [], //支付方式
  536. remark: "", //备注
  537. },
  538. payment_methodsData: [], //支付方式字典数据
  539. use_fundsData: [], //备注字典数据
  540. collectionData: [], //收款单位信息数据
  541. account_qualityData: [], //账户性质字典
  542. fundFlowData: [], //资金用途字典数据
  543. tableRules: {
  544. //资金申请单规则
  545. name: [
  546. { required: true, message: "请输入活动名称", trigger: "blur" },
  547. { min: 3, max: 5, message: "长度在 3 到 5 个字符", trigger: "blur" },
  548. ],
  549. region: [
  550. { required: true, message: "请选择活动区域", trigger: "change" },
  551. ],
  552. date1: [
  553. {
  554. type: "date",
  555. required: true,
  556. message: "请选择日期",
  557. trigger: "change",
  558. },
  559. ],
  560. date2: [
  561. {
  562. type: "date",
  563. required: true,
  564. message: "请选择时间",
  565. trigger: "change",
  566. },
  567. ],
  568. type: [
  569. {
  570. type: "array",
  571. required: true,
  572. message: "请至少选择一个活动性质",
  573. trigger: "change",
  574. },
  575. ],
  576. resource: [
  577. { required: true, message: "请选择活动资源", trigger: "change" },
  578. ],
  579. desc: [{ required: true, message: "请填写活动形式", trigger: "blur" }],
  580. },
  581. companyItem: {}, //选择单位整条数据
  582. collectionMessageItem: {}, //选择收款单位整条数据
  583. expendDataId: "", //修改时该条数据id
  584. buttonValue: "导 出", //弹框提交按钮内容
  585. };
  586. },
  587. watch: {
  588. expenseDialog(n) {
  589. if (!n) {
  590. this.tableForm = {
  591. company: "", //单位
  592. applicant: "", //申请人
  593. applySector: "", //申请部门
  594. applyTime: "", //申请日期
  595. collectionMessage: "", //收款单位信息
  596. fundFlow: "", //资金流程
  597. fundUse: "", //资金用途
  598. remark: "", //备注
  599. applyAmount: "", //申请金额
  600. bigApplyAmount: "", //大写金额
  601. payMethod: [], //支付方式
  602. remark: "", //备注
  603. };
  604. this.tableForm.payMethod = [
  605. this.payment_methodsData.find((item) => item.value == 2).label,
  606. ];
  607. this.expendDataId = "";
  608. }
  609. },
  610. },
  611. created() {
  612. this.business("use_funds"); //备注字典
  613. this.business("payment_methods"); //支付方式字典
  614. this.business("account_quality"); //账户性质字典
  615. this.getTreeList(); //获取资金用途树字典
  616. this.getAllUser(); //获取所有银行账户信息
  617. },
  618. mounted() {},
  619. methods: {
  620. //导出
  621. expendDataup(idList) {
  622. if (this.expendDataId) {
  623. let url = process.env.BASE_URL + "/upload/" + this.tableForm.uplodePath; // 3.创建一个临时的url指向blob对象
  624. // 4.创建url之后可以模拟对此文件对象的一系列操作,例如:预览、下载
  625. let a = document.createElement("a");
  626. a.href = url;
  627. a.download = "资金使用申请单.xlsx";
  628. a.click();
  629. // 5.释放这个临时的对象url
  630. window.URL.revokeObjectURL(url);
  631. this.resetForm();
  632. this.findPage();
  633. } else {
  634. this.$api.expense.excel(idList).then((response) => {
  635. if (response.code == 200) {
  636. response.data.forEach((data) => {
  637. this.resetForm();
  638. this.findPage();
  639. let url = process.env.BASE_URL + "/upload/" + data.uplodePath; // 3.创建一个临时的url指向blob对象
  640. // 4.创建url之后可以模拟对此文件对象的一系列操作,例如:预览、下载
  641. let a = document.createElement("a");
  642. a.href = url;
  643. a.download = "资金使用申请单.xlsx";
  644. a.click();
  645. // 5.释放这个临时的对象url
  646. window.URL.revokeObjectURL(url);
  647. });
  648. } else {
  649. this.$message.error(response.msg);
  650. }
  651. });
  652. }
  653. },
  654. //点击编辑按钮
  655. expendEdit(index) {
  656. let row = index.row;
  657. if (row.transferFlag == 0) {
  658. this.$message.error("已转账数据不能操作");
  659. return;
  660. }
  661. this.expendDataId = row.excelAccountOperateId;
  662. this.$api.expense
  663. .getAccountExcelById(row.excelAccountOperateId)
  664. .then((res) => {
  665. if (res.code == 200) {
  666. this.tableForm = JSON.parse(JSON.stringify(res.data));
  667. this.tableForm.payMethod = this.tableForm.payMethod.split(",");
  668. this.tableForm.collectionMessage = res.data.enterAccountId;
  669. this.tableForm.company = res.data.outAccountId;
  670. let obj = this.fundFlowData.find((item) =>
  671. item.child.find(
  672. (chidlItem) => chidlItem.category == this.tableForm.fundUse
  673. )
  674. );
  675. this.tableForm.fundUse = [
  676. obj.category,
  677. obj.child.find((item) => item.category == this.tableForm.fundUse)
  678. .category,
  679. ];
  680. } else {
  681. this.$message.error(res.msg);
  682. }
  683. });
  684. this.expendTitle = "编辑资金使用申请单";
  685. this.buttonValue = "确认提交";
  686. this.expenseDialog = true;
  687. },
  688. //删除数据事件
  689. expendDelete(index) {
  690. let row = index.row;
  691. if (row.transferFlag == 0) {
  692. this.$message.error("已转账数据不能操作");
  693. return;
  694. }
  695. this.$confirm("确认删除该条数据吗?", "提示", {
  696. type: "warning",
  697. })
  698. .then(() => {
  699. this.$api.expense
  700. .deleteAccountExcel(index.row.excelAccountOperateId)
  701. .then((res) => {
  702. if (res.code == 200) {
  703. this.$message.success("删除成功");
  704. this.findPage();
  705. } else {
  706. this.$message.error(res.msg);
  707. }
  708. });
  709. })
  710. .catch(() => {});
  711. },
  712. //获取资金用途树数据
  713. getTreeList() {
  714. this.$api.expense.getAccountExpensesTreeList().then((res) => {
  715. let arr = res.data;
  716. res.data.forEach((item) => {
  717. item.child.forEach((childItem) => {
  718. delete childItem.child;
  719. });
  720. });
  721. this.fundFlowData = res.data;
  722. });
  723. },
  724. //搜索列表功能
  725. queryStaffInfo() {
  726. this.findPage();
  727. },
  728. //查询列表
  729. findPage(data) {
  730. if (data && data.pageRequest) {
  731. this.pageRequest.pageNo = data.pageRequest.pageNum;
  732. this.pageRequest.pageSize = data.pageRequest.pageSize;
  733. }
  734. let obj = { ...this.queryFrom, ...this.pageRequest };
  735. this.$api.expense
  736. .getAccountExcel(obj)
  737. .then((res) => {
  738. res.data.records.forEach((element) => {
  739. element.transferFlagName =
  740. element.transferFlag == 0 ? "已转账" : "未转账";
  741. this.use_fundsData.forEach((item) => {
  742. if (element.remark == item.value) {
  743. element.remarkName = item.label;
  744. }
  745. });
  746. });
  747. this.pageResult = {
  748. content: res.data.records,
  749. pageNum: res.data.current,
  750. pageSize: res.data.size,
  751. totalPages: res.data.pages,
  752. totalSize: res.data.total,
  753. };
  754. })
  755. .then(data != null ? data.callback : "");
  756. },
  757. //选择证书有效日期区间
  758. setDateInterval(e) {
  759. if (e != null && e != "") {
  760. this.formData.startCertExpirationDate = e[0];
  761. this.formData.endCertExpirationDate = e[1];
  762. } else {
  763. this.formData.startCertExpirationDate = "";
  764. this.formData.endCertExpirationDate = "";
  765. }
  766. },
  767. //新增用户信息提交
  768. submitUserForm() {
  769. let params = JSON.parse(JSON.stringify(this.formData));
  770. delete params.certExpirationDate;
  771. //新增
  772. this.$api.expense.insertAccount(params).then((res) => {
  773. if (res.code == 200) {
  774. this.$message({
  775. message: "添加成功",
  776. type: "success",
  777. });
  778. } else {
  779. this.$message({
  780. message: `添加失败, ${res.msg}`,
  781. type: "error",
  782. });
  783. }
  784. this.getAllUser();
  785. this.closeForm();
  786. });
  787. },
  788. //弹框重新赋值
  789. outChange(e) {
  790. if (e == 1) {
  791. this.formData = {
  792. outerFlag: e, //账户类别
  793. accountName: this.formData.accountName, //户名
  794. accountQuality: this.formData.accountQuality, //账户性质
  795. bankCardNum: this.formData.bankCardNum, //银行卡号
  796. bank: this.formData.bank, //开户行
  797. };
  798. } else {
  799. this.formData = {
  800. outerFlag: e, //账户类别
  801. accountName: this.formData.accountName, //户名
  802. accountQuality: this.formData.accountQuality, //账户性质
  803. bankCardNum: this.formData.bankCardNum, //银行卡号
  804. bank: this.formData.bank, //开户行
  805. bankName: "", //开户行名称
  806. bankNum: "", //开户行号
  807. certExpirationDate: "", //证书有效期
  808. clearingProfit: "", //结算卡
  809. dayStrokeNum: "", //单日转账笔数限制
  810. exteriorProfit: "", //外部过账金额
  811. fiscalProfit: "", //财税公司利润
  812. insuranceProfit: "", //保险公司回款
  813. otherProfit: "", //其他利润
  814. parkProfit: "", //园区利润
  815. priDayLines: "", //对私单日限额
  816. priSingleLines: "", //对私单笔限额
  817. priYearExcess: "", //对私年剩余额度
  818. priYearLines: "", //对私年额度
  819. pubDayLines: "", //对公单日限额
  820. pubSingleLines: "", //对公单笔限额
  821. pubYearExcess: "", //对公年剩余额度
  822. pubYearLines: "", //对公年额度
  823. tianqinProfit: "", //天勤利润
  824. };
  825. }
  826. },
  827. //弹框取消重置
  828. closeForm() {
  829. this.dialogFormVisible = false;
  830. this.formData = {
  831. outerFlag: "0", //账户类别
  832. accountName: "", //户名
  833. accountQuality: "", //账户性质
  834. bankCardNum: "", //银行卡号
  835. bank: "", //开户行
  836. bankName: "", //开户行名称
  837. bankNum: "", //开户行号
  838. certExpirationDate: "", //证书有效期
  839. clearingProfit: "", //结算卡
  840. dayStrokeNum: "", //单日转账笔数限制
  841. exteriorProfit: "", //外部过账金额
  842. fiscalProfit: "", //财税公司利润
  843. insuranceProfit: "", //保险公司回款
  844. otherProfit: "", //其他利润
  845. parkProfit: "", //园区利润
  846. priDayLines: "", //对私单日限额
  847. priSingleLines: "", //对私单笔限额
  848. priYearExcess: "", //对私年剩余额度
  849. priYearLines: "", //对私年额度
  850. pubDayLines: "", //对公单日限额
  851. pubSingleLines: "", //对公单笔限额
  852. pubYearExcess: "", //对公年剩余额度
  853. pubYearLines: "", //对公年额度
  854. tianqinProfit: "", //天勤利润
  855. };
  856. },
  857. //新增账户信息
  858. addUserFn() {
  859. this.dialogFormVisible = true;
  860. },
  861. //选择收款单位信息事件
  862. collectionChange(e) {
  863. if (e.length > 0) {
  864. let obj = this.collectionData
  865. .find((item) => item.accountId == e[0])
  866. .children.find((item) => item.accountId == e[1]);
  867. }
  868. },
  869. //获取所有账户信息
  870. getAllUser() {
  871. this.$api.expense.getAccountByAccountName().then((res) => {
  872. if (res.code == 200) {
  873. res.data.forEach((item, index) => {
  874. item.name =
  875. (item.outerFlag == 0 ? "内部用户" : "外部用户") +
  876. " " +
  877. (item.accountQuality == 0 ? "公户" : "私户") +
  878. " " +
  879. item.accountName +
  880. " " +
  881. item.bankCardNum +
  882. " " +
  883. item.bank;
  884. item.nameValue =
  885. item.accountName + " " + item.bankCardNum + " " + item.bank;
  886. });
  887. this.collectionData = res.data;
  888. }
  889. });
  890. },
  891. //申请金额填写完成后
  892. chageAppl(e) {
  893. this.tableForm.bigApplyAmount = toChies(this.tableForm.applyAmount);
  894. },
  895. //数据字典
  896. business(typeName) {
  897. this.$api.dict.findByLableName(typeName).then((res) => {
  898. this[typeName + "Data"] = res.data;
  899. if (typeName == "payment_methods") {
  900. this.tableForm.payMethod = [
  901. this[typeName + "Data"].find((item) => item.value == 2).label,
  902. ];
  903. }
  904. });
  905. },
  906. //费用申请弹框
  907. showExpense() {
  908. this.expendTitle = "新增资金使用申请单";
  909. this.buttonValue = "导 出";
  910. this.expenseDialog = true;
  911. },
  912. //取消隐藏弹框
  913. resetForm() {
  914. this.expenseDialog = false;
  915. },
  916. //导出事件
  917. submitForm() {
  918. let params = JSON.parse(JSON.stringify(this.tableForm));
  919. //校验
  920. if (!params.company) {
  921. this.$message.error("请选择单位");
  922. return;
  923. } else if (!params.applicant) {
  924. this.$message.error("申请人不能为空");
  925. return;
  926. } else if (!params.applySector) {
  927. this.$message.error("申请部门不能为空");
  928. return;
  929. } else if (!params.applyTime) {
  930. this.$message.error("请填写申请日期");
  931. return;
  932. } else if (!params.collectionMessage) {
  933. this.$message.error("请选择收款单位信息");
  934. return;
  935. } else if (!params.fundUse) {
  936. this.$message.error("请选择资金用途");
  937. return;
  938. } else if (params.applyAmount == 0) {
  939. this.$message.error("请填写金额");
  940. return;
  941. }
  942. params.payMethod = this.toPayment(params.payMethod); //支付方式转换
  943. let companyItem = this.collectionData.find(
  944. (item) => item.accountId === params.company
  945. );
  946. let collectionMessageItem = this.collectionData.find(
  947. (item) => item.accountId === params.collectionMessage
  948. );
  949. params.company = companyItem.nameValue; //单位
  950. params.outAccountId = companyItem.accountId; //支出账户id
  951. params.outFlag = collectionMessageItem.outerFlag; //支出账户性质
  952. params.collectionMessage = collectionMessageItem.nameValue; //收入账户信息
  953. params.enterAccountId = collectionMessageItem.accountId; //收入账户id
  954. params.fundUse = params.fundUse[params.fundUse.length - 1]; //资金用途
  955. params.fundFlow = params.company + "→" + params.collectionMessage; //资金流程
  956. if (this.expendDataId) {
  957. //修改
  958. params.expendDataId = this.expendDataId;
  959. this.$api.expense.update(params).then((res) => {
  960. if (res.code == 200) {
  961. this.resetForm();
  962. this.findPage();
  963. } else {
  964. this.$message.error(res.msg);
  965. }
  966. });
  967. } else {
  968. //新增+导出
  969. this.$api.expense.insert(params).then((res) => {
  970. if (res.code == 200) {
  971. this.expendDataup([res.data]);
  972. } else {
  973. this.$message.error(res.msg);
  974. }
  975. });
  976. }
  977. },
  978. //支付方式转换
  979. toPayment(list) {
  980. let newList = [];
  981. list.forEach((item) => {
  982. let newItem = this.payment_methodsData.find(
  983. (payItem) => payItem.label == item
  984. );
  985. if (newItem) {
  986. newList.push(newItem.value);
  987. }
  988. });
  989. newList.sort();
  990. newList = newList.join(",");
  991. return newList;
  992. },
  993. },
  994. };
  995. </script>
  996. <style scoped>
  997. .query-form {
  998. display: flex;
  999. align-items: center;
  1000. margin-top: 14px;
  1001. }
  1002. .td-title,
  1003. .demo-tableForm >>> .el-form-item__label {
  1004. color: #323335;
  1005. font-weight: bold;
  1006. text-align: center;
  1007. }
  1008. .td-content,
  1009. .demo-tableForm >>> .el-input.is-disabled .el-input__inner {
  1010. color: #474545;
  1011. }
  1012. .expense-table >>> .el-textarea__inner,
  1013. .expense-table >>> .el-input__inner {
  1014. border: none;
  1015. padding: 0;
  1016. text-align: center;
  1017. }
  1018. .expense-table >>> .el-form-item {
  1019. margin: 0;
  1020. padding: 0;
  1021. }
  1022. .expense-table >>> .el-checkbox-group,
  1023. .expense-table >>> .el-date-editor,
  1024. .expense-table >>> .el-select,
  1025. .expense-table >>> .el-input-number,
  1026. .expense-table >>> .el-cascader,
  1027. .demo-tableForm >>> .el-select {
  1028. width: 100%;
  1029. text-align: center;
  1030. }
  1031. .demo-tableForm >>> .el-input__inner {
  1032. border: none;
  1033. }
  1034. .demo-tableForm >>> .el-input__prefix,
  1035. .demo-tableForm >>> .el-select__caret {
  1036. display: none;
  1037. }
  1038. .idea-box >>> .el-input.is-disabled .el-input__inner,
  1039. .expense-table >>> .el-input.is-disabled .el-input__inner {
  1040. background-color: #fff;
  1041. }
  1042. .demo-tableForm >>> .el-input-number__decrease,
  1043. .demo-tableForm >>> .el-input-number__increase {
  1044. display: none;
  1045. }
  1046. .demo-tableForm >>> .el-checkbox__input.is-disabled + span.el-checkbox__label {
  1047. color: #409eff;
  1048. }
  1049. .demo-tableForm
  1050. >>> .el-checkbox__input.is-disabled.is-checked
  1051. .el-checkbox__inner {
  1052. background-color: #409eff;
  1053. border-color: #409eff;
  1054. color: #fff;
  1055. }
  1056. .demo-tableForm
  1057. >>> .el-checkbox__input.is-disabled.is-checked
  1058. .el-checkbox__inner::after {
  1059. border-color: #fff;
  1060. }
  1061. .demo-tableForm >>> .el-input__suffix {
  1062. display: none;
  1063. }
  1064. .el-icon-right {
  1065. font-size: 20px;
  1066. }
  1067. .operation {
  1068. margin-bottom: 15px;
  1069. }
  1070. </style>